postext 1.91.1 → 1.92.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 (301) hide show
  1. package/dist/__tests__/exports.test.js +92 -0
  2. package/dist/__tests__/exports.test.js.map +1 -1
  3. package/dist/__tests__/paint/cropMarks.test.js +31 -0
  4. package/dist/__tests__/paint/cropMarks.test.js.map +1 -1
  5. package/dist/__tests__/pipeline/pages/reliefPlates.test.d.ts +2 -0
  6. package/dist/__tests__/pipeline/pages/reliefPlates.test.d.ts.map +1 -0
  7. package/dist/__tests__/pipeline/pages/reliefPlates.test.js +92 -0
  8. package/dist/__tests__/pipeline/pages/reliefPlates.test.js.map +1 -0
  9. package/dist/__tests__/pipeline/passFrontPages.test.d.ts +2 -0
  10. package/dist/__tests__/pipeline/passFrontPages.test.d.ts.map +1 -0
  11. package/dist/__tests__/pipeline/passFrontPages.test.js +66 -0
  12. package/dist/__tests__/pipeline/passFrontPages.test.js.map +1 -0
  13. package/dist/__tests__/production/compose.test.d.ts +2 -0
  14. package/dist/__tests__/production/compose.test.d.ts.map +1 -0
  15. package/dist/__tests__/production/compose.test.js +177 -0
  16. package/dist/__tests__/production/compose.test.js.map +1 -0
  17. package/dist/__tests__/production/config.test.d.ts +2 -0
  18. package/dist/__tests__/production/config.test.d.ts.map +1 -0
  19. package/dist/__tests__/production/config.test.js +83 -0
  20. package/dist/__tests__/production/config.test.js.map +1 -0
  21. package/dist/__tests__/production/cover.test.d.ts +2 -0
  22. package/dist/__tests__/production/cover.test.d.ts.map +1 -0
  23. package/dist/__tests__/production/cover.test.js +273 -0
  24. package/dist/__tests__/production/cover.test.js.map +1 -0
  25. package/dist/__tests__/production/coverLayers.test.d.ts +2 -0
  26. package/dist/__tests__/production/coverLayers.test.d.ts.map +1 -0
  27. package/dist/__tests__/production/coverLayers.test.js +198 -0
  28. package/dist/__tests__/production/coverLayers.test.js.map +1 -0
  29. package/dist/__tests__/production/coverOutputs.test.d.ts +2 -0
  30. package/dist/__tests__/production/coverOutputs.test.d.ts.map +1 -0
  31. package/dist/__tests__/production/coverOutputs.test.js +104 -0
  32. package/dist/__tests__/production/coverOutputs.test.js.map +1 -0
  33. package/dist/__tests__/production/geometry.test.d.ts +2 -0
  34. package/dist/__tests__/production/geometry.test.d.ts.map +1 -0
  35. package/dist/__tests__/production/geometry.test.js +281 -0
  36. package/dist/__tests__/production/geometry.test.js.map +1 -0
  37. package/dist/__tests__/production/mirrorBleed.test.d.ts +2 -0
  38. package/dist/__tests__/production/mirrorBleed.test.d.ts.map +1 -0
  39. package/dist/__tests__/production/mirrorBleed.test.js +129 -0
  40. package/dist/__tests__/production/mirrorBleed.test.js.map +1 -0
  41. package/dist/__tests__/production/shapes.test.d.ts +2 -0
  42. package/dist/__tests__/production/shapes.test.d.ts.map +1 -0
  43. package/dist/__tests__/production/shapes.test.js +107 -0
  44. package/dist/__tests__/production/shapes.test.js.map +1 -0
  45. package/dist/__tests__/production/sheets.test.d.ts +2 -0
  46. package/dist/__tests__/production/sheets.test.d.ts.map +1 -0
  47. package/dist/__tests__/production/sheets.test.js +153 -0
  48. package/dist/__tests__/production/sheets.test.js.map +1 -0
  49. package/dist/bundle/api.d.ts +8 -0
  50. package/dist/bundle/api.d.ts.map +1 -1
  51. package/dist/bundle/api.js +3 -0
  52. package/dist/bundle/api.js.map +1 -1
  53. package/dist/bundle/codec/files.d.ts.map +1 -1
  54. package/dist/bundle/codec/files.js +2 -0
  55. package/dist/bundle/codec/files.js.map +1 -1
  56. package/dist/bundle/codec/plan.d.ts +12 -0
  57. package/dist/bundle/codec/plan.d.ts.map +1 -1
  58. package/dist/bundle/codec/plan.js +12 -1
  59. package/dist/bundle/codec/plan.js.map +1 -1
  60. package/dist/bundle/codec/read.d.ts +3 -0
  61. package/dist/bundle/codec/read.d.ts.map +1 -1
  62. package/dist/bundle/codec/read.js +14 -2
  63. package/dist/bundle/codec/read.js.map +1 -1
  64. package/dist/bundle/index.d.ts +1 -1
  65. package/dist/bundle/index.d.ts.map +1 -1
  66. package/dist/bundle/index.js +1 -1
  67. package/dist/bundle/index.js.map +1 -1
  68. package/dist/bundle/manifest/locale.d.ts +3 -0
  69. package/dist/bundle/manifest/locale.d.ts.map +1 -1
  70. package/dist/bundle/manifest/locale.js +5 -0
  71. package/dist/bundle/manifest/locale.js.map +1 -1
  72. package/dist/bundle/manifest/validation.d.ts.map +1 -1
  73. package/dist/bundle/manifest/validation.js +4 -0
  74. package/dist/bundle/manifest/validation.js.map +1 -1
  75. package/dist/bundle/manifest.d.ts +1 -1
  76. package/dist/bundle/manifest.d.ts.map +1 -1
  77. package/dist/bundle/manifest.js +1 -1
  78. package/dist/bundle/manifest.js.map +1 -1
  79. package/dist/bundle/types.d.ts +7 -0
  80. package/dist/bundle/types.d.ts.map +1 -1
  81. package/dist/checks/configWarnings/collect.d.ts +6 -1
  82. package/dist/checks/configWarnings/collect.d.ts.map +1 -1
  83. package/dist/checks/configWarnings/collect.js +9 -1
  84. package/dist/checks/configWarnings/collect.js.map +1 -1
  85. package/dist/checks/configWarnings/cover.d.ts +17 -0
  86. package/dist/checks/configWarnings/cover.d.ts.map +1 -0
  87. package/dist/checks/configWarnings/cover.js +146 -0
  88. package/dist/checks/configWarnings/cover.js.map +1 -0
  89. package/dist/checks/configWarnings/production.d.ts +12 -0
  90. package/dist/checks/configWarnings/production.d.ts.map +1 -0
  91. package/dist/checks/configWarnings/production.js +48 -0
  92. package/dist/checks/configWarnings/production.js.map +1 -0
  93. package/dist/checks/preflight.d.ts.map +1 -1
  94. package/dist/checks/preflight.js +5 -0
  95. package/dist/checks/preflight.js.map +1 -1
  96. package/dist/checks/preflightFolds.d.ts +19 -0
  97. package/dist/checks/preflightFolds.d.ts.map +1 -0
  98. package/dist/checks/preflightFolds.js +81 -0
  99. package/dist/checks/preflightFolds.js.map +1 -0
  100. package/dist/checks/preflightIssues.d.ts +24 -0
  101. package/dist/checks/preflightIssues.d.ts.map +1 -1
  102. package/dist/composed/paint.d.ts +2 -1
  103. package/dist/composed/paint.d.ts.map +1 -1
  104. package/dist/composed/paint.js +3 -2
  105. package/dist/composed/paint.js.map +1 -1
  106. package/dist/defaults/bookKeys.d.ts +2 -2
  107. package/dist/defaults/bookKeys.d.ts.map +1 -1
  108. package/dist/defaults/bookKeys.js +2 -2
  109. package/dist/defaults/bookKeys.js.map +1 -1
  110. package/dist/defaults/index.d.ts +1 -1
  111. package/dist/defaults/index.d.ts.map +1 -1
  112. package/dist/defaults/index.js +1 -1
  113. package/dist/defaults/index.js.map +1 -1
  114. package/dist/defaults/output/folio.d.ts +6 -1
  115. package/dist/defaults/output/folio.d.ts.map +1 -1
  116. package/dist/defaults/output/folio.js +10 -0
  117. package/dist/defaults/output/folio.js.map +1 -1
  118. package/dist/defaults/output/production.d.ts +12 -0
  119. package/dist/defaults/output/production.d.ts.map +1 -0
  120. package/dist/defaults/output/production.js +83 -0
  121. package/dist/defaults/output/production.js.map +1 -0
  122. package/dist/defaults/page.d.ts.map +1 -1
  123. package/dist/defaults/page.js +4 -1
  124. package/dist/defaults/page.js.map +1 -1
  125. package/dist/defaults/structure/headerFooter/resolve.d.ts.map +1 -1
  126. package/dist/defaults/structure/headerFooter/resolve.js +1 -0
  127. package/dist/defaults/structure/headerFooter/resolve.js.map +1 -1
  128. package/dist/design/elementKeys.d.ts +6 -0
  129. package/dist/design/elementKeys.d.ts.map +1 -1
  130. package/dist/design/elementKeys.js +5 -5
  131. package/dist/design/elementKeys.js.map +1 -1
  132. package/dist/designs/parts.d.ts +2 -1
  133. package/dist/designs/parts.d.ts.map +1 -1
  134. package/dist/designs/parts.js +2 -1
  135. package/dist/designs/parts.js.map +1 -1
  136. package/dist/index.d.ts +2 -2
  137. package/dist/index.d.ts.map +1 -1
  138. package/dist/index.js +1 -1
  139. package/dist/index.js.map +1 -1
  140. package/dist/paint/cropMarks.d.ts +2 -1
  141. package/dist/paint/cropMarks.d.ts.map +1 -1
  142. package/dist/paint/cropMarks.js +7 -1
  143. package/dist/paint/cropMarks.js.map +1 -1
  144. package/dist/pipeline/build/passMade.d.ts +37 -0
  145. package/dist/pipeline/build/passMade.d.ts.map +1 -1
  146. package/dist/pipeline/build/passMade.js +59 -0
  147. package/dist/pipeline/build/passMade.js.map +1 -1
  148. package/dist/pipeline/build/passRejoin.d.ts.map +1 -1
  149. package/dist/pipeline/build/passRejoin.js +23 -0
  150. package/dist/pipeline/build/passRejoin.js.map +1 -1
  151. package/dist/pipeline/build/passReuse.d.ts +6 -0
  152. package/dist/pipeline/build/passReuse.d.ts.map +1 -1
  153. package/dist/pipeline/build/passReuse.js +44 -28
  154. package/dist/pipeline/build/passReuse.js.map +1 -1
  155. package/dist/pipeline/config.d.ts.map +1 -1
  156. package/dist/pipeline/config.js +9 -2
  157. package/dist/pipeline/config.js.map +1 -1
  158. package/dist/pipeline/pages/dieCuts.d.ts +2 -1
  159. package/dist/pipeline/pages/dieCuts.d.ts.map +1 -1
  160. package/dist/pipeline/pages/dieCuts.js +18 -2
  161. package/dist/pipeline/pages/dieCuts.js.map +1 -1
  162. package/dist/pipeline/pages/headerFooter/pageDecoration.d.ts.map +1 -1
  163. package/dist/pipeline/pages/headerFooter/pageDecoration.js +8 -3
  164. package/dist/pipeline/pages/headerFooter/pageDecoration.js.map +1 -1
  165. package/dist/pipeline/pages/headerFooter/slotLayout.d.ts +3 -2
  166. package/dist/pipeline/pages/headerFooter/slotLayout.d.ts.map +1 -1
  167. package/dist/pipeline/pages/headerFooter/slotLayout.js +1 -1
  168. package/dist/pipeline/pages/headerFooter/slotLayout.js.map +1 -1
  169. package/dist/production/barcodeSvg.d.ts +28 -0
  170. package/dist/production/barcodeSvg.d.ts.map +1 -0
  171. package/dist/production/barcodeSvg.js +64 -0
  172. package/dist/production/barcodeSvg.js.map +1 -0
  173. package/dist/production/buildCover.d.ts +104 -0
  174. package/dist/production/buildCover.d.ts.map +1 -0
  175. package/dist/production/buildCover.js +169 -0
  176. package/dist/production/buildCover.js.map +1 -0
  177. package/dist/production/catalogue.d.ts +40 -0
  178. package/dist/production/catalogue.d.ts.map +1 -0
  179. package/dist/production/catalogue.js +106 -0
  180. package/dist/production/catalogue.js.map +1 -0
  181. package/dist/production/compose.d.ts +120 -0
  182. package/dist/production/compose.d.ts.map +1 -0
  183. package/dist/production/compose.js +288 -0
  184. package/dist/production/compose.js.map +1 -0
  185. package/dist/production/config.d.ts +15 -0
  186. package/dist/production/config.d.ts.map +1 -0
  187. package/dist/production/config.js +143 -0
  188. package/dist/production/config.js.map +1 -0
  189. package/dist/production/coverArt.d.ts +74 -0
  190. package/dist/production/coverArt.d.ts.map +1 -0
  191. package/dist/production/coverArt.js +355 -0
  192. package/dist/production/coverArt.js.map +1 -0
  193. package/dist/production/coverDesign.d.ts +22 -0
  194. package/dist/production/coverDesign.d.ts.map +1 -0
  195. package/dist/production/coverDesign.js +111 -0
  196. package/dist/production/coverDesign.js.map +1 -0
  197. package/dist/production/coverLabels.d.ts +8 -0
  198. package/dist/production/coverLabels.d.ts.map +1 -0
  199. package/dist/production/coverLabels.js +23 -0
  200. package/dist/production/coverLabels.js.map +1 -0
  201. package/dist/production/coverSource.d.ts +79 -0
  202. package/dist/production/coverSource.d.ts.map +1 -0
  203. package/dist/production/coverSource.js +142 -0
  204. package/dist/production/coverSource.js.map +1 -0
  205. package/dist/production/exchange.d.ts +38 -0
  206. package/dist/production/exchange.d.ts.map +1 -0
  207. package/dist/production/exchange.js +146 -0
  208. package/dist/production/exchange.js.map +1 -0
  209. package/dist/production/folio.d.ts +21 -0
  210. package/dist/production/folio.d.ts.map +1 -0
  211. package/dist/production/folio.js +35 -0
  212. package/dist/production/folio.js.map +1 -0
  213. package/dist/production/geometry.d.ts +84 -0
  214. package/dist/production/geometry.d.ts.map +1 -0
  215. package/dist/production/geometry.js +220 -0
  216. package/dist/production/geometry.js.map +1 -0
  217. package/dist/production/guards.d.ts +6 -0
  218. package/dist/production/guards.d.ts.map +1 -0
  219. package/dist/production/guards.js +6 -0
  220. package/dist/production/guards.js.map +1 -0
  221. package/dist/production/index.d.ts +25 -0
  222. package/dist/production/index.d.ts.map +1 -0
  223. package/dist/production/index.js +19 -0
  224. package/dist/production/index.js.map +1 -0
  225. package/dist/production/isbn.d.ts +67 -0
  226. package/dist/production/isbn.d.ts.map +1 -0
  227. package/dist/production/isbn.js +135 -0
  228. package/dist/production/isbn.js.map +1 -0
  229. package/dist/production/measures.d.ts +30 -0
  230. package/dist/production/measures.d.ts.map +1 -0
  231. package/dist/production/measures.js +54 -0
  232. package/dist/production/measures.js.map +1 -0
  233. package/dist/production/mirrorBleed.d.ts +54 -0
  234. package/dist/production/mirrorBleed.d.ts.map +1 -0
  235. package/dist/production/mirrorBleed.js +92 -0
  236. package/dist/production/mirrorBleed.js.map +1 -0
  237. package/dist/production/shapes.d.ts +65 -0
  238. package/dist/production/shapes.d.ts.map +1 -0
  239. package/dist/production/shapes.js +313 -0
  240. package/dist/production/shapes.js.map +1 -0
  241. package/dist/production/spine.d.ts +38 -0
  242. package/dist/production/spine.d.ts.map +1 -0
  243. package/dist/production/spine.js +48 -0
  244. package/dist/production/spine.js.map +1 -0
  245. package/dist/production/svgSafe.d.ts +25 -0
  246. package/dist/production/svgSafe.d.ts.map +1 -0
  247. package/dist/production/svgSafe.js +33 -0
  248. package/dist/production/svgSafe.js.map +1 -0
  249. package/dist/production/version.d.ts +66 -0
  250. package/dist/production/version.d.ts.map +1 -0
  251. package/dist/production/version.js +68 -0
  252. package/dist/production/version.js.map +1 -0
  253. package/dist/types/config.d.ts +12 -0
  254. package/dist/types/config.d.ts.map +1 -1
  255. package/dist/types/designCut.d.ts +13 -1
  256. package/dist/types/designCut.d.ts.map +1 -1
  257. package/dist/types/designElements.d.ts +15 -0
  258. package/dist/types/designElements.d.ts.map +1 -1
  259. package/dist/types/output/cover.d.ts +230 -0
  260. package/dist/types/output/cover.d.ts.map +1 -0
  261. package/dist/types/output/cover.js +2 -0
  262. package/dist/types/output/cover.js.map +1 -0
  263. package/dist/types/output/production.d.ts +186 -0
  264. package/dist/types/output/production.d.ts.map +1 -0
  265. package/dist/types/output/production.js +2 -0
  266. package/dist/types/output/production.js.map +1 -0
  267. package/dist/types/page.d.ts +5 -0
  268. package/dist/types/page.d.ts.map +1 -1
  269. package/dist/types.d.ts +2 -0
  270. package/dist/types.d.ts.map +1 -1
  271. package/dist/util/base64.d.ts +3 -0
  272. package/dist/util/base64.d.ts.map +1 -0
  273. package/dist/util/base64.js +48 -0
  274. package/dist/util/base64.js.map +1 -0
  275. package/dist/util/png.d.ts +10 -0
  276. package/dist/util/png.d.ts.map +1 -0
  277. package/dist/util/png.js +60 -0
  278. package/dist/util/png.js.map +1 -0
  279. package/dist/util/xmlEscape.d.ts +6 -0
  280. package/dist/util/xmlEscape.d.ts.map +1 -0
  281. package/dist/util/xmlEscape.js +15 -0
  282. package/dist/util/xmlEscape.js.map +1 -0
  283. package/dist/vdt/design.d.ts +10 -1
  284. package/dist/vdt/design.d.ts.map +1 -1
  285. package/dist/vdt/design.js.map +1 -1
  286. package/dist/vdt/pages.d.ts +13 -0
  287. package/dist/vdt/pages.d.ts.map +1 -1
  288. package/dist/vdt.d.ts +1 -1
  289. package/dist/vdt.d.ts.map +1 -1
  290. package/dist/word/anchors/base64.d.ts +1 -2
  291. package/dist/word/anchors/base64.d.ts.map +1 -1
  292. package/dist/word/anchors/base64.js +2 -46
  293. package/dist/word/anchors/base64.js.map +1 -1
  294. package/dist/word/semantic/design/ground.d.ts.map +1 -1
  295. package/dist/word/semantic/design/ground.js +5 -47
  296. package/dist/word/semantic/design/ground.js.map +1 -1
  297. package/dist/word/xml.d.ts +1 -4
  298. package/dist/word/xml.d.ts.map +1 -1
  299. package/dist/word/xml.js +1 -13
  300. package/dist/word/xml.js.map +1 -1
  301. package/package.json +5 -1
