vue-chrts 0.1.0-beta.2-internal-15 → 0.1.0-beta.2-internal-16

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 +1 @@
1
- {"version":3,"file":"AreaChart.cjs","sources":["../../../src/components/Area/AreaChart.vue"],"sourcesContent":["<script setup lang=\"ts\" generic=\"T\">\nimport { computed, createApp } from \"vue\";\nimport { getDistributedIndices } from \"../../utils\";\nimport {\n type NumericAccessor,\n BulletLegendItemInterface,\n CurveType,\n Position,\n} from \"@unovis/ts\";\nimport {\n VisArea,\n VisAxis,\n VisBulletLegend,\n VisCrosshair,\n VisLine,\n VisTooltip,\n VisXYContainer,\n} from \"@unovis/vue\";\n\nimport Tooltip from \"./../Tooltip.vue\";\nimport { PaginationPosition } from \"../../types\";\nexport interface AreaChartProps<T> {\n /**\n * The data to be displayed in the area chart.\n * Each element of the array represents a data point.\n * The structure of 'T' should be compatible with the chart's rendering logic.\n */\n data: T[];\n /**\n * The height of the chart in pixels.\n */\n height: number;\n /**\n * Optional label for the x-axis.\n */\n xLabel?: string;\n /**\n * Optional label for the y-axis.\n */\n yLabel?: string;\n /**\n * A record mapping category keys to `BulletLegendItemInterface` objects.\n * This defines the visual representation and labels for each category in the chart's legend.\n */\n categories: Record<string, BulletLegendItemInterface>;\n /**\n * A function that formats the x-axis tick labels.\n * @param item The x-axis value to be formatted.\n * @returns The formatted x-axis label.\n */\n xFormatter: (item: T) => string | number;\n /**\n * An optional function that formats the y-axis tick labels.\n * @param i The value to be formatted.\n * @param idx The index of the data point (optional).\n * @returns The formatted y-axis label or value.\n */\n yFormatter?: (i: number, idx?: number) => string | number;\n /**\n * The type of curve to use for the area chart lines.\n * See `CurveType` for available options.\n */\n curveType?: CurveType;\n /**\n * The desired number of ticks on the x-axis.\n */\n xNumTicks?: number;\n /**\n * The desired number of ticks on the y-axis.\n */\n yNumTicks?: number;\n /**\n * If `true`, hides the chart legend.\n */\n hideLegend?: boolean;\n /**\n * If `true`, hides the chart tooltip.\n */\n hideTooltip?: boolean;\n /**\n * If `true`, displays grid lines along the x-axis.\n */\n gridLineX?: boolean;\n /**\n * If `true`, displays a domain line (axis line) along the x-axis.\n */\n domainLineX?: boolean;\n /**\n * If `true`, displays grid lines along the y-axis.\n */\n gridLineY?: boolean;\n /**\n * If `true`, displays a domain line (axis line) along the y-axis.\n */\n domainLineY?: boolean;\n /**\n * Optional position for pagination controls, if applicable.\n * See `PaginationPosition` for available options.\n */\n paginationPosition?: PaginationPosition;\n}\n\nconst props = withDefaults(defineProps<AreaChartProps<T>>(), {\n xNumTicks: (props) =>\n props.data.length > 24 ? 24 / 4 : props.data.length - 1,\n yNumTicks: (props) =>\n props.data.length > 24 ? 24 / 4 : props.data.length - 1,\n});\n\nconst colors = Object.values(props.categories).map((c) => c.color);\n\nconst generateTooltip = computed(() => (d: T) => {\n if (typeof window === \"undefined\" || typeof document === \"undefined\") {\n return \"\";\n }\n\n try {\n const app = createApp(Tooltip, {\n data: d,\n categories: props.categories,\n });\n\n const container = document.createElement(\"div\");\n app.mount(container);\n\n const html = container.innerHTML;\n app.unmount();\n\n return html;\n } catch (error) {\n return \"\";\n }\n});\n\nfunction accessors(id: string): { y: NumericAccessor<T>; color: string } {\n return {\n y: (d: T) => Number(d[id as keyof typeof d]),\n color: props.categories[id]?.color ?? \"#3b82f6\",\n };\n}\n\nconst svgDefs = colors\n .map(\n (color, index) => `\n <linearGradient id=\"gradient${index}-${color}\" gradientTransform=\"rotate(90)\">\n <stop offset=\"0%\" stop-color=\"${color}\" stop-opacity=\"1\" />\n <stop offset=\"100%\" stop-color=\"${color}\" stop-opacity=\"0\" />\n </linearGradient>\n`\n )\n .join(\"\");\n\nconst PaginationPositionTop = computed(\n () => props.paginationPosition === PaginationPosition.Top\n);\n\nconst tickIndices = computed(() =>\n getDistributedIndices(props.data.length, props.xNumTicks)\n);\n\nconst filteredDataByIndices = computed(() => {\n if (!props.data?.length || !tickIndices || tickIndices.value.length === 0) {\n return [];\n }\n return tickIndices.value.map((index) => props.data[index]);\n});\n</script>\n\n<template>\n <div\n class=\"flex flex-col space-y-4\"\n :class=\"{ 'flex-col-reverse': PaginationPositionTop }\"\n >\n <VisXYContainer\n :data=\"filteredDataByIndices\"\n :height=\"height\"\n :svg-defs=\"svgDefs\"\n >\n <VisTooltip\n v-if=\"!hideTooltip\"\n :horizontal-placement=\"Position.Right\"\n :vertical-placement=\"Position.Top\"\n />\n <template v-for=\"(i, iKey) in Object.keys(props.categories)\" :key=\"iKey\">\n <VisArea\n :x=\"(_: T, i: number) => i\"\n v-bind=\"accessors(i)\"\n :color=\"`url(#gradient${iKey}-${colors[iKey]})`\"\n :opacity=\"0.5\"\n :curve-type=\"curveType ?? CurveType.MonotoneX\"\n />\n <VisLine\n :x=\"(_: any, i: number) => i\"\n :y=\"(d: T) => d[i as keyof typeof d]\"\n :color=\"colors[iKey]\"\n :curve-type=\"curveType ?? CurveType.MonotoneX\"\n />\n </template>\n\n <VisAxis\n type=\"x\"\n :num-ticks=\"filteredDataByIndices.length\"\n :tick-format=\"(i: number) => xFormatter(filteredDataByIndices[i])\"\n :label=\"xLabel\"\n :grid-line=\"gridLineX\"\n :domain-line=\"domainLineX\"\n :tick-line=\"!!gridLineX\"\n />\n <VisAxis\n type=\"y\"\n :num-ticks=\"yNumTicks\"\n :tick-format=\"yFormatter\"\n :label=\"yLabel\"\n :grid-line=\"gridLineY\"\n :domain-line=\"domainLineY\"\n :tick-line=\"!!gridLineY\"\n />\n <VisCrosshair\n v-if=\"!hideTooltip\"\n color=\"#666\"\n :template=\"generateTooltip\"\n />\n </VisXYContainer>\n <div\n v-if=\"!hideLegend\"\n class=\"flex items center justify-end\"\n :class=\"{ 'pb-4': PaginationPositionTop }\"\n >\n <VisBulletLegend :items=\"Object.values(categories)\" />\n </div>\n </div>\n</template>\n"],"names":["props","__props","colors","c","generateTooltip","computed","d","app","createApp","Tooltip","container","html","accessors","id","_a","svgDefs","color","index","PaginationPositionTop","PaginationPosition","tickIndices","getDistributedIndices","filteredDataByIndices"],"mappings":"6sBAsGA,MAAMA,EAAQC,EAORC,EAAS,OAAO,OAAOF,EAAM,UAAU,EAAE,IAAKG,GAAMA,EAAE,KAAK,EAE3DC,EAAkBC,EAAAA,SAAS,IAAOC,GAAS,CAC/C,GAAI,OAAO,OAAW,KAAe,OAAO,SAAa,IAChD,MAAA,GAGL,GAAA,CACI,MAAAC,EAAMC,YAAUC,UAAS,CAC7B,KAAMH,EACN,WAAYN,EAAM,UAAA,CACnB,EAEKU,EAAY,SAAS,cAAc,KAAK,EAC9CH,EAAI,MAAMG,CAAS,EAEnB,MAAMC,EAAOD,EAAU,UACvB,OAAAH,EAAI,QAAQ,EAELI,OACO,CACP,MAAA,EAAA,CACT,CACD,EAED,SAASC,EAAUC,EAAsD,OAChE,MAAA,CACL,EAAIP,GAAS,OAAOA,EAAEO,CAAoB,CAAC,EAC3C,QAAOC,EAAAd,EAAM,WAAWa,CAAE,IAAnB,YAAAC,EAAsB,QAAS,SACxC,CAAA,CAGF,MAAMC,EAAUb,EACb,IACC,CAACc,EAAOC,IAAU;AAAA,gCACUA,CAAK,IAAID,CAAK;AAAA,oCACVA,CAAK;AAAA,sCACHA,CAAK;AAAA;AAAA,CAAA,EAIxC,KAAK,EAAE,EAEJE,EAAwBb,EAAA,SAC5B,IAAML,EAAM,qBAAuBmB,qBAAmB,GACxD,EAEMC,EAAcf,EAAA,SAAS,IAC3BgB,EAAsB,sBAAArB,EAAM,KAAK,OAAQA,EAAM,SAAS,CAC1D,EAEMsB,EAAwBjB,EAAAA,SAAS,IAAM,OACvC,MAAA,GAACS,EAAAd,EAAM,OAAN,MAAAc,EAAY,SAAU,CAACM,GAAeA,EAAY,MAAM,SAAW,EAC/D,CAAC,EAEHA,EAAY,MAAM,IAAKH,GAAUjB,EAAM,KAAKiB,CAAK,CAAC,CAAA,CAC1D"}
1
+ {"version":3,"file":"AreaChart.cjs","sources":["../../../src/components/Area/AreaChart.vue"],"sourcesContent":["<script setup lang=\"ts\" generic=\"T\">\nimport { computed, createApp } from \"vue\";\nimport { getDistributedIndices } from '../../utils'\nimport {\n type NumericAccessor,\n CurveType,\n Position,\n} from \"@unovis/ts\";\nimport {\n VisArea,\n VisAxis,\n VisBulletLegend,\n VisCrosshair,\n VisLine,\n VisTooltip,\n VisXYContainer,\n} from \"@unovis/vue\";\n\nimport Tooltip from \"./../Tooltip.vue\";\nimport { PaginationPosition } from \"../../types\";\nimport { AreaChartProps } from \"./types\";\n\nconst props = withDefaults(defineProps<AreaChartProps<T>>(), {\n xNumTicks: (props) =>\n props.data.length > 24 ? 24 / 4 : props.data.length - 1,\n yNumTicks: (props) =>\n props.data.length > 24 ? 24 / 4 : props.data.length - 1,\n});\n\nconst colors = Object.values(props.categories).map((c) => c.color);\n\nconst generateTooltip = computed(() => (d: T) => {\n if (typeof window === \"undefined\" || typeof document === \"undefined\") {\n return \"\";\n }\n\n try {\n const app = createApp(Tooltip, {\n data: d,\n categories: props.categories,\n });\n\n const container = document.createElement(\"div\");\n app.mount(container);\n\n const html = container.innerHTML;\n app.unmount();\n\n return html;\n } catch (error) {\n return \"\";\n }\n});\n\nfunction accessors(id: string): { y: NumericAccessor<T>; color: string } {\n return {\n y: (d: T) => Number(d[id as keyof typeof d]),\n color: props.categories[id]?.color ?? \"#3b82f6\",\n };\n}\n\nconst svgDefs = colors\n .map(\n (color, index) => `\n <linearGradient id=\"gradient${index}-${color}\" gradientTransform=\"rotate(90)\">\n <stop offset=\"0%\" stop-color=\"${color}\" stop-opacity=\"1\" />\n <stop offset=\"100%\" stop-color=\"${color}\" stop-opacity=\"0\" />\n </linearGradient>\n`\n )\n .join(\"\");\n\nconst PaginationPositionTop = computed(\n () => props.paginationPosition === PaginationPosition.Top\n);\n\nconst tickIndices = computed(() => getDistributedIndices(props.data.length, props.xNumTicks))\n\nconst filteredDataByIndices = computed(() => {\n if (!props.data?.length || !tickIndices || tickIndices.value.length === 0) {\n return [];\n }\n return tickIndices.value.map((index) => props.data[index]);\n})\n\n</script>\n\n<template>\n <div\n class=\"flex flex-col space-y-4\"\n :class=\"{ 'flex-col-reverse': PaginationPositionTop }\"\n >\n <VisXYContainer :data=\"filteredDataByIndices\" :height=\"height\" :svg-defs=\"svgDefs\">\n <VisTooltip\n v-if=\"!hideTooltip\"\n :horizontal-placement=\"Position.Right\"\n :vertical-placement=\"Position.Top\"\n />\n <template v-for=\"(i, iKey) in Object.keys(props.categories)\" :key=\"iKey\">\n <VisArea\n :x=\"(_: T, i: number) => i\"\n v-bind=\"accessors(i)\"\n :color=\"`url(#gradient${iKey}-${colors[iKey]})`\"\n :opacity=\"0.5\"\n :curve-type=\"curveType ?? CurveType.MonotoneX\"\n />\n <VisLine\n :x=\"(_: any, i: number) => i\"\n :y=\"(d: T) => d[i as keyof typeof d]\"\n :color=\"colors[iKey]\"\n :curve-type=\"curveType ?? CurveType.MonotoneX\"\n />\n </template>\n\n <VisAxis\n type=\"x\"\n :num-ticks=\"filteredDataByIndices.length\"\n :tick-format=\"(i: number) => xFormatter(filteredDataByIndices[i])\"\n :label=\"xLabel\"\n :grid-line=\"gridLineX\"\n :domain-line=\"domainLineX\"\n :tick-line=\"!!gridLineX\"\n />\n <VisAxis\n type=\"y\"\n :num-ticks=\"yNumTicks\"\n :tick-format=\"yFormatter\"\n :label=\"yLabel\"\n :grid-line=\"gridLineY\"\n :domain-line=\"domainLineY\"\n :tick-line=\"!!gridLineY\"\n />\n <VisCrosshair\n v-if=\"!hideTooltip\"\n color=\"#666\"\n :template=\"generateTooltip\"\n />\n </VisXYContainer>\n <div\n v-if=\"!hideLegend\"\n class=\"flex items center justify-end\"\n :class=\"{ 'pb-4': PaginationPositionTop }\"\n >\n <VisBulletLegend :items=\"Object.values(categories)\" />\n </div>\n </div>\n</template>\n"],"names":["props","__props","colors","c","generateTooltip","computed","d","app","createApp","Tooltip","container","html","accessors","id","_a","svgDefs","color","index","PaginationPositionTop","PaginationPosition","tickIndices","getDistributedIndices","filteredDataByIndices"],"mappings":"6sBAsBA,MAAMA,EAAQC,EAORC,EAAS,OAAO,OAAOF,EAAM,UAAU,EAAE,IAAKG,GAAMA,EAAE,KAAK,EAE3DC,EAAkBC,EAAAA,SAAS,IAAOC,GAAS,CAC/C,GAAI,OAAO,OAAW,KAAe,OAAO,SAAa,IAChD,MAAA,GAGL,GAAA,CACI,MAAAC,EAAMC,YAAUC,UAAS,CAC7B,KAAMH,EACN,WAAYN,EAAM,UAAA,CACnB,EAEKU,EAAY,SAAS,cAAc,KAAK,EAC9CH,EAAI,MAAMG,CAAS,EAEnB,MAAMC,EAAOD,EAAU,UACvB,OAAAH,EAAI,QAAQ,EAELI,OACO,CACP,MAAA,EAAA,CACT,CACD,EAED,SAASC,EAAUC,EAAsD,OAChE,MAAA,CACL,EAAIP,GAAS,OAAOA,EAAEO,CAAoB,CAAC,EAC3C,QAAOC,EAAAd,EAAM,WAAWa,CAAE,IAAnB,YAAAC,EAAsB,QAAS,SACxC,CAAA,CAGF,MAAMC,EAAUb,EACb,IACC,CAACc,EAAOC,IAAU;AAAA,gCACUA,CAAK,IAAID,CAAK;AAAA,oCACVA,CAAK;AAAA,sCACHA,CAAK;AAAA;AAAA,CAAA,EAIxC,KAAK,EAAE,EAEJE,EAAwBb,EAAA,SAC5B,IAAML,EAAM,qBAAuBmB,qBAAmB,GACxD,EAEMC,EAAcf,WAAS,IAAOgB,wBAAsBrB,EAAM,KAAK,OAAQA,EAAM,SAAS,CAAC,EAEvFsB,EAAwBjB,EAAAA,SAAS,IAAM,OACvC,MAAA,GAACS,EAAAd,EAAM,OAAN,MAAAc,EAAY,SAAU,CAACM,GAAeA,EAAY,MAAM,SAAW,EAC/D,CAAC,EAEHA,EAAY,MAAM,IAAKH,GAAUjB,EAAM,KAAKiB,CAAK,CAAC,CAAA,CAC1D"}
@@ -1,94 +1,12 @@
1
- import { BulletLegendItemInterface, CurveType } from '@unovis/ts';
2
- import { PaginationPosition } from '../../types';
3
- import { VNodeProps, AllowedComponentProps, ComponentCustomProps, ShallowUnwrapRef, VNode, RendererNode, RendererElement } from 'vue';
1
+ import { AreaChartProps } from './types';
4
2
 
