@visuallyjs/browser-ui 1.0.3 → 1.1.0

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 (135) 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 +12 -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/icons/definitions.d.ts +20 -0
  22. package/types/browser-ui/pan-zoom-options.d.ts +10 -21
  23. package/types/browser-ui/pan-zoom.d.ts +29 -114
  24. package/types/browser-ui/paper-renderer/definitions.d.ts +2 -0
  25. package/types/browser-ui/paper-renderer/paper.d.ts +1 -0
  26. package/types/browser-ui/plugins/background/background-options.d.ts +4 -0
  27. package/types/browser-ui/plugins/background/tiled-background.d.ts +2 -0
  28. package/types/browser-ui/plugins/browser-ui-plugin.d.ts +6 -1
  29. package/types/browser-ui/positioning-and-sizing-utils.d.ts +21 -1
  30. package/types/browser-ui/shape-library/shape-library-definitions.d.ts +26 -11
  31. package/types/browser-ui/shape-library/shape-library.d.ts +14 -3
  32. package/types/browser-ui/shape-library/shapes-basic.d.ts +1 -1
  33. package/types/browser-ui/shape-library/shapes-flowchart.d.ts +1 -1
  34. package/types/browser-ui/surface-renderer/anim/definitions.d.ts +13 -4
  35. package/types/browser-ui/surface-renderer/anim/path-transport.d.ts +0 -1
  36. package/types/browser-ui/surface-renderer/definitions.d.ts +14 -3
  37. package/types/browser-ui/surface-renderer/diagrams/definitions.d.ts +8 -2
  38. package/types/browser-ui/surface-renderer/diagrams/diagram-link.d.ts +2 -0
  39. package/types/browser-ui/surface-renderer/diagrams/diagram-tools.d.ts +4 -0
  40. package/types/browser-ui/surface-renderer/diagrams/diagram.d.ts +4 -1
  41. package/types/browser-ui/surface-renderer/diagrams/index.d.ts +4 -2
  42. package/types/browser-ui/surface-renderer/diagrams/mediator.d.ts +14 -0
  43. package/types/browser-ui/surface-renderer/plugins/controls/controls-plugin.d.ts +2 -0
  44. package/types/browser-ui/surface-renderer/plugins/export-controls/export-controls-plugin.d.ts +3 -1
  45. package/types/browser-ui/surface-renderer/plugins/index.d.ts +1 -0
  46. package/types/browser-ui/surface-renderer/plugins/list-manager/index.d.ts +1 -0
  47. package/types/browser-ui/surface-renderer/plugins/list-manager/list-manager-plugin.d.ts +34 -0
  48. package/types/browser-ui/surface-renderer/plugins/palette/palette-plugin.d.ts +2 -0
  49. package/types/browser-ui/surface-renderer/plugins/pan-buttons/pan-buttons-plugin.d.ts +1 -2
  50. package/types/browser-ui/surface-renderer/plugins/resizing-tools/definitions.d.ts +9 -0
  51. package/types/browser-ui/surface-renderer/plugins/snaplines/snaplines-plugin.d.ts +12 -0
  52. package/types/browser-ui/surface-renderer/plugins/vertex-drawing/vertex-drawing-plugin.d.ts +0 -2
  53. package/types/browser-ui/surface-renderer/shape-palette-options.d.ts +5 -2
  54. package/types/browser-ui/surface-renderer/shape-palette.d.ts +1 -1
  55. package/types/browser-ui/surface-renderer/surface-render-options.d.ts +0 -30
  56. package/types/browser-ui/surface-renderer/surface.d.ts +47 -38
  57. package/types/browser-ui/svg-export/definitions.d.ts +12 -0
  58. package/types/browser-ui/svg-export/image-exporter.d.ts +2 -0
  59. package/types/browser-ui/svg-export/svg-exporter.d.ts +3 -0
  60. package/types/browser-ui/templating/custom-tag-definition.d.ts +1 -2
  61. package/types/browser-ui/util.d.ts +2 -0
  62. package/types/charts/bar-and-column/bar-plot.d.ts +2 -0
  63. package/types/charts/base-chart.d.ts +62 -6
  64. package/types/charts/chart-exporter.d.ts +3 -0
  65. package/types/charts/datasource.d.ts +11 -0
  66. package/types/charts/definitions.d.ts +10 -0
  67. package/types/charts/domain_scale_utilities.d.ts +4 -0
  68. package/types/charts/legend.d.ts +2 -0
  69. package/types/charts/pie/pie-chart.d.ts +2 -0
  70. package/types/charts/sankey/sankey.d.ts +1 -0
  71. package/types/charts/scatter/definitions.d.ts +1 -0
  72. package/types/charts/series/array-based-series.d.ts +2 -0
  73. package/types/charts/series/definitions.d.ts +1 -0
  74. package/types/charts/series/series.d.ts +2 -0
  75. package/types/charts/series-based-chart.d.ts +1 -0
  76. package/types/charts/tooltip.d.ts +7 -2
  77. package/types/charts/util.d.ts +10 -3
  78. package/types/core/autosaver.d.ts +2 -1
  79. package/types/core/csv-loader.d.ts +8 -2
  80. package/types/core/event-constants.d.ts +44 -2
  81. package/types/core/geom.d.ts +1 -0
  82. package/types/core/io.d.ts +31 -7
  83. package/types/core/layout/abstract-layout.d.ts +1 -0
  84. package/types/core/layout/grid/definitions.d.ts +10 -19
  85. package/types/core/layout/grid/grid-layout.d.ts +2 -2
  86. package/types/core/layout/hierarchy/util.d.ts +1 -7
  87. package/types/core/magnetizer.d.ts +1 -0
  88. package/types/core/model/anchor.d.ts +1 -0
  89. package/types/core/model/graph.d.ts +3 -11
  90. package/types/core/model/group-template.d.ts +15 -0
  91. package/types/core/params.d.ts +2 -2
  92. package/types/core/renderer.d.ts +3 -0
  93. package/types/core/rtree/rtree.d.ts +15 -0
  94. package/types/core/selection.d.ts +2 -6
  95. package/types/core/templates/core.d.ts +1 -1
  96. package/types/core/toolkit.d.ts +30 -10
  97. package/types/core/undo-redo/undo-redo.d.ts +0 -22
  98. package/types/core/util.d.ts +4 -1
  99. package/types/ui/common/overlay.d.ts +3 -1
  100. package/types/ui/common/paint-style.d.ts +2 -0
  101. package/types/ui/connector-orthogonal/operations.d.ts +1 -18
  102. package/types/ui/connector-orthogonal/utils.d.ts +0 -6
  103. package/types/ui/connector-straight/straight-connector.d.ts +2 -5
  104. package/types/ui/core/component/component.d.ts +1 -4
  105. package/types/ui/core/connector/connection-impl.d.ts +1 -0
  106. package/types/ui/core/connector/connections.d.ts +0 -29
  107. package/types/ui/core/connector/straight-segment.d.ts +0 -6
  108. package/types/ui/core/constants.d.ts +0 -4
  109. package/types/ui/core/core-events.d.ts +5 -3
  110. package/types/ui/core/core.d.ts +19 -21
  111. package/types/ui/core/defaults.d.ts +43 -9
  112. package/types/ui/core/definitions.d.ts +39 -20
  113. package/types/ui/core/event-constants.d.ts +1 -0
  114. package/types/ui/core/factory/continuous-anchors.d.ts +0 -6
  115. package/types/ui/core/grid-profile.d.ts +3 -1
  116. package/types/ui/core/magnetize-profile.d.ts +1 -3
  117. package/types/ui/core/overlay/overlay.d.ts +2 -0
  118. package/types/ui/core/params.d.ts +8 -99
  119. package/types/ui/core/router/default-router.d.ts +89 -18
  120. package/types/ui/core/router/index.d.ts +0 -1
  121. package/types/ui/core/router/router-utils.d.ts +0 -24
  122. package/types/ui/core/router/router.d.ts +29 -20
  123. package/types/ui/core/type-descriptors.d.ts +2 -0
  124. package/types/ui/core/ui-model.d.ts +3 -0
  125. package/types/ui/core/view/edge-options.d.ts +1 -0
  126. package/types/ui/core/view/events.d.ts +22 -0
  127. package/types/ui/core/view/node-or-port-options.d.ts +6 -0
  128. package/types/ui/core/view/vertex-options.d.ts +2 -0
  129. package/types/ui/core/viewport.d.ts +7 -1
  130. package/types/ui/plugins/definitions.d.ts +6 -1
  131. package/types/ui/plugins/plugins.d.ts +4 -0
  132. package/types/ui/property-mappings/definitions.d.ts +6 -0
  133. package/types/ui/util/util.d.ts +3 -16
  134. package/types/version.d.ts +1 -1
  135. package/types/ui/core/router/base-router.d.ts +0 -100
