postext 1.15.1 → 1.16.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 (421) hide show
  1. package/dist/__tests__/arabic/harakatProfile.test.d.ts +2 -0
  2. package/dist/__tests__/arabic/harakatProfile.test.d.ts.map +1 -0
  3. package/dist/__tests__/arabic/harakatProfile.test.js +105 -0
  4. package/dist/__tests__/arabic/harakatProfile.test.js.map +1 -0
  5. package/dist/__tests__/bundleLocaleAndBytes.test.js +9 -9
  6. package/dist/__tests__/bundleLocaleAndBytes.test.js.map +1 -1
  7. package/dist/__tests__/chineseLocale.test.js +10 -5
  8. package/dist/__tests__/chineseLocale.test.js.map +1 -1
  9. package/dist/__tests__/cjk/annotationsRender.test.js +5 -2
  10. package/dist/__tests__/cjk/annotationsRender.test.js.map +1 -1
  11. package/dist/__tests__/cjk/chipTracking.test.d.ts +2 -0
  12. package/dist/__tests__/cjk/chipTracking.test.d.ts.map +1 -0
  13. package/dist/__tests__/cjk/chipTracking.test.js +52 -0
  14. package/dist/__tests__/cjk/chipTracking.test.js.map +1 -0
  15. package/dist/__tests__/cjk/japaneseHtml.test.d.ts +2 -0
  16. package/dist/__tests__/cjk/japaneseHtml.test.d.ts.map +1 -0
  17. package/dist/__tests__/cjk/japaneseHtml.test.js +163 -0
  18. package/dist/__tests__/cjk/japaneseHtml.test.js.map +1 -0
  19. package/dist/__tests__/cjk/japaneseMarks.test.d.ts +2 -0
  20. package/dist/__tests__/cjk/japaneseMarks.test.d.ts.map +1 -0
  21. package/dist/__tests__/cjk/japaneseMarks.test.js +289 -0
  22. package/dist/__tests__/cjk/japaneseMarks.test.js.map +1 -0
  23. package/dist/__tests__/cjk/japaneseMarksRender.test.d.ts +2 -0
  24. package/dist/__tests__/cjk/japaneseMarksRender.test.d.ts.map +1 -0
  25. package/dist/__tests__/cjk/japaneseMarksRender.test.js +161 -0
  26. package/dist/__tests__/cjk/japaneseMarksRender.test.js.map +1 -0
  27. package/dist/__tests__/cjk/japaneseRuby.test.d.ts +2 -0
  28. package/dist/__tests__/cjk/japaneseRuby.test.d.ts.map +1 -0
  29. package/dist/__tests__/cjk/japaneseRuby.test.js +457 -0
  30. package/dist/__tests__/cjk/japaneseRuby.test.js.map +1 -0
  31. package/dist/__tests__/cjk/japaneseSegmentLanguage.test.d.ts +2 -0
  32. package/dist/__tests__/cjk/japaneseSegmentLanguage.test.d.ts.map +1 -0
  33. package/dist/__tests__/cjk/japaneseSegmentLanguage.test.js +50 -0
  34. package/dist/__tests__/cjk/japaneseSegmentLanguage.test.js.map +1 -0
  35. package/dist/__tests__/cjk/japaneseSpacing.test.d.ts +2 -0
  36. package/dist/__tests__/cjk/japaneseSpacing.test.d.ts.map +1 -0
  37. package/dist/__tests__/cjk/japaneseSpacing.test.js +417 -0
  38. package/dist/__tests__/cjk/japaneseSpacing.test.js.map +1 -0
  39. package/dist/__tests__/cjk/kanbunKunten.test.d.ts +2 -0
  40. package/dist/__tests__/cjk/kanbunKunten.test.d.ts.map +1 -0
  41. package/dist/__tests__/cjk/kanbunKunten.test.js +230 -0
  42. package/dist/__tests__/cjk/kanbunKunten.test.js.map +1 -0
  43. package/dist/__tests__/cjk/kanbunKuntenRender.test.d.ts +2 -0
  44. package/dist/__tests__/cjk/kanbunKuntenRender.test.d.ts.map +1 -0
  45. package/dist/__tests__/cjk/kanbunKuntenRender.test.js +127 -0
  46. package/dist/__tests__/cjk/kanbunKuntenRender.test.js.map +1 -0
  47. package/dist/__tests__/cjk/kinsokuJa.test.d.ts +2 -0
  48. package/dist/__tests__/cjk/kinsokuJa.test.d.ts.map +1 -0
  49. package/dist/__tests__/cjk/kinsokuJa.test.js +388 -0
  50. package/dist/__tests__/cjk/kinsokuJa.test.js.map +1 -0
  51. package/dist/__tests__/cjk/kinsokuJaBuild.test.d.ts +2 -0
  52. package/dist/__tests__/cjk/kinsokuJaBuild.test.d.ts.map +1 -0
  53. package/dist/__tests__/cjk/kinsokuJaBuild.test.js +38 -0
  54. package/dist/__tests__/cjk/kinsokuJaBuild.test.js.map +1 -0
  55. package/dist/__tests__/cjk/resourceAnnotations.test.d.ts +2 -0
  56. package/dist/__tests__/cjk/resourceAnnotations.test.d.ts.map +1 -0
  57. package/dist/__tests__/cjk/resourceAnnotations.test.js +223 -0
  58. package/dist/__tests__/cjk/resourceAnnotations.test.js.map +1 -0
  59. package/dist/__tests__/defaults/cjk.test.js +10 -2
  60. package/dist/__tests__/defaults/cjk.test.js.map +1 -1
  61. package/dist/__tests__/exports.test.js +36 -0
  62. package/dist/__tests__/exports.test.js.map +1 -1
  63. package/dist/__tests__/headingLetterSpacing.test.js +2 -1
  64. package/dist/__tests__/headingLetterSpacing.test.js.map +1 -1
  65. package/dist/__tests__/indexChinese.test.js +1 -1
  66. package/dist/__tests__/indexJapanese.test.d.ts +2 -0
  67. package/dist/__tests__/indexJapanese.test.d.ts.map +1 -0
  68. package/dist/__tests__/indexJapanese.test.js +242 -0
  69. package/dist/__tests__/indexJapanese.test.js.map +1 -0
  70. package/dist/__tests__/japaneseHeadings.test.d.ts +2 -0
  71. package/dist/__tests__/japaneseHeadings.test.d.ts.map +1 -0
  72. package/dist/__tests__/japaneseHeadings.test.js +319 -0
  73. package/dist/__tests__/japaneseHeadings.test.js.map +1 -0
  74. package/dist/__tests__/japaneseLocale.test.d.ts +2 -0
  75. package/dist/__tests__/japaneseLocale.test.d.ts.map +1 -0
  76. package/dist/__tests__/japaneseLocale.test.js +201 -0
  77. package/dist/__tests__/japaneseLocale.test.js.map +1 -0
  78. package/dist/__tests__/japaneseNotes.test.d.ts +2 -0
  79. package/dist/__tests__/japaneseNotes.test.d.ts.map +1 -0
  80. package/dist/__tests__/japaneseNotes.test.js +336 -0
  81. package/dist/__tests__/japaneseNotes.test.js.map +1 -0
  82. package/dist/__tests__/japaneseNumbering.test.d.ts +2 -0
  83. package/dist/__tests__/japaneseNumbering.test.d.ts.map +1 -0
  84. package/dist/__tests__/japaneseNumbering.test.js +292 -0
  85. package/dist/__tests__/japaneseNumbering.test.js.map +1 -0
  86. package/dist/__tests__/pipeline/citationsJapanese.test.d.ts +2 -0
  87. package/dist/__tests__/pipeline/citationsJapanese.test.d.ts.map +1 -0
  88. package/dist/__tests__/pipeline/citationsJapanese.test.js +110 -0
  89. package/dist/__tests__/pipeline/citationsJapanese.test.js.map +1 -0
  90. package/dist/__tests__/pipeline/paragraphStyleFaces.test.js +1 -1
  91. package/dist/__tests__/pipeline/paragraphStyleFaces.test.js.map +1 -1
  92. package/dist/__tests__/pipeline/safeArea.test.d.ts +2 -0
  93. package/dist/__tests__/pipeline/safeArea.test.d.ts.map +1 -0
  94. package/dist/__tests__/pipeline/safeArea.test.js +207 -0
  95. package/dist/__tests__/pipeline/safeArea.test.js.map +1 -0
  96. package/dist/__tests__/vertical/compositionPaint.test.js +6 -5
  97. package/dist/__tests__/vertical/compositionPaint.test.js.map +1 -1
  98. package/dist/__tests__/vertical/japaneseVertical.test.d.ts +2 -0
  99. package/dist/__tests__/vertical/japaneseVertical.test.d.ts.map +1 -0
  100. package/dist/__tests__/vertical/japaneseVertical.test.js +247 -0
  101. package/dist/__tests__/vertical/japaneseVertical.test.js.map +1 -0
  102. package/dist/__tests__/vertical/verticalSpans.d.ts +2 -1
  103. package/dist/__tests__/vertical/verticalSpans.d.ts.map +1 -1
  104. package/dist/__tests__/vertical/verticalSpans.js +3 -2
  105. package/dist/__tests__/vertical/verticalSpans.js.map +1 -1
  106. package/dist/__tests__/video.test.d.ts +2 -0
  107. package/dist/__tests__/video.test.d.ts.map +1 -0
  108. package/dist/__tests__/video.test.js +305 -0
  109. package/dist/__tests__/video.test.js.map +1 -0
  110. package/dist/arabicMarks.d.ts +11 -1
  111. package/dist/arabicMarks.d.ts.map +1 -1
  112. package/dist/arabicMarks.js +72 -5
  113. package/dist/arabicMarks.js.map +1 -1
  114. package/dist/bundle/adapters.d.ts +6 -0
  115. package/dist/bundle/adapters.d.ts.map +1 -1
  116. package/dist/bundle/adapters.js +30 -0
  117. package/dist/bundle/adapters.js.map +1 -1
  118. package/dist/bundle/codec.d.ts.map +1 -1
  119. package/dist/bundle/codec.js +67 -3
  120. package/dist/bundle/codec.js.map +1 -1
  121. package/dist/bundle/index.d.ts +2 -2
  122. package/dist/bundle/index.d.ts.map +1 -1
  123. package/dist/bundle/index.js +2 -2
  124. package/dist/bundle/index.js.map +1 -1
  125. package/dist/bundle/manifest.d.ts +8 -0
  126. package/dist/bundle/manifest.d.ts.map +1 -1
  127. package/dist/bundle/manifest.js +48 -1
  128. package/dist/bundle/manifest.js.map +1 -1
  129. package/dist/bundle/types.d.ts +5 -0
  130. package/dist/bundle/types.d.ts.map +1 -1
  131. package/dist/bundle/zip.js +1 -1
  132. package/dist/bundle/zip.js.map +1 -1
  133. package/dist/canvas-backend/annotations.d.ts +20 -5
  134. package/dist/canvas-backend/annotations.d.ts.map +1 -1
  135. package/dist/canvas-backend/annotations.js +59 -6
  136. package/dist/canvas-backend/annotations.js.map +1 -1
  137. package/dist/canvas-backend/blockRender.d.ts.map +1 -1
  138. package/dist/canvas-backend/blockRender.js +29 -3
  139. package/dist/canvas-backend/blockRender.js.map +1 -1
  140. package/dist/canvas-backend/renderResourceBlock.d.ts +6 -1
  141. package/dist/canvas-backend/renderResourceBlock.d.ts.map +1 -1
  142. package/dist/canvas-backend/renderResourceBlock.js +124 -5
  143. package/dist/canvas-backend/renderResourceBlock.js.map +1 -1
  144. package/dist/canvas-backend/verticalText.d.ts +9 -4
  145. package/dist/canvas-backend/verticalText.d.ts.map +1 -1
  146. package/dist/canvas-backend/verticalText.js +20 -9
  147. package/dist/canvas-backend/verticalText.js.map +1 -1
  148. package/dist/chineseNumerals.d.ts +3 -2
  149. package/dist/chineseNumerals.d.ts.map +1 -1
  150. package/dist/chineseNumerals.js +11 -8
  151. package/dist/chineseNumerals.js.map +1 -1
  152. package/dist/citations/bibtex.d.ts.map +1 -1
  153. package/dist/citations/bibtex.js +4 -0
  154. package/dist/citations/bibtex.js.map +1 -1
  155. package/dist/citations/data.d.ts.map +1 -1
  156. package/dist/citations/data.js +6 -1
  157. package/dist/citations/data.js.map +1 -1
  158. package/dist/citations/types.d.ts +8 -0
  159. package/dist/citations/types.d.ts.map +1 -1
  160. package/dist/cjkMarks.d.ts +23 -14
  161. package/dist/cjkMarks.d.ts.map +1 -1
  162. package/dist/cjkMarks.js +251 -49
  163. package/dist/cjkMarks.js.map +1 -1
  164. package/dist/configWarnings.js +9 -3
  165. package/dist/configWarnings.js.map +1 -1
  166. package/dist/defaults/cjk.d.ts +64 -14
  167. package/dist/defaults/cjk.d.ts.map +1 -1
  168. package/dist/defaults/cjk.js +203 -29
  169. package/dist/defaults/cjk.js.map +1 -1
  170. package/dist/defaults/footnotes.d.ts +27 -4
  171. package/dist/defaults/footnotes.d.ts.map +1 -1
  172. package/dist/defaults/footnotes.js +95 -36
  173. package/dist/defaults/footnotes.js.map +1 -1
  174. package/dist/defaults/headings.d.ts +5 -0
  175. package/dist/defaults/headings.d.ts.map +1 -1
  176. package/dist/defaults/headings.js +46 -1
  177. package/dist/defaults/headings.js.map +1 -1
  178. package/dist/defaults/index.d.ts +3 -2
  179. package/dist/defaults/index.d.ts.map +1 -1
  180. package/dist/defaults/index.js +12 -3
  181. package/dist/defaults/index.js.map +1 -1
  182. package/dist/defaults/indexConfig.d.ts.map +1 -1
  183. package/dist/defaults/indexConfig.js +7 -4
  184. package/dist/defaults/indexConfig.js.map +1 -1
  185. package/dist/defaults/paragraphStyles.d.ts.map +1 -1
  186. package/dist/defaults/paragraphStyles.js +4 -0
  187. package/dist/defaults/paragraphStyles.js.map +1 -1
  188. package/dist/defaults/resourceTypes.d.ts +16 -3
  189. package/dist/defaults/resourceTypes.d.ts.map +1 -1
  190. package/dist/defaults/resourceTypes.js +56 -8
  191. package/dist/defaults/resourceTypes.js.map +1 -1
  192. package/dist/defaults/shared.d.ts.map +1 -1
  193. package/dist/defaults/shared.js +21 -0
  194. package/dist/defaults/shared.js.map +1 -1
  195. package/dist/defaults/tableStyle.d.ts.map +1 -1
  196. package/dist/defaults/tableStyle.js +4 -1
  197. package/dist/defaults/tableStyle.js.map +1 -1
  198. package/dist/defaults/videoStyle.d.ts +9 -0
  199. package/dist/defaults/videoStyle.d.ts.map +1 -0
  200. package/dist/defaults/videoStyle.js +130 -0
  201. package/dist/defaults/videoStyle.js.map +1 -0
  202. package/dist/design/placeholders.d.ts.map +1 -1
  203. package/dist/design/placeholders.js +5 -3
  204. package/dist/design/placeholders.js.map +1 -1
  205. package/dist/html-backend.d.ts +13 -0
  206. package/dist/html-backend.d.ts.map +1 -1
  207. package/dist/html-backend.js +233 -26
  208. package/dist/html-backend.js.map +1 -1
  209. package/dist/htmlAnnotations.d.ts +47 -9
  210. package/dist/htmlAnnotations.d.ts.map +1 -1
  211. package/dist/htmlAnnotations.js +89 -17
  212. package/dist/htmlAnnotations.js.map +1 -1
  213. package/dist/index.d.ts +13 -7
  214. package/dist/index.d.ts.map +1 -1
  215. package/dist/index.js +8 -4
  216. package/dist/index.js.map +1 -1
  217. package/dist/japaneseNumerals.d.ts +44 -0
  218. package/dist/japaneseNumerals.d.ts.map +1 -0
  219. package/dist/japaneseNumerals.js +100 -0
  220. package/dist/japaneseNumerals.js.map +1 -0
  221. package/dist/knuthPlass/richAdapter.d.ts +5 -1
  222. package/dist/knuthPlass/richAdapter.d.ts.map +1 -1
  223. package/dist/knuthPlass/richAdapter.js +2 -0
  224. package/dist/knuthPlass/richAdapter.js.map +1 -1
  225. package/dist/locale.d.ts +19 -12
  226. package/dist/locale.d.ts.map +1 -1
  227. package/dist/locale.js +24 -12
  228. package/dist/locale.js.map +1 -1
  229. package/dist/measure/cache.d.ts.map +1 -1
  230. package/dist/measure/cache.js +17 -8
  231. package/dist/measure/cache.js.map +1 -1
  232. package/dist/measure/canvas.d.ts +21 -0
  233. package/dist/measure/canvas.d.ts.map +1 -1
  234. package/dist/measure/canvas.js +82 -0
  235. package/dist/measure/canvas.js.map +1 -1
  236. package/dist/measure/cjk.d.ts +3 -1
  237. package/dist/measure/cjk.d.ts.map +1 -1
  238. package/dist/measure/cjk.js +4 -2
  239. package/dist/measure/cjk.js.map +1 -1
  240. package/dist/measure/cjkAnnotate.d.ts +62 -3
  241. package/dist/measure/cjkAnnotate.d.ts.map +1 -1
  242. package/dist/measure/cjkAnnotate.js +99 -2
  243. package/dist/measure/cjkAnnotate.js.map +1 -1
  244. package/dist/measure/cjkClasses.d.ts +93 -13
  245. package/dist/measure/cjkClasses.d.ts.map +1 -1
  246. package/dist/measure/cjkClasses.js +204 -14
  247. package/dist/measure/cjkClasses.js.map +1 -1
  248. package/dist/measure/cjkCompose.d.ts +10 -4
  249. package/dist/measure/cjkCompose.d.ts.map +1 -1
  250. package/dist/measure/cjkCompose.js +715 -75
  251. package/dist/measure/cjkCompose.js.map +1 -1
  252. package/dist/measure/cjkPunctuation.d.ts +68 -14
  253. package/dist/measure/cjkPunctuation.d.ts.map +1 -1
  254. package/dist/measure/cjkPunctuation.js +96 -21
  255. package/dist/measure/cjkPunctuation.js.map +1 -1
  256. package/dist/measure/plain.js +2 -2
  257. package/dist/measure/plain.js.map +1 -1
  258. package/dist/measure/rich.d.ts +12 -2
  259. package/dist/measure/rich.d.ts.map +1 -1
  260. package/dist/measure/rich.js +46 -8
  261. package/dist/measure/rich.js.map +1 -1
  262. package/dist/measure/rubyJis.d.ts +96 -0
  263. package/dist/measure/rubyJis.d.ts.map +1 -0
  264. package/dist/measure/rubyJis.js +245 -0
  265. package/dist/measure/rubyJis.js.map +1 -0
  266. package/dist/measure/vertical.d.ts +13 -5
  267. package/dist/measure/vertical.d.ts.map +1 -1
  268. package/dist/measure/vertical.js +16 -6
  269. package/dist/measure/vertical.js.map +1 -1
  270. package/dist/numberWords.d.ts +4 -3
  271. package/dist/numberWords.d.ts.map +1 -1
  272. package/dist/numberWords.js +15 -5
  273. package/dist/numberWords.js.map +1 -1
  274. package/dist/numbering.d.ts +24 -12
  275. package/dist/numbering.d.ts.map +1 -1
  276. package/dist/numbering.js +57 -11
  277. package/dist/numbering.js.map +1 -1
  278. package/dist/parse/annotations.d.ts +21 -18
  279. package/dist/parse/annotations.d.ts.map +1 -1
  280. package/dist/parse/annotations.js +140 -51
  281. package/dist/parse/annotations.js.map +1 -1
  282. package/dist/parse/index.d.ts +1 -1
  283. package/dist/parse/index.d.ts.map +1 -1
  284. package/dist/parse/index.js.map +1 -1
  285. package/dist/parse/indexMarks.d.ts.map +1 -1
  286. package/dist/parse/indexMarks.js +42 -0
  287. package/dist/parse/indexMarks.js.map +1 -1
  288. package/dist/parse/inlineFormatting.d.ts +4 -3
  289. package/dist/parse/inlineFormatting.d.ts.map +1 -1
  290. package/dist/parse/inlineFormatting.js +9 -8
  291. package/dist/parse/inlineFormatting.js.map +1 -1
  292. package/dist/parse/types.d.ts +93 -5
  293. package/dist/parse/types.d.ts.map +1 -1
  294. package/dist/pipeline/annotations.d.ts +25 -15
  295. package/dist/pipeline/annotations.d.ts.map +1 -1
  296. package/dist/pipeline/annotations.js +102 -16
  297. package/dist/pipeline/annotations.js.map +1 -1
  298. package/dist/pipeline/build.d.ts.map +1 -1
  299. package/dist/pipeline/build.js +284 -31
  300. package/dist/pipeline/build.js.map +1 -1
  301. package/dist/pipeline/buildBlockKind.js +2 -1
  302. package/dist/pipeline/buildBlockKind.js.map +1 -1
  303. package/dist/pipeline/buildHelpers.d.ts +2 -0
  304. package/dist/pipeline/buildHelpers.d.ts.map +1 -1
  305. package/dist/pipeline/buildHelpers.js +17 -0
  306. package/dist/pipeline/buildHelpers.js.map +1 -1
  307. package/dist/pipeline/buildMeasurement.d.ts +3 -0
  308. package/dist/pipeline/buildMeasurement.d.ts.map +1 -1
  309. package/dist/pipeline/buildMeasurement.js +1 -0
  310. package/dist/pipeline/buildMeasurement.js.map +1 -1
  311. package/dist/pipeline/calloutLayout.d.ts +2 -0
  312. package/dist/pipeline/calloutLayout.d.ts.map +1 -1
  313. package/dist/pipeline/calloutLayout.js +5 -5
  314. package/dist/pipeline/calloutLayout.js.map +1 -1
  315. package/dist/pipeline/citations.d.ts +1 -1
  316. package/dist/pipeline/citations.d.ts.map +1 -1
  317. package/dist/pipeline/citations.js +15 -7
  318. package/dist/pipeline/citations.js.map +1 -1
  319. package/dist/pipeline/columnBalancing.d.ts +22 -0
  320. package/dist/pipeline/columnBalancing.d.ts.map +1 -1
  321. package/dist/pipeline/columnBalancing.js +80 -3
  322. package/dist/pipeline/columnBalancing.js.map +1 -1
  323. package/dist/pipeline/config.d.ts.map +1 -1
  324. package/dist/pipeline/config.js +3 -2
  325. package/dist/pipeline/config.js.map +1 -1
  326. package/dist/pipeline/contentWarnings.d.ts.map +1 -1
  327. package/dist/pipeline/contentWarnings.js +19 -0
  328. package/dist/pipeline/contentWarnings.js.map +1 -1
  329. package/dist/pipeline/continuation.d.ts.map +1 -1
  330. package/dist/pipeline/continuation.js +3 -3
  331. package/dist/pipeline/continuation.js.map +1 -1
  332. package/dist/pipeline/crossRefs.d.ts.map +1 -1
  333. package/dist/pipeline/crossRefs.js +3 -0
  334. package/dist/pipeline/crossRefs.js.map +1 -1
  335. package/dist/pipeline/footnotes.d.ts +20 -12
  336. package/dist/pipeline/footnotes.d.ts.map +1 -1
  337. package/dist/pipeline/footnotes.js +62 -16
  338. package/dist/pipeline/footnotes.js.map +1 -1
  339. package/dist/pipeline/headingStyles.js +1 -1
  340. package/dist/pipeline/headingStyles.js.map +1 -1
  341. package/dist/pipeline/indexDirective.d.ts.map +1 -1
  342. package/dist/pipeline/indexDirective.js +89 -12
  343. package/dist/pipeline/indexDirective.js.map +1 -1
  344. package/dist/pipeline/indexGroups.d.ts +5 -3
  345. package/dist/pipeline/indexGroups.d.ts.map +1 -1
  346. package/dist/pipeline/indexGroups.js +9 -4
  347. package/dist/pipeline/indexGroups.js.map +1 -1
  348. package/dist/pipeline/indexJapanese.d.ts +75 -0
  349. package/dist/pipeline/indexJapanese.d.ts.map +1 -0
  350. package/dist/pipeline/indexJapanese.js +264 -0
  351. package/dist/pipeline/indexJapanese.js.map +1 -0
  352. package/dist/pipeline/lineSpan.d.ts +36 -0
  353. package/dist/pipeline/lineSpan.d.ts.map +1 -0
  354. package/dist/pipeline/lineSpan.js +36 -0
  355. package/dist/pipeline/lineSpan.js.map +1 -0
  356. package/dist/pipeline/lists.js +2 -2
  357. package/dist/pipeline/lists.js.map +1 -1
  358. package/dist/pipeline/measureContentBlock.d.ts +4 -0
  359. package/dist/pipeline/measureContentBlock.d.ts.map +1 -1
  360. package/dist/pipeline/measureContentBlock.js +54 -5
  361. package/dist/pipeline/measureContentBlock.js.map +1 -1
  362. package/dist/pipeline/outline.d.ts.map +1 -1
  363. package/dist/pipeline/outline.js +3 -1
  364. package/dist/pipeline/outline.js.map +1 -1
  365. package/dist/pipeline/paragraphContainers.d.ts +25 -2
  366. package/dist/pipeline/paragraphContainers.d.ts.map +1 -1
  367. package/dist/pipeline/paragraphContainers.js +82 -2
  368. package/dist/pipeline/paragraphContainers.js.map +1 -1
  369. package/dist/pipeline/parts.d.ts +2 -2
  370. package/dist/pipeline/parts.js +3 -3
  371. package/dist/pipeline/parts.js.map +1 -1
  372. package/dist/pipeline/placement.d.ts.map +1 -1
  373. package/dist/pipeline/placement.js +2 -2
  374. package/dist/pipeline/placement.js.map +1 -1
  375. package/dist/pipeline/resourceLayout.d.ts +6 -0
  376. package/dist/pipeline/resourceLayout.d.ts.map +1 -1
  377. package/dist/pipeline/resourceLayout.js +85 -15
  378. package/dist/pipeline/resourceLayout.js.map +1 -1
  379. package/dist/pipeline/resourceNumbering.d.ts +5 -2
  380. package/dist/pipeline/resourceNumbering.d.ts.map +1 -1
  381. package/dist/pipeline/resourceNumbering.js +12 -7
  382. package/dist/pipeline/resourceNumbering.js.map +1 -1
  383. package/dist/pipeline/safeArea.d.ts +29 -0
  384. package/dist/pipeline/safeArea.d.ts.map +1 -0
  385. package/dist/pipeline/safeArea.js +89 -0
  386. package/dist/pipeline/safeArea.js.map +1 -0
  387. package/dist/pipeline/styles.d.ts +12 -0
  388. package/dist/pipeline/styles.d.ts.map +1 -1
  389. package/dist/pipeline/styles.js +7 -1
  390. package/dist/pipeline/styles.js.map +1 -1
  391. package/dist/pipeline/verse.d.ts +3 -0
  392. package/dist/pipeline/verse.d.ts.map +1 -1
  393. package/dist/pipeline/verse.js +1 -1
  394. package/dist/pipeline/verse.js.map +1 -1
  395. package/dist/pipeline/verticalMetrics.d.ts.map +1 -1
  396. package/dist/pipeline/verticalMetrics.js +4 -0
  397. package/dist/pipeline/verticalMetrics.js.map +1 -1
  398. package/dist/pipeline/videoOverlay.d.ts +24 -0
  399. package/dist/pipeline/videoOverlay.d.ts.map +1 -0
  400. package/dist/pipeline/videoOverlay.js +134 -0
  401. package/dist/pipeline/videoOverlay.js.map +1 -0
  402. package/dist/types.d.ts +567 -50
  403. package/dist/types.d.ts.map +1 -1
  404. package/dist/uprightArabic.js +1 -1
  405. package/dist/uprightArabic.js.map +1 -1
  406. package/dist/vdt.d.ts +221 -17
  407. package/dist/vdt.d.ts.map +1 -1
  408. package/dist/vdt.js.map +1 -1
  409. package/dist/video/qr.d.ts +21 -0
  410. package/dist/video/qr.d.ts.map +1 -0
  411. package/dist/video/qr.js +326 -0
  412. package/dist/video/qr.js.map +1 -0
  413. package/dist/video/url.d.ts +62 -0
  414. package/dist/video/url.d.ts.map +1 -0
  415. package/dist/video/url.js +206 -0
  416. package/dist/video/url.js.map +1 -0
  417. package/dist/writingMode.d.ts +74 -20
  418. package/dist/writingMode.d.ts.map +1 -1
  419. package/dist/writingMode.js +146 -27
  420. package/dist/writingMode.js.map +1 -1
  421. package/package.json +1 -1
