konva 8.4.3 → 9.0.0

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 (190) hide show
  1. package/README.md +1 -9
  2. package/konva.js +17669 -16989
  3. package/konva.min.js +3 -3
  4. package/lib/Animation.js +11 -7
  5. package/lib/BezierFunctions.d.ts +6 -0
  6. package/lib/BezierFunctions.js +791 -0
  7. package/lib/Canvas.d.ts +1 -0
  8. package/lib/Canvas.js +26 -18
  9. package/lib/Container.js +16 -12
  10. package/lib/Context.d.ts +3 -1
  11. package/lib/Context.js +18 -10
  12. package/lib/Core.js +7 -3
  13. package/lib/DragAndDrop.js +25 -22
  14. package/lib/Factory.js +27 -24
  15. package/lib/FastLayer.js +10 -6
  16. package/lib/Global.js +16 -12
  17. package/lib/Group.js +10 -6
  18. package/lib/Layer.js +37 -33
  19. package/lib/Node.js +95 -90
  20. package/lib/PointerEvents.js +15 -7
  21. package/lib/Shape.js +90 -86
  22. package/lib/Stage.js +51 -47
  23. package/lib/Tween.js +26 -22
  24. package/lib/Util.js +29 -25
  25. package/lib/Validators.js +58 -44
  26. package/lib/_CoreInternals.js +36 -33
  27. package/lib/_FullInternals.js +78 -75
  28. package/lib/filters/Blur.js +9 -5
  29. package/lib/filters/Brighten.js +9 -5
  30. package/lib/filters/Contrast.js +9 -5
  31. package/lib/filters/Emboss.js +14 -10
  32. package/lib/filters/Enhance.js +9 -5
  33. package/lib/filters/Grayscale.js +5 -1
  34. package/lib/filters/HSL.js +11 -7
  35. package/lib/filters/HSV.js +11 -7
  36. package/lib/filters/Invert.js +5 -1
  37. package/lib/filters/Kaleidoscope.js +13 -9
  38. package/lib/filters/Mask.js +9 -5
  39. package/lib/filters/Noise.js +9 -5
  40. package/lib/filters/Pixelate.js +11 -7
  41. package/lib/filters/Posterize.js +9 -5
  42. package/lib/filters/RGB.js +11 -7
  43. package/lib/filters/RGBA.js +12 -8
  44. package/lib/filters/Sepia.js +5 -1
  45. package/lib/filters/Solarize.js +5 -1
  46. package/lib/filters/Threshold.js +9 -5
  47. package/lib/index-node.js +7 -5
  48. package/lib/index.js +4 -2
  49. package/lib/shapes/Arc.js +17 -13
  50. package/lib/shapes/Arrow.js +17 -13
  51. package/lib/shapes/Circle.js +11 -7
  52. package/lib/shapes/Ellipse.js +13 -9
  53. package/lib/shapes/Image.js +21 -17
  54. package/lib/shapes/Label.js +18 -13
  55. package/lib/shapes/Line.js +14 -10
  56. package/lib/shapes/Path.d.ts +5 -2
  57. package/lib/shapes/Path.js +44 -43
  58. package/lib/shapes/Rect.js +13 -9
  59. package/lib/shapes/RegularPolygon.js +12 -8
  60. package/lib/shapes/Ring.js +12 -8
  61. package/lib/shapes/Sprite.js +19 -15
  62. package/lib/shapes/Star.js +13 -9
  63. package/lib/shapes/Text.js +31 -26
  64. package/lib/shapes/TextPath.d.ts +5 -1
  65. package/lib/shapes/TextPath.js +82 -188
  66. package/lib/shapes/Transformer.js +85 -81
  67. package/lib/shapes/Wedge.js +16 -12
  68. package/lib/types.d.ts +6 -0
  69. package/lib/types.js +5 -2
  70. package/package.json +13 -42
  71. package/cmj/Animation.d.ts +0 -24
  72. package/cmj/Animation.js +0 -145
  73. package/cmj/Canvas.d.ts +0 -32
  74. package/cmj/Canvas.js +0 -114
  75. package/cmj/Container.d.ts +0 -47
  76. package/cmj/Container.js +0 -325
  77. package/cmj/Context.d.ts +0 -85
  78. package/cmj/Context.js +0 -538
  79. package/cmj/Core.d.ts +0 -3
  80. package/cmj/Core.js +0 -7
  81. package/cmj/DragAndDrop.d.ts +0 -17
  82. package/cmj/DragAndDrop.js +0 -111
  83. package/cmj/Factory.d.ts +0 -11
  84. package/cmj/Factory.js +0 -125
  85. package/cmj/FastLayer.d.ts +0 -4
  86. package/cmj/FastLayer.js +0 -16
  87. package/cmj/Global.d.ts +0 -34
  88. package/cmj/Global.js +0 -61
  89. package/cmj/Group.d.ts +0 -8
  90. package/cmj/Group.js +0 -17
  91. package/cmj/Layer.d.ts +0 -61
  92. package/cmj/Layer.js +0 -309
  93. package/cmj/Node.d.ts +0 -328
  94. package/cmj/Node.js +0 -1420
  95. package/cmj/PointerEvents.d.ts +0 -11
  96. package/cmj/PointerEvents.js +0 -45
  97. package/cmj/Shape.d.ts +0 -186
  98. package/cmj/Shape.js +0 -521
  99. package/cmj/Stage.d.ts +0 -85
  100. package/cmj/Stage.js +0 -692
  101. package/cmj/Tween.d.ts +0 -86
  102. package/cmj/Tween.js +0 -520
  103. package/cmj/Util.d.ts +0 -91
  104. package/cmj/Util.js +0 -801
  105. package/cmj/Validators.d.ts +0 -11
  106. package/cmj/Validators.js +0 -192
  107. package/cmj/_CoreInternals.d.ts +0 -152
  108. package/cmj/_CoreInternals.js +0 -37
  109. package/cmj/_FullInternals.d.ts +0 -196
  110. package/cmj/_FullInternals.js +0 -81
  111. package/cmj/filters/Blur.d.ts +0 -2
  112. package/cmj/filters/Blur.js +0 -701
  113. package/cmj/filters/Brighten.d.ts +0 -2
  114. package/cmj/filters/Brighten.js +0 -16
  115. package/cmj/filters/Contrast.d.ts +0 -2
  116. package/cmj/filters/Contrast.js +0 -38
  117. package/cmj/filters/Emboss.d.ts +0 -2
  118. package/cmj/filters/Emboss.js +0 -106
  119. package/cmj/filters/Enhance.d.ts +0 -2
  120. package/cmj/filters/Enhance.js +0 -87
  121. package/cmj/filters/Grayscale.d.ts +0 -2
  122. package/cmj/filters/Grayscale.js +0 -13
  123. package/cmj/filters/HSL.d.ts +0 -2
  124. package/cmj/filters/HSL.js +0 -28
  125. package/cmj/filters/HSV.d.ts +0 -2
  126. package/cmj/filters/HSV.js +0 -28
  127. package/cmj/filters/Invert.d.ts +0 -2
  128. package/cmj/filters/Invert.js +0 -12
  129. package/cmj/filters/Kaleidoscope.d.ts +0 -2
  130. package/cmj/filters/Kaleidoscope.js +0 -137
  131. package/cmj/filters/Mask.d.ts +0 -2
  132. package/cmj/filters/Mask.js +0 -144
  133. package/cmj/filters/Noise.d.ts +0 -2
  134. package/cmj/filters/Noise.js +0 -16
  135. package/cmj/filters/Pixelate.d.ts +0 -2
  136. package/cmj/filters/Pixelate.js +0 -64
  137. package/cmj/filters/Posterize.d.ts +0 -2
  138. package/cmj/filters/Posterize.js +0 -14
  139. package/cmj/filters/RGB.d.ts +0 -2
  140. package/cmj/filters/RGB.js +0 -43
  141. package/cmj/filters/RGBA.d.ts +0 -2
  142. package/cmj/filters/RGBA.js +0 -53
  143. package/cmj/filters/Sepia.d.ts +0 -2
  144. package/cmj/filters/Sepia.js +0 -15
  145. package/cmj/filters/Solarize.d.ts +0 -2
  146. package/cmj/filters/Solarize.js +0 -29
  147. package/cmj/filters/Threshold.d.ts +0 -2
  148. package/cmj/filters/Threshold.js +0 -14
  149. package/cmj/index-node.d.ts +0 -2
  150. package/cmj/index-node.js +0 -21
  151. package/cmj/index-types.d.ts +0 -181
  152. package/cmj/index.d.ts +0 -2
  153. package/cmj/index.js +0 -4
  154. package/cmj/package.json +0 -6
  155. package/cmj/shapes/Arc.d.ts +0 -26
  156. package/cmj/shapes/Arc.js +0 -59
  157. package/cmj/shapes/Arrow.d.ts +0 -26
  158. package/cmj/shapes/Arrow.js +0 -103
  159. package/cmj/shapes/Circle.d.ts +0 -14
  160. package/cmj/shapes/Circle.js +0 -37
  161. package/cmj/shapes/Ellipse.d.ts +0 -17
  162. package/cmj/shapes/Ellipse.js +0 -41
  163. package/cmj/shapes/Image.d.ts +0 -25
  164. package/cmj/shapes/Image.js +0 -117
  165. package/cmj/shapes/Label.d.ts +0 -36
  166. package/cmj/shapes/Label.js +0 -178
  167. package/cmj/shapes/Line.d.ts +0 -28
  168. package/cmj/shapes/Line.js +0 -159
  169. package/cmj/shapes/Path.d.ts +0 -37
  170. package/cmj/shapes/Path.js +0 -631
  171. package/cmj/shapes/Rect.d.ts +0 -10
  172. package/cmj/shapes/Rect.js +0 -26
  173. package/cmj/shapes/RegularPolygon.d.ts +0 -23
  174. package/cmj/shapes/RegularPolygon.js +0 -69
  175. package/cmj/shapes/Ring.d.ts +0 -16
  176. package/cmj/shapes/Ring.js +0 -37
  177. package/cmj/shapes/Sprite.d.ts +0 -31
  178. package/cmj/shapes/Sprite.js +0 -112
  179. package/cmj/shapes/Star.d.ts +0 -18
  180. package/cmj/shapes/Star.js +0 -42
  181. package/cmj/shapes/Text.d.ts +0 -63
  182. package/cmj/shapes/Text.js +0 -373
  183. package/cmj/shapes/TextPath.d.ts +0 -56
  184. package/cmj/shapes/TextPath.js +0 -351
  185. package/cmj/shapes/Transformer.d.ts +0 -116
  186. package/cmj/shapes/Transformer.js +0 -971
  187. package/cmj/shapes/Wedge.d.ts +0 -18
  188. package/cmj/shapes/Wedge.js +0 -42
  189. package/cmj/types.d.ts +0 -50
  190. package/cmj/types.js +0 -25
