@metadev/daga 3.1.4 → 3.1.5

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
@@ -1767,11 +1767,11 @@ class DiagramConnection extends DiagramElement {
1767
1767
  if (start !== undefined) {
1768
1768
  start.outgoingConnections.push(this);
1769
1769
  this.startDirection = start === null || start === undefined ? undefined : start.direction;
1770
- this.startCoords = (start === null || start === undefined ? undefined : start.coords) || [0, 0];
1770
+ this.startCoords = (start === null || start === undefined ? undefined : start.connectionPoint) || [0, 0];
1771
1771
  }
1772
1772
  } else {
1773
1773
  this.startDirection = start === null || start === undefined ? undefined : start.direction;
1774
- this.startCoords = (start === null || start === undefined ? undefined : start.coords) || [0, 0];
1774
+ this.startCoords = (start === null || start === undefined ? undefined : start.connectionPoint) || [0, 0];
1775
1775
  }
1776
1776
  this.updateInView();
1777
1777
  }
@@ -1790,11 +1790,11 @@ class DiagramConnection extends DiagramElement {
1790
1790
  if (end !== undefined) {
1791
1791
  end.incomingConnections.push(this);
1792
1792
  this.endDirection = end === null || end === undefined ? undefined : end.direction;
1793
- this.endCoords = (end === null || end === undefined ? undefined : end.coords) || [0, 0];
1793
+ this.endCoords = (end === null || end === undefined ? undefined : end.connectionPoint) || [0, 0];
1794
1794
  }
1795
1795
  } else {
1796
1796
  this.endDirection = end === null || end === undefined ? undefined : end.direction;
1797
- this.endCoords = (end === null || end === undefined ? undefined : end.coords) || [0, 0];
1797
+ this.endCoords = (end === null || end === undefined ? undefined : end.connectionPoint) || [0, 0];
1798
1798
  }
1799
1799
  this.updateInView();
1800
1800
  }
@@ -1812,6 +1812,10 @@ class DiagramConnection extends DiagramElement {
1812
1812
  // alternative start port not valid, it is the same as the end port
1813
1813
  continue checkAlternativeStartPorts;
1814
1814
  }
