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

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 (53) hide show
  1. package/build/index.js +415 -418
  2. package/build/index.min.js +2 -2
  3. package/cjs/charts/storyline/interface.d.ts +2 -2
  4. package/cjs/charts/storyline/interface.js.map +1 -1
  5. package/cjs/charts/storyline/layouts/arc.d.ts +1 -1
  6. package/cjs/charts/storyline/layouts/arc.js +35 -98
  7. package/cjs/charts/storyline/layouts/arc.js.map +1 -1
  8. package/cjs/charts/storyline/layouts/clock.d.ts +1 -1
  9. package/cjs/charts/storyline/layouts/clock.js +32 -30
  10. package/cjs/charts/storyline/layouts/clock.js.map +1 -1
  11. package/cjs/charts/storyline/layouts/common.d.ts +53 -1
  12. package/cjs/charts/storyline/layouts/common.js +180 -23
  13. package/cjs/charts/storyline/layouts/common.js.map +1 -1
  14. package/cjs/charts/storyline/layouts/default.js +21 -21
  15. package/cjs/charts/storyline/layouts/default.js.map +1 -1
  16. package/cjs/charts/storyline/layouts/ladder.js +21 -20
  17. package/cjs/charts/storyline/layouts/ladder.js.map +1 -1
  18. package/cjs/charts/storyline/layouts/landscape.js +20 -21
  19. package/cjs/charts/storyline/layouts/landscape.js.map +1 -1
  20. package/cjs/charts/storyline/layouts/portrait.d.ts +1 -1
  21. package/cjs/charts/storyline/layouts/portrait.js +63 -55
  22. package/cjs/charts/storyline/layouts/portrait.js.map +1 -1
  23. package/cjs/charts/storyline/layouts/wing.d.ts +1 -0
  24. package/cjs/charts/storyline/layouts/wing.js +91 -49
  25. package/cjs/charts/storyline/layouts/wing.js.map +1 -1
  26. package/cjs/charts/storyline/storyline-transformer.js +18 -14
  27. package/cjs/charts/storyline/storyline-transformer.js.map +1 -1
  28. package/esm/charts/storyline/interface.d.ts +2 -2
  29. package/esm/charts/storyline/interface.js.map +1 -1
  30. package/esm/charts/storyline/layouts/arc.d.ts +1 -1
  31. package/esm/charts/storyline/layouts/arc.js +31 -96
  32. package/esm/charts/storyline/layouts/arc.js.map +1 -1
  33. package/esm/charts/storyline/layouts/clock.d.ts +1 -1
  34. package/esm/charts/storyline/layouts/clock.js +30 -29
  35. package/esm/charts/storyline/layouts/clock.js.map +1 -1
  36. package/esm/charts/storyline/layouts/common.d.ts +53 -1
  37. package/esm/charts/storyline/layouts/common.js +165 -20
  38. package/esm/charts/storyline/layouts/common.js.map +1 -1
  39. package/esm/charts/storyline/layouts/default.js +18 -19
  40. package/esm/charts/storyline/layouts/default.js.map +1 -1
  41. package/esm/charts/storyline/layouts/ladder.js +17 -18
  42. package/esm/charts/storyline/layouts/ladder.js.map +1 -1
  43. package/esm/charts/storyline/layouts/landscape.js +18 -21
  44. package/esm/charts/storyline/layouts/landscape.js.map +1 -1
  45. package/esm/charts/storyline/layouts/portrait.d.ts +1 -1
  46. package/esm/charts/storyline/layouts/portrait.js +60 -57
  47. package/esm/charts/storyline/layouts/portrait.js.map +1 -1
  48. package/esm/charts/storyline/layouts/wing.d.ts +1 -0
  49. package/esm/charts/storyline/layouts/wing.js +86 -49
  50. package/esm/charts/storyline/layouts/wing.js.map +1 -1
  51. package/esm/charts/storyline/storyline-transformer.js +20 -18
  52. package/esm/charts/storyline/storyline-transformer.js.map +1 -1
  53. package/package.json +4 -4
package/build/index.js CHANGED
@@ -6078,6 +6078,11 @@
6078
6078
  const DEFAULT_IMAGE_HEIGHT = 48;
6079
6079
  const DEFAULT_IMAGE_GAP = 10;
6080
6080
  const DEFAULT_THEME_COLOR = '#e8543d';
6081
+ const DEFAULT_TITLE_IMAGE_WIDTH_RATIO = 0.52;
6082
+ const DEFAULT_TITLE_IMAGE_MAX_WIDTH = 720;
6083
+ const DEFAULT_TITLE_IMAGE_HEIGHT_RATIO = 0.36;
6084
+ const DEFAULT_TITLE_IMAGE_TOP = 12;
6085
+ const DEFAULT_TITLE_IMAGE_BOTTOM = 24;
6081
6086
  const isLandscape = (spec) => normalizeLayout(spec.layout).type === 'landscape';
6082
6087
  const isPortrait = (spec) => normalizeLayout(spec.layout).type === 'portrait';
6083
6088
  const isClock = (spec) => normalizeLayout(spec.layout).type === 'clock';
@@ -6086,6 +6091,143 @@
6086
6091
  const isLadder = (spec) => normalizeLayout(spec.layout).type === 'ladder';
6087
6092
  const getThemeColor = (spec) => { var _a; return (_a = spec.themeColor) !== null && _a !== void 0 ? _a : DEFAULT_THEME_COLOR; };
6088
6093
  const shouldShowImageBackground = (spec) => { var _a, _b; return (_b = (_a = spec.image) === null || _a === void 0 ? void 0 : _a.showBackground) !== null && _b !== void 0 ? _b : !(isPortrait(spec) || isLandscape(spec)); };
