@visuallyjs/browser-ui 1.0.3 → 1.1.1

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 (139) hide show
  1. package/js/visuallyjs.browser-ui.cjs.js +57 -57
  2. package/js/visuallyjs.browser-ui.esm.js +57 -57
  3. package/package.json +1 -1
  4. package/types/browser-ui/browser-ui.d.ts +4 -7
  5. package/types/browser-ui/browser-util.d.ts +1 -0
  6. package/types/browser-ui/browser-visuallyjs-instance.d.ts +13 -6
  7. package/types/browser-ui/components/controls/css-classes.d.ts +24 -0
  8. package/types/browser-ui/components/inspector/color-picker-tag.d.ts +6 -0
  9. package/types/browser-ui/components/palette/palette.d.ts +1 -0
  10. package/types/browser-ui/connector-editors/editor-base.d.ts +0 -1
  11. package/types/browser-ui/connector-editors/util.d.ts +0 -2
  12. package/types/browser-ui/connector-editors-bezier/css-constants.d.ts +0 -12
  13. package/types/browser-ui/constants.d.ts +4 -10
  14. package/types/browser-ui/css-constants.d.ts +57 -8
  15. package/types/browser-ui/definitions.d.ts +27 -6
  16. package/types/browser-ui/dialogs/binder.d.ts +0 -11
  17. package/types/browser-ui/edge-handler-base.d.ts +9 -16
  18. package/types/browser-ui/edge-input-handler.d.ts +3 -10
  19. package/types/browser-ui/edge-mappings/flowchart-basic.d.ts +2 -1
  20. package/types/browser-ui/element-drag-handler-2.d.ts +0 -3
  21. package/types/browser-ui/html-element-overlay.d.ts +3 -0
  22. package/types/browser-ui/icons/definitions.d.ts +20 -0
  23. package/types/browser-ui/pan-zoom-options.d.ts +10 -21
  24. package/types/browser-ui/pan-zoom.d.ts +29 -114
  25. package/types/browser-ui/paper-renderer/definitions.d.ts +2 -0
  26. package/types/browser-ui/paper-renderer/paper.d.ts +1 -0
  27. package/types/browser-ui/plugins/background/background-options.d.ts +4 -0
  28. package/types/browser-ui/plugins/background/tiled-background.d.ts +2 -0
  29. package/types/browser-ui/plugins/browser-ui-plugin.d.ts +6 -1
  30. package/types/browser-ui/positioning-and-sizing-utils.d.ts +21 -1
  31. package/types/browser-ui/shape-library/shape-library-definitions.d.ts +26 -11
  32. package/types/browser-ui/shape-library/shape-library.d.ts +14 -3
  33. package/types/browser-ui/shape-library/shapes-basic.d.ts +1 -1
  34. package/types/browser-ui/shape-library/shapes-flowchart.d.ts +1 -1
  35. package/types/browser-ui/surface-renderer/anim/definitions.d.ts +13 -4
  36. package/types/browser-ui/surface-renderer/anim/path-transport.d.ts +0 -1
  37. package/types/browser-ui/surface-renderer/definitions.d.ts +14 -3
  38. package/types/browser-ui/surface-renderer/diagrams/definitions.d.ts +12 -2
  39. package/types/browser-ui/surface-renderer/diagrams/diagram-link.d.ts +2 -0
  40. package/types/browser-ui/surface-renderer/diagrams/diagram-tools.d.ts +4 -0
  41. package/types/browser-ui/surface-renderer/diagrams/diagram.d.ts +4 -1
  42. package/types/browser-ui/surface-renderer/diagrams/index.d.ts +4 -2
  43. package/types/browser-ui/surface-renderer/diagrams/mediator.d.ts +14 -0
  44. package/types/browser-ui/surface-renderer/plugins/controls/controls-plugin.d.ts +2 -0
  45. package/types/browser-ui/surface-renderer/plugins/export-controls/export-controls-plugin.d.ts +3 -1
  46. package/types/browser-ui/surface-renderer/plugins/index.d.ts +1 -0
  47. package/types/browser-ui/surface-renderer/plugins/list-manager/index.d.ts +1 -0
  48. package/types/browser-ui/surface-renderer/plugins/list-manager/list-manager-plugin.d.ts +34 -0
  49. package/types/browser-ui/surface-renderer/plugins/palette/palette-plugin.d.ts +2 -0
  50. package/types/browser-ui/surface-renderer/plugins/pan-buttons/pan-buttons-plugin.d.ts +1 -2
  51. package/types/browser-ui/surface-renderer/plugins/resizing-tools/definitions.d.ts +9 -0
  52. package/types/browser-ui/surface-renderer/plugins/snaplines/snaplines-plugin.d.ts +12 -0
  53. package/types/browser-ui/surface-renderer/plugins/vertex-drawing/vertex-drawing-plugin.d.ts +0 -2
  54. package/types/browser-ui/surface-renderer/shape-palette-options.d.ts +5 -2
  55. package/types/browser-ui/surface-renderer/shape-palette.d.ts +1 -1
  56. package/types/browser-ui/surface-renderer/surface-render-options.d.ts +0 -30
  57. package/types/browser-ui/surface-renderer/surface.d.ts +47 -38
  58. package/types/browser-ui/svg-element-overlay.d.ts +1 -0
  59. package/types/browser-ui/svg-export/definitions.d.ts +12 -0
  60. package/types/browser-ui/svg-export/image-exporter.d.ts +2 -0
  61. package/types/browser-ui/svg-export/svg-exporter.d.ts +3 -0
  62. package/types/browser-ui/templating/custom-tag-definition.d.ts +1 -2
  63. package/types/browser-ui/util.d.ts +2 -0
  64. package/types/charts/bar-and-column/bar-plot.d.ts +2 -0
  65. package/types/charts/base-chart.d.ts +62 -6
  66. package/types/charts/chart-exporter.d.ts +3 -0
  67. package/types/charts/datasource.d.ts +11 -0
  68. package/types/charts/definitions.d.ts +10 -0
  69. package/types/charts/domain_scale_utilities.d.ts +4 -0
  70. package/types/charts/legend.d.ts +2 -0
  71. package/types/charts/pie/pie-chart.d.ts +2 -0
  72. package/types/charts/sankey/sankey.d.ts +1 -0
  73. package/types/charts/scatter/definitions.d.ts +1 -0
  74. package/types/charts/series/array-based-series.d.ts +2 -0
  75. package/types/charts/series/definitions.d.ts +1 -0
  76. package/types/charts/series/series.d.ts +2 -0
  77. package/types/charts/series-based-chart.d.ts +1 -0
  78. package/types/charts/tooltip.d.ts +7 -2
  79. package/types/charts/util.d.ts +10 -3
  80. package/types/core/autosaver.d.ts +2 -1
  81. package/types/core/csv-loader.d.ts +8 -2
  82. package/types/core/event-constants.d.ts +44 -2
  83. package/types/core/geom.d.ts +1 -0
  84. package/types/core/io.d.ts +31 -7
  85. package/types/core/layout/abstract-layout.d.ts +1 -0
  86. package/types/core/layout/grid/definitions.d.ts +10 -19
  87. package/types/core/layout/grid/grid-layout.d.ts +2 -2
  88. package/types/core/layout/hierarchy/util.d.ts +1 -7
  89. package/types/core/magnetizer.d.ts +1 -0
  90. package/types/core/model/anchor.d.ts +1 -0
  91. package/types/core/model/graph.d.ts +3 -11
  92. package/types/core/model/group-template.d.ts +15 -0
  93. package/types/core/params.d.ts +2 -2
  94. package/types/core/renderer.d.ts +3 -0
  95. package/types/core/rtree/rtree.d.ts +15 -0
  96. package/types/core/selection.d.ts +2 -6
  97. package/types/core/templates/core.d.ts +1 -1
  98. package/types/core/toolkit.d.ts +30 -10
  99. package/types/core/undo-redo/undo-redo.d.ts +0 -22
  100. package/types/core/util.d.ts +4 -1
  101. package/types/ui/common/overlay.d.ts +7 -1
  102. package/types/ui/common/paint-style.d.ts +2 -0
  103. package/types/ui/connector-orthogonal/operations.d.ts +1 -18
  104. package/types/ui/connector-orthogonal/utils.d.ts +0 -6
  105. package/types/ui/connector-straight/straight-connector.d.ts +2 -5
  106. package/types/ui/core/component/component.d.ts +1 -4
  107. package/types/ui/core/connector/connection-impl.d.ts +1 -0
  108. package/types/ui/core/connector/connections.d.ts +0 -29
  109. package/types/ui/core/connector/straight-segment.d.ts +0 -6
  110. package/types/ui/core/constants.d.ts +0 -4
  111. package/types/ui/core/core-events.d.ts +5 -3
  112. package/types/ui/core/core.d.ts +19 -21
  113. package/types/ui/core/defaults.d.ts +43 -9
  114. package/types/ui/core/definitions.d.ts +39 -20
  115. package/types/ui/core/event-constants.d.ts +1 -0
  116. package/types/ui/core/factory/continuous-anchors.d.ts +0 -6
  117. package/types/ui/core/grid-profile.d.ts +3 -1
  118. package/types/ui/core/magnetize-profile.d.ts +1 -3
  119. package/types/ui/core/overlay/custom-overlay.d.ts +28 -9
  120. package/types/ui/core/overlay/label-overlay.d.ts +3 -2
  121. package/types/ui/core/overlay/overlay.d.ts +5 -3
  122. package/types/ui/core/params.d.ts +12 -99
  123. package/types/ui/core/router/default-router.d.ts +89 -18
  124. package/types/ui/core/router/index.d.ts +0 -1
  125. package/types/ui/core/router/router-utils.d.ts +0 -24
  126. package/types/ui/core/router/router.d.ts +29 -20
  127. package/types/ui/core/type-descriptors.d.ts +2 -0
  128. package/types/ui/core/ui-model.d.ts +3 -0
  129. package/types/ui/core/view/edge-options.d.ts +5 -0
  130. package/types/ui/core/view/events.d.ts +22 -0
  131. package/types/ui/core/view/node-or-port-options.d.ts +6 -0
  132. package/types/ui/core/view/vertex-options.d.ts +2 -0
  133. package/types/ui/core/viewport.d.ts +7 -1
  134. package/types/ui/plugins/definitions.d.ts +6 -1
  135. package/types/ui/plugins/plugins.d.ts +4 -0
  136. package/types/ui/property-mappings/definitions.d.ts +6 -0
  137. package/types/ui/util/util.d.ts +3 -16
  138. package/types/version.d.ts +1 -1
  139. package/types/ui/core/router/base-router.d.ts +0 -100
