vue-chrts 0.2.0-test.5 → 0.2.0-test.6

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 F, computed as f, useSlots as x, useTemplateRef as N, ref as O, createElementBlock as d, openBlock as n, normalizeClass as k, createVNode as r, createCommentVNode as l, createElementVNode as P, unref as i, withCtx as j, createBlock as s, Fragment as w, renderList as M, renderSlot as g } from "vue";
2
- import { Position as h, CurveType as W } from "@unovis/ts";
3
- import { createMarkers as E, getFirstPropertyValue as G } from "../../utils.js";
4
- import X from "../Tooltip.js";
5
- import { VisXYContainer as $, VisTooltip as z, VisLine as R, VisAxis as v, VisCrosshair as Y, VisBulletLegend as S } from "@unovis/vue";
6
- import { LegendPosition as H } from "../../types.js";
7
- const U = {
1
+ import { defineComponent as P, computed as k, useSlots as x, useTemplateRef as O, ref as j, createElementBlock as u, openBlock as n, normalizeClass as g, createVNode as s, createCommentVNode as a, createElementVNode as w, unref as i, withCtx as M, createBlock as m, Fragment as W, renderList as E, mergeProps as G, renderSlot as h } from "vue";
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 = {
8
8
  ref: "slotWrapper",
9
9
  class: "hidden"
10
- }, _ = /* @__PURE__ */ F({
10
+ }, te = /* @__PURE__ */ P({
11
11
  __name: "LineChart",
12
12
  props: {
13
13
  data: {},
@@ -41,48 +41,53 @@ const U = {
41
41
  xTickLine: { type: Boolean },
42
42
  yTickLine: { type: Boolean },
43
43
  hideXAxis: { type: Boolean },
44
- hideYAxis: { type: Boolean }
44
+ hideYAxis: { type: Boolean },
45
+ crosshairConfig: { default: () => ({
46
+ color: "#666"
47
+ }) }
45
48
  },
46
- setup(o) {
47
- const t = o, T = f(() => t.markerConfig ? E(t.markerConfig) : ""), L = x(), m = N("slotWrapper"), a = O();
48
- function b(e) {
49
- return typeof window > "u" ? "" : m.value ? m.value.innerHTML : "";
49
+ emits: ["click"],
50
+ setup(o, { emit: L }) {
51
+ const C = L, t = o, b = k(() => t.markerConfig ? $(t.markerConfig) : ""), B = x(), c = O("slotWrapper"), l = j();
52
+ function D(e) {
53
+ return typeof window > "u" ? "" : c.value ? c.value.innerHTML : "";
50
54
  }
51
- function B(e) {
52
- return a.value = e, b();
55
+ function V(e) {
56
+ return l.value = e, D();
53
57
  }
54
- const u = f(
55
- () => t.legendPosition === H.Top
56
- ), C = Object.values(t.categories).map(
57
- (e, c) => `var(--vis-color${c})`
58
- ), D = (e) => Object.values(t.categories)[e].color ?? C[e];
59
- return (e, c) => (n(), d("div", {
60
- class: k(["flex flex-col space-y-4", {
61
- "flex-col-reverse": u.value,
58
+ const p = k(
59
+ () => t.legendPosition === I.Top
60
+ ), A = Object.values(t.categories).map(
61
+ (e, r) => `var(--vis-color${r})`
62
+ ), F = (e) => Object.values(t.categories)[e].color ?? A[e];
63
+ return (e, r) => (n(), u("div", {
64
+ class: g(["flex flex-col space-y-4", {
65
+ "flex-col-reverse": p.value,
62
66
  markers: !!t.markerConfig
63
- }])
67
+ }]),
68
+ onClick: r[0] || (r[0] = (d) => C("click", d, l.value))
64
69
  }, [
65
- r(i($), {
70
+ s(i(Y), {
66
71
  data: e.data,
67
72
  padding: e.padding,
68
73
  height: e.height,
69
- svgDefs: T.value
74
+ svgDefs: b.value
70
75
  }, {
71
- default: j(() => [
72
- r(i(z), {
73
- "horizontal-placement": i(h).Right,
74
- "vertical-placement": i(h).Top
76
+ default: M(() => [
77
+ s(i(S), {
78
+ "horizontal-placement": i(v).Right,
79
+ "vertical-placement": i(v).Top
75
80
  }, null, 8, ["horizontal-placement", "vertical-placement"]),
76
- (n(!0), d(w, null, M(Object.keys(t.categories), (V, p) => (n(), s(i(R), {
77
- key: p,
78
- x: (y, A) => A,
79
- y: (y) => y[V],
80
- color: D(p),
81
- "curve-type": e.curveType ?? i(W).MonotoneX,
81
+ (n(!0), u(W, null, E(Object.keys(t.categories), (d, y) => (n(), m(i(H), {
82
+ key: y,
83
+ x: (f, N) => N,
84
+ y: (f) => f[d],
85
+ color: F(y),
86
+ "curve-type": e.curveType ?? i(X).MonotoneX,
82
87
  "line-width": e.lineWidth,
83
88
  lineDashArray: e.lineDashArray
84
89
  }, null, 8, ["x", "y", "color", "curve-type", "line-width", "lineDashArray"]))), 128)),
85
- e.hideXAxis ? l("", !0) : (n(), s(i(v), {
90
+ e.hideXAxis ? a("", !0) : (n(), m(i(T), {
86
91
  key: 0,
87
92
  type: "x",
88
93
  "tick-format": e.xFormatter,
@@ -95,7 +100,7 @@ const U = {
95
100
  "tick-values": e.xExplicitTicks,
96
101
  "min-max-ticks-only": e.minMaxTicksOnly
97
102
  }, null, 8, ["tick-format", "label", "domain-line", "grid-line", "tick-line", "num-ticks", "tick-values", "min-max-ticks-only"])),
98
- e.hideYAxis ? l("", !0) : (n(), s(i(v), {
103
+ e.hideYAxis ? a("", !0) : (n(), m(i(T), {
99
104
  key: 1,
100
105
  type: "y",
101
106
  "tick-format": e.yFormatter,
@@ -105,38 +110,34 @@ const U = {
105
110
  "grid-line": e.yGridLine,
106
111
  "tick-line": e.yTickLine
107
112
  }, null, 8, ["tick-format", "label", "num-ticks", "domain-line", "grid-line", "tick-line"])),
108
- e.hideTooltip ? l("", !0) : (n(), s(i(Y), {
109
- key: 2,
110
- color: "#666",
111
- template: B
112
- }))
113
+ e.hideTooltip ? a("", !0) : (n(), m(i(U), G({ key: 2 }, e.crosshairConfig, { template: V }), null, 16))
113
114
  ]),
114
115
  _: 1
115
116
  }, 8, ["data", "padding", "height", "svgDefs"]),
116
- e.hideLegend ? l("", !0) : (n(), d("div", {
117
+ e.hideLegend ? a("", !0) : (n(), u("div", {
117
118
  key: 0,
118
- class: k(["flex items center justify-end", { "pb-4": u.value }])
119
+ class: g(["flex items center justify-end", { "pb-4": p.value }])
119
120
  }, [
120
- r(i(S), {
121
+ s(i(q), {
121
122
  items: Object.values(e.categories)
122
123
  }, null, 8, ["items"])
123
124
  ], 2)),
124
- P("div", U, [
125
- i(L).tooltip ? g(e.$slots, "tooltip", {
125
+ w("div", J, [
126
+ i(B).tooltip ? h(e.$slots, "tooltip", {
126
127
  key: 0,
127
- values: a.value
128
- }) : a.value ? g(e.$slots, "fallback", { key: 1 }, () => [
129
- r(X, {
130
- data: a.value,
128
+ values: l.value
129
+ }) : l.value ? h(e.$slots, "fallback", { key: 1 }, () => [
130
+ s(R, {
131
+ data: l.value,
131
132
  categories: e.categories,
132
- toolTipTitle: i(G)(a.value) ?? "",
133
+ toolTipTitle: i(z)(l.value) ?? "",
133
134
  yFormatter: t.yFormatter
134
135
  }, null, 8, ["data", "categories", "toolTipTitle", "yFormatter"])
135
- ]) : l("", !0)
136
+ ]) : a("", !0)
136
137
  ], 512)
137
138
  ], 2));
138
139
  }
139
140
  });
140
141
  export {
141
- _ as default
142
+ te as default
142
143
  };
@@ -1,6 +1,8 @@
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<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & LineChartProps<T> & Partial<{}>> & import('vue').PublicProps;
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;
4
6
  expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
5
7
  attrs: any;
6
8
  slots: {
@@ -9,7 +11,7 @@ declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>
9
11
  }): any;
10
12
  fallback?(_: {}): any;
11
13
  };
12
- emit: {};
14
+ emit: (e: "click", event: MouseEvent, values?: T) => void;
13
15
  }>) => import('vue').VNode & {
14
16
  __ctx?: Awaited<typeof __VLS_setup>;
15
17
  };
@@ -1,4 +1,5 @@
1
- import { axisFormatter, BulletLegendItemInterface, CurveType, LegendPosition, MarkerConfig } from '../../types';
1
+ import { BulletLegendItemInterface, CurveType } from '@unovis/ts';
2
+ import { axisFormatter, LegendPosition, MarkerConfig } from '../../types';
2
3
  export interface LineChartProps<T> {
3
4
  /**
4
5
  * The data to be displayed in the line chart.
@@ -43,22 +44,22 @@ export interface LineChartProps<T> {
43
44
  * @param {(number[]|Date[])} ticks - An array of all tick values for the x-axis.
44
45
  * @returns {string} The formatted string representation of the tick.
45
46
  */
46
- xFormatter?: axisFormatter<T>;
47
+ xFormatter?: axisFormatter;
47
48
  /**
48
49
  * @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
50
  * @param {number} i - The index of the tick in the `ticks` array.
50
51
  * @param {(number[]|Date[])} ticks - An array of all tick values for the y-axis.
51
52
  * @returns {string} The formatted string representation of the tick.
52
53
  */
53
- yFormatter?: axisFormatter<T>;
54
+ yFormatter?: axisFormatter;
54
55
  /**
55
56
  * The type of curve to use for the line chart.
56
57
  * See `CurveType` for available options.
57
58
  */
58
59
  curveType?: CurveType;
59
60
  /**
60
- * The width of the line in pixels. Default is 2px.
61
- */
61
+ * The width of the line in pixels. Default is 2px.
62
+ */
62
63
  lineWidth?: number;
63
64
  /**
64
65
  * Line dash array, see SVG's stroke-dasharray. Default: `undefined`
@@ -125,4 +126,22 @@ export interface LineChartProps<T> {
125
126
  * If `true`, hide the y-axis.
126
127
  */
127
128
  hideYAxis?: boolean;
129
+ /**
130
+ * Crosshair configuration object for customizing the appearance of the crosshair line.
131
+ */
132
+ crosshairConfig?: {
133
+ /**
134
+ * The color of the crosshair line. Accepts any valid CSS color string.
135
+ * Example: '#f00', 'rgba(0,0,0,0.5)', 'blue'
136
+ */
137
+ color?: string;
138
+ /**
139
+ * The stroke color of the crosshair line. Accepts any valid CSS color string.
140
+ */
141
+ strokeColor?: string;
142
+ /**
143
+ * The stroke width of the crosshair line in pixels.
144
+ */
145
+ strokeWidth?: number;
146
+ };
128
147
  }
@@ -1,41 +1,41 @@
1
- import { defineComponent as b, computed as v, createElementBlock as r, openBlock as l, createElementVNode as o, toDisplayString as i, Fragment as h, renderList as y, normalizeStyle as a } from "vue";
1
+ import { defineComponent as b, computed as v, createElementBlock as r, openBlock as l, createElementVNode as o, toDisplayString as i, Fragment as y, renderList as h, normalizeStyle as n } from "vue";
2
2
  const f = {
3
3
  class: "capitalize border-b mb-1 pb-1",
4
4
  style: {
5
5
  color: "var(--tooltip-value-color)",
6
6
  borderColor: "rgba(255, 255, 255, 0.05)"
7
7
  }
8
- }, T = /* @__PURE__ */ b({
8
+ }, F = /* @__PURE__ */ b({
9
9
  __name: "Tooltip",
10
10
  props: {
11
11
  data: {},
12
12
  categories: {},
13
13
  toolTipTitle: {},
14
- yFormatter: {}
14
+ yFormatter: { type: Function }
15
15
  },
16
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)
17
+ const a = p, d = ["_index", "_stacked", "_ending"], m = v(() => Object.entries(a.data ?? []).filter(
18
+ ([e, g]) => !d.includes(e) && Object.keys(a.categories).includes(e)
19
19
  ));
20
20
  return (e, g) => (l(), r("div", null, [
21
21
  o("div", f, i(e.toolTipTitle), 1),
22
- (l(!0), r(h, null, y(m.value, ([t, s], u) => {
22
+ (l(!0), r(y, null, h(m.value, ([t, s], u) => {
23
23
  var c;
24
24
  return l(), r("div", {
25
25
  key: t,
26
26
  style: { display: "flex", "align-items": "center", "margin-bottom": "4px" }
27
27
  }, [
28
28
  o("span", {
29
- style: a([{ width: "8px", height: "8px", "border-radius": "4px", "margin-right": "8px" }, {
29
+ style: n([{ width: "8px", height: "8px", "border-radius": "4px", "margin-right": "8px" }, {
30
30
  backgroundColor: (c = e.categories[t]) != null && c.color ? e.categories[t].color : `var(--vis-color${u})`
31
31
  }])
32
32
  }, null, 4),
33
33
  o("div", null, [
34
34
  o("span", {
35
- style: a([{ "font-weight": "600", "margin-right": "8px" }, { color: "var(--tooltip-label-color)" }])
35
+ style: n([{ "font-weight": "600", "margin-right": "8px" }, { color: "var(--tooltip-label-color)" }])
36
36
  }, i(e.categories[t].name) + ":", 1),
37
37
  o("span", {
38
- style: a([{ "font-weight": "400" }, { color: "var(--tooltip-value-color)" }])
38
+ style: n([{ "font-weight": "400" }, { color: "var(--tooltip-value-color)" }])
39
39
  }, i(e.yFormatter ? e.yFormatter(s) : s), 1)
40
40
  ])
41
41
  ]);
@@ -44,5 +44,5 @@ const f = {
44
44
  }
45
45
  });
46
46
  export {
47
- T as default
47
+ F as default
48
48
  };
@@ -1,10 +1,11 @@
1
- import { axisFormatter, BulletLegendItemInterface } from '../types';
1
+ import { axisFormatter } from '../types';
2
+ import { BulletLegendItemInterface } from '@unovis/ts';
2
3
  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
4
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & {
4
5
  data: T;
5
6
  categories: Record<string, BulletLegendItemInterface>;
6
7
  toolTipTitle: string | number;
7
- yFormatter?: axisFormatter<T>;
8
+ yFormatter?: axisFormatter;
8
9
  } & Partial<{}>> & import('vue').PublicProps;
9
10
  expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
10
11
  attrs: any;
package/dist/index.d.ts CHANGED
@@ -3,6 +3,5 @@ import { default as AreaStackedChart } from './components/AreaStackedChart/AreaS
3
3
  import { default as LineChart } from './components/LineChart/LineChart.vue';
4
4
  import { default as BarChart } from './components/BarChart/BarChart.vue';
5
5
  import { default as DonutChart } from './components/DonutChart/DonutChart.vue';
6
- import { LegendPosition, CurveType, Orientation, BulletLegendItemInterface } from './types';
7
- export { AreaChart, AreaStackedChart, LineChart, BarChart, DonutChart, Orientation, CurveType, LegendPosition };
8
- export type { BulletLegendItemInterface, };
6
+ import { LegendPosition } from './types';
7
+ export { AreaChart, AreaStackedChart, LineChart, BarChart, DonutChart, LegendPosition };
package/dist/index.js CHANGED
@@ -1,16 +1,14 @@
1
- import { default as a } from "./components/AreaChart/AreaChart.js";
1
+ import { default as t } from "./components/AreaChart/AreaChart.js";
2
2
  import { default as o } from "./components/AreaStackedChart/AreaStackedChart.js";
3
3
  import { default as d } from "./components/LineChart/LineChart.js";
4
- import { default as u } from "./components/BarChart/BarChart.js";
5
- import { default as n } from "./components/DonutChart/DonutChart.js";
6
- import { CurveType as x, LegendPosition as C, Orientation as h } from "./types.js";
4
+ import { default as p } from "./components/BarChart/BarChart.js";
5
+ import { default as u } from "./components/DonutChart/DonutChart.js";
6
+ import { LegendPosition as h } from "./types.js";
7
7
  export {
8
- a as AreaChart,
8
+ t as AreaChart,
9
9
  o as AreaStackedChart,
10
- u as BarChart,
11
- x as CurveType,
12
- n as DonutChart,
13
- C as LegendPosition,
14
- d as LineChart,
15
- h as Orientation
10
+ p as BarChart,
11
+ u as DonutChart,
12
+ h as LegendPosition,
13
+ d as LineChart
16
14
  };
package/dist/types.d.ts CHANGED
@@ -1,49 +1,12 @@
1
- import { AreaChartProps } from './components/AreaChart/types';
2
- import { BarChartProps } from './components/BarChart/types';
3
- import { LineChartProps } from './components/LineChart/types';
4
- import { DonutChartProps } from './components/DonutChart/types';
5
- declare enum LegendPosition {
1
+ export declare enum LegendPosition {
6
2
  Top = "top",
7
3
  Bottom = "bottom"
8
4
  }
9
- declare enum CurveType {
10
- Basis = "basis",
11
- BasisClosed = "basisClosed",
12
- BasisOpen = "basisOpen",
13
- Bundle = "bundle",
14
- Cardinal = "cardinal",
15
- CardinalClosed = "cardinalClosed",
16
- CardinalOpen = "cardinalOpen",
17
- CatmullRom = "catmullRom",
18
- CatmullRomClosed = "catmullRomClosed",
19
- CatmullRomOpen = "catmullRomOpen",
20
- Linear = "linear",
21
- LinearClosed = "linearClosed",
22
- MonotoneX = "monotoneX",
23
- MonotoneY = "monotoneY",
24
- Natural = "natural",
25
- Step = "step",
26
- StepAfter = "stepAfter",
27
- StepBefore = "stepBefore"
28
- }
29
- interface BulletLegendItemInterface {
30
- name: string | number;
31
- color?: string;
32
- className?: string;
33
- shape?: any;
34
- inactive?: boolean;
35
- hidden?: boolean;
36
- pointer?: boolean;
37
- }
38
- declare enum Orientation {
39
- Horizontal = "horizontal",
40
- Vertical = "vertical"
41
- }
42
- export { LegendPosition, CurveType, Orientation, type AreaChartProps, type BarChartProps, type LineChartProps, type DonutChartProps, type BulletLegendItemInterface, };
43
- export type axisFormatter<T> = ((tick: number, i?: number, ticks?: number[]) => string) | ((tick: Date, i?: number, ticks?: Date[]) => string);
44
- export type MarkerConfig = {
45
- type: "circle" | "square" | "triangle" | "diamond";
5
+ export type axisFormatter = ((tick: number, i?: number, ticks?: number[]) => string) | ((tick: Date, i?: number, ticks?: Date[]) => string);
6
+ export interface MarkerConfig {
7
+ type?: "circle" | "square" | "triangle" | "diamond";
46
8
  size?: number;
47
9
  strokeWidth?: number;
48
10
  color?: string;
49
- };
11
+ strokeColor?: string;
12
+ }
package/dist/types.js CHANGED
@@ -1,6 +1,4 @@
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.Top = "top", t.Bottom = "bottom", t))(o || {});
2
2
  export {
3
- o as CurveType,
4
- l as LegendPosition,
5
- t as Orientation
3
+ o as LegendPosition
6
4
  };
package/dist/utils.d.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  import { MarkerConfig } from './types';
2
2
  export declare function getDistributedIndices(length: number, numTicks: number): number[];
3
3
  export declare function getFirstPropertyValue(obj: unknown): undefined;
4
- export declare const markerShape: (type: string, size: number, strokeWidth: number, color: string) => string;
4
+ export declare const markerShape: (type: string, size: number, strokeWidth: number, color: string, strokeColor: string) => string;
5
5
  export declare function createMarkers(markerConfig: Record<string, MarkerConfig>): string;
6
+ export declare const flattenData: (data: any[], xAxis: string) => {
7
+ month: any;
8
+ }[];
package/dist/utils.js CHANGED
@@ -1,34 +1,49 @@
1
- function u($) {
2
- if ($ && Object.keys($).length > 0) {
3
- const n = Object.keys($)[0];
4
- return $[n];
1
+ function o(n) {
2
+ if (n && Object.keys(n).length > 0) {
3
+ const e = Object.keys(n)[0];
4
+ return n[e];
5
5
  }
6
6
  }
7
- const l = ($, n, r, c) => {
8
- switch ($) {
7
+ const u = (n, e, r, t, $) => {
8
+ switch (n) {
9
9
  case "circle":
10
- return `<circle cx="${n / 2}" cy="${n / 2}" r="${(n - r) / 2}" stroke-width="${r}" stroke="${c}" fill="none" />`;
10
+ return `<circle cx="${e / 2}" cy="${e / 2}" r="${(e - r) / 2}" stroke-width="${r}" stroke="${$}" fill="${t}" />`;
11
11
  case "square":
12
- return `<rect x="${r / 2}" y="${r / 2}" width="${n - r}" height="${n - r}" stroke-width="${r}" stroke="${c}" fill="none" />`;
12
+ return `<rect x="${r / 2}" y="${r / 2}" width="${e - r}" height="${e - r}" stroke-width="${r}" stroke="${$}" fill="${t}" />`;
13
13
  case "triangle":
14
- return `<polygon points="${n / 2},${r / 2} ${n - r / 2},${n - r / 2} ${r / 2},${n - r / 2}" stroke-width="${r}" stroke="${c}" fill="none" />`;
14
+ return `<polygon points="${e / 2},${r / 2} ${e - r / 2},${e - r / 2} ${r / 2},${e - r / 2}" stroke-width="${r}" stroke="${$}" fill="${t}" />`;
15
15
  case "diamond":
16
- return `<polygon points="${n / 2},${r / 2} ${n - r / 2},${n / 2} ${n / 2},${n - r / 2} ${r / 2},${n / 2}" stroke-width="${r}" stroke="${c}" fill="none" />`;
16
+ return `<polygon points="${e / 2},${r / 2} ${e - r / 2},${e / 2} ${e / 2},${e - r / 2} ${r / 2},${e / 2}" stroke-width="${r}" stroke="${$}" fill="${t}" />`;
17
17
  default:
18
18
  return "";
19
19
  }
20
20
  };
21
- function o($) {
22
- return Object.entries($).map(([n, r]) => {
23
- const c = r.type || "circle", e = r.size || 10, t = r.strokeWidth || 2, a = r.color || "#000";
24
- return `<marker id="circle-marker-${n}" viewBox="0 0 ${e} ${e}" refX="${e / 2}" refY="${e / 2}" markerWidth="${e / 2}" markerHeight="${e / 2}">
25
- ${l(c, e, t, a)}
21
+ function m(n) {
22
+ return Object.entries(n).map(([e, r]) => {
23
+ const t = r.type || "circle", $ = r.size || 10, c = r.strokeWidth || 2, a = r.color || "#000", l = r.strokeColor || r.color || "#000";
24
+ return `<marker id="circle-marker-${e}" viewBox="0 0 ${$} ${$}" refX="${$ / 2}" refY="${$ / 2}" markerWidth="${$ / 2}" markerHeight="${$ / 2}">
25
+ ${u(t, $, c, a, l)}
26
26
  </marker>`;
27
27
  }).join(`
28
28
  `);
29
29
  }
30
+ function p(n) {
31
+ return n.charAt(0).toUpperCase() + n.slice(1);
32
+ }
33
+ const y = (n, e) => {
34
+ const r = Object.keys(n[0]).filter(($) => $ !== e), t = Object.keys(n[0][r[0]]);
35
+ return n.map(($) => ({
36
+ month: $.month,
37
+ ...r.flatMap(
38
+ (c) => t.map((a) => ({
39
+ [`${c}${p(a)}`]: $[c][a]
40
+ }))
41
+ ).reduce((c, a) => ({ ...c, ...a }), {})
42
+ }));
43
+ };
30
44
  export {
31
- o as createMarkers,
32
- u as getFirstPropertyValue,
33
- l as markerShape
45
+ m as createMarkers,
46
+ y as flattenData,
47
+ o as getFirstPropertyValue,
48
+ u as markerShape
34
49
  };
package/package.json CHANGED
@@ -1,17 +1,16 @@
1
1
  {
2
2
  "name": "vue-chrts",
3
- "version": "0.2.0-test.5",
3
+ "version": "0.2.0-test.6",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
7
7
  ],
8
- "main": "./dist/index.umd.cjs",
8
+ "main": "./dist/index.js",
9
9
  "module": "./dist/index.js",
10
10
  "types": "./dist/index.d.ts",
11
11
  "exports": {
12
12
  ".": {
13
- "import": "./dist/index.js",
14
- "require": "./dist/index.umd.cjs"
13
+ "import": "./dist/index.js"
15
14
  }
16
15
  },
17
16
  "scripts": {
@@ -24,21 +23,21 @@
24
23
  "vue": "^3.5.13"
25
24
  },
26
25
  "devDependencies": {
27
- "@tailwindcss/vite": "^4.0.15",
28
- "@tanstack/vue-table": "^8.21.2",
29
- "@types/node": "^22.13.11",
26
+ "@tailwindcss/vite": "^4.1.11",
27
+ "@tanstack/vue-table": "^8.21.3",
28
+ "@types/node": "^22.16.5",
30
29
  "@unovis/ts": "^1.5.2",
31
30
  "@unovis/vue": "^1.5.2",
32
- "@vitejs/plugin-vue": "^5.2.1",
31
+ "@vitejs/plugin-vue": "^5.2.4",
33
32
  "@vue/tsconfig": "^0.7.0",
34
- "@vueuse/core": "^13.0.0",
33
+ "@vueuse/core": "^13.5.0",
35
34
  "commit-and-tag-version": "^12.5.1",
36
- "tailwindcss": "^4.0.15",
37
- "typescript": "~5.7.2",
38
- "vite": "^6.2.0",
39
- "vite-plugin-dts": "^4.5.3",
40
- "vue-router": "^4.5.0",
41
- "vue-tsc": "^2.2.4"
35
+ "tailwindcss": "^4.1.11",
36
+ "typescript": "~5.7.3",
37
+ "vite": "^6.3.5",
38
+ "vite-plugin-dts": "^4.5.4",
39
+ "vue-router": "^4.5.1",
40
+ "vue-tsc": "^2.2.12"
42
41
  },
43
42
  "packageManager": "pnpm@8.15.4+sha256.cea6d0bdf2de3a0549582da3983c70c92ffc577ff4410cbf190817ddc35137c2"
44
43
  }
@@ -1,9 +0,0 @@
1
- const s = (t, e) => {
2
- const o = t.__vccOpts || t;
3
- for (const [r, c] of e)
4
- o[r] = c;
5
- return o;
6
- };
7
- export {
8
- s as default
9
- };
package/dist/index.js.css DELETED
@@ -1 +0,0 @@
1
- .markers[data-v-f08e19f3] *[stroke="#156F36"]{marker:url(#circle-marker-desktop)}.markers[data-v-f08e19f3] *[stroke="#4ade80"]{marker:url(#circle-marker-mobile)}