@kensio/colophon 2.14.0 → 2.15.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 +3 -3
- package/dist/config/defaults.d.ts +9 -5
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +8 -4
- package/dist/config/defaults.js.map +1 -1
- package/dist/highlight/grid.d.ts +5 -8
- package/dist/highlight/grid.d.ts.map +1 -1
- package/dist/highlight/grid.js +5 -5
- package/dist/highlight/grid.js.map +1 -1
- package/dist/highlight/index.d.ts.map +1 -1
- package/dist/highlight/index.js +1 -8
- package/dist/highlight/index.js.map +1 -1
- package/dist/highlight/types.d.ts +9 -6
- package/dist/highlight/types.d.ts.map +1 -1
- package/dist/layout/block.d.ts +6 -0
- package/dist/layout/block.d.ts.map +1 -1
- package/dist/layout/block.js.map +1 -1
- package/dist/layout/draw.d.ts.map +1 -1
- package/dist/layout/draw.js +3 -0
- package/dist/layout/draw.js.map +1 -1
- package/dist/layout/index.d.ts +1 -1
- package/dist/layout/index.d.ts.map +1 -1
- package/dist/layout/index.js +1 -1
- package/dist/layout/index.js.map +1 -1
- package/dist/measure/index.js +0 -0
- package/dist/measure/index.js.map +1 -1
- package/dist/measure/runs.d.ts +13 -2
- package/dist/measure/runs.d.ts.map +1 -1
- package/dist/measure/runs.js +37 -2
- package/dist/measure/runs.js.map +1 -1
- package/dist/templates/code/advance.d.ts +25 -0
- package/dist/templates/code/advance.d.ts.map +1 -0
- package/dist/templates/code/advance.js +36 -0
- package/dist/templates/code/advance.js.map +1 -0
- package/dist/templates/code/clip.d.ts +4 -3
- package/dist/templates/code/clip.d.ts.map +1 -1
- package/dist/templates/code/clip.js +18 -11
- package/dist/templates/code/clip.js.map +1 -1
- package/dist/templates/code/extent.d.ts +39 -0
- package/dist/templates/code/extent.d.ts.map +1 -0
- package/dist/templates/code/extent.js +54 -0
- package/dist/templates/code/extent.js.map +1 -0
- package/dist/templates/code/fit.d.ts +10 -8
- package/dist/templates/code/fit.d.ts.map +1 -1
- package/dist/templates/code/fit.js +5 -18
- package/dist/templates/code/fit.js.map +1 -1
- package/dist/templates/code/index.d.ts.map +1 -1
- package/dist/templates/code/index.js +7 -6
- package/dist/templates/code/index.js.map +1 -1
- package/dist/templates/code/layout.d.ts +6 -3
- package/dist/templates/code/layout.d.ts.map +1 -1
- package/dist/templates/code/layout.js +20 -7
- package/dist/templates/code/layout.js.map +1 -1
- package/dist/templates/code/mark/draw.d.ts +1 -0
- package/dist/templates/code/mark/draw.d.ts.map +1 -1
- package/dist/templates/code/mark/draw.js +3 -3
- package/dist/templates/code/mark/draw.js.map +1 -1
- package/dist/templates/code/mark/index.d.ts +2 -1
- package/dist/templates/code/mark/index.d.ts.map +1 -1
- package/dist/templates/code/mark/index.js +2 -2
- package/dist/templates/code/mark/index.js.map +1 -1
- package/dist/templates/code/mark/locate.d.ts +9 -7
- package/dist/templates/code/mark/locate.d.ts.map +1 -1
- package/dist/templates/code/mark/locate.js +28 -26
- package/dist/templates/code/mark/locate.js.map +1 -1
- package/dist/templates/code/spans.d.ts +5 -3
- package/dist/templates/code/spans.d.ts.map +1 -1
- package/dist/templates/code/spans.js +8 -6
- package/dist/templates/code/spans.js.map +1 -1
- package/dist/templates/code/truncate.d.ts +13 -0
- package/dist/templates/code/truncate.d.ts.map +1 -0
- package/dist/templates/code/truncate.js +23 -0
- package/dist/templates/code/truncate.js.map +1 -0
- package/dist/templates/cover/lines.d.ts.map +1 -1
- package/dist/templates/cover/lines.js +6 -2
- package/dist/templates/cover/lines.js.map +1 -1
- package/dist/templates/cover/lockup.d.ts +8 -1
- package/dist/templates/cover/lockup.d.ts.map +1 -1
- package/dist/templates/cover/lockup.js +11 -4
- package/dist/templates/cover/lockup.js.map +1 -1
- package/dist/templates/cover/tracking.d.ts +16 -0
- package/dist/templates/cover/tracking.d.ts.map +1 -0
- package/dist/templates/cover/tracking.js +40 -0
- package/dist/templates/cover/tracking.js.map +1 -0
- package/dist/templates/terminal/index.d.ts.map +1 -1
- package/dist/templates/terminal/index.js +7 -5
- package/dist/templates/terminal/index.js.map +1 -1
- package/dist/templates/terminal/session.d.ts.map +1 -1
- package/dist/templates/terminal/session.js +1 -12
- package/dist/templates/terminal/session.js.map +1 -1
- package/dist/text/element.d.ts +5 -0
- package/dist/text/element.d.ts.map +1 -1
- package/dist/text/element.js +4 -1
- package/dist/text/element.js.map +1 -1
- package/dist/text/index.d.ts +1 -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/track.d.ts +30 -0
- package/dist/text/track.d.ts.map +1 -0
- package/dist/text/track.js +44 -0
- package/dist/text/track.js.map +1 -0
- package/dist/texture/chevrons.js +1 -1
- package/dist/texture/grid.js +1 -1
- package/dist/texture/grid.js.map +1 -1
- package/dist/texture/halftone.js +2 -2
- package/dist/texture/honeycomb.js +1 -1
- package/dist/texture/honeycomb.js.map +1 -1
- package/dist/texture/index.d.ts.map +1 -1
- package/dist/texture/index.js +1 -3
- package/dist/texture/index.js.map +1 -1
- package/dist/texture/moire.js +1 -1
- package/dist/texture/moire.js.map +1 -1
- package/dist/texture/pattern.js +3 -3
- package/dist/texture/pattern.js.map +1 -1
- package/dist/texture/rays.js +1 -1
- package/dist/texture/resolve.d.ts +1 -2
- package/dist/texture/resolve.d.ts.map +1 -1
- package/dist/texture/resolve.js +4 -6
- package/dist/texture/resolve.js.map +1 -1
- package/dist/texture/scallops.js +1 -1
- package/dist/texture/topographic/index.js +2 -2
- package/dist/texture/topographic/index.js.map +1 -1
- package/dist/texture/waves.js +1 -1
- package/dist/theme/presets.d.ts +6 -6
- package/dist/theme/presets.js +6 -6
- package/dist/types.d.ts +36 -40
- package/dist/types.d.ts.map +1 -1
- package/dist/validate/keys.d.ts +0 -2
- package/dist/validate/keys.d.ts.map +1 -1
- package/dist/validate/keys.js +0 -8
- package/dist/validate/keys.js.map +1 -1
- package/dist/validate/values.d.ts.map +1 -1
- package/dist/validate/values.js +21 -0
- package/dist/validate/values.js.map +1 -1
- package/package.json +1 -1
- package/dist/templates/code/width.d.ts +0 -10
- package/dist/templates/code/width.d.ts.map +0 -1
- package/dist/templates/code/width.js +0 -26
- package/dist/templates/code/width.js.map +0 -1
- package/dist/texture/grain.d.ts +0 -17
- package/dist/texture/grain.d.ts.map +0 -1
- package/dist/texture/grain.js +0 -29
- package/dist/texture/grain.js.map +0 -1
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import type { CodeToken } from "../../highlight/index.js";
|
|
2
|
+
import type { Advance } from "./advance.js";
|
|
2
3
|
/**
|
|
3
|
-
* Where and how the snippet
|
|
4
|
+
* Where and how the snippet is drawn.
|
|
4
5
|
*/
|
|
5
6
|
export interface GridMetrics {
|
|
6
7
|
readonly originX: number;
|
|
7
8
|
readonly originY: number;
|
|
8
9
|
readonly fontSize: number;
|
|
9
|
-
readonly
|
|
10
|
+
readonly advance: Advance;
|
|
10
11
|
readonly step: number;
|
|
11
12
|
readonly fontFamily: string;
|
|
12
13
|
readonly foreground: string;
|
|
13
14
|
}
|
|
14
15
|
/**
|
|
15
16
|
* The snippet as one `<text>` element per line, each token positioned
|
|
16
|
-
* absolutely
|
|
17
|
+
* absolutely at the measured width of the line before it, so indentation
|
|
18
|
+
* survives SVG text flow and a full-width character takes the room it needs.
|
|
17
19
|
*/
|
|
18
20
|
export declare function codeBody(lines: readonly (readonly CodeToken[])[], metrics: GridMetrics): string;
|
|
19
21
|
//# sourceMappingURL=spans.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spans.d.ts","sourceRoot":"","sources":["../../../src/templates/code/spans.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"spans.d.ts","sourceRoot":"","sources":["../../../src/templates/code/spans.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAsB5C;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,SAAS,CAAC,SAAS,SAAS,EAAE,CAAC,EAAE,EACxC,OAAO,EAAE,WAAW,GACnB,MAAM,CA6BR"}
|
|
@@ -1,31 +1,33 @@
|
|
|
1
1
|
import { escapeXml } from "../../layout/index.js";
|
|
2
|
+
import { placeTokens } from "./extent.js";
|
|
2
3
|
/** Fraction of the font size the baseline sits below the glyph box top. */
|
|
3
4
|
const ascentRatio = 0.78;
|
|
4
|
-
function tokenSpan(token, x,
|
|
5
|
+
function tokenSpan(token, x, foreground) {
|
|
5
6
|
const fill = token.color ?? foreground;
|
|
6
7
|
const opacity = token.opacity === undefined
|
|
7
8
|
? ""
|
|
8
9
|
: ` fill-opacity="${String(token.opacity)}"`;
|
|
9
10
|
const weight = token.bold ? ` font-weight="700"` : "";
|
|
10
11
|
const style = token.italic ? ` font-style="italic"` : "";
|
|
11
|
-
return (`<tspan x="${String(Math.round(x
|
|
12
|
+
return (`<tspan x="${String(Math.round(x))}"` +
|
|
12
13
|
` fill="${fill}"${opacity}${weight}${style}>` +
|
|
13
14
|
`${escapeXml(token.text)}</tspan>`);
|
|
14
15
|
}
|
|
15
16
|
/**
|
|
16
17
|
* The snippet as one `<text>` element per line, each token positioned
|
|
17
|
-
* absolutely
|
|
18
|
+
* absolutely at the measured width of the line before it, so indentation
|
|
19
|
+
* survives SVG text flow and a full-width character takes the room it needs.
|
|
18
20
|
*/
|
|
19
21
|
export function codeBody(lines, metrics) {
|
|
20
|
-
const { originX, originY, fontSize,
|
|
22
|
+
const { originX, originY, fontSize, advance, step } = metrics;
|
|
21
23
|
return lines
|
|
22
24
|
.map((tokens, index) => {
|
|
23
25
|
if (tokens.length === 0) {
|
|
24
26
|
return "";
|
|
25
27
|
}
|
|
26
28
|
const baseline = Math.round(originY + index * step + (step - fontSize) / 2 + fontSize * ascentRatio);
|
|
27
|
-
const spans = tokens
|
|
28
|
-
.map((
|
|
29
|
+
const spans = placeTokens(tokens, advance)
|
|
30
|
+
.map((placed) => tokenSpan(placed.token, originX + placed.x * fontSize, metrics.foreground))
|
|
29
31
|
.join("");
|
|
30
32
|
return (`<text y="${String(baseline)}" xml:space="preserve"` +
|
|
31
33
|
` font-family="${escapeXml(metrics.fontFamily)}"` +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spans.js","sourceRoot":"","sources":["../../../src/templates/code/spans.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,2EAA2E;AAC3E,MAAM,WAAW,GAAG,IAAI,CAAC;AAEzB,SAAS,SAAS,
|
|
1
|
+
{"version":3,"file":"spans.js","sourceRoot":"","sources":["../../../src/templates/code/spans.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,2EAA2E;AAC3E,MAAM,WAAW,GAAG,IAAI,CAAC;AAEzB,SAAS,SAAS,CAAC,KAAgB,EAAE,CAAS,EAAE,UAAkB;IAChE,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,IAAI,UAAU,CAAC;IACvC,MAAM,OAAO,GACX,KAAK,CAAC,OAAO,KAAK,SAAS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;aACA,IAAI,CAAC,EAAE,CAAC,CAAC;QAEZ,OAAO,CACL,YAAY,MAAM,CAAC,QAAQ,CAAC,wBAAwB;YACpD,iBAAiB,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG;YACjD,eAAe,MAAM,CAAC,QAAQ,CAAC,KAAK,KAAK,SAAS,CACnD,CAAC;IACJ,CAAC,CAAC;SACD,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Advance } from "./advance.js";
|
|
2
|
+
/**
|
|
3
|
+
* The longest run of `text` that leaves room for an ellipsis after it, with
|
|
4
|
+
* the ellipsis on the end.
|
|
5
|
+
*
|
|
6
|
+
* It goes character by character rather than slicing at a count, because how
|
|
7
|
+
* many characters fit is a question about the face rather than about the
|
|
8
|
+
* string: a line of ideographs runs out of room in half the characters a line
|
|
9
|
+
* of Latin does. Iterating the string also keeps a surrogate pair together,
|
|
10
|
+
* which slicing at an index did not.
|
|
11
|
+
*/
|
|
12
|
+
export declare function truncate(text: string, room: number, advance: Advance): string;
|
|
13
|
+
//# sourceMappingURL=truncate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"truncate.d.ts","sourceRoot":"","sources":["../../../src/templates/code/truncate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAa7E"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ellipsis } from "../../text/ellipsis.js";
|
|
2
|
+
/**
|
|
3
|
+
* The longest run of `text` that leaves room for an ellipsis after it, with
|
|
4
|
+
* the ellipsis on the end.
|
|
5
|
+
*
|
|
6
|
+
* It goes character by character rather than slicing at a count, because how
|
|
7
|
+
* many characters fit is a question about the face rather than about the
|
|
8
|
+
* string: a line of ideographs runs out of room in half the characters a line
|
|
9
|
+
* of Latin does. Iterating the string also keeps a surrogate pair together,
|
|
10
|
+
* which slicing at an index did not.
|
|
11
|
+
*/
|
|
12
|
+
export function truncate(text, room, advance) {
|
|
13
|
+
const mark = advance(ellipsis);
|
|
14
|
+
let kept = "";
|
|
15
|
+
for (const character of text) {
|
|
16
|
+
if (advance(kept + character) + mark > room) {
|
|
17
|
+
break;
|
|
18
|
+
}
|
|
19
|
+
kept += character;
|
|
20
|
+
}
|
|
21
|
+
return kept + ellipsis;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=truncate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"truncate.js","sourceRoot":"","sources":["../../../src/templates/code/truncate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGlD;;;;;;;;;GASG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY,EAAE,IAAY,EAAE,OAAgB;IACnE,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC/B,IAAI,IAAI,GAAG,EAAE,CAAC;IAEd,KAAK,MAAM,SAAS,IAAI,IAAI,EAAE,CAAC;QAC7B,IAAI,OAAO,CAAC,IAAI,GAAG,SAAS,CAAC,GAAG,IAAI,GAAG,IAAI,EAAE,CAAC;YAC5C,MAAM;QACR,CAAC;QAED,IAAI,IAAI,SAAS,CAAC;IACpB,CAAC;IAED,OAAO,IAAI,GAAG,QAAQ,CAAC;AACzB,CAAC"}
|
|
@@ -1 +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;
|
|
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;AAgClE,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,CAqB7E"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { blockLines, clampLine, measureIn } from "../../layout/index.js";
|
|
2
|
+
import { trackTagline } from "./tracking.js";
|
|
2
3
|
/**
|
|
3
4
|
* One line for the name, for the reason the `wordmark` has one: a name broken
|
|
4
5
|
* across two lines stops reading as a name. On a strip it is also the only
|
|
@@ -65,9 +66,12 @@ export function coverLines(props, text) {
|
|
|
65
66
|
gapBefore: Math.round(contentHeight * taglineGapScale),
|
|
66
67
|
});
|
|
67
68
|
const scale = tagline.length === 0 ? nameScale : nameWithTaglineScale;
|
|
69
|
+
const name = nameLines(props, text, Math.round(contentHeight * scale));
|
|
68
70
|
return [
|
|
69
|
-
...
|
|
70
|
-
...
|
|
71
|
+
...name,
|
|
72
|
+
...(props["tracking"] === "fill"
|
|
73
|
+
? trackTagline(name, tagline, measure, fontFamily)
|
|
74
|
+
: tagline),
|
|
71
75
|
];
|
|
72
76
|
}
|
|
73
77
|
//# sourceMappingURL=lines.js.map
|
|
@@ -1 +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;
|
|
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;AAEzE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C;;;;;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,CAAC;IAEH,IAAI,IAAI,KAAK,SAAS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,EAAE,OAAO,EAAE,UAAU,CAAC;YAClD,CAAC,CAAC,OAAO,CAAC;KACb,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import type { Rect, TextLine } from "../../layout/index.js";
|
|
2
2
|
import type { ImageAsset, MeasureText } from "../../types.js";
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* The widest of a block of lines, which is how wide the block is.
|
|
5
|
+
*
|
|
6
|
+
* Tracking counts towards it, because a tracked line is drawn wider than it
|
|
7
|
+
* measures. Leaving it out would centre the lockup on the width the words
|
|
8
|
+
* would have had, which is the one place a stretched line would push past its
|
|
9
|
+
* own margin.
|
|
10
|
+
*/
|
|
4
11
|
export declare function linesWidth(lines: readonly TextLine[], measure: MeasureText, fontFamily: string): number;
|
|
5
12
|
/** The room the mark takes along the row, including the gap after it. */
|
|
6
13
|
export interface Mark {
|
|
@@ -1 +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
|
|
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;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,SAAS,QAAQ,EAAE,EAC1B,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,MAAM,GACjB,MAAM,CAiBR;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"}
|
|
@@ -1,15 +1,22 @@
|
|
|
1
|
-
import { image, row } from "../../layout/index.js";
|
|
1
|
+
import { image, row, trackedWidth } from "../../layout/index.js";
|
|
2
2
|
/** The mark's height, as a fraction of the room the lockup has. */
|
|
3
3
|
const markScale = 0.72;
|
|
4
4
|
/** The clear space between the mark and the words, of the same room. */
|
|
5
5
|
const markGapScale = 0.24;
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* The widest of a block of lines, which is how wide the block is.
|
|
8
|
+
*
|
|
9
|
+
* Tracking counts towards it, because a tracked line is drawn wider than it
|
|
10
|
+
* measures. Leaving it out would centre the lockup on the width the words
|
|
11
|
+
* would have had, which is the one place a stretched line would push past its
|
|
12
|
+
* own margin.
|
|
13
|
+
*/
|
|
7
14
|
export function linesWidth(lines, measure, fontFamily) {
|
|
8
|
-
return lines.reduce((widest, line) => Math.max(widest, measure(line.text, {
|
|
15
|
+
return lines.reduce((widest, line) => Math.max(widest, trackedWidth(line.text, measure(line.text, {
|
|
9
16
|
fontFamily,
|
|
10
17
|
fontSize: line.fontSize,
|
|
11
18
|
fontWeight: line.fontWeight,
|
|
12
|
-
})), 0);
|
|
19
|
+
}), line.letterSpacing ?? 0)), 0);
|
|
13
20
|
}
|
|
14
21
|
/**
|
|
15
22
|
* How much of the row the mark claims, or nothing at all where the project has
|
|
@@ -1 +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;
|
|
1
|
+
{"version":3,"file":"lockup.js","sourceRoot":"","sources":["../../../src/templates/cover/lockup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGjE,mEAAmE;AACnE,MAAM,SAAS,GAAG,IAAI,CAAC;AAEvB,wEAAwE;AACxE,MAAM,YAAY,GAAG,IAAI,CAAC;AAE1B;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CACxB,KAA0B,EAC1B,OAAoB,EACpB,UAAkB;IAElB,OAAO,KAAK,CAAC,MAAM,CACjB,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CACf,IAAI,CAAC,GAAG,CACN,MAAM,EACN,YAAY,CACV,IAAI,CAAC,IAAI,EACT,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE;QACjB,UAAU;QACV,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,UAAU,EAAE,IAAI,CAAC,UAAU;KAC5B,CAAC,EACF,IAAI,CAAC,aAAa,IAAI,CAAC,CACxB,CACF,EACH,CAAC,CACF,CAAC;AACJ,CAAC;AAQD;;;;;;;GAOG;AACH,MAAM,UAAU,SAAS,CACvB,IAA4B,EAC5B,aAAqB;IAErB,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,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,IAAI,CAAC,IAAI,EACT,EAAE,GAAG,EAAE,SAAS,EAAE,CACnB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TextLine } from "../../layout/index.js";
|
|
2
|
+
import type { MeasureText } from "../../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Stretch a single line of tagline out to the width of the name above it.
|
|
5
|
+
*
|
|
6
|
+
* This is the adjustment somebody makes by hand in a drawing program and then
|
|
7
|
+
* has to make again every time the words change: the wordmark and the line
|
|
8
|
+
* under it share both edges, so the pair reads as one block rather than as two
|
|
9
|
+
* lines that happen to be centred together.
|
|
10
|
+
*
|
|
11
|
+
* Only a tagline of one line is tracked. Justifying every line of a wrapped
|
|
12
|
+
* one to the same width is a different thing to want, and it goes wrong on the
|
|
13
|
+
* short last line in the way justified text always does.
|
|
14
|
+
*/
|
|
15
|
+
export declare function trackTagline(name: readonly TextLine[], tagline: readonly TextLine[], measure: MeasureText, fontFamily: string): readonly TextLine[];
|
|
16
|
+
//# sourceMappingURL=tracking.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracking.d.ts","sourceRoot":"","sources":["../../../src/templates/cover/tracking.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AA0BlD;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,SAAS,QAAQ,EAAE,EACzB,OAAO,EAAE,SAAS,QAAQ,EAAE,EAC5B,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,MAAM,GACjB,SAAS,QAAQ,EAAE,CAmBrB"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { measureIn, trackingFor } from "../../layout/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* The most a line may be tracked, as a fraction of its own font size.
|
|
4
|
+
*
|
|
5
|
+
* Stretching a strapline to sit under a name is a typesetter's adjustment, and
|
|
6
|
+
* past a certain point it stops being one: a two-word tagline pulled out to the
|
|
7
|
+
* width of a long name reads as broken rather than as considered. Half an em
|
|
8
|
+
* between characters is where that starts, so a line needing more than this is
|
|
9
|
+
* left alone rather than drawn badly.
|
|
10
|
+
*/
|
|
11
|
+
const maxTracking = 0.5;
|
|
12
|
+
/** How wide one line is drawn, before any tracking is added to it. */
|
|
13
|
+
function naturalWidth(line, measure, fontFamily) {
|
|
14
|
+
return measureIn(measure, fontFamily, line.fontWeight)(line.text, line.fontSize);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Stretch a single line of tagline out to the width of the name above it.
|
|
18
|
+
*
|
|
19
|
+
* This is the adjustment somebody makes by hand in a drawing program and then
|
|
20
|
+
* has to make again every time the words change: the wordmark and the line
|
|
21
|
+
* under it share both edges, so the pair reads as one block rather than as two
|
|
22
|
+
* lines that happen to be centred together.
|
|
23
|
+
*
|
|
24
|
+
* Only a tagline of one line is tracked. Justifying every line of a wrapped
|
|
25
|
+
* one to the same width is a different thing to want, and it goes wrong on the
|
|
26
|
+
* short last line in the way justified text always does.
|
|
27
|
+
*/
|
|
28
|
+
export function trackTagline(name, tagline, measure, fontFamily) {
|
|
29
|
+
const [first] = name;
|
|
30
|
+
const [line] = tagline;
|
|
31
|
+
if (first === undefined || line === undefined || tagline.length !== 1) {
|
|
32
|
+
return tagline;
|
|
33
|
+
}
|
|
34
|
+
const tracking = trackingFor(line.text, naturalWidth(line, measure, fontFamily), naturalWidth(first, measure, fontFamily));
|
|
35
|
+
if (tracking > line.fontSize * maxTracking) {
|
|
36
|
+
return tagline;
|
|
37
|
+
}
|
|
38
|
+
return [{ ...line, letterSpacing: tracking }];
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=tracking.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracking.js","sourceRoot":"","sources":["../../../src/templates/cover/tracking.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAG/D;;;;;;;;GAQG;AACH,MAAM,WAAW,GAAG,GAAG,CAAC;AAExB,sEAAsE;AACtE,SAAS,YAAY,CACnB,IAAc,EACd,OAAoB,EACpB,UAAkB;IAElB,OAAO,SAAS,CACd,OAAO,EACP,UAAU,EACV,IAAI,CAAC,UAAU,CAChB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC9B,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,YAAY,CAC1B,IAAyB,EACzB,OAA4B,EAC5B,OAAoB,EACpB,UAAkB;IAElB,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IACrB,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;IAEvB,IAAI,KAAK,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtE,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,QAAQ,GAAG,WAAW,CAC1B,IAAI,CAAC,IAAI,EACT,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,UAAU,CAAC,EACvC,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,CACzC,CAAC;IAEF,IAAI,QAAQ,GAAG,IAAI,CAAC,QAAQ,GAAG,WAAW,EAAE,CAAC;QAC3C,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,OAAO,CAAC,EAAE,GAAG,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/terminal/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAa/C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,gBAAgB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/terminal/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAa/C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,gBAAgB,EAAE,QAuE9B,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { optionalString } from "../../props.js";
|
|
2
|
+
import { codeAdvance } from "../code/advance.js";
|
|
2
3
|
import { codeFooter } from "../code/chrome.js";
|
|
3
|
-
import {
|
|
4
|
+
import { blockWidth } from "../code/extent.js";
|
|
4
5
|
import { fitSnippet } from "../code/layout.js";
|
|
5
6
|
import { layoutPanel } from "../code/panel.js";
|
|
6
7
|
import { hugPanel, panelSvg } from "../code/plate.js";
|
|
7
8
|
import { codeBody } from "../code/spans.js";
|
|
8
9
|
import { warnIfTruncated } from "../code/warn.js";
|
|
9
|
-
import { charWidthRatio } from "../code/width.js";
|
|
10
10
|
import { footerFontSize, hasFooter } from "../footer.js";
|
|
11
11
|
import { barHeight, titleBar } from "../window/index.js";
|
|
12
12
|
import { terminalSession } from "./session.js";
|
|
@@ -34,14 +34,16 @@ export const terminalTemplate = {
|
|
|
34
34
|
// than against the window it ends up as, so that the room reserved for it
|
|
35
35
|
// and the bar that is drawn are the same height.
|
|
36
36
|
const bar = barHeight(available.width);
|
|
37
|
-
const
|
|
37
|
+
const advance = codeAdvance(measure, config.code.fontFamily);
|
|
38
|
+
const fitted = fitSnippet(session, { ...available, y: available.y + bar, height: available.height - bar }, width, config, advance);
|
|
38
39
|
warnIfTruncated(config, dimensions, {
|
|
39
40
|
dropped: session.lines.length - fitted.lines.length,
|
|
40
41
|
clipped: fitted.clipped,
|
|
41
42
|
}, session.lines.length, "terminal session");
|
|
42
43
|
const body = fitted.lines.length * fitted.step;
|
|
43
44
|
const window = hugPanel(available, {
|
|
44
|
-
width:
|
|
45
|
+
width: blockWidth(fitted.lines, advance) * fitted.fontSize +
|
|
46
|
+
fitted.padding * 2,
|
|
45
47
|
height: bar + body + fitted.padding * 2,
|
|
46
48
|
});
|
|
47
49
|
const shadow = Math.max(1, Math.round(Math.min(width, height) * 0.01));
|
|
@@ -51,7 +53,7 @@ export const terminalTemplate = {
|
|
|
51
53
|
originX: window.x + fitted.padding,
|
|
52
54
|
originY: window.y + bar + (window.height - bar - body) / 2,
|
|
53
55
|
fontSize: fitted.fontSize,
|
|
54
|
-
|
|
56
|
+
advance,
|
|
55
57
|
step: fitted.step,
|
|
56
58
|
fontFamily: config.code.fontFamily,
|
|
57
59
|
foreground: session.foreground,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/terminal/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/terminal/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO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AE,MAAM,CAAC,CACzC,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/templates/terminal/session.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAa,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3E,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/templates/terminal/session.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAa,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3E,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAkCrE;;;;;;;;;;;;GAYG;AACH,wBAAsB,eAAe,CACnC,KAAK,EAAE,cAAc,EACrB,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,eAAe,CAAC,CAoC1B"}
|
|
@@ -28,17 +28,6 @@ function promptToken(prompt, accent) {
|
|
|
28
28
|
italic: false,
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
/** The width of the widest line, in characters. */
|
|
32
|
-
function widest(lines) {
|
|
33
|
-
let longest = 0;
|
|
34
|
-
for (const tokens of lines) {
|
|
35
|
-
const last = tokens.at(-1);
|
|
36
|
-
if (last !== undefined) {
|
|
37
|
-
longest = Math.max(longest, last.column + last.text.length);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return longest;
|
|
41
|
-
}
|
|
42
31
|
/**
|
|
43
32
|
* The session as one grid of lines: the commands, then what they printed.
|
|
44
33
|
*
|
|
@@ -81,6 +70,6 @@ export async function terminalSession(props, config) {
|
|
|
81
70
|
.split("\n")
|
|
82
71
|
.map((line) => outputLine(line, tabSize));
|
|
83
72
|
const lines = [...(command === "" ? [] : commands), ...printed];
|
|
84
|
-
return { ...highlighted, lines
|
|
73
|
+
return { ...highlighted, lines };
|
|
85
74
|
}
|
|
86
75
|
//# sourceMappingURL=session.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../../src/templates/terminal/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAErE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,oEAAoE;AACpE,MAAM,aAAa,GAAG,IAAI,CAAC;AAE3B,qEAAqE;AACrE,MAAM,aAAa,GAAG,GAAG,CAAC;AAE1B,yEAAyE;AACzE,SAAS,UAAU,CAAC,IAAY,EAAE,OAAe;IAC/C,OAAO;QACL;YACE,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC;YAC/B,MAAM,EAAE,CAAC;YACT,KAAK,EAAE,SAAS;YAChB,OAAO,EAAE,aAAa;YACtB,IAAI,EAAE,KAAK;YACX,MAAM,EAAE,KAAK;SACd;KACF,CAAC;AACJ,CAAC;AAED,sDAAsD;AACtD,SAAS,WAAW,CAAC,MAAc,EAAE,MAAc;IACjD,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,CAAC;QACT,KAAK,EAAE,MAAM;QACb,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,IAAI;QACV,MAAM,EAAE,KAAK;KACd,CAAC;AACJ,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../../src/templates/terminal/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAErE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,oEAAoE;AACpE,MAAM,aAAa,GAAG,IAAI,CAAC;AAE3B,qEAAqE;AACrE,MAAM,aAAa,GAAG,GAAG,CAAC;AAE1B,yEAAyE;AACzE,SAAS,UAAU,CAAC,IAAY,EAAE,O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AAC,CAAC;IACrD,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;QACjD,GAAG,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YACrC,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;QACnD,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;KACxE,CAAC,CAAC;IAEH,MAAM,OAAO,GACX,MAAM,KAAK,EAAE;QACX,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,MAAM;aACH,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC;aACxB,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;aACnB,KAAK,CAAC,IAAI,CAAC;aACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;IAElD,MAAM,KAAK,GAAG,CAAC,GAAG,CAAC,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,GAAG,OAAO,CAAC,CAAC;IAEhE,OAAO,EAAE,GAAG,WAAW,EAAE,KAAK,EAAE,CAAC;AACnC,CAAC"}
|
package/dist/text/element.d.ts
CHANGED
|
@@ -10,6 +10,11 @@ export interface TextAttributes {
|
|
|
10
10
|
readonly fill: string;
|
|
11
11
|
readonly fillOpacity?: number;
|
|
12
12
|
readonly anchor?: "start" | "middle" | "end";
|
|
13
|
+
/**
|
|
14
|
+
* Extra space between characters. Left out when it is zero, which is what
|
|
15
|
+
* keeps every line that wanted none byte for byte what it was.
|
|
16
|
+
*/
|
|
17
|
+
readonly letterSpacing?: number;
|
|
13
18
|
}
|
|
14
19
|
/**
|
|
15
20
|
* Build a single `<text>` element. The content is XML-escaped.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../../src/text/element.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../../src/text/element.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IAC7C;;;OAGG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACjC;AAED;;GAEG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,cAAc,GACzB,MAAM,CAsBR"}
|
package/dist/text/element.js
CHANGED
|
@@ -9,11 +9,14 @@ export function textElement(content, attributes) {
|
|
|
9
9
|
const anchor = attributes.anchor === undefined
|
|
10
10
|
? ""
|
|
11
11
|
: ` text-anchor="${attributes.anchor}"`;
|
|
12
|
+
const spacing = attributes.letterSpacing === undefined || attributes.letterSpacing === 0
|
|
13
|
+
? ""
|
|
14
|
+
: ` letter-spacing="${String(attributes.letterSpacing)}"`;
|
|
12
15
|
return (`<text x="${String(attributes.x)}" y="${String(attributes.y)}"` +
|
|
13
16
|
` font-family="${escapeXml(attributes.fontFamily)}"` +
|
|
14
17
|
` font-size="${String(attributes.fontSize)}"` +
|
|
15
18
|
` font-weight="${String(attributes.fontWeight)}"` +
|
|
16
|
-
` fill="${attributes.fill}"${opacity}${anchor}>` +
|
|
19
|
+
` fill="${attributes.fill}"${opacity}${anchor}${spacing}>` +
|
|
17
20
|
`${escapeXml(content)}</text>`);
|
|
18
21
|
}
|
|
19
22
|
//# sourceMappingURL=element.js.map
|
package/dist/text/element.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element.js","sourceRoot":"","sources":["../../src/text/element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"element.js","sourceRoot":"","sources":["../../src/text/element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAqBxC;;GAEG;AACH,MAAM,UAAU,WAAW,CACzB,OAAe,EACf,UAA0B;IAE1B,MAAM,OAAO,GACX,UAAU,CAAC,WAAW,KAAK,SAAS;QAClC,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,kBAAkB,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC;IAC1D,MAAM,MAAM,GACV,UAAU,CAAC,MAAM,KAAK,SAAS;QAC7B,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,iBAAiB,UAAU,CAAC,MAAM,GAAG,CAAC;IAC5C,MAAM,OAAO,GACX,UAAU,CAAC,aAAa,KAAK,SAAS,IAAI,UAAU,CAAC,aAAa,KAAK,CAAC;QACtE,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,oBAAoB,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,GAAG,CAAC;IAE9D,OAAO,CACL,YAAY,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG;QAC/D,iBAAiB,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG;QACpD,eAAe,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG;QAC7C,iBAAiB,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG;QACjD,UAAU,UAAU,CAAC,IAAI,IAAI,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG;QAC1D,GAAG,SAAS,CAAC,OAAO,CAAC,SAAS,CAC/B,CAAC;AACJ,CAAC"}
|
package/dist/text/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export { fillText } from "./fill.js";
|
|
|
8
8
|
export type { FillOptions } from "./fill.js";
|
|
9
9
|
export { fitText } from "./fit.js";
|
|
10
10
|
export type { FitOptions, FittedText, MeasureAt } from "./fit.js";
|
|
11
|
+
export { trackedWidth, trackingFor } from "./track.js";
|
|
11
12
|
export { wrapText } from "./wrap.js";
|
|
12
13
|
export type { MeasureLine } from "./wrap.js";
|
|
13
14
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/text/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/text/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,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;AACrC,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/text/index.js
CHANGED
|
@@ -5,5 +5,6 @@ export { clampLine } from "./clamp.js";
|
|
|
5
5
|
export { ellipsis } from "./ellipsis.js";
|
|
6
6
|
export { fillText } from "./fill.js";
|
|
7
7
|
export { fitText } from "./fit.js";
|
|
8
|
+
export { trackedWidth, trackingFor } from "./track.js";
|
|
8
9
|
export { wrapText } from "./wrap.js";
|
|
9
10
|
//# sourceMappingURL=index.js.map
|
package/dist/text/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/text/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/text/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tracking: the space added between the characters of a line, so that a line
|
|
3
|
+
* set small can be stretched to the width of a line set large above it.
|
|
4
|
+
*
|
|
5
|
+
* It is what a typesetter does by hand to make a wordmark and the strapline
|
|
6
|
+
* under it share an edge on both sides. The alternative is choosing a font
|
|
7
|
+
* size that happens to come out the right width, which lasts until the words
|
|
8
|
+
* change.
|
|
9
|
+
*
|
|
10
|
+
* The arithmetic is exact rather than approximate because of how the renderer
|
|
11
|
+
* applies it. SVG's `letter-spacing` goes between characters and not after the
|
|
12
|
+
* last one, checked by rendering rather than read from a specification: four
|
|
13
|
+
* characters at a spacing of 20 come out exactly 60 wider, and an end-anchored
|
|
14
|
+
* run keeps its right edge. So a line of `n` characters has `n - 1` gaps, the
|
|
15
|
+
* width lands on the target, and `middle` and `end` anchors stay where they
|
|
16
|
+
* were put.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* The spacing that takes a line from the width it has to the width it wants,
|
|
20
|
+
* or nothing at all where it cannot get there.
|
|
21
|
+
*
|
|
22
|
+
* Two cases give nothing back. A line already at or past the target would need
|
|
23
|
+
* negative tracking, and letters pulled together read as a mistake where
|
|
24
|
+
* letters pushed apart read as a decision. A line of one character has no gaps
|
|
25
|
+
* to put the space in.
|
|
26
|
+
*/
|
|
27
|
+
export declare function trackingFor(text: string, naturalWidth: number, targetWidth: number): number;
|
|
28
|
+
/** The width a line takes once its tracking is applied. */
|
|
29
|
+
export declare function trackedWidth(text: string, naturalWidth: number, tracking: number): number;
|
|
30
|
+
//# sourceMappingURL=track.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"track.d.ts","sourceRoot":"","sources":["../../src/text/track.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AASH;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,GAClB,MAAM,CAQR;AAED,2DAA2D;AAC3D,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,GACf,MAAM,CAER"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tracking: the space added between the characters of a line, so that a line
|
|
3
|
+
* set small can be stretched to the width of a line set large above it.
|
|
4
|
+
*
|
|
5
|
+
* It is what a typesetter does by hand to make a wordmark and the strapline
|
|
6
|
+
* under it share an edge on both sides. The alternative is choosing a font
|
|
7
|
+
* size that happens to come out the right width, which lasts until the words
|
|
8
|
+
* change.
|
|
9
|
+
*
|
|
10
|
+
* The arithmetic is exact rather than approximate because of how the renderer
|
|
11
|
+
* applies it. SVG's `letter-spacing` goes between characters and not after the
|
|
12
|
+
* last one, checked by rendering rather than read from a specification: four
|
|
13
|
+
* characters at a spacing of 20 come out exactly 60 wider, and an end-anchored
|
|
14
|
+
* run keeps its right edge. So a line of `n` characters has `n - 1` gaps, the
|
|
15
|
+
* width lands on the target, and `middle` and `end` anchors stay where they
|
|
16
|
+
* were put.
|
|
17
|
+
*/
|
|
18
|
+
/** The gaps a line of text has between its characters. */
|
|
19
|
+
function gaps(text) {
|
|
20
|
+
// Code points rather than UTF-16 units, so an emoji or an astral character
|
|
21
|
+
// counts once and the spacing does not come out short.
|
|
22
|
+
return Array.from(text).length - 1;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The spacing that takes a line from the width it has to the width it wants,
|
|
26
|
+
* or nothing at all where it cannot get there.
|
|
27
|
+
*
|
|
28
|
+
* Two cases give nothing back. A line already at or past the target would need
|
|
29
|
+
* negative tracking, and letters pulled together read as a mistake where
|
|
30
|
+
* letters pushed apart read as a decision. A line of one character has no gaps
|
|
31
|
+
* to put the space in.
|
|
32
|
+
*/
|
|
33
|
+
export function trackingFor(text, naturalWidth, targetWidth) {
|
|
34
|
+
const count = gaps(text);
|
|
35
|
+
if (count < 1 || targetWidth <= naturalWidth) {
|
|
36
|
+
return 0;
|
|
37
|
+
}
|
|
38
|
+
return (targetWidth - naturalWidth) / count;
|
|
39
|
+
}
|
|
40
|
+
/** The width a line takes once its tracking is applied. */
|
|
41
|
+
export function trackedWidth(text, naturalWidth, tracking) {
|
|
42
|
+
return naturalWidth + Math.max(0, gaps(text)) * tracking;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=track.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"track.js","sourceRoot":"","sources":["../../src/text/track.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,0DAA0D;AAC1D,SAAS,IAAI,CAAC,IAAY;IACxB,2EAA2E;IAC3E,uDAAuD;IACvD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;AACrC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CACzB,IAAY,EACZ,YAAoB,EACpB,WAAmB;IAEnB,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;IAEzB,IAAI,KAAK,GAAG,CAAC,IAAI,WAAW,IAAI,YAAY,EAAE,CAAC;QAC7C,OAAO,CAAC,CAAC;IACX,CAAC;IAED,OAAO,CAAC,WAAW,GAAG,YAAY,CAAC,GAAG,KAAK,CAAC;AAC9C,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,YAAY,CAC1B,IAAY,EACZ,YAAoB,EACpB,QAAgB;IAEhB,OAAO,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,QAAQ,CAAC;AAC3D,CAAC"}
|
package/dist/texture/chevrons.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { fallbackColor } from "./color.js";
|
|
2
2
|
import { tile } from "./tile.js";
|
|
3
|
-
const chevronDefaults = { opacity: 0.07, width:
|
|
3
|
+
const chevronDefaults = { opacity: 0.07, width: 3, gap: 54 };
|
|
4
4
|
/**
|
|
5
5
|
* Rows of chevrons: one V to a tile, meeting its neighbours at the tile edge.
|
|
6
6
|
*
|
package/dist/texture/grid.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { fallbackColor } from "./color.js";
|
|
2
2
|
import { tile } from "./tile.js";
|
|
3
|
-
const gridDefaults = { opacity: 0.07, width: 1, gap:
|
|
3
|
+
const gridDefaults = { opacity: 0.07, width: 1.5, gap: 48, major: 5 };
|
|
4
4
|
/** How much heavier the every-so-often line is than the rest. */
|
|
5
5
|
const majorScale = 2;
|
|
6
6
|
/** One square's worth of grid: a line along two of its edges. */
|
package/dist/texture/grid.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid.js","sourceRoot":"","sources":["../../src/texture/grid.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,YAAY,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"grid.js","sourceRoot":"","sources":["../../src/texture/grid.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,YAAY,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AAEtE,iEAAiE;AACjE,MAAM,UAAU,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