5
- export interface AreaChartProps<T> {
6
- /**
7
- * The data to be displayed in the area chart.
8
- * Each element of the array represents a data point.
9
- * The structure of 'T' should be compatible with the chart's rendering logic.
10
- */
11
- data: T[];
12
- /**
13
- * The height of the chart in pixels.
14
- */
15
- height: number;
16
- /**
17
- * Optional label for the x-axis.
18
- */
19
- xLabel?: string;
20
- /**
21
- * Optional label for the y-axis.
22
- */
23
- yLabel?: string;
24
- /**
25
- * A record mapping category keys to `BulletLegendItemInterface` objects.
26
- * This defines the visual representation and labels for each category in the chart's legend.
27
- */
28
- categories: Record<string, BulletLegendItemInterface>;
29
- /**
30
- * A function that formats the x-axis tick labels.
31
- * @param item The x-axis value to be formatted.
32
- * @returns The formatted x-axis label.
33
- */
34
- xFormatter: (item: T) => string | number;
35
- /**
36
- * An optional function that formats the y-axis tick labels.
37
- * @param i The value to be formatted.
38
- * @param idx The index of the data point (optional).
39
- * @returns The formatted y-axis label or value.
40
- */
41
- yFormatter?: (i: number, idx?: number) => string | number;
42
- /**
43
- * The type of curve to use for the area chart lines.
44
- * See `CurveType` for available options.
45
- */
46
- curveType?: CurveType;
47
- /**
48
- * The desired number of ticks on the x-axis.
49
- */
50
- xNumTicks?: number;
51
- /**
52
- * The desired number of ticks on the y-axis.
53
- */
54
- yNumTicks?: number;
55
- /**
56
- * If `true`, hides the chart legend.
57
- */
58
- hideLegend?: boolean;
59
- /**
60
- * If `true`, hides the chart tooltip.
61
- */
62
- hideTooltip?: boolean;
63
- /**
64
- * If `true`, displays grid lines along the x-axis.
65
- */
66
- gridLineX?: boolean;
67
- /**
68
- * If `true`, displays a domain line (axis line) along the x-axis.
69
- */
70
- domainLineX?: boolean;
71
- /**
72
- * If `true`, displays grid lines along the y-axis.
73
- */
74
- gridLineY?: boolean;
75
- /**
76
- * If `true`, displays a domain line (axis line) along the y-axis.
77
- */
78
- domainLineY?: boolean;
79
- /**
80
- * Optional position for pagination controls, if applicable.
81
- * See `PaginationPosition` for available options.
82
- */
83
- paginationPosition?: PaginationPosition;
84
- }
85
3
  declare const _default: <T>(__VLS_props: Awaited<typeof __VLS_setup>["props"], __VLS_ctx?: __VLS_Prettify<Pick<Awaited<typeof __VLS_setup>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
86
- props: __VLS_Prettify<__VLS_OmitKeepDiscriminatedUnion<(Partial<{}> & Omit<{} & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>) & AreaChartProps<T>, keyof VNodeProps | keyof AllowedComponentProps>> & {} & ( VNodeProps & AllowedComponentProps & ComponentCustomProps);
87
- expose(exposed: ShallowUnwrapRef<{}>): void;
4
+ props: __VLS_Prettify<__VLS_OmitKeepDiscriminatedUnion<(Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>) & AreaChartProps<T>, keyof import('vue').VNodeProps | keyof import('vue').AllowedComponentProps>> & {} & (import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps);
5
+ expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
88
6
  attrs: any;
89
7
  slots: ReturnType<() => {}>;
90
8
  emit: typeof __VLS_emit;
91
- }>) => VNode<RendererNode, RendererElement, {
9
+ }>) => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
92
10
  [key: string]: any;
