@metadev/daga 1.5.0 → 1.5.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.
@@ -1,8 +1,9 @@
1
1
  import { Canvas } from '../../../interfaces/canvas';
2
2
  import { Point } from '../../../util/canvas-util';
3
- import { CollabTimestamp } from './primitives';
3
+ import { DagaConnection, DagaNode } from '../converters/daga-model';
4
4
  import { DiagramNodeGeometry } from '../diagram-node';
5
5
  import { ValueSet } from '../diagram-property';
6
+ import { CollabTimestamp } from './primitives';
6
7
  /**
7
8
  * An action taken by a local or remote user.
8
9
  *
@@ -31,7 +32,7 @@ export interface CollabAction {
31
32
  /**
32
33
  * @private
33
34
  */
34
- export type CollabActionSerialized = AddNodeSerialized | SetGeometrySerialized | AddConnectionSerialized | EditFieldSerialized | UpdateValuesSerialized | SetSelfRemovedSerialized;
35
+ export type CollabActionSerialized = AddNodeSerialized | SetGeometrySerialized | AddConnectionSerialized | EditFieldSerialized | UpdateValuesSerialized | SetSelfRemovedSerialized | PasteSerialized;
35
36
  /**
36
37
  * @private
37
38
  */
@@ -210,3 +211,26 @@ export declare class SetSelfRemovedCollabAction implements CollabAction {
210
211
  serialize(): CollabActionSerialized;
211
212
  static deserialize(canvas: Canvas, serialized: SetSelfRemovedSerialized): SetSelfRemovedCollabAction;
212
213
  }
214
+ /**
215
+ * @private
216
+ */
217
+ export type PasteSerialized = {
218
+ type: 'paste';
219
+ readonly nodes: DagaNode[];
220
+ readonly connections: DagaConnection[];
221
+ };
222
+ /**
223
+ * Collaborative action which consists of pasting elements from an external source into a diagram.
224
+ *
225
+ * @see PasteAction
226
+ * @private
227
+ */
228
+ export declare class PasteCollabAction implements CollabAction {
229
+ readonly canvas: Canvas;
230
+ readonly nodes: DagaNode[];
231
+ readonly connections: DagaConnection[];
232
+ constructor(canvas: Canvas, nodes: DagaNode[], connections: DagaConnection[]);
233
+ do(): void;
234
+ serialize(): CollabActionSerialized;
235
+ static deserialize(canvas: Canvas, serialized: PasteSerialized): PasteCollabAction;
236
+ }
@@ -1,5 +1,8 @@
1
+ import { DiagramConnection } from '../diagram-connection';
2
+ import { DiagramField } from '../diagram-field';
1
3
  import { DiagramModel } from '../diagram-model';
2
- import { DagaModel } from './daga-model';
4
+ import { DiagramNode } from '../diagram-node';
5
+ import { DagaConnection, DagaModel, DagaNode } from './daga-model';
3
6
  import { DiagramModelExporter } from './diagram-model-exporter';
4
7
  /**
5
8
  * Importer which exports a diagram to its daga model representation.
@@ -7,4 +10,18 @@ import { DiagramModelExporter } from './diagram-model-exporter';
7
10
  */
8
11
  export declare class DagaExporter implements DiagramModelExporter<DagaModel> {
9
12
  export(model: DiagramModel, includeCollabMeta?: boolean): DagaModel;
13
+ exportNode(node: DiagramNode, includeCollabMeta?: boolean): DagaNode;
14
+ exportConnection(connection: DiagramConnection, includeCollabMeta?: boolean): DagaConnection;
15
+ exportLabelCollabMeta({ label }: {
16
+ label?: DiagramField;
17
+ }): {
18
+ label: {
19
+ removed: boolean;
20
+ selfRemoved: boolean;
21
+ selfRemovedTimestamp: import("@metadev/daga").CollabTimestamp | null;
22
+ textTimestamp: import("@metadev/daga").CollabTimestamp | null;
23
+ };
24
+ } | {
25
+ label?: undefined;
26
+ };
10
27
  }
@@ -1,5 +1,7 @@
1
+ import { CollabTimestamp } from '../collab/primitives';
2
+ import { DiagramField } from '../diagram-field';
1
3
  import { DiagramModel } from '../diagram-model';
2
- import { DagaModel } from './daga-model';
4
+ import { DagaConnection, DagaModel, DagaNode } from './daga-model';
3
5
  import { DiagramModelImporter } from './diagram-model-importer';
