UNPKG

diagram-js

Version:

A toolbox for displaying and modifying diagrams on the web

83 lines (75 loc) 1.71 kB
/** * A factory for model elements. * */ export default class ElementFactory<T extends Connection = import("../model/Types.js").Connection, U extends Label = import("../model/Types.js").Label, V extends Root = import("../model/Types.js").Root, W extends Shape = import("../model/Types.js").Shape> { /** * Create a root element. * * @param attrs * * @return The created root element. */ createRoot(attrs?: Partial<Root>): V; /** * Create a label. * * @param attrs * * @return The created label. */ createLabel(attrs?: Partial<Label>): U; /** * Create a shape. * * @param attrs * * @return The created shape. */ createShape(attrs?: Partial<Shape>): W; /** * Create a connection. * * @param attrs * * @return The created connection. */ createConnection(attrs?: Partial<Connection>): T; /** * Create a root element. * * @param type * @param attrs * @return */ create(type: 'root', attrs?: Partial<Root>): V; /** * Create a shape. * * @param type * @param attrs * @return */ create(type: 'shape', attrs?: Partial<Shape>): W; /** * Create a connection. * * @param type * @param attrs * @return */ create(type: 'connection', attrs?: Partial<Connection>): T; /** * Create a label. * * @param type * @param attrs * @return */ create(type: 'label', attrs?: Partial<Label>): U; } type Element = import("../model/Types.js").Element; type Connection = import("../model/Types.js").Connection; type Label = import("../model/Types.js").Label; type Root = import("../model/Types.js").Root; type Shape = import("../model/Types.js").Shape;