@bridge-ui/vue 0.17.2 → 0.18.0

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.
Files changed (151) hide show
  1. package/ai/skills/bridge-ui-components/SKILL.md +33 -33
  2. package/dist/Components/CalendarMonth/composables/useCalendarMonth.d.ts +1 -1
  3. package/dist/Components/CalendarRange/composables/useCalendarRange.js +1 -1
  4. package/dist/Components/ChartAxis/ChartAxis.vue_vue_type_script_setup_true_lang.js +1 -0
  5. package/dist/Components/ChartAxis/chartAxis.types.d.ts +17 -7
  6. package/dist/Components/ChartAxis/composables/useChartAxis.d.ts +2 -2
  7. package/dist/Components/ChartAxis/composables/useChartAxis.js +15 -10
  8. package/dist/Components/ChartBar/ChartBar.js +5 -0
  9. package/dist/Components/ChartBar/ChartBar.vue.d.ts +16 -0
  10. package/dist/Components/ChartBar/ChartBar.vue_vue_type_script_setup_true_lang.js +59 -0
  11. package/dist/Components/ChartBar/chartBar.types.d.ts +56 -0
  12. package/dist/Components/ChartBar/composables/useChartBar.d.ts +26 -0
  13. package/dist/Components/ChartBar/composables/useChartBar.js +13 -0
  14. package/dist/Components/ChartBar/index.d.ts +4 -0
  15. package/dist/Components/ChartBar/index.js +4 -0
  16. package/dist/Components/ChartBarSeries/ChartBarSeries.js +5 -0
  17. package/dist/Components/ChartBarSeries/ChartBarSeries.vue.d.ts +6 -0
  18. package/dist/Components/ChartBarSeries/ChartBarSeries.vue_vue_type_script_setup_true_lang.js +25 -0
  19. package/dist/Components/ChartBarSeries/chartBarSeries.types.d.ts +45 -0
  20. package/dist/Components/ChartBarSeries/composables/useChartBarSeries.d.ts +5 -0
  21. package/dist/Components/ChartBarSeries/composables/useChartBarSeries.js +20 -0
  22. package/dist/Components/ChartBarSeries/index.d.ts +3 -0
  23. package/dist/Components/ChartBarSeries/index.js +3 -0
  24. package/dist/Components/ChartFunnel/ChartFunnel.js +5 -0
  25. package/dist/Components/ChartFunnel/ChartFunnel.vue.d.ts +16 -0
  26. package/dist/Components/ChartFunnel/ChartFunnel.vue_vue_type_script_setup_true_lang.js +59 -0
  27. package/dist/Components/ChartFunnel/chartFunnel.types.d.ts +54 -0
  28. package/dist/Components/ChartFunnel/composables/useChartFunnel.d.ts +29 -0
  29. package/dist/Components/ChartFunnel/composables/useChartFunnel.js +68 -0
  30. package/dist/Components/ChartFunnel/index.d.ts +4 -0
  31. package/dist/Components/ChartFunnel/index.js +4 -0
  32. package/dist/Components/ChartLegend/ChartLegend.vue.d.ts +2 -0
  33. package/dist/Components/ChartLegend/ChartLegend.vue_vue_type_script_setup_true_lang.js +33 -13
  34. package/dist/Components/ChartLegend/chartLegend.types.d.ts +41 -5
  35. package/dist/Components/ChartLegend/composables/useChartLegend.d.ts +9 -5
  36. package/dist/Components/ChartLegend/composables/useChartLegend.js +88 -54
  37. package/dist/Components/ChartLine/ChartLine.js +5 -0
  38. package/dist/Components/ChartLine/ChartLine.vue.d.ts +20 -0
  39. package/dist/Components/ChartLine/ChartLine.vue_vue_type_script_setup_true_lang.js +76 -0
  40. package/dist/Components/ChartLine/chartLine.types.d.ts +72 -0
  41. package/dist/Components/ChartLine/composables/useChartLine.d.ts +26 -0
  42. package/dist/Components/ChartLine/composables/useChartLine.js +13 -0
  43. package/dist/Components/ChartLine/index.d.ts +4 -0
  44. package/dist/Components/ChartLine/index.js +4 -0
  45. package/dist/Components/ChartLineSeries/ChartLineSeries.js +5 -0
  46. package/dist/Components/ChartLineSeries/ChartLineSeries.vue.d.ts +10 -0
  47. package/dist/Components/ChartLineSeries/ChartLineSeries.vue_vue_type_script_setup_true_lang.js +42 -0
  48. package/dist/Components/ChartLineSeries/chartLineSeries.types.d.ts +75 -0
  49. package/dist/Components/ChartLineSeries/composables/useChartLineSeries.d.ts +5 -0
  50. package/dist/Components/ChartLineSeries/composables/useChartLineSeries.js +25 -0
  51. package/dist/Components/ChartLineSeries/index.d.ts +3 -0
  52. package/dist/Components/ChartLineSeries/index.js +3 -0
  53. package/dist/Components/ChartPie/ChartPie.js +5 -0
  54. package/dist/Components/ChartPie/ChartPie.vue.d.ts +15 -0
  55. package/dist/Components/ChartPie/ChartPie.vue_vue_type_script_setup_true_lang.js +73 -0
  56. package/dist/Components/ChartPie/chartPie.types.d.ts +73 -0
  57. package/dist/Components/ChartPie/composables/useChartPie.d.ts +30 -0
  58. package/dist/Components/ChartPie/composables/useChartPie.js +71 -0
  59. package/dist/Components/ChartPie/index.d.ts +4 -0
  60. package/dist/Components/ChartPie/index.js +4 -0
  61. package/dist/Components/ChartScatter/ChartScatter.js +5 -0
  62. package/dist/Components/{Chart/Chart.vue.d.ts → ChartScatter/ChartScatter.vue.d.ts} +3 -2
  63. package/dist/Components/ChartScatter/ChartScatter.vue_vue_type_script_setup_true_lang.js +49 -0
  64. package/dist/Components/ChartScatter/chartScatter.types.d.ts +23 -0
  65. package/dist/Components/ChartScatter/composables/useChartScatter.d.ts +29 -0
  66. package/dist/Components/ChartScatter/composables/useChartScatter.js +103 -0
  67. package/dist/Components/ChartScatter/index.d.ts +4 -0
  68. package/dist/Components/ChartScatter/index.js +4 -0
  69. package/dist/Components/ChartScatterSeries/ChartScatterSeries.js +5 -0
  70. package/dist/Components/ChartScatterSeries/ChartScatterSeries.vue.d.ts +4 -0
  71. package/dist/Components/ChartScatterSeries/ChartScatterSeries.vue_vue_type_script_setup_true_lang.js +21 -0
  72. package/dist/Components/ChartScatterSeries/chartScatterSeries.types.d.ts +38 -0
  73. package/dist/Components/ChartScatterSeries/composables/useChartScatterSeries.d.ts +4 -0
  74. package/dist/Components/ChartScatterSeries/composables/useChartScatterSeries.js +18 -0
  75. package/dist/Components/ChartScatterSeries/index.d.ts +3 -0
  76. package/dist/Components/ChartScatterSeries/index.js +3 -0
  77. package/dist/Components/ChartTooltip/ChartTooltip.vue_vue_type_script_setup_true_lang.js +18 -10
  78. package/dist/Components/ChartTooltip/chartTooltip.types.d.ts +24 -9
  79. package/dist/Components/ChartTooltip/composables/useChartTooltip.d.ts +3 -1
  80. package/dist/Components/ChartTooltip/composables/useChartTooltip.js +79 -65
  81. package/dist/Components/ColorPicker/composables/useColorPicker.js +1 -1
  82. package/dist/Components/DatePicker/composables/useDatePicker.js +1 -1
  83. package/dist/Components/DateRangePicker/composables/useDateRangePicker.js +1 -1
  84. package/dist/Components/DateTimePicker/composables/useDateTimePicker.js +1 -1
  85. package/dist/Components/DateTimeRangePicker/composables/useDateTimeRangePicker.js +1 -1
  86. package/dist/Components/FormField/composables/useFormField.js +3 -1
  87. package/dist/Components/OtpField/composables/useOtpField.js +90 -89
  88. package/dist/Components/ResizablePanel/composables/useResizablePanel.d.ts +1 -1
  89. package/dist/Components/Spinner/composables/useSpinner.d.ts +1 -1
  90. package/dist/Components/TimePicker/composables/useTimePicker.js +1 -1
  91. package/dist/Components/TimeRangePicker/composables/useTimeRangePicker.js +1 -1
  92. package/dist/Utils/Charts/ChartFrame.js +5 -0
  93. package/dist/Utils/Charts/ChartFrame.vue.d.ts +24 -0
  94. package/dist/Utils/Charts/ChartFrame.vue_vue_type_script_setup_true_lang.js +41 -0
  95. package/dist/{Components/Chart → Utils/Charts}/chart.types.d.ts +16 -18
  96. package/dist/Utils/Charts/chartInjectionKey.d.ts +151 -0
  97. package/dist/{Components/Chart → Utils/Charts}/chartInjectionKey.js +2 -2
  98. package/dist/Utils/Charts/echarts/bar.d.ts +6 -0
  99. package/dist/Utils/Charts/echarts/bar.js +22 -0
  100. package/dist/Utils/Charts/echarts/cartesian.d.ts +15 -0
  101. package/dist/Utils/Charts/echarts/cartesian.js +255 -0
  102. package/dist/Utils/Charts/echarts/funnel.d.ts +15 -0
  103. package/dist/Utils/Charts/echarts/funnel.js +79 -0
  104. package/dist/Utils/Charts/echarts/line.d.ts +5 -0
  105. package/dist/Utils/Charts/echarts/line.js +19 -0
  106. package/dist/Utils/Charts/echarts/part.d.ts +19 -0
  107. package/dist/Utils/Charts/echarts/part.js +45 -0
  108. package/dist/Utils/Charts/echarts/pie.d.ts +14 -0
  109. package/dist/Utils/Charts/echarts/pie.js +75 -0
  110. package/dist/Utils/Charts/echarts/plot.d.ts +44 -0
  111. package/dist/Utils/Charts/echarts/plot.js +52 -0
  112. package/dist/Utils/Charts/echarts/scatter.d.ts +14 -0
  113. package/dist/Utils/Charts/echarts/scatter.js +152 -0
  114. package/dist/Utils/Charts/index.d.ts +6 -0
  115. package/dist/Utils/Charts/index.js +6 -0
  116. package/dist/Utils/Charts/useChartCartesian.d.ts +57 -0
  117. package/dist/Utils/Charts/useChartCartesian.js +155 -0
  118. package/dist/Utils/Charts/useChartPart.d.ts +45 -0
  119. package/dist/Utils/Charts/useChartPart.js +97 -0
  120. package/dist/Utils/Charts/useChartRegistry.d.ts +13 -0
  121. package/dist/Utils/Charts/useChartRegistry.js +40 -0
  122. package/dist/Utils/Charts/useChartRoot.d.ts +156 -0
  123. package/dist/Utils/Charts/useChartRoot.js +342 -0
  124. package/dist/Utils/Charts/useChartSeries.d.ts +10 -0
  125. package/dist/Utils/Charts/useChartSeries.js +22 -0
  126. package/dist/augments.d.ts +23 -7
  127. package/docs/README.md +6 -1
  128. package/docs/components/Chart.md +114 -154
  129. package/docs/components/ChartBar.md +137 -0
  130. package/docs/components/ChartFunnel.md +62 -0
  131. package/docs/components/ChartLine.md +151 -0
  132. package/docs/components/ChartPie.md +115 -0
  133. package/docs/components/ChartScatter.md +84 -0
  134. package/package.json +2 -2
  135. package/dist/Components/Chart/Chart.js +0 -5
  136. package/dist/Components/Chart/Chart.vue_vue_type_script_setup_true_lang.js +0 -52
  137. package/dist/Components/Chart/chartInjectionKey.d.ts +0 -94
  138. package/dist/Components/Chart/composables/useChart.d.ts +0 -40
  139. package/dist/Components/Chart/composables/useChart.js +0 -346
  140. package/dist/Components/Chart/echartsChart.d.ts +0 -14
  141. package/dist/Components/Chart/echartsChart.js +0 -199
  142. package/dist/Components/Chart/index.d.ts +0 -4
  143. package/dist/Components/Chart/index.js +0 -4
  144. package/dist/Components/ChartSeries/ChartSeries.js +0 -5
  145. package/dist/Components/ChartSeries/ChartSeries.vue.d.ts +0 -4
  146. package/dist/Components/ChartSeries/ChartSeries.vue_vue_type_script_setup_true_lang.js +0 -24
  147. package/dist/Components/ChartSeries/chartSeries.types.d.ts +0 -37
  148. package/dist/Components/ChartSeries/composables/useChartSeries.d.ts +0 -10
  149. package/dist/Components/ChartSeries/composables/useChartSeries.js +0 -29
  150. package/dist/Components/ChartSeries/index.d.ts +0 -3
  151. package/dist/Components/ChartSeries/index.js +0 -3
