@metadev/daga 1.5.3 → 1.5.5

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/index.d.ts CHANGED
@@ -13,11 +13,13 @@ export { ActionQueue, AddConnectionAction, AddNodeAction, DiagramAction, Diagram
13
13
  export { ACTION_QUEUE_SIZE, DiagramCanvas } from './lib/diagram-editor/diagram/diagram-canvas';
14
14
  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';
15
15
  export { DiagramConnection, DiagramConnectionSet, DiagramConnectionType } from './lib/diagram-editor/diagram/diagram-connection';
16
+ export { DiagramDecorator, DiagramDecoratorSet } from './lib/diagram-editor/diagram/diagram-decorator';
16
17
  export { DiagramElement, DiagramEntity, DiagramEntitySet } from './lib/diagram-editor/diagram/diagram-element';
17
18
  export { DiagramEvent } from './lib/diagram-editor/diagram/diagram-event';
18
19
  export { DiagramField, DiagramFieldSet } from './lib/diagram-editor/diagram/diagram-field';
19
20
  export { DiagramModel } from './lib/diagram-editor/diagram/diagram-model';
20
21
  export { DiagramNode, DiagramNodeGeometry, DiagramNodeSet, DiagramNodeType } from './lib/diagram-editor/diagram/diagram-node';
22
+ export { DiagramObject, DiagramObjectSet } from './lib/diagram-editor/diagram/diagram-object';
21
23
  export { DiagramPort, DiagramPortSet } from './lib/diagram-editor/diagram/diagram-port';
22
24
  export { Property, PropertySet, Type, ValueSet } from './lib/diagram-editor/diagram/diagram-property';
23
25
  export { DiagramSection, DiagramSectionGeometry, DiagramSectionSet } from './lib/diagram-editor/diagram/diagram-section';
@@ -28,6 +30,7 @@ export { DiagramLayout, layouts } from './lib/diagram-editor/diagram/layout/diag
28
30
  export { ForceLayout } from './lib/diagram-editor/diagram/layout/force-layout';
29
31
  export { HorizontalLayout } from './lib/diagram-editor/diagram/layout/horizontal-layout';
30
32
  export { PriorityLayout } from './lib/diagram-editor/diagram/layout/priority-layout';
33
+ export { TreeLayout } from './lib/diagram-editor/diagram/layout/tree-layout';
31
34
  export { VerticalLayout } from './lib/diagram-editor/diagram/layout/vertical-layout';
32
35
  export { DiagramComponent } from './lib/diagram/diagram.component';
33
36
  export { DiagramError } from './lib/errors/diagram-error';
@@ -105,6 +105,7 @@ export declare class DiagramCanvas implements Canvas {
105
105
  updateConnectionsInView(...ids: string[]): void;
106
106
  updateFieldsInView(...ids: string[]): void;
107
107
  updateObjectsInView(...ids: string[]): void;
108
+ updateDecoratorsInView(...ids: string[]): void;
108
109
  updateConnectionLabelsInView(connection: DiagramConnection): void;
109
110
  updateConnectionMarkersInView(connection: DiagramConnection): void;
110
111
  fitFieldRootInView(id: string): void;
@@ -118,6 +119,7 @@ export declare class DiagramCanvas implements Canvas {
118
119
  selectCanvasConnections(): d3.Selection<SVGGElement, unknown, null, unknown>;
119
120
  selectCanvasFields(): d3.Selection<SVGGElement, unknown, null, unknown>;
120
121
  selectCanvasObjects(): d3.Selection<SVGGElement, unknown, null, unknown>;
122
+ selectCanvasDecorators(): d3.Selection<SVGGElement, unknown, null, unknown>;
121
123
  startConnection(port: DiagramPort): void;
122
124
  finishConnection(port: DiagramPort): void;
123
125
  dropConnection(): void;
@@ -0,0 +1,63 @@
1
+ import { Point } from '../../util/canvas-util';
2
+ import { DiagramElement, DiagramEntitySet } from './diagram-element';
3
+ import { DiagramModel } from './diagram-model';
4
+ import { DiagramNode } from './diagram-node';
5
+ import { DiagramSection } from './diagram-section';
6
+ /**
7
+ * A foreign object which is inserted with arbitrary html into a diagram.
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
+ * Diagram decorators are not serialized with other diagram elements.
10
+ * @see DiagramNode
11
+ * @see DiagramObject
12
+ * @see DiagramSection
13
+ * @public
14
+ */
15
+ export declare class DiagramDecorator extends DiagramElement {
16
+ /**
17
+ * Element that this port belongs to.
18
+ * @public
19
+ */
20
+ rootElement?: DiagramNode | DiagramSection;
21
+ /**
22
+ * Coordinates of this decorator.
23
+ * @public
24
+ */
25
+ coords: Point;
26
+ /**
27
+ * Dimension of this decorator along the x axis.
28
+ * @public
29
+ */
30
+ width: number;
31
+ /**
32
+ * Dimension of this decorator along the y axis.
33
+ * @public
34
+ */
35
+ height: number;
36
+ priority: number;
37
+ html: string;
38
+ constructor(model: DiagramModel, rootElement: DiagramNode | DiagramSection | undefined, coords: Point, width: number, height: number, priority: number, html: string, id: string);
39
+ select(): d3.Selection<SVGGElement, unknown, null, unknown> | undefined;
40
+ get removed(): boolean;
41
+ updateInView(): void;
42
+ /**
43
+ * Change the coordinates of this decorator to the given coordinates.
44
+ * @public
45
+ * @param coords A point in the diagram.
46
+ */
47
+ move(coords: Point): void;
48
+ getPriority(): number;
49
+ }
50
+ export declare class DiagramDecoratorSet extends DiagramEntitySet<DiagramDecorator> {
51
+ private model;
52
+ /**
53
+ * Instance a set of decorators for the given model. This method is used internally.
54
+ * @private
55
+ */
56
+ constructor(model: DiagramModel);
57
+ /**
58
+ * Instance a new decorator and add it to this set.
59
+ * @private
60
+ */
61
+ new(rootElement: DiagramNode | DiagramSection | undefined, coords: Point, width: number, height: number, priority: number, html: string, id: string): DiagramDecorator;
62
+ remove(id: string): void;
63
+ }
@@ -1,5 +1,6 @@
1
1
  import { Canvas } from '../../interfaces/canvas';
2
2
  import { DiagramConnectionSet } from './diagram-connection';
3
+ import { DiagramDecoratorSet } from './diagram-decorator';
3
4
  import { DiagramFieldSet } from './diagram-field';
4
5
  import { DiagramNodeSet } from './diagram-node';
5
6
  import { DiagramObjectSet } from './diagram-object';
@@ -53,6 +54,12 @@ export declare class DiagramModel {
53
54
  * @public
54
55
  */
55
56
  objects: DiagramObjectSet;
57
+ /**
58
+ * Decorators of this model.
59
+ * @see DiagramDecorator
60
+ * @public
61
+ */
62
+ decorators: DiagramDecoratorSet;
56
63
  /**
57
64
  * Identifier of this diagram. Set by the consumer of the diagram.
58
65
  * @public
@@ -3,6 +3,7 @@ import { Side } from '../../util/svg-util';
3
3
  import { CollabTimestamp } from './collab/primitives';
4
4
  import { FieldConfig, NodeImageLook, NodeShapedLook, NodeStretchableImageLook, NodeTypeConfig, PortConfig, SectionGridConfig } from './diagram-config';
5
5
  import { DiagramConnection } from './diagram-connection';
6
+ import { DiagramDecorator } from './diagram-decorator';
6
7
  import { DiagramElement, DiagramEntity, DiagramEntitySet } from './diagram-element';
7
8
  import { DiagramField } from './diagram-field';
8
9
  import { DiagramModel } from './diagram-model';
@@ -101,6 +102,11 @@ export declare class DiagramNode extends DiagramElement {
101
102
  * @public
102
103
  */
103
104
  ports: DiagramPort[];
105
+ /**
106
+ * Decorators of this node.
107
+ * @public
108
+ */
109
+ decorators: DiagramDecorator[];
104
110
  /**
105
111
  * Coordinates of the top left corner of this node.
106
112
  * @public
@@ -2,6 +2,7 @@ import { Point } from '../../util/canvas-util';
2
2
  import { Side } from '../../util/svg-util';
3
3
  import { NodeShapedLook, SectionConfig } from './diagram-config';
4
4
  import { DiagramConnection } from './diagram-connection';
5
+ import { DiagramDecorator } from './diagram-decorator';
5
6
  import { DiagramElement, DiagramEntitySet } from './diagram-element';
6
7
  import { DiagramField } from './diagram-field';
7
8
  import { DiagramModel } from './diagram-model';
@@ -84,6 +85,11 @@ export declare class DiagramSection extends DiagramElement {
84
85
  * @public
85
86
  */
86
87
  ports: DiagramPort[];
88
+ /**
89
+ * Decorators of this section.
90
+ * @public
91
+ */
92
+ decorators: DiagramDecorator[];
87
93
  /**
88
94
  * Coordinates of the top left corner of this section.
89
95
  * @public
@@ -0,0 +1,9 @@
1
+ import { DiagramModel } from '../diagram-model';
2
+ import { DiagramLayout } from './diagram-layout';
3
+ /**
4
+ * A layout which arranges the nodes in trees from left to right by depth relative to the nodes with most priority.
5
+ * @public
6
+ */
7
+ export declare class TreeLayout implements DiagramLayout {
8
+ apply(model: DiagramModel): DiagramModel;
9
+ }
@@ -1,14 +1,14 @@
1
1
  import { Subject } from 'rxjs';
2
+ import { CollabEngine } from '../diagram-editor/diagram/collab/collab-engine';
2
3
  import { ActionQueue, DiagramActions } from '../diagram-editor/diagram/diagram-action';
3
4
  import { UserActionConfig } from '../diagram-editor/diagram/diagram-config';
4
5
  import { DiagramConnectionType } from '../diagram-editor/diagram/diagram-connection';
5
6
  import { DiagramElement } from '../diagram-editor/diagram/diagram-element';
6
7
  import { DiagramModel } from '../diagram-editor/diagram/diagram-model';
8
+ import { ValueSet } from '../diagram-editor/diagram/diagram-property';
7
9
  import { DiagramValidator } from '../errors/diagram-validator';
8
10
  import { Point } from '../util/canvas-util';
9
11
  import { DiagramEditor } from './diagram-editor';
10
- import { ValueSet } from '../diagram-editor/diagram/diagram-property';
11
- import { CollabEngine } from '../diagram-editor/diagram/collab/collab-engine';
12
12
  /**
13
13
  * Represents a specific replica or view of the model.
14
14
  * Provides the functionality for the visual representation of the elements of a model.
@@ -235,6 +235,11 @@ export interface Canvas {
235
235
  * @public
236
236
  */
237
237
  updateObjectsInView(...ids: string[]): void;
238
+ /**
239
+ * Update the view of the canvas to show the current state of the decorators.
240
+ * @public
241
+ */
242
+ updateDecoratorsInView(...ids: string[]): void;
238
243
  /**
239
244
  * Fit the root of a diagram field to encompass the totality of the field.
240
245
  * @param id The id of a diagram field
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@metadev/daga",
3
3
  "description": "Diagramming engine for editing models on the Web. Made by Metadev.",
4
- "version": "1.5.3",
4
+ "version": "1.5.5",
5
5
  "author": "Metadev (https://metadev.pro)",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
7
7
  "repository": "git+https://github.com/metadevpro/daga-tutorial.git",