@visactor/vchart-extension 2.1.0-alpha.25 → 2.1.0-alpha.26

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.
Files changed (143) hide show
  1. package/build/index.js +118 -17
  2. package/build/index.min.js +1 -1
  3. package/cjs/charts/3d/plugin.js +1 -1
  4. package/cjs/charts/3d/pyramid-3d.js +1 -1
  5. package/cjs/charts/3d/rect-3d.js +1 -1
  6. package/cjs/charts/3d/util.js +1 -1
  7. package/cjs/charts/axis-3d/axis-3d-mixin.js +1 -1
  8. package/cjs/charts/axis-3d/band-axis.js +1 -1
  9. package/cjs/charts/axis-3d/index.js +1 -1
  10. package/cjs/charts/axis-3d/linear-axis.js +1 -2
  11. package/cjs/charts/axis-3d/log-axis.js +1 -1
  12. package/cjs/charts/axis-3d/symlog-axis.js +1 -1
  13. package/cjs/charts/axis-3d/theme.js +1 -1
  14. package/cjs/charts/axis-3d/time-axis.js +1 -1
  15. package/cjs/charts/axis-3d/util.js +1 -1
  16. package/cjs/charts/combination-candlestick/combination-candlestick-transformer.js +1 -1
  17. package/cjs/charts/combination-candlestick/combination-candlestick.js +1 -1
  18. package/cjs/charts/combination-candlestick/constant.js +1 -1
  19. package/cjs/charts/combination-candlestick/index.js +1 -1
  20. package/cjs/charts/combination-candlestick/interface.js +1 -1
  21. package/cjs/charts/conversion-funnel/arrow-data-transform.js +1 -1
  22. package/cjs/charts/conversion-funnel/constants.js +1 -1
  23. package/cjs/charts/conversion-funnel/conversion-funnel-transformer.js +1 -1
  24. package/cjs/charts/conversion-funnel/conversion-funnel.js +1 -1
  25. package/cjs/charts/conversion-funnel/index.js +1 -1
  26. package/cjs/charts/conversion-funnel/interface.js +1 -1
  27. package/cjs/charts/conversion-funnel/util.js +1 -1
  28. package/cjs/charts/funnel-3d/chart.js +1 -1
  29. package/cjs/charts/funnel-3d/constant.js +1 -1
  30. package/cjs/charts/funnel-3d/index.js +1 -1
  31. package/cjs/charts/funnel-3d/interface.js +1 -1
  32. package/cjs/charts/funnel-3d/series-spec-transformer.js +1 -1
  33. package/cjs/charts/histogram-3d/chart.js +1 -2
  34. package/cjs/charts/histogram-3d/index.js +1 -1
  35. package/cjs/charts/histogram-3d/interface.js +1 -1
  36. package/cjs/charts/storyline/layouts/wing.js +92 -19
  37. package/cjs/charts/storyline/layouts/wing.js.map +1 -1
  38. package/cjs/charts/storyline/storyline-transformer.js +7 -3
  39. package/cjs/charts/storyline/storyline-transformer.js.map +1 -1
  40. package/cjs/components/bar-link/bar-link.js +1 -1
  41. package/cjs/components/bar-link/constant.js +1 -1
  42. package/cjs/components/bar-link/index.js +1 -1
  43. package/cjs/components/bar-link/type.js +1 -1
  44. package/cjs/components/bar-link/util.js +1 -1
  45. package/cjs/components/bar-regression-line/index.js +1 -1
  46. package/cjs/components/bar-regression-line/type.js +2 -1
  47. package/cjs/components/extension-mark-sync-state/extension-mark-sync-state.js +1 -1
  48. package/cjs/components/extension-mark-sync-state/index.js +1 -1
  49. package/cjs/components/extension-mark-sync-state/type.js +1 -1
  50. package/cjs/components/histogram-regression-line/index.js +1 -1
  51. package/cjs/components/histogram-regression-line/type.js +1 -1
  52. package/cjs/components/map-label/index.js +1 -1
  53. package/cjs/components/map-label/layout.js +1 -1
  54. package/cjs/components/map-label/map-label-transformer.js +1 -1
  55. package/cjs/components/map-label/map-label.js +1 -1
  56. package/cjs/components/map-label/theme.js +1 -1
  57. package/cjs/components/map-label/type.js +1 -1
  58. package/cjs/components/regression-line/index.js +1 -1
  59. package/cjs/components/regression-line/regression-line.js +1 -1
  60. package/cjs/components/regression-line/type.js +1 -1
  61. package/cjs/components/scatter-regression-line/index.js +1 -1
  62. package/cjs/components/scatter-regression-line/type.js +1 -1
  63. package/cjs/components/series-break/constant.js +1 -1
  64. package/cjs/components/series-break/index.js +1 -1
  65. package/cjs/components/series-break/series-break.js +1 -1
  66. package/cjs/components/series-break/type.js +1 -1
  67. package/cjs/components/series-break/util.js +1 -1
  68. package/cjs/components/series-label/constant.js +1 -1
  69. package/cjs/components/series-label/index.js +2 -1
  70. package/cjs/components/series-label/series-label.js +1 -1
  71. package/cjs/components/series-label/type.js +1 -1
  72. package/cjs/components/series-label/util.js +1 -1
  73. package/esm/charts/3d/plugin.js +1 -1
  74. package/esm/charts/3d/pyramid-3d.js +1 -1
  75. package/esm/charts/3d/rect-3d.js +1 -1
  76. package/esm/charts/3d/util.js +1 -1
  77. package/esm/charts/axis-3d/axis-3d-mixin.js +1 -1
  78. package/esm/charts/axis-3d/band-axis.js +1 -1
  79. package/esm/charts/axis-3d/index.js +1 -1
  80. package/esm/charts/axis-3d/linear-axis.js +1 -2
  81. package/esm/charts/axis-3d/log-axis.js +1 -1
  82. package/esm/charts/axis-3d/symlog-axis.js +1 -1
  83. package/esm/charts/axis-3d/theme.js +1 -1
  84. package/esm/charts/axis-3d/time-axis.js +1 -1
  85. package/esm/charts/axis-3d/util.js +1 -1
  86. package/esm/charts/combination-candlestick/combination-candlestick-transformer.js +1 -1
  87. package/esm/charts/combination-candlestick/combination-candlestick.js +1 -1
  88. package/esm/charts/combination-candlestick/constant.js +1 -1
  89. package/esm/charts/combination-candlestick/index.js +1 -1
  90. package/esm/charts/combination-candlestick/interface.js +1 -1
  91. package/esm/charts/conversion-funnel/arrow-data-transform.js +1 -1
  92. package/esm/charts/conversion-funnel/constants.js +1 -1
  93. package/esm/charts/conversion-funnel/conversion-funnel-transformer.js +1 -1
  94. package/esm/charts/conversion-funnel/conversion-funnel.js +1 -1
  95. package/esm/charts/conversion-funnel/index.js +1 -1
  96. package/esm/charts/conversion-funnel/interface.js +1 -1
  97. package/esm/charts/conversion-funnel/util.js +1 -1
  98. package/esm/charts/funnel-3d/chart.js +1 -1
  99. package/esm/charts/funnel-3d/constant.js +1 -1
  100. package/esm/charts/funnel-3d/index.js +1 -1
  101. package/esm/charts/funnel-3d/interface.js +1 -1
  102. package/esm/charts/funnel-3d/series-spec-transformer.js +1 -1
  103. package/esm/charts/histogram-3d/chart.js +1 -2
  104. package/esm/charts/histogram-3d/index.js +1 -1
  105. package/esm/charts/histogram-3d/interface.js +1 -1
  106. package/esm/charts/storyline/layouts/wing.js +92 -19
  107. package/esm/charts/storyline/layouts/wing.js.map +1 -1
  108. package/esm/charts/storyline/storyline-transformer.js +5 -3
  109. package/esm/charts/storyline/storyline-transformer.js.map +1 -1
  110. package/esm/components/bar-link/bar-link.js +1 -1
  111. package/esm/components/bar-link/constant.js +1 -1
  112. package/esm/components/bar-link/index.js +1 -1
  113. package/esm/components/bar-link/type.js +1 -1
  114. package/esm/components/bar-link/util.js +1 -1
  115. package/esm/components/bar-regression-line/index.js +1 -1
  116. package/esm/components/bar-regression-line/type.js +2 -1
  117. package/esm/components/extension-mark-sync-state/extension-mark-sync-state.js +1 -1
  118. package/esm/components/extension-mark-sync-state/index.js +1 -1
  119. package/esm/components/extension-mark-sync-state/type.js +1 -1
  120. package/esm/components/histogram-regression-line/index.js +1 -1
  121. package/esm/components/histogram-regression-line/type.js +1 -1
  122. package/esm/components/map-label/index.js +1 -1
  123. package/esm/components/map-label/layout.js +1 -1
  124. package/esm/components/map-label/map-label-transformer.js +1 -1
  125. package/esm/components/map-label/map-label.js +1 -1
  126. package/esm/components/map-label/theme.js +1 -1
  127. package/esm/components/map-label/type.js +1 -1
  128. package/esm/components/regression-line/index.js +1 -1
  129. package/esm/components/regression-line/regression-line.js +1 -1
  130. package/esm/components/regression-line/type.js +1 -1
  131. package/esm/components/scatter-regression-line/index.js +1 -1
  132. package/esm/components/scatter-regression-line/type.js +1 -1
  133. package/esm/components/series-break/constant.js +1 -1
  134. package/esm/components/series-break/index.js +1 -1
  135. package/esm/components/series-break/series-break.js +1 -1
  136. package/esm/components/series-break/type.js +1 -1
  137. package/esm/components/series-break/util.js +1 -1
  138. package/esm/components/series-label/constant.js +1 -1
  139. package/esm/components/series-label/index.js +2 -1
  140. package/esm/components/series-label/series-label.js +1 -1
  141. package/esm/components/series-label/type.js +1 -1
  142. package/esm/components/series-label/util.js +1 -1
  143. package/package.json +4 -4
