@baron1996/klinecharts-adapter 0.9.19 → 0.9.20

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.
@@ -1,7 +1,10 @@
1
1
  import type { SceneIndicator, ScenePane } from '@baron1996/kline-scene-schema';
2
2
  import type { Chart, DeepPartial, IndicatorCreate, IndicatorStyle } from 'klinecharts';
3
3
  import type { EngineIdMap } from './id-map.js';
4
- /** 将协议内指标样式映射为 KLineCharts 的受控样式子集。 */
4
+ /**
5
+ * 将协议内指标样式映射为 KLineCharts 的受控样式子集。
6
+ * 空样式通道必须省略,让引擎保留可用的默认项,避免圆点等图形按空数组取样。
7
+ */
5
8
  export declare function toKLineChartsIndicatorStyles(styles: SceneIndicator['styles']): DeepPartial<IndicatorStyle>;
6
9
  export declare function toIndicatorCreate(indicator: SceneIndicator, idMap: EngineIdMap, path: string): IndicatorCreate;
7
10
  export declare function createPaneIndicators(chart: Chart, pane: ScenePane, paneIndex: number, idMap: EngineIdMap): void;
@@ -1 +1 @@
1
- {"version":3,"file":"indicators.d.ts","sourceRoot":"","sources":["../../src/conversion/indicators.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,cAAc,EACd,SAAS,EACT,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EACX,KAAK,EACL,WAAW,EACX,eAAe,EACf,cAAc,EACd,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAc/C,uCAAuC;AACvC,wBAAgB,4BAA4B,CAC3C,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,GAC9B,WAAW,CAAC,cAAc,CAAC,CAiB7B;AAED,wBAAgB,iBAAiB,CAChC,SAAS,EAAE,cAAc,EACzB,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,MAAM,GACV,eAAe,CAejB;AAED,wBAAgB,oBAAoB,CACnC,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,SAAS,EACf,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,WAAW,GAChB,IAAI,CAqBN"}
1
+ {"version":3,"file":"indicators.d.ts","sourceRoot":"","sources":["../../src/conversion/indicators.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,cAAc,EACd,SAAS,EACT,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EACX,KAAK,EACL,WAAW,EACX,eAAe,EACf,cAAc,EACd,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAc/C;;;GAGG;AACH,wBAAgB,4BAA4B,CAC3C,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,GAC9B,WAAW,CAAC,cAAc,CAAC,CAuB7B;AAED,wBAAgB,iBAAiB,CAChC,SAAS,EAAE,cAAc,EACzB,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,MAAM,GACV,eAAe,CAejB;AAED,wBAAgB,oBAAoB,CACnC,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,SAAS,EACf,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,WAAW,GAChB,IAAI,CAqBN"}
@@ -10,24 +10,33 @@ function lineStyle(style) {
10
10
  smooth: false,
11
11
  };
12
12
  }
13
- /** 将协议内指标样式映射为 KLineCharts 的受控样式子集。 */
13
+ /**
14
+ * 将协议内指标样式映射为 KLineCharts 的受控样式子集。
15
+ * 空样式通道必须省略,让引擎保留可用的默认项,避免圆点等图形按空数组取样。
16
+ */
14
17
  export function toKLineChartsIndicatorStyles(styles) {
15
- return {
16
- lines: styles.lines.map(lineStyle),
17
- bars: styles.bars.map((style) => ({
18
+ const converted = {};
19
+ if (styles.lines.length > 0) {
20
+ converted.lines = styles.lines.map(lineStyle);
21
+ }
22
+ if (styles.bars.length > 0) {
23
+ converted.bars = styles.bars.map((style) => ({
18
24
  style: 'fill',
19
25
  upColor: style.upColor,
20
26
  downColor: style.downColor,
21
27
  noChangeColor: style.noChangeColor,
22
- })),
23
- circles: styles.circles.map((style) => ({
28
+ }));
29
+ }
30
+ if (styles.circles.length > 0) {
31
+ converted.circles = styles.circles.map((style) => ({
24
32
  style: 'fill',
25
33
  upColor: style.color,
26
34
  downColor: style.color,
27
35
  noChangeColor: style.color,
28
36
  borderRadius: style.radius,
29
- })),
30
- };
37
+ }));
38
+ }
39
+ return converted;
31
40
  }
32
41
  export function toIndicatorCreate(indicator, idMap, path) {
33
42
  if (!isSupportedIndicator(indicator.name)) {
package/dist/version.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /** Adapter 包版本。 */
2
- export declare const ADAPTER_PACKAGE_VERSION: "0.9.19";
2
+ export declare const ADAPTER_PACKAGE_VERSION: "0.9.20";
3
3
  /** 唯一允许加载的 KLineCharts 引擎版本。 */
4
4
  export declare const KLINECHARTS_ENGINE_VERSION: "10.0.0";
5
5
  /** 与 ChartScene 绑定的 Runtime 协议版本。 */
package/dist/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /** Adapter 包版本。 */
2
- export const ADAPTER_PACKAGE_VERSION = '0.9.19';
2
+ export const ADAPTER_PACKAGE_VERSION = '0.9.20';
3
3
  /** 唯一允许加载的 KLineCharts 引擎版本。 */
4
4
  export const KLINECHARTS_ENGINE_VERSION = '10.0.0';
5
5
  /** 与 ChartScene 绑定的 Runtime 协议版本。 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baron1996/klinecharts-adapter",
3
- "version": "0.9.19",
3
+ "version": "0.9.20",
4
4
  "description": "Controlled ChartScene adapter for KLineCharts.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -38,7 +38,7 @@
38
38
  "typecheck": "tsc -p tsconfig.json --noEmit"
39
39
  },
40
40
  "dependencies": {
41
- "@baron1996/kline-scene-schema": "0.9.19",
41
+ "@baron1996/kline-scene-schema": "0.9.20",
42
42
  "klinecharts": "10.0.0"
43
43
  }
44
44
  }