@metadev/daga 1.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.
Files changed (96) hide show
  1. package/Changelog.md +9 -0
  2. package/LICENSE.md +13 -0
  3. package/README.md +30 -0
  4. package/assets/config/generic-diagram.json +94 -0
  5. package/assets/icon/action/drop-down-arrow.svg +8 -0
  6. package/assets/icon/action/drop-horizontal-left.svg +14 -0
  7. package/assets/icon/action/drop-horizontal-none.svg +13 -0
  8. package/assets/icon/action/drop-horizontal-right.svg +14 -0
  9. package/assets/icon/action/drop-vertical-down.svg +14 -0
  10. package/assets/icon/action/drop-vertical-none.svg +13 -0
  11. package/assets/icon/action/drop-vertical-up.svg +14 -0
  12. package/assets/icon/action/filter-clear.png +0 -0
  13. package/assets/icon/buttons/center-hover.svg +10 -0
  14. package/assets/icon/buttons/center.svg +10 -0
  15. package/assets/icon/buttons/ellipsis-hover.svg +7 -0
  16. package/assets/icon/buttons/ellipsis.svg +7 -0
  17. package/assets/icon/buttons/filter-off-hover.svg +5 -0
  18. package/assets/icon/buttons/filter-off.svg +5 -0
  19. package/assets/icon/buttons/filter-on-hover.svg +5 -0
  20. package/assets/icon/buttons/filter-on.svg +5 -0
  21. package/assets/icon/buttons/layout-hover.svg +8 -0
  22. package/assets/icon/buttons/layout.svg +8 -0
  23. package/assets/icon/buttons/redo-hover.svg +5 -0
  24. package/assets/icon/buttons/redo.svg +5 -0
  25. package/assets/icon/buttons/undo-hover.svg +5 -0
  26. package/assets/icon/buttons/undo.svg +5 -0
  27. package/assets/icon/buttons/zoom-in-hover.svg +8 -0
  28. package/assets/icon/buttons/zoom-in.svg +8 -0
  29. package/assets/icon/buttons/zoom-out-hover.svg +7 -0
  30. package/assets/icon/buttons/zoom-out.svg +7 -0
  31. package/assets/icon/connection/arrow.svg +23 -0
  32. package/assets/icon/connection/empty-arrow.svg +19 -0
  33. package/assets/icon/connection/empty-diamond.svg +20 -0
  34. package/assets/icon/connection/filled-arrow.svg +19 -0
  35. package/assets/icon/connection/filled-diamond.svg +20 -0
  36. package/assets/icon/connection/line.svg +9 -0
  37. package/assets/icon/property/add.svg +3 -0
  38. package/assets/icon/property/close.svg +3 -0
  39. package/assets/icon/property/ellipsis.svg +5 -0
  40. package/assets/icon/property/hide.svg +10 -0
  41. package/assets/styles/styles.scss +181 -0
  42. package/fesm2022/metadev-daga.mjs +6480 -0
  43. package/fesm2022/metadev-daga.mjs.map +1 -0
  44. package/index.d.ts +39 -0
  45. package/lib/collapse-button/collapse-button.component.d.ts +17 -0
  46. package/lib/daga.module.d.ts +19 -0
  47. package/lib/diagram/diagram.component.d.ts +18 -0
  48. package/lib/diagram-buttons/diagram-buttons.component.d.ts +29 -0
  49. package/lib/diagram-editor/diagram/converters/daga-exporter.d.ts +6 -0
  50. package/lib/diagram-editor/diagram/converters/daga-importer.d.ts +6 -0
  51. package/lib/diagram-editor/diagram/converters/daga-model.d.ts +59 -0
  52. package/lib/diagram-editor/diagram/converters/diagram-model-exporter.d.ts +7 -0
  53. package/lib/diagram-editor/diagram/converters/diagram-model-importer.d.ts +7 -0
  54. package/lib/diagram-editor/diagram/diagram-action.d.ts +137 -0
  55. package/lib/diagram-editor/diagram/diagram-canvas.d.ts +99 -0
  56. package/lib/diagram-editor/diagram/diagram-config.d.ts +617 -0
  57. package/lib/diagram-editor/diagram/diagram-connection.d.ts +64 -0
  58. package/lib/diagram-editor/diagram/diagram-element.d.ts +21 -0
  59. package/lib/diagram-editor/diagram/diagram-field.d.ts +37 -0
  60. package/lib/diagram-editor/diagram/diagram-model.d.ts +64 -0
  61. package/lib/diagram-editor/diagram/diagram-node.d.ts +68 -0
  62. package/lib/diagram-editor/diagram/diagram-port.d.ts +27 -0
  63. package/lib/diagram-editor/diagram/diagram-property.d.ts +141 -0
  64. package/lib/diagram-editor/diagram/diagram-section.d.ts +36 -0
  65. package/lib/diagram-editor/diagram/layout/adjacency-layout.d.ts +8 -0
  66. package/lib/diagram-editor/diagram/layout/breadth-adjacency-layout.d.ts +8 -0
  67. package/lib/diagram-editor/diagram/layout/breadth-layout.d.ts +9 -0
  68. package/lib/diagram-editor/diagram/layout/diagram-layout.d.ts +10 -0
  69. package/lib/diagram-editor/diagram/layout/force-layout.d.ts +8 -0
  70. package/lib/diagram-editor/diagram/layout/horizontal-layout.d.ts +8 -0
  71. package/lib/diagram-editor/diagram/layout/priority-layout.d.ts +8 -0
  72. package/lib/diagram-editor/diagram/layout/vertical-layout.d.ts +8 -0
  73. package/lib/diagram-editor/diagram-editor.component.d.ts +27 -0
  74. package/lib/errors/diagram-error.d.ts +5 -0
  75. package/lib/errors/diagram-validator.d.ts +8 -0
  76. package/lib/errors/errors.component.d.ts +21 -0
  77. package/lib/interfaces/canvas.d.ts +203 -0
  78. package/lib/interfaces/diagram-buttons.d.ts +33 -0
  79. package/lib/interfaces/diagram-editor.d.ts +20 -0
  80. package/lib/interfaces/palette.d.ts +10 -0
  81. package/lib/interfaces/property-editor.d.ts +19 -0
  82. package/lib/object-editor/object-editor.component.d.ts +25 -0
  83. package/lib/palette/palette.component.d.ts +31 -0
  84. package/lib/property-editor/property-editor.component.d.ts +18 -0
  85. package/lib/services/canvas-provider.service.d.ts +15 -0
  86. package/lib/services/daga-configuration.service.d.ts +12 -0
  87. package/lib/text-list-editor/text-list-editor.component.d.ts +20 -0
  88. package/lib/text-map-editor/text-map-editor.component.d.ts +29 -0
  89. package/lib/util/canvas-util.d.ts +16 -0
  90. package/lib/util/events.d.ts +53 -0
  91. package/lib/util/grid.d.ts +19 -0
  92. package/lib/util/line.d.ts +15 -0
  93. package/lib/util/list-util.d.ts +2 -0
  94. package/lib/util/shape.d.ts +23 -0
  95. package/lib/util/svg-util.d.ts +22 -0
  96. package/package.json +55 -0