@@ -1,7 +1,7 @@
1
1
  import { Surface } from "./surface-renderer";
2
2
  import { BrowserElement } from "./util";
3
3
  import { VisuallyJSDOMElement } from "./element-facade";
4
- import { Vertex, BoundingBox, PointXY, RectangleXY, RTree, AnchorOrientationHint, ObjectAnchorSpec } from "../core";
4
+ import { Vertex, BoundingBox, PointXY, RectangleXY, RTree, AnchorOrientationHint, ObjectAnchorSpec, ObjectData } from "../core";
5
5
  import { EdgeInputMethod } from "./edge-input-handler";
6
6
  import { ElementModelInfo } from "./definitions";
7
7
  /**
@@ -96,12 +96,6 @@ export type DropTarget = {
96
96
  * @internal
97
97
  */
98
98
  export declare function _findTargetZones(surface: Surface): Array<BrowserElement>;
99
- /**
100
- * For a given drag selector, find the current list of target elements that match, according to the selector's redrop policy.
101
- * @param surface
102
- * @internal
103
- */
104
- export declare function _findSourceZones(surface: Surface): Array<BrowserElement>;
105
99
  export declare function _findZones(surface: Surface, selector: string): Array<BrowserElement>;
106
100
  /**
107
101
  * Gets vertex info for the given element.
@@ -119,22 +113,22 @@ export declare function _getVertexInfo(surface: Surface, el: BrowserElement, asS
119
113
  * @param e
120
114
  */
121
115
  export declare function testIntersectingDropTarget(surface: Surface, dropTargets: Array<DropTarget>, boundingRect: RectangleXY, e: MouseEvent): DropTarget;
