@metadev/daga 5.0.5 → 5.1.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metadev/daga",
3
- "version": "5.0.5",
3
+ "version": "5.1.1",
4
4
  "license": "SEE LICENSE IN LICENSE.md",
5
5
  "dependencies": {},
6
6
  "peerDependencies": {
package/src/index.d.ts CHANGED
@@ -7,14 +7,14 @@ export { DiagramUserSelection } from './lib/diagram/canvas/diagram-user-selectio
7
7
  export type { CollabAction, CollabActionSerialized } from './lib/diagram/collab/collab-action';
8
8
  export { CollabClient } from './lib/diagram/collab/collab-client';
9
9
  export type { CollabTimestamp, CollabTimestampSet } from './lib/diagram/collab/primitives';
10
- export type { CanvasConfig, GridConfig, GridStyle } from './lib/diagram/config/diagram-canvas-config';
10
+ export type { CanvasConfig, GridConfig, GridStyle, EmptyGridConfig, DotsGridConfig, LinesGridConfig, ImageGridConfig, BackgroundStyle, BackgroundConfig, SolidBackgroundConfig, ImageBackgroundConfig, ContextMenuConfig, ContextMenuButtonConfig } from './lib/diagram/config/diagram-canvas-config';
11
11
  export type { ButtonsComponentConfig, ComponentsConfig, ConnectionTemplateConfig, ErrorsComponentConfig, NodeTemplateConfig, PaletteComponentConfig, PaletteSectionConfig, PropertyEditorComponentConfig } from './lib/diagram/config/diagram-components-config';
12
12
  export { ResizableMode } from './lib/diagram/config/diagram-config';
13
13
  export type { ConnectionTypeConfig, DiagramConfig, FieldConfig, NodeTypeConfig, PortConfig, PortTypeConfig, SectionConfig, SectionGridConfig, UserActionConfig } from './lib/diagram/config/diagram-config';
14
14
  export type { ConnectionLook, ConnectionLookConfig, ImageLook, ImageLookConfig, Look, LookConfig, MarkerImageLook, MarkerImageLookConfig, ShapedLook, ShapedLookConfig, StretchableImageLook, StretchableImageLookConfig } from './lib/diagram/config/diagram-look-config';
15
15
  export { DagaExporter } from './lib/diagram/converters/daga-exporter';
16
16
  export { DagaImporter } from './lib/diagram/converters/daga-importer';
17
- export type { DagaConnection, DagaModel, DagaNode, DagaPort, DagaSection } from './lib/diagram/converters/daga-model';
17
+ export type { DagaConnection, DagaModel, DagaNode, DagaPort, DagaSection, DagaObject, DagaDecorator } from './lib/diagram/converters/daga-model';
18
18
  export type { DiagramModelExporter } from './lib/diagram/converters/diagram-model-exporter';
19
19
  export type { DiagramModelImporter } from './lib/diagram/converters/diagram-model-importer';
20
20
  export { ActionStack, AddConnectionAction, AddNodeAction, ApplyLayoutAction, DiagramActionMethod, DiagramActions, EditFieldAction, MoveAction, PasteAction, RemoveAction, SetGeometryAction, SetParentAction, UpdateValuesAction } from './lib/diagram/diagram-action';
@@ -3,6 +3,7 @@ import { Point } from '../../util/canvas-util';
3
3
  import { LineFunction, LineShape, LineStyle } from '../../util/line';
4
4
  import { CursorStyle } from '../../util/style';
5
5
  import { Side } from '../../util/svg-util';
6
+ import { BackgroundConfig, DotsGridConfig, EmptyGridConfig, GridConfig, SolidBackgroundConfig } from '../config/diagram-canvas-config';
6
7
  import { DiagramField } from '../model/diagram-field';
7
8
  import { DiagramNode } from '../model/diagram-node';
8
9
  import { DiagramPort } from '../model/diagram-port';
@@ -25,6 +26,7 @@ export declare const setCursorStyle: (style?: CursorStyle) => void;
25
26
  export declare const getRelatedNodeOrItself: (element: DiagramNode | DiagramSection | DiagramPort | DiagramField) => DiagramNode | DiagramSection | DiagramPort | DiagramField;
26
27
  export declare const needsResizerX: (element: DiagramNode | DiagramSection) => boolean;
27
28
  export declare const needsResizerY: (element: DiagramNode | DiagramSection) => boolean;
29
+ export declare const needsResizerXY: (element: DiagramNode | DiagramSection) => boolean;
28
30
  export declare const initializeLook: (selection: d3.Selection<SVGGElement, DiagramNode | DiagramSection | DiagramPort, d3.BaseType, unknown>) => void;
29
31
  export declare const SHAPED_LOOK_DEFAULTS: {
30
32
  fillColor: string;
@@ -33,12 +35,11 @@ export declare const SHAPED_LOOK_DEFAULTS: {
33
35
  borderStyle: LineStyle;
34
36
  };
35
37
  export declare const updateLook: (selection: d3.Selection<SVGGElement, DiagramNode | DiagramSection | DiagramPort, d3.BaseType, unknown>) => void;
36
- export declare const GRID_DEFAULTS: {
37
- enabled: boolean;
38
- style: string;
39
- color: string;
40
- snap: boolean;
41
- spacing: number;
42
- thickness: number;
43
- };
44
- export declare const initializeGrid: (canvas: DiagramCanvas, canvasView: d3.Selection<SVGGElement, unknown, null, unknown>, backgroundPatternId: string) => void;
38
+ export declare const BACKGROUND_DEFAULTS: SolidBackgroundConfig;
39
+ export declare const GRID_DEFAULTS: EmptyGridConfig;
40
+ export declare const DOTS_GRID_DEFAULTS: DotsGridConfig;
41
+ export declare const initializeBackground: (canvasView: d3.Selection<SVGGElement, unknown, null, unknown>, backgroundConfig: BackgroundConfig | undefined | null) => d3.Selection<SVGRectElement, unknown, null, unknown> | d3.Selection<SVGImageElement, unknown, null, unknown>;
42
+ export declare const applyGridDefaults: (gridConfig?: GridConfig) => GridConfig;
43
+ export declare const initializeGrid: (canvas: DiagramCanvas, canvasView: d3.Selection<SVGGElement, unknown, null, unknown>, canvasDefs: d3.Selection<SVGDefsElement, unknown, null, unknown>, gridPatternId: string, gridConfig: GridConfig) => d3.Selection<SVGRectElement, unknown, null, unknown> | undefined;
44
+ export declare const getGridSpacingX: (gridConfig: GridConfig) => number;
45
+ export declare const getGridSpacingY: (gridConfig: GridConfig) => number;
@@ -5,7 +5,7 @@ import { Canvas } from '../../interfaces/canvas';
5
5
  import { DiagramEditor } from '../../interfaces/diagram-editor';
6
6
  import { Point } from '../../util/canvas-util';
7
7
  import { CollabEngine } from '../collab/collab-engine';
8
- import { GridStyle } from '../config/diagram-canvas-config';
8
+ import { BackgroundConfig, GridConfig } from '../config/diagram-canvas-config';
9
9
  import { DiagramConfig } from '../config/diagram-config';
10
10
  import { ActionStack, DiagramAction, DiagramActionMethod, DiagramActions } from '../diagram-action';
11
11
  import { DiagramEvent } from '../diagram-event';
@@ -19,11 +19,6 @@ import { DiagramUserSelection } from './diagram-user-selection';
19
19
  * @private
20
20
  */
21
21
  export declare const CONNECTION_PATH_BOX_THICKNESS = 12;
22
- /**
23
- * Thickness of the resizer line used to resize nodes and sections on drag, in diagram units.
24
- * @private
25
- */
26
- export declare const RESIZER_THICKNESS = 6;
27
22
  /**
28
23
  * Maximum number of user actions that can be recorded in the user action stack.
29
24
  * @private
@@ -40,12 +35,9 @@ export declare class DiagramCanvas implements Canvas {
40
35
  readonly contextMenu: DiagramContextMenu;
41
36
  readonly actionStack: ActionStack;
42
37
  readonly collabEngine: CollabEngine;
43
- backgroundColor: string;
44
- gridStyle: GridStyle;
45
- gridSize: number;
46
- gridThickness: number;
47
- gridColor: string;
48
- snapToGrid: boolean;
38
+ backgroundConfig: BackgroundConfig;
39
+ gridConfig: GridConfig;
40
+ ancillaryGridsConfig: GridConfig[];
49
41
  zoomFactor: number;
50
42
  panRate: number;
51
43
  inferConnectionType: boolean;
@@ -64,7 +56,8 @@ export declare class DiagramCanvas implements Canvas {
64
56
  userActions: {
65
57
  [key in DiagramActions]?: boolean;
66
58
  };
67
- private readonly backgroundPatternId;
59
+ private readonly gridPatternId;
60
+ private readonly ancillaryGridPatternIds;
68
61
  private zoomBehavior;
69
62
  private zoomTransform;
70
63
  private priorityThreshold?;
@@ -10,16 +10,23 @@ export interface CanvasConfig {
10
10
  */
11
11
  contextMenu?: ContextMenuConfig;
12
12
  /**
13
- * Configuration for the grid in the canvas.
13
+ * Configuration for the main grid in the canvas.
14
14
  * If left undefined, it is interpreted as disabling the grid,
15
15
  * same as if the attribute `enabled` in its configuration was set to `false`.
16
+ * The grid repeats with a period of diagram units determined by the `spacing` attribute.
16
17
  */
17
- grid?: GridConfig;
18
+ grid?: EmptyGridConfig | DotsGridConfig | LinesGridConfig | ImageGridConfig;
18
19
  /**
19
- * Background color of this diagram.
20
- * @default "#FFFFFF"
20
+ * Configuration for ancillary grids in the canvas.
21
+ * They accompany the main grid without affecting the diagram.
21
22
  */
22
- backgroundColor?: string;
23
+ ancillaryGrids?: (DotsGridConfig | LinesGridConfig | ImageGridConfig)[];
24
+ /**
25
+ * Configuration for the background of the canvas.
26
+ * If left undefined, it is interpreted as a solid white (`'#FFFFFF'`) background.
27
+ * The background of the canvas covers the entire canvas and does not move when changing the position or zoom.
28
+ */
29
+ background?: SolidBackgroundConfig | ImageBackgroundConfig;
23
30
  /**
24
31
  * The factor by which the zoom level increases or decreases when the user users buttons or keys to zoom in or out. Should be above 1.
25
32
  * @default 2
@@ -42,9 +49,12 @@ export interface CanvasConfig {
42
49
  */
43
50
  priorityThresholds?: number[];
44
51
  }
45
- export type GridStyle = 'dots' | 'lines';
46
52
  /**
47
- * Configuration of the guide grid in the background of the diagram.
53
+ * Possible styles for the grid of the diagram. Each corresponds to a different configuration with different attributes.
54
+ */
55
+ export type GridStyle = 'none' | 'dots' | 'lines' | 'image';
56
+ /**
57
+ * Configuration of the guide grid of the diagram.
48
58
  */
49
59
  export interface GridConfig {
50
60
  /**
@@ -56,28 +66,102 @@ export interface GridConfig {
56
66
  * The style of the grid.
57
67
  * @default "dots"
58
68
  */
59
- style?: GridStyle;
69
+ style: GridStyle;
60
70
  /**
61
- * Color of grid elements such as the points or axes.
62
- * @default "rgba(0, 0, 0, 0.1)"
71
+ * Distance between each point of the grid of this diagram in diagram units.
72
+ * @default 10
63
73
  */
64
- color?: string;
74
+ spacing?: number | [number, number];
65
75
  /**
66
76
  * When true, the user moving or stretching nodes will cause their corners to automatically snap to the closest grid point.
77
+ * Does not have an effect in ancillary grids.
67
78
  * @default false
68
79
  */
69
80
  snap?: boolean;
81
+ }
82
+ /**
83
+ * A grid with no points are marked by dots.
84
+ */
85
+ export interface EmptyGridConfig extends GridConfig {
86
+ style: 'none';
87
+ }
88
+ /**
89
+ * A grid where the points are marked by dots.
90
+ */
91
+ export interface DotsGridConfig extends GridConfig {
92
+ style: 'dots';
70
93
  /**
71
- * Distance between each point of the grid of this diagram in diagram units.
72
- * @default 10
94
+ * Color of grid elements such as the points or axes.
95
+ * @default "rgba(0, 0, 0, 0.1)"
96
+ */
97
+ color?: string;
98
+ /**
99
+ * In a range between 0 and 1, how thick the points of the grid are relative to the distance between them.
100
+ * @default 0.05
101
+ */
102
+ thickness?: number;
103
+ }
104
+ /**
105
+ * A grid where the points are marked by lines.
106
+ */
107
+ export interface LinesGridConfig extends GridConfig {
108
+ style: 'lines';
109
+ /**
110
+ * Color of grid elements such as the points or axes.
111
+ * @default "rgba(0, 0, 0, 0.1)"
73
112
  */
74
- spacing?: number;
113
+ color?: string;
75
114
  /**
76
115
  * In a range between 0 and 1, how thick the points of the grid are relative to the distance between them.
77
116
  * @default 0.05
78
117
  */
79
118
  thickness?: number;
80
119
  }
120
+ /**
121
+ * A grid which consists of an image.
122
+ */
123
+ export interface ImageGridConfig extends GridConfig {
124
+ style: 'image';
125
+ /**
126
+ * The source of the image to use as grid.
127
+ * This image is placed such that the 0,0 point of the diagram is in the center of the image.
128
+ */
129
+ image: string;
130
+ }
131
+ /**
132
+ * Possible styles for the background of the diagram. Each corresponds to a different configuration with different attributes.
133
+ */
134
+ export type BackgroundStyle = 'solid' | 'image';
135
+ /**
136
+ * Configuration of the background of the diagram.
137
+ */
138
+ export interface BackgroundConfig {
139
+ /**
140
+ * The style of the background.
141
+ */
142
+ style: BackgroundStyle;
143
+ }
144
+ /**
145
+ * A background which consists of a solid color.
146
+ */
147
+ export interface SolidBackgroundConfig extends BackgroundConfig {
148
+ style: 'solid';
149
+ /**
150
+ * The color of the background.
151
+ * @default '#FFFFFF'
152
+ */
153
+ color?: string;
154
+ }
155
+ /**
156
+ * A background which consists of an image.
157
+ */
158
+ export interface ImageBackgroundConfig extends BackgroundConfig {
159
+ style: 'image';
160
+ /**
161
+ * The source of the image to use as background.
162
+ */
163
+ image: string;
164
+ }
81
165
  export interface ContextMenuConfig {
82
166
  /**
83
167
  * Custom buttons to be added to the context menu.
@@ -106,6 +106,11 @@ export interface PaletteComponentConfig {
106
106
  * @default true
107
107
  */
108
108
  enabled?: boolean;
109
+ /**
110
+ * Whether this component is open (not collapsed) by default in the diagram.
111
+ * @default true
112
+ */
113
+ open?: boolean;
109
114
  /**
110
115
  * Location of this component in the screen.
111
116
  * @default 'top-left'
@@ -116,21 +121,26 @@ export interface PaletteComponentConfig {
116
121
  * @default 'bottom'
117
122
  */
118
123
  direction?: Side;
119
- /**
120
- * Dimension of this component in the direction that it extends towards. If undefined, it stretches as needed.
121
- * @default undefined
122
- */
123
- height?: string;
124
124
  /**
125
125
  * Dimension of this component in the direction perpendicular to the direction that it extends towards.
126
126
  * @default '12rem'
127
127
  */
128
128
  width?: string;
129
+ /**
130
+ * Dimension of this component in the direction that it extends towards.
131
+ * @default 'min-content'
132
+ */
133
+ length?: string;
129
134
  /**
130
135
  * Gap between the templates in this palette.
131
136
  * @default '1rem'
132
137
  */
133
138
  gap?: string;
139
+ /**
140
+ * Value of the `justify-content` property in the elemments of the palette.
141
+ * @default 'center'
142
+ */
143
+ justifyContent?: string;
134
144
  /**
135
145
  * Configuration for the sections of this palette. By default, no sections are created.
136
146
  * @default undefined
@@ -148,6 +158,11 @@ export interface PropertyEditorComponentConfig {
148
158
  * @default true
149
159
  */
150
160
  enabled?: boolean;
161
+ /**
162
+ * Whether this component is open (not collapsed) by default in the diagram.
163
+ * @default true
164
+ */
165
+ open?: boolean;
151
166
  /**
152
167
  * Location of this component in the screen.
153
168
  * @default 'top-right'
@@ -164,10 +179,10 @@ export interface PropertyEditorComponentConfig {
164
179
  */
165
180
  width?: string;
166
181
  /**
167
- * Dimension of this component in the direction that it extends towards. If undefined, it stretches as needed.
168
- * @default undefined
182
+ * Dimension of this component in the direction that it extends towards.
183
+ * @default 'min-content'
169
184
  */
170
- height?: string;
185
+ length?: string;
171
186
  /**
172
187
  * Title that appears heading this component.
173
188
  * @default 'Diagram properties'
@@ -4,7 +4,7 @@ import { DiagramActions } from '../diagram-action';
4
4
  import { Property } from '../property/property';
5
5
  import { CanvasConfig } from './diagram-canvas-config';
6
6
  import { ComponentsConfig } from './diagram-components-config';
7
- import { ConnectionLookConfig, ImageLookConfig, MarkerImageLookConfig, ShapedLookConfig, StretchableImageLookConfig } from './diagram-look-config';
7
+ import { ConnectionLookConfig, FieldLookConfig, ImageLookConfig, MarkerImageLookConfig, ResizerLookConfig, ShapedLookConfig, StretchableImageLookConfig } from './diagram-look-config';
8
8
  /**
9
9
  * The configuration for a diagram.
10
10
  * @public
@@ -171,15 +171,20 @@ export interface NodeTypeConfig {
171
171
  */
172
172
  minHeight?: number;
173
173
  /**
174
- * Whether the user can resize nodes of this type along the x axis.
174
+ * Whether the user can resize nodes of this type horizontally.
175
175
  * @default false
176
176
  */
177
- resizableX?: boolean | ResizableMode;
177
+ resizableX?: boolean | ResizableMode | ResizerConfig;
178
178
  /**
179
- * Whether the user can resize nodes of this type along the y axis.
179
+ * Whether the user can resize nodes of this type vertically.
180
180
  * @default false
181
181
  */
182
- resizableY?: boolean | ResizableMode;
182
+ resizableY?: boolean | ResizableMode | ResizerConfig;
183
+ /**
184
+ * Whether the user can resize nodes of this type diagonally.
185
+ * @default false
186
+ */
187
+ resizableXY?: boolean | ResizableMode | ResizerConfig;
183
188
  /**
184
189
  * By how much the location of nodes of this type should be offset when snapping to grid in diagram units.
185
190
  * Each value corresponds to left, top, right and bottom respectively.
@@ -187,10 +192,11 @@ export interface NodeTypeConfig {
187
192
  */
188
193
  snapToGridOffset?: [number, number, number, number];
189
194
  /**
190
- * The padding between the node and its children in diagram units if children are present. May be a single value or an array, in which case the value is interpreted in the same way as in CSS padding.
195
+ * The padding between the node and its children in diagram units if children are present.
196
+ * May be a single number or an array of up to four numbers, in which case the value is interpreted in the same way as in CSS padding.
191
197
  * @default 0
192
198
  */
193
- padding?: number | number[];
199
+ padding?: number | [number] | [number, number] | [number, number, number] | [number, number, number, number];
194
200
  /**
195
201
  * Configuration for the label of nodes of this type.
196
202
  * @default null
@@ -336,41 +342,28 @@ export interface FieldConfig {
336
342
  */
337
343
  editable?: boolean;
338
344
  /**
339
- * The size of the font of this field in diagram units.
340
- * @default 0
345
+ * Whether this field and its root element should be resized automatically if the size of the text increases.
346
+ * 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.
347
+ * @default false
341
348
  */
342
- fontSize?: number;
349
+ fit?: boolean;
343
350
  /**
344
- * The margin around the field in diagram units. May be a single value or an array, in which case the value is interpreted in the same way as in CSS margin.
345
- * @default 0
351
+ * Whether when `fit` is enabled should the root element of the field also shrink if there is excess space.
352
+ * @default true
346
353
  */
347
- margin?: number | number[];
354
+ shrink?: boolean;
348
355
  /**
349
- * The padding around the field in diagram units. May be a single value or an array, in which case the value is interpreted in the same way as in CSS padding.
356
+ * The margin around the field in diagram units.
357
+ * May be a single number or an array of up to four numbers, in which case the value is interpreted in the same way as in CSS margin.
350
358
  * @default 0
351
359
  */
352
- padding?: number | number[];
360
+ margin?: number | [number] | [number, number] | [number, number, number] | [number, number, number, number];
353
361
  /**
354
- * The font family of the text of this field.
355
- * @default null
356
- * @see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/font-family |font-family}
357
- */
358
- fontFamily?: string | null;
359
- /**
360
- * The color of the text of this field.
361
- * @default '#000000'
362
- */
363
- color?: string;
364
- /**
365
- * The background color of the text of this field.
366
- * @default 'transparent'
367
- */
368
- backgroundColor?: string;
369
- /**
370
- * The color of the text of this field when selected.
371
- * @default '#000000'
362
+ * The padding around the field in diagram units.
363
+ * May be a single number or an array of up to four numbers, in which case the value is interpreted in the same way as in CSS padding.
364
+ * @default 0
372
365
  */
373
- selectedColor?: string;
366
+ padding?: number | [number] | [number, number] | [number, number, number] | [number, number, number, number];
374
367
  /**
375
368
  * The horizontal alignment of the text of this field.
376
369
  * @default 'center'
@@ -381,27 +374,20 @@ export interface FieldConfig {
381
374
  * @default 'center'
382
375
  */
383
376
  verticalAlign?: VerticalAlign;
384
- /**
385
- * The orientation of the text of this field. It may be a side or a number of degrees.
386
- * @default 'top'
387
- */
388
- orientation?: Side | number;
389
377
  /**
390
378
  * Whether this field can have multiple lines.
391
379
  * @default false
392
380
  */
393
381
  multiline?: boolean;
394
382
  /**
395
- * Whether this field and its root element should be resized automatically if the size of the text increases.
396
- * 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.
397
- * @default false
383
+ * The orientation of the text of this field. It may be a side or a number of degrees.
384
+ * @default 'top'
398
385
  */
399
- fit?: boolean;
386
+ orientation?: Side | number;
400
387
  /**
401
- * Whether when `fit` is enabled should the root element of the field also shrink if there is excess space.
402
- * @default true
388
+ * Configuration of the look this field as it should appear to the user.
403
389
  */
404
- shrink?: boolean;
390
+ look?: FieldLookConfig;
405
391
  }
406
392
  /**
407
393
  * Configuration for a decorator that is part of another element.
@@ -424,9 +410,9 @@ export interface DecoratorConfig {
424
410
  */
425
411
  height: number;
426
412
  /**
427
- * Inner HTML of this decorator.
413
+ * Inner SVG of this decorator.
428
414
  */
429
- html: string;
415
+ svg: string;
430
416
  /**
431
417
  * Horizontal anchor point for this decorator. Determines how the decorator behaves when its root element is resized.
432
418
  * - 'start': Always maintains the same distance from the left edge
@@ -509,13 +495,19 @@ export interface SectionConfig {
509
495
  * If undefined, inherits from the parent node's resizableX setting.
510
496
  * @default undefined
511
497
  */
512
- resizableX?: boolean | ResizableMode;
498
+ resizableX?: boolean | ResizableMode | ResizerConfig;
513
499
  /**
514
500
  * Whether this section can be resized vertically.
515
501
  * If undefined, inherits from the parent node's resizableY setting.
516
502
  * @default undefined
517
503
  */
518
- resizableY?: boolean | ResizableMode;
504
+ resizableY?: boolean | ResizableMode | ResizerConfig;
505
+ /**
506
+ * Whether this section can be resized diagonally.
507
+ * If undefined, inherits from the parent node's resizableXY setting.
508
+ * @default undefined
509
+ */
510
+ resizableXY?: boolean | ResizableMode | ResizerConfig;
519
511
  }
