import type { g } from './geometry'; import type { Vectorizer } from './vectorizer'; export const version: string; export namespace config { var useCSSSelectors: boolean; var classNamePrefix: string; var defaultTheme: string; var doubleTapInterval: number; var cellMergeStrategy: util.MergeCustomizer | null; var cellDefaultsMergeStrategy: util.MergeCustomizer | null; var layerAttribute: string; } type NativeEvent = Event; type _DeepRequired = { [P in keyof T]-?: T[P] extends object ? _DeepRequired : T[P]; }; type _DeepPartial = { [P in keyof T]?: T[P] extends object ? _DeepPartial : T[P]; }; type DeepPartial = _DeepPartial<_DeepRequired>; /** * A type that makes all properties of T nullable. */ type Nullable = { [K in keyof T]: T[K] | null }; // We use `DOMElement` later in the code, to avoid conflicts with the `dia.Element` type. type DOMElement = Element; export namespace dia { type Event = mvc.TriggeredEvent; type ObjectHash = { [key: string]: any }; type Point = g.PlainPoint; type BBox = g.PlainRect; type Size = Pick; type PaddingJSON = { left?: number; top?: number; right?: number; bottom?: number; }; type Padding = number | PaddingJSON; type SidesJSON = { left?: number; top?: number; right?: number; bottom?: number; horizontal?: number; vertical?: number; }; type LegacyPositionName = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'topMiddle' | 'bottomMiddle' | 'leftMiddle' | 'rightMiddle' | 'corner' | 'origin'; type PositionName = 'top' | 'left' | 'bottom' | 'right' | 'center' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | LegacyPositionName; type Sides = number | SidesJSON; type OrthogonalDirection = 'left' | 'top' | 'right' | 'bottom'; type DiagonalDirection = 'top-left' | 'top-right' | 'bottom-right' | 'bottom-left'; type Direction = OrthogonalDirection | DiagonalDirection; type LinkEnd = 'source' | 'target'; type MarkupNodeJSON = { tagName: string; selector?: string; groupSelector?: string | string[]; namespaceURI?: string; className?: string; attributes?: attributes.NativeSVGAttributes; style?: { [key: string]: any }; children?: MarkupJSON; textContent?: string; }; type MarkupJSON = Array; type Path = string | Array; interface ModelSetOptions extends mvc.ModelSetOptions { dry?: boolean; isolate?: boolean; [key: string]: any; } interface CollectionAddOptions extends mvc.AddOptions { dry?: boolean; [key: string]: any; } interface SVGPatternJSON { id?: string; type: 'pattern'; attrs?: attributes.NativeSVGAttributes; markup: string | MarkupJSON; } interface SVGGradientJSON { id?: string; type: 'linearGradient' | 'radialGradient'; attrs?: attributes.NativeSVGAttributes; stops: Array<{ offset: number | string; color: string; opacity?: number; }>; } type SVGMarkerJSON = SVGComplexMarkerJSON | SVGSimpleMarkerJSON; interface SVGComplexMarkerJSON { id?: string; markup: string | MarkupJSON; attrs?: attributes.NativeSVGAttributes; } interface SVGSimpleMarkerJSON extends attributes.NativeSVGAttributes { id?: string; type?: string; /** * @deprecated use `attrs` instead */ markerUnits?: string; } type SVGFilterJSON = util.filter.FilterJSON<'outline'> | util.filter.FilterJSON<'highlight'> | util.filter.FilterJSON<'blur'> | util.filter.FilterJSON<'dropShadow'> | util.filter.FilterJSON<'grayscale'> | util.filter.FilterJSON<'sepia'> | util.filter.FilterJSON<'saturate'> | util.filter.FilterJSON<'hueRotate'> | util.filter.FilterJSON<'invert'> | util.filter.FilterJSON<'brightness'> | util.filter.FilterJSON<'contrast'>; class CellCollection extends mvc.Collection { cellNamespace: any; layer: GraphLayer; minZIndex(): number; maxZIndex(): number; } class GraphLayerCollection extends mvc.Collection { cellNamespace: any; layerNamespace: any; graph: Graph; insert(layer: Graph.LayerInit, beforeId: GraphLayer.ID | null, opt?: ObjectHash): void; getCell(cellRef: Graph.CellRef): Cell | undefined; getCells(): Cell[]; removeCell(cell: Cell, opt?: ObjectHash): void; moveCellBetweenLayers(cell: Cell, targetLayerId: GraphLayer.ID, opt?: ObjectHash): void; addCellToLayer(cell: Cell, layerId: GraphLayer.ID, opt?: ObjectHash): void; } class GraphLayersController extends mvc.Listener<[]> { graph: Graph; layerCollection: GraphLayerCollection; startListening(): void; protected onCellChange(cell: Cell, opt: ObjectHash): void; protected onCellRemove(cell: Cell, opt: ObjectHash): void; protected onLayerCollectionEvent(eventName: string, ...args: any[]): void; protected forwardLayerEvent(...args: any[]): void; protected forwardCellEvent(...args: any[]): void; protected forwardCellCollectionEvent(...args: any[]): void; protected forwardLayerCollectionEvent(...args: any[]): void; } class GraphTopologyIndex extends mvc.Listener<[]> { layerCollection: GraphLayerCollection; startListening(): void; getOutboundEdges(id: Cell.ID): { [edgeId: string]: true }; getInboundEdges(id: Cell.ID): { [edgeId: string]: true }; getSinkNodes(): string[]; getSourceNodes(): string[]; isSinkNode(id: Cell.ID): boolean; isSourceNode(id: Cell.ID): boolean; protected initializeIndex(): void; protected _restructureOnReset(): void; protected _restructureOnAdd(cell: Cell): void; protected _restructureOnRemove(cell: Cell): void; protected _restructureOnChangeSource(cell: Cell): void; protected _restructureOnChangeTarget(cell: Cell): void; } export namespace Graph { interface Options { [key: string]: any; } interface ConnectionOptions extends Cell.EmbeddableOptions { inbound?: boolean; outbound?: boolean; } interface ExploreOptions extends ConnectionOptions { breadthFirst?: boolean; } interface FindAtPointOptions extends Options { strict?: boolean; } interface FindInAreaOptions extends Options { strict?: boolean; } interface SyncCellOptions extends Options { remove?: boolean; } interface RemoveCellOptions extends Options { disconnectLinks?: boolean; replace?: boolean; clear?: boolean; } type SearchByKey = 'bbox' | PositionName; interface FindUnderElementOptions extends FindInAreaOptions, FindAtPointOptions { searchBy?: SearchByKey; } type Cells = CellCollection; type CellInit = Cell | Cell.JSON; type CellRef = Cell | Cell.ID; type LayerInit = GraphLayer | GraphLayer.Attributes; type LayerRef = GraphLayer | GraphLayer.ID; interface Attributes { /** @deprecated use cellsCollection property **/ cells?: CellCollection; [key: string]: any; } interface JSON { cells: Array; layers?: Array; defaultLayer?: string; [key: string]: any; } interface InsertLayerOptions extends Options { before?: GraphLayer.ID | null; index?: number; } } class Graph extends mvc.Model { layerCollection: GraphLayerCollection; defaultLayerId: GraphLayer.ID; layersController: GraphLayersController; topologyIndex: GraphTopologyIndex; constructor(attributes?: Graph.Attributes, opt?: { cellNamespace?: any, layerNamespace?: any, ignoreLayers?: boolean, /** @deprecated use cellNamespace instead */ cellModel?: typeof Cell }); addCell(cell: Graph.CellInit, opt?: CollectionAddOptions): this; addCell(cell: Array, opt?: CollectionAddOptions): this; addCells(cells: Array, opt?: CollectionAddOptions): this; removeCell(cell: Graph.CellRef, opt?: Graph.RemoveCellOptions): void; removeCells(cells: Array, opt?: Graph.RemoveCellOptions): this; resetCells(cells: Array, opt?: Graph.Options): this; syncCells(cells: Array, opt?: Graph.SyncCellOptions): void; addLayer(layerInit: Graph.LayerInit, opt?: Graph.InsertLayerOptions): void; moveLayer(layerRef: Graph.LayerRef, opt?: Graph.InsertLayerOptions): void; removeLayer(layerRef: Graph.LayerRef, opt?: Graph.Options): void; getDefaultLayer(): GraphLayer; setDefaultLayer(id: string, opt?: Graph.Options): void; getLayer(id: string): GraphLayer; hasLayer(id: string): boolean; getLayers(): GraphLayer[]; getCellLayerId(cell: Graph.CellRef): GraphLayer.ID; getCell(id: Graph.CellRef): Cell; getElements(): Element[]; getLinks(): Link[]; getCells(): Cell[]; getFirstCell(layerId?: string): Cell | undefined; getLastCell(layerId?: string): Cell | undefined; getConnectedLinks(cell: Cell, opt?: Graph.ConnectionOptions): Link[]; disconnectLinks(cell: Cell, opt?: S): void; removeLinks(cell: Graph.CellRef, opt?: Graph.RemoveCellOptions): void; translate(tx: number, ty?: number, opt?: Element.TranslateOptions): this; cloneCells(cells: Cell[]): { [id: string]: Cell }; getSubgraph(cells: Cell[], opt?: Cell.EmbeddableOptions): Cell[]; cloneSubgraph(cells: Cell[], opt?: Cell.EmbeddableOptions): { [id: string]: Cell }; dfs(element: Element, iteratee: (element: Element, distance: number) => boolean, opt?: Graph.ConnectionOptions): void; bfs(element: Element, iteratee: (element: Element, distance: number) => boolean, opt?: Graph.ConnectionOptions): void; search(element: Element, iteratee: (element: Element, distance: number) => boolean, opt?: Graph.ExploreOptions): void; getSuccessors(element: Element, opt?: Graph.ExploreOptions): Element[]; getPredecessors(element: Element, opt?: Graph.ExploreOptions): Element[]; isSuccessor(elementA: Element, elementB: Element): boolean; isPredecessor(elementA: Element, elementB: Element): boolean; isSource(element: Element): boolean; isSink(element: Element): boolean; getSources(): Element[]; getSinks(): Element[]; getNeighbors(element: Element, opt?: Graph.ConnectionOptions): Element[]; isNeighbor(elementA: Element, elementB: Element, opt?: Graph.ConnectionOptions): boolean; getCommonAncestor(...cells: Cell[]): Element | undefined; toJSON(opt?: { cellAttributes?: dia.Cell.ExportOptions }): any; fromJSON(json: any, opt?: S): this; clear(opt?: { [key: string]: any }): this; findElementsAtPoint(p: Point, opt?: Graph.FindAtPointOptions): Element[]; findElementsInArea(rect: BBox, opt?: Graph.FindInAreaOptions): Element[]; findElementsUnderElement(element: Element, opt?: Graph.FindUnderElementOptions): Element[]; findLinksAtPoint(p: Point, opt?: Graph.FindAtPointOptions): Link[]; findLinksInArea(rect: BBox, opt?: Graph.FindInAreaOptions): Link[]; findLinksUnderElement(element: Element, opt?: Graph.FindUnderElementOptions): Link[]; findCellsAtPoint(p: Point, opt?: Graph.FindAtPointOptions): Cell[]; findCellsInArea(rect: BBox, opt?: Graph.FindInAreaOptions): Cell[]; findCellsUnderElement(element: Element, opt?: Graph.FindUnderElementOptions): Cell[]; protected _getFindUnderElementGeometry(element: Element, searchBy: Graph.SearchByKey): g.Point | g.Rect; protected _validateCellsUnderElement(cells: T, element: Element): T; protected _isValidElementUnderElement(el1: Element, el2: Element): boolean; protected _isValidLinkUnderElement(link: Link, element: Element): boolean; protected _filterCellsUnderElement(cells: Cell[], element: Element, opt: Graph.FindUnderElementOptions): Cell[]; protected _syncCell(cellInit: Graph.CellInit, opt?: Graph.Options): void; protected _replaceCell(currentCell: Cell, newCellInit: Graph.CellInit, opt?: Graph.Options): void; protected _resetLayers(layers: Array, defaultLayerId: GraphLayer.ID | null, opt?: Graph.Options): this; /** @deprecated use `findElementsAtPoint` instead */ findModelsFromPoint(p: Point): Element[]; /** @deprecated use `findElementsInArea` instead */ findModelsInArea(rect: BBox, opt?: Graph.FindInAreaOptions): Element[]; /** @deprecated use `findElementsUnderElement` instead */ findModelsUnderElement(element: Element, opt?: Graph.FindUnderElementOptions): Element[]; getBBox(): g.Rect | null; getCellsBBox(cells: Cell[], opt?: Cell.EmbeddableOptions): g.Rect | null; hasActiveBatch(name?: string | string[]): boolean; maxZIndex(layerId?: GraphLayer.ID): number; minZIndex(layerId?: GraphLayer.ID): number; transferCellEmbeds(sourceCell: Cell, targetCell: Cell, opt?: S): void; transferCellConnectedLinks(sourceCell: Cell, targetCell: Cell, opt?: Graph.ConnectionOptions): void; resize(width: number, height: number, opt?: S): this; resizeCells(width: number, height: number, cells: Cell[], opt?: S): this; startBatch(name: string, data?: { [key: string]: any }): this; stopBatch(name: string, data?: { [key: string]: any }): this; } // dia.Cell export namespace Cell { type ID = string | number; interface GenericAttributes { attrs?: T; z?: number; layer?: string; [key: string]: any; } interface Selectors { [selector: string]: Nullable | undefined; } interface Attributes extends GenericAttributes { } type JSON = GenericAttributes> = T & { [attribute in keyof T]: T[attribute]; } & { id: ID; type: string; }; interface Constructor { new(opt?: { id?: ID, [key: string]: any }): T; define(type: string, defaults?: any, protoProps?: any, staticProps?: any): dia.Cell.Constructor; } interface Options { [key: string]: any; } interface EmbedOptions extends Options { reparent?: boolean; } interface EmbeddableOptions extends Options { deep?: T; } type DisconnectableOptions = Graph.RemoveCellOptions; interface GetEmbeddedCellsOptions extends EmbeddableOptions { breadthFirst?: boolean; sortSiblings?: boolean; } interface ToFrontAndBackOptions extends GetEmbeddedCellsOptions { foregroundEmbeds?: boolean; } interface TransitionOptions extends Options { delay?: number; duration?: number; timingFunction?: util.timing.TimingFunction; valueFunction?: util.interpolate.InterpolateFunction; } interface ConstructorOptions extends Graph.Options { mergeArrays?: boolean; } interface ExportOptions { ignoreDefaults?: boolean | string[]; ignoreEmptyAttributes?: boolean; } type UnsetCallback = ( this: V, node: DOMElement, nodeAttributes: { [name: string]: any }, cellView: V ) => string | Array | null | void; type SetCallback = ( this: V, attributeValue: any, refBBox: g.Rect, node: DOMElement, nodeAttributes: { [name: string]: any }, cellView: V ) => { [key: string]: any } | string | number | void; type PositionCallback = ( this: V, attributeValue: any, refBBox: g.Rect, node: DOMElement, nodeAttributes: { [name: string]: any }, cellView: V ) => dia.Point | null | void; type OffsetCallback = ( this: V, attributeValue: any, nodeBBox: g.Rect, node: DOMElement, nodeAttributes: { [name: string]: any }, cellView: V ) => dia.Point | null | void; interface PresentationAttributeDefinition { set?: SetCallback | string; unset?: UnsetCallback | string | Array; position?: PositionCallback; offset?: OffsetCallback; } } class Cell extends mvc.Model { constructor(attributes?: DeepPartial, opt?: Cell.ConstructorOptions); id: Cell.ID; graph: Graph; markup: string | MarkupJSON; useCSSSelectors: boolean; protected generateId(): string | number; protected stopPendingTransitions(path?: Path, delim?: string): void; protected stopScheduledTransitions(path?: Path, delim?: string): void; toJSON(opt?: dia.Cell.ExportOptions): Cell.JSON; remove(opt?: Cell.DisconnectableOptions): this; toFront(opt?: Cell.ToFrontAndBackOptions): this; toBack(opt?: Cell.ToFrontAndBackOptions): this; parent(): string; getParentCell(): Cell | null; getAncestors(): Cell[]; getEmbeddedCells(opt?: Cell.GetEmbeddedCellsOptions): Cell[]; isEmbeddedIn(cell: Cell, opt?: Cell.EmbeddableOptions): boolean; isEmbedded(): boolean; prop(key: Path): any; prop(object: DeepPartial, opt?: Cell.Options): this; prop(key: Path, value: any, opt?: Cell.Options): this; removeProp(path: Path, opt?: Cell.Options): this; attr(key?: Path): any; attr(object: Cell.Selectors, opt?: Cell.Options): this; attr(key: Path, value: any, opt?: Cell.Options): this; clone(): this; clone(opt: Cell.EmbeddableOptions): this; clone(opt: Cell.EmbeddableOptions): Cell[]; removeAttr(path: Path, opt?: Cell.Options): this; transition(path: Path, value?: any, opt?: Cell.TransitionOptions, delim?: string): number; getTransitions(): string[]; stopTransitions(path?: Path, delim?: string): this; embed(cell: Cell | Cell[], opt?: Cell.EmbedOptions): this; unembed(cell: Cell | Cell[], opt?: Graph.Options): this; canEmbed(cell: Cell | Cell[]): boolean; addTo(graph: Graph, opt?: Graph.Options): this; findView(paper: Paper): CellView; isLink(): this is Link; isElement(): this is Element; startBatch(name: string, opt?: Graph.Options): this; stopBatch(name: string, opt?: Graph.Options): this; position(): g.Point; z(): number; layer(): string | null; layer(id: string | null, opt?: Graph.Options): this; angle(): number; getBBox(): g.Rect; getCenter(): g.Point; getPointFromConnectedLink(link: dia.Link, endType: dia.LinkEnd): g.Point; getPointRotatedAroundCenter(angle: number, x: number, y: number): g.Point; getPointRotatedAroundCenter(angle: number, point: dia.Point): g.Point; getRelativePointFromAbsolute(x: number, y: number): g.Point; getRelativePointFromAbsolute(absolutePoint: dia.Point): g.Point; getAbsolutePointFromRelative(x: number, y: number): g.Point; getAbsolutePointFromRelative(relativePoint: dia.Point): g.Point; getChangeFlag(attributes: { [key: string]: number }): number; static define(type: string, defaults?: any, protoProps?: any, staticProps?: any): Cell.Constructor; static getAttributeDefinition(attrName: string): Cell.PresentationAttributeDefinition | null; /** * @deprecated */ protected processPorts(): void; } // dia.Element export namespace Element { interface GenericAttributes extends Cell.GenericAttributes { markup?: string | MarkupJSON; position?: Point; size?: Size; angle?: number; ports?: { groups?: { [key: string]: PortGroup }; items?: Port[]; }; } interface Attributes extends GenericAttributes { } interface ConstructorOptions extends Cell.ConstructorOptions { portLayoutNamespace?: { [key: string]: layout.Port.LayoutFunction }; portLabelLayoutNamespace?: { [key: string]: layout.PortLabel.LayoutFunction }; } type PortPositionCallback = layout.Port.LayoutFunction; type PortLabelPositionCallback = layout.PortLabel.LayoutFunction; interface PortPositionJSON { name?: string; args?: layout.Port.Options; } interface PortLabelPositionJSON { name?: string; args?: layout.PortLabel.Options; } type PositionType = string | PortPositionCallback | PortPositionJSON; type PortLabelPositionType = PortLabelPositionCallback | PortPositionJSON; interface PortGroup { position?: PositionType; markup?: string | MarkupJSON; attrs?: Cell.Selectors; size?: Size; label?: PortLabel; } interface PortLabel { markup?: string | MarkupJSON; position?: PortLabelPositionType; } interface Port { id?: string; markup?: string | MarkupJSON; group?: string; attrs?: Cell.Selectors; position?: { args?: layout.Port.Options; }; /** @deprecated use `position.args` instead */ args?: layout.Port.Options; size?: Size; label?: PortLabel; z?: number | 'auto'; } interface PortPosition extends Point { angle: number; } interface PortRect extends BBox { angle: number; } interface TranslateOptions extends Cell.Options { restrictedArea?: BBox | Paper.PointConstraintCallback; transition?: Cell.TransitionOptions; } interface PositionOptions extends TranslateOptions { parentRelative?: boolean; deep?: boolean; } interface ResizeOptions extends Cell.Options { direction?: Direction; } interface FitToChildrenOptions { filter?: (cell: Cell) => boolean; deep?: boolean; padding?: Padding; minRect?: Partial; expandOnly?: boolean; shrinkOnly?: boolean; } interface FitParentOptions extends FitToChildrenOptions { terminator?: Graph.CellRef; } interface RotateOptions { rotate?: boolean; } interface BBoxOptions extends Cell.EmbeddableOptions, RotateOptions { } } class Element extends Cell { constructor(attributes?: DeepPartial, opt?: Element.ConstructorOptions); translate(tx: number, ty?: number, opt?: Element.TranslateOptions): this; position(opt?: Element.PositionOptions): g.Point; position(x: number, y: number, opt?: Element.PositionOptions): this; size(): Size; size(size: Partial, opt?: Element.ResizeOptions): this; size(width: number, height: number, opt?: Element.ResizeOptions): this; resize(width: number, height: number, opt?: Element.ResizeOptions): this; rotate(deg: number, absolute?: boolean, origin?: Point, opt?: { [key: string]: any }): this; angle(): number; scale(scaleX: number, scaleY: number, origin?: Point, opt?: { [key: string]: any }): this; fitEmbeds(opt?: Element.FitToChildrenOptions): this; fitToChildren(opt?: Element.FitToChildrenOptions): this; fitParent(opt?: Element.FitParentOptions): this; getBBox(opt?: Element.BBoxOptions): g.Rect; addPort(port: Element.Port, opt?: S): this; addPorts(ports: Element.Port[], opt?: S): this; insertPort(before: number | string | Element.Port, port: Element.Port, opt?: S): this; removePort(port: string | Element.Port, opt?: S): this; removePorts(opt?: S): this; removePorts(ports: Array, opt?: S): this; hasPorts(): boolean; hasPort(id: string): boolean; getPorts(): Element.Port[]; getGroupPorts(groupName: string): Element.Port[]; getPort(id: string): Element.Port; getPortsPositions(groupName: string): { [id: string]: Element.PortPosition }; getPortRelativePosition(portId: string): Element.PortPosition; getPortRelativeRect(portId: string): Element.PortRect; getPortCenter(portId: string): g.Point; getPortBBox(portId: string, opt?: Element.RotateOptions): g.Rect; getPortIndex(port: string | Element.Port): number; getPortGroupNames(): string[]; portProp(portId: string, path: dia.Path): any; portProp(portId: string, path: dia.Path, value?: any, opt?: S): Element; protected generatePortId(): string | number; static define(type: string, defaults?: any, protoProps?: any, staticProps?: any): Cell.Constructor; static attributes: { [attributeName: string]: Cell.PresentationAttributeDefinition }; } // dia.Link export namespace Link { interface EndCellArgs { magnet?: string; selector?: string; port?: string; anchor?: anchors.AnchorJSON; connectionPoint?: connectionPoints.ConnectionPointJSON; priority?: boolean; } interface EndJSON extends EndCellArgs { id?: Cell.ID; x?: number; y?: number; } interface GenericAttributes extends Cell.GenericAttributes { source?: EndJSON; target?: EndJSON; labels?: Label[]; vertices?: Point[]; router?: routers.Router | routers.RouterJSON; connector?: connectors.Connector | connectors.ConnectorJSON; } interface Attributes extends Cell.GenericAttributes { } interface LabelPosition { distance?: number; // optional for default labels offset?: number | { x: number, y: number }; angle?: number; args?: LinkView.LabelOptions; } interface Label { markup?: string | MarkupJSON; position?: LabelPosition | number; // optional for default labels attrs?: Cell.Selectors; size?: Size; } interface Vertex extends Point { [key: string]: any; } } class Link extends Cell { toolMarkup: string; doubleToolMarkup?: string; vertexMarkup: string; arrowHeadMarkup: string; defaultLabel?: Link.Label; // default label props /** * @deprecated use `defaultLabel.markup` instead */ labelMarkup?: string | MarkupJSON; // default label markup disconnect(): this; source(): Link.EndJSON; source(source: Link.EndJSON, opt?: S): this; source(source: Cell, args?: Link.EndCellArgs, opt?: S): this; target(): Link.EndJSON; target(target: Link.EndJSON, opt?: S): this; target(target: Cell, args?: Link.EndCellArgs, opt?: S): this; router(): routers.Router | routers.RouterJSON | null; router(router: routers.Router | routers.RouterJSON, opt?: S): this; router(name: routers.RouterType, args?: routers.RouterArguments, opt?: S): this; connector(): connectors.Connector | connectors.ConnectorJSON | null; connector(connector: connectors.Connector | connectors.ConnectorJSON, opt?: S): this; connector(name: connectors.ConnectorType, args?: connectors.ConnectorArguments, opt?: S): this; label(index?: number): Link.Label; label(index: number, label: Link.Label, opt?: S): this; labels(): Link.Label[]; labels(labels: Link.Label[], opt?: S): this; hasLabels(): boolean; insertLabel(index: number, label: Link.Label, opt?: S): Link.Label[]; appendLabel(label: Link.Label, opt?: S): Link.Label[]; removeLabel(index?: number, opt?: S): Link.Label[]; vertex(index?: number): Link.Vertex; vertex(index: number, vertex: Link.Vertex, opt?: S): this; vertices(): Link.Vertex[]; vertices(vertices: Link.Vertex[], opt?: S): this; insertVertex(index: number, vertex: Link.Vertex, opt?: S): Link.Vertex[]; removeVertex(index?: number, opt?: S): Link.Vertex[]; reparent(opt?: S): Element; getSourceElement(): null | Element; getTargetElement(): null | Element; getSourceCell(): null | Cell; getTargetCell(): null | Cell; getPolyline(): g.Polyline; getSourcePoint(): g.Point; getTargetPoint(): g.Point; getBBox(): g.Rect; hasLoop(opt?: Cell.EmbeddableOptions): boolean; getRelationshipAncestor(): undefined | Element; isRelationshipEmbeddedIn(cell: Cell): boolean; applyToPoints(fn: (p: Point) => Point, opt?: S): this; scale(sx: number, sy: number, origin?: Point, opt?: S): this; translate(tx: number, ty: number, opt?: S): this; static define(type: string, defaults?: any, protoProps?: any, staticProps?: any): Cell.Constructor; static attributes: { [attributeName: string]: Cell.PresentationAttributeDefinition }; } // dia.CellView export namespace CellView { enum Highlighting { DEFAULT = 'default', EMBEDDING = 'embedding', CONNECTING = 'connecting', MAGNET_AVAILABILITY = 'magnetAvailability', ELEMENT_AVAILABILITY = 'elementAvailability' } interface EventHighlightOptions { partial: boolean; type: Highlighting; [key: string]: any; } interface Options extends mvc.ViewOptions { id?: string; } interface InteractivityOptions extends ElementView.InteractivityOptions, LinkView.InteractivityOptions { } type FlagLabel = string | string[]; type PresentationAttributes = { [key: string]: FlagLabel }; type NodeData = { [key: string]: any }; type NodeMetrics = { data: NodeData; boundingRect: g.Rect; magnetMatrix: SVGMatrix; geometryShape: g.Shape; }; } abstract class CellViewGeneric extends mvc.View { constructor(opt?: CellView.Options); paper: Paper | null; initFlag(): CellView.FlagLabel; presentationAttributes(): CellView.PresentationAttributes; highlight(el?: mvc.$SVGElement, opt?: { [key: string]: any }): this; unhighlight(el?: mvc.$SVGElement, opt?: { [key: string]: any }): this; can(feature: string): boolean; findMagnet(el: mvc.$SVGElement): SVGElement | undefined; findNode(selector: string): SVGElement | HTMLElement | null; findNodes(groupSelector: string): Array; findProxyNode(el: SVGElement | null, type: string): SVGElement; getSelector(el: SVGElement, prevSelector?: string): string; notify(eventName: string, ...eventArguments: any[]): void; addTools(tools: dia.ToolsView): this; hasTools(name?: string): boolean; removeTools(): this; showTools(): this; hideTools(): this; updateTools(opt?: { [key: string]: any }): this; mountTools(): this; unmountTools(): this; getNodeMatrix(node: SVGElement): SVGMatrix; getNodeRotateMatrix(node: SVGElement): SVGMatrix; getNodeBoundingRect(node: SVGElement): g.Rect; getBBox(opt?: { useModelGeometry?: boolean }): g.Rect; getNodeBBox(node: SVGElement): g.Rect; getNodeUnrotatedBBox(node: SVGElement): g.Rect; isNodeConnection(node: SVGElement): boolean; getEventTarget(evt: dia.Event, opt?: { fromPoint?: boolean }): DOMElement; checkMouseleave(evt: dia.Event): void; getFlag(label: CellView.FlagLabel): number; requestUpdate(flags: number, opt?: { [key: string]: any }): void; dragLinkStart(evt: dia.Event, magnet: SVGElement, x: number, y: number): void; dragLink(evt: dia.Event, x: number, y: number): void; dragLinkEnd(evt: dia.Event, x: number, y: number): void; preventDefaultInteraction(evt: dia.Event): void; isDefaultInteractionPrevented(evt: dia.Event): boolean; isIntersecting(geometryShape: g.Shape, geometryData?: g.SegmentSubdivisionsOpt | null): boolean; cleanNodesCache(): void; cleanNodeCache(node: SVGElement): void protected isEnclosedIn(area: g.Rect): boolean; protected isInArea(area: g.Rect, options: g.StrictOpt): boolean; protected isAtPoint(point: g.Point, options: g.StrictOpt): boolean; protected findBySelector(selector: string, root?: SVGElement): SVGElement[]; protected removeHighlighters(): void; protected updateHighlighters(): void; protected transformHighlighters(): void; protected hasFlag(flags: number, label: CellView.FlagLabel): boolean; protected removeFlag(flags: number, label: CellView.FlagLabel): number; protected setFlags(): void; protected onToolEvent(eventName: string): void; protected pointerdblclick(evt: dia.Event, x: number, y: number): void; protected pointerclick(evt: dia.Event, x: number, y: number): void; protected contextmenu(evt: dia.Event, x: number, y: number): void; protected pointerdown(evt: dia.Event, x: number, y: number): void; protected pointermove(evt: dia.Event, x: number, y: number): void; protected pointerup(evt: dia.Event, x: number, y: number): void; protected mouseover(evt: dia.Event): void; protected mouseout(evt: dia.Event): void; protected mouseenter(evt: dia.Event): void; protected mouseleave(evt: dia.Event): void; protected mousewheel(evt: dia.Event, x: number, y: number, delta: number): void; protected onevent(evt: dia.Event, eventName: string, x: number, y: number): void; protected onmagnet(evt: dia.Event, x: number, y: number): void; protected getLinkEnd(magnet: SVGElement, x: number, y: number, link: dia.Link, endType: dia.LinkEnd): dia.Link.EndJSON; protected getMagnetFromLinkEnd(end: dia.Link.EndJSON): SVGElement; protected customizeLinkEnd(end: dia.Link.EndJSON, magnet: SVGElement, x: number, y: number, link: dia.Link, endType: dia.LinkEnd): dia.Link.EndJSON; protected addLinkFromMagnet(magnet: SVGElement, x: number, y: number): LinkView; protected nodeCache(magnet: SVGElement): CellView.NodeMetrics; protected getNodeData(magnet: SVGElement): CellView.NodeData; protected getNodeShape(magnet: SVGElement): g.Shape; protected onMount(isInitialMount: boolean): void; protected onDetach(): void; static addPresentationAttributes(attributes: CellView.PresentationAttributes): CellView.PresentationAttributes; static evalAttribute(attrName: string, attrValue: any, refBBox: dia.BBox): any; } class CellView extends CellViewGeneric { } // dia.ElementView export namespace ElementView { enum Flags { UPDATE = 'UPDATE', TRANSLATE = 'TRANSLATE', TOOLS = 'TOOLS', RESIZE = 'RESIZE', PORTS = 'PORTS', ROTATE = 'ROTATE', RENDER = 'RENDER' } interface InteractivityOptions { elementMove?: boolean; addLinkFromMagnet?: boolean; stopDelegation?: boolean; } } class ElementView extends CellViewGeneric { update(element?: DOMElement, renderingOnlyAttrs?: { [key: string]: any }): void; setInteractivity(value: boolean | ElementView.InteractivityOptions): void; getDelegatedView(): ElementView | null; getTargetParentView(evt: dia.Event): CellView | null; findPortNode(portId: string | number): SVGElement | null; findPortNode(portId: string | number, selector: string): DOMElement | null; findPortNodes(portId: string | number, groupSelector: string): DOMElement[]; protected renderMarkup(): void; protected renderJSONMarkup(markup: MarkupJSON): void; protected renderStringMarkup(markup: string): void; protected updateTransformation(): void; protected resize(): void; protected translate(): void; protected rotate(): void; protected getTranslateString(): string; protected getRotateString(): string; protected dragStart(evt: dia.Event, x: number, y: number): void; protected dragMagnetStart(evt: dia.Event, x: number, y: number): void; protected drag(evt: dia.Event, x: number, y: number): void; protected dragMagnet(evt: dia.Event, x: number, y: number): void; protected dragEnd(evt: dia.Event, x: number, y: number): void; protected dragMagnetEnd(evt: dia.Event, x: number, y: number): void; protected snapToGrid(evt: dia.Event, x: number, y: number): dia.Point; protected prepareEmbedding(data: any): void; protected processEmbedding(data: any, evt: dia.Event, x: number, y: number): void; protected clearEmbedding(data: any): void; protected finalizeEmbedding(data: any): void; } // dia.LinkView export namespace LinkView { enum Flags { RENDER = 'RENDER', UPDATE = 'UPDATE', TOOLS = 'TOOLS', LEGACY_TOOLS = 'LEGACY_TOOLS', LABELS = 'LABELS', VERTICES = 'VERTICES', SOURCE = 'SOURCE', TARGET = 'TARGET', CONNECTOR = 'CONNECTOR' } interface InteractivityOptions { labelMove?: boolean; linkMove?: boolean; } interface LabelOptions extends Cell.Options { absoluteDistance?: boolean; reverseDistance?: boolean; absoluteOffset?: boolean; keepGradient?: boolean; ensureLegibility?: boolean; } interface VertexOptions extends Cell.Options { } interface Options extends mvc.ViewOptions { labelsLayer?: Paper.Layers | string | false; } } class LinkView extends CellViewGeneric { options: LinkView.Options; sourceAnchor: g.Point; targetAnchor: g.Point; sourcePoint: g.Point; targetPoint: g.Point; sourceBBox: g.Rect; targetBBox: g.Rect; route: g.Point[]; sendToken(token: SVGElement, duration?: number, callback?: () => void): void; sendToken(token: SVGElement, opt?: { duration?: number, direction?: string, connection?: string }, callback?: () => void): void; addLabel(coordinates: Point, opt?: LinkView.LabelOptions): number; addLabel(coordinates: Point, angle: number, opt?: LinkView.LabelOptions): number; addLabel(x: number, y: number, opt?: LinkView.LabelOptions): number; addLabel(x: number, y: number, angle: number, opt?: LinkView.LabelOptions): number; addVertex(coordinates: Point, opt?: LinkView.VertexOptions): number; addVertex(x: number, y: number, opt?: LinkView.VertexOptions): number; getConnection(): g.Path; getSerializedConnection(): string; getConnectionSubdivisions(): g.Curve[][]; getConnectionLength(): number; getPointAtLength(length: number): g.Point; getPointAtRatio(ratio: number): g.Point; getTangentAtLength(length: number): g.Line; getTangentAtRatio(ratio: number): g.Line; getClosestPoint(point: Point): g.Point; getClosestPointLength(point: Point): number; getClosestPointRatio(point: Point): number; getLabelPosition(x: number, y: number, opt?: LinkView.LabelOptions): Link.LabelPosition; getLabelPosition(x: number, y: number, angle: number, opt?: LinkView.LabelOptions): Link.LabelPosition; getLabelCoordinates(labelPosition: Link.LabelPosition): g.Point; getVertexIndex(x: number, y: number): number; getVertexIndex(point: Point): number; update(): this; translate(tx: number, ty: number): void; requestConnectionUpdate(opt?: { [key: string]: any }): void; setInteractivity(value: boolean | LinkView.InteractivityOptions): void; getEndView(endType: dia.LinkEnd): dia.CellView | null; getEndAnchor(endType: dia.LinkEnd): g.Point; getEndConnectionPoint(endType: dia.LinkEnd): g.Point; getEndMagnet(endType: dia.LinkEnd): SVGElement | null; findLabelNode(labelIndex: string | number): SVGElement | null; findLabelNode(labelIndex: string | number, selector: string): DOMElement | null; findLabelNodes(labelIndex: string | number, groupSelector: string): DOMElement[]; removeRedundantLinearVertices(opt?: dia.ModelSetOptions): number; startArrowheadMove(end: dia.LinkEnd, options?: any): unknown; protected updateRoute(): void; protected updatePath(): void; protected updateDOM(): void; protected onLabelsChange(link: Link, labels: Link.Label[], opt: { [key: string]: any }): void; protected onToolsChange(link: Link, toolsMarkup: string, opt: { [key: string]: any }): void; protected onVerticesChange(link: Link, vertices: Point[], opt: { [key: string]: any }): void; protected onSourceChange(element: Element, sourceEnd: any, opt: { [key: string]: any }): void; protected onTargetChange(element: Element, targetEnd: any, opt: { [key: string]: any }): void; protected onlabel(evt: dia.Event, x: number, y: number): void; protected dragLabelStart(evt: dia.Event, x: number, y: number): void; protected dragArrowheadStart(evt: dia.Event, x: number, y: number): void; protected dragStart(evt: dia.Event, x: number, y: number): void; protected dragLabel(evt: dia.Event, x: number, y: number): void; protected dragArrowhead(evt: dia.Event, x: number, y: number): void; protected drag(evt: dia.Event, x: number, y: number): void; protected dragLabelEnd(evt: dia.Event, x: number, y: number): void; protected dragArrowheadEnd(evt: dia.Event, x: number, y: number): void; protected dragEnd(evt: dia.Event, x: number, y: number): void; protected findPath(route: Point[], sourcePoint: Point, targetPoint: Point): g.Path; protected notifyPointerdown(evt: dia.Event, x: number, y: number): void; protected notifyPointermove(evt: dia.Event, x: number, y: number): void; protected notifyPointerup(evt: dia.Event, x: number, y: number): void; protected mountLabels(): void; protected unmountLabels(): void; } // dia.Paper export namespace Paper { interface GradientOptions { id?: string; type: 'linearGradient' | 'radialGradient'; stops: Array<{ offset: string; color: string; opacity?: number; }>; } interface FilterOptions { [key: string]: any; } interface PatternOptions { [key: string]: any; } interface MarkerOptions { [key: string]: any; } interface GridOptions { color?: string; thickness?: number; name?: 'dot' | 'fixedDot' | 'mesh' | 'doubleMesh'; args?: Array<{ [key: string]: any }> | { [key: string]: any }; } interface BackgroundOptions { color?: string; image?: string; quality?: number; position?: Point | string; size?: Size | string; repeat?: string; opacity?: number; waterMarkAngle?: number; } type Dimension = number | string | null; enum sorting { EXACT = 'sorting-exact', APPROX = 'sorting-approximate', NONE = 'sorting-none' } enum Layers { LABELS = 'labels', BACK = 'back', FRONT = 'front', /** @deprecated */ CELLS = 'cells', TOOLS = 'tools', GRID = 'grid', } type LayerRef = Layers | string | dia.LayerView | dia.GraphLayer; interface RenderStats { priority: number; updated: number; } interface UpdateVisibilityStats { mounted: number; unmounted: number; } interface RenderBatchStats extends RenderStats, UpdateVisibilityStats { postponed: number; empty: boolean; } type UpdateStats = RenderStats & Partial & { batches?: number; }; type ViewportCallback = (view: mvc.View, isMounted: boolean, paper: Paper) => boolean; type CellVisibilityCallback = (cell: Cell, isMounted: boolean, paper: Paper) => boolean; type ProgressCallback = (done: boolean, processed: number, total: number, stats: UpdateStats, paper: Paper) => void; type BeforeRenderCallback = (opt: { [key: string]: any }, paper: Paper) => void; type AfterRenderCallback = (stats: UpdateStats, opt: { [key: string]: any }, paper: Paper) => void; interface CellVisibilityOptions { cellVisibility?: CellVisibilityCallback | null; /** @deprecated disable `legacyMode` and use `cellVisibility` instead */ viewport?: ViewportCallback | null; } interface MountOptions { mountBatchSize?: number; } interface UnmountOptions { unmountBatchSize?: number; } interface BatchSizeOptions { batchSize?: number; } interface BeforeRenderOptions { beforeRender?: BeforeRenderCallback; } interface AfterRenderOptions { afterRender?: AfterRenderCallback; } interface RenderCallbackOptions extends BeforeRenderOptions, AfterRenderOptions, mvc.Silenceable { } interface KeyOptions { key?: string; } interface UpdateViewOptions { [key: string]: any; } interface UpdateViewsBatchOptions extends UpdateViewOptions, BatchSizeOptions, CellVisibilityOptions { } interface UpdateViewsOptions extends UpdateViewsBatchOptions, RenderCallbackOptions { } interface UpdateViewsAsyncOptions extends UpdateViewsBatchOptions, ScheduleCellsVisibilityUpdateOptions, RenderCallbackOptions { progress?: ProgressCallback; } interface ScheduleCellsVisibilityUpdateOptions extends CellVisibilityOptions, MountOptions, UnmountOptions { } interface FreezeOptions extends KeyOptions { } interface UnfreezeOptions extends KeyOptions, UpdateViewsAsyncOptions, UpdateViewsOptions { } interface SnapLinksOptions { radius?: number; findInAreaOptions?: FindInAreaOptions; } type PointConstraintCallback = (x: number, y: number, opt: any) => Point; type RestrictTranslateCallback = (elementView: ElementView, x0: number, y0: number) => BBox | boolean | PointConstraintCallback; type FindParentByType = 'bbox' | 'pointer' | PositionName; type FindParentByCallback = ((this: dia.Graph, elementView: ElementView, evt: dia.Event, x: number, y: number) => Cell[]); type MeasureNodeCallback = (node: SVGGraphicsElement, cellView: dia.CellView) => g.Rect; interface Options extends mvc.ViewOptions, CellVisibilityOptions, BeforeRenderOptions, AfterRenderOptions { // appearance width?: Dimension; height?: Dimension; drawGrid?: boolean | GridOptions | GridOptions[]; drawGridSize?: number | null; background?: BackgroundOptions; labelsLayer?: boolean | Paper.Layers | string; // interactions gridSize?: number; highlighting?: boolean | Record; interactive?: ((cellView: CellView, event: string) => boolean | CellView.InteractivityOptions) | boolean | CellView.InteractivityOptions; snapLabels?: boolean; snapLinks?: boolean | SnapLinksOptions; snapLinksSelf?: boolean | { distance: number }; markAvailable?: boolean; // validations validateMagnet?: (cellView: CellView, magnet: SVGElement, evt: dia.Event) => boolean; validateConnection?: (cellViewS: CellView, magnetS: SVGElement, cellViewT: CellView, magnetT: SVGElement, end: LinkEnd, linkView: LinkView) => boolean; restrictTranslate?: RestrictTranslateCallback | boolean | BBox; multiLinks?: boolean; linkPinning?: boolean; allowLink?: ((linkView: LinkView, paper: Paper) => boolean) | null; // events guard?: (evt: dia.Event, view: CellView) => boolean; preventContextMenu?: boolean; preventDefaultViewAction?: boolean; preventDefaultBlankAction?: boolean; clickThreshold?: number; moveThreshold?: number; magnetThreshold?: number | string; // views elementView?: typeof ElementView | ((element: Element) => typeof ElementView | null | undefined); linkView?: typeof LinkView | ((link: Link) => typeof LinkView | null | undefined); measureNode?: MeasureNodeCallback; // embedding embeddingMode?: boolean; frontParentOnly?: boolean; findParentBy?: FindParentByType | FindParentByCallback; validateEmbedding?: (this: Paper, childView: ElementView, parentView: ElementView) => boolean; validateUnembedding?: (this: Paper, childView: ElementView) => boolean; // default views, models & attributes cellViewNamespace?: any; layerViewNamespace?: any; routerNamespace?: any; connectorNamespace?: any; highlighterNamespace?: any; anchorNamespace?: any; linkAnchorNamespace?: any; connectionPointNamespace?: any; defaultLink?: ((cellView: CellView, magnet: SVGElement) => Link) | Link; defaultRouter?: routers.Router | routers.RouterJSON; defaultConnector?: connectors.Connector | connectors.ConnectorJSON; defaultAnchor?: anchors.AnchorJSON | anchors.Anchor; defaultLinkAnchor?: anchors.AnchorJSON | anchors.Anchor; defaultConnectionPoint?: connectionPoints.ConnectionPointJSON | connectionPoints.ConnectionPoint | ((...args: any[]) => connectionPoints.ConnectionPoint); // connecting connectionStrategy?: connectionStrategies.ConnectionStrategy; // rendering async?: boolean; sorting?: sorting; frozen?: boolean; autoFreeze?: boolean; viewManagement?: ViewManagementOptions | boolean; onViewUpdate?: (view: mvc.View, flag: number, priority: number, opt: { [key: string]: any }, paper: Paper) => void; onViewPostponed?: (view: mvc.View, flag: number, paper: Paper) => boolean; overflow?: boolean; } interface ViewManagementOptions { lazyInitialize?: boolean; disposeHidden?: boolean; } interface TransformToFitContentOptions { padding?: Padding; preserveAspectRatio?: boolean; minScale?: number; minScaleX?: number; minScaleY?: number; maxScale?: number; maxScaleX?: number; maxScaleY?: number; scaleGrid?: number; useModelGeometry?: boolean; fittingBBox?: BBox; contentArea?: BBox; verticalAlign?: 'top' | 'middle' | 'bottom'; horizontalAlign?: 'left' | 'middle' | 'right'; } /** * @deprecated */ type ScaleContentOptions = TransformToFitContentOptions; interface FitToContentOptions { gridWidth?: number; gridHeight?: number; padding?: Padding; allowNewOrigin?: false | 'negative' | 'positive' | 'any'; allowNegativeBottomRight?: boolean; minWidth?: number; minHeight?: number; maxWidth?: number; maxHeight?: number; useModelGeometry?: boolean; contentArea?: BBox; } interface EventMap { // pointerclick 'cell:pointerclick': (cellView: dia.CellView, evt: dia.Event, x: number, y: number) => void; 'element:pointerclick': (elementView: dia.ElementView, evt: dia.Event, x: number, y: number) => void; 'link:pointerclick': (linkView: dia.LinkView, evt: dia.Event, x: number, y: number) => void; 'blank:pointerclick': (evt: dia.Event, x: number, y: number) => void; // pointerdblclick 'cell:pointerdblclick': (cellView: dia.CellView, evt: dia.Event, x: number, y: number) => void; 'element:pointerdblclick': (elementView: dia.ElementView, evt: dia.Event, x: number, y: number) => void; 'link:pointerdblclick': (linkView: dia.LinkView, evt: dia.Event, x: number, y: number) => void; 'blank:pointerdblclick': (evt: dia.Event, x: number, y: number) => void; // contextmenu 'cell:contextmenu': (cellView: dia.CellView, evt: dia.Event, x: number, y: number) => void; 'element:contextmenu': (elementView: dia.ElementView, evt: dia.Event, x: number, y: number) => void; 'link:contextmenu': (linkView: dia.LinkView, evt: dia.Event, x: number, y: number) => void; 'blank:contextmenu': (evt: dia.Event, x: number, y: number) => void; // pointerdown 'cell:pointerdown': (cellView: dia.CellView, evt: dia.Event, x: number, y: number) => void; 'element:pointerdown': (elementView: dia.ElementView, evt: dia.Event, x: number, y: number) => void; 'link:pointerdown': (linkView: dia.LinkView, evt: dia.Event, x: number, y: number) => void; 'blank:pointerdown': (evt: dia.Event, x: number, y: number) => void; // pointerdown 'cell:pointermove': (cellView: dia.CellView, evt: dia.Event, x: number, y: number) => void; 'element:pointermove': (elementView: dia.ElementView, evt: dia.Event, x: number, y: number) => void; 'link:pointermove': (linkView: dia.LinkView, evt: dia.Event, x: number, y: number) => void; 'blank:pointermove': (evt: dia.Event, x: number, y: number) => void; // pointerup 'cell:pointerup': (cellView: dia.CellView, evt: dia.Event, x: number, y: number) => void; 'element:pointerup': (elementView: dia.ElementView, evt: dia.Event, x: number, y: number) => void; 'link:pointerup': (linkView: dia.LinkView, evt: dia.Event, x: number, y: number) => void; 'blank:pointerup': (evt: dia.Event, x: number, y: number) => void; // mouseover 'cell:mouseover': (cellView: dia.CellView, evt: dia.Event) => void; 'element:mouseover': (elementView: dia.ElementView, evt: dia.Event) => void; 'link:mouseover': (linkView: dia.LinkView, evt: dia.Event) => void; 'blank:mouseover': (evt: dia.Event) => void; // mouseout 'cell:mouseout': (cellView: dia.CellView, evt: dia.Event) => void; 'element:mouseout': (elementView: dia.ElementView, evt: dia.Event) => void; 'link:mouseout': (linkView: dia.LinkView, evt: dia.Event) => void; 'blank:mouseout': (evt: dia.Event) => void; // mouseenter 'cell:mouseenter': (cellView: dia.CellView, evt: dia.Event) => void; 'element:mouseenter': (elementView: dia.ElementView, evt: dia.Event) => void; 'link:mouseenter': (linkView: dia.LinkView, evt: dia.Event) => void; 'blank:mouseenter': (evt: dia.Event) => void; // mouseleave 'cell:mouseleave': (cellView: dia.CellView, evt: dia.Event) => void; 'element:mouseleave': (elementView: dia.ElementView, evt: dia.Event) => void; 'link:mouseleave': (linkView: dia.LinkView, evt: dia.Event) => void; 'blank:mouseleave': (evt: dia.Event) => void; // mousewheel 'cell:mousewheel': (cellView: dia.CellView, evt: dia.Event, x: number, y: number, delta: number) => void; 'element:mousewheel': (elementView: dia.ElementView, evt: dia.Event, x: number, y: number, delta: number) => void; 'link:mousewheel': (linkView: dia.LinkView, evt: dia.Event, x: number, y: number, delta: number) => void; 'blank:mousewheel': (evt: dia.Event, x: number, y: number, delta: number) => void; // touchpad 'paper:pan': (evt: dia.Event, deltaX: number, deltaY: number) => void; 'paper:pinch': (evt: dia.Event, x: number, y: number, scale: number) => void; // magnet 'element:magnet:pointerclick': (elementView: dia.ElementView, evt: dia.Event, magnetNode: SVGElement, x: number, y: number) => void; 'element:magnet:pointerdblclick': (elementView: dia.ElementView, evt: dia.Event, magnetNode: SVGElement, x: number, y: number) => void; 'element:magnet:contextmenu': (elementView: dia.ElementView, evt: dia.Event, magnetNode: SVGElement, x: number, y: number) => void; // highlighting 'cell:highlight': (cellView: dia.CellView, node: SVGElement, options: dia.CellView.EventHighlightOptions) => void; 'cell:unhighlight': (cellView: dia.CellView, node: SVGElement, options: dia.CellView.EventHighlightOptions) => void; 'cell:highlight:invalid': (cellView: dia.CellView, highlighterId: string, highlighter: dia.HighlighterView) => void; // connect 'link:connect': (linkView: dia.LinkView, evt: dia.Event, newCellView: dia.CellView, newCellViewMagnet: SVGElement, arrowhead: dia.LinkEnd) => void; 'link:disconnect': (linkView: dia.LinkView, evt: dia.Event, prevCellView: dia.CellView, prevCellViewMagnet: SVGElement, arrowhead: dia.LinkEnd) => void; 'link:snap:connect': (linkView: dia.LinkView, evt: dia.Event, newCellView: dia.CellView, newCellViewMagnet: SVGElement, arrowhead: dia.LinkEnd) => void; 'link:snap:disconnect': (linkView: dia.LinkView, evt: dia.Event, prevCellView: dia.CellView, prevCellViewMagnet: SVGElement, arrowhead: dia.LinkEnd) => void; // render 'render:done': (stats: UpdateStats, opt: any) => void; 'render:idle': (opt: Paper.UpdateViewsAsyncOptions) => void; // transformations 'translate': (tx: number, ty: number, data: unknown) => void; 'scale': (sx: number, sy: number, data: unknown) => void; 'resize': (width: number, height: number, data: unknown) => void; 'transform': (matrix: SVGMatrix, data: unknown) => void; // custom [eventName: string]: mvc.EventHandler; } interface BufferOptions { /** * A buffer around the area to extend the search to * to mitigate the differences between the model and view geometry. */ buffer?: number; } interface FindAtPointOptions extends Graph.FindAtPointOptions, BufferOptions { } interface FindInAreaOptions extends Graph.FindInAreaOptions, BufferOptions { } interface FindClosestMagnetToPointOptions { radius?: number; findInAreaOptions?: FindInAreaOptions; filter?: (view: CellView, magnet: SVGElement) => boolean; } interface ClosestMagnet { view: CellView; magnet: SVGElement; } interface InsertLayerViewOptions { before?: LayerRef | null; index?: number; } } class Paper extends mvc.View { constructor(opt: Paper.Options); options: Paper.Options; stylesheet: string; svg: SVGSVGElement; defs: SVGDefsElement; /** @deprecated use getLayerViewNode()*/ cells: SVGGElement; /** @deprecated use layers property*/ viewport: SVGGElement; tools: SVGGElement; layers: SVGGElement; GUARDED_TAG_NAMES: string[]; FORM_CONTROLS_TAG_NAMES: string[]; matrix(): SVGMatrix; matrix(ctm: SVGMatrix | Vectorizer.Matrix, data?: any): this; clientMatrix(): SVGMatrix; clientOffset(): g.Point; pageOffset(): g.Point; clientToLocalPoint(x: number, y: number): g.Point; clientToLocalPoint(point: Point): g.Point; clientToLocalRect(x: number, y: number, width: number, height: number): g.Rect; clientToLocalRect(rect: BBox): g.Rect; localToClientPoint(x: number, y: number): g.Point; localToClientPoint(point: Point): g.Point; localToClientRect(x: number, y: number, width: number, height: number): g.Rect; localToClientRect(rect: BBox): g.Rect; localToPagePoint(x: number, y: number): g.Point; localToPagePoint(point: Point): g.Point; localToPageRect(x: number, y: number, width: number, height: number): g.Rect; localToPageRect(rect: BBox): g.Rect; localToPaperPoint(x: number, y: number): g.Point; localToPaperPoint(point: Point): g.Point; localToPaperRect(x: number, y: number, width: number, height: number): g.Rect; localToPaperRect(rect: BBox): g.Rect; pageToLocalPoint(x: number, y: number): g.Point; pageToLocalPoint(point: Point): g.Point; pageToLocalRect(x: number, y: number, width: number, height: number): g.Rect; pageToLocalRect(rect: BBox): g.Rect; paperToLocalPoint(x: number, y: number): g.Point; paperToLocalPoint(point: Point): g.Point; paperToLocalRect(x: number, y: number, width: number, height: number): g.Rect; paperToLocalRect(x: BBox): g.Rect; snapToGrid(x: number, y: number): g.Point; snapToGrid(point: Point): g.Point; defineFilter(filter: SVGFilterJSON): string; defineGradient(gradient: SVGGradientJSON): string; defineMarker(marker: SVGMarkerJSON): string; definePattern(pattern: Omit): string; isDefined(defId: string): boolean; getComputedSize(): Size; getArea(): g.Rect; getRestrictedArea(): g.Rect | null; getRestrictedArea(elementView: ElementView, x: number, y: number): g.Rect | null | Paper.PointConstraintCallback; getContentArea(opt?: { useModelGeometry: boolean }): g.Rect; getContentBBox(opt?: { useModelGeometry: boolean }): g.Rect; findView(element: mvc.$SVGElement): T; findViewByModel(model: Graph.CellRef): T; /** * Finds all the element views at the specified point * @param point a point in local paper coordinates * @param opt options for the search */ findElementViewsAtPoint(point: Point, opt?: Paper.FindAtPointOptions): ElementView[]; /** * Finds all the link views at the specified point * @param point a point in local paper coordinates * @param opt options for the search */ findLinkViewsAtPoint(point: Point, opt?: Paper.FindAtPointOptions): LinkView[]; /** * Finds all the cell views at the specified point * @param point a point in local paper coordinates * @param opt options for the search */ findCellViewsAtPoint(point: Point, opt?: Paper.FindAtPointOptions): CellView[]; /** * Finds all the element views in the specified area * @param area a rectangle in local paper coordinates * @param opt options for the search */ findElementViewsInArea(area: BBox, opt?: Paper.FindInAreaOptions): ElementView[]; /** * Finds all the link views in the specified area * @param area a rectangle in local paper coordinates * @param opt options for the search */ findLinkViewsInArea(area: BBox, opt?: Paper.FindInAreaOptions): LinkView[]; /** * Finds all the cell views in the specified area * @param area a rectangle in local paper coordinates * @param opt options for the search */ findCellViewsInArea(area: BBox, opt?: Paper.FindInAreaOptions): CellView[]; /** * Finds the closest magnet to the specified point * @param point a point in local paper coordinates * @param opt options for the search */ findClosestMagnetToPoint(point: Point, opt?: Paper.FindClosestMagnetToPointOptions): Paper.ClosestMagnet | null; fitToContent(opt?: Paper.FitToContentOptions): g.Rect; fitToContent(gridWidth?: number, gridHeight?: number, padding?: number, opt?: any): g.Rect; getFitToContentArea(opt?: Paper.FitToContentOptions): g.Rect; transformToFitContent(opt?: Paper.TransformToFitContentOptions): void; drawBackground(opt?: Paper.BackgroundOptions): this; getDefaultLink(cellView: CellView, magnet: SVGElement): Link; getModelById(id: Graph.CellRef): Cell; setDimensions(width: Paper.Dimension, height: Paper.Dimension, data?: any): void; setInteractivity(value: any): void; scale(): Vectorizer.Scale; scale(sx: number, sy?: number, data?: any): this; scaleUniformAtPoint(scale: number, point: Point, data?: any): this; translate(): Vectorizer.Translation; translate(tx: number, ty?: number, data?: any): this; update(): this; getPointerArgs(evt: dia.Event): [dia.Event, number, number]; // grid setGrid(opt?: null | boolean | string | Paper.GridOptions | Paper.GridOptions[]): this; setGridSize(gridSize: number): this; // tools removeTools(): this; hideTools(): this; showTools(): this; dispatchToolsEvent(eventName: string, ...args: any[]): void; // layers getLayerView(layerRef: Paper.LayerRef): LayerView; getLayerView(layer: GraphLayer): GraphLayerView; hasLayerView(layerRef: Paper.LayerRef): boolean; getLayerViews(): Array; getGraphLayerViews(): Array; addLayerView(layerView: LayerView, options?: Paper.InsertLayerViewOptions): void; moveLayerView(layerRef: Paper.LayerRef, options?: Paper.InsertLayerViewOptions): void; removeLayerView(layerRef: Paper.LayerRef): void; protected insertLayerView(layerView: LayerView, before?: Paper.LayerRef): void; protected requestLayerViewRemoval(layerRef: Paper.LayerRef): void; protected createLayerView(options: Omit): LayerView; protected getLayerViewOrder(): string[]; protected renderLayerViews(): void; protected renderImplicitLayerViews(): void; protected renderGraphLayerViews(): void; protected removeLayerViews(): void; protected resetLayerViews(): void; // rendering freeze(opt?: Paper.FreezeOptions): void; unfreeze(opt?: Paper.UnfreezeOptions): void; wakeUp(): void; isFrozen(): boolean; requestViewUpdate(view: mvc.View, flag: number, priority: number, opt?: { [key: string]: any }): void; requestCellViewInsertion(cell: Graph.CellRef, opt?: { [key: string]: any }): void; requireView(cellOrId: Graph.CellRef, opt?: Paper.UpdateViewOptions & Paper.RenderCallbackOptions): T; updateViews(opt?: Paper.UpdateViewsOptions): Paper.RenderStats & { batches: number }; hasScheduledUpdates(): boolean; disposeHiddenCellViews(): void; isCellVisible(cellOrId: Graph.CellRef): boolean; updateCellVisibility( cell: Graph.CellRef, opt?: Paper.CellVisibilityOptions & Paper.UpdateViewOptions & Paper.RenderCallbackOptions ): void; updateCellsVisibility( opt?: Paper.ScheduleCellsVisibilityUpdateOptions & Paper.UpdateViewsOptions ): void; // events on(eventName: T, callback: Paper.EventMap[T], context?: any): this; on(events: { [eventName in T]: Paper.EventMap[eventName]; }, context?: any): this; // protected /** * For the specified view, calls the cell visibility function specified by the `paper.options.cellVisibility` function. * If the function returns true, the view is attached to the DOM; in other case it is detached. * While async papers do this automatically, synchronous papers require an explicit call to this method for this functionality to be applied. To show the view again, use `paper.requestView()`. * If you are using `autoFreeze` option you should call this function if you are calling `paper.requestView()` if you want `paper.options.cellVisibility` function to be applied. * @param cellView cellView for which the visibility check is performed * @param opt if opt.cellVisibility is provided, it is used as the callback function instead of paper.options.cellVisibility. */ protected checkViewVisibility( cellView: dia.CellView, opt?: Paper.CellVisibilityOptions ): Paper.UpdateVisibilityStats; protected scheduleCellsVisibilityUpdate(opt?: Paper.ScheduleCellsVisibilityUpdateOptions): Paper.UpdateVisibilityStats; protected scheduleViewUpdate(view: mvc.View, flag: number, priority: number, opt?: { [key: string]: any }): void; protected dumpViewUpdate(view: mvc.View): number; protected dumpView(view: mvc.View, opt?: Paper.UpdateViewOptions & Paper.RenderCallbackOptions): number; protected updateView(view: mvc.View, flag: number, opt?: Paper.UpdateViewOptions): number; protected registerUnmountedView(view: mvc.View): number; protected registerMountedView(view: mvc.View): number; protected updateViewsAsync(opt?: Paper.UpdateViewsAsyncOptions): void; protected updateViewsBatch(opt?: Paper.UpdateViewsBatchOptions): Paper.RenderBatchStats; protected checkMountedViews(viewport: Paper.ViewportCallback, opt?: Paper.UnmountOptions): number; protected checkUnmountedViews(viewport: Paper.ViewportCallback, opt?: Paper.MountOptions): number; protected prioritizeCellViewMount(cellOrId: Graph.CellRef): boolean; protected prioritizeCellViewUnmount(cellOrId: Graph.CellRef): boolean; protected isViewMounted(viewOrCid: dia.CellView | string): boolean; protected isAsync(): boolean; protected isIdle(): boolean; protected isExactSorting(): boolean; protected sortViews(): void; protected sortViewsExact(): void; protected pointerdblclick(evt: dia.Event): void; protected pointerclick(evt: dia.Event): void; protected contextmenu(evt: dia.Event): void; protected pointerdown(evt: dia.Event): void; protected pointermove(evt: dia.Event): void; protected pointerup(evt: dia.Event): void; protected mouseover(evt: dia.Event): void; protected mouseout(evt: dia.Event): void; protected mouseenter(evt: dia.Event): void; protected mouseleave(evt: dia.Event): void; protected mousewheel(evt: dia.Event): void; protected onevent(evt: dia.Event): void; protected onmagnet(evt: dia.Event): void; protected onlabel(evt: dia.Event): void; protected guard(evt: dia.Event, view: CellView): boolean; protected drawBackgroundImage(img: HTMLImageElement, opt: { [key: string]: any }): void; protected updateBackgroundColor(color: string): void; protected updateBackgroundImage(opt: { position?: any, size?: any }): void; protected createViewForModel(cell: Cell): CellView; protected cloneOptions(): Paper.Options; protected onCellAdded(cell: Cell, collection: mvc.Collection, opt: dia.Graph.Options): void; protected onCellRemoved(cell: Cell, collection: mvc.Collection, opt: dia.Graph.Options): void; protected onCellChanged(cell: Cell, opt: dia.Cell.Options): void; protected onCellChanged(cell: mvc.Collection, opt: dia.Graph.Options): void; protected onGraphLayerAdd(layer: GraphLayer, collection: mvc.Collection, opt: dia.Graph.Options): void; protected onGraphLayerRemove(layer: GraphLayer, collection: mvc.Collection, opt: dia.Graph.Options): void; protected onGraphLayerCollectionReset(layer: mvc.Collection, opt: dia.Graph.Options): void; protected onGraphLayerCollectionSort(layer: GraphLayer[]): void; protected onGraphReset(cells: mvc.Collection, opt: dia.Graph.Options): void; protected onGraphSort(): void; protected onGraphBatchStop(): void; protected onCellHighlight(cellView: CellView, magnetEl: SVGElement, opt?: { highlighter?: highlighters.HighlighterJSON }): void; protected onCellUnhighlight(cellView: CellView, magnetEl: SVGElement, opt?: { highlighter?: highlighters.HighlighterJSON }): void; protected onRemove(): void; protected removeView(cell: Cell): CellView; protected removeViews(): void; protected renderView(cell: Cell): CellView; protected resetViews(cells?: Cell[], opt?: { [key: string]: any }): void; protected insertView(cellView: CellView, isInitialInsert: boolean): void; protected _hideCellView(cellView: CellView): void; protected _detachCellView(cellView: CellView): void; protected customEventTrigger(event: dia.Event, view: CellView, rootNode?: SVGElement): dia.Event | null; protected addStylesheet(stylesheet: string): void; /** * @deprecated use `getLayerView(id).el` instead * **/ getLayerNode(id: Paper.Layers | string): SVGElement; /** * @deprecated use `findElementViewsAtPoint() */ findViewsFromPoint(point: string | Point): ElementView[]; /** * @deprecated use `findElementViewsInArea() */ findViewsInArea(rect: BBox, opt?: { strict?: boolean }): ElementView[]; /** * @deprecated use transformToFitContent */ scaleContentToFit(opt?: Paper.ScaleContentOptions): void; /** * @deprecated Use `updateCellsVisibility()` */ checkViewport(opt?: Paper.ScheduleCellsVisibilityUpdateOptions): Paper.UpdateVisibilityStats; /** * @deprecated Use `updateCellsVisibility()` */ dumpViews(opt?: Paper.ScheduleCellsVisibilityUpdateOptions & Paper.UpdateViewsOptions): void; } namespace LayerView { interface Options extends mvc.ViewOptions { id: string; paper: Paper; type?: string; } } class LayerView extends mvc.View { constructor(opt?: LayerView.Options); options: LayerView.Options; pivotNodes: { [z: number]: Comment }; insertSortedNode(node: SVGElement, z: number): void; insertNode(node: SVGElement): void; insertPivot(z: number): Comment; isEmpty(): boolean; reset(): void; setPaperReference(paper: Paper): void; unsetPaperReference(): void; protected removePivots(): void; protected afterPaperReferenceSet(paper: Paper): void; protected beforePaperReferenceUnset(paper: Paper): void; protected assertPaperReferenceSet(): void; } namespace GraphLayer { type ID = string; interface Attributes extends mvc.ObjectHash { id: ID; type?: string; } } class GraphLayer extends mvc.Model { declare id: string; cellCollection: C; graph: Graph | null; constructor(attributes?: DeepPartial, options?: mvc.ModelConstructorOptions); getCells(): Cell[]; } class GraphLayerView extends LayerView { sort(): void; sortExact(): void; insertCellView(cellView: CellView): void; protected onCellMove(cell: Cell, opt: Graph.Options): void; protected onCellChange(cell: Cell, opt: Cell.Options): void; protected onCellCollectionSort(collection: CellCollection, opt: Graph.Options): void; protected onGraphBatchStop(data: any): void; } namespace GridLayerView { interface Options extends LayerView.Options { patterns?: Record; } } class GridLayerView extends LayerView { setGrid(opt?: null | boolean | string | Paper.GridOptions | Paper.GridOptions[]): void; renderGrid(): void; updateGrid(): void; removeGrid(): void; } namespace ToolsView { interface Options extends mvc.ViewOptions { tools?: dia.ToolView[]; name?: string | null; relatedView?: dia.CellView; component?: boolean; layer?: dia.Paper.Layers | string | null; z?: number; } } class ToolsView extends mvc.View { constructor(opt?: ToolsView.Options); isRendered: boolean; options: ToolsView.Options; configure(opt?: ToolsView.Options): this; getName(): string | null; focusTool(tool: ToolView): this; blurTool(tool?: ToolView): this; show(): this; hide(): this; mount(): this; getLayer(): string | null; hasLayer(): boolean; } namespace ToolView { type VisibilityCallback = (this: ToolView, view: V, tool: ToolView) => boolean; interface Options extends mvc.ViewOptions { focusOpacity?: number; visibility?: VisibilityCallback; } } class ToolView extends mvc.View { name: string | null; parentView: ToolsView; relatedView: dia.CellView; paper: Paper; constructor(opt?: ToolView.Options); configure(opt?: ToolView.Options): this; protected simulateRelatedView(el: SVGElement): void; show(): void; hide(): void; isVisible(): boolean; isExplicitlyVisible(): boolean; updateVisibility(): void; protected computeVisibility(): boolean; focus(): void; blur(): void; update(): void; isOverlay(): boolean; protected guard(evt: dia.Event): boolean; } namespace HighlighterView { type Constructor = { new(): T }; type NodeSelectorJSON = { selector?: string; port?: string; label?: number; }; type NodeSelector = string | SVGElement | NodeSelectorJSON; interface Options extends mvc.ViewOptions { layer?: dia.Paper.Layers | string | null; z?: number; } } class HighlighterView = HighlighterView.Options> extends mvc.View { constructor(options?: Options); options: Options; UPDATABLE: boolean; MOUNTABLE: boolean; UPDATE_ATTRIBUTES: string[] | ((this: HighlighterView) => string[]); cellView: dia.CellView; nodeSelector: HighlighterView.NodeSelector | null; node: SVGElement | null; updateRequested: boolean; postponedUpdate: boolean; transformGroup: Vectorizer | null; detachedTransformGroup: Vectorizer | null; protected findNode(cellView: dia.CellView, nodeSelector: HighlighterView.NodeSelector): SVGElement | null; protected transform(): void; protected update(): void; protected highlight(cellView: dia.CellView, node: SVGElement): void; protected unhighlight(cellView: dia.CellView, node: SVGElement): void; protected listenToUpdateAttributes(cellView: dia.CellView): void; protected onCellAttributeChange(): void; protected getNodeMatrix(cellView: dia.CellView, node: SVGElement): SVGMatrix; static uniqueId(node: SVGElement, options?: any): string; static add( this: HighlighterView.Constructor, cellView: dia.CellView, selector: HighlighterView.NodeSelector, id: string, options?: any ): T; static remove( cellView: dia.CellView, id?: string ): void; static removeAll( paper: dia.Paper, id?: string ): void; static get( this: HighlighterView.Constructor, cellView: dia.CellView, id: string ): T | null; static get( this: HighlighterView.Constructor, cellView: dia.CellView ): T[]; static getAll( paper: dia.Paper, id?: string ): T[]; static has(cellView: dia.CellView, id?: string): boolean; static update(cellView: dia.CellView, id?: string): void; static transform(cellView: dia.CellView, id?: string): void; static highlight(cellView: dia.CellView, node: SVGElement, options?: any): void; static unhighlight(cellView: dia.CellView, node: SVGElement, options?: any): void; protected static _addRef(cellView: dia.CellView, id: string, view: HighlighterView): void; protected static _removeRef(cellView: dia.CellView, id?: string): void; } } // highlighters export namespace highlighters { import HighlighterView = dia.HighlighterView; interface AddClassHighlighterArguments extends HighlighterView.Options { className?: string; } interface OpacityHighlighterArguments extends HighlighterView.Options { alphaValue?: number; } interface StrokeHighlighterArguments extends HighlighterView.Options { padding?: number; rx?: number; ry?: number; useFirstSubpath?: boolean; nonScalingStroke?: boolean; attrs?: attributes.NativeSVGAttributes; } interface MaskHighlighterArguments extends HighlighterView.Options { padding?: number; maskClip?: number; deep?: boolean; attrs?: attributes.NativeSVGAttributes; } interface HighlighterArgumentsMap { 'addClass': AddClassHighlighterArguments; 'opacity': OpacityHighlighterArguments; 'stroke': StrokeHighlighterArguments; 'mask': MaskHighlighterArguments; [key: string]: { [key: string]: any }; } type HighlighterType = keyof HighlighterArgumentsMap; type GenericHighlighterArguments = HighlighterArgumentsMap[K]; interface GenericHighlighterJSON { name: K; options?: GenericHighlighterArguments; } type HighlighterJSON = GenericHighlighterJSON; class mask extends dia.HighlighterView { VISIBLE: string; INVISIBLE: string; MASK_ROOT_ATTRIBUTE_BLACKLIST: string[]; MASK_CHILD_ATTRIBUTE_BLACKLIST: string[]; MASK_REPLACE_TAGS: string[]; MASK_REMOVE_TAGS: string[]; public getMaskId(): string; protected getMask(cellView: dia.CellView, vel: Vectorizer): Vectorizer; protected getMaskShape(cellView: dia.CellView, vel: Vectorizer): Vectorizer; protected transformMaskRoot(cellView: dia.CellView, root: Vectorizer): void; protected transformMaskChild(cellView: dia.CellView, child: Vectorizer): boolean; protected addMask(paper: dia.Paper, mask: Vectorizer): void; protected removeMask(paper: dia.Paper): void; } class stroke extends dia.HighlighterView { protected getPathData(cellView: dia.CellView, node: SVGElement): string; protected highlightConnection(cellView: dia.CellView): void; protected highlightNode(cellView: dia.CellView, node: SVGElement): void; } class addClass extends dia.HighlighterView { } class opacity extends dia.HighlighterView { opacityClassName: string; } namespace list { enum Directions { ROW = 'row', COLUMN = 'column' } type DirectionsType = 'row' | 'column'; enum Positions { TOP = 'top', RIGHT = 'right', BOTTOM = 'bottom', LEFT = 'left', TOP_LEFT = 'top-left', TOP_RIGHT = 'top-right', BOTTOM_LEFT = 'bottom-left', BOTTOM_RIGHT = 'bottom-right', CENTER = 'center', } interface Options extends dia.HighlighterView.Options { direction?: Directions | DirectionsType; position?: Positions | dia.PositionName; size?: number | dia.Size; gap?: number; margin?: dia.Sides; } } class list = list.Options> extends dia.HighlighterView { options: Options; protected createListItem(item: Item, itemSize: dia.Size, itemEl: SVGElement | null): SVGElement; protected position(element: dia.Element, listSize: dia.Size): void; } /** * @deprecated */ interface GenericHighlighter { highlight(cellView: dia.CellView, magnetEl: SVGElement, opt?: GenericHighlighterArguments): void; unhighlight(cellView: dia.CellView, magnetEl: SVGElement, opt?: GenericHighlighterArguments): void; } /** * @deprecated */ type HighlighterArguments = GenericHighlighterArguments; /** * @deprecated */ type Highlighter = GenericHighlighter; } export namespace shapes { interface SVGTextSelector extends dia.Cell.Selectors { text?: Nullable; } interface SVGRectSelector extends dia.Cell.Selectors { rect?: Nullable; } interface SVGCircleSelector extends dia.Cell.Selectors { circle?: Nullable; } interface SVGEllipseSelector extends dia.Cell.Selectors { ellipse?: Nullable; } interface SVGPolygonSelector extends dia.Cell.Selectors { polygon?: Nullable; } interface SVGPolylineSelector extends dia.Cell.Selectors { polyline?: Nullable; } interface SVGImageSelector extends dia.Cell.Selectors { image?: Nullable; } interface SVGPathSelector extends dia.Cell.Selectors { path?: Nullable; } namespace standard { interface RectangleSelectors extends dia.Cell.Selectors { root?: Nullable; body?: Nullable; label?: Nullable; } type RectangleAttributes = dia.Element.GenericAttributes; class Rectangle extends dia.Element { } interface CircleSelectors extends dia.Cell.Selectors { root?: Nullable; body?: Nullable; label?: Nullable; } type CircleAttributes = dia.Element.GenericAttributes; class Circle extends dia.Element { } interface EllipseSelectors extends dia.Cell.Selectors { root?: Nullable; body?: Nullable; label?: Nullable; } type EllipseAttributes = dia.Element.GenericAttributes; class Ellipse extends dia.Element { } interface PathSelectors extends dia.Cell.Selectors { root?: Nullable; body?: Nullable; label?: Nullable; } type PathAttributes = dia.Element.GenericAttributes; class Path extends dia.Element { } interface PolygonSelectors extends dia.Cell.Selectors { root?: Nullable; body?: Nullable; label?: Nullable; } type PolygonAttributes = dia.Element.GenericAttributes; class Polygon extends dia.Element { } interface PolylineSelectors extends dia.Cell.Selectors { root?: Nullable; body?: Nullable; label?: Nullable; } type PolylineAttributes = dia.Element.GenericAttributes; class Polyline extends dia.Element { } interface ImageSelectors extends dia.Cell.Selectors { root?: Nullable; image?: Nullable; label?: Nullable; } type ImageAttributes = dia.Element.GenericAttributes; class Image extends dia.Element { } interface BorderedImageSelectors extends dia.Cell.Selectors { root?: Nullable; border?: Nullable; background?: Nullable; image?: Nullable; label?: Nullable; } type BorderedImageAttributes = dia.Element.GenericAttributes; class BorderedImage extends dia.Element { } interface EmbeddedImageSelectors extends dia.Cell.Selectors { root?: Nullable; body?: Nullable; image?: Nullable; label?: Nullable; } type EmbeddedImageAttributes = dia.Element.GenericAttributes; class EmbeddedImage extends dia.Element { } interface InscribedImageSelectors extends dia.Cell.Selectors { root?: Nullable; border?: Nullable; background?: Nullable; image?: Nullable; label?: Nullable; } type InscribedImageAttributes = dia.Element.GenericAttributes; class InscribedImage extends dia.Element { } interface HeaderedRectangleSelectors extends dia.Cell.Selectors { root?: Nullable; body?: Nullable; header?: Nullable; headerText?: Nullable; bodyText?: Nullable; } type HeaderedRectangleAttributes = dia.Element.GenericAttributes; class HeaderedRectangle extends dia.Element { } interface CylinderBodyAttributes extends attributes.SVGPathAttributes { lateralArea?: string | number; } interface CylinderSelectors extends dia.Cell.Selectors { root?: Nullable; body?: CylinderBodyAttributes; top?: Nullable; } type CylinderAttributes = dia.Element.GenericAttributes; class Cylinder extends dia.Element { topRy(): string | number; topRy(t: string | number, opt?: S): this; } interface TextBlockSelectors extends dia.Cell.Selectors { root?: Nullable; body?: Nullable; label?: Nullable<{ text?: string; style?: { [key: string]: any }; [key: string]: any; }>; } type TextBlockAttributes = dia.Element.GenericAttributes; class TextBlock extends dia.Element { } interface LinkSelectors extends dia.Cell.Selectors { root?: Nullable; line?: Nullable; wrapper?: Nullable; } type LinkAttributes = dia.Link.GenericAttributes; class Link extends dia.Link { } interface DoubleLinkSelectors extends dia.Cell.Selectors { root?: Nullable; line?: Nullable; outline?: Nullable; } type DoubleLinkAttributes = dia.Link.GenericAttributes; class DoubleLink extends dia.Link { } interface ShadowLinkSelectors extends dia.Cell.Selectors { root?: Nullable; line?: Nullable; shadow?: Nullable; } type ShadowLinkAttributes = dia.Link.GenericAttributes; class ShadowLink extends dia.Link { } } } // util export namespace util { export function cloneCells(cells: dia.Cell[]): { [id: string]: dia.Cell }; export function isCalcExpression(value: any): boolean; export function evalCalcFormula(formula: string, rect: g.PlainRect): number; export function evalCalcExpression(expression: string, rect: g.PlainRect): string; export function hashCode(str: string): string; export function getByPath(object: { [key: string]: any }, path: string | string[], delim?: string): any; export function setByPath(object: { [key: string]: any }, path: string | string[], value: any, delim?: string): any; export function unsetByPath(object: { [key: string]: any }, path: string | string[], delim?: string): any; export function flattenObject(object: { [key: string]: any }, delim?: string, stop?: (node: any) => boolean): any; export function uuid(): string; export function svg(strings: TemplateStringsArray, ...expressions: any): dia.MarkupJSON; export function guid(obj?: { [key: string]: any }): string; export function toKebabCase(str: string): string; export function normalizeEvent(evt: dia.Event): dia.Event; export function nextFrame(callback: () => void, context?: { [key: string]: any }, ...args: any[]): number; export function cancelFrame(requestId: number): void; export function isPercentage(val: any): boolean; export function parseCssNumeric(val: any, restrictUnits: string | string[]): { value: number, unit?: string } | null; type BreakTextOptions = { svgDocument?: SVGElement; separator?: string | any; eol?: string; ellipsis?: boolean | string; hyphen?: string | RegExp; maxLineCount?: number; preserveSpaces?: boolean; } type BreakTextFunction = ( text: string, size: { width: number, height?: number }, attrs?: attributes.NativeSVGAttributes, opt?: BreakTextOptions ) => string; export var breakText: BreakTextFunction; export function sanitizeHTML(html: string): string; export function downloadBlob(blob: Blob, fileName: string): void; export function downloadDataUri(dataUri: string, fileName: string): void; export function dataUriToBlob(dataUri: string): Blob; export function imageToDataUri(url: string, callback: (err: Error | null, dataUri: string) => void): void; export function getElementBBox(el: DOMElement): dia.BBox; export function sortElements( elements: mvc.$Element, comparator: (a: DOMElement, b: DOMElement) => number ): DOMElement[]; export function setAttributesBySelector(el: DOMElement, attrs: { [selector: string]: { [attribute: string]: any }}): void; export function normalizeSides(sides: dia.Sides): dia.PaddingJSON; export function template(html: string): (data: any) => string; export function toggleFullScreen(el?: DOMElement): void; export function objectDifference(object: object, base: object, opt?: { maxDepth?: number }): object; interface DOMJSONDocument { fragment: DocumentFragment; selectors: { [key: string]: DOMElement }; groupSelectors: { [key: string]: DOMElement[] }; } export function parseDOMJSON(json: dia.MarkupJSON): DOMJSONDocument; export namespace timing { type TimingFunction = (time: number) => number; export var linear: TimingFunction; export var quad: TimingFunction; export var cubic: TimingFunction; export var inout: TimingFunction; export var exponential: TimingFunction; export var bounce: TimingFunction; export function reverse(f: TimingFunction): TimingFunction; export function reflect(f: TimingFunction): TimingFunction; export function clamp(f: TimingFunction, min?: number, max?: number): TimingFunction; export function back(s?: number): TimingFunction; export function elastic(x?: number): TimingFunction; } export namespace interpolate { type InterpolateFunction = (start: T, end: T) => ((time: number) => T); export var number: InterpolateFunction; export var object: InterpolateFunction<{ [key: string]: any }>; export var hexColor: InterpolateFunction; export var unit: InterpolateFunction; } export namespace filter { interface FilterArgumentsMap { 'outline': { color?: string; opacity?: number; margin?: number; width?: number; }; 'highlight': { color?: string; blur?: number; opacity?: number; width?: number; }; 'blur': { x?: number; y?: number; }; 'dropShadow': { dx?: number; dy?: number; opacity?: number; color?: string; blur?: number; }; 'grayscale': { amount?: number; }; 'sepia': { amount?: number; }; 'saturate': { amount?: number; }; 'hueRotate': { angle?: number; }; 'invert': { amount?: number; }; 'brightness': { amount?: number; }; 'contrast': { amount?: number; }; } type FilterFunction = (args: FilterArgumentsMap[K]) => string; interface FilterJSON { name: K; id?: string; args?: FilterArgumentsMap[K]; attrs?: attributes.NativeSVGAttributes; } export var outline: FilterFunction<'outline'>; export var highlight: FilterFunction<'highlight'>; export var blur: FilterFunction<'blur'>; export var dropShadow: FilterFunction<'dropShadow'>; export var grayscale: FilterFunction<'grayscale'>; export var sepia: FilterFunction<'sepia'>; export var saturate: FilterFunction<'saturate'>; export var hueRotate: FilterFunction<'hueRotate'>; export var invert: FilterFunction<'invert'>; export var brightness: FilterFunction<'brightness'>; export var contrast: FilterFunction<'contrast'>; } namespace format { interface NumberLocale { currency: [string, string]; decimal: string; thousands: string; grouping: number[]; } export function number(specifier: string, value: number, locale?: NumberLocale): string; export function string(str: string, value: string): string; export function convert(type: string, value: number, precision: number): string; export function round(value: number, precision?: number): number; export function precision(value: number, precision: number): number; export function prefix(value: number, precision: number): { scale: (d: number) => number, symbol: string } | undefined; } // LODASH FUNCTIONS: type NotVoid = {} | null | undefined; // the `any` type without `void` and `never` type Collection = object | any[]; // an object or an array type PropertyPath = string | string[]; type IterateeFunction = (value: T) => NotVoid; interface Cancelable { cancel(): void; flush(): void; } type SourceObjectsOptionalFinalCustomizer = Array; // typescript cannot express "any number of objects optionally followed by CustomizerFunction" type CustomizerFunction = (objValue: any, srcValue: any, key: string, object: any, source: any, stack: any) => NotVoid; /** @deprecated do not use */ export function mixin(destinationObject: object, ...sourceObjects: object[]): object; /** @deprecated do not use */ export function deepMixin(destinationObject: object, ...sourceObjects: object[]): object; /** @deprecated do not use */ export function assign(destinationObject: object, ...sourceObjects: object[]): object; /** @deprecated use joint.util.defaults */ export function supplement(destinationObject: object, ...sourceObjects: object[]): object; /** @deprecated use joint.util.defaultsDeep */ export function deepSupplement(destinationObject: object, ...sourceObjects: object[]): object; export function defaults(destinationObject: object, ...sourceObjects: object[]): object; export function defaultsDeep(destinationObject: object, ...sourceObjects: object[]): object; export function invoke(collection: Collection, methodPath: PropertyPath, args?: any[]): any[]; export function invoke(collection: Collection, functionToInvokeForAll: IterateeFunction, ...args: ArgsT[]): any[]; export function invokeProperty(object: object, propertyPath: PropertyPath, args?: any[]): any; export function sortedIndex(sortedArray: T[], valueToInsert: T, iteratee?: IterateeFunction): number; export function uniq(array: Array | null | undefined, iteratee?: IterateeFunction): T[]; export function clone(value: T): T; export function cloneDeep(value: T): T; export function isEmpty(value: any): boolean; export function isEqual(value: any, otherValue: any): boolean; export function isFunction(value: any): boolean; export function isPlainObject(value: any): boolean; export function toArray(value: any): any[]; // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type export function debounce(func: T, wait?: number, options?: { leading?: boolean, maxWait?: number, trailing?: boolean }): T & Cancelable; export function groupBy(collection: Collection, iteratee?: IterateeFunction): object; export function sortBy(collection: object, iteratee?: IterateeFunction[] | IterateeFunction): any[]; export function sortBy(collection: T[], iteratee?: IterateeFunction[] | IterateeFunction): any[]; export function flattenDeep(array: any[]): any[]; export function without(array: T[], ...values: T[]): T[]; export function difference(array: T[], ...excludedValuesArrays: T[][]): T[]; export function intersection(...arrays: T[][]): T[]; export function union(...arrays: T[][]): T[]; export function has(object: object, path: PropertyPath): boolean; export function result(object: object, propertyPath: PropertyPath, defaultValue?: any): any; export function omit(object: object, ...propertyPathsToOmit: PropertyPath[]): object; export function pick(object: object, ...propertyPathsToPick: PropertyPath[]): object; export function bindAll(object: object, methodNames: string | string[]): object; export function forIn(object: T, iteratee?: (value: any, key: string, iterable: object) => void | boolean): void; export function camelCase(string: string): string; export function uniqueId(prefix?: string | number): string; export function getRectPoint(rect: dia.BBox, position: dia.PositionName): g.Point; export function merge(destinationObject: object, ...args: any[]): object; type MergeCustomizer = (value: any, srcValue: any, key: string, object: any, source: any, stack: any) => any; // ADDITIONAL SIMPLE UTIL FUNCTIONS: export function isBoolean(value: any): boolean; export function isObject(value: any): boolean; export function isNumber(value: any): boolean; export function isString(value: any): boolean; export function noop(): void; } // env export namespace env { export function addTest(name: string, fn: () => boolean): void; export function test(name: string): boolean; } // layout export namespace layout { export namespace Port { type Position = { x: number | string; y: number | string; }; type Transformation = { x: number; y: number; angle: number; }; interface LayoutOptions { [key: string]: any; } type LayoutFunction = ( portsArgs: Array, elBBox: g.Rect, portGroupArgs: LayoutOptions ) => Array>; interface Options extends LayoutOptions { x?: number | string; y?: number | string; dx?: number; dy?: number; angle?: number; start?: Position; end?: Position; startAngle?: number; step?: number; compensateRotation?: boolean; } /** @todo define Options types per-layout */ export var absolute: LayoutFunction; export var line: LayoutFunction; export var left: LayoutFunction; export var right: LayoutFunction; export var top: LayoutFunction; export var bottom: LayoutFunction; export var ellipseSpread: LayoutFunction; export var ellipse: LayoutFunction; /** @deprecated */ export var fn: LayoutFunction; } export namespace PortLabel { interface Options { x?: number; y?: number; angle?: number; offset?: number; attrs?: dia.Cell.Selectors; [key: string]: any; } interface LabelAttributes { x: number; y: number; angle: number; attrs: dia.Cell.Selectors; } type LayoutFunction = (portPosition: g.Point, elBBox: g.Rect, opt: Options) => LabelAttributes; export var manual: LayoutFunction; export var left: LayoutFunction; export var right: LayoutFunction; export var top: LayoutFunction; export var bottom: LayoutFunction; export var outsideOriented: LayoutFunction; export var outside: LayoutFunction; export var insideOriented: LayoutFunction; export var inside: LayoutFunction; export var radial: LayoutFunction; export var radialOriented: LayoutFunction; } } // mvc export namespace mvc { type Dom = unknown; // The following types represent the DOM elements that can be passed to the // $() function. type $Element = string | T | T[] | Dom; type $HTMLElement = $Element; type $SVGElement = $Element; interface $AnimationOptions { duration?: number; delay?: number; easing?: string; complete?: (this: DOMElement) => void; } interface Event { // Event bubbles: boolean | undefined; cancelable: boolean | undefined; eventPhase: number | undefined; // UIEvent detail: number | undefined; view: Window | undefined; // MouseEvent button: number | undefined; buttons: number | undefined; clientX: number | undefined; clientY: number | undefined; offsetX: number | undefined; offsetY: number | undefined; pageX: number | undefined; pageY: number | undefined; screenX: number | undefined; screenY: number | undefined; /** @deprecated */ toElement: DOMElement | undefined; // PointerEvent pointerId: number | undefined; pointerType: string | undefined; // KeyboardEvent /** @deprecated */ char: string | undefined; /** @deprecated */ charCode: number | undefined; key: string | undefined; /** @deprecated */ keyCode: number | undefined; // TouchEvent changedTouches: TouchList | undefined; targetTouches: TouchList | undefined; touches: TouchList | undefined; // MouseEvent, KeyboardEvent which: number | undefined; // MouseEvent, KeyboardEvent, TouchEvent altKey: boolean | undefined; ctrlKey: boolean | undefined; metaKey: boolean | undefined; shiftKey: boolean | undefined; timeStamp: number; type: string; isDefaultPrevented(): boolean; isImmediatePropagationStopped(): boolean; isPropagationStopped(): boolean; preventDefault(): void; stopImmediatePropagation(): void; stopPropagation(): void; } interface TriggeredEvent< TDelegateTarget = any, TData = any, TCurrentTarget = any, TTarget = any > extends Event { currentTarget: TCurrentTarget; delegateTarget: TDelegateTarget; target: TTarget; data: TData; namespace?: string | undefined; originalEvent?: NativeEvent | undefined; result?: any; } type List = ArrayLike; type ListIterator = (value: T, index: number, collection: List) => TResult; type MemoIterator = (prev: TResult, curr: T, indexOrKey: any, list: T[]) => TResult; type _Result = T | (() => T); type _StringKey = keyof T & string; interface AddOptions extends Silenceable { at?: number | undefined; merge?: boolean | undefined; sort?: boolean | undefined; } interface CollectionSetOptions extends Parseable, Silenceable { add?: boolean | undefined; remove?: boolean | undefined; merge?: boolean | undefined; at?: number | undefined; sort?: boolean | undefined; } interface Silenceable { silent?: boolean | undefined; } interface Validable { validate?: boolean | undefined; } interface Parseable { parse?: boolean | undefined; } interface ModelConstructorOptions extends ModelSetOptions, Parseable { collection?: Collection | undefined; eventPrefix?: string | undefined; } type CombinedModelConstructorOptions = Model> = ModelConstructorOptions & E; interface ModelSetOptions extends Silenceable, Validable {} type ObjectHash = Record; /** * DOM events (used in the events property of a View) */ interface EventsHash { [selector: string]: string | { (eventObject: mvc.TriggeredEvent): void }; } /** * JavaScript events (used in the methods of the Events interface) */ interface EventHandler { (...args: any[]): void; } interface EventMap { [event: string]: EventHandler; } const Events: Events; interface Events extends EventsMixin {} /** * Helper shorthands for classes that implement the Events interface. * Define your class like this: * * * class YourClass implements Events { * on: Events_On; * off: Events_Off; * trigger: Events_Trigger; * bind: Events_On; * unbind: Events_Off; * * once: Events_On; * listenTo: Events_Listen; * listenToOnce: Events_Listen; * stopListening: Events_Stop; * * // ... (other methods) * } * * Object.assign(YourClass.prototype, Events); // can also use _.extend * * If you are just writing a class type declaration that doesn't already * extend some other base class, you can use the EventsMixin instead; * see below. */ interface Events_On { (this: T, eventName: string, callback: EventHandler, context?: any): T; (this: T, eventMap: EventMap, context?: any): T; } interface Events_Off { (this: T, eventName?: string | null, callback?: EventHandler | null, context?: any): T; } interface Events_Trigger { (this: T, eventName: string, ...args: any[]): T; } interface Events_Listen { (this: T, object: any, events: string, callback: EventHandler): T; (this: T, object: any, eventMap: EventMap): T; } interface Events_Stop { (this: T, object?: any, events?: string, callback?: EventHandler): T; } /** * Helper to avoid code repetition in type declarations. * Events cannot be extended, hence a separate abstract * class with a different name. Both classes and interfaces can * extend from this helper class to reuse the signatures. * * For class type declarations that already extend another base * class, and for actual class definitions, please see the * Events_* interfaces above. */ abstract class EventsMixin implements Events { on(eventName: string, callback: EventHandler, context?: any): this; on(eventMap: EventMap, context?: any): this; off(eventName?: string | null, callback?: EventHandler | null, context?: any): this; trigger(eventName: string, ...args: any[]): this; bind(eventName: string, callback: EventHandler, context?: any): this; bind(eventMap: EventMap, context?: any): this; unbind(eventName?: string, callback?: EventHandler, context?: any): this; once(events: string, callback: EventHandler, context?: any): this; once(eventMap: EventMap, context?: any): this; listenTo(object: any, events: string, callback: EventHandler): this; listenTo(object: any, eventMap: EventMap): this; listenToOnce(object: any, events: string, callback: EventHandler): this; listenToOnce(object: any, eventMap: EventMap): this; stopListening(object?: any, events?: string, callback?: EventHandler): this; } class ModelBase extends EventsMixin { toJSON(options?: any): any; } /** * E - Extensions to the model constructor options. You can accept additional constructor options * by listing them in the E parameter. */ class Model extends ModelBase implements Events { /** * Do not use, prefer TypeScript's extend functionality. */ static extend(properties: any, classProperties?: any): any; attributes: Partial; changed: Partial; cidPrefix: string; cid: string; collection: Collection; private _changing: boolean; private _previousAttributes: Partial; private _pending: boolean; /** * Default attributes for the model. It can be an object hash or a method returning an object hash. * For assigning an object hash, do it like this: this.defaults = { attribute: value, ... }; * That works only if you set it in the constructor or the initialize method. */ defaults(): Partial; id: string | number; idAttribute: string; validationError: any; /** * For use with models as ES classes. If you define a preinitialize * method, it will be invoked when the Model is first created, before * any instantiation logic is run for the Model. */ preinitialize(attributes?: T, options?: CombinedModelConstructorOptions): void; constructor(attributes?: T, options?: CombinedModelConstructorOptions); initialize(attributes?: T, options?: CombinedModelConstructorOptions): void; /** * For strongly-typed access to attributes, use the `get` method only privately in public getter properties. * @example * get name(): string { * return super.get("name"); * } */ get>(attributeName: A): T[A] | undefined; /** * For strongly-typed assignment of attributes, use the `set` method only privately in public setter properties. * @example * set name(value: string) { * super.set("name", value); * } */ set>(attributeName: A, value?: T[A], options?: S): this; set(attributeName: Partial, options?: S): this; set>(attributeName: A | Partial, value?: T[A] | S, options?: S): this; /** * Return an object containing all the attributes that have changed, or * false if there are no changed attributes. Useful for determining what * parts of a view need to be updated and/or what attributes need to be * persisted to the server. Unset attributes will be set to undefined. * You can also pass an attributes object to diff against the model, * determining if there *would be* a change. */ changedAttributes(attributes?: Partial): Partial | false; clear(options?: Silenceable): this; clone(): Model; escape(attribute: _StringKey): string; has(attribute: _StringKey): boolean; hasChanged(attribute?: _StringKey): boolean; isValid(options?: any): boolean; previous>(attribute: A): T[A] | null | undefined; previousAttributes(): Partial; unset(attribute: _StringKey, options?: Silenceable): this; validate(attributes: Partial, options?: any): any; private _validate(attributes: Partial, options: any): boolean; } class Collection extends ModelBase implements Events { /** * Do not use, prefer TypeScript's extend functionality. */ static extend(properties: any, classProperties?: any): any; model: new (...args: any[]) => TModel; models: TModel[]; length: number; /** * For use with collections as ES classes. If you define a preinitialize * method, it will be invoked when the Collection is first created and * before any instantiation logic is run for the Collection. */ preinitialize(models?: TModel[] | Array>, options?: any): void; constructor(models?: TModel[] | Array>, options?: any); initialize(models?: TModel[] | Array>, options?: any): void; /** * Specify a model attribute name (string) or function that will be used to sort the collection. */ comparator: | string | { bivarianceHack(element: TModel): number | string }['bivarianceHack'] | { bivarianceHack(compare: TModel, to?: TModel): number }['bivarianceHack']; add(model: {} | TModel, options?: AddOptions): TModel; add(models: Array<{} | TModel>, options?: AddOptions): TModel[]; at(index: number): TModel; /** * Get a model from a collection, specified by an id, a cid, or by passing in a model. */ get(id: number | string | Model): TModel; has(key: number | string | Model): boolean; clone(): this; push(model: TModel, options?: AddOptions): TModel; pop(options?: Silenceable): TModel; remove(model: {} | TModel, options?: Silenceable): TModel; remove(models: Array<{} | TModel>, options?: Silenceable): TModel[]; reset(models?: Array<{} | TModel>, options?: Silenceable): TModel[]; /** * * The set method performs a "smart" update of the collection with the passed list of models. * If a model in the list isn't yet in the collection it will be added; if the model is already in the * collection its attributes will be merged; and if the collection contains any models that aren't present * in the list, they'll be removed. All of the appropriate "add", "remove", and "change" events are fired as * this happens. Returns the touched models in the collection. If you'd like to customize the behavior, you can * disable it with options: {add: false}, {remove: false}, or {merge: false}. * @param models * @param options */ set(models?: Array<{} | TModel>, options?: CollectionSetOptions): TModel[]; shift(options?: Silenceable): TModel; sort(options?: Silenceable): this; unshift(model: TModel, options?: AddOptions): TModel; modelId(attrs: any): any; values(): Iterator; keys(): Iterator; entries(): Iterator<[any, TModel]>; [Symbol.iterator](): Iterator; private _prepareModel(attributes?: any, options?: any): any; private _removeReference(model: TModel): void; private _onModelEvent(event: string, model: TModel, collection: Collection, options: any): void; private _isModel(obj: any): obj is Model; /** * Return a shallow copy of this collection's models, using the same options as native Array#slice. */ slice(min?: number, max?: number): TModel[]; // array methods each(iterator: ListIterator, context?: any): void; find(iterator: ListIterator, context?: any): TModel | undefined; findIndex(iterator: ListIterator, context?: any): number; filter(iterator: ListIterator, context?: any): TModel[]; first(): TModel; includes(value: TModel): boolean; isEmpty(): boolean; last(): TModel; map(iterator: ListIterator, context?: any): TResult[]; reduce(iterator: MemoIterator, memo?: TResult): TResult; sortBy(iterator?: ListIterator, context?: any): TModel[]; sortBy(iterator: string, context?: any): TModel[]; toArray(): TModel[]; } interface ViewBaseOptions { model?: TModel | undefined; // TODO: quickfix, this can't be fixed easy. The collection does not need to have the same model as the parent view. collection?: Collection | undefined; // was: Collection; el?: $Element | string | undefined; id?: string | undefined; cid?: string | undefined; attributes?: Record | undefined; className?: string | undefined; tagName?: string | undefined; events?: _Result | undefined; } type ViewBaseEventListener = (event: mvc.Event) => void; class ViewBase extends EventsMixin implements Events { /** * Do not use, prefer TypeScript's extend functionality. */ static extend(properties: any, classProperties?: any): any; /** * For use with views as ES classes. If you define a preinitialize * method, it will be invoked when the view is first created, before any * instantiation logic is run. */ preinitialize(options?: ViewBaseOptions): void; constructor(options?: ViewBaseOptions); initialize(options?: ViewBaseOptions): void; /** * Events hash or a method returning the events hash that maps events/selectors to methods on your View. * For assigning events as object hash, do it like this: `this.events = { "event:selector": callback, ... };` * That works only if you set it in the constructor or the initialize method. */ events(): EventsHash; // A conditional type used here to prevent `TS2532: Object is possibly 'undefined'` model: TModel extends Model ? TModel : undefined; collection: Collection; setElement(element: $Element): this; id?: string | undefined; cid: string; className?: string | undefined; tagName: string; el: TElement; attributes: Record; /** @deprecated use `el` instead */ $el: Dom; /** @deprecated use `el.querySelector()` instead */ $(selector: string): Dom; render(): this; remove(): this; delegateEvents(events?: _Result): this; delegate(eventName: string, selector: string, listener: ViewBaseEventListener): this; undelegateEvents(): this; undelegate(eventName: string, selector?: string, listener?: ViewBaseEventListener): this; protected _removeElement(): void; protected _setElement(el: $Element): void; protected _createElement(tagName: string): void; protected _ensureElement(): void; protected _setAttributes(attributes: Record): void; } interface ViewOptions extends mvc.ViewBaseOptions { theme?: string; [key: string]: any; } interface viewEventData { [key: string]: any; } class View extends mvc.ViewBase { constructor(opt?: ViewOptions); UPDATE_PRIORITY: number; DETACHABLE: boolean; FLAG_INSERT: number; FLAG_REMOVE: number; FLAG_INIT: number; vel: E extends HTMLElement ? null : Vectorizer; svgElement: boolean; options: ViewOptions; theme: string; themeClassNamePrefix: string; defaultTheme: string; requireSetThemeOverride: boolean; documentEvents?: mvc.EventsHash; children?: dia.MarkupJSON; childNodes?: { [key: string]: DOMElement } | null; style?: { [key: string]: any }; setTheme(theme: string, opt?: { override?: boolean }): this; getEventNamespace(): string; delegateDocumentEvents(events?: mvc.EventsHash, data?: viewEventData): this; undelegateDocumentEvents(): this; delegateElementEvents(element: DOMElement, events?: mvc.EventsHash, data?: viewEventData): this; undelegateElementEvents(element: DOMElement): this; eventData(evt: dia.Event): viewEventData; eventData(evt: dia.Event, data: viewEventData): this; stopPropagation(evt: dia.Event): this; isPropagationStopped(evt: dia.Event): boolean; renderChildren(children?: dia.MarkupJSON): this; findAttribute(attributeName: string, node: DOMElement): string | null; confirmUpdate(flag: number, opt: { [key: string]: any }): number; unmount(): void; isMounted(): boolean; protected findAttributeNode(attributeName: string, node: DOMElement): DOMElement | null; protected init(): void; protected onRender(): void; protected onSetTheme(oldTheme: string, newTheme: string): void; protected onRemove(): void; } type ModifiedCallback = (...args: [...CallbackArgs, ...Parameters]) => any; type EventHashMap> = { [Property in keyof T]?: ModifiedCallback; }; type Callback = (...args: any[]) => any; class Listener { constructor(...callbackArguments: Args); callbackArguments: Args; listenTo(object: any, evt: string, callback: ModifiedCallback, context?: any): void; listenTo = { [eventName: string]: Callback }>(object: any, eventHashMap: EventHashMap, context?: any): void; stopListening(): void; } } // routers export namespace routers { interface NormalRouterArguments { } interface ManhattanRouterArguments { step?: number; padding?: dia.Sides; maximumLoops?: number; maxAllowedDirectionChange?: number; perpendicular?: boolean; excludeEnds?: dia.LinkEnd[]; excludeTypes?: string[]; startDirections?: dia.OrthogonalDirection[]; endDirections?: dia.OrthogonalDirection[]; isPointObstacle?: (point: dia.Point) => boolean; fallbackRouter: (vertices: dia.Point[], opts?: ManhattanRouterArguments, linkView?: dia.LinkView) => dia.Point[]; } interface OrthogonalRouterArguments { elementPadding?: number; padding?: dia.Sides; } interface OneSideRouterArguments { side?: dia.OrthogonalDirection; padding?: dia.Sides; } interface RouterArgumentsMap { 'normal': NormalRouterArguments; 'manhattan': ManhattanRouterArguments; 'metro': ManhattanRouterArguments; 'orthogonal': OrthogonalRouterArguments; /** * @deprecated use `rightAngle` instead */ 'oneSide': OneSideRouterArguments; 'rightAngle': RightAngleRouterArguments; [key: string]: { [key: string]: any }; } type RouterType = keyof RouterArgumentsMap; type GenericRouterArguments = RouterArgumentsMap[K]; interface GenericRouter { ( vertices: dia.Point[], args?: GenericRouterArguments, linkView?: dia.LinkView ): dia.Point[]; } interface GenericRouterJSON { name: K; args?: GenericRouterArguments; } type RouterArguments = GenericRouterArguments; type Router = GenericRouter; type RouterJSON = GenericRouterJSON; export var manhattan: GenericRouter<'manhattan'>; export var metro: GenericRouter<'metro'>; export var normal: GenericRouter<'normal'>; export var orthogonal: GenericRouter<'orthogonal'>; /** * @deprecated use `rightAngle` instead */ export var oneSide: GenericRouter<'oneSide'>; /* Right Angle Router */ enum RightAngleDirections { AUTO = 'auto', LEFT = 'left', RIGHT = 'right', TOP = 'top', BOTTOM = 'bottom', ANCHOR_SIDE = 'anchor-side', MAGNET_SIDE = 'magnet-side' } interface RightAngleRouterArguments { margin?: number; /** @experimental before version 4.0 */ useVertices?: boolean; sourceDirection?: RightAngleDirections; targetDirection?: RightAngleDirections; } interface RightAngleRouter extends GenericRouter<'rightAngle'> { Directions: typeof RightAngleDirections; } export var rightAngle: RightAngleRouter; } // connectors export namespace connectors { interface NormalConnectorArguments { raw?: boolean; } interface RoundedConnectorArguments { raw?: boolean; radius?: number; } interface SmoothConnectorArguments { raw?: boolean; } interface JumpOverConnectorArguments { raw?: boolean; size?: number; jump?: 'arc' | 'gap' | 'cubic'; radius?: number; } interface StraightConnectorArguments { raw?: boolean; cornerType?: 'point' | 'cubic' | 'line' | 'gap'; cornerRadius?: number; cornerPreserveAspectRatio?: boolean; precision?: number; } enum CurveDirections { AUTO = 'auto', HORIZONTAL = 'horizontal', VERTICAL = 'vertical', CLOSEST_POINT = 'closest-point', OUTWARDS = 'outwards' } enum CurveTangentDirections { UP = 'up', DOWN = 'down', LEFT = 'left', RIGHT = 'right', AUTO = 'auto', CLOSEST_POINT = 'closest-point', OUTWARDS = 'outwards' } interface CurveConnectorArguments { raw?: boolean; direction?: CurveDirections; sourceDirection?: CurveTangentDirections | dia.Point | number; targetDirection?: CurveTangentDirections | dia.Point | number; sourceTangent?: dia.Point; targetTangent?: dia.Point; distanceCoefficient?: number; angleTangentCoefficient?: number; tension?: number; precision?: number; } interface ConnectorArgumentsMap { 'normal': NormalConnectorArguments; 'rounded': RoundedConnectorArguments; 'smooth': SmoothConnectorArguments; 'jumpover': JumpOverConnectorArguments; 'straight': StraightConnectorArguments; 'curve': CurveConnectorArguments; [key: string]: { [key: string]: any }; } type ConnectorType = keyof ConnectorArgumentsMap; type GenericConnectorArguments = ConnectorArgumentsMap[K]; interface GenericConnector { ( sourcePoint: dia.Point, targetPoint: dia.Point, routePoints: dia.Point[], args?: GenericConnectorArguments, linkView?: dia.LinkView ): string | g.Path; } interface GenericConnectorJSON { name: K; args?: GenericConnectorArguments; } interface CurveConnector extends GenericConnector<'curve'> { Directions: typeof CurveDirections; TangentDirections: typeof CurveTangentDirections; } type ConnectorArguments = GenericConnectorArguments; type Connector = GenericConnector; type ConnectorJSON = GenericConnectorJSON; export var normal: GenericConnector<'normal'>; export var rounded: GenericConnector<'rounded'>; export var smooth: GenericConnector<'smooth'>; export var jumpover: GenericConnector<'jumpover'>; export var straight: GenericConnector<'straight'>; export var curve: CurveConnector; } // anchors export namespace anchors { interface ElementAnchorArguments { useModelGeometry?: boolean; } interface RotateAnchorArguments extends ElementAnchorArguments { rotate?: boolean; } interface BBoxAnchorArguments extends RotateAnchorArguments { dx?: number | string; dy?: number | string; } interface PaddingAnchorArguments extends ElementAnchorArguments { padding?: number; } interface MidSideAnchorArguments extends RotateAnchorArguments, PaddingAnchorArguments { mode?: 'prefer-horizontal' | 'prefer-vertical' | 'horizontal' | 'vertical' | 'auto'; preferenceThreshold?: dia.Sides; } interface ModelCenterAnchorArguments { dx?: number; dy?: number; } interface AnchorArgumentsMap { 'center': BBoxAnchorArguments; 'top': BBoxAnchorArguments; 'bottom': BBoxAnchorArguments; 'left': BBoxAnchorArguments; 'right': BBoxAnchorArguments; 'topLeft': BBoxAnchorArguments; 'topRight': BBoxAnchorArguments; 'bottomLeft': BBoxAnchorArguments; 'bottomRight': BBoxAnchorArguments; 'perpendicular': PaddingAnchorArguments; 'midSide': MidSideAnchorArguments; 'modelCenter': ModelCenterAnchorArguments; 'connectionRatio': linkAnchors.ConnectionLengthAnchorArguments; 'connectionLength': linkAnchors.ConnectionLengthAnchorArguments; 'connectionPerpendicular': linkAnchors.ConnectionPerpendicularAnchorArguments; 'connectionClosest': linkAnchors.ConnectionClosestAnchorArguments; [key: string]: { [key: string]: any }; } type AnchorType = keyof AnchorArgumentsMap; type GenericAnchorArguments = AnchorArgumentsMap[K]; interface GenericAnchor { ( endView: dia.CellView, endMagnet: SVGElement, anchorReference: g.Point | SVGElement, opt: AnchorArgumentsMap[K], endType: dia.LinkEnd, linkView: dia.LinkView ): g.Point; } interface GenericAnchorJSON { name: K; args?: AnchorArgumentsMap[K]; } type AnchorArguments = GenericAnchorArguments; type Anchor = GenericAnchor; type AnchorJSON = GenericAnchorJSON; export var center: GenericAnchor<'center'>; export var top: GenericAnchor<'top'>; export var bottom: GenericAnchor<'bottom'>; export var left: GenericAnchor<'left'>; export var right: GenericAnchor<'right'>; export var topLeft: GenericAnchor<'topLeft'>; export var topRight: GenericAnchor<'topRight'>; export var bottomLeft: GenericAnchor<'bottomLeft'>; export var bottomRight: GenericAnchor<'bottomRight'>; export var perpendicular: GenericAnchor<'perpendicular'>; export var midSide: GenericAnchor<'midSide'>; } export namespace linkAnchors { interface ConnectionLengthAnchorArguments { length?: number; } interface ConnectionRatioAnchorArguments { ratio?: number; } interface ConnectionPerpendicularAnchorArguments { fallbackAt?: number | string; fixedAt?: number | string; } interface ConnectionClosestAnchorArguments { fixedAt?: number | string; } export var connectionRatio: anchors.GenericAnchor<'connectionRatio'>; export var connectionLength: anchors.GenericAnchor<'connectionLength'>; export var connectionPerpendicular: anchors.GenericAnchor<'connectionPerpendicular'>; export var connectionClosest: anchors.GenericAnchor<'connectionClosest'>; } // connection points export namespace connectionPoints { type ConnectionPointAlignment = 'top' | 'bottom' | 'left' | 'right'; interface DefaultConnectionPointArguments { offset?: number | dia.Point; } interface AlignConnectionPointArguments extends DefaultConnectionPointArguments { align?: ConnectionPointAlignment | null; alignOffset?: number; } interface StrokeConnectionPointArguments extends DefaultConnectionPointArguments { stroke?: boolean; } interface BoundaryConnectionPointArguments extends StrokeConnectionPointArguments { selector?: Array | string | false; precision?: number; extrapolate?: boolean; sticky?: boolean; insideout?: boolean; } interface ConnectionPointArgumentsMap { 'anchor': DefaultConnectionPointArguments; 'bbox': StrokeConnectionPointArguments; 'rectangle': StrokeConnectionPointArguments; 'boundary': BoundaryConnectionPointArguments; [key: string]: { [key: string]: any }; } type ConnectionPointType = keyof ConnectionPointArgumentsMap; type GenericConnectionPointArguments = ConnectionPointArgumentsMap[K]; interface GenericConnectionPoint { ( endPathSegmentLine: g.Line, endView: dia.CellView, endMagnet: SVGElement, opt: ConnectionPointArgumentsMap[K], endType: dia.LinkEnd, linkView: dia.LinkView ): g.Point; } interface GenericConnectionPointJSON { name: K; args?: ConnectionPointArgumentsMap[K]; } type ConnectionPointArguments = GenericConnectionPointArguments; type ConnectionPoint = GenericConnectionPoint; type ConnectionPointJSON = GenericConnectionPointJSON; export var anchor: GenericConnectionPoint<'anchor'>; export var bbox: GenericConnectionPoint<'bbox'>; export var rectangle: GenericConnectionPoint<'rectangle'>; export var boundary: GenericConnectionPoint<'boundary'>; } export namespace connectionStrategies { interface ConnectionStrategy { ( endDefinition: dia.Link.EndJSON, endView: dia.CellView, endMagnet: SVGElement, coords: dia.Point, link: dia.Link, endType: dia.LinkEnd ): dia.Link.EndJSON; } export var useDefaults: ConnectionStrategy; export var pinAbsolute: ConnectionStrategy; export var pinRelative: ConnectionStrategy; } export namespace attributes { interface SVGCoreAttributes { 'id'?: string; 'xml:base'?: string; 'xml:lang'?: string; 'xml:space'?: string; 'tabindex'?: number; } interface SVGConditionalProcessingAttributes { 'requiredExtensions'?: boolean; 'requiredFeatures'?: string; 'systemLanguage'?: string; } interface SVGXLinkAttributes { 'xlink:href'?: string; 'xlink:type'?: string; 'xlink:role'?: string; 'xlink:arcrole'?: string; 'xlink:title'?: string; 'xlink:show'?: string; 'xlink:actuate'?: string; } interface SVGPresentationAttributes { 'alignment-baseline'?: any; 'baseline-shift'?: any; 'clip'?: any; 'clip-path'?: any; 'clip-rule'?: any; 'color'?: any; 'color-interpolation'?: any; 'color-interpolation-filters'?: any; 'color-profile'?: any; 'color-rendering'?: any; 'cursor'?: any; 'direction'?: any; 'display'?: any; 'dominant-baseline'?: any; 'enable-background'?: any; 'fill'?: any; 'fill-opacity'?: any; 'fill-rule'?: any; 'filter'?: any; 'flood-color'?: any; 'flood-opacity'?: any; 'font-family'?: any; 'font-size'?: any; 'font-size-adjust'?: any; 'font-stretch'?: any; 'font-style'?: any; 'font-variant'?: any; 'font-weight'?: any; 'glyph-orientation-horizontal'?: any; 'glyph-orientation-vertical'?: any; 'image-rendering'?: any; 'kerning'?: any; 'letter-spacing'?: any; 'lighting-color'?: any; 'marker-end'?: any; 'marker-mid'?: any; 'marker-start'?: any; 'mask'?: any; 'opacity'?: any; 'overflow'?: any; 'pointer-events'?: any; 'shape-rendering'?: any; 'stop-color'?: any; 'stop-opacity'?: any; 'stroke'?: any; 'stroke-dasharray'?: any; 'stroke-dashoffset'?: any; 'stroke-linecap'?: any; 'stroke-linejoin'?: any; 'stroke-miterlimit'?: any; 'stroke-opacity'?: any; 'stroke-width'?: any; 'text-anchor'?: any; 'text-decoration'?: any; 'text-rendering'?: any; 'unicode-bidi'?: any; 'visibility'?: any; 'word-spacing'?: any; 'writing-mode'?: any; } interface NativeSVGAttributes extends SVGCoreAttributes, SVGPresentationAttributes, SVGConditionalProcessingAttributes, SVGXLinkAttributes { 'class'?: string; 'style'?: any; 'transform'?: string; 'externalResourcesRequired'?: boolean; [key: string]: any; } interface SVGAttributeTextWrap { width?: string | number | null; height?: string | number | null; ellipsis?: boolean | string; separator?: string; hyphen?: string; maxLineCount?: number; preserveSpaces?: boolean; breakText?: util.BreakTextFunction; [key: string]: any; /** * @deprecated use SVGAttributes.text instead **/ text?: string; } interface SVGAttributeProps { checked?: boolean; disabled?: boolean; multiple?: boolean; readOnly?: boolean; selected?: boolean; indeterminate?: boolean; contentEditable?: boolean; value?: any; } interface SVGAttributes extends NativeSVGAttributes { // Special attributes eol?: string; filter?: string | dia.SVGFilterJSON; fill?: string | dia.SVGPatternJSON | dia.SVGGradientJSON; stroke?: string | dia.SVGPatternJSON | dia.SVGGradientJSON; sourceMarker?: dia.SVGMarkerJSON; targetMarker?: dia.SVGMarkerJSON; vertexMarker?: dia.SVGMarkerJSON; props?: SVGAttributeProps; text?: string; textWrap?: SVGAttributeTextWrap; lineHeight?: number | string; textPath?: any; annotations?: any; port?: string | { [key: string]: any }; style?: { [key: string]: any }; html?: string; ref?: string; refX?: string | number; refY?: string | number; refX2?: string | number; refY2?: string | number; refDx?: string | number; refDy?: string | number; refWidth?: string | number; refHeight?: string | number; refRx?: string | number; refRy?: string | number; refR?: string | number; refRInscribed?: string | number; // alias for refR refRCircumscribed?: string | number; refCx?: string | number; refCy?: string | number; refD?: string; refDResetOffset?: string; // alias for refD refDKeepOffset?: string; refPoints?: string; refPointsResetOffset?: string; // alias for refPoints refPointsKeepOffset?: string; resetOffset?: boolean; displayEmpty?: boolean; xAlignment?: 'middle' | 'right' | number | string; yAlignment?: 'middle' | 'bottom' | number | string; event?: string; magnet?: boolean | string; title?: string; textVerticalAnchor?: 'bottom' | 'top' | 'middle' | number | string; connection?: boolean | { stubs?: number }; atConnectionLength?: number; atConnectionLengthKeepGradient?: number; // alias for atConnectionLength atConnectionLengthIgnoreGradient?: number; atConnectionRatio?: number; atConnectionRatioKeepGradient?: number; // alias for atConnectionRatio atConnectionRatioIgnoreGradient?: number; magnetSelector?: string; highlighterSelector?: string; containerSelector?: string; // CamelCase variants of native attributes alignmentBaseline?: any; baselineShift?: any; clipPath?: any; clipRule?: any; colorInterpolation?: any; colorInterpolationFilters?: any; colorProfile?: any; colorRendering?: any; dominantBaseline?: any; enableBackground?: any; fillOpacity?: any; fillRule?: any; floodColor?: any; floodOpacity?: any; fontFamily?: any; fontSize?: any; fontSizeAdjust?: any; fontStretch?: any; fontStyle?: any; fontVariant?: any; fontWeight?: any; glyphOrientationHorizontal?: any; glyphOrientationVertical?: any; imageRendering?: any; letterSpacing?: any; lightingColor?: any; markerEnd?: any; markerMid?: any; markerStart?: any; pointerEvents?: any; shapeRendering?: any; stopColor?: any; stopOpacity?: any; strokeDasharray?: any; strokeDashoffset?: any; strokeLinecap?: any; strokeLinejoin?: any; strokeMiterlimit?: any; strokeOpacity?: any; strokeWidth?: any; textAnchor?: any; textDecoration?: any; textRendering?: any; unicodeBidi?: any; wordSpacing?: any; writingMode?: any; xlinkHref?: string; xlinkShow?: string; xlinkType?: string; xlinkRole?: string; xlinkArcrole?: string; xlinkTitle?: string; xlinkActuate?: string; xmlSpace?: string; xmlBase?: string; xmlLang?: string; // Backwards compatibility 'ref-x'?: string | number; 'ref-y'?: string | number; 'ref-dx'?: string | number; 'ref-dy'?: string | number; 'ref-width'?: string | number; 'ref-height'?: string | number; 'x-alignment'?: 'middle' | 'right' | number | string; 'y-alignment'?: 'middle' | 'bottom' | number | string; } interface SVGTextAttributes extends SVGAttributes { x?: string | number; y?: string | number; dx?: string | number; dy?: string | number; rotate?: string; textAnchor?: string; textLength?: number; lengthAdjust?: string; 'text-anchor'?: string; 'text-length'?: number; 'length-adjust'?: string; } interface SVGRectAttributes extends SVGAttributes { x?: string | number; y?: string | number; width?: string | number; height?: string | number; ry?: string | number; rx?: string | number; } interface SVGCircleAttributes extends SVGAttributes { cx?: string | number; cy?: string | number; r?: string | number; } interface SVGEllipseAttributes extends SVGAttributes { cx?: string | number; cy?: string | number; rx?: string | number; ry?: string | number; } interface SVGPolygonAttributes extends SVGAttributes { points?: string; } interface SVGPolylineAttributes extends SVGAttributes { points?: string; } interface SVGImageAttributes extends SVGAttributes { x?: string | number; y?: string | number; width?: string | number; height?: string | number; preserveAspectRatio?: string; } interface SVGPathAttributes extends SVGAttributes { d?: string; pathLength?: number; 'path-length'?: number; } interface SVGLineAttributes extends SVGAttributes { x1?: number | string; x2?: number | string; y1?: number | string; y2?: number | string; pathLength?: number; 'path-length'?: number; } } export function setTheme(theme: string): void; export namespace elementTools { namespace Button { type ActionCallback = (evt: dia.Event, view: dia.ElementView, tool: Button) => void; interface Options extends dia.ToolView.Options { x?: number | string; y?: number | string; offset?: { x?: number, y?: number }; rotate?: boolean; action?: ActionCallback; markup?: dia.MarkupJSON; useModelGeometry?: boolean; scale?: number; } } class Button extends dia.ToolView { constructor(opt?: Button.Options); protected onPointerDown(evt: dia.Event): void; protected position(): void; protected getCellMatrix(): SVGMatrix; protected getElementMatrix(): SVGMatrix; protected getLinkMatrix(): SVGMatrix; } class Remove extends Button { } namespace Connect { type MagnetCallback = ((this: Connect, view: dia.ElementView, tool: Connect) => SVGElement); interface Options extends Button.Options { magnet?: string | SVGElement | MagnetCallback; } } class Connect extends Button { constructor(opt?: Connect.Options); protected getMagnetNode(): SVGElement; protected dragstart(evt: dia.Event): void; protected drag(evt: dia.Event): void; protected dragend(evt: dia.Event): void; } namespace Boundary { interface Options extends dia.ToolView.Options { padding?: dia.Sides; useModelGeometry?: boolean; rotate?: boolean; } } class Boundary extends dia.ToolView { constructor(opt?: Boundary.Options); } namespace Control { interface Options extends dia.ToolView.Options { selector?: string | null; padding?: number; handleAttributes?: Partial; scale?: number; } } abstract class Control = Control.Options> extends dia.ToolView { options: T; constructor(opt?: T); protected getPosition(view: dia.ElementView): dia.Point; protected setPosition(view: dia.ElementView, coordinates: g.Point, evt: dia.Event): void; protected resetPosition(view: dia.ElementView, evt: dia.Event): void; protected updateHandle(handleNode: SVGElement): void; protected updateExtras(extrasNode: SVGElement): void; protected toggleExtras(visible: boolean): void; protected onPointerDown(evt: dia.Event): void; protected onPointerMove(evt: dia.Event): void; protected onPointerUp(evt: dia.Event): void; protected onPointerDblClick(evt: dia.Event): void; } namespace HoverConnect { type TrackPath = string; type TrackPathCallback = (this: HoverConnect, view: dia.ElementView) => TrackPath; interface Options extends Connect.Options { useModelGeometry?: boolean; trackWidth?: number; trackPath?: TrackPath | TrackPathCallback; } } class HoverConnect extends Connect { constructor(opt?: HoverConnect.Options); } } export namespace linkTools { type AnchorCallback = ( coords: g.Point, view: dia.CellView, magnet: SVGElement, type: string, linkView: dia.LinkView, toolView: dia.ToolView ) => T; namespace Vertices { class VertexHandle extends mvc.View { position(x: number, y: number): void; protected onPointerDown(evt: dia.Event): void; protected onPointerMove(evt: dia.Event): void; protected onPointerUp(evt: dia.Event): void; protected onPointerClick(evt: dia.Event): void; } interface VertexAddingOptions { interactiveLineNode: string; } interface Options extends dia.ToolView.Options { handleClass?: typeof VertexHandle; snapRadius?: number; redundancyRemoval?: boolean; vertexAdding?: boolean | Partial; vertexRemoving?: boolean; vertexMoving?: boolean; stopPropagation?: boolean; scale?: number; } } class Vertices extends dia.ToolView { constructor(opt?: Vertices.Options); } namespace Segments { class SegmentHandle extends mvc.View { position(x: number, y: number, angle: number, view: dia.LinkView): void; show(): void; hide(): void; protected onPointerDown(evt: dia.Event): void; protected onPointerMove(evt: dia.Event): void; protected onPointerUp(evt: dia.Event): void; } interface Options extends dia.ToolView.Options { handleClass?: typeof SegmentHandle; snapRadius?: number; snapHandle?: boolean; redundancyRemoval?: boolean; segmentLengthThreshold?: number; anchor?: AnchorCallback; stopPropagation?: boolean; scale?: number; } } class Segments extends dia.ToolView { constructor(opt?: Segments.Options); } namespace Arrowhead { interface Options extends dia.ToolView.Options { scale?: number; } } abstract class Arrowhead extends dia.ToolView { ratio: number; arrowheadType: string; constructor(opt?: Arrowhead.Options); protected onPointerDown(evt: dia.Event): void; protected onPointerMove(evt: dia.Event): void; protected onPointerUp(evt: dia.Event): void; } class SourceArrowhead extends Arrowhead { } class TargetArrowhead extends Arrowhead { } namespace Anchor { interface Options extends dia.ToolView.Options { snap?: AnchorCallback; anchor?: AnchorCallback; resetAnchor?: boolean | anchors.AnchorJSON; customAnchorAttributes?: attributes.NativeSVGAttributes; defaultAnchorAttributes?: attributes.NativeSVGAttributes; areaPadding?: number; snapRadius?: number; restrictArea?: boolean; redundancyRemoval?: boolean; scale?: number; } } abstract class Anchor extends dia.ToolView { type: string; constructor(opt?: Anchor.Options); } class SourceAnchor extends Anchor { } class TargetAnchor extends Anchor { } namespace Button { type ActionCallback = (evt: dia.Event, view: dia.LinkView, tool: Button) => void; type Distance = number | string; type DistanceCallback = (this: Button, view: dia.LinkView, tool: Button) => Distance; interface Options extends dia.ToolView.Options { distance?: Distance | DistanceCallback; offset?: number; rotate?: boolean; action?: ActionCallback; markup?: dia.MarkupJSON; scale?: number; } } class Button extends dia.ToolView { constructor(opt?: Button.Options); protected onPointerDown(evt: dia.Event): void; } class Remove extends Button { } namespace Connect { type MagnetCallback = ((this: Connect, view: dia.LinkView, tool: Connect) => SVGElement); interface Options extends Button.Options { magnet?: string | SVGElement | MagnetCallback; } } class Connect extends Button { constructor(opt?: Connect.Options); protected getMagnetNode(): SVGElement; protected dragstart(evt: dia.Event): void; protected drag(evt: dia.Event): void; protected dragend(evt: dia.Event): void; } namespace Boundary { interface Options extends dia.ToolView.Options { padding?: dia.Sides; useModelGeometry?: boolean; } } class Boundary extends dia.ToolView { constructor(opt?: Boundary.Options); } namespace HoverConnect { interface Options extends Connect.Options { } } class HoverConnect extends Connect { constructor(opt?: HoverConnect.Options); trackPath: g.Path; protected getButtonMatrix(): SVGMatrix; protected getTrackPath(): g.Path; protected getTrackMatrix(): SVGMatrix; protected getTrackRatioFromEvent(evt: dia.Event): number; protected canShowButton(): boolean; protected showButton(): void; protected hideButton(): void; protected onMousemove(evt: dia.Event): void; protected onMouseenter(evt: dia.Event): void; protected onMouseleave(evt: dia.Event): void; } namespace Control { interface Options extends dia.ToolView.Options { selector?: string | null; padding?: number; handleAttributes?: Partial; scale?: number; } } abstract class Control = Control.Options> extends dia.ToolView { options: T; constructor(opt?: T); protected getPosition(view: dia.LinkView): dia.Point; protected setPosition(view: dia.LinkView, coordinates: g.Point): void; protected resetPosition(view: dia.LinkView): void; protected updateHandle(handleNode: SVGElement): void; protected updateExtras(extrasNode: SVGElement): void; protected toggleExtras(visible: boolean): void; protected onPointerDown(evt: dia.Event): void; protected onPointerMove(evt: dia.Event): void; protected onPointerUp(evt: dia.Event): void; protected onPointerDblClick(evt: dia.Event): void; } namespace RotateLabel { interface Options extends Control.Options { offset?: number | dia.Point; buttonColor?: string; iconColor?: string; outlineColor?: string; } } class RotateLabel extends Control { constructor(opt?: RotateLabel.Options); protected getLabelPosition(label: dia.Link.Label): dia.Link.LabelPosition; protected getLabelIndex(): number; protected getLabel(): dia.Link.Label | null; } }