265 lines
11 KiB
TypeScript
265 lines
11 KiB
TypeScript
import { Transform } from './Util.ts';
|
|
import { Node } from './Node.ts';
|
|
import { Container } from './Container.ts';
|
|
import { Stage } from './Stage.ts';
|
|
import { Layer } from './Layer.ts';
|
|
import { FastLayer } from './FastLayer.ts';
|
|
import { Group } from './Group.ts';
|
|
import { Shape } from './Shape.ts';
|
|
import { Animation } from './Animation.ts';
|
|
import { Tween } from './Tween.ts';
|
|
import { Context } from './Context.ts';
|
|
import { Canvas } from './Canvas.ts';
|
|
export declare const Konva: {
|
|
_global: any;
|
|
version: string;
|
|
isBrowser: boolean;
|
|
isUnminified: boolean;
|
|
dblClickWindow: number;
|
|
getAngle(angle: number): number;
|
|
enableTrace: boolean;
|
|
pointerEventsEnabled: boolean;
|
|
autoDrawEnabled: boolean;
|
|
hitOnDragEnabled: boolean;
|
|
capturePointerEventsEnabled: boolean;
|
|
_renderBackend: string;
|
|
legacyTextRendering: boolean;
|
|
pixelRatio: number;
|
|
dragDistance: number;
|
|
angleDeg: boolean;
|
|
showWarnings: boolean;
|
|
dragButtons: number[];
|
|
isDragging(): boolean;
|
|
isTransforming(): boolean;
|
|
isDragReady(): boolean;
|
|
releaseCanvasOnDestroy: boolean;
|
|
document: any;
|
|
_injectGlobal(Konva: any): void;
|
|
} & {
|
|
/**
|
|
* Defer automatic Konva.Transformer updates across many synchronous node changes
|
|
* and run them once when the returned function is called.
|
|
* A Transformer normally updates after every change of an attached node, so a loop
|
|
* over N selected nodes costs N updates, each measuring all N nodes. In a batch it costs one.
|
|
* A single setAttrs(), position(), destroyChildren(), removeChildren() call or animation frame is
|
|
* already batched; use this for anything else, for example a React commit or an undo.
|
|
* Attributes and change events stay synchronous. Inside the batch, the Transformer's own
|
|
* x(), y(), width(), height() and getClientRect() are computed on read; its anchors are laid out
|
|
* when the batch finishes, or earlier if something draws or measures them.
|
|
* Change events fire inside the batch, so a listener sees the new attributes and the
|
|
* Transformer's box, but not its anchors; call transformer.update() there if it needs them.
|
|
* Batches nest. Call the returned function in a finally block, and do not keep a batch
|
|
* open across an await or an animation frame.
|
|
* @method
|
|
* @name Konva.beginUpdateBatch
|
|
* @returns {Function} finishes the batch and runs the pending updates
|
|
* @example
|
|
* const finish = Konva.beginUpdateBatch();
|
|
* try {
|
|
* selectedNodes.forEach((node) => node.width(100));
|
|
* } finally {
|
|
* finish();
|
|
* }
|
|
*/
|
|
beginUpdateBatch: typeof Node._beginUpdateBatch;
|
|
Util: {
|
|
_isElement(obj: any): obj is Element;
|
|
_isFunction(obj: any): boolean;
|
|
_isPlainObject(obj: any): boolean;
|
|
_isArray(obj: any): obj is Array<any>;
|
|
_isNumber(obj: any): obj is number;
|
|
_isString(obj: any): obj is string;
|
|
_isBoolean(obj: any): obj is boolean;
|
|
isObject(val: any): val is object;
|
|
isValidSelector(selector: any): boolean;
|
|
_sign(number: number): 1 | -1;
|
|
requestAnimFrame(callback: Function, win?: Window | null): void;
|
|
createCanvasElement(): HTMLCanvasElement;
|
|
createImageElement(): HTMLImageElement;
|
|
_urlToImage(url: string, callback: Function, onError?: (error: Error) => void): void;
|
|
_rgbToHex(r: number, g: number, b: number): string;
|
|
_hexToRgb(hex: string): import("./types.ts").RGB;
|
|
getRandomColor(): string;
|
|
isCanvasFarblingActive(): boolean;
|
|
getHitColor(): string;
|
|
getHitColorKey(r: number, g: number, b: number): string;
|
|
getSnappedHexColor(hex: string): string;
|
|
getRGB(color: string): import("./types.ts").RGB;
|
|
colorToRGBA(str: string): {
|
|
r: number;
|
|
g: number;
|
|
b: number;
|
|
a: number;
|
|
} | undefined;
|
|
_namedColorToRBA(str: string): {
|
|
r: number;
|
|
g: number;
|
|
b: number;
|
|
a: number;
|
|
} | null;
|
|
_rgbColorToRGBA(str: string): {
|
|
r: number;
|
|
g: number;
|
|
b: number;
|
|
a: number;
|
|
} | undefined;
|
|
_hex8ColorToRGBA(str: string): {
|
|
r: number;
|
|
g: number;
|
|
b: number;
|
|
a: number;
|
|
} | undefined;
|
|
_hex6ColorToRGBA(str: string): {
|
|
r: number;
|
|
g: number;
|
|
b: number;
|
|
a: number;
|
|
} | undefined;
|
|
_hex4ColorToRGBA(str: string): {
|
|
r: number;
|
|
g: number;
|
|
b: number;
|
|
a: number;
|
|
} | undefined;
|
|
_hex3ColorToRGBA(str: string): {
|
|
r: number;
|
|
g: number;
|
|
b: number;
|
|
a: number;
|
|
} | undefined;
|
|
_hslColorToRGBA(str: string): {
|
|
r: number;
|
|
g: number;
|
|
b: number;
|
|
a: number;
|
|
} | undefined;
|
|
_getPointsRect(points: ArrayLike<number>): import("./types.ts").IRect;
|
|
haveIntersection(r1: import("./types.ts").IRect, r2: import("./types.ts").IRect): boolean;
|
|
cloneObject<Any>(obj: Any): Any;
|
|
_cloneValue(val: any): any;
|
|
cloneArray(arr: Array<any>): any[];
|
|
degToRad(deg: number): number;
|
|
radToDeg(rad: number): number;
|
|
_getRotation(radians: number): number;
|
|
_capitalize(str: string): string;
|
|
throw(str: string): never;
|
|
error(str: string): void;
|
|
warn(str: string): void;
|
|
_batchEvents(batch: ((run: () => void) => void) | undefined, run: () => void): void;
|
|
each(obj: object, func: Function): void;
|
|
_inRange(val: number, left: number, right: number): boolean;
|
|
_getProjectionToSegment(x1: any, y1: any, x2: any, y2: any, x3: any, y3: any): any[];
|
|
_getProjectionToLine(pt: import("./types.ts").Vector2d, line: Array<import("./types.ts").Vector2d>, isClosed: boolean): import("./types.ts").Vector2d;
|
|
_prepareArrayForTween(startArray: any, endArray: any, isClosed: any): number[];
|
|
_prepareToStringify<T>(obj: any, ancestors?: Set<object>): T;
|
|
_assign<T, U>(target: T, source: U): T & U;
|
|
_getEventType(type: string): "mouse" | "touch" | "pointer";
|
|
_getFirstPointerId(evt: any): any;
|
|
releaseCanvas(...canvases: HTMLCanvasElement[]): void;
|
|
_cornerRadii(cornerRadius: number | number[], width: number, height: number): [number, number, number, number];
|
|
drawRoundedRectPath(context: Context, width: number, height: number, cornerRadius: number | number[]): void;
|
|
drawRoundedPolygonPath(context: Context, points: import("./types.ts").Vector2d[], sides: number, radius: number, cornerRadius: number | number[]): void;
|
|
};
|
|
Transform: typeof Transform;
|
|
Node: typeof Node;
|
|
Container: typeof Container;
|
|
Stage: typeof Stage;
|
|
stages: Stage[];
|
|
Layer: typeof Layer;
|
|
FastLayer: typeof FastLayer;
|
|
Group: typeof Group;
|
|
DD: {
|
|
readonly isDragging: boolean;
|
|
readonly node: Node<import("./Node.ts").NodeConfig> | undefined;
|
|
_dragElements: Map<number, {
|
|
node: Node;
|
|
startPointerPos: import("./types.ts").Vector2d;
|
|
offset: import("./types.ts").Vector2d;
|
|
pointerId?: number;
|
|
pointerEventType?: Stage["_pointerEventType"];
|
|
lastPos?: import("./types.ts").Vector2d;
|
|
startEvent?: any;
|
|
dragStatus: "ready" | "dragging" | "stopped";
|
|
}>;
|
|
_listenToWindow(win: Window): void;
|
|
_batchEvents(callback: () => void, win?: Window): void;
|
|
_drag(evt: any, win?: Window): void;
|
|
_endDragBefore(evt?: any, win?: Window, only?: {
|
|
node: Node;
|
|
startPointerPos: import("./types.ts").Vector2d;
|
|
offset: import("./types.ts").Vector2d;
|
|
pointerId?: number;
|
|
pointerEventType?: Stage["_pointerEventType"];
|
|
lastPos?: import("./types.ts").Vector2d;
|
|
startEvent?: any;
|
|
dragStatus: "ready" | "dragging" | "stopped";
|
|
}): void;
|
|
_endDragAfter(evt: any, only?: {
|
|
node: Node;
|
|
startPointerPos: import("./types.ts").Vector2d;
|
|
offset: import("./types.ts").Vector2d;
|
|
pointerId?: number;
|
|
pointerEventType?: Stage["_pointerEventType"];
|
|
lastPos?: import("./types.ts").Vector2d;
|
|
startEvent?: any;
|
|
dragStatus: "ready" | "dragging" | "stopped";
|
|
}): void;
|
|
};
|
|
Shape: typeof Shape;
|
|
shapes: {
|
|
[key: string]: Shape<import("./Shape.ts").ShapeConfig>;
|
|
};
|
|
Animation: typeof Animation;
|
|
Tween: typeof Tween;
|
|
Easings: {
|
|
BackEaseIn(t: any, b: any, c: any, d: any): any;
|
|
BackEaseOut(t: any, b: any, c: any, d: any): any;
|
|
BackEaseInOut(t: any, b: any, c: any, d: any): any;
|
|
ElasticEaseIn(t: any, b: any, c: any, d: any, a: any, p: any): any;
|
|
ElasticEaseOut(t: any, b: any, c: any, d: any, a: any, p: any): any;
|
|
ElasticEaseInOut(t: any, b: any, c: any, d: any, a: any, p: any): any;
|
|
BounceEaseOut(t: any, b: any, c: any, d: any): any;
|
|
BounceEaseIn(t: any, b: any, c: any, d: any): any;
|
|
BounceEaseInOut(t: any, b: any, c: any, d: any): any;
|
|
EaseIn(t: any, b: any, c: any, d: any): any;
|
|
EaseOut(t: any, b: any, c: any, d: any): any;
|
|
EaseInOut(t: any, b: any, c: any, d: any): any;
|
|
StrongEaseIn(t: any, b: any, c: any, d: any): any;
|
|
StrongEaseOut(t: any, b: any, c: any, d: any): any;
|
|
StrongEaseInOut(t: any, b: any, c: any, d: any): any;
|
|
Linear(t: any, b: any, c: any, d: any): any;
|
|
};
|
|
Context: typeof Context;
|
|
Canvas: typeof Canvas;
|
|
};
|
|
export declare namespace Konva {
|
|
type Vector2d = import('./types.ts').Vector2d;
|
|
type IRect = import('./types.ts').IRect;
|
|
type GetSet<Type, This> = import('./types.ts').GetSet<Type, This>;
|
|
type Filter = import('./Node.ts').Filter;
|
|
type LineCap = import('./Shape.ts').LineCap;
|
|
type LineJoin = import('./Shape.ts').LineJoin;
|
|
type Node = import('./Node.ts').Node;
|
|
type NodeConfig = import('./Node.ts').NodeConfig;
|
|
type KonvaEventObject<EventType> = import('./Node.ts').KonvaEventObject<EventType>;
|
|
type KonvaPointerEvent = import('./PointerEvents.ts').KonvaPointerEvent;
|
|
type KonvaEventListener<This, EventType> = import('./Node.ts').KonvaEventListener<This, EventType>;
|
|
type Container = import('./Container.ts').Container<Node>;
|
|
type ContainerConfig = import('./Container.ts').ContainerConfig;
|
|
type Transform = import('./Util.ts').Transform;
|
|
type Context = import('./Context.ts').Context;
|
|
type Stage = import('./Stage.ts').Stage;
|
|
type StageConfig = import('./Stage.ts').StageConfig;
|
|
type Layer = import('./Layer.ts').Layer;
|
|
type LayerConfig = import('./Layer.ts').LayerConfig;
|
|
type FastLayer = import('./FastLayer.ts').FastLayer;
|
|
type Group = import('./Group.ts').Group;
|
|
type GroupConfig = import('./Group.ts').GroupConfig;
|
|
type Shape = import('./Shape.ts').Shape;
|
|
type ShapeConfig = import('./Shape.ts').ShapeConfig;
|
|
type Animation = import('./Animation.ts').Animation;
|
|
type Tween = import('./Tween.ts').Tween;
|
|
type TweenConfig = import('./Tween.ts').TweenConfig;
|
|
}
|
|
export default Konva;
|