@bridge-ui/vue 0.17.3 → 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 (141) 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/ChartAxis/ChartAxis.vue_vue_type_script_setup_true_lang.js +1 -0
  4. package/dist/Components/ChartAxis/chartAxis.types.d.ts +17 -7
  5. package/dist/Components/ChartAxis/composables/useChartAxis.d.ts +2 -2
  6. package/dist/Components/ChartAxis/composables/useChartAxis.js +15 -10
  7. package/dist/Components/ChartBar/ChartBar.js +5 -0
  8. package/dist/Components/ChartBar/ChartBar.vue.d.ts +16 -0
  9. package/dist/Components/ChartBar/ChartBar.vue_vue_type_script_setup_true_lang.js +59 -0
  10. package/dist/Components/ChartBar/chartBar.types.d.ts +56 -0
  11. package/dist/Components/ChartBar/composables/useChartBar.d.ts +26 -0
  12. package/dist/Components/ChartBar/composables/useChartBar.js +13 -0
  13. package/dist/Components/ChartBar/index.d.ts +4 -0
  14. package/dist/Components/ChartBar/index.js +4 -0
  15. package/dist/Components/ChartBarSeries/ChartBarSeries.js +5 -0
  16. package/dist/Components/ChartBarSeries/ChartBarSeries.vue.d.ts +6 -0
  17. package/dist/Components/ChartBarSeries/ChartBarSeries.vue_vue_type_script_setup_true_lang.js +25 -0
  18. package/dist/Components/ChartBarSeries/chartBarSeries.types.d.ts +45 -0
  19. package/dist/Components/ChartBarSeries/composables/useChartBarSeries.d.ts +5 -0
  20. package/dist/Components/ChartBarSeries/composables/useChartBarSeries.js +20 -0
  21. package/dist/Components/ChartBarSeries/index.d.ts +3 -0
  22. package/dist/Components/ChartBarSeries/index.js +3 -0
  23. package/dist/Components/ChartFunnel/ChartFunnel.js +5 -0
  24. package/dist/Components/ChartFunnel/ChartFunnel.vue.d.ts +16 -0
  25. package/dist/Components/ChartFunnel/ChartFunnel.vue_vue_type_script_setup_true_lang.js +59 -0
  26. package/dist/Components/ChartFunnel/chartFunnel.types.d.ts +54 -0
  27. package/dist/Components/ChartFunnel/composables/useChartFunnel.d.ts +29 -0
  28. package/dist/Components/ChartFunnel/composables/useChartFunnel.js +68 -0
  29. package/dist/Components/ChartFunnel/index.d.ts +4 -0
  30. package/dist/Components/ChartFunnel/index.js +4 -0
  31. package/dist/Components/ChartLegend/ChartLegend.vue.d.ts +2 -0
  32. package/dist/Components/ChartLegend/ChartLegend.vue_vue_type_script_setup_true_lang.js +33 -13
  33. package/dist/Components/ChartLegend/chartLegend.types.d.ts +41 -5
  34. package/dist/Components/ChartLegend/composables/useChartLegend.d.ts +9 -5
  35. package/dist/Components/ChartLegend/composables/useChartLegend.js +88 -54
  36. package/dist/Components/ChartLine/ChartLine.js +5 -0
  37. package/dist/Components/ChartLine/ChartLine.vue.d.ts +20 -0
  38. package/dist/Components/ChartLine/ChartLine.vue_vue_type_script_setup_true_lang.js +76 -0
  39. package/dist/Components/ChartLine/chartLine.types.d.ts +72 -0
  40. package/dist/Components/ChartLine/composables/useChartLine.d.ts +26 -0
  41. package/dist/Components/ChartLine/composables/useChartLine.js +13 -0
  42. package/dist/Components/ChartLine/index.d.ts +4 -0
  43. package/dist/Components/ChartLine/index.js +4 -0
  44. package/dist/Components/ChartLineSeries/ChartLineSeries.js +5 -0
  45. package/dist/Components/ChartLineSeries/ChartLineSeries.vue.d.ts +10 -0
  46. package/dist/Components/ChartLineSeries/ChartLineSeries.vue_vue_type_script_setup_true_lang.js +42 -0
  47. package/dist/Components/ChartLineSeries/chartLineSeries.types.d.ts +75 -0
  48. package/dist/Components/ChartLineSeries/composables/useChartLineSeries.d.ts +5 -0
  49. package/dist/Components/ChartLineSeries/composables/useChartLineSeries.js +25 -0
  50. package/dist/Components/ChartLineSeries/index.d.ts +3 -0
  51. package/dist/Components/ChartLineSeries/index.js +3 -0
  52. package/dist/Components/ChartPie/ChartPie.js +5 -0
  53. package/dist/Components/ChartPie/ChartPie.vue.d.ts +15 -0
  54. package/dist/Components/ChartPie/ChartPie.vue_vue_type_script_setup_true_lang.js +73 -0
  55. package/dist/Components/ChartPie/chartPie.types.d.ts +73 -0
  56. package/dist/Components/ChartPie/composables/useChartPie.d.ts +30 -0
  57. package/dist/Components/ChartPie/composables/useChartPie.js +71 -0
  58. package/dist/Components/ChartPie/index.d.ts +4 -0
  59. package/dist/Components/ChartPie/index.js +4 -0
  60. package/dist/Components/ChartScatter/ChartScatter.js +5 -0
  61. package/dist/Components/{Chart/Chart.vue.d.ts → ChartScatter/ChartScatter.vue.d.ts} +3 -2
  62. package/dist/Components/ChartScatter/ChartScatter.vue_vue_type_script_setup_true_lang.js +49 -0
  63. package/dist/Components/ChartScatter/chartScatter.types.d.ts +23 -0
  64. package/dist/Components/ChartScatter/composables/useChartScatter.d.ts +29 -0
  65. package/dist/Components/ChartScatter/composables/useChartScatter.js +103 -0
  66. package/dist/Components/ChartScatter/index.d.ts +4 -0
  67. package/dist/Components/ChartScatter/index.js +4 -0
  68. package/dist/Components/ChartScatterSeries/ChartScatterSeries.js +5 -0
  69. package/dist/Components/ChartScatterSeries/ChartScatterSeries.vue.d.ts +4 -0
  70. package/dist/Components/ChartScatterSeries/ChartScatterSeries.vue_vue_type_script_setup_true_lang.js +21 -0
  71. package/dist/Components/ChartScatterSeries/chartScatterSeries.types.d.ts +38 -0
  72. package/dist/Components/ChartScatterSeries/composables/useChartScatterSeries.d.ts +4 -0
  73. package/dist/Components/ChartScatterSeries/composables/useChartScatterSeries.js +18 -0
  74. package/dist/Components/ChartScatterSeries/index.d.ts +3 -0
  75. package/dist/Components/ChartScatterSeries/index.js +3 -0
  76. package/dist/Components/ChartTooltip/ChartTooltip.vue_vue_type_script_setup_true_lang.js +18 -10
  77. package/dist/Components/ChartTooltip/chartTooltip.types.d.ts +24 -9
  78. package/dist/Components/ChartTooltip/composables/useChartTooltip.d.ts +3 -1
  79. package/dist/Components/ChartTooltip/composables/useChartTooltip.js +78 -64
  80. package/dist/Components/ResizablePanel/composables/useResizablePanel.d.ts +1 -1
  81. package/dist/Components/Spinner/composables/useSpinner.d.ts +1 -1
  82. package/dist/Utils/Charts/ChartFrame.js +5 -0
  83. package/dist/Utils/Charts/ChartFrame.vue.d.ts +24 -0
  84. package/dist/Utils/Charts/ChartFrame.vue_vue_type_script_setup_true_lang.js +41 -0
  85. package/dist/{Components/Chart → Utils/Charts}/chart.types.d.ts +16 -18
  86. package/dist/Utils/Charts/chartInjectionKey.d.ts +151 -0
  87. package/dist/{Components/Chart → Utils/Charts}/chartInjectionKey.js +2 -2
  88. package/dist/Utils/Charts/echarts/bar.d.ts +6 -0
  89. package/dist/Utils/Charts/echarts/bar.js +22 -0
  90. package/dist/Utils/Charts/echarts/cartesian.d.ts +15 -0
  91. package/dist/Utils/Charts/echarts/cartesian.js +255 -0
  92. package/dist/Utils/Charts/echarts/funnel.d.ts +15 -0
  93. package/dist/Utils/Charts/echarts/funnel.js +79 -0
  94. package/dist/Utils/Charts/echarts/line.d.ts +5 -0
  95. package/dist/Utils/Charts/echarts/line.js +19 -0
  96. package/dist/Utils/Charts/echarts/part.d.ts +19 -0
  97. package/dist/Utils/Charts/echarts/part.js +45 -0
  98. package/dist/Utils/Charts/echarts/pie.d.ts +14 -0
  99. package/dist/Utils/Charts/echarts/pie.js +75 -0
  100. package/dist/Utils/Charts/echarts/plot.d.ts +44 -0
  101. package/dist/Utils/Charts/echarts/plot.js +52 -0
  102. package/dist/Utils/Charts/echarts/scatter.d.ts +14 -0
  103. package/dist/Utils/Charts/echarts/scatter.js +152 -0
  104. package/dist/Utils/Charts/index.d.ts +6 -0
  105. package/dist/Utils/Charts/index.js +6 -0
  106. package/dist/Utils/Charts/useChartCartesian.d.ts +57 -0
  107. package/dist/Utils/Charts/useChartCartesian.js +155 -0
  108. package/dist/Utils/Charts/useChartPart.d.ts +45 -0
  109. package/dist/Utils/Charts/useChartPart.js +97 -0
  110. package/dist/Utils/Charts/useChartRegistry.d.ts +13 -0
  111. package/dist/Utils/Charts/useChartRegistry.js +40 -0
  112. package/dist/Utils/Charts/useChartRoot.d.ts +156 -0
  113. package/dist/Utils/Charts/useChartRoot.js +342 -0
  114. package/dist/Utils/Charts/useChartSeries.d.ts +10 -0
  115. package/dist/Utils/Charts/useChartSeries.js +22 -0
  116. package/dist/augments.d.ts +23 -7
  117. package/docs/README.md +6 -1
  118. package/docs/components/Chart.md +114 -154
  119. package/docs/components/ChartBar.md +137 -0
  120. package/docs/components/ChartFunnel.md +62 -0
  121. package/docs/components/ChartLine.md +151 -0
  122. package/docs/components/ChartPie.md +115 -0
  123. package/docs/components/ChartScatter.md +84 -0
  124. package/package.json +2 -2
  125. package/dist/Components/Chart/Chart.js +0 -5
  126. package/dist/Components/Chart/Chart.vue_vue_type_script_setup_true_lang.js +0 -52
  127. package/dist/Components/Chart/chartInjectionKey.d.ts +0 -94
  128. package/dist/Components/Chart/composables/useChart.d.ts +0 -40
  129. package/dist/Components/Chart/composables/useChart.js +0 -346
  130. package/dist/Components/Chart/echartsChart.d.ts +0 -14
  131. package/dist/Components/Chart/echartsChart.js +0 -199
  132. package/dist/Components/Chart/index.d.ts +0 -4
  133. package/dist/Components/Chart/index.js +0 -4
  134. package/dist/Components/ChartSeries/ChartSeries.js +0 -5
  135. package/dist/Components/ChartSeries/ChartSeries.vue.d.ts +0 -4
  136. package/dist/Components/ChartSeries/ChartSeries.vue_vue_type_script_setup_true_lang.js +0 -24
  137. package/dist/Components/ChartSeries/chartSeries.types.d.ts +0 -37
  138. package/dist/Components/ChartSeries/composables/useChartSeries.d.ts +0 -10
  139. package/dist/Components/ChartSeries/composables/useChartSeries.js +0 -29
  140. package/dist/Components/ChartSeries/index.d.ts +0 -3
  141. package/dist/Components/ChartSeries/index.js +0 -3
