import { Transform } from './Util.js'; import { SceneCanvas, Canvas } from './Canvas.js'; import { Container } from './Container.js'; import { GetSet, Vector2d, IRect } from './types.js'; import { Stage } from './Stage.js'; import { Context } from './Context.js'; import { Shape } from './Shape.js'; import { Layer } from './Layer.js'; export type Filter = (this: Node, imageData: ImageData) => void; type globalCompositeOperationType = '' | 'source-over' | 'source-in' | 'source-out' | 'source-atop' | 'destination-over' | 'destination-in' | 'destination-out' | 'destination-atop' | 'lighter' | 'copy' | 'xor' | 'multiply' | 'screen' | 'overlay' | 'darken' | 'lighten' | 'color-dodge' | 'color-burn' | 'hard-light' | 'soft-light' | 'difference' | 'exclusion' | 'hue' | 'saturation' | 'color' | 'luminosity'; export interface NodeConfig { [index: string]: any; x?: number; y?: number; width?: number; height?: number; visible?: boolean; listening?: boolean; id?: string; name?: string; opacity?: number; scale?: Vector2d; scaleX?: number; skewX?: number; skewY?: number; scaleY?: number; rotation?: number; rotationDeg?: number; offset?: Vector2d; offsetX?: number; offsetY?: number; draggable?: boolean; dragDistance?: number; dragBoundFunc?: (this: Node, pos: Vector2d) => Vector2d; preventDefault?: boolean; globalCompositeOperation?: globalCompositeOperationType; filters?: Array; } type NodeEventMap = GlobalEventHandlersEventMap & { [index: string]: any; }; export interface KonvaEventObject { type: string; target: Shape | Stage; evt: EventType; pointerId: number; currentTarget: Node; cancelBubble: boolean; child?: Node; } export type KonvaEventListener = (this: This, ev: KonvaEventObject) => void; export declare abstract class Node { _id: number; eventListeners: { [index: string]: Array<{ name: string; handler: Function; }>; }; attrs: any; index: number; _allEventListeners: null | Array; parent: Container | null; _cache: Map; _attachedDepsListeners: Map; _lastPos: Vector2d | null; _attrsAffectingSize: string[]; _batchingTransformChange: boolean; _needClearTransformCache: boolean; _filterUpToDate: boolean; _isUnderCache: boolean; nodeType: string; className: string; _dragEventId: number | null; _shouldFireChangeEvents: boolean; constructor(config?: Config); hasChildren(): boolean; _clearCache(attr?: string): void; _getCache(attr: string, privateGetter: Function): any; _calculate(name: string, deps: Array, getter: Function): any; _getCanvasCache(): any; _clearSelfAndDescendantCache(attr?: string): void; clearCache(): this; cache(config?: { x?: number; y?: number; width?: number; height?: number; drawBorder?: boolean; offset?: number; pixelRatio?: number; imageSmoothingEnabled?: boolean; hitCanvasPixelRatio?: number; }): this | undefined; isCached(): boolean; abstract drawScene(canvas?: Canvas, top?: Node, bufferCanvas?: Canvas): void; abstract drawHit(canvas?: Canvas, top?: Node): void; getClientRect(config?: { skipTransform?: boolean; skipShadow?: boolean; skipStroke?: boolean; relativeTo?: Container; }): { x: number; y: number; width: number; height: number; }; _transformedRect(rect: IRect, top?: Node | null): { x: number; y: number; width: number; height: number; }; _drawCachedSceneCanvas(context: Context): void; _drawCachedHitCanvas(context: Context): void; _getCachedSceneCanvas(): any; on(evtStr: K, handler: KonvaEventListener): void | this; off(evtStr?: string, callback?: Function): this; dispatchEvent(evt: any): this; addEventListener(type: string, handler: (e: Event) => void): this; removeEventListener(type: string): this; _delegate(event: string, selector: string, handler: (e: Event) => void): void; remove(): this; _clearCaches(): void; _remove(): void; destroy(): this; getAttr(attr: string): any; getAncestors(): Node[]; getAttrs(): Config & Record; setAttrs(config: any): this; isListening(): any; _isListening(relativeTo?: Node): boolean; isVisible(): any; _isVisible(relativeTo?: Node): boolean; shouldDrawHit(top?: Node, skipDragCheck?: boolean): any; show(): this; hide(): this; getZIndex(): number; getAbsoluteZIndex(): number; getDepth(): number; _batchTransformChanges(func: any): void; setPosition(pos: Vector2d): this; getPosition(): { x: number; y: number; }; getRelativePointerPosition(): { x: number; y: number; } | null; getAbsolutePosition(top?: Node): { x: number; y: number; }; setAbsolutePosition(pos: Vector2d): this; _setTransform(trans: any): void; _clearTransform(): { x: number; y: number; rotation: number; scaleX: number; scaleY: number; offsetX: number; offsetY: number; skewX: number; skewY: number; }; move(change: Vector2d): this; _eachAncestorReverse(func: any, top: any): void; rotate(theta: number): this; moveToTop(): boolean; moveUp(): boolean; moveDown(): boolean; moveToBottom(): boolean; setZIndex(zIndex: any): this; getAbsoluteOpacity(): any; _getAbsoluteOpacity(): number; moveTo(newContainer: any): this; toObject(): { attrs: Config & Record; className: string; children?: any[] | undefined; }; toJSON(): string; getParent(): Container> | null; findAncestors(selector: string | Function, includeSelf?: boolean, stopNode?: Node): Node[]; isAncestorOf(node: Node): boolean; findAncestor(selector: string | Function, includeSelf?: boolean, stopNode?: Container): Node; _isMatch(selector: string | Function): any; getLayer(): Layer | null; getStage(): Stage | null; _getStage(): Stage | null; fire(eventType: string, evt?: any, bubble?: boolean): this; getAbsoluteTransform(top?: Node | null): Transform; _getAbsoluteTransform(top?: Node): Transform; getAbsoluteScale(top?: Node): { x: number; y: number; }; getAbsoluteRotation(): number; getTransform(): Transform; _getTransform(): Transform; clone(obj?: any): any; _toKonvaCanvas(config: any): SceneCanvas; toCanvas(config?: any): HTMLCanvasElement; toDataURL(config?: { x?: number; y?: number; width?: number; height?: number; pixelRatio?: number; mimeType?: string; quality?: number; callback?: (str: string) => void; }): string; toImage(config?: { x?: number; y?: number; width?: number; height?: number; pixelRatio?: number; mimeType?: string; quality?: number; callback?: (img: HTMLImageElement) => void; }): Promise; toBlob(config?: { x?: number; y?: number; width?: number; height?: number; pixelRatio?: number; mimeType?: string; quality?: number; callback?: (blob: Blob | null) => void; }): Promise; setSize(size: any): this; getSize(): { width: number; height: number; }; getClassName(): string; getType(): string; getDragDistance(): number; _off(type: any, name?: any, callback?: any): void; _fireChangeEvent(attr: any, oldVal: any, newVal: any): void; addName(name: any): this; hasName(name: any): boolean; removeName(name: any): this; setAttr(attr: any, val: any): this; _requestDraw(): void; _setAttr(key: any, val: any): void; _setComponentAttr(key: any, component: any, val: any): void; _fireAndBubble(eventType: any, evt: any, compareShape?: any): void; _getProtoListeners(eventType: any): any; _fire(eventType: any, evt: any): void; draw(): this; _createDragElement(evt: any): void; startDrag(evt?: any, bubbleEvent?: boolean): void; _setDragPosition(evt: any, elem: any): void; stopDrag(evt?: any): void; setDraggable(draggable: any): void; isDragging(): boolean; _listenDrag(): void; _dragChange(): void; _dragCleanup(): void; isClientRectOnScreen(margin?: { x: number; y: number; }): boolean; preventDefault: GetSet; blue: GetSet; brightness: GetSet; contrast: GetSet; blurRadius: GetSet; luminance: GetSet; green: GetSet; alpha: GetSet; hue: GetSet; kaleidoscopeAngle: GetSet; kaleidoscopePower: GetSet; levels: GetSet; noise: GetSet; pixelSize: GetSet; red: GetSet; saturation: GetSet; threshold: GetSet; value: GetSet; dragBoundFunc: GetSet<(this: Node, pos: Vector2d, event: any) => Vector2d, this>; draggable: GetSet; dragDistance: GetSet; embossBlend: GetSet; embossDirection: GetSet; embossStrength: GetSet; embossWhiteLevel: GetSet; enhance: GetSet; filters: GetSet; position: GetSet; absolutePosition: GetSet; size: GetSet<{ width: number; height: number; }, this>; id: GetSet; listening: GetSet; name: GetSet; offset: GetSet; offsetX: GetSet; offsetY: GetSet; opacity: GetSet; rotation: GetSet; zIndex: GetSet; scale: GetSet; scaleX: GetSet; scaleY: GetSet; skew: GetSet; skewX: GetSet; skewY: GetSet; to: (params: AnimTo) => void; transformsEnabled: GetSet; visible: GetSet; width: number; height: GetSet; x: GetSet; y: GetSet; globalCompositeOperation: GetSet; static create(data: any, container?: any): any; static _createNode(obj: any, container?: any): any; } interface AnimTo extends NodeConfig { onFinish?: Function; onUpdate?: Function; duration?: number; } export {};