konva 10.0.9 → 10.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/konva.js +90 -44
  2. package/konva.min.js +4 -4
  3. package/package.json +1 -1
  4. package/lib/Animation.d.ts +0 -24
  5. package/lib/Animation.js +0 -142
  6. package/lib/BezierFunctions.d.ts +0 -6
  7. package/lib/BezierFunctions.js +0 -784
  8. package/lib/Canvas.d.ts +0 -33
  9. package/lib/Canvas.js +0 -137
  10. package/lib/Container.d.ts +0 -54
  11. package/lib/Container.js +0 -316
  12. package/lib/Context.d.ts +0 -95
  13. package/lib/Context.js +0 -561
  14. package/lib/Core.d.ts +0 -3
  15. package/lib/Core.js +0 -3
  16. package/lib/DragAndDrop.d.ts +0 -17
  17. package/lib/DragAndDrop.js +0 -110
  18. package/lib/Factory.d.ts +0 -22
  19. package/lib/Factory.js +0 -123
  20. package/lib/FastLayer.d.ts +0 -4
  21. package/lib/FastLayer.js +0 -12
  22. package/lib/Global.d.ts +0 -37
  23. package/lib/Global.js +0 -66
  24. package/lib/Group.d.ts +0 -9
  25. package/lib/Group.js +0 -13
  26. package/lib/Layer.d.ts +0 -62
  27. package/lib/Layer.js +0 -305
  28. package/lib/Node.d.ts +0 -323
  29. package/lib/Node.js +0 -1532
  30. package/lib/PointerEvents.d.ts +0 -11
  31. package/lib/PointerEvents.js +0 -37
  32. package/lib/Shape.d.ts +0 -196
  33. package/lib/Shape.js +0 -548
  34. package/lib/Stage.d.ts +0 -86
  35. package/lib/Stage.js +0 -715
  36. package/lib/Tween.d.ts +0 -90
  37. package/lib/Tween.js +0 -531
  38. package/lib/Util.d.ts +0 -133
  39. package/lib/Util.js +0 -866
  40. package/lib/Validators.d.ts +0 -11
  41. package/lib/Validators.js +0 -178
  42. package/lib/_CoreInternals.d.ts +0 -220
  43. package/lib/_CoreInternals.js +0 -34
  44. package/lib/_FullInternals.d.ts +0 -302
  45. package/lib/_FullInternals.js +0 -80
  46. package/lib/canvas-backend.d.ts +0 -2
  47. package/lib/canvas-backend.js +0 -27
  48. package/lib/filters/Blur.d.ts +0 -2
  49. package/lib/filters/Blur.js +0 -235
  50. package/lib/filters/Brighten.d.ts +0 -2
  51. package/lib/filters/Brighten.js +0 -12
  52. package/lib/filters/Brightness.d.ts +0 -2
  53. package/lib/filters/Brightness.js +0 -8
  54. package/lib/filters/Contrast.d.ts +0 -2
  55. package/lib/filters/Contrast.js +0 -35
  56. package/lib/filters/Emboss.d.ts +0 -2
  57. package/lib/filters/Emboss.js +0 -101
  58. package/lib/filters/Enhance.d.ts +0 -2
  59. package/lib/filters/Enhance.js +0 -84
  60. package/lib/filters/Grayscale.d.ts +0 -2
  61. package/lib/filters/Grayscale.js +0 -9
  62. package/lib/filters/HSL.d.ts +0 -2
  63. package/lib/filters/HSL.js +0 -24
  64. package/lib/filters/HSV.d.ts +0 -2
  65. package/lib/filters/HSV.js +0 -23
  66. package/lib/filters/Invert.d.ts +0 -2
  67. package/lib/filters/Invert.js +0 -8
  68. package/lib/filters/Kaleidoscope.d.ts +0 -2
  69. package/lib/filters/Kaleidoscope.js +0 -133
  70. package/lib/filters/Mask.d.ts +0 -2
  71. package/lib/filters/Mask.js +0 -151
  72. package/lib/filters/Noise.d.ts +0 -2
  73. package/lib/filters/Noise.js +0 -12
  74. package/lib/filters/Pixelate.d.ts +0 -2
  75. package/lib/filters/Pixelate.js +0 -60
  76. package/lib/filters/Posterize.d.ts +0 -2
  77. package/lib/filters/Posterize.js +0 -10
  78. package/lib/filters/RGB.d.ts +0 -2
  79. package/lib/filters/RGB.js +0 -38
  80. package/lib/filters/RGBA.d.ts +0 -2
  81. package/lib/filters/RGBA.js +0 -49
  82. package/lib/filters/Sepia.d.ts +0 -2
  83. package/lib/filters/Sepia.js +0 -11
  84. package/lib/filters/Solarize.d.ts +0 -2
  85. package/lib/filters/Solarize.js +0 -14
  86. package/lib/filters/Threshold.d.ts +0 -2
  87. package/lib/filters/Threshold.js +0 -10
  88. package/lib/index.d.ts +0 -2
  89. package/lib/index.js +0 -2
  90. package/lib/shapes/Arc.d.ts +0 -27
  91. package/lib/shapes/Arc.js +0 -60
  92. package/lib/shapes/Arrow.d.ts +0 -27
  93. package/lib/shapes/Arrow.js +0 -99
  94. package/lib/shapes/Circle.d.ts +0 -15
  95. package/lib/shapes/Circle.js +0 -33
  96. package/lib/shapes/Ellipse.d.ts +0 -18
  97. package/lib/shapes/Ellipse.js +0 -37
  98. package/lib/shapes/Image.d.ts +0 -29
  99. package/lib/shapes/Image.js +0 -131
  100. package/lib/shapes/Label.d.ts +0 -39
  101. package/lib/shapes/Label.js +0 -173
  102. package/lib/shapes/Line.d.ts +0 -29
  103. package/lib/shapes/Line.js +0 -156
  104. package/lib/shapes/Path.d.ts +0 -50
  105. package/lib/shapes/Path.js +0 -670
  106. package/lib/shapes/Rect.d.ts +0 -11
  107. package/lib/shapes/Rect.js +0 -22
  108. package/lib/shapes/RegularPolygon.d.ts +0 -26
  109. package/lib/shapes/RegularPolygon.js +0 -72
  110. package/lib/shapes/Ring.d.ts +0 -17
  111. package/lib/shapes/Ring.js +0 -33
  112. package/lib/shapes/Sprite.d.ts +0 -32
  113. package/lib/shapes/Sprite.js +0 -108
  114. package/lib/shapes/Star.d.ts +0 -19
  115. package/lib/shapes/Star.js +0 -38
  116. package/lib/shapes/Text.d.ts +0 -90
  117. package/lib/shapes/Text.js +0 -461
  118. package/lib/shapes/TextPath.d.ts +0 -72
  119. package/lib/shapes/TextPath.js +0 -268
  120. package/lib/shapes/Transformer.d.ts +0 -130
  121. package/lib/shapes/Transformer.js +0 -1009
  122. package/lib/shapes/Wedge.d.ts +0 -19
  123. package/lib/shapes/Wedge.js +0 -38
  124. package/lib/skia-backend.d.ts +0 -2
  125. package/lib/skia-backend.js +0 -24
  126. package/lib/types.d.ts +0 -56
  127. package/lib/types.js +0 -21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "konva",
