konva 10.5.0 → 10.7.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 (79) hide show
  1. package/README.md +16 -12
  2. package/konva.js +3623 -3819
  3. package/konva.min.js +4 -4
  4. package/lib/Animation.d.ts +2 -2
  5. package/lib/Animation.js +2 -2
  6. package/lib/BezierFunctions.d.ts +1 -1
  7. package/lib/BezierFunctions.js +76 -116
  8. package/lib/Canvas.d.ts +10 -3
  9. package/lib/Canvas.js +91 -10
  10. package/lib/Container.d.ts +3 -2
  11. package/lib/Container.js +31 -17
  12. package/lib/Context.d.ts +9 -7
  13. package/lib/Context.js +99 -73
  14. package/lib/DragAndDrop.d.ts +4 -3
  15. package/lib/DragAndDrop.js +39 -25
  16. package/lib/Factory.d.ts +3 -2
  17. package/lib/Factory.js +10 -9
  18. package/lib/Global.d.ts +2 -7
  19. package/lib/Global.js +8 -9
  20. package/lib/Group.d.ts +7 -1
  21. package/lib/Group.js +61 -0
  22. package/lib/Layer.d.ts +1 -1
  23. package/lib/Layer.js +13 -8
  24. package/lib/Node.d.ts +25 -19
  25. package/lib/Node.js +178 -169
  26. package/lib/PointerEvents.d.ts +1 -2
  27. package/lib/PointerEvents.js +20 -18
  28. package/lib/Shape.d.ts +9 -15
  29. package/lib/Shape.js +190 -86
  30. package/lib/Stage.d.ts +19 -15
  31. package/lib/Stage.js +184 -99
  32. package/lib/Tween.js +59 -66
  33. package/lib/Util.d.ts +3 -2
  34. package/lib/Util.js +46 -16
  35. package/lib/_CoreInternals.d.ts +23 -11
  36. package/lib/_FullInternals.d.ts +23 -11
  37. package/lib/filters/Blur.js +16 -12
  38. package/lib/filters/Brighten.d.ts +1 -0
  39. package/lib/filters/Brighten.js +1 -0
  40. package/lib/filters/Brightness.d.ts +2 -1
  41. package/lib/filters/Brightness.js +4 -4
  42. package/lib/filters/Emboss.js +16 -58
  43. package/lib/filters/Kaleidoscope.js +8 -15
  44. package/lib/filters/Mask.js +8 -8
  45. package/lib/filters/Pixelate.js +16 -29
  46. package/lib/filters/Threshold.d.ts +1 -1
  47. package/lib/filters/Threshold.js +1 -1
  48. package/lib/shapes/Arc.js +8 -6
  49. package/lib/shapes/Arrow.d.ts +3 -6
  50. package/lib/shapes/Arrow.js +75 -47
  51. package/lib/shapes/Circle.d.ts +1 -0
  52. package/lib/shapes/Circle.js +4 -1
  53. package/lib/shapes/Ellipse.d.ts +1 -0
  54. package/lib/shapes/Ellipse.js +4 -1
  55. package/lib/shapes/Image.d.ts +2 -1
  56. package/lib/shapes/Image.js +22 -22
  57. package/lib/shapes/Label.d.ts +2 -3
  58. package/lib/shapes/Label.js +25 -41
  59. package/lib/shapes/Line.d.ts +2 -1
  60. package/lib/shapes/Line.js +5 -2
  61. package/lib/shapes/Path.d.ts +11 -2
  62. package/lib/shapes/Path.js +133 -143
  63. package/lib/shapes/Rect.d.ts +1 -0
  64. package/lib/shapes/Rect.js +4 -1
  65. package/lib/shapes/RegularPolygon.js +2 -2
  66. package/lib/shapes/Ring.d.ts +7 -0
  67. package/lib/shapes/Ring.js +8 -1
  68. package/lib/shapes/Sprite.d.ts +2 -1
  69. package/lib/shapes/Sprite.js +8 -9
  70. package/lib/shapes/Star.d.ts +6 -0
  71. package/lib/shapes/Star.js +5 -1
  72. package/lib/shapes/Text.d.ts +16 -5
  73. package/lib/shapes/Text.js +134 -65
  74. package/lib/shapes/TextPath.d.ts +11 -3
  75. package/lib/shapes/TextPath.js +56 -27
  76. package/lib/shapes/Transformer.js +95 -96
  77. package/lib/shapes/Wedge.js +1 -1
  78. package/lib/types.d.ts +2 -2
  79. package/package.json +5 -20
