@visuallyjs/browser-ui 1.2.4 → 1.2.6
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 +34 -16
- package/js/visuallyjs.browser-ui.cjs.js +91 -59
- package/js/visuallyjs.browser-ui.esm.js +91 -59
- package/package.json +1 -1
- package/types/browser-ui/browser-util.d.ts +0 -7
- package/types/browser-ui/browser-visuallyjs-instance.d.ts +1 -0
- package/types/browser-ui/components/controls/controls-component.d.ts +8 -0
- package/types/browser-ui/components/index.d.ts +1 -0
- package/types/browser-ui/components/palette/auto-edge-connect.d.ts +74 -0
- package/types/browser-ui/components/palette/definitions.d.ts +50 -0
- package/types/browser-ui/components/palette/index.d.ts +3 -0
- package/types/browser-ui/components/palette/palette-options.d.ts +59 -2
- package/types/browser-ui/components/palette/palette.d.ts +25 -15
- package/types/browser-ui/components/palette/util.d.ts +21 -0
- package/types/browser-ui/components/rotate-manager.d.ts +27 -0
- package/types/browser-ui/constants.d.ts +5 -2
- package/types/browser-ui/css-constants.d.ts +28 -2
- package/types/browser-ui/definitions.d.ts +10 -2
- package/types/browser-ui/edge-handler-base.d.ts +20 -1
- package/types/browser-ui/edge-input-handler.d.ts +1 -18
- package/types/browser-ui/element-drag-handler-2.d.ts +4 -2
- package/types/browser-ui/event-manager.d.ts +7 -0
- package/types/browser-ui/index.d.ts +2 -1
- package/types/browser-ui/keyboard/index.d.ts +1 -0
- package/types/browser-ui/keyboard/keyboard-listener.d.ts +7 -0
- package/types/browser-ui/pan-zoom-options.d.ts +5 -0
- package/types/browser-ui/pan-zoom.d.ts +2 -1
- package/types/browser-ui/paper-renderer/paper.d.ts +1 -0
- package/types/browser-ui/positioning-and-sizing-utils.d.ts +5 -0
- package/types/browser-ui/shape-library/shape-library-definitions.d.ts +53 -12
- package/types/browser-ui/shape-library/shape-library.d.ts +15 -9
- package/types/browser-ui/surface-renderer/css-classes.d.ts +8 -0
- package/types/browser-ui/surface-renderer/diagrams/definitions.d.ts +46 -5
- package/types/browser-ui/surface-renderer/diagrams/diagram.d.ts +11 -1
- package/types/browser-ui/surface-renderer/diagrams/mediator.d.ts +7 -7
- package/types/browser-ui/surface-renderer/plugins/lasso/lasso.d.ts +1 -1
- package/types/browser-ui/surface-renderer/plugins/resizing-tools/resizing-tools-plugin.d.ts +4 -3
- package/types/browser-ui/surface-renderer/shape-palette-options.d.ts +31 -3
- package/types/browser-ui/surface-renderer/shape-palette.d.ts +1 -0
- package/types/browser-ui/surface-renderer/surface.d.ts +15 -1
- package/types/browser-ui/svg-util.d.ts +3 -1
- package/types/core/datasource.d.ts +1 -1
- package/types/core/geom.d.ts +6 -0
- package/types/core/io.d.ts +17 -3
- package/types/core/model/graph.d.ts +6 -2
- package/types/core/model/group-template.d.ts +4 -2
- package/types/core/params.d.ts +4 -4
- package/types/core/rtree/definitions.d.ts +5 -5
- package/types/core/rtree/rtree.d.ts +2 -2
- package/types/core/rtree/util.d.ts +2 -1
- package/types/core/toolkit.d.ts +7 -3
- package/types/test-support/test-support.d.ts +45 -1
- package/types/ui/common/anchor.d.ts +0 -4
- package/types/ui/common/overlay.d.ts +13 -1
- package/types/ui/core/constants.d.ts +24 -0
- package/types/ui/core/core.d.ts +40 -8
- package/types/ui/core/definitions.d.ts +12 -5
- package/types/ui/core/factory/anchor-record-factory.d.ts +6 -1
- package/types/ui/core/type-descriptors.d.ts +2 -2
- package/types/ui/core/view/group-options.d.ts +4 -0
- package/types/version.d.ts +1 -1
package/types/core/io.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export type Parser = (data: any, instance: VisuallyJsModel, parameters?: any) =>
|
|
|
29
29
|
*/
|
|
30
30
|
export type Exporter = (instance: VisuallyJsModel, parameters: any) => any;
|
|
31
31
|
/**
|
|
32
|
-
* The default type that represents an edge in a dataset to load or a saved dataset
|
|
32
|
+
* The default type that represents an edge in a dataset to load or a saved dataset. Edges differ slightly from nodes and groups in that there are fields which are mandatory: `source` and `data`. Edges also differ from nodes and groups in that any backing data for an edge (including its `id` and/or `type`) need to be provided in the `data` member of the edge, not in the root as with nodes and groups.
|
|
33
33
|
* @group Model
|
|
34
34
|
*/
|
|
35
35
|
export interface EdgeData {
|
|
@@ -66,12 +66,12 @@ export interface EdgeData {
|
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
69
|
-
* The default type that represents a node in a dataset to load or a saved dataset
|
|
69
|
+
* The default type that represents a node in a dataset to load or a saved dataset. While there are no specific requirements for the entries in node data, the default configuration expects that you will at the minimum have provided an `id`. Nodes have an associated `type`, which VisuallyJs will set to "default" in the absence of you providing one; as you start to build more complex interfaces with VisuallyJs you will want to provide the `type` member.
|
|
70
70
|
* @group Data Model
|
|
71
71
|
*/
|
|
72
72
|
export type NodeData = Record<string, any>;
|
|
73
73
|
/**
|
|
74
|
-
* The default type that represents a group in a dataset to load or a saved dataset
|
|
74
|
+
* The default type that represents a group in a dataset to load or a saved dataset. While there are no specific requirements for the entries in groups data, the default configuration expects that you will at the minimum have provided an `id`. Groups have an associated `type`, which VisuallyJs will set to "default" in the absence of you providing one; as you start to build more complex interfaces with VisuallyJs you will want to provide the `type` member.
|
|
75
75
|
* @group Data Model
|
|
76
76
|
*/
|
|
77
77
|
export type GroupData = Record<string, any>;
|
|
@@ -94,6 +94,20 @@ export interface VisuallyJsDefaultJSON {
|
|
|
94
94
|
*/
|
|
95
95
|
groups?: Array<GroupData>;
|
|
96
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* An entry in the hierarchical json format.
|
|
99
|
+
* @group Data Model
|
|
100
|
+
* @category Input and Output
|
|
101
|
+
*/
|
|
102
|
+
export interface VisuallyJsHierarchicalJSONEntry extends ObjectData {
|
|
103
|
+
children?: Array<VisuallyJsHierarchicalJSONEntry>;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* The Hierarchical JSON format. Consists of a single root entry, which has a children array, each of which may have children, etc.
|
|
107
|
+
* @group Data Model
|
|
108
|
+
* @category Input and Output
|
|
109
|
+
*/
|
|
110
|
+
export type VisuallyJsHierarchicalJSON = VisuallyJsHierarchicalJSONEntry;
|
|
97
111
|
/**
|
|
98
112
|
* Defines the default JSON datatype
|
|
99
113
|
*/
|
|
@@ -202,8 +202,8 @@ export interface InternalAddEdgeOptions {
|
|
|
202
202
|
directed?: boolean;
|
|
203
203
|
transient?: boolean;
|
|
204
204
|
anchors?: {
|
|
205
|
-
source?:
|
|
206
|
-
target?:
|
|
205
|
+
source?: any;
|
|
206
|
+
target?: any;
|
|
207
207
|
};
|
|
208
208
|
}
|
|
209
209
|
/**
|
|
@@ -1045,6 +1045,10 @@ export declare class Group extends Node {
|
|
|
1045
1045
|
* @internal
|
|
1046
1046
|
*/
|
|
1047
1047
|
_memberMap: Record<string, Node>;
|
|
1048
|
+
/**
|
|
1049
|
+
* @internal
|
|
1050
|
+
*/
|
|
1051
|
+
locked: boolean;
|
|
1048
1052
|
constructor(graph: Graph, data?: any, idFunction?: IdFunction);
|
|
1049
1053
|
/**
|
|
1050
1054
|
* @internal
|
|
@@ -8,8 +8,10 @@ export interface GroupTemplate {
|
|
|
8
8
|
groupTemplate?: string | GroupTemplate;
|
|
9
9
|
}>;
|
|
10
10
|
edges?: Array<{
|
|
11
|
-
source
|
|
12
|
-
|
|
11
|
+
source?: string;
|
|
12
|
+
sourcePort?: string;
|
|
13
|
+
target?: string;
|
|
14
|
+
targetPort?: string;
|
|
13
15
|
data?: ObjectData;
|
|
14
16
|
}>;
|
|
15
17
|
}
|
package/types/core/params.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { VisuallyJsRenderer } from "./renderer";
|
|
|
3
3
|
import { PointXY } from "./util";
|
|
4
4
|
import { EdgeUpdatedReason, VertexUpdatedReason } from "./toolkit";
|
|
5
5
|
import { VisuallyJsSelection } from "./selection";
|
|
6
|
-
import {
|
|
6
|
+
import { LineStyle, SingleAnchorSpec } from "../ui";
|
|
7
7
|
/**
|
|
8
8
|
* Defines the payload for a node added event.
|
|
9
9
|
* @group Events
|
|
@@ -495,7 +495,7 @@ export interface AddEdgeOptions {
|
|
|
495
495
|
/**
|
|
496
496
|
* Optional backing data for the edge.
|
|
497
497
|
*/
|
|
498
|
-
data?:
|
|
498
|
+
data?: ObjectData & LineStyle;
|
|
499
499
|
/**
|
|
500
500
|
* Optional edge cost. Defaults to 1.
|
|
501
501
|
*/
|
|
@@ -512,7 +512,7 @@ export interface AddEdgeOptions {
|
|
|
512
512
|
* Optional anchors for the edge.
|
|
513
513
|
*/
|
|
514
514
|
anchors?: {
|
|
515
|
-
source?:
|
|
516
|
-
target?:
|
|
515
|
+
source?: SingleAnchorSpec;
|
|
516
|
+
target?: SingleAnchorSpec;
|
|
517
517
|
};
|
|
518
518
|
}
|
|
@@ -4,10 +4,10 @@ import { RectangleXY } from "../util";
|
|
|
4
4
|
* Base region used by RTree
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
7
|
-
export interface RTreeRegion extends RectangleXY {
|
|
8
|
-
data?:
|
|
9
|
-
children: Array<RTreeRegion
|
|
10
|
-
parent?: RTreeRegion
|
|
7
|
+
export interface RTreeRegion<DataPayload extends ObjectData = ObjectData> extends RectangleXY {
|
|
8
|
+
data?: DataPayload;
|
|
9
|
+
children: Array<RTreeRegion<DataPayload>>;
|
|
10
|
+
parent?: RTreeRegion<DataPayload>;
|
|
11
11
|
id?: string;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
@@ -19,6 +19,6 @@ export declare const RTREE_DEFAULT_MAX_CHILD_ENTRIES = 4;
|
|
|
19
19
|
* A data node in an RTree
|
|
20
20
|
* @internal
|
|
21
21
|
*/
|
|
22
|
-
export interface RTreeDataNode extends RTreeRegion {
|
|
22
|
+
export interface RTreeDataNode<DataPayload extends ObjectData = ObjectData> extends RTreeRegion<DataPayload> {
|
|
23
23
|
id: string;
|
|
24
24
|
}
|
|
@@ -23,7 +23,7 @@ export interface RTreeSearchOptions {
|
|
|
23
23
|
* An RTree. Used internally to facilitate fast spatial querying.
|
|
24
24
|
* @internal
|
|
25
25
|
*/
|
|
26
|
-
export declare class RTree {
|
|
26
|
+
export declare class RTree<DataPayload extends ObjectData = ObjectData> {
|
|
27
27
|
private readonly _maxNodes;
|
|
28
28
|
private _root;
|
|
29
29
|
private _dataNodes;
|
|
@@ -33,7 +33,7 @@ export declare class RTree {
|
|
|
33
33
|
* @param searchBoundary
|
|
34
34
|
* @param options
|
|
35
35
|
*/
|
|
36
|
-
search(searchBoundary: RectangleXY, options?: RTreeSearchOptions): Array<RTreeDataNode
|
|
36
|
+
search(searchBoundary: RectangleXY, options?: RTreeSearchOptions): Array<RTreeDataNode<DataPayload>>;
|
|
37
37
|
/**
|
|
38
38
|
* Search the tree and find all entries that intersect the given rectangle, then rank them by the amount they overlap.
|
|
39
39
|
* @param searchBoundary
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RTreeRegion } from "./definitions";
|
|
2
|
+
import { ObjectData } from "../model/graph";
|
|
2
3
|
export declare function _growToFit(rectToGrow: RTreeRegion, otherRect: RTreeRegion): void;
|
|
3
4
|
/**
|
|
4
5
|
* Adjust the bounds of `rect` so that they fit the bounds of its children, then if the rect has a parent, traverse up to the parent
|
|
@@ -14,7 +15,7 @@ export declare function splitIntoSiblings(r: RTreeRegion): [RTreeRegion, RTreeRe
|
|
|
14
15
|
* @private
|
|
15
16
|
* @internal
|
|
16
17
|
*/
|
|
17
|
-
export declare function _emptyRTreeRegion(id?: string): RTreeRegion
|
|
18
|
+
export declare function _emptyRTreeRegion<DataPayload extends ObjectData = ObjectData>(id?: string): RTreeRegion<DataPayload>;
|
|
18
19
|
/**
|
|
19
20
|
* Return whether or not the given region is a leaf
|
|
20
21
|
* @param r
|
package/types/core/toolkit.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ import { PointXY, Geometry } from "./util";
|
|
|
16
16
|
import { OptimisticEventGenerator } from "./event-generator";
|
|
17
17
|
import { ProxyLocation } from "./constants";
|
|
18
18
|
import { GroupTemplate } from "./model/group-template";
|
|
19
|
+
import { SingleAnchorSpec } from "../ui";
|
|
19
20
|
/**
|
|
20
21
|
* Definition of a function to use as a beforeConnect interceptor.
|
|
21
22
|
* @param source The source vertex for the new edge
|
|
@@ -550,11 +551,11 @@ export declare abstract class VisuallyJsModel extends OptimisticEventGenerator i
|
|
|
550
551
|
*/
|
|
551
552
|
getDescendants(vertex: Group): Array<Node | Group>;
|
|
552
553
|
/**
|
|
553
|
-
* Gets a list of groups that are ancestors of the given node/group. The list of ancestors is ordered in terms of their proximity to the focus, ie. the first entry is the focus vertex's immediate parent.
|
|
554
|
+
* Gets a list of groups that are ancestors of the given node/group (or port, for which we first resolve the node/group it resides on). The list of ancestors is ordered in terms of their proximity to the focus, ie. the first entry is the focus vertex's immediate parent.
|
|
554
555
|
* @param vertex
|
|
555
556
|
*
|
|
556
557
|
*/
|
|
557
|
-
getAncestors(vertex:
|
|
558
|
+
getAncestors(vertex: Vertex): Array<Group>;
|
|
558
559
|
/**
|
|
559
560
|
* Returns whether or not `possibleAncestor` is in fact an ancestor of the given focus node/group
|
|
560
561
|
* @param focus Vertex to test
|
|
@@ -722,7 +723,10 @@ export declare abstract class VisuallyJsModel extends OptimisticEventGenerator i
|
|
|
722
723
|
* @param context
|
|
723
724
|
* @internal
|
|
724
725
|
*/
|
|
725
|
-
$addTransientEdge(renderer: VisuallyJsRenderer<any>, source: Vertex, target: Vertex, data?: ObjectData, geometry?: Geometry, context?: Record<string, any
|
|
726
|
+
$addTransientEdge(renderer: VisuallyJsRenderer<any>, source: string | Vertex, target: string | Vertex, data?: ObjectData, geometry?: Geometry, context?: Record<string, any>, anchors?: {
|
|
727
|
+
source?: SingleAnchorSpec;
|
|
728
|
+
target?: SingleAnchorSpec;
|
|
729
|
+
}): Edge;
|
|
726
730
|
/**
|
|
727
731
|
* Adds a Group by type, running the data generation for the node through the current GroupFactory. This is different from `addGroup` in that with `addGroup` you are supplying the final data and your GroupFactory is not called. This method can be called with one, two or three arguments. A single argument is considered to be the new Group's `type`, and a backing data object will be created with this set, and no callback will occur. If you provide two arguments the second argument may be either the new Group's backing data OR a callback to hit with the newly created Group. With three arguments the second argument is the Group's backing data and the third is a callback to hit with the newly created Group.
|
|
728
732
|
* @param type Required. Type of the object to create. `type` will be passed as the first argument to your group factory.
|
|
@@ -42,6 +42,7 @@ export interface SynthesizedEvent {
|
|
|
42
42
|
pageY: number;
|
|
43
43
|
}
|
|
44
44
|
declare function _createMouseEventWithPageLoc(el: Element, evt: string, pageLoc: PointXY, metaKeys?: Record<string, boolean>, button?: number): void;
|
|
45
|
+
declare function _createKeyboardEvent(el: Element, type: string, key: string, modifiers?: Record<string, boolean>): void;
|
|
45
46
|
/**
|
|
46
47
|
* Callbacks you can provide to connection drag methods in the TestHarness to interrupt the process
|
|
47
48
|
* and inspect what's going on.
|
|
@@ -63,6 +64,37 @@ export interface DragEventHandlers {
|
|
|
63
64
|
afterMove?: Function;
|
|
64
65
|
afterUp?: Function;
|
|
65
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Hadlers you can pass as an argument to palette drag handlers,
|
|
69
|
+
*/
|
|
70
|
+
export interface PaletteEventHandlers {
|
|
71
|
+
/**
|
|
72
|
+
* Fired before the mousedown event is posted
|
|
73
|
+
*/
|
|
74
|
+
beforeDown?: Function;
|
|
75
|
+
/**
|
|
76
|
+
* Fired before an initial move event is posted
|
|
77
|
+
*/
|
|
78
|
+
beforeMove?: Function;
|
|
79
|
+
/**
|
|
80
|
+
* fired after the initial move event is posted and before the 2nd move event is posted
|
|
81
|
+
*/
|
|
82
|
+
afterMove?: Function;
|
|
83
|
+
/**
|
|
84
|
+
* Fired after the 2nd move event, before the up event
|
|
85
|
+
*/
|
|
86
|
+
beforeUp?: Function;
|
|
87
|
+
/**
|
|
88
|
+
* Fired after the operation has been completed
|
|
89
|
+
*/
|
|
90
|
+
after?: Function;
|
|
91
|
+
}
|
|
92
|
+
export type PaletteDragHarness = {
|
|
93
|
+
start: () => any;
|
|
94
|
+
move: () => any;
|
|
95
|
+
up: () => any;
|
|
96
|
+
end: () => any;
|
|
97
|
+
};
|
|
66
98
|
/**
|
|
67
99
|
* Synthesize an event
|
|
68
100
|
* @param l
|
|
@@ -99,6 +131,7 @@ export declare const VisuallyJsTestSupport: {
|
|
|
99
131
|
getEdgeCanvas: typeof getEdgeCanvas;
|
|
100
132
|
defaultEventManager: EventManager;
|
|
101
133
|
createMouseEventWithPageLoc: typeof _createMouseEventWithPageLoc;
|
|
134
|
+
keyEvent: typeof _createKeyboardEvent;
|
|
102
135
|
/**
|
|
103
136
|
* Drag any DOM element around, not just elements managed by the surface.
|
|
104
137
|
* @param el
|
|
@@ -461,6 +494,14 @@ export declare class TestHarness {
|
|
|
461
494
|
* @param data
|
|
462
495
|
*/
|
|
463
496
|
triggerEventAt(el: HTMLElement, eventName: string, x: number, y: number, data?: Record<string, any>): void;
|
|
497
|
+
/**
|
|
498
|
+
* Dispatch a keyboard event of the given type on the given element, with the given key code.
|
|
499
|
+
* @param el Element to dispatch the event on.
|
|
500
|
+
* @param type Type of event, e.g. "keydown", "keyup", "keypress".
|
|
501
|
+
* @param key
|
|
502
|
+
* @param modifiers Optional modifiers for the event.
|
|
503
|
+
*/
|
|
504
|
+
keyEvent(el: Element, type: string, key: string, modifiers?: Record<string, boolean>): void;
|
|
464
505
|
/**
|
|
465
506
|
* Synthesize an event for the given object. This method is used by other parts of the test harness class
|
|
466
507
|
* and is not something a user of the API will necessarily need to make use of.
|
|
@@ -744,8 +785,11 @@ export declare class TestHarness {
|
|
|
744
785
|
* @param edgeOrEdgeId
|
|
745
786
|
*/
|
|
746
787
|
dblTapOnEdge(edgeOrEdgeId: string | Edge): void;
|
|
788
|
+
private _addFromPaletteInit;
|
|
747
789
|
private _addFromPalette;
|
|
748
|
-
|
|
790
|
+
private _addFromPaletteASync;
|
|
791
|
+
dragFromPalette(palette: Palette<any>, selector: string, options?: any, metaKeys?: Record<string, boolean>): void;
|
|
792
|
+
dragFromPaletteAsync(palette: Palette<any>, selector: string, options?: any, metaKeys?: Record<string, boolean>): PaletteDragHarness;
|
|
749
793
|
tapFromPalette(palette: Palette<any>, selector: string, options?: any): void;
|
|
750
794
|
/**
|
|
751
795
|
* Trigger a mousedown event on the edge with the given id.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PaintStyle } from './paint-style';
|
|
2
2
|
import { OverlayEvents, OverlayVisibility } from "../core/overlay/overlay";
|
|
3
3
|
import { FontSpec } from "../../browser-ui";
|
|
4
|
+
import { Edge } from "../../core";
|
|
4
5
|
/**
|
|
5
6
|
* Base options for an overlay.
|
|
6
7
|
* @group Edges
|
|
@@ -111,7 +112,18 @@ export type FullOverlaySpec = {
|
|
|
111
112
|
*/
|
|
112
113
|
options: OverlayOptions;
|
|
113
114
|
};
|
|
114
|
-
export
|
|
115
|
+
export interface InternalOverlayOptions extends OverlayOptions {
|
|
116
|
+
shouldAddToEdge?: (e: Edge) => boolean;
|
|
117
|
+
}
|
|
118
|
+
export type InternalOverlaySpec = {
|
|
119
|
+
/**
|
|
120
|
+
* Overlay type
|
|
121
|
+
*/
|
|
122
|
+
type: string;
|
|
123
|
+
/**
|
|
124
|
+
* Options for the overlay
|
|
125
|
+
*/
|
|
126
|
+
options: InternalOverlayOptions;
|
|
115
127
|
sourceMarker?: boolean;
|
|
116
128
|
targetMarker?: boolean;
|
|
117
129
|
};
|
|
@@ -163,6 +163,30 @@ export declare const ATTRIBUTE_VJS_TARGET_PORT_TYPE = "data-vjs-target-port-type
|
|
|
163
163
|
* @context edge-dragging
|
|
164
164
|
*/
|
|
165
165
|
export declare const ATTRIBUTE_VJS_MAGNET = "data-vjs-magnet";
|
|
166
|
+
/**
|
|
167
|
+
* Specifies the anchor to use for both source and target of an edge connected to some element, when an edge is dragged from that element as the source.
|
|
168
|
+
* @group Nodes and Groups
|
|
169
|
+
* @category DOM Attributes
|
|
170
|
+
* @domAttribute
|
|
171
|
+
* @context edge-dragging
|
|
172
|
+
*/
|
|
173
|
+
export declare const ATTRIBUTE_VJS_ANCHOR = "data-vjs-anchor";
|
|
174
|
+
/**
|
|
175
|
+
* Specifies the anchor to use for the source of an edge connected to some element, when an edge is dragged from that element.
|
|
176
|
+
* @group Nodes and Groups
|
|
177
|
+
* @category DOM Attributes
|
|
178
|
+
* @domAttribute
|
|
179
|
+
* @context edge-dragging
|
|
180
|
+
*/
|
|
181
|
+
export declare const ATTRIBUTE_VJS_SOURCE_ANCHOR = "data-vjs-source-anchor";
|
|
182
|
+
/**
|
|
183
|
+
* Specifies the anchor to use for the target of an edge connected to some element, when an edge is dragged from that element.
|
|
184
|
+
* @group Nodes and Groups
|
|
185
|
+
* @category DOM Attributes
|
|
186
|
+
* @domAttribute
|
|
187
|
+
* @context edge-dragging
|
|
188
|
+
*/
|
|
189
|
+
export declare const ATTRIBUTE_VJS_TARGET_ANCHOR = "data-vjs-target-anchor";
|
|
166
190
|
/**
|
|
167
191
|
* Attribute written by VisuallyJs to store edge id on its visual representation.
|
|
168
192
|
* @group Edges
|
package/types/ui/core/core.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { ConnectionEstablishedParams } from "./callbacks";
|
|
|
6
6
|
import { Viewport, ViewportElement, ViewportGroupElement, ViewportNodeElement } from "./viewport";
|
|
7
7
|
import { ComponentBase } from './component/component';
|
|
8
8
|
import { LabelOverlay } from './overlay/label-overlay';
|
|
9
|
-
import { AnchorSpec, LightweightAnchor, FullOverlaySpec, OverlaySpec, Connector, PaintStyle, ConnectorSpec } from "../common";
|
|
9
|
+
import { AnchorSpec, LightweightAnchor, FullOverlaySpec, OverlaySpec, Connector, PaintStyle, ConnectorSpec, SingleAnchorSpec } from "../common";
|
|
10
10
|
import { GroupRelayoutReason } from './event-constants';
|
|
11
11
|
import { Connection } from "./connector/connection-impl";
|
|
12
12
|
import { Base, Edge, Group, Node, ObjectData, Port, Vertex, IntersectingVertex, PortRemovedParams, PortAddedParams, ProxyLocation, ObjectAnchorSpec } from "../../core";
|
|
@@ -15,7 +15,7 @@ import { GroupMapping, NodeMapping, NodeOrGroupMapping, PortMapping, VertexMappi
|
|
|
15
15
|
import { Magnetizer, MagnetizeResult } from "../../core/magnetizer";
|
|
16
16
|
import { AbstractLayout, LayoutParameters, LayoutResultSet } from "../../core/layout/abstract-layout";
|
|
17
17
|
import { DataSource, EdgeAddedParams, EdgeRemovedParams, EdgeSourceChangedParams, EdgeTargetChangedParams, Extents, FilterableDataset, Grid, GroupAddedParams, GroupMemberAddedParams, GroupMemberRemovedParams, GroupRemovedParams, NodeAddedParams, NodeRemovedParams, OptimisticEventGenerator, PointXY, RectangleXY, VisuallyJsSelection, Size, VisuallyJsRenderer, VertexUpdatedParams, VisuallyJsModel, SaveOptions, Rotations, AbstractLayoutAdapter } from "../../core";
|
|
18
|
-
import { DataHook, ElementType, EnclosedVerticesOptions, GroupContentAreaInfo, GroupResizeResult, IntersectingVerticesOptions, UIExportOptions, UISaveData, ViewportBounds, ZoomToElementsOptions, ZoomToFitIfNecessaryOptions, ZoomToFitOptions } from "./definitions";
|
|
18
|
+
import { DataHook, ElementType, EnclosedVerticesOptions, GroupContentAreaInfo, GroupResizeResult, IntersectingVerticesOptions, UICapabilities, UIExportOptions, UISaveData, ViewportBounds, ZoomToElementsOptions, ZoomToFitIfNecessaryOptions, ZoomToFitOptions } from "./definitions";
|
|
19
19
|
import { GridProfile } from "./grid-profile";
|
|
20
20
|
import { MagnetizeProfile } from "./magnetize-profile";
|
|
21
21
|
import { UIPlugin, UIPluginOptions, UIPluginSpec } from "../plugins/definitions";
|
|
@@ -109,6 +109,8 @@ export declare abstract class UICore<EL, EVT = CoreUIEvent> extends OptimisticEv
|
|
|
109
109
|
$_discardEdgeEditsOnDrag: boolean;
|
|
110
110
|
$_vertexBuffer: number;
|
|
111
111
|
$_vertexBorder: number;
|
|
112
|
+
private _installedCapabilities;
|
|
113
|
+
private _installedCapabilitiesConfigurationProviders;
|
|
112
114
|
private _$_edgesAvoidVertices;
|
|
113
115
|
readonly viewport: Viewport<EL>;
|
|
114
116
|
readonly router: Router<EL>;
|
|
@@ -128,6 +130,17 @@ export declare abstract class UICore<EL, EVT = CoreUIEvent> extends OptimisticEv
|
|
|
128
130
|
* @internal
|
|
129
131
|
*/
|
|
130
132
|
protected $isInMotion: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Mark a group as "locked" : edges inside of it cannot be detached, removed or have their paths edited, edges cannot be established to child vertices.
|
|
135
|
+
* @param groupIdOrGroup
|
|
136
|
+
*/
|
|
137
|
+
lockGroup(groupIdOrGroup: string | Group): void;
|
|
138
|
+
$isGroupDefinedAsLocked(g: Group): boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Unlock a group.
|
|
141
|
+
* @param groupIdOrGroup
|
|
142
|
+
*/
|
|
143
|
+
unlockGroup(groupIdOrGroup: string | Group): void;
|
|
131
144
|
magnetizerProfile: MagnetizeProfile;
|
|
132
145
|
protected magnetizer: Magnetizer<Vertex>;
|
|
133
146
|
/**
|
|
@@ -244,6 +257,22 @@ export declare abstract class UICore<EL, EVT = CoreUIEvent> extends OptimisticEv
|
|
|
244
257
|
* @param size
|
|
245
258
|
*/
|
|
246
259
|
abstract $setGroupElementSize(group: Group, size: Size): void;
|
|
260
|
+
/**
|
|
261
|
+
* Test whether the specific capability is available on this instance of the UI.
|
|
262
|
+
* @param c
|
|
263
|
+
*/
|
|
264
|
+
$hasCapability(c: UICapabilities): boolean;
|
|
265
|
+
/**
|
|
266
|
+
* Gets the config for some capability. May be an empty object. A capability provider may be registered at the point that a capability is registered - the function is provided by the code that registers the capability.
|
|
267
|
+
* @param c
|
|
268
|
+
*/
|
|
269
|
+
$getCapabilityConfig(c: UICapabilities): Record<string, any>;
|
|
270
|
+
/**
|
|
271
|
+
* For subclasses/plugins/component to use to register that a specific capability is available. It is not possible for external code to say a capability is _not_ available, only that one is.
|
|
272
|
+
* @param c
|
|
273
|
+
* @internal
|
|
274
|
+
*/
|
|
275
|
+
$setCapabilityAvailable(c: UICapabilities, configProvider?: () => Record<string, any>): void;
|
|
247
276
|
/**
|
|
248
277
|
* Notification from the model that the target for some edge has changed.
|
|
249
278
|
* @param data
|
|
@@ -373,8 +402,7 @@ export declare abstract class UICore<EL, EVT = CoreUIEvent> extends OptimisticEv
|
|
|
373
402
|
*/
|
|
374
403
|
private $flushUnrenderedEdges;
|
|
375
404
|
/**
|
|
376
|
-
* Check to see if an edge can be rendered (ie. there is an element available for both its source and target), and
|
|
377
|
-
* if so, render it.
|
|
405
|
+
* Check to see if an edge can be rendered (ie. there is an element available for both its source and target), and if so, render it.
|
|
378
406
|
* @internal
|
|
379
407
|
*/
|
|
380
408
|
private _maybeRenderEdge;
|
|
@@ -642,7 +670,7 @@ export declare abstract class UICore<EL, EVT = CoreUIEvent> extends OptimisticEv
|
|
|
642
670
|
* @param _doNotRepaint - For internal use.
|
|
643
671
|
* @internal
|
|
644
672
|
*/
|
|
645
|
-
|
|
673
|
+
$rotateElement(vertex: Vertex | string, rotation: number, _doNotRepaint: boolean, animate: boolean): void;
|
|
646
674
|
abstract $isTouchDevice(): boolean;
|
|
647
675
|
abstract $syncManagedElementWithView(mel: ViewportElement<EL>, andThenRepaint: boolean): void;
|
|
648
676
|
/**
|
|
@@ -1559,11 +1587,12 @@ export declare abstract class UICore<EL, EVT = CoreUIEvent> extends OptimisticEv
|
|
|
1559
1587
|
* @param style
|
|
1560
1588
|
* @param clazz
|
|
1561
1589
|
* @param atts
|
|
1590
|
+
* @param EL the element to use, instead of creating one.
|
|
1562
1591
|
* @internal
|
|
1563
1592
|
*/
|
|
1564
|
-
$addTransientVertex(position: PointXY, size: Size, data?: ObjectData, style?: Record<string, any>, clazz?: string, atts?: Record<string, string
|
|
1593
|
+
$addTransientVertex(position: PointXY, size: Size, data?: ObjectData, style?: Record<string, any>, clazz?: string, atts?: Record<string, string>, element?: EL): {
|
|
1565
1594
|
vertex: Node;
|
|
1566
|
-
el:
|
|
1595
|
+
el: ViewportNodeElement<EL>;
|
|
1567
1596
|
};
|
|
1568
1597
|
/**
|
|
1569
1598
|
* Renders a dummy vertex. The model calls this at various points in the lifecycle.
|
|
@@ -1587,7 +1616,10 @@ export declare abstract class UICore<EL, EVT = CoreUIEvent> extends OptimisticEv
|
|
|
1587
1616
|
* @param data
|
|
1588
1617
|
* @internal
|
|
1589
1618
|
*/
|
|
1590
|
-
$addTransientEdge(source: Vertex, target: Vertex, data?: ObjectData, context?: Record<string, any
|
|
1619
|
+
$addTransientEdge(source: Vertex, target: Vertex, data?: ObjectData, context?: Record<string, any>, anchors?: {
|
|
1620
|
+
source?: SingleAnchorSpec;
|
|
1621
|
+
target?: SingleAnchorSpec;
|
|
1622
|
+
}): Edge;
|
|
1591
1623
|
/**
|
|
1592
1624
|
* Tests if the given edge type may be unattached at its source and/or target. An edge type might mandate some
|
|
1593
1625
|
* preference for that, or it may have been set via the `allowUnattached` flag in the edges defaults.
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { ViewportElement, ViewportGroupElement } from "./viewport";
|
|
2
|
-
import { Extents, PointXY, Size, Group, Node, Vertex } from "../../core";
|
|
3
|
-
import { ExportOptions, VisuallyJsModel } from "../../core/toolkit";
|
|
2
|
+
import { Extents, PointXY, Size, Group, Node, Vertex, BOTTOM, CENTER, LEFT, RIGHT, TOP, ExportOptions, VisuallyJsModel, MagnetizeResult } from "../../core";
|
|
4
3
|
import { MagnetizeProfile } from "./magnetize-profile";
|
|
5
|
-
import {
|
|
6
|
-
import { ConstrainFunction } from "../util/util";
|
|
7
|
-
import { BOTTOM, CENTER, LEFT, RIGHT, TOP } from "../../core";
|
|
4
|
+
import { ConstrainFunction } from "../util";
|
|
8
5
|
import { UICore } from "./core";
|
|
9
6
|
export type ElementSelectionSpecifier<E> = E | Array<E> | '*';
|
|
10
7
|
export type SelectionList = '*' | Array<string>;
|
|
@@ -571,4 +568,14 @@ export declare enum ElementTypes {
|
|
|
571
568
|
* @internal
|
|
572
569
|
*/
|
|
573
570
|
export type ElementType = keyof typeof ElementTypes;
|
|
571
|
+
/**
|
|
572
|
+
* Definition of capabilities that may have been added to a UI. This is an internal concept, managed by this class, its subclasses, and plugins/components. It provides a central place to store knowledge about the capabilities of the UI, without disparate parts needing to know about each other. For instance, if the ResizingToolsPlugin is installed and rotation is enabled, that plugin will set `vertexResize` and `vertexRotate` as available capabilities. The palette can then discover these are available, and support rotate while dragging - without needing to know about the implementation details. Similarly, the element dragging functionality can offer rotate by testing if the capability is available.
|
|
573
|
+
* @internal
|
|
574
|
+
*/
|
|
575
|
+
export declare enum UICapabilities {
|
|
576
|
+
vertexDrag = "vertexDrag",
|
|
577
|
+
vertexRotate = "vertexRotate",
|
|
578
|
+
vertexResize = "vertexResize",
|
|
579
|
+
vertexDrawing = "vertexDrawing"
|
|
580
|
+
}
|
|
574
581
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AnchorRecord, AnchorSpec, LightweightAnchor } from "../../common";
|
|
2
|
-
import { PointXY } from "../../../core";
|
|
2
|
+
import { ObjectAnchorSpec, PointXY } from "../../../core";
|
|
3
3
|
/**
|
|
4
4
|
* @internal
|
|
5
5
|
* @param type
|
|
@@ -8,6 +8,11 @@ import { PointXY } from "../../../core";
|
|
|
8
8
|
* @private
|
|
9
9
|
*/
|
|
10
10
|
export declare function _createAnchor(type: string, locations: Array<AnchorRecord>, params: Record<string, any>, fixedLocation: AnchorRecord): LightweightAnchor;
|
|
11
|
+
/**
|
|
12
|
+
* @internal
|
|
13
|
+
* @param oa
|
|
14
|
+
*/
|
|
15
|
+
export declare function isObjectAnchorSpec(oa: any): oa is ObjectAnchorSpec;
|
|
11
16
|
export declare function makeLightweightAnchorFromArraySpec(specs: Array<AnchorSpec>, selectedAnchor?: number, currentPosition?: PointXY): LightweightAnchor;
|
|
12
17
|
/**
|
|
13
18
|
* @internal
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnchorSpec, OverlaySpec, PaintStyle, ConnectorSpec, FullOverlaySpec } from "../common";
|
|
1
|
+
import { AnchorSpec, OverlaySpec, PaintStyle, ConnectorSpec, FullOverlaySpec, InternalOverlaySpec } from "../common";
|
|
2
2
|
/**
|
|
3
3
|
* Base interface for vertex/edge types. This interface contains parameters that are common between the two types, and is shared by internal methods and public methods.
|
|
4
4
|
* @group UI
|
|
@@ -79,7 +79,7 @@ export interface TypeDescriptorBase {
|
|
|
79
79
|
* @internal
|
|
80
80
|
*/
|
|
81
81
|
export interface CompiledTypeDescriptor extends Omit<TypeDescriptorBase, 'overlays' | 'sourceMarker' | 'targetMarker'> {
|
|
82
|
-
overlays?: Record<string,
|
|
82
|
+
overlays?: Record<string, InternalOverlaySpec>;
|
|
83
83
|
sourceMarker?: FullOverlaySpec;
|
|
84
84
|
targetMarker?: FullOverlaySpec;
|
|
85
85
|
}
|
package/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "1.2.
|
|
1
|
+
export declare const VERSION = "1.2.6";
|