konva 8.4.2 → 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 (242) hide show
  1. package/README.md +1 -9
  2. package/konva.js +17669 -16968
  3. package/konva.min.js +3 -3
  4. package/lib/Animation.d.ts +2 -2
  5. package/lib/Animation.js +11 -7
  6. package/lib/BezierFunctions.d.ts +6 -0
  7. package/lib/BezierFunctions.js +791 -0
  8. package/lib/Canvas.d.ts +2 -1
  9. package/lib/Canvas.js +26 -18
  10. package/lib/Container.d.ts +4 -4
  11. package/lib/Container.js +16 -12
  12. package/lib/Context.d.ts +16 -13
  13. package/lib/Context.js +27 -19
  14. package/lib/Core.d.ts +2 -2
  15. package/lib/Core.js +7 -3
  16. package/lib/DragAndDrop.d.ts +3 -3
  17. package/lib/DragAndDrop.js +25 -22
  18. package/lib/Factory.js +27 -24
  19. package/lib/FastLayer.d.ts +1 -1
  20. package/lib/FastLayer.js +10 -6
  21. package/lib/Global.js +16 -12
  22. package/lib/Group.d.ts +3 -3
  23. package/lib/Group.js +10 -6
  24. package/lib/Layer.d.ts +9 -9
  25. package/lib/Layer.js +37 -33
  26. package/lib/Node.d.ts +8 -8
  27. package/lib/Node.js +95 -90
  28. package/lib/PointerEvents.d.ts +4 -4
  29. package/lib/PointerEvents.js +15 -7
  30. package/lib/Shape.d.ts +6 -4
  31. package/lib/Shape.js +90 -86
  32. package/lib/Stage.d.ts +7 -7
  33. package/lib/Stage.js +51 -47
  34. package/lib/Tween.d.ts +2 -2
  35. package/lib/Tween.js +26 -22
  36. package/lib/Util.d.ts +2 -2
  37. package/lib/Util.js +29 -25
  38. package/lib/Validators.js +58 -44
  39. package/lib/_CoreInternals.d.ts +29 -29
  40. package/lib/_CoreInternals.js +36 -33
  41. package/lib/_FullInternals.d.ts +67 -67
  42. package/lib/_FullInternals.js +78 -75
  43. package/lib/filters/Blur.d.ts +1 -1
  44. package/lib/filters/Blur.js +9 -5
  45. package/lib/filters/Brighten.d.ts +1 -1
  46. package/lib/filters/Brighten.js +9 -5
  47. package/lib/filters/Contrast.d.ts +1 -1
  48. package/lib/filters/Contrast.js +9 -5
  49. package/lib/filters/Emboss.d.ts +1 -1
  50. package/lib/filters/Emboss.js +14 -10
  51. package/lib/filters/Enhance.d.ts +1 -1
  52. package/lib/filters/Enhance.js +9 -5
  53. package/lib/filters/Grayscale.d.ts +1 -1
  54. package/lib/filters/Grayscale.js +5 -1
  55. package/lib/filters/HSL.d.ts +1 -1
  56. package/lib/filters/HSL.js +11 -7
  57. package/lib/filters/HSV.d.ts +1 -1
  58. package/lib/filters/HSV.js +11 -7
  59. package/lib/filters/Invert.d.ts +1 -1
  60. package/lib/filters/Invert.js +5 -1
  61. package/lib/filters/Kaleidoscope.d.ts +1 -1
  62. package/lib/filters/Kaleidoscope.js +13 -9
  63. package/lib/filters/Mask.d.ts +1 -1
  64. package/lib/filters/Mask.js +9 -5
  65. package/lib/filters/Noise.d.ts +1 -1
  66. package/lib/filters/Noise.js +9 -5
  67. package/lib/filters/Pixelate.d.ts +1 -1
  68. package/lib/filters/Pixelate.js +11 -7
  69. package/lib/filters/Posterize.d.ts +1 -1
  70. package/lib/filters/Posterize.js +9 -5
  71. package/lib/filters/RGB.d.ts +1 -1
  72. package/lib/filters/RGB.js +11 -7
  73. package/lib/filters/RGBA.d.ts +1 -1
  74. package/lib/filters/RGBA.js +12 -8
  75. package/lib/filters/Sepia.d.ts +1 -1
  76. package/lib/filters/Sepia.js +5 -1
  77. package/lib/filters/Solarize.d.ts +1 -1
  78. package/lib/filters/Solarize.js +5 -1
  79. package/lib/filters/Threshold.d.ts +1 -1
  80. package/lib/filters/Threshold.js +9 -5
  81. package/lib/index-node.d.ts +1 -1
  82. package/lib/index-node.js +7 -5
  83. package/lib/index-types.d.ts +124 -124
  84. package/lib/index.d.ts +1 -1
  85. package/lib/index.js +4 -2
  86. package/lib/shapes/Arc.d.ts +6 -5
  87. package/lib/shapes/Arc.js +17 -13
  88. package/lib/shapes/Arrow.d.ts +5 -4
  89. package/lib/shapes/Arrow.js +17 -13
  90. package/lib/shapes/Circle.d.ts +6 -5
  91. package/lib/shapes/Circle.js +11 -7
  92. package/lib/shapes/Ellipse.d.ts +6 -5
  93. package/lib/shapes/Ellipse.js +13 -9
  94. package/lib/shapes/Image.d.ts +5 -5
  95. package/lib/shapes/Image.js +21 -17
  96. package/lib/shapes/Label.d.ts +8 -7
  97. package/lib/shapes/Label.js +18 -13
  98. package/lib/shapes/Line.d.ts +3 -3
  99. package/lib/shapes/Line.js +14 -10
  100. package/lib/shapes/Path.d.ts +6 -3
  101. package/lib/shapes/Path.js +44 -43
  102. package/lib/shapes/Rect.d.ts +3 -3
  103. package/lib/shapes/Rect.js +13 -9
  104. package/lib/shapes/RegularPolygon.d.ts +6 -5
  105. package/lib/shapes/RegularPolygon.js +12 -8
  106. package/lib/shapes/Ring.d.ts +6 -5
  107. package/lib/shapes/Ring.js +12 -8
  108. package/lib/shapes/Sprite.d.ts +7 -6
  109. package/lib/shapes/Sprite.js +19 -15
  110. package/lib/shapes/Star.d.ts +6 -5
  111. package/lib/shapes/Star.js +13 -9
  112. package/lib/shapes/Text.d.ts +8 -7
  113. package/lib/shapes/Text.js +31 -26
  114. package/lib/shapes/TextPath.d.ts +12 -7
  115. package/lib/shapes/TextPath.js +82 -188
  116. package/lib/shapes/Transformer.d.ts +10 -10
  117. package/lib/shapes/Transformer.js +92 -81
  118. package/lib/shapes/Wedge.d.ts +6 -5
  119. package/lib/shapes/Wedge.js +16 -12
  120. package/lib/types.d.ts +6 -0
  121. package/lib/types.js +5 -2
  122. package/package.json +13 -42
  123. package/cmj/Animation.d.ts +0 -24
  124. package/cmj/Animation.js +0 -145
  125. package/cmj/Canvas.d.ts +0 -32
  126. package/cmj/Canvas.js +0 -114
  127. package/cmj/Container.d.ts +0 -47
  128. package/cmj/Container.js +0 -325
  129. package/cmj/Context.d.ts +0 -84
  130. package/cmj/Context.js +0 -538
  131. package/cmj/Core.d.ts +0 -3
  132. package/cmj/Core.js +0 -7
  133. package/cmj/DragAndDrop.d.ts +0 -17
  134. package/cmj/DragAndDrop.js +0 -111
  135. package/cmj/Factory.d.ts +0 -11
  136. package/cmj/Factory.js +0 -125
  137. package/cmj/FastLayer.d.ts +0 -4
  138. package/cmj/FastLayer.js +0 -16
  139. package/cmj/Global.d.ts +0 -34
  140. package/cmj/Global.js +0 -61
  141. package/cmj/Group.d.ts +0 -8
  142. package/cmj/Group.js +0 -17
  143. package/cmj/Layer.d.ts +0 -61
  144. package/cmj/Layer.js +0 -309
  145. package/cmj/Node.d.ts +0 -328
  146. package/cmj/Node.js +0 -1420
  147. package/cmj/PointerEvents.d.ts +0 -11
  148. package/cmj/PointerEvents.js +0 -45
  149. package/cmj/Shape.d.ts +0 -184
  150. package/cmj/Shape.js +0 -521
  151. package/cmj/Stage.d.ts +0 -85
  152. package/cmj/Stage.js +0 -692
  153. package/cmj/Tween.d.ts +0 -86
  154. package/cmj/Tween.js +0 -520
  155. package/cmj/Util.d.ts +0 -91
  156. package/cmj/Util.js +0 -801
  157. package/cmj/Validators.d.ts +0 -11
  158. package/cmj/Validators.js +0 -192
  159. package/cmj/_CoreInternals.d.ts +0 -152
  160. package/cmj/_CoreInternals.js +0 -37
  161. package/cmj/_FullInternals.d.ts +0 -196
  162. package/cmj/_FullInternals.js +0 -81
  163. package/cmj/filters/Blur.d.ts +0 -2
  164. package/cmj/filters/Blur.js +0 -701
  165. package/cmj/filters/Brighten.d.ts +0 -2
  166. package/cmj/filters/Brighten.js +0 -16
  167. package/cmj/filters/Contrast.d.ts +0 -2
  168. package/cmj/filters/Contrast.js +0 -38
  169. package/cmj/filters/Emboss.d.ts +0 -2
  170. package/cmj/filters/Emboss.js +0 -106
  171. package/cmj/filters/Enhance.d.ts +0 -2
  172. package/cmj/filters/Enhance.js +0 -87
  173. package/cmj/filters/Grayscale.d.ts +0 -2
  174. package/cmj/filters/Grayscale.js +0 -13
  175. package/cmj/filters/HSL.d.ts +0 -2
  176. package/cmj/filters/HSL.js +0 -28
  177. package/cmj/filters/HSV.d.ts +0 -2
  178. package/cmj/filters/HSV.js +0 -28
  179. package/cmj/filters/Invert.d.ts +0 -2
  180. package/cmj/filters/Invert.js +0 -12
  181. package/cmj/filters/Kaleidoscope.d.ts +0 -2
  182. package/cmj/filters/Kaleidoscope.js +0 -137
  183. package/cmj/filters/Mask.d.ts +0 -2
  184. package/cmj/filters/Mask.js +0 -144
  185. package/cmj/filters/Noise.d.ts +0 -2
  186. package/cmj/filters/Noise.js +0 -16
  187. package/cmj/filters/Pixelate.d.ts +0 -2
  188. package/cmj/filters/Pixelate.js +0 -64
  189. package/cmj/filters/Posterize.d.ts +0 -2
  190. package/cmj/filters/Posterize.js +0 -14
  191. package/cmj/filters/RGB.d.ts +0 -2
  192. package/cmj/filters/RGB.js +0 -43
  193. package/cmj/filters/RGBA.d.ts +0 -2
  194. package/cmj/filters/RGBA.js +0 -53
  195. package/cmj/filters/Sepia.d.ts +0 -2
  196. package/cmj/filters/Sepia.js +0 -15
  197. package/cmj/filters/Solarize.d.ts +0 -2
  198. package/cmj/filters/Solarize.js +0 -29
  199. package/cmj/filters/Threshold.d.ts +0 -2
  200. package/cmj/filters/Threshold.js +0 -14
  201. package/cmj/index-node.d.ts +0 -2
  202. package/cmj/index-node.js +0 -21
  203. package/cmj/index-types.d.ts +0 -181
  204. package/cmj/index.d.ts +0 -2
  205. package/cmj/index.js +0 -4
  206. package/cmj/package.json +0 -6
  207. package/cmj/shapes/Arc.d.ts +0 -25
  208. package/cmj/shapes/Arc.js +0 -59
  209. package/cmj/shapes/Arrow.d.ts +0 -25
  210. package/cmj/shapes/Arrow.js +0 -103
  211. package/cmj/shapes/Circle.d.ts +0 -13
  212. package/cmj/shapes/Circle.js +0 -37
  213. package/cmj/shapes/Ellipse.d.ts +0 -16
  214. package/cmj/shapes/Ellipse.js +0 -41
  215. package/cmj/shapes/Image.d.ts +0 -25
  216. package/cmj/shapes/Image.js +0 -117
  217. package/cmj/shapes/Label.d.ts +0 -35
  218. package/cmj/shapes/Label.js +0 -178
  219. package/cmj/shapes/Line.d.ts +0 -28
  220. package/cmj/shapes/Line.js +0 -159
  221. package/cmj/shapes/Path.d.ts +0 -37
  222. package/cmj/shapes/Path.js +0 -631
  223. package/cmj/shapes/Rect.d.ts +0 -10
  224. package/cmj/shapes/Rect.js +0 -26
  225. package/cmj/shapes/RegularPolygon.d.ts +0 -22
  226. package/cmj/shapes/RegularPolygon.js +0 -69
  227. package/cmj/shapes/Ring.d.ts +0 -15
  228. package/cmj/shapes/Ring.js +0 -37
  229. package/cmj/shapes/Sprite.d.ts +0 -30
  230. package/cmj/shapes/Sprite.js +0 -112
  231. package/cmj/shapes/Star.d.ts +0 -17
  232. package/cmj/shapes/Star.js +0 -42
  233. package/cmj/shapes/Text.d.ts +0 -62
  234. package/cmj/shapes/Text.js +0 -373
  235. package/cmj/shapes/TextPath.d.ts +0 -55
  236. package/cmj/shapes/TextPath.js +0 -351
  237. package/cmj/shapes/Transformer.d.ts +0 -116
  238. package/cmj/shapes/Transformer.js +0 -964
  239. package/cmj/shapes/Wedge.d.ts +0 -17
  240. package/cmj/shapes/Wedge.js +0 -42
  241. package/cmj/types.d.ts +0 -50
  242. package/cmj/types.js +0 -25
