@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
@@ -1,52 +0,0 @@
1
- import { useChart as e } from "./composables/useChart.js";
2
- import t from "../../Utils/LoadingSpin.js";
3
- import { Fragment as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, createVNode as s, defineComponent as c, guardReactiveProps as l, mergeProps as u, normalizeProps as d, openBlock as f, renderList as p, renderSlot as m, toDisplayString as h, unref as g, useTemplateRef as _ } from "vue";
4
- //#region src/Components/Chart/Chart.vue?vue&type=script&setup=true&lang.ts
5
- var v = { scope: "col" }, y = { scope: "row" }, b = /*@__PURE__*/ c({
6
- inheritAttrs: !1,
7
- __name: "Chart",
8
- props: {
9
- animation: {
10
- type: Boolean,
11
- default: void 0
12
- },
13
- categories: {},
14
- classes: {},
15
- customProps: {},
16
- height: {},
17
- loading: {
18
- type: Boolean,
19
- default: !1
20
- },
21
- palette: {},
22
- size: {},
23
- summary: {},
24
- width: {}
25
- },
26
- setup(c) {
27
- let b = c, x = _("root"), S = _("plot"), C = _("host"), { table: w, isEmpty: T, hostBind: E, plotBind: D, rootBind: O, liveBind: k, emptyBind: A, isLoading: j, tableBind: M, loadingBind: N, announcement: P, emptyMessage: F } = e(b, {
28
- size: "md",
29
- height: 280,
30
- animation: !0
31
- }, {
32
- hostRef: C,
33
- plotRef: S,
34
- rootRef: x
35
- });
36
- return (e, c) => (f(), i("div", u({ ref: "root" }, g(O)), [
37
- a("div", u({ ref: "plot" }, g(D)), [
38
- a("div", u({ ref: "host" }, g(E)), null, 16),
39
- g(j) ? (f(), i("div", d(u({ key: 0 }, g(N))), [m(e.$slots, "loading", {}, () => [s(t)])], 16)) : r("", !0),
40
- g(T) ? (f(), i("div", d(u({ key: 1 }, g(A))), [m(e.$slots, "empty", {}, () => [o(h(g(F)), 1)])], 16)) : r("", !0)
41
- ], 16),
42
- m(e.$slots, "default"),
43
- a("table", d(l(g(M))), [a("thead", null, [a("tr", null, [a("th", v, h(g(w).categoryLabel), 1), (f(!0), i(n, null, p(g(w).series, (e) => (f(), i("th", {
44
- scope: "col",
45
- key: e.id
46
- }, h(e.name), 1))), 128))])]), a("tbody", null, [(f(!0), i(n, null, p(g(w).rows, (e) => (f(), i("tr", { key: e.category }, [a("th", y, h(e.category), 1), (f(!0), i(n, null, p(e.values, (e, t) => (f(), i("td", { key: g(w).series[t]?.id ?? t }, h(e), 1))), 128))]))), 128))])], 16),
47
- a("div", d(l(g(k))), h(g(P)), 17)
48
- ], 16));
49
- }
50
- });
51
- //#endregion
52
- export { b as default };
@@ -1,94 +0,0 @@
1
- import { ComputedRef, InjectionKey } from 'vue';
2
- import { ChartAnchor, ChartAxisPosition, ChartRenderAxis, ChartSeriesEntry, ChartTooltipItem } from '@bridge-ui/core/Domain';
3
- /**
4
- * Registered series with its resolved color and legend visibility.
5
- */
6
- export type ChartResolvedSeries = ChartSeriesEntry & {
7
- /**
8
- * Whether the series is hidden from the legend toggle.
9
- */
10
- hidden: boolean;
11
- /**
12
- * Computed CSS color (empty until the first layout pass).
13
- */
14
- resolvedColor: string;
15
- };
16
- /**
17
- * Shared chart state for `ChartSeries` / `ChartAxis` / `ChartLegend` /
18
- * `ChartTooltip` descendants.
19
- */
20
- export type ChartContextValue = {
21
- /**
22
- * Active category index (pointer or keyboard). `null` when idle.
23
- */
24
- activeIndex: null | number;
25
- /**
26
- * Category labels.
27
- */
28
- categories: string[];
29
- /**
30
- * Root size (px) used to keep the tooltip inside the chart.
31
- */
32
- getBounds: () => {
33
- height: number;
34
- width: number;
35
- };
36
- /**
37
- * Tooltip anchor for a category, relative to the chart root.
38
- */
39
- getTooltipAnchor: (index: number) => null | ChartAnchor;
40
- /**
41
- * Emphasizes one series in the plot. `null` clears it.
42
- */
43
- highlightSeries: (id: null | string) => void;
44
- /**
45
- * Stable id prefix for chart parts.
46
- */
47
- id: string;
48
- /**
49
- * Locale used to format values.
50
- */
51
- locale: string;
52
- /**
53
- * Removes axis options registered by `ChartAxis`.
54
- */
55
- removeAxis: (position: ChartAxisPosition) => void;
56
- /**
57
- * Removes a series by id.
58
- */
59
- removeSeries: (id: string) => void;
60
- /**
61
- * Registered series in mount order, with colors and visibility.
62
- */
63
- series: ChartResolvedSeries[];
64
- /**
65
- * Sets axis options (no-op when unchanged).
66
- */
67
- setAxis: (position: ChartAxisPosition, options: Partial<ChartRenderAxis>) => void;
68
- /**
69
- * Shows / hides a series by id.
70
- */
71
- toggleSeries: (id: string) => void;
72
- /**
73
- * Merged size token classes for legend and tooltip.
74
- */
75
- tokenClasses: {
76
- legend?: string;
77
- legendItem?: string;
78
- swatch?: string;
79
- tooltip?: string;
80
- };
81
- /**
82
- * Tooltip rows for `activeIndex` (visible series, non-null values).
83
- */
84
- tooltipItems: ChartTooltipItem[];
85
- /**
86
- * Adds or replaces a series by `id`, keeping its position (no-op when unchanged).
87
- */
88
- upsertSeries: (entry: ChartSeriesEntry) => void;
89
- };
90
- export declare const CHART_INJECTION_KEY: InjectionKey<ComputedRef<ChartContextValue>>;
91
- /**
92
- * Injects the nearest `Chart` context. Throws when used outside `Chart`.
93
- */
94
- export declare function useChartContext(): ComputedRef<ChartContextValue>;
@@ -1,40 +0,0 @@
1
- import { HTMLAttributes, Ref } from 'vue';
2
- import { LibDefaultsShape, MergeLibDefaults } from '@bridge-ui/core/Utils';
3
- import { ChartOwnProps } from '../chart.types';
4
- import { ChartContextValue } from '../chartInjectionKey';
5
- type ChartRegistryProps = Pick<ChartOwnProps, "size" | "height" | "classes" | "palette" | "animation" | "customProps">;
6
- type ChartLibDefaults = LibDefaultsShape<ChartOwnProps, "size" | "height" | "animation">;
7
- type ChartMerged = MergeLibDefaults<ChartRegistryProps, ChartLibDefaults>;
8
- type ChartElementRef = Readonly<Ref<null | HTMLDivElement>>;
9
- export declare function useChart(props: ChartOwnProps, libDefaults: ChartLibDefaults, elements: {
10
- hostRef: ChartElementRef;
11
- plotRef: ChartElementRef;
12
- rootRef: ChartElementRef;
13
- }): {
14
- table: import('vue').ComputedRef<{
15
- categoryLabel: string;
16
- series: {
17
- id: string;
18
- name: string;
19
- }[];
20
- rows: {
21
- category: string;
22
- values: string[];
23
- }[];
24
- }>;
25
- merged: import('vue').ComputedRef<ChartMerged>;
26
- isEmpty: import('vue').ComputedRef<boolean>;
27
- summary: import('vue').ComputedRef<string>;
28
- hostBind: import('vue').ComputedRef<HTMLAttributes>;
29
- plotBind: import('vue').ComputedRef<HTMLAttributes>;
30
- rootBind: import('vue').ComputedRef<HTMLAttributes>;
31
- liveBind: import('vue').ComputedRef<HTMLAttributes>;
32
- emptyBind: import('vue').ComputedRef<HTMLAttributes>;
33
- isLoading: import('vue').ComputedRef<boolean>;
34
- tableBind: import('vue').ComputedRef<HTMLAttributes>;
35
- loadingBind: import('vue').ComputedRef<HTMLAttributes>;
36
- announcement: import('vue').ComputedRef<string>;
37
- contextValue: import('vue').ComputedRef<ChartContextValue>;
38
- emptyMessage: import('vue').ComputedRef<string>;
39
- };
40
- export {};
@@ -1,346 +0,0 @@
1
- import { useResolveMessage as e } from "../../../Adapters/I18n/useI18nAdapter.js";
2
- import { mergePartBind as t, useBridgeUIComponent as n, useBridgeUIMergedRegistryClasses as r } from "../../../Utils/index.js";
3
- import { CHART_INJECTION_KEY as i } from "../chartInjectionKey.js";
4
- import { mountEchartsChart as ee } from "../echartsChart.js";
5
- import { computed as a, onBeforeUnmount as te, onMounted as ne, provide as re, ref as o, shallowRef as s, useAttrs as ie, useId as ae, watch as c } from "vue";
6
- import { get as l, isEqual as u, isNil as d, omit as f } from "es-toolkit/compat";
7
- import { DEFAULT_CHART_HEIGHT as oe, DEFAULT_CHART_PALETTE as se, DEFAULT_CHART_X_AXIS as ce, DEFAULT_CHART_Y_AXIS as le, formatChartAnnouncement as ue, formatChartValue as de, getAdjacentChartIndex as fe, getChartSummaryParams as pe, getChartTableRows as me, getChartTooltipItems as he, isChartEmpty as p, isSameChartAxisOptions as ge, isSameChartSeriesEntry as _e, resolveChartSeriesColor as ve, toChartCssSize as m } from "@bridge-ui/core/Domain";
8
- import { chartColorProps as ye, chartSizeProps as be, chartThemeProps as xe } from "@bridge-ui/core/Tokens";
9
- import { cn as h, mergeBridgeUILayeredClasses as g, splitComponentProps as Se } from "@bridge-ui/core/Utils";
10
- import { observeColorScheme as Ce, prefersReducedMotion as we, readChartTheme as Te, readCssColor as _ } from "@bridge-ui/core/Runtime";
11
- //#region src/Components/Chart/composables/useChart.ts
12
- var Ee = [
13
- "size",
14
- "width",
15
- "height",
16
- "classes",
17
- "loading",
18
- "palette",
19
- "summary",
20
- "animation",
21
- "categories",
22
- "customProps"
23
- ];
24
- function v(v, De, Oe) {
25
- let ke = ae(), Ae = ie(), y = `bridge-chart${ke}`, b = e(), { hostRef: x, plotRef: S, rootRef: C } = Oe, w = s(null), T = null, E = null, D = o(0), O = o([]), k = o([]), A = s({
26
- width: 0,
27
- height: 0
28
- }), j = s({}), M = s(null), N = s({
29
- index: null,
30
- source: "pointer"
31
- }), P = s({}), F = a(() => Se({
32
- bridgeKeys: Ee,
33
- props: {
34
- ...Ae,
35
- ...v
36
- }
37
- })), I = a(() => F.value.componentProps), { bridge: L, merged: R, entry: z } = n({
38
- libDefaults: De,
39
- componentName: "Chart",
40
- props: () => f(I.value, ["palette", "categories"])
41
- }), B = r({
42
- entry: z,
43
- props: () => I.value
44
- }), V = a(() => L?.global.value.locale ?? "en-US"), H = a(() => R.value.customProps), je = a(() => JSON.stringify(I.value.categories ?? [])), U = a(() => JSON.parse(je.value)), Me = a(() => JSON.stringify(I.value.palette ?? R.value.palette ?? se)), Ne = a(() => JSON.parse(Me.value)), Pe = a(() => g(be, z.value?.tokens?.size)), Fe = a(() => g(ye, z.value?.tokens?.color)), W = a(() => g(xe, z.value?.tokens?.theme)), G = a(() => l(Pe.value, R.value.size)), K = a(() => k.value.map((e, t) => {
45
- let n = ve({
46
- index: t,
47
- color: e.color,
48
- palette: Ne.value
49
- });
50
- return {
51
- color: n,
52
- id: e.id,
53
- className: l(Fe.value, [n, "series"])
54
- };
55
- })), q;
56
- ne(() => {
57
- q = Ce(() => {
58
- D.value += 1;
59
- });
60
- }), c([
61
- C,
62
- D,
63
- W,
64
- K,
65
- () => G.value?.root,
66
- () => L?.global.value.theme
67
- ], () => {
68
- let e = C.value;
69
- if (d(e)) return;
70
- let t = {};
71
- K.value.forEach((n) => {
72
- t[n.id] = d(n.className) ? _(e, { color: n.color }) : _(e, { className: n.className });
73
- });
74
- let n = Te(e, {
75
- axis: W.value.axis ?? "",
76
- grid: W.value.grid ?? "",
77
- text: W.value.text ?? ""
78
- });
79
- u(j.value, t) || (j.value = t), u(M.value, n) || (M.value = n);
80
- }, {
81
- flush: "post",
82
- immediate: !0
83
- }), c(S, (e, t, n) => {
84
- if (d(e)) return;
85
- let r = () => {
86
- let t = e.clientWidth, n = e.clientHeight;
87
- (A.value.width !== t || A.value.height !== n) && (A.value = {
88
- width: t,
89
- height: n
90
- });
91
- };
92
- if (r(), typeof ResizeObserver > "u") return;
93
- let i = new ResizeObserver(r);
94
- i.observe(e), n(() => {
95
- i.disconnect();
96
- });
97
- }, {
98
- flush: "post",
99
- immediate: !0
100
- });
101
- function Ie(e) {
102
- let t = k.value.findIndex((t) => t.id === e.id);
103
- if (t === -1) {
104
- k.value = [...k.value, e];
105
- return;
106
- }
107
- if (_e(k.value[t], e)) return;
108
- let n = [...k.value];
109
- n[t] = e, k.value = n;
110
- }
111
- function Le(e) {
112
- k.value = k.value.filter((t) => t.id !== e);
113
- }
114
- function Re(e, t) {
115
- let n = P.value[e];
116
- (d(n) || !ge(n, t)) && (P.value = {
117
- ...P.value,
118
- [e]: t
119
- });
120
- }
121
- function ze(e) {
122
- P.value = f(P.value, [e]);
123
- }
124
- function Be(e) {
125
- O.value = O.value.includes(e) ? O.value.filter((t) => t !== e) : [...O.value, e];
126
- }
127
- function Ve(e) {
128
- w.value?.highlightSeries(e);
129
- }
130
- function He(e) {
131
- N.value.index !== e && (N.value = {
132
- index: e,
133
- source: "pointer"
134
- });
135
- }
136
- let J = a(() => k.value.map((e) => ({
137
- ...e,
138
- resolvedColor: j.value[e.id] ?? "",
139
- hidden: O.value.includes(e.id)
140
- }))), Y = a(() => J.value.filter((e) => !e.hidden)), Ue = a(() => ({
141
- ...ce,
142
- ...P.value.x
143
- })), We = a(() => ({
144
- ...le,
145
- ...P.value.y
146
- })), Ge = a(() => R.value.animation !== !1 && !we()), X = a(() => d(M.value) ? null : {
147
- theme: M.value,
148
- xAxis: Ue.value,
149
- yAxis: We.value,
150
- animation: Ge.value,
151
- width: A.value.width,
152
- categories: U.value,
153
- height: A.value.height,
154
- series: Y.value.map((e) => ({
155
- id: e.id,
156
- name: e.name,
157
- type: e.type,
158
- data: e.data,
159
- curve: e.curve,
160
- color: e.resolvedColor
161
- }))
162
- }), Z = a(() => !d(x.value) && !d(X.value));
163
- function Q() {
164
- w.value?.destroy(), w.value = null, E = null, T?.remove(), T = null;
165
- }
166
- c([x, Z], () => {
167
- Q();
168
- let e = x.value, t = X.value;
169
- if (!Z.value || d(e) || d(t)) return;
170
- let n = document.createElement("div");
171
- n.className = "absolute inset-0", e.appendChild(n), T = n, w.value = ee({
172
- ...t,
173
- element: n,
174
- onActiveIndexChange: He
175
- }), E = t;
176
- }, {
177
- flush: "post",
178
- immediate: !0
179
- }), c(X, (e) => {
180
- let t = w.value;
181
- d(t) || d(e) || E === e || (E = e, t.update(e));
182
- }, { flush: "post" }), c(N, (e) => {
183
- e.source === "keyboard" && w.value?.setActiveIndex(e.index);
184
- }, { flush: "post" }), te(() => {
185
- q?.(), Q();
186
- });
187
- let Ke = a(() => {
188
- let e = N.value.index;
189
- return d(e) ? [] : he({
190
- index: e,
191
- series: Y.value.map((e) => ({
192
- ...e,
193
- color: e.resolvedColor
194
- }))
195
- });
196
- });
197
- function qe(e) {
198
- let t = w.value?.getCategoryAnchor(e), n = S.value;
199
- return d(t) || d(n) ? null : {
200
- y: t.y + n.offsetTop,
201
- x: t.x + n.offsetLeft
202
- };
203
- }
204
- function Je() {
205
- return {
206
- width: C.value?.clientWidth ?? 0,
207
- height: C.value?.clientHeight ?? 0
208
- };
209
- }
210
- let Ye = a(() => ({
211
- setAxis: Re,
212
- getBounds: Je,
213
- removeAxis: ze,
214
- id: y,
215
- removeSeries: Le,
216
- toggleSeries: Be,
217
- upsertSeries: Ie,
218
- highlightSeries: Ve,
219
- getTooltipAnchor: qe,
220
- series: J.value,
221
- locale: V.value,
222
- categories: U.value,
223
- activeIndex: N.value.index,
224
- tooltipItems: Ke.value,
225
- tokenClasses: {
226
- legend: l(G.value, "legend"),
227
- swatch: l(G.value, "swatch"),
228
- tooltip: l(G.value, "tooltip"),
229
- legendItem: l(G.value, "legendItem")
230
- }
231
- }));
232
- re(i, Ye);
233
- let $ = a(() => I.value.loading === !0), Xe = a(() => !$.value && p(k.value)), Ze = a(() => b("No data")), Qe = a(() => d(I.value.summary) ? p(k.value) ? Ze.value : b("Chart with {{count}} series ({{names}}) across {{categories}} categories, from {{first}} to {{last}}.", pe({
234
- series: k.value,
235
- categories: U.value
236
- })) : I.value.summary), $e = a(() => {
237
- let e = N.value.index;
238
- return N.value.source !== "keyboard" || d(e) ? "" : ue({
239
- locale: V.value,
240
- items: Ke.value,
241
- category: U.value[e] ?? ""
242
- });
243
- }), et = a(() => ({
244
- categoryLabel: b("Category"),
245
- series: k.value.map((e) => ({
246
- id: e.id,
247
- name: e.name
248
- })),
249
- rows: me({
250
- series: k.value,
251
- categories: U.value
252
- }).map((e) => ({
253
- category: e.category,
254
- values: e.values.map((e) => d(e) ? "—" : de(e, V.value))
255
- }))
256
- }));
257
- function tt(e) {
258
- if (H.value?.plot?.onKeydown?.(e), e.defaultPrevented) return;
259
- let t = fe({
260
- key: e.key,
261
- current: N.value.index,
262
- count: U.value.length
263
- });
264
- t !== void 0 && (e.preventDefault(), N.value = {
265
- index: t,
266
- source: "keyboard"
267
- });
268
- }
269
- function nt(e) {
270
- H.value?.plot?.onBlur?.(e), N.value.source === "keyboard" && (N.value = {
271
- index: null,
272
- source: "keyboard"
273
- });
274
- }
275
- let rt = a(() => t(f(H.value?.root, ["style"]), f(F.value.inheritedAttrs, ["style"]), {
276
- role: "figure",
277
- "aria-busy": $.value || void 0,
278
- style: [
279
- { width: m(I.value.width, "100%") },
280
- F.value.inheritedAttrs.style,
281
- H.value?.root?.style
282
- ],
283
- class: h({
284
- "relative flex min-w-0 flex-col gap-3": !0,
285
- [l(G.value, "root") ?? ""]: !0,
286
- [l(B.value, "root") ?? ""]: !0
287
- })
288
- })), it = a(() => t(f(H.value?.plot, [
289
- "style",
290
- "onBlur",
291
- "onKeydown"
292
- ]), void 0, {
293
- role: "img",
294
- tabindex: 0,
295
- onBlur: nt,
296
- onKeydown: tt,
297
- "aria-label": Qe.value,
298
- style: [{ height: m(R.value.height, `${oe}px`) }, H.value?.plot?.style],
299
- class: h({
300
- "relative w-full min-w-0 rounded-md outline-none": !0,
301
- "focus-visible:ring-2 focus-visible:ring-primary-500/50": !0,
302
- [l(B.value, "plot") ?? ""]: !0
303
- })
304
- })), at = a(() => ({
305
- "aria-hidden": !0,
306
- class: "absolute inset-0"
307
- })), ot = a(() => ({ class: h({
308
- "absolute inset-0 z-10 flex items-center justify-center": !0,
309
- "bg-white/50 dark:bg-dark-900/50": !0,
310
- [l(B.value, "loading") ?? ""]: !0
311
- }) })), st = a(() => ({ class: h({
312
- "absolute inset-0 z-10 flex items-center justify-center": !0,
313
- "text-dark-500 dark:text-dark-400": !0,
314
- [l(B.value, "empty") ?? ""]: !0
315
- }) })), ct = a(() => ({
316
- id: `${y}-table`,
317
- class: h({
318
- "sr-only block": !0,
319
- [l(B.value, "table") ?? ""]: !0
320
- })
321
- }));
322
- return {
323
- table: et,
324
- merged: R,
325
- isEmpty: Xe,
326
- summary: Qe,
327
- hostBind: at,
328
- plotBind: it,
329
- rootBind: rt,
330
- liveBind: a(() => ({
331
- role: "status",
332
- class: "sr-only",
333
- "aria-atomic": !0,
334
- "aria-live": "polite"
335
- })),
336
- emptyBind: st,
337
- isLoading: $,
338
- tableBind: ct,
339
- loadingBind: ot,
340
- announcement: $e,
341
- contextValue: Ye,
342
- emptyMessage: Ze
343
- };
344
- }
345
- //#endregion
346
- export { v as useChart };
@@ -1,14 +0,0 @@
1
- import { BarSeriesOption, LineSeriesOption } from 'echarts/charts';
2
- import { GridComponentOption, TooltipComponentOption } from 'echarts/components';
3
- import { ComposeOption } from 'echarts/core';
4
- import { ChartHandle, ChartMountOptions, ChartRenderOptions } from '@bridge-ui/core/Domain';
5
- type EChartsOption = ComposeOption<BarSeriesOption | LineSeriesOption | GridComponentOption | TooltipComponentOption>;
6
- /**
7
- * Builds the ECharts option for the current render options.
8
- */
9
- export declare function buildEchartsOption(options: ChartRenderOptions): EChartsOption;
10
- /**
11
- * Mounts an ECharts plot into `options.element`.
12
- */
13
- export declare function mountEchartsChart(options: ChartMountOptions): ChartHandle;
14
- export {};