4
6
  /**
5
7
  * Importer which imports a diagram from its daga model representation.
@@ -7,4 +9,11 @@ import { DiagramModelImporter } from './diagram-model-importer';
7
9
  */
8
10
  export declare class DagaImporter implements DiagramModelImporter<DagaModel> {
9
11
  import(model: DiagramModel, data: DagaModel): DiagramModel;
12
+ importNode(model: DiagramModel, node: DagaNode): DiagramModel;
13
+ importConnection(model: DiagramModel, connection: DagaConnection): DiagramModel;
14
+ importLabelCollabMeta(newLabel?: DiagramField, labelCollabMeta?: {
15
+ selfRemoved: boolean;
16
+ selfRemovedTimestamp: CollabTimestamp | null;
17
+ textTimestamp: CollabTimestamp | null;
18
+ }): void;
10
19
  }
@@ -19,108 +19,96 @@ export interface DagaModel {
19
19
  createdAt: Date;
20
20
  updatedAt: Date;
21
21
  updatedDaysAgo?: string;
22
- nodes: {
23
- id: string;
24
- type: string;
25
- sections?: {
26
- id: string;
27
- ports?: {
28
- id: string;
29
- coords: Point;
30
- direction: Side;
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
- };
43
- }[];
44
- label: string;
45
- indexXInNode: number;
46
- indexYInNode: number;
47
- coords: Point;
48
- width: number;
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
- };
61
- }[];
62
- ports?: {
63
- id: string;
64
- coords: Point;
65
- direction: Side;
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
- };
78
- }[];
79
- label: string;
80
- coords: Point;
81
- width: number;
82
- height: number;
83
- data: {
84
- [key: string]: unknown;
85
- };
86
- collabMeta?: {
22
+ nodes: DagaNode[];
23
+ connections: DagaConnection[];
24
+ data: {
25
+ [key: string]: unknown;
26
+ };
27
+ collabMeta?: {
28
+ logicalClock: number;
29
+ dataTimestamps: CollabTimestampSet;
30
+ };
31
+ }
32
+ export interface DagaNode {
33
+ id: string;
34
+ type: string;
35
+ sections?: DagaSection[];
36
+ ports?: DagaPort[];
37
+ label: string;
38
+ coords: Point;
39
+ width: number;
40
+ height: number;
41
+ data: {
42
+ [key: string]: unknown;
43
+ };
44
+ collabMeta?: {
45
+ removed: boolean;
46
+ selfRemoved: boolean;
47
+ selfRemovedTimestamp: CollabTimestamp | null;
48
+ geometryTimestamp: CollabTimestamp | null;
49
+ dataTimestamps: CollabTimestampSet;
50
+ label?: {
87
51
  removed: boolean;
88
52
  selfRemoved: boolean;
89
53
  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
- };
54
+ textTimestamp: CollabTimestamp | null;
98
55
  };
99
- }[];
100
- connections: {
101
- id: string;
102
- type: string;
103
- start: string;
104
- end: string;
105
- startLabel: string;
106
- middleLabel: string;
107
- endLabel: string;
108
- points: Point[];
109
- data: {
110
- [key: string]: unknown;
56
+ };
57
+ }
58
+ export interface DagaSection {
59
+ id: string;
60
+ ports?: DagaPort[];
61
+ label: string;
62
+ indexXInNode: number;
63
+ indexYInNode: number;
64
+ coords: Point;
65
+ width: number;
66
+ height: number;
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;
111
76
  };
112
- collabMeta?: {
77
+ };
78
+ }
79
+ export interface DagaPort {
80
+ id: string;
81
+ coords: Point;
82
+ direction: Side;
83
+ label: string;
84
+ collabMeta?: {
85
+ removed: boolean;
86
+ selfRemoved: boolean;
87
+ selfRemovedTimestamp: CollabTimestamp | null;
88
+ label?: {
113
89
  removed: boolean;
114
90
  selfRemoved: boolean;
115
91
  selfRemovedTimestamp: CollabTimestamp | null;
116
- dataTimestamps: CollabTimestampSet;
92
+ textTimestamp: CollabTimestamp | null;
117
93
  };
118
- }[];
94
+ };
95
+ }
96
+ export interface DagaConnection {
97
+ id: string;
98
+ type: string;
99
+ start: string;
100
+ end: string;
101
+ startLabel: string;
102
+ middleLabel: string;
103
+ endLabel: string;
104
+ points: Point[];
119
105
  data: {
120
106
  [key: string]: unknown;
121
107
  };
122
108
  collabMeta?: {
123
- logicalClock: number;
109
+ removed: boolean;
110
+ selfRemoved: boolean;
111
+ selfRemovedTimestamp: CollabTimestamp | null;
124
112
  dataTimestamps: CollabTimestampSet;
125
113
  };
126
114
  }
