konva 10.0.8 → 10.0.10

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.
Files changed (127) hide show
  1. package/konva.js +95 -48
  2. package/konva.min.js +4 -4
  3. package/package.json +1 -1
  4. package/lib/Animation.d.ts +0 -24
  5. package/lib/Animation.js +0 -142
  6. package/lib/BezierFunctions.d.ts +0 -6
  7. package/lib/BezierFunctions.js +0 -784
  8. package/lib/Canvas.d.ts +0 -33
  9. package/lib/Canvas.js +0 -137
  10. package/lib/Container.d.ts +0 -54
  11. package/lib/Container.js +0 -316
  12. package/lib/Context.d.ts +0 -95
  13. package/lib/Context.js +0 -561
  14. package/lib/Core.d.ts +0 -3
  15. package/lib/Core.js +0 -3
  16. package/lib/DragAndDrop.d.ts +0 -17
  17. package/lib/DragAndDrop.js +0 -110
  18. package/lib/Factory.d.ts +0 -22
  19. package/lib/Factory.js +0 -123
  20. package/lib/FastLayer.d.ts +0 -4
  21. package/lib/FastLayer.js +0 -12
  22. package/lib/Global.d.ts +0 -37
  23. package/lib/Global.js +0 -66
  24. package/lib/Group.d.ts +0 -9
  25. package/lib/Group.js +0 -13
  26. package/lib/Layer.d.ts +0 -62
  27. package/lib/Layer.js +0 -305
  28. package/lib/Node.d.ts +0 -323
  29. package/lib/Node.js +0 -1532
  30. package/lib/PointerEvents.d.ts +0 -11
  31. package/lib/PointerEvents.js +0 -37
  32. package/lib/Shape.d.ts +0 -196
  33. package/lib/Shape.js +0 -548
  34. package/lib/Stage.d.ts +0 -86
  35. package/lib/Stage.js +0 -715
  36. package/lib/Tween.d.ts +0 -90
  37. package/lib/Tween.js +0 -531
  38. package/lib/Util.d.ts +0 -133
  39. package/lib/Util.js +0 -866
  40. package/lib/Validators.d.ts +0 -11
  41. package/lib/Validators.js +0 -178
  42. package/lib/_CoreInternals.d.ts +0 -220
  43. package/lib/_CoreInternals.js +0 -34
  44. package/lib/_FullInternals.d.ts +0 -302
  45. package/lib/_FullInternals.js +0 -80
  46. package/lib/canvas-backend.d.ts +0 -2
  47. package/lib/canvas-backend.js +0 -27
  48. package/lib/filters/Blur.d.ts +0 -2
  49. package/lib/filters/Blur.js +0 -235
  50. package/lib/filters/Brighten.d.ts +0 -2
  51. package/lib/filters/Brighten.js +0 -12
  52. package/lib/filters/Brightness.d.ts +0 -2
  53. package/lib/filters/Brightness.js +0 -8
  54. package/lib/filters/Contrast.d.ts +0 -2
  55. package/lib/filters/Contrast.js +0 -35
  56. package/lib/filters/Emboss.d.ts +0 -2
  57. package/lib/filters/Emboss.js +0 -101
  58. package/lib/filters/Enhance.d.ts +0 -2
  59. package/lib/filters/Enhance.js +0 -84
  60. package/lib/filters/Grayscale.d.ts +0 -2
  61. package/lib/filters/Grayscale.js +0 -9
  62. package/lib/filters/HSL.d.ts +0 -2
  63. package/lib/filters/HSL.js +0 -24
  64. package/lib/filters/HSV.d.ts +0 -2
  65. package/lib/filters/HSV.js +0 -23
  66. package/lib/filters/Invert.d.ts +0 -2
  67. package/lib/filters/Invert.js +0 -8
  68. package/lib/filters/Kaleidoscope.d.ts +0 -2
  69. package/lib/filters/Kaleidoscope.js +0 -133
  70. package/lib/filters/Mask.d.ts +0 -2
  71. package/lib/filters/Mask.js +0 -151
  72. package/lib/filters/Noise.d.ts +0 -2
  73. package/lib/filters/Noise.js +0 -12
  74. package/lib/filters/Pixelate.d.ts +0 -2
  75. package/lib/filters/Pixelate.js +0 -60
  76. package/lib/filters/Posterize.d.ts +0 -2
  77. package/lib/filters/Posterize.js +0 -10
  78. package/lib/filters/RGB.d.ts +0 -2
  79. package/lib/filters/RGB.js +0 -38
  80. package/lib/filters/RGBA.d.ts +0 -2
  81. package/lib/filters/RGBA.js +0 -49
  82. package/lib/filters/Sepia.d.ts +0 -2
  83. package/lib/filters/Sepia.js +0 -11
  84. package/lib/filters/Solarize.d.ts +0 -2
  85. package/lib/filters/Solarize.js +0 -14
  86. package/lib/filters/Threshold.d.ts +0 -2
  87. package/lib/filters/Threshold.js +0 -10
  88. package/lib/index.d.ts +0 -2
  89. package/lib/index.js +0 -2
  90. package/lib/shapes/Arc.d.ts +0 -27
  91. package/lib/shapes/Arc.js +0 -60
  92. package/lib/shapes/Arrow.d.ts +0 -27
  93. package/lib/shapes/Arrow.js +0 -99
  94. package/lib/shapes/Circle.d.ts +0 -15
  95. package/lib/shapes/Circle.js +0 -33
  96. package/lib/shapes/Ellipse.d.ts +0 -18
  97. package/lib/shapes/Ellipse.js +0 -37
  98. package/lib/shapes/Image.d.ts +0 -29
  99. package/lib/shapes/Image.js +0 -131
  100. package/lib/shapes/Label.d.ts +0 -39
  101. package/lib/shapes/Label.js +0 -173
  102. package/lib/shapes/Line.d.ts +0 -29
  103. package/lib/shapes/Line.js +0 -156
  104. package/lib/shapes/Path.d.ts +0 -50
  105. package/lib/shapes/Path.js +0 -670
  106. package/lib/shapes/Rect.d.ts +0 -11
  107. package/lib/shapes/Rect.js +0 -22
  108. package/lib/shapes/RegularPolygon.d.ts +0 -26
  109. package/lib/shapes/RegularPolygon.js +0 -72
  110. package/lib/shapes/Ring.d.ts +0 -17
  111. package/lib/shapes/Ring.js +0 -33
  112. package/lib/shapes/Sprite.d.ts +0 -32
  113. package/lib/shapes/Sprite.js +0 -108
  114. package/lib/shapes/Star.d.ts +0 -19
  115. package/lib/shapes/Star.js +0 -38
  116. package/lib/shapes/Text.d.ts +0 -90
  117. package/lib/shapes/Text.js +0 -460
  118. package/lib/shapes/TextPath.d.ts +0 -72
  119. package/lib/shapes/TextPath.js +0 -268
  120. package/lib/shapes/Transformer.d.ts +0 -130
  121. package/lib/shapes/Transformer.js +0 -1009
  122. package/lib/shapes/Wedge.d.ts +0 -19
  123. package/lib/shapes/Wedge.js +0 -38
  124. package/lib/skia-backend.d.ts +0 -2
  125. package/lib/skia-backend.js +0 -24
  126. package/lib/types.d.ts +0 -56
  127. package/lib/types.js +0 -21