93
11
  }> & {
94
12
  __ctx?: Awaited<typeof __VLS_setup>;
@@ -57,9 +57,7 @@ const Q = /* @__PURE__ */ X({
57
57
  `
58
58
  ).join(""), h = c(
59
59
  () => i.paginationPosition === E.Top
60
- ), m = c(
61
- () => F(i.data.length, i.xNumTicks)
62
- ), p = c(() => {
60
+ ), m = c(() => F(i.data.length, i.xNumTicks)), p = c(() => {
63
61
  var e;
64
62
  return !((e = i.data) != null && e.length) || !m || m.value.length === 0 ? [] : m.value.map((o) => i.data[o]);
65
63
  });
@@ -1 +1 @@
1
- {"version":3,"file":"AreaChart.js","sources":["../../../src/components/Area/AreaChart.vue"],"sourcesContent":["<script setup lang=\"ts\" generic=\"T\">\nimport { computed, createApp } from \"vue\";\nimport { getDistributedIndices } from \"../../utils\";\nimport {\n type NumericAccessor,\n BulletLegendItemInterface,\n CurveType,\n Position,\n} from \"@unovis/ts\";\nimport {\n VisArea,\n VisAxis,\n VisBulletLegend,\n VisCrosshair,\n VisLine,\n VisTooltip,\n VisXYContainer,\n} from \"@unovis/vue\";\n\nimport Tooltip from \"./../Tooltip.vue\";\nimport { PaginationPosition } from \"../../types\";\nexport interface AreaChartProps<T> {\n /**\n * The data to be displayed in the area chart.\n * Each element of the array represents a data point.\n * The structure of 'T' should be compatible with the chart's rendering logic.\n */\n data: T[];\n /**\n * The height of the chart in pixels.\n */\n height: number;\n /**\n * Optional label for the x-axis.\n */\n xLabel?: string;\n /**\n * Optional label for the y-axis.\n */\n yLabel?: string;\n /**\n * A record mapping category keys to `BulletLegendItemInterface` objects.\n * This defines the visual representation and labels for each category in the chart's legend.\n */\n categories: Record<string, BulletLegendItemInterface>;\n /**\n * A function that formats the x-axis tick labels.\n * @param item The x-axis value to be formatted.\n * @returns The formatted x-axis label.\n */\n xFormatter: (item: T) => string | number;\n /**\n * An optional function that formats the y-axis tick labels.\n * @param i The value to be formatted.\n * @param idx The index of the data point (optional).\n * @returns The formatted y-axis label or value.\n */\n yFormatter?: (i: number, idx?: number) => string | number;\n /**\n * The type of curve to use for the area chart lines.\n * See `CurveType` for available options.\n */\n curveType?: CurveType;\n /**\n * The desired number of ticks on the x-axis.\n */\n xNumTicks?: number;\n /**\n * The desired number of ticks on the y-axis.\n */\n yNumTicks?: number;\n /**\n * If `true`, hides the chart legend.\n */\n hideLegend?: boolean;\n /**\n * If `true`, hides the chart tooltip.\n */\n hideTooltip?: boolean;\n /**\n * If `true`, displays grid lines along the x-axis.\n */\n gridLineX?: boolean;\n /**\n * If `true`, displays a domain line (axis line) along the x-axis.\n */\n domainLineX?: boolean;\n /**\n * If `true`, displays grid lines along the y-axis.\n */\n gridLineY?: boolean;\n /**\n * If `true`, displays a domain line (axis line) along the y-axis.\n */\n domainLineY?: boolean;\n /**\n * Optional position for pagination controls, if applicable.\n * See `PaginationPosition` for available options.\n */\n paginationPosition?: PaginationPosition;\n}\n\nconst props = withDefaults(defineProps<AreaChartProps<T>>(), {\n xNumTicks: (props) =>\n props.data.length > 24 ? 24 / 4 : props.data.length - 1,\n yNumTicks: (props) =>\n props.data.length > 24 ? 24 / 4 : props.data.length - 1,\n});\n\nconst colors = Object.values(props.categories).map((c) => c.color);\n\nconst generateTooltip = computed(() => (d: T) => {\n if (typeof window === \"undefined\" || typeof document === \"undefined\") {\n return \"\";\n }\n\n try {\n const app = createApp(Tooltip, {\n data: d,\n categories: props.categories,\n });\n\n const container = document.createElement(\"div\");\n app.mount(container);\n\n const html = container.innerHTML;\n app.unmount();\n\n return html;\n } catch (error) {\n return \"\";\n }\n});\n\nfunction accessors(id: string): { y: NumericAccessor<T>; color: string } {\n return {\n y: (d: T) => Number(d[id as keyof typeof d]),\n color: props.categories[id]?.color ?? \"#3b82f6\",\n };\n}\n\nconst svgDefs = colors\n .map(\n (color, index) => `\n <linearGradient id=\"gradient${index}-${color}\" gradientTransform=\"rotate(90)\">\n <stop offset=\"0%\" stop-color=\"${color}\" stop-opacity=\"1\" />\n <stop offset=\"100%\" stop-color=\"${color}\" stop-opacity=\"0\" />\n </linearGradient>\n`\n )\n .join(\"\");\n\nconst PaginationPositionTop = computed(\n () => props.paginationPosition === PaginationPosition.Top\n);\n\nconst tickIndices = computed(() =>\n getDistributedIndices(props.data.length, props.xNumTicks)\n);\n\nconst filteredDataByIndices = computed(() => {\n if (!props.data?.length || !tickIndices || tickIndices.value.length === 0) {\n return [];\n }\n return tickIndices.value.map((index) => props.data[index]);\n});\n</script>\n\n<template>\n <div\n class=\"flex flex-col space-y-4\"\n :class=\"{ 'flex-col-reverse': PaginationPositionTop }\"\n >\n <VisXYContainer\n :data=\"filteredDataByIndices\"\n :height=\"height\"\n :svg-defs=\"svgDefs\"\n >\n <VisTooltip\n v-if=\"!hideTooltip\"\n :horizontal-placement=\"Position.Right\"\n :vertical-placement=\"Position.Top\"\n />\n <template v-for=\"(i, iKey) in Object.keys(props.categories)\" :key=\"iKey\">\n <VisArea\n :x=\"(_: T, i: number) => i\"\n v-bind=\"accessors(i)\"\n :color=\"`url(#gradient${iKey}-${colors[iKey]})`\"\n :opacity=\"0.5\"\n :curve-type=\"curveType ?? CurveType.MonotoneX\"\n />\n <VisLine\n :x=\"(_: any, i: number) => i\"\n :y=\"(d: T) => d[i as keyof typeof d]\"\n :color=\"colors[iKey]\"\n :curve-type=\"curveType ?? CurveType.MonotoneX\"\n />\n </template>\n\n <VisAxis\n type=\"x\"\n :num-ticks=\"filteredDataByIndices.length\"\n :tick-format=\"(i: number) => xFormatter(filteredDataByIndices[i])\"\n :label=\"xLabel\"\n :grid-line=\"gridLineX\"\n :domain-line=\"domainLineX\"\n :tick-line=\"!!gridLineX\"\n />\n <VisAxis\n type=\"y\"\n :num-ticks=\"yNumTicks\"\n :tick-format=\"yFormatter\"\n :label=\"yLabel\"\n :grid-line=\"gridLineY\"\n :domain-line=\"domainLineY\"\n :tick-line=\"!!gridLineY\"\n />\n <VisCrosshair\n v-if=\"!hideTooltip\"\n color=\"#666\"\n :template=\"generateTooltip\"\n />\n </VisXYContainer>\n <div\n v-if=\"!hideLegend\"\n class=\"flex items center justify-end\"\n :class=\"{ 'pb-4': PaginationPositionTop }\"\n >\n <VisBulletLegend :items=\"Object.values(categories)\" />\n </div>\n </div>\n</template>\n"],"names":["props","__props","colors","c","generateTooltip","computed","d","app","createApp","Tooltip","container","html","accessors","id","_a","svgDefs","color","index","PaginationPositionTop","PaginationPosition","tickIndices","getDistributedIndices","filteredDataByIndices"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsGA,UAAMA,IAAQC,GAORC,IAAS,OAAO,OAAOF,EAAM,UAAU,EAAE,IAAI,CAACG,MAAMA,EAAE,KAAK,GAE3DC,IAAkBC,EAAS,MAAM,CAACC,MAAS;AAC/C,UAAI,OAAO,SAAW,OAAe,OAAO,WAAa;AAChD,eAAA;AAGL,UAAA;AACI,cAAAC,IAAMC,EAAUC,GAAS;AAAA,UAC7B,MAAMH;AAAA,UACN,YAAYN,EAAM;AAAA,QAAA,CACnB,GAEKU,IAAY,SAAS,cAAc,KAAK;AAC9C,QAAAH,EAAI,MAAMG,CAAS;AAEnB,cAAMC,IAAOD,EAAU;AACvB,eAAAH,EAAI,QAAQ,GAELI;AAAA,cACO;AACP,eAAA;AAAA,MAAA;AAAA,IACT,CACD;AAED,aAASC,EAAUC,GAAsD;;AAChE,aAAA;AAAA,QACL,GAAG,CAACP,MAAS,OAAOA,EAAEO,CAAoB,CAAC;AAAA,QAC3C,SAAOC,IAAAd,EAAM,WAAWa,CAAE,MAAnB,gBAAAC,EAAsB,UAAS;AAAA,MACxC;AAAA,IAAA;AAGF,UAAMC,IAAUb,EACb;AAAA,MACC,CAACc,GAAOC,MAAU;AAAA,gCACUA,CAAK,IAAID,CAAK;AAAA,oCACVA,CAAK;AAAA,sCACHA,CAAK;AAAA;AAAA;AAAA,IAAA,EAIxC,KAAK,EAAE,GAEJE,IAAwBb;AAAA,MAC5B,MAAML,EAAM,uBAAuBmB,EAAmB;AAAA,IACxD,GAEMC,IAAcf;AAAA,MAAS,MAC3BgB,EAAsBrB,EAAM,KAAK,QAAQA,EAAM,SAAS;AAAA,IAC1D,GAEMsB,IAAwBjB,EAAS,MAAM;;AACvC,aAAA,GAACS,IAAAd,EAAM,SAAN,QAAAc,EAAY,WAAU,CAACM,KAAeA,EAAY,MAAM,WAAW,IAC/D,CAAC,IAEHA,EAAY,MAAM,IAAI,CAACH,MAAUjB,EAAM,KAAKiB,CAAK,CAAC;AAAA,IAAA,CAC1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"AreaChart.js","sources":["../../../src/components/Area/AreaChart.vue"],"sourcesContent":["<script setup lang=\"ts\" generic=\"T\">\nimport { computed, createApp } from \"vue\";\nimport { getDistributedIndices } from '../../utils'\nimport {\n type NumericAccessor,\n CurveType,\n Position,\n} from \"@unovis/ts\";\nimport {\n VisArea,\n VisAxis,\n VisBulletLegend,\n VisCrosshair,\n VisLine,\n VisTooltip,\n VisXYContainer,\n} from \"@unovis/vue\";\n\nimport Tooltip from \"./../Tooltip.vue\";\nimport { PaginationPosition } from \"../../types\";\nimport { AreaChartProps } from \"./types\";\n\nconst props = withDefaults(defineProps<AreaChartProps<T>>(), {\n xNumTicks: (props) =>\n props.data.length > 24 ? 24 / 4 : props.data.length - 1,\n yNumTicks: (props) =>\n props.data.length > 24 ? 24 / 4 : props.data.length - 1,\n});\n\nconst colors = Object.values(props.categories).map((c) => c.color);\n\nconst generateTooltip = computed(() => (d: T) => {\n if (typeof window === \"undefined\" || typeof document === \"undefined\") {\n return \"\";\n }\n\n try {\n const app = createApp(Tooltip, {\n data: d,\n categories: props.categories,\n });\n\n const container = document.createElement(\"div\");\n app.mount(container);\n\n const html = container.innerHTML;\n app.unmount();\n\n return html;\n } catch (error) {\n return \"\";\n }\n});\n\nfunction accessors(id: string): { y: NumericAccessor<T>; color: string } {\n return {\n y: (d: T) => Number(d[id as keyof typeof d]),\n color: props.categories[id]?.color ?? \"#3b82f6\",\n };\n}\n\nconst svgDefs = colors\n .map(\n (color, index) => `\n <linearGradient id=\"gradient${index}-${color}\" gradientTransform=\"rotate(90)\">\n <stop offset=\"0%\" stop-color=\"${color}\" stop-opacity=\"1\" />\n <stop offset=\"100%\" stop-color=\"${color}\" stop-opacity=\"0\" />\n </linearGradient>\n`\n )\n .join(\"\");\n\nconst PaginationPositionTop = computed(\n () => props.paginationPosition === PaginationPosition.Top\n);\n\nconst tickIndices = computed(() => getDistributedIndices(props.data.length, props.xNumTicks))\n\nconst filteredDataByIndices = computed(() => {\n if (!props.data?.length || !tickIndices || tickIndices.value.length === 0) {\n return [];\n }\n return tickIndices.value.map((index) => props.data[index]);\n})\n\n</script>\n\n<template>\n <div\n class=\"flex flex-col space-y-4\"\n :class=\"{ 'flex-col-reverse': PaginationPositionTop }\"\n >\n <VisXYContainer :data=\"filteredDataByIndices\" :height=\"height\" :svg-defs=\"svgDefs\">\n <VisTooltip\n v-if=\"!hideTooltip\"\n :horizontal-placement=\"Position.Right\"\n :vertical-placement=\"Position.Top\"\n />\n <template v-for=\"(i, iKey) in Object.keys(props.categories)\" :key=\"iKey\">\n <VisArea\n :x=\"(_: T, i: number) => i\"\n v-bind=\"accessors(i)\"\n :color=\"`url(#gradient${iKey}-${colors[iKey]})`\"\n :opacity=\"0.5\"\n :curve-type=\"curveType ?? CurveType.MonotoneX\"\n />\n <VisLine\n :x=\"(_: any, i: number) => i\"\n :y=\"(d: T) => d[i as keyof typeof d]\"\n :color=\"colors[iKey]\"\n :curve-type=\"curveType ?? CurveType.MonotoneX\"\n />\n </template>\n\n <VisAxis\n type=\"x\"\n :num-ticks=\"filteredDataByIndices.length\"\n :tick-format=\"(i: number) => xFormatter(filteredDataByIndices[i])\"\n :label=\"xLabel\"\n :grid-line=\"gridLineX\"\n :domain-line=\"domainLineX\"\n :tick-line=\"!!gridLineX\"\n />\n <VisAxis\n type=\"y\"\n :num-ticks=\"yNumTicks\"\n :tick-format=\"yFormatter\"\n :label=\"yLabel\"\n :grid-line=\"gridLineY\"\n :domain-line=\"domainLineY\"\n :tick-line=\"!!gridLineY\"\n />\n <VisCrosshair\n v-if=\"!hideTooltip\"\n color=\"#666\"\n :template=\"generateTooltip\"\n />\n </VisXYContainer>\n <div\n v-if=\"!hideLegend\"\n class=\"flex items center justify-end\"\n :class=\"{ 'pb-4': PaginationPositionTop }\"\n >\n <VisBulletLegend :items=\"Object.values(categories)\" />\n </div>\n </div>\n</template>\n"],"names":["props","__props","colors","c","generateTooltip","computed","d","app","createApp","Tooltip","container","html","accessors","id","_a","svgDefs","color","index","PaginationPositionTop","PaginationPosition","tickIndices","getDistributedIndices","filteredDataByIndices"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,UAAMA,IAAQC,GAORC,IAAS,OAAO,OAAOF,EAAM,UAAU,EAAE,IAAI,CAACG,MAAMA,EAAE,KAAK,GAE3DC,IAAkBC,EAAS,MAAM,CAACC,MAAS;AAC/C,UAAI,OAAO,SAAW,OAAe,OAAO,WAAa;AAChD,eAAA;AAGL,UAAA;AACI,cAAAC,IAAMC,EAAUC,GAAS;AAAA,UAC7B,MAAMH;AAAA,UACN,YAAYN,EAAM;AAAA,QAAA,CACnB,GAEKU,IAAY,SAAS,cAAc,KAAK;AAC9C,QAAAH,EAAI,MAAMG,CAAS;AAEnB,cAAMC,IAAOD,EAAU;AACvB,eAAAH,EAAI,QAAQ,GAELI;AAAA,cACO;AACP,eAAA;AAAA,MAAA;AAAA,IACT,CACD;AAED,aAASC,EAAUC,GAAsD;;AAChE,aAAA;AAAA,QACL,GAAG,CAACP,MAAS,OAAOA,EAAEO,CAAoB,CAAC;AAAA,QAC3C,SAAOC,IAAAd,EAAM,WAAWa,CAAE,MAAnB,gBAAAC,EAAsB,UAAS;AAAA,MACxC;AAAA,IAAA;AAGF,UAAMC,IAAUb,EACb;AAAA,MACC,CAACc,GAAOC,MAAU;AAAA,gCACUA,CAAK,IAAID,CAAK;AAAA,oCACVA,CAAK;AAAA,sCACHA,CAAK;AAAA;AAAA;AAAA,IAAA,EAIxC,KAAK,EAAE,GAEJE,IAAwBb;AAAA,MAC5B,MAAML,EAAM,uBAAuBmB,EAAmB;AAAA,IACxD,GAEMC,IAAcf,EAAS,MAAOgB,EAAsBrB,EAAM,KAAK,QAAQA,EAAM,SAAS,CAAC,GAEvFsB,IAAwBjB,EAAS,MAAM;;AACvC,aAAA,GAACS,IAAAd,EAAM,SAAN,QAAAc,EAAY,WAAU,CAACM,KAAeA,EAAY,MAAM,WAAW,IAC/D,CAAC,IAEHA,EAAY,MAAM,IAAI,CAACH,MAAUjB,EAAM,KAAKiB,CAAK,CAAC;AAAA,IAAA,CAC1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1 +1,2 @@
1
1
  export { default as AreaChart } from './AreaChart';
2
+ export * from './types';
@@ -0,0 +1,83 @@
1
+ import { PaginationPosition } from '../../types';
2
+ import { BulletLegendItemInterface, CurveType } from '@unovis/ts';
3
+
4
+ export interface AreaChartProps<T> {
5
+ /**
6
+ * The data to be displayed in the area chart.
7
+ * Each element of the array represents a data point.
8
+ * The structure of 'T' should be compatible with the chart's rendering logic.
9
+ */
10
+ data: T[];
11
+ /**
12
+ * The height of the chart in pixels.
13
+ */
14
+ height: number;
15
+ /**
16
+ * Optional label for the x-axis.
17
+ */
18
+ xLabel?: string;
19
+ /**
20
+ * Optional label for the y-axis.
21
+ */
22
+ yLabel?: string;
23
+ /**
24
+ * A record mapping category keys to `BulletLegendItemInterface` objects.
25
+ * This defines the visual representation and labels for each category in the chart's legend.
26
+ */
27
+ categories: Record<string, BulletLegendItemInterface>;
28
+ /**
29
+ * A function that formats the x-axis tick labels.
30
+ * @param item The x-axis value to be formatted.
31
+ * @returns The formatted x-axis label.
32
+ */
33
+ xFormatter: (item: T) => string | number;
34
+ /**
35
+ * An optional function that formats the y-axis tick labels.
36
+ * @param i The value to be formatted.
37
+ * @param idx The index of the data point (optional).
38
+ * @returns The formatted y-axis label or value.
39
+ */
40
+ yFormatter?: (i: number, idx?: number) => string | number;
41
+ /**
42
+ * The type of curve to use for the area chart lines.
43
+ * See `CurveType` for available options.
44
+ */
45
+ curveType?: CurveType;
46
+ /**
47
+ * The desired number of ticks on the x-axis.
48
+ */
49
+ xNumTicks?: number;
50
+ /**
51
+ * The desired number of ticks on the y-axis.
52
+ */
53
+ yNumTicks?: number;
54
+ /**
55
+ * If `true`, hides the chart legend.
56
+ */
57
+ hideLegend?: boolean;
58
+ /**
59
+ * If `true`, hides the chart tooltip.
60
+ */
61
+ hideTooltip?: boolean;
62
+ /**
63
+ * If `true`, displays grid lines along the x-axis.
64
+ */
65
+ gridLineX?: boolean;
66
+ /**
67
+ * If `true`, displays a domain line (axis line) along the x-axis.
68
+ */
69
+ domainLineX?: boolean;
70
+ /**
71
+ * If `true`, displays grid lines along the y-axis.
72
+ */
73
+ gridLineY?: boolean;
74
+ /**
75
+ * If `true`, displays a domain line (axis line) along the y-axis.
76
+ */
77
+ domainLineY?: boolean;
78
+ /**
79
+ * Optional position for pagination controls, if applicable.
80
+ * See `PaginationPosition` for available options.
81
+ */
82
+ paginationPosition?: PaginationPosition;
83
+ }
@@ -1,5 +1,4 @@
1
1
  import { BulletLegendItemInterface } from '@unovis/ts';
2
- import { VNodeProps, AllowedComponentProps, ComponentCustomProps, ShallowUnwrapRef, VNode, RendererNode, RendererElement } from 'vue';
3
2
 
4
3
  export type AreaStackedChartProps<T> = {
5
4
  data: T[];
@@ -8,12 +7,12 @@ export type AreaStackedChartProps<T> = {
8
7
  hideTooltip?: boolean;
9
8
  };
10
9
  declare const _default: <T>(__VLS_props: Awaited<typeof __VLS_setup>["props"], __VLS_ctx?: __VLS_Prettify<Pick<Awaited<typeof __VLS_setup>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
11
- props: __VLS_Prettify<__VLS_OmitKeepDiscriminatedUnion<(Partial<{}> & Omit<{} & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>) & AreaStackedChartProps<T>, keyof VNodeProps | keyof AllowedComponentProps>> & {} & ( VNodeProps & AllowedComponentProps & ComponentCustomProps);
12
- expose(exposed: ShallowUnwrapRef<{}>): void;
10
+ props: __VLS_Prettify<__VLS_OmitKeepDiscriminatedUnion<(Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>) & AreaStackedChartProps<T>, keyof import('vue').VNodeProps | keyof import('vue').AllowedComponentProps>> & {} & (import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps);
11
+ expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
13
12
  attrs: any;
14
13
  slots: ReturnType<() => {}>;
15
14
  emit: typeof __VLS_emit;
16
- }>) => VNode<RendererNode, RendererElement, {
15
+ }>) => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
17
16
  [key: string]: any;
18
17
  }> & {
19
18
  __ctx?: Awaited<typeof __VLS_setup>;
@@ -1,9 +1,8 @@
1
1
  import { BulletLegendItemInterface, Orientation } from '@unovis/ts';
2
2
  import { PaginationPosition } from '../../types';
3
- import { VNodeProps, AllowedComponentProps, ComponentCustomProps, ShallowUnwrapRef, VNode, RendererNode, RendererElement } from 'vue';
4
3
 
5
4
  declare const _default: <T>(__VLS_props: Awaited<typeof __VLS_setup>["props"], __VLS_ctx?: __VLS_Prettify<Pick<Awaited<typeof __VLS_setup>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
6
- props: __VLS_Prettify<__VLS_OmitKeepDiscriminatedUnion<(Partial<{}> & Omit<{} & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>) & {
5
+ props: __VLS_Prettify<__VLS_OmitKeepDiscriminatedUnion<(Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>) & {
7
6
  data: T[];
8
7
  stacked?: boolean;
9
8
  height: number;
@@ -21,12 +20,12 @@ declare const _default: <T>(__VLS_props: Awaited<typeof __VLS_setup>["props"], _
21
20
  hideLegend?: boolean;
22
21
  orientation?: Orientation;
23
22
  paginationPosition?: PaginationPosition;
24
- }, keyof VNodeProps | keyof AllowedComponentProps>> & {} & ( VNodeProps & AllowedComponentProps & ComponentCustomProps);
25
- expose(exposed: ShallowUnwrapRef<{}>): void;
23
+ }, keyof import('vue').VNodeProps | keyof import('vue').AllowedComponentProps>> & {} & (import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps);
24
+ expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
26
25
  attrs: any;
27
26
  slots: ReturnType<() => {}>;
28
27
  emit: typeof __VLS_emit;
29
- }>) => VNode<RendererNode, RendererElement, {
28
+ }>) => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
30
29
  [key: string]: any;
31
30
  }> & {
32
31
  __ctx?: Awaited<typeof __VLS_setup>;
@@ -1,30 +1,30 @@
1
1
  import { BulletLegendItemInterface } from '@unovis/ts';
2
- import { Component, DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions, PropType } from 'vue';
2
+ import { Component } from 'vue';
3
3
 
4
- declare const _default: DefineComponent<ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
4
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
5
5
  colors: string[];
6
6
  index: string;
7
7
  items: BulletLegendItemInterface[];
8
8
  customTooltip?: Component;
9
9
  }>, {
10
- colors: () => never[];
11
- }>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly< ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
10
+ colors: () => any[];
11
+ }>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
12
12
  colors: string[];
