import { ILeaf, ICursorType, IAlign } from '../display/ILeaf' import { IRenderer, IRendererConfig } from '../renderer/IRenderer' import { IHitCanvas, ILeaferCanvas, ILeaferCanvasConfig, IHitCanvasConfig } from '../canvas/ILeaferCanvas' import { ILayouter, ILayouterConfig } from '../layouter/ILayouter' import { IFinder, ISelector, ISelectorConfig } from '../selector/ISelector' import { IInteraction, IInteractionCanvas, IInteractionConfig } from '../interaction/IInteraction' import { IWatcher, IWatcherConfig } from '../watcher/IWatcher' import { IAutoBounds, IBoundsData, IPointData, IScreenSizeData, IBounds, IClientPointData } from '../math/IMath' import { ICanvasManager } from '../canvas/ICanvasManager' import { IHitCanvasManager } from '../canvas/IHitCanvasManager' import { IEventListenerId } from '../event/IEventer' import { IFourNumber, IObject } from '../data/IData' import { IZoomView } from '../display/IView' import { IAppBase } from './IApp' import { ILeaferImage, ILeaferImageConfig } from '../image/ILeaferImage' import { ILeaferFilm, ILeaferFilmConfig } from '../image/ILeaferFilm' import { ILeaferVideo, ILeaferVideoConfig } from '../image/ILeaferVideo' import { IControl } from '../control/IControl' import { IFunction } from '../function/IFunction' import { ITransition } from '../animate/ITransition' import { ILeafMap } from '../data/IList' export type ILeaferType = 'draw' | 'block' | 'viewport' | 'editor' | 'design' | 'board' | 'document' | 'app' | 'website' | 'game' | 'player' | 'chart' | 'custom' // 应用场景类型 export type ILeaferMode = 'normal' | 'draw' | 'preview' // 交互模式 export interface ILeaferConfig extends IRendererConfig, ILeaferCanvasConfig, IInteractionConfig, ILayouterConfig { start?: boolean type?: ILeaferType mobile?: boolean realCanvas?: boolean grow?: boolean | 'box' | 'render' lazySpeard?: IFourNumber } export interface ILeaferAttrData { mode: ILeaferMode running: boolean created: boolean ready: boolean viewReady: boolean imageReady: boolean viewCompleted: boolean layoutLocked: boolean transforming: boolean readonly view: unknown canvas: ILeaferCanvas renderer: IRenderer watcher: IWatcher layouter: ILayouter selector?: ISelector interaction?: IInteraction canvasManager: ICanvasManager hitCanvasManager?: IHitCanvasManager autoLayout?: IAutoBounds lazyBounds: IBounds config: ILeaferConfig userConfig?: ILeaferConfig // @leafer-in/find cacheId?: boolean cacheInnerId?: boolean innerIdMap?: ILeafMap idMap?: ILeafMap readonly cursorPoint: IPointData readonly clientBounds: IBoundsData leafs: number isPullDown?: boolean isReachDottom?: boolean __eventIds: IEventListenerId[] __nextRenderWait: IFunction[] init(userConfig?: ILeaferConfig, parentApp?: IAppBase): void start(): void stop(): void unlockLayout(updateLayout?: boolean): void lockLayout(updateLayout?: boolean): void requestRender(change: boolean): void updateCursor(cursor?: ICursorType): void resize(size: IScreenSizeData): void waitReady(item: IFunction, bind?: IObject): void waitViewReady(item: IFunction, bind?: IObject): void waitViewCompleted(item: IFunction, bind?: IObject): void zoom(zoomType: IZoomType, optionsOrPadding?: IZoomOptions | IFourNumber, scroll?: 'x' | 'y' | boolean, transition?: ITransition): IBoundsData getValidMove(moveX: number, moveY: number, checkLimit?: boolean): IPointData getValidScale(changeScale: number): number getWorldPointByClient(clientPoint: IClientPointData, updateClient?: boolean): IPointData getPagePointByClient(clientPoint: IClientPointData, updateClient?: boolean): IPointData getClientPointByWorld(worldPoint: IPointData): IPointData updateClientBounds(): void receiveEvent(event: any): void } export type IZoomType = 'in' | 'out' | 'fit' | 'fit-width' | 'fit-height' | number | ILeaf | ILeaf[] | IBoundsData export interface IZoomOptions { padding?: IFourNumber scroll?: 'x' | 'y' | boolean transition?: ITransition origin?: IPointData | IAlign } export interface ILeaferBase extends IZoomView, IControl, ILeaferAttrData { readonly isApp: boolean readonly app: ILeaferBase parentApp?: IAppBase parent?: IAppBase } export interface ILeaferTypeCreator { list: ILeaferTypeList register(name: string, fn: ILeaferTypeFunction): void run(name: string, leafer: ILeaferBase): void } export interface ILeaferTypeFunction { (leafer: ILeaferBase): void } export interface ILeaferTypeList { [key: string]: ILeaferTypeFunction } export interface ICreator { image?(options?: ILeaferImageConfig): ILeaferImage film?(options?: ILeaferFilmConfig): ILeaferFilm video?(options?: ILeaferVideoConfig): ILeaferVideo canvas?(options?: ILeaferCanvasConfig, manager?: ICanvasManager): ILeaferCanvas hitCanvas?(options?: IHitCanvasConfig, manager?: ICanvasManager): IHitCanvas hitCanvasManager?(): IHitCanvasManager watcher?(target: ILeaf, options?: IWatcherConfig): IWatcher layouter?(target: ILeaf, options?: ILayouterConfig): ILayouter renderer?(target: ILeaf, canvas: ILeaferCanvas, options?: IRendererConfig): IRenderer selector?(target?: ILeaf, options?: ISelectorConfig): ISelector finder?(target?: ILeaf, options?: ISelectorConfig): IFinder interaction?(target: ILeaf, canvas: IInteractionCanvas, selector: ISelector, options?: IInteractionConfig): IInteraction editor?(options?: IObject, app?: IAppBase): ILeaf } export interface IUICreator { register(UI: IObject): void get(tag: string, data: IObject): IObject }