import { AnchorPoint, Point } from '../../util/canvas-util'; import { Side } from '../../util/svg-util'; import { FieldConfig, PortTypeConfig } from '../config/diagram-config'; import { ImageLook, ImageLookConfig, ShapedLook, ShapedLookConfig } from '../config/diagram-look-config'; import { DiagramConnection } from './diagram-connection'; import { DiagramElement, DiagramElementSet } from './diagram-element'; import { DiagramEntity, DiagramEntitySet } from './diagram-entity'; import { DiagramField, LabeledElement } from './diagram-field'; import { DiagramModel } from './diagram-model'; import { DiagramNode } from './diagram-node'; import { DiagramSection } from './diagram-section'; /** * Default values of the look of a diagram port. * @private * @see DIAGRAM_NODE_TYPE_DEFAULTS */ export declare const DIAGRAM_PORT_LOOK_DEFAULTS: ShapedLookConfig; /** * Default values of the parameters of a diagram port. * @private * @see DiagramPort */ export declare const DIAGRAM_PORT_TYPE_DEFAULTS: { name: string; label: null; allowsOutgoing: boolean; allowsIncoming: boolean; width: number; look: ShapedLookConfig; }; /** * The types allowed for the look of a port. * @public * @see Look * @see DiagramPort */ export type PortLook = ShapedLook | ImageLook; /** * A port type, which holds properties that ports of this type share in common. * @public * @see PortTypeConfig */ export declare class DiagramPortType implements DiagramEntity { readonly id: string; name: string; label: FieldConfig | null; /** * Whether ports of this type can be used as a connection start point. */ allowsOutgoing: boolean; /** * Whether ports of this type can be used as a connection end point. */ allowsIncoming: boolean; /** * Width of ports of this type in diagram units. */ width: number; defaultLook: PortLook; selectedLook: PortLook; highlightedLook: PortLook; selectedAndHighlightedLook: PortLook; constructor(options: PortTypeConfig); } /** * A port which is part of a node or section and at which connections can start or end. * @public * @see DiagramConnection * @see DiagramNode * @see DiagramSection */ export declare class DiagramPort extends DiagramElement implements LabeledElement { #private; get type(): DiagramPortType | undefined; set type(type: DiagramPortType | undefined); get typeString(): string | undefined; set typeString(typeString: string | undefined); /** * Element that this port belongs to. * @public */ rootElement?: DiagramNode | DiagramSection; /** * Label of this port. * @public */ label?: DiagramField; /** * Coordinates of this port. * @public */ coords: Point; /** * Coordinates of the point where connections end and start from this port. * @public */ connectionPoint: Point; /** * Direction of the connections of this port at the coordinates of this port. * @public */ direction: Side; /** * Horizontal anchor point for this port. Determines how the port behaves when its root element is resized. * @public */ anchorPointX: AnchorPoint; /** * Vertical anchor point for this port. Determines how the port behaves when its root element is resized. * @public */ anchorPointY: AnchorPoint; /** * Whether this port can be used as a connection start point. */ get allowsOutgoing(): boolean; /** * Whether this port can be used as a connection end point. */ get allowsIncoming(): boolean; /** * Connections that start at this port. * @public */ outgoingConnections: DiagramConnection[]; /** * Connections that end at this port. * @public */ incomingConnections: DiagramConnection[]; /** * Name of this port. Alias for this port's label's text. * @public */ get name(): string; set name(name: string); private _lookConfig?; private _defaultLook?; private _selectedLook?; private _highlightedLook?; private _selectedAndHighlightedLook?; /** * Current look of this port. * @private */ get look(): PortLook; /** * An alias for the `lookConfig` attribute. * @private */ set look(look: ShapedLookConfig | ImageLookConfig | undefined); /** * Look configuration used to derive the current look of this port. * @private */ get lookConfig(): ShapedLookConfig | ImageLookConfig | undefined; /** * Sets the look configuration of the look to override the one determined by the type. * `undefined` resets it to the one determined by the type. * @private */ set lookConfig(lookConfig: ShapedLookConfig | ImageLookConfig | undefined); /** * Current width of this port. * @private */ get width(): number; /** * Current height of this port. Same as the width. * @private */ get height(): number; constructor(model: DiagramModel, type: DiagramPortType | undefined, rootElement: DiagramNode | DiagramSection | undefined, coords: Point, connectionPoint: Point | undefined, direction: Side, id: string, anchorPointX?: AnchorPoint, anchorPointY?: AnchorPoint); get removed(): boolean; updateInView(): void; raise(raiseConnections?: boolean): void; /** * Add a connection to this port's list of outgoing connections. * @public * @param connection A connection. */ startConnection(connection: DiagramConnection): void; /** * Add a connection to this port's list of incoming connections. * @public * @param connection A connection. */ finishConnection(connection: DiagramConnection): void; /** * Get the root node of this port, which is either its rootElement if it's a node or it's rootElement's node if it's a section. * @public * @returns A node if it could be found, `undefined` otherwise. */ getNode(): DiagramNode | undefined; getPriority(): number; /** * Change the coordinates of this port to the given coordinates and move its labels correspondingly. * @public * @param coords A point in the diagram. */ move(coords: Point): void; distanceTo(coords: Point): number; } export declare class DiagramPortSet extends DiagramElementSet { #private; /** * Set of the possible types of port that the ports of this set can have. * @public */ readonly types: DiagramEntitySet; /** * Instance a set of ports for the given model. This method is used internally. * @private */ constructor(model: DiagramModel); /** * Instance a new port and add it to this set. This method is normally called when instancing an element with a port and it is rarely called by itself. * @private */ new(type: DiagramPortType | undefined, rootElement: DiagramNode | DiagramSection | undefined, coords: Point, connectionPoint: Point | undefined, direction: Side, id: string, anchorPointX?: AnchorPoint, anchorPointY?: AnchorPoint): DiagramPort; remove(id: string): void; }