@bridge-ui/vue 0.18.0 → 0.20.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 (103) hide show
  1. package/ai/skills/bridge-ui-components/SKILL.md +35 -34
  2. package/ai/skills/bridge-ui-setup/SKILL.md +1 -1
  3. package/dist/Components/Autocomplete/composables/useAutocomplete.js +257 -265
  4. package/dist/Components/Calendar/composables/useCalendar.d.ts +1 -1
  5. package/dist/Components/Calendar/composables/useCalendar.js +192 -187
  6. package/dist/Components/CalendarMonth/composables/useCalendarMonth.d.ts +1 -1
  7. package/dist/Components/CalendarRange/composables/useCalendarRange.d.ts +1 -1
  8. package/dist/Components/CalendarRange/composables/useCalendarRange.js +243 -238
  9. package/dist/Components/ChartBar/ChartBar.vue_vue_type_script_setup_true_lang.js +5 -0
  10. package/dist/Components/ChartBar/chartBar.types.d.ts +11 -1
  11. package/dist/Components/ChartBar/composables/useChartBar.js +4 -4
  12. package/dist/Components/ChartBar/index.d.ts +1 -1
  13. package/dist/Components/ChartBarSeries/ChartBarSeries.vue_vue_type_script_setup_true_lang.js +4 -1
  14. package/dist/Components/ChartBarSeries/chartBarSeries.types.d.ts +24 -2
  15. package/dist/Components/ChartBarSeries/composables/useChartBarSeries.js +3 -0
  16. package/dist/Components/ChartBarSeries/index.d.ts +1 -0
  17. package/dist/Components/ChartFunnel/composables/useChartFunnel.js +10 -10
  18. package/dist/Components/ChartLine/ChartLine.vue_vue_type_script_setup_true_lang.js +1 -0
  19. package/dist/Components/ChartLine/chartLine.types.d.ts +7 -0
  20. package/dist/Components/ChartLine/composables/useChartLine.js +1 -1
  21. package/dist/Components/ChartLineSeries/ChartLineSeries.vue_vue_type_script_setup_true_lang.js +3 -0
  22. package/dist/Components/ChartLineSeries/chartLineSeries.types.d.ts +23 -2
  23. package/dist/Components/ChartLineSeries/composables/useChartLineSeries.js +3 -0
  24. package/dist/Components/ChartLineSeries/index.d.ts +1 -0
  25. package/dist/Components/ChartPie/ChartPie.vue_vue_type_script_setup_true_lang.js +3 -0
  26. package/dist/Components/ChartPie/chartPie.types.d.ts +20 -1
  27. package/dist/Components/ChartPie/composables/useChartPie.d.ts +1 -1
  28. package/dist/Components/ChartPie/composables/useChartPie.js +39 -29
  29. package/dist/Components/ChartScatter/composables/useChartScatter.js +63 -58
  30. package/dist/Components/ChartScatterSeries/ChartScatterSeries.vue_vue_type_script_setup_true_lang.js +1 -0
  31. package/dist/Components/ChartScatterSeries/chartScatterSeries.types.d.ts +8 -1
  32. package/dist/Components/ChartScatterSeries/composables/useChartScatterSeries.js +2 -1
  33. package/dist/Components/ChartScatterSeries/index.d.ts +1 -0
  34. package/dist/Components/ChartTooltip/ChartTooltip.vue_vue_type_script_setup_true_lang.js +11 -7
  35. package/dist/Components/ChartTooltip/chartTooltip.types.d.ts +4 -0
  36. package/dist/Components/ChartTooltip/composables/useChartTooltip.d.ts +1 -0
  37. package/dist/Components/ChartTooltip/composables/useChartTooltip.js +4 -0
  38. package/dist/Components/DataTable/DataTableColumnsMenu.vue.d.ts +1 -2
  39. package/dist/Components/DataTable/composables/useDataTable.d.ts +8 -66
  40. package/dist/Components/DataTable/composables/useDataTable.js +267 -349
  41. package/dist/Components/DataTable/composables/useDataTableColumnsMenu.d.ts +1 -2
  42. package/dist/Components/Heading/Heading.js +5 -0
  43. package/dist/Components/Heading/Heading.vue.d.ts +11 -0
  44. package/dist/Components/Heading/Heading.vue_vue_type_script_setup_true_lang.js +29 -0
  45. package/dist/Components/Heading/composables/useHeading.d.ts +10 -0
  46. package/dist/Components/Heading/composables/useHeading.js +56 -0
  47. package/dist/Components/Heading/heading.types.d.ts +56 -0
  48. package/dist/Components/Heading/index.d.ts +3 -0
  49. package/dist/Components/Heading/index.js +3 -0
  50. package/dist/Components/ListItem/composables/useListItem.js +29 -30
  51. package/dist/Components/Listbox/composables/useListboxNavigation.d.ts +0 -5
  52. package/dist/Components/Listbox/composables/useListboxNavigation.js +23 -50
  53. package/dist/Components/Listbox/index.d.ts +1 -1
  54. package/dist/Components/Listbox/index.js +5 -5
  55. package/dist/Components/ResizablePanel/composables/useResizablePanel.d.ts +1 -1
  56. package/dist/Components/RichTextEditor/composables/useRichTextEditor.js +31 -31
  57. package/dist/Components/Select/composables/useSelect.js +201 -211
  58. package/dist/Components/Slider/composables/useSlider.js +93 -122
  59. package/dist/Components/Text/Text.js +5 -0
  60. package/dist/Components/Text/Text.vue.d.ts +11 -0
  61. package/dist/Components/Text/Text.vue_vue_type_script_setup_true_lang.js +33 -0
  62. package/dist/Components/Text/composables/useText.d.ts +9 -0
  63. package/dist/Components/Text/composables/useText.js +56 -0
  64. package/dist/Components/Text/index.d.ts +3 -0
  65. package/dist/Components/Text/index.js +3 -0
  66. package/dist/Components/Text/text.types.d.ts +76 -0
  67. package/dist/Utils/Charts/chart.types.d.ts +17 -0
  68. package/dist/Utils/Charts/chartInjectionKey.d.ts +2 -2
  69. package/dist/Utils/Charts/index.d.ts +1 -1
  70. package/dist/Utils/Charts/useChartCartesian.d.ts +4 -2
  71. package/dist/Utils/Charts/useChartCartesian.js +90 -76
  72. package/dist/augments.d.ts +10 -0
  73. package/dist/index.d.ts +5 -1
  74. package/dist/index.js +175 -171
  75. package/docs/README.md +2 -0
  76. package/docs/components/BridgeUIProvider.md +1 -1
  77. package/docs/components/Card.md +15 -0
  78. package/docs/components/Chart.md +17 -10
  79. package/docs/components/ChartBar.md +70 -17
  80. package/docs/components/ChartLine.md +57 -16
  81. package/docs/components/ChartPie.md +33 -10
  82. package/docs/components/ChartScatter.md +25 -7
  83. package/docs/components/Heading.md +85 -0
  84. package/docs/components/Text.md +118 -0
  85. package/package.json +2 -2
  86. package/dist/Components/RichTextEditor/tiptapEditor.d.ts +0 -111
  87. package/dist/Components/RichTextEditor/tiptapEditor.js +0 -121
  88. package/dist/Utils/Charts/echarts/bar.d.ts +0 -6
  89. package/dist/Utils/Charts/echarts/bar.js +0 -22
  90. package/dist/Utils/Charts/echarts/cartesian.d.ts +0 -15
  91. package/dist/Utils/Charts/echarts/cartesian.js +0 -255
  92. package/dist/Utils/Charts/echarts/funnel.d.ts +0 -15
  93. package/dist/Utils/Charts/echarts/funnel.js +0 -79
  94. package/dist/Utils/Charts/echarts/line.d.ts +0 -5
  95. package/dist/Utils/Charts/echarts/line.js +0 -19
  96. package/dist/Utils/Charts/echarts/part.d.ts +0 -19
  97. package/dist/Utils/Charts/echarts/part.js +0 -45
  98. package/dist/Utils/Charts/echarts/pie.d.ts +0 -14
  99. package/dist/Utils/Charts/echarts/pie.js +0 -75
  100. package/dist/Utils/Charts/echarts/plot.d.ts +0 -44
  101. package/dist/Utils/Charts/echarts/plot.js +0 -52
  102. package/dist/Utils/Charts/echarts/scatter.d.ts +0 -14
  103. package/dist/Utils/Charts/echarts/scatter.js +0 -152
