@antv/infographic 0.2.13 → 0.2.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 (241) hide show
  1. package/README.md +12 -5
  2. package/README.zh-CN.md +12 -5
  3. package/dist/infographic.min.js +180 -171
  4. package/dist/infographic.min.js.map +1 -1
  5. package/esm/designs/structures/index.d.ts +1 -0
  6. package/esm/designs/structures/index.js +1 -0
  7. package/esm/designs/structures/relation-dagre-flow.js +4 -139
  8. package/esm/designs/structures/sequence-interaction.d.ts +54 -0
  9. package/esm/designs/structures/sequence-interaction.js +440 -0
  10. package/esm/designs/utils/geometry.d.ts +44 -0
  11. package/esm/designs/utils/geometry.js +244 -0
  12. package/esm/designs/utils/index.d.ts +1 -0
  13. package/esm/designs/utils/index.js +1 -0
  14. package/esm/editor/commands/UpdateOptions.d.ts +4 -4
  15. package/esm/editor/commands/UpdateOptions.js +6 -3
  16. package/esm/editor/editor.d.ts +5 -1
  17. package/esm/editor/editor.js +16 -5
  18. package/esm/editor/index.d.ts +1 -0
  19. package/esm/editor/index.js +1 -0
  20. package/esm/editor/interactions/brush-select.d.ts +0 -1
  21. package/esm/editor/interactions/brush-select.js +2 -10
  22. package/esm/editor/interactions/drag-canvas.d.ts +35 -0
  23. package/esm/editor/interactions/drag-canvas.js +161 -0
  24. package/esm/editor/interactions/drag-element.js +4 -3
  25. package/esm/editor/interactions/index.d.ts +1 -0
  26. package/esm/editor/interactions/index.js +1 -0
  27. package/esm/editor/interactions/zoom-wheel.d.ts +9 -0
  28. package/esm/editor/interactions/zoom-wheel.js +32 -15
  29. package/esm/editor/managers/index.d.ts +1 -0
  30. package/esm/editor/managers/index.js +1 -0
  31. package/esm/editor/managers/state.d.ts +4 -2
  32. package/esm/editor/managers/state.js +14 -13
  33. package/esm/editor/managers/sync-registry.d.ts +16 -0
  34. package/esm/editor/managers/sync-registry.js +51 -0
  35. package/esm/editor/plugins/{edit-bar/components → components}/button.js +1 -1
  36. package/esm/editor/plugins/{edit-bar/components → components}/color-picker.js +1 -1
  37. package/esm/editor/plugins/{edit-bar/components → components}/icons.d.ts +1 -0
  38. package/esm/editor/plugins/{edit-bar/components → components}/icons.js +1 -0
  39. package/esm/editor/plugins/{edit-bar/components → components}/popover.js +2 -2
  40. package/esm/editor/plugins/{edit-bar/components → components}/select.js +1 -1
  41. package/esm/editor/plugins/core-sync.d.ts +8 -0
  42. package/esm/editor/plugins/core-sync.js +30 -0
  43. package/esm/editor/plugins/edit-bar/edit-items/align-elements.js +1 -1
  44. package/esm/editor/plugins/edit-bar/edit-items/font-align.js +1 -1
  45. package/esm/editor/plugins/edit-bar/edit-items/font-color.js +1 -1
  46. package/esm/editor/plugins/edit-bar/edit-items/font-family.js +1 -1
  47. package/esm/editor/plugins/edit-bar/edit-items/font-size.js +1 -1
  48. package/esm/editor/plugins/edit-bar/edit-items/icon-color.js +1 -1
  49. package/esm/editor/plugins/edit-bar/index.d.ts +2 -2
  50. package/esm/editor/plugins/edit-bar/index.js +1 -1
  51. package/esm/editor/plugins/index.d.ts +2 -0
  52. package/esm/editor/plugins/index.js +2 -0
  53. package/esm/editor/plugins/reset-viewbox.d.ts +33 -0
  54. package/esm/editor/plugins/reset-viewbox.js +186 -0
  55. package/esm/editor/types/editor.d.ts +14 -0
  56. package/esm/editor/types/index.d.ts +1 -0
  57. package/esm/editor/types/interaction.d.ts +9 -0
  58. package/esm/editor/types/state.d.ts +4 -2
  59. package/esm/editor/types/sync.d.ts +27 -0
  60. package/esm/editor/types/sync.js +1 -0
  61. package/esm/editor/utils/data.js +3 -1
  62. package/esm/editor/utils/event.d.ts +1 -0
  63. package/esm/editor/utils/event.js +8 -0
  64. package/esm/editor/utils/index.d.ts +1 -0
  65. package/esm/editor/utils/index.js +1 -0
  66. package/esm/editor/utils/object.d.ts +15 -0
  67. package/esm/editor/utils/object.js +77 -0
  68. package/esm/index.d.ts +4 -3
  69. package/esm/index.js +3 -2
  70. package/esm/options/types.d.ts +7 -0
  71. package/esm/runtime/Infographic.js +20 -7
  72. package/esm/runtime/options.js +7 -2
  73. package/esm/syntax/index.js +40 -20
  74. package/esm/syntax/relations.js +26 -2
  75. package/esm/syntax/schema.js +1 -0
  76. package/esm/templates/built-in.js +27 -2
  77. package/esm/templates/sequence-interaction.d.ts +2 -0
  78. package/esm/templates/sequence-interaction.js +76 -0
  79. package/esm/types/data.d.ts +1 -0
  80. package/esm/utils/index.d.ts +1 -0
  81. package/esm/utils/index.js +1 -0
  82. package/esm/utils/measure-text.js +40 -9
  83. package/esm/utils/padding.d.ts +1 -0
  84. package/esm/utils/padding.js +6 -2
  85. package/esm/utils/types.d.ts +16 -0
  86. package/esm/utils/types.js +12 -0
  87. package/esm/version.d.ts +1 -1
  88. package/esm/version.js +1 -1
  89. package/lib/designs/structures/index.d.ts +1 -0
  90. package/lib/designs/structures/index.js +1 -0
  91. package/lib/designs/structures/relation-dagre-flow.js +5 -140
  92. package/lib/designs/structures/sequence-interaction.d.ts +54 -0
  93. package/lib/designs/structures/sequence-interaction.js +444 -0
  94. package/lib/designs/utils/geometry.d.ts +44 -0
  95. package/lib/designs/utils/geometry.js +256 -0
  96. package/lib/designs/utils/index.d.ts +1 -0
  97. package/lib/designs/utils/index.js +1 -0
  98. package/lib/editor/commands/UpdateOptions.d.ts +4 -4
  99. package/lib/editor/commands/UpdateOptions.js +6 -3
  100. package/lib/editor/editor.d.ts +5 -1
  101. package/lib/editor/editor.js +16 -5
  102. package/lib/editor/index.d.ts +1 -0
  103. package/lib/editor/index.js +1 -0
  104. package/lib/editor/interactions/brush-select.d.ts +0 -1
  105. package/lib/editor/interactions/brush-select.js +1 -9
  106. package/lib/editor/interactions/drag-canvas.d.ts +35 -0
  107. package/lib/editor/interactions/drag-canvas.js +165 -0
  108. package/lib/editor/interactions/drag-element.js +4 -3
  109. package/lib/editor/interactions/index.d.ts +1 -0
  110. package/lib/editor/interactions/index.js +3 -1
  111. package/lib/editor/interactions/zoom-wheel.d.ts +9 -0
  112. package/lib/editor/interactions/zoom-wheel.js +32 -15
  113. package/lib/editor/managers/index.d.ts +1 -0
  114. package/lib/editor/managers/index.js +1 -0
  115. package/lib/editor/managers/state.d.ts +4 -2
  116. package/lib/editor/managers/state.js +12 -11
  117. package/lib/editor/managers/sync-registry.d.ts +16 -0
  118. package/lib/editor/managers/sync-registry.js +55 -0
  119. package/lib/editor/plugins/{edit-bar/components → components}/button.js +1 -1
  120. package/lib/editor/plugins/{edit-bar/components → components}/color-picker.js +1 -1
  121. package/lib/editor/plugins/{edit-bar/components → components}/icons.d.ts +1 -0
  122. package/lib/editor/plugins/{edit-bar/components → components}/icons.js +2 -1
  123. package/lib/editor/plugins/{edit-bar/components → components}/popover.js +2 -2
  124. package/lib/editor/plugins/{edit-bar/components → components}/select.js +1 -1
  125. package/lib/editor/plugins/core-sync.d.ts +8 -0
  126. package/lib/editor/plugins/core-sync.js +34 -0
  127. package/lib/editor/plugins/edit-bar/edit-items/align-elements.js +1 -1
  128. package/lib/editor/plugins/edit-bar/edit-items/font-align.js +1 -1
  129. package/lib/editor/plugins/edit-bar/edit-items/font-color.js +1 -1
  130. package/lib/editor/plugins/edit-bar/edit-items/font-family.js +1 -1
  131. package/lib/editor/plugins/edit-bar/edit-items/font-size.js +1 -1
  132. package/lib/editor/plugins/edit-bar/edit-items/icon-color.js +1 -1
  133. package/lib/editor/plugins/edit-bar/index.d.ts +2 -2
  134. package/lib/editor/plugins/edit-bar/index.js +1 -1
  135. package/lib/editor/plugins/index.d.ts +2 -0
  136. package/lib/editor/plugins/index.js +5 -1
  137. package/lib/editor/plugins/reset-viewbox.d.ts +33 -0
  138. package/lib/editor/plugins/reset-viewbox.js +190 -0
  139. package/lib/editor/types/editor.d.ts +14 -0
  140. package/lib/editor/types/index.d.ts +1 -0
  141. package/lib/editor/types/interaction.d.ts +9 -0
  142. package/lib/editor/types/state.d.ts +4 -2
  143. package/lib/editor/types/sync.d.ts +27 -0
  144. package/lib/editor/types/sync.js +2 -0
  145. package/lib/editor/utils/data.js +3 -1
  146. package/lib/editor/utils/event.d.ts +1 -0
  147. package/lib/editor/utils/event.js +9 -0
  148. package/lib/editor/utils/index.d.ts +1 -0
  149. package/lib/editor/utils/index.js +1 -0
  150. package/lib/editor/utils/object.d.ts +15 -0
  151. package/lib/editor/utils/object.js +80 -0
  152. package/lib/index.d.ts +4 -3
  153. package/lib/index.js +9 -2
  154. package/lib/options/types.d.ts +7 -0
  155. package/lib/runtime/Infographic.js +19 -6
  156. package/lib/runtime/options.js +6 -1
  157. package/lib/syntax/index.js +40 -20
  158. package/lib/syntax/relations.js +26 -2
  159. package/lib/syntax/schema.js +1 -0
  160. package/lib/templates/built-in.js +27 -2
  161. package/lib/templates/sequence-interaction.d.ts +2 -0
  162. package/lib/templates/sequence-interaction.js +79 -0
  163. package/lib/types/data.d.ts +1 -0
  164. package/lib/utils/index.d.ts +1 -0
  165. package/lib/utils/index.js +1 -0
  166. package/lib/utils/measure-text.js +39 -8
  167. package/lib/utils/padding.d.ts +1 -0
  168. package/lib/utils/padding.js +7 -2
  169. package/lib/utils/types.d.ts +16 -0
  170. package/lib/utils/types.js +13 -0
  171. package/lib/version.d.ts +1 -1
  172. package/lib/version.js +1 -1
  173. package/package.json +1 -1
  174. package/src/designs/structures/index.ts +1 -0
  175. package/src/designs/structures/relation-dagre-flow.tsx +14 -178
  176. package/src/designs/structures/sequence-interaction.tsx +885 -0
  177. package/src/designs/utils/geometry.tsx +315 -0
  178. package/src/designs/utils/index.ts +1 -0
  179. package/src/editor/commands/UpdateOptions.ts +11 -6
  180. package/src/editor/editor.ts +26 -5
  181. package/src/editor/index.ts +1 -0
  182. package/src/editor/interactions/brush-select.ts +2 -8
  183. package/src/editor/interactions/drag-canvas.ts +203 -0
  184. package/src/editor/interactions/drag-element.ts +5 -4
  185. package/src/editor/interactions/index.ts +1 -0
  186. package/src/editor/interactions/zoom-wheel.ts +49 -13
  187. package/src/editor/managers/index.ts +1 -0
  188. package/src/editor/managers/state.ts +21 -21
  189. package/src/editor/managers/sync-registry.ts +66 -0
  190. package/src/editor/plugins/{edit-bar/components → components}/button.ts +1 -1
  191. package/src/editor/plugins/{edit-bar/components → components}/color-picker.ts +1 -1
  192. package/src/editor/plugins/{edit-bar/components → components}/icons.ts +4 -0
  193. package/src/editor/plugins/{edit-bar/components → components}/popover.ts +2 -2
  194. package/src/editor/plugins/{edit-bar/components → components}/select.ts +1 -1
  195. package/src/editor/plugins/core-sync.ts +44 -0
  196. package/src/editor/plugins/edit-bar/edit-items/align-elements.ts +2 -2
  197. package/src/editor/plugins/edit-bar/edit-items/font-align.ts +1 -1
  198. package/src/editor/plugins/edit-bar/edit-items/font-color.ts +1 -1
  199. package/src/editor/plugins/edit-bar/edit-items/font-family.ts +1 -1
  200. package/src/editor/plugins/edit-bar/edit-items/font-size.ts +3 -3
  201. package/src/editor/plugins/edit-bar/edit-items/icon-color.ts +1 -1
  202. package/src/editor/plugins/edit-bar/index.ts +2 -2
  203. package/src/editor/plugins/index.ts +2 -0
  204. package/src/editor/plugins/reset-viewbox.ts +258 -0
  205. package/src/editor/types/editor.ts +18 -0
  206. package/src/editor/types/index.ts +1 -0
  207. package/src/editor/types/interaction.ts +31 -0
  208. package/src/editor/types/state.ts +14 -2
  209. package/src/editor/types/sync.ts +33 -0
  210. package/src/editor/utils/data.ts +2 -1
  211. package/src/editor/utils/event.ts +7 -0
  212. package/src/editor/utils/index.ts +1 -0
  213. package/src/editor/utils/object.ts +116 -0
  214. package/src/index.ts +26 -2
  215. package/src/options/types.ts +11 -0
  216. package/src/runtime/Infographic.tsx +27 -17
  217. package/src/runtime/options.ts +8 -1
  218. package/src/syntax/index.ts +51 -18
  219. package/src/syntax/relations.ts +29 -2
  220. package/src/syntax/schema.ts +1 -0
  221. package/src/templates/built-in.ts +30 -0
  222. package/src/templates/sequence-interaction.ts +101 -0
  223. package/src/types/data.ts +1 -0
  224. package/src/utils/index.ts +1 -0
  225. package/src/utils/measure-text.ts +41 -9
  226. package/src/utils/padding.ts +10 -2
  227. package/src/utils/types.ts +61 -0
  228. package/src/version.ts +1 -1
  229. /package/esm/editor/plugins/{edit-bar/components → components}/button.d.ts +0 -0
  230. /package/esm/editor/plugins/{edit-bar/components → components}/color-picker.d.ts +0 -0
  231. /package/esm/editor/plugins/{edit-bar/components → components}/index.d.ts +0 -0
  232. /package/esm/editor/plugins/{edit-bar/components → components}/index.js +0 -0
  233. /package/esm/editor/plugins/{edit-bar/components → components}/popover.d.ts +0 -0
  234. /package/esm/editor/plugins/{edit-bar/components → components}/select.d.ts +0 -0
  235. /package/lib/editor/plugins/{edit-bar/components → components}/button.d.ts +0 -0
  236. /package/lib/editor/plugins/{edit-bar/components → components}/color-picker.d.ts +0 -0
  237. /package/lib/editor/plugins/{edit-bar/components → components}/index.d.ts +0 -0
  238. /package/lib/editor/plugins/{edit-bar/components → components}/index.js +0 -0
  239. /package/lib/editor/plugins/{edit-bar/components → components}/popover.d.ts +0 -0
  240. /package/lib/editor/plugins/{edit-bar/components → components}/select.d.ts +0 -0
  241. /package/src/editor/plugins/{edit-bar/components → components}/index.ts +0 -0
