@bridge-ui/vue 0.17.3 → 0.19.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 (164) hide show
  1. package/ai/skills/bridge-ui-components/SKILL.md +36 -35
  2. package/ai/skills/bridge-ui-setup/SKILL.md +1 -1
  3. package/dist/Components/CalendarMonth/composables/useCalendarMonth.d.ts +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 +64 -0
  11. package/dist/Components/ChartBar/chartBar.types.d.ts +66 -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 +28 -0
  19. package/dist/Components/ChartBarSeries/chartBarSeries.types.d.ts +67 -0
  20. package/dist/Components/ChartBarSeries/composables/useChartBarSeries.d.ts +5 -0
  21. package/dist/Components/ChartBarSeries/composables/useChartBarSeries.js +23 -0
  22. package/dist/Components/ChartBarSeries/index.d.ts +4 -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 +77 -0
  40. package/dist/Components/ChartLine/chartLine.types.d.ts +79 -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 +45 -0
  48. package/dist/Components/ChartLineSeries/chartLineSeries.types.d.ts +96 -0
  49. package/dist/Components/ChartLineSeries/composables/useChartLineSeries.d.ts +5 -0
  50. package/dist/Components/ChartLineSeries/composables/useChartLineSeries.js +28 -0
  51. package/dist/Components/ChartLineSeries/index.d.ts +4 -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 +76 -0
  56. package/dist/Components/ChartPie/chartPie.types.d.ts +92 -0
  57. package/dist/Components/ChartPie/composables/useChartPie.d.ts +30 -0
  58. package/dist/Components/ChartPie/composables/useChartPie.js +81 -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 +108 -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 +22 -0
  72. package/dist/Components/ChartScatterSeries/chartScatterSeries.types.d.ts +45 -0
  73. package/dist/Components/ChartScatterSeries/composables/useChartScatterSeries.d.ts +4 -0
  74. package/dist/Components/ChartScatterSeries/composables/useChartScatterSeries.js +19 -0
  75. package/dist/Components/ChartScatterSeries/index.d.ts +4 -0
  76. package/dist/Components/ChartScatterSeries/index.js +3 -0
  77. package/dist/Components/ChartTooltip/ChartTooltip.vue_vue_type_script_setup_true_lang.js +22 -10
  78. package/dist/Components/ChartTooltip/chartTooltip.types.d.ts +28 -9
  79. package/dist/Components/ChartTooltip/composables/useChartTooltip.d.ts +4 -1
  80. package/dist/Components/ChartTooltip/composables/useChartTooltip.js +81 -63
  81. package/dist/Components/Heading/Heading.js +5 -0
  82. package/dist/Components/Heading/Heading.vue.d.ts +11 -0
  83. package/dist/Components/Heading/Heading.vue_vue_type_script_setup_true_lang.js +29 -0
  84. package/dist/Components/Heading/composables/useHeading.d.ts +10 -0
  85. package/dist/Components/Heading/composables/useHeading.js +56 -0
  86. package/dist/Components/Heading/heading.types.d.ts +56 -0
  87. package/dist/Components/Heading/index.d.ts +3 -0
  88. package/dist/Components/Heading/index.js +3 -0
  89. package/dist/Components/ResizablePanel/composables/useResizablePanel.d.ts +1 -1
  90. package/dist/Components/Spinner/composables/useSpinner.d.ts +1 -1
  91. package/dist/Components/Text/Text.js +5 -0
  92. package/dist/Components/Text/Text.vue.d.ts +11 -0
  93. package/dist/Components/Text/Text.vue_vue_type_script_setup_true_lang.js +33 -0
  94. package/dist/Components/Text/composables/useText.d.ts +9 -0
  95. package/dist/Components/Text/composables/useText.js +56 -0
  96. package/dist/Components/Text/index.d.ts +3 -0
  97. package/dist/Components/Text/index.js +3 -0
  98. package/dist/Components/Text/text.types.d.ts +76 -0
  99. package/dist/Utils/Charts/ChartFrame.js +5 -0
  100. package/dist/Utils/Charts/ChartFrame.vue.d.ts +24 -0
  101. package/dist/Utils/Charts/ChartFrame.vue_vue_type_script_setup_true_lang.js +41 -0
  102. package/dist/{Components/Chart → Utils/Charts}/chart.types.d.ts +33 -18
  103. package/dist/Utils/Charts/chartInjectionKey.d.ts +151 -0
  104. package/dist/{Components/Chart → Utils/Charts}/chartInjectionKey.js +2 -2
  105. package/dist/Utils/Charts/echarts/bar.d.ts +6 -0
  106. package/dist/Utils/Charts/echarts/bar.js +23 -0
  107. package/dist/Utils/Charts/echarts/cartesian.d.ts +15 -0
  108. package/dist/Utils/Charts/echarts/cartesian.js +290 -0
  109. package/dist/Utils/Charts/echarts/funnel.d.ts +15 -0
  110. package/dist/Utils/Charts/echarts/funnel.js +79 -0
  111. package/dist/Utils/Charts/echarts/line.d.ts +5 -0
  112. package/dist/Utils/Charts/echarts/line.js +20 -0
  113. package/dist/Utils/Charts/echarts/part.d.ts +19 -0
  114. package/dist/Utils/Charts/echarts/part.js +45 -0
  115. package/dist/Utils/Charts/echarts/pie.d.ts +14 -0
  116. package/dist/Utils/Charts/echarts/pie.js +76 -0
  117. package/dist/Utils/Charts/echarts/plot.d.ts +44 -0
  118. package/dist/Utils/Charts/echarts/plot.js +52 -0
  119. package/dist/Utils/Charts/echarts/scatter.d.ts +14 -0
  120. package/dist/Utils/Charts/echarts/scatter.js +161 -0
  121. package/dist/Utils/Charts/index.d.ts +6 -0
  122. package/dist/Utils/Charts/index.js +6 -0
  123. package/dist/Utils/Charts/useChartCartesian.d.ts +59 -0
  124. package/dist/Utils/Charts/useChartCartesian.js +169 -0
  125. package/dist/Utils/Charts/useChartPart.d.ts +45 -0
  126. package/dist/Utils/Charts/useChartPart.js +97 -0
  127. package/dist/Utils/Charts/useChartRegistry.d.ts +13 -0
  128. package/dist/Utils/Charts/useChartRegistry.js +40 -0
  129. package/dist/Utils/Charts/useChartRoot.d.ts +156 -0
  130. package/dist/Utils/Charts/useChartRoot.js +342 -0
  131. package/dist/Utils/Charts/useChartSeries.d.ts +10 -0
  132. package/dist/Utils/Charts/useChartSeries.js +22 -0
  133. package/dist/augments.d.ts +33 -7
  134. package/dist/index.d.ts +4 -0
  135. package/dist/index.js +90 -86
  136. package/docs/README.md +8 -1
  137. package/docs/components/BridgeUIProvider.md +1 -1
  138. package/docs/components/Card.md +15 -0
  139. package/docs/components/Chart.md +118 -151
  140. package/docs/components/ChartBar.md +190 -0
  141. package/docs/components/ChartFunnel.md +62 -0
  142. package/docs/components/ChartLine.md +192 -0
  143. package/docs/components/ChartPie.md +138 -0
  144. package/docs/components/ChartScatter.md +102 -0
  145. package/docs/components/Heading.md +85 -0
  146. package/docs/components/Text.md +118 -0
  147. package/package.json +2 -2
  148. package/dist/Components/Chart/Chart.js +0 -5
  149. package/dist/Components/Chart/Chart.vue_vue_type_script_setup_true_lang.js +0 -52
  150. package/dist/Components/Chart/chartInjectionKey.d.ts +0 -94
  151. package/dist/Components/Chart/composables/useChart.d.ts +0 -40
  152. package/dist/Components/Chart/composables/useChart.js +0 -346
  153. package/dist/Components/Chart/echartsChart.d.ts +0 -14
  154. package/dist/Components/Chart/echartsChart.js +0 -199
  155. package/dist/Components/Chart/index.d.ts +0 -4
  156. package/dist/Components/Chart/index.js +0 -4
  157. package/dist/Components/ChartSeries/ChartSeries.js +0 -5
  158. package/dist/Components/ChartSeries/ChartSeries.vue.d.ts +0 -4
  159. package/dist/Components/ChartSeries/ChartSeries.vue_vue_type_script_setup_true_lang.js +0 -24
  160. package/dist/Components/ChartSeries/chartSeries.types.d.ts +0 -37
  161. package/dist/Components/ChartSeries/composables/useChartSeries.d.ts +0 -10
  162. package/dist/Components/ChartSeries/composables/useChartSeries.js +0 -29
  163. package/dist/Components/ChartSeries/index.d.ts +0 -3
  164. package/dist/Components/ChartSeries/index.js +0 -3
