vue-chrts 2.0.0 → 2.1.0-beta-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.
@@ -0,0 +1,123 @@
1
+ import { defineComponent as W, useSlots as x, useTemplateRef as V, ref as L, computed as g, createElementBlock as u, openBlock as f, normalizeStyle as d, createVNode as n, createCommentVNode as c, createElementVNode as P, unref as o, withCtx as A, renderSlot as h } from "vue";
2
+ import { VisSingleContainer as N, VisTooltip as p, VisSankey as B, VisBulletLegend as H } from "@unovis/vue";
3
+ import z from "../Tooltip.js";
4
+ import { LegendPosition as M } from "../../types.js";
5
+ import { SankeyNodeAlign as O, Sankey as F } from "@unovis/ts";
6
+ const T = {
7
+ ref: "slotWrapper",
8
+ style: { display: "none" }
9
+ }, D = /* @__PURE__ */ W({
10
+ __name: "SankeyChart",
11
+ props: {
12
+ data: {},
13
+ height: {},
14
+ padding: { default: () => ({
15
+ top: 5,
16
+ right: 5,
17
+ bottom: 5,
18
+ left: 5
19
+ }) },
20
+ categories: {},
21
+ hideLegend: { type: Boolean, default: !1 },
22
+ legendPosition: { default: M.BottomCenter },
23
+ legendStyle: { default: void 0 },
24
+ label: {},
25
+ subLabel: {},
26
+ nodeColor: {},
27
+ linkColor: {},
28
+ linkValue: {},
29
+ nodeWidth: { default: 10 },
30
+ nodeAlign: { default: O.Justify },
31
+ nodePadding: { default: 10 },
32
+ nodeSort: {},
33
+ linkSort: {},
34
+ iterations: { default: 32 },
35
+ highlightSubtreeOnHover: { type: Boolean, default: !1 },
36
+ labelFontSize: {},
37
+ labelColor: {},
38
+ labelMaxWidth: { default: 70 }
39
+ },
40
+ emits: ["click"],
41
+ setup(e, { emit: b }) {
42
+ const m = b, t = e, S = x(), k = V("slotWrapper"), i = L(), y = g(() => t.legendPosition.startsWith("top")), v = g(() => t.legendPosition.includes("left") ? "flex-start" : t.legendPosition.includes("right") ? "flex-end" : "center");
43
+ function C(a) {
44
+ i.value = a;
45
+ }
46
+ return (a, r) => (f(), u("div", {
47
+ style: d({
48
+ display: "flex",
49
+ flexDirection: y.value ? "column-reverse" : "column",
50
+ gap: "var(--vis-legend-spacing)"
51
+ }),
52
+ onClick: r[0] || (r[0] = (l) => m("click", l))
53
+ }, [
54
+ n(o(N), {
55
+ padding: e.padding,
56
+ height: e.height
57
+ }, {
58
+ default: A(() => [
59
+ n(o(p), {
60
+ triggers: {
61
+ [o(F).selectors.node]: (l) => {
62
+ var s;
63
+ return C(l), l ? (s = k.value) == null ? void 0 : s.innerHTML : "";
64
+ }
65
+ }
66
+ }, null, 8, ["triggers"]),
67
+ n(o(B), {
68
+ data: e.data,
69
+ label: e.label,
70
+ subLabel: e.subLabel,
71
+ nodeColor: e.nodeColor,
72
+ linkColor: e.linkColor,
73
+ linkValue: e.linkValue,
74
+ nodeWidth: e.nodeWidth,
75
+ nodeAlign: e.nodeAlign,
76
+ nodePadding: e.nodePadding,
77
+ nodeSort: e.nodeSort,
78
+ linkSort: e.linkSort,
79
+ iterations: e.iterations,
80
+ highlightSubtreeOnHover: e.highlightSubtreeOnHover,
81
+ labelFontSize: e.labelFontSize,
82
+ labelColor: e.labelColor,
83
+ labelMaxWidth: e.labelMaxWidth
84
+ }, null, 8, ["data", "label", "subLabel", "nodeColor", "linkColor", "linkValue", "nodeWidth", "nodeAlign", "nodePadding", "nodeSort", "linkSort", "iterations", "highlightSubtreeOnHover", "labelFontSize", "labelColor", "labelMaxWidth"])
85
+ ]),
86
+ _: 1
87
+ }, 8, ["padding", "height"]),
88
+ !t.hideLegend && t.categories ? (f(), u("div", {
89
+ key: 0,
90
+ style: d({
91
+ display: "flex",
92
+ justifyContent: v.value
93
+ })
94
+ }, [
95
+ n(o(H), {
96
+ style: d([
97
+ t.legendStyle,
98
+ "display: flex; gap: var(--vis-legend-spacing);"
99
+ ]),
100
+ items: Object.values(t.categories).map((l) => ({
101
+ ...l,
102
+ color: Array.isArray(l.color) ? l.color[0] : l.color
103
+ }))
104
+ }, null, 8, ["style", "items"])
105
+ ], 4)) : c("", !0),
106
+ P("div", T, [
107
+ o(S).tooltip ? h(a.$slots, "tooltip", {
108
+ key: 0,
109
+ node: i.value
110
+ }) : i.value ? h(a.$slots, "fallback", { key: 1 }, () => [
111
+ n(z, {
112
+ data: i.value,
113
+ categories: t.categories ?? {},
114
+ "title-formatter": (l) => l.label || l.id || "Node"
115
+ }, null, 8, ["data", "categories", "title-formatter"])
116
+ ]) : c("", !0)
117
+ ], 512)
118
+ ], 4));
119
+ }
120
+ });
121
+ export {
122
+ D as default
123
+ };
@@ -0,0 +1,22 @@
1
+ import { SankeyInputLink, SankeyInputNode } from '../../types';
2
+ import { SankeyChartProps } from './types';
3
+ declare const _default: <N extends SankeyInputNode, L extends SankeyInputLink>(__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<{
4
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
5
+ readonly onClick?: ((event: MouseEvent) => any) | undefined;
6
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onClick"> & SankeyChartProps<N, L> & Partial<{}>> & import('vue').PublicProps;
7
+ expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
8
+ attrs: any;
9
+ slots: {
10
+ tooltip?(_: {
11
+ node: any;
12
+ }): any;
13
+ fallback?(_: {}): any;
14
+ };
15
+ emit: (e: "click", event: MouseEvent) => void;
16
+ }>) => import('vue').VNode & {
17
+ __ctx?: Awaited<typeof __VLS_setup>;
18
+ };
19
+ export default _default;
20
+ type __VLS_PrettifyLocal<T> = {
21
+ [K in keyof T]: T[K];
22
+ } & {};
@@ -0,0 +1,4 @@
1
+ import f from "./SankeyChart.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,103 @@
1
+ import { BulletLegendItemInterface, LegendPosition, SankeyInputLink, SankeyInputNode, SankeyNodeAlign } from '../../types';
2
+ export type SankeyChartProps<N extends SankeyInputNode, L extends SankeyInputLink> = {
3
+ /**
4
+ * The data to be displayed in the Sankey diagram.
5
+ * Contains nodes and links representing the flow between entities.
6
+ */
7
+ data: {
8
+ nodes: N[];
9
+ links: L[];
10
+ };
11
+ /**
12
+ * The height of the chart in pixels.
13
+ */
14
+ height: number;
15
+ /**
16
+ * Optional padding applied to the chart.
17
+ * Allows specifying individual padding values for the top, right, bottom, and left sides.
18
+ */
19
+ padding?: {
20
+ top: number;
21
+ right: number;
22
+ bottom: number;
23
+ left: number;
24
+ };
25
+ /**
26
+ * A record mapping category keys to `BulletLegendItemInterface` objects.
27
+ * This defines the visual representation and labels for each category in the chart's legend.
28
+ */
29
+ categories?: Record<string, BulletLegendItemInterface>;
30
+ /**
31
+ * If `true`, hides the chart legend.
32
+ */
33
+ hideLegend?: boolean;
34
+ /**
35
+ * Optional position for the legend, if applicable.
36
+ * See `LegendPosition` for available options.
37
+ */
38
+ legendPosition?: LegendPosition;
39
+ /**
40
+ * Optional style object for the legend container. Allows custom CSS styling.
41
+ */
42
+ legendStyle?: string | Record<string, string>;
43
+ /**
44
+ * Node label accessor function or value.
45
+ */
46
+ label?: (node: N) => string;
47
+ /**
48
+ * Node sub-label accessor function or value.
49
+ */
50
+ subLabel?: (node: N) => string;
51
+ /**
52
+ * Node color accessor function or value.
53
+ */
54
+ nodeColor?: (node: N) => string;
55
+ /**
56
+ * Link color accessor function or value.
57
+ */
58
+ linkColor?: (link: L) => string;
59
+ /**
60
+ * Link value accessor function or value.
61
+ */
62
+ linkValue?: (link: L) => number;
63
+ /**
64
+ * Sankey node width in pixels. Default: 10
65
+ */
66
+ nodeWidth?: number;
67
+ /**
68
+ * Sankey node alignment method. Default: 'justify'
69
+ */
70
+ nodeAlign?: SankeyNodeAlign;
71
+ /**
72
+ * Sankey vertical separation between nodes in pixels. Default: 10
73
+ */
74
+ nodePadding?: number;
75
+ /**
76
+ * Node sorting function.
77
+ */
78
+ nodeSort?: (node1: any, node2: any) => number;
79
+ /**
80
+ * Link sorting function.
81
+ */
82
+ linkSort?: (link1: any, link2: any) => number;
83
+ /**
84
+ * Sankey algorithm iterations. Default: 32
85
+ */
86
+ iterations?: number;
87
+ /**
88
+ * Highlight the corresponding subtree on node / link hover. Default: false
89
+ */
90
+ highlightSubtreeOnHover?: boolean;
91
+ /**
92
+ * Label font size in pixels.
93
+ */
94
+ labelFontSize?: number;
95
+ /**
96
+ * Label color accessor function or value.
97
+ */
98
+ labelColor?: (node: N) => string;
99
+ /**
100
+ * Maximum label width in pixels. Default: 70
101
+ */
102
+ labelMaxWidth?: number;
103
+ };
package/dist/index.d.ts CHANGED
@@ -4,6 +4,9 @@ import { default as BarChart } from './components/BarChart/BarChart.vue';
4
4
  import { default as DonutChart } from './components/DonutChart/DonutChart.vue';
