konva 9.3.15 → 9.3.17

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 (68) hide show
  1. package/konva.js +821 -801
  2. package/konva.min.js +3 -3
  3. package/lib/Animation.js +1 -1
  4. package/lib/BezierFunctions.js +1 -2
  5. package/lib/Canvas.js +9 -9
  6. package/lib/Container.d.ts +1 -1
  7. package/lib/Container.js +29 -29
  8. package/lib/Context.d.ts +2 -2
  9. package/lib/Context.js +28 -28
  10. package/lib/DragAndDrop.d.ts +2 -2
  11. package/lib/DragAndDrop.js +6 -4
  12. package/lib/Factory.d.ts +18 -8
  13. package/lib/Factory.js +17 -16
  14. package/lib/Global.js +1 -1
  15. package/lib/Group.js +1 -1
  16. package/lib/Layer.js +17 -17
  17. package/lib/Node.d.ts +2 -2
  18. package/lib/Node.js +89 -89
  19. package/lib/PointerEvents.js +5 -6
  20. package/lib/Shape.d.ts +5 -0
  21. package/lib/Shape.js +37 -37
  22. package/lib/Stage.d.ts +2 -2
  23. package/lib/Stage.js +32 -31
  24. package/lib/Tween.js +31 -27
  25. package/lib/Util.d.ts +4 -4
  26. package/lib/Util.js +66 -65
  27. package/lib/Validators.d.ts +9 -9
  28. package/lib/Validators.js +12 -13
  29. package/lib/_CoreInternals.d.ts +8 -8
  30. package/lib/_FullInternals.d.ts +8 -8
  31. package/lib/filters/Blur.js +7 -6
  32. package/lib/filters/Brighten.js +2 -2
  33. package/lib/filters/Contrast.js +4 -3
  34. package/lib/filters/Emboss.js +22 -21
  35. package/lib/filters/Enhance.js +8 -7
  36. package/lib/filters/Grayscale.js +3 -3
  37. package/lib/filters/HSL.js +7 -7
  38. package/lib/filters/HSV.js +7 -7
  39. package/lib/filters/Invert.js +2 -2
  40. package/lib/filters/Kaleidoscope.js +44 -44
  41. package/lib/filters/Mask.js +58 -57
  42. package/lib/filters/Noise.js +2 -2
  43. package/lib/filters/Pixelate.js +1 -1
  44. package/lib/filters/Posterize.js +2 -2
  45. package/lib/filters/RGB.js +3 -4
  46. package/lib/filters/RGBA.js +3 -3
  47. package/lib/filters/Sepia.js +5 -5
  48. package/lib/filters/Solarize.js +8 -7
  49. package/lib/filters/Threshold.js +2 -2
  50. package/lib/shapes/Arc.js +1 -1
  51. package/lib/shapes/Arrow.js +12 -12
  52. package/lib/shapes/Ellipse.js +1 -1
  53. package/lib/shapes/Image.js +3 -3
  54. package/lib/shapes/Label.d.ts +3 -1
  55. package/lib/shapes/Label.js +6 -6
  56. package/lib/shapes/Line.d.ts +1 -1
  57. package/lib/shapes/Line.js +14 -14
  58. package/lib/shapes/Path.js +62 -62
  59. package/lib/shapes/Rect.js +1 -1
  60. package/lib/shapes/RegularPolygon.js +6 -6
  61. package/lib/shapes/Ring.js +1 -1
  62. package/lib/shapes/Sprite.js +9 -9
  63. package/lib/shapes/Star.js +5 -5
  64. package/lib/shapes/Text.js +48 -44
  65. package/lib/shapes/TextPath.js +25 -25
  66. package/lib/shapes/Transformer.d.ts +1 -1
  67. package/lib/shapes/Transformer.js +64 -64
  68. package/package.json +15 -17
package/lib/Util.js CHANGED
@@ -27,7 +27,7 @@ class Transform {
27
27
  tr.m[5] = this.m[5];
28
28
  }
