@metadev/daga 4.2.9 → 4.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Changelog.md CHANGED
@@ -6,6 +6,17 @@ List of releases and changes.
6
6
 
7
7
  ## Next release Joyeuse
8
8
 
9
+ ## v. 4.2.11
10
+
11
+ - Version branch to avoid error in ng-packagr
12
+ - Ensure that an array remains an array after cloning [#349](https://github.com/metadevpro/daga/pull/349)
13
+ - When checking if a port is being shared, ignore connections that have been removed [#350](https://github.com/metadevpro/daga/pull/350)
14
+ - Create `DiagramZoomEvent` to enable listening to user zooming and panning events [#351](https://github.com/metadevpro/daga/pull/351)
15
+
16
+ ## v. 4.2.10
17
+
18
+ - Fix errors with cloned objects containing functions [#345](https://github.com/metadevpro/daga/pull/345)
19
+
9
20
  ## v. 4.2.9
10
21
 
11
22
  - Enable configuring the text heading the diagram properties component to values other than `'Diagram properties'` [#341](https://github.com/metadevpro/daga/pull/341)
package/index.cjs.js CHANGED
@@ -1186,6 +1186,25 @@ const numberOfRows = s => {
1186
1186
  return ((_a = s.match(/\n/g)) === null || _a === void 0 ? void 0 : _a.length) || 0;
1187
1187
  };
1188
1188
 
1189
+ /**
1190
+ * Clones an object with support for functions.
1191
+ * @private
1192
+ */
1193
+ const clone = o => {
1194
+ if (typeof o !== 'object') {
1195
+ return o;
1196
+ }
1197
+ const res = {};
1198
+ for (const e of Object.entries(o)) {
1199
+ if (typeof e[1] === 'object') {
1200
+ res[e[0]] = clone(e[1]);
1201
+ } else {
1202
+ res[e[0]] = e[1];
1203
+ }
1204
+ }
1205
+ return res;
1206
+ };
1207
+
1189
1208
  /******************************************************************************
1190
1209
  Copyright (c) Microsoft Corporation.
1191
1210
 
@@ -2050,7 +2069,7 @@ class ValueSet {
2050
2069
  if (property.type === exports.Type.Object) {
2051
2070
  this.valueSets[key] = this.constructSubValueSet(key);
2052
2071
  } else {
2053
- this.values[key] = structuredClone(property.defaultValue);
2072
+ this.values[key] = clone(property.defaultValue);
2054
2073
  }
2055
2074
  if (rootAttribute !== undefined && rootAttribute !== null) {
2056
2075
  if (property.defaultValue !== undefined && !equals(this.getRootElementValue(rootAttribute), property.defaultValue)) {
@@ -2074,7 +2093,7 @@ class ValueSet {
2074
2093
  const property = this.propertySet.getProperty(key);
2075
2094
  const propertySet = new PropertySet(property.properties);
2076
2095
  const valueSet = new ValueSet(propertySet, this.rootElement);
2077
- valueSet.overwriteValues(structuredClone(property.defaultValue));
2096
+ valueSet.overwriteValues(clone(property.defaultValue));
2078
2097
  return valueSet;
2079
2098
  }
2080
2099
  /**
@@ -2510,18 +2529,18 @@ class DiagramConnection extends DiagramElement {
2510
2529
  // alternative start port not valid, it doesn't allow outgoing connections
2511
2530
  continue checkAlternativeStartPorts;
2512
2531
  }
2513
- if (!allowSharingPorts && (alternativeStartPort.incomingConnections.length === 1 && alternativeStartPort.incomingConnections[0] !== this || alternativeStartPort.incomingConnections.length > 1 || alternativeStartPort.outgoingConnections.length === 1 && alternativeStartPort.outgoingConnections[0] !== this || alternativeStartPort.outgoingConnections.length > 1)) {
2532
+ if (!allowSharingPorts && (alternativeStartPort.incomingConnections.filter(c => !c.removed && c !== this).length > 0 || alternativeStartPort.outgoingConnections.filter(c => !c.removed && c !== this).length > 0)) {
2514
2533
  // alternative start port not valid, it already has other connections
2515
2534
  continue checkAlternativeStartPorts;
2516
2535
  }
2517
2536
  if (!allowSharingBothPorts) {
2518
- for (const connection of alternativeStartPort.outgoingConnections) {
2537
+ for (const connection of alternativeStartPort.outgoingConnections.filter(c => !c.removed)) {
2519
2538
  if (connection !== this && connection.end === this.end) {
2520
2539
  // alternative start port not valid, there is a connection whose start and end matches the alternative start port and this connection's end
2521
2540
  continue checkAlternativeStartPorts;
2522
2541
  }
2523
2542
  }
2524
- for (const connection of alternativeStartPort.incomingConnections) {
2543
+ for (const connection of alternativeStartPort.incomingConnections.filter(c => !c.removed)) {
2525
2544
  if (connection !== this && connection.start === this.end) {
2526
2545
  // alternative start port not valid, there is a connection whose start and end matches the alternative start port and this connection's end
2527
2546
  continue checkAlternativeStartPorts;
@@ -2548,18 +2567,18 @@ class DiagramConnection extends DiagramElement {
2548
2567
  // alternative end port not valid, it doesn't allow incoming connections
2549
2568
  continue checkAlternativeEndPorts;
2550
2569
  }
2551
- if (!allowSharingPorts && (alternativeEndPort.outgoingConnections.length === 1 && alternativeEndPort.outgoingConnections[0] !== this || alternativeEndPort.outgoingConnections.length > 1 || alternativeEndPort.incomingConnections.length === 1 && alternativeEndPort.incomingConnections[0] !== this || alternativeEndPort.incomingConnections.length > 1)) {
2570
+ if (!allowSharingPorts && (alternativeEndPort.incomingConnections.filter(c => !c.removed && c !== this).length > 0 || alternativeEndPort.outgoingConnections.filter(c => !c.removed && c !== this).length > 0)) {
2552
2571
  // alternative end port not valid, it already has other connections
2553
2572
  continue checkAlternativeEndPorts;
2554
2573
  }
2555
2574
  if (!allowSharingBothPorts) {
2556
- for (const connection of alternativeEndPort.incomingConnections) {
2575
+ for (const connection of alternativeEndPort.incomingConnections.filter(c => !c.removed)) {
2557
2576
  if (connection !== this && connection.start === this.start) {
2558
2577
  // alternative end port not valid, there is a connection whose start and end matches the alternative end port and this connection's start
2559
2578
  continue checkAlternativeEndPorts;
2560
2579
  }
2561
2580
  }
2562
- for (const connection of alternativeEndPort.outgoingConnections) {
2581
+ for (const connection of alternativeEndPort.outgoingConnections.filter(c => !c.removed)) {
2563
2582
  if (connection !== this && connection.end === this.start) {
2564
2583
  // alternative end port not valid, there is a connection whose start and end matches the alternative end port and this connection's start
2565
2584
  continue checkAlternativeEndPorts;
@@ -5080,7 +5099,7 @@ class AddNodeCollabAction {
5080
5099
  node.label.text = this.label || '';
5081
5100
  }
5082
5101
  if (this.values !== undefined) {
5083
- node.valueSet.setValues(structuredClone(Object.assign(Object.assign({}, node.valueSet.getValues()), this.values)));
5102
+ node.valueSet.setValues(clone(Object.assign(Object.assign({}, node.valueSet.getValues()), this.values)));
5084
5103
  } else {
5085
5104
  node.valueSet.resetValues();
5086
5105
  }
@@ -6282,11 +6301,27 @@ class DiagramEvent {
6282
6301
  */
6283
6302
  exports.DiagramEvents = void 0;
6284
6303
  (function (DiagramEvents) {
6285
- DiagramEvents[DiagramEvents["DoubleClick"] = 0] = "DoubleClick";
6286
- DiagramEvents[DiagramEvents["SecondaryClick"] = 1] = "SecondaryClick";
6287
- DiagramEvents[DiagramEvents["Selection"] = 2] = "Selection";
6288
- DiagramEvents[DiagramEvents["Highlight"] = 3] = "Highlight";
6304
+ DiagramEvents[DiagramEvents["Zoom"] = 0] = "Zoom";
6305
+ DiagramEvents[DiagramEvents["DoubleClick"] = 1] = "DoubleClick";
6306
+ DiagramEvents[DiagramEvents["SecondaryClick"] = 2] = "SecondaryClick";
6307
+ DiagramEvents[DiagramEvents["Selection"] = 3] = "Selection";
6308
+ DiagramEvents[DiagramEvents["Highlight"] = 4] = "Highlight";
6289
6309
  })(exports.DiagramEvents || (exports.DiagramEvents = {}));
6310
+ /**
6311
+ * Diagram event which consists of the user zooming or panning.
6312
+ */
6313
+ class DiagramZoomEvent extends DiagramEvent {
6314
+ /**
6315
+ * Create a diagram zoom event.
6316
+ *
6317
+ * @param coords .
6318
+ */
6319
+ constructor(coords, zoom) {
6320
+ super(exports.DiagramEvents.Zoom);
6321
+ this.coords = coords;
6322
+ this.zoom = zoom;
6323
+ }
6324
+ }
6290
6325
  /**
6291
6326
  * Diagram event which consists of the user performing a double click on the diagram.
6292
6327
  */
@@ -7307,7 +7342,7 @@ class DiagramUserSelection extends DiagramElementSet {
7307
7342
  if (selectedValueSet) {
7308
7343
  this.propertyEditorSelection = selection;
7309
7344
  if (makeUpdateValuesAction) {
7310
- this.propertyEditorValues = structuredClone(selectedValueSet.getValues());
7345
+ this.propertyEditorValues = clone(selectedValueSet.getValues());
7311
7346
  }
7312
7347
  if (propertyEditor) {
7313
7348
  if (selection instanceof DiagramNode || selection instanceof DiagramConnection) {
@@ -7351,7 +7386,7 @@ class DiagramUserSelection extends DiagramElementSet {
7351
7386
  return;
7352
7387
  }
7353
7388
  const from = this.propertyEditorValues;
7354
- const to = structuredClone((_b = this.propertyEditorSelection) === null || _b === void 0 ? void 0 : _b.valueSet.getValues());
7389
+ const to = clone((_b = this.propertyEditorSelection) === null || _b === void 0 ? void 0 : _b.valueSet.getValues());
7355
7390
  const [fromDiff, toDiff] = diffProperties(from, to, (_c = this.propertyEditorSelection) === null || _c === void 0 ? void 0 : _c.valueSet);
7356
7391
  const currentAction = new UpdateValuesAction(this.canvas, previousSelectionId, fromDiff, toDiff);
7357
7392
  currentAction.do();
@@ -7678,6 +7713,7 @@ class DiagramCanvas {
7678
7713
  this.selectCanvasElements().attr('transform', transformAttribute);
7679
7714
  d3__namespace.select(`#${this.backgroundPatternId}`).attr('patternTransform', transformAttribute);
7680
7715
  this.contextMenu.close();
7716
+ this.diagramEvent$.next(new DiagramZoomEvent([this.zoomTransform.x, this.zoomTransform.y], this.zoomTransform.k));
7681
7717
  }).on(exports.ZoomEvents.End, () => {
7682
7718
  setCursorStyle();
7683
7719
  }));
@@ -8338,7 +8374,7 @@ class DiagramCanvas {
8338
8374
  if (this.multipleSelectionOn || this.secondaryButton) {
8339
8375
  this.startMultipleSelection(event);
8340
8376
  } else {
8341
- if (this.canUserPerformAction(exports.DiagramActions.AddConnection) && (this.allowSharingPorts || d.incomingConnections.length === 0 && d.outgoingConnections.length === 0) && !d.removed) {
8377
+ if (this.canUserPerformAction(exports.DiagramActions.AddConnection) && (this.allowSharingPorts || d.incomingConnections.filter(c => !c.removed).length === 0 && d.outgoingConnections.filter(c => !c.removed).length === 0) && !d.removed) {
8342
8378
  setCursorStyle(exports.CursorStyle.Grabbing);
8343
8379
  this.startConnection(d);
8344
8380
  // should be true after having called this.startConnection()
@@ -9088,13 +9124,13 @@ class DiagramCanvas {
9088
9124
  this.dropConnection();
9089
9125
  return;
9090
9126
  }
9091
- if (!this.allowSharingPorts && (port.incomingConnections.length > 0 || port.outgoingConnections.length > 0)) {
9127
+ if (!this.allowSharingPorts && (port.incomingConnections.filter(c => !c.removed).length > 0 || port.outgoingConnections.filter(c => !c.removed).length > 0)) {
9092
9128
  this.dropConnection();
9093
9129
  return;
9094
9130
  }
9095
9131
  if (!this.allowSharingBothPorts && this.model.connections.find(c => {
9096
9132
  var _a, _b;
9097
- return c.start === ((_a = this.unfinishedConnection) === null || _a === void 0 ? void 0 : _a.start) && c.end === port || c.end === ((_b = this.unfinishedConnection) === null || _b === void 0 ? void 0 : _b.start) && c.start === port;
9133
+ return !c.removed && (c.start === ((_a = this.unfinishedConnection) === null || _a === void 0 ? void 0 : _a.start) && c.end === port || c.end === ((_b = this.unfinishedConnection) === null || _b === void 0 ? void 0 : _b.start) && c.start === port);
9098
9134
  }) !== undefined) {
9099
9135
  this.dropConnection();
9100
9136
  return;
@@ -10306,6 +10342,7 @@ exports.DiagramSectionSet = DiagramSectionSet;
10306
10342
  exports.DiagramSelectionEvent = DiagramSelectionEvent;
10307
10343
  exports.DiagramUserHighlight = DiagramUserHighlight;
10308
10344
  exports.DiagramUserSelection = DiagramUserSelection;
10345
+ exports.DiagramZoomEvent = DiagramZoomEvent;
10309
10346
  exports.EditFieldAction = EditFieldAction;
10310
10347
  exports.ForceLayout = ForceLayout;
10311
10348
  exports.HorizontalLayout = HorizontalLayout;
package/index.esm.js CHANGED
@@ -1165,6 +1165,25 @@ const numberOfRows = s => {
1165
1165
  return ((_a = s.match(/\n/g)) === null || _a === void 0 ? void 0 : _a.length) || 0;
1166
1166
  };
1167
1167
 
1168
+ /**
1169
+ * Clones an object with support for functions.
1170
+ * @private
1171
+ */
1172
+ const clone = o => {
1173
+ if (typeof o !== 'object') {
1174
+ return o;
1175
+ }
1176
+ const res = {};
1177
+ for (const e of Object.entries(o)) {
1178
+ if (typeof e[1] === 'object') {
1179
+ res[e[0]] = clone(e[1]);
1180
+ } else {
1181
+ res[e[0]] = e[1];
1182
+ }
1183
+ }
1184
+ return res;
1185
+ };
1186
+
1168
1187
  /******************************************************************************
1169
1188
  Copyright (c) Microsoft Corporation.
1170
1189
 
@@ -2029,7 +2048,7 @@ class ValueSet {
2029
2048
  if (property.type === Type.Object) {
2030
2049
  this.valueSets[key] = this.constructSubValueSet(key);
2031
2050
  } else {
2032
- this.values[key] = structuredClone(property.defaultValue);
2051
+ this.values[key] = clone(property.defaultValue);
2033
2052
  }
2034
2053
  if (rootAttribute !== undefined && rootAttribute !== null) {
2035
2054
  if (property.defaultValue !== undefined && !equals(this.getRootElementValue(rootAttribute), property.defaultValue)) {
@@ -2053,7 +2072,7 @@ class ValueSet {
2053
2072
  const property = this.propertySet.getProperty(key);
2054
2073
  const propertySet = new PropertySet(property.properties);
2055
2074
  const valueSet = new ValueSet(propertySet, this.rootElement);
2056
- valueSet.overwriteValues(structuredClone(property.defaultValue));
2075
+ valueSet.overwriteValues(clone(property.defaultValue));
2057
2076
  return valueSet;
2058
2077
  }
2059
2078
  /**
@@ -2489,18 +2508,18 @@ class DiagramConnection extends DiagramElement {
2489
2508
  // alternative start port not valid, it doesn't allow outgoing connections
2490
2509
  continue checkAlternativeStartPorts;
2491
2510
  }
2492
- if (!allowSharingPorts && (alternativeStartPort.incomingConnections.length === 1 && alternativeStartPort.incomingConnections[0] !== this || alternativeStartPort.incomingConnections.length > 1 || alternativeStartPort.outgoingConnections.length === 1 && alternativeStartPort.outgoingConnections[0] !== this || alternativeStartPort.outgoingConnections.length > 1)) {
2511
+ if (!allowSharingPorts && (alternativeStartPort.incomingConnections.filter(c => !c.removed && c !== this).length > 0 || alternativeStartPort.outgoingConnections.filter(c => !c.removed && c !== this).length > 0)) {
2493
2512
  // alternative start port not valid, it already has other connections
2494
2513
  continue checkAlternativeStartPorts;
2495
2514
  }
2496
2515
  if (!allowSharingBothPorts) {
2497
- for (const connection of alternativeStartPort.outgoingConnections) {
2516
+ for (const connection of alternativeStartPort.outgoingConnections.filter(c => !c.removed)) {
2498
2517
  if (connection !== this && connection.end === this.end) {
2499
2518
  // alternative start port not valid, there is a connection whose start and end matches the alternative start port and this connection's end
2500
2519
  continue checkAlternativeStartPorts;
2501
2520
  }
2502
2521
  }
2503
- for (const connection of alternativeStartPort.incomingConnections) {
2522
+ for (const connection of alternativeStartPort.incomingConnections.filter(c => !c.removed)) {
2504
2523
  if (connection !== this && connection.start === this.end) {
2505
2524
  // alternative start port not valid, there is a connection whose start and end matches the alternative start port and this connection's end
2506
2525
  continue checkAlternativeStartPorts;
@@ -2527,18 +2546,18 @@ class DiagramConnection extends DiagramElement {
2527
2546
  // alternative end port not valid, it doesn't allow incoming connections
2528
2547
  continue checkAlternativeEndPorts;
2529
2548
  }
2530
- if (!allowSharingPorts && (alternativeEndPort.outgoingConnections.length === 1 && alternativeEndPort.outgoingConnections[0] !== this || alternativeEndPort.outgoingConnections.length > 1 || alternativeEndPort.incomingConnections.length === 1 && alternativeEndPort.incomingConnections[0] !== this || alternativeEndPort.incomingConnections.length > 1)) {
2549
+ if (!allowSharingPorts && (alternativeEndPort.incomingConnections.filter(c => !c.removed && c !== this).length > 0 || alternativeEndPort.outgoingConnections.filter(c => !c.removed && c !== this).length > 0)) {
2531
2550
  // alternative end port not valid, it already has other connections
2532
2551
  continue checkAlternativeEndPorts;
2533
2552
  }
2534
2553
  if (!allowSharingBothPorts) {
2535
- for (const connection of alternativeEndPort.incomingConnections) {
2554
+ for (const connection of alternativeEndPort.incomingConnections.filter(c => !c.removed)) {
2536
2555
  if (connection !== this && connection.start === this.start) {
2537
2556
  // alternative end port not valid, there is a connection whose start and end matches the alternative end port and this connection's start
2538
2557
  continue checkAlternativeEndPorts;
2539
2558
  }
2540
2559
  }
2541
- for (const connection of alternativeEndPort.outgoingConnections) {
2560
+ for (const connection of alternativeEndPort.outgoingConnections.filter(c => !c.removed)) {
2542
2561
  if (connection !== this && connection.end === this.start) {
2543
2562
  // alternative end port not valid, there is a connection whose start and end matches the alternative end port and this connection's start
2544
2563
  continue checkAlternativeEndPorts;
@@ -5059,7 +5078,7 @@ class AddNodeCollabAction {
5059
5078
  node.label.text = this.label || '';
5060
5079
  }
5061
5080
  if (this.values !== undefined) {
5062
- node.valueSet.setValues(structuredClone(Object.assign(Object.assign({}, node.valueSet.getValues()), this.values)));
5081
+ node.valueSet.setValues(clone(Object.assign(Object.assign({}, node.valueSet.getValues()), this.values)));
5063
5082
  } else {
5064
5083
  node.valueSet.resetValues();
5065
5084
  }
@@ -6261,11 +6280,27 @@ class DiagramEvent {
6261
6280
  */
6262
6281
  var DiagramEvents;
6263
6282
  (function (DiagramEvents) {
6264
- DiagramEvents[DiagramEvents["DoubleClick"] = 0] = "DoubleClick";
6265
- DiagramEvents[DiagramEvents["SecondaryClick"] = 1] = "SecondaryClick";
6266
- DiagramEvents[DiagramEvents["Selection"] = 2] = "Selection";
6267
- DiagramEvents[DiagramEvents["Highlight"] = 3] = "Highlight";
6283
+ DiagramEvents[DiagramEvents["Zoom"] = 0] = "Zoom";
6284
+ DiagramEvents[DiagramEvents["DoubleClick"] = 1] = "DoubleClick";
6285
+ DiagramEvents[DiagramEvents["SecondaryClick"] = 2] = "SecondaryClick";
6286
+ DiagramEvents[DiagramEvents["Selection"] = 3] = "Selection";
6287
+ DiagramEvents[DiagramEvents["Highlight"] = 4] = "Highlight";
6268
6288
  })(DiagramEvents || (DiagramEvents = {}));
6289
+ /**
6290
+ * Diagram event which consists of the user zooming or panning.
6291
+ */
6292
+ class DiagramZoomEvent extends DiagramEvent {
6293
+ /**
6294
+ * Create a diagram zoom event.
6295
+ *
6296
+ * @param coords .
6297
+ */
6298
+ constructor(coords, zoom) {
6299
+ super(DiagramEvents.Zoom);
6300
+ this.coords = coords;
6301
+ this.zoom = zoom;
6302
+ }
6303
+ }
6269
6304
  /**
6270
6305
  * Diagram event which consists of the user performing a double click on the diagram.
6271
6306
  */
@@ -7286,7 +7321,7 @@ class DiagramUserSelection extends DiagramElementSet {
7286
7321
  if (selectedValueSet) {
7287
7322
  this.propertyEditorSelection = selection;
7288
7323
  if (makeUpdateValuesAction) {
7289
- this.propertyEditorValues = structuredClone(selectedValueSet.getValues());
7324
+ this.propertyEditorValues = clone(selectedValueSet.getValues());
7290
7325
  }
7291
7326
  if (propertyEditor) {
7292
7327
  if (selection instanceof DiagramNode || selection instanceof DiagramConnection) {
@@ -7330,7 +7365,7 @@ class DiagramUserSelection extends DiagramElementSet {
7330
7365
  return;
7331
7366
  }
7332
7367
  const from = this.propertyEditorValues;
7333
- const to = structuredClone((_b = this.propertyEditorSelection) === null || _b === void 0 ? void 0 : _b.valueSet.getValues());
7368
+ const to = clone((_b = this.propertyEditorSelection) === null || _b === void 0 ? void 0 : _b.valueSet.getValues());
7334
7369
  const [fromDiff, toDiff] = diffProperties(from, to, (_c = this.propertyEditorSelection) === null || _c === void 0 ? void 0 : _c.valueSet);
7335
7370
  const currentAction = new UpdateValuesAction(this.canvas, previousSelectionId, fromDiff, toDiff);
7336
7371
  currentAction.do();
@@ -7657,6 +7692,7 @@ class DiagramCanvas {
7657
7692
  this.selectCanvasElements().attr('transform', transformAttribute);
7658
7693
  d3.select(`#${this.backgroundPatternId}`).attr('patternTransform', transformAttribute);
7659
7694
  this.contextMenu.close();
7695
+ this.diagramEvent$.next(new DiagramZoomEvent([this.zoomTransform.x, this.zoomTransform.y], this.zoomTransform.k));
7660
7696
  }).on(ZoomEvents.End, () => {
7661
7697
  setCursorStyle();
7662
7698
  }));
@@ -8317,7 +8353,7 @@ class DiagramCanvas {
8317
8353
  if (this.multipleSelectionOn || this.secondaryButton) {
8318
8354
  this.startMultipleSelection(event);
8319
8355
  } else {
8320
- if (this.canUserPerformAction(DiagramActions.AddConnection) && (this.allowSharingPorts || d.incomingConnections.length === 0 && d.outgoingConnections.length === 0) && !d.removed) {
8356
+ if (this.canUserPerformAction(DiagramActions.AddConnection) && (this.allowSharingPorts || d.incomingConnections.filter(c => !c.removed).length === 0 && d.outgoingConnections.filter(c => !c.removed).length === 0) && !d.removed) {
8321
8357
  setCursorStyle(CursorStyle.Grabbing);
8322
8358
  this.startConnection(d);
8323
8359
  // should be true after having called this.startConnection()
@@ -9067,13 +9103,13 @@ class DiagramCanvas {
9067
9103
  this.dropConnection();
9068
9104
  return;
9069
9105
  }
9070
- if (!this.allowSharingPorts && (port.incomingConnections.length > 0 || port.outgoingConnections.length > 0)) {
9106
+ if (!this.allowSharingPorts && (port.incomingConnections.filter(c => !c.removed).length > 0 || port.outgoingConnections.filter(c => !c.removed).length > 0)) {
9071
9107
  this.dropConnection();
9072
9108
  return;
9073
9109
  }
9074
9110
  if (!this.allowSharingBothPorts && this.model.connections.find(c => {
9075
9111
  var _a, _b;
9076
- return c.start === ((_a = this.unfinishedConnection) === null || _a === void 0 ? void 0 : _a.start) && c.end === port || c.end === ((_b = this.unfinishedConnection) === null || _b === void 0 ? void 0 : _b.start) && c.start === port;
9112
+ return !c.removed && (c.start === ((_a = this.unfinishedConnection) === null || _a === void 0 ? void 0 : _a.start) && c.end === port || c.end === ((_b = this.unfinishedConnection) === null || _b === void 0 ? void 0 : _b.start) && c.start === port);
9077
9113
  }) !== undefined) {
9078
9114
  this.dropConnection();
9079
9115
  return;
@@ -10243,4 +10279,4 @@ const getLocationsOfNodes = model => {
10243
10279
  return locations;
10244
10280
  };
10245
10281
 
10246
- export { ACTION_STACK_SIZE, ActionStack, AddConnectionAction, AddNodeAction, AdjacencyLayout, ApplyLayoutAction, BreadthAdjacencyLayout, BreadthLayout, ClosedShape, CollabClient, Corner, CursorStyle, DIAGRAM_FIELD_DEFAULTS, DagaExporter, DagaImporter, DiagramActionMethod, DiagramActions, DiagramCanvas, DiagramConnection, DiagramConnectionSet, DiagramConnectionType, DiagramContextMenu, DiagramDecorator, DiagramDecoratorSet, DiagramDoubleClickEvent, DiagramElement, DiagramElementSet, DiagramEntitySet, DiagramEvent, DiagramEvents, DiagramField, DiagramFieldSet, DiagramHighlightedEvent, DiagramModel, DiagramNode, DiagramNodeSet, DiagramNodeType, DiagramObject, DiagramObjectSet, DiagramPort, DiagramPortSet, DiagramPortType, DiagramSecondaryClickEvent, DiagramSection, DiagramSectionSet, DiagramSelectionEvent, DiagramUserHighlight, DiagramUserSelection, DragEvents, EditFieldAction, Events, ForceLayout, HorizontalAlign, HorizontalLayout, Keys, LineShape, LineStyle, MoveAction, PasteAction, PriorityLayout, Property, PropertySet, RemoveAction, SetGeometryAction, SetParentAction, Side, TreeLayout, Type, UpdateValuesAction, ValueSet, VerticalAlign, VerticalLayout, ZoomEvents, addIfNotExists, diff, equals, filterByOnlyAncestors, filterByOnlyDescendants, generalClosedPath, getBottomMargin, getBottomPadding$1 as getBottomPadding, getLeftMargin, getLeftPadding$1 as getLeftPadding, getLocationsOfNodes, getRightMargin, getRightPadding$1 as getRightPadding, getTopMargin, getTopPadding$1 as getTopPadding, isObject, layouts, linePath, lineStyleDasharray, removeIfExists, setCursorStyle };
10282
+ export { ACTION_STACK_SIZE, ActionStack, AddConnectionAction, AddNodeAction, AdjacencyLayout, ApplyLayoutAction, BreadthAdjacencyLayout, BreadthLayout, ClosedShape, CollabClient, Corner, CursorStyle, DIAGRAM_FIELD_DEFAULTS, DagaExporter, DagaImporter, DiagramActionMethod, DiagramActions, DiagramCanvas, DiagramConnection, DiagramConnectionSet, DiagramConnectionType, DiagramContextMenu, DiagramDecorator, DiagramDecoratorSet, DiagramDoubleClickEvent, DiagramElement, DiagramElementSet, DiagramEntitySet, DiagramEvent, DiagramEvents, DiagramField, DiagramFieldSet, DiagramHighlightedEvent, DiagramModel, DiagramNode, DiagramNodeSet, DiagramNodeType, DiagramObject, DiagramObjectSet, DiagramPort, DiagramPortSet, DiagramPortType, DiagramSecondaryClickEvent, DiagramSection, DiagramSectionSet, DiagramSelectionEvent, DiagramUserHighlight, DiagramUserSelection, DiagramZoomEvent, DragEvents, EditFieldAction, Events, ForceLayout, HorizontalAlign, HorizontalLayout, Keys, LineShape, LineStyle, MoveAction, PasteAction, PriorityLayout, Property, PropertySet, RemoveAction, SetGeometryAction, SetParentAction, Side, TreeLayout, Type, UpdateValuesAction, ValueSet, VerticalAlign, VerticalLayout, ZoomEvents, addIfNotExists, diff, equals, filterByOnlyAncestors, filterByOnlyDescendants, generalClosedPath, getBottomMargin, getBottomPadding$1 as getBottomPadding, getLeftMargin, getLeftPadding$1 as getLeftPadding, getLocationsOfNodes, getRightMargin, getRightPadding$1 as getRightPadding, getTopMargin, getTopPadding$1 as getTopPadding, isObject, layouts, linePath, lineStyleDasharray, removeIfExists, setCursorStyle };
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@metadev/daga",
3
- "version": "4.2.9",
3
+ "version": "4.2.11",
4
4
  "dependencies": {},
5
5
  "peerDependencies": {
6
6
  "d3": "^7.9.0",
7
7
  "rxjs": "~7.8.1",
8
- "uuid": "^11.0.3"
8
+ "uuid": "^13.0.0"
9
9
  },
10
10
  "main": "./index.cjs.js",
11
11
  "typings": "./src/index.d.ts",
package/src/index.d.ts CHANGED
@@ -18,7 +18,7 @@ export type { DiagramModelExporter } from './lib/diagram/converters/diagram-mode
18
18
  export type { DiagramModelImporter } from './lib/diagram/converters/diagram-model-importer';
19
19
  export { ActionStack, AddConnectionAction, AddNodeAction, ApplyLayoutAction, DiagramActionMethod, DiagramActions, EditFieldAction, MoveAction, PasteAction, RemoveAction, SetGeometryAction, SetParentAction, UpdateValuesAction } from './lib/diagram/diagram-action';
20
20
  export type { DiagramAction } from './lib/diagram/diagram-action';
21
- export { DiagramDoubleClickEvent, DiagramEvent, DiagramEvents, DiagramHighlightedEvent, DiagramSecondaryClickEvent, DiagramSelectionEvent } from './lib/diagram/diagram-event';
21
+ export { DiagramDoubleClickEvent, DiagramEvent, DiagramEvents, DiagramHighlightedEvent, DiagramSecondaryClickEvent, DiagramSelectionEvent, DiagramZoomEvent } from './lib/diagram/diagram-event';
22
22
  export { AdjacencyLayout } from './lib/diagram/layout/adjacency-layout';
23
23
  export { BreadthAdjacencyLayout } from './lib/diagram/layout/breadth-adjacency-layout';
24
24
  export { BreadthLayout } from './lib/diagram/layout/breadth-layout';
@@ -16,10 +16,24 @@ export declare abstract class DiagramEvent {
16
16
  * @public
17
17
  */
18
18
  export declare enum DiagramEvents {
19
- DoubleClick = 0,
20
- SecondaryClick = 1,
21
- Selection = 2,
22
- Highlight = 3
19
+ Zoom = 0,
20
+ DoubleClick = 1,
21
+ SecondaryClick = 2,
22
+ Selection = 3,
23
+ Highlight = 4
24
+ }
25
+ /**
26
+ * Diagram event which consists of the user zooming or panning.
27
+ */
28
+ export declare class DiagramZoomEvent extends DiagramEvent {
29
+ coords: Point;
30
+ zoom: number;
31
+ /**
32
+ * Create a diagram zoom event.
33
+ *
34
+ * @param coords .
35
+ */
36
+ constructor(coords: Point, zoom: number);
23
37
  }
24
38
  /**
25
39
  * Diagram event which consists of the user performing a double click on the diagram.
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Clones an object with support for functions.
3
+ * @private
4
+ */
5
+ export declare const clone: <T>(o: T) => T;
@@ -1,9 +1,4 @@
1
1
  import { DiagramConfig } from '../diagram/config/diagram-config';
2
- /**
3
- * Creates the structuredClone function if it doesn't exist.
4
- * @private
5
- */
6
- export declare const createStructuredClone: () => void;
7
2
  /**
8
3
  * Generic diagram configuration used for testing.
9
4
  * @private