@api-client/ui 0.2.2 → 0.2.3

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 (170) hide show
  1. package/package.json +7 -2
  2. package/test/env.ts +15 -0
  3. package/test/tsconfig.json +1 -7
  4. package/web-test-runner.config.js +5 -1
  5. package/build/src/visualization/elements/VizAssociationElement.d.ts +0 -4
  6. package/build/src/visualization/elements/VizAssociationElement.d.ts.map +0 -1
  7. package/build/src/visualization/elements/VizAssociationElement.js +0 -4
  8. package/build/src/visualization/elements/VizAssociationElement.js.map +0 -1
  9. package/build/src/visualization/elements/VizWorkspaceElement.d.ts +0 -110
  10. package/build/src/visualization/elements/VizWorkspaceElement.d.ts.map +0 -1
  11. package/build/src/visualization/elements/VizWorkspaceElement.js +0 -321
  12. package/build/src/visualization/elements/VizWorkspaceElement.js.map +0 -1
  13. package/build/src/visualization/elements/WorkspaceStyles.d.ts +0 -3
  14. package/build/src/visualization/elements/WorkspaceStyles.d.ts.map +0 -1
  15. package/build/src/visualization/elements/WorkspaceStyles.js +0 -168
  16. package/build/src/visualization/elements/WorkspaceStyles.js.map +0 -1
  17. package/build/src/visualization/lib/AnchorFinder.d.ts +0 -64
  18. package/build/src/visualization/lib/AnchorFinder.d.ts.map +0 -1
  19. package/build/src/visualization/lib/AnchorFinder.js +0 -107
  20. package/build/src/visualization/lib/AnchorFinder.js.map +0 -1
  21. package/build/src/visualization/lib/AnchorUtils.d.ts +0 -10
  22. package/build/src/visualization/lib/AnchorUtils.d.ts.map +0 -1
  23. package/build/src/visualization/lib/AnchorUtils.js +0 -44
  24. package/build/src/visualization/lib/AnchorUtils.js.map +0 -1
  25. package/build/src/visualization/lib/AssociationAnchors.d.ts +0 -134
  26. package/build/src/visualization/lib/AssociationAnchors.d.ts.map +0 -1
  27. package/build/src/visualization/lib/AssociationAnchors.js +0 -351
  28. package/build/src/visualization/lib/AssociationAnchors.js.map +0 -1
  29. package/build/src/visualization/lib/LabelSketch.d.ts +0 -16
  30. package/build/src/visualization/lib/LabelSketch.d.ts.map +0 -1
  31. package/build/src/visualization/lib/LabelSketch.js +0 -53
  32. package/build/src/visualization/lib/LabelSketch.js.map +0 -1
  33. package/build/src/visualization/lib/LineSketch.d.ts +0 -26
  34. package/build/src/visualization/lib/LineSketch.d.ts.map +0 -1
  35. package/build/src/visualization/lib/LineSketch.js +0 -55
  36. package/build/src/visualization/lib/LineSketch.js.map +0 -1
  37. package/build/src/visualization/lib/Point.d.ts +0 -74
  38. package/build/src/visualization/lib/Point.d.ts.map +0 -1
  39. package/build/src/visualization/lib/Point.js +0 -121
  40. package/build/src/visualization/lib/Point.js.map +0 -1
  41. package/build/src/visualization/lib/PositionUtils.d.ts +0 -65
  42. package/build/src/visualization/lib/PositionUtils.d.ts.map +0 -1
  43. package/build/src/visualization/lib/PositionUtils.js +0 -205
  44. package/build/src/visualization/lib/PositionUtils.js.map +0 -1
  45. package/build/src/visualization/lib/SelectionManager.d.ts +0 -183
  46. package/build/src/visualization/lib/SelectionManager.d.ts.map +0 -1
  47. package/build/src/visualization/lib/SelectionManager.js +0 -481
  48. package/build/src/visualization/lib/SelectionManager.js.map +0 -1
  49. package/build/src/visualization/lib/ShapeArtist.d.ts +0 -45
  50. package/build/src/visualization/lib/ShapeArtist.d.ts.map +0 -1
  51. package/build/src/visualization/lib/ShapeArtist.js +0 -209
  52. package/build/src/visualization/lib/ShapeArtist.js.map +0 -1
  53. package/build/src/visualization/lib/SvgMarkers.d.ts +0 -14
  54. package/build/src/visualization/lib/SvgMarkers.d.ts.map +0 -1
  55. package/build/src/visualization/lib/SvgMarkers.js +0 -77
  56. package/build/src/visualization/lib/SvgMarkers.js.map +0 -1
  57. package/build/src/visualization/lib/TipSketch.d.ts +0 -26
  58. package/build/src/visualization/lib/TipSketch.d.ts.map +0 -1
  59. package/build/src/visualization/lib/TipSketch.js +0 -77
  60. package/build/src/visualization/lib/TipSketch.js.map +0 -1
  61. package/build/src/visualization/lib/TouchSupport.d.ts +0 -14
  62. package/build/src/visualization/lib/TouchSupport.d.ts.map +0 -1
  63. package/build/src/visualization/lib/TouchSupport.js +0 -55
  64. package/build/src/visualization/lib/TouchSupport.js.map +0 -1
  65. package/build/src/visualization/lib/Utils.d.ts +0 -25
  66. package/build/src/visualization/lib/Utils.d.ts.map +0 -1
  67. package/build/src/visualization/lib/Utils.js +0 -59
  68. package/build/src/visualization/lib/Utils.js.map +0 -1
  69. package/build/src/visualization/lib/VisualizationTypes.d.ts +0 -216
  70. package/build/src/visualization/lib/VisualizationTypes.d.ts.map +0 -1
  71. package/build/src/visualization/lib/VisualizationTypes.js +0 -3
  72. package/build/src/visualization/lib/VisualizationTypes.js.map +0 -1
  73. package/build/src/visualization/lib/WorkspaceAlignment.d.ts +0 -51
  74. package/build/src/visualization/lib/WorkspaceAlignment.d.ts.map +0 -1
  75. package/build/src/visualization/lib/WorkspaceAlignment.js +0 -243
  76. package/build/src/visualization/lib/WorkspaceAlignment.js.map +0 -1
  77. package/build/src/visualization/lib/WorkspaceDebugging.d.ts +0 -104
  78. package/build/src/visualization/lib/WorkspaceDebugging.d.ts.map +0 -1
  79. package/build/src/visualization/lib/WorkspaceDebugging.js +0 -286
  80. package/build/src/visualization/lib/WorkspaceDebugging.js.map +0 -1
  81. package/build/src/visualization/lib/WorkspaceEdges.d.ts +0 -293
  82. package/build/src/visualization/lib/WorkspaceEdges.d.ts.map +0 -1
  83. package/build/src/visualization/lib/WorkspaceEdges.js +0 -1073
  84. package/build/src/visualization/lib/WorkspaceEdges.js.map +0 -1
  85. package/build/src/visualization/lib/WorkspaceGestures.d.ts +0 -119
  86. package/build/src/visualization/lib/WorkspaceGestures.d.ts.map +0 -1
  87. package/build/src/visualization/lib/WorkspaceGestures.js +0 -376
  88. package/build/src/visualization/lib/WorkspaceGestures.js.map +0 -1
  89. package/build/src/visualization/lib/WorkspaceSizing.d.ts +0 -66
  90. package/build/src/visualization/lib/WorkspaceSizing.d.ts.map +0 -1
  91. package/build/src/visualization/lib/WorkspaceSizing.js +0 -168
  92. package/build/src/visualization/lib/WorkspaceSizing.js.map +0 -1
  93. package/build/src/visualization/lib/lines/RectilinearLine.d.ts +0 -114
  94. package/build/src/visualization/lib/lines/RectilinearLine.d.ts.map +0 -1
  95. package/build/src/visualization/lib/lines/RectilinearLine.js +0 -605
  96. package/build/src/visualization/lib/lines/RectilinearLine.js.map +0 -1
  97. package/build/src/visualization/lib/tips/RectilinearTip.d.ts +0 -26
  98. package/build/src/visualization/lib/tips/RectilinearTip.d.ts.map +0 -1
  99. package/build/src/visualization/lib/tips/RectilinearTip.js +0 -149
  100. package/build/src/visualization/lib/tips/RectilinearTip.js.map +0 -1
  101. package/build/src/visualization/lib/tips/TipArtist.d.ts +0 -22
  102. package/build/src/visualization/lib/tips/TipArtist.d.ts.map +0 -1
  103. package/build/src/visualization/lib/tips/TipArtist.js +0 -31
  104. package/build/src/visualization/lib/tips/TipArtist.js.map +0 -1
  105. package/build/src/visualization/lib/types.d.ts +0 -164
  106. package/build/src/visualization/lib/types.d.ts.map +0 -1
  107. package/build/src/visualization/lib/types.js +0 -2
  108. package/build/src/visualization/lib/types.js.map +0 -1
  109. package/build/src/visualization/plugin/dnd/DragAndDropPlugin.d.ts +0 -126
  110. package/build/src/visualization/plugin/dnd/DragAndDropPlugin.d.ts.map +0 -1
  111. package/build/src/visualization/plugin/dnd/DragAndDropPlugin.js +0 -260
  112. package/build/src/visualization/plugin/dnd/DragAndDropPlugin.js.map +0 -1
  113. package/build/src/visualization/plugin/group-selection/GroupSelection.d.ts +0 -93
  114. package/build/src/visualization/plugin/group-selection/GroupSelection.d.ts.map +0 -1
  115. package/build/src/visualization/plugin/group-selection/GroupSelection.js +0 -250
  116. package/build/src/visualization/plugin/group-selection/GroupSelection.js.map +0 -1
  117. package/build/src/visualization/plugin/positioning/DataModelLayout.d.ts +0 -10
  118. package/build/src/visualization/plugin/positioning/DataModelLayout.d.ts.map +0 -1
  119. package/build/src/visualization/plugin/positioning/DataModelLayout.js +0 -105
  120. package/build/src/visualization/plugin/positioning/DataModelLayout.js.map +0 -1
  121. package/build/src/visualization/plugin/positioning/WorkspaceLayout.d.ts +0 -93
  122. package/build/src/visualization/plugin/positioning/WorkspaceLayout.d.ts.map +0 -1
  123. package/build/src/visualization/plugin/positioning/WorkspaceLayout.js +0 -96
  124. package/build/src/visualization/plugin/positioning/WorkspaceLayout.js.map +0 -1
  125. package/build/src/visualization/viz-association.d.ts +0 -7
  126. package/build/src/visualization/viz-association.d.ts.map +0 -1
  127. package/build/src/visualization/viz-association.js +0 -3
  128. package/build/src/visualization/viz-association.js.map +0 -1
  129. package/build/src/visualization/viz-workspace.d.ts +0 -7
  130. package/build/src/visualization/viz-workspace.d.ts.map +0 -1
  131. package/build/src/visualization/viz-workspace.js +0 -3
  132. package/build/src/visualization/viz-workspace.js.map +0 -1
  133. package/src/visualization/elements/VizAssociationElement.ts +0 -3
  134. package/src/visualization/elements/VizWorkspaceElement.ts +0 -302
  135. package/src/visualization/elements/WorkspaceStyles.ts +0 -168
  136. package/src/visualization/lib/AnchorFinder.ts +0 -112
  137. package/src/visualization/lib/AnchorUtils.ts +0 -53
  138. package/src/visualization/lib/AssociationAnchors.ts +0 -418
  139. package/src/visualization/lib/LabelSketch.ts +0 -67
  140. package/src/visualization/lib/LineSketch.ts +0 -62
  141. package/src/visualization/lib/Point.ts +0 -134
  142. package/src/visualization/lib/PositionUtils.ts +0 -218
  143. package/src/visualization/lib/SelectionManager.ts +0 -513
  144. package/src/visualization/lib/ShapeArtist.ts +0 -222
  145. package/src/visualization/lib/SvgMarkers.ts +0 -80
  146. package/src/visualization/lib/TipSketch.ts +0 -91
  147. package/src/visualization/lib/TouchSupport.ts +0 -72
  148. package/src/visualization/lib/Utils.ts +0 -63
  149. package/src/visualization/lib/VisualizationTypes.ts +0 -232
  150. package/src/visualization/lib/WorkspaceAlignment.ts +0 -261
  151. package/src/visualization/lib/WorkspaceDebugging.ts +0 -313
  152. package/src/visualization/lib/WorkspaceEdges.ts +0 -1153
  153. package/src/visualization/lib/WorkspaceGestures.ts +0 -400
  154. package/src/visualization/lib/WorkspaceSizing.ts +0 -181
  155. package/src/visualization/lib/lines/RectilinearLine.ts +0 -589
  156. package/src/visualization/lib/tips/RectilinearTip.ts +0 -156
  157. package/src/visualization/lib/tips/TipArtist.ts +0 -34
  158. package/src/visualization/lib/types.ts +0 -173
  159. package/src/visualization/plugin/dnd/DragAndDropPlugin.ts +0 -294
  160. package/src/visualization/plugin/group-selection/GroupSelection.ts +0 -271
  161. package/src/visualization/plugin/positioning/DataModelLayout.ts +0 -114
  162. package/src/visualization/plugin/positioning/WorkspaceLayout.ts +0 -149
  163. package/src/visualization/viz-association.ts +0 -9
  164. package/src/visualization/viz-workspace.ts +0 -9
  165. package/test/env.d.ts +0 -9
  166. package/test/env.js +0 -7
  167. package/test/visualization/lib/AnchorFinder.test.ts +0 -313
  168. package/test/visualization/lib/AnchorUtils.test.ts +0 -178
  169. package/test/visualization/lib/PositionUtils.test.ts +0 -406
  170. package/test/visualization/lib/test-styles.css +0 -80
