@metadev/daga 1.5.7 → 2.0.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.
Files changed (137) hide show
  1. package/Changelog.md +30 -1
  2. package/README.md +67 -30
  3. package/assets/daga-logo.svg +10 -0
  4. package/index.cjs.d.ts +1 -0
  5. package/index.cjs.default.js +1 -0
  6. package/index.cjs.js +8085 -0
  7. package/index.cjs.mjs +2 -0
  8. package/index.esm.d.ts +1 -0
  9. package/index.esm.js +7999 -0
  10. package/package.json +19 -37
  11. package/src/index.d.ts +49 -0
  12. package/src/lib/core.d.ts +1 -0
  13. package/{lib/diagram-editor/diagram → src/lib/diagram/canvas}/diagram-canvas.d.ts +69 -66
  14. package/src/lib/diagram/canvas/diagram-context-menu.d.ts +27 -0
  15. package/src/lib/diagram/canvas/diagram-user-highlight.d.ts +30 -0
  16. package/src/lib/diagram/canvas/diagram-user-selection.d.ts +74 -0
  17. package/{lib/diagram-editor → src/lib}/diagram/collab/collab-action.d.ts +36 -12
  18. package/{lib/diagram-editor → src/lib}/diagram/collab/collab-client.d.ts +1 -1
  19. package/{lib/diagram-editor → src/lib}/diagram/collab/collab-engine.d.ts +1 -1
  20. package/{lib/diagram-editor → src/lib}/diagram/collab/message-types.d.ts +3 -8
  21. package/{lib/diagram-editor → src/lib}/diagram/converters/daga-exporter.d.ts +6 -6
  22. package/{lib/diagram-editor → src/lib}/diagram/converters/daga-importer.d.ts +6 -4
  23. package/{lib/diagram-editor → src/lib}/diagram/converters/daga-model.d.ts +3 -3
  24. package/{lib/diagram-editor → src/lib}/diagram/converters/diagram-model-exporter.d.ts +2 -2
  25. package/{lib/diagram-editor → src/lib}/diagram/converters/diagram-model-importer.d.ts +2 -2
  26. package/{lib/diagram-editor → src/lib}/diagram/diagram-action.d.ts +75 -55
  27. package/{lib/diagram-editor → src/lib}/diagram/diagram-config.d.ts +139 -84
  28. package/{lib/diagram-editor → src/lib}/diagram/diagram-event.d.ts +3 -3
  29. package/{lib/diagram-editor → src/lib}/diagram/layout/adjacency-layout.d.ts +1 -1
  30. package/{lib/diagram-editor → src/lib}/diagram/layout/breadth-adjacency-layout.d.ts +1 -1
  31. package/{lib/diagram-editor → src/lib}/diagram/layout/breadth-layout.d.ts +1 -1
  32. package/{lib/diagram-editor → src/lib}/diagram/layout/diagram-layout.d.ts +1 -1
  33. package/{lib/diagram-editor → src/lib}/diagram/layout/force-layout.d.ts +1 -1
  34. package/{lib/diagram-editor → src/lib}/diagram/layout/horizontal-layout.d.ts +1 -1
  35. package/{lib/diagram-editor → src/lib}/diagram/layout/priority-layout.d.ts +1 -1
  36. package/{lib/diagram-editor → src/lib}/diagram/layout/tree-layout.d.ts +1 -1
  37. package/{lib/diagram-editor → src/lib}/diagram/layout/vertical-layout.d.ts +1 -1
  38. package/{lib/diagram-editor/diagram → src/lib/diagram/model}/diagram-connection.d.ts +4 -4
  39. package/{lib/diagram-editor/diagram → src/lib/diagram/model}/diagram-element.d.ts +7 -11
  40. package/{lib/diagram-editor/diagram → src/lib/diagram/model}/diagram-entity.d.ts +2 -2
  41. package/{lib/diagram-editor/diagram → src/lib/diagram/model}/diagram-field.d.ts +4 -4
  42. package/{lib/diagram-editor/diagram → src/lib/diagram/model}/diagram-model.d.ts +15 -15
  43. package/{lib/diagram-editor/diagram → src/lib/diagram/model}/diagram-node.d.ts +7 -7
  44. package/{lib/diagram-editor/diagram → src/lib/diagram/model}/diagram-property.d.ts +46 -31
  45. package/{lib/diagram-editor/diagram → src/lib/diagram/model}/diagram-section.d.ts +8 -8
  46. package/{lib → src/lib}/errors/diagram-validator.d.ts +1 -1
  47. package/{lib → src/lib}/interfaces/canvas.d.ts +79 -107
  48. package/{lib → src/lib}/interfaces/diagram-buttons.d.ts +8 -8
  49. package/{lib → src/lib}/interfaces/diagram-editor.d.ts +4 -11
  50. package/{lib → src/lib}/interfaces/palette.d.ts +2 -2
  51. package/{lib → src/lib}/interfaces/property-editor.d.ts +5 -5
  52. package/{lib → src/lib}/util/canvas-util.d.ts +20 -5
  53. package/src/lib/util/device-util.d.ts +5 -0
  54. package/{lib → src/lib}/util/events.d.ts +4 -4
  55. package/{lib → src/lib}/util/style.d.ts +1 -0
  56. package/src/lib/util/test-util.d.ts +11 -0
  57. package/assets/fonts/DMMono-Medium.ttf +0 -0
  58. package/assets/fonts/DMMono-Medium.woff +0 -0
  59. package/assets/fonts/DMMono-Medium.woff2 +0 -0
  60. package/assets/fonts/WonderUnitSans-Medium.ttf +0 -0
  61. package/assets/fonts/WonderUnitSans-Medium.woff +0 -0
  62. package/assets/fonts/WonderUnitSans-Medium.woff2 +0 -0
  63. package/assets/icon/action/drop-down-arrow.svg +0 -8
  64. package/assets/icon/action/drop-horizontal-left.svg +0 -14
  65. package/assets/icon/action/drop-horizontal-none.svg +0 -13
  66. package/assets/icon/action/drop-horizontal-right.svg +0 -14
  67. package/assets/icon/action/drop-vertical-down.svg +0 -14
  68. package/assets/icon/action/drop-vertical-none.svg +0 -13
  69. package/assets/icon/action/drop-vertical-up.svg +0 -14
  70. package/assets/icon/action/filter-clear.png +0 -0
  71. package/assets/icon/buttons/center-hover.svg +0 -10
  72. package/assets/icon/buttons/center.svg +0 -10
  73. package/assets/icon/buttons/ellipsis-hover.svg +0 -7
  74. package/assets/icon/buttons/ellipsis.svg +0 -7
  75. package/assets/icon/buttons/filter-off-hover.svg +0 -5
  76. package/assets/icon/buttons/filter-off.svg +0 -5
  77. package/assets/icon/buttons/filter-on-hover.svg +0 -5
  78. package/assets/icon/buttons/filter-on.svg +0 -5
  79. package/assets/icon/buttons/layout-hover.svg +0 -8
  80. package/assets/icon/buttons/layout.svg +0 -8
  81. package/assets/icon/buttons/redo-hover.svg +0 -5
  82. package/assets/icon/buttons/redo.svg +0 -5
  83. package/assets/icon/buttons/undo-hover.svg +0 -5
  84. package/assets/icon/buttons/undo.svg +0 -5
  85. package/assets/icon/buttons/zoom-in-hover.svg +0 -8
  86. package/assets/icon/buttons/zoom-in.svg +0 -8
  87. package/assets/icon/buttons/zoom-out-hover.svg +0 -7
  88. package/assets/icon/buttons/zoom-out.svg +0 -7
  89. package/assets/icon/context/copy.svg +0 -4
  90. package/assets/icon/context/cross.svg +0 -3
  91. package/assets/icon/context/cut.svg +0 -4
  92. package/assets/icon/context/delete.svg +0 -4
  93. package/assets/icon/context/paste.svg +0 -4
  94. package/assets/icon/property/add.svg +0 -23
  95. package/assets/icon/property/close.svg +0 -3
  96. package/assets/icon/property/ellipsis.svg +0 -5
  97. package/assets/icon/property/gear.svg +0 -3
  98. package/assets/icon/property/hide.svg +0 -10
  99. package/assets/icon/property/move.svg +0 -35
  100. package/assets/styles/_collapse-button.scss +0 -37
  101. package/assets/styles/_context-menu.scss +0 -32
  102. package/assets/styles/_diagram-buttons.scss +0 -166
  103. package/assets/styles/_diagram.scss +0 -15
  104. package/assets/styles/_errors.scss +0 -83
  105. package/assets/styles/_palette.scss +0 -20
  106. package/assets/styles/_property-editor.scss +0 -285
  107. package/assets/styles/daga.scss +0 -150
  108. package/fesm2022/metadev-daga.mjs +0 -10977
  109. package/fesm2022/metadev-daga.mjs.map +0 -1
  110. package/index.d.ts +0 -55
  111. package/lib/collapse-button/collapse-button.component.d.ts +0 -22
  112. package/lib/daga.module.d.ts +0 -18
  113. package/lib/diagram/diagram.component.d.ts +0 -44
  114. package/lib/diagram-buttons/diagram-buttons.component.d.ts +0 -44
  115. package/lib/diagram-editor/diagram-editor.component.d.ts +0 -38
  116. package/lib/errors/errors.component.d.ts +0 -26
  117. package/lib/palette/palette.component.d.ts +0 -39
  118. package/lib/property-editor/autocomplete/autocomplete.component.d.ts +0 -39
  119. package/lib/property-editor/object-editor/object-editor.component.d.ts +0 -30
  120. package/lib/property-editor/option-list-editor/option-list-editor.component.d.ts +0 -33
  121. package/lib/property-editor/property-editor.component.d.ts +0 -34
  122. package/lib/property-editor/property-settings/property-settings.component.d.ts +0 -35
  123. package/lib/property-editor/text-list-editor/text-list-editor.component.d.ts +0 -29
  124. package/lib/property-editor/text-map-editor/text-map-editor.component.d.ts +0 -36
  125. package/lib/services/canvas-provider.service.d.ts +0 -32
  126. package/lib/services/daga-configuration.service.d.ts +0 -23
  127. package/{lib/diagram-editor → src/lib}/diagram/collab/primitives.d.ts +0 -0
  128. package/{lib/diagram-editor/diagram → src/lib/diagram/model}/diagram-decorator.d.ts +1 -1
  129. package/{lib/diagram-editor/diagram → src/lib/diagram/model}/diagram-object.d.ts +0 -0
  130. package/{lib/diagram-editor/diagram → src/lib/diagram/model}/diagram-port.d.ts +2 -2
  131. package/{lib → src/lib}/errors/diagram-error.d.ts +3 -3
  132. package/{lib → src/lib}/util/grid.d.ts +0 -0
  133. package/{lib → src/lib}/util/line.d.ts +0 -0
  134. package/{lib → src/lib}/util/list-util.d.ts +0 -0
  135. package/{lib → src/lib}/util/shape.d.ts +10 -10
  136. /package/{lib → src/lib}/util/svg-util.d.ts +0 -0
  137. /package/{lib → src/lib}/util/text-util.d.ts +0 -0