@@ -28,4 +28,4 @@ export const register3DPlugin = () => {
28
28
  registerChartPlugin(VChart3dPlugin), registerDirectionalLight(), registerOrthoCamera(),
29
29
  registerViewTransform3dPlugin();
30
30
  };
31
- //# sourceMappingURL=plugin.js.map
31
+ //# sourceMappingURL=plugin.js.map
@@ -21,4 +21,4 @@ export const registerPyramid3dMark = () => {
21
21
  Factory.registerMark(Pyramid3dMark.type, Pyramid3dMark), registerShadowRoot(), registerPyramid3d(),
22
22
  registerPolygonAnimation(), Factory.registerGraphicComponent("pyramid3d", createPyramid3d);
23
23
  };
24
- //# sourceMappingURL=pyramid-3d.js.map
24
+ //# sourceMappingURL=pyramid-3d.js.map
@@ -27,4 +27,4 @@ export const registerRect3dMark = () => {
27
27
  Factory.registerMark(Rect3dMark.type, Rect3dMark), registerShadowRoot(), registerRect3d(),
28
28
  registerRectAnimation(), Factory.registerGraphicComponent("rect3d", createRect3d);
29
29
  };
30
- //# sourceMappingURL=rect-3d.js.map
30
+ //# sourceMappingURL=rect-3d.js.map
@@ -7,4 +7,4 @@ export const is3DChart = spec => {
7
7
  !0);
