@lark-apaas/fullstack-vite-preset 1.0.2 → 1.0.3
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-for-react.d.ts +21 -0
- package/lib/module-alias/echarts-for-react.d.ts.map +1 -0
- package/lib/module-alias/echarts-for-react.js +108 -0
- package/lib/module-alias/echarts-for-react.js.map +1 -0
- package/lib/module-alias/echarts.d.ts +2 -1
- package/lib/module-alias/echarts.d.ts.map +1 -1
- package/lib/module-alias/echarts.js +27 -8
- package/lib/module-alias/echarts.js.map +1 -1
- package/package.json +2 -2
- package/src/module-alias/echarts.mjs +2 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import OriginalReactECharts from 'echarts-for-react';
|
|
3
|
+
import type { EChartsReactProps } from 'echarts-for-react';
|
|
4
|
+
/**
|
|
5
|
+
* Convert HSL/HSLA color to hex or rgba
|
|
6
|
+
*/
|
|
7
|
+
export declare function convertColorToHex(color: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* Deep traverse object to transform all HSL colors in 'color' property
|
|
10
|
+
*/
|
|
11
|
+
export declare function transformColors<T>(value: T, visited?: WeakSet<object>): T;
|
|
12
|
+
/**
|
|
13
|
+
* EChartsReact wrapper component
|
|
14
|
+
* - Automatically converts HSL colors to hex in option
|
|
15
|
+
*/
|
|
16
|
+
export declare class EChartsReact extends React.Component<EChartsReactProps> {
|
|
17
|
+
render(): React.CElement<EChartsReactProps, OriginalReactECharts>;
|
|
18
|
+
}
|
|
19
|
+
export * from 'echarts-for-react';
|
|
20
|
+
export default EChartsReact;
|
|
21
|
+
//# sourceMappingURL=echarts-for-react.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"echarts-for-react.d.ts","sourceRoot":"","sources":["../../src/module-alias/echarts-for-react.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,oBAAoB,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAG3D;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAoBvD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,kBAAwB,GAAG,CAAC,CAqC/E;AAED;;;GAGG;AACH,qBAAa,YAAa,SAAQ,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC;IAClE,MAAM;CASP;AAED,cAAc,mBAAmB,CAAC;AAClC,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
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
|
+
exports.convertColorToHex = convertColorToHex;
|
|
22
|
+
exports.transformColors = transformColors;
|
|
23
|
+
const react_1 = __importDefault(require("react"));
|
|
24
|
+
const echarts_for_react_1 = __importDefault(require("echarts-for-react"));
|
|
25
|
+
const colorjs_io_1 = __importDefault(require("colorjs.io"));
|
|
26
|
+
/**
|
|
27
|
+
* Convert HSL/HSLA color to hex or rgba
|
|
28
|
+
*/
|
|
29
|
+
function convertColorToHex(color) {
|
|
30
|
+
if (typeof color !== 'string')
|
|
31
|
+
return color;
|
|
32
|
+
const trimmed = color.trim();
|
|
33
|
+
if (!trimmed.startsWith('hsl')) {
|
|
34
|
+
return color;
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
const colorObj = new colorjs_io_1.default(trimmed);
|
|
38
|
+
if (colorObj.alpha < 1) {
|
|
39
|
+
return colorObj.to('srgb').toString({ format: 'rgba' });
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
return colorObj.to('srgb').toString({ format: 'hex' });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
console.warn(`Failed to convert color: ${color}`, error);
|
|
47
|
+
return color;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Deep traverse object to transform all HSL colors in 'color' property
|
|
52
|
+
*/
|
|
53
|
+
function transformColors(value, visited = new WeakSet()) {
|
|
54
|
+
if (value === null || value === undefined)
|
|
55
|
+
return value;
|
|
56
|
+
if (typeof value !== 'object')
|
|
57
|
+
return value;
|
|
58
|
+
if (visited.has(value))
|
|
59
|
+
return value;
|
|
60
|
+
if (value instanceof Date || value instanceof RegExp)
|
|
61
|
+
return value;
|
|
62
|
+
if (typeof value === 'function')
|
|
63
|
+
return value;
|
|
64
|
+
visited.add(value);
|
|
65
|
+
if (Array.isArray(value)) {
|
|
66
|
+
return value.map((item) => transformColors(item, visited));
|
|
67
|
+
}
|
|
68
|
+
const obj = value;
|
|
69
|
+
const result = {};
|
|
70
|
+
for (const key in obj) {
|
|
71
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
72
|
+
continue;
|
|
73
|
+
const propValue = obj[key];
|
|
74
|
+
if (key === 'color') {
|
|
75
|
+
if (typeof propValue === 'string') {
|
|
76
|
+
result[key] = convertColorToHex(propValue);
|
|
77
|
+
}
|
|
78
|
+
else if (Array.isArray(propValue)) {
|
|
79
|
+
result[key] = propValue.map((item) => typeof item === 'string' ? convertColorToHex(item) : transformColors(item, visited));
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
result[key] = transformColors(propValue, visited);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
result[key] = transformColors(propValue, visited);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return result;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* EChartsReact wrapper component
|
|
93
|
+
* - Automatically converts HSL colors to hex in option
|
|
94
|
+
*/
|
|
95
|
+
class EChartsReact extends react_1.default.Component {
|
|
96
|
+
render() {
|
|
97
|
+
const { option, ...rest } = this.props;
|
|
98
|
+
const transformedOption = option ? transformColors(option) : option;
|
|
99
|
+
return react_1.default.createElement(echarts_for_react_1.default, {
|
|
100
|
+
option: transformedOption,
|
|
101
|
+
...rest,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
exports.EChartsReact = EChartsReact;
|
|
106
|
+
__exportStar(require("echarts-for-react"), exports);
|
|
107
|
+
exports.default = EChartsReact;
|
|
108
|
+
//# sourceMappingURL=echarts-for-react.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"echarts-for-react.js","sourceRoot":"","sources":["../../src/module-alias/echarts-for-react.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAQA,8CAoBC;AAKD,0CAqCC;AAtED,kDAA0B;AAC1B,0EAAqD;AAErD,4DAA+B;AAE/B;;GAEG;AACH,SAAgB,iBAAiB,CAAC,KAAa;IAC7C,IAAI,OAAO,KAAK,KAA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,eAAK,CAAC,SAA4B;IAClE,MAAM;QACJ,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"echarts.d.ts","sourceRoot":"","sources":["../../src/module-alias/echarts.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"echarts.d.ts","sourceRoot":"","sources":["../../src/module-alias/echarts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,gBAAgB,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,gBAAgB,IAAI,OAAO,EAAE,CAAC;AACvC,cAAc,SAAS,CAAC;AAOxB,wBAAgB,qBAAqB,IAAI,IAAI,CAoB5C"}
|
|
@@ -10,20 +10,39 @@ 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
|
+
})();
|
|
13
35
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
36
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
37
|
};
|
|
16
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
-
};
|
|
19
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
39
|
exports.echarts = void 0;
|
|
21
40
|
exports.resgisterEchartsTheme = resgisterEchartsTheme;
|
|
22
41
|
// @ts-nocheck - echarts types are complex, ignore for re-export
|
|
23
|
-
|
|
24
|
-
|
|
42
|
+
const echartsNamespace = __importStar(require("echarts"));
|
|
43
|
+
exports.echarts = echartsNamespace;
|
|
25
44
|
__exportStar(require("echarts"), exports);
|
|
26
|
-
const
|
|
45
|
+
const echarts_1 = require("echarts");
|
|
27
46
|
const registry_echarts_theme_1 = require("./registry_echarts_theme");
|
|
28
47
|
let isRegistered = false;
|
|
29
48
|
function resgisterEchartsTheme() {
|
|
@@ -33,7 +52,7 @@ function resgisterEchartsTheme() {
|
|
|
33
52
|
}
|
|
34
53
|
isRegistered = true;
|
|
35
54
|
// After bundling main.js defer execution, css will be loaded
|
|
36
|
-
(0,
|
|
55
|
+
(0, echarts_1.registerTheme)('ud', (0, registry_echarts_theme_1.getShadcnEChartsTheme)());
|
|
37
56
|
if (process.env.NODE_ENV === 'development') {
|
|
38
57
|
// Listen for HMR update completion to re-register theme
|
|
39
58
|
// Vite uses import.meta.hot instead of webpack's module.hot
|
|
@@ -41,7 +60,7 @@ function resgisterEchartsTheme() {
|
|
|
41
60
|
if (import.meta.hot) {
|
|
42
61
|
// @ts-ignore
|
|
43
62
|
import.meta.hot.on('vite:afterUpdate', () => {
|
|
44
|
-
(0,
|
|
63
|
+
(0, echarts_1.registerTheme)('ud', (0, registry_echarts_theme_1.getShadcnEChartsTheme)());
|
|
45
64
|
});
|
|
46
65
|
}
|
|
47
66
|
}
|
|
@@ -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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,sDAoBC;AA9BD,gEAAgE;AAChE,0DAA4C;AACf,mCAAO;AACpC,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-apaas/fullstack-vite-preset",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"files": [
|
|
5
5
|
"lib",
|
|
6
6
|
"src/empty.css",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@babel/parser": "^7.28.0",
|
|
33
33
|
"@babel/traverse": "^7.28.0",
|
|
34
34
|
"@babel/types": "^7.28.2",
|
|
35
|
-
"@lark-apaas/devtool-kits": "^1.2.
|
|
35
|
+
"@lark-apaas/devtool-kits": "^1.2.18",
|
|
36
36
|
"@lark-apaas/miaoda-inspector-jsx-runtime": "^1.0.1",
|
|
37
37
|
"@lark-apaas/vite-inspector-plugin": "^1.0.1",
|
|
38
38
|
"@vitejs/plugin-react": "^4.5.0",
|