@@ -1,11 +1,13 @@
1
1
  import { Subject } from 'rxjs';
2
- import { CollabEngine } from '../diagram-editor/diagram/collab/collab-engine';
3
- import { ActionQueue, DiagramActions } from '../diagram-editor/diagram/diagram-action';
4
- import { UserActionConfig } from '../diagram-editor/diagram/diagram-config';
5
- import { DiagramConnectionType } from '../diagram-editor/diagram/diagram-connection';
6
- import { DiagramElement } from '../diagram-editor/diagram/diagram-element';
7
- import { DiagramModel } from '../diagram-editor/diagram/diagram-model';
8
- import { ValueSet } from '../diagram-editor/diagram/diagram-property';
2
+ import { DiagramContextMenu } from '../diagram/canvas/diagram-context-menu';
3
+ import { DiagramUserHighlight } from '../diagram/canvas/diagram-user-highlight';
4
+ import { DiagramUserSelection } from '../diagram/canvas/diagram-user-selection';
5
+ import { CollabEngine } from '../diagram/collab/collab-engine';
6
+ import { ActionStack, DiagramActions } from '../diagram/diagram-action';
7
+ import { UserActionConfig } from '../diagram/diagram-config';
8
+ import { DiagramEvent } from '../diagram/diagram-event';
9
+ import { DiagramConnectionType } from '../diagram/model/diagram-connection';
10
+ import { DiagramModel } from '../diagram/model/diagram-model';
9
11
  import { DiagramValidator } from '../errors/diagram-validator';
