@visactor/vchart-extension 2.1.0-alpha.21 → 2.1.0-alpha.23

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 (189) hide show
  1. package/build/index.js +526 -489
  2. package/build/index.min.js +2 -2
  3. package/cjs/charts/axis-3d/index.js +2 -1
  4. package/cjs/charts/axis-3d/linear-axis.js +1 -2
  5. package/cjs/charts/bar-3d/chart-spec-transformer.js +1 -1
  6. package/cjs/charts/bar-3d/chart.js +1 -1
  7. package/cjs/charts/bar-3d/constant.js +1 -1
  8. package/cjs/charts/bar-3d/index.js +1 -1
  9. package/cjs/charts/bar-3d/interface.js +1 -1
  10. package/cjs/charts/bar-3d/series-spec-transformer.js +1 -1
  11. package/cjs/charts/bar-3d/series.js +1 -1
  12. package/cjs/charts/bar-3d/theme.js +1 -1
  13. package/cjs/charts/candlestick/candlestick-transformer.js +1 -1
  14. package/cjs/charts/candlestick/candlestick.js +1 -2
  15. package/cjs/charts/candlestick/index.js +1 -1
  16. package/cjs/charts/candlestick/interface.js +1 -1
  17. package/cjs/charts/candlestick/util.js +1 -1
  18. package/cjs/charts/combination-candlestick/combination-candlestick-transformer.js +1 -1
  19. package/cjs/charts/combination-candlestick/combination-candlestick.js +1 -1
  20. package/cjs/charts/combination-candlestick/constant.js +1 -1
  21. package/cjs/charts/combination-candlestick/index.js +1 -1
  22. package/cjs/charts/combination-candlestick/interface.js +1 -1
  23. package/cjs/charts/conversion-funnel/arrow-data-transform.js +1 -1
  24. package/cjs/charts/conversion-funnel/constants.js +1 -1
  25. package/cjs/charts/conversion-funnel/conversion-funnel-transformer.js +1 -1
  26. package/cjs/charts/conversion-funnel/conversion-funnel.js +1 -1
  27. package/cjs/charts/conversion-funnel/index.js +1 -1
  28. package/cjs/charts/conversion-funnel/interface.js +1 -1
  29. package/cjs/charts/conversion-funnel/util.js +1 -1
  30. package/cjs/charts/funnel-3d/chart.js +1 -2
  31. package/cjs/charts/funnel-3d/constant.js +1 -1
  32. package/cjs/charts/funnel-3d/index.js +1 -1
  33. package/cjs/charts/funnel-3d/interface.js +1 -1
  34. package/cjs/charts/funnel-3d/series-spec-transformer.js +1 -1
  35. package/cjs/charts/funnel-3d/series.js +1 -1
  36. package/cjs/charts/funnel-3d/theme.js +1 -1
  37. package/cjs/charts/histogram-3d/chart.js +1 -1
  38. package/cjs/charts/storyline/interface.d.ts +2 -2
  39. package/cjs/charts/storyline/interface.js.map +1 -1
  40. package/cjs/charts/storyline/layouts/arc.d.ts +1 -1
  41. package/cjs/charts/storyline/layouts/arc.js +92 -111
  42. package/cjs/charts/storyline/layouts/arc.js.map +1 -1
  43. package/cjs/charts/storyline/layouts/clock.d.ts +1 -1
  44. package/cjs/charts/storyline/layouts/clock.js +47 -37
  45. package/cjs/charts/storyline/layouts/clock.js.map +1 -1
  46. package/cjs/charts/storyline/layouts/common.d.ts +56 -16
  47. package/cjs/charts/storyline/layouts/common.js +185 -40
  48. package/cjs/charts/storyline/layouts/common.js.map +1 -1
  49. package/cjs/charts/storyline/layouts/default.js +34 -28
  50. package/cjs/charts/storyline/layouts/default.js.map +1 -1
  51. package/cjs/charts/storyline/layouts/ladder.js +35 -28
  52. package/cjs/charts/storyline/layouts/ladder.js.map +1 -1
  53. package/cjs/charts/storyline/layouts/landscape.js +39 -34
  54. package/cjs/charts/storyline/layouts/landscape.js.map +1 -1
  55. package/cjs/charts/storyline/layouts/portrait.d.ts +2 -2
  56. package/cjs/charts/storyline/layouts/portrait.js +78 -65
  57. package/cjs/charts/storyline/layouts/portrait.js.map +1 -1
  58. package/cjs/charts/storyline/layouts/wing.d.ts +1 -0
  59. package/cjs/charts/storyline/layouts/wing.js +103 -54
  60. package/cjs/charts/storyline/layouts/wing.js.map +1 -1
  61. package/cjs/charts/storyline/storyline-transformer.js +18 -14
  62. package/cjs/charts/storyline/storyline-transformer.js.map +1 -1
  63. package/cjs/components/bar-link/bar-link.js +1 -1
  64. package/cjs/components/bar-link/constant.js +1 -1
  65. package/cjs/components/bar-link/index.js +1 -1
  66. package/cjs/components/bar-link/type.js +1 -1
  67. package/cjs/components/bar-link/util.js +1 -1
  68. package/cjs/components/bar-regression-line/index.js +1 -1
  69. package/cjs/components/bar-regression-line/type.js +1 -1
  70. package/cjs/components/extension-mark-sync-state/extension-mark-sync-state.js +1 -1
  71. package/cjs/components/extension-mark-sync-state/index.js +1 -1
  72. package/cjs/components/extension-mark-sync-state/type.js +1 -1
  73. package/cjs/components/histogram-regression-line/index.js +1 -1
  74. package/cjs/components/histogram-regression-line/type.js +2 -1
  75. package/cjs/components/map-label/index.js +1 -1
  76. package/cjs/components/map-label/layout.js +1 -1
  77. package/cjs/components/map-label/map-label-transformer.js +1 -1
  78. package/cjs/components/map-label/map-label.js +1 -1
  79. package/cjs/components/map-label/theme.js +1 -1
  80. package/cjs/components/map-label/type.js +1 -1
  81. package/cjs/components/regression-line/index.js +1 -1
  82. package/cjs/components/regression-line/regression-line.js +1 -1
  83. package/cjs/components/regression-line/type.js +1 -1
  84. package/cjs/components/scatter-regression-line/index.js +1 -1
  85. package/cjs/components/scatter-regression-line/type.js +1 -1
  86. package/cjs/components/series-break/constant.js +1 -1
  87. package/cjs/components/series-break/index.js +1 -1
  88. package/cjs/components/series-break/series-break.js +1 -1
  89. package/cjs/components/series-break/type.js +1 -1
  90. package/cjs/components/series-break/util.js +2 -1
  91. package/cjs/components/series-label/constant.js +1 -1
  92. package/cjs/components/series-label/index.js +1 -1
  93. package/cjs/components/series-label/series-label.js +1 -1
  94. package/cjs/components/series-label/type.js +1 -1
  95. package/cjs/components/series-label/util.js +1 -1
  96. package/esm/charts/axis-3d/index.js +2 -1
  97. package/esm/charts/axis-3d/linear-axis.js +1 -2
  98. package/esm/charts/bar-3d/chart-spec-transformer.js +1 -1
  99. package/esm/charts/bar-3d/chart.js +1 -1
  100. package/esm/charts/bar-3d/constant.js +1 -1
  101. package/esm/charts/bar-3d/index.js +1 -1
  102. package/esm/charts/bar-3d/interface.js +1 -1
  103. package/esm/charts/bar-3d/series-spec-transformer.js +1 -1
  104. package/esm/charts/bar-3d/series.js +1 -1
  105. package/esm/charts/bar-3d/theme.js +1 -1
  106. package/esm/charts/candlestick/candlestick-transformer.js +1 -1
  107. package/esm/charts/candlestick/candlestick.js +1 -2
  108. package/esm/charts/candlestick/index.js +1 -1
  109. package/esm/charts/candlestick/interface.js +1 -1
  110. package/esm/charts/candlestick/util.js +1 -1
  111. package/esm/charts/combination-candlestick/combination-candlestick-transformer.js +1 -1
  112. package/esm/charts/combination-candlestick/combination-candlestick.js +1 -1
  113. package/esm/charts/combination-candlestick/constant.js +1 -1
  114. package/esm/charts/combination-candlestick/index.js +1 -1
  115. package/esm/charts/combination-candlestick/interface.js +1 -1
  116. package/esm/charts/conversion-funnel/arrow-data-transform.js +1 -1
  117. package/esm/charts/conversion-funnel/constants.js +1 -1
  118. package/esm/charts/conversion-funnel/conversion-funnel-transformer.js +1 -1
  119. package/esm/charts/conversion-funnel/conversion-funnel.js +1 -1
  120. package/esm/charts/conversion-funnel/index.js +1 -1
  121. package/esm/charts/conversion-funnel/interface.js +1 -1
  122. package/esm/charts/conversion-funnel/util.js +1 -1
  123. package/esm/charts/funnel-3d/chart.js +1 -2
  124. package/esm/charts/funnel-3d/constant.js +1 -1
  125. package/esm/charts/funnel-3d/index.js +1 -1
  126. package/esm/charts/funnel-3d/interface.js +1 -1
  127. package/esm/charts/funnel-3d/series-spec-transformer.js +1 -1
  128. package/esm/charts/funnel-3d/series.js +1 -1
  129. package/esm/charts/funnel-3d/theme.js +1 -1
  130. package/esm/charts/histogram-3d/chart.js +1 -1
  131. package/esm/charts/storyline/interface.d.ts +2 -2
  132. package/esm/charts/storyline/interface.js.map +1 -1
  133. package/esm/charts/storyline/layouts/arc.d.ts +1 -1
  134. package/esm/charts/storyline/layouts/arc.js +86 -109
  135. package/esm/charts/storyline/layouts/arc.js.map +1 -1
  136. package/esm/charts/storyline/layouts/clock.d.ts +1 -1
  137. package/esm/charts/storyline/layouts/clock.js +45 -36
  138. package/esm/charts/storyline/layouts/clock.js.map +1 -1
  139. package/esm/charts/storyline/layouts/common.d.ts +56 -16
  140. package/esm/charts/storyline/layouts/common.js +168 -35
  141. package/esm/charts/storyline/layouts/common.js.map +1 -1
  142. package/esm/charts/storyline/layouts/default.js +30 -26
  143. package/esm/charts/storyline/layouts/default.js.map +1 -1
  144. package/esm/charts/storyline/layouts/ladder.js +30 -26
  145. package/esm/charts/storyline/layouts/ladder.js.map +1 -1
  146. package/esm/charts/storyline/layouts/landscape.js +35 -34
  147. package/esm/charts/storyline/layouts/landscape.js.map +1 -1
  148. package/esm/charts/storyline/layouts/portrait.d.ts +2 -2
  149. package/esm/charts/storyline/layouts/portrait.js +75 -68
  150. package/esm/charts/storyline/layouts/portrait.js.map +1 -1
  151. package/esm/charts/storyline/layouts/wing.d.ts +1 -0
  152. package/esm/charts/storyline/layouts/wing.js +97 -54
  153. package/esm/charts/storyline/layouts/wing.js.map +1 -1
  154. package/esm/charts/storyline/storyline-transformer.js +20 -18
  155. package/esm/charts/storyline/storyline-transformer.js.map +1 -1
  156. package/esm/components/bar-link/bar-link.js +1 -1
  157. package/esm/components/bar-link/constant.js +1 -1
  158. package/esm/components/bar-link/index.js +1 -1
  159. package/esm/components/bar-link/type.js +1 -1
  160. package/esm/components/bar-link/util.js +1 -1
  161. package/esm/components/bar-regression-line/index.js +1 -1
  162. package/esm/components/bar-regression-line/type.js +1 -1
  163. package/esm/components/extension-mark-sync-state/extension-mark-sync-state.js +1 -1
  164. package/esm/components/extension-mark-sync-state/index.js +1 -1
  165. package/esm/components/extension-mark-sync-state/type.js +1 -1
  166. package/esm/components/histogram-regression-line/index.js +1 -1
  167. package/esm/components/histogram-regression-line/type.js +2 -1
  168. package/esm/components/map-label/index.js +1 -1
  169. package/esm/components/map-label/layout.js +1 -1
  170. package/esm/components/map-label/map-label-transformer.js +1 -1
  171. package/esm/components/map-label/map-label.js +1 -1
  172. package/esm/components/map-label/theme.js +1 -1
  173. package/esm/components/map-label/type.js +1 -1
  174. package/esm/components/regression-line/index.js +1 -1
  175. package/esm/components/regression-line/regression-line.js +1 -1
  176. package/esm/components/regression-line/type.js +1 -1
  177. package/esm/components/scatter-regression-line/index.js +1 -1
  178. package/esm/components/scatter-regression-line/type.js +1 -1
  179. package/esm/components/series-break/constant.js +1 -1
  180. package/esm/components/series-break/index.js +1 -1
  181. package/esm/components/series-break/series-break.js +1 -1
  182. package/esm/components/series-break/type.js +1 -1
  183. package/esm/components/series-break/util.js +2 -1
  184. package/esm/components/series-label/constant.js +1 -1
  185. package/esm/components/series-label/index.js +1 -1
  186. package/esm/components/series-label/series-label.js +1 -1
  187. package/esm/components/series-label/type.js +1 -1
  188. package/esm/components/series-label/util.js +1 -1
  189. package/package.json +2 -2
