@lark-apaas/coding-vite-preset 0.1.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/LICENSE +7 -0
- package/README.md +68 -0
- package/lib/index.d.ts +37 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +69 -0
- package/lib/index.js.map +1 -0
- package/lib/module-alias/clsx.d.ts +4 -0
- package/lib/module-alias/clsx.d.ts.map +1 -0
- package/lib/module-alias/clsx.js +13 -0
- package/lib/module-alias/clsx.js.map +1 -0
- package/lib/module-alias/echarts-for-react.d.ts +14 -0
- package/lib/module-alias/echarts-for-react.d.ts.map +1 -0
- package/lib/module-alias/echarts-for-react.js +142 -0
- package/lib/module-alias/echarts-for-react.js.map +1 -0
- package/lib/module-alias/echarts.d.ts +9 -0
- package/lib/module-alias/echarts.d.ts.map +1 -0
- package/lib/module-alias/echarts.js +84 -0
- package/lib/module-alias/echarts.js.map +1 -0
- package/lib/module-alias/registry_echarts_theme.d.ts +692 -0
- package/lib/module-alias/registry_echarts_theme.d.ts.map +1 -0
- package/lib/module-alias/registry_echarts_theme.js +394 -0
- package/lib/module-alias/registry_echarts_theme.js.map +1 -0
- package/lib/polyfills/index.d.ts +15 -0
- package/lib/polyfills/index.d.ts.map +1 -0
- package/lib/polyfills/index.js +36 -0
- package/lib/polyfills/index.js.map +1 -0
- package/lib/preset.d.ts +14 -0
- package/lib/preset.d.ts.map +1 -0
- package/lib/preset.js +452 -0
- package/lib/preset.js.map +1 -0
- package/lib/utils/hmr-timing.d.ts +10 -0
- package/lib/utils/hmr-timing.d.ts.map +1 -0
- package/lib/utils/hmr-timing.js +102 -0
- package/lib/utils/hmr-timing.js.map +1 -0
- package/lib/utils/normalize-base-path.d.ts +12 -0
- package/lib/utils/normalize-base-path.d.ts.map +1 -0
- package/lib/utils/normalize-base-path.js +24 -0
- package/lib/utils/normalize-base-path.js.map +1 -0
- package/lib/utils/snapdom-proxy.d.ts +8 -0
- package/lib/utils/snapdom-proxy.d.ts.map +1 -0
- package/lib/utils/snapdom-proxy.js +52 -0
- package/lib/utils/snapdom-proxy.js.map +1 -0
- package/lib/vite-plugins/banner-plugin.d.ts +3 -0
- package/lib/vite-plugins/banner-plugin.d.ts.map +1 -0
- package/lib/vite-plugins/banner-plugin.js +26 -0
- package/lib/vite-plugins/banner-plugin.js.map +1 -0
- package/lib/vite-plugins/css-legacy-plugin.d.ts +12 -0
- package/lib/vite-plugins/css-legacy-plugin.d.ts.map +1 -0
- package/lib/vite-plugins/css-legacy-plugin.js +205 -0
- package/lib/vite-plugins/css-legacy-plugin.js.map +1 -0
- package/lib/vite-plugins/error-overlay-plugin.d.ts +33 -0
- package/lib/vite-plugins/error-overlay-plugin.d.ts.map +1 -0
- package/lib/vite-plugins/error-overlay-plugin.js +129 -0
- package/lib/vite-plugins/error-overlay-plugin.js.map +1 -0
- package/lib/vite-plugins/html-output-plugin.d.ts +21 -0
- package/lib/vite-plugins/html-output-plugin.d.ts.map +1 -0
- package/lib/vite-plugins/html-output-plugin.js +171 -0
- package/lib/vite-plugins/html-output-plugin.js.map +1 -0
- package/lib/vite-plugins/module-alias-plugin.d.ts +10 -0
- package/lib/vite-plugins/module-alias-plugin.d.ts.map +1 -0
- package/lib/vite-plugins/module-alias-plugin.js +40 -0
- package/lib/vite-plugins/module-alias-plugin.js.map +1 -0
- package/lib/vite-plugins/og-meta-plugin.d.ts +17 -0
- package/lib/vite-plugins/og-meta-plugin.d.ts.map +1 -0
- package/lib/vite-plugins/og-meta-plugin.js +80 -0
- package/lib/vite-plugins/og-meta-plugin.js.map +1 -0
- package/lib/vite-plugins/polyfill-plugin.d.ts +12 -0
- package/lib/vite-plugins/polyfill-plugin.d.ts.map +1 -0
- package/lib/vite-plugins/polyfill-plugin.js +132 -0
- package/lib/vite-plugins/polyfill-plugin.js.map +1 -0
- package/lib/vite-plugins/route-parser-plugin.d.ts +13 -0
- package/lib/vite-plugins/route-parser-plugin.d.ts.map +1 -0
- package/lib/vite-plugins/route-parser-plugin.js +120 -0
- package/lib/vite-plugins/route-parser-plugin.js.map +1 -0
- package/lib/vite-plugins/runtime-injection-plugin.d.ts +23 -0
- package/lib/vite-plugins/runtime-injection-plugin.d.ts.map +1 -0
- package/lib/vite-plugins/runtime-injection-plugin.js +93 -0
- package/lib/vite-plugins/runtime-injection-plugin.js.map +1 -0
- package/lib/vite-plugins/slardar-plugin.d.ts +10 -0
- package/lib/vite-plugins/slardar-plugin.d.ts.map +1 -0
- package/lib/vite-plugins/slardar-plugin.js +102 -0
- package/lib/vite-plugins/slardar-plugin.js.map +1 -0
- package/lib/vite-plugins/source-map-upload-plugin.d.ts +7 -0
- package/lib/vite-plugins/source-map-upload-plugin.d.ts.map +1 -0
- package/lib/vite-plugins/source-map-upload-plugin.js +85 -0
- package/lib/vite-plugins/source-map-upload-plugin.js.map +1 -0
- package/lib/vite-plugins/static-assets-plugin.d.ts +27 -0
- package/lib/vite-plugins/static-assets-plugin.d.ts.map +1 -0
- package/lib/vite-plugins/static-assets-plugin.js +393 -0
- package/lib/vite-plugins/static-assets-plugin.js.map +1 -0
- package/lib/vite-plugins/view-context-plugin.d.ts +4 -0
- package/lib/vite-plugins/view-context-plugin.d.ts.map +1 -0
- package/lib/vite-plugins/view-context-plugin.js +40 -0
- package/lib/vite-plugins/view-context-plugin.js.map +1 -0
- package/lib/vite-plugins/vite-client-patch-plugin.d.ts +23 -0
- package/lib/vite-plugins/vite-client-patch-plugin.d.ts.map +1 -0
- package/lib/vite-plugins/vite-client-patch-plugin.js +53 -0
- package/lib/vite-plugins/vite-client-patch-plugin.js.map +1 -0
- package/package.json +61 -0
- package/src/empty.css +1 -0
- package/src/inspector-stub.js +6 -0
- package/src/module-alias/clsx.mjs +8 -0
- package/src/module-alias/echarts-for-react.mjs +129 -0
- package/src/module-alias/echarts.mjs +43 -0
- package/src/module-alias/registry_echarts_theme.mjs +390 -0
- package/src/overlay/components.js +94 -0
- package/src/overlay/index.js +443 -0
- package/src/overlay/vite-client.js +554 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import OriginalReactECharts from 'echarts-for-react';
|
|
3
|
+
import Color from 'colorjs.io';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Convert HSL/HSLA color to hex or rgba
|
|
7
|
+
*/
|
|
8
|
+
export function convertColorToHex(color) {
|
|
9
|
+
if (typeof color !== 'string') return color;
|
|
10
|
+
|
|
11
|
+
const trimmed = color.trim();
|
|
12
|
+
if (!trimmed.startsWith('hsl')) {
|
|
13
|
+
return color;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
try {
|
|
17
|
+
const colorObj = new Color(trimmed);
|
|
18
|
+
|
|
19
|
+
if (colorObj.alpha < 1) {
|
|
20
|
+
return colorObj.to('srgb').toString({ format: 'rgba' });
|
|
21
|
+
} else {
|
|
22
|
+
return colorObj.to('srgb').toString({ format: 'hex' });
|
|
23
|
+
}
|
|
24
|
+
} catch (error) {
|
|
25
|
+
console.warn(`Failed to convert color: ${color}`, error);
|
|
26
|
+
return color;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function convertColorValue(propValue, visited) {
|
|
31
|
+
if (typeof propValue === 'string') {
|
|
32
|
+
return convertColorToHex(propValue);
|
|
33
|
+
}
|
|
34
|
+
if (Array.isArray(propValue)) {
|
|
35
|
+
return propValue.map((item) =>
|
|
36
|
+
typeof item === 'string' ? convertColorToHex(item) : transformColors(item, visited)
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
return transformColors(propValue, visited);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Deep traverse object to transform all HSL colors in 'color' property
|
|
44
|
+
*/
|
|
45
|
+
export function transformColors(value, visited = new WeakSet()) {
|
|
46
|
+
if (value === null || value === undefined) return value;
|
|
47
|
+
if (typeof value !== 'object') return value;
|
|
48
|
+
if (visited.has(value)) return value;
|
|
49
|
+
if (value instanceof Date || value instanceof RegExp) return value;
|
|
50
|
+
|
|
51
|
+
visited.add(value);
|
|
52
|
+
|
|
53
|
+
if (Array.isArray(value)) {
|
|
54
|
+
return value.map((item) => transformColors(item, visited));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const result = {};
|
|
58
|
+
for (const key in value) {
|
|
59
|
+
if (!Object.prototype.hasOwnProperty.call(value, key)) continue;
|
|
60
|
+
|
|
61
|
+
const propValue = value[key];
|
|
62
|
+
|
|
63
|
+
if (key === 'color') {
|
|
64
|
+
if (typeof propValue === 'function') {
|
|
65
|
+
result[key] = (...args) => convertColorValue(propValue(...args), visited);
|
|
66
|
+
} else {
|
|
67
|
+
result[key] = convertColorValue(propValue, visited);
|
|
68
|
+
}
|
|
69
|
+
} else {
|
|
70
|
+
result[key] = transformColors(propValue, visited);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return result;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Remove label.color and emphasis.label.color from funnel series
|
|
79
|
+
* to let ECharts use default contrast colors
|
|
80
|
+
*/
|
|
81
|
+
function removeFunnelLabelColor(option) {
|
|
82
|
+
if (!Array.isArray(option.series)) return option;
|
|
83
|
+
|
|
84
|
+
const series = option.series.map((item) => {
|
|
85
|
+
if (item?.type !== 'funnel') return item;
|
|
86
|
+
|
|
87
|
+
let result = { ...item };
|
|
88
|
+
|
|
89
|
+
// remove label.color
|
|
90
|
+
if (result.label && typeof result.label === 'object') {
|
|
91
|
+
const { color: _, ...labelRest } = result.label;
|
|
92
|
+
result = { ...result, label: labelRest };
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// remove emphasis.label.color
|
|
96
|
+
const emphasis = result.emphasis;
|
|
97
|
+
if (emphasis?.label && typeof emphasis.label === 'object') {
|
|
98
|
+
const { color: _, ...emphasisLabelRest } = emphasis.label;
|
|
99
|
+
result = { ...result, emphasis: { ...emphasis, label: emphasisLabelRest } };
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return result;
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
return { ...option, series };
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* EChartsReact wrapper component
|
|
110
|
+
* - Automatically converts HSL colors to hex in option
|
|
111
|
+
* - Removes label.color from funnel series
|
|
112
|
+
*/
|
|
113
|
+
export class EChartsReact extends React.Component {
|
|
114
|
+
render() {
|
|
115
|
+
const { option, ...rest } = this.props;
|
|
116
|
+
|
|
117
|
+
const transformedOption = option
|
|
118
|
+
? removeFunnelLabelColor(transformColors(option))
|
|
119
|
+
: option;
|
|
120
|
+
|
|
121
|
+
return React.createElement(OriginalReactECharts, {
|
|
122
|
+
option: transformedOption,
|
|
123
|
+
...rest,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export * from 'echarts-for-react';
|
|
129
|
+
export default EChartsReact;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as echartsNamespace from 'echarts';
|
|
2
|
+
export { echartsNamespace as echarts };
|
|
3
|
+
export * from 'echarts';
|
|
4
|
+
|
|
5
|
+
import * as echarts from 'echarts';
|
|
6
|
+
import { registerTheme } from 'echarts';
|
|
7
|
+
import { getShadcnEChartsTheme } from './registry_echarts_theme.mjs';
|
|
8
|
+
|
|
9
|
+
let isRegistered = false;
|
|
10
|
+
let isWindowMounted = false;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Mount echarts to window for debugging
|
|
14
|
+
*/
|
|
15
|
+
export function registerEchartsToWindow() {
|
|
16
|
+
if (isWindowMounted || typeof globalThis.window === 'undefined') {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
isWindowMounted = true;
|
|
20
|
+
globalThis.echarts = echarts;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function resgisterEchartsTheme() {
|
|
24
|
+
// Register ud theme, only register once globally
|
|
25
|
+
if (isRegistered) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
isRegistered = true;
|
|
29
|
+
// After bundling main.js defer execution, css will be loaded
|
|
30
|
+
registerTheme('ud', getShadcnEChartsTheme());
|
|
31
|
+
|
|
32
|
+
if (process.env.NODE_ENV === 'development') {
|
|
33
|
+
// Listen for HMR update completion to re-register theme
|
|
34
|
+
if (import.meta.hot) {
|
|
35
|
+
import.meta.hot.on('vite:afterUpdate', () => {
|
|
36
|
+
registerTheme('ud', getShadcnEChartsTheme());
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
registerEchartsToWindow();
|
|
43
|
+
resgisterEchartsTheme();
|
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
import Color from 'colorjs.io';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Get the value of a CSS variable and convert it to sRGB color space hex string
|
|
5
|
+
* @param varName CSS variable name
|
|
6
|
+
* @param element Optional element, defaults to document.body
|
|
7
|
+
* @returns sRGB color space hex string
|
|
8
|
+
*/
|
|
9
|
+
export function getCssVariable(varName, element = document.body) {
|
|
10
|
+
const value = window
|
|
11
|
+
.getComputedStyle(element)
|
|
12
|
+
.getPropertyValue(varName)
|
|
13
|
+
.trim();
|
|
14
|
+
if (!value) {
|
|
15
|
+
return '';
|
|
16
|
+
}
|
|
17
|
+
return new Color(value).to('srgb').toString({ format: 'hex' });
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Generate ECharts theme configuration
|
|
21
|
+
export function generateEChartsTheme(element = document.body) {
|
|
22
|
+
// Get chart colors
|
|
23
|
+
const chartColors = [
|
|
24
|
+
getCssVariable('--chart-1', element),
|
|
25
|
+
getCssVariable('--chart-2', element),
|
|
26
|
+
getCssVariable('--chart-3', element),
|
|
27
|
+
getCssVariable('--chart-4', element),
|
|
28
|
+
getCssVariable('--chart-5', element),
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
// Get other color variables
|
|
32
|
+
const background = getCssVariable('--background', element);
|
|
33
|
+
const foreground = getCssVariable('--foreground', element);
|
|
34
|
+
const muted = getCssVariable('--muted', element);
|
|
35
|
+
const mutedForeground = getCssVariable('--muted-foreground', element);
|
|
36
|
+
const border = getCssVariable('--border', element);
|
|
37
|
+
const primary = getCssVariable('--primary', element);
|
|
38
|
+
|
|
39
|
+
const fullTheme = {
|
|
40
|
+
color: chartColors,
|
|
41
|
+
backgroundColor: 'transparent',
|
|
42
|
+
textStyle: {
|
|
43
|
+
// color: foreground,
|
|
44
|
+
},
|
|
45
|
+
title: {
|
|
46
|
+
textStyle: {
|
|
47
|
+
color: foreground,
|
|
48
|
+
},
|
|
49
|
+
subtextStyle: {
|
|
50
|
+
color: mutedForeground,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
line: {
|
|
54
|
+
itemStyle: {
|
|
55
|
+
borderWidth: 1,
|
|
56
|
+
},
|
|
57
|
+
lineStyle: {
|
|
58
|
+
width: 2,
|
|
59
|
+
},
|
|
60
|
+
symbolSize: 4,
|
|
61
|
+
symbol: 'circle',
|
|
62
|
+
smooth: false,
|
|
63
|
+
},
|
|
64
|
+
radar: {
|
|
65
|
+
itemStyle: {
|
|
66
|
+
borderWidth: 1,
|
|
67
|
+
},
|
|
68
|
+
lineStyle: {
|
|
69
|
+
width: 2,
|
|
70
|
+
},
|
|
71
|
+
symbolSize: 4,
|
|
72
|
+
symbol: 'circle',
|
|
73
|
+
smooth: false,
|
|
74
|
+
},
|
|
75
|
+
bar: {
|
|
76
|
+
itemStyle: {
|
|
77
|
+
barBorderWidth: 0,
|
|
78
|
+
barBorderColor: border,
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
pie: {
|
|
82
|
+
itemStyle: {
|
|
83
|
+
borderWidth: 0,
|
|
84
|
+
borderColor: border,
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
scatter: {
|
|
88
|
+
itemStyle: {
|
|
89
|
+
borderWidth: 0,
|
|
90
|
+
borderColor: border,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
boxplot: {
|
|
94
|
+
itemStyle: {
|
|
95
|
+
borderWidth: 0,
|
|
96
|
+
borderColor: border,
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
parallel: {
|
|
100
|
+
itemStyle: {
|
|
101
|
+
borderWidth: 0,
|
|
102
|
+
borderColor: border,
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
sankey: {
|
|
106
|
+
itemStyle: {
|
|
107
|
+
borderWidth: 0,
|
|
108
|
+
borderColor: border,
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
funnel: {
|
|
112
|
+
itemStyle: {
|
|
113
|
+
borderWidth: 0,
|
|
114
|
+
borderColor: border,
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
gauge: {
|
|
118
|
+
itemStyle: {
|
|
119
|
+
borderWidth: 0,
|
|
120
|
+
borderColor: border,
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
candlestick: {
|
|
124
|
+
itemStyle: {
|
|
125
|
+
color: chartColors[0],
|
|
126
|
+
color0: chartColors[1],
|
|
127
|
+
borderColor: chartColors[0],
|
|
128
|
+
borderColor0: chartColors[1],
|
|
129
|
+
borderWidth: 1,
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
graph: {
|
|
133
|
+
itemStyle: {
|
|
134
|
+
borderWidth: 0,
|
|
135
|
+
borderColor: border,
|
|
136
|
+
},
|
|
137
|
+
lineStyle: {
|
|
138
|
+
width: 1,
|
|
139
|
+
color: mutedForeground,
|
|
140
|
+
},
|
|
141
|
+
symbolSize: 4,
|
|
142
|
+
symbol: 'circle',
|
|
143
|
+
smooth: false,
|
|
144
|
+
color: chartColors,
|
|
145
|
+
label: {
|
|
146
|
+
color: foreground,
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
map: {
|
|
150
|
+
itemStyle: {
|
|
151
|
+
areaColor: muted,
|
|
152
|
+
borderColor: border,
|
|
153
|
+
borderWidth: 0.5,
|
|
154
|
+
},
|
|
155
|
+
label: {
|
|
156
|
+
color: foreground,
|
|
157
|
+
},
|
|
158
|
+
emphasis: {
|
|
159
|
+
itemStyle: {
|
|
160
|
+
areaColor: chartColors[0],
|
|
161
|
+
borderColor: chartColors[1],
|
|
162
|
+
borderWidth: 1,
|
|
163
|
+
},
|
|
164
|
+
label: {
|
|
165
|
+
color: foreground,
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
geo: {
|
|
170
|
+
itemStyle: {
|
|
171
|
+
areaColor: muted,
|
|
172
|
+
borderColor: border,
|
|
173
|
+
borderWidth: 0.5,
|
|
174
|
+
},
|
|
175
|
+
label: {
|
|
176
|
+
color: foreground,
|
|
177
|
+
},
|
|
178
|
+
emphasis: {
|
|
179
|
+
itemStyle: {
|
|
180
|
+
areaColor: chartColors[0],
|
|
181
|
+
borderColor: chartColors[1],
|
|
182
|
+
borderWidth: 1,
|
|
183
|
+
},
|
|
184
|
+
label: {
|
|
185
|
+
color: foreground,
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
categoryAxis: {
|
|
190
|
+
axisLine: {
|
|
191
|
+
show: true,
|
|
192
|
+
lineStyle: {
|
|
193
|
+
color: border,
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
axisTick: {
|
|
197
|
+
show: true,
|
|
198
|
+
lineStyle: {
|
|
199
|
+
color: border,
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
axisLabel: {
|
|
203
|
+
show: true,
|
|
204
|
+
color: mutedForeground,
|
|
205
|
+
},
|
|
206
|
+
splitLine: {
|
|
207
|
+
show: false,
|
|
208
|
+
lineStyle: {
|
|
209
|
+
color: [border],
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
splitArea: {
|
|
213
|
+
show: false,
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
valueAxis: {
|
|
217
|
+
axisLine: {
|
|
218
|
+
show: true,
|
|
219
|
+
lineStyle: {
|
|
220
|
+
color: border,
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
axisTick: {
|
|
224
|
+
show: true,
|
|
225
|
+
lineStyle: {
|
|
226
|
+
color: border,
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
axisLabel: {
|
|
230
|
+
show: true,
|
|
231
|
+
color: mutedForeground,
|
|
232
|
+
},
|
|
233
|
+
splitLine: {
|
|
234
|
+
show: true,
|
|
235
|
+
lineStyle: {
|
|
236
|
+
color: [border],
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
splitArea: {
|
|
240
|
+
show: false,
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
logAxis: {
|
|
244
|
+
axisLine: {
|
|
245
|
+
show: true,
|
|
246
|
+
lineStyle: {
|
|
247
|
+
color: border,
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
axisTick: {
|
|
251
|
+
show: true,
|
|
252
|
+
lineStyle: {
|
|
253
|
+
color: border,
|
|
254
|
+
},
|
|
255
|
+
},
|
|
256
|
+
axisLabel: {
|
|
257
|
+
show: true,
|
|
258
|
+
color: mutedForeground,
|
|
259
|
+
},
|
|
260
|
+
splitLine: {
|
|
261
|
+
show: true,
|
|
262
|
+
lineStyle: {
|
|
263
|
+
color: [border],
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
splitArea: {
|
|
267
|
+
show: false,
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
timeAxis: {
|
|
271
|
+
axisLine: {
|
|
272
|
+
show: true,
|
|
273
|
+
lineStyle: {
|
|
274
|
+
color: border,
|
|
275
|
+
},
|
|
276
|
+
},
|
|
277
|
+
axisTick: {
|
|
278
|
+
show: true,
|
|
279
|
+
lineStyle: {
|
|
280
|
+
color: border,
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
axisLabel: {
|
|
284
|
+
show: true,
|
|
285
|
+
color: mutedForeground,
|
|
286
|
+
},
|
|
287
|
+
splitLine: {
|
|
288
|
+
show: true,
|
|
289
|
+
lineStyle: {
|
|
290
|
+
color: [border],
|
|
291
|
+
},
|
|
292
|
+
},
|
|
293
|
+
splitArea: {
|
|
294
|
+
show: false,
|
|
295
|
+
},
|
|
296
|
+
},
|
|
297
|
+
toolbox: {
|
|
298
|
+
iconStyle: {
|
|
299
|
+
borderColor: mutedForeground,
|
|
300
|
+
},
|
|
301
|
+
emphasis: {
|
|
302
|
+
iconStyle: {
|
|
303
|
+
borderColor: primary,
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
legend: {
|
|
308
|
+
textStyle: {
|
|
309
|
+
color: foreground,
|
|
310
|
+
},
|
|
311
|
+
},
|
|
312
|
+
tooltip: {
|
|
313
|
+
axisPointer: {
|
|
314
|
+
lineStyle: {
|
|
315
|
+
color: border,
|
|
316
|
+
width: 1,
|
|
317
|
+
},
|
|
318
|
+
crossStyle: {
|
|
319
|
+
color: border,
|
|
320
|
+
width: 1,
|
|
321
|
+
},
|
|
322
|
+
},
|
|
323
|
+
},
|
|
324
|
+
timeline: {
|
|
325
|
+
lineStyle: {
|
|
326
|
+
color: primary,
|
|
327
|
+
width: 1,
|
|
328
|
+
},
|
|
329
|
+
itemStyle: {
|
|
330
|
+
color: primary,
|
|
331
|
+
borderWidth: 1,
|
|
332
|
+
},
|
|
333
|
+
controlStyle: {
|
|
334
|
+
color: primary,
|
|
335
|
+
borderColor: primary,
|
|
336
|
+
borderWidth: 0.5,
|
|
337
|
+
},
|
|
338
|
+
checkpointStyle: {
|
|
339
|
+
color: chartColors[1],
|
|
340
|
+
borderColor: chartColors[1],
|
|
341
|
+
},
|
|
342
|
+
label: {
|
|
343
|
+
color: mutedForeground,
|
|
344
|
+
},
|
|
345
|
+
emphasis: {
|
|
346
|
+
itemStyle: {
|
|
347
|
+
color: chartColors[1],
|
|
348
|
+
},
|
|
349
|
+
controlStyle: {
|
|
350
|
+
color: primary,
|
|
351
|
+
borderColor: primary,
|
|
352
|
+
borderWidth: 0.5,
|
|
353
|
+
},
|
|
354
|
+
label: {
|
|
355
|
+
color: mutedForeground,
|
|
356
|
+
},
|
|
357
|
+
},
|
|
358
|
+
},
|
|
359
|
+
visualMap: {
|
|
360
|
+
color: [chartColors[0], chartColors[2]],
|
|
361
|
+
},
|
|
362
|
+
dataZoom: {
|
|
363
|
+
backgroundColor: background,
|
|
364
|
+
dataBackgroundColor: border,
|
|
365
|
+
fillerColor: `${chartColors[0]}40`, // 25% opacity
|
|
366
|
+
handleColor: primary,
|
|
367
|
+
handleSize: '100%',
|
|
368
|
+
textStyle: {
|
|
369
|
+
color: foreground,
|
|
370
|
+
},
|
|
371
|
+
},
|
|
372
|
+
markPoint: {
|
|
373
|
+
label: {
|
|
374
|
+
color: foreground,
|
|
375
|
+
},
|
|
376
|
+
emphasis: {
|
|
377
|
+
label: {
|
|
378
|
+
color: foreground,
|
|
379
|
+
},
|
|
380
|
+
},
|
|
381
|
+
},
|
|
382
|
+
};
|
|
383
|
+
return fullTheme;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
// Get current theme's ECharts configuration
|
|
387
|
+
export function getShadcnEChartsTheme() {
|
|
388
|
+
// body
|
|
389
|
+
return generateEChartsTheme(document.body);
|
|
390
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 错误容器组件
|
|
3
|
+
* @param {*} document
|
|
4
|
+
* @param {*} root
|
|
5
|
+
* @param {string} errorTitle 错误标题
|
|
6
|
+
*/
|
|
7
|
+
function ErrorContainer(document, root, errorTitle) {
|
|
8
|
+
// 创建容器元素
|
|
9
|
+
const container = document.createElement('div');
|
|
10
|
+
container.className = 'overlay-container';
|
|
11
|
+
|
|
12
|
+
// 创建内容元素
|
|
13
|
+
const content = document.createElement('div');
|
|
14
|
+
content.className = 'overlay-content';
|
|
15
|
+
container.appendChild(content);
|
|
16
|
+
|
|
17
|
+
// 创建图片元素
|
|
18
|
+
const img = document.createElement('img');
|
|
19
|
+
img.src =
|
|
20
|
+
'https://lf3-static.bytednsdoc.com/obj/eden-cn/ylcylz_fsph_ryhs/ljhwZthlaukjlkulzlp/feisuda/template/illustration_empty_negative_error.svg';
|
|
21
|
+
img.alt = 'Error';
|
|
22
|
+
// 图片占位
|
|
23
|
+
img.width = 100;
|
|
24
|
+
img.height = 100;
|
|
25
|
+
img.className = 'overlay-error-image';
|
|
26
|
+
content.appendChild(img);
|
|
27
|
+
|
|
28
|
+
// 创建标题元素
|
|
29
|
+
const title = document.createElement('p');
|
|
30
|
+
title.className = 'overlay-title';
|
|
31
|
+
title.textContent = errorTitle;
|
|
32
|
+
content.appendChild(title);
|
|
33
|
+
|
|
34
|
+
// 添加到根元素
|
|
35
|
+
root.appendChild(container);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function RootStyle(document, root) {
|
|
39
|
+
const style = document.createElement('style');
|
|
40
|
+
style.id = 'react-refresh-overlay-style';
|
|
41
|
+
style.textContent = `
|
|
42
|
+
* {
|
|
43
|
+
margin: 0;
|
|
44
|
+
padding: 0;
|
|
45
|
+
box-sizing: border-box;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
body {
|
|
49
|
+
font-family: "PingFang SC", -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
|
50
|
+
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
|
51
|
+
sans-serif;
|
|
52
|
+
-webkit-font-smoothing: antialiased;
|
|
53
|
+
-moz-osx-font-smoothing: grayscale;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.overlay-container {
|
|
57
|
+
min-height: 100vh;
|
|
58
|
+
display: flex;
|
|
59
|
+
align-items: center;
|
|
60
|
+
justify-content: center;
|
|
61
|
+
background-color: #fff;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.overlay-content {
|
|
65
|
+
display: flex;
|
|
66
|
+
flex-direction: column;
|
|
67
|
+
justify-content: center;
|
|
68
|
+
align-items: center;
|
|
69
|
+
text-align: center;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.overlay-error-image {
|
|
73
|
+
margin-bottom: 12px; /* mb-3 */
|
|
74
|
+
width: 100px; /* w-[100px] */
|
|
75
|
+
height: auto;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.overlay-title {
|
|
79
|
+
color: #1F2329;
|
|
80
|
+
text-align: center;
|
|
81
|
+
font-size: 14px;
|
|
82
|
+
font-style: normal;
|
|
83
|
+
font-weight: 500;
|
|
84
|
+
line-height: 22px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
`;
|
|
88
|
+
root.appendChild(style);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
module.exports = {
|
|
92
|
+
ErrorContainer,
|
|
93
|
+
RootStyle,
|
|
94
|
+
};
|