@@ -1,7 +1,8 @@
1
1
  import { Canvas } from '../../interfaces/canvas';
2
2
  import { Point } from '../../util/canvas-util';
3
+ import { DagaConnection, DagaNode } from './converters/daga-model';
3
4
  import { DiagramConnectionType } from './diagram-connection';
4
- import { DiagramNodeType, DiagramNodeGeometry } from './diagram-node';
5
+ import { DiagramNodeGeometry, DiagramNodeType } from './diagram-node';
5
6
  /**
6
7
  * A queue of recent actions taken by the user that can be undone and redone.
7
8
  * @private
@@ -85,6 +86,16 @@ export declare enum DiagramActions {
85
86
  * @public
86
87
  */
87
88
  AddNode = "add-node",
89
+ /**
90
+ * Action that corresponds to copying diagram elements to the clipboard.
91
+ * @public
92
+ */
93
+ Clipboard = "clipboard",
94
+ /**
95
+ * Action that corresponds to opening the context menu.
96
+ * @public
97
+ */
98
+ ContextMenu = "context-menu",
88
99
  /**
89
100
  * Action that corresponds to the edition of a field's text content.
90
101
  * @see EditFieldAction
@@ -97,6 +108,12 @@ export declare enum DiagramActions {
97
108
  * @public
98
109
  */
99
110
  MoveNode = "move-node",
111
+ /**
112
+ * Action that corresponds to pasting diagram elements from the clipboard.
113
+ * @see PasteAction
114
+ * @public
115
+ */
116
+ Paste = "paste",
100
117
  /**
101
118
  * Action that corresponds to removing elements.
102
119
  * @see RemoveAction
@@ -241,3 +258,18 @@ export declare class RemoveAction implements DiagramAction {
241
258
  undo(): void;
242
259
  redo(): void;
243
260
  }
261
+ /**
262
+ * Action which consists of pasting elements from an external source into a diagram.
263
+ *
264
+ * @private
265
+ */
266
+ export declare class PasteAction implements DiagramAction {
267
+ canvas: Canvas;
268
+ nodes: DagaNode[];
269
+ connections: DagaConnection[];
270
+ coords?: Point;
271
+ constructor(canvas: Canvas, nodes: DagaNode[], connections: DagaConnection[], coords?: Point);
272
+ do(): void;
273
+ undo(): void;
274
+ redo(): void;
275
+ }
@@ -5,6 +5,7 @@ import { Canvas } from '../../interfaces/canvas';
5
5
  import { DiagramEditor } from '../../interfaces/diagram-editor';
6
6
  import { Point } from '../../util/canvas-util';
7
7
  import { CursorStyle } from '../../util/style';
8
+ import { CollabEngine } from './collab/collab-engine';
8
9
  import { ActionQueue, DiagramActions } from './diagram-action';
9
10
  import { DiagramConfig } from './diagram-config';
10
11
  import { DiagramConnection, DiagramConnectionType } from './diagram-connection';
@@ -12,7 +13,6 @@ import { DiagramElement } from './diagram-element';
12
13
  import { DiagramModel } from './diagram-model';
13
14
  import { DiagramPort } from './diagram-port';
14
15
  import { ValueSet } from './diagram-property';
15
- import { CollabEngine } from './collab/collab-engine';
16
16
  /**
17
17
  * Thickness of the invisible path around a connection used to make it easier to click on, in pixels.
18
18
  * @private
@@ -59,6 +59,9 @@ export declare class DiagramCanvas implements Canvas {
59
59
  private priorityThresholds;
60
60
  private mainUserHighlight?;
61
61
  private userHighlight;
62
+ /**
63
+ * Elements selected by the user. Only nodes and connections should be selected.
64
+ */
62
65
  private userSelection;
63
66
  private propertyEditorSelection?;
64
67
  private propertyEditorValues?;
