import { Component } from 'vue'; import { EditorHost } from '../core'; import { BasePlugin } from './base-plugin'; import { IGraphicElement } from './base'; export interface GraphicTypeRegistration { type: string; render: () => Component; createElement: () => IGraphicElement; iconComponent?: Component; typeDisplayName?: string; } export interface PropertyPanelRegistration { graphicTypes: string[]; render: () => Component; isCanvas?: boolean; isPublic?: boolean; } export declare abstract class GraphicPlugin extends BasePlugin { abstract graphicType: string; abstract graphicElement: new (host: EditorHost) => T; abstract shapeComponent: Component; /** * 当前图形自身的属性面板 Vue 组件。 * * 与 {@link shapeComponent} / {@link iconComponent} 风格一致: * 直接以组件引用声明,而非工厂函数。 * * 基类会在 `onActivate` 时自动 emit 等价的 `property-panel:registered` 事件: * - `graphicTypes = [this.graphicType]` * - `render = () => this.propertyPanel` * - `isCanvas = false` * - `isPublic = false` * * 如需注册自身以外的图形类型、注册多个面板、或 `isCanvas = true` / `isPublic = true`, * 请改用旧 {@link propertyPanels} 字段或在独立插件的 `onInstall` 手动 emit。 */ propertyPanel?: Component; /** * 属性面板注册列表(旧 API,多面板与逃生通道)。 * * @deprecated 请优先使用单数 {@link propertyPanel} 字段。本字段仅作为 * 「多面板 / 为其他 graphicType 注册 / `isCanvas = true` / `isPublic = true`」 * 场景下的逃生通道保留。新插件禁止使用本字段。 * * 基类 `onActivate` 仍按现有逻辑遍历本数组 emit `property-panel:registered`, * 因此同一插件同时声明 `propertyPanel` 与 `propertyPanels` 时两者都会被注册。 */ propertyPanels?: PropertyPanelRegistration[]; iconComponent?: Component; typeDisplayName?: string; protected onActivate(): void; protected onDeactivate(): void; }