konva 8.1.4

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 (125) hide show
  1. package/CHANGELOG.md +1140 -0
  2. package/LICENSE +22 -0
  3. package/README.md +189 -0
  4. package/konva.js +18090 -0
  5. package/konva.min.js +12 -0
  6. package/lib/Animation.d.ts +24 -0
  7. package/lib/Animation.js +141 -0
  8. package/lib/Canvas.d.ts +32 -0
  9. package/lib/Canvas.js +107 -0
  10. package/lib/Container.d.ts +47 -0
  11. package/lib/Container.js +318 -0
  12. package/lib/Context.d.ts +76 -0
  13. package/lib/Context.js +520 -0
  14. package/lib/Core.d.ts +3 -0
  15. package/lib/Core.js +3 -0
  16. package/lib/DragAndDrop.d.ts +17 -0
  17. package/lib/DragAndDrop.js +104 -0
  18. package/lib/Factory.d.ts +11 -0
  19. package/lib/Factory.js +117 -0
  20. package/lib/FastLayer.d.ts +4 -0
  21. package/lib/FastLayer.js +12 -0
  22. package/lib/Global.d.ts +30 -0
  23. package/lib/Global.js +53 -0
  24. package/lib/Group.d.ts +6 -0
  25. package/lib/Group.js +13 -0
  26. package/lib/Layer.d.ts +60 -0
  27. package/lib/Layer.js +301 -0
  28. package/lib/Node.d.ts +318 -0
  29. package/lib/Node.js +1381 -0
  30. package/lib/PointerEvents.d.ts +11 -0
  31. package/lib/PointerEvents.js +37 -0
  32. package/lib/Shape.d.ts +184 -0
  33. package/lib/Shape.js +515 -0
  34. package/lib/Stage.d.ts +85 -0
  35. package/lib/Stage.js +687 -0
  36. package/lib/Tween.d.ts +86 -0
  37. package/lib/Tween.js +516 -0
  38. package/lib/Util.d.ts +87 -0
  39. package/lib/Util.js +742 -0
  40. package/lib/Validators.d.ts +11 -0
  41. package/lib/Validators.js +171 -0
  42. package/lib/_CoreInternals.d.ts +144 -0
  43. package/lib/_CoreInternals.js +34 -0
  44. package/lib/_FullInternals.d.ts +188 -0
  45. package/lib/_FullInternals.js +78 -0
  46. package/lib/filters/Blur.d.ts +2 -0
  47. package/lib/filters/Blur.js +697 -0
  48. package/lib/filters/Brighten.d.ts +2 -0
  49. package/lib/filters/Brighten.js +12 -0
  50. package/lib/filters/Contrast.d.ts +2 -0
  51. package/lib/filters/Contrast.js +34 -0
  52. package/lib/filters/Emboss.d.ts +2 -0
  53. package/lib/filters/Emboss.js +102 -0
  54. package/lib/filters/Enhance.d.ts +2 -0
  55. package/lib/filters/Enhance.js +83 -0
  56. package/lib/filters/Grayscale.d.ts +2 -0
  57. package/lib/filters/Grayscale.js +9 -0
  58. package/lib/filters/HSL.d.ts +2 -0
  59. package/lib/filters/HSL.js +24 -0
  60. package/lib/filters/HSV.d.ts +2 -0
  61. package/lib/filters/HSV.js +24 -0
  62. package/lib/filters/Invert.d.ts +2 -0
  63. package/lib/filters/Invert.js +8 -0
  64. package/lib/filters/Kaleidoscope.d.ts +2 -0
  65. package/lib/filters/Kaleidoscope.js +132 -0
  66. package/lib/filters/Mask.d.ts +2 -0
  67. package/lib/filters/Mask.js +140 -0
  68. package/lib/filters/Noise.d.ts +2 -0
  69. package/lib/filters/Noise.js +12 -0
  70. package/lib/filters/Pixelate.d.ts +2 -0
  71. package/lib/filters/Pixelate.js +60 -0
  72. package/lib/filters/Posterize.d.ts +2 -0
  73. package/lib/filters/Posterize.js +10 -0
  74. package/lib/filters/RGB.d.ts +2 -0
  75. package/lib/filters/RGB.js +39 -0
  76. package/lib/filters/RGBA.d.ts +2 -0
  77. package/lib/filters/RGBA.js +49 -0
  78. package/lib/filters/Sepia.d.ts +2 -0
  79. package/lib/filters/Sepia.js +11 -0
  80. package/lib/filters/Solarize.d.ts +2 -0
  81. package/lib/filters/Solarize.js +25 -0
  82. package/lib/filters/Threshold.d.ts +2 -0
  83. package/lib/filters/Threshold.js +10 -0
  84. package/lib/index-node.d.ts +2 -0
  85. package/lib/index-node.js +18 -0
  86. package/lib/index-types.d.ts +179 -0
  87. package/lib/index.d.ts +2 -0
  88. package/lib/index.js +2 -0
  89. package/lib/shapes/Arc.d.ts +19 -0
  90. package/lib/shapes/Arc.js +35 -0
  91. package/lib/shapes/Arrow.d.ts +24 -0
  92. package/lib/shapes/Arrow.js +94 -0
  93. package/lib/shapes/Circle.d.ts +13 -0
  94. package/lib/shapes/Circle.js +33 -0
  95. package/lib/shapes/Ellipse.d.ts +16 -0
  96. package/lib/shapes/Ellipse.js +37 -0
  97. package/lib/shapes/Image.d.ts +23 -0
  98. package/lib/shapes/Image.js +100 -0
  99. package/lib/shapes/Label.d.ts +35 -0
  100. package/lib/shapes/Label.js +166 -0
  101. package/lib/shapes/Line.d.ts +28 -0
  102. package/lib/shapes/Line.js +155 -0
  103. package/lib/shapes/Path.d.ts +37 -0
  104. package/lib/shapes/Path.js +627 -0
  105. package/lib/shapes/Rect.d.ts +9 -0
  106. package/lib/shapes/Rect.js +42 -0
  107. package/lib/shapes/RegularPolygon.d.ts +22 -0
  108. package/lib/shapes/RegularPolygon.js +65 -0
  109. package/lib/shapes/Ring.d.ts +16 -0
  110. package/lib/shapes/Ring.js +33 -0
  111. package/lib/shapes/Sprite.d.ts +30 -0
  112. package/lib/shapes/Sprite.js +108 -0
  113. package/lib/shapes/Star.d.ts +17 -0
  114. package/lib/shapes/Star.js +38 -0
  115. package/lib/shapes/Text.d.ts +59 -0
  116. package/lib/shapes/Text.js +347 -0
  117. package/lib/shapes/TextPath.d.ts +54 -0
  118. package/lib/shapes/TextPath.js +343 -0
  119. package/lib/shapes/Transformer.d.ts +112 -0
  120. package/lib/shapes/Transformer.js +944 -0
  121. package/lib/shapes/Wedge.d.ts +17 -0
  122. package/lib/shapes/Wedge.js +38 -0
  123. package/lib/types.d.ts +50 -0
  124. package/lib/types.js +22 -0
  125. package/package.json +111 -0
