@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,1073 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-unused-vars */
2
- import { getObjectBoundingClientRect, findDirection } from './PositionUtils.js';
3
- import { closestAnchors, anchorToPoint } from './AnchorUtils.js';
4
- import { LineSketch } from './LineSketch.js';
5
- import { TipSketch } from './TipSketch.js';
6
- import { LabelSketch } from './LabelSketch.js';
7
- import { anchorPadding, findClosestAnchors } from './AnchorFinder.js';
8
- const DefaultLineType = 'rectilinear';
9
- export const observeItems = Symbol('observeItems');
10
- export const clickHandler = Symbol('clickHandler');
11
- export const mouseOverHandler = Symbol('mouseOverHandler');
12
- export const mouseOutHandler = Symbol('mouseOutHandler');
13
- export const mutationHandler = Symbol('mutationHandler');
14
- export const mutationObserver = Symbol('mutationObserver');
15
- export const processAddedNodes = Symbol('processAddedNodes');
16
- export const processRemovedNodes = Symbol('processRemovedNodes');
17
- export const processAttributeChanged = Symbol('processAttributeChanged');
18
- export const connectedValue = Symbol('connectedValue');
19
- export const processAddedAssociation = Symbol('processAddedAssociation');
20
- export const processRemovedAssociation = Symbol('processRemovedAssociation');
21
- export const processAddedNode = Symbol('processAddedNode');
22
- export const processRemovedNode = Symbol('processRemovedNode');
23
- export const edgesValue = Symbol('edgesValue');
24
- export const associationClickHandler = Symbol('associationClickHandler');
25
- export const deselectAllEdges = Symbol('deselectAllEdges');
26
- export const calculateEdge = Symbol('calculateEdge');
27
- export const processQueue = Symbol('processQueue');
28
- export const processQueueDebouncer = Symbol('processQueueDebouncer');
29
- export const updateAssociationById = Symbol('updateAssociationById');
30
- export const calculateNearestPoints = Symbol('calculateNearestPoints');
31
- export const readEventTarget = Symbol('readEventTarget');
32
- /**
33
- * A class that manages drawing edges between the nodes in the workspace visualization.
34
- *
35
- * This class looks for the `viz-association` elements inside other elements
36
- * and when the association has a valid (existing) target then it creates an internal model for the edge
37
- * visualization and sets it on the workspace to be rendered.
38
- *
39
- * This class also manages selection state of the edge.
40
- */
41
- export class WorkspaceEdges {
42
- workspace;
43
- [connectedValue] = false;
44
- /**
45
- * @returns True when the plug-in is listening for the input events.
46
- */
47
- get connected() {
48
- return this[connectedValue];
49
- }
50
- [edgesValue] = new Map();
51
- /**
52
- * @returns The edges to be visualized in the workspace.
53
- */
54
- get edges() {
55
- return this[edgesValue];
56
- }
57
- /**
58
- * When an association is changed in the DOM it is held in this array to process them asynchronously
59
- * in the future, when the workspace is updated.
60
- */
61
- [processQueue] = [];
62
- /**
63
- * The processor used to draw lines
64
- */
65
- lineProcessor = new LineSketch();
66
- /**
67
- * The processor used to draw tips on the line
68
- */
69
- tipProcessor = new TipSketch();
70
- [mutationObserver];
71
- constructor(workspace) {
72
- this.workspace = workspace;
73
- this[mutationHandler] = this[mutationHandler].bind(this);
74
- this[clickHandler] = this[clickHandler].bind(this);
75
- this[mouseOverHandler] = this[mouseOverHandler].bind(this);
76
- this[mouseOutHandler] = this[mouseOutHandler].bind(this);
77
- }
78
- /**
79
- * Starts listening on user events
80
- */
81
- connect() {
82
- this[mutationObserver] = this[observeItems]();
83
- this[connectedValue] = true;
84
- if (this.workspace.associationSvg) {
85
- this.listenContent();
86
- }
87
- this.associateCurrent();
88
- }
89
- /**
90
- * Creates associations for the current state of the canvas.
91
- */
92
- associateCurrent() {
93
- const nodes = Array.from(this.workspace.querySelectorAll('viz-association'));
94
- nodes.forEach((assoc) => this[processAddedAssociation](assoc));
95
- }
96
- /**
97
- * Initializes events when the workspace DOM is rendered.
98
- */
99
- listenContent() {
100
- this.workspace.associationSvg.addEventListener('click', this[clickHandler]);
101
- this.workspace.associationSvg.addEventListener('mouseover', this[mouseOverHandler]);
102
- this.workspace.associationSvg.addEventListener('mouseout', this[mouseOutHandler]);
103
- }
104
- /**
105
- * Cleans up the listeners
106
- */
107
- disconnect() {
108
- const observer = this[mutationObserver];
109
- if (observer) {
110
- observer.disconnect();
111
- this[mutationObserver] = undefined;
112
- }
113
- this[connectedValue] = false;
114
- this.workspace.associationSvg.removeEventListener('click', this[clickHandler]);
115
- this.workspace.associationSvg.removeEventListener('mouseover', this[mouseOverHandler]);
116
- this.workspace.associationSvg.removeEventListener('mouseout', this[mouseOutHandler]);
117
- }
118
- /**
119
- * Clear all edges from the workspace
120
- */
121
- clear() {
122
- this[edgesValue].clear();
123
- this.workspace.requestUpdate();
124
- }
125
- /**
126
- * Forces to re-calculate all existing edges.
127
- */
128
- async recalculate() {
129
- const { edges, workspace } = this;
130
- edges.forEach((edge) => {
131
- const { id, source, target, shape } = edge;
132
- const { label } = shape;
133
- const item = this[updateAssociationById](source, target, id, label && label.value);
134
- if (item) {
135
- edges.set(id, item);
136
- }
137
- });
138
- workspace.requestUpdate();
139
- }
140
- /**
141
- * Reads an edge definition by the association id.
142
- */
143
- get(key) {
144
- const { edges } = this;
145
- return edges.get(key);
146
- }
147
- /**
148
- * Removes an edge and notifies workspace to update.
149
- */
150
- removeEdge(id) {
151
- if (this[edgesValue].has(id)) {
152
- this[edgesValue].delete(id);
153
- this.workspace.requestUpdate();
154
- }
155
- }
156
- /**
157
- * Updates associations (in and out) for an element identified by the `key` attribute.
158
- * The element must be one of the visualized elements in the workspace.
159
- *
160
- * This is to be used when position and or size of an element that has associations change.
161
- *
162
- * @param key The domain id of the visualized element that has changed.
163
- */
164
- async update(key) {
165
- const { edges, workspace } = this;
166
- const element = workspace.querySelector(`[data-key="${key}"]`);
167
- if (!element) {
168
- return;
169
- }
170
- edges.forEach((edge) => {
171
- const { source, target, id, shape } = edge;
172
- const { label } = shape;
173
- let change = false;
174
- if ([source, target].includes(key)) {
175
- change = true;
176
- }
177
- if (change) {
178
- const item = this[updateAssociationById](source, target, id, label && label.value);
179
- if (item) {
180
- edges.set(id, item);
181
- }
182
- }
183
- });
184
- workspace.requestUpdate();
185
- await workspace.updateComplete;
186
- }
187
- /**
188
- * Computes workspace edge object for source and target.
189
- *
190
- * @param source The domain id of the source element
191
- * @param target The domain id of the target element
192
- * @param id The domain id of the association
193
- * @param name The label rendered in the association
194
- */
195
- [updateAssociationById](source, target, id, name) {
196
- const { workspace } = this;
197
- const sourceElement = workspace.querySelector(`[data-key="${source}"]`);
198
- if (!sourceElement) {
199
- return null;
200
- }
201
- const targetElement = workspace.querySelector(`[data-key="${target}"]`);
202
- if (!targetElement) {
203
- return null;
204
- }
205
- const opts = {
206
- sourceElement,
207
- targetElement,
208
- id,
209
- name,
210
- };
211
- const assocElement = workspace.querySelector(`viz-association[data-key="${id}"]`);
212
- if (!assocElement) {
213
- return null;
214
- }
215
- const slots = this.readAssociationSlots(assocElement);
216
- if (slots.source) {
217
- opts.sourceSlot = slots.source;
218
- }
219
- if (slots.target) {
220
- opts.targetSlot = slots.target;
221
- }
222
- const others = this.findOtherAssociations(sourceElement, targetElement, assocElement.dataset.key);
223
- if (others.length) {
224
- opts.others = others;
225
- }
226
- return this[calculateEdge](opts) || null;
227
- }
228
- /**
229
- * Creates a internal data model for the edge drawn between an association source and the target.
230
- * @param assocElement The viz-association element reference
231
- * @param targetElement The target element reference.
232
- */
233
- buildAssociationEdge(assocElement, targetElement) {
234
- const sourceElement = assocElement.parentElement;
235
- if (!sourceElement || !sourceElement.dataset.key) {
236
- return;
237
- }
238
- const slots = this.readAssociationSlots(assocElement);
239
- const { title, dataset } = assocElement;
240
- const opts = {
241
- sourceElement,
242
- targetElement,
243
- id: dataset.key,
244
- name: title || '',
245
- };
246
- if (slots.source) {
247
- opts.sourceSlot = slots.source;
248
- }
249
- if (slots.target) {
250
- opts.targetSlot = slots.target;
251
- }
252
- const map = this[edgesValue];
253
- const others = this.findOtherAssociations(sourceElement, targetElement, dataset.key);
254
- if (others.length) {
255
- opts.others = others;
256
- }
257
- const item = this[calculateEdge](opts);
258
- if (item) {
259
- map.set(dataset.key, item);
260
- }
261
- this.workspace.requestUpdate();
262
- }
263
- /**
264
- */
265
- findOtherAssociations(sourceElement, targetElement, assocId) {
266
- const srcId = sourceElement.dataset.key;
267
- const trgId = targetElement.dataset.key;
268
- const sourceAssociations = Array.from(sourceElement.querySelectorAll('viz-association'));
269
- const targetAssociations = Array.from(sourceElement.querySelectorAll('viz-association'));
270
- const otherSourceAssociations = sourceAssociations.filter((i) => i.dataset.target === trgId && i.dataset.key !== assocId);
271
- const otherTargetAssociations = targetAssociations.filter((i) => i.dataset.target === srcId && i.dataset.key);
272
- const others = [];
273
- const map = this[edgesValue];
274
- otherSourceAssociations.concat(otherTargetAssociations).forEach((item) => {
275
- const m = map.get(item.dataset.key);
276
- if (m) {
277
- others.push(m);
278
- }
279
- });
280
- return others;
281
- }
282
- /**
283
- * Reads the view model for an association and returns slot definitions for the association.
284
- *
285
- * @param assocElement The viz-association element reference
286
- */
287
- readAssociationSlots(assocElement) {
288
- const result = {};
289
- Array.from(assocElement.querySelectorAll('modeling-view')).forEach((item) => {
290
- // if (item.name === 'sourceSlot') {
291
- // result.source = item.value;
292
- // } else if (item.name === 'targetSlot') {
293
- // result.target = item.value;
294
- // }
295
- });
296
- return result;
297
- }
298
- /**
299
- * Calculates the edge between two nodes.
300
- */
301
- [calculateNearestPoints](sourceElement, targetElement, others) {
302
- const { workspace } = this;
303
- if (sourceElement.hasAttribute('data-association-slots') && targetElement.hasAttribute('data-association-slots')) {
304
- return closestAnchors(sourceElement, targetElement, workspace, others);
305
- }
306
- const sourceBox = getObjectBoundingClientRect(sourceElement, workspace);
307
- const targetBox = getObjectBoundingClientRect(targetElement, workspace);
308
- const anchors = findClosestAnchors(sourceBox, targetBox, anchorPadding);
309
- return anchors;
310
- }
311
- /**
312
- * Calculates the edge between two nodes.
313
- */
314
- [calculateEdge](options) {
315
- const { sourceElement, targetElement, id, name = '' } = options;
316
- const slotPoints = this.discoverAssociationVertexes(options);
317
- if (!slotPoints) {
318
- return undefined;
319
- }
320
- const sourceRect = getObjectBoundingClientRect(sourceElement, this.workspace);
321
- const targetRect = getObjectBoundingClientRect(targetElement, this.workspace);
322
- const sketch = this.lineProcessor.sketch({
323
- source: sourceRect,
324
- target: targetRect,
325
- startPoint: slotPoints.start,
326
- endPoint: slotPoints.end,
327
- type: DefaultLineType,
328
- others: options.others,
329
- });
330
- if (!sketch) {
331
- return undefined;
332
- }
333
- const coords = sketch.coordinates;
334
- const [sp] = coords;
335
- const ep = coords[coords.length - 1];
336
- const directions = findDirection(sp, ep, sourceRect, targetRect);
337
- const labelArtist = new LabelSketch();
338
- const label = labelArtist.sketch(sketch, name, directions) || undefined;
339
- const assocElement = this.workspace.querySelector(`viz-association[data-key="${id}"]`);
340
- const style = this.createAssociationStyles(assocElement);
341
- const tips = this.createAssociationTips(assocElement, sketch, directions);
342
- const positionChange = sourceElement.hasAttribute('data-association-slots') && targetElement.hasAttribute('data-association-slots');
343
- const shape = {
344
- selection: {
345
- primary: false,
346
- secondary: false,
347
- },
348
- line: sketch,
349
- style,
350
- label,
351
- tips,
352
- };
353
- const srcId = sourceElement.dataset.key;
354
- const trgId = targetElement.dataset.key;
355
- if (!srcId || !trgId) {
356
- return undefined;
357
- }
358
- const positionItem = {
359
- id,
360
- source: srcId,
361
- target: trgId,
362
- positionChange,
363
- directions,
364
- shape,
365
- };
366
- if (options.sourceSlot || options.targetSlot) {
367
- shape.slots = {};
368
- if (options.sourceSlot) {
369
- shape.slots.source = options.sourceSlot;
370
- }
371
- if (options.targetSlot) {
372
- shape.slots.target = options.targetSlot;
373
- }
374
- }
375
- return positionItem;
376
- }
377
- discoverAssociationVertexes(options) {
378
- const slotPoints = (this.discoverSlotPoints(options) || {});
379
- if (!slotPoints.end || !slotPoints.start) {
380
- const closest = this[calculateNearestPoints](options.sourceElement, options.targetElement, options.others);
381
- if (!closest) {
382
- return undefined;
383
- }
384
- if (!slotPoints.start) {
385
- slotPoints.start = closest[0];
386
- }
387
- if (!slotPoints.end) {
388
- slotPoints.end = closest[1];
389
- }
390
- }
391
- return slotPoints;
392
- }
393
- /**
394
- * When defined and correctly configured it returns position of the slots of the source and the target.
395
- */
396
- discoverSlotPoints(options) {
397
- const { sourceElement, targetElement, sourceSlot, targetSlot } = options;
398
- if (!sourceSlot && !targetSlot) {
399
- return undefined;
400
- }
401
- const result = {};
402
- if (sourceSlot) {
403
- const dom = sourceElement.shadowRoot ? sourceElement.shadowRoot : sourceElement;
404
- const obj = dom.querySelector(`[data-association-slot="${sourceSlot}"]`);
405
- if (obj) {
406
- result.start = anchorToPoint(obj, this.workspace);
407
- }
408
- }
409
- if (targetElement) {
410
- const dom = targetElement.shadowRoot ? targetElement.shadowRoot : targetElement;
411
- const obj = dom.querySelector(`[data-association-slot="${targetSlot}"]`);
412
- if (obj) {
413
- result.end = anchorToPoint(obj, this.workspace);
414
- }
415
- }
416
- return result;
417
- }
418
- /**
419
- * Creates edge's markers definition from the association element.
420
- * The association element can have the following attributes set:
421
- * - data-marker-end
422
- * - data-marker-start
423
- * With a value of a marker name defined in the visualization workspace.
424
- *
425
- * @param assocElement The association element to read the values from.
426
- * @param lineShape The definition of the line that the marker is attached to
427
- * @param directions Computed line directions
428
- */
429
- createAssociationTips(assocElement, lineShape, directions) {
430
- const result = {};
431
- if (!assocElement) {
432
- return result;
433
- }
434
- const { dataset } = assocElement;
435
- const { markerEnd, markerStart } = dataset;
436
- const style = this.createAssociationStyles(assocElement);
437
- if (markerEnd) {
438
- // result.end = this.buildEdgeTip(markerEnd, lineShape, directions);
439
- result.end = this.tipProcessor.endMarker(markerEnd, lineShape, directions);
440
- if (style) {
441
- result.end.style = style;
442
- }
443
- }
444
- if (markerStart) {
445
- // result.start = this.buildEdgeTip(markerStart, lineShape, directions);
446
- result.start = this.tipProcessor.startMarker(markerStart, lineShape, directions);
447
- if (style) {
448
- result.start.style = style;
449
- }
450
- }
451
- return result;
452
- }
453
- /**
454
- * Reads element's `data-style` attribute and returns it.
455
- * This is used in the edge definition for class name.
456
- *
457
- * @param assocElement The association element to read the values from.
458
- */
459
- createAssociationStyles(assocElement) {
460
- let result = '';
461
- if (assocElement) {
462
- const { dataset } = assocElement;
463
- const { style } = dataset;
464
- if (style) {
465
- result = style;
466
- }
467
- }
468
- return result;
469
- }
470
- /**
471
- * Updates an existing association data model for position
472
- * @param assocElement The viz-association element reference
473
- * @param targetElement The target element reference.
474
- */
475
- updateAssociationPosition(assocElement, targetElement) {
476
- const id = assocElement.dataset.key;
477
- const map = this[edgesValue];
478
- if (!map.has(id)) {
479
- return;
480
- }
481
- const sourceElement = assocElement.parentElement;
482
- if (!sourceElement || !sourceElement.dataset.key) {
483
- return;
484
- }
485
- const model = map.get(id);
486
- if (!model) {
487
- return;
488
- }
489
- const opts = {
490
- sourceElement,
491
- targetElement,
492
- id,
493
- };
494
- const slots = this.readAssociationSlots(assocElement);
495
- if (slots.source) {
496
- opts.sourceSlot = slots.source;
497
- }
498
- if (slots.target) {
499
- opts.targetSlot = slots.target;
500
- }
501
- const others = this.findOtherAssociations(sourceElement, targetElement, assocElement.dataset.key);
502
- if (others.length) {
503
- opts.others = others;
504
- }
505
- const slotPoints = this.discoverAssociationVertexes(opts);
506
- if (!slotPoints) {
507
- return;
508
- }
509
- const sourceRect = getObjectBoundingClientRect(sourceElement, this.workspace);
510
- const targetRect = getObjectBoundingClientRect(targetElement, this.workspace);
511
- const sketch = this.lineProcessor.sketch({
512
- source: sourceRect,
513
- target: targetRect,
514
- startPoint: slotPoints.start,
515
- endPoint: slotPoints.end,
516
- type: model.shape.line.type || DefaultLineType,
517
- });
518
- if (!sketch) {
519
- return;
520
- }
521
- const coord = sketch.coordinates;
522
- const [sp] = coord;
523
- const ep = coord[coord.length - 1];
524
- const directions = findDirection(sp, ep, sourceRect, targetRect);
525
- const labelArtist = new LabelSketch();
526
- const label = labelArtist.sketch(sketch, (model.shape.label && model.shape.label.value) || '', directions);
527
- const tips = this.createAssociationTips(assocElement, sketch, directions);
528
- model.shape.line = sketch;
529
- model.shape.label = label || undefined;
530
- model.shape.tips = tips;
531
- model.directions = directions;
532
- this.workspace.requestUpdate();
533
- }
534
- /**
535
- * Updates the label of the association in the visualization canvas.
536
- *
537
- * @param assocElement The viz-association element reference
538
- */
539
- updateAssociationLabel(assocElement) {
540
- const map = this[edgesValue];
541
- const key = assocElement.dataset.key;
542
- if (!map.has(key)) {
543
- return;
544
- }
545
- const { title } = assocElement;
546
- const model = map.get(key);
547
- if (model.shape && model.shape.label) {
548
- model.shape.label.value = title || '';
549
- this.workspace.requestUpdate();
550
- }
551
- }
552
- /**
553
- * Updates the `markers` property from an association element.
554
- *
555
- * @param assocElement The viz-association element reference
556
- */
557
- updateEdgeMarker(assocElement) {
558
- const map = this[edgesValue];
559
- const assocId = assocElement.dataset.key;
560
- if (!assocId) {
561
- return;
562
- }
563
- if (!map.has(assocId)) {
564
- return;
565
- }
566
- const model = map.get(assocId);
567
- const sourceElement = assocElement.parentElement;
568
- if (!sourceElement || !sourceElement.dataset.key) {
569
- return;
570
- }
571
- const targetElement = this.findDomainTarget(model.target);
572
- if (!targetElement || !targetElement.dataset.key) {
573
- return;
574
- }
575
- const closest = this[calculateNearestPoints](sourceElement, targetElement);
576
- if (!closest) {
577
- return;
578
- }
579
- const sourceRect = getObjectBoundingClientRect(sourceElement, this.workspace);
580
- const targetRect = getObjectBoundingClientRect(targetElement, this.workspace);
581
- const shape = this.lineProcessor.sketch({
582
- source: sourceRect,
583
- target: targetRect,
584
- startPoint: closest[0],
585
- endPoint: closest[1],
586
- type: model.shape.line.type || DefaultLineType,
587
- });
588
- if (!shape || !shape.coordinates) {
589
- return;
590
- }
591
- const [sp] = shape.coordinates;
592
- const ep = shape.coordinates[shape.coordinates.length - 1];
593
- const directions = findDirection(sp, ep, sourceRect, targetRect);
594
- const tips = this.createAssociationTips(assocElement, shape, directions);
595
- model.shape.tips = tips;
596
- this.workspace.requestUpdate();
597
- }
598
- /**
599
- * Updates the `styles` property from an association element.
600
- *
601
- * @param assocElement The viz-association element reference
602
- */
603
- updateEdgeStyles(assocElement) {
604
- const map = this[edgesValue];
605
- const key = assocElement.dataset.key;
606
- if (!key) {
607
- return;
608
- }
609
- if (!map.has(key)) {
610
- return;
611
- }
612
- const model = map.get(key);
613
- model.shape.style = this.createAssociationStyles(assocElement);
614
- this.workspace.requestUpdate();
615
- }
616
- /**
617
- * Updates the selection state of the edge
618
- *
619
- * @param assocElement The viz-association element reference
620
- */
621
- toggleEdgeHighlight(assocElement) {
622
- const map = this[edgesValue];
623
- const key = assocElement.dataset.key;
624
- if (!key) {
625
- return;
626
- }
627
- if (!map.has(key)) {
628
- return;
629
- }
630
- const model = map.get(key);
631
- if (!model.shape.selection) {
632
- model.shape.selection = {};
633
- }
634
- model.shape.selection.primary = assocElement.hasAttribute('data-selected');
635
- this.workspace.requestUpdate();
636
- }
637
- /**
638
- * Updates the selection state of the edge
639
- *
640
- * @param assocElement The viz-association element reference
641
- */
642
- toggleEdgeSecondaryHighlight(assocElement) {
643
- const map = this[edgesValue];
644
- const key = assocElement.dataset.key;
645
- if (!key) {
646
- return;
647
- }
648
- if (!map.has(key)) {
649
- return;
650
- }
651
- const model = map.get(key);
652
- if (!model.shape.selection) {
653
- model.shape.selection = {};
654
- }
655
- model.shape.selection.secondary = assocElement.hasAttribute('secondary-selected');
656
- this.workspace.requestUpdate();
657
- }
658
- /**
659
- * Removes an association edge from the edges list.
660
- * @param associationId The domain id of the association
661
- */
662
- delete(associationId) {
663
- const map = this[edgesValue];
664
- if (!map.has(associationId)) {
665
- return;
666
- }
667
- map.delete(associationId);
668
- this.workspace.requestUpdate();
669
- }
670
- /**
671
- * A function that checks whether the associations reported in this class still exist in the workspace.
672
- */
673
- syncAssociations() {
674
- const map = this[edgesValue];
675
- const { workspace } = this;
676
- let updated = false;
677
- map.forEach((model) => {
678
- const { id, target } = model;
679
- const node = workspace.querySelector(`viz-association[data-key="${id}"]`);
680
- if (!node) {
681
- map.delete(id);
682
- updated = true;
683
- return;
684
- }
685
- const targetNode = this.findDomainTarget(target);
686
- if (!targetNode) {
687
- map.delete(id);
688
- updated = true;
689
- }
690
- });
691
- if (updated) {
692
- workspace.requestUpdate();
693
- }
694
- }
695
- /**
696
- * Searches the DOM for the domain element that has set the `data-key`.
697
- * It takes into the account the `data-delegate-visualization` attribute.
698
- *
699
- * @param target The domain id of the target.
700
- * @returns The domain element or null if not found.
701
- */
702
- findDomainTarget(target) {
703
- const targetElement = this.workspace.querySelector(`[data-key="${target}"]`);
704
- return targetElement;
705
- }
706
- [processQueueDebouncer];
707
- runProcessingQueue() {
708
- const timeout = this[processQueueDebouncer];
709
- if (timeout) {
710
- clearTimeout(timeout);
711
- }
712
- this[processQueueDebouncer] = setTimeout(async () => {
713
- this[processQueueDebouncer] = undefined;
714
- await this.workspace.updateComplete;
715
- this[processQueue].forEach((assoc) => {
716
- const { target } = assoc.dataset;
717
- if (!target) {
718
- return;
719
- }
720
- const targetElement = this.findDomainTarget(target);
721
- if (!targetElement) {
722
- return;
723
- }
724
- this.buildAssociationEdge(assoc, targetElement);
725
- });
726
- this[processQueue] = [];
727
- });
728
- }
729
- /**
730
- * Adds an association element to the rendering queue and runs the queue.
731
- */
732
- queueAssociation(assoc) {
733
- if (this[processQueue].includes(assoc)) {
734
- return;
735
- }
736
- this[processQueue].push(assoc);
737
- this.runProcessingQueue();
738
- }
739
- // PRIVATE APIS
740
- /**
741
- * Observe items change in the element's light DOM
742
- * @returns The observer handler
743
- */
744
- [observeItems]() {
745
- const config = /** @type MutationObserverInit */ {
746
- attributes: true,
747
- childList: true,
748
- subtree: true,
749
- attributeOldValue: true,
750
- };
751
- const observer = new MutationObserver(this[mutationHandler]);
752
- observer.observe(this.workspace, config);
753
- return observer;
754
- }
755
- /**
756
- * Processes mutations in the workspace and manages selection state.
757
- * @param mutationsList List of mutations.
758
- */
759
- async [mutationHandler](mutationsList) {
760
- await this.workspace.updateComplete;
761
- for (const mutation of mutationsList) {
762
- if (mutation.type === 'childList') {
763
- this[processAddedNodes](mutation.addedNodes);
764
- this[processRemovedNodes](mutation.removedNodes);
765
- }
766
- else if (mutation.type === 'attributes') {
767
- this[processAttributeChanged](mutation);
768
- }
769
- }
770
- }
771
- /**
772
- * Processes added to the canvas elements.
773
- * @param nodes The list of added nodes
774
- */
775
- [processAddedNodes](nodes) {
776
- nodes.forEach((node) => {
777
- if (node.nodeType !== Node.ELEMENT_NODE) {
778
- return;
779
- }
780
- const typed = node;
781
- const name = typed.localName;
782
- if (name === 'viz-association') {
783
- this[processAddedAssociation](typed);
784
- }
785
- else {
786
- this[processAddedNode](typed);
787
- }
788
- const children = typed.querySelectorAll('*');
789
- this[processAddedNodes](children);
790
- });
791
- }
792
- /**
793
- * Processes removed from the canvas elements.
794
- * @param nodes The list of removed nodes
795
- */
796
- [processRemovedNodes](nodes) {
797
- nodes.forEach((node) => {
798
- if (node.nodeType !== Node.ELEMENT_NODE) {
799
- return;
800
- }
801
- const typed = node;
802
- const name = typed.localName;
803
- if (name === 'viz-association') {
804
- this[processRemovedAssociation](typed);
805
- }
806
- else {
807
- this[processRemovedNode](typed);
808
- }
809
- const children = typed.querySelectorAll('*');
810
- this[processRemovedNodes](children);
811
- });
812
- this.syncAssociations();
813
- }
814
- /**
815
- * Processes changed attribute on any element in the canvas
816
- * @param mutation The record associated with the change
817
- */
818
- [processAttributeChanged](mutation) {
819
- const att = mutation.attributeName;
820
- // console.log(att);
821
- const nodeName = mutation.target.nodeName.toLowerCase();
822
- const isAssociation = nodeName === 'viz-association';
823
- if (att === 'data-key') {
824
- if (isAssociation) {
825
- const typed = mutation.target;
826
- const old = mutation.oldValue;
827
- const id = typed.dataset.id;
828
- if (old && id && this[edgesValue].has(old)) {
829
- const value = this[edgesValue].get(old);
830
- this[edgesValue].delete(old);
831
- this[edgesValue].set(id, value);
832
- }
833
- else if (old && this[edgesValue].has(old)) {
834
- this.removeEdge(old);
835
- }
836
- }
837
- else {
838
- const typed = mutation.target;
839
- this[processAddedNode](typed);
840
- }
841
- }
842
- else if (isAssociation) {
843
- const typed = mutation.target;
844
- if (att === 'target') {
845
- this[processAddedAssociation](typed);
846
- }
847
- else if (['name', 'displayName'].includes(att)) {
848
- this.updateAssociationLabel(typed);
849
- }
850
- else if (att === 'selected') {
851
- this.toggleEdgeHighlight(typed);
852
- }
853
- else if (att === 'secondary-selected') {
854
- this.toggleEdgeSecondaryHighlight(typed);
855
- }
856
- else if (att === 'data-marker-end') {
857
- this.updateEdgeMarker(typed);
858
- }
859
- else if (att === 'data-style') {
860
- this.updateEdgeStyles(typed);
861
- }
862
- }
863
- }
864
- /**
865
- * If the target exists it creates the model of the association
866
- * and adds it to the associations list.
867
- * If the target is not set the association is ignored.
868
- * If the parent has no `data-key` it is ignored.
869
- * If the target does not exists it is ignored (handled in processAddedNode)
870
- */
871
- [processAddedAssociation](node) {
872
- const { target, key } = node.dataset;
873
- if (!target) {
874
- if (key) {
875
- this.removeEdge(key);
876
- }
877
- return;
878
- }
879
- const targetElement = this.findDomainTarget(target);
880
- if (!targetElement) {
881
- if (key) {
882
- this.removeEdge(key);
883
- }
884
- return;
885
- }
886
- this.queueAssociation(node);
887
- }
888
- /**
889
- * If there is an association that corresponds to the `data-key` of the element
890
- * then it builds the association model.
891
- */
892
- [processAddedNode](node) {
893
- const { key } = node.dataset;
894
- if (!key) {
895
- return;
896
- }
897
- // first add associations that this node has
898
- const nodesAssociations = node.querySelectorAll('viz-association');
899
- Array.from(nodesAssociations).forEach((assocNode) => {
900
- const typed = assocNode;
901
- if (!typed.dataset.target) {
902
- return;
903
- }
904
- const targetElement = this.findDomainTarget(typed.dataset.target);
905
- if (!targetElement) {
906
- return;
907
- }
908
- // this.buildAssociationEdge(typed, targetElement);
909
- this.queueAssociation(typed);
910
- });
911
- // then find association to this node.
912
- const assocElement = this.workspace.querySelector(`viz-association[data-target="${key}"]`);
913
- if (!assocElement) {
914
- return;
915
- }
916
- // this.buildAssociationEdge(assocElement, node);
917
- this.queueAssociation(assocElement);
918
- }
919
- /**
920
- * If the association model exists for this association then it is removed.
921
- */
922
- [processRemovedAssociation](node) {
923
- const { key } = node.dataset;
924
- if (key) {
925
- this.delete(key);
926
- }
927
- }
928
- /**
929
- * If the element has an association then this association is removed.
930
- */
931
- [processRemovedNode](node) {
932
- // first remove associations that this node has
933
- const nodesAssociations = node.querySelectorAll('viz-association');
934
- Array.from(nodesAssociations).forEach((assocNode) => {
935
- const typed = assocNode;
936
- if (typed.dataset.key) {
937
- this.delete(typed.dataset.key);
938
- }
939
- });
940
- // them remove association that this node is connected to
941
- const { key } = node.dataset;
942
- if (!key) {
943
- return;
944
- }
945
- const assocElement = this.workspace.querySelector(`viz-association[data-target="${key}"]`);
946
- if (!assocElement || !assocElement.dataset.key) {
947
- return;
948
- }
949
- this.delete(assocElement.dataset.key);
950
- }
951
- /**
952
- * Handles selection of an association from the SVG element click.
953
- */
954
- [clickHandler](e) {
955
- const typeTarget = this[readEventTarget](e);
956
- if (!typeTarget) {
957
- this[deselectAllEdges]();
958
- return;
959
- }
960
- const { type, id } = typeTarget.dataset;
961
- if (type === 'association' && id) {
962
- this[associationClickHandler](id, e.shiftKey);
963
- }
964
- }
965
- /**
966
- * Handles mouse over event on the SVG element
967
- */
968
- [mouseOverHandler](e) {
969
- const typeTarget = this[readEventTarget](e);
970
- if (!typeTarget) {
971
- return;
972
- }
973
- if (!typeTarget.classList.contains('association-line-area')) {
974
- return;
975
- }
976
- const { id } = typeTarget.dataset;
977
- if (!id) {
978
- return;
979
- }
980
- const item = this.get(id);
981
- if (!item) {
982
- return;
983
- }
984
- if (item.shape.selection) {
985
- item.shape.selection.hover = true;
986
- this.workspace.requestUpdate();
987
- }
988
- }
989
- /**
990
- * Handles mouse out event on the SVG element
991
- */
992
- [mouseOutHandler](e) {
993
- const typeTarget = this[readEventTarget](e);
994
- if (!typeTarget) {
995
- return;
996
- }
997
- if (!typeTarget.classList.contains('association-line-area')) {
998
- return;
999
- }
1000
- const { id } = typeTarget.dataset;
1001
- if (!id) {
1002
- return;
1003
- }
1004
- const item = this.get(id);
1005
- if (!item) {
1006
- return;
1007
- }
1008
- if (item.shape.selection) {
1009
- item.shape.selection.hover = false;
1010
- this.workspace.requestUpdate();
1011
- }
1012
- }
1013
- [readEventTarget](e) {
1014
- let typeTarget;
1015
- const path = e.composedPath();
1016
- while (path.length) {
1017
- const item = path.shift();
1018
- if (item.localName === 'svg') {
1019
- break;
1020
- }
1021
- if (item.dataset.type && item.dataset.id) {
1022
- typeTarget = item;
1023
- break;
1024
- }
1025
- }
1026
- return typeTarget;
1027
- }
1028
- /**
1029
- * Handles the logic when an association visualization was clicked.
1030
- * @param id Association id
1031
- * @param multi Whether multi selection is applied
1032
- */
1033
- [associationClickHandler](id, multi = false) {
1034
- const selectableTarget = this.findDomainTarget(id);
1035
- if (!selectableTarget) {
1036
- return;
1037
- }
1038
- const manager = this.workspace.selection;
1039
- const isSelected = manager.isSelected(selectableTarget);
1040
- if (isSelected) {
1041
- if (multi) {
1042
- manager.setUnselected(selectableTarget);
1043
- }
1044
- return;
1045
- }
1046
- if (!multi) {
1047
- this[deselectAllEdges]();
1048
- manager.deselectAll();
1049
- }
1050
- manager.setSelected(selectableTarget);
1051
- }
1052
- /**
1053
- * Removes selection from all associations
1054
- */
1055
- [deselectAllEdges]() {
1056
- const nodes = this.workspace.querySelectorAll(`viz-association[data-selected]`);
1057
- const manager = this.workspace.selection;
1058
- Array.from(nodes).forEach((node) => {
1059
- manager.setUnselected(node);
1060
- });
1061
- const map = this[edgesValue];
1062
- map.forEach((model) => {
1063
- if (!model.shape.selection) {
1064
- model.shape.selection = {};
1065
- }
1066
- model.shape.selection.primary = false;
1067
- model.shape.selection.secondary = false;
1068
- model.shape.selection.hover = false;
1069
- });
1070
- this.workspace.requestUpdate();
1071
- }
1072
- }
1073
- //# sourceMappingURL=WorkspaceEdges.js.map