@@ -12,9 +12,9 @@ var __rest = this && this.__rest || function(s, e) {
12
12
 
13
13
  Object.defineProperty(exports, "__esModule", {
14
14
  value: !0
15
- }), exports.normalizePadding = exports.normalizeLayout = exports.buildSmoothCurvePath = exports.getTextBox = exports.getImageBox = exports.omitImageLayoutSpec = exports.buildRichContent = exports.getLayout = exports.getRegionGeometry = exports.resolveBlockWidth = exports.withAlpha = exports.shouldShowImageBackground = exports.getThemeColor = exports.isLadder = exports.isWing = exports.isArc = exports.isClock = exports.isPortrait = exports.isLandscape = exports.DEFAULT_THEME_COLOR = exports.DEFAULT_IMAGE_GAP = exports.DEFAULT_IMAGE_HEIGHT = exports.DEFAULT_IMAGE_WIDTH = exports.DEFAULT_BLOCK_GAP = exports.DEFAULT_BLOCK_WIDTH_RATIO = exports.DEFAULT_BLOCK_HEIGHT = exports.DEFAULT_BLOCK_WIDTH = void 0;
15
+ }), exports.normalizePadding = exports.normalizeLayout = exports.buildSmoothCurvePath = exports.getTextBox = exports.getImageBox = exports.omitImageLayoutSpec = exports.getBlockTitleHeight = exports.buildPlainContent = exports.getLayout = exports.getRegionGeometry = exports.resolveBlockWidth = exports.withAlpha = exports.buildTopTitleImageMark = exports.getChartGeometry = exports.getTitleImageReservedHeight = exports.getTitleImageSize = exports.getImageBackgroundStyle = exports.resolveMarkerFontSize = exports.resolveTitleFontSize = exports.resolveAdaptiveLineHeight = exports.shouldShowImageBackground = exports.getThemeColor = exports.isLadder = exports.isWing = exports.isArc = exports.isClock = exports.isPortrait = exports.isLandscape = exports.BLOCK_TITLE_MAX_LINES = exports.DEFAULT_THEME_COLOR = exports.DEFAULT_IMAGE_GAP = exports.DEFAULT_IMAGE_HEIGHT = exports.DEFAULT_IMAGE_WIDTH = exports.DEFAULT_BLOCK_GAP = exports.DEFAULT_BLOCK_WIDTH_RATIO = exports.DEFAULT_BLOCK_HEIGHT = exports.DEFAULT_BLOCK_WIDTH = void 0;
16
16
 
17
- const layout_1 = require("../layout");
17
+ const vchart_1 = require("@visactor/vchart"), layout_1 = require("../layout");
18
18
 