@@ -29,35 +29,18 @@ export declare function $getOverlay<T extends Overlay<EL>, EL>(c: Connection<EL>
29
29
  * @internal
30
30
  */
31
31
  export declare function $getOverlays<EL>(c: Connection<EL>): Record<string, Overlay<EL>>;
32
- /**
33
- * Hide the overlay with the given id.
34
- * @param id
35
- * @internal
36
- */
37
- export declare function $hideOverlay<EL>(c: Connection<EL>, id: string): void;
38
32
  /**
39
33
  * Hide all overlays, or a specific set of overlays.
40
34
  * @param ids optional list of ids to hide.
41
35
  * @internal
42
36
  */
43
37
  export declare function _hideOverlays<EL>(c: Connection<EL>, ...ids: Array<string>): void;
44
- /**
45
- * Show a specific overlay (set it to be visible)
46
- * @param id
47
- * @internal
48
- */
49
- export declare function _showOverlay<E>(c: Connection<E>, id: string): void;
50
38
  /**
51
39
  * Show all overlays, or a specific set of overlays.
52
40
  * @param ids optional list of ids to show.
53
41
  * @internal
54
42
  */
55
43
  export declare function _showOverlays<E>(c: Connection<E>, ...ids: Array<string>): void;
56
- /**
57
- * Remove all overlays from this component.
58
- * @internal
59
- */
60
- export declare function _removeAllOverlays<E>(c: Connection<E>): void;
61
44
  /**
62
45
  * Remove the overlay with the given id.
63
46
  * @param overlayId
@@ -65,22 +48,10 @@ export declare function _removeAllOverlays<E>(c: Connection<E>): void;
65
48
  * @internal
66
49
  */
67
50
  export declare function _removeOverlay<E>(c: Connection<E>, overlayId: string, dontCleanup?: boolean): void;
68
- /**
69
- * Remove the given set of overlays, specified by their ids.
70
- * @param overlays
71
- * @internal
72
- */
73
- export declare function _removeOverlays<E>(c: Connection<E>, ...overlays: string[]): void;
74
51
  /**
75
52
  * @internal
76
53
  */
77
54
  export declare function _getLabelOverlay<EL>(c: Connection<EL>): LabelOverlay<EL>;
78
- /**
79
- * Set this component's label.
80
- * @param l Either some text, or a function which returns some text, or an existing label overlay.
81
- * @internal
82
- */
83
- export declare function _setConnectionLabel<EL>(c: Connection<EL>, l: string | Function | LabelOverlay<EL>): void;
84
55
  export declare const ACTION_ADD = "add";
85
56
  export declare const ACTION_REMOVE = "remove";
86
57
  /**
@@ -2,12 +2,6 @@
2
2
  * @internal
3
3
  */
4
4
  import { Segment, SegmentHandler, SegmentParams } from "../../common";
5
- export type StraightSegmentCoordinates = {
6
- x1: number;
7
- y1: number;
8
- x2: number;
9
- y2: number;
10
- };
11
5
  /**
12
6
  * @internal
13
7
  */
@@ -5,8 +5,6 @@ export declare const PX = "px";
5
5
  export declare const NOMINAL_SIZE = "50px";
6
6
  export declare const BLOCK = "block";
7
7
  export declare const NONE = "none";
8
- export declare const SOURCE_INDEX = 0;
9
- export declare const TARGET_INDEX = 1;
10
8
  export declare const ABSOLUTE = "absolute";
11
9
  export declare const FIXED = "fixed";
12
10
  export declare const STATIC = "static";
@@ -31,8 +29,6 @@ export declare const ATTRIBUTE_NOT_DRAGGABLE = "data-vjs-not-draggable";
31
29
  */
32
30
  export declare const ATTRIBUTE_ELEMENTS_DRAGGABLE = "data-vjs-elements-draggable";
33
31
  export declare const ATTRIBUTE_TABINDEX = "tabindex";
34
- /** @internal */
35
- export declare const KEY_OVERLAYS = "overlays";
36
32
  /**
37
33
  * Written by VisuallyJs onto an element that represents some vertex (a node, group or port)
38
34
  * @group Nodes and Groups
@@ -1,7 +1,9 @@
1
- import { EVENT_DESTROY, EVENT_EDGE_GEOMETRY, EVENT_EDGE_REMOVED, EVENT_GROUP_MOVE, EVENT_GROUP_MOVE_END, EVENT_GROUP_MOVE_START, EVENT_GROUP_REMOVED, EVENT_NODE_MOVE, EVENT_NODE_MOVE_END, EVENT_NODE_MOVE_START, EVENT_NODE_REMOVED } from "../../core";
1
+ import { EVENT_DESTROY, EVENT_EDGE_GEOMETRY, EVENT_EDGE_REMOVED, EVENT_GROUP_MOVE, EVENT_GROUP_MOVE_END, EVENT_GROUP_MOVE_START, EVENT_GROUP_REMOVED, EVENT_NODE_MOVE, EVENT_NODE_MOVE_ABORT, EVENT_NODE_MOVE_END, EVENT_NODE_MOVE_START, EVENT_NODE_REMOVED } from "../../core";
2
2
  import { EVENT_GROUP_COLLAPSE, EVENT_GROUP_EXPAND, EVENT_INTERNAL_CONNECTION, EVENT_RENDER_END, EVENT_RENDER_START, EVENT_ZOOM, EVENT_AFTER_LAYOUT_REFRESH, //EVENT_CONNECTION_MOUSEOVER,
3
- EVENT_GROUP_RELAYOUT, EVENT_GROUP_RENDERED, EVENT_INTERNAL_VERTEX_UPDATED, EVENT_NODE_RENDERED, EVENT_NODE_VISIBILITY, EVENT_PLUGIN_ADDED, EVENT_RELAYOUT, EVENT_PLUGIN_REMOVED, EVENT_ADHOC_LAYOUT } from "./event-constants";
3
+ EVENT_GROUP_RELAYOUT, EVENT_GROUP_RENDERED, EVENT_INTERNAL_VERTEX_UPDATED, EVENT_NODE_RENDERED, EVENT_NODE_VISIBILITY, EVENT_PLUGIN_ADDED, EVENT_RELAYOUT, EVENT_PLUGIN_REMOVED, EVENT_ADHOC_LAYOUT, EVENT_INTERNAL_ELEMENT_REPAINTED } from "./event-constants";
4
4
  /**
5
5
  * An event that the UI core may fire - meaning subclasses too.
6
+ * @group Events
7
+ * @category UI Events
6
8
  */
7
- export type CoreUIEvent = typeof EVENT_NODE_MOVE_END | typeof EVENT_NODE_MOVE | typeof EVENT_NODE_MOVE_START | typeof EVENT_RENDER_START | typeof EVENT_GROUP_REMOVED | typeof EVENT_GROUP_MOVE | typeof EVENT_GROUP_MOVE_END | typeof EVENT_GROUP_MOVE_START | typeof EVENT_RENDER_END | typeof EVENT_DESTROY | typeof EVENT_RELAYOUT | typeof EVENT_GROUP_COLLAPSE | typeof EVENT_AFTER_LAYOUT_REFRESH | typeof EVENT_GROUP_EXPAND | typeof EVENT_NODE_VISIBILITY | typeof EVENT_GROUP_RENDERED | typeof EVENT_NODE_REMOVED | typeof EVENT_INTERNAL_VERTEX_UPDATED | typeof EVENT_INTERNAL_CONNECTION | typeof EVENT_NODE_RENDERED | typeof EVENT_EDGE_REMOVED | typeof EVENT_ZOOM | typeof EVENT_GROUP_RELAYOUT | typeof EVENT_PLUGIN_ADDED | typeof EVENT_PLUGIN_REMOVED | typeof EVENT_EDGE_GEOMETRY | typeof EVENT_ADHOC_LAYOUT;
9
+ export type CoreUIEvent = typeof EVENT_NODE_MOVE_END | typeof EVENT_NODE_MOVE | typeof EVENT_NODE_MOVE_START | typeof EVENT_NODE_MOVE_ABORT | typeof EVENT_RENDER_START | typeof EVENT_GROUP_REMOVED | typeof EVENT_GROUP_MOVE | typeof EVENT_GROUP_MOVE_END | typeof EVENT_GROUP_MOVE_START | typeof EVENT_RENDER_END | typeof EVENT_DESTROY | typeof EVENT_RELAYOUT | typeof EVENT_GROUP_COLLAPSE | typeof EVENT_AFTER_LAYOUT_REFRESH | typeof EVENT_GROUP_EXPAND | typeof EVENT_NODE_VISIBILITY | typeof EVENT_GROUP_RENDERED | typeof EVENT_NODE_REMOVED | typeof EVENT_INTERNAL_VERTEX_UPDATED | typeof EVENT_INTERNAL_CONNECTION | typeof EVENT_INTERNAL_ELEMENT_REPAINTED | typeof EVENT_NODE_RENDERED | typeof EVENT_EDGE_REMOVED | typeof EVENT_ZOOM | typeof EVENT_GROUP_RELAYOUT | typeof EVENT_PLUGIN_ADDED | typeof EVENT_PLUGIN_REMOVED | typeof EVENT_EDGE_GEOMETRY | typeof EVENT_ADHOC_LAYOUT;
@@ -88,7 +88,7 @@ export declare abstract class UICore<EL, EVT = CoreUIEvent> extends OptimisticEv
88
88
  protected _boundCanvasEvents: Array<[string, Function]>;
89
89
  containerType: ElementType;
90
90
  id: string;
91
- defaults: UICoreDefaults<EL>;
91
+ defaults: UICoreDefaults;
92
92
  private _initialDefaults;
93
93
  hoverSuspended: boolean;
94
94
  _suspendDrawing: boolean;
@@ -110,7 +110,7 @@ export declare abstract class UICore<EL, EVT = CoreUIEvent> extends OptimisticEv
110
110
  $_vertexBorder: number;
111
111
  private _$_edgesAvoidVertices;
112
112
  readonly viewport: Viewport<EL>;
113
- readonly router: Router<EL, any>;
113
+ readonly router: Router<EL>;
114
114
  private _connectionTypes;
115
115
  protected _container: EL;
116
116
  private _pendingGroupsToSize;
@@ -212,6 +212,11 @@ export declare abstract class UICore<EL, EVT = CoreUIEvent> extends OptimisticEv
212
212
  * @internal
213
213
  */
214
214
  private _refreshLayoutOnEdgeConnect;
215
+ /**
216
+ * @internal
217
+ * @private
218
+ */
219
+ protected $relayoutOnResize: boolean;
215
220
  /**
216
221
  * @internal
217
222
  */
@@ -221,7 +226,7 @@ export declare abstract class UICore<EL, EVT = CoreUIEvent> extends OptimisticEv
221
226
  * @internal
222
227
  */
223
228
  rootElement: EL;
224
- protected constructor(model: VisuallyJsModel, dataSource: DataSource, rootElement: EL, options: UICoreOptions<EL, any>, defaults?: UICoreDefaults<EL>);
229
+ protected constructor(model: VisuallyJsModel, dataSource: DataSource, rootElement: EL, options: UICoreOptions<EL, any>, defaults?: UICoreDefaults);
225
230
  /**
226
231
  * Gets the Layout this surface is currently using.
227
232
  */
@@ -473,6 +478,12 @@ export declare abstract class UICore<EL, EVT = CoreUIEvent> extends OptimisticEv
473
478
  $vertexRendered<N extends Vertex>(v: N, el: EL, def: VertexMapping<any, EL>, eventInfo?: {
474
479
  position: PointXY;
475
480
  }): void;
481
+ /**
482
+ * @internal
483
+ */
484
+ $redrawEveryConnection(): void;
485
+ private $redrawConnectionsForViewportElement;
486
+ private _repaintConnections;
476
487
  /**
477
488
  * Toggle the visible state of some edge.
478
489
  * @param edge
@@ -578,17 +589,9 @@ export declare abstract class UICore<EL, EVT = CoreUIEvent> extends OptimisticEv
578
589
  * @internal
579
590
  */
580
591
  $batch(fn: Function, doNotRepaintAfterwards?: boolean): void;
581
- /**
582
- * Update the cached offset information for some element.
583
- * @param params
584
- * @returns an UpdateOffsetResult containing the offset information for the given element.
585
- * @internal
586
- */
587
- private _updateOffset;
588
592
  private _beforeDetach;
589
593
  /**
590
- * Delete the given connection. Do not call this method as part of the API. It will not result in the model being
591
- * updated. This method is called in response to model changes.
594
+ * Delete the given connection. Do not call this method as part of the API. It will not result in the model being updated. This method is called in response to model changes.
592
595
  * @param connection - Connection to delete.
593
596
  * @param params - Optional extra parameters.
594
597
  * @internal
@@ -682,12 +685,7 @@ export declare abstract class UICore<EL, EVT = CoreUIEvent> extends OptimisticEv
682
685
  * Repaint every connection in the instance.
683
686
  */
684
687
  repaintEverything(doNotRefreshElements?: boolean): void;
685
- /**
686
- * Repaints the given vertex and all of the edges connected to it.
687
- * @param el Either an element, a vertex id, or a Vertex.
688
- * @param resetToLayoutPosition If true, the UI will also ensure that the given element's position in the canvas is reset to the position the viewport has. This is mostly an internal flag, used when resetting certain dragging scenarios.
689
- */
690
- repaint(el: string | EL | Vertex, resetToLayoutPosition?: boolean): void;
688
+ $repaintUIElementById(id: string, timestamp?: string, offsetsWereJustCalculated?: boolean, postEvent?: boolean): void;
691
689
  /**
692
690
  * Repaints all connections associated with the given element, _without recomputing the element size and position_. If you want to first recompute element size and position you should call `revalidate(el)` instead,
693
691
  * @param el - Element to repaint.
@@ -695,7 +693,7 @@ export declare abstract class UICore<EL, EVT = CoreUIEvent> extends OptimisticEv
695
693
  * @param offsetsWereJustCalculated - If true, we don't recalculate the offsets of child elements of the element we're repainting.
696
694
  * @internal
697
695
  */
698
- $repaintUIElement(el: ViewportElement<EL>, timestamp?: string, offsetsWereJustCalculated?: boolean): RedrawResult;
696
+ $repaintUIElement(el: ViewportElement<EL>, timestamp?: string, offsetsWereJustCalculated?: boolean, postEvent?: boolean): RedrawResult;
699
697
  /**
700
698
  * Clears all connections from the UI instance. Does not also clear out event listeners, selectors, or
701
699
  * connection types - for that, use `destroy()`.
@@ -854,7 +852,7 @@ export declare abstract class UICore<EL, EVT = CoreUIEvent> extends OptimisticEv
854
852
  * Whether or not to also apply the rotations to the element
855
853
  */
856
854
  writeRotationsToElements: boolean;
857
- }): RedrawResult;
855
+ }): Set<Connection<any>>;
858
856
  /**
859
857
  * Runs a relayout of all vertices in the canvas, and of each group.
860
858
  * @param newParameters
@@ -1156,7 +1154,7 @@ export declare abstract class UICore<EL, EVT = CoreUIEvent> extends OptimisticEv
1156
1154
  * @internal
1157
1155
  * @param el
1158
1156
  */