122
- export declare function _populateTargetZones(surface: Surface, activeFiltering: boolean, focusVertex: Vertex, loopbackAllowed: boolean, scope?: string): {
116
+ export declare function _populateTargetZones(surface: Surface, activeFiltering: boolean, focusVertex: Vertex, loopbackAllowed: boolean, payload?: ObjectData, scope?: string): {
123
117
  dropTargets: Array<DropTarget>;
124
118
  disabledDropTargets: Array<VisuallyJSDOMElement>;
125
119
  };
126
- export declare function _populateSourceZones(surface: Surface, activeFiltering: boolean, focusVertex: Vertex, loopbackAllowed: boolean, scope?: string): {
120
+ export declare function _populateSourceZones(surface: Surface, activeFiltering: boolean, focusVertex: Vertex, loopbackAllowed: boolean, payload?: ObjectData, scope?: string): {
127
121
  dropTargets: Array<DropTarget>;
128
122
  disabledDropTargets: Array<VisuallyJSDOMElement>;
129
123
  };
130
- export declare function _populateZones(surface: Surface, activeFiltering: boolean, focusVertex: Vertex, focusVertexIsTarget: boolean, loopbackAllowed: boolean, scope?: string): {
124
+ export declare function _populateZones(surface: Surface, activeFiltering: boolean, focusVertex: Vertex, focusVertexIsTarget: boolean, loopbackAllowed: boolean, payload?: ObjectData, scope?: string): {
131
125
  dropTargets: Array<DropTarget>;
132
126
  disabledDropTargets: Array<VisuallyJSDOMElement>;
133
127
  };
134
128
  /**
135
129
  * @internal
136
130
  */
137
- export declare class EdgeHandlerBase {
131
+ export declare abstract class EdgeHandlerBase {
138
132
  protected surface: Surface;
139
133
  protected container: BrowserElement;
140
134
  protected edgeSnap: boolean;
@@ -144,19 +138,18 @@ export declare class EdgeHandlerBase {
144
138
  protected edgeSnapType: EdgeSnapType;
145
139
  protected allowLoopbackEdges: boolean;
146
140
  activeFiltering: boolean;
141
+ $active: boolean;
147
142
  protected rtree: RTree;
148
143
  disabledDropTargets: Array<BrowserElement>;
149
144
  dropTargets: Array<DropTarget>;
150
145
  currentDropTarget: DropTarget;
151
146
  constructor(options: EdgeHandlerBaseOptions);
147
+ $refreshTree(recalcBoundingBoxes?: boolean, ...ids: Array<string>): void;
152
148
  /**
153
- * For the given point, test if it intersects the bounding rect of any of our drop targets (with a 50 pixels buffer). If so,
154
- * test if the point is inside the rectangle, in which case we return the point unchanged. But otherwise it must be in the
155
- * buffer, so we find the closest face midpoint to that point and snap to there.
149
+ * For the given point, test if it intersects the bounding rect of any of our drop targets (with a 50 pixels buffer). If so, test if the point is inside the rectangle, in which case we return the point unchanged. But otherwise it must be in the buffer, so we find the closest face midpoint to that point and snap to there.
156
150
  * @param p Point to test
157
151
  * @param edgeSnapThreshold Buffer to set around point when testing for intersections, defaults to 50.
158
- * @param edgeSnapSizeThreshold Threshold that defines a small vs large target. If a target exceeds this value in either axis it is
159
- * deemed large, and then we may snap to midpoints.
152
+ * @param edgeSnapSizeThreshold Threshold that defines a small vs large target. If a target exceeds this value in either axis it is deemed large, and then we may snap to midpoints.
160
153
  * @param edgeSnapType Type of snap to perform.
161
154
  * @internal
162
155
  */
@@ -3,13 +3,6 @@ import { BrowserElement } from "./util";
3
3
  import { Edge, Node, Vertex } from "../core";
4
4
  import { PointXY } from "../core";
5
5
  import { EdgeHandlerBase, EdgeHandlerBaseOptions } from "./edge-handler-base";
6
- /**
7
- * Added to placeholder elements used when relocating edges by dragging, or when an edge exists in the
8
- * dataset but has no source or no target
9
- * @group Edges
10
- * @category CSS Classes
11
- */
12
- export declare const CLASS_TRANSIENT_VERTEX = "vjs-transient-vertex";
13
6
  export declare const EVENT_KEYUP = "keyup";
14
7
  /**
15
8
  * Defines the drag method of creating new edges with the mouse/touch events
@@ -84,9 +77,9 @@ export declare class EdgeInputHandler extends EdgeHandlerBase {
84
77
  * @private
85
78
  */
86
79
  private _canStartNewEdgeInput;
87
- private _start;
80
+ private _startDrag;
88
81
  private _finaliseTransientEdge;
89
- private _stop;
82
+ private _stopDrag;
90
83
  /**
91
84
  * Common mouse move functionality. This method calls back to get a bounding box,
92
85
  * and expects the mouse event that instigated the move
@@ -106,7 +99,7 @@ export declare class EdgeInputHandler extends EdgeHandlerBase {
106
99
  * @param p
107
100
  * @internal
108
101
  */
109
- private _drag;
102
+ private _handleDrag;
110
103
  private _ensureTransientConnection;
111
104
  private _tapHandler;
112
105
  private $_exitTapMode;
@@ -11,7 +11,8 @@ export declare const FLOWCHART_EDGE_TYPE_DASHED = "dashed";
11
11
  /**
12
12
  * Basic edge mappings for flowcharts - a 'dashed' or 'plain' line style, and source/target/both/none arrow markers, with a configurable width/height
13
13
  * @param options
14
- * @constructor
14
+ * @group Diagrams
15
+ * @category Flowchart
15
16
  * @edgeMapping
16
17
  */
17
18
  export declare function FlowchartBasicEdgeMappings(options?: {
@@ -115,9 +115,6 @@ export declare class ElementDragHandler2 {
115
115
  newPosition: PointXY;
116
116
  private _ignoreCanvasShift;
117
117
  private _canvasShift;
118
- tapHandler: (e: MouseEvent) => void;
119
- canvasTapHandler: (e: MouseEvent) => any;
120
- documentKeypressHandler: (e: KeyboardEvent) => any;
121
118
  private _currentSurfaceZoom;
122
119
  private _activeEffectiveZoom;
123
120
  /**
@@ -2,40 +2,56 @@ import { RectangleXY } from "../../core";
2
2
  /**
3
3
  * A link icon
4
4
  * @icon
5
+ * @group Diagrams
6
+ * @category Shapes
5
7
  */
6
8
  export declare const ICON_LINK = "link";
7
9
  /**
8
10
  * Icon for the clone tool
9
11
  * @icon
12
+ * @group Diagrams
13
+ * @category Shapes
10
14
  */
11
15
  export declare const ICON_CLONE = "clone";
12
16
  /**
13
17
  * Icon for the trash tool
14
18
  * @icon
19
+ * @group Diagrams
20
+ * @category Shapes
15
21
  */
16
22
  export declare const ICON_TRASH = "trash";
17
23
  /**
18
24
  * An 'x' icon
19
25
  * @icon
26
+ * @group Diagrams
27
+ * @category Shapes
20
28
  */
21
29
  export declare const ICON_CROSS = "cross";
22
30
  /**
23
31
  * A plus sign icon
24
32
  * @icon
33
+ * @group Diagrams
34
+ * @category Shapes
25
35
  */
26
36
  export declare const ICON_PLUS = "plus";
27
37
  /**
28
38
  * A circle icon
29
39
  * @icon
40
+ * @group Diagrams
41
+ * @category Shapes
30
42
  */
31
43
  export declare const ICON_CIRCLE = "circle";
32
44
  /**
33
45
  * a 12 point gear icon
34
46
  * @icon
47
+ * @group Diagrams
48
+ * @category Shapes
35
49
  */
36
50
  export declare const ICON_GEAR = "gear";
37
51
  /**
38
52
  * Definition of an icon that can be rendered into an SVG element.
53
+ * @group Diagrams
54
+ * @category Shapes
39
55
  */
40
56
  export interface IconDefinition {
41
57
  id: string;
@@ -49,11 +65,15 @@ export interface IconDefinition {
49
65
  }
50
66
  /**
51
67
  * Map of default icons that ship with VisuallyJs
68
+ * @group Diagrams
69
+ * @category Shapes
52
70
  */
53
71
  export declare const defaultIcons: Record<string, IconDefinition>;
54
72
  /**
55
73
  * Clone a default icon definition and give it a new ID.
56
74
  * @param iconOrId
57
75
  * @param newId
76
+ * @group Diagrams
77
+ * @category Utils
58
78
  */
59
79
  export declare function cloneIcon(iconOrId: string | IconDefinition, newId: string): IconDefinition;
@@ -1,18 +1,19 @@
1
1
  import { Viewport } from "../ui";
2
- import { PointXY, Size, ZoomRange } from "../core";
2
+ import { PointXY, ZoomRange } from "../core";
3
3
  import { BrowserElement } from "./util";
4
4
  import { Background } from "./definitions";
5
5
  /**
6
6
  * Axes in which the canvas can be panned - x, y, or both. Used with the {@link WheelOptions} interface.
7
+ * @group Components
8
+ * @category Surface
7
9
  */
8
10
  export type PanAxis = "both" | "x" | "y";
9
11
  /**
10
12
  * Options to control how a user manages zoom on the canvas.
13
+ * @group Components
14
+ * @category Surface
11
15
  */
12
16
  export interface ZoomOptions {
13
- /**
14
- * Whether or not zoom is enabled. Defaults to true.
15
- */
16
17
  /**
17
18
  * When true - which is the default - the wheel will be used for zoom.
18
19
  */
@@ -36,6 +37,8 @@ export interface ZoomOptions {
36
37
  }
37
38
  /**
38
39
  * Options to control how a user pans the canvas.
40
+ * @group Components
41
+ * @category Surface
39
42
  */
40
43
  export interface PanOptions {
41
44
  /**
@@ -61,6 +64,8 @@ export interface PanOptions {
61
64
  }
62
65
  /**
63
66
  * Options for how to respond to wheel events.
67
+ * @group Components
68
+ * @category Surface
64
69
  */
65
70
  export interface WheelOptions {
66
71
  /**
@@ -115,21 +120,6 @@ export interface PanZoomOptions {
115
120
  * The element that will act as the viewport for the canvas.
116
121
  */
117
122
  viewportElement: BrowserElement;
118
- /**
119
- * A function that can return the x,y location of the given element, relative to the origin of the canvas the pan zoom
120
- * is controlling.
121
- * @param el
122
- */
123
- getOffset: (el: BrowserElement) => PointXY;
124
- /**
125
- * A function that can return the x,y location of the given element, relative to the document origin
126
- * @param el
127
- */
128
- getOffsetRelativeToRoot: (el: BrowserElement) => PointXY;
129
- /**
130
- * Gets the size of some element
131
- */
132
- getSize: (el: BrowserElement) => Size;
133
123
  /**
134
124
  * Helper function to set the position of some element.
135
125
  */
@@ -255,8 +245,7 @@ export interface PanZoomOptions {
255
245
  */
256
246
  background?: Background;
257
247
  /**
258
- * Optional fixed transform origin. When this is supplied the zoom function does not change the transform origin, and neither
259
- * does the pan. You can still zoom and pan but the zoom is applied relative to the top/left corner of the content.
248
+ * Optional fixed transform origin. When this is supplied the zoom function does not change the transform origin, and neither does the pan. You can still zoom and pan but the zoom is applied relative to the top/left corner of the content.
260
249
  */
261
250
  fixedTransformOrigin?: PointXY;
262
251
  }
@@ -3,8 +3,8 @@ import { PinchListener } from "./pinch-listener";
3
3
  import { FixedElement, FixedElementConstraints, FixedLayer } from "./fixed-layer";
4
4
  import { VisuallyJSDOMElement } from "./element-facade";
5
5
  import { EventManager } from "./event-manager";
6
- import { Viewport, ViewportBounds, ZoomToFitIfNecessaryOptions, ZoomToFitOptions, ViewportElement, AlignContentOptions, AlignContentToFaceOptions, CenterContentOptions } from "../ui";
7
- import { BoundingBox, Extents, PointXY, Size, ZoomRange, Edge, Group, Node, RectangleXY } from "../core";
6
+ import { Viewport, ViewportBounds, ZoomToFitIfNecessaryOptions, ZoomToFitOptions, ViewportElement, AlignContentOptions, AlignContentToFaceOptions, CenterContentOptions, CenterContentHorizontallyOptions, CenterContentVerticallyOptions } from "../ui";
7
+ import { BoundingBox, PointXY, Size, ZoomRange, Edge, Group, Node, RectangleXY } from "../core";
8
8
  import { BrowserElement } from "./util";
9
9
  import { Background, ZoomToExtentsOptions } from './definitions';
10
10
  /**
@@ -27,10 +27,7 @@ export interface IntersectingObjectData {
27
27
  objectType: typeof Node.objectType | typeof Group.objectType | typeof Edge.objectType;
28
28
  }
29
29
  /**
30
- * Provides Pan/Zoom functionality. This component is not something with which users of the Toolkit are expected to
31
- * work directly (although in fact it is sufficiently decoupled from the Surface that it could serve as a stand-alone
32
- * widget for other use cases, which is something we've slated for future investigation). Each Surface widget is
33
- * backed by a ZoomWidget.
30
+ * Provides Pan/Zoom functionality. This component is not something with which users of the Toolkit are expected to work directly (although in fact it is sufficiently decoupled from the Surface that it could serve as a stand-alone widget for other use cases, which is something we've slated for future investigation). Each Surface widget is backed by a ZoomWidget.
34
31
  * @internal
35
32
  */
36
33
  export declare class PanZoom {
@@ -79,7 +76,9 @@ export declare class PanZoom {
79
76
  panWithMetaKey: boolean;
80
77
  enableWheelZoom: boolean;
81
78
  enableAnimation: boolean;
79
+ wheelCssFilterSpec: string;
82
80
  wheelFilter: (e: MouseEvent) => boolean;
81
+ wheelCssFilter: (e: MouseEvent) => boolean;
83
82
  wheelZoomRequiresMetaKey: boolean;
84
83
  wheelDirection: number;
85
84
  wheelSensitivity: number;
@@ -98,9 +97,6 @@ export declare class PanZoom {
98
97
  private consumeRightClick;
99
98
  private smartMinimumZoom;
100
99
  idFunction: (e: Element) => string;
101
- getOffset: (el: Element) => PointXY;
102
- getOffsetRelativeToRoot: (el: Element) => PointXY;
103
- getSize: (el: Element) => Size;
104
100
  enabled: boolean;
105
101
  clampToBackground: boolean;
106
102
  clampToBackgroundExtents: boolean;
@@ -114,34 +110,29 @@ export declare class PanZoom {
114
110
  */
115
111
  getCompoundZoom(): number;
116
112
  /**
117
- * Calculates the "compound zoom" ie. what the visual zoom is for users. If this component is nested inside one or more
118
- * elements that have scale applied, adjust for that scale. This is agnostic of whether those parents are other pan/zoom
119
- * components - they could be any div that has a scale. This method simply gets the offset size of the viewport and
120
- * compares it with the bounding client rect size to find
121
- * the visible ratio. This method is called when the pan/zoom is created. It can be called from elsewhere in the codebase - one
122
- * example at the time of writing is the surface widget calls this method at the start of an element drag
113
+ * Add an extra selector to the wheel filter.
114
+ * @internal
115
+ * @param selector
116
+ */
117
+ $addWheelSelectorFilter(selector: string): void;
118
+ /**
119
+ * Calculates the "compound zoom" ie. what the visual zoom is for users. If this component is nested inside one or more elements that have scale applied, adjust for that scale. This is agnostic of whether those parents are other pan/zoom components - they could be any div that has a scale. This method simply gets the offset size of the viewport and compares it with the bounding client rect size to find the visible ratio. This method is called when the pan/zoom is created. It can be called from elsewhere in the codebase - one example at the time of writing is the surface widget calls this method at the start of an element drag
123
120
  * @param knownViewportSize
124
121
  * @internal
125
122
  */
126
- _computeCompoundZoom(knownViewportSize?: Size): void;
123
+ $computeCompoundZoom(knownViewportSize?: Size): void;
127
124
  /**
128
125
  * @internal
129
126
  */
130
127
  $_getViewportSize(): Size;
131
128
  private _$_getCanvasSize;
129
+ private _updateWheelCssFilter;
132
130
  private _animateToCanvasPosition;
133
131
  private _setCanvasPosition;
134
132
  private _moveCanvas;
135
133
  private _wheelPan;
136
134
  private _wheelZoom;
137
135
  private wheelPanOrZoom;
138
- /**
139
- * Sets whether or not rendering is suspended, which for the moment means that when updateBounds is
140
- * called, the widget doesn't sort the bounds, since we know there will be more changes to the
141
- * positions and/or sizes of elements.
142
- * @param val True to suspend rendering, false to re-enable rendering. If an update was called during the
143
- * time that rendering was suspended, the positions are sorted once rendering is re-enabled.
144
- */
145
136
  private _cssAnimation;
146
137
  private _constructTransformProperty;
147
138
  private _writeTransform;
@@ -163,14 +154,14 @@ export declare class PanZoom {
163
154
  * @private
164
155
  * @internal
165
156
  */
166
- _setTransformOriginToPageLocation(x: number, y: number): void;
157
+ private _setTransformOriginToPageLocation;
167
158
  /**
168
159
  * changes the transformOrigin of the canvas to be the point on the canvas at which the given event occurred, then shifts the canvas to account for this change (the user sees no shift)
169
160
  * @param e Event to use as the new transform origin.
170
161
  * @private
171
162
  * @internal
172
163
  */
173
- _setTransformOriginToEvent(e: any): void;
164
+ private _setTransformOriginToEvent;
174
165
  /**
175
166
  * Changes the transformOrigin of the canvas to be the given x,y, which is a point on the canvas.
176
167
  * @param x X location on the canvas.
@@ -178,7 +169,7 @@ export declare class PanZoom {
178
169
  * @private
179
170
  * @internal
180
171
  */
181
- _setTransformOriginToCanvasPoint(x: number, y: number): void;
172
+ $setTransformOriginToCanvasPoint(x: number, y: number): void;
182
173
  /**
183
174
  * Calculate an allowable value for zoom from the desired value.
184
175
  * @param desiredZoom
@@ -204,7 +195,6 @@ export declare class PanZoom {
204
195
  * @param paddingRatio
205
196
  */
206
197
  getBoundsInfo(padding?: number, paddingRatio?: number): ViewportBounds;
207
- isPinchZooming(): boolean;
208
198
  /**
209
199
  * Adds the given element to those that this widget is tracking.
210
200
  * @param el - Element to begin tracking.
@@ -216,7 +206,7 @@ export declare class PanZoom {
216
206
  /**
217
207
  * Removes the given element from the list this widget is tracking. Note that this widget does
218
208
  * not remove the element from the DOM.
219
- * @param Element el Element to stop tracking.
209
+ * @param el Element to stop tracking.
220
210
  */
221
211
  remove(el: BrowserElement): void;
222
212
  /**
@@ -240,8 +230,7 @@ export declare class PanZoom {
240
230
  * Zooms the display so that all the given elements fit inside the viewport.
241
231
  * @param zParams.elements List of DOM elements to zoom to.
242
232
  * @param zParams.fill A decimal indicating how much of the viewport to fill with the zoomed content. Defaults to 0.90.
243
- * @param zParams.doNotZoomIfVisible If true and the widget determines the entire selection is already
244
- * visible, the zoom will not be adjusted.
233
+ * @param zParams.doNotZoomIfVisible If true and the widget determines the entire selection is already visible, the zoom will not be adjusted.
245
234
  * @param zParams.doNotAnimate=true By default the widget does not animate this operation. You can override that behaviour by setting doNotAnimate:false.
246
235
  */
247
236
  zoomToElements(zParams: {
@@ -263,10 +252,7 @@ export declare class PanZoom {
263
252
  }): void;
264
253
  zoomToExtents(zParams: ZoomToExtentsOptions): void;
265
254
  /**
266
- * Sets (or clears) the filter that will be called if the widget needs to know whether to respond to an event that would
267
- * start a pan. By default, the widget responds to down events on the viewport or the canvas, but not on child nodes. You
268
- * can supply a function that the widget will call in the event that the down event did not occur on the viewport or the canvas
269
- * returning true from this function will cause the pan to begin.
255
+ * Sets (or clears) the filter that will be called if the widget needs to know whether to respond to an event that would start a pan. By default, the widget responds to down events on the viewport or the canvas, but not on child nodes. You can supply a function that the widget will call in the event that the down event did not occur on the viewport or the canvas returning true from this function will cause the pan to begin.
270
256
  * @param filterFn Function to set as the filter; may be null if you wish to clear it. The function should return true if it wants to honour the down event on the given element.
271
257
  */
272
258
  setFilter(filterFn: Function): void;
@@ -280,65 +266,12 @@ export declare class PanZoom {
280
266
  onComplete?: (p: PointXY) => any;
281
267
  }): void;
282
268
  /**
283
- * Positions the widget so that the edges of the background align with the viewport. This method is useful for
284
- * snapping to a corner of the background.
269
+ * Positions the widget so that the edges of the background align with the viewport. This method is useful for snapping to a corner of the background.
285
270
  * @param axes Spec for the axes to align to. This should be a space-separated string containing a value
286
- * for the x (allowed values `left` and `right`) and, optionally, y (allowed values `top` and `bottom`) axes. The
287
- * default value is `"left top"`.
271
+ * for the x (allowed values `left` and `right`) and, optionally, y (allowed values `top` and `bottom`) axes. The default value is `"left top"`.
272
+ * @param animationDuration Defaults to 150ms
288
273
  */
289
274
  alignBackground(axes: string, animationDuration?: number): void;
290
- /**
291
- * Places (using `style.left` and `style.top`) the given element at the given x,y, which is taken to
292
- * mean an x,y value on the canvas. At zoom 1, with no panning, this will be the same as the given x,y value
293
- * relative to the viewport origin. But once the canvas has been zoomed and panned we have to map
294
- * to the altered coordinates. This function also takes into account the difference between the offset of the
295
- * viewport in the page and the offset of the given element. It is assumed, just because of what this method
296
- * does, that the given element will be positioned `absolute`, but this method does nothing to ensure that.
297
- * @param el Element to position.
298
- * @param x X location on canvas to move element's left edge to.
299
- * @param y Y location on canvas to move element's top edge to.
300
- * @param xShift Optional absolute number of pixels to shift the element by in the x axis after calculating its position relative to the canvas. Typically you'd use this to place something other than the top left corner of your element at the desired location.
301
- * @param yShift Optional absolute number of pixels to shift the element by in the y axis after calculating its position relative to the canvas.
302
- * @param ensureOnScreen If true, will ensure that x and y positions are never negative.
303
- * @internal
304
- */
305
- positionElementAt(el: Element, x: number, y: number, xShift?: number, yShift?: number, ensureOnScreen?: boolean): void;
306
- /**
307
- * Places (using `style.left` and `style.top`) the given element at the given page x,y. It is assumed, just because of what this method
308
- * does, that the given element will be positioned `absolute`, but this method does nothing to ensure that.
309
- * @param el - Element to position.
310
- * @param x - X location on canvas to move element's left edge to.
311
- * @param y - Y location on canvas to move element's top edge to.
312
- * @param xShift - Optional absolute number of pixels to shift the element by in the x axis after calculating its position relative to the canvas. Typically you'd use this to place something other than the top left corner of your element at the desired location.
313
- * @param yShift - Optional absolute number of pixels to shift the element by in the y axis after calculating its position relative to the canvas.
314
- */
315
- positionElementAtPageLocation(el: Element, x: number, y: number, xShift?: number, yShift?: number): void;
316
- /**
317
- * Places (using `style.left` and `style.top`) the given element at the page x,y corresponding to the given event. It is assumed, just because of what this method does, that the given element will be positioned `absolute`, but this method does nothing to ensure that.
318
- * @param el - Element to position.
319
- * @param evt - Event to position element at.
320
- * @param xShift - Optional absolute number of pixels to shift the element by in the x axis after calculating its position relative to the canvas. Typically you'd use this to place something other than the top left corner of your element at the desired location.
321
- * @param yShift - Optional absolute number of pixels to shift the element by in the y axis after calculating its position relative to the canvas.
322
- * @internal
323
- */
324
- positionElementAtEventLocation(el: Element, evt?: MouseEvent, xShift?: number, yShift?: number): void;
325
- /**
326
- * Zooms the component by the given increment, centered on the location at which the given event occurred.
327
- * @param e - Browser event
328
- * @param increment Amount to zoom by (a positive or negative number). If this takes the component out of the current zoom range, it will be clamped.
329
- * @internal
330
- */
331
- zoomToEvent(e: Event, increment: number): void;
332
- /**
333
- * Tells the widget that a relayout has occurred. If panning is
334
- * disabled, the widget will move the canvas element so that all
335
- * content is visible, and adjust the transform origin so that the ui
336
- * zooms from the apparent top left corner. Nothing happens as a result of
337
- * this method if panning is enabled.
338
- * @param extents Bounds information
339
- * @internal
340
- */
341
- $relayout(extents: Extents): void;
342
275
  /**
343
276
  * Nudges the zoom by the given amount. Zoom will be clamped to the current zoom range in effect and the
344
277
  * value that was ultimately set is returned from this function.
@@ -399,7 +332,7 @@ export declare class PanZoom {
399
332
  * @param params.onComplete Optional function to call on operation complete (centering may be animated).
400
333
  * @param params.doNotFirePanEvent If true, a pan event will not be fired.
401
334
  */
402
- centerContentHorizontally(params: any): void;
335
+ centerContentHorizontally(params: CenterContentHorizontallyOptions): void;
403
336
  /**
404
337
  * Centers the tracked content inside the viewport vertically, but does not adjust the current zoom.
405
338
  * @param params Method parameters.
@@ -408,7 +341,7 @@ export declare class PanZoom {
408
341
  * @param params.onComplete Optional function to call on operation complete (centering may be animated).
409
342
  * @param params.doNotFirePanEvent If true, a pan event will not be fired.
410
343
  */
411
- centerContentVertically(params: any): void;
344
+ centerContentVertically(params: CenterContentVerticallyOptions): void;
412
345
  /**
413
346
  * Centers the given bounds in the viewport, vertically and/or horizontally.
414
347
  * @param cparams Optional extra parameters.
@@ -448,9 +381,7 @@ export declare class PanZoom {
448
381
  onComplete?: (p: PointXY) => any;
449
382
  }): void;
450
383
  /**
451
- * Centers on the given bounds and then adjusts the zoom of the widget so that the short axis of the viewport
452
- * is [1 / fillRatio] larger than its corresponding axis on the centered bounds. `fillRatio` is basically
453
- * a measure of how much context you want to see around the bounds on which you centered.
384
+ * Centers on the given bounds and then adjusts the zoom of the widget so that the short axis of the viewport is [1 / fillRatio] larger than its corresponding axis on the centered bounds. `fillRatio` is basically a measure of how much context you want to see around the bounds on which you centered.
454
385
  * @param cparams Centering params
455
386
  * @param cparams.fillRatio - Proportional ratio of the corresponding bounds' edge to the viewport's short edge. Defaults to 0.6.
456
387
  * @param cparams.doNotAnimate - By default, this operation is animated.
@@ -492,9 +423,7 @@ export declare class PanZoom {
492
423
  zoomIn(canvasLoc: PointXY, animate?: boolean): number;
493
424
  zoomOut(canvasLoc: PointXY, animate?: boolean): number;
494
425
  /**
495
- * Sets the current zoom range. By default, this method checks if the current zoom is within
496
- * the new range, and if it is not then `setZoom` is called, which will cause the zoom to be clamped
497
- * to an allowed value in the new range. You can disable this by passing `true` for `doNotClamp`.
426
+ * Sets the current zoom range. By default, this method checks if the current zoom is within the new range, and if it is not then `setZoom` is called, which will cause the zoom to be clamped to an allowed value in the new range. You can disable this by passing `true` for `doNotClamp`.
498
427
  *
499
428
  * @param zr New range, as an array consisting of [lower, upper] values. Lower must be less than upper.
500
429
  * @param doNotClamp If true, will not check the current zoom to ensure it falls within the new range.
@@ -541,10 +470,7 @@ export declare class PanZoom {
541
470
  */
542
471
  setTransformOrigin(x: number, y: number): void;
543
472
  /**
544
- * Maps the given page location to a value relative to the viewport origin, allowing for
545
- * zoom and pan of the canvas. This takes into account the offset of the viewport in the page so that what
546
- * you get back is the mapped position relative to the target element's [left,top] corner. If
547
- * you wish, you can supply true for 'doNotAdjustForOffset', to suppress that behavior.
473
+ * Maps the given page location to a value relative to the viewport origin, allowing for zoom and pan of the canvas. This takes into account the offset of the viewport in the page so that what you get back is the mapped position relative to the target element's [left,top] corner. If you wish, you can supply true for 'doNotAdjustForOffset', to suppress that behavior.
548
474
  * @param left X location
549
475
  * @param top Y location
550
476
  * @param roundValues If true, return integers.
@@ -571,22 +497,11 @@ export declare class PanZoom {
571
497
  * @param state Whether or not to respond to mouse events.
572
498
  */
573
499
  setEnabled(state: boolean): void;
574
- /**
575
- * Takes some element that is in the DOM and moves it so that it appears at the given x,y over the canvas,
576
- * allowing for the current zoom and pan. It is expected that the element is not one that is currently
577
- * managed by the widget - a common use case for this is some dialog, which you do not want to append to
578
- * the canvas since it would have the zoom effect applied.
579
- * @param el Selector, DOM element or element id representing the element to move.
580
- * @param x X location to move to.
581
- * @param y Y location to move to.
582
- */
583
- showElementAt(el: HTMLElement, x: number, y: number): void;
584
500
  /**
585
501
  * Returns the apparent origin of the canvas inside the viewport - the coordinates, in real pixel
586
502
  * values, of where the origin of the canvas appears to be. This apparent origin is not necessarily the
587
503
  * same as the origin values of the canvas, because the transform origin and zoom values change
588
- * things. This function can be used in conjunction with the content bounds by widgets such as the miniview,
589
- * to calculate what is actually visible in the viewport at some point in time.
504
+ * things. This function can be used in conjunction with the content bounds by widgets such as the miniview, to calculate what is actually visible in the viewport at some point in time.
590
505
  * @returns Position of the canvas, relative to the viewport's 0,0.
591
506
  */
592
507
  getApparentCanvasLocation(): PointXY;
@@ -3,6 +3,8 @@ import { BrowserUIDefaults, BrowserUIOptions } from "../definitions";
3
3
  * Css class added to a Paper component's container element
4
4
  * @cssClass
5
5
  * @context paper
6
+ * @group Components
7
+ * @category Paper
6
8
  */
7
9
  export declare const CLASS_PAPER = "vjs-paper";
8
10
  /**
@@ -8,6 +8,7 @@ import { Background } from "../definitions";
8
8
  /**
9
9
  * Provides a canvas on which nodes, groups and edges can be rendered, with support for layouts and various plugins. This is not a class that API users should instantiate directly: for users of a library integration, a Paper will be created internally by the appropriate component; for users of vanilla VisuallyJs, a Paper is created either via the {@link createPaper} factory method, or via a `renderPaper` call on an instance of the {@link BrowserUIModel}.
10
10
  * @group Components
11
+ * @category Paper
11
12
  */
12
13
  export declare class Paper extends BrowserUI {
13
14
  model: BrowserUIModel;
@@ -2,10 +2,14 @@ import { BrowserUI } from "../../browser-visuallyjs-instance";
2
2
  import { Background } from "../../definitions";
3
3
  /**
4
4
  * Defines the `logarithmic` tiling strategy
5
+ * @group Plugins
6
+ * @category Background
5
7
  */
6
8
  export declare const TILING_STRATEGY_LOGARITHMIC = "logarithmic";
7
9
  /**
8
10
  * Defines the `absolute` tiling strategy
11
+ * @group Plugins
12
+ * @category Background
9
13
  */
10
14
  export declare const TILING_STRATEGY_ABSOLUTE = "absolute";
11
15
  /**
@@ -8,6 +8,8 @@ import { ImageBackground, InternalBackgroundOptions } from "../../definitions";
8
8
  * The class that is added to each tile element in a tiled background
9
9
  * @cssClass
10
10
  * @context imageBackground
11
+ * @group Plugins
12
+ * @category Background
11
13
  */
12
14
  export declare const CLASS_BACKGROUND_TILE = "vjs-background-tile";
13
15
  export type TileSpecs = {
@@ -1,6 +1,6 @@
1
1
  import { BrowserElement } from "../util";
2
2
  import { BrowserUI } from "../browser-visuallyjs-instance";
3
- import { GroupResizeResult, UIPlugin, UIPluginOptions, ViewportElement, ViewportGroupElement } from "../../ui";
3
+ import { ConnectionEstablishedParams, GroupResizeResult, UIPlugin, UIPluginOptions, ViewportElement, ViewportGroupElement } from "../../ui";
4
4
  import { Edge, Size, Vertex, VertexUpdatedReason } from "../../core";
5
5
  /**
6
6
  * Base interface for BrowserUI plugin options.
@@ -87,4 +87,9 @@ export declare abstract class BaseBrowserUIPlugin {
87
87
  * @param edge
88
88
  */
89
89
  $edgeUpdated(edge: Edge): void;
90
+ /**
91
+ * Invoked when an edge has been rendered
92
+ * @param edge
93
+ */
94
+ $edgeRendered(p: ConnectionEstablishedParams): void;
90
95
  }