@metadev/daga 5.0.4 → 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.
@@ -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
- constructor(model: DiagramModel, rootElement: (LabeledElement & DiagramElement) | undefined, coords: Point, width: number, height: number, fontSize: number, fontFamily: string | null, color: string, selectedColor: string, horizontalAlign: HorizontalAlign, verticalAlign: VerticalAlign, orientation: Side | number, multiline: boolean, text: string, editable: boolean, fit: boolean, shrink: boolean);
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, fontSize: number, fontFamily: string | null, color: string, selectedColor: string, width: number, height: number, horizontalAlign: HorizontalAlign, verticalAlign: VerticalAlign, orientation: Side | number, multiline: boolean, text: string, editable: boolean, fit: boolean, shrink: boolean): DiagramField;
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;
@@ -2,7 +2,7 @@ import { Point } from '../../util/canvas-util';
2
2
  import { DiagramElement, DiagramElementSet } from './diagram-element';
3
3
  import { DiagramModel } from './diagram-model';
4
4
  /**
5
- * A foreign object which is inserted with arbitrary html into a diagram.
5
+ * A foreign object which is inserted with arbitrary SVG code into a diagram.
6
6
  * Diagram objects are not serialized with other diagram elements.
7
7
  * @public
8
8
  */
@@ -23,8 +23,8 @@ export declare class DiagramObject extends DiagramElement {
23
23
  */
24
24
  height: number;
25
25
  priority: number;
26
- html: string;
27
- constructor(model: DiagramModel, coords: Point, width: number, height: number, priority: number, html: string, id: string);
26
+ svg: string;
27
+ constructor(model: DiagramModel, coords: Point, width: number, height: number, priority: number, svg: string, id: string);
28
28
  get removed(): boolean;
29
29
  updateInView(): void;
30
30
  raise(): void;
@@ -50,10 +50,10 @@ export declare class DiagramObjectSet extends DiagramElementSet<DiagramObject> {
50
50
  * @param width The dimension of the object along the x axis.
51
51
  * @param height The dimension of the object along the y axis.
52
52
  * @param priority The priority of the object. Used when filtering by priority.
53
- * @param html The html contents of the object.
53
+ * @param svg The SVG contents of the object.
54
54
  * @param id The id of the object. Cannot be an empty string.
55
55
  * @returns The instanced object.
56
56
  */
57
- new(coords: Point, width: number, height: number, priority: number, html: string, id: string): DiagramObject;
57
+ new(coords: Point, width: number, height: number, priority: number, svg: string, id: string): DiagramObject;
58
58
  remove(id: string): void;
59
59
  }
@@ -3,15 +3,15 @@ import { DiagramContextMenu } from '../diagram/canvas/diagram-context-menu';
3
3
  import { DiagramUserHighlight } from '../diagram/canvas/diagram-user-highlight';
4
4
  import { DiagramUserSelection } from '../diagram/canvas/diagram-user-selection';
5
5
  import { CollabEngine } from '../diagram/collab/collab-engine';
6
- import { ActionStack, DiagramAction, DiagramActionMethod, DiagramActions } from '../diagram/diagram-action';
6
+ import { BackgroundConfig, GridConfig } from '../diagram/config/diagram-canvas-config';
7
7
  import { UserActionConfig } from '../diagram/config/diagram-config';
8
+ import { ActionStack, DiagramAction, DiagramActionMethod, DiagramActions } from '../diagram/diagram-action';
8
9
  import { DiagramEvent } from '../diagram/diagram-event';
9
10
  import { DiagramConnectionType } from '../diagram/model/diagram-connection';
10
11
  import { DiagramModel } from '../diagram/model/diagram-model';
11
12
  import { DiagramValidator } from '../errors/diagram-validator';
12
13
  import { Point } from '../util/canvas-util';
13
14
  import { DiagramEditor } from './diagram-editor';
14
- import { GridStyle } from '../diagram/config/diagram-canvas-config';
15
15
  /**
16
16
  * Represents a specific replica or view of the model.
17
17
  * Provides the functionality for the visual representation of the elements of a model.
@@ -54,35 +54,15 @@ export interface Canvas {
54
54
  */
55
55
  readonly collabEngine: CollabEngine;
56
56
  /**
57
- * Background color of the diagram.
58
- * @public
59
- */
60
- backgroundColor: string;
61
- /**
62
- * Style of the grid elements of the diagram.
63
- * @public
64
- */
65
- gridStyle: GridStyle;
66
- /**
67
- * Distance between the grid points of the diagram in diagram units.
68
- * @public
69
- */
70
- gridSize: number;
71
- /**
72
- * Size of the grid points of the diagram relative to the distance between grid points in diagram units.
73
- * @public
74
- */
75
- gridThickness: number;
76
- /**
77
- * Color of the grid elements of the diagram.
57
+ * Background config of the diagram.
78
58
  * @public
79
59
  */
80
- gridColor: string;
60
+ backgroundConfig: BackgroundConfig;
81
61
  /**
82
- * If true, elements moved by the user should be placed on the closest grid point rather than the exact point where they were placed.
62
+ * Grid config of the diagram.
83
63
  * @public
84
64
  */
85
- snapToGrid: boolean;
65
+ gridConfig: GridConfig;
86
66
  /**
87
67
  * 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.
88
68
  * @public