@visactor/vrender-core
Version:
```typescript import { xxx } from '@visactor/vrender-core'; ```
37 lines (36 loc) • 2.66 kB
TypeScript
import { GraphicFactory } from '../factory/graphic-factory';
import type { IArc, IArcGraphicAttribute, IArea, IAreaGraphicAttribute, ICircle, ICircleGraphicAttribute, IGroup, IGroupGraphicAttribute, IImage, IImageGraphicAttribute, ILine, ILineGraphicAttribute, IPath, IPathGraphicAttribute, IPolygon, IPolygonGraphicAttribute, IRect, IRect3d, IRect3dGraphicAttribute, IRectGraphicAttribute, IRichText, IRichTextGraphicAttribute, IShadowRoot, ISymbol, ISymbolGraphicAttribute, IText, ITextGraphicAttribute, IWrapTextGraphicAttribute } from '../interface';
import type { IGraphic } from '../interface/graphic';
export type IGraphicCreateCallback<TGraphic extends IGraphic = IGraphic, TAttributes = any> = (attributes: TAttributes) => TGraphic;
declare class GraphicCreator {
store: Map<string, IGraphicCreateCallback>;
arc?: (attribute: IArcGraphicAttribute) => IArc;
area?: (attribute: IAreaGraphicAttribute) => IArea;
circle?: (attribute: ICircleGraphicAttribute) => ICircle;
group?: (attribute: IGroupGraphicAttribute) => IGroup;
image?: (attribute: IImageGraphicAttribute) => IImage;
line?: (attribute: ILineGraphicAttribute) => ILine;
path?: (attribute: IPathGraphicAttribute) => IPath;
rect?: (attribute: IRectGraphicAttribute) => IRect;
rect3d?: (attribute: IRect3dGraphicAttribute) => IRect3d;
symbol?: (attribute: ISymbolGraphicAttribute) => ISymbol;
text?: (attribute: ITextGraphicAttribute) => IText;
richtext?: (attribute: IRichTextGraphicAttribute) => IRichText;
polygon?: (attribute: IPolygonGraphicAttribute) => IPolygon;
shadowRoot?: (attribute: IGroupGraphicAttribute) => IShadowRoot;
wrapText?: (attribute: IWrapTextGraphicAttribute) => IText;
constructor();
registerStore(name: string, creator: IGraphicCreateCallback): void;
RegisterGraphicCreator(name: string, creator: IGraphicCreateCallback): void;
CreateGraphic<TGraphic extends IGraphic = IGraphic, TAttributes = any>(name: string, attributes: TAttributes): TGraphic | null;
}
export declare const GRAPHIC_REGISTRY_SYMBOL: unique symbol;
export interface IGraphicRegistryState {
graphicCreator: GraphicCreator;
graphicFactory: GraphicFactory;
}
export declare function getGraphicRegistryState(): IGraphicRegistryState;
export declare const graphicCreator: GraphicCreator;
export declare function registerGraphic<TGraphic extends IGraphic = IGraphic, TAttributes = any>(name: string, creator: IGraphicCreateCallback<TGraphic, TAttributes>): void;
export declare function createGraphic<TGraphic extends IGraphic = IGraphic, TAttributes = any>(name: string, attributes: TAttributes): TGraphic;
export {};