@@ -31,6 +31,7 @@ export * from './sequence-cylinders-3d';
31
31
  export * from './sequence-filter-mesh';
32
32
  export * from './sequence-funnel';
33
33
  export * from './sequence-horizontal-zigzag';
34
+ export * from './sequence-interaction';
34
35
  export * from './sequence-mountain';
35
36
  export * from './sequence-pyramid';
36
37
  export * from './sequence-roadmap-vertical';
@@ -31,6 +31,7 @@ export * from './sequence-cylinders-3d.js';
31
31
  export * from './sequence-filter-mesh.js';
32
32
  export * from './sequence-funnel.js';
33
33
  export * from './sequence-horizontal-zigzag.js';
34
+ export * from './sequence-interaction.js';
34
35
  export * from './sequence-mountain.js';
35
36
  export * from './sequence-pyramid.js';
36
37
  export * from './sequence-roadmap-vertical.js';
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "../../jsx-runtime.js";
2
2
  import { DagreLayout } from '@antv/layout';
3
- import { Defs, getElementBounds, Group, Path, Polygon, Text } from '../../jsx/index.js';
3
+ import { Defs, getElementBounds, Group, Path, Text } from '../../jsx/index.js';
4
4
  import { BtnAdd, BtnsGroup, ItemsGroup } from '../components/index.js';
