@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
|
@@ -13,7 +13,10 @@ export interface Frame {
|
|
|
13
13
|
/** The margin, applied to every edge. */
|
|
14
14
|
readonly pad: number;
|
|
15
15
|
readonly footerFontSize: number;
|
|
16
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* The rectangle the content is inset from: the whole image, or the part of
|
|
18
|
+
* it that survives being displayed where the config named a safe area.
|
|
19
|
+
*/
|
|
17
20
|
readonly full: Rect;
|
|
18
21
|
/**
|
|
19
22
|
* Vertical room to leave below the content, which is the footer line plus
|
|
@@ -25,8 +28,19 @@ export interface Frame {
|
|
|
25
28
|
}
|
|
26
29
|
/** What a template can tell the frame about itself. */
|
|
27
30
|
export interface FrameOptions {
|
|
28
|
-
/** The margin, as a fraction of the
|
|
31
|
+
/** The margin, as a fraction of the frame's width. */
|
|
29
32
|
readonly padScale?: number;
|
|
33
|
+
/**
|
|
34
|
+
* The margin outright, for a template whose frame is too wide for its height
|
|
35
|
+
* to take one from the width.
|
|
36
|
+
*
|
|
37
|
+
* A fraction of the width is the right unit for an image with the
|
|
38
|
+
* proportions of a card, and the wrong one for a strip: on a 6:1 cover the
|
|
39
|
+
* usual 7.5% of the width is a third of the height, spent on margins above
|
|
40
|
+
* and below the only band there is. Wins over `padScale` where both are
|
|
41
|
+
* given.
|
|
42
|
+
*/
|
|
43
|
+
readonly pad?: number;
|
|
30
44
|
/**
|
|
31
45
|
* Whether the template draws something of its own on the bottom line, such
|
|
32
46
|
* as a byline, so the room is left for it even where the config has no
|
|
@@ -38,6 +52,16 @@ export interface FrameOptions {
|
|
|
38
52
|
* Work out a template's frame. The avatar counts as a footer even where the
|
|
39
53
|
* config carries no text, since the picture is drawn on the same line and
|
|
40
54
|
* needs the same room.
|
|
55
|
+
*
|
|
56
|
+
* The safe area is worked out first and everything else is measured against
|
|
57
|
+
* it, rather than against the image. That matters most for the margin: a
|
|
58
|
+
* YouTube banner is 2560 across and the part of it anyone sees is 1546, so a
|
|
59
|
+
* margin taken from the image would spend a quarter of the visible width on
|
|
60
|
+
* clear space. It matters for the footer too, which would otherwise sit on the
|
|
61
|
+
* bottom edge of a picture that is cropped before it gets there.
|
|
62
|
+
*
|
|
63
|
+
* A config naming no safe area gets the whole image back, so every one of
|
|
64
|
+
* these is the arithmetic it always was.
|
|
41
65
|
*/
|
|
42
66
|
export declare function imageFrame(dimensions: Dimensions, config: ResolvedConfig, avatar: ImageAsset | undefined, options?: FrameOptions): Frame;
|
|
43
67
|
/**
|
|
@@ -49,7 +73,7 @@ export declare function imageFrame(dimensions: Dimensions, config: ResolvedConfi
|
|
|
49
73
|
*/
|
|
50
74
|
export declare function markRoom(height: number | undefined, gap: number): number;
|
|
51
75
|
/**
|
|
52
|
-
* The space a template's content has: the
|
|
76
|
+
* The space a template's content has: the frame, less the margins, less
|
|
53
77
|
* whatever sits along the top, less the footer line.
|
|
54
78
|
*
|
|
55
79
|
* `top` is what {@link markRoom} worked out, or whatever else the template put
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame.d.ts","sourceRoot":"","sources":["../../src/templates/frame.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"frame.d.ts","sourceRoot":"","sources":["../../src/templates/frame.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAQ1E;;;;;;;;GAQG;AACH,MAAM,WAAW,KAAK;IACpB,yCAAyC;IACzC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,qEAAqE;IACrE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,uDAAuD;AACvD,MAAM,WAAW,YAAY;IAC3B,sDAAsD;IACtD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;;;;;;OASG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,UAAU,CACxB,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,UAAU,GAAG,SAAS,EAC9B,OAAO,GAAE,YAAiB,GACzB,KAAK,CAgBP;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAExE;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,SAAI,GAAG,IAAI,CAOvD;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAE1D"}
|
package/dist/templates/frame.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { footerBaseline, footerFontSize, hasFooter } from "./footer.js";
|
|
2
|
+
import { safeRect } from "../config/safe-area.js";
|
|
2
3
|
import { inset } from "../layout/index.js";
|
|
3
4
|
/** Margin from the image edge, as a fraction of its width. */
|
|
4
5
|
const defaultPadScale = 0.075;
|
|
@@ -8,18 +9,29 @@ const footerGap = 0.02;
|
|
|
8
9
|
* Work out a template's frame. The avatar counts as a footer even where the
|
|
9
10
|
* config carries no text, since the picture is drawn on the same line and
|
|
10
11
|
* needs the same room.
|
|
12
|
+
*
|
|
13
|
+
* The safe area is worked out first and everything else is measured against
|
|
14
|
+
* it, rather than against the image. That matters most for the margin: a
|
|
15
|
+
* YouTube banner is 2560 across and the part of it anyone sees is 1546, so a
|
|
16
|
+
* margin taken from the image would spend a quarter of the visible width on
|
|
17
|
+
* clear space. It matters for the footer too, which would otherwise sit on the
|
|
18
|
+
* bottom edge of a picture that is cropped before it gets there.
|
|
19
|
+
*
|
|
20
|
+
* A config naming no safe area gets the whole image back, so every one of
|
|
21
|
+
* these is the arithmetic it always was.
|
|
11
22
|
*/
|
|
12
23
|
export function imageFrame(dimensions, config, avatar, options = {}) {
|
|
13
|
-
const
|
|
14
|
-
const pad =
|
|
15
|
-
|
|
24
|
+
const full = safeRect(dimensions, config.safeArea);
|
|
25
|
+
const pad = options.pad ??
|
|
26
|
+
Math.round(full.width * (options.padScale ?? defaultPadScale));
|
|
27
|
+
const fontSize = footerFontSize(full);
|
|
16
28
|
const isDrawn = options.footer === true || hasFooter(config) || avatar !== undefined;
|
|
17
29
|
return {
|
|
18
30
|
pad,
|
|
19
31
|
footerFontSize: fontSize,
|
|
20
|
-
full
|
|
21
|
-
footerRoom: isDrawn ? fontSize + Math.round(height * footerGap) : 0,
|
|
22
|
-
footerY: footerBaseline(height, pad, fontSize),
|
|
32
|
+
full,
|
|
33
|
+
footerRoom: isDrawn ? fontSize + Math.round(full.height * footerGap) : 0,
|
|
34
|
+
footerY: footerBaseline(full.y + full.height, pad, fontSize),
|
|
23
35
|
};
|
|
24
36
|
}
|
|
25
37
|
/**
|
|
@@ -33,7 +45,7 @@ export function markRoom(height, gap) {
|
|
|
33
45
|
return height === undefined || height === 0 ? 0 : height + gap;
|
|
34
46
|
}
|
|
35
47
|
/**
|
|
36
|
-
* The space a template's content has: the
|
|
48
|
+
* The space a template's content has: the frame, less the margins, less
|
|
37
49
|
* whatever sits along the top, less the footer line.
|
|
38
50
|
*
|
|
39
51
|
* `top` is what {@link markRoom} worked out, or whatever else the template put
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame.js","sourceRoot":"","sources":["../../src/templates/frame.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAI3C,8DAA8D;AAC9D,MAAM,eAAe,GAAG,KAAK,CAAC;AAE9B,gFAAgF;AAChF,MAAM,SAAS,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"frame.js","sourceRoot":"","sources":["../../src/templates/frame.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAI3C,8DAA8D;AAC9D,MAAM,eAAe,GAAG,KAAK,CAAC;AAE9B,gFAAgF;AAChF,MAAM,SAAS,GAAG,IAAI,CAAC;AAoDvB;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,UAAU,CACxB,UAAsB,EACtB,MAAsB,EACtB,MAA8B,EAC9B,OAAO,GAAiB,EAAE;IAE1B,MAAM,IAAI,GAAG,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;IACnD,MAAM,GAAG,GACP,OAAO,CAAC,GAAG;QACX,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,OAAO,CAAC,QAAQ,IAAI,eAAe,CAAC,CAAC,CAAC;IACjE,MAAM,QAAQ,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IACtC,MAAM,OAAO,GACX,OAAO,CAAC,MAAM,KAAK,IAAI,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,MAAM,KAAK,SAAS,CAAC;IAEvE,OAAO;QACL,GAAG;QACH,cAAc,EAAE,QAAQ;QACxB,IAAI;QACJ,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QACxE,OAAO,EAAE,cAAc,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,CAAC;KAC7D,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,MAA0B,EAAE,GAAW;IAC9D,OAAO,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,GAAG,CAAC;AACjE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,KAAY,EAAE,GAAG,GAAG,CAAC;IAC/C,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE;QACvB,GAAG,EAAE,KAAK,CAAC,GAAG,GAAG,GAAG;QACpB,KAAK,EAAE,KAAK,CAAC,GAAG;QAChB,IAAI,EAAE,KAAK,CAAC,GAAG;QACf,MAAM,EAAE,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC,UAAU;KACrC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY,EAAE,GAAW;IAChD,OAAO,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AAC9B,CAAC"}
|
|
@@ -8,6 +8,7 @@ export { articleTemplate } from "./article/index.js";
|
|
|
8
8
|
export { bannerTemplate } from "./banner/index.js";
|
|
9
9
|
export { cardTemplate } from "./card/index.js";
|
|
10
10
|
export { codeTemplate } from "./code/index.js";
|
|
11
|
+
export { coverTemplate } from "./cover/index.js";
|
|
11
12
|
export { docsTemplate } from "./docs/index.js";
|
|
12
13
|
export { eventTemplate } from "./event/index.js";
|
|
13
14
|
export { photoTemplate } from "./photo/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAgB5C;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAe/D,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/templates/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import { articleTemplate } from "./article/index.js";
|
|
|
2
2
|
import { bannerTemplate } from "./banner/index.js";
|
|
3
3
|
import { cardTemplate } from "./card/index.js";
|
|
4
4
|
import { codeTemplate } from "./code/index.js";
|
|
5
|
+
import { coverTemplate } from "./cover/index.js";
|
|
5
6
|
import { docsTemplate } from "./docs/index.js";
|
|
6
7
|
import { eventTemplate } from "./event/index.js";
|
|
7
8
|
import { photoTemplate } from "./photo/index.js";
|
|
@@ -20,6 +21,7 @@ export const builtinTemplates = {
|
|
|
20
21
|
[bannerTemplate.name]: bannerTemplate,
|
|
21
22
|
[cardTemplate.name]: cardTemplate,
|
|
22
23
|
[codeTemplate.name]: codeTemplate,
|
|
24
|
+
[coverTemplate.name]: coverTemplate,
|
|
23
25
|
[docsTemplate.name]: docsTemplate,
|
|
24
26
|
[eventTemplate.name]: eventTemplate,
|
|
25
27
|
[photoTemplate.name]: photoTemplate,
|
|
@@ -34,6 +36,7 @@ export { articleTemplate } from "./article/index.js";
|
|
|
34
36
|
export { bannerTemplate } from "./banner/index.js";
|
|
35
37
|
export { cardTemplate } from "./card/index.js";
|
|
36
38
|
export { codeTemplate } from "./code/index.js";
|
|
39
|
+
export { coverTemplate } from "./cover/index.js";
|
|
37
40
|
export { docsTemplate } from "./docs/index.js";
|
|
38
41
|
export { eventTemplate } from "./event/index.js";
|
|
39
42
|
export { photoTemplate } from "./photo/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAA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E,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/templates/logo.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Rect } from "../layout/index.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ImageAsset } from "../types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Where the logo goes, or nothing where there is none.
|
|
5
5
|
*
|
|
@@ -8,8 +8,12 @@ import type { Dimensions, ImageAsset } from "../types.js";
|
|
|
8
8
|
* follows from the proportions of the picture. A logo whose format does not
|
|
9
9
|
* state its size is drawn in a square, where a wordmark will sit small in the
|
|
10
10
|
* middle rather than being stretched to fit.
|
|
11
|
+
*
|
|
12
|
+
* `area` is the frame's, which is the whole image unless the config named a
|
|
13
|
+
* safe area. Taking it from the image instead would put the mark in a corner
|
|
14
|
+
* a profile cover crops off, and size it against a height nobody sees.
|
|
11
15
|
*/
|
|
12
|
-
export declare function logoRect(logo: ImageAsset | undefined,
|
|
16
|
+
export declare function logoRect(logo: ImageAsset | undefined, area: Rect, pad: number, align: "start" | "middle"): Rect | undefined;
|
|
13
17
|
/** The logo drawn in the rectangle it was given, whole rather than cropped. */
|
|
14
18
|
export declare function logoElement(logo: ImageAsset | undefined, rect: Rect | undefined): string;
|
|
15
19
|
//# sourceMappingURL=logo.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logo.d.ts","sourceRoot":"","sources":["../../src/templates/logo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,KAAK,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"logo.d.ts","sourceRoot":"","sources":["../../src/templates/logo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAK9C;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CACtB,IAAI,EAAE,UAAU,GAAG,SAAS,EAC5B,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,OAAO,GAAG,QAAQ,GACxB,IAAI,GAAG,SAAS,CAalB;AAED,+EAA+E;AAC/E,wBAAgB,WAAW,CACzB,IAAI,EAAE,UAAU,GAAG,SAAS,EAC5B,IAAI,EAAE,IAAI,GAAG,SAAS,GACrB,MAAM,CAIR"}
|
package/dist/templates/logo.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { image } from "../layout/index.js";
|
|
2
|
-
/** The logo's height, as a fraction of the
|
|
2
|
+
/** The logo's height, as a fraction of the frame's. */
|
|
3
3
|
const logoScale = 0.075;
|
|
4
4
|
/**
|
|
5
5
|
* Where the logo goes, or nothing where there is none.
|
|
@@ -9,17 +9,21 @@ const logoScale = 0.075;
|
|
|
9
9
|
* follows from the proportions of the picture. A logo whose format does not
|
|
10
10
|
* state its size is drawn in a square, where a wordmark will sit small in the
|
|
11
11
|
* middle rather than being stretched to fit.
|
|
12
|
+
*
|
|
13
|
+
* `area` is the frame's, which is the whole image unless the config named a
|
|
14
|
+
* safe area. Taking it from the image instead would put the mark in a corner
|
|
15
|
+
* a profile cover crops off, and size it against a height nobody sees.
|
|
12
16
|
*/
|
|
13
|
-
export function logoRect(logo,
|
|
17
|
+
export function logoRect(logo, area, pad, align) {
|
|
14
18
|
if (logo === undefined) {
|
|
15
19
|
return undefined;
|
|
16
20
|
}
|
|
17
|
-
const height = Math.round(
|
|
21
|
+
const height = Math.round(area.height * logoScale);
|
|
18
22
|
const width = Math.round(height * logo.aspect);
|
|
19
23
|
const x = align === "middle"
|
|
20
|
-
? Math.round((
|
|
21
|
-
:
|
|
22
|
-
return { x, y: pad, width, height };
|
|
24
|
+
? Math.round(area.x + (area.width - width) / 2)
|
|
25
|
+
: area.x + area.width - pad - width;
|
|
26
|
+
return { x, y: area.y + pad, width, height };
|
|
23
27
|
}
|
|
24
28
|
/** The logo drawn in the rectangle it was given, whole rather than cropped. */
|
|
25
29
|
export function logoElement(logo, rect) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logo.js","sourceRoot":"","sources":["../../src/templates/logo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAG3C,uDAAuD;AACvD,MAAM,SAAS,GAAG,KAAK,CAAC;AAExB
|
|
1
|
+
{"version":3,"file":"logo.js","sourceRoot":"","sources":["../../src/templates/logo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAG3C,uDAAuD;AACvD,MAAM,SAAS,GAAG,KAAK,CAAC;AAExB;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,QAAQ,CACtB,IAA4B,EAC5B,IAAU,EACV,GAAW,EACX,KAAyB;IAEzB,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACnD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;IAC/C,MAAM,CAAC,GACL,KAAK,KAAK,QAAQ;QAChB,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;QAC/C,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,GAAG,GAAG,GAAG,KAAK,CAAC;IAExC,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAC/C,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,WAAW,CACzB,IAA4B,EAC5B,IAAsB;IAEtB,OAAO,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS;QAC7C,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/photo/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAmB,MAAM,gBAAgB,CAAC;AAYhE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/photo/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAmB,MAAM,gBAAgB,CAAC;AAYhE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,aAAa,EAAE,QAiD3B,CAAC"}
|
|
@@ -28,11 +28,16 @@ export const photoTemplate = {
|
|
|
28
28
|
const { fontFamily, colors } = config;
|
|
29
29
|
const frame = imageFrame(dimensions, config, avatar);
|
|
30
30
|
const { pad } = frame;
|
|
31
|
-
const mark = logoRect(logo,
|
|
31
|
+
const mark = logoRect(logo, frame.full, pad, "start");
|
|
32
|
+
// Over the whole image rather than over the frame, so that a safe area
|
|
33
|
+
// moves the words and leaves the picture behind them full-bleed. The part
|
|
34
|
+
// a platform crops off is still seen on some of its clients, and a
|
|
35
|
+
// photograph stopping short of the edge would be the visible fault there.
|
|
36
|
+
const canvas = { x: 0, y: 0, width, height };
|
|
32
37
|
const backdrop = picture === undefined
|
|
33
38
|
? ""
|
|
34
|
-
: image(
|
|
35
|
-
scrim(
|
|
39
|
+
: image(canvas, picture.href, { fit: "cover" }) +
|
|
40
|
+
scrim(canvas, scrimId, { from: scrimFrom, to: scrimTo });
|
|
36
41
|
const area = contentArea(frame, markRoom(mark?.height, pad / 2));
|
|
37
42
|
// Set along the bottom, where the scrim is heaviest and where a picture
|
|
38
43
|
// usually has least going on.
|
|
@@ -44,7 +49,7 @@ export const photoTemplate = {
|
|
|
44
49
|
standfirstFs: Math.round(height * 0.042),
|
|
45
50
|
height,
|
|
46
51
|
}), area, { fontFamily, fill: colors.foreground, lineHeight: 1.24, align: "end" });
|
|
47
|
-
const footer = footerLine(config, frame,
|
|
52
|
+
const footer = footerLine(config, frame, avatar, measure, "start", 0.85);
|
|
48
53
|
return backdrop + logoElement(logo, mark) + body + footer;
|
|
49
54
|
},
|
|
50
55
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/photo/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEhE,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,O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AAM,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,KAAK,EAAE,KAAK,EAAE,CACxE,CAAC;QAEF,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;QAEzE,OAAO,QAAQ,GAAG,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,IAAI,GAAG,MAAM,CAAC;IAC5D,CAAC;CACF,CAAC"}
|
|
@@ -17,7 +17,7 @@ const lineHeight = 1.3;
|
|
|
17
17
|
export const quoteTemplate = {
|
|
18
18
|
name: "quote",
|
|
19
19
|
render({ props, config, dimensions, measure, avatar, }) {
|
|
20
|
-
const {
|
|
20
|
+
const { height } = dimensions;
|
|
21
21
|
const { fontFamily, colors } = config;
|
|
22
22
|
// The avatar goes on the attribution line rather than the footer, so as
|
|
23
23
|
// far as the frame is concerned there is none.
|
|
@@ -54,7 +54,7 @@ export const quoteTemplate = {
|
|
|
54
54
|
return (quoteMark(markSlot, markFs, fontFamily, colors.brandWarm) +
|
|
55
55
|
body +
|
|
56
56
|
speaker(said, saidSlot, saidFs, config, avatar, measure) +
|
|
57
|
-
footerLine(config, frame,
|
|
57
|
+
footerLine(config, frame, undefined, measure, "middle", 0.7));
|
|
58
58
|
},
|
|
59
59
|
};
|
|
60
60
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/quote/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,QAAQ,EAAE,UAAU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AAO,CACL,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,SAAS,CAAC;YACzD,IAAI;YACJ,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC;YACxD,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,CAAC,CAC7D,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -18,11 +18,11 @@ const lineHeight = 1.2;
|
|
|
18
18
|
export const releaseTemplate = {
|
|
19
19
|
name: "release",
|
|
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
|
const { pad } = frame;
|
|
25
|
-
const mark = logoRect(logo,
|
|
25
|
+
const mark = logoRect(logo, frame.full, pad, "start");
|
|
26
26
|
const area = contentArea(frame, markRoom(mark?.height, Math.round(height * 0.03)));
|
|
27
27
|
const lines = releaseLines(props, {
|
|
28
28
|
measure,
|
|
@@ -48,7 +48,7 @@ export const releaseTemplate = {
|
|
|
48
48
|
lineHeight,
|
|
49
49
|
});
|
|
50
50
|
const list = changeBlock(changes, listSlot, changeFs, config, measure);
|
|
51
|
-
const footer = footerLine(config, frame,
|
|
51
|
+
const footer = footerLine(config, frame, avatar, measure);
|
|
52
52
|
return logoElement(logo, mark) + head + list + footer;
|
|
53
53
|
},
|
|
54
54
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/release/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEvE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,c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E,IAAI,EAAE,UAAU;gBAChB,SAAS,EAAE,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;aAC3D;SACF,EACD,IAAI,CACL,CAAC;QAEF,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE;YACrC,UAAU;YACV,IAAI,EAAE,MAAM,CAAC,UAAU;YACvB,UAAU;SACX,CAAC,CAAC;QAEH,MAAM,IAAI,GAAG,WAAW,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAEvE,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAE1D,OAAO,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;IACxD,CAAC;CACF,CAAC"}
|
|
@@ -14,12 +14,12 @@ import { statLines } from "./lines.js";
|
|
|
14
14
|
export const statTemplate = {
|
|
15
15
|
name: "stat",
|
|
16
16
|
render({ props, config, dimensions, measure, logo, avatar, }) {
|
|
17
|
-
const {
|
|
17
|
+
const { height } = dimensions;
|
|
18
18
|
const frame = imageFrame(dimensions, config, avatar, {
|
|
19
19
|
padScale: 0.09,
|
|
20
20
|
});
|
|
21
21
|
const { pad } = frame;
|
|
22
|
-
const mark = logoRect(logo,
|
|
22
|
+
const mark = logoRect(logo, frame.full, pad, "middle");
|
|
23
23
|
const area = contentArea(frame, markRoom(mark?.height, pad / 2));
|
|
24
24
|
const lines = statLines(props, {
|
|
25
25
|
measure,
|
|
@@ -36,7 +36,7 @@ export const statTemplate = {
|
|
|
36
36
|
lineHeight: 1.15,
|
|
37
37
|
anchor: "middle",
|
|
38
38
|
});
|
|
39
|
-
const footer = footerLine(config, frame,
|
|
39
|
+
const footer = footerLine(config, frame, avatar, measure, "middle");
|
|
40
40
|
return logoElement(logo, mark) + body + footer;
|
|
41
41
|
},
|
|
42
42
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/stat/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;;;;;;;GAOG;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/stat/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;;;;;;;GAOG;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,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
|
32
32
|
render({ props, config, dimensions, measure, logo, avatar, }) {
|
|
33
|
-
const {
|
|
33
|
+
const { height } = dimensions;
|
|
34
34
|
const frame = imageFrame(dimensions, config, avatar, { padScale });
|
|
35
35
|
const { pad } = frame;
|
|
36
|
-
const mark = logoRect(logo,
|
|
36
|
+
const mark = logoRect(logo, frame.full, pad, "middle");
|
|
37
37
|
const area = contentArea(frame, markRoom(mark?.height, pad / 2));
|
|
38
38
|
const text = {
|
|
39
39
|
measure,
|
|
@@ -62,7 +62,7 @@ export const thumbnailTemplate = {
|
|
|
62
62
|
...style,
|
|
63
63
|
lineHeight: subtitleLineHeight,
|
|
64
64
|
}) +
|
|
65
|
-
footerLine(config, frame,
|
|
65
|
+
footerLine(config, frame, avatar, measure, "middle"));
|
|
66
66
|
},
|
|
67
67
|
};
|
|
68
68
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/thumbnail/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,eAAe,GAChB,MAAM,YAAY,CAAC;AAEpB;;;;GAIG;AACH,MAAM,QAAQ,GAAG,KAAK,CAAC;AAEvB;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAa;IACzC,IAAI,EAAE,WAAW;IACjB,MAAM,CAAC,EACL,KAAK,EACL,MAAM,EACN,UAAU,EACV,OAAO,EACP,IAAI,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
|
render({ props, config, dimensions, measure, logo, avatar, }) {
|
|
21
|
-
const {
|
|
21
|
+
const { height } = dimensions;
|
|
22
22
|
const frame = imageFrame(dimensions, config, avatar, {
|
|
23
23
|
padScale: 0.09,
|
|
24
24
|
});
|
|
@@ -47,7 +47,7 @@ export const wordmarkTemplate = {
|
|
|
47
47
|
});
|
|
48
48
|
return (markElement(logo, markSlot) +
|
|
49
49
|
body +
|
|
50
|
-
footerLine(config, frame,
|
|
50
|
+
footerLine(config, frame, avatar, measure, "middle"));
|
|
51
51
|
},
|
|
52
52
|
};
|
|
53
53
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/wordmark/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEpD,yDAAyD;AACzD,MAAM,UAAU,GAAG,GAAG,CAAC;AAEvB;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAa;IACxC,IAAI,EAAE,UAAU;IAChB,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/wordmark/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,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G,KAAK,CAAC,CAAC;aACtD;SACF,EACD,IAAI,CACL,CAAC;QAEF,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE;YACrC,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU;YAC9B,UAAU;YACV,MAAM,EAAE,QAAQ;SACjB,CAAC,CAAC;QAEH,OAAO,CACL,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC;YAC3B,IAAI;YACJ,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CACrD,CAAC;IACJ,CAAC;CACF,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -5,6 +5,33 @@ export interface Dimensions {
|
|
|
5
5
|
readonly width: number;
|
|
6
6
|
readonly height: number;
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* The part of an image that survives being displayed: what is left after the
|
|
10
|
+
* platform has cropped it and drawn its own furniture over it.
|
|
11
|
+
*
|
|
12
|
+
* Each edge is an inset from that edge, as a fraction of the image's width for
|
|
13
|
+
* `left` and `right` and of its height for `top` and `bottom`. An edge that is
|
|
14
|
+
* not named is not inset, so an empty object is the whole image, which is what
|
|
15
|
+
* a config that says nothing gets.
|
|
16
|
+
*
|
|
17
|
+
* Fractions rather than pixels because the same crop applies at whatever size
|
|
18
|
+
* a platform is served: YouTube publishes its safe area as 1546x423 on a
|
|
19
|
+
* 2560x1440 upload and as 1235x338 on the 2048x1152 minimum, which are the
|
|
20
|
+
* same two fractions.
|
|
21
|
+
*
|
|
22
|
+
* A profile cover is what this exists for, since every platform overlays a
|
|
23
|
+
* circular avatar on one corner of it and crops the rest differently on each
|
|
24
|
+
* of its own clients. `SIZE_PRESETS` carries one per platform. It applies to
|
|
25
|
+
* every template rather than to any one of them, so an image rendered at a
|
|
26
|
+
* cover size keeps its margins, its footer and its logo inside the part that
|
|
27
|
+
* will be seen.
|
|
28
|
+
*/
|
|
29
|
+
export interface SafeArea {
|
|
30
|
+
readonly top?: number;
|
|
31
|
+
readonly right?: number;
|
|
32
|
+
readonly bottom?: number;
|
|
33
|
+
readonly left?: number;
|
|
34
|
+
}
|
|
8
35
|
/**
|
|
9
36
|
* A named output size. The `name` identifies the size in output filenames
|
|
10
37
|
* (e.g. `og`, `square`) and must be unique within a config, so every
|
|
@@ -901,6 +928,16 @@ export interface ColophonConfig {
|
|
|
901
928
|
* {@link SizeOverrides.textureScale}.
|
|
902
929
|
*/
|
|
903
930
|
readonly textureScale?: number;
|
|
931
|
+
/**
|
|
932
|
+
* The part of the image a template may draw in: see {@link SafeArea}.
|
|
933
|
+
* Defaults to all of it.
|
|
934
|
+
*
|
|
935
|
+
* Like `textureScale`, this usually belongs on a size rather than on a whole
|
|
936
|
+
* build, because what it describes is where the image ends up rather than
|
|
937
|
+
* anything about the picture. The cover presets in `SIZE_PRESETS` carry one
|
|
938
|
+
* each. See {@link SizeOverrides.safeArea}.
|
|
939
|
+
*/
|
|
940
|
+
readonly safeArea?: SafeArea;
|
|
904
941
|
/**
|
|
905
942
|
* Fonts to load into the rasteriser, so the output does not depend on what
|
|
906
943
|
* the build machine happens to have installed. Supplying any font turns
|
|
@@ -1119,6 +1156,16 @@ export interface SizeOverrides {
|
|
|
1119
1156
|
* for that reason, and naming it on a size of your own overrides that.
|
|
1120
1157
|
*/
|
|
1121
1158
|
readonly textureScale?: number;
|
|
1159
|
+
/**
|
|
1160
|
+
* Replaces the config's safe area, which is where it usually belongs: a
|
|
1161
|
+
* crop is a property of the platform an image is uploaded to, and that is
|
|
1162
|
+
* what a size names. Every cover preset in `SIZE_PRESETS` carries one.
|
|
1163
|
+
*
|
|
1164
|
+
* It replaces rather than merges, for the reason `background` does. A safe
|
|
1165
|
+
* area describes one platform's crop as a whole, so half of X's over half of
|
|
1166
|
+
* YouTube's is not a safe area for anywhere.
|
|
1167
|
+
*/
|
|
1168
|
+
readonly safeArea?: SafeArea;
|
|
1122
1169
|
readonly fontFamily?: string;
|
|
1123
1170
|
readonly footer?: string;
|
|
1124
1171
|
readonly badge?: Badge;
|
|
@@ -1167,6 +1214,8 @@ export interface ResolvedConfig {
|
|
|
1167
1214
|
readonly texture: Texture | undefined;
|
|
1168
1215
|
/** How much larger than its stated lengths the texture is drawn. */
|
|
1169
1216
|
readonly textureScale: number;
|
|
1217
|
+
/** The part of the image a template may draw in, with every edge filled in. */
|
|
1218
|
+
readonly safeArea: Required<SafeArea>;
|
|
1170
1219
|
/** Configured fonts, with every `path` made absolute. */
|
|
1171
1220
|
readonly fonts: readonly FontSource[];
|
|
1172
1221
|
readonly systemFonts: boolean;
|