13
13
  index: string;
14
14
  items: BulletLegendItemInterface[];
15
15
  customTooltip?: Component;
16
16
  }>, {
17
- colors: () => never[];
17
+ colors: () => any[];
18
18
  }>>> & Readonly<{}>, {
19
19
  colors: string[];
20
- }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
20
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
21
21
  export default _default;
22
22
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
23
23
  type __VLS_TypePropsToRuntimeProps<T> = {
24
24
  [K in keyof T]-?: {} extends Pick<T, K> ? {
25
- type: PropType<__VLS_NonUndefinedable<T[K]>>;
25
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
26
26
  } : {
27
- type: PropType<T[K]>;
27
+ type: import('vue').PropType<T[K]>;
28
28
  required: true;
29
29
  };
30
30
  };
@@ -1,18 +1,17 @@
1
1
  import { DonutChartProps } from '.';
2
- import { DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions, PropType } from 'vue';
3
2
 
4
3
  declare function __VLS_template(): {
5
4
  default?(_: {}): any;
6
5
  };
7
- declare const __VLS_component: DefineComponent<ExtractPropTypes<__VLS_TypePropsToRuntimeProps<DonutChartProps>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly< ExtractPropTypes<__VLS_TypePropsToRuntimeProps<DonutChartProps>>> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
6
+ declare const __VLS_component: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<DonutChartProps>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<DonutChartProps>>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
8
7
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
9
8
  export default _default;