8
8
  var type;
9
9
  };
10
- //# sourceMappingURL=util.js.map
10
+ //# sourceMappingURL=util.js.map
@@ -56,4 +56,4 @@ export class Axis3dMixin {
56
56
  return getUpdateAttributeOfZAxis(this, ignoreGrid);
57
57
  }
58
58
  }
59
- //# sourceMappingURL=axis-3d-mixin.js.map
59
+ //# sourceMappingURL=axis-3d-mixin.js.map
@@ -13,4 +13,4 @@ export const registerCartesianBandAxis3d = () => {
13
13
  axisZ: Object.assign(Object.assign({}, CartesianBandAxis.builtInTheme.axisX), axisZ)
14
14
  }), mixin(AxisCls, Axis3dMixin);
15
15
  };
16
- //# sourceMappingURL=band-axis.js.map
16
+ //# sourceMappingURL=band-axis.js.map
@@ -16,4 +16,4 @@ export const registerAxis3dPlugin = () => {
16
16
  register3DPlugin(), registerLayout3d(), registerCartesianBandAxis3d(), registerCartesianLinearAxis3d(),
17
17
  registerCartesianTimeAxis3d(), registerCartesianSymlogAxis3d(), registerCartesianLogAxis3d();
18
18
  };
19
- //# sourceMappingURL=index.js.map
19
+ //# sourceMappingURL=index.js.map
@@ -12,5 +12,4 @@ export const registerCartesianLinearAxis3d = () => {
12
12
  AxisCls.builtInTheme = Object.assign(Object.assign({}, AxisCls.builtInTheme), {
13
13
  axisZ: Object.assign(Object.assign({}, CartesianLinearAxis.builtInTheme.axisX), axisZ)
14
14
  }), mixin(AxisCls, Axis3dMixin);
15
- };
16
- //# sourceMappingURL=linear-axis.js.map
15
+ };
@@ -13,4 +13,4 @@ export const registerCartesianLogAxis3d = () => {
13
13
  axisZ: Object.assign(Object.assign({}, CartesianLogAxis.builtInTheme.axisX), axisZ)
14
14
  }), mixin(AxisCls, Axis3dMixin);
15
15
  };
16
- //# sourceMappingURL=log-axis.js.map
16
+ //# sourceMappingURL=log-axis.js.map
@@ -13,4 +13,4 @@ export const registerCartesianSymlogAxis3d = () => {
13
13
  axisZ: Object.assign(Object.assign({}, AxisCls.builtInTheme.axisX), axisZ)
14
14
  }), mixin(AxisCls, Axis3dMixin);
15
15
  };
16
- //# sourceMappingURL=symlog-axis.js.map
16
+ //# sourceMappingURL=symlog-axis.js.map
@@ -3,4 +3,4 @@ export const axisZ = {
3
3
  space: 0
4
4
  }
5
5
  };
6
- //# sourceMappingURL=theme.js.map
6
+ //# sourceMappingURL=theme.js.map
@@ -13,4 +13,4 @@ export const registerCartesianTimeAxis3d = () => {
13
13
  axisZ: Object.assign(Object.assign({}, AxisCls.builtInTheme.axisX), axisZ)
14
14
  }), mixin(AxisCls, Axis3dMixin);
15
15
  };
16
- //# sourceMappingURL=time-axis.js.map
16
+ //# sourceMappingURL=time-axis.js.map
@@ -37,4 +37,4 @@ export const getUpdateAttributeOfZAxis = (axis, ignoreGrid) => {
37
37
  anchor3d: anchor3d
38
38
  }), attrs;
39
39
  };
40
- //# sourceMappingURL=util.js.map
40
+ //# sourceMappingURL=util.js.map
@@ -196,4 +196,4 @@ export class CombinationCandlestickChartSpecTransformer extends CartesianChartSp
196
196
  };
197
197
  }
198
198
  }
199
- //# sourceMappingURL=combination-candlestick-transformer.js.map
199
+ //# sourceMappingURL=combination-candlestick-transformer.js.map
@@ -26,4 +26,4 @@ mixin(CombinationCandlestickChart, StackChartMixin);
26
26
  export const registerCombinationCandlestickChart = () => {
27
27
  registerCandlestickSeries(), Factory.registerChart(CombinationCandlestickChart.type, CombinationCandlestickChart);
28
28
  };
