/** biome-ignore-all lint/complexity/noThisInStatic: <存量的问题biome修了运行的实际效果就变了,所以先忽略> */ import type { NonUndefined } from 'utility-types'; import { Basecoat, type KeyValue, type Size } from '../common'; import { Point, type PointLike, Rectangle } from '../geometry'; import type { Graph } from '../graph'; import { type AttrDefinitions, type CellAttrs, type ComplexAttrValue } from '../registry'; import type { CellView } from '../view'; import type { MarkupType } from '../view/markup'; import { Animation, AnimationManager, type AnimationPlaybackEvent, type KeyframeEffectOptions } from './animation'; import type { ConnectorData, Edge, EdgeLabel, EdgeProperties, RouterData, TerminalData, TerminalType } from './edge'; import type { BatchName, Model } from './model'; import type { Node, NodeProperties, NodeSetOptions } from './node'; import type { Port } from './port'; import type { StoreMutateOptions, StoreSetByPathOptions, StoreSetOptions } from './store'; import { Store } from './store'; export declare class Cell extends Basecoat { static toStringTag: string; static isCell(instance: any): instance is Cell; static normalizeTools(raw: ToolsLoose): Tools; static getCommonAncestor(...cells: (Cell | null | undefined)[]): Cell | null; static getCellsBBox(cells: Cell[], options?: CellGetCellsBBoxOptions): Rectangle; static deepClone(cell: Cell): KeyValue>; static cloneCells(cells: Cell[]): KeyValue>; protected static markup: MarkupType; protected static defaults: CellDefaults; protected static attrHooks: AttrDefinitions; protected static propHooks: CellPropHook[]; static config(presets: C): void; static getMarkup(): MarkupType; static getDefaults(raw?: boolean): T; static getAttrHooks(): AttrDefinitions; static applyPropHooks(cell: Cell, metadata: CellMetadata): CellMetadata; static generateId(metadata?: CellMetadata): string; protected get [Symbol.toStringTag](): string; readonly id: string; protected readonly store: Store; protected readonly animationManager: AnimationManager; protected _model: Model | null; protected _parent: Cell | null; protected _children: Cell[] | null; constructor(metadata?: CellMetadata); init(): void; get model(): Model | null; set model(model: Model | null); protected preprocess(metadata: CellMetadata, ignoreIdCheck?: boolean): Properties; protected postprocess(metadata: CellMetadata): void; protected setup(): void; notify(name: Key, args: CellBaseEventArgs[Key]): this; notify(name: Exclude, args: any): this; isNode(): this is Node; isEdge(): this is Edge; isSameStore(cell: Cell): boolean; get view(): string; get shape(): string; getProp(): Properties; getProp(key: K): Properties[K]; getProp(key: K, defaultValue: Properties[K]): NonUndefined; getProp(key: string): T; getProp(key: string, defaultValue: T): T; setProp(key: K, value: Properties[K] | null | undefined | void, options?: CellSetOptions): this; setProp(key: string, value: any, options?: CellSetOptions): this; setProp(props: Partial, options?: CellSetOptions): this; removeProp(key: K | K[], options?: CellSetOptions): this; removeProp(key: string | string[], options?: CellSetOptions): this; removeProp(options?: CellSetOptions): this; hasChanged(): boolean; hasChanged(key: K | null): boolean; hasChanged(key: string | null): boolean; getPropByPath(path: string | string[]): T; setPropByPath(path: string | string[], value: any, options?: SetByPathOptions): this; removePropByPath(path: string | string[], options?: CellSetOptions): this; prop(): Properties; prop(key: K): Properties[K]; prop(key: string): T; prop(path: string[]): T; prop(key: K, value: Properties[K] | null | undefined | void, options?: CellSetOptions): this; prop(key: string, value: any, options?: CellSetOptions): this; prop(path: string[], value: any, options?: CellSetOptions): this; prop(props: Partial, options?: CellSetOptions): this; previous(name: K): Properties[K] | undefined; previous(name: string): T | undefined; get zIndex(): number | undefined | null; set zIndex(z: number | undefined | null); getZIndex(): number; setZIndex(z: number, options?: CellSetOptions): this; removeZIndex(options?: CellSetOptions): this; toFront(options?: ToFrontOptions): this; toBack(options?: ToBackOptions): this; get markup(): MarkupType | undefined | null; set markup(value: MarkupType | undefined | null); getMarkup(): MarkupType; setMarkup(markup: MarkupType, options?: CellSetOptions): this; removeMarkup(options?: CellSetOptions): this; get attrs(): CellAttrs | null | undefined; set attrs(value: CellAttrs | null | undefined); getAttrs(): { [selector: string]: import("../registry").ComplexAttrs; }; setAttrs(attrs: CellAttrs | null | undefined, options?: SetAttrOptions): this; replaceAttrs(attrs: CellAttrs, options?: CellSetOptions): this; updateAttrs(attrs: CellAttrs, options?: CellSetOptions): this; removeAttrs(options?: CellSetOptions): this; getAttrDefinition(attrName: string): import("../registry").AttrDefinition; getAttrByPath(): CellAttrs; getAttrByPath(path: string | string[]): T; setAttrByPath(path: string | string[], value: ComplexAttrValue, options?: CellSetOptions): this; removeAttrByPath(path: string | string[], options?: CellSetOptions): this; protected prefixAttrPath(path: string | string[]): string | string[]; attr(): CellAttrs; attr(path: string | string[]): T; attr(path: string | string[], value: ComplexAttrValue | null, options?: CellSetOptions): this; attr(attrs: CellAttrs, options?: SetAttrOptions): this; get visible(): boolean; set visible(value: boolean); setVisible(visible: boolean, options?: CellSetOptions): this; isVisible(): boolean; show(options?: CellSetOptions): this; hide(options?: CellSetOptions): this; toggleVisible(visible: boolean, options?: CellSetOptions): this; toggleVisible(options?: CellSetOptions): this; get data(): Properties['data']; set data(val: Properties['data']); getData(): T; setData(data: T, options?: SetDataOptions): this; replaceData(data: T, options?: CellSetOptions): this; updateData(data: T, options?: CellSetOptions): this; removeData(options?: CellSetOptions): this; get parent(): Cell | null; get children(): Cell[]; getParentId(): string; getParent(): T | null; getChildren(): Cell[]; hasParent(): boolean; isParentOf(child: Cell | null): boolean; isChildOf(parent: Cell | null): boolean; eachChild(iterator: (child: Cell, index: number, children: Cell[]) => void, context?: any): this; filterChild(filter: (cell: Cell, index: number, arr: Cell[]) => boolean, context?: any): Cell[]; getChildCount(): number; getChildIndex(child: Cell): number; getChildAt(index: number): Cell; getAncestors(options?: { deep?: boolean; }): Cell[]; getDescendants(options?: CellGetDescendantsOptions): Cell[]; isDescendantOf(ancestor: Cell | null, options?: { deep?: boolean; }): boolean; isAncestorOf(descendant: Cell | null, options?: { deep?: boolean; }): boolean; contains(cell: Cell | null): boolean; getCommonAncestor(...cells: (Cell | null | undefined)[]): Cell | null; setParent(parent: Cell | null, options?: CellSetOptions): this; setChildren(children: Cell[] | null, options?: CellSetOptions): this; unembed(child: Cell, options?: CellSetOptions): this; embed(child: Cell, options?: CellSetOptions): this; addTo(model: Model, options?: CellSetOptions): this; addTo(graph: Graph, options?: CellSetOptions): this; addTo(parent: Cell, options?: CellSetOptions): this; insertTo(parent: Cell, index?: number, options?: CellSetOptions): this; addChild(child: Cell | null, options?: CellSetOptions): this; insertChild(child: Cell | null, index?: number, options?: CellSetOptions): this; removeFromParent(options?: CellRemoveOptions): this; removeChild(child: Cell, options?: CellRemoveOptions): Cell; removeChildAt(index: number, options?: CellRemoveOptions): Cell; remove(options?: CellRemoveOptions): this; animate(keyframes: Keyframe[] | PropertyIndexedKeyframes | null, options?: number | KeyframeAnimationOptions): Animation; getAnimations(): Animation[]; translate(tx: number, ty: number, options?: CellTranslateOptions): this; scale(sx: number, // eslint-disable-line sy: number, // eslint-disable-line origin?: Point | PointLike, // eslint-disable-line options?: NodeSetOptions): this; addTools(items: ToolItem | ToolItem[], options?: AddToolOptions): void; addTools(items: ToolItem | ToolItem[], name: string, options?: AddToolOptions): void; setTools(tools?: ToolsLoose | null, options?: CellSetOptions): this; getTools(): Tools | null; removeTools(options?: CellSetOptions): this; hasTools(name?: string): boolean; hasTool(name: string): boolean; removeTool(name: string, options?: CellSetOptions): this; removeTool(index: number, options?: CellSetOptions): this; getBBox(options?: { deep?: boolean; }): Rectangle; getConnectionPoint(edge: Edge, type: TerminalType): Point; toJSON(options?: CellToJSONOptions): this extends Node ? NodeProperties : this extends Edge ? EdgeProperties : Properties; clone(options?: CloneOptions): this extends Node ? Node : this extends Edge ? Edge : Cell; findView(graph: Graph): CellView | null; startBatch(name: BatchName, data?: KeyValue, model?: Model | null): this; stopBatch(name: BatchName, data?: KeyValue, model?: Model | null): this; batchUpdate(name: BatchName, execute: () => T, data?: KeyValue): T; dispose(): void; } export interface CellCommon { view?: string; shape?: string; markup?: MarkupType; attrs?: CellAttrs; zIndex?: number; visible?: boolean; data?: any; } export interface CellDefaults extends CellCommon { } export interface CellMetadata extends CellCommon, KeyValue { id?: string; tools?: ToolsLoose; animation?: AnimateParams[]; } export interface CellProperties extends CellDefaults, CellMetadata { parent?: string; children?: string[]; tools?: Tools; } type ToolItem = string | { name: string; args?: any; }; export interface Tools { name?: string | null; local?: boolean; items: ToolItem[]; } export type ToolsLoose = ToolItem | ToolItem[] | Tools; export interface CellSetOptions extends StoreSetOptions { } export interface CellMutateOptions extends StoreMutateOptions { } export interface CellRemoveOptions extends CellSetOptions { deep?: boolean; } export interface SetAttrOptions extends CellSetOptions { deep?: boolean; overwrite?: boolean; } export interface SetDataOptions extends CellSetOptions { deep?: boolean; overwrite?: boolean; } export interface SetByPathOptions extends StoreSetByPathOptions { } export interface ToFrontOptions extends CellSetOptions { deep?: boolean; } export interface ToBackOptions extends ToFrontOptions { } export interface CellTranslateOptions extends CellSetOptions { tx?: number; ty?: number; translateBy?: string | number; } export interface AddToolOptions extends CellSetOptions { reset?: boolean; local?: boolean; } export interface CellGetDescendantsOptions { deep?: boolean; breadthFirst?: boolean; } export interface CellToJSONOptions { diff?: boolean; } export interface CloneOptions { deep?: boolean; keepId?: boolean; } export interface KeyframeAnimationOptions extends KeyframeEffectOptions { id?: string; timeline?: AnimationTimeline | null; } export type AnimateParams = Parameters['animate']>; export interface CellBaseEventArgs { 'animation:finish': AnimationPlaybackEvent; 'animation:cancel': AnimationPlaybackEvent; 'change:*': ChangeAnyKeyArgs; 'change:attrs': CellChangeArgs; 'change:zIndex': CellChangeArgs; 'change:markup': CellChangeArgs; 'change:visible': CellChangeArgs; 'change:parent': CellChangeArgs; 'change:children': CellChangeArgs; 'change:tools': CellChangeArgs; 'change:view': CellChangeArgs; 'change:data': CellChangeArgs; 'change:size': NodeChangeArgs; 'change:angle': NodeChangeArgs; 'change:position': NodeChangeArgs; 'change:ports': NodeChangeArgs; 'change:portMarkup': NodeChangeArgs; 'change:portLabelMarkup': NodeChangeArgs; 'change:portContainerMarkup': NodeChangeArgs; 'ports:removed': { cell: Cell; node: Node; removed: Port[]; }; 'ports:added': { cell: Cell; node: Node; added: Port[]; }; 'change:source': EdgeChangeArgs; 'change:target': EdgeChangeArgs; 'change:terminal': EdgeChangeArgs & { type: TerminalType; }; 'change:router': EdgeChangeArgs; 'change:connector': EdgeChangeArgs; 'change:vertices': EdgeChangeArgs; 'change:labels': EdgeChangeArgs; 'change:defaultLabel': EdgeChangeArgs; 'vertexs:added': { cell: Cell; edge: Edge; added: PointLike[]; }; 'vertexs:removed': { cell: Cell; edge: Edge; removed: PointLike[]; }; 'labels:added': { cell: Cell; edge: Edge; added: EdgeLabel[]; }; 'labels:removed': { cell: Cell; edge: Edge; removed: EdgeLabel[]; }; 'batch:start': { name: BatchName; data: KeyValue; cell: Cell; }; 'batch:stop': { name: BatchName; data: KeyValue; cell: Cell; }; changed: { cell: Cell; options: CellMutateOptions; }; added: { cell: Cell; index: number; options: CellSetOptions; }; removed: { cell: Cell; index: number; options: CellRemoveOptions; }; } interface ChangeAnyKeyArgs { key: T; current: CellProperties[T]; previous: CellProperties[T]; options: CellMutateOptions; cell: Cell; } export interface CellChangeArgs { cell: Cell; current?: T; previous?: T; options: CellMutateOptions; } interface NodeChangeArgs extends CellChangeArgs { node: Node; } interface EdgeChangeArgs extends CellChangeArgs { edge: Edge; } export interface CellGetCellsBBoxOptions { deep?: boolean; } export type CellDefinition = typeof Cell; export type CellPropHook = (this: C, metadata: M) => M; export type PropHooks = KeyValue> | CellPropHook | CellPropHook[]; export interface CellConfig extends CellDefaults, KeyValue { constructorName?: string; overwrite?: boolean; propHooks?: PropHooks; attrHooks?: AttrDefinitions; } export {};