10
9
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
11
10
  type __VLS_TypePropsToRuntimeProps<T> = {
12
11
  [K in keyof T]-?: {} extends Pick<T, K> ? {
13
- type: PropType<__VLS_NonUndefinedable<T[K]>>;
12
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
14
13
  } : {
15
- type: PropType<T[K]>;
14
+ type: import('vue').PropType<T[K]>;
16
15
  required: true;
17
16
  };
18
17
  };
@@ -1,9 +1,8 @@
1
1
  import { CurveType, BulletLegendItemInterface } from '@unovis/ts';
2
2
  import { PaginationPosition } from '../../types';
3
- import { VNodeProps, AllowedComponentProps, ComponentCustomProps, ShallowUnwrapRef, VNode, RendererNode, RendererElement } from 'vue';
4
3
 
5
4
  declare const _default: <T>(__VLS_props: Awaited<typeof __VLS_setup>["props"], __VLS_ctx?: __VLS_Prettify<Pick<Awaited<typeof __VLS_setup>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
6
- props: __VLS_Prettify<__VLS_OmitKeepDiscriminatedUnion<(Partial<{}> & Omit<{} & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>) & {
5
+ props: __VLS_Prettify<__VLS_OmitKeepDiscriminatedUnion<(Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>) & {
7
6
  data: T[];
8
7
  height: number;
9
8
  xLabel?: string;
@@ -15,12 +14,12 @@ declare const _default: <T>(__VLS_props: Awaited<typeof __VLS_setup>["props"], _
15
14
  yNumTicks?: number;
16
15
  xNumTicks?: number;
17
16
  paginationPosition?: PaginationPosition;
18
- }, keyof VNodeProps | keyof AllowedComponentProps>> & {} & ( VNodeProps & AllowedComponentProps & ComponentCustomProps);
19
- expose(exposed: ShallowUnwrapRef<{}>): void;
17
+ }, keyof import('vue').VNodeProps | keyof import('vue').AllowedComponentProps>> & {} & (import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps);
18
+ expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
20
19
  attrs: any;
21
20
  slots: ReturnType<() => {}>;
22
21
  emit: typeof __VLS_emit;
23
- }>) => VNode<RendererNode, RendererElement, {
22
+ }>) => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
24
23
  [key: string]: any;