package/lib/Shape.js CHANGED
@@ -1,10 +1,13 @@
1
- import { Konva } from './Global.js';
2
- import { Transform, Util } from './Util.js';
3
- import { Factory } from './Factory.js';
4
- import { Node } from './Node.js';
5
- import { getNumberValidator, getNumberOrAutoValidator, getStringValidator, getBooleanValidator, getStringOrGradientValidator, } from './Validators.js';
6
- import { _registerNode } from './Global.js';
7
- import * as PointerEvents from './PointerEvents.js';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Shape = exports.shapes = void 0;
4
+ const Global_1 = require("./Global");
5
+ const Util_1 = require("./Util");
6
+ const Factory_1 = require("./Factory");
7
+ const Node_1 = require("./Node");
8
+ const Validators_1 = require("./Validators");
9
+ const Global_2 = require("./Global");
10
+ const PointerEvents = require("./PointerEvents");
8
11
  var HAS_SHADOW = 'hasShadow';
9
12
  var SHADOW_RGBA = 'shadowRGBA';
10
13
  var patternImage = 'patternImage';
@@ -15,10 +18,10 @@ function getDummyContext() {
15
18
  if (dummyContext) {
16
19
  return dummyContext;
17
20
  }
18
- dummyContext = Util.createCanvasElement().getContext('2d');
21
+ dummyContext = Util_1.Util.createCanvasElement().getContext('2d');
19
22
  return dummyContext;
20
23
  }