520
512
  /**
521
513
  * Configuration for a type of connection.
@@ -566,6 +558,51 @@ export interface ConnectionTypeConfig {
566
558
  */
567
559
  properties?: Property[];
568
560
  }
561
+ /**
562
+ * Configuration for the resizers of a node or section.
563
+ * @public
564
+ * @see DiagramNode
565
+ * @see DiagramSection
566
+ */
567
+ export interface ResizerConfig {
568
+ /**
569
+ * Mode of the resizer.
570
+ * @default ResizableMode.Never
571
+ */
572
+ mode?: ResizableMode;
573
+ /**
574
+ * Thickness of the resizer.
575
+ * @default 10
576
+ */
577
+ thickness?: number;
578
+ /**
579
+ * The margin around the resizer in diagram units. Used to shift the resizer relative to its default position.
580
+ * @default 0
581
+ */
582
+ outerMargin?: number;
583
+ /**
584
+ * Configuration of the look of the resizer.
585
+ * @default { fillColor: 'transparent' }
586
+ */
587
+ look?: ResizerLookConfig;
588
+ }
589
+ /**
590
+ * The different modes for when a node or section can be resized.
591
+ * @public
592
+ * @see DiagramNode
593
+ * @see DiagramSection
594
+ */
569
595
  export declare enum ResizableMode {
570
- OnlyWhenSelected = 0
596
+ /**
597
+ * Resizable mode for always being resizable.
598
+ */
599
+ Always = 0,
600
+ /**
601
+ * Resizable mode for only being resizable while selected.
602
+ */
603
+ OnlyWhenSelected = 1,
604
+ /**
605
+ * Resizable mode for never being resizable.
606
+ */
607
+ Never = 2
571
608
  }
