@metadev/daga 1.1.0 → 1.2.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/index.d.ts CHANGED
@@ -7,16 +7,17 @@ export { DagaImporter } from './lib/diagram-editor/diagram/converters/daga-impor
7
7
  export { DagaModel } from './lib/diagram-editor/diagram/converters/daga-model';
8
8
  export { DiagramModelExporter } from './lib/diagram-editor/diagram/converters/diagram-model-exporter';
9
9
  export { DiagramModelImporter } from './lib/diagram-editor/diagram/converters/diagram-model-importer';
10
- export { ActionQueue, AddConnectionAction, AddNodeAction, DiagramAction, EditFieldAction, MoveNodeAction, RemoveAction, StretchNodeAction, UpdateValuesAction } from './lib/diagram-editor/diagram/diagram-action';
10
+ export { ActionQueue, AddConnectionAction, AddNodeAction, DiagramAction, DiagramActions, EditFieldAction, MoveNodeAction, RemoveAction, StretchNodeAction, UpdateValuesAction } from './lib/diagram-editor/diagram/diagram-action';
11
11
  export { ACTION_QUEUE_SIZE, DiagramCanvas } from './lib/diagram-editor/diagram/diagram-canvas';
12
- export { DiagramConfig } from './lib/diagram-editor/diagram/diagram-config';
13
- export { DiagramConnection, DiagramConnectionType } from './lib/diagram-editor/diagram/diagram-connection';
14
- export { DiagramElement, DiagramEntity } from './lib/diagram-editor/diagram/diagram-element';
15
- export { DiagramField } from './lib/diagram-editor/diagram/diagram-field';
12
+ export { ConnectionMarkerLook, ConnectionTemplateConfig, ConnectionTypeConfig, DiagramConfig, FieldConfig, NodeImageLook, NodeShapedLook, NodeStretchableImageLook, NodeTemplateConfig, NodeTypeConfig, PaletteConfig, PortConfig, SectionConfig } from './lib/diagram-editor/diagram/diagram-config';
13
+ export { DiagramConnection, DiagramConnectionSet, DiagramConnectionType } from './lib/diagram-editor/diagram/diagram-connection';
14
+ export { DiagramElement, DiagramEntity, DiagramEntitySet } from './lib/diagram-editor/diagram/diagram-element';
15
+ export { DiagramField, DiagramFieldSet } from './lib/diagram-editor/diagram/diagram-field';
16
16
  export { DiagramModel } from './lib/diagram-editor/diagram/diagram-model';
17
- export { DiagramNode, DiagramNodeType } from './lib/diagram-editor/diagram/diagram-node';
18
- export { DiagramPort } from './lib/diagram-editor/diagram/diagram-port';
17
+ export { DiagramNode, DiagramNodeSet, DiagramNodeType } from './lib/diagram-editor/diagram/diagram-node';
18
+ export { DiagramPort, DiagramPortSet } from './lib/diagram-editor/diagram/diagram-port';
19
19
  export { Property, PropertySet, Type, ValueSet } from './lib/diagram-editor/diagram/diagram-property';
20
+ export { DiagramSection, DiagramSectionSet } from './lib/diagram-editor/diagram/diagram-section';
20
21
  export { AdjacencyLayout } from './lib/diagram-editor/diagram/layout/adjacency-layout';
21
22
  export { BreadthAdjacencyLayout } from './lib/diagram-editor/diagram/layout/breadth-adjacency-layout';
22
23
  export { BreadthLayout } from './lib/diagram-editor/diagram/layout/breadth-layout';
@@ -30,6 +31,10 @@ export { DiagramError } from './lib/errors/diagram-error';
30
31
  export { DiagramValidator } from './lib/errors/diagram-validator';
31
32
  export { ErrorsComponent } from './lib/errors/errors.component';
32
33
  export { Canvas } from './lib/interfaces/canvas';
34
+ export { DiagramButtons } from './lib/interfaces/diagram-buttons';
35
+ export { DiagramEditor } from './lib/interfaces/diagram-editor';
36
+ export { Palette } from './lib/interfaces/palette';
37
+ export { PropertyEditor } from './lib/interfaces/property-editor';
33
38
  export { ObjectEditorComponent } from './lib/object-editor/object-editor.component';
34
39
  export { PaletteComponent } from './lib/palette/palette.component';
35
40
  export { PropertyEditorComponent } from './lib/property-editor/property-editor.component';
@@ -37,3 +42,7 @@ export { CanvasProviderService } from './lib/services/canvas-provider.service';
37
42
  export { DagaConfigurationService } from './lib/services/daga-configuration.service';
