@metadev/daga 4.1.0 → 4.2.0

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/index.esm.js CHANGED
@@ -804,7 +804,7 @@ const numberOfColumns = s => {
804
804
  };
805
805
  const numberOfRows = s => {
806
806
  var _a;
807
- return ((_a = s.match(/\n/g)) === null || _a === undefined ? undefined : _a.length) || 0;
807
+ return ((_a = s.match(/\n/g)) === null || _a === void 0 ? void 0 : _a.length) || 0;
808
808
  };
809
809
 
810
810
  /******************************************************************************
@@ -1030,14 +1030,14 @@ class DiagramElement {
1030
1030
  */
1031
1031
  get highlighted() {
1032
1032
  var _a, _b;
1033
- return ((_b = (_a = this.model.canvas) === null || _a === undefined ? undefined : _a.userHighlight) === null || _b === undefined ? undefined : _b.contains(this.id)) || false;
1033
+ return ((_b = (_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.userHighlight) === null || _b === void 0 ? void 0 : _b.contains(this.id)) || false;
1034
1034
  }
1035
1035
  /**
1036
1036
  * Whether this diagram element is currently in the user selection.
1037
1037
  */
1038
1038
  get selected() {
1039
1039
  var _a, _b;
1040
- return ((_b = (_a = this.model.canvas) === null || _a === undefined ? undefined : _a.userSelection) === null || _b === undefined ? undefined : _b.contains(this.id)) || false;
1040
+ return ((_b = (_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.userSelection) === null || _b === void 0 ? void 0 : _b.contains(this.id)) || false;
1041
1041
  }
1042
1042
  constructor(model, id) {
1043
1043
  /**
@@ -1066,7 +1066,7 @@ class DiagramElement {
1066
1066
  */
1067
1067
  select() {
1068
1068
  var _a, _b;
1069
- return (_b = (_a = this.model.canvas) === null || _a === undefined ? undefined : _a.selectCanvasView()) === null || _b === undefined ? undefined : _b.select(`[id='${escapeSelector(this.id)}']`);
1069
+ return (_b = (_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.selectCanvasView()) === null || _b === void 0 ? void 0 : _b.select(`[id='${escapeSelector(this.id)}']`);
1070
1070
  }
1071
1071
  }
1072
1072
  class DiagramElementSet extends DiagramEntitySet {
@@ -1464,7 +1464,7 @@ class ValueSet {
1464
1464
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1465
1465
  getValue(key) {
1466
1466
  var _a;
1467
- const rootAttribute = (_a = this.propertySet.getProperty(key)) === null || _a === undefined ? undefined : _a.rootAttribute;
1467
+ const rootAttribute = (_a = this.propertySet.getProperty(key)) === null || _a === void 0 ? void 0 : _a.rootAttribute;
1468
1468
  if (rootAttribute !== undefined && rootAttribute !== null) {
1469
1469
  this.values[key] = this.getRootElementValue(rootAttribute);
1470
1470
  }
@@ -1549,7 +1549,7 @@ class ValueSet {
1549
1549
  if (property && property.type === Type.Object) {
1550
1550
  return this.getSubValueSet(key).hasAnySetValue();
1551
1551
  }
1552
- return !empty(value) && !equals(value, property === null || property === undefined ? undefined : property.defaultValue);
1552
+ return !empty(value) && !equals(value, property === null || property === void 0 ? void 0 : property.defaultValue);
1553
1553
  }
1554
1554
  /**
1555
1555
  * Checks if any of the values in the set are not empty or the default value.
@@ -1816,7 +1816,7 @@ class DiagramConnection extends DiagramElement {
1816
1816
  }
1817
1817
  set type(type) {
1818
1818
  var _a, _b;
1819
- (_b = (_a = this.model.canvas) === null || _a === undefined ? undefined : _a.userSelection) === null || _b === undefined ? undefined : _b.openInPropertyEditor(undefined);
1819
+ (_b = (_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.userSelection) === null || _b === void 0 ? void 0 : _b.openInPropertyEditor(undefined);
1820
1820
  this._type = type;
1821
1821
  if (this.valueSet) {
1822
1822
  this.valueSet = new ValueSet(type.propertySet, this);
@@ -2005,11 +2005,11 @@ class DiagramConnection extends DiagramElement {
2005
2005
  }
2006
2006
  updateInView() {
2007
2007
  var _a;
2008
- (_a = this.model.canvas) === null || _a === undefined ? undefined : _a.updateConnectionsInView(this.id);
2008
+ (_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.updateConnectionsInView(this.id);
2009
2009
  }
2010
2010
  raise() {
2011
2011
  var _a;
2012
- (_a = this.select()) === null || _a === undefined ? undefined : _a.raise();
2012
+ (_a = this.select()) === null || _a === void 0 ? void 0 : _a.raise();
2013
2013
  }
2014
2014
  /**
2015
2015
  * Set the start of this connection to the given port or reset this connection's starting port if `undefined`.
@@ -2025,12 +2025,12 @@ class DiagramConnection extends DiagramElement {
2025
2025
  this.start = start;
2026
2026
  if (start !== undefined) {
2027
2027
  start.outgoingConnections.push(this);
2028
- this.startDirection = start === null || start === undefined ? undefined : start.direction;
2029
- this.startCoords = (start === null || start === undefined ? undefined : start.connectionPoint) || [0, 0];
2028
+ this.startDirection = start === null || start === void 0 ? void 0 : start.direction;
2029
+ this.startCoords = (start === null || start === void 0 ? void 0 : start.connectionPoint) || [0, 0];
2030
2030
  }
2031
2031
  } else {
2032
- this.startDirection = start === null || start === undefined ? undefined : start.direction;
2033
- this.startCoords = (start === null || start === undefined ? undefined : start.connectionPoint) || [0, 0];
2032
+ this.startDirection = start === null || start === void 0 ? void 0 : start.direction;
2033
+ this.startCoords = (start === null || start === void 0 ? void 0 : start.connectionPoint) || [0, 0];
2034
2034
  }
2035
2035
  this.updateInView();
2036
2036
  }
@@ -2048,12 +2048,12 @@ class DiagramConnection extends DiagramElement {
2048
2048
  this.end = end;
2049
2049
  if (end !== undefined) {
2050
2050
  end.incomingConnections.push(this);
2051
- this.endDirection = end === null || end === undefined ? undefined : end.direction;
2052
- this.endCoords = (end === null || end === undefined ? undefined : end.connectionPoint) || [0, 0];
2051
+ this.endDirection = end === null || end === void 0 ? void 0 : end.direction;
2052
+ this.endCoords = (end === null || end === void 0 ? void 0 : end.connectionPoint) || [0, 0];
2053
2053
  }
2054
2054
  } else {
2055
- this.endDirection = end === null || end === undefined ? undefined : end.direction;
2056
- this.endCoords = (end === null || end === undefined ? undefined : end.connectionPoint) || [0, 0];
2055
+ this.endDirection = end === null || end === void 0 ? void 0 : end.direction;
2056
+ this.endCoords = (end === null || end === void 0 ? void 0 : end.connectionPoint) || [0, 0];
2057
2057
  }
2058
2058
  this.updateInView();
2059
2059
  }
@@ -2064,7 +2064,7 @@ class DiagramConnection extends DiagramElement {
2064
2064
  */
2065
2065
  tighten() {
2066
2066
  var _a, _b;
2067
- if (((_a = this.start) === null || _a === undefined ? undefined : _a.rootElement) && this.end) {
2067
+ if (((_a = this.start) === null || _a === void 0 ? void 0 : _a.rootElement) && this.end) {
2068
2068
  const alternativeStartPortsSortedByDistanceAscending = this.start.rootElement.ports.map(p => [p, p.distanceTo(this.end.coords)]).sort((a, b) => a[1] - b[1]).map(a => a[0]);
2069
2069
  checkAlternativeStartPorts: for (const alternativeStartPort of alternativeStartPortsSortedByDistanceAscending) {
2070
2070
  if (alternativeStartPort === this.end) {
@@ -2098,7 +2098,7 @@ class DiagramConnection extends DiagramElement {
2098
2098
  }
2099
2099
  }
2100
2100
  }
2101
- if (((_b = this.end) === null || _b === undefined ? undefined : _b.rootElement) && this.start) {
2101
+ if (((_b = this.end) === null || _b === void 0 ? void 0 : _b.rootElement) && this.start) {
2102
2102
  const alternativeEndPortsSortedByDistanceAscending = this.end.rootElement.ports.map(p => [p, p.distanceTo(this.start.coords)]).sort((a, b) => a[1] - b[1]).map(a => a[0]);
2103
2103
  checkAlternativeEndPorts: for (const alternativeEndPort of alternativeEndPortsSortedByDistanceAscending) {
2104
2104
  if (alternativeEndPort === this.start) {
@@ -2194,8 +2194,8 @@ class DiagramConnectionSet extends DiagramElementSet {
2194
2194
  const connection = this.get(id, true);
2195
2195
  if (connection) {
2196
2196
  // remove from ports
2197
- removeIfExists(((_a = connection.start) === null || _a === undefined ? undefined : _a.outgoingConnections) || [], connection);
2198
- removeIfExists(((_b = connection.end) === null || _b === undefined ? undefined : _b.incomingConnections) || [], connection);
2197
+ removeIfExists(((_a = connection.start) === null || _a === void 0 ? void 0 : _a.outgoingConnections) || [], connection);
2198
+ removeIfExists(((_b = connection.end) === null || _b === void 0 ? void 0 : _b.incomingConnections) || [], connection);
2199
2199
  // remove from set of connections
2200
2200
  super.remove(id);
2201
2201
  // remove from canvas
@@ -2219,6 +2219,7 @@ const DIAGRAM_FIELD_DEFAULTS = {
2219
2219
  selectedColor: '#000000',
2220
2220
  horizontalAlign: HorizontalAlign.Center,
2221
2221
  verticalAlign: VerticalAlign.Center,
2222
+ orientation: Side.Top,
2222
2223
  fit: false
2223
2224
  };
2224
2225
  /**
@@ -2238,17 +2239,17 @@ class DiagramField extends DiagramElement {
2238
2239
  }
2239
2240
  set text(value) {
2240
2241
  var _a;
2241
- if (value === null || value === undefined || (value === null || value === undefined ? undefined : value.trim()) === '') {
2242
+ if (value === null || value === undefined || (value === null || value === void 0 ? void 0 : value.trim()) === '') {
2242
2243
  value = this.defaultText;
2243
2244
  }
2244
2245
  this._text = value;
2245
2246
  this.updateInView();
2246
2247
  if (this.fit) {
2247
- (_a = this.model.canvas) === null || _a === undefined ? undefined : _a.fitFieldRootInView(this.id);
2248
+ (_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.fitFieldRootInView(this.id);
2248
2249
  }
2249
2250
  }
2250
- constructor(model, rootElement, coords, width, height, fontSize, fontFamily, color, selectedColor, horizontalAlign, verticalAlign, text, editable, fit) {
2251
- const id = `${rootElement === null || rootElement === undefined ? undefined : rootElement.id}_field`;
2251
+ constructor(model, rootElement, coords, width, height, fontSize, fontFamily, color, selectedColor, horizontalAlign, verticalAlign, orientation, text, editable, fit) {
2252
+ const id = `${rootElement === null || rootElement === void 0 ? void 0 : rootElement.id}_field`;
2252
2253
  if (model.fields.get(id) !== undefined) {
2253
2254
  throw new Error('DiagramField for rootElement already exists');
2254
2255
  }
@@ -2268,6 +2269,7 @@ class DiagramField extends DiagramElement {
2268
2269
  this.selectedColor = selectedColor;
2269
2270
  this.horizontalAlign = horizontalAlign;
2270
2271
  this.verticalAlign = verticalAlign;
2272
+ this.orientation = orientation;
2271
2273
  this.defaultText = text;
2272
2274
  this._text = text;
2273
2275
  this.editable = editable;
@@ -2278,11 +2280,11 @@ class DiagramField extends DiagramElement {
2278
2280
  }
2279
2281
  updateInView() {
2280
2282
  var _a;
2281
- (_a = this.model.canvas) === null || _a === undefined ? undefined : _a.updateFieldsInView(this.id);
2283
+ (_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.updateFieldsInView(this.id);
2282
2284
  }
2283
2285
  raise() {
2284
2286
  var _a;
2285
- (_a = this.select()) === null || _a === undefined ? undefined : _a.raise();
2287
+ (_a = this.select()) === null || _a === void 0 ? void 0 : _a.raise();
2286
2288
  }
2287
2289
  /**
2288
2290
  * Change the coordinates of this field to the given coordinates.
@@ -2295,7 +2297,7 @@ class DiagramField extends DiagramElement {
2295
2297
  }
2296
2298
  getPriority() {
2297
2299
  var _a;
2298
- return ((_a = this.rootElement) === null || _a === undefined ? undefined : _a.getPriority()) || DEFAULT_PRIORITY;
2300
+ return ((_a = this.rootElement) === null || _a === void 0 ? void 0 : _a.getPriority()) || DEFAULT_PRIORITY;
2299
2301
  }
2300
2302
  }
2301
2303
  class DiagramFieldSet extends DiagramElementSet {
@@ -2311,8 +2313,8 @@ class DiagramFieldSet extends DiagramElementSet {
2311
2313
  * Instance a new field and add it to this set. This method is normally called when instancing an element with a field and it is rarely called by itself.
2312
2314
  * @private
2313
2315
  */
2314
- new(rootElement, coords, fontSize, fontFamily, color, selectedColor, width, height, horizontalAlign, verticalAlign, text, editable, fit) {
2315
- const field = new DiagramField(this.model, rootElement, coords, width, height, fontSize, fontFamily, color, selectedColor, horizontalAlign, verticalAlign, text, editable, fit);
2316
+ new(rootElement, coords, fontSize, fontFamily, color, selectedColor, width, height, horizontalAlign, verticalAlign, orientation, text, editable, fit) {
2317
+ const field = new DiagramField(this.model, rootElement, coords, width, height, fontSize, fontFamily, color, selectedColor, horizontalAlign, verticalAlign, orientation, text, editable, fit);
2316
2318
  super.add(field);
2317
2319
  field.updateInView();
2318
2320
  // add this field to its root element
@@ -2326,7 +2328,7 @@ class DiagramFieldSet extends DiagramElementSet {
2326
2328
  const field = this.get(id, true);
2327
2329
  if (field) {
2328
2330
  // remove from root element
2329
- if (((_a = field.rootElement) === null || _a === undefined ? undefined : _a.label) !== undefined) {
2331
+ if (((_a = field.rootElement) === null || _a === void 0 ? void 0 : _a.label) !== undefined) {
2330
2332
  if (field.rootElement.label === field) {
2331
2333
  field.rootElement.label = undefined;
2332
2334
  }
@@ -2339,7 +2341,7 @@ class DiagramFieldSet extends DiagramElementSet {
2339
2341
  }
2340
2342
  }
2341
2343
  const getBottomMargin = config => {
2342
- if ((config === null || config === undefined ? undefined : config.margin) === null || (config === null || config === undefined ? undefined : config.margin) === undefined) {
2344
+ if ((config === null || config === void 0 ? void 0 : config.margin) === null || (config === null || config === void 0 ? void 0 : config.margin) === undefined) {
2343
2345
  return DIAGRAM_FIELD_DEFAULTS.margin;
2344
2346
  } else if (typeof config.margin === 'number') {
2345
2347
  return config.margin;
@@ -2358,7 +2360,7 @@ const getBottomMargin = config => {
2358
2360
  }
2359
2361
  };
2360
2362
  const getLeftMargin = config => {
2361
- if ((config === null || config === undefined ? undefined : config.margin) === null || (config === null || config === undefined ? undefined : config.margin) === undefined) {
2363
+ if ((config === null || config === void 0 ? void 0 : config.margin) === null || (config === null || config === void 0 ? void 0 : config.margin) === undefined) {
2362
2364
  return DIAGRAM_FIELD_DEFAULTS.margin;
2363
2365
  } else if (typeof config.margin === 'number') {
2364
2366
  return config.margin;
@@ -2377,7 +2379,7 @@ const getLeftMargin = config => {
2377
2379
  }
2378
2380
  };
2379
2381
  const getRightMargin = config => {
2380
- if ((config === null || config === undefined ? undefined : config.margin) === null || (config === null || config === undefined ? undefined : config.margin) === undefined) {
2382
+ if ((config === null || config === void 0 ? void 0 : config.margin) === null || (config === null || config === void 0 ? void 0 : config.margin) === undefined) {
2381
2383
  return DIAGRAM_FIELD_DEFAULTS.margin;
2382
2384
  } else if (typeof config.margin === 'number') {
2383
2385
  return config.margin;
@@ -2396,7 +2398,7 @@ const getRightMargin = config => {
2396
2398
  }
2397
2399
  };
2398
2400
  const getTopMargin = config => {
2399
- if ((config === null || config === undefined ? undefined : config.margin) === null || (config === null || config === undefined ? undefined : config.margin) === undefined) {
2401
+ if ((config === null || config === void 0 ? void 0 : config.margin) === null || (config === null || config === void 0 ? void 0 : config.margin) === undefined) {
2400
2402
  return DIAGRAM_FIELD_DEFAULTS.margin;
2401
2403
  } else if (typeof config.margin === 'number') {
2402
2404
  return config.margin;
@@ -2415,7 +2417,7 @@ const getTopMargin = config => {
2415
2417
  }
2416
2418
  };
2417
2419
  const getBottomPadding$1 = config => {
2418
- if ((config === null || config === undefined ? undefined : config.padding) === null || (config === null || config === undefined ? undefined : config.padding) === undefined) {
2420
+ if ((config === null || config === void 0 ? void 0 : config.padding) === null || (config === null || config === void 0 ? void 0 : config.padding) === undefined) {
2419
2421
  return DIAGRAM_FIELD_DEFAULTS.padding;
2420
2422
  } else if (typeof config.padding === 'number') {
2421
2423
  return config.padding;
@@ -2434,7 +2436,7 @@ const getBottomPadding$1 = config => {
2434
2436
  }
2435
2437
  };
2436
2438
  const getLeftPadding$1 = config => {
2437
- if ((config === null || config === undefined ? undefined : config.padding) === null || (config === null || config === undefined ? undefined : config.padding) === undefined) {
2439
+ if ((config === null || config === void 0 ? void 0 : config.padding) === null || (config === null || config === void 0 ? void 0 : config.padding) === undefined) {
2438
2440
  return DIAGRAM_FIELD_DEFAULTS.padding;
2439
2441
  } else if (typeof config.padding === 'number') {
2440
2442
  return config.padding;
@@ -2453,7 +2455,7 @@ const getLeftPadding$1 = config => {
2453
2455
  }
2454
2456
  };
2455
2457
  const getRightPadding$1 = config => {
2456
- if ((config === null || config === undefined ? undefined : config.padding) === null || (config === null || config === undefined ? undefined : config.padding) === undefined) {
2458
+ if ((config === null || config === void 0 ? void 0 : config.padding) === null || (config === null || config === void 0 ? void 0 : config.padding) === undefined) {
2457
2459
  return DIAGRAM_FIELD_DEFAULTS.padding;
2458
2460
  } else if (typeof config.padding === 'number') {
2459
2461
  return config.padding;
@@ -2472,7 +2474,7 @@ const getRightPadding$1 = config => {
2472
2474
  }
2473
2475
  };
2474
2476
  const getTopPadding$1 = config => {
2475
- if ((config === null || config === undefined ? undefined : config.padding) === null || (config === null || config === undefined ? undefined : config.padding) === undefined) {
2477
+ if ((config === null || config === void 0 ? void 0 : config.padding) === null || (config === null || config === void 0 ? void 0 : config.padding) === undefined) {
2476
2478
  return DIAGRAM_FIELD_DEFAULTS.padding;
2477
2479
  } else if (typeof config.padding === 'number') {
2478
2480
  return config.padding;
@@ -2564,7 +2566,7 @@ class DiagramSection extends DiagramElement {
2564
2566
  */
2565
2567
  get name() {
2566
2568
  var _a;
2567
- return ((_a = this.label) === null || _a === undefined ? undefined : _a.text) || '';
2569
+ return ((_a = this.label) === null || _a === void 0 ? void 0 : _a.text) || '';
2568
2570
  }
2569
2571
  set name(name) {
2570
2572
  if (this.label) {
@@ -2579,15 +2581,15 @@ class DiagramSection extends DiagramElement {
2579
2581
  var _a, _b, _c, _d, _e, _f, _g, _h;
2580
2582
  if (this.selected) {
2581
2583
  if (this.highlighted) {
2582
- return this._selectedAndHighlightedLook !== undefined ? this._selectedAndHighlightedLook : ((_a = this.type) === null || _a === undefined ? undefined : _a.selectedAndHighlightedLook) || ((_b = this.node) === null || _b === undefined ? undefined : _b.look);
2584
+ return this._selectedAndHighlightedLook !== undefined ? this._selectedAndHighlightedLook : ((_a = this.type) === null || _a === void 0 ? void 0 : _a.selectedAndHighlightedLook) || ((_b = this.node) === null || _b === void 0 ? void 0 : _b.look);
2583
2585
  } else {
2584
- return this._selectedLook !== undefined ? this._selectedLook : ((_c = this.type) === null || _c === undefined ? undefined : _c.selectedLook) || ((_d = this.node) === null || _d === undefined ? undefined : _d.look);
2586
+ return this._selectedLook !== undefined ? this._selectedLook : ((_c = this.type) === null || _c === void 0 ? void 0 : _c.selectedLook) || ((_d = this.node) === null || _d === void 0 ? void 0 : _d.look);
2585
2587
  }
2586
2588
  } else {
2587
2589
  if (this.highlighted) {
2588
- return this._highlightedLook !== undefined ? this._highlightedLook : ((_e = this.type) === null || _e === undefined ? undefined : _e.highlightedLook) || ((_f = this.node) === null || _f === undefined ? undefined : _f.look);
2590
+ return this._highlightedLook !== undefined ? this._highlightedLook : ((_e = this.type) === null || _e === void 0 ? void 0 : _e.highlightedLook) || ((_f = this.node) === null || _f === void 0 ? void 0 : _f.look);
2589
2591
  } else {
2590
- return this._defaultLook !== undefined ? this._defaultLook : ((_g = this.type) === null || _g === undefined ? undefined : _g.defaultLook) || ((_h = this.node) === null || _h === undefined ? undefined : _h.look);
2592
+ return this._defaultLook !== undefined ? this._defaultLook : ((_g = this.type) === null || _g === void 0 ? void 0 : _g.defaultLook) || ((_h = this.node) === null || _h === void 0 ? void 0 : _h.look);
2591
2593
  }
2592
2594
  }
2593
2595
  }
@@ -2640,11 +2642,11 @@ class DiagramSection extends DiagramElement {
2640
2642
  }
2641
2643
  updateInView() {
2642
2644
  var _a;
2643
- (_a = this.model.canvas) === null || _a === undefined ? undefined : _a.updateSectionsInView(this.id);
2645
+ (_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.updateSectionsInView(this.id);
2644
2646
  }
2645
2647
  raise() {
2646
2648
  var _a;
2647
- (_a = this.select()) === null || _a === undefined ? undefined : _a.raise();
2649
+ (_a = this.select()) === null || _a === void 0 ? void 0 : _a.raise();
2648
2650
  if (this.label) {
2649
2651
  this.label.raise();
2650
2652
  }
@@ -2657,19 +2659,19 @@ class DiagramSection extends DiagramElement {
2657
2659
  }
2658
2660
  get type() {
2659
2661
  var _a, _b, _c, _d, _e;
2660
- return (_e = (_d = (_c = (_b = (_a = this.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.sectionGrid) === null || _c === undefined ? undefined : _c.sections) === null || _d === undefined ? undefined : _d[this.indexYInNode]) === null || _e === undefined ? undefined : _e[this.indexXInNode];
2662
+ return (_e = (_d = (_c = (_b = (_a = this.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.sectionGrid) === null || _c === void 0 ? void 0 : _c.sections) === null || _d === void 0 ? void 0 : _d[this.indexYInNode]) === null || _e === void 0 ? void 0 : _e[this.indexXInNode];
2661
2663
  }
2662
2664
  getMinWidth() {
2663
2665
  var _a, _b, _c, _d;
2664
- return ((_d = (_c = (_b = (_a = this.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.sectionGrid) === null || _c === undefined ? undefined : _c.minWidths) === null || _d === undefined ? undefined : _d[this.indexXInNode]) || DIAGRAM_SECTION_MIN_WIDTH;
2666
+ return ((_d = (_c = (_b = (_a = this.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.sectionGrid) === null || _c === void 0 ? void 0 : _c.minWidths) === null || _d === void 0 ? void 0 : _d[this.indexXInNode]) || DIAGRAM_SECTION_MIN_WIDTH;
2665
2667
  }
2666
2668
  getMinHeight() {
2667
2669
  var _a, _b, _c, _d;
2668
- return ((_d = (_c = (_b = (_a = this.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.sectionGrid) === null || _c === undefined ? undefined : _c.minHeights) === null || _d === undefined ? undefined : _d[this.indexYInNode]) || DIAGRAM_SECTION_MIN_HEIGHT;
2670
+ return ((_d = (_c = (_b = (_a = this.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.sectionGrid) === null || _c === void 0 ? void 0 : _c.minHeights) === null || _d === void 0 ? void 0 : _d[this.indexYInNode]) || DIAGRAM_SECTION_MIN_HEIGHT;
2669
2671
  }
2670
2672
  getPriority() {
2671
2673
  var _a, _b, _c, _d, _e, _f;
2672
- return ((_f = (_e = (_d = (_c = (_b = (_a = this.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.sectionGrid) === null || _c === undefined ? undefined : _c.sections) === null || _d === undefined ? undefined : _d[this.indexYInNode]) === null || _e === undefined ? undefined : _e[this.indexXInNode]) === null || _f === undefined ? undefined : _f.priority) || DEFAULT_PRIORITY;
2674
+ return ((_f = (_e = (_d = (_c = (_b = (_a = this.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.sectionGrid) === null || _c === void 0 ? void 0 : _c.sections) === null || _d === void 0 ? void 0 : _d[this.indexYInNode]) === null || _e === void 0 ? void 0 : _e[this.indexXInNode]) === null || _f === void 0 ? void 0 : _f.priority) || DEFAULT_PRIORITY;
2673
2675
  }
2674
2676
  /**
2675
2677
  * Get the port of this section which is closest to the given coordinates.
@@ -2834,9 +2836,9 @@ class DiagramSection extends DiagramElement {
2834
2836
  // Set label's dimensions as a function of ours.
2835
2837
  const type = this.type;
2836
2838
  if (this.label) {
2837
- this.label.coords = [this.coords[0] + getLeftMargin(type === null || type === undefined ? undefined : type.label), this.coords[1] + getTopMargin(type === null || type === undefined ? undefined : type.label)];
2838
- this.label.width = this.width - getLeftMargin(type === null || type === undefined ? undefined : type.label) - getRightMargin(type === null || type === undefined ? undefined : type.label);
2839
- this.label.height = this.height - getTopMargin(type === null || type === undefined ? undefined : type.label) - getBottomMargin(type === null || type === undefined ? undefined : type.label);
2839
+ this.label.coords = [this.coords[0] + getLeftMargin(type === null || type === void 0 ? void 0 : type.label), this.coords[1] + getTopMargin(type === null || type === void 0 ? void 0 : type.label)];
2840
+ this.label.width = this.width - getLeftMargin(type === null || type === void 0 ? void 0 : type.label) - getRightMargin(type === null || type === void 0 ? void 0 : type.label);
2841
+ this.label.height = this.height - getTopMargin(type === null || type === void 0 ? void 0 : type.label) - getBottomMargin(type === null || type === void 0 ? void 0 : type.label);
2840
2842
  this.label.updateInView();
2841
2843
  }
2842
2844
  // Move decorators to match the new coords.
@@ -2870,13 +2872,13 @@ class DiagramSectionSet extends DiagramElementSet {
2870
2872
  node.sections.push(section);
2871
2873
  node.updateInView();
2872
2874
  // add section ports
2873
- const sectionPorts = (_d = (_c = (_b = (_a = node.type.sectionGrid) === null || _a === undefined ? undefined : _a.sections) === null || _b === undefined ? undefined : _b[indexYInNode]) === null || _c === undefined ? undefined : _c[indexXInNode]) === null || _d === undefined ? undefined : _d.ports;
2875
+ const sectionPorts = (_d = (_c = (_b = (_a = node.type.sectionGrid) === null || _a === void 0 ? void 0 : _a.sections) === null || _b === void 0 ? void 0 : _b[indexYInNode]) === null || _c === void 0 ? void 0 : _c[indexXInNode]) === null || _d === void 0 ? void 0 : _d.ports;
2874
2876
  if (sectionPorts && sectionPorts.length > 0) {
2875
2877
  for (let i = 0; i < sectionPorts.length; ++i) {
2876
2878
  const portConfig = sectionPorts[i];
2877
- const port = this.model.ports.new(portConfig.type !== undefined ? this.model.ports.types.get(portConfig.type) : undefined, section, [section.coords[0] + (portConfig.coords[0] || 0), section.coords[1] + (portConfig.coords[1] || 0)], portConfig.connectionPoint !== undefined ? [section.coords[0] + (portConfig.connectionPoint[0] || 0), section.coords[1] + (portConfig.connectionPoint[1] || 0)] : undefined, portConfig === null || portConfig === undefined ? undefined : portConfig.direction, `${section.id}_${i}`);
2878
- if ((_e = port.type) === null || _e === undefined ? undefined : _e.label) {
2879
- const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), (_f = port.type) === null || _f === undefined ? undefined : _f.label);
2879
+ const port = this.model.ports.new(portConfig.type !== undefined ? this.model.ports.types.get(portConfig.type) : undefined, section, [section.coords[0] + (portConfig.coords[0] || 0), section.coords[1] + (portConfig.coords[1] || 0)], portConfig.connectionPoint !== undefined ? [section.coords[0] + (portConfig.connectionPoint[0] || 0), section.coords[1] + (portConfig.connectionPoint[1] || 0)] : undefined, portConfig === null || portConfig === void 0 ? void 0 : portConfig.direction, `${section.id}_${i}`);
2880
+ if ((_e = port.type) === null || _e === void 0 ? void 0 : _e.label) {
2881
+ const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), (_f = port.type) === null || _f === void 0 ? void 0 : _f.label);
2880
2882
  const labelWidth = 6 * labelConfiguration.fontSize + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
2881
2883
  const labelHeight = labelConfiguration.fontSize + getTopPadding$1(labelConfiguration) + getBottomPadding$1(labelConfiguration);
2882
2884
  let labelCoords;
@@ -2892,15 +2894,15 @@ class DiagramSectionSet extends DiagramElementSet {
2892
2894
  default:
2893
2895
  labelCoords = port.coords;
2894
2896
  }
2895
- this.model.fields.new(port, labelCoords, labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelWidth, labelHeight, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, '', labelConfiguration.editable, labelConfiguration.fit);
2897
+ this.model.fields.new(port, labelCoords, labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelWidth, labelHeight, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, '', labelConfiguration.editable, labelConfiguration.fit);
2896
2898
  }
2897
2899
  }
2898
2900
  }
2899
2901
  // add section label
2900
- const sectionLabel = (_k = (_j = (_h = (_g = node.type.sectionGrid) === null || _g === undefined ? undefined : _g.sections) === null || _h === undefined ? undefined : _h[indexYInNode]) === null || _j === undefined ? undefined : _j[indexXInNode]) === null || _k === undefined ? undefined : _k.label;
2902
+ const sectionLabel = (_k = (_j = (_h = (_g = node.type.sectionGrid) === null || _g === void 0 ? void 0 : _g.sections) === null || _h === void 0 ? void 0 : _h[indexYInNode]) === null || _j === void 0 ? void 0 : _j[indexXInNode]) === null || _k === void 0 ? void 0 : _k.label;
2901
2903
  if (sectionLabel) {
2902
2904
  const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), sectionLabel);
2903
- this.model.fields.new(section, [section.coords[0] + getLeftMargin(labelConfiguration), section.coords[1] + getTopMargin(labelConfiguration)], labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, section.width - getLeftMargin(labelConfiguration) - getRightMargin(labelConfiguration), section.height - getTopMargin(labelConfiguration) - getBottomMargin(labelConfiguration), labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, '', labelConfiguration.editable, labelConfiguration.fit);
2905
+ this.model.fields.new(section, [section.coords[0] + getLeftMargin(labelConfiguration), section.coords[1] + getTopMargin(labelConfiguration)], labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, section.width - getLeftMargin(labelConfiguration) - getRightMargin(labelConfiguration), section.height - getTopMargin(labelConfiguration) - getBottomMargin(labelConfiguration), labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, '', labelConfiguration.editable, labelConfiguration.fit);
2904
2906
  }
2905
2907
  return section;
2906
2908
  }
@@ -3004,7 +3006,7 @@ class DiagramNodeType {
3004
3006
  this.canBeParentless = values.canBeParentless;
3005
3007
  this.childrenTypes = values.childrenTypes;
3006
3008
  this.priority = values.priority;
3007
- this.propertySet = new PropertySet((options === null || options === undefined ? undefined : options.properties) || []);
3009
+ this.propertySet = new PropertySet((options === null || options === void 0 ? void 0 : options.properties) || []);
3008
3010
  }
3009
3011
  }
3010
3012
  /**
@@ -3020,7 +3022,7 @@ class DiagramNode extends DiagramElement {
3020
3022
  }
3021
3023
  set type(type) {
3022
3024
  var _a, _b;
3023
- (_b = (_a = this.model.canvas) === null || _a === undefined ? undefined : _a.userSelection) === null || _b === undefined ? undefined : _b.openInPropertyEditor(undefined);
3025
+ (_b = (_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.userSelection) === null || _b === void 0 ? void 0 : _b.openInPropertyEditor(undefined);
3024
3026
  this._type = type;
3025
3027
  if (this.valueSet) {
3026
3028
  this.valueSet = new ValueSet(type.propertySet, this);
@@ -3042,7 +3044,7 @@ class DiagramNode extends DiagramElement {
3042
3044
  */
3043
3045
  get name() {
3044
3046
  var _a;
3045
- return ((_a = this.label) === null || _a === undefined ? undefined : _a.text) || '';
3047
+ return ((_a = this.label) === null || _a === void 0 ? void 0 : _a.text) || '';
3046
3048
  }
3047
3049
  set name(name) {
3048
3050
  if (this.label) {
@@ -3132,11 +3134,11 @@ class DiagramNode extends DiagramElement {
3132
3134
  }
3133
3135
  updateInView() {
3134
3136
  var _a;
3135
- (_a = this.model.canvas) === null || _a === undefined ? undefined : _a.updateNodesInView(this.id);
3137
+ (_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.updateNodesInView(this.id);
3136
3138
  }
3137
3139
  raise() {
3138
3140
  var _a;
3139
- (_a = this.select()) === null || _a === undefined ? undefined : _a.raise();
3141
+ (_a = this.select()) === null || _a === void 0 ? void 0 : _a.raise();
3140
3142
  for (const section of this.sections) {
3141
3143
  section.raise();
3142
3144
  }
@@ -3243,7 +3245,7 @@ class DiagramNode extends DiagramElement {
3243
3245
  if (!includeRemoved && incomingConnection.removed) {
3244
3246
  continue;
3245
3247
  }
3246
- const otherNode = (_a = incomingConnection.start) === null || _a === undefined ? undefined : _a.getNode();
3248
+ const otherNode = (_a = incomingConnection.start) === null || _a === void 0 ? void 0 : _a.getNode();
3247
3249
  if (otherNode) {
3248
3250
  if (!includeRemoved && otherNode.removed) {
3249
3251
  continue;
@@ -3255,7 +3257,7 @@ class DiagramNode extends DiagramElement {
3255
3257
  if (!includeRemoved && outgoingConnection.removed) {
3256
3258
  continue;
3257
3259
  }
3258
- const otherNode = (_b = outgoingConnection.end) === null || _b === undefined ? undefined : _b.getNode();
3260
+ const otherNode = (_b = outgoingConnection.end) === null || _b === void 0 ? void 0 : _b.getNode();
3259
3261
  if (otherNode) {
3260
3262
  if (!includeRemoved && otherNode.removed) {
3261
3263
  continue;
@@ -3274,7 +3276,7 @@ class DiagramNode extends DiagramElement {
3274
3276
  // eslint-disable-next-line @typescript-eslint/no-this-alias
3275
3277
  let node = this;
3276
3278
  while (node.parent !== undefined) {
3277
- node = node === null || node === undefined ? undefined : node.parent;
3279
+ node = node === null || node === void 0 ? void 0 : node.parent;
3278
3280
  }
3279
3281
  return node;
3280
3282
  }
@@ -3585,7 +3587,7 @@ class DiagramNode extends DiagramElement {
3585
3587
  */
3586
3588
  removeSectionColumn(columnIndex) {
3587
3589
  var _a;
3588
- const margin = ((_a = this.type.sectionGrid) === null || _a === undefined ? undefined : _a.margin) || 0;
3590
+ const margin = ((_a = this.type.sectionGrid) === null || _a === void 0 ? void 0 : _a.margin) || 0;
3589
3591
  let columnWidth = 0;
3590
3592
  const sections = [...this.sections];
3591
3593
  for (const section of sections) {
@@ -3608,7 +3610,7 @@ class DiagramNode extends DiagramElement {
3608
3610
  */
3609
3611
  removeSectionRow(rowIndex) {
3610
3612
  var _a;
3611
- const margin = ((_a = this.type.sectionGrid) === null || _a === undefined ? undefined : _a.margin) || 0;
3613
+ const margin = ((_a = this.type.sectionGrid) === null || _a === void 0 ? void 0 : _a.margin) || 0;
3612
3614
  let rowHeight = 0;
3613
3615
  const sections = [...this.sections];
3614
3616
  for (const section of sections) {
@@ -3631,7 +3633,7 @@ class DiagramNode extends DiagramElement {
3631
3633
  */
3632
3634
  copySectionColumn(columnIndex) {
3633
3635
  var _a;
3634
- const margin = ((_a = this.type.sectionGrid) === null || _a === undefined ? undefined : _a.margin) || 0;
3636
+ const margin = ((_a = this.type.sectionGrid) === null || _a === void 0 ? void 0 : _a.margin) || 0;
3635
3637
  let columnWidth = 0;
3636
3638
  const sections = [...this.sections];
3637
3639
  for (const section of sections) {
@@ -3658,7 +3660,7 @@ class DiagramNode extends DiagramElement {
3658
3660
  */
3659
3661
  copySectionRow(rowIndex) {
3660
3662
  var _a;
3661
- const margin = ((_a = this.type.sectionGrid) === null || _a === undefined ? undefined : _a.margin) || 0;
3663
+ const margin = ((_a = this.type.sectionGrid) === null || _a === void 0 ? void 0 : _a.margin) || 0;
3662
3664
  let rowHeight = 0;
3663
3665
  const sections = [...this.sections];
3664
3666
  for (const section of sections) {
@@ -3724,10 +3726,10 @@ class DiagramNodeSet extends DiagramElementSet {
3724
3726
  for (let j = 0; j < nodeType.sectionGrid.sections.length; ++j) {
3725
3727
  let widthAccumulator = node.coords[0] + (nodeType.sectionGrid.margin || 0);
3726
3728
  for (let i = 0; i < nodeType.sectionGrid.sections[j].length; ++i) {
3727
- this.model.sections.new(node, i, j, [widthAccumulator, heightAccumulator], ((_a = nodeType.sectionGrid.defaultWidths) === null || _a === undefined ? undefined : _a[i]) || DIAGRAM_SECTION_DEFAULT_WIDTH, ((_b = nodeType.sectionGrid.defaultHeights) === null || _b === undefined ? undefined : _b[j]) || DIAGRAM_SECTION_DEFAULT_HEIGHT, `${node.id}_${j}_${i}`);
3728
- widthAccumulator += (((_c = nodeType.sectionGrid.defaultWidths) === null || _c === undefined ? undefined : _c[i]) || DIAGRAM_SECTION_DEFAULT_WIDTH) + (nodeType.sectionGrid.margin || 0);
3729
+ this.model.sections.new(node, i, j, [widthAccumulator, heightAccumulator], ((_a = nodeType.sectionGrid.defaultWidths) === null || _a === void 0 ? void 0 : _a[i]) || DIAGRAM_SECTION_DEFAULT_WIDTH, ((_b = nodeType.sectionGrid.defaultHeights) === null || _b === void 0 ? void 0 : _b[j]) || DIAGRAM_SECTION_DEFAULT_HEIGHT, `${node.id}_${j}_${i}`);
3730
+ widthAccumulator += (((_c = nodeType.sectionGrid.defaultWidths) === null || _c === void 0 ? void 0 : _c[i]) || DIAGRAM_SECTION_DEFAULT_WIDTH) + (nodeType.sectionGrid.margin || 0);
3729
3731
  }
3730
- heightAccumulator += (((_d = nodeType.sectionGrid.defaultHeights) === null || _d === undefined ? undefined : _d[j]) || DIAGRAM_SECTION_DEFAULT_HEIGHT) + (nodeType.sectionGrid.margin || 0);
3732
+ heightAccumulator += (((_d = nodeType.sectionGrid.defaultHeights) === null || _d === void 0 ? void 0 : _d[j]) || DIAGRAM_SECTION_DEFAULT_HEIGHT) + (nodeType.sectionGrid.margin || 0);
3731
3733
  }
3732
3734
  }
3733
3735
  // add node ports
@@ -3736,8 +3738,8 @@ class DiagramNodeSet extends DiagramElementSet {
3736
3738
  const portConfig = nodeType.ports[i];
3737
3739
  const portType = portConfig.type !== undefined ? this.model.ports.types.get(portConfig.type) : undefined;
3738
3740
  const port = this.model.ports.new(portType, node, [node.coords[0] + portConfig.coords[0], node.coords[1] + portConfig.coords[1]], portConfig.connectionPoint !== undefined ? [node.coords[0] + (portConfig.connectionPoint[0] || 0), node.coords[1] + (portConfig.connectionPoint[1] || 0)] : undefined, portConfig.direction, `${node.id}_port_${i}`);
3739
- if ((_e = port.type) === null || _e === undefined ? undefined : _e.label) {
3740
- const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), (_f = port.type) === null || _f === undefined ? undefined : _f.label);
3741
+ if ((_e = port.type) === null || _e === void 0 ? void 0 : _e.label) {
3742
+ const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), (_f = port.type) === null || _f === void 0 ? void 0 : _f.label);
3741
3743
  const labelWidth = 6 * labelConfiguration.fontSize + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
3742
3744
  const labelHeight = labelConfiguration.fontSize + getTopPadding$1(labelConfiguration) + getBottomPadding$1(labelConfiguration);
3743
3745
  let labelCoords;
@@ -3753,14 +3755,14 @@ class DiagramNodeSet extends DiagramElementSet {
3753
3755
  default:
3754
3756
  labelCoords = port.coords;
3755
3757
  }
3756
- this.model.fields.new(port, labelCoords, labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelWidth, labelHeight, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, '', labelConfiguration.editable, labelConfiguration.fit);
3758
+ this.model.fields.new(port, labelCoords, labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelWidth, labelHeight, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, '', labelConfiguration.editable, labelConfiguration.fit);
3757
3759
  }
3758
3760
  }
3759
3761
  }
3760
3762
  // add node label
3761
3763
  if (nodeType.label) {
3762
3764
  const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), nodeType.label);
3763
- this.model.fields.new(node, [node.coords[0] + getLeftMargin(labelConfiguration), node.coords[1] + getTopMargin(labelConfiguration)], labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, node.width - getLeftMargin(labelConfiguration) - getRightMargin(labelConfiguration), node.height - getTopMargin(labelConfiguration) - getBottomMargin(labelConfiguration), labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, '', labelConfiguration.editable, labelConfiguration.fit);
3765
+ this.model.fields.new(node, [node.coords[0] + getLeftMargin(labelConfiguration), node.coords[1] + getTopMargin(labelConfiguration)], labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, node.width - getLeftMargin(labelConfiguration) - getRightMargin(labelConfiguration), node.height - getTopMargin(labelConfiguration) - getBottomMargin(labelConfiguration), labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, '', labelConfiguration.editable, labelConfiguration.fit);
3764
3766
  }
3765
3767
  // add node decorators
3766
3768
  if (nodeType.decorators.length > 0) {
@@ -3770,7 +3772,7 @@ class DiagramNodeSet extends DiagramElementSet {
3770
3772
  }
3771
3773
  }
3772
3774
  node.valueSet.resetValues();
3773
- (_g = node.model.canvas) === null || _g === undefined ? undefined : _g.fitNodeInView(node.id);
3775
+ (_g = node.model.canvas) === null || _g === void 0 ? void 0 : _g.fitNodeInView(node.id);
3774
3776
  return node;
3775
3777
  }
3776
3778
  remove(id) {
@@ -3862,7 +3864,7 @@ const filterByOnlyDescendants = nodes => {
3862
3864
  return nodes;
3863
3865
  };
3864
3866
  const getBottomPadding = config => {
3865
- if ((config === null || config === undefined ? undefined : config.padding) === null || (config === null || config === undefined ? undefined : config.padding) === undefined) {
3867
+ if ((config === null || config === void 0 ? void 0 : config.padding) === null || (config === null || config === void 0 ? void 0 : config.padding) === undefined) {
3866
3868
  return DIAGRAM_NODE_TYPE_DEFAULTS.padding;
3867
3869
  } else if (typeof config.padding === 'number') {
3868
3870
  return config.padding;
@@ -3881,7 +3883,7 @@ const getBottomPadding = config => {
3881
3883
  }
3882
3884
  };
3883
3885
  const getLeftPadding = config => {
3884
- if ((config === null || config === undefined ? undefined : config.padding) === null || (config === null || config === undefined ? undefined : config.padding) === undefined) {
3886
+ if ((config === null || config === void 0 ? void 0 : config.padding) === null || (config === null || config === void 0 ? void 0 : config.padding) === undefined) {
3885
3887
  return DIAGRAM_NODE_TYPE_DEFAULTS.padding;
3886
3888
  } else if (typeof config.padding === 'number') {
3887
3889
  return config.padding;
@@ -3900,7 +3902,7 @@ const getLeftPadding = config => {
3900
3902
  }
3901
3903
  };
3902
3904
  const getRightPadding = config => {
3903
- if ((config === null || config === undefined ? undefined : config.padding) === null || (config === null || config === undefined ? undefined : config.padding) === undefined) {
3905
+ if ((config === null || config === void 0 ? void 0 : config.padding) === null || (config === null || config === void 0 ? void 0 : config.padding) === undefined) {
3904
3906
  return DIAGRAM_NODE_TYPE_DEFAULTS.padding;
3905
3907
  } else if (typeof config.padding === 'number') {
3906
3908
  return config.padding;
@@ -3919,7 +3921,7 @@ const getRightPadding = config => {
3919
3921
  }
3920
3922
  };
3921
3923
  const getTopPadding = config => {
3922
- if ((config === null || config === undefined ? undefined : config.padding) === null || (config === null || config === undefined ? undefined : config.padding) === undefined) {
3924
+ if ((config === null || config === void 0 ? void 0 : config.padding) === null || (config === null || config === void 0 ? void 0 : config.padding) === undefined) {
3923
3925
  return DIAGRAM_NODE_TYPE_DEFAULTS.padding;
3924
3926
  } else if (typeof config.padding === 'number') {
3925
3927
  return config.padding;
@@ -4008,7 +4010,7 @@ class DiagramPort extends DiagramElement {
4008
4010
  }
4009
4011
  get typeString() {
4010
4012
  var _a;
4011
- return (_a = this.type) === null || _a === undefined ? undefined : _a.id;
4013
+ return (_a = this.type) === null || _a === void 0 ? void 0 : _a.id;
4012
4014
  }
4013
4015
  set typeString(typeString) {
4014
4016
  if (typeString === undefined) {
@@ -4025,14 +4027,14 @@ class DiagramPort extends DiagramElement {
4025
4027
  */
4026
4028
  get allowsOutgoing() {
4027
4029
  var _a, _b;
4028
- return ((_a = this.type) === null || _a === undefined ? undefined : _a.allowsOutgoing) !== undefined ? (_b = this.type) === null || _b === undefined ? undefined : _b.allowsOutgoing : true;
4030
+ return ((_a = this.type) === null || _a === void 0 ? void 0 : _a.allowsOutgoing) !== undefined ? (_b = this.type) === null || _b === void 0 ? void 0 : _b.allowsOutgoing : true;
4029
4031
  }
4030
4032
  /**
4031
4033
  * Whether this port can be used as a connection end point.
4032
4034
  */
4033
4035
  get allowsIncoming() {
4034
4036
  var _a, _b;
4035
- return ((_a = this.type) === null || _a === undefined ? undefined : _a.allowsIncoming) !== undefined ? (_b = this.type) === null || _b === undefined ? undefined : _b.allowsIncoming : true;
4037
+ return ((_a = this.type) === null || _a === void 0 ? void 0 : _a.allowsIncoming) !== undefined ? (_b = this.type) === null || _b === void 0 ? void 0 : _b.allowsIncoming : true;
4036
4038
  }
4037
4039
  /**
4038
4040
  * Name of this port. Alias for this port's label's text.
@@ -4040,7 +4042,7 @@ class DiagramPort extends DiagramElement {
4040
4042
  */
4041
4043
  get name() {
4042
4044
  var _a;
4043
- return ((_a = this.label) === null || _a === undefined ? undefined : _a.text) || '';
4045
+ return ((_a = this.label) === null || _a === void 0 ? void 0 : _a.text) || '';
4044
4046
  }
4045
4047
  set name(name) {
4046
4048
  if (this.label) {
@@ -4055,15 +4057,15 @@ class DiagramPort extends DiagramElement {
4055
4057
  var _a, _b, _c, _d;
4056
4058
  if (this.selected) {
4057
4059
  if (this.highlighted) {
4058
- return this._selectedAndHighlightedLook !== undefined ? this._selectedAndHighlightedLook : (_a = this.type || DIAGRAM_PORT_LOOKS) === null || _a === undefined ? undefined : _a.selectedAndHighlightedLook;
4060
+ return this._selectedAndHighlightedLook !== undefined ? this._selectedAndHighlightedLook : (_a = this.type || DIAGRAM_PORT_LOOKS) === null || _a === void 0 ? void 0 : _a.selectedAndHighlightedLook;
4059
4061
  } else {
4060
- return this._selectedLook !== undefined ? this._selectedLook : (_b = this.type || DIAGRAM_PORT_LOOKS) === null || _b === undefined ? undefined : _b.selectedLook;
4062
+ return this._selectedLook !== undefined ? this._selectedLook : (_b = this.type || DIAGRAM_PORT_LOOKS) === null || _b === void 0 ? void 0 : _b.selectedLook;
4061
4063
  }
4062
4064
  } else {
4063
4065
  if (this.highlighted) {
4064
- return this._highlightedLook !== undefined ? this._highlightedLook : (_c = this.type || DIAGRAM_PORT_LOOKS) === null || _c === undefined ? undefined : _c.highlightedLook;
4066
+ return this._highlightedLook !== undefined ? this._highlightedLook : (_c = this.type || DIAGRAM_PORT_LOOKS) === null || _c === void 0 ? void 0 : _c.highlightedLook;
4065
4067
  } else {
4066
- return this._defaultLook !== undefined ? this._defaultLook : (_d = this.type || DIAGRAM_PORT_LOOKS) === null || _d === undefined ? undefined : _d.defaultLook;
4068
+ return this._defaultLook !== undefined ? this._defaultLook : (_d = this.type || DIAGRAM_PORT_LOOKS) === null || _d === void 0 ? void 0 : _d.defaultLook;
4067
4069
  }
4068
4070
  }
4069
4071
  }
@@ -4092,7 +4094,7 @@ class DiagramPort extends DiagramElement {
4092
4094
  */
4093
4095
  get width() {
4094
4096
  var _a;
4095
- return ((_a = this.type) === null || _a === undefined ? undefined : _a.width) || DIAGRAM_PORT_TYPE_DEFAULTS.width;
4097
+ return ((_a = this.type) === null || _a === void 0 ? void 0 : _a.width) || DIAGRAM_PORT_TYPE_DEFAULTS.width;
4096
4098
  }
4097
4099
  /**
4098
4100
  * Current height of this port. Same as the width.
@@ -4130,11 +4132,11 @@ class DiagramPort extends DiagramElement {
4130
4132
  }
4131
4133
  updateInView() {
4132
4134
  var _a;
4133
- (_a = this.model.canvas) === null || _a === undefined ? undefined : _a.updatePortsInView(this.id);
4135
+ (_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.updatePortsInView(this.id);
4134
4136
  }
4135
4137
  raise() {
4136
4138
  var _a;
4137
- (_a = this.select()) === null || _a === undefined ? undefined : _a.raise();
4139
+ (_a = this.select()) === null || _a === void 0 ? void 0 : _a.raise();
4138
4140
  if (this.label) {
4139
4141
  this.label.raise();
4140
4142
  }
@@ -4176,7 +4178,7 @@ class DiagramPort extends DiagramElement {
4176
4178
  }
4177
4179
  getPriority() {
4178
4180
  var _a;
4179
- return ((_a = this.rootElement) === null || _a === undefined ? undefined : _a.getPriority()) || DEFAULT_PRIORITY;
4181
+ return ((_a = this.rootElement) === null || _a === void 0 ? void 0 : _a.getPriority()) || DEFAULT_PRIORITY;
4180
4182
  }
4181
4183
  /**
4182
4184
  * Change the coordinates of this port to the given coordinates and move its labels correspondingly.
@@ -4307,7 +4309,7 @@ class DagaImporter {
4307
4309
  // add node label
4308
4310
  if (newNodeType.label) {
4309
4311
  const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), newNodeType.label);
4310
- const newField = new DiagramField(model, newNode, [newNode.coords[0] + getLeftMargin(labelConfiguration), newNode.coords[1] + getTopMargin(labelConfiguration)], newNode.width - getLeftMargin(labelConfiguration) - getRightMargin(labelConfiguration), newNode.height - getTopMargin(labelConfiguration) - getBottomMargin(labelConfiguration), labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, '', labelConfiguration.editable, labelConfiguration.fit);
4312
+ const newField = new DiagramField(model, newNode, [newNode.coords[0] + getLeftMargin(labelConfiguration), newNode.coords[1] + getTopMargin(labelConfiguration)], newNode.width - getLeftMargin(labelConfiguration) - getRightMargin(labelConfiguration), newNode.height - getTopMargin(labelConfiguration) - getBottomMargin(labelConfiguration), labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, '', labelConfiguration.editable, labelConfiguration.fit);
4311
4313
  newField.text = node.label;
4312
4314
  newNode.label = newField;
4313
4315
  model.fields.add(newField);
@@ -4317,19 +4319,19 @@ class DagaImporter {
4317
4319
  for (const child of node.children || []) {
4318
4320
  const newChild = this.importNode(model, child);
4319
4321
  if (newChild !== undefined) {
4320
- (_a = newNode.children) === null || _a === undefined ? undefined : _a.push(newChild);
4322
+ (_a = newNode.children) === null || _a === void 0 ? void 0 : _a.push(newChild);
4321
4323
  newChild.parent = newNode;
4322
4324
  }
4323
4325
  }
4324
4326
  for (const section of node.sections || []) {
4325
4327
  const newSection = new DiagramSection(model, newNode, section.indexXInNode, section.indexYInNode, section.coords, section.width, section.height, section.id);
4326
- (_b = newNode.sections) === null || _b === undefined ? undefined : _b.push(newSection);
4328
+ (_b = newNode.sections) === null || _b === void 0 ? void 0 : _b.push(newSection);
4327
4329
  model.sections.add(newSection);
4328
4330
  if (section.label) {
4329
4331
  // add section label
4330
- if ((_f = (_e = (_d = (_c = newNodeType.sectionGrid) === null || _c === undefined ? undefined : _c.sections) === null || _d === undefined ? undefined : _d[section.indexYInNode]) === null || _e === undefined ? undefined : _e[section.indexXInNode]) === null || _f === undefined ? undefined : _f.label) {
4331
- const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), (_k = (_j = (_h = (_g = newNodeType.sectionGrid) === null || _g === undefined ? undefined : _g.sections) === null || _h === undefined ? undefined : _h[section.indexYInNode]) === null || _j === undefined ? undefined : _j[section.indexXInNode]) === null || _k === undefined ? undefined : _k.label);
4332
- const newField = new DiagramField(model, newSection, [newSection.coords[0] + getLeftMargin(labelConfiguration), newSection.coords[1] + getTopMargin(labelConfiguration)], newSection.width - getLeftMargin(labelConfiguration) - getRightMargin(labelConfiguration), newSection.height - getTopMargin(labelConfiguration) - getBottomMargin(labelConfiguration), labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, '', labelConfiguration.editable, labelConfiguration.fit);
4332
+ if ((_f = (_e = (_d = (_c = newNodeType.sectionGrid) === null || _c === void 0 ? void 0 : _c.sections) === null || _d === void 0 ? void 0 : _d[section.indexYInNode]) === null || _e === void 0 ? void 0 : _e[section.indexXInNode]) === null || _f === void 0 ? void 0 : _f.label) {
4333
+ const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), (_k = (_j = (_h = (_g = newNodeType.sectionGrid) === null || _g === void 0 ? void 0 : _g.sections) === null || _h === void 0 ? void 0 : _h[section.indexYInNode]) === null || _j === void 0 ? void 0 : _j[section.indexXInNode]) === null || _k === void 0 ? void 0 : _k.label);
4334
+ const newField = new DiagramField(model, newSection, [newSection.coords[0] + getLeftMargin(labelConfiguration), newSection.coords[1] + getTopMargin(labelConfiguration)], newSection.width - getLeftMargin(labelConfiguration) - getRightMargin(labelConfiguration), newSection.height - getTopMargin(labelConfiguration) - getBottomMargin(labelConfiguration), labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, '', labelConfiguration.editable, labelConfiguration.fit);
4333
4335
  newField.text = section.label;
4334
4336
  newSection.label = newField;
4335
4337
  model.fields.add(newField);
@@ -4344,8 +4346,8 @@ class DagaImporter {
4344
4346
  model.ports.add(newPort);
4345
4347
  if (port.label) {
4346
4348
  // add port label
4347
- if (newNodeType.ports.length > portCounter && (newPortType === null || newPortType === undefined ? undefined : newPortType.label)) {
4348
- const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), newPortType === null || newPortType === undefined ? undefined : newPortType.label);
4349
+ if (newNodeType.ports.length > portCounter && (newPortType === null || newPortType === void 0 ? void 0 : newPortType.label)) {
4350
+ const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), newPortType === null || newPortType === void 0 ? void 0 : newPortType.label);
4349
4351
  let labelCoords;
4350
4352
  switch (newPort.direction) {
4351
4353
  case Side.Top:
@@ -4361,7 +4363,7 @@ class DagaImporter {
4361
4363
  default:
4362
4364
  labelCoords = newPort.coords;
4363
4365
  }
4364
- const newField = new DiagramField(model, newPort, labelCoords, labelConfiguration.fontSize, labelConfiguration.fontSize, labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, '', labelConfiguration.editable, labelConfiguration.fit);
4366
+ const newField = new DiagramField(model, newPort, labelCoords, labelConfiguration.fontSize, labelConfiguration.fontSize, labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, '', labelConfiguration.editable, labelConfiguration.fit);
4365
4367
  newField.text = port.label;
4366
4368
  newPort.label = newField;
4367
4369
  model.fields.add(newField);
@@ -4391,8 +4393,8 @@ class DagaImporter {
4391
4393
  model.ports.add(newPort);
4392
4394
  if (port.label) {
4393
4395
  // add port label
4394
- if (newNodeType.ports.length > portCounter && (newPortType === null || newPortType === undefined ? undefined : newPortType.label)) {
4395
- const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), newPortType === null || newPortType === undefined ? undefined : newPortType.label);
4396
+ if (newNodeType.ports.length > portCounter && (newPortType === null || newPortType === void 0 ? void 0 : newPortType.label)) {
4397
+ const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), newPortType === null || newPortType === void 0 ? void 0 : newPortType.label);
4396
4398
  let labelCoords;
4397
4399
  switch (newPort.direction) {
4398
4400
  case Side.Top:
@@ -4408,7 +4410,7 @@ class DagaImporter {
4408
4410
  default:
4409
4411
  labelCoords = newPort.coords;
4410
4412
  }
4411
- const newField = new DiagramField(model, newPort, labelCoords, labelConfiguration.fontSize, labelConfiguration.fontSize, labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, '', labelConfiguration.editable, labelConfiguration.fit);
4413
+ const newField = new DiagramField(model, newPort, labelCoords, labelConfiguration.fontSize, labelConfiguration.fontSize, labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, '', labelConfiguration.editable, labelConfiguration.fit);
4412
4414
  newField.text = port.label;
4413
4415
  newPort.label = newField;
4414
4416
  model.fields.add(newField);
@@ -4492,14 +4494,16 @@ class AddNodeCollabAction {
4492
4494
  var _a;
4493
4495
  const node = this.canvas.model.nodes.new(this.typeId, this.coords, this.id);
4494
4496
  if (this.parentId !== undefined) {
4495
- (_a = this.canvas.model.nodes.get(this.parentId)) === null || _a === undefined ? undefined : _a.addChild(node);
4496
- }
4497
- if (this.values !== undefined) {
4498
- node.valueSet.setValues(structuredClone(Object.assign(Object.assign({}, node.valueSet.getValues()), this.values)));
4497
+ (_a = this.canvas.model.nodes.get(this.parentId)) === null || _a === void 0 ? void 0 : _a.addChild(node);
4499
4498
  }
4500
4499
  if (node.label) {
4501
4500
  node.label.text = this.label || '';
4502
4501
  }
4502
+ if (this.values !== undefined) {
4503
+ node.valueSet.setValues(structuredClone(Object.assign(Object.assign({}, node.valueSet.getValues()), this.values)));
4504
+ } else {
4505
+ node.valueSet.resetValues();
4506
+ }
4503
4507
  }
4504
4508
  serialize() {
4505
4509
  return {
@@ -4614,7 +4618,7 @@ class MoveCollabAction {
4614
4618
  const node = this.canvas.model.nodes.get(nodeId, true);
4615
4619
  if (node && timestampWins(this.timestamp, node.geometryTimestamp)) {
4616
4620
  node.move([node.coords[0] + this.delta[0], node.coords[1] + this.delta[1]]);
4617
- (_a = node.parent) === null || _a === undefined ? undefined : _a.fitToChild(node);
4621
+ (_a = node.parent) === null || _a === void 0 ? void 0 : _a.fitToChild(node);
4618
4622
  node.geometryTimestamp = this.timestamp;
4619
4623
  }
4620
4624
  }
@@ -4649,15 +4653,15 @@ class SetGeometryCollabAction {
4649
4653
  if (node && timestampWins(this.timestamp, node.geometryTimestamp)) {
4650
4654
  node.setGeometry(this.to);
4651
4655
  // Re-fit the labels, in case their text has changed since `this.to` was measured.
4652
- if ((_a = node.label) === null || _a === undefined ? undefined : _a.fit) {
4656
+ if ((_a = node.label) === null || _a === void 0 ? void 0 : _a.fit) {
4653
4657
  this.canvas.fitFieldRootInView(node.label.id);
4654
4658
  }
4655
4659
  for (const section of node.sections) {
4656
- if ((_b = section.label) === null || _b === undefined ? undefined : _b.fit) {
4660
+ if ((_b = section.label) === null || _b === void 0 ? void 0 : _b.fit) {
4657
4661
  this.canvas.fitFieldRootInView(section.label.id);
4658
4662
  }
4659
4663
  }
4660
- (_c = node.parent) === null || _c === undefined ? undefined : _c.fitToChild(node);
4664
+ (_c = node.parent) === null || _c === void 0 ? void 0 : _c.fitToChild(node);
4661
4665
  node.geometryTimestamp = this.timestamp;
4662
4666
  }
4663
4667
  }
@@ -4691,9 +4695,9 @@ class SetParentCollabAction {
4691
4695
  const childNode = this.canvas.model.nodes.get(this.childId, true);
4692
4696
  const parentNode = this.parentId !== undefined ? this.canvas.model.nodes.get(this.parentId, true) : undefined;
4693
4697
  if (childNode && (this.parentId !== undefined ? parentNode : true) && timestampWins(this.timestamp, childNode.geometryTimestamp)) {
4694
- (_a = childNode.parent) === null || _a === undefined ? undefined : _a.removeChild(childNode);
4698
+ (_a = childNode.parent) === null || _a === void 0 ? void 0 : _a.removeChild(childNode);
4695
4699
  childNode.setGeometry(this.childGeometry);
4696
- parentNode === null || parentNode === undefined ? undefined : parentNode.addChild(childNode);
4700
+ parentNode === null || parentNode === void 0 ? void 0 : parentNode.addChild(childNode);
4697
4701
  }
4698
4702
  }
4699
4703
  serialize() {
@@ -4790,12 +4794,12 @@ class UpdateValuesCollabAction {
4790
4794
  if (this.id === undefined) {
4791
4795
  return this.canvas.model.valueSet;
4792
4796
  } else {
4793
- return (_a = this.canvas.model.nodes.get(this.id, true) || this.canvas.model.connections.get(this.id, true)) === null || _a === undefined ? undefined : _a.valueSet;
4797
+ return (_a = this.canvas.model.nodes.get(this.id, true) || this.canvas.model.connections.get(this.id, true)) === null || _a === void 0 ? void 0 : _a.valueSet;
4794
4798
  }
4795
4799
  }
4796
4800
  do() {
4797
4801
  var _a;
4798
- (_a = this.getValueSet()) === null || _a === undefined ? undefined : _a.overwriteValuesLww(this.to, this.timestamp);
4802
+ (_a = this.getValueSet()) === null || _a === void 0 ? void 0 : _a.overwriteValuesLww(this.to, this.timestamp);
4799
4803
  }
4800
4804
  serialize() {
4801
4805
  return {
@@ -5795,11 +5799,11 @@ class DiagramDecorator extends DiagramElement {
5795
5799
  }
5796
5800
  updateInView() {
5797
5801
  var _a;
5798
- (_a = this.model.canvas) === null || _a === undefined ? undefined : _a.updateDecoratorsInView(this.id);
5802
+ (_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.updateDecoratorsInView(this.id);
5799
5803
  }
5800
5804
  raise() {
5801
5805
  var _a;
5802
- (_a = this.select()) === null || _a === undefined ? undefined : _a.raise();
5806
+ (_a = this.select()) === null || _a === void 0 ? void 0 : _a.raise();
5803
5807
  }
5804
5808
  /**
5805
5809
  * Change the coordinates of this decorator to the given coordinates.
@@ -5884,11 +5888,11 @@ class DiagramObject extends DiagramElement {
5884
5888
  }
5885
5889
  updateInView() {
5886
5890
  var _a;
5887
- (_a = this.model.canvas) === null || _a === undefined ? undefined : _a.updateObjectsInView(this.id);
5891
+ (_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.updateObjectsInView(this.id);
5888
5892
  }
5889
5893
  raise() {
5890
5894
  var _a;
5891
- (_a = this.select()) === null || _a === undefined ? undefined : _a.raise();
5895
+ (_a = this.select()) === null || _a === void 0 ? void 0 : _a.raise();
5892
5896
  }
5893
5897
  /**
5894
5898
  * Change the coordinates of this object to the given coordinates.
@@ -6005,7 +6009,7 @@ class DiagramModel {
6005
6009
  */
6006
6010
  clear() {
6007
6011
  var _a, _b;
6008
- (_a = this.canvas) === null || _a === undefined ? undefined : _a.cancelAllUserActions();
6012
+ (_a = this.canvas) === null || _a === void 0 ? void 0 : _a.cancelAllUserActions();
6009
6013
  this.id = undefined;
6010
6014
  this.name = '';
6011
6015
  this.description = undefined;
@@ -6020,7 +6024,7 @@ class DiagramModel {
6020
6024
  this.objects.clear();
6021
6025
  this.decorators.clear();
6022
6026
  this.valueSet.resetValues();
6023
- (_b = this.canvas) === null || _b === undefined ? undefined : _b.updateModelInView();
6027
+ (_b = this.canvas) === null || _b === void 0 ? void 0 : _b.updateModelInView();
6024
6028
  }
6025
6029
  }
6026
6030
 
@@ -6086,7 +6090,6 @@ const updateLook = selection => {
6086
6090
  selection.filter('.stretchable-image-look').select('image.bottom-right-image').attr('x', d => d.width - d.look.rightMargin).attr('y', d => d.height - d.look.bottomMargin).attr('width', d => d.look.rightMargin).attr('height', d => d.look.bottomMargin).attr('href', d => d.look.backgroundImageBottomRight);
6087
6091
  };
6088
6092
  const GRID_DEFAULTS = {
6089
- enabled: true,
6090
6093
  style: 'dots',
6091
6094
  color: 'rgba(0, 0, 0, 0.1)',
6092
6095
  snap: false,
@@ -6244,7 +6247,7 @@ class DiagramContextMenu {
6244
6247
  */
6245
6248
  close() {
6246
6249
  var _a;
6247
- (_a = this.contextMenuContainer) === null || _a === undefined ? undefined : _a.remove();
6250
+ (_a = this.contextMenuContainer) === null || _a === void 0 ? void 0 : _a.remove();
6248
6251
  this.contextMenuContainer = undefined;
6249
6252
  }
6250
6253
  }
@@ -6380,11 +6383,11 @@ class DagaExporter {
6380
6383
  for (const port of section.ports) {
6381
6384
  ports.push(Object.assign({
6382
6385
  id: port.id,
6383
- type: (_a = port.type) === null || _a === undefined ? undefined : _a.id,
6386
+ type: (_a = port.type) === null || _a === void 0 ? void 0 : _a.id,
6384
6387
  coords: roundPoint(port.coords),
6385
6388
  connectionPoint: roundPoint(port.connectionPoint),
6386
6389
  direction: port.direction,
6387
- label: ((_b = port.label) === null || _b === undefined ? undefined : _b.text) || ''
6390
+ label: ((_b = port.label) === null || _b === void 0 ? void 0 : _b.text) || ''
6388
6391
  }, includeCollabMeta ? {
6389
6392
  collabMeta: Object.assign({
6390
6393
  removed: port.removed,
@@ -6396,7 +6399,7 @@ class DagaExporter {
6396
6399
  sections.push(Object.assign({
6397
6400
  id: section.id,
6398
6401
  ports,
6399
- label: ((_c = section.label) === null || _c === undefined ? undefined : _c.text) || '',
6402
+ label: ((_c = section.label) === null || _c === void 0 ? void 0 : _c.text) || '',
6400
6403
  indexXInNode: section.indexXInNode,
6401
6404
  indexYInNode: section.indexYInNode,
6402
6405
  coords: roundPoint(section.coords),
@@ -6414,11 +6417,11 @@ class DagaExporter {
6414
6417
  for (const port of node.ports) {
6415
6418
  ports.push(Object.assign({
6416
6419
  id: port.id,
6417
- type: (_d = port.type) === null || _d === undefined ? undefined : _d.id,
6420
+ type: (_d = port.type) === null || _d === void 0 ? void 0 : _d.id,
6418
6421
  coords: roundPoint(port.coords),
6419
6422
  connectionPoint: roundPoint(port.connectionPoint),
6420
6423
  direction: port.direction,
6421
- label: ((_e = port.label) === null || _e === undefined ? undefined : _e.text) || ''
6424
+ label: ((_e = port.label) === null || _e === void 0 ? void 0 : _e.text) || ''
6422
6425
  }, includeCollabMeta ? {
6423
6426
  collabMeta: Object.assign({
6424
6427
  removed: port.removed,
@@ -6433,7 +6436,7 @@ class DagaExporter {
6433
6436
  children,
6434
6437
  sections,
6435
6438
  ports,
6436
- label: ((_f = node.label) === null || _f === undefined ? undefined : _f.text) || '',
6439
+ label: ((_f = node.label) === null || _f === void 0 ? void 0 : _f.text) || '',
6437
6440
  coords: roundPoint(node.coords),
6438
6441
  width: node.width,
6439
6442
  height: node.height,
@@ -6453,8 +6456,8 @@ class DagaExporter {
6453
6456
  return Object.assign({
6454
6457
  id: connection.id,
6455
6458
  type: connection.type.id,
6456
- start: ((_a = connection.start) === null || _a === undefined ? undefined : _a.id) || '',
6457
- end: ((_b = connection.end) === null || _b === undefined ? undefined : _b.id) || '',
6459
+ start: ((_a = connection.start) === null || _a === void 0 ? void 0 : _a.id) || '',
6460
+ end: ((_b = connection.end) === null || _b === void 0 ? void 0 : _b.id) || '',
6458
6461
  startLabel: connection.startLabel,
6459
6462
  middleLabel: connection.middleLabel,
6460
6463
  endLabel: connection.endLabel,
@@ -6674,11 +6677,11 @@ class DiagramUserSelection extends DiagramElementSet {
6674
6677
  openInPropertyEditor(selection) {
6675
6678
  var _a;
6676
6679
  this.makeUpdateValuesAction();
6677
- const propertyEditor = (_a = this.canvas.parentComponent) === null || _a === undefined ? undefined : _a.propertyEditor;
6680
+ const propertyEditor = (_a = this.canvas.parentComponent) === null || _a === void 0 ? void 0 : _a.propertyEditor;
6678
6681
  if (propertyEditor === undefined) {
6679
6682
  return;
6680
6683
  }
6681
- const selectedValueSet = selection === null || selection === undefined ? undefined : selection.valueSet;
6684
+ const selectedValueSet = selection === null || selection === void 0 ? void 0 : selection.valueSet;
6682
6685
  if (selectedValueSet) {
6683
6686
  this.propertyEditorSelection = selection;
6684
6687
  this.propertyEditorValues = structuredClone(selectedValueSet.getValues());
@@ -6720,12 +6723,12 @@ class DiagramUserSelection extends DiagramElementSet {
6720
6723
  const previousSelectionId = this.propertyEditorSelection instanceof DiagramModel ? undefined : this.propertyEditorSelection.id;
6721
6724
  // check if there have been changes in the previously selected ValueSet,
6722
6725
  // and create an UpdateValuesAction if there have
6723
- if (equals(this.propertyEditorValues, (_a = this.propertyEditorSelection) === null || _a === undefined ? undefined : _a.valueSet.getValues())) {
6726
+ if (equals(this.propertyEditorValues, (_a = this.propertyEditorSelection) === null || _a === void 0 ? void 0 : _a.valueSet.getValues())) {
6724
6727
  return;
6725
6728
  }
6726
6729
  const from = this.propertyEditorValues;
6727
- const to = structuredClone((_b = this.propertyEditorSelection) === null || _b === undefined ? undefined : _b.valueSet.getValues());
6728
- const [fromDiff, toDiff] = diffProperties(from, to, (_c = this.propertyEditorSelection) === null || _c === undefined ? undefined : _c.valueSet);
6730
+ const to = structuredClone((_b = this.propertyEditorSelection) === null || _b === void 0 ? void 0 : _b.valueSet.getValues());
6731
+ const [fromDiff, toDiff] = diffProperties(from, to, (_c = this.propertyEditorSelection) === null || _c === void 0 ? void 0 : _c.valueSet);
6729
6732
  const currentAction = new UpdateValuesAction(this.canvas, previousSelectionId, fromDiff, toDiff);
6730
6733
  currentAction.do();
6731
6734
  this.canvas.actionStack.add(currentAction);
@@ -6759,7 +6762,7 @@ class DiagramCanvas {
6759
6762
  var _a, _b;
6760
6763
  this._connectionType = value;
6761
6764
  // refresh the palette every time connectionType is set so that the palette keeps track of updates to the connectionType
6762
- (_b = (_a = this.parentComponent) === null || _a === undefined ? undefined : _a.palette) === null || _b === undefined ? undefined : _b.refreshPalette();
6765
+ (_b = (_a = this.parentComponent) === null || _a === void 0 ? void 0 : _a.palette) === null || _b === void 0 ? void 0 : _b.refreshPalette();
6763
6766
  }
6764
6767
  /**
6765
6768
  * Constructs a canvas object.
@@ -6785,18 +6788,18 @@ class DiagramCanvas {
6785
6788
  this.model = new DiagramModel(this, undefined, config.name || 'unnamed', '', config.type || '', config.properties || []);
6786
6789
  this.userSelection = new DiagramUserSelection(this);
6787
6790
  this.userHighlight = new DiagramUserHighlight(this);
6788
- this.contextMenu = new DiagramContextMenu(this, (_a = config.canvas) === null || _a === undefined ? undefined : _a.contextMenu);
6789
- this.backgroundColor = ((_b = config.canvas) === null || _b === undefined ? undefined : _b.backgroundColor) || '#FFFFFF';
6790
- this.gridStyle = (_e = (_d = (_c = config.canvas) === null || _c === undefined ? undefined : _c.grid) === null || _d === undefined ? undefined : _d.style) !== null && _e !== undefined ? _e : GRID_DEFAULTS.style;
6791
- this.gridSize = ((_g = (_f = config.canvas) === null || _f === undefined ? undefined : _f.grid) === null || _g === undefined ? undefined : _g.enabled) === false || ((_h = config.canvas) === null || _h === undefined ? undefined : _h.grid) === undefined ? 0 : Math.abs(((_k = (_j = config.canvas) === null || _j === undefined ? undefined : _j.grid) === null || _k === undefined ? undefined : _k.spacing) || GRID_DEFAULTS.spacing);
6792
- this.gridThickness = Math.abs(((_m = (_l = config.canvas) === null || _l === undefined ? undefined : _l.grid) === null || _m === undefined ? undefined : _m.thickness) || GRID_DEFAULTS.thickness);
6793
- this.gridColor = ((_p = (_o = config.canvas) === null || _o === undefined ? undefined : _o.grid) === null || _p === undefined ? undefined : _p.color) || GRID_DEFAULTS.color;
6794
- this.snapToGrid = ((_r = (_q = config.canvas) === null || _q === undefined ? undefined : _q.grid) === null || _r === undefined ? undefined : _r.enabled) === false || ((_s = config.canvas) === null || _s === undefined ? undefined : _s.grid) === undefined ? false : ((_u = (_t = config.canvas) === null || _t === undefined ? undefined : _t.grid) === null || _u === undefined ? undefined : _u.snap) || GRID_DEFAULTS.snap;
6795
- this.zoomFactor = ((_v = config.canvas) === null || _v === undefined ? undefined : _v.zoomFactor) || 2;
6796
- this.panRate = ((_w = config.canvas) === null || _w === undefined ? undefined : _w.panRate) || 100;
6791
+ this.contextMenu = new DiagramContextMenu(this, (_a = config.canvas) === null || _a === void 0 ? void 0 : _a.contextMenu);
6792
+ this.backgroundColor = ((_b = config.canvas) === null || _b === void 0 ? void 0 : _b.backgroundColor) || '#FFFFFF';
6793
+ this.gridStyle = (_e = (_d = (_c = config.canvas) === null || _c === void 0 ? void 0 : _c.grid) === null || _d === void 0 ? void 0 : _d.style) !== null && _e !== void 0 ? _e : GRID_DEFAULTS.style;
6794
+ this.gridSize = ((_g = (_f = config.canvas) === null || _f === void 0 ? void 0 : _f.grid) === null || _g === void 0 ? void 0 : _g.enabled) === false || ((_h = config.canvas) === null || _h === void 0 ? void 0 : _h.grid) === undefined ? 0 : Math.abs(((_k = (_j = config.canvas) === null || _j === void 0 ? void 0 : _j.grid) === null || _k === void 0 ? void 0 : _k.spacing) || GRID_DEFAULTS.spacing);
6795
+ this.gridThickness = Math.abs(((_m = (_l = config.canvas) === null || _l === void 0 ? void 0 : _l.grid) === null || _m === void 0 ? void 0 : _m.thickness) || GRID_DEFAULTS.thickness);
6796
+ this.gridColor = ((_p = (_o = config.canvas) === null || _o === void 0 ? void 0 : _o.grid) === null || _p === void 0 ? void 0 : _p.color) || GRID_DEFAULTS.color;
6797
+ this.snapToGrid = ((_r = (_q = config.canvas) === null || _q === void 0 ? void 0 : _q.grid) === null || _r === void 0 ? void 0 : _r.enabled) === false || ((_s = config.canvas) === null || _s === void 0 ? void 0 : _s.grid) === undefined ? false : ((_u = (_t = config.canvas) === null || _t === void 0 ? void 0 : _t.grid) === null || _u === void 0 ? void 0 : _u.snap) || GRID_DEFAULTS.snap;
6798
+ this.zoomFactor = ((_v = config.canvas) === null || _v === void 0 ? void 0 : _v.zoomFactor) || 2;
6799
+ this.panRate = ((_w = config.canvas) === null || _w === void 0 ? void 0 : _w.panRate) || 100;
6797
6800
  this.inferConnectionType = config.inferConnectionType || false;
6798
6801
  this.multipleSelectionOn = false;
6799
- this.priorityThresholds = ((_x = config.canvas) === null || _x === undefined ? undefined : _x.priorityThresholds) || [];
6802
+ this.priorityThresholds = ((_x = config.canvas) === null || _x === void 0 ? void 0 : _x.priorityThresholds) || [];
6800
6803
  this.priorityThreshold = this.priorityThresholds ? this.priorityThresholds[0] : undefined;
6801
6804
  this.layoutFormat = config.layoutFormat;
6802
6805
  this.userActions = config.userActions || {};
@@ -6847,7 +6850,7 @@ class DiagramCanvas {
6847
6850
  for (const node of this.model.nodes) {
6848
6851
  this.fitNodeInView(node.id);
6849
6852
  }
6850
- (_b = (_a = this.parentComponent) === null || _a === undefined ? undefined : _a.palette) === null || _b === undefined ? undefined : _b.refreshPalette();
6853
+ (_b = (_a = this.parentComponent) === null || _a === void 0 ? void 0 : _a.palette) === null || _b === void 0 ? void 0 : _b.refreshPalette();
6851
6854
  }
6852
6855
  // View methods
6853
6856
  initView(appendTo) {
@@ -6861,7 +6864,7 @@ class DiagramCanvas {
6861
6864
  var _a;
6862
6865
  // focus on the diagram when clicking so that we can focus on the diagram
6863
6866
  // keyboard events only work if we're focusing on the diagram
6864
- (_a = d3.select(this.diagramRoot).node()) === null || _a === undefined ? undefined : _a.focus();
6867
+ (_a = d3.select(this.diagramRoot).node()) === null || _a === void 0 ? void 0 : _a.focus();
6865
6868
  }).on(Events.ContextMenu, event => {
6866
6869
  if (this.dragging) {
6867
6870
  event.preventDefault();
@@ -7084,7 +7087,7 @@ class DiagramCanvas {
7084
7087
  var _a;
7085
7088
  // if there are no nodes, we have nothing to do here
7086
7089
  if (this.model.nodes.length > 0) {
7087
- const canvasViewBoundingBox = (_a = this.selectCanvasView().select('rect').node()) === null || _a === undefined ? undefined : _a.getBBox();
7090
+ const canvasViewBoundingBox = (_a = this.selectCanvasView().select('rect').node()) === null || _a === void 0 ? void 0 : _a.getBBox();
7088
7091
  const nonRemovedNodes = this.model.nodes.all();
7089
7092
  const minimumX = Math.min(...nonRemovedNodes.map(n => n.coords[0]));
7090
7093
  const maximumX = Math.max(...nonRemovedNodes.map(n => n.coords[0] + n.width));
@@ -7116,8 +7119,8 @@ class DiagramCanvas {
7116
7119
  }
7117
7120
  getCoordinatesOnScreen() {
7118
7121
  var _a;
7119
- const rootBoundingClientRect = (_a = this.selectSVGElement().node()) === null || _a === undefined ? undefined : _a.getBoundingClientRect();
7120
- const rootDimensions = [(rootBoundingClientRect === null || rootBoundingClientRect === undefined ? undefined : rootBoundingClientRect.width) || 0, (rootBoundingClientRect === null || rootBoundingClientRect === undefined ? undefined : rootBoundingClientRect.height) || 0];
7122
+ const rootBoundingClientRect = (_a = this.selectSVGElement().node()) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
7123
+ const rootDimensions = [(rootBoundingClientRect === null || rootBoundingClientRect === void 0 ? void 0 : rootBoundingClientRect.width) || 0, (rootBoundingClientRect === null || rootBoundingClientRect === void 0 ? void 0 : rootBoundingClientRect.height) || 0];
7121
7124
  return [[-this.zoomTransform.x / this.zoomTransform.k, -this.zoomTransform.y / this.zoomTransform.k], [(rootDimensions[0] - this.zoomTransform.x) / this.zoomTransform.k, (rootDimensions[1] - this.zoomTransform.y) / this.zoomTransform.k]];
7122
7125
  }
7123
7126
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -7372,7 +7375,7 @@ class DiagramCanvas {
7372
7375
  const exitSelection = updateSelection.exit();
7373
7376
  const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', d => {
7374
7377
  var _a, _b, _c, _d, _e;
7375
- return `diagram-section${((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableX) ? ' resizable-x' : ''}${((_d = (_c = d.node) === null || _c === undefined ? undefined : _c.type) === null || _d === undefined ? undefined : _d.resizableY) ? ' resizable-y' : ''} ${(_e = d.look) === null || _e === undefined ? undefined : _e.lookType}`;
7378
+ return `diagram-section${((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableX) ? ' resizable-x' : ''}${((_d = (_c = d.node) === null || _c === void 0 ? void 0 : _c.type) === null || _d === void 0 ? void 0 : _d.resizableY) ? ' resizable-y' : ''} ${(_e = d.look) === null || _e === void 0 ? void 0 : _e.lookType}`;
7376
7379
  });
7377
7380
  if (ids && ids.length > 0) {
7378
7381
  updateSelection = updateSelection.filter(d => ids.includes(d.id));
@@ -7421,7 +7424,7 @@ class DiagramCanvas {
7421
7424
  if (this.multipleSelectionOn || this.secondaryButton) {
7422
7425
  this.startMultipleSelection(event);
7423
7426
  } else {
7424
- const node = d === null || d === undefined ? undefined : d.node;
7427
+ const node = d === null || d === void 0 ? void 0 : d.node;
7425
7428
  if (node) {
7426
7429
  this.startMovingNode(event, node);
7427
7430
  } else {
@@ -7432,7 +7435,7 @@ class DiagramCanvas {
7432
7435
  if (this.multipleSelectionOn || this.secondaryButton) {
7433
7436
  this.continueMultipleSelection(event);
7434
7437
  } else {
7435
- const node = d === null || d === undefined ? undefined : d.node;
7438
+ const node = d === null || d === void 0 ? void 0 : d.node;
7436
7439
  if (node) {
7437
7440
  this.continueMovingNode(event, node);
7438
7441
  } else {
@@ -7443,7 +7446,7 @@ class DiagramCanvas {
7443
7446
  if (this.multipleSelectionOn || this.secondaryButton) {
7444
7447
  this.finishMultipleSelection(event);
7445
7448
  } else {
7446
- const node = d === null || d === undefined ? undefined : d.node;
7449
+ const node = d === null || d === void 0 ? void 0 : d.node;
7447
7450
  if (node) {
7448
7451
  this.finishMovingNode(event, node);
7449
7452
  } else {
@@ -7455,17 +7458,17 @@ class DiagramCanvas {
7455
7458
  initializeLook(enterSelection);
7456
7459
  enterSelection.filter('.resizable-x').append('line').attr('class', 'left-resizer').attr('stroke', 'transparent').attr('stroke-width', `${RESIZER_THICKNESS}px`).on(Events.MouseOver, (_event, d) => {
7457
7460
  var _a, _b;
7458
- if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableX) && !d.removed) {
7461
+ if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableX) && !d.removed) {
7459
7462
  setCursorStyle(CursorStyle.EWResize);
7460
7463
  }
7461
7464
  }).on(Events.MouseOut, (_event, d) => {
7462
7465
  var _a, _b;
7463
- if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableX) && !d.removed) {
7466
+ if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableX) && !d.removed) {
7464
7467
  setCursorStyle();
7465
7468
  }
7466
7469
  }).call(d3.drag().on(DragEvents.Start, (_event, d) => {
7467
7470
  var _a, _b;
7468
- if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableX) && !d.removed) {
7471
+ if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableX) && !d.removed) {
7469
7472
  setCursorStyle(CursorStyle.EWResize);
7470
7473
  this.currentAction = new SetGeometryAction(this, DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry());
7471
7474
  } else {
@@ -7473,13 +7476,13 @@ class DiagramCanvas {
7473
7476
  }
7474
7477
  }).on(DragEvents.Drag, (event, d) => {
7475
7478
  var _a, _b;
7476
- if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableX) && !d.removed) {
7479
+ if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableX) && !d.removed) {
7477
7480
  const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
7478
7481
  d.node.stretchSections(Side.Left, d.coords[0] - pointerCoords[0], d.indexXInNode, d.indexYInNode);
7479
7482
  }
7480
7483
  }).on(DragEvents.End, (event, d) => {
7481
7484
  var _a, _b;
7482
- if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableX) && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === DiagramActions.StretchSection) {
7485
+ if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableX) && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === DiagramActions.StretchSection) {
7483
7486
  let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
7484
7487
  if (this.snapToGrid) {
7485
7488
  pointerCoords = this.getClosestGridPoint(pointerCoords);
@@ -7494,17 +7497,17 @@ class DiagramCanvas {
7494
7497
  }));
7495
7498
  enterSelection.filter('.resizable-y').append('line').attr('class', 'top-resizer').attr('stroke', 'transparent').attr('stroke-width', `${RESIZER_THICKNESS}px`).on(Events.MouseOver, (_event, d) => {
7496
7499
  var _a, _b;
7497
- if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableY) && !d.removed) {
7500
+ if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableY) && !d.removed) {
7498
7501
  setCursorStyle(CursorStyle.NSResize);
7499
7502
  }
7500
7503
  }).on(Events.MouseOut, (_event, d) => {
7501
7504
  var _a, _b;
7502
- if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableY) && !d.removed) {
7505
+ if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableY) && !d.removed) {
7503
7506
  setCursorStyle();
7504
7507
  }
7505
7508
  }).call(d3.drag().on(DragEvents.Start, (_event, d) => {
7506
7509
  var _a, _b;
7507
- if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableY) && !d.removed) {
7510
+ if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableY) && !d.removed) {
7508
7511
  setCursorStyle(CursorStyle.NSResize);
7509
7512
  this.currentAction = new SetGeometryAction(this, DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry());
7510
7513
  } else {
@@ -7512,13 +7515,13 @@ class DiagramCanvas {
7512
7515
  }
7513
7516
  }).on(DragEvents.Drag, (event, d) => {
7514
7517
  var _a, _b;
7515
- if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableY) && !d.removed) {
7518
+ if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableY) && !d.removed) {
7516
7519
  const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
7517
7520
  d.node.stretchSections(Side.Top, d.coords[1] - pointerCoords[1], d.indexXInNode, d.indexYInNode);
7518
7521
  }
7519
7522
  }).on(DragEvents.End, (event, d) => {
7520
7523
  var _a, _b;
7521
- if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableY) && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === DiagramActions.StretchSection) {
7524
+ if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableY) && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === DiagramActions.StretchSection) {
7522
7525
  let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
7523
7526
  if (this.snapToGrid) {
7524
7527
  pointerCoords = this.getClosestGridPoint(pointerCoords);
@@ -7533,17 +7536,17 @@ class DiagramCanvas {
7533
7536
  }));
7534
7537
  enterSelection.filter('.resizable-x').append('line').attr('class', 'right-resizer').attr('stroke', 'transparent').attr('stroke-width', `${RESIZER_THICKNESS}px`).on(Events.MouseOver, (_event, d) => {
7535
7538
  var _a, _b;
7536
- if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableX) && !d.removed) {
7539
+ if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableX) && !d.removed) {
7537
7540
  setCursorStyle(CursorStyle.EWResize);
7538
7541
  }
7539
7542
  }).on(Events.MouseOut, (_event, d) => {
7540
7543
  var _a, _b;
7541
- if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableX) && !d.removed) {
7544
+ if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableX) && !d.removed) {
7542
7545
  setCursorStyle();
7543
7546
  }
7544
7547
  }).call(d3.drag().on(DragEvents.Start, (_event, d) => {
7545
7548
  var _a, _b;
7546
- if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableX) && !d.removed) {
7549
+ if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableX) && !d.removed) {
7547
7550
  setCursorStyle(CursorStyle.EWResize);
7548
7551
  this.currentAction = new SetGeometryAction(this, DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry());
7549
7552
  } else {
@@ -7551,13 +7554,13 @@ class DiagramCanvas {
7551
7554
  }
7552
7555
  }).on(DragEvents.Drag, (event, d) => {
7553
7556
  var _a, _b;
7554
- if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableX) && !d.removed) {
7557
+ if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableX) && !d.removed) {
7555
7558
  const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
7556
7559
  d.node.stretchSections(Side.Right, pointerCoords[0] - (d.coords[0] + d.width), d.indexXInNode, d.indexYInNode);
7557
7560
  }
7558
7561
  }).on(DragEvents.End, (event, d) => {
7559
7562
  var _a, _b;
7560
- if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableX) && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === DiagramActions.StretchSection) {
7563
+ if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableX) && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === DiagramActions.StretchSection) {
7561
7564
  let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
7562
7565
  if (this.snapToGrid) {
7563
7566
  pointerCoords = this.getClosestGridPoint(pointerCoords);
@@ -7572,17 +7575,17 @@ class DiagramCanvas {
7572
7575
  }));
7573
7576
  enterSelection.filter('.resizable-y').append('line').attr('class', 'bottom-resizer').attr('stroke', 'transparent').attr('stroke-width', `${RESIZER_THICKNESS}px`).on(Events.MouseOver, (_event, d) => {
7574
7577
  var _a, _b;
7575
- if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableY) && !d.removed) {
7578
+ if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableY) && !d.removed) {
7576
7579
  setCursorStyle(CursorStyle.NSResize);
7577
7580
  }
7578
7581
  }).on(Events.MouseOut, (_event, d) => {
7579
7582
  var _a, _b;
7580
- if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableY) && !d.removed) {
7583
+ if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableY) && !d.removed) {
7581
7584
  setCursorStyle();
7582
7585
  }
7583
7586
  }).call(d3.drag().on(DragEvents.Start, (_event, d) => {
7584
7587
  var _a, _b;
7585
- if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableY) && !d.removed) {
7588
+ if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableY) && !d.removed) {
7586
7589
  setCursorStyle(CursorStyle.NSResize);
7587
7590
  this.currentAction = new SetGeometryAction(this, DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry());
7588
7591
  } else {
@@ -7590,13 +7593,13 @@ class DiagramCanvas {
7590
7593
  }
7591
7594
  }).on(DragEvents.Drag, (event, d) => {
7592
7595
  var _a, _b;
7593
- if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableY) && !d.removed) {
7596
+ if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableY) && !d.removed) {
7594
7597
  const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
7595
7598
  d.node.stretchSections(Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height), d.indexXInNode, d.indexYInNode);
7596
7599
  }
7597
7600
  }).on(DragEvents.End, (event, d) => {
7598
7601
  var _a, _b;
7599
- if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableY) && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === DiagramActions.StretchSection) {
7602
+ if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableY) && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === DiagramActions.StretchSection) {
7600
7603
  let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
7601
7604
  if (this.snapToGrid) {
7602
7605
  pointerCoords = this.getClosestGridPoint(pointerCoords);
@@ -7635,13 +7638,13 @@ class DiagramCanvas {
7635
7638
  if (this.unfinishedConnection) {
7636
7639
  const canConnectionFinishAtThisPort =
7637
7640
  // can start at the starting port
7638
- this.unfinishedConnection.type.canStartFromType(((_c = (_b = (_a = this.unfinishedConnection.start) === null || _a === undefined ? undefined : _a.getNode()) === null || _b === undefined ? undefined : _b.type) === null || _c === undefined ? undefined : _c.id) || '') && ((_d = this.unfinishedConnection.start) === null || _d === undefined ? undefined : _d.allowsOutgoing) &&
7641
+ this.unfinishedConnection.type.canStartFromType(((_c = (_b = (_a = this.unfinishedConnection.start) === null || _a === void 0 ? void 0 : _a.getNode()) === null || _b === void 0 ? void 0 : _b.type) === null || _c === void 0 ? void 0 : _c.id) || '') && ((_d = this.unfinishedConnection.start) === null || _d === void 0 ? void 0 : _d.allowsOutgoing) &&
7639
7642
  // can end at the ending port
7640
- this.unfinishedConnection.type.canFinishOnType(((_f = (_e = d.getNode()) === null || _e === undefined ? undefined : _e.type) === null || _f === undefined ? undefined : _f.id) || '') && d.allowsIncoming ||
7643
+ this.unfinishedConnection.type.canFinishOnType(((_f = (_e = d.getNode()) === null || _e === void 0 ? void 0 : _e.type) === null || _f === void 0 ? void 0 : _f.id) || '') && d.allowsIncoming ||
7641
7644
  // can start at the ending port
7642
- this.unfinishedConnection.type.canStartFromType(((_h = (_g = d.getNode()) === null || _g === undefined ? undefined : _g.type) === null || _h === undefined ? undefined : _h.id) || '') && d.allowsOutgoing &&
7645
+ this.unfinishedConnection.type.canStartFromType(((_h = (_g = d.getNode()) === null || _g === void 0 ? void 0 : _g.type) === null || _h === void 0 ? void 0 : _h.id) || '') && d.allowsOutgoing &&
7643
7646
  // can end at the starting port
7644
- this.unfinishedConnection.type.canFinishOnType(((_l = (_k = (_j = this.unfinishedConnection.start) === null || _j === undefined ? undefined : _j.getNode()) === null || _k === undefined ? undefined : _k.type) === null || _l === undefined ? undefined : _l.id) || '') && ((_m = this.unfinishedConnection.start) === null || _m === undefined ? undefined : _m.allowsIncoming);
7647
+ this.unfinishedConnection.type.canFinishOnType(((_l = (_k = (_j = this.unfinishedConnection.start) === null || _j === void 0 ? void 0 : _j.getNode()) === null || _k === void 0 ? void 0 : _k.type) === null || _l === void 0 ? void 0 : _l.id) || '') && ((_m = this.unfinishedConnection.start) === null || _m === void 0 ? void 0 : _m.allowsIncoming);
7645
7648
  if (!canConnectionFinishAtThisPort) {
7646
7649
  setCursorStyle(CursorStyle.NoDrop);
7647
7650
  }
@@ -7706,8 +7709,8 @@ class DiagramCanvas {
7706
7709
  if (this.canUserPerformAction(DiagramActions.AddConnection) && !d.removed) {
7707
7710
  if (this.unfinishedConnection !== undefined) {
7708
7711
  const endCoords = [event.x, event.y];
7709
- (_a = this.unfinishedConnectionTracer) === null || _a === undefined ? undefined : _a.attr('d', getConnectionPath(this.unfinishedConnection.look.shape, this.unfinishedConnection.startCoords, endCoords, this.unfinishedConnection.startDirection, this.unfinishedConnection.endDirection, this.unfinishedConnection.look.thickness, (_b = this.unfinishedConnection.startMarkerLook) === null || _b === undefined ? undefined : _b.width, (_c = this.unfinishedConnection.endMarkerLook) === null || _c === undefined ? undefined : _c.width));
7710
- const unfinishedConnectionGhostNode = (_d = this.unfinishedConnectionTracer) === null || _d === undefined ? undefined : _d.node();
7712
+ (_a = this.unfinishedConnectionTracer) === null || _a === void 0 ? void 0 : _a.attr('d', getConnectionPath(this.unfinishedConnection.look.shape, this.unfinishedConnection.startCoords, endCoords, this.unfinishedConnection.startDirection, this.unfinishedConnection.endDirection, this.unfinishedConnection.look.thickness, (_b = this.unfinishedConnection.startMarkerLook) === null || _b === void 0 ? void 0 : _b.width, (_c = this.unfinishedConnection.endMarkerLook) === null || _c === void 0 ? void 0 : _c.width));
7713
+ const unfinishedConnectionGhostNode = (_d = this.unfinishedConnectionTracer) === null || _d === void 0 ? void 0 : _d.node();
7711
7714
  if (unfinishedConnectionGhostNode) {
7712
7715
  let margin = 2;
7713
7716
  const unfinishedConnectionTotalLength = unfinishedConnectionGhostNode.getTotalLength();
@@ -7748,7 +7751,7 @@ class DiagramCanvas {
7748
7751
  this.finishMultipleSelection(event);
7749
7752
  } else {
7750
7753
  if (this.canUserPerformAction(DiagramActions.AddConnection) && !d.removed) {
7751
- (_a = this.unfinishedConnectionTracer) === null || _a === undefined ? undefined : _a.remove();
7754
+ (_a = this.unfinishedConnectionTracer) === null || _a === void 0 ? void 0 : _a.remove();
7752
7755
  const userHighlight = this.userHighlight.getFocus();
7753
7756
  if (userHighlight instanceof DiagramPort) {
7754
7757
  this.finishConnection(userHighlight);
@@ -7854,11 +7857,11 @@ class DiagramCanvas {
7854
7857
  enterSelection.select('g.diagram-connection-end-label').append('text').style('user-select', 'none');
7855
7858
  mergeSelection.attr('opacity', d => d.removed ? 0.5 : 1).select('path.diagram-connection-path').attr('d', d => {
7856
7859
  var _a, _b;
7857
- return getConnectionPath(d.look.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.look.thickness, (_a = d.startMarkerLook) === null || _a === undefined ? undefined : _a.width, (_b = d.endMarkerLook) === null || _b === undefined ? undefined : _b.width);
7860
+ return getConnectionPath(d.look.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.look.thickness, (_a = d.startMarkerLook) === null || _a === void 0 ? void 0 : _a.width, (_b = d.endMarkerLook) === null || _b === void 0 ? void 0 : _b.width);
7858
7861
  }).attr('marker-start', d => `url(#${d.id}-start-marker)`).attr('marker-end', d => `url(#${d.id}-end-marker)`).attr('stroke', d => d.look.color).attr('stroke-width', d => `${d.look.thickness}px`).attr('stroke-dasharray', d => lineStyleDasharray(d.look.style, d.look.thickness)).attr('fill', 'none');
7859
7862
  mergeSelection.select('path.diagram-connection-path-box').attr('d', d => {
7860
7863
  var _a, _b;
7861
- return getConnectionPath(d.look.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.look.thickness, (_a = d.startMarkerLook) === null || _a === undefined ? undefined : _a.width, (_b = d.endMarkerLook) === null || _b === undefined ? undefined : _b.width);
7864
+ return getConnectionPath(d.look.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.look.thickness, (_a = d.startMarkerLook) === null || _a === void 0 ? void 0 : _a.width, (_b = d.endMarkerLook) === null || _b === void 0 ? void 0 : _b.width);
7862
7865
  }).attr('stroke', 'transparent')
7863
7866
  // allow generating pointer events even when it is transparent
7864
7867
  .attr('pointer-events', 'stroke').attr('stroke-width', d => `${d.look.thickness + CONNECTION_PATH_BOX_THICKNESS}px`).attr('stroke-dasharray', d => lineStyleDasharray(d.look.style, d.look.thickness)).attr('fill', 'none');
@@ -7913,8 +7916,12 @@ class DiagramCanvas {
7913
7916
  this.diagramEvent$.next(diagramEvent);
7914
7917
  if (!diagramEvent.defaultPrevented && this.canUserPerformAction(DiagramActions.EditField) && d.editable && !d.removed) {
7915
7918
  this.currentAction = new EditFieldAction(this, d.id, d.text, '');
7916
- this.createInputField(d.text, d.coords, d.width, d.height, d.fontSize, d.fontFamily || DIAGRAM_FIELD_DEFAULTS.fontFamily, text => {
7917
- d.text = text;
7919
+ this.createInputField(d.text, d.coords, d.width, d.height, d.fontSize, d.fontFamily || DIAGRAM_FIELD_DEFAULTS.fontFamily, d.orientation, text => {
7920
+ /*
7921
+ Empty for now
7922
+ We should create a better function to stretch the root element as the text expands
7923
+ Bear in mind that DiagramNode.setGeometry() calls DiagramNode.raise(), which breaks the input field
7924
+ */
7918
7925
  }, text => {
7919
7926
  d.text = text;
7920
7927
  if (this.currentAction instanceof EditFieldAction) {
@@ -7978,7 +7985,24 @@ class DiagramCanvas {
7978
7985
  }
7979
7986
  this.secondaryButton = false;
7980
7987
  })).append('xhtml:div').style('width', '100%').style('height', '100%').style('display', 'flex').append('xhtml:p').style('box-sizing', 'border-box').style('outline', 0).style('margin', 0).style('border', 0).style('padding', 0).style('user-select', 'none').style('font-kerning', 'none').style('white-space', 'nowrap');
7981
- mergeSelection.attr('x', 0).attr('y', 0).attr('width', d => `${d.width}px`).attr('height', d => `${d.height}px`).attr('transform', d => `translate(${d.coords[0]},${d.coords[1]})`).attr('opacity', d => d.removed ? 0.5 : 1).select('div').style('justify-content', d => d.horizontalAlign === HorizontalAlign.Center ? 'center' : d.horizontalAlign === HorizontalAlign.Right ? 'flex-end' : 'flex-start').style('align-items', d => d.verticalAlign === VerticalAlign.Center ? 'center' : d.verticalAlign === VerticalAlign.Bottom ? 'end' : 'start').select('p').style('max-width', d => d.fit ? 'default' : '100%').style('max-height', d => d.fit ? 'default' : '100%').style('overflow', d => d.fit ? 'default' : 'hidden').style('text-overflow', d => d.fit ? 'default' : 'ellipsis').style('text-align', d => d.horizontalAlign === HorizontalAlign.Center ? 'center' : d.horizontalAlign === HorizontalAlign.Right ? 'end' : 'start').style('font-size', d => `${d.fontSize}px`).style('font-family', d => d.fontFamily || "'Wonder Unit Sans', sans-serif").style('font-weight', d => d.highlighted ? 600 : 400).style('color', d => d.selected ? d.selectedColor || '#000000' : d.color || '#000000').html(d => d.text.replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\n/g, '<br/>'));
7988
+ mergeSelection.attr('x', 0).attr('y', 0).attr('width', d => `${d.width}px`).attr('height', d => `${d.height}px`).attr('transform', d => `translate(${d.coords[0]},${d.coords[1]})`).attr('opacity', d => d.removed ? 0.5 : 1).select('div').style('justify-content', d => d.horizontalAlign === HorizontalAlign.Center ? 'center' : d.horizontalAlign === HorizontalAlign.Right ? 'flex-end' : 'flex-start').style('align-items', d => d.verticalAlign === VerticalAlign.Center ? 'center' : d.verticalAlign === VerticalAlign.Bottom ? 'end' : 'start').select('p').style('max-width', d => d.fit ? 'default' : '100%').style('max-height', d => d.fit ? 'default' : '100%').style('overflow', d => d.fit ? 'default' : 'hidden').style('text-overflow', d => d.fit ? 'default' : 'ellipsis').style('text-align', d => d.horizontalAlign === HorizontalAlign.Center ? 'center' : d.horizontalAlign === HorizontalAlign.Right ? 'end' : 'start').style('transform', d => {
7989
+ if (!isNaN(Number(d.orientation))) {
7990
+ return `rotate(${d.orientation}deg)`;
7991
+ } else {
7992
+ switch (d.orientation) {
7993
+ case Side.Top:
7994
+ return 'rotate(0deg)';
7995
+ case Side.Right:
7996
+ return 'rotate(90deg)';
7997
+ case Side.Bottom:
7998
+ return 'rotate(180deg)';
7999
+ case Side.Left:
8000
+ return 'rotate(270deg)';
8001
+ default:
8002
+ return 'rotate(0deg)';
8003
+ }
8004
+ }
8005
+ }).style('font-size', d => `${d.fontSize}px`).style('font-family', d => d.fontFamily || "'Wonder Unit Sans', sans-serif").style('font-weight', d => d.highlighted ? 600 : 400).style('color', d => d.selected ? d.selectedColor || '#000000' : d.color || '#000000').html(d => d.text.replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\n/g, '<br/>'));
7982
8006
  }
7983
8007
  updateObjectsInView(...ids) {
7984
8008
  let updateSelection = this.selectCanvasElements().selectAll('foreignObject.diagram-object').data(this.model.objects.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true), d => d.id);
@@ -8136,7 +8160,7 @@ class DiagramCanvas {
8136
8160
  const pathLength = pathNode.getTotalLength();
8137
8161
  // bind start labels
8138
8162
  connectionSelection.select('g.diagram-connection-start-label text').attr('x', 0).attr('y', labelConfiguration.fontSize / 3).attr('text-anchor', 'middle').attr('font-family', labelConfiguration.fontFamily).attr('font-size', labelConfiguration.fontSize).attr('fill', connection.selected ? labelConfiguration.selectedColor : labelConfiguration.color).style('font-kerning', 'none').text(connection.startLabel);
8139
- const startLabelBoundingRect = (_a = connectionSelection.select('g.diagram-connection-start-label text').node()) === null || _a === undefined ? undefined : _a.getBoundingClientRect();
8163
+ const startLabelBoundingRect = (_a = connectionSelection.select('g.diagram-connection-start-label text').node()) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
8140
8164
  if (startLabelBoundingRect) {
8141
8165
  // don't create space for the label if the label is empty
8142
8166
  const boundingWidth = !connection.startLabel ? 0 : startLabelBoundingRect.width / this.zoomTransform.k + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
@@ -8147,7 +8171,7 @@ class DiagramCanvas {
8147
8171
  }
8148
8172
  // bind middle labels
8149
8173
  connectionSelection.select('g.diagram-connection-middle-label text').attr('x', 0).attr('y', labelConfiguration.fontSize / 3).attr('text-anchor', 'middle').attr('font-family', labelConfiguration.fontFamily).attr('font-size', labelConfiguration.fontSize).attr('fill', connection.selected ? labelConfiguration.selectedColor : labelConfiguration.color).style('font-kerning', 'none').text(connection.middleLabel);
8150
- const middleLabelBoundingRect = (_b = connectionSelection.select('g.diagram-connection-middle-label text').node()) === null || _b === undefined ? undefined : _b.getBoundingClientRect();
8174
+ const middleLabelBoundingRect = (_b = connectionSelection.select('g.diagram-connection-middle-label text').node()) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
8151
8175
  if (middleLabelBoundingRect) {
8152
8176
  // don't create space for the label if the label is empty
8153
8177
  const boundingWidth = !connection.middleLabel ? 0 : middleLabelBoundingRect.width / this.zoomTransform.k + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
@@ -8158,7 +8182,7 @@ class DiagramCanvas {
8158
8182
  }
8159
8183
  // bind end labels
8160
8184
  connectionSelection.select('g.diagram-connection-end-label text').attr('x', 0).attr('y', labelConfiguration.fontSize / 3).attr('text-anchor', 'middle').attr('font-family', labelConfiguration.fontFamily).attr('font-size', labelConfiguration.fontSize).attr('fill', connection.selected ? labelConfiguration.selectedColor : labelConfiguration.color).style('font-kerning', 'none').text(connection.endLabel);
8161
- const endLabelBoundingRect = (_c = connectionSelection.select('g.diagram-connection-end-label text').node()) === null || _c === undefined ? undefined : _c.getBoundingClientRect();
8185
+ const endLabelBoundingRect = (_c = connectionSelection.select('g.diagram-connection-end-label text').node()) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect();
8162
8186
  if (endLabelBoundingRect) {
8163
8187
  // don't create space for the label if the label is empty
8164
8188
  const boundingWidth = !connection.endLabel ? 0 : endLabelBoundingRect.width / this.zoomTransform.k + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
@@ -8192,8 +8216,8 @@ class DiagramCanvas {
8192
8216
  }
8193
8217
  if (field.rootElement instanceof DiagramNode || field.rootElement instanceof DiagramSection) {
8194
8218
  const fieldDimensions = this.minimumSizeOfField(field);
8195
- const stretchX = fieldDimensions[0] + getLeftMargin((_a = field.rootElement.type) === null || _a === undefined ? undefined : _a.label) + getRightMargin((_b = field.rootElement.type) === null || _b === undefined ? undefined : _b.label) - field.rootElement.width;
8196
- const stretchY = fieldDimensions[1] + getTopMargin((_c = field.rootElement.type) === null || _c === undefined ? undefined : _c.label) + getBottomMargin((_d = field.rootElement.type) === null || _d === undefined ? undefined : _d.label) - field.rootElement.height;
8219
+ const stretchX = fieldDimensions[0] + getLeftMargin((_a = field.rootElement.type) === null || _a === void 0 ? void 0 : _a.label) + getRightMargin((_b = field.rootElement.type) === null || _b === void 0 ? void 0 : _b.label) - field.rootElement.width;
8220
+ const stretchY = fieldDimensions[1] + getTopMargin((_c = field.rootElement.type) === null || _c === void 0 ? void 0 : _c.label) + getBottomMargin((_d = field.rootElement.type) === null || _d === void 0 ? void 0 : _d.label) - field.rootElement.height;
8197
8221
  return stretchX <= 0 && stretchY <= 0;
8198
8222
  }
8199
8223
  return true;
@@ -8230,7 +8254,7 @@ class DiagramCanvas {
8230
8254
  const fieldDimensions = this.minimumSizeOfField(field);
8231
8255
  let minimumFieldWidth = fieldDimensions[0];
8232
8256
  let minimumFieldHeight = fieldDimensions[1];
8233
- for (const section of ((_a = field.rootElement.node) === null || _a === undefined ? undefined : _a.sections) || []) {
8257
+ for (const section of ((_a = field.rootElement.node) === null || _a === void 0 ? void 0 : _a.sections) || []) {
8234
8258
  if (section.label) {
8235
8259
  if (section.indexXInNode === field.rootElement.indexXInNode && section.indexYInNode !== field.rootElement.indexYInNode) {
8236
8260
  minimumFieldWidth = Math.max(minimumFieldWidth, this.minimumSizeOfField(section.label)[0]);
@@ -8246,8 +8270,8 @@ class DiagramCanvas {
8246
8270
  fieldDimensions[1] = minimumFieldHeight;
8247
8271
  }
8248
8272
  const type = field.rootElement.type;
8249
- let stretchX = fieldDimensions[0] + getLeftMargin(type === null || type === undefined ? undefined : type.label) + getRightMargin(type === null || type === undefined ? undefined : type.label) - field.rootElement.width;
8250
- let stretchY = fieldDimensions[1] + getTopMargin(type === null || type === undefined ? undefined : type.label) + getBottomMargin(type === null || type === undefined ? undefined : type.label) - field.rootElement.height;
8273
+ let stretchX = fieldDimensions[0] + getLeftMargin(type === null || type === void 0 ? void 0 : type.label) + getRightMargin(type === null || type === void 0 ? void 0 : type.label) - field.rootElement.width;
8274
+ let stretchY = fieldDimensions[1] + getTopMargin(type === null || type === void 0 ? void 0 : type.label) + getBottomMargin(type === null || type === void 0 ? void 0 : type.label) - field.rootElement.height;
8251
8275
  if (this.snapToGrid) {
8252
8276
  stretchX = Math.ceil(stretchX / this.gridSize) * this.gridSize;
8253
8277
  stretchY = Math.ceil(stretchY / this.gridSize) * this.gridSize;
@@ -8260,10 +8284,10 @@ class DiagramCanvas {
8260
8284
  stretchY = (field.rootElement.getMinHeight() || 0) - field.rootElement.height;
8261
8285
  }
8262
8286
  if (shrink !== false || stretchX > 0) {
8263
- (_b = field.rootElement.node) === null || _b === undefined ? undefined : _b.stretchSections(Side.Right, stretchX, field.rootElement.indexXInNode, field.rootElement.indexYInNode);
8287
+ (_b = field.rootElement.node) === null || _b === void 0 ? void 0 : _b.stretchSections(Side.Right, stretchX, field.rootElement.indexXInNode, field.rootElement.indexYInNode);
8264
8288
  }
8265
8289
  if (shrink !== false || stretchY > 0) {
8266
- (_c = field.rootElement.node) === null || _c === undefined ? undefined : _c.stretchSections(Side.Bottom, stretchY, field.rootElement.indexXInNode, field.rootElement.indexYInNode);
8290
+ (_c = field.rootElement.node) === null || _c === void 0 ? void 0 : _c.stretchSections(Side.Bottom, stretchY, field.rootElement.indexXInNode, field.rootElement.indexYInNode);
8267
8291
  }
8268
8292
  }
8269
8293
  }
@@ -8286,8 +8310,8 @@ class DiagramCanvas {
8286
8310
  }
8287
8311
  }
8288
8312
  // add the margin that goes between the rightmost and bottommost points of the sections and the edge of the node
8289
- newNodeWidth += ((_a = node.type.sectionGrid) === null || _a === undefined ? undefined : _a.margin) || 0;
8290
- newNodeHeight += ((_b = node.type.sectionGrid) === null || _b === undefined ? undefined : _b.margin) || 0;
8313
+ newNodeWidth += ((_a = node.type.sectionGrid) === null || _a === void 0 ? void 0 : _a.margin) || 0;
8314
+ newNodeHeight += ((_b = node.type.sectionGrid) === null || _b === void 0 ? void 0 : _b.margin) || 0;
8291
8315
  node.stretch(Side.Right, newNodeWidth - node.width);
8292
8316
  node.stretch(Side.Bottom, newNodeHeight - node.height);
8293
8317
  }
@@ -8308,18 +8332,18 @@ class DiagramCanvas {
8308
8332
  startConnection(port) {
8309
8333
  var _a, _b, _c, _d;
8310
8334
  if (port.allowsOutgoing || port.allowsIncoming) {
8311
- if (this.connectionType && (this.connectionType.canStartFromType(((_b = (_a = port.getNode()) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.id) || '') && port.allowsOutgoing || this.connectionType.canFinishOnType(((_d = (_c = port.getNode()) === null || _c === undefined ? undefined : _c.type) === null || _d === undefined ? undefined : _d.id) || '') && port.allowsIncoming)) {
8335
+ if (this.connectionType && (this.connectionType.canStartFromType(((_b = (_a = port.getNode()) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.id) || '') && port.allowsOutgoing || this.connectionType.canFinishOnType(((_d = (_c = port.getNode()) === null || _c === void 0 ? void 0 : _c.type) === null || _d === void 0 ? void 0 : _d.id) || '') && port.allowsIncoming)) {
8312
8336
  this.unfinishedConnection = new DiagramConnection(this.model, this.connectionType, port, undefined, UNFINISHED_CONNECTION_ID);
8313
8337
  } else {
8314
8338
  if (this.inferConnectionType) {
8315
8339
  let differentConnectionType = this.model.connections.types.all().find(t => {
8316
8340
  var _a, _b;
8317
- return port.allowsOutgoing && t.canStartFromType(((_b = (_a = port.getNode()) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.id) || '');
8341
+ return port.allowsOutgoing && t.canStartFromType(((_b = (_a = port.getNode()) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.id) || '');
8318
8342
  });
8319
8343
  if (differentConnectionType === undefined) {
8320
8344
  differentConnectionType = this.model.connections.types.all().find(t => {
8321
8345
  var _a, _b;
8322
- return port.allowsIncoming && t.canFinishOnType(((_b = (_a = port.getNode()) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.id) || '');
8346
+ return port.allowsIncoming && t.canFinishOnType(((_b = (_a = port.getNode()) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.id) || '');
8323
8347
  });
8324
8348
  }
8325
8349
  if (differentConnectionType !== undefined) {
@@ -8334,14 +8358,14 @@ class DiagramCanvas {
8334
8358
  this.userHighlight.clear();
8335
8359
  if (this.unfinishedConnection !== undefined) {
8336
8360
  if (this.unfinishedConnection.start !== port) {
8337
- if (this.unfinishedConnection.type.canStartFromType(((_d = (_c = (_b = (_a = this.unfinishedConnection) === null || _a === undefined ? undefined : _a.start) === null || _b === undefined ? undefined : _b.getNode()) === null || _c === undefined ? undefined : _c.type) === null || _d === undefined ? undefined : _d.id) || '') && ((_f = (_e = this.unfinishedConnection) === null || _e === undefined ? undefined : _e.start) === null || _f === undefined ? undefined : _f.allowsOutgoing) && this.unfinishedConnection.type.canFinishOnType(((_h = (_g = port.getNode()) === null || _g === undefined ? undefined : _g.type) === null || _h === undefined ? undefined : _h.id) || '') && port.allowsIncoming) {
8338
- const addConnectionAction = new AddConnectionAction(this, this.unfinishedConnection.type, (_j = this.unfinishedConnection.start) === null || _j === undefined ? undefined : _j.id, port.id);
8361
+ if (this.unfinishedConnection.type.canStartFromType(((_d = (_c = (_b = (_a = this.unfinishedConnection) === null || _a === void 0 ? void 0 : _a.start) === null || _b === void 0 ? void 0 : _b.getNode()) === null || _c === void 0 ? void 0 : _c.type) === null || _d === void 0 ? void 0 : _d.id) || '') && ((_f = (_e = this.unfinishedConnection) === null || _e === void 0 ? void 0 : _e.start) === null || _f === void 0 ? void 0 : _f.allowsOutgoing) && this.unfinishedConnection.type.canFinishOnType(((_h = (_g = port.getNode()) === null || _g === void 0 ? void 0 : _g.type) === null || _h === void 0 ? void 0 : _h.id) || '') && port.allowsIncoming) {
8362
+ const addConnectionAction = new AddConnectionAction(this, this.unfinishedConnection.type, (_j = this.unfinishedConnection.start) === null || _j === void 0 ? void 0 : _j.id, port.id);
8339
8363
  // clean up the previous unfinished connection
8340
8364
  this.dropConnection();
8341
8365
  addConnectionAction.do();
8342
8366
  this.actionStack.add(addConnectionAction);
8343
- } else if (this.unfinishedConnection.type.canFinishOnType(((_o = (_m = (_l = (_k = this.unfinishedConnection) === null || _k === undefined ? undefined : _k.start) === null || _l === undefined ? undefined : _l.getNode()) === null || _m === undefined ? undefined : _m.type) === null || _o === undefined ? undefined : _o.id) || '') && ((_q = (_p = this.unfinishedConnection) === null || _p === undefined ? undefined : _p.start) === null || _q === undefined ? undefined : _q.allowsIncoming) && this.unfinishedConnection.type.canStartFromType(((_s = (_r = port.getNode()) === null || _r === undefined ? undefined : _r.type) === null || _s === undefined ? undefined : _s.id) || '') && port.allowsOutgoing) {
8344
- const addConnectionAction = new AddConnectionAction(this, this.unfinishedConnection.type, port.id, (_t = this.unfinishedConnection.start) === null || _t === undefined ? undefined : _t.id);
8367
+ } else if (this.unfinishedConnection.type.canFinishOnType(((_o = (_m = (_l = (_k = this.unfinishedConnection) === null || _k === void 0 ? void 0 : _k.start) === null || _l === void 0 ? void 0 : _l.getNode()) === null || _m === void 0 ? void 0 : _m.type) === null || _o === void 0 ? void 0 : _o.id) || '') && ((_q = (_p = this.unfinishedConnection) === null || _p === void 0 ? void 0 : _p.start) === null || _q === void 0 ? void 0 : _q.allowsIncoming) && this.unfinishedConnection.type.canStartFromType(((_s = (_r = port.getNode()) === null || _r === void 0 ? void 0 : _r.type) === null || _s === void 0 ? void 0 : _s.id) || '') && port.allowsOutgoing) {
8368
+ const addConnectionAction = new AddConnectionAction(this, this.unfinishedConnection.type, port.id, (_t = this.unfinishedConnection.start) === null || _t === void 0 ? void 0 : _t.id);
8345
8369
  // clean up the previous unfinished connection
8346
8370
  this.dropConnection();
8347
8371
  addConnectionAction.do();
@@ -8350,18 +8374,18 @@ class DiagramCanvas {
8350
8374
  if (this.inferConnectionType) {
8351
8375
  let differentConnectionType = this.model.connections.types.all().find(t => {
8352
8376
  var _a, _b, _c, _d, _e, _f, _g, _h;
8353
- return t.canStartFromType(((_d = (_c = (_b = (_a = this.unfinishedConnection) === null || _a === undefined ? undefined : _a.start) === null || _b === undefined ? undefined : _b.getNode()) === null || _c === undefined ? undefined : _c.type) === null || _d === undefined ? undefined : _d.id) || '') && ((_f = (_e = this.unfinishedConnection) === null || _e === undefined ? undefined : _e.start) === null || _f === undefined ? undefined : _f.allowsOutgoing) && t.canFinishOnType(((_h = (_g = port.getNode()) === null || _g === undefined ? undefined : _g.type) === null || _h === undefined ? undefined : _h.id) || '') && port.allowsIncoming;
8377
+ return t.canStartFromType(((_d = (_c = (_b = (_a = this.unfinishedConnection) === null || _a === void 0 ? void 0 : _a.start) === null || _b === void 0 ? void 0 : _b.getNode()) === null || _c === void 0 ? void 0 : _c.type) === null || _d === void 0 ? void 0 : _d.id) || '') && ((_f = (_e = this.unfinishedConnection) === null || _e === void 0 ? void 0 : _e.start) === null || _f === void 0 ? void 0 : _f.allowsOutgoing) && t.canFinishOnType(((_h = (_g = port.getNode()) === null || _g === void 0 ? void 0 : _g.type) === null || _h === void 0 ? void 0 : _h.id) || '') && port.allowsIncoming;
8354
8378
  });
8355
8379
  let invertConnection = false;
8356
8380
  if (differentConnectionType === undefined) {
8357
8381
  differentConnectionType = this.model.connections.types.all().find(t => {
8358
8382
  var _a, _b, _c, _d, _e, _f, _g, _h;
8359
- return t.canFinishOnType(((_d = (_c = (_b = (_a = this.unfinishedConnection) === null || _a === undefined ? undefined : _a.start) === null || _b === undefined ? undefined : _b.getNode()) === null || _c === undefined ? undefined : _c.type) === null || _d === undefined ? undefined : _d.id) || '') && ((_f = (_e = this.unfinishedConnection) === null || _e === undefined ? undefined : _e.start) === null || _f === undefined ? undefined : _f.allowsIncoming) && t.canStartFromType(((_h = (_g = port.getNode()) === null || _g === undefined ? undefined : _g.type) === null || _h === undefined ? undefined : _h.id) || '') && port.allowsOutgoing;
8383
+ return t.canFinishOnType(((_d = (_c = (_b = (_a = this.unfinishedConnection) === null || _a === void 0 ? void 0 : _a.start) === null || _b === void 0 ? void 0 : _b.getNode()) === null || _c === void 0 ? void 0 : _c.type) === null || _d === void 0 ? void 0 : _d.id) || '') && ((_f = (_e = this.unfinishedConnection) === null || _e === void 0 ? void 0 : _e.start) === null || _f === void 0 ? void 0 : _f.allowsIncoming) && t.canStartFromType(((_h = (_g = port.getNode()) === null || _g === void 0 ? void 0 : _g.type) === null || _h === void 0 ? void 0 : _h.id) || '') && port.allowsOutgoing;
8360
8384
  });
8361
8385
  invertConnection = true;
8362
8386
  }
8363
8387
  if (differentConnectionType !== undefined) {
8364
- const addConnectionAction = new AddConnectionAction(this, differentConnectionType, invertConnection ? port.id : (_u = this.unfinishedConnection.start) === null || _u === undefined ? undefined : _u.id, invertConnection ? (_v = this.unfinishedConnection.start) === null || _v === undefined ? undefined : _v.id : port.id);
8388
+ const addConnectionAction = new AddConnectionAction(this, differentConnectionType, invertConnection ? port.id : (_u = this.unfinishedConnection.start) === null || _u === void 0 ? void 0 : _u.id, invertConnection ? (_v = this.unfinishedConnection.start) === null || _v === void 0 ? void 0 : _v.id : port.id);
8365
8389
  // clean up the previous unfinished connection
8366
8390
  this.dropConnection();
8367
8391
  addConnectionAction.do();
@@ -8383,9 +8407,9 @@ class DiagramCanvas {
8383
8407
  }
8384
8408
  dropConnection() {
8385
8409
  var _a, _b, _c, _d;
8386
- (_a = this.unfinishedConnection) === null || _a === undefined ? undefined : _a.setStart(undefined);
8387
- (_b = this.unfinishedConnection) === null || _b === undefined ? undefined : _b.setEnd(undefined);
8388
- (_d = (_c = this.unfinishedConnection) === null || _c === undefined ? undefined : _c.select()) === null || _d === undefined ? undefined : _d.remove();
8410
+ (_a = this.unfinishedConnection) === null || _a === void 0 ? void 0 : _a.setStart(undefined);
8411
+ (_b = this.unfinishedConnection) === null || _b === void 0 ? void 0 : _b.setEnd(undefined);
8412
+ (_d = (_c = this.unfinishedConnection) === null || _c === void 0 ? void 0 : _c.select()) === null || _d === void 0 ? void 0 : _d.remove();
8389
8413
  this.unfinishedConnection = undefined;
8390
8414
  }
8391
8415
  cancelAllUserActions() {
@@ -8398,7 +8422,7 @@ class DiagramCanvas {
8398
8422
  canUserPerformAction(action) {
8399
8423
  return this.userActions[action] !== false;
8400
8424
  }
8401
- createInputField(text, coords, width, height, fontSize, fontFamily, changeCallback, finishCallback) {
8425
+ createInputField(text, coords, width, height, fontSize, fontFamily, orientation, changeCallback, finishCallback) {
8402
8426
  // if we have a text input open, close it before creating a new one
8403
8427
  this.removeInputField();
8404
8428
  const inputFieldContainer = this.selectCanvasElements().append('foreignObject').attr('x', `${coords[0]}px`).attr('y', `${coords[1]}px`).attr('width', `${width}px`).attr('height', `${height}px`).style('box-sizing', 'border-box').style('border', '1px solid');
@@ -8430,9 +8454,9 @@ class DiagramCanvas {
8430
8454
  // keep the field from shrinking below its original size
8431
8455
  const newWidth = Math.max(inputFieldWidth, width);
8432
8456
  const newHeight = Math.max(inputFieldHeight, height);
8433
- inputFieldContainer === null || inputFieldContainer === undefined ? undefined : inputFieldContainer.attr('width', `${newWidth}px`);
8457
+ inputFieldContainer === null || inputFieldContainer === void 0 ? void 0 : inputFieldContainer.attr('width', `${newWidth}px`);
8434
8458
  inputField.style('width', `${newWidth}px`);
8435
- inputFieldContainer === null || inputFieldContainer === undefined ? undefined : inputFieldContainer.attr('height', `${newHeight}px`);
8459
+ inputFieldContainer === null || inputFieldContainer === void 0 ? void 0 : inputFieldContainer.attr('height', `${newHeight}px`);
8436
8460
  inputField.style('height', `${newHeight}px`);
8437
8461
  if (changeCallback) {
8438
8462
  changeCallback(value);
@@ -8454,13 +8478,13 @@ class DiagramCanvas {
8454
8478
  var _a, _b, _c;
8455
8479
  // when removing an element, a blur event is emitted
8456
8480
  // we remove the listener for blur so that it doesn't shoot again on element removal
8457
- (_b = (_a = this.inputFieldContainer) === null || _a === undefined ? undefined : _a.select('input')) === null || _b === undefined ? undefined : _b.on(Events.Blur, null);
8458
- (_c = this.inputFieldContainer) === null || _c === undefined ? undefined : _c.remove();
8481
+ (_b = (_a = this.inputFieldContainer) === null || _a === void 0 ? void 0 : _a.select('input')) === null || _b === void 0 ? void 0 : _b.on(Events.Blur, null);
8482
+ (_c = this.inputFieldContainer) === null || _c === void 0 ? void 0 : _c.remove();
8459
8483
  this.inputFieldContainer = undefined;
8460
8484
  }
8461
8485
  minimumSizeOfField(field) {
8462
8486
  var _a, _b;
8463
- const pNode = (_b = (_a = field.select()) === null || _a === undefined ? undefined : _a.select('p')) === null || _b === undefined ? undefined : _b.node();
8487
+ const pNode = (_b = (_a = field.select()) === null || _a === void 0 ? void 0 : _a.select('p')) === null || _b === void 0 ? void 0 : _b.node();
8464
8488
  if (!pNode) {
8465
8489
  // happens when a field has been created but not updated in view yet
8466
8490
  return [0, 0];
@@ -8479,7 +8503,7 @@ class DiagramCanvas {
8479
8503
  this.currentAction = new MoveAction(this, this.userSelection.filter(e => e instanceof DiagramNode).map(n => n.id), d.coords);
8480
8504
  } else {
8481
8505
  const ancestorOfNode = d.getLastAncestor();
8482
- this.currentAction = new SetGeometryAction(this, DiagramActions.MoveNode, d.id, d.getGeometry(), d.getGeometry(), ancestorOfNode === null || ancestorOfNode === undefined ? undefined : ancestorOfNode.id, ancestorOfNode === null || ancestorOfNode === undefined ? undefined : ancestorOfNode.getGeometry(d.id), ancestorOfNode === null || ancestorOfNode === undefined ? undefined : ancestorOfNode.getGeometry(d.id));
8506
+ this.currentAction = new SetGeometryAction(this, DiagramActions.MoveNode, d.id, d.getGeometry(), d.getGeometry(), ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.id, ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.getGeometry(d.id), ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.getGeometry(d.id));
8483
8507
  }
8484
8508
  } else {
8485
8509
  setCursorStyle(CursorStyle.NotAllowed);
@@ -8532,23 +8556,23 @@ class DiagramCanvas {
8532
8556
  const filteredNodesAtLocation = filterByOnlyDescendants(nodesAtLocationWhichCanHaveNodeAsAChild);
8533
8557
  const droppedOn = filteredNodesAtLocation[filteredNodesAtLocation.length - 1];
8534
8558
  if (droppedOn !== d.parent && (d.type.canBeParentless || droppedOn !== undefined)) {
8535
- const ancestorOfDroppedOn = droppedOn === null || droppedOn === undefined ? undefined : droppedOn.getLastAncestor();
8559
+ const ancestorOfDroppedOn = droppedOn === null || droppedOn === void 0 ? void 0 : droppedOn.getLastAncestor();
8536
8560
  const fromChildGeometry = this.currentAction.from;
8537
- const setParentAction = new SetParentAction(this, d.id, (_a = d.parent) === null || _a === undefined ? undefined : _a.id, droppedOn === null || droppedOn === undefined ? undefined : droppedOn.id, fromChildGeometry, d.getGeometry(), ancestorOfDroppedOn === null || ancestorOfDroppedOn === undefined ? undefined : ancestorOfDroppedOn.id, ancestorOfDroppedOn === null || ancestorOfDroppedOn === undefined ? undefined : ancestorOfDroppedOn.getGeometry(d.id), ancestorOfDroppedOn === null || ancestorOfDroppedOn === undefined ? undefined : ancestorOfDroppedOn.getGeometry(d.id));
8538
- (_b = d.parent) === null || _b === undefined ? undefined : _b.removeChild(d);
8561
+ const setParentAction = new SetParentAction(this, d.id, (_a = d.parent) === null || _a === void 0 ? void 0 : _a.id, droppedOn === null || droppedOn === void 0 ? void 0 : droppedOn.id, fromChildGeometry, d.getGeometry(), ancestorOfDroppedOn === null || ancestorOfDroppedOn === void 0 ? void 0 : ancestorOfDroppedOn.id, ancestorOfDroppedOn === null || ancestorOfDroppedOn === void 0 ? void 0 : ancestorOfDroppedOn.getGeometry(d.id), ancestorOfDroppedOn === null || ancestorOfDroppedOn === void 0 ? void 0 : ancestorOfDroppedOn.getGeometry(d.id));
8562
+ (_b = d.parent) === null || _b === void 0 ? void 0 : _b.removeChild(d);
8539
8563
  if (droppedOn !== undefined) {
8540
8564
  droppedOn.addChild(d);
8541
8565
  }
8542
8566
  setParentAction.toChildGeometry = d.getGeometry(d.id);
8543
- setParentAction.toAncestorGeometry = ancestorOfDroppedOn === null || ancestorOfDroppedOn === undefined ? undefined : ancestorOfDroppedOn.getGeometry(d.id);
8567
+ setParentAction.toAncestorGeometry = ancestorOfDroppedOn === null || ancestorOfDroppedOn === void 0 ? void 0 : ancestorOfDroppedOn.getGeometry(d.id);
8544
8568
  this.currentAction = setParentAction;
8545
8569
  } else {
8546
- const ancestorOfNode = d === null || d === undefined ? undefined : d.getLastAncestor();
8547
- this.currentAction.ancestorId = ancestorOfNode === null || ancestorOfNode === undefined ? undefined : ancestorOfNode.id;
8548
- this.currentAction.fromAncestorGeometry = ancestorOfNode === null || ancestorOfNode === undefined ? undefined : ancestorOfNode.getGeometry(d.id);
8549
- (_c = d.parent) === null || _c === undefined ? undefined : _c.fitToChild(d);
8570
+ const ancestorOfNode = d === null || d === void 0 ? void 0 : d.getLastAncestor();
8571
+ this.currentAction.ancestorId = ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.id;
8572
+ this.currentAction.fromAncestorGeometry = ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.getGeometry(d.id);
8573
+ (_c = d.parent) === null || _c === void 0 ? void 0 : _c.fitToChild(d);
8550
8574
  this.currentAction.to = d.getGeometry(d.id);
8551
- this.currentAction.toAncestorGeometry = ancestorOfNode === null || ancestorOfNode === undefined ? undefined : ancestorOfNode.getGeometry(d.id);
8575
+ this.currentAction.toAncestorGeometry = ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.getGeometry(d.id);
8552
8576
  }
8553
8577
  }
8554
8578
  if (this.currentAction !== undefined) {
@@ -8574,14 +8598,14 @@ class DiagramCanvas {
8574
8598
  setCursorStyle(CursorStyle.Crosshair);
8575
8599
  // since the multiple selection rectangle is not affected by zoom,
8576
8600
  // we compensate its coordinates based in the zoom transform to draw it
8577
- (_d = (_c = (_b = (_a = this.multipleSelectionContainer) === null || _a === undefined ? undefined : _a.attr('x', Math.min(this.draggingFrom[0], pointerCoords[0]) * this.zoomTransform.k + this.zoomTransform.x)) === null || _b === undefined ? undefined : _b.attr('y', Math.min(this.draggingFrom[1], pointerCoords[1]) * this.zoomTransform.k + this.zoomTransform.y)) === null || _c === undefined ? undefined : _c.attr('width', Math.abs(this.draggingFrom[0] - pointerCoords[0]) * this.zoomTransform.k)) === null || _d === undefined ? undefined : _d.attr('height', Math.abs(this.draggingFrom[1] - pointerCoords[1]) * this.zoomTransform.k);
8601
+ (_d = (_c = (_b = (_a = this.multipleSelectionContainer) === null || _a === void 0 ? void 0 : _a.attr('x', Math.min(this.draggingFrom[0], pointerCoords[0]) * this.zoomTransform.k + this.zoomTransform.x)) === null || _b === void 0 ? void 0 : _b.attr('y', Math.min(this.draggingFrom[1], pointerCoords[1]) * this.zoomTransform.k + this.zoomTransform.y)) === null || _c === void 0 ? void 0 : _c.attr('width', Math.abs(this.draggingFrom[0] - pointerCoords[0]) * this.zoomTransform.k)) === null || _d === void 0 ? void 0 : _d.attr('height', Math.abs(this.draggingFrom[1] - pointerCoords[1]) * this.zoomTransform.k);
8578
8602
  this.dragging = true;
8579
8603
  }
8580
8604
  }
8581
8605
  finishMultipleSelection(event) {
8582
8606
  var _a;
8583
8607
  const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8584
- (_a = this.multipleSelectionContainer) === null || _a === undefined ? undefined : _a.remove();
8608
+ (_a = this.multipleSelectionContainer) === null || _a === void 0 ? void 0 : _a.remove();
8585
8609
  this.multipleSelectionContainer = undefined;
8586
8610
  this.userSelection.clear();
8587
8611
  for (const node of this.model.nodes) {
@@ -8675,7 +8699,7 @@ class CollabClient {
8675
8699
  const initialModel = message.initialModel;
8676
8700
  new DagaImporter().import(session.canvas.model, initialModel);
8677
8701
  this.startSyncing(session);
8678
- (_a = session.joinRoomResolve) === null || _a === undefined ? undefined : _a.call(session);
8702
+ (_a = session.joinRoomResolve) === null || _a === void 0 ? void 0 : _a.call(session);
8679
8703
  session.joinRoomResolve = undefined;
8680
8704
  break;
8681
8705
  }
@@ -8698,7 +8722,7 @@ class CollabClient {
8698
8722
  session.locator = message.locator;
8699
8723
  this.pendingSessions.delete(message.refId);
8700
8724
  this.sessions.set(session.locator, session);
8701
- (_b = session.createRoomResolve) === null || _b === undefined ? undefined : _b.call(session, session.locator);
8725
+ (_b = session.createRoomResolve) === null || _b === void 0 ? void 0 : _b.call(session, session.locator);
8702
8726
  session.createRoomResolve = undefined;
8703
8727
  // Deliver queued AddMessages now that we have a locator.
8704
8728
  for (const message of session.addQueue) {
@@ -8971,7 +8995,7 @@ class AdjacencyLayout {
8971
8995
  // place nodes according to arrangement
8972
8996
  const maximumWidth = Math.max(...model.nodes.map(n => n.width));
8973
8997
  const maximumHeight = Math.max(...model.nodes.map(n => n.height));
8974
- const gapSize = this.gapSize !== undefined ? this.gapSize : (((_a = model.canvas) === null || _a === undefined ? undefined : _a.gridSize) || 0) * 2;
8998
+ const gapSize = this.gapSize !== undefined ? this.gapSize : (((_a = model.canvas) === null || _a === void 0 ? void 0 : _a.gridSize) || 0) * 2;
8975
8999
  for (let y = nodeArrangement.minY(); y <= nodeArrangement.maxY(); ++y) {
8976
9000
  for (let x = nodeArrangement.minX(); x <= nodeArrangement.maxX(); ++x) {
8977
9001
  const node = nodeArrangement.get([x, y]);
@@ -9039,7 +9063,7 @@ class BreadthAdjacencyLayout {
9039
9063
  // place nodes according to arrangement
9040
9064
  const maximumWidth = Math.max(...model.nodes.map(n => n.width));
9041
9065
  const maximumHeight = Math.max(...model.nodes.map(n => n.height));
9042
- const gapSize = this.gapSize !== undefined ? this.gapSize : (((_a = model.canvas) === null || _a === undefined ? undefined : _a.gridSize) || 0) * 2;
9066
+ const gapSize = this.gapSize !== undefined ? this.gapSize : (((_a = model.canvas) === null || _a === void 0 ? void 0 : _a.gridSize) || 0) * 2;
9043
9067
  for (let y = nodeArrangement.minY(); y <= nodeArrangement.maxY(); ++y) {
9044
9068
  for (let x = nodeArrangement.minX(); x <= nodeArrangement.maxX(); ++x) {
9045
9069
  const node = nodeArrangement.get([x, y]);
@@ -9066,7 +9090,7 @@ class BreadthLayout {
9066
9090
  // nothing to arrange...
9067
9091
  return model;
9068
9092
  }
9069
- const gapSize = this.gapSize !== undefined ? this.gapSize : (((_a = model.canvas) === null || _a === undefined ? undefined : _a.gridSize) || 0) * 2;
9093
+ const gapSize = this.gapSize !== undefined ? this.gapSize : (((_a = model.canvas) === null || _a === void 0 ? void 0 : _a.gridSize) || 0) * 2;
9070
9094
  let nodesToBeArranged = model.nodes.filter(n => !n.parent);
9071
9095
  // Arrange nodes by a breadth first search
9072
9096
  const firstNode = nodesToBeArranged[0];
@@ -9133,7 +9157,7 @@ class ForceLayout {
9133
9157
  }
9134
9158
  // as a starting point, we apply a simple layout
9135
9159
  new BreadthLayout().apply(model);
9136
- const gapSize = this.gapSize !== undefined ? this.gapSize : (((_a = model.canvas) === null || _a === undefined ? undefined : _a.gridSize) || 0) * 2;
9160
+ const gapSize = this.gapSize !== undefined ? this.gapSize : (((_a = model.canvas) === null || _a === void 0 ? void 0 : _a.gridSize) || 0) * 2;
9137
9161
  const coolingFactor = 0.99;
9138
9162
  const minimumTemperature = 1;
9139
9163
  const attractionFactor = 0.1;
@@ -9229,7 +9253,7 @@ class HorizontalLayout {
9229
9253
  // nothing to arrange...
9230
9254
  return model;
9231
9255
  }
9232
- const gapSize = this.gapSize !== undefined ? this.gapSize : (((_a = model.canvas) === null || _a === undefined ? undefined : _a.gridSize) || 0) * 2;
9256
+ const gapSize = this.gapSize !== undefined ? this.gapSize : (((_a = model.canvas) === null || _a === void 0 ? void 0 : _a.gridSize) || 0) * 2;
9233
9257
  const nodesToBeArranged = model.nodes.filter(n => !n.parent);
9234
9258
  nodesToBeArranged.sort((a, b) => b.type.priority - a.type.priority);
9235
9259
  let widthAccumulator = 0;
@@ -9262,7 +9286,7 @@ class PriorityLayout {
9262
9286
  new BreadthLayout().apply(model);
9263
9287
  return model;
9264
9288
  }
9265
- const gapSize = this.gapSize !== undefined ? this.gapSize : (((_a = model.canvas) === null || _a === undefined ? undefined : _a.gridSize) || 0) * 2;
9289
+ const gapSize = this.gapSize !== undefined ? this.gapSize : (((_a = model.canvas) === null || _a === void 0 ? void 0 : _a.gridSize) || 0) * 2;
9266
9290
  const nodesToBeArranged = model.nodes.filter(n => !n.parent);
9267
9291
  const nodeArrangement = [];
9268
9292
  const nodesWithMaximumPriorityToBeArranged = model.nodes.filter(n => !n.parent).filter(n => n.getPriority() >= maximumPriority);
@@ -9372,7 +9396,7 @@ class TreeLayout {
9372
9396
  new BreadthLayout().apply(model);
9373
9397
  return model;
9374
9398
  }
9375
- const gapSize = this.gapSize !== undefined ? this.gapSize : (((_a = model.canvas) === null || _a === undefined ? undefined : _a.gridSize) || 0) * 2;
9399
+ const gapSize = this.gapSize !== undefined ? this.gapSize : (((_a = model.canvas) === null || _a === void 0 ? void 0 : _a.gridSize) || 0) * 2;
9376
9400
  const nodesToBeArranged = model.nodes.filter(n => !n.parent).sort((n1, n2) => n2.getPriority() - n1.getPriority());
9377
9401
  const branches = [];
9378
9402
  while (nodesToBeArranged.length > 0) {
@@ -9466,7 +9490,7 @@ class VerticalLayout {
9466
9490
  // nothing to arrange...
9467
9491
  return model;
9468
9492
  }
9469
- const gapSize = this.gapSize !== undefined ? this.gapSize : (((_a = model.canvas) === null || _a === undefined ? undefined : _a.gridSize) || 0) * 2;
9493
+ const gapSize = this.gapSize !== undefined ? this.gapSize : (((_a = model.canvas) === null || _a === void 0 ? void 0 : _a.gridSize) || 0) * 2;
9470
9494
  const nodesToBeArranged = model.nodes.filter(n => !n.parent);
9471
9495
  nodesToBeArranged.sort((a, b) => b.type.priority - a.type.priority);
9472
9496
  let heightAccumulator = 0;