@metadev/daga 3.1.5 → 4.0.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.cjs.js CHANGED
@@ -828,6 +828,64 @@ const numberOfRows = s => {
828
828
  return ((_a = s.match(/\n/g)) === null || _a === undefined ? undefined : _a.length) || 0;
829
829
  };
830
830
 
831
+ /******************************************************************************
832
+ Copyright (c) Microsoft Corporation.
833
+
834
+ Permission to use, copy, modify, and/or distribute this software for any
835
+ purpose with or without fee is hereby granted.
836
+
837
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
838
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
839
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
840
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
841
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
842
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
843
+ PERFORMANCE OF THIS SOFTWARE.
844
+ ***************************************************************************** */
845
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
846
+
847
+
848
+ function __rest(s, e) {
849
+ var t = {};
850
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
851
+ t[p] = s[p];
852
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
853
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
854
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
855
+ t[p[i]] = s[p[i]];
856
+ }
857
+ return t;
858
+ }
859
+
860
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
861
+ var e = new Error(message);
862
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
863
+ };
864
+
865
+ /**
866
+ * Converts a configuration for a look into an easier to consult object of fully qualified looks for each case.
867
+ *
868
+ * @param lookConfig A look configuration object
869
+ * @returns An object with four keys for a look with each possible state of being selected or not and being highlighted or not.
870
+ */
871
+ const extractLooksFromConfig = lookConfig => {
872
+ const {
873
+ selected,
874
+ highlighted
875
+ } = lookConfig,
876
+ rest = __rest(lookConfig, ["selected", "highlighted"]);
877
+ const defaultLook = rest;
878
+ const selectedLook = Object.assign(Object.assign({}, defaultLook), selected);
879
+ const highlightedLook = Object.assign(Object.assign({}, defaultLook), highlighted);
880
+ const selectedAndHighlightedLook = Object.assign(Object.assign(Object.assign({}, defaultLook), highlighted), selected);
881
+ return {
882
+ defaultLook,
883
+ selectedLook,
884
+ highlightedLook,
885
+ selectedAndHighlightedLook
886
+ };
887
+ };
888
+
831
889
  /**
832
890
  * Represents a collection of diagram entities of a type that exists as part of a diagram model.
833
891
  * @public
@@ -976,6 +1034,10 @@ const DEFAULT_PRIORITY = 0;
976
1034
  * @see DiagramCanvas
977
1035
  */