@@ -0,0 +1,17 @@
1
+ import { Shape, ShapeConfig } from '../Shape';
2
+ import { GetSet } from '../types';
3
+ export interface WedgeConfig extends ShapeConfig {
4
+ angle: number;
5
+ radius: number;
6
+ clockwise?: boolean;
7
+ }
8
+ export declare class Wedge extends Shape<WedgeConfig> {
9
+ _sceneFunc(context: any): void;
10
+ getWidth(): number;
11
+ getHeight(): number;
12
+ setWidth(width: any): void;
13
+ setHeight(height: any): void;
14
+ radius: GetSet<number, this>;
15
+ angle: GetSet<number, this>;
16
+ clockwise: GetSet<boolean, this>;
17
+ }
@@ -0,0 +1,38 @@
1
+ import { Factory } from '../Factory.js';
2
+ import { Shape } from '../Shape.js';
3
+ import { Konva } from '../Global.js';
4
+ import { getNumberValidator } from '../Validators.js';
5
+ import { _registerNode } from '../Global.js';
6
+ export class Wedge extends Shape {
7
+ _sceneFunc(context) {
8
+ context.beginPath();
9
+ context.arc(0, 0, this.radius(), 0, Konva.getAngle(this.angle()), this.clockwise());
10
+ context.lineTo(0, 0);
11
+ context.closePath();
12
+ context.fillStrokeShape(this);
13
+ }
14
+ getWidth() {
15
+ return this.radius() * 2;
16
+ }
17
+ getHeight() {
18
+ return this.radius() * 2;
19
+ }
20
+ setWidth(width) {
21
+ this.radius(width / 2);
22
+ }
23
+ setHeight(height) {
24
+ this.radius(height / 2);
25
+ }
26
+ }
27
+ Wedge.prototype.className = 'Wedge';
28
+ Wedge.prototype._centroid = true;
29
+ Wedge.prototype._attrsAffectingSize = ['radius'];
30
+ _registerNode(Wedge);
31
+ Factory.addGetterSetter(Wedge, 'radius', 0, getNumberValidator());
32
+ Factory.addGetterSetter(Wedge, 'angle', 0, getNumberValidator());
33
+ Factory.addGetterSetter(Wedge, 'clockwise', false);
34
+ Factory.backCompat(Wedge, {
35
+ angleDeg: 'angle',
36
+ getAngleDeg: 'getAngle',
37
+ setAngleDeg: 'setAngle',
38
+ });
package/lib/types.d.ts ADDED
@@ -0,0 +1,50 @@
1
+ export interface GetSet<Type, This> {
2
+ (): Type;
3
+ (v: Type): This;
4
+ }
5
+ export interface Vector2d {
6
+ x: number;
7
+ y: number;
8
+ }
9
+ export interface IRect {
10
+ x: number;
11
+ y: number;
12
+ width: number;
13
+ height: number;
14
+ }
15
+ export interface IFrame {
16
+ time: number;
17
+ timeDiff: number;
18
+ lastTime: number;
19
+ frameRate: number;
20
+ }
21
+ export declare type AnimationFn = (frame?: IFrame) => boolean | void;
22
+ export declare enum KonvaNodeEvent {
23
+ mouseover = "mouseover",
24
+ mouseout = "mouseout",
25
+ mousemove = "mousemove",
26
+ mouseleave = "mouseleave",
27
+ mouseenter = "mouseenter",
28
+ mousedown = "mousedown",
29
+ mouseup = "mouseup",
30
+ wheel = "wheel",
31
+ contextmenu = "contextmenu",
32
+ click = "click",
33
+ dblclick = "dblclick",
34
+ touchstart = "touchstart",
35
+ touchmove = "touchmove",
36
+ touchend = "touchend",
37
+ tap = "tap",
38
+ dbltap = "dbltap",
39
+ dragstart = "dragstart",
40
+ dragmove = "dragmove",
41
+ dragend = "dragend"
42
+ }
43
+ export interface RGB {
44
+ r: number;
45
+ g: number;
46
+ b: number;
47
+ }
48
+ export interface RGBA extends RGB {
49
+ a: number;
50
+ }
package/lib/types.js ADDED
@@ -0,0 +1,22 @@
1
+ export var KonvaNodeEvent;
2
+ (function (KonvaNodeEvent) {
3
+ KonvaNodeEvent["mouseover"] = "mouseover";
4
+ KonvaNodeEvent["mouseout"] = "mouseout";
5
+ KonvaNodeEvent["mousemove"] = "mousemove";
6
+ KonvaNodeEvent["mouseleave"] = "mouseleave";
7
+ KonvaNodeEvent["mouseenter"] = "mouseenter";
8
+ KonvaNodeEvent["mousedown"] = "mousedown";
9
+ KonvaNodeEvent["mouseup"] = "mouseup";
10
+ KonvaNodeEvent["wheel"] = "wheel";
11
+ KonvaNodeEvent["contextmenu"] = "contextmenu";
12
+ KonvaNodeEvent["click"] = "click";
13
+ KonvaNodeEvent["dblclick"] = "dblclick";
14
+ KonvaNodeEvent["touchstart"] = "touchstart";
15
+ KonvaNodeEvent["touchmove"] = "touchmove";
16
+ KonvaNodeEvent["touchend"] = "touchend";
17
+ KonvaNodeEvent["tap"] = "tap";
18
+ KonvaNodeEvent["dbltap"] = "dbltap";
19
+ KonvaNodeEvent["dragstart"] = "dragstart";
20
+ KonvaNodeEvent["dragmove"] = "dragmove";
21
+ KonvaNodeEvent["dragend"] = "dragend";
22
+ })(KonvaNodeEvent || (KonvaNodeEvent = {}));
package/package.json ADDED
@@ -0,0 +1,111 @@
1
+ {
2
+ "name": "konva",
3
+ "version": "8.1.4",
4
+ "author": "Anton Lavrenov",
5
+ "files": [
6
+ "README.md",
7
+ "konva.js",
8
+ "konva.min.js",
9
+ "lib"
10
+ ],
11
+ "type": "module",
12
+ "main": "./lib/index-node.js",
13
+ "browser": "./lib/index.js",
14
+ "typings": "./lib/index-types.d.ts",
15
+ "scripts": {
16
+ "start": "npm run test:watch",
17
+ "compile": "npm run clean && npm run tsc && cp ./src/index-types.d.ts ./lib/index-types.d.ts && npm run rollup",
18
+ "build": "npm run compile && cp ./src/index-types.d.ts ./lib && gulp build && node ./rename-imports.js",
19
+ "test:import": "npm run build && node ./test/import-test.js",
20
+ "test": "npm run test:browser && npm run test:node",
21
+ "test:build": "parcel build ./test/unit-tests.html --dist-dir test-build --target none --public-url ./ --no-source-maps",
22
+ "test:browser": "npm run test:build && mocha-headless-chrome -f ./test-build/unit-tests.html -a disable-web-security",
23
+ "test:node": "env TS_NODE_PROJECT=\"./test/tsconfig.json\" mocha -r ts-node/register test/unit/**/*.ts --exit && npm run test:import",
24
+ "test:watch": "rm -rf ./parcel-cache && parcel serve ./test/unit-tests.html ./test/manual-tests.html ./test/sandbox.html ./test/performance/bunnies.html",
25
+ "tsc": "tsc --removeComments",
26
+ "rollup": "rollup -c",
27
+ "clean": "rm -rf ./lib && rm -rf ./types && rm -rf ./es && rm -rf ./test-build",
28
+ "watch": "rollup -c -w",
29
+ "size": "size-limit"
30
+ },
31
+ "targets": {
32
+ "none": {}
33
+ },
34
+ "funding": [
35
+ {
36
+ "type": "patreon",
37
+ "url": "https://www.patreon.com/lavrton"
38
+ },
39
+ {
40
+ "type": "opencollective",
41
+ "url": "https://opencollective.com/konva"
42
+ },
43
+ {
44
+ "type": "github",
45
+ "url": "https://github.com/sponsors/lavrton"
46
+ }
47
+ ],
48
+ "size-limit": [
49
+ {
50
+ "limit": "45 KB",
51
+ "path": "./lib/index.js"
52
+ },
53
+ {
54
+ "limit": "26 KB",
55
+ "path": "./lib/Core.js"
56
+ },
57
+ {
58
+ "path": "./konva.min.js"
59
+ }
60
+ ],
61
+ "devDependencies": {
62
+ "@parcel/transformer-image": "2.0.0-beta.2",
63
+ "@size-limit/preset-big-lib": "^4.10.3",
64
+ "@types/mocha": "^8.2.2",
65
+ "canvas": "^2.8.0",
66
+ "chai": "4.3.4",
67
+ "filehound": "^1.17.4",
68
+ "gulp": "^4.0.2",
69
+ "gulp-concat": "^2.6.1",
70
+ "gulp-connect": "^5.7.0",
71
+ "gulp-exec": "^5.0.0",
72
+ "gulp-jsdoc3": "^3.0.0",
73
+ "gulp-rename": "^2.0.0",
74
+ "gulp-replace": "^1.1.3",
75
+ "gulp-typescript": "^5.0.1",
76
+ "gulp-uglify": "^3.0.2",
77
+ "gulp-uglify-es": "^2.0.0",
78
+ "gulp-util": "^3.0.8",
79
+ "mocha": "8.4.0",
80
+ "mocha-headless-chrome": "^3.1.0",
81
+ "parcel": "^2.0.0-beta.2",
82
+ "rollup": "^2.48.0",
83
+ "rollup-plugin-commonjs": "^10.1.0",
84
+ "rollup-plugin-node-resolve": "^5.2.0",
85
+ "rollup-plugin-sourcemaps": "^0.6.3",
86
+ "rollup-plugin-typescript2": "^0.30.0",
87
+ "size-limit": "^4.10.3",
88
+ "ts-mocha": "^8.0.0",
89
+ "ts-node": "^9.1.1",
90
+ "typescript": "^4.2.4"
91
+ },
92
+ "keywords": [
93
+ "canvas",
94
+ "animations",
95
+ "graphic",
96
+ "html5"
97
+ ],
98
+ "prettier": {
99
+ "singleQuote": true
100
+ },
101
+ "bugs": {
102
+ "url": "https://github.com/konvajs/konva/issues"
103
+ },
104
+ "homepage": "http://konvajs.org/",
105
+ "readmeFilename": "README.md",
106
+ "repository": {
107
+ "type": "git",
108
+ "url": "git://github.com/konvajs/konva.git"
109
+ },
110
+ "license": "MIT"
111
+ }