19
19
  Object.defineProperty(exports, "normalizeLayout", {
20
20
  enumerable: !0,
@@ -28,9 +28,10 @@ Object.defineProperty(exports, "normalizeLayout", {
28
28
  }
29
29
  }), exports.DEFAULT_BLOCK_WIDTH = 180, exports.DEFAULT_BLOCK_HEIGHT = 400, exports.DEFAULT_BLOCK_WIDTH_RATIO = .24,
30
30
  exports.DEFAULT_BLOCK_GAP = 36, exports.DEFAULT_IMAGE_WIDTH = 48, exports.DEFAULT_IMAGE_HEIGHT = 48,
31
- exports.DEFAULT_IMAGE_GAP = 10, exports.DEFAULT_THEME_COLOR = "#e8543d";
31
+ exports.DEFAULT_IMAGE_GAP = 10, exports.DEFAULT_THEME_COLOR = "#e8543d", exports.BLOCK_TITLE_MAX_LINES = 2;
32
32
 
33
- const isLandscape = spec => "landscape" === (0, layout_1.normalizeLayout)(spec.layout).type;
33
+ const DEFAULT_TITLE_IMAGE_WIDTH_RATIO = .52, DEFAULT_TITLE_IMAGE_MAX_WIDTH = 720, DEFAULT_TITLE_IMAGE_HEIGHT_RATIO = .36, DEFAULT_TITLE_IMAGE_TOP = 12, DEFAULT_TITLE_IMAGE_BOTTOM = 24, isLandscape = spec => "landscape" === (0,
34
+ layout_1.normalizeLayout)(spec.layout).type;
34
35
 
35
36
  exports.isLandscape = isLandscape;
36
37
 
@@ -69,6 +70,161 @@ const shouldShowImageBackground = spec => {
69
70
 
70
71
  exports.shouldShowImageBackground = shouldShowImageBackground;
71
72
 
73
+ const TITLE_FONT_SCALE_ID = "storylineTitleFontSize", MARKER_FONT_SCALE_ID = "storylineMarkerFontSize", clamp = (value, min, max) => Math.max(min, Math.min(max, value)), getTextWeight = text => text ? Math.max(Array.from(text).reduce(((sum, char) => 0 === char.trim().length ? sum + .32 : sum + (char.charCodeAt(0) > 255 ? 1.05 : .62)), 0), 1) : 4, getScaleRange = (spec, scaleId, fallback) => {
74
+ var _a;
75
+ const scales = spec.scales, range = null === (_a = null == scales ? void 0 : scales.find((scale => scale.id === scaleId || scale.type === scaleId))) || void 0 === _a ? void 0 : _a.range;
76
+ return Array.isArray(range) && range.length >= 2 && "number" == typeof range[0] && "number" == typeof range[1] ? [ Math.min(range[0], range[1]), Math.max(range[0], range[1]) ] : fallback;
77
+ }, getSpecGeometry = (spec, ctx) => {
78
+ var _a, _b;
79
+ return ctx ? (0, exports.getRegionGeometry)(ctx, spec) : {
80
+ width: Math.max(Number(null !== (_a = spec.width) && void 0 !== _a ? _a : 0), 1),
81
+ height: Math.max(Number(null !== (_b = spec.height) && void 0 !== _b ? _b : 0), 1),
82
+ startX: 0,
83
+ startY: 0
84
+ };
85
+ }, resolveAdaptiveFontSize = (spec, ctx, text, options) => {
86
+ var _a;
87
+ const configuredFontSize = null === (_a = options.style) || void 0 === _a ? void 0 : _a.fontSize;
88
+ if (null != configuredFontSize) return Number(configuredFontSize);
89
+ const [minFontSize, maxFontSize] = getScaleRange(spec, options.scaleId, options.range), {width: width, height: height} = getSpecGeometry(spec, ctx), textWeight = getTextWeight(text), canvasSize = Math.sqrt(width * height) * options.canvasRatio, lengthFactor = Math.sqrt(8 / Math.max(textWeight, 4)), adaptiveSize = width <= 1 && height <= 1 ? options.fallback : canvasSize * lengthFactor, boxWidthLimit = options.boxWidth && options.boxWidth > 0 ? options.boxWidth * exports.BLOCK_TITLE_MAX_LINES / textWeight * .96 : Number.POSITIVE_INFINITY, boxHeightLimit = options.boxHeight && options.boxHeight > 0 ? options.boxHeight / Math.max(textWeight, 1) : Number.POSITIVE_INFINITY;
90
+ return Math.floor((value = Math.min(adaptiveSize, boxWidthLimit, boxHeightLimit),
91
+ min = minFontSize, max = maxFontSize, Math.max(min, Math.min(max, value))));
92
+ var value, min, max;
93
+ }, resolveAdaptiveLineHeight = (fontSize, style, fallback, ratio = 1.35) => {
94
+ var _a;
95
+ return Number(null !== (_a = null == style ? void 0 : style.lineHeight) && void 0 !== _a ? _a : Math.round((Number.isFinite(fontSize) ? fontSize : fallback) * ratio));
96
+ };
97
+
98
+ exports.resolveAdaptiveLineHeight = resolveAdaptiveLineHeight;
99
+
100
+ const resolveTitleFontSize = (spec, ctx, title, boxWidth, fallback, range = [ 16, 34 ]) => {
101
+ var _a;
102
+ return resolveAdaptiveFontSize(spec, ctx, title, {
103
+ style: null === (_a = spec.title) || void 0 === _a ? void 0 : _a.style,
104
+ scaleId: TITLE_FONT_SCALE_ID,
105
+ fallback: fallback,
106
+ range: range,
107
+ canvasRatio: .038,
108
+ boxWidth: boxWidth
109
+ });
110
+ };
111
+
112
+ exports.resolveTitleFontSize = resolveTitleFontSize;
113
+
114
+ const resolveMarkerFontSize = (spec, ctx, marker, boxHeight, fallback, range = [ 18, 46 ]) => {
115
+ var _a;
116
+ return resolveAdaptiveFontSize(spec, ctx, marker, {
117
+ style: null === (_a = spec.marker) || void 0 === _a ? void 0 : _a.style,
118
+ scaleId: MARKER_FONT_SCALE_ID,
119
+ fallback: fallback,
120
+ range: range,
121
+ canvasRatio: .052,
122
+ boxHeight: boxHeight
123
+ });
124
+ };
125
+
126
+ exports.resolveMarkerFontSize = resolveMarkerFontSize;
127
+
128
+ const getImageBackgroundStyle = spec => {
129
+ const themeColor = (0, exports.getThemeColor)(spec);
130
+ return {
131
+ fill: {
132
+ gradient: "linear",
133
+ x0: 0,
134
+ y0: 0,
135
+ x1: 1,
136
+ y1: 1,
137
+ stops: [ {
138
+ offset: 0,
139
+ color: "#ffffff"
140
+ }, {
141
+ offset: .58,
142
+ color: (0, exports.withAlpha)(themeColor, .12)
143
+ }, {
144
+ offset: 1,
145
+ color: (0, exports.withAlpha)(themeColor, .32)
146
+ } ]
147
+ },
148
+ stroke: (0, exports.withAlpha)(themeColor, .78),
149
+ lineWidth: 2,
150
+ shadowColor: (0, exports.withAlpha)(themeColor, .18),
151
+ shadowBlur: 10,
152
+ shadowOffsetX: 0,
153
+ shadowOffsetY: 4
154
+ };
155
+ };
156
+
157
+ exports.getImageBackgroundStyle = getImageBackgroundStyle;
158
+
159
+ const getTitleImageSize = (spec, width, height, options) => {
160
+ var _a, _b, _c, _e, _f, _g, _h;
161
+ const defaultWidth = Math.min(Math.max(width * (null !== (_a = null == options ? void 0 : options.widthRatio) && void 0 !== _a ? _a : .52), 1), null !== (_b = null == options ? void 0 : options.maxWidth) && void 0 !== _b ? _b : 720), imageWidth = Math.max(Number(null !== (_e = null === (_c = spec.titleImage) || void 0 === _c ? void 0 : _c.width) && void 0 !== _e ? _e : defaultWidth), 1);
162
+ return {
163
+ width: imageWidth,
164
+ height: Math.max(Number(null !== (_g = null === (_f = spec.titleImage) || void 0 === _f ? void 0 : _f.height) && void 0 !== _g ? _g : Math.min(height, imageWidth * (null !== (_h = null == options ? void 0 : options.heightRatio) && void 0 !== _h ? _h : .36))), 1)
165
+ };
166
+ };
167
+
168
+ exports.getTitleImageSize = getTitleImageSize;
169
+
170
+ const getTitleImageReservedHeight = (spec, width, height, options) => {
171
+ var _a, _b, _c;
172
+ if (!(null === (_a = spec.titleImage) || void 0 === _a ? void 0 : _a.image) || !1 === spec.titleImage.visible) return 0;
173
+ const size = (0, exports.getTitleImageSize)(spec, width, height, options);
174
+ return Math.ceil((null !== (_b = null == options ? void 0 : options.y) && void 0 !== _b ? _b : 12) + size.height + (null !== (_c = null == options ? void 0 : options.bottom) && void 0 !== _c ? _c : 24));
175
+ };
176
+
177
+ exports.getTitleImageReservedHeight = getTitleImageReservedHeight;
178
+
179
+ const getChartGeometry = (ctx, spec) => {
180
+ var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m;
181
+ const chartRect = null === (_b = null === (_a = ctx.chart) || void 0 === _a ? void 0 : _a.getLayoutRect) || void 0 === _b ? void 0 : _b.call(_a), bounds = null === (_c = ctx.getLayoutBounds) || void 0 === _c ? void 0 : _c.call(ctx);
182
+ return {
183
+ width: Math.max(null !== (_h = null !== (_g = null !== (_e = null == chartRect ? void 0 : chartRect.width) && void 0 !== _e ? _e : null === (_f = null == bounds ? void 0 : bounds.width) || void 0 === _f ? void 0 : _f.call(bounds)) && void 0 !== _g ? _g : null == spec ? void 0 : spec.width) && void 0 !== _h ? _h : 0, 1),
184
+ height: Math.max(null !== (_m = null !== (_l = null !== (_j = null == chartRect ? void 0 : chartRect.height) && void 0 !== _j ? _j : null === (_k = null == bounds ? void 0 : bounds.height) || void 0 === _k ? void 0 : _k.call(bounds)) && void 0 !== _l ? _l : null == spec ? void 0 : spec.height) && void 0 !== _m ? _m : 0, 1),
185
+ startX: 0,
186
+ startY: 0
187
+ };
188
+ };
189
+
190
+ exports.getChartGeometry = getChartGeometry;
191
+
192
+ const buildTopTitleImageMark = (spec, options) => {
193
+ var _a;
194
+ return (null === (_a = spec.titleImage) || void 0 === _a ? void 0 : _a.image) && !1 !== spec.titleImage.visible ? Object.assign(Object.assign({
195
+ type: "image",
196
+ name: "storyline-title-image",
197
+ interactive: !1,
198
+ zIndex: vchart_1.LayoutZIndex.Mark + 8
199
+ }, spec.titleImage), {
200
+ style: Object.assign({
201
+ x: (_d, ctx) => {
202
+ const {width: width, height: height, startX: startX} = (0, exports.getChartGeometry)(ctx, spec);
203
+ return startX + (width - (0, exports.getTitleImageSize)(spec, width, height, options).width) / 2;
204
+ },
205
+ y: (_d, ctx) => {
206
+ var _a;
207
+ return (0, exports.getChartGeometry)(ctx, spec).startY + (null !== (_a = null == options ? void 0 : options.y) && void 0 !== _a ? _a : 12);
208
+ },
209
+ width: (_d, ctx) => {
210
+ const {width: width, height: height} = (0, exports.getChartGeometry)(ctx, spec);
211
+ return (0, exports.getTitleImageSize)(spec, width, height, options).width;
212
+ },
213
+ height: (_d, ctx) => {
214
+ const {width: width, height: height} = (0, exports.getChartGeometry)(ctx, spec);
215
+ return (0, exports.getTitleImageSize)(spec, width, height, options).height;
216
+ },
217
+ image: spec.titleImage.image,
218
+ repeatX: "no-repeat",
219
+ repeatY: "no-repeat",
220
+ imageMode: "contain",
221
+ imagePosition: "center"
222
+ }, spec.titleImage.style)
223
+ }) : null;
224
+ };
225
+
226
+ exports.buildTopTitleImageMark = buildTopTitleImageMark;
227
+
72
228
  const withAlpha = (color, alpha) => {
73
229
  const safeAlpha = Math.max(0, Math.min(1, alpha));
74
230
  if (!color) return `rgba(0, 0, 0, ${safeAlpha})`;
@@ -87,47 +243,48 @@ const withAlpha = (color, alpha) => {
87
243
  exports.withAlpha = withAlpha;
88
244
 
89
245
  const resolveBlockWidth = (spec, viewWidth) => {
90
- var _a, _b, _c, _d, _e, _f, _g;
246
+ var _a, _b, _c, _e, _f, _g, _h;
91
247
  if (null === (_a = spec.block) || void 0 === _a ? void 0 : _a.width) return spec.block.width;
92
- const ratio = null !== (_c = null === (_b = spec.block) || void 0 === _b ? void 0 : _b.widthRatio) && void 0 !== _c ? _c : exports.DEFAULT_BLOCK_WIDTH_RATIO, minWidth = null !== (_e = null === (_d = spec.block) || void 0 === _d ? void 0 : _d.minWidth) && void 0 !== _e ? _e : exports.DEFAULT_BLOCK_WIDTH, maxWidth = null !== (_g = null === (_f = spec.block) || void 0 === _f ? void 0 : _f.maxWidth) && void 0 !== _g ? _g : Math.max(minWidth, 320);
248
+ const ratio = null !== (_c = null === (_b = spec.block) || void 0 === _b ? void 0 : _b.widthRatio) && void 0 !== _c ? _c : exports.DEFAULT_BLOCK_WIDTH_RATIO, minWidth = null !== (_f = null === (_e = spec.block) || void 0 === _e ? void 0 : _e.minWidth) && void 0 !== _f ? _f : exports.DEFAULT_BLOCK_WIDTH, maxWidth = null !== (_h = null === (_g = spec.block) || void 0 === _g ? void 0 : _g.maxWidth) && void 0 !== _h ? _h : Math.max(minWidth, 320);
93
249
  return Math.max(minWidth, Math.min(maxWidth, Math.round(viewWidth * ratio)));
94
250
  };
95
251
 
96
252
  exports.resolveBlockWidth = resolveBlockWidth;
97
253
 
98
254
  const getRegionGeometry = (ctx, spec) => {
99
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
100
- const region = null === (_c = null === (_b = null === (_a = ctx.chart) || void 0 === _a ? void 0 : _a.getAllRegions) || void 0 === _b ? void 0 : _b.call(_a)) || void 0 === _c ? void 0 : _c[0], regionRect = null === (_d = null == region ? void 0 : region.getLayoutRect) || void 0 === _d ? void 0 : _d.call(region), regionStart = null === (_e = null == region ? void 0 : region.getLayoutStartPoint) || void 0 === _e ? void 0 : _e.call(region), chartRect = null === (_g = null === (_f = ctx.chart) || void 0 === _f ? void 0 : _f.getLayoutRect) || void 0 === _g ? void 0 : _g.call(_f), bounds = null === (_h = ctx.getLayoutBounds) || void 0 === _h ? void 0 : _h.call(ctx);
255
+ var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
256
+ const region = null === (_c = null === (_b = null === (_a = ctx.chart) || void 0 === _a ? void 0 : _a.getAllRegions) || void 0 === _b ? void 0 : _b.call(_a)) || void 0 === _c ? void 0 : _c[0], regionRect = null === (_e = null == region ? void 0 : region.getLayoutRect) || void 0 === _e ? void 0 : _e.call(region), regionStart = null === (_f = null == region ? void 0 : region.getLayoutStartPoint) || void 0 === _f ? void 0 : _f.call(region), chartRect = null === (_h = null === (_g = ctx.chart) || void 0 === _g ? void 0 : _g.getLayoutRect) || void 0 === _h ? void 0 : _h.call(_g), bounds = null === (_j = ctx.getLayoutBounds) || void 0 === _j ? void 0 : _j.call(ctx);
101
257
  return {
102
- width: Math.max(null !== (_o = null !== (_m = null !== (_k = null !== (_j = null == regionRect ? void 0 : regionRect.width) && void 0 !== _j ? _j : null == chartRect ? void 0 : chartRect.width) && void 0 !== _k ? _k : null === (_l = null == bounds ? void 0 : bounds.width) || void 0 === _l ? void 0 : _l.call(bounds)) && void 0 !== _m ? _m : null == spec ? void 0 : spec.width) && void 0 !== _o ? _o : 0, 1),
103
- height: Math.max(null !== (_t = null !== (_s = null !== (_q = null !== (_p = null == regionRect ? void 0 : regionRect.height) && void 0 !== _p ? _p : null == chartRect ? void 0 : chartRect.height) && void 0 !== _q ? _q : null === (_r = null == bounds ? void 0 : bounds.height) || void 0 === _r ? void 0 : _r.call(bounds)) && void 0 !== _s ? _s : null == spec ? void 0 : spec.height) && void 0 !== _t ? _t : 0, 1),
104
- startX: null !== (_u = null == regionStart ? void 0 : regionStart.x) && void 0 !== _u ? _u : 0,
105
- startY: null !== (_v = null == regionStart ? void 0 : regionStart.y) && void 0 !== _v ? _v : 0
258
+ width: Math.max(null !== (_p = null !== (_o = null !== (_l = null !== (_k = null == regionRect ? void 0 : regionRect.width) && void 0 !== _k ? _k : null == chartRect ? void 0 : chartRect.width) && void 0 !== _l ? _l : null === (_m = null == bounds ? void 0 : bounds.width) || void 0 === _m ? void 0 : _m.call(bounds)) && void 0 !== _o ? _o : null == spec ? void 0 : spec.width) && void 0 !== _p ? _p : 0, 1),
259
+ height: Math.max(null !== (_u = null !== (_t = null !== (_r = null !== (_q = null == regionRect ? void 0 : regionRect.height) && void 0 !== _q ? _q : null == chartRect ? void 0 : chartRect.height) && void 0 !== _r ? _r : null === (_s = null == bounds ? void 0 : bounds.height) || void 0 === _s ? void 0 : _s.call(bounds)) && void 0 !== _t ? _t : null == spec ? void 0 : spec.height) && void 0 !== _u ? _u : 0, 1),
260
+ startX: null !== (_v = null == regionStart ? void 0 : regionStart.x) && void 0 !== _v ? _v : 0,
261
+ startY: null !== (_w = null == regionStart ? void 0 : regionStart.y) && void 0 !== _w ? _w : 0
106
262
  };
107
263
  };
108
264
 
109
265
  exports.getRegionGeometry = getRegionGeometry;
110
266
 
111
267
  const getLayout = (spec, ctx) => {
112
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
268
+ var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
113
269
  const {width: width, height: height, startX: startX, startY: startY} = (0, exports.getRegionGeometry)(ctx, spec);
114
270
  let blockWidth = (0, exports.resolveBlockWidth)(spec, width), blockHeight = null !== (_b = null === (_a = spec.block) || void 0 === _a ? void 0 : _a.height) && void 0 !== _b ? _b : (0,
115
271
  exports.isLandscape)(spec) ? 320 : exports.DEFAULT_BLOCK_HEIGHT;
116
272
  if ((0, exports.isLandscape)(spec) && !(null === (_c = spec.block) || void 0 === _c ? void 0 : _c.width)) {
117
- const count = null !== (_e = null === (_d = spec.data) || void 0 === _d ? void 0 : _d.length) && void 0 !== _e ? _e : 0;
273
+ const count = null !== (_f = null === (_e = spec.data) || void 0 === _e ? void 0 : _e.length) && void 0 !== _f ? _f : 0;
118
274
  if (count > 0) {
119
- const padding = (0, layout_1.normalizePadding)(null === (_f = spec.block) || void 0 === _f ? void 0 : _f.padding), LANDSCAPE_IMAGE_MIN_WIDTH = 80, adaptive = (Math.max(width - padding.left - padding.right, 1) - 40 * Math.max(count - 1, 0)) / count;
275
+ const padding = (0, layout_1.normalizePadding)(null === (_g = spec.block) || void 0 === _g ? void 0 : _g.padding), LANDSCAPE_IMAGE_MIN_WIDTH = 80, adaptive = (Math.max(width - padding.left - padding.right, 1) - 40 * Math.max(count - 1, 0)) / count;
120
276
  blockWidth = Math.max(LANDSCAPE_IMAGE_MIN_WIDTH, Math.floor(adaptive));
121
277
  }
122
278
  }
123
- if ((0, exports.isPortrait)(spec) && !(null === (_g = spec.block) || void 0 === _g ? void 0 : _g.height)) {
124
- const count = null !== (_j = null === (_h = spec.data) || void 0 === _h ? void 0 : _h.length) && void 0 !== _j ? _j : 0;
279
+ if ((0, exports.isPortrait)(spec) && !(null === (_h = spec.block) || void 0 === _h ? void 0 : _h.height)) {
280
+ const count = null !== (_k = null === (_j = spec.data) || void 0 === _j ? void 0 : _j.length) && void 0 !== _k ? _k : 0;
125
281
  if (count > 0) {
126
- const padding = (0, layout_1.normalizePadding)(null !== (_l = null === (_k = spec.layout) || void 0 === _k ? void 0 : _k.padding) && void 0 !== _l ? _l : null === (_m = spec.block) || void 0 === _m ? void 0 : _m.padding), innerHeight = Math.max(height - padding.top - padding.bottom, 1);
282
+ const layoutPadding = "object" == typeof spec.layout ? spec.layout.padding : void 0, padding = (0,
283
+ layout_1.normalizePadding)(null != layoutPadding ? layoutPadding : null === (_l = spec.block) || void 0 === _l ? void 0 : _l.padding), innerHeight = Math.max(height - padding.top - padding.bottom, 1);
127
284
  blockHeight = Math.max(120, Math.floor(innerHeight / (count + 1)));
128
285
  }
129
286
  }
130
- const result = (0, layout_1.computeStorylineLayout)(null !== (_o = spec.data) && void 0 !== _o ? _o : [], {
287
+ const result = (0, layout_1.computeStorylineLayout)(null !== (_m = spec.data) && void 0 !== _m ? _m : [], {
131
288
  layout: spec.layout,
132
289
  viewBox: {
133
290
  width: width,
@@ -137,9 +294,9 @@ const getLayout = (spec, ctx) => {
137
294
  width: blockWidth,
138
295
  height: blockHeight
139
296
  },
140
- gap: null !== (_q = null === (_p = spec.block) || void 0 === _p ? void 0 : _p.gap) && void 0 !== _q ? _q : exports.DEFAULT_BLOCK_GAP,
141
- padding: null === (_r = spec.block) || void 0 === _r ? void 0 : _r.padding,
142
- lineDistance: null === (_s = spec.line) || void 0 === _s ? void 0 : _s.distance
297
+ gap: null !== (_p = null === (_o = spec.block) || void 0 === _o ? void 0 : _o.gap) && void 0 !== _p ? _p : exports.DEFAULT_BLOCK_GAP,
298
+ padding: null === (_q = spec.block) || void 0 === _q ? void 0 : _q.padding,
299
+ lineDistance: null === (_r = spec.line) || void 0 === _r ? void 0 : _r.distance
143
300
  });
144
301
  return startX || startY ? Object.assign(Object.assign({}, result), {
145
302
  blocks: result.blocks.map((block => Object.assign(Object.assign({}, block), {
@@ -169,25 +326,13 @@ const getLayout = (spec, ctx) => {
169
326
 
170
327
  exports.getLayout = getLayout;
171
328
 
172
- const buildRichContent = (contentText, spec, overrides) => {
173
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
174
- const fontSize = Number(null !== (_d = null !== (_a = null == overrides ? void 0 : overrides.fontSize) && void 0 !== _a ? _a : null === (_c = null === (_b = spec.content) || void 0 === _b ? void 0 : _b.style) || void 0 === _c ? void 0 : _c.fontSize) && void 0 !== _d ? _d : 18), lineHeight = Number(null !== (_h = null !== (_e = null == overrides ? void 0 : overrides.lineHeight) && void 0 !== _e ? _e : null === (_g = null === (_f = spec.content) || void 0 === _f ? void 0 : _f.style) || void 0 === _g ? void 0 : _g.lineHeight) && void 0 !== _h ? _h : 26), fill = null !== (_m = null !== (_j = null == overrides ? void 0 : overrides.fill) && void 0 !== _j ? _j : null === (_l = null === (_k = spec.content) || void 0 === _k ? void 0 : _k.style) || void 0 === _l ? void 0 : _l.fill) && void 0 !== _m ? _m : "#596173", align = null !== (_o = null == overrides ? void 0 : overrides.align) && void 0 !== _o ? _o : "left";
175
- return {
176
- type: "rich",
177
- text: contentText.reduce(((result, paragraph, index) => {
178
- const suffix = index === contentText.length - 1 ? "" : "\n";
179
- return result.push({
180
- text: `${paragraph}${suffix}`,
181
- fontSize: fontSize,
182
- lineHeight: lineHeight,
183
- fill: fill,
184
- align: align
185
- }), result;
186
- }), [])
187
- };
188
- };
329
+ const buildPlainContent = contentText => contentText.join("\n");
330
+
331
+ exports.buildPlainContent = buildPlainContent;
332
+
333
+ const getBlockTitleHeight = (lineHeight, title) => title ? lineHeight * exports.BLOCK_TITLE_MAX_LINES : 0;
189
334
 
190
- exports.buildRichContent = buildRichContent;
335
+ exports.getBlockTitleHeight = getBlockTitleHeight;
191
336
 
192
337
  const omitImageLayoutSpec = imageSpec => {
193
338
  if (!imageSpec) return {};
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/charts/storyline/layouts/common.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAEA,sCAMmB;AA0TV,gGA9TP,wBAAe,OA8TO;AAAE,iGA7TxB,yBAAgB,OA6TwB;AAzS7B,QAAA,mBAAmB,GAAG,GAAG,CAAC;AAC1B,QAAA,oBAAoB,GAAG,GAAG,CAAC;AAC3B,QAAA,yBAAyB,GAAG,IAAI,CAAC;AACjC,QAAA,iBAAiB,GAAG,EAAE,CAAC;AACvB,QAAA,mBAAmB,GAAG,EAAE,CAAC;AACzB,QAAA,oBAAoB,GAAG,EAAE,CAAC;AAC1B,QAAA,iBAAiB,GAAG,EAAE,CAAC;AACvB,QAAA,mBAAmB,GAAG,SAAS,CAAC;AAItC,MAAM,WAAW,GAAG,CAAC,IAAoB,EAAE,EAAE,CAAC,IAAA,wBAAe,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC;AAA1F,QAAA,WAAW,eAA+E;AAChG,MAAM,UAAU,GAAG,CAAC,IAAoB,EAAE,EAAE,CAAC,IAAA,wBAAe,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,KAAK,UAAU,CAAC;AAAxF,QAAA,UAAU,cAA8E;AAC9F,MAAM,OAAO,GAAG,CAAC,IAAoB,EAAE,EAAE,CAAC,IAAA,wBAAe,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC;AAAlF,QAAA,OAAO,WAA2E;AACxF,MAAM,KAAK,GAAG,CAAC,IAAoB,EAAE,EAAE,CAAC,IAAA,wBAAe,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC;AAA9E,QAAA,KAAK,SAAyE;AACpF,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,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;KACzD;IACD,OAAO,CAAC,CAAC;AACX,CAAC,CAAC;AApBW,QAAA,oBAAoB,wBAoB/B","file":"common.js","sourcesContent":["import type { ICustomMarkSpec } from '@visactor/vchart';\nimport type { IStorylineBlock, IStorylineSpec, StorylineImagePosition } from '../interface';\nimport {\n computeStorylineLayout,\n normalizeLayout,\n normalizePadding,\n type StorylineLayoutResult,\n type StorylinePoint\n} from '../layout';\n\n// ===== 布局通用类型 =====\n\nexport type LayoutContext = {\n chart?: {\n getAllRegions?: () => {\n getLayoutRect?: () => { width?: number; height?: number };\n getLayoutStartPoint?: () => { x?: number; y?: number };\n }[];\n getLayoutRect?: () => { width?: number; height?: number };\n };\n getLayoutBounds?: () => { width?: () => number; height?: () => number };\n};\n\n// ===== 通用默认值 =====\n\nexport const DEFAULT_BLOCK_WIDTH = 180;\nexport const DEFAULT_BLOCK_HEIGHT = 400;\nexport const DEFAULT_BLOCK_WIDTH_RATIO = 0.24;\nexport const DEFAULT_BLOCK_GAP = 36;\nexport const DEFAULT_IMAGE_WIDTH = 48;\nexport const DEFAULT_IMAGE_HEIGHT = 48;\nexport const DEFAULT_IMAGE_GAP = 10;\nexport const DEFAULT_THEME_COLOR = '#e8543d';\n\n// ===== 布局判定 =====\n\nexport const isLandscape = (spec: IStorylineSpec) => normalizeLayout(spec.layout).type === 'landscape';\nexport const isPortrait = (spec: IStorylineSpec) => normalizeLayout(spec.layout).type === 'portrait';\nexport const isClock = (spec: IStorylineSpec) => normalizeLayout(spec.layout).type === 'clock';\nexport const isArc = (spec: IStorylineSpec) => normalizeLayout(spec.layout).type === 'arc';\nexport const isWing = (spec: IStorylineSpec) => normalizeLayout(spec.layout).type === 'wing';\nexport const isLadder = (spec: IStorylineSpec) => normalizeLayout(spec.layout).type === 'ladder';\n\nexport const getThemeColor = (spec: IStorylineSpec) => spec.themeColor ?? DEFAULT_THEME_COLOR;\n\nexport const shouldShowImageBackground = (spec: IStorylineSpec) =>\n spec.image?.showBackground ?? !(isPortrait(spec) || isLandscape(spec));\n\n// ===== 颜色工具 =====\n\n/**\n * 给颜色(#hex / rgb / rgba / hsl / 颜色关键字)追加/替换 alpha 通道,返回 rgba(...) 字符串\n */\nexport const withAlpha = (color: string, alpha: number): string => {\n const safeAlpha = Math.max(0, Math.min(1, alpha));\n if (!color) {\n return `rgba(0, 0, 0, ${safeAlpha})`;\n }\n const trimmed = color.trim();\n if (trimmed.startsWith('#')) {\n let hex = trimmed.slice(1);\n if (hex.length === 3 || hex.length === 4) {\n hex = hex\n .split('')\n .map(ch => ch + ch)\n .join('');\n }\n if (hex.length === 6 || hex.length === 8) {\n const r = parseInt(hex.slice(0, 2), 16);\n const g = parseInt(hex.slice(2, 4), 16);\n const b = parseInt(hex.slice(4, 6), 16);\n return `rgba(${r}, ${g}, ${b}, ${safeAlpha})`;\n }\n }\n const rgbMatch = trimmed.match(/^rgba?\\(\\s*([\\d.]+)\\s*,\\s*([\\d.]+)\\s*,\\s*([\\d.]+)/i);\n if (rgbMatch) {\n return `rgba(${rgbMatch[1]}, ${rgbMatch[2]}, ${rgbMatch[3]}, ${safeAlpha})`;\n }\n return trimmed;\n};\n\n// ===== 块宽度解析 =====\n\nexport const resolveBlockWidth = (spec: IStorylineSpec, viewWidth: number) => {\n if (spec.block?.width) {\n return spec.block.width;\n }\n const ratio = spec.block?.widthRatio ?? DEFAULT_BLOCK_WIDTH_RATIO;\n const minWidth = spec.block?.minWidth ?? DEFAULT_BLOCK_WIDTH;\n const maxWidth = spec.block?.maxWidth ?? Math.max(minWidth, 320);\n return Math.max(minWidth, Math.min(maxWidth, Math.round(viewWidth * ratio)));\n};\n\n// ===== 容器几何信息(chart region rect)=====\n\nexport const getRegionGeometry = (ctx: LayoutContext, spec?: { width?: number; height?: number }) => {\n const region = ctx.chart?.getAllRegions?.()?.[0];\n const regionRect = region?.getLayoutRect?.();\n const regionStart = region?.getLayoutStartPoint?.();\n const chartRect = ctx.chart?.getLayoutRect?.();\n const bounds = ctx.getLayoutBounds?.();\n const width = Math.max(regionRect?.width ?? chartRect?.width ?? bounds?.width?.() ?? spec?.width ?? 0, 1);\n const height = Math.max(regionRect?.height ?? chartRect?.height ?? bounds?.height?.() ?? spec?.height ?? 0, 1);\n return {\n width,\n height,\n startX: regionStart?.x ?? 0,\n startY: regionStart?.y ?? 0\n };\n};\n\n// ===== 布局计算(layout.ts 的封装,附加 startX/startY 平移)=====\n\nexport const getLayout = (spec: IStorylineSpec, ctx: LayoutContext): StorylineLayoutResult => {\n const { width, height, startX, startY } = getRegionGeometry(ctx, spec);\n let blockWidth = resolveBlockWidth(spec, width);\n let blockHeight = spec.block?.height ?? (isLandscape(spec) ? 320 : DEFAULT_BLOCK_HEIGHT);\n // landscape:图片间距固定 40,根据 block 数量自适应单个 image 宽度\n if (isLandscape(spec) && !spec.block?.width) {\n const count = spec.data?.length ?? 0;\n if (count > 0) {\n const padding = normalizePadding(spec.block?.padding);\n const innerWidth = Math.max(width - padding.left - padding.right, 1);\n const LANDSCAPE_IMAGE_GAP = 40;\n const LANDSCAPE_IMAGE_MIN_WIDTH = 80;\n const totalGap = LANDSCAPE_IMAGE_GAP * Math.max(count - 1, 0);\n const adaptive = (innerWidth - totalGap) / count;\n blockWidth = Math.max(LANDSCAPE_IMAGE_MIN_WIDTH, Math.floor(adaptive));\n }\n }\n // portrait:每个 block 在垂直方向需要容纳 image + text,整体根据 region 高度均分\n // blockHeight = regionHeight / (count + 1)(即每个 block 的\"槽位\"高度),后续 portrait.ts 中:\n // imageHeight = blockHeight * 0.6\n // contentHeight = blockHeight\n if (isPortrait(spec) && !spec.block?.height) {\n const count = spec.data?.length ?? 0;\n if (count > 0) {\n const padding = normalizePadding(spec.layout?.padding ?? spec.block?.padding);\n const innerHeight = Math.max(height - padding.top - padding.bottom, 1);\n blockHeight = Math.max(120, Math.floor(innerHeight / (count + 1)));\n }\n }\n const result = computeStorylineLayout(spec.data ?? [], {\n layout: spec.layout,\n viewBox: { width, height },\n block: {\n width: blockWidth,\n height: blockHeight\n },\n gap: spec.block?.gap ?? DEFAULT_BLOCK_GAP,\n padding: spec.block?.padding,\n lineDistance: spec.line?.distance\n });\n if (!startX && !startY) {\n return result;\n }\n return {\n ...result,\n blocks: result.blocks.map(block => ({\n ...block,\n x: block.x + startX,\n y: block.y + startY,\n center: {\n x: block.center.x + startX,\n y: block.center.y + startY\n }\n })),\n links: result.links.map(link => ({\n ...link,\n start: { x: link.start.x + startX, y: link.start.y + startY },\n end: { x: link.end.x + startX, y: link.end.y + startY },\n points: link.points.map(point => ({ x: point.x + startX, y: point.y + startY }))\n }))\n };\n};\n\n// ===== 文本 / 图像通用工具 =====\n\nexport const buildRichContent = (\n contentText: string[],\n spec: IStorylineSpec,\n overrides?: { fontSize?: number; lineHeight?: number; fill?: string; align?: 'left' | 'center' | 'right' }\n) => {\n const fontSize = Number(overrides?.fontSize ?? (spec.content?.style as any)?.fontSize ?? 18);\n const lineHeight = Number(overrides?.lineHeight ?? (spec.content?.style as any)?.lineHeight ?? 26);\n const fill = overrides?.fill ?? (spec.content?.style as any)?.fill ?? '#596173';\n const align = overrides?.align ?? 'left';\n\n return {\n type: 'rich' as const,\n text: contentText.reduce<{ text: string; fontSize: number; lineHeight: number; fill: string; align: string }[]>(\n (result, paragraph, index) => {\n const suffix = index === contentText.length - 1 ? '' : '\\n';\n result.push({\n text: `${paragraph}${suffix}`,\n fontSize,\n lineHeight,\n fill,\n align\n });\n return result;\n },\n []\n )\n };\n};\n\nexport const omitImageLayoutSpec = (imageSpec: IStorylineSpec['image']) => {\n if (!imageSpec) {\n return {};\n }\n const { width: _width, height: _height, position: _position, gap: _gap, ...rest } = imageSpec;\n return rest;\n};\n\n// ===== 默认 image / text 盒计算(用于通用 block)=====\n\nexport const getImageBox = (\n position: StorylineImagePosition,\n blockWidth: number,\n blockHeight: number,\n padding: ReturnType<typeof normalizePadding>,\n width: number,\n height: number,\n _gap: number,\n visible: boolean\n) => {\n if (!visible) {\n return { x: padding.left, y: padding.top, width: 0, height: 0 };\n }\n switch (position) {\n case 'left':\n return { x: padding.left, y: (blockHeight - height) / 2, width, height };\n case 'right':\n return { x: blockWidth - padding.right - width, y: (blockHeight - height) / 2, width, height };\n case 'bottom':\n return { x: (blockWidth - width) / 2, y: blockHeight - padding.bottom - height, width, height };\n case 'top':\n default:\n return { x: (blockWidth - width) / 2, y: padding.top, width, height };\n }\n};\n\nexport const getTextBox = (\n position: StorylineImagePosition,\n blockWidth: number,\n blockHeight: number,\n padding: ReturnType<typeof normalizePadding>,\n imageWidth: number,\n imageHeight: number,\n imageGap: number,\n hasImage: boolean\n) => {\n if (!hasImage) {\n return {\n x: padding.left,\n y: padding.top,\n width: blockWidth - padding.left - padding.right,\n height: blockHeight - padding.top - padding.bottom\n };\n }\n switch (position) {\n case 'left':\n return {\n x: padding.left + imageWidth + imageGap,\n y: padding.top,\n width: blockWidth - padding.left - padding.right - imageWidth - imageGap,\n height: blockHeight - padding.top - padding.bottom\n };\n case 'right':\n return {\n x: padding.left,\n y: padding.top,\n width: blockWidth - padding.left - padding.right - imageWidth - imageGap,\n height: blockHeight - padding.top - padding.bottom\n };\n case 'bottom':\n return {\n x: padding.left,\n y: padding.top,\n width: blockWidth - padding.left - padding.right,\n height: blockHeight - padding.top - padding.bottom - imageHeight - imageGap\n };\n case 'top':\n default:\n return {\n x: padding.left,\n y: padding.top + imageHeight + imageGap,\n width: blockWidth - padding.left - padding.right,\n height: blockHeight - padding.top - padding.bottom - imageHeight - imageGap\n };\n }\n};\n\n// ===== Catmull-Rom 平滑曲线 =====\n\n/**\n * 用 Catmull-Rom 转 cubic Bezier 生成平滑曲线 path(贯穿所有点)。\n */\nexport const buildSmoothCurvePath = (points: StorylinePoint[]): string => {\n if (points.length < 2) {\n return '';\n }\n if (points.length === 2) {\n return `M ${points[0].x} ${points[0].y} L ${points[1].x} ${points[1].y}`;\n }\n let d = `M ${points[0].x} ${points[0].y}`;\n for (let i = 0; i < points.length - 1; i++) {\n const p0 = points[i - 1] ?? points[i];\n const p1 = points[i];\n const p2 = points[i + 1];\n const p3 = points[i + 2] ?? p2;\n const c1x = p1.x + (p2.x - p0.x) / 6;\n const c1y = p1.y + (p2.y - p0.y) / 6;\n const c2x = p2.x - (p3.x - p1.x) / 6;\n const c2y = p2.y - (p3.y - p1.y) / 6;\n d += ` C ${c1x} ${c1y}, ${c2x} ${c2y}, ${p2.x} ${p2.y}`;\n }\n return d;\n};\n\n// 重导出常用的 layout helper(避免外部再 import layout.ts)\nexport { normalizeLayout, normalizePadding };\nexport type { IStorylineBlock, ICustomMarkSpec, StorylinePoint };\n"]}
1
+ {"version":3,"sources":["../src/charts/storyline/layouts/common.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,6CAAsE;AAEtE,sCAMmB;AAygBV,gGA7gBP,wBAAe,OA6gBO;AAAE,iGA5gBxB,yBAAgB,OA4gBwB;AAxf7B,QAAA,mBAAmB,GAAG,GAAG,CAAC;AAC1B,QAAA,oBAAoB,GAAG,GAAG,CAAC;AAC3B,QAAA,yBAAyB,GAAG,IAAI,CAAC;AACjC,QAAA,iBAAiB,GAAG,EAAE,CAAC;AACvB,QAAA,mBAAmB,GAAG,EAAE,CAAC;AACzB,QAAA,oBAAoB,GAAG,EAAE,CAAC;AAC1B,QAAA,iBAAiB,GAAG,EAAE,CAAC;AACvB,QAAA,mBAAmB,GAAG,SAAS,CAAC;AAChC,QAAA,qBAAqB,GAAG,CAAC,CAAC;AACvC,MAAM,+BAA+B,GAAG,IAAI,CAAC;AAC7C,MAAM,6BAA6B,GAAG,GAAG,CAAC;AAC1C,MAAM,gCAAgC,GAAG,IAAI,CAAC;AAC9C,MAAM,uBAAuB,GAAG,EAAE,CAAC;AACnC,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAI/B,MAAM,WAAW,GAAG,CAAC,IAAoB,EAAE,EAAE,CAAC,IAAA,wBAAe,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,KAAK,WAAW,CA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AAC,CAAC,mCAAI,MAAM,CAAC,CAAC,CAAC,CAAC;QACtC,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QACrB,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACzB,MAAM,EAAE,GAAG,MAAA,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,mCAAI,EAAE,CAAC;QAC/B,MAAM,GAAG,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACrC,MAAM,GAAG,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACrC,MAAM,GAAG,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACrC,MAAM,GAAG,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACrC,CAAC,IAAI,MAAM,GAAG,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;KACzD;IACD,OAAO,CAAC,CAAC;AACX,CAAC,CAAC;AApBW,QAAA,oBAAoB,wBAoB/B","file":"common.js","sourcesContent":["import { LayoutZIndex, type ICustomMarkSpec } from '@visactor/vchart';\nimport type { IStorylineBlock, IStorylineSpec, StorylineImagePosition } from '../interface';\nimport {\n computeStorylineLayout,\n normalizeLayout,\n normalizePadding,\n type StorylineLayoutResult,\n type StorylinePoint\n} from '../layout';\n\n// ===== 布局通用类型 =====\n\nexport type LayoutContext = {\n chart?: {\n getAllRegions?: () => {\n getLayoutRect?: () => { width?: number; height?: number };\n getLayoutStartPoint?: () => { x?: number; y?: number };\n }[];\n getLayoutRect?: () => { width?: number; height?: number };\n };\n getLayoutBounds?: () => { width?: () => number; height?: () => number };\n};\n\n// ===== 通用默认值 =====\n\nexport const DEFAULT_BLOCK_WIDTH = 180;\nexport const DEFAULT_BLOCK_HEIGHT = 400;\nexport const DEFAULT_BLOCK_WIDTH_RATIO = 0.24;\nexport const DEFAULT_BLOCK_GAP = 36;\nexport const DEFAULT_IMAGE_WIDTH = 48;\nexport const DEFAULT_IMAGE_HEIGHT = 48;\nexport const DEFAULT_IMAGE_GAP = 10;\nexport const DEFAULT_THEME_COLOR = '#e8543d';\nexport const BLOCK_TITLE_MAX_LINES = 2;\nconst DEFAULT_TITLE_IMAGE_WIDTH_RATIO = 0.52;\nconst DEFAULT_TITLE_IMAGE_MAX_WIDTH = 720;\nconst DEFAULT_TITLE_IMAGE_HEIGHT_RATIO = 0.36;\nconst DEFAULT_TITLE_IMAGE_TOP = 12;\nconst DEFAULT_TITLE_IMAGE_BOTTOM = 24;\n\n// ===== 布局判定 =====\n\nexport const isLandscape = (spec: IStorylineSpec) => normalizeLayout(spec.layout).type === 'landscape';\nexport const isPortrait = (spec: IStorylineSpec) => normalizeLayout(spec.layout).type === 'portrait';\nexport const isClock = (spec: IStorylineSpec) => normalizeLayout(spec.layout).type === 'clock';\nexport const isArc = (spec: IStorylineSpec) => normalizeLayout(spec.layout).type === 'arc';\nexport const isWing = (spec: IStorylineSpec) => normalizeLayout(spec.layout).type === 'wing';\nexport const isLadder = (spec: IStorylineSpec) => normalizeLayout(spec.layout).type === 'ladder';\n\nexport const getThemeColor = (spec: IStorylineSpec) => spec.themeColor ?? DEFAULT_THEME_COLOR;\n\nexport const shouldShowImageBackground = (spec: IStorylineSpec) =>\n spec.image?.showBackground ?? !(isPortrait(spec) || isLandscape(spec));\n\n// ===== 默认样式工具 =====\n\nconst TITLE_FONT_SCALE_ID = 'storylineTitleFontSize';\nconst MARKER_FONT_SCALE_ID = 'storylineMarkerFontSize';\n\nconst clamp = (value: number, min: number, max: number) => Math.max(min, Math.min(max, value));\n\nconst getTextWeight = (text?: string) => {\n if (!text) {\n return 4;\n }\n return Math.max(\n Array.from(text).reduce((sum, char) => {\n if (char.trim().length === 0) {\n return sum + 0.32;\n }\n return sum + (char.charCodeAt(0) > 255 ? 1.05 : 0.62);\n }, 0),\n 1\n );\n};\n\nconst getScaleRange = (spec: IStorylineSpec, scaleId: string, fallback: [number, number]) => {\n const scales = (spec as { scales?: { id?: string; type?: string; range?: unknown }[] }).scales;\n const range = scales?.find(scale => scale.id === scaleId || scale.type === scaleId)?.range;\n if (Array.isArray(range) && range.length >= 2 && typeof range[0] === 'number' && typeof range[1] === 'number') {\n return [Math.min(range[0], range[1]), Math.max(range[0], range[1])] as [number, number];\n }\n return fallback;\n};\n\nconst getSpecGeometry = (spec: IStorylineSpec, ctx?: LayoutContext) => {\n if (ctx) {\n return getRegionGeometry(ctx, spec);\n }\n return {\n width: Math.max(Number(spec.width ?? 0), 1),\n height: Math.max(Number(spec.height ?? 0), 1),\n startX: 0,\n startY: 0\n };\n};\n\nconst resolveAdaptiveFontSize = (\n spec: IStorylineSpec,\n ctx: LayoutContext | undefined,\n text: string | undefined,\n options: {\n style?: Record<string, unknown>;\n scaleId: string;\n fallback: number;\n range: [number, number];\n canvasRatio: number;\n boxWidth?: number;\n boxHeight?: number;\n }\n) => {\n const configuredFontSize = options.style?.fontSize;\n if (configuredFontSize != null) {\n return Number(configuredFontSize);\n }\n const [minFontSize, maxFontSize] = getScaleRange(spec, options.scaleId, options.range);\n const { width, height } = getSpecGeometry(spec, ctx);\n const textWeight = getTextWeight(text);\n const canvasSize = Math.sqrt(width * height) * options.canvasRatio;\n const lengthFactor = Math.sqrt(8 / Math.max(textWeight, 4));\n const adaptiveSize = width <= 1 && height <= 1 ? options.fallback : canvasSize * lengthFactor;\n const boxWidthLimit =\n options.boxWidth && options.boxWidth > 0\n ? ((options.boxWidth * BLOCK_TITLE_MAX_LINES) / textWeight) * 0.96\n : Number.POSITIVE_INFINITY;\n const boxHeightLimit =\n options.boxHeight && options.boxHeight > 0 ? options.boxHeight / Math.max(textWeight, 1) : Number.POSITIVE_INFINITY;\n return Math.floor(clamp(Math.min(adaptiveSize, boxWidthLimit, boxHeightLimit), minFontSize, maxFontSize));\n};\n\nexport const resolveAdaptiveLineHeight = (\n fontSize: number,\n style: Record<string, unknown> | undefined,\n fallback: number,\n ratio = 1.35\n) => Number(style?.lineHeight ?? Math.round((Number.isFinite(fontSize) ? fontSize : fallback) * ratio));\n\nexport const resolveTitleFontSize = (\n spec: IStorylineSpec,\n ctx: LayoutContext | undefined,\n title: string | undefined,\n boxWidth: number | undefined,\n fallback: number,\n range: [number, number] = [16, 34]\n) =>\n resolveAdaptiveFontSize(spec, ctx, title, {\n style: spec.title?.style as Record<string, unknown> | undefined,\n scaleId: TITLE_FONT_SCALE_ID,\n fallback,\n range,\n canvasRatio: 0.038,\n boxWidth\n });\n\nexport const resolveMarkerFontSize = (\n spec: IStorylineSpec,\n ctx: LayoutContext,\n marker: string | undefined,\n boxHeight: number | undefined,\n fallback: number,\n range: [number, number] = [18, 46]\n) =>\n resolveAdaptiveFontSize(spec, ctx, marker, {\n style: spec.marker?.style as Record<string, unknown> | undefined,\n scaleId: MARKER_FONT_SCALE_ID,\n fallback,\n range,\n canvasRatio: 0.052,\n boxHeight\n });\n\nexport const getImageBackgroundStyle = (spec: IStorylineSpec) => {\n const themeColor = getThemeColor(spec);\n return {\n fill: {\n gradient: 'linear',\n x0: 0,\n y0: 0,\n x1: 1,\n y1: 1,\n stops: [\n { offset: 0, color: '#ffffff' },\n { offset: 0.58, color: withAlpha(themeColor, 0.12) },\n { offset: 1, color: withAlpha(themeColor, 0.32) }\n ]\n },\n stroke: withAlpha(themeColor, 0.78),\n lineWidth: 2,\n shadowColor: withAlpha(themeColor, 0.18),\n shadowBlur: 10,\n shadowOffsetX: 0,\n shadowOffsetY: 4\n };\n};\n\nexport const getTitleImageSize = (\n spec: IStorylineSpec,\n width: number,\n height: number,\n options?: { widthRatio?: number; maxWidth?: number; heightRatio?: number }\n) => {\n const defaultWidth = Math.min(\n Math.max(width * (options?.widthRatio ?? DEFAULT_TITLE_IMAGE_WIDTH_RATIO), 1),\n options?.maxWidth ?? DEFAULT_TITLE_IMAGE_MAX_WIDTH\n );\n const imageWidth = Math.max(Number(spec.titleImage?.width ?? defaultWidth), 1);\n const imageHeight = Math.max(\n Number(\n spec.titleImage?.height ??\n Math.min(height, imageWidth * (options?.heightRatio ?? DEFAULT_TITLE_IMAGE_HEIGHT_RATIO))\n ),\n 1\n );\n return { width: imageWidth, height: imageHeight };\n};\n\nexport const getTitleImageReservedHeight = (\n spec: IStorylineSpec,\n width: number,\n height: number,\n options?: { y?: number; widthRatio?: number; maxWidth?: number; heightRatio?: number; bottom?: number }\n) => {\n if (!spec.titleImage?.image || spec.titleImage.visible === false) {\n return 0;\n }\n const size = getTitleImageSize(spec, width, height, options);\n return Math.ceil(\n (options?.y ?? DEFAULT_TITLE_IMAGE_TOP) + size.height + (options?.bottom ?? DEFAULT_TITLE_IMAGE_BOTTOM)\n );\n};\n\nexport const getChartGeometry = (ctx: LayoutContext, spec?: { width?: number; height?: number }) => {\n const chartRect = ctx.chart?.getLayoutRect?.();\n const bounds = ctx.getLayoutBounds?.();\n const width = Math.max(chartRect?.width ?? bounds?.width?.() ?? spec?.width ?? 0, 1);\n const height = Math.max(chartRect?.height ?? bounds?.height?.() ?? spec?.height ?? 0, 1);\n return { width, height, startX: 0, startY: 0 };\n};\n\nexport const buildTopTitleImageMark = (\n spec: IStorylineSpec,\n options?: { y?: number; widthRatio?: number; maxWidth?: number; heightRatio?: number }\n): ICustomMarkSpec<'image'> | null => {\n if (!spec.titleImage?.image || spec.titleImage.visible === false) {\n return null;\n }\n return {\n type: 'image',\n name: 'storyline-title-image',\n interactive: false,\n zIndex: LayoutZIndex.Mark + 8,\n ...spec.titleImage,\n style: {\n x: (_d: unknown, ctx: LayoutContext) => {\n const { width, height, startX } = getChartGeometry(ctx, spec);\n const size = getTitleImageSize(spec, width, height, options);\n return startX + (width - size.width) / 2;\n },\n y: (_d: unknown, ctx: LayoutContext) =>\n getChartGeometry(ctx, spec).startY + (options?.y ?? DEFAULT_TITLE_IMAGE_TOP),\n width: (_d: unknown, ctx: LayoutContext) => {\n const { width, height } = getChartGeometry(ctx, spec);\n return getTitleImageSize(spec, width, height, options).width;\n },\n height: (_d: unknown, ctx: LayoutContext) => {\n const { width, height } = getChartGeometry(ctx, spec);\n return getTitleImageSize(spec, width, height, options).height;\n },\n image: spec.titleImage.image,\n repeatX: 'no-repeat',\n repeatY: 'no-repeat',\n imageMode: 'contain',\n imagePosition: 'center',\n ...spec.titleImage.style\n }\n } as ICustomMarkSpec<'image'>;\n};\n\n// ===== 颜色工具 =====\n\n/**\n * 给颜色(#hex / rgb / rgba / hsl / 颜色关键字)追加/替换 alpha 通道,返回 rgba(...) 字符串\n */\nexport const withAlpha = (color: string, alpha: number): string => {\n const safeAlpha = Math.max(0, Math.min(1, alpha));\n if (!color) {\n return `rgba(0, 0, 0, ${safeAlpha})`;\n }\n const trimmed = color.trim();\n if (trimmed.startsWith('#')) {\n let hex = trimmed.slice(1);\n if (hex.length === 3 || hex.length === 4) {\n hex = hex\n .split('')\n .map(ch => ch + ch)\n .join('');\n }\n if (hex.length === 6 || hex.length === 8) {\n const r = parseInt(hex.slice(0, 2), 16);\n const g = parseInt(hex.slice(2, 4), 16);\n const b = parseInt(hex.slice(4, 6), 16);\n return `rgba(${r}, ${g}, ${b}, ${safeAlpha})`;\n }\n }\n const rgbMatch = trimmed.match(/^rgba?\\(\\s*([\\d.]+)\\s*,\\s*([\\d.]+)\\s*,\\s*([\\d.]+)/i);\n if (rgbMatch) {\n return `rgba(${rgbMatch[1]}, ${rgbMatch[2]}, ${rgbMatch[3]}, ${safeAlpha})`;\n }\n return trimmed;\n};\n\n// ===== 块宽度解析 =====\n\nexport const resolveBlockWidth = (spec: IStorylineSpec, viewWidth: number) => {\n if (spec.block?.width) {\n return spec.block.width;\n }\n const ratio = spec.block?.widthRatio ?? DEFAULT_BLOCK_WIDTH_RATIO;\n const minWidth = spec.block?.minWidth ?? DEFAULT_BLOCK_WIDTH;\n const maxWidth = spec.block?.maxWidth ?? Math.max(minWidth, 320);\n return Math.max(minWidth, Math.min(maxWidth, Math.round(viewWidth * ratio)));\n};\n\n// ===== 容器几何信息(chart region rect)=====\n\nexport const getRegionGeometry = (ctx: LayoutContext, spec?: { width?: number; height?: number }) => {\n const region = ctx.chart?.getAllRegions?.()?.[0];\n const regionRect = region?.getLayoutRect?.();\n const regionStart = region?.getLayoutStartPoint?.();\n const chartRect = ctx.chart?.getLayoutRect?.();\n const bounds = ctx.getLayoutBounds?.();\n const width = Math.max(regionRect?.width ?? chartRect?.width ?? bounds?.width?.() ?? spec?.width ?? 0, 1);\n const height = Math.max(regionRect?.height ?? chartRect?.height ?? bounds?.height?.() ?? spec?.height ?? 0, 1);\n return {\n width,\n height,\n startX: regionStart?.x ?? 0,\n startY: regionStart?.y ?? 0\n };\n};\n\n// ===== 布局计算(layout.ts 的封装,附加 startX/startY 平移)=====\n\nexport const getLayout = (spec: IStorylineSpec, ctx: LayoutContext): StorylineLayoutResult => {\n const { width, height, startX, startY } = getRegionGeometry(ctx, spec);\n let blockWidth = resolveBlockWidth(spec, width);\n let blockHeight = spec.block?.height ?? (isLandscape(spec) ? 320 : DEFAULT_BLOCK_HEIGHT);\n // landscape:图片间距固定 40,根据 block 数量自适应单个 image 宽度\n if (isLandscape(spec) && !spec.block?.width) {\n const count = spec.data?.length ?? 0;\n if (count > 0) {\n const padding = normalizePadding(spec.block?.padding);\n const innerWidth = Math.max(width - padding.left - padding.right, 1);\n const LANDSCAPE_IMAGE_GAP = 40;\n const LANDSCAPE_IMAGE_MIN_WIDTH = 80;\n const totalGap = LANDSCAPE_IMAGE_GAP * Math.max(count - 1, 0);\n const adaptive = (innerWidth - totalGap) / count;\n blockWidth = Math.max(LANDSCAPE_IMAGE_MIN_WIDTH, Math.floor(adaptive));\n }\n }\n // portrait:每个 block 在垂直方向需要容纳 image + text,整体根据 region 高度均分\n // blockHeight = regionHeight / (count + 1)(即每个 block 的\"槽位\"高度),后续 portrait.ts 中:\n // imageHeight = blockHeight * 0.6\n // contentHeight = blockHeight\n if (isPortrait(spec) && !spec.block?.height) {\n const count = spec.data?.length ?? 0;\n if (count > 0) {\n const layoutPadding = typeof spec.layout === 'object' ? spec.layout.padding : undefined;\n const padding = normalizePadding(layoutPadding ?? spec.block?.padding);\n const innerHeight = Math.max(height - padding.top - padding.bottom, 1);\n blockHeight = Math.max(120, Math.floor(innerHeight / (count + 1)));\n }\n }\n const result = computeStorylineLayout(spec.data ?? [], {\n layout: spec.layout,\n viewBox: { width, height },\n block: {\n width: blockWidth,\n height: blockHeight\n },\n gap: spec.block?.gap ?? DEFAULT_BLOCK_GAP,\n padding: spec.block?.padding,\n lineDistance: spec.line?.distance\n });\n if (!startX && !startY) {\n return result;\n }\n return {\n ...result,\n blocks: result.blocks.map(block => ({\n ...block,\n x: block.x + startX,\n y: block.y + startY,\n center: {\n x: block.center.x + startX,\n y: block.center.y + startY\n }\n })),\n links: result.links.map(link => ({\n ...link,\n start: { x: link.start.x + startX, y: link.start.y + startY },\n end: { x: link.end.x + startX, y: link.end.y + startY },\n points: link.points.map(point => ({ x: point.x + startX, y: point.y + startY }))\n }))\n };\n};\n\n// ===== 文本 / 图像通用工具 =====\n\nexport const buildPlainContent = (contentText: string[]) => contentText.join('\\n');\n\nexport const getBlockTitleHeight = (lineHeight: number, title?: string) =>\n title ? lineHeight * BLOCK_TITLE_MAX_LINES : 0;\n\nexport const omitImageLayoutSpec = (imageSpec: IStorylineSpec['image']) => {\n if (!imageSpec) {\n return {};\n }\n const { width: _width, height: _height, position: _position, gap: _gap, ...rest } = imageSpec;\n return rest;\n};\n\n// ===== 默认 image / text 盒计算(用于通用 block)=====\n\nexport const getImageBox = (\n position: StorylineImagePosition,\n blockWidth: number,\n blockHeight: number,\n padding: ReturnType<typeof normalizePadding>,\n width: number,\n height: number,\n _gap: number,\n visible: boolean\n) => {\n if (!visible) {\n return { x: padding.left, y: padding.top, width: 0, height: 0 };\n }\n switch (position) {\n case 'left':\n return { x: padding.left, y: (blockHeight - height) / 2, width, height };\n case 'right':\n return { x: blockWidth - padding.right - width, y: (blockHeight - height) / 2, width, height };\n case 'bottom':\n return { x: (blockWidth - width) / 2, y: blockHeight - padding.bottom - height, width, height };\n case 'top':\n default:\n return { x: (blockWidth - width) / 2, y: padding.top, width, height };\n }\n};\n\nexport const getTextBox = (\n position: StorylineImagePosition,\n blockWidth: number,\n blockHeight: number,\n padding: ReturnType<typeof normalizePadding>,\n imageWidth: number,\n imageHeight: number,\n imageGap: number,\n hasImage: boolean\n) => {\n if (!hasImage) {\n return {\n x: padding.left,\n y: padding.top,\n width: blockWidth - padding.left - padding.right,\n height: blockHeight - padding.top - padding.bottom\n };\n }\n switch (position) {\n case 'left':\n return {\n x: padding.left + imageWidth + imageGap,\n y: padding.top,\n width: blockWidth - padding.left - padding.right - imageWidth - imageGap,\n height: blockHeight - padding.top - padding.bottom\n };\n case 'right':\n return {\n x: padding.left,\n y: padding.top,\n width: blockWidth - padding.left - padding.right - imageWidth - imageGap,\n height: blockHeight - padding.top - padding.bottom\n };\n case 'bottom':\n return {\n x: padding.left,\n y: padding.top,\n width: blockWidth - padding.left - padding.right,\n height: blockHeight - padding.top - padding.bottom - imageHeight - imageGap\n };\n case 'top':\n default:\n return {\n x: padding.left,\n y: padding.top + imageHeight + imageGap,\n width: blockWidth - padding.left - padding.right,\n height: blockHeight - padding.top - padding.bottom - imageHeight - imageGap\n };\n }\n};\n\n// ===== Catmull-Rom 平滑曲线 =====\n\n/**\n * 用 Catmull-Rom 转 cubic Bezier 生成平滑曲线 path(贯穿所有点)。\n */\nexport const buildSmoothCurvePath = (points: StorylinePoint[]): string => {\n if (points.length < 2) {\n return '';\n }\n if (points.length === 2) {\n return `M ${points[0].x} ${points[0].y} L ${points[1].x} ${points[1].y}`;\n }\n let d = `M ${points[0].x} ${points[0].y}`;\n for (let i = 0; i < points.length - 1; i++) {\n const p0 = points[i - 1] ?? points[i];\n const p1 = points[i];\n const p2 = points[i + 1];\n const p3 = points[i + 2] ?? p2;\n const c1x = p1.x + (p2.x - p0.x) / 6;\n const c1y = p1.y + (p2.y - p0.y) / 6;\n const c2x = p2.x - (p3.x - p1.x) / 6;\n const c2y = p2.y - (p3.y - p1.y) / 6;\n d += ` C ${c1x} ${c1y}, ${c2x} ${c2y}, ${p2.x} ${p2.y}`;\n }\n return d;\n};\n\n// 重导出常用的 layout helper(避免外部再 import layout.ts)\nexport { normalizeLayout, normalizePadding };\nexport type { IStorylineBlock, ICustomMarkSpec, StorylinePoint };\n"]}
@@ -47,16 +47,21 @@ const vchart_1 = require("@visactor/vchart"), common_1 = require("./common"), bu
47
47
  exports.buildDefaultLineMark = buildDefaultLineMark;
48
48
 
49
49
  const getDefaultBlockMetrics = (spec, ctx, index) => {
50
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
51
- const block = (0, common_1.getLayout)(spec, ctx).blocks[index], padding = (0, common_1.normalizePadding)(null !== (_b = null === (_a = spec.block) || void 0 === _a ? void 0 : _a.padding) && void 0 !== _b ? _b : 12), imagePosition = null !== (_d = null === (_c = spec.image) || void 0 === _c ? void 0 : _c.position) && void 0 !== _d ? _d : "top", imageWidth = null !== (_f = null === (_e = spec.image) || void 0 === _e ? void 0 : _e.width) && void 0 !== _f ? _f : common_1.DEFAULT_IMAGE_WIDTH, imageHeight = null !== (_h = null === (_g = spec.image) || void 0 === _g ? void 0 : _g.height) && void 0 !== _h ? _h : common_1.DEFAULT_IMAGE_HEIGHT, imageGap = null !== (_k = null === (_j = spec.image) || void 0 === _j ? void 0 : _j.gap) && void 0 !== _k ? _k : common_1.DEFAULT_IMAGE_GAP, hasImage = !!(null === (_m = null === (_l = spec.data) || void 0 === _l ? void 0 : _l[index]) || void 0 === _m ? void 0 : _m.image), titleFontSize = Number(null !== (_q = null === (_p = null === (_o = spec.title) || void 0 === _o ? void 0 : _o.style) || void 0 === _p ? void 0 : _p.fontSize) && void 0 !== _q ? _q : 18), titleLineHeight = Number(null !== (_t = null === (_s = null === (_r = spec.title) || void 0 === _r ? void 0 : _r.style) || void 0 === _s ? void 0 : _s.lineHeight) && void 0 !== _t ? _t : Math.round(1.35 * titleFontSize)), titleHeight = (null === (_v = null === (_u = spec.data) || void 0 === _u ? void 0 : _u[index]) || void 0 === _v ? void 0 : _v.title) ? titleLineHeight : 0, blockWidth = null !== (_w = null == block ? void 0 : block.width) && void 0 !== _w ? _w : (0,
52
- common_1.resolveBlockWidth)(spec, 0), blockHeight = null !== (_z = null !== (_x = null == block ? void 0 : block.height) && void 0 !== _x ? _x : null === (_y = spec.block) || void 0 === _y ? void 0 : _y.height) && void 0 !== _z ? _z : common_1.DEFAULT_BLOCK_HEIGHT, imageBox = (0,
50
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
51
+ const block = (0, common_1.getLayout)(spec, ctx).blocks[index], padding = (0, common_1.normalizePadding)(null !== (_b = null === (_a = spec.block) || void 0 === _a ? void 0 : _a.padding) && void 0 !== _b ? _b : 12), imagePosition = null !== (_d = null === (_c = spec.image) || void 0 === _c ? void 0 : _c.position) && void 0 !== _d ? _d : "top", imageWidth = null !== (_f = null === (_e = spec.image) || void 0 === _e ? void 0 : _e.width) && void 0 !== _f ? _f : common_1.DEFAULT_IMAGE_WIDTH, imageHeight = null !== (_h = null === (_g = spec.image) || void 0 === _g ? void 0 : _g.height) && void 0 !== _h ? _h : common_1.DEFAULT_IMAGE_HEIGHT, imageGap = null !== (_k = null === (_j = spec.image) || void 0 === _j ? void 0 : _j.gap) && void 0 !== _k ? _k : common_1.DEFAULT_IMAGE_GAP, hasImage = !!(null === (_m = null === (_l = spec.data) || void 0 === _l ? void 0 : _l[index]) || void 0 === _m ? void 0 : _m.image), blockWidth = null !== (_o = null == block ? void 0 : block.width) && void 0 !== _o ? _o : (0,
52
+ common_1.resolveBlockWidth)(spec, 0), blockHeight = null !== (_r = null !== (_p = null == block ? void 0 : block.height) && void 0 !== _p ? _p : null === (_q = spec.block) || void 0 === _q ? void 0 : _q.height) && void 0 !== _r ? _r : common_1.DEFAULT_BLOCK_HEIGHT, imageBox = (0,
53
53
  common_1.getImageBox)(imagePosition, blockWidth, blockHeight, padding, imageWidth, imageHeight, imageGap, hasImage), textBox = (0,
54
- common_1.getTextBox)(imagePosition, blockWidth, blockHeight, padding, imageWidth, imageHeight, imageGap, hasImage), contentGap = (null === (_1 = null === (_0 = spec.data) || void 0 === _0 ? void 0 : _0[index]) || void 0 === _1 ? void 0 : _1.title) ? 8 : 0;
54
+ common_1.getTextBox)(imagePosition, blockWidth, blockHeight, padding, imageWidth, imageHeight, imageGap, hasImage), titleFontSize = (0,
55
+ common_1.resolveTitleFontSize)(spec, ctx, null === (_t = null === (_s = spec.data) || void 0 === _s ? void 0 : _s[index]) || void 0 === _t ? void 0 : _t.title, textBox.width, 18, [ 8, 28 ]), titleLineHeight = (0,
56
+ common_1.resolveAdaptiveLineHeight)(titleFontSize, null === (_u = spec.title) || void 0 === _u ? void 0 : _u.style, Math.round(24.3)), titleHeight = (0,
57
+ common_1.getBlockTitleHeight)(titleLineHeight, null === (_w = null === (_v = spec.data) || void 0 === _v ? void 0 : _v[index]) || void 0 === _w ? void 0 : _w.title), contentGap = (null === (_y = null === (_x = spec.data) || void 0 === _x ? void 0 : _x[index]) || void 0 === _y ? void 0 : _y.title) ? 8 : 0;
55
58
  return {
56
59
  block: {
57
60
  width: blockWidth,
58
61
  height: blockHeight
59
62
  },
63
+ titleFontSize: titleFontSize,
64
+ titleLineHeight: titleLineHeight,
60
65
  imageBox: imageBox,
61
66
  textBox: textBox,
62
67
  contentBox: {
@@ -65,12 +70,11 @@ const getDefaultBlockMetrics = (spec, ctx, index) => {
65
70
  }
66
71
  };
67
72
  }, buildDefaultBlockMark = (spec, block, index) => {
68
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
69
- const hasImage = !!block.image, contentText = Array.isArray(block.content) ? block.content : block.content ? [ block.content ] : [], titleFontSize = Number(null !== (_c = null === (_b = null === (_a = spec.title) || void 0 === _a ? void 0 : _a.style) || void 0 === _b ? void 0 : _b.fontSize) && void 0 !== _c ? _c : 18), titleLineHeight = Number(null !== (_f = null === (_e = null === (_d = spec.title) || void 0 === _d ? void 0 : _d.style) || void 0 === _e ? void 0 : _e.lineHeight) && void 0 !== _f ? _f : Math.round(1.35 * titleFontSize)), themeColor = (0,
70
- common_1.getThemeColor)(spec);
73
+ var _a, _b, _c, _d, _e, _f, _g;
74
+ const hasImage = !!block.image, contentText = Array.isArray(block.content) ? block.content : block.content ? [ block.content ] : [];
71
75
  return {
72
76
  type: "group",
73
- id: `storyline-block-${null !== (_g = block.id) && void 0 !== _g ? _g : index}`,
77
+ id: `storyline-block-${null !== (_a = block.id) && void 0 !== _a ? _a : index}`,
74
78
  name: `storyline-block-${index}`,
75
79
  zIndex: vchart_1.LayoutZIndex.Mark + 1,
76
80
  style: {
@@ -85,7 +89,7 @@ const getDefaultBlockMetrics = (spec, ctx, index) => {
85
89
  width: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).block.width,
86
90
  height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).block.height
87
91
  },
88
- children: [ !0 === (null === (_h = spec.block) || void 0 === _h ? void 0 : _h.showBackground) ? {
92
+ children: [ !0 === (null === (_b = spec.block) || void 0 === _b ? void 0 : _b.showBackground) ? {
89
93
  type: "rect",
90
94
  name: `storyline-block-bg-${index}`,
91
95
  interactive: !1,
@@ -100,21 +104,18 @@ const getDefaultBlockMetrics = (spec, ctx, index) => {
100
104
  lineWidth: 1,
101
105
  shadowBlur: 6,
102
106
  shadowColor: "rgba(0, 0, 0, 0.08)"
103
- }, null === (_j = spec.block) || void 0 === _j ? void 0 : _j.style)
107
+ }, null === (_c = spec.block) || void 0 === _c ? void 0 : _c.style)
104
108
  } : null, (0, common_1.shouldShowImageBackground)(spec) ? {
105
109
  type: "rect",
106
110
  name: `storyline-block-image-bg-${index}`,
107
111
  interactive: !1,
108
- style: Object.assign({
112
+ style: Object.assign(Object.assign({
109
113
  x: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.x,
110
114
  y: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.y,
111
115
  width: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.width,
112
116
  height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.height,
113
- cornerRadius: 8,
114
- fill: "#ffffff",
115
- stroke: themeColor,
116
- lineWidth: 2
117
- }, null === (_k = spec.block) || void 0 === _k ? void 0 : _k.style)
117
+ cornerRadius: 8
118
+ }, (0, common_1.getImageBackgroundStyle)(spec)), null === (_d = spec.block) || void 0 === _d ? void 0 : _d.style)
118
119
  } : null, hasImage ? Object.assign(Object.assign({
119
120
  type: "image",
120
121
  name: `storyline-block-image-${index}`,
@@ -126,7 +127,7 @@ const getDefaultBlockMetrics = (spec, ctx, index) => {
126
127
  width: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.width,
127
128
  height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.height,
128
129
  image: block.image
129
- }, null === (_l = spec.image) || void 0 === _l ? void 0 : _l.style)
130
+ }, null === (_e = spec.image) || void 0 === _e ? void 0 : _e.style)
130
131
  }) : null, block.title ? Object.assign(Object.assign({
131
132
  type: "text",
132
133
  name: `storyline-block-title-${index}`,
@@ -137,39 +138,44 @@ const getDefaultBlockMetrics = (spec, ctx, index) => {
137
138
  y: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.y,
138
139
  text: block.title,
139
140
  maxLineWidth: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.width,
140
- fontSize: titleFontSize,
141
- lineHeight: titleLineHeight,
141
+ height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).titleLineHeight * common_1.BLOCK_TITLE_MAX_LINES,
142
+ heightLimit: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).titleLineHeight * common_1.BLOCK_TITLE_MAX_LINES,
143
+ lineClamp: common_1.BLOCK_TITLE_MAX_LINES,
144
+ fontSize: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).titleFontSize,
145
+ lineHeight: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).titleLineHeight,
142
146
  fontWeight: "bold",
143
147
  fill: "#1f2430",
144
148
  stroke: "#fff",
145
149
  lineWidth: 5,
146
150
  lineJoin: "round",
147
151
  textAlign: "left",
148
- textBaseline: "top"
149
- }, null === (_m = spec.title) || void 0 === _m ? void 0 : _m.style)
152
+ textBaseline: "top",
153
+ whiteSpace: "normal",
154
+ wordBreak: "break-word",
155
+ ellipsis: "..."
156
+ }, null === (_f = spec.title) || void 0 === _f ? void 0 : _f.style)
150
157
  }) : null, contentText.length ? Object.assign(Object.assign({
151
158
  type: "text",
152
159
  name: `storyline-block-content-${index}`,
153
160
  interactive: !1
154
161
  }, spec.content), {
155
- textType: "rich",
156
162
  style: Object.assign({
157
163
  x: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.x,
158
164
  y: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).contentBox.y,
159
165
  width: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.width,
160
- text: (0, common_1.buildRichContent)(contentText, spec, {
161
- fontSize: 18,
162
- lineHeight: 26,
163
- fill: "#596173"
164
- }),
166
+ height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).contentBox.height,
167
+ text: (0, common_1.buildPlainContent)(contentText),
165
168
  maxLineWidth: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.width,
166
169
  heightLimit: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).contentBox.height,
170
+ fontSize: 16,
171
+ lineHeight: 23,
167
172
  textAlign: "left",
168
173
  textBaseline: "top",
174
+ whiteSpace: "normal",
169
175
  wordBreak: "break-word",
170
176
  ellipsis: "...",
171
177
  fill: "#596173"
172
- }, null === (_o = spec.content) || void 0 === _o ? void 0 : _o.style)
178
+ }, null === (_g = spec.content) || void 0 === _g ? void 0 : _g.style)
173
179
  }) : null ].filter(Boolean)
174
180
  };
175
181
  };