@kensio/colophon 2.11.1 → 2.12.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.
Files changed (145) hide show
  1. package/dist/astro/index.d.ts.map +1 -1
  2. package/dist/astro/index.js +0 -1
  3. package/dist/astro/index.js.map +1 -1
  4. package/dist/config/defaults.d.ts.map +1 -1
  5. package/dist/config/defaults.js +5 -0
  6. package/dist/config/defaults.js.map +1 -1
  7. package/dist/measure/faces.d.ts.map +1 -1
  8. package/dist/measure/faces.js.map +1 -1
  9. package/dist/templates/banner/index.js +2 -2
  10. package/dist/templates/banner/index.js.map +1 -1
  11. package/dist/templates/card/index.js +2 -2
  12. package/dist/templates/card/index.js.map +1 -1
  13. package/dist/templates/code/bar.d.ts +24 -0
  14. package/dist/templates/code/bar.d.ts.map +1 -0
  15. package/dist/templates/code/bar.js +31 -0
  16. package/dist/templates/code/bar.js.map +1 -0
  17. package/dist/templates/code/gutter.d.ts +30 -0
  18. package/dist/templates/code/gutter.d.ts.map +1 -0
  19. package/dist/templates/code/gutter.js +64 -0
  20. package/dist/templates/code/gutter.js.map +1 -0
  21. package/dist/templates/code/index.d.ts.map +1 -1
  22. package/dist/templates/code/index.js +34 -15
  23. package/dist/templates/code/index.js.map +1 -1
  24. package/dist/templates/code/layout.d.ts +6 -1
  25. package/dist/templates/code/layout.d.ts.map +1 -1
  26. package/dist/templates/code/layout.js +8 -3
  27. package/dist/templates/code/layout.js.map +1 -1
  28. package/dist/templates/code/mark/draw.d.ts +26 -0
  29. package/dist/templates/code/mark/draw.d.ts.map +1 -0
  30. package/dist/templates/code/mark/draw.js +41 -0
  31. package/dist/templates/code/mark/draw.js.map +1 -0
  32. package/dist/templates/code/mark/index.d.ts +16 -0
  33. package/dist/templates/code/mark/index.d.ts.map +1 -0
  34. package/dist/templates/code/mark/index.js +34 -0
  35. package/dist/templates/code/mark/index.js.map +1 -0
  36. package/dist/templates/code/mark/locate.d.ts +20 -0
  37. package/dist/templates/code/mark/locate.d.ts.map +1 -0
  38. package/dist/templates/code/mark/locate.js +56 -0
  39. package/dist/templates/code/mark/locate.js.map +1 -0
  40. package/dist/templates/code/mark/read.d.ts +30 -0
  41. package/dist/templates/code/mark/read.d.ts.map +1 -0
  42. package/dist/templates/code/mark/read.js +61 -0
  43. package/dist/templates/code/mark/read.js.map +1 -0
  44. package/dist/templates/code/plate.d.ts +7 -1
  45. package/dist/templates/code/plate.d.ts.map +1 -1
  46. package/dist/templates/code/plate.js +14 -4
  47. package/dist/templates/code/plate.js.map +1 -1
  48. package/dist/templates/footer.d.ts +9 -1
  49. package/dist/templates/footer.d.ts.map +1 -1
  50. package/dist/templates/footer.js +24 -0
  51. package/dist/templates/footer.js.map +1 -1
  52. package/dist/templates/frame.d.ts.map +1 -1
  53. package/dist/templates/frame.js +5 -7
  54. package/dist/templates/frame.js.map +1 -1
  55. package/dist/templates/terminal/index.js +4 -4
  56. package/dist/templates/terminal/index.js.map +1 -1
  57. package/dist/templates/window/dots.d.ts +11 -0
  58. package/dist/templates/window/dots.d.ts.map +1 -0
  59. package/dist/templates/window/dots.js +32 -0
  60. package/dist/templates/window/dots.js.map +1 -0
  61. package/dist/templates/{terminal/window.d.ts → window/index.d.ts} +4 -2
  62. package/dist/templates/window/index.d.ts.map +1 -0
  63. package/dist/templates/window/index.js +48 -0
  64. package/dist/templates/window/index.js.map +1 -0
  65. package/dist/templates/window/title.d.ts +9 -0
  66. package/dist/templates/window/title.d.ts.map +1 -0
  67. package/dist/templates/window/title.js +24 -0
  68. package/dist/templates/window/title.js.map +1 -0
  69. package/dist/texture/chevrons.d.ts +13 -0
  70. package/dist/texture/chevrons.d.ts.map +1 -0
  71. package/dist/texture/chevrons.js +22 -0
  72. package/dist/texture/chevrons.js.map +1 -0
  73. package/dist/texture/grid.d.ts +14 -0
  74. package/dist/texture/grid.d.ts.map +1 -0
  75. package/dist/texture/grid.js +38 -0
  76. package/dist/texture/grid.js.map +1 -0
  77. package/dist/texture/halftone.d.ts +14 -0
  78. package/dist/texture/halftone.d.ts.map +1 -0
  79. package/dist/texture/halftone.js +55 -0
  80. package/dist/texture/halftone.js.map +1 -0
  81. package/dist/texture/honeycomb.d.ts +14 -0
  82. package/dist/texture/honeycomb.d.ts.map +1 -0
  83. package/dist/texture/honeycomb.js +43 -0
  84. package/dist/texture/honeycomb.js.map +1 -0
  85. package/dist/texture/index.d.ts +1 -2
  86. package/dist/texture/index.d.ts.map +1 -1
  87. package/dist/texture/index.js +44 -13
  88. package/dist/texture/index.js.map +1 -1
  89. package/dist/texture/moire.d.ts +18 -0
  90. package/dist/texture/moire.d.ts.map +1 -0
  91. package/dist/texture/moire.js +44 -0
  92. package/dist/texture/moire.js.map +1 -0
  93. package/dist/texture/pattern.d.ts +10 -0
  94. package/dist/texture/pattern.d.ts.map +1 -1
  95. package/dist/texture/pattern.js +36 -13
  96. package/dist/texture/pattern.js.map +1 -1
  97. package/dist/texture/rays.d.ts +13 -0
  98. package/dist/texture/rays.d.ts.map +1 -0
  99. package/dist/texture/rays.js +36 -0
  100. package/dist/texture/rays.js.map +1 -0
  101. package/dist/texture/scallops.d.ts +14 -0
  102. package/dist/texture/scallops.d.ts.map +1 -0
  103. package/dist/texture/scallops.js +29 -0
  104. package/dist/texture/scallops.js.map +1 -0
  105. package/dist/texture/tile.d.ts +14 -0
  106. package/dist/texture/tile.d.ts.map +1 -0
  107. package/dist/texture/tile.js +23 -0
  108. package/dist/texture/tile.js.map +1 -0
  109. package/dist/texture/topographic/contours.d.ts +13 -0
  110. package/dist/texture/topographic/contours.d.ts.map +1 -0
  111. package/dist/texture/topographic/contours.js +72 -0
  112. package/dist/texture/topographic/contours.js.map +1 -0
  113. package/dist/texture/topographic/field.d.ts +8 -0
  114. package/dist/texture/topographic/field.d.ts.map +1 -0
  115. package/dist/texture/topographic/field.js +29 -0
  116. package/dist/texture/topographic/field.js.map +1 -0
  117. package/dist/texture/topographic/index.d.ts +17 -0
  118. package/dist/texture/topographic/index.d.ts.map +1 -0
  119. package/dist/texture/topographic/index.js +48 -0
  120. package/dist/texture/topographic/index.js.map +1 -0
  121. package/dist/theme/presets.d.ts +13 -5
  122. package/dist/theme/presets.d.ts.map +1 -1
  123. package/dist/theme/presets.js +16 -5
  124. package/dist/theme/presets.js.map +1 -1
  125. package/dist/types.d.ts +231 -3
  126. package/dist/types.d.ts.map +1 -1
  127. package/dist/validate/collect.d.ts.map +1 -1
  128. package/dist/validate/collect.js +2 -1
  129. package/dist/validate/collect.js.map +1 -1
  130. package/dist/validate/keys.d.ts +37 -0
  131. package/dist/validate/keys.d.ts.map +1 -1
  132. package/dist/validate/keys.js +130 -2
  133. package/dist/validate/keys.js.map +1 -1
  134. package/dist/validate/texture.d.ts +4 -5
  135. package/dist/validate/texture.d.ts.map +1 -1
  136. package/dist/validate/texture.js +11 -20
  137. package/dist/validate/texture.js.map +1 -1
  138. package/dist/validate/values.d.ts +6 -0
  139. package/dist/validate/values.d.ts.map +1 -1
  140. package/dist/validate/values.js +16 -1
  141. package/dist/validate/values.js.map +1 -1
  142. package/package.json +3 -10
  143. package/dist/templates/terminal/window.d.ts.map +0 -1
  144. package/dist/templates/terminal/window.js +0 -84
  145. package/dist/templates/terminal/window.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/templates/code/mark/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAItC;;;;;;;;;GASG;AACH,MAAM,UAAU,SAAS,CACvB,KAAqB,EACrB,KAAwC,EACxC,OAAoB,EACpB,MAAsB;IAEtB,4EAA4E;IAC5E,6DAA6D;IAC7D,MAAM,QAAQ,GAAY,KAAK,CAAC,MAAM,CAAC,CAAC;IACxC,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,IAAI,KAAK,GAAG,EAAE,CAAC;IAEf,KAAK,MAAM,IAAI,IAAI,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC;QAC/C,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAErC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,QAAQ,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;YAC5D,SAAS;QACX,CAAC;QAED,KAAK,IAAI,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC3D,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,CAAC,SAAS,CACd,aAAa,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YACnE,qCAAqC,CACxC,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { CodeToken } from "../../../highlight/index.js";