1159
- abstract $getElementPositionInUIRelativeToCanvasOrigin(el: EL, knownElementSize?: Size): PointXY;
1157
+ abstract $getElementPositionInUIRelativeToCanvasOrigin(el: ViewportElement<EL>, knownElementSize?: Size): PointXY;
1160
1158
  /**
1161
1159
  * Gets the position of the given element relative to the browser window's origin.
1162
1160
  * @param el
@@ -5,6 +5,8 @@ import { Base, Size, LayoutSpec, Group, ObjectData } from "../../core";
5
5
  import { GridOptions } from "./grid-profile";
6
6
  import { MagnetizeOptions } from "./magnetize-profile";
7
7
  import { UIPluginSpec } from "../plugins";
8
+ import { Router } from "./router";
9
+ import { UICore } from "./core";
8
10
  /**
9
11
  * Default key used to instruct VisuallyJs whether or not nested groups are allowed. Defaults to true.
10
12
  * @group Nodes and Groups
@@ -26,13 +28,10 @@ export declare const DEFAULT_KEY_ANCHOR = "anchor";
26
28
  */
27
29
  export declare const DEFAULT_KEY_ANCHORS = "anchors";
28
30
  /** @internal */
29
- export declare const DEFAULT_KEY_ASTAR_GRID_CELL_SIZE = "astarGridCellSize";
30
31
  /** @internal */