5
5
  import { default as BubbleChart } from './components/BubbleChart/BubbleChart.vue';
6
6
  import { default as GanttChart } from './components/GanttChart/GanttChart.vue';
7
- import { LegendPosition, CurveType, Orientation, BulletLegendItemInterface, MarkerConfig, CrosshairConfig, DonutType } from './types';
8
- export { AreaChart, LineChart, BarChart, DonutChart, BubbleChart, GanttChart, Orientation, CurveType, LegendPosition, DonutType };
9
- export type { BulletLegendItemInterface, MarkerConfig, CrosshairConfig };
7
+ import { default as DagreGraph } from './components/DagreGraph/DagreGraph.vue';
8
+ import { default as DualChart } from './components/DualChart/DualChart.vue';
9
+ import { default as SankeyChart } from './components/SankeyChart/SankeyChart.vue';
10
+ import { LegendPosition, CurveType, Orientation, MarkerConfig, CrosshairConfig, AxisConfig, DonutType, SankeyNodeAlign, BulletLegendItemInterface, AreaChartProps, AreaChartProps as AreaStackedChartProps, BarChartProps, LineChartProps, DonutChartProps, BubbleChartProps, GanttChartProps, DagreGraphProps, SankeyChartProps, DualChartProps, axisFormatter, SankeyInputNode, SankeyInputLink, GraphNodeDatum, GraphLinkDatum, GraphData, DagreLayoutSettings, DagreRankDir, DagreAlign, DagreRanker, NodeShape, LinkArrowPosition } from './types';
11
+ export { AreaChart, AreaChart as AreaStackedChart, LineChart, BarChart, DonutChart, BubbleChart, GanttChart, DagreGraph, DualChart, SankeyChart, SankeyNodeAlign, Orientation, CurveType, LegendPosition, DonutType };
12
+ export type { BulletLegendItemInterface, AreaChartProps, AreaStackedChartProps, BarChartProps, LineChartProps, DonutChartProps, BubbleChartProps, GanttChartProps, DagreGraphProps, SankeyChartProps, DualChartProps, MarkerConfig, CrosshairConfig, AxisConfig, axisFormatter, SankeyInputNode, SankeyInputLink, GraphNodeDatum, GraphLinkDatum, GraphData, DagreLayoutSettings, DagreRankDir, DagreAlign, DagreRanker, NodeShape, LinkArrowPosition };
package/dist/index.js CHANGED
@@ -1,20 +1,29 @@
1
- import { default as e } from "./components/AreaChart/AreaChart.js";
2
- import { default as o } from "./components/LineChart/LineChart.js";
3
- import { default as p } from "./components/BarChart/BarChart.js";
4
- import { default as m } from "./components/DonutChart/DonutChart.js";
1
+ import { default as t, default as e } from "./components/AreaChart/AreaChart.js";
2
+ import { default as f } from "./components/LineChart/LineChart.js";
3
+ import { default as u } from "./components/BarChart/BarChart.js";
4
+ import { default as l } from "./components/DonutChart/DonutChart.js";
5
5
  import { default as x } from "./components/BubbleChart/BubbleChart.js";
