@metadev/daga 5.0.5 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Changelog.md +431 -0
- package/LICENSE.md +13 -0
- package/README.md +78 -0
- package/index.cjs.js +581 -366
- package/index.esm.js +581 -366
- package/package.json +1 -1
- package/src/index.d.ts +2 -2
- package/src/lib/diagram/canvas/diagram-canvas-util.d.ts +9 -9
- package/src/lib/diagram/canvas/diagram-canvas.d.ts +6 -8
- package/src/lib/diagram/config/diagram-canvas-config.d.ts +98 -14
- package/src/lib/diagram/config/diagram-components-config.d.ts +23 -8
- package/src/lib/diagram/config/diagram-config.d.ts +17 -39
- package/src/lib/diagram/config/diagram-look-config.d.ts +40 -0
- package/src/lib/diagram/converters/daga-model.d.ts +29 -2
- package/src/lib/diagram/diagram-event.d.ts +2 -1
- package/src/lib/diagram/model/diagram-decorator.d.ts +5 -5
- package/src/lib/diagram/model/diagram-field.d.ts +20 -27
- package/src/lib/diagram/model/diagram-object.d.ts +5 -5
- package/src/lib/interfaces/canvas.d.ts +6 -26
package/package.json
CHANGED
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';
|
|
@@ -33,12 +34,11 @@ export declare const SHAPED_LOOK_DEFAULTS: {
|
|
|
33
34
|
borderStyle: LineStyle;
|
|
34
35
|
};
|
|
35
36
|
export declare const updateLook: (selection: d3.Selection<SVGGElement, DiagramNode | DiagramSection | DiagramPort, d3.BaseType, unknown>) => void;
|
|
36
|
-
export declare const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
export declare const initializeGrid: (canvas: DiagramCanvas, canvasView: d3.Selection<SVGGElement, unknown, null, unknown>, backgroundPatternId: string) => void;
|
|
37
|
+
export declare const BACKGROUND_DEFAULTS: SolidBackgroundConfig;
|
|
38
|
+
export declare const GRID_DEFAULTS: EmptyGridConfig;
|
|
39
|
+
export declare const DOTS_GRID_DEFAULTS: DotsGridConfig;
|
|
40
|
+
export declare const initializeBackground: (canvas: DiagramCanvas, canvasView: d3.Selection<SVGGElement, unknown, null, unknown>, backgroundConfig: BackgroundConfig | undefined | null) => d3.Selection<SVGRectElement, unknown, null, unknown> | d3.Selection<SVGImageElement, unknown, null, unknown>;
|
|
41
|
+
export declare const applyGridDefaults: (gridConfig?: GridConfig) => GridConfig;
|
|
42
|
+
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;
|
|
43
|
+
export declare const getGridSpacingX: (gridConfig: GridConfig) => number;
|
|
44
|
+
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 {
|
|
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';
|
|
@@ -40,12 +40,9 @@ export declare class DiagramCanvas implements Canvas {
|
|
|
40
40
|
readonly contextMenu: DiagramContextMenu;
|
|
41
41
|
readonly actionStack: ActionStack;
|
|
42
42
|
readonly collabEngine: CollabEngine;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
gridThickness: number;
|
|
47
|
-
gridColor: string;
|
|
48
|
-
snapToGrid: boolean;
|
|
43
|
+
backgroundConfig: BackgroundConfig;
|
|
44
|
+
gridConfig: GridConfig;
|
|
45
|
+
ancillaryGridsConfig: GridConfig[];
|
|
49
46
|
zoomFactor: number;
|
|
50
47
|
panRate: number;
|
|
51
48
|
inferConnectionType: boolean;
|
|
@@ -64,7 +61,8 @@ export declare class DiagramCanvas implements Canvas {
|
|
|
64
61
|
userActions: {
|
|
65
62
|
[key in DiagramActions]?: boolean;
|
|
66
63
|
};
|
|
67
|
-
private readonly
|
|
64
|
+
private readonly gridPatternId;
|
|
65
|
+
private readonly ancillaryGridPatternIds;
|
|
68
66
|
private zoomBehavior;
|
|
69
67
|
private zoomTransform;
|
|
70
68
|
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?:
|
|
18
|
+
grid?: EmptyGridConfig | DotsGridConfig | LinesGridConfig | ImageGridConfig;
|
|
18
19
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
20
|
+
* Configuration for ancillary grids in the canvas.
|
|
21
|
+
* They accompany the main grid without affecting the diagram.
|
|
21
22
|
*/
|
|
22
|
-
|
|
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
|
-
*
|
|
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
|
|
69
|
+
style: GridStyle;
|
|
60
70
|
/**
|
|
61
|
-
*
|
|
62
|
-
* @default
|
|
71
|
+
* Distance between each point of the grid of this diagram in diagram units.
|
|
72
|
+
* @default 10
|
|
63
73
|
*/
|
|
64
|
-
|
|
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
|
-
*
|
|
72
|
-
* @default
|
|
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
|
-
|
|
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.
|
|
168
|
-
* @default
|
|
182
|
+
* Dimension of this component in the direction that it extends towards.
|
|
183
|
+
* @default 'min-content'
|
|
169
184
|
*/
|
|
170
|
-
|
|
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, ShapedLookConfig, StretchableImageLookConfig } from './diagram-look-config';
|
|
8
8
|
/**
|
|
9
9
|
* The configuration for a diagram.
|
|
10
10
|
* @public
|
|
@@ -336,10 +336,16 @@ export interface FieldConfig {
|
|
|
336
336
|
*/
|
|
337
337
|
editable?: boolean;
|
|
338
338
|
/**
|
|
339
|
-
*
|
|
340
|
-
*
|
|
339
|
+
* Whether this field and its root element should be resized automatically if the size of the text increases.
|
|
340
|
+
* 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.
|
|
341
|
+
* @default false
|
|
341
342
|
*/
|
|
342
|
-
|
|
343
|
+
fit?: boolean;
|
|
344
|
+
/**
|
|
345
|
+
* Whether when `fit` is enabled should the root element of the field also shrink if there is excess space.
|
|
346
|
+
* @default true
|
|
347
|
+
*/
|
|
348
|
+
shrink?: boolean;
|
|
343
349
|
/**
|
|
344
350
|
* 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
351
|
* @default 0
|
|
@@ -350,27 +356,6 @@ export interface FieldConfig {
|
|
|
350
356
|
* @default 0
|
|
351
357
|
*/
|
|
352
358
|
padding?: number | number[];
|
|
353
|
-
/**
|
|
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'
|
|
372
|
-
*/
|
|
373
|
-
selectedColor?: string;
|
|
374
359
|
/**
|
|
375
360
|
* The horizontal alignment of the text of this field.
|
|
376
361
|
* @default 'center'
|
|
@@ -381,27 +366,20 @@ export interface FieldConfig {
|
|
|
381
366
|
* @default 'center'
|
|
382
367
|
*/
|
|
383
368
|
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
369
|
/**
|
|
390
370
|
* Whether this field can have multiple lines.
|
|
391
371
|
* @default false
|
|
392
372
|
*/
|
|
393
373
|
multiline?: boolean;
|
|
394
374
|
/**
|
|
395
|
-
*
|
|
396
|
-
*
|
|
397
|
-
* @default false
|
|
375
|
+
* The orientation of the text of this field. It may be a side or a number of degrees.
|
|
376
|
+
* @default 'top'
|
|
398
377
|
*/
|
|
399
|
-
|
|
378
|
+
orientation?: Side | number;
|
|
400
379
|
/**
|
|
401
|
-
*
|
|
402
|
-
* @default true
|
|
380
|
+
* Configuration of the look this field as it should appear to the user.
|
|
403
381
|
*/
|
|
404
|
-
|
|
382
|
+
look?: FieldLookConfig;
|
|
405
383
|
}
|
|
406
384
|
/**
|
|
407
385
|
* Configuration for a decorator that is part of another element.
|
|
@@ -424,9 +402,9 @@ export interface DecoratorConfig {
|
|
|
424
402
|
*/
|
|
425
403
|
height: number;
|
|
426
404
|
/**
|
|
427
|
-
* Inner
|
|
405
|
+
* Inner SVG of this decorator.
|
|
428
406
|
*/
|
|
429
|
-
|
|
407
|
+
svg: string;
|
|
430
408
|
/**
|
|
431
409
|
* Horizontal anchor point for this decorator. Determines how the decorator behaves when its root element is resized.
|
|
432
410
|
* - 'start': Always maintains the same distance from the left edge
|
|
@@ -58,6 +58,13 @@ 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
|
+
}
|
|
61
68
|
export interface Look {
|
|
62
69
|
/**
|
|
63
70
|
* String used to discern the type of look this is.
|
|
@@ -228,3 +235,36 @@ export interface ConnectionLook extends Look {
|
|
|
228
235
|
*/
|
|
229
236
|
style?: LineStyle;
|
|
230
237
|
}
|
|
238
|
+
/**
|
|
239
|
+
* Configuration for a look for a field.
|
|
240
|
+
* @public
|
|
241
|
+
*/
|
|
242
|
+
export interface FieldLook extends Look {
|
|
243
|
+
lookType: 'field-look';
|
|
244
|
+
/**
|
|
245
|
+
* Background color of this look.
|
|
246
|
+
* @default '#FFFFFF'
|
|
247
|
+
*/
|
|
248
|
+
fillColor?: string;
|
|
249
|
+
/**
|
|
250
|
+
* Font color of this look.
|
|
251
|
+
* @default '#000000'
|
|
252
|
+
*/
|
|
253
|
+
fontColor?: string;
|
|
254
|
+
/**
|
|
255
|
+
* Font family of this field. `null` for the default one.
|
|
256
|
+
* @default null
|
|
257
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/font-family |font-family}
|
|
258
|
+
*/
|
|
259
|
+
fontFamily?: string | null;
|
|
260
|
+
/**
|
|
261
|
+
* Font size of this field.
|
|
262
|
+
* @default 0
|
|
263
|
+
*/
|
|
264
|
+
fontSize?: number;
|
|
265
|
+
/**
|
|
266
|
+
* Font weight of this field.
|
|
267
|
+
* @default 0
|
|
268
|
+
*/
|
|
269
|
+
fontWeight?: number;
|
|
270
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Point } from '../../util/canvas-util';
|
|
1
|
+
import { AnchorPoint, Point } from '../../util/canvas-util';
|
|
2
2
|
import { Side } from '../../util/svg-util';
|
|
3
3
|
import { CollabTimestamp, CollabTimestampSet } from '../collab/primitives';
|
|
4
4
|
export declare const DAGA_FILE_VERSION = 1;
|
|
@@ -18,9 +18,9 @@ export interface DagaModel {
|
|
|
18
18
|
typeVersion: number;
|
|
19
19
|
createdAt: Date;
|
|
20
20
|
updatedAt: Date;
|
|
21
|
-
updatedDaysAgo?: string;
|
|
22
21
|
nodes: DagaNode[];
|
|
23
22
|
connections: DagaConnection[];
|
|
23
|
+
objects?: DagaObject[];
|
|
24
24
|
data: {
|
|
25
25
|
[key: string]: unknown;
|
|
26
26
|
};
|
|
@@ -35,6 +35,7 @@ export interface DagaNode {
|
|
|
35
35
|
children?: DagaNode[];
|
|
36
36
|
sections?: DagaSection[];
|
|
37
37
|
ports?: DagaPort[];
|
|
38
|
+
decorators?: DagaDecorator[];
|
|
38
39
|
label: string;
|
|
39
40
|
coords: Point;
|
|
40
41
|
width: number;
|
|
@@ -59,6 +60,7 @@ export interface DagaNode {
|
|
|
59
60
|
export interface DagaSection {
|
|
60
61
|
id: string;
|
|
61
62
|
ports?: DagaPort[];
|
|
63
|
+
decorators?: DagaDecorator[];
|
|
62
64
|
label: string;
|
|
63
65
|
indexXInNode: number;
|
|
64
66
|
indexYInNode: number;
|
|
@@ -115,3 +117,28 @@ export interface DagaConnection {
|
|
|
115
117
|
dataTimestamps: CollabTimestampSet;
|
|
116
118
|
};
|
|
117
119
|
}
|
|
120
|
+
export interface DagaObject {
|
|
121
|
+
id: string;
|
|
122
|
+
coords: Point;
|
|
123
|
+
width: number;
|
|
124
|
+
height: number;
|
|
125
|
+
priority: number;
|
|
126
|
+
svg: string;
|
|
127
|
+
collabMeta?: {
|
|
128
|
+
removed: boolean;
|
|
129
|
+
selfRemoved: boolean;
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
export interface DagaDecorator {
|
|
133
|
+
id: string;
|
|
134
|
+
coords: Point;
|
|
135
|
+
width: number;
|
|
136
|
+
height: number;
|
|
137
|
+
priority: number;
|
|
138
|
+
anchorPoints: [AnchorPoint, AnchorPoint];
|
|
139
|
+
svg: string;
|
|
140
|
+
collabMeta?: {
|
|
141
|
+
removed: boolean;
|
|
142
|
+
selfRemoved: boolean;
|
|
143
|
+
};
|
|
144
|
+
}
|
|
@@ -33,7 +33,8 @@ export declare class DiagramZoomEvent extends DiagramEvent {
|
|
|
33
33
|
/**
|
|
34
34
|
* Create a diagram zoom event.
|
|
35
35
|
*
|
|
36
|
-
* @param coords .
|
|
36
|
+
* @param coords Coordinates to which the user panned. Calling the method `canvas.translateTo()` with these coordinates after this event should cause no changes.
|
|
37
|
+
* @param zoom Zoom level to which the user zoomed. Calling the method `canvas.zoomTo()` with this zoom level after this event should cause no changes.
|
|
37
38
|
*/
|
|
38
39
|
constructor(coords: Point, zoom: number);
|
|
39
40
|
}
|
|
@@ -4,7 +4,7 @@ import { DiagramModel } from './diagram-model';
|
|
|
4
4
|
import { DiagramNode } from './diagram-node';
|
|
5
5
|
import { DiagramSection } from './diagram-section';
|
|
6
6
|
/**
|
|
7
|
-
* A foreign object which is inserted with arbitrary
|
|
7
|
+
* A foreign object which is inserted with arbitrary SVG code into a diagram.
|
|
8
8
|
* Similar to a diagram object, but it's part of a node or section and it moves and stretches as its geometry changes.
|
|
9
9
|
* Diagram decorators are not serialized with other diagram elements.
|
|
10
10
|
* @public
|
|
@@ -34,7 +34,7 @@ export declare class DiagramDecorator extends DiagramElement {
|
|
|
34
34
|
*/
|
|
35
35
|
height: number;
|
|
36
36
|
priority: number;
|
|
37
|
-
|
|
37
|
+
svg: string;
|
|
38
38
|
/**
|
|
39
39
|
* Horizontal anchor point for this decorator. Determines how the decorator behaves when its root element is resized.
|
|
40
40
|
* @public
|
|
@@ -45,7 +45,7 @@ export declare class DiagramDecorator extends DiagramElement {
|
|
|
45
45
|
* @public
|
|
46
46
|
*/
|
|
47
47
|
anchorPointY: AnchorPoint;
|
|
48
|
-
constructor(model: DiagramModel, rootElement: DiagramNode | DiagramSection | undefined, coords: Point, width: number, height: number, priority: number,
|
|
48
|
+
constructor(model: DiagramModel, rootElement: DiagramNode | DiagramSection | undefined, coords: Point, width: number, height: number, priority: number, svg: string, id: string, anchorPointX?: AnchorPoint, anchorPointY?: AnchorPoint);
|
|
49
49
|
get removed(): boolean;
|
|
50
50
|
updateInView(): void;
|
|
51
51
|
raise(): void;
|
|
@@ -71,10 +71,10 @@ export declare class DiagramDecoratorSet extends DiagramElementSet<DiagramDecora
|
|
|
71
71
|
* @param width The dimension of the decorator along the x axis.
|
|
72
72
|
* @param height The dimension of the decorator along the y axis.
|
|
73
73
|
* @param priority The priority of the decorator. Used when filtering by priority.
|
|
74
|
-
* @param
|
|
74
|
+
* @param svg The SVG contents of the decorator.
|
|
75
75
|
* @param id The id of the decorator. Cannot be an empty string.
|
|
76
76
|
* @returns The instanced decorator.
|
|
77
77
|
*/
|
|
78
|
-
new(rootElement: DiagramNode | DiagramSection | undefined, coords: Point, width: number, height: number, priority: number,
|
|
78
|
+
new(rootElement: DiagramNode | DiagramSection | undefined, coords: Point, width: number, height: number, priority: number, svg: string, id: string, anchorPointX?: AnchorPoint, anchorPointY?: AnchorPoint): DiagramDecorator;
|
|
79
79
|
remove(id: string): void;
|
|
80
80
|
}
|
|
@@ -2,6 +2,7 @@ import { Point } from '../../util/canvas-util';
|
|
|
2
2
|
import { HorizontalAlign, Side, VerticalAlign } from '../../util/svg-util';
|
|
3
3
|
import { CollabTimestamp } from '../collab/primitives';
|
|
4
4
|
import { FieldConfig } from '../config/diagram-config';
|
|
5
|
+
import { FieldLook, FieldLookConfig } from '../config/diagram-look-config';
|
|
5
6
|
import { DiagramElement, DiagramElementSet } from './diagram-element';
|
|
6
7
|
import { DiagramModel } from './diagram-model';
|
|
7
8
|
/**
|
|
@@ -11,19 +12,22 @@ import { DiagramModel } from './diagram-model';
|
|
|
11
12
|
*/
|
|
12
13
|
export declare const DIAGRAM_FIELD_DEFAULTS: {
|
|
13
14
|
editable: boolean;
|
|
14
|
-
fontSize: number;
|
|
15
15
|
margin: number;
|
|
16
16
|
padding: number;
|
|
17
|
-
fontFamily: string;
|
|
18
|
-
color: string;
|
|
19
|
-
selectedColor: string;
|
|
20
|
-
backgroundColor: string;
|
|
21
17
|
horizontalAlign: HorizontalAlign;
|
|
22
18
|
verticalAlign: VerticalAlign;
|
|
23
19
|
orientation: Side;
|
|
24
20
|
multiline: boolean;
|
|
25
21
|
fit: boolean;
|
|
26
22
|
shrink: boolean;
|
|
23
|
+
look: {
|
|
24
|
+
lookType: "field-look";
|
|
25
|
+
fillColor: string;
|
|
26
|
+
fontColor: string;
|
|
27
|
+
fontFamily: string;
|
|
28
|
+
fontSize: number;
|
|
29
|
+
fontWeight: number;
|
|
30
|
+
};
|
|
27
31
|
};
|
|
28
32
|
export interface LabeledElement {
|
|
29
33
|
label?: DiagramField;
|
|
@@ -56,26 +60,6 @@ export declare class DiagramField extends DiagramElement {
|
|
|
56
60
|
* @public
|
|
57
61
|
*/
|
|
58
62
|
height: number;
|
|
59
|
-
/**
|
|
60
|
-
* Font size of this field.
|
|
61
|
-
* @public
|
|
62
|
-
*/
|
|
63
|
-
fontSize: number;
|
|
64
|
-
/**
|
|
65
|
-
* Font family of this field. `null` for the default one.
|
|
66
|
-
* @public
|
|
67
|
-
*/
|
|
68
|
-
fontFamily: string | null;
|
|
69
|
-
/**
|
|
70
|
-
* Font color of this field.
|
|
71
|
-
* @public
|
|
72
|
-
*/
|
|
73
|
-
color: string;
|
|
74
|
-
/**
|
|
75
|
-
* Font color of this field when selected.
|
|
76
|
-
* @public
|
|
77
|
-
*/
|
|
78
|
-
selectedColor: string;
|
|
79
63
|
/**
|
|
80
64
|
* Horizontal alignment of the text of this field.
|
|
81
65
|
* @public
|
|
@@ -128,7 +112,16 @@ export declare class DiagramField extends DiagramElement {
|
|
|
128
112
|
* @public
|
|
129
113
|
*/
|
|
130
114
|
shrink: boolean;
|
|
131
|
-
|
|
115
|
+
private defaultLook;
|
|
116
|
+
private selectedLook;
|
|
117
|
+
private highlightedLook;
|
|
118
|
+
private selectedAndHighlightedLook;
|
|
119
|
+
/**
|
|
120
|
+
* Current look of this field.
|
|
121
|
+
* @private
|
|
122
|
+
*/
|
|
123
|
+
get look(): FieldLook;
|
|
124
|
+
constructor(model: DiagramModel, rootElement: (LabeledElement & DiagramElement) | undefined, coords: Point, width: number, height: number, horizontalAlign: HorizontalAlign, verticalAlign: VerticalAlign, orientation: Side | number, multiline: boolean, look: FieldLookConfig, text: string, editable: boolean, fit: boolean, shrink: boolean);
|
|
132
125
|
get removed(): boolean;
|
|
133
126
|
updateInView(): void;
|
|
134
127
|
raise(): void;
|
|
@@ -151,7 +144,7 @@ export declare class DiagramFieldSet extends DiagramElementSet<DiagramField> {
|
|
|
151
144
|
* Instance a new field and add it to this set. This method is normally called when instancing an element with a field and it is rarely called by itself.
|
|
152
145
|
* @private
|
|
153
146
|
*/
|
|
154
|
-
new(rootElement: (LabeledElement & DiagramElement) | undefined, coords: Point,
|
|
147
|
+
new(rootElement: (LabeledElement & DiagramElement) | undefined, coords: Point, width: number, height: number, horizontalAlign: HorizontalAlign, verticalAlign: VerticalAlign, orientation: Side | number, multiline: boolean, look: FieldLookConfig, text: string, editable: boolean, fit: boolean, shrink: boolean): DiagramField;
|
|
155
148
|
remove(id: string): void;
|
|
156
149
|
}
|
|
157
150
|
export declare const getBottomMargin: (config?: FieldConfig | null) => number;
|