@knime/kds-echarts 6.0.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.
package/README.md ADDED
@@ -0,0 +1,174 @@
1
+ # KNIME® Design System – ECharts
2
+
3
+ This package contains the KNIME Design System integration for [Apache ECharts]: the `KdsECharts` [Vue] component, the `useKdsEChartsColors` composable, and the generated KDS ECharts **themes** (`light` / `dark`) with all chart tokens resolved to concrete values.
4
+
5
+ It's published as npm package: [@knime/kds-echarts]
6
+
7
+ ## Development
8
+
9
+ This package is part of the [KNIME Design System monorepo](../../README.md). For setup instructions, see the **[root README](../../README.md)**.
10
+
11
+ ## Building
12
+
13
+ ```sh
14
+ pnpm run build # Build only this package
15
+ pnpm run build:theme # Only regenerate the ECharts themes from the KDS tokens
16
+ ```
17
+
18
+ Results are saved to `dist/`.
19
+
20
+ `build:theme` reads the resolved design tokens from `@knime/kds-styles` and writes `src/theme/generated.ts` (gitignored), so `@knime/kds-styles` must be built first. The repository's `postinstall` does both in order.
21
+
22
+ ## Using ECharts in a Vue application
23
+
24
+ Install the [@knime/kds-echarts] npm package as a dependency:
25
+
26
+ ```sh
27
+ pnpm add @knime/kds-echarts echarts
28
+ ```
29
+
30
+ `KdsECharts` deliberately registers nothing itself, so the bundle stays tree-shaken — the consumer registers exactly the renderer, charts and components it uses via ECharts' `use()`:
31
+
32
+ ```vue
33
+ <script setup lang="ts">
34
+ import type { EChartsOption } from "echarts";
35
+ import { BarChart } from "echarts/charts";
36
+ import { GridComponent, TooltipComponent } from "echarts/components";
37
+ import { use } from "echarts/core";
38
+ import { CanvasRenderer } from "echarts/renderers";
39
+
40
+ import { KdsECharts } from "@knime/kds-echarts";
41
+
42
+ use([CanvasRenderer, BarChart, GridComponent, TooltipComponent]);
43
+
44
+ const option: EChartsOption = {
45
+ xAxis: { type: "category", data: ["Jan", "Feb", "Mar"] },
46
+ yAxis: { type: "value" },
47
+ series: [{ type: "bar", data: [120, 200, 150] }],
48
+ };
49
+ </script>
50
+
51
+ <template>
52
+ <KdsECharts :option="option" style="height: 240px" />
53
+ </template>
54
+ ```
55
+
56
+ The KDS theme is applied automatically and follows light/dark mode, so an option should generally omit colors and fonts and let the theme drive styling.
57
+
58
+ Events (`@click`, `@datazoom`, `@finished`, `zr:*`, …) as well as `class` and `style` fall through to the wrapped `vue-echarts` component. The underlying ECharts instance is exposed as `chart` for imperative use (`dispatchAction`, `resize`, `getDataURL`, …).
59
+
60
+ ### Public exports
61
+
62
+ | Export | Kind | Description |
63
+ | --------------------- | ---------- | ----------------------------------------------------------------------------------- |
64
+ | `KdsECharts` | component | ECharts chart with the KDS theme applied and light/dark mode handled |
65
+ | `useKdsEChartsColors` | composable | Reactive semantic chart colors for explicit per-series coloring |
66
+ | `light` / `dark` | const | The KDS ECharts theme objects (also available from `@knime/kds-echarts/theme`) |
67
+ | `chartColors` | const | The semantic chart colors per mode (also available from `@knime/kds-echarts/theme`) |
68
+ | `KdsEChartsProps` | type | Props of `KdsECharts` |
69
+ | `KdsEChartsTheme` | type | Shape of a KDS ECharts theme object |
70
+ | `KdsChartColors` | type | Shape of the semantic chart colors for one mode |
71
+
72
+ ### Explicit per-series coloring
73
+
74
+ The theme's base palette covers series 1–9 in order. For colors it doesn't reach — status hues, label inks drawn on a segment fill, chart controls — use `useKdsEChartsColors()`, which resolves against the effective dark mode and flips automatically when the mode changes:
75
+
76
+ ```vue
77
+ <script setup lang="ts">
78
+ import { computed } from "vue";
79
+
80
+ import { KdsECharts, useKdsEChartsColors } from "@knime/kds-echarts";
81
+
82
+ const colors = useKdsEChartsColors();
83
+ const option = computed(() => ({
84
+ xAxis: { type: "category", data: ["Jan", "Feb", "Mar"] },
85
+ yAxis: { type: "value" },
86
+ series: [
87
+ {
88
+ type: "bar",
89
+ data: [120, 200, 150],
90
+ itemStyle: { color: colors.value.series[1] },
91
+ },
92
+ {
93
+ type: "line",
94
+ data: [90, 90, 90],
95
+ lineStyle: { color: colors.value.status.negative },
96
+ },
97
+ ],
98
+ }));
99
+ </script>
100
+ ```
101
+
102
+ ## Using the KDS ECharts theme without Vue
103
+
104
+ [Apache ECharts] renders to `<canvas>`/SVG and cannot resolve CSS custom properties or `light-dark()`, so it needs concrete, per-mode values. The `@knime/kds-echarts/theme` entry point ships those theme objects with the KDS chart tokens already resolved, and imports **neither Vue nor vue-echarts**:
105
+
106
+ ```ts
107
+ import { BarChart } from "echarts/charts";
108
+ import { GridComponent, TooltipComponent } from "echarts/components";
109
+ import { init, use } from "echarts/core";
110
+ import { CanvasRenderer } from "echarts/renderers";
111
+
112
+ import { dark, fontFaces, light } from "@knime/kds-echarts/theme";
113
+
114
+ use([CanvasRenderer, BarChart, GridComponent, TooltipComponent]);
115
+
116
+ // Canvas keeps whatever glyphs it drew with, so wait for the fonts first.
117
+ await Promise.all(fontFaces.map((face) => document.fonts.load(face)));
118
+
119
+ const chart = init(el, dark); // initialise with a theme object
120
+ chart.setTheme(light); // swap themes at runtime (e.g. on dark-mode change)
121
+ ```
122
+
123
+ | Export | Description |
124
+ | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
125
+ | `light` | Light-mode ECharts theme (palette, axes, tooltip, text, …) for `registerTheme` or vue-echarts' `theme` prop. |
126
+ | `dark` | Dark-mode ECharts theme, same shape as `light`. |
127
+ | `chartColors` | Semantic colors the base theme palette doesn't reach (series 1–9, status hues, on-fill inks, controls) per mode, for explicit per-series coloring. |
128
+ | `fontFaces` | Every font face the themes draw with, as `document.fonts.load()` arguments. |
129
+
130
+ A non-Vue app can skip installing Vue-related dependencies entirely with pnpm overrides:
131
+
132
+ ```jsonc
133
+ // package.json (consumer)
134
+ {
135
+ "pnpm": {
136
+ "overrides": {
137
+ "vue": "-",
138
+ "vue-echarts": "-",
139
+ "@knime/kds-components": "-",
140
+ },
141
+ },
142
+ }
143
+ ```
144
+
145
+ ### Using with Vitest, Nuxt, or Vite SSR
146
+
147
+ The published JavaScript imports its CSS as a side effect (e.g.
148
+ `import "./index.css"`), which bundlers handle automatically. When the package
149
+ is instead evaluated by Node's native ESM loader — as **Vitest** and
150
+ **Vite/Nuxt SSR** do by default, since they externalize `node_modules` — Node
151
+ has no `.css` loader and throws `Unknown file extension ".css"`. Configure the
152
+ consuming project once so `@knime/*` packages are processed instead of
153
+ externalized:
154
+
155
+ ```ts
156
+ // Vitest — vitest.config.ts
157
+ export default defineConfig({
158
+ test: { server: { deps: { inline: [/@knime\//] } } },
159
+ });
160
+ ```
161
+
162
+ ```ts
163
+ // Vite SSR — vite.config.ts
164
+ export default defineConfig({ ssr: { noExternal: [/@knime\//] } });
165
+ ```
166
+
167
+ ```ts
168
+ // Nuxt — nuxt.config.ts
169
+ export default defineNuxtConfig({ build: { transpile: [/@knime\//] } });
170
+ ```
171
+
172
+ [Apache ECharts]: https://echarts.apache.org/
173
+ [Vue]: https://vuejs.org/
174
+ [@knime/kds-echarts]: https://www.npmjs.com/package/@knime/kds-echarts
package/dist/index.css ADDED
@@ -0,0 +1,4 @@
1
+
2
+ .kds-echarts[data-v-7601cf05] {
3
+ width: 100%;
4
+ }
package/dist/index.js ADDED
@@ -0,0 +1,80 @@
1
+ import { i as light, n as dark, r as fontFaces, t as chartColors } from "./theme-CrV5MB97.js";
2
+ import { computed, createBlock, createCommentVNode, createPropsRestProxy, defineComponent, mergeProps, onMounted, openBlock, ref, unref, useTemplateRef } from "vue";
3
+ import VChart from "vue-echarts";
4
+ import { useKdsDarkMode } from "@knime/kds-components";
5
+ import './index.css';//#region src/KdsECharts.vue?vue&type=script&setup=true&lang.ts
6
+ var KdsECharts_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
7
+ __name: "KdsECharts",
8
+ props: {
9
+ option: {},
10
+ autoresize: { default: true },
11
+ initOptions: {},
12
+ updateOptions: {},
13
+ loading: {},
14
+ loadingOptions: {},
15
+ group: {}
16
+ },
17
+ setup(__props, { expose: __expose }) {
18
+ const rest = createPropsRestProxy(__props, ["option", "autoresize"]);
19
+ const { isDark } = useKdsDarkMode();
20
+ const theme = computed(() => isDark.value ? dark : light);
21
+ const vchart = useTemplateRef("vchart");
22
+ const chart = computed(() => vchart.value?.chart);
23
+ const fontsReady = ref(!globalThis.document?.fonts);
24
+ onMounted(async () => {
25
+ try {
26
+ await Promise.all(fontFaces.map((face) => document.fonts.load(face)));
27
+ } catch {}
28
+ fontsReady.value = true;
29
+ });
30
+ __expose({
31
+ /**
32
+ * The underlying ECharts instance for imperative use (`dispatchAction`,
33
+ * `resize`, `getDataURL`, …), or `undefined` before the chart is mounted.
34
+ */
35
+ chart });
36
+ return (_ctx, _cache) => {
37
+ return fontsReady.value ? (openBlock(), createBlock(unref(VChart), mergeProps({
38
+ key: 0,
39
+ ref_key: "vchart",
40
+ ref: vchart,
41
+ class: "kds-echarts",
42
+ option: __props.option,
43
+ theme: theme.value,
44
+ autoresize: __props.autoresize
45
+ }, rest), null, 16, [
46
+ "option",
47
+ "theme",
48
+ "autoresize"
49
+ ])) : createCommentVNode("", true);
50
+ };
51
+ }
52
+ });
53
+ //#endregion
54
+ //#region \0plugin-vue:export-helper
55
+ var _plugin_vue_export_helper_default = (sfc, props) => {
56
+ const target = sfc.__vccOpts || sfc;
57
+ for (const [key, val] of props) target[key] = val;
58
+ return target;
59
+ };
60
+ //#endregion
61
+ //#region src/KdsECharts.vue
62
+ var KdsECharts_default = /*#__PURE__*/ _plugin_vue_export_helper_default(KdsECharts_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-7601cf05"]]);
63
+ //#endregion
64
+ //#region src/useKdsEChartsColors.ts
65
+ /**
66
+ * Reactive KDS chart colors resolved for the effective dark mode. Use it to
67
+ * color individual series, markers or custom shapes that the theme's base
68
+ * palette does not reach — e.g. `colors.value.series[1]` for the blue series,
69
+ * `colors.value.status.negative` for an over-cap line. The value flips
70
+ * automatically when the dark mode changes, so a consumer never needs a
71
+ * `MutationObserver` on `data-theme` or a `resolveColor()` probe.
72
+ */
73
+ var useKdsEChartsColors = () => {
74
+ const { isDark } = useKdsDarkMode();
75
+ return computed(() => isDark.value ? chartColors.dark : chartColors.light);
76
+ };
77
+ //#endregion
78
+ export { KdsECharts_default as KdsECharts, chartColors, dark, light, useKdsEChartsColors };
79
+
80
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/KdsECharts.vue","../src/KdsECharts.vue","../src/useKdsEChartsColors.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onMounted, ref, useTemplateRef } from \"vue\";\nimport VChart from \"vue-echarts\";\n\nimport { useKdsDarkMode } from \"@knime/kds-components\";\n\nimport { dark, fontFaces, light } from \"./theme\";\nimport type { KdsEChartsProps } from \"./types\";\n\nconst { option, autoresize = true, ...rest } = defineProps<KdsEChartsProps>();\n\nconst { isDark } = useKdsDarkMode();\n// vue-echarts calls echarts' setTheme() when `theme` changes, so flipping this\n// re-themes the whole chart (palette / axes / tooltip / text).\nconst theme = computed(() => (isDark.value ? dark : light));\n\nconst vchart = useTemplateRef(\"vchart\");\n// vue-echarts exposes the live ECharts instance as `chart`; surface it directly\n// so consumers get the raw instance rather than the wrapper component.\nconst chart = computed(() => vchart.value?.chart);\n\n/* Canvas keeps whatever glyphs it drew with, so hold the first paint until the\n fonts are there. `fonts.ready` is no use — it resolves while the faces are\n still undiscovered. */\nconst fontsReady = ref(!globalThis.document?.fonts);\nonMounted(async () => {\n try {\n await Promise.all(fontFaces.map((face) => document.fonts.load(face)));\n } catch {\n // A face that fails to load must never keep the chart from rendering.\n }\n fontsReady.value = true;\n});\n\ndefineExpose({\n /**\n * The underlying ECharts instance for imperative use (`dispatchAction`,\n * `resize`, `getDataURL`, …), or `undefined` before the chart is mounted.\n */\n chart,\n});\n</script>\n\n<template>\n <VChart\n v-if=\"fontsReady\"\n ref=\"vchart\"\n class=\"kds-echarts\"\n :option=\"option\"\n :theme=\"theme\"\n :autoresize=\"autoresize\"\n v-bind=\"rest\"\n />\n</template>\n\n<style scoped>\n.kds-echarts {\n width: 100%;\n}\n</style>\n","<script setup lang=\"ts\">\nimport { computed, onMounted, ref, useTemplateRef } from \"vue\";\nimport VChart from \"vue-echarts\";\n\nimport { useKdsDarkMode } from \"@knime/kds-components\";\n\nimport { dark, fontFaces, light } from \"./theme\";\nimport type { KdsEChartsProps } from \"./types\";\n\nconst { option, autoresize = true, ...rest } = defineProps<KdsEChartsProps>();\n\nconst { isDark } = useKdsDarkMode();\n// vue-echarts calls echarts' setTheme() when `theme` changes, so flipping this\n// re-themes the whole chart (palette / axes / tooltip / text).\nconst theme = computed(() => (isDark.value ? dark : light));\n\nconst vchart = useTemplateRef(\"vchart\");\n// vue-echarts exposes the live ECharts instance as `chart`; surface it directly\n// so consumers get the raw instance rather than the wrapper component.\nconst chart = computed(() => vchart.value?.chart);\n\n/* Canvas keeps whatever glyphs it drew with, so hold the first paint until the\n fonts are there. `fonts.ready` is no use — it resolves while the faces are\n still undiscovered. */\nconst fontsReady = ref(!globalThis.document?.fonts);\nonMounted(async () => {\n try {\n await Promise.all(fontFaces.map((face) => document.fonts.load(face)));\n } catch {\n // A face that fails to load must never keep the chart from rendering.\n }\n fontsReady.value = true;\n});\n\ndefineExpose({\n /**\n * The underlying ECharts instance for imperative use (`dispatchAction`,\n * `resize`, `getDataURL`, …), or `undefined` before the chart is mounted.\n */\n chart,\n});\n</script>\n\n<template>\n <VChart\n v-if=\"fontsReady\"\n ref=\"vchart\"\n class=\"kds-echarts\"\n :option=\"option\"\n :theme=\"theme\"\n :autoresize=\"autoresize\"\n v-bind=\"rest\"\n />\n</template>\n\n<style scoped>\n.kds-echarts {\n width: 100%;\n}\n</style>\n","import { computed } from \"vue\";\n\nimport { useKdsDarkMode } from \"@knime/kds-components\";\n\nimport { chartColors } from \"./theme\";\n\n/**\n * Reactive KDS chart colors resolved for the effective dark mode. Use it to\n * color individual series, markers or custom shapes that the theme's base\n * palette does not reach — e.g. `colors.value.series[1]` for the blue series,\n * `colors.value.status.negative` for an over-cap line. The value flips\n * automatically when the dark mode changes, so a consumer never needs a\n * `MutationObserver` on `data-theme` or a `resolveColor()` probe.\n */\nexport const useKdsEChartsColors = () => {\n const { isDark } = useKdsDarkMode();\n return computed(() => (isDark.value ? chartColors.dark : chartColors.light));\n};\n"],"mappings":";;;;;;;;;;;;;;;;;EASA,MAAM,OAAyC,qBAAA,SAAA,CAAA,UAAA,YAAA,CAAA;EAE/C,MAAM,EAAE,WAAW,eAAe;EAGlC,MAAM,QAAQ,eAAgB,OAAO,QAAQ,OAAO,KAAM;EAE1D,MAAM,SAAS,eAAe,QAAQ;EAGtC,MAAM,QAAQ,eAAe,OAAO,OAAO,KAAK;EAKhD,MAAM,aAAa,IAAI,CAAC,WAAW,UAAU,KAAK;EAClD,UAAU,YAAY;GACpB,IAAI;IACF,MAAM,QAAQ,IAAI,UAAU,KAAK,SAAS,SAAS,MAAM,KAAK,IAAI,CAAC,CAAC;GACtE,QAAQ,CAER;GACA,WAAW,QAAQ;EACrB,CAAC;EAED,SAAa;;;;;AAKX,MACF,CAAC;;UAKS,WAAA,SAAA,UAAA,GADR,YAQE,MAAA,MAAA,GARF,WAQE;;aANI;IAAJ,KAAI;IACJ,OAAM;IACL,QAAQ,QAAA;IACR,OAAO,MAAA;IACP,YAAY,QAAA;MACL,IAAI,GAAA,MAAA,IAAA;IAAA;IAAA;IAAA;GAAA,CAAA,KAAA,mBAAA,IAAA,IAAA;;;;;;;;;;;;;;;;;;;;;;;;AErChB,IAAa,4BAA4B;CACvC,MAAM,EAAE,WAAW,eAAe;CAClC,OAAO,eAAgB,OAAO,QAAQ,YAAY,OAAO,YAAY,KAAM;AAC7E"}
@@ -0,0 +1,11 @@
1
+ import { KdsEChartsProps } from './types';
2
+ declare const __VLS_export: import('vue').DefineComponent<KdsEChartsProps, {
3
+ /**
4
+ * The underlying ECharts instance for imperative use (`dispatchAction`,
5
+ * `resize`, `getDataURL`, …), or `undefined` before the chart is mounted.
6
+ */
7
+ chart: import('vue').ComputedRef<import('echarts').ECharts | undefined>;
8
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<KdsEChartsProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
11
+ //# sourceMappingURL=KdsECharts.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KdsECharts.vue.d.ts","sourceRoot":"","sources":["../../src/KdsECharts.vue"],"names":[],"mappings":"AAqEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AA4F/C,QAAA,MAAM,YAAY;IA9DhB;;;OAGG;;wPA8DH,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -0,0 +1,6 @@
1
+ export { default as KdsECharts } from './KdsECharts.vue';
2
+ export { useKdsEChartsColors } from './useKdsEChartsColors';
3
+ export { chartColors, dark, light } from './theme';
4
+ export type * from './types';
5
+ export type * from './theme';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAI5D,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEnD,mBAAmB,SAAS,CAAC;AAC7B,mBAAmB,SAAS,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { KdsChartColors, KdsEChartsTheme } from './types';
2
+ /** KDS ECharts theme for light mode. */
3
+ export declare const light: KdsEChartsTheme;
4
+ /** KDS ECharts theme for dark mode. */
5
+ export declare const dark: KdsEChartsTheme;
6
+ /** Semantic chart colors resolved per mode, for explicit per-series coloring. */
7
+ export declare const chartColors: {
8
+ light: KdsChartColors;
9
+ dark: KdsChartColors;
10
+ };
11
+ /**
12
+ * Every font face the themes draw with, as `document.fonts.load()` arguments.
13
+ * Await them before the first paint: canvas keeps whatever glyphs it drew with.
14
+ */
15
+ export declare const fontFaces: readonly string[];
16
+ //# sourceMappingURL=generated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated.d.ts","sourceRoot":"","sources":["../../../src/theme/generated.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/D,wCAAwC;AACxC,eAAO,MAAM,KAAK,EAAE,eA6MnB,CAAC;AAEF,uCAAuC;AACvC,eAAO,MAAM,IAAI,EAAE,eA6MlB,CAAC;AAEF,iFAAiF;AACjF,eAAO,MAAM,WAAW,EAAE;IAAE,KAAK,EAAE,cAAc,CAAC;IAAC,IAAI,EAAE,cAAc,CAAA;CA2DtE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,SAAS,EAAE,SAAS,MAAM,EAKtC,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Framework-agnostic entry point (`@knime/kds-echarts/theme`): the generated KDS
3
+ * ECharts themes with no Vue or vue-echarts import, for consumers that drive
4
+ * ECharts directly.
5
+ */
6
+ export { chartColors, dark, fontFaces, light } from './generated';
7
+ export type * from './types';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/theme/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAClE,mBAAmB,SAAS,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * A KDS ECharts theme: concrete, resolved color/dimension/font values ready to
3
+ * hand to ECharts' `registerTheme` or vue-echarts' `theme` prop. Typed loosely
4
+ * (as ECharts itself types themes) since a theme is a partial merge template.
5
+ */
6
+ export type KdsEChartsTheme = Record<string, unknown>;
7
+ /**
8
+ * Semantic chart colors resolved for a single mode — the categorical series
9
+ * palette plus the colors the base palette does not reach.
10
+ */
11
+ export type KdsChartColors = {
12
+ /** Categorical series palette (series 1–9), matching the theme's `color`. */
13
+ readonly series: string[];
14
+ /** Directional / limit status hues for markers, lines and labels on data. */
15
+ readonly status: {
16
+ readonly positive: string;
17
+ readonly negative: string;
18
+ readonly warning: string;
19
+ readonly error: string;
20
+ };
21
+ /** Label inks for text drawn on a segment fill; pick by contrast per fill. */
22
+ readonly onFill: {
23
+ readonly dark: string;
24
+ readonly light: string;
25
+ };
26
+ /** Chart control colors (toolbox, dataZoom handle, legend pager). */
27
+ readonly control: {
28
+ readonly default: string;
29
+ readonly hover: string;
30
+ readonly selected: string;
31
+ readonly disabled: string;
32
+ };
33
+ };
34
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/theme/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEtD;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;IAC1B,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,EAAE;QACf,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;KACxB,CAAC;IACF,8EAA8E;IAC9E,QAAQ,CAAC,MAAM,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IACnE,qEAAqE;IACrE,QAAQ,CAAC,OAAO,EAAE;QAChB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;KAC3B,CAAC;CACH,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { EChartsOption } from 'echarts';
2
+ /**
3
+ * vue-echarts does not re-export its prop value types (AutoResize, InitOptions,
4
+ * …), so we source them from the component's resolved props. The `typeof
5
+ * import(...)` type query keeps this in sync with the wrapped component without
6
+ * a runtime import and without re-declaring echarts' option shapes.
7
+ */
8
+ type VChartProps = InstanceType<(typeof import("vue-echarts"))["default"]>["$props"];
9
+ export type KdsEChartsProps = {
10
+ /**
11
+ * The ECharts option describing the chart (series, axes, tooltip, …). Colors,
12
+ * fonts and light/dark theming are applied automatically from KDS tokens, so
13
+ * an option should generally omit them and let the theme drive styling; set a
14
+ * color explicitly (e.g. from `useKdsEChartsColors`) only for deliberate
15
+ * per-series choices.
16
+ */
17
+ option: EChartsOption;
18
+ /**
19
+ * Whether the chart resizes with its container. `true` (the default) covers
20
+ * the common responsive case; pass an object to throttle or hook resizes.
21
+ */
22
+ autoresize?: VChartProps["autoresize"];
23
+ /** Options forwarded to `echarts.init` (renderer, devicePixelRatio, locale, …). */
24
+ initOptions?: VChartProps["initOptions"];
25
+ /** Options forwarded to every `setOption` update (e.g. `notMerge`, `replaceMerge`). */
26
+ updateOptions?: VChartProps["updateOptions"];
27
+ /** Whether to overlay ECharts' loading animation. */
28
+ loading?: VChartProps["loading"];
29
+ /** Styling for the loading animation (text, colors, spinner). */
30
+ loadingOptions?: VChartProps["loadingOptions"];
31
+ /** Connects charts sharing the same group id for coordinated interactions. */
32
+ group?: VChartProps["group"];
33
+ };
34
+ export {};
35
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C;;;;;GAKG;AACH,KAAK,WAAW,GAAG,YAAY,CAC7B,CAAC,cAAc,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAC1C,CAAC,QAAQ,CAAC,CAAC;AAEZ,MAAM,MAAM,eAAe,GAAG;IAC5B;;;;;;OAMG;IACH,MAAM,EAAE,aAAa,CAAC;IACtB;;;OAGG;IACH,UAAU,CAAC,EAAE,WAAW,CAAC,YAAY,CAAC,CAAC;IACvC,mFAAmF;IACnF,WAAW,CAAC,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC;IACzC,uFAAuF;IACvF,aAAa,CAAC,EAAE,WAAW,CAAC,eAAe,CAAC,CAAC;IAC7C,qDAAqD;IACrD,OAAO,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IACjC,iEAAiE;IACjE,cAAc,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAC/C,8EAA8E;IAC9E,KAAK,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CAC9B,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Reactive KDS chart colors resolved for the effective dark mode. Use it to
3
+ * color individual series, markers or custom shapes that the theme's base
4
+ * palette does not reach — e.g. `colors.value.series[1]` for the blue series,
5
+ * `colors.value.status.negative` for an over-cap line. The value flips
6
+ * automatically when the dark mode changes, so a consumer never needs a
7
+ * `MutationObserver` on `data-theme` or a `resolveColor()` probe.
8
+ */
9
+ export declare const useKdsEChartsColors: () => import('vue').ComputedRef<import('./theme').KdsChartColors>;
10
+ //# sourceMappingURL=useKdsEChartsColors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useKdsEChartsColors.d.ts","sourceRoot":"","sources":["../../src/useKdsEChartsColors.ts"],"names":[],"mappings":"AAMA;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,mEAG/B,CAAC"}