fabric 6.0.0-beta12 โ 6.0.0-beta14
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/.gitmodules +3 -0
- package/.prettierignore +4 -3
- package/CHANGELOG.md +47 -0
- package/CONTRIBUTING.md +12 -10
- package/dist/fabric.d.ts +3 -3
- package/dist/index.js +335 -378
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.mjs +332 -378
- package/dist/index.mjs.map +1 -1
- package/dist/index.node.cjs +335 -378
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.mjs +332 -378
- package/dist/index.node.mjs.map +1 -1
- package/dist/src/Collection.d.ts +1 -1
- package/dist/src/EventTypeDefs.d.ts +1 -0
- 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 +14 -19
- 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/ActiveSelection.d.ts +15 -3
- package/dist/src/shapes/Group.d.ts +5 -1
- package/dist/src/shapes/IText/ITextBehavior.d.ts +3 -3
- package/dist/src/shapes/Image.d.ts +19 -11
- package/dist/src/shapes/Object/FabricObject.d.ts +8 -0
- 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/ObjectOrigin.d.ts +0 -14
- package/dist/src/shapes/Object/types/FabricObjectProps.d.ts +1 -1
- package/dist/src/shapes/Object/types/ObjectProps.d.ts +9 -0
- 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 +17 -9
- package/dist/src/shapes/Text/TextSVGExportMixin.d.ts +7 -7
- package/dist/src/shapes/Text/constants.d.ts +2 -2
- package/dist/src/shapes/Textbox.d.ts +3 -1
- package/dist/src/util/animation/AnimationRegistry.d.ts +4 -4
- package/dist/src/util/animation/types.d.ts +1 -1
- 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 +7 -3
- package/jest.config.js +1 -1
- package/jest.extend.ts +125 -0
- package/jest.setup.ts +5 -0
- package/package.json +6 -6
- package/playwright.setup.ts +82 -14
- package/src/ClassRegistry.ts +3 -1
- package/src/Collection.ts +3 -4
- package/src/EventTypeDefs.ts +1 -0
- 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 +38 -22
- 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 +35 -47
- 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 +772 -0
- package/src/canvas/__tests__/eventData.test.ts +141 -0
- 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 +20 -19
- package/src/controls/scale.ts +1 -1
- package/src/controls/wrapWithFixedAnchor.spec.ts +122 -0
- package/src/controls/wrapWithFixedAnchor.ts +7 -1
- 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/parseSVGDocument.ts +2 -1
- package/src/shapes/ActiveSelection.spec.ts +123 -0
- package/src/shapes/ActiveSelection.ts +36 -12
- 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.test.ts +3 -4
- package/src/shapes/IText/ITextBehavior.ts +4 -3
- package/src/shapes/IText/__snapshots__/IText.test.ts.snap +50 -0
- package/src/shapes/Image.ts +23 -14
- package/src/shapes/Object/FabricObject.spec.ts +16 -0
- package/src/shapes/Object/FabricObject.ts +8 -0
- package/src/shapes/Object/InteractiveObject.spec.ts +43 -0
- package/src/shapes/Object/InteractiveObject.ts +20 -30
- package/src/shapes/Object/Object.spec.ts +61 -0
- package/src/shapes/Object/Object.ts +24 -13
- package/src/shapes/Object/ObjectGeometry.ts +11 -126
- package/src/shapes/Object/ObjectOrigin.ts +0 -48
- package/src/shapes/Object/types/FabricObjectProps.ts +1 -1
- package/src/shapes/Object/types/ObjectProps.ts +10 -0
- package/src/shapes/Text/StyledText.ts +5 -2
- package/src/shapes/Text/Text.spec.ts +11 -11
- package/src/shapes/Text/Text.ts +29 -19
- 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 +7 -6
- package/src/shapes/Text/constants.ts +2 -2
- package/src/shapes/Textbox.spec.ts +4 -5
- package/src/shapes/Textbox.ts +6 -4
- package/src/shapes/__snapshots__/ActiveSelection.spec.ts.snap +43 -0
- package/src/shapes/__snapshots__/Textbox.spec.ts.snap +2 -0
- package/src/util/animation/AnimationRegistry.ts +7 -6
- package/src/util/animation/types.ts +2 -1
- package/src/util/dom_misc.ts +3 -2
- 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 +11 -0
- package/toMatchRoundedSnapshot.ts +0 -66
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/.gitmodules
ADDED
package/.prettierignore
CHANGED
|
@@ -7,13 +7,14 @@ change-output.md
|
|
|
7
7
|
before_commit
|
|
8
8
|
/coverage/
|
|
9
9
|
.idea/
|
|
10
|
-
/dist/fabric.require.js
|
|
11
|
-
/dist/fabric.min.js.gz
|
|
12
10
|
/cli_output/
|
|
13
11
|
/scripts/cli_cache.json
|
|
14
|
-
|
|
12
|
+
**/dist/
|
|
15
13
|
/lib/
|
|
16
14
|
/test/
|
|
17
15
|
.next/
|
|
18
16
|
.parcel-cache/
|
|
19
17
|
/docs/
|
|
18
|
+
/e2e/test-results/
|
|
19
|
+
/e2e/test-report/
|
|
20
|
+
/e2e/tests/**/*-snapshots/*.json
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,53 @@
|
|
|
2
2
|
|
|
3
3
|
## [next]
|
|
4
4
|
|
|
5
|
+
## [6.0.0-beta13]
|
|
6
|
+
|
|
7
|
+
- fix(Object): fixes centeredScaling prop type [#9401](https://github.com/fabricjs/fabric.js/pull/9401)
|
|
8
|
+
- CI(): fix build caching + tests when merging to master [#9404](https://github.com/fabricjs/fabric.js/pull/9404)
|
|
9
|
+
- chore(): export poly control utils [#9400](https://github.com/fabricjs/fabric.js/pull/9400)
|
|
10
|
+
- fix(Canvas): in/out event names were swapped [#9396](https://github.com/fabricjs/fabric.js/pull/9396)
|
|
11
|
+
- fix(Canvas): `setActiveObject` should update `canvas#_activeSelection` [#9336](https://github.com/fabricjs/fabric.js/pull/9336)
|
|
12
|
+
- patch(Coords): calc oCoords only with canvas ref [#9380](https://github.com/fabricjs/fabric.js/pull/9380)
|
|
13
|
+
- patch(Control): pass object to `calcCornerCoords` [#9376](https://github.com/fabricjs/fabric.js/pull/9376)
|
|
14
|
+
- fix(Canvas): invalidate `_objectsToRender` on stack change [#9387](https://github.com/fabricjs/fabric.js/pull/9387)
|
|
15
|
+
- ci(e2e): fix babel compiling error [#9388](https://github.com/fabricjs/fabric.js/pull/9388)
|
|
16
|
+
- Breaking: Remove node 14 [#9383](https://github.com/fabricjs/fabric.js/pull/9383)
|
|
17
|
+
- 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)
|
|
18
|
+
- fix(Geometry): `containsPoint` [#9372](https://github.com/fabricjs/fabric.js/pull/9372)
|
|
19
|
+
**BREAKING**:
|
|
20
|
+
- `Canvas#_checkTarget(point, object, pointFromViewport)` => `Canvas#_checkTarget(object, pointFromViewport)`
|
|
21
|
+
- fix(Canvas): avoid firing event twice when working with nested objects [#9329](https://github.com/fabricjs/fabric.js/pull/9329)
|
|
22
|
+
- fix(Control): `calcCornerCoords` angle + calculation [#9377](https://github.com/fabricjs/fabric.js/pull/9377)
|
|
23
|
+
- patch(): dep findCrossPoints in favor of `isPointInPolygon` [#9374](https://github.com/fabricjs/fabric.js/pull/9374)
|
|
24
|
+
- docs() enable typedocs to run again [#9356](https://github.com/fabricjs/fabric.js/pull/9356)
|
|
25
|
+
- chore(): cleanup logs and error messages [#9369](https://github.com/fabricjs/fabric.js/pull/9369)
|
|
26
|
+
- feature(Object) BREAKING: Remove lines parameter from object.containsPoint [#9375](https://github.com/fabricjs/fabric.js/pull/9375)
|
|
27
|
+
- patch(Control): move hit detection to shouldActivate [#9374](https://github.com/fabricjs/fabric.js/pull/9374)
|
|
28
|
+
- fix(Control): method binding for mouseUpHandler, mouseDownHandler, and actionHandler [#9370](https://github.com/fabricjs/fabric.js/pull/9370)
|
|
29
|
+
- fix(StaticCanvas): disposing animations [#9361](https://github.com/fabricjs/fabric.js/pull/9361)
|
|
30
|
+
- fix(IText): cursor width under group [#9341](https://github.com/fabricjs/fabric.js/pull/9341)
|
|
31
|
+
- TS(Canvas): constructor optional el [#9348](https://github.com/fabricjs/fabric.js/pull/9348)
|
|
32
|
+
- fix(Utils): fix exported svg color [#9408](https://github.com/fabricjs/fabric.js/pull/9408)
|
|
33
|
+
|
|
34
|
+
## [6.0.0-beta13]
|
|
35
|
+
|
|
36
|
+
- fix(Textbox): implemente a fix for the style shifting issues on new lines [#9197](https://github.com/fabricjs/fabric.js/pull/9197)
|
|
37
|
+
- Fix(Control) fix a regression in `wrap with fixed anchor`, regression from #8400 [#9326](https://github.com/fabricjs/fabric.js/pull/9326)
|
|
38
|
+
- test(e2e): improve test case for line shifting and style with more colors [#9327](https://github.com/fabricjs/fabric.js/pull/9327)
|
|
39
|
+
- test(e2e): node canvas visual tests [#9134](https://github.com/fabricjs/fabric.js/pull/9134)
|
|
40
|
+
- fix(ActiveSelection): make sure canvas is in charge of setting initial coords [#9322](https://github.com/fabricjs/fabric.js/pull/9322)
|
|
41
|
+
- test(): Migrate json control tests [#9323](https://github.com/fabricjs/fabric.js/pull/9323)
|
|
42
|
+
- fix() Textbox inputs with new lines, regression from #9097 [#9192](https://github.com/fabricjs/fabric.js/pull/9192)
|
|
43
|
+
- docs(): add link to contributing guide [#8393](https://github.com/fabricjs/fabric.js/pull/8393)
|
|
44
|
+
- test(e2e): Drag&Drop tests [#9112](https://github.com/fabricjs/fabric.js/pull/9112)
|
|
45
|
+
- fix(CanvasEvents): regression of `getPointer` usages + BREAKING: drop event data [#9186](https://github.com/fabricjs/fabric.js/pull/9186)
|
|
46
|
+
- feat(Object): BREAKING rm \_setOriginToCenter and \_resetOrigin unuseful methods [#9179](https://github.com/fabricjs/fabric.js/pull/9179)
|
|
47
|
+
- fix(ActiveSelection): reset positioning when cleared [#9088](https://github.com/fabricjs/fabric.js/pull/9088)
|
|
48
|
+
- ci(): generate docs [#9169](https://github.com/fabricjs/fabric.js/pull/9169)
|
|
49
|
+
- fix(utils) Fixes the code for the anchor point in point controls for polygons [#9178](https://github.com/fabricjs/fabric.js/pull/9178)
|
|
50
|
+
- CD(): website submodule [#9165](https://github.com/fabricjs/fabric.js/pull/9165)
|
|
51
|
+
|
|
5
52
|
## [6.0.0-beta12]
|
|
6
53
|
|
|
7
54
|
- fix(Object): border rendering with padding under group [#9161](https://github.com/fabricjs/fabric.js/pull/9161)
|
package/CONTRIBUTING.md
CHANGED
|
@@ -108,7 +108,8 @@ Fabric is an open source project ๐ฆ and as such depends on the **genuine effor
|
|
|
108
108
|
PRs must be backed with relevant tests, follow [TESTING](#-testing). If you never wrote a test or you find our tests unclear to extend, just ask for help.
|
|
109
109
|
Aim to cover 100% of the changes.
|
|
110
110
|
- **Docs** \
|
|
111
|
-
|
|
111
|
+
Update guides if necessary.\
|
|
112
|
+
Add relevant comments to your code using [JSDoc3][jsdoc], [JSDoc reference supported by TS][tsjsdoc].\
|
|
112
113
|
The generated documentation can be found at [fabricjs.com][docs], see [DOCS](#-improving-docs).
|
|
113
114
|
- **Changelog**\
|
|
114
115
|
Add a concise listing to the [**CHANGELOG**](CHANGELOG.md) describing what has changed or let github actions add the PR title for you.
|
|
@@ -128,15 +129,15 @@ It is more than likely you will be requested to change stuff and refine your wor
|
|
|
128
129
|
[](../../actions/workflows/tests.yml)
|
|
129
130
|
[](../../actions/workflows/codeql-analysis.yml)
|
|
130
131
|
|
|
131
|
-
| Suite
|
|
132
|
-
|
|
|
133
|
-
| Framework
|
|
134
|
-
| Setup
|
|
135
|
-
| Running Tests<br><br><
|
|
136
|
-
| Writing Tests
|
|
137
|
-
| Test Gen
|
|
138
|
-
| Test Spec
|
|
139
|
-
| 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` |
|
|
140
141
|
|
|
141
142
|
### Legacy Test Suite
|
|
142
143
|
|
|
@@ -263,6 +264,7 @@ Don't forget to unlink the package once you're done.
|
|
|
263
264
|
[prettier_extension]: https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode
|
|
264
265
|
[eslint]: https://eslint.org/
|
|
265
266
|
[jsdoc]: https://jsdoc.app/
|
|
267
|
+
[tsjsdoc]: https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html
|
|
266
268
|
[playwright]: https://playwright.dev/
|
|
267
269
|
[jest]: https://jestjs.io/
|
|
268
270
|
[qunit]: https://qunitjs.com/
|
package/dist/fabric.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ 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 as Object } from './src/shapes/Object/FabricObject';
|
|
33
|
+
export { FabricObject, _Object as Object, } from './src/shapes/Object/FabricObject';
|
|
34
34
|
export type { TFabricObjectProps, FabricObjectProps, SerializedObjectProps, } from './src/shapes/Object/types';
|
|
35
35
|
export type { SerializedLineProps } from './src/shapes/Line';
|
|
36
36
|
export { Line } from './src/shapes/Line';
|
|
@@ -47,7 +47,7 @@ export type { SerializedPolylineProps } from './src/shapes/Polyline';
|
|
|
47
47
|
export { Polyline } from './src/shapes/Polyline';
|
|
48
48
|
export { Polygon } from './src/shapes/Polygon';
|
|
49
49
|
export type { GraphemeBBox, SerializedTextProps, TPathAlign, TPathSide, TextProps, } from './src/shapes/Text/Text';
|
|
50
|
-
export { Text } from './src/shapes/Text/Text';
|
|
50
|
+
export { Text, FabricText } from './src/shapes/Text/Text';
|
|
51
51
|
export type { ITextProps, SerializedITextProps, } from './src/shapes/IText/IText';
|
|
52
52
|
export { IText } from './src/shapes/IText/IText';
|
|
53
53
|
export type { GraphemeData, SerializedTextboxProps, TextboxProps, } from './src/shapes/Textbox';
|
|
@@ -57,7 +57,7 @@ export type { GroupEvents, GroupProps, LayoutContext, GroupOwnProps, LayoutConte
|
|
|
57
57
|
export { Group } from './src/shapes/Group';
|
|
58
58
|
export type { ActiveSelectionOptions, MultiSelectionStacking, } from './src/shapes/ActiveSelection';
|
|
59
59
|
export { ActiveSelection } from './src/shapes/ActiveSelection';
|
|
60
|
-
export { Image } from './src/shapes/Image';
|
|
60
|
+
export { Image, FabricImage } from './src/shapes/Image';
|
|
61
61
|
export type { ImageSource, SerializedImageProps, ImageProps, } from './src/shapes/Image';
|
|
62
62
|
export { createCollectionMixin } from './src/Collection';
|
|
63
63
|
export * as util from './src/util';
|