@@ -1,22 +0,0 @@
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 } from "echarts/components";
5
- import { use as s } from "echarts/core";
6
- import { LabelLayout as c } from "echarts/features";
7
- import { SVGRenderer as l } from "echarts/renderers";
8
- //#region src/Utils/Charts/echarts/bar.ts
9
- s([
10
- n,
11
- r,
12
- c,
13
- i,
14
- l,
15
- o,
16
- a
17
- ]);
18
- function u(n) {
19
- return e(n, t);
20
- }
21
- //#endregion
22
- export { u as mountEchartsBar };
@@ -1,15 +0,0 @@
1
- import { BarSeriesOption, LineSeriesOption } from 'echarts/charts';
2
- import { GridComponentOption, MarkLineComponentOption, TooltipComponentOption } 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>;
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 {};
@@ -1,255 +0,0 @@
1
- import { labelStyle as e } from "./plot.js";
2
- import { get as t, isArray as n, isNil as r, isNumber as i } from "es-toolkit/compat";
3
- import { getChartNearestIndex as a, getChartStackEnds as o, isChartValue as s, resolveChartBarRadii as c, resolveChartCartesianAxes as l } from "@bridge-ui/core/Domain";
4
- //#region src/Utils/Charts/echarts/cartesian.ts
5
- var u = .15, d = 32;
6
- function f(e, t) {
7
- let n = e.formatTick, i = e.formatCategory;
8
- return t === "category" ? r(i) ? void 0 : (e) => i(String(e)) : r(n) ? void 0 : (e) => n(Number(e));
9
- }
10
- function p(e, t, n) {
11
- let i = e.timestamps?.[n];
12
- return r(i) ? t : e.orientation === "horizontal" ? [t, i] : [i, t];
13
- }
14
- function m(n, r) {
15
- if (r.reference.length === 0) return;
16
- let i = n.orientation === "horizontal" ? "xAxis" : "yAxis", a = (r) => ({
17
- ...e(n.theme),
18
- position: "insideEndTop",
19
- formatter: (e) => r.label ?? n.formatLabel(Number(t(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 h(e) {
40
- let n = t(e, "rect"), r = t(e, "labelRect");
41
- return Number(t(r, "width")) <= Number(t(n, "width")) - 4 && Number(t(r, "height")) <= Number(t(n, "height")) ? {} : { fontSize: 0 };
42
- }
43
- function g(n, r, i) {
44
- if (r.labels) return {
45
- position: i,
46
- show: !0,
47
- ...e(n.theme),
48
- color: i === "inside" ? "#fff" : n.theme.textColor,
49
- formatter: (e) => {
50
- let i = t(r.data, Number(t(e, "dataIndex")));
51
- return s(i) ? n.formatLabel(i) : "";
52
- }
53
- };
54
- }
55
- function _(e, n, i) {
56
- let a = m(e, n);
57
- if (n.kind === "bar") {
58
- let o = r(n.stack) ? e.orientation === "horizontal" ? "right" : "top" : "inside";
59
- return {
60
- markLine: a,
61
- type: "bar",
62
- id: n.id,
63
- name: n.name,
64
- stack: n.stack,
65
- barMaxWidth: d,
66
- emphasis: { focus: "series" },
67
- itemStyle: { color: n.color },
68
- label: g(e, n, o),
69
- labelLayout: o === "inside" ? h : { hideOverlap: !0 },
70
- data: n.data.map((r, a) => {
71
- let o = p(e, r, a);
72
- return s(r) ? {
73
- value: o,
74
- itemStyle: { borderRadius: t(i, [n.id, a]) ?? 0 }
75
- } : o;
76
- })
77
- };
78
- }
79
- return {
80
- markLine: a,
81
- type: "line",
82
- id: n.id,
83
- symbolSize: 6,
84
- symbol: "circle",
85
- name: n.name,
86
- step: n.step,
87
- stack: n.stack,
88
- connectNulls: !1,
89
- showSymbol: n.showPoints,
90
- emphasis: { focus: "series" },
91
- smooth: n.curve === "smooth",
92
- itemStyle: { color: n.color },
93
- label: g(e, n, "top"),
94
- areaStyle: n.area ? {
95
- color: n.color,
96
- opacity: u
97
- } : void 0,
98
- data: n.data.map((t, n) => p(e, t, n)),
99
- lineStyle: {
100
- color: n.color,
101
- width: e.sparkline ? 1.5 : 2,
102
- type: n.dashed ? "dashed" : "solid"
103
- }
104
- };
105
- }
106
- function v(t) {
107
- let { theme: n, sparkline: i, orientation: a } = t, o = !r(t.timestamps), s = Math.round(n.fontSize * 2.25), u = t.series.some((e) => e.kind === "bar"), d = t.series.some((e) => e.labels), p = l({
108
- orientation: a,
109
- xAxis: t.xAxis,
110
- yAxis: t.yAxis
111
- }), m = c({
112
- orientation: a,
113
- radius: t.radius,
114
- series: t.series.filter((e) => e.kind === "bar")
115
- }), h = p.categoryPosition === "y", { value: g, category: v } = p, y = {
116
- min: v.min,
117
- max: v.max,
118
- name: v.label,
119
- axisTick: { show: !1 },
120
- nameTextStyle: e(n),
121
- show: !v.hidden && !i,
122
- nameGap: h ? void 0 : s,
123
- axisLine: { lineStyle: { color: n.axisColor } },
124
- nameLocation: h ? "end" : "middle",
125
- splitLine: {
126
- show: v.grid && !i,
127
- lineStyle: { color: n.gridColor }
128
- },
129
- axisLabel: {
130
- ...e(n),
131
- formatter: f(v, o ? "time" : "category")
132
- }
133
- }, b = o ? {
134
- ...y,
135
- inverse: h,
136
- type: "time"
137
- } : {
138
- ...y,
139
- inverse: h,
140
- boundaryGap: u,
141
- data: t.categories,
142
- type: "category"
143
- }, x = {
144
- min: g.min,
145
- max: g.max,
146
- name: g.label,
147
- type: "value",
148
- axisLine: { show: !1 },
149
- splitNumber: g.tickCount,
150
- nameTextStyle: e(n),
151
- show: !g.hidden && !i,
152
- nameGap: h ? s : void 0,
153
- nameLocation: h ? "middle" : "end",
154
- axisLabel: {
155
- ...e(n),
156
- formatter: f(g, "value")
157
- },
158
- splitLine: {
159
- show: g.grid && !i,
160
- lineStyle: { color: n.gridColor }
161
- }
162
- }, S = h ? v.label : g.label, C = h ? g.label : v.label, w = d ? Math.round(n.fontSize * 1.5) : 0;
163
- return {
164
- animation: t.animation,
165
- xAxis: h ? x : b,
166
- yAxis: h ? b : x,
167
- textStyle: {
168
- fontSize: n.fontSize,
169
- fontFamily: n.fontFamily
170
- },
171
- series: t.series.map((e) => _(t, e, m)),
172
- tooltip: {
173
- show: !0,
174
- trigger: "axis",
175
- showContent: !1,
176
- axisPointer: {
177
- type: u ? "shadow" : "line",
178
- lineStyle: { color: n.axisColor },
179
- shadowStyle: {
180
- opacity: .5,
181
- color: n.gridColor
182
- }
183
- }
184
- },
185
- grid: i ? {
186
- left: 2,
187
- right: 2,
188
- bottom: 2,
189
- top: 2 + w,
190
- outerBoundsMode: "none"
191
- } : {
192
- left: 4,
193
- outerBoundsMode: "same",
194
- outerBoundsContain: "axisLabel",
195
- bottom: r(C) ? 4 : s,
196
- right: 12 + (h ? w * 2 : 0),
197
- top: (r(S) ? 12 : s) + (h ? 0 : w)
198
- }
199
- };
200
- }
201
- function y(e, o) {
202
- let s = t(e, "axesInfo"), c = n(s) ? t(s, [0, "value"]) : null;
203
- return i(c) ? r(o.timestamps) ? c : a(o.timestamps, c) : null;
204
- }
205
- function b(e, t) {
206
- return e.timestamps?.[t] ?? t;
207
- }
208
- var x = {
209
- build: v,
210
- getAnchor: (e, t, n) => S(e, t, n),
211
- attach: (e, t, n) => {
212
- e.on("updateAxisPointer", (e) => {
213
- t(y(e, n()));
214
- });
215
- },
216
- highlight: (e, t, n) => {
217
- e.dispatchAction({ type: "downplay" }), r(n) || e.dispatchAction({
218
- seriesId: n,
219
- type: "highlight"
220
- });
221
- },
222
- showActive: (e, t, n) => {
223
- if (t.series.length !== 0) {
224
- if (r(n)) {
225
- e.dispatchAction({ type: "hideTip" });
226
- return;
227
- }
228
- e.dispatchAction({
229
- seriesIndex: 0,
230
- type: "showTip",
231
- dataIndex: n
232
- });
233
- }
234
- }
235
- };
236
- function S(e, r, a) {
237
- if (a < 0 || a >= r.categories.length) return null;
238
- let c = r.orientation === "horizontal", l = b(r, a), u = e.convertToPixel(c ? { yAxisIndex: 0 } : { xAxisIndex: 0 }, l);
239
- if (!i(u)) return null;
240
- let d = o(r.series), f = r.series.flatMap((r) => {
241
- let o = t(d, [r.id, a]);
242
- if (!s(o)) return [];
243
- let u = e.convertToPixel({ gridIndex: 0 }, c ? [o, l] : [l, o]), f = n(u) ? u[+!c] : null;
244
- return i(f) ? [f] : [];
245
- });
246
- return c ? {
247
- y: u,
248
- x: f.length > 0 ? Math.max(...f) : r.width / 2
249
- } : {
250
- x: u,
251
- y: f.length > 0 ? Math.min(...f) : r.height / 2
252
- };
253
- }
254
- //#endregion
255
- export { v as buildEchartsCartesianOption, x as echartsCartesianFamily };
@@ -1,15 +0,0 @@
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 {};
@@ -1,79 +0,0 @@
1
- import { labelStyle as e, mountEchartsPlot as t, readItemLayout as n } from "./plot.js";
2
- import { createEchartsPartFamily as r, formatSliceLabel as i } from "./part.js";
3
- import { get as a, isArray as o, isNumber as s } from "es-toolkit/compat";
4
- import { FunnelChart as c } from "echarts/charts";
5
- import { TooltipComponent as l } from "echarts/components";
6
- import { use as u } from "echarts/core";
7
- import { SVGRenderer as d } from "echarts/renderers";
8
- //#region src/Utils/Charts/echarts/funnel.ts
9
- u([
10
- c,
11
- d,
12
- l
13
- ]);
14
- function f(e) {
15
- return !e.labels || e.labelPosition !== "outside" ? {
16
- left: "4%",
17
- width: "92%"
18
- } : {
19
- width: "60%",
20
- left: e.align === "right" ? "36%" : "4%"
21
- };
22
- }
23
- function p(t) {
24
- let { theme: n, labels: r, slices: a, labelPosition: o } = t, s = r && o === "outside", c = t.align === "right" ? "left" : "right", l = {
25
- show: r,
26
- ...e(n),
27
- formatter: i(a),
28
- color: s ? n.textColor : "#fff",
29
- position: s ? c : "inside"
30
- };
31
- return {
32
- animation: t.animation,
33
- tooltip: {
34
- show: !0,
35
- trigger: "item",
36
- showContent: !1
37
- },
38
- textStyle: {
39
- fontSize: n.fontSize,
40
- fontFamily: n.fontFamily
41
- },
42
- series: [{
43
- label: l,
44
- gap: 2,
45
- top: 4,
46
- bottom: 4,
47
- sort: "none",
48
- type: "funnel",
49
- ...f(t),
50
- emphasis: { label: l },
51
- funnelAlign: t.align,
52
- labelLine: {
53
- show: s,
54
- lineStyle: { color: n.axisColor }
55
- },
56
- data: a.map((e) => ({
57
- id: e.id,
58
- name: e.label,
59
- value: e.value,
60
- itemStyle: { color: e.color }
61
- }))
62
- }]
63
- };
64
- }
65
- function m(e, t) {
66
- let r = a(n(e, t), "points");
67
- if (!o(r) || r.length < 2) return null;
68
- let [i, c] = r, l = a(i, 0), u = a(c, 0), d = a(i, 1);
69
- return !s(l) || !s(u) || !s(d) ? null : {
70
- y: d,
71
- x: (l + u) / 2
72
- };
73
- }
74
- var h = r(p, m);
75
- function g(e) {
76
- return t(e, h);
77
- }
78
- //#endregion
79
- export { p as buildEchartsFunnelOption, g as mountEchartsFunnel };
@@ -1,5 +0,0 @@
1
- import { ChartCartesianRenderOptions, ChartHandle, ChartMountOptions } from '@bridge-ui/core/Domain';
2
- /**
3
- * Mounts a line plot (tree-shaken: line series only).
4
- */
5
- export declare function mountEchartsLine(options: ChartMountOptions<ChartCartesianRenderOptions>): ChartHandle<ChartCartesianRenderOptions>;
@@ -1,19 +0,0 @@
1
- import { mountEchartsPlot as e } from "./plot.js";
2
- import { echartsCartesianFamily as t } from "./cartesian.js";
3
- import { LineChart as n } from "echarts/charts";
4
- import { GridComponent as r, MarkLineComponent as i, TooltipComponent as a } from "echarts/components";
5
- import { use as o } from "echarts/core";
6
- import { SVGRenderer as s } from "echarts/renderers";
7
- //#region src/Utils/Charts/echarts/line.ts
8
- o([
9
- n,
10
- r,
11
- s,
12
- a,
13
- i
14
- ]);
15
- function c(n) {
16
- return e(n, t);
17
- }
18
- //#endregion
19
- export { c as mountEchartsLine };
@@ -1,19 +0,0 @@
1
- import { ECharts } from 'echarts/core';
2
- import { ChartAnchor, ChartBaseRenderOptions, ChartPartRenderSlice } from '@bridge-ui/core/Domain';
3
- import { EchartsPlotFamily } from './plot';
4
- /**
5
- * Render options with slices (pie, funnel).
6
- */
7
- type PartOptions = ChartBaseRenderOptions & {
8
- slices: ChartPartRenderSlice[];
9
- };
10
- /**
11
- * Plot label formatter: the precomputed text of each slice.
12
- */
13
- export declare function formatSliceLabel(slices: ChartPartRenderSlice[]): (params: unknown) => string;
14
- /**
15
- * Item-trigger pieces shared by pie and funnel plots: one series whose data
16
- * index is the active index.
17
- */
18
- export declare function createEchartsPartFamily<Options extends PartOptions>(build: EchartsPlotFamily<Options>["build"], getAnchor: (chart: ECharts, index: number) => null | ChartAnchor): EchartsPlotFamily<Options>;
19
- export {};
@@ -1,45 +0,0 @@
1
- import { get as e, isNil as t, isNumber as n } from "es-toolkit/compat";
2
- //#region src/Utils/Charts/echarts/part.ts
3
- function r(e, n) {
4
- e.dispatchAction({
5
- seriesIndex: 0,
6
- type: "downplay"
7
- }), !t(n) && n >= 0 && e.dispatchAction({
8
- seriesIndex: 0,
9
- dataIndex: n,
10
- type: "highlight"
11
- });
12
- }
13
- function i(t) {
14
- return (n) => e(t, [Number(e(n, "dataIndex")), "labelText"]) ?? "";
15
- }
16
- function a(i, a) {
17
- return {
18
- build: i,
19
- getAnchor: (e, t, n) => n < 0 || n >= t.slices.length ? null : a(e, n),
20
- highlight: (e, n, i) => {
21
- r(e, t(i) ? null : n.slices.findIndex((e) => e.id === i));
22
- },
23
- attach: (t, r) => {
24
- t.on("mouseover", (t) => {
25
- let i = e(t, "dataIndex");
26
- r(n(i) ? i : null);
27
- }), t.on("mouseout", () => {
28
- r(null);
29
- });
30
- },
31
- showActive: (e, n, i) => {
32
- if (r(e, i), t(i)) {
33
- e.dispatchAction({ type: "hideTip" });
34
- return;
35
- }
36
- e.dispatchAction({
37
- seriesIndex: 0,
38
- type: "showTip",
39
- dataIndex: i
40
- });
41
- }
42
- };
43
- }
44
- //#endregion
45
- export { a as createEchartsPartFamily, i as formatSliceLabel };
@@ -1,14 +0,0 @@
1
- import { PieSeriesOption } from 'echarts/charts';
2
- import { TooltipComponentOption } from 'echarts/components';
3
- import { ComposeOption } from 'echarts/core';
4
- import { ChartHandle, ChartMountOptions, ChartPieRenderOptions } from '@bridge-ui/core/Domain';
5
- type EChartsPieOption = ComposeOption<PieSeriesOption | TooltipComponentOption>;
6
- /**
7
- * Builds the ECharts option for a pie or donut plot.
8
- */
9
- export declare function buildEchartsPieOption(options: ChartPieRenderOptions): EChartsPieOption;
10
- /**
11
- * Mounts a pie / donut plot (tree-shaken: pie series only).
12
- */
13
- export declare function mountEchartsPie(options: ChartMountOptions<ChartPieRenderOptions>): ChartHandle<ChartPieRenderOptions>;
14
- export {};
@@ -1,75 +0,0 @@
1
- import { labelStyle as e, mountEchartsPlot as t, readItemLayout as n } from "./plot.js";
2
- import { createEchartsPartFamily as r, formatSliceLabel as i } from "./part.js";
3
- import { get as a, isNumber as o } from "es-toolkit/compat";
4
- import { PieChart as s } from "echarts/charts";
5
- import { TooltipComponent as c } from "echarts/components";
6
- import { use as l } from "echarts/core";
7
- import { SVGRenderer as u } from "echarts/renderers";
8
- //#region src/Utils/Charts/echarts/pie.ts
9
- l([
10
- s,
11
- u,
12
- c
13
- ]);
14
- var d = 70, f = 92;
15
- function p(t) {
16
- let { theme: n, labels: r, slices: a, labelPosition: o } = t, s = r && o === "outside", c = s ? d : f, l = t.variant === "donut", u = Math.min(1, Math.max(0, t.thickness)), p = l ? Math.round(c * (1 - u)) : 0, m = {
17
- show: r,
18
- ...e(n),
19
- formatter: i(a),
20
- color: s ? n.textColor : "#fff",
21
- position: s ? "outside" : "inside"
22
- };
23
- return {
24
- animation: t.animation,
25
- tooltip: {
26
- show: !0,
27
- trigger: "item",
28
- showContent: !1
29
- },
30
- textStyle: {
31
- fontSize: n.fontSize,
32
- fontFamily: n.fontFamily
33
- },
34
- series: [{
35
- label: m,
36
- type: "pie",
37
- center: ["50%", "50%"],
38
- avoidLabelOverlap: !0,
39
- minAngle: t.minAngle,
40
- radius: [`${p}%`, `${c}%`],
41
- itemStyle: { borderRadius: l ? 2 : 0 },
42
- padAngle: l && a.length > 1 ? 1 : 0,
43
- emphasis: {
44
- label: m,
45
- scale: !0,
46
- scaleSize: 4
47
- },
48
- labelLine: {
49
- show: s,
50
- lineStyle: { color: n.axisColor }
51
- },
52
- data: a.map((e) => ({
53
- id: e.id,
54
- name: e.label,
55
- value: e.value,
56
- itemStyle: { color: e.color }
57
- }))
58
- }]
59
- };
60
- }
61
- function m(e, t) {
62
- let r = n(e, t), i = a(r, "cx"), s = a(r, "cy"), c = a(r, "r"), l = a(r, "startAngle"), u = a(r, "endAngle");
63
- if (!o(i) || !o(s) || !o(c) || !o(l) || !o(u)) return null;
64
- let d = (l + u) / 2;
65
- return {
66
- x: i + c * Math.cos(d),
67
- y: s + c * Math.sin(d)
68
- };
69
- }
70
- var h = r(p, m);
71
- function g(e) {
72
- return t(e, h);
73
- }
74
- //#endregion
75
- export { p as buildEchartsPieOption, g as mountEchartsPie };
@@ -1,44 +0,0 @@
1
- import { ECharts, EChartsCoreOption } from 'echarts/core';
2
- import { ChartAnchor, ChartBaseRenderOptions, ChartHandle, ChartMountOptions, ChartRenderTheme } from '@bridge-ui/core/Domain';
3
- /**
4
- * Family-specific pieces of a plot.
5
- */
6
- export type EchartsPlotFamily<Options extends ChartBaseRenderOptions> = {
7
- /**
8
- * Wires pointer events to `emit` (the active index, `null` on leave).
9
- */
10
- attach: (chart: ECharts, emit: (index: null | number) => void, getOptions: () => Options) => void;
11
- /**
12
- * Builds the ECharts option.
13
- */
14
- build: (options: Options) => EChartsCoreOption;
15
- /**
16
- * Tooltip anchor for the item at `index`.
17
- */
18
- getAnchor: (chart: ECharts, options: Options, index: number) => null | ChartAnchor;
19
- /**
20
- * Emphasizes a legend item (`null` clears).
21
- */
22
- highlight: (chart: ECharts, options: Options, id: null | string) => void;
23
- /**
24
- * Shows the pointer for keyboard navigation (`null` clears).
25
- */
26
- showActive: (chart: ECharts, options: Options, index: null | number) => void;
27
- };
28
- /**
29
- * Label style shared by axes and plot labels.
30
- */
31
- export declare function labelStyle(theme: ChartRenderTheme): {
32
- color: string;
33
- fontSize: number;
34
- fontFamily: string;
35
- };
36
- /**
37
- * Item layout computed by ECharts for a single-series plot (pie slice
38
- * sector, funnel trapezoid). Reads the internal model; `null` when missing.
39
- */
40
- export declare function readItemLayout(chart: ECharts, dataIndex: number): null | Record<string, unknown>;
41
- /**
42
- * Mounts a plot into `options.element` and returns its handle.
43
- */
44
- export declare function mountEchartsPlot<Options extends ChartBaseRenderOptions>(options: ChartMountOptions<Options>, family: EchartsPlotFamily<Options>): ChartHandle<Options>;
@@ -1,52 +0,0 @@
1
- import { get as e, isFunction as t, isNil as n } from "es-toolkit/compat";
2
- import { init as r } from "echarts/core";
3
- //#region src/Utils/Charts/echarts/plot.ts
4
- function i(e) {
5
- return {
6
- color: e.textColor,
7
- fontSize: e.fontSize,
8
- fontFamily: e.fontFamily
9
- };
10
- }
11
- function a(r, i) {
12
- let a = e(r, "getModel");
13
- if (!t(a)) return null;
14
- let o = a.call(r)?.getSeriesByIndex?.(0)?.getData?.()?.getItemLayout?.(i);
15
- return n(o) ? null : o;
16
- }
17
- function o(e, t) {
18
- let i = e, a = null, o = null, s = !1, c = (t) => {
19
- s || t === o || (o = t, e.onActiveIndexChange(t));
20
- }, l = () => n(a) ? i.width <= 0 || i.height <= 0 ? null : (a = r(e.element, null, {
21
- renderer: "svg",
22
- width: i.width,
23
- height: i.height
24
- }), t.attach(a, c, () => i), a.getZr().on("globalout", () => {
25
- c(null);
26
- }), a) : a, u = () => {
27
- let e = l();
28
- if (n(e)) return;
29
- let { width: r, height: a } = i;
30
- (e.getWidth() !== r || e.getHeight() !== a) && e.resize({
31
- width: r,
32
- height: a
33
- }), e.setOption(t.build(i), { replaceMerge: ["series"] });
34
- };
35
- return u(), {
36
- update: (e) => {
37
- i = e, u();
38
- },
39
- destroy: () => {
40
- a?.dispose(), a = null;
41
- },
42
- getAnchor: (e) => n(a) ? null : t.getAnchor(a, i, e),
43
- highlight: (e) => {
44
- n(a) || t.highlight(a, i, e);
45
- },
46
- setActiveIndex: (e) => {
47
- n(a) || (s = !0, o = e, t.showActive(a, i, e), s = !1);
48
- }
49
- };
50
- }
51
- //#endregion
52
- export { i as labelStyle, o as mountEchartsPlot, a as readItemLayout };
@@ -1,14 +0,0 @@
1
- import { ScatterSeriesOption } from 'echarts/charts';
2
- import { GridComponentOption, TooltipComponentOption } from 'echarts/components';
3
- import { ComposeOption } from 'echarts/core';
4
- import { ChartHandle, ChartMountOptions, ChartScatterRenderOptions } from '@bridge-ui/core/Domain';
5
- type EChartsScatterOption = ComposeOption<GridComponentOption | ScatterSeriesOption | TooltipComponentOption>;
6
- /**
7
- * Builds the ECharts option for a scatter plot.
8
- */
9
- export declare function buildEchartsScatterOption(options: ChartScatterRenderOptions): EChartsScatterOption;
10
- /**
11
- * Mounts a scatter plot (tree-shaken: scatter series only).
12
- */
13
- export declare function mountEchartsScatter(options: ChartMountOptions<ChartScatterRenderOptions>): ChartHandle<ChartScatterRenderOptions>;
14
- export {};