3
- "version": "10.0.9",
3
+ "version": "10.0.10",
4
4
  "description": "HTML5 2d canvas library.",
5
5
  "author": "Anton Lavrenov",
6
6
  "type": "module",
@@ -1,24 +0,0 @@
1
- import type { Layer } from './Layer.ts';
2
- import type { IFrame, AnimationFn } from './types.ts';
3
- export declare class Animation {
4
- func: AnimationFn;
5
- id: number;
6
- layers: Layer[];
7
- frame: IFrame;
8
- constructor(func: AnimationFn, layers?: any);
9
- setLayers(layers: null | Layer | Layer[]): this;
10
- getLayers(): Layer[];
11
- addLayer(layer: Layer): boolean;
12
- isRunning(): boolean;
13
- start(): this;
14
- stop(): this;
15
- _updateFrameObject(time: number): void;
16
- static animations: Array<Animation>;
17
- static animIdCounter: number;
18
- static animRunning: boolean;
19
- static _addAnimation(anim: any): void;
20
- static _removeAnimation(anim: any): void;
21
- static _runFrames(): void;
22
- static _animationLoop(): void;
23
- static _handleAnimation(): void;
24
- }
package/lib/Animation.js DELETED
@@ -1,142 +0,0 @@
1
- import { glob } from "./Global.js";
2
- import { Util } from "./Util.js";
3
- const now = (function () {
4
- if (glob.performance && glob.performance.now) {
5
- return function () {
6
- return glob.performance.now();
7
- };
8
- }
9
- return function () {
10
- return new Date().getTime();
11
- };
12
- })();
13
- export class Animation {
14
- constructor(func, layers) {
15
- this.id = Animation.animIdCounter++;
16
- this.frame = {
17
- time: 0,
18
- timeDiff: 0,
19
- lastTime: now(),
20
- frameRate: 0,
21
- };
22
- this.func = func;
23
- this.setLayers(layers);
24
- }
25
- setLayers(layers) {
26
- let lays = [];
27
- if (layers) {
28
- lays = Array.isArray(layers) ? layers : [layers];
29
- }
30
- this.layers = lays;
31
- return this;
32
- }
33
- getLayers() {
34
- return this.layers;
35
- }
36
- addLayer(layer) {
37
- const layers = this.layers;
38
- const len = layers.length;
39
- for (let n = 0; n < len; n++) {
40
- if (layers[n]._id === layer._id) {
41
- return false;
42
- }
43
- }
44
- this.layers.push(layer);
45
- return true;
46
- }
47
- isRunning() {
48
- const a = Animation;
49
- const animations = a.animations;
50
- const len = animations.length;
51
- for (let n = 0; n < len; n++) {
52
- if (animations[n].id === this.id) {
53
- return true;
54
- }
55
- }
56
- return false;
57
- }
58
- start() {
59
- this.stop();
60
- this.frame.timeDiff = 0;
61
- this.frame.lastTime = now();
62
- Animation._addAnimation(this);
63
- return this;
64
- }
65
- stop() {
66
- Animation._removeAnimation(this);
67
- return this;
68
- }
69
- _updateFrameObject(time) {
70
- this.frame.timeDiff = time - this.frame.lastTime;
71
- this.frame.lastTime = time;
72
- this.frame.time += this.frame.timeDiff;
73
- this.frame.frameRate = 1000 / this.frame.timeDiff;
74
- }
75
- static _addAnimation(anim) {
76
- this.animations.push(anim);
77
- this._handleAnimation();
78
- }
79
- static _removeAnimation(anim) {
80
- const id = anim.id;
81
- const animations = this.animations;
82
- const len = animations.length;
83
- for (let n = 0; n < len; n++) {
84
- if (animations[n].id === id) {
85
- this.animations.splice(n, 1);
86
- break;
87
- }
88
- }
89
- }
90
- static _runFrames() {
91
- const layerHash = {};
92
- const animations = this.animations;
93
- for (let n = 0; n < animations.length; n++) {
94
- const anim = animations[n];
95
- const layers = anim.layers;
96
- const func = anim.func;
97
- anim._updateFrameObject(now());
98
- const layersLen = layers.length;
99
- let needRedraw;
100
- if (func) {
101
- needRedraw = func.call(anim, anim.frame) !== false;
102
- }
103
- else {
104
- needRedraw = true;
105
- }
106
- if (!needRedraw) {
107
- continue;
108
- }
109
- for (let i = 0; i < layersLen; i++) {
110
- const layer = layers[i];
111
- if (layer._id !== undefined) {
112
- layerHash[layer._id] = layer;
113
- }
114
- }
115
- }
116
- for (const key in layerHash) {
117
- if (!layerHash.hasOwnProperty(key)) {
118
- continue;
119
- }
120
- layerHash[key].batchDraw();
121
- }
122
- }
123
- static _animationLoop() {
124
- const Anim = Animation;
125
- if (Anim.animations.length) {
126
- Anim._runFrames();
127
- Util.requestAnimFrame(Anim._animationLoop);
128
- }
129
- else {
130
- Anim.animRunning = false;
131
- }
132
- }
133
- static _handleAnimation() {
134
- if (!this.animRunning) {
135
- this.animRunning = true;
136
- Util.requestAnimFrame(this._animationLoop);
137
- }
138
- }
139
- }
140
- Animation.animations = [];
141
- Animation.animIdCounter = 0;
142
- Animation.animRunning = false;
@@ -1,6 +0,0 @@
1
- export declare const tValues: number[][];
2
- export declare const cValues: number[][];
3
- export declare const binomialCoefficients: number[][];
4
- export declare const getCubicArcLength: (xs: number[], ys: number[], t: number) => number;
5
- export declare const getQuadraticArcLength: (xs: number[], ys: number[], t: number) => number;
6
- export declare const t2length: (length: number, totalLength: number, func: (t: number) => number) => number;