postext 1.35.1 → 1.37.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 (273) hide show
  1. package/dist/__bench__/composedPage.bench.test.d.ts +2 -0
  2. package/dist/__bench__/composedPage.bench.test.d.ts.map +1 -0
  3. package/dist/__bench__/composedPage.bench.test.js +95 -0
  4. package/dist/__bench__/composedPage.bench.test.js.map +1 -0
  5. package/dist/__tests__/composed/continuation.test.d.ts +2 -0
  6. package/dist/__tests__/composed/continuation.test.d.ts.map +1 -0
  7. package/dist/__tests__/composed/continuation.test.js +352 -0
  8. package/dist/__tests__/composed/continuation.test.js.map +1 -0
  9. package/dist/__tests__/composed/contrast.test.d.ts +2 -0
  10. package/dist/__tests__/composed/contrast.test.d.ts.map +1 -0
  11. package/dist/__tests__/composed/contrast.test.js +124 -0
  12. package/dist/__tests__/composed/contrast.test.js.map +1 -0
  13. package/dist/__tests__/composed/corpus.test.js +7 -1
  14. package/dist/__tests__/composed/corpus.test.js.map +1 -1
  15. package/dist/__tests__/composed/fit.test.d.ts +2 -0
  16. package/dist/__tests__/composed/fit.test.d.ts.map +1 -0
  17. package/dist/__tests__/composed/fit.test.js +408 -0
  18. package/dist/__tests__/composed/fit.test.js.map +1 -0
  19. package/dist/__tests__/composed/groups.test.js +14 -0
  20. package/dist/__tests__/composed/groups.test.js.map +1 -1
  21. package/dist/__tests__/composed/headingDesigns.test.d.ts +2 -0
  22. package/dist/__tests__/composed/headingDesigns.test.d.ts.map +1 -0
  23. package/dist/__tests__/composed/headingDesigns.test.js +262 -0
  24. package/dist/__tests__/composed/headingDesigns.test.js.map +1 -0
  25. package/dist/__tests__/composed/labels.test.d.ts +2 -0
  26. package/dist/__tests__/composed/labels.test.d.ts.map +1 -0
  27. package/dist/__tests__/composed/labels.test.js +326 -0
  28. package/dist/__tests__/composed/labels.test.js.map +1 -0
  29. package/dist/__tests__/composed/layout.test.js +2 -1
  30. package/dist/__tests__/composed/layout.test.js.map +1 -1
  31. package/dist/__tests__/composed/outsidePrint.test.js +5 -2
  32. package/dist/__tests__/composed/outsidePrint.test.js.map +1 -1
  33. package/dist/__tests__/composed/pageMemo.test.d.ts +2 -0
  34. package/dist/__tests__/composed/pageMemo.test.d.ts.map +1 -0
  35. package/dist/__tests__/composed/pageMemo.test.js +128 -0
  36. package/dist/__tests__/composed/pageMemo.test.js.map +1 -0
  37. package/dist/__tests__/composed/sourceMap.test.d.ts +2 -0
  38. package/dist/__tests__/composed/sourceMap.test.d.ts.map +1 -0
  39. package/dist/__tests__/composed/sourceMap.test.js +395 -0
  40. package/dist/__tests__/composed/sourceMap.test.js.map +1 -0
  41. package/dist/__tests__/composed/spreadLabels.test.d.ts +2 -0
  42. package/dist/__tests__/composed/spreadLabels.test.d.ts.map +1 -0
  43. package/dist/__tests__/composed/spreadLabels.test.js +131 -0
  44. package/dist/__tests__/composed/spreadLabels.test.js.map +1 -0
  45. package/dist/__tests__/composed/templateFrameRects.test.d.ts +2 -0
  46. package/dist/__tests__/composed/templateFrameRects.test.d.ts.map +1 -0
  47. package/dist/__tests__/composed/templateFrameRects.test.js +37 -0
  48. package/dist/__tests__/composed/templateFrameRects.test.js.map +1 -0
  49. package/dist/__tests__/design/imageAltText.test.js +2 -1
  50. package/dist/__tests__/design/imageAltText.test.js.map +1 -1
  51. package/dist/__tests__/exports.test.js +33 -0
  52. package/dist/__tests__/exports.test.js.map +1 -1
  53. package/dist/__tests__/migrate/fixtures/textbookPort.d.ts +14 -0
  54. package/dist/__tests__/migrate/fixtures/textbookPort.d.ts.map +1 -0
  55. package/dist/__tests__/migrate/fixtures/textbookPort.js +116 -0
  56. package/dist/__tests__/migrate/fixtures/textbookPort.js.map +1 -0
  57. package/dist/__tests__/migrate/textToMarkdown.test.d.ts +2 -0
  58. package/dist/__tests__/migrate/textToMarkdown.test.d.ts.map +1 -0
  59. package/dist/__tests__/migrate/textToMarkdown.test.js +268 -0
  60. package/dist/__tests__/migrate/textToMarkdown.test.js.map +1 -0
  61. package/dist/__tests__/paragraphStyleLetterSpacing.test.d.ts +2 -0
  62. package/dist/__tests__/paragraphStyleLetterSpacing.test.d.ts.map +1 -0
  63. package/dist/__tests__/paragraphStyleLetterSpacing.test.js +89 -0
  64. package/dist/__tests__/paragraphStyleLetterSpacing.test.js.map +1 -0
  65. package/dist/__tests__/pictureBelowPrintSize.test.d.ts +2 -0
  66. package/dist/__tests__/pictureBelowPrintSize.test.d.ts.map +1 -0
  67. package/dist/__tests__/pictureBelowPrintSize.test.js +82 -0
  68. package/dist/__tests__/pictureBelowPrintSize.test.js.map +1 -0
  69. package/dist/__tests__/pipeline/contourWrap.test.d.ts +2 -0
  70. package/dist/__tests__/pipeline/contourWrap.test.d.ts.map +1 -0
  71. package/dist/__tests__/pipeline/contourWrap.test.js +412 -0
  72. package/dist/__tests__/pipeline/contourWrap.test.js.map +1 -0
  73. package/dist/__tests__/pipeline/paragraphStyleFaces.test.js +1 -1
  74. package/dist/__tests__/pipeline/paragraphStyleFaces.test.js.map +1 -1
  75. package/dist/__tests__/toc.test.js +3 -2
  76. package/dist/__tests__/toc.test.js.map +1 -1
  77. package/dist/bundle/codec.d.ts +16 -0
  78. package/dist/bundle/codec.d.ts.map +1 -1
  79. package/dist/bundle/codec.js +44 -2
  80. package/dist/bundle/codec.js.map +1 -1
  81. package/dist/bundle/index.d.ts +1 -1
  82. package/dist/bundle/index.d.ts.map +1 -1
  83. package/dist/bundle/index.js +1 -1
  84. package/dist/bundle/index.js.map +1 -1
  85. package/dist/canvas-backend/composed.d.ts +5 -2
  86. package/dist/canvas-backend/composed.d.ts.map +1 -1
  87. package/dist/canvas-backend/composed.js +10 -5
  88. package/dist/canvas-backend/composed.js.map +1 -1
  89. package/dist/canvas-backend/index.d.ts.map +1 -1
  90. package/dist/canvas-backend/index.js +37 -19
  91. package/dist/canvas-backend/index.js.map +1 -1
  92. package/dist/canvas-backend/renderResourceBlock.d.ts +5 -1
  93. package/dist/canvas-backend/renderResourceBlock.d.ts.map +1 -1
  94. package/dist/canvas-backend/renderResourceBlock.js +60 -1
  95. package/dist/canvas-backend/renderResourceBlock.js.map +1 -1
  96. package/dist/composed/continuation.d.ts +102 -0
  97. package/dist/composed/continuation.d.ts.map +1 -0
  98. package/dist/composed/continuation.js +87 -0
  99. package/dist/composed/continuation.js.map +1 -0
  100. package/dist/composed/contour.d.ts +21 -0
  101. package/dist/composed/contour.d.ts.map +1 -0
  102. package/dist/composed/contour.js +34 -0
  103. package/dist/composed/contour.js.map +1 -0
  104. package/dist/composed/geometry.d.ts +8 -0
  105. package/dist/composed/geometry.d.ts.map +1 -1
  106. package/dist/composed/geometry.js +26 -0
  107. package/dist/composed/geometry.js.map +1 -1
  108. package/dist/composed/ids.d.ts +22 -0
  109. package/dist/composed/ids.d.ts.map +1 -0
  110. package/dist/composed/ids.js +32 -0
  111. package/dist/composed/ids.js.map +1 -0
  112. package/dist/composed/labels.d.ts +154 -0
  113. package/dist/composed/labels.d.ts.map +1 -0
  114. package/dist/composed/labels.js +524 -0
  115. package/dist/composed/labels.js.map +1 -0
  116. package/dist/composed/pageMemo.d.ts +73 -0
  117. package/dist/composed/pageMemo.d.ts.map +1 -0
  118. package/dist/composed/pageMemo.js +289 -0
  119. package/dist/composed/pageMemo.js.map +1 -0
  120. package/dist/composed/paint.d.ts +29 -9
  121. package/dist/composed/paint.d.ts.map +1 -1
  122. package/dist/composed/paint.js +41 -7
  123. package/dist/composed/paint.js.map +1 -1
  124. package/dist/composed/reflowLog.d.ts +14 -2
  125. package/dist/composed/reflowLog.d.ts.map +1 -1
  126. package/dist/composed/reflowLog.js +64 -7
  127. package/dist/composed/reflowLog.js.map +1 -1
  128. package/dist/composed/slotChecks.d.ts.map +1 -1
  129. package/dist/composed/slotChecks.js +3 -1
  130. package/dist/composed/slotChecks.js.map +1 -1
  131. package/dist/composed/sourceMap.d.ts +97 -0
  132. package/dist/composed/sourceMap.d.ts.map +1 -0
  133. package/dist/composed/sourceMap.js +748 -0
  134. package/dist/composed/sourceMap.js.map +1 -0
  135. package/dist/composed/spread.d.ts +3 -0
  136. package/dist/composed/spread.d.ts.map +1 -1
  137. package/dist/composed/spread.js +11 -12
  138. package/dist/composed/spread.js.map +1 -1
  139. package/dist/composed/templates.d.ts +1 -0
  140. package/dist/composed/templates.d.ts.map +1 -1
  141. package/dist/composed/templates.js +4 -0
  142. package/dist/composed/templates.js.map +1 -1
  143. package/dist/composed/types.d.ts +15 -32
  144. package/dist/composed/types.d.ts.map +1 -1
  145. package/dist/composed/validate.d.ts.map +1 -1
  146. package/dist/composed/validate.js +3 -2
  147. package/dist/composed/validate.js.map +1 -1
  148. package/dist/composed/wrap.d.ts.map +1 -1
  149. package/dist/composed/wrap.js +7 -1
  150. package/dist/composed/wrap.js.map +1 -1
  151. package/dist/configWarnings.d.ts +15 -0
  152. package/dist/configWarnings.d.ts.map +1 -1
  153. package/dist/configWarnings.js +29 -17
  154. package/dist/configWarnings.js.map +1 -1
  155. package/dist/contour/index.d.ts +134 -0
  156. package/dist/contour/index.d.ts.map +1 -0
  157. package/dist/contour/index.js +354 -0
  158. package/dist/contour/index.js.map +1 -0
  159. package/dist/contour/png.d.ts +16 -0
  160. package/dist/contour/png.d.ts.map +1 -0
  161. package/dist/contour/png.js +173 -0
  162. package/dist/contour/png.js.map +1 -0
  163. package/dist/contrast.d.ts +5 -3
  164. package/dist/contrast.d.ts.map +1 -1
  165. package/dist/contrast.js +46 -5
  166. package/dist/contrast.js.map +1 -1
  167. package/dist/defaults/paragraphStyles.d.ts +1 -1
  168. package/dist/defaults/paragraphStyles.d.ts.map +1 -1
  169. package/dist/defaults/paragraphStyles.js +5 -1
  170. package/dist/defaults/paragraphStyles.js.map +1 -1
  171. package/dist/design/slots.d.ts +12 -10
  172. package/dist/design/slots.d.ts.map +1 -1
  173. package/dist/design/slots.js +26 -2
  174. package/dist/design/slots.js.map +1 -1
  175. package/dist/fonts/faces.d.ts.map +1 -1
  176. package/dist/fonts/faces.js +6 -0
  177. package/dist/fonts/faces.js.map +1 -1
  178. package/dist/highlightMarks.d.ts.map +1 -1
  179. package/dist/highlightMarks.js +6 -0
  180. package/dist/highlightMarks.js.map +1 -1
  181. package/dist/html-backend.d.ts.map +1 -1
  182. package/dist/html-backend.js +42 -4
  183. package/dist/html-backend.js.map +1 -1
  184. package/dist/index.d.ts +18 -7
  185. package/dist/index.d.ts.map +1 -1
  186. package/dist/index.js +18 -4
  187. package/dist/index.js.map +1 -1
  188. package/dist/measure/rich.d.ts.map +1 -1
  189. package/dist/measure/rich.js +2 -0
  190. package/dist/measure/rich.js.map +1 -1
  191. package/dist/migrate/markdownRuns.d.ts +70 -0
  192. package/dist/migrate/markdownRuns.d.ts.map +1 -0
  193. package/dist/migrate/markdownRuns.js +215 -0
  194. package/dist/migrate/markdownRuns.js.map +1 -0
  195. package/dist/migrate/pageDesign.d.ts +119 -0
  196. package/dist/migrate/pageDesign.d.ts.map +1 -0
  197. package/dist/migrate/pageDesign.js +446 -0
  198. package/dist/migrate/pageDesign.js.map +1 -0
  199. package/dist/migrate/textToMarkdown.d.ts +124 -0
  200. package/dist/migrate/textToMarkdown.d.ts.map +1 -0
  201. package/dist/migrate/textToMarkdown.js +716 -0
  202. package/dist/migrate/textToMarkdown.js.map +1 -0
  203. package/dist/parse/blockParser.d.ts.map +1 -1
  204. package/dist/parse/blockParser.js +44 -3
  205. package/dist/parse/blockParser.js.map +1 -1
  206. package/dist/parse/types.d.ts +20 -0
  207. package/dist/parse/types.d.ts.map +1 -1
  208. package/dist/pipeline/build.d.ts.map +1 -1
  209. package/dist/pipeline/build.js +298 -30
  210. package/dist/pipeline/build.js.map +1 -1
  211. package/dist/pipeline/buildMeasurement.d.ts +7 -2
  212. package/dist/pipeline/buildMeasurement.d.ts.map +1 -1
  213. package/dist/pipeline/buildMeasurement.js +21 -5
  214. package/dist/pipeline/buildMeasurement.js.map +1 -1
  215. package/dist/pipeline/calloutLayout.d.ts +39 -14
  216. package/dist/pipeline/calloutLayout.d.ts.map +1 -1
  217. package/dist/pipeline/calloutLayout.js +50 -4
  218. package/dist/pipeline/calloutLayout.js.map +1 -1
  219. package/dist/pipeline/composedLayout.d.ts +51 -6
  220. package/dist/pipeline/composedLayout.d.ts.map +1 -1
  221. package/dist/pipeline/composedLayout.js +633 -78
  222. package/dist/pipeline/composedLayout.js.map +1 -1
  223. package/dist/pipeline/contentWarnings.d.ts +15 -0
  224. package/dist/pipeline/contentWarnings.d.ts.map +1 -1
  225. package/dist/pipeline/contentWarnings.js +98 -4
  226. package/dist/pipeline/contentWarnings.js.map +1 -1
  227. package/dist/pipeline/floatPlacement.d.ts +2 -0
  228. package/dist/pipeline/floatPlacement.d.ts.map +1 -1
  229. package/dist/pipeline/floatPlacement.js +1 -0
  230. package/dist/pipeline/floatPlacement.js.map +1 -1
  231. package/dist/pipeline/frameLayout.d.ts +7 -4
  232. package/dist/pipeline/frameLayout.d.ts.map +1 -1
  233. package/dist/pipeline/frameLayout.js +5 -2
  234. package/dist/pipeline/frameLayout.js.map +1 -1
  235. package/dist/pipeline/headerFooter.d.ts +20 -1
  236. package/dist/pipeline/headerFooter.d.ts.map +1 -1
  237. package/dist/pipeline/headerFooter.js +225 -70
  238. package/dist/pipeline/headerFooter.js.map +1 -1
  239. package/dist/pipeline/measureContentBlock.d.ts.map +1 -1
  240. package/dist/pipeline/measureContentBlock.js +1 -0
  241. package/dist/pipeline/measureContentBlock.js.map +1 -1
  242. package/dist/pipeline/mirrorFrame.d.ts.map +1 -1
  243. package/dist/pipeline/mirrorFrame.js +25 -2
  244. package/dist/pipeline/mirrorFrame.js.map +1 -1
  245. package/dist/pipeline/outline.d.ts.map +1 -1
  246. package/dist/pipeline/outline.js +2 -0
  247. package/dist/pipeline/outline.js.map +1 -1
  248. package/dist/pipeline/resourceLayout.d.ts +28 -0
  249. package/dist/pipeline/resourceLayout.d.ts.map +1 -1
  250. package/dist/pipeline/resourceLayout.js +21 -0
  251. package/dist/pipeline/resourceLayout.js.map +1 -1
  252. package/dist/pipeline/styles.d.ts +1 -1
  253. package/dist/pipeline/styles.d.ts.map +1 -1
  254. package/dist/pipeline/styles.js +4 -0
  255. package/dist/pipeline/styles.js.map +1 -1
  256. package/dist/pipeline/textWrap.d.ts +4 -1
  257. package/dist/pipeline/textWrap.d.ts.map +1 -1
  258. package/dist/pipeline/textWrap.js +17 -3
  259. package/dist/pipeline/textWrap.js.map +1 -1
  260. package/dist/pipeline/toc.d.ts.map +1 -1
  261. package/dist/pipeline/toc.js +1 -0
  262. package/dist/pipeline/toc.js.map +1 -1
  263. package/dist/types.d.ts +77 -2
  264. package/dist/types.d.ts.map +1 -1
  265. package/dist/vdt.d.ts +290 -15
  266. package/dist/vdt.d.ts.map +1 -1
  267. package/dist/vdt.js.map +1 -1
  268. package/dist/word/toDocx.d.ts.map +1 -1
  269. package/dist/word/toDocx.js +14 -0
  270. package/dist/word/toDocx.js.map +1 -1
  271. package/dist/word/word.test.js +11 -1
  272. package/dist/word/word.test.js.map +1 -1
  273. package/package.json +1 -1
