paper 0.13.0 → 0.15.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 +337 -0
- package/README.md +19 -14
- package/dist/docs/assets/js/paper.js +7351 -1706
- package/dist/docs/classes/AreaText.html +8658 -0
- package/dist/docs/classes/ChangeFlag.html +385 -0
- package/dist/docs/classes/Color.html +2 -1
- package/dist/docs/classes/CompoundPath.html +208 -69
- package/dist/docs/classes/Curve.html +2 -1
- package/dist/docs/classes/CurveLocation.html +2 -1
- package/dist/docs/classes/Event.html +5 -4
- package/dist/docs/classes/Gradient.html +2 -1
- package/dist/docs/classes/GradientStop.html +2 -1
- package/dist/docs/classes/Group.html +204 -17
- package/dist/docs/classes/HitResult.html +4 -2
- package/dist/docs/classes/HostItem.html +6786 -0
- package/dist/docs/classes/Item.html +193 -17
- package/dist/docs/classes/Key.html +2 -1
- package/dist/docs/classes/KeyEvent.html +5 -4
- package/dist/docs/classes/Layer.html +201 -17
- package/dist/docs/classes/Matrix.html +2 -1
- package/dist/docs/classes/MouseEvent.html +5 -4
- package/dist/docs/classes/PaperScope.html +5 -2
- package/dist/docs/classes/PaperScript.html +6 -2
- package/dist/docs/classes/Path.html +183 -70
- package/dist/docs/classes/PathItem.html +326 -187
- package/dist/docs/classes/PathText.html +8528 -0
- package/dist/docs/classes/Point.html +13 -2
- package/dist/docs/classes/PointText.html +1404 -63
- package/dist/docs/classes/Project.html +221 -1
- package/dist/docs/classes/Raster.html +136 -17
- package/dist/docs/classes/Rectangle.html +3 -2
- package/dist/docs/classes/Segment.html +2 -1
- package/dist/docs/classes/Shape.html +136 -17
- package/dist/docs/classes/Size.html +4 -2
- package/dist/docs/classes/Style.html +768 -15
- package/dist/docs/classes/SymbolDefinition.html +2 -1
- package/dist/docs/classes/SymbolItem.html +136 -17
- package/dist/docs/classes/TextItem.html +1566 -222
- package/dist/docs/classes/TextRange.html +186 -0
- package/dist/docs/classes/TextStory.html +355 -0
- package/dist/docs/classes/Tool.html +127 -1
- package/dist/docs/classes/ToolEvent.html +57 -4
- package/dist/docs/classes/Tween.html +17 -1
- package/dist/docs/classes/View.html +148 -5
- package/dist/docs/classes/global.html +2 -1
- package/dist/docs/classes/index.html +2 -2
- package/dist/docs/index.html +1 -1
- package/dist/paper-core.js +7160 -1663
- package/dist/paper-core.min.js +3 -3
- package/dist/paper-full.js +7351 -1706
- package/dist/paper-full.min.js +3 -3
- package/dist/paper-hosted.js +24058 -0
- package/dist/paper.d.ts +1996 -155
- package/examples/Scripts/AreaText.html +65 -0
- package/examples/Scripts/PathText.html +48 -0
- package/examples/Scripts/TextRanges.html +51 -0
- package/package.json +8 -11
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<title>Area Text</title>
|
|
6
|
+
<link rel="stylesheet" href="../css/style.css">
|
|
7
|
+
<script type="text/javascript" src="../../dist/paper-full.js"></script>
|
|
8
|
+
<script type="text/paperscript" canvas="canvas">
|
|
9
|
+
var words = 'Text flows inside an area, line by line, broken where '
|
|
10
|
+
+ 'the words no longer fit, or at their soft hy\u00adphens, '
|
|
11
|
+
+ 'and on into the next col\u00adumn. ';
|
|
12
|
+
// Two justified columns in a rectangle:
|
|
13
|
+
var text = new AreaText(new Rectangle(40, 40, 420, 260));
|
|
14
|
+
text.columns = 2;
|
|
15
|
+
text.gutter = 20;
|
|
16
|
+
text.content = words + words + words + '\n' + words + words + words
|
|
17
|
+
+ words + words + words + words;
|
|
18
|
+
text.fontFamily = 'Georgia';
|
|
19
|
+
text.fontSize = 15;
|
|
20
|
+
text.justification = 'justify';
|
|
21
|
+
text.paragraphs[1].fillColor = '#c04';
|
|
22
|
+
|
|
23
|
+
// A circle, linked to the rectangle, so the story flows on into it:
|
|
24
|
+
var circle = new AreaText(new Path.Circle({
|
|
25
|
+
center: [640, 200],
|
|
26
|
+
radius: 140
|
|
27
|
+
}));
|
|
28
|
+
circle.fontFamily = 'Georgia';
|
|
29
|
+
circle.fontSize = 15;
|
|
30
|
+
circle.justification = 'center';
|
|
31
|
+
text.link(circle);
|
|
32
|
+
|
|
33
|
+
// A heading with balanced lines, in an area as high as they need:
|
|
34
|
+
var heading = new AreaText(new Rectangle(40, 340, 420, 0));
|
|
35
|
+
heading.content = 'A heading whose lines are balanced, so the last '
|
|
36
|
+
+ 'one is not left alone';
|
|
37
|
+
heading.fontFamily = 'Georgia';
|
|
38
|
+
heading.fontSize = 28;
|
|
39
|
+
heading.lineWrap = 'balance';
|
|
40
|
+
heading.fitHeight();
|
|
41
|
+
|
|
42
|
+
// Show the guides, which the text items don't draw:
|
|
43
|
+
var guides = new Group([heading.textPath.clone(),
|
|
44
|
+
text.textPath.clone(), circle.textPath.clone()]);
|
|
45
|
+
guides.strokeColor = '#ddd';
|
|
46
|
+
guides.sendToBack();
|
|
47
|
+
|
|
48
|
+
// A circle above the columns, which pushes their text aside, and
|
|
49
|
+
// follows the mouse:
|
|
50
|
+
var wrap = new Path.Circle({
|
|
51
|
+
center: [250, 170],
|
|
52
|
+
radius: 50,
|
|
53
|
+
fillColor: '#048',
|
|
54
|
+
textWrap: { offset: 8 }
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
function onMouseMove(event) {
|
|
58
|
+
wrap.position = event.point;
|
|
59
|
+
}
|
|
60
|
+
</script>
|
|
61
|
+
</head>
|
|
62
|
+
<body>
|
|
63
|
+
<canvas id="canvas" resize></canvas>
|
|
64
|
+
</body>
|
|
65
|
+
</html>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<title>Path Text</title>
|
|
6
|
+
<link rel="stylesheet" href="../css/style.css">
|
|
7
|
+
<script type="text/javascript" src="../../dist/paper-full.js"></script>
|
|
8
|
+
<script type="text/paperscript" canvas="canvas">
|
|
9
|
+
// Text along a wave, which the mouse reshapes:
|
|
10
|
+
var path = new Path({
|
|
11
|
+
segments: [[60, 200], [260, 120], [460, 280], [660, 200]]
|
|
12
|
+
});
|
|
13
|
+
path.smooth();
|
|
14
|
+
var text = new PathText(path);
|
|
15
|
+
text.content = 'Text runs along a path, each letter turned to where it '
|
|
16
|
+
+ 'sits, and what doesn\'t fit flows on into the next one.';
|
|
17
|
+
text.fontFamily = 'Georgia';
|
|
18
|
+
text.fontSize = 22;
|
|
19
|
+
text.words.forEach(function(word, i) {
|
|
20
|
+
word.fillColor = i % 2 ? '#c04' : '#048';
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// A second text item along a circle, linked to the first, so the
|
|
24
|
+
// story flows on into it:
|
|
25
|
+
var circle = new PathText(new Path.Circle({
|
|
26
|
+
center: [360, 420],
|
|
27
|
+
radius: 90
|
|
28
|
+
}));
|
|
29
|
+
circle.fontFamily = 'Georgia';
|
|
30
|
+
circle.fontSize = 22;
|
|
31
|
+
text.link(circle);
|
|
32
|
+
|
|
33
|
+
// Show the guides, which the text items don't draw:
|
|
34
|
+
var guides = new Group([path.clone(), circle.textPath.clone()]);
|
|
35
|
+
guides.strokeColor = '#ddd';
|
|
36
|
+
guides.sendToBack();
|
|
37
|
+
|
|
38
|
+
function onMouseMove(event) {
|
|
39
|
+
path.segments[1].point.y = event.point.y;
|
|
40
|
+
path.smooth();
|
|
41
|
+
guides.firstChild.segments = path.segments;
|
|
42
|
+
}
|
|
43
|
+
</script>
|
|
44
|
+
</head>
|
|
45
|
+
<body>
|
|
46
|
+
<canvas id="canvas" resize></canvas>
|
|
47
|
+
</body>
|
|
48
|
+
</html>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<title>Text Ranges</title>
|
|
6
|
+
<link rel="stylesheet" href="../css/style.css">
|
|
7
|
+
<script type="text/javascript" src="../../dist/paper-full.js"></script>
|
|
8
|
+
<script type="text/paperscript" canvas="canvas">
|
|
9
|
+
var text = new PointText({
|
|
10
|
+
point: [400, 80],
|
|
11
|
+
content: 'Every word its own size\nand every letter its own color\n'
|
|
12
|
+
+ 'Right justified, with space before, and a note1',
|
|
13
|
+
fontFamily: 'Georgia',
|
|
14
|
+
fontSize: 20
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
var paragraphs = text.paragraphs;
|
|
18
|
+
|
|
19
|
+
// Walk the words of the first paragraph and restyle them:
|
|
20
|
+
paragraphs[0].words.forEach(function(word) {
|
|
21
|
+
word.fontSize = 14 + word.content.length * 4;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// Walk the letters of the second paragraph:
|
|
25
|
+
paragraphs[1].letters.forEach(function(letter, i) {
|
|
26
|
+
letter.fillColor = { hue: i * 12, saturation: 0.8,
|
|
27
|
+
brightness: 0.8 };
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// Paragraph properties apply to whole paragraphs:
|
|
31
|
+
var last = paragraphs[2];
|
|
32
|
+
last.justification = 'right';
|
|
33
|
+
last.spaceBefore = 20;
|
|
34
|
+
last.fontStyle = 'italic';
|
|
35
|
+
text.range(last.start, last.start + 5).underline = true;
|
|
36
|
+
|
|
37
|
+
// Tracking and superscripts on ranges:
|
|
38
|
+
text.words[1].letterTracking = 300;
|
|
39
|
+
var end = text.content.length;
|
|
40
|
+
text.range(end - 1, end).baselinePosition = 'superscript';
|
|
41
|
+
|
|
42
|
+
var bounds = new Path.Rectangle({
|
|
43
|
+
rectangle: text.bounds,
|
|
44
|
+
strokeColor: '#ddd'
|
|
45
|
+
});
|
|
46
|
+
</script>
|
|
47
|
+
</head>
|
|
48
|
+
<body>
|
|
49
|
+
<canvas id="canvas" resize></canvas>
|
|
50
|
+
</body>
|
|
51
|
+
</html>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "paper",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "The Swiss Army Knife of Vector Graphics Scripting",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "http://paperjs.org",
|
|
@@ -26,7 +26,9 @@
|
|
|
26
26
|
"jshint": "gulp jshint",
|
|
27
27
|
"test": "gulp test",
|
|
28
28
|
"test:browser": "gulp test:browser",
|
|
29
|
-
"test:
|
|
29
|
+
"test:chrome": "gulp test:chrome",
|
|
30
|
+
"test:node": "gulp test:node",
|
|
31
|
+
"prepare": "husky"
|
|
30
32
|
},
|
|
31
33
|
"files": [
|
|
32
34
|
"AUTHORS.md",
|
|
@@ -42,12 +44,6 @@
|
|
|
42
44
|
"engines": {
|
|
43
45
|
"node": ">=8.0.0"
|
|
44
46
|
},
|
|
45
|
-
"husky": {
|
|
46
|
-
"hooks": {
|
|
47
|
-
"pre-commit": "yarn jshint --ensure-branch develop",
|
|
48
|
-
"pre-push": "yarn test --ensure-branch develop"
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
47
|
"browser": {
|
|
52
48
|
"./dist/node/extend.js": false,
|
|
53
49
|
"./dist/node/self.js": false,
|
|
@@ -59,6 +55,7 @@
|
|
|
59
55
|
},
|
|
60
56
|
"devDependencies": {
|
|
61
57
|
"acorn": "~0.5.0",
|
|
58
|
+
"acorn-latest": "npm:acorn@8.15.0",
|
|
62
59
|
"ansi-colors": "^4.1.3",
|
|
63
60
|
"canvas": "^3.2.3",
|
|
64
61
|
"del": "^5.1.0",
|
|
@@ -78,14 +75,14 @@
|
|
|
78
75
|
"gulp-webserver": "^0.9.1",
|
|
79
76
|
"gulp-whitespace": "^0.1.0",
|
|
80
77
|
"gulp-zip": "^5.1.0",
|
|
81
|
-
"husky": "^
|
|
78
|
+
"husky": "^9.1.7",
|
|
82
79
|
"jsdom": "^28.1.0",
|
|
83
80
|
"jshint": "^2.13.6",
|
|
84
81
|
"jshint-summary": "^0.4.0",
|
|
85
82
|
"merge-stream": "^2.0.0",
|
|
86
83
|
"minimist": "^1.2.8",
|
|
87
84
|
"mustache": "^4.2.0",
|
|
88
|
-
"prepro": "^2.
|
|
85
|
+
"prepro": "^2.5.0",
|
|
89
86
|
"qunitjs": "^1.23.1",
|
|
90
87
|
"require-dir": "^1.2.0",
|
|
91
88
|
"resemblejs": "^3.2.5",
|
|
@@ -93,7 +90,7 @@
|
|
|
93
90
|
"source-map-support": "^0.5.21",
|
|
94
91
|
"stats.js": "^0.17.0",
|
|
95
92
|
"straps": "^3.0.1",
|
|
96
|
-
"typescript": "^
|
|
93
|
+
"typescript": "^5.9.3"
|
|
97
94
|
},
|
|
98
95
|
"keywords": [
|
|
99
96
|
"vector",
|