6094
+ const TITLE_FONT_SCALE_ID = 'storylineTitleFontSize';
6095
+ const MARKER_FONT_SCALE_ID = 'storylineMarkerFontSize';
6096
+ const clamp = (value, min, max) => Math.max(min, Math.min(max, value));
6097
+ const getTextWeight = (text) => {
6098
+ if (!text) {
6099
+ return 4;
6100
+ }
6101
+ return Math.max(Array.from(text).reduce((sum, char) => {
6102
+ if (char.trim().length === 0) {
6103
+ return sum + 0.32;
6104
+ }
6105
+ return sum + (char.charCodeAt(0) > 255 ? 1.05 : 0.62);
6106
+ }, 0), 1);
6107
+ };
6108
+ const getScaleRange = (spec, scaleId, fallback) => {
6109
+ var _a;
6110
+ const scales = spec.scales;
6111
+ const range = (_a = scales === null || scales === void 0 ? void 0 : scales.find(scale => scale.id === scaleId || scale.type === scaleId)) === null || _a === void 0 ? void 0 : _a.range;
6112
+ if (Array.isArray(range) && range.length >= 2 && typeof range[0] === 'number' && typeof range[1] === 'number') {
6113
+ return [Math.min(range[0], range[1]), Math.max(range[0], range[1])];
6114
+ }
6115
+ return fallback;
6116
+ };
6117
+ const getSpecGeometry = (spec, ctx) => {
6118
+ var _a, _b;
6119
+ if (ctx) {
6120
+ return getRegionGeometry(ctx, spec);
6121
+ }
6122
+ return {
6123
+ width: Math.max(Number((_a = spec.width) !== null && _a !== void 0 ? _a : 0), 1),
6124
+ height: Math.max(Number((_b = spec.height) !== null && _b !== void 0 ? _b : 0), 1),
6125
+ startX: 0,
6126
+ startY: 0
6127
+ };
6128
+ };
6129
+ const resolveAdaptiveFontSize = (spec, ctx, text, options) => {
6130
+ var _a;
6131
+ const configuredFontSize = (_a = options.style) === null || _a === void 0 ? void 0 : _a.fontSize;
6132
+ if (configuredFontSize != null) {
6133
+ return Number(configuredFontSize);
6134
+ }
6135
+ const [minFontSize, maxFontSize] = getScaleRange(spec, options.scaleId, options.range);
6136
+ const { width, height } = getSpecGeometry(spec, ctx);
6137
+ const textWeight = getTextWeight(text);
6138
+ const canvasSize = Math.sqrt(width * height) * options.canvasRatio;
6139
+ const lengthFactor = Math.sqrt(8 / Math.max(textWeight, 4));
6140
+ const adaptiveSize = width <= 1 && height <= 1 ? options.fallback : canvasSize * lengthFactor;
6141
+ const boxWidthLimit = options.boxWidth && options.boxWidth > 0 ? (options.boxWidth / textWeight) * 0.96 : Number.POSITIVE_INFINITY;
6142
+ const boxHeightLimit = options.boxHeight && options.boxHeight > 0 ? options.boxHeight / Math.max(textWeight, 1) : Number.POSITIVE_INFINITY;
6143
+ return Math.floor(clamp(Math.min(adaptiveSize, boxWidthLimit, boxHeightLimit), minFontSize, maxFontSize));
6144
+ };
6145
+ const resolveAdaptiveLineHeight = (fontSize, style, fallback, ratio = 1.35) => { var _a; return Number((_a = style === null || style === void 0 ? void 0 : style.lineHeight) !== null && _a !== void 0 ? _a : Math.round((Number.isFinite(fontSize) ? fontSize : fallback) * ratio)); };
6146
+ const resolveTitleFontSize = (spec, ctx, title, boxWidth, fallback, range = [16, 34]) => {
6147
+ var _a;
6148
+ return resolveAdaptiveFontSize(spec, ctx, title, {
6149
+ style: (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style,
6150
+ scaleId: TITLE_FONT_SCALE_ID,
6151
+ fallback,
6152
+ range,
6153
+ canvasRatio: 0.038,
6154
+ boxWidth
6155
+ });
6156
+ };
6157
+ const resolveMarkerFontSize = (spec, ctx, marker, boxHeight, fallback, range = [18, 46]) => {
6158
+ var _a;
6159
+ return resolveAdaptiveFontSize(spec, ctx, marker, {
6160
+ style: (_a = spec.marker) === null || _a === void 0 ? void 0 : _a.style,
6161
+ scaleId: MARKER_FONT_SCALE_ID,
6162
+ fallback,
6163
+ range,
6164
+ canvasRatio: 0.052,
6165
+ boxHeight
6166
+ });
6167
+ };
6168
+ const getImageBackgroundStyle = (spec) => {
6169
+ const themeColor = getThemeColor(spec);
6170
+ return {
6171
+ fill: {
6172
+ gradient: 'linear',
6173
+ x0: 0,
6174
+ y0: 0,
6175
+ x1: 1,
6176
+ y1: 1,
6177
+ stops: [
6178
+ { offset: 0, color: '#ffffff' },
6179
+ { offset: 0.58, color: withAlpha(themeColor, 0.12) },
6180
+ { offset: 1, color: withAlpha(themeColor, 0.32) }
6181
+ ]
6182
+ },
6183
+ stroke: withAlpha(themeColor, 0.78),
6184
+ lineWidth: 2,
6185
+ shadowColor: withAlpha(themeColor, 0.18),
6186
+ shadowBlur: 10,
6187
+ shadowOffsetX: 0,
6188
+ shadowOffsetY: 4
6189
+ };
6190
+ };
6191
+ const getTitleImageSize = (spec, width, height, options) => {
6192
+ var _a, _b, _c, _e, _f, _g, _h;
6193
+ const defaultWidth = Math.min(Math.max(width * ((_a = options === null || options === void 0 ? void 0 : options.widthRatio) !== null && _a !== void 0 ? _a : DEFAULT_TITLE_IMAGE_WIDTH_RATIO), 1), (_b = options === null || options === void 0 ? void 0 : options.maxWidth) !== null && _b !== void 0 ? _b : DEFAULT_TITLE_IMAGE_MAX_WIDTH);
6194
+ const imageWidth = Math.max(Number((_e = (_c = spec.titleImage) === null || _c === void 0 ? void 0 : _c.width) !== null && _e !== void 0 ? _e : defaultWidth), 1);
6195
+ const imageHeight = Math.max(Number((_g = (_f = spec.titleImage) === null || _f === void 0 ? void 0 : _f.height) !== null && _g !== void 0 ? _g : Math.min(height, imageWidth * ((_h = options === null || options === void 0 ? void 0 : options.heightRatio) !== null && _h !== void 0 ? _h : DEFAULT_TITLE_IMAGE_HEIGHT_RATIO))), 1);
6196
+ return { width: imageWidth, height: imageHeight };
6197
+ };
6198
+ const getTitleImageReservedHeight = (spec, width, height, options) => {
6199
+ var _a, _b, _c;
6200
+ if (!((_a = spec.titleImage) === null || _a === void 0 ? void 0 : _a.image) || spec.titleImage.visible === false) {
6201
+ return 0;
6202
+ }
6203
+ const size = getTitleImageSize(spec, width, height, options);
6204
+ return Math.ceil(((_b = options === null || options === void 0 ? void 0 : options.y) !== null && _b !== void 0 ? _b : DEFAULT_TITLE_IMAGE_TOP) + size.height + ((_c = options === null || options === void 0 ? void 0 : options.bottom) !== null && _c !== void 0 ? _c : DEFAULT_TITLE_IMAGE_BOTTOM));
6205
+ };
6206
+ const getChartGeometry = (ctx, spec) => {
6207
+ var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m;
6208
+ const chartRect = (_b = (_a = ctx.chart) === null || _a === void 0 ? void 0 : _a.getLayoutRect) === null || _b === void 0 ? void 0 : _b.call(_a);
6209
+ const bounds = (_c = ctx.getLayoutBounds) === null || _c === void 0 ? void 0 : _c.call(ctx);
6210
+ const width = Math.max((_h = (_g = (_e = chartRect === null || chartRect === void 0 ? void 0 : chartRect.width) !== null && _e !== void 0 ? _e : (_f = bounds === null || bounds === void 0 ? void 0 : bounds.width) === null || _f === void 0 ? void 0 : _f.call(bounds)) !== null && _g !== void 0 ? _g : spec === null || spec === void 0 ? void 0 : spec.width) !== null && _h !== void 0 ? _h : 0, 1);
6211
+ const height = Math.max((_m = (_l = (_j = chartRect === null || chartRect === void 0 ? void 0 : chartRect.height) !== null && _j !== void 0 ? _j : (_k = bounds === null || bounds === void 0 ? void 0 : bounds.height) === null || _k === void 0 ? void 0 : _k.call(bounds)) !== null && _l !== void 0 ? _l : spec === null || spec === void 0 ? void 0 : spec.height) !== null && _m !== void 0 ? _m : 0, 1);
6212
+ return { width, height, startX: 0, startY: 0 };
6213
+ };
6214
+ const buildTopTitleImageMark = (spec, options) => {
6215
+ var _a;
6216
+ if (!((_a = spec.titleImage) === null || _a === void 0 ? void 0 : _a.image) || spec.titleImage.visible === false) {
6217
+ return null;
6218
+ }
6219
+ return Object.assign(Object.assign({ type: 'image', name: 'storyline-title-image', interactive: false, zIndex: vchart.LayoutZIndex.Mark + 8 }, spec.titleImage), { style: Object.assign({ x: (_d, ctx) => {
6220
+ const { width, height, startX } = getChartGeometry(ctx, spec);
6221
+ const size = getTitleImageSize(spec, width, height, options);
6222
+ return startX + (width - size.width) / 2;
6223
+ }, y: (_d, ctx) => { var _a; return getChartGeometry(ctx, spec).startY + ((_a = options === null || options === void 0 ? void 0 : options.y) !== null && _a !== void 0 ? _a : DEFAULT_TITLE_IMAGE_TOP); }, width: (_d, ctx) => {
6224
+ const { width, height } = getChartGeometry(ctx, spec);
6225
+ return getTitleImageSize(spec, width, height, options).width;
6226
+ }, height: (_d, ctx) => {
6227
+ const { width, height } = getChartGeometry(ctx, spec);
6228
+ return getTitleImageSize(spec, width, height, options).height;
6229
+ }, image: spec.titleImage.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'contain', imagePosition: 'center' }, spec.titleImage.style) });
6230
+ };
6089
6231
  const withAlpha = (color, alpha) => {
6090
6232
  const safeAlpha = Math.max(0, Math.min(1, alpha));
6091
6233
  if (!color) {
@@ -6114,40 +6256,40 @@
6114
6256
  return trimmed;
6115
6257
  };
6116
6258
  const resolveBlockWidth = (spec, viewWidth) => {
6117
- var _a, _b, _c, _d, _e, _f, _g;
6259
+ var _a, _b, _c, _e, _f, _g, _h;
6118
6260
  if ((_a = spec.block) === null || _a === void 0 ? void 0 : _a.width) {
6119
6261
  return spec.block.width;
6120
6262
  }
6121
6263
  const ratio = (_c = (_b = spec.block) === null || _b === void 0 ? void 0 : _b.widthRatio) !== null && _c !== void 0 ? _c : DEFAULT_BLOCK_WIDTH_RATIO;
6122
- const minWidth = (_e = (_d = spec.block) === null || _d === void 0 ? void 0 : _d.minWidth) !== null && _e !== void 0 ? _e : DEFAULT_BLOCK_WIDTH;
6123
- const maxWidth = (_g = (_f = spec.block) === null || _f === void 0 ? void 0 : _f.maxWidth) !== null && _g !== void 0 ? _g : Math.max(minWidth, 320);
6264
+ const minWidth = (_f = (_e = spec.block) === null || _e === void 0 ? void 0 : _e.minWidth) !== null && _f !== void 0 ? _f : DEFAULT_BLOCK_WIDTH;
6265
+ const maxWidth = (_h = (_g = spec.block) === null || _g === void 0 ? void 0 : _g.maxWidth) !== null && _h !== void 0 ? _h : Math.max(minWidth, 320);
6124
6266
  return Math.max(minWidth, Math.min(maxWidth, Math.round(viewWidth * ratio)));
6125
6267
  };
6126
6268
  const getRegionGeometry = (ctx, spec) => {
6127
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
6269
+ var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
6128
6270
  const region = (_c = (_b = (_a = ctx.chart) === null || _a === void 0 ? void 0 : _a.getAllRegions) === null || _b === void 0 ? void 0 : _b.call(_a)) === null || _c === void 0 ? void 0 : _c[0];
6129
- const regionRect = (_d = region === null || region === void 0 ? void 0 : region.getLayoutRect) === null || _d === void 0 ? void 0 : _d.call(region);
6130
- const regionStart = (_e = region === null || region === void 0 ? void 0 : region.getLayoutStartPoint) === null || _e === void 0 ? void 0 : _e.call(region);
6131
- const chartRect = (_g = (_f = ctx.chart) === null || _f === void 0 ? void 0 : _f.getLayoutRect) === null || _g === void 0 ? void 0 : _g.call(_f);
6132
- const bounds = (_h = ctx.getLayoutBounds) === null || _h === void 0 ? void 0 : _h.call(ctx);
6133
- const width = Math.max((_o = (_m = (_k = (_j = regionRect === null || regionRect === void 0 ? void 0 : regionRect.width) !== null && _j !== void 0 ? _j : chartRect === null || chartRect === void 0 ? void 0 : chartRect.width) !== null && _k !== void 0 ? _k : (_l = bounds === null || bounds === void 0 ? void 0 : bounds.width) === null || _l === void 0 ? void 0 : _l.call(bounds)) !== null && _m !== void 0 ? _m : spec === null || spec === void 0 ? void 0 : spec.width) !== null && _o !== void 0 ? _o : 0, 1);
6134
- const height = Math.max((_t = (_s = (_q = (_p = regionRect === null || regionRect === void 0 ? void 0 : regionRect.height) !== null && _p !== void 0 ? _p : chartRect === null || chartRect === void 0 ? void 0 : chartRect.height) !== null && _q !== void 0 ? _q : (_r = bounds === null || bounds === void 0 ? void 0 : bounds.height) === null || _r === void 0 ? void 0 : _r.call(bounds)) !== null && _s !== void 0 ? _s : spec === null || spec === void 0 ? void 0 : spec.height) !== null && _t !== void 0 ? _t : 0, 1);
6271
+ const regionRect = (_e = region === null || region === void 0 ? void 0 : region.getLayoutRect) === null || _e === void 0 ? void 0 : _e.call(region);
6272
+ const regionStart = (_f = region === null || region === void 0 ? void 0 : region.getLayoutStartPoint) === null || _f === void 0 ? void 0 : _f.call(region);
6273
+ const chartRect = (_h = (_g = ctx.chart) === null || _g === void 0 ? void 0 : _g.getLayoutRect) === null || _h === void 0 ? void 0 : _h.call(_g);
6274
+ const bounds = (_j = ctx.getLayoutBounds) === null || _j === void 0 ? void 0 : _j.call(ctx);
6275
+ const width = Math.max((_p = (_o = (_l = (_k = regionRect === null || regionRect === void 0 ? void 0 : regionRect.width) !== null && _k !== void 0 ? _k : chartRect === null || chartRect === void 0 ? void 0 : chartRect.width) !== null && _l !== void 0 ? _l : (_m = bounds === null || bounds === void 0 ? void 0 : bounds.width) === null || _m === void 0 ? void 0 : _m.call(bounds)) !== null && _o !== void 0 ? _o : spec === null || spec === void 0 ? void 0 : spec.width) !== null && _p !== void 0 ? _p : 0, 1);
6276
+ const height = Math.max((_u = (_t = (_r = (_q = regionRect === null || regionRect === void 0 ? void 0 : regionRect.height) !== null && _q !== void 0 ? _q : chartRect === null || chartRect === void 0 ? void 0 : chartRect.height) !== null && _r !== void 0 ? _r : (_s = bounds === null || bounds === void 0 ? void 0 : bounds.height) === null || _s === void 0 ? void 0 : _s.call(bounds)) !== null && _t !== void 0 ? _t : spec === null || spec === void 0 ? void 0 : spec.height) !== null && _u !== void 0 ? _u : 0, 1);
6135
6277
  return {
6136
6278
  width,
6137
6279
  height,
6138
- startX: (_u = regionStart === null || regionStart === void 0 ? void 0 : regionStart.x) !== null && _u !== void 0 ? _u : 0,
6139
- startY: (_v = regionStart === null || regionStart === void 0 ? void 0 : regionStart.y) !== null && _v !== void 0 ? _v : 0
6280
+ startX: (_v = regionStart === null || regionStart === void 0 ? void 0 : regionStart.x) !== null && _v !== void 0 ? _v : 0,
6281
+ startY: (_w = regionStart === null || regionStart === void 0 ? void 0 : regionStart.y) !== null && _w !== void 0 ? _w : 0
6140
6282
  };
6141
6283
  };
6142
6284
  const getLayout = (spec, ctx) => {
6143
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
6285
+ var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
6144
6286
  const { width, height, startX, startY } = getRegionGeometry(ctx, spec);
6145
6287
  let blockWidth = resolveBlockWidth(spec, width);
6146
6288
  let blockHeight = (_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.height) !== null && _b !== void 0 ? _b : (isLandscape(spec) ? 320 : DEFAULT_BLOCK_HEIGHT);
6147
6289
  if (isLandscape(spec) && !((_c = spec.block) === null || _c === void 0 ? void 0 : _c.width)) {
6148
- const count = (_e = (_d = spec.data) === null || _d === void 0 ? void 0 : _d.length) !== null && _e !== void 0 ? _e : 0;
6290
+ const count = (_f = (_e = spec.data) === null || _e === void 0 ? void 0 : _e.length) !== null && _f !== void 0 ? _f : 0;
6149
6291
  if (count > 0) {
6150
- const padding = normalizePadding((_f = spec.block) === null || _f === void 0 ? void 0 : _f.padding);
6292
+ const padding = normalizePadding((_g = spec.block) === null || _g === void 0 ? void 0 : _g.padding);
6151
6293
  const innerWidth = Math.max(width - padding.left - padding.right, 1);
6152
6294
  const LANDSCAPE_IMAGE_GAP = 40;
6153
6295
  const LANDSCAPE_IMAGE_MIN_WIDTH = 80;
@@ -6156,24 +6298,25 @@
6156
6298
  blockWidth = Math.max(LANDSCAPE_IMAGE_MIN_WIDTH, Math.floor(adaptive));
6157
6299
  }
6158
6300
  }
6159
- if (isPortrait(spec) && !((_g = spec.block) === null || _g === void 0 ? void 0 : _g.height)) {
6160
- const count = (_j = (_h = spec.data) === null || _h === void 0 ? void 0 : _h.length) !== null && _j !== void 0 ? _j : 0;
6301
+ if (isPortrait(spec) && !((_h = spec.block) === null || _h === void 0 ? void 0 : _h.height)) {
6302
+ const count = (_k = (_j = spec.data) === null || _j === void 0 ? void 0 : _j.length) !== null && _k !== void 0 ? _k : 0;
6161
6303
  if (count > 0) {
6162
- const padding = normalizePadding((_l = (_k = spec.layout) === null || _k === void 0 ? void 0 : _k.padding) !== null && _l !== void 0 ? _l : (_m = spec.block) === null || _m === void 0 ? void 0 : _m.padding);
6304
+ const layoutPadding = typeof spec.layout === 'object' ? spec.layout.padding : undefined;
6305
+ const padding = normalizePadding(layoutPadding !== null && layoutPadding !== void 0 ? layoutPadding : (_l = spec.block) === null || _l === void 0 ? void 0 : _l.padding);
6163
6306
  const innerHeight = Math.max(height - padding.top - padding.bottom, 1);
6164
6307
  blockHeight = Math.max(120, Math.floor(innerHeight / (count + 1)));
6165
6308
  }
6166
6309
  }
6167
- const result = computeStorylineLayout((_o = spec.data) !== null && _o !== void 0 ? _o : [], {
6310
+ const result = computeStorylineLayout((_m = spec.data) !== null && _m !== void 0 ? _m : [], {
6168
6311
  layout: spec.layout,
6169
6312
  viewBox: { width, height },
6170
6313
  block: {
6171
6314
  width: blockWidth,
6172
6315
  height: blockHeight
6173
6316
  },
6174
- gap: (_q = (_p = spec.block) === null || _p === void 0 ? void 0 : _p.gap) !== null && _q !== void 0 ? _q : DEFAULT_BLOCK_GAP,
6175
- padding: (_r = spec.block) === null || _r === void 0 ? void 0 : _r.padding,
6176
- lineDistance: (_s = spec.line) === null || _s === void 0 ? void 0 : _s.distance
6317
+ gap: (_p = (_o = spec.block) === null || _o === void 0 ? void 0 : _o.gap) !== null && _p !== void 0 ? _p : DEFAULT_BLOCK_GAP,
6318
+ padding: (_q = spec.block) === null || _q === void 0 ? void 0 : _q.padding,
6319
+ lineDistance: (_r = spec.line) === null || _r === void 0 ? void 0 : _r.distance
6177
6320
  });
6178
6321
  if (!startX && !startY) {
6179
6322
  return result;
@@ -6184,11 +6327,11 @@
6184
6327
  } }))), links: result.links.map(link => (Object.assign(Object.assign({}, link), { start: { x: link.start.x + startX, y: link.start.y + startY }, end: { x: link.end.x + startX, y: link.end.y + startY }, points: link.points.map(point => ({ x: point.x + startX, y: point.y + startY })) }))) });
6185
6328
  };