2
+ import type { CodeMark } from "./read.js";
3
+ /** Where a mark landed on the character grid, once it was found. */
4
+ export interface MarkSpan {
5
+ /** Zero-based, into the lines being drawn. */
6
+ readonly line: number;
7
+ readonly column: number;
8
+ /** Characters, or `undefined` for the whole line. */
9
+ readonly length: number | undefined;
10
+ readonly color: string | undefined;
11
+ }
12
+ /**
13
+ * Turn a declared mark into grid coordinates, or nothing where it names
14
+ * something the image does not show.
15
+ *
16
+ * A mark naming a line and no column is the whole line, which is the band an
17
+ * editor draws rather than a box around a word.
18
+ */
19
+ export declare function locateMark(mark: CodeMark, lines: readonly (readonly CodeToken[])[]): MarkSpan | undefined;
20
+ //# sourceMappingURL=locate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locate.d.ts","sourceRoot":"","sources":["../../../../src/templates/code/mark/locate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE1C,oEAAoE;AACpE,MAAM,WAAW,QAAQ;IACvB,8CAA8C;IAC9C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,qDAAqD;IACrD,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC;AAsCD;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,SAAS,CAAC,SAAS,SAAS,EAAE,CAAC,EAAE,GACvC,QAAQ,GAAG,SAAS,CAyBtB"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * One line as plain text, rebuilt from the tokens by putting each back at its
3
+ * own column.
4
+ *
5
+ * The tokens are what survived highlighting, fitting and clipping, so this is
6
+ * the line as it will be drawn rather than as it was written. Searching what
7
+ * is drawn is the point: a mark on a line that was dropped has nowhere to go,
8
+ * and finding it in the original snippet would only mean drawing a box in the
9
+ * wrong place.
10
+ */
11
+ function lineText(tokens) {
12
+ let text = "";
13
+ for (const token of tokens) {
14
+ text = text.padEnd(token.column, " ") + token.text;
15
+ }
16
+ return text;
17
+ }
18
+ /** The first line holding the text, and where on it. */
19
+ function findText(text, lines) {
20
+ for (const [line, tokens] of lines.entries()) {
21
+ const column = lineText(tokens).indexOf(text);
22
+ if (column !== -1) {
23
+ return { line, column };
24
+ }
25
+ }
26
+ return undefined;
27
+ }
28
+ /**
29
+ * Turn a declared mark into grid coordinates, or nothing where it names
30
+ * something the image does not show.
31
+ *
32
+ * A mark naming a line and no column is the whole line, which is the band an
33
+ * editor draws rather than a box around a word.
34
+ */
35
+ export function locateMark(mark, lines) {
36
+ const color = mark.color;
37
+ if (mark.text !== undefined) {
38
+ const found = findText(mark.text, lines);
39
+ return found === undefined
40
+ ? undefined
41
+ : { ...found, length: mark.length ?? mark.text.length, color };
42
+ }
43
+ const line = (mark.line ?? 0) - 1;
44
+ if (line < 0 || line >= lines.length) {
45
+ return undefined;
46
+ }
47
+ return mark.column === undefined
48
+ ? { line, column: 0, length: undefined, color }
49
+ : {
50
+ line,
51
+ column: mark.column - 1,
52
+ length: mark.length ?? 1,
53
+ color,
54
+ };
55
+ }
56
+ //# sourceMappingURL=locate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locate.js","sourceRoot":"","sources":["../../../../src/templates/code/mark/locate.ts"],"names":[],"mappings":"AAaA;;;;;;;;;GASG;AACH,SAAS,QAAQ,CAAC,MAA4B;IAC5C,IAAI,IAAI,GAAG,EAAE,CAAC;IAEd,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC;IACrD,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,wDAAwD;AACxD,SAAS,QAAQ,CACf,IAAY,EACZ,KAAwC;IAExC,KAAK,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;QAC7C,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAE9C,IAAI,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC;YAClB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAC1B,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CACxB,IAAc,EACd,KAAwC;IAExC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;IAEzB,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC5B,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAEzC,OAAO,KAAK,KAAK,SAAS;YACxB,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC;IACnE,CAAC;IAED,MAAM,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IAElC,IAAI,IAAI,GAAG,CAAC,IAAI,IAAI,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QACrC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,IAAI,CAAC,MAAM,KAAK,SAAS;QAC9B,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE;QAC/C,CAAC,CAAC;YACE,IAAI;YACJ,MAAM,EAAE,IAAI,CAAC,MAAM,GAAG,CAAC;YACvB,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,CAAC;YACxB,KAAK;SACN,CAAC;AACR,CAAC"}
@@ -0,0 +1,30 @@
1
+ import type { ResolvedConfig } from "../../../types.js";
2
+ /**
3
+ * One thing a post asked to have marked on its snippet.
4
+ *
5
+ * `text` names it by what it says, which is what frontmatter usually wants: it
6
+ * survives the snippet being edited above the line, and it is what somebody
7
+ * would type. `line` and `column` name it by where it is, for the times the
8
+ * same text appears twice or the thing worth marking is a whole line.
9
+ */
10
+ export interface CodeMark {
11
+ readonly text?: string;
12
+ /** One-based, as an editor counts. */
13
+ readonly line?: number;
14
+ /** One-based. Omit it, with no `text`, to mark the whole line. */
15
+ readonly column?: number;
16
+ /** Characters from `column`. Defaults to what `text` is, or the line. */
17
+ readonly length?: number;
18
+ /** Defaults to the palette's warm accent. */
19
+ readonly color?: string;
20
+ }
21
+ /**
22
+ * The marks a post declared: one, or a list of them.
23
+ *
24
+ * Anything that is neither a string nor an object saying where to look is a
25
+ * mistake in the frontmatter, and it is reported rather than dropped. A mark
26
+ * that goes missing is invisible in the finished image, so nothing else would
27
+ * ever say the post asked for one.
28
+ */
29
+ export declare function readMarks(declared: unknown, config: ResolvedConfig): readonly CodeMark[];
30
+ //# sourceMappingURL=read.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../../../src/templates/code/mark/read.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD;;;;;;;GAOG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,sCAAsC;IACtC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,kEAAkE;IAClE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,yEAAyE;IACzE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,6CAA6C;IAC7C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AA8CD;;;;;;;GAOG;AACH,wBAAgB,SAAS,CACvB,QAAQ,EAAE,OAAO,EACjB,MAAM,EAAE,cAAc,GACrB,SAAS,QAAQ,EAAE,CAuBrB"}
@@ -0,0 +1,61 @@
1
+ import { optionalString } from "../../../props.js";
2
+ function number(value) {
3
+ return typeof value === "number" && Number.isFinite(value)
4
+ ? value
5
+ : undefined;
6
+ }
7
+ /** One declared mark, read field by field the way a badge is. */
8
+ function markFromProps(declared) {
9
+ const read = (key) => key in declared ? declared[key] : undefined;
10
+ const text = optionalString(read("text"));
11
+ const line = number(read("line"));
12
+ if ((text === undefined || text === "") && line === undefined) {
13
+ return undefined;
14
+ }
15
+ const column = number(read("column"));
16
+ const length = number(read("length"));
17
+ const color = optionalString(read("color"));
18
+ return {
19
+ ...(text !== undefined && text !== "" && { text }),
20
+ ...(line !== undefined && { line }),
21
+ ...(column !== undefined && { column }),
22
+ ...(length !== undefined && { length }),
23
+ ...(color !== undefined && { color }),
24
+ };
25
+ }
26
+ /** A string is the text to find, and an object is read for its fields. */
27
+ function markFromValue(declared) {
28
+ const text = optionalString(declared);
29
+ if (text !== undefined) {
30
+ return text === "" ? undefined : { text };
31
+ }
32
+ return typeof declared === "object" && declared !== null
33
+ ? markFromProps(declared)
34
+ : undefined;
35
+ }
36
+ /**
37
+ * The marks a post declared: one, or a list of them.
38
+ *
39
+ * Anything that is neither a string nor an object saying where to look is a
40
+ * mistake in the frontmatter, and it is reported rather than dropped. A mark
41
+ * that goes missing is invisible in the finished image, so nothing else would
42
+ * ever say the post asked for one.
43
+ */
44
+ export function readMarks(declared, config) {
45
+ if (declared === undefined) {
46
+ return [];
47
+ }
48
+ const values = Array.isArray(declared) ? declared : [declared];
49
+ const marks = [];
50
+ for (const value of values) {
51
+ const mark = markFromValue(value);
52
+ if (mark === undefined) {
53
+ config.onWarning(`code mark ${JSON.stringify(value)} says nothing to mark:` +
54
+ ` give it text to find, or a line to draw across.`);
55
+ continue;
56
+ }
57
+ marks.push(mark);
58
+ }
59
+ return marks;
60
+ }
61
+ //# sourceMappingURL=read.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read.js","sourceRoot":"","sources":["../../../../src/templates/code/mark/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAuBnD,SAAS,MAAM,CAAC,KAAc;IAC5B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QACxD,CAA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AAC,CAAC;IAEtC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;IAC5C,CAAC;IAED,OAAO,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI;QACtD,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC;QACzB,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,SAAS,CACvB,QAAiB,EACjB,MAAsB;IAEtB,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC/D,MAAM,KAAK,GAAe,EAAE,CAAC;IAE7B,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,IAAI,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;QAElC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,MAAM,CAAC,SAAS,CACd,aAAa,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,wBAAwB;gBACxD,kDAAkD,CACrD,CAAC;YACF,SAAS;QACX,CAAC;QAED,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -1,3 +1,4 @@
1
+ import type { ResolvedConfig } from "../../types.js";
1
2
  import type { Panel } from "./panel.js";
