fabric 6.0.0-beta13 → 6.0.0-beta15
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.
- package/.eslintrc.js +9 -0
- package/CHANGELOG.md +35 -1
- package/CONTRIBUTING.md +9 -9
- package/dist/fabric.d.ts +36 -3
- package/dist/index.js +218 -324
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.mjs +214 -323
- package/dist/index.mjs.map +1 -1
- package/dist/index.node.cjs +218 -324
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.mjs +214 -323
- package/dist/index.node.mjs.map +1 -1
- package/dist/src/Intersection.d.ts +8 -0
- package/dist/src/canvas/Canvas.d.ts +1 -1
- package/dist/src/canvas/CanvasOptions.d.ts +1 -1
- package/dist/src/canvas/DOMManagers/CanvasDOMManager.d.ts +1 -1
- package/dist/src/canvas/DOMManagers/StaticCanvasDOMManager.d.ts +2 -2
- package/dist/src/canvas/SelectableCanvas.d.ts +10 -15
- package/dist/src/canvas/StaticCanvas.d.ts +2 -2
- package/dist/src/controls/Control.d.ts +8 -8
- package/dist/src/controls/index.d.ts +1 -1
- package/dist/src/controls/polyControl.d.ts +25 -0
- package/dist/src/filters/BlendImage.d.ts +4 -4
- package/dist/src/shapes/Group.d.ts +5 -1
- package/dist/src/shapes/IText/ITextBehavior.d.ts +2 -2
- package/dist/src/shapes/Image.d.ts +11 -11
- package/dist/src/shapes/Object/InteractiveObject.d.ts +2 -3
- package/dist/src/shapes/Object/Object.d.ts +4 -4
- package/dist/src/shapes/Object/ObjectGeometry.d.ts +3 -29
- package/dist/src/shapes/Object/types/FabricObjectProps.d.ts +1 -1
- package/dist/src/shapes/Path.d.ts +1 -1
- package/dist/src/shapes/Text/StyledText.d.ts +2 -2
- package/dist/src/shapes/Text/Text.d.ts +7 -7
- package/dist/src/shapes/Text/TextSVGExportMixin.d.ts +7 -7
- package/dist/src/shapes/Text/constants.d.ts +2 -2
- package/dist/src/util/animation/AnimationRegistry.d.ts +4 -4
- package/dist/src/util/internals/console.d.ts +8 -0
- package/dist/src/util/misc/dom.d.ts +1 -1
- package/dist/src/util/misc/svgParsing.d.ts +2 -1
- package/dist/src/util/typeAssertions.d.ts +2 -2
- package/fabric.ts +45 -3
- package/jest.extend.ts +3 -1
- package/package.json +5 -6
- package/playwright.setup.ts +82 -14
- package/src/ClassRegistry.ts +3 -1
- package/src/Collection.ts +2 -3
- package/src/Intersection.spec.ts +74 -0
- package/src/Intersection.ts +30 -0
- package/src/Pattern/Pattern.ts +2 -1
- package/src/benchmarks/README.md +7 -0
- package/src/benchmarks/calcCornerCoords.mjs +117 -0
- package/src/benchmarks/raycasting.mjs +154 -0
- package/src/canvas/Canvas.ts +23 -11
- package/src/canvas/CanvasOptions.ts +1 -1
- package/src/canvas/DOMManagers/CanvasDOMManager.ts +1 -1
- package/src/canvas/DOMManagers/StaticCanvasDOMManager.ts +7 -7
- package/src/canvas/SelectableCanvas.ts +30 -43
- package/src/canvas/StaticCanvas.ts +9 -7
- package/src/canvas/__tests__/SelectableCanvas.spec.ts +60 -0
- package/src/canvas/__tests__/__snapshots__/eventData.test.ts.snap +193 -2
- package/src/canvas/__tests__/eventData.test.ts +40 -1
- package/src/controls/Control.spec.ts +41 -0
- package/src/controls/Control.ts +36 -44
- package/src/controls/index.ts +1 -1
- package/src/controls/polyControl.ts +8 -5
- package/src/filters/BaseFilter.ts +8 -6
- package/src/filters/BlendImage.ts +4 -4
- package/src/filters/GLProbes/WebGLProbe.ts +2 -1
- package/src/parser/elements_parser.ts +2 -2
- package/src/parser/loadSVGFromString.test.ts +36 -0
- package/src/parser/parseSVGDocument.ts +2 -1
- package/src/parser/parseUseDirectives.ts +6 -2
- package/src/parser/recursivelyParseGradientsXlink.ts +1 -3
- package/src/shapes/ActiveSelection.spec.ts +35 -1
- package/src/shapes/ActiveSelection.ts +3 -1
- package/src/shapes/Group.ts +7 -8
- package/src/shapes/IText/IText.test.ts +43 -0
- package/src/shapes/IText/IText.ts +1 -1
- package/src/shapes/IText/ITextBehavior.ts +2 -2
- package/src/shapes/IText/__snapshots__/IText.test.ts.snap +50 -0
- package/src/shapes/Image.ts +15 -14
- package/src/shapes/Object/FabricObject.spec.ts +16 -0
- package/src/shapes/Object/InteractiveObject.spec.ts +43 -0
- package/src/shapes/Object/InteractiveObject.ts +20 -30
- package/src/shapes/Object/Object.ts +6 -5
- package/src/shapes/Object/ObjectGeometry.ts +11 -126
- package/src/shapes/Object/types/FabricObjectProps.ts +1 -1
- package/src/shapes/Text/StyledText.ts +5 -2
- package/src/shapes/Text/Text.spec.ts +9 -9
- package/src/shapes/Text/Text.ts +16 -15
- package/src/shapes/Text/TextSVGExportMixin.spec.ts +29 -0
- package/src/shapes/Text/TextSVGExportMixin.ts +16 -13
- package/src/shapes/Text/__snapshots__/Text.spec.ts.snap +6 -6
- package/src/shapes/Text/constants.ts +2 -2
- package/src/util/animation/AnimationRegistry.ts +7 -6
- package/src/util/internals/console.ts +18 -0
- package/src/util/internals/dom_request.ts +2 -1
- package/src/util/misc/dom.ts +3 -2
- package/src/util/misc/objectEnlive.ts +3 -2
- package/src/util/misc/planeChange.ts +3 -2
- package/src/util/misc/svgParsing.ts +22 -9
- package/src/util/transform_matrix_removal.ts +3 -3
- package/src/util/typeAssertions.ts +2 -2
- package/typedoc.config.json +6 -0
- package/typedoc.json +3 -2
- package/dist/src/parser/elementById.d.ts +0 -7
- package/src/parser/elementById.ts +0 -18
package/.eslintrc.js
CHANGED
|
@@ -36,6 +36,7 @@ module.exports = {
|
|
|
36
36
|
],
|
|
37
37
|
'no-restricted-syntax': [
|
|
38
38
|
'error',
|
|
39
|
+
// explore how to define the selector: https://astexplorer.net/
|
|
39
40
|
{
|
|
40
41
|
selector: '[callee.object.name="Math"][callee.property.name="hypot"]',
|
|
41
42
|
message:
|
|
@@ -46,6 +47,14 @@ module.exports = {
|
|
|
46
47
|
message:
|
|
47
48
|
'Aliasing or destructing `Math` is not allowed due to restrictions on `Math.hypot` usage.',
|
|
48
49
|
},
|
|
50
|
+
{
|
|
51
|
+
selector: '[callee.object.name="console"]',
|
|
52
|
+
message: 'Use the `log` util',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
selector: 'NewExpression[callee.name="Error"]',
|
|
56
|
+
message: 'Use `FabricError`',
|
|
57
|
+
},
|
|
49
58
|
],
|
|
50
59
|
},
|
|
51
60
|
};
|
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,41 @@
|
|
|
2
2
|
|
|
3
3
|
## [next]
|
|
4
4
|
|
|
5
|
-
## [6.0.0-
|
|
5
|
+
## [6.0.0-beta14]
|
|
6
|
+
|
|
7
|
+
- Fix(SVGParser) ignore missing xlink target issue on svg parsing (#9427) [#9109](https://github.com/fabricjs/fabric.js/issues/9109)
|
|
8
|
+
- fix(#9172): dep export `Object`, `Text`, `Image` [#9433](https://github.com/fabricjs/fabric.js/pull/9433)
|
|
9
|
+
|
|
10
|
+
## [6.0.0-beta14]
|
|
11
|
+
|
|
12
|
+
- fix(Object): fixes centeredScaling prop type [#9401](https://github.com/fabricjs/fabric.js/pull/9401)
|
|
13
|
+
- CI(): fix build caching + tests when merging to master [#9404](https://github.com/fabricjs/fabric.js/pull/9404)
|
|
14
|
+
- chore(): export poly control utils [#9400](https://github.com/fabricjs/fabric.js/pull/9400)
|
|
15
|
+
- fix(Canvas): in/out event names were swapped [#9396](https://github.com/fabricjs/fabric.js/pull/9396)
|
|
16
|
+
- fix(Canvas): `setActiveObject` should update `canvas#_activeSelection` [#9336](https://github.com/fabricjs/fabric.js/pull/9336)
|
|
17
|
+
- patch(Coords): calc oCoords only with canvas ref [#9380](https://github.com/fabricjs/fabric.js/pull/9380)
|
|
18
|
+
- patch(Control): pass object to `calcCornerCoords` [#9376](https://github.com/fabricjs/fabric.js/pull/9376)
|
|
19
|
+
- fix(Canvas): invalidate `_objectsToRender` on stack change [#9387](https://github.com/fabricjs/fabric.js/pull/9387)
|
|
20
|
+
- ci(e2e): fix babel compiling error [#9388](https://github.com/fabricjs/fabric.js/pull/9388)
|
|
21
|
+
- Breaking: Remove node 14 [#9383](https://github.com/fabricjs/fabric.js/pull/9383)
|
|
22
|
+
- chore(): Rename exports that conflicts with JS/WEB api ( Object, Text, Image ). Kept backward compatibility with deprecation notice [#9172](https://github.com/fabricjs/fabric.js/pull/9172)
|
|
23
|
+
- fix(Geometry): `containsPoint` [#9372](https://github.com/fabricjs/fabric.js/pull/9372)
|
|
24
|
+
**BREAKING**:
|
|
25
|
+
- `Canvas#_checkTarget(point, object, pointFromViewport)` => `Canvas#_checkTarget(object, pointFromViewport)`
|
|
26
|
+
- fix(Canvas): avoid firing event twice when working with nested objects [#9329](https://github.com/fabricjs/fabric.js/pull/9329)
|
|
27
|
+
- fix(Control): `calcCornerCoords` angle + calculation [#9377](https://github.com/fabricjs/fabric.js/pull/9377)
|
|
28
|
+
- patch(): dep findCrossPoints in favor of `isPointInPolygon` [#9374](https://github.com/fabricjs/fabric.js/pull/9374)
|
|
29
|
+
- docs() enable typedocs to run again [#9356](https://github.com/fabricjs/fabric.js/pull/9356)
|
|
30
|
+
- chore(): cleanup logs and error messages [#9369](https://github.com/fabricjs/fabric.js/pull/9369)
|
|
31
|
+
- feature(Object) BREAKING: Remove lines parameter from object.containsPoint [#9375](https://github.com/fabricjs/fabric.js/pull/9375)
|
|
32
|
+
- patch(Control): move hit detection to shouldActivate [#9374](https://github.com/fabricjs/fabric.js/pull/9374)
|
|
33
|
+
- fix(Control): method binding for mouseUpHandler, mouseDownHandler, and actionHandler [#9370](https://github.com/fabricjs/fabric.js/pull/9370)
|
|
34
|
+
- fix(StaticCanvas): disposing animations [#9361](https://github.com/fabricjs/fabric.js/pull/9361)
|
|
35
|
+
- fix(IText): cursor width under group [#9341](https://github.com/fabricjs/fabric.js/pull/9341)
|
|
36
|
+
- TS(Canvas): constructor optional el [#9348](https://github.com/fabricjs/fabric.js/pull/9348)
|
|
37
|
+
- fix(Utils): fix exported svg color [#9408](https://github.com/fabricjs/fabric.js/pull/9408)
|
|
38
|
+
|
|
39
|
+
## [6.0.0-beta13]
|
|
6
40
|
|
|
7
41
|
- fix(Textbox): implemente a fix for the style shifting issues on new lines [#9197](https://github.com/fabricjs/fabric.js/pull/9197)
|
|
8
42
|
- Fix(Control) fix a regression in `wrap with fixed anchor`, regression from #8400 [#9326](https://github.com/fabricjs/fabric.js/pull/9326)
|
package/CONTRIBUTING.md
CHANGED
|
@@ -129,15 +129,15 @@ It is more than likely you will be requested to change stuff and refine your wor
|
|
|
129
129
|
[](../../actions/workflows/tests.yml)
|
|
130
130
|
[](../../actions/workflows/codeql-analysis.yml)
|
|
131
131
|
|
|
132
|
-
| Suite
|
|
133
|
-
|
|
|
134
|
-
| Framework
|
|
135
|
-
| Setup
|
|
136
|
-
| Running Tests<br><br><
|
|
137
|
-
| Writing Tests
|
|
138
|
-
| Test Gen
|
|
139
|
-
| Test Spec
|
|
140
|
-
| Outputs
|
|
132
|
+
| Suite | unit (node) | e2e (browser) |
|
|
133
|
+
| ------------------------------------------------------------------------------------------------------------- | :--------------------------------------------- | :----------------------------------------------------------------------------------- |
|
|
134
|
+
| Framework | [`jest`][jest] | [`playwright`][playwright] |
|
|
135
|
+
| Setup | | <pre>npm run build -- -f -w</pre> |
|
|
136
|
+
| Running Tests<br><br><pre>\<test cmd\> -- [filter] [watch]</pre><br>It is advised to use filters to save time | <pre>npm run test:jest -- [filters] [-w]</pre> | <pre>npm run test:e2e -- [filters] [--ui]</pre> |
|
|
137
|
+
| Writing Tests | Add/update `src/*.(spec\|test).ts` files | - Update tests in `e2e/tests`<br>- Create a new test based on `e2e/template` |
|
|
138
|
+
| Test Gen | | <pre>npm start vanilla<br>npx playwright codegen http://localhost:1234</pre> |
|
|
139
|
+
| Test Spec | | - `index.ts`: built and loaded into the web app<br> - `index.spec.ts`: test spec<br> |
|
|
140
|
+
| Outputs | Snapshots next to the test file | - Snapshots next to the test file <br>- `e2e/test-report`<br>- `e2e/test-results` |
|
|
141
141
|
|
|
142
142
|
### Legacy Test Suite
|
|
143
143
|
|
package/dist/fabric.d.ts
CHANGED
|
@@ -30,7 +30,18 @@ export { PencilBrush } from './src/brushes/PencilBrush';
|
|
|
30
30
|
export { CircleBrush } from './src/brushes/CircleBrush';
|
|
31
31
|
export { SprayBrush } from './src/brushes/SprayBrush';
|
|
32
32
|
export { PatternBrush } from './src/brushes/PatternBrush';
|
|
33
|
-
export { FabricObject
|
|
33
|
+
export { FabricObject,
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated Due to a naming conflict with the
|
|
36
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object JS API},
|
|
37
|
+
* `fabric.Object` has been renamed to `FabricObject`
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* import { Object } from 'fabric'; // deprecated
|
|
41
|
+
* import { FabricObject } from 'fabric'; // migration path
|
|
42
|
+
*
|
|
43
|
+
*/
|
|
44
|
+
FabricObject as Object, } from './src/shapes/Object/FabricObject';
|
|
34
45
|
export type { TFabricObjectProps, FabricObjectProps, SerializedObjectProps, } from './src/shapes/Object/types';
|
|
35
46
|
export type { SerializedLineProps } from './src/shapes/Line';
|
|
36
47
|
export { Line } from './src/shapes/Line';
|
|
@@ -47,7 +58,18 @@ export type { SerializedPolylineProps } from './src/shapes/Polyline';
|
|
|
47
58
|
export { Polyline } from './src/shapes/Polyline';
|
|
48
59
|
export { Polygon } from './src/shapes/Polygon';
|
|
49
60
|
export type { GraphemeBBox, SerializedTextProps, TPathAlign, TPathSide, TextProps, } from './src/shapes/Text/Text';
|
|
50
|
-
export {
|
|
61
|
+
export { FabricText,
|
|
62
|
+
/**
|
|
63
|
+
* @deprecated Due to a naming conflict with the
|
|
64
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/Text/Text Web API},
|
|
65
|
+
* `fabric.Text` has been renamed to `FabricText`
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* import { Text } from 'fabric'; // deprecated
|
|
69
|
+
* import { FabricText } from 'fabric'; // migration path
|
|
70
|
+
*
|
|
71
|
+
*/
|
|
72
|
+
FabricText as Text, } from './src/shapes/Text/Text';
|
|
51
73
|
export type { ITextProps, SerializedITextProps, } from './src/shapes/IText/IText';
|
|
52
74
|
export { IText } from './src/shapes/IText/IText';
|
|
53
75
|
export type { GraphemeData, SerializedTextboxProps, TextboxProps, } from './src/shapes/Textbox';
|
|
@@ -57,7 +79,18 @@ export type { GroupEvents, GroupProps, LayoutContext, GroupOwnProps, LayoutConte
|
|
|
57
79
|
export { Group } from './src/shapes/Group';
|
|
58
80
|
export type { ActiveSelectionOptions, MultiSelectionStacking, } from './src/shapes/ActiveSelection';
|
|
59
81
|
export { ActiveSelection } from './src/shapes/ActiveSelection';
|
|
60
|
-
export {
|
|
82
|
+
export { FabricImage,
|
|
83
|
+
/**
|
|
84
|
+
* @deprecated Due to a naming conflict with the
|
|
85
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/Image Web API},
|
|
86
|
+
* `fabric.Image` has been renamed to `FabricImage`
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* import { Image } from 'fabric'; // deprecated
|
|
90
|
+
* import { FabricImage } from 'fabric'; // migration path
|
|
91
|
+
*
|
|
92
|
+
*/
|
|
93
|
+
FabricImage as Image, } from './src/shapes/Image';
|
|
61
94
|
export type { ImageSource, SerializedImageProps, ImageProps, } from './src/shapes/Image';
|
|
62
95
|
export { createCollectionMixin } from './src/Collection';
|
|
63
96
|
export * as util from './src/util';
|