@lark-apaas/fullstack-vite-preset 1.0.2-alpha.3 → 1.0.2-alpha.5
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/lib/module-alias/echarts.d.ts +1 -6
- package/lib/module-alias/echarts.d.ts.map +1 -1
- package/lib/module-alias/echarts.js +10 -45
- package/lib/module-alias/echarts.js.map +1 -1
- package/lib/vite-plugins/module-alias-plugin.d.ts.map +1 -1
- package/lib/vite-plugins/module-alias-plugin.js +0 -4
- package/lib/vite-plugins/module-alias-plugin.js.map +1 -1
- package/package.json +2 -4
- package/src/module-alias/echarts.mjs +1 -16
- package/lib/module-alias/echarts-for-react.d.ts +0 -12
- package/lib/module-alias/echarts-for-react.d.ts.map +0 -1
- package/lib/module-alias/echarts-for-react.js +0 -106
- package/lib/module-alias/echarts-for-react.js.map +0 -1
- package/src/module-alias/echarts-for-react.mjs +0 -86
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export { echartsNamespace as echarts };
|
|
1
|
+
export { default as echarts } from 'echarts';
|
|
3
2
|
export * from 'echarts';
|
|
4
|
-
/**
|
|
5
|
-
* Mount echarts to window for debugging
|
|
6
|
-
*/
|
|
7
|
-
export declare function registerEchartsToWindow(): void;
|
|
8
3
|
export declare function resgisterEchartsTheme(): void;
|
|
9
4
|
//# sourceMappingURL=echarts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"echarts.d.ts","sourceRoot":"","sources":["../../src/module-alias/echarts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"echarts.d.ts","sourceRoot":"","sources":["../../src/module-alias/echarts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,SAAS,CAAC;AAC7C,cAAc,SAAS,CAAC;AAOxB,wBAAgB,qBAAqB,IAAI,IAAI,CAoB5C"}
|
|
@@ -10,55 +10,22 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
11
|
o[k2] = m[k];
|
|
12
12
|
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
36
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
15
|
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
38
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
20
|
exports.echarts = void 0;
|
|
40
|
-
exports.registerEchartsToWindow = registerEchartsToWindow;
|
|
41
21
|
exports.resgisterEchartsTheme = resgisterEchartsTheme;
|
|
42
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
43
22
|
// @ts-nocheck - echarts types are complex, ignore for re-export
|
|
44
|
-
|
|
45
|
-
exports
|
|
23
|
+
var echarts_1 = require("echarts");
|
|
24
|
+
Object.defineProperty(exports, "echarts", { enumerable: true, get: function () { return __importDefault(echarts_1).default; } });
|
|
46
25
|
__exportStar(require("echarts"), exports);
|
|
47
|
-
const
|
|
48
|
-
const echarts_1 = require("echarts");
|
|
26
|
+
const echarts_2 = require("echarts");
|
|
49
27
|
const registry_echarts_theme_1 = require("./registry_echarts_theme");
|
|
50
28
|
let isRegistered = false;
|
|
51
|
-
let isWindowMounted = false;
|
|
52
|
-
/**
|
|
53
|
-
* Mount echarts to window for debugging
|
|
54
|
-
*/
|
|
55
|
-
function registerEchartsToWindow() {
|
|
56
|
-
if (isWindowMounted || typeof globalThis.window === 'undefined') {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
isWindowMounted = true;
|
|
60
|
-
globalThis.echarts = echarts;
|
|
61
|
-
}
|
|
62
29
|
function resgisterEchartsTheme() {
|
|
63
30
|
// Register ud theme, only register once globally
|
|
64
31
|
if (isRegistered) {
|
|
@@ -66,20 +33,18 @@ function resgisterEchartsTheme() {
|
|
|
66
33
|
}
|
|
67
34
|
isRegistered = true;
|
|
68
35
|
// After bundling main.js defer execution, css will be loaded
|
|
69
|
-
(0,
|
|
36
|
+
(0, echarts_2.registerTheme)('ud', (0, registry_echarts_theme_1.getShadcnEChartsTheme)());
|
|
70
37
|
if (process.env.NODE_ENV === 'development') {
|
|
71
38
|
// Listen for HMR update completion to re-register theme
|
|
72
39
|
// Vite uses import.meta.hot instead of webpack's module.hot
|
|
73
|
-
// @ts-
|
|
40
|
+
// @ts-ignore - import.meta.hot is Vite-specific
|
|
74
41
|
if (import.meta.hot) {
|
|
75
|
-
//
|
|
76
|
-
// @ts-expect-error
|
|
42
|
+
// @ts-ignore
|
|
77
43
|
import.meta.hot.on('vite:afterUpdate', () => {
|
|
78
|
-
(0,
|
|
44
|
+
(0, echarts_2.registerTheme)('ud', (0, registry_echarts_theme_1.getShadcnEChartsTheme)());
|
|
79
45
|
});
|
|
80
46
|
}
|
|
81
47
|
}
|
|
82
48
|
}
|
|
83
|
-
registerEchartsToWindow();
|
|
84
49
|
resgisterEchartsTheme();
|
|
85
50
|
//# sourceMappingURL=echarts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"echarts.js","sourceRoot":"","sources":["../../src/module-alias/echarts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"echarts.js","sourceRoot":"","sources":["../../src/module-alias/echarts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AASA,sDAoBC;AA7BD,gEAAgE;AAChE,mCAA6C;AAApC,mHAAA,OAAO,OAAW;AAC3B,0CAAwB;AAExB,qCAAwC;AACxC,qEAAiE;AAEjE,IAAI,YAAY,GAAG,KAAK,CAAC;AAEzB,SAAgB,qBAAqB;IACnC,iDAAiD;IACjD,IAAI,YAAY,EAAE,CAAC;QACjB,OAAO;IACT,CAAC;IACD,YAAY,GAAG,IAAI,CAAC;IACpB,6DAA6D;IAC7D,IAAA,uBAAa,EAAC,IAAI,EAAE,IAAA,8CAAqB,GAAE,CAAC,CAAC;IAE7C,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE,CAAC;QAC3C,wDAAwD;QACxD,4DAA4D;QAC5D,gDAAgD;QAChD,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;YACpB,aAAa;YACb,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,kBAAkB,EAAE,GAAG,EAAE;gBAC1C,IAAA,uBAAa,EAAC,IAAI,EAAE,IAAA,8CAAqB,GAAE,CAAC,CAAC;YAC/C,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;AACH,CAAC;AAED,qBAAqB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-alias-plugin.d.ts","sourceRoot":"","sources":["../../src/vite-plugins/module-alias-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAGnC;;;;;GAKG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"module-alias-plugin.d.ts","sourceRoot":"","sources":["../../src/vite-plugins/module-alias-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAGnC;;;;;GAKG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAwB1C;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -28,10 +28,6 @@ function moduleAliasPlugin() {
|
|
|
28
28
|
if (source === 'echarts') {
|
|
29
29
|
return path_1.default.resolve(__dirname, '../../src/module-alias/echarts.mjs');
|
|
30
30
|
}
|
|
31
|
-
// Replace 'echarts-for-react' with our wrapper (ESM version in src/)
|
|
32
|
-
if (source === 'echarts-for-react') {
|
|
33
|
-
return path_1.default.resolve(__dirname, '../../src/module-alias/echarts-for-react.mjs');
|
|
34
|
-
}
|
|
35
31
|
return null;
|
|
36
32
|
},
|
|
37
33
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-alias-plugin.js","sourceRoot":"","sources":["../../src/vite-plugins/module-alias-plugin.ts"],"names":[],"mappings":";;;;;AASA,
|
|
1
|
+
{"version":3,"file":"module-alias-plugin.js","sourceRoot":"","sources":["../../src/vite-plugins/module-alias-plugin.ts"],"names":[],"mappings":";;;;;AASA,8CAwBC;AAhCD,gDAAwB;AAExB;;;;;GAKG;AACH,SAAgB,iBAAiB;IAC/B,OAAO;QACL,IAAI,EAAE,wBAAwB;QAC9B,OAAO,EAAE,KAAK;QAEd,SAAS,CAAC,MAAM,EAAE,QAAQ;YACxB,wDAAwD;YACxD,IAAI,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;gBAClD,OAAO,IAAI,CAAC;YACd,CAAC;YAED,wDAAwD;YACxD,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;gBACtB,OAAO,cAAI,CAAC,OAAO,CAAC,SAAS,EAAE,iCAAiC,CAAC,CAAC;YACpE,CAAC;YAED,2DAA2D;YAC3D,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;gBACzB,OAAO,cAAI,CAAC,OAAO,CAAC,SAAS,EAAE,oCAAoC,CAAC,CAAC;YACvE,CAAC;YAED,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC;AAED,kBAAe,iBAAiB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-apaas/fullstack-vite-preset",
|
|
3
|
-
"version": "1.0.2-alpha.
|
|
3
|
+
"version": "1.0.2-alpha.5",
|
|
4
4
|
"files": [
|
|
5
5
|
"lib",
|
|
6
6
|
"src/empty.css",
|
|
7
7
|
"src/inspector-stub.js",
|
|
8
8
|
"src/module-alias/clsx.mjs",
|
|
9
9
|
"src/module-alias/echarts.mjs",
|
|
10
|
-
"src/module-alias/echarts-for-react.mjs",
|
|
11
10
|
"src/module-alias/registry_echarts_theme.mjs",
|
|
12
11
|
"src/overlay"
|
|
13
12
|
],
|
|
@@ -33,7 +32,7 @@
|
|
|
33
32
|
"@babel/parser": "^7.28.0",
|
|
34
33
|
"@babel/traverse": "^7.28.0",
|
|
35
34
|
"@babel/types": "^7.28.2",
|
|
36
|
-
"@lark-apaas/devtool-kits": "
|
|
35
|
+
"@lark-apaas/devtool-kits": "1.2.17-alpha.27",
|
|
37
36
|
"@lark-apaas/miaoda-inspector-jsx-runtime": "^1.0.1",
|
|
38
37
|
"@lark-apaas/vite-inspector-plugin": "^1.0.1",
|
|
39
38
|
"@vitejs/plugin-react": "^4.5.0",
|
|
@@ -41,7 +40,6 @@
|
|
|
41
40
|
"colorjs.io": "^0.5.2",
|
|
42
41
|
"dotenv": "^16.4.5",
|
|
43
42
|
"echarts": "^6.0.0",
|
|
44
|
-
"echarts-for-react": "^3.0.2",
|
|
45
43
|
"postcss-import": "^16.1.1",
|
|
46
44
|
"styled-jsx": "^5.1.6",
|
|
47
45
|
"tailwind-merge": "^2.5.5",
|
|
@@ -1,24 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
export { echartsNamespace as echarts };
|
|
1
|
+
export { default as echarts } from 'echarts';
|
|
3
2
|
export * from 'echarts';
|
|
4
3
|
|
|
5
|
-
import * as echarts from 'echarts';
|
|
6
4
|
import { registerTheme } from 'echarts';
|
|
7
5
|
import { getShadcnEChartsTheme } from './registry_echarts_theme.mjs';
|
|
8
6
|
|
|
9
7
|
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
8
|
|
|
23
9
|
export function resgisterEchartsTheme() {
|
|
24
10
|
// Register ud theme, only register once globally
|
|
@@ -39,5 +25,4 @@ export function resgisterEchartsTheme() {
|
|
|
39
25
|
}
|
|
40
26
|
}
|
|
41
27
|
|
|
42
|
-
registerEchartsToWindow();
|
|
43
28
|
resgisterEchartsTheme();
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { EChartsReactProps } from 'echarts-for-react';
|
|
3
|
-
/**
|
|
4
|
-
* EChartsReact wrapper component
|
|
5
|
-
* - Automatically converts HSL colors to hex in option
|
|
6
|
-
*/
|
|
7
|
-
export declare class EChartsReact extends React.Component<EChartsReactProps> {
|
|
8
|
-
render(): React.CElement<any, React.Component<any, any, any>>;
|
|
9
|
-
}
|
|
10
|
-
export * from 'echarts-for-react';
|
|
11
|
-
export default EChartsReact;
|
|
12
|
-
//# sourceMappingURL=echarts-for-react.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"echarts-for-react.d.ts","sourceRoot":"","sources":["../../src/module-alias/echarts-for-react.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAoE3D;;;GAGG;AACH,qBAAa,YAAa,SAAQ,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC;IAClE,MAAM;CASP;AAED,cAAc,mBAAmB,CAAC;AAClC,eAAe,YAAY,CAAC"}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
-
};
|
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.EChartsReact = void 0;
|
|
21
|
-
// @ts-nocheck - echarts-for-react types, ignore for re-export
|
|
22
|
-
const react_1 = __importDefault(require("react"));
|
|
23
|
-
const echarts_for_react_1 = __importDefault(require("echarts-for-react"));
|
|
24
|
-
const colorjs_io_1 = __importDefault(require("colorjs.io"));
|
|
25
|
-
/**
|
|
26
|
-
* Convert HSL/HSLA color to hex or rgba
|
|
27
|
-
*/
|
|
28
|
-
function convertColorToHex(color) {
|
|
29
|
-
if (typeof color !== 'string')
|
|
30
|
-
return color;
|
|
31
|
-
const trimmed = color.trim();
|
|
32
|
-
if (!trimmed.startsWith('hsl')) {
|
|
33
|
-
return color;
|
|
34
|
-
}
|
|
35
|
-
try {
|
|
36
|
-
const colorObj = new colorjs_io_1.default(trimmed);
|
|
37
|
-
if (colorObj.alpha < 1) {
|
|
38
|
-
return colorObj.to('srgb').toString({ format: 'rgba' });
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
return colorObj.to('srgb').toString({ format: 'hex' });
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
catch (error) {
|
|
45
|
-
console.warn(`Failed to convert color: ${color}`, error);
|
|
46
|
-
return color;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Deep traverse object to transform all HSL colors in 'color' property
|
|
51
|
-
*/
|
|
52
|
-
function transformColors(value, visited = new WeakSet()) {
|
|
53
|
-
if (value === null || value === undefined)
|
|
54
|
-
return value;
|
|
55
|
-
if (typeof value !== 'object')
|
|
56
|
-
return value;
|
|
57
|
-
if (visited.has(value))
|
|
58
|
-
return value;
|
|
59
|
-
if (value instanceof Date || value instanceof RegExp)
|
|
60
|
-
return value;
|
|
61
|
-
if (typeof value === 'function')
|
|
62
|
-
return value;
|
|
63
|
-
visited.add(value);
|
|
64
|
-
if (Array.isArray(value)) {
|
|
65
|
-
return value.map((item) => transformColors(item, visited));
|
|
66
|
-
}
|
|
67
|
-
const result = {};
|
|
68
|
-
for (const key in value) {
|
|
69
|
-
if (!Object.prototype.hasOwnProperty.call(value, key))
|
|
70
|
-
continue;
|
|
71
|
-
const propValue = value[key];
|
|
72
|
-
if (key === 'color') {
|
|
73
|
-
if (typeof propValue === 'string') {
|
|
74
|
-
result[key] = convertColorToHex(propValue);
|
|
75
|
-
}
|
|
76
|
-
else if (Array.isArray(propValue)) {
|
|
77
|
-
result[key] = propValue.map((item) => typeof item === 'string' ? convertColorToHex(item) : transformColors(item, visited));
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
result[key] = transformColors(propValue, visited);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
result[key] = transformColors(propValue, visited);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return result;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* EChartsReact wrapper component
|
|
91
|
-
* - Automatically converts HSL colors to hex in option
|
|
92
|
-
*/
|
|
93
|
-
class EChartsReact extends react_1.default.Component {
|
|
94
|
-
render() {
|
|
95
|
-
const { option, ...rest } = this.props;
|
|
96
|
-
const transformedOption = option ? transformColors(option) : option;
|
|
97
|
-
return react_1.default.createElement(echarts_for_react_1.default, {
|
|
98
|
-
option: transformedOption,
|
|
99
|
-
...rest,
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
exports.EChartsReact = EChartsReact;
|
|
104
|
-
__exportStar(require("echarts-for-react"), exports);
|
|
105
|
-
exports.default = EChartsReact;
|
|
106
|
-
//# sourceMappingURL=echarts-for-react.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"echarts-for-react.js","sourceRoot":"","sources":["../../src/module-alias/echarts-for-react.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,8DAA8D;AAC9D,kDAA0B;AAC1B,0EAAqD;AAErD,4DAA+B;AAE/B;;GAEG;AACH,SAAS,iBAAiB,CAAC,KAAa;IACtC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAE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,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QACvC,MAAM,iBAAiB,GAAG,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QAEpE,OAAO,eAAK,CAAC,aAAa,CAAC,2BAAoB,EAAE;YAC/C,MAAM,EAAE,iBAAiB;YACzB,GAAG,IAAI;SACR,CAAC,CAAC;IACL,CAAC;CACF;AAVD,oCAUC;AAED,oDAAkC;AAClC,kBAAe,YAAY,CAAC"}
|
|
@@ -1,86 +0,0 @@
|
|
|
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
|
-
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
|
-
/**
|
|
31
|
-
* Deep traverse object to transform all HSL colors in 'color' property
|
|
32
|
-
*/
|
|
33
|
-
function transformColors(value, visited = new WeakSet()) {
|
|
34
|
-
if (value === null || value === undefined) return value;
|
|
35
|
-
if (typeof value !== 'object') return value;
|
|
36
|
-
if (visited.has(value)) return value;
|
|
37
|
-
if (value instanceof Date || value instanceof RegExp) return value;
|
|
38
|
-
if (typeof value === 'function') return value;
|
|
39
|
-
|
|
40
|
-
visited.add(value);
|
|
41
|
-
|
|
42
|
-
if (Array.isArray(value)) {
|
|
43
|
-
return value.map((item) => transformColors(item, visited));
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const result = {};
|
|
47
|
-
for (const key in value) {
|
|
48
|
-
if (!Object.prototype.hasOwnProperty.call(value, key)) continue;
|
|
49
|
-
|
|
50
|
-
const propValue = value[key];
|
|
51
|
-
|
|
52
|
-
if (key === 'color') {
|
|
53
|
-
if (typeof propValue === 'string') {
|
|
54
|
-
result[key] = convertColorToHex(propValue);
|
|
55
|
-
} else if (Array.isArray(propValue)) {
|
|
56
|
-
result[key] = propValue.map((item) =>
|
|
57
|
-
typeof item === 'string' ? convertColorToHex(item) : transformColors(item, visited)
|
|
58
|
-
);
|
|
59
|
-
} else {
|
|
60
|
-
result[key] = transformColors(propValue, visited);
|
|
61
|
-
}
|
|
62
|
-
} else {
|
|
63
|
-
result[key] = transformColors(propValue, visited);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return result;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* EChartsReact wrapper component
|
|
72
|
-
*/
|
|
73
|
-
export class EChartsReact extends React.Component {
|
|
74
|
-
render() {
|
|
75
|
-
const { option, ...rest } = this.props;
|
|
76
|
-
const transformedOption = option ? transformColors(option) : option;
|
|
77
|
-
|
|
78
|
-
return React.createElement(OriginalReactECharts, {
|
|
79
|
-
option: transformedOption,
|
|
80
|
-
...rest,
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export * from 'echarts-for-react';
|
|
86
|
-
export default EChartsReact;
|