@@ -1,351 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-non-null-assertion */
2
- import { getRelativeClickPoint } from './PositionUtils.js';
3
- import { anchorToPoint } from './AnchorUtils.js';
4
- import { LineSketch } from './LineSketch.js';
5
- const SvgNS = 'http://www.w3.org/2000/svg';
6
- export const connectedValue = Symbol('connectedValue');
7
- export const mouseDownHandler = Symbol('mouseDownHandler');
8
- export const mouseMoveHandler = Symbol('mouseMoveHandler');
9
- export const mouseUpHandler = Symbol('mouseUpHandler');
10
- export const keydownHandler = Symbol('keydownHandler');
11
- /**
12
- * A helper that allows to manually draw a line from one visualization object to another.
13
- * The visualization object has to have the `data-association-slots` attribute set on the element
14
- * and the mouse event target having the `data-association-slot` attribute with the index of the slot.
15
- *
16
- * The association line can be drawn to another object that has both attributes.
17
- *
18
- * After the user finish a DOM event is dispatched from the visualization workspace.
19
- */
20
- export class AssociationAnchors {
21
- workspace;
22
- [connectedValue] = false;
23
- /**
24
- * Whether a line is being constructed.
25
- */
26
- drawing = false;
27
- /**
28
- * A reference to the currently injected SVG element.
29
- */
30
- lineElement;
31
- /**
32
- * Whether an association position is being updated.
33
- * In such case it dispatches different event at the end.
34
- */
35
- updating = false;
36
- /**
37
- * The processor used to draw lines
38
- */
39
- lineProcessor = new LineSketch();
40
- /**
41
- * Set when a new association is being created
42
- */
43
- createInfo;
44
- /**
45
- * Set when an association update is performed
46
- */
47
- updateInfo;
48
- constructor(workspace) {
49
- this.workspace = workspace;
50
- this.workspace = workspace;
51
- this[mouseDownHandler] = this[mouseDownHandler].bind(this);
52
- this[mouseMoveHandler] = this[mouseMoveHandler].bind(this);
53
- this[mouseUpHandler] = this[mouseUpHandler].bind(this);
54
- this[keydownHandler] = this[keydownHandler].bind(this);
55
- }
56
- /**
57
- * Starts listening for the user events
58
- */
59
- connect() {
60
- if (this[connectedValue]) {
61
- return;
62
- }
63
- this[connectedValue] = true;
64
- const { workspace } = this;
65
- // const { canvas } = workspace;
66
- workspace.addEventListener('mousedown', this[mouseDownHandler], true);
67
- }
68
- /**
69
- * Stops listening for the user events
70
- */
71
- disconnect() {
72
- this[connectedValue] = false;
73
- const { workspace } = this;
74
- // const { canvas } = workspace;
75
- workspace.removeEventListener('mousedown', this[mouseDownHandler], true);
76
- }
77
- findSlotParent(path) {
78
- const element = path.find((node) => {
79
- if (node.nodeType !== Node.ELEMENT_NODE) {
80
- return false;
81
- }
82
- const typed = node;
83
- return typed.hasAttribute('data-association-slots');
84
- });
85
- return element;
86
- }
87
- [mouseDownHandler](e) {
88
- if (e.button !== 0) {
89
- return;
90
- }
91
- let node = e.target;
92
- if (!e.composed || node.nodeType !== Node.ELEMENT_NODE) {
93
- return;
94
- }
95
- const [source] = e.composedPath();
96
- if (node === source) {
97
- const parent = this.findSlotParent(e.composedPath());
98
- if (!parent) {
99
- return;
100
- }
101
- node = parent;
102
- }
103
- const { dataset } = source;
104
- const isSvgDraggable = source.classList && source.classList.contains('association-draggable');
105
- if (isSvgDraggable) {
106
- e.preventDefault();
107
- e.stopPropagation();
108
- this.startUpdate(dataset.key, dataset.dir);
109
- return;
110
- }
111
- if (!node.hasAttribute('data-association-slots')) {
112
- return;
113
- }
114
- if (source.nodeType !== Node.ELEMENT_NODE) {
115
- return;
116
- }
117
- if (!dataset.associationSlot) {
118
- return;
119
- }
120
- e.preventDefault();
121
- e.stopPropagation();
122
- const startPoint = anchorToPoint(source, this.workspace);
123
- this.start(node, dataset.associationSlot, startPoint);
124
- }
125
- [mouseMoveHandler](e) {
126
- if (!this.drawing) {
127
- return;
128
- }
129
- const { clientX, clientY } = e;
130
- const pos = getRelativeClickPoint(clientX, clientY, this.workspace);
131
- this.updateLinePosition(pos);
132
- }
133
- [mouseUpHandler](e) {
134
- if (!this.drawing) {
135
- return;
136
- }
137
- this.drawing = false;
138
- this.cancel();
139
- let node = e.target;
140
- if (!e.composed || node.nodeType !== Node.ELEMENT_NODE) {
141
- this.cleanup();
142
- return;
143
- }
144
- if (!node.hasAttribute('data-association-slots')) {
145
- const parent = this.findSlotParent(e.composedPath());
146
- if (!parent) {
147
- return;
148
- }
149
- node = parent;
150
- }
151
- if (!node.hasAttribute('data-association-slots')) {
152
- this.cleanup();
153
- return;
154
- }
155
- const [source] = e.composedPath();
156
- if (source.nodeType !== Node.ELEMENT_NODE) {
157
- this.cleanup();
158
- return;
159
- }
160
- const { dataset } = source;
161
- if (!dataset.associationSlot) {
162
- this.cleanup();
163
- return;
164
- }
165
- const { clientX, clientY } = e;
166
- const endPoint = getRelativeClickPoint(clientX, clientY, this.workspace);
167
- if (this.updating) {
168
- this.endUpdate(node.dataset.key, dataset.associationSlot, endPoint);
169
- }
170
- else {
171
- this.end(node.dataset.key, dataset.associationSlot, endPoint);
172
- }
173
- }
174
- [keydownHandler](e) {
175
- if (e.code !== 'Escape') {
176
- return;
177
- }
178
- this.cancel();
179
- this.cleanup();
180
- }
181
- /**
182
- * Cancels the operation.
183
- */
184
- cancel() {
185
- this.unlistenDargEvents();
186
- this.removeLine();
187
- if (this.updating) {
188
- const model = this.workspace.edges.get(this.updateInfo.id);
189
- model.shape.selection.hidden = false;
190
- this.workspace.requestUpdate();
191
- }
192
- }
193
- /**
194
- * Clears variables set in the `start()` function.
195
- */
196
- cleanup() {
197
- this.createInfo = undefined;
198
- this.updateInfo = undefined;
199
- this.updating = false;
200
- this.drawing = false;
201
- }
202
- start(domainObject, slot, startPoint) {
203
- this.drawing = true;
204
- this.createInfo = {
205
- slot,
206
- point: startPoint,
207
- source: domainObject,
208
- };
209
- this.addLine(startPoint, startPoint);
210
- this.listenDargEvents();
211
- }
212
- /**
213
- * @param key The domain id of the association being updated
214
- * @param dir The name of the tip that is being dragged.
215
- */
216
- startUpdate(key, dir) {
217
- const model = this.workspace.edges.get(key);
218
- if (!model) {
219
- throw new Error(`The edge is not prepared.`);
220
- }
221
- model.shape.selection.hidden = true;
222
- const { coordinates } = model.shape.line;
223
- const [sp] = coordinates;
224
- const ep = coordinates[coordinates.length - 1];
225
- const startPoint = dir === 'end' ? sp : ep;
226
- const endPoint = dir === 'end' ? ep : sp;
227
- this.updating = true;
228
- this.updateInfo = {
229
- direction: dir,
230
- ep: endPoint,
231
- sp: startPoint,
232
- id: key,
233
- };
234
- this.drawing = true;
235
- this.addLine(startPoint, endPoint);
236
- this.listenDargEvents();
237
- this.workspace.requestUpdate();
238
- }
239
- end(id, slot, endPoint) {
240
- const { createInfo } = this;
241
- if (!createInfo) {
242
- throw new Error(`updateInfo is not set.`);
243
- }
244
- const detail = {
245
- source: {
246
- id: createInfo.source.dataset.key,
247
- point: createInfo.point,
248
- slot: createInfo.slot,
249
- },
250
- target: {
251
- id, // : domainObject.dataset.key,
252
- point: endPoint,
253
- slot,
254
- },
255
- };
256
- createInfo.source.dispatchEvent(new CustomEvent('anchorassociationcreate', {
257
- composed: true,
258
- cancelable: true,
259
- bubbles: true,
260
- detail,
261
- }));
262
- this.cleanup();
263
- }
264
- endUpdate(id, slot, endPoint) {
265
- const { updateInfo } = this;
266
- if (!updateInfo) {
267
- throw new Error(`updateInfo is not set.`);
268
- }
269
- const detail = {
270
- source: {
271
- associationId: updateInfo.id,
272
- direction: updateInfo.direction,
273
- },
274
- target: {
275
- id, // : domainObject.dataset.key,
276
- point: endPoint,
277
- slot,
278
- },
279
- };
280
- const model = this.workspace.edges.get(updateInfo.id);
281
- const eventTarget = this.workspace.querySelector(`[data-key="${model.source}"]`);
282
- this.cleanup();
283
- eventTarget.dispatchEvent(new CustomEvent('anchorassociationupdate', {
284
- composed: true,
285
- cancelable: true,
286
- bubbles: true,
287
- detail,
288
- }));
289
- }
290
- /**
291
- * Insets a child with a line definition into the workspace's SVG element.
292
- * @param start The starting point of the line
293
- * @param end The ending point of the line
294
- */
295
- addLine(start, end) {
296
- const line = document.createElementNS(SvgNS, 'line');
297
- line.setAttribute('x1', `${start.x}`);
298
- line.setAttribute('y1', `${start.y}`);
299
- line.setAttribute('x2', `${end.x}`);
300
- line.setAttribute('y2', `${end.y}`);
301
- line.classList.add('association-line');
302
- const { associationSvg } = this.workspace;
303
- associationSvg.append(line);
304
- this.lineElement = line;
305
- }
306
- /**
307
- * Removes the previously added line from the SVG
308
- */
309
- removeLine() {
310
- const { lineElement } = this;
311
- if (!lineElement) {
312
- return;
313
- }
314
- const { associationSvg } = this.workspace;
315
- associationSvg.removeChild(lineElement);
316
- this.lineElement = undefined;
317
- }
318
- /**
319
- * Updates the end position of the line.
320
- * @param {Point} point
321
- */
322
- updateLinePosition(point) {
323
- const { lineElement } = this;
324
- if (!lineElement) {
325
- return;
326
- }
327
- // lineElement.setAttribute('d', definition.path);
328
- lineElement.setAttribute('x2', `${point.x}`);
329
- lineElement.setAttribute('y2', `${point.y}`);
330
- }
331
- /**
332
- * Listens for the mouse move and mouse up events to draw the line and finish the operation.
333
- * This is only initialized when starting drawing a line.
334
- */
335
- listenDargEvents() {
336
- const { workspace } = this;
337
- workspace.addEventListener('mousemove', this[mouseMoveHandler]);
338
- workspace.addEventListener('mouseup', this[mouseUpHandler]);
339
- window.addEventListener('keydown', this[keydownHandler]);
340
- }
341
- /**
342
- * Removes previously registered events.
343
- */
344
- unlistenDargEvents() {
345
- const { workspace } = this;
346
- workspace.removeEventListener('mousemove', this[mouseMoveHandler]);
347
- workspace.removeEventListener('mouseup', this[mouseUpHandler]);
348
- window.removeEventListener('keydown', this[keydownHandler]);
349
- }
350
- }
351
- //# sourceMappingURL=AssociationAnchors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AssociationAnchors.js","sourceRoot":"","sources":["../../../../src/visualization/lib/AssociationAnchors.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAI5C,MAAM,KAAK,GAAG,4BAA4B,CAAA;AAE1C,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAA;AACtD,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,kBAAkB,CAAC,CAAA;AAC1D,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,kBAAkB,CAAC,CAAA;AAC1D,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAA;AACtD,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAA;AAqCtD;;;;;;;;GAQG;AACH,MAAM,OAAO,kBAAkB;IAkCV;IAjCnB,CAAC,cAAc,CAAC,GAAG,KAAK,CAAA;IAExB;;OAEG;IACH,OAAO,GAAG,KAAK,CAAA;IAEf;;OAEG;IACH,WAAW,CAAa;IAExB;;;OAGG;IACH,QAAQ,GAAG,KAAK,CAAA;IAEhB;;OAEG;IACH,aAAa,GAAG,IAAI,UAAU,EAAE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,CAAA;IAC9C,CAAC;IAED;;;OAGG;IACH,gBAAgB;QACd,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAA;QAC1B,SAAS,CAAC,gBAAgB,CAAC,WAAW,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAA;QAC/D,SAAS,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,CAAA;QAC3D,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,CAAA;IAC1D,CAAC;IAED;;OAEG;IACH,kBAAkB;QAChB,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAA;QAC1B,SAAS,CAAC,mBAAmB,CAAC,WAAW,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAA;QAClE,SAAS,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,CAAA;QAC9D,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,CAAA;IAC7D,CAAC;CACF","sourcesContent":["/* eslint-disable @typescript-eslint/no-non-null-assertion */\nimport { getRelativeClickPoint } from './PositionUtils.js'\nimport { anchorToPoint } from './AnchorUtils.js'\nimport { LineSketch } from './LineSketch.js'\nimport VizWorkspaceElement from '../elements/VizWorkspaceElement.js'\nimport { Point } from './Point.js'\n\nconst SvgNS = 'http://www.w3.org/2000/svg'\n\nexport const connectedValue = Symbol('connectedValue')\nexport const mouseDownHandler = Symbol('mouseDownHandler')\nexport const mouseMoveHandler = Symbol('mouseMoveHandler')\nexport const mouseUpHandler = Symbol('mouseUpHandler')\nexport const keydownHandler = Symbol('keydownHandler')\n\nexport interface EdgeCreateInfo {\n /**\n * The slot name of the source object.\n */\n slot: string\n /**\n * The workspace coordinates of the staring point\n */\n point: Point\n /**\n * The domain element that is the source of the association.\n */\n source: HTMLElement\n}\n\nexport interface IEdgeUpdateInfo {\n /**\n * The name of the tip that is being dragged.\n * It's either `start` or `end`.\n */\n direction: string\n /**\n * The association domain id.\n */\n id: string\n /**\n * The start point of the line\n */\n sp: Point\n /**\n * The end point of the line\n */\n ep: Point\n}\n\n/**\n * A helper that allows to manually draw a line from one visualization object to another.\n * The visualization object has to have the `data-association-slots` attribute set on the element\n * and the mouse event target having the `data-association-slot` attribute with the index of the slot.\n *\n * The association line can be drawn to another object that has both attributes.\n *\n * After the user finish a DOM event is dispatched from the visualization workspace.\n */\nexport class AssociationAnchors {\n [connectedValue] = false\n\n /**\n * Whether a line is being constructed.\n */\n drawing = false\n\n /**\n * A reference to the currently injected SVG element.\n */\n lineElement?: SVGElement\n\n /**\n * Whether an association position is being updated.\n * In such case it dispatches different event at the end.\n */\n updating = false\n\n /**\n * The processor used to draw lines\n */\n lineProcessor = new LineSketch()\n\n /**\n * Set when a new association is being created\n */\n createInfo?: EdgeCreateInfo\n\n /**\n * Set when an association update is performed\n */\n updateInfo?: IEdgeUpdateInfo\n\n constructor(public workspace: VizWorkspaceElement) {\n this.workspace = workspace\n this[mouseDownHandler] = this[mouseDownHandler].bind(this)\n this[mouseMoveHandler] = this[mouseMoveHandler].bind(this)\n this[mouseUpHandler] = this[mouseUpHandler].bind(this)\n this[keydownHandler] = this[keydownHandler].bind(this)\n }\n\n /**\n * Starts listening for the user events\n */\n connect(): void {\n if (this[connectedValue]) {\n return\n }\n this[connectedValue] = true\n const { workspace } = this\n // const { canvas } = workspace;\n workspace.addEventListener('mousedown', this[mouseDownHandler], true)\n }\n\n /**\n * Stops listening for the user events\n */\n disconnect(): void {\n this[connectedValue] = false\n const { workspace } = this\n // const { canvas } = workspace;\n workspace.removeEventListener('mousedown', this[mouseDownHandler], true)\n }\n\n findSlotParent(path: Node[]): Element {\n const element = path.find((node) => {\n if (node.nodeType !== Node.ELEMENT_NODE) {\n return false\n }\n const typed = node as Element\n return typed.hasAttribute('data-association-slots')\n })\n return element as Element\n }\n\n [mouseDownHandler](e: MouseEvent): void {\n if (e.button !== 0) {\n return\n }\n let node = e.target as HTMLElement\n if (!e.composed || node.nodeType !== Node.ELEMENT_NODE) {\n return\n }\n const [source] = e.composedPath() as HTMLElement[]\n if (node === source) {\n const parent = this.findSlotParent(e.composedPath() as Node[])\n if (!parent) {\n return\n }\n node = parent as HTMLElement\n }\n const { dataset } = source\n const isSvgDraggable = source.classList && source.classList.contains('association-draggable')\n if (isSvgDraggable) {\n e.preventDefault()\n e.stopPropagation()\n this.startUpdate(dataset.key!, dataset.dir!)\n return\n }\n if (!node.hasAttribute('data-association-slots')) {\n return\n }\n if (source.nodeType !== Node.ELEMENT_NODE) {\n return\n }\n if (!dataset.associationSlot) {\n return\n }\n e.preventDefault()\n e.stopPropagation()\n const startPoint = anchorToPoint(source, this.workspace)\n this.start(node, dataset.associationSlot, startPoint)\n }\n\n [mouseMoveHandler](e: MouseEvent): void {\n if (!this.drawing) {\n return\n }\n const { clientX, clientY } = e\n const pos = getRelativeClickPoint(clientX, clientY, this.workspace)\n this.updateLinePosition(pos)\n }\n\n [mouseUpHandler](e: MouseEvent): void {\n if (!this.drawing) {\n return\n }\n this.drawing = false\n this.cancel()\n let node = e.target as HTMLElement\n if (!e.composed || node.nodeType !== Node.ELEMENT_NODE) {\n this.cleanup()\n return\n }\n if (!node.hasAttribute('data-association-slots')) {\n const parent = this.findSlotParent(e.composedPath() as Node[])\n if (!parent) {\n return\n }\n node = parent as HTMLElement\n }\n if (!node.hasAttribute('data-association-slots')) {\n this.cleanup()\n return\n }\n const [source] = e.composedPath() as HTMLElement[]\n if (source.nodeType !== Node.ELEMENT_NODE) {\n this.cleanup()\n return\n }\n const { dataset } = source\n if (!dataset.associationSlot) {\n this.cleanup()\n return\n }\n const { clientX, clientY } = e\n const endPoint = getRelativeClickPoint(clientX, clientY, this.workspace)\n if (this.updating) {\n this.endUpdate(node.dataset.key!, dataset.associationSlot, endPoint)\n } else {\n this.end(node.dataset.key!, dataset.associationSlot, endPoint)\n }\n }\n\n [keydownHandler](e: KeyboardEvent): void {\n if (e.code !== 'Escape') {\n return\n }\n this.cancel()\n this.cleanup()\n }\n\n /**\n * Cancels the operation.\n */\n cancel(): void {\n this.unlistenDargEvents()\n this.removeLine()\n if (this.updating) {\n const model = this.workspace.edges.get(this.updateInfo!.id)!\n model.shape.selection!.hidden = false\n this.workspace.requestUpdate()\n }\n }\n\n /**\n * Clears variables set in the `start()` function.\n */\n cleanup(): void {\n this.createInfo = undefined\n this.updateInfo = undefined\n this.updating = false\n this.drawing = false\n }\n\n start(domainObject: HTMLElement, slot: string, startPoint: Point): void {\n this.drawing = true\n this.createInfo = {\n slot,\n point: startPoint,\n source: domainObject,\n }\n this.addLine(startPoint, startPoint)\n this.listenDargEvents()\n }\n\n /**\n * @param key The domain id of the association being updated\n * @param dir The name of the tip that is being dragged.\n */\n startUpdate(key: string, dir: string): void {\n const model = this.workspace.edges.get(key)\n if (!model) {\n throw new Error(`The edge is not prepared.`)\n }\n model.shape.selection!.hidden = true\n const { coordinates } = model.shape.line\n const [sp] = coordinates!\n const ep = coordinates![coordinates!.length - 1]\n const startPoint = dir === 'end' ? sp : ep\n const endPoint = dir === 'end' ? ep : sp\n this.updating = true\n this.updateInfo = {\n direction: dir,\n ep: endPoint,\n sp: startPoint,\n id: key,\n }\n this.drawing = true\n this.addLine(startPoint, endPoint)\n this.listenDargEvents()\n this.workspace.requestUpdate()\n }\n\n end(id: string, slot: string, endPoint: Point): void {\n const { createInfo } = this\n if (!createInfo) {\n throw new Error(`updateInfo is not set.`)\n }\n const detail = {\n source: {\n id: createInfo.source.dataset.key,\n point: createInfo.point,\n slot: createInfo.slot,\n },\n target: {\n id, // : domainObject.dataset.key,\n point: endPoint,\n slot,\n },\n }\n createInfo.source.dispatchEvent(\n new CustomEvent('anchorassociationcreate', {\n composed: true,\n cancelable: true,\n bubbles: true,\n detail,\n })\n )\n this.cleanup()\n }\n\n endUpdate(id: string, slot: string, endPoint: Point): void {\n const { updateInfo } = this\n if (!updateInfo) {\n throw new Error(`updateInfo is not set.`)\n }\n const detail = {\n source: {\n associationId: updateInfo.id,\n direction: updateInfo.direction,\n },\n target: {\n id, // : domainObject.dataset.key,\n point: endPoint,\n slot,\n },\n }\n const model = this.workspace.edges.get(updateInfo.id)!\n const eventTarget = this.workspace.querySelector(`[data-key=\"${model.source}\"]`)!\n this.cleanup()\n eventTarget.dispatchEvent(\n new CustomEvent('anchorassociationupdate', {\n composed: true,\n cancelable: true,\n bubbles: true,\n detail,\n })\n )\n }\n\n /**\n * Insets a child with a line definition into the workspace's SVG element.\n * @param start The starting point of the line\n * @param end The ending point of the line\n */\n addLine(start: Point, end: Point): void {\n const line = document.createElementNS(SvgNS, 'line')\n line.setAttribute('x1', `${start.x}`)\n line.setAttribute('y1', `${start.y}`)\n line.setAttribute('x2', `${end.x}`)\n line.setAttribute('y2', `${end.y}`)\n line.classList.add('association-line')\n const { associationSvg } = this.workspace\n associationSvg.append(line)\n this.lineElement = line\n }\n\n /**\n * Removes the previously added line from the SVG\n */\n removeLine(): void {\n const { lineElement } = this\n if (!lineElement) {\n return\n }\n const { associationSvg } = this.workspace\n associationSvg.removeChild(lineElement)\n this.lineElement = undefined\n }\n\n /**\n * Updates the end position of the line.\n * @param {Point} point\n */\n updateLinePosition(point: Point): void {\n const { lineElement } = this\n\n if (!lineElement) {\n return\n }\n\n // lineElement.setAttribute('d', definition.path);\n lineElement.setAttribute('x2', `${point.x}`)\n lineElement.setAttribute('y2', `${point.y}`)\n }\n\n /**\n * Listens for the mouse move and mouse up events to draw the line and finish the operation.\n * This is only initialized when starting drawing a line.\n */\n listenDargEvents(): void {\n const { workspace } = this\n workspace.addEventListener('mousemove', this[mouseMoveHandler])\n workspace.addEventListener('mouseup', this[mouseUpHandler])\n window.addEventListener('keydown', this[keydownHandler])\n }\n\n /**\n * Removes previously registered events.\n */\n unlistenDargEvents(): void {\n const { workspace } = this\n workspace.removeEventListener('mousemove', this[mouseMoveHandler])\n workspace.removeEventListener('mouseup', this[mouseUpHandler])\n window.removeEventListener('keydown', this[keydownHandler])\n }\n}\n"]}
@@ -1,16 +0,0 @@
1
- import { IEdgeDirections } from './types.js';
2
- import { IAssociationLabelShape, IVisualizationAssociationShape, IVisualizationRectilinearLineShape } from './VisualizationTypes.js';
3
- /**
4
- * A class that specializes in sketching a label (association label) on the workspace.
5
- */
6
- export declare class LabelSketch {
7
- /**
8
- * Computes sketch of the label.
9
- */
10
- sketch(lineShape: IVisualizationAssociationShape, value: string, directions: IEdgeDirections): IAssociationLabelShape | null;
11
- /**
12
- * Computes sketch of the label on a rectilinear shape.
13
- */
14
- sketchRectilinear(lineShape: IVisualizationRectilinearLineShape, value: string, directions: IEdgeDirections): IAssociationLabelShape | null;
15
- }
16
- //# sourceMappingURL=LabelSketch.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LabelSketch.d.ts","sourceRoot":"","sources":["../../../../src/visualization/lib/LabelSketch.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,EACL,sBAAsB,EACtB,8BAA8B,EAC9B,kCAAkC,EACnC,MAAM,yBAAyB,CAAA;AAEhC;;GAEG;AACH,qBAAa,WAAW;IACtB;;OAEG;IACH,MAAM,CACJ,SAAS,EAAE,8BAA8B,EACzC,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,eAAe,GAC1B,sBAAsB,GAAG,IAAI;IAShC;;OAEG;IACH,iBAAiB,CACf,SAAS,EAAE,kCAAkC,EAC7C,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,eAAe,GAC1B,sBAAsB,GAAG,IAAI;CA8BjC"}
@@ -1,53 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-non-null-assertion */
2
- /**
3
- * A class that specializes in sketching a label (association label) on the workspace.
4
- */
5
- export class LabelSketch {
6
- /**
7
- * Computes sketch of the label.
8
- */
9
- sketch(lineShape, value, directions) {
10
- switch (lineShape.type) {
11
- case 'rectilinear':
12
- return this.sketchRectilinear(lineShape, value, directions);
13
- default:
14
- return null;
15
- }
16
- }
17
- /**
18
- * Computes sketch of the label on a rectilinear shape.
19
- */
20
- sketchRectilinear(lineShape, value, directions) {
21
- const [position] = lineShape.coordinates;
22
- const point = position.copy();
23
- const transformOrigin = `${position.x}px ${position.y}px`;
24
- const { start } = directions;
25
- let anchor = 'start';
26
- if (start === 'south') {
27
- point.x += 8;
28
- point.y += 20;
29
- }
30
- else if (start === 'east') {
31
- point.x += 8;
32
- point.y -= 8;
33
- }
34
- else if (start === 'north') {
35
- point.x += 8;
36
- point.y -= 24;
37
- }
38
- else {
39
- point.x -= 8;
40
- point.y -= 8;
41
- anchor = 'end';
42
- }
43
- return {
44
- x: point.x,
45
- y: point.y,
46
- value,
47
- transformOrigin,
48
- rotate: 0,
49
- anchor,
50
- };
51
- }
52
- }
53
- //# sourceMappingURL=LabelSketch.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LabelSketch.js","sourceRoot":"","sources":["../../../../src/visualization/lib/LabelSketch.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAS7D;;GAEG;AACH,MAAM,OAAO,WAAW;IACtB;;OAEG;IACH,MAAM,CACJ,SAAyC,EACzC,KAAa,EACb,UAA2B;QAE3B,QAAQ,SAAS,CAAC,IAAI,EAAE,CAAC;YACvB,KAAK,aAAa;gBAChB,OAAO,IAAI,CAAC,iBAAiB,CAAC,SAA+C,EAAE,KAAK,EAAE,UAAU,CAAC,CAAA;YACnG;gBACE,OAAO,IAAI,CAAA;QACf,CAAC;IACH,CAAC;IAED;;OAEG;IACH,iBAAiB,CACf,SAA6C,EAC7C,KAAa,EACb,UAA2B;QAE3B,MAAM,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC,WAAY,CAAA;QACzC,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAA;QAC7B,MAAM,eAAe,GAAG,GAAG,QAAQ,CAAC,CAAC,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAA;QACzD,MAAM,EAAE,KAAK,EAAE,GAAG,UAAU,CAAA;QAC5B,IAAI,MAAM,GAAG,OAAO,CAAA;QACpB,IAAI,KAAK,KAAK,OAAO,EAAE,CAAC;YACtB,KAAK,CAAC,CAAC,IAAI,CAAC,CAAA;YACZ,KAAK,CAAC,CAAC,IAAI,EAAE,CAAA;QACf,CAAC;aAAM,IAAI,KAAK,KAAK,MAAM,EAAE,CAAC;YAC5B,KAAK,CAAC,CAAC,IAAI,CAAC,CAAA;YACZ,KAAK,CAAC,CAAC,IAAI,CAAC,CAAA;QACd,CAAC;aAAM,IAAI,KAAK,KAAK,OAAO,EAAE,CAAC;YAC7B,KAAK,CAAC,CAAC,IAAI,CAAC,CAAA;YACZ,KAAK,CAAC,CAAC,IAAI,EAAE,CAAA;QACf,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,CAAC,IAAI,CAAC,CAAA;YACZ,KAAK,CAAC,CAAC,IAAI,CAAC,CAAA;YACZ,MAAM,GAAG,KAAK,CAAA;QAChB,CAAC;QAED,OAAO;YACL,CAAC,EAAE,KAAK,CAAC,CAAC;YACV,CAAC,EAAE,KAAK,CAAC,CAAC;YACV,KAAK;YACL,eAAe;YACf,MAAM,EAAE,CAAC;YACT,MAAM;SACP,CAAA;IACH,CAAC;CACF","sourcesContent":["/* eslint-disable @typescript-eslint/no-non-null-assertion */\n\nimport { IEdgeDirections } from './types.js'\nimport {\n IAssociationLabelShape,\n IVisualizationAssociationShape,\n IVisualizationRectilinearLineShape,\n} from './VisualizationTypes.js'\n\n/**\n * A class that specializes in sketching a label (association label) on the workspace.\n */\nexport class LabelSketch {\n /**\n * Computes sketch of the label.\n */\n sketch(\n lineShape: IVisualizationAssociationShape,\n value: string,\n directions: IEdgeDirections\n ): IAssociationLabelShape | null {\n switch (lineShape.type) {\n case 'rectilinear':\n return this.sketchRectilinear(lineShape as IVisualizationRectilinearLineShape, value, directions)\n default:\n return null\n }\n }\n\n /**\n * Computes sketch of the label on a rectilinear shape.\n */\n sketchRectilinear(\n lineShape: IVisualizationRectilinearLineShape,\n value: string,\n directions: IEdgeDirections\n ): IAssociationLabelShape | null {\n const [position] = lineShape.coordinates!\n const point = position.copy()\n const transformOrigin = `${position.x}px ${position.y}px`\n const { start } = directions\n let anchor = 'start'\n if (start === 'south') {\n point.x += 8\n point.y += 20\n } else if (start === 'east') {\n point.x += 8\n point.y -= 8\n } else if (start === 'north') {\n point.x += 8\n point.y -= 24\n } else {\n point.x -= 8\n point.y -= 8\n anchor = 'end'\n }\n\n return {\n x: point.x,\n y: point.y,\n value,\n transformOrigin,\n rotate: 0,\n anchor,\n }\n }\n}\n"]}
@@ -1,26 +0,0 @@
1
- import { ILineSketchOptions, IVisualizationAssociationShape, IVisualizationRectilinearLineShape } from './VisualizationTypes.js';
2
- /**
3
- * A class that is responsible for sketching different kind of lines.
4
- * It computes list of points and other properties so the visualization workspace can
5
- * use this definition in the SVG drawing.
6
- */
7
- export declare class LineSketch {
8
- /**
9
- * Creates an association line for the given configuration.
10
- * @param config The line building options
11
- * @returns Computed model for the association.
12
- */
13
- sketch(config: ILineSketchOptions): IVisualizationAssociationShape | null;
14
- /**
15
- * Sketches a regular line.
16
- * @returns Computed model for the association.
17
- */
18
- computeLine(config: ILineSketchOptions): IVisualizationAssociationShape | null;
19
- /**
20
- * Sketches a regular line.
21
- *
22
- * @returns Computed model for the association.
23
- */
24
- computeRectilinearLine(config: ILineSketchOptions): IVisualizationRectilinearLineShape | null;
25
- }
26
- //# sourceMappingURL=LineSketch.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LineSketch.d.ts","sourceRoot":"","sources":["../../../../src/visualization/lib/LineSketch.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,kBAAkB,EAClB,8BAA8B,EAC9B,kCAAkC,EACnC,MAAM,yBAAyB,CAAA;AAEhC;;;;GAIG;AACH,qBAAa,UAAU;IACrB;;;;OAIG;IACH,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,8BAA8B,GAAG,IAAI;IAYzE;;;OAGG;IACH,WAAW,CAAC,MAAM,EAAE,kBAAkB,GAAG,8BAA8B,GAAG,IAAI;IAiB9E;;;;OAIG;IACH,sBAAsB,CAAC,MAAM,EAAE,kBAAkB,GAAG,kCAAkC,GAAG,IAAI;CAI9F"}
@@ -1,55 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-non-null-assertion */
2
- import { RectilinearLine } from './lines/RectilinearLine.js';
3
- /**
4
- * A class that is responsible for sketching different kind of lines.
5
- * It computes list of points and other properties so the visualization workspace can
6
- * use this definition in the SVG drawing.
7
- */
8
- export class LineSketch {
9
- /**
10
- * Creates an association line for the given configuration.
11
- * @param config The line building options
12
- * @returns Computed model for the association.
13
- */
14
- sketch(config) {
15
- const { type } = config;
16
- switch (type) {
17
- case 'linear':
18
- return this.computeLine(config);
19
- case 'rectilinear':
20
- return this.computeRectilinearLine(config);
21
- default:
22
- return null;
23
- }
24
- }
25
- /**
26
- * Sketches a regular line.
27
- * @returns Computed model for the association.
28
- */
29
- computeLine(config) {
30
- const { startPoint, endPoint, type } = config;
31
- if (!startPoint.validate() || !endPoint.validate()) {
32
- return null;
33
- }
34
- const coordinates = [startPoint, endPoint];
35
- const transformOrigin = `${startPoint.x}px ${endPoint.y}px`;
36
- return {
37
- transformOrigin,
38
- coordinates,
39
- rotate: 0,
40
- type: type,
41
- startPoint,
42
- endPoint,
43
- };
44
- }
45
- /**
46
- * Sketches a regular line.
47
- *
48
- * @returns Computed model for the association.
49
- */
50
- computeRectilinearLine(config) {
51
- const artist = new RectilinearLine(config);
52
- return artist.sketch();
53
- }
54
- }
55
- //# sourceMappingURL=LineSketch.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LineSketch.js","sourceRoot":"","sources":["../../../../src/visualization/lib/LineSketch.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAO5D;;;;GAIG;AACH,MAAM,OAAO,UAAU;IACrB;;;;OAIG;IACH,MAAM,CAAC,MAA0B;QAC/B,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAA;QACvB,QAAQ,IAAI,EAAE,CAAC;YACb,KAAK,QAAQ;gBACX,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAA;YACjC,KAAK,aAAa;gBAChB,OAAO,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAA;YAC5C;gBACE,OAAO,IAAI,CAAA;QACf,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,WAAW,CAAC,MAA0B;QACpC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,MAAM,CAAA;QAC7C,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC;YACnD,OAAO,IAAI,CAAA;QACb,CAAC;QACD,MAAM,WAAW,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;QAC1C,MAAM,eAAe,GAAG,GAAG,UAAU,CAAC,CAAC,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAA;QAC3D,OAAO;YACL,eAAe;YACf,WAAW;YACX,MAAM,EAAE,CAAC;YACT,IAAI,EAAE,IAAK;YACX,UAAU;YACV,QAAQ;SACT,CAAA;IACH,CAAC;IAED;;;;OAIG;IACH,sBAAsB,CAAC,MAA0B;QAC/C,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,CAAA;QAC1C,OAAO,MAAM,CAAC,MAAM,EAAE,CAAA;IACxB,CAAC;CACF","sourcesContent":["/* eslint-disable @typescript-eslint/no-non-null-assertion */\nimport { RectilinearLine } from './lines/RectilinearLine.js'\nimport {\n ILineSketchOptions,\n IVisualizationAssociationShape,\n IVisualizationRectilinearLineShape,\n} from './VisualizationTypes.js'\n\n/**\n * A class that is responsible for sketching different kind of lines.\n * It computes list of points and other properties so the visualization workspace can\n * use this definition in the SVG drawing.\n */\nexport class LineSketch {\n /**\n * Creates an association line for the given configuration.\n * @param config The line building options\n * @returns Computed model for the association.\n */\n sketch(config: ILineSketchOptions): IVisualizationAssociationShape | null {\n const { type } = config\n switch (type) {\n case 'linear':\n return this.computeLine(config)\n case 'rectilinear':\n return this.computeRectilinearLine(config)\n default:\n return null\n }\n }\n\n /**\n * Sketches a regular line.\n * @returns Computed model for the association.\n */\n computeLine(config: ILineSketchOptions): IVisualizationAssociationShape | null {\n const { startPoint, endPoint, type } = config\n if (!startPoint.validate() || !endPoint.validate()) {\n return null\n }\n const coordinates = [startPoint, endPoint]\n const transformOrigin = `${startPoint.x}px ${endPoint.y}px`\n return {\n transformOrigin,\n coordinates,\n rotate: 0,\n type: type!,\n startPoint,\n endPoint,\n }\n }\n\n /**\n * Sketches a regular line.\n *\n * @returns Computed model for the association.\n */\n computeRectilinearLine(config: ILineSketchOptions): IVisualizationRectilinearLineShape | null {\n const artist = new RectilinearLine(config)\n return artist.sketch()\n }\n}\n"]}
@@ -1,74 +0,0 @@
1
- import { xPositionOrCoord } from './types.js';
2
- /**
3
- * An object representing a point in a 2-d space (Euclidean space)
4
- */
5
- export declare class Point {
6
- x: number;
7
- y: number;
8
- /**
9
- * @param x The x coordinate or the array with x and y position values
10
- * @param y Optional when the `x` is an array. The y position of the point
11
- */
12
- constructor(x: xPositionOrCoord, y?: number);
13
- /**
14
- * Copies the current point as new object
15
- * @return A copy of the object
16
- */
17
- copy(): Point;
18
- /**
19
- * Validates the point value.
20
- * @return True if the point has valid values.
21
- */
22
- validate(): boolean;
23
- /**
24
- * Adds another point to this point and returns a new point.
25
- * @param v Point or a number to add.
26
- * @returns Created new point
27
- */
28
- add(v: Point | number): Point;
29
- /**
30
- * Subtracts another point from this point and returns a new point.
31
- * @param v Point or a number to add.
32
- * @returns Created new point
33
- */
34
- subtract(v: Point | number): Point;
35
- /**
36
- * Multiplies this point by another point or a number and returns a new point.
37
- * @param v Point or a number to add.
38
- * @returns Created new point
39
- */
40
- multiply(v: Point | number): Point;
41
- /**
42
- * Divides this point by another point or a number and returns a new point.
43
- * @param v Point or a number to add.
44
- * @returns Created new point
45
- */
46
- divide(v: Point | number): Point;
47
- /**
48
- * Subtracts another point to this point and returns a new point.
49
- * @param v Point or a number to add.
50
- * @returns True when points are equal
51
- */
52
- equals(v: Point): boolean;
53
- /**
54
- * Computes an angle to another point in radians.
55
- * @param v Point or a number to add.
56
- * @returns True when points are equal
57
- */
58
- angle(v: Point): number;
59
- /**
60
- * Computes an angle to another point in degrees.
61
- * @param v Point or a number to add.
62
- * @returns True when points are equal
63
- */
64
- degrees(v: Point): number;
65
- /**
66
- * Computes the distance to the other point.
67
- */
68
- distance(other: Point): number;
69
- /**
70
- * Computes the distance between two points.
71
- */
72
- static distance(p1: Point, p2: Point): number;
73
- }
74
- //# sourceMappingURL=Point.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Point.d.ts","sourceRoot":"","sources":["../../../../src/visualization/lib/Point.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAE7C;;GAEG;AACH,qBAAa,KAAK;IAChB,CAAC,EAAE,MAAM,CAAA;IAET,CAAC,EAAE,MAAM,CAAA;IAET;;;OAGG;gBACS,CAAC,EAAE,gBAAgB,EAAE,CAAC,CAAC,EAAE,MAAM;IAa3C;;;OAGG;IACH,IAAI,IAAI,KAAK;IAIb;;;OAGG;IACH,QAAQ,IAAI,OAAO;IAKnB;;;;OAIG;IACH,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK;IAO7B;;;;OAIG;IACH,QAAQ,CAAC,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK;IAOlC;;;;OAIG;IACH,QAAQ,CAAC,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK;IAOlC;;;;OAIG;IACH,MAAM,CAAC,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK;IAOhC;;;;OAIG;IACH,MAAM,CAAC,CAAC,EAAE,KAAK,GAAG,OAAO;IAIzB;;;;OAIG;IACH,KAAK,CAAC,CAAC,EAAE,KAAK,GAAG,MAAM;IAIvB;;;;OAIG;IACH,OAAO,CAAC,CAAC,EAAE,KAAK,GAAG,MAAM;IAIzB;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM;IAI9B;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,GAAG,MAAM;CAG9C"}