@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
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/astro/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE;QAGd,QAAQ,CAAC,oBAAoB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;KACpD,CAAC;CACH;AAED,kEAAkE;AAClE,MAAM,MAAM,0BAA0B,GAAG,eAAe,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAC9B,OAAO,EAAE,0BAA0B,GAClC,gBAAgB,CAUlB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/astro/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE;QAEd,QAAQ,CAAC,oBAAoB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;KACpD,CAAC;CACH;AAED,kEAAkE;AAClE,MAAM,MAAM,0BAA0B,GAAG,eAAe,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAC9B,OAAO,EAAE,0BAA0B,GAClC,gBAAgB,CASlB"}
@@ -32,7 +32,6 @@ export default function colophon(options) {
32
32
  return {
33
33
  name: "@kensio/colophon",
34
34
  hooks: {
35
- // eslint-disable-next-line @typescript-eslint/naming-convention
36
35
  "astro:config:setup": async () => {
37
36
  await generate(options);
38
37
  },
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/astro/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAwBhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAC9B,OAAmC;IAEnC,OAAO;QACL,IAAI,EAAE,kBAAkB;QACxB,KAAK,EAAE;YACL,gEAAgE;YAChE,oBAAoB,EAAE,KAAK,IAAmB,EAAE;gBAC9C,MAAM,QAAQ,CAAC,OAAO,CAAC,CAAC;YAC1B,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/astro/index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AAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAKhD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,8FACkD,CAAC;AAExF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,SAAS,CAalD,CAAC"}
@@ -98,5 +98,10 @@ export const DEFAULT_CODE_STYLE = {
98
98
  cornerScale: 0.025,
99
99
  maxFontScale: 0.075,
100
100
  minFontScale: 0.025,
101
+ lineNumbers: false,
102
+ chrome: "none",
103
+ panelOpacity: 1,
104
+ borderColor: "#ffffff",
105
+ borderOpacity: 0.12,
101
106
  };
102
107
  //# sourceMappingURL=defaults.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../src/config/defaults.ts"],"names":[],"mappings":"AAOA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE;IAC5C,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;IACrD,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE;IACtD,SAAS,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;CACd,CAAC;AAEhD;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAA0B;IAClD,YAAY,CAAC,EAAE;IACf,YAAY,CAAC,MAAM;CACpB,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,8BAA8B,CAAC;AAElE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAE3C;;;GAGG;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,SAAS,CAAC;AAIpC,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE9D;;;;GAIG;AACH,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB;AA2FD,+EAA+E;AAC/E,wBAAsB,SAAS,CAC7B,KAAK,EAAE,SAAS,UAAU,EAAE,EAC5B,SAAS,EAAE,cAAc,GACxB,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC,CAM1B"}
1
+ {"version":3,"file":"faces.d.ts","sourceRoot":"","sources":["../../src/measure/faces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAIpC,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE9D;;;;GAIG;AACH,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB;AA0FD,+EAA+E;AAC/E,wBAAsB,SAAS,CAC7B,KAAK,EAAE,SAAS,UAAU,EAAE,EAC5B,SAAS,EAAE,cAAc,GACxB,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC,CAM1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"faces.js","sourceRoot":"","sources":["../../src/measure/faces.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAc9D;;;GAGG;AACH,MAAM,MAAM,GAAG,IAAI,GAAG,EAAoC,CAAC;AAE3D;;;;GAIG;AACH,MAAM,MAAM,GAAG,IAAI,OAAO,EAAwC,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M,EAAE,CAC/C,CAAC;QACF,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,SAAS,MAAM,CACb,IAAgB,EAChB,SAAyB;IAEzB,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;QACnB,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC/D,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC/B,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAC/D,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/B,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,+EAA+E;AAC/E,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,KAA4B,EAC5B,SAAyB;IAEzB,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,GAAG,CAC9B,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CACnD,CAAC;IAEF,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { drawLines, inset } from "../../layout/index.js";
2
2
  import { optionalString } from "../../props.js";
3
3
  import { attribution } from "../attribution.js";
4
- import { footerBaseline, hasFooter } from "../footer.js";
4
+ import { footerBaseline, footerFontSize, hasFooter } from "../footer.js";
5
5
  import { logoElement, logoRect } from "../logo.js";
6
6
  import { badgeFor } from "./badge-props.js";
7
7
  import { renderBadge } from "./badge.js";
@@ -21,7 +21,7 @@ export const bannerTemplate = {
21
21
  const { width, height } = dimensions;
22
22
  const { fontFamily } = config;
23
23
  const pad = Math.round(width * 0.075);
24
- const footerFs = Math.round(height * 0.034);
24
+ const footerFs = footerFontSize(dimensions);
25
25
  const badgeHeight = Math.round(height * 0.072);
26
26
  const mark = logoRect(logo, dimensions, pad, "start");
27
27
  const badge = badgeFor(props, config);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/banner/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,cAAc,GAAa;IACtC,IAAI,EAAE,QAAQ;IACd,MAAM,CAAC,EACL,KAAK,EACL,MAAM,EACN,UAAU,EACV,OAAO,EACP,IAAI,EACJ,MAAM,GACU;QAChB,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;QACrC,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;QAC9B,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC;QACtC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC;QAC5C,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,CAA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C,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,WAAW,CAAC,CAAC;QAE5E,MAAM,MAAM,GAAG,WAAW,CACxB,MAAM,EACN;YACE,CAAC,EAAE,GAAG;YACN,CAAC,EAAE,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,CAAC;YACxC,QAAQ,EAAE,QAAQ;YAClB,OAAO,EAAE,IAAI;YACb,IAAI,EAAE,GAAG;YACT,KAAK,EAAE,KAAK,GAAG,GAAG,GAAG,CAAC;SACvB,EACD,MAAM,EACN,OAAO,CACR,CAAC;QAEF,OAAO,SAAS,GAAG,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,IAAI,GAAG,MAAM,CAAC;IAC7D,CAAC;CACF,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { drawLines, inset } from "../../layout/index.js";
2
2
  import { attribution } from "../attribution.js";
3
- import { footerBaseline, hasFooter } from "../footer.js";
3
+ import { footerBaseline, footerFontSize, hasFooter } from "../footer.js";
4
4
  import { logoElement, logoRect } from "../logo.js";
5
5
  import { cardLines } from "./lines.js";
6
6
  /**
@@ -15,7 +15,7 @@ export const cardTemplate = {
15
15
  render({ props, config, dimensions, measure, logo, avatar, }) {
16
16
  const { width, height } = dimensions;
17
17
  const pad = Math.round(width * 0.09);
18
- const footerFs = Math.round(height * 0.032);
18
+ const footerFs = footerFontSize(dimensions);
19
19
  const mark = logoRect(logo, dimensions, pad, "middle");
20
20
  const area = inset({ x: 0, y: 0, width, height }, {
21
21
  top: pad + (mark === undefined ? 0 : mark.height + pad / 2),
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/card/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC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;YACjC,MAAM;SACP,CAAC,CAAC;QAEH,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE;YAClC,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU;YAC9B,UAAU,EAAE,IAAI;YAChB,MAAM,EAAE,QAAQ;SACjB,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG,WAAW,CACxB,MAAM,EACN;YACE,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC;YACxB,CAAC,EAAE,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,CAAC;YACxC,QAAQ,EAAE,QAAQ;YAClB,OAAO,EAAE,IAAI;YACb,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,GAAG;YACT,KAAK,EAAE,KAAK,GAAG,GAAG,GAAG,CAAC;SACvB,EACD,MAAM,EACN,OAAO,CACR,CAAC;QAEF,OAAO,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,IAAI,GAAG,MAAM,CAAC;IACjD,CAAC;CACF,CAAC"}
@@ -0,0 +1,24 @@
1
+ import type { MetaImageProps, ResolvedConfig } from "../../types.js";
2
+ import type { MeasureText } from "../../types.js";
3
+ import type { Panel } from "./panel.js";
4
+ /**
5
+ * How much of the panel the window bar takes, or none where the config asks
6
+ * for no chrome.
7
+ *
8
+ * It is measured against the space the panel was allotted rather than against
9
+ * the panel it ends up as, so that the room reserved for the bar and the bar
10
+ * that is drawn are the same height.
11
+ */
12
+ export declare function barRoom(config: ResolvedConfig, allotted: number): number;
13
+ /**
14
+ * The window bar across the top of the panel, or nothing where the config asks
15
+ * for no chrome.
16
+ *
17
+ * What it holds is the post's `filename`, which is a prop of its own rather
18
+ * than the `title` the template already draws above the panel. The two say
19
+ * different things: a title is what the image is about, and a filename is
20
+ * where the code lives. Overloading one field to mean the other depending on a
21
+ * config flag would move a post's heading without the post changing.
22
+ */
23
+ export declare function windowBar(panel: Panel, height: number, props: MetaImageProps, config: ResolvedConfig, measure: MeasureText): string;
24
+ //# sourceMappingURL=bar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bar.d.ts","sourceRoot":"","sources":["../../../src/templates/code/bar.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAExE;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,cAAc,EACrB,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,WAAW,GACnB,MAAM,CAeR"}
@@ -0,0 +1,31 @@
1
+ import { optionalString } from "../../props.js";
2
+ import { barHeight, titleBar } from "../window/index.js";
3
+ /**
4
+ * How much of the panel the window bar takes, or none where the config asks
5
+ * for no chrome.
6
+ *
7
+ * It is measured against the space the panel was allotted rather than against
8
+ * the panel it ends up as, so that the room reserved for the bar and the bar
9
+ * that is drawn are the same height.
10
+ */
11
+ export function barRoom(config, allotted) {
12
+ return config.code.chrome === "none" ? 0 : barHeight(allotted);
13
+ }
14
+ /**
15
+ * The window bar across the top of the panel, or nothing where the config asks
16
+ * for no chrome.
17
+ *
18
+ * What it holds is the post's `filename`, which is a prop of its own rather
19
+ * than the `title` the template already draws above the panel. The two say
20
+ * different things: a title is what the image is about, and a filename is
21
+ * where the code lives. Overloading one field to mean the other depending on a
22
+ * config flag would move a post's heading without the post changing.
23
+ */
24
+ export function windowBar(panel, height, props, config, measure) {
25
+ const { chrome } = config.code;
26
+ if (chrome === "none") {
27
+ return "";
28
+ }
29
+ return titleBar(panel, height, optionalString(props["filename"]) ?? "", config, measure, chrome);
30
+ }
31
+ //# sourceMappingURL=bar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bar.js","sourceRoot":"","sources":["../../../src/templates/code/bar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAGzD;;;;;;;GAOG;AACH,MAAM,UAAU,OAAO,CAAC,MAAsB,EAAE,QAAgB;IAC9D,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;AACjE,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,SAAS,CACvB,KAAY,EACZ,MAAc,EACd,KAAqB,EACrB,MAAsB,EACtB,OAAoB;IAEpB,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC;IAE/B,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACtB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,QAAQ,CACb,KAAK,EACL,MAAM,EACN,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,EACvC,MAAM,EACN,OAAO,EACP,MAAM,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,30 @@
1
+ import type { CodeToken } from "../../highlight/index.js";
2
+ import type { ResolvedConfig } from "../../types.js";
3
+ /**
4
+ * Width of the gutter in characters, or none where the config wants no
5
+ * numbers.
6
+ *
7
+ * It is taken from the whole snippet rather than from the lines that survive
8
+ * fitting, so the gutter is the width the numbering needs rather than the
9
+ * width it happens to use: a snippet cut off at line 9 of 40 still reserves
10
+ * two digits, and the code does not shift when a line is dropped.
11
+ */
12
+ export declare function gutterColumns(config: ResolvedConfig, lines: number): number;
13
+ /**
14
+ * Move the code across by the width of the gutter and put a number in front of
15
+ * each line.
16
+ *
17
+ * The numbers are tokens on the same character grid as the code rather than
18
+ * text placed alongside it, which is what keeps them on the baselines the code
19
+ * is drawn on: there is one piece of arithmetic for where a line sits, and it
20
+ * stays in `codeBody` where it already was.
21
+ *
22
+ * A snippet that had lines dropped ends with the truncation marker, and that
23
+ * line is left unnumbered: it stands for the lines that are not shown, so a
24
+ * number of its own would be a number nothing has.
25
+ *
26
+ * A gutter of no columns is a snippet with the numbers turned off, and the
27
+ * lines come back untouched.
28
+ */
29
+ export declare function numberLines(lines: readonly (readonly CodeToken[])[], columns: number, dropped: number): readonly (readonly CodeToken[])[];
30
+ //# sourceMappingURL=gutter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gutter.d.ts","sourceRoot":"","sources":["../../../src/templates/code/gutter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAQrD;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAI3E;AAkBD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,SAAS,CAAC,SAAS,SAAS,EAAE,CAAC,EAAE,EACxC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GACd,SAAS,CAAC,SAAS,SAAS,EAAE,CAAC,EAAE,CAiBnC"}
@@ -0,0 +1,64 @@
1
+ /** How faint the numbers are against the code beside them. */
2
+ const numberOpacity = 0.4;
3
+ /** Columns of clear space between the numbers and the code. */
4
+ const numberGap = 2;
5
+ /**
6
+ * Width of the gutter in characters, or none where the config wants no
7
+ * numbers.
8
+ *
9
+ * It is taken from the whole snippet rather than from the lines that survive
10
+ * fitting, so the gutter is the width the numbering needs rather than the
11
+ * width it happens to use: a snippet cut off at line 9 of 40 still reserves
12
+ * two digits, and the code does not shift when a line is dropped.
13
+ */
14
+ export function gutterColumns(config, lines) {
15
+ return config.code.lineNumbers
16
+ ? String(Math.max(1, lines)).length + numberGap
17
+ : 0;
18
+ }
19
+ /** One line's number, right-aligned in the digits the gutter reserves. */
20
+ function numberToken(line, columns) {
21
+ const text = String(line);
22
+ return {
23
+ text,
24
+ column: columns - numberGap - text.length,
25
+ // No colour of its own, so `codeBody` draws it in the theme's foreground
26
+ // and the opacity is what holds it back from the code.
27
+ color: undefined,
28
+ opacity: numberOpacity,
29
+ bold: false,
30
+ italic: false,
31
+ };
32
+ }
33
+ /**
34
+ * Move the code across by the width of the gutter and put a number in front of
35
+ * each line.
36
+ *
37
+ * The numbers are tokens on the same character grid as the code rather than
38
+ * text placed alongside it, which is what keeps them on the baselines the code
39
+ * is drawn on: there is one piece of arithmetic for where a line sits, and it
40
+ * stays in `codeBody` where it already was.
41
+ *
42
+ * A snippet that had lines dropped ends with the truncation marker, and that
43
+ * line is left unnumbered: it stands for the lines that are not shown, so a
44
+ * number of its own would be a number nothing has.
45
+ *
46
+ * A gutter of no columns is a snippet with the numbers turned off, and the
47
+ * lines come back untouched.
48
+ */
49
+ export function numberLines(lines, columns, dropped) {
50
+ if (columns === 0) {
51
+ return lines;
52
+ }
53
+ const numbered = lines.length - (dropped > 0 ? 1 : 0);
54
+ return lines.map((tokens, index) => {
55
+ const shifted = tokens.map((token) => ({
56
+ ...token,
57
+ column: token.column + columns,
58
+ }));
59
+ return index < numbered
60
+ ? [numberToken(index + 1, columns), ...shifted]
61
+ : shifted;
62
+ });
63
+ }
64
+ //# sourceMappingURL=gutter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gutter.js","sourceRoot":"","sources":["../../../src/templates/code/gutter.ts"],"names":[],"mappings":"AAGA,8DAA8D;AAC9D,MAAM,aAAa,GAAG,GAAG,CAAC;AAE1B,+DAA+D;AAC/D,MA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,WAAW,CAAC,KAAK,GAAG,CAAC,EAAE,OAAO,CAAC,EAAE,GAAG,OAAO,CAAC;YAC/C,CAAC,CAAC,OAAO,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/code/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAY/C;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,EAAE,QAkF1B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/code/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAe/C;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,EAAE,QA8G1B,CAAC"}
@@ -1,8 +1,11 @@
1
1
  import { highlightCode } from "../../highlight/index.js";
2
- import { hasFooter } from "../footer.js";
2
+ import { footerFontSize, hasFooter } from "../footer.js";
3
3
  import { optionalString } from "../../props.js";
4
+ import { barRoom, windowBar } from "./bar.js";
4
5
  import { codeFooter, codeHeading } from "./chrome.js";
5
6
  import { blockColumns } from "./fit.js";
7
+ import { gutterColumns, numberLines } from "./gutter.js";
8
+ import { codeMarks } from "./mark/index.js";
6
9
  import { fitSnippet } from "./layout.js";
7
10
  import { layoutPanel, titleBand } from "./panel.js";
8
11
  import { hugPanel, panelSvg } from "./plate.js";
@@ -24,40 +27,56 @@ export const codeTemplate = {
24
27
  const { width, height } = dimensions;
25
28
  const title = optionalString(props.title);
26
29
  const titleFs = Math.round(height * 0.045);
27
- const footerFs = Math.round(height * 0.032);
30
+ const footerFs = footerFontSize(dimensions);
28
31
  const highlighted = await highlightCode(optionalString(props["code"]) ?? "", {
29
32
  language: optionalString(props["language"]) ?? "text",
30
33
  theme: optionalString(props["theme"]) ?? config.code.theme,
31
34
  tabSize: config.code.tabSize,
32
35
  });
33
36
  const available = layoutPanel(dimensions, config, titleFs, footerFs, title !== undefined && title !== "", hasFooter(config));
34
- const fitted = fitSnippet(highlighted, available, width, config, charWidthRatio(measure, config.code.fontFamily));
35
- warnIfTruncated(config, dimensions, {
36
- dropped: highlighted.lines.length - fitted.lines.length,
37
- clipped: fitted.clipped,
38
- }, highlighted.lines.length);
37
+ const bar = barRoom(config, available.width);
38
+ const gutter = gutterColumns(config, highlighted.lines.length);
39
+ const fitted = fitSnippet(highlighted, { ...available, y: available.y + bar, height: available.height - bar }, width, config, charWidthRatio(measure, config.code.fontFamily), gutter);
40
+ const dropped = highlighted.lines.length - fitted.lines.length;
41
+ warnIfTruncated(config, dimensions, { dropped, clipped: fitted.clipped }, highlighted.lines.length);
42
+ const lines = numberLines(fitted.lines, gutter, dropped);
39
43
  // Shrink the panel down onto the snippet so it isn't left floating in dead
40
44
  // space. On a landscape image especially, a wide panel holding a narrow
41
45
  // block leaves the code marooned off to one side.
46
+ const bodyHeight = fitted.lines.length * fitted.step;
42
47
  const panel = hugPanel(available, {
43
- width: blockColumns(fitted.lines) * fitted.charWidth + fitted.padding * 2,
44
- height: fitted.lines.length * fitted.step + fitted.padding * 2,
48
+ width: blockColumns(lines) * fitted.charWidth + fitted.padding * 2,
49
+ height: bar + bodyHeight + fitted.padding * 2,
45
50
  });
46
- const body = codeBody(fitted.lines, {
47
- // Code reads from the left edge, as it does in an editor. Indentation is
48
- // carried by each token's column, so the snippet keeps its shape.
49
- originX: panel.x + fitted.padding,
50
- originY: panel.y + (panel.height - fitted.lines.length * fitted.step) / 2,
51
+ // Code reads from the left edge, as it does in an editor. Indentation is
52
+ // carried by each token's column, so the snippet keeps its shape.
53
+ const originX = panel.x + fitted.padding;
54
+ const originY = panel.y + bar + (panel.height - bar - bodyHeight) / 2;
55
+ const body = codeBody(lines, {
56
+ originX,
57
+ originY,
51
58
  fontSize: fitted.fontSize,
52
59
  charWidth: fitted.charWidth,
53
60
  step: fitted.step,
54
61
  fontFamily: config.code.fontFamily,
55
62
  foreground: highlighted.foreground,
56
63
  });
64
+ const marks = codeMarks(props, fitted.lines, {
65
+ // Past the gutter, since a mark names columns of the code rather than
66
+ // of the grid the numbers share with it.
67
+ originX: originX + gutter * fitted.charWidth,
68
+ originY,
69
+ charWidth: fitted.charWidth,
70
+ fontSize: fitted.fontSize,
71
+ step: fitted.step,
72
+ band: { x: originX, width: panel.width - fitted.padding * 2 },
73
+ }, config);
57
74
  const shadowOffset = Math.round(Math.min(width, height) * 0.01);
58
- const plate = panelSvg(panel, highlighted.background, Math.max(1, shadowOffset));
75
+ const plate = panelSvg(panel, highlighted.background, Math.max(1, shadowOffset), config);
59
76
  return (codeHeading(title, titleBand(panel, dimensions, titleFs), titleFs, config) +
60
77
  plate +
78
+ windowBar(panel, bar, props, config, measure) +
79
+ marks +
61
80
  body +
62
81
  codeFooter(dimensions, footerFs, config));
63
82
  },
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/code/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;;;;GA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YACzC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC,SAAS;YAC5C,OAAO;YACP,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,IAAI,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,OAAO,GAAG,CAAC,EAAE;SAC9D,EACD,MAAM,CACP,CAAC;QAEF,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;QAChE,MAAM,KAAK,GAAG,QAAQ,CACpB,KAAK,EACL,WAAW,CAAC,UAAU,EACtB,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY,CAAC,EACzB,MAAM,CACP,CAAC;QAEF,OAAO,CACL,WAAW,CACT,KAAK,EACL,SAAS,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,EACrC,OAAO,EACP,MAAM,CACP;YACD,KAAK;YACL,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC;YAC7C,KAAK;YACL,IAAI;YACJ,UAAU,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC,CACzC,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -16,6 +16,11 @@ export interface FittedCode {
16
16
  /**
17
17
  * Fit a highlighted snippet into the panel it has been allotted: choose the
18
18
  * font size, then drop and clip whatever still does not fit.
19
+ *
20
+ * `gutter` is columns reserved to the left of the code, for line numbers. It
21
+ * is counted in characters rather than pixels because that is what it is: the
22
+ * numbers sit on the same monospace grid, so the space they take follows
23
+ * whatever font size the fitting settles on.
19
24
  */
20
- export declare function fitSnippet(highlighted: HighlightedCode, available: Panel, imageWidth: number, config: ResolvedConfig, charWidthRatio: number): FittedCode;
25
+ export declare function fitSnippet(highlighted: HighlightedCode, available: Panel, imageWidth: number, config: ResolvedConfig, charWidthRatio: number, gutter?: number): FittedCode;
21
26
  //# sourceMappingURL=layout.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/templates/code/layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,SAAS,SAAS,EAAE,CAAC,EAAE,CAAC;IAClD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;GAGG;AACH,wBAAgB,UAAU,CACxB,WAAW,EAAE,eAAe,EAC5B,SAAS,EAAE,KAAK,EAChB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,cAAc,EACtB,cAAc,EAAE,MAAM,GACrB,UAAU,CA6BZ"}
1
+ {"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/templates/code/layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,SAAS,SAAS,EAAE,CAAC,EAAE,CAAC;IAClD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CACxB,WAAW,EAAE,eAAe,EAC5B,SAAS,EAAE,KAAK,EAChB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,cAAc,EACtB,cAAc,EAAE,MAAM,EACtB,MAAM,SAAI,GACT,UAAU,CA6BZ"}
@@ -3,15 +3,20 @@ import { fitFontSize, fitLines } from "./fit.js";
3
3
  /**
4
4
  * Fit a highlighted snippet into the panel it has been allotted: choose the
5
5
  * font size, then drop and clip whatever still does not fit.
6
+ *
7
+ * `gutter` is columns reserved to the left of the code, for line numbers. It
8
+ * is counted in characters rather than pixels because that is what it is: the
9
+ * numbers sit on the same monospace grid, so the space they take follows
10
+ * whatever font size the fitting settles on.
6
11
  */
7
- export function fitSnippet(highlighted, available, imageWidth, config, charWidthRatio) {
12
+ export function fitSnippet(highlighted, available, imageWidth, config, charWidthRatio, gutter = 0) {
8
13
  const inner = Math.round(Math.min(available.width, available.height) * 0.07);
9
14
  const codeWidth = Math.max(1, available.width - inner * 2);
10
15
  const codeHeight = Math.max(1, available.height - inner * 2);
11
- const fontSize = fitFontSize(highlighted, { width: codeWidth, height: codeHeight }, imageWidth, config, charWidthRatio);
16
+ const fontSize = fitFontSize({ ...highlighted, longestLine: highlighted.longestLine + gutter }, { width: codeWidth, height: codeHeight }, imageWidth, config, charWidthRatio);
12
17
  const charWidth = fontSize * charWidthRatio;
13
18
  const step = fontSize * config.code.lineHeight;
14
- const { lines, clipped } = clipLines(fitLines(highlighted.lines, codeHeight, step), Math.max(1, Math.floor(codeWidth / charWidth)));
19
+ const { lines, clipped } = clipLines(fitLines(highlighted.lines, codeHeight, step), Math.max(1, Math.floor(codeWidth / charWidth) - gutter));
15
20
  // Padding reads best proportional to the text rather than the panel, since a
16
21
  // snippet fitted down to a small size wants tighter margins. Only ever
17
22
  // shrink, so the code area the font was fitted against stays valid.
@@ -1 +1 @@
1
- {"version":3,"file":"layout.js","sourceRoot":"","sources":["../../../src/templates/code/layout.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAgBjD;;;GAGG;AACH,MAAM,UAAU,UAAU,CACxB,WAA4B,EAC5B,SAAgB,EAChB,UAAkB,EAClB,MAAsB,EACtB,cAAsB;IAEtB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;IAC7E,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,CAAC,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC;IAC3D,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC;IAE7D,MAAM,QAAQ,GAAG,WAAW,CAC1B,WAAW,EACX,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,EACxC,UAAU,EACV,MAAM,EACN,cAAc,CACf,CAAC;IACF,MAAM,SAAS,GAAG,QAAQ,GAAG,cAAc,CAAC;IAC5C,MAAM,IAAI,GAAG,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;IAE/C,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,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AC,CAAC;IAE7D,MAAM,QAAQ,GAAG,WAAW,CAC1B,EAAE,GAAG,WAAW,EAAE,WAAW,EAAE,WAAW,CAAC,WAAW,GAAG,MAAM,EAAE,EACjE,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,EACxC,UAAU,EACV,MAAM,EACN,cAAc,CACf,CAAC;IACF,MAAM,SAAS,GAAG,QAAQ,GAAG,cAAc,CAAC;IAC5C,MAAM,IAAI,GAAG,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;IAE/C,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,SAAS,CAClC,QAAQ,CAAC,WAAW,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,EAC7C,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC,GAAG,MAAM,CAAC,CACxD,CAAC;IAEF,6EAA6E;IAC7E,uEAAuE;IACvE,oEAAoE;IACpE,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CACtB,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,GAAG,CAAC,CAAC,EAC3C,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,CACzB,CAAC;IAEF,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAChE,CAAC"}
@@ -0,0 +1,26 @@
1
+ import type { MarkSpan } from "./locate.js";
2
+ /** Where the code sits, so a mark can be put over the right characters. */
3
+ export interface MarkMetrics {
4
+ /** Where column zero of the code is, past the gutter. */
5
+ readonly originX: number;
6
+ readonly originY: number;
7
+ readonly charWidth: number;
8
+ readonly fontSize: number;
9
+ readonly step: number;
10
+ /** Across, for a mark that takes a whole line rather than a span of one. */
11
+ readonly band: {
12
+ readonly x: number;
13
+ readonly width: number;
14
+ };
15
+ }
16
+ /**
17
+ * A mark over one span of code: a box around the characters, or a band across
18
+ * the line where the post named no columns.
19
+ *
20
+ * The box is stroked and the band is filled, which is the difference between
21
+ * pointing at something and highlighting it. Both take the palette's warm
22
+ * accent by default, so a mark is the one thing on the image that is neither
23
+ * the code theme's colours nor the site's brand.
24
+ */
25
+ export declare function markSvg(span: MarkSpan, metrics: MarkMetrics, color: string): string;
26
+ //# sourceMappingURL=draw.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"draw.d.ts","sourceRoot":"","sources":["../../../../src/templates/code/mark/draw.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,2EAA2E;AAC3E,MAAM,WAAW,WAAW;IAC1B,yDAAyD;IACzD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,4EAA4E;IAC5E,QAAQ,CAAC,IAAI,EAAE;QAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/D;AAmBD;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CACrB,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,WAAW,EACpB,KAAK,EAAE,MAAM,GACZ,MAAM,CA2BR"}
@@ -0,0 +1,41 @@
1
+ import { box } from "../../../layout/index.js";
2
+ /** Clear space around the marked characters, as a fraction of the size. */
3
+ const padScale = 0.16;
4
+ /** The band a line's glyphs are drawn in, which is what a mark encloses. */
5
+ function lineRect(span, metrics) {
6
+ const { originY, step, fontSize } = metrics;
7
+ const pad = fontSize * padScale;
8
+ return {
9
+ y: Math.round(originY + span.line * step + (step - fontSize) / 2 - pad),
10
+ height: Math.round(fontSize + pad * 2),
11
+ };
12
+ }
13
+ /**
14
+ * A mark over one span of code: a box around the characters, or a band across
15
+ * the line where the post named no columns.
16
+ *
17
+ * The box is stroked and the band is filled, which is the difference between
18
+ * pointing at something and highlighting it. Both take the palette's warm
19
+ * accent by default, so a mark is the one thing on the image that is neither
20
+ * the code theme's colours nor the site's brand.
21
+ */
22
+ export function markSvg(span, metrics, color) {
23
+ const { originX, charWidth, fontSize } = metrics;
24
+ const { y, height } = lineRect(span, metrics);
25
+ const fill = span.color ?? color;
26
+ if (span.length === undefined) {
27
+ return box({ x: metrics.band.x, y, width: metrics.band.width, height }, { radius: Math.round(fontSize * 0.2), fill, fillOpacity: 0.16 });
28
+ }
29
+ const pad = charWidth * padScale;
30
+ return box({
31
+ x: Math.round(originX + span.column * charWidth - pad),
32
+ y,
33
+ width: Math.round(span.length * charWidth + pad * 2),
34
+ height,
35
+ }, {
36
+ radius: Math.round(fontSize * 0.2),
37
+ stroke: fill,
38
+ strokeWidth: Math.max(1, Math.round(fontSize * 0.08)),
39
+ });
40
+ }
41
+ //# sourceMappingURL=draw.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"draw.js","sourceRoot":"","sources":["../../../../src/templates/code/mark/draw.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAe/C,2EAA2E;AAC3E,MAAM,QAAQ,GAAG,IAAI,CAAC;AAEtB,4EAA4E;AAC5E,SAAS,QAAQ,CACf,IAAc,EACd,OAAoB;IAEpB,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAC5C,MAAM,GAAG,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAEhC,OAAO;QACL,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,GAAG,IAAI,GAAG,CAAC,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CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;KACtD,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { CodeToken } from "../../../highlight/index.js";
2
+ import type { MetaImageProps, ResolvedConfig } from "../../../types.js";
3
+ import type { MarkMetrics } from "./draw.js";
4
+ export type { MarkMetrics } from "./draw.js";
5
+ /**
6
+ * What a post asked to have marked on its snippet, drawn over the code.
7
+ *
8
+ * A mark that cannot be placed is reported rather than dropped quietly. There
9
+ * are three ways to get one, and an author cannot tell them apart from the
10
+ * image: the text is not in the snippet at all, or it is on a line the fitting
11
+ * dropped, or it was past the width and got clipped. The message says the
12
+ * marks were not found, and the truncation warning beside it says whether
13
+ * there was room for them.
14
+ */
15
+ export declare function codeMarks(props: MetaImageProps, lines: readonly (readonly CodeToken[])[], metrics: MarkMetrics, config: ResolvedConfig): string;
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/templates/code/mark/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAI7C,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,cAAc,EACrB,KAAK,EAAE,SAAS,CAAC,SAAS,SAAS,EAAE,CAAC,EAAE,EACxC,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,cAAc,GACrB,MAAM,CA0BR"}
@@ -0,0 +1,34 @@
1
+ import { markSvg } from "./draw.js";
2
+ import { locateMark } from "./locate.js";
3
+ import { readMarks } from "./read.js";
4
+ /**
5
+ * What a post asked to have marked on its snippet, drawn over the code.
6
+ *
7
+ * A mark that cannot be placed is reported rather than dropped quietly. There
8
+ * are three ways to get one, and an author cannot tell them apart from the
9
+ * image: the text is not in the snippet at all, or it is on a line the fitting
10
+ * dropped, or it was past the width and got clipped. The message says the
11
+ * marks were not found, and the truncation warning beside it says whether
12
+ * there was room for them.
13
+ */
14
+ export function codeMarks(props, lines, metrics, config) {
15
+ // Widened because this arrives from a post's frontmatter: the declared type
16
+ // is what a project means to write, not what the file holds.
17
+ const declared = props["mark"];
18
+ const missing = [];
19
+ let drawn = "";
20
+ for (const mark of readMarks(declared, config)) {
21
+ const span = locateMark(mark, lines);
22
+ if (span === undefined) {
23
+ missing.push(mark.text ?? `line ${String(mark.line ?? 0)}`);
24
+ continue;
25
+ }
26
+ drawn += markSvg(span, metrics, config.colors.brandWarm);
27
+ }
28
+ if (missing.length > 0) {
29
+ config.onWarning(`code mark ${missing.map((name) => JSON.stringify(name)).join(", ")}` +
30
+ ` not found in the snippet as drawn.`);
31
+ }
32
+ return drawn;
33
+ }
34
+ //# sourceMappingURL=index.js.map