@@ -58,11 +58,25 @@ export interface MarkerImageLookConfig extends MarkerImageLook, LookConfig<Marke
58
58
  */
59
59
  export interface ConnectionLookConfig extends ConnectionLook, LookConfig<ConnectionLook> {
60
60
  }
61
+ /**
62
+ * Configuration for a look for a field.
63
+ * @public
64
+ * @see FieldLook
65
+ */
66
+ export interface FieldLookConfig extends FieldLook, LookConfig<FieldLook> {
67
+ }
68
+ /**
69
+ * Configuration for a look for a resizer.
70
+ * @public
71
+ * @see ResizerLook
72
+ */
73
+ export interface ResizerLookConfig extends ResizerLook, LookConfig<ResizerLook> {
74
+ }
61
75
  export interface Look {
62
76
  /**
63
- * String used to discern the type of look this is.
77
+ * String used to discern the type of look this is in cases where different types of looks can be used.
64
78
  */
65
- lookType: string;
79
+ lookType?: string;
66
80
  }
67
81
  /**
68
82
  * Configuration for a look given by a shape.
@@ -171,7 +185,6 @@ export interface StretchableImageLook extends Look {
171
185
  * @public
172
186
  */
173
187
  export interface MarkerImageLook extends Look {
174
- lookType: 'marker-image-look';
175
188
  /**
176
189
  * File path to the image used for the marker.
177
190
  */
@@ -206,7 +219,6 @@ export interface MarkerImageLook extends Look {
206
219
  * @public
207
220
  */
208
221
  export interface ConnectionLook extends Look {
209
- lookType: 'connection-look';
210
222
  /**
211
223
  * Color of the line of connections of this type.
212
224
  * @default '#000000'
@@ -228,3 +240,56 @@ export interface ConnectionLook extends Look {
228
240
  */
229
241
  style?: LineStyle;
230
242
  }
243
+ /**
244
+ * Configuration for a look for a field.
245
+ * @public
246
+ */
247
+ export interface FieldLook extends Look {
248
+ /**
249
+ * Background color of this look.
250
+ * @default '#FFFFFF'
251
+ */
252
+ fillColor?: string;
253
+ /**
254
+ * Font color of this look.
255
+ * @default '#000000'
256
+ */
257
+ fontColor?: string;
258
+ /**
259
+ * Font family of this field. `null` for the default one.
260
+ * @default null
261
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/font-family |font-family}
262
+ */
263
+ fontFamily?: string | null;
264
+ /**
265
+ * Font size of this field.
266
+ * @default 10
267
+ */
268
+ fontSize?: number;
269
+ /**
270
+ * Font weight of this field.
271
+ * @default 400
272
+ */
273
+ fontWeight?: number;
274
+ }
275
+ /**
276
+ * Configuration for a look for a resizer.
277
+ * @public
278
+ */
279
+ export interface ResizerLook extends Look {
280
+ /**
281
+ * Color of this resizer.
282
+ * @default 'transparent'
283
+ */
284
+ fillColor?: string;
285
+ /**
286
+ * Border color of this resizer.
287
+ * @default 'transparent'
288
+ */
289
+ borderColor?: string;
290
+ /**
291
+ * Border thickness of this resizer in diagram units.
292
+ * @default 0
293
+ */
294
+ borderThickness?: number;
295
+ }