@@ -1,11 +0,0 @@
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) => T) | undefined;
4
- export declare function getNumberOrArrayOfNumbersValidator<T>(noOfElements: number): ((val: T, attr: string) => T) | undefined;
5
- export declare function getNumberOrAutoValidator<T>(): ((val: T, attr: string) => T) | undefined;
6
- export declare function getStringValidator<T>(): ((val: T, attr: string) => T) | undefined;
7
- export declare function getStringOrGradientValidator<T>(): ((val: T, attr: string) => T) | undefined;
8
- export declare function getFunctionValidator<T>(): ((val: T, attr: string) => T) | undefined;
9
- export declare function getNumberArrayValidator<T>(): ((val: T, attr: string) => T) | undefined;
10
- export declare function getBooleanValidator<T>(): ((val: T, attr: string) => T) | undefined;
11
- export declare function getComponentValidator<T>(components: string[]): ((val: T, attr: string) => T) | undefined;
package/lib/Validators.js DELETED
@@ -1,178 +0,0 @@
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
- const isNumber = Util._isNumber(val);
67
- const 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
- const TypedArray = Int8Array ? Object.getPrototypeOf(Int8Array) : null;
124
- if (TypedArray && val instanceof TypedArray) {
125
- return val;
126
- }
127
- if (!Util._isArray(val)) {
128
- Util.warn(_formatValue(val) +
129
- ' is a not valid value for "' +
130
- attr +
131
- '" attribute. The value should be a array of numbers.');
132
- }
133
- else {
134
- val.forEach(function (item) {
135
- if (!Util._isNumber(item)) {
136
- Util.warn('"' +
137
- attr +
138
- '" attribute has non numeric element ' +
139
- item +
140
- '. Make sure that all elements are numbers.');
141
- }
142
- });
143
- }
144
- return val;
145
- };
146
- }
147
- }
148
- export function getBooleanValidator() {
149
- if (Konva.isUnminified) {
150
- return function (val, attr) {
151
- const isBool = val === true || val === false;
152
- if (!isBool) {
153
- Util.warn(_formatValue(val) +
154
- ' is a not valid value for "' +
155
- attr +
156
- '" attribute. The value should be a boolean.');
157
- }
158
- return val;
159
- };
160
- }
161
- }
162
- export function getComponentValidator(components) {
163
- if (Konva.isUnminified) {
164
- return function (val, attr) {
165
- if (val === undefined || val === null) {
166
- return val;
167
- }
168
- if (!Util.isObject(val)) {
169
- Util.warn(_formatValue(val) +
170
- ' is a not valid value for "' +
171
- attr +
172
- '" attribute. The value should be an object with properties ' +
173
- components);
174
- }
175
- return val;
176
- };
177
- }
178
- }
@@ -1,220 +0,0 @@
1
- import { Transform } from './Util.ts';
2
- import { Node } from './Node.ts';
3
- import { Container } from './Container.ts';
4
- import { Stage } from './Stage.ts';
5
- import { Layer } from './Layer.ts';
6
- import { FastLayer } from './FastLayer.ts';
7
- import { Group } from './Group.ts';
8
- import { Shape } from './Shape.ts';
9
- import { Animation } from './Animation.ts';
10
- import { Tween } from './Tween.ts';
11
- import { Context } from './Context.ts';
12
- import { Canvas } from './Canvas.ts';
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
- _mouseDblClickPointerId: null;
32
- _touchDblClickPointerId: null;
33
- _pointerDblClickPointerId: null;
34
- _renderBackend: string;
35
- legacyTextRendering: boolean;
36
- pixelRatio: number;
37
- dragDistance: number;
38
- angleDeg: boolean;
39
- showWarnings: boolean;
40
- dragButtons: number[];
41
- isDragging(): boolean;
42
- isTransforming(): boolean;
43
- isDragReady(): boolean;
44
- releaseCanvasOnDestroy: boolean;
45
- document: any;
46
- _injectGlobal(Konva: any): void;
47
- } & {
48
- Util: {
49
- _isElement(obj: any): obj is Element;
50
- _isFunction(obj: any): boolean;
51
- _isPlainObject(obj: any): boolean;
52
- _isArray(obj: any): obj is Array<any>;
53
- _isNumber(obj: any): obj is number;
54
- _isString(obj: any): obj is string;
55
- _isBoolean(obj: any): obj is boolean;
56
- isObject(val: any): val is object;
57
- isValidSelector(selector: any): boolean;
58
- _sign(number: number): 1 | -1;
59
- requestAnimFrame(callback: Function): void;
60
- createCanvasElement(): HTMLCanvasElement;
61
- createImageElement(): HTMLImageElement;
62
- _isInDocument(el: any): boolean;
63
- _urlToImage(url: string, callback: Function): void;
64
- _rgbToHex(r: number, g: number, b: number): string;
65
- _hexToRgb(hex: string): import("./types.ts").RGB;
66
- getRandomColor(): string;
67
- getRGB(color: string): import("./types.ts").RGB;
68
- colorToRGBA(str: string): {
69
- r: number;
70
- g: number;
71
- b: number;
72
- a: number;
73
- } | undefined;
74
- _namedColorToRBA(str: string): {
75
- r: number;
76
- g: number;
77
- b: number;
78
- a: number;
79
- } | null;
80
- _rgbColorToRGBA(str: string): {
81
- r: number;
82
- g: number;
83
- b: number;
84
- a: number;
85
- } | undefined;
86
- _rgbaColorToRGBA(str: string): {
87
- r: number;
88
- g: number;
89
- b: number;
90
- a: number;
91
- } | undefined;
92
- _hex8ColorToRGBA(str: string): {
93
- r: number;
94
- g: number;
95
- b: number;
96
- a: number;
97
- } | undefined;
98
- _hex6ColorToRGBA(str: string): {
99
- r: number;
100
- g: number;
101
- b: number;
102
- a: number;
103
- } | undefined;
104
- _hex4ColorToRGBA(str: string): {
105
- r: number;
106
- g: number;
107
- b: number;
108
- a: number;
109
- } | undefined;
110
- _hex3ColorToRGBA(str: string): {
111
- r: number;
112
- g: number;
113
- b: number;
114
- a: number;
115
- } | undefined;
116
- _hslColorToRGBA(str: string): {
117
- r: number;
118
- g: number;
119
- b: number;
120
- a: number;
121
- } | undefined;
122
- haveIntersection(r1: import("./types.ts").IRect, r2: import("./types.ts").IRect): boolean;
123
- cloneObject<Any>(obj: Any): Any;
124
- cloneArray(arr: Array<any>): any[];
125
- degToRad(deg: number): number;
126
- radToDeg(rad: number): number;
127
- _degToRad(deg: number): number;
128
- _radToDeg(rad: number): number;
129
- _getRotation(radians: number): number;
130
- _capitalize(str: string): string;
131
- throw(str: string): never;
132
- error(str: string): void;
133
- warn(str: string): void;
134
- each(obj: object, func: Function): void;
135
- _inRange(val: number, left: number, right: number): boolean;
136
- _getProjectionToSegment(x1: any, y1: any, x2: any, y2: any, x3: any, y3: any): any[];
137
- _getProjectionToLine(pt: import("./types.ts").Vector2d, line: Array<import("./types.ts").Vector2d>, isClosed: boolean): import("./types.ts").Vector2d;
138
- _prepareArrayForTween(startArray: any, endArray: any, isClosed: any): number[];
139
- _prepareToStringify<T>(obj: any): T | null;
140
- _assign<T, U>(target: T, source: U): T & U;
141
- _getFirstPointerId(evt: any): any;
142
- releaseCanvas(...canvases: HTMLCanvasElement[]): void;
143
- drawRoundedRectPath(context: Context, width: number, height: number, cornerRadius: number | number[]): void;
144
- drawRoundedPolygonPath(context: Context, points: import("./types.ts").Vector2d[], sides: number, radius: number, cornerRadius: number | number[]): void;
145
- };
146
- Transform: typeof Transform;
147
- Node: typeof Node;
148
- Container: typeof Container;
149
- Stage: typeof Stage;
150
- stages: Stage[];
151
- Layer: typeof Layer;
152
- FastLayer: typeof FastLayer;
153
- Group: typeof Group;
154
- DD: {
155
- readonly isDragging: boolean;
156
- justDragged: boolean;
157
- readonly node: Node<import("./Node.ts").NodeConfig> | undefined;
158
- _dragElements: Map<number, {
159
- node: Node;
160
- startPointerPos: import("./types.ts").Vector2d;
161
- offset: import("./types.ts").Vector2d;
162
- pointerId?: number;
163
- dragStatus: "ready" | "dragging" | "stopped";
164
- }>;
165
- _drag(evt: any): void;
166
- _endDragBefore(evt?: any): void;
167
- _endDragAfter(evt: any): void;
168
- };
169
- Shape: typeof Shape;
170
- shapes: {
171
- [key: string]: Shape<import("./Shape.ts").ShapeConfig>;
172
- };
173
- Animation: typeof Animation;
174
- Tween: typeof Tween;
175
- Easings: {
176
- BackEaseIn(t: any, b: any, c: any, d: any): any;
177
- BackEaseOut(t: any, b: any, c: any, d: any): any;
178
- BackEaseInOut(t: any, b: any, c: any, d: any): any;
179
- ElasticEaseIn(t: any, b: any, c: any, d: any, a: any, p: any): any;
180
- ElasticEaseOut(t: any, b: any, c: any, d: any, a: any, p: any): any;
181
- ElasticEaseInOut(t: any, b: any, c: any, d: any, a: any, p: any): any;
182
- BounceEaseOut(t: any, b: any, c: any, d: any): any;
183
- BounceEaseIn(t: any, b: any, c: any, d: any): any;
184
- BounceEaseInOut(t: any, b: any, c: any, d: any): any;
185
- EaseIn(t: any, b: any, c: any, d: any): any;
186
- EaseOut(t: any, b: any, c: any, d: any): any;
187
- EaseInOut(t: any, b: any, c: any, d: any): any;
188
- StrongEaseIn(t: any, b: any, c: any, d: any): any;
189
- StrongEaseOut(t: any, b: any, c: any, d: any): any;
190
- StrongEaseInOut(t: any, b: any, c: any, d: any): any;
191
- Linear(t: any, b: any, c: any, d: any): any;
192
- };
193
- Context: typeof Context;
194
- Canvas: typeof Canvas;
195
- };
196
- export declare namespace Konva {
197
- type Vector2d = import('./types.ts').Vector2d;
198
- type Node = import('./Node.ts').Node;
199
- type NodeConfig = import('./Node.ts').NodeConfig;
200
- type KonvaEventObject<EventType> = import('./Node.ts').KonvaEventObject<EventType>;
201
- type KonvaPointerEvent = import('./PointerEvents.ts').KonvaPointerEvent;
202
- type KonvaEventListener<This, EventType> = import('./Node.ts').KonvaEventListener<This, EventType>;
203
- type Container = import('./Container.ts').Container<Node>;
204
- type ContainerConfig = import('./Container.ts').ContainerConfig;
205
- type Transform = import('./Util.ts').Transform;
206
- type Context = import('./Context.ts').Context;
207
- type Stage = import('./Stage.ts').Stage;
208
- type StageConfig = import('./Stage.ts').StageConfig;
209
- type Layer = import('./Layer.ts').Layer;
210
- type LayerConfig = import('./Layer.ts').LayerConfig;
211
- type FastLayer = import('./FastLayer.ts').FastLayer;
212
- type Group = import('./Group.ts').Group;
213
- type GroupConfig = import('./Group.ts').GroupConfig;
214
- type Shape = import('./Shape.ts').Shape;
215
- type ShapeConfig = import('./Shape.ts').ShapeConfig;
216
- type Animation = import('./Animation.ts').Animation;
217
- type Tween = import('./Tween.ts').Tween;
218
- type TweenConfig = import('./Tween.ts').TweenConfig;
219
- }
220
- export default Konva;
@@ -1,34 +0,0 @@
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;