@@ -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 };
@@ -0,0 +1,156 @@
1
+ import { ComputedRef, HTMLAttributes } from 'vue';
2
+ import { BridgeUIComponentsConfig } from '@bridge-ui/core/Config';
3
+ import { ChartBaseRenderOptions, ChartHandle, ChartMountOptions, ChartRenderTheme, ChartTable, ChartTooltipContent } from '@bridge-ui/core/Domain';
4
+ import { ChartClasses, ChartRootOwnProps } from './chart.types';
5
+ import { ChartContextValue, ChartLegendItem, ChartLegendPosition } from './chartInjectionKey';
6
+ /**
7
+ * Registry names of the chart roots.
8
+ */
9
+ export type ChartRootName = Extract<keyof BridgeUIComponentsConfig, "ChartBar" | "ChartPie" | "ChartLine" | "ChartFunnel" | "ChartScatter">;
10
+ /**
11
+ * Merged props every chart root resolves.
12
+ */
13
+ export type ChartRootMerged = Pick<ChartRootOwnProps, "palette" | "customProps"> & {
14
+ animation: boolean;
15
+ height: number | string;
16
+ size: string;
17
+ };
18
+ /**
19
+ * Bridge keys shared by every chart root.
20
+ */
21
+ export declare const chartRootBridgeKeys: readonly ["size", "width", "height", "classes", "loading", "palette", "summary", "animation", "customProps"];
22
+ type ChartActive = {
23
+ index: null | number;
24
+ source: "pointer" | "keyboard";
25
+ };
26
+ /**
27
+ * Shared state for a chart root: registry merge, tokens, theme, plot size,
28
+ * active item, hidden items, and the mounted plot handle.
29
+ */
30
+ export declare function useChartRoot<Merged extends ChartRootMerged>({ props, bridgeKeys, libDefaults, registryKeys, componentName, fallbackProps, }: {
31
+ bridgeKeys: readonly string[];
32
+ componentName: ChartRootName;
33
+ /**
34
+ * Props that win over registry defaults but lose to explicit props
35
+ * (e.g. the sparkline height).
36
+ */
37
+ fallbackProps?: () => Partial<ChartRootOwnProps>;
38
+ libDefaults: Partial<Merged>;
39
+ props: ChartRootOwnProps;
40
+ registryKeys: readonly string[];
41
+ }): {
42
+ split: ComputedRef<{
43
+ componentProps: Record<string, unknown> & ChartRootOwnProps;
44
+ inheritedAttrs: HTMLAttributes & Record<string, unknown>;
45
+ }>;
46
+ theme: import('vue').ShallowRef<ChartRenderTheme | null, ChartRenderTheme | null>;
47
+ merged: ComputedRef<Merged>;
48
+ active: import('vue').ShallowRef<ChartActive, ChartActive>;
49
+ hidden: import('vue').Ref<string[], string[]>;
50
+ locale: ComputedRef<string>;
51
+ chartId: string;
52
+ palette: ComputedRef<string[]>;
53
+ rootRef: import('vue').ShallowRef<HTMLDivElement | null, HTMLDivElement | null>;
54
+ plotRef: import('vue').ShallowRef<HTMLDivElement | null, HTMLDivElement | null>;
55
+ hostRef: import('vue').ShallowRef<HTMLDivElement | null, HTMLDivElement | null>;
56
+ plotSize: import('vue').ShallowRef<{
57
+ width: number;
58
+ height: number;
59
+ }, {
60
+ width: number;
61
+ height: number;
62
+ }>;
63
+ sizeItem: ComputedRef<any>;
64
+ animation: ComputedRef<boolean>;
65
+ handleRef: import('vue').ShallowRef<ChartHandle<ChartBaseRenderOptions> | null, ChartHandle<ChartBaseRenderOptions> | null>;
66
+ getBounds: () => {
67
+ width: number;
68
+ height: number;
69
+ };
70
+ schemeTick: import('vue').Ref<number, number>;
71
+ toggleItem: (id: string) => void;
72
+ bridgeTheme: ComputedRef<string | undefined>;
73
+ customProps: ComputedRef<import('./chart.types').ChartCustomProps | undefined>;
74
+ colorClasses: ComputedRef<Partial<{
75
+ black: import('@bridge-ui/core/Tokens').ChartColorItem;
76
+ dark: import('@bridge-ui/core/Tokens').ChartColorItem;
77
+ error: import('@bridge-ui/core/Tokens').ChartColorItem;
78
+ info: import('@bridge-ui/core/Tokens').ChartColorItem;
79
+ primary: import('@bridge-ui/core/Tokens').ChartColorItem;
80
+ secondary: import('@bridge-ui/core/Tokens').ChartColorItem;
81
+ success: import('@bridge-ui/core/Tokens').ChartColorItem;
82
+ warning: import('@bridge-ui/core/Tokens').ChartColorItem;
83
+ }>>;
84
+ highlightItem: (id: null | string) => void;
85
+ mergedClasses: ComputedRef<Partial<ChartClasses>>;
86
+ legendPosition: import('vue').Ref<ChartLegendPosition | null, ChartLegendPosition | null>;
87
+ resolveMessage: (message: string, countOrParams?: number | import('@bridge-ui/core/Adapters').MessageParams, params?: import('@bridge-ui/core/Adapters').MessageParams) => string;
88
+ componentProps: ComputedRef<Record<string, unknown> & ChartRootOwnProps>;
89
+ getTooltipAnchor: (index: number) => {
90
+ y: number;
91
+ x: number;
92
+ } | null;
93
+ setLegendPosition: (position: null | ChartLegendPosition) => void;
94
+ onActiveIndexChange: (index: null | number) => void;
95
+ };
96
+ /**
97
+ * State returned by {@link useChartRoot}.
98
+ */
99
+ export type ChartRootState = ReturnType<typeof useChartRoot>;
100
+ /**
101
+ * Resolves item colors (token keys or CSS colors) to computed CSS colors.
102
+ * Items without `color` take palette entries in order.
103
+ */
104
+ export declare function useChartColors(root: ChartRootState, items: () => ReadonlyArray<{
105
+ color?: string;
106
+ id: string;
107
+ }>): import('vue').ShallowRef<Record<string, string>, Record<string, string>>;
108
+ /**
109
+ * Mounts the plot into the host once the theme and size are known, then
110
+ * pushes every new options object to it.
111
+ */
112
+ export declare function useChartPlot<Options extends ChartBaseRenderOptions>(root: ChartRootState, { mount, options, }: {
113
+ mount: (options: ChartMountOptions<Options>) => ChartHandle<Options>;
114
+ options: ComputedRef<null | Options>;
115
+ }): void;
116
+ /**
117
+ * Root, plot, and overlay binds plus keyboard navigation over `count` items.
118
+ */
119
+ export declare function useChartFrame(root: ChartRootState, state: ComputedRef<{
120
+ count: number;
121
+ isEmpty: boolean;
122
+ summary: string;
123
+ table: ChartTable;
124
+ tooltip: null | ChartTooltipContent;
125
+ }>): {
126
+ label: ComputedRef<string>;
127
+ table: ComputedRef<ChartTable>;
128
+ isEmpty: ComputedRef<boolean>;
129
+ hostBind: ComputedRef<HTMLAttributes>;
130
+ plotBind: ComputedRef<HTMLAttributes>;
131
+ rootBind: ComputedRef<HTMLAttributes>;
132
+ liveBind: ComputedRef<HTMLAttributes>;
133
+ emptyBind: ComputedRef<HTMLAttributes>;
134
+ isLoading: ComputedRef<boolean>;
135
+ tableBind: ComputedRef<HTMLAttributes>;
136
+ centerBind: ComputedRef<HTMLAttributes>;
137
+ loadingBind: ComputedRef<HTMLAttributes>;
138
+ announcement: ComputedRef<string>;
139
+ emptyMessage: ComputedRef<string>;
140
+ rootRef: import('vue').ShallowRef<HTMLDivElement | null, HTMLDivElement | null>;
141
+ plotRef: import('vue').ShallowRef<HTMLDivElement | null, HTMLDivElement | null>;
142
+ hostRef: import('vue').ShallowRef<HTMLDivElement | null, HTMLDivElement | null>;
143
+ };
144
+ /**
145
+ * Frame state returned by {@link useChartFrame}.
146
+ */
147
+ export type ChartFrameState = ReturnType<typeof useChartFrame>;
148
+ /**
149
+ * Provides the context value for the chart parts.
150
+ */
151
+ export declare function useChartContextValue(root: ChartRootState, state: ComputedRef<Pick<ChartContextValue, "family" | "setAxis" | "tooltip" | "removeAxis" | "legendItems" | "removeSeries" | "upsertSeries">>): ComputedRef<ChartContextValue>;
152
+ /**
153
+ * Legend entries from items, their resolved colors, and the hidden ids.
154
+ */
155
+ export declare function toChartLegendItems(items: ReadonlyArray<Pick<ChartLegendItem, "id" | "name" | "value" | "percent">>, colors: Record<string, string>, hidden: readonly string[]): ChartLegendItem[];
156
+ export {};