package/dist/vdt.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ColorPaletteEntry, DocumentMetadata, PostextResource, Resource, ResourceSafeArea, TableCellAlign, TableCellVerticalAlign, ResolvedPageConfig, ResolvedLayoutConfig, ResolvedBodyTextConfig, ResolvedHeadingsConfig, ResolvedTableStyleConfig, ResolvedNamedTableStyleConfig, TableRules, ResolvedCaptionStyleConfig, ResolvedDiagramStyleConfig, ResolvedVideoStyleConfig, ResolvedVideoPlayerOptions, VideoSource, ResolvedParagraphStyleConfig, ResolvedCalloutStyleConfig, ResolvedChipStyleConfig, ResolvedMarkStyleConfig, CalloutSpan, CalloutPlacement, ResolvedUnorderedListsConfig, ResolvedOrderedListsConfig, ResolvedMathConfig, ResolvedPdfGenerationConfig, ResolvedPrintConfig, ResolvedContrastConfig, ResolvedChecksConfig, ResolvedFolioConfig, ResolvedDesignSlot, ResolvedPartsConfig, ResolvedHeadingStyleConfig, ResolvedTocConfig, ResolvedIndexConfig, ResolvedFootnotesConfig, ResolvedCrossRefsConfig, ResolvedCitationsConfig, ResolvedCjkConfig, CjkRegion, PageRole, PartState, PostextConfig, FolioPaperConfig, ResolvedComicsConfig, ResolvedLineNumbersConfig, ResolvedCodeStyleConfig, PageTemplate, ResolvedLabelStyle } from './types';
1
+ import type { ColorPaletteEntry, DocumentMetadata, PostextResource, Resource, ResourceSafeArea, TableCellAlign, TableCellVerticalAlign, ResolvedPageConfig, ResolvedLayoutConfig, ResolvedBodyTextConfig, ResolvedHeadingsConfig, ResolvedTableStyleConfig, ResolvedNamedTableStyleConfig, TableRules, ResolvedCaptionStyleConfig, ResolvedDiagramStyleConfig, ResolvedVideoStyleConfig, ResolvedVideoPlayerOptions, VideoSource, ResolvedParagraphStyleConfig, ResolvedCalloutStyleConfig, ResolvedChipStyleConfig, ResolvedMarkStyleConfig, CalloutSpan, CalloutPlacement, ResolvedUnorderedListsConfig, ResolvedOrderedListsConfig, ResolvedMathConfig, ResolvedPdfGenerationConfig, ResolvedPrintConfig, ResolvedContrastConfig, ResolvedChecksConfig, ResolvedFolioConfig, ResolvedDesignSlot, ResolvedPartsConfig, ResolvedHeadingStyleConfig, ResolvedTocConfig, ResolvedIndexConfig, ResolvedFootnotesConfig, ResolvedCrossRefsConfig, ResolvedCitationsConfig, ResolvedCjkConfig, CjkRegion, PageRole, PartState, PostextConfig, FolioPaperConfig, ResolvedComicsConfig, ResolvedLineNumbersConfig, ResolvedCodeStyleConfig, PageTemplate, ResolvedLabelStyle, Dimension } from './types';
2
2
  import type { NumeralStyle } from './numbering';
