fabric 6.5.3 → 6.5.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 (54) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/CONTRIBUTING.md +1 -1
  3. package/README.md +9 -6
  4. package/dist/index.js +15 -15
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.min.js +1 -1
  7. package/dist/index.min.js.map +1 -1
  8. package/dist/index.min.mjs +1 -1
  9. package/dist/index.min.mjs.map +1 -1
  10. package/dist/index.mjs +15 -15
  11. package/dist/index.mjs.map +1 -1
  12. package/dist/index.node.cjs +15 -15
  13. package/dist/index.node.cjs.map +1 -1
  14. package/dist/index.node.mjs +15 -15
  15. package/dist/index.node.mjs.map +1 -1
  16. package/dist/package.json.min.mjs +1 -1
  17. package/dist/package.json.mjs +1 -1
  18. package/dist/src/shapes/ActiveSelection.d.ts +1 -5
  19. package/dist/src/shapes/ActiveSelection.d.ts.map +1 -1
  20. package/dist/src/shapes/ActiveSelection.min.mjs.map +1 -1
  21. package/dist/src/shapes/ActiveSelection.mjs +1 -5
  22. package/dist/src/shapes/ActiveSelection.mjs.map +1 -1
  23. package/dist/src/shapes/Group.d.ts +2 -2
  24. package/dist/src/shapes/Group.d.ts.map +1 -1
  25. package/dist/src/shapes/Group.min.mjs.map +1 -1
  26. package/dist/src/shapes/Group.mjs +2 -2
  27. package/dist/src/shapes/Group.mjs.map +1 -1
  28. package/dist/src/shapes/Image.d.ts +3 -3
  29. package/dist/src/shapes/Image.min.mjs.map +1 -1
  30. package/dist/src/shapes/Image.mjs +3 -3
  31. package/dist/src/shapes/Image.mjs.map +1 -1
  32. package/dist/src/shapes/Object/Object.d.ts +6 -3
  33. package/dist/src/shapes/Object/Object.d.ts.map +1 -1
  34. package/dist/src/shapes/Object/Object.min.mjs +1 -1
  35. package/dist/src/shapes/Object/Object.min.mjs.map +1 -1
  36. package/dist/src/shapes/Object/Object.mjs +8 -4
  37. package/dist/src/shapes/Object/Object.mjs.map +1 -1
  38. package/dist/src/shapes/Object/ObjectGeometry.d.ts.map +1 -1
  39. package/dist/src/shapes/Object/ObjectGeometry.min.mjs.map +1 -1
  40. package/dist/src/shapes/Object/ObjectGeometry.mjs.map +1 -1
  41. package/dist-extensions/src/shapes/ActiveSelection.d.ts +1 -5
  42. package/dist-extensions/src/shapes/ActiveSelection.d.ts.map +1 -1
  43. package/dist-extensions/src/shapes/Group.d.ts +2 -2
  44. package/dist-extensions/src/shapes/Group.d.ts.map +1 -1
  45. package/dist-extensions/src/shapes/Image.d.ts +3 -3
  46. package/dist-extensions/src/shapes/Object/Object.d.ts +6 -3
  47. package/dist-extensions/src/shapes/Object/Object.d.ts.map +1 -1
  48. package/dist-extensions/src/shapes/Object/ObjectGeometry.d.ts.map +1 -1
  49. package/package.json +1 -1
  50. package/src/shapes/ActiveSelection.ts +1 -5
  51. package/src/shapes/Group.ts +2 -2
  52. package/src/shapes/Image.ts +3 -3
  53. package/src/shapes/Object/Object.ts +9 -5
  54. package/src/shapes/Object/ObjectGeometry.ts +1 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## [next]
4
4
 