29
- //# sourceMappingURL=combination-candlestick.js.map
29
+ //# sourceMappingURL=combination-candlestick.js.map
@@ -1,2 +1,2 @@
1
1
  export const CombinationCandlestickChart_TYPE = "combinationCandlestick";
2
- //# sourceMappingURL=constant.js.map
2
+ //# sourceMappingURL=constant.js.map
@@ -3,4 +3,4 @@ export * from "./combination-candlestick";
3
3
  export * from "./interface";
4
4
 
5
5
  export * from "./constant";
6
- //# sourceMappingURL=index.js.map
6
+ //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
1
  export { };
2
- //# sourceMappingURL=interface.js.map
2
+ //# sourceMappingURL=interface.js.map
@@ -91,4 +91,4 @@ function computeIndex(arrow, totalArrows) {
91
91
  }
92
92
  return index;
93
93
  }
94
- //# sourceMappingURL=arrow-data-transform.js.map
94
+ //# sourceMappingURL=arrow-data-transform.js.map
@@ -22,4 +22,4 @@ export const DEFAULT_ARROW_TEXT_MARK_STYLE = {
22
22
  export const DEFAULT_FUNNEL_BACKGROUND_MARK_STYLE = {
23
23
  fill: "#eff1f9"
24
24
  };
25
- //# sourceMappingURL=constants.js.map
25
+ //# sourceMappingURL=constants.js.map
@@ -190,4 +190,4 @@ function addFunnelBackgroundMark(funnelBackground) {
190
190
  })
191
191
  });
192
192
  }
193
- //# sourceMappingURL=conversion-funnel-transformer.js.map
193
+ //# sourceMappingURL=conversion-funnel-transformer.js.map
@@ -54,4 +54,4 @@ export const registerConversionFunnelChart = option => {
54
54
  const vchartConstructor = (null == option ? void 0 : option.VChart) || VChart;
55
55
  vchartConstructor && (vchartConstructor.useChart([ ConversionFunnelChart ]), vchartConstructor.useSeries([ ConversionFunnelSeries ]));
56
56
  };
57
- //# sourceMappingURL=conversion-funnel.js.map
57
+ //# sourceMappingURL=conversion-funnel.js.map
@@ -1,4 +1,4 @@
1
1
  export * from "./interface";
2
2
 
3
3
  export * from "./conversion-funnel";
4
- //# sourceMappingURL=index.js.map
4
+ //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
1
  export { };
2
- //# sourceMappingURL=interface.js.map
2
+ //# sourceMappingURL=interface.js.map
@@ -7,4 +7,4 @@ export function isSameArrow(arrow1, arrow2) {
7
7
  const {from: from1, to: to1} = arrow1, {from: from2, to: to2} = arrow2;
8
8
  return from1 === from2 && to1 === to2;
9
9
  }
10
- //# sourceMappingURL=util.js.map
10
+ //# sourceMappingURL=util.js.map
@@ -22,4 +22,4 @@ export const registerFunnel3dChart = () => {
22
22
  registerMarkTooltipProcessor(), register3DPlugin(), registerLayout3d(), registerFunnel3dSeries(),
23
23
  Factory.registerChart(Funnel3dChart.type, Funnel3dChart);
24
24
  };
25
- //# sourceMappingURL=chart.js.map
25
+ //# sourceMappingURL=chart.js.map
@@ -22,4 +22,4 @@ export const funnel3dSeriesMark = Object.assign(Object.assign({}, baseSeriesMark
22
22
  type: "rule"
23
23
  }
24
24
  });
25
- //# sourceMappingURL=constant.js.map
25
+ //# sourceMappingURL=constant.js.map
@@ -5,4 +5,4 @@ export * from "./series";
5
5
  export * from "./series-spec-transformer";
6
6
 
7
7
  export * from "./interface";
8
- //# sourceMappingURL=index.js.map
8
+ //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
1
  export { };
2
- //# sourceMappingURL=interface.js.map
2
+ //# sourceMappingURL=interface.js.map
@@ -5,4 +5,4 @@ export class Funnel3dSeriesSpecTransformer extends FunnelSeriesSpecTransformer {
5
5
  this._addMarkLabelSpec(spec, "funnel3d"), spec.isTransform && this._addMarkLabelSpec(spec, "transform3d", "transformLabel");
6
6
  }
7
7
  }
8
- //# sourceMappingURL=series-spec-transformer.js.map
8
+ //# sourceMappingURL=series-spec-transformer.js.map
@@ -26,5 +26,4 @@ export const registerHistogram3dChart = () => {
26
26
  registerGroupTooltipProcessor(), registerDimensionTooltipProcessor(), registerMarkTooltipProcessor(),
27
27
  registerDimensionEvents(), registerDimensionHover(), register3DPlugin(), registerLayout3d(),
28
28
  registerBar3dSeries(), Factory.registerChart(Histogram3dChart.type, Histogram3dChart);
29
- };
30
- //# sourceMappingURL=chart.js.map
29
+ };
@@ -1,4 +1,4 @@
1
1
  export * from "./chart";
