@kensio/colophon 2.13.1 → 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 +10 -0
- package/dist/config/defaults.d.ts +69 -2
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +61 -2
- 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/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/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.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/package.json +1 -1
|
@@ -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,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACrD,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;QAC5B,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,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EH,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/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AG,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE;YAClC,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU;YAC9B,UAAU,EAAE,IAAI;YAChB,MAAM,EAAE,QAAQ;SACjB,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;QAEpE,OAAO,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,IAAI,GAAG,MAAM,CAAC;IACjD,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Template } from "../../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* A profile cover: the mark beside the name, with a tagline under it.
|
|
4
|
+
*
|
|
5
|
+
* This is the header image at the top of a profile rather than a card attached
|
|
6
|
+
* to a post, so it is made once for a site and usually declared in
|
|
7
|
+
* `config.extra`. What makes it its own template rather than the `wordmark` at
|
|
8
|
+
* other proportions is the shape of the space: a cover is a strip somewhere
|
|
9
|
+
* between 2.6:1 and 6:1, and a layout that stacks a mark above a name has
|
|
10
|
+
* nothing left to set the name in.
|
|
11
|
+
*
|
|
12
|
+
* Every platform crops a cover and draws a circular avatar over one corner of
|
|
13
|
+
* it, so where the words may go is not the image. That is what `config.safeArea`
|
|
14
|
+
* describes and what the cover presets in `SIZE_PRESETS` carry, and by the time
|
|
15
|
+
* a template sees a frame it has already been applied. The one thing this
|
|
16
|
+
* template does about it is size its text from the room it actually has rather
|
|
17
|
+
* than from the image, which on a YouTube banner is the difference between 423
|
|
18
|
+
* pixels and 1440.
|
|
19
|
+
*/
|
|
20
|
+
export declare const coverTemplate: Template;
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/cover/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAmB,MAAM,gBAAgB,CAAC;AAoBhE;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,aAAa,EAAE,QA0C3B,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { safeRect } from "../../config/safe-area.js";
|
|
2
|
+
import { drawLines } from "../../layout/index.js";
|
|
3
|
+
import { footerLine } from "../bottom.js";
|
|
4
|
+
import { contentArea, imageFrame } from "../frame.js";
|
|
5
|
+
import { coverLines } from "./lines.js";
|
|
6
|
+
import { linesWidth, lockup, markElement, markSpace } from "./lockup.js";
|
|
7
|
+
/**
|
|
8
|
+
* The margin, as a fraction of the frame's height rather than its width.
|
|
9
|
+
*
|
|
10
|
+
* A cover is a strip between about 2.6:1 and 6:1, so a margin taken from the
|
|
11
|
+
* width is a margin measured against the one dimension that has room to spare.
|
|
12
|
+
* On a LinkedIn Page cover the usual 7.5% of the width is 208px above and
|
|
13
|
+
* below a band 504px tall. The safe area has already done the horizontal work,
|
|
14
|
+
* which is the other half of why this is the axis that matters here.
|
|
15
|
+
*/
|
|
16
|
+
const padScale = 0.09;
|
|
17
|
+
/** How the name and its tagline are stacked. */
|
|
18
|
+
const lineHeight = 1.15;
|
|
19
|
+
/**
|
|
20
|
+
* A profile cover: the mark beside the name, with a tagline under it.
|
|
21
|
+
*
|
|
22
|
+
* This is the header image at the top of a profile rather than a card attached
|
|
23
|
+
* to a post, so it is made once for a site and usually declared in
|
|
24
|
+
* `config.extra`. What makes it its own template rather than the `wordmark` at
|
|
25
|
+
* other proportions is the shape of the space: a cover is a strip somewhere
|
|
26
|
+
* between 2.6:1 and 6:1, and a layout that stacks a mark above a name has
|
|
27
|
+
* nothing left to set the name in.
|
|
28
|
+
*
|
|
29
|
+
* Every platform crops a cover and draws a circular avatar over one corner of
|
|
30
|
+
* it, so where the words may go is not the image. That is what `config.safeArea`
|
|
31
|
+
* describes and what the cover presets in `SIZE_PRESETS` carry, and by the time
|
|
32
|
+
* a template sees a frame it has already been applied. The one thing this
|
|
33
|
+
* template does about it is size its text from the room it actually has rather
|
|
34
|
+
* than from the image, which on a YouTube banner is the difference between 423
|
|
35
|
+
* pixels and 1440.
|
|
36
|
+
*/
|
|
37
|
+
export const coverTemplate = {
|
|
38
|
+
name: "cover",
|
|
39
|
+
render({ props, config, dimensions, measure, logo, avatar, }) {
|
|
40
|
+
const { fontFamily } = config;
|
|
41
|
+
const safe = safeRect(dimensions, config.safeArea);
|
|
42
|
+
const frame = imageFrame(dimensions, config, avatar, {
|
|
43
|
+
pad: Math.round(safe.height * padScale),
|
|
44
|
+
});
|
|
45
|
+
const area = contentArea(frame);
|
|
46
|
+
const mark = markSpace(logo, area.height);
|
|
47
|
+
const lines = coverLines(props, {
|
|
48
|
+
measure,
|
|
49
|
+
fontFamily,
|
|
50
|
+
contentWidth: area.width - mark.width - mark.gap,
|
|
51
|
+
contentHeight: area.height,
|
|
52
|
+
});
|
|
53
|
+
const placed = lockup(area, mark, linesWidth(lines, measure, fontFamily));
|
|
54
|
+
const body = drawLines(lines, placed.text, {
|
|
55
|
+
fontFamily,
|
|
56
|
+
fill: config.colors.foreground,
|
|
57
|
+
lineHeight,
|
|
58
|
+
anchor: "start",
|
|
59
|
+
});
|
|
60
|
+
return (markElement(logo, placed.mark) +
|
|
61
|
+
body +
|
|
62
|
+
// Centred, because the lockup above it is, and a footer set against the
|
|
63
|
+
// left margin of a strip has nothing above it to line up with.
|
|
64
|
+
footerLine(config, frame, avatar, measure, "middle"));
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/cover/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,OAAO,E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,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC;QAE1E,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE;YACzC,UAAU;YACV,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU;YAC9B,UAAU;YACV,MAAM,EAAE,OAAO;SAChB,CAAC,CAAC;QAEH,OAAO,CACL,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC;YAC9B,IAAI;YACJ,wEAAwE;YACxE,+DAA+D;YAC/D,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CACrD,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { TextLine } from "../../layout/index.js";
|
|
2
|
+
import type { MeasureText, MetaImageProps } from "../../types.js";
|
|
3
|
+
/** The space the cover's text has, and how to measure it into it. */
|
|
4
|
+
export interface CoverText {
|
|
5
|
+
readonly measure: MeasureText;
|
|
6
|
+
readonly fontFamily: string;
|
|
7
|
+
readonly contentWidth: number;
|
|
8
|
+
/**
|
|
9
|
+
* The height the text is sized against, which is the content area's rather
|
|
10
|
+
* than the image's.
|
|
11
|
+
*
|
|
12
|
+
* Every other template takes its sizes from the image, and on a cover that
|
|
13
|
+
* is the wrong number by a wide margin: a YouTube banner is 1440 tall and
|
|
14
|
+
* the band anyone reads is 423 of it, so a title at a tenth of the image
|
|
15
|
+
* would be a third of the height of the part that is seen.
|
|
16
|
+
*/
|
|
17
|
+
readonly contentHeight: number;
|
|
18
|
+
}
|
|
19
|
+
/** The name over its tagline, each fitted to the room the lockup has. */
|
|
20
|
+
export declare function coverLines(props: MetaImageProps, text: CoverText): TextLine[];
|
|
21
|
+
//# sourceMappingURL=lines.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lines.d.ts","sourceRoot":"","sources":["../../../src/templates/cover/lines.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AA+BlE,qEAAqE;AACrE,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B;;;;;;;;OAQG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AA4CD,yEAAyE;AACzE,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,SAAS,GAAG,QAAQ,EAAE,CAkB7E"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { blockLines, clampLine, measureIn } from "../../layout/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* One line for the name, for the reason the `wordmark` has one: a name broken
|
|
4
|
+
* across two lines stops reading as a name. On a strip it is also the only
|
|
5
|
+
* arrangement that fits, since a second line of a title set to fill the band
|
|
6
|
+
* would be a second band.
|
|
7
|
+
*/
|
|
8
|
+
const maxNameLines = 1;
|
|
9
|
+
const maxTaglineLines = 2;
|
|
10
|
+
/** The weights the two blocks are drawn at, and so measured at. */
|
|
11
|
+
const nameWeight = 800;
|
|
12
|
+
const taglineWeight = 500;
|
|
13
|
+
const nameFloor = 0.5;
|
|
14
|
+
const taglineFloor = 0.7;
|
|
15
|
+
/**
|
|
16
|
+
* The name's size, as a fraction of the room it has. It gives up a third of
|
|
17
|
+
* that where there is a tagline under it, which is what leaves the two
|
|
18
|
+
* reading as a pair rather than as one line with a caption squeezed beneath.
|
|
19
|
+
*/
|
|
20
|
+
const nameScale = 0.48;
|
|
21
|
+
const nameWithTaglineScale = 0.3;
|
|
22
|
+
/** The tagline's size, and the clear space above it, both of the same room. */
|
|
23
|
+
const taglineScale = 0.15;
|
|
24
|
+
const taglineGapScale = 0.09;
|
|
25
|
+
/**
|
|
26
|
+
* The name as one line: shrunk until it fits, and cut with an ellipsis where
|
|
27
|
+
* even the floor is not small enough.
|
|
28
|
+
*
|
|
29
|
+
* Wrapping is what the fitting does at that point, and on a strip there is no
|
|
30
|
+
* second line to wrap onto. This is `wordmark`'s treatment of the same string,
|
|
31
|
+
* and it is here rather than shared because the two differ in the fitting
|
|
32
|
+
* around it rather than in this.
|
|
33
|
+
*/
|
|
34
|
+
function nameLines(props, text, fontSize) {
|
|
35
|
+
const { measure, fontFamily, contentWidth } = text;
|
|
36
|
+
const name = props.title;
|
|
37
|
+
const [line] = blockLines(name, measure, fontFamily, {
|
|
38
|
+
maxWidth: contentWidth,
|
|
39
|
+
maxLines: maxNameLines,
|
|
40
|
+
fontSize,
|
|
41
|
+
floor: nameFloor,
|
|
42
|
+
fontWeight: nameWeight,
|
|
43
|
+
opacity: 1,
|
|
44
|
+
});
|
|
45
|
+
if (line === undefined || line.text === name) {
|
|
46
|
+
return line === undefined ? [] : [line];
|
|
47
|
+
}
|
|
48
|
+
return [
|
|
49
|
+
{
|
|
50
|
+
...line,
|
|
51
|
+
text: clampLine(line.text, contentWidth, measureIn(measure, fontFamily, nameWeight), line.fontSize),
|
|
52
|
+
},
|
|
53
|
+
];
|
|
54
|
+
}
|
|
55
|
+
/** The name over its tagline, each fitted to the room the lockup has. */
|
|
56
|
+
export function coverLines(props, text) {
|
|
57
|
+
const { measure, fontFamily, contentWidth, contentHeight } = text;
|
|
58
|
+
const tagline = blockLines(props.subtitle, measure, fontFamily, {
|
|
59
|
+
maxWidth: contentWidth,
|
|
60
|
+
maxLines: maxTaglineLines,
|
|
61
|
+
fontSize: Math.round(contentHeight * taglineScale),
|
|
62
|
+
floor: taglineFloor,
|
|
63
|
+
fontWeight: taglineWeight,
|
|
64
|
+
opacity: 0.85,
|
|
65
|
+
gapBefore: Math.round(contentHeight * taglineGapScale),
|
|
66
|
+
});
|
|
67
|
+
const scale = tagline.length === 0 ? nameScale : nameWithTaglineScale;
|
|
68
|
+
return [
|
|
69
|
+
...nameLines(props, text, Math.round(contentHeight * scale)),
|
|
70
|
+
...tagline,
|
|
71
|
+
];
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=lines.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lines.js","sourceRoot":"","sources":["../../../src/templates/cover/lines.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGzE;;;;;GAKG;AACH,MAAM,YAAY,GAAG,CAAC,CAAC;AAEvB,MAAM,eAAe,GAAG,CAAC,CAAC;AAE1B,mEAAmE;AACnE,MAAM,UAAU,GAAG,GAAG,CAAC;AACvB,MAAM,aAAa,GAAG,GAAG,CAAC;AAE1B,MAAM,SAAS,GAAG,GAAG,CAAC;AACtB,MAAM,YAAY,GAAG,GAAG,CAAC;AAEzB;;;;GAIG;AACH,MAAM,SAAS,GAAG,IAAI,CAAC;AACvB,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAEjC,+EAA+E;AAC/E,MAAM,YAAY,GAAG,IAAI,CAAC;AAC1B,MAAM,eAAe,GAAG,IAAI,CAAC;AAmB7B;;;;;;;;GAQG;AACH,SAAS,SAAS,CAChB,KAAqB,EACrB,IAAe,EACf,QAAgB;IAEhB,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;IACnD,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC;IACzB,MAAM,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE;QACnD,QAAQ,EAAE,YAAY;QACtB,QAAQ,EAAE,YAAY;QACtB,QAAQ;QACR,KAAK,EAAE,SAAS;QAChB,UAAU,EAAE,UAAU;QACtB,OAAO,EAAE,CAAC;KACX,CAAC,CAA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index.js";
|
|
2
|
+
import type { ImageAsset, MeasureText } from "../../types.js";
|
|
3
|
+
/** The widest of a block of lines, which is how wide the block is. */
|
|
4
|
+
export declare function linesWidth(lines: readonly TextLine[], measure: MeasureText, fontFamily: string): number;
|
|
5
|
+
/** The room the mark takes along the row, including the gap after it. */
|
|
6
|
+
export interface Mark {
|
|
7
|
+
readonly width: number;
|
|
8
|
+
readonly gap: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* How much of the row the mark claims, or nothing at all where the project has
|
|
12
|
+
* no logo, which is what takes the gap with it.
|
|
13
|
+
*
|
|
14
|
+
* The width and the gap come back together because the words need both before
|
|
15
|
+
* they can be fitted, and deriving either of them twice is how the room
|
|
16
|
+
* reserved stops matching the room used.
|
|
17
|
+
*/
|
|
18
|
+
export declare function markSpace(logo: ImageAsset | undefined, contentHeight: number): Mark;
|
|
19
|
+
/** Where the mark and the words go: side by side, centred in the area. */
|
|
20
|
+
export interface Lockup {
|
|
21
|
+
readonly mark: Rect | undefined;
|
|
22
|
+
readonly text: Rect;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Set the mark beside the words and centre the pair.
|
|
26
|
+
*
|
|
27
|
+
* A cover is a strip between about 2.6:1 and 6:1, so the mark goes next to the
|
|
28
|
+
* name rather than above it as the `wordmark` template has it: stacked, three
|
|
29
|
+
* elements in 400px of height leave nothing legible. The words are then set
|
|
30
|
+
* from the left of the slot they were given rather than centred within it, so
|
|
31
|
+
* that a wrapped name lines up under itself and the whole lockup still sits in
|
|
32
|
+
* the middle.
|
|
33
|
+
*
|
|
34
|
+
* A project with no logo takes the same path with a mark of no width, which is
|
|
35
|
+
* one arrangement rather than two: `row` centres a single item exactly as it
|
|
36
|
+
* centres a pair.
|
|
37
|
+
*/
|
|
38
|
+
export declare function lockup(area: Rect, mark: Mark, textWidth: number): Lockup;
|
|
39
|
+
/**
|
|
40
|
+
* The mark, centred down the slot it was given.
|
|
41
|
+
*
|
|
42
|
+
* Its height comes from the room the lockup has rather than from the slot,
|
|
43
|
+
* which is the whole content area tall: `row` gives every item the full height
|
|
44
|
+
* so that each can sit where it likes within it.
|
|
45
|
+
*/
|
|
46
|
+
export declare function markElement(logo: ImageAsset | undefined, slot: Rect | undefined): string;
|
|
47
|
+
//# sourceMappingURL=lockup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lockup.d.ts","sourceRoot":"","sources":["../../../src/templates/cover/lockup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAQ9D,sEAAsE;AACtE,wBAAgB,UAAU,CACxB,KAAK,EAAE,SAAS,QAAQ,EAAE,EAC1B,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,MAAM,GACjB,MAAM,CAaR;AAED,yEAAyE;AACzE,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,UAAU,GAAG,SAAS,EAC5B,aAAa,EAAE,MAAM,GACpB,IAAI,CASN;AAED,0EAA0E;AAC1E,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAUxE;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,UAAU,GAAG,SAAS,EAC5B,IAAI,EAAE,IAAI,GAAG,SAAS,GACrB,MAAM,CAiBR"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { image, row } from "../../layout/index.js";
|
|
2
|
+
/** The mark's height, as a fraction of the room the lockup has. */
|
|
3
|
+
const markScale = 0.72;
|
|
4
|
+
/** The clear space between the mark and the words, of the same room. */
|
|
5
|
+
const markGapScale = 0.24;
|
|
6
|
+
/** The widest of a block of lines, which is how wide the block is. */
|
|
7
|
+
export function linesWidth(lines, measure, fontFamily) {
|
|
8
|
+
return lines.reduce((widest, line) => Math.max(widest, measure(line.text, {
|
|
9
|
+
fontFamily,
|
|
10
|
+
fontSize: line.fontSize,
|
|
11
|
+
fontWeight: line.fontWeight,
|
|
12
|
+
})), 0);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* How much of the row the mark claims, or nothing at all where the project has
|
|
16
|
+
* no logo, which is what takes the gap with it.
|
|
17
|
+
*
|
|
18
|
+
* The width and the gap come back together because the words need both before
|
|
19
|
+
* they can be fitted, and deriving either of them twice is how the room
|
|
20
|
+
* reserved stops matching the room used.
|
|
21
|
+
*/
|
|
22
|
+
export function markSpace(logo, contentHeight) {
|
|
23
|
+
if (logo === undefined) {
|
|
24
|
+
return { width: 0, gap: 0 };
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
width: Math.round(Math.round(contentHeight * markScale) * logo.aspect),
|
|
28
|
+
gap: Math.round(contentHeight * markGapScale),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Set the mark beside the words and centre the pair.
|
|
33
|
+
*
|
|
34
|
+
* A cover is a strip between about 2.6:1 and 6:1, so the mark goes next to the
|
|
35
|
+
* name rather than above it as the `wordmark` template has it: stacked, three
|
|
36
|
+
* elements in 400px of height leave nothing legible. The words are then set
|
|
37
|
+
* from the left of the slot they were given rather than centred within it, so
|
|
38
|
+
* that a wrapped name lines up under itself and the whole lockup still sits in
|
|
39
|
+
* the middle.
|
|
40
|
+
*
|
|
41
|
+
* A project with no logo takes the same path with a mark of no width, which is
|
|
42
|
+
* one arrangement rather than two: `row` centres a single item exactly as it
|
|
43
|
+
* centres a pair.
|
|
44
|
+
*/
|
|
45
|
+
export function lockup(area, mark, textWidth) {
|
|
46
|
+
const [markSlot, textSlot] = row([{ size: mark.width }, { size: textWidth, gapBefore: mark.gap }], area);
|
|
47
|
+
return {
|
|
48
|
+
mark: mark.width === 0 ? undefined : markSlot,
|
|
49
|
+
text: textSlot ?? area,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The mark, centred down the slot it was given.
|
|
54
|
+
*
|
|
55
|
+
* Its height comes from the room the lockup has rather than from the slot,
|
|
56
|
+
* which is the whole content area tall: `row` gives every item the full height
|
|
57
|
+
* so that each can sit where it likes within it.
|
|
58
|
+
*/
|
|
59
|
+
export function markElement(logo, slot) {
|
|
60
|
+
if (logo === undefined || slot === undefined) {
|
|
61
|
+
return "";
|
|
62
|
+
}
|
|
63
|
+
const height = Math.round(slot.height * markScale);
|
|
64
|
+
return image({
|
|
65
|
+
x: slot.x,
|
|
66
|
+
y: Math.round(slot.y + (slot.height - height) / 2),
|
|
67
|
+
width: slot.width,
|
|
68
|
+
height,
|
|
69
|
+
}, logo.href, { fit: "contain" });
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=lockup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lockup.js","sourceRoot":"","sources":["../../../src/templates/cover/lockup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAGnD,mEAAmE;AACnE,MAAM,SAAS,GAAG,IAAI,CAAC;AAEvB,wEAAwE;AACxE,MAAM,YAAY,GAAG,IAAI,CAAC;AAE1B,sEAAsE;AACtE,MAAM,UAAU,UAAU,CACxB,KAA0B,EAC1B,OAAoB,EACpB,UAAkB;IAElB,OAAO,KAAK,CAAC,MAAM,CACjB,CAAC,MAAM,EA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I,KAAK,SAAS,EAAE,CAAC;QAC7C,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAEnD,OAAO,KAAK,CACV;QACE,CAAC,EAAE,IAAI,CAAC,CAAC;QACT,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAClD,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,MAAM;KACP,EACD,IAAI,CAAC,IAAI,EACT,EAAE,GAAG,EAAE,SAAS,EAAE,CACnB,CAAC;AACJ,CAAC"}
|
|
@@ -17,11 +17,11 @@ import { docsLines } from "./lines.js";
|
|
|
17
17
|
export const docsTemplate = {
|
|
18
18
|
name: "docs",
|
|
19
19
|
render({ props, config, dimensions, measure, logo, avatar, }) {
|
|
20
|
-
const {
|
|
20
|
+
const { height } = dimensions;
|
|
21
21
|
const { fontFamily, colors } = config;
|
|
22
22
|
const frame = imageFrame(dimensions, config, avatar);
|
|
23
23
|
const { pad } = frame;
|
|
24
|
-
const mark = logoRect(logo,
|
|
24
|
+
const mark = logoRect(logo, frame.full, pad, "start");
|
|
25
25
|
const chrome = docsChrome(props, config, dimensions, pad, markRoom(mark?.width, pad / 2), measure);
|
|
26
26
|
// The title starts below whichever of the trail and the logo reaches
|
|
27
27
|
// furthest down. Both are measured from the top of the image, so the room
|
|
@@ -41,7 +41,7 @@ export const docsTemplate = {
|
|
|
41
41
|
return (chrome.svg +
|
|
42
42
|
logoElement(logo, mark) +
|
|
43
43
|
body +
|
|
44
|
-
footerLine(config, frame,
|
|
44
|
+
footerLine(config, frame, avatar, measure));
|
|
45
45
|
},
|
|
46
46
|
};
|
|
47
47
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/docs/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,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC;;;;;;;;;GASG;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,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/docs/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,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC;;;;;;;;;GASG;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,EAAE,UAAU,EAAE,MAAM,E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WAAW,CAAC,IAAI,EAAE,IAAI,CAAC;YACvB,IAAI;YACJ,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAC3C,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -18,13 +18,13 @@ const lineHeight = 1.24;
|
|
|
18
18
|
export const eventTemplate = {
|
|
19
19
|
name: "event",
|
|
20
20
|
render({ props, config, dimensions, measure, logo, avatar, }) {
|
|
21
|
-
const {
|
|
21
|
+
const { height } = dimensions;
|
|
22
22
|
const { fontFamily, colors } = config;
|
|
23
23
|
const frame = imageFrame(dimensions, config, avatar, {
|
|
24
24
|
padScale: 0.09,
|
|
25
25
|
});
|
|
26
26
|
const { pad } = frame;
|
|
27
|
-
const mark = logoRect(logo,
|
|
27
|
+
const mark = logoRect(logo, frame.full, pad, "middle");
|
|
28
28
|
const area = contentArea(frame, markRoom(mark?.height, pad / 2));
|
|
29
29
|
const lines = eventLines(props, {
|
|
30
30
|
measure,
|
|
@@ -49,7 +49,7 @@ export const eventTemplate = {
|
|
|
49
49
|
lineHeight,
|
|
50
50
|
anchor: "middle",
|
|
51
51
|
});
|
|
52
|
-
const footer = footerLine(config, frame,
|
|
52
|
+
const footer = footerLine(config, frame, avatar, measure, "middle");
|
|
53
53
|
return (logoElement(logo, mark) +
|
|
54
54
|
datePlate(date, dateSlot, plateStyle(config), measure) +
|
|
55
55
|
body +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/event/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAE3E,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,Q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AEH,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;QAEpE,OAAO,CACL,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC;YACvB,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;YACtD,IAAI;YACJ,MAAM,CACP,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -5,6 +5,9 @@ import type { Dimensions, ResolvedConfig } from "../types.js";
|
|
|
5
5
|
* Every template asks for it here rather than working it out, which is what
|
|
6
6
|
* stops the twelve of them drifting apart. It is one number for the footer,
|
|
7
7
|
* the byline and the attribution alike, since they are all the same line.
|
|
8
|
+
*
|
|
9
|
+
* The dimensions are the frame's rather than the image's, so a size with a
|
|
10
|
+
* safe area gets a footer scaled to the part of the picture that is seen.
|
|
8
11
|
*/
|
|
9
12
|
export declare function footerFontSize(dimensions: Dimensions): number;
|
|
10
13
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"footer.d.ts","sourceRoot":"","sources":["../../src/templates/footer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"footer.d.ts","sourceRoot":"","sources":["../../src/templates/footer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AA+B9D;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAU7D;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;CAC9C;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,GACf,MAAM,CAER;AAED,yDAAyD;AACzD,wBAAgB,SAAS,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAEzD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,cAAc,EACtB,SAAS,EAAE,eAAe,GACzB,MAAM,CAeR"}
|
package/dist/templates/footer.js
CHANGED
|
@@ -13,15 +13,30 @@ const footerScale = 0.036;
|
|
|
13
13
|
* and keeps the proportions it had.
|
|
14
14
|
*/
|
|
15
15
|
const footerWidthFloor = 0.026;
|
|
16
|
+
/**
|
|
17
|
+
* The most it may be, as a fraction of the height, which is about a twelfth.
|
|
18
|
+
*
|
|
19
|
+
* The width floor assumes an image whose proportions are somewhere near a
|
|
20
|
+
* share card's, and a profile cover is not: a LinkedIn Page cover is 6:1, so
|
|
21
|
+
* the floor asks for 72px of footer in a band that has 250px for the title,
|
|
22
|
+
* and the site's URL comes out the same size as its name. The ceiling is what
|
|
23
|
+
* says the line along the bottom is a footer rather than a second heading. It
|
|
24
|
+
* is above every share preset, so nothing that was drawn before this existed
|
|
25
|
+
* is drawn differently.
|
|
26
|
+
*/
|
|
27
|
+
const footerHeightCeiling = 0.08;
|
|
16
28
|
/**
|
|
17
29
|
* The size the line along the bottom is drawn at.
|
|
18
30
|
*
|
|
19
31
|
* Every template asks for it here rather than working it out, which is what
|
|
20
32
|
* stops the twelve of them drifting apart. It is one number for the footer,
|
|
21
33
|
* the byline and the attribution alike, since they are all the same line.
|
|
34
|
+
*
|
|
35
|
+
* The dimensions are the frame's rather than the image's, so a size with a
|
|
36
|
+
* safe area gets a footer scaled to the part of the picture that is seen.
|
|
22
37
|
*/
|
|
23
38
|
export function footerFontSize(dimensions) {
|
|
24
|
-
return Math.round(Math.max(dimensions.height * footerScale, dimensions.width * footerWidthFloor));
|
|
39
|
+
return Math.round(Math.min(Math.max(dimensions.height * footerScale, dimensions.width * footerWidthFloor), dimensions.height * footerHeightCeiling));
|
|
25
40
|
}
|
|
26
41
|
/**
|
|
27
42
|
* The baseline of a footer sitting on the bottom margin.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"footer.js","sourceRoot":"","sources":["../../src/templates/footer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAG9D,8DAA8D;AAC9D,MAAM,WAAW,GAAG,KAAK,CAAC;AAE1B;;;;;;;;;;GAUG;AACH,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAE/B
|
|
1
|
+
{"version":3,"file":"footer.js","sourceRoot":"","sources":["../../src/templates/footer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAG9D,8DAA8D;AAC9D,MAAM,WAAW,GAAG,KAAK,CAAC;AAE1B;;;;;;;;;;GAUG;AACH,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAE/B;;;;;;;;;;GAUG;AACH,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAEjC;;;;;;;;;GASG;AACH,MAAM,UAAU,cAAc,CAAC,UAAsB;IACnD,OAAO,IAAI,CAAC,KAAK,CACf,IAAI,CAAC,GAAG,CACN,IAAI,CAAC,GAAG,CACN,UAAU,CAAC,MAAM,GAAG,WAAW,EAC/B,UAAU,CAAC,KAAK,GAAG,gBAAgB,CACpC,EACD,UAAU,CAAC,MAAM,GAAG,mBAAmB,CACxC,CACF,CAAC;AACJ,CAAC;AAeD;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,MAAc,EACd,GAAW,EACX,QAAgB;IAEhB,OAAO,WAAW,CAAC,M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