5
+ ## [6.5.4]
6
+
7
+ - docs() perf(): Reorder caching conditions for most common scenario and docs fixes. [#10366](https://github.com/fabricjs/fabric.js/pull/10366)
8
+
5
9
  ## [6.5.3]
6
10
 
7
11
  - fix(ColorMatrix): Restore correct alpha for JS colorMatrix filter [#10313](https://github.com/fabricjs/fabric.js/pull/10313)
package/CONTRIBUTING.md CHANGED
@@ -254,7 +254,7 @@ Don't forget to unlink the package once you're done.
254
254
  [website]: http://fabricjs.com/
255
255
  [docs]: http://fabricjs.com/docs
256
256
  [demos]: http://fabricjs.com/demos/
257
- [gotchas]: http://fabricjs.com/fabric-gotchas
257
+ [gotchas]: https://fabricjs.com/docs/old-docs/gotchas/
258
258
  [demo_file]: https://github.com/fabricjs/fabricjs.com/blob/gh-pages/posts/demos/_posts/2020-2-15-custom-control-render.md
259
259
  [jsfiddles]: https://jsfiddle.net/user/fabricjs/fiddles/
260
260
  [codepens]: https://codepen.io/tag/fabricjs
package/README.md CHANGED
@@ -5,6 +5,7 @@
5
5
  A **simple and powerful Javascript HTML5 canvas library**.
6
6
 
7
7
  - [**Website**][website]
8
+ - [**Old V5 documentation**](https://fabric5.fabricjs.com)
8
9
  - [**GOTCHAS**][gotchas]
9
10
  - [**Contributing, Developing and More**](CONTRIBUTING.md)
10
11
 
@@ -42,8 +43,8 @@ A **simple and powerful Javascript HTML5 canvas library**.
42
43
  - Out of the box interactions such as scale, move, rotate, skew, group...
43
44
  - Built in shapes, controls, animations, image filters, gradients, patterns, brushes...
44
45
  - `JPG`, `PNG`, `JSON` and `SVG` i/o
45
- - [Typed and modular](#migrating-to-v6)
46
- - [Unit tested](CONTRIBUTING.md#%F0%9F%A7%AA%20testing)
46
+ - Typed and modular
47
+ - [Unit tested](CONTRIBUTING.md#-testing)
47
48
 
48
49
  #### Supported Browsers/Environments
49
50
 
@@ -58,14 +59,16 @@ A **simple and powerful Javascript HTML5 canvas library**.
58
59
  | IE11 | ❌ |
59
60
  | Node.js | ✔️ | [Node.js installation](#nodejs) |
60
61
 
61
- Fabric.js Does not use transpilation by default, the browser version we support is determined by the level of canvas api we want to use and some js syntax. While JS can be easily transpiled, canvas API can't.
62
+ Fabric.js does not use polyfills by default, or tries to keep it at minimum. the browser version we support is determined by the level of canvas api we want to use and some js syntax. While JS can be easily transpiled, canvas API can't.
62
63
 
63
64
  ## Installation
64
65
 
65
66
  ```bash
66
67
  $ npm install fabric --save
67
- // or
68
+ # or use yarn
68
69
  $ yarn add fabric
70
+ # or use pnpm
71
+ $ pnpm install fabric
69
72
  ```
70
73
 
71
74
  #### Browser
@@ -114,7 +117,7 @@ import { fabric } from 'fabric';
114
117
 
115
118
  </details>
116
119
 
117
- <details><summary><b>ReactJS</b></summary>
120
+ <details><summary><b>React.js</b></summary>
118
121
 
119
122
  ```tsx
120
123
  import React, { useEffect, useRef } from 'react';
@@ -224,7 +227,7 @@ See our ready to use [templates](./.codesandbox/templates/).
224
227
  [codepens]: https://codepen.io/tag/fabricjs
225
228
  [contributors]: https://github.com/fabricjs/fabric.js/graphs/contributors
226
229
  [demos]: http://fabricjs.com/demos/
227
- [gotchas]: http://fabricjs.com/fabric-gotchas
230
+ [gotchas]: https://fabricjs.com/docs/old-docs/gotchas/
228
231
  [html-to-image]: https://github.com/bubkoo/html-to-image
229
232
  [jsdelivr]: https://www.jsdelivr.com/package/npm/fabric
230
233
  [jsdom]: https://github.com/jsdom/jsdom
package/dist/index.js CHANGED
@@ -411,7 +411,7 @@
411
411
  }
412
412
  const cache = new Cache();
413
413
 
414
- var version = "6.5.3";
414
+ var version = "6.5.4";
415
415
 
416
416
  // use this syntax so babel plugin see this import here
417
417
  const VERSION = version;
@@ -7129,7 +7129,7 @@
7129
7129
  }
7130
7130
 
7131
7131
  /**
7132
- * When set to `true`, force the object to have its own cache, even if it is inside a group
7132
+ * When returns `true`, force the object to have its own cache, even if it is inside a group
7133
7133
  * it may be needed when your object behave in a particular way on the cache and always needs
7134
7134
  * its own isolated canvas to render correctly.
7135
7135
  * Created to be overridden
@@ -7137,6 +7137,7 @@
7137
7137
  * @returns Boolean
7138
7138
  */
7139
7139
  needsItsOwnCache() {
7140
+ // TODO re-evaluate this shadow condition
7140
7141
  if (this.paintFirst === STROKE && this.hasFill() && this.hasStroke() && !!this.shadow) {
7141
7142
  return true;
7142
7143
  }
@@ -7150,13 +7151,13 @@
7150
7151
  * Decide if the object should cache or not. Create its own cache level
7151
7152
  * objectCaching is a global flag, wins over everything
7152
7153
  * needsItsOwnCache should be used when the object drawing method requires
7153
- * a cache step. None of the fabric classes requires it.
7154
+ * a cache step.
7154
7155
  * Generally you do not cache objects in groups because the group outside is cached.
7155
7156
  * Read as: cache if is needed, or if the feature is enabled but we are not already caching.
7156
7157
  * @return {Boolean}
7157
7158
  */
7158
7159
  shouldCache() {
7159
- this.ownCaching = this.needsItsOwnCache() || this.objectCaching && (!this.parent || !this.parent.isOnACache());
7160
+ this.ownCaching = this.objectCaching && (!this.parent || !this.parent.isOnACache()) || this.needsItsOwnCache();
7160
7161
  return this.ownCaching;
7161
7162
  }
7162
7163
 
@@ -7256,7 +7257,10 @@
7256
7257
  }
7257
7258
 
7258
7259
  /**
7259
- * Check if cache is dirty
7260
+ * Check if cache is dirty and if is dirty clear the context.
7261
+ * This check has a big side effect, it changes the underlying cache canvas if necessary.
7262
+ * Do not call this method on your own to check if the cache is dirty, because if it is,
7263
+ * it is also going to wipe the cache. This is badly designed and needs to be fixed.
7260
7264
  * @param {Boolean} skipCanvas skip canvas checks because this object is painted
7261
7265
  * on parent canvas.
7262
7266
  */
@@ -11668,9 +11672,9 @@
11668
11672
  }
11669
11673
 
11670
11674
  /**
11671
- * Decide if the object should cache or not. Create its own cache level
11675
+ * Decide if the group should cache or not. Create its own cache level
11672
11676
  * needsItsOwnCache should be used when the object drawing method requires
11673
- * a cache step. None of the fabric classes requires it.
11677
+ * a cache step.
11674
11678
  * Generally you do not cache objects in groups because the group is already cached.
11675
11679
  * @return {Boolean}
11676
11680
  */
@@ -23668,11 +23672,7 @@
23668
23672
  }
23669
23673
 
23670
23674
  /**
23671
- * Decide if the object should cache or not. Create its own cache level
23672
- * objectCaching is a global flag, wins over everything
23673
- * needsItsOwnCache should be used when the object drawing method requires
23674
- * a cache step. None of the fabric classes requires it.
23675
- * Generally you do not cache objects in groups because the group outside is cached.
23675
+ * Decide if the object should cache or not. The Active selection never caches
23676
23676
  * @return {Boolean}
23677
23677
  */
23678
23678
  shouldCache() {
@@ -24523,11 +24523,11 @@
24523
24523
  }
24524
24524
 
24525
24525
  /**
24526
- * Decide if the object should cache or not. Create its own cache level
24526
+ * Decide if the FabricImage should cache or not. Create its own cache level
24527
24527
  * needsItsOwnCache should be used when the object drawing method requires
24528
- * a cache step. None of the fabric classes requires it.
24528
+ * a cache step.
24529
24529
  * Generally you do not cache objects in groups because the group outside is cached.
24530
- * This is the special image version where we would like to avoid caching where possible.
24530
+ * This is the special Image version where we would like to avoid caching where possible.
24531
24531
  * Essentially images do not benefit from caching. They may require caching, and in that
24532
24532
  * case we do it. Also caching an image usually ends in a loss of details.
24533
24533
  * A full performance audit should be done.