@@ -0,0 +1,41 @@
1
+ import e from "../LoadingSpin.js";
2
+ import { Fragment as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, createTextVNode as a, createVNode as o, defineComponent as s, guardReactiveProps as c, mergeProps as l, normalizeProps as u, openBlock as d, renderList as f, renderSlot as p, toDisplayString as m, unref as h } from "vue";
3
+ //#region src/Utils/Charts/ChartFrame.vue?vue&type=script&setup=true&lang.ts
4
+ var g = {
5
+ key: 0,
6
+ scope: "row"
7
+ }, _ = { key: 1 }, v = /*@__PURE__*/ s({
8
+ __name: "ChartFrame",
9
+ props: {
10
+ frame: {},
11
+ showCenter: { type: Boolean }
12
+ },
13
+ setup(s) {
14
+ let { table: v, isEmpty: y, rootRef: b, plotRef: x, hostRef: S, hostBind: C, plotBind: w, rootBind: T, liveBind: E, emptyBind: D, isLoading: O, tableBind: k, centerBind: A, loadingBind: j, announcement: M, emptyMessage: N } = s.frame;
15
+ function P(e) {
16
+ b.value = e;
17
+ }
18
+ function F(e) {
19
+ x.value = e;
20
+ }
21
+ function I(e) {
22
+ S.value = e;
23
+ }
24
+ return (b, x) => (d(), r("div", l({ ref: P }, h(T)), [
25
+ i("div", l({ ref: F }, h(w)), [
26
+ i("div", l({ ref: I }, h(C)), null, 16),
27
+ s.showCenter && !h(y) ? (d(), r("div", u(l({ key: 0 }, h(A))), [p(b.$slots, "center")], 16)) : n("", !0),
28
+ h(O) ? (d(), r("div", u(l({ key: 1 }, h(j))), [p(b.$slots, "loading", {}, () => [o(e)])], 16)) : n("", !0),
29
+ h(y) ? (d(), r("div", u(l({ key: 2 }, h(D))), [p(b.$slots, "empty", {}, () => [a(m(h(N)), 1)])], 16)) : n("", !0)
30
+ ], 16),
31
+ p(b.$slots, "default"),
32
+ i("table", u(c(h(k))), [i("thead", null, [i("tr", null, [(d(!0), r(t, null, f(h(v).headers, (e, t) => (d(), r("th", {
33
+ scope: "col",
34
+ key: `${t}-${e}`
35
+ }, m(e), 1))), 128))])]), i("tbody", null, [(d(!0), r(t, null, f(h(v).rows, (e) => (d(), r("tr", { key: e.key }, [(d(!0), r(t, null, f(e.cells, (e, n) => (d(), r(t, { key: n }, [n === 0 ? (d(), r("th", g, m(e), 1)) : (d(), r("td", _, m(e), 1))], 64))), 128))]))), 128))])], 16),
36
+ i("div", u(c(h(E))), m(h(M)), 17)
37
+ ], 16));
38
+ }
39
+ });
40
+ //#endregion
41
+ export { v as default };
@@ -1,14 +1,24 @@
1
1
  import { HTMLAttributes, Slot } from 'vue';