2
3
  /**
3
4
  * Shrink a panel onto its content, keeping it centred in the space it was
@@ -12,6 +13,11 @@ export declare function hugPanel(available: Panel, wanted: {
12
13
  * The panel itself: a drop shadow, then the theme-coloured surface it sits on.
13
14
  * The surface is stroked rather than left flat, so a dark theme still has an
14
15
  * edge against a dark background.
16
+ *
17
+ * A panel the background shows through casts no shadow. The shadow is the same
18
+ * rectangle offset a few pixels, so a translucent surface shows most of it as
19
+ * a dark wash across the panel, which reads as a smudge rather than as depth.
20
+ * A pane of glass is not a raised card, and this is the difference.
15
21
  */
16
- export declare function panelSvg(available: Panel, background: string, shadowOffset: number): string;
22
+ export declare function panelSvg(available: Panel, background: string, shadowOffset: number, config: ResolvedConfig): string;
17
23
  //# sourceMappingURL=plate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plate.d.ts","sourceRoot":"","sources":["../../../src/templates/code/plate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;;GAIG;AACH,wBAAgB,QAAQ,CACtB,SAAS,EAAE,KAAK,EAChB,MAAM,EAAE;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC1D,KAAK,CAmBP;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CACtB,SAAS,EAAE,KAAK,EAChB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,GACnB,MAAM,CAQR"}
