@metadev/daga 1.4.2 → 1.5.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.
- package/Changelog.md +16 -1
- package/assets/icon/property/add.svg +23 -3
- package/assets/icon/property/gear.svg +3 -0
- package/assets/icon/property/move.svg +35 -0
- package/assets/styles/_property-editor.scss +161 -101
- package/assets/styles/daga.scss +1 -1
- package/fesm2022/metadev-daga.mjs +1276 -651
- package/fesm2022/metadev-daga.mjs.map +1 -1
- package/index.d.ts +4 -4
- package/lib/diagram-editor/diagram/collab/collab-action.d.ts +144 -22
- package/lib/diagram-editor/diagram/collab/primitives.d.ts +9 -2
- package/lib/diagram-editor/diagram/converters/daga-exporter.d.ts +1 -1
- package/lib/diagram-editor/diagram/converters/daga-model.d.ts +57 -3
- package/lib/diagram-editor/diagram/diagram-action.d.ts +23 -51
- package/lib/diagram-editor/diagram/diagram-connection.d.ts +20 -3
- package/lib/diagram-editor/diagram/diagram-element.d.ts +24 -2
- package/lib/diagram-editor/diagram/diagram-field.d.ts +9 -2
- package/lib/diagram-editor/diagram/diagram-node.d.ts +25 -6
- package/lib/diagram-editor/diagram/diagram-port.d.ts +3 -2
- package/lib/diagram-editor/diagram/diagram-property.d.ts +60 -8
- package/lib/diagram-editor/diagram/diagram-section.d.ts +18 -2
- package/lib/property-editor/object-editor/object-editor.component.d.ts +2 -3
- package/lib/property-editor/option-list-editor/option-list-editor.component.d.ts +5 -1
- package/lib/property-editor/property-editor.component.d.ts +2 -0
- package/lib/property-editor/property-settings/property-settings.component.d.ts +35 -0
- package/lib/property-editor/text-list-editor/text-list-editor.component.d.ts +3 -1
- package/package.json +5 -5
package/index.d.ts
CHANGED
|
@@ -3,23 +3,23 @@ export { DagaModule } from './lib/daga.module';
|
|
|
3
3
|
export { DiagramButtonsComponent } from './lib/diagram-buttons/diagram-buttons.component';
|
|
4
4
|
export { DiagramEditorComponent } from './lib/diagram-editor/diagram-editor.component';
|
|
5
5
|
export { CollabClient } from './lib/diagram-editor/diagram/collab/collab-client';
|
|
6
|
-
export { CollabTimestamp
|
|
6
|
+
export { CollabTimestamp, CollabTimestampSet } from './lib/diagram-editor/diagram/collab/primitives';
|
|
7
7
|
export { DagaExporter } from './lib/diagram-editor/diagram/converters/daga-exporter';
|
|
8
8
|
export { DagaImporter } from './lib/diagram-editor/diagram/converters/daga-importer';
|
|
9
9
|
export { DagaModel } from './lib/diagram-editor/diagram/converters/daga-model';
|
|
10
10
|
export { DiagramModelExporter } from './lib/diagram-editor/diagram/converters/diagram-model-exporter';
|
|
11
11
|
export { DiagramModelImporter } from './lib/diagram-editor/diagram/converters/diagram-model-importer';
|
|
12
|
-
export { ActionQueue, AddConnectionAction, AddNodeAction, DiagramAction, DiagramActions, EditFieldAction,
|
|
12
|
+
export { ActionQueue, AddConnectionAction, AddNodeAction, DiagramAction, DiagramActions, EditFieldAction, RemoveAction, SetGeometryAction, UpdateValuesAction } from './lib/diagram-editor/diagram/diagram-action';
|
|
13
13
|
export { ACTION_QUEUE_SIZE, DiagramCanvas } from './lib/diagram-editor/diagram/diagram-canvas';
|
|
14
14
|
export { ButtonsComponentConfig, ComponentsConfig, ConnectionMarkerLook, ConnectionTemplateConfig, ConnectionTypeConfig, DiagramConfig, ErrorsComponentConfig, FieldConfig, NodeImageLook, NodeShapedLook, NodeStretchableImageLook, NodeTemplateConfig, NodeTypeConfig, PaletteComponentConfig, PaletteSectionConfig, PortConfig, PropertyEditorComponentConfig, SectionConfig, SectionGridConfig, UserActionConfig } from './lib/diagram-editor/diagram/diagram-config';
|
|
15
15
|
export { DiagramConnection, DiagramConnectionSet, DiagramConnectionType } from './lib/diagram-editor/diagram/diagram-connection';
|
|
16
16
|
export { DiagramElement, DiagramEntity, DiagramEntitySet } from './lib/diagram-editor/diagram/diagram-element';
|
|
17
17
|
export { DiagramField, DiagramFieldSet } from './lib/diagram-editor/diagram/diagram-field';
|
|
18
18
|
export { DiagramModel } from './lib/diagram-editor/diagram/diagram-model';
|
|
19
|
-
export { DiagramNode, DiagramNodeSet, DiagramNodeType } from './lib/diagram-editor/diagram/diagram-node';
|
|
19
|
+
export { DiagramNode, DiagramNodeSet, DiagramNodeType, DiagramNodeGeometry } from './lib/diagram-editor/diagram/diagram-node';
|
|
20
20
|
export { DiagramPort, DiagramPortSet } from './lib/diagram-editor/diagram/diagram-port';
|
|
21
21
|
export { Property, PropertySet, Type, ValueSet } from './lib/diagram-editor/diagram/diagram-property';
|
|
22
|
-
export { DiagramSection, DiagramSectionSet } from './lib/diagram-editor/diagram/diagram-section';
|
|
22
|
+
export { DiagramSection, DiagramSectionSet, DiagramSectionGeometry } from './lib/diagram-editor/diagram/diagram-section';
|
|
23
23
|
export { AdjacencyLayout } from './lib/diagram-editor/diagram/layout/adjacency-layout';
|
|
24
24
|
export { BreadthAdjacencyLayout } from './lib/diagram-editor/diagram/layout/breadth-adjacency-layout';
|
|
25
25
|
export { BreadthLayout } from './lib/diagram-editor/diagram/layout/breadth-layout';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Canvas } from '../../../interfaces/canvas';
|
|
2
2
|
import { Point } from '../../../util/canvas-util';
|
|
3
3
|
import { CollabTimestamp } from './primitives';
|
|
4
|
+
import { DiagramNodeGeometry } from '../diagram-node';
|
|
5
|
+
import { ValueSet } from '../diagram-property';
|
|
4
6
|
/**
|
|
5
7
|
* An action taken by a local or remote user.
|
|
6
8
|
*
|
|
@@ -29,14 +31,14 @@ export interface CollabAction {
|
|
|
29
31
|
/**
|
|
30
32
|
* @private
|
|
31
33
|
*/
|
|
32
|
-
export type CollabActionSerialized = AddNodeSerialized |
|
|
34
|
+
export type CollabActionSerialized = AddNodeSerialized | SetGeometrySerialized | AddConnectionSerialized | EditFieldSerialized | UpdateValuesSerialized | SetSelfRemovedSerialized;
|
|
33
35
|
/**
|
|
34
36
|
* @private
|
|
35
37
|
*/
|
|
36
38
|
export type AddNodeSerialized = {
|
|
37
|
-
type: '
|
|
39
|
+
type: 'addNode';
|
|
38
40
|
id: string;
|
|
39
|
-
|
|
41
|
+
typeId: string;
|
|
40
42
|
coords: Point;
|
|
41
43
|
label?: string;
|
|
42
44
|
values?: {
|
|
@@ -49,17 +51,17 @@ export type AddNodeSerialized = {
|
|
|
49
51
|
* @private
|
|
50
52
|
*/
|
|
51
53
|
export declare class AddNodeCollabAction implements CollabAction {
|
|
52
|
-
canvas: Canvas;
|
|
53
|
-
id: string;
|
|
54
|
-
|
|
55
|
-
coords: Point;
|
|
56
|
-
label?: string;
|
|
57
|
-
values?: {
|
|
54
|
+
readonly canvas: Canvas;
|
|
55
|
+
readonly id: string;
|
|
56
|
+
readonly typeId: string;
|
|
57
|
+
readonly coords: Point;
|
|
58
|
+
readonly label?: string | undefined;
|
|
59
|
+
readonly values?: {
|
|
58
60
|
[key: string]: unknown;
|
|
59
|
-
};
|
|
60
|
-
constructor(canvas: Canvas, id: string,
|
|
61
|
+
} | undefined;
|
|
62
|
+
constructor(canvas: Canvas, id: string, typeId: string, coords: Point, label?: string | undefined, values?: {
|
|
61
63
|
[key: string]: unknown;
|
|
62
|
-
});
|
|
64
|
+
} | undefined);
|
|
63
65
|
do(): void;
|
|
64
66
|
serialize(): AddNodeSerialized;
|
|
65
67
|
static deserialize(canvas: Canvas, serialized: AddNodeSerialized): AddNodeCollabAction;
|
|
@@ -67,24 +69,144 @@ export declare class AddNodeCollabAction implements CollabAction {
|
|
|
67
69
|
/**
|
|
68
70
|
* @private
|
|
69
71
|
*/
|
|
70
|
-
export type
|
|
71
|
-
type: '
|
|
72
|
+
export type SetGeometrySerialized = {
|
|
73
|
+
type: 'setGeometry';
|
|
72
74
|
nodeId: string;
|
|
73
|
-
to:
|
|
75
|
+
to: DiagramNodeGeometry;
|
|
74
76
|
timestamp: CollabTimestamp;
|
|
75
77
|
};
|
|
76
78
|
/**
|
|
77
|
-
* Collaborative action which consists of
|
|
78
|
-
* @see
|
|
79
|
+
* Collaborative action which consists of changing a node's geometry: moving, stretching, or stretching sections.
|
|
80
|
+
* @see SetGeometryAction
|
|
79
81
|
* @private
|
|
80
82
|
*/
|
|
81
|
-
export declare class
|
|
83
|
+
export declare class SetGeometryCollabAction implements CollabAction {
|
|
82
84
|
readonly canvas: Canvas;
|
|
83
85
|
readonly nodeId: string;
|
|
84
|
-
readonly to:
|
|
86
|
+
readonly to: DiagramNodeGeometry;
|
|
85
87
|
readonly timestamp: CollabTimestamp;
|
|
86
|
-
constructor(canvas: Canvas, nodeId: string, to:
|
|
88
|
+
constructor(canvas: Canvas, nodeId: string, to: DiagramNodeGeometry, timestamp: CollabTimestamp);
|
|
87
89
|
do(): void;
|
|
88
|
-
serialize():
|
|
89
|
-
static deserialize(canvas: Canvas, serialized:
|
|
90
|
+
serialize(): SetGeometrySerialized;
|
|
91
|
+
static deserialize(canvas: Canvas, serialized: SetGeometrySerialized): SetGeometryCollabAction;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* @private
|
|
95
|
+
*/
|
|
96
|
+
export type AddConnectionSerialized = {
|
|
97
|
+
type: 'addConnection';
|
|
98
|
+
id: string;
|
|
99
|
+
typeId: string;
|
|
100
|
+
startId: string;
|
|
101
|
+
endId: string;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Collaborative action which consists of adding a connection.
|
|
105
|
+
* @see AddConnectionAction
|
|
106
|
+
* @private
|
|
107
|
+
*/
|
|
108
|
+
export declare class AddConnectionCollabAction implements CollabAction {
|
|
109
|
+
readonly canvas: Canvas;
|
|
110
|
+
readonly id: string;
|
|
111
|
+
readonly typeId: string;
|
|
112
|
+
readonly startId: string;
|
|
113
|
+
readonly endId: string;
|
|
114
|
+
constructor(canvas: Canvas, id: string, typeId: string, startId: string, endId: string);
|
|
115
|
+
do(): void;
|
|
116
|
+
serialize(): AddConnectionSerialized;
|
|
117
|
+
static deserialize(canvas: Canvas, serialized: AddConnectionSerialized): AddConnectionCollabAction;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* @private
|
|
121
|
+
*/
|
|
122
|
+
export type EditFieldSerialized = {
|
|
123
|
+
type: 'editField';
|
|
124
|
+
fieldId: string;
|
|
125
|
+
to: string;
|
|
126
|
+
timestamp: CollabTimestamp;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Collaborative action which consists of editing the text of a field.
|
|
130
|
+
* @see EditFieldAction
|
|
131
|
+
* @private
|
|
132
|
+
*/
|
|
133
|
+
export declare class EditFieldCollabAction implements CollabAction {
|
|
134
|
+
readonly canvas: Canvas;
|
|
135
|
+
readonly fieldId: string;
|
|
136
|
+
readonly to: string;
|
|
137
|
+
readonly timestamp: CollabTimestamp;
|
|
138
|
+
constructor(canvas: Canvas, fieldId: string, to: string, timestamp: CollabTimestamp);
|
|
139
|
+
do(): void;
|
|
140
|
+
serialize(): EditFieldSerialized;
|
|
141
|
+
static deserialize(canvas: Canvas, serialized: EditFieldSerialized): EditFieldCollabAction;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* @private
|
|
145
|
+
*/
|
|
146
|
+
export type UpdateValuesSerialized = {
|
|
147
|
+
type: 'updateValues';
|
|
148
|
+
id: string | undefined;
|
|
149
|
+
to: {
|
|
150
|
+
[key: string]: unknown;
|
|
151
|
+
};
|
|
152
|
+
timestamp: CollabTimestamp;
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* Collaborative action which consists of editing the values of a value set.
|
|
156
|
+
* @see UpdateValuesAction
|
|
157
|
+
* @private
|
|
158
|
+
*/
|
|
159
|
+
export declare class UpdateValuesCollabAction implements CollabAction {
|
|
160
|
+
readonly canvas: Canvas;
|
|
161
|
+
readonly id: string | undefined;
|
|
162
|
+
readonly to: {
|
|
163
|
+
[key: string]: unknown;
|
|
164
|
+
};
|
|
165
|
+
readonly timestamp: CollabTimestamp;
|
|
166
|
+
constructor(canvas: Canvas, id: string | undefined, to: {
|
|
167
|
+
[key: string]: unknown;
|
|
168
|
+
}, timestamp: CollabTimestamp);
|
|
169
|
+
getValueSet(): ValueSet | undefined;
|
|
170
|
+
do(): void;
|
|
171
|
+
serialize(): UpdateValuesSerialized;
|
|
172
|
+
static deserialize(canvas: Canvas, serialized: UpdateValuesSerialized): UpdateValuesCollabAction;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* @private
|
|
176
|
+
*/
|
|
177
|
+
export type SetSelfRemovedSerialized = {
|
|
178
|
+
type: 'setSelfRemoved';
|
|
179
|
+
nodeIds: string[];
|
|
180
|
+
sectionIds: string[];
|
|
181
|
+
portIds: string[];
|
|
182
|
+
connectionIds: string[];
|
|
183
|
+
fieldIds: string[];
|
|
184
|
+
removed: boolean;
|
|
185
|
+
timestamp: CollabTimestamp;
|
|
186
|
+
};
|
|
187
|
+
/**
|
|
188
|
+
* Collaborative action which consists of removing or un-removing elements.
|
|
189
|
+
*
|
|
190
|
+
* Specifically, the action sets the `selfRemoved` field for elements that are
|
|
191
|
+
* explicitly removed/unremoved. This causes the `removed` fields for those elements
|
|
192
|
+
* and their transitive dependents to update automatically.
|
|
193
|
+
* For example, self-removing a node also removes all of its sections/connections/etc.
|
|
194
|
+
*
|
|
195
|
+
* @see RemoveAction
|
|
196
|
+
* @private
|
|
197
|
+
*/
|
|
198
|
+
export declare class SetSelfRemovedCollabAction implements CollabAction {
|
|
199
|
+
readonly canvas: Canvas;
|
|
200
|
+
readonly nodeIds: string[];
|
|
201
|
+
readonly sectionIds: string[];
|
|
202
|
+
readonly portIds: string[];
|
|
203
|
+
readonly connectionIds: string[];
|
|
204
|
+
readonly fieldIds: string[];
|
|
205
|
+
readonly selfRemoved: boolean;
|
|
206
|
+
readonly timestamp: CollabTimestamp;
|
|
207
|
+
constructor(canvas: Canvas, nodeIds: string[], sectionIds: string[], portIds: string[], connectionIds: string[], fieldIds: string[], selfRemoved: boolean, timestamp: CollabTimestamp);
|
|
208
|
+
private doOne;
|
|
209
|
+
do(): void;
|
|
210
|
+
serialize(): CollabActionSerialized;
|
|
211
|
+
static deserialize(canvas: Canvas, serialized: SetSelfRemovedSerialized): SetSelfRemovedCollabAction;
|
|
90
212
|
}
|
|
@@ -9,7 +9,14 @@ export type CollabTimestamp = [clock: number, replicaId: string];
|
|
|
9
9
|
/**
|
|
10
10
|
* Returns whether the incoming timestamp wins over the existing timestamp.
|
|
11
11
|
*
|
|
12
|
-
* In the DiagramModel, timestamps that have never been set are left
|
|
12
|
+
* In the DiagramModel, timestamps that have never been set are left null;
|
|
13
13
|
* `timestampWins` treats that as an "initial timestamp" that loses to all LogicalTimestamps.
|
|
14
14
|
*/
|
|
15
|
-
export declare function timestampWins(incoming: CollabTimestamp, existing: CollabTimestamp | undefined): boolean;
|
|
15
|
+
export declare function timestampWins(incoming: CollabTimestamp, existing: CollabTimestamp | null | undefined): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* A nested collection of CollabTimestamps associated to a ValueSet.
|
|
18
|
+
* @see ValueSet
|
|
19
|
+
*/
|
|
20
|
+
export type CollabTimestampSet = {
|
|
21
|
+
[key: string]: CollabTimestamp | CollabTimestampSet;
|
|
22
|
+
};
|
|
@@ -6,5 +6,5 @@ import { DiagramModelExporter } from './diagram-model-exporter';
|
|
|
6
6
|
* @public
|
|
7
7
|
*/
|
|
8
8
|
export declare class DagaExporter implements DiagramModelExporter<DagaModel> {
|
|
9
|
-
export(model: DiagramModel): DagaModel;
|
|
9
|
+
export(model: DiagramModel, includeCollabMeta?: boolean): DagaModel;
|
|
10
10
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Point } from '../../../util/canvas-util';
|
|
2
2
|
import { Side } from '../../../util/svg-util';
|
|
3
|
-
import { CollabTimestamp } from '../collab/primitives';
|
|
3
|
+
import { CollabTimestamp, CollabTimestampSet } from '../collab/primitives';
|
|
4
4
|
export declare const DAGA_FILE_VERSION = 1;
|
|
5
5
|
/**
|
|
6
6
|
* Representation of a diagram model in a serialized format.
|
|
@@ -19,7 +19,6 @@ export interface DagaModel {
|
|
|
19
19
|
createdAt: Date;
|
|
20
20
|
updatedAt: Date;
|
|
21
21
|
updatedDaysAgo?: string;
|
|
22
|
-
logicalClock?: number;
|
|
23
22
|
nodes: {
|
|
24
23
|
id: string;
|
|
25
24
|
type: string;
|
|
@@ -30,6 +29,17 @@ export interface DagaModel {
|
|
|
30
29
|
coords: Point;
|
|
31
30
|
direction: Side;
|
|
32
31
|
label: string;
|
|
32
|
+
collabMeta?: {
|
|
33
|
+
removed: boolean;
|
|
34
|
+
selfRemoved: boolean;
|
|
35
|
+
selfRemovedTimestamp: CollabTimestamp | null;
|
|
36
|
+
label?: {
|
|
37
|
+
removed: boolean;
|
|
38
|
+
selfRemoved: boolean;
|
|
39
|
+
selfRemovedTimestamp: CollabTimestamp | null;
|
|
40
|
+
textTimestamp: CollabTimestamp | null;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
33
43
|
}[];
|
|
34
44
|
label: string;
|
|
35
45
|
indexXInNode: number;
|
|
@@ -37,21 +47,55 @@ export interface DagaModel {
|
|
|
37
47
|
coords: Point;
|
|
38
48
|
width: number;
|
|
39
49
|
height: number;
|
|
50
|
+
collabMeta?: {
|
|
51
|
+
removed: boolean;
|
|
52
|
+
selfRemoved: boolean;
|
|
53
|
+
selfRemovedTimestamp: CollabTimestamp | null;
|
|
54
|
+
label?: {
|
|
55
|
+
removed: boolean;
|
|
56
|
+
selfRemoved: boolean;
|
|
57
|
+
selfRemovedTimestamp: CollabTimestamp | null;
|
|
58
|
+
textTimestamp: CollabTimestamp | null;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
40
61
|
}[];
|
|
41
62
|
ports?: {
|
|
42
63
|
id: string;
|
|
43
64
|
coords: Point;
|
|
44
65
|
direction: Side;
|
|
45
66
|
label: string;
|
|
67
|
+
collabMeta?: {
|
|
68
|
+
removed: boolean;
|
|
69
|
+
selfRemoved: boolean;
|
|
70
|
+
selfRemovedTimestamp: CollabTimestamp | null;
|
|
71
|
+
label?: {
|
|
72
|
+
removed: boolean;
|
|
73
|
+
selfRemoved: boolean;
|
|
74
|
+
selfRemovedTimestamp: CollabTimestamp | null;
|
|
75
|
+
textTimestamp: CollabTimestamp | null;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
46
78
|
}[];
|
|
47
79
|
label: string;
|
|
48
80
|
coords: Point;
|
|
49
|
-
coordsTimestamp?: CollabTimestamp;
|
|
50
81
|
width: number;
|
|
51
82
|
height: number;
|
|
52
83
|
data: {
|
|
53
84
|
[key: string]: unknown;
|
|
54
85
|
};
|
|
86
|
+
collabMeta?: {
|
|
87
|
+
removed: boolean;
|
|
88
|
+
selfRemoved: boolean;
|
|
89
|
+
selfRemovedTimestamp: CollabTimestamp | null;
|
|
90
|
+
geometryTimestamp: CollabTimestamp | null;
|
|
91
|
+
dataTimestamps: CollabTimestampSet;
|
|
92
|
+
label?: {
|
|
93
|
+
removed: boolean;
|
|
94
|
+
selfRemoved: boolean;
|
|
95
|
+
selfRemovedTimestamp: CollabTimestamp | null;
|
|
96
|
+
textTimestamp: CollabTimestamp | null;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
55
99
|
}[];
|
|
56
100
|
connections: {
|
|
57
101
|
id: string;
|
|
@@ -65,8 +109,18 @@ export interface DagaModel {
|
|
|
65
109
|
data: {
|
|
66
110
|
[key: string]: unknown;
|
|
67
111
|
};
|
|
112
|
+
collabMeta?: {
|
|
113
|
+
removed: boolean;
|
|
114
|
+
selfRemoved: boolean;
|
|
115
|
+
selfRemovedTimestamp: CollabTimestamp | null;
|
|
116
|
+
dataTimestamps: CollabTimestampSet;
|
|
117
|
+
};
|
|
68
118
|
}[];
|
|
69
119
|
data: {
|
|
70
120
|
[key: string]: unknown;
|
|
71
121
|
};
|
|
122
|
+
collabMeta?: {
|
|
123
|
+
logicalClock: number;
|
|
124
|
+
dataTimestamps: CollabTimestampSet;
|
|
125
|
+
};
|
|
72
126
|
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { Canvas } from '../../interfaces/canvas';
|
|
2
2
|
import { Point } from '../../util/canvas-util';
|
|
3
|
-
import { Side } from '../../util/svg-util';
|
|
4
3
|
import { DiagramConnectionType } from './diagram-connection';
|
|
5
|
-
import {
|
|
6
|
-
import { DiagramNodeType } from './diagram-node';
|
|
7
|
-
import { ValueSet } from './diagram-property';
|
|
4
|
+
import { DiagramNodeType, DiagramNodeGeometry } from './diagram-node';
|
|
8
5
|
/**
|
|
9
6
|
* A queue of recent actions taken by the user that can be undone and redone.
|
|
10
7
|
* @private
|
|
@@ -96,7 +93,7 @@ export declare enum DiagramActions {
|
|
|
96
93
|
EditField = "edit-field",
|
|
97
94
|
/**
|
|
98
95
|
* Action that corresponds to moving a node.
|
|
99
|
-
* @see
|
|
96
|
+
* @see SetGeometryAction
|
|
100
97
|
* @public
|
|
101
98
|
*/
|
|
102
99
|
MoveNode = "move-node",
|
|
@@ -108,13 +105,13 @@ export declare enum DiagramActions {
|
|
|
108
105
|
Remove = "remove",
|
|
109
106
|
/**
|
|
110
107
|
* Action that corresponds to altering a node's dimensions.
|
|
111
|
-
* @see
|
|
108
|
+
* @see SetGeometryActionAction
|
|
112
109
|
* @public
|
|
113
110
|
*/
|
|
114
111
|
StretchNode = "stretch-node",
|
|
115
112
|
/**
|
|
116
113
|
* Action that corresponds to altering a sections's dimensions.
|
|
117
|
-
* @see
|
|
114
|
+
* @see SetGeometryAction
|
|
118
115
|
* @public
|
|
119
116
|
*/
|
|
120
117
|
StretchSection = "stretch-section",
|
|
@@ -152,48 +149,17 @@ export declare class AddNodeAction implements DiagramAction {
|
|
|
152
149
|
redo(): void;
|
|
153
150
|
}
|
|
154
151
|
/**
|
|
155
|
-
* Action which consists of
|
|
152
|
+
* Action which consists of changing a node's geometry: moving, stretching, or stretching sections.
|
|
156
153
|
* @see DiagramNode
|
|
157
154
|
* @private
|
|
158
155
|
*/
|
|
159
|
-
export declare class
|
|
156
|
+
export declare class SetGeometryAction implements DiagramAction {
|
|
160
157
|
canvas: Canvas;
|
|
158
|
+
intent: DiagramActions.MoveNode | DiagramActions.StretchNode | DiagramActions.StretchSection;
|
|
161
159
|
nodeId: string;
|
|
162
|
-
from:
|
|
163
|
-
to:
|
|
164
|
-
constructor(canvas: Canvas, nodeId: string, from:
|
|
165
|
-
do(): void;
|
|
166
|
-
undo(): void;
|
|
167
|
-
redo(): void;
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Action which consists of changing the dimensions of a node in a given direction.
|
|
171
|
-
* @see DiagramNode
|
|
172
|
-
* @private
|
|
173
|
-
*/
|
|
174
|
-
export declare class StretchNodeAction implements DiagramAction {
|
|
175
|
-
canvas: Canvas;
|
|
176
|
-
nodeId: string;
|
|
177
|
-
direction: Side;
|
|
178
|
-
from: number;
|
|
179
|
-
to: number;
|
|
180
|
-
constructor(canvas: Canvas, nodeId: string, direction: Side, from: number, to: number);
|
|
181
|
-
do(): void;
|
|
182
|
-
undo(): void;
|
|
183
|
-
redo(): void;
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* Action which consists of changing the dimensions of a section in a given direction.
|
|
187
|
-
* @see DiagramSection
|
|
188
|
-
* @private
|
|
189
|
-
*/
|
|
190
|
-
export declare class StretchSectionAction implements DiagramAction {
|
|
191
|
-
canvas: Canvas;
|
|
192
|
-
sectionId: string;
|
|
193
|
-
direction: Side;
|
|
194
|
-
from: number;
|
|
195
|
-
to: number;
|
|
196
|
-
constructor(canvas: Canvas, sectionId: string, direction: Side, from: number, to: number);
|
|
160
|
+
from: DiagramNodeGeometry;
|
|
161
|
+
to: DiagramNodeGeometry;
|
|
162
|
+
constructor(canvas: Canvas, intent: DiagramActions.MoveNode | DiagramActions.StretchNode | DiagramActions.StretchSection, nodeId: string, from: DiagramNodeGeometry, to: DiagramNodeGeometry);
|
|
197
163
|
do(): void;
|
|
198
164
|
undo(): void;
|
|
199
165
|
redo(): void;
|
|
@@ -208,8 +174,8 @@ export declare class AddConnectionAction implements DiagramAction {
|
|
|
208
174
|
type: DiagramConnectionType;
|
|
209
175
|
startId: string;
|
|
210
176
|
endId: string;
|
|
211
|
-
id
|
|
212
|
-
constructor(canvas: Canvas, type: DiagramConnectionType, startId: string, endId: string
|
|
177
|
+
id: string;
|
|
178
|
+
constructor(canvas: Canvas, type: DiagramConnectionType, startId: string, endId: string);
|
|
213
179
|
do(): void;
|
|
214
180
|
undo(): void;
|
|
215
181
|
redo(): void;
|
|
@@ -235,7 +201,7 @@ export declare class EditFieldAction implements DiagramAction {
|
|
|
235
201
|
* @private
|
|
236
202
|
*/
|
|
237
203
|
export declare class UpdateValuesAction implements DiagramAction {
|
|
238
|
-
|
|
204
|
+
canvas: Canvas;
|
|
239
205
|
id: string | undefined;
|
|
240
206
|
from: {
|
|
241
207
|
[key: string]: unknown;
|
|
@@ -243,28 +209,34 @@ export declare class UpdateValuesAction implements DiagramAction {
|
|
|
243
209
|
to: {
|
|
244
210
|
[key: string]: unknown;
|
|
245
211
|
};
|
|
246
|
-
constructor(
|
|
212
|
+
constructor(canvas: Canvas, id: string | undefined, from: {
|
|
247
213
|
[key: string]: unknown;
|
|
248
214
|
}, to: {
|
|
249
215
|
[key: string]: unknown;
|
|
250
216
|
});
|
|
251
|
-
getValueSet(): ValueSet | undefined;
|
|
252
217
|
do(): void;
|
|
253
218
|
undo(): void;
|
|
254
219
|
redo(): void;
|
|
255
220
|
}
|
|
256
221
|
/**
|
|
257
222
|
* Action which consists of removing elements from a diagram.
|
|
223
|
+
*
|
|
224
|
+
* You should only include an element in this action if the element itself is explicitly removed.
|
|
225
|
+
* Elements removed as a consequence of a removing another element
|
|
226
|
+
* (e.g., removing a node removes all of its sections)
|
|
227
|
+
* will be handled automatically, in a way that converges in the case
|
|
228
|
+
* of concurrent collaborative actions.
|
|
229
|
+
*
|
|
258
230
|
* @private
|
|
259
231
|
*/
|
|
260
232
|
export declare class RemoveAction implements DiagramAction {
|
|
261
|
-
|
|
233
|
+
canvas: Canvas;
|
|
262
234
|
nodeIds: string[];
|
|
263
235
|
sectionIds: string[];
|
|
264
236
|
portIds: string[];
|
|
265
237
|
connectionIds: string[];
|
|
266
238
|
fieldIds: string[];
|
|
267
|
-
constructor(
|
|
239
|
+
constructor(canvas: Canvas, nodeIds: string[], sectionIds: string[], portIds: string[], connectionIds: string[], fieldIds: string[]);
|
|
268
240
|
do(): void;
|
|
269
241
|
undo(): void;
|
|
270
242
|
redo(): void;
|
|
@@ -25,6 +25,22 @@ export declare const DIAGRAM_CONNECTION_TYPE_DEFAULTS: {
|
|
|
25
25
|
selectedColor: string;
|
|
26
26
|
properties: never[];
|
|
27
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* Whether a connection can have the same port as both its start port and its end port.
|
|
30
|
+
*/
|
|
31
|
+
export declare const CAN_A_CONNECTION_END_ON_THE_SAME_PORT_IT_STARTS = false;
|
|
32
|
+
/**
|
|
33
|
+
* Whether a connection can have the same ports as another connection.
|
|
34
|
+
*/
|
|
35
|
+
export declare const CAN_A_CONNECTION_HAVE_THE_SAME_PORTS_AS_ANOTHER = false;
|
|
36
|
+
/**
|
|
37
|
+
* Whether a port can have multiple connections.
|
|
38
|
+
*/
|
|
39
|
+
export declare const CAN_CONNECTIONS_SHARE_PORTS = true;
|
|
40
|
+
/**
|
|
41
|
+
* Whether tightening connections is allowed.
|
|
42
|
+
*/
|
|
43
|
+
export declare const CAN_TIGHTEN_CONNECTIONS = true;
|
|
28
44
|
/**
|
|
29
45
|
* A connection type, which holds properties that connections of this type share in common.
|
|
30
46
|
* @see ConnectionTypeConfig
|
|
@@ -131,7 +147,8 @@ export declare class DiagramConnection extends DiagramElement {
|
|
|
131
147
|
*/
|
|
132
148
|
get name(): string;
|
|
133
149
|
set name(name: string);
|
|
134
|
-
constructor(model: DiagramModel, type: DiagramConnectionType, start
|
|
150
|
+
constructor(model: DiagramModel, type: DiagramConnectionType, start: DiagramPort | undefined, end: DiagramPort | undefined, id: string);
|
|
151
|
+
get removed(): boolean;
|
|
135
152
|
updateInView(): void;
|
|
136
153
|
/**
|
|
137
154
|
* Set the start of this connection to the given port or reset this connection's starting port if `undefined`.
|
|
@@ -173,9 +190,9 @@ export declare class DiagramConnectionSet extends DiagramEntitySet<DiagramConnec
|
|
|
173
190
|
* @param type The type of the connection given as either the type itself or the id of the type.
|
|
174
191
|
* @param start The start port of the connection.
|
|
175
192
|
* @param end The end port of the connection.
|
|
176
|
-
* @param id The id of the connection.
|
|
193
|
+
* @param id The id of the connection.
|
|
177
194
|
* @returns The instanced connection.
|
|
178
195
|
*/
|
|
179
|
-
new(type: DiagramConnectionType | string, start
|
|
196
|
+
new(type: DiagramConnectionType | string, start: DiagramPort | undefined, end: DiagramPort | undefined, id: string): DiagramConnection;
|
|
180
197
|
remove(id: string): void;
|
|
181
198
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as d3 from 'd3';
|
|
2
2
|
import { DiagramModel } from './diagram-model';
|
|
3
|
+
import { CollabTimestamp } from './collab/primitives';
|
|
3
4
|
/**
|
|
4
5
|
* Default priority value for diagram elements.
|
|
5
6
|
* @private
|
|
@@ -42,11 +43,32 @@ export declare abstract class DiagramElement implements DiagramEntity {
|
|
|
42
43
|
*/
|
|
43
44
|
selected: boolean;
|
|
44
45
|
/**
|
|
45
|
-
* Whether this diagram element has been removed.
|
|
46
|
+
* Whether this diagram element has itself been explicitly removed.
|
|
47
|
+
*
|
|
48
|
+
* Override the `removed` getter so that it returns true if and only if:
|
|
49
|
+
* - `selfRemoved` is true, or
|
|
50
|
+
* - `removed` is true for any of this element's dependencies.
|
|
51
|
+
*
|
|
52
|
+
* For example, a DiagramConnection is removed if either of its ports are removed,
|
|
53
|
+
* even if the connection's own `selfRemoved` field is false.
|
|
54
|
+
* @private
|
|
55
|
+
*/
|
|
56
|
+
selfRemoved: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Collaborative timestamp for selfRemoved.
|
|
46
59
|
* @private
|
|
47
60
|
*/
|
|
48
|
-
|
|
61
|
+
selfRemovedTimestamp: CollabTimestamp | null;
|
|
49
62
|
constructor(model: DiagramModel, id: string);
|
|
63
|
+
/**
|
|
64
|
+
* Whether this diagram element has been removed.
|
|
65
|
+
*
|
|
66
|
+
* An element can be removed because it was explicitly removed, or because one of
|
|
67
|
+
* its dependencies was removed. For example, a DiagramConnection depends on both of its ports.
|
|
68
|
+
*
|
|
69
|
+
* @private
|
|
70
|
+
*/
|
|
71
|
+
abstract readonly removed: boolean;
|
|
50
72
|
/**
|
|
51
73
|
* Get the priority of this element to calculate whether it should be filtered out in the view or not.
|
|
52
74
|
* @public
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Point } from '../../util/canvas-util';
|
|
2
2
|
import { HorizontalAlign, VerticalAlign } from '../../util/svg-util';
|
|
3
|
+
import { CollabTimestamp } from './collab/primitives';
|
|
3
4
|
import { DiagramElement, DiagramEntitySet } from './diagram-element';
|
|
4
5
|
import { DiagramModel } from './diagram-model';
|
|
5
6
|
import { DiagramNode } from './diagram-node';
|
|
@@ -92,6 +93,11 @@ export declare class DiagramField extends DiagramElement {
|
|
|
92
93
|
*/
|
|
93
94
|
get text(): string;
|
|
94
95
|
set text(value: string);
|
|
96
|
+
/**
|
|
97
|
+
* Collaborative timestamp for text.
|
|
98
|
+
* @public
|
|
99
|
+
*/
|
|
100
|
+
textTimestamp: CollabTimestamp | null;
|
|
95
101
|
/**
|
|
96
102
|
* Whether this field's text can be edited by the user.
|
|
97
103
|
* @public
|
|
@@ -102,8 +108,9 @@ export declare class DiagramField extends DiagramElement {
|
|
|
102
108
|
* @public
|
|
103
109
|
*/
|
|
104
110
|
fit: boolean;
|
|
105
|
-
constructor(model: DiagramModel, rootElement: DiagramNode | DiagramSection | DiagramPort | undefined, coords: Point, width: number, height: number, fontSize: number, fontFamily: string | null, color: string, selectedColor: string, horizontalAlign: HorizontalAlign, verticalAlign: VerticalAlign, text: string, editable: boolean, fit: boolean
|
|
111
|
+
constructor(model: DiagramModel, rootElement: DiagramNode | DiagramSection | DiagramPort | undefined, coords: Point, width: number, height: number, fontSize: number, fontFamily: string | null, color: string, selectedColor: string, horizontalAlign: HorizontalAlign, verticalAlign: VerticalAlign, text: string, editable: boolean, fit: boolean);
|
|
106
112
|
select(): d3.Selection<SVGGElement, unknown, null, unknown> | undefined;
|
|
113
|
+
get removed(): boolean;
|
|
107
114
|
updateInView(): void;
|
|
108
115
|
/**
|
|
109
116
|
* Change the coordinates of this field to the given coordinates.
|
|
@@ -124,6 +131,6 @@ export declare class DiagramFieldSet extends DiagramEntitySet<DiagramField> {
|
|
|
124
131
|
* Instance a new field and add it to this set. This method is normally called when instancing an element with a field and it is rarely called by itself.
|
|
125
132
|
* @private
|
|
126
133
|
*/
|
|
127
|
-
new(rootElement: DiagramNode | DiagramSection | DiagramPort | undefined, coords: Point, fontSize: number, fontFamily: string | null, color: string, selectedColor: string, width: number, height: number, horizontalAlign: HorizontalAlign, verticalAlign: VerticalAlign, text: string, editable: boolean, fit: boolean
|
|
134
|
+
new(rootElement: DiagramNode | DiagramSection | DiagramPort | undefined, coords: Point, fontSize: number, fontFamily: string | null, color: string, selectedColor: string, width: number, height: number, horizontalAlign: HorizontalAlign, verticalAlign: VerticalAlign, text: string, editable: boolean, fit: boolean): DiagramField;
|
|
128
135
|
remove(id: string): void;
|
|
129
136
|
}
|