25
24
  }> & {
26
25
  __ctx?: Awaited<typeof __VLS_setup>;
@@ -1,16 +1,15 @@
1
1
  import { BulletLegendItemInterface } from '@unovis/ts';
2
- import { VNodeProps, AllowedComponentProps, ComponentCustomProps, ShallowUnwrapRef, VNode, RendererNode, RendererElement } from 'vue';
3
2
 
4
3
  declare const _default: <T>(__VLS_props: Awaited<typeof __VLS_setup>["props"], __VLS_ctx?: __VLS_Prettify<Pick<Awaited<typeof __VLS_setup>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
5
- props: __VLS_Prettify<__VLS_OmitKeepDiscriminatedUnion<(Partial<{}> & Omit<{} & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>) & {
4
+ props: __VLS_Prettify<__VLS_OmitKeepDiscriminatedUnion<(Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>) & {
6
5
  data: T;
7
6
  categories: Record<string, BulletLegendItemInterface>;
8
- }, keyof VNodeProps | keyof AllowedComponentProps>> & {} & ( VNodeProps & AllowedComponentProps & ComponentCustomProps);
9
- expose(exposed: ShallowUnwrapRef<{}>): void;
7
+ }, keyof import('vue').VNodeProps | keyof import('vue').AllowedComponentProps>> & {} & (import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps);
8
+ expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
10
9
  attrs: any;
11
10
  slots: ReturnType<() => {}>;
12
11
  emit: typeof __VLS_emit;
13
- }>) => VNode<RendererNode, RendererElement, {
12
+ }>) => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
14
13
  [key: string]: any;