2
2
 
3
3
  export * from "./interface";
4
- //# sourceMappingURL=index.js.map
4
+ //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
1
  export { };
2
- //# sourceMappingURL=interface.js.map
2
+ //# sourceMappingURL=interface.js.map
@@ -1,8 +1,8 @@
1
- import { LayoutZIndex } from "@visactor/vchart";
1
+ import { LayoutZIndex, measureText } from "@visactor/vchart";
2
2
 
3
- import { BLOCK_TITLE_MAX_LINES, buildPlainContent, getBlockTitleHeight, getImageBackgroundStyle, getChartGeometry, getRegionGeometry, getThemeColor, getTitleImageSize, normalizeLayout, omitImageLayoutSpec, resolveAdaptiveLineHeight, resolveTitleFontSize, shouldShowImageBackground } from "./common";
3
+ import { BLOCK_TITLE_MAX_LINES, buildPlainContent, getImageBackgroundStyle, getChartGeometry, getRegionGeometry, getThemeColor, getTitleImageSize, normalizeLayout, omitImageLayoutSpec, resolveAdaptiveLineHeight, shouldShowImageBackground } from "./common";
4
4
 
5
- const WING_BLOCK_IMAGE_SIZE = 160, WING_TEXT_GAP_FROM_IMAGE = 14, WING_TITLE_LINE_HEIGHT = 30, WING_TITLE_FONT_SIZE = 22, WING_CONTENT_LINE_HEIGHT = 17, WING_CONTENT_FONT_SIZE = 12, WING_TEXT_BOX_WIDTH = 240, WING_TEXT_BOX_HEIGHT = 110, WING_TITLE_TO_CONTENT_GAP = 4, WING_TITLE_IMAGE_WIDTH_RATIO = .6, WING_TITLE_IMAGE_MAX_WIDTH = 820, WING_DEFAULT_PATH_END_WIDTH = 350, WING_IMAGE_MIN_SCALE = .52, WING_IMAGE_MAX_SCALE = 1.2, WING_BOTTOM_TEXT_IMAGE_GAP_RATIO = 1.35, clamp = (value, min, max) => Math.max(min, Math.min(max, value)), getWingDirection = spec => "right" === normalizeLayout(spec.layout).direction ? "right" : "left", getWingPathWidthRange = spec => {
5
+ const WING_BLOCK_IMAGE_SIZE = 160, WING_TEXT_GAP_FROM_IMAGE = 14, WING_TITLE_LINE_HEIGHT = 30, WING_TITLE_FONT_SIZE = 22, WING_TITLE_MIN_FONT_SIZE = 14, WING_TITLE_MAX_FONT_SIZE = 30, WING_CONTENT_LINE_HEIGHT = 17, WING_CONTENT_FONT_SIZE = 12, WING_TEXT_BOX_WIDTH = 240, WING_TEXT_BOX_MIN_WIDTH = 240, WING_TEXT_BOX_MAX_WIDTH = 360, WING_TEXT_BOX_WIDTH_RATIO = .24, WING_TEXT_BOX_HEIGHT = 110, WING_TITLE_TO_CONTENT_GAP = 4, WING_TITLE_IMAGE_WIDTH_RATIO = .6, WING_TITLE_IMAGE_MAX_WIDTH = 820, WING_DEFAULT_PATH_END_WIDTH = 350, WING_IMAGE_MIN_SCALE = .52, WING_IMAGE_MAX_SCALE = 1.2, WING_BOTTOM_TEXT_IMAGE_GAP_RATIO = 1.35, WING_PATH_EDGE_GAP = 8, clamp = (value, min, max) => Math.max(min, Math.min(max, value)), getWingDirection = spec => "right" === normalizeLayout(spec.layout).direction ? "right" : "left", getWingPathWidthRange = spec => {
6
6
  var _a, _b, _c, _e, _f;
7
7
  const lineStyle = null !== (_b = null === (_a = spec.line) || void 0 === _a ? void 0 : _a.style) && void 0 !== _b ? _b : {}, startWidth = Math.max(Number(null !== (_c = lineStyle.startWidth) && void 0 !== _c ? _c : 50), .5);
8
8
  return {
@@ -16,14 +16,46 @@ const WING_BLOCK_IMAGE_SIZE = 160, WING_TEXT_GAP_FROM_IMAGE = 14, WING_TITLE_LIN
16
16
  }, getWingBlockImageScale = (spec, index) => {
17
17
  const {startWidth: startWidth, endWidth: endWidth} = getWingPathWidthRange(spec), startScale = clamp(startWidth / 350, .52, 1.2);
18
18
  return startScale + (clamp(endWidth / 350, .52, 1.2) - startScale) * getWingBlockPathRatio(spec, index);
19
+ }, getConfiguredTextBoxWidth = spec => {
20
+ var _a, _b, _c;
21
+ const style = null === (_a = spec.title) || void 0 === _a ? void 0 : _a.style, width = Number(null !== (_c = null !== (_b = null == style ? void 0 : style.width) && void 0 !== _b ? _b : null == style ? void 0 : style.maxLineWidth) && void 0 !== _c ? _c : 240);
22
+ return Number.isFinite(width) && width > 0 ? width : 240;
23
+ }, getWingTextBoxWidth = (spec, ctx) => {
24
+ const {width: width} = getRegionGeometry(ctx, spec), configuredWidth = getConfiguredTextBoxWidth(spec), adaptiveWidth = Math.max(configuredWidth, Math.round(.24 * width));
25
+ return clamp(adaptiveWidth, 240, 360);
26
+ }, estimateTextWidth = (text, fontSize) => Array.from(text).reduce(((sum, char) => 0 === char.trim().length ? sum + .32 * fontSize : sum + fontSize * (char.charCodeAt(0) > 255 ? 1.05 : .62)), 0), measureWingTitleWidth = (title, fontSize, style) => {
27
+ var _a;
28
+ if (!title) return 0;
29
+ try {
30
+ const size = measureText(title, {
31
+ fontSize: fontSize,
32
+ fontFamily: style.fontFamily,
33
+ fontWeight: null !== (_a = style.fontWeight) && void 0 !== _a ? _a : "bold"
34
+ });
35
+ return Number.isFinite(size.width) && size.width > 0 ? size.width : estimateTextWidth(title, fontSize);
36
+ } catch (_err) {
37
+ return estimateTextWidth(title, fontSize);
38
+ }
39
+ }, getMeasuredTitleLineCount = (title, fontSize, textWidth, style) => {
40
+ if (!title) return 0;
41
+ const measuredWidth = measureWingTitleWidth(title, fontSize, style);
42
+ return Math.max(1, Math.min(BLOCK_TITLE_MAX_LINES, Math.ceil(measuredWidth / Math.max(.96 * textWidth, 1))));
43
+ }, resolveWingTitleFontSize = (spec, index, textWidth) => {
44
+ var _a, _b, _c, _e;
45
+ const style = null !== (_b = null === (_a = spec.title) || void 0 === _a ? void 0 : _a.style) && void 0 !== _b ? _b : {}, configuredFontSize = style.fontSize;
46
+ if (null != configuredFontSize) return Number(configuredFontSize);
47
+ const title = null === (_e = null === (_c = spec.data) || void 0 === _c ? void 0 : _c[index]) || void 0 === _e ? void 0 : _e.title, measuredWidth = measureWingTitleWidth(title, 22, style);
48
+ if (!measuredWidth) return 22;
49
+ const widthLimit = textWidth * BLOCK_TITLE_MAX_LINES * .96, measuredPerFont = measuredWidth / 22, fittedFontSize = Math.floor(widthLimit / Math.max(measuredPerFont, 1));
50
+ return clamp(fittedFontSize, 14, 30);
19
51
  }, getWingArcGeometry = (spec, ctx) => {
20
52
  var _a, _b, _c;
21
- const {width: width, height: height, startX: startX, startY: startY} = getRegionGeometry(ctx), innerWidth = Math.max(width, 1), innerHeight = Math.max(height, 1), layoutOpt = normalizeLayout(spec.layout), direction = getWingDirection(spec), defaultStart = "right" === direction ? 110 : -70, defaultEnd = "right" === direction ? 250 : 70, startAngle = null !== (_a = layoutOpt.startAngle) && void 0 !== _a ? _a : defaultStart, endAngle = null !== (_b = layoutOpt.endAngle) && void 0 !== _b ? _b : defaultEnd, ratio = null !== (_c = layoutOpt.radiusRatio) && void 0 !== _c ? _c : .92, rx = .6 * innerWidth * ratio;
53
+ const {width: width, height: height, startX: startX, startY: startY} = getRegionGeometry(ctx), innerWidth = Math.max(width, 1), innerHeight = Math.max(height, 1), layoutOpt = normalizeLayout(spec.layout), direction = getWingDirection(spec), defaultStart = "right" === direction ? 110 : -70, defaultEnd = "right" === direction ? 250 : 70, startAngle = null !== (_a = layoutOpt.startAngle) && void 0 !== _a ? _a : defaultStart, endAngle = null !== (_b = layoutOpt.endAngle) && void 0 !== _b ? _b : defaultEnd, ratio = null !== (_c = layoutOpt.radiusRatio) && void 0 !== _c ? _c : .92, {startWidth: startWidth, endWidth: endWidth} = getWingPathWidthRange(spec), topPathWidth = "right" === direction ? endWidth : startWidth, pathTopInset = Math.min(Math.max(innerHeight / 2 - 1, 0), Math.ceil(topPathWidth / 2 + 8)), ry = Math.max(innerHeight - pathTopInset, 1) / 2 * ratio, rx = .6 * innerWidth * ratio;
22
54
  return {
23
55
  cx: "right" === direction ? startX + innerWidth - .1 * rx : startX + .1 * rx,
24
- cy: startY + innerHeight / 2,
56
+ cy: startY + pathTopInset - Math.min(Math.sin(startAngle / 180 * Math.PI), Math.sin(endAngle / 180 * Math.PI), 0) * ry,
25
57
  rx: rx,
26
- ry: innerHeight / 2 * ratio,
58
+ ry: ry,
27
59
  startAngle: startAngle,
28
60
  endAngle: endAngle
29
61
  };
@@ -103,11 +135,50 @@ export const buildWingTitleImageMark = spec => {
103
135
  name: "storyline-wing-title-image",
104
136
  zIndex: LayoutZIndex.Mark + 8,
105
137
  children: [ Object.assign(Object.assign({
138
+ type: "rect",
139
+ name: "storyline-wing-title-image-node",
140
+ interactive: !1
141
+ }, spec.titleImage), {
142
+ _debug_bounds: !0,
143
+ style: Object.assign({
144
+ _debug_bounds: !0,
145
+ x: (_d, ctx) => {
146
+ const {width: width, height: height, startX: startX} = getChartGeometry(ctx, spec), size = getTitleImageSize(spec, width, height, {
147
+ widthRatio: .6,
148
+ maxWidth: 820
149
+ });
150
+ return "right" === getWingDirection(spec) ? startX : startX + width - size.width;
151
+ },
152
+ fill: "red",
153
+ y: (_d, ctx) => getChartGeometry(ctx, spec).startY + 12,
154
+ width: (_d, ctx) => {
155
+ const {width: width, height: height} = getChartGeometry(ctx, spec);
156
+ return getTitleImageSize(spec, width, height, {
157
+ widthRatio: .6,
158
+ maxWidth: 820
159
+ }).width;
160
+ },
161
+ height: (_d, ctx) => {
162
+ const {width: width, height: height} = getChartGeometry(ctx, spec);
163
+ return getTitleImageSize(spec, width, height, {
164
+ widthRatio: .6,
165
+ maxWidth: 820
166
+ }).height;
167
+ },
168
+ image: spec.titleImage.image,
169
+ repeatX: "no-repeat",
170
+ repeatY: "no-repeat",
171
+ imageMode: "contain",
172
+ imagePosition: "center"
173
+ }, spec.titleImage.style)
174
+ }), Object.assign(Object.assign({
106
175
  type: "image",
107
176
  name: "storyline-wing-title-image-node",
108
177
  interactive: !1
109
178
  }, spec.titleImage), {
179
+ _debug_bounds: !0,
110
180
  style: Object.assign({
181
+ _debug_bounds: !0,
111
182
  x: (_d, ctx) => {
112
183
  const {width: width, height: height, startX: startX} = getChartGeometry(ctx, spec), size = getTitleImageSize(spec, width, height, {
113
184
  widthRatio: .6,
@@ -141,25 +212,25 @@ export const buildWingTitleImageMark = spec => {
141
212
  };
142
213
 
143
214
  const WING_TEXT_IMAGE_GAP = 120, getWingBlockMetrics = (spec, ctx, index) => {
144
- var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
145
- const titleFontSize = resolveTitleFontSize(spec, ctx, null === (_b = null === (_a = spec.data) || void 0 === _a ? void 0 : _a[index]) || void 0 === _b ? void 0 : _b.title, 240, 22, [ 8, 30 ]), titleLineHeight = resolveAdaptiveLineHeight(titleFontSize, null === (_c = spec.title) || void 0 === _c ? void 0 : _c.style, 30, 1.3), titleHeight = getBlockTitleHeight(titleLineHeight, null === (_f = null === (_e = spec.data) || void 0 === _e ? void 0 : _e[index]) || void 0 === _f ? void 0 : _f.title, 240, titleFontSize), contentFontSize = Number(null !== (_j = null === (_h = null === (_g = spec.content) || void 0 === _g ? void 0 : _g.style) || void 0 === _h ? void 0 : _h.fontSize) && void 0 !== _j ? _j : 12), contentLineHeight = Number(null !== (_m = null === (_l = null === (_k = spec.content) || void 0 === _k ? void 0 : _k.style) || void 0 === _l ? void 0 : _l.lineHeight) && void 0 !== _m ? _m : 17), imageScale = getWingBlockImageScale(spec, index), imageWidth = Math.round(Number(null !== (_p = null === (_o = spec.image) || void 0 === _o ? void 0 : _o.width) && void 0 !== _p ? _p : 160) * imageScale), imageHeight = Math.round(Number(null !== (_r = null === (_q = spec.image) || void 0 === _q ? void 0 : _q.height) && void 0 !== _r ? _r : 160) * imageScale), imageBox = {
215
+ var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
216
+ const textWidth = getWingTextBoxWidth(spec, ctx), titleStyle = null !== (_b = null === (_a = spec.title) || void 0 === _a ? void 0 : _a.style) && void 0 !== _b ? _b : {}, titleFontSize = resolveWingTitleFontSize(spec, index, textWidth), titleLineHeight = resolveAdaptiveLineHeight(titleFontSize, titleStyle, 30, 1.3), titleHeight = titleLineHeight * getMeasuredTitleLineCount(null === (_e = null === (_c = spec.data) || void 0 === _c ? void 0 : _c[index]) || void 0 === _e ? void 0 : _e.title, titleFontSize, textWidth, titleStyle), contentFontSize = Number(null !== (_h = null === (_g = null === (_f = spec.content) || void 0 === _f ? void 0 : _f.style) || void 0 === _g ? void 0 : _g.fontSize) && void 0 !== _h ? _h : 12), contentLineHeight = Number(null !== (_l = null === (_k = null === (_j = spec.content) || void 0 === _j ? void 0 : _j.style) || void 0 === _k ? void 0 : _k.lineHeight) && void 0 !== _l ? _l : 17), imageScale = getWingBlockImageScale(spec, index), imageWidth = Math.round(Number(null !== (_o = null === (_m = spec.image) || void 0 === _m ? void 0 : _m.width) && void 0 !== _o ? _o : 160) * imageScale), imageHeight = Math.round(Number(null !== (_q = null === (_p = spec.image) || void 0 === _p ? void 0 : _p.height) && void 0 !== _q ? _q : 160) * imageScale), imageBox = {
146
217
  x: -imageWidth / 2,
147
218
  y: -imageHeight / 2,
148
219
  width: imageWidth,
149
220
  height: imageHeight
150
- }, direction = getWingDirection(spec), count = null !== (_t = null === (_s = spec.data) || void 0 === _s ? void 0 : _s.length) && void 0 !== _t ? _t : 0, isSpecialBelow = "right" === direction && count > 0 && index === count - 1 || "left" === direction && 0 === index, isBottomAbove = isWingBottomBlock(spec, ctx, index), isVerticalLayout = isBottomAbove || isSpecialBelow;
221
+ }, direction = getWingDirection(spec), count = null !== (_s = null === (_r = spec.data) || void 0 === _r ? void 0 : _r.length) && void 0 !== _s ? _s : 0, isSpecialBelow = "right" === direction && count > 0 && index === count - 1 || "left" === direction && 0 === index, isBottomAbove = isWingBottomBlock(spec, ctx, index), isVerticalLayout = isBottomAbove || isSpecialBelow;
151
222
  let textBox, contentBox, connectorBox, onLeft, verticalAlign;
152
223
  if (isBottomAbove) {
153
- const bottomTextImageGap = Math.round(162), textX = -120, textY = -imageHeight / 2 - bottomTextImageGap - 110;
224
+ const bottomTextImageGap = Math.round(162), textX = -textWidth / 2, textY = -imageHeight / 2 - bottomTextImageGap - 110;
154
225
  textBox = {
155
226
  x: textX,
156
227
  y: textY,
157
- width: 240,
228
+ width: textWidth,
158
229
  height: 110
159
230
  }, contentBox = {
160
231
  x: textX,
161
232
  y: textY + titleHeight + 4,
162
- width: 240,
233
+ width: textWidth,
163
234
  height: 1e5
164
235
  }, connectorBox = {
165
236
  x: -1,
@@ -168,16 +239,16 @@ const WING_TEXT_IMAGE_GAP = 120, getWingBlockMetrics = (spec, ctx, index) => {
168
239
  height: bottomTextImageGap
169
240
  }, onLeft = !1, verticalAlign = "above";
170
241
  } else if (isVerticalLayout) {
171
- const textX = -120, textY = imageHeight / 2 + 120;
242
+ const textX = -textWidth / 2, textY = imageHeight / 2 + 120;
172
243
  textBox = {
173
244
  x: textX,
174
245
  y: textY,
175
- width: 240,
246
+ width: textWidth,
176
247
  height: 110
177
248
  }, contentBox = {
178
249
  x: textX,
179
250
  y: textY + titleHeight + 4,
180
- width: 240,
251
+ width: textWidth,
181
252
  height: 1e5
182
253
  }, connectorBox = {
183
254
  x: -1,
@@ -186,19 +257,19 @@ const WING_TEXT_IMAGE_GAP = 120, getWingBlockMetrics = (spec, ctx, index) => {
186
257
  height: 120
187
258
  }, onLeft = !1, verticalAlign = "below";
188
259
  } else {
189
- const textOnLeft = "right" === direction, textX = textOnLeft ? -imageWidth / 2 - 120 - 240 : imageWidth / 2 + 120, textY = -55;
260
+ const textOnLeft = "right" === direction, textX = textOnLeft ? -imageWidth / 2 - 120 - textWidth : imageWidth / 2 + 120, textY = -55;
190
261
  textBox = {
191
262
  x: textX,
192
263
  y: textY,
193
- width: 240,
264
+ width: textWidth,
194
265
  height: 110
195
266
  }, contentBox = {
196
267
  x: textX,
197
268
  y: textY + titleHeight + 4,
198
- width: 240,
269
+ width: textWidth,
199
270
  height: 1e5
200
271
  };
201
- const imageEdgeX = textOnLeft ? -imageWidth / 2 : imageWidth / 2, textEdgeX = textOnLeft ? textX + 240 : textX;
272
+ const imageEdgeX = textOnLeft ? -imageWidth / 2 : imageWidth / 2, textEdgeX = textOnLeft ? textX + textWidth : textX;
202
273
  connectorBox = {
203
274
  x: Math.min(imageEdgeX, textEdgeX),
204
275
  y: 0,
@@ -298,6 +369,8 @@ export const buildWingBlockMark = (spec, block, index) => {
298
369
  return m.verticalAlign ? m.textBox.x + m.textBox.width / 2 : m.onLeft ? m.textBox.x + m.textBox.width : m.textBox.x;
299
370
  },
300
371
  y: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).textBox.y,
372
+ width: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).textBox.width,
373
+ maxLineWidth: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).textBox.width,
301
374
  text: block.title,
302
375
  height: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).titleHeight,
303
376
  heightLimit: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).titleLineHeight * BLOCK_TITLE_MAX_LINES,