10
12
  import { Point } from '../util/canvas-util';
11
13
  import { DiagramEditor } from './diagram-editor';
@@ -19,32 +21,81 @@ export interface Canvas {
19
21
  * Parent component of the diagram.
20
22
  * @private
21
23
  */
22
- parentComponent: DiagramEditor;
24
+ readonly parentComponent: DiagramEditor;
23
25
  /**
24
26
  * Object that contains the data of the elements of the diagram.
25
27
  * @public
26
28
  */
27
- model: DiagramModel;
29
+ readonly model: DiagramModel;
30
+ /**
31
+ * Object that contains the functionality related to the user selection.
32
+ * @public
33
+ */
34
+ readonly userSelection: DiagramUserSelection;
35
+ /**
36
+ * Object that contains the functionality related to the user highlight.
37
+ * @public
38
+ */
39
+ readonly userHighlight: DiagramUserHighlight;
40
+ /**
41
+ * Object that contains the functionality related to the context menu.
42
+ * @public
43
+ */
44
+ readonly contextMenu: DiagramContextMenu;
45
+ /**
46
+ * The stack of actions performed by the user used to keep track of what actions can be undone or redone.
47
+ * @private
48
+ */
49
+ readonly actionStack: ActionStack;
50
+ /**
51
+ * Engine that implements collaborative actions.
52
+ * @private
53
+ */
54
+ readonly collabEngine: CollabEngine;
28
55
  /**
29
56
  * Background color of the diagram.
30
57
  * @public
31
58
  */
32
59
  backgroundColor: string;
33
60
  /**
34
- * Distance between the grid points of the diagram.
61
+ * Distance between the grid points of the diagram in diagram units.
35
62
  * @public
36
63
  */
37
64
  gridSize: number;
65
+ /**
66
+ * Size of the grid points of the diagram relative to the distance between grid points in diagram units.
67
+ * @public
68
+ */
69
+ gridThickness: number;
70
+ /**
71
+ * Color of the grid elements of the diagram.
72
+ * @public
73
+ */
74
+ gridColor: string;
38
75
  /**
39
76
  * If true, elements moved by the user should be placed on the closest grid point rather than the exact point where they were placed.
40
77
  * @public
41
78
  */
42
79
  snapToGrid: boolean;
80
+ /**
81
+ * The factor by which the zoom level increases or decreases when the user users buttons or keys to zoom in or out. Should be above 1.
82
+ * @public
83
+ */
84
+ zoomFactor: number;
85
+ /**
86
+ * The rate by which the view of the canvas moves when the user users buttons or keys to pan at a default zoom level in diagram units. Should be above 1.
87
+ * @public
88
+ */
89
+ panRate: number;
43
90
  /**
44
91
  * If true, new connections should have the type that makes most sense even if it's not the currently chosen type.
45
92
  * @public
46
93
  */
47
- guessConnectionType: boolean;
94
+ inferConnectionType: boolean;
95
+ /**
96
+ * If true, the next drag action will create a multiple selection rectangle.
97
+ */
98
+ multipleSelectionOn: boolean;
48
99
  /**
49
100
  * When a new connection is made, it should have this type.
50
101
  * @public
@@ -55,54 +106,49 @@ export interface Canvas {
55
106
  * @public
56
107
  */
57
108
  layoutFormat?: string;
58
- /**
59
- * Mapping of what actions the user is allowed to perform. Absent values are assumed to be `true`.
60
- * @public
61
- */
62
- userActions: UserActionConfig;
63
109
  /**
64
110
  * The list of validators used to check for errors in this canvas.
65
111
  * @private
66
112
  */
67
113
  validators: DiagramValidator[];
68
114
  /**
69
- * The queue of actions used to keep track of what actions can be undone or redone.
70
- * @private
71
- */
72
- actionQueue: ActionQueue;
73
- /**
74
- * Engine that implements collaborative actions.
75
- * @private
115
+ * Mapping of what actions the user is allowed to perform. Absent values are assumed to be allowed.
116
+ * @public
76
117
  */
77
- collabEngine: CollabEngine;
118
+ userActions: UserActionConfig;
78
119
  /**
79
120
  * Subject for tracking when the canvas' view is initialized.
80
121
  * @public
81
122
  */
82
- viewInitialized$: Subject<void>;
123
+ readonly viewInitialized$: Subject<void>;
83
124
  /**
84
125
  * Subject for tracking when validators are added to or removed from the canvas.
85
126
  * @public
86
127
  */
87
- validatorChanges$: Subject<void>;
128
+ readonly validatorChange$: Subject<void>;
88
129
  /**
89
130
  * Subject for tracking changes in the diagram.
90
131
  * Used to detect if there have been changes over a period of time.
91
132
  * Values are sent when the user performs changes on the diagram, but not when the changes are performed programmatically.
92
133
  * @public
93
134
  */
94
- diagramChanges$: Subject<void>;
135
+ readonly diagramChange$: Subject<void>;
95
136
  /**
96
137
  * Subject for tracking the presence of important changes in the diagram.
97
138
  * Used to detect if there are any changes that require immediate handling.
98
139
  * @public
99
140
  */
100
- diagramImportantChanges$: Subject<void>;
141
+ readonly diagramImportantChange$: Subject<void>;
101
142
  /**
102
143
  * Subject for tracking changes in the property editor.
103
144
  * @public
104
145
  */
105
- propertyEditorChanges$: Subject<void>;
146
+ readonly propertyEditorChanges$: Subject<void>;
147
+ /**
148
+ * Subject for tracking user events in the diagram.
149
+ * @public
150
+ */
151
+ readonly diagramEvent$: Subject<DiagramEvent>;
106
152
  /**
107
153
  * Initializes the view of the diagram.
108
154
  * @private
@@ -111,15 +157,15 @@ export interface Canvas {
111
157
  /**
112
158
  * Increases the zoom level by the given factor.
113
159
  * @public
114
- * @param zoom A factor of zoom.
160
+ * @param factor A factor of zoom.
115
161
  */
116
- zoomBy(zoom: number): void;
162
+ zoomBy(factor: number): void;
117
163
  /**
118
164
  * Changes the zoom level to a given level.
119
165
  * @public
120
- * @param zoom A level of zoom.
166
+ * @param level A level of zoom.
121
167
  */
122
- zoomTo(zoom: number): void;
168
+ zoomTo(level: number): void;
123
169
  /**
124
170
  * Translates the view by the given amount.
125
171
  * @public
@@ -260,73 +306,6 @@ export interface Canvas {
260
306
  * @private
261
307
  */
262
308
  selectCanvasView(): d3.Selection<SVGGElement, unknown, null, unknown>;
263
- /**
264
- * Highlight the given diagram element in the canvas view and all the elements which depend on it.
265
- * Highlighting an element unhighlights the previously highlighted elements.
266
- * @private
267
- * @param element A diagram element.
268
- */
269
- highlight(element: DiagramElement): void;
270
- /**
271
- * Unhighlights all diagram elements.
272
- * @private
273
- */
274
- unhighlight(): void;
275
- /**
276
- * Checks if the given diagram element is in the current user selection.
277
- * @private
278
- * @param selection A diagram element.
279
- */
280
- isInUserSelection(selection: DiagramElement): boolean;
281
- /**
282
- * Adds the given diagram element to the current user selection.
283
- * @private
284
- * @param selection A diagram element.
285
- */
286
- addToUserSelection(selection: DiagramElement): void;
287
- /**
288
- * Removes the given diagram element from the current user selection.
289
- * @private
290
- * @param selection A diagram element.
291
- */
292
- removeFromUserSelection(selection: DiagramElement): void;
293
- /**
294
- * Adds the given diagram element to the current user selection if it's not in the current user selection.
295
- * If it is part of the current user selection, removes it from the current user selection.
296
- * @private
297
- * @param selection A diagram element.
298
- */
299
- toggleUserSelection(selection: DiagramElement): void;
300
- /**
301
- * Removes all elements from the current user selection.
302
- * @private
303
- */
304
- clearUserSelection(): void;
305
- /**
306
- * Removes all elements in the user selection from the canvas.
307
- * @private
308
- */
309
- deleteUserSelection(): void;
310
- /**
311
- * Copies all elements in the user selection to the clipboard.
312
- * @private
313
- */
314
- copyUserSelectionToClipboard(): void;
315
- /**
316
- * Pastes all elements in the clipboard to the model.
317
- * @private
318
- */
319
- pasteUserSelectionFromClipboard(coords?: Point): void;
320
- /**
321
- * Opens the context menu based on the given event.
322
- * @private
323
- */
324
- openContextMenu(event: MouseEvent): void;
325
- /**
326
- * Closes the context menu.
327
- * @private
328
- */
329
- closeContextMenu(): void;
330
309
  /**
331
310
  * Stops all unfinished user actions to ensure there are no unfinished actions before performing a different action.
332
311
  * @public
@@ -337,11 +316,4 @@ export interface Canvas {
337
316
  * @public
338
317
  */
339
318
  canUserPerformAction(action: DiagramActions): boolean;
340
- /**
341
- * Sets the diagram element whose ValueSet is being displayed in the value set editor.
342
- * @private
343
- */
344
- setPropertyEditorSelection(selection?: {
345
- valueSet: ValueSet;
346
- } & (DiagramElement | DiagramModel)): void;
347
319
  }
