@kensio/colophon 2.11.1 → 2.13.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 +4 -1
- package/dist/astro/index.d.ts.map +1 -1
- package/dist/astro/index.js +0 -1
- package/dist/astro/index.js.map +1 -1
- package/dist/config/defaults.d.ts +24 -0
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +29 -0
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +2 -1
- package/dist/config/index.js.map +1 -1
- package/dist/config/size.d.ts.map +1 -1
- package/dist/config/size.js +3 -0
- package/dist/config/size.js.map +1 -1
- package/dist/layout/fill.d.ts +32 -0
- package/dist/layout/fill.d.ts.map +1 -0
- package/dist/layout/fill.js +34 -0
- package/dist/layout/fill.js.map +1 -0
- package/dist/layout/index.d.ts +4 -2
- package/dist/layout/index.d.ts.map +1 -1
- package/dist/layout/index.js +2 -1
- package/dist/layout/index.js.map +1 -1
- package/dist/measure/faces.d.ts.map +1 -1
- package/dist/measure/faces.js.map +1 -1
- package/dist/render/svg.js +1 -1
- package/dist/render/svg.js.map +1 -1
- package/dist/templates/banner/index.js +2 -2
- package/dist/templates/banner/index.js.map +1 -1
- package/dist/templates/card/index.js +2 -2
- package/dist/templates/card/index.js.map +1 -1
- package/dist/templates/code/bar.d.ts +24 -0
- package/dist/templates/code/bar.d.ts.map +1 -0
- package/dist/templates/code/bar.js +31 -0
- package/dist/templates/code/bar.js.map +1 -0
- package/dist/templates/code/gutter.d.ts +30 -0
- package/dist/templates/code/gutter.d.ts.map +1 -0
- package/dist/templates/code/gutter.js +64 -0
- package/dist/templates/code/gutter.js.map +1 -0
- package/dist/templates/code/index.d.ts.map +1 -1
- package/dist/templates/code/index.js +34 -15
- package/dist/templates/code/index.js.map +1 -1
- package/dist/templates/code/layout.d.ts +6 -1
- package/dist/templates/code/layout.d.ts.map +1 -1
- package/dist/templates/code/layout.js +8 -3
- package/dist/templates/code/layout.js.map +1 -1
- package/dist/templates/code/mark/draw.d.ts +26 -0
- package/dist/templates/code/mark/draw.d.ts.map +1 -0
- package/dist/templates/code/mark/draw.js +41 -0
- package/dist/templates/code/mark/draw.js.map +1 -0
- package/dist/templates/code/mark/index.d.ts +16 -0
- package/dist/templates/code/mark/index.d.ts.map +1 -0
- package/dist/templates/code/mark/index.js +34 -0
- package/dist/templates/code/mark/index.js.map +1 -0
- package/dist/templates/code/mark/locate.d.ts +20 -0
- package/dist/templates/code/mark/locate.d.ts.map +1 -0
- package/dist/templates/code/mark/locate.js +56 -0
- package/dist/templates/code/mark/locate.js.map +1 -0
- package/dist/templates/code/mark/read.d.ts +30 -0
- package/dist/templates/code/mark/read.d.ts.map +1 -0
- package/dist/templates/code/mark/read.js +61 -0
- package/dist/templates/code/mark/read.js.map +1 -0
- package/dist/templates/code/plate.d.ts +7 -1
- package/dist/templates/code/plate.d.ts.map +1 -1
- package/dist/templates/code/plate.js +14 -4
- package/dist/templates/code/plate.js.map +1 -1
- package/dist/templates/footer.d.ts +9 -1
- package/dist/templates/footer.d.ts.map +1 -1
- package/dist/templates/footer.js +24 -0
- package/dist/templates/footer.js.map +1 -1
- package/dist/templates/frame.d.ts.map +1 -1
- package/dist/templates/frame.js +5 -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/terminal/index.js +4 -4
- package/dist/templates/terminal/index.js.map +1 -1
- package/dist/templates/thumbnail/index.d.ts +21 -0
- package/dist/templates/thumbnail/index.d.ts.map +1 -0
- package/dist/templates/thumbnail/index.js +68 -0
- package/dist/templates/thumbnail/index.js.map +1 -0
- package/dist/templates/thumbnail/lines.d.ts +38 -0
- package/dist/templates/thumbnail/lines.d.ts.map +1 -0
- package/dist/templates/thumbnail/lines.js +76 -0
- package/dist/templates/thumbnail/lines.js.map +1 -0
- package/dist/templates/window/dots.d.ts +11 -0
- package/dist/templates/window/dots.d.ts.map +1 -0
- package/dist/templates/window/dots.js +32 -0
- package/dist/templates/window/dots.js.map +1 -0
- package/dist/templates/{terminal/window.d.ts → window/index.d.ts} +4 -2
- package/dist/templates/window/index.d.ts.map +1 -0
- package/dist/templates/window/index.js +48 -0
- package/dist/templates/window/index.js.map +1 -0
- package/dist/templates/window/title.d.ts +9 -0
- package/dist/templates/window/title.d.ts.map +1 -0
- package/dist/templates/window/title.js +24 -0
- package/dist/templates/window/title.js.map +1 -0
- package/dist/text/fill.d.ts +34 -0
- package/dist/text/fill.d.ts.map +1 -0
- package/dist/text/fill.js +57 -0
- package/dist/text/fill.js.map +1 -0
- package/dist/text/fit.d.ts.map +1 -1
- package/dist/text/fit.js +2 -6
- package/dist/text/fit.js.map +1 -1
- package/dist/text/index.d.ts +2 -0
- package/dist/text/index.d.ts.map +1 -1
- package/dist/text/index.js +1 -0
- package/dist/text/index.js.map +1 -1
- package/dist/text/step.d.ts +13 -0
- package/dist/text/step.d.ts.map +1 -0
- package/dist/text/step.js +17 -0
- package/dist/text/step.js.map +1 -0
- package/dist/text/unbroken.d.ts +22 -0
- package/dist/text/unbroken.d.ts.map +1 -0
- package/dist/text/unbroken.js +29 -0
- package/dist/text/unbroken.js.map +1 -0
- package/dist/texture/chevrons.d.ts +13 -0
- package/dist/texture/chevrons.d.ts.map +1 -0
- package/dist/texture/chevrons.js +22 -0
- package/dist/texture/chevrons.js.map +1 -0
- package/dist/texture/grid.d.ts +14 -0
- package/dist/texture/grid.d.ts.map +1 -0
- package/dist/texture/grid.js +38 -0
- package/dist/texture/grid.js.map +1 -0
- package/dist/texture/halftone.d.ts +14 -0
- package/dist/texture/halftone.d.ts.map +1 -0
- package/dist/texture/halftone.js +55 -0
- package/dist/texture/halftone.js.map +1 -0
- package/dist/texture/honeycomb.d.ts +14 -0
- package/dist/texture/honeycomb.d.ts.map +1 -0
- package/dist/texture/honeycomb.js +43 -0
- package/dist/texture/honeycomb.js.map +1 -0
- package/dist/texture/index.d.ts +15 -4
- package/dist/texture/index.d.ts.map +1 -1
- package/dist/texture/index.js +64 -14
- package/dist/texture/index.js.map +1 -1
- package/dist/texture/moire.d.ts +18 -0
- package/dist/texture/moire.d.ts.map +1 -0
- package/dist/texture/moire.js +44 -0
- package/dist/texture/moire.js.map +1 -0
- package/dist/texture/pattern.d.ts +10 -0
- package/dist/texture/pattern.d.ts.map +1 -1
- package/dist/texture/pattern.js +36 -13
- package/dist/texture/pattern.js.map +1 -1
- package/dist/texture/rays.d.ts +13 -0
- package/dist/texture/rays.d.ts.map +1 -0
- package/dist/texture/rays.js +36 -0
- package/dist/texture/rays.js.map +1 -0
- package/dist/texture/resolve.d.ts +10 -0
- package/dist/texture/resolve.d.ts.map +1 -1
- package/dist/texture/resolve.js +15 -0
- package/dist/texture/resolve.js.map +1 -1
- package/dist/texture/scallops.d.ts +14 -0
- package/dist/texture/scallops.d.ts.map +1 -0
- package/dist/texture/scallops.js +29 -0
- package/dist/texture/scallops.js.map +1 -0
- package/dist/texture/tile.d.ts +14 -0
- package/dist/texture/tile.d.ts.map +1 -0
- package/dist/texture/tile.js +23 -0
- package/dist/texture/tile.js.map +1 -0
- package/dist/texture/topographic/contours.d.ts +13 -0
- package/dist/texture/topographic/contours.d.ts.map +1 -0
- package/dist/texture/topographic/contours.js +72 -0
- package/dist/texture/topographic/contours.js.map +1 -0
- package/dist/texture/topographic/field.d.ts +8 -0
- package/dist/texture/topographic/field.d.ts.map +1 -0
- package/dist/texture/topographic/field.js +29 -0
- package/dist/texture/topographic/field.js.map +1 -0
- package/dist/texture/topographic/index.d.ts +17 -0
- package/dist/texture/topographic/index.d.ts.map +1 -0
- package/dist/texture/topographic/index.js +48 -0
- package/dist/texture/topographic/index.js.map +1 -0
- package/dist/theme/presets.d.ts +13 -5
- package/dist/theme/presets.d.ts.map +1 -1
- package/dist/theme/presets.js +16 -5
- package/dist/theme/presets.js.map +1 -1
- package/dist/types.d.ts +259 -3
- 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 +37 -0
- package/dist/validate/keys.d.ts.map +1 -1
- package/dist/validate/keys.js +132 -2
- package/dist/validate/keys.js.map +1 -1
- package/dist/validate/texture.d.ts +4 -5
- package/dist/validate/texture.d.ts.map +1 -1
- package/dist/validate/texture.js +11 -20
- package/dist/validate/texture.js.map +1 -1
- package/dist/validate/values.d.ts +6 -0
- package/dist/validate/values.d.ts.map +1 -1
- package/dist/validate/values.js +16 -1
- package/dist/validate/values.js.map +1 -1
- package/package.json +3 -10
- package/dist/templates/terminal/window.d.ts.map +0 -1
- package/dist/templates/terminal/window.js +0 -84
- package/dist/templates/terminal/window.js.map +0 -1
package/README.md
CHANGED
|
@@ -196,7 +196,10 @@ gallery stays in sync.
|
|
|
196
196
|
<img src="docs/samples/docs-wide.png" alt="docs template, landscape" width="100%" /><br />
|
|
197
197
|
<sub><code>docs</code> · 1200×630 · breadcrumb, title and summary</sub>
|
|
198
198
|
</td>
|
|
199
|
-
<td
|
|
199
|
+
<td>
|
|
200
|
+
<img src="docs/samples/thumbnail-video.png" alt="thumbnail template, 16:9" width="100%" /><br />
|
|
201
|
+
<sub><code>thumbnail</code> · 1280×720 · title grown to fill the frame, texture scaled up</sub>
|
|
202
|
+
</td>
|
|
200
203
|
</tr>
|
|
201
204
|
</table>
|
|
202
205
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/astro/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/astro/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE;QAEd,QAAQ,CAAC,oBAAoB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;KACpD,CAAC;CACH;AAED,kEAAkE;AAClE,MAAM,MAAM,0BAA0B,GAAG,eAAe,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAC9B,OAAO,EAAE,0BAA0B,GAClC,gBAAgB,CASlB"}
|
package/dist/astro/index.js
CHANGED
package/dist/astro/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/astro/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/astro/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAuBhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAC9B,OAAmC;IAEnC,OAAO;QACL,IAAI,EAAE,kBAAkB;QACxB,KAAK,EAAE;YACL,oBAAoB,EAAE,KAAK,IAAmB,EAAE;gBAC9C,MAAM,QAAQ,CAAC,OAAO,CAAC,CAAC;YAC1B,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
import type { BrandColors, CodeStyle, OutputFormat, OutputSize } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* How much larger a texture is drawn on the `thumbnail` preset.
|
|
4
|
+
*
|
|
5
|
+
* A thumbnail is uploaded at 1280 wide and shown at somewhere between about
|
|
6
|
+
* 360 and 170, so a dot grid at its default 44px spacing arrives at the reader
|
|
7
|
+
* about 10px apart, which is not a texture any more but a slightly dirty
|
|
8
|
+
* background. Three is the factor for the largest of those, and it is the
|
|
9
|
+
* conservative choice: a treatment that is a little too coarse still reads as
|
|
10
|
+
* a treatment, where one that is too fine reads as nothing at all.
|
|
11
|
+
*/
|
|
12
|
+
export declare const DEFAULT_THUMBNAIL_TEXTURE_SCALE = 3;
|
|
13
|
+
/**
|
|
14
|
+
* The texture scale everything else is drawn at, which is to say, unchanged.
|
|
15
|
+
*/
|
|
16
|
+
export declare const DEFAULT_TEXTURE_SCALE = 1;
|
|
2
17
|
/**
|
|
3
18
|
* Named output-size presets covering the common social-image standards. Each
|
|
4
19
|
* `name` becomes the filename suffix (e.g. `my-post-og.png`).
|
|
@@ -8,6 +23,9 @@ import type { BrandColors, CodeStyle, OutputFormat, OutputSize } from "../types.
|
|
|
8
23
|
* - `square`: 1:1, X/Twitter `summary` card and a universal fallback.
|
|
9
24
|
* - `twitter`: 2:1, X/Twitter `summary_large_image` card.
|
|
10
25
|
* - `pinterest`: 2:3 tall pin.
|
|
26
|
+
* - `thumbnail`: 16:9, the size YouTube asks video thumbnails to be uploaded
|
|
27
|
+
* at. It is the one preset carrying an override of its own, for the reason
|
|
28
|
+
* {@link SizeOverrides.textureScale} gives.
|
|
11
29
|
*/
|
|
12
30
|
export declare const SIZE_PRESETS: {
|
|
13
31
|
readonly og: {
|
|
@@ -30,6 +48,12 @@ export declare const SIZE_PRESETS: {
|
|
|
30
48
|
readonly width: 1000;
|
|
31
49
|
readonly height: 1500;
|
|
32
50
|
};
|
|
51
|
+
readonly thumbnail: {
|
|
52
|
+
readonly name: "thumbnail";
|
|
53
|
+
readonly width: 1280;
|
|
54
|
+
readonly height: 720;
|
|
55
|
+
readonly textureScale: 3;
|
|
56
|
+
};
|
|
33
57
|
};
|
|
34
58
|
/**
|
|
35
59
|
* Default output sizes: the Open Graph landscape plus a square. Between them
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/config/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EACT,YAAY,EACZ,UAAU,EACX,MAAM,aAAa,CAAC;AAErB;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY;;iBACjB,IAAI,EAAE,IAAI;iBAAE,KAAK,EAAE,IAAI;iBAAE,MAAM,EAAE,GAAG;;;iBAChC,IAAI,EAAE,QAAQ;iBAAE,KAAK,EAAE,IAAI;iBAAE,MAAM,EAAE,IAAI;;;iBACxC,IAAI,EAAE,SAAS;iBAAE,KAAK,EAAE,IAAI;iBAAE,MAAM,EAAE,GAAG;;;iBACvC,IAAI,EAAE,WAAW;iBAAE,KAAK,EAAE,IAAI;iBAAE,MAAM,EAAE,IAAI;;
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/config/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EACT,YAAY,EACZ,UAAU,EACX,MAAM,aAAa,CAAC;AAErB;;;;;;;;;GASG;AACH,eAAO,MAAM,+BAA+B,IAAI,CAAC;AAEjD;;GAEG;AACH,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,YAAY;;iBACjB,IAAI,EAAE,IAAI;iBAAE,KAAK,EAAE,IAAI;iBAAE,MAAM,EAAE,GAAG;;;iBAChC,IAAI,EAAE,QAAQ;iBAAE,KAAK,EAAE,IAAI;iBAAE,MAAM,EAAE,IAAI;;;iBACxC,IAAI,EAAE,SAAS;iBAAE,KAAK,EAAE,IAAI;iBAAE,MAAM,EAAE,GAAG;;;iBACvC,IAAI,EAAE,WAAW;iBAAE,KAAK,EAAE,IAAI;iBAAE,MAAM,EAAE,IAAI;;;iBAEvD,IAAI,EAAE,WAAW;iBACjB,KAAK,EAAE,IAAI;iBACX,MAAM,EAAE,GAAG;iBACX,YAAY;;CAE+B,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,SAAS,UAAU,EAG9C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,iCAAiC,CAAC;AAElE;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,YAAoB,CAAC;AAElD;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC;;;;;GAKG;AACH,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC;;;;;GAKG;AACH,eAAO,MAAM,YAAY,KAAK,CAAC;AAE/B,wEAAwE;AACxE,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAKhD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,8FACkD,CAAC;AAExF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,SAAS,CAalD,CAAC"}
|
package/dist/config/defaults.js
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How much larger a texture is drawn on the `thumbnail` preset.
|
|
3
|
+
*
|
|
4
|
+
* A thumbnail is uploaded at 1280 wide and shown at somewhere between about
|
|
5
|
+
* 360 and 170, so a dot grid at its default 44px spacing arrives at the reader
|
|
6
|
+
* about 10px apart, which is not a texture any more but a slightly dirty
|
|
7
|
+
* background. Three is the factor for the largest of those, and it is the
|
|
8
|
+
* conservative choice: a treatment that is a little too coarse still reads as
|
|
9
|
+
* a treatment, where one that is too fine reads as nothing at all.
|
|
10
|
+
*/
|
|
11
|
+
export const DEFAULT_THUMBNAIL_TEXTURE_SCALE = 3;
|
|
12
|
+
/**
|
|
13
|
+
* The texture scale everything else is drawn at, which is to say, unchanged.
|
|
14
|
+
*/
|
|
15
|
+
export const DEFAULT_TEXTURE_SCALE = 1;
|
|
1
16
|
/**
|
|
2
17
|
* Named output-size presets covering the common social-image standards. Each
|
|
3
18
|
* `name` becomes the filename suffix (e.g. `my-post-og.png`).
|
|
@@ -7,12 +22,21 @@
|
|
|
7
22
|
* - `square`: 1:1, X/Twitter `summary` card and a universal fallback.
|
|
8
23
|
* - `twitter`: 2:1, X/Twitter `summary_large_image` card.
|
|
9
24
|
* - `pinterest`: 2:3 tall pin.
|
|
25
|
+
* - `thumbnail`: 16:9, the size YouTube asks video thumbnails to be uploaded
|
|
26
|
+
* at. It is the one preset carrying an override of its own, for the reason
|
|
27
|
+
* {@link SizeOverrides.textureScale} gives.
|
|
10
28
|
*/
|
|
11
29
|
export const SIZE_PRESETS = {
|
|
12
30
|
og: { name: "og", width: 1200, height: 630 },
|
|
13
31
|
square: { name: "square", width: 1200, height: 1200 },
|
|
14
32
|
twitter: { name: "twitter", width: 1200, height: 600 },
|
|
15
33
|
pinterest: { name: "pinterest", width: 1000, height: 1500 },
|
|
34
|
+
thumbnail: {
|
|
35
|
+
name: "thumbnail",
|
|
36
|
+
width: 1280,
|
|
37
|
+
height: 720,
|
|
38
|
+
textureScale: DEFAULT_THUMBNAIL_TEXTURE_SCALE,
|
|
39
|
+
},
|
|
16
40
|
};
|
|
17
41
|
/**
|
|
18
42
|
* Default output sizes: the Open Graph landscape plus a square. Between them
|
|
@@ -98,5 +122,10 @@ export const DEFAULT_CODE_STYLE = {
|
|
|
98
122
|
cornerScale: 0.025,
|
|
99
123
|
maxFontScale: 0.075,
|
|
100
124
|
minFontScale: 0.025,
|
|
125
|
+
lineNumbers: false,
|
|
126
|
+
chrome: "none",
|
|
127
|
+
panelOpacity: 1,
|
|
128
|
+
borderColor: "#ffffff",
|
|
129
|
+
borderOpacity: 0.12,
|
|
101
130
|
};
|
|
102
131
|
//# sourceMappingURL=defaults.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../src/config/defaults.ts"],"names":[],"mappings":"AAOA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE;IAC5C,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;IACrD,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE;IACtD,SAAS,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;
|
|
1
|
+
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../src/config/defaults.ts"],"names":[],"mappings":"AAOA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC;AAEjD;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAEvC;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE;IAC5C,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;IACrD,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE;IACtD,SAAS,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;IAC3D,SAAS,EAAE;QACT,IAAI,E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-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EAErB,cAAc,EACf,MAAM,aAAa,CAAC;AAcrB,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,cAAc,EACd,yBAAyB,EACzB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,aAAa,EACb,YAAY,GACb,MAAM,eAAe,CAAC;AAcvB;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc,CAAC;AACrE;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,qBAAqB,GAC7B,qBAAqB,CAAC;AAUzB;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,GAAE,cAAmB,GAAG,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EAErB,cAAc,EACf,MAAM,aAAa,CAAC;AAcrB,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,cAAc,EACd,yBAAyB,EACzB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,aAAa,EACb,YAAY,GACb,MAAM,eAAe,CAAC;AAcvB;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc,CAAC;AACrE;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,qBAAqB,GAC7B,qBAAqB,CAAC;AAUzB;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,GAAE,cAAmB,GAAG,cAAc,CAuCxE"}
|
package/dist/config/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { resolveOptionalImage } from "../image/index.js";
|
|
|
5
5
|
import { defaultRasteriser } from "../platform/rasteriser.node.js";
|
|
6
6
|
import { builtinTemplates } from "../templates/index.js";
|
|
7
7
|
import { applyTheme } from "../theme/index.js";
|
|
8
|
-
import { resolveTexture } from "../texture/index.js";
|
|
8
|
+
import { resolveTexture, resolveTextureScale } from "../texture/index.js";
|
|
9
9
|
import { validateConfig } from "../validate/index.js";
|
|
10
10
|
import { DEFAULT_FONT_FAMILY, DEFAULT_FORMAT } from "./defaults.js";
|
|
11
11
|
import { resolveMaxBytes, resolveQuality } from "./output.js";
|
|
@@ -49,6 +49,7 @@ export function resolveConfig(input = {}) {
|
|
|
49
49
|
colors,
|
|
50
50
|
background: resolveBackground(config.background) ?? defaultBackground(colors),
|
|
51
51
|
texture: resolveTexture(config.texture, colors),
|
|
52
|
+
textureScale: resolveTextureScale(config.textureScale),
|
|
52
53
|
fonts,
|
|
53
54
|
systemFonts: shouldLoadSystemFonts(config.systemFonts, fonts),
|
|
54
55
|
// A project that supplies one font should not have to name it twice.
|
package/dist/config/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,0DAA0D;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,0DAA0D;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,iB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K;KACjC,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"size.d.ts","sourceRoot":"","sources":["../../src/config/size.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,cAAc,EACd,UAAU,EACV,cAAc,EAEf,MAAM,aAAa,CAAC;AAyBrB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,cAAc,GAAG,SAAS,EAClC,IAAI,EAAE,UAAU,GACf,cAAc,
|
|
1
|
+
{"version":3,"file":"size.d.ts","sourceRoot":"","sources":["../../src/config/size.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,cAAc,EACd,UAAU,EACV,cAAc,EAEf,MAAM,aAAa,CAAC;AAyBrB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,cAAc,GAAG,SAAS,EAClC,IAAI,EAAE,UAAU,GACf,cAAc,CAoBhB"}
|
package/dist/config/size.js
CHANGED
|
@@ -48,6 +48,9 @@ export function resolveConfigForSize(config, size) {
|
|
|
48
48
|
colors: mergeColors(base.colors, size.theme ?? base.theme, size.colors),
|
|
49
49
|
}),
|
|
50
50
|
...(size.texture !== undefined && { texture: size.texture }),
|
|
51
|
+
...(size.textureScale !== undefined && {
|
|
52
|
+
textureScale: size.textureScale,
|
|
53
|
+
}),
|
|
51
54
|
...(size.code !== undefined && { code: { ...base.code, ...size.code } }),
|
|
52
55
|
...(size.background !== undefined && { background: size.background }),
|
|
53
56
|
...(size.fontFamily !== undefined && { fontFamily: size.fontFamily }),
|
package/dist/config/size.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"size.js","sourceRoot":"","sources":["../../src/config/size.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;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I,CAAC,OAAO,KAAK,SAAS,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;QAC5D,GAAG,CAAC,IAAI,CAAC,YAAY,KAAK,SAAS,IAAI;YACrC,YAAY,EAAE,IAAI,CAAC,YAAY;SAChC,CAAC;QACF,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;QACxE,GAAG,CAAC,IAAI,CAAC,UAAU,KAAK,SAAS,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC;QACrE,GAAG,CAAC,IAAI,CAAC,UAAU,KAAK,SAAS,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC;QACrE,GAAG,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;QACzD,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;QACtD,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;KACpD,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { MeasureText } from "../types.js";
|
|
2
|
+
import type { TextLine } from "./block.js";
|
|
3
|
+
/** One group of a template's text, and the box it has to fill. */
|
|
4
|
+
export interface FilledBlock {
|
|
5
|
+
readonly maxWidth: number;
|
|
6
|
+
readonly maxHeight: number;
|
|
7
|
+
/** The advance used both to fit the lines and to draw them, so they agree. */
|
|
8
|
+
readonly lineHeight: number;
|
|
9
|
+
/** The largest size to try, which short text ends up drawn at. */
|
|
10
|
+
readonly maxFontSize: number;
|
|
11
|
+
/** The size below which the text is cut rather than shrunk any further. */
|
|
12
|
+
readonly minFontSize: number;
|
|
13
|
+
readonly fontWeight: number;
|
|
14
|
+
readonly opacity: number;
|
|
15
|
+
/** Space inserted before the group's first line, to separate it from the last. */
|
|
16
|
+
readonly gapBefore?: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Fit one group of a template's text to a box, and return its lines.
|
|
20
|
+
*
|
|
21
|
+
* The sibling of `blockLines`, for the layouts where the text is the picture
|
|
22
|
+
* rather than a heading in it. Both take a prop that may not be there and give
|
|
23
|
+
* back nothing at all when it is missing; what differs is what decides the
|
|
24
|
+
* size. See {@link fillText} for which of the two a layout wants.
|
|
25
|
+
*
|
|
26
|
+
* `lineHeight` is here rather than left to `drawLines` because the fitting has
|
|
27
|
+
* to know it: how tall a block of lines is is what the search is measuring
|
|
28
|
+
* against. Pass the same value to both, or the block that was fitted is not
|
|
29
|
+
* the block that gets drawn.
|
|
30
|
+
*/
|
|
31
|
+
export declare function fillLines(value: unknown, measure: MeasureText, fontFamily: string, block: FilledBlock): TextLine[];
|
|
32
|
+
//# sourceMappingURL=fill.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fill.d.ts","sourceRoot":"","sources":["../../src/layout/fill.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAG3C,kEAAkE;AAClE,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,8EAA8E;IAC9E,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,kEAAkE;IAClE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,2EAA2E;IAC3E,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,kFAAkF;IAClF,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,WAAW,GACjB,QAAQ,EAAE,CAqBZ"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { optionalString } from "../props.js";
|
|
2
|
+
import { fillText } from "../text/index.js";
|
|
3
|
+
import { measureIn } from "./measure.js";
|
|
4
|
+
/**
|
|
5
|
+
* Fit one group of a template's text to a box, and return its lines.
|
|
6
|
+
*
|
|
7
|
+
* The sibling of `blockLines`, for the layouts where the text is the picture
|
|
8
|
+
* rather than a heading in it. Both take a prop that may not be there and give
|
|
9
|
+
* back nothing at all when it is missing; what differs is what decides the
|
|
10
|
+
* size. See {@link fillText} for which of the two a layout wants.
|
|
11
|
+
*
|
|
12
|
+
* `lineHeight` is here rather than left to `drawLines` because the fitting has
|
|
13
|
+
* to know it: how tall a block of lines is is what the search is measuring
|
|
14
|
+
* against. Pass the same value to both, or the block that was fitted is not
|
|
15
|
+
* the block that gets drawn.
|
|
16
|
+
*/
|
|
17
|
+
export function fillLines(value, measure, fontFamily, block) {
|
|
18
|
+
const fitted = fillText(optionalString(value) ?? "", measureIn(measure, fontFamily, block.fontWeight), {
|
|
19
|
+
maxWidth: block.maxWidth,
|
|
20
|
+
maxHeight: block.maxHeight,
|
|
21
|
+
lineHeight: block.lineHeight,
|
|
22
|
+
maxFontSize: block.maxFontSize,
|
|
23
|
+
minFontSize: block.minFontSize,
|
|
24
|
+
});
|
|
25
|
+
return fitted.lines.map((text, index) => ({
|
|
26
|
+
text,
|
|
27
|
+
fontSize: fitted.fontSize,
|
|
28
|
+
fontWeight: block.fontWeight,
|
|
29
|
+
opacity: block.opacity,
|
|
30
|
+
...(index === 0 &&
|
|
31
|
+
block.gapBefore !== undefined && { gapBefore: block.gapBefore }),
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=fill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fill.js","sourceRoot":"","sources":["../../src/layout/fill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAkBzC;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,SAAS,CACvB,KAAc,EACd,OAAoB,EACpB,UAAkB,EAClB,KAAkB;IAElB,MAAM,MAAM,GAAe,QAAQ,CACjC,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,EAC3B,SAAS,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,EAChD;QACE,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,WAAW,EAAE,KAAK,CAAC,WAAW;KAC/B,CACF,CAAC;IAEF,OAAO,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QACxC,IAAI;QACJ,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,GAAG,CAAC,KAAK,KAAK,CAAC;YACb,KAAK,CAAC,SAAS,KAAK,SAAS,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;KACnE,CAAC,CAAC,CAAC;AACN,CAAC"}
|
package/dist/layout/index.d.ts
CHANGED
|
@@ -30,6 +30,8 @@ export type { StackedRect } from "./stack.js";
|
|
|
30
30
|
export type { Align, BoxStyle, Extent, Placed, Rect, Span } from "./types.js";
|
|
31
31
|
export { blockLines } from "./block.js";
|
|
32
32
|
export type { StyledBlock, TextBlock, TextLine } from "./block.js";
|
|
33
|
+
export { fillLines } from "./fill.js";
|
|
34
|
+
export type { FilledBlock } from "./fill.js";
|
|
33
35
|
export { lineExtents, linesHeight } from "./extent.js";
|
|
34
36
|
export { drawLines } from "./draw.js";
|
|
35
37
|
export type { LinesStyle } from "./draw.js";
|
|
@@ -37,7 +39,7 @@ export { baselineFor, placeLines } from "./lines.js";
|
|
|
37
39
|
export type { PlacedLine } from "./lines.js";
|
|
38
40
|
export { measureIn } from "./measure.js";
|
|
39
41
|
export { optionalString, stringList } from "../props.js";
|
|
40
|
-
export { clampLine, escapeXml, fitText, textElement, wrapText, } from "../text/index.js";
|
|
41
|
-
export type { FitOptions, FittedText, MeasureAt, MeasureLine, TextAttributes, } from "../text/index.js";
|
|
42
|
+
export { clampLine, escapeXml, fillText, fitText, textElement, wrapText, } from "../text/index.js";
|
|
43
|
+
export type { FillOptions, FitOptions, FittedText, MeasureAt, MeasureLine, TextAttributes, } from "../text/index.js";
|
|
42
44
|
export type { Dimensions, MeasureText, MetaImageProps, ResolvedConfig, Template, TemplateContext, TextStyle, } from "../types.js";
|
|
43
45
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,YAAY,EAAE,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AAW,CAAC;AACtC,YAAY,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACrD,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EACL,SAAS,EACT,SAAS,EACT,QAAQ,EACR,OAAO,EACP,WAAW,EACX,QAAQ,GACT,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,WAAW,EACX,UAAU,EACV,UAAU,EACV,SAAS,EACT,WAAW,EACX,cAAc,GACf,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,UAAU,EACV,WAAW,EACX,cAAc,EACd,cAAc,EACd,QAAQ,EACR,eAAe,EACf,SAAS,GACV,MAAM,aAAa,CAAC"}
|
package/dist/layout/index.js
CHANGED
|
@@ -23,10 +23,11 @@ export { row } from "./row.js";
|
|
|
23
23
|
export { scrim } from "./scrim.js";
|
|
24
24
|
export { stack } from "./stack.js";
|
|
25
25
|
export { blockLines } from "./block.js";
|
|
26
|
+
export { fillLines } from "./fill.js";
|
|
26
27
|
export { lineExtents, linesHeight } from "./extent.js";
|
|
27
28
|
export { drawLines } from "./draw.js";
|
|
28
29
|
export { baselineFor, placeLines } from "./lines.js";
|
|
29
30
|
export { measureIn } from "./measure.js";
|
|
30
31
|
export { optionalString, stringList } from "../props.js";
|
|
31
|
-
export { clampLine, escapeXml, fitText, textElement, wrapText, } from "../text/index.js";
|
|
32
|
+
export { clampLine, escapeXml, fillText, fitText, textElement, wrapText, } from "../text/index.js";
|
|
32
33
|
//# sourceMappingURL=index.js.map
|
package/dist/layout/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"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O,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAInC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAErD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EACL,SAAS,EACT,SAAS,EACT,QAAQ,EACR,OAAO,EACP,WAAW,EACX,QAAQ,GACT,MAAM,kBAAkB,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;AA0FD,+EAA+E;AAC/E,wBAAsB,SAAS,CAC7B,KAAK,EAAE,SAAS,UAAU,EAAE,EAC5B,SAAS,EAAE,cAAc,GACxB,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC,CAM1B"}
|
|
@@ -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;;;;;;GAMG;AACH,SAAS,MAAM,CAAC,IAAU;IACxB,MAAM,QAAQ,GAAG,
|
|
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;;;;;;GAMG;AACH,SAAS,MAAM,CAAC,IAAU;IACxB,MAAM,QAAQ,GAAG,IAIhB,CAAC;IAEF,OAAO;QACL,MAAM,EAAE,QAAQ,CAAC,UAAU,IAAI,EAAE;QACjC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,IAAI,GAAG;QAC9C,IAAI;KACL,CAAC;AACJ,CAAC;AAED,0EAA0E;AAC1E,SAAS,OAAO,CAAC,MAAyC;IACxD,OAAO,OAA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AI,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"}
|
package/dist/render/svg.js
CHANGED
|
@@ -25,7 +25,7 @@ export async function buildSvg(props, config, dimensions) {
|
|
|
25
25
|
// background some surface without ever coming between text and reader.
|
|
26
26
|
const texture = config.texture === undefined
|
|
27
27
|
? ""
|
|
28
|
-
: textureSvg(config.texture, dimensions, textureId);
|
|
28
|
+
: textureSvg(config.texture, dimensions, textureId, config.textureScale);
|
|
29
29
|
const body = await template.render({
|
|
30
30
|
props,
|
|
31
31
|
config,
|
package/dist/render/svg.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svg.js","sourceRoot":"","sources":["../../src/render/svg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD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alString } from "../../props.js";
|
|
3
3
|
import { attribution } from "../attribution.js";
|
|
4
|
-
import { footerBaseline, hasFooter } from "../footer.js";
|
|
4
|
+
import { footerBaseline, footerFontSize, hasFooter } from "../footer.js";
|
|
5
5
|
import { logoElement, logoRect } from "../logo.js";
|
|
6
6
|
import { badgeFor } from "./badge-props.js";
|
|
7
7
|
import { renderBadge } from "./badge.js";
|
|
@@ -21,7 +21,7 @@ export const bannerTemplate = {
|
|
|
21
21
|
const { width, height } = dimensions;
|
|
22
22
|
const { fontFamily } = config;
|
|
23
23
|
const pad = Math.round(width * 0.075);
|
|
24
|
-
const footerFs =
|
|
24
|
+
const footerFs = footerFontSize(dimensions);
|
|
25
25
|
const badgeHeight = Math.round(height * 0.072);
|
|
26
26
|
const mark = logoRect(logo, dimensions, pad, "start");
|
|
27
27
|
const badge = badgeFor(props, config);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/banner/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/banner/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAA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M,EACN;YACE,CAAC,EAAE,GAAG;YACN,CAAC,EAAE,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,CAAC;YACxC,QAAQ,EAAE,QAAQ;YAClB,OAAO,EAAE,IAAI;YACb,IAAI,EAAE,GAAG;YACT,KAAK,EAAE,KAAK,GAAG,GAAG,GAAG,CAAC;SACvB,EACD,MAAM,EACN,OAAO,CACR,CAAC;QAEF,OAAO,SAAS,GAAG,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,IAAI,GAAG,MAAM,CAAC;IAC7D,CAAC;CACF,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { drawLines, inset } from "../../layout/index.js";
|
|
2
2
|
import { attribution } from "../attribution.js";
|
|
3
|
-
import { footerBaseline, hasFooter } from "../footer.js";
|
|
3
|
+
import { footerBaseline, footerFontSize, hasFooter } from "../footer.js";
|
|
4
4
|
import { logoElement, logoRect } from "../logo.js";
|
|
5
5
|
import { cardLines } from "./lines.js";
|
|
6
6
|
/**
|
|
@@ -15,7 +15,7 @@ export const cardTemplate = {
|
|
|
15
15
|
render({ props, config, dimensions, measure, logo, avatar, }) {
|
|
16
16
|
const { width, height } = dimensions;
|
|
17
17
|
const pad = Math.round(width * 0.09);
|
|
18
|
-
const footerFs =
|
|
18
|
+
const footerFs = footerFontSize(dimensions);
|
|
19
19
|
const mark = logoRect(logo, dimensions, pad, "middle");
|
|
20
20
|
const area = inset({ x: 0, y: 0, width, height }, {
|
|
21
21
|
top: pad + (mark === undefined ? 0 : mark.height + pad / 2),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/card/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM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,SAAS;oBACxC,CAAC,CAAC,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC;oBACtC,CAAC,CAAC,CAAC,CAAC;SACT,CACF,CAAC;QAEF,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,MAAM,GAAG,GAAG,CAAC;YACjC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC;YACjC,MAAM;SACP,CAAC,CAAC;QAEH,MAAM,IAAI,GAAG,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,WAAW,CACxB,MAAM,EACN;YACE,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC;YACxB,CAAC,EAAE,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,CAAC;YACxC,QAAQ,EAAE,QAAQ;YAClB,OAAO,EAAE,IAAI;YACb,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,GAAG;YACT,KAAK,EAAE,KAAK,GAAG,GAAG,GAAG,CAAC;SACvB,EACD,MAAM,EACN,OAAO,CACR,CAAC;QAEF,OAAO,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,IAAI,GAAG,MAAM,CAAC;IACjD,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { MetaImageProps, ResolvedConfig } from "../../types.js";
|
|
2
|
+
import type { MeasureText } from "../../types.js";
|
|
3
|
+
import type { Panel } from "./panel.js";
|
|
4
|
+
/**
|
|
5
|
+
* How much of the panel the window bar takes, or none where the config asks
|
|
6
|
+
* for no chrome.
|
|
7
|
+
*
|
|
8
|
+
* It is measured against the space the panel was allotted rather than against
|
|
9
|
+
* the panel it ends up as, so that the room reserved for the bar and the bar
|
|
10
|
+
* that is drawn are the same height.
|
|
11
|
+
*/
|
|
12
|
+
export declare function barRoom(config: ResolvedConfig, allotted: number): number;
|
|
13
|
+
/**
|
|
14
|
+
* The window bar across the top of the panel, or nothing where the config asks
|
|
15
|
+
* for no chrome.
|
|
16
|
+
*
|
|
17
|
+
* What it holds is the post's `filename`, which is a prop of its own rather
|
|
18
|
+
* than the `title` the template already draws above the panel. The two say
|
|
19
|
+
* different things: a title is what the image is about, and a filename is
|
|
20
|
+
* where the code lives. Overloading one field to mean the other depending on a
|
|
21
|
+
* config flag would move a post's heading without the post changing.
|
|
22
|
+
*/
|
|
23
|
+
export declare function windowBar(panel: Panel, height: number, props: MetaImageProps, config: ResolvedConfig, measure: MeasureText): string;
|
|
24
|
+
//# sourceMappingURL=bar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bar.d.ts","sourceRoot":"","sources":["../../../src/templates/code/bar.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAExE;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,cAAc,EACrB,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,WAAW,GACnB,MAAM,CAeR"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { optionalString } from "../../props.js";
|
|
2
|
+
import { barHeight, titleBar } from "../window/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* How much of the panel the window bar takes, or none where the config asks
|
|
5
|
+
* for no chrome.
|
|
6
|
+
*
|
|
7
|
+
* It is measured against the space the panel was allotted rather than against
|
|
8
|
+
* the panel it ends up as, so that the room reserved for the bar and the bar
|
|
9
|
+
* that is drawn are the same height.
|
|
10
|
+
*/
|
|
11
|
+
export function barRoom(config, allotted) {
|
|
12
|
+
return config.code.chrome === "none" ? 0 : barHeight(allotted);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The window bar across the top of the panel, or nothing where the config asks
|
|
16
|
+
* for no chrome.
|
|
17
|
+
*
|
|
18
|
+
* What it holds is the post's `filename`, which is a prop of its own rather
|
|
19
|
+
* than the `title` the template already draws above the panel. The two say
|
|
20
|
+
* different things: a title is what the image is about, and a filename is
|
|
21
|
+
* where the code lives. Overloading one field to mean the other depending on a
|
|
22
|
+
* config flag would move a post's heading without the post changing.
|
|
23
|
+
*/
|
|
24
|
+
export function windowBar(panel, height, props, config, measure) {
|
|
25
|
+
const { chrome } = config.code;
|
|
26
|
+
if (chrome === "none") {
|
|
27
|
+
return "";
|
|
28
|
+
}
|
|
29
|
+
return titleBar(panel, height, optionalString(props["filename"]) ?? "", config, measure, chrome);
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=bar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bar.js","sourceRoot":"","sources":["../../../src/templates/code/bar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAGzD;;;;;;;GAOG;AACH,MAAM,UAAU,OAAO,CAAC,MAAsB,EAAE,QAAgB;IAC9D,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;AACjE,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,SAAS,CACvB,KAAY,EACZ,MAAc,EACd,KAAqB,EACrB,MAAsB,EACtB,OAAoB;IAEpB,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC;IAE/B,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACtB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,QAAQ,CACb,KAAK,EACL,MAAM,EACN,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,EACvC,MAAM,EACN,OAAO,EACP,MAAM,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { CodeToken } from "../../highlight/index.js";
|
|
2
|
+
import type { ResolvedConfig } from "../../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Width of the gutter in characters, or none where the config wants no
|
|
5
|
+
* numbers.
|
|
6
|
+
*
|
|
7
|
+
* It is taken from the whole snippet rather than from the lines that survive
|
|
8
|
+
* fitting, so the gutter is the width the numbering needs rather than the
|
|
9
|
+
* width it happens to use: a snippet cut off at line 9 of 40 still reserves
|
|
10
|
+
* two digits, and the code does not shift when a line is dropped.
|
|
11
|
+
*/
|
|
12
|
+
export declare function gutterColumns(config: ResolvedConfig, lines: number): number;
|
|
13
|
+
/**
|
|
14
|
+
* Move the code across by the width of the gutter and put a number in front of
|
|
15
|
+
* each line.
|
|
16
|
+
*
|
|
17
|
+
* The numbers are tokens on the same character grid as the code rather than
|
|
18
|
+
* text placed alongside it, which is what keeps them on the baselines the code
|
|
19
|
+
* is drawn on: there is one piece of arithmetic for where a line sits, and it
|
|
20
|
+
* stays in `codeBody` where it already was.
|
|
21
|
+
*
|
|
22
|
+
* A snippet that had lines dropped ends with the truncation marker, and that
|
|
23
|
+
* line is left unnumbered: it stands for the lines that are not shown, so a
|
|
24
|
+
* number of its own would be a number nothing has.
|
|
25
|
+
*
|
|
26
|
+
* A gutter of no columns is a snippet with the numbers turned off, and the
|
|
27
|
+
* lines come back untouched.
|
|
28
|
+
*/
|
|
29
|
+
export declare function numberLines(lines: readonly (readonly CodeToken[])[], columns: number, dropped: number): readonly (readonly CodeToken[])[];
|
|
30
|
+
//# sourceMappingURL=gutter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gutter.d.ts","sourceRoot":"","sources":["../../../src/templates/code/gutter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAQrD;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAI3E;AAkBD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,SAAS,CAAC,SAAS,SAAS,EAAE,CAAC,EAAE,EACxC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GACd,SAAS,CAAC,SAAS,SAAS,EAAE,CAAC,EAAE,CAiBnC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/** How faint the numbers are against the code beside them. */
|
|
2
|
+
const numberOpacity = 0.4;
|
|
3
|
+
/** Columns of clear space between the numbers and the code. */
|
|
4
|
+
const numberGap = 2;
|
|
5
|
+
/**
|
|
6
|
+
* Width of the gutter in characters, or none where the config wants no
|
|
7
|
+
* numbers.
|
|
8
|
+
*
|
|
9
|
+
* It is taken from the whole snippet rather than from the lines that survive
|
|
10
|
+
* fitting, so the gutter is the width the numbering needs rather than the
|
|
11
|
+
* width it happens to use: a snippet cut off at line 9 of 40 still reserves
|
|
12
|
+
* two digits, and the code does not shift when a line is dropped.
|
|
13
|
+
*/
|
|
14
|
+
export function gutterColumns(config, lines) {
|
|
15
|
+
return config.code.lineNumbers
|
|
16
|
+
? String(Math.max(1, lines)).length + numberGap
|
|
17
|
+
: 0;
|
|
18
|
+
}
|
|
19
|
+
/** One line's number, right-aligned in the digits the gutter reserves. */
|
|
20
|
+
function numberToken(line, columns) {
|
|
21
|
+
const text = String(line);
|
|
22
|
+
return {
|
|
23
|
+
text,
|
|
24
|
+
column: columns - numberGap - text.length,
|
|
25
|
+
// No colour of its own, so `codeBody` draws it in the theme's foreground
|
|
26
|
+
// and the opacity is what holds it back from the code.
|
|
27
|
+
color: undefined,
|
|
28
|
+
opacity: numberOpacity,
|
|
29
|
+
bold: false,
|
|
30
|
+
italic: false,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Move the code across by the width of the gutter and put a number in front of
|
|
35
|
+
* each line.
|
|
36
|
+
*
|
|
37
|
+
* The numbers are tokens on the same character grid as the code rather than
|
|
38
|
+
* text placed alongside it, which is what keeps them on the baselines the code
|
|
39
|
+
* is drawn on: there is one piece of arithmetic for where a line sits, and it
|
|
40
|
+
* stays in `codeBody` where it already was.
|
|
41
|
+
*
|
|
42
|
+
* A snippet that had lines dropped ends with the truncation marker, and that
|
|
43
|
+
* line is left unnumbered: it stands for the lines that are not shown, so a
|
|
44
|
+
* number of its own would be a number nothing has.
|
|
45
|
+
*
|
|
46
|
+
* A gutter of no columns is a snippet with the numbers turned off, and the
|
|
47
|
+
* lines come back untouched.
|
|
48
|
+
*/
|
|
49
|
+
export function numberLines(lines, columns, dropped) {
|
|
50
|
+
if (columns === 0) {
|
|
51
|
+
return lines;
|
|
52
|
+
}
|
|
53
|
+
const numbered = lines.length - (dropped > 0 ? 1 : 0);
|
|
54
|
+
return lines.map((tokens, index) => {
|
|
55
|
+
const shifted = tokens.map((token) => ({
|
|
56
|
+
...token,
|
|
57
|
+
column: token.column + columns,
|
|
58
|
+
}));
|
|
59
|
+
return index < numbered
|
|
60
|
+
? [numberToken(index + 1, columns), ...shifted]
|
|
61
|
+
: shifted;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=gutter.js.map
|