@visactor/vchart 1.6.1-alpha.0 → 1.6.2
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/build/es5/index.js +1 -1
- package/build/index.js +133 -124
- package/build/index.min.js +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/compile/compilable-base.js +1 -2
- package/cjs/compile/grammar-item.js +2 -1
- package/cjs/component/marker/mark-point/interface/spec.d.ts +2 -2
- package/cjs/component/marker/mark-point/interface/spec.js.map +1 -1
- package/cjs/component/marker/mark-point/interface/theme.d.ts +5 -5
- package/cjs/component/marker/mark-point/interface/theme.js.map +1 -1
- package/cjs/component/tooltip/handler/dom/model/content-column-model.js +4 -2
- package/cjs/component/tooltip/handler/dom/model/content-column-model.js.map +1 -1
- package/cjs/component/tooltip/handler/dom/util.js +2 -2
- package/cjs/component/tooltip/handler/dom/util.js.map +1 -1
- package/cjs/component/tooltip/handler/utils/attribute.js +1 -2
- package/cjs/component/tooltip/handler/utils/attribute.js.map +1 -1
- package/cjs/core/index.d.ts +1 -1
- package/cjs/core/index.js +1 -1
- package/cjs/core/index.js.map +1 -1
- package/cjs/layout/grid-layout/grid-layout.js +4 -4
- package/cjs/layout/grid-layout/grid-layout.js.map +1 -1
- package/cjs/theme/builtin/common/component/axis/cartesian-axis.js +2 -2
- package/cjs/theme/builtin/common/component/axis/cartesian-axis.js.map +1 -1
- package/cjs/theme/builtin/common/component/axis/common-axis.js +1 -1
- package/cjs/theme/builtin/common/component/axis/common-axis.js.map +1 -1
- package/cjs/theme/builtin/common/component/crosshair.js +5 -5
- package/cjs/theme/builtin/common/component/crosshair.js.map +1 -1
- package/cjs/theme/builtin/common/component/data-zoom.js +10 -10
- package/cjs/theme/builtin/common/component/data-zoom.js.map +1 -1
- package/cjs/theme/builtin/common/component/indicator.js +1 -1
- package/cjs/theme/builtin/common/component/indicator.js.map +1 -1
- package/cjs/theme/builtin/common/component/legend/color-legend.js +4 -3
- package/cjs/theme/builtin/common/component/legend/color-legend.js.map +1 -1
- package/cjs/theme/builtin/common/component/legend/discrete-legend.js +2 -2
- package/cjs/theme/builtin/common/component/legend/discrete-legend.js.map +1 -1
- package/cjs/theme/builtin/common/component/legend/size-legend.js +6 -6
- package/cjs/theme/builtin/common/component/legend/size-legend.js.map +1 -1
- package/cjs/theme/builtin/common/component/map-label.js.map +1 -1
- package/cjs/theme/builtin/common/component/mark-area.js.map +1 -1
- package/cjs/theme/builtin/common/component/mark-line.js +9 -9
- package/cjs/theme/builtin/common/component/mark-line.js.map +1 -1
- package/cjs/theme/builtin/common/component/mark-point.js +3 -15
- package/cjs/theme/builtin/common/component/mark-point.js.map +1 -1
- package/cjs/theme/builtin/common/component/player.js +7 -7
- package/cjs/theme/builtin/common/component/player.js.map +1 -1
- package/cjs/theme/builtin/common/component/poptip.js +4 -3
- package/cjs/theme/builtin/common/component/poptip.js.map +1 -1
- package/cjs/theme/builtin/common/component/scroll-bar.js +1 -1
- package/cjs/theme/builtin/common/component/scroll-bar.js.map +1 -1
- package/cjs/theme/builtin/common/component/title.js +1 -1
- package/cjs/theme/builtin/common/component/title.js.map +1 -1
- package/cjs/theme/builtin/common/component/tooltip.js +4 -3
- package/cjs/theme/builtin/common/component/tooltip.js.map +1 -1
- package/cjs/theme/builtin/common/component/total-label.js.map +1 -1
- package/cjs/theme/builtin/common/mark.js.map +1 -1
- package/cjs/theme/builtin/common/series/rangeColumn.js +1 -1
- package/cjs/theme/builtin/common/series/rangeColumn.js.map +1 -1
- package/cjs/theme/builtin/dark/color-scheme.js +10 -19
- package/cjs/theme/builtin/dark/color-scheme.js.map +1 -1
- package/cjs/theme/builtin/light/color-scheme.js +9 -18
- package/cjs/theme/builtin/light/color-scheme.js.map +1 -1
- package/cjs/theme/color-scheme/builtin/interface.d.ts +7 -16
- package/cjs/theme/color-scheme/builtin/interface.js.map +1 -1
- package/cjs/theme/color-scheme/legacy.d.ts +5 -0
- package/cjs/theme/color-scheme/legacy.js +21 -0
- package/cjs/theme/color-scheme/legacy.js.map +1 -0
- package/cjs/theme/color-scheme/util.js +5 -6
- package/cjs/theme/color-scheme/util.js.map +1 -1
- package/esm/compile/compilable-base.js +1 -2
- package/esm/compile/grammar-item.js +2 -1
- package/esm/component/marker/mark-point/interface/spec.d.ts +2 -2
- package/esm/component/marker/mark-point/interface/spec.js.map +1 -1
- package/esm/component/marker/mark-point/interface/theme.d.ts +5 -5
- package/esm/component/marker/mark-point/interface/theme.js.map +1 -1
- package/esm/component/tooltip/handler/dom/model/content-column-model.js +4 -2
- package/esm/component/tooltip/handler/dom/model/content-column-model.js.map +1 -1
- package/esm/component/tooltip/handler/dom/util.js +2 -2
- package/esm/component/tooltip/handler/dom/util.js.map +1 -1
- package/esm/component/tooltip/handler/utils/attribute.js +1 -2
- package/esm/component/tooltip/handler/utils/attribute.js.map +1 -1
- package/esm/core/index.d.ts +1 -1
- package/esm/core/index.js +1 -1
- package/esm/core/index.js.map +1 -1
- package/esm/layout/grid-layout/grid-layout.js +4 -4
- package/esm/layout/grid-layout/grid-layout.js.map +1 -1
- package/esm/theme/builtin/common/component/axis/cartesian-axis.js +2 -2
- package/esm/theme/builtin/common/component/axis/cartesian-axis.js.map +1 -1
- package/esm/theme/builtin/common/component/axis/common-axis.js +1 -1
- package/esm/theme/builtin/common/component/axis/common-axis.js.map +1 -1
- package/esm/theme/builtin/common/component/crosshair.js +5 -5
- package/esm/theme/builtin/common/component/crosshair.js.map +1 -1
- package/esm/theme/builtin/common/component/data-zoom.js +10 -10
- package/esm/theme/builtin/common/component/data-zoom.js.map +1 -1
- package/esm/theme/builtin/common/component/indicator.js +1 -1
- package/esm/theme/builtin/common/component/indicator.js.map +1 -1
- package/esm/theme/builtin/common/component/legend/color-legend.js +4 -3
- package/esm/theme/builtin/common/component/legend/color-legend.js.map +1 -1
- package/esm/theme/builtin/common/component/legend/discrete-legend.js +2 -2
- package/esm/theme/builtin/common/component/legend/discrete-legend.js.map +1 -1
- package/esm/theme/builtin/common/component/legend/size-legend.js +6 -6
- package/esm/theme/builtin/common/component/legend/size-legend.js.map +1 -1
- package/esm/theme/builtin/common/component/map-label.js.map +1 -1
- package/esm/theme/builtin/common/component/mark-area.js.map +1 -1
- package/esm/theme/builtin/common/component/mark-line.js +9 -9
- package/esm/theme/builtin/common/component/mark-line.js.map +1 -1
- package/esm/theme/builtin/common/component/mark-point.js +3 -15
- package/esm/theme/builtin/common/component/mark-point.js.map +1 -1
- package/esm/theme/builtin/common/component/player.js +7 -7
- package/esm/theme/builtin/common/component/player.js.map +1 -1
- package/esm/theme/builtin/common/component/poptip.js +4 -3
- package/esm/theme/builtin/common/component/poptip.js.map +1 -1
- package/esm/theme/builtin/common/component/scroll-bar.js +1 -1
- package/esm/theme/builtin/common/component/scroll-bar.js.map +1 -1
- package/esm/theme/builtin/common/component/title.js +1 -1
- package/esm/theme/builtin/common/component/title.js.map +1 -1
- package/esm/theme/builtin/common/component/tooltip.js +4 -3
- package/esm/theme/builtin/common/component/tooltip.js.map +1 -1
- package/esm/theme/builtin/common/component/total-label.js.map +1 -1
- package/esm/theme/builtin/common/mark.js.map +1 -1
- package/esm/theme/builtin/common/series/rangeColumn.js +1 -1
- package/esm/theme/builtin/common/series/rangeColumn.js.map +1 -1
- package/esm/theme/builtin/dark/color-scheme.js +10 -19
- package/esm/theme/builtin/dark/color-scheme.js.map +1 -1
- package/esm/theme/builtin/light/color-scheme.js +9 -18
- package/esm/theme/builtin/light/color-scheme.js.map +1 -1
- package/esm/theme/color-scheme/builtin/interface.d.ts +7 -16
- package/esm/theme/color-scheme/builtin/interface.js.map +1 -1
- package/esm/theme/color-scheme/legacy.d.ts +5 -0
- package/esm/theme/color-scheme/legacy.js +18 -0
- package/esm/theme/color-scheme/legacy.js.map +1 -0
- package/esm/theme/color-scheme/util.js +7 -5
- package/esm/theme/color-scheme/util.js.map +1 -1
- package/package.json +9 -9
|
@@ -6,31 +6,22 @@ export const colorScheme = {
|
|
|
6
6
|
palette: {
|
|
7
7
|
backgroundColor: "#ffffff",
|
|
8
8
|
borderColor: "#e3e5e8",
|
|
9
|
-
shadowColor: "
|
|
10
|
-
hoverBackgroundColor: "#f1f2f5",
|
|
11
|
-
sliderRailColor: "#f1f3f4",
|
|
12
|
-
sliderHandleColor: "#ffffff",
|
|
13
|
-
sliderTrackColor: "#0040ff",
|
|
14
|
-
popupBackgroundColor: "#ffffff",
|
|
9
|
+
shadowColor: "#21252c",
|
|
15
10
|
primaryFontColor: "#21252c",
|
|
16
11
|
secondaryFontColor: "#606773",
|
|
17
|
-
|
|
18
|
-
axisLabelFontColor: "#89909d",
|
|
12
|
+
axisFontColor: "#89909d",
|
|
19
13
|
disableFontColor: "#bcc1cb",
|
|
20
|
-
|
|
14
|
+
labelReverseFontColor: "#ffffff",
|
|
21
15
|
axisGridColor: "#f1f2f5",
|
|
22
16
|
axisDomainColor: "#d9dde4",
|
|
23
|
-
|
|
17
|
+
dataZoomHandlerStrokeColor: "#aeb5be",
|
|
18
|
+
dataZoomHandlerFillColor: "#ffffff",
|
|
19
|
+
dataZoomBackgroundColor: "#f1f3f4",
|
|
24
20
|
dataZoomChartColor: "#c9ced8",
|
|
25
|
-
|
|
21
|
+
dataZoomSelectedColor: "#0040ff",
|
|
26
22
|
scrollBarSliderColor: "#000000",
|
|
27
|
-
|
|
28
|
-
markLabelBackgroundColor: "#
|
|
29
|
-
markLineStrokeColor: "#606773",
|
|
30
|
-
dangerColor: "#e33232",
|
|
31
|
-
warningColor: "#ffc528",
|
|
32
|
-
successColor: "#07a35a",
|
|
33
|
-
infoColor: "#3073f2"
|
|
23
|
+
tooltipBackgroundColor: "#ffffff",
|
|
24
|
+
markLabelBackgroundColor: "#ffc528"
|
|
34
25
|
}
|
|
35
26
|
}
|
|
36
27
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/theme/builtin/light/color-scheme.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAGhE,MAAM,CAAC,MAAM,WAAW,GAAsB;IAC5C,OAAO,EAAE;QACP,UAAU;QACV,OAAO,EAAE;YAEP,eAAe,EAAE,SAAS;YAE1B,WAAW,EAAE,SAAS;YAEtB,WAAW,EAAE,
|
|
1
|
+
{"version":3,"sources":["../src/theme/builtin/light/color-scheme.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAGhE,MAAM,CAAC,MAAM,WAAW,GAAsB;IAC5C,OAAO,EAAE;QACP,UAAU;QACV,OAAO,EAAE;YAEP,eAAe,EAAE,SAAS;YAE1B,WAAW,EAAE,SAAS;YAEtB,WAAW,EAAE,SAAS;YAGtB,gBAAgB,EAAE,SAAS;YAE3B,kBAAkB,EAAE,SAAS;YAE7B,aAAa,EAAE,SAAS;YAExB,gBAAgB,EAAE,SAAS;YAE3B,qBAAqB,EAAE,SAAS;YAGhC,aAAa,EAAE,SAAS;YAExB,eAAe,EAAE,SAAS;YAG1B,0BAA0B,EAAE,SAAS;YAErC,wBAAwB,EAAE,SAAS;YAEnC,uBAAuB,EAAE,SAAS;YAElC,kBAAkB,EAAE,SAAS;YAE7B,qBAAqB,EAAE,SAAS;YAGhC,oBAAoB,EAAE,SAAS;YAG/B,sBAAsB,EAAE,SAAS;YAGjC,wBAAwB,EAAE,SAAS;SACb;KACzB;CACF,CAAC","file":"color-scheme.js","sourcesContent":["import type { IThemeColorScheme } from '../../color-scheme/interface';\nimport { dataScheme } from '../../color-scheme/builtin/default';\nimport type { BuiltinColorPalette } from '../../color-scheme/builtin/interface';\n\nexport const colorScheme: IThemeColorScheme = {\n default: {\n dataScheme,\n palette: {\n /** 背景色 */\n backgroundColor: '#ffffff',\n /** 图表边框色 */\n borderColor: '#e3e5e8',\n /** 默认阴影颜色 */\n shadowColor: '#21252c',\n\n /** 主要字色 */\n primaryFontColor: '#21252c',\n /** 次要字色 */\n secondaryFontColor: '#606773',\n /** 轴字色 */\n axisFontColor: '#89909d',\n /** 禁用字色 */\n disableFontColor: '#bcc1cb',\n /** 标签反转字色 */\n labelReverseFontColor: '#ffffff',\n\n /** 轴网格线颜色 */\n axisGridColor: '#f1f2f5',\n /** 轴线颜色 */\n axisDomainColor: '#d9dde4',\n\n /** 缩略轴滑块描边颜色 */\n dataZoomHandlerStrokeColor: '#aeb5be',\n /** 缩略轴滑块填充颜色 */\n dataZoomHandlerFillColor: '#ffffff',\n /** 缩略轴背景区域颜色 */\n dataZoomBackgroundColor: '#f1f3f4',\n /** 缩略轴图表区域颜色 */\n dataZoomChartColor: '#c9ced8',\n /** 缩略轴选择区域颜色 */\n dataZoomSelectedColor: '#0040ff',\n\n /** 滚动条滑块颜色 */\n scrollBarSliderColor: '#000000',\n\n /** 提示信息背景区域颜色 */\n tooltipBackgroundColor: '#ffffff',\n\n /** 标注标签背景颜色 */\n markLabelBackgroundColor: '#ffc528'\n } as BuiltinColorPalette\n }\n};\n"]}
|
|
@@ -3,28 +3,19 @@ export type BuiltinColorPalette = IColorSchemeStruct['palette'] & {
|
|
|
3
3
|
backgroundColor: string;
|
|
4
4
|
borderColor: string;
|
|
5
5
|
shadowColor: string;
|
|
6
|
-
hoverBackgroundColor: string;
|
|
7
|
-
sliderRailColor: string;
|
|
8
|
-
sliderHandleColor: string;
|
|
9
|
-
sliderTrackColor: string;
|
|
10
|
-
popupBackgroundColor: string;
|
|
11
6
|
primaryFontColor: string;
|
|
12
7
|
secondaryFontColor: string;
|
|
13
|
-
|
|
14
|
-
axisLabelFontColor: string;
|
|
8
|
+
axisFontColor: string;
|
|
15
9
|
disableFontColor: string;
|
|
16
|
-
|
|
10
|
+
labelReverseFontColor: string;
|
|
17
11
|
axisGridColor: string;
|
|
18
12
|
axisDomainColor: string;
|
|
19
|
-
|
|
13
|
+
dataZoomHandlerStrokeColor: string;
|
|
14
|
+
dataZoomHandlerFillColor: string;
|
|
15
|
+
dataZoomBackgroundColor: string;
|
|
20
16
|
dataZoomChartColor: string;
|
|
21
|
-
|
|
17
|
+
dataZoomSelectedColor: string;
|
|
22
18
|
scrollBarSliderColor: string;
|
|
23
|
-
|
|
19
|
+
tooltipBackgroundColor: string;
|
|
24
20
|
markLabelBackgroundColor: string;
|
|
25
|
-
markLineStrokeColor: string;
|
|
26
|
-
dangerColor: string;
|
|
27
|
-
warningColor: string;
|
|
28
|
-
successColor: string;
|
|
29
|
-
infoColor: string;
|
|
30
21
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/theme/color-scheme/builtin/interface.ts"],"names":[],"mappings":"","file":"interface.js","sourcesContent":["import type { IColorSchemeStruct } from '../interface';\n\nexport type BuiltinColorPalette = IColorSchemeStruct['palette'] & {\n /** 背景色 */\n backgroundColor: string;\n /** 图表边框色 */\n borderColor: string;\n /** 默认阴影颜色 */\n shadowColor: string;\n
|
|
1
|
+
{"version":3,"sources":["../src/theme/color-scheme/builtin/interface.ts"],"names":[],"mappings":"","file":"interface.js","sourcesContent":["import type { IColorSchemeStruct } from '../interface';\n\nexport type BuiltinColorPalette = IColorSchemeStruct['palette'] & {\n /** 背景色 */\n backgroundColor: string;\n /** 图表边框色 */\n borderColor: string;\n /** 默认阴影颜色 */\n shadowColor: string;\n\n /** 主要字色(图表标题、大数字) */\n primaryFontColor: string;\n /** 次要字色(图例、tooltip、数据标签) */\n secondaryFontColor: string;\n /** 轴字色 */\n axisFontColor: string;\n /** 禁用字色(非激活态字色) */\n disableFontColor: string;\n /** 标签反转字色 */\n labelReverseFontColor: string;\n\n /** 轴网格线颜色 */\n axisGridColor: string;\n /** 轴线颜色 */\n axisDomainColor: string;\n\n /** 缩略轴滑块描边颜色 */\n dataZoomHandlerStrokeColor: string;\n /** 缩略轴滑块填充颜色 */\n dataZoomHandlerFillColor: string;\n /** 缩略轴背景区域颜色 */\n dataZoomBackgroundColor: string;\n /** 缩略轴图表区域颜色 */\n dataZoomChartColor: string;\n /** 缩略轴选择区域颜色 */\n dataZoomSelectedColor: string;\n\n /** 滚动条滑块颜色 */\n scrollBarSliderColor: string;\n\n /** 提示信息背景区域颜色 */\n tooltipBackgroundColor: string;\n\n /** 标注标签背景颜色 */\n markLabelBackgroundColor: string;\n};\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BuiltinColorPalette } from './builtin';
|
|
2
|
+
import type { ColorSchemeItem, IColorSchemeStruct } from './interface';
|
|
3
|
+
export declare const newTokenToLegacyToken: Record<keyof BuiltinColorPalette, string>;
|
|
4
|
+
export declare const legacyTokenToNewToken: Record<string, keyof BuiltinColorPalette>;
|
|
5
|
+
export declare function getUpgradedTokenValue(palette: IColorSchemeStruct['palette'], key: string): ColorSchemeItem;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const newTokenToLegacyToken = {
|
|
2
|
+
primaryFontColor: "titleFontColor",
|
|
3
|
+
secondaryFontColor: "labelFontColor"
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
export const legacyTokenToNewToken = {
|
|
7
|
+
titleFontColor: "primaryFontColor",
|
|
8
|
+
labelFontColor: "secondaryFontColor"
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export function getUpgradedTokenValue(palette, key) {
|
|
12
|
+
const legacyKey = newTokenToLegacyToken[key];
|
|
13
|
+
if (legacyKey && palette[legacyKey]) return palette[legacyKey];
|
|
14
|
+
if (palette[key]) return palette[key];
|
|
15
|
+
const newKey = legacyTokenToNewToken[key];
|
|
16
|
+
return newKey ? palette[newKey] : void 0;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=legacy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/theme/color-scheme/legacy.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,qBAAqB,GAA8C;IAC9E,gBAAgB,EAAE,gBAAgB;IAClC,kBAAkB,EAAE,gBAAgB;CACrC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAA8C;IAC9E,cAAc,EAAE,kBAAkB;IAClC,cAAc,EAAE,oBAAoB;CACrC,CAAC;AAEF,MAAM,UAAU,qBAAqB,CAAC,OAAsC,EAAE,GAAW;IAEvF,MAAM,SAAS,GAAG,qBAAqB,CAAC,GAAG,CAAC,CAAC;IAC7C,IAAI,SAAS,IAAI,OAAO,CAAC,SAAS,CAAC,EAAE;QACnC,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC;KAC3B;IAED,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE;QAChB,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC;KACrB;IAED,MAAM,MAAM,GAAG,qBAAqB,CAAC,GAAG,CAAC,CAAC;IAC1C,IAAI,MAAM,EAAE;QACV,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;KACxB;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","file":"legacy.js","sourcesContent":["// FIXME: token 兼容策略,照目前的设计不应该硬编码。\n// 后续需要二选一:\n// - 主题模块指定唯一一套支持的 token(可以保留这段硬编码)\n// - 在默认主题中做声明式的兼容(需要删除这段硬编码,并在 IColorKey 中支持新属性)\n\nimport type { BuiltinColorPalette } from './builtin';\nimport type { ColorSchemeItem, IColorSchemeStruct } from './interface';\n\nexport const newTokenToLegacyToken: Record<keyof BuiltinColorPalette, string> = {\n primaryFontColor: 'titleFontColor',\n secondaryFontColor: 'labelFontColor'\n};\n\nexport const legacyTokenToNewToken: Record<string, keyof BuiltinColorPalette> = {\n titleFontColor: 'primaryFontColor',\n labelFontColor: 'secondaryFontColor'\n};\n\nexport function getUpgradedTokenValue(palette: IColorSchemeStruct['palette'], key: string): ColorSchemeItem {\n // 情况一:用户定义了包含旧 token 的新色板\n const legacyKey = newTokenToLegacyToken[key];\n if (legacyKey && palette[legacyKey]) {\n return palette[legacyKey];\n }\n // 情况二:默认情况,用户尝试取色(大部分情况下在此退出)\n if (palette[key]) {\n return palette[key];\n }\n // 情况三:用户没有取到颜色,判断用户是否在尝试用旧 token 取色\n const newKey = legacyTokenToNewToken[key];\n if (newKey) {\n return palette[newKey];\n }\n // 情况四:真的取不到颜色\n return undefined;\n}\n"]}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { isArray, isFunction, isObject, isString, isValid, ColorUtil } from "@visactor/vutils";
|
|
1
|
+
import { isArray, isFunction, isObject, isString, isValid, ColorUtil, isNil } from "@visactor/vutils";
|
|
2
2
|
|
|
3
3
|
import { Color } from "../../util/color";
|
|
4
4
|
|
|
5
5
|
import { getDirectionFromSeriesSpec } from "../../series/util/spec";
|
|
6
6
|
|
|
7
|
+
import { getUpgradedTokenValue } from "./legacy";
|
|
8
|
+
|
|
7
9
|
export function getDataScheme(colorScheme, seriesSpec) {
|
|
8
10
|
var _a;
|
|
9
11
|
if (!colorScheme) return [];
|
|
@@ -29,9 +31,9 @@ export function queryColorFromColorScheme(colorScheme, colorKey, seriesSpec) {
|
|
|
29
31
|
if (!scheme) return;
|
|
30
32
|
let color;
|
|
31
33
|
const {palette: palette} = scheme;
|
|
32
|
-
if (isObject(palette) && (color = null !== (_a = palette
|
|
34
|
+
if (isObject(palette) && (color = null !== (_a = getUpgradedTokenValue(palette, colorKey.key)) && void 0 !== _a ? _a : colorKey.default),
|
|
33
35
|
!color) return;
|
|
34
|
-
if (
|
|
36
|
+
if (isNil(colorKey.a) && isNil(colorKey.l) || !isString(color)) return color;
|
|
35
37
|
let c = new Color(color);
|
|
36
38
|
if (isValid(colorKey.l)) {
|
|
37
39
|
const {r: r, g: g, b: b} = c.color, {h: h, s: s} = ColorUtil.rgbToHsl(r, g, b), rgb = ColorUtil.hslToRgb(h, s, colorKey.l), newColor = new Color(`rgb(${rgb.r}, ${rgb.g}, ${rgb.b})`);
|
|
@@ -66,10 +68,10 @@ export function getColorSchemeBySeries(colorScheme, seriesSpec) {
|
|
|
66
68
|
var _a, _b;
|
|
67
69
|
const {type: seriesType} = null != seriesSpec ? seriesSpec : {};
|
|
68
70
|
let scheme;
|
|
69
|
-
if (seriesSpec
|
|
71
|
+
if (!seriesSpec || isNil(seriesType)) scheme = null == colorScheme ? void 0 : colorScheme.default; else {
|
|
70
72
|
const direction = getDirectionFromSeriesSpec(seriesSpec);
|
|
71
73
|
scheme = null !== (_b = null !== (_a = null == colorScheme ? void 0 : colorScheme[`${seriesType}_${direction}`]) && void 0 !== _a ? _a : null == colorScheme ? void 0 : colorScheme[seriesType]) && void 0 !== _b ? _b : null == colorScheme ? void 0 : colorScheme.default;
|
|
72
|
-
}
|
|
74
|
+
}
|
|
73
75
|
return scheme;
|
|
74
76
|
}
|
|
75
77
|
//# sourceMappingURL=util.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/theme/color-scheme/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"sources":["../src/theme/color-scheme/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACtG,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAWzC,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAQjD,MAAM,UAAU,aAAa,CAC3B,WAA+B,EAC/B,UAAwB;;IAExB,IAAI,CAAC,WAAW,EAAE;QAChB,OAAO,EAAE,CAAC;KACX;IACD,MAAM,MAAM,GAAG,sBAAsB,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IAC/D,IAAI,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE;QAE9B,OAAO,MAAC,MAA0E,mCAAI,EAAE,CAAC;KAC1F;SAAM,IAAI,QAAQ,CAAC,MAAM,CAAC,EAAE;QAE3B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AK,CAAC,IAAI,CAAC,EAAE;QACtB,OAAO,OAAO,CAAE,IAAsC,CAAC,MAAM,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;AACL,CAAC;AAGD,MAAM,UAAU,oCAAoC,CAAC,WAAwB;IAC3E,IAAI,OAAO,CAAC,WAAW,CAAC,EAAE;QACxB,OAAO;YACL,UAAU,EAAE,WAAW;SACxB,CAAC;KACH;IACD,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,WAA+B,EAC/B,UAAwB;;IAExB,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,EAAE,CAAC;IAC9C,IAAI,MAA+B,CAAC;IACpC,IAAI,CAAC,UAAU,IAAI,KAAK,CAAC,UAAU,CAAC,EAAE;QACpC,MAAM,GAAG,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,OAAO,CAAC;KAC/B;SAAM;QACL,MAAM,SAAS,GAAG,0BAA0B,CAAC,UAAU,CAAC,CAAC;QACzD,MAAM,GAAG,MAAA,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAG,GAAG,UAAU,IAAI,SAAS,EAAE,CAAC,mCAAI,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAG,UAAU,CAAC,mCAAI,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,OAAO,CAAC;KAC3G;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","file":"util.js","sourcesContent":["import { isArray, isFunction, isObject, isString, isValid, ColorUtil, isNil } from '@visactor/vutils';\nimport { Color } from '../../util/color';\nimport type {\n ColorScheme,\n ColorSchemeItem,\n IColorKey,\n IColorSchemeStruct,\n IProgressiveDataSchemeCase,\n IThemeColorScheme,\n ProgressiveDataScheme\n} from './interface';\nimport type { ISeriesSpec } from '../../typings';\nimport { getDirectionFromSeriesSpec } from '../../series/util/spec';\nimport { getUpgradedTokenValue } from './legacy';\n\n/**\n * 从色板中获取数据色板(在此步骤中替换语义色值)\n * @param colorScheme\n * @param seriesType\n * @returns\n */\nexport function getDataScheme(\n colorScheme?: IThemeColorScheme,\n seriesSpec?: ISeriesSpec\n): Array<ColorSchemeItem> | ProgressiveDataScheme<ColorSchemeItem> {\n if (!colorScheme) {\n return [];\n }\n const scheme = getColorSchemeBySeries(colorScheme, seriesSpec);\n if (!scheme || isArray(scheme)) {\n // 不带语义色板,直接输出\n return (scheme as Array<ColorSchemeItem> | ProgressiveDataScheme<ColorSchemeItem>) ?? [];\n } else if (isObject(scheme)) {\n // 带语义色板,转换颜色后输出\n const { dataScheme } = scheme as IColorSchemeStruct;\n if (!dataScheme) {\n return [];\n }\n // 渐进式色板的情况\n if (isProgressiveDataColorScheme(dataScheme)) {\n return dataScheme.map(item => ({\n ...item,\n scheme: item.scheme\n .map(color => {\n if (isColorKey(color)) {\n return queryColorFromColorScheme(colorScheme, color, seriesSpec);\n }\n return color;\n })\n .filter(isValid)\n }));\n }\n // 普通色板的情况\n return dataScheme\n .map(color => {\n if (isColorKey(color)) {\n return queryColorFromColorScheme(colorScheme, color, seriesSpec);\n }\n return color;\n })\n .filter(isValid);\n }\n return [];\n}\n\n/**\n * 计算最终数据色板(在此步骤中获得渐进式色板的最终色板)\n * @param colorScheme\n * @param seriesType\n * @returns\n */\nexport function computeActualDataScheme(\n dataScheme: Array<ColorSchemeItem> | ProgressiveDataScheme<ColorSchemeItem>,\n colorDomain: any[]\n): Array<ColorSchemeItem> {\n if (isProgressiveDataColorScheme(dataScheme)) {\n return (\n dataScheme.find(item => {\n if (isValid(item.isAvailable)) {\n if (isFunction(item.isAvailable)) {\n return item.isAvailable(colorDomain);\n }\n return !!item.isAvailable;\n } else if (isValid(item.maxDomainLength)) {\n return colorDomain?.length <= item.maxDomainLength;\n }\n return true;\n })?.scheme ?? dataScheme[dataScheme.length - 1].scheme\n );\n }\n return dataScheme;\n}\n\n/**\n * 根据色板和色值索引生成颜色\n * @param colorScheme\n * @param colorKey\n * @param seriesType\n * @returns\n */\nexport function queryColorFromColorScheme(\n colorScheme: IThemeColorScheme,\n colorKey: IColorKey,\n seriesSpec?: ISeriesSpec\n): ColorSchemeItem | undefined {\n const scheme = getColorSchemeBySeries(colorScheme, seriesSpec);\n if (!scheme) {\n return undefined;\n }\n let color;\n const { palette } = scheme as IColorSchemeStruct;\n if (isObject(palette)) {\n color = getUpgradedTokenValue(palette, colorKey.key) ?? colorKey.default;\n }\n if (!color) {\n return undefined;\n }\n if ((isNil(colorKey.a) && isNil(colorKey.l)) || !isString(color)) {\n return color;\n }\n let c = new Color(color);\n if (isValid(colorKey.l)) {\n const { r, g, b } = c.color;\n const { h, s } = ColorUtil.rgbToHsl(r, g, b);\n const rgb = ColorUtil.hslToRgb(h, s, colorKey.l);\n const newColor = new Color(`rgb(${rgb.r}, ${rgb.g}, ${rgb.b})`);\n newColor.setOpacity(c.color.opacity);\n c = newColor;\n }\n if (isValid(colorKey.a)) {\n c.setOpacity(colorKey.a);\n }\n return c.toRGBA();\n}\n\n/** 查询语义化颜色 */\nexport const getActualColor = (value: any, colorScheme?: IThemeColorScheme, seriesSpec?: ISeriesSpec) => {\n if (isColorKey(value)) {\n if (colorScheme) {\n const color = queryColorFromColorScheme(colorScheme, value, seriesSpec);\n if (color) {\n return color;\n }\n }\n }\n return value;\n};\n\nexport function isColorKey(obj: any): obj is IColorKey {\n return isObject(obj) && (obj as IColorKey).type === 'palette' && !!(obj as IColorKey).key;\n}\n\nexport function isProgressiveDataColorScheme<T>(obj: any): obj is ProgressiveDataScheme<T> {\n if (!isArray(obj) || obj.length === 0) {\n return false;\n }\n return obj.every(item => {\n return isValid((item as IProgressiveDataSchemeCase<T>).scheme);\n });\n}\n\n/** 将色板转化为标准形式 */\nexport function transformColorSchemeToStandardStruct(colorScheme: ColorScheme): IColorSchemeStruct {\n if (isArray(colorScheme)) {\n return {\n dataScheme: colorScheme\n };\n }\n return colorScheme;\n}\n\nexport function getColorSchemeBySeries(\n colorScheme?: IThemeColorScheme,\n seriesSpec?: ISeriesSpec\n): ColorScheme | undefined {\n const { type: seriesType } = seriesSpec ?? {};\n let scheme: ColorScheme | undefined;\n if (!seriesSpec || isNil(seriesType)) {\n scheme = colorScheme?.default;\n } else {\n const direction = getDirectionFromSeriesSpec(seriesSpec);\n scheme = colorScheme?.[`${seriesType}_${direction}`] ?? colorScheme?.[seriesType] ?? colorScheme?.default;\n }\n return scheme;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visactor/vchart",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.2",
|
|
4
4
|
"description": "charts lib based @visactor/VGrammar",
|
|
5
5
|
"main": "cjs/index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
@@ -76,17 +76,17 @@
|
|
|
76
76
|
"size-limit": "9.0.0",
|
|
77
77
|
"@size-limit/file": "9.0.0",
|
|
78
78
|
"@internal/typescript-json-schema": "0.0.1",
|
|
79
|
-
"@internal/bundler": "0.0.1",
|
|
80
79
|
"@internal/eslint-config": "0.0.1",
|
|
81
|
-
"@internal/ts-config": "0.0.1"
|
|
80
|
+
"@internal/ts-config": "0.0.1",
|
|
81
|
+
"@internal/bundler": "0.0.1"
|
|
82
82
|
},
|
|
83
83
|
"dependencies": {
|
|
84
|
-
"@visactor/vutils": "~0.16.
|
|
84
|
+
"@visactor/vutils": "~0.16.7",
|
|
85
85
|
"@visactor/vdataset": "~0.16.6",
|
|
86
|
-
"@visactor/vscale": "~0.16.
|
|
87
|
-
"@visactor/vrender-core": "~0.16.
|
|
88
|
-
"@visactor/vrender-kits": "~0.16.
|
|
89
|
-
"@visactor/vrender-components": "~0.16.
|
|
86
|
+
"@visactor/vscale": "~0.16.7",
|
|
87
|
+
"@visactor/vrender-core": "~0.16.12",
|
|
88
|
+
"@visactor/vrender-kits": "~0.16.12",
|
|
89
|
+
"@visactor/vrender-components": "~0.16.12",
|
|
90
90
|
"@visactor/vgrammar-core": "~0.8.2",
|
|
91
91
|
"@visactor/vgrammar-projection": "~0.8.2",
|
|
92
92
|
"@visactor/vgrammar-wordcloud": "~0.8.2",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"@visactor/vgrammar-hierarchy": "~0.8.2",
|
|
95
95
|
"@visactor/vgrammar-sankey": "~0.8.2",
|
|
96
96
|
"@visactor/vgrammar-util": "~0.8.2",
|
|
97
|
-
"@visactor/vutils-extension": "1.6.
|
|
97
|
+
"@visactor/vutils-extension": "1.6.2"
|
|
98
98
|
},
|
|
99
99
|
"publishConfig": {
|
|
100
100
|
"access": "public",
|