@@ -1,41 +1,41 @@
1
1
  /**
2
2
  * General canvas commands for zooming and filtering used by the buttons of the diagram's user interface.
3
- * @private
3
+ * @public
4
4
  */
5
5
  export interface DiagramButtons {
6
6
  /**
7
7
  * Increase the zoom level of the diagram by this component's zoom rate.
8
- * @private
8
+ * @public
9
9
  */
10
10
  zoomIn(): void;
11
11
  /**
12
12
  * Decrease the zoom level of the diagram by this component's zoom rate.
13
- * @private
13
+ * @public
14
14
  */
15
15
  zoomOut(): void;
16
16
  /**
17
17
  * Center the view of the diagram.
18
- * @private
18
+ * @public
19
19
  */
20
20
  center(): void;
21
21
  /**
22
22
  * Apply the diagram's current layout if applicable.
23
- * @private
23
+ * @public
24
24
  */
25
25
  layout(): void;
26
26
  /**
27
27
  * Change the current priority threshold of the canvas, hide any nodes with a priority below the threshold and recalculate the diagram's layout.
28
- * @private
28
+ * @public
29
29
  */
30
30
  filter(): void;
31
31
  /**
32
32
  * Undo the latest user change in the diagram.
33
- * @private
33
+ * @public
34
34
  */
35
35
  undo(): void;
36
36
  /**
37
37
  * Redo the latest undone user change in the diagram.
38
- * @private
38
+ * @public
39
39
  */
40
40
  redo(): void;
41
41
  }
