import { Constructor } from '@thegraid/common-lib'; import { DisplayObject, Stage } from '@thegraid/easeljs-module'; declare module "@thegraid/easeljs-module" { interface Container { removeChildType(type: Constructor, pred?: (dobj: T) => boolean): T[]; } interface EventDispatcher { dispatchEvent(type: string | Event | Object): boolean; dispatchEvent(type: string | Event | Object, bubbles?: boolean, cancelable?: boolean): boolean; on(type: string, listener: (eventObj: any, data?: any) => boolean, scope?: Object, once?: boolean, data?: any, useCapture?: boolean): Function; } } /** if no canvas, then disable MouseOver, DOMEvents, tick & tickChildren * @param canvasId a \ Element OR the DOM ID of a \ Element (or undefined for no canvas) */ export declare function makeStage(canvasId?: string | HTMLCanvasElement, tick?: boolean): Stage; export declare function textWidth(text: string, font_h: number, fontName?: string): number; /** * return length of longest Text(string, fontSpec) * @param items each item is string OR { text: string } * @param font_h * @param fontName * @returns length of longest Text(string, fontSpec(font_h, fontName)) */ export declare function maxTextWidth(items: (string | { text: string; })[], font_h: number, fontName?: string): number; /** * dispObj.stage.update(); on 'drawend' run afterFunc() * * Uses setTimeout(afterFunc, andWait) so browser can repaint, * and afterFunc will run in new task (vs the event dispatch) * * If (andWait === false) do NOT setTimeout. * @param dispObj any DisplayObject to find the stage. * @param afterFunc [] if supplied, invoke after stage updates. * @param scope [] thisArg for afterFunc * @param andWait [10] number then setTimeout(afterFunc, andWait) */ export declare function afterUpdate(dispObj: DisplayObject, afterFunc?: () => void, scope?: any, andWait?: false | number): void; /** async wrapper for afterUpdate */ export declare function awaitUpdate(cont: DisplayObject): Promise; /** dispObj.visible = false; awaitUpdate().then(setTimeout(dispObj.visible = true; after(), dwell)) */ export declare function blinkAndThen(dispObj: DisplayObject, after: () => void, dwell?: number): Promise; /** stopPropagation and stopImmediatePropagation */ export declare function stopPropagation(ev: any): void;