6186
6329
  const buildRichContent = (contentText, spec, overrides) => {
6187
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
6188
- const fontSize = Number((_d = (_a = overrides === null || overrides === void 0 ? void 0 : overrides.fontSize) !== null && _a !== void 0 ? _a : (_c = (_b = spec.content) === null || _b === void 0 ? void 0 : _b.style) === null || _c === void 0 ? void 0 : _c.fontSize) !== null && _d !== void 0 ? _d : 18);
6189
- const lineHeight = Number((_h = (_e = overrides === null || overrides === void 0 ? void 0 : overrides.lineHeight) !== null && _e !== void 0 ? _e : (_g = (_f = spec.content) === null || _f === void 0 ? void 0 : _f.style) === null || _g === void 0 ? void 0 : _g.lineHeight) !== null && _h !== void 0 ? _h : 26);
6190
- const fill = (_m = (_j = overrides === null || overrides === void 0 ? void 0 : overrides.fill) !== null && _j !== void 0 ? _j : (_l = (_k = spec.content) === null || _k === void 0 ? void 0 : _k.style) === null || _l === void 0 ? void 0 : _l.fill) !== null && _m !== void 0 ? _m : '#596173';
6191
- const align = (_o = overrides === null || overrides === void 0 ? void 0 : overrides.align) !== null && _o !== void 0 ? _o : 'left';
6330
+ var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
6331
+ const fontSize = Number((_e = (_a = overrides === null || overrides === void 0 ? void 0 : overrides.fontSize) !== null && _a !== void 0 ? _a : (_c = (_b = spec.content) === null || _b === void 0 ? void 0 : _b.style) === null || _c === void 0 ? void 0 : _c.fontSize) !== null && _e !== void 0 ? _e : 18);
6332
+ const lineHeight = Number((_j = (_f = overrides === null || overrides === void 0 ? void 0 : overrides.lineHeight) !== null && _f !== void 0 ? _f : (_h = (_g = spec.content) === null || _g === void 0 ? void 0 : _g.style) === null || _h === void 0 ? void 0 : _h.lineHeight) !== null && _j !== void 0 ? _j : 26);
6333
+ const fill = (_o = (_k = overrides === null || overrides === void 0 ? void 0 : overrides.fill) !== null && _k !== void 0 ? _k : (_m = (_l = spec.content) === null || _l === void 0 ? void 0 : _l.style) === null || _m === void 0 ? void 0 : _m.fill) !== null && _o !== void 0 ? _o : '#596173';
6334
+ const align = (_p = overrides === null || overrides === void 0 ? void 0 : overrides.align) !== null && _p !== void 0 ? _p : 'left';
6192
6335
  return {
6193
6336
  type: 'rich',
6194
6337
  text: contentText.reduce((result, paragraph, index) => {
@@ -6291,8 +6434,6 @@
6291
6434
  return d;
6292
6435
  };
6293
6436
 
6294
- const CLOCK_CENTER_RADIUS_RATIO = 0.6;
6295
- const CLOCK_CENTER_IMAGE_INSET_RATIO = 0.9;
6296
6437
  const CLOCK_ORBIT_RATIO = 0.68;
6297
6438
  const CLOCK_DOT_RATIO = 0.68;
6298
6439
  const CLOCK_TEXT_INNER_RATIO = 0.92;
@@ -6328,81 +6469,6 @@
6328
6469
  y: cy + Math.sin(angle) * r
6329
6470
  });
6330
6471
  const isOnLeftHalf = (angle) => Math.cos(angle) < 0;
6331
- const buildClockCenterImageMark = (spec) => {
6332
- var _a, _b, _c, _e;
6333
- if (((_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.visible) === false) {
6334
- return null;
6335
- }
6336
- const themeColor = getThemeColor(spec);
6337
- const hasImage = !!((_b = spec.centerImage) === null || _b === void 0 ? void 0 : _b.image);
6338
- return {
6339
- type: 'group',
6340
- name: 'storyline-clock-center',
6341
- zIndex: vchart.LayoutZIndex.Mark + 2,
6342
- children: [
6343
- {
6344
- type: 'symbol',
6345
- name: 'storyline-clock-center-halo',
6346
- interactive: false,
6347
- style: {
6348
- x: (_d, ctx) => getClockGeometry(spec, ctx).cx,
6349
- y: (_d, ctx) => getClockGeometry(spec, ctx).cy,
6350
- size: (_d, ctx) => {
6351
- const g = getClockGeometry(spec, ctx);
6352
- return g.R * CLOCK_CENTER_RADIUS_RATIO * 2.16;
6353
- },
6354
- symbolType: 'circle',
6355
- fill: withAlpha(themeColor, 0.28),
6356
- stroke: 'transparent'
6357
- }
6358
- },
6359
- hasImage
6360
- ? {
6361
- type: 'image',
6362
- name: 'storyline-clock-center-image',
6363
- interactive: false,
6364
- style: Object.assign({ x: (_d, ctx) => {
6365
- const g = getClockGeometry(spec, ctx);
6366
- return g.cx - g.R * CLOCK_CENTER_RADIUS_RATIO * CLOCK_CENTER_IMAGE_INSET_RATIO;
6367
- }, y: (_d, ctx) => {
6368
- const g = getClockGeometry(spec, ctx);
6369
- return g.cy - g.R * CLOCK_CENTER_RADIUS_RATIO * CLOCK_CENTER_IMAGE_INSET_RATIO;
6370
- }, width: (_d, ctx) => getClockGeometry(spec, ctx).R * CLOCK_CENTER_RADIUS_RATIO * CLOCK_CENTER_IMAGE_INSET_RATIO * 2, height: (_d, ctx) => getClockGeometry(spec, ctx).R * CLOCK_CENTER_RADIUS_RATIO * CLOCK_CENTER_IMAGE_INSET_RATIO * 2, image: (_c = spec.centerImage) === null || _c === void 0 ? void 0 : _c.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'cover', imagePosition: 'center', cornerRadius: (_d, ctx) => getClockGeometry(spec, ctx).R * CLOCK_CENTER_RADIUS_RATIO * CLOCK_CENTER_IMAGE_INSET_RATIO, anchor: (_d, ctx) => {
6371
- const g = getClockGeometry(spec, ctx);
6372
- return [g.cx, g.cy];
6373
- }, dx: (_d, ctx) => {
6374
- var _a, _b;
6375
- const g = getClockGeometry(spec, ctx);
6376
- const rectW = g.R * CLOCK_CENTER_RADIUS_RATIO * CLOCK_CENTER_IMAGE_INSET_RATIO * 2;
6377
- const userWidth = (_b = (_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.width;
6378
- const w = typeof userWidth === 'number' ? userWidth : rectW;
6379
- return (rectW - w) / 2;
6380
- }, dy: (_d, ctx) => {
6381
- var _a, _b;
6382
- const g = getClockGeometry(spec, ctx);
6383
- const rectH = g.R * CLOCK_CENTER_RADIUS_RATIO * CLOCK_CENTER_IMAGE_INSET_RATIO * 2;
6384
- const userHeight = (_b = (_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.height;
6385
- const h = typeof userHeight === 'number' ? userHeight : rectH;
6386
- return (rectH - h) / 2;
6387
- } }, (_e = spec.centerImage) === null || _e === void 0 ? void 0 : _e.style)
6388
- }
6389
- : {
6390
- type: 'symbol',
6391
- name: 'storyline-clock-center-placeholder',
6392
- interactive: false,
6393
- style: {
6394
- x: (_d, ctx) => getClockGeometry(spec, ctx).cx,
6395
- y: (_d, ctx) => getClockGeometry(spec, ctx).cy,
6396
- size: (_d, ctx) => getClockGeometry(spec, ctx).R * CLOCK_CENTER_RADIUS_RATIO * 2,
6397
- symbolType: 'circle',
6398
- fill: '#ffffff',
6399
- stroke: themeColor,
6400
- lineWidth: 2
6401
- }
6402
- }
6403
- ].filter(Boolean)
6404
- };
6405
- };
6406
6472
  const buildClockArcMark = (spec) => {
6407
6473
  const themeColor = getThemeColor(spec);
6408
6474
  const orbitPath = (_d, ctx) => {
@@ -6466,11 +6532,13 @@
6466
6532
  return { x: innerPoint.x, y: innerPoint.y, width, onLeft, anchorY: innerPoint.y };
6467
6533
  };
6468
6534
  const buildClockBlockMark = (spec, block, index) => {
6469
- var _a, _b, _c;
6535
+ var _a, _b, _c, _e;
6470
6536
  const hasImage = !!block.image;
6471
6537
  const themeColor = getThemeColor(spec);
6472
6538
  const showImageBackground = shouldShowImageBackground(spec);
6473
6539
  const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
6540
+ const getTitleFontSize = (ctx) => resolveTitleFontSize(spec, ctx, block.title, getClockTextRect(spec, ctx, index).width, CLOCK_TITLE_FONT_SIZE, [8, 30]);
6541
+ const getTitleLineHeight = (ctx) => { var _a; return resolveAdaptiveLineHeight(getTitleFontSize(ctx), (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style, CLOCK_TITLE_LINE_HEIGHT, 1.28); };
6474
6542
  const leadPath = (_d, ctx) => {
6475
6543
  const { start, end } = getClockLeadLine(spec, ctx, index);
6476
6544
  return `M ${start.x.toFixed(2)} ${start.y.toFixed(2)} L ${end.x.toFixed(2)} ${end.y.toFixed(2)}`;
@@ -6494,41 +6562,17 @@
6494
6562
  type: 'symbol',
6495
6563
  name: `storyline-clock-dot-bg-${index}`,
6496
6564
  interactive: false,
6497
- style: {
6498
- x: (_d, ctx) => getClockDotCenter(spec, ctx, index).x,
6499
- y: (_d, ctx) => getClockDotCenter(spec, ctx, index).y,
6500
- size: (_d, ctx) => getClockDotCenter(spec, ctx, index).diameter + 10,
6501
- symbolType: 'circle',
6502
- fill: '#ffffff',
6503
- stroke: themeColor,
6504
- lineWidth: 2
6505
- }
6565
+ style: Object.assign({ x: (_d, ctx) => getClockDotCenter(spec, ctx, index).x, y: (_d, ctx) => getClockDotCenter(spec, ctx, index).y, size: (_d, ctx) => getClockDotCenter(spec, ctx, index).diameter + 10, symbolType: 'circle' }, getImageBackgroundStyle(spec))
6506
6566
  }
6507
6567
  : null,
6508
6568
  hasImage
6509
- ? {
6510
- type: 'image',
6511
- name: `storyline-clock-dot-${index}`,
6512
- interactive: false,
6513
- style: {
6514
- x: (_d, ctx) => {
6569
+ ? Object.assign(Object.assign({ type: 'image', name: `storyline-clock-dot-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_d, ctx) => {
6515
6570
  const dot = getClockDotCenter(spec, ctx, index);
6516
6571
  return dot.x - dot.diameter / 2;
6517
- },
6518
- y: (_d, ctx) => {
6572
+ }, y: (_d, ctx) => {
6519
6573
  const dot = getClockDotCenter(spec, ctx, index);
6520
6574
  return dot.y - dot.diameter / 2;
6521
- },
6522
- width: (_d, ctx) => getClockDotCenter(spec, ctx, index).diameter,
6523
- height: (_d, ctx) => getClockDotCenter(spec, ctx, index).diameter,
6524
- image: block.image,
6525
- repeatX: 'no-repeat',
6526
- repeatY: 'no-repeat',
6527
- imageMode: 'cover',
6528
- imagePosition: 'center',
6529
- cornerRadius: (_d, ctx) => getClockDotCenter(spec, ctx, index).diameter / 2
6530
- }
6531
- }
6575
+ }, width: (_d, ctx) => getClockDotCenter(spec, ctx, index).diameter, height: (_d, ctx) => getClockDotCenter(spec, ctx, index).diameter, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'contain', imagePosition: 'center', cornerRadius: (_d, ctx) => getClockDotCenter(spec, ctx, index).diameter / 2 }, (_a = spec.image) === null || _a === void 0 ? void 0 : _a.style) })
6532
6576
  : {
6533
6577
  type: 'symbol',
6534
6578
  name: `storyline-clock-dot-${index}`,
@@ -6544,15 +6588,15 @@
6544
6588
  }
6545
6589
  },
6546
6590
  block.title
6547
- ? Object.assign(Object.assign({ type: 'text', name: `storyline-clock-title-${index}`, interactive: false }, spec.title), { style: Object.assign({ x: (_d, ctx) => getClockTextRect(spec, ctx, index).x, y: (_d, ctx) => getClockTextRect(spec, ctx, index).anchorY - CLOCK_TITLE_LINE_HEIGHT, text: block.title, maxLineWidth: (_d, ctx) => getClockTextRect(spec, ctx, index).width, fontSize: CLOCK_TITLE_FONT_SIZE, lineHeight: CLOCK_TITLE_LINE_HEIGHT, fontWeight: 'bold', fill: themeColor, stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: (_d, ctx) => getClockTextRect(spec, ctx, index).onLeft ? 'right' : 'left', textBaseline: 'top' }, (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style) })
6591
+ ? Object.assign(Object.assign({ type: 'text', name: `storyline-clock-title-${index}`, interactive: false }, spec.title), { style: Object.assign({ x: (_d, ctx) => getClockTextRect(spec, ctx, index).x, y: (_d, ctx) => getClockTextRect(spec, ctx, index).anchorY - getTitleLineHeight(ctx), text: block.title, maxLineWidth: (_d, ctx) => getClockTextRect(spec, ctx, index).width, fontSize: (_d, ctx) => getTitleFontSize(ctx), lineHeight: (_d, ctx) => getTitleLineHeight(ctx), fontWeight: 'bold', fill: themeColor, stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: (_d, ctx) => getClockTextRect(spec, ctx, index).onLeft ? 'right' : 'left', textBaseline: 'top' }, (_b = spec.title) === null || _b === void 0 ? void 0 : _b.style) })
6548
6592
  : null,
6549
6593
  contentText.length
6550
- ? Object.assign(Object.assign({ type: 'text', name: `storyline-clock-content-${index}`, interactive: false }, spec.content), { textType: 'rich', style: Object.assign({ x: (_d, ctx) => getClockTextRect(spec, ctx, index).x, y: (_d, ctx) => getClockTextRect(spec, ctx, index).anchorY + 4, width: (_d, ctx) => getClockTextRect(spec, ctx, index).width, maxLineWidth: (_d, ctx) => getClockTextRect(spec, ctx, index).width, text: buildRichContent(contentText, spec), fontSize: CLOCK_CONTENT_FONT_SIZE, lineHeight: CLOCK_CONTENT_LINE_HEIGHT, fill: '#3a3f4d', textAlign: (_d, ctx) => getClockTextRect(spec, ctx, index).onLeft ? 'right' : 'left', textBaseline: 'top', wordBreak: 'break-word' }, (_b = spec.content) === null || _b === void 0 ? void 0 : _b.style) })
6594
+ ? Object.assign(Object.assign({ type: 'text', name: `storyline-clock-content-${index}`, interactive: false }, spec.content), { textType: 'rich', style: Object.assign({ x: (_d, ctx) => getClockTextRect(spec, ctx, index).x, y: (_d, ctx) => getClockTextRect(spec, ctx, index).anchorY + 4, width: (_d, ctx) => getClockTextRect(spec, ctx, index).width, maxLineWidth: (_d, ctx) => getClockTextRect(spec, ctx, index).width, text: buildRichContent(contentText, spec), fontSize: CLOCK_CONTENT_FONT_SIZE, lineHeight: CLOCK_CONTENT_LINE_HEIGHT, fill: '#3a3f4d', textAlign: (_d, ctx) => getClockTextRect(spec, ctx, index).onLeft ? 'right' : 'left', textBaseline: 'top', wordBreak: 'break-word' }, (_c = spec.content) === null || _c === void 0 ? void 0 : _c.style) })
6551
6595
  : null
6552
6596
  ];
6553
6597
  return {
6554
6598
  type: 'group',
6555
- id: `storyline-block-${(_c = block.id) !== null && _c !== void 0 ? _c : index}`,
6599
+ id: `storyline-block-${(_e = block.id) !== null && _e !== void 0 ? _e : index}`,
6556
6600
  name: `storyline-block-${index}`,
6557
6601
  zIndex: vchart.LayoutZIndex.Mark + 1,
6558
6602
  children: children.filter(Boolean)
@@ -6582,7 +6626,7 @@
6582
6626
  };
6583
6627
  };
6584
6628
  const getDefaultBlockMetrics = (spec, ctx, index) => {
6585
- 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;
6629
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
6586
6630
  const block = getLayout(spec, ctx).blocks[index];
6587
6631
  const padding = normalizePadding((_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.padding) !== null && _b !== void 0 ? _b : 12);
6588
6632
  const imagePosition = (_d = (_c = spec.image) === null || _c === void 0 ? void 0 : _c.position) !== null && _d !== void 0 ? _d : 'top';
@@ -6590,19 +6634,21 @@
6590
6634
  const imageHeight = (_h = (_g = spec.image) === null || _g === void 0 ? void 0 : _g.height) !== null && _h !== void 0 ? _h : DEFAULT_IMAGE_HEIGHT;
6591
6635
  const imageGap = (_k = (_j = spec.image) === null || _j === void 0 ? void 0 : _j.gap) !== null && _k !== void 0 ? _k : DEFAULT_IMAGE_GAP;
6592
6636
  const hasImage = !!((_m = (_l = spec.data) === null || _l === void 0 ? void 0 : _l[index]) === null || _m === void 0 ? void 0 : _m.image);
6593
- const titleFontSize = Number((_q = (_p = (_o = spec.title) === null || _o === void 0 ? void 0 : _o.style) === null || _p === void 0 ? void 0 : _p.fontSize) !== null && _q !== void 0 ? _q : 18);
6594
- const titleLineHeight = Number((_t = (_s = (_r = spec.title) === null || _r === void 0 ? void 0 : _r.style) === null || _s === void 0 ? void 0 : _s.lineHeight) !== null && _t !== void 0 ? _t : Math.round(titleFontSize * 1.35));
6595
- const titleHeight = ((_v = (_u = spec.data) === null || _u === void 0 ? void 0 : _u[index]) === null || _v === void 0 ? void 0 : _v.title) ? titleLineHeight : 0;
6596
- const blockWidth = (_w = block === null || block === void 0 ? void 0 : block.width) !== null && _w !== void 0 ? _w : resolveBlockWidth(spec, 0);
6597
- const blockHeight = (_z = (_x = block === null || block === void 0 ? void 0 : block.height) !== null && _x !== void 0 ? _x : (_y = spec.block) === null || _y === void 0 ? void 0 : _y.height) !== null && _z !== void 0 ? _z : DEFAULT_BLOCK_HEIGHT;
6637
+ const blockWidth = (_o = block === null || block === void 0 ? void 0 : block.width) !== null && _o !== void 0 ? _o : resolveBlockWidth(spec, 0);
6638
+ const blockHeight = (_r = (_p = block === null || block === void 0 ? void 0 : block.height) !== null && _p !== void 0 ? _p : (_q = spec.block) === null || _q === void 0 ? void 0 : _q.height) !== null && _r !== void 0 ? _r : DEFAULT_BLOCK_HEIGHT;
6598
6639
  const imageBox = getImageBox(imagePosition, blockWidth, blockHeight, padding, imageWidth, imageHeight, imageGap, hasImage);
6599
6640
  const textBox = getTextBox(imagePosition, blockWidth, blockHeight, padding, imageWidth, imageHeight, imageGap, hasImage);
6600
- const contentGap = ((_1 = (_0 = spec.data) === null || _0 === void 0 ? void 0 : _0[index]) === null || _1 === void 0 ? void 0 : _1.title) ? 8 : 0;
6641
+ const titleFontSize = resolveTitleFontSize(spec, ctx, (_t = (_s = spec.data) === null || _s === void 0 ? void 0 : _s[index]) === null || _t === void 0 ? void 0 : _t.title, textBox.width, 18, [8, 28]);
6642
+ const titleLineHeight = resolveAdaptiveLineHeight(titleFontSize, (_u = spec.title) === null || _u === void 0 ? void 0 : _u.style, Math.round(18 * 1.35));
6643
+ const titleHeight = ((_w = (_v = spec.data) === null || _v === void 0 ? void 0 : _v[index]) === null || _w === void 0 ? void 0 : _w.title) ? titleLineHeight : 0;
6644
+ const contentGap = ((_y = (_x = spec.data) === null || _x === void 0 ? void 0 : _x[index]) === null || _y === void 0 ? void 0 : _y.title) ? 8 : 0;
6601
6645
  return {
6602
6646
  block: {
6603
6647
  width: blockWidth,
6604
6648
  height: blockHeight
6605
6649
  },
6650
+ titleFontSize,
6651
+ titleLineHeight,
6606
6652
  imageBox,
6607
6653
  textBox,
6608
6654
  contentBox: {
@@ -6612,15 +6658,12 @@
6612
6658
  };
6613
6659
  };
6614
6660
  const buildDefaultBlockMark = (spec, block, index) => {
6615
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
6661
+ var _a, _b, _c, _d, _e, _f, _g;
6616
6662
  const hasImage = !!block.image;
6617
6663
  const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
6618
- const titleFontSize = Number((_c = (_b = (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.fontSize) !== null && _c !== void 0 ? _c : 18);
6619
- const titleLineHeight = Number((_f = (_e = (_d = spec.title) === null || _d === void 0 ? void 0 : _d.style) === null || _e === void 0 ? void 0 : _e.lineHeight) !== null && _f !== void 0 ? _f : Math.round(titleFontSize * 1.35));
6620
- const themeColor = getThemeColor(spec);
6621
6664
  return {
6622
6665
  type: 'group',
6623
- id: `storyline-block-${(_g = block.id) !== null && _g !== void 0 ? _g : index}`,
6666
+ id: `storyline-block-${(_a = block.id) !== null && _a !== void 0 ? _a : index}`,
6624
6667
  name: `storyline-block-${index}`,
6625
6668
  zIndex: vchart.LayoutZIndex.Mark + 1,
6626
6669
  style: {
@@ -6630,12 +6673,12 @@
6630
6673
  height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).block.height
6631
6674
  },
6632
6675
  children: [
6633
- ((_h = spec.block) === null || _h === void 0 ? void 0 : _h.showBackground) === true
6676
+ ((_b = spec.block) === null || _b === void 0 ? void 0 : _b.showBackground) === true
6634
6677
  ? {
6635
6678
  type: 'rect',
6636
6679
  name: `storyline-block-bg-${index}`,
6637
6680
  interactive: false,
6638
- style: Object.assign({ x: 0, y: 0, width: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).block.width, height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).block.height, cornerRadius: 8, fill: '#ffffff', stroke: '#d7dce5', lineWidth: 1, shadowBlur: 6, shadowColor: 'rgba(0, 0, 0, 0.08)' }, (_j = spec.block) === null || _j === void 0 ? void 0 : _j.style)
6681
+ style: Object.assign({ x: 0, y: 0, width: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).block.width, height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).block.height, cornerRadius: 8, fill: '#ffffff', stroke: '#d7dce5', lineWidth: 1, shadowBlur: 6, shadowColor: 'rgba(0, 0, 0, 0.08)' }, (_c = spec.block) === null || _c === void 0 ? void 0 : _c.style)
6639
6682
  }
6640
6683
  : null,
6641
6684
  shouldShowImageBackground(spec)
@@ -6643,21 +6686,21 @@
6643
6686
  type: 'rect',
6644
6687
  name: `storyline-block-image-bg-${index}`,
6645
6688
  interactive: false,
6646
- style: Object.assign({ x: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.x, y: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.y, width: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.width, height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.height, cornerRadius: 8, fill: '#ffffff', stroke: themeColor, lineWidth: 2 }, (_k = spec.block) === null || _k === void 0 ? void 0 : _k.style)
6689
+ style: Object.assign(Object.assign({ x: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.x, y: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.y, width: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.width, height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.height, cornerRadius: 8 }, getImageBackgroundStyle(spec)), (_d = spec.block) === null || _d === void 0 ? void 0 : _d.style)
6647
6690
  }
6648
6691
  : null,
6649
6692
  hasImage
6650
- ? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.x, y: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.y, width: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.width, height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.height, image: block.image }, (_l = spec.image) === null || _l === void 0 ? void 0 : _l.style) })
6693
+ ? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.x, y: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.y, width: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.width, height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.height, image: block.image }, (_e = spec.image) === null || _e === void 0 ? void 0 : _e.style) })
6651
6694
  : null,
6652
6695
  block.title
6653
- ? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, spec.title), { style: Object.assign({ x: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.x, y: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.y, text: block.title, maxLineWidth: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.width, fontSize: titleFontSize, lineHeight: titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: 'left', textBaseline: 'top' }, (_m = spec.title) === null || _m === void 0 ? void 0 : _m.style) })
6696
+ ? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, spec.title), { style: Object.assign({ x: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.x, y: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.y, text: block.title, maxLineWidth: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.width, fontSize: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).titleFontSize, lineHeight: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: 'left', textBaseline: 'top' }, (_f = spec.title) === null || _f === void 0 ? void 0 : _f.style) })
6654
6697
  : null,
6655
6698
  contentText.length
6656
6699
  ? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), { textType: 'rich', style: Object.assign({ x: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.x, y: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).contentBox.y, width: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.width, text: buildRichContent(contentText, spec, {
6657
6700
  fontSize: 18,
6658
6701
  lineHeight: 26,
6659
6702
  fill: '#596173'
6660
- }), maxLineWidth: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.width, heightLimit: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).contentBox.height, textAlign: 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_o = spec.content) === null || _o === void 0 ? void 0 : _o.style) })
6703
+ }), maxLineWidth: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.width, heightLimit: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).contentBox.height, textAlign: 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_g = spec.content) === null || _g === void 0 ? void 0 : _g.style) })
6661
6704
  : null
6662
6705
  ].filter(Boolean)
6663
6706
  };
@@ -6777,14 +6820,14 @@
6777
6820
  ]
6778
6821
  };
6779
6822
  };
6780
- const getLandscapeMetrics = (spec, blockWidth, blockHeight, index) => {
6781
- var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
6823
+ const getLandscapeMetrics = (spec, blockWidth, blockHeight, index, ctx) => {
6824
+ var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
6782
6825
  const padding = normalizePadding((_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.padding) !== null && _b !== void 0 ? _b : 12);
6783
- const titleFontSize = Number((_f = (_e = (_c = spec.title) === null || _c === void 0 ? void 0 : _c.style) === null || _e === void 0 ? void 0 : _e.fontSize) !== null && _f !== void 0 ? _f : 26);
6784
- const titleLineHeight = Number((_j = (_h = (_g = spec.title) === null || _g === void 0 ? void 0 : _g.style) === null || _h === void 0 ? void 0 : _h.lineHeight) !== null && _j !== void 0 ? _j : Math.max(LANDSCAPE_TITLE_LINE_HEIGHT, Math.round(titleFontSize * 1.35)));
6785
- const contentFontSize = Number((_m = (_l = (_k = spec.content) === null || _k === void 0 ? void 0 : _k.style) === null || _l === void 0 ? void 0 : _l.fontSize) !== null && _m !== void 0 ? _m : LANDSCAPE_CONTENT_FONT_SIZE);
6786
- const contentLineHeight = Number((_q = (_p = (_o = spec.content) === null || _o === void 0 ? void 0 : _o.style) === null || _p === void 0 ? void 0 : _p.lineHeight) !== null && _q !== void 0 ? _q : LANDSCAPE_CONTENT_LINE_HEIGHT);
6787
- const imageHeight = Math.max((_s = (_r = spec.image) === null || _r === void 0 ? void 0 : _r.height) !== null && _s !== void 0 ? _s : Math.round(blockHeight * LANDSCAPE_IMAGE_HEIGHT_RATIO), titleLineHeight + padding.top + padding.bottom);
6826
+ const titleFontSize = resolveTitleFontSize(spec, ctx, (_e = (_c = spec.data) === null || _c === void 0 ? void 0 : _c[index]) === null || _e === void 0 ? void 0 : _e.title, blockWidth, 26, [8, 34]);
6827
+ const titleLineHeight = resolveAdaptiveLineHeight(titleFontSize, (_f = spec.title) === null || _f === void 0 ? void 0 : _f.style, LANDSCAPE_TITLE_LINE_HEIGHT);
6828
+ const contentFontSize = Number((_j = (_h = (_g = spec.content) === null || _g === void 0 ? void 0 : _g.style) === null || _h === void 0 ? void 0 : _h.fontSize) !== null && _j !== void 0 ? _j : LANDSCAPE_CONTENT_FONT_SIZE);
6829
+ const contentLineHeight = Number((_m = (_l = (_k = spec.content) === null || _k === void 0 ? void 0 : _k.style) === null || _l === void 0 ? void 0 : _l.lineHeight) !== null && _m !== void 0 ? _m : LANDSCAPE_CONTENT_LINE_HEIGHT);
6830
+ const imageHeight = Math.max((_p = (_o = spec.image) === null || _o === void 0 ? void 0 : _o.height) !== null && _p !== void 0 ? _p : Math.round(blockHeight * LANDSCAPE_IMAGE_HEIGHT_RATIO), titleLineHeight + padding.top + padding.bottom);
6788
6831
  const connectorGap = LANDSCAPE_DETACHED_GAP;
6789
6832
  const canvasHeight = spec.height;
6790
6833
  const contentHeight = canvasHeight
@@ -6855,27 +6898,25 @@
6855
6898
  };
6856
6899
  };
6857
6900
  const buildLandscapeBlockMark = (spec, block, index) => {
6858
- var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
6901
+ var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m;
6859
6902
  const hasImage = !!block.image;
6860
6903
  const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
6861
- const titleFontSize = Number((_c = (_b = (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.fontSize) !== null && _c !== void 0 ? _c : 26);
6862
- const titleLineHeight = Number((_g = (_f = (_e = spec.title) === null || _e === void 0 ? void 0 : _e.style) === null || _f === void 0 ? void 0 : _f.lineHeight) !== null && _g !== void 0 ? _g : Math.round(titleFontSize * 1.35));
6863
6904
  const getMetrics = (ctx) => {
6864
6905
  var _a, _b, _c, _e;
6865
6906
  const layoutBlock = getLayout(spec, ctx).blocks[index];
6866
6907
  const w = (_a = layoutBlock === null || layoutBlock === void 0 ? void 0 : layoutBlock.width) !== null && _a !== void 0 ? _a : resolveBlockWidth(spec, 0);
6867
6908
  const h = (_e = (_b = layoutBlock === null || layoutBlock === void 0 ? void 0 : layoutBlock.height) !== null && _b !== void 0 ? _b : (_c = spec.block) === null || _c === void 0 ? void 0 : _c.height) !== null && _e !== void 0 ? _e : DEFAULT_BLOCK_HEIGHT;
6868
- return getLandscapeMetrics(spec, w, h, index);
6909
+ return getLandscapeMetrics(spec, w, h, index, ctx);
6869
6910
  };
6870
- const blockStyle = (_j = (_h = spec.block) === null || _h === void 0 ? void 0 : _h.style) !== null && _j !== void 0 ? _j : {};
6871
- const lineStyle = (_l = (_k = spec.line) === null || _k === void 0 ? void 0 : _k.style) !== null && _l !== void 0 ? _l : {};
6911
+ const blockStyle = (_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.style) !== null && _b !== void 0 ? _b : {};
6912
+ const lineStyle = (_e = (_c = spec.line) === null || _c === void 0 ? void 0 : _c.style) !== null && _e !== void 0 ? _e : {};
6872
6913
  const themeColor = getThemeColor(spec);
6873
- const connectorStroke = (_m = lineStyle.stroke) !== null && _m !== void 0 ? _m : themeColor;
6874
- const connectorLineWidth = (_o = lineStyle.lineWidth) !== null && _o !== void 0 ? _o : 2;
6875
- const connectorDash = (_p = lineStyle.lineDash) !== null && _p !== void 0 ? _p : [4, 4];
6914
+ const connectorStroke = (_f = lineStyle.stroke) !== null && _f !== void 0 ? _f : themeColor;
6915
+ const connectorLineWidth = (_g = lineStyle.lineWidth) !== null && _g !== void 0 ? _g : 2;
6916
+ const connectorDash = (_h = lineStyle.lineDash) !== null && _h !== void 0 ? _h : [4, 4];
6876
6917
  return {
6877
6918
  type: 'group',
6878
- id: `storyline-block-${(_q = block.id) !== null && _q !== void 0 ? _q : index}`,
6919
+ id: `storyline-block-${(_j = block.id) !== null && _j !== void 0 ? _j : index}`,
6879
6920
  name: `storyline-block-${index}`,
6880
6921
  zIndex: vchart.LayoutZIndex.Mark + 1,
6881
6922
  style: {
@@ -6902,11 +6943,11 @@
6902
6943
  type: 'rect',
6903
6944
  name: `storyline-block-image-bg-${index}`,
6904
6945
  interactive: false,
6905
- style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).imageBox.x, y: (_d, ctx) => getMetrics(ctx).imageBox.y, width: (_d, ctx) => getMetrics(ctx).imageBox.width, height: (_d, ctx) => getMetrics(ctx).imageBox.height, cornerRadius: 8, fill: '#ffffff', stroke: themeColor, lineWidth: 2 }, blockStyle)
6946
+ style: Object.assign(Object.assign({ x: (_d, ctx) => getMetrics(ctx).imageBox.x, y: (_d, ctx) => getMetrics(ctx).imageBox.y, width: (_d, ctx) => getMetrics(ctx).imageBox.width, height: (_d, ctx) => getMetrics(ctx).imageBox.height, cornerRadius: 8 }, getImageBackgroundStyle(spec)), blockStyle)
6906
6947
  }
6907
6948
  : null,
6908
6949
  hasImage
6909
- ? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).imageBox.x, y: (_d, ctx) => getMetrics(ctx).imageBox.y, width: (_d, ctx) => getMetrics(ctx).imageBox.width, height: (_d, ctx) => getMetrics(ctx).imageBox.height, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'cover', imagePosition: 'center' }, (_r = spec.image) === null || _r === void 0 ? void 0 : _r.style) })
6950
+ ? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).imageBox.x, y: (_d, ctx) => getMetrics(ctx).imageBox.y, width: (_d, ctx) => getMetrics(ctx).imageBox.width, height: (_d, ctx) => getMetrics(ctx).imageBox.height, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'contain', imagePosition: 'center' }, (_k = spec.image) === null || _k === void 0 ? void 0 : _k.style) })
6910
6951
  : null,
6911
6952
  {
6912
6953
  type: 'path',
@@ -6932,26 +6973,26 @@
6932
6973
  }
6933
6974
  },
6934
6975
  block.title
6935
- ? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, spec.title), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).textBox.x, y: (_d, ctx) => getMetrics(ctx).textBox.y, text: block.title, maxLineWidth: (_d, ctx) => getMetrics(ctx).textBox.width, fontSize: titleFontSize, lineHeight: titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: 'left', textBaseline: 'top' }, (_s = spec.title) === null || _s === void 0 ? void 0 : _s.style) })
6976
+ ? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, spec.title), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).textBox.x, y: (_d, ctx) => getMetrics(ctx).textBox.y, text: block.title, maxLineWidth: (_d, ctx) => getMetrics(ctx).textBox.width, fontSize: (_d, ctx) => getMetrics(ctx).titleFontSize, lineHeight: (_d, ctx) => getMetrics(ctx).titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: 'left', textBaseline: 'top' }, (_l = spec.title) === null || _l === void 0 ? void 0 : _l.style) })
6936
6977
  : null,
6937
6978
  contentText.length
6938
6979
  ? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), { textType: 'rich', style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).contentBox.x, y: (_d, ctx) => getMetrics(ctx).contentBox.y, width: (_d, ctx) => getMetrics(ctx).contentBox.width, height: (_d, ctx) => getMetrics(ctx).contentBox.height, maxLineWidth: (_d, ctx) => getMetrics(ctx).contentBox.width, heightLimit: (_d, ctx) => getMetrics(ctx).contentBox.height, text: buildRichContent(contentText, spec, {
6939
6980
  fontSize: LANDSCAPE_CONTENT_FONT_SIZE,
6940
6981
  lineHeight: LANDSCAPE_CONTENT_LINE_HEIGHT,
6941
6982
  fill: '#596173'
6942
- }), textAlign: 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_t = spec.content) === null || _t === void 0 ? void 0 : _t.style) })
6983
+ }), textAlign: 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_m = spec.content) === null || _m === void 0 ? void 0 : _m.style) })
6943
6984
  : null
6944
6985
  ].filter(Boolean)
6945
6986
  };
6946
6987
  };
6947
6988
 
6948
6989
  const PORTRAIT_AXIS_WIDTH = 96;
6949
- const PORTRAIT_AXIS_PADDING = 50;
6990
+ const PORTRAIT_AXIS_PADDING = 120;
6950
6991
  const PORTRAIT_MARKER_FONT_SIZE = 40;
6951
6992
  const PORTRAIT_MARKER_LINE_HEIGHT = 28;
6952
6993
  const PORTRAIT_MARKER_AXIS_PADDING = 6;
6953
6994
  const PORTRAIT_IMAGE_HEIGHT_RATIO = 0.6;
6954
- const PORTRAIT_CONTENT_HEIGHT_RATIO = 1;
6995
+ const PORTRAIT_CONTENT_HEIGHT_RATIO = 1.25;
6955
6996
  const PORTRAIT_IMAGE_GAP_FROM_AXIS = 24;
6956
6997
  const PORTRAIT_SHADOW_OFFSET_X = 24;
6957
6998
  const PORTRAIT_SHADOW_OFFSET_Y = 16;
@@ -6962,27 +7003,10 @@
6962
7003
  const PORTRAIT_CONTENT_LINE_HEIGHT = 26;
6963
7004
  const PORTRAIT_CONTENT_FONT_SIZE = 18;
6964
7005
  const PORTRAIT_TITLE_TO_CONTENT_GAP = 4;
6965
- const getPortraitAxisRect = (spec, ctx) => {
6966
- const blocks = getLayout(spec, ctx).blocks;
6967
- if (!blocks.length) {
6968
- return { x: 0, y: 0, width: 0, height: 0 };
6969
- }
6970
- const firstCy = blocks[0].center.y;
6971
- const lastCy = blocks[blocks.length - 1].center.y;
6972
- const top = Math.min(firstCy, lastCy);
6973
- const bottom = Math.max(firstCy, lastCy);
6974
- const cx = blocks[0].center.x;
6975
- return {
6976
- x: cx - PORTRAIT_AXIS_WIDTH / 2,
6977
- y: top - PORTRAIT_AXIS_PADDING,
6978
- width: PORTRAIT_AXIS_WIDTH,
6979
- height: bottom - top + PORTRAIT_AXIS_PADDING * 2
6980
- };
6981
- };
6982
7006
  const buildPortraitAxisMark = (spec) => {
6983
- var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
6984
- const themeColor = getThemeColor(spec);
6985
- const lineStyle = (_b = (_a = spec.line) === null || _a === void 0 ? void 0 : _a.style) !== null && _b !== void 0 ? _b : {};
7007
+ var _a, _b, _c, _e, _f, _g, _h, _j, _k;
7008
+ const themeColor = (_a = spec.themeColor) !== null && _a !== void 0 ? _a : '#e8543d';
7009
+ const lineStyle = (_c = (_b = spec.line) === null || _b === void 0 ? void 0 : _b.style) !== null && _c !== void 0 ? _c : {};
6986
7010
  const defaultFill = {
6987
7011
  gradient: 'linear',
6988
7012
  x0: 0,
@@ -6994,11 +7018,9 @@
6994
7018
  { offset: 1, color: withAlpha(themeColor, 1) }
6995
7019
  ]
6996
7020
  };
6997
- const markerFontSize = Number((_f = (_e = (_c = spec.marker) === null || _c === void 0 ? void 0 : _c.style) === null || _e === void 0 ? void 0 : _e.fontSize) !== null && _f !== void 0 ? _f : PORTRAIT_MARKER_FONT_SIZE);
6998
- const markerLineHeight = Number((_j = (_h = (_g = spec.marker) === null || _g === void 0 ? void 0 : _g.style) === null || _h === void 0 ? void 0 : _h.lineHeight) !== null && _j !== void 0 ? _j : PORTRAIT_MARKER_LINE_HEIGHT);
6999
- const markerVisible = ((_k = spec.marker) === null || _k === void 0 ? void 0 : _k.visible) !== false;
7021
+ const markerVisible = ((_e = spec.marker) === null || _e === void 0 ? void 0 : _e.visible) !== false;
7000
7022
  const markerMarks = markerVisible
7001
- ? ((_l = spec.data) !== null && _l !== void 0 ? _l : [])
7023
+ ? ((_f = spec.data) !== null && _f !== void 0 ? _f : [])
7002
7024
  .map((block, index) => {
7003
7025
  var _a;
7004
7026
  if (!block.marker) {
@@ -7018,15 +7040,21 @@
7018
7040
  var _a, _b;
7019
7041
  const lb = getLayout(spec, ctx).blocks[index];
7020
7042
  return (_b = (_a = lb === null || lb === void 0 ? void 0 : lb.center) === null || _a === void 0 ? void 0 : _a.y) !== null && _b !== void 0 ? _b : 0;
7021
- }, text: {
7022
- type: 'rich',
7023
- text: block.marker.split('').map((char, i, arr) => ({
7024
- text: char + (i < arr.length - 1 ? '\n' : ''),
7025
- fontSize: markerFontSize,
7026
- lineHeight: markerLineHeight,
7027
- fill: '#fff',
7028
- align: markerTextAlign
7029
- }))
7043
+ }, text: (_d, ctx) => {
7044
+ var _a, _b, _c;
7045
+ const axis = getPortraitAxisRect(spec, ctx);
7046
+ const markerFontSize = resolveMarkerFontSize(spec, ctx, block.marker, axis.height / Math.max((_b = (_a = spec.data) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 1, 1), PORTRAIT_MARKER_FONT_SIZE);
7047
+ const markerLineHeight = resolveAdaptiveLineHeight(markerFontSize, (_c = spec.marker) === null || _c === void 0 ? void 0 : _c.style, PORTRAIT_MARKER_LINE_HEIGHT, 0.9);
7048
+ return {
7049
+ type: 'rich',
7050
+ text: block.marker.split('').map((char, i, arr) => ({
7051
+ text: char + (i < arr.length - 1 ? '\n' : ''),
7052
+ fontSize: markerFontSize,
7053
+ lineHeight: markerLineHeight,
7054
+ fill: '#fff',
7055
+ align: markerTextAlign
7056
+ }))
7057
+ };
7030
7058
  }, fontWeight: 'bold', lineJoin: 'round', shadowColor: 'rgba(0, 0, 0, 0.3)', shadowBlur: 8, shadowOffsetX: 0, shadowOffsetY: 5, textAlign: markerTextAlign, textBaseline: 'middle' }, (_a = spec.marker) === null || _a === void 0 ? void 0 : _a.style) });
7031
7059
  })
7032
7060
  .filter(Boolean)
@@ -7041,10 +7069,10 @@
7041
7069
  name: 'storyline-portrait-axis-rect',
7042
7070
  interactive: false,
7043
7071
  style: {
7044
- fill: (_m = lineStyle.fill) !== null && _m !== void 0 ? _m : defaultFill,
7045
- stroke: (_o = lineStyle.stroke) !== null && _o !== void 0 ? _o : false,
7046
- lineWidth: (_p = lineStyle.lineWidth) !== null && _p !== void 0 ? _p : 0,
7047
- cornerRadius: (_q = lineStyle.cornerRadius) !== null && _q !== void 0 ? _q : 0,
7072
+ fill: (_g = lineStyle.fill) !== null && _g !== void 0 ? _g : defaultFill,
7073
+ stroke: (_h = lineStyle.stroke) !== null && _h !== void 0 ? _h : false,
7074
+ lineWidth: (_j = lineStyle.lineWidth) !== null && _j !== void 0 ? _j : 0,
7075
+ cornerRadius: (_k = lineStyle.cornerRadius) !== null && _k !== void 0 ? _k : 0,
7048
7076
  x: (_d, ctx) => getPortraitAxisRect(spec, ctx).x,
7049
7077
  y: (_d, ctx) => getPortraitAxisRect(spec, ctx).y,
7050
7078
  width: (_d, ctx) => getPortraitAxisRect(spec, ctx).width,
@@ -7055,15 +7083,15 @@
7055
7083
  ]
7056
7084
  };
7057
7085
  };
7058
- const getPortraitMetrics = (spec, blockWidth, blockHeight, index) => {
7059
- var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
7060
- const titleFontSize = Number((_c = (_b = (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.fontSize) !== null && _c !== void 0 ? _c : 26);
7061
- const titleLineHeight = Number((_g = (_f = (_e = spec.title) === null || _e === void 0 ? void 0 : _e.style) === null || _f === void 0 ? void 0 : _f.lineHeight) !== null && _g !== void 0 ? _g : Math.max(PORTRAIT_TITLE_LINE_HEIGHT, Math.round(titleFontSize * 1.35)));
7062
- const contentFontSize = Number((_k = (_j = (_h = spec.content) === null || _h === void 0 ? void 0 : _h.style) === null || _j === void 0 ? void 0 : _j.fontSize) !== null && _k !== void 0 ? _k : PORTRAIT_CONTENT_FONT_SIZE);
7063
- const contentLineHeight = Number((_o = (_m = (_l = spec.content) === null || _l === void 0 ? void 0 : _l.style) === null || _m === void 0 ? void 0 : _m.lineHeight) !== null && _o !== void 0 ? _o : PORTRAIT_CONTENT_LINE_HEIGHT);
7086
+ const getPortraitMetrics = (spec, blockWidth, blockHeight, index, ctx) => {
7087
+ var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
7088
+ const contentFontSize = Number((_c = (_b = (_a = spec.content) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.fontSize) !== null && _c !== void 0 ? _c : PORTRAIT_CONTENT_FONT_SIZE);
7089
+ const contentLineHeight = Number((_g = (_f = (_e = spec.content) === null || _e === void 0 ? void 0 : _e.style) === null || _f === void 0 ? void 0 : _f.lineHeight) !== null && _g !== void 0 ? _g : PORTRAIT_CONTENT_LINE_HEIGHT);
7064
7090
  const titleToContentGap = PORTRAIT_TITLE_TO_CONTENT_GAP;
7065
- const imageWidth = (_q = (_p = spec.image) === null || _p === void 0 ? void 0 : _p.width) !== null && _q !== void 0 ? _q : Math.max(blockWidth, 80);
7066
- const imageHeight = (_s = (_r = spec.image) === null || _r === void 0 ? void 0 : _r.height) !== null && _s !== void 0 ? _s : Math.round(blockHeight * PORTRAIT_IMAGE_HEIGHT_RATIO);
7091
+ const imageWidth = (_j = (_h = spec.image) === null || _h === void 0 ? void 0 : _h.width) !== null && _j !== void 0 ? _j : Math.max(blockWidth, 80);
7092
+ const imageHeight = (_l = (_k = spec.image) === null || _k === void 0 ? void 0 : _k.height) !== null && _l !== void 0 ? _l : Math.round(blockHeight * PORTRAIT_IMAGE_HEIGHT_RATIO);
7093
+ const titleFontSize = resolveTitleFontSize(spec, ctx, (_o = (_m = spec.data) === null || _m === void 0 ? void 0 : _m[index]) === null || _o === void 0 ? void 0 : _o.title, imageWidth, 26, [8, 34]);
7094
+ const titleLineHeight = resolveAdaptiveLineHeight(titleFontSize, (_p = spec.title) === null || _p === void 0 ? void 0 : _p.style, PORTRAIT_TITLE_LINE_HEIGHT);
7067
7095
  const minContentHeight = PORTRAIT_CONTENT_LINES * contentLineHeight;
7068
7096
  const contentHeight = Math.max(minContentHeight, Math.round(blockHeight * PORTRAIT_CONTENT_HEIGHT_RATIO));
7069
7097
  const textHeight = titleLineHeight + titleToContentGap + contentHeight;
@@ -7107,25 +7135,44 @@
7107
7135
  contentBox
7108
7136
  };
7109
7137
  };
7138
+ const getPortraitAxisRect = (spec, ctx) => {
7139
+ const blocks = getLayout(spec, ctx).blocks;
7140
+ if (!blocks.length) {
7141
+ return { x: 0, y: 0, width: 0, height: 0 };
7142
+ }
7143
+ let top = Number.POSITIVE_INFINITY;
7144
+ let bottom = Number.NEGATIVE_INFINITY;
7145
+ blocks.forEach((block, index) => {
7146
+ const metrics = getPortraitMetrics(spec, block.width, block.height, index, ctx);
7147
+ const localTop = Math.min(metrics.imageBox.y, metrics.shadowBox.y, metrics.textBox.y, metrics.contentBox.y);
7148
+ const localBottom = Math.max(metrics.imageBox.y + metrics.imageBox.height, metrics.shadowBox.y + metrics.shadowBox.height, metrics.textBox.y + metrics.textBox.height, metrics.contentBox.y + metrics.contentBox.height);
7149
+ top = Math.min(top, block.center.y + localTop);
7150
+ bottom = Math.max(bottom, block.center.y + localBottom);
7151
+ });
7152
+ const cx = blocks[0].center.x;
7153
+ return {
7154
+ x: cx - PORTRAIT_AXIS_WIDTH / 2,
7155
+ y: top - PORTRAIT_AXIS_PADDING,
7156
+ width: PORTRAIT_AXIS_WIDTH,
7157
+ height: bottom - top + PORTRAIT_AXIS_PADDING * 2
7158
+ };
7159
+ };
7110
7160
  const buildPortraitBlockMark = (spec, block, index) => {
7111
- var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o;
7161
+ var _a, _b, _c, _e, _f, _g;
7112
7162
  const hasImage = !!block.image;
7113
7163
  const hasSubImage = !!block.subImage;
7114
7164
  const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
7115
- const titleFontSize = Number((_c = (_b = (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.fontSize) !== null && _c !== void 0 ? _c : 26);
7116
- const titleLineHeight = Number((_g = (_f = (_e = spec.title) === null || _e === void 0 ? void 0 : _e.style) === null || _f === void 0 ? void 0 : _f.lineHeight) !== null && _g !== void 0 ? _g : Math.max(PORTRAIT_TITLE_LINE_HEIGHT, Math.round(titleFontSize * 1.35)));
7117
7165
  const getMetrics = (ctx) => {
7118
7166
  var _a, _b, _c, _e;
7119
7167
  const lb = getLayout(spec, ctx).blocks[index];
7120
7168
  const w = (_a = lb === null || lb === void 0 ? void 0 : lb.width) !== null && _a !== void 0 ? _a : resolveBlockWidth(spec, 0);
7121
7169
  const h = (_e = (_b = lb === null || lb === void 0 ? void 0 : lb.height) !== null && _b !== void 0 ? _b : (_c = spec.block) === null || _c === void 0 ? void 0 : _c.height) !== null && _e !== void 0 ? _e : DEFAULT_BLOCK_HEIGHT;
7122
- return getPortraitMetrics(spec, w, h, index);
7170
+ return getPortraitMetrics(spec, w, h, index, ctx);
7123
7171
  };
7124
- const themeColor = getThemeColor(spec);
7125
- const blockStyle = (_j = (_h = spec.block) === null || _h === void 0 ? void 0 : _h.style) !== null && _j !== void 0 ? _j : {};
7172
+ const blockStyle = (_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.style) !== null && _b !== void 0 ? _b : {};
7126
7173
  return {
7127
7174
  type: 'group',
7128
- id: `storyline-block-${(_k = block.id) !== null && _k !== void 0 ? _k : index}`,
7175
+ id: `storyline-block-${(_c = block.id) !== null && _c !== void 0 ? _c : index}`,
7129
7176
  name: `storyline-block-${index}`,
7130
7177
  zIndex: vchart.LayoutZIndex.Mark + 1,
7131
7178
  style: {
@@ -7154,7 +7201,7 @@
7154
7201
  image: block.subImage,
7155
7202
  repeatX: 'no-repeat',
7156
7203
  repeatY: 'no-repeat',
7157
- imageMode: 'cover',
7204
+ imageMode: 'contain',
7158
7205
  imagePosition: 'center'
7159
7206
  }
7160
7207
  }
@@ -7164,21 +7211,21 @@
7164
7211
  type: 'rect',
7165
7212
  name: `storyline-block-image-bg-${index}`,
7166
7213
  interactive: false,
7167
- style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).imageBox.x, y: (_d, ctx) => getMetrics(ctx).imageBox.y, width: (_d, ctx) => getMetrics(ctx).imageBox.width, height: (_d, ctx) => getMetrics(ctx).imageBox.height, cornerRadius: 8, fill: '#ffffff', stroke: themeColor, lineWidth: 2 }, blockStyle)
7214
+ style: Object.assign(Object.assign({ x: (_d, ctx) => getMetrics(ctx).imageBox.x, y: (_d, ctx) => getMetrics(ctx).imageBox.y, width: (_d, ctx) => getMetrics(ctx).imageBox.width, height: (_d, ctx) => getMetrics(ctx).imageBox.height, cornerRadius: 8 }, getImageBackgroundStyle(spec)), blockStyle)
7168
7215
  }
7169
7216
  : null,
7170
7217
  hasImage
7171
- ? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).imageBox.x, y: (_d, ctx) => getMetrics(ctx).imageBox.y, width: (_d, ctx) => getMetrics(ctx).imageBox.width, height: (_d, ctx) => getMetrics(ctx).imageBox.height, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'cover', imagePosition: 'center' }, (_l = spec.image) === null || _l === void 0 ? void 0 : _l.style) })
7218
+ ? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).imageBox.x, y: (_d, ctx) => getMetrics(ctx).imageBox.y, width: (_d, ctx) => getMetrics(ctx).imageBox.width, height: (_d, ctx) => getMetrics(ctx).imageBox.height, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'contain', imagePosition: 'center' }, (_e = spec.image) === null || _e === void 0 ? void 0 : _e.style) })
7172
7219
  : null,
7173
7220
  block.title
7174
- ? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, spec.title), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).textBox.x, y: (_d, ctx) => getMetrics(ctx).textBox.y, text: block.title, maxLineWidth: (_d, ctx) => getMetrics(ctx).textBox.width, fontSize: titleFontSize, lineHeight: titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: 'left', textBaseline: 'top' }, (_m = spec.title) === null || _m === void 0 ? void 0 : _m.style) })
7221
+ ? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, spec.title), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).textBox.x, y: (_d, ctx) => getMetrics(ctx).textBox.y, text: block.title, maxLineWidth: (_d, ctx) => getMetrics(ctx).textBox.width, fontSize: (_d, ctx) => getMetrics(ctx).titleFontSize, lineHeight: (_d, ctx) => getMetrics(ctx).titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: 'left', textBaseline: 'top' }, (_f = spec.title) === null || _f === void 0 ? void 0 : _f.style) })
7175
7222
  : null,
7176
7223
  contentText.length
7177
7224
  ? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), { textType: 'rich', style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).contentBox.x, y: (_d, ctx) => getMetrics(ctx).contentBox.y, width: (_d, ctx) => getMetrics(ctx).contentBox.width, height: (_d, ctx) => getMetrics(ctx).contentBox.height, maxLineWidth: (_d, ctx) => getMetrics(ctx).contentBox.width, heightLimit: (_d, ctx) => getMetrics(ctx).contentBox.height, text: buildRichContent(contentText, spec, {
7178
7225
  fontSize: PORTRAIT_CONTENT_FONT_SIZE,
7179
7226
  lineHeight: PORTRAIT_CONTENT_LINE_HEIGHT,
7180
7227
  fill: '#596173'
7181
- }), textAlign: 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_o = spec.content) === null || _o === void 0 ? void 0 : _o.style) })
7228
+ }), textAlign: 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_g = spec.content) === null || _g === void 0 ? void 0 : _g.style) })
7182
7229
  : null
7183
7230
  ].filter(Boolean)
7184
7231
  };
@@ -7196,18 +7243,19 @@
7196
7243
  const ARC_TITLE_TO_CONTENT_GAP = 4;
7197
7244
  const ARC_TEXT_PADDING = 20;
7198
7245
  const ARC_TEXT_BOX_MIN_WIDTH = 240;
7199
- const ARC_CENTER_IMAGE_SIZE_RATIO = 0.55;
7200
- const ARC_CENTER_IMAGE_TO_SYMBOL_RATIO = 0.8;
7201
- const ARC_GAP_FROM_CENTER_IMAGE = 200;
7246
+ const ARC_TITLE_IMAGE_WIDTH_RATIO = 0.68;
7247
+ const ARC_TITLE_IMAGE_MAX_WIDTH = 900;
7248
+ const ARC_TITLE_IMAGE_HEIGHT_RATIO = 0.34;
7249
+ const ARC_GAP_FROM_TITLE_IMAGE = 200;
7202
7250
  const isDownArc = (spec) => normalizeLayout(spec.layout).direction === 'down';
7203
- const getArcCenterImageRect = (spec, ctx) => {
7251
+ const getArcTitleImageRect = (spec, ctx) => {
7204
7252
  var _a, _b, _c, _e;
7205
7253
  const { width, height, startX, startY } = getRegionGeometry(ctx);
7206
7254
  const innerWidth = Math.max(width, 1);
7207
7255
  const innerHeight = Math.max(height, 1);
7208
- const baseSize = Math.min(innerWidth, innerHeight) * ARC_CENTER_IMAGE_SIZE_RATIO;
7209
- const w = Math.max((_b = (_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.width) !== null && _b !== void 0 ? _b : baseSize, 80);
7210
- const h = Math.max((_e = (_c = spec.centerImage) === null || _c === void 0 ? void 0 : _c.height) !== null && _e !== void 0 ? _e : baseSize, 80);
7256
+ const baseWidth = Math.min(innerWidth * ARC_TITLE_IMAGE_WIDTH_RATIO, ARC_TITLE_IMAGE_MAX_WIDTH);
7257
+ const w = Math.max((_b = (_a = spec.titleImage) === null || _a === void 0 ? void 0 : _a.width) !== null && _b !== void 0 ? _b : baseWidth, 80);
7258
+ const h = Math.max((_e = (_c = spec.titleImage) === null || _c === void 0 ? void 0 : _c.height) !== null && _e !== void 0 ? _e : w * ARC_TITLE_IMAGE_HEIGHT_RATIO, 40);
7211
7259
  const cx = startX + innerWidth / 2;
7212
7260
  const isDown = isDownArc(spec);
7213
7261
  const top = isDown ? startY : startY + innerHeight - h;
@@ -7224,20 +7272,20 @@
7224
7272
  const endAngle = (_b = layoutOpt.endAngle) !== null && _b !== void 0 ? _b : (isDown ? 160 : 340);
7225
7273
  const ratio = (_c = layoutOpt.radiusRatio) !== null && _c !== void 0 ? _c : 0.88;
7226
7274
  const rx = Math.max((innerWidth - blockWidth) / 2, 1) * ratio;
7227
- const centerRect = getArcCenterImageRect(spec, ctx);
7228
- const centerTop = centerRect.y;
7229
- const centerBottom = centerRect.y + centerRect.height;
7275
+ const titleImageRect = getArcTitleImageRect(spec, ctx);
7276
+ const centerTop = titleImageRect.y;
7277
+ const centerBottom = titleImageRect.y + titleImageRect.height;
7230
7278
  const sinStart = Math.sin((startAngle / 180) * Math.PI);
7231
7279
  let cy;
7232
7280
  let ry;
7233
7281
  if (isDown) {
7234
7282
  const denom = Math.max(1 - sinStart, 0.05);
7235
- ry = (centerRect.height + ARC_GAP_FROM_CENTER_IMAGE) / denom;
7283
+ ry = (titleImageRect.height + ARC_GAP_FROM_TITLE_IMAGE) / denom;
7236
7284
  cy = centerTop - ry * sinStart;
7237
7285
  }
7238
7286
  else {
7239
7287
  const denom = Math.max(1 + sinStart, 0.05);
7240
- ry = (centerRect.height + ARC_GAP_FROM_CENTER_IMAGE) / denom;
7288
+ ry = (titleImageRect.height + ARC_GAP_FROM_TITLE_IMAGE) / denom;
7241
7289
  cy = centerBottom - ry * sinStart;
7242
7290
  }
7243
7291
  return {
@@ -7311,121 +7359,45 @@
7311
7359
  ]
7312
7360
  };
7313
7361
  };
7314
- const buildArcCenterImageMark = (spec) => {
7315
- var _a, _b, _c, _e;
7316
- const visible = ((_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.visible) !== false;
7317
- if (!visible) {
7362
+ const buildArcTitleImageMark = (spec) => {
7363
+ var _a;
7364
+ if (!((_a = spec.titleImage) === null || _a === void 0 ? void 0 : _a.image) || spec.titleImage.visible === false) {
7318
7365
  return null;
7319
7366
  }
7320
- const themeColor = getThemeColor(spec);
7321
- const hasImage = !!((_b = spec.centerImage) === null || _b === void 0 ? void 0 : _b.image);
7322
- const symbolGradient = {
7323
- gradient: 'linear',
7324
- x0: 0.5,
7325
- y0: 0,
7326
- x1: 0.5,
7327
- y1: 1,
7328
- stops: [
7329
- { offset: 0, color: withAlpha(themeColor, 0.15) },
7330
- { offset: 1, color: themeColor }
7331
- ]
7332
- };
7333
7367
  return {
7334
7368
  type: 'group',
7335
- name: 'storyline-arc-center',
7336
- zIndex: vchart.LayoutZIndex.Mark,
7369
+ name: 'storyline-arc-title-image',
7370
+ zIndex: vchart.LayoutZIndex.Mark + 6,
7337
7371
  children: [
7338
- {
7339
- type: 'symbol',
7340
- name: 'storyline-arc-center-symbol',
7341
- interactive: false,
7342
- style: {
7343
- x: (_d, ctx) => {
7344
- const r = getArcCenterImageRect(spec, ctx);
7345
- return r.x + r.width / 2;
7346
- },
7347
- y: (_d, ctx) => {
7348
- const r = getArcCenterImageRect(spec, ctx);
7349
- return r.y + r.height / 2;
7350
- },
7351
- size: (_d, ctx) => {
7352
- const r = getArcCenterImageRect(spec, ctx);
7353
- return Math.max(r.width, r.height);
7354
- },
7355
- symbolType: 'circle',
7356
- fill: hasImage ? symbolGradient : '#ffffff',
7357
- stroke: themeColor,
7358
- lineWidth: 2
7359
- }
7360
- },
7361
- hasImage
7362
- ? Object.assign(Object.assign({ type: 'image', name: 'storyline-arc-center-image', interactive: false }, spec.centerImage), { style: Object.assign({ x: (_d, ctx) => {
7363
- var _a, _b;
7364
- const r = getArcCenterImageRect(spec, ctx);
7365
- const userWidth = (_b = (_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.width;
7366
- const w = typeof userWidth === 'number'
7367
- ? userWidth
7368
- : Math.max(r.width, r.height) * ARC_CENTER_IMAGE_TO_SYMBOL_RATIO;
7369
- return r.x + (r.width - w) / 2;
7370
- }, y: (_d, ctx) => {
7371
- var _a, _b;
7372
- const r = getArcCenterImageRect(spec, ctx);
7373
- const userHeight = (_b = (_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.height;
7374
- const h = typeof userHeight === 'number'
7375
- ? userHeight
7376
- : Math.max(r.width, r.height) * ARC_CENTER_IMAGE_TO_SYMBOL_RATIO;
7377
- return r.y + (r.height - h) / 2;
7378
- }, width: (_d, ctx) => {
7379
- var _a, _b;
7380
- const r = getArcCenterImageRect(spec, ctx);
7381
- const userWidth = (_b = (_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.width;
7382
- return typeof userWidth === 'number'
7383
- ? userWidth
7384
- : Math.max(r.width, r.height) * ARC_CENTER_IMAGE_TO_SYMBOL_RATIO;
7385
- }, height: (_d, ctx) => {
7386
- var _a, _b;
7387
- const r = getArcCenterImageRect(spec, ctx);
7388
- const userHeight = (_b = (_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.height;
7389
- return typeof userHeight === 'number'
7390
- ? userHeight
7391
- : Math.max(r.width, r.height) * ARC_CENTER_IMAGE_TO_SYMBOL_RATIO;
7392
- }, cornerRadius: (_d, ctx) => {
7393
- var _a, _b, _c, _e;
7394
- const r = getArcCenterImageRect(spec, ctx);
7395
- const userWidth = (_b = (_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.width;
7396
- const userHeight = (_e = (_c = spec.centerImage) === null || _c === void 0 ? void 0 : _c.style) === null || _e === void 0 ? void 0 : _e.height;
7397
- const w = typeof userWidth === 'number'
7398
- ? userWidth
7399
- : Math.max(r.width, r.height) * ARC_CENTER_IMAGE_TO_SYMBOL_RATIO;
7400
- const h = typeof userHeight === 'number'
7401
- ? userHeight
7402
- : Math.max(r.width, r.height) * ARC_CENTER_IMAGE_TO_SYMBOL_RATIO;
7403
- return Math.max(w, h) / 2;
7404
- }, image: (_c = spec.centerImage) === null || _c === void 0 ? void 0 : _c.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'cover', imagePosition: 'center', anchor: (_d, ctx) => {
7405
- const r = getArcCenterImageRect(spec, ctx);
7406
- return [r.x + r.width / 2, r.y + r.height / 2];
7407
- } }, (_e = spec.centerImage) === null || _e === void 0 ? void 0 : _e.style) })
7408
- : null
7409
- ].filter(Boolean)
7372
+ Object.assign(Object.assign({ type: 'image', name: 'storyline-arc-title-image-node', interactive: false }, spec.titleImage), { style: Object.assign({ x: (_d, ctx) => {
7373
+ return getArcTitleImageRect(spec, ctx).x;
7374
+ }, y: (_d, ctx) => {
7375
+ return getArcTitleImageRect(spec, ctx).y;
7376
+ }, width: (_d, ctx) => {
7377
+ return getArcTitleImageRect(spec, ctx).width;
7378
+ }, height: (_d, ctx) => {
7379
+ return getArcTitleImageRect(spec, ctx).height;
7380
+ }, image: spec.titleImage.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'contain', imagePosition: 'center' }, spec.titleImage.style) })
7381
+ ]
7410
7382
  };
7411
7383
  };
7412
7384
  const getArcBlockMetrics = (spec, index = 0) => {
7413
- var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
7414
- const titleFontSize = Number((_c = (_b = (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.fontSize) !== null && _c !== void 0 ? _c : ARC_TITLE_FONT_SIZE);
7415
- const titleLineHeight = Number((_g = (_f = (_e = spec.title) === null || _e === void 0 ? void 0 : _e.style) === null || _f === void 0 ? void 0 : _f.lineHeight) !== null && _g !== void 0 ? _g : Math.max(ARC_TITLE_LINE_HEIGHT, Math.round(titleFontSize * 1.35)));
7416
- const contentFontSize = Number((_k = (_j = (_h = spec.content) === null || _h === void 0 ? void 0 : _h.style) === null || _j === void 0 ? void 0 : _j.fontSize) !== null && _k !== void 0 ? _k : ARC_CONTENT_FONT_SIZE);
7417
- const contentLineHeight = Number((_o = (_m = (_l = spec.content) === null || _l === void 0 ? void 0 : _l.style) === null || _m === void 0 ? void 0 : _m.lineHeight) !== null && _o !== void 0 ? _o : ARC_CONTENT_LINE_HEIGHT);
7385
+ var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
7386
+ const contentFontSize = Number((_c = (_b = (_a = spec.content) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.fontSize) !== null && _c !== void 0 ? _c : ARC_CONTENT_FONT_SIZE);
7387
+ const contentLineHeight = Number((_g = (_f = (_e = spec.content) === null || _e === void 0 ? void 0 : _e.style) === null || _f === void 0 ? void 0 : _f.lineHeight) !== null && _g !== void 0 ? _g : ARC_CONTENT_LINE_HEIGHT);
7418
7388
  const titleToContentGap = ARC_TITLE_TO_CONTENT_GAP;
7419
- const textHeight = ARC_TEXT_BOX_HEIGHT;
7420
- const contentHeight = Math.max(textHeight - titleLineHeight - titleToContentGap, contentLineHeight);
7421
- const imageDiameter = Math.max((_q = (_p = spec.image) === null || _p === void 0 ? void 0 : _p.width) !== null && _q !== void 0 ? _q : ARC_BLOCK_IMAGE_SIZE, (_s = (_r = spec.image) === null || _r === void 0 ? void 0 : _r.height) !== null && _s !== void 0 ? _s : ARC_BLOCK_IMAGE_SIZE);
7389
+ const imageDiameter = Math.max((_j = (_h = spec.image) === null || _h === void 0 ? void 0 : _h.width) !== null && _j !== void 0 ? _j : ARC_BLOCK_IMAGE_SIZE, (_l = (_k = spec.image) === null || _k === void 0 ? void 0 : _k.height) !== null && _l !== void 0 ? _l : ARC_BLOCK_IMAGE_SIZE);
7422
7390
  const imageWidth = imageDiameter;
7423
7391
  const imageHeight = imageDiameter;
7424
7392
  const isDown = isDownArc(spec);
7425
- const count = Math.max((_u = (_t = spec.data) === null || _t === void 0 ? void 0 : _t.length) !== null && _u !== void 0 ? _u : 0, 1);
7426
- const canvasWidth = Number((_v = spec.width) !== null && _v !== void 0 ? _v : imageWidth * count);
7393
+ const count = Math.max((_o = (_m = spec.data) === null || _m === void 0 ? void 0 : _m.length) !== null && _o !== void 0 ? _o : 0, 1);
7394
+ const canvasWidth = Number((_p = spec.width) !== null && _p !== void 0 ? _p : imageWidth * count);
7427
7395
  const defaultTextWidth = Math.round(canvasWidth / (count + 1));
7428
- const textBoxWidth = Math.max(Number((_x = (_w = spec.block) === null || _w === void 0 ? void 0 : _w.width) !== null && _x !== void 0 ? _x : defaultTextWidth), ARC_TEXT_BOX_MIN_WIDTH);
7396
+ const textBoxWidth = Math.max(Number((_r = (_q = spec.block) === null || _q === void 0 ? void 0 : _q.width) !== null && _r !== void 0 ? _r : defaultTextWidth), ARC_TEXT_BOX_MIN_WIDTH);
7397
+ const titleFontSize = resolveTitleFontSize(spec, undefined, (_t = (_s = spec.data) === null || _s === void 0 ? void 0 : _s[index]) === null || _t === void 0 ? void 0 : _t.title, textBoxWidth, ARC_TITLE_FONT_SIZE, [8, 40]);
7398
+ const titleLineHeight = resolveAdaptiveLineHeight(titleFontSize, (_u = spec.title) === null || _u === void 0 ? void 0 : _u.style, ARC_TITLE_LINE_HEIGHT);
7399
+ const textHeight = ARC_TEXT_BOX_HEIGHT;
7400
+ const contentHeight = Math.max(textHeight - titleLineHeight - titleToContentGap, contentLineHeight);
7429
7401
  const isLeftSide = index < count / 2;
7430
7402
  const textAlign = isLeftSide ? 'right' : 'left';
7431
7403
  const imageBox = {
@@ -7495,21 +7467,13 @@
7495
7467
  }
7496
7468
  },
7497
7469
  hasImage
7498
- ? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 3 }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: metrics.imageBox.x, y: metrics.imageBox.y, width: metrics.imageBox.width, height: metrics.imageBox.height, cornerRadius: Math.min(metrics.imageBox.width, metrics.imageBox.height) / 2, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'cover', imagePosition: 'center' }, (_b = spec.image) === null || _b === void 0 ? void 0 : _b.style) })
7470
+ ? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 3 }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: metrics.imageBox.x, y: metrics.imageBox.y, width: metrics.imageBox.width, height: metrics.imageBox.height, cornerRadius: Math.min(metrics.imageBox.width, metrics.imageBox.height) / 2, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'contain', imagePosition: 'center' }, (_b = spec.image) === null || _b === void 0 ? void 0 : _b.style) })
7499
7471
  : {
7500
7472
  type: 'symbol',
7501
7473
  name: `storyline-block-image-bg-${index}`,
7502
7474
  interactive: false,
7503
7475
  zIndex: vchart.LayoutZIndex.Mark + 3,
7504
- style: {
7505
- x: 0,
7506
- y: 0,
7507
- size: Math.min(metrics.imageBox.width, metrics.imageBox.height),
7508
- symbolType: 'circle',
7509
- fill: '#ffffff',
7510
- stroke: themeColor,
7511
- lineWidth: 2
7512
- }
7476
+ style: Object.assign({ x: 0, y: 0, size: Math.min(metrics.imageBox.width, metrics.imageBox.height), symbolType: 'circle' }, getImageBackgroundStyle(spec))
7513
7477
  },
7514
7478
  shouldShowImageBackground(spec)
7515
7479
  ? {
@@ -7523,7 +7487,7 @@
7523
7487
  size: Math.min(metrics.imageBox.width, metrics.imageBox.height) + ARC_BLOCK_IMAGE_HALO_PADDING * 2,
7524
7488
  symbolType: 'circle',
7525
7489
  fill: 'transparent',
7526
- stroke: themeColor,
7490
+ stroke: withAlpha(themeColor, 0.82),
7527
7491
  lineWidth: ARC_BLOCK_IMAGE_BORDER
7528
7492
  }
7529
7493
  }
@@ -7551,9 +7515,10 @@
7551
7515
  const WING_TEXT_BOX_WIDTH = 240;
7552
7516
  const WING_TEXT_BOX_HEIGHT = 110;
7553
7517
  const WING_TITLE_TO_CONTENT_GAP = 4;
7518
+ const WING_TITLE_IMAGE_WIDTH_RATIO = 0.6;
7519
+ const WING_TITLE_IMAGE_MAX_WIDTH = 820;
7554
7520
  const getWingDirection = (spec) => {
7555
- var _a;
7556
- return (_a = normalizeLayout(spec.layout).direction) !== null && _a !== void 0 ? _a : 'left';
7521
+ return normalizeLayout(spec.layout).direction === 'right' ? 'right' : 'left';
7557
7522
  };
7558
7523
  const getWingArcGeometry = (spec, ctx) => {
7559
7524
  var _a, _b, _c;
@@ -7652,18 +7617,53 @@
7652
7617
  ]
7653
7618
  };
7654
7619
  };
7620
+ const buildWingTitleImageMark = (spec) => {
7621
+ var _a;
7622
+ if (!((_a = spec.titleImage) === null || _a === void 0 ? void 0 : _a.image) || spec.titleImage.visible === false) {
7623
+ return null;
7624
+ }
7625
+ return {
7626
+ type: 'group',
7627
+ name: 'storyline-wing-title-image',
7628
+ zIndex: vchart.LayoutZIndex.Mark + 8,
7629
+ children: [
7630
+ Object.assign(Object.assign({ type: 'image', name: 'storyline-wing-title-image-node', interactive: false }, spec.titleImage), { style: Object.assign({ x: (_d, ctx) => {
7631
+ const { width, height, startX } = getChartGeometry(ctx, spec);
7632
+ const size = getTitleImageSize(spec, width, height, {
7633
+ widthRatio: WING_TITLE_IMAGE_WIDTH_RATIO,
7634
+ maxWidth: WING_TITLE_IMAGE_MAX_WIDTH
7635
+ });
7636
+ return getWingDirection(spec) === 'right' ? startX : startX + width - size.width;
7637
+ }, y: (_d, ctx) => {
7638
+ return getChartGeometry(ctx, spec).startY + 12;
7639
+ }, width: (_d, ctx) => {
7640
+ const { width, height } = getChartGeometry(ctx, spec);
7641
+ return getTitleImageSize(spec, width, height, {
7642
+ widthRatio: WING_TITLE_IMAGE_WIDTH_RATIO,
7643
+ maxWidth: WING_TITLE_IMAGE_MAX_WIDTH
7644
+ }).width;
7645
+ }, height: (_d, ctx) => {
7646
+ const { width, height } = getChartGeometry(ctx, spec);
7647
+ return getTitleImageSize(spec, width, height, {
7648
+ widthRatio: WING_TITLE_IMAGE_WIDTH_RATIO,
7649
+ maxWidth: WING_TITLE_IMAGE_MAX_WIDTH
7650
+ }).height;
7651
+ }, image: spec.titleImage.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'contain', imagePosition: 'center' }, spec.titleImage.style) })
7652
+ ]
7653
+ };
7654
+ };
7655
7655
  const WING_TEXT_IMAGE_GAP = 120;
7656
7656
  const getWingBlockMetrics = (spec, ctx, index) => {
7657
- var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
7658
- const titleFontSize = Number((_c = (_b = (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.fontSize) !== null && _c !== void 0 ? _c : WING_TITLE_FONT_SIZE);
7659
- const titleLineHeight = Number((_g = (_f = (_e = spec.title) === null || _e === void 0 ? void 0 : _e.style) === null || _f === void 0 ? void 0 : _f.lineHeight) !== null && _g !== void 0 ? _g : Math.max(WING_TITLE_LINE_HEIGHT, Math.round(titleFontSize * 1.3)));
7660
- const contentFontSize = Number((_k = (_j = (_h = spec.content) === null || _h === void 0 ? void 0 : _h.style) === null || _j === void 0 ? void 0 : _j.fontSize) !== null && _k !== void 0 ? _k : WING_CONTENT_FONT_SIZE);
7661
- const contentLineHeight = Number((_o = (_m = (_l = spec.content) === null || _l === void 0 ? void 0 : _l.style) === null || _m === void 0 ? void 0 : _m.lineHeight) !== null && _o !== void 0 ? _o : WING_CONTENT_LINE_HEIGHT);
7657
+ var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
7658
+ const titleFontSize = resolveTitleFontSize(spec, ctx, (_b = (_a = spec.data) === null || _a === void 0 ? void 0 : _a[index]) === null || _b === void 0 ? void 0 : _b.title, WING_TEXT_BOX_WIDTH, WING_TITLE_FONT_SIZE, [8, 30]);
7659
+ const titleLineHeight = resolveAdaptiveLineHeight(titleFontSize, (_c = spec.title) === null || _c === void 0 ? void 0 : _c.style, WING_TITLE_LINE_HEIGHT, 1.3);
7660
+ const contentFontSize = Number((_g = (_f = (_e = spec.content) === null || _e === void 0 ? void 0 : _e.style) === null || _f === void 0 ? void 0 : _f.fontSize) !== null && _g !== void 0 ? _g : WING_CONTENT_FONT_SIZE);
7661
+ const contentLineHeight = Number((_k = (_j = (_h = spec.content) === null || _h === void 0 ? void 0 : _h.style) === null || _j === void 0 ? void 0 : _j.lineHeight) !== null && _k !== void 0 ? _k : WING_CONTENT_LINE_HEIGHT);
7662
7662
  const titleToContentGap = WING_TITLE_TO_CONTENT_GAP;
7663
7663
  const textHeight = WING_TEXT_BOX_HEIGHT;
7664
7664
  const contentHeight = 100000;
7665
- const imageWidth = Number((_q = (_p = spec.image) === null || _p === void 0 ? void 0 : _p.width) !== null && _q !== void 0 ? _q : WING_BLOCK_IMAGE_SIZE);
7666
- const imageHeight = Number((_s = (_r = spec.image) === null || _r === void 0 ? void 0 : _r.height) !== null && _s !== void 0 ? _s : WING_BLOCK_IMAGE_SIZE);
7665
+ const imageWidth = Number((_m = (_l = spec.image) === null || _l === void 0 ? void 0 : _l.width) !== null && _m !== void 0 ? _m : WING_BLOCK_IMAGE_SIZE);
7666
+ const imageHeight = Number((_p = (_o = spec.image) === null || _o === void 0 ? void 0 : _o.height) !== null && _p !== void 0 ? _p : WING_BLOCK_IMAGE_SIZE);
7667
7667
  const imageBox = {
7668
7668
  x: -imageWidth / 2,
7669
7669
  y: -imageHeight / 2,
@@ -7671,7 +7671,7 @@
7671
7671
  height: imageHeight
7672
7672
  };
7673
7673
  const direction = getWingDirection(spec);
7674
- const count = (_u = (_t = spec.data) === null || _t === void 0 ? void 0 : _t.length) !== null && _u !== void 0 ? _u : 0;
7674
+ const count = (_r = (_q = spec.data) === null || _q === void 0 ? void 0 : _q.length) !== null && _r !== void 0 ? _r : 0;
7675
7675
  const isSpecialBelow = (direction === 'right' && count > 0 && index === count - 1) || (direction === 'left' && index === 0);
7676
7676
  const isVerticalLayout = isSpecialBelow;
7677
7677
  const textWidth = WING_TEXT_BOX_WIDTH;
@@ -7769,33 +7769,16 @@
7769
7769
  type: 'symbol',
7770
7770
  name: `storyline-block-image-halo-${index}`,
7771
7771
  interactive: false,
7772
- style: {
7773
- x: 0,
7774
- y: 0,
7775
- size: (_d, ctx) => Math.max(getWingBlockMetrics(spec, ctx, index).imageBox.width, getWingBlockMetrics(spec, ctx, index).imageBox.height) + 12,
7776
- symbolType: 'circle',
7777
- fill: withAlpha(themeColor, 0.18),
7778
- stroke: themeColor,
7779
- lineWidth: 1.5
7780
- }
7772
+ style: Object.assign(Object.assign({ x: 0, y: 0, size: (_d, ctx) => Math.max(getWingBlockMetrics(spec, ctx, index).imageBox.width, getWingBlockMetrics(spec, ctx, index).imageBox.height) + 12, symbolType: 'circle' }, getImageBackgroundStyle(spec)), { lineWidth: 1.5 })
7781
7773
  }
7782
7774
  : null,
7783
7775
  hasImage
7784
- ? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.x, y: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.y, width: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.width, height: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.height, cornerRadius: (_d, ctx) => Math.min(getWingBlockMetrics(spec, ctx, index).imageBox.width, getWingBlockMetrics(spec, ctx, index).imageBox.height) / 2, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'cover', imagePosition: 'center' }, (_b = spec.image) === null || _b === void 0 ? void 0 : _b.style) })
7776
+ ? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.x, y: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.y, width: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.width, height: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.height, cornerRadius: (_d, ctx) => Math.min(getWingBlockMetrics(spec, ctx, index).imageBox.width, getWingBlockMetrics(spec, ctx, index).imageBox.height) / 2, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'contain', imagePosition: 'center' }, (_b = spec.image) === null || _b === void 0 ? void 0 : _b.style) })
7785
7777
  : {
7786
7778
  type: 'rect',
7787
7779
  name: `storyline-block-image-bg-${index}`,
7788
7780
  interactive: false,
7789
- style: {
7790
- x: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.x,
7791
- y: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.y,
7792
- width: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.width,
7793
- height: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.height,
7794
- cornerRadius: (_d, ctx) => Math.min(getWingBlockMetrics(spec, ctx, index).imageBox.width, getWingBlockMetrics(spec, ctx, index).imageBox.height) / 2,
7795
- fill: '#ffffff',
7796
- stroke: themeColor,
7797
- lineWidth: 2
7798
- }
7781
+ style: Object.assign({ x: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.x, y: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.y, width: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.width, height: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.height, cornerRadius: (_d, ctx) => Math.min(getWingBlockMetrics(spec, ctx, index).imageBox.width, getWingBlockMetrics(spec, ctx, index).imageBox.height) / 2 }, getImageBackgroundStyle(spec))
7799
7782
  },
7800
7783
  block.title
7801
7784
  ? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 10 }, spec.title), { style: Object.assign({ x: (_d, ctx) => {
@@ -7937,7 +7920,7 @@
7937
7920
  };
7938
7921
  const isOnLeft = (index) => index % 2 === 1;
7939
7922
  const getLadderBlockMetrics = (spec, ctx, index) => {
7940
- var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
7923
+ var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
7941
7924
  const block = getLayout(spec, ctx).blocks[index];
7942
7925
  const padding = normalizePadding((_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.padding) !== null && _b !== void 0 ? _b : 12);
7943
7926
  const imagePosition = isOnLeft(index) ? 'right' : 'left';
@@ -7945,16 +7928,18 @@
7945
7928
  const imageHeight = (_g = (_f = spec.image) === null || _f === void 0 ? void 0 : _f.height) !== null && _g !== void 0 ? _g : LADDER_BLOCK_IMAGE_SIZE;
7946
7929
  const imageGap = (_j = (_h = spec.image) === null || _h === void 0 ? void 0 : _h.gap) !== null && _j !== void 0 ? _j : DEFAULT_IMAGE_GAP;
7947
7930
  const hasImage = !!((_l = (_k = spec.data) === null || _k === void 0 ? void 0 : _k[index]) === null || _l === void 0 ? void 0 : _l.image);
7948
- const titleFontSize = Number((_p = (_o = (_m = spec.title) === null || _m === void 0 ? void 0 : _m.style) === null || _o === void 0 ? void 0 : _o.fontSize) !== null && _p !== void 0 ? _p : LADDER_TITLE_FONT_SIZE);
7949
- const titleLineHeight = Number((_s = (_r = (_q = spec.title) === null || _q === void 0 ? void 0 : _q.style) === null || _r === void 0 ? void 0 : _r.lineHeight) !== null && _s !== void 0 ? _s : Math.round(titleFontSize * (LADDER_TITLE_LINE_HEIGHT / LADDER_TITLE_FONT_SIZE)));
7950
- const titleHeight = ((_u = (_t = spec.data) === null || _t === void 0 ? void 0 : _t[index]) === null || _u === void 0 ? void 0 : _u.title) ? titleLineHeight : 0;
7951
- const blockWidth = (_v = block === null || block === void 0 ? void 0 : block.width) !== null && _v !== void 0 ? _v : resolveBlockWidth(spec, 0);
7952
- const blockHeight = (_y = (_w = block === null || block === void 0 ? void 0 : block.height) !== null && _w !== void 0 ? _w : (_x = spec.block) === null || _x === void 0 ? void 0 : _x.height) !== null && _y !== void 0 ? _y : DEFAULT_BLOCK_HEIGHT;
7931
+ const blockWidth = (_m = block === null || block === void 0 ? void 0 : block.width) !== null && _m !== void 0 ? _m : resolveBlockWidth(spec, 0);
7932
+ const blockHeight = (_q = (_o = block === null || block === void 0 ? void 0 : block.height) !== null && _o !== void 0 ? _o : (_p = spec.block) === null || _p === void 0 ? void 0 : _p.height) !== null && _q !== void 0 ? _q : DEFAULT_BLOCK_HEIGHT;
7953
7933
  const imageBox = getImageBox(imagePosition, blockWidth, blockHeight, padding, imageWidth, imageHeight, imageGap, hasImage);
7954
7934
  const textBox = getTextBox(imagePosition, blockWidth, blockHeight, padding, imageWidth, imageHeight, imageGap, hasImage);
7955
- const contentGap = ((_0 = (_z = spec.data) === null || _z === void 0 ? void 0 : _z[index]) === null || _0 === void 0 ? void 0 : _0.title) ? 8 : 0;
7935
+ const titleFontSize = resolveTitleFontSize(spec, ctx, (_s = (_r = spec.data) === null || _r === void 0 ? void 0 : _r[index]) === null || _s === void 0 ? void 0 : _s.title, textBox.width, LADDER_TITLE_FONT_SIZE, [8, 34]);
7936
+ const titleLineHeight = resolveAdaptiveLineHeight(titleFontSize, (_t = spec.title) === null || _t === void 0 ? void 0 : _t.style, LADDER_TITLE_LINE_HEIGHT, LADDER_TITLE_LINE_HEIGHT / LADDER_TITLE_FONT_SIZE);
7937
+ const titleHeight = ((_v = (_u = spec.data) === null || _u === void 0 ? void 0 : _u[index]) === null || _v === void 0 ? void 0 : _v.title) ? titleLineHeight : 0;
7938
+ const contentGap = ((_x = (_w = spec.data) === null || _w === void 0 ? void 0 : _w[index]) === null || _x === void 0 ? void 0 : _x.title) ? 8 : 0;
7956
7939
  return {
7957
7940
  block: { width: blockWidth, height: blockHeight },
7941
+ titleFontSize,
7942
+ titleLineHeight,
7958
7943
  imageBox,
7959
7944
  textBox,
7960
7945
  contentBox: {
@@ -7964,23 +7949,20 @@
7964
7949
  };
7965
7950
  };
7966
7951
  const buildLadderBlockMark = (spec, block, index) => {
7967
- var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
7952
+ var _a, _b, _c, _e, _f, _g, _h;
7968
7953
  const hasImage = !!block.image;
7969
7954
  const onLeft = isOnLeft(index);
7970
7955
  const align = onLeft ? 'right' : 'left';
7971
7956
  const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
7972
- const titleFontSize = Number((_c = (_b = (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.fontSize) !== null && _c !== void 0 ? _c : LADDER_TITLE_FONT_SIZE);
7973
- const titleLineHeight = Number((_g = (_f = (_e = spec.title) === null || _e === void 0 ? void 0 : _e.style) === null || _f === void 0 ? void 0 : _f.lineHeight) !== null && _g !== void 0 ? _g : Math.round(titleFontSize * (LADDER_TITLE_LINE_HEIGHT / LADDER_TITLE_FONT_SIZE)));
7974
- const showBackground = ((_h = spec.block) === null || _h === void 0 ? void 0 : _h.showBackground) === true;
7957
+ const showBackground = ((_a = spec.block) === null || _a === void 0 ? void 0 : _a.showBackground) === true;
7975
7958
  const showImageBackground = shouldShowImageBackground(spec);
7976
- const themeColor = getThemeColor(spec);
7977
7959
  const getTitleX = (ctx) => {
7978
7960
  const m = getLadderBlockMetrics(spec, ctx, index);
7979
7961
  return align === 'right' ? m.textBox.x + m.textBox.width : m.textBox.x;
7980
7962
  };
7981
7963
  return {
7982
7964
  type: 'group',
7983
- id: `storyline-block-${(_j = block.id) !== null && _j !== void 0 ? _j : index}`,
7965
+ id: `storyline-block-${(_b = block.id) !== null && _b !== void 0 ? _b : index}`,
7984
7966
  name: `storyline-block-${index}`,
7985
7967
  zIndex: vchart.LayoutZIndex.Mark + 1,
7986
7968
  style: {
@@ -7995,7 +7977,7 @@
7995
7977
  type: 'rect',
7996
7978
  name: `storyline-block-bg-${index}`,
7997
7979
  interactive: false,
7998
- style: Object.assign({ x: 0, y: 0, width: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).block.width, height: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).block.height, cornerRadius: 8, fill: '#ffffff', stroke: '#d7dce5', lineWidth: 1, shadowBlur: 6, shadowColor: 'rgba(0, 0, 0, 0.08)' }, (_k = spec.block) === null || _k === void 0 ? void 0 : _k.style)
7980
+ style: Object.assign({ x: 0, y: 0, width: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).block.width, height: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).block.height, cornerRadius: 8, fill: '#ffffff', stroke: '#d7dce5', lineWidth: 1, shadowBlur: 6, shadowColor: 'rgba(0, 0, 0, 0.08)' }, (_c = spec.block) === null || _c === void 0 ? void 0 : _c.style)
7999
7981
  }
8000
7982
  : null,
8001
7983
  showImageBackground
@@ -8003,21 +7985,21 @@
8003
7985
  type: 'rect',
8004
7986
  name: `storyline-block-image-bg-${index}`,
8005
7987
  interactive: false,
8006
- style: Object.assign({ x: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.x, y: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.y, width: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.width, height: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.height, cornerRadius: 8, fill: '#ffffff', stroke: themeColor, lineWidth: 2 }, (_l = spec.block) === null || _l === void 0 ? void 0 : _l.style)
7988
+ style: Object.assign(Object.assign({ x: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.x, y: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.y, width: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.width, height: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.height, cornerRadius: 8 }, getImageBackgroundStyle(spec)), (_e = spec.block) === null || _e === void 0 ? void 0 : _e.style)
8007
7989
  }
8008
7990
  : null,
8009
7991
  hasImage
8010
- ? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.x, y: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.y, width: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.width, height: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.height, image: block.image }, (_m = spec.image) === null || _m === void 0 ? void 0 : _m.style) })
7992
+ ? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.x, y: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.y, width: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.width, height: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.height, image: block.image }, (_f = spec.image) === null || _f === void 0 ? void 0 : _f.style) })
8011
7993
  : null,
8012
7994
  block.title
8013
- ? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, spec.title), { style: Object.assign(Object.assign({ x: (_d, ctx) => getTitleX(ctx), y: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).textBox.y, text: block.title, maxLineWidth: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).textBox.width, fontSize: titleFontSize, lineHeight: titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textBaseline: 'top' }, (_o = spec.title) === null || _o === void 0 ? void 0 : _o.style), { textAlign: align }) })
7995
+ ? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, spec.title), { style: Object.assign(Object.assign({ x: (_d, ctx) => getTitleX(ctx), y: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).textBox.y, text: block.title, maxLineWidth: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).textBox.width, fontSize: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).titleFontSize, lineHeight: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textBaseline: 'top' }, (_g = spec.title) === null || _g === void 0 ? void 0 : _g.style), { textAlign: align }) })
8014
7996
  : null,
8015
7997
  contentText.length
8016
7998
  ? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), { textType: 'rich', style: Object.assign(Object.assign({ x: (_d, ctx) => getTitleX(ctx), y: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).contentBox.y, width: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).textBox.width, text: buildRichContent(contentText, spec, {
8017
7999
  fontSize: LADDER_CONTENT_FONT_SIZE,
8018
8000
  lineHeight: LADDER_CONTENT_LINE_HEIGHT,
8019
8001
  align: align
8020
- }), maxLineWidth: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).textBox.width, heightLimit: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).contentBox.height, textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_p = spec.content) === null || _p === void 0 ? void 0 : _p.style), { textAlign: align }) })
8002
+ }), maxLineWidth: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).textBox.width, heightLimit: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).contentBox.height, textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_h = spec.content) === null || _h === void 0 ? void 0 : _h.style), { textAlign: align }) })
8021
8003
  : null
8022
8004
  ].filter(Boolean)
8023
8005
  };
@@ -8050,6 +8032,16 @@
8050
8032
  const ladder = isLadder(spec);
8051
8033
  const wing = isWing(spec);
8052
8034
  const clock = isClock(spec);
8035
+ const topTitleImageReserve = (() => {
8036
+ var _a, _b, _c, _d;
8037
+ if (arc ||
8038
+ ladder ||
8039
+ !((_a = spec.titleImage) === null || _a === void 0 ? void 0 : _a.image) ||
8040
+ ((_b = spec.titleImage) === null || _b === void 0 ? void 0 : _b.visible) === false) {
8041
+ return 0;
8042
+ }
8043
+ return getTitleImageReservedHeight(spec, Number((_c = spec.width) !== null && _c !== void 0 ? _c : 1000), Number((_d = spec.height) !== null && _d !== void 0 ? _d : 600));
8044
+ })();
8053
8045
  const portraitBottomReserve = (() => {
8054
8046
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
8055
8047
  if (!portrait) {
@@ -8096,7 +8088,7 @@
8096
8088
  const cap = canvasHeight ? Math.floor(canvasHeight * 0.3) : ideal;
8097
8089
  return Math.min(ideal, cap);
8098
8090
  })();
8099
- const defaultTop = clock ? 40 : ladder ? ladderVerticalPadding : arcDown ? 0 : arcUp ? TEXT_RESERVE : SMALL;
8091
+ const defaultTop = Math.max(topTitleImageReserve, clock ? 40 : ladder ? ladderVerticalPadding : arcDown ? 0 : arcUp ? TEXT_RESERVE : SMALL);
8100
8092
  const defaultBottom = clock
8101
8093
  ? 60
8102
8094
  : portrait
@@ -8127,14 +8119,18 @@
8127
8119
  spec.padding = [defaultTop, defaultRight, defaultBottom, defaultLeft];
8128
8120
  return;
8129
8121
  }
8122
+ if (typeof p === 'number') {
8123
+ spec.padding = [Math.max(p, topTitleImageReserve), p, p, p];
8124
+ return;
8125
+ }
8130
8126
  if (Array.isArray(p)) {
8131
8127
  const [t, r = defaultRight, b, l = defaultLeft] = p;
8132
- spec.padding = [t !== null && t !== void 0 ? t : defaultTop, r, b !== null && b !== void 0 ? b : defaultBottom, l];
8128
+ spec.padding = [Math.max(t !== null && t !== void 0 ? t : defaultTop, topTitleImageReserve), r, b !== null && b !== void 0 ? b : defaultBottom, l];
8133
8129
  return;
8134
8130
  }
8135
8131
  if (typeof p === 'object') {
8136
8132
  spec.padding = {
8137
- top: (_a = p.top) !== null && _a !== void 0 ? _a : defaultTop,
8133
+ top: Math.max((_a = p.top) !== null && _a !== void 0 ? _a : defaultTop, topTitleImageReserve),
8138
8134
  right: (_b = p.right) !== null && _b !== void 0 ? _b : defaultRight,
8139
8135
  bottom: (_c = p.bottom) !== null && _c !== void 0 ? _c : defaultBottom,
8140
8136
  left: (_d = p.left) !== null && _d !== void 0 ? _d : defaultLeft
@@ -8145,32 +8141,33 @@
8145
8141
  var _a;
8146
8142
  const lineMark = buildLineMark(spec);
8147
8143
  const blockMarks = ((_a = spec.data) !== null && _a !== void 0 ? _a : []).map((block, index) => buildBlockMark(spec, block, index));
8144
+ const titleImageMark = buildTopTitleImageMark(spec);
8148
8145
  if (isLandscape(spec)) {
8149
- return [...blockMarks, lineMark].filter(Boolean);
8146
+ return [titleImageMark, ...blockMarks, lineMark].filter(Boolean);
8150
8147
  }
8151
8148
  if (isPortrait(spec)) {
8152
- return [lineMark, ...blockMarks].filter(Boolean);
8149
+ return [lineMark, titleImageMark, ...blockMarks].filter(Boolean);
8153
8150
  }
8154
8151
  if (isArc(spec)) {
8155
- const centerImageMark = buildArcCenterImageMark(spec);
8152
+ const arcTitleImageMark = buildArcTitleImageMark(spec);
8156
8153
  const arcMark = buildArcMark(spec);
8157
- return [centerImageMark, arcMark, ...blockMarks].filter(Boolean);
8154
+ return [arcTitleImageMark, arcMark, ...blockMarks].filter(Boolean);
8158
8155
  }
8159
8156
  if (isClock(spec)) {
8160
8157
  const ringsMark = buildClockArcMark(spec);
8161
- const centerImageMark = buildClockCenterImageMark(spec);
8162
- return [ringsMark, ...blockMarks, centerImageMark].filter(Boolean);
8158
+ return [titleImageMark, ringsMark, ...blockMarks].filter(Boolean);
8163
8159
  }
8164
8160
  if (isWing(spec)) {
8165
8161
  const arcMark = buildWingArcMark(spec);
8166
- return [arcMark, ...blockMarks].filter(Boolean);
8162
+ const wingTitleImageMark = buildWingTitleImageMark(spec);
8163
+ return [arcMark, wingTitleImageMark, ...blockMarks].filter(Boolean);
8167
8164
  }
8168
8165
  if (isLadder(spec)) {
8169
8166
  const diagonalMark = buildLadderDiagonalMark(spec);
8170
8167
  const headlineMark = buildLadderHeadlineMark(spec);
8171
8168
  return [diagonalMark, headlineMark, ...blockMarks].filter(Boolean);
8172
8169
  }
8173
- return [lineMark, ...blockMarks].filter(Boolean);
8170
+ return [titleImageMark, lineMark, ...blockMarks].filter(Boolean);
8174
8171
  };
8175
8172
  const buildLineMark = (spec) => {
8176
8173
  var _a, _b, _c;