@@ -1,31 +1,24 @@
1
- import { EventEmitter } from '@angular/core';
2
1
  import { DiagramButtons } from './diagram-buttons';
3
2
  import { Palette } from './palette';
4
3
  import { PropertyEditor } from './property-editor';
5
- import { DiagramEvent } from '../diagram-editor/diagram/diagram-event';
6
4
  /**
7
5
  * Exposes the components of the diagram editor.
8
- * @private
6
+ * @public
9
7
  */
10
8
  export interface DiagramEditor {
11
9
  /**
12
10
  * Diagram buttons component of the diagram editor.
13
- * @private
11
+ * @public
14
12
  */
15
13
  diagramButtons: DiagramButtons;
16
14
  /**
17
15
  * Palette component of the diagram editor.
18
- * @private
16
+ * @public
19
17
  */
20
18
  palette: Palette;
21
19
  /**
22
20
  * Property editor component of the diagram editor.
23
- * @private
21
+ * @public
24
22
  */
25
23
  propertyEditor: PropertyEditor;
26
- /**
27
- * Event emitter of user actions taken on the diagram.
28
- * @private
29
- */
30
- modelEvent: EventEmitter<DiagramEvent>;
31
24
  }
@@ -1,12 +1,12 @@
1
1
  /**
2
2
  * Exposes the commands of the palette component.
3
- * @private
3
+ * @public
4
4
  */