@@ -30,20 +30,20 @@ import { resetLinePositions, createPageWithColumns, currentColumn, advanceToNext
30
30
  import { chooseParagraphSplit } from './orphanWidow';
31
31
  import { applyStyleAttrs, computePageMetrics, flowPageMirrored, sheetRectToFlow, isMarkerBlock, nextNonMarkerBlock, spaceLinesAfter, prevNonMarkerBlock, rollbackTrailingBlocks, } from './buildHelpers';
32
32
  import { measureContentBlock } from './measureContentBlock';
33
- import { paragraphStyleIdOf, planParagraphContainers } from './paragraphContainers';
33
+ import { containerStyle, paragraphStyleIdOf, planParagraphContainers } from './paragraphContainers';
34
34
  import { appendChapterEndNotes, footnoteIdsOfLines, footnoteParagraphStyle, noteContentBlock, noteNumberPositionOf, numberFootnotes, numberFootnotesByPlacement, sameFootnoteNumbers, splitFootnoteDefinitions, withFootnoteStyle, } from './footnotes';
35
35
  import { planParts, derivePartMeasureContext } from './parts';
36
- import { layoutCallout, offsetCalloutToAbsolute, pickCalloutStyle, planCallouts, resolveCalloutAttrs, } from './calloutLayout';
36
+ import { layoutCallout, offsetBlock, offsetCalloutToAbsolute, pickCalloutStyle, planCallouts, resolveCalloutAttrs, } from './calloutLayout';
37
37
  import { layoutResourceBlock, planTableSlice } from './resourceLayout';
38
38
  import { computeFloatPlan, floatedResourceIds, } from './floatPlacement';
39
39
  import { enumerateCurrentPageSlots, measureFloatBand, floatGapAbove, measureSideStack, clearSideObstacles, columnHasFloatBand, fitsStrict, trueBottom, } from './floatSlots';
40
40
  import { computeHeadingContext, computeResourceNumbering, } from './resourceNumbering';
41
- import { defaultResourceTypes, documentLocale } from '../defaults/resourceTypes';
41
+ import { documentLocale, effectiveResourceTypes } from '../defaults/resourceTypes';
42
42
  import { pickTableStyle } from '../defaults/tableStyle';
43
43
  import { buildHeadersAndFooters, defaultOpenerTitle, headingDesignBoxes, headingTitleText, measureDefaultOpenerHeight, measureHeadingDesign } from './headerFooter';
44
44
  import { flowColorValues } from './partPalette';
45
45
  import { chapterNumberCounter, leadingBoldText } from './placeholders';
46
- import { proposeBalanceLines, collectColumnGaps, firstDivergentColumn, gapLinesIn, boxRoomIn, boxLeverKeys, pageSegments, MAX_BALANCING_PASSES, MAX_BALANCING_PASSES_PER_DOCUMENT, balanceKey } from './columnBalancing';
46
+ import { proposeBalanceLines, collectColumnGaps, firstDivergentColumn, gapLinesIn, boxRoomIn, boxLeverKeys, pageSegments, MAX_BALANCING_PASSES, MAX_BALANCING_PASSES_PER_DOCUMENT, balanceKey, candidateKey, flexFigureKey, flexFloatKey } from './columnBalancing';
47
47
  import { applyBandCap, uncapBand, columnBottom, bandCapLines, bandTop, bareBandTop, resolveBandCapsGen, drainPasses, resolveTrailingCapsGen, bandCapLinesAroundZone, } from './bandCaps';
48
48
  import { raggedLooseLines } from './raggedLines';
49
49
  import { cjkLooseLineWarnings, collectContentWarnings, joiningLetterSpacingWarnings, locateContentWarnings, wordOverflowWarnings } from './contentWarnings';
@@ -54,6 +54,7 @@ import { tashkilFor } from './tashkil';
54
54
  import { overlineEmphasis } from '../emphasisOverline';
55
55
  import { withBookTitleBrackets } from './annotations';
56
56
  import { paperByBlock, stampPagePaper } from './paper';
57
+ import { headingLineSpanBand } from './lineSpan';
57
58
  /** Tolerance for "does this block fit" checks against a column's free
58
59
  * height, absorbing floating-point drift between grid multiples. */
59
60
  const FIT_EPS = 0.01;
@@ -322,7 +323,7 @@ function placeDocumentPass(content, config, cache, options, hints) {
322
323
  }
323
324
  const chapterEndNotes = resolved.footnotes.placement === 'chapterEnd' && footnoteNumbering.numbers.size > 0;
324
325
  const parsedBlocks = chapterEndNotes
325
- ? appendChapterEndNotes(footnoteSplit.blocks, footnoteNumbering, footnoteDefs, noteNumberPositionOf(resolved.footnotes))
326
+ ? appendChapterEndNotes(footnoteSplit.blocks, footnoteNumbering, footnoteDefs, noteNumberPositionOf(resolved.footnotes, resolved.layout.writingMode === 'vertical-rl'), resolved.footnotes.numberGap)
326
327
  : footnoteSplit.blocks;
327
328
  const headingStart = continuation?.headings;
328
329
  // `:::toc` expands into the entries of the book's outline — the one the
@@ -354,10 +355,10 @@ function placeDocumentPass(content, config, cache, options, hints) {
354
355
  // captions and inline `:ref`s can resolve their rendered number strings
355
356
  // before measurement. Numbering follows order of first reference in the
356
357
  // document.
357
- const resourceTypes = config?.resourceTypes ?? defaultResourceTypes(documentLocale(config));
358
358
  const resources = content.resources ?? [];
359
+ const resourceTypes = effectiveResourceTypes(config, resources);
359
360
  const headingContext = computeHeadingContext(contentBlocks, headingStart, isNumbered);
360
- const resourceNumbering = computeResourceNumbering(contentBlocks, resourceTypes, resources, headingContext, continuation ? { counters: continuation.resourceCounters, numbered: continuation.resourceNumbers } : undefined, resolved.numerals);
361
+ const resourceNumbering = computeResourceNumbering(contentBlocks, resourceTypes, resources, headingContext, continuation ? { counters: continuation.resourceCounters, numbered: continuation.resourceNumbers } : undefined, resolved.numerals, documentLocale(config));
361
362
  // Lookups threaded into block-kind resolution + measurement.
362
363
  const resourceById = new Map();
363
364
  for (const r of resources)
@@ -672,6 +673,9 @@ function placeDocumentPass(content, config, cache, options, hints) {
672
673
  const resource = resourceById.get(resourceId);
673
674
  if (!resource)
674
675
  return null;
676
+ // Column balancing: a picture with a safe area grown by whole lines
677
+ // (`flexFigure`, #442).
678
+ const flexPx = balanceExtraPx?.get(flexFloatKey(resourceId)) ?? 0;
675
679
  return layoutResourceBlock({
676
680
  resource,
677
681
  resourceType: resourceTypeById.get(resource.typeId),
@@ -684,6 +688,7 @@ function placeDocumentPass(content, config, cache, options, hints) {
684
688
  ...(slice ? { slice } : {}),
685
689
  ...(rotated ? (rotated.upright ? { upright: { maxLength: rotated.length } } : { rotate: rotated.direction, rotatedLength: rotated.length }) : {}),
686
690
  ...(aside ? { captionAside: aside } : {}),
691
+ ...(flexPx > 0 ? { bodyHeightDelta: flexPx } : {}),
687
692
  });
688
693
  };
689
694
  /** The rotation of a pending float on a band whose columns keep `avail`
@@ -812,6 +817,9 @@ function placeDocumentPass(content, config, cache, options, hints) {
812
817
  blk.dirty = false;
813
818
  blk.snappedToGrid = false;
814
819
  blk.bbox = createBoundingBox(x, 0, width, totalHeight);
820
+ if ((rb.bodyFlex?.delta ?? 0) > 0.01 && balanceExtraPx?.has(flexFloatKey(resourceId))) {
821
+ blk.balancing = { levers: ['flexFigure'], spaceAbove: 0, bodyGrowth: rb.bodyFlex.delta };
822
+ }
815
823
  blk.lines = [];
816
824
  if (rb.rotation) {
817
825
  // The upright frame's origin: for a counter-clockwise turn the frame's
@@ -835,6 +843,8 @@ function placeDocumentPass(content, config, cache, options, hints) {
835
843
  /** Float bands reserved per column in this pass (the fresh-page flush
836
844
  * sends single-column floats to the least reserved column). */
837
845
  const floatReserved = new Map();
846
+ /** Pages a `:::pagebreak{center}` opened (#424). */
847
+ const centredPages = new Set();
838
848
  const reservedOf = (col) => floatReserved.get(col) ?? { top: 0, bottom: 0 };
839
849
  const floatHeadOf = (col) => reservedOf(col).top;
840
850
  /** `BandCap.headPx` for a cap proposed on `cols`: how far the float bands
@@ -1640,7 +1650,21 @@ function placeDocumentPass(content, config, cache, options, hints) {
1640
1650
  // places lines (`notesPrefixCost`), so the line citing a note and the note
1641
1651
  // share a column. The notes are set in their reserved room once the pass
1642
1652
  // is placed (`setColumnNotes`).
1643
- const columnNotes = resolved.footnotes.placement === 'column' && footnoteNumbering.numbers.size > 0;
1653
+ //
1654
+ // Sidenotes on the spread (`placement: 'spread'`, 傍注, JLReq §4.2.6; a
1655
+ // vertical document's: a horizontal one resolves to `'column'`) use the
1656
+ // same room, at the foot of the flow, which on a vertical page is its
1657
+ // left end, the fore edge of a right-bound book's odd page. A spread is
1658
+ // an even book page and the odd page after it. The notes cited on the
1659
+ // odd page are reserved there as column notes; the ones cited on the
1660
+ // even page wait for the odd page (`spreadDeferred`) and are reserved at
1661
+ // the foot of its first column of text before anything it cites. A note
1662
+ // that would leave the odd page without room for a line of its own text
1663
+ // stays on the even page, at its foot (the overflow JLReq sends there);
1664
+ // a line on the odd page whose notes no longer fit moves on, as any
1665
+ // line with column notes does, to the next spread.
1666
+ const spreadNotes = resolved.footnotes.placement === 'spread' && footnoteNumbering.numbers.size > 0;
1667
+ const columnNotes = (resolved.footnotes.placement === 'column' || spreadNotes) && footnoteNumbering.numbers.size > 0;
1644
1668
  const noteStyle = columnNotes ? resolveParagraphStyle(footnoteParagraphStyle(resolved), resolved) : bodyStyle;
1645
1669
  const noteSpaceAbovePx = dimensionToPx(resolved.footnotes.spaceAbove, dpi, bodyStyle.fontSizePx);
1646
1670
  const noteSpaceBelowRulePx = dimensionToPx(resolved.footnotes.spaceBelowRule, dpi, bodyStyle.fontSizePx);
@@ -1658,7 +1682,7 @@ function placeDocumentPass(content, config, cache, options, hints) {
1658
1682
  let m = noteMeasures.get(key);
1659
1683
  if (m === undefined) {
1660
1684
  const number = footnoteNumbering.numbers.get(id) ?? '?';
1661
- m = measureContentBlock(noteContentBlock(footnoteDefs.get(id), id, number, noteNumberPositionOf(resolved.footnotes)), 0, width, measureCtx, { styleOverride: noteStyle });
1685
+ m = measureContentBlock(noteContentBlock(footnoteDefs.get(id), id, number, noteNumberPositionOf(resolved.footnotes, resolved.layout.writingMode === 'vertical-rl'), resolved.footnotes.numberGap), 0, width, measureCtx, { styleOverride: noteStyle });
1662
1686
  noteMeasures.set(key, m);
1663
1687
  }
1664
1688
  return m;
@@ -1682,6 +1706,11 @@ function placeDocumentPass(content, config, cache, options, hints) {
1682
1706
  });
1683
1707
  return h;
1684
1708
  };
1709
+ /** Sidenotes cited on the even page of a spread, waiting for its odd
1710
+ * page (`spreadDeferredPage`, a page index) or the first page after it
1711
+ * the flow sets text on. */
1712
+ const spreadDeferred = [];
1713
+ let spreadDeferredPage = -1;
1685
1714
  /** Notes cited by blocks set outside the flow (the paragraphs of a box,
1686
1715
  * inline, floated or fixed): they wait for the next text the flow
1687
1716
  * places, and go to the foot of its column, in citation order. */
@@ -1691,11 +1720,47 @@ function placeDocumentPass(content, config, cache, options, hints) {
1691
1720
  const collectPendingNotes = () => {
1692
1721
  for (; notesScanned < doc.blocks.length; notesScanned++) {
1693
1722
  for (const id of footnoteIdsOfLines(doc.blocks[notesScanned].lines)) {
1694
- if (!placedNotes.has(id) && !pendingNotes.includes(id))
1723
+ if (!placedNotes.has(id) && !pendingNotes.includes(id) && !spreadDeferred.includes(id))
1695
1724
  pendingNotes.push(id);
1696
1725
  }
1697
1726
  }
1698
1727
  };
1728
+ /** Whether the page at `pageIndex` opens its spread (an even book page),
1729
+ * so the notes it cites go to the next page. */
1730
+ const opensSpread = (pageIndex) => spreadNotes && (pageIndex + pageIndexOffset + 1) % 2 === 0;
1731
+ /** The sidenotes waiting for the page at `pageIndex`, if any. */
1732
+ const deferredFor = (pageIndex) => (spreadDeferred.length > 0 && pageIndex >= spreadDeferredPage ? spreadDeferred : []);
1733
+ /** Height `ids` take at the foot of a column of `width` with no note
1734
+ * yet: the separator zone, the notes and the gaps between. */
1735
+ const freshNotesCost = (ids, width) => {
1736
+ let h = ids.length > 0 ? noteHeadPx : 0;
1737
+ ids.forEach((id, i) => { h += (i > 0 ? noteGapPx : 0) + noteHeight(id, width); });
1738
+ return h;
1739
+ };
1740
+ /** On the even page of a spread (`pageIndex`), `col` holding the text:
1741
+ * which of `ids` (cited there, in order) wait for the odd page and which
1742
+ * stay at this column's foot. Each waits while the notes waiting with it
1743
+ * leave the odd page room for a line of text — measured on this column,
1744
+ * which the odd page's matches; a note that does not stays here, and so
1745
+ * do the ones after it. */
1746
+ const splitSpreadNotes = (pageIndex, col, ids) => {
1747
+ const already = spreadDeferredPage > pageIndex ? spreadDeferred : [];
1748
+ const wait = [...already];
1749
+ const here = [];
1750
+ const room = col.bbox.height + reservedHeight(col) - bodyStyle.lineHeightPx;
1751
+ for (const id of ids) {
1752
+ if (here.length === 0 && freshNotesCost([...wait, id], col.bbox.width) <= room + 0.01)
1753
+ wait.push(id);
1754
+ else
1755
+ here.push(id);
1756
+ }
1757
+ return { wait: wait.slice(already.length), here };
1758
+ };
1759
+ /** What the notes reserved at `col`'s foot took from it. */
1760
+ const reservedHeight = (col) => {
1761
+ const entry = columnNotesOf.get(col);
1762
+ return entry ? entry.slots.reduce((h, slot) => h + slot.height, 0) : 0;
1763
+ };
1699
1764
  /** `cost[k]`: the notes the first `k` of `lines` cite for the first time
1700
1765
  * (after the pending ones) would add to `col`'s foot. Undefined when
1701
1766
  * there are none. */
@@ -1703,35 +1768,56 @@ function placeDocumentPass(content, config, cache, options, hints) {
1703
1768
  if (!columnNotes)
1704
1769
  return undefined;
1705
1770
  collectPendingNotes();
1771
+ const page = cursor.pageIndex;
1772
+ // Sidenotes waiting for this page are set first; on the even page of a
1773
+ // spread only the notes that stay on it cost room.
1774
+ const waiting = deferredFor(page);
1706
1775
  const ids = [...pendingNotes];
1707
- let any = ids.length > 0;
1708
- const cost = [notesCost(col, ids)];
1776
+ let any = ids.length > 0 || waiting.length > 0;
1777
+ const even = opensSpread(page);
1778
+ const costOf = () => notesCost(col, [...waiting, ...(even ? splitSpreadNotes(page, col, ids).here : ids)]);
1779
+ const cost = [costOf()];
1709
1780
  for (const line of lines) {
1710
1781
  for (const seg of line.segments ?? []) {
1711
1782
  const id = seg.footnoteId;
1712
- if (id !== undefined && !placedNotes.has(id) && !ids.includes(id)) {
1783
+ if (id !== undefined && !placedNotes.has(id) && !ids.includes(id) && !spreadDeferred.includes(id)) {
1713
1784
  ids.push(id);
1714
1785
  any = true;
1715
1786
  }
1716
1787
  }
1717
- cost.push(notesCost(col, ids));
1788
+ cost.push(costOf());
1718
1789
  }
1719
1790
  return any ? cost : undefined;
1720
1791
  };
1721
1792
  /** Reserve at the placed block's column foot the pending notes and the
1722
- * ones the block cites first. */
1793
+ * ones the block cites first (sidenotes: the ones waiting for this
1794
+ * page first; on the even page of a spread, only the ones that stay). */
1723
1795
  const reserveCitedNotes = (placed) => {
1724
1796
  if (!columnNotes || placed.pageIndex < 0)
1725
1797
  return;
1726
1798
  collectPendingNotes();
1727
- const cited = footnoteIdsOfLines(placed.lines).filter((id) => !placedNotes.has(id) && !pendingNotes.includes(id));
1728
- if (cited.length === 0 && pendingNotes.length === 0)
1799
+ const waiting = deferredFor(placed.pageIndex);
1800
+ const cited = footnoteIdsOfLines(placed.lines).filter((id) => !placedNotes.has(id) && !pendingNotes.includes(id) && !spreadDeferred.includes(id));
1801
+ if (cited.length === 0 && pendingNotes.length === 0 && waiting.length === 0)
1729
1802
  return;
1730
1803
  const page = doc.pages[placed.pageIndex];
1731
1804
  const col = page?.columns[placed.columnIndex];
1732
1805
  if (!page || !col)
1733
1806
  return;
1734
- reserveNotes(page, col, [...pendingNotes.splice(0), ...cited], placed.contentIndex ?? 0);
1807
+ const anchor = placed.contentIndex ?? 0;
1808
+ if (waiting.length > 0)
1809
+ reserveNotes(page, col, spreadDeferred.splice(0), anchor);
1810
+ const ids = [...pendingNotes.splice(0), ...cited];
1811
+ if (opensSpread(placed.pageIndex)) {
1812
+ const { wait, here } = splitSpreadNotes(placed.pageIndex, col, ids);
1813
+ spreadDeferred.push(...wait);
1814
+ spreadDeferredPage = placed.pageIndex + 1;
1815
+ if (here.length > 0)
1816
+ reserveNotes(page, col, here, anchor);
1817
+ return;
1818
+ }
1819
+ if (ids.length > 0)
1820
+ reserveNotes(page, col, ids, anchor);
1735
1821
  };
1736
1822
  /** Reserve `ids` at `col`'s foot. */
1737
1823
  const reserveNotes = (page, col, ids, anchor) => {
@@ -1774,6 +1860,7 @@ function placeDocumentPass(content, config, cache, options, hints) {
1774
1860
  if (!columnNotes)
1775
1861
  return;
1776
1862
  collectPendingNotes();
1863
+ reserveLeftoverSidenotes();
1777
1864
  if (pendingNotes.length === 0)
1778
1865
  return;
1779
1866
  const page = doc.pages[cursor.pageIndex];
@@ -1781,6 +1868,27 @@ function placeDocumentPass(content, config, cache, options, hints) {
1781
1868
  if (page && col)
1782
1869
  reserveNotes(page, col, pendingNotes.splice(0), contentBlocks.length - 1);
1783
1870
  };
1871
+ /** Sidenotes still waiting when the flow ends on the even page of a
1872
+ * spread: they stay on it (JLReq §4.2.6), at the foot of the column the
1873
+ * flow ended in when they fit under its text, else on a page of their
1874
+ * own after it. */
1875
+ const reserveLeftoverSidenotes = () => {
1876
+ if (spreadDeferred.length === 0)
1877
+ return;
1878
+ const ids = spreadDeferred.splice(0);
1879
+ let page = doc.pages[cursor.pageIndex];
1880
+ let col = page?.columns[cursor.columnIndex];
1881
+ if (!page || !col)
1882
+ return;
1883
+ if (notesCost(col, ids) > col.availableHeight + 0.01) {
1884
+ page = createPageWithColumns(doc.pages.length, geomResolved, contentArea, pageWidthPx, pageHeightPx, pageIndexOffset);
1885
+ doc.pages.push(page);
1886
+ col = page.columns[0];
1887
+ if (!col)
1888
+ return;
1889
+ }
1890
+ reserveNotes(page, col, ids, contentBlocks.length - 1);
1891
+ };
1784
1892
  /** `chapterEnd`: move the run of note paragraphs that closes a column
1785
1893
  * down to the column's true foot (under a band cap's cut, above any
1786
1894
  * bottom float band). */
@@ -2481,6 +2589,22 @@ function placeDocumentPass(content, config, cache, options, hints) {
2481
2589
  });
2482
2590
  pendingNumberingChange = null;
2483
2591
  };
2592
+ /** `headings.keepWithNextSpread` (#424): whether a heading may close
2593
+ * `col` even so — the last text column of an even page, whose text then
2594
+ * opens the facing odd page of the same spread (JLReq §4.1.7 b). Pages
2595
+ * count as printed (`pageIndexOffset` of a chapter laid out after
2596
+ * others), page 1 being the lone recto. */
2597
+ const headingMayCloseColumn = (col) => {
2598
+ if (!resolved.headings.keepWithNextSpread)
2599
+ return false;
2600
+ const page = doc.pages[cursor.pageIndex];
2601
+ if (!page || !page.columns.includes(col))
2602
+ return false;
2603
+ if ((page.index + (doc.pageIndexOffset ?? 0) + 1) % 2 !== 0)
2604
+ return false;
2605
+ const flow = page.columns.filter((c) => c.kind !== 'side' && c.kind !== 'span');
2606
+ return flow[flow.length - 1] === col;
2607
+ };
2484
2608
  /** Heading blocks that are not part of a callout — the only ones the
2485
2609
  * keep-with-next rollbacks may pull along (a callout is one unbreakable
2486
2610
  * unit; its children never leave it). */
@@ -2488,7 +2612,7 @@ function placeDocumentPass(content, config, cache, options, hints) {
2488
2612
  /** Free headings closing `col` (its trailing run), 0 unless keep-with-next
2489
2613
  * is on: the headings a block moving on would strand. */
2490
2614
  const trailingHeadingRun = (col) => {
2491
- if (!resolved.headings.keepWithNext)
2615
+ if (!resolved.headings.keepWithNext || headingMayCloseColumn(col))
2492
2616
  return 0;
2493
2617
  let n = 0;
2494
2618
  for (let j = col.blocks.length - 1; j >= 0 && isFreeHeading(col.blocks[j]); j--)
@@ -3834,6 +3958,11 @@ function placeDocumentPass(content, config, cache, options, hints) {
3834
3958
  // parity padding, so a blank parity page never carries a float.
3835
3959
  flushFloatsIntoPage(doc.pages[cursor.pageIndex]);
3836
3960
  flushPendingNumberingAtBoundary();
3961
+ // `:::pagebreak{center}` (ページの左右中央, #424): the text of the page
3962
+ // the break opens is centred between the head and the foot of the
3963
+ // type area once the pass is done (`centrePageText`).
3964
+ if (attrs.center !== undefined && attrs.center.trim().toLowerCase() !== 'false')
3965
+ centredPages.add(cursor.pageIndex);
3837
3966
  }
3838
3967
  else if (name === 'columnbreak') {
3839
3968
  // Explicit column break: end the current column here (its bottom
@@ -4097,7 +4226,9 @@ function placeDocumentPass(content, config, cache, options, hints) {
4097
4226
  ? { ...containerTail.tailStyle, marginBottomPx: blockMeasureCtx.bodyStyle.marginBottomPx }
4098
4227
  : containerTail?.tailStyle;
4099
4228
  const styleOverride = paragraphContainer
4100
- ? (isContainerTail ? tailStyle ?? paragraphContainer.tailStyle : paragraphContainer.style)
4229
+ ? (paragraphContainer.overBody
4230
+ ? containerStyle(paragraphContainer, isContainerTail, blockMeasureCtx.bodyStyle, dpi)
4231
+ : isContainerTail ? tailStyle ?? paragraphContainer.tailStyle : paragraphContainer.style)
4101
4232
  : undefined;
4102
4233
  // Column balancing "run a paragraph long": the loose path is taken only
4103
4234
  // for the paragraphs the driver asked for, so the common case keeps its
@@ -4125,9 +4256,28 @@ function placeDocumentPass(content, config, cache, options, hints) {
4125
4256
  const upright = pageIsVertical(blockPage) && rawBlock.type === 'resourceBlock'
4126
4257
  ? { uprightMaxLength: uprightOn(blockPage).length }
4127
4258
  : {};
4259
+ // Column balancing: an inline picture with a safe area grown by whole
4260
+ // lines (`flexFigure`, #442).
4261
+ const figureGrowPx = rawBlock.type === 'resourceBlock' ? balanceExtraPx?.get(flexFigureKey(blockIdx)) ?? 0 : 0;
4262
+ const figureDelta = figureGrowPx > 0 ? { figureHeightDelta: figureGrowPx } : {};
4128
4263
  let measuredBlock = tryLoose
4129
4264
  ? measureLooseParagraph(rawBlock, blockIdx, col.bbox.width, blockMeasureCtx, styleOverride, looseLines, trackingLadder, looseOutcome)
4130
- : measureContentBlock(rawBlock, blockIdx, measureWidth, blockMeasureCtx, { styleOverride, ...upright });
4265
+ : measureContentBlock(rawBlock, blockIdx, measureWidth, blockMeasureCtx, { styleOverride, ...upright, ...figureDelta });
4266
+ // An inline picture with a safe area a little too tall for the room
4267
+ // left in its column is cropped within its safe area to stay there
4268
+ // rather than move on and leave the column short (#442).
4269
+ if (measuredBlock?.kind.vdtType === 'resource' && measuredBlock.resourceBlock?.bodyFlex) {
4270
+ const flex = measuredBlock.resourceBlock.bodyFlex;
4271
+ const room = col.availableHeight - (col.blocks.length === 0 ? 0 : Math.max(pendingSpacing, floatGapPx));
4272
+ const over = measuredBlock.measured.totalHeight - room;
4273
+ if (over > 0.01 && room > 0 && over <= flex.shrink + 0.01) {
4274
+ const cropped = measureContentBlock(rawBlock, blockIdx, measureWidth, blockMeasureCtx, {
4275
+ styleOverride, ...upright, figureHeightDelta: flex.delta - over,
4276
+ });
4277
+ if (cropped && cropped.measured.totalHeight <= room + 0.01)
4278
+ measuredBlock = cropped;
4279
+ }
4280
+ }
4131
4281
  // Screen pages (`layout.fitFiguresToPage`): an inline figure a little
4132
4282
  // too tall for the room left in its column — under an opener band, say
4133
4283
  // — is set smaller to stay with its text rather than leave the rest of
@@ -4174,7 +4324,16 @@ function placeDocumentPass(content, config, cache, options, hints) {
4174
4324
  // break, keep-with-next and grid snap apply — but with no line height
4175
4325
  // and no margins: it takes no room, and renderers skip it.
4176
4326
  const hiddenHeading = vdtType === 'heading' && headingIsHidden(rawBlock, headingLevels.forBlock(rawBlock));
4177
- const style = hiddenHeading ? { ...kind.style, lineHeightPx: 0, marginTopPx: 0, marginBottomPx: 0 } : kind.style;
4327
+ // 行取り (#424): a heading with a `lineSpan` takes that many body grid
4328
+ // lines, its text centred in them; the band replaces its margins. Not a
4329
+ // heading painted as a page opener or from its own design.
4330
+ const lineSpan = vdtType === 'heading' && !hiddenHeading && kind.style.lineSpan !== undefined
4331
+ && !headingSetsOwnBand(headingLevels.forBlock(rawBlock))
4332
+ ? kind.style.lineSpan
4333
+ : undefined;
4334
+ const style = hiddenHeading
4335
+ ? { ...kind.style, lineHeightPx: 0, marginTopPx: 0, marginBottomPx: 0 }
4336
+ : lineSpan !== undefined ? { ...kind.style, marginTopPx: 0, marginBottomPx: 0 } : kind.style;
4178
4337
  // --- Resource blocks (image / svg / table + caption) -----------------
4179
4338
  // Placed atomically (kept-together) — no mid-content split for v1.
4180
4339
  if (vdtType === 'resource') {
@@ -4208,6 +4367,11 @@ function placeDocumentPass(content, config, cache, options, hints) {
4208
4367
  // resource's own caption/table lines live on `resourceBlock` and must be
4209
4368
  // offset to absolute page coordinates here using the placed bbox origin.
4210
4369
  offsetResourceBlockToAbsolute(resourceBlock, blk.bbox.x, blk.bbox.y);
4370
+ const grown = figureGrowPx > 0 ? resourceBlock.bodyFlex?.delta ?? 0 : 0;
4371
+ if (grown > 0.01) {
4372
+ blk.balancing = { levers: ['flexFigure'], spaceAbove: 0, bodyGrowth: grown };
4373
+ addBalanceExtra(currentColumn(doc, cursor), grown);
4374
+ }
4211
4375
  doc.blocks.push(blk);
4212
4376
  // Snap the flow position after the resource to the baseline grid (the
4213
4377
  // group height is arbitrary), baking in at least marginBottom — same
@@ -4433,6 +4597,12 @@ function placeDocumentPass(content, config, cache, options, hints) {
4433
4597
  spacingBefore = pendingSpacing;
4434
4598
  if (vdtType === 'heading' || vdtType === 'mathDisplay') {
4435
4599
  spacingBefore = Math.max(partIndex === 0 ? pendingBeforeSelfSnapping(blockIdx) : spacingBefore, style.marginTopPx);
4600
+ // A 行取り band opens on a grid line when its heading snaps to the
4601
+ // grid, so its lines are body lines (#424).
4602
+ if (lineSpan !== undefined && partIndex === 0 && (headingLevels.forBlock(rawBlock)?.snapToGrid ?? resolved.headings.snapToGrid)) {
4603
+ const usedHeight = curCol.bbox.height - curCol.availableHeight;
4604
+ spacingBefore = Math.ceil((usedHeight + spacingBefore - 0.01) / baselineGrid) * baselineGrid - usedHeight;
4605
+ }
4436
4606
  // Column balancing: extra whole grid lines above this heading so
4437
4607
  // the column it sits in ends flush with the page bottom. Applied
4438
4608
  // after margin collapsing — the heading's effective top margin
@@ -4546,6 +4716,14 @@ function placeDocumentPass(content, config, cache, options, hints) {
4546
4716
  // actual content bottom so the reserved block height (and the
4547
4717
  // subsequent marginBottom + grid snap) starts from there.
4548
4718
  let effectiveRemainHeight = totalRemainHeight;
4719
+ /** How far the lines of a 行取り heading go down its band (#424). */
4720
+ let lineSpanShift = 0;
4721
+ if (lineSpan !== undefined && partIndex === 0) {
4722
+ const bodyBlockStyle = blockMeasureCtx.bodyStyle;
4723
+ const band = headingLineSpanBand(lineSpan, remainingLines.length, style.lineHeightPx, { font: style.fontString, sizePx: style.fontSizePx }, { font: bodyBlockStyle.fontString, sizePx: bodyBlockStyle.fontSizePx }, baselineGrid);
4724
+ effectiveRemainHeight = band.height;
4725
+ lineSpanShift = band.shift;
4726
+ }
4549
4727
  /** The heading's design and the values it is laid out with, kept for
4550
4728
  * the side-column obstacles once the block is placed (EF-78). */
4551
4729
  let headingDesign;
@@ -4806,7 +4984,8 @@ function placeDocumentPass(content, config, cache, options, hints) {
4806
4984
  && resolved.headings.keepWithNext
4807
4985
  && !nextIsHeading
4808
4986
  && nextBlock !== null
4809
- && (curCol.blocks.length > trailingHeadingRun(curCol) || shortColumn)) {
4987
+ && (curCol.blocks.length > trailingHeadingRun(curCol) || shortColumn)
4988
+ && !headingMayCloseColumn(curCol)) {
4810
4989
  const wouldUsedHeight = (curCol.bbox.height - curCol.availableHeight) + spacingBefore;
4811
4990
  const naturalBottom = wouldUsedHeight + effectiveRemainHeight + style.marginBottomPx;
4812
4991
  const snappedBottom = shouldSnapToGrid
@@ -4879,7 +5058,7 @@ function placeDocumentPass(content, config, cache, options, hints) {
4879
5058
  blk.lines = [mathLine];
4880
5059
  }
4881
5060
  else {
4882
- blk.lines = resetLinePositions(remainingLines, style.lineHeightPx);
5061
+ blk.lines = shiftLinesDown(resetLinePositions(remainingLines, style.lineHeightPx), lineSpanShift);
4883
5062
  }
4884
5063
  blk.dirty = false;
4885
5064
  blk.snappedToGrid = shouldSnapToGrid && partIndex === 0;
@@ -5250,7 +5429,7 @@ function placeDocumentPass(content, config, cache, options, hints) {
5250
5429
  blk.titleBreaks = rawBlock.titleBreaks;
5251
5430
  blk.titleLength = rawBlock.text.length;
5252
5431
  }
5253
- blk.lines = resetLinePositions(remainingLines, style.lineHeightPx);
5432
+ blk.lines = shiftLinesDown(resetLinePositions(remainingLines, style.lineHeightPx), lineSpanShift);
5254
5433
  blk.dirty = false;
5255
5434
  blk.snappedToGrid = false;
5256
5435
  if (remainingLines.length > 0) {
@@ -5306,6 +5485,11 @@ function placeDocumentPass(content, config, cache, options, hints) {
5306
5485
  dropChapterEndNotes();
5307
5486
  if (chapterEndNotes)
5308
5487
  ruleChapterEndNotes();
5488
+ for (const index of centredPages) {
5489
+ const page = doc.pages[index];
5490
+ if (page)
5491
+ centrePageText(page, reservedOf);
5492
+ }
5309
5493
  // A band that is still cut at the end of the pass (a trailing cap: the
5310
5494
  // closing band of a chapter or of the document) must hold what it took,
5311
5495
  // under the same rules as an uncut one. Two ways a cut too low breaks
@@ -5551,8 +5735,9 @@ function printedFootnoteNumbers(doc) {
5551
5735
  * beyond the first, for the numbers to settle. */
5552
5736
  const MAX_FOOTNOTE_ROUNDS = 3;
5553
5737
  /**
5554
- * {@link buildDocumentBalanced}, with `footnotes.numbering: 'page'` /
5555
- * `'column'`: a note's number depends on the page the layout sets it on,
5738
+ * {@link buildDocumentBalanced}, with `footnotes.numbering: 'page'`,
5739
+ * `'column'` or `'spread'`: a note's number depends on the page the layout
5740
+ * sets it on,
5556
5741
  * so the document is numbered by chapter, laid out, numbered again where
5557
5742
  * its notes landed, and laid out with those numbers until they no longer
5558
5743
  * change (as the contents' page labels are). A circled marker is the same
@@ -5562,13 +5747,16 @@ const MAX_FOOTNOTE_ROUNDS = 3;
5562
5747
  function* buildDocumentNumbered(content, config, cache, options, tocRound = 0) {
5563
5748
  let doc = yield* buildDocumentBalanced(content, config, cache, options, tocRound);
5564
5749
  const f = doc.config.footnotes;
5565
- if (f.placement !== 'column' || (f.numbering !== 'page' && f.numbering !== 'column'))
5750
+ if ((f.placement !== 'column' && f.placement !== 'spread') || (f.numbering !== 'page' && f.numbering !== 'column' && f.numbering !== 'spread'))
5566
5751
  return doc;
5567
5752
  for (let round = 0; round < MAX_FOOTNOTE_ROUNDS; round++) {
5568
5753
  const used = printedFootnoteNumbers(doc);
5569
5754
  if (used.size === 0)
5570
5755
  break;
5571
- const placed = numberFootnotesByPlacement(doc.pages, f.numbering, documentNumeralStyle(f.numberFormat, doc.config.numerals), f.markerTemplate).numbers;
5756
+ // A spread counts its notes in citation order: the order of the first
5757
+ // markers, which `used` holds.
5758
+ const order = f.numbering === 'spread' ? new Map([...used.keys()].map((id, i) => [id, i])) : undefined;
5759
+ const placed = numberFootnotesByPlacement(doc.pages, f.numbering, documentNumeralStyle(f.numberFormat, doc.config.numerals), f.markerTemplate, doc.pageIndexOffset ?? 0, order).numbers;
5572
5760
  // A note the layout set nowhere keeps the number it had.
5573
5761
  const next = new Map(used);
5574
5762
  for (const [id, number] of placed)
@@ -5690,7 +5878,7 @@ function* buildDocumentBalanced(content, config, cache, options, tocRound = 0, f
5690
5878
  if (si < 0)
5691
5879
  continue;
5692
5880
  for (const c of g.candidates)
5693
- owner.set(balanceKey(c.contentIndex, c.part ?? 0), si);
5881
+ owner.set(candidateKey(c), si);
5694
5882
  }
5695
5883
  return owner;
5696
5884
  };
@@ -5804,7 +5992,7 @@ function* buildDocumentBalanced(content, config, cache, options, tocRound = 0, f
5804
5992
  }
5805
5993
  return hit;
5806
5994
  };
5807
- const keysOf = (pick) => new Set(gaps.filter(pick).flatMap((g) => g.candidates.map((c) => balanceKey(c.contentIndex, c.part ?? 0))));
5995
+ const keysOf = (pick) => new Set(gaps.filter(pick).flatMap((g) => g.candidates.map((c) => candidateKey(c))));
5808
5996
  if (blacklist(keysOf((g) => g.pageIndex === div.pageIndex && g.columnIndex === div.columnIndex)))
5809
5997
  return true;
5810
5998
  if (blacklist(keysOf((g) => g.pageIndex === div.pageIndex)))
@@ -6016,4 +6204,69 @@ function verseSnaps(styleId, resolved) {
6016
6204
  const key = styleId?.trim();
6017
6205
  return !key || resolved.paragraphStyles.find((s) => s.id === key)?.snapToGrid !== false;
6018
6206
  }
6207
+ /** `lines` (block-relative, as `resetLinePositions` sets them) moved `dy`
6208
+ * px down their block: a 行取り heading's lines in its band (#424). */
6209
+ function shiftLinesDown(lines, dy) {
6210
+ if (dy === 0)
6211
+ return lines;
6212
+ for (const line of lines) {
6213
+ line.bbox.y += dy;
6214
+ line.baseline += dy;
6215
+ }
6216
+ return lines;
6217
+ }
6218
+ /** Whether a heading level sets the band it takes itself — a page opener
6219
+ * (`span: 'page'`) or a heading painted from its `advancedDesign` — so a
6220
+ * `lineSpan` (#424) does not apply to it. */
6221
+ function headingSetsOwnBand(lvl) {
6222
+ return lvl !== undefined && (lvl.span === 'page' || lvl.advancedDesign.enabled);
6223
+ }
6224
+ /**
6225
+ * ページの左右中央 (#424): the text on `page` centred between the head and
6226
+ * the foot of its type area — across the page in vertical text, down it in
6227
+ * horizontal text — as a dedication or a part title is set on a page of its
6228
+ * own. The extent is measured from the first line box to the last one of
6229
+ * every text column (a box or a figure by its frame), and the room taken by
6230
+ * floats at the head or foot of a column is left out; every block of the
6231
+ * columns moves by the same amount, so columns and the text in them keep
6232
+ * their places relative to each other. Floats, notes and running heads stay
6233
+ * where they are. A page whose text already fills the area is left alone.
6234
+ */
6235
+ function centrePageText(page, reservedOf) {
6236
+ const cols = page.columns.filter((c) => c.kind !== 'side' && c.blocks.length > 0);
6237
+ if (cols.length === 0)
6238
+ return;
6239
+ let top = Infinity;
6240
+ let bottom = -Infinity;
6241
+ let areaTop = Infinity;
6242
+ let areaBottom = -Infinity;
6243
+ for (const col of cols) {
6244
+ const reserved = reservedOf(col);
6245
+ areaTop = Math.min(areaTop, col.bbox.y + reserved.top);
6246
+ areaBottom = Math.max(areaBottom, col.bbox.y + col.bbox.height - reserved.bottom);
6247
+ for (const b of col.blocks) {
6248
+ if (b.hidden)
6249
+ continue;
6250
+ const first = b.lines[0];
6251
+ const last = b.lines[b.lines.length - 1];
6252
+ const textual = first !== undefined && last !== undefined && b.type !== 'resource' && b.containerId === undefined;
6253
+ top = Math.min(top, textual ? first.bbox.y : b.bbox.y);
6254
+ bottom = Math.max(bottom, textual ? last.bbox.y + last.bbox.height : b.bbox.y + b.bbox.height);
6255
+ }
6256
+ }
6257
+ if (!Number.isFinite(top) || !Number.isFinite(bottom))
6258
+ return;
6259
+ const dy = (areaTop + areaBottom) / 2 - (top + bottom) / 2;
6260
+ if (dy < 0.5)
6261
+ return;
6262
+ const moved = new Set();
6263
+ for (const col of cols) {
6264
+ for (const b of col.blocks) {
6265
+ if (moved.has(b))
6266
+ continue;
6267
+ moved.add(b);
6268
+ offsetBlock(b, 0, dy);
6269
+ }
6270
+ }
6271
+ }
6019
6272
  //# sourceMappingURL=build.js.map