1815
+ if (!alternativeStartPort.allowsOutgoing) {
1816
+ // alternative start port not valid, it doesn't allow outgoing connections
1817
+ continue checkAlternativeStartPorts;
1818
+ }
1815
1819
  {
1816
1820
  for (const connection of alternativeStartPort.outgoingConnections) {
1817
1821
  if (connection !== this && connection.end === this.end) {
@@ -1839,24 +1843,28 @@ class DiagramConnection extends DiagramElement {
1839
1843
  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]);
1840
1844
  checkAlternativeEndPorts: for (const alternativeEndPort of alternativeEndPortsSortedByDistanceAscending) {
1841
1845
  if (alternativeEndPort === this.start) {
1842
- // alternative start port not valid, it is the same as the end port
1846
+ // alternative end port not valid, it is the same as the end port
1847
+ continue checkAlternativeEndPorts;
1848
+ }
1849
+ if (!alternativeEndPort.allowsIncoming) {
1850
+ // alternative end port not valid, it doesn't allow incoming connections
1843
1851
  continue checkAlternativeEndPorts;
1844
1852
  }
1845
1853
  {
1846
1854
  for (const connection of alternativeEndPort.incomingConnections) {
1847
1855
  if (connection !== this && connection.start === this.start) {
1848
- // alternative start port not valid, there is a connection whose start and end matches the alternative end port and this connection's start
1856
+ // alternative end port not valid, there is a connection whose start and end matches the alternative end port and this connection's start
1849
1857
  continue checkAlternativeEndPorts;
1850
1858
  }
1851
1859
  }
1852
1860
  for (const connection of alternativeEndPort.outgoingConnections) {
1853
1861
  if (connection !== this && connection.end === this.start) {
1854
- // alternative start port not valid, there is a connection whose start and end matches the alternative end port and this connection's start
1862
+ // alternative end port not valid, there is a connection whose start and end matches the alternative end port and this connection's start
1855
1863
  continue checkAlternativeEndPorts;
1856
1864
  }
1857
1865
  }
1858
1866
  }
1859
- // found a valid start port
1867
+ // found a valid end port
1860
1868
  if (alternativeEndPort === this.end) {
1861
1869
  break checkAlternativeEndPorts;
1862
1870
  } else {
@@ -2558,25 +2566,25 @@ class DiagramSectionSet extends DiagramElementSet {
2558
2566
  if (sectionPorts && sectionPorts.length > 0) {
2559
2567
  for (let i = 0; i < sectionPorts.length; ++i) {
2560
2568
  const portConfig = sectionPorts[i];
2561
- const port = this.model.ports.new(section, [section.coords[0] + (((_e = portConfig === null || portConfig === undefined ? undefined : portConfig.coords) === null || _e === undefined ? undefined : _e[0]) || 0), section.coords[1] + (((_f = portConfig === null || portConfig === undefined ? undefined : portConfig.coords) === null || _f === undefined ? undefined : _f[1]) || 0)], portConfig === null || portConfig === undefined ? undefined : portConfig.direction, `${section.id}_${i}`);
2562
- if (portConfig.label) {
2563
- const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), portConfig.label);
2569
+ 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}`);
2570
+ if ((_e = port.type) === null || _e === undefined ? undefined : _e.label) {
2571
+ const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), (_f = port.type) === null || _f === undefined ? undefined : _f.label);
2572
+ const labelWidth = 6 * labelConfiguration.fontSize + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
2573
+ const labelHeight = labelConfiguration.fontSize + getTopPadding$1(labelConfiguration) + getBottomPadding$1(labelConfiguration);
2564
2574
  let labelCoords;
2565
2575
  switch (port.direction) {
2566
- case Side.Top:
2567
- case Side.Left:
2568
- labelCoords = [port.coords[0] - labelConfiguration.fontSize, port.coords[1] - labelConfiguration.fontSize];
2569
- break;
2570
2576
  case Side.Bottom:
2571
- labelCoords = [port.coords[0] - labelConfiguration.fontSize, port.coords[1] + labelConfiguration.fontSize];
2572
- break;
2577
+ case Side.Left:
2573
2578
  case Side.Right:
2574
- labelCoords = [port.coords[0] + labelConfiguration.fontSize, port.coords[1] - labelConfiguration.fontSize];
2579
+ labelCoords = [port.coords[0] - labelWidth / 2, port.coords[1] - labelHeight - getBottomMargin(labelConfiguration)];
2580
+ break;
2581
+ case Side.Top:
2582
+ labelCoords = [port.coords[0] - labelWidth / 2, port.coords[1] + getTopMargin(labelConfiguration)];
2575
2583
  break;
2576
2584
  default:
2577
2585
  labelCoords = port.coords;
2578
2586
  }
2579
- this.model.fields.new(port, labelCoords, labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelConfiguration.fontSize, labelConfiguration.fontSize, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, '', labelConfiguration.editable, labelConfiguration.fit);
2587
+ this.model.fields.new(port, labelCoords, labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelWidth, labelHeight, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, '', labelConfiguration.editable, labelConfiguration.fit);
2580
2588
  }
2581
2589
  }
2582
2590
  }
@@ -3213,7 +3221,7 @@ class DiagramNodeSet extends DiagramElementSet {
3213
3221
  * @returns The instanced node.
3214
3222
  */
3215
3223
  new(type, coords, id) {
3216
- var _a, _b, _c, _d, _e;
3224
+ var _a, _b, _c, _d, _e, _f, _g;
3217
3225
  let nodeType;
3218
3226
  if (type instanceof DiagramNodeType) {
3219
3227
  nodeType = type;
@@ -3244,25 +3252,25 @@ class DiagramNodeSet extends DiagramElementSet {
3244
3252
  if (nodeType.ports.length > 0) {
3245
3253
  for (let i = 0; i < nodeType.ports.length; ++i) {
3246
3254
  const portConfig = nodeType.ports[i];
3247
- const port = this.model.ports.new(node, [node.coords[0] + portConfig.coords[0], node.coords[1] + portConfig.coords[1]], portConfig.direction, `${node.id}_${i}`);
3248
- if (portConfig.label) {
3249
- const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), portConfig.label);
3255
+ const port = this.model.ports.new(portConfig.type !== undefined ? this.model.ports.types.get(portConfig.type) : undefined, 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}_${i}`);
3256
+ if ((_e = port.type) === null || _e === undefined ? undefined : _e.label) {
3257
+ const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), (_f = port.type) === null || _f === undefined ? undefined : _f.label);
3258
+ const labelWidth = 6 * labelConfiguration.fontSize + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
3259
+ const labelHeight = labelConfiguration.fontSize + getTopPadding$1(labelConfiguration) + getBottomPadding$1(labelConfiguration);
3250
3260
  let labelCoords;
3251
3261
  switch (port.direction) {
3252
- case Side.Top:
3253
- case Side.Left:
3254
- labelCoords = [port.coords[0] - labelConfiguration.fontSize, port.coords[1] - labelConfiguration.fontSize];
3255
- break;
3256
3262
  case Side.Bottom:
3257
- labelCoords = [port.coords[0] - labelConfiguration.fontSize, port.coords[1] + labelConfiguration.fontSize];
3258
- break;
3263
+ case Side.Left:
3259
3264
  case Side.Right:
3260
- labelCoords = [port.coords[0] + labelConfiguration.fontSize, port.coords[1] - labelConfiguration.fontSize];
3265
+ labelCoords = [port.coords[0] - labelWidth / 2, port.coords[1] - labelHeight - getBottomMargin(labelConfiguration)];
3266
+ break;
3267
+ case Side.Top:
3268
+ labelCoords = [port.coords[0] - labelWidth / 2, port.coords[1] + getTopMargin(labelConfiguration)];
3261
3269
  break;
3262
3270
  default:
3263
3271
  labelCoords = port.coords;
3264
3272
  }
3265
- this.model.fields.new(port, labelCoords, labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelConfiguration.fontSize, labelConfiguration.fontSize, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, '', labelConfiguration.editable, labelConfiguration.fit);
3273
+ this.model.fields.new(port, labelCoords, labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelWidth, labelHeight, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, '', labelConfiguration.editable, labelConfiguration.fit);
3266
3274
  }
3267
3275
  }
3268
3276
  }
@@ -3272,7 +3280,7 @@ class DiagramNodeSet extends DiagramElementSet {
3272
3280
  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);
3273
3281
  }
3274
3282
  node.valueSet.resetValues();
3275
- (_e = node.model.canvas) === null || _e === undefined ? undefined : _e.fitNodeInView(node.id);
3283
+ (_g = node.model.canvas) === null || _g === undefined ? undefined : _g.fitNodeInView(node.id);
3276
3284
  return node;
3277
3285
  }