5
5
  export interface Palette {
6
6
  /**
7
7
  * Refresh the current items being displayed in the palette.
8
8
  * Used when it is necessary to update the contents of the palette but the state of the palette doesn't change.
9
- * @private
9
+ * @public
10
10
  */
11
11
  refreshPalette(): void;
12
12
  }
@@ -1,22 +1,22 @@
1
- import { ValueSet } from '../diagram-editor/diagram/diagram-property';
1
+ import { ValueSet } from '../diagram/model/diagram-property';
2
2
  /**
3
3
  * Exposes the commands of the property editor component.
4
- * @private
4
+ * @public
5
5
  */
6
6
  export interface PropertyEditor {
7
7
  /**
8
8
  * Title of the ValueSet displayed in the UI.
9
- * @private
9
+ * @public
10
10
  */
11
11
  title?: string;
12
12
  /**
13
13
  * ValueSet being edited in this component by the user.
14
- * @private
14
+ * @public
15
15
  */
16
16
  valueSet?: ValueSet;
17
17
  /**
18
18
  * Highlight the property given by the list of keys it can be found under.
19
- * @private
19
+ * @public
20
20
  * @param propertyNames The keys under which a property can be found in the ValueSet being edited in this component.
21
21
  */
22
22
  highlightProperty(...propertyNames: string[]): void;
@@ -1,20 +1,20 @@
1
1
  import { Side } from './svg-util';
2
2
  /**
3
3
  * A point on a canvas defined as its coordinates along the x and y axes.
4
- * @see DiagramCanvas
5
4
  * @public
5
+ * @see DiagramCanvas
6
6
  */
7
7
  export type Point = [number, number];
8
8
  /**
9
9
  * A line on a canvas defined as its start point and end point.
10
- * @see DiagramCanvas
11
10
  * @public
11
+ * @see DiagramCanvas
12
12
  */
13
13
  export type Line = [Point, Point];
14
14
  /**
15
15
  * A rectangle on a canvas defined as the points of its opposite corners.
16
- * @see DiagramCanvas
17
16
  * @public
17
+ * @see DiagramCanvas
18
18
  */
19
19
  export type Rectangle = [Point, Point];
20
20
  /**
@@ -32,7 +32,7 @@ export declare const roundPoint: (point: Point) => Point;
32
32
  * @param end A coordinate determine one of the extremes in the range.
33
33
  * @returns `true` if the given coordinate is in the given range; `false` otherwise.
34
34
  */
35
- export declare const between: (coordinate: number, start: number, end: number) => boolean;
35
+ export declare const isBetweenCoordinates: (coordinate: number, start: number, end: number) => boolean;
36
36
  /**
37
37
  * Moves the given coordinate according to the given changes in coordinates.
38
38
  * @public
@@ -69,7 +69,7 @@ export declare const movePoint: (point: Point, direction: Side, distance: number
69
69
  * @param point2 A point.
70
70
  * @returns `true` if the two points have the same coordinates; `false` otherwise.
71
71
  */
72
- export declare const equals: (point1: Point, point2: Point) => boolean;
72
+ export declare const pointsEqual: (point1: Point, point2: Point) => boolean;
73
73
  /**
74
74
  * Calculates the euclidean distance between two points.
75
75
  * @public
@@ -78,6 +78,13 @@ export declare const equals: (point1: Point, point2: Point) => boolean;
78
78
  * @returns The euclidean distance between the given points.
79
79
  */
80
80
  export declare const distanceBetweenPoints: (point1: Point, point2: Point) => number;
81
+ /**
82
+ * Calculates the slope of the line as the ratio between the increase of the second coordinate and the increase of the first coordinate.
83
+ * @public
84
+ * @param line A line.
85
+ * @returns The ratio between the increase of the second coordinate and the increase of the first coordinate. `Infinity` if the increase of the first coordiante is zero. `NaN` if the line is a point.
86
+ */
87
+ export declare const slope: (line: Line) => number;
81
88
  /**
82
89
  * Checks whether the given point is inside the given line.
83
90
  * @public
@@ -118,3 +125,11 @@ export declare const linesOverlap: (line1: Line, line2: Line) => boolean;
118
125
  * @returns `true` if the line intersects with the rectangle; `false` otherwise.
119
126
  */
120
127
  export declare const lineIntersectsRectangle: (line: Line, rectangle: Rectangle) => boolean;
128
+ /**
129
+ * Checks whether the two given reactangles share at least one point.
130
+ * @public
131
+ * @param rectangle1 A rectangle.
132
+ * @param rectangle2 A rectangle.
133
+ * @returns `true` if the rectangles intersect; `false` otherwise.
134
+ */
135
+ export declare const rectanglesIntersect: (rectangle1: Rectangle, rectangle2: Rectangle) => boolean;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Detects if the current device is a touchscreen.
3
+ * @returns `true` if the current device is a touchscreen, `false` otherwise.
4
+ */
5
+ export declare const isTouchscreen: () => boolean;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * User events.
3
- * @private
3
+ * @public
4
4
  */
5
5
  export declare enum Events {
6
6
  Blur = "blur",
@@ -25,7 +25,7 @@ export declare enum Events {
25
25
  }
26
26
  /**
27
27
  * Keys in keyboard events.
28
- * @private
28
+ * @public
29
29
  */
30
30
  export declare enum Keys {
31
31
  Alt = "Alt",
@@ -49,7 +49,7 @@ export declare enum Keys {
49
49
  }
50
50
  /**
51
51
  * Types of events used by D3's drag functionality.
52
- * @private
52
+ * @public
53
53
  */
54
54
  export declare enum DragEvents {
55
55
  Drag = "drag",
@@ -58,7 +58,7 @@ export declare enum DragEvents {
58
58
  }
59
59
  /**
60
60
  * Types of events used by D3's zoom functionality.
61
- * @private
61
+ * @public
62
62
  */
63
63
  export declare enum ZoomEvents {
64
64
  Zoom = "zoom",
@@ -1,6 +1,7 @@
1
1
  export declare enum CursorStyle {
2
2
  AllScroll = "all-scroll",
3
3
  Auto = "auto",
4
+ Crosshair = "crosshair",
4
5
  EWResize = "ew-resize",
5
6
  Grab = "grab",
6
7
  Grabbing = "grabbing",
@@ -0,0 +1,11 @@
1
+ import { DiagramConfig } from '../diagram/diagram-config';
2
+ /**
3
+ * Creates the structuredClone function if it doesn't exist.
4
+ * @private
5
+ */
6
+ export declare const createStructuredClone: () => void;
7
+ /**
8
+ * Generic diagram configuration used for testing.
9
+ * @private
10
+ */
11
+ export declare const GENERIC_DIAGRAM_CONFIG: DiagramConfig;
Binary file
Binary file
Binary file
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
- <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
- width="255px" height="255px" viewBox="0 0 255 255" style="enable-background:new 0 0 255 255;" xml:space="preserve">
5
- <g id="arrow-drop-down">
6
- <polygon points="0,63.75 127.5,191.25 255,63.75"/>
7
- </g>
8
- </svg>
@@ -1,14 +0,0 @@
1
- <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
2
- <path
3
- d="
4
- M 15 1
5
- L 9 12
6
- L 15 23
7
- "
8
- fill="none"
9
- stroke="#C1CDD9"
10
- stroke-width="2"
11
- stroke-linecap="round"
12
- stroke-linejoin="round"
13
- />
14
- </svg>
@@ -1,13 +0,0 @@
1
- <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
2
- <path
3
- d="
4
- M 12 1
5
- L 12 23
6
- "
7
- fill="none"
8
- stroke="#C1CDD9"
9
- stroke-width="2"
10
- stroke-linecap="round"
11
- stroke-linejoin="round"
12
- />
13
- </svg>
@@ -1,14 +0,0 @@
1
- <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
2
- <path
3
- d="
4
- M 9 1
5
- L 15 12
6
- L 9 23
7
- "
8
- fill="none"
9
- stroke="#C1CDD9"
10
- stroke-width="2"
11
- stroke-linecap="round"
12
- stroke-linejoin="round"
13
- />
14
- </svg>
@@ -1,14 +0,0 @@
1
- <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
2
- <path
3
- d="
4
- M 1 9
5
- L 12 15
6
- L 23 9
7
- "
8
- fill="none"
9
- stroke="#C1CDD9"
10
- stroke-width="2"
11
- stroke-linecap="round"
12
- stroke-linejoin="round"
13
- />
14
- </svg>
@@ -1,13 +0,0 @@
1
- <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
2
- <path
3
- d="
4
- M 1 12
5
- L 23 12
6
- "
7
- fill="none"
8
- stroke="#C1CDD9"
9
- stroke-width="2"
10
- stroke-linecap="round"
11
- stroke-linejoin="round"
12
- />
13
- </svg>
@@ -1,14 +0,0 @@
1
- <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
2
- <path
3
- d="
4
- M 1 15
5
- L 12 9
6
- L 23 15
7
- "
8
- fill="none"
9
- stroke="#C1CDD9"
10
- stroke-width="2"
11
- stroke-linecap="round"
12
- stroke-linejoin="round"
13
- />
14
- </svg>
Binary file
@@ -1,10 +0,0 @@
1
- <svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <rect x="0.5" y="0.5" width="47" height="47" rx="23.5" fill="#F5F5F5"/>
3
- <circle cx="24" cy="24" r="7" stroke="#33363F" stroke-width="2"/>
4
- <circle cx="24" cy="24" r="2" fill="#33363F" stroke="#33363F" stroke-width="2"/>
5
- <path d="M24 17V13" stroke="#33363F" stroke-width="2" stroke-linecap="round"/>
6
- <path d="M31 24L35 24" stroke="#33363F" stroke-width="2" stroke-linecap="round"/>
7
- <path d="M24 35L24 31" stroke="#33363F" stroke-width="2" stroke-linecap="round"/>
8
- <path d="M13 24H17" stroke="#33363F" stroke-width="2" stroke-linecap="round"/>
9
- <rect x="0.5" y="0.5" width="47" height="47" rx="23.5" stroke="#E5E5E5"/>
10
- </svg>