@kensio/colophon 2.13.0 → 2.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -3
- package/dist/config/defaults.d.ts +77 -6
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +69 -6
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +2 -0
- package/dist/config/index.js.map +1 -1
- package/dist/config/resolve.d.ts +13 -0
- package/dist/config/resolve.d.ts.map +1 -1
- package/dist/config/resolve.js +14 -8
- package/dist/config/resolve.js.map +1 -1
- package/dist/config/safe-area.d.ts +27 -0
- package/dist/config/safe-area.d.ts.map +1 -0
- package/dist/config/safe-area.js +81 -0
- package/dist/config/safe-area.js.map +1 -0
- package/dist/config/size.d.ts.map +1 -1
- package/dist/config/size.js +1 -0
- package/dist/config/size.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/fonts/bundled.d.ts +38 -0
- package/dist/fonts/bundled.d.ts.map +1 -0
- package/dist/fonts/bundled.js +29 -0
- package/dist/fonts/bundled.js.map +1 -0
- package/dist/fonts/index.d.ts +1 -0
- package/dist/fonts/index.d.ts.map +1 -1
- package/dist/fonts/index.js +1 -0
- package/dist/fonts/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/measure/faces.d.ts.map +1 -1
- package/dist/measure/faces.js +29 -5
- package/dist/measure/faces.js.map +1 -1
- package/dist/measure/index.d.ts.map +1 -1
- package/dist/measure/index.js +0 -0
- package/dist/measure/index.js.map +1 -1
- package/dist/platform/bundled-fonts.browser.d.ts +16 -0
- package/dist/platform/bundled-fonts.browser.d.ts.map +1 -0
- package/dist/platform/bundled-fonts.browser.js +17 -0
- package/dist/platform/bundled-fonts.browser.js.map +1 -0
- package/dist/platform/bundled-fonts.node.d.ts +18 -0
- package/dist/platform/bundled-fonts.node.d.ts.map +1 -0
- package/dist/platform/bundled-fonts.node.js +49 -0
- package/dist/platform/bundled-fonts.node.js.map +1 -0
- package/dist/render/rasterise.d.ts.map +1 -1
- package/dist/render/rasterise.js +8 -3
- package/dist/render/rasterise.js.map +1 -1
- package/dist/templates/article/index.js +1 -1
- package/dist/templates/article/index.js.map +1 -1
- package/dist/templates/banner/badge.d.ts +8 -1
- package/dist/templates/banner/badge.d.ts.map +1 -1
- package/dist/templates/banner/badge.js +8 -4
- package/dist/templates/banner/badge.js.map +1 -1
- package/dist/templates/banner/index.d.ts.map +1 -1
- package/dist/templates/banner/index.js +10 -25
- package/dist/templates/banner/index.js.map +1 -1
- package/dist/templates/bottom.d.ts +1 -1
- package/dist/templates/bottom.d.ts.map +1 -1
- package/dist/templates/bottom.js +5 -5
- package/dist/templates/bottom.js.map +1 -1
- package/dist/templates/card/index.d.ts.map +1 -1
- package/dist/templates/card/index.js +9 -25
- package/dist/templates/card/index.js.map +1 -1
- package/dist/templates/cover/index.d.ts +21 -0
- package/dist/templates/cover/index.d.ts.map +1 -0
- package/dist/templates/cover/index.js +67 -0
- package/dist/templates/cover/index.js.map +1 -0
- package/dist/templates/cover/lines.d.ts +21 -0
- package/dist/templates/cover/lines.d.ts.map +1 -0
- package/dist/templates/cover/lines.js +73 -0
- package/dist/templates/cover/lines.js.map +1 -0
- package/dist/templates/cover/lockup.d.ts +47 -0
- package/dist/templates/cover/lockup.d.ts.map +1 -0
- package/dist/templates/cover/lockup.js +71 -0
- package/dist/templates/cover/lockup.js.map +1 -0
- package/dist/templates/docs/index.js +3 -3
- package/dist/templates/docs/index.js.map +1 -1
- package/dist/templates/event/index.js +3 -3
- package/dist/templates/event/index.js.map +1 -1
- package/dist/templates/footer.d.ts +3 -0
- package/dist/templates/footer.d.ts.map +1 -1
- package/dist/templates/footer.js +16 -1
- package/dist/templates/footer.js.map +1 -1
- package/dist/templates/frame.d.ts +27 -3
- package/dist/templates/frame.d.ts.map +1 -1
- package/dist/templates/frame.js +19 -7
- package/dist/templates/frame.js.map +1 -1
- package/dist/templates/index.d.ts +1 -0
- package/dist/templates/index.d.ts.map +1 -1
- package/dist/templates/index.js +3 -0
- package/dist/templates/index.js.map +1 -1
- package/dist/templates/logo.d.ts +6 -2
- package/dist/templates/logo.d.ts.map +1 -1
- package/dist/templates/logo.js +10 -6
- package/dist/templates/logo.js.map +1 -1
- package/dist/templates/photo/index.d.ts.map +1 -1
- package/dist/templates/photo/index.js +9 -4
- package/dist/templates/photo/index.js.map +1 -1
- package/dist/templates/quote/index.js +2 -2
- package/dist/templates/quote/index.js.map +1 -1
- package/dist/templates/release/index.js +3 -3
- package/dist/templates/release/index.js.map +1 -1
- package/dist/templates/stat/index.js +3 -3
- package/dist/templates/stat/index.js.map +1 -1
- package/dist/templates/thumbnail/index.js +3 -3
- package/dist/templates/thumbnail/index.js.map +1 -1
- package/dist/templates/wordmark/index.js +2 -2
- package/dist/templates/wordmark/index.js.map +1 -1
- package/dist/types.d.ts +49 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/validate/collect.d.ts.map +1 -1
- package/dist/validate/collect.js +2 -1
- package/dist/validate/collect.js.map +1 -1
- package/dist/validate/keys.d.ts +2 -0
- package/dist/validate/keys.d.ts.map +1 -1
- package/dist/validate/keys.js +9 -0
- package/dist/validate/keys.js.map +1 -1
- package/dist/validate/overrides.d.ts.map +1 -1
- package/dist/validate/overrides.js +2 -1
- package/dist/validate/overrides.js.map +1 -1
- package/fonts/JetBrainsMono-LICENSE.txt +93 -0
- package/fonts/JetBrainsMono_400Regular.ttf +0 -0
- package/fonts/JetBrainsMono_700Bold.ttf +0 -0
- package/fonts/Outfit-LICENSE.txt +93 -0
- package/fonts/Outfit_400Regular.ttf +0 -0
- package/fonts/Outfit_500Medium.ttf +0 -0
- package/fonts/Outfit_600SemiBold.ttf +0 -0
- package/fonts/Outfit_700Bold.ttf +0 -0
- package/fonts/Outfit_800ExtraBold.ttf +0 -0
- package/package.json +4 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundled.js","sourceRoot":"","sources":["../../src/fonts/bundled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAajE,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,gBAAgB,CAC9B,KAA4B;IAE5B,OAAO,CAAC,GAAG,KAAK,EAAE,GAAG,YAAY,EAAE,CAAC,CAAC;AACvC,CAAC"}
|
package/dist/fonts/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fonts/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,SAAS,UAAU,EAAE,GAC3B,MAAM,GAAG,SAAS,CAEpB"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fonts/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,SAAS,UAAU,EAAE,GAC3B,MAAM,GAAG,SAAS,CAEpB"}
|
package/dist/fonts/index.js
CHANGED
package/dist/fonts/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/fonts/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAC5B,KAA4B;IAE5B,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,EAAE,MAAM,CAAC;AACjE,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/fonts/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAC5B,KAA4B;IAE5B,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,EAAE,MAAM,CAAC;AACjE,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { Background, Badge, BrandColors, CodeStyle, ColophonConfig, ColophonConfigFactory, ColophonConfigInput, ContentFile, ContentOptions, Dimensions, ExtraImage, FontSource, GradientStop, Manifest, ManifestImage, ManifestPage, MeshBlob, MetaImageProps, MeasureText, MetaTag, MetaTagOptions, OutputFormat, OutputSize, Placement, PropsFromFrontmatter, Rasteriser, RenderedMetaImage, SlugStrategy, SizeOverrides, ResolvedConfig, Template, TemplateContext, Texture, TextStyle, ThemeName, WarningHandler, } from "./types.js";
|
|
1
|
+
export type { Background, Badge, BrandColors, CodeStyle, ColophonConfig, ColophonConfigFactory, ColophonConfigInput, ContentFile, ContentOptions, Dimensions, ExtraImage, FontSource, GradientStop, Manifest, ManifestImage, ManifestPage, MeshBlob, MetaImageProps, MeasureText, MetaTag, MetaTagOptions, OutputFormat, OutputSize, Placement, PropsFromFrontmatter, Rasteriser, RenderedMetaImage, SafeArea, SlugStrategy, SizeOverrides, ResolvedConfig, Template, TemplateContext, Texture, TextStyle, ThemeName, WarningHandler, } from "./types.js";
|
|
2
2
|
export { DEFAULT_CODE_FONT_FAMILY, DEFAULT_CODE_STYLE, DEFAULT_COLORS, DEFAULT_FONT_FAMILY, DEFAULT_SIZES, defineConfig, resolveConfig, SIZE_PRESETS, } from "./config/index.js";
|
|
3
3
|
export { resolveConfigForSize } from "./config/size.js";
|
|
4
4
|
export { backgroundSvg } from "./background/index.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,KAAK,EACL,WAAW,EACX,SAAS,EACT,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACnB,WAAW,EACX,cAAc,EACd,UAAU,EACV,UAAU,EACV,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,cAAc,EACd,WAAW,EACX,OAAO,EACP,cAAc,EACd,YAAY,EACZ,UAAU,EACV,SAAS,EACT,oBAAoB,EACpB,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,QAAQ,EACR,eAAe,EACf,OAAO,EACP,SAAS,EACT,SAAS,EACT,cAAc,GACf,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,YAAY,EACZ,aAAa,EACb,YAAY,GACb,MAAM,mBAAmB,CAAC;AAC3B,OA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,EACV,UAAU,EACV,SAAS,EACT,WAAW,EACX,cAAc,GACf,MAAM,iBAAiB,CAAC;AAIzB,OAAO,EACL,UAAU,EACV,GAAG,EACH,UAAU,EACV,SAAS,EACT,KAAK,EACL,KAAK,EACL,SAAS,EACT,cAAc,EACd,KAAK,EACL,UAAU,EACV,GAAG,EACH,KAAK,EACL,KAAK,GACN,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,KAAK,EACL,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,UAAU,EACV,MAAM,EACN,UAAU,EACV,UAAU,EACV,IAAI,EACJ,OAAO,EACP,YAAY,EACZ,IAAI,EACJ,WAAW,EACX,WAAW,EACX,SAAS,EACT,QAAQ,GACT,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,wBAAwB,EACxB,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAItD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,EACL,cAAc,EACd,UAAU,EACV,WAAW,EACX,YAAY,EACZ,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAwCA,OAAO,EACL,wBAAwB,EACxB,kBAAkB,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Z,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAG5B,+EAA+E;AAC/E,+EAA+E;AAC/E,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,EACL,cAAc,EACd,UAAU,EACV,WAAW,EACX,YAAY,EACZ,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"faces.d.ts","sourceRoot":"","sources":["../../src/measure/faces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAIpC,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE9D;;;;GAIG;AACH,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB;
|
|
1
|
+
{"version":3,"file":"faces.d.ts","sourceRoot":"","sources":["../../src/measure/faces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAIpC,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE9D;;;;GAIG;AACH,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB;AAwHD,+EAA+E;AAC/E,wBAAsB,SAAS,CAC7B,KAAK,EAAE,SAAS,UAAU,EAAE,EAC5B,SAAS,EAAE,cAAc,GACxB,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC,CAM1B"}
|
package/dist/measure/faces.js
CHANGED
|
@@ -12,16 +12,40 @@ const byPath = new Map();
|
|
|
12
12
|
*/
|
|
13
13
|
const byData = new WeakMap();
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* The family a face belongs to, as the rasteriser understands it.
|
|
16
|
+
*
|
|
17
|
+
* A font file carries two family names. The old one, name ID 1, has to put
|
|
18
|
+
* every cut beyond regular and bold in a family of its own, because that is
|
|
19
|
+
* all the four-slot model of the original format could express; the
|
|
20
|
+
* typographic family, name ID 16, is the one that was added to say what the
|
|
21
|
+
* file actually belongs to. Google's static cuts use both, so
|
|
22
|
+
* `Outfit_800ExtraBold.ttf` is `Outfit ExtraBold` under the old name and
|
|
23
|
+
* `Outfit` under the new one.
|
|
24
|
+
*
|
|
25
|
+
* resvg matches on the typographic family, so `font-family="Outfit"` at weight
|
|
26
|
+
* 800 finds that file. fontkit's `familyName` is the old one, so taking it
|
|
27
|
+
* here meant `selectFace` never matched anything but the regular cut: a bold
|
|
28
|
+
* title was drawn in `Outfit ExtraBold` and measured in `Outfit` Regular,
|
|
29
|
+
* which is narrower, so the line was under-measured and ran past the margin.
|
|
30
|
+
* Preferring name ID 16 is what makes the two agree.
|
|
31
|
+
*
|
|
32
|
+
* Everything is read defensively because a font file is data. The types say
|
|
33
|
+
* these are always there, and a file missing its name or its `OS/2` table
|
|
34
|
+
* would otherwise take the build down inside `selectFace` rather than being
|
|
18
35
|
* measured as well as it can be. A face with no family name matches no stack,
|
|
19
|
-
* so it is only ever reached as the fallback
|
|
36
|
+
* so it is only ever reached as the fallback the first configured font is.
|
|
20
37
|
*/
|
|
21
38
|
function toFace(font) {
|
|
22
39
|
const declared = font;
|
|
40
|
+
const preferred = declared.name?.records?.preferredFamily;
|
|
41
|
+
// Name records are keyed by language, and fontkit hands back either the map
|
|
42
|
+
// or a bare string depending on the file. English is what a stack is written
|
|
43
|
+
// in, and the first entry is the best guess for a file that has no English.
|
|
44
|
+
const typographic = typeof preferred === "string"
|
|
45
|
+
? preferred
|
|
46
|
+
: (preferred?.["en"] ?? Object.values(preferred ?? {})[0]);
|
|
23
47
|
return {
|
|
24
|
-
family: declared.familyName ?? "",
|
|
48
|
+
family: typographic ?? declared.familyName ?? "",
|
|
25
49
|
weight: declared["OS/2"]?.usWeightClass ?? 400,
|
|
26
50
|
font,
|
|
27
51
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"faces.js","sourceRoot":"","sources":["../../src/measure/faces.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAc9D;;;GAGG;AACH,MAAM,MAAM,GAAG,IAAI,GAAG,EAAoC,CAAC;AAE3D;;;;GAIG;AACH,MAAM,MAAM,GAAG,IAAI,OAAO,EAAwC,CAAC;AAEnE
|
|
1
|
+
{"version":3,"file":"faces.js","sourceRoot":"","sources":["../../src/measure/faces.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAc9D;;;GAGG;AACH,MAAM,MAAM,GAAG,IAAI,GAAG,EAAoC,CAAC;AAE3D;;;;GAIG;AACH,MAAM,MAAM,GAAG,IAAI,OAAO,EAAwC,CAAC;AAEnE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,SAAS,MAAM,CAAC,IAAU;IACxB,MAAM,QAAQ,GAAG,IAShB,CAAC;IACF,MAAM,SAAS,GAAG,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,eAAe,CAAC;IAC1D,4EAA4E;IAC5E,6EAA6E;IAC7E,4EAA4E;IAC5E,MAAM,WAAW,GACf,OAAO,SAAS,KAAK,QAAQ;QAC3B,CAAC,CAAC,SAAS;QACX,C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AAC;QACtE,SAAS,CACP,kBAAkB,IAAI,+CAA+C;YACnE,oCAAoC,MAAM,EAAE,CAC/C,CAAC;QACF,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,SAAS,MAAM,CACb,IAAgB,EAChB,SAAyB;IAEzB,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;QACnB,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC/D,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC/B,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAC/D,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/B,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,+EAA+E;AAC/E,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,KAA4B,EAC5B,SAAyB;IAEzB,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,GAAG,CAC9B,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CACnD,CAAC;IAEF,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/measure/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/measure/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAa,MAAM,aAAa,CAAC;AAO1E,YAAY,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AA8CvC;;;;;;;;;;;GAWG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,WAAW,CAAC,CAsBtB"}
|
package/dist/measure/index.js
CHANGED
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/measure/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/measure/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAIzC;;;;;;;;GAQG;AACH,SAAS,OAAO,CACd,KAAsB,EACtB,KAAgB,EAChB,cAAuB;IAEvB,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,IAAI,GAAG,CAAC;IAEvC,OAAO,CACL,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,EAAE,MAAM,CAAC;QAC3C,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CACxC,CAAC;AACJ,CAAC;AAED,gEAAgE;AAChE,SAAS,SAAS,CAChB,IAAY,EACZ,KAAgB,EAChB,KAAsB,EACtB,cAAuB;IAEvB,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,IAAI,GAAG,CAAC;IACvC,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC;IAEtD,IAAI,GAAG,GAAG,CAAC,CAAC;IAEZ,KAAK,MAAM,GAAG,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AQ,CAAC;IAC9B,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { BundledFont } from "../fonts/bundled.js";
|
|
2
|
+
/**
|
|
3
|
+
* The bundled fonts in the browser and at the edge, which is to say none.
|
|
4
|
+
*
|
|
5
|
+
* A bundler picks this up through `package.json`'s `browser` field. The fonts
|
|
6
|
+
* that ship with the package are files, and a file path means nothing here, so
|
|
7
|
+
* offering them would be offering something `readFileBytes` is about to refuse.
|
|
8
|
+
* Inlining the bytes instead would put half a megabyte of font into every
|
|
9
|
+
* bundle that imports the core, whether or not it draws any text.
|
|
10
|
+
*
|
|
11
|
+
* So text in a browser is measured by estimate and drawn in whatever the host
|
|
12
|
+
* has, exactly as it was before there were bundled fonts. A page that wants
|
|
13
|
+
* them supplies them itself, as bytes, which is what `FontSource.data` is for.
|
|
14
|
+
*/
|
|
15
|
+
export declare function bundledFonts(): readonly BundledFont[];
|
|
16
|
+
//# sourceMappingURL=bundled-fonts.browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundled-fonts.browser.d.ts","sourceRoot":"","sources":["../../src/platform/bundled-fonts.browser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,IAAI,SAAS,WAAW,EAAE,CAErD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The bundled fonts in the browser and at the edge, which is to say none.
|
|
3
|
+
*
|
|
4
|
+
* A bundler picks this up through `package.json`'s `browser` field. The fonts
|
|
5
|
+
* that ship with the package are files, and a file path means nothing here, so
|
|
6
|
+
* offering them would be offering something `readFileBytes` is about to refuse.
|
|
7
|
+
* Inlining the bytes instead would put half a megabyte of font into every
|
|
8
|
+
* bundle that imports the core, whether or not it draws any text.
|
|
9
|
+
*
|
|
10
|
+
* So text in a browser is measured by estimate and drawn in whatever the host
|
|
11
|
+
* has, exactly as it was before there were bundled fonts. A page that wants
|
|
12
|
+
* them supplies them itself, as bytes, which is what `FontSource.data` is for.
|
|
13
|
+
*/
|
|
14
|
+
export function bundledFonts() {
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=bundled-fonts.browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundled-fonts.browser.js","sourceRoot":"","sources":["../../src/platform/bundled-fonts.browser.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,YAAY;IAC1B,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { BundledFont } from "../fonts/bundled.js";
|
|
2
|
+
/**
|
|
3
|
+
* The bundled fonts, in the order they are loaded.
|
|
4
|
+
*
|
|
5
|
+
* The family is declared as well as being in the file, which is a fact written
|
|
6
|
+
* down twice and worth the duplication for one reason: `fallbackFamily` reads
|
|
7
|
+
* declared families and nothing else, and it is what tells resvg which family
|
|
8
|
+
* to draw a stack in when the stack names nothing that was loaded. Without a
|
|
9
|
+
* declared family here, a project setting `fontFamily` to something it has not
|
|
10
|
+
* supplied would have its text measured against Outfit and drawn in whatever
|
|
11
|
+
* resvg falls back to on its own, which is how a layout comes out wrong on one
|
|
12
|
+
* machine and right on another. Nothing else reads these: matching a
|
|
13
|
+
* `font-family` to a file is done from the file's own name table, by the
|
|
14
|
+
* rasteriser and by `measure/faces.ts` alike. `fonts.test.ts` checks the two
|
|
15
|
+
* against each other so they cannot drift.
|
|
16
|
+
*/
|
|
17
|
+
export declare function bundledFonts(): readonly BundledFont[];
|
|
18
|
+
//# sourceMappingURL=bundled-fonts.node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundled-fonts.node.d.ts","sourceRoot":"","sources":["../../src/platform/bundled-fonts.node.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AA6BvD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,IAAI,SAAS,WAAW,EAAE,CAKrD"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { fileURLToPath } from "node:url";
|
|
2
|
+
/**
|
|
3
|
+
* The font files that ship with the package, as absolute paths.
|
|
4
|
+
*
|
|
5
|
+
* Two families, and only the cuts the built-in templates draw: Outfit at 400
|
|
6
|
+
* through 800 for everything that is words, and JetBrains Mono at 400 and 700
|
|
7
|
+
* for the code templates. The whole of either family would be most of a
|
|
8
|
+
* megabyte to install for cuts nothing asks for, and a weight that is not here
|
|
9
|
+
* is drawn in the nearest one that is, by resvg and by `selectFace` alike.
|
|
10
|
+
*
|
|
11
|
+
* Static cuts rather than the variable fonts, because resvg draws a variable
|
|
12
|
+
* font at its default instance and a single file would then be one weight.
|
|
13
|
+
*
|
|
14
|
+
* They are named from `import.meta.url` rather than resolved from the working
|
|
15
|
+
* directory, since the working directory belongs to the project being built
|
|
16
|
+
* and these live wherever the package was installed. Two levels up from
|
|
17
|
+
* `dist/platform/` is the package root.
|
|
18
|
+
*/
|
|
19
|
+
const files = [
|
|
20
|
+
["Outfit", "Outfit_400Regular.ttf"],
|
|
21
|
+
["Outfit", "Outfit_500Medium.ttf"],
|
|
22
|
+
["Outfit", "Outfit_600SemiBold.ttf"],
|
|
23
|
+
["Outfit", "Outfit_700Bold.ttf"],
|
|
24
|
+
["Outfit", "Outfit_800ExtraBold.ttf"],
|
|
25
|
+
["JetBrains Mono", "JetBrainsMono_400Regular.ttf"],
|
|
26
|
+
["JetBrains Mono", "JetBrainsMono_700Bold.ttf"],
|
|
27
|
+
];
|
|
28
|
+
/**
|
|
29
|
+
* The bundled fonts, in the order they are loaded.
|
|
30
|
+
*
|
|
31
|
+
* The family is declared as well as being in the file, which is a fact written
|
|
32
|
+
* down twice and worth the duplication for one reason: `fallbackFamily` reads
|
|
33
|
+
* declared families and nothing else, and it is what tells resvg which family
|
|
34
|
+
* to draw a stack in when the stack names nothing that was loaded. Without a
|
|
35
|
+
* declared family here, a project setting `fontFamily` to something it has not
|
|
36
|
+
* supplied would have its text measured against Outfit and drawn in whatever
|
|
37
|
+
* resvg falls back to on its own, which is how a layout comes out wrong on one
|
|
38
|
+
* machine and right on another. Nothing else reads these: matching a
|
|
39
|
+
* `font-family` to a file is done from the file's own name table, by the
|
|
40
|
+
* rasteriser and by `measure/faces.ts` alike. `fonts.test.ts` checks the two
|
|
41
|
+
* against each other so they cannot drift.
|
|
42
|
+
*/
|
|
43
|
+
export function bundledFonts() {
|
|
44
|
+
return files.map(([family, file]) => ({
|
|
45
|
+
family,
|
|
46
|
+
path: fileURLToPath(new URL(`../../fonts/${file}`, import.meta.url)),
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=bundled-fonts.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundled-fonts.node.js","sourceRoot":"","sources":["../../src/platform/bundled-fonts.node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAIzC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,KAAK,GAAyD;IAClE,CAAC,QAAQ,EAAE,uBAAuB,CAAC;IACnC,CAAC,QAAQ,EAAE,sBAAsB,CAAC;IAClC,CAAC,QAAQ,EAAE,wBAAwB,CAAC;IACpC,CAAC,QAAQ,EAAE,oBAAoB,CAAC;IAChC,CAAC,QAAQ,EAAE,yBAAyB,CAAC;IACrC,CAAC,gBAAgB,EAAE,8BAA8B,CAAC;IAClD,CAAC,gBAAgB,EAAE,2BAA2B,CAAC;CAChD,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,YAAY;IAC1B,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;QACpC,MAAM;QACN,IAAI,EAAE,aAAa,CAAC,IAAI,GAAG,CAAC,eAAe,IAAI,EAAE,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;KACrE,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rasterise.d.ts","sourceRoot":"","sources":["../../src/render/rasterise.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rasterise.d.ts","sourceRoot":"","sources":["../../src/render/rasterise.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAkB,MAAM,aAAa,CAAC;AAuB9D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe,EAAE,UAO7B,CAAC"}
|
package/dist/render/rasterise.js
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { renderAsync } from "@resvg/resvg-js";
|
|
2
|
-
import { fallbackFamily, fontFilePaths } from "../fonts/index.js";
|
|
2
|
+
import { fallbackFamily, fontFilePaths, withBundledFonts, } from "../fonts/index.js";
|
|
3
3
|
/**
|
|
4
4
|
* Font options for resvg: the configured font files, and whether to fall back
|
|
5
5
|
* to the machine's own.
|
|
6
6
|
*/
|
|
7
7
|
async function fontOptions(config) {
|
|
8
|
-
|
|
8
|
+
// The bundled fonts count here too, so that a stack naming nothing loaded
|
|
9
|
+
// falls back to Outfit rather than to whatever resvg would have chosen. That
|
|
10
|
+
// is the family the measurer will have measured against, and the two have to
|
|
11
|
+
// agree or the layout is right on a machine that happens to have the font
|
|
12
|
+
// and wrong on one that does not.
|
|
13
|
+
const fallback = fallbackFamily(withBundledFonts(config.fonts));
|
|
9
14
|
return {
|
|
10
15
|
loadSystemFonts: config.systemFonts,
|
|
11
|
-
fontFiles: await fontFilePaths(config.fonts),
|
|
16
|
+
fontFiles: await fontFilePaths(withBundledFonts(config.fonts)),
|
|
12
17
|
...(fallback !== undefined && { defaultFontFamily: fallback }),
|
|
13
18
|
};
|
|
14
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rasterise.js","sourceRoot":"","sources":["../../src/render/rasterise.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,
|
|
1
|
+
{"version":3,"file":"rasterise.js","sourceRoot":"","sources":["../../src/render/rasterise.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EACL,cAAc,EACd,aAAa,EACb,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAG3B;;;GAGG;AACH,KAAK,UAAU,WAAW,CACxB,MAAsB;IAEtB,0EAA0E;IAC1E,6EAA6E;IAC7E,6EAA6E;IAC7E,0EAA0E;IAC1E,kCAAkC;IAClC,MAAM,QAAQ,GAAG,cAAc,CAAC,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAEhE,OAAO;QACL,eAAe,EAAE,MAAM,CAAC,WAAW;QACnC,SAAS,EAAE,MAAM,aAAa,CAAC,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC9D,GAAG,CAAC,QAAQ,KAAK,SAAS,IAAI,EAAE,iBAAiB,EAAE,QAAQ,EAAE,CAAC;KAC/D,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,eAAe,GAAe,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE;IAC3E,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,GAAG,EAAE;QACtC,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE;QACjD,IAAI,EAAE,MAAM,WAAW,CAAC,MAAM,CAAC;KAChC,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC,KAAK,EAAE,CAAC;AAC1B,CAAC,CAAC"}
|
|
@@ -23,7 +23,7 @@ export const articleTemplate = {
|
|
|
23
23
|
footer: said.length > 0,
|
|
24
24
|
});
|
|
25
25
|
const { pad } = frame;
|
|
26
|
-
const mark = logoRect(logo,
|
|
26
|
+
const mark = logoRect(logo, frame.full, pad, "start");
|
|
27
27
|
const chips = tagBand(props, config, dimensions, pad, markRoom(mark?.width, pad), measure);
|
|
28
28
|
const topMark = Math.max(chips.height, mark?.height ?? 0);
|
|
29
29
|
const area = contentArea(frame, markRoom(topMark, Math.round(height * 0.035)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/article/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,eAAe,GAAa;IACvC,IAAI,EAAE,SAAS;IACf,MAAM,CAAC,EACL,KAAK,EACL,MAAM,EACN,UAAU,EACV,OAAO,EACP,IAAI,EACJ,MAAM,GACU;QAChB,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;QACrC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;QACtC,MAAM,IAAI,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;QAChC,MAAM,KAAK,GAAG,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE;YACnD,MAAM,EAAE,IAAI,CAAC,MAAM,GAAG,CAAC;SACx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,GAAG,EACH,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,EAC1B,OAAO,CACR,CAAC;QAEF,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC,CAAC,CAAC;QAC1D,MAAM,IAAI,GAAG,WAAW,CACtB,KAAK,EACL,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,CAC9C,CAAC;QAEF,MAAM,IAAI,GAAG,SAAS,CACpB,YAAY,CAAC,KAAK,EAAE;YAClB,OAAO;YACP,UAAU;YACV,YAAY,EAAE,IAAI,CAAC,KAAK;YACxB,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC;YACnC,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC;YACxC,MAAM;SACP,CAAC,EACF,IAAI,EACJ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,CAAC,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,CAC1D,CAAC;QAEF,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAE1E,OAAO,KAAK,CAAC,GAAG,GAAG,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,IAAI,GAAG,MAAM,CAAC;IAC7D,CAAC;CACF,CAAC"}
|
|
@@ -2,6 +2,13 @@ import type { Badge } from "../../types.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* The corner badge: a rounded plate with the badge text on it, sized from the
|
|
4
4
|
* plate height so it scales with the image rather than the text length.
|
|
5
|
+
*
|
|
6
|
+
* `corner` is where the plate's top-left goes, which the template works out
|
|
7
|
+
* from its frame rather than from the image, so that a safe area brings the
|
|
8
|
+
* badge in along with everything else.
|
|
5
9
|
*/
|
|
6
|
-
export declare function renderBadge(badge: Badge, fontFamily: string, brand: string,
|
|
10
|
+
export declare function renderBadge(badge: Badge, fontFamily: string, brand: string, corner: {
|
|
11
|
+
readonly x: number;
|
|
12
|
+
readonly y: number;
|
|
13
|
+
}, height: number): string;
|
|
7
14
|
//# sourceMappingURL=badge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../../src/templates/banner/badge.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAE5C
|
|
1
|
+
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../../src/templates/banner/badge.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAE5C;;;;;;;GAOG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE;IAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EAClD,MAAM,EAAE,MAAM,GACb,MAAM,CAoBR"}
|
|
@@ -2,15 +2,19 @@ import { box, textElement } from "../../layout/index.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* The corner badge: a rounded plate with the badge text on it, sized from the
|
|
4
4
|
* plate height so it scales with the image rather than the text length.
|
|
5
|
+
*
|
|
6
|
+
* `corner` is where the plate's top-left goes, which the template works out
|
|
7
|
+
* from its frame rather than from the image, so that a safe area brings the
|
|
8
|
+
* badge in along with everything else.
|
|
5
9
|
*/
|
|
6
|
-
export function renderBadge(badge, fontFamily, brand,
|
|
10
|
+
export function renderBadge(badge, fontFamily, brand, corner, height) {
|
|
7
11
|
const fontSize = Math.round(height * 0.6);
|
|
8
12
|
const padX = Math.round(height * 0.36);
|
|
9
13
|
const width = Math.round(badge.text.length * fontSize * 0.64 + padX * 2);
|
|
10
|
-
const plate = box({ x:
|
|
14
|
+
const plate = box({ x: corner.x, y: corner.y, width, height }, { radius: Math.round(height * 0.1), fill: badge.background ?? "#ffffff" });
|
|
11
15
|
const text = textElement(badge.text, {
|
|
12
|
-
x:
|
|
13
|
-
y:
|
|
16
|
+
x: corner.x + padX,
|
|
17
|
+
y: corner.y + Math.round(height * 0.72),
|
|
14
18
|
fontFamily,
|
|
15
19
|
fontSize,
|
|
16
20
|
fontWeight: 900,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.js","sourceRoot":"","sources":["../../../src/templates/banner/badge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGzD
|
|
1
|
+
{"version":3,"file":"badge.js","sourceRoot":"","sources":["../../../src/templates/banner/badge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGzD;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CACzB,KAAY,EACZ,UAAkB,EAClB,KAAa,EACb,MAAkD,EAClD,MAAc;IAEd,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC;IAC1C,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACvC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,QAAQ,GAAG,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC;IAEzE,MAAM,KAAK,GAAG,GAAG,CACf,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAC3C,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,UAAU,IAAI,SAAS,EAAE,CAC1E,CAAC;IAEF,MAAM,IAAI,GAAG,WAAW,CAAC,KAAK,CAAC,IAAI,EAAE;QACnC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,IAAI;QAClB,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC;QACvC,UAAU;QACV,QAAQ;QACR,UAAU,EAAE,GAAG;QACf,IAAI,EAAE,KAAK,CAAC,KAAK,IAAI,KAAK;KAC3B,CAAC,CAAC;IAEH,OAAO,KAAK,GAAG,IAAI,CAAC;AACtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/banner/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAmB,MAAM,gBAAgB,CAAC;AAQhE;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/banner/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAmB,MAAM,gBAAgB,CAAC;AAQhE;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,EAAE,QA+D5B,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { drawLines
|
|
1
|
+
import { drawLines } from "../../layout/index.js";
|
|
2
2
|
import { optionalString } from "../../props.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { footerLine } from "../bottom.js";
|
|
4
|
+
import { contentArea, imageFrame, markRoom } from "../frame.js";
|
|
5
5
|
import { logoElement, logoRect } from "../logo.js";
|
|
6
6
|
import { badgeFor } from "./badge-props.js";
|
|
7
7
|
import { renderBadge } from "./badge.js";
|
|
@@ -18,27 +18,19 @@ import { bannerLines } from "./lines.js";
|
|
|
18
18
|
export const bannerTemplate = {
|
|
19
19
|
name: "banner",
|
|
20
20
|
render({ props, config, dimensions, measure, logo, avatar, }) {
|
|
21
|
-
const {
|
|
21
|
+
const { height } = dimensions;
|
|
22
22
|
const { fontFamily } = config;
|
|
23
|
-
const
|
|
24
|
-
const
|
|
23
|
+
const frame = imageFrame(dimensions, config, avatar);
|
|
24
|
+
const { pad, full } = frame;
|
|
25
25
|
const badgeHeight = Math.round(height * 0.072);
|
|
26
|
-
const mark = logoRect(logo,
|
|
26
|
+
const mark = logoRect(logo, full, pad, "start");
|
|
27
27
|
const badge = badgeFor(props, config);
|
|
28
28
|
const subtitle = optionalString(props.subtitle);
|
|
29
29
|
const hasSubtitle = subtitle !== undefined && subtitle !== "";
|
|
30
30
|
// The text sits between whatever the marks along the top and the footer
|
|
31
31
|
// along the bottom leave behind.
|
|
32
32
|
const topMark = Math.max(badge === undefined ? 0 : badgeHeight, mark?.height ?? 0);
|
|
33
|
-
const area =
|
|
34
|
-
top: pad + (topMark === 0 ? 0 : topMark + Math.round(height * 0.03)),
|
|
35
|
-
right: pad,
|
|
36
|
-
left: pad,
|
|
37
|
-
bottom: pad +
|
|
38
|
-
(hasFooter(config) || avatar !== undefined
|
|
39
|
-
? footerFs + Math.round(height * 0.02)
|
|
40
|
-
: 0),
|
|
41
|
-
});
|
|
33
|
+
const area = contentArea(frame, markRoom(topMark, Math.round(height * 0.03)));
|
|
42
34
|
const lines = bannerLines(props, {
|
|
43
35
|
height,
|
|
44
36
|
contentWidth: area.width,
|
|
@@ -55,15 +47,8 @@ export const bannerTemplate = {
|
|
|
55
47
|
});
|
|
56
48
|
const badgeMark = badge === undefined
|
|
57
49
|
? ""
|
|
58
|
-
: renderBadge(badge, fontFamily, config.colors.brand, pad, badgeHeight);
|
|
59
|
-
const footer =
|
|
60
|
-
x: pad,
|
|
61
|
-
y: footerBaseline(height, pad, footerFs),
|
|
62
|
-
fontSize: footerFs,
|
|
63
|
-
opacity: 0.78,
|
|
64
|
-
left: pad,
|
|
65
|
-
width: width - pad * 2,
|
|
66
|
-
}, avatar, measure);
|
|
50
|
+
: renderBadge(badge, fontFamily, config.colors.brand, { x: full.x + pad, y: full.y + pad }, badgeHeight);
|
|
51
|
+
const footer = footerLine(config, frame, avatar, measure, "start", 0.78);
|
|
67
52
|
return badgeMark + logoElement(logo, mark) + body + footer;
|
|
68
53
|
},
|
|
69
54
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/banner/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/banner/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,cAAc,GAAa;IACtC,IAAI,EAAE,QAAQ;IACd,MAAM,CAAC,EACL,KAAK,EACL,MAAM,EACN,UAAU,EACV,OAAO,EACP,IAAI,EACJ,MAAM,GACU;QAChB,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;QAC9B,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;QAC9B,MAAM,KAAK,GAAG,UAAU,CAAC,UAAU,E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AS,CAAC,KAAK,EAAE,IAAI,EAAE;YAClC,UAAU;YACV,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU;YAC9B,UAAU,EAAE,IAAI;SACjB,CAAC,CAAC;QAEH,MAAM,SAAS,GACb,KAAK,KAAK,SAAS;YACjB,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,WAAW,CACT,KAAK,EACL,UAAU,EACV,MAAM,CAAC,MAAM,CAAC,KAAK,EACnB,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,GAAG,EAAE,EACpC,WAAW,CACZ,CAAC;QAER,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;QAEzE,OAAO,SAAS,GAAG,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,IAAI,GAAG,MAAM,CAAC;IAC7D,CAAC;CACF,CAAC"}
|
|
@@ -10,7 +10,7 @@ import type { Frame } from "./frame.js";
|
|
|
10
10
|
* else, such as the `article` with its byline at the other end of the same
|
|
11
11
|
* line, still calls `attribution` itself.
|
|
12
12
|
*/
|
|
13
|
-
export declare function footerLine(config: ResolvedConfig, frame: Frame,
|
|
13
|
+
export declare function footerLine(config: ResolvedConfig, frame: Frame, avatar: ImageAsset | undefined, measure: MeasureText, align?: "start" | "middle", opacity?: number): string;
|
|
14
14
|
/**
|
|
15
15
|
* Draw a block of lines in a slot a `stack` handed back, or nothing where
|
|
16
16
|
* there was no slot to draw it in.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bottom.d.ts","sourceRoot":"","sources":["../../src/templates/bottom.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE3E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAKxC;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,cAAc,EACtB,KAAK,EAAE,KAAK,EACZ,
|
|
1
|
+
{"version":3,"file":"bottom.d.ts","sourceRoot":"","sources":["../../src/templates/bottom.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE3E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAKxC;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,cAAc,EACtB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,UAAU,GAAG,SAAS,EAC9B,OAAO,EAAE,WAAW,EACpB,KAAK,GAAE,OAAO,GAAG,QAAkB,EACnC,OAAO,GAAE,MAAuB,GAC/B,MAAM,CAkBR;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,SAAS,QAAQ,EAAE,EAC1B,IAAI,EAAE,IAAI,GAAG,SAAS,EACtB,KAAK,EAAE,UAAU,GAChB,MAAM,CAER"}
|
package/dist/templates/bottom.js
CHANGED
|
@@ -11,16 +11,16 @@ const defaultOpacity = 0.75;
|
|
|
11
11
|
* else, such as the `article` with its byline at the other end of the same
|
|
12
12
|
* line, still calls `attribution` itself.
|
|
13
13
|
*/
|
|
14
|
-
export function footerLine(config, frame,
|
|
15
|
-
const { pad } = frame;
|
|
14
|
+
export function footerLine(config, frame, avatar, measure, align = "start", opacity = defaultOpacity) {
|
|
15
|
+
const { pad, full } = frame;
|
|
16
16
|
return attribution(config, {
|
|
17
|
-
x: align === "middle" ? Math.round(
|
|
17
|
+
x: align === "middle" ? Math.round(full.x + full.width / 2) : full.x + pad,
|
|
18
18
|
y: frame.footerY,
|
|
19
19
|
fontSize: frame.footerFontSize,
|
|
20
20
|
opacity,
|
|
21
21
|
...(align === "middle" && { anchor: "middle" }),
|
|
22
|
-
left: pad,
|
|
23
|
-
width:
|
|
22
|
+
left: full.x + pad,
|
|
23
|
+
width: full.width - pad * 2,
|
|
24
24
|
}, avatar, measure);
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bottom.js","sourceRoot":"","sources":["../../src/templates/bottom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C,4DAA4D;AAC5D,MAAM,cAAc,GAAG,IAAI,CAAC;AAE5B;;;;;;;;GAQG;AACH,MAAM,UAAU,UAAU,CACxB,MAAsB,EACtB,KAAY,EACZ,
|
|
1
|
+
{"version":3,"file":"bottom.js","sourceRoot":"","sources":["../../src/templates/bottom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C,4DAA4D;AAC5D,MAAM,cAAc,GAAG,IAAI,CAAC;AAE5B;;;;;;;;GAQG;AACH,MAAM,UAAU,UAAU,CACxB,MAAsB,EACtB,KAAY,EACZ,MAA8B,EAC9B,OAAoB,EACpB,KAAK,GAAuB,OAAO,EACnC,OAAO,GAAW,cAAc;IAEhC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IAE5B,OAAO,WAAW,CAChB,MAAM,EACN;QACE,CAAC,EACC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,GAAG;QACzE,CAAC,EAAE,KAAK,CAAC,OAAO;QAChB,QAAQ,EAAE,KAAK,CAAC,cAAc;QAC9B,OAAO;QACP,GAAG,CAAC,KAAK,KAAK,QAAQ,IAAI,EAAE,MAAM,EAAE,QAAiB,EAAE,CAAC;QACxD,IAAI,EAAE,IAAI,CAAC,CAAC,GAAG,GAAG;QAClB,KAAK,EAAE,IAAI,CAAC,KAAK,GAAG,GAAG,GAAG,CAAC;KAC5B,EACD,MAAM,EACN,OAAO,CACR,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,QAAQ,CACtB,KAA0B,EAC1B,IAAsB,EACtB,KAAiB;IAEjB,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/card/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAmB,MAAM,gBAAgB,CAAC;AAMhE;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/card/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAmB,MAAM,gBAAgB,CAAC;AAMhE;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,EAAE,QAoC1B,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { drawLines
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { drawLines } from "../../layout/index.js";
|
|
2
|
+
import { footerLine } from "../bottom.js";
|
|
3
|
+
import { contentArea, imageFrame, markRoom } from "../frame.js";
|
|
4
4
|
import { logoElement, logoRect } from "../logo.js";
|
|
5
5
|
import { cardLines } from "./lines.js";
|
|
6
6
|
/**
|
|
@@ -13,19 +13,11 @@ import { cardLines } from "./lines.js";
|
|
|
13
13
|
export const cardTemplate = {
|
|
14
14
|
name: "card",
|
|
15
15
|
render({ props, config, dimensions, measure, logo, avatar, }) {
|
|
16
|
-
const {
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const mark = logoRect(logo,
|
|
20
|
-
const area =
|
|
21
|
-
top: pad + (mark === undefined ? 0 : mark.height + pad / 2),
|
|
22
|
-
right: pad,
|
|
23
|
-
left: pad,
|
|
24
|
-
bottom: pad +
|
|
25
|
-
(hasFooter(config) || avatar !== undefined
|
|
26
|
-
? footerFs + Math.round(height * 0.02)
|
|
27
|
-
: 0),
|
|
28
|
-
});
|
|
16
|
+
const { height } = dimensions;
|
|
17
|
+
const frame = imageFrame(dimensions, config, avatar, { padScale: 0.09 });
|
|
18
|
+
const { pad } = frame;
|
|
19
|
+
const mark = logoRect(logo, frame.full, pad, "middle");
|
|
20
|
+
const area = contentArea(frame, markRoom(mark?.height, pad / 2));
|
|
29
21
|
const lines = cardLines(props, {
|
|
30
22
|
measure,
|
|
31
23
|
fontFamily: config.fontFamily,
|
|
@@ -40,15 +32,7 @@ export const cardTemplate = {
|
|
|
40
32
|
lineHeight: 1.28,
|
|
41
33
|
anchor: "middle",
|
|
42
34
|
});
|
|
43
|
-
const footer =
|
|
44
|
-
x: Math.round(width / 2),
|
|
45
|
-
y: footerBaseline(height, pad, footerFs),
|
|
46
|
-
fontSize: footerFs,
|
|
47
|
-
opacity: 0.75,
|
|
48
|
-
anchor: "middle",
|
|
49
|
-
left: pad,
|
|
50
|
-
width: width - pad * 2,
|
|
51
|
-
}, avatar, measure);
|
|
35
|
+
const footer = footerLine(config, frame, avatar, measure, "middle");
|
|
52
36
|
return logoElement(logo, mark) + body + footer;
|
|
53
37
|
},
|
|
54
38
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/card/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/card/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,YAAY,GAAa;IACpC,IAAI,EAAE,MAAM;IACZ,MAAM,CAAC,EACL,KAAK,EACL,MAAM,EACN,UAAU,EACV,OAAO,EACP,IAAI,EACJ,MAAM,GACU;QAChB,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;QAC9B,MAAM,KAAK,GAAG,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QACzE,MAAM,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC;QACtB,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;QACvD,MAAM,IAAI,GAAG,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;QAEjE,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,EAAE;YAC7B,OAAO;YACP,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,YAAY,EAAE,IAAI,CAAC,KAAK;YACxB,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,M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