@visactor/vchart-extension 2.1.0-alpha.14 → 2.1.0-alpha.15

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 (85) hide show
  1. package/build/index.js +1960 -0
  2. package/build/index.min.js +2 -2
  3. package/cjs/charts/image-cloud/series/image-cloud.d.ts +138 -0
  4. package/cjs/charts/storyline/index.d.ts +4 -0
  5. package/cjs/charts/storyline/index.js +22 -0
  6. package/cjs/charts/storyline/index.js.map +1 -0
  7. package/cjs/charts/storyline/interface.d.ts +59 -0
  8. package/cjs/charts/storyline/interface.js +6 -0
  9. package/cjs/charts/storyline/interface.js.map +1 -0
  10. package/cjs/charts/storyline/layout.d.ts +53 -0
  11. package/cjs/charts/storyline/layout.js +215 -0
  12. package/cjs/charts/storyline/layout.js.map +1 -0
  13. package/cjs/charts/storyline/layouts/bowl.d.ts +5 -0
  14. package/cjs/charts/storyline/layouts/bowl.js +286 -0
  15. package/cjs/charts/storyline/layouts/bowl.js.map +1 -0
  16. package/cjs/charts/storyline/layouts/clock.d.ts +5 -0
  17. package/cjs/charts/storyline/layouts/clock.js +233 -0
  18. package/cjs/charts/storyline/layouts/clock.js.map +1 -0
  19. package/cjs/charts/storyline/layouts/common.d.ts +87 -0
  20. package/cjs/charts/storyline/layouts/common.js +287 -0
  21. package/cjs/charts/storyline/layouts/common.js.map +1 -0
  22. package/cjs/charts/storyline/layouts/default.d.ts +4 -0
  23. package/cjs/charts/storyline/layouts/default.js +179 -0
  24. package/cjs/charts/storyline/layouts/default.js.map +1 -0
  25. package/cjs/charts/storyline/layouts/dome.d.ts +5 -0
  26. package/cjs/charts/storyline/layouts/dome.js +286 -0
  27. package/cjs/charts/storyline/layouts/dome.js.map +1 -0
  28. package/cjs/charts/storyline/layouts/landscape.d.ts +4 -0
  29. package/cjs/charts/storyline/layouts/landscape.js +254 -0
  30. package/cjs/charts/storyline/layouts/landscape.js.map +1 -0
  31. package/cjs/charts/storyline/layouts/portrait.d.ts +4 -0
  32. package/cjs/charts/storyline/layouts/portrait.js +241 -0
  33. package/cjs/charts/storyline/layouts/portrait.js.map +1 -0
  34. package/cjs/charts/storyline/storyline-transformer.d.ts +4 -0
  35. package/cjs/charts/storyline/storyline-transformer.js +62 -0
  36. package/cjs/charts/storyline/storyline-transformer.js.map +1 -0
  37. package/cjs/charts/storyline/storyline.d.ts +16 -0
  38. package/cjs/charts/storyline/storyline.js +36 -0
  39. package/cjs/charts/storyline/storyline.js.map +1 -0
  40. package/cjs/components/map-label/map-label.d.ts +52 -0
  41. package/cjs/index.d.ts +1 -0
  42. package/cjs/index.js +5 -5
  43. package/cjs/index.js.map +1 -1
  44. package/esm/charts/image-cloud/series/image-cloud.d.ts +138 -0
  45. package/esm/charts/storyline/index.d.ts +4 -0
  46. package/esm/charts/storyline/index.js +8 -0
  47. package/esm/charts/storyline/index.js.map +1 -0
  48. package/esm/charts/storyline/interface.d.ts +59 -0
  49. package/esm/charts/storyline/interface.js +2 -0
  50. package/esm/charts/storyline/interface.js.map +1 -0
  51. package/esm/charts/storyline/layout.d.ts +53 -0
  52. package/esm/charts/storyline/layout.js +205 -0
  53. package/esm/charts/storyline/layout.js.map +1 -0
  54. package/esm/charts/storyline/layouts/bowl.d.ts +5 -0
  55. package/esm/charts/storyline/layouts/bowl.js +278 -0
  56. package/esm/charts/storyline/layouts/bowl.js.map +1 -0
  57. package/esm/charts/storyline/layouts/clock.d.ts +5 -0
  58. package/esm/charts/storyline/layouts/clock.js +227 -0
  59. package/esm/charts/storyline/layouts/clock.js.map +1 -0
  60. package/esm/charts/storyline/layouts/common.d.ts +87 -0
  61. package/esm/charts/storyline/layouts/common.js +255 -0
  62. package/esm/charts/storyline/layouts/common.js.map +1 -0
  63. package/esm/charts/storyline/layouts/default.d.ts +4 -0
  64. package/esm/charts/storyline/layouts/default.js +172 -0
  65. package/esm/charts/storyline/layouts/default.js.map +1 -0
  66. package/esm/charts/storyline/layouts/dome.d.ts +5 -0
  67. package/esm/charts/storyline/layouts/dome.js +278 -0
  68. package/esm/charts/storyline/layouts/dome.js.map +1 -0
  69. package/esm/charts/storyline/layouts/landscape.d.ts +4 -0
  70. package/esm/charts/storyline/layouts/landscape.js +250 -0
  71. package/esm/charts/storyline/layouts/landscape.js.map +1 -0
  72. package/esm/charts/storyline/layouts/portrait.d.ts +4 -0
  73. package/esm/charts/storyline/layouts/portrait.js +238 -0
  74. package/esm/charts/storyline/layouts/portrait.js.map +1 -0
  75. package/esm/charts/storyline/storyline-transformer.d.ts +4 -0
  76. package/esm/charts/storyline/storyline-transformer.js +61 -0
  77. package/esm/charts/storyline/storyline-transformer.js.map +1 -0
  78. package/esm/charts/storyline/storyline.d.ts +16 -0
  79. package/esm/charts/storyline/storyline.js +29 -0
  80. package/esm/charts/storyline/storyline.js.map +1 -0
  81. package/esm/components/map-label/map-label.d.ts +52 -0
  82. package/esm/index.d.ts +1 -0
  83. package/esm/index.js +2 -0
  84. package/esm/index.js.map +1 -1
  85. package/package.json +8 -8
