@metadev/daga 3.1.5 → 4.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/Changelog.md +6 -0
- package/index.cjs.js +653 -307
- package/index.esm.js +653 -307
- package/package.json +1 -1
- package/src/index.d.ts +4 -2
- package/src/lib/diagram/canvas/diagram-canvas-util.d.ts +26 -0
- package/src/lib/diagram/canvas/diagram-canvas.d.ts +1 -3
- package/src/lib/diagram/{diagram-config.d.ts → config/diagram-config.d.ts} +22 -231
- package/src/lib/diagram/config/diagram-look.d.ts +220 -0
- package/src/lib/diagram/model/diagram-connection.d.ts +86 -26
- package/src/lib/diagram/model/diagram-decorator.d.ts +8 -1
- package/src/lib/diagram/model/diagram-element.d.ts +4 -0
- package/src/lib/diagram/model/diagram-field.d.ts +1 -1
- package/src/lib/diagram/model/diagram-node.d.ts +38 -8
- package/src/lib/diagram/model/diagram-object.d.ts +8 -1
- package/src/lib/diagram/model/diagram-port.d.ts +47 -12
- package/src/lib/diagram/model/diagram-property.d.ts +18 -3
- package/src/lib/diagram/model/diagram-section.d.ts +44 -20
- package/src/lib/interfaces/canvas.d.ts +1 -1
- package/src/lib/util/test-util.d.ts +1 -1
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { Corner, HorizontalAlign, Side, VerticalAlign } from '../../daga/src/lib/util/svg-util';
|
|
2
|
-
export { ACTION_STACK_SIZE, DiagramCanvas
|
|
2
|
+
export { ACTION_STACK_SIZE, DiagramCanvas } from './lib/diagram/canvas/diagram-canvas';
|
|
3
|
+
export { setCursorStyle } from './lib/diagram/canvas/diagram-canvas-util';
|
|
3
4
|
export { DiagramContextMenu } from './lib/diagram/canvas/diagram-context-menu';
|
|
4
5
|
export { DiagramUserHighlight } from './lib/diagram/canvas/diagram-user-highlight';
|
|
5
6
|
export { DiagramUserSelection } from './lib/diagram/canvas/diagram-user-selection';
|
|
@@ -13,7 +14,8 @@ export type { DiagramModelExporter } from './lib/diagram/converters/diagram-mode
|
|
|
13
14
|
export type { DiagramModelImporter } from './lib/diagram/converters/diagram-model-importer';
|
|
14
15
|
export { ActionStack, AddConnectionAction, AddNodeAction, ApplyLayoutAction, DiagramActionMethod, DiagramActions, EditFieldAction, MoveAction, PasteAction, RemoveAction, SetGeometryAction, SetParentAction, UpdateValuesAction } from './lib/diagram/diagram-action';
|
|
15
16
|
export type { DiagramAction } from './lib/diagram/diagram-action';
|
|
16
|
-
export type { ButtonsComponentConfig, CanvasConfig, ComponentsConfig,
|
|
17
|
+
export type { ButtonsComponentConfig, CanvasConfig, ComponentsConfig, ConnectionTemplateConfig, ConnectionTypeConfig, DiagramConfig, ErrorsComponentConfig, FieldConfig, GridConfig, NodeTemplateConfig, NodeTypeConfig, PaletteComponentConfig, PaletteSectionConfig, PortConfig, PortTypeConfig, PropertyEditorComponentConfig, SectionConfig, SectionGridConfig, UserActionConfig } from './lib/diagram/config/diagram-config';
|
|
18
|
+
export type { MarkerImageLook, StretchableImageLook, ImageLook, ShapedLook, Look, MarkerImageLookConfig, StretchableImageLookConfig, ImageLookConfig, ShapedLookConfig, LookConfig } from './lib/diagram/config/diagram-look';
|
|
17
19
|
export { DiagramDoubleClickEvent, DiagramEvent, DiagramEvents, DiagramHighlightedEvent, DiagramSecondaryClickEvent, DiagramSelectionEvent } from './lib/diagram/diagram-event';
|
|
18
20
|
export { AdjacencyLayout } from './lib/diagram/layout/adjacency-layout';
|
|
19
21
|
export { BreadthAdjacencyLayout } from './lib/diagram/layout/breadth-adjacency-layout';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as d3 from 'd3';
|
|
2
|
+
import { Point } from '../../util/canvas-util';
|
|
3
|
+
import { LineFunction, LineShape } from '../../util/line';
|
|
4
|
+
import { CursorStyle } from '../../util/style';
|
|
5
|
+
import { Side } from '../../util/svg-util';
|
|
6
|
+
import { DiagramField } from '../model/diagram-field';
|
|
7
|
+
import { DiagramNode } from '../model/diagram-node';
|
|
8
|
+
import { DiagramPort } from '../model/diagram-port';
|
|
9
|
+
import { DiagramSection } from '../model/diagram-section';
|
|
10
|
+
/**
|
|
11
|
+
* Checks if the given mouse event was produced with a secondary button press.
|
|
12
|
+
* @private
|
|
13
|
+
* @param event A mouse event.
|
|
14
|
+
* @returns `true` if the given mouse event was produced with a secondary button press, `false` otherwise.
|
|
15
|
+
*/
|
|
16
|
+
export declare const isSecondaryButton: (event: MouseEvent) => boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Get the SVG path of a diagram connection.
|
|
19
|
+
* @private
|
|
20
|
+
* @see linePath
|
|
21
|
+
*/
|
|
22
|
+
export declare const getConnectionPath: (shape: LineShape | LineFunction, startCoords: Point, endCoords: Point, startDirection: Side | undefined, endDirection: Side | undefined, width: number, startMarkerWidth: number | undefined, endMarkerWidth: number | undefined) => string;
|
|
23
|
+
export declare const setCursorStyle: (style?: CursorStyle) => void;
|
|
24
|
+
export declare const getRelatedNodeOrItself: (element: DiagramNode | DiagramSection | DiagramPort | DiagramField) => DiagramNode | DiagramSection | DiagramPort | DiagramField;
|
|
25
|
+
export declare const initializeLook: (selection: d3.Selection<SVGGElement, DiagramNode | DiagramSection | DiagramPort, d3.BaseType, unknown>) => void;
|
|
26
|
+
export declare const updateLook: (selection: d3.Selection<SVGGElement, DiagramNode | DiagramSection | DiagramPort, d3.BaseType, unknown>) => void;
|
|
@@ -4,10 +4,9 @@ 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 { CursorStyle } from '../../util/style';
|
|
8
7
|
import { CollabEngine } from '../collab/collab-engine';
|
|
8
|
+
import { DiagramConfig } from '../config/diagram-config';
|
|
9
9
|
import { ActionStack, DiagramAction, DiagramActionMethod, DiagramActions } from '../diagram-action';
|
|
10
|
-
import { DiagramConfig } from '../diagram-config';
|
|
11
10
|
import { DiagramEvent } from '../diagram-event';
|
|
12
11
|
import { DiagramConnectionType } from '../model/diagram-connection';
|
|
13
12
|
import { DiagramModel } from '../model/diagram-model';
|
|
@@ -145,4 +144,3 @@ export declare class DiagramCanvas implements Canvas {
|
|
|
145
144
|
private continueMultipleSelection;
|
|
146
145
|
private finishMultipleSelection;
|
|
147
146
|
}
|
|
148
|
-
export declare const setCursorStyle: (style?: CursorStyle) => void;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { Point } from '
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { Property } from './model/diagram-property';
|
|
1
|
+
import { Point } from '../../util/canvas-util';
|
|
2
|
+
import { Corner, HorizontalAlign, Side, VerticalAlign } from '../../util/svg-util';
|
|
3
|
+
import { DiagramActions } from '../diagram-action';
|
|
4
|
+
import { Property } from '../model/diagram-property';
|
|
5
|
+
import { ConnectionLookConfig, ImageLookConfig, MarkerImageLookConfig, ShapedLookConfig, StretchableImageLookConfig } from './diagram-look';
|
|
7
6
|
/**
|
|
8
7
|
* The configuration for a diagram.
|
|
9
8
|
* @public
|
|
@@ -348,7 +347,7 @@ export interface NodeTemplateConfig {
|
|
|
348
347
|
/**
|
|
349
348
|
* Look of this template as it appears on the palette which can be used to override the default look of the nodes of this type.
|
|
350
349
|
*/
|
|
351
|
-
look?:
|
|
350
|
+
look?: ShapedLookConfig | ImageLookConfig | StretchableImageLookConfig;
|
|
352
351
|
/**
|
|
353
352
|
* Label of this template as it appears on the palette and label that will be given to nodes created from this template.
|
|
354
353
|
*/
|
|
@@ -468,10 +467,9 @@ export interface NodeTypeConfig {
|
|
|
468
467
|
*/
|
|
469
468
|
ports?: PortConfig[];
|
|
470
469
|
/**
|
|
471
|
-
* Configuration of the look of nodes of this type as
|
|
472
|
-
* @default {lookType: 'shaped-look', shape: ClosedShape.Rectangle, fillColor: '#FFFFFF', borderColor: '#000000', selectedFillColor: '#FFFFFF', selectedBorderColor: '#000000'}
|
|
470
|
+
* Configuration of the look of nodes of this type as they should appear to the user.
|
|
473
471
|
*/
|
|
474
|
-
look?:
|
|
472
|
+
look?: ShapedLookConfig | ImageLookConfig | StretchableImageLookConfig;
|
|
475
473
|
/**
|
|
476
474
|
* If true and a node of this type already exists in the diagram, the user can't create more nodes of this type.
|
|
477
475
|
* @default false
|
|
@@ -524,7 +522,7 @@ export interface PortTypeConfig {
|
|
|
524
522
|
*/
|
|
525
523
|
allowsIncoming?: boolean;
|
|
526
524
|
/**
|
|
527
|
-
* Configuration for the label of
|
|
525
|
+
* Configuration for the label of ports of this type.
|
|
528
526
|
* @default null
|
|
529
527
|
*/
|
|
530
528
|
label?: FieldConfig | null;
|
|
@@ -534,10 +532,9 @@ export interface PortTypeConfig {
|
|
|
534
532
|
*/
|
|
535
533
|
width?: number;
|
|
536
534
|
/**
|
|
537
|
-
* Configuration of the look of ports of this type as they should appear to the user.
|
|
538
|
-
* @default undefined
|
|
535
|
+
* Configuration of the look of ports of this type as they should appear to the user.
|
|
539
536
|
*/
|
|
540
|
-
look?:
|
|
537
|
+
look?: ShapedLookConfig | ImageLookConfig;
|
|
541
538
|
}
|
|
542
539
|
/**
|
|
543
540
|
* Configuration for a port that is part of another element.
|
|
@@ -651,7 +648,7 @@ export interface SectionGridConfig {
|
|
|
651
648
|
*/
|
|
652
649
|
margin?: number;
|
|
653
650
|
/**
|
|
654
|
-
* Configuration for the
|
|
651
|
+
* Configuration for the look of each section of this grid.
|
|
655
652
|
* @default [[]]
|
|
656
653
|
*/
|
|
657
654
|
sections: SectionConfig[][];
|
|
@@ -673,162 +670,15 @@ export interface SectionConfig {
|
|
|
673
670
|
*/
|
|
674
671
|
ports?: PortConfig[];
|
|
675
672
|
/**
|
|
676
|
-
* Configuration of the look of
|
|
677
|
-
* @default {lookType: 'shaped-look', shape: ClosedShape.Rectangle, color: '#FFFFFF', borderColor: '#000000', selectedColor: '#FFFFFF', selectedBorderColor: '#000000'}
|
|
673
|
+
* Configuration of the look of nodes of this type as they should appear to the user.
|
|
678
674
|
*/
|
|
679
|
-
look?:
|
|
675
|
+
look?: ShapedLookConfig | ImageLookConfig | StretchableImageLookConfig;
|
|
680
676
|
/**
|
|
681
677
|
* The priority of this section when filtering out sections below a given threshold.
|
|
682
678
|
* @default 0
|
|
683
679
|
*/
|
|
684
680
|
priority?: number;
|
|
685
681
|
}
|
|
686
|
-
/**
|
|
687
|
-
* Configuration for the look of a node given by shape and color.
|
|
688
|
-
* @public
|
|
689
|
-
*/
|
|
690
|
-
export interface ShapedLook {
|
|
691
|
-
/**
|
|
692
|
-
* String used to discern the type of node look this is.
|
|
693
|
-
*/
|
|
694
|
-
lookType: 'shaped-look';
|
|
695
|
-
/**
|
|
696
|
-
* Shape of nodes using this look.
|
|
697
|
-
*/
|
|
698
|
-
shape: ClosedShape | ShapeFunction;
|
|
699
|
-
/**
|
|
700
|
-
* Background color of nodes using this look.
|
|
701
|
-
*/
|
|
702
|
-
fillColor: string;
|
|
703
|
-
/**
|
|
704
|
-
* Border color of nodes using this look.
|
|
705
|
-
*/
|
|
706
|
-
borderColor: string;
|
|
707
|
-
/**
|
|
708
|
-
* Background color of nodes using this look when selected.
|
|
709
|
-
*/
|
|
710
|
-
selectedFillColor: string;
|
|
711
|
-
/**
|
|
712
|
-
* Border color of nodes using this look when selected.
|
|
713
|
-
*/
|
|
714
|
-
selectedBorderColor: string;
|
|
715
|
-
}
|
|
716
|
-
/**
|
|
717
|
-
* Configuration for the look of a node given by an image.
|
|
718
|
-
* @public
|
|
719
|
-
*/
|
|
720
|
-
export interface ImageLook {
|
|
721
|
-
/**
|
|
722
|
-
* String used to discern the type of node look this is.
|
|
723
|
-
*/
|
|
724
|
-
lookType: 'image-look';
|
|
725
|
-
/**
|
|
726
|
-
* File path to the background image used by nodes using this look.
|
|
727
|
-
*/
|
|
728
|
-
backgroundImage: string;
|
|
729
|
-
/**
|
|
730
|
-
* File path to the background image used by nodes using this look when selected.
|
|
731
|
-
*/
|
|
732
|
-
selectedBackgroundImage: string;
|
|
733
|
-
}
|
|
734
|
-
/**
|
|
735
|
-
* Configuration for the look of a node given by fixed size images in the corners and stretchable images in the middle.
|
|
736
|
-
* @public
|
|
737
|
-
*/
|
|
738
|
-
export interface StretchableImageLook {
|
|
739
|
-
/**
|
|
740
|
-
* String used to discern the type of node look this is.
|
|
741
|
-
*/
|
|
742
|
-
lookType: 'stretchable-image-look';
|
|
743
|
-
/**
|
|
744
|
-
* Width taken up by the images at the left of nodes using this look in diagram units.
|
|
745
|
-
*/
|
|
746
|
-
leftMargin: number;
|
|
747
|
-
/**
|
|
748
|
-
* Width taken up by the images at the right of nodes using this look in diagram units.
|
|
749
|
-
*/
|
|
750
|
-
rightMargin: number;
|
|
751
|
-
/**
|
|
752
|
-
* Width taken up by the images at the top of nodes using this look in diagram units.
|
|
753
|
-
*/
|
|
754
|
-
topMargin: number;
|
|
755
|
-
/**
|
|
756
|
-
* Width taken up by the images at the bottom of nodes using this look in diagram units.
|
|
757
|
-
*/
|
|
758
|
-
bottomMargin: number;
|
|
759
|
-
/**
|
|
760
|
-
* File path to the background image used at the top left of nodes using this look.
|
|
761
|
-
*/
|
|
762
|
-
backgroundImageTopLeft: string;
|
|
763
|
-
/**
|
|
764
|
-
* File path to the background image used at the top of nodes using this look.
|
|
765
|
-
*/
|
|
766
|
-
backgroundImageTop: string;
|
|
767
|
-
/**
|
|
768
|
-
* File path to the background image used at the top right of nodes using this look.
|
|
769
|
-
*/
|
|
770
|
-
backgroundImageTopRight: string;
|
|
771
|
-
/**
|
|
772
|
-
* File path to the background image used at the left of nodes using this look.
|
|
773
|
-
*/
|
|
774
|
-
backgroundImageLeft: string;
|
|
775
|
-
/**
|
|
776
|
-
* File path to the background image used at the center of nodes using this look.
|
|
777
|
-
*/
|
|
778
|
-
backgroundImageCenter: string;
|
|
779
|
-
/**
|
|
780
|
-
* File path to the background image used at the right of nodes using this look.
|
|
781
|
-
*/
|
|
782
|
-
backgroundImageRight: string;
|
|
783
|
-
/**
|
|
784
|
-
* File path to the background image used at the bottom left of nodes using this look.
|
|
785
|
-
*/
|
|
786
|
-
backgroundImageBottomLeft: string;
|
|
787
|
-
/**
|
|
788
|
-
* File path to the background image used at the bottom of nodes using this look.
|
|
789
|
-
*/
|
|
790
|
-
backgroundImageBottom: string;
|
|
791
|
-
/**
|
|
792
|
-
* File path to the background image used at the bottom right of nodes using this look.
|
|
793
|
-
*/
|
|
794
|
-
backgroundImageBottomRight: string;
|
|
795
|
-
/**
|
|
796
|
-
* File path to the background image used at the top left of nodes using this look when selected.
|
|
797
|
-
*/
|
|
798
|
-
selectedBackgroundImageTopLeft: string;
|
|
799
|
-
/**
|
|
800
|
-
* File path to the background image used at the top of nodes using this look when selected.
|
|
801
|
-
*/
|
|
802
|
-
selectedBackgroundImageTop: string;
|
|
803
|
-
/**
|
|
804
|
-
* File path to the background image used at the top right of nodes using this look when selected.
|
|
805
|
-
*/
|
|
806
|
-
selectedBackgroundImageTopRight: string;
|
|
807
|
-
/**
|
|
808
|
-
* File path to the background image used at the left of nodes using this look when selected.
|
|
809
|
-
*/
|
|
810
|
-
selectedBackgroundImageLeft: string;
|
|
811
|
-
/**
|
|
812
|
-
* File path to the background image used at the center of nodes using this look when selected.
|
|
813
|
-
*/
|
|
814
|
-
selectedBackgroundImageCenter: string;
|
|
815
|
-
/**
|
|
816
|
-
* File path to the background image used at the right of nodes using this look when selected.
|
|
817
|
-
*/
|
|
818
|
-
selectedBackgroundImageRight: string;
|
|
819
|
-
/**
|
|
820
|
-
* File path to the background image used at the bottom left of nodes using this look when selected.
|
|
821
|
-
*/
|
|
822
|
-
selectedBackgroundImageBottomLeft: string;
|
|
823
|
-
/**
|
|
824
|
-
* File path to the background image used at the bottom of nodes using this look when selected.
|
|
825
|
-
*/
|
|
826
|
-
selectedBackgroundImageBottom: string;
|
|
827
|
-
/**
|
|
828
|
-
* File path to the background image used at the bottom right of nodes using this look when selected.
|
|
829
|
-
*/
|
|
830
|
-
selectedBackgroundImageBottomRight: string;
|
|
831
|
-
}
|
|
832
682
|
/**
|
|
833
683
|
* Configuration for a type of connection.
|
|
834
684
|
* @public
|
|
@@ -843,45 +693,24 @@ export interface ConnectionTypeConfig {
|
|
|
843
693
|
* Name of this type of connection as displayed to the user.
|
|
844
694
|
*/
|
|
845
695
|
name?: string;
|
|
846
|
-
/**
|
|
847
|
-
* Color of the line of connections of this type.
|
|
848
|
-
* @default '#000000'
|
|
849
|
-
*/
|
|
850
|
-
color?: string;
|
|
851
|
-
/**
|
|
852
|
-
* Color of the line of connections of this type when selected.
|
|
853
|
-
* @default '#000000'
|
|
854
|
-
*/
|
|
855
|
-
selectedColor?: string;
|
|
856
|
-
/**
|
|
857
|
-
* Width of the line of connections of this type in diagram units.
|
|
858
|
-
* @default 1
|
|
859
|
-
*/
|
|
860
|
-
width?: number;
|
|
861
|
-
/**
|
|
862
|
-
* Shape of the line of connections of this type.
|
|
863
|
-
* @default 'straight'
|
|
864
|
-
*/
|
|
865
|
-
shape?: LineShape | LineFunction;
|
|
866
|
-
/**
|
|
867
|
-
* Style of the line of connections of this type.
|
|
868
|
-
* @default 'solid'
|
|
869
|
-
*/
|
|
870
|
-
style?: LineStyle;
|
|
871
696
|
/**
|
|
872
697
|
* Configuration of the labels of connections of this type.
|
|
873
698
|
*/
|
|
874
699
|
label?: FieldConfig | null;
|
|
700
|
+
/**
|
|
701
|
+
* Configuration of the look of connections of this type as they should appear to the user.
|
|
702
|
+
*/
|
|
703
|
+
look?: ConnectionLookConfig;
|
|
875
704
|
/**
|
|
876
705
|
* 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.
|
|
877
|
-
* @default
|
|
706
|
+
* @default undefined
|
|
878
707
|
*/
|
|
879
|
-
|
|
708
|
+
startMarkerLook?: MarkerImageLookConfig;
|
|
880
709
|
/**
|
|
881
710
|
* 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.
|
|
882
|
-
* @default
|
|
711
|
+
* @default undefined
|
|
883
712
|
*/
|
|
884
|
-
|
|
713
|
+
endMarkerLook?: MarkerImageLookConfig;
|
|
885
714
|
/**
|
|
886
715
|
* 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.
|
|
887
716
|
* @default []
|
|
@@ -899,41 +728,3 @@ export interface ConnectionTypeConfig {
|
|
|
899
728
|
*/
|
|
900
729
|
properties?: Property[];
|
|
901
730
|
}
|
|
902
|
-
/**
|
|
903
|
-
* Configuration for the look of the markers at the start and end of a connection.
|
|
904
|
-
* @public
|
|
905
|
-
*/
|
|
906
|
-
export interface ConnectionMarkerLook {
|
|
907
|
-
/**
|
|
908
|
-
* File path to the image used for the marker.
|
|
909
|
-
*/
|
|
910
|
-
image: string;
|
|
911
|
-
/**
|
|
912
|
-
* File path to the image used for the marker when selected.
|
|
913
|
-
*/
|
|
914
|
-
selectedImage: string;
|
|
915
|
-
/**
|
|
916
|
-
* The width of the marker in diagram units.
|
|
917
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Element/marker |marker}
|
|
918
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/markerWidth |markerWidth}
|
|
919
|
-
*/
|
|
920
|
-
markerWidth: number;
|
|
921
|
-
/**
|
|
922
|
-
* The height of the marker in diagram units.
|
|
923
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Element/marker |marker}
|
|
924
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/markerHeight |markerHeight}
|
|
925
|
-
*/
|
|
926
|
-
markerHeight: number;
|
|
927
|
-
/**
|
|
928
|
-
* The x coordinate of the reference point of the image used for the marker.
|
|
929
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Element/marker |marker}
|
|
930
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/refX |refX}
|
|
931
|
-
*/
|
|
932
|
-
markerRefX: number;
|
|
933
|
-
/**
|
|
934
|
-
* The y coordinate of the reference point of the image used for the marker.
|
|
935
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Element/marker |marker}
|
|
936
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/refY |refY}
|
|
937
|
-
*/
|
|
938
|
-
markerRefY: number;
|
|
939
|
-
}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { LineFunction, LineShape, LineStyle } from '../../util/line';
|
|
2
|
+
import { ClosedShape, ShapeFunction } from '../../util/shape';
|
|
3
|
+
/**
|
|
4
|
+
* Converts a configuration for a look into an easier to consult object of fully qualified looks for each case.
|
|
5
|
+
*
|
|
6
|
+
* @param lookConfig A look configuration object
|
|
7
|
+
* @returns An object with four keys for a look with each possible state of being selected or not and being highlighted or not.
|
|
8
|
+
*/
|
|
9
|
+
export declare const extractLooksFromConfig: <L extends Look>(lookConfig: LookConfig<L>) => {
|
|
10
|
+
defaultLook: L;
|
|
11
|
+
selectedLook: L;
|
|
12
|
+
highlightedLook: L;
|
|
13
|
+
selectedAndHighlightedLook: L;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* A configuration object for a look, which consists of the look
|
|
17
|
+
* plus optional objects indicating which values are different
|
|
18
|
+
* when the object with this look is selected or highlighted.
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export interface LookConfig<L extends Look> {
|
|
22
|
+
selected?: Partial<L>;
|
|
23
|
+
highlighted?: Partial<L>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Configuration object for a look given by a shape.
|
|
27
|
+
* @public
|
|
28
|
+
* @see ShapedLook
|
|
29
|
+
*/
|
|
30
|
+
export interface ShapedLookConfig extends ShapedLook, LookConfig<ShapedLook> {
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Configuration object for a look given by an image.
|
|
34
|
+
* @public
|
|
35
|
+
* @see ImageLook
|
|
36
|
+
*/
|
|
37
|
+
export interface ImageLookConfig extends ImageLook, LookConfig<ImageLook> {
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Configuration object for a look given by fixed size images in the corners and stretchable images in the middle.
|
|
41
|
+
* @public
|
|
42
|
+
* @see StretchableImageLook
|
|
43
|
+
*/
|
|
44
|
+
export interface StretchableImageLookConfig extends StretchableImageLook, LookConfig<StretchableImageLook> {
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Configuration for a look for the markers at the start and end of a connection given by an image.
|
|
48
|
+
* @public
|
|
49
|
+
* @see MarkerImageLook
|
|
50
|
+
*/
|
|
51
|
+
export interface MarkerImageLookConfig extends MarkerImageLook, LookConfig<MarkerImageLook> {
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Configuration for a look for a connection.
|
|
55
|
+
* @public
|
|
56
|
+
* @see MarkerImageLook
|
|
57
|
+
*/
|
|
58
|
+
export interface ConnectionLookConfig extends ConnectionLook, LookConfig<ConnectionLook> {
|
|
59
|
+
}
|
|
60
|
+
export interface Look {
|
|
61
|
+
/**
|
|
62
|
+
* String used to discern the type of look this is.
|
|
63
|
+
*/
|
|
64
|
+
lookType: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Configuration for a look given by a shape.
|
|
68
|
+
* @public
|
|
69
|
+
*/
|
|
70
|
+
export interface ShapedLook extends Look {
|
|
71
|
+
lookType: 'shaped-look';
|
|
72
|
+
/**
|
|
73
|
+
* Shape of nodes using this look.
|
|
74
|
+
*/
|
|
75
|
+
shape: ClosedShape | ShapeFunction;
|
|
76
|
+
/**
|
|
77
|
+
* Background color of this look.
|
|
78
|
+
*/
|
|
79
|
+
fillColor: string;
|
|
80
|
+
/**
|
|
81
|
+
* Border color of this look.
|
|
82
|
+
*/
|
|
83
|
+
borderColor: string;
|
|
84
|
+
/**
|
|
85
|
+
* Border thickness of this look in diagram units.
|
|
86
|
+
*/
|
|
87
|
+
borderThickness: number;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Configuration for a look given by an image.
|
|
91
|
+
* @public
|
|
92
|
+
*/
|
|
93
|
+
export interface ImageLook extends Look {
|
|
94
|
+
lookType: 'image-look';
|
|
95
|
+
/**
|
|
96
|
+
* File path to the background image used by this look.
|
|
97
|
+
*/
|
|
98
|
+
backgroundImage: string;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Configuration for a look given by fixed size images in the corners and stretchable images in the middle.
|
|
102
|
+
* @public
|
|
103
|
+
*/
|
|
104
|
+
export interface StretchableImageLook extends Look {
|
|
105
|
+
lookType: 'stretchable-image-look';
|
|
106
|
+
/**
|
|
107
|
+
* Width taken up by the images at the left of the look in diagram units.
|
|
108
|
+
*/
|
|
109
|
+
leftMargin: number;
|
|
110
|
+
/**
|
|
111
|
+
* Width taken up by the images at the right of the look in diagram units.
|
|
112
|
+
*/
|
|
113
|
+
rightMargin: number;
|
|
114
|
+
/**
|
|
115
|
+
* Width taken up by the images at the top of the look in diagram units.
|
|
116
|
+
*/
|
|
117
|
+
topMargin: number;
|
|
118
|
+
/**
|
|
119
|
+
* Width taken up by the images at the bottom of the look in diagram units.
|
|
120
|
+
*/
|
|
121
|
+
bottomMargin: number;
|
|
122
|
+
/**
|
|
123
|
+
* File path to the background image used at the top left of the look.
|
|
124
|
+
*/
|
|
125
|
+
backgroundImageTopLeft: string;
|
|
126
|
+
/**
|
|
127
|
+
* File path to the background image used at the top of the look.
|
|
128
|
+
*/
|
|
129
|
+
backgroundImageTop: string;
|
|
130
|
+
/**
|
|
131
|
+
* File path to the background image used at the top right of the look.
|
|
132
|
+
*/
|
|
133
|
+
backgroundImageTopRight: string;
|
|
134
|
+
/**
|
|
135
|
+
* File path to the background image used at the left of the look.
|
|
136
|
+
*/
|
|
137
|
+
backgroundImageLeft: string;
|
|
138
|
+
/**
|
|
139
|
+
* File path to the background image used at the center of the look.
|
|
140
|
+
*/
|
|
141
|
+
backgroundImageCenter: string;
|
|
142
|
+
/**
|
|
143
|
+
* File path to the background image used at the right of the look.
|
|
144
|
+
*/
|
|
145
|
+
backgroundImageRight: string;
|
|
146
|
+
/**
|
|
147
|
+
* File path to the background image used at the bottom left of the look.
|
|
148
|
+
*/
|
|
149
|
+
backgroundImageBottomLeft: string;
|
|
150
|
+
/**
|
|
151
|
+
* File path to the background image used at the bottom of the look.
|
|
152
|
+
*/
|
|
153
|
+
backgroundImageBottom: string;
|
|
154
|
+
/**
|
|
155
|
+
* File path to the background image used at the bottom right of the look.
|
|
156
|
+
*/
|
|
157
|
+
backgroundImageBottomRight: string;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Configuration for a look for the markers at the start and end of a connection given by an image.
|
|
161
|
+
* @public
|
|
162
|
+
*/
|
|
163
|
+
export interface MarkerImageLook extends Look {
|
|
164
|
+
lookType: 'marker-image-look';
|
|
165
|
+
/**
|
|
166
|
+
* File path to the image used for the marker.
|
|
167
|
+
*/
|
|
168
|
+
image: string;
|
|
169
|
+
/**
|
|
170
|
+
* The width of the marker in diagram units.
|
|
171
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Element/marker |marker}
|
|
172
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/markerWidth |markerWidth}
|
|
173
|
+
*/
|
|
174
|
+
width: number;
|
|
175
|
+
/**
|
|
176
|
+
* The height of the marker in diagram units.
|
|
177
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Element/marker |marker}
|
|
178
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/markerHeight |markerHeight}
|
|
179
|
+
*/
|
|
180
|
+
height: number;
|
|
181
|
+
/**
|
|
182
|
+
* The x coordinate of the reference point of the image used for the marker.
|
|
183
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Element/marker |marker}
|
|
184
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/refX |refX}
|
|
185
|
+
*/
|
|
186
|
+
refX: number;
|
|
187
|
+
/**
|
|
188
|
+
* The y coordinate of the reference point of the image used for the marker.
|
|
189
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Element/marker |marker}
|
|
190
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/refY |refY}
|
|
191
|
+
*/
|
|
192
|
+
refY: number;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Configuration for a look for a connection.
|
|
196
|
+
* @public
|
|
197
|
+
*/
|
|
198
|
+
export interface ConnectionLook extends Look {
|
|
199
|
+
lookType: 'connection-look';
|
|
200
|
+
/**
|
|
201
|
+
* Color of the line of connections of this type.
|
|
202
|
+
* @default '#000000'
|
|
203
|
+
*/
|
|
204
|
+
color: string;
|
|
205
|
+
/**
|
|
206
|
+
* Thickness of the line of connections of this type in diagram units.
|
|
207
|
+
* @default 1
|
|
208
|
+
*/
|
|
209
|
+
thickness: number;
|
|
210
|
+
/**
|
|
211
|
+
* Shape of the line of connections of this type.
|
|
212
|
+
* @default 'straight'
|
|
213
|
+
*/
|
|
214
|
+
shape: LineShape | LineFunction;
|
|
215
|
+
/**
|
|
216
|
+
* Style of the line of connections of this type.
|
|
217
|
+
* @default 'solid'
|
|
218
|
+
*/
|
|
219
|
+
style: LineStyle;
|
|
220
|
+
}
|