@@ -68,12 +71,14 @@ export declare class DiagramCanvas implements Canvas {
68
71
  */
69
72
  private unfinishedConnectionTracer?;
70
73
  private inputFieldContainer?;
74
+ private contextMenuContainer?;
71
75
  private draggingFrom;
72
76
  private currentAction?;
73
77
  viewInitialized$: Subject<void>;
74
78
  validatorChanges$: Subject<void>;
75
79
  diagramChanges$: Subject<void>;
76
80
  diagramImportantChanges$: Subject<void>;
81
+ propertyEditorChanges$: Subject<void>;
77
82
  constructor(parentComponent: DiagramEditor, config: DiagramConfig);
78
83
  addValidator(validator: DiagramValidator): void;
79
84
  removeValidator(validator: DiagramValidator): void;
@@ -87,8 +92,10 @@ export declare class DiagramCanvas implements Canvas {
87
92
  translateTo(x: number, y: number): void;
88
93
  center(): void;
89
94
  getClosestGridPoint(point: Point): Point;
95
+ getCoordinatesOnScreen(): [Point, Point];
90
96
  private getEventHoldingCoordinates;
91
97
  getPointerLocationRelativeToCanvas(event: MouseEvent): Point;
98
+ getPointerLocationRelativeToRoot(event: MouseEvent): Point;
92
99
  getPointerLocationRelativeToBody(event: MouseEvent): Point;
93
100
  getPointerLocationRelativeToScreen(event: MouseEvent): Point;
94
101
  updateModelInView(): void;
@@ -97,11 +104,12 @@ export declare class DiagramCanvas implements Canvas {
97
104
  updatePortsInView(...ids: string[]): void;
98
105
  updateConnectionsInView(...ids: string[]): void;
99
106
  updateFieldsInView(...ids: string[]): void;
107
+ updateObjectsInView(...ids: string[]): void;
100
108
  updateConnectionLabelsInView(connection: DiagramConnection): void;
101
109
  updateConnectionMarkersInView(connection: DiagramConnection): void;
102
110
  fitFieldRootInView(id: string): void;
103
111
  fitNodeInView(id: string): void;
104
- selectRoot(): d3.Selection<d3.BaseType, unknown, null, unknown>;
112
+ selectRoot(): d3.Selection<SVGElement, unknown, null, unknown>;
105
113
  selectCanvasView(): d3.Selection<SVGGElement, unknown, null, unknown>;
106
114
  selectCanvasElements(): d3.Selection<SVGGElement, unknown, null, unknown>;
107
115
  selectCanvasNodes(): d3.Selection<SVGGElement, unknown, null, unknown>;
@@ -109,6 +117,7 @@ export declare class DiagramCanvas implements Canvas {
109
117
  selectCanvasPorts(): d3.Selection<SVGGElement, unknown, null, unknown>;
110
118
  selectCanvasConnections(): d3.Selection<SVGGElement, unknown, null, unknown>;
111
119
  selectCanvasFields(): d3.Selection<SVGGElement, unknown, null, unknown>;
120
+ selectCanvasObjects(): d3.Selection<SVGGElement, unknown, null, unknown>;
112
121
  startConnection(port: DiagramPort): void;
113
122
  finishConnection(port: DiagramPort): void;
114
123
  dropConnection(): void;
@@ -117,11 +126,17 @@ export declare class DiagramCanvas implements Canvas {
117
126
  setPropertyEditorSelection(selection?: {
118
127
  valueSet: ValueSet;
119
128
  } & (DiagramElement | DiagramModel)): void;
129
+ private makeUpdateValuesAction;
120
130
  isInUserSelection(selection: DiagramElement): boolean;
121
131
  addToUserSelection(selection: DiagramElement): void;
122
132
  removeFromUserSelection(selection: DiagramElement): void;
123
133
  toggleUserSelection(selection: DiagramElement): void;
124
134
  clearUserSelection(): void;
135
+ deleteUserSelection(): void;
136
+ copyUserSelectionToClipboard(): void;
137
+ pasteUserSelectionFromClipboard(coords?: Point): void;
138
+ openContextMenu(event: MouseEvent): void;
139
+ closeContextMenu(): void;
125
140
  cancelAllUserActions(): void;
126
141
  canUserPerformAction(action: DiagramActions): boolean;
127
142
  private createInputField;
@@ -2,6 +2,7 @@ import { Canvas } from '../../interfaces/canvas';
2
2
  import { DiagramConnectionSet } from './diagram-connection';
3
3
  import { DiagramFieldSet } from './diagram-field';
4
4
  import { DiagramNodeSet } from './diagram-node';
5
+ import { DiagramObjectSet } from './diagram-object';
5
6
  import { DiagramPortSet } from './diagram-port';
6
7
  import { Property, ValueSet } from './diagram-property';
7
8
  import { DiagramSectionSet } from './diagram-section';
@@ -46,6 +47,12 @@ export declare class DiagramModel {
46
47
  * @public
47
48
  */
48
49
  fields: DiagramFieldSet;
50
+ /**
51
+ * Objects of this model.
52
+ * @see DiagramObject
53
+ * @public
54
+ */
55
+ objects: DiagramObjectSet;
49
56
  /**
50
57
  * Identifier of this diagram. Set by the consumer of the diagram.
51
58
  * @public
@@ -0,0 +1,52 @@
1
+ import { Point } from '../../util/canvas-util';
2
+ import { DiagramElement, DiagramEntitySet } from './diagram-element';
3
+ import { DiagramModel } from './diagram-model';
4
+ /**
5
+ * A foreign object which is inserted with arbitrary html into a diagram.
6
+ * Diagram objects are not serialized with other diagram elements.
7
+ * @public
8
+ */
9
+ export declare class DiagramObject extends DiagramElement {
10
+ /**
11
+ * Coordinates of this object.
12
+ * @public
13
+ */
14
+ coords: Point;
15
+ /**
16
+ * Dimension of this object along the x axis.
17
+ * @public
18
+ */
19
+ width: number;
20
+ /**
21
+ * Dimension of this object along the y axis.
22
+ * @public
23
+ */
24
+ height: number;
25
+ priority: number;
26
+ html: string;
27
+ constructor(model: DiagramModel, coords: Point, width: number, height: number, priority: number, html: string, id: string);
28
+ select(): d3.Selection<SVGGElement, unknown, null, unknown> | undefined;
29
+ get removed(): boolean;
30
+ updateInView(): void;
31
+ /**
32
+ * Change the coordinates of this object to the given coordinates.
33
+ * @public
34
+ * @param coords A point in the diagram.
35
+ */
36
+ move(coords: Point): void;
37
+ getPriority(): number;
38
+ }
39
+ export declare class DiagramObjectSet extends DiagramEntitySet<DiagramObject> {
40
+ private model;
41
+ /**
42
+ * Instance a set of objects for the given model. This method is used internally.
43
+ * @private
44
+ */
45
+ constructor(model: DiagramModel);
46
+ /**
47
+ * Instance a new object and add it to this set.
48
+ * @private
49
+ */
50
+ new(coords: Point, width: number, height: number, priority: number, html: string, id: string): DiagramObject;
51
+ remove(id: string): void;
52
+ }
@@ -140,6 +140,7 @@ export declare class PropertySet {
140
140
  propertyList: Property[];
141
141
  constructor(properties?: Property[]);
142
142
  getProperty(key: string): Property;
143
+ hasProperty(key: string): boolean;
143
144
  hasProperties(): boolean;
144
145
  }
145
146
  /**
@@ -327,12 +328,9 @@ export declare const diff: (a: {
327
328
  [key: string]: unknown;
328
329
  }, b: {
329
330
  [key: string]: unknown;
330
- }) => [
331
- {
332
- [key: string]: unknown;
333
- },
334
- {
335
- [key: string]: unknown;
336
- }
337
- ];
331
+ }) => [{
332
+ [key: string]: unknown;
333
+ }, {
334
+ [key: string]: unknown;
335
+ }];
338
336
  export declare const isObject: (x: unknown) => boolean;
@@ -98,6 +98,11 @@ export interface Canvas {
98
98
  * @public
99
99
  */
100
100
  diagramImportantChanges$: Subject<void>;
101
+ /**
102
+ * Subject for tracking changes in the property editor.
103
+ * @public
104
+ */
105
+ propertyEditorChanges$: Subject<void>;
101
106
  /**
102
107
  * Initializes the view of the diagram.
103
108
  * @private
@@ -140,12 +145,23 @@ export interface Canvas {
140
145
  * @param point A point.
141
146
  */
142
147
  getClosestGridPoint(point: Point): Point;
148
+ /**
149
+ * Get the coordinates in the diagram of the points of the screen at the top left and the bottom right of the diagram view.
150
+ * @public
151
+ */
152
+ getCoordinatesOnScreen(): [Point, Point];
143
153
  /**
144
154
  * Get the location of the pointer in the given event relative to the canvas.
145
155
  * @private
146
156
  * @param event A MouseEvent.
147
157
  */
148
158
  getPointerLocationRelativeToCanvas(event: MouseEvent): Point;
159
+ /**
160
+ * Get the location of the pointer in the given event relative to the svg element.
161
+ * @private
162
+ * @param event A MouseEvent.
163
+ */
164
+ getPointerLocationRelativeToRoot(event: MouseEvent): Point;
149
165
  /**
150
166
  * Get the location of the pointer in the given event relative to the body.
151
167
  * @private
@@ -214,6 +230,11 @@ export interface Canvas {
214
230
  * @public
215
231
  */
216
232
  updateFieldsInView(...ids: string[]): void;
233
+ /**
234
+ * Update the view of the canvas to show the current state of the objects.
235
+ * @public
236
+ */
237
+ updateObjectsInView(...ids: string[]): void;
217
238
  /**
218
239
  * Fit the root of a diagram field to encompass the totality of the field.
219
240
  * @param id The id of a diagram field
@@ -224,6 +245,11 @@ export interface Canvas {
224
245
  * @param id The id of a node
225
246
  */
226
247
  fitNodeInView(id: string): void;
248
+ /**
249
+ * Get the d3 Selection containing the svg root node of the canvas.
250
+ * @private
251
+ */
252
+ selectRoot(): d3.Selection<SVGElement, unknown, null, unknown>;
227
253
  /**
228
254
  * Get the d3 Selection containing the view of all the elements in the canvas.
229
255
  * @private
@@ -271,6 +297,31 @@ export interface Canvas {
271
297
  * @private
272
298
  */
273
299
  clearUserSelection(): void;
300
+ /**
301
+ * Removes all elements in the user selection from the canvas.
302
+ * @private
303
+ */
304
+ deleteUserSelection(): void;
305
+ /**
306
+ * Copies all elements in the user selection to the clipboard.
307
+ * @private
308
+ */
309
+ copyUserSelectionToClipboard(): void;
310
+ /**
311
+ * Pastes all elements in the clipboard to the model.
312
+ * @private
313
+ */
314
+ pasteUserSelectionFromClipboard(coords?: Point): void;
315
+ /**
316
+ * Opens the context menu based on the given event.
317
+ * @private
318
+ */
319
+ openContextMenu(event: MouseEvent): void;
320
+ /**
321
+ * Closes the context menu.
322
+ * @private
323
+ */
324
+ closeContextMenu(): void;
274
325
  /**
275
326
  * Stops all unfinished user actions to ensure there are no unfinished actions before performing a different action.
276
327
  * @public
@@ -6,15 +6,21 @@ export declare enum Events {
6
6
  Blur = "blur",
7
7
  Change = "change",
8
8
  Click = "click",
9
+ ContextMenu = "contextmenu",
9
10
  DoubleClick = "dblclick",
10
11
  Focus = "focus",
11
12
  FocusIn = "focusin",
12
13
  FocusOut = "focusout",
13
14
  Input = "input",
15
+ KeyDown = "keydown",
14
16
  KeyUp = "keyup",
17
+ MouseDown = "mousedown",
15
18
  MouseMove = "mousemove",
16
19
  MouseOut = "mouseout",
17
20
  MouseOver = "mouseover",
21
+ MouseUp = "mouseup",
22
+ TouchStart = "touchstart",
23
+ TouchEnd = "touchend",
18
24
  Wheel = "wheel"
19
25
  }
20
26
  /**
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.5.0",
4
+ "version": "1.5.2",
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",
@@ -18,12 +18,12 @@
18
18
  "angular"
19
19
  ],
20
20
  "peerDependencies": {
21
- "@angular/common": "^18.0.1",
22
- "@angular/core": "^18.0.1",
23
- "@angular/forms": "^18.0.1",
21
+ "@angular/common": "^18.2.2",
22
+ "@angular/core": "^18.2.2",
23
+ "@angular/forms": "^18.2.2",
24
24
  "d3": "^7.9.0",
25
25
  "rxjs": "~7.8.1",
26
- "uuid": "^9.0.0"
26
+ "uuid": "^10.0.0"
27
27
  },
28
28
  "sideEffects": false,
29
29
  "files": [