@@ -1,64 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Pixelate = void 0;
4
- const Factory_1 = require("../Factory");
5
- const Util_1 = require("../Util");
6
- const Node_1 = require("../Node");
7
- const Validators_1 = require("../Validators");
8
- const Pixelate = function (imageData) {
9
- var pixelSize = Math.ceil(this.pixelSize()), width = imageData.width, height = imageData.height, x, y, i, red, green, blue, alpha, nBinsX = Math.ceil(width / pixelSize), nBinsY = Math.ceil(height / pixelSize), xBinStart, xBinEnd, yBinStart, yBinEnd, xBin, yBin, pixelsInBin, data = imageData.data;
10
- if (pixelSize <= 0) {
11
- Util_1.Util.error('pixelSize value can not be <= 0');
12
- return;
13
- }
14
- for (xBin = 0; xBin < nBinsX; xBin += 1) {
15
- for (yBin = 0; yBin < nBinsY; yBin += 1) {
16
- red = 0;
17
- green = 0;
18
- blue = 0;
19
- alpha = 0;
20
- xBinStart = xBin * pixelSize;
21
- xBinEnd = xBinStart + pixelSize;
22
- yBinStart = yBin * pixelSize;
23
- yBinEnd = yBinStart + pixelSize;
24
- pixelsInBin = 0;
25
- for (x = xBinStart; x < xBinEnd; x += 1) {
26
- if (x >= width) {
27
- continue;
28
- }
29
- for (y = yBinStart; y < yBinEnd; y += 1) {
30
- if (y >= height) {
31
- continue;
32
- }
33
- i = (width * y + x) * 4;
34
- red += data[i + 0];
35
- green += data[i + 1];
36
- blue += data[i + 2];
37
- alpha += data[i + 3];
38
- pixelsInBin += 1;
39
- }
40
- }
41
- red = red / pixelsInBin;
42
- green = green / pixelsInBin;
43
- blue = blue / pixelsInBin;
44
- alpha = alpha / pixelsInBin;
45
- for (x = xBinStart; x < xBinEnd; x += 1) {
46
- if (x >= width) {
47
- continue;
48
- }
49
- for (y = yBinStart; y < yBinEnd; y += 1) {
50
- if (y >= height) {
51
- continue;
52
- }
53
- i = (width * y + x) * 4;
54
- data[i + 0] = red;
55
- data[i + 1] = green;
56
- data[i + 2] = blue;
57
- data[i + 3] = alpha;
58
- }
59
- }
60
- }
61
- }
62
- };
63
- exports.Pixelate = Pixelate;
64
- Factory_1.Factory.addGetterSetter(Node_1.Node, 'pixelSize', 8, (0, Validators_1.getNumberValidator)(), Factory_1.Factory.afterSetFilter);
@@ -1,2 +0,0 @@
1
- import { Filter } from '../Node';
2
- export declare const Posterize: Filter;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Posterize = void 0;
4
- const Factory_1 = require("../Factory");
5
- const Node_1 = require("../Node");
6
- const Validators_1 = require("../Validators");
7
- const Posterize = function (imageData) {
8
- var levels = Math.round(this.levels() * 254) + 1, data = imageData.data, len = data.length, scale = 255 / levels, i;
9
- for (i = 0; i < len; i += 1) {
10
- data[i] = Math.floor(data[i] / scale) * scale;
11
- }
12
- };
13
- exports.Posterize = Posterize;
14
- Factory_1.Factory.addGetterSetter(Node_1.Node, 'levels', 0.5, (0, Validators_1.getNumberValidator)(), Factory_1.Factory.afterSetFilter);
@@ -1,2 +0,0 @@
1
- import { Filter } from '../Node';
2
- export declare const RGB: Filter;
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RGB = void 0;
4
- const Factory_1 = require("../Factory");
5
- const Node_1 = require("../Node");
6
- const Validators_1 = require("../Validators");
7
- const RGB = function (imageData) {
8
- var data = imageData.data, nPixels = data.length, red = this.red(), green = this.green(), blue = this.blue(), i, brightness;
9
- for (i = 0; i < nPixels; i += 4) {
10
- brightness =
11
- (0.34 * data[i] + 0.5 * data[i + 1] + 0.16 * data[i + 2]) / 255;
12
- data[i] = brightness * red;
13
- data[i + 1] = brightness * green;
14
- data[i + 2] = brightness * blue;
15
- data[i + 3] = data[i + 3];
16
- }
17
- };
18
- exports.RGB = RGB;
19
- Factory_1.Factory.addGetterSetter(Node_1.Node, 'red', 0, function (val) {
20
- this._filterUpToDate = false;
21
- if (val > 255) {
22
- return 255;
23
- }
24
- else if (val < 0) {
25
- return 0;
26
- }
27
- else {
28
- return Math.round(val);
29
- }
30
- });
31
- Factory_1.Factory.addGetterSetter(Node_1.Node, 'green', 0, function (val) {
32
- this._filterUpToDate = false;
33
- if (val > 255) {
34
- return 255;
35
- }
36
- else if (val < 0) {
37
- return 0;
38
- }
39
- else {
40
- return Math.round(val);
41
- }
42
- });
43
- Factory_1.Factory.addGetterSetter(Node_1.Node, 'blue', 0, Validators_1.RGBComponent, Factory_1.Factory.afterSetFilter);
@@ -1,2 +0,0 @@
1
- import { Filter } from '../Node';
2
- export declare const RGBA: Filter;
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RGBA = void 0;
4
- const Factory_1 = require("../Factory");
5
- const Node_1 = require("../Node");
6
- const Validators_1 = require("../Validators");
7
- const RGBA = function (imageData) {
8
- var data = imageData.data, nPixels = data.length, red = this.red(), green = this.green(), blue = this.blue(), alpha = this.alpha(), i, ia;
9
- for (i = 0; i < nPixels; i += 4) {
10
- ia = 1 - alpha;
11
- data[i] = red * alpha + data[i] * ia;
12
- data[i + 1] = green * alpha + data[i + 1] * ia;
13
- data[i + 2] = blue * alpha + data[i + 2] * ia;
14
- }
15
- };
16
- exports.RGBA = RGBA;
17
- Factory_1.Factory.addGetterSetter(Node_1.Node, 'red', 0, function (val) {
18
- this._filterUpToDate = false;
19
- if (val > 255) {
20
- return 255;
21
- }
22
- else if (val < 0) {
23
- return 0;
24
- }
25
- else {
26
- return Math.round(val);
27
- }
28
- });
29
- Factory_1.Factory.addGetterSetter(Node_1.Node, 'green', 0, function (val) {
30
- this._filterUpToDate = false;
31
- if (val > 255) {
32
- return 255;
33
- }
34
- else if (val < 0) {
35
- return 0;
36
- }
37
- else {
38
- return Math.round(val);
39
- }
40
- });
41
- Factory_1.Factory.addGetterSetter(Node_1.Node, 'blue', 0, Validators_1.RGBComponent, Factory_1.Factory.afterSetFilter);
42
- Factory_1.Factory.addGetterSetter(Node_1.Node, 'alpha', 1, function (val) {
43
- this._filterUpToDate = false;
44
- if (val > 1) {
45
- return 1;
46
- }
47
- else if (val < 0) {
48
- return 0;
49
- }
50
- else {
51
- return val;
52
- }
53
- });
@@ -1,2 +0,0 @@
1
- import { Filter } from '../Node';
2
- export declare const Sepia: Filter;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Sepia = void 0;
4
- const Sepia = function (imageData) {
5
- var data = imageData.data, nPixels = data.length, i, r, g, b;
6
- for (i = 0; i < nPixels; i += 4) {
7
- r = data[i + 0];
8
- g = data[i + 1];
9
- b = data[i + 2];
10
- data[i + 0] = Math.min(255, r * 0.393 + g * 0.769 + b * 0.189);
11
- data[i + 1] = Math.min(255, r * 0.349 + g * 0.686 + b * 0.168);
12
- data[i + 2] = Math.min(255, r * 0.272 + g * 0.534 + b * 0.131);
13
- }
14
- };
15
- exports.Sepia = Sepia;
@@ -1,2 +0,0 @@
1
- import { Filter } from '../Node';
2
- export declare const Solarize: Filter;
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Solarize = void 0;
4
- const Solarize = function (imageData) {
5
- var data = imageData.data, w = imageData.width, h = imageData.height, w4 = w * 4, y = h;
6
- do {
7
- var offsetY = (y - 1) * w4;
8
- var x = w;
9
- do {
10
- var offset = offsetY + (x - 1) * 4;
11
- var r = data[offset];
12
- var g = data[offset + 1];
13
- var b = data[offset + 2];
14
- if (r > 127) {
15
- r = 255 - r;
16
- }
17
- if (g > 127) {
18
- g = 255 - g;
19
- }
20
- if (b > 127) {
21
- b = 255 - b;
22
- }
23
- data[offset] = r;
24
- data[offset + 1] = g;
25
- data[offset + 2] = b;
26
- } while (--x);
27
- } while (--y);
28
- };
29
- exports.Solarize = Solarize;
@@ -1,2 +0,0 @@
1
- import { Filter } from '../Node';
2
- export declare const Threshold: Filter;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Threshold = void 0;
4
- const Factory_1 = require("../Factory");
5
- const Node_1 = require("../Node");
6
- const Validators_1 = require("../Validators");
7
- const Threshold = function (imageData) {
8
- var level = this.threshold() * 255, data = imageData.data, len = data.length, i;
9
- for (i = 0; i < len; i += 1) {
10
- data[i] = data[i] < level ? 0 : 255;
11
- }
12
- };
13
- exports.Threshold = Threshold;
14
- Factory_1.Factory.addGetterSetter(Node_1.Node, 'threshold', 0.5, (0, Validators_1.getNumberValidator)(), Factory_1.Factory.afterSetFilter);
@@ -1,2 +0,0 @@
1
- import { Konva } from './_FullInternals';
2
- export default Konva;
package/cmj/index-node.js DELETED
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const _FullInternals_1 = require("./_FullInternals");
4
- const Canvas = require("canvas");
5
- const canvas = Canvas['default'] || Canvas;
6
- global.DOMMatrix = canvas.DOMMatrix;
7
- const isNode = typeof global.document === 'undefined';
8
- if (isNode) {
9
- _FullInternals_1.Konva.Util['createCanvasElement'] = () => {
10
- const node = canvas.createCanvas(300, 300);
11
- if (!node['style']) {
12
- node['style'] = {};
13
- }
14
- return node;
15
- };
16
- _FullInternals_1.Konva.Util.createImageElement = () => {
17
- const node = new canvas.Image();
18
- return node;
19
- };
20
- }
21
- exports.default = _FullInternals_1.Konva;
@@ -1,181 +0,0 @@
1
- // the purpose of that file is very stupid
2
- // I was not able to generate correct typescript declarations from the main source code
3
- // because right now Konva is an object. Typescript can not define types from object like this:
4
- // const stage : Konva.Stage = new Konva.Stage();
5
- // we can convert Konva to namespace
6
- // but I was not able to find a way to extend it
7
- // so here we just need to define full API of Konva manually
8
-
9
- // filters
10
- import { Blur } from './filters/Blur';
11
- import { Brighten } from './filters/Brighten';
12
- import { Contrast } from './filters/Contrast';
13
- import { Emboss } from './filters/Emboss';
14
- import { Enhance } from './filters/Enhance';
15
- import { Grayscale } from './filters/Grayscale';
16
- import { HSL } from './filters/HSL';
17
- import { HSV } from './filters/HSV';
18
- import { Invert } from './filters/Invert';
19
- import { Kaleidoscope } from './filters/Kaleidoscope';
20
- import { Mask } from './filters/Mask';
21
- import { Noise } from './filters/Noise';
22
- import { Pixelate } from './filters/Pixelate';
23
- import { Posterize } from './filters/Posterize';
24
- import { RGB } from './filters/RGB';
25
- import { RGBA } from './filters/RGBA';
26
- import { Sepia } from './filters/Sepia';
27
- import { Solarize } from './filters/Solarize';
28
- import { Threshold } from './filters/Threshold';
29
-
30
- declare namespace Konva {
31
- export let enableTrace: number;
32
- export let pixelRatio: number;
33
- export let autoDrawEnabled: boolean;
34
- export let dragDistance: number;
35
- export let angleDeg: boolean;
36
- export let showWarnings: boolean;
37
- export let capturePointerEventsEnabled: boolean;
38
- export let dragButtons: Array<number>;
39
- export let hitOnDragEnabled: boolean;
40
- export const isDragging: () => boolean;
41
- export const isDragReady: () => boolean;
42
-
43
- export type Vector2d = import('./types').Vector2d;
44
-
45
- export const Node: typeof import('./Node').Node;
46
- export type Node = import('./Node').Node;
47
- export type NodeConfig = import('./Node').NodeConfig;
48
-
49
- export type KonvaEventObject<
50
- EventType
51
- > = import('./Node').KonvaEventObject<EventType>;
52
-
53
- export type KonvaPointerEvent = import('./PointerEvents').KonvaPointerEvent;
54
-
55
- export type KonvaEventListener<
56
- This,
57
- EventType
58
- > = import('./Node').KonvaEventListener<This, EventType>;
59
-
60
- export const Container: typeof import('./Container').Container;
61
- export type Container = import('./Container').Container<Node>;
62
- export type ContainerConfig = import('./Container').ContainerConfig;
63
-
64
- export const Transform: typeof import('./Util').Transform;
65
- export type Transform = import('./Util').Transform;
66
-
67
- export const Util: typeof import('./Util').Util;
68
-
69
- export const Context: typeof import('./Context').Context;
70
- export type Context = import('./Context').Context;
71
-
72
- export const Stage: typeof import('./Stage').Stage;
73
- export type Stage = import('./Stage').Stage;
74
- export type StageConfig = import('./Stage').StageConfig;
75
- export const stages: typeof import('./Stage').stages;
76
-
77
- export const Layer: typeof import('./Layer').Layer;
78
- export type Layer = import('./Layer').Layer;
79
- export type LayerConfig = import('./Layer').LayerConfig;
80
-
81
- export const FastLayer: typeof import('./FastLayer').FastLayer;
82
- export type FastLayer = import('./FastLayer').FastLayer;
83
-
84
- export const Group: typeof import('./Group').Group;
85
- export type Group = import('./Group').Group;
86
- export type GroupConfig = import('./Group').GroupConfig;
87
-
88
- export const DD: typeof import('./DragAndDrop').DD;
89
-
90
- export const Shape: typeof import('./Shape').Shape;
91
- export type Shape = import('./Shape').Shape;
92
- export type ShapeConfig = import('./Shape').ShapeConfig;
93
- export const shapes: typeof import('./Shape').shapes;
94
-
95
- export const Animation: typeof import('./Animation').Animation;
96
- export type Animation = import('./Animation').Animation;
97
-
98
- export const Tween: typeof import('./Tween').Tween;
99
- export type Tween = import('./Tween').Tween;
100
- export type TweenConfig = import('./Tween').TweenConfig;
101
- export const Easings: typeof import('./Tween').Easings;
102
-
103
- export const Arc: typeof import('./shapes/Arc').Arc;
104
- export type Arc = import('./shapes/Arc').Arc;
105
- export type ArcConfig = import('./shapes/Arc').ArcConfig;
106
- export const Arrow: typeof import('./shapes/Arrow').Arrow;
107
- export type Arrow = import('./shapes/Arrow').Arrow;
108
- export type ArrowConfig = import('./shapes/Arrow').ArrowConfig;
109
- export const Circle: typeof import('./shapes/Circle').Circle;
110
- export type Circle = import('./shapes/Circle').Circle;
111
- export type CircleConfig = import('./shapes/Circle').CircleConfig;
112
- export const Ellipse: typeof import('./shapes/Ellipse').Ellipse;
113
- export type Ellipse = import('./shapes/Ellipse').Ellipse;
114
- export type EllipseConfig = import('./shapes/Ellipse').EllipseConfig;
115
- export const Image: typeof import('./shapes/Image').Image;
116
- export type Image = import('./shapes/Image').Image;
117
- export type ImageConfig = import('./shapes/Image').ImageConfig;
118
- export const Label: typeof import('./shapes/Label').Label;
119
- export type Label = import('./shapes/Label').Label;
120
- export type LabelConfig = import('./shapes/Label').LabelConfig;
121
- export const Tag: typeof import('./shapes/Label').Tag;
122
- export type Tag = import('./shapes/Label').Tag;
123
- export type TagConfig = import('./shapes/Label').TagConfig;
124
- export const Line: typeof import('./shapes/Line').Line;
125
- export type Line = import('./shapes/Line').Line;
126
- export type LineConfig = import('./shapes/Line').LineConfig;
127
- export const Path: typeof import('./shapes/Path').Path;
128
- export type Path = import('./shapes/Path').Path;
129
- export type PathConfig = import('./shapes/Path').PathConfig;
130
- export const Rect: typeof import('./shapes/Rect').Rect;
131
- export type Rect = import('./shapes/Rect').Rect;
132
- export type RectConfig = import('./shapes/Rect').RectConfig;
133
- export const RegularPolygon: typeof import('./shapes/RegularPolygon').RegularPolygon;
134
- export type RegularPolygon = import('./shapes/RegularPolygon').RegularPolygon;
135
- export type RegularPolygonConfig = import('./shapes/RegularPolygon').RegularPolygonConfig;
136
- export const Ring: typeof import('./shapes/Ring').Ring;
137
- export type Ring = import('./shapes/Ring').Ring;
138
- export type RingConfig = import('./shapes/Ring').RingConfig;
139
- export const Sprite: typeof import('./shapes/Sprite').Sprite;
140
- export type Sprite = import('./shapes/Sprite').Sprite;
141
- export type SpriteConfig = import('./shapes/Sprite').SpriteConfig;
142
- export const Star: typeof import('./shapes/Star').Star;
143
- export type Star = import('./shapes/Star').Star;
144
- export type StarConfig = import('./shapes/Star').StarConfig;
145
- export const Text: typeof import('./shapes/Text').Text;
146
- export type Text = import('./shapes/Text').Text;
147
- export type TextConfig = import('./shapes/Text').TextConfig;
148
- export const TextPath: typeof import('./shapes/TextPath').TextPath;
149
- export type TextPath = import('./shapes/TextPath').TextPath;
150
- export type TextPathConfig = import('./shapes/TextPath').TextPathConfig;
151
- export const Transformer: typeof import('./shapes/Transformer').Transformer;
152
- export type Transformer = import('./shapes/Transformer').Transformer;
153
- export type TransformerConfig = import('./shapes/Transformer').TransformerConfig;
154
- export const Wedge: typeof import('./shapes/Wedge').Wedge;
155
- export type Wedge = import('./shapes/Wedge').Wedge;
156
- export type WedgeConfig = import('./shapes/Wedge').WedgeConfig;
157
-
158
- export const Filters: {
159
- Blur: typeof Blur;
160
- Brighten: typeof Brighten;
161
- Contrast: typeof Contrast;
162
- Emboss: typeof Emboss;
163
- Enhance: typeof Enhance;
164
- Grayscale: typeof Grayscale;
165
- HSL: typeof HSL;
166
- HSV: typeof HSV;
167
- Invert: typeof Invert;
168
- Kaleidoscope: typeof Kaleidoscope;
169
- Mask: typeof Mask;
170
- Noise: typeof Noise;
171
- Pixelate: typeof Pixelate;
172
- Posterize: typeof Posterize;
173
- RGB: typeof RGB;
174
- RGBA: typeof RGBA;
175
- Sepia: typeof Sepia;
176
- Solarize: typeof Solarize;
177
- Threshold: typeof Threshold;
178
- };
179
- }
180
-
181
- export default Konva;
package/cmj/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { Konva } from './_FullInternals';
2
- export default Konva;
package/cmj/index.js DELETED
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const _FullInternals_1 = require("./_FullInternals");
4
- exports.default = _FullInternals_1.Konva;
package/cmj/package.json DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "type": "commonjs",
3
- "main": "./index-node.js",
4
- "browser": "./index.js",
5
- "typings": "./index-types.d.ts"
6
- }
@@ -1,26 +0,0 @@
1
- import { Shape, ShapeConfig } from '../Shape';
2
- import { GetSet } from '../types';
3
- import { Context } from '../Context';
4
- export interface ArcConfig extends ShapeConfig {
5
- angle: number;
6
- innerRadius: number;
7
- outerRadius: number;
8
- clockwise?: boolean;
9
- }
10
- export declare class Arc extends Shape<ArcConfig> {
11
- _sceneFunc(context: Context): void;
12
- getWidth(): number;
13
- getHeight(): number;
14
- setWidth(width: number): void;
15
- setHeight(height: number): void;
16
- getSelfRect(): {
17
- x: number;
18
- y: number;
19
- width: number;
20
- height: number;
21
- };
22
- innerRadius: GetSet<number, this>;
23
- outerRadius: GetSet<number, this>;
24
- angle: GetSet<number, this>;
25
- clockwise: GetSet<boolean, this>;
26
- }
package/cmj/shapes/Arc.js DELETED
@@ -1,59 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Arc = void 0;
4
- const Factory_1 = require("../Factory");
5
- const Shape_1 = require("../Shape");
6
- const Global_1 = require("../Global");
7
- const Validators_1 = require("../Validators");
8
- const Global_2 = require("../Global");
9
- class Arc extends Shape_1.Shape {
10
- _sceneFunc(context) {
11
- var angle = Global_1.Konva.getAngle(this.angle()), clockwise = this.clockwise();
12
- context.beginPath();
13
- context.arc(0, 0, this.outerRadius(), 0, angle, clockwise);
14
- context.arc(0, 0, this.innerRadius(), angle, 0, !clockwise);
15
- context.closePath();
16
- context.fillStrokeShape(this);
17
- }
18
- getWidth() {
19
- return this.outerRadius() * 2;
20
- }
21
- getHeight() {
22
- return this.outerRadius() * 2;
23
- }
24
- setWidth(width) {
25
- this.outerRadius(width / 2);
26
- }
27
- setHeight(height) {
28
- this.outerRadius(height / 2);
29
- }
30
- getSelfRect() {
31
- const innerRadius = this.innerRadius();
32
- const outerRadius = this.outerRadius();
33
- const clockwise = this.clockwise();
34
- const angle = Global_1.Konva.getAngle(clockwise ? 360 - this.angle() : this.angle());
35
- const boundLeftRatio = Math.cos(Math.min(angle, Math.PI));
36
- const boundRightRatio = 1;
37
- const boundTopRatio = Math.sin(Math.min(Math.max(Math.PI, angle), (3 * Math.PI) / 2));
38
- const boundBottomRatio = Math.sin(Math.min(angle, Math.PI / 2));
39
- const boundLeft = boundLeftRatio * (boundLeftRatio > 0 ? innerRadius : outerRadius);
40
- const boundRight = boundRightRatio * (boundRightRatio > 0 ? outerRadius : innerRadius);
41
- const boundTop = boundTopRatio * (boundTopRatio > 0 ? innerRadius : outerRadius);
42
- const boundBottom = boundBottomRatio * (boundBottomRatio > 0 ? outerRadius : innerRadius);
43
- return {
44
- x: boundLeft,
45
- y: clockwise ? -1 * boundBottom : boundTop,
46
- width: boundRight - boundLeft,
47
- height: boundBottom - boundTop,
48
- };
49
- }
50
- }
51
- exports.Arc = Arc;
52
- Arc.prototype._centroid = true;
53
- Arc.prototype.className = 'Arc';
54
- Arc.prototype._attrsAffectingSize = ['innerRadius', 'outerRadius'];
55
- (0, Global_2._registerNode)(Arc);
56
- Factory_1.Factory.addGetterSetter(Arc, 'innerRadius', 0, (0, Validators_1.getNumberValidator)());
57
- Factory_1.Factory.addGetterSetter(Arc, 'outerRadius', 0, (0, Validators_1.getNumberValidator)());
58
- Factory_1.Factory.addGetterSetter(Arc, 'angle', 0, (0, Validators_1.getNumberValidator)());
59
- Factory_1.Factory.addGetterSetter(Arc, 'clockwise', false, (0, Validators_1.getBooleanValidator)());
@@ -1,26 +0,0 @@
1
- import { Line, LineConfig } from './Line';
2
- import { GetSet } from '../types';
3
- import { Context } from '../Context';
4
- export interface ArrowConfig extends LineConfig {
5
- points: number[];
6
- tension?: number;
7
- closed?: boolean;
8
- pointerLength?: number;
9
- pointerWidth?: number;
10
- pointerAtBeginning?: boolean;
11
- pointerAtEnding?: boolean;
12
- }
13
- export declare class Arrow extends Line<ArrowConfig> {
14
- _sceneFunc(ctx: Context): void;
15
- __fillStroke(ctx: Context): void;
16
- getSelfRect(): {
17
- x: number;
18
- y: number;
19
- width: number;
20
- height: number;
21
- };
22
- pointerLength: GetSet<number, this>;
23
- pointerWidth: GetSet<number, this>;
24
- pointerAtEnding: GetSet<boolean, this>;
25
- pointerAtBeginning: GetSet<boolean, this>;
26
- }