3278
3286
  remove(id) {
@@ -3446,10 +3454,38 @@ const getTopPadding = config => {
3446
3454
  * @see DiagramPort
3447
3455
  */
3448
3456
  const DIAGRAM_PORT_DEFAULTS = {
3449
- radius: 12,
3450
3457
  highlightedColor: 'cyan',
3451
3458
  selectedColor: 'violet'
3452
3459
  };
3460
+ /**
3461
+ * Default values of the parameters of a diagram port.
3462
+ * @private
3463
+ * @see DiagramPort
3464
+ */
3465
+ const DIAGRAM_PORT_TYPE_DEFAULTS = {
3466
+ name: '',
3467
+ label: null,
3468
+ allowsOutgoing: true,
3469
+ allowsIncoming: true,
3470
+ width: 24
3471
+ };
3472
+ /**
3473
+ * A port type, which holds properties that ports of this type share in common.
3474
+ * @public
3475
+ * @see PortTypeConfig
3476
+ */
3477
+ class DiagramPortType {
3478
+ constructor(options) {
3479
+ const values = Object.assign(Object.assign({}, DIAGRAM_PORT_TYPE_DEFAULTS), options);
3480
+ this.id = values.id;
3481
+ this.name = values.name;
3482
+ this.label = values.label;
3483
+ this.allowsOutgoing = values.allowsOutgoing;
3484
+ this.allowsIncoming = values.allowsIncoming;
3485
+ this.width = values.width;
3486
+ this.look = values.look;
3487
+ }
3488
+ }
3453
3489
  /**
3454
3490
  * A port which is part of a node or section and at which connections can start or end.
3455
3491
  * @public
@@ -3458,7 +3494,34 @@ const DIAGRAM_PORT_DEFAULTS = {
3458
3494
  * @see DiagramSection
3459
3495
  */
3460
3496
  class DiagramPort extends DiagramElement {
3461
- constructor(model, rootElement, coords, direction, id) {
3497
+ /**
3498
+ * Whether this port can be used as a connection start point.
3499
+ */
3500
+ get allowsOutgoing() {
3501
+ var _a, _b;
3502
+ return ((_a = this.type) === null || _a === undefined ? undefined : _a.allowsOutgoing) !== undefined ? (_b = this.type) === null || _b === undefined ? undefined : _b.allowsOutgoing : true;
3503
+ }
3504
+ /**
3505
+ * Whether this port can be used as a connection end point.
3506
+ */
3507
+ get allowsIncoming() {
3508
+ var _a, _b;
3509
+ return ((_a = this.type) === null || _a === undefined ? undefined : _a.allowsIncoming) !== undefined ? (_b = this.type) === null || _b === undefined ? undefined : _b.allowsIncoming : true;
3510
+ }
3511
+ /**
3512
+ * Name of this port. Alias for this port's label's text.
3513
+ * @public
3514
+ */
3515
+ get name() {
3516
+ var _a;
3517
+ return ((_a = this.label) === null || _a === undefined ? undefined : _a.text) || '';
3518
+ }
3519
+ set name(name) {
3520
+ if (this.label) {
3521
+ this.label.text = name;
3522
+ }
3523
+ }
3524
+ constructor(model, type, rootElement, coords, connectionPoint, direction, id) {
3462
3525
  if (model.ports.get(id) !== undefined) {
3463
3526
  throw new Error(`DiagramPort with id "${id}" already exists`);
3464
3527
  }
@@ -3473,8 +3536,10 @@ class DiagramPort extends DiagramElement {
3473
3536
  * @public
3474
3537
  */
3475
3538
  this.incomingConnections = [];
3539
+ this.type = type;
3476
3540
  this.rootElement = rootElement;
3477
3541
  this.coords = coords;
3542
+ this.connectionPoint = connectionPoint || coords;
3478
3543
  this.direction = direction;
3479
3544
  }
3480
3545
  get removed() {
@@ -3487,6 +3552,9 @@ class DiagramPort extends DiagramElement {
3487
3552
  raise() {
3488
3553
  var _a;
3489
3554
  (_a = this.select()) === null || _a === undefined ? undefined : _a.raise();
3555
+ if (this.label) {
3556
+ this.label.raise();
3557
+ }
3490
3558
  for (const connection of this.incomingConnections) {
3491
3559
  connection.raise();
3492
3560
  }
@@ -3535,6 +3603,8 @@ class DiagramPort extends DiagramElement {
3535
3603
  move(coords) {
3536
3604
  const coordDifferences = [coords[0] - this.coords[0], coords[1] - this.coords[1]];
3537
3605
  this.coords = coords;
3606
+ this.connectionPoint[0] = this.connectionPoint[0] + coordDifferences[0];
3607
+ this.connectionPoint[1] = this.connectionPoint[1] + coordDifferences[1];
3538
3608
  for (const connection of this.outgoingConnections) {
3539
3609
  connection.setStart(this);
3540
3610
  }
@@ -3557,14 +3627,19 @@ class DiagramPortSet extends DiagramElementSet {
3557
3627
  */
3558
3628
  constructor(model) {
3559
3629
  super();
3630
+ /**
3631
+ * Set of the possible types of port that the ports of this set can have.
3632
+ * @public
3633
+ */
3634
+ this.types = new DiagramEntitySet();
3560
3635
  this.model = model;
3561
3636
  }
3562
3637
  /**
3563
3638
  * Instance a new port and add it to this set. This method is normally called when instancing an element with a port and it is rarely called by itself.
3564
3639
  * @private
3565
3640
  */
3566
- new(rootElement, coords, direction, id) {
3567
- const port = new DiagramPort(this.model, rootElement, coords, direction, id);
3641
+ new(type, rootElement, coords, connectionPoint, direction, id) {
3642
+ const port = new DiagramPort(this.model, type, rootElement, coords, connectionPoint, direction, id);
3568
3643
  super.add(port);
3569
3644
  port.updateInView();
3570
3645
  // add this port to its root element
@@ -3673,13 +3748,14 @@ class DagaImporter {
3673
3748
  }
3674
3749
  let portCounter = 0;
3675
3750
  for (const port of section.ports || []) {
3676
- const newPort = new DiagramPort(model, newSection, port.coords, port.direction, port.id);
3751
+ const newPortType = port.type !== undefined ? model.ports.types.get(port.type) : undefined;
3752
+ const newPort = new DiagramPort(model, newPortType, newSection, port.coords, port.connectionPoint, port.direction, port.id);
3677
3753
  newSection.ports.push(newPort);
3678
3754
  model.ports.add(newPort);
3679
3755
  if (port.label) {
3680
3756
  // add port label
3681
- if (newNodeType.ports.length > portCounter && newNodeType.ports[portCounter].label) {
3682
- const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), newNodeType.ports[portCounter].label);
3757
+ if (newNodeType.ports.length > portCounter && (newPortType === null || newPortType === undefined ? undefined : newPortType.label)) {
3758
+ const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), newPortType === null || newPortType === undefined ? undefined : newPortType.label);
3683
3759
  let labelCoords;
3684
3760
  switch (newPort.direction) {
3685
3761
  case Side.Top:
@@ -3719,13 +3795,14 @@ class DagaImporter {
3719
3795
  }
3720
3796
  let portCounter = 0;
3721
3797
  for (const port of node.ports || []) {
3722
- const newPort = new DiagramPort(model, newNode, port.coords, port.direction, port.id);
3798
+ const newPortType = port.type !== undefined ? model.ports.types.get(port.type) : undefined;
3799
+ const newPort = new DiagramPort(model, newPortType, newNode, port.coords, port.connectionPoint, port.direction, port.id);
3723
3800
  newNode.ports.push(newPort);
3724
3801
  model.ports.add(newPort);
3725
3802
  if (port.label) {
3726
3803
  // add port label
3727
- if (newNodeType.ports.length > portCounter && newNodeType.ports[portCounter].label) {
3728
- const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), newNodeType.ports[portCounter].label);
3804
+ if (newNodeType.ports.length > portCounter && (newPortType === null || newPortType === undefined ? undefined : newPortType.label)) {
3805
+ const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), newPortType === null || newPortType === undefined ? undefined : newPortType.label);
3729
3806
  let labelCoords;
3730
3807
  switch (newPort.direction) {
3731
3808
  case Side.Top:
@@ -3767,6 +3844,8 @@ class DagaImporter {
3767
3844
  newNode.valueSet.setTimestamps(node.collabMeta.dataTimestamps);
3768
3845
  }
3769
3846
  newNode.updateInView();
3847
+ // raise node to sort the render order of the node and its components
3848
+ newNode.raise();
3770
3849
  return newNode;
3771
3850
  }
3772
3851
  return undefined;
@@ -3789,6 +3868,8 @@ class DagaImporter {
3789
3868
  newConnection.valueSet.setTimestamps(connection.collabMeta.dataTimestamps);
3790
3869
  }
3791
3870
  newConnection.updateInView();
3871
+ // raise connection just in case it is necessary to sort the render order
3872
+ newConnection.raise();
3792
3873
  return newConnection;
3793
3874
  }
3794
3875
  return undefined;
@@ -5531,7 +5612,7 @@ class DagaExporter {
5531
5612
  return result;
5532
5613
  }
5533
5614
  exportNode(node, includeCollabMeta = false) {
5534
- var _a, _b, _c, _d;
5615
+ var _a, _b, _c, _d, _e, _f;
5535
5616
  const children = [];
5536
5617
  for (const child of node.children) {
5537
5618
  children.push(this.exportNode(child, includeCollabMeta));
@@ -5542,9 +5623,11 @@ class DagaExporter {
5542
5623
  for (const port of section.ports) {
5543
5624
  ports.push(Object.assign({
5544
5625
  id: port.id,
5626
+ type: (_a = port.type) === null || _a === undefined ? undefined : _a.id,
5545
5627
  coords: roundPoint(port.coords),
5628
+ connectionPoint: roundPoint(port.connectionPoint),
5546
5629
  direction: port.direction,
5547
- label: ((_a = port.label) === null || _a === undefined ? undefined : _a.text) || ''
5630
+ label: ((_b = port.label) === null || _b === undefined ? undefined : _b.text) || ''
5548
5631
  }, includeCollabMeta ? {
5549
5632
  collabMeta: Object.assign({
5550
5633
  removed: port.removed,
@@ -5556,7 +5639,7 @@ class DagaExporter {
5556
5639
  sections.push(Object.assign({
5557
5640
  id: section.id,
5558
5641
  ports,
5559
- label: ((_b = section.label) === null || _b === undefined ? undefined : _b.text) || '',
5642
+ label: ((_c = section.label) === null || _c === undefined ? undefined : _c.text) || '',
5560
5643
  indexXInNode: section.indexXInNode,
5561
5644
  indexYInNode: section.indexYInNode,
5562
5645
  coords: roundPoint(section.coords),
@@ -5574,9 +5657,11 @@ class DagaExporter {
5574
5657
  for (const port of node.ports) {
5575
5658
  ports.push(Object.assign({
5576
5659
  id: port.id,
5660
+ type: (_d = port.type) === null || _d === undefined ? undefined : _d.id,
5577
5661
  coords: roundPoint(port.coords),
5662
+ connectionPoint: roundPoint(port.connectionPoint),
5578
5663
  direction: port.direction,
5579
- label: ((_c = port.label) === null || _c === undefined ? undefined : _c.text) || ''
5664
+ label: ((_e = port.label) === null || _e === undefined ? undefined : _e.text) || ''
5580
5665
  }, includeCollabMeta ? {
5581
5666
  collabMeta: Object.assign({
5582
5667
  removed: port.removed,
@@ -5591,7 +5676,7 @@ class DagaExporter {
5591
5676
  children,
5592
5677
  sections,
5593
5678
  ports,
5594
- label: ((_d = node.label) === null || _d === undefined ? undefined : _d.text) || '',
5679
+ label: ((_f = node.label) === null || _f === undefined ? undefined : _f.text) || '',
5595
5680
  coords: roundPoint(node.coords),
5596
5681
  width: node.width,
5597
5682
  height: node.height,
@@ -5967,6 +6052,13 @@ class DiagramCanvas {
5967
6052
  this.model.nodes.types.add(nodeType);
5968
6053
  }
5969
6054
  }
6055
+ // load port types
6056
+ if (config.portTypes) {
6057
+ for (const portTypeConfig of config.portTypes) {
6058
+ const portType = new DiagramPortType(Object.assign(Object.assign({}, config.portTypeDefaults), portTypeConfig));
6059
+ this.model.ports.types.add(portType);
6060
+ }
6061
+ }
5970
6062
  // load connection types
5971
6063
  if (config.connectionTypes) {
5972
6064
  for (const connectionTypeConfig of config.connectionTypes) {
@@ -6219,9 +6311,10 @@ class DiagramCanvas {
6219
6311
  }
6220
6312
  }
6221
6313
  center() {
6314
+ var _a;
6222
6315
  // if there are no nodes, we have nothing to do here
6223
6316
  if (this.model.nodes.length > 0) {
6224
- const canvasViewBoundingBox = this.selectCanvasView().select('rect').node().getBBox();
6317
+ const canvasViewBoundingBox = (_a = this.selectCanvasView().select('rect').node()) === null || _a === undefined ? undefined : _a.getBBox();
6225
6318
  const nonRemovedNodes = this.model.nodes.all();
6226
6319
  const minimumX = Math.min(...nonRemovedNodes.map(n => n.coords[0]));
6227
6320
  const maximumX = Math.max(...nonRemovedNodes.map(n => n.coords[0] + n.width));
@@ -6925,21 +7018,32 @@ class DiagramCanvas {
6925
7018
  updatePortsInView(...ids) {
6926
7019
  let updateSelection = this.selectCanvasElements().selectAll('g.diagram-port').data(this.model.ports.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true), d => d.id);
6927
7020
  const exitSelection = updateSelection.exit();
6928
- const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', 'diagram-port');
7021
+ const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', d => {
7022
+ var _a, _b;
7023
+ return `diagram-port ${((_b = (_a = d.type) === null || _a === undefined ? undefined : _a.look) === null || _b === undefined ? undefined : _b.lookType) || 'default'}`;
7024
+ });
6929
7025
  if (ids && ids.length > 0) {
6930
7026
  updateSelection = updateSelection.filter(d => ids.includes(d.id));
6931
7027
  }
6932
7028
  const mergeSelection = enterSelection.merge(updateSelection);
6933
7029
  exitSelection.remove();
6934
7030
  enterSelection.on(Events.MouseOver, (_event, d) => {
6935
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
7031
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
6936
7032
  if (!this.unfinishedConnection && !this.dragging) {
6937
7033
  // if there is an unfinished connection, the port will be highlighted automatically if the pointer is close
6938
7034
  this.userHighlight.focusOn(d);
6939
7035
  this.diagramEvent$.next(new DiagramHighlightedEvent(d));
6940
7036
  }
6941
7037
  if (this.unfinishedConnection) {
6942
- const canConnectionFinishAtThisPort = 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) || '') && this.unfinishedConnection.type.canFinishOnType(((_e = (_d = d.getNode()) === null || _d === undefined ? undefined : _d.type) === null || _e === undefined ? undefined : _e.id) || '') || this.unfinishedConnection.type.canStartFromType(((_g = (_f = d.getNode()) === null || _f === undefined ? undefined : _f.type) === null || _g === undefined ? undefined : _g.id) || '') && this.unfinishedConnection.type.canFinishOnType(((_k = (_j = (_h = this.unfinishedConnection.start) === null || _h === undefined ? undefined : _h.getNode()) === null || _j === undefined ? undefined : _j.type) === null || _k === undefined ? undefined : _k.id) || '');
7038
+ const canConnectionFinishAtThisPort =
7039
+ // can start at the starting port
7040
+ 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) &&
7041
+ // can end at the ending port
7042
+ this.unfinishedConnection.type.canFinishOnType(((_f = (_e = d.getNode()) === null || _e === undefined ? undefined : _e.type) === null || _f === undefined ? undefined : _f.id) || '') && d.allowsIncoming ||
7043
+ // can start at the ending port
7044
+ this.unfinishedConnection.type.canStartFromType(((_h = (_g = d.getNode()) === null || _g === undefined ? undefined : _g.type) === null || _h === undefined ? undefined : _h.id) || '') && d.allowsOutgoing &&
7045
+ // can end at the starting port
7046
+ 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);
6943
7047
  if (!canConnectionFinishAtThisPort) {
6944
7048
  setCursorStyle(CursorStyle.NoDrop);
6945
7049
  }
@@ -7076,8 +7180,14 @@ class DiagramCanvas {
7076
7180
  }
7077
7181
  this.secondaryButton = false;
7078
7182
  }));
7079
- enterSelection.append('circle');
7080
- mergeSelection.attr('transform', d => `translate(${d.coords[0]},${d.coords[1]})`).attr('opacity', d => d.removed ? 0.5 : 1).select('circle').attr('cx', 0).attr('cy', 0).attr('r', DIAGRAM_PORT_DEFAULTS.radius).attr('fill', d => d.selected ? DIAGRAM_PORT_DEFAULTS.selectedColor : DIAGRAM_PORT_DEFAULTS.highlightedColor).attr('opacity', d => d.highlighted || d.selected ? 0.5 : 0);
7183
+ enterSelection.filter('.default').append('circle');
7184
+ enterSelection.filter('.image-look').append('image');
7185
+ mergeSelection.attr('transform', d => `translate(${d.coords[0]},${d.coords[1]})`).attr('opacity', d => d.removed ? 0.5 : 1);
7186
+ mergeSelection.filter('.default').select('circle').attr('cx', 0).attr('cy', 0).attr('r', DIAGRAM_PORT_TYPE_DEFAULTS.width / 2).attr('fill', d => d.selected ? DIAGRAM_PORT_DEFAULTS.selectedColor : DIAGRAM_PORT_DEFAULTS.highlightedColor).attr('opacity', d => d.highlighted || d.selected ? 0.5 : 0);
7187
+ mergeSelection.filter('.image-look').select('image').attr('x', d => -d.type.width / 2).attr('y', d => -d.type.width / 2).attr('width', d => d.type.width).attr('height', d => d.type.width).attr('href', d => {
7188
+ var _a, _b;
7189
+ return d.selected ? ((_a = d.type) === null || _a === undefined ? undefined : _a.look).selectedBackgroundImage : ((_b = d.type) === null || _b === undefined ? undefined : _b.look).backgroundImage;
7190
+ });
7081
7191
  }
7082
7192
  updateConnectionsInView(...ids) {
7083
7193
  const connectionList = this.model.connections.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true);
@@ -7508,39 +7618,41 @@ class DiagramCanvas {
7508
7618
  // User actions
7509
7619
  startConnection(port) {
7510
7620
  var _a, _b, _c, _d;
7511
- if (this.connectionType && (this.connectionType.canStartFromType(((_b = (_a = port.getNode()) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.id) || '') || this.connectionType.canFinishOnType(((_d = (_c = port.getNode()) === null || _c === undefined ? undefined : _c.type) === null || _d === undefined ? undefined : _d.id) || ''))) {
7512
- this.unfinishedConnection = new DiagramConnection(this.model, this.connectionType, port, undefined, UNFINISHED_CONNECTION_ID);
7513
- } else {
7514
- if (this.inferConnectionType) {
7515
- let differentConnectionType = this.model.connections.types.all().find(t => {
7516
- var _a, _b;
7517
- return t.canStartFromType(((_b = (_a = port.getNode()) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.id) || '');
7518
- });
7519
- if (differentConnectionType === undefined) {
7520
- differentConnectionType = this.model.connections.types.all().find(t => {
7621
+ if (port.allowsOutgoing || port.allowsIncoming) {
7622
+ 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)) {
7623
+ this.unfinishedConnection = new DiagramConnection(this.model, this.connectionType, port, undefined, UNFINISHED_CONNECTION_ID);
7624
+ } else {
7625
+ if (this.inferConnectionType) {
7626
+ let differentConnectionType = this.model.connections.types.all().find(t => {
7521
7627
  var _a, _b;
7522
- return t.canFinishOnType(((_b = (_a = port.getNode()) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.id) || '');
7628
+ return port.allowsOutgoing && t.canStartFromType(((_b = (_a = port.getNode()) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.id) || '');
7523
7629
  });
7524
- }
7525
- if (differentConnectionType !== undefined) {
7526
- this.unfinishedConnection = new DiagramConnection(this.model, differentConnectionType, port, undefined, UNFINISHED_CONNECTION_ID);
7630
+ if (differentConnectionType === undefined) {
7631
+ differentConnectionType = this.model.connections.types.all().find(t => {
7632
+ var _a, _b;
7633
+ return port.allowsIncoming && t.canFinishOnType(((_b = (_a = port.getNode()) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.id) || '');
7634
+ });
7635
+ }
7636
+ if (differentConnectionType !== undefined) {
7637
+ this.unfinishedConnection = new DiagramConnection(this.model, differentConnectionType, port, undefined, UNFINISHED_CONNECTION_ID);
7638
+ }
7527
7639
  }
7528
7640
  }
7529
7641
  }
7530
7642
  }
7531
7643
  finishConnection(port) {
7532
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
7644
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
7533
7645
  this.userHighlight.clear();
7534
7646
  if (this.unfinishedConnection !== undefined) {
7535
7647
  if (this.unfinishedConnection.start !== port) {
7536
- 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) || '') && this.unfinishedConnection.type.canFinishOnType(((_f = (_e = port.getNode()) === null || _e === undefined ? undefined : _e.type) === null || _f === undefined ? undefined : _f.id) || '')) {
7537
- const addConnectionAction = new AddConnectionAction(this, this.unfinishedConnection.type, (_g = this.unfinishedConnection.start) === null || _g === undefined ? undefined : _g.id, port.id);
7648
+ 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) {
7649
+ const addConnectionAction = new AddConnectionAction(this, this.unfinishedConnection.type, (_j = this.unfinishedConnection.start) === null || _j === undefined ? undefined : _j.id, port.id);
7538
7650
  // clean up the previous unfinished connection
7539
7651
  this.dropConnection();
7540
7652
  addConnectionAction.do();
7541
7653
  this.actionStack.add(addConnectionAction);
7542
- } else if (this.unfinishedConnection.type.canFinishOnType(((_l = (_k = (_j = (_h = this.unfinishedConnection) === null || _h === undefined ? undefined : _h.start) === null || _j === undefined ? undefined : _j.getNode()) === null || _k === undefined ? undefined : _k.type) === null || _l === undefined ? undefined : _l.id) || '') && this.unfinishedConnection.type.canStartFromType(((_o = (_m = port.getNode()) === null || _m === undefined ? undefined : _m.type) === null || _o === undefined ? undefined : _o.id) || '')) {
7543
- const addConnectionAction = new AddConnectionAction(this, this.unfinishedConnection.type, port.id, (_p = this.unfinishedConnection.start) === null || _p === undefined ? undefined : _p.id);
7654
+ } 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) {
7655
+ const addConnectionAction = new AddConnectionAction(this, this.unfinishedConnection.type, port.id, (_t = this.unfinishedConnection.start) === null || _t === undefined ? undefined : _t.id);
7544
7656
  // clean up the previous unfinished connection
7545
7657
  this.dropConnection();
7546
7658
  addConnectionAction.do();
@@ -7548,19 +7660,19 @@ class DiagramCanvas {
7548
7660
  } else {
7549
7661
  if (this.inferConnectionType) {
7550
7662
  let differentConnectionType = this.model.connections.types.all().find(t => {
7551
- var _a, _b, _c, _d, _e, _f;
7552
- 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) || '') && t.canFinishOnType(((_f = (_e = port.getNode()) === null || _e === undefined ? undefined : _e.type) === null || _f === undefined ? undefined : _f.id) || '');
7663
+ var _a, _b, _c, _d, _e, _f, _g, _h;
7664
+ 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;
7553
7665
  });
7554
7666
  let invertConnection = false;
7555
7667
  if (differentConnectionType === undefined) {
7556
7668
  differentConnectionType = this.model.connections.types.all().find(t => {
7557
- var _a, _b, _c, _d, _e, _f;
7558
- 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) || '') && t.canStartFromType(((_f = (_e = port.getNode()) === null || _e === undefined ? undefined : _e.type) === null || _f === undefined ? undefined : _f.id) || '');
7669
+ var _a, _b, _c, _d, _e, _f, _g, _h;
7670
+ 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;
7559
7671
  });
7560
7672
  invertConnection = true;
7561
7673
  }
7562
7674
  if (differentConnectionType !== undefined) {
7563
- const addConnectionAction = new AddConnectionAction(this, differentConnectionType, invertConnection ? port.id : (_q = this.unfinishedConnection.start) === null || _q === undefined ? undefined : _q.id, invertConnection ? (_r = this.unfinishedConnection.start) === null || _r === undefined ? undefined : _r.id : port.id);
7675
+ 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);
7564
7676
  // clean up the previous unfinished connection
7565
7677
  this.dropConnection();
7566
7678
  addConnectionAction.do();
@@ -8709,4 +8821,4 @@ const getLocationsOfNodes = model => {
8709
8821
  return locations;
8710
8822
  };
8711
8823
 
8712
- export { ACTION_STACK_SIZE, ActionStack, AddConnectionAction, AddNodeAction, AdjacencyLayout, ApplyLayoutAction, BreadthAdjacencyLayout, BreadthLayout, ClosedShape, CollabClient, Corner, CursorStyle, DIAGRAM_FIELD_DEFAULTS, DagaExporter, DagaImporter, DiagramActionMethod, DiagramActions, DiagramCanvas, DiagramConnection, DiagramConnectionSet, DiagramConnectionType, DiagramContextMenu, DiagramDecorator, DiagramDecoratorSet, DiagramDoubleClickEvent, DiagramElement, DiagramElementSet, DiagramEntitySet, DiagramEvent, DiagramEvents, DiagramField, DiagramFieldSet, DiagramHighlightedEvent, DiagramModel, DiagramNode, DiagramNodeSet, DiagramNodeType, DiagramObject, DiagramObjectSet, DiagramPort, DiagramPortSet, DiagramSecondaryClickEvent, DiagramSection, DiagramSectionSet, DiagramSelectionEvent, DiagramUserHighlight, DiagramUserSelection, DragEvents, EditFieldAction, Events, ForceLayout, HorizontalAlign, HorizontalLayout, Keys, LineShape, LineStyle, MoveAction, PasteAction, PriorityLayout, Property, PropertySet, RemoveAction, SetGeometryAction, SetParentAction, Side, TreeLayout, Type, UpdateValuesAction, ValueSet, VerticalAlign, VerticalLayout, ZoomEvents, addIfNotExists, diff, equals, filterByOnlyAncestors, filterByOnlyDescendants, generalClosedPath, getBottomMargin, getBottomPadding$1 as getBottomPadding, getLeftMargin, getLeftPadding$1 as getLeftPadding, getLocationsOfNodes, getRightMargin, getRightPadding$1 as getRightPadding, getTopMargin, getTopPadding$1 as getTopPadding, isObject, layouts, linePath, lineStyleDasharray, removeIfExists, setCursorStyle };
8824
+ export { ACTION_STACK_SIZE, ActionStack, AddConnectionAction, AddNodeAction, AdjacencyLayout, ApplyLayoutAction, BreadthAdjacencyLayout, BreadthLayout, ClosedShape, CollabClient, Corner, CursorStyle, DIAGRAM_FIELD_DEFAULTS, DagaExporter, DagaImporter, DiagramActionMethod, DiagramActions, DiagramCanvas, DiagramConnection, DiagramConnectionSet, DiagramConnectionType, DiagramContextMenu, DiagramDecorator, DiagramDecoratorSet, DiagramDoubleClickEvent, DiagramElement, DiagramElementSet, DiagramEntitySet, DiagramEvent, DiagramEvents, DiagramField, DiagramFieldSet, DiagramHighlightedEvent, DiagramModel, DiagramNode, DiagramNodeSet, DiagramNodeType, DiagramObject, DiagramObjectSet, DiagramPort, DiagramPortSet, DiagramPortType, DiagramSecondaryClickEvent, DiagramSection, DiagramSectionSet, DiagramSelectionEvent, DiagramUserHighlight, DiagramUserSelection, DragEvents, EditFieldAction, Events, ForceLayout, HorizontalAlign, HorizontalLayout, Keys, LineShape, LineStyle, MoveAction, PasteAction, PriorityLayout, Property, PropertySet, RemoveAction, SetGeometryAction, SetParentAction, Side, TreeLayout, Type, UpdateValuesAction, ValueSet, VerticalAlign, VerticalLayout, ZoomEvents, addIfNotExists, diff, equals, filterByOnlyAncestors, filterByOnlyDescendants, generalClosedPath, getBottomMargin, getBottomPadding$1 as getBottomPadding, getLeftMargin, getLeftPadding$1 as getLeftPadding, getLocationsOfNodes, getRightMargin, getRightPadding$1 as getRightPadding, getTopMargin, getTopPadding$1 as getTopPadding, isObject, layouts, linePath, lineStyleDasharray, removeIfExists, setCursorStyle };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metadev/daga",
3
- "version": "3.1.4",
3
+ "version": "3.1.5",
4
4
  "dependencies": {},
5
5
  "peerDependencies": {
6
6
  "d3": "^7.9.0",
package/src/index.d.ts CHANGED
@@ -13,7 +13,7 @@ export type { DiagramModelExporter } from './lib/diagram/converters/diagram-mode
13
13
  export type { DiagramModelImporter } from './lib/diagram/converters/diagram-model-importer';
14
14
  export { ActionStack, AddConnectionAction, AddNodeAction, ApplyLayoutAction, DiagramActionMethod, DiagramActions, EditFieldAction, MoveAction, PasteAction, RemoveAction, SetGeometryAction, SetParentAction, UpdateValuesAction } from './lib/diagram/diagram-action';
15
15
  export type { DiagramAction } from './lib/diagram/diagram-action';
16
- export type { ButtonsComponentConfig, CanvasConfig, ComponentsConfig, ConnectionMarkerLook, ConnectionTemplateConfig, ConnectionTypeConfig, DiagramConfig, ErrorsComponentConfig, FieldConfig, GridConfig, NodeImageLook, NodeShapedLook, NodeStretchableImageLook, NodeTemplateConfig, NodeTypeConfig, PaletteComponentConfig, PaletteSectionConfig, PortConfig, PropertyEditorComponentConfig, SectionConfig, SectionGridConfig, UserActionConfig } from './lib/diagram/diagram-config';
16
+ export type { ButtonsComponentConfig, CanvasConfig, ComponentsConfig, ConnectionMarkerLook, ConnectionTemplateConfig, ConnectionTypeConfig, DiagramConfig, ErrorsComponentConfig, FieldConfig, GridConfig, ImageLook, NodeTemplateConfig, NodeTypeConfig, PaletteComponentConfig, PaletteSectionConfig, PortConfig, PortTypeConfig, PropertyEditorComponentConfig, SectionConfig, SectionGridConfig, ShapedLook, StretchableImageLook, UserActionConfig } from './lib/diagram/diagram-config';
17
17
  export { DiagramDoubleClickEvent, DiagramEvent, DiagramEvents, DiagramHighlightedEvent, DiagramSecondaryClickEvent, DiagramSelectionEvent } from './lib/diagram/diagram-event';
18
18
  export { AdjacencyLayout } from './lib/diagram/layout/adjacency-layout';
19
19
  export { BreadthAdjacencyLayout } from './lib/diagram/layout/breadth-adjacency-layout';
@@ -35,7 +35,7 @@ export { DiagramModel } from './lib/diagram/model/diagram-model';
35
35
  export { DiagramNode, DiagramNodeSet, DiagramNodeType, filterByOnlyAncestors, filterByOnlyDescendants } from './lib/diagram/model/diagram-node';
36
36
  export type { DiagramNodeGeometry } from './lib/diagram/model/diagram-node';
37
37
  export { DiagramObject, DiagramObjectSet } from './lib/diagram/model/diagram-object';
38
- export { DiagramPort, DiagramPortSet } from './lib/diagram/model/diagram-port';
38
+ export { DiagramPort, DiagramPortSet, DiagramPortType } from './lib/diagram/model/diagram-port';
39
39
  export { diff, equals, isObject, Property, PropertySet, Type, ValueSet } from './lib/diagram/model/diagram-property';
40
40
  export type { Option } from './lib/diagram/model/diagram-property';
41
41
  export { DiagramSection, DiagramSectionSet } from './lib/diagram/model/diagram-section';
@@ -79,7 +79,9 @@ export interface DagaSection {
79
79
  }
80
80
  export interface DagaPort {
81
81
  id: string;
82
+ type?: string;
82
83
  coords: Point;
84
+ connectionPoint?: Point;
83
85
  direction: Side;
84
86
  label: string;
85
87
  collabMeta?: {