6
- import { default as l } from "./components/GanttChart/GanttChart.js";
7
- import { CurveType as C, LegendPosition as h, Orientation as i } from "./types.js";
8
- import { DonutType as y } from "./components/DonutChart/types.js";
6
+ import { default as s } from "./components/GanttChart/GanttChart.js";
7
+ import { default as C } from "./components/DagreGraph/DagreGraph.js";
8
+ import { default as y } from "./components/DualChart/DualChart.js";
9
+ import { default as g } from "./components/SankeyChart/SankeyChart.js";
10
+ import { LegendPosition as A } from "./types.js";
11
+ import { DonutType as b } from "./components/DonutChart/types.js";
12
+ import { CurveType as G, Orientation as L, SankeyNodeAlign as T } from "@unovis/ts";
9
13
  export {
10
- e as AreaChart,
11
- p as BarChart,
14
+ t as AreaChart,
15
+ e as AreaStackedChart,
16
+ u as BarChart,
12
17
  x as BubbleChart,
13
- C as CurveType,
14
- m as DonutChart,
15
- y as DonutType,
16
- l as GanttChart,
17
- h as LegendPosition,
18
- o as LineChart,
19
- i as Orientation
18
+ G as CurveType,
19
+ C as DagreGraph,
20
+ l as DonutChart,
21
+ b as DonutType,
22
+ y as DualChart,
23
+ s as GanttChart,
24
+ A as LegendPosition,
25
+ f as LineChart,
26
+ L as Orientation,
27
+ g as SankeyChart,
28
+ T as SankeyNodeAlign
20
29
  };
