@metadev/daga 1.2.0 → 1.3.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/Changelog.md +16 -0
- package/README.md +2 -2
- package/fesm2022/metadev-daga.mjs +810 -58
- package/fesm2022/metadev-daga.mjs.map +1 -1
- package/lib/collapse-button/collapse-button.component.d.ts +4 -0
- package/lib/diagram/diagram.component.d.ts +1 -0
- package/lib/diagram-buttons/diagram-buttons.component.d.ts +4 -0
- package/lib/diagram-editor/diagram/converters/daga-exporter.d.ts +4 -0
- package/lib/diagram-editor/diagram/converters/daga-importer.d.ts +4 -0
- package/lib/diagram-editor/diagram/converters/daga-model.d.ts +5 -0
- package/lib/diagram-editor/diagram/converters/diagram-model-exporter.d.ts +7 -0
- package/lib/diagram-editor/diagram/converters/diagram-model-importer.d.ts +7 -0
- package/lib/diagram-editor/diagram/diagram-action.d.ts +67 -1
- package/lib/diagram-editor/diagram/diagram-canvas.d.ts +4 -0
- package/lib/diagram-editor/diagram/diagram-config.d.ts +21 -3
- package/lib/diagram-editor/diagram/diagram-connection.d.ts +75 -0
- package/lib/diagram-editor/diagram/diagram-element.d.ts +40 -3
- package/lib/diagram-editor/diagram/diagram-field.d.ts +64 -0
- package/lib/diagram-editor/diagram/diagram-model.d.ts +75 -2
- package/lib/diagram-editor/diagram/diagram-node.d.ts +58 -0
- package/lib/diagram-editor/diagram/diagram-port.d.ts +36 -0
- package/lib/diagram-editor/diagram/diagram-property.d.ts +23 -2
- package/lib/diagram-editor/diagram/diagram-section.d.ts +45 -0
- package/lib/diagram-editor/diagram/layout/adjacency-layout.d.ts +1 -0
- package/lib/diagram-editor/diagram/layout/breadth-adjacency-layout.d.ts +1 -0
- package/lib/diagram-editor/diagram/layout/breadth-layout.d.ts +2 -2
- package/lib/diagram-editor/diagram/layout/diagram-layout.d.ts +8 -0
- package/lib/diagram-editor/diagram/layout/force-layout.d.ts +1 -0
- package/lib/diagram-editor/diagram/layout/horizontal-layout.d.ts +1 -0
- package/lib/diagram-editor/diagram/layout/priority-layout.d.ts +1 -0
- package/lib/diagram-editor/diagram/layout/vertical-layout.d.ts +1 -0
- package/lib/diagram-editor/diagram-editor.component.d.ts +4 -0
- package/lib/errors/diagram-error.d.ts +19 -0
- package/lib/errors/diagram-validator.d.ts +6 -1
- package/lib/errors/errors.component.d.ts +5 -0
- package/lib/interfaces/canvas.d.ts +48 -4
- package/lib/interfaces/diagram-buttons.d.ts +8 -0
- package/lib/interfaces/diagram-editor.d.ts +4 -0
- package/lib/interfaces/palette.d.ts +2 -0
- package/lib/interfaces/property-editor.d.ts +4 -0
- package/lib/object-editor/object-editor.component.d.ts +7 -1
- package/lib/palette/palette.component.d.ts +6 -0
- package/lib/property-editor/property-editor.component.d.ts +5 -0
- package/lib/services/canvas-provider.service.d.ts +17 -0
- package/lib/services/daga-configuration.service.d.ts +11 -0
- package/lib/text-list-editor/text-list-editor.component.d.ts +7 -0
- package/lib/text-map-editor/text-map-editor.component.d.ts +7 -0
- package/lib/util/canvas-util.d.ts +104 -0
- package/lib/util/events.d.ts +8 -4
- package/lib/util/grid.d.ts +47 -4
- package/lib/util/line.d.ts +44 -0
- package/lib/util/list-util.d.ts +14 -0
- package/lib/util/shape.d.ts +98 -0
- package/lib/util/svg-util.d.ts +77 -5
- package/package.json +1 -1
package/lib/util/grid.d.ts
CHANGED
|
@@ -1,19 +1,62 @@
|
|
|
1
1
|
import { Point } from './canvas-util';
|
|
2
|
+
/**
|
|
3
|
+
* A two dimensional array of elements of the given class that can extend infinitely in any direction, both positive and negative.
|
|
4
|
+
* @private
|
|
5
|
+
*/
|
|
2
6
|
export declare class Grid<T> {
|
|
3
|
-
grid
|
|
4
|
-
offsetX
|
|
5
|
-
offsetY
|
|
7
|
+
private grid;
|
|
8
|
+
private offsetX;
|
|
9
|
+
private offsetY;
|
|
10
|
+
/**
|
|
11
|
+
* Get the minimum x coordinate among the elements in the grid.
|
|
12
|
+
*/
|
|
6
13
|
minX(): number;
|
|
14
|
+
/**
|
|
15
|
+
* Get the maximum x coordinate among the elements in the grid.
|
|
16
|
+
*/
|
|
7
17
|
maxX(): number;
|
|
18
|
+
/**
|
|
19
|
+
* Get the minimum y coordinate among the elements in the grid.
|
|
20
|
+
*/
|
|
8
21
|
minY(): number;
|
|
22
|
+
/**
|
|
23
|
+
* Get the maximum y coordinate among the elements in the grid.
|
|
24
|
+
*/
|
|
9
25
|
maxY(): number;
|
|
26
|
+
/**
|
|
27
|
+
* Get the total extension of the grid along the x axis.
|
|
28
|
+
*/
|
|
10
29
|
width(): number;
|
|
30
|
+
/**
|
|
31
|
+
* Get the total extension of the grid along the y axis.
|
|
32
|
+
*/
|
|
11
33
|
height(): number;
|
|
34
|
+
/**
|
|
35
|
+
* Add a new column at the start of the x axis.
|
|
36
|
+
*/
|
|
12
37
|
addColumnLeft(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Add a new column at the end of the x axis.
|
|
40
|
+
*/
|
|
13
41
|
addColumnRight(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Add a new row at the start of the y axis.
|
|
44
|
+
*/
|
|
14
45
|
addRowTop(): void;
|
|
46
|
+
/**
|
|
47
|
+
* Add a new row at the end of the y axis.
|
|
48
|
+
*/
|
|
15
49
|
addRowBottom(): void;
|
|
50
|
+
/**
|
|
51
|
+
* Get the element at the given coordinates or undefined if there is no element at the given coordinates.
|
|
52
|
+
*/
|
|
16
53
|
get(coords: Point): T | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Set the element at the given coordinates to the given element.
|
|
56
|
+
*/
|
|
17
57
|
set(coords: Point, value: T | undefined): void;
|
|
18
|
-
|
|
58
|
+
/**
|
|
59
|
+
* Get the closest coordinates to the given coordinates that are not set to an element.
|
|
60
|
+
*/
|
|
61
|
+
getClosestEmptyCoordinate(coords: Point): Point;
|
|
19
62
|
}
|
package/lib/util/line.d.ts
CHANGED
|
@@ -1,15 +1,59 @@
|
|
|
1
1
|
import { Point } from './canvas-util';
|
|
2
2
|
import { Side } from './svg-util';
|
|
3
|
+
/**
|
|
4
|
+
* An enumeration of the possible shapes of a line.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
3
7
|
export declare enum LineShape {
|
|
8
|
+
/**
|
|
9
|
+
* A line that goes between its points taking the shortest euclidean distance.
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
4
12
|
Straight = "straight",
|
|
13
|
+
/**
|
|
14
|
+
* A line that goes between its points using bezier splines.
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
5
17
|
Bezier = "bezier",
|
|
18
|
+
/**
|
|
19
|
+
* A line that goes between its points moving parallel to the axes of coordinates.
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
6
22
|
Square = "square"
|
|
7
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* An enumeration of the possible styles of a line.
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
8
28
|
export declare enum LineStyle {
|
|
29
|
+
/**
|
|
30
|
+
* A solid uninterrupted line.
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
9
33
|
Solid = "solid",
|
|
34
|
+
/**
|
|
35
|
+
* A dashed line with little separation between the dashes.
|
|
36
|
+
* @public
|
|
37
|
+
*/
|
|
10
38
|
Dashed = "dashed",
|
|
39
|
+
/**
|
|
40
|
+
* A dashed line with wide gaps between the dashes.
|
|
41
|
+
* @public
|
|
42
|
+
*/
|
|
11
43
|
GappedDashes = "gapped-dashes",
|
|
44
|
+
/**
|
|
45
|
+
* A dotted line.
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
12
48
|
Dotted = "dotted"
|
|
13
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Calculates the path of an SVG line with the given parameters.
|
|
52
|
+
* @private
|
|
53
|
+
*/
|
|
14
54
|
export declare const linePath: (shape: LineShape, points: Point[], startDirection?: Side | undefined, endDirection?: Side | undefined, minimumDistanceBeforeTurn?: number) => string;
|
|
55
|
+
/**
|
|
56
|
+
* Calculates the dasharray property of an SVG line corresponding to the given line style and width.
|
|
57
|
+
* @private
|
|
58
|
+
*/
|
|
15
59
|
export declare const lineStyleDasharray: (style: LineStyle, width: number) => string;
|
package/lib/util/list-util.d.ts
CHANGED
|
@@ -1,2 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Removes the given element from the array if it exists within the array.
|
|
3
|
+
* @private
|
|
4
|
+
* @param arr An array.
|
|
5
|
+
* @param obj An element to remove from the array.
|
|
6
|
+
* @returns The given array without the given element removed if it was found; otherwise the array without modifications.
|
|
7
|
+
*/
|
|
1
8
|
export declare const removeIfExists: <T>(arr: T[], obj: T) => T[];
|
|
9
|
+
/**
|
|
10
|
+
* Adds the given element to the array if it doesn't exist within the array.
|
|
11
|
+
* @private
|
|
12
|
+
* @param arr An array.
|
|
13
|
+
* @param obj An element to add to the array.
|
|
14
|
+
* @returns The given array with the given element added it was not found; otherwise the array without modifications.
|
|
15
|
+
*/
|
|
2
16
|
export declare const addIfNotExists: <T>(arr: T[], obj: T) => T[];
|
package/lib/util/shape.d.ts
CHANGED
|
@@ -1,23 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An enumeration of possible closed shapes.
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
1
5
|
export declare enum ClosedShape {
|
|
6
|
+
/**
|
|
7
|
+
* An ellipse shape.
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
2
10
|
Ellipse = "ellipse",
|
|
11
|
+
/**
|
|
12
|
+
* A nonexistent shape.
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
3
15
|
Empty = "empty",
|
|
16
|
+
/**
|
|
17
|
+
* A folder-like shape.
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
4
20
|
Folder = "folder",
|
|
21
|
+
/**
|
|
22
|
+
* An hexagon shape.
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
5
25
|
Hexagon = "hexagon",
|
|
26
|
+
/**
|
|
27
|
+
* An octagon shape.
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
6
30
|
Octagon = "octagon",
|
|
31
|
+
/**
|
|
32
|
+
* A shape delimited by curves with a fixed radius, with differences in dimensions supplemented by straight lines.
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
7
35
|
Pill = "pill",
|
|
36
|
+
/**
|
|
37
|
+
* A rectangle shape.
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
8
40
|
Rectangle = "rectangle",
|
|
41
|
+
/**
|
|
42
|
+
* A rhombus shape.
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
9
45
|
Rhombus = "rhombus",
|
|
46
|
+
/**
|
|
47
|
+
* A rectangle shape with rounded corners.
|
|
48
|
+
* @public
|
|
49
|
+
*/
|
|
10
50
|
RoundedRectangle = "rounded-rectangle",
|
|
51
|
+
/**
|
|
52
|
+
* A sticky note-like shape.
|
|
53
|
+
* @public
|
|
54
|
+
*/
|
|
11
55
|
StickyNote = "sticky-note"
|
|
12
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Get the SVG path of the correspondign closed shape, starting at the given x and y coordinates, with the given width and height.
|
|
59
|
+
* @private
|
|
60
|
+
*/
|
|
13
61
|
export declare const generalClosedPath: (shape: ClosedShape, x: number, y: number, width: number, height: number) => string;
|
|
62
|
+
/**
|
|
63
|
+
* Generates an ellipse SVG path.
|
|
64
|
+
* @see ClosedShape
|
|
65
|
+
* @private
|
|
66
|
+
*/
|
|
14
67
|
export declare const ellipsePath: (x: number, y: number, width: number, height: number) => string;
|
|
68
|
+
/**
|
|
69
|
+
* Generates an empty SVG path.
|
|
70
|
+
* @see ClosedShape
|
|
71
|
+
* @private
|
|
72
|
+
*/
|
|
15
73
|
export declare const emptyPath: () => string;
|
|
74
|
+
/**
|
|
75
|
+
* Generates a folder SVG path.
|
|
76
|
+
* @see ClosedShape
|
|
77
|
+
* @private
|
|
78
|
+
*/
|
|
16
79
|
export declare const folderPath: (x: number, y: number, width: number, height: number) => string;
|
|
80
|
+
/**
|
|
81
|
+
* Generates an hexagon SVG path.
|
|
82
|
+
* @see ClosedShape
|
|
83
|
+
* @private
|
|
84
|
+
*/
|
|
17
85
|
export declare const hexagonPath: (x: number, y: number, width: number, height: number) => string;
|
|
86
|
+
/**
|
|
87
|
+
* Generates an octagon SVG path.
|
|
88
|
+
* @see ClosedShape
|
|
89
|
+
* @private
|
|
90
|
+
*/
|
|
18
91
|
export declare const octagonPath: (x: number, y: number, width: number, height: number) => string;
|
|
92
|
+
/**
|
|
93
|
+
* Generates a pill SVG path.
|
|
94
|
+
* @see ClosedShape
|
|
95
|
+
* @private
|
|
96
|
+
*/
|
|
19
97
|
export declare const pillPath: (x: number, y: number, width: number, height: number) => string;
|
|
98
|
+
/**
|
|
99
|
+
* Generates a rectangle SVG path.
|
|
100
|
+
* @see ClosedShape
|
|
101
|
+
* @private
|
|
102
|
+
*/
|
|
20
103
|
export declare const rectanglePath: (x: number, y: number, width: number, height: number) => string;
|
|
104
|
+
/**
|
|
105
|
+
* Generates a rhombus SVG path.
|
|
106
|
+
* @see ClosedShape
|
|
107
|
+
* @private
|
|
108
|
+
*/
|
|
21
109
|
export declare const rhombusPath: (x: number, y: number, width: number, height: number) => string;
|
|
110
|
+
/**
|
|
111
|
+
* Generates a rounded rectangle SVG path.
|
|
112
|
+
* @see ClosedShape
|
|
113
|
+
* @private
|
|
114
|
+
*/
|
|
22
115
|
export declare const roundedRectanglePath: (x: number, y: number, width: number, height: number) => string;
|
|
116
|
+
/**
|
|
117
|
+
* Generates a sticky note SVG path.
|
|
118
|
+
* @see ClosedShape
|
|
119
|
+
* @private
|
|
120
|
+
*/
|
|
23
121
|
export declare const stickyNotePath: (x: number, y: number, width: number, height: number) => string;
|
package/lib/util/svg-util.d.ts
CHANGED
|
@@ -1,22 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An enumeration of the possible sides of a rectangle and directions parallel to the axes of coordinates.
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
1
5
|
export declare enum Side {
|
|
6
|
+
/**
|
|
7
|
+
* Bottom side or direction.
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
2
10
|
Bottom = "bottom",
|
|
11
|
+
/**
|
|
12
|
+
* Left side or direction.
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
3
15
|
Left = "left",
|
|
16
|
+
/**
|
|
17
|
+
* Right side or direction.
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
4
20
|
Right = "right",
|
|
21
|
+
/**
|
|
22
|
+
* Top side or direction.
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
5
25
|
Top = "top"
|
|
6
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* An enumeration of the possible corners of a rectangle.
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
7
31
|
export declare enum Corner {
|
|
32
|
+
/**
|
|
33
|
+
* Bottom left corner.
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
8
36
|
BottomLeft = "bottom-left",
|
|
37
|
+
/**
|
|
38
|
+
* Bottom right corner.
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
9
41
|
BottomRight = "bottom-right",
|
|
42
|
+
/**
|
|
43
|
+
* Top left corner.
|
|
44
|
+
* @public
|
|
45
|
+
*/
|
|
10
46
|
TopLeft = "top-left",
|
|
47
|
+
/**
|
|
48
|
+
* Top right corner.
|
|
49
|
+
* @public
|
|
50
|
+
*/
|
|
11
51
|
TopRight = "top-right"
|
|
12
52
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
53
|
+
/**
|
|
54
|
+
* An enumeration of the possible horizontal alignments within a horizontal range of coordinates.
|
|
55
|
+
* @public
|
|
56
|
+
*/
|
|
18
57
|
export declare enum HorizontalAlign {
|
|
58
|
+
/**
|
|
59
|
+
* Start of an horizontal range of coordinates.
|
|
60
|
+
* @public
|
|
61
|
+
*/
|
|
19
62
|
Left = "left",
|
|
63
|
+
/**
|
|
64
|
+
* Middle of an horizontal range of coordinates.
|
|
65
|
+
* @public
|
|
66
|
+
*/
|
|
20
67
|
Center = "center",
|
|
68
|
+
/**
|
|
69
|
+
* End of an horizontal range of coordinates.
|
|
70
|
+
* @public
|
|
71
|
+
*/
|
|
21
72
|
Right = "right"
|
|
22
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* An enumeration of the possible vertical alignments within a vertical range of coordinates.
|
|
76
|
+
* @public
|
|
77
|
+
*/
|
|
78
|
+
export declare enum VerticalAlign {
|
|
79
|
+
/**
|
|
80
|
+
* Start of a vertical range of coordinates.
|
|
81
|
+
* @public
|
|
82
|
+
*/
|
|
83
|
+
Top = "top",
|
|
84
|
+
/**
|
|
85
|
+
* Middle of a vertical range of coordinates.
|
|
86
|
+
* @public
|
|
87
|
+
*/
|
|
88
|
+
Center = "center",
|
|
89
|
+
/**
|
|
90
|
+
* End of a vertical range of coordinates.
|
|
91
|
+
* @public
|
|
92
|
+
*/
|
|
93
|
+
Bottom = "bottom"
|
|
94
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metadev/daga",
|
|
3
3
|
"description": "Diagramming engine for editing models on the Web. Made by Metadev.",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.3.1",
|
|
5
5
|
"author": "Metadev (https://metadev.pro)",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
7
7
|
"repository": "git+https://github.com/metadevpro/daga-tutorial.git",
|