package/README.md CHANGED
@@ -30,12 +30,12 @@ This repository began as a GitHub fork of [ericdrowell/KineticJS](https://github
30
30
 
31
31
  ## Framework integrations
32
32
 
33
- | Framework | Package | Documentation |
34
- |---|---|---|
35
- | React | [`react-konva`](https://www.npmjs.com/package/react-konva) | [React guide](https://konvajs.org/docs/react/index.html) |
36
- | Vue | [`vue-konva`](https://www.npmjs.com/package/vue-konva) | [Vue guide](https://konvajs.org/docs/vue/index.html) |
37
- | Svelte | [`svelte-konva`](https://www.npmjs.com/package/svelte-konva) | [Svelte guide](https://konvajs.org/docs/svelte/index.html) |
38
- | Angular | [`ng2-konva`](https://www.npmjs.com/package/ng2-konva) | [Angular guide](https://konvajs.org/docs/angular/index.html) |
33
+ | Framework | Package | Documentation |
34
+ | --------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
35
+ | React | [`react-konva`](https://www.npmjs.com/package/react-konva) | [React guide](https://konvajs.org/docs/react/index.html) |
36
+ | Vue | [`vue-konva`](https://www.npmjs.com/package/vue-konva) | [Vue guide](https://konvajs.org/docs/vue/index.html) |
37
+ | Svelte | [`svelte-konva`](https://www.npmjs.com/package/svelte-konva) | [Svelte guide](https://konvajs.org/docs/svelte/index.html) |
38
+ | Angular | [`ng2-konva`](https://www.npmjs.com/package/ng2-konva) | [Angular guide](https://konvajs.org/docs/angular/index.html) |
39
39
 
40
40
  # Quick Look
41
41
 
@@ -48,8 +48,12 @@ document.body.appendChild(container);
48
48
  const stage = new Konva.Stage({ container, width: 600, height: 400 });
49
49
  const layer = new Konva.Layer();
50
50
  const box = new Konva.Rect({
51
- x: 50, y: 50, width: 120, height: 80,
52
- fill: '#00a8e8', draggable: true,
51
+ x: 50,
52
+ y: 50,
53
+ width: 120,
54
+ height: 80,
55
+ fill: '#00a8e8',
56
+ draggable: true,
53
57
  });
54
58
 
55
59
  layer.add(box);
@@ -133,7 +137,7 @@ npm install konva canvas
133
137
  npm install konva skia-canvas
134
138
  ```
135
139
 
136
- Then you can use the same Konva API and all Konva demos will work just fine. You just don't need to use `container` attribute in your stage.
140
+ Use the same scene graph API for server-side rendering and omit the stage's `container` attribute. DOM events require a browser, and canvas feature support depends on the selected backend.
137
141
 
138
142
  ```js
139
143
  import Konva from 'konva';
@@ -143,7 +147,7 @@ const stage = new Konva.Stage({
143
147
  width: 500,
144
148
  height: 500,
145
149
  });
146
- // then all regular Konva code will work
150
+ // Add shapes and export the stage with the usual Konva drawing API.
147
151
  ```
148
152
 
149
153
  # Backers
@@ -172,11 +176,11 @@ Konva uses Mocha for testing.
172
176
  - While developing it is easy to use `npm start`. Just run it and go to [http://localhost:1234/unit-tests.html](http://localhost:1234/unit-tests.html). The watcher will rebuild the bundle on any change.
173
177
 
174
178
  Konva is covered with hundreds of tests and well over a thousand assertions.
175
- Konva uses TDD (test driven development) which means that every new feature or bug fix is accompanied with at least one new test.
179
+ For each feature or bug fix, write a failing test first, implement the behavior, then verify that the test passes (test-driven development).
176
180
 
177
181
  ## Generate documentation
178
182
 
179
- Run `npx gulp api` which will build the documentation files and place them in the `api` folder.
183
+ Run `npm run build`, then `npx gulp api` to generate documentation from the current bundle in the `api` folder.
180
184
 
181
185
  # Pull Requests
182
186