@visuallyjs/browser-ui 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/js/visuallyjs.browser-ui.cjs.js +31 -31
- package/js/visuallyjs.browser-ui.esm.js +44 -44
- package/package.json +1 -1
- package/types/browser-ui/browser-visuallyjs-instance.d.ts +1 -0
- package/types/browser-ui/html-element-overlay.d.ts +3 -0
- package/types/browser-ui/surface-renderer/diagrams/definitions.d.ts +4 -0
- package/types/browser-ui/svg-element-overlay.d.ts +1 -0
- package/types/ui/common/overlay.d.ts +4 -0
- package/types/ui/core/overlay/custom-overlay.d.ts +28 -9
- package/types/ui/core/overlay/label-overlay.d.ts +3 -2
- package/types/ui/core/overlay/overlay.d.ts +3 -3
- package/types/ui/core/params.d.ts +4 -0
- package/types/ui/core/view/edge-options.d.ts +4 -0
- package/types/version.d.ts +1 -1
package/package.json
CHANGED
|
@@ -577,6 +577,7 @@ export declare abstract class BrowserUI<EVT = any> extends UICore<BrowserElement
|
|
|
577
577
|
* @param parentOrigin
|
|
578
578
|
*/
|
|
579
579
|
$paintOverlay(o: Overlay<BrowserElement>, params: OverlayPaintParams, parentOrigin: PointXY): void;
|
|
580
|
+
private _positionHTMLElementOverlay;
|
|
580
581
|
/**
|
|
581
582
|
* Sets the visibility of some overlay.
|
|
582
583
|
* @param o - Overlay to hide or show
|
|
@@ -13,6 +13,8 @@ export declare function isHTMLLabelOverlay(o: Overlay<any>): o is HTMLElementOve
|
|
|
13
13
|
export interface HTMLElementOverlayHolder extends Overlay<BrowserElement> {
|
|
14
14
|
contentElement: VisuallyJSDOMElement;
|
|
15
15
|
cachedDimensions: Size;
|
|
16
|
+
rotatable: boolean;
|
|
17
|
+
connection: Connection<BrowserElement>;
|
|
16
18
|
}
|
|
17
19
|
export interface HTMLElementOverlayPaintParams extends OverlayPaintParams {
|
|
18
20
|
d: {
|
|
@@ -20,6 +22,7 @@ export interface HTMLElementOverlayPaintParams extends OverlayPaintParams {
|
|
|
20
22
|
miny: number;
|
|
21
23
|
td: Size;
|
|
22
24
|
cxy: PointXY;
|
|
25
|
+
rotation?: number;
|
|
23
26
|
};
|
|
24
27
|
}
|
|
25
28
|
export declare class HTMLElementOverlay {
|
|
@@ -137,6 +137,10 @@ export interface DiagramOptions {
|
|
|
137
137
|
* Whether or not to display labels on edges. Defaults to false. The value for an edge's label is sourced from the `label` field of the edge's data. You can change this via the `labelProperty` setting. The label is placed at location 0.5 by default. You can change that with either the `labelLocation` setting (to change every label), or the `labelLocationProperty` (to set location on a per-edge basis).
|
|
138
138
|
*/
|
|
139
139
|
showLabels?: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Defaults to false. When true, edge labels are rotated to the angle matching the slope of the connector at the point at which they are located.
|
|
142
|
+
*/
|
|
143
|
+
labelsRotatable?: boolean;
|
|
140
144
|
/**
|
|
141
145
|
* Whether or not to reattach this connection automatically should it be detached via user intervention and then dropped onto whitespace.
|
|
142
146
|
*/
|
|
@@ -91,6 +91,10 @@ export interface LabelOverlayOptions extends OverlayOptions {
|
|
|
91
91
|
* Optional spec for the font to use on this label.
|
|
92
92
|
*/
|
|
93
93
|
font?: FontSpec;
|
|
94
|
+
/**
|
|
95
|
+
* If true, the label can be rotated to match the gradient of the connector at that location at which it is positioned.
|
|
96
|
+
*/
|
|
97
|
+
rotatable?: boolean;
|
|
94
98
|
}
|
|
95
99
|
/**
|
|
96
100
|
* An overlay specified by name and options.
|
|
@@ -2,33 +2,52 @@ import { Overlay } from "./overlay";
|
|
|
2
2
|
import { UICore } from "../core";
|
|
3
3
|
import { OverlayOptions } from "../../common";
|
|
4
4
|
import { Connection } from "../connector/connection-impl";
|
|
5
|
-
import { ObjectData } from "../../../core";
|
|
5
|
+
import { Edge, ObjectData, VisuallyJsModel } from "../../../core";
|
|
6
|
+
import { BrowserUI } from "../../../browser-ui";
|
|
6
7
|
/**
|
|
7
8
|
* Options for a custom overlay. You need to supply the `create` method, which is passed the current connection as an argument, and return a DOM element.
|
|
8
9
|
* @group Edges
|
|
9
10
|
* @category Overlays
|
|
10
11
|
*/
|
|
11
12
|
export interface CustomOverlayOptions<EL> extends OverlayOptions {
|
|
12
|
-
create: (c: Connection<EL
|
|
13
|
+
create: (c: Connection<EL>, edge: Edge, instance: BrowserUI, model: VisuallyJsModel) => EL;
|
|
14
|
+
/**
|
|
15
|
+
* If true, the label can be rotated to match the gradient of the connector at that location at which it is positioned.
|
|
16
|
+
*/
|
|
17
|
+
rotatable?: boolean;
|
|
13
18
|
}
|
|
14
19
|
/**
|
|
15
20
|
* A custom overlay allows you to create the element that will be used to represent the overlay.
|
|
16
21
|
* @group Edges
|
|
17
22
|
* @category Overlays
|
|
18
23
|
*/
|
|
19
|
-
export
|
|
20
|
-
|
|
21
|
-
create: (c: Connection<EL>) => EL;
|
|
24
|
+
export interface CustomOverlay<EL> extends Overlay<EL> {
|
|
25
|
+
create: (c: Connection<EL>, edge: Edge, instance: BrowserUI, model: VisuallyJsModel) => EL;
|
|
22
26
|
isSimpleShape: boolean;
|
|
23
|
-
|
|
27
|
+
rotatable: boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Custom overlay type.
|
|
31
|
+
* @group Overlays
|
|
32
|
+
* @constant
|
|
33
|
+
*/
|
|
34
|
+
export declare const OVERLAY_TYPE_CUSTOM = "Custom";
|
|
35
|
+
/**
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
export declare class CustomOverlayImpl<EL> extends Overlay<EL> implements CustomOverlay<EL> {
|
|
39
|
+
connection: Connection<EL>;
|
|
24
40
|
/**
|
|
25
|
-
*
|
|
41
|
+
* This method is invoked to create the overlay.
|
|
26
42
|
*/
|
|
27
|
-
|
|
43
|
+
create: (c: Connection<EL>, edge: Edge, instance: BrowserUI, model: VisuallyJsModel) => EL;
|
|
44
|
+
isSimpleShape: boolean;
|
|
45
|
+
rotatable: boolean;
|
|
46
|
+
constructor(instance: UICore<EL>, connection: Connection<EL>, p: CustomOverlayOptions<EL>);
|
|
28
47
|
type: string;
|
|
29
48
|
updateFrom(d: any, context: ObjectData): void;
|
|
30
49
|
}
|
|
31
|
-
export interface CustomOverlayHolder<EL> extends
|
|
50
|
+
export interface CustomOverlayHolder<EL> extends CustomOverlayImpl<EL> {
|
|
32
51
|
contentElement: EL;
|
|
33
52
|
}
|
|
34
53
|
/**
|
|
@@ -11,13 +11,14 @@ import { FontSpec } from "../../../browser-ui";
|
|
|
11
11
|
*/
|
|
12
12
|
export declare class LabelOverlay<EL> extends Overlay<EL> {
|
|
13
13
|
private instance;
|
|
14
|
-
|
|
14
|
+
connection: Connection<EL>;
|
|
15
15
|
label: string | Function;
|
|
16
16
|
static type: string;
|
|
17
17
|
type: string;
|
|
18
18
|
useHTMLElement: boolean;
|
|
19
|
+
rotatable: boolean;
|
|
19
20
|
font: FontSpec;
|
|
20
|
-
constructor(instance: UICore<EL>,
|
|
21
|
+
constructor(instance: UICore<EL>, connection: Connection<EL>, p: LabelOverlayOptions);
|
|
21
22
|
isSimpleShape: boolean;
|
|
22
23
|
getLabel(): string;
|
|
23
24
|
setLabel(l: string | Function): void;
|
|
@@ -63,7 +63,7 @@ export declare function setOverlayLocation(o: Overlay<any>, l: number | string):
|
|
|
63
63
|
* @internal
|
|
64
64
|
*/
|
|
65
65
|
export declare abstract class Overlay<EL> {
|
|
66
|
-
|
|
66
|
+
connection: Connection<EL>;
|
|
67
67
|
id: string;
|
|
68
68
|
abstract type: string;
|
|
69
69
|
cssClass: string;
|
|
@@ -77,11 +77,11 @@ export declare abstract class Overlay<EL> {
|
|
|
77
77
|
* types system.
|
|
78
78
|
* @internal
|
|
79
79
|
* @param instance
|
|
80
|
-
* @param
|
|
80
|
+
* @param connection
|
|
81
81
|
* @param p
|
|
82
82
|
*/
|
|
83
83
|
ignoreTypes: boolean;
|
|
84
|
-
constructor(
|
|
84
|
+
constructor(connection: Connection<EL>, p: OverlayOptions);
|
|
85
85
|
abstract updateFrom(opts: any, context: ObjectData): void;
|
|
86
86
|
abstract isSimpleShape: boolean;
|
|
87
87
|
}
|
|
@@ -37,6 +37,10 @@ export interface ConnectParams<E> {
|
|
|
37
37
|
* Optional label to set on the connection. In the default browser UI implementation this is rendered as a `label` attribute on the SVG element representing the connection.
|
|
38
38
|
*/
|
|
39
39
|
label?: string;
|
|
40
|
+
/**
|
|
41
|
+
* When true, the label will be rotated so that it is at the same angle as the slope of the connector at the point at which the label is located.
|
|
42
|
+
*/
|
|
43
|
+
labelsRotatable?: boolean;
|
|
40
44
|
/**
|
|
41
45
|
* Spec for the connector used to paint the connection.
|
|
42
46
|
*/
|
|
@@ -79,6 +79,10 @@ export interface EdgeMapping extends BaseViewObjectMapping, LineStyle {
|
|
|
79
79
|
* Optional spec for label font. Will use browser defaults if not specified (or CSS, but remember that CSS is not taken into account when you export an SVG from a diagram or an app using an SVG container)
|
|
80
80
|
*/
|
|
81
81
|
labelFont?: FontSpec;
|
|
82
|
+
/**
|
|
83
|
+
* When true, the label will be rotated so that it is at the same angle as the slope of the connector at the point at which the label is located.
|
|
84
|
+
*/
|
|
85
|
+
labelsRotatable?: boolean;
|
|
82
86
|
/**
|
|
83
87
|
* Optional width of the edge's outline. Defaults to 0.
|
|
84
88
|
*/
|
package/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "1.1.
|
|
1
|
+
export declare const VERSION = "1.1.1";
|