978
1036
  class DiagramElement {
1037
+ /**
1038
+ * Identifier that uniquely identifies this element within its diagram model. Cannot be an empty string.
1039
+ * @public
1040
+ */
979
1041
  get id() {
980
1042
  return this._id;
981
1043
  }
@@ -1244,7 +1306,6 @@ class ValueSet {
1244
1306
  constructor(propertySet, rootElement) {
1245
1307
  this.displayedProperties = [];
1246
1308
  this.hiddenProperties = [];
1247
- // TODO JC: make this private after reviewing how it's used from React
1248
1309
  this.values = {};
1249
1310
  this.valueSets = {};
1250
1311
  /**
@@ -1529,7 +1590,7 @@ class ValueSet {
1529
1590
  this.values[key] = structuredClone(property.defaultValue);
1530
1591
  }
1531
1592
  if (rootAttribute !== undefined && rootAttribute !== null) {
1532
- if (property.defaultValue !== undefined) {
1593
+ if (property.defaultValue !== undefined && !equals(this.values[key], property.defaultValue)) {
1533
1594
  this.setRootElementValue(rootAttribute, this.values[key]);
1534
1595
  } else {
1535
1596
  this.values[key] = this.getRootElementValue(rootAttribute);
@@ -1647,6 +1708,34 @@ const diff = (a, b) => {
1647
1708
  }
1648
1709
  return [aDiff, bDiff];
1649
1710
  };
1711
+ /**
1712
+ * Calculates the differences between the two given values of a valueset and returns two objects containing the differences in each relative to the other.
1713
+ *
1714
+ * @param a An object.
1715
+ * @param b An object.
1716
+ * @param valueSet A ValueSet to use as reference for the keys and types of each property.
1717
+ * @returns A tuple of two objects with each containing the keys that have a different value in the corresponding argument compared to the other argument.
1718
+ */
1719
+ const diffProperties = (a, b, valueSet) => {
1720
+ const aDiff = {};
1721
+ const bDiff = {};
1722
+ for (const key in valueSet.propertySet.propertyMap) {
1723
+ if (valueSet.propertySet.propertyMap[key].type === exports.Type.Object) {
1724
+ const diffAB = diffProperties(a[key], b[key], valueSet.getSubValueSet(key));
1725
+ // only add the key if differences are detected
1726
+ if (Object.keys(diffAB[0]).length > 0 && Object.keys(diffAB[1]).length > 0) {
1727
+ aDiff[key] = diffAB[0];
1728
+ bDiff[key] = diffAB[1];
1729
+ }
1730
+ } else {
1731
+ if (!equals(a[key], b[key])) {
1732
+ aDiff[key] = a[key];
1733
+ bDiff[key] = b[key];
1734
+ }
1735
+ }
1736
+ }
1737
+ return [aDiff, bDiff];
1738
+ };
1650
1739
  /**
1651
1740
  * Checks if the given value is an object.
1652
1741
  * @public
@@ -1662,16 +1751,24 @@ const isObject = x => x !== undefined && x !== null && x.constructor === Object;
1662
1751
  */
1663
1752
  const DIAGRAM_CONNECTION_TYPE_DEFAULTS = {
1664
1753
  name: '',
1665
- width: 1,
1666
- shape: exports.LineShape.Straight,
1667
- style: exports.LineStyle.Solid,
1668
1754
  label: null,
1669
- defaultStartMarkerLook: null,
1670
- defaultEndMarkerLook: null,
1755
+ look: {
1756
+ lookType: 'connection-look',
1757
+ color: '#000000',
1758
+ thickness: 1,
1759
+ shape: exports.LineShape.Straight,
1760
+ style: exports.LineStyle.Solid,
1761
+ selected: {
1762
+ color: '#AA00AA'
1763
+ },
1764
+ highlighted: {
1765
+ thickness: 2
1766
+ }
1767
+ },
1768
+ startMarkerLook: undefined,
1769
+ endMarkerLook: undefined,
1671
1770
  startTypes: [],
1672
1771
  endTypes: [],
1673
- color: '#000000',
1674
- selectedColor: '#000000',
1675
1772
  properties: []
1676
1773
  };
1677
1774
  /**
@@ -1684,16 +1781,38 @@ class DiagramConnectionType {
1684
1781
  const values = Object.assign(Object.assign({}, DIAGRAM_CONNECTION_TYPE_DEFAULTS), options);
1685
1782
  this.id = values.id;
1686
1783
  this.name = values.name;
1687
- this.width = values.width;
1688
- this.shape = values.shape;
1689
- this.style = values.style;
1690
1784
  this.label = values.label;
1691
- this.defaultStartMarkerLook = values.defaultStartMarkerLook;
1692
- this.defaultEndMarkerLook = values.defaultEndMarkerLook;
1785
+ const looks = extractLooksFromConfig(values.look);
1786
+ this.defaultLook = looks.defaultLook;
1787
+ this.selectedLook = looks.selectedLook;
1788
+ this.highlightedLook = looks.highlightedLook;
1789
+ this.selectedAndHighlightedLook = looks.selectedAndHighlightedLook;
1790
+ if (values.startMarkerLook !== undefined) {
1791
+ const startMarkerLooks = extractLooksFromConfig(values.startMarkerLook);
1792
+ this.defaultStartMarkerLook = startMarkerLooks.defaultLook;
1793
+ this.selectedStartMarkerLook = startMarkerLooks.selectedLook;
1794
+ this.highlightedStartMarkerLook = startMarkerLooks.highlightedLook;
1795
+ this.selectedAndHighlightedStartMarkerLook = startMarkerLooks.selectedAndHighlightedLook;
1796
+ } else {
1797
+ this.defaultStartMarkerLook = null;
1798
+ this.selectedStartMarkerLook = null;
1799
+ this.highlightedStartMarkerLook = null;
1800
+ this.selectedAndHighlightedStartMarkerLook = null;
1801
+ }
1802
+ if (values.endMarkerLook !== undefined) {
1803
+ const endMarkerLooks = extractLooksFromConfig(values.endMarkerLook);
1804
+ this.defaultEndMarkerLook = endMarkerLooks.defaultLook;
1805
+ this.selectedEndMarkerLook = endMarkerLooks.selectedLook;
1806
+ this.highlightedEndMarkerLook = endMarkerLooks.highlightedLook;
1807
+ this.selectedAndHighlightedEndMarkerLook = endMarkerLooks.selectedAndHighlightedLook;
1808
+ } else {
1809
+ this.defaultEndMarkerLook = null;
1810
+ this.selectedEndMarkerLook = null;
1811
+ this.highlightedEndMarkerLook = null;
1812
+ this.selectedAndHighlightedEndMarkerLook = null;
1813
+ }
1693
1814
  this.startTypes = values.startTypes;
1694
1815
  this.endTypes = values.endTypes;
1695
- this.color = values.color;
1696
- this.selectedColor = values.selectedColor;
1697
1816
  this.propertySet = new PropertySet(values.properties);
1698
1817
  }
1699
1818
  canStartFromType(type) {
@@ -1709,6 +1828,27 @@ class DiagramConnectionType {
1709
1828
  * @see DiagramPort
1710
1829
  */
1711
1830
  class DiagramConnection extends DiagramElement {
1831
+ get type() {
1832
+ return this._type;
1833
+ }
1834
+ set type(type) {
1835
+ var _a, _b;
1836
+ (_b = (_a = this.model.canvas) === null || _a === undefined ? undefined : _a.userSelection) === null || _b === undefined ? undefined : _b.openInPropertyEditor(undefined);
1837
+ this._type = type;
1838
+ if (this.valueSet) {
1839
+ this.valueSet = new ValueSet(type.propertySet, this);
1840
+ }
1841
+ this.updateInView();
1842
+ }
1843
+ get typeString() {
1844
+ return this.type.id;
1845
+ }
1846
+ set typeString(typeString) {
1847
+ const type = this.model.connections.types.get(typeString);
1848
+ if (type) {
1849
+ this.type = type;
1850
+ }
1851
+ }
1712
1852
  /**
1713
1853
  * Name of this connection. Alias for this connection's middle label.
1714
1854
  * @public
@@ -1719,10 +1859,127 @@ class DiagramConnection extends DiagramElement {
1719
1859
  set name(name) {
1720
1860
  this.middleLabel = name;
1721
1861
  }
1862
+ /**
1863
+ * Current look of the connection.
1864
+ * @private
1865
+ */
1866
+ get look() {
1867
+ if (this.selected) {
1868
+ if (this.highlighted) {
1869
+ return this._selectedAndHighlightedLook !== undefined ? this._selectedAndHighlightedLook : this.type.selectedAndHighlightedLook;
1870
+ } else {
1871
+ return this._selectedLook !== undefined ? this._selectedLook : this.type.selectedLook;
1872
+ }
1873
+ } else {
1874
+ if (this.highlighted) {
1875
+ return this._highlightedLook !== undefined ? this._highlightedLook : this.type.highlightedLook;
1876
+ } else {
1877
+ return this._defaultLook !== undefined ? this._defaultLook : this.type.defaultLook;
1878
+ }
1879
+ }
1880
+ }
1881
+ /**
1882
+ * Sets the look configuration of the connection to override the one determined by the type.
1883
+ * `undefined` resets it to the one determined by the type.
1884
+ * @private
1885
+ */
1886
+ set look(look) {
1887
+ if (look) {
1888
+ const looks = extractLooksFromConfig(look);
1889
+ this._defaultLook = Object.assign(Object.assign({}, this._defaultLook), looks.defaultLook);
1890
+ this._selectedLook = Object.assign(Object.assign({}, this._selectedLook), looks.selectedLook);
1891
+ this._highlightedLook = Object.assign(Object.assign({}, this._highlightedLook), looks.highlightedLook);
1892
+ this._selectedAndHighlightedLook = Object.assign(Object.assign({}, this._selectedAndHighlightedLook), looks.selectedAndHighlightedLook);
1893
+ } else {
1894
+ this._defaultLook = look;
1895
+ this._selectedLook = look;
1896
+ this._highlightedLook = look;
1897
+ this._selectedAndHighlightedLook = look;
1898
+ }
1899
+ }
1900
+ /**
1901
+ * Current look of the start marker.
1902
+ * @private
1903
+ */
1904
+ get startMarkerLook() {
1905
+ if (this.selected) {
1906
+ if (this.highlighted) {
1907
+ return this._selectedAndHighlightedStartMarkerLook !== undefined ? this._selectedAndHighlightedStartMarkerLook : this.type.selectedAndHighlightedStartMarkerLook;
1908
+ } else {
1909
+ return this._selectedStartMarkerLook !== undefined ? this._selectedStartMarkerLook : this.type.selectedStartMarkerLook;
1910
+ }
1911
+ } else {
1912
+ if (this.highlighted) {
1913
+ return this._highlightedStartMarkerLook !== undefined ? this._highlightedStartMarkerLook : this.type.highlightedStartMarkerLook;
1914
+ } else {
1915
+ return this._defaultStartMarkerLook !== undefined ? this._defaultStartMarkerLook : this.type.defaultStartMarkerLook;
1916
+ }
1917
+ }
1918
+ }
1919
+ /**
1920
+ * Sets the look configuration of the start marker to override the one determined by the type.
1921
+ * `null` stands for no marker and `undefined` resets it to the one determined by the type.
1922
+ * @private
1923
+ */
1924
+ set startMarkerLook(startMarkerLook) {
1925
+ if (startMarkerLook) {
1926
+ const looks = extractLooksFromConfig(startMarkerLook);
1927
+ this._defaultStartMarkerLook = Object.assign(Object.assign({}, this._defaultStartMarkerLook), looks.defaultLook);
1928
+ this._selectedStartMarkerLook = Object.assign(Object.assign({}, this._selectedStartMarkerLook), looks.selectedLook);
1929
+ this._highlightedStartMarkerLook = Object.assign(Object.assign({}, this._highlightedStartMarkerLook), looks.highlightedLook);
1930
+ this._selectedAndHighlightedStartMarkerLook = Object.assign(Object.assign({}, this._selectedAndHighlightedStartMarkerLook), looks.selectedAndHighlightedLook);
1931
+ } else {
1932
+ this._defaultStartMarkerLook = startMarkerLook;
1933
+ this._selectedStartMarkerLook = startMarkerLook;
1934
+ this._highlightedStartMarkerLook = startMarkerLook;
1935
+ this._selectedAndHighlightedStartMarkerLook = startMarkerLook;
1936
+ }
1937
+ }
1938
+ /**
1939
+ * Current look of the end marker.
1940
+ * @private
1941
+ */
1942
+ get endMarkerLook() {
1943
+ if (this.selected) {
1944
+ if (this.highlighted) {
1945
+ return this._selectedAndHighlightedEndMarkerLook !== undefined ? this._selectedAndHighlightedEndMarkerLook : this.type.selectedAndHighlightedEndMarkerLook;
1946
+ } else {
1947
+ return this._selectedEndMarkerLook !== undefined ? this._selectedEndMarkerLook : this.type.selectedEndMarkerLook;
1948
+ }
1949
+ } else {
1950
+ if (this.highlighted) {
1951
+ return this._highlightedEndMarkerLook !== undefined ? this._highlightedEndMarkerLook : this.type.highlightedEndMarkerLook;
1952
+ } else {
1953
+ return this._defaultEndMarkerLook !== undefined ? this._defaultEndMarkerLook : this.type.defaultEndMarkerLook;
1954
+ }
1955
+ }
1956
+ }
1957
+ /**
1958
+ * Sets the look configuration of the end marker to override the one determined by the type.
1959
+ * `null` stands for no marker and `undefined` resets it to the one determined by the type.
1960
+ * @private
1961
+ */
1962
+ set endMarkerLook(endMarkerLook) {
1963
+ if (endMarkerLook) {
1964
+ const looks = extractLooksFromConfig(endMarkerLook);
1965
+ this._defaultEndMarkerLook = Object.assign(Object.assign({}, this._defaultEndMarkerLook), looks.defaultLook);
1966
+ this._selectedEndMarkerLook = Object.assign(Object.assign({}, this._selectedEndMarkerLook), looks.selectedLook);
1967
+ this._highlightedEndMarkerLook = Object.assign(Object.assign({}, this._highlightedEndMarkerLook), looks.highlightedLook);
1968
+ this._selectedAndHighlightedEndMarkerLook = Object.assign(Object.assign({}, this._selectedAndHighlightedEndMarkerLook), looks.selectedAndHighlightedLook);
1969
+ } else {
1970
+ this._defaultEndMarkerLook = endMarkerLook;
1971
+ this._selectedEndMarkerLook = endMarkerLook;
1972
+ this._highlightedEndMarkerLook = endMarkerLook;
1973
+ this._selectedAndHighlightedEndMarkerLook = endMarkerLook;
1974
+ }
1975
+ }
1722
1976
  constructor(model, type, start, end, id) {
1723
1977
  if (model.connections.get(id) !== undefined) {
1724
1978
  throw new Error(`DiagramConnection with id "${id}" already exists`);
1725
1979
  }
1980
+ if (!id) {
1981
+ throw new Error(`DiagramConnection cannot have an empty or null id`);
1982
+ }
1726
1983
  super(model, id);
1727
1984
  /**
1728
1985
  * Coordinates of the start point of this connection.
@@ -1754,11 +2011,9 @@ class DiagramConnection extends DiagramElement {
1754
2011
  * @public
1755
2012
  */
1756
2013
  this.points = [];
1757
- this.type = type;
2014
+ this._type = type;
1758
2015
  this.valueSet = new ValueSet(type.propertySet, this);
1759
2016
  this.originalData = {};
1760
- this.startMarkerLook = type.defaultStartMarkerLook;
1761
- this.endMarkerLook = type.defaultEndMarkerLook;
1762
2017
  this.setStart(start);
1763
2018
  this.setEnd(end);
1764
2019
  }
@@ -1931,7 +2186,7 @@ class DiagramConnectionSet extends DiagramElementSet {
1931
2186
  * @param type The type of the connection given as either the type itself or the id of the type.
1932
2187
  * @param start The start port of the connection.
1933
2188
  * @param end The end port of the connection.
1934
- * @param id The id of the connection.
2189
+ * @param id The id of the connection. Cannot be an empty string.
1935
2190
  * @returns The instanced connection.
1936
2191
  */
1937
2192
  new(type, start, end, id) {
@@ -2257,30 +2512,6 @@ const getTopPadding$1 = config => {
2257
2512
  }
2258
2513
  };
2259
2514
 
2260
- /**
2261
- * Default values of the look of a diagram section.
2262
- * @private
2263
- * @see DIAGRAM_SECTION_DEFAULTS
2264
- */
2265
- const DIAGRAM_SECTION_LOOK_DEFAULTS = {
2266
- lookType: 'shaped-look',
2267
- shape: exports.ClosedShape.Rectangle,
2268
- fillColor: '#FFFFFF',
2269
- borderColor: '#000000',
2270
- selectedFillColor: '#FFFFFF',
2271
- selectedBorderColor: '#000000'
2272
- };
2273
- /**
2274
- * Default values of the parameters of a diagram section.
2275
- * @private
2276
- * @see DiagramSection
2277
- */
2278
- const DIAGRAM_SECTION_DEFAULTS = {
2279
- label: null,
2280
- ports: [],
2281
- look: DIAGRAM_SECTION_LOOK_DEFAULTS,
2282
- priority: DEFAULT_PRIORITY
2283
- };
2284
2515
  /**
2285
2516
  * Default value of the default width of a diagram section.
2286
2517
  * @private
@@ -2305,6 +2536,41 @@ const DIAGRAM_SECTION_MIN_WIDTH = 1;
2305
2536
  * @see DiagramSection
2306
2537
  */
2307
2538
  const DIAGRAM_SECTION_MIN_HEIGHT = 1;
2539
+ /**
2540
+ * A grid of sections which a node has.
2541
+ * @public
2542
+ * @see DiagramNode
2543
+ * @see SectionGridConfig
2544
+ */
2545
+ class DiagramSectionGrid {
2546
+ constructor(options) {
2547
+ this.margin = options.margin || 0;
2548
+ this.defaultWidths = options.defaultWidths || null;
2549
+ this.defaultHeights = options.defaultHeights || null;
2550
+ this.minWidths = options.minWidths || null;
2551
+ this.minHeights = options.minHeights || null;
2552
+ this.sections = [];
2553
+ for (const sectionRow of options.sections) {
2554
+ const sectionList = [];
2555
+ this.sections.push(sectionList);
2556
+ for (const section of sectionRow) {
2557
+ sectionList.push(new DiagramSectionType(section));
2558
+ }
2559
+ }
2560
+ }
2561
+ }
2562
+ class DiagramSectionType {
2563
+ constructor(options) {
2564
+ this.label = options.label || null;
2565
+ this.ports = options.ports || [];
2566
+ this.priority = options.priority || DEFAULT_PRIORITY;
2567
+ const looks = extractLooksFromConfig(options.look || DIAGRAM_NODE_LOOK_DEFAULTS);
2568
+ this.defaultLook = looks.defaultLook;
2569
+ this.selectedLook = looks.selectedLook;
2570
+ this.highlightedLook = looks.highlightedLook;
2571
+ this.selectedAndHighlightedLook = looks.selectedAndHighlightedLook;
2572
+ }
2573
+ }
2308
2574
  /**
2309
2575
  * A section of a node which can have connections and display a property of the node.
2310
2576
  * @public
@@ -2326,10 +2592,52 @@ class DiagramSection extends DiagramElement {
2326
2592
  this.label.text = name;
2327
2593
  }
2328
2594
  }
2595
+ /**
2596
+ * Current look of this port.
2597
+ * @private
2598
+ */
2599
+ get look() {
2600
+ var _a, _b, _c, _d, _e, _f, _g, _h;
2601
+ if (this.selected) {
2602
+ if (this.highlighted) {
2603
+ return this._selectedAndHighlightedLook !== undefined ? this._selectedAndHighlightedLook : ((_a = this.type) === null || _a === undefined ? undefined : _a.selectedAndHighlightedLook) || ((_b = this.node) === null || _b === undefined ? undefined : _b.look);
2604
+ } else {
2605
+ return this._selectedLook !== undefined ? this._selectedLook : ((_c = this.type) === null || _c === undefined ? undefined : _c.selectedLook) || ((_d = this.node) === null || _d === undefined ? undefined : _d.look);
2606
+ }
2607
+ } else {
2608
+ if (this.highlighted) {
2609
+ return this._highlightedLook !== undefined ? this._highlightedLook : ((_e = this.type) === null || _e === undefined ? undefined : _e.highlightedLook) || ((_f = this.node) === null || _f === undefined ? undefined : _f.look);
2610
+ } else {
2611
+ return this._defaultLook !== undefined ? this._defaultLook : ((_g = this.type) === null || _g === undefined ? undefined : _g.defaultLook) || ((_h = this.node) === null || _h === undefined ? undefined : _h.look);
2612
+ }
2613
+ }
2614
+ }
2615
+ /**
2616
+ * Sets the look configuration of the look to override the one determined by the type.
2617
+ * `undefined` resets it to the one determined by the type.
2618
+ * @private
2619
+ */
2620
+ set look(look) {
2621
+ if (look) {
2622
+ const looks = extractLooksFromConfig(look);
2623
+ this._defaultLook = Object.assign(Object.assign({}, this._defaultLook), looks.defaultLook);
2624
+ this._selectedLook = Object.assign(Object.assign({}, this._selectedLook), looks.selectedLook);
2625
+ this._highlightedLook = Object.assign(Object.assign({}, this._highlightedLook), looks.highlightedLook);
2626
+ this._selectedAndHighlightedLook = Object.assign(Object.assign({}, this._selectedAndHighlightedLook), looks.selectedAndHighlightedLook);
2627
+ } else {
2628
+ this._defaultLook = look;
2629
+ this._selectedLook = look;
2630
+ this._highlightedLook = look;
2631
+ this._selectedAndHighlightedLook = look;
2632
+ }
2633
+ }
2329
2634
  constructor(model, node, indexXInNode, indexYInNode, coords, width, height, id) {
2330
2635
  if (model.sections.get(id) !== undefined) {
2331
2636
  throw new Error(`DiagramSection with id "${id}" already exists`);
2332
2637
  }
2638
+ if (!id) {
2639
+ throw new Error(`DiagramSection cannot have an empty or null id`);
2640
+ }
2333
2641
  super(model, id);
2334
2642
  /**
2335
2643
  * Ports of this section.
@@ -2368,7 +2676,7 @@ class DiagramSection extends DiagramElement {
2368
2676
  decorator.raise();
2369
2677
  }
2370
2678
  }
2371
- getConfig() {
2679
+ get type() {
2372
2680
  var _a, _b, _c, _d, _e;
2373
2681
  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];
2374
2682
  }
@@ -2382,7 +2690,7 @@ class DiagramSection extends DiagramElement {
2382
2690
  }
2383
2691
  getPriority() {
2384
2692
  var _a, _b, _c, _d, _e, _f;
2385
- 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) || DIAGRAM_SECTION_DEFAULTS.priority;
2693
+ 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;
2386
2694
  }
2387
2695
  /**
2388
2696
  * Get the port of this section which is closest to the given coordinates.
@@ -2533,7 +2841,6 @@ class DiagramSection extends DiagramElement {
2533
2841
  * @public
2534
2842
  */
2535
2843
  setGeometry(geometry) {
2536
- var _a, _b, _c, _d, _e, _f;
2537
2844
  const oldCoordsX = [this.coords[0], this.coords[0] + this.width];
2538
2845
  const oldCoordsY = [this.coords[1], this.coords[1] + this.height];
2539
2846
  this.coords = [...geometry.coords];
@@ -2546,10 +2853,11 @@ class DiagramSection extends DiagramElement {
2546
2853
  port.move(translatePoint(port.coords, oldCoordsX, oldCoordsY, newCoordsX, newCoordsY));
2547
2854
  }
2548
2855
  // Set label's dimensions as a function of ours.
2856
+ const type = this.type;
2549
2857
  if (this.label) {
2550
- this.label.coords = [this.coords[0] + getLeftMargin((_a = this.getConfig()) === null || _a === undefined ? undefined : _a.label), this.coords[1] + getTopMargin((_b = this.getConfig()) === null || _b === undefined ? undefined : _b.label)];
2551
- this.label.width = this.width - getLeftMargin((_c = this.getConfig()) === null || _c === undefined ? undefined : _c.label) - getRightMargin((_d = this.getConfig()) === null || _d === undefined ? undefined : _d.label);
2552
- this.label.height = this.height - getTopMargin((_e = this.getConfig()) === null || _e === undefined ? undefined : _e.label) - getBottomMargin((_f = this.getConfig()) === null || _f === undefined ? undefined : _f.label);
2858
+ 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)];
2859
+ this.label.width = this.width - getLeftMargin(type === null || type === undefined ? undefined : type.label) - getRightMargin(type === null || type === undefined ? undefined : type.label);
2860
+ this.label.height = this.height - getTopMargin(type === null || type === undefined ? undefined : type.label) - getBottomMargin(type === null || type === undefined ? undefined : type.label);
2553
2861
  this.label.updateInView();
2554
2862
  }
2555
2863
  // Move decorators to match the new coords.
@@ -2650,8 +2958,14 @@ const DIAGRAM_NODE_LOOK_DEFAULTS = {
2650
2958
  shape: exports.ClosedShape.Rectangle,
2651
2959
  fillColor: '#FFFFFF',
2652
2960
  borderColor: '#000000',
2653
- selectedFillColor: '#FFFFFF',
2654
- selectedBorderColor: '#000000'
2961
+ borderThickness: 1,
2962
+ selected: {
2963
+ fillColor: '#FFAAFF',
2964
+ borderColor: '#AA00AA'
2965
+ },
2966
+ highlighted: {
2967
+ borderThickness: 3
2968
+ }
2655
2969
  };
2656
2970
  /**
2657
2971
  * Default values of the parameters of a diagram node.
@@ -2699,8 +3013,12 @@ class DiagramNodeType {
2699
3013
  this.topPadding = getTopPadding(values);
2700
3014
  this.label = values.label;
2701
3015
  this.ports = values.ports;
2702
- this.sectionGrid = values.sectionGrid;
2703
- this.look = values.look;
3016
+ this.sectionGrid = values.sectionGrid ? new DiagramSectionGrid(values.sectionGrid) : null;
3017
+ const looks = extractLooksFromConfig(values.look);
3018
+ this.defaultLook = looks.defaultLook;
3019
+ this.selectedLook = looks.selectedLook;
3020
+ this.highlightedLook = looks.highlightedLook;
3021
+ this.selectedAndHighlightedLook = looks.selectedAndHighlightedLook;
2704
3022
  this.isUnique = values.isUnique;
2705
3023
  this.canBeParentless = values.canBeParentless;
2706
3024
  this.childrenTypes = values.childrenTypes;
@@ -2716,6 +3034,27 @@ class DiagramNodeType {
2716
3034
  * @see DiagramSection
2717
3035
  */
2718
3036
  class DiagramNode extends DiagramElement {
3037
+ get type() {
3038
+ return this._type;
3039
+ }
3040
+ set type(type) {
3041
+ var _a, _b;
3042
+ (_b = (_a = this.model.canvas) === null || _a === undefined ? undefined : _a.userSelection) === null || _b === undefined ? undefined : _b.openInPropertyEditor(undefined);
3043
+ this._type = type;
3044
+ if (this.valueSet) {
3045
+ this.valueSet = new ValueSet(type.propertySet, this);
3046
+ }
3047
+ this.updateInView();
3048
+ }
3049
+ get typeString() {
3050
+ return this.type.id;
3051
+ }
3052
+ set typeString(typeString) {
3053
+ const type = this.model.nodes.types.get(typeString);
3054
+ if (type) {
3055
+ this.type = type;
3056
+ }
3057
+ }
2719
3058
  /**
2720
3059
  * Name of this node. Alias for this node's label's text.
2721
3060
  * @public
@@ -2729,10 +3068,51 @@ class DiagramNode extends DiagramElement {
2729
3068
  this.label.text = name;
2730
3069
  }
2731
3070
  }
3071
+ /**
3072
+ * Current look of this port.
3073
+ * @private
3074
+ */
3075
+ get look() {
3076
+ if (this.selected) {
3077
+ if (this.highlighted) {
3078
+ return this._selectedAndHighlightedLook !== undefined ? this._selectedAndHighlightedLook : this.type.selectedAndHighlightedLook;
3079
+ } else {
3080
+ return this._selectedLook !== undefined ? this._selectedLook : this.type.selectedLook;
3081
+ }
3082
+ } else {
3083
+ if (this.highlighted) {
3084
+ return this._highlightedLook !== undefined ? this._highlightedLook : this.type.highlightedLook;
3085
+ } else {
3086
+ return this._defaultLook !== undefined ? this._defaultLook : this.type.defaultLook;
3087
+ }
3088
+ }
3089
+ }
3090
+ /**
3091
+ * Sets the look configuration of the look to override the one determined by the type.
3092
+ * `undefined` resets it to the one determined by the type.
3093
+ * @private
3094
+ */
3095
+ set look(look) {
3096
+ if (look) {
3097
+ const looks = extractLooksFromConfig(look);
3098
+ this._defaultLook = Object.assign(Object.assign({}, this._defaultLook), looks.defaultLook);
3099
+ this._selectedLook = Object.assign(Object.assign({}, this._selectedLook), looks.selectedLook);
3100
+ this._highlightedLook = Object.assign(Object.assign({}, this._highlightedLook), looks.highlightedLook);
3101
+ this._selectedAndHighlightedLook = Object.assign(Object.assign({}, this._selectedAndHighlightedLook), looks.selectedAndHighlightedLook);
3102
+ } else {
3103
+ this._defaultLook = look;
3104
+ this._selectedLook = look;
3105
+ this._highlightedLook = look;
3106
+ this._selectedAndHighlightedLook = look;
3107
+ }
3108
+ }
2732
3109
  constructor(model, type, coords = [0, 0], id) {
2733
3110
  if (model.nodes.get(id) !== undefined) {
2734
3111
  throw new Error(`DiagramNode with id "${id}" already exists`);
2735
3112
  }
3113
+ if (!id) {
3114
+ throw new Error(`DiagramNode cannot have an empty or null id`);
3115
+ }
2736
3116
  super(model, id);
2737
3117
  /**
2738
3118
  * Nodes contained within this node.
@@ -2759,7 +3139,7 @@ class DiagramNode extends DiagramElement {
2759
3139
  * @public
2760
3140
  */
2761
3141
  this.geometryTimestamp = null;
2762
- this.type = type;
3142
+ this._type = type;
2763
3143
  this.valueSet = new ValueSet(type.propertySet, this);
2764
3144
  this.originalData = {};
2765
3145
  this.coords = coords;
@@ -3238,7 +3618,7 @@ class DiagramNodeSet extends DiagramElementSet {
3238
3618
  * @public
3239
3619
  * @param type The type of the node given as either the type itself or the id of the type.
3240
3620
  * @param coords The coordinates of the top left corner of the node in the diagram.
3241
- * @param id The id of the node.
3621
+ * @param id The id of the node. Cannot be an empty string.
3242
3622
  * @returns The instanced node.
3243
3623
  */
3244
3624
  new(type, coords, id) {
@@ -3273,7 +3653,8 @@ class DiagramNodeSet extends DiagramElementSet {
3273
3653
  if (nodeType.ports.length > 0) {
3274
3654
  for (let i = 0; i < nodeType.ports.length; ++i) {
3275
3655
  const portConfig = nodeType.ports[i];
3276
- 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}`);
3656
+ const portType = portConfig.type !== undefined ? this.model.ports.types.get(portConfig.type) : undefined;
3657
+ 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}_${i}`);
3277
3658
  if ((_e = port.type) === null || _e === undefined ? undefined : _e.label) {
3278
3659
  const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), (_f = port.type) === null || _f === undefined ? undefined : _f.label);
3279
3660
  const labelWidth = 6 * labelConfiguration.fontSize + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
@@ -3470,14 +3851,24 @@ const getTopPadding = config => {
3470
3851
  };
3471
3852
 
3472
3853
  /**
3473
- * Default values of the parameters of a diagram port.
3854
+ * Default values of the look of a diagram port.
3474
3855
  * @private
3475
- * @see DiagramPort
3856
+ * @see DIAGRAM_NODE_TYPE_DEFAULTS
3476
3857
  */
3477
- const DIAGRAM_PORT_DEFAULTS = {
3478
- highlightedColor: 'cyan',
3479
- selectedColor: 'violet'
3858
+ const DIAGRAM_PORT_LOOK_DEFAULTS = {
3859
+ lookType: 'shaped-look',
3860
+ shape: exports.ClosedShape.Ellipse,
3861
+ fillColor: 'transparent',
3862
+ borderColor: 'transparent',
3863
+ borderThickness: 0,
3864
+ selected: {
3865
+ fillColor: 'rgba(255, 0, 255, 0.5)'
3866
+ },
3867
+ highlighted: {
3868
+ fillColor: 'rgba(0, 255, 255, 0.5)'
3869
+ }
3480
3870
  };
3871
+ const DIAGRAM_PORT_LOOKS = extractLooksFromConfig(DIAGRAM_PORT_LOOK_DEFAULTS);
3481
3872
  /**
3482
3873
  * Default values of the parameters of a diagram port.
3483
3874
  * @private
@@ -3488,7 +3879,8 @@ const DIAGRAM_PORT_TYPE_DEFAULTS = {
3488
3879
  label: null,
3489
3880
  allowsOutgoing: true,
3490
3881
  allowsIncoming: true,
3491
- width: 24
3882
+ width: 24,
3883
+ look: DIAGRAM_PORT_LOOK_DEFAULTS
3492
3884
  };
3493
3885
  /**
3494
3886
  * A port type, which holds properties that ports of this type share in common.
@@ -3504,7 +3896,11 @@ class DiagramPortType {
3504
3896
  this.allowsOutgoing = values.allowsOutgoing;
3505
3897
  this.allowsIncoming = values.allowsIncoming;
3506
3898
  this.width = values.width;
3507
- this.look = values.look;
3899
+ const looks = extractLooksFromConfig(values.look);
3900
+ this.defaultLook = looks.defaultLook;
3901
+ this.selectedLook = looks.selectedLook;
3902
+ this.highlightedLook = looks.highlightedLook;
3903
+ this.selectedAndHighlightedLook = looks.selectedAndHighlightedLook;
3508
3904
  }
3509
3905
  }
3510
3906
  /**
@@ -3515,6 +3911,27 @@ class DiagramPortType {
3515
3911
  * @see DiagramSection
3516
3912
  */
3517
3913
  class DiagramPort extends DiagramElement {
3914
+ get type() {
3915
+ return this._type;
3916
+ }
3917
+ set type(type) {
3918
+ this._type = type;
3919
+ this.updateInView();
3920
+ }
3921
+ get typeString() {
3922
+ var _a;
3923
+ return (_a = this.type) === null || _a === undefined ? undefined : _a.id;
3924
+ }
3925
+ set typeString(typeString) {
3926
+ if (typeString === undefined) {
3927
+ this.type = undefined;
3928
+ } else {
3929
+ const type = this.model.ports.types.get(typeString);
3930
+ if (type) {
3931
+ this.type = type;
3932
+ }
3933
+ }
3934
+ }
3518
3935
  /**
3519
3936
  * Whether this port can be used as a connection start point.
3520
3937
  */
@@ -3542,10 +3959,67 @@ class DiagramPort extends DiagramElement {
3542
3959
  this.label.text = name;
3543
3960
  }
3544
3961
  }
3962
+ /**
3963
+ * Current look of this port.
3964
+ * @private
3965
+ */
3966
+ get look() {
3967
+ var _a, _b, _c, _d;
3968
+ if (this.selected) {
3969
+ if (this.highlighted) {
3970
+ return this._selectedAndHighlightedLook !== undefined ? this._selectedAndHighlightedLook : (_a = this.type || DIAGRAM_PORT_LOOKS) === null || _a === undefined ? undefined : _a.selectedAndHighlightedLook;
3971
+ } else {
3972
+ return this._selectedLook !== undefined ? this._selectedLook : (_b = this.type || DIAGRAM_PORT_LOOKS) === null || _b === undefined ? undefined : _b.selectedLook;
3973
+ }
3974
+ } else {
3975
+ if (this.highlighted) {
3976
+ return this._highlightedLook !== undefined ? this._highlightedLook : (_c = this.type || DIAGRAM_PORT_LOOKS) === null || _c === undefined ? undefined : _c.highlightedLook;
3977
+ } else {
3978
+ return this._defaultLook !== undefined ? this._defaultLook : (_d = this.type || DIAGRAM_PORT_LOOKS) === null || _d === undefined ? undefined : _d.defaultLook;
3979
+ }
3980
+ }
3981
+ }
3982
+ /**
3983
+ * Sets the look configuration of the look to override the one determined by the type.
3984
+ * `undefined` resets it to the one determined by the type.
3985
+ * @private
3986
+ */
3987
+ set look(look) {
3988
+ if (look) {
3989
+ const looks = extractLooksFromConfig(look);
3990
+ this._defaultLook = Object.assign(Object.assign({}, this._defaultLook), looks.defaultLook);
3991
+ this._selectedLook = Object.assign(Object.assign({}, this._selectedLook), looks.selectedLook);
3992
+ this._highlightedLook = Object.assign(Object.assign({}, this._highlightedLook), looks.highlightedLook);
3993
+ this._selectedAndHighlightedLook = Object.assign(Object.assign({}, this._selectedAndHighlightedLook), looks.selectedAndHighlightedLook);
3994
+ } else {
3995
+ this._defaultLook = look;
3996
+ this._selectedLook = look;
3997
+ this._highlightedLook = look;
3998
+ this._selectedAndHighlightedLook = look;
3999
+ }
4000
+ }
4001
+ /**
4002
+ * Current width of this port.
4003
+ * @private
4004
+ */
4005
+ get width() {
4006
+ var _a;
4007
+ return ((_a = this.type) === null || _a === undefined ? undefined : _a.width) || DIAGRAM_PORT_TYPE_DEFAULTS.width;
4008
+ }
4009
+ /**
4010
+ * Current height of this port. Same as the width.
4011
+ * @private
4012
+ */
4013
+ get height() {
4014
+ return this.width;
4015
+ }
3545
4016
  constructor(model, type, rootElement, coords, connectionPoint, direction, id) {
3546
4017
  if (model.ports.get(id) !== undefined) {
3547
4018
  throw new Error(`DiagramPort with id "${id}" already exists`);
3548
4019
  }
4020
+ if (!id) {
4021
+ throw new Error(`DiagramPort cannot have an empty or null id`);
4022
+ }
3549
4023
  super(model, id);
3550
4024
  /**
3551
4025
  * Connections that start at this port.
@@ -3557,7 +4031,7 @@ class DiagramPort extends DiagramElement {
3557
4031
  * @public
3558
4032
  */
3559
4033
  this.incomingConnections = [];
3560
- this.type = type;
4034
+ this._type = type;
3561
4035
  this.rootElement = rootElement;
3562
4036
  this.coords = coords;
3563
4037
  this.connectionPoint = connectionPoint || coords;
@@ -5148,7 +5622,10 @@ class DiagramHighlightedEvent extends DiagramEvent {
5148
5622
  class DiagramDecorator extends DiagramElement {
5149
5623
  constructor(model, rootElement, coords, width, height, priority, html, id) {
5150
5624
  if (model.objects.get(id) !== undefined) {
5151
- throw new Error(`DiagramObject with id "${id}" already exists`);
5625
+ throw new Error(`DiagramDecorator with id "${id}" already exists`);
5626
+ }
5627
+ if (!id) {
5628
+ throw new Error(`DiagramDecorator cannot have an empty or null id`);
5152
5629
  }
5153
5630
  super(model, id);
5154
5631
  this.rootElement = rootElement;
@@ -5197,7 +5674,14 @@ class DiagramDecoratorSet extends DiagramElementSet {
5197
5674
  }
5198
5675
  /**
5199
5676
  * Instance a new decorator and add it to this set.
5200
- * @private
5677
+ * @public
5678
+ * @param coords The coordinates of the top left corner of the decorator in the diagram.
5679
+ * @param width The dimension of the decorator along the x axis.
5680
+ * @param height The dimension of the decorator along the y axis.
5681
+ * @param priority The priority of the decorator. Used when filtering by priority.
5682
+ * @param html The html contents of the decorator.
5683
+ * @param id The id of the decorator. Cannot be an empty string.
5684
+ * @returns The instanced decorator.
5201
5685
  */
5202
5686
  new(rootElement, coords, width, height, priority, html, id) {
5203
5687
  const decorator = new DiagramDecorator(this.model, rootElement, coords, width, height, priority, html, id);
@@ -5234,6 +5718,9 @@ class DiagramObject extends DiagramElement {
5234
5718
  if (model.objects.get(id) !== undefined) {
5235
5719
  throw new Error(`DiagramObject with id "${id}" already exists`);
5236
5720
  }
5721
+ if (!id) {
5722
+ throw new Error(`DiagramObject cannot have an empty or null id`);
5723
+ }
5237
5724
  super(model, id);
5238
5725
  this.coords = coords;
5239
5726
  this.width = width;
@@ -5280,7 +5767,14 @@ class DiagramObjectSet extends DiagramElementSet {
5280
5767
  }
5281
5768
  /**
5282
5769
  * Instance a new object and add it to this set.
5283
- * @private
5770
+ * @public
5771
+ * @param coords The coordinates of the top left corner of the object in the diagram.
5772
+ * @param width The dimension of the object along the x axis.
5773
+ * @param height The dimension of the object along the y axis.
5774
+ * @param priority The priority of the object. Used when filtering by priority.
5775
+ * @param html The html contents of the object.
5776
+ * @param id The id of the object. Cannot be an empty string.
5777
+ * @returns The instanced object.
5284
5778
  */
5285
5779
  new(coords, width, height, priority, html, id) {
5286
5780
  const object = new DiagramObject(this.model, coords, width, height, priority, html, id);
@@ -5383,6 +5877,68 @@ class DiagramModel {
5383
5877
  }
5384
5878
  }
5385
5879
 
5880
+ /**
5881
+ * Checks if the given mouse event was produced with a secondary button press.
5882
+ * @private
5883
+ * @param event A mouse event.
5884
+ * @returns `true` if the given mouse event was produced with a secondary button press, `false` otherwise.
5885
+ */
5886
+ const isSecondaryButton = event => {
5887
+ return !!event.button;
5888
+ };
5889
+ /**
5890
+ * Get the SVG path of a diagram connection.
5891
+ * @private
5892
+ * @see linePath
5893
+ */
5894
+ const getConnectionPath = (shape, startCoords, endCoords, startDirection, endDirection, width, startMarkerWidth, endMarkerWidth) => {
5895
+ return linePath(shape, [startCoords, endCoords], startDirection, endDirection, Math.max(
5896
+ // reasonable value for the minimumDistanceBeforeTurn relative to the line width
5897
+ 10, startMarkerWidth || 0, endMarkerWidth || 0) * width);
5898
+ };
5899
+ const setCursorStyle = style => {
5900
+ if (!style) {
5901
+ d3__namespace.select('body').style('cursor', exports.CursorStyle.Auto);
5902
+ } else {
5903
+ d3__namespace.select('body').style('cursor', style);
5904
+ }
5905
+ };
5906
+ const getRelatedNodeOrItself = element => {
5907
+ if (element instanceof DiagramNode) {
5908
+ return element;
5909
+ }
5910
+ if (element instanceof DiagramSection) {
5911
+ return element.node || element;
5912
+ }
5913
+ return element.rootElement instanceof DiagramNode || element.rootElement instanceof DiagramSection || element.rootElement instanceof DiagramPort ? getRelatedNodeOrItself(element.rootElement) : element;
5914
+ };
5915
+ const initializeLook = selection => {
5916
+ selection.filter('.shaped-look').append('path');
5917
+ selection.filter('.image-look').append('image').attr('preserveAspectRatio', 'none');
5918
+ selection.filter('.stretchable-image-look').append('image').attr('class', 'top-left-image').attr('preserveAspectRatio', 'none');
5919
+ selection.filter('.stretchable-image-look').append('image').attr('class', 'top-image').attr('preserveAspectRatio', 'none');
5920
+ selection.filter('.stretchable-image-look').append('image').attr('class', 'top-right-image').attr('preserveAspectRatio', 'none');
5921
+ selection.filter('.stretchable-image-look').append('image').attr('class', 'left-image').attr('preserveAspectRatio', 'none');
5922
+ selection.filter('.stretchable-image-look').append('image').attr('class', 'center-image').attr('preserveAspectRatio', 'none');
5923
+ selection.filter('.stretchable-image-look').append('image').attr('class', 'right-image').attr('preserveAspectRatio', 'none');
5924
+ selection.filter('.stretchable-image-look').append('image').attr('class', 'bottom-left-image').attr('preserveAspectRatio', 'none');
5925
+ selection.filter('.stretchable-image-look').append('image').attr('class', 'bottom-image').attr('preserveAspectRatio', 'none');
5926
+ selection.filter('.stretchable-image-look').append('image').attr('class', 'bottom-right-image').attr('preserveAspectRatio', 'none');
5927
+ };
5928
+ const updateLook = selection => {
5929
+ selection.filter('.shaped-look').select('path').attr('d', d => generalClosedPath(d.look.shape, 0, 0, d.width, d.height)).attr('fill', d => d.look.fillColor).attr('stroke', d => d.look.borderColor).attr('stroke-width', d => `${d.look.borderThickness}px`);
5930
+ selection.filter('.image-look').select('image').attr('x', 0).attr('y', 0).attr('width', d => d.width).attr('height', d => d.height).attr('href', d => d.look.backgroundImage);
5931
+ selection.filter('.stretchable-image-look').select('image.top-left-image').attr('x', 0).attr('y', 0).attr('width', d => d.look.leftMargin).attr('height', d => d.look.topMargin).attr('href', d => d.look.backgroundImageTopLeft);
5932
+ selection.filter('.stretchable-image-look').select('image.top-image').attr('x', d => d.look.leftMargin).attr('y', 0).attr('width', d => d.width - d.look.rightMargin - d.look.leftMargin).attr('height', d => d.look.topMargin).attr('href', d => d.look.backgroundImageTop);
5933
+ selection.filter('.stretchable-image-look').select('image.top-right-image').attr('x', d => d.width - d.look.rightMargin).attr('y', 0).attr('width', d => d.look.rightMargin).attr('height', d => d.look.topMargin).attr('href', d => d.look.backgroundImageTopRight);
5934
+ selection.filter('.stretchable-image-look').select('image.left-image').attr('x', 0).attr('y', d => d.look.topMargin).attr('width', d => d.look.leftMargin).attr('height', d => d.height - d.look.bottomMargin - d.look.topMargin).attr('href', d => d.look.backgroundImageLeft);
5935
+ selection.filter('.stretchable-image-look').select('image.center-image').attr('x', d => d.look.leftMargin).attr('y', d => d.look.topMargin).attr('width', d => d.width - d.look.rightMargin - d.look.leftMargin).attr('height', d => d.height - d.look.bottomMargin - d.look.topMargin).attr('href', d => d.look.backgroundImageCenter);
5936
+ selection.filter('.stretchable-image-look').select('image.right-image').attr('x', d => d.width - d.look.rightMargin).attr('y', d => d.look.topMargin).attr('width', d => d.look.rightMargin).attr('height', d => d.height - d.look.bottomMargin - d.look.topMargin).attr('href', d => d.look.backgroundImageRight);
5937
+ selection.filter('.stretchable-image-look').select('image.bottom-left-image').attr('x', 0).attr('y', d => d.height - d.look.bottomMargin).attr('width', d => d.look.leftMargin).attr('height', d => d.look.bottomMargin).attr('href', d => d.look.backgroundImageBottomLeft);
5938
+ selection.filter('.stretchable-image-look').select('image.bottom-image').attr('x', d => d.look.leftMargin).attr('y', d => d.height - d.look.bottomMargin).attr('width', d => d.width - d.look.rightMargin - d.look.leftMargin).attr('height', d => d.look.bottomMargin).attr('href', d => d.look.backgroundImageBottom);
5939
+ 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);
5940
+ };
5941
+
5386
5942
  const CONTEXT_MENU_MENU_RADIUS = 96;
5387
5943
  const CONTEXT_MENU_BUTTON_RADIUS = 32;
5388
5944
  const CONTEXT_MENU_TOTAL_RADIUS = CONTEXT_MENU_MENU_RADIUS + CONTEXT_MENU_BUTTON_RADIUS;
@@ -5977,7 +6533,7 @@ class DiagramUserSelection extends DiagramElementSet {
5977
6533
  }
5978
6534
  }
5979
6535
  makeUpdateValuesAction() {
5980
- var _a, _b;
6536
+ var _a, _b, _c;
5981
6537
  if (this.propertyEditorSelection === undefined || this.propertyEditorValues === undefined) {
5982
6538
  return;
5983
6539
  }
@@ -5989,7 +6545,7 @@ class DiagramUserSelection extends DiagramElementSet {
5989
6545
  }
5990
6546
  const from = this.propertyEditorValues;
5991
6547
  const to = structuredClone((_b = this.propertyEditorSelection) === null || _b === undefined ? undefined : _b.valueSet.getValues());
5992
- const [fromDiff, toDiff] = diff(from, to);
6548
+ const [fromDiff, toDiff] = diffProperties(from, to, (_c = this.propertyEditorSelection) === null || _c === undefined ? undefined : _c.valueSet);
5993
6549
  const currentAction = new UpdateValuesAction(this.canvas, previousSelectionId, fromDiff, toDiff);
5994
6550
  currentAction.do();
5995
6551
  this.canvas.actionStack.add(currentAction);
@@ -6412,7 +6968,7 @@ class DiagramCanvas {
6412
6968
  updateNodesInView(...ids) {
6413
6969
  let updateSelection = this.selectCanvasElements().selectAll('g.diagram-node').data(this.model.nodes.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true), d => d.id);
6414
6970
  const exitSelection = updateSelection.exit();
6415
- const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', d => `diagram-node${d.type.resizableX ? ' resizable-x' : ''}${d.type.resizableY ? ' resizable-y' : ''} ${d.type.look.lookType}`);
6971
+ const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', d => `diagram-node${d.type.resizableX ? ' resizable-x' : ''}${d.type.resizableY ? ' resizable-y' : ''} ${d.type.defaultLook.lookType}`);
6416
6972
  if (ids && ids.length > 0) {
6417
6973
  updateSelection = updateSelection.filter(d => ids.includes(d.id));
6418
6974
  }
@@ -6474,17 +7030,7 @@ class DiagramCanvas {
6474
7030
  }
6475
7031
  this.secondaryButton = false;
6476
7032
  }));
6477
- enterSelection.filter('.shaped-look').append('path');
6478
- enterSelection.filter('.image-look').append('image').attr('preserveAspectRatio', 'none');
6479
- enterSelection.filter('.stretchable-image-look').append('image').attr('class', 'top-left-image').attr('preserveAspectRatio', 'none');
6480
- enterSelection.filter('.stretchable-image-look').append('image').attr('class', 'top-image').attr('preserveAspectRatio', 'none');
6481
- enterSelection.filter('.stretchable-image-look').append('image').attr('class', 'top-right-image').attr('preserveAspectRatio', 'none');
6482
- enterSelection.filter('.stretchable-image-look').append('image').attr('class', 'left-image').attr('preserveAspectRatio', 'none');
6483
- enterSelection.filter('.stretchable-image-look').append('image').attr('class', 'center-image').attr('preserveAspectRatio', 'none');
6484
- enterSelection.filter('.stretchable-image-look').append('image').attr('class', 'right-image').attr('preserveAspectRatio', 'none');
6485
- enterSelection.filter('.stretchable-image-look').append('image').attr('class', 'bottom-left-image').attr('preserveAspectRatio', 'none');
6486
- enterSelection.filter('.stretchable-image-look').append('image').attr('class', 'bottom-image').attr('preserveAspectRatio', 'none');
6487
- enterSelection.filter('.stretchable-image-look').append('image').attr('class', 'bottom-right-image').attr('preserveAspectRatio', 'none');
7033
+ initializeLook(enterSelection);
6488
7034
  enterSelection.filter('.resizable-x').append('line').attr('class', 'left-resizer').attr('stroke', 'transparent').attr('stroke-width', `${RESIZER_THICKNESS}px`).on(exports.Events.MouseOver, (_event, d) => {
6489
7035
  if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.type.resizableX && !d.removed) {
6490
7036
  setCursorStyle(exports.CursorStyle.EWResize);
@@ -6622,17 +7168,7 @@ class DiagramCanvas {
6622
7168
  setCursorStyle();
6623
7169
  }));
6624
7170
  mergeSelection.attr('transform', d => `translate(${d.coords[0]},${d.coords[1]})`).attr('opacity', d => d.removed ? 0.5 : 1);
6625
- mergeSelection.filter('.shaped-look').select('path').attr('d', d => generalClosedPath(d.type.look.shape, 0, 0, d.width, d.height)).attr('fill', d => d.selected ? d.type.look.selectedFillColor : d.type.look.fillColor).attr('stroke', d => d.selected ? d.type.look.selectedBorderColor : d.type.look.borderColor).attr('stroke-width', d => `${d.highlighted ? 3 : 1}px`);
6626
- mergeSelection.filter('.image-look').select('image').attr('x', 0).attr('y', 0).attr('width', d => d.width).attr('height', d => d.height).attr('href', d => d.selected ? d.type.look.selectedBackgroundImage : d.type.look.backgroundImage);
6627
- mergeSelection.filter('.stretchable-image-look').select('image.top-left-image').attr('x', 0).attr('y', 0).attr('width', d => d.type.look.leftMargin).attr('height', d => d.type.look.topMargin).attr('href', d => d.selected ? d.type.look.selectedBackgroundImageTopLeft : d.type.look.backgroundImageTopLeft);
6628
- mergeSelection.filter('.stretchable-image-look').select('image.top-image').attr('x', d => d.type.look.leftMargin).attr('y', 0).attr('width', d => d.width - d.type.look.rightMargin - d.type.look.leftMargin).attr('height', d => d.type.look.topMargin).attr('href', d => d.selected ? d.type.look.selectedBackgroundImageTop : d.type.look.backgroundImageTop);
6629
- mergeSelection.filter('.stretchable-image-look').select('image.top-right-image').attr('x', d => d.width - d.type.look.rightMargin).attr('y', 0).attr('width', d => d.type.look.rightMargin).attr('height', d => d.type.look.topMargin).attr('href', d => d.selected ? d.type.look.selectedBackgroundImageTopRight : d.type.look.backgroundImageTopRight);
6630
- mergeSelection.filter('.stretchable-image-look').select('image.left-image').attr('x', 0).attr('y', d => d.type.look.topMargin).attr('width', d => d.type.look.leftMargin).attr('height', d => d.height - d.type.look.bottomMargin - d.type.look.topMargin).attr('href', d => d.selected ? d.type.look.selectedBackgroundImageLeft : d.type.look.backgroundImageLeft);
6631
- mergeSelection.filter('.stretchable-image-look').select('image.center-image').attr('x', d => d.type.look.leftMargin).attr('y', d => d.type.look.topMargin).attr('width', d => d.width - d.type.look.rightMargin - d.type.look.leftMargin).attr('height', d => d.height - d.type.look.bottomMargin - d.type.look.topMargin).attr('href', d => d.selected ? d.type.look.selectedBackgroundImageCenter : d.type.look.backgroundImageCenter);
6632
- mergeSelection.filter('.stretchable-image-look').select('image.right-image').attr('x', d => d.width - d.type.look.rightMargin).attr('y', d => d.type.look.topMargin).attr('width', d => d.type.look.rightMargin).attr('height', d => d.height - d.type.look.bottomMargin - d.type.look.topMargin).attr('href', d => d.selected ? d.type.look.selectedBackgroundImageRight : d.type.look.backgroundImageRight);
6633
- mergeSelection.filter('.stretchable-image-look').select('image.bottom-left-image').attr('x', 0).attr('y', d => d.height - d.type.look.bottomMargin).attr('width', d => d.type.look.leftMargin).attr('height', d => d.type.look.bottomMargin).attr('href', d => d.selected ? d.type.look.selectedBackgroundImageBottomLeft : d.type.look.backgroundImageBottomLeft);
6634
- mergeSelection.filter('.stretchable-image-look').select('image.bottom-image').attr('x', d => d.type.look.leftMargin).attr('y', d => d.height - d.type.look.bottomMargin).attr('width', d => d.width - d.type.look.rightMargin - d.type.look.leftMargin).attr('height', d => d.type.look.bottomMargin).attr('href', d => d.selected ? d.type.look.selectedBackgroundImageBottom : d.type.look.backgroundImageBottom);
6635
- mergeSelection.filter('.stretchable-image-look').select('image.bottom-right-image').attr('x', d => d.width - d.type.look.rightMargin).attr('y', d => d.height - d.type.look.bottomMargin).attr('width', d => d.type.look.rightMargin).attr('height', d => d.type.look.bottomMargin).attr('href', d => d.selected ? d.type.look.selectedBackgroundImageBottomRight : d.type.look.backgroundImageBottomRight);
7171
+ updateLook(mergeSelection);
6636
7172
  mergeSelection.filter('.resizable-x').select('line.left-resizer').attr('x1', RESIZER_THICKNESS / 2).attr('x2', RESIZER_THICKNESS / 2).attr('y1', 0).attr('y2', d => d.height);
6637
7173
  mergeSelection.filter('.resizable-y').select('line.top-resizer').attr('x1', 0).attr('x2', d => d.width).attr('y1', RESIZER_THICKNESS / 2).attr('y2', RESIZER_THICKNESS / 2);
6638
7174
  mergeSelection.filter('.resizable-x').select('line.right-resizer').attr('x1', d => d.width - RESIZER_THICKNESS / 2).attr('x2', d => d.width - RESIZER_THICKNESS / 2).attr('y1', 0).attr('y2', d => d.height);
@@ -6642,8 +7178,8 @@ class DiagramCanvas {
6642
7178
  let updateSelection = this.selectCanvasElements().selectAll('g.diagram-section').data(this.model.sections.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true), d => d.id);
6643
7179
  const exitSelection = updateSelection.exit();
6644
7180
  const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', d => {
6645
- var _a, _b, _c, _d, _e, _f;
6646
- 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' : ''} ${(_f = (_e = d.getConfig()) === null || _e === undefined ? undefined : _e.look) === null || _f === undefined ? undefined : _f.lookType}`;
7181
+ var _a, _b, _c, _d, _e;
7182
+ 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}`;
6647
7183
  });
6648
7184
  if (ids && ids.length > 0) {
6649
7185
  updateSelection = updateSelection.filter(d => ids.includes(d.id));
@@ -6723,17 +7259,7 @@ class DiagramCanvas {
6723
7259
  }
6724
7260
  this.secondaryButton = false;
6725
7261
  }));
6726
- enterSelection.filter('.shaped-look').append('path');
6727
- enterSelection.filter('.image-look').append('image').attr('preserveAspectRatio', 'none');
6728
- enterSelection.filter('.stretchable-image-look').append('image').attr('class', 'top-left-image').attr('preserveAspectRatio', 'none');
6729
- enterSelection.filter('.stretchable-image-look').append('image').attr('class', 'top-image').attr('preserveAspectRatio', 'none');
6730
- enterSelection.filter('.stretchable-image-look').append('image').attr('class', 'top-right-image').attr('preserveAspectRatio', 'none');
6731
- enterSelection.filter('.stretchable-image-look').append('image').attr('class', 'left-image').attr('preserveAspectRatio', 'none');
6732
- enterSelection.filter('.stretchable-image-look').append('image').attr('class', 'center-image').attr('preserveAspectRatio', 'none');
6733
- enterSelection.filter('.stretchable-image-look').append('image').attr('class', 'right-image').attr('preserveAspectRatio', 'none');
6734
- enterSelection.filter('.stretchable-image-look').append('image').attr('class', 'bottom-left-image').attr('preserveAspectRatio', 'none');
6735
- enterSelection.filter('.stretchable-image-look').append('image').attr('class', 'bottom-image').attr('preserveAspectRatio', 'none');
6736
- enterSelection.filter('.stretchable-image-look').append('image').attr('class', 'bottom-right-image').attr('preserveAspectRatio', 'none');
7262
+ initializeLook(enterSelection);
6737
7263
  enterSelection.filter('.resizable-x').append('line').attr('class', 'left-resizer').attr('stroke', 'transparent').attr('stroke-width', `${RESIZER_THICKNESS}px`).on(exports.Events.MouseOver, (_event, d) => {
6738
7264
  var _a, _b;
6739
7265
  if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableX) && !d.removed) {
@@ -6891,146 +7417,7 @@ class DiagramCanvas {
6891
7417
  setCursorStyle();
6892
7418
  }));
6893
7419
  mergeSelection.attr('transform', d => `translate(${d.coords[0]},${d.coords[1]})`).attr('opacity', d => d.removed ? 0.5 : 1);
6894
- mergeSelection.filter('.shaped-look').select('path').attr('d', d => {
6895
- var _a;
6896
- return generalClosedPath(((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).shape, 0, 0, d.width, d.height);
6897
- }).attr('fill', d => {
6898
- var _a, _b;
6899
- return d.selected ? ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).selectedFillColor : ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).fillColor;
6900
- }).attr('stroke', d => {
6901
- var _a, _b;
6902
- return d.selected ? ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).selectedBorderColor : ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).borderColor;
6903
- }).attr('stroke-width', d => `${d.highlighted ? 3 : 1}px`);
6904
- mergeSelection.filter('.image-look').select('image').attr('x', 0).attr('y', 0).attr('width', d => d.width).attr('height', d => d.height).attr('href', d => {
6905
- var _a, _b;
6906
- return d.selected ? ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).selectedBackgroundImage : ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).backgroundImage;
6907
- });
6908
- mergeSelection.filter('.stretchable-image-look').select('image.top-left-image').attr('x', 0).attr('y', 0).attr('width', d => {
6909
- var _a;
6910
- return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).leftMargin;
6911
- }).attr('height', d => {
6912
- var _a;
6913
- return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).topMargin;
6914
- }).attr('href', d => {
6915
- var _a, _b;
6916
- return d.selected ? ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).selectedBackgroundImageTopLeft : ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).backgroundImageTopLeft;
6917
- });
6918
- mergeSelection.filter('.stretchable-image-look').select('image.top-image').attr('x', d => {
6919
- var _a;
6920
- return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).leftMargin;
6921
- }).attr('y', 0).attr('width', d => {
6922
- var _a, _b;
6923
- return d.width - ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).rightMargin - ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).leftMargin;
6924
- }).attr('height', d => {
6925
- var _a;
6926
- return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).topMargin;
6927
- }).attr('href', d => {
6928
- var _a, _b;
6929
- return d.selected ? ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).selectedBackgroundImageTop : ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).backgroundImageTop;
6930
- });
6931
- mergeSelection.filter('.stretchable-image-look').select('image.top-right-image').attr('x', d => {
6932
- var _a;
6933
- return d.width - ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).rightMargin;
6934
- }).attr('y', 0).attr('width', d => {
6935
- var _a;
6936
- return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).rightMargin;
6937
- }).attr('height', d => {
6938
- var _a;
6939
- return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).topMargin;
6940
- }).attr('href', d => {
6941
- var _a, _b;
6942
- return d.selected ? ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).selectedBackgroundImageTopRight : ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).backgroundImageTopRight;
6943
- });
6944
- mergeSelection.filter('.stretchable-image-look').select('image.left-image').attr('x', 0).attr('y', d => {
6945
- var _a;
6946
- return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).topMargin;
6947
- }).attr('width', d => {
6948
- var _a;
6949
- return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).leftMargin;
6950
- }).attr('height', d => {
6951
- var _a, _b;
6952
- return d.height - ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).bottomMargin - ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).topMargin;
6953
- }).attr('href', d => {
6954
- var _a, _b;
6955
- return d.selected ? ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).selectedBackgroundImageLeft : ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).backgroundImageLeft;
6956
- });
6957
- mergeSelection.filter('.stretchable-image-look').select('image.center-image').attr('x', d => {
6958
- var _a;
6959
- return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).leftMargin;
6960
- }).attr('y', d => {
6961
- var _a;
6962
- return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).topMargin;
6963
- }).attr('width', d => {
6964
- var _a, _b;
6965
- return d.width - ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).rightMargin - ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).leftMargin;
6966
- }).attr('height', d => {
6967
- var _a, _b;
6968
- return d.height - ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).bottomMargin - ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).topMargin;
6969
- }).attr('href', d => {
6970
- var _a, _b;
6971
- return d.selected ? ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).selectedBackgroundImageCenter : ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).backgroundImageCenter;
6972
- });
6973
- mergeSelection.filter('.stretchable-image-look').select('image.right-image').attr('x', d => {
6974
- var _a;
6975
- return d.width - ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).rightMargin;
6976
- }).attr('y', d => {
6977
- var _a;
6978
- return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).topMargin;
6979
- }).attr('width', d => {
6980
- var _a;
6981
- return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).rightMargin;
6982
- }).attr('height', d => {
6983
- var _a, _b;
6984
- return d.height - ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).bottomMargin - ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).topMargin;
6985
- }).attr('href', d => {
6986
- var _a, _b;
6987
- return d.selected ? ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).selectedBackgroundImageRight : ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).backgroundImageRight;
6988
- });
6989
- mergeSelection.filter('.stretchable-image-look').select('image.bottom-left-image').attr('x', 0).attr('y', d => {
6990
- var _a;
6991
- return d.height - ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).bottomMargin;
6992
- }).attr('width', d => {
6993
- var _a;
6994
- return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).leftMargin;
6995
- }).attr('height', d => {
6996
- var _a;
6997
- return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).bottomMargin;
6998
- }).attr('href', d => {
6999
- var _a, _b;
7000
- return d.selected ? ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).selectedBackgroundImageBottomLeft : ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).backgroundImageBottomLeft;
7001
- });
7002
- mergeSelection.filter('.stretchable-image-look').select('image.bottom-image').attr('x', d => {
7003
- var _a;
7004
- return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).leftMargin;
7005
- }).attr('y', d => {
7006
- var _a;
7007
- return d.height - ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).bottomMargin;
7008
- }).attr('width', d => {
7009
- var _a, _b;
7010
- return d.width - ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).rightMargin - ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).leftMargin;
7011
- }).attr('height', d => {
7012
- var _a;
7013
- return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).bottomMargin;
7014
- }).attr('href', d => {
7015
- var _a, _b;
7016
- return d.selected ? ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).selectedBackgroundImageBottom : ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).backgroundImageBottom;
7017
- });
7018
- mergeSelection.filter('.stretchable-image-look').select('image.bottom-right-image').attr('x', d => {
7019
- var _a;
7020
- return d.width - ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).rightMargin;
7021
- }).attr('y', d => {
7022
- var _a;
7023
- return d.height - ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).bottomMargin;
7024
- }).attr('width', d => {
7025
- var _a;
7026
- return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).rightMargin;
7027
- }).attr('height', d => {
7028
- var _a;
7029
- return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).bottomMargin;
7030
- }).attr('href', d => {
7031
- var _a, _b;
7032
- return d.selected ? ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).selectedBackgroundImageBottomRight : ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).backgroundImageBottomRight;
7033
- });
7420
+ updateLook(mergeSelection);
7034
7421
  mergeSelection.filter('.resizable-x').select('line.left-resizer').attr('x1', RESIZER_THICKNESS / 2).attr('x2', RESIZER_THICKNESS / 2).attr('y1', 0).attr('y2', d => d.height);
7035
7422
  mergeSelection.filter('.resizable-y').select('line.top-resizer').attr('x1', 0).attr('x2', d => d.width).attr('y1', RESIZER_THICKNESS / 2).attr('y2', RESIZER_THICKNESS / 2);
7036
7423
  mergeSelection.filter('.resizable-x').select('line.right-resizer').attr('x1', d => d.width - RESIZER_THICKNESS / 2).attr('x2', d => d.width - RESIZER_THICKNESS / 2).attr('y1', 0).attr('y2', d => d.height);
@@ -7039,10 +7426,7 @@ class DiagramCanvas {
7039
7426
  updatePortsInView(...ids) {
7040
7427
  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);
7041
7428
  const exitSelection = updateSelection.exit();
7042
- const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', d => {
7043
- var _a, _b;
7044
- return `diagram-port ${((_b = (_a = d.type) === null || _a === undefined ? undefined : _a.look) === null || _b === undefined ? undefined : _b.lookType) || 'default'}`;
7045
- });
7429
+ const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', d => `diagram-port ${d.look.lookType}`);
7046
7430
  if (ids && ids.length > 0) {
7047
7431
  updateSelection = updateSelection.filter(d => ids.includes(d.id));
7048
7432
  }
@@ -7129,7 +7513,7 @@ class DiagramCanvas {
7129
7513
  if (this.canUserPerformAction(exports.DiagramActions.AddConnection) && !d.removed) {
7130
7514
  if (this.unfinishedConnection !== undefined) {
7131
7515
  const endCoords = [event.x, event.y];
7132
- (_a = this.unfinishedConnectionTracer) === null || _a === undefined ? undefined : _a.attr('d', getConnectionPath(this.unfinishedConnection.type.shape, this.unfinishedConnection.startCoords, endCoords, this.unfinishedConnection.startDirection, this.unfinishedConnection.endDirection, this.unfinishedConnection.type.width, (_b = this.unfinishedConnection.startMarkerLook) === null || _b === undefined ? undefined : _b.markerWidth, (_c = this.unfinishedConnection.endMarkerLook) === null || _c === undefined ? undefined : _c.markerWidth));
7516
+ (_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));
7133
7517
  const unfinishedConnectionGhostNode = (_d = this.unfinishedConnectionTracer) === null || _d === undefined ? undefined : _d.node();
7134
7518
  if (unfinishedConnectionGhostNode) {
7135
7519
  let margin = 2;
@@ -7201,14 +7585,10 @@ class DiagramCanvas {
7201
7585
  }
7202
7586
  this.secondaryButton = false;
7203
7587
  }));
7204
- enterSelection.filter('.default').append('circle');
7205
7588
  enterSelection.filter('.image-look').append('image');
7206
- mergeSelection.attr('transform', d => `translate(${d.coords[0]},${d.coords[1]})`).attr('opacity', d => d.removed ? 0.5 : 1);
7207
- 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);
7208
- 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 => {
7209
- var _a, _b;
7210
- return d.selected ? ((_a = d.type) === null || _a === undefined ? undefined : _a.look).selectedBackgroundImage : ((_b = d.type) === null || _b === undefined ? undefined : _b.look).backgroundImage;
7211
- });
7589
+ initializeLook(enterSelection);
7590
+ mergeSelection.attr('transform', d => `translate(${d.coords[0] - d.width / 2},${d.coords[1] - d.width / 2})`).attr('opacity', d => d.removed ? 0.5 : 1);
7591
+ updateLook(mergeSelection);
7212
7592
  }
7213
7593
  updateConnectionsInView(...ids) {
7214
7594
  const connectionList = this.model.connections.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true);
@@ -7281,14 +7661,14 @@ class DiagramCanvas {
7281
7661
  enterSelection.select('g.diagram-connection-end-label').append('text').style('user-select', 'none');
7282
7662
  mergeSelection.attr('opacity', d => d.removed ? 0.5 : 1).select('path.diagram-connection-path').attr('d', d => {
7283
7663
  var _a, _b;
7284
- return getConnectionPath(d.type.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.type.width, (_a = d.startMarkerLook) === null || _a === undefined ? undefined : _a.markerWidth, (_b = d.endMarkerLook) === null || _b === undefined ? undefined : _b.markerWidth);
7285
- }).attr('marker-start', d => `url(#${d.id}-start-marker)`).attr('marker-end', d => `url(#${d.id}-end-marker)`).attr('stroke', d => d.selected ? d.type.selectedColor : d.type.color).attr('stroke-width', d => `${d.highlighted ? d.type.width + 1 : d.type.width}px`).attr('stroke-dasharray', d => lineStyleDasharray(d.type.style, d.type.width)).attr('fill', 'none');
7664
+ 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);
7665
+ }).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');
7286
7666
  mergeSelection.select('path.diagram-connection-path-box').attr('d', d => {
7287
7667
  var _a, _b;
7288
- return getConnectionPath(d.type.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.type.width, (_a = d.startMarkerLook) === null || _a === undefined ? undefined : _a.markerWidth, (_b = d.endMarkerLook) === null || _b === undefined ? undefined : _b.markerWidth);
7668
+ 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);
7289
7669
  }).attr('stroke', 'transparent')
7290
7670
  // allow generating pointer events even when it is transparent
7291
- .attr('pointer-events', 'stroke').attr('stroke-width', d => `${d.type.width + CONNECTION_PATH_BOX_THICKNESS}px`).attr('stroke-dasharray', d => lineStyleDasharray(d.type.style, d.type.width)).attr('fill', 'none');
7671
+ .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');
7292
7672
  mergeSelection.data().forEach(connection => {
7293
7673
  this.updateConnectionLabelsInView(connection);
7294
7674
  this.updateConnectionMarkersInView(connection);
@@ -7497,7 +7877,7 @@ class DiagramCanvas {
7497
7877
  const boundingWidth = !connection.startLabel ? 0 : startLabelBoundingRect.width / this.zoomTransform.k + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
7498
7878
  const boundingHeight = !connection.startLabel ? 0 : startLabelBoundingRect.height / this.zoomTransform.k + getTopPadding$1(labelConfiguration) + getBottomPadding$1(labelConfiguration);
7499
7879
  const pathStartLabelPoint = pathNode.getPointAtLength(Math.max(getLeftMargin(labelConfiguration) + boundingWidth / 2, getRightMargin(labelConfiguration) + boundingWidth / 2, getTopMargin(labelConfiguration) + boundingHeight / 2, getBottomMargin(labelConfiguration) + boundingHeight / 2));
7500
- connectionSelection.select('g.diagram-connection-start-label path').attr('d', pillPath(-boundingWidth / 2, -boundingHeight / 2, boundingWidth, boundingHeight)).attr('fill', connection.selected ? connection.type.selectedColor : connection.type.color).attr('stroke', 'none');
7880
+ connectionSelection.select('g.diagram-connection-start-label path').attr('d', pillPath(-boundingWidth / 2, -boundingHeight / 2, boundingWidth, boundingHeight)).attr('fill', connection.look.color).attr('stroke', 'none');
7501
7881
  connectionSelection.select('g.diagram-connection-start-label').attr('transform', `translate(${pathStartLabelPoint.x},${pathStartLabelPoint.y})`);
7502
7882
  }
7503
7883
  // bind middle labels
@@ -7508,7 +7888,7 @@ class DiagramCanvas {
7508
7888
  const boundingWidth = !connection.middleLabel ? 0 : middleLabelBoundingRect.width / this.zoomTransform.k + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
7509
7889
  const boundingHeight = !connection.middleLabel ? 0 : middleLabelBoundingRect.height / this.zoomTransform.k + getTopPadding$1(labelConfiguration) + getBottomPadding$1(labelConfiguration);
7510
7890
  const pathMiddleLabelPoint = pathNode.getPointAtLength(pathLength / 2);
7511
- connectionSelection.select('g.diagram-connection-middle-label path').attr('d', pillPath(-boundingWidth / 2, -boundingHeight / 2, boundingWidth, boundingHeight)).attr('fill', connection.selected ? connection.type.selectedColor : connection.type.color).attr('stroke', 'none');
7891
+ connectionSelection.select('g.diagram-connection-middle-label path').attr('d', pillPath(-boundingWidth / 2, -boundingHeight / 2, boundingWidth, boundingHeight)).attr('fill', connection.look.color).attr('stroke', 'none');
7512
7892
  connectionSelection.select('g.diagram-connection-middle-label').attr('transform', `translate(${pathMiddleLabelPoint.x},${pathMiddleLabelPoint.y})`);
7513
7893
  }
7514
7894
  // bind end labels
@@ -7519,7 +7899,7 @@ class DiagramCanvas {
7519
7899
  const boundingWidth = !connection.endLabel ? 0 : endLabelBoundingRect.width / this.zoomTransform.k + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
7520
7900
  const boundingHeight = !connection.endLabel ? 0 : endLabelBoundingRect.height / this.zoomTransform.k + getTopPadding$1(labelConfiguration) + getBottomPadding$1(labelConfiguration);
7521
7901
  const pathEndLabelPoint = pathNode.getPointAtLength(pathLength - Math.max(getLeftMargin(labelConfiguration) + boundingWidth / 2, getRightMargin(labelConfiguration) + boundingWidth / 2, getTopMargin(labelConfiguration) + boundingHeight / 2, getBottomMargin(labelConfiguration) + boundingHeight / 2));
7522
- connectionSelection.select('g.diagram-connection-end-label path').attr('d', pillPath(-boundingWidth / 2, -boundingHeight / 2, boundingWidth, boundingHeight)).attr('fill', connection.selected ? connection.type.selectedColor : connection.type.color).attr('stroke', 'none');
7902
+ connectionSelection.select('g.diagram-connection-end-label path').attr('d', pillPath(-boundingWidth / 2, -boundingHeight / 2, boundingWidth, boundingHeight)).attr('fill', connection.look.color).attr('stroke', 'none');
7523
7903
  connectionSelection.select('g.diagram-connection-end-label').attr('transform', `translate(${pathEndLabelPoint.x},${pathEndLabelPoint.y})`);
7524
7904
  }
7525
7905
  }
@@ -7529,18 +7909,18 @@ class DiagramCanvas {
7529
7909
  const startMarkerSelection = connectionSelection.select('marker.diagram-connection-start-marker');
7530
7910
  const endMarkerSelection = connectionSelection.select('marker.diagram-connection-end-marker');
7531
7911
  if (connection.startMarkerLook !== null) {
7532
- startMarkerSelection.attr('orient', 'auto-start-reverse').attr('markerWidth', connection.startMarkerLook.markerWidth).attr('markerHeight', connection.startMarkerLook.markerHeight).attr('refX', connection.startMarkerLook.markerRefX).attr('refY', connection.startMarkerLook.markerRefY).select('image').attr('href', connection.selected ? connection.startMarkerLook.selectedImage : connection.startMarkerLook.image).attr('width', connection.startMarkerLook.markerWidth).attr('height', connection.startMarkerLook.markerHeight);
7912
+ startMarkerSelection.attr('orient', 'auto-start-reverse').attr('markerWidth', connection.startMarkerLook.width).attr('markerHeight', connection.startMarkerLook.height).attr('refX', connection.startMarkerLook.refX).attr('refY', connection.startMarkerLook.refY).select('image').attr('href', connection.startMarkerLook.image).attr('width', connection.startMarkerLook.width).attr('height', connection.startMarkerLook.height);
7533
7913
  } else {
7534
7914
  startMarkerSelection.attr('orient', 'auto-start-reverse').attr('markerWidth', 0).attr('markerHeight', 0);
7535
7915
  }
7536
7916
  if (connection.endMarkerLook !== null) {
7537
- endMarkerSelection.attr('orient', 'auto-start-reverse').attr('markerWidth', connection.endMarkerLook.markerWidth).attr('markerHeight', connection.endMarkerLook.markerHeight).attr('refX', connection.endMarkerLook.markerRefX).attr('refY', connection.endMarkerLook.markerRefY).select('image').attr('href', connection.selected ? connection.endMarkerLook.selectedImage : connection.endMarkerLook.image).attr('width', connection.endMarkerLook.markerWidth).attr('height', connection.endMarkerLook.markerHeight);
7917
+ endMarkerSelection.attr('orient', 'auto-start-reverse').attr('markerWidth', connection.endMarkerLook.width).attr('markerHeight', connection.endMarkerLook.height).attr('refX', connection.endMarkerLook.refX).attr('refY', connection.endMarkerLook.refY).select('image').attr('href', connection.endMarkerLook.image).attr('width', connection.endMarkerLook.width).attr('height', connection.endMarkerLook.height);
7538
7918
  } else {
7539
7919
  endMarkerSelection.attr('orient', 'auto-start-reverse').attr('markerWidth', 0).attr('markerHeight', 0);
7540
7920
  }
7541
7921
  }
7542
7922
  fitFieldRootInView(id) {
7543
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
7923
+ var _a, _b, _c;
7544
7924
  const field = this.model.fields.get(id);
7545
7925
  if (!field) {
7546
7926
  return;
@@ -7582,8 +7962,9 @@ class DiagramCanvas {
7582
7962
  if (fieldDimensions[1] < minimumFieldHeight) {
7583
7963
  fieldDimensions[1] = minimumFieldHeight;
7584
7964
  }
7585
- let stretchX = fieldDimensions[0] + getLeftMargin((_c = (_b = field.rootElement) === null || _b === undefined ? undefined : _b.getConfig()) === null || _c === undefined ? undefined : _c.label) + getRightMargin((_e = (_d = field.rootElement) === null || _d === undefined ? undefined : _d.getConfig()) === null || _e === undefined ? undefined : _e.label) - field.rootElement.width;
7586
- let stretchY = fieldDimensions[1] + getTopMargin((_g = (_f = field.rootElement) === null || _f === undefined ? undefined : _f.getConfig()) === null || _g === undefined ? undefined : _g.label) + getBottomMargin((_j = (_h = field.rootElement) === null || _h === undefined ? undefined : _h.getConfig()) === null || _j === undefined ? undefined : _j.label) - field.rootElement.height;
7965
+ const type = field.rootElement.type;
7966
+ let stretchX = fieldDimensions[0] + getLeftMargin(type === null || type === undefined ? undefined : type.label) + getRightMargin(type === null || type === undefined ? undefined : type.label) - field.rootElement.width;
7967
+ let stretchY = fieldDimensions[1] + getTopMargin(type === null || type === undefined ? undefined : type.label) + getBottomMargin(type === null || type === undefined ? undefined : type.label) - field.rootElement.height;
7587
7968
  if (this.snapToGrid) {
7588
7969
  stretchX = Math.ceil(stretchX / this.gridSize) * this.gridSize;
7589
7970
  stretchY = Math.ceil(stretchY / this.gridSize) * this.gridSize;
@@ -7595,8 +7976,8 @@ class DiagramCanvas {
7595
7976
  if (field.rootElement.height + stretchY < (field.rootElement.getMinHeight() || 0)) {
7596
7977
  stretchY = (field.rootElement.getMinHeight() || 0) - field.rootElement.height;
7597
7978
  }
7598
- (_k = field.rootElement.node) === null || _k === undefined ? undefined : _k.stretchSections(exports.Side.Right, stretchX, field.rootElement.indexXInNode, field.rootElement.indexYInNode);
7599
- (_l = field.rootElement.node) === null || _l === undefined ? undefined : _l.stretchSections(exports.Side.Bottom, stretchY, field.rootElement.indexXInNode, field.rootElement.indexYInNode);
7979
+ (_b = field.rootElement.node) === null || _b === undefined ? undefined : _b.stretchSections(exports.Side.Right, stretchX, field.rootElement.indexXInNode, field.rootElement.indexYInNode);
7980
+ (_c = field.rootElement.node) === null || _c === undefined ? undefined : _c.stretchSections(exports.Side.Bottom, stretchY, field.rootElement.indexXInNode, field.rootElement.indexYInNode);
7600
7981
  }
7601
7982
  }
7602
7983
  fitNodeInView(id) {
@@ -7927,41 +8308,6 @@ class DiagramCanvas {
7927
8308
  }
7928
8309
  }
7929
8310
  DiagramCanvas.canvasCount = 0;
7930
- /**
7931
- * Checks if the given mouse event was produced with a secondary button press.
7932
- * @private
7933
- * @param event A mouse event.
7934
- * @returns `true` if the given mouse event was produced with a secondary button press, `false` otherwise.
7935
- */
7936
- const isSecondaryButton = event => {
7937
- return !!event.button;
7938
- };
7939
- /**
7940
- * Get the SVG path of a diagram connection.
7941
- * @private
7942
- * @see linePath
7943
- */
7944
- const getConnectionPath = (shape, startCoords, endCoords, startDirection, endDirection, width, startMarkerWidth, endMarkerWidth) => {
7945
- return linePath(shape, [startCoords, endCoords], startDirection, endDirection, Math.max(
7946
- // reasonable value for the minimumDistanceBeforeTurn relative to the line width
7947
- 10, startMarkerWidth || 0, endMarkerWidth || 0) * width);
7948
- };
7949
- const setCursorStyle = style => {
7950
- if (!style) {
7951
- d3__namespace.select('body').style('cursor', exports.CursorStyle.Auto);
7952
- } else {
7953
- d3__namespace.select('body').style('cursor', style);
7954
- }
7955
- };
7956
- const getRelatedNodeOrItself = element => {
7957
- if (element instanceof DiagramNode) {
7958
- return element;
7959
- }
7960
- if (element instanceof DiagramSection) {
7961
- return element.node || element;
7962
- }
7963
- return element.rootElement instanceof DiagramNode || element.rootElement instanceof DiagramSection || element.rootElement instanceof DiagramPort ? getRelatedNodeOrItself(element.rootElement) : element;
7964
- };
7965
8311
 
7966
8312
  const VERSION = '0.0.1';
7967
8313
  /**