@lark-apaas/fullstack-rspack-preset 1.0.42 → 1.0.43

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.
@@ -45,6 +45,15 @@ function convertColorToHex(color) {
45
45
  return color;
46
46
  }
47
47
  }
48
+ function convertColorValue(propValue, visited) {
49
+ if (typeof propValue === 'string') {
50
+ return convertColorToHex(propValue);
51
+ }
52
+ if (Array.isArray(propValue)) {
53
+ return propValue.map((item) => typeof item === 'string' ? convertColorToHex(item) : transformColors(item, visited));
54
+ }
55
+ return transformColors(propValue, visited);
56
+ }
48
57
  /**
49
58
  * Deep traverse object to transform all HSL colors in 'color' property
50
59
  */
@@ -57,8 +66,6 @@ function transformColors(value, visited = new WeakSet()) {
57
66
  return value;
58
67
  if (value instanceof Date || value instanceof RegExp)
59
68
  return value;
60
- if (typeof value === 'function')
61
- return value;
62
69
  visited.add(value);
63
70
  if (Array.isArray(value)) {
64
71
  return value.map((item) => transformColors(item, visited));
@@ -69,14 +76,11 @@ function transformColors(value, visited = new WeakSet()) {
69
76
  continue;
70
77
  const propValue = value[key];
71
78
  if (key === 'color') {
72
- if (typeof propValue === 'string') {
73
- result[key] = convertColorToHex(propValue);
74
- }
75
- else if (Array.isArray(propValue)) {
76
- result[key] = propValue.map((item) => typeof item === 'string' ? convertColorToHex(item) : transformColors(item, visited));
79
+ if (typeof propValue === 'function') {
80
+ result[key] = (...args) => convertColorValue(propValue(...args), visited);
77
81
  }
78
82
  else {
79
- result[key] = transformColors(propValue, visited);
83
+ result[key] = convertColorValue(propValue, visited);
80
84
  }
81
85
  }
82
86
  else {
@@ -8,9 +8,7 @@ export declare function getCssVariable(varName: string, element?: HTMLElement):
8
8
  export declare function generateEChartsTheme(element?: HTMLElement): {
9
9
  color: string[];
10
10
  backgroundColor: string;
11
- textStyle: {
12
- color: string;
13
- };
11
+ textStyle: {};
14
12
  title: {
15
13
  textStyle: {
16
14
  color: string;
@@ -352,9 +350,7 @@ export declare function generateEChartsTheme(element?: HTMLElement): {
352
350
  export declare function getShadcnEChartsTheme(): {
353
351
  color: string[];
354
352
  backgroundColor: string;
355
- textStyle: {
356
- color: string;
357
- };
353
+ textStyle: {};
358
354
  title: {
359
355
  textStyle: {
360
356
  color: string;
@@ -44,7 +44,7 @@ function generateEChartsTheme(element = document.body) {
44
44
  color: chartColors,
45
45
  backgroundColor: 'transparent',
46
46
  textStyle: {
47
- color: foreground,
47
+ // color: foreground,
48
48
  },
49
49
  title: {
50
50
  textStyle: {
package/lib/preset.js CHANGED
@@ -46,6 +46,12 @@ function createRecommendRspackConfig(options) {
46
46
  resolve: {
47
47
  mainFields: ['module', 'browser', 'main'],
48
48
  extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
49
+ alias: {
50
+ // 确保所有 echarts 子路径导入(如 echarts/core, echarts/lib/...)
51
+ // 都解析到 preset 自带的 echarts,避免第三方扩展(如 echarts-wordcloud)
52
+ // 安装了独立的 echarts 副本导致注册不到同一个实例上
53
+ echarts: path_1.default.dirname(require.resolve('echarts/package.json')),
54
+ },
49
55
  },
50
56
  module: {
51
57
  rules: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/fullstack-rspack-preset",
3
- "version": "1.0.42",
3
+ "version": "1.0.43",
4
4
  "files": [
5
5
  "lib",
6
6
  "patches",