konva 8.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1140 -0
- package/LICENSE +22 -0
- package/README.md +189 -0
- package/konva.js +18090 -0
- package/konva.min.js +12 -0
- package/lib/Animation.d.ts +24 -0
- package/lib/Animation.js +141 -0
- package/lib/Canvas.d.ts +32 -0
- package/lib/Canvas.js +107 -0
- package/lib/Container.d.ts +47 -0
- package/lib/Container.js +318 -0
- package/lib/Context.d.ts +76 -0
- package/lib/Context.js +520 -0
- package/lib/Core.d.ts +3 -0
- package/lib/Core.js +3 -0
- package/lib/DragAndDrop.d.ts +17 -0
- package/lib/DragAndDrop.js +104 -0
- package/lib/Factory.d.ts +11 -0
- package/lib/Factory.js +117 -0
- package/lib/FastLayer.d.ts +4 -0
- package/lib/FastLayer.js +12 -0
- package/lib/Global.d.ts +30 -0
- package/lib/Global.js +53 -0
- package/lib/Group.d.ts +6 -0
- package/lib/Group.js +13 -0
- package/lib/Layer.d.ts +60 -0
- package/lib/Layer.js +301 -0
- package/lib/Node.d.ts +318 -0
- package/lib/Node.js +1381 -0
- package/lib/PointerEvents.d.ts +11 -0
- package/lib/PointerEvents.js +37 -0
- package/lib/Shape.d.ts +184 -0
- package/lib/Shape.js +515 -0
- package/lib/Stage.d.ts +85 -0
- package/lib/Stage.js +687 -0
- package/lib/Tween.d.ts +86 -0
- package/lib/Tween.js +516 -0
- package/lib/Util.d.ts +87 -0
- package/lib/Util.js +742 -0
- package/lib/Validators.d.ts +11 -0
- package/lib/Validators.js +171 -0
- package/lib/_CoreInternals.d.ts +144 -0
- package/lib/_CoreInternals.js +34 -0
- package/lib/_FullInternals.d.ts +188 -0
- package/lib/_FullInternals.js +78 -0
- package/lib/filters/Blur.d.ts +2 -0
- package/lib/filters/Blur.js +697 -0
- package/lib/filters/Brighten.d.ts +2 -0
- package/lib/filters/Brighten.js +12 -0
- package/lib/filters/Contrast.d.ts +2 -0
- package/lib/filters/Contrast.js +34 -0
- package/lib/filters/Emboss.d.ts +2 -0
- package/lib/filters/Emboss.js +102 -0
- package/lib/filters/Enhance.d.ts +2 -0
- package/lib/filters/Enhance.js +83 -0
- package/lib/filters/Grayscale.d.ts +2 -0
- package/lib/filters/Grayscale.js +9 -0
- package/lib/filters/HSL.d.ts +2 -0
- package/lib/filters/HSL.js +24 -0
- package/lib/filters/HSV.d.ts +2 -0
- package/lib/filters/HSV.js +24 -0
- package/lib/filters/Invert.d.ts +2 -0
- package/lib/filters/Invert.js +8 -0
- package/lib/filters/Kaleidoscope.d.ts +2 -0
- package/lib/filters/Kaleidoscope.js +132 -0
- package/lib/filters/Mask.d.ts +2 -0
- package/lib/filters/Mask.js +140 -0
- package/lib/filters/Noise.d.ts +2 -0
- package/lib/filters/Noise.js +12 -0
- package/lib/filters/Pixelate.d.ts +2 -0
- package/lib/filters/Pixelate.js +60 -0
- package/lib/filters/Posterize.d.ts +2 -0
- package/lib/filters/Posterize.js +10 -0
- package/lib/filters/RGB.d.ts +2 -0
- package/lib/filters/RGB.js +39 -0
- package/lib/filters/RGBA.d.ts +2 -0
- package/lib/filters/RGBA.js +49 -0
- package/lib/filters/Sepia.d.ts +2 -0
- package/lib/filters/Sepia.js +11 -0
- package/lib/filters/Solarize.d.ts +2 -0
- package/lib/filters/Solarize.js +25 -0
- package/lib/filters/Threshold.d.ts +2 -0
- package/lib/filters/Threshold.js +10 -0
- package/lib/index-node.d.ts +2 -0
- package/lib/index-node.js +18 -0
- package/lib/index-types.d.ts +179 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/shapes/Arc.d.ts +19 -0
- package/lib/shapes/Arc.js +35 -0
- package/lib/shapes/Arrow.d.ts +24 -0
- package/lib/shapes/Arrow.js +94 -0
- package/lib/shapes/Circle.d.ts +13 -0
- package/lib/shapes/Circle.js +33 -0
- package/lib/shapes/Ellipse.d.ts +16 -0
- package/lib/shapes/Ellipse.js +37 -0
- package/lib/shapes/Image.d.ts +23 -0
- package/lib/shapes/Image.js +100 -0
- package/lib/shapes/Label.d.ts +35 -0
- package/lib/shapes/Label.js +166 -0
- package/lib/shapes/Line.d.ts +28 -0
- package/lib/shapes/Line.js +155 -0
- package/lib/shapes/Path.d.ts +37 -0
- package/lib/shapes/Path.js +627 -0
- package/lib/shapes/Rect.d.ts +9 -0
- package/lib/shapes/Rect.js +42 -0
- package/lib/shapes/RegularPolygon.d.ts +22 -0
- package/lib/shapes/RegularPolygon.js +65 -0
- package/lib/shapes/Ring.d.ts +16 -0
- package/lib/shapes/Ring.js +33 -0
- package/lib/shapes/Sprite.d.ts +30 -0
- package/lib/shapes/Sprite.js +108 -0
- package/lib/shapes/Star.d.ts +17 -0
- package/lib/shapes/Star.js +38 -0
- package/lib/shapes/Text.d.ts +59 -0
- package/lib/shapes/Text.js +347 -0
- package/lib/shapes/TextPath.d.ts +54 -0
- package/lib/shapes/TextPath.js +343 -0
- package/lib/shapes/Transformer.d.ts +112 -0
- package/lib/shapes/Transformer.js +944 -0
- package/lib/shapes/Wedge.d.ts +17 -0
- package/lib/shapes/Wedge.js +38 -0
- package/lib/types.d.ts +50 -0
- package/lib/types.js +22 -0
- package/package.json +111 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare function RGBComponent(val: number): number;
|
|
2
|
+
export declare function alphaComponent(val: number): number;
|
|
3
|
+
export declare function getNumberValidator(): <T>(val: T, attr: string) => void | T;
|
|
4
|
+
export declare function getNumberOrArrayOfNumbersValidator(noOfElements: number): <T>(val: T, attr: string) => void | T;
|
|
5
|
+
export declare function getNumberOrAutoValidator(): <T extends string>(val: T, attr: string) => void | T;
|
|
6
|
+
export declare function getStringValidator(): (val: any, attr: string) => any;
|
|
7
|
+
export declare function getStringOrGradientValidator(): (val: any, attr: string) => any;
|
|
8
|
+
export declare function getFunctionValidator(): (val: any, attr: string) => any;
|
|
9
|
+
export declare function getNumberArrayValidator(): (val: any, attr: string) => any;
|
|
10
|
+
export declare function getBooleanValidator(): (val: any, attr: string) => any;
|
|
11
|
+
export declare function getComponentValidator(components: any): (val: any, attr: string) => any;
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { Konva } from './Global.js';
|
|
2
|
+
import { Util } from './Util.js';
|
|
3
|
+
function _formatValue(val) {
|
|
4
|
+
if (Util._isString(val)) {
|
|
5
|
+
return '"' + val + '"';
|
|
6
|
+
}
|
|
7
|
+
if (Object.prototype.toString.call(val) === '[object Number]') {
|
|
8
|
+
return val;
|
|
9
|
+
}
|
|
10
|
+
if (Util._isBoolean(val)) {
|
|
11
|
+
return val;
|
|
12
|
+
}
|
|
13
|
+
return Object.prototype.toString.call(val);
|
|
14
|
+
}
|
|
15
|
+
export function RGBComponent(val) {
|
|
16
|
+
if (val > 255) {
|
|
17
|
+
return 255;
|
|
18
|
+
}
|
|
19
|
+
else if (val < 0) {
|
|
20
|
+
return 0;
|
|
21
|
+
}
|
|
22
|
+
return Math.round(val);
|
|
23
|
+
}
|
|
24
|
+
export function alphaComponent(val) {
|
|
25
|
+
if (val > 1) {
|
|
26
|
+
return 1;
|
|
27
|
+
}
|
|
28
|
+
else if (val < 0.0001) {
|
|
29
|
+
return 0.0001;
|
|
30
|
+
}
|
|
31
|
+
return val;
|
|
32
|
+
}
|
|
33
|
+
export function getNumberValidator() {
|
|
34
|
+
if (Konva.isUnminified) {
|
|
35
|
+
return function (val, attr) {
|
|
36
|
+
if (!Util._isNumber(val)) {
|
|
37
|
+
Util.warn(_formatValue(val) +
|
|
38
|
+
' is a not valid value for "' +
|
|
39
|
+
attr +
|
|
40
|
+
'" attribute. The value should be a number.');
|
|
41
|
+
}
|
|
42
|
+
return val;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export function getNumberOrArrayOfNumbersValidator(noOfElements) {
|
|
47
|
+
if (Konva.isUnminified) {
|
|
48
|
+
return function (val, attr) {
|
|
49
|
+
let isNumber = Util._isNumber(val);
|
|
50
|
+
let isValidArray = Util._isArray(val) && val.length == noOfElements;
|
|
51
|
+
if (!isNumber && !isValidArray) {
|
|
52
|
+
Util.warn(_formatValue(val) +
|
|
53
|
+
' is a not valid value for "' +
|
|
54
|
+
attr +
|
|
55
|
+
'" attribute. The value should be a number or Array<number>(' +
|
|
56
|
+
noOfElements +
|
|
57
|
+
')');
|
|
58
|
+
}
|
|
59
|
+
return val;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
export function getNumberOrAutoValidator() {
|
|
64
|
+
if (Konva.isUnminified) {
|
|
65
|
+
return function (val, attr) {
|
|
66
|
+
var isNumber = Util._isNumber(val);
|
|
67
|
+
var isAuto = val === 'auto';
|
|
68
|
+
if (!(isNumber || isAuto)) {
|
|
69
|
+
Util.warn(_formatValue(val) +
|
|
70
|
+
' is a not valid value for "' +
|
|
71
|
+
attr +
|
|
72
|
+
'" attribute. The value should be a number or "auto".');
|
|
73
|
+
}
|
|
74
|
+
return val;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
export function getStringValidator() {
|
|
79
|
+
if (Konva.isUnminified) {
|
|
80
|
+
return function (val, attr) {
|
|
81
|
+
if (!Util._isString(val)) {
|
|
82
|
+
Util.warn(_formatValue(val) +
|
|
83
|
+
' is a not valid value for "' +
|
|
84
|
+
attr +
|
|
85
|
+
'" attribute. The value should be a string.');
|
|
86
|
+
}
|
|
87
|
+
return val;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
export function getStringOrGradientValidator() {
|
|
92
|
+
if (Konva.isUnminified) {
|
|
93
|
+
return function (val, attr) {
|
|
94
|
+
const isString = Util._isString(val);
|
|
95
|
+
const isGradient = Object.prototype.toString.call(val) === '[object CanvasGradient]' ||
|
|
96
|
+
(val && val.addColorStop);
|
|
97
|
+
if (!(isString || isGradient)) {
|
|
98
|
+
Util.warn(_formatValue(val) +
|
|
99
|
+
' is a not valid value for "' +
|
|
100
|
+
attr +
|
|
101
|
+
'" attribute. The value should be a string or a native gradient.');
|
|
102
|
+
}
|
|
103
|
+
return val;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
export function getFunctionValidator() {
|
|
108
|
+
if (Konva.isUnminified) {
|
|
109
|
+
return function (val, attr) {
|
|
110
|
+
if (!Util._isFunction(val)) {
|
|
111
|
+
Util.warn(_formatValue(val) +
|
|
112
|
+
' is a not valid value for "' +
|
|
113
|
+
attr +
|
|
114
|
+
'" attribute. The value should be a function.');
|
|
115
|
+
}
|
|
116
|
+
return val;
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
export function getNumberArrayValidator() {
|
|
121
|
+
if (Konva.isUnminified) {
|
|
122
|
+
return function (val, attr) {
|
|
123
|
+
if (!Util._isArray(val)) {
|
|
124
|
+
Util.warn(_formatValue(val) +
|
|
125
|
+
' is a not valid value for "' +
|
|
126
|
+
attr +
|
|
127
|
+
'" attribute. The value should be a array of numbers.');
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
val.forEach(function (item) {
|
|
131
|
+
if (!Util._isNumber(item)) {
|
|
132
|
+
Util.warn('"' +
|
|
133
|
+
attr +
|
|
134
|
+
'" attribute has non numeric element ' +
|
|
135
|
+
item +
|
|
136
|
+
'. Make sure that all elements are numbers.');
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
return val;
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
export function getBooleanValidator() {
|
|
145
|
+
if (Konva.isUnminified) {
|
|
146
|
+
return function (val, attr) {
|
|
147
|
+
var isBool = val === true || val === false;
|
|
148
|
+
if (!isBool) {
|
|
149
|
+
Util.warn(_formatValue(val) +
|
|
150
|
+
' is a not valid value for "' +
|
|
151
|
+
attr +
|
|
152
|
+
'" attribute. The value should be a boolean.');
|
|
153
|
+
}
|
|
154
|
+
return val;
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
export function getComponentValidator(components) {
|
|
159
|
+
if (Konva.isUnminified) {
|
|
160
|
+
return function (val, attr) {
|
|
161
|
+
if (!Util.isObject(val)) {
|
|
162
|
+
Util.warn(_formatValue(val) +
|
|
163
|
+
' is a not valid value for "' +
|
|
164
|
+
attr +
|
|
165
|
+
'" attribute. The value should be an object with properties ' +
|
|
166
|
+
components);
|
|
167
|
+
}
|
|
168
|
+
return val;
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { Transform } from './Util';
|
|
2
|
+
import { Node } from './Node';
|
|
3
|
+
import { Container } from './Container';
|
|
4
|
+
import { Stage } from './Stage';
|
|
5
|
+
import { Layer } from './Layer';
|
|
6
|
+
import { FastLayer } from './FastLayer';
|
|
7
|
+
import { Group } from './Group';
|
|
8
|
+
import { Shape } from './Shape';
|
|
9
|
+
import { Animation } from './Animation';
|
|
10
|
+
import { Tween } from './Tween';
|
|
11
|
+
import { Context } from './Context';
|
|
12
|
+
import { Canvas } from './Canvas';
|
|
13
|
+
export declare const Konva: {
|
|
14
|
+
_global: any;
|
|
15
|
+
version: string;
|
|
16
|
+
isBrowser: boolean;
|
|
17
|
+
isUnminified: boolean;
|
|
18
|
+
dblClickWindow: number;
|
|
19
|
+
getAngle(angle: number): number;
|
|
20
|
+
enableTrace: boolean;
|
|
21
|
+
pointerEventsEnabled: boolean;
|
|
22
|
+
autoDrawEnabled: boolean;
|
|
23
|
+
hitOnDragEnabled: boolean;
|
|
24
|
+
capturePointerEventsEnabled: boolean;
|
|
25
|
+
_mouseListenClick: boolean;
|
|
26
|
+
_touchListenClick: boolean;
|
|
27
|
+
_pointerListenClick: boolean;
|
|
28
|
+
_mouseInDblClickWindow: boolean;
|
|
29
|
+
_touchInDblClickWindow: boolean;
|
|
30
|
+
_pointerInDblClickWindow: boolean;
|
|
31
|
+
pixelRatio: number;
|
|
32
|
+
dragDistance: number;
|
|
33
|
+
angleDeg: boolean;
|
|
34
|
+
showWarnings: boolean;
|
|
35
|
+
dragButtons: number[];
|
|
36
|
+
isDragging(): any;
|
|
37
|
+
isDragReady(): boolean;
|
|
38
|
+
document: any;
|
|
39
|
+
_injectGlobal(Konva: any): void;
|
|
40
|
+
} & {
|
|
41
|
+
Util: {
|
|
42
|
+
_isElement(obj: any): obj is Element;
|
|
43
|
+
_isFunction(obj: any): boolean;
|
|
44
|
+
_isPlainObject(obj: any): boolean;
|
|
45
|
+
_isArray(obj: any): obj is any[];
|
|
46
|
+
_isNumber(obj: any): obj is number;
|
|
47
|
+
_isString(obj: any): obj is string;
|
|
48
|
+
_isBoolean(obj: any): obj is boolean;
|
|
49
|
+
isObject(val: any): val is Object;
|
|
50
|
+
isValidSelector(selector: any): boolean;
|
|
51
|
+
_sign(number: number): 1 | -1;
|
|
52
|
+
requestAnimFrame(callback: Function): void;
|
|
53
|
+
createCanvasElement(): HTMLCanvasElement;
|
|
54
|
+
createImageElement(): HTMLImageElement;
|
|
55
|
+
_isInDocument(el: any): boolean;
|
|
56
|
+
_urlToImage(url: string, callback: Function): void;
|
|
57
|
+
_rgbToHex(r: number, g: number, b: number): string;
|
|
58
|
+
_hexToRgb(hex: string): import("./types").RGB;
|
|
59
|
+
getRandomColor(): string;
|
|
60
|
+
getRGB(color: string): import("./types").RGB;
|
|
61
|
+
colorToRGBA(str: string): import("./types").RGBA;
|
|
62
|
+
_namedColorToRBA(str: string): {
|
|
63
|
+
r: any;
|
|
64
|
+
g: any;
|
|
65
|
+
b: any;
|
|
66
|
+
a: number;
|
|
67
|
+
};
|
|
68
|
+
_rgbColorToRGBA(str: string): import("./types").RGBA;
|
|
69
|
+
_rgbaColorToRGBA(str: string): import("./types").RGBA;
|
|
70
|
+
_hex6ColorToRGBA(str: string): import("./types").RGBA;
|
|
71
|
+
_hex3ColorToRGBA(str: string): import("./types").RGBA;
|
|
72
|
+
_hslColorToRGBA(str: string): import("./types").RGBA;
|
|
73
|
+
haveIntersection(r1: import("./types").IRect, r2: import("./types").IRect): boolean;
|
|
74
|
+
cloneObject<Any>(obj: Any): Any;
|
|
75
|
+
cloneArray(arr: any[]): any[];
|
|
76
|
+
degToRad(deg: number): number;
|
|
77
|
+
radToDeg(rad: number): number;
|
|
78
|
+
_degToRad(deg: number): number;
|
|
79
|
+
_radToDeg(rad: number): number;
|
|
80
|
+
_getRotation(radians: any): any;
|
|
81
|
+
_capitalize(str: string): string;
|
|
82
|
+
throw(str: string): never;
|
|
83
|
+
error(str: string): void;
|
|
84
|
+
warn(str: string): void;
|
|
85
|
+
each(obj: any, func: any): void;
|
|
86
|
+
_inRange(val: any, left: any, right: any): boolean;
|
|
87
|
+
_getProjectionToSegment(x1: any, y1: any, x2: any, y2: any, x3: any, y3: any): any[];
|
|
88
|
+
_getProjectionToLine(pt: import("./types").Vector2d, line: any, isClosed: any): import("./types").Vector2d;
|
|
89
|
+
_prepareArrayForTween(startArray: any, endArray: any, isClosed: any): any[];
|
|
90
|
+
_prepareToStringify(obj: any): any;
|
|
91
|
+
_assign<T, U>(target: T, source: U): T & U;
|
|
92
|
+
_getFirstPointerId(evt: any): any;
|
|
93
|
+
};
|
|
94
|
+
Transform: typeof Transform;
|
|
95
|
+
Node: typeof Node;
|
|
96
|
+
Container: typeof Container;
|
|
97
|
+
Stage: typeof Stage;
|
|
98
|
+
stages: Stage[];
|
|
99
|
+
Layer: typeof Layer;
|
|
100
|
+
FastLayer: typeof FastLayer;
|
|
101
|
+
Group: typeof Group;
|
|
102
|
+
DD: {
|
|
103
|
+
readonly isDragging: boolean;
|
|
104
|
+
justDragged: boolean;
|
|
105
|
+
readonly node: Node<import("./Node").NodeConfig>;
|
|
106
|
+
_dragElements: Map<number, {
|
|
107
|
+
node: Node<import("./Node").NodeConfig>;
|
|
108
|
+
startPointerPos: import("./types").Vector2d;
|
|
109
|
+
offset: import("./types").Vector2d;
|
|
110
|
+
pointerId?: number;
|
|
111
|
+
dragStatus: "stopped" | "ready" | "dragging";
|
|
112
|
+
}>;
|
|
113
|
+
_drag(evt: any): void;
|
|
114
|
+
_endDragBefore(evt?: any): void;
|
|
115
|
+
_endDragAfter(evt: any): void;
|
|
116
|
+
};
|
|
117
|
+
Shape: typeof Shape;
|
|
118
|
+
shapes: {
|
|
119
|
+
[key: string]: Shape<import("./Shape").ShapeConfig>;
|
|
120
|
+
};
|
|
121
|
+
Animation: typeof Animation;
|
|
122
|
+
Tween: typeof Tween;
|
|
123
|
+
Easings: {
|
|
124
|
+
BackEaseIn(t: any, b: any, c: any, d: any): any;
|
|
125
|
+
BackEaseOut(t: any, b: any, c: any, d: any): any;
|
|
126
|
+
BackEaseInOut(t: any, b: any, c: any, d: any): any;
|
|
127
|
+
ElasticEaseIn(t: any, b: any, c: any, d: any, a: any, p: any): any;
|
|
128
|
+
ElasticEaseOut(t: any, b: any, c: any, d: any, a: any, p: any): any;
|
|
129
|
+
ElasticEaseInOut(t: any, b: any, c: any, d: any, a: any, p: any): any;
|
|
130
|
+
BounceEaseOut(t: any, b: any, c: any, d: any): any;
|
|
131
|
+
BounceEaseIn(t: any, b: any, c: any, d: any): any;
|
|
132
|
+
BounceEaseInOut(t: any, b: any, c: any, d: any): any;
|
|
133
|
+
EaseIn(t: any, b: any, c: any, d: any): any;
|
|
134
|
+
EaseOut(t: any, b: any, c: any, d: any): any;
|
|
135
|
+
EaseInOut(t: any, b: any, c: any, d: any): any;
|
|
136
|
+
StrongEaseIn(t: any, b: any, c: any, d: any): any;
|
|
137
|
+
StrongEaseOut(t: any, b: any, c: any, d: any): any;
|
|
138
|
+
StrongEaseInOut(t: any, b: any, c: any, d: any): any;
|
|
139
|
+
Linear(t: any, b: any, c: any, d: any): any;
|
|
140
|
+
};
|
|
141
|
+
Context: typeof Context;
|
|
142
|
+
Canvas: typeof Canvas;
|
|
143
|
+
};
|
|
144
|
+
export default Konva;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Konva as Global } from './Global.js';
|
|
2
|
+
import { Util, Transform } from './Util.js';
|
|
3
|
+
import { Node } from './Node.js';
|
|
4
|
+
import { Container } from './Container.js';
|
|
5
|
+
import { Stage, stages } from './Stage.js';
|
|
6
|
+
import { Layer } from './Layer.js';
|
|
7
|
+
import { FastLayer } from './FastLayer.js';
|
|
8
|
+
import { Group } from './Group.js';
|
|
9
|
+
import { DD } from './DragAndDrop.js';
|
|
10
|
+
import { Shape, shapes } from './Shape.js';
|
|
11
|
+
import { Animation } from './Animation.js';
|
|
12
|
+
import { Tween, Easings } from './Tween.js';
|
|
13
|
+
import { Context } from './Context.js';
|
|
14
|
+
import { Canvas } from './Canvas.js';
|
|
15
|
+
export const Konva = Util._assign(Global, {
|
|
16
|
+
Util,
|
|
17
|
+
Transform,
|
|
18
|
+
Node,
|
|
19
|
+
Container,
|
|
20
|
+
Stage,
|
|
21
|
+
stages,
|
|
22
|
+
Layer,
|
|
23
|
+
FastLayer,
|
|
24
|
+
Group,
|
|
25
|
+
DD,
|
|
26
|
+
Shape,
|
|
27
|
+
shapes,
|
|
28
|
+
Animation,
|
|
29
|
+
Tween,
|
|
30
|
+
Easings,
|
|
31
|
+
Context,
|
|
32
|
+
Canvas,
|
|
33
|
+
});
|
|
34
|
+
export default Konva;
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { Arc } from './shapes/Arc';
|
|
2
|
+
import { Arrow } from './shapes/Arrow';
|
|
3
|
+
import { Circle } from './shapes/Circle';
|
|
4
|
+
import { Ellipse } from './shapes/Ellipse';
|
|
5
|
+
import { Image } from './shapes/Image';
|
|
6
|
+
import { Label, Tag } from './shapes/Label';
|
|
7
|
+
import { Line } from './shapes/Line';
|
|
8
|
+
import { Path } from './shapes/Path';
|
|
9
|
+
import { Rect } from './shapes/Rect';
|
|
10
|
+
import { RegularPolygon } from './shapes/RegularPolygon';
|
|
11
|
+
import { Ring } from './shapes/Ring';
|
|
12
|
+
import { Sprite } from './shapes/Sprite';
|
|
13
|
+
import { Star } from './shapes/Star';
|
|
14
|
+
import { Text } from './shapes/Text';
|
|
15
|
+
import { TextPath } from './shapes/TextPath';
|
|
16
|
+
import { Transformer } from './shapes/Transformer';
|
|
17
|
+
import { Wedge } from './shapes/Wedge';
|
|
18
|
+
export declare const Konva: {
|
|
19
|
+
_global: any;
|
|
20
|
+
version: string;
|
|
21
|
+
isBrowser: boolean;
|
|
22
|
+
isUnminified: boolean;
|
|
23
|
+
dblClickWindow: number;
|
|
24
|
+
getAngle(angle: number): number;
|
|
25
|
+
enableTrace: boolean;
|
|
26
|
+
pointerEventsEnabled: boolean;
|
|
27
|
+
autoDrawEnabled: boolean;
|
|
28
|
+
hitOnDragEnabled: boolean;
|
|
29
|
+
capturePointerEventsEnabled: boolean;
|
|
30
|
+
_mouseListenClick: boolean;
|
|
31
|
+
_touchListenClick: boolean;
|
|
32
|
+
_pointerListenClick: boolean;
|
|
33
|
+
_mouseInDblClickWindow: boolean;
|
|
34
|
+
_touchInDblClickWindow: boolean;
|
|
35
|
+
_pointerInDblClickWindow: boolean;
|
|
36
|
+
pixelRatio: number;
|
|
37
|
+
dragDistance: number;
|
|
38
|
+
angleDeg: boolean;
|
|
39
|
+
showWarnings: boolean;
|
|
40
|
+
dragButtons: number[];
|
|
41
|
+
isDragging(): any;
|
|
42
|
+
isDragReady(): boolean;
|
|
43
|
+
document: any;
|
|
44
|
+
_injectGlobal(Konva: any): void;
|
|
45
|
+
} & {
|
|
46
|
+
Util: {
|
|
47
|
+
_isElement(obj: any): obj is Element;
|
|
48
|
+
_isFunction(obj: any): boolean;
|
|
49
|
+
_isPlainObject(obj: any): boolean;
|
|
50
|
+
_isArray(obj: any): obj is any[];
|
|
51
|
+
_isNumber(obj: any): obj is number;
|
|
52
|
+
_isString(obj: any): obj is string;
|
|
53
|
+
_isBoolean(obj: any): obj is boolean;
|
|
54
|
+
isObject(val: any): val is Object;
|
|
55
|
+
isValidSelector(selector: any): boolean;
|
|
56
|
+
_sign(number: number): 1 | -1;
|
|
57
|
+
requestAnimFrame(callback: Function): void;
|
|
58
|
+
createCanvasElement(): HTMLCanvasElement;
|
|
59
|
+
createImageElement(): HTMLImageElement;
|
|
60
|
+
_isInDocument(el: any): boolean;
|
|
61
|
+
_urlToImage(url: string, callback: Function): void;
|
|
62
|
+
_rgbToHex(r: number, g: number, b: number): string;
|
|
63
|
+
_hexToRgb(hex: string): import("./types").RGB;
|
|
64
|
+
getRandomColor(): string;
|
|
65
|
+
getRGB(color: string): import("./types").RGB;
|
|
66
|
+
colorToRGBA(str: string): import("./types").RGBA;
|
|
67
|
+
_namedColorToRBA(str: string): {
|
|
68
|
+
r: any;
|
|
69
|
+
g: any;
|
|
70
|
+
b: any;
|
|
71
|
+
a: number;
|
|
72
|
+
};
|
|
73
|
+
_rgbColorToRGBA(str: string): import("./types").RGBA;
|
|
74
|
+
_rgbaColorToRGBA(str: string): import("./types").RGBA;
|
|
75
|
+
_hex6ColorToRGBA(str: string): import("./types").RGBA;
|
|
76
|
+
_hex3ColorToRGBA(str: string): import("./types").RGBA;
|
|
77
|
+
_hslColorToRGBA(str: string): import("./types").RGBA;
|
|
78
|
+
haveIntersection(r1: import("./types").IRect, r2: import("./types").IRect): boolean;
|
|
79
|
+
cloneObject<Any>(obj: Any): Any;
|
|
80
|
+
cloneArray(arr: any[]): any[];
|
|
81
|
+
degToRad(deg: number): number;
|
|
82
|
+
radToDeg(rad: number): number;
|
|
83
|
+
_degToRad(deg: number): number;
|
|
84
|
+
_radToDeg(rad: number): number;
|
|
85
|
+
_getRotation(radians: any): any;
|
|
86
|
+
_capitalize(str: string): string;
|
|
87
|
+
throw(str: string): never;
|
|
88
|
+
error(str: string): void;
|
|
89
|
+
warn(str: string): void;
|
|
90
|
+
each(obj: any, func: any): void;
|
|
91
|
+
_inRange(val: any, left: any, right: any): boolean;
|
|
92
|
+
_getProjectionToSegment(x1: any, y1: any, x2: any, y2: any, x3: any, y3: any): any[];
|
|
93
|
+
_getProjectionToLine(pt: import("./types").Vector2d, line: any, isClosed: any): import("./types").Vector2d;
|
|
94
|
+
_prepareArrayForTween(startArray: any, endArray: any, isClosed: any): any[];
|
|
95
|
+
_prepareToStringify(obj: any): any;
|
|
96
|
+
_assign<T, U>(target: T, source: U): T & U;
|
|
97
|
+
_getFirstPointerId(evt: any): any;
|
|
98
|
+
};
|
|
99
|
+
Transform: typeof import("./Util").Transform;
|
|
100
|
+
Node: typeof import("./Node").Node;
|
|
101
|
+
Container: typeof import("./Container").Container;
|
|
102
|
+
Stage: typeof import("./Stage").Stage;
|
|
103
|
+
stages: import("./Stage").Stage[];
|
|
104
|
+
Layer: typeof import("./Layer").Layer;
|
|
105
|
+
FastLayer: typeof import("./FastLayer").FastLayer;
|
|
106
|
+
Group: typeof import("./Group").Group;
|
|
107
|
+
DD: {
|
|
108
|
+
readonly isDragging: boolean;
|
|
109
|
+
justDragged: boolean;
|
|
110
|
+
readonly node: import("./Node").Node<import("./Node").NodeConfig>;
|
|
111
|
+
_dragElements: Map<number, {
|
|
112
|
+
node: import("./Node").Node<import("./Node").NodeConfig>;
|
|
113
|
+
startPointerPos: import("./types").Vector2d;
|
|
114
|
+
offset: import("./types").Vector2d;
|
|
115
|
+
pointerId?: number;
|
|
116
|
+
dragStatus: "stopped" | "ready" | "dragging";
|
|
117
|
+
}>;
|
|
118
|
+
_drag(evt: any): void;
|
|
119
|
+
_endDragBefore(evt?: any): void;
|
|
120
|
+
_endDragAfter(evt: any): void;
|
|
121
|
+
};
|
|
122
|
+
Shape: typeof import("./Shape").Shape;
|
|
123
|
+
shapes: {
|
|
124
|
+
[key: string]: import("./Shape").Shape<import("./Shape").ShapeConfig>;
|
|
125
|
+
};
|
|
126
|
+
Animation: typeof import("./Animation").Animation;
|
|
127
|
+
Tween: typeof import("./Tween").Tween;
|
|
128
|
+
Easings: {
|
|
129
|
+
BackEaseIn(t: any, b: any, c: any, d: any): any;
|
|
130
|
+
BackEaseOut(t: any, b: any, c: any, d: any): any;
|
|
131
|
+
BackEaseInOut(t: any, b: any, c: any, d: any): any;
|
|
132
|
+
ElasticEaseIn(t: any, b: any, c: any, d: any, a: any, p: any): any;
|
|
133
|
+
ElasticEaseOut(t: any, b: any, c: any, d: any, a: any, p: any): any;
|
|
134
|
+
ElasticEaseInOut(t: any, b: any, c: any, d: any, a: any, p: any): any;
|
|
135
|
+
BounceEaseOut(t: any, b: any, c: any, d: any): any;
|
|
136
|
+
BounceEaseIn(t: any, b: any, c: any, d: any): any;
|
|
137
|
+
BounceEaseInOut(t: any, b: any, c: any, d: any): any;
|
|
138
|
+
EaseIn(t: any, b: any, c: any, d: any): any;
|
|
139
|
+
EaseOut(t: any, b: any, c: any, d: any): any;
|
|
140
|
+
EaseInOut(t: any, b: any, c: any, d: any): any;
|
|
141
|
+
StrongEaseIn(t: any, b: any, c: any, d: any): any;
|
|
142
|
+
StrongEaseOut(t: any, b: any, c: any, d: any): any;
|
|
143
|
+
StrongEaseInOut(t: any, b: any, c: any, d: any): any;
|
|
144
|
+
Linear(t: any, b: any, c: any, d: any): any;
|
|
145
|
+
};
|
|
146
|
+
Context: typeof import("./Context").Context;
|
|
147
|
+
Canvas: typeof import("./Canvas").Canvas;
|
|
148
|
+
} & {
|
|
149
|
+
Arc: typeof Arc;
|
|
150
|
+
Arrow: typeof Arrow;
|
|
151
|
+
Circle: typeof Circle;
|
|
152
|
+
Ellipse: typeof Ellipse;
|
|
153
|
+
Image: typeof Image;
|
|
154
|
+
Label: typeof Label;
|
|
155
|
+
Tag: typeof Tag;
|
|
156
|
+
Line: typeof Line;
|
|
157
|
+
Path: typeof Path;
|
|
158
|
+
Rect: typeof Rect;
|
|
159
|
+
RegularPolygon: typeof RegularPolygon;
|
|
160
|
+
Ring: typeof Ring;
|
|
161
|
+
Sprite: typeof Sprite;
|
|
162
|
+
Star: typeof Star;
|
|
163
|
+
Text: typeof Text;
|
|
164
|
+
TextPath: typeof TextPath;
|
|
165
|
+
Transformer: typeof Transformer;
|
|
166
|
+
Wedge: typeof Wedge;
|
|
167
|
+
Filters: {
|
|
168
|
+
Blur: import("./Node").Filter;
|
|
169
|
+
Brighten: import("./Node").Filter;
|
|
170
|
+
Contrast: import("./Node").Filter;
|
|
171
|
+
Emboss: import("./Node").Filter;
|
|
172
|
+
Enhance: import("./Node").Filter;
|
|
173
|
+
Grayscale: import("./Node").Filter;
|
|
174
|
+
HSL: import("./Node").Filter;
|
|
175
|
+
HSV: import("./Node").Filter;
|
|
176
|
+
Invert: import("./Node").Filter;
|
|
177
|
+
Kaleidoscope: import("./Node").Filter;
|
|
178
|
+
Mask: import("./Node").Filter;
|
|
179
|
+
Noise: import("./Node").Filter;
|
|
180
|
+
Pixelate: import("./Node").Filter;
|
|
181
|
+
Posterize: import("./Node").Filter;
|
|
182
|
+
RGB: import("./Node").Filter;
|
|
183
|
+
RGBA: import("./Node").Filter;
|
|
184
|
+
Sepia: import("./Node").Filter;
|
|
185
|
+
Solarize: import("./Node").Filter;
|
|
186
|
+
Threshold: import("./Node").Filter;
|
|
187
|
+
};
|
|
188
|
+
};
|