@phin-tech/dottie 0.6.1 → 0.6.3
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/PARITY.md +3 -1
- package/README.md +8 -2
- package/dist/compile.js +64 -7
- package/dist/dottie-compile.mjs +76 -9
- package/dist/dottie-loader.js +2 -1
- package/dist/dottie-player.js +490 -179
- package/dist/dottie-player.min.js +53 -53
- package/dist/dottie.js +484 -179
- package/dist/fonts/OFL-architects-daughter.txt +93 -0
- package/dist/fonts/OFL-caveat.txt +93 -0
- package/dist/fonts/OFL-patrick-hand.txt +93 -0
- package/dist/fonts/architects-daughter-regular.woff2 +0 -0
- package/dist/fonts/caveat-bold.woff2 +0 -0
- package/dist/fonts/caveat-regular.woff2 +0 -0
- package/dist/fonts/patrick-hand-regular.woff2 +0 -0
- package/dist/types/compile.d.ts +5 -1
- package/dist/types/connector.d.ts +6 -6
- package/dist/types/element.d.ts +3 -0
- package/dist/types/fonts.d.ts +13 -0
- package/dist/types/index.d.ts +3 -1
- package/dist/types/metrics.d.ts +16 -9
- package/dist/types/model.d.ts +8 -0
- package/dist/types/shapes.d.ts +17 -4
- package/dist/types/text.d.ts +20 -6
- package/package.json +1 -1
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright (c) 2010, Kimberly Geswein (kimberlygeswein.com)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright 2014 The Caveat Project Authors (https://github.com/googlefonts/caveat)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright (c) 2010-2012 Patrick Wagesreiter (mail@patrickwagesreiter.at)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/types/compile.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { Face } from "./metrics.ts";
|
|
1
2
|
/** What follows the runtime; DOTTIE_DATA and DOTTIE_OPTIONS are replaced with JSON. Plain ES5, unminified. */
|
|
2
|
-
export declare const LOADER = ";(function () {\n var data = DOTTIE_DATA, options = DOTTIE_OPTIONS;\n var script = document.currentScript;\n function attr(el, name, value) { el.setAttribute(name.replace(/[A-Z]/g, function (c) { return \"-\" + c.toLowerCase(); }), value); }\n function mount() {\n var player = document.createElement(\"dottie-player\"), k;\n for (k in options) attr(player, k, options[k]);\n if (script) for (k in script.dataset) if (k !== \"target\") attr(player, k, script.dataset[k]);\n var target = script && script.dataset.target ? document.querySelector(script.dataset.target) : null;\n if (target) target.appendChild(player);\n else if (script && script.parentNode && script.parentNode !== document.head) script.parentNode.insertBefore(player, script);\n else document.body.appendChild(player);\n player.setFile(window.Dottie.parseDottie(data));\n }\n if (document.readyState === \"loading\" && (!script || script.parentNode === document.head || script.dataset.target)) {\n document.addEventListener(\"DOMContentLoaded\", mount);\n } else {\n mount();\n }\n})();\n";
|
|
3
|
+
export declare const LOADER = ";(function () {\n var data = DOTTIE_DATA, options = DOTTIE_OPTIONS, fonts = DOTTIE_FONTS;\n var script = document.currentScript;\n if (window.Dottie.addFonts) window.Dottie.addFonts(Object.keys(fonts), fonts);\n function attr(el, name, value) { el.setAttribute(name.replace(/[A-Z]/g, function (c) { return \"-\" + c.toLowerCase(); }), value); }\n function mount() {\n var player = document.createElement(\"dottie-player\"), k;\n for (k in options) attr(player, k, options[k]);\n if (script) for (k in script.dataset) if (k !== \"target\") attr(player, k, script.dataset[k]);\n var target = script && script.dataset.target ? document.querySelector(script.dataset.target) : null;\n if (target) target.appendChild(player);\n else if (script && script.parentNode && script.parentNode !== document.head) script.parentNode.insertBefore(player, script);\n else document.body.appendChild(player);\n player.setFile(window.Dottie.parseDottie(data));\n }\n if (document.readyState === \"loading\" && (!script || script.parentNode === document.head || script.dataset.target)) {\n document.addEventListener(\"DOMContentLoaded\", mount);\n } else {\n mount();\n }\n})();\n";
|
|
3
4
|
export interface CompileOptions {
|
|
4
5
|
/** Page name or 1-based number; only that page goes in. The first page by default. */
|
|
5
6
|
page?: string | number;
|
|
@@ -10,6 +11,9 @@ export interface CompileOptions {
|
|
|
10
11
|
noAutoplay?: boolean;
|
|
11
12
|
noLoop?: boolean;
|
|
12
13
|
label?: string;
|
|
14
|
+
/** A bundled font's file (`fontFile`) as base64, so the drawing carries the fonts it uses; without it the
|
|
15
|
+
* player fetches them from beside itself. dottie-compile reads them from dist/fonts. */
|
|
16
|
+
fontData?: (family: string, face: Face) => string | undefined;
|
|
13
17
|
}
|
|
14
18
|
/** JSON safe inside a script: it can't close the tag or start a comment. */
|
|
15
19
|
export declare function scriptJSON(value: unknown): string;
|
|
@@ -6,18 +6,18 @@ export declare function portPoint(shape: Element, port: Port): Point;
|
|
|
6
6
|
/** Where the line from the shape's center toward `target` crosses its outline. */
|
|
7
7
|
export declare function edgePoint(shape: Element, toward: Point): Point;
|
|
8
8
|
export declare function endpoints(e: Element, index: Index): [Point, Point];
|
|
9
|
+
/** A curve is joined cubic Béziers: the start, then two controls and an end per segment. */
|
|
9
10
|
export type Route = {
|
|
10
11
|
kind: "polyline";
|
|
11
12
|
points: Point[];
|
|
12
13
|
} | {
|
|
13
|
-
kind: "
|
|
14
|
-
|
|
15
|
-
b: Point;
|
|
16
|
-
c: Point;
|
|
17
|
-
d: Point;
|
|
14
|
+
kind: "curve";
|
|
15
|
+
points: Point[];
|
|
18
16
|
};
|
|
19
|
-
/** A route's centerline as points;
|
|
17
|
+
/** A route's centerline as points; each cubic segment is sampled at 25 points. */
|
|
20
18
|
export declare function routePoints(r: Route): Point[];
|
|
19
|
+
/** Drops repeated points and the middle of three in a line, so dragged bends that fall into line disappear. */
|
|
20
|
+
export declare function simplified(pts: Point[]): Point[];
|
|
21
21
|
export declare function route(e: Element, index: Index): Route;
|
|
22
22
|
/** Arrowhead wing points for a tip at `tip` arriving from `from`. */
|
|
23
23
|
export declare function arrowhead(tip: Point, from: Point, size: number): [Point, Point];
|
package/dist/types/element.d.ts
CHANGED
|
@@ -11,6 +11,9 @@ export declare const unrotated: (e: Element, p: Point) => Point;
|
|
|
11
11
|
export declare function rotatedBounds(e: Element): Rect;
|
|
12
12
|
/** The element with automatic ink drawn as `ink`; a light ink is not used on a light, mostly opaque fill. */
|
|
13
13
|
export declare function resolvingInk(e: Element, ink: RGBA): Element;
|
|
14
|
+
/** What the element's text is drawn in: a text box's and a note's stroke, any other label's `textColor` or,
|
|
15
|
+
* without one, its stroke. */
|
|
16
|
+
export declare function labelColor(e: Element): RGBA;
|
|
14
17
|
export interface Contour {
|
|
15
18
|
closed: boolean;
|
|
16
19
|
points: Point[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Page } from "./model.ts";
|
|
2
|
+
import { type Face } from "./metrics.ts";
|
|
3
|
+
/** A bundled font file's name in dist/fonts, e.g. "caveat-bold.woff2". */
|
|
4
|
+
export declare function fontFile(family: string, face: Face): string;
|
|
5
|
+
/** The faces bundled for `family`. */
|
|
6
|
+
export declare function fontFaces(family: string): Face[];
|
|
7
|
+
/** The bundled families text on `page` (and in its symbols) is set in. */
|
|
8
|
+
export declare function usedFonts(page: Page): string[];
|
|
9
|
+
/** Serves the font files from `url` (a folder) instead of the one beside dottie.js. */
|
|
10
|
+
export declare function setFontBase(url: string): void;
|
|
11
|
+
/** Adds `fonts` to the document, once each: from `data` (base64 WOFF2 by family and face) when it has them, else
|
|
12
|
+
* from the font files, which the browser fetches when text first needs them. */
|
|
13
|
+
export declare function addFonts(fonts: string[], data?: Record<string, Partial<Record<Face, string>>>): void;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type DottieFile, type RGBA } from "./model.ts";
|
|
2
2
|
export * from "./model.ts";
|
|
3
|
+
export { addFonts, fontFaces, fontFile, setFontBase, usedFonts } from "./fonts.ts";
|
|
4
|
+
export { BUNDLED_FONTS } from "./text.ts";
|
|
3
5
|
export { inspect, inspectFrame, inspectPage, sampleTimes } from "./inspect.ts";
|
|
4
6
|
export { DottiePlayer, Playback, definePlayer, pageIndex, withRoughness } from "./player.ts";
|
|
5
7
|
export { bounds, plan, svg, svgParts, type Plan, type Part } from "./svg.ts";
|
|
@@ -18,4 +20,4 @@ export interface RenderOptions {
|
|
|
18
20
|
/** One page of a drawing as an SVG document, as Dottie's own SVG export draws it. */
|
|
19
21
|
export declare function render(source: string | DottieFile | unknown, options?: RenderOptions): string;
|
|
20
22
|
/** The library's version. */
|
|
21
|
-
export declare const VERSION = "0.6.
|
|
23
|
+
export declare const VERSION = "0.6.3";
|
package/dist/types/metrics.d.ts
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export declare const fonts: Record<"regular" | "bold" | "italic" | "boldItalic", {
|
|
1
|
+
export type Face = "regular" | "bold" | "italic" | "boldItalic";
|
|
2
|
+
export interface FaceMetrics {
|
|
3
|
+
ascent: number;
|
|
4
|
+
descent: number;
|
|
5
|
+
leading: number;
|
|
7
6
|
w: Record<string, number>;
|
|
8
7
|
k: Record<string, number>;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
}
|
|
9
|
+
export interface FamilyMetrics {
|
|
10
|
+
/** The faces the font has; text in a face it lacks is set in its regular face. */
|
|
11
|
+
faces: {
|
|
12
|
+
regular: FaceMetrics;
|
|
13
|
+
} & Partial<Record<Face, FaceMetrics>>;
|
|
14
|
+
/** Ascent, descent and leading per em of the fallback font for characters the font lacks. */
|
|
15
|
+
fallback: Record<string, [number, number, number]>;
|
|
16
|
+
}
|
|
17
|
+
export declare const monoAdvance = 0.60205078125, monoAscent = 0.92822265625, monoDescent = 0.23583984375;
|
|
18
|
+
export declare const families: Record<string, FamilyMetrics>;
|
package/dist/types/model.d.ts
CHANGED
|
@@ -21,10 +21,14 @@ export interface Style {
|
|
|
21
21
|
roughness: number;
|
|
22
22
|
bowing: number;
|
|
23
23
|
fontSize: number;
|
|
24
|
+
/** The font text is set in: null is Helvetica Neue, else a bundled handwriting font or one of the viewer's own. */
|
|
25
|
+
font: string | null;
|
|
24
26
|
gridSize: number | null;
|
|
25
27
|
opacity: number | null;
|
|
26
28
|
/** How far into its dash pattern a dashed or dotted line starts; marching ants set it on every frame. */
|
|
27
29
|
dashOffset: number | null;
|
|
30
|
+
/** The color of a shape's or connector's label; null follows `stroke`. Text boxes and notes ignore it. */
|
|
31
|
+
textColor: RGBA | null;
|
|
28
32
|
}
|
|
29
33
|
/** `portIndex` pins the end to one of the bound element's `ports`, and wins over `port`. */
|
|
30
34
|
export interface Endpoint {
|
|
@@ -47,6 +51,10 @@ export interface ConnectorData {
|
|
|
47
51
|
routing: Routing;
|
|
48
52
|
startHead: Arrowhead;
|
|
49
53
|
endHead: Arrowhead;
|
|
54
|
+
/** Bends on the canvas the line passes through, start to end. */
|
|
55
|
+
waypoints: StrokePoint[] | null;
|
|
56
|
+
/** Hops where the line crosses a connector drawn beneath it. */
|
|
57
|
+
hops: boolean | null;
|
|
50
58
|
}
|
|
51
59
|
export interface PathSubpath {
|
|
52
60
|
closed: boolean;
|
package/dist/types/shapes.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type Index } from "./connector.ts";
|
|
2
|
-
import type
|
|
1
|
+
import { type Index, type Route } from "./connector.ts";
|
|
2
|
+
import { type DashStyle, type Element, type Page } from "./model.ts";
|
|
3
3
|
import { Path, type Point } from "./path.ts";
|
|
4
4
|
/** The `.grid` cell size actually drawn. */
|
|
5
5
|
export declare const cellSize: (e: Element) => number;
|
|
@@ -13,5 +13,18 @@ export declare function fillPath(e: Element): Path;
|
|
|
13
13
|
export declare function hachurePath(e: Element): Path;
|
|
14
14
|
/** Dash lengths for a stroke width; null for a solid line. */
|
|
15
15
|
export declare function dashPattern(dash: DashStyle, width: number): number[] | null;
|
|
16
|
-
/**
|
|
17
|
-
|
|
16
|
+
/**
|
|
17
|
+
* A connector as the stroked line (with open arrowheads) and the closed heads filled in the stroke color. `page`
|
|
18
|
+
* holds the connectors a hopping line hops over; without it a line draws no hops.
|
|
19
|
+
*/
|
|
20
|
+
export declare function connectorParts(e: Element, index: Index, page?: Page): [Path, Path];
|
|
21
|
+
/** How big a hop is for a line `strokeWidth` wide: its radius. */
|
|
22
|
+
export declare function hopRadius(strokeWidth: number): number;
|
|
23
|
+
/** The points a route's segments are measured along: a straight segment's two ends, or a cubic sampled at 25. */
|
|
24
|
+
export declare function hopSamples(r: Route): Point[][];
|
|
25
|
+
/**
|
|
26
|
+
* Where a hopping connector's segments (straight, or each cubic of a curve) cross the connectors drawn beneath it
|
|
27
|
+
* (earlier on a visible layer): for each segment, the distances along it, ascending, leaving out crossings too close
|
|
28
|
+
* to its ends or the hop before.
|
|
29
|
+
*/
|
|
30
|
+
export declare function hopCrossings(e: Element, r: Route, page: Page, index: Index): number[][];
|
package/dist/types/text.d.ts
CHANGED
|
@@ -1,15 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
import { type Face, type FamilyMetrics } from "./metrics.ts";
|
|
2
|
+
export type { Face };
|
|
3
|
+
export declare const DEFAULT_FAMILY = "Helvetica Neue";
|
|
4
|
+
/** The bundled handwriting fonts, by name. */
|
|
5
|
+
export declare const BUNDLED_FONTS: readonly string[];
|
|
6
|
+
/** The bundled family `font` (an element's `style.font`) names, matched without regard to case. */
|
|
7
|
+
export declare function bundledFamily(font: string | null | undefined): string | null;
|
|
8
|
+
/** The measurements text in `font` is laid out with: a bundled font's own, else Helvetica Neue's (a font of one's
|
|
9
|
+
* own isn't embedded, and dottie.js can't measure it, so it is laid out as Helvetica Neue). */
|
|
10
|
+
export declare function familyMetrics(font: string | null | undefined): FamilyMetrics;
|
|
11
|
+
/** The face text that is `bold` and `italic` is set in: that face, or regular when the font lacks it. */
|
|
12
|
+
export declare function faceOf(fam: FamilyMetrics, bold: boolean, italic: boolean): Face;
|
|
13
|
+
/** The SVG `font-family` for text in `font`: its name, then the fallbacks (Fonts.cssFamily). */
|
|
14
|
+
export declare function cssFamily(font: string | null | undefined): string;
|
|
2
15
|
/** Width of a run of text at `fontSize`, kerned. */
|
|
3
|
-
export declare function measure(s: string, fontSize: number, face?: Face): number;
|
|
4
|
-
/**
|
|
5
|
-
|
|
16
|
+
export declare function measure(s: string, fontSize: number, face?: Face, font?: string | null): number;
|
|
17
|
+
/** Height of one line, and what each further line adds, for the regular face: CoreText puts baselines on
|
|
18
|
+
* rounded ascents, descents and leadings, and the frame ends below the last line's descent, rounded up. */
|
|
19
|
+
export declare function lineHeights(fontSize: number, font?: string | null): [number, number];
|
|
6
20
|
/** Whether a line may break after `ch` when `next` follows (Unicode line breaking as CoreText does it: after
|
|
7
21
|
* a space, and after a slash or hyphen not followed by a digit, a space or another of itself). */
|
|
8
22
|
export declare function breaksAfter(ch: string, next: string): boolean;
|
|
9
23
|
/** Lines `s` wraps into within `maxWidth` (or inside a piece too long for a line). */
|
|
10
|
-
export declare function wrap(s: string, fontSize: number, maxWidth: number, face?: Face): string[];
|
|
24
|
+
export declare function wrap(s: string, fontSize: number, maxWidth: number, face?: Face, font?: string | null): string[];
|
|
11
25
|
/** The size CoreText suggests for `s` wrapped at `maxWidth`, rounded up (Renderer.textSize). */
|
|
12
|
-
export declare function textSize(s: string, fontSize: number, maxWidth: number): {
|
|
26
|
+
export declare function textSize(s: string, fontSize: number, maxWidth: number, font?: string | null): {
|
|
13
27
|
width: number;
|
|
14
28
|
height: number;
|
|
15
29
|
};
|