vue-chrts 0.2.4 → 0.2.5-test.2

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,17 +1,10 @@
1
1
  import { LineChartProps } 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
- props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
4
- readonly onClick?: ((event: MouseEvent, values?: T | undefined) => any) | undefined;
5
- } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onClick"> & LineChartProps<T> & Partial<{}>> & import('vue').PublicProps;
3
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & LineChartProps<T> & Partial<{}>> & import('vue').PublicProps;
6
4
  expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
7
5
  attrs: any;
8
- slots: {
9
- tooltip?(_: {
10
- values: T | undefined;
11
- }): any;
12
- fallback?(_: {}): any;
13
- };
14
- emit: (e: "click", event: MouseEvent, values?: T) => void;
6
+ slots: Partial<Record<number, (_: any) => any>>;
7
+ emit: {};
15
8
  }>) => import('vue').VNode & {
16
9
  __ctx?: Awaited<typeof __VLS_setup>;
17
10
  };
@@ -1,140 +1,2 @@
1
- import { axisFormatter, BulletLegendItemInterface, CrosshairConfig, CurveType, LegendPosition, MarkerConfig } from '../../types';
2
- export interface LineChartProps<T> {
3
- /**
4
- * The data to be displayed in the line chart.
5
- * Each element of the array represents a data point.
6
- * The structure of 'T' should be compatible with the chart's rendering logic.
7
- */
8
- data: T[];
9
- /**
10
- * The height of the chart in pixels.
11
- */
12
- height: number;
13
- /**
14
- * Optional label for the x-axis.
15
- */
16
- xLabel?: string;
17
- /**
18
- * Optional label for the y-axis.
19
- */
20
- yLabel?: string;
21
- /**
22
- * Optional padding applied to the chart.
23
- * Allows specifying individual padding values for the top, right, bottom, and left sides.
24
- */
25
- padding?: {
26
- top: number;
27
- right: number;
28
- bottom: number;
29
- left: number;
30
- };
31
- /**
32
- * A record mapping category keys to `BulletLegendItemInterface` objects.
33
- * This defines the visual representation and labels for each category in the chart's legend.
34
- */
35
- categories: Record<string, BulletLegendItemInterface>;
36
- /**
37
- * A record mapping marker keys to show custom patterns.
38
- */
39
- markerConfig?: Record<string, MarkerConfig>;
40
- /**
41
- * @param {number|Date} tick - The value of the tick. This can be a number or a Date object depending on the scale of the x-axis.
42
- * @param {number} i - The index of the tick in the `ticks` array.
43
- * @param {(number[]|Date[])} ticks - An array of all tick values for the x-axis.
44
- * @returns {string} The formatted string representation of the tick.
45
- */
46
- xFormatter?: axisFormatter;
47
- /**
48
- * @param {number|Date} tick - The value of the tick. This can be a number or a Date object depending on the scale of the y-axis.
49
- * @param {number} i - The index of the tick in the `ticks` array.
50
- * @param {(number[]|Date[])} ticks - An array of all tick values for the y-axis.
51
- * @returns {string} The formatted string representation of the tick.
52
- */
53
- yFormatter?: axisFormatter;
54
- /**
55
- * The type of curve to use for the line chart.
56
- * See `CurveType` for available options.
57
- */
58
- curveType?: CurveType;
59
- /**
60
- * The width of the line in pixels. Default is 2px.
61
- */
62
- lineWidth?: number;
63
- /**
64
- * Line dash array, see SVG's stroke-dasharray. Default: `undefined`
65
- */
66
- lineDashArray?: number[][];
67
- /**
68
- * The desired number of ticks on the x-axis.
69
- */
70
- xNumTicks?: number;
71
- /**
72
- * Force specific ticks on the x-axis.
73
- */
74
- xExplicitTicks?: (number | string | Date)[];
75
- /**
76
- * Force only first and last ticks on the x-axis.
77
- */
78
- minMaxTicksOnly?: boolean;
79
- /**
80
- * The desired number of ticks on the y-axis.
81
- */
82
- yNumTicks?: number;
83
- /**
84
- * If `true`, hides the chart tooltip.
85
- */
86
- hideTooltip?: boolean;
87
- /**
88
- * If `true`, hides the chart legend.
89
- */
90
- hideLegend?: boolean;
91
- /**
92
- * Optional position for the legend, if applicable.
93
- * See `LegendPosition` for available options.
94
- */
95
- legendPosition?: LegendPosition;
96
- /**
97
- * If `true`, displays grid lines along the x-axis.
98
- */
99
- xGridLine?: boolean;
100
- /**
101
- * If `true`, displays a domain line (axis line) along the x-axis.
102
- */
103
- xDomainLine?: boolean;
104
- /**
105
- * If `true`, displays grid lines along the y-axis.
106
- */
107
- yGridLine?: boolean;
108
- /**
109
- * If `true`, displays a domain line (axis line) along the y-axis.
110
- */
111
- yDomainLine?: boolean;
112
- /**
113
- * If `true`, displays tick lines on the x-axis.
114
- */
115
- xTickLine?: boolean;
116
- /**
117
- * If `true`, displays tick lines on the y-axis.
118
- */
119
- yTickLine?: boolean;
120
- /**
121
- * If `true`, hide the x-axis.
122
- */
123
- hideXAxis?: boolean;
124
- /**
125
- * If `true`, hide the y-axis.
126
- */
127
- hideYAxis?: boolean;
128
- /**
129
- * Crosshair configuration object for customizing the appearance of the crosshair line.
130
- */
131
- crosshairConfig?: CrosshairConfig;
132
- /**
133
- * The domain for the y-axis, specified as a tuple of two values.
134
- */
135
- yDomain?: [number | undefined, number | undefined];
136
- /**
137
- * The domain for the x-axis, specified as a tuple of two values.
138
- */
139
- xDomain?: [number | undefined, number | undefined];
140
- }
1
+ import { AreaChartProps } from '../AreaChart/types';
2
+ export type LineChartProps<T> = Omit<AreaChartProps<T>, "hideArea" | "gradientStops">;
@@ -1,11 +1,11 @@
1
- import { defineComponent as y, computed as f, 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 x = { style: { padding: "10px 15px" } }, _ = { style: {
1
+ import { defineComponent as v, computed as y, createElementBlock as i, openBlock as l, createElementVNode as o, toDisplayString as n, Fragment as b, renderList as f, normalizeStyle as a } from "vue";
2
+ const h = { style: { padding: "10px 15px" } }, B = { style: {
3
3
  color: "var(--tooltip-value-color)",
4
4
  textTransform: "capitalize",
5
- borderBottom: "1px solid rgba(255, 255, 255, 0.05)",
5
+ borderBottom: "borderBottom: 1px solid var(--tooltip-border-color)",
6
6
  marginBottom: "0.25rem",
7
7
  paddingBottom: "0.25rem"
8
- } }, T = /* @__PURE__ */ y({
8
+ } }, F = /* @__PURE__ */ v({
9
9
  __name: "Tooltip",
10
10
  props: {
11
11
  data: {},
@@ -13,30 +13,30 @@ const x = { style: { padding: "10px 15px" } }, _ = { style: {
13
13
  toolTipTitle: {},
14
14
  yFormatter: { type: Function }
15
15
  },
16
- setup(d) {
17
- const a = d, m = ["_index", "_stacked", "_ending"], g = f(() => Object.entries(a.data ?? []).filter(
18
- ([t, u]) => !m.includes(t) && Object.keys(a.categories).includes(t)
16
+ setup(t) {
17
+ const c = t, g = ["_index", "_stacked", "_ending"], p = y(() => Object.entries(c.data ?? []).filter(
18
+ ([r, u]) => !g.includes(r) && Object.keys(c.categories).includes(r)
19
19
  ));
20
- return (t, u) => (i(), r("div", x, [
21
- e("div", _, l(t.toolTipTitle), 1),
22
- (i(!0), r(h, null, b(g.value, ([o, s], v) => {
23
- var p, c;
24
- return i(), r("div", {
25
- key: o,
20
+ return (r, u) => (l(), i("div", h, [
21
+ o("div", B, n(t.toolTipTitle), 1),
22
+ (l(!0), i(b, null, f(p.value, ([e, s], x) => {
23
+ var d, m;
24
+ return l(), i("div", {
25
+ key: e,
26
26
  style: { display: "flex", "align-items": "center", "margin-bottom": "4px" }
27
27
  }, [
28
- e("span", {
29
- style: n([{ width: "8px", height: "8px", "border-radius": "4px", "margin-right": "8px" }, {
30
- backgroundColor: typeof ((p = t.categories[o]) == null ? void 0 : p.color) == "string" && ((c = t.categories[o]) != null && c.color) ? t.categories[o].color : `var(--vis-color${v})`
28
+ o("span", {
29
+ style: a([{ width: "8px", height: "8px", "border-radius": "4px", "margin-right": "8px" }, {
30
+ backgroundColor: typeof ((d = t.categories[e]) == null ? void 0 : d.color) == "string" && ((m = t.categories[e]) != null && m.color) ? t.categories[e].color : `var(--vis-color${x})`
31
31
  }])
32
32
  }, null, 4),
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)
33
+ o("div", null, [
34
+ o("span", {
35
+ style: a([{ "font-weight": "600", "margin-right": "8px" }, { color: "var(--tooltip-label-color)" }])
36
+ }, n(t.categories[e].name) + ":", 1),
37
+ o("span", {
38
+ style: a([{ "font-weight": "400" }, { color: "var(--tooltip-value-color)" }])
39
+ }, n(t.yFormatter ? t.yFormatter(s) : s), 1)
40
40
  ])
41
41
  ]);
42
42
  }), 128))
@@ -44,5 +44,5 @@ const x = { style: { padding: "10px 15px" } }, _ = { style: {
44
44
  }
45
45
  });
46
46
  export {
47
- T as default
47
+ F as default
48
48
  };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,8 @@
1
1
  import { default as AreaChart } from './components/AreaChart/AreaChart.vue';
2
- import { default as AreaStackedChart } from './components/AreaStackedChart/AreaStackedChart.vue';
3
2
  import { default as LineChart } from './components/LineChart/LineChart.vue';
4
3
  import { default as BarChart } from './components/BarChart/BarChart.vue';
5
4
  import { default as DonutChart } from './components/DonutChart/DonutChart.vue';
6
5
  import { default as BubbleChart } from './components/BubbleChart/BubbleChart.vue';
7
6
  import { LegendPosition, CurveType, Orientation, BulletLegendItemInterface, MarkerConfig, CrosshairConfig } from './types';
8
- export { AreaChart, AreaStackedChart, LineChart, BarChart, DonutChart, BubbleChart, Orientation, CurveType, LegendPosition };
7
+ export { AreaChart, LineChart, BarChart, DonutChart, BubbleChart, Orientation, CurveType, LegendPosition };
9
8
  export type { BulletLegendItemInterface, MarkerConfig, CrosshairConfig };
package/dist/index.js CHANGED
@@ -1,18 +1,16 @@
1
- import { default as a } from "./components/AreaChart/AreaChart.js";
2
- import { default as o } from "./components/AreaStackedChart/AreaStackedChart.js";
3
- import { default as u } from "./components/LineChart/LineChart.js";
4
- import { default as p } from "./components/BarChart/BarChart.js";
5
- import { default as m } from "./components/DonutChart/DonutChart.js";
6
- import { default as x } from "./components/BubbleChart/BubbleChart.js";
7
- import { CurveType as h, LegendPosition as n, Orientation as i } from "./types.js";
1
+ import { default as e } from "./components/AreaChart/AreaChart.js";
2
+ import { default as o } from "./components/LineChart/LineChart.js";
3
+ import { default as u } from "./components/BarChart/BarChart.js";
4
+ import { default as d } from "./components/DonutChart/DonutChart.js";
5
+ import { default as m } from "./components/BubbleChart/BubbleChart.js";
6
+ import { CurveType as s, LegendPosition as x, Orientation as C } from "./types.js";
8
7
  export {
9
- a as AreaChart,
10
- o as AreaStackedChart,
11
- p as BarChart,
12
- x as BubbleChart,
13
- h as CurveType,
14
- m as DonutChart,
15
- n as LegendPosition,
16
- u as LineChart,
17
- i as Orientation
8
+ e as AreaChart,
9
+ u as BarChart,
10
+ m as BubbleChart,
11
+ s as CurveType,
12
+ d as DonutChart,
13
+ x as LegendPosition,
14
+ o as LineChart,
15
+ C as Orientation
18
16
  };
package/dist/types.d.ts CHANGED
@@ -4,8 +4,12 @@ import { LineChartProps } from './components/LineChart/types';
4
4
  import { DonutChartProps } from './components/DonutChart/types';
5
5
  import { BubbleChartProps } from './components/BubbleChart/types';
6
6
  declare enum LegendPosition {
7
- Top = "top",
8
- Bottom = "bottom"
7
+ TopLeft = "top-left",
8
+ TopCenter = "top-center",
9
+ TopRight = "top-right",
10
+ BottomLeft = "bottom-left",
11
+ BottomCenter = "bottom-center",
12
+ BottomRight = "bottom-right"
9
13
  }
10
14
  declare enum CurveType {
11
15
  Basis = "basis",
package/dist/types.js CHANGED
@@ -1,6 +1,6 @@
1
- var l = /* @__PURE__ */ ((a) => (a.Top = "top", a.Bottom = "bottom", a))(l || {}), o = /* @__PURE__ */ ((a) => (a.Basis = "basis", a.BasisClosed = "basisClosed", a.BasisOpen = "basisOpen", a.Bundle = "bundle", a.Cardinal = "cardinal", a.CardinalClosed = "cardinalClosed", a.CardinalOpen = "cardinalOpen", a.CatmullRom = "catmullRom", a.CatmullRomClosed = "catmullRomClosed", a.CatmullRomOpen = "catmullRomOpen", a.Linear = "linear", a.LinearClosed = "linearClosed", a.MonotoneX = "monotoneX", a.MonotoneY = "monotoneY", a.Natural = "natural", a.Step = "step", a.StepAfter = "stepAfter", a.StepBefore = "stepBefore", a))(o || {}), t = /* @__PURE__ */ ((a) => (a.Horizontal = "horizontal", a.Vertical = "vertical", a))(t || {});
1
+ var o = /* @__PURE__ */ ((t) => (t.TopLeft = "top-left", t.TopCenter = "top-center", t.TopRight = "top-right", t.BottomLeft = "bottom-left", t.BottomCenter = "bottom-center", t.BottomRight = "bottom-right", t))(o || {}), a = /* @__PURE__ */ ((t) => (t.Basis = "basis", t.BasisClosed = "basisClosed", t.BasisOpen = "basisOpen", t.Bundle = "bundle", t.Cardinal = "cardinal", t.CardinalClosed = "cardinalClosed", t.CardinalOpen = "cardinalOpen", t.CatmullRom = "catmullRom", t.CatmullRomClosed = "catmullRomClosed", t.CatmullRomOpen = "catmullRomOpen", t.Linear = "linear", t.LinearClosed = "linearClosed", t.MonotoneX = "monotoneX", t.MonotoneY = "monotoneY", t.Natural = "natural", t.Step = "step", t.StepAfter = "stepAfter", t.StepBefore = "stepBefore", t))(a || {}), l = /* @__PURE__ */ ((t) => (t.Horizontal = "horizontal", t.Vertical = "vertical", t))(l || {});
2
2
  export {
3
- o as CurveType,
4
- l as LegendPosition,
5
- t as Orientation
3
+ a as CurveType,
4
+ o as LegendPosition,
5
+ l as Orientation
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-chrts",
3
- "version": "0.2.4",
3
+ "version": "0.2.5-test.2",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -1,77 +0,0 @@
1
- import { defineComponent as y, computed as f, createApp as h, createElementBlock as g, openBlock as a, createVNode as n, createElementVNode as B, unref as t, withCtx as L, createBlock as v, createCommentVNode as C, mergeProps as k } from "vue";
2
- import { VisXYContainer as b, VisArea as x, VisAxis as s, VisCrosshair as T, VisBulletLegend as V } from "@unovis/vue";
3
- import { CurveType as _ } 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" }, O = /* @__PURE__ */ y({
6
- __name: "AreaStackedChart",
7
- props: {
8
- data: {},
9
- height: {},
10
- categories: {},
11
- hideTooltip: { type: Boolean },
12
- xLabel: {},
13
- yLabel: {},
14
- padding: {},
15
- hideLegend: { type: Boolean },
16
- xGridLine: { type: Boolean },
17
- xDomainLine: { type: Boolean },
18
- yGridLine: { type: Boolean },
19
- yDomainLine: { type: Boolean },
20
- xTickLine: { type: Boolean },
21
- yTickLine: { type: Boolean },
22
- crosshairConfig: {}
23
- },
24
- setup(c) {
25
- const i = c, l = f(() => (e, m) => {
26
- if (typeof window > "u" || typeof document > "u")
27
- return "";
28
- try {
29
- const o = h(N, {
30
- data: e,
31
- categories: i.categories
32
- }), r = document.createElement("div");
33
- o.mount(r);
34
- const u = r.innerHTML;
35
- return o.unmount(), u;
36
- } catch {
37
- return "";
38
- }
39
- }), p = (e) => Number.parseInt(e.time), d = [(e) => e.firstTime, (e) => e.returning];
40
- return (e, m) => (a(), g("div", A, [
41
- n(t(b), {
42
- data: e.data,
43
- padding: e.padding,
44
- height: e.height
45
- }, {
46
- default: L(() => [
47
- n(t(x), {
48
- x: p,
49
- y: d,
50
- color: Object.values(i.categories).map((o) => o.color),
51
- "curve-type": t(_).Linear
52
- }, null, 8, ["color", "curve-type"]),
53
- n(t(s), {
54
- type: "x",
55
- label: "Time",
56
- "num-ticks": 12
57
- }),
58
- n(t(s), {
59
- type: "y",
60
- label: "Number of visitors",
61
- "num-ticks": 3
62
- }),
63
- e.hideTooltip ? C("", !0) : (a(), v(t(T), k({ key: 0 }, e.crosshairConfig, { template: l.value }), null, 16, ["template"]))
64
- ]),
65
- _: 1
66
- }, 8, ["data", "padding", "height"]),
67
- B("div", j, [
68
- n(t(V), {
69
- items: Object.values(e.categories)
70
- }, null, 8, ["items"])
71
- ])
72
- ]));
73
- }
74
- });
75
- export {
76
- O as default
77
- };
@@ -1,14 +0,0 @@
1
- import { AreaStackedChartProps } 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<{
3
- props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & AreaStackedChartProps<T> & Partial<{}>> & import('vue').PublicProps;
4
- expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
5
- attrs: any;
6
- slots: {};
7
- emit: {};
8
- }>) => import('vue').VNode & {
9
- __ctx?: Awaited<typeof __VLS_setup>;
10
- };
11
- export default _default;
12
- type __VLS_PrettifyLocal<T> = {
13
- [K in keyof T]: T[K];
14
- } & {};
@@ -1,4 +0,0 @@
1
- import f from "./AreaStackedChart.js";
2
- export {
3
- f as default
4
- };
@@ -1,86 +0,0 @@
1
- import { BulletLegendItemInterface } from '@unovis/ts';
2
- export interface AreaStackedChartProps<T> {
3
- /**
4
- * The data to be displayed in the stacked area chart.
5
- * Each element of the array represents a data point.
6
- * The structure of 'T' should be compatible with the chart's rendering logic.
7
- */
8
- data: T[];
9
- /**
10
- * The height of the chart in pixels.
11
- */
12
- height: number;
13
- /**
14
- * A record mapping category keys to `BulletLegendItemInterface` objects.
15
- * This defines the visual representation and labels for each category in the chart's legend.
16
- */
17
- categories: Record<string, BulletLegendItemInterface>;
18
- /**
19
- * If `true`, hides the chart tooltip.
20
- */
21
- hideTooltip?: boolean;
22
- /**
23
- * Optional label for the x-axis.
24
- */
25
- xLabel?: string;
26
- /**
27
- * Optional label for the y-axis.
28
- */
29
- yLabel?: string;
30
- /**
31
- * Optional padding applied to the chart.
32
- * Allows specifying individual padding values for the top, right, bottom, and left sides.
33
- */
34
- padding?: {
35
- top: number;
36
- right: number;
37
- bottom: number;
38
- left: number;
39
- };
40
- /**
41
- * If `true`, hides the chart legend.
42
- */
43
- hideLegend?: boolean;
44
- /**
45
- * If `true`, displays grid lines along the x-axis.
46
- */
47
- xGridLine?: boolean;
48
- /**
49
- * If `true`, displays a domain line (axis line) along the x-axis.
50
- */
51
- xDomainLine?: boolean;
52
- /**
53
- * If `true`, displays grid lines along the y-axis.
54
- */
55
- yGridLine?: boolean;
56
- /**
57
- * If `true`, displays a domain line (axis line) along the y-axis.
58
- */
59
- yDomainLine?: boolean;
60
- /**
61
- * If `true`, displays tick lines on the x-axis.
62
- */
63
- xTickLine?: boolean;
64
- /**
65
- * If `true`, displays tick lines on the y-axis.
66
- */
67
- yTickLine?: boolean;
68
- /**
69
- * Crosshair configuration object for customizing the appearance of the crosshair line.
70
- */
71
- crosshairConfig?: {
72
- /**
73
- * The color of the crosshair line. Accepts any valid CSS color string.
74
- * Example: '#f00', 'rgba(0,0,0,0.5)', 'blue'
75
- */
76
- color?: string;
77
- /**
78
- * The stroke color of the crosshair line. Accepts any valid CSS color string.
79
- */
80
- strokeColor?: string;
81
- /**
82
- * The stroke width of the crosshair line in pixels.
83
- */
84
- strokeWidth?: number;
85
- };
86
- }