15
14
  }> & {
16
15
  __ctx?: Awaited<typeof __VLS_setup>;
@@ -0,0 +1,6 @@
1
+ export * from './components/Area';
2
+ export * from './components/AreaStacked';
3
+ export * from './components/Line';
4
+ export * from './components/Bar';
5
+ export * from './components/Donut';
6
+ export * from './components/Crosshair';
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./components/Area/AreaChart.cjs"),r=require("./components/Donut/index.cjs"),u=require("./types.cjs"),e=require("@unovis/ts"),a=require("./components/AreaStacked/AreaStackedChart.cjs"),i=require("./components/Bar/BarChart.cjs"),n=require("./components/Crosshair/Crosshair.cjs"),_=require("./components/Donut/DonutChart.cjs"),o=require("./components/Line/LineChart.cjs");exports.AreaChart=t.default;exports.DonutType=r.DonutType;exports.PaginationPosition=u.PaginationPosition;Object.defineProperty(exports,"CurveType",{enumerable:!0,get:()=>e.CurveType});Object.defineProperty(exports,"Orientation",{enumerable:!0,get:()=>e.Orientation});Object.defineProperty(exports,"Position",{enumerable:!0,get:()=>e.Position});exports.AreaStackedChart=a.default;exports.BarChart=i.default;exports.Crosshair=n.default;exports.DonutChart=_.default;exports.LineChart=o.default;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@unovis/ts"),u=require("./components/Area/AreaChart.cjs"),_=require("./components/AreaStacked/AreaStackedChart.cjs"),a=require("./components/Line/LineChart.cjs"),n=require("./components/Bar/BarChart.cjs"),i=require("./components/Donut/DonutChart.cjs"),o=require("./components/Crosshair/Crosshair.cjs"),s=require("./components/Donut/index.cjs");var r=(e=>(e.Top="top",e.Bottom="bottom",e))(r||{});Object.defineProperty(exports,"CurveType",{enumerable:!0,get:()=>t.CurveType});Object.defineProperty(exports,"Orientation",{enumerable:!0,get:()=>t.Orientation});Object.defineProperty(exports,"Position",{enumerable:!0,get:()=>t.Position});exports.AreaChart=u.default;exports.AreaStackedChart=_.default;exports.LineChart=a.default;exports.BarChart=n.default;exports.DonutChart=i.default;exports.Crosshair=o.default;exports.DonutType=s.DonutType;exports.PaginationPosition=r;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":["export * from \"./components\";\n\nexport enum PaginationPosition {\n Top = \"top\",\n Bottom = \"bottom\",\n }\n\nexport { CurveType, type BulletLegendItemInterface, Position, Orientation } from '@unovis/ts'"],"names":["PaginationPosition"],"mappings":"ybAEY,IAAAA,GAAAA,IACRA,EAAA,IAAM,MACNA,EAAA,OAAS,SAFDA,IAAAA,GAAA,CAAA,CAAA"}
package/dist/index.d.ts CHANGED
@@ -1,12 +1,6 @@
1
- import { default as AreaChart } from './components/Area/AreaChart';
2
-
3
- export { AreaChart };
4
- export type { AreaChartProps } from './components/Area/AreaChart';
5
- export * from './components/AreaStacked';
6
- export * from './components/Bar';
7
- export * from './components/Crosshair';
8
- export * from './components/Donut';
9
- export * from './components/Line';
10
- export { PaginationPosition } from './types';
11
- export { CurveType, Position, Orientation, type NumericAccessor } from '@unovis/ts';
12
- export type { BulletLegendItemInterface } from '@unovis/ts';
1
+ export * from './components';
2
+ export declare enum PaginationPosition {
3
+ Top = "top",
4
+ Bottom = "bottom"
5
+ }
6
+ export { CurveType, type BulletLegendItemInterface, Position, Orientation } from '@unovis/ts';
package/dist/index.js CHANGED
@@ -1,23 +1,23 @@
1
- import { default as o } from "./components/Area/AreaChart.js";
2
- import { DonutType as e } from "./components/Donut/index.js";
3
- import { PaginationPosition as p } from "./types.js";
4
- import { CurveType as s, Orientation as m, Position as n } from "@unovis/ts";
5
- import { default as x } from "./components/AreaStacked/AreaStackedChart.js";
6
- import { default as C } from "./components/Bar/BarChart.js";
7
- import { default as l } from "./components/Crosshair/Crosshair.js";
8
- import { default as y } from "./components/Donut/DonutChart.js";
9
- import { default as D } from "./components/Line/LineChart.js";
1
+ import { CurveType as a, Orientation as f, Position as p } from "@unovis/ts";
2
+ import { default as u } from "./components/Area/AreaChart.js";
3
+ import { default as s } from "./components/AreaStacked/AreaStackedChart.js";
4
+ import { default as C } from "./components/Line/LineChart.js";
5
+ import { default as l } from "./components/Bar/BarChart.js";
6
+ import { default as T } from "./components/Donut/DonutChart.js";
7
+ import { default as v } from "./components/Crosshair/Crosshair.js";
8
+ import { DonutType as A } from "./components/Donut/index.js";
9
+ var t = /* @__PURE__ */ ((r) => (r.Top = "top", r.Bottom = "bottom", r))(t || {});
10
10
  export {
11
- o as AreaChart,
12
- x as AreaStackedChart,
13
- C as BarChart,
14
- l as Crosshair,
15
- s as CurveType,
16
- y as DonutChart,
17
- e as DonutType,
18
- D as LineChart,
19
- m as Orientation,
20
- p as PaginationPosition,
21
- n as Position
11
+ u as AreaChart,
12
+ s as AreaStackedChart,
13
+ l as BarChart,
14
+ v as Crosshair,
15
+ a as CurveType,
16
+ T as DonutChart,
17
+ A as DonutType,
18
+ C as LineChart,
19
+ f as Orientation,
20
+ t as PaginationPosition,
21
+ p as Position
22
22
  };