31
32
  export declare const DEFAULT_KEY_ASTAR_VERTEX_BORDER = "astarVertexBorder";
32
33
  /** @internal */
33
34
  export declare const DEFAULT_KEY_ASTAR_VERTEX_BUFFER = "astarVertexBuffer";
34
- /** @internal */
35
- export declare const DEFAULT_KEY_OVERLAYS = "overlays";
36
35
  /**
37
36
  * Default key used to instruct the UI whether or not connections should be detachable via mouse/touch events. Defaults to true.
38
37
  * @group Edges
@@ -48,7 +47,6 @@ export declare const DEFAULT_KEY_EDGES_DETACHABLE = "edgesDetachable";
48
47
  export declare const DEFAULT_KEY_CONNECTOR = "connector";
49
48
  export declare const DEFAULT_KEY_CSS_CLASS = "cssClass";
50
49
  export declare const DEFAULT_KEY_EDGE_RELOCATE_HANDLE_SIZE = "edgeRelocateHandleSize";
51
- export declare const DEFAULT_KEY_ENSURE_ANCHORS_IN_WHITESPACE = "ensureAnchorsInWhitespace";
52
50
  /**
53
51
  * When `useModelForSizes` is set on a Surface, this key can be used to define the default size for groups.
54
52
  * @group Nodes and Groups
@@ -155,9 +153,13 @@ export interface UIEdgeOptions {
155
153
  }
156
154
  /**
157
155
  * Base options for a renderer.
158
- * @group Components
156
+ * @group UI
157
+ * @category Definitions
159
158
  */