5
5
  import { FlexLayout } from '../layouts/index.js';
6
- import { getColorPrimary, getPaletteColor, getThemeColors } from '../utils/index.js';
6
+ import { createArrowElements, createRoundedPath, createStraightPath, getColorPrimary, getMidPoint, getPaletteColor, getThemeColors, } from '../utils/index.js';
7
7
  import { registerStructure } from './registry.js';
8
8
  const DEFAULT_NODE_SEP = 50;
9
9
  const DEFAULT_RANK_SEP = 70;
@@ -191,141 +191,6 @@ export const RelationDagreFlow = (props) => {
191
191
  ? `${dashPatternLength / (edgeAnimationSpeed * 10)}s`
192
192
  : '1s';
193
193
  const straightCornerRadius = edgeCornerRadius;
194
- const createStraightPath = (points, dx, dy) => points
195
- .map(([x, y], index) => {
196
- const prefix = index === 0 ? 'M' : 'L';
197
- return `${prefix} ${x + dx} ${y + dy}`;
198
- })
199
- .join(' ');
200
- const createRoundedPath = (points, radius, dx, dy) => {
201
- if (points.length < 2)
202
- return '';
203
- const clamp = (value, min, max) => Math.min(max, Math.max(min, value));
204
- const toPoint = ([x, y]) => ({
205
- x: x + dx,
206
- y: y + dy,
207
- });
208
- const output = [];
209
- const first = toPoint(points[0]);
210
- output.push(`M ${first.x} ${first.y}`);
211
- if (points.length === 2) {
212
- const last = toPoint(points[1]);
213
- output.push(`L ${last.x} ${last.y}`);
214
- return output.join(' ');
215
- }
216
- for (let i = 1; i < points.length - 1; i += 1) {
217
- const prev = points[i - 1];
218
- const curr = points[i];
219
- const next = points[i + 1];
220
- const v0x = curr[0] - prev[0];
221
- const v0y = curr[1] - prev[1];
222
- const v1x = next[0] - curr[0];
223
- const v1y = next[1] - curr[1];
224
- const d0 = Math.hypot(v0x, v0y);
225
- const d1 = Math.hypot(v1x, v1y);
226
- if (d0 === 0 || d1 === 0) {
227
- const currPoint = toPoint(curr);
228
- output.push(`L ${currPoint.x} ${currPoint.y}`);
229
- continue;
230
- }
231
- const r = clamp(radius, 0, Math.min(d0, d1) / 2);
232
- if (r === 0) {
233
- const currPoint = toPoint(curr);
234
- output.push(`L ${currPoint.x} ${currPoint.y}`);
235
- continue;
236
- }
237
- const u0x = v0x / d0;
238
- const u0y = v0y / d0;
239
- const u1x = v1x / d1;
240
- const u1y = v1y / d1;
241
- const start = toPoint([curr[0] - u0x * r, curr[1] - u0y * r]);
242
- const end = toPoint([curr[0] + u1x * r, curr[1] + u1y * r]);
243
- output.push(`L ${start.x} ${start.y}`);
244
- const currPoint = toPoint(curr);
245
- output.push(`Q ${currPoint.x} ${currPoint.y} ${end.x} ${end.y}`);
246
- }
247
- const last = toPoint(points[points.length - 1]);
248
- output.push(`L ${last.x} ${last.y}`);
249
- return output.join(' ');
250
- };
251
- const createArrowElements = (x, y, angle, type, fillColor) => {
252
- const ux = Math.cos(angle);
253
- const uy = Math.sin(angle);
254
- const px = -uy;
255
- const py = ux;
256
- const length = arrowSize;
257
- const halfWidth = arrowSize * 0.55;
258
- if (type === 'arrow') {
259
- const leftX = x - ux * length + px * halfWidth;
260
- const leftY = y - uy * length + py * halfWidth;
261
- const rightX = x - ux * length - px * halfWidth;
262
- const rightY = y - uy * length - py * halfWidth;
263
- return [
264
- _jsx(Path, { d: `M ${leftX} ${leftY} L ${x} ${y} L ${rightX} ${rightY}`, stroke: fillColor, strokeWidth: Math.max(1.5, edgeWidth), strokeLinecap: "round", strokeLinejoin: "round", fill: "none" }),
265
- ];
266
- }
267
- if (type === 'diamond') {
268
- const diamondLength = length * 1.25;
269
- const diamondWidth = halfWidth * 0.75;
270
- const midX = x - ux * diamondLength * 0.5;
271
- const midY = y - uy * diamondLength * 0.5;
272
- const diamondPoints = [
273
- { x, y },
274
- { x: midX + px * diamondWidth, y: midY + py * diamondWidth },
275
- { x: x - ux * diamondLength, y: y - uy * diamondLength },
276
- { x: midX - px * diamondWidth, y: midY - py * diamondWidth },
277
- ];
278
- return [
279
- _jsx(Polygon, { points: diamondPoints, fill: fillColor, stroke: fillColor, strokeWidth: Math.max(1, edgeWidth * 0.8) }),
280
- ];
281
- }
282
- const trianglePoints = [
283
- { x, y },
284
- {
285
- x: x - ux * length + px * halfWidth,
286
- y: y - uy * length + py * halfWidth,
287
- },
288
- {
289
- x: x - ux * length - px * halfWidth,
290
- y: y - uy * length - py * halfWidth,
291
- },
292
- ];
293
- return [
294
- _jsx(Polygon, { points: trianglePoints, fill: fillColor, stroke: fillColor, strokeWidth: Math.max(1, edgeWidth * 0.8) }),
295
- ];
296
- };
297
- const getMidPoint = (points) => {
298
- if (points.length === 0)
299
- return null;
300
- if (points.length === 1)
301
- return points[0];
302
- let total = 0;
303
- const segments = [];
304
- for (let i = 0; i < points.length - 1; i += 1) {
305
- const start = points[i];
306
- const end = points[i + 1];
307
- const length = Math.hypot(end[0] - start[0], end[1] - start[1]);
308
- segments.push({ length, start, end });
309
- total += length;
310
- }
311
- if (total === 0)
312
- return points[0];
313
- let target = total / 2;
314
- for (let i = 0; i < segments.length; i += 1) {
315
- const segment = segments[i];
316
- if (target <= segment.length || i === segments.length - 1) {
317
- const ratio = segment.length === 0
318
- ? 0
319
- : Math.max(0, Math.min(1, target / segment.length));
320
- return [
321
- segment.start[0] + (segment.end[0] - segment.start[0]) * ratio,
322
- segment.start[1] + (segment.end[1] - segment.start[1]) * ratio,
323
- ];
324
- }
325
- target -= segment.length;
326
- }
327
- return points[Math.floor(points.length / 2)];
328
- };
329
194
  const getOrthEdgeEndpoints = (sourceId, targetId) => {
330
195
  const source = nodeLayoutById.get(sourceId);
331
196
  const target = nodeLayoutById.get(targetId);
@@ -468,7 +333,7 @@ export const RelationDagreFlow = (props) => {
468
333
  const tail = points[lastIndex - 1];
469
334
  const angle = Math.atan2(head[1] - tail[1], head[0] - tail[0]);
470
335
  const arrowFill = edgeColorMode === 'gradient' ? targetColor : defaultStroke;
471
- const arrowElements = createArrowElements(head[0] + pointsOffsetX, head[1] + pointsOffsetY, angle, edgeArrowType, arrowFill);
336
+ const arrowElements = createArrowElements(head[0] + pointsOffsetX, head[1] + pointsOffsetY, angle, edgeArrowType, arrowFill, edgeWidth, arrowSize);
472
337
  decorElements.push(...arrowElements);
473
338
  }
474
339
  if (direction === 'both') {
@@ -476,7 +341,7 @@ export const RelationDagreFlow = (props) => {
476
341
  const tail = points[1];
477
342
  const angle = Math.atan2(head[1] - tail[1], head[0] - tail[0]);
478
343
  const arrowFill = edgeColorMode === 'gradient' ? sourceColor : defaultStroke;
479
- const arrowElements = createArrowElements(head[0] + pointsOffsetX, head[1] + pointsOffsetY, angle, edgeArrowType, arrowFill);
344
+ const arrowElements = createArrowElements(head[0] + pointsOffsetX, head[1] + pointsOffsetY, angle, edgeArrowType, arrowFill, edgeWidth, arrowSize);
480
345
  decorElements.push(...arrowElements);
481
346
  }
482
347
  }
@@ -0,0 +1,54 @@
1
+ import type { ComponentType } from '../../jsx';
2
+ import type { RelationEdgeDatum } from '../../types';
3
+ import type { BaseStructureProps } from './types';
4
+ /**
5
+ * 泳道内的节点数据
6
+ */
7
+ export interface InteractionChildDatum {
8
+ id: string;
9
+ label?: string;
10
+ desc?: string;
11
+ icon?: string;
12
+ /**
13
+ * 手动指定节点的垂直顺序(层级),默认为数组索引
14
+ * 相同 step 的节点会处于同一高度
15
+ */
16
+ step?: number;
17
+ }
18
+ /**
19
+ * 泳道数据(顶层item)
20
+ * label 作为泳道标题
21
+ * children 作为泳道内的节点列表
22
+ */
23
+ export interface InteractionLaneDatum {
24
+ label: string;
25
+ desc?: string;
26
+ icon?: string;
27
+ children?: InteractionChildDatum[];
28
+ }
29
+ /**
30
+ * 交互流程的数据结构
31
+ * items: 泳道列表,每个泳道有 label 和 children
32
+ * relations: 节点间的关系
33
+ */
34
+ export interface InteractionFlowData {
35
+ title?: string;
36
+ desc?: string;
37
+ items?: InteractionLaneDatum[];
38
+ relations?: RelationEdgeDatum[];
39
+ }
40
+ export interface SequenceInteractionProps extends BaseStructureProps {
41
+ laneGap?: number;
42
+ nodeGap?: number;
43
+ lifelineWidth?: number;
44
+ arrowWidth?: number;
45
+ showLifeline?: boolean;
46
+ padding?: number;
47
+ arrowType?: 'arrow' | 'triangle';
48
+ showLaneHeader?: boolean;
49
+ laneHeaderHeight?: number;
50
+ edgeStyle?: 'solid' | 'dashed';
51
+ animated?: boolean;
52
+ edgeColorMode?: 'solid' | 'gradient';
53
+ }
54
+ export declare const SequenceInteractionFlow: ComponentType<SequenceInteractionProps>;