@@ -0,0 +1,227 @@
1
+ import { LayoutZIndex } from "@visactor/vchart";
2
+
3
+ import { buildRichContent, getRegionGeometry, getThemeColor, normalizePadding, withAlpha } from "./common";
4
+
5
+ const CLOCK_CENTER_RADIUS_RATIO = .5, CLOCK_CENTER_IMAGE_INSET_RATIO = .86, CLOCK_ORBIT_RATIO = .58, CLOCK_DOT_RATIO = .58, CLOCK_TEXT_INNER_RATIO = .7, CLOCK_TEXT_MAX_WIDTH = 200, CLOCK_DOT_DIAMETER_RATIO = .24, CLOCK_LEAD_LINE_GAP = 6, CLOCK_TEXT_GAP_FROM_LEAD = 8, CLOCK_ORBIT_DASH = [ 4, 4 ], CLOCK_TITLE_FONT_SIZE = 13, CLOCK_TITLE_LINE_HEIGHT = 18, CLOCK_CONTENT_FONT_SIZE = 11, CLOCK_CONTENT_LINE_HEIGHT = 15, getClockGeometry = (spec, ctx) => {
6
+ var _a, _b, _c;
7
+ const {width: width, height: height, startX: startX, startY: startY} = getRegionGeometry(ctx), padding = normalizePadding(null === (_a = spec.block) || void 0 === _a ? void 0 : _a.padding), innerWidth = Math.max(width - padding.left - padding.right, 1), innerHeight = Math.max(height - padding.top - padding.bottom, 1), cx = startX + padding.left + innerWidth / 2, cy = startY + padding.top + innerHeight / 2, R = Math.max(Math.min(innerWidth, innerHeight) / 2, 1), count = null !== (_c = null === (_b = spec.data) || void 0 === _b ? void 0 : _b.length) && void 0 !== _c ? _c : 0;
8
+ return {
9
+ cx: cx,
10
+ cy: cy,
11
+ R: R,
12
+ count: count,
13
+ step: count > 0 ? 2 * Math.PI / count : 0
14
+ };
15
+ }, getClockBlockAngle = (geom, index) => -Math.PI / 2 + geom.step * (index + .5), polar = (cx, cy, r, angle) => ({
16
+ x: cx + Math.cos(angle) * r,
17
+ y: cy + Math.sin(angle) * r
18
+ }), isOnLeftHalf = angle => Math.cos(angle) < 0;
19
+
20
+ export const buildClockCenterImageMark = spec => {
21
+ var _a, _b, _c, _e;
22
+ if (!1 === (null === (_a = spec.centerImage) || void 0 === _a ? void 0 : _a.visible)) return null;
23
+ const themeColor = getThemeColor(spec), hasImage = !!(null === (_b = spec.centerImage) || void 0 === _b ? void 0 : _b.image);
24
+ return {
25
+ type: "group",
26
+ name: "storyline-clock-center",
27
+ zIndex: LayoutZIndex.Mark + 2,
28
+ children: [ {
29
+ type: "symbol",
30
+ name: "storyline-clock-center-halo",
31
+ interactive: !1,
32
+ style: {
33
+ x: (_d, ctx) => getClockGeometry(spec, ctx).cx,
34
+ y: (_d, ctx) => getClockGeometry(spec, ctx).cy,
35
+ size: (_d, ctx) => .5 * getClockGeometry(spec, ctx).R * 2.16,
36
+ symbolType: "circle",
37
+ fill: withAlpha(themeColor, .28),
38
+ stroke: "transparent"
39
+ }
40
+ }, hasImage ? {
41
+ type: "image",
42
+ name: "storyline-clock-center-image",
43
+ interactive: !1,
44
+ style: Object.assign({
45
+ x: (_d, ctx) => {
46
+ const g = getClockGeometry(spec, ctx);
47
+ return g.cx - .5 * g.R * .86;
48
+ },
49
+ y: (_d, ctx) => {
50
+ const g = getClockGeometry(spec, ctx);
51
+ return g.cy - .5 * g.R * .86;
52
+ },
53
+ width: (_d, ctx) => .5 * getClockGeometry(spec, ctx).R * .86 * 2,
54
+ height: (_d, ctx) => .5 * getClockGeometry(spec, ctx).R * .86 * 2,
55
+ image: null === (_c = spec.centerImage) || void 0 === _c ? void 0 : _c.image,
56
+ cornerRadius: (_d, ctx) => .5 * getClockGeometry(spec, ctx).R * .86,
57
+ repeatX: "no-repeat",
58
+ repeatY: "no-repeat",
59
+ imageMode: "cover",
60
+ imagePosition: "center"
61
+ }, null === (_e = spec.centerImage) || void 0 === _e ? void 0 : _e.style)
62
+ } : {
63
+ type: "symbol",
64
+ name: "storyline-clock-center-placeholder",
65
+ interactive: !1,
66
+ style: {
67
+ x: (_d, ctx) => getClockGeometry(spec, ctx).cx,
68
+ y: (_d, ctx) => getClockGeometry(spec, ctx).cy,
69
+ size: (_d, ctx) => .5 * getClockGeometry(spec, ctx).R * 2,
70
+ symbolType: "circle",
71
+ fill: "#ffffff",
72
+ stroke: themeColor,
73
+ lineWidth: 2
74
+ }
75
+ } ].filter(Boolean)
76
+ };
77
+ };
78
+
79
+ export const buildClockArcMark = spec => {
80
+ const themeColor = getThemeColor(spec);
81
+ return {
82
+ type: "group",
83
+ name: "storyline-clock-orbit",
84
+ zIndex: LayoutZIndex.Mark,
85
+ children: [ {
86
+ type: "path",
87
+ name: "storyline-clock-orbit-path",
88
+ interactive: !1,
89
+ style: {
90
+ path: (_d, ctx) => {
91
+ const g = getClockGeometry(spec, ctx), r = .58 * g.R;
92
+ return [ `M ${(g.cx + r).toFixed(2)} ${g.cy.toFixed(2)}`, `A ${r.toFixed(2)} ${r.toFixed(2)} 0 1 1 ${(g.cx - r).toFixed(2)} ${g.cy.toFixed(2)}`, `A ${r.toFixed(2)} ${r.toFixed(2)} 0 1 1 ${(g.cx + r).toFixed(2)} ${g.cy.toFixed(2)}` ].join(" ");
93
+ },
94
+ stroke: withAlpha(themeColor, .7),
95
+ lineWidth: 1,
96
+ lineDash: CLOCK_ORBIT_DASH,
97
+ fill: "transparent",
98
+ fillOpacity: 0
99
+ }
100
+ } ]
101
+ };
102
+ };
103
+
104
+ const getClockDotCenter = (spec, ctx, index) => {
105
+ const g = getClockGeometry(spec, ctx), angle = getClockBlockAngle(g, index), r = .58 * g.R;
106
+ return Object.assign(Object.assign({}, polar(g.cx, g.cy, r, angle)), {
107
+ diameter: .24 * g.R,
108
+ angle: angle
109
+ });
110
+ }, getClockLeadLine = (spec, ctx, index) => {
111
+ const g = getClockGeometry(spec, ctx), angle = getClockBlockAngle(g, index), dotR = .24 * g.R / 2;
112
+ return {
113
+ start: polar(g.cx, g.cy, .58 * g.R + dotR + 6, angle),
114
+ end: polar(g.cx, g.cy, .7 * g.R - 8, angle)
115
+ };
116
+ }, getClockTextRect = (spec, ctx, index) => {
117
+ var _a;
118
+ const g = getClockGeometry(spec, ctx), {width: regionWidth, startX: startX} = getRegionGeometry(ctx), padding = normalizePadding(null === (_a = spec.block) || void 0 === _a ? void 0 : _a.padding), angle = getClockBlockAngle(g, index), onLeft = isOnLeftHalf(angle), rInner = .7 * g.R, innerPoint = polar(g.cx, g.cy, rInner, angle), leftEdge = startX + padding.left, rightEdge = startX + regionWidth - padding.right, width = onLeft ? Math.min(Math.max(innerPoint.x - leftEdge, 80), 200) : Math.min(Math.max(rightEdge - innerPoint.x, 80), 200);
119
+ return {
120
+ x: innerPoint.x,
121
+ y: innerPoint.y,
122
+ width: width,
123
+ onLeft: onLeft,
124
+ anchorY: innerPoint.y
125
+ };
126
+ };
127
+
128
+ export const buildClockBlockMark = (spec, block, index) => {
129
+ var _a, _b, _c;
130
+ const hasImage = !!block.image, themeColor = getThemeColor(spec), contentText = Array.isArray(block.content) ? block.content : block.content ? [ block.content ] : [], children = [ {
131
+ type: "path",
132
+ name: `storyline-clock-lead-${index}`,
133
+ interactive: !1,
134
+ style: {
135
+ path: (_d, ctx) => {
136
+ const {start: start, end: end} = getClockLeadLine(spec, ctx, index);
137
+ return `M ${start.x.toFixed(2)} ${start.y.toFixed(2)} L ${end.x.toFixed(2)} ${end.y.toFixed(2)}`;
138
+ },
139
+ stroke: withAlpha(themeColor, .7),
140
+ lineWidth: 1,
141
+ lineDash: [ 3, 3 ],
142
+ fill: "transparent",
143
+ fillOpacity: 0
144
+ }
145
+ }, hasImage ? {
146
+ type: "image",
147
+ name: `storyline-clock-dot-${index}`,
148
+ interactive: !1,
149
+ style: {
150
+ x: (_d, ctx) => {
151
+ const dot = getClockDotCenter(spec, ctx, index);
152
+ return dot.x - dot.diameter / 2;
153
+ },
154
+ y: (_d, ctx) => {
155
+ const dot = getClockDotCenter(spec, ctx, index);
156
+ return dot.y - dot.diameter / 2;
157
+ },
158
+ width: (_d, ctx) => getClockDotCenter(spec, ctx, index).diameter,
159
+ height: (_d, ctx) => getClockDotCenter(spec, ctx, index).diameter,
160
+ image: block.image,
161
+ cornerRadius: (_d, ctx) => getClockDotCenter(spec, ctx, index).diameter / 2,
162
+ repeatX: "no-repeat",
163
+ repeatY: "no-repeat",
164
+ imageMode: "cover",
165
+ imagePosition: "center",
166
+ stroke: themeColor,
167
+ lineWidth: 2
168
+ }
169
+ } : {
170
+ type: "symbol",
171
+ name: `storyline-clock-dot-${index}`,
172
+ interactive: !1,
173
+ style: {
174
+ x: (_d, ctx) => getClockDotCenter(spec, ctx, index).x,
175
+ y: (_d, ctx) => getClockDotCenter(spec, ctx, index).y,
176
+ size: (_d, ctx) => getClockDotCenter(spec, ctx, index).diameter,
177
+ symbolType: "circle",
178
+ fill: themeColor,
179
+ stroke: "#ffffff",
180
+ lineWidth: 1.5
181
+ }
182
+ }, block.title ? Object.assign(Object.assign({
183
+ type: "text",
184
+ name: `storyline-clock-title-${index}`,
185
+ interactive: !1
186
+ }, spec.title), {
187
+ style: Object.assign({
188
+ x: (_d, ctx) => getClockTextRect(spec, ctx, index).x,
189
+ y: (_d, ctx) => getClockTextRect(spec, ctx, index).anchorY - 18,
190
+ text: block.title,
191
+ maxLineWidth: (_d, ctx) => getClockTextRect(spec, ctx, index).width,
192
+ fontSize: 13,
193
+ lineHeight: 18,
194
+ fontWeight: "bold",
195
+ fill: themeColor,
196
+ textAlign: (_d, ctx) => getClockTextRect(spec, ctx, index).onLeft ? "right" : "left",
197
+ textBaseline: "top"
198
+ }, null === (_a = spec.title) || void 0 === _a ? void 0 : _a.style)
199
+ }) : null, contentText.length ? Object.assign(Object.assign({
200
+ type: "text",
201
+ name: `storyline-clock-content-${index}`,
202
+ interactive: !1
203
+ }, spec.content), {
204
+ textType: "rich",
205
+ style: Object.assign({
206
+ x: (_d, ctx) => getClockTextRect(spec, ctx, index).x,
207
+ y: (_d, ctx) => getClockTextRect(spec, ctx, index).anchorY + 4,
208
+ width: (_d, ctx) => getClockTextRect(spec, ctx, index).width,
209
+ maxLineWidth: (_d, ctx) => getClockTextRect(spec, ctx, index).width,
210
+ text: buildRichContent(contentText, spec),
211
+ fontSize: 11,
212
+ lineHeight: 15,
213
+ fill: "#3a3f4d",
214
+ textAlign: (_d, ctx) => getClockTextRect(spec, ctx, index).onLeft ? "right" : "left",
215
+ textBaseline: "top",
216
+ wordBreak: "break-word"
217
+ }, null === (_b = spec.content) || void 0 === _b ? void 0 : _b.style)
218
+ }) : null ];
219
+ return {
220
+ type: "group",
221
+ id: `storyline-block-${null !== (_c = block.id) && void 0 !== _c ? _c : index}`,
222
+ name: `storyline-block-${index}`,
223
+ zIndex: LayoutZIndex.Mark + 1,
224
+ children: children.filter(Boolean)
225
+ };
226
+ };
227
+ //# sourceMappingURL=clock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/charts/storyline/layouts/clock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EAGL,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,SAAS,EACV,MAAM,UAAU,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EAAE,CAAC,EAAW,EAAE,GAAkB,EAAE,EAAE,CAAC,gBAAgB,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC,KAAK,EACpF,YAAY,EAAE,CAAC,EAAW,EAAE,GAAkB,EAAE,EAAE,CAAC,gBAAgB,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC,KAAK,EAC3F,IAAI,EAAE,gBAAgB,CAAC,WAAW,EAAE,IAAI,CAAC,EACzC,QAAQ,EAAE,uBAAuB,EACjC,UAAU,EAAE,yBAAyB,EACrC,IAAI,EAAE,SAAS,EACf,SAAS,EAAE,CAAC,EAAW,EAAE,GAAkB,EAAE,EAAE,CAC7C,gBAAgB,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAC9D,YAAY,EAAE,KAAK,EACnB,SAAS,EAAE,YAAY,IACpB,MAAA,IAAI,CAAC,OAAO,0CAAE,KAAK,IAEG;YAC/B,CAAC,CAAC,IAAI;KACT,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,OAAc;QACpB,EAAE,EAAE,mBAAmB,MAAA,KAAK,CAAC,EAAE,mCAAI,KAAK,EAAE;QAC1C,IAAI,EAAE,mBAAmB,KAAK,EAAE;QAChC,MAAM,EAAE,YAAY,CAAC,IAAI,GAAG,CAAC;QAC7B,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,OAAO,CAA2B;KAC7D,CAAC;AACJ,CAAC,CAAC","file":"clock.js","sourcesContent":["import type { IExtensionGroupMarkSpec } from '@visactor/vchart';\nimport { LayoutZIndex } from '@visactor/vchart';\nimport type { IStorylineBlock, IStorylineSpec } from '../interface';\nimport {\n type ICustomMarkSpec,\n type LayoutContext,\n buildRichContent,\n getRegionGeometry,\n getThemeColor,\n normalizePadding,\n withAlpha\n} from './common';\n\n/**\n * clock 布局:环绕式时间线(orbit timeline)\n *\n * 视觉结构(参考报刊版式):\n *\n * ┌──────── 外侧文字段(title + content)─────────┐\n * │ │\n * ●●● │ ┌───── 虚线轨道圆环 ─────┐ │\n * 圆形 dot ──────引线──────┤ │\n * │ │ ◎ centerImage │\n * │ │ (大圆人像) │\n * │ └───────────────────────┘\n * └─────────────────────────────────────────────┘\n *\n * - centerImage:圆形大图,位于版面中心\n * - 虚线轨道:紧贴 centerImage 外侧的圆环,提供时间线的视觉骨架\n * - 每个 block 由 1 个圆形小图(dot)压在轨道上,外加一段从 dot 引出的 title + content 文字\n * - block 沿轨道环绕分布(默认 360°);左半圆 block 文字 right-align,右半圆 block 文字 left-align\n */\n\n// ===== 半径配置(按可用半径的比例划分各圈层)=====\nconst CLOCK_CENTER_RADIUS_RATIO = 0.5; // 中心圆半径\nconst CLOCK_CENTER_IMAGE_INSET_RATIO = 0.86; // centerImage 相对中心圆的尺寸比例(留出环形空隙)\nconst CLOCK_ORBIT_RATIO = 0.58; // 虚线轨道半径\nconst CLOCK_DOT_RATIO = 0.58; // 圆形小图(dot)中心所在半径(与轨道重合)\nconst CLOCK_TEXT_INNER_RATIO = 0.7; // block 文字段起始半径\nconst CLOCK_TEXT_MAX_WIDTH = 200; // 文字段最大宽度,避免靠近正上/正下的 block 占满整个画布半宽\n\n// ===== 元素尺寸 =====\nconst CLOCK_DOT_DIAMETER_RATIO = 0.24; // dot 直径相对 R\nconst CLOCK_LEAD_LINE_GAP = 6; // dot 到引线起点的间距 px\nconst CLOCK_TEXT_GAP_FROM_LEAD = 8; // 引线到文字的间距 px\nconst CLOCK_ORBIT_DASH = [4, 4];\n\n// ===== 文字 =====\nconst CLOCK_TITLE_FONT_SIZE = 13;\nconst CLOCK_TITLE_LINE_HEIGHT = 18;\nconst CLOCK_CONTENT_FONT_SIZE = 11;\nconst CLOCK_CONTENT_LINE_HEIGHT = 15;\n\n// ===== 几何 =====\n\ntype ClockGeometry = {\n cx: number;\n cy: number;\n R: number; // 整盘外半径\n count: number;\n step: number;\n};\n\nconst getClockGeometry = (spec: IStorylineSpec, ctx: LayoutContext): ClockGeometry => {\n const { width, height, startX, startY } = getRegionGeometry(ctx);\n const padding = normalizePadding(spec.block?.padding);\n const innerWidth = Math.max(width - padding.left - padding.right, 1);\n const innerHeight = Math.max(height - padding.top - padding.bottom, 1);\n const cx = startX + padding.left + innerWidth / 2;\n const cy = startY + padding.top + innerHeight / 2;\n const R = Math.max(Math.min(innerWidth, innerHeight) / 2, 1);\n const count = spec.data?.length ?? 0;\n const step = count > 0 ? (Math.PI * 2) / count : 0;\n return { cx, cy, R, count, step };\n};\n\n/**\n * 第 index 个 block 在轨道上的角度。\n * - 0° = 正上方(12 点钟)\n * - 顺时针递增\n */\nconst getClockBlockAngle = (geom: ClockGeometry, index: number) => -Math.PI / 2 + geom.step * (index + 0.5);\n\nconst polar = (cx: number, cy: number, r: number, angle: number) => ({\n x: cx + Math.cos(angle) * r,\n y: cy + Math.sin(angle) * r\n});\n\n/**\n * 判断 block 在版面左半边还是右半边。\n * 用于决定 block 文字的对齐方向(左半边 right-align,右半边 left-align)。\n */\nconst isOnLeftHalf = (angle: number) => Math.cos(angle) < 0;\n\n// ===== 中心圆 =====\n\nexport const buildClockCenterImageMark = (spec: IStorylineSpec): IExtensionGroupMarkSpec | null => {\n if (spec.centerImage?.visible === false) {\n return null;\n }\n const themeColor = getThemeColor(spec);\n const hasImage = !!spec.centerImage?.image;\n return {\n type: 'group' as any,\n name: 'storyline-clock-center',\n zIndex: LayoutZIndex.Mark + 2,\n children: [\n // centerImage 背后的高亮光晕(主题色透明色,营造\"焦点\"效果)\n {\n type: 'symbol',\n name: 'storyline-clock-center-halo',\n interactive: false,\n style: {\n x: (_d: unknown, ctx: LayoutContext) => getClockGeometry(spec, ctx).cx,\n y: (_d: unknown, ctx: LayoutContext) => getClockGeometry(spec, ctx).cy,\n size: (_d: unknown, ctx: LayoutContext) => {\n const g = getClockGeometry(spec, ctx);\n return g.R * CLOCK_CENTER_RADIUS_RATIO * 2.16;\n },\n symbolType: 'circle',\n fill: withAlpha(themeColor, 0.28),\n stroke: 'transparent'\n }\n } as ICustomMarkSpec<'symbol'>,\n hasImage\n ? ({\n type: 'image',\n name: 'storyline-clock-center-image',\n interactive: false,\n style: {\n x: (_d: unknown, ctx: LayoutContext) => {\n const g = getClockGeometry(spec, ctx);\n return g.cx - g.R * CLOCK_CENTER_RADIUS_RATIO * CLOCK_CENTER_IMAGE_INSET_RATIO;\n },\n y: (_d: unknown, ctx: LayoutContext) => {\n const g = getClockGeometry(spec, ctx);\n return g.cy - g.R * CLOCK_CENTER_RADIUS_RATIO * CLOCK_CENTER_IMAGE_INSET_RATIO;\n },\n width: (_d: unknown, ctx: LayoutContext) =>\n getClockGeometry(spec, ctx).R * CLOCK_CENTER_RADIUS_RATIO * CLOCK_CENTER_IMAGE_INSET_RATIO * 2,\n height: (_d: unknown, ctx: LayoutContext) =>\n getClockGeometry(spec, ctx).R * CLOCK_CENTER_RADIUS_RATIO * CLOCK_CENTER_IMAGE_INSET_RATIO * 2,\n image: spec.centerImage?.image,\n cornerRadius: (_d: unknown, ctx: LayoutContext) =>\n getClockGeometry(spec, ctx).R * CLOCK_CENTER_RADIUS_RATIO * CLOCK_CENTER_IMAGE_INSET_RATIO,\n repeatX: 'no-repeat',\n repeatY: 'no-repeat',\n imageMode: 'cover',\n imagePosition: 'center',\n ...spec.centerImage?.style\n }\n } as ICustomMarkSpec<'image'>)\n : ({\n type: 'symbol',\n name: 'storyline-clock-center-placeholder',\n interactive: false,\n style: {\n x: (_d: unknown, ctx: LayoutContext) => getClockGeometry(spec, ctx).cx,\n y: (_d: unknown, ctx: LayoutContext) => getClockGeometry(spec, ctx).cy,\n size: (_d: unknown, ctx: LayoutContext) => getClockGeometry(spec, ctx).R * CLOCK_CENTER_RADIUS_RATIO * 2,\n symbolType: 'circle',\n fill: '#ffffff',\n stroke: themeColor,\n lineWidth: 2\n }\n } as ICustomMarkSpec<'symbol'>)\n ].filter(Boolean) as ICustomMarkSpec<any>[]\n };\n};\n\n// ===== 虚线轨道 =====\n\n/**\n * 紧贴 centerImage 外侧的虚线圆环轨道。\n */\nexport const buildClockArcMark = (spec: IStorylineSpec): IExtensionGroupMarkSpec | null => {\n const themeColor = getThemeColor(spec);\n\n const orbitPath = (_d: unknown, ctx: LayoutContext) => {\n const g = getClockGeometry(spec, ctx);\n const r = g.R * CLOCK_ORBIT_RATIO;\n return [\n `M ${(g.cx + r).toFixed(2)} ${g.cy.toFixed(2)}`,\n `A ${r.toFixed(2)} ${r.toFixed(2)} 0 1 1 ${(g.cx - r).toFixed(2)} ${g.cy.toFixed(2)}`,\n `A ${r.toFixed(2)} ${r.toFixed(2)} 0 1 1 ${(g.cx + r).toFixed(2)} ${g.cy.toFixed(2)}`\n ].join(' ');\n };\n\n return {\n type: 'group' as any,\n name: 'storyline-clock-orbit',\n zIndex: LayoutZIndex.Mark,\n children: [\n {\n type: 'path',\n name: 'storyline-clock-orbit-path',\n interactive: false,\n style: {\n path: orbitPath,\n stroke: withAlpha(themeColor, 0.7),\n lineWidth: 1,\n lineDash: CLOCK_ORBIT_DASH,\n fill: 'transparent',\n fillOpacity: 0\n }\n } as ICustomMarkSpec<'path'>\n ]\n };\n};\n\n// ===== block:dot + 引线 + 文字段 =====\n\nconst getClockDotCenter = (spec: IStorylineSpec, ctx: LayoutContext, index: number) => {\n const g = getClockGeometry(spec, ctx);\n const angle = getClockBlockAngle(g, index);\n const r = g.R * CLOCK_DOT_RATIO;\n return { ...polar(g.cx, g.cy, r, angle), diameter: g.R * CLOCK_DOT_DIAMETER_RATIO, angle };\n};\n\n/**\n * 引线(dot 外缘 → 文字段内边)的两个端点。\n */\nconst getClockLeadLine = (spec: IStorylineSpec, ctx: LayoutContext, index: number) => {\n const g = getClockGeometry(spec, ctx);\n const angle = getClockBlockAngle(g, index);\n const dotR = (g.R * CLOCK_DOT_DIAMETER_RATIO) / 2;\n const start = polar(g.cx, g.cy, g.R * CLOCK_DOT_RATIO + dotR + CLOCK_LEAD_LINE_GAP, angle);\n const end = polar(g.cx, g.cy, g.R * CLOCK_TEXT_INNER_RATIO - CLOCK_TEXT_GAP_FROM_LEAD, angle);\n return { start, end };\n};\n\n/**\n * block 文字段的矩形(中心 + 宽高 + 对齐)。\n * 文字段沿水平方向从 dot 一侧外延:\n * - 左半圆:文字右对齐,向左延伸至画布左边界(含 padding)\n * - 右半圆:文字左对齐,向右延伸至画布右边界(含 padding)\n * 这样所有 block 的可用宽度都是一致的\"画布半宽 - 中心圆半径\",避免出现窄文字。\n */\nconst getClockTextRect = (spec: IStorylineSpec, ctx: LayoutContext, index: number) => {\n const g = getClockGeometry(spec, ctx);\n const { width: regionWidth, startX } = getRegionGeometry(ctx);\n const padding = normalizePadding(spec.block?.padding);\n const angle = getClockBlockAngle(g, index);\n const onLeft = isOnLeftHalf(angle);\n // 文字段从 dot 外侧的 inner ring 处开始水平延展\n const rInner = g.R * CLOCK_TEXT_INNER_RATIO;\n const innerPoint = polar(g.cx, g.cy, rInner, angle);\n // 画布水平边界(含 padding)\n const leftEdge = startX + padding.left;\n const rightEdge = startX + regionWidth - padding.right;\n const width = onLeft\n ? Math.min(Math.max(innerPoint.x - leftEdge, 80), CLOCK_TEXT_MAX_WIDTH)\n : Math.min(Math.max(rightEdge - innerPoint.x, 80), CLOCK_TEXT_MAX_WIDTH);\n return { x: innerPoint.x, y: innerPoint.y, width, onLeft, anchorY: innerPoint.y };\n};\n\nexport const buildClockBlockMark = (\n spec: IStorylineSpec,\n block: IStorylineBlock,\n index: number\n): IExtensionGroupMarkSpec => {\n const hasImage = !!block.image;\n const themeColor = getThemeColor(spec);\n const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];\n\n const leadPath = (_d: unknown, ctx: LayoutContext) => {\n const { start, end } = getClockLeadLine(spec, ctx, index);\n return `M ${start.x.toFixed(2)} ${start.y.toFixed(2)} L ${end.x.toFixed(2)} ${end.y.toFixed(2)}`;\n };\n\n const children: (ICustomMarkSpec<any> | null)[] = [\n // 引线:从 dot 外缘到文字段内边\n {\n type: 'path',\n name: `storyline-clock-lead-${index}`,\n interactive: false,\n style: {\n path: leadPath,\n stroke: withAlpha(themeColor, 0.7),\n lineWidth: 1,\n lineDash: [3, 3],\n fill: 'transparent',\n fillOpacity: 0\n }\n } as ICustomMarkSpec<'path'>,\n // 圆形小图(dot):压在轨道上,作为时间锚点\n hasImage\n ? ({\n type: 'image',\n name: `storyline-clock-dot-${index}`,\n interactive: false,\n style: {\n x: (_d: unknown, ctx: LayoutContext) => {\n const dot = getClockDotCenter(spec, ctx, index);\n return dot.x - dot.diameter / 2;\n },\n y: (_d: unknown, ctx: LayoutContext) => {\n const dot = getClockDotCenter(spec, ctx, index);\n return dot.y - dot.diameter / 2;\n },\n width: (_d: unknown, ctx: LayoutContext) => getClockDotCenter(spec, ctx, index).diameter,\n height: (_d: unknown, ctx: LayoutContext) => getClockDotCenter(spec, ctx, index).diameter,\n image: block.image,\n cornerRadius: (_d: unknown, ctx: LayoutContext) => getClockDotCenter(spec, ctx, index).diameter / 2,\n repeatX: 'no-repeat',\n repeatY: 'no-repeat',\n imageMode: 'cover',\n imagePosition: 'center',\n stroke: themeColor,\n lineWidth: 2\n }\n } as ICustomMarkSpec<'image'>)\n : ({\n type: 'symbol',\n name: `storyline-clock-dot-${index}`,\n interactive: false,\n style: {\n x: (_d: unknown, ctx: LayoutContext) => getClockDotCenter(spec, ctx, index).x,\n y: (_d: unknown, ctx: LayoutContext) => getClockDotCenter(spec, ctx, index).y,\n size: (_d: unknown, ctx: LayoutContext) => getClockDotCenter(spec, ctx, index).diameter,\n symbolType: 'circle',\n fill: themeColor,\n stroke: '#ffffff',\n lineWidth: 1.5\n }\n } as ICustomMarkSpec<'symbol'>),\n // title:文字段的第一行\n block.title\n ? ({\n type: 'text',\n name: `storyline-clock-title-${index}`,\n interactive: false,\n ...spec.title,\n style: {\n x: (_d: unknown, ctx: LayoutContext) => getClockTextRect(spec, ctx, index).x,\n y: (_d: unknown, ctx: LayoutContext) =>\n getClockTextRect(spec, ctx, index).anchorY - CLOCK_TITLE_LINE_HEIGHT,\n text: block.title,\n maxLineWidth: (_d: unknown, ctx: LayoutContext) => getClockTextRect(spec, ctx, index).width,\n fontSize: CLOCK_TITLE_FONT_SIZE,\n lineHeight: CLOCK_TITLE_LINE_HEIGHT,\n fontWeight: 'bold',\n fill: themeColor,\n textAlign: (_d: unknown, ctx: LayoutContext) =>\n getClockTextRect(spec, ctx, index).onLeft ? 'right' : 'left',\n textBaseline: 'top',\n ...spec.title?.style\n }\n } as ICustomMarkSpec<'text'>)\n : null,\n // content:富文本,title 下方\n contentText.length\n ? ({\n type: 'text',\n name: `storyline-clock-content-${index}`,\n interactive: false,\n ...spec.content,\n textType: 'rich',\n style: {\n x: (_d: unknown, ctx: LayoutContext) => getClockTextRect(spec, ctx, index).x,\n y: (_d: unknown, ctx: LayoutContext) => getClockTextRect(spec, ctx, index).anchorY + 4,\n width: (_d: unknown, ctx: LayoutContext) => getClockTextRect(spec, ctx, index).width,\n maxLineWidth: (_d: unknown, ctx: LayoutContext) => getClockTextRect(spec, ctx, index).width,\n text: buildRichContent(contentText, spec),\n fontSize: CLOCK_CONTENT_FONT_SIZE,\n lineHeight: CLOCK_CONTENT_LINE_HEIGHT,\n fill: '#3a3f4d',\n textAlign: (_d: unknown, ctx: LayoutContext) =>\n getClockTextRect(spec, ctx, index).onLeft ? 'right' : 'left',\n textBaseline: 'top',\n wordBreak: 'break-word',\n ...spec.content?.style\n }\n } as ICustomMarkSpec<'text'>)\n : null\n ];\n\n return {\n type: 'group' as any,\n id: `storyline-block-${block.id ?? index}`,\n name: `storyline-block-${index}`,\n zIndex: LayoutZIndex.Mark + 1,\n children: children.filter(Boolean) as ICustomMarkSpec<any>[]\n };\n};\n"]}
@@ -0,0 +1,87 @@
1
+ import type { ICustomMarkSpec } from '@visactor/vchart';
2
+ import type { IStorylineBlock, IStorylineSpec, StorylineImagePosition } from '../interface';
3
+ import { normalizeLayout, normalizePadding, type StorylineLayoutResult, type StorylinePoint } from '../layout';
4
+ export type LayoutContext = {
5
+ chart?: {
6
+ getAllRegions?: () => {
7
+ getLayoutRect?: () => {
8
+ width?: number;
9
+ height?: number;
10
+ };
11
+ getLayoutStartPoint?: () => {
12
+ x?: number;
13
+ y?: number;
14
+ };
15
+ }[];
16
+ getLayoutRect?: () => {
17
+ width?: number;
18
+ height?: number;
19
+ };
20
+ };
21
+ getLayoutBounds?: () => {
22
+ width?: () => number;
23
+ height?: () => number;
24
+ };
25
+ };
26
+ export declare const DEFAULT_BLOCK_WIDTH = 180;
27
+ export declare const DEFAULT_BLOCK_HEIGHT = 112;
28
+ export declare const DEFAULT_BLOCK_WIDTH_RATIO = 0.24;
29
+ export declare const DEFAULT_BLOCK_GAP = 36;
30
+ export declare const DEFAULT_IMAGE_WIDTH = 48;
31
+ export declare const DEFAULT_IMAGE_HEIGHT = 48;
32
+ export declare const DEFAULT_IMAGE_GAP = 10;
33
+ export declare const DEFAULT_THEME_COLOR = "#e8543d";
34
+ export declare const isLandscape: (spec: IStorylineSpec) => boolean;
35
+ export declare const isPortrait: (spec: IStorylineSpec) => boolean;
36
+ export declare const isClock: (spec: IStorylineSpec) => boolean;
37
+ export declare const isDome: (spec: IStorylineSpec) => boolean;
38
+ export declare const isBowl: (spec: IStorylineSpec) => boolean;
39
+ export declare const getThemeColor: (spec: IStorylineSpec) => string;
40
+ export declare const withAlpha: (color: string, alpha: number) => string;
41
+ export declare const resolveBlockWidth: (spec: IStorylineSpec, viewWidth: number) => number;
42
+ export declare const getRegionGeometry: (ctx: LayoutContext) => {
43
+ width: number;
44
+ height: number;
45
+ startX: number;
46
+ startY: number;
47
+ };
48
+ export declare const getLayout: (spec: IStorylineSpec, ctx: LayoutContext) => StorylineLayoutResult;
49
+ export declare const buildRichContent: (contentText: string[], spec: IStorylineSpec) => {
50
+ type: "rich";
51
+ text: {
52
+ text: string;
53
+ fontSize: number;
54
+ lineHeight: number;
55
+ fill: string;
56
+ }[];
57
+ };
58
+ export declare const omitImageLayoutSpec: (imageSpec: IStorylineSpec['image']) => {
59
+ id?: import("@visactor/vchart").StringOrNumber;
60
+ interactive?: boolean;
61
+ zIndex?: number;
62
+ visible?: boolean;
63
+ style?: import("@visactor/vchart").ConvertToMarkStyleSpec<import("@visactor/vchart").IImageMarkSpec>;
64
+ state?: import("@visactor/vchart").IMarkStateFullSpec<import("@visactor/vchart").IImageMarkSpec>;
65
+ stateSort?: (stateA: string, stateB: string) => number;
66
+ support3d?: boolean;
67
+ customShape?: (datum: any[], attrs: any, path: import("@visactor/vrender-core").ICustomPath2D) => import("@visactor/vrender-core").ICustomPath2D;
68
+ large?: boolean;
69
+ largeThreshold?: number;
70
+ progressiveStep?: number;
71
+ progressiveThreshold?: number;
72
+ };
73
+ export declare const getImageBox: (position: StorylineImagePosition, blockWidth: number, blockHeight: number, padding: ReturnType<typeof normalizePadding>, width: number, height: number, _gap: number, visible: boolean) => {
74
+ x: number;
75
+ y: number;
76
+ width: number;
77
+ height: number;
78
+ };
79
+ export declare const getTextBox: (position: StorylineImagePosition, blockWidth: number, blockHeight: number, padding: ReturnType<typeof normalizePadding>, imageWidth: number, imageHeight: number, imageGap: number, hasImage: boolean) => {
80
+ x: number;
81
+ y: number;
82
+ width: number;
83
+ height: number;
84
+ };
85
+ export declare const buildSmoothCurvePath: (points: StorylinePoint[]) => string;
86
+ export { normalizeLayout, normalizePadding };
87
+ export type { IStorylineBlock, ICustomMarkSpec, StorylinePoint };
@@ -0,0 +1,255 @@
1
+ var __rest = this && this.__rest || function(s, e) {
2
+ var t = {};
3
+ for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
4
+ if (null != s && "function" == typeof Object.getOwnPropertySymbols) {
5
+ var i = 0;
6
+ for (p = Object.getOwnPropertySymbols(s); i < p.length; i++) e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]) && (t[p[i]] = s[p[i]]);
7
+ }
8
+ return t;
9
+ };
10
+
11
+ import { computeStorylineLayout, normalizeLayout, normalizePadding } from "../layout";
12
+
13
+ export const DEFAULT_BLOCK_WIDTH = 180;
14
+
15
+ export const DEFAULT_BLOCK_HEIGHT = 112;
16
+
17
+ export const DEFAULT_BLOCK_WIDTH_RATIO = .24;
18
+
19
+ export const DEFAULT_BLOCK_GAP = 36;
20
+
21
+ export const DEFAULT_IMAGE_WIDTH = 48;
22
+
23
+ export const DEFAULT_IMAGE_HEIGHT = 48;
24
+
25
+ export const DEFAULT_IMAGE_GAP = 10;
26
+
27
+ export const DEFAULT_THEME_COLOR = "#e8543d";
28
+
29
+ export const isLandscape = spec => "landscape" === normalizeLayout(spec.layout).type;
30
+
31
+ export const isPortrait = spec => "portrait" === normalizeLayout(spec.layout).type;
32
+
33
+ export const isClock = spec => "clock" === normalizeLayout(spec.layout).type;
34
+
35
+ export const isDome = spec => "dome" === normalizeLayout(spec.layout).type;
36
+
37
+ export const isBowl = spec => "bowl" === normalizeLayout(spec.layout).type;
38
+
39
+ export const getThemeColor = spec => {
40
+ var _a;
41
+ return null !== (_a = spec.themeColor) && void 0 !== _a ? _a : "#e8543d";
42
+ };
43
+
44
+ export const withAlpha = (color, alpha) => {
45
+ const safeAlpha = Math.max(0, Math.min(1, alpha));
46
+ if (!color) return `rgba(0, 0, 0, ${safeAlpha})`;
47
+ const trimmed = color.trim();
48
+ if (trimmed.startsWith("#")) {
49
+ let hex = trimmed.slice(1);
50
+ if (3 !== hex.length && 4 !== hex.length || (hex = hex.split("").map((ch => ch + ch)).join("")),
51
+ 6 === hex.length || 8 === hex.length) {
52
+ return `rgba(${parseInt(hex.slice(0, 2), 16)}, ${parseInt(hex.slice(2, 4), 16)}, ${parseInt(hex.slice(4, 6), 16)}, ${safeAlpha})`;
53
+ }
54
+ }
55
+ const rgbMatch = trimmed.match(/^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)/i);
56
+ return rgbMatch ? `rgba(${rgbMatch[1]}, ${rgbMatch[2]}, ${rgbMatch[3]}, ${safeAlpha})` : trimmed;
57
+ };
58
+
59
+ export const resolveBlockWidth = (spec, viewWidth) => {
60
+ var _a, _b, _c, _d, _e, _f, _g;
61
+ if (null === (_a = spec.block) || void 0 === _a ? void 0 : _a.width) return spec.block.width;
62
+ const ratio = null !== (_c = null === (_b = spec.block) || void 0 === _b ? void 0 : _b.widthRatio) && void 0 !== _c ? _c : .24, minWidth = null !== (_e = null === (_d = spec.block) || void 0 === _d ? void 0 : _d.minWidth) && void 0 !== _e ? _e : 180, maxWidth = null !== (_g = null === (_f = spec.block) || void 0 === _f ? void 0 : _f.maxWidth) && void 0 !== _g ? _g : Math.max(minWidth, 320);
63
+ return Math.max(minWidth, Math.min(maxWidth, Math.round(viewWidth * ratio)));
64
+ };
65
+
66
+ export const getRegionGeometry = ctx => {
67
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
68
+ const region = null === (_c = null === (_b = null === (_a = ctx.chart) || void 0 === _a ? void 0 : _a.getAllRegions) || void 0 === _b ? void 0 : _b.call(_a)) || void 0 === _c ? void 0 : _c[0], regionRect = null === (_d = null == region ? void 0 : region.getLayoutRect) || void 0 === _d ? void 0 : _d.call(region), regionStart = null === (_e = null == region ? void 0 : region.getLayoutStartPoint) || void 0 === _e ? void 0 : _e.call(region), chartRect = null === (_g = null === (_f = ctx.chart) || void 0 === _f ? void 0 : _f.getLayoutRect) || void 0 === _g ? void 0 : _g.call(_f), bounds = null === (_h = ctx.getLayoutBounds) || void 0 === _h ? void 0 : _h.call(ctx);
69
+ return {
70
+ width: Math.max(null !== (_m = null !== (_k = null !== (_j = null == regionRect ? void 0 : regionRect.width) && void 0 !== _j ? _j : null == chartRect ? void 0 : chartRect.width) && void 0 !== _k ? _k : null === (_l = null == bounds ? void 0 : bounds.width) || void 0 === _l ? void 0 : _l.call(bounds)) && void 0 !== _m ? _m : 0, 1),
71
+ height: Math.max(null !== (_r = null !== (_p = null !== (_o = null == regionRect ? void 0 : regionRect.height) && void 0 !== _o ? _o : null == chartRect ? void 0 : chartRect.height) && void 0 !== _p ? _p : null === (_q = null == bounds ? void 0 : bounds.height) || void 0 === _q ? void 0 : _q.call(bounds)) && void 0 !== _r ? _r : 0, 1),
72
+ startX: null !== (_s = null == regionStart ? void 0 : regionStart.x) && void 0 !== _s ? _s : 0,
73
+ startY: null !== (_t = null == regionStart ? void 0 : regionStart.y) && void 0 !== _t ? _t : 0
74
+ };
75
+ };
76
+
77
+ export const getLayout = (spec, ctx) => {
78
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
79
+ const {width: width, height: height, startX: startX, startY: startY} = getRegionGeometry(ctx);
80
+ let blockWidth = resolveBlockWidth(spec, width), blockHeight = null !== (_b = null === (_a = spec.block) || void 0 === _a ? void 0 : _a.height) && void 0 !== _b ? _b : 112;
81
+ if (isLandscape(spec) && !(null === (_c = spec.block) || void 0 === _c ? void 0 : _c.width)) {
82
+ const count = null !== (_e = null === (_d = spec.data) || void 0 === _d ? void 0 : _d.length) && void 0 !== _e ? _e : 0;
83
+ if (count > 0) {
84
+ const padding = normalizePadding(null === (_f = spec.block) || void 0 === _f ? void 0 : _f.padding), LANDSCAPE_IMAGE_MIN_WIDTH = 80, adaptive = (Math.max(width - padding.left - padding.right, 1) - 40 * Math.max(count - 1, 0)) / count;
85
+ blockWidth = Math.max(LANDSCAPE_IMAGE_MIN_WIDTH, Math.floor(adaptive));
86
+ }
87
+ }
88
+ if (isPortrait(spec) && !(null === (_g = spec.block) || void 0 === _g ? void 0 : _g.height)) {
89
+ const count = null !== (_j = null === (_h = spec.data) || void 0 === _h ? void 0 : _h.length) && void 0 !== _j ? _j : 0;
90
+ if (count > 0) {
91
+ const padding = normalizePadding(null === (_k = spec.block) || void 0 === _k ? void 0 : _k.padding), innerHeight = Math.max(height - padding.top - padding.bottom, 1);
92
+ blockHeight = Math.max(160, Math.floor(innerHeight / count));
93
+ }
94
+ }
95
+ const result = computeStorylineLayout(null !== (_l = spec.data) && void 0 !== _l ? _l : [], {
96
+ layout: spec.layout,
97
+ viewBox: {
98
+ width: width,
99
+ height: height
100
+ },
101
+ block: {
102
+ width: blockWidth,
103
+ height: blockHeight
104
+ },
105
+ gap: null !== (_o = null === (_m = spec.block) || void 0 === _m ? void 0 : _m.gap) && void 0 !== _o ? _o : 36,
106
+ padding: null === (_p = spec.block) || void 0 === _p ? void 0 : _p.padding,
107
+ lineDistance: null === (_q = spec.line) || void 0 === _q ? void 0 : _q.distance
108
+ });
109
+ return startX || startY ? Object.assign(Object.assign({}, result), {
110
+ blocks: result.blocks.map((block => Object.assign(Object.assign({}, block), {
111
+ x: block.x + startX,
112
+ y: block.y + startY,
113
+ center: {
114
+ x: block.center.x + startX,
115
+ y: block.center.y + startY
116
+ }
117
+ }))),
118
+ links: result.links.map((link => Object.assign(Object.assign({}, link), {
119
+ start: {
120
+ x: link.start.x + startX,
121
+ y: link.start.y + startY
122
+ },
123
+ end: {
124
+ x: link.end.x + startX,
125
+ y: link.end.y + startY
126
+ },
127
+ points: link.points.map((point => ({
128
+ x: point.x + startX,
129
+ y: point.y + startY
130
+ })))
131
+ })))
132
+ }) : result;
133
+ };
134
+
135
+ export const buildRichContent = (contentText, spec) => {
136
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
137
+ const fontSize = Number(null !== (_c = null === (_b = null === (_a = spec.content) || void 0 === _a ? void 0 : _a.style) || void 0 === _b ? void 0 : _b.fontSize) && void 0 !== _c ? _c : 12), lineHeight = Number(null !== (_f = null === (_e = null === (_d = spec.content) || void 0 === _d ? void 0 : _d.style) || void 0 === _e ? void 0 : _e.lineHeight) && void 0 !== _f ? _f : 18), fill = null !== (_j = null === (_h = null === (_g = spec.content) || void 0 === _g ? void 0 : _g.style) || void 0 === _h ? void 0 : _h.fill) && void 0 !== _j ? _j : "#596173";
138
+ return {
139
+ type: "rich",
140
+ text: contentText.reduce(((result, paragraph, index) => {
141
+ const suffix = index === contentText.length - 1 ? "" : "\n";
142
+ return result.push({
143
+ text: `${paragraph}${suffix}`,
144
+ fontSize: fontSize,
145
+ lineHeight: lineHeight,
146
+ fill: fill
147
+ }), result;
148
+ }), [])
149
+ };
150
+ };
151
+
152
+ export const omitImageLayoutSpec = imageSpec => {
153
+ if (!imageSpec) return {};
154
+ const {width: _width, height: _height, position: _position, gap: _gap} = imageSpec;
155
+ return __rest(imageSpec, [ "width", "height", "position", "gap" ]);
156
+ };
157
+
158
+ export const getImageBox = (position, blockWidth, blockHeight, padding, width, height, _gap, visible) => {
159
+ if (!visible) return {
160
+ x: padding.left,
161
+ y: padding.top,
162
+ width: 0,
163
+ height: 0
164
+ };
165
+ switch (position) {
166
+ case "left":
167
+ return {
168
+ x: padding.left,
169
+ y: (blockHeight - height) / 2,
170
+ width: width,
171
+ height: height
172
+ };
173
+
174
+ case "right":
175
+ return {
176
+ x: blockWidth - padding.right - width,
177
+ y: (blockHeight - height) / 2,
178
+ width: width,
179
+ height: height
180
+ };
181
+
182
+ case "bottom":
183
+ return {
184
+ x: (blockWidth - width) / 2,
185
+ y: blockHeight - padding.bottom - height,
186
+ width: width,
187
+ height: height
188
+ };
189
+
190
+ default:
191
+ return {
192
+ x: (blockWidth - width) / 2,
193
+ y: padding.top,
194
+ width: width,
195
+ height: height
196
+ };
197
+ }
198
+ };
199
+
200
+ export const getTextBox = (position, blockWidth, blockHeight, padding, imageWidth, imageHeight, imageGap, hasImage) => {
201
+ if (!hasImage) return {
202
+ x: padding.left,
203
+ y: padding.top,
204
+ width: blockWidth - padding.left - padding.right,
205
+ height: blockHeight - padding.top - padding.bottom
206
+ };
207
+ switch (position) {
208
+ case "left":
209
+ return {
210
+ x: padding.left + imageWidth + imageGap,
211
+ y: padding.top,
212
+ width: blockWidth - padding.left - padding.right - imageWidth - imageGap,
213
+ height: blockHeight - padding.top - padding.bottom
214
+ };
215
+
216
+ case "right":
217
+ return {
218
+ x: padding.left,
219
+ y: padding.top,
220
+ width: blockWidth - padding.left - padding.right - imageWidth - imageGap,
221
+ height: blockHeight - padding.top - padding.bottom
222
+ };
223
+
224
+ case "bottom":
225
+ return {
226
+ x: padding.left,
227
+ y: padding.top,
228
+ width: blockWidth - padding.left - padding.right,
229
+ height: blockHeight - padding.top - padding.bottom - imageHeight - imageGap
230
+ };
231
+
232
+ default:
233
+ return {
234
+ x: padding.left,
235
+ y: padding.top + imageHeight + imageGap,
236
+ width: blockWidth - padding.left - padding.right,
237
+ height: blockHeight - padding.top - padding.bottom - imageHeight - imageGap
238
+ };
239
+ }
240
+ };
241
+
242
+ export const buildSmoothCurvePath = points => {
243
+ var _a, _b;
244
+ if (points.length < 2) return "";
245
+ if (2 === points.length) return `M ${points[0].x} ${points[0].y} L ${points[1].x} ${points[1].y}`;
246
+ let d = `M ${points[0].x} ${points[0].y}`;
247
+ for (let i = 0; i < points.length - 1; i++) {
248
+ const p0 = null !== (_a = points[i - 1]) && void 0 !== _a ? _a : points[i], p1 = points[i], p2 = points[i + 1], p3 = null !== (_b = points[i + 2]) && void 0 !== _b ? _b : p2;
249
+ d += ` C ${p1.x + (p2.x - p0.x) / 6} ${p1.y + (p2.y - p0.y) / 6}, ${p2.x - (p3.x - p1.x) / 6} ${p2.y - (p3.y - p1.y) / 6}, ${p2.x} ${p2.y}`;
250
+ }
251
+ return d;
252
+ };
253
+
254
+ export { normalizeLayout, normalizePadding };
255
+ //# sourceMappingURL=common.js.map