@metadev/daga 2.0.2 → 3.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metadev/daga",
3
- "version": "2.0.2",
3
+ "version": "3.0.0",
4
4
  "dependencies": {},
5
5
  "peerDependencies": {
6
6
  "d3": "^7.9.0",
@@ -49,7 +49,9 @@ export declare class DiagramCanvas implements Canvas {
49
49
  panRate: number;
50
50
  inferConnectionType: boolean;
51
51
  multipleSelectionOn: boolean;
52
- connectionType?: DiagramConnectionType;
52
+ private _connectionType?;
53
+ get connectionType(): DiagramConnectionType | undefined;
54
+ set connectionType(value: DiagramConnectionType | undefined);
53
55
  layoutFormat?: string;
54
56
  validators: DiagramValidator[];
55
57
  userActions: {
@@ -262,6 +262,11 @@ export interface PaletteComponentConfig {
262
262
  * @default '12rem'
263
263
  */
264
264
  width?: string;
265
+ /**
266
+ * Gap between the templates in this palette.
267
+ * @default '1rem'
268
+ */
269
+ gap?: string;
265
270
  /**
266
271
  * Configuration for the sections of this palette. By default, no sections are created.
267
272
  * @default undefined
@@ -371,6 +376,10 @@ export interface ConnectionTemplateConfig {
371
376
  * File path of the background image of this template as it appears on the palette.
372
377
  */
373
378
  icon: string;
379
+ /**
380
+ * File path of the background image of this template as it appears on the palette when this connection type is selected.
381
+ */
382
+ selectedIcon: string;
374
383
  /**
375
384
  * Width of this template in diagram units as it appears on the palette.
376
385
  */
@@ -4,9 +4,6 @@ import { CollabTimestamp } from '../collab/primitives';
4
4
  import { FieldConfig } from '../diagram-config';
5
5
  import { DiagramElement, DiagramElementSet } from './diagram-element';
6
6
  import { DiagramModel } from './diagram-model';
7
- import { DiagramNode } from './diagram-node';
8
- import { DiagramPort } from './diagram-port';
9
- import { DiagramSection } from './diagram-section';
10
7
  /**
11
8
  * Default values of the parameters of a diagram field.
12
9
  * @private
@@ -24,6 +21,9 @@ export declare const DIAGRAM_FIELD_DEFAULTS: {
24
21
  verticalAlign: VerticalAlign;
25
22
  fit: boolean;
26
23
  };
24
+ export interface LabeledElement {
25
+ label?: DiagramField;
26
+ }
27
27
  /**
28
28
  * A field which displays text and is part of a diagram element.
29
29
  * @public
@@ -36,7 +36,7 @@ export declare class DiagramField extends DiagramElement {
36
36
  * Element that this field belongs to.
37
37
  * @public
38
38
  */
39
- rootElement?: DiagramNode | DiagramSection | DiagramPort;
39
+ rootElement?: LabeledElement & DiagramElement;
40
40
  /**
41
41
  * Coordinates of this field.
42
42
  * @public
@@ -109,7 +109,7 @@ export declare class DiagramField extends DiagramElement {
109
109
  * @public
110
110
  */
111
111
  fit: boolean;
112
- constructor(model: DiagramModel, rootElement: DiagramNode | DiagramSection | DiagramPort | undefined, coords: Point, width: number, height: number, fontSize: number, fontFamily: string | null, color: string, selectedColor: string, horizontalAlign: HorizontalAlign, verticalAlign: VerticalAlign, text: string, editable: boolean, fit: boolean);
112
+ 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, text: string, editable: boolean, fit: boolean);
113
113
  select(): d3.Selection<SVGGElement, unknown, null, unknown> | undefined;
114
114
  get removed(): boolean;
115
115
  updateInView(): void;
@@ -132,7 +132,7 @@ export declare class DiagramFieldSet extends DiagramElementSet<DiagramField> {
132
132
  * 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.
133
133
  * @private
134
134
  */
135
- new(rootElement: DiagramNode | DiagramSection | DiagramPort | undefined, coords: Point, fontSize: number, fontFamily: string | null, color: string, selectedColor: string, width: number, height: number, horizontalAlign: HorizontalAlign, verticalAlign: VerticalAlign, text: string, editable: boolean, fit: boolean): DiagramField;
135
+ new(rootElement: (LabeledElement & DiagramElement) | undefined, coords: Point, fontSize: number, fontFamily: string | null, color: string, selectedColor: string, width: number, height: number, horizontalAlign: HorizontalAlign, verticalAlign: VerticalAlign, text: string, editable: boolean, fit: boolean): DiagramField;
136
136
  remove(id: string): void;
137
137
  }
138
138
  export declare const getBottomMargin: (config?: FieldConfig | null) => number;
@@ -6,7 +6,7 @@ import { DiagramConnection } from './diagram-connection';
6
6
  import { DiagramDecorator } from './diagram-decorator';
7
7
  import { DiagramElement, DiagramElementSet } from './diagram-element';
8
8
  import { DiagramEntity, DiagramEntitySet } from './diagram-entity';
9
- import { DiagramField } from './diagram-field';
9
+ import { DiagramField, LabeledElement } from './diagram-field';
10
10
  import { DiagramModel } from './diagram-model';
11
11
  import { DiagramPort } from './diagram-port';
12
12
  import { PropertySet, ValueSet } from './diagram-property';
@@ -76,7 +76,7 @@ export declare class DiagramNodeType implements DiagramEntity {
76
76
  * @see DiagramPort
77
77
  * @see DiagramSection
78
78
  */
79
- export declare class DiagramNode extends DiagramElement {
79
+ export declare class DiagramNode extends DiagramElement implements LabeledElement {
80
80
  type: DiagramNodeType;
81
81
  /**
82
82
  * Additional properties of this node.
@@ -2,7 +2,7 @@ import { Point } from '../../util/canvas-util';
2
2
  import { Side } from '../../util/svg-util';
3
3
  import { DiagramConnection } from './diagram-connection';
4
4
  import { DiagramElement, DiagramElementSet } from './diagram-element';
5
- import { DiagramField } from './diagram-field';
5
+ import { DiagramField, LabeledElement } from './diagram-field';
6
6
  import { DiagramModel } from './diagram-model';
7
7
  import { DiagramNode } from './diagram-node';
8
8
  import { DiagramSection } from './diagram-section';
@@ -23,7 +23,7 @@ export declare const DIAGRAM_PORT_DEFAULTS: {
23
23
  * @see DiagramNode
24
24
  * @see DiagramSection
25
25
  */
26
- export declare class DiagramPort extends DiagramElement {
26
+ export declare class DiagramPort extends DiagramElement implements LabeledElement {
27
27
  /**
28
28
  * Element that this port belongs to.
29
29
  * @public
@@ -4,7 +4,7 @@ import { NodeShapedLook, SectionConfig } from '../diagram-config';
4
4
  import { DiagramConnection } from './diagram-connection';
5
5
  import { DiagramDecorator } from './diagram-decorator';
6
6
  import { DiagramElement, DiagramElementSet } from './diagram-element';
7
- import { DiagramField } from './diagram-field';
7
+ import { DiagramField, LabeledElement } from './diagram-field';
8
8
  import { DiagramModel } from './diagram-model';
9
9
  import { DiagramNode } from './diagram-node';
10
10
  import { DiagramPort } from './diagram-port';
@@ -61,7 +61,7 @@ export type DiagramSectionGeometry = {
61
61
  * @see DiagramNode
62
62
  * @see DiagramPort
63
63
  */
64
- export declare class DiagramSection extends DiagramElement {
64
+ export declare class DiagramSection extends DiagramElement implements LabeledElement {
65
65
  /**
66
66
  * Node that this section belongs to.
67
67
  * @public
@@ -15,6 +15,8 @@ export declare enum Events {
15
15
  KeyDown = "keydown",
16
16
  KeyUp = "keyup",
17
17
  MouseDown = "mousedown",
18
+ MouseEnter = "mouseenter",
19
+ MouseLeave = "mouseleave",
18
20
  MouseMove = "mousemove",
19
21
  MouseOut = "mouseout",
20
22
  MouseOver = "mouseover",