3
3
  import type { MathRender } from './math/types';
4
4
  export interface BoundingBox {
@@ -187,6 +187,12 @@ export interface VDTChip {
187
187
  * pass joins the pieces that share a line into one box. Never left on a
188
188
  * chip of a finished line. */
189
189
  joinNext?: boolean;
190
+ /** Where each character of the chip's runs (joined, in logical order)
191
+ * stands in the source, counted from the chip's leading `:` (#857): add
192
+ * the source offset of the chip's plain character (its block's
193
+ * `sourceMap`). Absent when the runs do not read as written (a chip in
194
+ * small capitals is still mapped; one cut by direction is not). */
195
+ sourceOffsets?: number[];
190
196
  }
191
197
  export interface VDTLineSegment {
192
198
  kind: 'text' | 'space' | 'math' | 'swatch' | 'chip';
@@ -1340,6 +1346,71 @@ export interface VDTFigureLabel {
1340
1346
  /** The label's text in the source (absolute offsets). */
1341
1347
  sourceStart: number;
1342
1348
  sourceEnd: number;
1349
+ /** The source offset of each character of `text` (absolute), when the
1350
+ * text reads as written (#857). */
1351
+ sourceMap?: number[];
1352
+ /** On a composed page, the label's stable id,
1353
+ * `cp<fence>:<slot>:label:<anchor>` (`@<k>` for the k-th label placed by
1354
+ * percentages): the same in every locale (#857). */
1355
+ id?: string;
1356
+ /** The anchor it is set at, as `resourceId#anchorId` (#857); absent for
1357
+ * a label placed by percentages. */
1358
+ anchorRef?: string;
1359
+ /** Where the label is painted: the upright box round its text (and
1360
+ * background), in the coordinates of the block's own frame (a page's
1361
+ * flow, or the frame of a composed page its block stands in), stamped
1362
+ * once the pages exist (#860). `sourceAt` answers a point inside it
1363
+ * with the label. Absent for a label that is not drawn. */
1364
+ rect?: BoundingBox;
1365
+ /** The label set on the picture (#860): absent when it is not drawn (its
1366
+ * anchor is unknown, the resource is no picture). */
1367
+ layout?: VDTFigureLabelLayout;
1368
+ }
1369
+ /**
1370
+ * A figure label laid out on its picture (#860, DESIGN §2.6). Everything is
1371
+ * in the label's own frame: its origin is the anchor's point and its axes
1372
+ * are turned by `rotate` degrees (clockwise) about it. That point is
1373
+ * `(x, y)` px from the top-left corner of the picture's body (the block's
1374
+ * `bodyRect` as drawn, its crop applied), so the label moves with its
1375
+ * block. Painters: `translate(bodyX + x, bodyY + y) · rotate(rotate)`
1376
+ * (`figureLabelMatrix`), then the halo, the background and the lines.
1377
+ */
1378
+ export interface VDTFigureLabelLayout {
1379
+ x: number;
1380
+ y: number;
1381
+ /** Degrees, clockwise. Absent = 0. */
1382
+ rotate?: number;
1383
+ /** The text, as caption lines are (segments, chips, marks, bidi order),
1384
+ * positioned in the label's frame. */
1385
+ lines: VDTLine[];
1386
+ /** The box of the lines in the label's frame. */
1387
+ box: BoundingBox;
1388
+ fontString: string;
1389
+ boldFontString: string;
1390
+ italicFontString: string;
1391
+ boldItalicFontString: string;
1392
+ /** Hex. */
1393
+ color: string;
1394
+ /** The glyphs stroked `2 × widthPx` wide in `color` under the text. */
1395
+ halo?: {
1396
+ color: string;
1397
+ widthPx: number;
1398
+ };
1399
+ /** A fill behind the text: `rect` is the box grown by the style's
1400
+ * padding. */
1401
+ background?: {
1402
+ color: string;
1403
+ rect: BoundingBox;
1404
+ };
1405
+ /** The scale the label was set at to fit its width (`minScale` at
1406
+ * least); absent at 1. */
1407
+ scale?: number;
1408
+ /** Still wider than its anchor's width at the style's `minScale`. */
1409
+ overflow?: true;
1410
+ /** The label style it was set in (`labelStyles[].id`). */
1411
+ styleId?: string;
1412
+ /** Set right to left (its text opens with a right-to-left letter). */
1413
+ direction?: 'rtl';
1343
1414
  }
1344
1415
  /**
1345
1416
  * A paragraph's drop cap (#623, {@link VDTBlock.dropCap}), in page
@@ -1472,6 +1543,23 @@ export interface VDTBlock {
1472
1543
  indexLevel?: number;
1473
1544
  /** Id of the heading style (`{style="…"}`) applied to this heading. */
1474
1545
  headingStyleId?: string;
1546
+ /** A heading set in a box or a frame of a composed page whose level or
1547
+ * heading style has a design of its own (#906): what the design
1548
+ * (`designOverlay`) is laid out with. Such a heading carries no
1549
+ * `headingStyleId`, `attrs` or `titleBreaks`: in the flow those open a
1550
+ * styled section, a chapter's attributes, an opener band or a page's
1551
+ * role, which a heading inside a box does not. The block is as tall as
1552
+ * the design needs, as a heading in a column is. */
1553
+ boxDesign?: {
1554
+ styleId?: string;
1555
+ attrs?: Record<string, string>;
1556
+ attrSources?: Record<string, {
1557
+ start: number;
1558
+ end: number;
1559
+ }>;
1560
+ titleBreaks?: number[];
1561
+ titleLength?: number;
1562
+ };
1475
1563
  /** True for a heading whose style has `numbered: false`: it advances no
1476
1564
  * counter and `{chapterNumber}` is empty on its pages. */
1477
1565
  unnumbered?: boolean;
@@ -1500,10 +1588,12 @@ export interface VDTBlock {
1500
1588
  * make the row a link to it. The contents keep their own rhythm:
1501
1589
  * entries and part rows neither snap to the baseline grid nor serve as
1502
1590
  * column-balancing stretch points. `continued`: a repeated head row (see
1503
- * `tocPart`). */
1591
+ * `tocPart`). `headingSource`: where the heading the entry lists starts
1592
+ * in its chapter's Markdown body (`OutlineEntry.headingSource`, #857). */
1504
1593
  tocEntry?: {
1505
1594
  pageIndex?: number;
1506
1595
  continued?: true;
1596
+ headingSource?: number;
1507
1597
  };
1508
1598
  numberPrefix?: string;
1509
1599
  /** What joins {@link numberPrefix} to the title
@@ -1836,6 +1926,28 @@ export interface VDTExclusion {
1836
1926
  /** The id of the block that wraps the text: an inline figure's block, a
1837
1927
  * float's, or a box's frame. */
1838
1928
  ownerId: string;
1929
+ /** A contour wrap (#883): the picture's shape, which sets each line
1930
+ * beside it short by the shape's width there rather than by
1931
+ * {@link width}. Absent: the rectangle. */
1932
+ contour?: VDTExclusionContour;
1933
+ }
1934
+ /** The shape a contour wrap runs round (#883), in page px: bands of the
1935
+ * page, each with the shape's extent across it, and the margin kept round
1936
+ * them (across, above and below). A line meets the shape where a band
1937
+ * lies within the margin of the line's own band. */
1938
+ export interface VDTExclusionContour {
1939
+ spans: VDTContourSpan[];
1940
+ margin: number;
1941
+ /** The insets are rounded up to whole multiples of this (px): one body
1942
+ * character under a CJK character grid, so the lines keep to it. */
1943
+ quantum?: number;
1944
+ }
1945
+ /** One band of a contour (`VDTExclusionContour.spans`). */
1946
+ export interface VDTContourSpan {
1947
+ y: number;
1948
+ height: number;
1949
+ left: number;
1950
+ right: number;
1839
1951
  }
1840
1952
  /** The notes set at the foot of one column (`footnotes.placement:
1841
1953
  * 'column'`). The note paragraphs themselves are in `VDTPage.floats` (and
@@ -1954,7 +2066,23 @@ export interface VDTDesignBoxStyle {
1954
2066
  borderRadiusPx: number;
1955
2067
  }
1956
2068
  /** Text block rendered inside a design slot (header / footer / heading). */
1957
- export interface VDTDesignTextBlock {
2069
+ /** Where a design block comes from in the configuration (#857): the
2070
+ * element of its design slot (`DesignElement.id`) and the JSON pointer of
2071
+ * that element (`/pageTemplates/0/decoration/elements/2`,
2072
+ * `/footer/elements/0`). Set on the blocks of a composed page's decoration
2073
+ * and of the running heads; absent where the slot's origin is not known
2074
+ * (a heading style's design, a callout's own overlay). */
2075
+ export interface VDTDesignBlockOrigin {
2076
+ elementId?: string;
2077
+ configPath?: string;
2078
+ /** The Markdown attribute the block shows: `x` for a text element whose
2079
+ * content is `{attr.x}` (its `sourceStart`/`sourceEnd` are the value's
2080
+ * in the page fence or the heading) and for an image whose `resourceId`
2081
+ * is `{attr.x}`; `label` / `title` for a frame's tab and title (the
2082
+ * `:::frame` fence's). Absent otherwise. */
2083
+ attr?: string;
2084
+ }
2085
+ export interface VDTDesignTextBlock extends VDTDesignBlockOrigin {
1958
2086
  kind: 'text';
1959
2087
  bbox: BoundingBox;
1960
2088
  fontString: string;
@@ -2028,7 +2156,7 @@ export interface VDTVerticalText {
2028
2156
  centralBaselines: Record<string, number>;
2029
2157
  }
2030
2158
  /** Rendered rule inside a design slot. */
2031
- export interface VDTDesignRuleBlock {
2159
+ export interface VDTDesignRuleBlock extends VDTDesignBlockOrigin {
2032
2160
  kind: 'rule';
2033
2161
  bbox: BoundingBox;
2034
2162
  color: string;
@@ -2036,7 +2164,7 @@ export interface VDTDesignRuleBlock {
2036
2164
  direction: 'horizontal' | 'vertical';
2037
2165
  }
2038
2166
  /** Decorative rounded box. */
2039
- export interface VDTDesignBoxBlock {
2167
+ export interface VDTDesignBoxBlock extends VDTDesignBlockOrigin {
2040
2168
  kind: 'box';
2041
2169
  bbox: BoundingBox;
2042
2170
  box: VDTDesignBoxStyle;
@@ -2047,7 +2175,7 @@ export interface VDTDesignBoxBlock {
2047
2175
  clip?: RoundedOutline;
2048
2176
  }
2049
2177
  /** Image drawn from the resource image registry (e.g. a callout icon). */
2050
- export interface VDTDesignImageBlock {
2178
+ export interface VDTDesignImageBlock extends VDTDesignBlockOrigin {
2051
2179
  kind: 'image';
2052
2180
  bbox: BoundingBox;
2053
2181
  /** Out-of-band binary id resolved at render time (canvas registry, HTML
@@ -2258,6 +2386,10 @@ export interface ReflowEvent {
2258
2386
  /** The frame whose change caused this event; `'gutter'` when the spine
2259
2387
  * band of a spread template kept the frame off it (#861). */
2260
2388
  cause?: string;
2389
+ /** `continued` (#859): the page (`VDTPage.index`) the frame's content
2390
+ * goes on on, and the frame there (`VDTFrame.id`, `cp<n>:<slot>~<k>`). */
2391
+ toPage?: number;
2392
+ toFrame?: string;
2261
2393
  }
2262
2394
  /** One frame of a composed page, in sheet coordinates. Its box and its
2263
2395
  * content are ordinary callout blocks in `page.floats` (and
@@ -2267,8 +2399,10 @@ export interface ReflowEvent {
2267
2399
  * turn, and how much of its content did not fit. */
2268
2400
  export interface VDTFrame {
2269
2401
  /** `cp<fenceIndex>:<name>`: the same in every locale and across
2270
- * relayouts (`~<n>` is reserved for the n-th continuation piece on a
2271
- * later page, #859). */
2402
+ * relayouts. On the n-th page added by continuation (#859) a frame is
2403
+ * `cp<fenceIndex>:<name>~<n>`, and the frame that takes content from
2404
+ * the page before is named by the frame of the fence's own page that
2405
+ * first sent it on (`cp0:dinero~1`). */
2272
2406
  id: string;
2273
2407
  /** The frame's name in its template (the slot it receives). */
2274
2408
  name: string;
@@ -2296,13 +2430,23 @@ export interface VDTFrame {
2296
2430
  layer: number;
2297
2431
  /** The callout style the frame is drawn with; absent = frameless. */
2298
2432
  styleId?: string;
2299
- /** Text scale the reflow ladder applied (1 = none; #858). */
2433
+ /** Text scale the reflow ladder applied (1 = none; #858): the frame's
2434
+ * content is laid out `1 / scale` times as wide and tall as `rect` and
2435
+ * painted scaled by `scale` about the top-left of `rect`, so its font
2436
+ * sizes, leading and spacing shrink together. Its blocks' coordinates
2437
+ * are in that laid-out frame: {@link frameMatrix} (`composed/paint.ts`)
2438
+ * puts them on the sheet. */
2300
2439
  scale: number;
2440
+ /** Scale the reflow ladder set the pictures of the frame's content at
2441
+ * (#858), below 1; absent when they keep their size. */
2442
+ imageScale?: number;
2301
2443
  /** Height of content that did not fit in the frame, px (0 = it fits).
2302
2444
  * Past the frame's foot it is clipped on paged output. */
2303
2445
  overflowPx: number;
2304
- /** The frame of the same page whose content this one goes on with
2305
- * (`next`), and the one this frame's content goes on in. */
2446
+ /** The frame whose content this one goes on with (`next`, or on a page
2447
+ * added by continuation, #859, the frame of the page before), and the
2448
+ * one this frame's content goes on in (on this page, or on a page added
2449
+ * after it). */
2306
2450
  continuedFrom?: string;
2307
2451
  continuesTo?: string;
2308
2452
  /** Ids of the blocks set in this frame (its box first), in
@@ -2353,6 +2497,9 @@ export interface VDTComposedPage {
2353
2497
  };
2354
2498
  /** The page fence's ordinal in its chapter (stable across locales). */
2355
2499
  fenceIndex: number;
2500
+ /** On a page added by continuation (#859): the index (`VDTPage.index`)
2501
+ * of the fence's own page, whose frames' content goes on here. */
2502
+ continuationOf?: number;
2356
2503
  /** The role the template reports to design slots (`role`, default
2357
2504
  * `'composed'`). `page.role` is `'composed'` whatever this says. */
2358
2505
  role: string;
@@ -2375,6 +2522,13 @@ export interface VDTComposedPage {
2375
2522
  /** The page fence, opening line to closing fence (absolute offsets). */
2376
2523
  sourceStart: number;
2377
2524
  sourceEnd: number;
2525
+ /** A digest of everything the page's frames were laid out from (#857):
2526
+ * template, Markdown and blocks, styles, fonts, locale, side and
2527
+ * geometry. Two pages with the same key hold the same frames (their
2528
+ * source offsets aside), so a host may keep the pixels it painted for
2529
+ * one (with the same running heads and decoration). Absent when the
2530
+ * page reads what the key does not hold (a footnote, a reference). */
2531
+ layoutKey?: string;
2378
2532
  }
2379
2533
  /** A comic page (`:::page`): its panels, the split lines between them and
2380
2534
  * the lettering, on the sheet. Also the comic of a strip
@@ -2675,6 +2829,56 @@ export interface ConfigWarning {
2675
2829
  * about, when its owner is one. */
2676
2830
  ownerId?: string;
2677
2831
  }
2832
+ /** A step of the reflow ladder (#858, DESIGN §5.4), in ladder order:
2833
+ * `free` (the frame grows into free space up to its `maxHeight`), `push`
2834
+ * (its group moves the frames after it and the ones that `shrink` yield),
2835
+ * `scaleImages` (pictures of the frame and its group, down to
2836
+ * `fit.imageMinScale`), `redistribute` (the other frames of its group go
2837
+ * down to their minimum or their content, a row's give width),
2838
+ * `shrinkText` (down to `fit.minScale`), `continue` (`overflow.continueIn`
2839
+ * to another page, #859). */
2840
+ export type FrameFitStep = 'free' | 'push' | 'scaleImages' | 'redistribute' | 'shrinkText' | 'continue';
2841
+ /** A change that would make a frame's content fit (#858): data, so the
2842
+ * Sandbox can offer it as a confirmed edit. `path` is the JSON pointer of
2843
+ * the config value to set to `value`; a Markdown change carries the
2844
+ * source range it is about instead. Values are worked out from the
2845
+ * shortfall: `allowShrink` the largest text scale (in 2.5 % steps) at
2846
+ * which the content fits (`also`: the switch to turn on with it),
2847
+ * `raiseMax` / `lowerMin` the height in whole millimetres, `useTemplate`
2848
+ * another template of the book with a frame of this name in which the
2849
+ * content fits, `shortenText` about how many characters to cut. */
2850
+ export type FrameOverflowProposal = {
2851
+ kind: 'allowShrink';
2852
+ path: string;
2853
+ value: number;
2854
+ also?: {
2855
+ path: string;
2856
+ value: boolean;
2857
+ }[];
2858
+ } | {
2859
+ kind: 'raiseMax';
2860
+ path: string;
2861
+ value: Dimension;
2862
+ } | {
2863
+ kind: 'lowerMin';
2864
+ path: string;
2865
+ value: Dimension;
2866
+ frame: string;
2867
+ } | {
2868
+ kind: 'continueNextPage';
2869
+ path: string;
2870
+ value: 'next-page';
2871
+ } | {
2872
+ kind: 'useTemplate';
2873
+ value: string;
2874
+ sourceStart?: number;
2875
+ sourceEnd?: number;
2876
+ } | {
2877
+ kind: 'shortenText';
2878
+ value: number;
2879
+ sourceStart?: number;
2880
+ sourceEnd?: number;
2881
+ };
2678
2882
  /** The kinds of {@link ConfigWarning} a page template gives (#853). */
2679
2883
  export type PageTemplateWarningKind = 'templateDuplicate' | 'templateExtendsCycle' | 'templateExtendsUnknown' | 'frameDuplicate' | 'frameStyleUnknown' | 'frameAnchorUnknown' | 'frameMinMax' | 'groupFrameUnknown' | 'groupFrameTwice' | 'frameChainLoop' | 'overflowTargetUnknown' | 'labelStyleUnknown';
2680
2884
  /** Where a content warning points: the source range of the construct in
@@ -2778,11 +2982,12 @@ export type ContentWarning = ContentWarningBase & (
2778
2982
  }
2779
2983
  /** Content of a composed page names a slot (`slot="…"`,
2780
2984
  * `:::frame{slot=…}`) that is no frame of the page's template: it goes
2781
- * to the template's flow frame. */
2985
+ * to the template's flow frame (`frame`, when the template has one). */
2782
2986
  | {
2783
2987
  kind: 'slotUnknown';
2784
2988
  template: string;
2785
2989
  slot: string;
2990
+ frame?: string;
2786
2991
  fenceIndex: number;
2787
2992
  }
2788
2993
  /** A frame of a composed page's template receives no content: nothing
@@ -2813,6 +3018,32 @@ export type ContentWarning = ContentWarningBase & (
2813
3018
  fenceIndex: number;
2814
3019
  overflowMm: number;
2815
3020
  configPath: string;
3021
+ /** The document's locale (`config.locale`): the same page overflows in
3022
+ * one language and fits in another. */
3023
+ locale?: string;
3024
+ /** The steps of the reflow ladder (#858) that applied to the frame, in
3025
+ * the order they were tried; none made the content fit. */
3026
+ stepsTried: FrameFitStep[];
3027
+ /** The text scale the frame was left at (1 = none). */
3028
+ scale: number;
3029
+ /** The scale its pictures were left at, below 1. */
3030
+ imageScale?: number;
3031
+ /** Changes that would make the content fit, with their values worked
3032
+ * out from the shortfall (each tried on the page where it can be). */
3033
+ proposals: FrameOverflowProposal[];
3034
+ }
3035
+ /** A frame's content went on to other pages (#859) as many times as a
3036
+ * composed page may add (`pages`, 16) and still does not fit: what is
3037
+ * left is cut at the foot of the frame on the last page added
3038
+ * (`overflowMm`, `pageIndex`). */
3039
+ | {
3040
+ kind: 'frameContinuationLimit';
3041
+ template: string;
3042
+ frame: string;
3043
+ fenceIndex: number;
3044
+ pages: number;
3045
+ overflowMm: number;
3046
+ configPath: string;
2816
3047
  }
2817
3048
  /** A composed page's fence and its template disagree about spreads
2818
3049
  * (#861): `::::page{template spread}` names a template that is a single
@@ -2827,6 +3058,29 @@ export type ContentWarning = ContentWarningBase & (
2827
3058
  fence: boolean;
2828
3059
  templateSpread: boolean;
2829
3060
  }
3061
+ /** A `::label[…]{at="…"}` of a `:::figure` (#860) names an anchor its
3062
+ * resource does not have: the label is not drawn (the reflowable
3063
+ * output still lists it). `known` lists the resource's anchor ids. The
3064
+ * source range is the label's text. */
3065
+ | {
3066
+ kind: 'labelAnchorUnknown';
3067
+ resourceId: string;
3068
+ anchor: string;
3069
+ known: string[];
3070
+ locale?: string;
3071
+ labelId?: string;
3072
+ }
3073
+ /** An anchor of a figure's resource names a label `style` but no
3074
+ * `::label` of the figure stands at it in this locale (#860): a note,
3075
+ * the map lacks that word in this edition. The source range is the
3076
+ * figure's. */
3077
+ | {
3078
+ kind: 'anchorUnlabelled';
3079
+ resourceId: string;
3080
+ anchor: string;
3081
+ style: string;
3082
+ locale?: string;
3083
+ }
2830
3084
  /** A `:::paper{…}` attribute the engine cannot read: an unknown key, a
2831
3085
  * stock, finish or texture it does not know, a number out of range, a
2832
3086
  * shade that is neither a hex colour nor a palette id, a `showThrough`
@@ -3192,6 +3446,22 @@ export type ContentWarning = ContentWarningBase & (
3192
3446
  scale: number;
3193
3447
  overflowPx?: number;
3194
3448
  }
3449
+ /** `pictureBelowPrintSize` (#901): a bitmap with a print size (its own
3450
+ * `bitmap.resolution`, or a number in `layout.bitmapResolution`) set in
3451
+ * a column that holds it at under half of it, on a page whose text
3452
+ * block is wider than that column: `scale` is the share of its print
3453
+ * width it keeps, `printWidthPx` that width, `widthPx` the column's and
3454
+ * `pageWidthPx` the text block's. A picture in the flow is never wider
3455
+ * than its column, and the default page has two (`layout.layoutType:
3456
+ * 'double'`). Found by the layout; reported once per picture. */
3457
+ | {
3458
+ kind: 'pictureBelowPrintSize';
3459
+ resourceId: string;
3460
+ scale: number;
3461
+ printWidthPx: number;
3462
+ widthPx: number;
3463
+ pageWidthPx: number;
3464
+ }
3195
3465
  /** `textWrap` (#627): a resource or a box set to wrap text round it
3196
3466
  * (`placement.wrap`, a box's `wrap`) that does not as asked.
3197
3467
  * `'tooNarrow'`: the text beside it would be narrower than
@@ -3200,11 +3470,16 @@ export type ContentWarning = ContentWarningBase & (
3200
3470
  * its band whole; `'moved'`: an inline one was too tall for the room
3201
3471
  * left in its column and moved on to the next, its anchor with it;
3202
3472
  * `'verticalText'`: text wraps in horizontal text only, so in a
3203
- * vertical flow it takes its band whole. `resourceId` names a
3204
- * resource, `box` a box's style. Found by the layout. */
3473
+ * vertical flow it takes its band whole; `'noContour'` (#883): a
3474
+ * contour wrap (`wrap: 'contour'`, or a pushing frame's) round a
3475
+ * picture whose shape is not known (an SVG with no
3476
+ * `contour.points`, a bitmap with no transparency, or whose alpha
3477
+ * channel the host did not trace), so the text runs round its box.
3478
+ * `resourceId` names a resource, `box` a box's style. Found by the
3479
+ * layout. */
3205
3480
  | {
3206
3481
  kind: 'textWrap';
3207
- reason: 'tooNarrow' | 'fewLines' | 'moved' | 'verticalText';
3482
+ reason: 'tooNarrow' | 'fewLines' | 'moved' | 'verticalText' | 'noContour';
3208
3483
  resourceId?: string;
3209
3484
  box?: string;
3210
3485
  }