import { LineFunction, LineShape, LineStyle } from '../../util/line'; import { ClosedShape, ShapeFunction } from '../../util/shape'; /** * Converts a configuration for a look into an easier to consult object of fully qualified looks for each case. * * @param lookConfig A look configuration object * @returns An object with four keys for a look with each possible state of being selected or not and being highlighted or not. */ export declare const extractLooksFromConfig: (lookConfig: LookConfig) => { defaultLook: L; selectedLook: L; highlightedLook: L; selectedAndHighlightedLook: L; }; /** * A configuration object for a look, which consists of the look * plus optional objects indicating which values are different * when the object with this look is selected or highlighted. * @public */ export interface LookConfig { selected?: Partial; highlighted?: Partial; selectedAndHighlighted?: Partial; } /** * Configuration object for a look given by a shape. * @public * @see ShapedLook */ export interface ShapedLookConfig extends ShapedLook, LookConfig { } /** * Configuration object for a look given by an image. * @public * @see ImageLook */ export interface ImageLookConfig extends ImageLook, LookConfig { } /** * Configuration object for a look given by fixed size images in the corners and stretchable images in the middle. * @public * @see StretchableImageLook */ export interface StretchableImageLookConfig extends StretchableImageLook, LookConfig { } /** * Configuration for a look for the markers at the start and end of a connection given by an image. * @public * @see MarkerImageLook */ export interface MarkerImageLookConfig extends MarkerImageLook, LookConfig { } /** * Configuration for a look for a connection. * @public * @see MarkerImageLook */ export interface ConnectionLookConfig extends ConnectionLook, LookConfig { } /** * Configuration for a look for a field. * @public * @see FieldLook */ export interface FieldLookConfig extends FieldLook, LookConfig { } /** * Configuration for a look for a resizer. * @public * @see ResizerLook */ export interface ResizerLookConfig extends ResizerLook, LookConfig { } export interface Look { /** * String used to discern the type of look this is in cases where different types of looks can be used. */ lookType?: string; } /** * Configuration for a look given by a shape. * @public */ export interface ShapedLook extends Look { lookType: 'shaped-look'; /** * Shape of nodes using this look. * @default 'rectangle' */ shape?: ClosedShape | ShapeFunction; /** * Background color of this look. * @default '#FFFFFF' */ fillColor?: string; /** * Border color of this look. * @default '#000000' */ borderColor?: string; /** * Border thickness of this look in diagram units. * @default 1 */ borderThickness?: number; /** * Border style of this look. * @default 'solid' */ borderStyle?: LineStyle; } /** * Configuration for a look given by an image. * @public */ export interface ImageLook extends Look { lookType: 'image-look'; /** * File path to the background image used by this look. */ backgroundImage: string; } /** * Configuration for a look given by fixed size images in the corners and stretchable images in the middle. * @public */ export interface StretchableImageLook extends Look { lookType: 'stretchable-image-look'; /** * Width taken up by the images at the left of the look in diagram units. */ leftMargin: number; /** * Width taken up by the images at the right of the look in diagram units. */ rightMargin: number; /** * Width taken up by the images at the top of the look in diagram units. */ topMargin: number; /** * Width taken up by the images at the bottom of the look in diagram units. */ bottomMargin: number; /** * File path to the background image used at the top left of the look. */ backgroundImageTopLeft: string; /** * File path to the background image used at the top of the look. */ backgroundImageTop: string; /** * File path to the background image used at the top right of the look. */ backgroundImageTopRight: string; /** * File path to the background image used at the left of the look. */ backgroundImageLeft: string; /** * File path to the background image used at the center of the look. */ backgroundImageCenter: string; /** * File path to the background image used at the right of the look. */ backgroundImageRight: string; /** * File path to the background image used at the bottom left of the look. */ backgroundImageBottomLeft: string; /** * File path to the background image used at the bottom of the look. */ backgroundImageBottom: string; /** * File path to the background image used at the bottom right of the look. */ backgroundImageBottomRight: string; } /** * Configuration for a look for the markers at the start and end of a connection given by an image. * @public */ export interface MarkerImageLook extends Look { /** * File path to the image used for the marker. */ image: string; /** * The width of the marker in diagram units. * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Element/marker |marker} * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/markerWidth |markerWidth} */ width: number; /** * The height of the marker in diagram units. * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Element/marker |marker} * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/markerHeight |markerHeight} */ height: number; /** * The x coordinate of the reference point of the image used for the marker. * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Element/marker |marker} * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/refX |refX} */ refX: number; /** * The y coordinate of the reference point of the image used for the marker. * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Element/marker |marker} * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/refY |refY} */ refY: number; } /** * Configuration for a look for a connection. * @public */ export interface ConnectionLook extends Look { /** * Color of the line of connections of this type. * @default '#000000' */ color?: string; /** * Thickness of the line of connections of this type in diagram units. * @default 1 */ thickness?: number; /** * Shape of the line of connections of this type. * @default 'straight' */ shape?: LineShape | LineFunction; /** * Style of the line of connections of this type. * @default 'solid' */ style?: LineStyle; } /** * Configuration for a look for a field. * @public */ export interface FieldLook extends Look { /** * Background color of this look. * @default '#FFFFFF' */ fillColor?: string; /** * Font color of this look. * @default '#000000' */ fontColor?: string; /** * Font family of this field. `null` for the default one. * @default null * @see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/font-family |font-family} */ fontFamily?: string | null; /** * Font size of this field. * @default 10 */ fontSize?: number; /** * Font weight of this field. * @default 400 */ fontWeight?: number; } /** * Configuration for a look for a resizer. * @public */ export interface ResizerLook extends Look { /** * Color of this resizer. * @default 'transparent' */ fillColor?: string; /** * Border color of this resizer. * @default 'transparent' */ borderColor?: string; /** * Border thickness of this resizer in diagram units. * @default 0 */ borderThickness?: number; }