23
23
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["export * from \"./components\";\n\nexport enum PaginationPosition {\n Top = \"top\",\n Bottom = \"bottom\",\n }\n\nexport { CurveType, type BulletLegendItemInterface, Position, Orientation } from '@unovis/ts'"],"names":["PaginationPosition"],"mappings":";;;;;;;;AAEY,IAAAA,sBAAAA,OACRA,EAAA,MAAM,OACNA,EAAA,SAAS,UAFDA,IAAAA,KAAA,CAAA,CAAA;"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.cjs","sources":["../src/utils.ts"],"sourcesContent":["export function getDistributedIndices(length: number, numTicks: number) {\n // Handle edge cases\n if (numTicks <= 0) return [];\n\n // If numTicks >= length, return all indices\n if (numTicks >= length) {\n return Array.from({ length }, (_, i) => i);\n }\n\n // Special case: if numTicks is 1, return only the middle index\n if (numTicks === 1) {\n return [Math.floor((length - 1) / 2)];\n }\n\n // For 2 ticks, just return first and last\n if (numTicks === 2) {\n return [0, length - 1];\n }\n\n // For 3 or more ticks, we need to ensure perfectly even distribution\n const indices = [];\n\n // We'll manually calculate the indices to ensure perfect distribution\n for (let i = 0; i < numTicks; i++) {\n // This formula ensures perfect distribution of indices\n const index = Math.round(i * (length - 1) / (numTicks - 1));\n indices.push(index);\n }\n\n // No need to filter duplicates as our formula ensures unique indices\n return indices;\n}"],"names":["getDistributedIndices","length","numTicks","_","indices","i","index"],"mappings":"gFAAgB,SAAAA,EAAsBC,EAAgBC,EAAkB,CAElE,GAAAA,GAAY,EAAG,MAAO,CAAC,EAG3B,GAAIA,GAAYD,EACP,OAAA,MAAM,KAAK,CAAE,OAAAA,GAAU,CAACE,EAAG,IAAM,CAAC,EAI3C,GAAID,IAAa,EACf,MAAO,CAAC,KAAK,OAAOD,EAAS,GAAK,CAAC,CAAC,EAItC,GAAIC,IAAa,EACR,MAAA,CAAC,EAAGD,EAAS,CAAC,EAIvB,MAAMG,EAAU,CAAC,EAGjB,QAASC,EAAI,EAAGA,EAAIH,EAAUG,IAAK,CAEjC,MAAMC,EAAQ,KAAK,MAAMD,GAAKJ,EAAS,IAAMC,EAAW,EAAE,EAC1DE,EAAQ,KAAKE,CAAK,CAAA,CAIb,OAAAF,CACT"}
1
+ {"version":3,"file":"utils.cjs","sources":["../src/utils.ts"],"sourcesContent":["export function getDistributedIndices(length, numTicks) {\n // Handle edge cases\n if (numTicks <= 0) return [];\n\n // If numTicks >= length, return all indices\n if (numTicks >= length) {\n return Array.from({ length }, (_, i) => i);\n }\n\n // Special case: if numTicks is 1, return only the middle index\n if (numTicks === 1) {\n return [Math.floor((length - 1) / 2)];\n }\n\n // For 2 ticks, just return first and last\n if (numTicks === 2) {\n return [0, length - 1];\n }\n\n // For 3 or more ticks, we need to ensure perfectly even distribution\n const indices = [];\n\n // We'll manually calculate the indices to ensure perfect distribution\n for (let i = 0; i < numTicks; i++) {\n // This formula ensures perfect distribution of indices\n const index = Math.round(i * (length - 1) / (numTicks - 1));\n indices.push(index);\n }\n\n // No need to filter duplicates as our formula ensures unique indices\n return indices;\n}"],"names":["getDistributedIndices","length","numTicks","_","indices","i","index"],"mappings":"gFAAgB,SAAAA,EAAsBC,EAAQC,EAAU,CAElD,GAAAA,GAAY,EAAG,MAAO,CAAC,EAG3B,GAAIA,GAAYD,EACP,OAAA,MAAM,KAAK,CAAE,OAAAA,GAAU,CAACE,EAAG,IAAM,CAAC,EAI3C,GAAID,IAAa,EACf,MAAO,CAAC,KAAK,OAAOD,EAAS,GAAK,CAAC,CAAC,EAItC,GAAIC,IAAa,EACR,MAAA,CAAC,EAAGD,EAAS,CAAC,EAIvB,MAAMG,EAAU,CAAC,EAGjB,QAASC,EAAI,EAAGA,EAAIH,EAAUG,IAAK,CAEjC,MAAMC,EAAQ,KAAK,MAAMD,GAAKJ,EAAS,IAAMC,EAAW,EAAE,EAC1DE,EAAQ,KAAKE,CAAK,CAAA,CAIb,OAAAF,CACT"}
package/dist/utils.d.ts CHANGED
@@ -1 +1 @@
1
- export declare function getDistributedIndices(length: number, numTicks: number): number[];
1
+ export declare function getDistributedIndices(length: any, numTicks: any): any[];
package/dist/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../src/utils.ts"],"sourcesContent":["export function getDistributedIndices(length: number, numTicks: number) {\n // Handle edge cases\n if (numTicks <= 0) return [];\n\n // If numTicks >= length, return all indices\n if (numTicks >= length) {\n return Array.from({ length }, (_, i) => i);\n }\n\n // Special case: if numTicks is 1, return only the middle index\n if (numTicks === 1) {\n return [Math.floor((length - 1) / 2)];\n }\n\n // For 2 ticks, just return first and last\n if (numTicks === 2) {\n return [0, length - 1];\n }\n\n // For 3 or more ticks, we need to ensure perfectly even distribution\n const indices = [];\n\n // We'll manually calculate the indices to ensure perfect distribution\n for (let i = 0; i < numTicks; i++) {\n // This formula ensures perfect distribution of indices\n const index = Math.round(i * (length - 1) / (numTicks - 1));\n indices.push(index);\n }\n\n // No need to filter duplicates as our formula ensures unique indices\n return indices;\n}"],"names":["getDistributedIndices","length","numTicks","_","i","indices","index"],"mappings":"AAAgB,SAAAA,EAAsBC,GAAgBC,GAAkB;AAElE,MAAAA,KAAY,EAAG,QAAO,CAAC;AAG3B,MAAIA,KAAYD;AACP,WAAA,MAAM,KAAK,EAAE,QAAAA,KAAU,CAACE,GAAGC,MAAMA,CAAC;AAI3C,MAAIF,MAAa;AACf,WAAO,CAAC,KAAK,OAAOD,IAAS,KAAK,CAAC,CAAC;AAItC,MAAIC,MAAa;AACR,WAAA,CAAC,GAAGD,IAAS,CAAC;AAIvB,QAAMI,IAAU,CAAC;AAGjB,WAASD,IAAI,GAAGA,IAAIF,GAAUE,KAAK;AAEjC,UAAME,IAAQ,KAAK,MAAMF,KAAKH,IAAS,MAAMC,IAAW,EAAE;AAC1D,IAAAG,EAAQ,KAAKC,CAAK;AAAA,EAAA;AAIb,SAAAD;AACT;"}
1
+ {"version":3,"file":"utils.js","sources":["../src/utils.ts"],"sourcesContent":["export function getDistributedIndices(length, numTicks) {\n // Handle edge cases\n if (numTicks <= 0) return [];\n\n // If numTicks >= length, return all indices\n if (numTicks >= length) {\n return Array.from({ length }, (_, i) => i);\n }\n\n // Special case: if numTicks is 1, return only the middle index\n if (numTicks === 1) {\n return [Math.floor((length - 1) / 2)];\n }\n\n // For 2 ticks, just return first and last\n if (numTicks === 2) {\n return [0, length - 1];\n }\n\n // For 3 or more ticks, we need to ensure perfectly even distribution\n const indices = [];\n\n // We'll manually calculate the indices to ensure perfect distribution\n for (let i = 0; i < numTicks; i++) {\n // This formula ensures perfect distribution of indices\n const index = Math.round(i * (length - 1) / (numTicks - 1));\n indices.push(index);\n }\n\n // No need to filter duplicates as our formula ensures unique indices\n return indices;\n}"],"names":["getDistributedIndices","length","numTicks","_","i","indices","index"],"mappings":"AAAgB,SAAAA,EAAsBC,GAAQC,GAAU;AAElD,MAAAA,KAAY,EAAG,QAAO,CAAC;AAG3B,MAAIA,KAAYD;AACP,WAAA,MAAM,KAAK,EAAE,QAAAA,KAAU,CAACE,GAAGC,MAAMA,CAAC;AAI3C,MAAIF,MAAa;AACf,WAAO,CAAC,KAAK,OAAOD,IAAS,KAAK,CAAC,CAAC;AAItC,MAAIC,MAAa;AACR,WAAA,CAAC,GAAGD,IAAS,CAAC;AAIvB,QAAMI,IAAU,CAAC;AAGjB,WAASD,IAAI,GAAGA,IAAIF,GAAUE,KAAK;AAEjC,UAAME,IAAQ,KAAK,MAAMF,KAAKH,IAAS,MAAMC,IAAW,EAAE;AAC1D,IAAAG,EAAQ,KAAKC,CAAK;AAAA,EAAA;AAIb,SAAAD;AACT;"}
package/package.json CHANGED
@@ -1,14 +1,26 @@
1
1
  {
2
2
  "name": "vue-chrts",
3
- "version": "0.1.0-beta.2-internal-15",
3
+ "version": "0.1.0-beta.2-internal-16",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "dist"
7
7
  ],
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "require": "./dist/index.cjs",
12
+ "import": "./dist/index.js"
13
+ },
14
+ "./*": {
15
+ "types": "./*/dist/index.d.ts",
16
+ "require": "./*/dist/index.cjs",
17
+ "import": "./*/dist/index.js"
18
+ }
19
+ },
8
20
  "main": "./dist/index.cjs",
9
21
  "module": "./dist/index.js",
10
22
  "types": "./dist/index.d.ts",
11
- "typings": "./dist/index.d.ts",
23
+ "typings": "./index.d.ts",
12
24
  "type": "module",
13
25
  "sideEffects": false,
14
26
  "scripts": {