You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.7 KiB
45 lines
1.7 KiB
import type EventEmitter from '@antv/event-emitter';
|
|
import type { Graph } from '../../runtime/graph';
|
|
import type { RuntimeContext } from '../../runtime/types';
|
|
import type { IEvent } from '../../types';
|
|
import type { STDExtensionOption } from './types';
|
|
export declare abstract class ExtensionController<E extends BaseExtension<any>> {
|
|
protected context: RuntimeContext;
|
|
protected extensions: STDExtensionOption[];
|
|
protected extensionMap: Record<string, E>;
|
|
abstract category: 'plugin' | 'behavior' | 'transform';
|
|
constructor(context: RuntimeContext);
|
|
setExtensions(extensions: (string | {
|
|
type: string;
|
|
[keys: string]: unknown;
|
|
} | ((this: Graph) => {
|
|
type: string;
|
|
[keys: string]: unknown;
|
|
}))[]): void;
|
|
protected createExtension(extension: STDExtensionOption): void;
|
|
protected createExtensions(extensions: STDExtensionOption[]): void;
|
|
protected updateExtension(extension: STDExtensionOption): void;
|
|
protected updateExtensions(extensions: STDExtensionOption[]): void;
|
|
protected destroyExtension(key: string): void;
|
|
protected destroyExtensions(extensions: STDExtensionOption[]): void;
|
|
destroy(): void;
|
|
}
|
|
/**
|
|
* <zh/> 模块实例基类
|
|
*
|
|
* <en/> Base class for extension instance
|
|
*/
|
|
export declare class BaseExtension<T extends {
|
|
type: string;
|
|
key?: string;
|
|
[key: string]: unknown;
|
|
}> {
|
|
protected context: RuntimeContext;
|
|
protected options: Required<T>;
|
|
protected events: [EventEmitter | HTMLElement, string, (event: IEvent) => void][];
|
|
initialized: boolean;
|
|
destroyed: boolean;
|
|
constructor(context: RuntimeContext, options: Partial<T>);
|
|
update(options: Partial<T>): void;
|
|
destroy(): void;
|
|
}
|
|
|