1
+ {"version":3,"file":"plate.d.ts","sourceRoot":"","sources":["../../../src/templates/code/plate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;;GAIG;AACH,wBAAgB,QAAQ,CACtB,SAAS,EAAE,KAAK,EAChB,MAAM,EAAE;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC1D,KAAK,CAmBP;AAED;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CACtB,SAAS,EAAE,KAAK,EAChB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,cAAc,GACrB,MAAM,CAcR"}
@@ -21,14 +21,24 @@ export function hugPanel(available, wanted) {
21
21
  * The panel itself: a drop shadow, then the theme-coloured surface it sits on.
22
22
  * The surface is stroked rather than left flat, so a dark theme still has an
23
23
  * edge against a dark background.
24
+ *
25
+ * A panel the background shows through casts no shadow. The shadow is the same
26
+ * rectangle offset a few pixels, so a translucent surface shows most of it as
27
+ * a dark wash across the panel, which reads as a smudge rather than as depth.
28
+ * A pane of glass is not a raised card, and this is the difference.
24
29
  */
25
- export function panelSvg(available, background, shadowOffset) {
30
+ export function panelSvg(available, background, shadowOffset, config) {
31
+ const { panelOpacity, borderColor, borderOpacity } = config.code;
32
+ // A full-opacity surface says nothing about its opacity, which keeps the
33
+ // common case's output to what the template actually decided.
26
34
  return panel(available, {
27
35
  radius: available.radius,
28
36
  fill: background,
29
- stroke: "#ffffff",
30
- strokeOpacity: 0.12,
31
- shadow: shadowOffset,
37
+ stroke: borderColor,
38
+ strokeOpacity: borderOpacity,
39
+ ...(panelOpacity < 1
40
+ ? { fillOpacity: panelOpacity }
41
+ : { shadow: shadowOffset }),
32
42
  });
33
43
  }
34
44
  //# sourceMappingURL=plate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"plate.js","sourceRoot":"","sources":["../../../src/templates/code/plate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAG9C;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CACtB,SAAgB,EAChB,MAA2D;IAE3D,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CACpB,SAAS,CAAC,KAAK,EACf,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CACvE,CAAC;IACF,uEAAuE;IACvE,uE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,CAAC,CACvE,CAAC;IACF,uEAAuE;IACvE,uEAAuE;IACvE,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CACrB,SAAS,CAAC,MAAM,EAChB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAC9D,CAAC;IAEF,OAAO;QACL,GAAG,SAAS;QACZ,CAAC,EAAE,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;QAC1D,CAAC,EAAE,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC5D,KAAK;QACL,MAAM;KACP,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,QAAQ,CACtB,SAAgB,EAChB,UAAkB,EAClB,YAAoB,EACpB,MAAsB;IAEtB,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC;IAEjE,yEAAyE;IACzE,8DAA8D;IAC9D,OAAO,KAAK,CAAC,SAAS,EAAE;QACtB,MAAM,EAAE,SAAS,CAAC,MAAM;QACxB,IAAI,EAAE,UAAU;QAChB,MAAM,EAAE,WAAW;QACnB,aAAa,EAAE,aAAa;QAC5B,GAAG,CAAC,YAAY,GAAG,CAAC;YAClB,CAAC,CAAC,EAAE,WAAW,EAAE,YAAY,EAAE;YAC/B,CAAC,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC;KAC9B,CAAC,CAAC;AACL,CAAC"}
@@ -1,4 +1,12 @@
1
- import type { ResolvedConfig } from "../types.js";
1
+ import type { Dimensions, ResolvedConfig } from "../types.js";
2
+ /**
3
+ * The size the line along the bottom is drawn at.
4
+ *
5
+ * Every template asks for it here rather than working it out, which is what
6
+ * stops the twelve of them drifting apart. It is one number for the footer,
7
+ * the byline and the attribution alike, since they are all the same line.
8
+ */
9
+ export declare function footerFontSize(dimensions: Dimensions): number;
2
10
  /**
3
11
  * Where and how a template wants its footer drawn. Every template places the
4
12
  * footer differently; what they share is that a config with no footer, or an
@@ -1 +1 @@
1
- {"version":3,"file":"footer.d.ts","sourceRoot":"","sources":["../../src/templates/footer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;CAC9C;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,GACf,MAAM,CAER;AAED,yDAAyD;AACzD,wBAAgB,SAAS,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAEzD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,cAAc,EACtB,SAAS,EAAE,eAAe,GACzB,MAAM,CAeR"}
1
+ {"version":3,"file":"footer.d.ts","sourceRoot":"","sources":["../../src/templates/footer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAkB9D;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAO7D;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;CAC9C;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,GACf,MAAM,CAER;AAED,yDAAyD;AACzD,wBAAgB,SAAS,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAEzD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,cAAc,EACtB,SAAS,EAAE,eAAe,GACzB,MAAM,CAeR"}
@@ -1,4 +1,28 @@
1
1
  import { baselineFor, textElement } from "../layout/index.js";
2
+ /** The footer's size, as a fraction of the image's height. */
3
+ const footerScale = 0.036;
4
+ /**
5
+ * The least it may be, as a fraction of the image's width.
6
+ *
7
+ * Height alone is what the footer used to be measured against, and it left the
8
+ * landscape sizes with the smallest text on the least of it: at 1200x630 the
9
+ * line came out at 20px against the square's 38px, on an image a feed scales
10
+ * to the same width. Width is what legibility tracks, for the reason the code
11
+ * template's font-size bounds are fractions of it, so this is the floor that
12
+ * stops a wide image having a footer nobody can read. The square is above it
13
+ * and keeps the proportions it had.
14
+ */
15
+ const footerWidthFloor = 0.026;
16
+ /**
17
+ * The size the line along the bottom is drawn at.
18
+ *
19
+ * Every template asks for it here rather than working it out, which is what
20
+ * stops the twelve of them drifting apart. It is one number for the footer,
21
+ * the byline and the attribution alike, since they are all the same line.
22
+ */
23
+ export function footerFontSize(dimensions) {
24
+ return Math.round(Math.max(dimensions.height * footerScale, dimensions.width * footerWidthFloor));
25
+ }
2
26
  /**
3
27
  * The baseline of a footer sitting on the bottom margin.
4
28
  *
@@ -1 +1 @@
1
- {"version":3,"file":"footer.js","sourceRoot":"","sources":["../../src/templates/footer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAgB9D;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,MAAc,EACd,GAAW,EACX,QAAgB;IAEhB,OAAO,WAAW,CAAC,MAAM,GAAG,GAAG,GAAG,QAAQ,EAAE,QAAQ,CAAC,CAAC;AACxD,CAAC;AAED,yDAAyD;AACzD,MAAM,UAAU,SAAS,CAAC,MAAsB;IAC9C,OAAO,MAAM,CAAC,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,MAAM,KAAK,EAAE,CAAC;AAC7D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAC3B,MAAsB,EACtB,SAA0B;IAE1B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;QACvB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,WAAW,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,EAAE;QACtC,CAAC,EAAE,SAAS,CAAC,CAAC;QACd,CAAC,EAAE,SAAS,CAAC,CAAC;QACd,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,QAAQ,EAAE,SAAS,CAAC,QAAQ;QAC5B,UAAU,EAAE,GAAG;QACf,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU;QAC9B,WAAW,EAAE,SAAS,CAAC,OAAO;QAC9B,GAAG,CAAC,SAAS,CAAC,MAAM,KAAK,SAAS,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,CAAC;KACpE,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"footer.js","sourceRoot":"","sources":["../../src/templates/footer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAG9D,8DAA8D;AAC9D,MAAM,WAA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1
- {"version":3,"file":"frame.d.ts","sourceRoot":"","sources":["../../src/templates/frame.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAW1E;;;;;;;;GAQG;AACH,MAAM,WAAW,KAAK;IACpB,yCAAyC;IACzC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,mEAAmE;IACnE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,qEAAqE;IACrE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,uDAAuD;AACvD,MAAM,WAAW,YAAY;IAC3B,sDAAsD;IACtD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,UAAU,GAAG,SAAS,EAC9B,OAAO,GAAE,YAAiB,GACzB,KAAK,CAcP;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAExE;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,SAAI,GAAG,IAAI,CAOvD;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAE1D"}
1
+ {"version":3,"file":"frame.d.ts","sourceRoot":"","sources":["../../src/templates/frame.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAQ1E;;;;;;;;GAQG;AACH,MAAM,WAAW,KAAK;IACpB,yCAAyC;IACzC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,mEAAmE;IACnE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,qEAAqE;IACrE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,uDAAuD;AACvD,MAAM,WAAW,YAAY;IAC3B,sDAAsD;IACtD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,UAAU,GAAG,SAAS,EAC9B,OAAO,GAAE,YAAiB,GACzB,KAAK,CAcP;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAExE;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,SAAI,GAAG,IAAI,CAOvD;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAE1D"}
@@ -1,9 +1,7 @@
1
- import { footerBaseline, hasFooter } from "./footer.js";
1
+ import { footerBaseline, footerFontSize, hasFooter } from "./footer.js";
2
2
  import { inset } from "../layout/index.js";
3
3
  /** Margin from the image edge, as a fraction of its width. */
4
4
  const defaultPadScale = 0.075;
5
- /** The footer's size, as a fraction of the image's height. */
6
- const footerScale = 0.032;
7
5
  /** Clear space between the content and the footer line, as a fraction of it. */
8
6
  const footerGap = 0.02;
9
7
  /**
@@ -14,14 +12,14 @@ const footerGap = 0.02;
14
12
  export function imageFrame(dimensions, config, avatar, options = {}) {
15
13
  const { width, height } = dimensions;
16
14
  const pad = Math.round(width * (options.padScale ?? defaultPadScale));
17
- const footerFontSize = Math.round(height * footerScale);
15
+ const fontSize = footerFontSize(dimensions);
18
16
  const isDrawn = options.footer === true || hasFooter(config) || avatar !== undefined;
19
17
  return {
20
18
  pad,
21
- footerFontSize,
19
+ footerFontSize: fontSize,
22
20
  full: { x: 0, y: 0, width, height },
23
- footerRoom: isDrawn ? footerFontSize + Math.round(height * footerGap) : 0,
24
- footerY: footerBaseline(height, pad, footerFontSize),
21
+ footerRoom: isDrawn ? fontSize + Math.round(height * footerGap) : 0,
22
+ footerY: footerBaseline(height, pad, fontSize),
25
23
  };
26
24
  }
27
25
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"frame.js","sourceRoot":"","sources":["../../src/templates/frame.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAI3C,8DAA8D;AAC9D,MAAM,eAAe,GAAG,KAAK,CAAC;AAE9B,8DAA8D;AAC9D,MAAM,WAAW,GAAG,KAAK,CAAC;AAE1B,gFAAgF;AAChF,MAAM,SAAS,GAAG,IAAI,CAAC;AAsCvB;;;;GAIG;AACH,MAAM,UAAU,UAAU,CACxB,UAAsB,EACtB,MAAsB,EACtB,MAA8B,EAC9B,OAAO,GAAiB,EAAE;IAE1B,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC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AC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,MAA0B,EAAE,GAAW;IAC9D,OAAO,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,GAAG,CAAC;AACjE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,KAAY,EAAE,GAAG,GAAG,CAAC;IAC/C,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE;QACvB,GAAG,EAAE,KAAK,CAAC,GAAG,GAAG,GAAG;QACpB,KAAK,EAAE,KAAK,CAAC,GAAG;QAChB,IAAI,EAAE,KAAK,CAAC,GAAG;QACf,MAAM,EAAE,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC,UAAU;KACrC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY,EAAE,GAAW;IAChD,OAAO,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AAC9B,CAAC"}
@@ -7,9 +7,9 @@ import { hugPanel, panelSvg } from "../code/plate.js";
7
7
  import { codeBody } from "../code/spans.js";
8
8
  import { warnIfTruncated } from "../code/warn.js";
9
9
  import { charWidthRatio } from "../code/width.js";
10
- import { hasFooter } from "../footer.js";
10
+ import { footerFontSize, hasFooter } from "../footer.js";
11
+ import { barHeight, titleBar } from "../window/index.js";
11
12
  import { terminalSession } from "./session.js";
12
- import { barHeight, titleBar } from "./window.js";
13
13
  /**
14
14
  * A command and what it printed, in a terminal window.
15
15
  *
@@ -27,7 +27,7 @@ export const terminalTemplate = {
27
27
  name: "terminal",
28
28
  async render({ props, config, dimensions, measure }) {
29
29
  const { width, height } = dimensions;
30
- const footerFs = Math.round(height * 0.032);
30
+ const footerFs = footerFontSize(dimensions);
31
31
  const session = await terminalSession(props, config);
32
32
  const available = layoutPanel(dimensions, config, 0, footerFs, false, hasFooter(config));
33
33
  // The bar is measured against the space the window was allotted rather
@@ -45,7 +45,7 @@ export const terminalTemplate = {
45
45
  height: bar + body + fitted.padding * 2,
46
46
  });
47
47
  const shadow = Math.max(1, Math.round(Math.min(width, height) * 0.01));
48
- return (panelSvg(window, session.background, shadow) +
48
+ return (panelSvg(window, session.background, shadow, config) +
49
49
  titleBar(window, bar, optionalString(props.title) ?? "", config, measure) +
50
50
  codeBody(fitted.lines, {
51
51
  originX: window.x + fitted.padding,
@@ -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,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,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,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAa;IACxC,IAAI,EAAE,UAAU;IAChB,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE;QACjD,MAAM,EAAE,KAA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,CAAC,QAAQ;gBACzB,SAAS,EAAE,MAAM,CAAC,SAAS;gBAC3B,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU;gBAClC,UAAU,EAAE,OAAO,CAAC,UAAU;aAC/B,CAAC;YACF,UAAU,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC,CACzC,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -0,0 +1,11 @@
1
+ /** Which buttons a window's bar carries. */
2
+ export type WindowDots = "mono" | "macos";
3
+ /** Where the buttons sit in the bar, and how big they are. */
4
+ export interface DotsLayout {
5
+ readonly left: number;
6
+ readonly middle: number;
7
+ readonly diameter: number;
8
+ }
9
+ /** The row of buttons at the left of the bar. */
10
+ export declare function windowDots(dots: WindowDots, layout: DotsLayout): string;
11
+ //# sourceMappingURL=dots.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dots.d.ts","sourceRoot":"","sources":["../../../src/templates/window/dots.ts"],"names":[],"mappings":"AAGA,4CAA4C;AAC5C,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC;AAuB1C,8DAA8D;AAC9D,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,iDAAiD;AACjD,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,GAAG,MAAM,CAevE"}
@@ -0,0 +1,32 @@
1
+ import { box } from "../../layout/index.js";
2
+ /**
3
+ * The three buttons, in the colours every reader has seen on a window.
4
+ *
5
+ * They are not the site's colours and are not meant to be. The point of the
6
+ * chrome is that the image is recognised as a window before a word of it is
7
+ * read, and these are what does the recognising.
8
+ *
9
+ * The neutral set says the same thing without borrowing an operating system's
10
+ * colours, which is what a snippet on a site with a palette of its own usually
11
+ * wants. The terminal draws the coloured ones, since a terminal is a window
12
+ * somebody has seen rather than a decorated panel.
13
+ */
14
+ const macosButtons = ["#ff5f57", "#febc2e", "#28c840"];
15
+ /** One button's fill, which for the neutral set is the bar's own tone. */
16
+ function buttonStyle(dots, index) {
17
+ return dots === "macos"
18
+ ? { fill: macosButtons[index] ?? "#ffffff" }
19
+ : { fill: "#ffffff", fillOpacity: 0.28 };
20
+ }
21
+ /** The row of buttons at the left of the bar. */
22
+ export function windowDots(dots, layout) {
23
+ const { left, middle, diameter } = layout;
24
+ const gap = Math.round(diameter * 1.7);
25
+ return Array.from({ length: macosButtons.length }, (_unused, index) => box({
26
+ x: left + index * gap,
27
+ y: middle - Math.round(diameter / 2),
28
+ width: diameter,
29
+ height: diameter,
30
+ }, { radius: Math.round(diameter / 2), ...buttonStyle(dots, index) })).join("");
31
+ }
32
+ //# sourceMappingURL=dots.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dots.js","sourceRoot":"","sources":["../../../src/templates/window/dots.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAM5C;;;;;;;;;;;GAWG;AACH,MAAM,YAAY,GAAsB,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AAE1E,0EAA0E;AAC1E,SAAS,WAAW,CAAC,IAAgB,EAAE,KAAa;IAClD,OAAO,IAAI,KAAK,OAAO;QACrB,CAAC,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,KAAK,CAAC,IAAI,SAAS,EAAE;QAC5C,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;AAC7C,CAAC;AASD,iDAAiD;AACjD,MAAM,UAAU,UAAU,CAAC,IAAgB,EAAE,MAAkB;IAC7D,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;IAC1C,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,GAAG,CAAC,CAAC;IAEvC,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CACpE,GAAG,CACD;QACE,CAAC,EAAE,IAAI,GAAG,KAAK,GAAG,GAAG;QACrB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC;QACpC,KAAK,EAAE,QAAQ;QACf,MAAM,EAAE,QAAQ;KACjB,EACD,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC,EAAE,GAAG,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAClE,CACF,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACb,CAAC"}
@@ -1,5 +1,7 @@
1
1
  import type { MeasureText, ResolvedConfig } from "../../types.js";
2
2
  import type { Panel } from "../code/panel.js";
3
+ import type { WindowDots } from "./dots.js";
4
+ export type { WindowDots } from "./dots.js";
3
5
  /** How tall the title bar is on a window of this width. */
4
6
  export declare function barHeight(windowWidth: number): number;
5
7
  /**
@@ -10,5 +12,5 @@ export declare function barHeight(windowWidth: number): number;
10
12
  * lifts whatever the code theme's background happens to be instead of having
11
13
  * to be chosen against it.
12
14
  */
13
- export declare function titleBar(window: Panel, height: number, title: string, config: ResolvedConfig, measure: MeasureText): string;
14
- //# sourceMappingURL=window.d.ts.map
15
+ export declare function titleBar(window: Panel, height: number, title: string, config: ResolvedConfig, measure: MeasureText, dots?: WindowDots): string;
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/window/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAG5C,YAAY,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAQ5C,2DAA2D;AAC3D,wBAAgB,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAErD;AAwBD;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CACtB,MAAM,EAAE,KAAK,EACb,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,WAAW,EACpB,IAAI,GAAE,UAAoB,GACzB,MAAM,CAeR"}
@@ -0,0 +1,48 @@
1
+ import { box } from "../../layout/index.js";
2
+ import { windowDots } from "./dots.js";
3
+ import { windowTitle } from "./title.js";
4
+ /** The title bar's height, as a fraction of the window's width. */
5
+ const barScale = 0.055;
6
+ /** The buttons' diameter, as a fraction of the bar's height. */
7
+ const buttonScale = 0.26;
8
+ /** How tall the title bar is on a window of this width. */
9
+ export function barHeight(windowWidth) {
10
+ return Math.round(windowWidth * barScale);
11
+ }
12
+ /**
13
+ * A rectangle with its top corners rounded and its bottom ones square, which
14
+ * is the shape of a title bar sitting in the top of a rounded window.
15
+ *
16
+ * It has to be one shape rather than a rounded rectangle with a square one
17
+ * over its bottom half, which is the obvious way to do it and the wrong one:
18
+ * the band is drawn at low opacity, so anywhere the two overlapped would be
19
+ * painted twice and come out as a lighter block with a curve through it.
20
+ */
21
+ function roundedTop(rect, radius) {
22
+ const { x, y, width, height } = rect;
23
+ const r = Math.min(radius, Math.round(width / 2), height);
24
+ return (`M${String(x)} ${String(y + r)}` +
25
+ `a${String(r)} ${String(r)} 0 0 1 ${String(r)} ${String(-r)}` +
26
+ `h${String(width - r * 2)}` +
27
+ `a${String(r)} ${String(r)} 0 0 1 ${String(r)} ${String(r)}` +
28
+ `v${String(height - r)}h${String(-width)}z`);
29
+ }
30
+ /**
31
+ * The bar across the top of the window: a lighter band, the buttons, and the
32
+ * title in the middle of what is left.
33
+ *
34
+ * The band is white at low opacity rather than a colour of its own, so it
35
+ * lifts whatever the code theme's background happens to be instead of having
36
+ * to be chosen against it.
37
+ */
38
+ export function titleBar(window, height, title, config, measure, dots = "macos") {
39
+ const band = `<path d="${roundedTop({ x: window.x, y: window.y, width: window.width, height }, window.radius)}"` +
40
+ ` fill="#ffffff" fill-opacity="0.07"/>${box({ x: window.x, y: window.y + height, width: window.width, height: 1 }, { fill: "#ffffff", fillOpacity: 0.1 })}`;
41
+ const lights = windowDots(dots, {
42
+ left: window.x + Math.round(height * 0.6),
43
+ middle: window.y + Math.round(height / 2),
44
+ diameter: Math.round(height * buttonScale),
45
+ });
46
+ return band + lights + windowTitle(title, window, height, config, measure);
47
+ }
48
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/window/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAI5C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAIzC,mEAAmE;AACnE,MAAM,QAAQ,GAAG,KAAK,CAAC;AAEvB,gEAAgE;AAChE,MAAM,WAAW,GAAG,IAAI,CAAC;AAEzB,2DAA2D;AAC3D,MAAM,UAAU,SAAS,CAAC,WAAmB;IAC3C,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,QAAQ,CAAC,CAAC;AAC5C,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,UAAU,CAAC,IAAU,EAAE,MAAc;IAC5C,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACrC,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAA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AE;QAC9B,IAAI,EAAE,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,CAAC;QACzC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;QACzC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,WAAW,CAAC;KAC3C,CAAC,CAAC;IAEH,OAAO,IAAI,GAAG,MAAM,GAAG,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAC7E,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { MeasureText, ResolvedConfig } from "../../types.js";
2
+ import type { Panel } from "../code/panel.js";
3
+ /**
4
+ * The window's title, centred in the bar. It is cut to the room between the
5
+ * buttons and the far edge, taking the buttons' width off both sides so that
6
+ * it stays centred in the bar rather than in what the buttons left.
7
+ */
8
+ export declare function windowTitle(title: string, window: Panel, height: number, config: ResolvedConfig, measure: MeasureText): string;
9
+ //# sourceMappingURL=title.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"title.d.ts","sourceRoot":"","sources":["../../../src/templates/window/title.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,KAAK,EACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,WAAW,GACnB,MAAM,CA0BR"}
@@ -0,0 +1,24 @@
1
+ import { baselineFor, clampLine, measureIn, textElement, } from "../../layout/index.js";
2
+ /**
3
+ * The window's title, centred in the bar. It is cut to the room between the
4
+ * buttons and the far edge, taking the buttons' width off both sides so that
5
+ * it stays centred in the bar rather than in what the buttons left.
6
+ */
7
+ export function windowTitle(title, window, height, config, measure) {
8
+ if (title === "") {
9
+ return "";
10
+ }
11
+ const fontSize = Math.round(height * 0.42);
12
+ const reserved = Math.round(height * 2.4);
13
+ return textElement(clampLine(title, window.width - reserved * 2, measureIn(measure, config.fontFamily, 600), fontSize), {
14
+ x: Math.round(window.x + window.width / 2),
15
+ y: baselineFor(window.y + (height - fontSize) / 2, fontSize),
16
+ fontFamily: config.fontFamily,
17
+ fontSize,
18
+ fontWeight: 600,
19
+ fill: "#ffffff",
20
+ fillOpacity: 0.6,
21
+ anchor: "middle",
22
+ });
23
+ }
24
+ //# sourceMappingURL=title.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"title.js","sourceRoot":"","sources":["../../../src/templates/window/title.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,SAAS,EACT,SAAS,EACT,WAAW,GACZ,MAAM,uBAAuB,CAAC;AAI/B;;;;GAIG;AACH,MAAM,UAAU,WAAW,CACzB,KAAa,EACb,MAAa,EACb,MAAc,EACd,MAAsB,EACtB,OAAoB;IAEpB,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;QACjB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC;IAE1C,OAAO,WAAW,CAChB,SAAS,CACP,KAAK,EACL,MAAM,CAAC,KAAK,GAAG,QAAQ,GAAG,CAAC,EAC3B,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC,EAC1C,QAAQ,CACT,EACD;QACE,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC;QAC1C,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC;QAC5D,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,QAAQ;QACR,UAAU,EAAE,GAAG;QACf,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,GAAG;QAChB,MAAM,EAAE,QAAQ;KACjB,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { Dimensions, Texture } from "../types.js";
2
+ /**
3
+ * Rows of chevrons: one V to a tile, meeting its neighbours at the tile edge.
4
+ *
5
+ * The V spans the whole width and stops short of the top and bottom, so the
6
+ * rows have air between them. Its ends sit at the same height on both edges,
7
+ * which is what makes one tile's chevron continue into the next rather than
8
+ * ending in a corner.
9
+ */
10
+ export declare function chevronsSvg(texture: Extract<Texture, {
11
+ readonly type: "chevrons";
12
+ }>, dimensions: Dimensions, id: string): string;
13
+ //# sourceMappingURL=chevrons.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chevrons.d.ts","sourceRoot":"","sources":["../../src/texture/chevrons.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAMvD;;;;;;;GAOG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,EACxD,UAAU,EAAE,UAAU,EACtB,EAAE,EAAE,MAAM,GACT,MAAM,CAkBR"}