@metadev/daga 4.2.8 → 4.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Changelog.md CHANGED
@@ -6,6 +6,16 @@ List of releases and changes.
6
6
 
7
7
  ## Next release Joyeuse
8
8
 
9
+ ## v. 4.2.10
10
+
11
+ - Fix errors with cloned objects containing functions [#345](https://github.com/metadevpro/daga/pull/345)
12
+
13
+ ## v. 4.2.9
14
+
15
+ - Enable configuring the text heading the diagram properties component to values other than `'Diagram properties'` [#341](https://github.com/metadevpro/daga/pull/341)
16
+ - Enable opening diagram properties in property editor even without involving a deselection [#342](https://github.com/metadevpro/daga/pull/342)
17
+ - Enable binding properties of diagram elements to the element's `lookConfig` when applicable [#343](https://github.com/metadevpro/daga/pull/343)
18
+
9
19
  ## v. 4.2.8
10
20
 
11
21
  - Add a snap to grid offset to node types [#337](https://github.com/metadevpro/daga/pull/337)
package/index.cjs.js CHANGED
@@ -1186,6 +1186,25 @@ const numberOfRows = s => {
1186
1186
  return ((_a = s.match(/\n/g)) === null || _a === void 0 ? void 0 : _a.length) || 0;
1187
1187
  };
1188
1188
 
1189
+ /**
1190
+ * Clones an object with support for functions.
1191
+ * @private
1192
+ */
1193
+ const clone = o => {
1194
+ if (typeof o !== 'object') {
1195
+ return o;
1196
+ }
1197
+ const res = {};
1198
+ for (const e of Object.entries(o)) {
1199
+ if (typeof e[1] === 'object') {
1200
+ res[e[0]] = clone(e[1]);
1201
+ } else {
1202
+ res[e[0]] = e[1];
1203
+ }
1204
+ }
1205
+ return res;
1206
+ };
1207
+
1189
1208
  /******************************************************************************
1190
1209
  Copyright (c) Microsoft Corporation.
1191
1210
 
@@ -2050,7 +2069,7 @@ class ValueSet {
2050
2069
  if (property.type === exports.Type.Object) {
2051
2070
  this.valueSets[key] = this.constructSubValueSet(key);
2052
2071
  } else {
2053
- this.values[key] = structuredClone(property.defaultValue);
2072
+ this.values[key] = clone(property.defaultValue);
2054
2073
  }
2055
2074
  if (rootAttribute !== undefined && rootAttribute !== null) {
2056
2075
  if (property.defaultValue !== undefined && !equals(this.getRootElementValue(rootAttribute), property.defaultValue)) {
@@ -2074,7 +2093,7 @@ class ValueSet {
2074
2093
  const property = this.propertySet.getProperty(key);
2075
2094
  const propertySet = new PropertySet(property.properties);
2076
2095
  const valueSet = new ValueSet(propertySet, this.rootElement);
2077
- valueSet.overwriteValues(structuredClone(property.defaultValue));
2096
+ valueSet.overwriteValues(clone(property.defaultValue));
2078
2097
  return valueSet;
2079
2098
  }
2080
2099
  /**
@@ -2248,23 +2267,38 @@ class DiagramConnection extends DiagramElement {
2248
2267
  }
2249
2268
  }
2250
2269
  }
2270
+ /**
2271
+ * An alias for the `lookConfig` attribute.
2272
+ * @private
2273
+ */
2274
+ set look(look) {
2275
+ this.lookConfig = look;
2276
+ }
2277
+ /**
2278
+ * Look configuration used to derive the current look of this connection.
2279
+ * @private
2280
+ */
2281
+ get lookConfig() {
2282
+ return this._lookConfig;
2283
+ }
2251
2284
  /**
2252
2285
  * Sets the look configuration of the connection to override the one determined by the type.
2253
2286
  * `undefined` resets it to the one determined by the type.
2254
2287
  * @private
2255
2288
  */
2256
- set look(look) {
2257
- if (look) {
2258
- const looks = extractLooksFromConfig(look);
2289
+ set lookConfig(lookConfig) {
2290
+ this._lookConfig = lookConfig;
2291
+ if (lookConfig) {
2292
+ const looks = extractLooksFromConfig(lookConfig);
2259
2293
  this._defaultLook = Object.assign(Object.assign({}, this._defaultLook), looks.defaultLook);
2260
2294
  this._selectedLook = Object.assign(Object.assign({}, this._selectedLook), looks.selectedLook);
2261
2295
  this._highlightedLook = Object.assign(Object.assign({}, this._highlightedLook), looks.highlightedLook);
2262
2296
  this._selectedAndHighlightedLook = Object.assign(Object.assign({}, this._selectedAndHighlightedLook), looks.selectedAndHighlightedLook);
2263
2297
  } else {
2264
- this._defaultLook = look;
2265
- this._selectedLook = look;
2266
- this._highlightedLook = look;
2267
- this._selectedAndHighlightedLook = look;
2298
+ this._defaultLook = lookConfig;
2299
+ this._selectedLook = lookConfig;
2300
+ this._highlightedLook = lookConfig;
2301
+ this._selectedAndHighlightedLook = lookConfig;
2268
2302
  }
2269
2303
  }
2270
2304
  /**
@@ -2286,23 +2320,38 @@ class DiagramConnection extends DiagramElement {
2286
2320
  }
2287
2321
  }
2288
2322
  }
2323
+ /**
2324
+ * An alias for the `lookConfig` attribute.
2325
+ * @private
2326
+ */
2327
+ set startMarkerLook(startMarkerLook) {
2328
+ this.startMarkerLookConfig = startMarkerLook;
2329
+ }
2330
+ /**
2331
+ * Look configuration used to derive the current look of the start marker of this connection.
2332
+ * @private
2333
+ */
2334
+ get startMarkerLookConfig() {
2335
+ return this._startMarkerLookConfig;
2336
+ }
2289
2337
  /**
2290
2338
  * Sets the look configuration of the start marker to override the one determined by the type.
2291
2339
  * `null` stands for no marker and `undefined` resets it to the one determined by the type.
2292
2340
  * @private
2293
2341
  */
2294
- set startMarkerLook(startMarkerLook) {
2295
- if (startMarkerLook) {
2296
- const looks = extractLooksFromConfig(startMarkerLook);
2342
+ set startMarkerLookConfig(startMarkerLookConfig) {
2343
+ this._startMarkerLookConfig = startMarkerLookConfig;
2344
+ if (startMarkerLookConfig) {
2345
+ const looks = extractLooksFromConfig(startMarkerLookConfig);
2297
2346
  this._defaultStartMarkerLook = Object.assign(Object.assign({}, this._defaultStartMarkerLook), looks.defaultLook);
2298
2347
  this._selectedStartMarkerLook = Object.assign(Object.assign({}, this._selectedStartMarkerLook), looks.selectedLook);
2299
2348
  this._highlightedStartMarkerLook = Object.assign(Object.assign({}, this._highlightedStartMarkerLook), looks.highlightedLook);
2300
2349
  this._selectedAndHighlightedStartMarkerLook = Object.assign(Object.assign({}, this._selectedAndHighlightedStartMarkerLook), looks.selectedAndHighlightedLook);
2301
2350
  } else {
2302
- this._defaultStartMarkerLook = startMarkerLook;
2303
- this._selectedStartMarkerLook = startMarkerLook;
2304
- this._highlightedStartMarkerLook = startMarkerLook;
2305
- this._selectedAndHighlightedStartMarkerLook = startMarkerLook;
2351
+ this._defaultStartMarkerLook = startMarkerLookConfig;
2352
+ this._selectedStartMarkerLook = startMarkerLookConfig;
2353
+ this._highlightedStartMarkerLook = startMarkerLookConfig;
2354
+ this._selectedAndHighlightedStartMarkerLook = startMarkerLookConfig;
2306
2355
  }
2307
2356
  }
2308
2357
  /**
@@ -2324,23 +2373,38 @@ class DiagramConnection extends DiagramElement {
2324
2373
  }
2325
2374
  }
2326
2375
  }
2376
+ /**
2377
+ * An alias for the `lookConfig` attribute.
2378
+ * @private
2379
+ */
2380
+ set endMarkerLook(endMarkerLook) {
2381
+ this.endMarkerLookConfig = endMarkerLook;
2382
+ }
2383
+ /**
2384
+ * Look configuration used to derive the current look of the end marker of this connection.
2385
+ * @private
2386
+ */
2387
+ get endMarkerLookConfig() {
2388
+ return this._endMarkerLookConfig;
2389
+ }
2327
2390
  /**
2328
2391
  * Sets the look configuration of the end marker to override the one determined by the type.
2329
2392
  * `null` stands for no marker and `undefined` resets it to the one determined by the type.
2330
2393
  * @private
2331
2394
  */
2332
- set endMarkerLook(endMarkerLook) {
2333
- if (endMarkerLook) {
2334
- const looks = extractLooksFromConfig(endMarkerLook);
2395
+ set endMarkerLookConfig(endMarkerLookConfig) {
2396
+ this._endMarkerLookConfig = endMarkerLookConfig;
2397
+ if (endMarkerLookConfig) {
2398
+ const looks = extractLooksFromConfig(endMarkerLookConfig);
2335
2399
  this._defaultEndMarkerLook = Object.assign(Object.assign({}, this._defaultEndMarkerLook), looks.defaultLook);
2336
2400
  this._selectedEndMarkerLook = Object.assign(Object.assign({}, this._selectedEndMarkerLook), looks.selectedLook);
2337
2401
  this._highlightedEndMarkerLook = Object.assign(Object.assign({}, this._highlightedEndMarkerLook), looks.highlightedLook);
2338
2402
  this._selectedAndHighlightedEndMarkerLook = Object.assign(Object.assign({}, this._selectedAndHighlightedEndMarkerLook), looks.selectedAndHighlightedLook);
2339
2403
  } else {
2340
- this._defaultEndMarkerLook = endMarkerLook;
2341
- this._selectedEndMarkerLook = endMarkerLook;
2342
- this._highlightedEndMarkerLook = endMarkerLook;
2343
- this._selectedAndHighlightedEndMarkerLook = endMarkerLook;
2404
+ this._defaultEndMarkerLook = endMarkerLookConfig;
2405
+ this._selectedEndMarkerLook = endMarkerLookConfig;
2406
+ this._highlightedEndMarkerLook = endMarkerLookConfig;
2407
+ this._selectedAndHighlightedEndMarkerLook = endMarkerLookConfig;
2344
2408
  }
2345
2409
  }
2346
2410
  constructor(model, type, start, end, id) {
@@ -3015,23 +3079,38 @@ class DiagramSection extends DiagramElement {
3015
3079
  }
3016
3080
  }
3017
3081
  }
3082
+ /**
3083
+ * An alias for the `lookConfig` attribute.
3084
+ * @private
3085
+ */
3086
+ set look(look) {
3087
+ this.lookConfig = look;
3088
+ }
3089
+ /**
3090
+ * Look configuration used to derive the current look of this section.
3091
+ * @private
3092
+ */
3093
+ get lookConfig() {
3094
+ return this._lookConfig;
3095
+ }
3018
3096
  /**
3019
3097
  * Sets the look configuration of the look to override the one determined by the type.
3020
3098
  * `undefined` resets it to the one determined by the type.
3021
3099
  * @private
3022
3100
  */
3023
- set look(look) {
3024
- if (look) {
3025
- const looks = extractLooksFromConfig(look);
3101
+ set lookConfig(lookConfig) {
3102
+ this._lookConfig = lookConfig;
3103
+ if (lookConfig) {
3104
+ const looks = extractLooksFromConfig(lookConfig);
3026
3105
  this._defaultLook = Object.assign(Object.assign({}, this._defaultLook), looks.defaultLook);
3027
3106
  this._selectedLook = Object.assign(Object.assign({}, this._selectedLook), looks.selectedLook);
3028
3107
  this._highlightedLook = Object.assign(Object.assign({}, this._highlightedLook), looks.highlightedLook);
3029
3108
  this._selectedAndHighlightedLook = Object.assign(Object.assign({}, this._selectedAndHighlightedLook), looks.selectedAndHighlightedLook);
3030
3109
  } else {
3031
- this._defaultLook = look;
3032
- this._selectedLook = look;
3033
- this._highlightedLook = look;
3034
- this._selectedAndHighlightedLook = look;
3110
+ this._defaultLook = lookConfig;
3111
+ this._selectedLook = lookConfig;
3112
+ this._highlightedLook = lookConfig;
3113
+ this._selectedAndHighlightedLook = lookConfig;
3035
3114
  }
3036
3115
  }
3037
3116
  constructor(model, node, indexXInNode, indexYInNode, coords, width, height, id) {
@@ -3529,23 +3608,38 @@ class DiagramNode extends DiagramElement {
3529
3608
  }
3530
3609
  }
3531
3610
  }
3611
+ /**
3612
+ * An alias for the `lookConfig` attribute.
3613
+ * @private
3614
+ */
3615
+ set look(look) {
3616
+ this.lookConfig = look;
3617
+ }
3618
+ /**
3619
+ * Look configuration used to derive the current look of this node.
3620
+ * @private
3621
+ */
3622
+ get lookConfig() {
3623
+ return this._lookConfig;
3624
+ }
3532
3625
  /**
3533
3626
  * Sets the look configuration of the look to override the one determined by the type.
3534
3627
  * `undefined` resets it to the one determined by the type.
3535
3628
  * @private
3536
3629
  */
3537
- set look(look) {
3538
- if (look) {
3539
- const looks = extractLooksFromConfig(look);
3630
+ set lookConfig(lookConfig) {
3631
+ this._lookConfig = lookConfig;
3632
+ if (lookConfig) {
3633
+ const looks = extractLooksFromConfig(lookConfig);
3540
3634
  this._defaultLook = Object.assign(Object.assign({}, this._defaultLook), looks.defaultLook);
3541
3635
  this._selectedLook = Object.assign(Object.assign({}, this._selectedLook), looks.selectedLook);
3542
3636
  this._highlightedLook = Object.assign(Object.assign({}, this._highlightedLook), looks.highlightedLook);
3543
3637
  this._selectedAndHighlightedLook = Object.assign(Object.assign({}, this._selectedAndHighlightedLook), looks.selectedAndHighlightedLook);
3544
3638
  } else {
3545
- this._defaultLook = look;
3546
- this._selectedLook = look;
3547
- this._highlightedLook = look;
3548
- this._selectedAndHighlightedLook = look;
3639
+ this._defaultLook = lookConfig;
3640
+ this._selectedLook = lookConfig;
3641
+ this._highlightedLook = lookConfig;
3642
+ this._selectedAndHighlightedLook = lookConfig;
3549
3643
  }
3550
3644
  }
3551
3645
  constructor(model, type, coords = [0, 0], id) {
@@ -4557,23 +4651,38 @@ class DiagramPort extends DiagramElement {
4557
4651
  }
4558
4652
  }
4559
4653
  }
4654
+ /**
4655
+ * An alias for the `lookConfig` attribute.
4656
+ * @private
4657
+ */
4658
+ set look(look) {
4659
+ this.lookConfig = look;
4660
+ }
4661
+ /**
4662
+ * Look configuration used to derive the current look of this port.
4663
+ * @private
4664
+ */
4665
+ get lookConfig() {
4666
+ return this._lookConfig;
4667
+ }
4560
4668
  /**
4561
4669
  * Sets the look configuration of the look to override the one determined by the type.
4562
4670
  * `undefined` resets it to the one determined by the type.
4563
4671
  * @private
4564
4672
  */
4565
- set look(look) {
4566
- if (look) {
4567
- const looks = extractLooksFromConfig(look);
4673
+ set lookConfig(lookConfig) {
4674
+ this._lookConfig = lookConfig;
4675
+ if (lookConfig) {
4676
+ const looks = extractLooksFromConfig(lookConfig);
4568
4677
  this._defaultLook = Object.assign(Object.assign({}, this._defaultLook), looks.defaultLook);
4569
4678
  this._selectedLook = Object.assign(Object.assign({}, this._selectedLook), looks.selectedLook);
4570
4679
  this._highlightedLook = Object.assign(Object.assign({}, this._highlightedLook), looks.highlightedLook);
4571
4680
  this._selectedAndHighlightedLook = Object.assign(Object.assign({}, this._selectedAndHighlightedLook), looks.selectedAndHighlightedLook);
4572
4681
  } else {
4573
- this._defaultLook = look;
4574
- this._selectedLook = look;
4575
- this._highlightedLook = look;
4576
- this._selectedAndHighlightedLook = look;
4682
+ this._defaultLook = lookConfig;
4683
+ this._selectedLook = lookConfig;
4684
+ this._highlightedLook = lookConfig;
4685
+ this._selectedAndHighlightedLook = lookConfig;
4577
4686
  }
4578
4687
  }
4579
4688
  /**
@@ -4990,7 +5099,7 @@ class AddNodeCollabAction {
4990
5099
  node.label.text = this.label || '';
4991
5100
  }
4992
5101
  if (this.values !== undefined) {
4993
- node.valueSet.setValues(structuredClone(Object.assign(Object.assign({}, node.valueSet.getValues()), this.values)));
5102
+ node.valueSet.setValues(clone(Object.assign(Object.assign({}, node.valueSet.getValues()), this.values)));
4994
5103
  } else {
4995
5104
  node.valueSet.resetValues();
4996
5105
  }
@@ -7015,12 +7124,12 @@ class DagaExporter {
7015
7124
  }
7016
7125
 
7017
7126
  /**
7018
- * Text to display as the title of the property editor when editing the properties of a diagram's value set.
7127
+ * Text to display by default as the title of the property editor when editing the properties of a diagram's value set.
7019
7128
  * @private
7020
7129
  * @see PropertyEditorComponent
7021
7130
  * @see ValueSet
7022
7131
  */
7023
- const DIAGRAM_PROPERTIES_TEXT = 'Diagram properties';
7132
+ const DIAGRAM_PROPERTIES_DEFAULT_TEXT = 'Diagram properties';
7024
7133
  /**
7025
7134
  * Stores the functionality regarding the user highlight of a diagram canvas.
7026
7135
  * @public
@@ -7032,12 +7141,14 @@ class DiagramUserSelection extends DiagramElementSet {
7032
7141
  * @public
7033
7142
  * @param canvas A canvas.
7034
7143
  */
7035
- constructor(canvas) {
7144
+ constructor(canvas, diagramPropertiesText) {
7036
7145
  super();
7037
7146
  this.canvas = canvas;
7038
7147
  this.canvas.propertyEditorChanges$.pipe(rxjs.debounceTime(2000)).subscribe(() => {
7039
7148
  this.makeUpdateValuesAction();
7040
7149
  });
7150
+ console.log(diagramPropertiesText);
7151
+ this.diagramPropertiesText = diagramPropertiesText !== undefined ? diagramPropertiesText : DIAGRAM_PROPERTIES_DEFAULT_TEXT;
7041
7152
  }
7042
7153
  add(element) {
7043
7154
  if (this.contains(element.id)) {
@@ -7215,7 +7326,7 @@ class DiagramUserSelection extends DiagramElementSet {
7215
7326
  if (selectedValueSet) {
7216
7327
  this.propertyEditorSelection = selection;
7217
7328
  if (makeUpdateValuesAction) {
7218
- this.propertyEditorValues = structuredClone(selectedValueSet.getValues());
7329
+ this.propertyEditorValues = clone(selectedValueSet.getValues());
7219
7330
  }
7220
7331
  if (propertyEditor) {
7221
7332
  if (selection instanceof DiagramNode || selection instanceof DiagramConnection) {
@@ -7232,7 +7343,7 @@ class DiagramUserSelection extends DiagramElementSet {
7232
7343
  propertyEditor.valueSet = undefined;
7233
7344
  propertyEditor.valueSet = selectedValueSet;
7234
7345
  } else {
7235
- propertyEditor.title = DIAGRAM_PROPERTIES_TEXT;
7346
+ propertyEditor.title = this.diagramPropertiesText;
7236
7347
  // force the update of the valueSet
7237
7348
  propertyEditor.valueSet = undefined;
7238
7349
  propertyEditor.valueSet = selectedValueSet;
@@ -7259,7 +7370,7 @@ class DiagramUserSelection extends DiagramElementSet {
7259
7370
  return;
7260
7371
  }
7261
7372
  const from = this.propertyEditorValues;
7262
- const to = structuredClone((_b = this.propertyEditorSelection) === null || _b === void 0 ? void 0 : _b.valueSet.getValues());
7373
+ const to = clone((_b = this.propertyEditorSelection) === null || _b === void 0 ? void 0 : _b.valueSet.getValues());
7263
7374
  const [fromDiff, toDiff] = diffProperties(from, to, (_c = this.propertyEditorSelection) === null || _c === void 0 ? void 0 : _c.valueSet);
7264
7375
  const currentAction = new UpdateValuesAction(this.canvas, previousSelectionId, fromDiff, toDiff);
7265
7376
  currentAction.do();
@@ -7322,7 +7433,7 @@ class DiagramCanvas {
7322
7433
  * @param config The configuration object used to set the parameters of this canvas.
7323
7434
  */
7324
7435
  constructor(parentComponent, config) {
7325
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5;
7436
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7;
7326
7437
  this.backgroundPatternId = `daga-background-pattern-id-${DiagramCanvas.canvasCount++}`;
7327
7438
  this.zoomTransform = d3__namespace.zoomIdentity;
7328
7439
  // used to distinguish drags from clicks when dragging elements and during multiple selection
@@ -7337,25 +7448,25 @@ class DiagramCanvas {
7337
7448
  this.propertyEditorChanges$ = new rxjs.Subject();
7338
7449
  this.parentComponent = parentComponent;
7339
7450
  this.model = new DiagramModel(this, undefined, config.name || 'unnamed', '', config.type || '', config.properties || []);
7340
- this.userSelection = new DiagramUserSelection(this);
7341
- this.userHighlight = new DiagramUserHighlight(this, ((_a = config.canvas) === null || _a === void 0 ? void 0 : _a.highlightSections) !== false);
7342
- this.contextMenu = new DiagramContextMenu(this, (_b = config.canvas) === null || _b === void 0 ? void 0 : _b.contextMenu);
7343
- this.backgroundColor = ((_c = config.canvas) === null || _c === void 0 ? void 0 : _c.backgroundColor) || '#FFFFFF';
7344
- this.gridStyle = (_f = (_e = (_d = config.canvas) === null || _d === void 0 ? void 0 : _d.grid) === null || _e === void 0 ? void 0 : _e.style) !== null && _f !== void 0 ? _f : GRID_DEFAULTS.style;
7345
- this.gridSize = ((_h = (_g = config.canvas) === null || _g === void 0 ? void 0 : _g.grid) === null || _h === void 0 ? void 0 : _h.enabled) === false || ((_j = config.canvas) === null || _j === void 0 ? void 0 : _j.grid) === undefined ? 0 : Math.abs(((_l = (_k = config.canvas) === null || _k === void 0 ? void 0 : _k.grid) === null || _l === void 0 ? void 0 : _l.spacing) || GRID_DEFAULTS.spacing);
7346
- this.gridThickness = Math.abs(((_o = (_m = config.canvas) === null || _m === void 0 ? void 0 : _m.grid) === null || _o === void 0 ? void 0 : _o.thickness) || GRID_DEFAULTS.thickness);
7347
- this.gridColor = ((_q = (_p = config.canvas) === null || _p === void 0 ? void 0 : _p.grid) === null || _q === void 0 ? void 0 : _q.color) || GRID_DEFAULTS.color;
7348
- this.snapToGrid = ((_s = (_r = config.canvas) === null || _r === void 0 ? void 0 : _r.grid) === null || _s === void 0 ? void 0 : _s.enabled) === false || ((_t = config.canvas) === null || _t === void 0 ? void 0 : _t.grid) === undefined ? false : ((_v = (_u = config.canvas) === null || _u === void 0 ? void 0 : _u.grid) === null || _v === void 0 ? void 0 : _v.snap) || GRID_DEFAULTS.snap;
7349
- this.zoomFactor = ((_w = config.canvas) === null || _w === void 0 ? void 0 : _w.zoomFactor) || 2;
7350
- this.panRate = ((_x = config.canvas) === null || _x === void 0 ? void 0 : _x.panRate) || 100;
7351
- this.inferConnectionType = ((_y = config.connectionSettings) === null || _y === void 0 ? void 0 : _y.inferConnectionType) || false;
7352
- this.autoTightenConnections = ((_z = config.connectionSettings) === null || _z === void 0 ? void 0 : _z.autoTighten) !== false;
7353
- this.allowConnectionLoops = ((_0 = config.connectionSettings) === null || _0 === void 0 ? void 0 : _0.allowLoops) || false;
7354
- this.allowSharingPorts = ((_1 = config.connectionSettings) === null || _1 === void 0 ? void 0 : _1.sharePorts) !== false;
7355
- this.allowSharingBothPorts = ((_2 = config.connectionSettings) === null || _2 === void 0 ? void 0 : _2.shareBothPorts) || false;
7356
- this.portHighlightRadius = ((_3 = config.connectionSettings) === null || _3 === void 0 ? void 0 : _3.portHighlightRadius) || 100;
7451
+ this.userSelection = new DiagramUserSelection(this, (_b = (_a = config.components) === null || _a === void 0 ? void 0 : _a.propertyEditor) === null || _b === void 0 ? void 0 : _b.title);
7452
+ this.userHighlight = new DiagramUserHighlight(this, ((_c = config.canvas) === null || _c === void 0 ? void 0 : _c.highlightSections) !== false);
7453
+ this.contextMenu = new DiagramContextMenu(this, (_d = config.canvas) === null || _d === void 0 ? void 0 : _d.contextMenu);
7454
+ this.backgroundColor = ((_e = config.canvas) === null || _e === void 0 ? void 0 : _e.backgroundColor) || '#FFFFFF';
7455
+ this.gridStyle = (_h = (_g = (_f = config.canvas) === null || _f === void 0 ? void 0 : _f.grid) === null || _g === void 0 ? void 0 : _g.style) !== null && _h !== void 0 ? _h : GRID_DEFAULTS.style;
7456
+ this.gridSize = ((_k = (_j = config.canvas) === null || _j === void 0 ? void 0 : _j.grid) === null || _k === void 0 ? void 0 : _k.enabled) === false || ((_l = config.canvas) === null || _l === void 0 ? void 0 : _l.grid) === undefined ? 0 : Math.abs(((_o = (_m = config.canvas) === null || _m === void 0 ? void 0 : _m.grid) === null || _o === void 0 ? void 0 : _o.spacing) || GRID_DEFAULTS.spacing);
7457
+ this.gridThickness = Math.abs(((_q = (_p = config.canvas) === null || _p === void 0 ? void 0 : _p.grid) === null || _q === void 0 ? void 0 : _q.thickness) || GRID_DEFAULTS.thickness);
7458
+ this.gridColor = ((_s = (_r = config.canvas) === null || _r === void 0 ? void 0 : _r.grid) === null || _s === void 0 ? void 0 : _s.color) || GRID_DEFAULTS.color;
7459
+ this.snapToGrid = ((_u = (_t = config.canvas) === null || _t === void 0 ? void 0 : _t.grid) === null || _u === void 0 ? void 0 : _u.enabled) === false || ((_v = config.canvas) === null || _v === void 0 ? void 0 : _v.grid) === undefined ? false : ((_x = (_w = config.canvas) === null || _w === void 0 ? void 0 : _w.grid) === null || _x === void 0 ? void 0 : _x.snap) || GRID_DEFAULTS.snap;
7460
+ this.zoomFactor = ((_y = config.canvas) === null || _y === void 0 ? void 0 : _y.zoomFactor) || 2;
7461
+ this.panRate = ((_z = config.canvas) === null || _z === void 0 ? void 0 : _z.panRate) || 100;
7462
+ this.inferConnectionType = ((_0 = config.connectionSettings) === null || _0 === void 0 ? void 0 : _0.inferConnectionType) || false;
7463
+ this.autoTightenConnections = ((_1 = config.connectionSettings) === null || _1 === void 0 ? void 0 : _1.autoTighten) !== false;
7464
+ this.allowConnectionLoops = ((_2 = config.connectionSettings) === null || _2 === void 0 ? void 0 : _2.allowLoops) || false;
7465
+ this.allowSharingPorts = ((_3 = config.connectionSettings) === null || _3 === void 0 ? void 0 : _3.sharePorts) !== false;
7466
+ this.allowSharingBothPorts = ((_4 = config.connectionSettings) === null || _4 === void 0 ? void 0 : _4.shareBothPorts) || false;
7467
+ this.portHighlightRadius = ((_5 = config.connectionSettings) === null || _5 === void 0 ? void 0 : _5.portHighlightRadius) || 100;
7357
7468
  this.multipleSelectionOn = false;
7358
- this.priorityThresholds = ((_4 = config.canvas) === null || _4 === void 0 ? void 0 : _4.priorityThresholds) || [];
7469
+ this.priorityThresholds = ((_6 = config.canvas) === null || _6 === void 0 ? void 0 : _6.priorityThresholds) || [];
7359
7470
  this.priorityThreshold = this.priorityThresholds ? this.priorityThresholds[0] : undefined;
7360
7471
  this.layoutFormat = config.layoutFormat;
7361
7472
  this.userActions = config.userActions || {};
@@ -7382,7 +7493,7 @@ class DiagramCanvas {
7382
7493
  const connectionType = new DiagramConnectionType(Object.assign(Object.assign({}, config.connectionTypeDefaults), connectionTypeConfig));
7383
7494
  this.model.connections.types.add(connectionType);
7384
7495
  }
7385
- this._connectionType = ((_5 = config === null || config === void 0 ? void 0 : config.connectionSettings) === null || _5 === void 0 ? void 0 : _5.defaultConnection) !== undefined ? this.model.connections.types.get(config.connectionSettings.defaultConnection) : undefined;
7496
+ this._connectionType = ((_7 = config === null || config === void 0 ? void 0 : config.connectionSettings) === null || _7 === void 0 ? void 0 : _7.defaultConnection) !== undefined ? this.model.connections.types.get(config.connectionSettings.defaultConnection) : undefined;
7386
7497
  }
7387
7498
  }
7388
7499
  addValidator(validator) {
@@ -7609,8 +7720,8 @@ class DiagramCanvas {
7609
7720
  const deselectedElements = this.userSelection.all();
7610
7721
  this.userSelection.clear();
7611
7722
  this.diagramEvent$.next(new DiagramSelectionEvent(deselectedElements, false));
7612
- this.userSelection.openInPropertyEditor(this.model);
7613
7723
  }
7724
+ this.userSelection.openInPropertyEditor(this.model);
7614
7725
  }).call(d3__namespace.drag().filter(event => {
7615
7726
  return this.multipleSelectionOn || isSecondaryButton(event);
7616
7727
  }).on(exports.DragEvents.Start, event => {
package/index.esm.js CHANGED
@@ -1165,6 +1165,25 @@ const numberOfRows = s => {
1165
1165
  return ((_a = s.match(/\n/g)) === null || _a === void 0 ? void 0 : _a.length) || 0;
1166
1166
  };
1167
1167
 
1168
+ /**
1169
+ * Clones an object with support for functions.
1170
+ * @private
1171
+ */
1172
+ const clone = o => {
1173
+ if (typeof o !== 'object') {
1174
+ return o;
1175
+ }
1176
+ const res = {};
1177
+ for (const e of Object.entries(o)) {
1178
+ if (typeof e[1] === 'object') {
1179
+ res[e[0]] = clone(e[1]);
1180
+ } else {
1181
+ res[e[0]] = e[1];
1182
+ }
1183
+ }
1184
+ return res;
1185
+ };
1186
+
1168
1187
  /******************************************************************************
1169
1188
  Copyright (c) Microsoft Corporation.
1170
1189
 
@@ -2029,7 +2048,7 @@ class ValueSet {
2029
2048
  if (property.type === Type.Object) {
2030
2049
  this.valueSets[key] = this.constructSubValueSet(key);
2031
2050
  } else {
2032
- this.values[key] = structuredClone(property.defaultValue);
2051
+ this.values[key] = clone(property.defaultValue);
2033
2052
  }
2034
2053
  if (rootAttribute !== undefined && rootAttribute !== null) {
2035
2054
  if (property.defaultValue !== undefined && !equals(this.getRootElementValue(rootAttribute), property.defaultValue)) {
@@ -2053,7 +2072,7 @@ class ValueSet {
2053
2072
  const property = this.propertySet.getProperty(key);
2054
2073
  const propertySet = new PropertySet(property.properties);
2055
2074
  const valueSet = new ValueSet(propertySet, this.rootElement);
2056
- valueSet.overwriteValues(structuredClone(property.defaultValue));
2075
+ valueSet.overwriteValues(clone(property.defaultValue));
2057
2076
  return valueSet;
2058
2077
  }
2059
2078
  /**
@@ -2227,23 +2246,38 @@ class DiagramConnection extends DiagramElement {
2227
2246
  }
2228
2247
  }
2229
2248
  }
2249
+ /**
2250
+ * An alias for the `lookConfig` attribute.
2251
+ * @private
2252
+ */
2253
+ set look(look) {
2254
+ this.lookConfig = look;
2255
+ }
2256
+ /**
2257
+ * Look configuration used to derive the current look of this connection.
2258
+ * @private
2259
+ */
2260
+ get lookConfig() {
2261
+ return this._lookConfig;
2262
+ }
2230
2263
  /**
2231
2264
  * Sets the look configuration of the connection to override the one determined by the type.
2232
2265
  * `undefined` resets it to the one determined by the type.
2233
2266
  * @private
2234
2267
  */
2235
- set look(look) {
2236
- if (look) {
2237
- const looks = extractLooksFromConfig(look);
2268
+ set lookConfig(lookConfig) {
2269
+ this._lookConfig = lookConfig;
2270
+ if (lookConfig) {
2271
+ const looks = extractLooksFromConfig(lookConfig);
2238
2272
  this._defaultLook = Object.assign(Object.assign({}, this._defaultLook), looks.defaultLook);
2239
2273
  this._selectedLook = Object.assign(Object.assign({}, this._selectedLook), looks.selectedLook);
2240
2274
  this._highlightedLook = Object.assign(Object.assign({}, this._highlightedLook), looks.highlightedLook);
2241
2275
  this._selectedAndHighlightedLook = Object.assign(Object.assign({}, this._selectedAndHighlightedLook), looks.selectedAndHighlightedLook);
2242
2276
  } else {
2243
- this._defaultLook = look;
2244
- this._selectedLook = look;
2245
- this._highlightedLook = look;
2246
- this._selectedAndHighlightedLook = look;
2277
+ this._defaultLook = lookConfig;
2278
+ this._selectedLook = lookConfig;
2279
+ this._highlightedLook = lookConfig;
2280
+ this._selectedAndHighlightedLook = lookConfig;
2247
2281
  }
2248
2282
  }
2249
2283
  /**
@@ -2265,23 +2299,38 @@ class DiagramConnection extends DiagramElement {
2265
2299
  }
2266
2300
  }
2267
2301
  }
2302
+ /**
2303
+ * An alias for the `lookConfig` attribute.
2304
+ * @private
2305
+ */
2306
+ set startMarkerLook(startMarkerLook) {
2307
+ this.startMarkerLookConfig = startMarkerLook;
2308
+ }
2309
+ /**
2310
+ * Look configuration used to derive the current look of the start marker of this connection.
2311
+ * @private
2312
+ */
2313
+ get startMarkerLookConfig() {
2314
+ return this._startMarkerLookConfig;
2315
+ }
2268
2316
  /**
2269
2317
  * Sets the look configuration of the start marker to override the one determined by the type.
2270
2318
  * `null` stands for no marker and `undefined` resets it to the one determined by the type.
2271
2319
  * @private
2272
2320
  */
2273
- set startMarkerLook(startMarkerLook) {
2274
- if (startMarkerLook) {
2275
- const looks = extractLooksFromConfig(startMarkerLook);
2321
+ set startMarkerLookConfig(startMarkerLookConfig) {
2322
+ this._startMarkerLookConfig = startMarkerLookConfig;
2323
+ if (startMarkerLookConfig) {
2324
+ const looks = extractLooksFromConfig(startMarkerLookConfig);
2276
2325
  this._defaultStartMarkerLook = Object.assign(Object.assign({}, this._defaultStartMarkerLook), looks.defaultLook);
2277
2326
  this._selectedStartMarkerLook = Object.assign(Object.assign({}, this._selectedStartMarkerLook), looks.selectedLook);
2278
2327
  this._highlightedStartMarkerLook = Object.assign(Object.assign({}, this._highlightedStartMarkerLook), looks.highlightedLook);
2279
2328
  this._selectedAndHighlightedStartMarkerLook = Object.assign(Object.assign({}, this._selectedAndHighlightedStartMarkerLook), looks.selectedAndHighlightedLook);
2280
2329
  } else {
2281
- this._defaultStartMarkerLook = startMarkerLook;
2282
- this._selectedStartMarkerLook = startMarkerLook;
2283
- this._highlightedStartMarkerLook = startMarkerLook;
2284
- this._selectedAndHighlightedStartMarkerLook = startMarkerLook;
2330
+ this._defaultStartMarkerLook = startMarkerLookConfig;
2331
+ this._selectedStartMarkerLook = startMarkerLookConfig;
2332
+ this._highlightedStartMarkerLook = startMarkerLookConfig;
2333
+ this._selectedAndHighlightedStartMarkerLook = startMarkerLookConfig;
2285
2334
  }
2286
2335
  }
2287
2336
  /**
@@ -2303,23 +2352,38 @@ class DiagramConnection extends DiagramElement {
2303
2352
  }
2304
2353
  }
2305
2354
  }
2355
+ /**
2356
+ * An alias for the `lookConfig` attribute.
2357
+ * @private
2358
+ */
2359
+ set endMarkerLook(endMarkerLook) {
2360
+ this.endMarkerLookConfig = endMarkerLook;
2361
+ }
2362
+ /**
2363
+ * Look configuration used to derive the current look of the end marker of this connection.
2364
+ * @private
2365
+ */
2366
+ get endMarkerLookConfig() {
2367
+ return this._endMarkerLookConfig;
2368
+ }
2306
2369
  /**
2307
2370
  * Sets the look configuration of the end marker to override the one determined by the type.
2308
2371
  * `null` stands for no marker and `undefined` resets it to the one determined by the type.
2309
2372
  * @private
2310
2373
  */
2311
- set endMarkerLook(endMarkerLook) {
2312
- if (endMarkerLook) {
2313
- const looks = extractLooksFromConfig(endMarkerLook);
2374
+ set endMarkerLookConfig(endMarkerLookConfig) {
2375
+ this._endMarkerLookConfig = endMarkerLookConfig;
2376
+ if (endMarkerLookConfig) {
2377
+ const looks = extractLooksFromConfig(endMarkerLookConfig);
2314
2378
  this._defaultEndMarkerLook = Object.assign(Object.assign({}, this._defaultEndMarkerLook), looks.defaultLook);
2315
2379
  this._selectedEndMarkerLook = Object.assign(Object.assign({}, this._selectedEndMarkerLook), looks.selectedLook);
2316
2380
  this._highlightedEndMarkerLook = Object.assign(Object.assign({}, this._highlightedEndMarkerLook), looks.highlightedLook);
2317
2381
  this._selectedAndHighlightedEndMarkerLook = Object.assign(Object.assign({}, this._selectedAndHighlightedEndMarkerLook), looks.selectedAndHighlightedLook);
2318
2382
  } else {
2319
- this._defaultEndMarkerLook = endMarkerLook;
2320
- this._selectedEndMarkerLook = endMarkerLook;
2321
- this._highlightedEndMarkerLook = endMarkerLook;
2322
- this._selectedAndHighlightedEndMarkerLook = endMarkerLook;
2383
+ this._defaultEndMarkerLook = endMarkerLookConfig;
2384
+ this._selectedEndMarkerLook = endMarkerLookConfig;
2385
+ this._highlightedEndMarkerLook = endMarkerLookConfig;
2386
+ this._selectedAndHighlightedEndMarkerLook = endMarkerLookConfig;
2323
2387
  }
2324
2388
  }
2325
2389
  constructor(model, type, start, end, id) {
@@ -2994,23 +3058,38 @@ class DiagramSection extends DiagramElement {
2994
3058
  }
2995
3059
  }
2996
3060
  }
3061
+ /**
3062
+ * An alias for the `lookConfig` attribute.
3063
+ * @private
3064
+ */
3065
+ set look(look) {
3066
+ this.lookConfig = look;
3067
+ }
3068
+ /**
3069
+ * Look configuration used to derive the current look of this section.
3070
+ * @private
3071
+ */
3072
+ get lookConfig() {
3073
+ return this._lookConfig;
3074
+ }
2997
3075
  /**
2998
3076
  * Sets the look configuration of the look to override the one determined by the type.
2999
3077
  * `undefined` resets it to the one determined by the type.
3000
3078
  * @private
3001
3079
  */
3002
- set look(look) {
3003
- if (look) {
3004
- const looks = extractLooksFromConfig(look);
3080
+ set lookConfig(lookConfig) {
3081
+ this._lookConfig = lookConfig;
3082
+ if (lookConfig) {
3083
+ const looks = extractLooksFromConfig(lookConfig);
3005
3084
  this._defaultLook = Object.assign(Object.assign({}, this._defaultLook), looks.defaultLook);
3006
3085
  this._selectedLook = Object.assign(Object.assign({}, this._selectedLook), looks.selectedLook);
3007
3086
  this._highlightedLook = Object.assign(Object.assign({}, this._highlightedLook), looks.highlightedLook);
3008
3087
  this._selectedAndHighlightedLook = Object.assign(Object.assign({}, this._selectedAndHighlightedLook), looks.selectedAndHighlightedLook);
3009
3088
  } else {
3010
- this._defaultLook = look;
3011
- this._selectedLook = look;
3012
- this._highlightedLook = look;
3013
- this._selectedAndHighlightedLook = look;
3089
+ this._defaultLook = lookConfig;
3090
+ this._selectedLook = lookConfig;
3091
+ this._highlightedLook = lookConfig;
3092
+ this._selectedAndHighlightedLook = lookConfig;
3014
3093
  }
3015
3094
  }
3016
3095
  constructor(model, node, indexXInNode, indexYInNode, coords, width, height, id) {
@@ -3508,23 +3587,38 @@ class DiagramNode extends DiagramElement {
3508
3587
  }
3509
3588
  }
3510
3589
  }
3590
+ /**
3591
+ * An alias for the `lookConfig` attribute.
3592
+ * @private
3593
+ */
3594
+ set look(look) {
3595
+ this.lookConfig = look;
3596
+ }
3597
+ /**
3598
+ * Look configuration used to derive the current look of this node.
3599
+ * @private
3600
+ */
3601
+ get lookConfig() {
3602
+ return this._lookConfig;
3603
+ }
3511
3604
  /**
3512
3605
  * Sets the look configuration of the look to override the one determined by the type.
3513
3606
  * `undefined` resets it to the one determined by the type.
3514
3607
  * @private
3515
3608
  */
3516
- set look(look) {
3517
- if (look) {
3518
- const looks = extractLooksFromConfig(look);
3609
+ set lookConfig(lookConfig) {
3610
+ this._lookConfig = lookConfig;
3611
+ if (lookConfig) {
3612
+ const looks = extractLooksFromConfig(lookConfig);
3519
3613
  this._defaultLook = Object.assign(Object.assign({}, this._defaultLook), looks.defaultLook);
3520
3614
  this._selectedLook = Object.assign(Object.assign({}, this._selectedLook), looks.selectedLook);
3521
3615
  this._highlightedLook = Object.assign(Object.assign({}, this._highlightedLook), looks.highlightedLook);
3522
3616
  this._selectedAndHighlightedLook = Object.assign(Object.assign({}, this._selectedAndHighlightedLook), looks.selectedAndHighlightedLook);
3523
3617
  } else {
3524
- this._defaultLook = look;
3525
- this._selectedLook = look;
3526
- this._highlightedLook = look;
3527
- this._selectedAndHighlightedLook = look;
3618
+ this._defaultLook = lookConfig;
3619
+ this._selectedLook = lookConfig;
3620
+ this._highlightedLook = lookConfig;
3621
+ this._selectedAndHighlightedLook = lookConfig;
3528
3622
  }
3529
3623
  }
3530
3624
  constructor(model, type, coords = [0, 0], id) {
@@ -4536,23 +4630,38 @@ class DiagramPort extends DiagramElement {
4536
4630
  }
4537
4631
  }
4538
4632
  }
4633
+ /**
4634
+ * An alias for the `lookConfig` attribute.
4635
+ * @private
4636
+ */
4637
+ set look(look) {
4638
+ this.lookConfig = look;
4639
+ }
4640
+ /**
4641
+ * Look configuration used to derive the current look of this port.
4642
+ * @private
4643
+ */
4644
+ get lookConfig() {
4645
+ return this._lookConfig;
4646
+ }
4539
4647
  /**
4540
4648
  * Sets the look configuration of the look to override the one determined by the type.
4541
4649
  * `undefined` resets it to the one determined by the type.
4542
4650
  * @private
4543
4651
  */
4544
- set look(look) {
4545
- if (look) {
4546
- const looks = extractLooksFromConfig(look);
4652
+ set lookConfig(lookConfig) {
4653
+ this._lookConfig = lookConfig;
4654
+ if (lookConfig) {
4655
+ const looks = extractLooksFromConfig(lookConfig);
4547
4656
  this._defaultLook = Object.assign(Object.assign({}, this._defaultLook), looks.defaultLook);
4548
4657
  this._selectedLook = Object.assign(Object.assign({}, this._selectedLook), looks.selectedLook);
4549
4658
  this._highlightedLook = Object.assign(Object.assign({}, this._highlightedLook), looks.highlightedLook);
4550
4659
  this._selectedAndHighlightedLook = Object.assign(Object.assign({}, this._selectedAndHighlightedLook), looks.selectedAndHighlightedLook);
4551
4660
  } else {
4552
- this._defaultLook = look;
4553
- this._selectedLook = look;
4554
- this._highlightedLook = look;
4555
- this._selectedAndHighlightedLook = look;
4661
+ this._defaultLook = lookConfig;
4662
+ this._selectedLook = lookConfig;
4663
+ this._highlightedLook = lookConfig;
4664
+ this._selectedAndHighlightedLook = lookConfig;
4556
4665
  }
4557
4666
  }
4558
4667
  /**
@@ -4969,7 +5078,7 @@ class AddNodeCollabAction {
4969
5078
  node.label.text = this.label || '';
4970
5079
  }
4971
5080
  if (this.values !== undefined) {
4972
- node.valueSet.setValues(structuredClone(Object.assign(Object.assign({}, node.valueSet.getValues()), this.values)));
5081
+ node.valueSet.setValues(clone(Object.assign(Object.assign({}, node.valueSet.getValues()), this.values)));
4973
5082
  } else {
4974
5083
  node.valueSet.resetValues();
4975
5084
  }
@@ -6994,12 +7103,12 @@ class DagaExporter {
6994
7103
  }
6995
7104
 
6996
7105
  /**
6997
- * Text to display as the title of the property editor when editing the properties of a diagram's value set.
7106
+ * Text to display by default as the title of the property editor when editing the properties of a diagram's value set.
6998
7107
  * @private
6999
7108
  * @see PropertyEditorComponent
7000
7109
  * @see ValueSet
7001
7110
  */
7002
- const DIAGRAM_PROPERTIES_TEXT = 'Diagram properties';
7111
+ const DIAGRAM_PROPERTIES_DEFAULT_TEXT = 'Diagram properties';
7003
7112
  /**
7004
7113
  * Stores the functionality regarding the user highlight of a diagram canvas.
7005
7114
  * @public
@@ -7011,12 +7120,14 @@ class DiagramUserSelection extends DiagramElementSet {
7011
7120
  * @public
7012
7121
  * @param canvas A canvas.
7013
7122
  */
7014
- constructor(canvas) {
7123
+ constructor(canvas, diagramPropertiesText) {
7015
7124
  super();
7016
7125
  this.canvas = canvas;
7017
7126
  this.canvas.propertyEditorChanges$.pipe(debounceTime(2000)).subscribe(() => {
7018
7127
  this.makeUpdateValuesAction();
7019
7128
  });
7129
+ console.log(diagramPropertiesText);
7130
+ this.diagramPropertiesText = diagramPropertiesText !== undefined ? diagramPropertiesText : DIAGRAM_PROPERTIES_DEFAULT_TEXT;
7020
7131
  }
7021
7132
  add(element) {
7022
7133
  if (this.contains(element.id)) {
@@ -7194,7 +7305,7 @@ class DiagramUserSelection extends DiagramElementSet {
7194
7305
  if (selectedValueSet) {
7195
7306
  this.propertyEditorSelection = selection;
7196
7307
  if (makeUpdateValuesAction) {
7197
- this.propertyEditorValues = structuredClone(selectedValueSet.getValues());
7308
+ this.propertyEditorValues = clone(selectedValueSet.getValues());
7198
7309
  }
7199
7310
  if (propertyEditor) {
7200
7311
  if (selection instanceof DiagramNode || selection instanceof DiagramConnection) {
@@ -7211,7 +7322,7 @@ class DiagramUserSelection extends DiagramElementSet {
7211
7322
  propertyEditor.valueSet = undefined;
7212
7323
  propertyEditor.valueSet = selectedValueSet;
7213
7324
  } else {
7214
- propertyEditor.title = DIAGRAM_PROPERTIES_TEXT;
7325
+ propertyEditor.title = this.diagramPropertiesText;
7215
7326
  // force the update of the valueSet
7216
7327
  propertyEditor.valueSet = undefined;
7217
7328
  propertyEditor.valueSet = selectedValueSet;
@@ -7238,7 +7349,7 @@ class DiagramUserSelection extends DiagramElementSet {
7238
7349
  return;
7239
7350
  }
7240
7351
  const from = this.propertyEditorValues;
7241
- const to = structuredClone((_b = this.propertyEditorSelection) === null || _b === void 0 ? void 0 : _b.valueSet.getValues());
7352
+ const to = clone((_b = this.propertyEditorSelection) === null || _b === void 0 ? void 0 : _b.valueSet.getValues());
7242
7353
  const [fromDiff, toDiff] = diffProperties(from, to, (_c = this.propertyEditorSelection) === null || _c === void 0 ? void 0 : _c.valueSet);
7243
7354
  const currentAction = new UpdateValuesAction(this.canvas, previousSelectionId, fromDiff, toDiff);
7244
7355
  currentAction.do();
@@ -7301,7 +7412,7 @@ class DiagramCanvas {
7301
7412
  * @param config The configuration object used to set the parameters of this canvas.
7302
7413
  */
7303
7414
  constructor(parentComponent, config) {
7304
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5;
7415
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7;
7305
7416
  this.backgroundPatternId = `daga-background-pattern-id-${DiagramCanvas.canvasCount++}`;
7306
7417
  this.zoomTransform = d3.zoomIdentity;
7307
7418
  // used to distinguish drags from clicks when dragging elements and during multiple selection
@@ -7316,25 +7427,25 @@ class DiagramCanvas {
7316
7427
  this.propertyEditorChanges$ = new Subject();
7317
7428
  this.parentComponent = parentComponent;
7318
7429
  this.model = new DiagramModel(this, undefined, config.name || 'unnamed', '', config.type || '', config.properties || []);
7319
- this.userSelection = new DiagramUserSelection(this);
7320
- this.userHighlight = new DiagramUserHighlight(this, ((_a = config.canvas) === null || _a === void 0 ? void 0 : _a.highlightSections) !== false);
7321
- this.contextMenu = new DiagramContextMenu(this, (_b = config.canvas) === null || _b === void 0 ? void 0 : _b.contextMenu);
7322
- this.backgroundColor = ((_c = config.canvas) === null || _c === void 0 ? void 0 : _c.backgroundColor) || '#FFFFFF';
7323
- this.gridStyle = (_f = (_e = (_d = config.canvas) === null || _d === void 0 ? void 0 : _d.grid) === null || _e === void 0 ? void 0 : _e.style) !== null && _f !== void 0 ? _f : GRID_DEFAULTS.style;
7324
- this.gridSize = ((_h = (_g = config.canvas) === null || _g === void 0 ? void 0 : _g.grid) === null || _h === void 0 ? void 0 : _h.enabled) === false || ((_j = config.canvas) === null || _j === void 0 ? void 0 : _j.grid) === undefined ? 0 : Math.abs(((_l = (_k = config.canvas) === null || _k === void 0 ? void 0 : _k.grid) === null || _l === void 0 ? void 0 : _l.spacing) || GRID_DEFAULTS.spacing);
7325
- this.gridThickness = Math.abs(((_o = (_m = config.canvas) === null || _m === void 0 ? void 0 : _m.grid) === null || _o === void 0 ? void 0 : _o.thickness) || GRID_DEFAULTS.thickness);
7326
- this.gridColor = ((_q = (_p = config.canvas) === null || _p === void 0 ? void 0 : _p.grid) === null || _q === void 0 ? void 0 : _q.color) || GRID_DEFAULTS.color;
7327
- this.snapToGrid = ((_s = (_r = config.canvas) === null || _r === void 0 ? void 0 : _r.grid) === null || _s === void 0 ? void 0 : _s.enabled) === false || ((_t = config.canvas) === null || _t === void 0 ? void 0 : _t.grid) === undefined ? false : ((_v = (_u = config.canvas) === null || _u === void 0 ? void 0 : _u.grid) === null || _v === void 0 ? void 0 : _v.snap) || GRID_DEFAULTS.snap;
7328
- this.zoomFactor = ((_w = config.canvas) === null || _w === void 0 ? void 0 : _w.zoomFactor) || 2;
7329
- this.panRate = ((_x = config.canvas) === null || _x === void 0 ? void 0 : _x.panRate) || 100;
7330
- this.inferConnectionType = ((_y = config.connectionSettings) === null || _y === void 0 ? void 0 : _y.inferConnectionType) || false;
7331
- this.autoTightenConnections = ((_z = config.connectionSettings) === null || _z === void 0 ? void 0 : _z.autoTighten) !== false;
7332
- this.allowConnectionLoops = ((_0 = config.connectionSettings) === null || _0 === void 0 ? void 0 : _0.allowLoops) || false;
7333
- this.allowSharingPorts = ((_1 = config.connectionSettings) === null || _1 === void 0 ? void 0 : _1.sharePorts) !== false;
7334
- this.allowSharingBothPorts = ((_2 = config.connectionSettings) === null || _2 === void 0 ? void 0 : _2.shareBothPorts) || false;
7335
- this.portHighlightRadius = ((_3 = config.connectionSettings) === null || _3 === void 0 ? void 0 : _3.portHighlightRadius) || 100;
7430
+ this.userSelection = new DiagramUserSelection(this, (_b = (_a = config.components) === null || _a === void 0 ? void 0 : _a.propertyEditor) === null || _b === void 0 ? void 0 : _b.title);
7431
+ this.userHighlight = new DiagramUserHighlight(this, ((_c = config.canvas) === null || _c === void 0 ? void 0 : _c.highlightSections) !== false);
7432
+ this.contextMenu = new DiagramContextMenu(this, (_d = config.canvas) === null || _d === void 0 ? void 0 : _d.contextMenu);
7433
+ this.backgroundColor = ((_e = config.canvas) === null || _e === void 0 ? void 0 : _e.backgroundColor) || '#FFFFFF';
7434
+ this.gridStyle = (_h = (_g = (_f = config.canvas) === null || _f === void 0 ? void 0 : _f.grid) === null || _g === void 0 ? void 0 : _g.style) !== null && _h !== void 0 ? _h : GRID_DEFAULTS.style;
7435
+ this.gridSize = ((_k = (_j = config.canvas) === null || _j === void 0 ? void 0 : _j.grid) === null || _k === void 0 ? void 0 : _k.enabled) === false || ((_l = config.canvas) === null || _l === void 0 ? void 0 : _l.grid) === undefined ? 0 : Math.abs(((_o = (_m = config.canvas) === null || _m === void 0 ? void 0 : _m.grid) === null || _o === void 0 ? void 0 : _o.spacing) || GRID_DEFAULTS.spacing);
7436
+ this.gridThickness = Math.abs(((_q = (_p = config.canvas) === null || _p === void 0 ? void 0 : _p.grid) === null || _q === void 0 ? void 0 : _q.thickness) || GRID_DEFAULTS.thickness);
7437
+ this.gridColor = ((_s = (_r = config.canvas) === null || _r === void 0 ? void 0 : _r.grid) === null || _s === void 0 ? void 0 : _s.color) || GRID_DEFAULTS.color;
7438
+ this.snapToGrid = ((_u = (_t = config.canvas) === null || _t === void 0 ? void 0 : _t.grid) === null || _u === void 0 ? void 0 : _u.enabled) === false || ((_v = config.canvas) === null || _v === void 0 ? void 0 : _v.grid) === undefined ? false : ((_x = (_w = config.canvas) === null || _w === void 0 ? void 0 : _w.grid) === null || _x === void 0 ? void 0 : _x.snap) || GRID_DEFAULTS.snap;
7439
+ this.zoomFactor = ((_y = config.canvas) === null || _y === void 0 ? void 0 : _y.zoomFactor) || 2;
7440
+ this.panRate = ((_z = config.canvas) === null || _z === void 0 ? void 0 : _z.panRate) || 100;
7441
+ this.inferConnectionType = ((_0 = config.connectionSettings) === null || _0 === void 0 ? void 0 : _0.inferConnectionType) || false;
7442
+ this.autoTightenConnections = ((_1 = config.connectionSettings) === null || _1 === void 0 ? void 0 : _1.autoTighten) !== false;
7443
+ this.allowConnectionLoops = ((_2 = config.connectionSettings) === null || _2 === void 0 ? void 0 : _2.allowLoops) || false;
7444
+ this.allowSharingPorts = ((_3 = config.connectionSettings) === null || _3 === void 0 ? void 0 : _3.sharePorts) !== false;
7445
+ this.allowSharingBothPorts = ((_4 = config.connectionSettings) === null || _4 === void 0 ? void 0 : _4.shareBothPorts) || false;
7446
+ this.portHighlightRadius = ((_5 = config.connectionSettings) === null || _5 === void 0 ? void 0 : _5.portHighlightRadius) || 100;
7336
7447
  this.multipleSelectionOn = false;
7337
- this.priorityThresholds = ((_4 = config.canvas) === null || _4 === void 0 ? void 0 : _4.priorityThresholds) || [];
7448
+ this.priorityThresholds = ((_6 = config.canvas) === null || _6 === void 0 ? void 0 : _6.priorityThresholds) || [];
7338
7449
  this.priorityThreshold = this.priorityThresholds ? this.priorityThresholds[0] : undefined;
7339
7450
  this.layoutFormat = config.layoutFormat;
7340
7451
  this.userActions = config.userActions || {};
@@ -7361,7 +7472,7 @@ class DiagramCanvas {
7361
7472
  const connectionType = new DiagramConnectionType(Object.assign(Object.assign({}, config.connectionTypeDefaults), connectionTypeConfig));
7362
7473
  this.model.connections.types.add(connectionType);
7363
7474
  }
7364
- this._connectionType = ((_5 = config === null || config === void 0 ? void 0 : config.connectionSettings) === null || _5 === void 0 ? void 0 : _5.defaultConnection) !== undefined ? this.model.connections.types.get(config.connectionSettings.defaultConnection) : undefined;
7475
+ this._connectionType = ((_7 = config === null || config === void 0 ? void 0 : config.connectionSettings) === null || _7 === void 0 ? void 0 : _7.defaultConnection) !== undefined ? this.model.connections.types.get(config.connectionSettings.defaultConnection) : undefined;
7365
7476
  }
7366
7477
  }
7367
7478
  addValidator(validator) {
@@ -7588,8 +7699,8 @@ class DiagramCanvas {
7588
7699
  const deselectedElements = this.userSelection.all();
7589
7700
  this.userSelection.clear();
7590
7701
  this.diagramEvent$.next(new DiagramSelectionEvent(deselectedElements, false));
7591
- this.userSelection.openInPropertyEditor(this.model);
7592
7702
  }
7703
+ this.userSelection.openInPropertyEditor(this.model);
7593
7704
  }).call(d3.drag().filter(event => {
7594
7705
  return this.multipleSelectionOn || isSecondaryButton(event);
7595
7706
  }).on(DragEvents.Start, event => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metadev/daga",
3
- "version": "4.2.8",
3
+ "version": "4.2.10",
4
4
  "dependencies": {},
5
5
  "peerDependencies": {
6
6
  "d3": "^7.9.0",
@@ -4,12 +4,12 @@ import { DiagramElement, DiagramElementSet } from '../model/diagram-element';
4
4
  import { DiagramModel } from '../model/diagram-model';
5
5
  import { ValueSet } from '../property/value';
6
6
  /**
7
- * Text to display as the title of the property editor when editing the properties of a diagram's value set.
7
+ * Text to display by default as the title of the property editor when editing the properties of a diagram's value set.
8
8
  * @private
9
9
  * @see PropertyEditorComponent
10
10
  * @see ValueSet
11
11
  */
12
- export declare const DIAGRAM_PROPERTIES_TEXT = "Diagram properties";
12
+ export declare const DIAGRAM_PROPERTIES_DEFAULT_TEXT = "Diagram properties";
13
13
  /**
14
14
  * Stores the functionality regarding the user highlight of a diagram canvas.
15
15
  * @public
@@ -17,6 +17,7 @@ export declare const DIAGRAM_PROPERTIES_TEXT = "Diagram properties";
17
17
  */
18
18
  export declare class DiagramUserSelection extends DiagramElementSet<DiagramElement> {
19
19
  private readonly canvas;
20
+ private readonly diagramPropertiesText;
20
21
  private propertyEditorSelection?;
21
22
  private propertyEditorValues?;
22
23
  /**
@@ -24,7 +25,7 @@ export declare class DiagramUserSelection extends DiagramElementSet<DiagramEleme
24
25
  * @public
25
26
  * @param canvas A canvas.
26
27
  */
27
- constructor(canvas: Canvas);
28
+ constructor(canvas: Canvas, diagramPropertiesText: string | undefined);
28
29
  add(element: DiagramElement): void;
29
30
  remove(id: string): void;
30
31
  /**
@@ -163,6 +163,11 @@ export interface PropertyEditorComponentConfig {
163
163
  * @default undefined
164
164
  */
165
165
  height?: string;
166
+ /**
167
+ * Title that appears heading this component.
168
+ * @default 'Diagram properties'
169
+ */
170
+ title?: string;
166
171
  }
167
172
  /**
168
173
  * Configuration for a palette.
@@ -148,6 +148,7 @@ export declare class DiagramConnection extends DiagramElement {
148
148
  */
149
149
  get name(): string;
150
150
  set name(name: string);
151
+ private _lookConfig?;
151
152
  private _defaultLook?;
152
153
  private _selectedLook?;
153
154
  private _highlightedLook?;
@@ -157,12 +158,23 @@ export declare class DiagramConnection extends DiagramElement {
157
158
  * @private
158
159
  */
159
160
  get look(): ConnectionLook;
161
+ /**
162
+ * An alias for the `lookConfig` attribute.
163
+ * @private
164
+ */
165
+ set look(look: ConnectionLookConfig | undefined);
166
+ /**
167
+ * Look configuration used to derive the current look of this connection.
168
+ * @private
169
+ */
170
+ get lookConfig(): ConnectionLookConfig | undefined;
160
171
  /**
161
172
  * Sets the look configuration of the connection to override the one determined by the type.
162
173
  * `undefined` resets it to the one determined by the type.
163
174
  * @private
164
175
  */
165
- set look(look: ConnectionLookConfig | undefined);
176
+ set lookConfig(lookConfig: ConnectionLookConfig | undefined);
177
+ private _startMarkerLookConfig?;
166
178
  private _defaultStartMarkerLook?;
167
179
  private _selectedStartMarkerLook?;
168
180
  private _highlightedStartMarkerLook?;
@@ -172,12 +184,23 @@ export declare class DiagramConnection extends DiagramElement {
172
184
  * @private
173
185
  */
174
186
  get startMarkerLook(): MarkerImageLook | null;
187
+ /**
188
+ * An alias for the `lookConfig` attribute.
189
+ * @private
190
+ */
191
+ set startMarkerLook(startMarkerLook: MarkerImageLookConfig | null | undefined);
192
+ /**
193
+ * Look configuration used to derive the current look of the start marker of this connection.
194
+ * @private
195
+ */
196
+ get startMarkerLookConfig(): MarkerImageLookConfig | null | undefined;
175
197
  /**
176
198
  * Sets the look configuration of the start marker to override the one determined by the type.
177
199
  * `null` stands for no marker and `undefined` resets it to the one determined by the type.
178
200
  * @private
179
201
  */
180
- set startMarkerLook(startMarkerLook: MarkerImageLookConfig | null | undefined);
202
+ set startMarkerLookConfig(startMarkerLookConfig: MarkerImageLookConfig | null | undefined);
203
+ private _endMarkerLookConfig?;
181
204
  private _defaultEndMarkerLook?;
182
205
  private _selectedEndMarkerLook?;
183
206
  private _highlightedEndMarkerLook?;
@@ -187,12 +210,22 @@ export declare class DiagramConnection extends DiagramElement {
187
210
  * @private
188
211
  */
189
212
  get endMarkerLook(): MarkerImageLook | null;
213
+ /**
214
+ * An alias for the `lookConfig` attribute.
215
+ * @private
216
+ */
217
+ set endMarkerLook(endMarkerLook: MarkerImageLookConfig | null | undefined);
218
+ /**
219
+ * Look configuration used to derive the current look of the end marker of this connection.
220
+ * @private
221
+ */
222
+ get endMarkerLookConfig(): MarkerImageLookConfig | null | undefined;
190
223
  /**
191
224
  * Sets the look configuration of the end marker to override the one determined by the type.
192
225
  * `null` stands for no marker and `undefined` resets it to the one determined by the type.
193
226
  * @private
194
227
  */
195
- set endMarkerLook(endMarkerLook: MarkerImageLookConfig | null | undefined);
228
+ set endMarkerLookConfig(endMarkerLookConfig: MarkerImageLookConfig | null | undefined);
196
229
  constructor(model: DiagramModel, type: DiagramConnectionType, start: DiagramPort | undefined, end: DiagramPort | undefined, id: string);
197
230
  get removed(): boolean;
198
231
  updateInView(): void;
@@ -176,6 +176,7 @@ export declare class DiagramNode extends DiagramElement implements LabeledElemen
176
176
  */
177
177
  get name(): string;
178
178
  set name(name: string);
179
+ private _lookConfig?;
179
180
  private _defaultLook?;
180
181
  private _selectedLook?;
181
182
  private _highlightedLook?;
@@ -185,12 +186,22 @@ export declare class DiagramNode extends DiagramElement implements LabeledElemen
185
186
  * @private
186
187
  */
187
188
  get look(): NodeLook;
189
+ /**
190
+ * An alias for the `lookConfig` attribute.
191
+ * @private
192
+ */
193
+ set look(look: ShapedLookConfig | ImageLookConfig | StretchableImageLookConfig | undefined);
194
+ /**
195
+ * Look configuration used to derive the current look of this node.
196
+ * @private
197
+ */
198
+ get lookConfig(): ShapedLookConfig | ImageLookConfig | StretchableImageLookConfig | undefined;
188
199
  /**
189
200
  * Sets the look configuration of the look to override the one determined by the type.
190
201
  * `undefined` resets it to the one determined by the type.
191
202
  * @private
192
203
  */
193
- set look(look: ShapedLookConfig | ImageLookConfig | StretchableImageLookConfig | undefined);
204
+ set lookConfig(lookConfig: ShapedLookConfig | ImageLookConfig | StretchableImageLookConfig | undefined);
194
205
  constructor(model: DiagramModel, type: DiagramNodeType, coords: Point | undefined, id: string);
195
206
  get removed(): boolean;
196
207
  updateInView(): void;
@@ -134,6 +134,7 @@ export declare class DiagramPort extends DiagramElement implements LabeledElemen
134
134
  */
135
135
  get name(): string;
136
136
  set name(name: string);
137
+ private _lookConfig?;
137
138
  private _defaultLook?;
138
139
  private _selectedLook?;
139
140
  private _highlightedLook?;
@@ -143,12 +144,22 @@ export declare class DiagramPort extends DiagramElement implements LabeledElemen
143
144
  * @private
144
145
  */
145
146
  get look(): PortLook;
147
+ /**
148
+ * An alias for the `lookConfig` attribute.
149
+ * @private
150
+ */
151
+ set look(look: ShapedLookConfig | ImageLookConfig | undefined);
152
+ /**
153
+ * Look configuration used to derive the current look of this port.
154
+ * @private
155
+ */
156
+ get lookConfig(): ShapedLookConfig | ImageLookConfig | undefined;
146
157
  /**
147
158
  * Sets the look configuration of the look to override the one determined by the type.
148
159
  * `undefined` resets it to the one determined by the type.
149
160
  * @private
150
161
  */
151
- set look(look: ShapedLookConfig | ImageLookConfig | undefined);
162
+ set lookConfig(lookConfig: ShapedLookConfig | ImageLookConfig | undefined);
152
163
  /**
153
164
  * Current width of this port.
154
165
  * @private
@@ -122,6 +122,7 @@ export declare class DiagramSection extends DiagramElement implements LabeledEle
122
122
  */
123
123
  get name(): string;
124
124
  set name(name: string);
125
+ private _lookConfig?;
125
126
  private _defaultLook?;
126
127
  private _selectedLook?;
127
128
  private _highlightedLook?;
@@ -131,12 +132,22 @@ export declare class DiagramSection extends DiagramElement implements LabeledEle
131
132
  * @private
132
133
  */
133
134
  get look(): NodeLook;
135
+ /**
136
+ * An alias for the `lookConfig` attribute.
137
+ * @private
138
+ */
139
+ set look(look: ShapedLookConfig | ImageLookConfig | StretchableImageLookConfig | undefined);
140
+ /**
141
+ * Look configuration used to derive the current look of this section.
142
+ * @private
143
+ */
144
+ get lookConfig(): ShapedLookConfig | ImageLookConfig | StretchableImageLookConfig | undefined;
134
145
  /**
135
146
  * Sets the look configuration of the look to override the one determined by the type.
136
147
  * `undefined` resets it to the one determined by the type.
137
148
  * @private
138
149
  */
139
- set look(look: ShapedLookConfig | ImageLookConfig | StretchableImageLookConfig | undefined);
150
+ set lookConfig(lookConfig: ShapedLookConfig | ImageLookConfig | StretchableImageLookConfig | undefined);
140
151
  constructor(model: DiagramModel, node: DiagramNode | undefined, indexXInNode: number, indexYInNode: number, coords: Point, width: number, height: number, id: string);
141
152
  get removed(): boolean;
142
153
  updateInView(): void;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Clones an object with support for functions.
3
+ * @private
4
+ */
5
+ export declare const clone: <T>(o: T) => T;
@@ -1,9 +1,4 @@
1
1
  import { DiagramConfig } from '../diagram/config/diagram-config';
2
- /**
3
- * Creates the structuredClone function if it doesn't exist.
4
- * @private
5
- */
6
- export declare const createStructuredClone: () => void;
7
2
  /**
8
3
  * Generic diagram configuration used for testing.
9
4
  * @private