package/dist/types.d.ts CHANGED
@@ -1,10 +1,16 @@
1
- import { AreaChartProps } from './components/AreaChart/types';
2
- import { BarChartProps } from './components/BarChart/types';
3
- import { LineChartProps } from './components/LineChart/types';
4
- import { DonutChartProps, DonutType } from './components/DonutChart/types';
5
- import { BubbleChartProps } from './components/BubbleChart/types';
6
- import { GanttChartProps } from './components/GanttChart/types';
7
- declare enum LegendPosition {
1
+ export type { SankeyInputLink, SankeyInputNode, BulletLegendItemInterface } from '@unovis/ts';
2
+ export { SankeyNodeAlign, CurveType, Orientation } from '@unovis/ts';
3
+ export type { AreaChartProps, AreaChartProps as AreaStackedChartProps } from './components/AreaChart/types';
4
+ export type { BarChartProps } from './components/BarChart/types';
5
+ export type { LineChartProps } from './components/LineChart/types';
6
+ export type { DonutChartProps } from './components/DonutChart/types';
7
+ export { DonutType } from './components/DonutChart/types';
8
+ export type { BubbleChartProps } from './components/BubbleChart/types';
9
+ export type { GanttChartProps } from './components/GanttChart/types';
10
+ export type { DagreGraphProps, GraphNodeDatum, GraphLinkDatum, GraphData, DagreLayoutSettings, DagreRankDir, DagreAlign, DagreRanker, NodeShape, LinkArrowPosition, } from './components/DagreGraph/types';
11
+ export type { DualChartProps } from './components/DualChart/types';
12
+ export type { SankeyChartProps } from './components/SankeyChart/types';
13
+ export declare enum LegendPosition {
8
14
  TopLeft = "top-left",
9
15
  TopCenter = "top-center",
10
16
  TopRight = "top-right",
@@ -12,39 +18,6 @@ declare enum LegendPosition {
12
18
  BottomCenter = "bottom-center",
13
19
  BottomRight = "bottom-right"
14
20
  }
15
- declare enum CurveType {
16
- Basis = "basis",
17
- BasisClosed = "basisClosed",
18
- BasisOpen = "basisOpen",
19
- Bundle = "bundle",
20
- Cardinal = "cardinal",
21
- CardinalClosed = "cardinalClosed",
22
- CardinalOpen = "cardinalOpen",
23
- CatmullRom = "catmullRom",
24
- CatmullRomClosed = "catmullRomClosed",
25
- CatmullRomOpen = "catmullRomOpen",
26
- Linear = "linear",
27
- LinearClosed = "linearClosed",
28
- MonotoneX = "monotoneX",
29
- MonotoneY = "monotoneY",
30
- Natural = "natural",
31
- Step = "step",
32
- StepAfter = "stepAfter",
33
- StepBefore = "stepBefore"
34
- }
35
- interface BulletLegendItemInterface {
36
- name: string | number;
37
- color?: string | Array<string>;
38
- className?: string;
39
- inactive?: boolean;
40
- hidden?: boolean;
41
- pointer?: boolean;
42
- }
43
- declare enum Orientation {
44
- Horizontal = "horizontal",
45
- Vertical = "vertical"
46
- }
47
- export { LegendPosition, CurveType, Orientation, DonutType, type AreaChartProps, type BarChartProps, type LineChartProps, type DonutChartProps, type BulletLegendItemInterface, type BubbleChartProps, type GanttChartProps, };
48
21
  export type axisFormatter = ((tick: number, i?: number, ticks?: number[]) => string) | ((tick: Date, i?: number, ticks?: Date[]) => string);
49
22
  export interface AxisConfig {
50
23
  tickLine?: boolean;
package/dist/types.js CHANGED
@@ -1,6 +1,8 @@
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 || {});
1
+ import { CurveType as p, Orientation as m, SankeyNodeAlign as f } from "@unovis/ts";
2
+ var r = /* @__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))(r || {});
2
3
  export {
3
- a as CurveType,
4
- o as LegendPosition,
5
- l as Orientation
4
+ p as CurveType,
5
+ r as LegendPosition,
6
+ m as Orientation,
7
+ f as SankeyNodeAlign
6
8
  };
package/dist/utils.d.ts CHANGED
@@ -3,6 +3,9 @@ export declare function getDistributedIndices(length: number, numTicks: number):
3
3
  export declare function getFirstPropertyValue(obj: unknown): undefined;
4
4
  export declare const markerShape: (type: string, size: number, strokeWidth: number, color: string, strokeColor: string) => string;
5
5
  export declare function createMarkers(markerConfig: MarkerConfig): string;
6
+ export declare function createScopedMarkers(markerConfig: MarkerConfig, scopeId: string, options?: {
7
+ includeLegacy?: boolean;
8
+ }): string;
6
9
  export declare const flattenData: (data: any[], xAxis: string) => {
7
10
  month: any;
8
11
  }[];
package/dist/utils.js CHANGED
@@ -1,50 +1,54 @@
1
- function p(t) {
2
- if (t && Object.keys(t).length > 0) {
3
- const e = Object.keys(t)[0];
4
- return t[e];
1
+ function i(e) {
2
+ if (e && Object.keys(e).length > 0) {
3
+ const r = Object.keys(e)[0];
4
+ return e[r];
5
5
  }
6
6
  }
7
- const o = (t, e, r, n, $) => {
8
- switch (t) {
7
+ const s = (e, r, t, a, $) => {
8
+ switch (e) {
9
9
  case "circle":
10
- return `<circle cx="${e / 2}" cy="${e / 2}" r="${(e - r) / 2}" stroke-width="${r}" stroke="${$}" fill="${n}" />`;
10
+ return `<circle cx="${r / 2}" cy="${r / 2}" r="${(r - t) / 2}" stroke-width="${t}" stroke="${$}" fill="${a}" />`;
11
11
  case "square":
12
- return `<rect x="${r / 2}" y="${r / 2}" width="${e - r}" height="${e - r}" stroke-width="${r}" stroke="${$}" fill="${n}" />`;
12
+ return `<rect x="${t / 2}" y="${t / 2}" width="${r - t}" height="${r - t}" stroke-width="${t}" stroke="${$}" fill="${a}" />`;
13
13
  case "triangle":
14
- return `<polygon points="${e / 2},${r / 2} ${e - r / 2},${e - r / 2} ${r / 2},${e - r / 2}" stroke-width="${r}" stroke="${$}" fill="${n}" />`;
14
+ return `<polygon points="${r / 2},${t / 2} ${r - t / 2},${r - t / 2} ${t / 2},${r - t / 2}" stroke-width="${t}" stroke="${$}" fill="${a}" />`;
15
15
  case "diamond":
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="${n}" />`;
16
+ return `<polygon points="${r / 2},${t / 2} ${r - t / 2},${r / 2} ${r / 2},${r - t / 2} ${t / 2},${r / 2}" stroke-width="${t}" stroke="${$}" fill="${a}" />`;
17
17
  default:
18
18
  return "";
19
19
  }
20
20
  };
21
- function m(t) {
22
- return Object.entries(t.config).map(([e, r]) => {
23
- const n = r.type || "circle", $ = r.size || 10, c = r.strokeWidth || 2, a = r.color || "#000", l = r.strokeColor || r.color || "#000";
24
- return `<marker id="${t.id}-${e}" viewBox="0 0 ${$} ${$}" refX="${$ / 2}" refY="${$ / 2}" markerWidth="${$ / 2}" markerHeight="${$ / 2}">
25
- ${o(n, $, c, a, l)}
26
- </marker>`;
21
+ function f(e, r, t) {
22
+ const a = ($, n) => {
23
+ const o = n.type || "circle", c = n.size || 10, l = n.strokeWidth || 2, u = n.color || "#000", p = n.strokeColor || n.color || "#000";
24
+ return `<marker id="${$}" viewBox="0 0 ${c} ${c}" refX="${c / 2}" refY="${c / 2}" markerWidth="${c / 2}" markerHeight="${c / 2}" orient="auto">
25
+ ${s(o, c, l, u, p)}
26
+ </marker>`;
27
+ };
28
+ return Object.entries(e.config).flatMap(([$, n]) => {
29
+ const o = `${e.id}--${r}--${$}`, c = [a(o, n)];
30
+ return c.push(a(`${e.id}-${$}`, n)), c;
27
31
  }).join(`
28
32
  `);
29
33
  }
30
- function u(t) {
31
- return t.charAt(0).toUpperCase() + t.slice(1);
34
+ function m(e) {
35
+ return e.charAt(0).toUpperCase() + e.slice(1);
32
36
  }
33
- const f = (t, e) => {
34
- const r = Object.keys(t[0]).filter(($) => $ !== e), n = Object.keys(t[0][r[0]]);
35
- return t.map(($) => ({
37
+ const y = (e, r) => {
38
+ const t = Object.keys(e[0]).filter(($) => $ !== r), a = Object.keys(e[0][t[0]]);
39
+ return e.map(($) => ({
36
40
  month: $.month,
37
- ...r.flatMap(
38
- (c) => n.map((a) => ({
39
- [`${c}${u(a)}`]: $[c][a]
41
+ ...t.flatMap(
42
+ (n) => a.map((o) => ({
43
+ [`${n}${m(o)}`]: $[n][o]
40
44
  }))
41
- ).reduce((c, a) => ({ ...c, ...a }), {})
45
+ ).reduce((n, o) => ({ ...n, ...o }), {})
42
46
  }));
43
- }, y = (t) => Intl.DateTimeFormat().format(t);
47
+ }, w = (e) => Intl.DateTimeFormat().format(e);
44
48
  export {
45
- m as createMarkers,
46
- y as dateFormatter,
47
- f as flattenData,
48
- p as getFirstPropertyValue,
49
- o as markerShape
49
+ f as createScopedMarkers,
50
+ w as dateFormatter,
51
+ y as flattenData,
52
+ i as getFirstPropertyValue,
53
+ s as markerShape
50
54
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-chrts",
3
- "version": "2.0.0",
3
+ "version": "2.1.0-beta-2",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -10,16 +10,11 @@
10
10
  "types": "./dist/index.d.ts",
11
11
  "exports": {
12
12
  ".": {
13
+ "types": "./dist/index.d.ts",
13
14
  "import": "./dist/index.js",
14
15
  "require": "./dist/index.umd.cjs"
15
16
  }
16
17
  },
17
- "scripts": {
18
- "dev": "vite",
19
- "build": "vue-tsc -b && vite build",
20
- "preview": "vite preview",
21
- "release": "commit-and-tag-version"
22
- },
23
18
  "peerDependencies": {
24
19
  "vue": "^3.5.13"
25
20
  },
@@ -42,5 +37,10 @@
42
37
  "vue-router": "^4.5.0",
43
38
  "vue-tsc": "^2.2.4"
44
39
  },
45
- "packageManager": "pnpm@8.15.4+sha256.cea6d0bdf2de3a0549582da3983c70c92ffc577ff4410cbf190817ddc35137c2"
46
- }
40
+ "scripts": {
41
+ "dev": "vite",
42
+ "build": "vue-tsc -b && vite build",
43
+ "preview": "vite preview",
44
+ "release": "pnpm run build && commit-and-tag-version && pnpm publish"
45
+ }
46
+ }