paper 0.16.0 → 1.0.0-rc.1
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 +294 -0
- package/LICENSE.txt +1 -1
- package/MIGRATION.md +402 -0
- package/README.md +137 -143
- package/dist/esm/anim/Tween.js +404 -0
- package/dist/esm/basic/Line.js +252 -0
- package/dist/esm/basic/Matrix.js +603 -0
- package/dist/esm/basic/Point.js +738 -0
- package/dist/esm/basic/Rectangle.js +788 -0
- package/dist/esm/basic/Size.js +368 -0
- package/dist/esm/boolean/graph.js +950 -0
- package/dist/esm/boolean/index.js +143 -0
- package/dist/esm/boolean/operations.js +94 -0
- package/dist/esm/boolean/split.js +89 -0
- package/dist/esm/canvas/blendModes.js +115 -0
- package/dist/esm/canvas/canvasProvider.js +102 -0
- package/dist/esm/constants.js +130 -0
- package/dist/esm/core/Base.js +52 -0
- package/dist/esm/core/Emitter.js +215 -0
- package/dist/esm/core/features.js +53 -0
- package/dist/esm/core/serialization.js +174 -0
- package/dist/esm/core.js +15 -0
- package/dist/esm/dom/domElement.js +112 -0
- package/dist/esm/dom/domEvent.js +106 -0
- package/dist/esm/env.js +66 -0
- package/dist/esm/event/DrawEvent.js +38 -0
- package/dist/esm/event/Event.js +79 -0
- package/dist/esm/event/Key.js +236 -0
- package/dist/esm/event/KeyEvent.js +39 -0
- package/dist/esm/event/MouseEvent.js +91 -0
- package/dist/esm/hosted/HostItem.js +60 -0
- package/dist/esm/hosted/Hosting.js +1061 -0
- package/dist/esm/hosted/index.js +20 -0
- package/dist/esm/index.js +38 -0
- package/dist/esm/internal.js +115 -0
- package/dist/esm/item/Effect.js +256 -0
- package/dist/esm/item/EffectInstance.js +184 -0
- package/dist/esm/item/Group.js +293 -0
- package/dist/esm/item/HitResult.js +126 -0
- package/dist/esm/item/Item.js +3339 -0
- package/dist/esm/item/ItemDefinition.js +95 -0
- package/dist/esm/item/Layer.js +69 -0
- package/dist/esm/item/Project.js +1013 -0
- package/dist/esm/item/Raster.js +722 -0
- package/dist/esm/item/Shape.js +355 -0
- package/dist/esm/item/SymbolDefinition.js +68 -0
- package/dist/esm/item/SymbolItem.js +131 -0
- package/dist/esm/item/bounds.js +324 -0
- package/dist/esm/item/draw.js +525 -0
- package/dist/esm/item/effects.js +124 -0
- package/dist/esm/item/expand.js +87 -0
- package/dist/esm/item/hitTest.js +203 -0
- package/dist/esm/item/hosting.js +12 -0
- package/dist/esm/item/props.js +12 -0
- package/dist/esm/item/query.js +139 -0
- package/dist/esm/item/sampling.js +67 -0
- package/dist/esm/item/transform.js +128 -0
- package/dist/esm/net/http.js +26 -0
- package/dist/esm/node/CanvasAdapter.js +137 -0
- package/dist/esm/node/index.js +150 -0
- package/dist/esm/node/peers.js +27 -0
- package/dist/esm/offset/curves.js +866 -0
- package/dist/esm/offset/index.js +70 -0
- package/dist/esm/offset/offset.js +178 -0
- package/dist/esm/offset/outline.js +91 -0
- package/dist/esm/offset/pen.js +298 -0
- package/dist/esm/offset/profile.js +772 -0
- package/dist/esm/offset/round.js +213 -0
- package/dist/esm/offset/sweep.js +100 -0
- package/dist/esm/paperscript/PaperScript.js +832 -0
- package/dist/esm/paperscript/autoload.js +27 -0
- package/dist/esm/paperscript/index.js +17 -0
- package/dist/esm/path/CompoundPath.js +367 -0
- package/dist/esm/path/Curve.js +996 -0
- package/dist/esm/path/CurveLocation.js +462 -0
- package/dist/esm/path/Path.js +1761 -0
- package/dist/esm/path/PathFlattener.js +186 -0
- package/dist/esm/path/PathItem.js +757 -0
- package/dist/esm/path/Segment.js +640 -0
- package/dist/esm/path/SegmentPoint.js +106 -0
- package/dist/esm/path/StrokeProfile.js +387 -0
- package/dist/esm/path/StrokeProfileStop.js +207 -0
- package/dist/esm/path/boolean.js +284 -0
- package/dist/esm/path/bounds.js +257 -0
- package/dist/esm/path/crossing.js +114 -0
- package/dist/esm/path/draw.js +161 -0
- package/dist/esm/path/hitTest.js +259 -0
- package/dist/esm/path/offset.js +152 -0
- package/dist/esm/path/shapes.js +231 -0
- package/dist/esm/path/smooth.js +84 -0
- package/dist/esm/path/values.js +40 -0
- package/dist/esm/scope/PaperScope.js +288 -0
- package/dist/esm/scope/PaperScopeItem.js +74 -0
- package/dist/esm/smoothing/index.js +71 -0
- package/dist/esm/style/Color.js +917 -0
- package/dist/esm/style/Gradient.js +191 -0
- package/dist/esm/style/GradientStop.js +168 -0
- package/dist/esm/style/PatternDefinition.js +383 -0
- package/dist/esm/style/Style.js +503 -0
- package/dist/esm/svg/index.js +27 -0
- package/dist/esm/svg/svgElement.js +97 -0
- package/dist/esm/svg/svgExport.js +847 -0
- package/dist/esm/svg/svgImport.js +1101 -0
- package/dist/esm/svg/svgStyles.js +96 -0
- package/dist/esm/text/AreaText.js +190 -0
- package/dist/esm/text/PathText.js +111 -0
- package/dist/esm/text/PointText.js +92 -0
- package/dist/esm/text/TextItem.js +538 -0
- package/dist/esm/text/TextRange.js +169 -0
- package/dist/esm/text/TextStory.js +394 -0
- package/dist/esm/text/areaLayout.js +439 -0
- package/dist/esm/text/layout.js +265 -0
- package/dist/esm/text/measure.js +57 -0
- package/dist/esm/text/pathLayout.js +93 -0
- package/dist/esm/tool/Tool.js +284 -0
- package/dist/esm/tool/ToolEvent.js +232 -0
- package/dist/esm/util/Formatter.js +57 -0
- package/dist/esm/util/collisions.js +216 -0
- package/dist/esm/util/list.js +110 -0
- package/dist/esm/util/numerical.js +656 -0
- package/dist/esm/util/object.js +81 -0
- package/dist/esm/util/string.js +29 -0
- package/dist/esm/util/uid.js +31 -0
- package/dist/esm/values/arcs.js +243 -0
- package/dist/esm/values/curve.js +975 -0
- package/dist/esm/values/fit.js +290 -0
- package/dist/esm/values/index.js +23 -0
- package/dist/esm/values/intersections.js +869 -0
- package/dist/esm/values/matrix.js +114 -0
- package/dist/esm/values/path.js +174 -0
- package/dist/esm/values/profile.js +221 -0
- package/dist/esm/values/region.js +63 -0
- package/dist/esm/values/smooth.js +248 -0
- package/dist/esm/values/svg.js +287 -0
- package/dist/esm/view/CanvasView.js +106 -0
- package/dist/esm/view/View.js +775 -0
- package/dist/esm/view/input.js +527 -0
- package/dist/paper-full.js +33083 -22681
- package/dist/paper-full.min.js +36 -31
- package/dist/paper-hosted.js +33898 -23223
- package/dist/paper-hosted.min.js +37 -0
- package/dist/paper-slim.js +28581 -0
- package/dist/paper-slim.min.js +17 -0
- package/dist/types/anim/Tween.d.ts +164 -0
- package/dist/types/basic/Line.d.ts +136 -0
- package/dist/types/basic/Matrix.d.ts +387 -0
- package/dist/types/basic/Point.d.ts +781 -0
- package/dist/types/basic/Rectangle.d.ts +550 -0
- package/dist/types/basic/Size.d.ts +457 -0
- package/dist/types/boolean/graph.d.ts +123 -0
- package/dist/types/boolean/index.d.ts +74 -0
- package/dist/types/boolean/operations.d.ts +9 -0
- package/dist/types/boolean/split.d.ts +19 -0
- package/dist/types/canvas/blendModes.d.ts +18 -0
- package/dist/types/canvas/canvasProvider.d.ts +32 -0
- package/dist/types/constants.d.ts +112 -0
- package/dist/types/core/Base.d.ts +50 -0
- package/dist/types/core/Emitter.d.ts +49 -0
- package/dist/types/core/features.d.ts +41 -0
- package/dist/types/core/serialization.d.ts +44 -0
- package/dist/types/core.d.ts +18 -0
- package/dist/types/dom/domElement.d.ts +33 -0
- package/dist/types/dom/domEvent.d.ts +29 -0
- package/dist/types/env.d.ts +26 -0
- package/dist/types/event/DrawEvent.d.ts +27 -0
- package/dist/types/event/Event.d.ts +47 -0
- package/dist/types/event/Key.d.ts +82 -0
- package/dist/types/event/KeyEvent.d.ts +35 -0
- package/dist/types/event/MouseEvent.d.ts +78 -0
- package/dist/types/hosted/HostItem.d.ts +26 -0
- package/dist/types/hosted/Hosting.d.ts +273 -0
- package/dist/types/hosted/index.d.ts +10 -0
- package/dist/types/index.d.ts +64 -0
- package/dist/types/internal.d.ts +101 -0
- package/dist/types/item/Effect.d.ts +128 -0
- package/dist/types/item/EffectInstance.d.ts +81 -0
- package/dist/types/item/Group.d.ts +225 -0
- package/dist/types/item/HitResult.d.ts +94 -0
- package/dist/types/item/Item.d.ts +2927 -0
- package/dist/types/item/ItemDefinition.d.ts +25 -0
- package/dist/types/item/Layer.d.ts +80 -0
- package/dist/types/item/Project.d.ts +748 -0
- package/dist/types/item/Raster.d.ts +431 -0
- package/dist/types/item/Shape.d.ts +219 -0
- package/dist/types/item/SymbolDefinition.d.ts +98 -0
- package/dist/types/item/SymbolItem.d.ts +92 -0
- package/dist/types/item/bounds.d.ts +56 -0
- package/dist/types/item/draw.d.ts +23 -0
- package/dist/types/item/effects.d.ts +22 -0
- package/dist/types/item/expand.d.ts +7 -0
- package/dist/types/item/hitTest.d.ts +10 -0
- package/dist/types/item/hosting.d.ts +20 -0
- package/dist/types/item/props.d.ts +35 -0
- package/dist/types/item/query.d.ts +14 -0
- package/dist/types/item/sampling.d.ts +5 -0
- package/dist/types/item/transform.d.ts +3 -0
- package/dist/types/net/http.d.ts +6 -0
- package/dist/types/node/CanvasAdapter.d.ts +19 -0
- package/dist/types/node/index.d.ts +60 -0
- package/dist/types/node/peers.d.ts +2 -0
- package/dist/types/offset/curves.d.ts +22 -0
- package/dist/types/offset/index.d.ts +65 -0
- package/dist/types/offset/offset.d.ts +18 -0
- package/dist/types/offset/outline.d.ts +14 -0
- package/dist/types/offset/pen.d.ts +36 -0
- package/dist/types/offset/profile.d.ts +37 -0
- package/dist/types/offset/round.d.ts +18 -0
- package/dist/types/offset/sweep.d.ts +44 -0
- package/dist/types/paperscript/PaperScript.d.ts +114 -0
- package/dist/types/paperscript/autoload.d.ts +1 -0
- package/dist/types/paperscript/index.d.ts +7 -0
- package/dist/types/path/CompoundPath.d.ts +183 -0
- package/dist/types/path/Curve.d.ts +567 -0
- package/dist/types/path/CurveLocation.d.ts +164 -0
- package/dist/types/path/Path.d.ts +1361 -0
- package/dist/types/path/PathFlattener.d.ts +48 -0
- package/dist/types/path/PathItem.d.ts +1190 -0
- package/dist/types/path/Segment.d.ts +335 -0
- package/dist/types/path/SegmentPoint.d.ts +1 -0
- package/dist/types/path/StrokeProfile.d.ts +74 -0
- package/dist/types/path/StrokeProfileStop.d.ts +110 -0
- package/dist/types/path/boolean.d.ts +24 -0
- package/dist/types/path/bounds.d.ts +24 -0
- package/dist/types/path/crossing.d.ts +2 -0
- package/dist/types/path/draw.d.ts +6 -0
- package/dist/types/path/hitTest.d.ts +8 -0
- package/dist/types/path/offset.d.ts +14 -0
- package/dist/types/path/shapes.d.ts +20 -0
- package/dist/types/path/smooth.d.ts +18 -0
- package/dist/types/path/values.d.ts +8 -0
- package/dist/types/scope/PaperScope.d.ts +182 -0
- package/dist/types/scope/PaperScopeItem.d.ts +26 -0
- package/dist/types/smoothing/index.d.ts +26 -0
- package/dist/types/style/Color.d.ts +829 -0
- package/dist/types/style/Gradient.d.ts +130 -0
- package/dist/types/style/GradientStop.d.ts +126 -0
- package/dist/types/style/PatternDefinition.d.ts +185 -0
- package/dist/types/style/Style.d.ts +757 -0
- package/dist/types/svg/index.d.ts +14 -0
- package/dist/types/svg/svgElement.d.ts +32 -0
- package/dist/types/svg/svgExport.d.ts +19 -0
- package/dist/types/svg/svgImport.d.ts +13 -0
- package/dist/types/svg/svgStyles.d.ts +20 -0
- package/dist/types/text/AreaText.d.ts +104 -0
- package/dist/types/text/PathText.d.ts +78 -0
- package/dist/types/text/PointText.d.ts +50 -0
- package/dist/types/text/TextItem.d.ts +163 -0
- package/dist/types/text/TextRange.d.ts +98 -0
- package/dist/types/text/TextStory.d.ts +119 -0
- package/dist/types/text/areaLayout.d.ts +3 -0
- package/dist/types/text/layout.d.ts +43 -0
- package/dist/types/text/measure.d.ts +7 -0
- package/dist/types/text/pathLayout.d.ts +3 -0
- package/dist/types/tool/Tool.d.ts +356 -0
- package/dist/types/tool/ToolEvent.d.ts +134 -0
- package/dist/types/util/Formatter.d.ts +34 -0
- package/dist/types/util/collisions.d.ts +77 -0
- package/dist/types/util/list.d.ts +23 -0
- package/dist/types/util/numerical.d.ts +196 -0
- package/dist/types/util/object.d.ts +19 -0
- package/dist/types/util/string.d.ts +12 -0
- package/dist/types/util/uid.d.ts +7 -0
- package/dist/types/values/arcs.d.ts +10 -0
- package/dist/types/values/curve.d.ts +42 -0
- package/dist/types/values/fit.d.ts +26 -0
- package/dist/types/values/index.d.ts +10 -0
- package/dist/types/values/intersections.d.ts +11 -0
- package/dist/types/values/matrix.d.ts +19 -0
- package/dist/types/values/path.d.ts +26 -0
- package/dist/types/values/profile.d.ts +41 -0
- package/dist/types/values/region.d.ts +13 -0
- package/dist/types/values/smooth.d.ts +39 -0
- package/dist/types/values/svg.d.ts +47 -0
- package/dist/types/view/CanvasView.d.ts +37 -0
- package/dist/types/view/View.d.ts +700 -0
- package/dist/types/view/input.d.ts +28 -0
- package/package.json +90 -58
- package/dist/docs/assets/css/docs.css +0 -414
- package/dist/docs/assets/js/codemirror.js +0 -4
- package/dist/docs/assets/js/docs.js +0 -493
- package/dist/docs/assets/js/jquery.js +0 -6
- package/dist/docs/assets/js/paper.js +0 -23759
- package/dist/docs/classes/AreaText.html +0 -8708
- package/dist/docs/classes/ChangeFlag.html +0 -385
- package/dist/docs/classes/Color.html +0 -2205
- package/dist/docs/classes/CompoundPath.html +0 -9168
- package/dist/docs/classes/Curve.html +0 -2326
- package/dist/docs/classes/CurveLocation.html +0 -673
- package/dist/docs/classes/Event.html +0 -177
- package/dist/docs/classes/Gradient.html +0 -241
- package/dist/docs/classes/GradientStop.html +0 -274
- package/dist/docs/classes/Group.html +0 -7139
- package/dist/docs/classes/HitResult.html +0 -241
- package/dist/docs/classes/HostItem.html +0 -6836
- package/dist/docs/classes/Item.html +0 -6892
- package/dist/docs/classes/Key.html +0 -140
- package/dist/docs/classes/KeyEvent.html +0 -309
- package/dist/docs/classes/Layer.html +0 -7122
- package/dist/docs/classes/Matrix.html +0 -1745
- package/dist/docs/classes/MouseEvent.html +0 -356
- package/dist/docs/classes/PaperScope.html +0 -548
- package/dist/docs/classes/PaperScript.html +0 -202
- package/dist/docs/classes/Path.html +0 -12064
- package/dist/docs/classes/PathItem.html +0 -8930
- package/dist/docs/classes/PathText.html +0 -8578
- package/dist/docs/classes/Point.html +0 -2860
- package/dist/docs/classes/PointText.html +0 -8489
- package/dist/docs/classes/Project.html +0 -1604
- package/dist/docs/classes/Raster.html +0 -8069
- package/dist/docs/classes/Rectangle.html +0 -1698
- package/dist/docs/classes/Segment.html +0 -1017
- package/dist/docs/classes/Shape.html +0 -7570
- package/dist/docs/classes/Size.html +0 -1915
- package/dist/docs/classes/Style.html +0 -1765
- package/dist/docs/classes/SymbolDefinition.html +0 -312
- package/dist/docs/classes/SymbolItem.html +0 -6999
- package/dist/docs/classes/TextItem.html +0 -8332
- package/dist/docs/classes/TextRange.html +0 -186
- package/dist/docs/classes/TextStory.html +0 -355
- package/dist/docs/classes/Tool.html +0 -888
- package/dist/docs/classes/ToolEvent.html +0 -525
- package/dist/docs/classes/Tween.html +0 -390
- package/dist/docs/classes/View.html +0 -2108
- package/dist/docs/classes/global.html +0 -426
- package/dist/docs/classes/index.html +0 -88
- package/dist/docs/index.html +0 -11
- package/dist/node/canvas.js +0 -68
- package/dist/node/extend.js +0 -156
- package/dist/node/self.js +0 -67
- package/dist/paper-core.d.ts +0 -1
- package/dist/paper-core.js +0 -21834
- package/dist/paper-core.min.js +0 -32
- package/dist/paper.d.ts +0 -9630
- package/examples/Animated/AnimatedStar.html +0 -53
- package/examples/Animated/BooleanOperations.html +0 -115
- package/examples/Animated/CandyCrash.html +0 -151
- package/examples/Animated/Extruded.html +0 -50
- package/examples/Animated/Lines.html +0 -53
- package/examples/Animated/Smoothing.html +0 -70
- package/examples/Animated/Space.html +0 -86
- package/examples/Animated/SpaceUsingShapes.html +0 -79
- package/examples/Games/Paperoids.html +0 -569
- package/examples/JSON/Circle Testing.html +0 -34
- package/examples/JSON/Compound Path.html +0 -25
- package/examples/JSON/Empty Path Testing.html +0 -31
- package/examples/JSON/Gradients.html +0 -34
- package/examples/JSON/Group Transform.html +0 -28
- package/examples/JSON/Line Testing.html +0 -44
- package/examples/JSON/Random Path Testing.html +0 -42
- package/examples/JSON/Raster.html +0 -29
- package/examples/JSON/Rect and Attribute Testing.html +0 -56
- package/examples/JSON/Rotated Primitives.html +0 -55
- package/examples/JSON/Selection.html +0 -43
- package/examples/JSON/Shapes.html +0 -54
- package/examples/JSON/Symbols.html +0 -30
- package/examples/JSON/Text Testing.html +0 -38
- package/examples/JSON/Tiger.html +0 -19
- package/examples/JSON/Transform Test 1.html +0 -32
- package/examples/JSON/Transform Test 2.html +0 -30
- package/examples/Node.js/AnimatedStar.js +0 -52
- package/examples/Node.js/BooleanOperations.js +0 -36
- package/examples/Node.js/JSONtoPDF.js +0 -20
- package/examples/Node.js/Raster.js +0 -32
- package/examples/Node.js/RasterRemote.js +0 -33
- package/examples/Node.js/SvgExport.js +0 -52
- package/examples/Node.js/SvgImport.js +0 -23
- package/examples/Node.js/Tadpoles.js +0 -16
- package/examples/Node.js/Tadpoles.pjs +0 -278
- package/examples/Node.js/in.json +0 -1
- package/examples/Node.js/in.svg +0 -16
- package/examples/Paperjs.org/BooleanOperattions.html +0 -115
- package/examples/Paperjs.org/BouncingBalls.html +0 -103
- package/examples/Paperjs.org/Chain.html +0 -54
- package/examples/Paperjs.org/DivisionRaster.html +0 -72
- package/examples/Paperjs.org/FutureSplash.html +0 -122
- package/examples/Paperjs.org/HitTesting.html +0 -103
- package/examples/Paperjs.org/InteractiveTiger.html +0 -777
- package/examples/Paperjs.org/MetaBalls.html +0 -132
- package/examples/Paperjs.org/NyanRainbow.html +0 -202
- package/examples/Paperjs.org/PathIntersections.html +0 -76
- package/examples/Paperjs.org/Qbertify.html +0 -146
- package/examples/Paperjs.org/RadialRainbows.html +0 -80
- package/examples/Paperjs.org/RoundedRectangles.html +0 -41
- package/examples/Paperjs.org/SatieLikedToDraw.html +0 -140
- package/examples/Paperjs.org/Simplify.html +0 -63
- package/examples/Paperjs.org/SpiralRaster.html +0 -120
- package/examples/Paperjs.org/Tadpoles.html +0 -283
- package/examples/Paperjs.org/Voronoi.html +0 -134
- package/examples/Rasters/PhyllotaxisRaster.html +0 -96
- package/examples/Rasters/Raster.html +0 -34
- package/examples/Rasters/RotationRaster.html +0 -44
- package/examples/Rasters/Smoothing.html +0 -36
- package/examples/SVG Export/Circle Testing.html +0 -32
- package/examples/SVG Export/Clipping.html +0 -17
- package/examples/SVG Export/Compound Path.html +0 -22
- package/examples/SVG Export/Empty Path Testing.html +0 -28
- package/examples/SVG Export/Gradients.html +0 -52
- package/examples/SVG Export/Group Transform.html +0 -25
- package/examples/SVG Export/Line Testing.html +0 -41
- package/examples/SVG Export/Random Path Testing.html +0 -39
- package/examples/SVG Export/Raster.html +0 -21
- package/examples/SVG Export/Rect and Attribute Testing.html +0 -53
- package/examples/SVG Export/Rotated Primitives.html +0 -80
- package/examples/SVG Export/Shapes.html +0 -58
- package/examples/SVG Export/Symbols.html +0 -27
- package/examples/SVG Export/Text Testing.html +0 -45
- package/examples/SVG Export/Tiger.html +0 -23
- package/examples/SVG Export/Transform Test 1.html +0 -29
- package/examples/SVG Export/Transform Test 2.html +0 -27
- package/examples/SVG Import/Arcs.html +0 -78
- package/examples/SVG Import/Butterfly.html +0 -223
- package/examples/SVG Import/Circle and Ellipse Testing.html +0 -26
- package/examples/SVG Import/Clipping.html +0 -100
- package/examples/SVG Import/From File.html +0 -30
- package/examples/SVG Import/Gradient.html +0 -138
- package/examples/SVG Import/Gradients.html +0 -30
- package/examples/SVG Import/Inkscape Pivot.html +0 -52
- package/examples/SVG Import/Inkscape.html +0 -88
- package/examples/SVG Import/Line Testing.html +0 -24
- package/examples/SVG Import/MoreGradients.html +0 -107
- package/examples/SVG Import/Multiple Paths Test 1.html +0 -42
- package/examples/SVG Import/Multiple Paths Test 2.html +0 -33
- package/examples/SVG Import/Nested Groups Test.html +0 -78
- package/examples/SVG Import/Polybezier.html +0 -43
- package/examples/SVG Import/Rect Testing.html +0 -25
- package/examples/SVG Import/Symbols.html +0 -24
- package/examples/SVG Import/Testing.html +0 -40
- package/examples/SVG Import/Text Testing.html +0 -19
- package/examples/SVG Import/Tiger.html +0 -742
- package/examples/SVG Import/Transform Testing.html +0 -22
- package/examples/SVG Import/Viewbox.html +0 -38
- package/examples/Scripts/Arcs.html +0 -39
- package/examples/Scripts/AreaText.html +0 -65
- package/examples/Scripts/BlendModes.html +0 -77
- package/examples/Scripts/BooleanOperations.html +0 -937
- package/examples/Scripts/CompoundPath.html +0 -19
- package/examples/Scripts/CurveTimeParameterization.html +0 -61
- package/examples/Scripts/HslColor.html +0 -53
- package/examples/Scripts/PathStructure.html +0 -82
- package/examples/Scripts/PathTangents.html +0 -73
- package/examples/Scripts/PathText.html +0 -48
- package/examples/Scripts/Resize.html +0 -42
- package/examples/Scripts/RoundRectangle.html +0 -28
- package/examples/Scripts/Shapes.html +0 -54
- package/examples/Scripts/StrokeBounds.html +0 -101
- package/examples/Scripts/StrokeScaling.html +0 -65
- package/examples/Scripts/TextRanges.html +0 -51
- package/examples/Tools/BezierTool.html +0 -90
- package/examples/Tools/Circles.html +0 -28
- package/examples/Tools/Clouds.html +0 -35
- package/examples/Tools/DrippingBrush.html +0 -73
- package/examples/Tools/FancyBrush.html +0 -82
- package/examples/Tools/Grid.html +0 -44
- package/examples/Tools/MultiLines.html +0 -44
- package/examples/Tools/MultipleTools.html +0 -44
- package/examples/Tools/PathEditing.html +0 -95
- package/examples/Tools/SquareRounded.html +0 -76
- package/examples/Tools/Stars.html +0 -38
- package/examples/Tools/Vektor.html +0 -200
- package/examples/Tools/Wave.html +0 -50
- package/examples/Tools/WormFarm.html +0 -88
- package/examples/Worker/Main.html +0 -53
- package/examples/Worker/Worker.js +0 -14
- package/examples/css/style.css +0 -12
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
type Canvas = HTMLCanvasElement | OffscreenCanvas;
|
|
2
|
+
type Size = {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
};
|
|
6
|
+
type Options = CanvasRenderingContext2DSettings & {
|
|
7
|
+
minimum?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const canvases: Canvas[];
|
|
10
|
+
/**
|
|
11
|
+
* Returns a canvas of the given size, reusing one that was released if there
|
|
12
|
+
* is one, or null in workers without OffscreenCanvas.
|
|
13
|
+
*
|
|
14
|
+
* @private
|
|
15
|
+
* @option [options.minimum=false] {Boolean} reuse a released canvas that is at
|
|
16
|
+
* least as large, without resizing it, since resizing reallocates its
|
|
17
|
+
* pixels
|
|
18
|
+
*/
|
|
19
|
+
export declare function getCanvas({ width, height }: Size, options?: Options): Canvas | null;
|
|
20
|
+
/**
|
|
21
|
+
* Returns the 2D context of a canvas of the given size, see getCanvas().
|
|
22
|
+
*
|
|
23
|
+
* @private
|
|
24
|
+
*/
|
|
25
|
+
export declare function getContext(size: Size, options?: Options): CanvasRenderingContext2D | null;
|
|
26
|
+
/**
|
|
27
|
+
* Releases a canvas, or the canvas of a context, for getCanvas() to reuse.
|
|
28
|
+
*
|
|
29
|
+
* @private
|
|
30
|
+
*/
|
|
31
|
+
export declare function releaseCanvas(canvasOrContext: any): void;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The flags that describe what has changed in an item, as reported by
|
|
3
|
+
* {@link Project#takeChanges()}. They are bit flags that can be combined.
|
|
4
|
+
*/
|
|
5
|
+
export declare const ChangeFlag: {
|
|
6
|
+
/**
|
|
7
|
+
* Anything affecting the appearance of an item, including GEOMETRY,
|
|
8
|
+
* STROKE, STYLE and ATTRIBUTE (except for the invisible ones: locked, name)
|
|
9
|
+
*
|
|
10
|
+
* @property
|
|
11
|
+
*/
|
|
12
|
+
APPEARANCE: number;
|
|
13
|
+
/**
|
|
14
|
+
* A change in the item's children
|
|
15
|
+
*
|
|
16
|
+
* @property
|
|
17
|
+
*/
|
|
18
|
+
CHILDREN: number;
|
|
19
|
+
/**
|
|
20
|
+
* A change of the item's place in the scene graph (removed, inserted,
|
|
21
|
+
* moved)
|
|
22
|
+
*
|
|
23
|
+
* @property
|
|
24
|
+
*/
|
|
25
|
+
INSERTION: number;
|
|
26
|
+
/**
|
|
27
|
+
* Item geometry (path, bounds)
|
|
28
|
+
*
|
|
29
|
+
* @property
|
|
30
|
+
*/
|
|
31
|
+
GEOMETRY: number;
|
|
32
|
+
/**
|
|
33
|
+
* The item's matrix has changed
|
|
34
|
+
*
|
|
35
|
+
* @property
|
|
36
|
+
*/
|
|
37
|
+
MATRIX: number;
|
|
38
|
+
/**
|
|
39
|
+
* Only segment(s) have changed, and affected curves have already been
|
|
40
|
+
* notified. This is to implement an optimization in _changed() calls
|
|
41
|
+
*
|
|
42
|
+
* @property
|
|
43
|
+
*/
|
|
44
|
+
SEGMENTS: number;
|
|
45
|
+
/**
|
|
46
|
+
* Stroke geometry (excluding color)
|
|
47
|
+
*
|
|
48
|
+
* @property
|
|
49
|
+
*/
|
|
50
|
+
STROKE: number;
|
|
51
|
+
/**
|
|
52
|
+
* Fill style or stroke color / dash
|
|
53
|
+
*
|
|
54
|
+
* @property
|
|
55
|
+
*/
|
|
56
|
+
STYLE: number;
|
|
57
|
+
/**
|
|
58
|
+
* Item attributes: visible, blendMode, locked, name, opacity, clipMask ...
|
|
59
|
+
*
|
|
60
|
+
* @property
|
|
61
|
+
*/
|
|
62
|
+
ATTRIBUTE: number;
|
|
63
|
+
/**
|
|
64
|
+
* Text content
|
|
65
|
+
*
|
|
66
|
+
* @property
|
|
67
|
+
*/
|
|
68
|
+
CONTENT: number;
|
|
69
|
+
/**
|
|
70
|
+
* Raster pixels
|
|
71
|
+
*
|
|
72
|
+
* @property
|
|
73
|
+
*/
|
|
74
|
+
PIXELS: number;
|
|
75
|
+
/**
|
|
76
|
+
* Clipping in one of the child items
|
|
77
|
+
*
|
|
78
|
+
* @property
|
|
79
|
+
*/
|
|
80
|
+
CLIPPING: number;
|
|
81
|
+
/**
|
|
82
|
+
* The view has been transformed
|
|
83
|
+
*
|
|
84
|
+
* @property
|
|
85
|
+
*/
|
|
86
|
+
VIEW: number;
|
|
87
|
+
};
|
|
88
|
+
export declare const Change: {
|
|
89
|
+
CHILDREN: number;
|
|
90
|
+
INSERTION: number;
|
|
91
|
+
GEOMETRY: number;
|
|
92
|
+
MATRIX: number;
|
|
93
|
+
SEGMENTS: number;
|
|
94
|
+
STROKE: number;
|
|
95
|
+
STYLE: number;
|
|
96
|
+
ATTRIBUTE: number;
|
|
97
|
+
CONTENT: number;
|
|
98
|
+
PIXELS: number;
|
|
99
|
+
VIEW: number;
|
|
100
|
+
};
|
|
101
|
+
export declare const ItemSelection: {
|
|
102
|
+
ITEM: number;
|
|
103
|
+
BOUNDS: number;
|
|
104
|
+
POSITION: number;
|
|
105
|
+
STROKE_BOUNDS: number;
|
|
106
|
+
};
|
|
107
|
+
export declare const SegmentSelection: {
|
|
108
|
+
POINT: number;
|
|
109
|
+
HANDLE_IN: number;
|
|
110
|
+
HANDLE_OUT: number;
|
|
111
|
+
ALL: number;
|
|
112
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @private
|
|
3
|
+
*/
|
|
4
|
+
export declare class Base {
|
|
5
|
+
readonly className: string;
|
|
6
|
+
/**
|
|
7
|
+
* Exports (serializes) this object to a JSON data object or string.
|
|
8
|
+
*
|
|
9
|
+
* @option [options.asString=true] {Boolean} whether the JSON is returned as
|
|
10
|
+
* a `Object` or a `String`
|
|
11
|
+
* @option [options.precision=5] {Number} the amount of fractional digits in
|
|
12
|
+
* numbers used in JSON data
|
|
13
|
+
*
|
|
14
|
+
* @param options the serialization options
|
|
15
|
+
* @return the exported JSON data
|
|
16
|
+
*/
|
|
17
|
+
exportJSON(options?: {
|
|
18
|
+
asString?: boolean;
|
|
19
|
+
precision?: number;
|
|
20
|
+
}): string | unknown[];
|
|
21
|
+
toJSON(): any;
|
|
22
|
+
/**
|
|
23
|
+
* Exports (serializes) a value to a JSON data object or string, also one
|
|
24
|
+
* that holds Paper.js objects without being one, such as a plain object or
|
|
25
|
+
* an array, see {@link #exportJSON(options)}.
|
|
26
|
+
*
|
|
27
|
+
* @option [options.asString=true] {Boolean} whether the JSON is returned as
|
|
28
|
+
* a `Object` or a `String`
|
|
29
|
+
* @option [options.precision=5] {Number} the amount of fractional digits in
|
|
30
|
+
* numbers used in JSON data
|
|
31
|
+
*
|
|
32
|
+
* @param value the value to export
|
|
33
|
+
* @param options the serialization options
|
|
34
|
+
* @return the exported JSON data
|
|
35
|
+
*/
|
|
36
|
+
static exportJSON(value: unknown, options?: {
|
|
37
|
+
asString?: boolean;
|
|
38
|
+
precision?: number;
|
|
39
|
+
}): string | unknown[];
|
|
40
|
+
/**
|
|
41
|
+
* Imports (deserializes) the JSON data of a value that
|
|
42
|
+
* {@link Base.exportJSON(value, options)} or {@link #exportJSON(options)}
|
|
43
|
+
* exported. Items are created without being inserted, except for layers,
|
|
44
|
+
* which go into the active project.
|
|
45
|
+
*
|
|
46
|
+
* @param json the JSON data to import
|
|
47
|
+
* @return the imported value
|
|
48
|
+
*/
|
|
49
|
+
static importJSON: (json: string | unknown[]) => unknown;
|
|
50
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Base } from './Base.ts';
|
|
2
|
+
type Handler = (this: any, ...args: any[]) => any;
|
|
3
|
+
export type EventType<T> = {
|
|
4
|
+
[K in keyof T]: K extends `on${infer N}` ? Lowercase<N> : never;
|
|
5
|
+
}[keyof T];
|
|
6
|
+
export type EventHandler<T, E> = {
|
|
7
|
+
[K in keyof T]: K extends `on${infer N}` ? Lowercase<N> extends E ? NonNullable<T[K]> : never : never;
|
|
8
|
+
}[keyof T];
|
|
9
|
+
export type EventHandlers<T, H> = {
|
|
10
|
+
[K in EventType<T>]?: EventHandler<T, K>;
|
|
11
|
+
} & Record<string, H>;
|
|
12
|
+
export interface EventDeclaration {
|
|
13
|
+
install?(this: any, type: string): void;
|
|
14
|
+
uninstall?(this: any, type: string): void;
|
|
15
|
+
classLevel?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The base class of all objects that emit events: items, views, tools and
|
|
19
|
+
* tweens.
|
|
20
|
+
*
|
|
21
|
+
* @private
|
|
22
|
+
*/
|
|
23
|
+
export declare class Emitter extends Base {
|
|
24
|
+
static events: Record<string, EventDeclaration>;
|
|
25
|
+
_callbacks: Record<string, Handler[]>;
|
|
26
|
+
_handlers: Record<string, Handler>;
|
|
27
|
+
on(type: string | Record<string, Handler>, func?: Handler): this;
|
|
28
|
+
off(type: string | Record<string, Handler>, func?: Handler): this;
|
|
29
|
+
once(type: string, func: Handler): this;
|
|
30
|
+
emit(type: string, event?: unknown, ...args: unknown[]): boolean;
|
|
31
|
+
responds(type: string): boolean;
|
|
32
|
+
_getHandlers(type: string): Handler[];
|
|
33
|
+
_installEvents(install: boolean): void;
|
|
34
|
+
static on(type: string | Record<string, Handler>, func?: Handler): typeof Emitter;
|
|
35
|
+
static off(type: string | Record<string, Handler>, func?: Handler): typeof Emitter;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Declares the events of an emitter class by their handler names, e.g.
|
|
39
|
+
* `onMouseDown`, and adds the class's `events` table keyed by type
|
|
40
|
+
* (`mousedown`), and the accessors for the handler properties, on the class
|
|
41
|
+
* too for the `classLevel` events.
|
|
42
|
+
*
|
|
43
|
+
* @private
|
|
44
|
+
*/
|
|
45
|
+
export declare function defineEvents(ctor: {
|
|
46
|
+
prototype: Emitter;
|
|
47
|
+
events?: Record<string, EventDeclaration>;
|
|
48
|
+
}, declarations: Record<string, EventDeclaration>): void;
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { boolean } from '../boolean/index.ts';
|
|
2
|
+
import type { offset } from '../offset/index.ts';
|
|
3
|
+
import type { svg } from '../svg/index.ts';
|
|
4
|
+
import type { effects } from '../item/effects.ts';
|
|
5
|
+
import type { raster } from '../item/Raster.ts';
|
|
6
|
+
import type { tween } from '../anim/Tween.ts';
|
|
7
|
+
import type { hosted } from '../hosted/Hosting.ts';
|
|
8
|
+
type Features = {
|
|
9
|
+
boolean: typeof boolean.feature;
|
|
10
|
+
offset: typeof offset.feature;
|
|
11
|
+
svg: typeof svg.feature;
|
|
12
|
+
effects: typeof effects.feature;
|
|
13
|
+
tween: typeof tween.feature;
|
|
14
|
+
raster: typeof raster.feature;
|
|
15
|
+
hosted: typeof hosted.feature;
|
|
16
|
+
};
|
|
17
|
+
type Feature = Features[keyof Features];
|
|
18
|
+
/**
|
|
19
|
+
* Adds the features to the library that `paper/core` leaves out, e.g.
|
|
20
|
+
* `use(boolean)` with `boolean` from `paper/boolean` for the boolean
|
|
21
|
+
* operations of path items. The `paper` entry adds all of them.
|
|
22
|
+
*
|
|
23
|
+
* @param list the features to add
|
|
24
|
+
*/
|
|
25
|
+
export declare function use(...list: {
|
|
26
|
+
feature: Feature;
|
|
27
|
+
}[]): void;
|
|
28
|
+
/**
|
|
29
|
+
* Returns the feature, or throws if it wasn't added through use().
|
|
30
|
+
*
|
|
31
|
+
* @private
|
|
32
|
+
*/
|
|
33
|
+
export declare function getFeature<K extends keyof Features>(name: K): Features[K];
|
|
34
|
+
/**
|
|
35
|
+
* Returns the feature if it was added through use(), for what works without
|
|
36
|
+
* it too.
|
|
37
|
+
*
|
|
38
|
+
* @private
|
|
39
|
+
*/
|
|
40
|
+
export declare function findFeature<K extends keyof Features>(name: K): Features[K] | undefined;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Formatter } from '../util/Formatter.ts';
|
|
2
|
+
export type JSONOptions = {
|
|
3
|
+
asString?: boolean;
|
|
4
|
+
precision?: number;
|
|
5
|
+
formatter: Formatter;
|
|
6
|
+
};
|
|
7
|
+
export type JSONDictionary = {
|
|
8
|
+
length: number;
|
|
9
|
+
definitions: Record<string, unknown[]>;
|
|
10
|
+
references: Record<string, [string]>;
|
|
11
|
+
add(item: {
|
|
12
|
+
_id: number;
|
|
13
|
+
className: string;
|
|
14
|
+
}, create: () => unknown[]): [string];
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Registers classes with the library under their keys: Each key becomes the
|
|
18
|
+
* `className` of its class, which its objects report, queries match and JSON
|
|
19
|
+
* stores, and which `importJSON()` creates the class from again. Keys survive
|
|
20
|
+
* minification, while class names don't.
|
|
21
|
+
*
|
|
22
|
+
* @param classesByName the classes to register, by name
|
|
23
|
+
*/
|
|
24
|
+
export declare function registerClasses(classesByName: Record<string, abstract new (...args: any[]) => any>): void;
|
|
25
|
+
export declare function getClass(name: string): new (...args: any[]) => any;
|
|
26
|
+
/**
|
|
27
|
+
* Serializes the passed object into a format that can be passed to
|
|
28
|
+
* `JSON.stringify()` for JSON serialization.
|
|
29
|
+
*/
|
|
30
|
+
export declare function serialize(obj: any, options?: Partial<JSONOptions> | null, compact?: boolean, dictionary?: JSONDictionary): any;
|
|
31
|
+
/**
|
|
32
|
+
* Deserializes from parsed JSON data. A simple convention is followed: Array
|
|
33
|
+
* values with a string at the first position are links to deserializable
|
|
34
|
+
* types through the registered classes, and the values following in the array
|
|
35
|
+
* are the arguments to their constructor. Any other value is passed on
|
|
36
|
+
* unmodified. The passed json data is recursively traversed and converted,
|
|
37
|
+
* leaves first. References of the form `['@key']` are passed to the optional
|
|
38
|
+
* `resolve(key)`, for definitions that the importer provides.
|
|
39
|
+
*/
|
|
40
|
+
export declare function deserialize(json: any, create?: (ctor: any, args: any[], isRoot: boolean) => any, resolve?: ((key: string) => any) | null, _data?: any, _setDictionary?: boolean, _isRoot?: boolean): any;
|
|
41
|
+
export declare function exportJSON(obj: any, options?: {
|
|
42
|
+
asString?: boolean;
|
|
43
|
+
precision?: number;
|
|
44
|
+
}): any;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { Point, Size, Rectangle, Matrix, Line, Project, Item, Group, Layer, Shape, Raster, SymbolItem, SymbolDefinition, HitResult, Effect, EffectInstance, Segment, Curve, CurveLocation, PathItem, Path, CompoundPath, StrokeProfileStop, PathFlattener, TextItem, PointText, PathText, AreaText, TextStory, TextRange, Color, Gradient, GradientStop, PatternDefinition, Style, View, CanvasView, Event, DrawEvent, KeyEvent, MouseEvent, Tool, ToolEvent, Tween, Base, ChangeFlag, Key, Numerical, PaperScope, registerClasses, use, effects, raster, tween } from './internal.ts';
|
|
2
|
+
export type { BlendMode } from './canvas/blendModes.ts';
|
|
3
|
+
export type { SelectablePoint } from './basic/Point.ts';
|
|
4
|
+
export type { SelectableRectangle } from './basic/Rectangle.ts';
|
|
5
|
+
export type { ColorSpace, ColorType } from './style/Color.ts';
|
|
6
|
+
export type { BaselinePosition, Direction, FontStyle, Hyphenation, Justification, LetterCase, LineWrap, PaintOrder, JustificationRange, TabStop } from './style/Style.ts';
|
|
7
|
+
export type { FillRule } from './values/region.ts';
|
|
8
|
+
export type { StrokeCap, StrokeJoin } from './values/path.ts';
|
|
9
|
+
export type { RasterSmoothing } from './item/Raster.ts';
|
|
10
|
+
export type { ShapeType } from './item/Shape.ts';
|
|
11
|
+
export type { HitTestOptions, HitType } from './item/HitResult.ts';
|
|
12
|
+
export type { FrameEvent } from './view/View.ts';
|
|
13
|
+
export type { ItemProps, Props } from './item/props.ts';
|
|
14
|
+
export type { SVGExportOptions } from './svg/svgExport.ts';
|
|
15
|
+
export type { SVGImportOptions } from './svg/svgImport.ts';
|
|
16
|
+
export type { TextOrientation } from './text/TextItem.ts';
|
|
17
|
+
export type { PathTextAlignment } from './text/PathText.ts';
|
|
18
|
+
export type { VerticalAlign } from './text/AreaText.ts';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Size } from '../internal.ts';
|
|
2
|
+
import type { Point } from '../basic/Point.ts';
|
|
3
|
+
export declare function getStyles(element: Element | Document): CSSStyleDeclaration | undefined;
|
|
4
|
+
export declare function getOffset(element: Element, viewport?: boolean): Point;
|
|
5
|
+
export declare function getSize(element: Element): Size;
|
|
6
|
+
/**
|
|
7
|
+
* Returns the horizontal and vertical sums of the element's padding
|
|
8
|
+
* and border widths, or with `start`, only the left and top ones.
|
|
9
|
+
*
|
|
10
|
+
* @private
|
|
11
|
+
*/
|
|
12
|
+
export declare function getInsets(element: Element, start?: boolean): Size;
|
|
13
|
+
/**
|
|
14
|
+
* Checks if element is visible in current viewport.
|
|
15
|
+
*
|
|
16
|
+
* @private
|
|
17
|
+
*/
|
|
18
|
+
export declare function isInView(element: Element): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Checks if element is inside the DOM.
|
|
21
|
+
*
|
|
22
|
+
* @private
|
|
23
|
+
*/
|
|
24
|
+
export declare function isInserted(element: Element): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Sets the given properties on the element, or its style, also under their
|
|
27
|
+
* WebKit prefix where the browser only knows that one.
|
|
28
|
+
*
|
|
29
|
+
* @private
|
|
30
|
+
*/
|
|
31
|
+
export declare function setPrefixed(element: object, name: string | Record<string, unknown>, value?: unknown): void;
|
|
32
|
+
export declare function getPaperAttribute(element: Element, name: string): string | null;
|
|
33
|
+
export declare function hasPaperAttribute(element: Element, name: string): boolean;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Point } from '../internal.ts';
|
|
2
|
+
type Listener = (event: any) => void;
|
|
3
|
+
/**
|
|
4
|
+
* Adds the listeners to the element, keyed by their event types, several of
|
|
5
|
+
* them separated by spaces or commas.
|
|
6
|
+
*
|
|
7
|
+
* @private
|
|
8
|
+
*/
|
|
9
|
+
export declare function addEvents(element: EventTarget, events: Record<string, Listener>): void;
|
|
10
|
+
/**
|
|
11
|
+
* Removes the listeners that {@link addEvents()} added.
|
|
12
|
+
*
|
|
13
|
+
* @private
|
|
14
|
+
*/
|
|
15
|
+
export declare function removeEvents(element: EventTarget, events: Record<string, Listener>): void;
|
|
16
|
+
/**
|
|
17
|
+
* Returns the position of the event in the coordinates of its target element.
|
|
18
|
+
*
|
|
19
|
+
* @private
|
|
20
|
+
*/
|
|
21
|
+
export declare function getEventOffset(event: MouseEvent, target?: Element | null): Point;
|
|
22
|
+
/**
|
|
23
|
+
* Calls the callback in the next animation frame, or where there are none,
|
|
24
|
+
* through an interval timer.
|
|
25
|
+
*
|
|
26
|
+
* @private
|
|
27
|
+
*/
|
|
28
|
+
export declare function requestFrame(callback: () => void): void;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sets the window, and with it the document, that Paper.js works with, and
|
|
3
|
+
* whether it shows what Paper.js draws.
|
|
4
|
+
*
|
|
5
|
+
* @private
|
|
6
|
+
*/
|
|
7
|
+
export declare function setEnvironment(environment: Window & typeof globalThis, hasDisplay?: boolean): void;
|
|
8
|
+
/**
|
|
9
|
+
* Returns the window that Paper.js draws in, or null in workers.
|
|
10
|
+
*
|
|
11
|
+
* @private
|
|
12
|
+
*/
|
|
13
|
+
export declare function getWindow(): (Window & typeof globalThis) | null;
|
|
14
|
+
/**
|
|
15
|
+
* Returns the document that Paper.js creates elements in, if there is one.
|
|
16
|
+
*
|
|
17
|
+
* @private
|
|
18
|
+
*/
|
|
19
|
+
export declare function getDocument(): Document | null;
|
|
20
|
+
/**
|
|
21
|
+
* Returns whether the window shows what Paper.js draws, so that views update
|
|
22
|
+
* by themselves and run animations. The window of `paper/node` doesn't.
|
|
23
|
+
*
|
|
24
|
+
* @private
|
|
25
|
+
*/
|
|
26
|
+
export declare function hasDisplay(): boolean;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Base } from '../internal.ts';
|
|
2
|
+
import type { Item } from '../item/Item.ts';
|
|
3
|
+
import type { Matrix } from '../basic/Matrix.ts';
|
|
4
|
+
import type { Color } from '../style/Color.ts';
|
|
5
|
+
import type { View } from '../view/View.ts';
|
|
6
|
+
/**
|
|
7
|
+
* The DrawEvent object is received by the {@link Item}'s drawing
|
|
8
|
+
* handlers {@link Item#onDraw} and {@link Item#onDrawSelection}, which
|
|
9
|
+
* describe its fields.
|
|
10
|
+
*/
|
|
11
|
+
export declare class DrawEvent extends Base {
|
|
12
|
+
item: Item;
|
|
13
|
+
context: CanvasRenderingContext2D;
|
|
14
|
+
matrix: Matrix;
|
|
15
|
+
view: View | null;
|
|
16
|
+
pixelRatio: number;
|
|
17
|
+
size: number;
|
|
18
|
+
color: Color;
|
|
19
|
+
prevented: boolean;
|
|
20
|
+
constructor(props: Partial<DrawEvent>);
|
|
21
|
+
/**
|
|
22
|
+
* Skips the item's default drawing, as returning `false` from the handler
|
|
23
|
+
* does.
|
|
24
|
+
*/
|
|
25
|
+
preventDefault(): void;
|
|
26
|
+
stop(): void;
|
|
27
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { KeyModifiers } from '../internal.ts';
|
|
2
|
+
/**
|
|
3
|
+
* The Event object is the base class for any of the other event types,
|
|
4
|
+
* such as {@link MouseEvent}, {@link ToolEvent} and {@link KeyEvent}.
|
|
5
|
+
*/
|
|
6
|
+
export declare class Event {
|
|
7
|
+
#private;
|
|
8
|
+
event: globalThis.Event;
|
|
9
|
+
type: string;
|
|
10
|
+
prevented: boolean;
|
|
11
|
+
stopped: boolean;
|
|
12
|
+
constructor(event: globalThis.Event);
|
|
13
|
+
/**
|
|
14
|
+
* Cancels the event if it is cancelable, without stopping further
|
|
15
|
+
* propagation of the event.
|
|
16
|
+
*/
|
|
17
|
+
preventDefault(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Prevents further propagation of the current event.
|
|
20
|
+
*/
|
|
21
|
+
stopPropagation(): void;
|
|
22
|
+
/**
|
|
23
|
+
* Cancels the event if it is cancelable, and stops further propagation of
|
|
24
|
+
* the event. This has the same effect as calling both
|
|
25
|
+
* {@link #stopPropagation()} and {@link #preventDefault()}.
|
|
26
|
+
*
|
|
27
|
+
* Any handler can also return `false` to indicate that `stop()` should be
|
|
28
|
+
* called right after.
|
|
29
|
+
*/
|
|
30
|
+
stop(): void;
|
|
31
|
+
/**
|
|
32
|
+
* The time at which the event was created, in seconds, as the times of
|
|
33
|
+
* frame events are. Browsers count from the page's time origin, as
|
|
34
|
+
* `performance.now()` does, while
|
|
35
|
+
* {@link View#dispatchMouseEvent(type, point[, options])} and
|
|
36
|
+
* {@link View#dispatchKeyEvent(type, key[, options])} use `Date.now()`
|
|
37
|
+
* unless the host passes a time, so only compare the times of events from
|
|
38
|
+
* the same source.
|
|
39
|
+
*/
|
|
40
|
+
get time(): number;
|
|
41
|
+
/**
|
|
42
|
+
* The state of the keyboard modifiers when the event happened.
|
|
43
|
+
*
|
|
44
|
+
* @see Key.modifiers
|
|
45
|
+
*/
|
|
46
|
+
get modifiers(): KeyModifiers;
|
|
47
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { View } from '../internal.ts';
|
|
2
|
+
/**
|
|
3
|
+
* The state of the keyboard modifiers, see {@link Key.modifiers} and
|
|
4
|
+
* {@link Event#modifiers}.
|
|
5
|
+
*
|
|
6
|
+
* @private
|
|
7
|
+
*/
|
|
8
|
+
export declare class KeyModifiers {
|
|
9
|
+
shift: boolean;
|
|
10
|
+
control: boolean;
|
|
11
|
+
alt: boolean;
|
|
12
|
+
meta: boolean;
|
|
13
|
+
capsLock: boolean;
|
|
14
|
+
space: boolean;
|
|
15
|
+
constructor(modifiers?: KeyModifiers);
|
|
16
|
+
get option(): boolean;
|
|
17
|
+
get command(): boolean;
|
|
18
|
+
toString(): string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The Key object gives access to the state of the keyboard: the modifier keys
|
|
22
|
+
* that are held, and whether a key is pressed.
|
|
23
|
+
*/
|
|
24
|
+
export declare const Key: {
|
|
25
|
+
/**
|
|
26
|
+
* The current state of the keyboard modifiers.
|
|
27
|
+
*
|
|
28
|
+
* @option modifiers.shift {Boolean} {@true if the shift key is
|
|
29
|
+
* pressed}.
|
|
30
|
+
* @option modifiers.control {Boolean} {@true if the control key is
|
|
31
|
+
* pressed}.
|
|
32
|
+
* @option modifiers.alt {Boolean} {@true if the alt/option key is
|
|
33
|
+
* pressed}.
|
|
34
|
+
* @option modifiers.meta {Boolean} {@true if the meta/windows/command
|
|
35
|
+
* key is pressed}.
|
|
36
|
+
* @option modifiers.capsLock {Boolean} {@true if the caps-lock key is
|
|
37
|
+
* active}.
|
|
38
|
+
* @option modifiers.space {Boolean} {@true if the space key is
|
|
39
|
+
* pressed}.
|
|
40
|
+
* @option modifiers.option {Boolean} {@true if the alt/option key is
|
|
41
|
+
* pressed}. This is the same as `modifiers.alt`
|
|
42
|
+
* @option modifiers.command {Boolean} {@true if the meta key is pressed
|
|
43
|
+
* on Mac, or the control key is pressed on Windows and Linux}.
|
|
44
|
+
*/
|
|
45
|
+
modifiers: KeyModifiers;
|
|
46
|
+
/**
|
|
47
|
+
* Checks whether the specified key is pressed.
|
|
48
|
+
*
|
|
49
|
+
* @param key any character or special key descriptor:
|
|
50
|
+
* {@values 'enter', 'space', 'shift', 'control', 'alt', 'meta',
|
|
51
|
+
* 'caps-lock', 'left', 'up', 'right', 'down', 'escape', 'delete',
|
|
52
|
+
* ...}
|
|
53
|
+
* @return {@true if the key is pressed}
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* // Whenever the user clicks, create a circle shaped path. If the
|
|
57
|
+
* // 'a' key is pressed, fill it with red, otherwise fill it with blue:
|
|
58
|
+
* function onMouseDown(event) {
|
|
59
|
+
* var path = Path.circle(event.point, 10);
|
|
60
|
+
* if (Key.isDown('a')) {
|
|
61
|
+
* path.fillColor = 'red';
|
|
62
|
+
* } else {
|
|
63
|
+
* path.fillColor = 'blue';
|
|
64
|
+
* }
|
|
65
|
+
* }
|
|
66
|
+
*/
|
|
67
|
+
isDown(key: string): boolean;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Installs the listeners for the DOM's key events, once, with the first
|
|
71
|
+
* {@link View}.
|
|
72
|
+
*
|
|
73
|
+
* @private
|
|
74
|
+
*/
|
|
75
|
+
export declare function installKeyEvents(): void;
|
|
76
|
+
/**
|
|
77
|
+
* Handles a key going down or up, from the DOM's key events or from
|
|
78
|
+
* {@link View#dispatchKeyEvent(type, key[, options])}.
|
|
79
|
+
*
|
|
80
|
+
* @private
|
|
81
|
+
*/
|
|
82
|
+
export declare function handleKey(down: boolean, key: string, character: string | null, event: Event, view?: View | null): void;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Event } from '../internal.ts';
|
|
2
|
+
export type KeyEventType = 'keydown' | 'keyup';
|
|
3
|
+
/**
|
|
4
|
+
* The KeyEvent object is received by the {@link Tool}'s keyboard
|
|
5
|
+
* handlers {@link Tool#onKeyDown}, {@link Tool#onKeyUp}. The KeyEvent object is
|
|
6
|
+
* the only parameter passed to these functions and contains information about
|
|
7
|
+
* the keyboard event.
|
|
8
|
+
*/
|
|
9
|
+
export declare class KeyEvent extends Event {
|
|
10
|
+
/**
|
|
11
|
+
* The type of key event.
|
|
12
|
+
*
|
|
13
|
+
* @values 'keydown', 'keyup'
|
|
14
|
+
*/
|
|
15
|
+
type: KeyEventType;
|
|
16
|
+
/**
|
|
17
|
+
* The character representation of the key that caused this key event,
|
|
18
|
+
* taking into account the current key-modifiers (e.g. shift, control,
|
|
19
|
+
* caps-lock, etc.)
|
|
20
|
+
*/
|
|
21
|
+
character: string;
|
|
22
|
+
/**
|
|
23
|
+
* The key that caused this key event, either as a lower-case character or
|
|
24
|
+
* special key descriptor.
|
|
25
|
+
*
|
|
26
|
+
* @values 'enter', 'space', 'shift', 'control', 'alt', 'meta', 'caps-lock',
|
|
27
|
+
* 'left', 'up', 'right', 'down', 'escape', 'delete', ...
|
|
28
|
+
*/
|
|
29
|
+
key: string;
|
|
30
|
+
constructor(type: KeyEventType, event: globalThis.Event, key: string, character: string);
|
|
31
|
+
/**
|
|
32
|
+
* @return a string representation of the key event
|
|
33
|
+
*/
|
|
34
|
+
toString(): string;
|
|
35
|
+
}
|