21
- export const shapes = {};
24
+ exports.shapes = {};
22
25
  function _fillFunc(context) {
23
26
  context.fill();
24
27
  }
@@ -46,25 +49,25 @@ function _clearLinearGradientCache() {
46
49
  function _clearRadialGradientCache() {
47
50
  this._clearCache(radialGradient);
48
51
  }
49
- export class Shape extends Node {
52
+ class Shape extends Node_1.Node {
50
53
  constructor(config) {
51
54
  super(config);
52
55
  let key;
53
56
  while (true) {
54
- key = Util.getRandomColor();
55
- if (key && !(key in shapes)) {
57
+ key = Util_1.Util.getRandomColor();
58
+ if (key && !(key in exports.shapes)) {
56
59
  break;
57
60
  }
58
61
  }
59
62
  this.colorKey = key;
60
- shapes[key] = this;
63
+ exports.shapes[key] = this;
61
64
  }
62
65
  getContext() {
63
- Util.warn('shape.getContext() method is deprecated. Please do not use it.');
66
+ Util_1.Util.warn('shape.getContext() method is deprecated. Please do not use it.');
64
67
  return this.getLayer().getContext();
65
68
  }
66
69
  getCanvas() {
67
- Util.warn('shape.getCanvas() method is deprecated. Please do not use it.');
70
+ Util_1.Util.warn('shape.getCanvas() method is deprecated. Please do not use it.');
68
71
  return this.getLayer().getCanvas();
69
72
  }
70
73
  getSceneFunc() {
@@ -92,9 +95,9 @@ export class Shape extends Node {
92
95
  var ctx = getDummyContext();
93
96
  const pattern = ctx.createPattern(this.fillPatternImage(), this.fillPatternRepeat() || 'repeat');
94
97
  if (pattern && pattern.setTransform) {
95
- const tr = new Transform();
98
+ const tr = new Util_1.Transform();
96
99
  tr.translate(this.fillPatternX(), this.fillPatternY());
97
- tr.rotate(Konva.getAngle(this.fillPatternRotation()));
100
+ tr.rotate(Global_1.Konva.getAngle(this.fillPatternRotation()));
98
101
  tr.scale(this.fillPatternScaleX(), this.fillPatternScaleY());
99
102
  tr.translate(-1 * this.fillPatternOffsetX(), -1 * this.fillPatternOffsetY());
100
103
  const m = tr.getMatrix();
@@ -152,7 +155,7 @@ export class Shape extends Node {
152
155
  if (!this.hasShadow()) {
153
156
  return;
154
157
  }
155
- var rgba = Util.colorToRGBA(this.shadowColor());
158
+ var rgba = Util_1.Util.colorToRGBA(this.shadowColor());
156
159
  if (rgba) {
157
160
  return ('rgba(' +
158
161
  rgba.r +
@@ -207,8 +210,8 @@ export class Shape extends Node {
207
210
  return p[3] > 0;
208
211
  }
209
212
  destroy() {
210
- Node.prototype.destroy.call(this);
211
- delete shapes[this.colorKey];
213
+ Node_1.Node.prototype.destroy.call(this);
214
+ delete exports.shapes[this.colorKey];
212
215
  delete this.colorKey;
213
216
  return this;
214
217
  }
@@ -235,7 +238,7 @@ export class Shape extends Node {
235
238
  return false;
236
239
  }
237
240
  setStrokeHitEnabled(val) {
238
- Util.warn('strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead.');
241
+ Util_1.Util.warn('strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead.');
239
242
  if (val) {
240
243
  this.hitStrokeWidth('auto');
241
244
  }
@@ -351,7 +354,7 @@ export class Shape extends Node {
351
354
  }
352
355
  var layer = this.getLayer(), canvas = can || layer.hitCanvas, context = canvas && canvas.getContext(), drawFunc = this.hitFunc() || this.sceneFunc(), cachedCanvas = this._getCanvasCache(), cachedHitCanvas = cachedCanvas && cachedCanvas.hit;
353
356
  if (!this.colorKey) {
354
- Util.warn('Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()');
357
+ Util_1.Util.warn('Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()');
355
358
  }
356
359
  if (cachedHitCanvas) {
357
360
  context.save();
@@ -383,7 +386,7 @@ export class Shape extends Node {
383
386
  hitImageData = hitContext.getImageData(0, 0, hitWidth, hitHeight);
384
387
  hitData = hitImageData.data;
385
388
  len = hitData.length;
386
- rgbColorKey = Util._hexToRgb(this.colorKey);
389
+ rgbColorKey = Util_1.Util._hexToRgb(this.colorKey);
387
390
  for (i = 0; i < len; i += 4) {
388
391
  alpha = hitData[i + 3];
389
392
  if (alpha > alphaThreshold) {
@@ -399,7 +402,7 @@ export class Shape extends Node {
399
402
  hitContext.putImageData(hitImageData, 0, 0);
400
403
  }
401
404
  catch (e) {
402
- Util.error('Unable to draw hit graph from cached scene canvas. ' + e.message);
405
+ Util_1.Util.error('Unable to draw hit graph from cached scene canvas. ' + e.message);
403
406
  }
404
407
  return this;
405
408
  }
@@ -413,98 +416,99 @@ export class Shape extends Node {
413
416
  PointerEvents.releaseCapture(pointerId, this);
414
417
  }
415
418
  }
419
+ exports.Shape = Shape;
416
420
  Shape.prototype._fillFunc = _fillFunc;
417
421
  Shape.prototype._strokeFunc = _strokeFunc;
418
422
  Shape.prototype._fillFuncHit = _fillFuncHit;
419
423
  Shape.prototype._strokeFuncHit = _strokeFuncHit;
420
424
  Shape.prototype._centroid = false;
421
425
  Shape.prototype.nodeType = 'Shape';
422
- _registerNode(Shape);
426
+ (0, Global_2._registerNode)(Shape);
423
427
  Shape.prototype.eventListeners = {};
424
428
  Shape.prototype.on.call(Shape.prototype, 'shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva', _clearHasShadowCache);
425
429
  Shape.prototype.on.call(Shape.prototype, 'shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva', _clearGetShadowRGBACache);
426
430
  Shape.prototype.on.call(Shape.prototype, 'fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva', _clearFillPatternCache);
427
431
  Shape.prototype.on.call(Shape.prototype, 'fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva', _clearLinearGradientCache);
428
432
  Shape.prototype.on.call(Shape.prototype, 'fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva', _clearRadialGradientCache);
429
- Factory.addGetterSetter(Shape, 'stroke', undefined, getStringOrGradientValidator());
430
- Factory.addGetterSetter(Shape, 'strokeWidth', 2, getNumberValidator());
431
- Factory.addGetterSetter(Shape, 'fillAfterStrokeEnabled', false);
432
- Factory.addGetterSetter(Shape, 'hitStrokeWidth', 'auto', getNumberOrAutoValidator());
433
- Factory.addGetterSetter(Shape, 'strokeHitEnabled', true, getBooleanValidator());
434
- Factory.addGetterSetter(Shape, 'perfectDrawEnabled', true, getBooleanValidator());
435
- Factory.addGetterSetter(Shape, 'shadowForStrokeEnabled', true, getBooleanValidator());
436
- Factory.addGetterSetter(Shape, 'lineJoin');
437
- Factory.addGetterSetter(Shape, 'lineCap');
438
- Factory.addGetterSetter(Shape, 'sceneFunc');
439
- Factory.addGetterSetter(Shape, 'hitFunc');
440
- Factory.addGetterSetter(Shape, 'dash');
441
- Factory.addGetterSetter(Shape, 'dashOffset', 0, getNumberValidator());
442
- Factory.addGetterSetter(Shape, 'shadowColor', undefined, getStringValidator());
443
- Factory.addGetterSetter(Shape, 'shadowBlur', 0, getNumberValidator());
444
- Factory.addGetterSetter(Shape, 'shadowOpacity', 1, getNumberValidator());
445
- Factory.addComponentsGetterSetter(Shape, 'shadowOffset', ['x', 'y']);
446
- Factory.addGetterSetter(Shape, 'shadowOffsetX', 0, getNumberValidator());
447
- Factory.addGetterSetter(Shape, 'shadowOffsetY', 0, getNumberValidator());
448
- Factory.addGetterSetter(Shape, 'fillPatternImage');
449
- Factory.addGetterSetter(Shape, 'fill', undefined, getStringOrGradientValidator());
450
- Factory.addGetterSetter(Shape, 'fillPatternX', 0, getNumberValidator());
451
- Factory.addGetterSetter(Shape, 'fillPatternY', 0, getNumberValidator());
452
- Factory.addGetterSetter(Shape, 'fillLinearGradientColorStops');
453
- Factory.addGetterSetter(Shape, 'strokeLinearGradientColorStops');
454
- Factory.addGetterSetter(Shape, 'fillRadialGradientStartRadius', 0);
455
- Factory.addGetterSetter(Shape, 'fillRadialGradientEndRadius', 0);
456
- Factory.addGetterSetter(Shape, 'fillRadialGradientColorStops');
457
- Factory.addGetterSetter(Shape, 'fillPatternRepeat', 'repeat');
458
- Factory.addGetterSetter(Shape, 'fillEnabled', true);
459
- Factory.addGetterSetter(Shape, 'strokeEnabled', true);
460
- Factory.addGetterSetter(Shape, 'shadowEnabled', true);
461
- Factory.addGetterSetter(Shape, 'dashEnabled', true);
462
- Factory.addGetterSetter(Shape, 'strokeScaleEnabled', true);
463
- Factory.addGetterSetter(Shape, 'fillPriority', 'color');
464
- Factory.addComponentsGetterSetter(Shape, 'fillPatternOffset', ['x', 'y']);
465
- Factory.addGetterSetter(Shape, 'fillPatternOffsetX', 0, getNumberValidator());
466
- Factory.addGetterSetter(Shape, 'fillPatternOffsetY', 0, getNumberValidator());
467
- Factory.addComponentsGetterSetter(Shape, 'fillPatternScale', ['x', 'y']);
468
- Factory.addGetterSetter(Shape, 'fillPatternScaleX', 1, getNumberValidator());
469
- Factory.addGetterSetter(Shape, 'fillPatternScaleY', 1, getNumberValidator());
470
- Factory.addComponentsGetterSetter(Shape, 'fillLinearGradientStartPoint', [
433
+ Factory_1.Factory.addGetterSetter(Shape, 'stroke', undefined, (0, Validators_1.getStringOrGradientValidator)());
434
+ Factory_1.Factory.addGetterSetter(Shape, 'strokeWidth', 2, (0, Validators_1.getNumberValidator)());
435
+ Factory_1.Factory.addGetterSetter(Shape, 'fillAfterStrokeEnabled', false);
436
+ Factory_1.Factory.addGetterSetter(Shape, 'hitStrokeWidth', 'auto', (0, Validators_1.getNumberOrAutoValidator)());
437
+ Factory_1.Factory.addGetterSetter(Shape, 'strokeHitEnabled', true, (0, Validators_1.getBooleanValidator)());
438
+ Factory_1.Factory.addGetterSetter(Shape, 'perfectDrawEnabled', true, (0, Validators_1.getBooleanValidator)());
439
+ Factory_1.Factory.addGetterSetter(Shape, 'shadowForStrokeEnabled', true, (0, Validators_1.getBooleanValidator)());
440
+ Factory_1.Factory.addGetterSetter(Shape, 'lineJoin');
441
+ Factory_1.Factory.addGetterSetter(Shape, 'lineCap');
442
+ Factory_1.Factory.addGetterSetter(Shape, 'sceneFunc');
443
+ Factory_1.Factory.addGetterSetter(Shape, 'hitFunc');
444
+ Factory_1.Factory.addGetterSetter(Shape, 'dash');
445
+ Factory_1.Factory.addGetterSetter(Shape, 'dashOffset', 0, (0, Validators_1.getNumberValidator)());
446
+ Factory_1.Factory.addGetterSetter(Shape, 'shadowColor', undefined, (0, Validators_1.getStringValidator)());
447
+ Factory_1.Factory.addGetterSetter(Shape, 'shadowBlur', 0, (0, Validators_1.getNumberValidator)());
448
+ Factory_1.Factory.addGetterSetter(Shape, 'shadowOpacity', 1, (0, Validators_1.getNumberValidator)());
449
+ Factory_1.Factory.addComponentsGetterSetter(Shape, 'shadowOffset', ['x', 'y']);
450
+ Factory_1.Factory.addGetterSetter(Shape, 'shadowOffsetX', 0, (0, Validators_1.getNumberValidator)());
451
+ Factory_1.Factory.addGetterSetter(Shape, 'shadowOffsetY', 0, (0, Validators_1.getNumberValidator)());
452
+ Factory_1.Factory.addGetterSetter(Shape, 'fillPatternImage');
453
+ Factory_1.Factory.addGetterSetter(Shape, 'fill', undefined, (0, Validators_1.getStringOrGradientValidator)());
454
+ Factory_1.Factory.addGetterSetter(Shape, 'fillPatternX', 0, (0, Validators_1.getNumberValidator)());
455
+ Factory_1.Factory.addGetterSetter(Shape, 'fillPatternY', 0, (0, Validators_1.getNumberValidator)());
456
+ Factory_1.Factory.addGetterSetter(Shape, 'fillLinearGradientColorStops');
457
+ Factory_1.Factory.addGetterSetter(Shape, 'strokeLinearGradientColorStops');
458
+ Factory_1.Factory.addGetterSetter(Shape, 'fillRadialGradientStartRadius', 0);
459
+ Factory_1.Factory.addGetterSetter(Shape, 'fillRadialGradientEndRadius', 0);
460
+ Factory_1.Factory.addGetterSetter(Shape, 'fillRadialGradientColorStops');
461
+ Factory_1.Factory.addGetterSetter(Shape, 'fillPatternRepeat', 'repeat');
462
+ Factory_1.Factory.addGetterSetter(Shape, 'fillEnabled', true);
463
+ Factory_1.Factory.addGetterSetter(Shape, 'strokeEnabled', true);
464
+ Factory_1.Factory.addGetterSetter(Shape, 'shadowEnabled', true);
465
+ Factory_1.Factory.addGetterSetter(Shape, 'dashEnabled', true);
466
+ Factory_1.Factory.addGetterSetter(Shape, 'strokeScaleEnabled', true);
467
+ Factory_1.Factory.addGetterSetter(Shape, 'fillPriority', 'color');
468
+ Factory_1.Factory.addComponentsGetterSetter(Shape, 'fillPatternOffset', ['x', 'y']);
469
+ Factory_1.Factory.addGetterSetter(Shape, 'fillPatternOffsetX', 0, (0, Validators_1.getNumberValidator)());
470
+ Factory_1.Factory.addGetterSetter(Shape, 'fillPatternOffsetY', 0, (0, Validators_1.getNumberValidator)());
471
+ Factory_1.Factory.addComponentsGetterSetter(Shape, 'fillPatternScale', ['x', 'y']);
472
+ Factory_1.Factory.addGetterSetter(Shape, 'fillPatternScaleX', 1, (0, Validators_1.getNumberValidator)());
473
+ Factory_1.Factory.addGetterSetter(Shape, 'fillPatternScaleY', 1, (0, Validators_1.getNumberValidator)());
474
+ Factory_1.Factory.addComponentsGetterSetter(Shape, 'fillLinearGradientStartPoint', [
471
475
  'x',
472
476
  'y',
473
477
  ]);
474
- Factory.addComponentsGetterSetter(Shape, 'strokeLinearGradientStartPoint', [
478
+ Factory_1.Factory.addComponentsGetterSetter(Shape, 'strokeLinearGradientStartPoint', [
475
479
  'x',
476
480
  'y',
477
481
  ]);
478
- Factory.addGetterSetter(Shape, 'fillLinearGradientStartPointX', 0);
479
- Factory.addGetterSetter(Shape, 'strokeLinearGradientStartPointX', 0);
480
- Factory.addGetterSetter(Shape, 'fillLinearGradientStartPointY', 0);
481
- Factory.addGetterSetter(Shape, 'strokeLinearGradientStartPointY', 0);
482
- Factory.addComponentsGetterSetter(Shape, 'fillLinearGradientEndPoint', [
482
+ Factory_1.Factory.addGetterSetter(Shape, 'fillLinearGradientStartPointX', 0);
483
+ Factory_1.Factory.addGetterSetter(Shape, 'strokeLinearGradientStartPointX', 0);
484
+ Factory_1.Factory.addGetterSetter(Shape, 'fillLinearGradientStartPointY', 0);
485
+ Factory_1.Factory.addGetterSetter(Shape, 'strokeLinearGradientStartPointY', 0);
486
+ Factory_1.Factory.addComponentsGetterSetter(Shape, 'fillLinearGradientEndPoint', [
483
487
  'x',
484
488
  'y',
485
489
  ]);
486
- Factory.addComponentsGetterSetter(Shape, 'strokeLinearGradientEndPoint', [
490
+ Factory_1.Factory.addComponentsGetterSetter(Shape, 'strokeLinearGradientEndPoint', [
487
491
  'x',
488
492
  'y',
489
493
  ]);
490
- Factory.addGetterSetter(Shape, 'fillLinearGradientEndPointX', 0);
491
- Factory.addGetterSetter(Shape, 'strokeLinearGradientEndPointX', 0);
492
- Factory.addGetterSetter(Shape, 'fillLinearGradientEndPointY', 0);
493
- Factory.addGetterSetter(Shape, 'strokeLinearGradientEndPointY', 0);
494
- Factory.addComponentsGetterSetter(Shape, 'fillRadialGradientStartPoint', [
494
+ Factory_1.Factory.addGetterSetter(Shape, 'fillLinearGradientEndPointX', 0);
495
+ Factory_1.Factory.addGetterSetter(Shape, 'strokeLinearGradientEndPointX', 0);
496
+ Factory_1.Factory.addGetterSetter(Shape, 'fillLinearGradientEndPointY', 0);
497
+ Factory_1.Factory.addGetterSetter(Shape, 'strokeLinearGradientEndPointY', 0);
498
+ Factory_1.Factory.addComponentsGetterSetter(Shape, 'fillRadialGradientStartPoint', [
495
499
  'x',
496
500
  'y',
497
501
  ]);
498
- Factory.addGetterSetter(Shape, 'fillRadialGradientStartPointX', 0);
499
- Factory.addGetterSetter(Shape, 'fillRadialGradientStartPointY', 0);
500
- Factory.addComponentsGetterSetter(Shape, 'fillRadialGradientEndPoint', [
502
+ Factory_1.Factory.addGetterSetter(Shape, 'fillRadialGradientStartPointX', 0);
503
+ Factory_1.Factory.addGetterSetter(Shape, 'fillRadialGradientStartPointY', 0);
504
+ Factory_1.Factory.addComponentsGetterSetter(Shape, 'fillRadialGradientEndPoint', [
501
505
  'x',
502
506
  'y',
503
507
  ]);
504
- Factory.addGetterSetter(Shape, 'fillRadialGradientEndPointX', 0);
505
- Factory.addGetterSetter(Shape, 'fillRadialGradientEndPointY', 0);
506
- Factory.addGetterSetter(Shape, 'fillPatternRotation', 0);
507
- Factory.backCompat(Shape, {
508
+ Factory_1.Factory.addGetterSetter(Shape, 'fillRadialGradientEndPointX', 0);
509
+ Factory_1.Factory.addGetterSetter(Shape, 'fillRadialGradientEndPointY', 0);
510
+ Factory_1.Factory.addGetterSetter(Shape, 'fillPatternRotation', 0);
511
+ Factory_1.Factory.backCompat(Shape, {
508
512
  dashArray: 'dash',
509
513
  getDashArray: 'getDash',
510
514
  setDashArray: 'getDash',
package/lib/Stage.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { Container, ContainerConfig } from './Container';
2
- import { SceneCanvas, HitCanvas } from './Canvas';
3
- import { GetSet, Vector2d } from './types';
4
- import { Shape } from './Shape';
5
- import { Layer } from './Layer';
1
+ import { Container, ContainerConfig } from './Container.js';
2
+ import { SceneCanvas, HitCanvas } from './Canvas.js';
3
+ import { GetSet, Vector2d } from './types.js';
4
+ import { Shape } from './Shape.js';
5
+ import { Layer } from './Layer.js';
6
6
  export interface StageConfig extends ContainerConfig {
7
7
  container: HTMLDivElement | string;
8
8
  }
@@ -48,7 +48,7 @@ export declare class Stage extends Container<Layer> {
48
48
  getStage(): this;
49
49
  getContent(): HTMLDivElement;
50
50
  _toKonvaCanvas(config: any): SceneCanvas;
51
- getIntersection(pos: Vector2d): Shape<import("./Shape").ShapeConfig>;
51
+ getIntersection(pos: Vector2d): Shape<import("./Shape.js").ShapeConfig>;
52
52
  _resizeDOM(): void;
53
53
  add(layer: Layer, ...rest: any[]): this;
54
54
  getParent(): any;
@@ -60,7 +60,7 @@ export declare class Stage extends Container<Layer> {
60
60
  _bindContentEvents(): void;
61
61
  _pointerenter(evt: any): void;
62
62
  _pointerover(evt: any): void;
63
- _getTargetShape(evenType: any): Shape<import("./Shape").ShapeConfig>;
63
+ _getTargetShape(evenType: any): Shape<import("./Shape.js").ShapeConfig>;
64
64
  _pointerleave(evt: any): void;
65
65
  _pointerdown(evt: TouchEvent | MouseEvent | PointerEvent): void;
66
66
  _pointermove(evt: TouchEvent | MouseEvent | PointerEvent): void;
package/lib/Stage.js CHANGED
@@ -1,11 +1,14 @@
1
- import { Util } from './Util.js';
2
- import { Factory } from './Factory.js';
3
- import { Container } from './Container.js';
4
- import { Konva } from './Global.js';
5
- import { SceneCanvas, HitCanvas } from './Canvas.js';
6
- import { DD } from './DragAndDrop.js';
7
- import { _registerNode } from './Global.js';
8
- import * as PointerEvents from './PointerEvents.js';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Stage = exports.stages = void 0;
4
+ const Util_1 = require("./Util");
5
+ const Factory_1 = require("./Factory");
6
+ const Container_1 = require("./Container");
7
+ const Global_1 = require("./Global");
8
+ const Canvas_1 = require("./Canvas");
9
+ const DragAndDrop_1 = require("./DragAndDrop");
10
+ const Global_2 = require("./Global");
11
+ const PointerEvents = require("./PointerEvents");
9
12
  var STAGE = 'Stage', STRING = 'string', PX = 'px', MOUSEOUT = 'mouseout', MOUSELEAVE = 'mouseleave', MOUSEOVER = 'mouseover', MOUSEENTER = 'mouseenter', MOUSEMOVE = 'mousemove', MOUSEDOWN = 'mousedown', MOUSEUP = 'mouseup', POINTERMOVE = 'pointermove', POINTERDOWN = 'pointerdown', POINTERUP = 'pointerup', POINTERCANCEL = 'pointercancel', LOSTPOINTERCAPTURE = 'lostpointercapture', POINTEROUT = 'pointerout', POINTERLEAVE = 'pointerleave', POINTEROVER = 'pointerover', POINTERENTER = 'pointerenter', CONTEXTMENU = 'contextmenu', TOUCHSTART = 'touchstart', TOUCHEND = 'touchend', TOUCHMOVE = 'touchmove', TOUCHCANCEL = 'touchcancel', WHEEL = 'wheel', MAX_LAYERS_NUMBER = 5, EVENTS = [
10
13
  [MOUSEENTER, '_pointerenter'],
11
14
  [MOUSEDOWN, '_pointerdown'],
@@ -75,7 +78,7 @@ const getEventType = (type) => {
75
78
  const getEventsMap = (eventType) => {
76
79
  const type = getEventType(eventType);
77
80
  if (type === 'pointer') {
78
- return Konva.pointerEventsEnabled && EVENTS_MAP.pointer;
81
+ return Global_1.Konva.pointerEventsEnabled && EVENTS_MAP.pointer;
79
82
  }
80
83
  if (type === 'touch') {
81
84
  return EVENTS_MAP.touch;
@@ -86,20 +89,20 @@ const getEventsMap = (eventType) => {
86
89
  };
87
90
  function checkNoClip(attrs = {}) {
88
91
  if (attrs.clipFunc || attrs.clipWidth || attrs.clipHeight) {
89
- Util.warn('Stage does not support clipping. Please use clip for Layers or Groups.');
92
+ Util_1.Util.warn('Stage does not support clipping. Please use clip for Layers or Groups.');
90
93
  }
91
94
  return attrs;
92
95
  }
93
96
  const NO_POINTERS_MESSAGE = `Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);`;
94
- export const stages = [];
95
- export class Stage extends Container {
97
+ exports.stages = [];
98
+ class Stage extends Container_1.Container {
96
99
  constructor(config) {
97
100
  super(checkNoClip(config));
98
101
  this._pointerPositions = [];
99
102
  this._changedPointerPositions = [];
100
103
  this._buildDOM();
101
104
  this._bindContentEvents();
102
- stages.push(this);
105
+ exports.stages.push(this);
103
106
  this.on('widthChange.konva heightChange.konva', this._resizeDOM);
104
107
  this.on('visibleChange.konva', this._checkVisibility);
105
108
  this.on('clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva', () => {
@@ -112,7 +115,7 @@ export class Stage extends Container {
112
115
  const isFastLayer = child.getType() === 'FastLayer';
113
116
  const valid = isLayer || isFastLayer;
114
117
  if (!valid) {
115
- Util.throw('You may only add layers to the stage.');
118
+ Util_1.Util.throw('You may only add layers to the stage.');
116
119
  }
117
120
  }
118
121
  _checkVisibility() {
@@ -167,25 +170,25 @@ export class Stage extends Container {
167
170
  }
168
171
  obj.container =
169
172
  typeof document !== 'undefined' && document.createElement('div');
170
- return Container.prototype.clone.call(this, obj);
173
+ return Container_1.Container.prototype.clone.call(this, obj);
171
174
  }
172
175
  destroy() {
173
176
  super.destroy();
174
177
  var content = this.content;
175
- if (content && Util._isInDocument(content)) {
178
+ if (content && Util_1.Util._isInDocument(content)) {
176
179
  this.container().removeChild(content);
177
180
  }
178
- var index = stages.indexOf(this);
181
+ var index = exports.stages.indexOf(this);
179
182
  if (index > -1) {
180
- stages.splice(index, 1);
183
+ exports.stages.splice(index, 1);
181
184
  }
182
- Util.releaseCanvas(this.bufferCanvas._canvas, this.bufferHitCanvas._canvas);
185
+ Util_1.Util.releaseCanvas(this.bufferCanvas._canvas, this.bufferHitCanvas._canvas);
183
186
  return this;
184
187
  }
185
188
  getPointerPosition() {
186
189
  const pos = this._pointerPositions[0] || this._changedPointerPositions[0];
187
190
  if (!pos) {
188
- Util.warn(NO_POINTERS_MESSAGE);
191
+ Util_1.Util.warn(NO_POINTERS_MESSAGE);
189
192
  return null;
190
193
  }
191
194
  return {
@@ -211,7 +214,7 @@ export class Stage extends Container {
211
214
  config.y = config.y || 0;
212
215
  config.width = config.width || this.width();
213
216
  config.height = config.height || this.height();
214
- var canvas = new SceneCanvas({
217
+ var canvas = new Canvas_1.SceneCanvas({
215
218
  width: config.width,
216
219
  height: config.height,
217
220
  pixelRatio: config.pixelRatio || 1,
@@ -267,13 +270,13 @@ export class Stage extends Container {
267
270
  super.add(layer);
268
271
  var length = this.children.length;
269
272
  if (length > MAX_LAYERS_NUMBER) {
270
- Util.warn('The stage has ' +
273
+ Util_1.Util.warn('The stage has ' +
271
274
  length +
272
275
  ' layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group.');
273
276
  }
274
277
  layer.setSize({ width: this.width(), height: this.height() });
275
278
  layer.draw();
276
- if (Konva.isBrowser) {
279
+ if (Global_1.Konva.isBrowser) {
277
280
  this.content.appendChild(layer.canvas._canvas);
278
281
  }
279
282
  return this;
@@ -297,7 +300,7 @@ export class Stage extends Container {
297
300
  return this.children;
298
301
  }
299
302
  _bindContentEvents() {
300
- if (!Konva.isBrowser) {
303
+ if (!Global_1.Konva.isBrowser) {
301
304
  return;
302
305
  }
303
306
  EVENTS.forEach(([event, methodName]) => {
@@ -339,7 +342,7 @@ export class Stage extends Container {
339
342
  }
340
343
  this.setPointersPositions(evt);
341
344
  var targetShape = this._getTargetShape(eventType);
342
- var eventsEnabled = !DD.isDragging || Konva.hitOnDragEnabled;
345
+ var eventsEnabled = !DragAndDrop_1.DD.isDragging || Global_1.Konva.hitOnDragEnabled;
343
346
  if (targetShape && eventsEnabled) {
344
347
  targetShape._fireAndBubble(events.pointerout, { evt: evt });
345
348
  targetShape._fireAndBubble(events.pointerleave, { evt: evt });
@@ -375,13 +378,13 @@ export class Stage extends Container {
375
378
  var triggeredOnShape = false;
376
379
  this._changedPointerPositions.forEach((pos) => {
377
380
  var shape = this.getIntersection(pos);
378
- DD.justDragged = false;
379
- Konva['_' + eventType + 'ListenClick'] = true;
381
+ DragAndDrop_1.DD.justDragged = false;
382
+ Global_1.Konva['_' + eventType + 'ListenClick'] = true;
380
383
  const hasShape = shape && shape.isListening();
381
384
  if (!hasShape) {
382
385
  return;
383
386
  }
384
- if (Konva.capturePointerEventsEnabled) {
387
+ if (Global_1.Konva.capturePointerEventsEnabled) {
385
388
  shape.setPointerCapture(pos.id);
386
389
  }
387
390
  this[eventType + 'ClickStartShape'] = shape;
@@ -410,11 +413,11 @@ export class Stage extends Container {
410
413
  if (!events) {
411
414
  return;
412
415
  }
413
- if (DD.isDragging && DD.node.preventDefault() && evt.cancelable) {
416
+ if (DragAndDrop_1.DD.isDragging && DragAndDrop_1.DD.node.preventDefault() && evt.cancelable) {
414
417
  evt.preventDefault();
415
418
  }
416
419
  this.setPointersPositions(evt);
417
- var eventsEnabled = !DD.isDragging || Konva.hitOnDragEnabled;
420
+ var eventsEnabled = !DragAndDrop_1.DD.isDragging || Global_1.Konva.hitOnDragEnabled;
418
421
  if (!eventsEnabled) {
419
422
  return;
420
423
  }
@@ -491,22 +494,22 @@ export class Stage extends Container {
491
494
  const pointerId = pos.id;
492
495
  const event = { evt: evt, pointerId };
493
496
  let fireDblClick = false;
494
- if (Konva['_' + eventType + 'InDblClickWindow']) {
497
+ if (Global_1.Konva['_' + eventType + 'InDblClickWindow']) {
495
498
  fireDblClick = true;
496
499
  clearTimeout(this[eventType + 'DblTimeout']);
497
500
  }
498
- else if (!DD.justDragged) {
499
- Konva['_' + eventType + 'InDblClickWindow'] = true;
501
+ else if (!DragAndDrop_1.DD.justDragged) {
502
+ Global_1.Konva['_' + eventType + 'InDblClickWindow'] = true;
500
503
  clearTimeout(this[eventType + 'DblTimeout']);
501
504
  }
502
505
  this[eventType + 'DblTimeout'] = setTimeout(function () {
503
- Konva['_' + eventType + 'InDblClickWindow'] = false;
504
- }, Konva.dblClickWindow);
506
+ Global_1.Konva['_' + eventType + 'InDblClickWindow'] = false;
507
+ }, Global_1.Konva.dblClickWindow);
505
508
  if (shape && shape.isListening()) {
506
509
  triggeredOnShape = true;
507
510
  this[eventType + 'ClickEndShape'] = shape;
508
511
  shape._fireAndBubble(events.pointerup, Object.assign({}, event));
509
- if (Konva['_' + eventType + 'ListenClick'] &&
512
+ if (Global_1.Konva['_' + eventType + 'ListenClick'] &&
510
513
  clickStartShape &&
511
514
  clickStartShape === shape) {
512
515
  shape._fireAndBubble(events.pointerclick, Object.assign({}, event));
@@ -517,7 +520,7 @@ export class Stage extends Container {
517
520
  }
518
521
  else {
519
522
  this[eventType + 'ClickEndShape'] = null;
520
- if (Konva['_' + eventType + 'ListenClick']) {
523
+ if (Global_1.Konva['_' + eventType + 'ListenClick']) {
521
524
  this._fire(events.pointerclick, {
522
525
  evt: evt,
523
526
  target: this,
@@ -543,7 +546,7 @@ export class Stage extends Container {
543
546
  pointerId: this._changedPointerPositions[0].id,
544
547
  });
545
548
  }
546
- Konva['_' + eventType + 'ListenClick'] = false;
549
+ Global_1.Konva['_' + eventType + 'ListenClick'] = false;
547
550
  if (evt.cancelable && eventType !== 'touch') {
548
551
  evt.preventDefault();
549
552
  }
@@ -616,14 +619,14 @@ export class Stage extends Container {
616
619
  x: x,
617
620
  y: y,
618
621
  };
619
- this._pointerPositions = [{ x, y, id: Util._getFirstPointerId(evt) }];
622
+ this._pointerPositions = [{ x, y, id: Util_1.Util._getFirstPointerId(evt) }];
620
623
  this._changedPointerPositions = [
621
- { x, y, id: Util._getFirstPointerId(evt) },
624
+ { x, y, id: Util_1.Util._getFirstPointerId(evt) },
622
625
  ];
623
626
  }
624
627
  }
625
628
  _setPointerPosition(evt) {
626
- Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.');
629
+ Util_1.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.');
627
630
  this.setPointersPositions(evt);
628
631
  }
629
632
  _getContentPosition() {
@@ -644,16 +647,16 @@ export class Stage extends Container {
644
647
  };
645
648
  }
646
649
  _buildDOM() {
647
- this.bufferCanvas = new SceneCanvas({
650
+ this.bufferCanvas = new Canvas_1.SceneCanvas({
648
651
  width: this.width(),
649
652
  height: this.height(),
650
653
  });
651
- this.bufferHitCanvas = new HitCanvas({
654
+ this.bufferHitCanvas = new Canvas_1.HitCanvas({
652
655
  pixelRatio: 1,
653
656
  width: this.width(),
654
657
  height: this.height(),
655
658
  });
656
- if (!Konva.isBrowser) {
659
+ if (!Global_1.Konva.isBrowser) {
657
660
  return;
658
661
  }
659
662
  var container = this.container();
@@ -670,7 +673,7 @@ export class Stage extends Container {
670
673
  this._resizeDOM();
671
674
  }
672
675
  cache() {
673
- Util.warn('Cache function is not allowed for stage. You may use cache only for layers, groups and shapes.');
676
+ Util_1.Util.warn('Cache function is not allowed for stage. You may use cache only for layers, groups and shapes.');
674
677
  return this;
675
678
  }
676
679
  clearCache() {
@@ -683,6 +686,7 @@ export class Stage extends Container {
683
686
  return this;
684
687
  }
685
688
  }
689
+ exports.Stage = Stage;
686
690
  Stage.prototype.nodeType = STAGE;
687
- _registerNode(Stage);
688
- Factory.addGetterSetter(Stage, 'container');
691
+ (0, Global_2._registerNode)(Stage);
692
+ Factory_1.Factory.addGetterSetter(Stage, 'container');
package/lib/Tween.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Animation } from './Animation';
2
- import { Node, NodeConfig } from './Node';
1
+ import { Animation } from './Animation.js';
2
+ import { Node, NodeConfig } from './Node.js';
3
3
  declare class TweenEngine {
4
4
  prop: string;
5
5
  propFunc: Function;