@metadev/daga 1.3.1 → 1.4.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.
Files changed (38) hide show
  1. package/Changelog.md +24 -0
  2. package/assets/styles/_diagram-buttons.scss +71 -37
  3. package/assets/styles/_palette.scss +12 -4
  4. package/assets/styles/_property-editor.scss +0 -3
  5. package/assets/styles/daga.scss +9 -5
  6. package/fesm2022/metadev-daga.mjs +3063 -2589
  7. package/fesm2022/metadev-daga.mjs.map +1 -1
  8. package/index.d.ts +1 -1
  9. package/lib/diagram/diagram.component.d.ts +28 -3
  10. package/lib/diagram-buttons/diagram-buttons.component.d.ts +14 -3
  11. package/lib/diagram-editor/diagram/converters/daga-model.d.ts +5 -0
  12. package/lib/diagram-editor/diagram/diagram-action.d.ts +61 -10
  13. package/lib/diagram-editor/diagram/diagram-canvas.d.ts +25 -7
  14. package/lib/diagram-editor/diagram/diagram-config.d.ts +199 -41
  15. package/lib/diagram-editor/diagram/diagram-connection.d.ts +1 -0
  16. package/lib/diagram-editor/diagram/diagram-element.d.ts +10 -0
  17. package/lib/diagram-editor/diagram/diagram-field.d.ts +11 -4
  18. package/lib/diagram-editor/diagram/diagram-model.d.ts +0 -16
  19. package/lib/diagram-editor/diagram/diagram-node.d.ts +5 -4
  20. package/lib/diagram-editor/diagram/diagram-port.d.ts +1 -0
  21. package/lib/diagram-editor/diagram/diagram-section.d.ts +40 -8
  22. package/lib/diagram-editor/diagram-editor.component.d.ts +2 -1
  23. package/lib/interfaces/canvas.d.ts +42 -17
  24. package/lib/palette/palette.component.d.ts +8 -6
  25. package/lib/property-editor/property-editor.component.d.ts +9 -4
  26. package/lib/services/canvas-provider.service.d.ts +1 -1
  27. package/lib/services/daga-configuration.service.d.ts +1 -1
  28. package/lib/util/events.d.ts +5 -1
  29. package/lib/util/style.d.ts +13 -0
  30. package/lib/util/text-util.d.ts +2 -0
  31. package/package.json +1 -1
  32. package/assets/config/generic-diagram.json +0 -94
  33. package/assets/icon/connection/arrow.svg +0 -23
  34. package/assets/icon/connection/empty-arrow.svg +0 -19
  35. package/assets/icon/connection/empty-diamond.svg +0 -20
  36. package/assets/icon/connection/filled-arrow.svg +0 -19
  37. package/assets/icon/connection/filled-diamond.svg +0 -20
  38. package/assets/icon/connection/line.svg +0 -9
package/index.d.ts CHANGED
@@ -9,7 +9,7 @@ export { DiagramModelExporter } from './lib/diagram-editor/diagram/converters/di
9
9
  export { DiagramModelImporter } from './lib/diagram-editor/diagram/converters/diagram-model-importer';
10
10
  export { ActionQueue, AddConnectionAction, AddNodeAction, DiagramAction, DiagramActions, EditFieldAction, MoveNodeAction, RemoveAction, StretchNodeAction, UpdateValuesAction } from './lib/diagram-editor/diagram/diagram-action';
11
11
  export { ACTION_QUEUE_SIZE, DiagramCanvas } from './lib/diagram-editor/diagram/diagram-canvas';
12
- export { ConnectionMarkerLook, ConnectionTemplateConfig, ConnectionTypeConfig, DiagramConfig, FieldConfig, NodeImageLook, NodeShapedLook, NodeStretchableImageLook, NodeTemplateConfig, NodeTypeConfig, PaletteConfig, PortConfig, SectionConfig } from './lib/diagram-editor/diagram/diagram-config';
12
+ export { ButtonsComponentConfig, ComponentsConfig, ConnectionMarkerLook, ConnectionTemplateConfig, ConnectionTypeConfig, DiagramConfig, ErrorsComponentConfig, FieldConfig, NodeImageLook, NodeShapedLook, NodeStretchableImageLook, NodeTemplateConfig, NodeTypeConfig, PaletteComponentConfig, PaletteSectionConfig, PortConfig, PropertyEditorComponentConfig, SectionConfig, SectionGridConfig, UserActionConfig } from './lib/diagram-editor/diagram/diagram-config';
13
13
  export { DiagramConnection, DiagramConnectionSet, DiagramConnectionType } from './lib/diagram-editor/diagram/diagram-connection';