@@ -0,0 +1,79 @@
1
+ /**
2
+ * The cover's Markdown (#1667): a document of the book, one
3
+ * `:::frame{slot="…"}` per zone or text box (the back cover's blurb, a
4
+ * flap's biography), laid out on the cover's page template. The front and
5
+ * the spine the Markdown leaves empty take the book's title, subtitle and
6
+ * author, read from its metadata on every build (never copied into the
7
+ * cover), each in a paragraph style of its own the book may redefine.
8
+ */
9
+ import type { DocumentMetadata } from '../types/content.js';
10
+ import type { ParagraphStyleConfig } from '../types/text/paragraphStyles.js';
11
+ /** The paragraph styles the front and the spine are set in when the
12
+ * cover's Markdown leaves them to the metadata. */
13
+ export declare const COVER_PARAGRAPH_STYLES: readonly ["cover-title", "cover-subtitle", "cover-author", "cover-spine"];
14
+ /** Something in the cover's Markdown the cover cannot lay out. */
15
+ export type CoverSourceIssue =
16
+ /** A frame names a slot the cover has not (`slots`, an endpaper has no
17
+ * back cover): its text is left out. */
18
+ {
19
+ kind: 'coverSlotUnknown';
20
+ slot: string;
21
+ sourceStart: number;
22
+ sourceEnd: number;
23
+ }
24
+ /** Two frames fill one slot: only the first is laid out, the others
25
+ * are left out. */
26
+ | {
27
+ kind: 'coverSlotRepeated';
28
+ slot: string;
29
+ sourceStart: number;
30
+ sourceEnd: number;
31
+ }
32
+ /** A frame names a sheet no version has (`sheet="…"`): left out. */
33
+ | {
34
+ kind: 'coverFrameSheetUnknown';
35
+ sheet: string;
36
+ sourceStart: number;
37
+ sourceEnd: number;
38
+ };
39
+ /** The sheet names a frame's `sheet` attribute may give (#1673). */
40
+ export declare const COVER_FRAME_SHEETS: ReadonlySet<string>;
41
+ /** The slots the cover's Markdown fills, in order, with where each frame
42
+ * opens and the sheets it is for (`sheet="case jacket"`; absent: every
43
+ * sheet). */
44
+ export declare function coverFrames(markdown: string): {
45
+ slot: string;
46
+ start: number;
47
+ end: number;
48
+ sheets?: string[];
49
+ }[];
50
+ /** Text as Markdown that reads as written: the inline marks escaped, line
51
+ * breaks as spaces. */
52
+ export declare function markdownLiteral(text: string): string;
53
+ /**
54
+ * The Markdown the cover is laid out from: the cover's own frames inside
55
+ * the cover's page fence, and a frame for the front and one for the spine
56
+ * when the cover has the slot, the Markdown leaves it empty and the
57
+ * metadata has something to put there. `slots` are the cover page's
58
+ * (`CoverPage.slots`); `sheets`, the names of the sheet being laid out
59
+ * (`case`, `endpaperFront` and `endpapers`…): a frame for other sheets is
60
+ * left out, and one for this sheet takes its slot over a frame for every
61
+ * sheet.
62
+ */
63
+ export declare function coverSource(markdown: string | undefined, slots: readonly string[], metadata?: DocumentMetadata, sheets?: readonly string[]): {
64
+ markdown: string;
65
+ issues: CoverSourceIssue[];
66
+ };
67
+ /** Where the cover's Markdown starts in `coverSource`'s: its offsets
68
+ * minus this are the cover's own. */
69
+ export declare const coverSourceOffset: () => number;
70
+ /**
71
+ * The paragraph styles the cover sets its metadata text in, from the
72
+ * book's body text: the book's own style of each id goes over its
73
+ * default, field by field. The title and
74
+ * subtitle are centred at 2.4 and 1.4 times the body size, the author at
75
+ * 1.2, the spine's line at the body size, a catalogue's titles at the body
76
+ * size from the left; none hyphenated.
77
+ */
78
+ export declare function coverParagraphStyles(own: readonly ParagraphStyleConfig[] | undefined, bodySizePt?: number): ParagraphStyleConfig[];
79
+ //# sourceMappingURL=coverSource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coverSource.d.ts","sourceRoot":"","sources":["../../src/production/coverSource.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAG7E;oDACoD;AACpD,eAAO,MAAM,sBAAsB,2EAA4E,CAAC;AAEhH,kEAAkE;AAClE,MAAM,MAAM,gBAAgB;AAC1B;yCACyC;AACvC;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE;AACpF;oBACoB;GAClB;IAAE,IAAI,EAAE,mBAAmB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE;AACrF,oEAAoE;GAClE;IAAE,IAAI,EAAE,wBAAwB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9F,oEAAoE;AACpE,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAAsF,CAAC;AAM1I;;cAEc;AACd,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,EAAE,CAU/G;AAOD;wBACwB;AACxB,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEpD;AAQD;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,QAAQ,GAAE,gBAAqB,EAC/B,MAAM,GAAE,SAAS,MAAM,EAAO,GAC7B;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,gBAAgB,EAAE,CAAA;CAAE,CAiDlD;AAED;sCACsC;AACtC,eAAO,MAAM,iBAAiB,QAAO,MAA8D,CAAC;AAEpG;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,SAAS,oBAAoB,EAAE,GAAG,SAAS,EAAE,UAAU,SAAK,GAAG,oBAAoB,EAAE,CAmB9H"}
@@ -0,0 +1,142 @@
1
+ /**
2
+ * The cover's Markdown (#1667): a document of the book, one
3
+ * `:::frame{slot="…"}` per zone or text box (the back cover's blurb, a
4
+ * flap's biography), laid out on the cover's page template. The front and
5
+ * the spine the Markdown leaves empty take the book's title, subtitle and
6
+ * author, read from its metadata on every build (never copied into the
7
+ * cover), each in a paragraph style of its own the book may redefine.
8
+ */
9
+ import { COVER_TEMPLATE_ID } from './compose.js';
10
+ /** The paragraph styles the front and the spine are set in when the
11
+ * cover's Markdown leaves them to the metadata. */
12
+ export const COVER_PARAGRAPH_STYLES = ['cover-title', 'cover-subtitle', 'cover-author', 'cover-spine'];
13
+ /** The sheet names a frame's `sheet` attribute may give (#1673). */
14
+ export const COVER_FRAME_SHEETS = new Set(['cover', 'case', 'jacket', 'endpapers', 'endpaperFront', 'endpaperBack']);
15
+ const FRAME_OPEN = /^[ \t]{0,3}(:{3,})[ \t]*frame[ \t]*\{([^}\n]*)\}[ \t]*$/gm;
16
+ const SLOT_ATTR = /(?:^|\s)slot\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"']+))/;
17
+ const SHEET_ATTR = /(?:^|\s)sheet\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"']+))/;
18
+ /** The slots the cover's Markdown fills, in order, with where each frame
19
+ * opens and the sheets it is for (`sheet="case jacket"`; absent: every
20
+ * sheet). */
21
+ export function coverFrames(markdown) {
22
+ const out = [];
23
+ for (const m of markdown.matchAll(FRAME_OPEN)) {
24
+ const attr = SLOT_ATTR.exec(m[2]);
25
+ if (!attr)
26
+ continue;
27
+ const sheet = SHEET_ATTR.exec(m[2]);
28
+ const sheets = sheet ? (sheet[1] ?? sheet[2] ?? sheet[3] ?? '').split(/[\s,]+/).filter(Boolean) : undefined;
29
+ out.push({ slot: attr[1] ?? attr[2] ?? attr[3] ?? '', start: m.index, end: m.index + m[0].length, ...(sheets ? { sheets } : {}) });
30
+ }
31
+ return out;
32
+ }
33
+ /** The marks the inline parser reads back after a backslash: emphasis,
34
+ * strikethrough, super- and subscript, code, cross-references and maths.
35
+ * Any other mark escaped would print its backslash. */
36
+ const LITERAL_MARKS = /[*_^~+`@$]/g;
37
+ /** Text as Markdown that reads as written: the inline marks escaped, line
38
+ * breaks as spaces. */
39
+ export function markdownLiteral(text) {
40
+ return text.replace(/\s+/g, ' ').trim().replace(LITERAL_MARKS, (c) => `\\${c}`);
41
+ }
42
+ const metaText = (v) => (typeof v === 'string' ? v.trim() : typeof v === 'number' ? String(v) : '');
43
+ function styled(style, text) {
44
+ return `:::paragraphs{style="${style}"}\n${markdownLiteral(text)}\n:::`;
45
+ }
46
+ /**
47
+ * The Markdown the cover is laid out from: the cover's own frames inside
48
+ * the cover's page fence, and a frame for the front and one for the spine
49
+ * when the cover has the slot, the Markdown leaves it empty and the
50
+ * metadata has something to put there. `slots` are the cover page's
51
+ * (`CoverPage.slots`); `sheets`, the names of the sheet being laid out
52
+ * (`case`, `endpaperFront` and `endpapers`…): a frame for other sheets is
53
+ * left out, and one for this sheet takes its slot over a frame for every
54
+ * sheet.
55
+ */
56
+ export function coverSource(markdown, slots, metadata = {}, sheets = []) {
57
+ const own = (markdown ?? '').replace(/\r\n?/g, '\n').trim();
58
+ const issues = [];
59
+ const known = new Set(slots);
60
+ const here = new Set(sheets);
61
+ const filled = new Set();
62
+ const frames = coverFrames(own);
63
+ const forHere = (f) => !f.sheets || f.sheets.some((s) => here.has(s));
64
+ // The slots a frame of this sheet's own fills.
65
+ const ownSlots = new Set(frames.filter((f) => f.sheets && forHere(f)).map((f) => f.slot));
66
+ // A frame the cover cannot take is blanked, its text and its fence up to
67
+ // the next frame, so that nothing spills onto a page of its own and the
68
+ // offsets of what follows stay the Markdown's.
69
+ let kept = own;
70
+ const blank = (i) => {
71
+ const to = frames[i + 1]?.start ?? own.length;
72
+ kept = kept.slice(0, frames[i].start) + kept.slice(frames[i].start, to).replace(/[^\n]/g, ' ') + kept.slice(to);
73
+ };
74
+ frames.forEach((f, i) => {
75
+ const strange = f.sheets?.find((s) => !COVER_FRAME_SHEETS.has(s));
76
+ if (strange !== undefined)
77
+ issues.push({ kind: 'coverFrameSheetUnknown', sheet: strange, sourceStart: f.start, sourceEnd: f.end });
78
+ // Another sheet's frame, or a frame for every sheet where this one
79
+ // has its own: no mistake, only not this sheet's.
80
+ if (!forHere(f) || (!f.sheets && ownSlots.has(f.slot)))
81
+ return blank(i);
82
+ const unknown = !known.has(f.slot);
83
+ if (unknown)
84
+ issues.push({ kind: 'coverSlotUnknown', slot: f.slot, sourceStart: f.start, sourceEnd: f.end });
85
+ else if (filled.has(f.slot))
86
+ issues.push({ kind: 'coverSlotRepeated', slot: f.slot, sourceStart: f.start, sourceEnd: f.end });
87
+ if (unknown || filled.has(f.slot))
88
+ blank(i);
89
+ filled.add(f.slot);
90
+ });
91
+ const title = metaText(metadata.title);
92
+ const subtitle = metaText(metadata.subtitle);
93
+ const author = metaText(metadata.author);
94
+ const added = [];
95
+ if (known.has('front') && !filled.has('front') && (title || subtitle || author)) {
96
+ const parts = [
97
+ ...(title ? [styled('cover-title', title)] : []),
98
+ ...(subtitle ? [styled('cover-subtitle', subtitle)] : []),
99
+ ...(author ? [styled('cover-author', author)] : []),
100
+ ];
101
+ added.push(`:::frame{slot="front"}\n${parts.join('\n\n')}\n:::`);
102
+ }
103
+ if (known.has('spine') && !filled.has('spine') && (title || author)) {
104
+ added.push(`:::frame{slot="spine"}\n${styled('cover-spine', [title, author].filter(Boolean).join(' · '))}\n:::`);
105
+ }
106
+ // The cover's own text first, so its source offsets inside the page are
107
+ // the Markdown's shifted by the fence alone.
108
+ const body = [kept.trim() ? kept : '', ...added].filter(Boolean).join('\n\n');
109
+ return { markdown: `::::page{template="${COVER_TEMPLATE_ID}"}\n${body}\n::::`, issues };
110
+ }
111
+ /** Where the cover's Markdown starts in `coverSource`'s: its offsets
112
+ * minus this are the cover's own. */
113
+ export const coverSourceOffset = () => `::::page{template="${COVER_TEMPLATE_ID}"}\n`.length;
114
+ /**
115
+ * The paragraph styles the cover sets its metadata text in, from the
116
+ * book's body text: the book's own style of each id goes over its
117
+ * default, field by field. The title and
118
+ * subtitle are centred at 2.4 and 1.4 times the body size, the author at
119
+ * 1.2, the spine's line at the body size, a catalogue's titles at the body
120
+ * size from the left; none hyphenated.
121
+ */
122
+ export function coverParagraphStyles(own, bodySizePt = 10) {
123
+ const have = new Set((own ?? []).map((s) => s.id));
124
+ const pt = (k) => ({ value: Math.round(bodySizePt * k * 10) / 10, unit: 'pt' });
125
+ const defaults = [
126
+ { id: 'cover-title', fontSize: pt(2.4), lineHeight: pt(2.8), fontWeight: 700, textAlign: 'center', hyphenation: false },
127
+ { id: 'cover-subtitle', fontSize: pt(1.4), lineHeight: pt(1.8), textAlign: 'center', hyphenation: false },
128
+ { id: 'cover-author', fontSize: pt(1.2), lineHeight: pt(1.6), textAlign: 'center', hyphenation: false },
129
+ { id: 'cover-spine', fontSize: pt(1), lineHeight: pt(1.2), textAlign: 'center', hyphenation: false },
130
+ // A collection's titles (`::catalogue`), the book's own in bold.
131
+ { id: 'cover-catalogue', fontSize: pt(1), lineHeight: pt(1.4), textAlign: 'left', hyphenation: false },
132
+ { id: 'cover-catalogue-current', fontSize: pt(1), lineHeight: pt(1.4), fontWeight: 700, textAlign: 'left', hyphenation: false },
133
+ ];
134
+ // A style of the book's with one of these ids keeps the defaults it
135
+ // leaves out (a colour alone keeps the size and the centring).
136
+ const byId = new Map(defaults.map((d) => [d.id, d]));
137
+ return [
138
+ ...(own ?? []).map((s) => (byId.has(s.id) ? { ...byId.get(s.id), ...s } : s)),
139
+ ...defaults.filter((d) => !have.has(d.id)),
140
+ ];
141
+ }
142
+ //# sourceMappingURL=coverSource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coverSource.js","sourceRoot":"","sources":["../../src/production/coverSource.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD;oDACoD;AACpD,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,aAAa,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,CAAU,CAAC;AAahH,oEAAoE;AACpE,MAAM,CAAC,MAAM,kBAAkB,GAAwB,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,MAAM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one user exports and another
3
+ * imports (`.postext-production.json`), as design templates travel.
4
+ */
5
+ import type { BindingProfile, PaperProfile } from '../types/output/production.js';
6
+ export declare const PRODUCTION_FILE_FORMAT = "postext-production";
7
+ export declare const PRODUCTION_FILE_VERSION = 1;
8
+ export interface ProductionFile {
9
+ format: typeof PRODUCTION_FILE_FORMAT;
10
+ version: number;
11
+ papers: PaperProfile[];
12
+ bindings: BindingProfile[];
13
+ }
14
+ /** Something in an imported file that was left out, and why. */
15
+ export interface ProductionImportIssue {
16
+ where: string;
17
+ reason: 'notAProductionFile' | 'newerVersion' | 'missingId' | 'unknownStyle' | 'badMeasure' | 'badNumber' | 'badText';
18
+ }
19
+ /** The file for these profiles. */
20
+ export declare function exportProductionProfiles(papers: readonly PaperProfile[], bindings: readonly BindingProfile[]): ProductionFile;
21
+ /** A paper profile as read from untrusted data, or undefined when it has
22
+ * no id. Fields that do not read are dropped and listed in `issues`. */
23
+ export declare function readPaperProfile(p: unknown, where: string, issues: ProductionImportIssue[]): PaperProfile | undefined;
24
+ /** A binding profile as read from untrusted data, or undefined when it has
25
+ * no id or an unknown style. Fields that do not read are dropped and
26
+ * listed in `issues`. */
27
+ export declare function readBindingProfile(b: unknown, where: string, issues: ProductionImportIssue[]): BindingProfile | undefined;
28
+ /** The profiles of a file (parsed JSON), each one checked: a profile
29
+ * without an id or with an unknown binding style is left out; a measure
30
+ * that is unknown or unreadable is dropped from its profile. What was left
31
+ * out is listed in `issues`. Ids are kept as written: the caller decides
32
+ * what to do with one the library already has. */
33
+ export declare function importProductionProfiles(data: unknown): {
34
+ papers: PaperProfile[];
35
+ bindings: BindingProfile[];
36
+ issues: ProductionImportIssue[];
37
+ };
38
+ //# sourceMappingURL=exchange.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exchange.d.ts","sourceRoot":"","sources":["../../src/production/exchange.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAmB,cAAc,EAAgB,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAGjH,eAAO,MAAM,sBAAsB,uBAAuB,CAAC;AAC3D,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,OAAO,sBAAsB,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,QAAQ,EAAE,cAAc,EAAE,CAAC;CAC5B;AAED,gEAAgE;AAChE,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,oBAAoB,GAAG,cAAc,GAAG,WAAW,GAAG,cAAc,GAAG,YAAY,GAAG,WAAW,GAAG,SAAS,CAAC;CACvH;AASD,mCAAmC;AACnC,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,EAAE,QAAQ,EAAE,SAAS,cAAc,EAAE,GAAG,cAAc,CAO7H;AAkCD;yEACyE;AACzE,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,qBAAqB,EAAE,GAAG,YAAY,GAAG,SAAS,CAsBrH;AAED;;0BAE0B;AAC1B,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,qBAAqB,EAAE,GAAG,cAAc,GAAG,SAAS,CAgCzH;AAED;;;;mDAImD;AACnD,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,OAAO,GAAG;IACvD,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,MAAM,EAAE,qBAAqB,EAAE,CAAC;CACjC,CAmBA"}
@@ -0,0 +1,146 @@
1
+ /**
2
+ * Paper and binding profiles as a file one user exports and another
3
+ * imports (`.postext-production.json`), as design templates travel.
4
+ */
5
+ import { isNum, isRecord } from './guards.js';
6
+ export const PRODUCTION_FILE_FORMAT = 'postext-production';
7
+ export const PRODUCTION_FILE_VERSION = 1;
8
+ const STYLES = new Set(['perfect', 'sewnSoftcover', 'caseFlat', 'caseRound']);
9
+ const MEASURES = new Set([
10
+ 'spineAllowance', 'bleed', 'hingeScore', 'flapWidth', 'flapFoldInset', 'board', 'square', 'joint', 'turnIn',
11
+ 'boardSetback', 'caseSpineAllowance', 'roundSpineAllowance', 'jacketFoldAllowance', 'jacketFlapWidth', 'jacketBleed',
12
+ 'endpaperGlueStrip', 'endpaperBleed', 'safeMargin', 'designMargin',
13
+ ]);
14
+ /** The file for these profiles. */
15
+ export function exportProductionProfiles(papers, bindings) {
16
+ return {
17
+ format: PRODUCTION_FILE_FORMAT,
18
+ version: PRODUCTION_FILE_VERSION,
19
+ papers: structuredClone([...papers]),
20
+ bindings: structuredClone([...bindings]),
21
+ };
22
+ }
23
+ const isTrim = (v) => isRecord(v) && isNum(v.width) && isNum(v.height);
24
+ /** `accepts` as written, or undefined when any part of it does not read:
25
+ * trims with a width and a height, spine limits as numbers. */
26
+ function validAccepts(v) {
27
+ if (!isRecord(v))
28
+ return false;
29
+ const { trim, spine } = v;
30
+ if (trim !== undefined && !(isRecord(trim) && (trim.min === undefined || isTrim(trim.min)) && (trim.max === undefined || isTrim(trim.max))))
31
+ return false;
32
+ if (spine !== undefined && !(isRecord(spine) && (spine.min === undefined || isNum(spine.min)) && (spine.max === undefined || isNum(spine.max))))
33
+ return false;
34
+ return true;
35
+ }
36
+ /** Drops each named field that is present but not a string. */
37
+ function keepStrings(o, keys, where, issues) {
38
+ for (const key of keys) {
39
+ if (o[key] !== undefined && typeof o[key] !== 'string') {
40
+ delete o[key];
41
+ issues.push({ where: `${where}.${key}`, reason: 'badText' });
42
+ }
43
+ }
44
+ }
45
+ function validLength(v) {
46
+ if (isNum(v))
47
+ return true;
48
+ if (Array.isArray(v)) {
49
+ return v.length > 0 && v.every((s) => isRecord(s) && isNum(s.mm)
50
+ && (s.upTo === undefined || (isRecord(s.upTo) && isNum(s.upTo.width) && isNum(s.upTo.height))));
51
+ }
52
+ return isRecord(v) && isNum(v.ratio) && (v.min === undefined || isNum(v.min)) && (v.max === undefined || isNum(v.max))
53
+ && (v.of === undefined || v.of === 'width' || v.of === 'height');
54
+ }
55
+ /** A paper profile as read from untrusted data, or undefined when it has
56
+ * no id. Fields that do not read are dropped and listed in `issues`. */
57
+ export function readPaperProfile(p, where, issues) {
58
+ if (!isRecord(p) || typeof p.id !== 'string' || !p.id) {
59
+ issues.push({ where, reason: 'missingId' });
60
+ return undefined;
61
+ }
62
+ const paper = structuredClone(p);
63
+ for (const key of ['grammage', 'bulk']) {
64
+ if (paper[key] !== undefined && !(isNum(paper[key]) && paper[key] > 0)) {
65
+ delete paper[key];
66
+ issues.push({ where: `${where}.${key}`, reason: 'badNumber' });
67
+ }
68
+ }
69
+ for (const [key, value] of Object.entries(paper)) {
70
+ // A paper's other fields are Folio's: words and numbers only.
71
+ if (value !== undefined && typeof value !== 'string' && !(typeof value === 'number' && Number.isFinite(value)) && typeof value !== 'boolean') {
72
+ delete paper[key];
73
+ issues.push({ where: `${where}.${key}`, reason: 'badText' });
74
+ }
75
+ }
76
+ keepStrings(paper, ['name', 'supplier', 'commercialName'], where, issues);
77
+ if (typeof paper.name !== 'string')
78
+ paper.name = paper.id;
79
+ return paper;
80
+ }
81
+ /** A binding profile as read from untrusted data, or undefined when it has
82
+ * no id or an unknown style. Fields that do not read are dropped and
83
+ * listed in `issues`. */
84
+ export function readBindingProfile(b, where, issues) {
85
+ if (!isRecord(b) || typeof b.id !== 'string' || !b.id) {
86
+ issues.push({ where, reason: 'missingId' });
87
+ return undefined;
88
+ }
89
+ if (typeof b.style !== 'string' || !STYLES.has(b.style)) {
90
+ issues.push({ where, reason: 'unknownStyle' });
91
+ return undefined;
92
+ }
93
+ const binding = structuredClone(b);
94
+ keepStrings(binding, ['name', 'printer'], where, issues);
95
+ if (typeof binding.name !== 'string')
96
+ binding.name = binding.id;
97
+ if (binding.accepts !== undefined && !validAccepts(binding.accepts)) {
98
+ delete binding.accepts;
99
+ issues.push({ where: `${where}.accepts`, reason: 'badNumber' });
100
+ }
101
+ if (binding.signature !== undefined && !(isNum(binding.signature) && binding.signature > 0)) {
102
+ delete binding.signature;
103
+ issues.push({ where: `${where}.signature`, reason: 'badNumber' });
104
+ }
105
+ if (isRecord(binding.measures)) {
106
+ for (const [key, value] of Object.entries(binding.measures)) {
107
+ if (!(MEASURES.has(key) && validLength(value))) {
108
+ delete binding.measures[key];
109
+ issues.push({ where: `${where}.measures.${key}`, reason: MEASURES.has(key) ? 'badNumber' : 'badMeasure' });
110
+ }
111
+ }
112
+ }
113
+ else if (binding.measures !== undefined) {
114
+ delete binding.measures;
115
+ issues.push({ where: `${where}.measures`, reason: 'badMeasure' });
116
+ }
117
+ return binding;
118
+ }
119
+ /** The profiles of a file (parsed JSON), each one checked: a profile
120
+ * without an id or with an unknown binding style is left out; a measure
121
+ * that is unknown or unreadable is dropped from its profile. What was left
122
+ * out is listed in `issues`. Ids are kept as written: the caller decides
123
+ * what to do with one the library already has. */
124
+ export function importProductionProfiles(data) {
125
+ const issues = [];
126
+ const papers = [];
127
+ const bindings = [];
128
+ if (!isRecord(data) || data.format !== PRODUCTION_FILE_FORMAT) {
129
+ return { papers, bindings, issues: [{ where: 'file', reason: 'notAProductionFile' }] };
130
+ }
131
+ if (typeof data.version !== 'number' || data.version > PRODUCTION_FILE_VERSION) {
132
+ issues.push({ where: 'file', reason: 'newerVersion' });
133
+ }
134
+ (Array.isArray(data.papers) ? data.papers : []).forEach((p, i) => {
135
+ const paper = readPaperProfile(p, `papers[${i}]`, issues);
136
+ if (paper)
137
+ papers.push(paper);
138
+ });
139
+ (Array.isArray(data.bindings) ? data.bindings : []).forEach((b, i) => {
140
+ const binding = readBindingProfile(b, `bindings[${i}]`, issues);
141
+ if (binding)
142
+ bindings.push(binding);
143
+ });
144
+ return { papers, bindings, issues };
145
+ }
146
+ //# sourceMappingURL=exchange.js.map
@@ -0,0 +1 @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AE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,oBAAoB,EAAE,CAAC,EAAE,CAAC;IACzF,CAAC;IACD,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,IAAI,IAAI,CAAC,OAAO,GAAG,uBAAuB,EAAE,CAAC;QAC/E,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC;IACzD,CAAC;IACD,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QAC/D,MAAM,KAAK,GAAG,gBAAgB,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAC1D,IAAI,KAAK;YAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;IACH,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACnE,MAAM,OAAO,GAAG,kBAAkB,CAAC,CAAC,EAAE,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAChE,IAAI,OAAO;YAAE,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;AACtC,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The 3D book of a version (#1668): Folio binds the book as the version
3
+ * it shows is bound, with the binding's settings under the book's own
4
+ * `folio` settings, which always win.
5
+ */
6
+ import type { FolioBindingConfig, FolioConfig } from '../types/output/folio.js';
7
+ import type { ProductionConfig, ProductionVersion } from '../types/output/production.js';
8
+ /** The version Folio shows: the one named, else the book's first. */
9
+ export declare function folioVersionOf(production: ProductionConfig | undefined, versionId?: string): ProductionVersion | undefined;
10
+ /** The binding a version gives Folio's book: how it is bound and what its
11
+ * cover is made of (a cloth case, else a printed one). Undefined when
12
+ * the book has no version or its binding profile is not found. */
13
+ export declare function productionFolioBinding(production: ProductionConfig | undefined, versionId?: string): FolioBindingConfig | undefined;
14
+ /** A book's `folio` settings with its version's binding under them: what
15
+ * Folio shows when the Design settings leave the binding alone. The book's
16
+ * own `folio` when it has no version. */
17
+ export declare function folioOfBook(config: {
18
+ folio?: FolioConfig;
19
+ production?: ProductionConfig;
20
+ }, versionId?: string): FolioConfig | undefined;
21
+ //# sourceMappingURL=folio.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"folio.d.ts","sourceRoot":"","sources":["../../src/production/folio.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAChF,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAIzF,qEAAqE;AACrE,wBAAgB,cAAc,CAAC,UAAU,EAAE,gBAAgB,GAAG,SAAS,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAG1H;AAED;;mEAEmE;AACnE,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,gBAAgB,GAAG,SAAS,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS,CAOnI;AAED;;0CAE0C;AAC1C,wBAAgB,WAAW,CAAC,MAAM,EAAE;IAAE,KAAK,CAAC,EAAE,WAAW,CAAC;IAAC,UAAU,CAAC,EAAE,gBAAgB,CAAA;CAAE,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAIvI"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * The 3D book of a version (#1668): Folio binds the book as the version
3
+ * it shows is bound, with the binding's settings under the book's own
4
+ * `folio` settings, which always win.
5
+ */
6
+ import { FOLIO_BINDING_OF_STYLE } from './measures.js';
7
+ import { findBindingProfile, isCaseBinding } from './version.js';
8
+ /** The version Folio shows: the one named, else the book's first. */
9
+ export function folioVersionOf(production, versionId) {
10
+ const versions = production?.versions ?? [];
11
+ return (versionId !== undefined ? versions.find((v) => v.id === versionId) : undefined) ?? versions[0];
12
+ }
13
+ /** The binding a version gives Folio's book: how it is bound and what its
14
+ * cover is made of (a cloth case, else a printed one). Undefined when
15
+ * the book has no version or its binding profile is not found. */
16
+ export function productionFolioBinding(production, versionId) {
17
+ const version = folioVersionOf(production, versionId);
18
+ if (!version)
19
+ return undefined;
20
+ const profile = findBindingProfile(version.binding, production?.bindings);
21
+ if (!profile)
22
+ return undefined;
23
+ const cloth = isCaseBinding(profile.style) && version.caseMaterial === 'cloth';
24
+ return { type: FOLIO_BINDING_OF_STYLE[profile.style], coverMaterial: cloth ? 'cloth' : 'paper' };
25
+ }
26
+ /** A book's `folio` settings with its version's binding under them: what
27
+ * Folio shows when the Design settings leave the binding alone. The book's
28
+ * own `folio` when it has no version. */
29
+ export function folioOfBook(config, versionId) {
30
+ const binding = productionFolioBinding(config.production, versionId);
31
+ if (!binding)
32
+ return config.folio;
33
+ return { ...config.folio, binding: { ...binding, ...config.folio?.binding } };
34
+ }
35
+ //# sourceMappingURL=folio.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"folio.js","sourceRoot":"","sources":["../../src/production/folio.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAEjE,qEAAqE;AACrE,MAAM,UAA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AK,EAAE,OAAO,EAAE,EAAE,CAAC;AAChF,CAAC"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * The flat sheets of a manufactured book, in millimetres: the cover of a
3
+ * softcover, the case of a hardcover, its dust jacket and its endpapers.
4
+ * Each sheet is a row of named zones (the back cover, the spine, the front
5
+ * cover, the flaps, the joints…) with the folds and scores between them,
6
+ * the area kept clear inside each, and the bleed (or turn-in) round it. A
7
+ * design anchors to the zones, so a change of binding moves it with them.
8
+ */
9
+ import type { BindingStyle, TrimMm } from '../types/output/production.js';
10
+ import type { CoverZoneName, SheetRect } from '../types/output/cover.js';
11
+ import type { ResolvedBindingMeasures } from './measures.js';
12
+ export type { CoverZoneName, SheetRect } from '../types/output/cover.js';
13
+ export interface SheetZone {
14
+ name: CoverZoneName;
15
+ rect: SheetRect;
16
+ /** Where text and anything that must not be cut or folded can go. */
17
+ safe: SheetRect;
18
+ }
19
+ /** A line across the sheet: a fold (spine, flap, turn-in), a score (the
20
+ * hinge of a softcover), a joint of a case, or the glue line of an
21
+ * endpaper. Vertical, at `x` mm. */
22
+ export interface SheetLine {
23
+ x: number;
24
+ kind: 'fold' | 'score' | 'joint' | 'glue';
25
+ }
26
+ export interface ProductionSheet {
27
+ kind: 'softcover' | 'case' | 'jacket' | 'endpaper' | 'promo';
28
+ /** The whole sheet, bleed or turn-in included, mm. */
29
+ width: number;
30
+ height: number;
31
+ /** The finished piece: the cover as trimmed, the case as covered (to the
32
+ * outer edges of its boards), the endpaper spread. */
33
+ trim: SheetRect;
34
+ /** Bleed past the trim, mm: the turn-in on a case. On an endpaper, none
35
+ * at the fold. */
36
+ bleed: number;
37
+ zones: SheetZone[];
38
+ lines: SheetLine[];
39
+ /** Width of the spine zone, mm (0 on an endpaper). */
40
+ spine: number;
41
+ }
42
+ /** Safe margin either side inside a spine: 2 mm, 1 mm on spines of 9 mm
43
+ * or less (IngramSpark). */
44
+ export declare const spineSafeMargin: (spine: number) => number;
45
+ /** A sheet read from the right (a book bound on the right: Arabic,
46
+ * Hebrew, a vertical Chinese or Japanese book): the same panels in
47
+ * mirror order, the front on the left and the back on the right, with
48
+ * every zone, safe area and line moved across. Its zones stay listed left
49
+ * to right. */
50
+ export declare function mirrorSheet(sheet: ProductionSheet): ProductionSheet;
51
+ /** The cover sheet of a softcover: back, spine and front (and the flaps),
52
+ * scored at the spine and at the hinges, with bleed all round. */
53
+ export declare function softcoverSheet(trim: TrimMm, spine: number, m: ResolvedBindingMeasures, flaps: boolean): ProductionSheet;
54
+ /** Board size of a case for a trim, mm. */
55
+ export declare function caseBoard(trim: TrimMm, m: ResolvedBindingMeasures): TrimMm;
56
+ /** Width of the spine of a case, mm: the block's spine, the two boards
57
+ * beside it and the allowance, and on a round case the round's own. */
58
+ export declare function caseSpineWidth(blockSpine: number, style: BindingStyle, m: ResolvedBindingMeasures): number;
59
+ /** The covering sheet of a case: two boards and the spine with a joint
60
+ * either side, and the turn-in all round. Text keeps clear of the board
61
+ * edges by the board's thickness, which the material wraps round. */
62
+ export declare function caseSheet(trim: TrimMm, caseSpine: number, m: ResolvedBindingMeasures): ProductionSheet;
63
+ /** The dust jacket of a case: as tall as the boards, its spine the case's,
64
+ * its panels reaching over the joint to the fore-edge and a little past
65
+ * it for the board the flap folds round, and its flaps. */
66
+ export declare function jacketSheet(trim: TrimMm, caseSpine: number, m: ResolvedBindingMeasures): ProductionSheet;
67
+ /** One endpaper spread, the size of two pages of the block: the pastedown
68
+ * glued to the board and the free flyleaf, the fold between them with
69
+ * its glue strip and the joint kept clear, bleed at head, foot and the
70
+ * outer edges. `side` is the front or back of the book; `rtl`, a book
71
+ * bound on the right. */
72
+ export declare function endpaperSheet(trim: TrimMm, m: ResolvedBindingMeasures, side: 'front' | 'back', rtl?: boolean): ProductionSheet;
73
+ /** Pictures of the front cover for screens: an EPUB's cover and the usual
74
+ * social media sizes, in pixels. */
75
+ export type PromoFormat = 'epub' | 'square' | 'story' | 'landscape';
76
+ export declare const PROMO_FORMATS: Readonly<Record<PromoFormat, {
77
+ width: number;
78
+ height: number;
79
+ }>>;
80
+ /** The front cover recomposed in a screen format: one zone, the front,
81
+ * as wide as the trim so its type keeps its size against it, as tall as
82
+ * the format says; no bleed, no folds. */
83
+ export declare function promoSheet(trim: TrimMm, format: PromoFormat, safeMargin: number): ProductionSheet;
84
+ //# sourceMappingURL=geometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../../src/production/geometry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACzE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAE7D,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAEzE,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,SAAS,CAAC;IAChB,qEAAqE;IACrE,IAAI,EAAE,SAAS,CAAC;CACjB;AAED;;qCAEqC;AACrC,MAAM,WAAW,SAAS;IACxB,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC;CAC3C;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,CAAC;IAC7D,sDAAsD;IACtD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf;2DACuD;IACvD,IAAI,EAAE,SAAS,CAAC;IAChB;uBACmB;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,sDAAsD;IACtD,KAAK,EAAE,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