basant307/AI_Governance_Project
045
1//2// Translation from Objects in help to Typescript interface.3// http://js.cytoscape.org/#notation/functions4// TypeScript Version: 2.35 6/**7 * WARNING: This is a provisional specification of the Cytoscape.js8 * API in TypeScript, based on improvements made on the Typescript9 * specification for Cytoscape.js in DefinitelyTyped. This is a work10 * in progress and may not be complete, and it may have errors. Please11 * report any issues to the issue tracker:12 *13 * https://github.com/cytoscape/cytoscape.js/issues14 *15 * cy --> Cy.Core16 * the core17 *18 * eles --> Cy.Collection19 * a collection of one or more elements (nodes and edges)20 *21 * ele --> Cy.Singular22 * a collection of a single element (node or edge)23 *24 * node --> Cy.NodeSingular25 * a collection of a single node26 *27 * nodes -> Cy.NodeCollection28 * a collection of one or more nodes29 *30 * edge --> Cy.EdgeSingular31 * a collection of a single edge32 *33 * edges -> Cy.EdgeCollection34 * a collection of one or more edges35 *36 * The library makes a distinction between input and output parameters37 * due to the dynamic behaviour of the Cytoscape library.38 *39 * For a input parameter it will always expect:40 * - Cy.Collection41 * The input can be any element (node and edge) collection.42 * - Cy.NodeCollection43 * The input must be a node collection.44 * - Cy.EdgeCollection45 * The input must be a edge collection.46 * - Cy.Singular47 * The input must be a single element.48 * - Cy.NodeSingular49 * The input must be a single node.50 * - Cy.EdgeSingular51 * The input must be a single edge.52 *53 * For a output of a function it will always give:54 * - Cy.Elements55 * The output is a collection of node and edge elements OR single element.56 * - Cy.EdgeCollection57 * The output is a collection of edge elements OR single edge.58 * - Cy.NodeCollection59 * The output is a collection of node elements OR single node.60 *61 * A number of interfaces contain nothing as they serve to collect interfaces.62 */63export = cytoscape;64export as namespace cytoscape;65 66/**67 * WARNING: This is a provisional specification of the Cytoscape.js68 * API in TypeScript, based on improvements made on the Typescript69 * specification for Cytoscape.js in DefinitelyTyped. This is a work70 * in progress and may not be complete, and it may have errors. Please 71 * report any issues to the issue tracker:72 * 73 * https://github.com/cytoscape/cytoscape.js/issues74 */75declare function cytoscape(options?: cytoscape.CytoscapeOptions): cytoscape.Core;76declare function cytoscape(type: string, name: string): unknown;77declare function cytoscape(type: string, name: string, registrant: any): void;78 79declare namespace cytoscape {80 /***81 * extensions can add functionality to the registry for Cytoscape ,82 * to three different types of functionality can be added83 **/84 type CytoscapeRegistry = (type: "core" | "collection" | "layout", name: string, extension: unknown) => void;85 interface Position {86 x: number;87 y: number;88 }89 90 interface BoundingBox {91 x1: number;92 y1: number;93 x2: number;94 y2: number;95 w: number;96 h: number;97 }98 99 type CssStyleDeclaration = any;100 101 interface ElementDefinition {102 group?: ElementGroup;103 data: NodeDataDefinition | EdgeDataDefinition;104 /**105 * Scratchpad data (usually temp or nonserialisable data)106 */107 scratch?: Scratchpad;108 /**109 * The model position of the node (optional on init, mandatory after)110 */111 position?: Position;112 /**113 * can alternatively specify position in rendered on-screen pixels114 */115 renderedPosition?: Position;116 /**117 * Whether the element is selected (default false)118 */119 selected?: boolean;120 /**121 * Whether the selection state is mutable (default true)122 */123 selectable?: boolean;124 /**125 * When locked a node's position is immutable (default false)126 */127 locked?: boolean;128 /**129 * Wether the node can be grabbed and moved by the user130 */131 grabbable?: boolean;132 /**133 * Whether the element has passthrough panning enabled.134 */135 pannable?: boolean;136 /**137 * a space separated list of class names that the element has138 */139 classes?: string[] | string;140 /**141 * CssStyleDeclaration;142 */143 style?: CssStyleDeclaration;144 /**145 * you should only use `style`/`css` for very special cases; use classes instead146 */147 css?: Css.Node | Css.Edge;148 /**149 * an element can be in a removed state, these elements will be not part of the rendered graph150 */151 removed?: boolean;152 }153 154 interface ElementDataDefinition {155 /**156 * elided id => autogenerated id157 */158 id?: string;159 position?: Position;160 }161 162 interface EdgeDefinition extends ElementDefinition {163 group?: "edges";164 data: EdgeDataDefinition;165 }166 167 interface EdgeDataDefinition extends ElementDataDefinition {168 /**169 * the source node id (edge comes from this node)170 */171 source: string;172 /**173 * the target node id (edge goes to this node)174 */175 target: string;176 177 [key: string]: any;178 }179 180 interface NodeDefinition extends ElementDefinition {181 group?: "nodes";182 data: NodeDataDefinition;183 }184 185 interface NodeDataDefinition extends ElementDataDefinition {186 parent?: string;187 [key: string]: any;188 }189 190 interface CytoscapeOptions {191 ///////////////////////////////////////192 // very commonly used options:193 /**194 * A HTML DOM element in which the graph should be rendered.195 * This is optional if Cytoscape.js is run headlessly or if you initialise using jQuery (in which case your jQuery object already has an associated DOM element).196 *197 * The default is undefined.198 */199 container?: HTMLElement | null;200 201 /**202 * An array of [[Elements]] specified as plain objects. For convenience, this option can alternatively be specified as a promise that resolves to the elements JSON.203 */204 elements?:205 | ElementsDefinition206 | ElementDefinition[]207 | Promise<ElementsDefinition>208 | Promise<ElementDefinition[]>209 ;210 /**211 * The StylesheetJson (StylesheetJsonBlock[]) used to style the graph. For convenience, this option can alternatively be specified as a promise that resolves to the stylesheet.212 */213 style?: StylesheetJson | Promise<StylesheetJson>;214 /**215 * A plain object that specifies layout options.216 * Which layout is initially run is specified by the name field.217 * Refer to a layout's documentation for the options it supports.218 * If you want to specify your node positions yourself in your elements JSON,219 * you can use the preset layout — by default it does not set any positions,220 * leaving your nodes in their current positions221 * (e.g. specified in options.elements at initialisation time)222 */223 layout?: LayoutOptions;224 225 /**226 * A plain object that contains graph-level data (i.e. data that does not belong to any particular node or edge).227 */228 data?: Record<string, any>;229 230 ///////////////////////////////////////231 // initial viewport state:232 /**233 * The initial zoom level of the graph.234 * Make sure to disable viewport manipulation options, such as fit, in your layout so that it is not overridden when the layout is applied.235 * You can set options.minZoom and options.maxZoom to set restrictions on the zoom level.236 *237 * The default value is 1.238 */239 zoom?: number;240 /**241 * The initial panning position of the graph. Make sure to disable viewport manipulation options, such as fit,242 * in your layout so that it is not overridden when the layout is applied.243 */244 pan?: Position;245 246 ///////////////////////////////////////247 // interaction options?:248 /**249 * A minimum bound on the zoom level of the graph. The viewport can not be scaled smaller than this zoom level.250 *251 * The default value is 1e-50.252 */253 minZoom?: number;254 /**255 * A maximum bound on the zoom level of the graph. The viewport can not be scaled larger than this zoom level.256 *257 * The default value is 1e50.258 */259 maxZoom?: number;260 /**261 * Whether zooming the graph is enabled, both by user events and programmatically.262 *263 * The default value is true.264 */265 zoomingEnabled?: boolean;266 /**267 * Whether user events (e.g. mouse wheel, pinch-to-zoom) are allowed to zoom the graph. Programmatic changes to zoom are unaffected by this option.268 *269 * The default value is true.270 */271 userZoomingEnabled?: boolean;272 /**273 * Whether panning the graph is enabled, both by user events and programmatically.274 *275 * The default value is true.276 */277 panningEnabled?: boolean;278 /**279 * Whether user events (e.g. dragging the graph background) are allowed to pan the graph. Programmatic changes to pan are unaffected by this option.280 *281 * The default value is true.282 */283 userPanningEnabled?: boolean;284 /**285 * Whether box selection (i.e. drag a box overlay around, and release it to select) is enabled. If enabled, the user must taphold to pan the graph.286 *287 * The default value is false.288 */289 boxSelectionEnabled?: boolean;290 /**291 * A string indicating the selection behaviour from user input.292 * By default, this is set automatically for you based on the type of input device detected.293 * On touch devices, 'additive' is default — a new selection made by the user adds to the set of currenly selected elements.294 * On mouse-input devices, 'single' is default — a new selection made by the user becomes the entire set of currently selected elements (i.e. the previous elements are unselected).295 *296 * The default value is (isTouchDevice ? 'additive' : 'single').297 */298 selectionType?: SelectionType;299 /**300 * A nonnegative integer that indicates the maximum allowable distance that a user may move during a tap gesture,301 * on touch devices and desktop devices respectively.302 *303 * This makes tapping easier for users.304 * These values have sane defaults, so it is not advised to change these options unless you have very good reason for doing so.305 * Larger values will almost certainly have undesirable consequences.306 *307 * The default value is is 8.308 */309 touchTapThreshold?: number;310 /**311 * A nonnegative integer that indicates the maximum allowable distance that a user may move during a tap gesture,312 * on touch devices and desktop devices respectively.313 *314 * This makes tapping easier for users.315 * These values have sane defaults,316 * so it is not advised to change these options unless you have very good reason for doing so.317 * Larger values will almost certainly have undesirable consequences.318 *319 * The default value is 4.320 */321 desktopTapThreshold?: number;322 /**323 * Whether nodes should be locked (not draggable at all) by default (if true, overrides individual node state).324 *325 * The default value is false.326 */327 autolock?: boolean;328 /**329 * Whether nodes should be ungrabified (not grabbable by user) by default (if true, overrides individual node state).330 *331 * The default value is false.332 */333 autoungrabify?: boolean;334 /**335 * Whether nodes should be unselectified (immutable selection state) by default (if true, overrides individual element state).336 *337 * The default value is false.338 */339 autounselectify?: boolean;340 341 ///////////////////////////////////////342 // rendering options:343 /**344 * A convenience option that initialises the Core to run headlessly.345 * You do not need to set this in environments that are implicitly headless (e.g. Node.js).346 * However, it is handy to set headless: true if you want a headless Core in a browser.347 *348 * The default value is false.349 */350 headless?: boolean;351 /**352 * A boolean that indicates whether styling should be used.353 * For headless (i.e. outside the browser) environments,354 * display is not necessary and so neither is styling necessary — thereby speeding up your code.355 * You can manually enable styling in headless environments if you require it for a special case.356 * Note that it does not make sense to disable style if you plan on rendering the graph.357 *358 * The default value is true.359 */360 styleEnabled?: boolean;361 /**362 * When set to true, the renderer does not render edges while the viewport is being manipulated.363 * This makes panning, zooming, dragging, et cetera more responsive for large graphs.364 *365 * The default value is false.366 */367 hideEdgesOnViewport?: boolean;368 /**369 * when set to true, the renderer does not render labels while the viewport is being manipulated.370 * This makes panning, zooming, dragging, et cetera more responsive for large graphs.371 *372 * The default value is false.373 */374 hideLabelsOnViewport?: boolean;375 /**376 * When set to true, the renderer uses a texture (if supported) during panning and zooming instead of drawing the elements,377 * making large graphs more responsive.378 *379 * The default value is false.380 */381 textureOnViewport?: boolean;382 /**383 * When set to true, the renderer will use a motion blur effect to make the transition between frames seem smoother.384 * This can significantly increase the perceived performance for a large graphs.385 *386 * The default value is false.387 */388 motionBlur?: boolean;389 /**390 * When motionBlur: true, this value controls the opacity of motion blur frames.391 * Higher values make the motion blur effect more pronounced.392 *393 * The default value is 0.2.394 */395 motionBlurOpacity?: number;396 /**397 * Changes the scroll wheel sensitivity when zooming. This is a multiplicative modifier.398 * So, a value between 0 and 1 reduces the sensitivity (zooms slower), and a value greater than 1 increases the sensitivity (zooms faster).399 *400 * The default value is 1.401 */402 wheelSensitivity?: number;403 /**404 * Overrides the screen pixel ratio with a manually set value (1.0 or 0.666 recommended, if set).405 * This can be used to increase performance on high density displays by reducing the effective area that needs to be rendered.406 * If you want to use the hardware's actual pixel ratio at the expense of performance, you can set pixelRatio: 'auto'.407 *408 * The default value is 1.409 */410 pixelRatio?: number | "auto";411 412 /**413 * Enables the experimental WebGL mode.414 * WARNING: This is currently experimental, and may have API changes in future.415 */416 webgl?: boolean;417 418 /**419 * Prints debug info to the browser console.420 * (optional)421 * WARNING: This is currently experimental, and may have API changes in future.422 */423 webglDebug?: boolean;424 425 /**426 * The size of the WebGL texture.427 * (provisional, may change in future releases)428 * WARNING: This is currently experimental, and may have API changes in future.429 */430 webglTexSize?: number;431 432 /**433 * The number of rows in the WebGL texture.434 * (provisional, may change in future releases)435 * WARNING: This is currently experimental, and may have API changes in future.436 */437 webglTexRows?: number;438 439 /**440 * The batch size for WebGL.441 * (provisional, may change in future releases)442 * WARNING: This is currently experimental, and may have API changes in future.443 */444 webglBatchSize?: number;445 446 /**447 * The number of textures per batch in WebGL.448 * (provisional, may change in future releases)449 * WARNING: This is currently experimental, and may have API changes in future.450 */451 webglTexPerBatch?: number;452 }453 454 /**455 * cy --> Cy.Core456 * The core object is your interface to a graph.457 *458 * It is your entry point to Cytoscape.js:459 * All of the library’s features are accessed through this object.460 * http://js.cytoscape.org/#core461 */462 interface Core463 extends464 CoreGraphManipulation,465 CoreData,466 CoreGraphManipulationExt,467 CoreEvents,468 CoreViewportManipulation,469 CoreAnimation,470 CoreLayout,471 CoreStyle,472 CoreExport473 {}474 475 /**476 * These are the principle functions used to interact with the graph model.477 *478 * http://js.cytoscape.org/#core/graph-manipulation479 */480 interface CoreGraphManipulation {481 /**482 * Add elements to the graph and return them.483 */484 add(485 eles: ElementDefinition | ElementDefinition[] | ElementsDefinition | CollectionArgument,486 ): CollectionReturnValue;487 488 /**489 * Remove elements in collection or match the selector from the graph and return them.490 */491 remove(eles: CollectionArgument | Selector): CollectionReturnValue;492 493 /**494 * Get a collection from elements in the graph matching the specified selector or from an array of elements.495 * If no parameter is specified, an empty collection will be returned496 * options The options for the collection497 * removed A truthy value that sets whether the elements are in the removed state (true) or added to the graph (false, default).498 */499 collection(500 eleObjs?: ElementDefinition[] | CollectionArgument | Selector,501 options?: {502 removed?: true;503 }504 ): CollectionReturnValue;505 506 /**507 * check whether the specified id is in the collection508 */509 hasElementWithId(id: string): boolean;510 511 /**512 * Get an element from its ID in a very performant way.513 * http://js.cytoscape.org/#cy.getElementById514 */515 getElementById(id: string): CollectionReturnValue;516 517 /**518 * Get an element from its ID in a very performant way.519 * http://js.cytoscape.org/#cy.getElementById520 */521 $id(id: string): CollectionReturnValue;522 523 /**524 * Get elements in the graph matching the specified selector.525 * http://js.cytoscape.org/#cy.$526 */527 $(selector: Selector): CollectionReturnValue;528 529 /**530 * Get elements in the graph matching the specified selector.531 * http://js.cytoscape.org/#cy.$532 */533 elements(selector?: Selector): CollectionReturnValue;534 535 /**536 * Get nodes in the graph matching the specified selector.537 */538 nodes(selector?: Selector): NodeCollection;539 540 /**541 * Get edges in the graph matching the specified selector.542 */543 edges(selector?: Selector): EdgeCollection;544 /**545 * Get elements in the graph matching the specified selector or filter function.546 */547 filter(548 selector: Selector | ((ele: Singular, i: number, eles: CollectionArgument) => boolean),549 ): CollectionReturnValue;550 551 /**552 * Allow for manipulation of elements without triggering multiple style calculations or multiple redraws.553 * http://js.cytoscape.org/#cy.batch554 * A callback within which you can make batch updates to elements.555 */556 batch(callback: () => void): void;557 /**558 * Allow for manipulation of elements without triggering multiple style calculations or multiple redraws.559 * http://js.cytoscape.org/#cy.batch560 *561 * Starts batching manually (useful for asynchronous cases).562 */563 startBatch(): void;564 /**565 * Allow for manipulation of elements without triggering multiple style calculations or multiple redraws.566 * http://js.cytoscape.org/#cy.batch567 *568 * Ends batching manually (useful for asynchronous cases).569 */570 endBatch(): void;571 572 /**573 * Attaches the instance to the specified container for visualisation.574 * http://js.cytoscape.org/#cy.mount575 *576 * If the core instance is headless prior to calling cy.mount(), then577 * the instance will no longer be headless and the visualisation will578 * be shown in the specified container. If the core instance is579 * non-headless prior to calling cy.mount(), then the visualisation580 * is swapped from the prior container to the specified container.581 */582 mount(element: Element): void;583 584 /**585 * Remove the instance from its current container.586 * http://js.cytoscape.org/#cy.unmount587 *588 * This function sets the instance to be headless after unmounting from589 * the current container.590 */591 unmount(): void;592 593 /**594 * A convenience function to explicitly destroy the Core.595 * http://js.cytoscape.org/#cy.destroy596 */597 destroy(): void;598 599 /**600 * Get whether the instance of Cytoscape.js has been destroyed or not.601 * https://js.cytoscape.org/#cy.destroyed602 */603 destroyed(): boolean;604 }605 606 /**607 * https://js.cytoscape.org/#core/data608 */609 interface CoreData {610 /**611 * Read and write developer-defined data associated with the graph.612 * http://js.cytoscape.org/#cy.data613 */614 /**615 * Get the entire data object or a particular data field.616 * @alias attr617 *618 * @param name The name of the field to get.619 */620 data(name?: string): any;621 /**622 * Set a particular data field.623 * @alias attr624 *625 * @param name The name of the field to set.626 * @param value The value to set for the field (must be JSON-serializable).627 */628 data(name: string, value: any): this;629 /**630 * Update multiple data fields at once via an object.631 * @alias attr632 *633 * @param obj The object containing name-value pairs to update data fields (must be JSON-serializable).634 */635 data(obj: Record<string, any>): this;636 /**637 * Get the entire data object or a particular data field.638 *639 * @param name The name of the field to get. Get the entire data object640 */641 attr(name?: string): any;642 /**643 * Set a particular data field.644 *645 * @param name The name of the field to set.646 * @param value The value to set for the field (must be JSON-serializable).647 */648 attr(name: string, value: any): this;649 /**650 * Update multiple data fields at once via an object.651 *652 * @param obj The object containing name-value pairs to update data fields.653 */654 attr(obj: Record<string, any>): this;655 656 /**657 * Remove developer-defined data associated with the elements.658 * https://js.cytoscape.org/#cy.removeData659 * @alias removeAttr660 *661 * @param names A space-separated list of fields to delete.662 */663 removeData(names?: string): this;664 /**665 * Remove developer-defined data associated with the elements.666 * https://js.cytoscape.org/#cy.removeData667 *668 * @param names A space-separated list of fields to delete.669 */670 removeAttr(names?: string): this;671 }672 673 /**674 * http://js.cytoscape.org/#core/graph-manipulation675 * http://js.cytoscape.org/#extensions676 * These functions are intended for use in extensions.677 */678 interface CoreGraphManipulationExt {679 /**680 * Set the scratchpad at a particular namespace,681 * where temporary or non-JSON data can be stored.682 * App-level scratchpad data should use namespaces prefixed with underscore, like '_foo'.683 *684 * If no parameter provided, the entire scratchpad will be returned.685 * If only namespace provided, the scratchpad with the namespace will be returned.686 *687 * @param namespace A namespace string.688 * @param value The value to set at the specified namespace.689 */690 scratch(namespace?: string): Scratchpad;691 scratch(namespace: string, value: any): this;692 693 /**694 * Remove scratchpad data. You should remove scratchpad data only at your own namespaces.695 * http://js.cytoscape.org/#cy.removeScratch696 *697 * @param namespace A namespace string.698 */699 removeScratch(namespace: string): this;700 }701 702 /**703 * The principle events from the graph model.704 * http://js.cytoscape.org/#core/events705 */706 interface CoreEvents {707 /**708 * Bind to events that occur in the graph.709 *710 * @param events A space separated list of event names.711 * @param handler The handler function that is called when one of the specified events occurs.712 * @param selector A selector to specify elements for which the handler is triggered.713 * @param data A plain object which is passed to the handler in the event object argument.714 * @param eventsMap A map of event names to handler functions.715 */716 717 on(events: EventNames, handler: EventHandler): this;718 on(events: EventNames, selector: Selector, handler: EventHandler): this;719 on(events: EventNames, selector: Selector, data: any, handler: EventHandler): this;720 on(eventsMap: { [value: string]: EventHandler }, selector?: Selector, data?: any): this;721 722 bind(events: EventNames, handler: EventHandler): this;723 bind(events: EventNames, selector: Selector, handler: EventHandler): this;724 bind(events: EventNames, selector: Selector, data: any, handler: EventHandler): this;725 bind(eventsMap: { [value: string]: EventHandler }, selector?: Selector, data?: any): this;726 727 listen(events: EventNames, handler: EventHandler): this;728 listen(events: EventNames, selector: Selector, handler: EventHandler): this;729 listen(events: EventNames, selector: Selector, data: any, handler: EventHandler): this;730 listen(eventsMap: { [value: string]: EventHandler }, selector?: Selector, data?: any): this;731 732 addListener(events: EventNames, handler: EventHandler): this;733 addListener(events: EventNames, selector: Selector, handler: EventHandler): this;734 addListener(events: EventNames, selector: Selector, data: any, handler: EventHandler): this;735 addListener(eventsMap: { [value: string]: EventHandler }, selector?: Selector, data?: any): this;736 737 /**738 * Get a promise that is resolved with the first739 * of any of the specified events triggered on the graph.740 * @param events A space separated list of event names.741 * @param selector [optional] A selector to specify elements for which the handler is triggered.742 */743 promiseOn(events: EventNames, selector?: Selector): Promise<EventHandler>;744 pon(events: EventNames, selector?: Selector): Promise<EventHandler>;745 /**746 * Bind to events that occur in the graph, and trigger the handler only once.747 *748 * @param events A space separated list of event names.749 * @param handler The handler function that is called when one of the specified events occurs.750 */751 one(events: EventNames, handler: EventHandler): this;752 /**753 * Bind to events that occur in the graph, and trigger the handler only once.754 *755 * @param events A space separated list of event names.756 * @param handler The handler function that is called when one of the specified events occurs.757 * @param selector A selector to specify elements for which the handler is triggered.758 */759 one(events: EventNames, selector: Selector, handler: EventHandler): this;760 /**761 * Bind to events that occur in the graph, and trigger the handler only once.762 *763 * @param events A space separated list of event names.764 * @param handler The handler function that is called when one of the specified events occurs.765 * @param selector A selector to specify elements for which the handler is triggered.766 * @param data A plain object which is passed to the handler in the event object argument.767 */768 one(events: EventNames, selector: Selector, data: any, handler: EventHandler): this;769 /**770 * Bind to events that occur in the graph, and trigger the handler only once.771 *772 * @param eventsMap A map of event names to handler functions.773 * @param selector A selector to specify elements for which the handler is triggered.774 * @param data A plain object which is passed to the handler in the event object argument.775 */776 one(eventsMap: { [value: string]: EventHandler }, selector?: Selector, data?: any): this;777 778 /**779 * Remove event handlers.780 * http://js.cytoscape.org/#cy.off781 *782 * @param events A space separated list of event names.783 * @param selector [optional] The same selector used to bind to the events.784 * @param handler [optional] A reference to the handler function to remove.785 * @param eventsMap A map of event names to handler functions to remove.786 */787 off(events: EventNames, handler?: EventHandler): this;788 off(events: EventNames, selector: Selector, handler?: EventHandler): this;789 off(eventsMap: { [value: string]: EventHandler }, selector?: Selector): this;790 791 unbind(events: EventNames, handler?: EventHandler): this;792 unbind(events: EventNames, selector: Selector, handler?: EventHandler): this;793 unbind(eventsMap: { [value: string]: EventHandler }, selector?: Selector): this;794 795 unlisten(events: EventNames, handler?: EventHandler): this;796 unlisten(events: EventNames, selector: Selector, handler?: EventHandler): this;797 unlisten(eventsMap: { [value: string]: EventHandler }, selector?: Selector): this;798 799 removeListener(events: EventNames, handler?: EventHandler): this;800 removeListener(events: EventNames, selector: Selector | undefined, handler?: EventHandler): this;801 removeListener(eventsMap: { [value: string]: EventHandler }, selector?: Selector): this;802 803 /**804 * Remove all event handlers.805 * https://js.cytoscape.org/#cy.removeAllListeners806 */807 removeAllListeners(): this;808 809 /**810 * Trigger one or more events.811 *812 * @param events A space separated list of event names to trigger.813 * @param extraParams [optional] An array of additional parameters to pass to the handler.814 */815 trigger(events: EventNames, extraParams?: any[]): this;816 emit(events: EventNames, extraParams?: any[]): this;817 818 /**819 * Run a callback as soon as the graph becomes ready. If the graph is already ready, then the callback is called immediately.820 * @param fn The callback run as soon as the graph is ready, inside which this refers to the core (cy).821 */822 ready(fn: EventHandler): this;823 }824 825 interface ZoomOptionsModel {826 /** The position about which to zoom. */827 position: Position;828 }829 interface ZoomOptionsRendered {830 /** The rendered position about which to zoom. */831 renderedPosition: Position;832 }833 interface ZoomOptionsLevel {834 /** The zoom level to set. */835 level: number;836 }837 type ZoomOptions = number | (ZoomOptionsLevel & (ZoomOptionsModel | ZoomOptionsRendered));838 839 /**840 * http://js.cytoscape.org/#core/viewport-manipulation841 */842 interface CoreViewportManipulation {843 /**844 * Get the HTML DOM element in which the graph is visualised.845 * A null value is returned if the Core is headless.846 */847 container(): HTMLElement | null;848 849 /**850 * Pan the graph to the centre of a collection.851 *852 * @param eles The collection to centre upon.853 */854 center(eles?: CollectionArgument): this;855 856 /**857 * Pan the graph to the centre of a collection.858 *859 * @param eles The collection to centre upon.860 */861 centre(eles?: CollectionArgument): this;862 863 /**864 * Pan and zooms the graph to fit to a collection.865 * http://js.cytoscape.org/#cy.fit866 *867 * @param eles [optional] The collection to fit to.868 * @param padding [optional] An amount of padding (in pixels) to have around the graph869 */870 fit(eles?: CollectionArgument | Selector, padding?: number): this;871 872 /**873 * Reset the graph to the default zoom level and panning position.874 * http://js.cytoscape.org/#cy.reset875 */876 reset(): this;877 878 /**879 * Get the panning position of the graph.880 * http://js.cytoscape.org/#cy.pan881 */882 pan(): Position;883 884 /**885 * Set the panning position of the graph.886 * http://js.cytoscape.org/#cy.pan887 *888 * @param renderedPosition The rendered position to pan the graph to.889 */890 pan(renderedPosition?: Position): this;891 892 /**893 * Relatively pan the graph by a specified rendered position vector.894 * http://js.cytoscape.org/#cy.panBy895 *896 * @param renderedPosition The rendered position vector to pan the graph by.897 */898 panBy(renderedPosition: Position): this;899 900 /**901 * Get whether panning is enabled.902 * If cy.boxSelectionEnabled() === true, then the user903 * must taphold to initiate panning.904 * http://js.cytoscape.org/#cy.panningEnabled905 */906 panningEnabled(): boolean;907 908 /**909 * Set whether panning is enabled. If cy.boxSelectionEnabled() === true, then the user must taphold to initiate panning.910 * http://js.cytoscape.org/#cy.panningEnabled911 *912 * @param bool A truthy value enables panning; a falsey value disables it.913 */914 panningEnabled(bool?: boolean): this;915 916 /**917 * Get whether panning by user events (e.g. dragging the graph background) is enabled. If cy.boxSelectionEnabled() === true, then the user must taphold to initiate panning.918 * http://js.cytoscape.org/#cy.userPanningEnabled919 */920 userPanningEnabled(): boolean;921 922 /**923 * Set whether panning by user events (e.g. dragging the graph background) is enabled. If cy.boxSelectionEnabled() === true, then the user must taphold to initiate panning.924 * http://js.cytoscape.org/#cy.userPanningEnabled925 *926 * @param bool A truthy value enables user panning; a falsey value disables it.927 */928 userPanningEnabled(bool?: boolean): this;929 /**930 * Get the zoom level.931 * http://js.cytoscape.org/#cy.zoom932 */933 zoom(): number;934 /**935 * Set the zoom level.936 * http://js.cytoscape.org/#cy.zoom937 *938 * @param level The zoom level to set.939 * @param options The options for zooming.940 */941 zoom(level?: number | ZoomOptions): this;942 943 /**944 * Set or get whether zooming is enabled. Get if no parameter provided.945 * http://js.cytoscape.org/#cy.zoomingEnabled946 *947 * @param bool A truthy value enables zooming; a falsey value disables it.948 */949 zoomingEnabled(bool?: boolean): this;950 951 /**952 * Get whether zooming by user events (e.g. mouse wheel, pinch-to-zoom)953 * is enabled.954 * http://js.cytoscape.org/#cy.userZoomingEnabled955 */956 userZoomingEnabled(): boolean;957 /**958 * Get or set whether zooming by user events get if no parameter provided959 * (e.g. mouse wheel, pinch-to-zoom) is enabled.960 * http://js.cytoscape.org/#cy.userZoomingEnabled961 *962 * @param bool A truthy value enables user zooming; a falsey value disables it.963 */964 userZoomingEnabled(bool?: boolean): this;965 966 /**967 * Get the minimum zoom level.968 * http://js.cytoscape.org/#cy.minZoom969 */970 minZoom(): number;971 /**972 * Set the minimum zoom level.973 * http://js.cytoscape.org/#cy.minZoom974 *975 * @param zoom The new minimum zoom level to use.976 */977 minZoom(zoom: number): this;978 979 /**980 * Get the maximum zoom level.981 * http://js.cytoscape.org/#cy.maxZoom982 */983 maxZoom(): number;984 /**985 * Set the maximum zoom level.986 * http://js.cytoscape.org/#cy.maxZoom987 *988 * @param zoom The new maximum zoom level to use.989 */990 maxZoom(zoom: number): this;991 992 /**993 * Set the viewport state (pan & zoom) in one call.994 * http://js.cytoscape.org/#cy.viewport995 *996 * @param options The viewport options.997 * @param options.zoom The zoom level to set.998 * @param options.pan The pan to set (a rendered position).999 */1000 viewport(options: { zoom: number; pan: Position }): this;1001 1002 /**1003 * gets the viewport state (pan & zoom) in one call.1004 * http://js.cytoscape.org/#cy.viewport1005 *1006 */1007 getFitViewport(): {1008 zoom: number;1009 pan: Position;1010 };1011 1012 /**1013 * Get whether box selection is enabled.1014 * If enabled, the user must hold left-click to initiate panning.1015 * http://js.cytoscape.org/#cy.boxSelectionEnabled1016 */1017 boxSelectionEnabled(): boolean;1018 /**1019 * Set whether box selection is enabled.1020 * If enabled, the user must hold left-click to initiate panning.1021 * http://js.cytoscape.org/#cy.boxSelectionEnabled1022 *1023 * @param bool A truthy value enables box selection; a falsey value disables it.1024 */1025 boxSelectionEnabled(bool?: boolean): this;1026 1027 /**1028 * Get the selection type.1029 * http://js.cytoscape.org/#cy.selectionType1030 */1031 selectionType(): SelectionType;1032 /**1033 * Set the selection type.1034 * http://js.cytoscape.org/#cy.selectionType1035 *1036 * @param type The selection type string; one of 'single' (default) or 'additive'.1037 */1038 selectionType(type: SelectionType): this;1039 1040 /**1041 * Get the on-screen width of the viewport in pixels.1042 * http://js.cytoscape.org/#cy.width1043 */1044 width(): number;1045 1046 /**1047 * Get the on-screen height of the viewport in pixels.1048 * http://js.cytoscape.org/#cy.height1049 */1050 height(): number;1051 1052 /**1053 * Get the extent of the viewport, a bounding box in model1054 * coordinates that lets you know what model1055 * positions are visible in the viewport.1056 * http://js.cytoscape.org/#cy.extent1057 */1058 extent(): BoundingBox;1059 1060 /**1061 * Get the rendered extent of the viewport, a bounding box in rendered1062 * coordinates that lets you know what rendered1063 * positions are visible in the viewport.1064 * http://js.cytoscape.org/#cy.renderedExtent1065 */1066 renderedExtent(): BoundingBox;1067 1068 /**1069 * Get whether nodes are automatically locked1070 * (i.e. if true, nodes are locked despite their individual state).1071 * http://js.cytoscape.org/#cy.autolock1072 */1073 autolock(): boolean;1074 /**1075 * Set whether nodes are automatically locked1076 * (i.e. if true, nodes are locked despite their individual state).1077 * http://js.cytoscape.org/#cy.autolock1078 *1079 * @param bool A truthy value enables autolocking; a falsey value disables it.1080 */1081 autolock(bool?: boolean): this;1082 1083 /**1084 * Get whether nodes are automatically ungrabified1085 * (i.e. if true, nodes are ungrabbale despite their individual state).1086 * http://js.cytoscape.org/#cy.autoungrabify1087 */1088 autoungrabify(): boolean;1089 /**1090 * Set whether nodes are automatically ungrabified1091 * (i.e. if true, nodes are ungrabbale despite their individual state).1092 * http://js.cytoscape.org/#cy.autoungrabify1093 *1094 * @param bool A truthy value enables autolocking; a falsey value disables it.1095 */1096 autoungrabify(bool?: boolean): this;1097 1098 /**1099 * Get whether nodes are automatically unselectified1100 * (i.e. if true, nodes are unselectable despite their individual state).1101 * http://js.cytoscape.org/#cy.autounselectify1102 */1103 autounselectify(): boolean;1104 /**1105 * Set whether nodes are automatically unselectified1106 * (i.e. if true, nodes are unselectable despite their individual state).1107 * http://js.cytoscape.org/#cy.autounselectify1108 *1109 * @param bool A truthy value enables autolocking; a falsey value disables it.1110 */1111 autounselectify(bool?: boolean): this;1112 1113 /**1114 * Force the renderer to redraw (i.e. draw a new frame).1115 *1116 * This function forces the renderer to draw a new frame.1117 * It is useful for very specific edgecases, such as in certain UI plugins,1118 * but it should not be needed for most developers.1119 * http://js.cytoscape.org/#cy.forceRender1120 */1121 forceRender(): this;1122 1123 /**1124 * Force the renderer to recalculate the viewport bounds.1125 *1126 * If your code resizes the graph's dimensions or position1127 * (i.e. by changing the style of the HTML DOM element that holds the graph),1128 * you will want to call cy.resize() to have the graph resize and redraw itself.1129 *1130 * Cytoscape.js can not automatically monitor the bounding box of the viewport,1131 * as querying the DOM for those dimensions can be expensive.1132 * Although cy.resize() is automatically called for you on the window's resize event,1133 * there is no resize or style event for arbitrary DOM elements.1134 * http://js.cytoscape.org/#cy.resize1135 */1136 resize(): this;1137 invalidateDimensions(): this;1138 }1139 1140 /**1141 * http://js.cytoscape.org/#core/animation1142 */1143 interface AnimationFitOptions {1144 eles: CollectionArgument | Selector; // to which the viewport will be fitted.1145 padding: number; // Padding to use with the fitting.1146 }1147 interface CenterOptions {1148 eles: CollectionArgument | Selector; // to which the viewport will be selected.1149 }1150 interface AnimationOptions {1151 /** A zoom level to which the graph will be animated. */1152 zoom?: ZoomOptions;1153 /** A panning position to which the graph will be animated. */1154 pan?: Position;1155 /** A relative panning position to which the graph will be animated. */1156 panBy?: Position;1157 /** An object containing fitting options from which the graph will be animated. */1158 fit?: AnimationFitOptions;1159 /** An object containing centring options from which the graph will be animated. */1160 center?: CenterOptions;1161 /** easing - A transition-timing-function easing style string that shapes the animation progress curve. */1162 easing?: Css.TransitionTimingFunction;1163 1164 /** duration - The duration of the animation in milliseconds. */1165 duration?: number;1166 }1167 interface AnimateOptions extends AnimationOptions {1168 /** queue - A boolean indicating whether to queue the animation. */1169 queue?: boolean;1170 /** complete - A function to call when the animation is done. */1171 complete?(): void;1172 /** step - A function to call each time the animation steps. */1173 step?(): void;1174 }1175 1176 interface CoreAnimation {1177 /**1178 * Get whether the viewport is currently being animated.1179 * http://js.cytoscape.org/#cy.animated1180 */1181 animated(): boolean;1182 1183 /**1184 * Animate the viewport.1185 * http://js.cytoscape.org/#cy.animate1186 *1187 * @param anis An object containing the details of the animation.1188 *1189 * @param options An object containing animation options.1190 */1191 animate(anis: AnimateOptions, options?: AnimateOptions): Core;1192 1193 /**1194 * Get an animation of the viewport.1195 * http://js.cytoscape.org/#cy.animation1196 */1197 animation(options: AnimationOptions): AnimationManipulation;1198 1199 /**1200 * Add a delay between animations for the viewport.