@visuallyjs/browser-ui 1.2.0 → 1.2.2
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.
- package/css/visuallyjs.css +10 -0
- package/js/visuallyjs.browser-ui.cjs.js +53 -53
- package/js/visuallyjs.browser-ui.esm.js +53 -53
- package/package.json +1 -1
- package/types/browser-ui/auto-pan-handler.d.ts +10 -1
- package/types/browser-ui/browser-visuallyjs-instance.d.ts +6 -0
- package/types/browser-ui/components/inspector/definitions.d.ts +1 -0
- package/types/browser-ui/components/inspector/inspector.d.ts +2 -2
- package/types/browser-ui/dialogs/binder.d.ts +2 -1
- package/types/browser-ui/dialogs/constants.d.ts +1 -0
- package/types/browser-ui/pan-zoom.d.ts +14 -15
- package/types/browser-ui/paper-renderer/definitions.d.ts +9 -0
- package/types/browser-ui/paper-renderer/paper.d.ts +15 -0
- package/types/browser-ui/plugins/background/generated-grid-background.d.ts +1 -1
- package/types/browser-ui/plugins/background/tiled-background.d.ts +0 -2
- package/types/browser-ui/surface-renderer/index.d.ts +1 -0
- package/types/browser-ui/surface-renderer/plugins/lasso/lasso.d.ts +10 -0
- package/types/browser-ui/surface-renderer/popups/definitions.d.ts +14 -0
- package/types/browser-ui/surface-renderer/popups/index.d.ts +3 -0
- package/types/browser-ui/surface-renderer/popups/popup-handler.d.ts +28 -0
- package/types/browser-ui/surface-renderer/popups/util.d.ts +4 -0
- package/types/browser-ui/surface-renderer/surface.d.ts +22 -9
- package/types/core/geom.d.ts +10 -4
- package/types/core/params.d.ts +58 -16
- package/types/core/search/visuallyjs-search.d.ts +4 -6
- package/types/core/toolkit.d.ts +9 -7
- package/types/core/undo-redo/update-action.d.ts +4 -1
- package/types/core/undo-redo/vertex-update-action.d.ts +4 -1
- package/types/core/util.d.ts +5 -0
- package/types/ui/core/constants.d.ts +7 -0
- package/types/ui/core/core.d.ts +10 -1
- package/types/ui/core/defaults.d.ts +5 -1
- package/types/ui/core/definitions.d.ts +9 -0
- package/types/version.d.ts +1 -1
package/types/core/toolkit.d.ts
CHANGED
|
@@ -63,11 +63,11 @@ export type BeforeStartDetachInterceptor = (source: Vertex, edge: Edge) => Recor
|
|
|
63
63
|
*/
|
|
64
64
|
export interface ModelOptions {
|
|
65
65
|
/**
|
|
66
|
-
* The name of a property that will exist inside the backing data for nodes/group, and which represents a list of ports pertaining to that node/group. When a node/group is rendered, if this property is set, VisuallyJs will consider the value of this property to be a list of port data
|
|
66
|
+
* The name of a property that will exist inside the backing data for nodes/group, and which represents a list of ports pertaining to that node/group. When a node/group is rendered, if this property is set, VisuallyJs will consider the value of this property to be a list of port data objects. So this property's value should be of type `Array<ObjectData>`. Note that this mechanism is fine for models where either all vertex types that have ports have them keyed with the same property, or you only have a single vertex type with ports, but for more advanced setups you should look at the `portExtractor` function.
|
|
67
67
|
*/
|
|
68
68
|
portDataProperty?: string;
|
|
69
69
|
/**
|
|
70
|
-
* The name of a property inside of each port's data that can be used to order the ports. For instance, you might have ports that have a `rank` property, which is a number. VisuallyJs will sort the ports according to the natural ordering of this property.
|
|
70
|
+
* The name of a property inside of each port's data that can be used to order the ports. For instance, you might have ports that have a `rank` property, which is a number. VisuallyJs will sort the ports according to the natural ordering of this property. Note that this mechanism is fine for models where either all vertex types that have ports have them keyed with the same property, or you only have a single vertex type with ports, but for more advanced setups you should look at the `portUpdated` function.
|
|
71
71
|
*/
|
|
72
72
|
portOrderProperty?: string;
|
|
73
73
|
model?: DataModelDefinition;
|
|
@@ -235,11 +235,13 @@ export interface ModelOptions {
|
|
|
235
235
|
/**
|
|
236
236
|
* A function to use to extract an array of ports from the data representing some node/group. Whenever a node/group is rendered, VisuallyJs will use this method, if provided, to determine a list of ports for that node/group. If you use this you probably also want to define a `portUpdater`. Note that if you provide the `portDataProperty` then you do not need to set this.
|
|
237
237
|
*/
|
|
238
|
-
portExtractor?: (o: ObjectData) => Array<ObjectData>;
|
|
238
|
+
portExtractor?: (o: ObjectData, nodeOrGroup: Node | Group) => Array<ObjectData>;
|
|
239
239
|
/**
|
|
240
|
-
* A function to use to update a given node/group's list of ports.
|
|
240
|
+
* A function to use to update a given node/group's list of ports. This function should return a Javascript object which represents the node/group's backing data. This method is invoked whenever changes to some vertex's ports occur.
|
|
241
|
+
*
|
|
242
|
+
* Note that if you provide the `portDataProperty` then you do not need to set this.
|
|
241
243
|
*/
|
|
242
|
-
portUpdater?:
|
|
244
|
+
portUpdater?: (data: ObjectData, nodeOrGroup: Node | Group, ports: Array<Port>) => ObjectData;
|
|
243
245
|
/**
|
|
244
246
|
* Optional model event mappings to bind
|
|
245
247
|
*/
|
|
@@ -406,8 +408,8 @@ export declare abstract class VisuallyJsModel extends OptimisticEventGenerator i
|
|
|
406
408
|
edgeTypeFunction: TypeFunction;
|
|
407
409
|
portIdFunction: IdFunction;
|
|
408
410
|
portTypeFunction: TypeFunction;
|
|
409
|
-
portExtractor:
|
|
410
|
-
portUpdater:
|
|
411
|
+
portExtractor: (o: ObjectData, nodeOrGroup: Node | Group) => Array<ObjectData>;
|
|
412
|
+
portUpdater: (data: ObjectData, nodeOrGroup: Node | Group, ports: Array<Port>) => ObjectData;
|
|
411
413
|
portDataProperty: string;
|
|
412
414
|
portOrderProperty: string;
|
|
413
415
|
modelTopAttribute: string;
|
|
@@ -8,11 +8,14 @@ import { Edge, Group, Port, Node } from "../model/graph";
|
|
|
8
8
|
export declare class UpdateAction<ReasonType> implements UndoRedoAction {
|
|
9
9
|
obj: Node | Port | Group | Edge;
|
|
10
10
|
protected instance: VisuallyJsModel;
|
|
11
|
+
protected typeChanged: boolean;
|
|
12
|
+
protected newType: string;
|
|
13
|
+
protected previousType: string;
|
|
11
14
|
type: string;
|
|
12
15
|
readonly $nd: any;
|
|
13
16
|
protected readonly $od: any;
|
|
14
17
|
private readonly reason;
|
|
15
|
-
constructor(obj: Node | Port | Group | Edge, originalData: any, instance: VisuallyJsModel, reason: ReasonType);
|
|
18
|
+
constructor(obj: Node | Port | Group | Edge, originalData: any, instance: VisuallyJsModel, reason: ReasonType, typeChanged: boolean, newType: string, previousType: string);
|
|
16
19
|
private _do;
|
|
17
20
|
undo(): void;
|
|
18
21
|
redo(): void;
|
|
@@ -7,6 +7,9 @@ import { UpdateAction } from "./update-action";
|
|
|
7
7
|
export declare class VertexUpdateAction extends UpdateAction<VertexUpdatedReason> {
|
|
8
8
|
obj: Node | Port | Group | Edge;
|
|
9
9
|
protected instance: VisuallyJsModel;
|
|
10
|
+
protected typeChanged: boolean;
|
|
11
|
+
protected newType: string;
|
|
12
|
+
protected previousType: string;
|
|
10
13
|
type: string;
|
|
11
|
-
constructor(obj: Node | Port | Group | Edge, originalData: any, instance: VisuallyJsModel, reason: VertexUpdatedReason);
|
|
14
|
+
constructor(obj: Node | Port | Group | Edge, originalData: any, instance: VisuallyJsModel, reason: VertexUpdatedReason, typeChanged: boolean, newType: string, previousType: string);
|
|
12
15
|
}
|
package/types/core/util.d.ts
CHANGED
|
@@ -362,6 +362,11 @@ export declare function isDate(o: any): o is Date;
|
|
|
362
362
|
* @internal
|
|
363
363
|
*/
|
|
364
364
|
export declare function isFunction(o: any): o is Function;
|
|
365
|
+
/**
|
|
366
|
+
* return whether or not the given value is a Class
|
|
367
|
+
* @param o
|
|
368
|
+
*/
|
|
369
|
+
export declare function isClass(o: any): boolean;
|
|
365
370
|
/**
|
|
366
371
|
* Returns whether or not the given value is of type `Function` and is a named Function.
|
|
367
372
|
* @param o
|
|
@@ -23,6 +23,13 @@ export declare const ATTRIBUTE_MANAGED = "data-vjs-managed";
|
|
|
23
23
|
* @context element-dragging
|
|
24
24
|
*/
|
|
25
25
|
export declare const ATTRIBUTE_NOT_DRAGGABLE = "data-vjs-not-draggable";
|
|
26
|
+
/**
|
|
27
|
+
* This attribute can be written onto DOM elements by node/group renderers to instruct VisuallyJs that the given element should not cause mouse events for the given vertex to be fired.
|
|
28
|
+
* @group Nodes and Groups
|
|
29
|
+
* @category DOM Attributes
|
|
30
|
+
* @domAttribute
|
|
31
|
+
*/
|
|
32
|
+
export declare const ATTRIBUTE_SUPPRESS_VERTEX_EVENTS = "data-vjs-no-events";
|
|
26
33
|
/**
|
|
27
34
|
* Written by the Surface when `elementsDraggable` is provided as a constructor option. The value of this attribute will match what you provide for `elementsDraggable`, but it's really only of any use if you set it to `false`, as `true` is the default.
|
|
28
35
|
* @internal
|
package/types/ui/core/core.d.ts
CHANGED
|
@@ -211,12 +211,17 @@ export declare abstract class UICore<EL, EVT = CoreUIEvent> extends OptimisticEv
|
|
|
211
211
|
/**
|
|
212
212
|
* @internal
|
|
213
213
|
*/
|
|
214
|
-
private
|
|
214
|
+
private $relayoutOnEdgeConnect;
|
|
215
215
|
/**
|
|
216
216
|
* @internal
|
|
217
217
|
* @private
|
|
218
218
|
*/
|
|
219
219
|
protected $relayoutOnResize: boolean;
|
|
220
|
+
/**
|
|
221
|
+
* @internal
|
|
222
|
+
* @protected
|
|
223
|
+
*/
|
|
224
|
+
protected $relayoutOnVertexRemove: boolean;
|
|
220
225
|
/**
|
|
221
226
|
* @internal
|
|
222
227
|
*/
|
|
@@ -643,6 +648,10 @@ export declare abstract class UICore<EL, EVT = CoreUIEvent> extends OptimisticEv
|
|
|
643
648
|
* Gets the current bounds of the UI's viewport.
|
|
644
649
|
*/
|
|
645
650
|
abstract getViewportBoundsInfo(): ViewportBounds;
|
|
651
|
+
/**
|
|
652
|
+
* If the UI has a fixed viewport (not panning, zooming etc), it can opt to return a value from this method. A background can use this information to place itself.
|
|
653
|
+
*/
|
|
654
|
+
abstract $getFixedViewportBoundsInfo(): ViewportBounds | null;
|
|
646
655
|
abstract getApparentCanvasLocation(): PointXY;
|
|
647
656
|
abstract toFront(v: string | Vertex | EL, alsoBringAncestorsToFront?: boolean): void;
|
|
648
657
|
abstract toBack(v: string | Vertex | EL, alsoSendAncestorsToBack?: boolean): void;
|
|
@@ -189,10 +189,14 @@ export interface UICoreOptions<E, O extends UICoreDefaults> {
|
|
|
189
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
190
|
*/
|
|
191
191
|
relayoutOnResize?: boolean;
|
|
192
|
+
/**
|
|
193
|
+
* Whether or not to relayout the UI when a vertex is removed. Defaults to false. For some layouts, like the Hierarchy layout, you may wish to switch this on.
|
|
194
|
+
*/
|
|
195
|
+
relayoutOnVertexRemove?: boolean;
|
|
192
196
|
/**
|
|
193
197
|
* 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
198
|
*/
|
|
195
|
-
|
|
199
|
+
relayoutOnEdgeConnect?: boolean;
|
|
196
200
|
/**
|
|
197
201
|
* Default options for edges - these will apply to all edge types in the UI.
|
|
198
202
|
*/
|
|
@@ -102,6 +102,10 @@ export type VertexDragFilter<E> = (p: {
|
|
|
102
102
|
* @category Definitions
|
|
103
103
|
*/
|
|
104
104
|
export type DragConstrainFunction<E> = (desiredLoc: PointXY, dragEl: E, modelObject: Node | Group, size: Size, currentLoc: PointXY, e: MouseEvent) => PointXY;
|
|
105
|
+
/**
|
|
106
|
+
* Strategy for determining whether something that is moving is considered out of bounds. Options are 'contained', ie the element must be fully contained inside the root bounds, or 'intersecting', ie. the element must intersect the root bounds by some amount. Prior to 1.1.4 the behaviour was 'contained', but a change in 1.1.4 switched this to 'intersecting', which does not necessarily provide the best UX when the canvas is hard up against the edge of the screen, because it isnt always possible to move the mouse far enough that the element is not intersecting, and in those situations panning stops. From 1.2.1 onwards the default is once again `contained`, but you can change that via the `autoPanBoundsStrategy` option on the surface's dragOptions.
|
|
107
|
+
*/
|
|
108
|
+
export type AutoPanBoundsStrategy = "contained" | "intersecting";
|
|
105
109
|
/**
|
|
106
110
|
* Options for element drag
|
|
107
111
|
* @group UI
|
|
@@ -136,6 +140,10 @@ export interface DragOptions<E> {
|
|
|
136
140
|
* When auto-panning, this is the number of pixels that the canvas repositions itself on each tick. Defaults to 5.
|
|
137
141
|
*/
|
|
138
142
|
autoPanDelta?: number;
|
|
143
|
+
/**
|
|
144
|
+
* When auto-panning, this flag instructs the auto pan how to determine if an element is inside the root bounds or not. A value of "contained" (the default), means the whole element has to be inside the root bounds. A value of "intersecting" means that the element needs to just intersect the root bounds by some amount.
|
|
145
|
+
*/
|
|
146
|
+
autoPanBoundsStrategy?: AutoPanBoundsStrategy;
|
|
139
147
|
/**
|
|
140
148
|
* Optional function that is invoked at the start of a drag, and which identifies allowed drop targets. Each target - the canvas, nodes and groups - is passed in turn to this method; returning false indicates that the given target is not valid for that drag.
|
|
141
149
|
* @param candidate
|
|
@@ -164,6 +172,7 @@ export interface SupportsElementDragging<E> {
|
|
|
164
172
|
$startPanRepeat: (dirX: 1 | 0 | -1, dirY: 1 | 0 | -1, dx: number, dy: number, interval: number, cb?: (total: PointXY) => any) => void;
|
|
165
173
|
$stopPanRepeat: () => void;
|
|
166
174
|
$provisionallyMagnetize(focus: Vertex, repositionFocus: boolean, knownLocations: Record<string, PointXY>, knownSizes: Record<string, Size>, magnetizerIsAlreadyPrimed: boolean, invertTrackbackPreference: boolean): MagnetizeResult;
|
|
175
|
+
addVertexDragFilter(f: VertexDragFilter<E>): void;
|
|
167
176
|
}
|
|
168
177
|
/**
|
|
169
178
|
* Payload for the node:move:start event that is fired when a node/group has just begun to be moved.
|
package/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "1.2.
|
|
1
|
+
export declare const VERSION = "1.2.2";
|