@@ -0,0 +1,617 @@
1
+ import { Point } from '../../util/canvas-util';
2
+ import { LineShape, LineStyle } from '../../util/line';
3
+ import { ClosedShape } from '../../util/shape';
4
+ import { HorizontalAlign, Side, VerticalAlign } from '../../util/svg-util';
5
+ import { Property } from './diagram-property';
6
+ /**
7
+ * The configuration for a diagram.
8
+ */
9
+ export interface DiagramConfig {
10
+ /**
11
+ * The name of this type of diagram. Used so that it is possible to discern the type of a diagram.
12
+ * @default ""
13
+ */
14
+ type?: string;
15
+ /**
16
+ * The default name for a new diagram of this type.
17
+ * @default "unnamed"
18
+ */
19
+ name?: string;
20
+ /**
21
+ * Background color of this diagram.
22
+ * @default "#FFFFFF"
23
+ */
24
+ color?: string;
25
+ /**
26
+ * Distance between each point of the grid of this diagram in pixels. 0 or negative is interpreted as no grid.
27
+ * @default 0
28
+ */
29
+ gridSize?: number;
30
+ /**
31
+ * When true, nodes moved by the user will be moved to the closest point where the top left corner matches a grid point.
32
+ * @default false
33
+ */
34
+ snapToGrid?: boolean;
35
+ /**
36
+ * When true, connections made by the user will have their type assumed based on the type of the source and target nodes.
37
+ * @default false
38
+ */
39
+ guessConnectionType?: boolean;
40
+ /**
41
+ * Id of the type of connection that is selected by default initially for the user to make.
42
+ * @default undefined
43
+ */
44
+ defaultConnection?: string;
45
+ /**
46
+ * Initial threshold value used to hide nodes whose priority value is below it.
47
+ * @default undefined
48
+ */
49
+ defaultPriorityThreshold?: number;
50
+ /**
51
+ * Possible values of the priority threshold that the user can toggle between to hide nodes whose priority value is below it.
52
+ * @default []
53
+ */
54
+ priorityThresholds?: number[];
55
+ /**
56
+ * Name of the layout format used to arrange the nodes of this diagram when pressing the layout button in the diagram buttons component.
57
+ * @see DiagramButtonsComponent
58
+ * @default undefined
59
+ */
60
+ layoutFormat?: string;
61
+ /**
62
+ * 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
+ * @see PaletteComponent
64
+ * @default undefined
65
+ */
66
+ palettes?: PaletteConfig[];
67
+ /**
68
+ * Default attributes for each of the types of node of this diagram.
69
+ * @default undefined
70
+ */
71
+ nodeTypeDefaults?: Partial<NodeTypeConfig>;
72
+ /**
73
+ * List of the types of node that can be used in this diagram.
74
+ * @default undefined
75
+ */
76
+ nodeTypes?: NodeTypeConfig[];
77
+ /**
78
+ * Default attributes for each of the types of connection of this diagram.
79
+ * @default undefined
80
+ */
81
+ connectionTypeDefaults?: Partial<ConnectionTypeConfig>;
82
+ /**
83
+ * List of the types of connection that can be used in this diagram.
84
+ * @default undefined
85
+ */
86
+ connectionTypes?: ConnectionTypeConfig[];
87
+ /**
88
+ * Properties of this diagram that can be edited in the property editor component.
89
+ * @see PropertyEditorComponent
90
+ * @default []
91
+ */
92
+ properties?: Property[];
93
+ }
94
+ /**
95
+ * Configuration for a palette.
96
+ * @see PaletteComponent
97
+ */
98
+ export interface PaletteConfig {
99
+ /**
100
+ * Name of this palette. Displayed in the tab of this palette in the palette component. Can be left undefined if this is the only palette.
101
+ */
102
+ name?: string;
103
+ /**
104
+ * Categories of this palette. Used to enable displaying one of different categories of templates as defined here. Can be left undefined if there are no categories.
105
+ */
106
+ categories?: {
107
+ [key: string]: (NodeTemplateConfig | ConnectionTemplateConfig)[];
108
+ };
109
+ /**
110
+ * List of templates that are always displayed in this palette. Can be left undefined.
111
+ */
112
+ templates?: (NodeTemplateConfig | ConnectionTemplateConfig)[];
113
+ }
114
+ /**
115
+ * Configuration for a template of a node in a palette.
116
+ * @see PaletteComponent
117
+ */
118
+ export interface NodeTemplateConfig {
119
+ /**
120
+ * String used to indicate that this is a template of a node.
121
+ */
122
+ templateType: 'node';
123
+ /**
124
+ * Id of the type of node of this template. Must correspond to the id of a type of node defined in the nodeTypes list.
125
+ */
126
+ type: string;
127
+ /**
128
+ * Label of this template as it appears on the palette and label that will be given to nodes created from this template.
129
+ */
130
+ label: string;
131
+ /**
132
+ * Default values of the properties of nodes created from this template.
133
+ */
134
+ values?: {
135
+ [key: string]: unknown;
136
+ };
137
+ }
138
+ /**
139
+ * Configuration for a template of a connection in a palette.
140
+ * @see PaletteComponent
141
+ */
142
+ export interface ConnectionTemplateConfig {
143
+ /**
144
+ * String used to indicate that this is a template of a connection.
145
+ */
146
+ templateType: 'connection';
147
+ /**
148
+ * Id of the type of connection of this template. Must correspond to the id of a type of connection defined in the connectionTypes list.
149
+ */
150
+ type: string;
151
+ /**
152
+ * Label of this template as it appears on the palette.
153
+ */
154
+ label: string;
155
+ /**
156
+ * Background color of this template as it appears on the palette.
157
+ */
158
+ color: string;
159
+ /**
160
+ * File path of the background image of this template as it appears on the palette.
161
+ */
162
+ icon: string;
163
+ /**
164
+ * Width of this template in pixels as it appears on the palette.
165
+ */
166
+ width: number;
167
+ /**
168
+ * Height of this template in pixels as it appears on the palette.
169
+ */
170
+ height: number;
171
+ }
172
+ /**
173
+ * Configuration for a type of node.
174
+ * @see DiagramNodeType
175
+ */
176
+ export interface NodeTypeConfig {
177
+ /**
178
+ * Id of this type of node used to reference this type of node internally.
179
+ */
180
+ id: string;
181
+ /**
182
+ * Name of this type of node as displayed to the user.
183
+ */
184
+ name?: string;
185
+ /**
186
+ * Default width of nodes of this type in pixels.
187
+ * @default 0
188
+ */
189
+ defaultWidth?: number;
190
+ /**
191
+ * Default height of nodes of this type in pixels.
192
+ * @default 0
193
+ */
194
+ defaultHeight?: number;
195
+ /**
196
+ * Minimum width of nodes of this type in pixels.
197
+ * @default 0
198
+ */
199
+ minWidth?: number;
200
+ /**
201
+ * Minimum height of nodes of this type in pixels.
202
+ * @default 0
203
+ */
204
+ minHeight?: number;
205
+ /**
206
+ * Whether the user can resize nodes of this type along the x axis.
207
+ * @default false
208
+ */
209
+ resizableX?: boolean;
210
+ /**
211
+ * Whether the user can resize nodes of this type along the y axis.
212
+ * @default false
213
+ */
214
+ resizableY?: boolean;
215
+ /**
216
+ * Configuration for the label of nodes of this type.
217
+ * @default null
218
+ */
219
+ label?: FieldConfig | null;
220
+ /**
221
+ * Configuration of the ports of nodes of this type.
222
+ * @default []
223
+ */
224
+ ports?: PortConfig[];
225
+ /**
226
+ * Configuration for the sections of this diagram if applicable.
227
+ * @default null
228
+ */
229
+ sections?: SectionConfig | null;
230
+ /**
231
+ * Configuration of the look of nodes of this type as it should appear to the user.
232
+ * @default {lookType: 'shaped-look', shape: ClosedShape.Rectangle, color: '#FFFFFF', borderColor: '#000000', selectedColor: '#FFFFFF', selectedBorderColor: '#000000'}
233
+ */
234
+ look?: NodeShapedLook | NodeImageLook | NodeStretchableImageLook;
235
+ /**
236
+ * If true and a node of this type already exists in the diagram, the user can't create more nodes of this type.
237
+ * @default false
238
+ */
239
+ isUnique?: boolean;
240
+ /**
241
+ * The priority of this node when filtering out nodes below a given threshold.
242
+ * @default 0
243
+ */
244
+ priority?: number;
245
+ /**
246
+ * Properties of nodes of this type that can be edited in the property editor component.
247
+ * @see PropertyEditorComponent
248
+ * @default []
249
+ */
250
+ properties?: Property[];
251
+ }
252
+ /**
253
+ * Configuration for a field that is part of another element.
254
+ * @see DiagramField
255
+ */
256
+ export interface FieldConfig {
257
+ /**
258
+ * Whether this field can be edited by the user.
259
+ * @default true
260
+ */
261
+ editable?: boolean;
262
+ /**
263
+ * The size of the font of this field in pixels.
264
+ * @default 0
265
+ */
266
+ fontSize?: number;
267
+ /**
268
+ * The margin around the field in pixels.
269
+ * @default 0
270
+ */
271
+ margin?: number;
272
+ /**
273
+ * The padding around the field in pixels.
274
+ * @default 0
275
+ */
276
+ padding?: number;
277
+ /**
278
+ * The font family of the text of this field.
279
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/font-family |font-family}
280
+ * @default null
281
+ */
282
+ fontFamily?: string | null;
283
+ /**
284
+ * The color of the text of this field.
285
+ * @default '#000000'
286
+ */
287
+ color?: string;
288
+ /**
289
+ * The color of the text of this field when selected.
290
+ * @default '#000000'
291
+ */
292
+ selectedColor?: string;
293
+ /**
294
+ * The horizontal alignment of the text of this field.
295
+ * @default 'center'
296
+ */
297
+ horizontalAlign?: HorizontalAlign;
298
+ /**
299
+ * The vertical alignment of the text of this field.
300
+ * @default 'center'
301
+ */
302
+ verticalAlign?: VerticalAlign;
303
+ }
304
+ /**
305
+ * Configuration for a port that is part of another element.
306
+ * @see DiagramPort
307
+ */
308
+ export interface PortConfig {
309
+ /**
310
+ * Coordinates of this port relative to its root element's coordinates.
311
+ */
312
+ coords: Point;
313
+ /**
314
+ * Direction that the connections passing by this port follow at the point of the port.
315
+ */
316
+ direction: Side;
317
+ /**
318
+ * Configuration for the label of this port.
319
+ * @default null
320
+ */
321
+ label?: FieldConfig | null;
322
+ }
323
+ /**
324
+ * Configuration for the sections of a node.
325
+ * @see DiagramSection
326
+ */
327
+ export interface SectionConfig {
328
+ /**
329
+ * The number of sections this node can accomodate along the x axis.
330
+ * @default 1
331
+ */
332
+ sectionsX?: number;
333
+ /**
334
+ * The number of sections this node can accomodate along the y axis.
335
+ * @default 1
336
+ */
337
+ sectionsY?: number;
338
+ /**
339
+ * Minimum width of sections of this node in pixels.
340
+ * @default 0
341
+ */
342
+ minWidth?: number;
343
+ /**
344
+ * Minimum height of sections of this node in pixels.
345
+ * @default 0
346
+ */
347
+ minHeight?: number;
348
+ /**
349
+ * The margin left around sections in pixels.
350
+ * @default 0
351
+ */
352
+ margin?: number;
353
+ /**
354
+ * Configuration for the label of the sections.
355
+ * @default null
356
+ */
357
+ label?: FieldConfig | null;
358
+ /**
359
+ * Configuration of the ports of the sections.
360
+ * @default []
361
+ */
362
+ ports?: PortConfig[];
363
+ /**
364
+ * Configuration of the look of the sections as it should appear to the user.
365
+ * @default {lookType: 'shaped-look', shape: ClosedShape.Rectangle, color: '#FFFFFF', borderColor: '#000000', selectedColor: '#FFFFFF', selectedBorderColor: '#000000'}
366
+ */
367
+ look?: NodeShapedLook | NodeImageLook | NodeStretchableImageLook;
368
+ }
369
+ /**
370
+ * Configuration for the look of a node given by shape and color.
371
+ */
372
+ export interface NodeShapedLook {
373
+ /**
374
+ * String used to discern the type of node look this is.
375
+ */
376
+ lookType: 'shaped-look';
377
+ /**
378
+ * Shape of nodes using this look.
379
+ */
380
+ shape: ClosedShape;
381
+ /**
382
+ * Background color of nodes using this look.
383
+ */
384
+ color: string;
385
+ /**
386
+ * Border color of nodes using this look.
387
+ */
388
+ borderColor: string;
389
+ /**
390
+ * Background color of nodes using this look when selected.
391
+ */
392
+ selectedColor: string;
393
+ /**
394
+ * Border color of nodes using this look when selected.
395
+ */
396
+ selectedBorderColor: string;
397
+ }
398
+ /**
399
+ * Configuration for the look of a node given by an image.
400
+ */
401
+ export interface NodeImageLook {
402
+ /**
403
+ * String used to discern the type of node look this is.
404
+ */
405
+ lookType: 'image-look';
406
+ /**
407
+ * File path to the background image used by nodes using this look.
408
+ */
409
+ backgroundImage: string;
410
+ /**
411
+ * File path to the background image used by nodes using this look when selected.
412
+ */
413
+ selectedBackgroundImage: string;
414
+ }
415
+ /**
416
+ * Configuration for the look of a node given by fixed size images in the corners and stretchable images in the middle.
417
+ */
418
+ export interface NodeStretchableImageLook {
419
+ /**
420
+ * String used to discern the type of node look this is.
421
+ */
422
+ lookType: 'stretchable-image-look';
423
+ /**
424
+ * Width taken up by the images at the left of nodes using this look in pixels.
425
+ */
426
+ leftMargin: number;
427
+ /**
428
+ * Width taken up by the images at the right of nodes using this look in pixels.
429
+ */
430
+ rightMargin: number;
431
+ /**
432
+ * Width taken up by the images at the top of nodes using this look in pixels.
433
+ */
434
+ topMargin: number;
435
+ /**
436
+ * Width taken up by the images at the bottom of nodes using this look in pixels.
437
+ */
438
+ bottomMargin: number;
439
+ /**
440
+ * File path to the background image used at the top left of nodes using this look.
441
+ */
442
+ backgroundImageTopLeft: string;
443
+ /**
444
+ * File path to the background image used at the top of nodes using this look.
445
+ */
446
+ backgroundImageTop: string;
447
+ /**
448
+ * File path to the background image used at the top right of nodes using this look.
449
+ */
450
+ backgroundImageTopRight: string;
451
+ /**
452
+ * File path to the background image used at the left of nodes using this look.
453
+ */
454
+ backgroundImageLeft: string;
455
+ /**
456
+ * File path to the background image used at the center of nodes using this look.
457
+ */
458
+ backgroundImageCenter: string;
459
+ /**
460
+ * File path to the background image used at the right of nodes using this look.
461
+ */
462
+ backgroundImageRight: string;
463
+ /**
464
+ * File path to the background image used at the bottom left of nodes using this look.
465
+ */
466
+ backgroundImageBottomLeft: string;
467
+ /**
468
+ * File path to the background image used at the bottom of nodes using this look.
469
+ */
470
+ backgroundImageBottom: string;
471
+ /**
472
+ * File path to the background image used at the bottom right of nodes using this look.
473
+ */
474
+ backgroundImageBottomRight: string;
475
+ /**
476
+ * File path to the background image used at the top left of nodes using this look when selected.
477
+ */
478
+ selectedBackgroundImageTopLeft: string;
479
+ /**
480
+ * File path to the background image used at the top of nodes using this look when selected.
481
+ */
482
+ selectedBackgroundImageTop: string;
483
+ /**
484
+ * File path to the background image used at the top right of nodes using this look when selected.
485
+ */
486
+ selectedBackgroundImageTopRight: string;
487
+ /**
488
+ * File path to the background image used at the left of nodes using this look when selected.
489
+ */
490
+ selectedBackgroundImageLeft: string;
491
+ /**
492
+ * File path to the background image used at the center of nodes using this look when selected.
493
+ */
494
+ selectedBackgroundImageCenter: string;
495
+ /**
496
+ * File path to the background image used at the right of nodes using this look when selected.
497
+ */
498
+ selectedBackgroundImageRight: string;
499
+ /**
500
+ * File path to the background image used at the bottom left of nodes using this look when selected.
501
+ */
502
+ selectedBackgroundImageBottomLeft: string;
503
+ /**
504
+ * File path to the background image used at the bottom of nodes using this look when selected.
505
+ */
506
+ selectedBackgroundImageBottom: string;
507
+ /**
508
+ * File path to the background image used at the bottom right of nodes using this look when selected.
509
+ */
510
+ selectedBackgroundImageBottomRight: string;
511
+ }
512
+ /**
513
+ * Configuration for a type of connection.
514
+ * @see DiagramConnectionType
515
+ */
516
+ export interface ConnectionTypeConfig {
517
+ /**
518
+ * Id of this type of connection used to reference this type of node internally.
519
+ */
520
+ id: string;
521
+ /**
522
+ * Name of this type of connection as displayed to the user.
523
+ */
524
+ name?: string;
525
+ /**
526
+ * Color of the line of connections of this type.
527
+ * @default '#000000'
528
+ */
529
+ color?: string;
530
+ /**
531
+ * Color of the line of connections of this type when selected.
532
+ * @default '#000000'
533
+ */
534
+ selectedColor?: string;
535
+ /**
536
+ * Width of the line of connections of this type in pixels.
537
+ * @default 1
538
+ */
539
+ width?: number;
540
+ /**
541
+ * Shape of the line of connections of this type.
542
+ * @default 'straight'
543
+ */
544
+ shape?: LineShape;
545
+ /**
546
+ * Style of the line of connections of this type.
547
+ * @default 'solid'
548
+ */
549
+ style?: LineStyle;
550
+ /**
551
+ * Configuration of the labels of connections of this type.
552
+ */
553
+ label?: FieldConfig | null;
554
+ /**
555
+ * Configuration of the look of the marker at the start of connections of this type as it should appear to the user. Undefined for no marker.
556
+ * @default null
557
+ */
558
+ defaultStartMarkerLook?: ConnectionMarkerLook | null;
559
+ /**
560
+ * Configuration of the look of the marker at the end of connections of this type as it should appear to the user. Undefined for no marker.
561
+ * @default null
562
+ */
563
+ defaultEndMarkerLook?: ConnectionMarkerLook | null;
564
+ /**
565
+ * Ids of the types of nodes that connections of this type can start from. Must correspond to the ids of types of node defined in the nodeTypes list. Should list one id at minimum.
566
+ * @default []
567
+ */
568
+ startTypes?: string[];
569
+ /**
570
+ * Ids of the types of nodes that connections of this type can end at. Must correspond to the ids of types of node defined in the nodeTypes list. Should list one id at minimum.
571
+ * @default []
572
+ */
573
+ endTypes?: string[];
574
+ /**
575
+ * Properties of connections of this type that can be edited in the property editor component.
576
+ * @see PropertyEditorComponent
577
+ * @default []
578
+ */
579
+ properties?: Property[];
580
+ }
581
+ /**
582
+ * Configuration for the look of the markers at the start and end of a connection.
583
+ */
584
+ export interface ConnectionMarkerLook {
585
+ /**
586
+ * File path to the image used for the marker.
587
+ */
588
+ image: string;
589
+ /**
590
+ * File path to the image used for the marker when selected.
591
+ */
592
+ selectedImage: string;
593
+ /**
594
+ * The width of the marker in pixels.
595
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Element/marker |marker}
596
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/markerWidth |markerWidth}
597
+ */
598
+ markerWidth: number;
599
+ /**
600
+ * The height of the marker in pixels.
601
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Element/marker |marker}
602
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/markerHeight |markerHeight}
603
+ */
604
+ markerHeight: number;
605
+ /**
606
+ * The x coordinate of the reference point of the image used for the marker.
607
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Element/marker |marker}
608
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/refX |refX}
609
+ */
610
+ markerRefX: number;
611
+ /**
612
+ * The y coordinate of the reference point of the image used for the marker.
613
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Element/marker |marker}
614
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/refY |refY}
615
+ */
616
+ markerRefY: number;
617
+ }
@@ -0,0 +1,64 @@
1
+ import { Point } from '../../util/canvas-util';
2
+ import { LineShape, LineStyle } from '../../util/line';
3
+ import { Side } from '../../util/svg-util';
4
+ import { DiagramElement } from './diagram-element';
5
+ import { DiagramModel } from './diagram-model';
6
+ import { DiagramPort } from './diagram-port';
7
+ import { PropertySet, ValueSet } from './diagram-property';
8
+ import { ConnectionMarkerLook, ConnectionTypeConfig, FieldConfig } from './diagram-config';
9
+ export declare const DIAGRAM_CONNECTION_TYPE_DEFAULTS: {
10
+ name: string;
11
+ width: number;
12
+ shape: LineShape;
13
+ style: LineStyle;
14
+ label: null;
15
+ defaultStartMarkerLook: null;
16
+ defaultEndMarkerLook: null;
17
+ startTypes: never[];
18
+ endTypes: never[];
19
+ color: string;
20
+ selectedColor: string;
21
+ properties: never[];
22
+ };
23
+ export declare class DiagramConnectionType {
24
+ id: string;
25
+ name: string;
26
+ width: number;
27
+ shape: LineShape;
28
+ style: LineStyle;
29
+ label: FieldConfig | null;
30
+ defaultStartMarkerLook: ConnectionMarkerLook | null;
31
+ defaultEndMarkerLook: ConnectionMarkerLook | null;
32
+ startTypes: string[];
33
+ endTypes: string[];
34
+ color: string;
35
+ selectedColor: string;
36
+ propertySet: PropertySet;
37
+ constructor(options: ConnectionTypeConfig);
38
+ canStartFromType(type: string): boolean;
39
+ canFinishOnType(type: string): boolean;
40
+ }
41
+ export declare class DiagramConnection extends DiagramElement {
42
+ type: DiagramConnectionType;
43
+ valueSet: ValueSet;
44
+ originalData: unknown;
45
+ start?: DiagramPort;
46
+ startDirection?: Side;
47
+ startCoords: Point;
48
+ startMarkerLook: ConnectionMarkerLook | null;
49
+ end?: DiagramPort;
50
+ endDirection?: Side;
51
+ endCoords: Point;
52
+ endMarkerLook: ConnectionMarkerLook | null;
53
+ startLabel: string;
54
+ middleLabel: string;
55
+ endLabel: string;
56
+ points: Point[];
57
+ get name(): string;
58
+ set name(name: string);
59
+ constructor(model: DiagramModel, type: DiagramConnectionType, start?: DiagramPort, end?: DiagramPort, id?: string);
60
+ updateInView(): void;
61
+ setStart(start?: DiagramPort): void;
62
+ setEnd(end?: DiagramPort): void;
63
+ tighten(): void;
64
+ }
@@ -0,0 +1,21 @@
1
+ import * as d3 from 'd3';
2
+ import { DiagramModel } from './diagram-model';
3
+ /**
4
+ * Represents an object which exists as part of a particular diagram model and has a visual representation in a diagram canvas.
5
+ * @see DiagramModel
6
+ * @see DiagramCanvas
7
+ */
8
+ export declare abstract class DiagramElement {
9
+ model: DiagramModel;
10
+ _id: string;
11
+ get id(): string;
12
+ set id(value: string);
13
+ highlighted: boolean;
14
+ selected: boolean;
15
+ constructor(model: DiagramModel, id: string);
16
+ abstract updateInView(): void;
17
+ /**
18
+ * Obtain the selection of this element.
19
+ */
20
+ select(): d3.Selection<SVGGElement, unknown, null, unknown> | undefined;
21
+ }