160
- export interface UICoreOptions<E, O extends UICoreDefaults<E>> {
159
+ export interface UICoreOptions<E, O extends UICoreDefaults> {
160
+ /**
161
+ * Optional ID for the UI. Allows you to retrieve this UI from a model's `getRenderer(id)` method.
162
+ */
161
163
  id?: string;
162
164
  /**
163
165
  * Optional list of plugins to attach to the UI.
@@ -169,11 +171,27 @@ export interface UICoreOptions<E, O extends UICoreDefaults<E>> {
169
171
  defaults?: O;
170
172
  view?: ViewSpec<E>;
171
173
  connectionEstablished?: (payload: ConnectionEstablishedParams) => void;
174
+ /**
175
+ * Options for imposing a grid onto the elements in the UI
176
+ */
172
177
  grid?: GridOptions;
178
+ /**
179
+ * Defaults to false. When true, the UI treats the vertex's element as the element for the port if it cannot find a specific element for the port.
180
+ */
173
181
  logicalPorts?: boolean;
174
182
  objectFilter?: (b: Base) => boolean;
175
183
  magnetizer?: MagnetizeOptions;
184
+ /**
185
+ * Defines the layout to use.
186
+ */
176
187
  layout?: LayoutSpec;
188
+ /**
189
+ * Whether or not to relayout the UI when an element's size changes as a result of content changes in its element. Defaults to false.
190
+ */
191
+ relayoutOnResize?: boolean;
192
+ /**
193
+ * When true, the UI will run a `refresh` of the underlying layout whenever a new edge is established. This defaults to false, but you might want to set this to true if you're using the Hierarchical or Hierarchy layouts, because it has a bearing on the way they paint. However, if your users are able to drag vertices around, you may not wish for the layout to move things that they have placed, which is why this defaults to false.
194
+ */
177
195
  refreshLayoutOnEdgeConnect?: boolean;
178
196
  /**
179
197
  * Default options for edges - these will apply to all edge types in the UI.
@@ -200,18 +218,34 @@ export interface UICoreOptions<E, O extends UICoreDefaults<E>> {
200
218
  */
201
219
  zoomToFitIfNecessary?: boolean;
202
220
  /**
203
- * Optional function to determine the size of a collapsed group. This is given precedence over any default
204
- * or per-type specification for a collapsed group's size.
221
+ * Optional function to determine the size of a collapsed group. This is given precedence over any default or per-type specification for a collapsed group's size.
205
222
  * @param group - The group that is being collapsed.
206
223
  * @returns The size for the collapsed group.
207
224
  */
208
225
  getCollapsedGroupSize?: (group: Group, currentSize: Size) => Size;
226
+ /**
227
+ * Returns whether or not the given group can be collapsed
228
+ * @param group Group in question
229
+ * @param currentSize The group's current size.
230
+ * @return Either a boolean value indicating the operation may or may not proceed, or a set of values. In the case that a set of values are returned, the operation is approved, and the data returned is updated onto the group's dataset. This is useful when your UI wants to stored specific information related to the collapsed group.
231
+ */
209
232
  canCollapseGroup?: (group: Group, currentSize: Size) => boolean | ObjectData;
233
+ /**
234
+ * Returns whether or not the given group can be expanded
235
+ * @param group Group in question
236
+ * @param currentSize The group's current (collapsed) size.
237
+ * @return Either a boolean value indicating the operation may or may not proceed, or a set of values. In the case that a set of values are returned, the operation is approved, and the data returned is updated onto the group's dataset. This is useful when your UI wants to stored specific information related to the expanded group.
238
+ */
210
239
  canExpandGroup?: (group: Group, currentSize: Size) => boolean | ObjectData;
211
240
  /**
212
241
  * Optional default size for a collapsed group. Defaults to 200x150.
213
242
  */
214
243
  defaultCollapsedGroupSize?: Size;
244
+ /**
245
+ * Optional factory method to instantiate a router. This is only for certain advanced usages in which you wish to route all of the edges yourself. Most applications do not need to consider this.
246
+ * @param u
247
+ */
248
+ router?: (u: UICore<E>) => Router<E>;
215
249
  }
216
250
  /** @internal */
217
251
  export declare const DEFAULT_ZOOM_RANGE: [number, number];
@@ -220,7 +254,7 @@ export declare const DEFAULT_ZOOM_RANGE: [number, number];
220
254
  * @group Components
221
255
  * @category Defaults
222
256
  */
223
- export interface UICoreDefaults<E> {
257
+ export interface UICoreDefaults {
224
258
  /**
225
259
  * Default style to use to paint edges.
226
260
  */
@@ -1,7 +1,5 @@
1
- import { Connection } from "./connector/connection-impl";
2
1
  import { ViewportElement, ViewportGroupElement } from "./viewport";
3
- import { Group, Node, Vertex } from "../../core/model/graph";
4
- import { Extents, PointXY, Size } from "../../core/util";
2
+ import { Extents, PointXY, Size, Group, Node, Vertex } from "../../core";
5
3
  import { ExportOptions, VisuallyJsModel } from "../../core/toolkit";
6
4
  import { MagnetizeProfile } from "./magnetize-profile";
7
5
  import { MagnetizeResult } from "../../core/magnetizer";
@@ -10,17 +8,6 @@ import { BOTTOM, CENTER, LEFT, RIGHT, TOP } from "../../core";
10
8
  import { UICore } from "./core";
11
9
  export type ElementSelectionSpecifier<E> = E | Array<E> | '*';
12
10
  export type SelectionList = '*' | Array<string>;
13
- export interface AbstractSelectOptions<E> {
14
- scope?: SelectionList;
15
- source?: ElementSelectionSpecifier<E>;
16
- target?: ElementSelectionSpecifier<E>;
17
- }
18
- export interface SelectOptions<E> extends AbstractSelectOptions<E> {
19
- connections?: Array<Connection<E>>;
20
- }
21
- export interface SelectEndpointOptions<E> extends AbstractSelectOptions<E> {
22
- element?: ElementSelectionSpecifier<E>;
23
- }
24
11
  /**
25
12
  * Optional parameters to the `DeleteConnection` method.
26
13
  * @internal
@@ -72,9 +59,7 @@ export interface DragHandler2StartParams<E> {
72
59
  */
73
60
  el: E;
74
61
  /**
75
- * The page position of the initial event. This position is relative to the page origin, and does not take
76
- * page scroll into account. It _cannot_ be safely compared to the return value of getBoundingClientRect, because
77
- * getBoundingClientRect returns values relative to the viewport origin (ie. the visible part of the page).
62
+ * The page position of the initial event. This position is relative to the page origin, and does not take page scroll into account. It _cannot_ be safely compared to the return value of getBoundingClientRect, because getBoundingClientRect returns values relative to the viewport origin (ie. the visible part of the page).
78
63
  */
79
64
  pagePosition: PointXY;
80
65
  /**
@@ -102,6 +87,8 @@ export interface DragHandler2<E> {
102
87
  }
103
88
  /**
104
89
  * Defines a function that will be invoked prior to a vertex being dragged. Returning false from this function will abort the vertex drag.
90
+ * @group UI
91
+ * @category Definitions
105
92
  */
106
93
  export type VertexDragFilter<E> = (p: {
107
94
  el: E;
@@ -110,12 +97,14 @@ export type VertexDragFilter<E> = (p: {
110
97
  }) => boolean;
111
98
  /**
112
99
  * Defines a function that can constrain drag.
100
+ * @group UI
101
+ * @category Definitions
113
102
  */
114
103
  export type DragConstrainFunction<E> = (desiredLoc: PointXY, dragEl: E, modelObject: Node | Group, size: Size, currentLoc: PointXY, e: MouseEvent) => PointXY;
115
104
  /**
116
105
  * Options for element drag
117
- * @group Components
118
- * @category Element dragging
106
+ * @group UI
107
+ * @category Definitions
119
108
  */
120
109
  export interface DragOptions<E> {
121
110
  /**
@@ -253,7 +242,8 @@ export interface UISaveData {
253
242
  /**
254
243
  * Models the current bounds of a viewport, containing its x/y location,
255
244
  * width/height and current zoom.
256
- * @group Components
245
+ * @group UI
246
+ * @category Definitions
257
247
  */
258
248
  export interface ViewportBounds {
259
249
  /**
@@ -291,6 +281,8 @@ export interface ViewportBounds {
291
281
  }
292
282
  /**
293
283
  * A DataHook is a pair of functions that are invoked during a `load` and a `save`. This mechanism is a means you can use for storing/retrieving custom data from the payload the UI exports.
284
+ * @group Input and Output
285
+ * @category Model
294
286
  */
295
287
  export interface DataHook {
296
288
  load: (d: UISaveData) => any;
@@ -327,6 +319,7 @@ interface EnclosedOrIntersectingVerticesOptions {
327
319
  }
328
320
  /**
329
321
  * Options for a find intersecting vertices call
322
+ * @group UI
330
323
  */
331
324
  export interface IntersectingVerticesOptions extends EnclosedOrIntersectingVerticesOptions {
332
325
  /**
@@ -336,19 +329,23 @@ export interface IntersectingVerticesOptions extends EnclosedOrIntersectingVerti
336
329
  }
337
330
  /**
338
331
  * Options for a find enclosed vertices call
332
+ * @group UI
339
333
  */
340
334
  export interface EnclosedVerticesOptions extends EnclosedOrIntersectingVerticesOptions {
341
335
  }
342
336
  /**
343
337
  * Possible alignments for the `alignX` argument to `alignContent`
338
+ * @group UI
344
339
  */
345
340
  export type CanvasAlignmentX = typeof LEFT | typeof CENTER | typeof RIGHT;
346
341
  /**
347
342
  * Possible alignments for the `alignY` argument to `alignContent`
343
+ * @group UI
348
344
  */
349
345
  export type CanvasAlignmentY = typeof TOP | typeof CENTER | typeof BOTTOM;
350
346
  /**
351
347
  * Options for a content centering operation.
348
+ * @group UI
352
349
  */
353
350
  export type CenterContentOptions = {
354
351
  /**
@@ -384,8 +381,20 @@ export type CenterContentOptions = {
384
381
  */
385
382
  animationDuration?: number;
386
383
  };
384
+ /**
385
+ * Options for a horizontal content centering operation.
386
+ * @group UI
387
+ */
388
+ export type CenterContentHorizontallyOptions = Omit<CenterContentOptions, "horizontal" | "vertical">;
389
+ /**
390
+ * Options for a vertical content centering operation.
391
+ * @group UI
392
+ */
393
+ export type CenterContentVerticallyOptions = Omit<CenterContentOptions, "horizontal" | "vertical">;
387
394
  /**
388
395
  * Options for aligning content in the UI.
396
+ * @group Components
397
+ * @category Surface
389
398
  */
390
399
  export interface AlignContentOptions {
391
400
  /**
@@ -427,6 +436,8 @@ export interface AlignContentOptions {
427
436
  }
428
437
  /**
429
438
  * Options for aligning content to a specific position in the UI.
439
+ * @group Components
440
+ * @category Surface
430
441
  */
431
442
  export interface AlignContentToFaceOptions {
432
443
  /**
@@ -452,6 +463,8 @@ export interface AlignContentToFaceOptions {
452
463
  }
453
464
  /**
454
465
  * Options for the zoomToElements method.
466
+ * @group Components
467
+ * @category Surface
455
468
  */
456
469
  export interface ZoomToElementsOptions<EL> {
457
470
  /**
@@ -481,6 +494,8 @@ export interface ZoomToElementsOptions<EL> {
481
494
  }
482
495
  /**
483
496
  * Base Options for the zoomToFit methods.
497
+ * @group Components
498
+ * @category Surface
484
499
  */
485
500
  export interface BaseZoomToFitOptions {
486
501
  /**
@@ -514,6 +529,8 @@ export interface BaseZoomToFitOptions {
514
529
  }
515
530
  /**
516
531
  * Options for the zoomToFit method.
532
+ * @group Components
533
+ * @category Surface
517
534
  */
518
535
  export interface ZoomToFitOptions extends BaseZoomToFitOptions {
519
536
  /**
@@ -523,6 +540,8 @@ export interface ZoomToFitOptions extends BaseZoomToFitOptions {
523
540
  }
524
541
  /**
525
542
  * Options for the zoomToFitIfNecessary method.
543
+ * @group Components
544
+ * @category Surface
526
545
  */
527
546
  export interface ZoomToFitIfNecessaryOptions extends BaseZoomToFitOptions {
528
547
  }
@@ -1,4 +1,5 @@
1
1
  export declare const EVENT_INTERNAL_CONNECTION = "internal.connection";
2
+ export declare const EVENT_INTERNAL_ELEMENT_REPAINTED = "internal.element:repainted";
2
3
  /**
3
4
  * Fired by an UI when its updateContext method has been invoked. The callback gets a JS object with key and value for the update.
4
5
  * @group Events
@@ -1,10 +1,4 @@
1
1
  import { Face, LightweightContinuousAnchor } from "../../common";
2
- /**
3
- *
4
- * @param a
5
- * @internal
6
- */
7
- export declare function getDefaultFace(a: LightweightContinuousAnchor): Face;
8
2
  /**
9
3
  * @internal
10
4
  * @param a
@@ -1,6 +1,8 @@
1
- import { Grid } from "../../core/util";
1
+ import { Grid } from "../../core";
2
2
  /**
3
3
  * Options for a grid in the UI
4
+ * @group UI
5
+ * @category Definitions
4
6
  */
5
7
  export interface GridOptions {
6
8
  /**
@@ -1,4 +1,3 @@
1
- import { GridProfile } from "./grid-profile";
2
1
  import { Grid, PointXY } from "../../core/util";
3
2
  /**
4
3
  * Options for the magnetize functionality of the UI.
@@ -64,7 +63,6 @@ export interface MagnetizeOptions {
64
63
  * @internal
65
64
  */
66
65
  export declare class MagnetizeProfile {
67
- gridProfile: GridProfile;
68
66
  readonly afterGroupCollapse: boolean;
69
67
  readonly afterGroupExpand: boolean;
70
68
  readonly afterGroupResize: boolean;
@@ -78,5 +76,5 @@ export declare class MagnetizeProfile {
78
76
  readonly constrainToViewport: boolean;
79
77
  readonly repositionDraggedElement: boolean;
80
78
  grid: Grid;
81
- constructor(opts: MagnetizeOptions, gridProfile: GridProfile);
79
+ constructor(opts: MagnetizeOptions);
82
80
  }
@@ -2,33 +2,52 @@ import { Overlay } from "./overlay";
2
2
  import { UICore } from "../core";
3
3
  import { OverlayOptions } from "../../common";
4
4
  import { Connection } from "../connector/connection-impl";
5
- import { ObjectData } from "../../../core";
5
+ import { Edge, ObjectData, VisuallyJsModel } from "../../../core";
6
+ import { BrowserUI } from "../../../browser-ui";
6
7
  /**
7
8
  * Options for a custom overlay. You need to supply the `create` method, which is passed the current connection as an argument, and return a DOM element.
8
9
  * @group Edges
9
10
  * @category Overlays
10
11
  */
11
12
  export interface CustomOverlayOptions<EL> extends OverlayOptions {
12
- create: (c: Connection<EL>) => EL;
13
+ create: (c: Connection<EL>, edge: Edge, instance: BrowserUI, model: VisuallyJsModel) => EL;
14
+ /**
15
+ * If true, the label can be rotated to match the gradient of the connector at that location at which it is positioned.
16
+ */
17
+ rotatable?: boolean;
13
18
  }
14
19
  /**
15
20
  * A custom overlay allows you to create the element that will be used to represent the overlay.
16
21
  * @group Edges
17
22
  * @category Overlays
18
23
  */
19
- export declare class CustomOverlay<EL> extends Overlay<EL> {
20
- connection: Connection<EL>;
21
- create: (c: Connection<EL>) => EL;
24
+ export interface CustomOverlay<EL> extends Overlay<EL> {
25
+ create: (c: Connection<EL>, edge: Edge, instance: BrowserUI, model: VisuallyJsModel) => EL;
22
26
  isSimpleShape: boolean;
23
- constructor(instance: UICore<EL>, connection: Connection<EL>, p: CustomOverlayOptions<EL>);
27
+ rotatable: boolean;
28
+ }
29
+ /**
30
+ * Custom overlay type.
31
+ * @group Overlays
32
+ * @constant
33
+ */
34
+ export declare const OVERLAY_TYPE_CUSTOM = "Custom";
35
+ /**
36
+ * @internal
37
+ */
38
+ export declare class CustomOverlayImpl<EL> extends Overlay<EL> implements CustomOverlay<EL> {
39
+ connection: Connection<EL>;
24
40
  /**
25
- * Custom overlay type.
41
+ * This method is invoked to create the overlay.
26
42
  */
27
- static type: string;
43
+ create: (c: Connection<EL>, edge: Edge, instance: BrowserUI, model: VisuallyJsModel) => EL;
44
+ isSimpleShape: boolean;
45
+ rotatable: boolean;
46
+ constructor(instance: UICore<EL>, connection: Connection<EL>, p: CustomOverlayOptions<EL>);
28
47
  type: string;
29
48
  updateFrom(d: any, context: ObjectData): void;
30
49
  }
31
- export interface CustomOverlayHolder<EL> extends CustomOverlay<EL> {
50
+ export interface CustomOverlayHolder<EL> extends CustomOverlayImpl<EL> {
32
51
  contentElement: EL;
33
52
  }
34
53
  /**
@@ -11,13 +11,14 @@ import { FontSpec } from "../../../browser-ui";
11
11
  */
12
12
  export declare class LabelOverlay<EL> extends Overlay<EL> {
13
13
  private instance;
14
- component: Connection<EL>;
14
+ connection: Connection<EL>;
15
15
  label: string | Function;
16
16
  static type: string;
17
17
  type: string;
18
18
  useHTMLElement: boolean;
19
+ rotatable: boolean;
19
20
  font: FontSpec;
20
- constructor(instance: UICore<EL>, component: Connection<EL>, p: LabelOverlayOptions);
21
+ constructor(instance: UICore<EL>, connection: Connection<EL>, p: LabelOverlayOptions);
21
22
  isSimpleShape: boolean;
22
23
  getLabel(): string;
23
24
  setLabel(l: string | Function): void;