paper 0.13.0 → 0.14.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.
- package/CHANGELOG.md +85 -0
- package/README.md +16 -13
- package/dist/docs/assets/js/paper.js +434 -128
- package/dist/docs/classes/ChangeFlag.html +384 -0
- package/dist/docs/classes/Color.html +1 -1
- package/dist/docs/classes/CompoundPath.html +58 -4
- package/dist/docs/classes/Curve.html +1 -1
- package/dist/docs/classes/CurveLocation.html +1 -1
- package/dist/docs/classes/Event.html +1 -1
- package/dist/docs/classes/Gradient.html +1 -1
- package/dist/docs/classes/GradientStop.html +1 -1
- package/dist/docs/classes/Group.html +89 -4
- package/dist/docs/classes/HitResult.html +3 -2
- package/dist/docs/classes/HostItem.html +6721 -0
- package/dist/docs/classes/Item.html +58 -4
- package/dist/docs/classes/Key.html +1 -1
- package/dist/docs/classes/KeyEvent.html +1 -1
- package/dist/docs/classes/Layer.html +89 -4
- package/dist/docs/classes/Matrix.html +1 -1
- package/dist/docs/classes/MouseEvent.html +1 -1
- package/dist/docs/classes/PaperScope.html +2 -1
- package/dist/docs/classes/PaperScript.html +2 -1
- package/dist/docs/classes/Path.html +59 -5
- package/dist/docs/classes/PathItem.html +58 -4
- package/dist/docs/classes/Point.html +1 -1
- package/dist/docs/classes/PointText.html +58 -4
- package/dist/docs/classes/Project.html +188 -1
- package/dist/docs/classes/Raster.html +58 -4
- package/dist/docs/classes/Rectangle.html +1 -1
- package/dist/docs/classes/Segment.html +1 -1
- package/dist/docs/classes/Shape.html +58 -4
- package/dist/docs/classes/Size.html +1 -1
- package/dist/docs/classes/Style.html +2 -2
- package/dist/docs/classes/SymbolDefinition.html +1 -1
- package/dist/docs/classes/SymbolItem.html +58 -4
- package/dist/docs/classes/TextItem.html +58 -4
- package/dist/docs/classes/Tool.html +126 -1
- package/dist/docs/classes/ToolEvent.html +1 -1
- package/dist/docs/classes/Tween.html +1 -1
- package/dist/docs/classes/View.html +144 -2
- package/dist/docs/classes/global.html +1 -1
- package/dist/docs/classes/index.html +2 -2
- package/dist/docs/index.html +1 -1
- package/dist/paper-core.js +425 -123
- package/dist/paper-core.min.js +3 -3
- package/dist/paper-full.js +434 -128
- package/dist/paper-full.min.js +3 -3
- package/dist/paper-sourced.js +18631 -0
- package/dist/paper.d.ts +284 -7
- package/package.json +6 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,90 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## `0.14.0`
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Add `options.handlers` to `PaperScript.execute()`, to export further global
|
|
8
|
+
handlers next to `onFrame`, `onResize` and the tool's, for hosts that call
|
|
9
|
+
them themselves, such as Scriptographer's `onStop`.
|
|
10
|
+
- Add `Tool#eventInterval`, as Scriptographer had it, to fire `onMouseDrag` again
|
|
11
|
+
at an interval while the mouse button is held, also when the mouse doesn't
|
|
12
|
+
move.
|
|
13
|
+
- Add `Project#scope`, `View#scope`, `Item#scope` and `Tool#scope`, to get from
|
|
14
|
+
each of them to its `PaperScope` (#1634).
|
|
15
|
+
- Add `Group#isolated`, to draw a group or layer through a temporary canvas, so
|
|
16
|
+
that the blend modes of its children, such as `'destination-out'`, only apply
|
|
17
|
+
within it, like CSS's `isolation: isolate` (#474).
|
|
18
|
+
- Add `View#dispatchMouseEvent()` and `View#dispatchKeyEvent()`, to feed mouse
|
|
19
|
+
and key events from hosts without a DOM, such as workers, through the same
|
|
20
|
+
handling as the DOM's events, for tools, items and views.
|
|
21
|
+
- Add `settings.scaleStrokes`, to scale the stroke widths of paths and
|
|
22
|
+
compound paths along with their content when matrices are applied (#2098,
|
|
23
|
+
#1514).
|
|
24
|
+
- Add the `paper-sourced.js` build, in which a project's items can be backed
|
|
25
|
+
by a host document through `Project#source`: items are created as light
|
|
26
|
+
shells from the host's records, and load their content and children from
|
|
27
|
+
the host on first access, so a script costs what it touches. Includes
|
|
28
|
+
`HostItem`, for the host's own kinds of nodes (#2203).
|
|
29
|
+
- Add `Project#trackChanges` and `Project#takeChanges()`, to let hosts that
|
|
30
|
+
keep their own document update only the items that changed, and export
|
|
31
|
+
`ChangeFlag` (#2202).
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
|
|
35
|
+
- `Path.RegularPolygon()` follows Illustrator: it stands on a flat bottom edge
|
|
36
|
+
for any number of sides, and its segments run counterclockwise from its top
|
|
37
|
+
vertex, or with an even number of sides, from the right end of its top edge.
|
|
38
|
+
This changes the segment order of all regular polygons, and turns those with
|
|
39
|
+
a multiple of 6 sides onto an edge (#1787).
|
|
40
|
+
- Hit-test transparent fills, as in SVG: only items without a fill color are
|
|
41
|
+
not hit through their fill (#1157).
|
|
42
|
+
- `paper.install()` keeps what the target scope has already, such as the
|
|
43
|
+
native `Event`, `MouseEvent` and `Symbol`, and PaperScript doesn't shadow
|
|
44
|
+
existing globals with Paper.js's classes of the same name either (#1832,
|
|
45
|
+
#1652).
|
|
46
|
+
- `Item#importJSON()` into an existing item resets the fields that the JSON
|
|
47
|
+
leaves out, so the item ends up the same as a newly imported one, with its
|
|
48
|
+
place in the scene graph and its event handlers kept (#1425, #1324).
|
|
49
|
+
- Canvases without `resize` get their CSS size from the view on every screen,
|
|
50
|
+
not only at pixel ratios other than 1, where the page's CSS won (#2088).
|
|
51
|
+
- `#hitTestAll()` reports every segment and handle of a path within the
|
|
52
|
+
tolerance, closest first, followed by its stroke or fill hit, instead of only
|
|
53
|
+
the first hit per path (#1294).
|
|
54
|
+
|
|
55
|
+
### Fixed
|
|
56
|
+
|
|
57
|
+
- Create the tool in PaperScript for all of its global handlers, also for
|
|
58
|
+
scripts that only define `onActivate()` or `onDeactivate()`, and document
|
|
59
|
+
`Tool#onActivate` and `Tool#onDeactivate`.
|
|
60
|
+
- Keep `Key.modifiers` in sync with the flags of mouse events, so modifier keys
|
|
61
|
+
pressed or released while the page didn't have the focus don't stay wrong
|
|
62
|
+
(#1140).
|
|
63
|
+
- Keep Paper.js's own blend modes, which CSS doesn't have, such as
|
|
64
|
+
`'destination-out'`, through SVG export and import, in a
|
|
65
|
+
`data-paper-blend-mode` attribute (#1296).
|
|
66
|
+
- Throw a clear error when creating an item without a project, instead of a
|
|
67
|
+
null access deep inside the constructor (#1889).
|
|
68
|
+
- Free the pixels of temporary canvases when they're released, which their pool
|
|
69
|
+
kept allocated at their largest size for the life of the page.
|
|
70
|
+
- Keep the size of rasters in JSON, so imported rasters have their size and
|
|
71
|
+
bounds before their image has loaded, or if it fails to load (#1598).
|
|
72
|
+
- Fix the frame timer of workers and Node.js running forever after any script,
|
|
73
|
+
which kept hosts from seeing scripts end.
|
|
74
|
+
- Fix touch scrolling over empty parts of a canvas whose items have mouse
|
|
75
|
+
handlers (#1930).
|
|
76
|
+
- Fix mouse events reaching items and views through elements that cover the
|
|
77
|
+
canvas, such as menus. Drags still reach beyond them (#992).
|
|
78
|
+
- Fix the points of `#hitTestAll()` results of items inside transformed
|
|
79
|
+
groups, which were in the items' own coordinates.
|
|
80
|
+
- Support `strokeScaling: false` on text, exactly for uniform scaling (#1703).
|
|
81
|
+
- Fix the view size of canvases inside elements with CSS transforms, which
|
|
82
|
+
only scale the canvas on screen.
|
|
83
|
+
- Fix italic and oblique font weights in SVG export and import, which SVG
|
|
84
|
+
keeps in `font-style` (#937).
|
|
85
|
+
- Fix `onFrame` in web workers, where views have no element (#2200).
|
|
86
|
+
- Fix `PaperScope#execute()` in web workers (#2201).
|
|
87
|
+
|
|
3
88
|
## `0.13.0`
|
|
4
89
|
|
|
5
90
|
### Added
|
package/README.md
CHANGED
|
@@ -201,16 +201,14 @@ Paper.js uses [Gulp.js](https://gulpjs.com/) for building, and has a couple of
|
|
|
201
201
|
dependencies as NPM modules. Read the chapter [Installing Node.js and
|
|
202
202
|
NPM](#installing-nodejs-and-npm) if you still need to install these.
|
|
203
203
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
needs to be installed now. See
|
|
207
|
-
[Installing Yarn](https://classic.yarnpkg.com/en/docs/install/) for details.
|
|
204
|
+
Development uses [pnpm](https://pnpm.io/), which needs to be installed too. See
|
|
205
|
+
[Installing pnpm](https://pnpm.io/installation) for details.
|
|
208
206
|
|
|
209
207
|
In order to be able to build Paper.js, after checking out the repository, paper
|
|
210
208
|
has dependencies that need to be installed. Install them by issuing the
|
|
211
209
|
following commands from the Paper.js directory:
|
|
212
210
|
|
|
213
|
-
|
|
211
|
+
pnpm install
|
|
214
212
|
|
|
215
213
|
### Building the Library
|
|
216
214
|
|
|
@@ -218,7 +216,7 @@ The Paper.js sources are distributed across many separate files, organised in
|
|
|
218
216
|
subfolders inside the `src` folder. To compile them all into distributable
|
|
219
217
|
files, you can run the `build` task:
|
|
220
218
|
|
|
221
|
-
|
|
219
|
+
pnpm build
|
|
222
220
|
|
|
223
221
|
You will then find the built library files inside the `dist` folder, named
|
|
224
222
|
`paper-full.js` and `paper-core.js`, along with their minified versions. Read
|
|
@@ -236,11 +234,11 @@ library.
|
|
|
236
234
|
This means you can switch between loading from sources and loading a built
|
|
237
235
|
library simply by running.
|
|
238
236
|
|
|
239
|
-
|
|
237
|
+
pnpm load
|
|
240
238
|
|
|
241
239
|
And to go back to a built library
|
|
242
240
|
|
|
243
|
-
|
|
241
|
+
pnpm build
|
|
244
242
|
|
|
245
243
|
Note that your PaperScripts examples do not need to change, they can keep
|
|
246
244
|
loading `dist/paper-full.js`, which will always do the right thing. Note also
|
|
@@ -250,7 +248,7 @@ that `src/load.js` handles both browsers and Node.js, as supported by Prepro.js.
|
|
|
250
248
|
|
|
251
249
|
Create a final zipped distribution file inside the `dist` folder:
|
|
252
250
|
|
|
253
|
-
|
|
251
|
+
pnpm dist
|
|
254
252
|
|
|
255
253
|
### Branch structure
|
|
256
254
|
|
|
@@ -261,7 +259,7 @@ only merged into [`main`](https://github.com/paperjs/paper.js/tree/main)
|
|
|
261
259
|
when a new release occurs.
|
|
262
260
|
|
|
263
261
|
As of version `0.9.26`, the `dist` folder is excluded on all branches, and the
|
|
264
|
-
building is now part of the `
|
|
262
|
+
building is now part of the `pnpm publish` process by way of the `prepublish`
|
|
265
263
|
script.
|
|
266
264
|
|
|
267
265
|
We also offer prebuilt versions of the latest state of the `develop` branch on
|
|
@@ -273,7 +271,7 @@ and [`prebuilt/dist`](https://github.com/paperjs/paper.js/tree/prebuilt/dist).
|
|
|
273
271
|
Similarly to building the library, you can run the `docs` task to build the
|
|
274
272
|
documentation:
|
|
275
273
|
|
|
276
|
-
|
|
274
|
+
pnpm docs
|
|
277
275
|
|
|
278
276
|
Your docs will then be located at `dist/docs`.
|
|
279
277
|
|
|
@@ -291,11 +289,16 @@ CORS restrictions. In order to run the browser based tests on Chrome, you need
|
|
|
291
289
|
to run a local web-server through Gulp.js. The following command will handle it
|
|
292
290
|
for you, and will also open the browser at the right address straight away:
|
|
293
291
|
|
|
294
|
-
|
|
292
|
+
pnpm test:browser
|
|
293
|
+
|
|
294
|
+
To run them in headless Chrome instead, as CI does, and report the result in the
|
|
295
|
+
terminal:
|
|
296
|
+
|
|
297
|
+
pnpm test:chrome
|
|
295
298
|
|
|
296
299
|
To test the Node.js version of Paper.js, use this command:
|
|
297
300
|
|
|
298
|
-
|
|
301
|
+
pnpm test
|
|
299
302
|
|
|
300
303
|
### Contributing [](https://www.codetriage.com/paperjs/paper.js)
|
|
301
304
|
|