@@ -0,0 +1,152 @@
1
+ import { labelStyle as e, mountEchartsPlot as t } from "./plot.js";
2
+ import { get as n, isArray as r, isNil as i, isNumber as a } from "es-toolkit/compat";
3
+ import { isChartValue as o, scaleChartBubbleSize as s } from "@bridge-ui/core/Domain";
4
+ import { ScatterChart as c } from "echarts/charts";
5
+ import { GridComponent as l, TooltipComponent as u } from "echarts/components";
6
+ import { use as d } from "echarts/core";
7
+ import { SVGRenderer as f } from "echarts/renderers";
8
+ //#region src/Utils/Charts/echarts/scatter.ts
9
+ d([
10
+ c,
11
+ l,
12
+ f,
13
+ u
14
+ ]);
15
+ var p = .7;
16
+ function m(e, t, n) {
17
+ let a = r(n) ? n[2] : void 0, c = t.symbolSize ?? e.symbolSize;
18
+ return !o(a) || i(e.sizeDomain) ? c : s({
19
+ value: a,
20
+ range: e.bubbleSize,
21
+ domain: e.sizeDomain
22
+ });
23
+ }
24
+ function h(t, n) {
25
+ let { theme: r } = t;
26
+ return {
27
+ scale: !0,
28
+ min: n.min,
29
+ max: n.max,
30
+ name: n.label,
31
+ type: "value",
32
+ show: n.hidden !== !0,
33
+ splitNumber: n.tickCount,
34
+ nameTextStyle: e(r),
35
+ axisLine: { lineStyle: { color: r.axisColor } },
36
+ splitLine: {
37
+ show: n.grid ?? !0,
38
+ lineStyle: { color: r.gridColor }
39
+ },
40
+ axisLabel: {
41
+ ...e(r),
42
+ formatter: i(n.formatTick) ? void 0 : (e) => n.formatTick?.(Number(e)) ?? String(e)
43
+ }
44
+ };
45
+ }
46
+ function g(e) {
47
+ let { theme: t } = e, n = Math.round(t.fontSize * 2.25), r = !i(e.sizeDomain);
48
+ return {
49
+ animation: e.animation,
50
+ tooltip: {
51
+ show: !0,
52
+ trigger: "item",
53
+ showContent: !1
54
+ },
55
+ yAxis: {
56
+ ...h(e, e.yAxis),
57
+ nameLocation: "end"
58
+ },
59
+ textStyle: {
60
+ fontSize: t.fontSize,
61
+ fontFamily: t.fontFamily
62
+ },
63
+ xAxis: {
64
+ ...h(e, e.xAxis),
65
+ nameGap: n,
66
+ nameLocation: "middle"
67
+ },
68
+ grid: {
69
+ left: 4,
70
+ outerBoundsMode: "same",
71
+ outerBoundsContain: "axisLabel",
72
+ top: i(e.yAxis.label) ? 12 : n,
73
+ right: r ? e.bubbleSize[1] / 2 : 12,
74
+ bottom: i(e.xAxis.label) ? 4 : n
75
+ },
76
+ series: e.series.map((t) => ({
77
+ id: t.id,
78
+ type: "scatter",
79
+ name: t.name,
80
+ data: t.data,
81
+ emphasis: {
82
+ scale: 1.2,
83
+ focus: "series"
84
+ },
85
+ symbolSize: (n) => m(e, t, n),
86
+ itemStyle: {
87
+ color: t.color,
88
+ opacity: r ? p : 1
89
+ }
90
+ }))
91
+ };
92
+ }
93
+ function _(e, t, n) {
94
+ let r = e.points.findIndex((e) => e.seriesIndex === t && e.dataIndex === n);
95
+ return r === -1 ? null : r;
96
+ }
97
+ var v = {
98
+ build: g,
99
+ highlight: (e, t, n) => {
100
+ e.dispatchAction({ type: "downplay" }), i(n) || e.dispatchAction({
101
+ seriesId: n,
102
+ type: "highlight"
103
+ });
104
+ },
105
+ attach: (e, t, r) => {
106
+ e.on("mouseover", (e) => {
107
+ let i = n(e, "seriesIndex"), o = n(e, "dataIndex");
108
+ a(i) && a(o) && t(_(r(), i, o));
109
+ }), e.on("mouseout", () => {
110
+ t(null);
111
+ });
112
+ },
113
+ showActive: (e, t, n) => {
114
+ e.dispatchAction({ type: "downplay" });
115
+ let r = i(n) ? void 0 : t.points[n];
116
+ if (i(r)) {
117
+ e.dispatchAction({ type: "hideTip" });
118
+ return;
119
+ }
120
+ let a = {
121
+ dataIndex: r.dataIndex,
122
+ seriesIndex: r.seriesIndex
123
+ };
124
+ e.dispatchAction({
125
+ ...a,
126
+ type: "highlight"
127
+ }), e.dispatchAction({
128
+ ...a,
129
+ type: "showTip"
130
+ });
131
+ },
132
+ getAnchor: (e, t, n) => {
133
+ let o = t.points[n], s = i(o) ? void 0 : t.series[o.seriesIndex];
134
+ if (i(o) || i(s)) return null;
135
+ let c = e.convertToPixel({ seriesIndex: o.seriesIndex }, [o.x, o.y]);
136
+ if (!r(c) || !a(c[0]) || !a(c[1])) return null;
137
+ let l = m(t, s, i(o.size) ? [o.x, o.y] : [
138
+ o.x,
139
+ o.y,
140
+ o.size
141
+ ]);
142
+ return {
143
+ x: c[0],
144
+ y: c[1] - l / 2
145
+ };
146
+ }
147
+ };
148
+ function y(e) {
149
+ return t(e, v);
150
+ }
151
+ //#endregion
152
+ export { g as buildEchartsScatterOption, y as mountEchartsScatter };
@@ -0,0 +1,6 @@
1
+ export type { ChartClasses, ChartColorOverrides, ChartColorValue, ChartCustomProps, ChartRootOwnProps, ChartSizeOverrides, ChartSlots, } from './chart.types';
2
+ export { default as ChartFrame } from './ChartFrame.vue';
3
+ export { CHART_INJECTION_KEY, useChartContext, type ChartBarSeriesRegistration, type ChartContextValue, type ChartFamily, type ChartLegendItem, type ChartLegendPosition, type ChartLineSeriesRegistration, type ChartScatterSeriesRegistration, type ChartSeriesRegistration, } from './chartInjectionKey';
4
+ export { useChartRegistry } from './useChartRegistry';
5
+ export { chartRootBridgeKeys, toChartLegendItems, useChartColors, useChartContextValue, useChartFrame, useChartPlot, useChartRoot, type ChartFrameState, type ChartRootMerged, type ChartRootName, type ChartRootState, } from './useChartRoot';
6
+ export { useChartSeries } from './useChartSeries';
@@ -0,0 +1,6 @@
1
+ import e from "./ChartFrame.js";
2
+ import { CHART_INJECTION_KEY as t, useChartContext as n } from "./chartInjectionKey.js";
3
+ import { useChartRegistry as r } from "./useChartRegistry.js";
4
+ import { chartRootBridgeKeys as i, toChartLegendItems as a, useChartColors as o, useChartContextValue as s, useChartFrame as c, useChartPlot as l, useChartRoot as u } from "./useChartRoot.js";
5
+ import { useChartSeries as d } from "./useChartSeries.js";
6
+ export { t as CHART_INJECTION_KEY, e as ChartFrame, i as chartRootBridgeKeys, a as toChartLegendItems, o as useChartColors, n as useChartContext, s as useChartContextValue, c as useChartFrame, l as useChartPlot, r as useChartRegistry, u as useChartRoot, d as useChartSeries };
@@ -0,0 +1,57 @@
1
+ import { ChartCartesianRenderOptions, ChartCurve, ChartHandle, ChartMountOptions, ChartOrientation, ChartStep } from '@bridge-ui/core/Domain';
2
+ import { ChartRootOwnProps } from './chart.types';
3
+ import { ChartRootMerged } from './useChartRoot';
4
+ /**
5
+ * Props shared by `ChartLine` and `ChartBar` (each root exposes its subset).
6
+ */
7
+ export type ChartCartesianOwnProps = ChartRootOwnProps & {
8
+ area?: boolean;
9
+ categories: Date[] | string[];
10
+ curve?: ChartCurve;
11
+ formatDate?: (date: Date) => string;
12
+ formatLabel?: (value: number) => string;
13
+ labels?: boolean;
14
+ orientation?: ChartOrientation;
15
+ radius?: number;
16
+ showPoints?: boolean;
17
+ sparkline?: boolean;
18
+ stack?: string;
19
+ step?: ChartStep;
20
+ };
21
+ /**
22
+ * Merged cartesian props after registry defaults.
23
+ */
24
+ export type ChartCartesianMerged = ChartRootMerged & Pick<ChartCartesianOwnProps, "area" | "step" | "curve" | "labels" | "radius" | "showPoints" | "orientation">;
25
+ /**
26
+ * Line / bar root: series registry, category (or time) axis, stacks, and the
27
+ * shared chart frame.
28
+ */
29
+ export declare function useChartCartesian(props: ChartCartesianOwnProps, { kind, mount, libDefaults, componentName, }: {
30
+ componentName: "ChartBar" | "ChartLine";
31
+ kind: "bar" | "line";
32
+ libDefaults: Partial<ChartCartesianMerged>;
33
+ mount: (options: ChartMountOptions<ChartCartesianRenderOptions>) => ChartHandle<ChartCartesianRenderOptions>;
34
+ }): {
35
+ frame: {
36
+ label: import('vue').ComputedRef<string>;
37
+ table: import('vue').ComputedRef<import('@bridge-ui/core/Domain').ChartTable>;
38
+ isEmpty: import('vue').ComputedRef<boolean>;
39
+ hostBind: import('vue').ComputedRef<import('vue').HTMLAttributes>;
40
+ plotBind: import('vue').ComputedRef<import('vue').HTMLAttributes>;
41
+ rootBind: import('vue').ComputedRef<import('vue').HTMLAttributes>;
42
+ liveBind: import('vue').ComputedRef<import('vue').HTMLAttributes>;
43
+ emptyBind: import('vue').ComputedRef<import('vue').HTMLAttributes>;
44
+ isLoading: import('vue').ComputedRef<boolean>;
45
+ tableBind: import('vue').ComputedRef<import('vue').HTMLAttributes>;
46
+ centerBind: import('vue').ComputedRef<import('vue').HTMLAttributes>;
47
+ loadingBind: import('vue').ComputedRef<import('vue').HTMLAttributes>;
48
+ announcement: import('vue').ComputedRef<string>;
49
+ emptyMessage: import('vue').ComputedRef<string>;
50
+ rootRef: import('vue').ShallowRef<HTMLDivElement | null, HTMLDivElement | null>;
51
+ plotRef: import('vue').ShallowRef<HTMLDivElement | null, HTMLDivElement | null>;
52
+ hostRef: import('vue').ShallowRef<HTMLDivElement | null, HTMLDivElement | null>;
53
+ };
54
+ merged: import('vue').ComputedRef<ChartCartesianMerged>;
55
+ context: import('vue').ComputedRef<import('./chartInjectionKey').ChartContextValue>;
56
+ options: import('vue').ComputedRef<ChartCartesianRenderOptions | null>;
57
+ };
@@ -0,0 +1,155 @@
1
+ import { useChartRegistry as e } from "./useChartRegistry.js";
2
+ import { chartRootBridgeKeys as t, toChartLegendItems as n, useChartColors as r, useChartContextValue as i, useChartFrame as a, useChartPlot as o, useChartRoot as s } from "./useChartRoot.js";
3
+ import { computed as c } from "vue";
4
+ import { isDate as l, isNil as u, isString as d } from "es-toolkit/compat";
5
+ import { DEFAULT_CHART_BAR_RADIUS as f, formatChartValue as p, getChartCartesianSummaryParams as m, getChartCartesianTable as h, getChartCartesianTooltip as g, getChartCategoryLabels as _, getChartTimeTickFormatter as v, isChartEmpty as y, isChartTimeCategories as b } from "@bridge-ui/core/Domain";
6
+ //#region src/Utils/Charts/useChartCartesian.ts
7
+ var x = [
8
+ ...t,
9
+ "area",
10
+ "step",
11
+ "curve",
12
+ "stack",
13
+ "labels",
14
+ "radius",
15
+ "sparkline",
16
+ "categories",
17
+ "formatDate",
18
+ "showPoints",
19
+ "formatLabel",
20
+ "orientation"
21
+ ], S = [
22
+ "area",
23
+ "size",
24
+ "step",
25
+ "curve",
26
+ "height",
27
+ "labels",
28
+ "radius",
29
+ "classes",
30
+ "animation",
31
+ "showPoints",
32
+ "customProps",
33
+ "orientation"
34
+ ];
35
+ function C(e, t, n) {
36
+ return e.kind === "bar" ? {
37
+ kind: "bar",
38
+ id: e.id,
39
+ name: e.name,
40
+ data: e.data,
41
+ color: e.color,
42
+ reference: e.reference ?? [],
43
+ stack: e.stack ?? t.stack,
44
+ labels: e.labels ?? t.labels ?? !1
45
+ } : {
46
+ kind: "line",
47
+ id: e.id,
48
+ name: e.name,
49
+ data: e.data,
50
+ color: e.color,
51
+ dashed: e.dashed ?? !1,
52
+ reference: e.reference ?? [],
53
+ area: e.area ?? t.area ?? !1,
54
+ step: e.step ?? t.step ?? !1,
55
+ labels: e.labels ?? t.labels ?? !1,
56
+ curve: e.curve ?? t.curve ?? "linear",
57
+ showPoints: e.showPoints ?? t.showPoints ?? !1,
58
+ stack: e.stack ?? (n === "line" ? t.stack : void 0)
59
+ };
60
+ }
61
+ function w(t, { kind: w, mount: T, libDefaults: E, componentName: D }) {
62
+ let O = s({
63
+ props: t,
64
+ libDefaults: E,
65
+ componentName: D,
66
+ bridgeKeys: x,
67
+ registryKeys: S,
68
+ fallbackProps: () => t.sparkline ? { height: 48 } : {}
69
+ }), k = e(), { merged: A, hidden: j, locale: M, resolveMessage: N } = O, P = c(() => JSON.stringify((t.categories ?? []).map((e) => l(e) ? { time: e.getTime() } : e))), F = c(() => JSON.parse(P.value).map((e) => d(e) ? e : new Date(e.time))), I = c(() => b(F.value) ? F.value.map((e) => e.getTime()) : null), L = c(() => _({
70
+ locale: M.value,
71
+ categories: F.value,
72
+ formatDate: t.formatDate
73
+ })), R = c(() => {
74
+ let e = t.formatLabel, n = M.value;
75
+ return e ?? ((e) => p(e, n));
76
+ }), z = c(() => w === "bar" ? A.value.orientation ?? "vertical" : "vertical"), B = c(() => k.entries.value.map((e) => C(e, {
77
+ ...A.value,
78
+ stack: t.stack
79
+ }, w))), V = r(O, () => k.entries.value), H = c(() => B.value.filter((e) => !j.value.includes(e.id)).map((e) => ({
80
+ ...e,
81
+ color: V.value[e.id] ?? ""
82
+ }))), U = c(() => {
83
+ let e = { ...k.axes.value.x }, t = { ...k.axes.value.y };
84
+ if (!u(I.value)) {
85
+ let n = z.value === "horizontal" ? t : e;
86
+ n.formatTick ??= v({
87
+ locale: M.value,
88
+ timestamps: I.value
89
+ });
90
+ }
91
+ return {
92
+ xAxis: e,
93
+ yAxis: t
94
+ };
95
+ }), W = c(() => {
96
+ let e = O.theme.value;
97
+ return u(e) ? null : {
98
+ theme: e,
99
+ xAxis: U.value.xAxis,
100
+ yAxis: U.value.yAxis,
101
+ categories: L.value,
102
+ series: H.value,
103
+ timestamps: I.value,
104
+ orientation: z.value,
105
+ formatLabel: R.value,
106
+ animation: O.animation.value,
107
+ width: O.plotSize.value.width,
108
+ height: O.plotSize.value.height,
109
+ sparkline: t.sparkline === !0,
110
+ radius: A.value.radius ?? f
111
+ };
112
+ });
113
+ o(O, {
114
+ mount: T,
115
+ options: W
116
+ });
117
+ let G = c(() => {
118
+ let e = O.active.value.index;
119
+ return u(e) ? null : g({
120
+ index: e,
121
+ series: H.value,
122
+ title: L.value[e] ?? ""
123
+ });
124
+ });
125
+ return {
126
+ frame: a(O, c(() => ({
127
+ tooltip: G.value,
128
+ count: L.value.length,
129
+ isEmpty: y(B.value.flatMap((e) => e.data)),
130
+ table: h({
131
+ locale: M.value,
132
+ series: B.value,
133
+ categories: L.value,
134
+ categoryHeader: N(u(I.value) ? "Category" : "Date")
135
+ }),
136
+ summary: N("Chart with {{count}} series ({{names}}) across {{categories}} categories, from {{first}} to {{last}}.", m({
137
+ series: B.value,
138
+ categories: L.value
139
+ }))
140
+ }))),
141
+ merged: A,
142
+ context: i(O, c(() => ({
143
+ family: w,
144
+ tooltip: G.value,
145
+ setAxis: k.setAxis,
146
+ removeAxis: k.removeAxis,
147
+ upsertSeries: k.upsertSeries,
148
+ removeSeries: k.removeSeries,
149
+ legendItems: n(B.value, V.value, j.value)
150
+ }))),
151
+ options: W
152
+ };
153
+ }
154
+ //#endregion
155
+ export { w as useChartCartesian };
@@ -0,0 +1,45 @@
1
+ import { ChartBaseRenderOptions, ChartHandle, ChartLabelContent, ChartMountOptions, ChartPartRenderSlice, ChartSlice, ChartSliceEntry } from '@bridge-ui/core/Domain';
2
+ import { ChartRootState } from './useChartRoot';
3
+ /**
4
+ * Pie / funnel root: slices from `data`, percents, plot labels, and the
5
+ * shared chart frame. Getters keep every input reactive.
6
+ */
7
+ export declare function useChartPart<Options extends ChartBaseRenderOptions & {
8
+ slices: ChartPartRenderSlice[];
9
+ }>(root: ChartRootState, { data, mount, order, family, labels, summary, percents, maxSlices, buildOptions, labelContent, positiveOnly, }: {
10
+ buildOptions: (base: ChartBaseRenderOptions & {
11
+ slices: ChartPartRenderSlice[];
12
+ }) => Options;
13
+ data: () => readonly ChartSlice[];
14
+ family: "pie" | "funnel";
15
+ labelContent: () => undefined | ChartLabelContent;
16
+ labels: () => boolean;
17
+ maxSlices?: () => number | undefined;
18
+ mount: (options: ChartMountOptions<Options>) => ChartHandle<Options>;
19
+ order?: (entries: ChartSliceEntry[]) => ChartSliceEntry[];
20
+ percents: (values: readonly number[]) => number[];
21
+ positiveOnly: boolean;
22
+ summary: (slices: ChartPartRenderSlice[]) => string;
23
+ }): {
24
+ frame: {
25
+ label: import('vue').ComputedRef<string>;
26
+ table: import('vue').ComputedRef<import('@bridge-ui/core/Domain').ChartTable>;
27
+ isEmpty: import('vue').ComputedRef<boolean>;
28
+ hostBind: import('vue').ComputedRef<import('vue').HTMLAttributes>;
29
+ plotBind: import('vue').ComputedRef<import('vue').HTMLAttributes>;
30
+ rootBind: import('vue').ComputedRef<import('vue').HTMLAttributes>;
31
+ liveBind: import('vue').ComputedRef<import('vue').HTMLAttributes>;
32
+ emptyBind: import('vue').ComputedRef<import('vue').HTMLAttributes>;
33
+ isLoading: import('vue').ComputedRef<boolean>;
34
+ tableBind: import('vue').ComputedRef<import('vue').HTMLAttributes>;
35
+ centerBind: import('vue').ComputedRef<import('vue').HTMLAttributes>;
36
+ loadingBind: import('vue').ComputedRef<import('vue').HTMLAttributes>;
37
+ announcement: import('vue').ComputedRef<string>;
38
+ emptyMessage: import('vue').ComputedRef<string>;
39
+ rootRef: import('vue').ShallowRef<HTMLDivElement | null, HTMLDivElement | null>;
40
+ plotRef: import('vue').ShallowRef<HTMLDivElement | null, HTMLDivElement | null>;
41
+ hostRef: import('vue').ShallowRef<HTMLDivElement | null, HTMLDivElement | null>;
42
+ };
43
+ context: import('vue').ComputedRef<import('./chartInjectionKey').ChartContextValue>;
44
+ options: import('vue').ComputedRef<Options | null>;
45
+ };
@@ -0,0 +1,97 @@
1
+ import { toChartLegendItems as e, useChartColors as t, useChartContextValue as n, useChartFrame as r, useChartPlot as i } from "./useChartRoot.js";
2
+ import { computed as a } from "vue";
3
+ import { isNil as o } from "es-toolkit/compat";
4
+ import { getChartPartTable as s, getChartPartTooltip as c, isChartPartEmpty as l, resolveChartSliceLabel as u, toChartSliceEntries as d } from "@bridge-ui/core/Domain";
5
+ //#region src/Utils/Charts/useChartPart.ts
6
+ function f(f, { data: p, mount: m, order: h, family: g, labels: _, summary: v, percents: y, maxSlices: b, buildOptions: x, labelContent: S, positiveOnly: C }) {
7
+ let { hidden: w, locale: T, resolveMessage: E } = f, D = a(() => JSON.stringify(p() ?? [])), O = a(() => {
8
+ let e = d({
9
+ positiveOnly: C,
10
+ maxSlices: b?.(),
11
+ otherLabel: E("Other"),
12
+ data: JSON.parse(D.value)
13
+ });
14
+ return o(h) ? e : h(e);
15
+ }), k = t(f, () => O.value), A = a(() => {
16
+ let e = y(O.value.map((e) => e.value));
17
+ return O.value.map((t, n) => ({
18
+ id: t.id,
19
+ labelText: "",
20
+ label: t.label,
21
+ value: t.value,
22
+ percent: e[n] ?? 0,
23
+ color: k.value[t.id] ?? ""
24
+ }));
25
+ }), j = a(() => {
26
+ let e = O.value.filter((e) => !w.value.includes(e.id)), t = y(e.map((e) => e.value)), n = S() ?? "label", r = _();
27
+ return e.map((e, i) => {
28
+ let a = t[i] ?? 0;
29
+ return {
30
+ percent: a,
31
+ id: e.id,
32
+ label: e.label,
33
+ value: e.value,
34
+ color: k.value[e.id] ?? "",
35
+ labelText: r ? u({
36
+ content: n,
37
+ locale: T.value,
38
+ slice: {
39
+ percent: a,
40
+ label: e.label,
41
+ value: e.value
42
+ }
43
+ }) : ""
44
+ };
45
+ });
46
+ }), M = a(() => {
47
+ let e = f.theme.value;
48
+ return o(e) ? null : x({
49
+ theme: e,
50
+ slices: j.value,
51
+ animation: f.animation.value,
52
+ width: f.plotSize.value.width,
53
+ height: f.plotSize.value.height
54
+ });
55
+ });
56
+ i(f, {
57
+ mount: m,
58
+ options: M
59
+ });
60
+ let N = a(() => {
61
+ let e = f.active.value.index, t = o(e) ? void 0 : j.value[e];
62
+ return o(t) ? null : c(t);
63
+ });
64
+ return {
65
+ frame: r(f, a(() => ({
66
+ tooltip: N.value,
67
+ count: j.value.length,
68
+ summary: v(A.value),
69
+ isEmpty: l(O.value),
70
+ table: s({
71
+ locale: T.value,
72
+ slices: A.value,
73
+ headers: {
74
+ value: E("Value"),
75
+ percent: E("Share"),
76
+ label: E("Category")
77
+ }
78
+ })
79
+ }))),
80
+ context: n(f, a(() => {
81
+ let t = new Map(j.value.map((e) => [e.id, e]));
82
+ return {
83
+ family: g,
84
+ tooltip: N.value,
85
+ legendItems: e(O.value.map((e) => ({
86
+ id: e.id,
87
+ name: e.label,
88
+ value: e.value,
89
+ percent: t.get(e.id)?.percent
90
+ })), k.value, w.value)
91
+ };
92
+ })),
93
+ options: M
94
+ };
95
+ }
96
+ //#endregion
97
+ export { f as useChartPart };
@@ -0,0 +1,13 @@
1
+ import { ChartAxisOptions, ChartAxisPosition } from '@bridge-ui/core/Domain';
2
+ import { ChartSeriesRegistration } from './chartInjectionKey';
3
+ /**
4
+ * Series and axes registered by chart children, in mount order.
5
+ */
6
+ export declare function useChartRegistry<Entry extends ChartSeriesRegistration>(): {
7
+ axes: import('vue').ShallowRef<Partial<Record<ChartAxisPosition, ChartAxisOptions>>, Partial<Record<ChartAxisPosition, ChartAxisOptions>>>;
8
+ entries: import('vue').ShallowRef<Entry[], Entry[]>;
9
+ setAxis: (position: ChartAxisPosition, options: ChartAxisOptions) => void;
10
+ removeAxis: (position: ChartAxisPosition) => void;
11
+ upsertSeries: (entry: ChartSeriesRegistration) => void;
12
+ removeSeries: (id: string) => void;
13
+ };
@@ -0,0 +1,40 @@
1
+ import { shallowRef as e } from "vue";
2
+ import { isEqual as t, isNil as n, omit as r } from "es-toolkit/compat";
3
+ import { isSameChartAxisOptions as i } from "@bridge-ui/core/Domain";
4
+ //#region src/Utils/Charts/useChartRegistry.ts
5
+ function a() {
6
+ let a = e([]), o = e({});
7
+ function s(e) {
8
+ let n = a.value.findIndex((t) => t.id === e.id);
9
+ if (n === -1) {
10
+ a.value = [...a.value, e];
11
+ return;
12
+ }
13
+ if (t(a.value[n], e)) return;
14
+ let r = [...a.value];
15
+ r[n] = e, a.value = r;
16
+ }
17
+ function c(e) {
18
+ a.value = a.value.filter((t) => t.id !== e);
19
+ }
20
+ function l(e, t) {
21
+ let r = o.value[e];
22
+ (n(r) || !i(r, t)) && (o.value = {
23
+ ...o.value,
24
+ [e]: t
25
+ });
26
+ }
27
+ function u(e) {
28
+ o.value = r(o.value, [e]);
29
+ }
30
+ return {
31
+ axes: o,
32
+ entries: a,
33
+ setAxis: l,
34
+ removeAxis: u,
35
+ upsertSeries: s,
36
+ removeSeries: c
37
+ };
38
+ }
39
+ //#endregion
40
+ export { a as useChartRegistry };