2
+ import { ChartColorRange } from '@bridge-ui/core/Domain';
2
3
  import { ChartColor, ChartSize } from '@bridge-ui/core/Tokens';
3
- import { MergeHtmlProps, MergeProps } from '@bridge-ui/core/Utils';
4
+ import { MergeProps } from '@bridge-ui/core/Utils';
4
5
  export interface ChartSizeOverrides {}
5
6
  export interface ChartColorOverrides {}
6
7
  /**
7
- * Series color: a Chart color token key (`"primary"`, `"info"`, …) or any
8
- * CSS color (`"#6366f1"`, `"rgb(0 0 0)"`, `"var(--brand)"`).
8
+ * Chart color: a Chart color token key (`"primary"`, `"info"`, …) or any CSS
9
+ * color (`"#6366f1"`, `"rgb(0 0 0)"`, `"var(--brand)"`).
9
10
  */
10
- export type ChartSeriesColor = (string & {}) | MergeProps<ChartColor, ChartColorOverrides>;
11
+ export type ChartColorValue = (string & {}) | MergeProps<ChartColor, ChartColorOverrides>;
12
+ /**
13
+ * Bar colors per category: `true` takes palette entries in category order,
14
+ * an array follows the category order, and a record maps category labels.
15
+ */
16
+ export type ChartCategoryColors = boolean | ChartColorValue[] | Record<string, ChartColorValue>;
11
17
  export interface ChartClasses {
18
+ /**
19
+ * Classes merged onto the center content (`ChartPie` donut hole).
20
+ */
21
+ center?: string;
12
22
  /**
13
23
  * Classes merged onto the empty-state overlay.
14
24
  */
@@ -30,6 +40,17 @@ export interface ChartClasses {
30
40
  */
31
41
  table?: string;
32
42
  }
43
+ /**
44
+ * One color range: values in `[min, max)` take `color` (token key or CSS
45
+ * color). With `colorBy="category"`, `min` and `max` are category indices
46
+ * and both ends are included.
47
+ */
48
+ export interface ChartColorRangeOption extends Omit<ChartColorRange, "color"> {
49
+ /**
50
+ * Range color.
51
+ */
52
+ color: ChartColorValue;
53
+ }
33
54
  export interface ChartCustomProps {
34
55
  /**
35
56
  * Props forwarded to the plot area (`role="img"`, keyboard target).
@@ -45,20 +66,16 @@ export interface ChartCustomProps {
45
66
  root?: HTMLAttributes;
46
67
  }
47
68
  /**
48
- * Chart root. Compose with `ChartSeries`, `ChartAxis`, `ChartLegend`,
49
- * and `ChartTooltip`. The plot is drawn by ECharts.
69
+ * Props shared by every chart root (`ChartLine`, `ChartBar`, `ChartScatter`,
70
+ * `ChartPie`, `ChartFunnel`).
50
71
  */
51
- export interface ChartOwnProps {
72
+ export interface ChartRootOwnProps {
52
73
  /**
53
74
  * Enables engine transitions. Always off under `prefers-reduced-motion`.
54
75
  *
55
76
  * @default true
56
77
  */
57
78
  animation?: boolean;
58
- /**
59
- * Category labels for the x axis. Each series has one value per category.
60
- */
61
- categories: string[];
62
79
  /**
63
80
  * Classes for chart parts.
64
81
  *
@@ -84,20 +101,19 @@ export interface ChartOwnProps {
84
101
  */
85
102
  loading?: boolean;
86
103
  /**
87
- * Series colors used in order when a `ChartSeries` omits `color`.
104
+ * Colors used in order when a series or slice omits `color`.
88
105
  *
89
106
  * @default ["primary", "info", "success", "warning", "error", "secondary", "dark"]
90
107
  */
91
- palette?: ChartSeriesColor[];
108
+ palette?: ChartColorValue[];
92
109
  /**
93
- * Density of axis labels, legend, and tooltip.
110
+ * Density of labels, legend, and tooltip.
94
111
  *
95
112
  * @default "md"
96
113
  */
97
114
  size?: MergeProps<ChartSize, ChartSizeOverrides>;
98
115
  /**
99
- * Accessible description of the plot. Defaults to a generated summary
100
- * (series names and category range).
116
+ * Accessible description of the plot. Defaults to a generated summary.
101
117
  *
102
118
  * @default undefined
103
119
  */
@@ -111,7 +127,7 @@ export interface ChartOwnProps {
111
127
  }
112
128
  export interface ChartSlots {
113
129
  /**
114
- * Chart parts (`ChartSeries`, `ChartAxis`, `ChartLegend`, `ChartTooltip`).
130
+ * Chart parts (series, `ChartAxis`, `ChartLegend`, `ChartTooltip`).
115
131
  */
116
132
  default?: Slot<undefined>;
117
133
  /**
@@ -123,4 +139,3 @@ export interface ChartSlots {
123
139
  */
124
140
  loading?: Slot<undefined>;
125
141
  }
126
- export type ChartProps = MergeHtmlProps<ChartOwnProps, HTMLAttributes>;
@@ -0,0 +1,151 @@
1
+ import { ComputedRef, InjectionKey } from 'vue';
2
+ import { ChartAnchor, ChartAxisOptions, ChartAxisPosition, ChartBarSeriesEntry, ChartLineSeriesEntry, ChartReference, ChartScatterSeriesEntry, ChartTooltipContent } from '@bridge-ui/core/Domain';
3
+ /**
4
+ * Chart family of the nearest root.
5
+ */
6
+ export type ChartFamily = "bar" | "pie" | "line" | "funnel" | "scatter";
7
+ /**
8
+ * Where `ChartLegend` sits relative to the plot.
9
+ */
10
+ export type ChartLegendPosition = "top" | "left" | "right" | "bottom";
11
+ /**
12
+ * Series registered by `ChartLineSeries`. Unset options fall back to the
13
+ * `ChartLine` props.
14
+ */
15
+ export type ChartLineSeriesRegistration = Pick<ChartLineSeriesEntry, "id" | "data" | "kind" | "name" | "color"> & Partial<Pick<ChartLineSeriesEntry, "area" | "step" | "curve" | "stack" | "dashed" | "labels" | "colorBy" | "showPoints" | "areaOpacity" | "colorRanges">> & {
16
+ /**
17
+ * Reference lines.
18
+ */
19
+ reference?: ChartReference[];
20
+ };
21
+ /**
22
+ * Series registered by `ChartBarSeries`. Unset options fall back to the
23
+ * `ChartBar` props.
24
+ */
25
+ export type ChartBarSeriesRegistration = Pick<ChartBarSeriesEntry, "id" | "data" | "kind" | "name" | "color"> & Partial<Pick<ChartBarSeriesEntry, "tone" | "stack" | "labels" | "colorBy" | "colorRanges">> & {
26
+ /**
27
+ * Reference lines.
28
+ */
29
+ reference?: ChartReference[];
30
+ };
31
+ /**
32
+ * Series registered by `ChartScatterSeries`.
33
+ */
34
+ export type ChartScatterSeriesRegistration = ChartScatterSeriesEntry;
35
+ /**
36
+ * Any series a chart root accepts.
37
+ */
38
+ export type ChartSeriesRegistration = ChartBarSeriesRegistration | ChartLineSeriesRegistration | ChartScatterSeriesRegistration;
39
+ /**
40
+ * One legend entry: a series or a slice.
41
+ */
42
+ export type ChartLegendItem = {
43
+ /**
44
+ * Resolved CSS color (empty until the first layout pass).
45
+ */
46
+ color: string;
47
+ /**
48
+ * Whether the item is hidden with the legend toggle.
49
+ */
50
+ hidden: boolean;
51
+ /**
52
+ * Series or slice id.
53
+ */
54
+ id: string;
55
+ /**
56
+ * Series name or slice label.
57
+ */
58
+ name: string;
59
+ /**
60
+ * Share (`0`–`100`, slices only). `undefined` while hidden.
61
+ */
62
+ percent?: number;
63
+ /**
64
+ * Slice value (slices only).
65
+ */
66
+ value?: number;
67
+ };
68
+ /**
69
+ * Shared chart state for series, `ChartAxis`, `ChartLegend`, and
70
+ * `ChartTooltip` descendants.
71
+ */
72
+ export type ChartContextValue = {
73
+ /**
74
+ * Active item index (pointer or keyboard). `null` when idle.
75
+ */
76
+ activeIndex: null | number;
77
+ /**
78
+ * Chart family of the root.
79
+ */
80
+ family: ChartFamily;
81
+ /**
82
+ * Root size (px) used to keep the tooltip inside the chart.
83
+ */
84
+ getBounds: () => {
85
+ height: number;
86
+ width: number;
87
+ };
88
+ /**
89
+ * Tooltip anchor for an item, relative to the chart root.
90
+ */
91
+ getTooltipAnchor: (index: number) => null | ChartAnchor;
92
+ /**
93
+ * Emphasizes one legend item in the plot. `null` clears it.
94
+ */
95
+ highlightItem: (id: null | string) => void;
96
+ /**
97
+ * Stable id prefix for chart parts.
98
+ */
99
+ id: string;
100
+ /**
101
+ * Legend entries in order, with colors and visibility.
102
+ */
103
+ legendItems: ChartLegendItem[];
104
+ /**
105
+ * Locale used to format values.
106
+ */
107
+ locale: string;
108
+ /**
109
+ * Removes axis options registered by `ChartAxis` (axis charts only).
110
+ */
111
+ removeAxis?: (position: ChartAxisPosition) => void;
112
+ /**
113
+ * Removes a series by id (series charts only).
114
+ */
115
+ removeSeries?: (id: string) => void;
116
+ /**
117
+ * Sets axis options (axis charts only; no-op when unchanged).
118
+ */
119
+ setAxis?: (position: ChartAxisPosition, options: ChartAxisOptions) => void;
120
+ /**
121
+ * Tells the root where the legend sits (`null` when it unmounts).
122
+ */
123
+ setLegendPosition: (position: null | ChartLegendPosition) => void;
124
+ /**
125
+ * Shows / hides a legend item by id.
126
+ */
127
+ toggleItem: (id: string) => void;
128
+ /**
129
+ * Merged size token classes for legend and tooltip.
130
+ */
131
+ tokenClasses: {
132
+ legend?: string;
133
+ legendItem?: string;
134
+ swatch?: string;
135
+ tooltip?: string;
136
+ };
137
+ /**
138
+ * Tooltip content for `activeIndex`. `null` when idle or empty.
139
+ */
140
+ tooltip: null | ChartTooltipContent;
141
+ /**
142
+ * Adds or replaces a series by `id`, keeping its position (series charts
143
+ * only; no-op when unchanged).
144
+ */
145
+ upsertSeries?: (entry: ChartSeriesRegistration) => void;
146
+ };
147
+ export declare const CHART_INJECTION_KEY: InjectionKey<ComputedRef<ChartContextValue>>;
148
+ /**
149
+ * Injects the nearest chart root context. Throws when used outside a chart.
150
+ */
151
+ export declare function useChartContext(): ComputedRef<ChartContextValue>;
@@ -1,9 +1,9 @@
1
1
  import { inject as e } from "vue";
2
- //#region src/Components/Chart/chartInjectionKey.ts
2
+ //#region src/Utils/Charts/chartInjectionKey.ts
3
3
  var t = Symbol("bridge-chart");
4
4
  function n() {
5
5
  let n = e(t, null);
6
- if (!n) throw Error("Chart components must be used within a Chart");
6
+ if (!n) throw Error("Chart components must be used within ChartLine, ChartBar, ChartScatter, ChartPie, or ChartFunnel");
7
7
  return n;
8
8
  }
9
9
  //#endregion
@@ -0,0 +1,6 @@
1
+ import { ChartCartesianRenderOptions, ChartHandle, ChartMountOptions } from '@bridge-ui/core/Domain';
2
+ /**
3
+ * Mounts a bar plot (tree-shaken: bar and line series, for bar + line
4
+ * charts).
5
+ */
6
+ export declare function mountEchartsBar(options: ChartMountOptions<ChartCartesianRenderOptions>): ChartHandle<ChartCartesianRenderOptions>;
@@ -0,0 +1,23 @@
1
+ import { mountEchartsPlot as e } from "./plot.js";
2
+ import { echartsCartesianFamily as t } from "./cartesian.js";
3
+ import { BarChart as n, LineChart as r } from "echarts/charts";
4
+ import { GridComponent as i, MarkLineComponent as a, TooltipComponent as o, VisualMapPiecewiseComponent as s } from "echarts/components";
5
+ import { use as c } from "echarts/core";
6
+ import { LabelLayout as l } from "echarts/features";
7
+ import { SVGRenderer as u } from "echarts/renderers";
8
+ //#region src/Utils/Charts/echarts/bar.ts
9
+ c([
10
+ n,
11
+ r,
12
+ l,
13
+ i,
14
+ u,
15
+ o,
16
+ a,
17
+ s
18
+ ]);
19
+ function d(n) {
20
+ return e(n, t);
21
+ }
22
+ //#endregion
23
+ export { d as mountEchartsBar };
@@ -0,0 +1,15 @@
1
+ import { BarSeriesOption, LineSeriesOption } from 'echarts/charts';
2
+ import { GridComponentOption, MarkLineComponentOption, TooltipComponentOption, VisualMapComponentOption } from 'echarts/components';
3
+ import { ComposeOption } from 'echarts/core';
4
+ import { ChartCartesianRenderOptions } from '@bridge-ui/core/Domain';
5
+ import { EchartsPlotFamily } from './plot';
6
+ type EChartsCartesianOption = ComposeOption<BarSeriesOption | LineSeriesOption | GridComponentOption | TooltipComponentOption | MarkLineComponentOption | VisualMapComponentOption>;
7
+ /**
8
+ * Builds the ECharts option for a line or bar plot.
9
+ */
10
+ export declare function buildEchartsCartesianOption(options: ChartCartesianRenderOptions): EChartsCartesianOption;
11
+ /**
12
+ * Line / bar pieces for {@link mountEchartsPlot}.
13
+ */
14
+ export declare const echartsCartesianFamily: EchartsPlotFamily<ChartCartesianRenderOptions>;
15
+ export {};
@@ -0,0 +1,290 @@
1
+ import { labelStyle as e } from "./plot.js";
2
+ import { clamp as t, get as n, isArray as r, isEmpty as i, isNil as a, isNumber as o } from "es-toolkit/compat";
3
+ import { getChartNearestIndex as s, getChartStackEnds as c, isChartValue as l, resolveChartBarRadii as u, resolveChartCartesianAxes as d } from "@bridge-ui/core/Domain";
4
+ //#region src/Utils/Charts/echarts/cartesian.ts
5
+ var f = 32;
6
+ function p(e, t) {
7
+ let n = e.formatTick, r = e.formatCategory;
8
+ return t === "category" ? a(r) ? void 0 : (e) => r(String(e)) : a(n) ? void 0 : (e) => n(Number(e));
9
+ }
10
+ function m(e, t, n) {
11
+ let r = e.timestamps?.[n];
12
+ return a(r) ? t : e.orientation === "horizontal" ? [t, r] : [r, t];
13
+ }
14
+ function h(t, r) {
15
+ if (r.reference.length === 0) return;
16
+ let i = t.orientation === "horizontal" ? "xAxis" : "yAxis", a = (r) => ({
17
+ ...e(t.theme),
18
+ position: "insideEndTop",
19
+ formatter: (e) => r.label ?? t.formatLabel(Number(n(e, "value")))
20
+ });
21
+ return {
22
+ silent: !0,
23
+ symbol: "none",
24
+ animation: !1,
25
+ lineStyle: {
26
+ width: 1,
27
+ type: "dashed",
28
+ color: r.color
29
+ },
30
+ data: r.reference.map((e) => "type" in e ? {
31
+ type: e.type,
32
+ label: a(e)
33
+ } : {
34
+ label: a(e),
35
+ [i]: e.value
36
+ })
37
+ };
38
+ }
39
+ function g(e) {
40
+ return e.colorRanges.some((e) => l(e.min) || l(e.max));
41
+ }
42
+ function _(e, n) {
43
+ let r = e.timestamps;
44
+ return a(r) || i(r) ? n : r[Math.round(t(n, 0, r.length - 1))];
45
+ }
46
+ function v(e) {
47
+ let t = e.orientation === "horizontal", n = e.series.flatMap((n, r) => {
48
+ if (n.kind !== "line" || !g(n)) return [];
49
+ let i = n.colorBy === "category";
50
+ return [{
51
+ seriesIndex: r,
52
+ show: !1,
53
+ type: "piecewise",
54
+ outOfRange: { color: n.color },
55
+ dimension: +(i === t),
56
+ pieces: n.colorRanges.map((t) => i ? {
57
+ color: t.color,
58
+ ...a(t.min) ? {} : { gte: _(e, t.min) },
59
+ ...a(t.max) ? {} : { lte: _(e, t.max) }
60
+ } : {
61
+ color: t.color,
62
+ ...a(t.min) ? {} : { gte: t.min },
63
+ ...a(t.max) ? {} : { lt: t.max }
64
+ })
65
+ }];
66
+ });
67
+ return n.length > 0 ? n : void 0;
68
+ }
69
+ function y(e) {
70
+ let t = n(e, "rect"), r = n(e, "labelRect");
71
+ return Number(n(r, "width")) <= Number(n(t, "width")) - 4 && Number(n(r, "height")) <= Number(n(t, "height")) ? {} : { fontSize: 0 };
72
+ }
73
+ function b(t, r, i) {
74
+ if (r.labels) return {
75
+ position: i,
76
+ show: !0,
77
+ ...e(t.theme),
78
+ color: i === "inside" && (r.kind !== "bar" || r.tone !== "muted") ? "#fff" : t.theme.textColor,
79
+ formatter: (e) => {
80
+ let i = n(r.data, Number(n(e, "dataIndex")));
81
+ return l(i) ? t.formatLabel(i) : "";
82
+ }
83
+ };
84
+ }
85
+ function x(e, t, r) {
86
+ let i = h(e, t);
87
+ if (t.kind === "bar") {
88
+ let o = a(t.stack) ? e.orientation === "horizontal" ? "right" : "top" : "inside";
89
+ return {
90
+ markLine: i,
91
+ type: "bar",
92
+ id: t.id,
93
+ name: t.name,
94
+ stack: t.stack,
95
+ barMaxWidth: f,
96
+ emphasis: { focus: "series" },
97
+ itemStyle: { color: t.color },
98
+ label: b(e, t, o),
99
+ labelLayout: o === "inside" ? y : { hideOverlap: !0 },
100
+ data: t.data.map((i, o) => {
101
+ let s = m(e, i, o);
102
+ return l(i) ? {
103
+ value: s,
104
+ itemStyle: {
105
+ borderRadius: n(r, [t.id, o]) ?? 0,
106
+ ...a(t.itemColors) ? {} : { color: t.itemColors[o] ?? t.color }
107
+ }
108
+ } : s;
109
+ })
110
+ };
111
+ }
112
+ let o = g(t), s = t.colorRanges.length > 0 && !o ? t.colorRanges[0]?.color ?? t.color : t.color;
113
+ return {
114
+ markLine: i,
115
+ type: "line",
116
+ id: t.id,
117
+ symbolSize: 6,
118
+ symbol: "circle",
119
+ name: t.name,
120
+ step: t.step,
121
+ stack: t.stack,
122
+ connectNulls: !1,
123
+ itemStyle: { color: s },
124
+ showSymbol: t.showPoints,
125
+ emphasis: { focus: "series" },
126
+ smooth: t.curve === "smooth",
127
+ label: b(e, t, "top"),
128
+ data: t.data.map((t, n) => m(e, t, n)),
129
+ areaStyle: t.area ? {
130
+ opacity: t.areaOpacity,
131
+ ...o ? {} : { color: s }
132
+ } : void 0,
133
+ lineStyle: {
134
+ ...o ? {} : { color: s },
135
+ width: e.sparkline ? 1.5 : 2,
136
+ type: t.dashed ? "dashed" : "solid"
137
+ }
138
+ };
139
+ }
140
+ function S(t) {
141
+ let { theme: n, sparkline: r, orientation: i } = t, o = !a(t.timestamps), s = Math.round(n.fontSize * 2.25), c = t.series.some((e) => e.kind === "bar"), l = t.series.some((e) => e.labels), f = d({
142
+ orientation: i,
143
+ xAxis: t.xAxis,
144
+ yAxis: t.yAxis
145
+ }), m = u({
146
+ orientation: i,
147
+ radius: t.radius,
148
+ series: t.series.filter((e) => e.kind === "bar")
149
+ }), h = f.categoryPosition === "y", { value: g, category: _ } = f, y = {
150
+ min: _.min,
151
+ max: _.max,
152
+ name: _.label,
153
+ axisTick: { show: !1 },
154
+ nameTextStyle: e(n),
155
+ show: !_.hidden && !r,
156
+ nameGap: h ? void 0 : s,
157
+ axisLine: { lineStyle: { color: n.axisColor } },
158
+ nameLocation: h ? "end" : "middle",
159
+ splitLine: {
160
+ show: _.grid && !r,
161
+ lineStyle: { color: n.gridColor }
162
+ },
163
+ axisLabel: {
164
+ ...e(n),
165
+ formatter: p(_, o ? "time" : "category")
166
+ }
167
+ }, b = o ? {
168
+ ...y,
169
+ inverse: h,
170
+ type: "time"
171
+ } : {
172
+ ...y,
173
+ inverse: h,
174
+ boundaryGap: c,
175
+ data: t.categories,
176
+ type: "category"
177
+ }, S = {
178
+ min: g.min,
179
+ max: g.max,
180
+ name: g.label,
181
+ type: "value",
182
+ axisLine: { show: !1 },
183
+ splitNumber: g.tickCount,
184
+ nameTextStyle: e(n),
185
+ show: !g.hidden && !r,
186
+ nameGap: h ? s : void 0,
187
+ nameLocation: h ? "middle" : "end",
188
+ axisLabel: {
189
+ ...e(n),
190
+ formatter: p(g, "value")
191
+ },
192
+ splitLine: {
193
+ show: g.grid && !r,
194
+ lineStyle: { color: n.gridColor }
195
+ }
196
+ }, C = h ? _.label : g.label, w = h ? g.label : _.label, T = l ? Math.round(n.fontSize * 1.5) : 0;
197
+ return {
198
+ animation: t.animation,
199
+ visualMap: v(t),
200
+ xAxis: h ? S : b,
201
+ yAxis: h ? b : S,
202
+ textStyle: {
203
+ fontSize: n.fontSize,
204
+ fontFamily: n.fontFamily
205
+ },
206
+ series: t.series.map((e) => x(t, e, m)),
207
+ tooltip: {
208
+ show: !0,
209
+ trigger: "axis",
210
+ showContent: !1,
211
+ axisPointer: {
212
+ type: c ? "shadow" : "line",
213
+ lineStyle: { color: n.axisColor },
214
+ shadowStyle: {
215
+ opacity: .5,
216
+ color: n.gridColor
217
+ }
218
+ }
219
+ },
220
+ grid: r ? {
221
+ left: 2,
222
+ right: 2,
223
+ bottom: 2,
224
+ top: 2 + T,
225
+ outerBoundsMode: "none"
226
+ } : {
227
+ left: 4,
228
+ outerBoundsMode: "same",
229
+ outerBoundsContain: "axisLabel",
230
+ bottom: a(w) ? 4 : s,
231
+ right: 12 + (h ? T * 2 : 0),
232
+ top: (a(C) ? 12 : s) + (h ? 0 : T)
233
+ }
234
+ };
235
+ }
236
+ function C(e, t) {
237
+ let i = n(e, "axesInfo"), c = r(i) ? n(i, [0, "value"]) : null;
238
+ return o(c) ? a(t.timestamps) ? c : s(t.timestamps, c) : null;
239
+ }
240
+ function w(e, t) {
241
+ return e.timestamps?.[t] ?? t;
242
+ }
243
+ var T = {
244
+ build: S,
245
+ getAnchor: (e, t, n) => E(e, t, n),
246
+ attach: (e, t, n) => {
247
+ e.on("updateAxisPointer", (e) => {
248
+ t(C(e, n()));
249
+ });
250
+ },
251
+ highlight: (e, t, n) => {
252
+ e.dispatchAction({ type: "downplay" }), a(n) || e.dispatchAction({
253
+ seriesId: n,
254
+ type: "highlight"
255
+ });
256
+ },
257
+ showActive: (e, t, n) => {
258
+ if (t.series.length !== 0) {
259
+ if (a(n)) {
260
+ e.dispatchAction({ type: "hideTip" });
261
+ return;
262
+ }
263
+ e.dispatchAction({
264
+ seriesIndex: 0,
265
+ type: "showTip",
266
+ dataIndex: n
267
+ });
268
+ }
269
+ }
270
+ };
271
+ function E(e, t, i) {
272
+ if (i < 0 || i >= t.categories.length) return null;
273
+ let a = t.orientation === "horizontal", s = w(t, i), u = e.convertToPixel(a ? { yAxisIndex: 0 } : { xAxisIndex: 0 }, s);
274
+ if (!o(u)) return null;
275
+ let d = c(t.series), f = t.series.flatMap((t) => {
276
+ let c = n(d, [t.id, i]);
277
+ if (!l(c)) return [];
278
+ let u = e.convertToPixel({ gridIndex: 0 }, a ? [c, s] : [s, c]), f = r(u) ? u[+!a] : null;
279
+ return o(f) ? [f] : [];
280
+ });
281
+ return a ? {
282
+ y: u,
283
+ x: f.length > 0 ? Math.max(...f) : t.width / 2
284
+ } : {
285
+ x: u,
286
+ y: f.length > 0 ? Math.min(...f) : t.height / 2
287
+ };
288
+ }
289
+ //#endregion
290
+ export { S as buildEchartsCartesianOption, T as echartsCartesianFamily };
@@ -0,0 +1,15 @@
1
+ import { FunnelSeriesOption } from 'echarts/charts';
2
+ import { TooltipComponentOption } from 'echarts/components';
3
+ import { ComposeOption } from 'echarts/core';
4
+ import { ChartFunnelRenderOptions, ChartHandle, ChartMountOptions } from '@bridge-ui/core/Domain';
5
+ type EChartsFunnelOption = ComposeOption<FunnelSeriesOption | TooltipComponentOption>;
6
+ /**
7
+ * Builds the ECharts option for a funnel plot. Stages arrive sorted, so
8
+ * the data index matches the keyboard order.
9
+ */
10
+ export declare function buildEchartsFunnelOption(options: ChartFunnelRenderOptions): EChartsFunnelOption;
11
+ /**
12
+ * Mounts a funnel plot (tree-shaken: funnel series only).
13
+ */
14
+ export declare function mountEchartsFunnel(options: ChartMountOptions<ChartFunnelRenderOptions>): ChartHandle<ChartFunnelRenderOptions>;
15
+ export {};