29
29
  point(point) {
30
- var m = this.m;
30
+ const m = this.m;
31
31
  return {
32
32
  x: m[0] * point.x + m[2] * point.y + m[4],
33
33
  y: m[1] * point.x + m[3] * point.y + m[5],
@@ -46,12 +46,12 @@ class Transform {
46
46
  return this;
47
47
  }
48
48
  rotate(rad) {
49
- var c = Math.cos(rad);
50
- var s = Math.sin(rad);
51
- var m11 = this.m[0] * c + this.m[2] * s;
52
- var m12 = this.m[1] * c + this.m[3] * s;
53
- var m21 = this.m[0] * -s + this.m[2] * c;
54
- var m22 = this.m[1] * -s + this.m[3] * c;
49
+ const c = Math.cos(rad);
50
+ const s = Math.sin(rad);
51
+ const m11 = this.m[0] * c + this.m[2] * s;
52
+ const m12 = this.m[1] * c + this.m[3] * s;
53
+ const m21 = this.m[0] * -s + this.m[2] * c;
54
+ const m22 = this.m[1] * -s + this.m[3] * c;
55
55
  this.m[0] = m11;
56
56
  this.m[1] = m12;
57
57
  this.m[2] = m21;
@@ -65,10 +65,10 @@ class Transform {
65
65
  };
66
66
  }
67
67
  skew(sx, sy) {
68
- var m11 = this.m[0] + this.m[2] * sy;
69
- var m12 = this.m[1] + this.m[3] * sy;
70
- var m21 = this.m[2] + this.m[0] * sx;
71
- var m22 = this.m[3] + this.m[1] * sx;
68
+ const m11 = this.m[0] + this.m[2] * sy;
69
+ const m12 = this.m[1] + this.m[3] * sy;
70
+ const m21 = this.m[2] + this.m[0] * sx;
71
+ const m22 = this.m[3] + this.m[1] * sx;
72
72
  this.m[0] = m11;
73
73
  this.m[1] = m12;
74
74
  this.m[2] = m21;
@@ -76,12 +76,12 @@ class Transform {
76
76
  return this;
77
77
  }
78
78
  multiply(matrix) {
79
- var m11 = this.m[0] * matrix.m[0] + this.m[2] * matrix.m[1];
80
- var m12 = this.m[1] * matrix.m[0] + this.m[3] * matrix.m[1];
81
- var m21 = this.m[0] * matrix.m[2] + this.m[2] * matrix.m[3];
82
- var m22 = this.m[1] * matrix.m[2] + this.m[3] * matrix.m[3];
83
- var dx = this.m[0] * matrix.m[4] + this.m[2] * matrix.m[5] + this.m[4];
84
- var dy = this.m[1] * matrix.m[4] + this.m[3] * matrix.m[5] + this.m[5];
79
+ const m11 = this.m[0] * matrix.m[0] + this.m[2] * matrix.m[1];
80
+ const m12 = this.m[1] * matrix.m[0] + this.m[3] * matrix.m[1];
81
+ const m21 = this.m[0] * matrix.m[2] + this.m[2] * matrix.m[3];
82
+ const m22 = this.m[1] * matrix.m[2] + this.m[3] * matrix.m[3];
83
+ const dx = this.m[0] * matrix.m[4] + this.m[2] * matrix.m[5] + this.m[4];
84
+ const dy = this.m[1] * matrix.m[4] + this.m[3] * matrix.m[5] + this.m[5];
85
85
  this.m[0] = m11;
86
86
  this.m[1] = m12;
87
87
  this.m[2] = m21;
@@ -91,13 +91,13 @@ class Transform {
91
91
  return this;
92
92
  }
93
93
  invert() {
94
- var d = 1 / (this.m[0] * this.m[3] - this.m[1] * this.m[2]);
95
- var m0 = this.m[3] * d;
96
- var m1 = -this.m[1] * d;
97
- var m2 = -this.m[2] * d;
98
- var m3 = this.m[0] * d;
99
- var m4 = d * (this.m[2] * this.m[5] - this.m[3] * this.m[4]);
100
- var m5 = d * (this.m[1] * this.m[4] - this.m[0] * this.m[5]);
94
+ const d = 1 / (this.m[0] * this.m[3] - this.m[1] * this.m[2]);
95
+ const m0 = this.m[3] * d;
96
+ const m1 = -this.m[1] * d;
97
+ const m2 = -this.m[2] * d;
98
+ const m3 = this.m[0] * d;
99
+ const m4 = d * (this.m[2] * this.m[5] - this.m[3] * this.m[4]);
100
+ const m5 = d * (this.m[1] * this.m[4] - this.m[0] * this.m[5]);
101
101
  this.m[0] = m0;
102
102
  this.m[1] = m1;
103
103
  this.m[2] = m2;
@@ -110,14 +110,14 @@ class Transform {
110
110
  return this.m;
111
111
  }
112
112
  decompose() {
113
- var a = this.m[0];
114
- var b = this.m[1];
115
- var c = this.m[2];
116
- var d = this.m[3];
117
- var e = this.m[4];
118
- var f = this.m[5];
119
- var delta = a * d - b * c;
120
- let result = {
113
+ const a = this.m[0];
114
+ const b = this.m[1];
115
+ const c = this.m[2];
116
+ const d = this.m[3];
117
+ const e = this.m[4];
118
+ const f = this.m[5];
119
+ const delta = a * d - b * c;
120
+ const result = {
121
121
  x: e,
122
122
  y: f,
123
123
  rotation: 0,
@@ -127,7 +127,7 @@ class Transform {
127
127
  skewY: 0,
128
128
  };
129
129
  if (a != 0 || b != 0) {
130
- var r = Math.sqrt(a * a + b * b);
130
+ const r = Math.sqrt(a * a + b * b);
131
131
  result.rotation = b > 0 ? Math.acos(a / r) : -Math.acos(a / r);
132
132
  result.scaleX = r;
133
133
  result.scaleY = delta / r;
@@ -135,7 +135,7 @@ class Transform {
135
135
  result.skewY = 0;
136
136
  }
137
137
  else if (c != 0 || d != 0) {
138
- var s = Math.sqrt(c * c + d * d);
138
+ const s = Math.sqrt(c * c + d * d);
139
139
  result.rotation =
140
140
  Math.PI / 2 - (d > 0 ? Math.acos(-c / s) : -Math.acos(c / s));
141
141
  result.scaleX = delta / s;
@@ -150,7 +150,7 @@ class Transform {
150
150
  }
151
151
  }
152
152
  exports.Transform = Transform;
153
- var OBJECT_ARRAY = '[object Array]', OBJECT_NUMBER = '[object Number]', OBJECT_STRING = '[object String]', OBJECT_BOOLEAN = '[object Boolean]', PI_OVER_DEG180 = Math.PI / 180, DEG180_OVER_PI = 180 / Math.PI, HASH = '#', EMPTY_STRING = '', ZERO = '0', KONVA_WARNING = 'Konva warning: ', KONVA_ERROR = 'Konva error: ', RGB_PAREN = 'rgb(', COLORS = {
153
+ const OBJECT_ARRAY = '[object Array]', OBJECT_NUMBER = '[object Number]', OBJECT_STRING = '[object String]', OBJECT_BOOLEAN = '[object Boolean]', PI_OVER_DEG180 = Math.PI / 180, DEG180_OVER_PI = 180 / Math.PI, HASH = '#', EMPTY_STRING = '', ZERO = '0', KONVA_WARNING = 'Konva warning: ', KONVA_ERROR = 'Konva error: ', RGB_PAREN = 'rgb(', COLORS = {
154
154
  aliceblue: [240, 248, 255],
155
155
  antiquewhite: [250, 235, 215],
156
156
  aqua: [0, 255, 255],
@@ -300,7 +300,8 @@ var OBJECT_ARRAY = '[object Array]', OBJECT_NUMBER = '[object Number]', OBJECT_S
300
300
  whitesmoke: [245, 245, 245],
301
301
  yellow: [255, 255, 0],
302
302
  yellowgreen: [154, 205, 5],
303
- }, RGB_REGEX = /rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/, animQueue = [];
303
+ }, RGB_REGEX = /rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/;
304
+ let animQueue = [];
304
305
  const req = (typeof requestAnimationFrame !== 'undefined' && requestAnimationFrame) ||
305
306
  function (f) {
306
307
  setTimeout(f, 60);
@@ -336,7 +337,7 @@ exports.Util = {
336
337
  if (typeof selector !== 'string') {
337
338
  return false;
338
339
  }
339
- var firstChar = selector[0];
340
+ const firstChar = selector[0];
340
341
  return (firstChar === '#' ||
341
342
  firstChar === '.' ||
342
343
  firstChar === firstChar.toUpperCase());
@@ -365,7 +366,7 @@ exports.Util = {
365
366
  }
366
367
  },
367
368
  createCanvasElement() {
368
- var canvas = document.createElement('canvas');
369
+ const canvas = document.createElement('canvas');
369
370
  try {
370
371
  canvas.style = canvas.style || {};
371
372
  }
@@ -384,7 +385,7 @@ exports.Util = {
384
385
  return false;
385
386
  },
386
387
  _urlToImage(url, callback) {
387
- var imageObj = exports.Util.createImageElement();
388
+ const imageObj = exports.Util.createImageElement();
388
389
  imageObj.onload = function () {
389
390
  callback(imageObj);
390
391
  };
@@ -395,7 +396,7 @@ exports.Util = {
395
396
  },
396
397
  _hexToRgb(hex) {
397
398
  hex = hex.replace(HASH, EMPTY_STRING);
398
- var bigint = parseInt(hex, 16);
399
+ const bigint = parseInt(hex, 16);
399
400
  return {
400
401
  r: (bigint >> 16) & 255,
401
402
  g: (bigint >> 8) & 255,
@@ -403,14 +404,14 @@ exports.Util = {
403
404
  };
404
405
  },
405
406
  getRandomColor() {
406
- var randColor = ((Math.random() * 0xffffff) << 0).toString(16);
407
+ let randColor = ((Math.random() * 0xffffff) << 0).toString(16);
407
408
  while (randColor.length < 6) {
408
409
  randColor = ZERO + randColor;
409
410
  }
410
411
  return HASH + randColor;
411
412
  },
412
413
  getRGB(color) {
413
- var rgb;
414
+ let rgb;
414
415
  if (color in COLORS) {
415
416
  rgb = COLORS[color];
416
417
  return {
@@ -450,7 +451,7 @@ exports.Util = {
450
451
  exports.Util._hslColorToRGBA(str));
451
452
  },
452
453
  _namedColorToRBA(str) {
453
- var c = COLORS[str.toLowerCase()];
454
+ const c = COLORS[str.toLowerCase()];
454
455
  if (!c) {
455
456
  return null;
456
457
  }
@@ -464,7 +465,7 @@ exports.Util = {
464
465
  _rgbColorToRGBA(str) {
465
466
  if (str.indexOf('rgb(') === 0) {
466
467
  str = str.match(/rgb\(([^)]+)\)/)[1];
467
- var parts = str.split(/ *, */).map(Number);
468
+ const parts = str.split(/ *, */).map(Number);
468
469
  return {
469
470
  r: parts[0],
470
471
  g: parts[1],
@@ -476,7 +477,7 @@ exports.Util = {
476
477
  _rgbaColorToRGBA(str) {
477
478
  if (str.indexOf('rgba(') === 0) {
478
479
  str = str.match(/rgba\(([^)]+)\)/)[1];
479
- var parts = str.split(/ *, */).map((n, index) => {
480
+ const parts = str.split(/ *, */).map((n, index) => {
480
481
  if (n.slice(-1) === '%') {
481
482
  return index === 3 ? parseInt(n) / 100 : (parseInt(n) / 100) * 255;
482
483
  }
@@ -593,8 +594,8 @@ exports.Util = {
593
594
  r2.y + r2.height < r1.y);
594
595
  },
595
596
  cloneObject(obj) {
596
- var retObj = {};
597
- for (var key in obj) {
597
+ const retObj = {};
598
+ for (const key in obj) {
598
599
  if (this._isPlainObject(obj[key])) {
599
600
  retObj[key] = this.cloneObject(obj[key]);
600
601
  }
@@ -643,7 +644,7 @@ exports.Util = {
643
644
  console.warn(KONVA_WARNING + str);
644
645
  },
645
646
  each(obj, func) {
646
- for (var key in obj) {
647
+ for (const key in obj) {
647
648
  func(key, obj[key]);
648
649
  }
649
650
  },
@@ -651,15 +652,15 @@ exports.Util = {
651
652
  return left <= val && val < right;
652
653
  },
653
654
  _getProjectionToSegment(x1, y1, x2, y2, x3, y3) {
654
- var x, y, dist;
655
- var pd2 = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
655
+ let x, y, dist;
656
+ const pd2 = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
656
657
  if (pd2 == 0) {
657
658
  x = x1;
658
659
  y = y1;
659
660
  dist = (x3 - x2) * (x3 - x2) + (y3 - y2) * (y3 - y2);
660
661
  }
661
662
  else {
662
- var u = ((x3 - x1) * (x2 - x1) + (y3 - y1) * (y2 - y1)) / pd2;
663
+ const u = ((x3 - x1) * (x2 - x1) + (y3 - y1) * (y2 - y1)) / pd2;
663
664
  if (u < 0) {
664
665
  x = x1;
665
666
  y = y1;
@@ -679,15 +680,15 @@ exports.Util = {
679
680
  return [x, y, dist];
680
681
  },
681
682
  _getProjectionToLine(pt, line, isClosed) {
682
- var pc = exports.Util.cloneObject(pt);
683
- var dist = Number.MAX_VALUE;
683
+ const pc = exports.Util.cloneObject(pt);
684
+ let dist = Number.MAX_VALUE;
684
685
  line.forEach(function (p1, i) {
685
686
  if (!isClosed && i === line.length - 1) {
686
687
  return;
687
688
  }
688
- var p2 = line[(i + 1) % line.length];
689
- var proj = exports.Util._getProjectionToSegment(p1.x, p1.y, p2.x, p2.y, pt.x, pt.y);
690
- var px = proj[0], py = proj[1], pdist = proj[2];
689
+ const p2 = line[(i + 1) % line.length];
690
+ const proj = exports.Util._getProjectionToSegment(p1.x, p1.y, p2.x, p2.y, pt.x, pt.y);
691
+ const px = proj[0], py = proj[1], pdist = proj[2];
691
692
  if (pdist < dist) {
692
693
  pc.x = px;
693
694
  pc.y = py;
@@ -697,36 +698,36 @@ exports.Util = {
697
698
  return pc;
698
699
  },
699
700
  _prepareArrayForTween(startArray, endArray, isClosed) {
700
- var n, start = [], end = [];
701
+ const start = [], end = [];
701
702
  if (startArray.length > endArray.length) {
702
- var temp = endArray;
703
+ const temp = endArray;
703
704
  endArray = startArray;
704
705
  startArray = temp;
705
706
  }
706
- for (n = 0; n < startArray.length; n += 2) {
707
+ for (let n = 0; n < startArray.length; n += 2) {
707
708
  start.push({
708
709
  x: startArray[n],
709
710
  y: startArray[n + 1],
710
711
  });
711
712
  }
712
- for (n = 0; n < endArray.length; n += 2) {
713
+ for (let n = 0; n < endArray.length; n += 2) {
713
714
  end.push({
714
715
  x: endArray[n],
715
716
  y: endArray[n + 1],
716
717
  });
717
718
  }
718
- var newStart = [];
719
+ const newStart = [];
719
720
  end.forEach(function (point) {
720
- var pr = exports.Util._getProjectionToLine(point, start, isClosed);
721
+ const pr = exports.Util._getProjectionToLine(point, start, isClosed);
721
722
  newStart.push(pr.x);
722
723
  newStart.push(pr.y);
723
724
  });
724
725
  return newStart;
725
726
  },
726
727
  _prepareToStringify(obj) {
727
- var desc;
728
+ let desc;
728
729
  obj.visitedByCircularReferenceRemoval = true;
729
- for (var key in obj) {
730
+ for (const key in obj) {
730
731
  if (!(obj.hasOwnProperty(key) && obj[key] && typeof obj[key] == 'object')) {
731
732
  continue;
732
733
  }
@@ -753,7 +754,7 @@ exports.Util = {
753
754
  return obj;
754
755
  },
755
756
  _assign(target, source) {
756
- for (var key in source) {
757
+ for (const key in source) {
757
758
  target[key] = source[key];
758
759
  }
759
760
  return target;
@@ -1,11 +1,11 @@
1
1
  export declare function RGBComponent(val: number): number;
2
2
  export declare function alphaComponent(val: number): number;
3
- export declare function getNumberValidator(): (<T>(val: T, attr: string) => T | void) | undefined;
4
- export declare function getNumberOrArrayOfNumbersValidator(noOfElements: number): (<T>(val: T, attr: string) => T | void) | undefined;
5
- export declare function getNumberOrAutoValidator(): (<T extends string>(val: T, attr: string) => T | void) | undefined;
6
- export declare function getStringValidator(): ((val: any, attr: string) => any) | undefined;
7
- export declare function getStringOrGradientValidator(): ((val: any, attr: string) => any) | undefined;
8
- export declare function getFunctionValidator(): ((val: any, attr: string) => any) | undefined;
9
- export declare function getNumberArrayValidator(): ((val: any, attr: string) => any) | undefined;
10
- export declare function getBooleanValidator(): ((val: any, attr: string) => any) | undefined;
11
- export declare function getComponentValidator(components: any): ((val: any, attr: string) => any) | undefined;
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 CHANGED
@@ -1,6 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getComponentValidator = exports.getBooleanValidator = exports.getNumberArrayValidator = exports.getFunctionValidator = exports.getStringOrGradientValidator = exports.getStringValidator = exports.getNumberOrAutoValidator = exports.getNumberOrArrayOfNumbersValidator = exports.getNumberValidator = exports.alphaComponent = exports.RGBComponent = void 0;
3
+ exports.RGBComponent = RGBComponent;
4
+ exports.alphaComponent = alphaComponent;
5
+ exports.getNumberValidator = getNumberValidator;
6
+ exports.getNumberOrArrayOfNumbersValidator = getNumberOrArrayOfNumbersValidator;
7
+ exports.getNumberOrAutoValidator = getNumberOrAutoValidator;
8
+ exports.getStringValidator = getStringValidator;
9
+ exports.getStringOrGradientValidator = getStringOrGradientValidator;
10
+ exports.getFunctionValidator = getFunctionValidator;
11
+ exports.getNumberArrayValidator = getNumberArrayValidator;
12
+ exports.getBooleanValidator = getBooleanValidator;
13
+ exports.getComponentValidator = getComponentValidator;
4
14
  const Global_1 = require("./Global");
5
15
  const Util_1 = require("./Util");
6
16
  function _formatValue(val) {
@@ -24,7 +34,6 @@ function RGBComponent(val) {
24
34
  }
25
35
  return Math.round(val);
26
36
  }
27
- exports.RGBComponent = RGBComponent;
28
37
  function alphaComponent(val) {
29
38
  if (val > 1) {
30
39
  return 1;
@@ -34,7 +43,6 @@ function alphaComponent(val) {
34
43
  }
35
44
  return val;
36
45
  }
37
- exports.alphaComponent = alphaComponent;
38
46
  function getNumberValidator() {
39
47
  if (Global_1.Konva.isUnminified) {
40
48
  return function (val, attr) {
@@ -48,7 +56,6 @@ function getNumberValidator() {
48
56
  };
49
57
  }
50
58
  }
51
- exports.getNumberValidator = getNumberValidator;
52
59
  function getNumberOrArrayOfNumbersValidator(noOfElements) {
53
60
  if (Global_1.Konva.isUnminified) {
54
61
  return function (val, attr) {
@@ -66,7 +73,6 @@ function getNumberOrArrayOfNumbersValidator(noOfElements) {
66
73
  };
67
74
  }
68
75
  }
69
- exports.getNumberOrArrayOfNumbersValidator = getNumberOrArrayOfNumbersValidator;
70
76
  function getNumberOrAutoValidator() {
71
77
  if (Global_1.Konva.isUnminified) {
72
78
  return function (val, attr) {
@@ -82,7 +88,6 @@ function getNumberOrAutoValidator() {
82
88
  };
83
89
  }
84
90
  }
85
- exports.getNumberOrAutoValidator = getNumberOrAutoValidator;
86
91
  function getStringValidator() {
87
92
  if (Global_1.Konva.isUnminified) {
88
93
  return function (val, attr) {
@@ -96,13 +101,12 @@ function getStringValidator() {
96
101
  };
97
102
  }
98
103
  }
99
- exports.getStringValidator = getStringValidator;
100
104
  function getStringOrGradientValidator() {
101
105
  if (Global_1.Konva.isUnminified) {
102
106
  return function (val, attr) {
103
107
  const isString = Util_1.Util._isString(val);
104
108
  const isGradient = Object.prototype.toString.call(val) === '[object CanvasGradient]' ||
105
- (val && val.addColorStop);
109
+ (val && val['addColorStop']);
106
110
  if (!(isString || isGradient)) {
107
111
  Util_1.Util.warn(_formatValue(val) +
108
112
  ' is a not valid value for "' +
@@ -113,7 +117,6 @@ function getStringOrGradientValidator() {
113
117
  };
114
118
  }
115
119
  }
116
- exports.getStringOrGradientValidator = getStringOrGradientValidator;
117
120
  function getFunctionValidator() {
118
121
  if (Global_1.Konva.isUnminified) {
119
122
  return function (val, attr) {
@@ -127,7 +130,6 @@ function getFunctionValidator() {
127
130
  };
128
131
  }
129
132
  }
130
- exports.getFunctionValidator = getFunctionValidator;
131
133
  function getNumberArrayValidator() {
132
134
  if (Global_1.Konva.isUnminified) {
133
135
  return function (val, attr) {
@@ -156,7 +158,6 @@ function getNumberArrayValidator() {
156
158
  };
157
159
  }
158
160
  }
159
- exports.getNumberArrayValidator = getNumberArrayValidator;
160
161
  function getBooleanValidator() {
161
162
  if (Global_1.Konva.isUnminified) {
162
163
  return function (val, attr) {
@@ -171,7 +172,6 @@ function getBooleanValidator() {
171
172
  };
172
173
  }
173
174
  }
174
- exports.getBooleanValidator = getBooleanValidator;
175
175
  function getComponentValidator(components) {
176
176
  if (Global_1.Konva.isUnminified) {
177
177
  return function (val, attr) {
@@ -189,4 +189,3 @@ function getComponentValidator(components) {
189
189
  };
190
190
  }
191
191
  }
192
- exports.getComponentValidator = getComponentValidator;
@@ -48,11 +48,11 @@ export declare const Konva: {
48
48
  _isElement(obj: any): obj is Element;
49
49
  _isFunction(obj: any): boolean;
50
50
  _isPlainObject(obj: any): boolean;
51
- _isArray(obj: any): obj is any[];
51
+ _isArray(obj: any): obj is Array<any>;
52
52
  _isNumber(obj: any): obj is number;
53
53
  _isString(obj: any): obj is string;
54
54
  _isBoolean(obj: any): obj is boolean;
55
- isObject(val: any): val is Object;
55
+ isObject(val: any): val is object;
56
56
  isValidSelector(selector: any): boolean;
57
57
  _sign(number: number): 1 | -1;
58
58
  requestAnimFrame(callback: Function): void;
@@ -120,7 +120,7 @@ export declare const Konva: {
120
120
  } | undefined;
121
121
  haveIntersection(r1: import("./types").IRect, r2: import("./types.js").IRect): boolean;
122
122
  cloneObject<Any>(obj: Any): Any;
123
- cloneArray(arr: any[]): any[];
123
+ cloneArray(arr: Array<any>): any[];
124
124
  degToRad(deg: number): number;
125
125
  radToDeg(rad: number): number;
126
126
  _degToRad(deg: number): number;
@@ -130,13 +130,13 @@ export declare const Konva: {
130
130
  throw(str: string): never;
131
131
  error(str: string): void;
132
132
  warn(str: string): void;
133
- each(obj: Object, func: Function): void;
133
+ each(obj: object, func: Function): void;
134
134
  _inRange(val: number, left: number, right: number): boolean;
135
135
  _getProjectionToSegment(x1: any, y1: any, x2: any, y2: any, x3: any, y3: any): any[];
136
- _getProjectionToLine(pt: import("./types").Vector2d, line: import("./types").Vector2d[], isClosed: boolean): import("./types.js").Vector2d;
136
+ _getProjectionToLine(pt: import("./types").Vector2d, line: Array<import("./types").Vector2d>, isClosed: boolean): import("./types.js").Vector2d;
137
137
  _prepareArrayForTween(startArray: any, endArray: any, isClosed: any): number[];
138
138
  _prepareToStringify<T>(obj: any): T | null;
139
- _assign<T_1, U>(target: T_1, source: U): T_1 & U;
139
+ _assign<T, U>(target: T, source: U): T & U;
140
140
  _getFirstPointerId(evt: any): any;
141
141
  releaseCanvas(...canvases: HTMLCanvasElement[]): void;
142
142
  drawRoundedRectPath(context: Context, width: number, height: number, cornerRadius: number | number[]): void;
@@ -154,10 +154,10 @@ export declare const Konva: {
154
154
  justDragged: boolean;
155
155
  readonly node: Node<import("./Node.js").NodeConfig> | undefined;
156
156
  _dragElements: Map<number, {
157
- node: Node<import("./Node.js").NodeConfig>;
157
+ node: Node;
158
158
  startPointerPos: import("./types.js").Vector2d;
159
159
  offset: import("./types.js").Vector2d;
160
- pointerId?: number | undefined;
160
+ pointerId?: number;
161
161
  dragStatus: "ready" | "dragging" | "stopped";
162
162
  }>;
163
163
  _drag(evt: any): void;
@@ -53,11 +53,11 @@ export declare const Konva: {
53
53
  _isElement(obj: any): obj is Element;
54
54
  _isFunction(obj: any): boolean;
55
55
  _isPlainObject(obj: any): boolean;
56
- _isArray(obj: any): obj is any[];
56
+ _isArray(obj: any): obj is Array<any>;
57
57
  _isNumber(obj: any): obj is number;
58
58
  _isString(obj: any): obj is string;
59
59
  _isBoolean(obj: any): obj is boolean;
60
- isObject(val: any): val is Object;
60
+ isObject(val: any): val is object;
61
61
  isValidSelector(selector: any): boolean;
62
62
  _sign(number: number): 1 | -1;
63
63
  requestAnimFrame(callback: Function): void;
@@ -125,7 +125,7 @@ export declare const Konva: {
125
125
  } | undefined;
126
126
  haveIntersection(r1: import("./types").IRect, r2: import("./types.js").IRect): boolean;
127
127
  cloneObject<Any>(obj: Any): Any;
128
- cloneArray(arr: any[]): any[];
128
+ cloneArray(arr: Array<any>): any[];
129
129
  degToRad(deg: number): number;
130
130
  radToDeg(rad: number): number;
131
131
  _degToRad(deg: number): number;
@@ -135,13 +135,13 @@ export declare const Konva: {
135
135
  throw(str: string): never;
136
136
  error(str: string): void;
137
137
  warn(str: string): void;
138
- each(obj: Object, func: Function): void;
138
+ each(obj: object, func: Function): void;
139
139
  _inRange(val: number, left: number, right: number): boolean;
140
140
  _getProjectionToSegment(x1: any, y1: any, x2: any, y2: any, x3: any, y3: any): any[];
141
- _getProjectionToLine(pt: import("./types").Vector2d, line: import("./types").Vector2d[], isClosed: boolean): import("./types.js").Vector2d;
141
+ _getProjectionToLine(pt: import("./types").Vector2d, line: Array<import("./types").Vector2d>, isClosed: boolean): import("./types.js").Vector2d;
142
142
  _prepareArrayForTween(startArray: any, endArray: any, isClosed: any): number[];
143
143
  _prepareToStringify<T>(obj: any): T | null;
144
- _assign<T_1, U>(target: T_1, source: U): T_1 & U;
144
+ _assign<T, U>(target: T, source: U): T & U;
145
145
  _getFirstPointerId(evt: any): any;
146
146
  releaseCanvas(...canvases: HTMLCanvasElement[]): void;
147
147
  drawRoundedRectPath(context: import("./Context.js").Context, width: number, height: number, cornerRadius: number | number[]): void;
@@ -159,10 +159,10 @@ export declare const Konva: {
159
159
  justDragged: boolean;
160
160
  readonly node: import("./Node").Node<import("./Node.js").NodeConfig> | undefined;
161
161
  _dragElements: Map<number, {
162
- node: import("./Node").Node<import("./Node.js").NodeConfig>;
162
+ node: import("./Node.js").Node;
163
163
  startPointerPos: import("./types.js").Vector2d;
164
164
  offset: import("./types.js").Vector2d;
165
- pointerId?: number | undefined;
165
+ pointerId?: number;
166
166
  dragStatus: "ready" | "dragging" | "stopped";
167
167
  }>;
168
168
  _drag(evt: any): void;
@@ -11,7 +11,7 @@ function BlurStack() {
11
11
  this.a = 0;
12
12
  this.next = null;
13
13
  }
14
- var mul_table = [
14
+ const mul_table = [
15
15
  512, 512, 456, 512, 328, 456, 335, 512, 405, 328, 271, 456, 388, 335, 292,
16
16
  512, 454, 405, 364, 328, 298, 271, 496, 456, 420, 388, 360, 335, 312, 292,
17
17
  273, 512, 482, 454, 428, 405, 383, 364, 345, 328, 312, 298, 284, 271, 259,
@@ -30,7 +30,7 @@ var mul_table = [
30
30
  329, 326, 323, 320, 318, 315, 312, 310, 307, 304, 302, 299, 297, 294, 292,
31
31
  289, 287, 285, 282, 280, 278, 275, 273, 271, 269, 267, 265, 263, 261, 259,
32
32
  ];
33
- var shg_table = [
33
+ const shg_table = [
34
34
  9, 11, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17,
35
35
  17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19,
36
36
  19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
@@ -47,9 +47,10 @@ var shg_table = [
47
47
  24, 24, 24, 24, 24, 24, 24,
48
48
  ];
49
49
  function filterGaussBlurRGBA(imageData, radius) {
50
- var pixels = imageData.data, width = imageData.width, height = imageData.height;
51
- var x, y, i, p, yp, yi, yw, r_sum, g_sum, b_sum, a_sum, r_out_sum, g_out_sum, b_out_sum, a_out_sum, r_in_sum, g_in_sum, b_in_sum, a_in_sum, pr, pg, pb, pa, rbs;
52
- var div = radius + radius + 1, widthMinus1 = width - 1, heightMinus1 = height - 1, radiusPlus1 = radius + 1, sumFactor = (radiusPlus1 * (radiusPlus1 + 1)) / 2, stackStart = new BlurStack(), stackEnd = null, stack = stackStart, stackIn = null, stackOut = null, mul_sum = mul_table[radius], shg_sum = shg_table[radius];
50
+ const pixels = imageData.data, width = imageData.width, height = imageData.height;
51
+ let x, y, i, p, yp, yi, yw, r_sum, g_sum, b_sum, a_sum, r_out_sum, g_out_sum, b_out_sum, a_out_sum, r_in_sum, g_in_sum, b_in_sum, a_in_sum, pr, pg, pb, pa, rbs;
52
+ const div = radius + radius + 1, widthMinus1 = width - 1, heightMinus1 = height - 1, radiusPlus1 = radius + 1, sumFactor = (radiusPlus1 * (radiusPlus1 + 1)) / 2, stackStart = new BlurStack(), mul_sum = mul_table[radius], shg_sum = shg_table[radius];
53
+ let stackEnd = null, stack = stackStart, stackIn = null, stackOut = null;
53
54
  for (i = 1; i < div; i++) {
54
55
  stack = stack.next = new BlurStack();
55
56
  if (i === radiusPlus1) {
@@ -229,7 +230,7 @@ function filterGaussBlurRGBA(imageData, radius) {
229
230
  }
230
231
  }
231
232
  const Blur = function Blur(imageData) {
232
- var radius = Math.round(this.blurRadius());
233
+ const radius = Math.round(this.blurRadius());
233
234
  if (radius > 0) {
234
235
  filterGaussBlurRGBA(imageData, radius);
235
236
  }
@@ -5,8 +5,8 @@ const Factory_1 = require("../Factory");
5
5
  const Node_1 = require("../Node");
6
6
  const Validators_1 = require("../Validators");
7
7
  const Brighten = function (imageData) {
8
- var brightness = this.brightness() * 255, data = imageData.data, len = data.length, i;
9
- for (i = 0; i < len; i += 4) {
8
+ const brightness = this.brightness() * 255, data = imageData.data, len = data.length;
9
+ for (let i = 0; i < len; i += 4) {
10
10
  data[i] += brightness;
11
11
  data[i + 1] += brightness;
12
12
  data[i + 2] += brightness;
@@ -5,9 +5,10 @@ const Factory_1 = require("../Factory");
5
5
  const Node_1 = require("../Node");
6
6
  const Validators_1 = require("../Validators");
7
7
  const Contrast = function (imageData) {
8
- var adjust = Math.pow((this.contrast() + 100) / 100, 2);
9
- var data = imageData.data, nPixels = data.length, red = 150, green = 150, blue = 150, i;
10
- for (i = 0; i < nPixels; i += 4) {
8
+ const adjust = Math.pow((this.contrast() + 100) / 100, 2);
9
+ const data = imageData.data, nPixels = data.length;
10
+ let red = 150, green = 150, blue = 150;
11
+ for (let i = 0; i < nPixels; i += 4) {
11
12
  red = data[i];
12
13
  green = data[i + 1];
13
14
  blue = data[i + 2];