14
14
  export { DiagramElement, DiagramEntity, DiagramEntitySet } from './lib/diagram-editor/diagram/diagram-element';
15
15
  export { DiagramField, DiagramFieldSet } from './lib/diagram-editor/diagram/diagram-field';
@@ -1,4 +1,5 @@
1
- import { OnInit } from '@angular/core';
1
+ import { AfterContentInit, AfterViewInit, EventEmitter, OnInit } from '@angular/core';
2
+ import { DagaModel } from '../diagram-editor/diagram/converters/daga-model';
2
3
  import { DiagramConfig } from '../diagram-editor/diagram/diagram-config';
3
4
  import { CanvasProviderService } from '../services/canvas-provider.service';
4
5
  import { DagaConfigurationService } from '../services/daga-configuration.service';
@@ -8,12 +9,36 @@ import * as i0 from "@angular/core";
8
9
  * This component defines a {@link DagaConfigurationService} and a {@link CanvasProviderService}, which is shared by all the components within and allows accessing the configuration and the canvas of this component's diagram, respectively.
9
10
  * @public
10
11
  */
11
- export declare class DiagramComponent implements OnInit {
12
+ export declare class DiagramComponent implements AfterContentInit, AfterViewInit, OnInit {
12
13
  private configurationService;
13
14
  private canvasProvider;
15
+ /**
16
+ * Configuration for the diagram.
17
+ * @public
18
+ */
14
19
  config: DiagramConfig;
20
+ private importer;
21
+ private exporter;
22
+ private _model;
23
+ /**
24
+ * Serialized model for the diagram. Used for data binding to the model.
25
+ * @public
26
+ */
27
+ get model(): DagaModel;
28
+ /**
29
+ * Serialized model for the diagram. Used for data binding to the model.
30
+ * @public
31
+ */
32
+ set model(model: DagaModel);
33
+ /**
34
+ * Output for changes to the diagram's model.
35
+ * @public
36
+ */
37
+ modelChange: EventEmitter<DagaModel>;
15
38
  constructor(configurationService: DagaConfigurationService, canvasProvider: CanvasProviderService);
16
39
  ngOnInit(): void;
40
+ ngAfterContentInit(): void;
41
+ ngAfterViewInit(): void;
17
42
  static ɵfac: i0.ɵɵFactoryDeclaration<DiagramComponent, never>;
18
- static ɵcmp: i0.ɵɵComponentDeclaration<DiagramComponent, "daga-diagram", never, { "config": { "alias": "config"; "required": false; }; }, {}, never, ["*"], true, never>;
43
+ static ɵcmp: i0.ɵɵComponentDeclaration<DiagramComponent, "daga-diagram", never, { "config": { "alias": "config"; "required": false; }; "model": { "alias": "model"; "required": false; }; }, { "modelChange": "modelChange"; }, never, ["*"], true, never>;
19
44
  }
@@ -1,16 +1,20 @@
1
- import { ElementRef } from '@angular/core';
1
+ import { AfterViewInit, ElementRef } from '@angular/core';
2
+ import { DiagramActions } from '../diagram-editor/diagram/diagram-action';
2
3
  import { Canvas } from '../interfaces/canvas';
3
4
  import { DiagramButtons } from '../interfaces/diagram-buttons';
4
5
  import { CanvasProviderService } from '../services/canvas-provider.service';
6
+ import { Corner, Side } from '../util/svg-util';
5
7
  import * as i0 from "@angular/core";
6
8
  /**
7
9
  * Buttons used to trigger diagram functionalities by the user.
8
10
  * @private
9
11
  */
10
- export declare class DiagramButtonsComponent implements DiagramButtons {
12
+ export declare class DiagramButtonsComponent implements AfterViewInit, DiagramButtons {
11
13
  private canvasProvider;
12
14
  get canvas(): Canvas;
13
15
  collapsableButtons: ElementRef<HTMLDivElement>;
16
+ location: Corner;
17
+ direction: Side;
14
18
  enableFilter: boolean;
15
19
  enableLayout: boolean;
16
20
  enableUndoRedo: boolean;
@@ -19,7 +23,14 @@ export declare class DiagramButtonsComponent implements DiagramButtons {
19
23
  filterOn: boolean;
20
24
  collapsed: boolean;
21
25
  animationOngoing: boolean;
26
+ private sizeAttribute;
27
+ private transformFunction;
28
+ private transformOrigin;
29
+ private marginSide;
30
+ private collapsableButtonsSize;
31
+ DiagramActions: typeof DiagramActions;
22
32
  constructor(canvasProvider: CanvasProviderService);
33
+ ngAfterViewInit(): void;
23
34
  toggleCollapse(): Promise<void>;
24
35
  zoomIn(): void;
25
36
  zoomOut(): void;
@@ -29,5 +40,5 @@ export declare class DiagramButtonsComponent implements DiagramButtons {
29
40
  undo(): void;
30
41
  redo(): void;
31
42
  static ɵfac: i0.ɵɵFactoryDeclaration<DiagramButtonsComponent, never>;
32
- static ɵcmp: i0.ɵɵComponentDeclaration<DiagramButtonsComponent, "daga-diagram-buttons", never, { "enableFilter": { "alias": "enableFilter"; "required": false; }; "enableLayout": { "alias": "enableLayout"; "required": false; }; "enableUndoRedo": { "alias": "enableUndoRedo"; "required": false; }; "enableZoom": { "alias": "enableZoom"; "required": false; }; "zoomRate": { "alias": "zoomRate"; "required": false; }; }, {}, never, never, true, never>;
43
+ static ɵcmp: i0.ɵɵComponentDeclaration<DiagramButtonsComponent, "daga-diagram-buttons", never, { "location": { "alias": "location"; "required": false; }; "direction": { "alias": "direction"; "required": false; }; "enableFilter": { "alias": "enableFilter"; "required": false; }; "enableLayout": { "alias": "enableLayout"; "required": false; }; "enableUndoRedo": { "alias": "enableUndoRedo"; "required": false; }; "enableZoom": { "alias": "enableZoom"; "required": false; }; "zoomRate": { "alias": "zoomRate"; "required": false; }; }, {}, never, never, true, never>;
33
44
  }
@@ -30,6 +30,8 @@ export interface DagaModel {
30
30
  label: string;
31
31
  }[];
32
32
  label: string;
33
+ indexXInNode: number;
34
+ indexYInNode: number;
33
35
  coords: Point;
34
36
  width: number;
35
37
  height: number;
@@ -61,4 +63,7 @@ export interface DagaModel {
61
63
  [key: string]: unknown;
62
64
  };
63
65
  }[];
66
+ data: {
67
+ [key: string]: unknown;
68
+ };
64
69
  }
@@ -13,6 +13,11 @@ import { DiagramSection } from './diagram-section';
13
13
  * @private
14
14
  */
15
15
  export declare class ActionQueue {
16
+ /**
17
+ * Canvas that this action queue belongs to.
18
+ * @private
19
+ */
20
+ canvas: Canvas;
16
21
  /**
17
22
  * Maximum number of actions that can be recorded simultaneously.
18
23
  * When new actions are added past this limit, older actions are removed.
@@ -29,7 +34,7 @@ export declare class ActionQueue {
29
34
  * @private
30
35
  */
31
36
  index: number;
32
- constructor(maximum: number);
37
+ constructor(canvas: Canvas, maximum: number);
33
38
  /**
34
39
  * Adds an action to the history.
35
40
  * @private
@@ -56,17 +61,63 @@ export interface DiagramAction {
56
61
  }
57
62
  /**
58
63
  * Enum listing the actions that can be taken by the user.
59
- * @private
64
+ * The actions can correspond to a DiagramAction that can be recorded in the action queue of a diagram or they may not correspond to any DiagramAction implementations.
65
+ * @public
60
66
  */
61
67
  export declare enum DiagramActions {
62
- AddConnectionAction = "add-connection",
63
- AddNodeAction = "add-node",
64
- EditFieldAction = "edit-field",
65
- MoveNodeAction = "move-node",
66
- RemoveAction = "remove",
67
- StretchNodeAction = "stretch-node",
68
- StretchSectionAction = "stretch-section",
69
- UpdateValuesAction = "update-values"
68
+ /**
69
+ * Action that corresponds to the addition of a connection.
70
+ * @see AddConnectionAction
71
+ * @public
72
+ */
73
+ AddConnection = "add-connection",
74
+ /**
75
+ * Action that corresponds to the addition of a node.
76
+ * @see AddNodeAction
77
+ * @public
78
+ */
79
+ AddNode = "add-node",
80
+ /**
81
+ * Action that corresponds to the edition of a field's text content.
82
+ * @see EditFieldAction
83
+ * @public
84
+ */
85
+ EditField = "edit-field",
86
+ /**
87
+ * Action that corresponds to moving a node.
88
+ * @see MoveNodeAction
89
+ * @public
90
+ */
91
+ MoveNode = "move-node",
92
+ /**
93
+ * Action that corresponds to removing elements.
94
+ * @see RemoveAction
95
+ * @public
96
+ */
97
+ Remove = "remove",
98
+ /**
99
+ * Action that corresponds to altering a node's dimensions.
100
+ * @see StretchNodeAction
101
+ * @public
102
+ */
103
+ StretchNode = "stretch-node",
104
+ /**
105
+ * Action that corresponds to altering a sections's dimensions.
106
+ * @see StretchSectionAction
107
+ * @public
108
+ */
109
+ StretchSection = "stretch-section",
110
+ /**
111
+ * Action that corresponds to changing the values of a value set.
112
+ * @see UpdateValuesAction
113
+ * @public
114
+ */
115
+ UpdateValues = "update-values",
116
+ /**
117
+ * Action that corresponds to changing the view point of a diagram by zooming or panning.
118
+ * @public
119
+ */
120
+ Zoom = "zoom"
70
121
  }
71
122
  /**
72
123
  * Action which consists of adding a node.
@@ -11,6 +11,7 @@ import { DiagramElement } from './diagram-element';
11
11
  import { DiagramModel } from './diagram-model';
12
12
  import { DiagramPort } from './diagram-port';
13
13
  import { ValueSet } from './diagram-property';
14
+ import { CursorStyle } from '../../util/style';
14
15
  /**
15
16
  * Thickness of the invisible path around a connection used to make it easier to click on, in pixels.
16
17
  * @private
@@ -37,13 +38,11 @@ export declare class DiagramCanvas implements Canvas {
37
38
  parentComponent: DiagramEditor;
38
39
  diagramRoot: HTMLElement;
39
40
  model: DiagramModel;
40
- color: string;
41
+ backgroundColor: string;
41
42
  gridSize: number;
42
43
  snapToGrid: boolean;
43
44
  guessConnectionType: boolean;
44
45
  connectionType?: DiagramConnectionType;
45
- priorityThreshold?: number;
46
- priorityThresholds: number[];
47
46
  validators: DiagramValidator[];
48
47
  layoutFormat?: string;
49
48
  userActions: {
@@ -54,22 +53,31 @@ export declare class DiagramCanvas implements Canvas {
54
53
  private backgroundPatternId;
55
54
  private zoomBehavior;
56
55
  private zoomTransform;
56
+ private priorityThreshold?;
57
+ private priorityThresholds;
57
58
  private mainUserHighlight?;
58
59
  private userHighlight;
59
60
  private userSelection;
60
61
  private propertyEditorSelection?;
61
62
  private propertyEditorValues?;
62
63
  private unfinishedConnection?;
64
+ /**
65
+ * Invisible path followed by an unfinished connection. Used for making unfinished connections stop before the cursor rather than stopping right at the cursor.
66
+ */
67
+ private unfinishedConnectionTracer?;
63
68
  private inputFieldContainer?;
64
69
  private draggingFrom;
65
70
  private currentAction?;
66
71
  viewInitialized$: Subject<void>;
67
72
  validatorChanges$: Subject<void>;
68
- diagramChanges$: Subject<number>;
73
+ diagramChanges$: Subject<void>;
69
74
  diagramImportantChanges$: Subject<void>;
70
75
  constructor(parentComponent: DiagramEditor, config: DiagramConfig);
71
76
  addValidator(validator: DiagramValidator): void;
72
77
  removeValidator(validator: DiagramValidator): void;
78
+ getPriorityThresholdOptions(): number[] | undefined;
79
+ getPriorityThreshold(): number | undefined;
80
+ setPriorityThreshold(priority: number): void;
73
81
  initView(appendTo: HTMLElement): void;
74
82
  zoomBy(zoom: number): void;
75
83
  zoomTo(zoom: number): void;
@@ -88,23 +96,33 @@ export declare class DiagramCanvas implements Canvas {
88
96
  updateFieldsInView(...ids: string[]): void;
89
97
  updateConnectionLabelsInView(connection: DiagramConnection): void;
90
98
  updateConnectionMarkersInView(connection: DiagramConnection): void;
99
+ fitFieldRootInView(id: string): void;
100
+ fitNodeInView(id: string): void;
91
101
  selectRoot(): d3.Selection<d3.BaseType, unknown, null, unknown>;
92
- selectCanvas(): d3.Selection<SVGGElement, unknown, null, unknown>;
93
102
  selectCanvasView(): d3.Selection<SVGGElement, unknown, null, unknown>;
103
+ selectCanvasElements(): d3.Selection<SVGGElement, unknown, null, unknown>;
104
+ selectCanvasNodes(): d3.Selection<SVGGElement, unknown, null, unknown>;
105
+ selectCanvasSections(): d3.Selection<SVGGElement, unknown, null, unknown>;
106
+ selectCanvasPorts(): d3.Selection<SVGGElement, unknown, null, unknown>;
107
+ selectCanvasConnections(): d3.Selection<SVGGElement, unknown, null, unknown>;
108
+ selectCanvasFields(): d3.Selection<SVGGElement, unknown, null, unknown>;
94
109
  startConnection(port: DiagramPort): void;
95
110
  finishConnection(port: DiagramPort): void;
96
111
  dropConnection(): void;
97
112
  highlight(element: DiagramElement): void;
98
113
  unhighlight(): void;
99
- setPropertyEditorSelection(selection?: DiagramElement & {
114
+ setPropertyEditorSelection(selection?: {
100
115
  valueSet: ValueSet;
101
- }): void;
116
+ } & (DiagramElement | DiagramModel)): void;
102
117
  isInUserSelection(selection: DiagramElement): boolean;
103
118
  addToUserSelection(selection: DiagramElement): void;
104
119
  removeFromUserSelection(selection: DiagramElement): void;
105
120
  toggleUserSelection(selection: DiagramElement): void;
106
121
  clearUserSelection(): void;
107
122
  cancelAllUserActions(): void;
123
+ canUserPerformAction(action: DiagramActions): boolean;
108
124
  private createInputField;
109
125
  private removeInputField;
126
+ private minimumSizeOfField;
110
127
  }
128
+ export declare const cursorStyle: (style?: CursorStyle) => void;
@@ -1,7 +1,7 @@
1
1
  import { Point } from '../../util/canvas-util';
2
2
  import { LineShape, LineStyle } from '../../util/line';
3
3
  import { ClosedShape } from '../../util/shape';
4
- import { HorizontalAlign, Side, VerticalAlign } from '../../util/svg-util';
4
+ import { Corner, HorizontalAlign, Side, VerticalAlign } from '../../util/svg-util';
5
5
  import { DiagramActions } from './diagram-action';
6
6
  import { Property } from './diagram-property';
7
7
  /**
@@ -23,7 +23,7 @@ export interface DiagramConfig {
23
23
  * Background color of this diagram.
24
24
  * @default "#FFFFFF"
25
25
  */
26
- color?: string;
26
+ backgroundColor?: string;
27
27
  /**
28
28
  * Distance between each point of the grid of this diagram in pixels. 0 or negative is interpreted as no grid.
29
29
  * @default 0
@@ -44,13 +44,9 @@ export interface DiagramConfig {
44
44
  * @default undefined
45
45
  */
46
46
  defaultConnection?: string;
47
- /**
48
- * Initial threshold value used to hide nodes whose priority value is below it.
49
- * @default undefined
50
- */
51
- defaultPriorityThreshold?: number;
52
47
  /**
53
48
  * Possible values of the priority threshold that the user can toggle between to hide nodes whose priority value is below it.
49
+ * If it is possible to toggle the priority threshold via the filter button, it should have at least two values.
54
50
  * @default []
55
51
  */
56
52
  priorityThresholds?: number[];
@@ -66,11 +62,10 @@ export interface DiagramConfig {
66
62
  */
67
63
  userActions?: UserActionConfig;
68
64
  /**
69
- * Configuration for the palettes of this diagram. Each configuration provided will configure one palette, which will be displayed as one of the tabs in the palette component.
70
- * @see PaletteComponent
71
- * @default undefined
65
+ * Mapping of components to a boolean indicating whether those components are enabled.
66
+ * @default {}
72
67
  */
73
- palettes?: PaletteConfig[];
68
+ components?: ComponentsConfig;
74
69
  /**
75
70
  * Default attributes for each of the types of node of this diagram.
76
71
  * @default undefined
@@ -105,12 +100,152 @@ export interface DiagramConfig {
105
100
  export type UserActionConfig = {
106
101
  [key in DiagramActions]?: boolean;
107
102
  };
103
+ /**
104
+ * Configuration for the components of the diagram.
105
+ * @public
106
+ */
107
+ export type ComponentsConfig = {
108
+ /**
109
+ * Configuration for the buttons component in the diagram.
110
+ */
111
+ buttons?: ButtonsComponentConfig;
112
+ /**
113
+ * Configuration for the errors component in the diagram.
114
+ */
115
+ errors?: ErrorsComponentConfig;
116
+ /**
117
+ * Configuration for the palette component in the diagram.
118
+ */
119
+ palette?: PaletteComponentConfig;
120
+ /**
121
+ * Configuration for the property editor component in the diagram.
122
+ */
123
+ propertyEditor?: PropertyEditorComponentConfig;
124
+ };
125
+ /**
126
+ * Configuration for the buttons component in a diagram.
127
+ * @see DiagramButtonsComponent
128
+ * @public
129
+ */
130
+ export interface ButtonsComponentConfig {
131
+ /**
132
+ * Whether this component is present in the diagram.
133
+ * @default true
134
+ */
135
+ exists?: boolean;
136
+ /**
137
+ * Location of this component in the screen.
138
+ * @default 'bottom-right'
139
+ */
140
+ location?: Corner;
141
+ /**
142
+ * Direction that this component extends towards.
143
+ * @default 'top'
144
+ */
145
+ direction?: Side;
146
+ /**
147
+ * Whether to enable the filter button in this component.
148
+ * @default true
149
+ */
150
+ enableFilter?: boolean;
151
+ /**
152
+ * Whether to enable the layout button in this component.
153
+ * @default true
154
+ */
155
+ enableLayout?: boolean;
156
+ /**
157
+ * Whether to enable the undo and redo buttons in this component.
158
+ * @default true
159
+ */
160
+ enableUndoRedo?: boolean;
161
+ /**
162
+ * Whether to enable the zoom button in this component.
163
+ * @default true
164
+ */
165
+ enableZoom?: boolean;
166
+ /**
167
+ * The rate by which the zoom level increases or decreses in this component.
168
+ * @default 2
169
+ */
170
+ zoomRate?: number;
171
+ }
172
+ /**
173
+ * Configuration for the errors component in a diagram.
174
+ * @see ErrorsComponent
175
+ * @public
176
+ */
177
+ export interface ErrorsComponentConfig {
178
+ /**
179
+ * Whether this component is present in the diagram.
180
+ * @default true
181
+ */
182
+ exists?: boolean;
183
+ }
184
+ /**
185
+ * Configuration for the palette component in a diagram.
186
+ * @see PaletteComponent
187
+ * @public
188
+ */
189
+ export interface PaletteComponentConfig {
190
+ /**
191
+ * Whether this component is present in the diagram.
192
+ * @default true
193
+ */
194
+ exists?: boolean;
195
+ /**
196
+ * Location of this component in the screen.
197
+ * @default 'top-left'
198
+ */
199
+ location?: Corner;
200
+ /**
201
+ * Direction that this component extends towards.
202
+ * @default 'bottom'
203
+ */
204
+ direction?: Side;
205
+ /**
206
+ * Dimension of this component in the direction perpendicular to the direction that it extends towards.
207
+ * @default '12rem'
208
+ */
209
+ width?: string;
210
+ /**
211
+ * Configuration for the sections of this palette.
212
+ * @default undefined
213
+ */
214
+ sections?: PaletteSectionConfig[];
215
+ }
216
+ /**
217
+ * Configuration for the property editor component in a diagram.
218
+ * @see PropertyEditorComponent
219
+ * @public
220
+ */
221
+ export interface PropertyEditorComponentConfig {
222
+ /**
223
+ * Whether this component is present in the diagram.
224
+ * @default true
225
+ */
226
+ exists?: boolean;
227
+ /**
228
+ * Location of this component in the screen.
229
+ * @default 'top-right'
230
+ */
231
+ location?: Corner;
232
+ /**
233
+ * Direction that this component extends towards.
234
+ * @default 'bottom'
235
+ */
236
+ direction?: Side;
237
+ /**
238
+ * Dimension of this component in the direction perpendicular to the direction that it extends towards.
239
+ * @default '24rem'
240
+ */
241
+ width?: string;
242
+ }
108
243
  /**
109
244
  * Configuration for a palette.
110
245
  * @see PaletteComponent
111
246
  * @public
112
247
  */
113
- export interface PaletteConfig {
248
+ export interface PaletteSectionConfig {
114
249
  /**
115
250
  * Name of this palette. Displayed in the tab of this palette in the palette component. Can be left undefined if this is the only palette.
116
251
  */
@@ -143,7 +278,11 @@ export interface NodeTemplateConfig {
143
278
  /**
144
279
  * Label of this template as it appears on the palette and label that will be given to nodes created from this template.
145
280
  */
146
- label: string;
281
+ label?: string;
282
+ /**
283
+ * Look of the label of this template as it appears on the palette. By default, the label of the type of node is used.
284
+ */
285
+ labelLook?: FieldConfig | null;
147
286
  /**
148
287
  * Default values of the properties of nodes created from this template.
149
288
  */
@@ -172,7 +311,7 @@ export interface ConnectionTemplateConfig {
172
311
  /**
173
312
  * Background color of this template as it appears on the palette.
174
313
  */
175
- color: string;
314
+ backgroundColor: string;
176
315
  /**
177
316
  * File path of the background image of this template as it appears on the palette.
178
317
  */
@@ -202,22 +341,22 @@ export interface NodeTypeConfig {
202
341
  name?: string;
203
342
  /**
204
343
  * Default width of nodes of this type in pixels.
205
- * @default 0
344
+ * @default 1
206
345
  */
207
346
  defaultWidth?: number;
208
347
  /**
209
348
  * Default height of nodes of this type in pixels.
210
- * @default 0
349
+ * @default 1
211
350
  */
212
351
  defaultHeight?: number;
213
352
  /**
214
353
  * Minimum width of nodes of this type in pixels.
215
- * @default 0
354
+ * @default 1
216
355
  */
217
356
  minWidth?: number;
218
357
  /**
219
358
  * Minimum height of nodes of this type in pixels.
220
- * @default 0
359
+ * @default 1
221
360
  */
222
361
  minHeight?: number;
223
362
  /**
@@ -235,19 +374,19 @@ export interface NodeTypeConfig {
235
374
  * @default null
236
375
  */
237
376
  label?: FieldConfig | null;
377
+ /**
378
+ * Configuration for the sections of nodes of this type or null if nodes of this type have no sections.
379
+ * @default null
380
+ */
381
+ sectionGrid?: SectionGridConfig | null;
238
382
  /**
239
383
  * Configuration of the ports of nodes of this type.
240
384
  * @default []
241
385
  */
242
386
  ports?: PortConfig[];
243
- /**
244
- * Configuration for the sections of this diagram if applicable.
245
- * @default null
246
- */
247
- sections?: SectionConfig | null;
248
387
  /**
249
388
  * Configuration of the look of nodes of this type as it should appear to the user.
250
- * @default {lookType: 'shaped-look', shape: ClosedShape.Rectangle, color: '#FFFFFF', borderColor: '#000000', selectedColor: '#FFFFFF', selectedBorderColor: '#000000'}
389
+ * @default {lookType: 'shaped-look', shape: ClosedShape.Rectangle, fillColor: '#FFFFFF', borderColor: '#000000', selectedFillColor: '#FFFFFF', selectedBorderColor: '#000000'}
251
390
  */
252
391
  look?: NodeShapedLook | NodeImageLook | NodeStretchableImageLook;
253
392
  /**
@@ -319,6 +458,12 @@ export interface FieldConfig {
319
458
  * @default 'center'
320
459
  */
321
460
  verticalAlign?: VerticalAlign;
461
+ /**
462
+ * Whether this field and its root element should be resized automatically if the size of the text increases.
463
+ * Setting this to true should also entail setting reasonable `minWidth` and `minHeight` values for the configuration of any nodes or sections that contain this field.
464
+ * @default false
465
+ */
466
+ fit?: boolean;
322
467
  }
323
468
  /**
324
469
  * Configuration for a port that is part of another element.
@@ -341,36 +486,44 @@ export interface PortConfig {
341
486
  label?: FieldConfig | null;
342
487
  }
343
488
  /**
344
- * Configuration for the sections of a node.
489
+ * Configuration for the grid of sections of a node.
345
490
  * @see DiagramSection
346
491
  * @public
347
492
  */
348
- export interface SectionConfig {
493
+ export interface SectionGridConfig {
349
494
  /**
350
- * The number of sections this node can accomodate along the x axis.
351
- * @default 1
495
+ * Default widths of each column of sections of this grid in pixels.
352
496
  */
353
- sectionsX?: number;
497
+ defaultWidths?: number[];
354
498
  /**
355
- * The number of sections this node can accomodate along the y axis.
356
- * @default 1
499
+ * Default heights of each row of sections of this grid in pixels.
357
500
  */
358
- sectionsY?: number;
501
+ defaultHeights?: number[];
359
502
  /**
360
- * Minimum width of sections of this node in pixels.
361
- * @default 0
503
+ * Minimum widths of each column of sections of this grid in pixels.
362
504
  */
363
- minWidth?: number;
505
+ minWidths?: number[];
364
506
  /**
365
- * Minimum height of sections of this node in pixels.
366
- * @default 0
507
+ * Minimum heights of each row of sections of this grid in pixels.
367
508
  */
368
- minHeight?: number;
509
+ minHeights?: number[];
369
510
  /**
370
- * The margin left around sections in pixels.
511
+ * The margin left around the sections of this grid in pixels.
371
512
  * @default 0
372
513
  */
373
514
  margin?: number;
515
+ /**
516
+ * Configuration for the sections of this grid.
517
+ * @default [[]]
518
+ */
519
+ sections: SectionConfig[][];
520
+ }
521
+ /**
522
+ * Configuration for a section of a node.
523
+ * @see DiagramSection
524
+ * @public
525
+ */
526
+ export interface SectionConfig {
374
527
  /**
375
528
  * Configuration for the label of the sections.
376
529
  * @default null
@@ -386,6 +539,11 @@ export interface SectionConfig {
386
539
  * @default {lookType: 'shaped-look', shape: ClosedShape.Rectangle, color: '#FFFFFF', borderColor: '#000000', selectedColor: '#FFFFFF', selectedBorderColor: '#000000'}
387
540
  */
388
541
  look?: NodeShapedLook | NodeImageLook | NodeStretchableImageLook;
542
+ /**
543
+ * The priority of this section when filtering out sections below a given threshold.
544
+ * @default 0
545
+ */
546
+ priority?: number;
389
547
  }
390
548
  /**
391
549
  * Configuration for the look of a node given by shape and color.
@@ -403,7 +561,7 @@ export interface NodeShapedLook {
403
561
  /**
404
562
  * Background color of nodes using this look.
405
563
  */
406
- color: string;
564
+ fillColor: string;
407
565
  /**
408
566
  * Border color of nodes using this look.
409
567
  */
@@ -411,7 +569,7 @@ export interface NodeShapedLook {
411
569
  /**
412
570
  * Background color of nodes using this look when selected.
413
571
  */
414
- selectedColor: string;
572
+ selectedFillColor: string;
415
573
  /**
416
574
  * Border color of nodes using this look when selected.
417
575
  */