38
43
  export { TextListEditorComponent } from './lib/text-list-editor/text-list-editor.component';
39
44
  export { TextMapEditorComponent } from './lib/text-map-editor/text-map-editor.component';
45
+ export { Line, Point, Rectangle } from './lib/util/canvas-util';
46
+ export { LineShape, LineStyle } from './lib/util/line';
47
+ export { ClosedShape } from './lib/util/shape';
48
+ export { Corner, HorizontalAlign, Side, VerticalAlign } from './lib/util/svg-util';
@@ -12,6 +12,7 @@ export declare class CollapseButtonComponent {
12
12
  visibleValue: string;
13
13
  Side: typeof Side;
14
14
  toggleCollapse(): void;
15
+ getClass(): string;
15
16
  static ɵfac: i0.ɵɵFactoryDeclaration<CollapseButtonComponent, never>;
16
17
  static ɵcmp: i0.ɵɵComponentDeclaration<CollapseButtonComponent, "daga-collapse-button", never, { "collapsableSelector": { "alias": "collapsableSelector"; "required": false; }; "collapsableAdditionalSelector": { "alias": "collapsableAdditionalSelector"; "required": false; }; "collapsed": { "alias": "collapsed"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "direction": { "alias": "direction"; "required": false; }; "rule": { "alias": "rule"; "required": false; }; "collapsedValue": { "alias": "collapsedValue"; "required": false; }; "visibleValue": { "alias": "visibleValue"; "required": false; }; }, {}, never, never, true, never>;
17
18
  }
@@ -31,6 +31,16 @@ export interface DiagramAction {
31
31
  undo(): void;
32
32
  redo(): void;
33
33
  }
34
+ export declare enum DiagramActions {
35
+ AddConnectionAction = "add-connection",
36
+ AddNodeAction = "add-node",
37
+ EditFieldAction = "edit-field",
38
+ MoveNodeAction = "move-node",
39
+ RemoveAction = "remove",
40
+ StretchNodeAction = "stretch-node",
41
+ StretchSectionAction = "stretch-section",
42
+ UpdateValuesAction = "update-values"
43
+ }
34
44
  export declare class AddNodeAction implements DiagramAction {
35
45
  canvas: Canvas;
36
46
  type: DiagramNodeType;
@@ -134,4 +144,3 @@ export declare class RemoveAction implements DiagramAction {
134
144
  undo(): void;
135
145
  redo(): void;
136
146
  }
137
- export declare const clone: <T extends object | null | undefined>(obj: T) => T;
@@ -4,7 +4,7 @@ import { DiagramValidator } from '../../errors/diagram-validator';
4
4
  import { Canvas } from '../../interfaces/canvas';
5
5
  import { DiagramEditor } from '../../interfaces/diagram-editor';
6
6
  import { Point } from '../../util/canvas-util';
7
- import { ActionQueue } from './diagram-action';
7
+ import { ActionQueue, DiagramActions } from './diagram-action';
8
8
  import { DiagramConfig } from './diagram-config';
9
9
  import { DiagramConnection, DiagramConnectionType } from './diagram-connection';
10
10
  import { DiagramElement } from './diagram-element';
@@ -42,6 +42,9 @@ export declare class DiagramCanvas implements Canvas {
42
42
  priorityThresholds: number[];
43
43
  validators: DiagramValidator[];
44
44
  layoutFormat?: string;
45
+ userActions: {
46
+ [key in DiagramActions]?: boolean;
47
+ };
45
48
  actionQueue: ActionQueue;
46
49
  private static canvasCount;
47
50
  private backgroundPatternId;
@@ -2,6 +2,7 @@ import { Point } from '../../util/canvas-util';
2
2
  import { LineShape, LineStyle } from '../../util/line';
3
3
  import { ClosedShape } from '../../util/shape';
4
4
  import { HorizontalAlign, Side, VerticalAlign } from '../../util/svg-util';
5
+ import { DiagramActions } from './diagram-action';
5
6
  import { Property } from './diagram-property';
6
7
  /**
7
8
  * The configuration for a diagram.
@@ -58,6 +59,13 @@ export interface DiagramConfig {
58
59
  * @default undefined
59
60
  */
60
61
  layoutFormat?: string;
62
+ /**
63
+ * Mapping of user actions to a boolean indicating whether the user can perform those actions. Absent values are assumed to be `true`.
64
+ * @default {}
65
+ */
66
+ userActions?: {
67
+ [key in DiagramActions]?: boolean;
68
+ };
61
69
  /**
62
70
  * Configuration for the palettes of this diagram. Each configuration provided will configure one palette, which will be displayed as one of the tabs in the palette component.
63
71
  * @see PaletteComponent
@@ -8,7 +8,7 @@ import { DiagramModel } from './diagram-model';
8
8
  import { DiagramPort } from './diagram-port';
9
9
  import { PropertySet, ValueSet } from './diagram-property';
10
10
  import { DiagramSection } from './diagram-section';
11
- export declare const DIAGRAM_LOOK_DEFAULTS: NodeShapedLook;
11
+ export declare const DIAGRAM_NODE_LOOK_DEFAULTS: NodeShapedLook;
12
12
  export declare const DIAGRAM_NODE_TYPE_DEFAULTS: {
13
13
  name: string;
14
14
  defaultWidth: number;
@@ -1,11 +1,13 @@
1
1
  import { Point } from '../../util/canvas-util';
2
2
  import { Side } from '../../util/svg-util';
3
+ import { NodeShapedLook } from './diagram-config';
3
4
  import { DiagramConnection } from './diagram-connection';
4
5
  import { DiagramElement, DiagramEntitySet } from './diagram-element';
5
6
  import { DiagramField } from './diagram-field';
6
7
  import { DiagramModel } from './diagram-model';
7
8
  import { DiagramNode } from './diagram-node';
8
9
  import { DiagramPort } from './diagram-port';
10
+ export declare const DIAGRAM_SECTION_LOOK_DEFAULTS: NodeShapedLook;
9
11
  export declare const DIAGRAM_SECTION_DEFAULTS: {
10
12
  sectionsX: number;
11
13
  sectionsY: number;
@@ -14,7 +16,7 @@ export declare const DIAGRAM_SECTION_DEFAULTS: {
14
16
  margin: number;
15
17
  label: null;
16
18
  ports: never[];
17
- look: import("./diagram-config").NodeShapedLook;
19
+ look: NodeShapedLook;
18
20
  };
19
21
  export declare class DiagramSection extends DiagramElement {
20
22
  node?: DiagramNode;
@@ -1,5 +1,5 @@
1
1
  import { Subject } from 'rxjs';
2
- import { ActionQueue } from '../diagram-editor/diagram/diagram-action';
2
+ import { ActionQueue, DiagramActions } from '../diagram-editor/diagram/diagram-action';
3
3
  import { DiagramConnectionType } from '../diagram-editor/diagram/diagram-connection';
4
4
  import { DiagramElement } from '../diagram-editor/diagram/diagram-element';
5
5
  import { DiagramModel } from '../diagram-editor/diagram/diagram-model';
@@ -50,6 +50,12 @@ export interface Canvas {
50
50
  * Identifier of the current layout format used by the diagram.
51
51
  */
52
52
  layoutFormat?: string;
53
+ /**
54
+ * Mapping of what actions the user is allowed to perform. Absent values are assumed to be `true`.
55
+ */
56
+ userActions: {
57
+ [key in DiagramActions]?: boolean;
58
+ };
53
59
  /**
54
60
  * The list of validators used to check for errors in this canvas.
55
61
  */
@@ -8,6 +8,7 @@ export declare class ObjectEditorComponent {
8
8
  private cdr;
9
9
  private canvasProvider;
10
10
  get canvas(): Canvas;
11
+ get userCanEdit(): boolean;
11
12
  _valueSet?: ValueSet;
12
13
  get valueSet(): ValueSet | undefined;
13
14
  set valueSet(valueSet: ValueSet | undefined);
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.1.0",
4
+ "version": "1.2.0",
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",
@@ -1,181 +0,0 @@
1
- :root {
2
- --font-color: #233154;
3
- --panel-background-color: #ffffff;
4
- --panel-secondary-color: #f7f8fc;
5
- --panel-border-color: #e6e6e6;
6
- --property-background-color: #f5f8fa;
7
- --property-border-color: #e1e4ff;
8
- --modal-border-color: #e5e5e5;
9
- --button-color: #d7dee5;
10
- --error-color: #ff6363;
11
- --accept-color: #63ff63;
12
- --button-text-color: #000000;
13
- --metadev-blue-1: #0e74b6;
14
-
15
- --font-color-disabled: #808080;
16
- --monospace-font-family: 'DM Mono', monospace;
17
- --lux-disabled-border-color: var(--property-border-color);
18
- --lux-disabled-color: var(--property-background-color);
19
- --lux-input-border-color: var(--property-border-color);
20
- --lux-radiogroup-color: var(--font-color);
21
- --lux-radiogroup-selected-background-color: #0095f9;
22
- --lux-border-radius: 0.25rem;
23
- --lux-autocomplete-input-padding: 0 0.5rem;
24
- --lux-autocomplete-icon-clear: url(../icon/action/filter-clear.png) no-repeat
25
- center;
26
- --lux-autocomplete-icon-dropdown: url(../icon/action/drop-down-arrow.svg)
27
- no-repeat center;
28
- }
29
-
30
- header,
31
- footer,
32
- div,
33
- h1,
34
- p,
35
- li,
36
- button,
37
- input,
38
- option {
39
- font-family: 'Wonder Unit Sans', sans-serif;
40
- }
41
- code {
42
- font-family: var(--monospace-font-family);
43
- }
44
-
45
- .prevent-user-select {
46
- user-select: none;
47
- }
48
-
49
- .top-left {
50
- left: 0;
51
- top: 0;
52
- }
53
- .top-right {
54
- right: 0;
55
- top: 0;
56
- }
57
- .bottom-left {
58
- bottom: 0;
59
- left: 0;
60
- }
61
- .bottom-right {
62
- bottom: 0;
63
- right: 0;
64
- }
65
- .panel {
66
- &.bottom {
67
- flex-flow: column;
68
- }
69
- &.top {
70
- flex-flow: column-reverse;
71
- }
72
- &.right {
73
- flex-flow: row;
74
- }
75
- &.left {
76
- flex-flow: row-reverse;
77
- }
78
- background-color: var(--panel-secondary-color);
79
- border: 1px solid var(--panel-border-color);
80
- border-radius: 1rem;
81
- box-shadow: 0 0 0.5rem rgba(0, 0, 0, 0.1);
82
- display: flex;
83
- flex-direction: column;
84
- height: fit-content;
85
- margin: 1rem;
86
- max-height: calc(100% - 2rem);
87
- max-width: calc(100% - 2rem);
88
- position: absolute;
89
- width: fit-content;
90
- .collapse-button {
91
- &.bottom {
92
- border-radius: 0.75rem 0.75rem 0 0;
93
- }
94
- &.top {
95
- border-radius: 0 0 0.75rem 0.75rem;
96
- }
97
- &.right {
98
- border-radius: 0.75rem 0 0 0.75rem;
99
- }
100
- &.left {
101
- border-radius: 0 0.75rem 0.75rem 0;
102
- }
103
- }
104
- .panel-content {
105
- background-color: var(--panel-background-color);
106
- border: 0;
107
- border-radius: 1rem;
108
- flex: 1 1 auto;
109
- overflow: auto;
110
- }
111
- .panel-tabs {
112
- background-color: var(--panel-secondary-color);
113
- display: flex;
114
- flex-direction: row;
115
- overflow-x: auto;
116
- padding-top: 0.5rem;
117
- .panel-tab {
118
- &.current-tab {
119
- background-color: var(--panel-background-color);
120
- border-top-left-radius: 0.5rem;
121
- border-top-right-radius: 0.5rem;
122
- }
123
- flex-grow: 1;
124
- flex-shrink: 0;
125
- padding: 0.5rem;
126
- text-align: center;
127
- user-select: none;
128
- }
129
- }
130
- }
131
-
132
- daga-property-editor {
133
- .property {
134
- color: var(--font-color);
135
- :disabled,
136
- .disabled {
137
- color: var(--font-color-disabled);
138
- }
139
- input,
140
- select,
141
- textarea,
142
- button,
143
- .radio-item {
144
- background-color: var(--property-background-color);
145
- border: 1px solid var(--property-border-color);
146
- font-weight: 500;
147
- font-size: 0.8rem;
148
- }
149
- input,
150
- select,
151
- textarea {
152
- border-radius: var(--lux-border-radius);
153
- box-sizing: border-box;
154
- font-family: var(--monospace-font-family);
155
- width: 100%;
156
- }
157
- input,
158
- select {
159
- height: 1.5rem;
160
- }
161
- select {
162
- padding: 0 0.5rem;
163
- }
164
- textarea {
165
- height: 5rem;
166
- padding: var(--lux-input-padding, 0rem 0.5rem);
167
- resize: none;
168
- }
169
- .radio-item {
170
- &.radio-start {
171
- border-bottom-left-radius: var(--lux-border-radius);
172
- border-top-left-radius: var(--lux-border-radius);
173
- }
174
- &.radio-end {
175
- border-bottom-right-radius: var(--lux-border-radius);
176
- border-top-right-radius: var(--lux-border-radius);
177
- }
178
- width: 50%;
179
- }
180
- }
181
- }