pulpweaver4 0.0.91 → 0.0.185

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 (502) hide show
  1. package/dist/ast/djot.js +23 -0
  2. package/dist/ast/djot.js.map +1 -1
  3. package/dist/ast/index.d.ts +1 -0
  4. package/dist/ast/index.js +1 -0
  5. package/dist/ast/index.js.map +1 -1
  6. package/dist/ast/nodes.d.ts +59 -5
  7. package/dist/ast/nodes.js.map +1 -1
  8. package/dist/ast/table.d.ts +27 -0
  9. package/dist/ast/table.js +32 -0
  10. package/dist/ast/table.js.map +1 -0
  11. package/dist/browser.js +2420 -0
  12. package/dist/citations/index.d.ts +1 -1
  13. package/dist/citations/index.js +1 -1
  14. package/dist/citations/index.js.map +1 -1
  15. package/dist/citations/project.d.ts +12 -2
  16. package/dist/citations/project.js +21 -7
  17. package/dist/citations/project.js.map +1 -1
  18. package/dist/colour/images.d.ts +11 -2
  19. package/dist/colour/images.js +53 -3
  20. package/dist/colour/images.js.map +1 -1
  21. package/dist/colour/ink-limit.d.ts +2 -2
  22. package/dist/colour/ink-limit.js +6 -0
  23. package/dist/colour/ink-limit.js.map +1 -1
  24. package/dist/colour/previews.d.ts +8 -4
  25. package/dist/colour/previews.js +11 -8
  26. package/dist/colour/previews.js.map +1 -1
  27. package/dist/config/config.d.ts +91 -3
  28. package/dist/config/config.js +200 -3
  29. package/dist/config/config.js.map +1 -1
  30. package/dist/config/project-schema.d.ts +0 -8
  31. package/dist/config/project-schema.js +207 -12
  32. package/dist/config/project-schema.js.map +1 -1
  33. package/dist/config/schema.js +10 -0
  34. package/dist/config/schema.js.map +1 -1
  35. package/dist/config/secrets.d.ts +11 -0
  36. package/dist/config/secrets.js +19 -0
  37. package/dist/config/secrets.js.map +1 -0
  38. package/dist/csl/project.d.ts +19 -4
  39. package/dist/csl/project.js +23 -10
  40. package/dist/csl/project.js.map +1 -1
  41. package/dist/fonts/index.d.ts +1 -1
  42. package/dist/fonts/index.js +1 -1
  43. package/dist/fonts/index.js.map +1 -1
  44. package/dist/fonts/lint.d.ts +51 -0
  45. package/dist/fonts/lint.js +101 -16
  46. package/dist/fonts/lint.js.map +1 -1
  47. package/dist/fonts/walk.d.ts +13 -0
  48. package/dist/fonts/walk.js +50 -33
  49. package/dist/fonts/walk.js.map +1 -1
  50. package/dist/html/css.d.ts +4 -0
  51. package/dist/html/css.js +11 -3
  52. package/dist/html/css.js.map +1 -1
  53. package/dist/html/dom.d.ts +6 -1
  54. package/dist/html/dom.js +28 -6
  55. package/dist/html/dom.js.map +1 -1
  56. package/dist/html/generated.d.ts +17 -0
  57. package/dist/html/generated.js +21 -0
  58. package/dist/html/generated.js.map +1 -0
  59. package/dist/html/images.d.ts +18 -0
  60. package/dist/html/images.js +49 -2
  61. package/dist/html/images.js.map +1 -1
  62. package/dist/html/index.d.ts +1 -0
  63. package/dist/html/index.js +1 -0
  64. package/dist/html/index.js.map +1 -1
  65. package/dist/html/render.d.ts +5 -4
  66. package/dist/html/render.js +24 -6
  67. package/dist/html/render.js.map +1 -1
  68. package/dist/hyphenation/exceptions.d.ts +5 -0
  69. package/dist/hyphenation/exceptions.js +11 -0
  70. package/dist/hyphenation/exceptions.js.map +1 -1
  71. package/dist/hyphenation/index.d.ts +1 -1
  72. package/dist/hyphenation/index.js +1 -1
  73. package/dist/hyphenation/index.js.map +1 -1
  74. package/dist/import/convert.d.ts +21 -0
  75. package/dist/import/convert.js +65 -0
  76. package/dist/import/convert.js.map +1 -0
  77. package/dist/incremental/cache.d.ts +59 -0
  78. package/dist/incremental/cache.js +64 -0
  79. package/dist/incremental/cache.js.map +1 -0
  80. package/dist/incremental/index.d.ts +3 -0
  81. package/dist/incremental/index.js +4 -0
  82. package/dist/incremental/index.js.map +1 -0
  83. package/dist/incremental/keys.d.ts +27 -0
  84. package/dist/incremental/keys.js +89 -0
  85. package/dist/incremental/keys.js.map +1 -0
  86. package/dist/incremental/session.d.ts +180 -0
  87. package/dist/incremental/session.js +401 -0
  88. package/dist/incremental/session.js.map +1 -0
  89. package/dist/index.d.ts +6 -0
  90. package/dist/index.js +6 -0
  91. package/dist/index.js.map +1 -1
  92. package/dist/indexes/layout.d.ts +8 -2
  93. package/dist/indexes/layout.js +6 -4
  94. package/dist/indexes/layout.js.map +1 -1
  95. package/dist/layout/cache.d.ts +174 -0
  96. package/dist/layout/cache.js +150 -0
  97. package/dist/layout/cache.js.map +1 -0
  98. package/dist/layout/converge.d.ts +28 -0
  99. package/dist/layout/converge.js +102 -9
  100. package/dist/layout/converge.js.map +1 -1
  101. package/dist/layout/counters.d.ts +4 -0
  102. package/dist/layout/counters.js +15 -0
  103. package/dist/layout/counters.js.map +1 -1
  104. package/dist/layout/index.d.ts +5 -2
  105. package/dist/layout/index.js +3 -0
  106. package/dist/layout/index.js.map +1 -1
  107. package/dist/layout/lists.d.ts +52 -3
  108. package/dist/layout/lists.js +513 -46
  109. package/dist/layout/lists.js.map +1 -1
  110. package/dist/layout/lookahead.d.ts +151 -0
  111. package/dist/layout/lookahead.js +581 -0
  112. package/dist/layout/lookahead.js.map +1 -0
  113. package/dist/layout/margin-boxes.d.ts +11 -1
  114. package/dist/layout/margin-boxes.js +24 -1
  115. package/dist/layout/margin-boxes.js.map +1 -1
  116. package/dist/layout/page-rules.d.ts +6 -1
  117. package/dist/layout/page-rules.js +42 -1
  118. package/dist/layout/page-rules.js.map +1 -1
  119. package/dist/layout/page.js +4 -2
  120. package/dist/layout/page.js.map +1 -1
  121. package/dist/layout/pagebuilder.d.ts +248 -3
  122. package/dist/layout/pagebuilder.js +512 -19
  123. package/dist/layout/pagebuilder.js.map +1 -1
  124. package/dist/layout/pages.d.ts +108 -1
  125. package/dist/layout/pages.js +1362 -159
  126. package/dist/layout/pages.js.map +1 -1
  127. package/dist/layout/paragraph.d.ts +14 -0
  128. package/dist/layout/paragraph.js +304 -31
  129. package/dist/layout/paragraph.js.map +1 -1
  130. package/dist/layout/pre.js +4 -0
  131. package/dist/layout/pre.js.map +1 -1
  132. package/dist/layout/protrusion.d.ts +26 -0
  133. package/dist/layout/protrusion.js +39 -0
  134. package/dist/layout/protrusion.js.map +1 -0
  135. package/dist/layout/ranges.d.ts +2 -0
  136. package/dist/layout/ranges.js +22 -0
  137. package/dist/layout/ranges.js.map +1 -0
  138. package/dist/layout/region.d.ts +2 -1
  139. package/dist/layout/region.js +9 -5
  140. package/dist/layout/region.js.map +1 -1
  141. package/dist/layout/templates.d.ts +71 -0
  142. package/dist/layout/templates.js +290 -0
  143. package/dist/layout/templates.js.map +1 -0
  144. package/dist/layout/vlist.d.ts +3 -3
  145. package/dist/linebreak/items.d.ts +27 -2
  146. package/dist/linebreak/items.js +10 -3
  147. package/dist/linebreak/items.js.map +1 -1
  148. package/dist/linebreak/knuth-plass.d.ts +20 -0
  149. package/dist/linebreak/knuth-plass.js +68 -16
  150. package/dist/linebreak/knuth-plass.js.map +1 -1
  151. package/dist/lint/book.d.ts +13 -0
  152. package/dist/lint/book.js +52 -0
  153. package/dist/lint/book.js.map +1 -0
  154. package/dist/lint/config.d.ts +9 -0
  155. package/dist/lint/config.js +40 -6
  156. package/dist/lint/config.js.map +1 -1
  157. package/dist/lint/linter.js +1 -0
  158. package/dist/lint/linter.js.map +1 -1
  159. package/dist/lint/project.js +1 -1
  160. package/dist/lint/project.js.map +1 -1
  161. package/dist/lint/rules/layout.d.ts +3 -1
  162. package/dist/lint/rules/layout.js +8 -6
  163. package/dist/lint/rules/layout.js.map +1 -1
  164. package/dist/lint/rules/source.js +1 -1
  165. package/dist/lint/rules/source.js.map +1 -1
  166. package/dist/lint/testing.js +1 -0
  167. package/dist/lint/testing.js.map +1 -1
  168. package/dist/measure/bidi-data.d.ts +14 -0
  169. package/dist/measure/bidi-data.js +69 -0
  170. package/dist/measure/bidi-data.js.map +1 -0
  171. package/dist/measure/bidi.d.ts +70 -0
  172. package/dist/measure/bidi.js +225 -0
  173. package/dist/measure/bidi.js.map +1 -0
  174. package/dist/measure/css.d.ts +5 -0
  175. package/dist/measure/css.js +2 -0
  176. package/dist/measure/css.js.map +1 -1
  177. package/dist/measure/measurer.d.ts +36 -2
  178. package/dist/measure/measurer.js +220 -22
  179. package/dist/measure/measurer.js.map +1 -1
  180. package/dist/measure/model.d.ts +20 -2
  181. package/dist/measure/model.js +13 -6
  182. package/dist/measure/model.js.map +1 -1
  183. package/dist/measure/script-data.d.ts +6 -0
  184. package/dist/measure/script-data.js +34 -0
  185. package/dist/measure/script-data.js.map +1 -0
  186. package/dist/measure/scripts.d.ts +36 -0
  187. package/dist/measure/scripts.js +293 -0
  188. package/dist/measure/scripts.js.map +1 -0
  189. package/dist/output/output.d.ts +35 -3
  190. package/dist/output/output.js +26 -4
  191. package/dist/output/output.js.map +1 -1
  192. package/dist/paint/backgrounds.js +7 -20
  193. package/dist/paint/backgrounds.js.map +1 -1
  194. package/dist/paint/blend.d.ts +33 -13
  195. package/dist/paint/blend.js +73 -21
  196. package/dist/paint/blend.js.map +1 -1
  197. package/dist/paint/cache.d.ts +80 -0
  198. package/dist/paint/cache.js +537 -0
  199. package/dist/paint/cache.js.map +1 -0
  200. package/dist/paint/canvas.d.ts +4 -13
  201. package/dist/paint/canvas.js +45 -5
  202. package/dist/paint/canvas.js.map +1 -1
  203. package/dist/paint/context.d.ts +2 -0
  204. package/dist/paint/emphasis.js +1 -1
  205. package/dist/paint/emphasis.js.map +1 -1
  206. package/dist/paint/flatten.d.ts +24 -2
  207. package/dist/paint/flatten.js +55 -12
  208. package/dist/paint/flatten.js.map +1 -1
  209. package/dist/paint/forms.d.ts +64 -0
  210. package/dist/paint/forms.js +319 -0
  211. package/dist/paint/forms.js.map +1 -0
  212. package/dist/paint/images.d.ts +4 -1
  213. package/dist/paint/images.js +13 -2
  214. package/dist/paint/images.js.map +1 -1
  215. package/dist/paint/layers.d.ts +64 -0
  216. package/dist/paint/layers.js +137 -0
  217. package/dist/paint/layers.js.map +1 -0
  218. package/dist/paint/painter.d.ts +19 -6
  219. package/dist/paint/painter.js +15 -135
  220. package/dist/paint/painter.js.map +1 -1
  221. package/dist/paint/stacking.d.ts +1 -1
  222. package/dist/paint/stacking.js +9 -2
  223. package/dist/paint/stacking.js.map +1 -1
  224. package/dist/paint/text.d.ts +14 -3
  225. package/dist/paint/text.js +25 -4
  226. package/dist/paint/text.js.map +1 -1
  227. package/dist/paint/vertical.js +2 -2
  228. package/dist/paint/vertical.js.map +1 -1
  229. package/dist/pdf/encoded.d.ts +16 -0
  230. package/dist/pdf/encoded.js +35 -0
  231. package/dist/pdf/encoded.js.map +1 -0
  232. package/dist/pdf/include/colour.d.ts +105 -0
  233. package/dist/pdf/include/colour.js +349 -0
  234. package/dist/pdf/include/colour.js.map +1 -0
  235. package/dist/pdf/include/functions.d.ts +17 -0
  236. package/dist/pdf/include/functions.js +389 -0
  237. package/dist/pdf/include/functions.js.map +1 -0
  238. package/dist/pdf/include/pages.d.ts +14 -0
  239. package/dist/pdf/include/pages.js +27 -0
  240. package/dist/pdf/include/pages.js.map +1 -0
  241. package/dist/pdf/include/pdfjs/LICENSE +177 -0
  242. package/dist/pdf/include/pdfjs/pdf.min.mjs +27 -0
  243. package/dist/pdf/include/pdfjs/pdf.worker.min.mjs +27 -0
  244. package/dist/pdf/include/pdfjs/standard_fonts/FoxitDingbats.pfb +0 -0
  245. package/dist/pdf/include/pdfjs/standard_fonts/FoxitFixed.pfb +0 -0
  246. package/dist/pdf/include/pdfjs/standard_fonts/FoxitFixedBold.pfb +0 -0
  247. package/dist/pdf/include/pdfjs/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
  248. package/dist/pdf/include/pdfjs/standard_fonts/FoxitFixedItalic.pfb +0 -0
  249. package/dist/pdf/include/pdfjs/standard_fonts/FoxitSerif.pfb +0 -0
  250. package/dist/pdf/include/pdfjs/standard_fonts/FoxitSerifBold.pfb +0 -0
  251. package/dist/pdf/include/pdfjs/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
  252. package/dist/pdf/include/pdfjs/standard_fonts/FoxitSerifItalic.pfb +0 -0
  253. package/dist/pdf/include/pdfjs/standard_fonts/FoxitSymbol.pfb +0 -0
  254. package/dist/pdf/include/pdfjs/standard_fonts/LICENSE_FOXIT +27 -0
  255. package/dist/pdf/include/pdfjs/standard_fonts/LICENSE_LIBERATION +363 -0
  256. package/dist/pdf/include/pdfjs/standard_fonts/LiberationSans-Bold.ttf +0 -0
  257. package/dist/pdf/include/pdfjs/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
  258. package/dist/pdf/include/pdfjs/standard_fonts/LiberationSans-Italic.ttf +0 -0
  259. package/dist/pdf/include/pdfjs/standard_fonts/LiberationSans-Regular.ttf +0 -0
  260. package/dist/pdf/include/pdfjs/wasm/LICENSE_JBIG2 +196 -0
  261. package/dist/pdf/include/pdfjs/wasm/LICENSE_OPENJPEG +39 -0
  262. package/dist/pdf/include/pdfjs/wasm/LICENSE_PDFJS_JBIG2 +13 -0
  263. package/dist/pdf/include/pdfjs/wasm/LICENSE_PDFJS_OPENJPEG +22 -0
  264. package/dist/pdf/include/pdfjs/wasm/LICENSE_PDFJS_QCMS +19 -0
  265. package/dist/pdf/include/pdfjs/wasm/LICENSE_QCMS +21 -0
  266. package/dist/pdf/include/pdfjs/wasm/jbig2.wasm +0 -0
  267. package/dist/pdf/include/pdfjs/wasm/openjpeg.wasm +0 -0
  268. package/dist/pdf/include/pdfjs/wasm/qcms_bg.wasm +0 -0
  269. package/dist/pdf/include/pdfjs/wasm/quickjs-eval.wasm +0 -0
  270. package/dist/pdf/include/prepare.d.ts +58 -0
  271. package/dist/pdf/include/prepare.js +266 -0
  272. package/dist/pdf/include/prepare.js.map +1 -0
  273. package/dist/pdf/include/preview.d.ts +38 -0
  274. package/dist/pdf/include/preview.js +101 -0
  275. package/dist/pdf/include/preview.js.map +1 -0
  276. package/dist/pdf/include/rewrite.d.ts +57 -0
  277. package/dist/pdf/include/rewrite.js +803 -0
  278. package/dist/pdf/include/rewrite.js.map +1 -0
  279. package/dist/pdf/include/serialize.d.ts +32 -0
  280. package/dist/pdf/include/serialize.js +158 -0
  281. package/dist/pdf/include/serialize.js.map +1 -0
  282. package/dist/pdf/include/testing.d.ts +26 -0
  283. package/dist/pdf/include/testing.js +50 -0
  284. package/dist/pdf/include/testing.js.map +1 -0
  285. package/dist/pdf/index.d.ts +1 -0
  286. package/dist/pdf/index.js +1 -0
  287. package/dist/pdf/index.js.map +1 -1
  288. package/dist/pdf/structure/annotations.d.ts +33 -0
  289. package/dist/pdf/structure/annotations.js +112 -0
  290. package/dist/pdf/structure/annotations.js.map +1 -0
  291. package/dist/pdf/structure/forms.d.ts +10 -0
  292. package/dist/pdf/structure/forms.js +46 -0
  293. package/dist/pdf/structure/forms.js.map +1 -0
  294. package/dist/pdf/structure/index.d.ts +41 -5
  295. package/dist/pdf/structure/index.js +40 -5
  296. package/dist/pdf/structure/index.js.map +1 -1
  297. package/dist/pdf/structure/links.d.ts +2 -0
  298. package/dist/pdf/structure/links.js +1 -1
  299. package/dist/pdf/structure/links.js.map +1 -1
  300. package/dist/pdf/structure/presentation.d.ts +28 -0
  301. package/dist/pdf/structure/presentation.js +79 -0
  302. package/dist/pdf/structure/presentation.js.map +1 -0
  303. package/dist/pdf/structure/tags.d.ts +34 -2
  304. package/dist/pdf/structure/tags.js +117 -14
  305. package/dist/pdf/structure/tags.js.map +1 -1
  306. package/dist/pdf/types.d.ts +357 -11
  307. package/dist/pdf/wasm/pulpweaver4_pdf.d.ts +44 -2
  308. package/dist/pdf/wasm/pulpweaver4_pdf.js +191 -2
  309. package/dist/pdf/wasm/pulpweaver4_pdf_bg.wasm +0 -0
  310. package/dist/pdf/writer.d.ts +13 -1
  311. package/dist/pdf/writer.js +26 -1
  312. package/dist/pdf/writer.js.map +1 -1
  313. package/dist/plugin/define.d.ts +200 -15
  314. package/dist/plugin/define.js +124 -15
  315. package/dist/plugin/define.js.map +1 -1
  316. package/dist/plugin/failure.d.ts +1 -1
  317. package/dist/plugin/index.d.ts +5 -4
  318. package/dist/plugin/index.js +5 -4
  319. package/dist/plugin/index.js.map +1 -1
  320. package/dist/plugin/reference.d.ts +38 -0
  321. package/dist/plugin/reference.js +287 -0
  322. package/dist/plugin/reference.js.map +1 -0
  323. package/dist/plugin/register.d.ts +39 -7
  324. package/dist/plugin/register.js +83 -2
  325. package/dist/plugin/register.js.map +1 -1
  326. package/dist/preflight/index.d.ts +1 -1
  327. package/dist/preflight/index.js +1 -1
  328. package/dist/preflight/index.js.map +1 -1
  329. package/dist/preflight/pdfx.d.ts +35 -0
  330. package/dist/preflight/pdfx.js +33 -2
  331. package/dist/preflight/pdfx.js.map +1 -1
  332. package/dist/preflight/reader.d.ts +10 -3
  333. package/dist/preflight/reader.js +86 -5
  334. package/dist/preflight/reader.js.map +1 -1
  335. package/dist/print/impose.d.ts +66 -0
  336. package/dist/print/impose.js +331 -0
  337. package/dist/print/impose.js.map +1 -0
  338. package/dist/print/output.js +400 -50
  339. package/dist/print/output.js.map +1 -1
  340. package/dist/problem.js +4 -3
  341. package/dist/problem.js.map +1 -1
  342. package/dist/profile/index.d.ts +1 -0
  343. package/dist/profile/index.js +1 -0
  344. package/dist/profile/index.js.map +1 -1
  345. package/dist/profile/lint.d.ts +1 -1
  346. package/dist/profile/lint.js +29 -1
  347. package/dist/profile/lint.js.map +1 -1
  348. package/dist/profile/list-table.d.ts +51 -0
  349. package/dist/profile/list-table.js +137 -0
  350. package/dist/profile/list-table.js.map +1 -0
  351. package/dist/profile/metadata.js +3 -0
  352. package/dist/profile/metadata.js.map +1 -1
  353. package/dist/profile/profile.d.ts +3 -0
  354. package/dist/profile/profile.js +9 -1
  355. package/dist/profile/profile.js.map +1 -1
  356. package/dist/project.js +3 -0
  357. package/dist/project.js.map +1 -1
  358. package/dist/qpdf/index.d.ts +2 -0
  359. package/dist/qpdf/index.js +3 -0
  360. package/dist/qpdf/index.js.map +1 -0
  361. package/dist/qpdf/qpdf.d.ts +125 -0
  362. package/dist/qpdf/qpdf.js +205 -0
  363. package/dist/qpdf/qpdf.js.map +1 -0
  364. package/dist/qpdf/testing.d.ts +12 -0
  365. package/dist/qpdf/testing.js +9 -0
  366. package/dist/qpdf/testing.js.map +1 -0
  367. package/dist/qpdf/wasm/LICENSE-qpdf +202 -0
  368. package/dist/qpdf/wasm/LICENSE-zlib +22 -0
  369. package/dist/qpdf/wasm/NOTICE-qpdf.md +42 -0
  370. package/dist/qpdf/wasm/qpdf.wasm +0 -0
  371. package/dist/render/index.d.ts +3 -0
  372. package/dist/render/index.js +2 -0
  373. package/dist/render/index.js.map +1 -0
  374. package/dist/render/render.d.ts +98 -0
  375. package/dist/render/render.js +243 -0
  376. package/dist/render/render.js.map +1 -0
  377. package/dist/reproducible/clock.d.ts +4 -5
  378. package/dist/reproducible/clock.js +4 -5
  379. package/dist/reproducible/clock.js.map +1 -1
  380. package/dist/spike/spike-page.chromium.json +4 -4
  381. package/dist/style/colours.d.ts +7 -2
  382. package/dist/style/colours.js +24 -2
  383. package/dist/style/colours.js.map +1 -1
  384. package/dist/style/compile.js +1 -1
  385. package/dist/style/compile.js.map +1 -1
  386. package/dist/style/defaults.d.ts +9 -3
  387. package/dist/style/defaults.js +14 -2
  388. package/dist/style/defaults.js.map +1 -1
  389. package/dist/style/gcpm.d.ts +1 -1
  390. package/dist/style/gcpm.js +17 -5
  391. package/dist/style/gcpm.js.map +1 -1
  392. package/dist/style/properties.js +84 -0
  393. package/dist/style/properties.js.map +1 -1
  394. package/dist/test/book.d.ts +22 -2
  395. package/dist/test/book.js +35 -2
  396. package/dist/test/book.js.map +1 -1
  397. package/dist/test/build.d.ts +23 -0
  398. package/dist/test/build.js +86 -33
  399. package/dist/test/build.js.map +1 -1
  400. package/dist/test/layout.js +128 -19
  401. package/dist/test/layout.js.map +1 -1
  402. package/dist/test/limits.d.ts +8 -0
  403. package/dist/test/limits.js +9 -0
  404. package/dist/test/limits.js.map +1 -0
  405. package/dist/test/pipeline.d.ts +23 -0
  406. package/dist/test/pipeline.js.map +1 -1
  407. package/dist/test/render.d.ts +26 -3
  408. package/dist/test/render.js +151 -23
  409. package/dist/test/render.js.map +1 -1
  410. package/dist/test/runner.d.ts +6 -3
  411. package/dist/test/runner.js +172 -105
  412. package/dist/test/runner.js.map +1 -1
  413. package/dist/test/text.js +2 -2
  414. package/dist/test/text.js.map +1 -1
  415. package/dist/text/output.js +2 -2
  416. package/dist/text/output.js.map +1 -1
  417. package/dist/text/render.d.ts +4 -3
  418. package/dist/text/render.js +126 -4
  419. package/dist/text/render.js.map +1 -1
  420. package/dist/transform/index.d.ts +1 -1
  421. package/dist/transform/index.js +1 -1
  422. package/dist/transform/index.js.map +1 -1
  423. package/dist/transform/run.d.ts +2 -0
  424. package/dist/transform/run.js +32 -16
  425. package/dist/transform/run.js.map +1 -1
  426. package/dist/web/output.js +116 -10
  427. package/dist/web/output.js.map +1 -1
  428. package/dist/web/runtime/justify.js.txt +2 -2
  429. package/dist/web/site.d.ts +2 -0
  430. package/dist/web/site.js +8 -1
  431. package/dist/web/site.js.map +1 -1
  432. package/docs/README.md +6 -1
  433. package/docs/manual/chapters/front.dj +34 -0
  434. package/docs/manual/chapters/guides/citations.dj +426 -0
  435. package/docs/manual/chapters/guides/colour-and-prepress.dj +261 -0
  436. package/docs/manual/chapters/guides/editions.dj +329 -0
  437. package/docs/manual/chapters/guides/in-a-web-page.dj +143 -0
  438. package/docs/manual/chapters/guides/lines-and-pages.dj +681 -0
  439. package/docs/manual/chapters/guides/lint-rules.dj +355 -0
  440. package/docs/manual/chapters/guides/pdfs.dj +501 -0
  441. package/docs/manual/chapters/guides/plugins.dj +425 -0
  442. package/docs/manual/chapters/guides/testing.dj +264 -0
  443. package/docs/manual/chapters/guides/writing-in-djot.dj +537 -0
  444. package/docs/manual/chapters/start/for-latex-users.dj +256 -0
  445. package/docs/manual/chapters/start/getting-started.dj +167 -0
  446. package/docs/manual/chapters/start/your-first-book.dj +426 -0
  447. package/docs/manual/fonts/CrimsonPro-Italic-VF.ttf +0 -0
  448. package/docs/manual/fonts/CrimsonPro-VF.ttf +0 -0
  449. package/docs/manual/fonts/JetBrainsMono-Regular.otf +0 -0
  450. package/docs/manual/fonts/NotoSansSymbols2-Boxes.ttf +0 -0
  451. package/docs/manual/fonts/OFL.txt +95 -0
  452. package/docs/manual/pulpweaver4.toml +39 -0
  453. package/docs/manual/styles/manual.css +137 -0
  454. package/docs/reference/css-properties/index.md +9 -0
  455. package/docs/reference/css-properties/pw-expansion.md +31 -0
  456. package/docs/reference/css-properties/pw-flow-into.md +31 -0
  457. package/docs/reference/css-properties/pw-knockout.md +26 -0
  458. package/docs/reference/css-properties/pw-layer.md +24 -0
  459. package/docs/reference/css-properties/pw-page-breaking.md +30 -0
  460. package/docs/reference/css-properties/pw-page-duration.md +28 -0
  461. package/docs/reference/css-properties/pw-page-rotate.md +29 -0
  462. package/docs/reference/css-properties/pw-page-transition.md +29 -0
  463. package/docs/reference/css-properties/pw-protrusion.md +31 -0
  464. package/docs/reference/lint-rules/ibid-across-page.md +2 -2
  465. package/docs/reference/plugin-api/capabilities.md +2 -2
  466. package/docs/reference/plugin-api/claim-kind.md +1 -1
  467. package/docs/reference/plugin-api/combine-exceptions.md +19 -0
  468. package/docs/reference/plugin-api/element-break-context.md +34 -0
  469. package/docs/reference/plugin-api/element-break-item.md +24 -0
  470. package/docs/reference/plugin-api/element-breaker.md +24 -0
  471. package/docs/reference/plugin-api/flow-definition.md +30 -0
  472. package/docs/reference/plugin-api/generated-reference.md +32 -0
  473. package/docs/reference/plugin-api/index-definition.md +32 -0
  474. package/docs/reference/plugin-api/index-titles.md +18 -0
  475. package/docs/reference/plugin-api/index.md +27 -3
  476. package/docs/reference/plugin-api/insert-class-definition.md +46 -0
  477. package/docs/reference/plugin-api/insert-placement.md +22 -0
  478. package/docs/reference/plugin-api/insert-placements.md +18 -0
  479. package/docs/reference/plugin-api/layout-definition.md +9 -5
  480. package/docs/reference/plugin-api/layout-slot.md +6 -16
  481. package/docs/reference/plugin-api/lint-context.md +3 -1
  482. package/docs/reference/plugin-api/lint-definition.md +1 -1
  483. package/docs/reference/plugin-api/lint-edition.md +2 -0
  484. package/docs/reference/plugin-api/page-builder-event.md +22 -0
  485. package/docs/reference/plugin-api/page-builder-hook.md +7 -3
  486. package/docs/reference/plugin-api/page-builder-page-event.md +30 -0
  487. package/docs/reference/plugin-api/page-template-definition.md +34 -0
  488. package/docs/reference/plugin-api/page-template-region-definition.md +46 -0
  489. package/docs/reference/plugin-api/plugin-definition.md +5 -1
  490. package/docs/reference/plugin-api/plugin-reference-options.md +32 -0
  491. package/docs/reference/plugin-api/plugin-reference.md +22 -0
  492. package/docs/reference/plugin-api/plugin-registry.md +15 -5
  493. package/docs/reference/plugin-api/plugin-stage.md +1 -1
  494. package/docs/reference/plugin-api/plugin.md +9 -2
  495. package/docs/reference/plugin-api/reference-page.md +34 -0
  496. package/docs/reference/plugin-api/render-reference-page.md +18 -0
  497. package/docs/reference/plugin-api/renderers.md +1 -1
  498. package/docs/reference/pulpweaver4-toml/editions.md +239 -2
  499. package/docs/reference/pulpweaver4-toml/index.md +44 -1
  500. package/docs/reference/pulpweaver4-toml/inks.md +15 -4
  501. package/docs/reference/pulpweaver4-toml/lint.md +1 -1
  502. package/package.json +5 -1
@@ -1,5 +1,183 @@
1
1
  /* @ts-self-types="./pulpweaver4_pdf.d.ts" */
2
2
 
3
+ /**
4
+ * A JBIG2 or JPEG 2000 file's samples (`decodeImage`): 8 bits per
5
+ * component, interleaved, in `space` (`grey`, `rgb` or `cmyk`), with its
6
+ * opacity apart when it has one.
7
+ */
8
+ export class DecodedImage {
9
+ static __wrap(ptr) {
10
+ const obj = Object.create(DecodedImage.prototype);
11
+ obj.__wbg_ptr = ptr;
12
+ DecodedImageFinalization.register(obj, obj.__wbg_ptr, obj);
13
+ return obj;
14
+ }
15
+ __destroy_into_raw() {
16
+ const ptr = this.__wbg_ptr;
17
+ this.__wbg_ptr = 0;
18
+ DecodedImageFinalization.unregister(this);
19
+ return ptr;
20
+ }
21
+ free() {
22
+ const ptr = this.__destroy_into_raw();
23
+ wasm.__wbg_decodedimage_free(ptr, 0);
24
+ }
25
+ /**
26
+ * @returns {Uint8Array | undefined}
27
+ */
28
+ get alpha() {
29
+ try {
30
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
31
+ wasm.__wbg_get_decodedimage_alpha(retptr, this.__wbg_ptr);
32
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
33
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
34
+ let v1;
35
+ if (r0 !== 0) {
36
+ v1 = getArrayU8FromWasm0(r0, r1).slice();
37
+ wasm.__wbindgen_export2(r0, r1 * 1, 1);
38
+ }
39
+ return v1;
40
+ } finally {
41
+ wasm.__wbindgen_add_to_stack_pointer(16);
42
+ }
43
+ }
44
+ /**
45
+ * @returns {Uint8Array}
46
+ */
47
+ get data() {
48
+ try {
49
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
50
+ wasm.__wbg_get_decodedimage_data(retptr, this.__wbg_ptr);
51
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
52
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
53
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
54
+ wasm.__wbindgen_export2(r0, r1 * 1, 1);
55
+ return v1;
56
+ } finally {
57
+ wasm.__wbindgen_add_to_stack_pointer(16);
58
+ }
59
+ }
60
+ /**
61
+ * @returns {number}
62
+ */
63
+ get height() {
64
+ const ret = wasm.__wbg_get_decodedimage_height(this.__wbg_ptr);
65
+ return ret >>> 0;
66
+ }
67
+ /**
68
+ * @returns {string}
69
+ */
70
+ get space() {
71
+ let deferred1_0;
72
+ let deferred1_1;
73
+ try {
74
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
75
+ wasm.__wbg_get_decodedimage_space(retptr, this.__wbg_ptr);
76
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
77
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
78
+ deferred1_0 = r0;
79
+ deferred1_1 = r1;
80
+ return getStringFromWasm0(r0, r1);
81
+ } finally {
82
+ wasm.__wbindgen_add_to_stack_pointer(16);
83
+ wasm.__wbindgen_export2(deferred1_0, deferred1_1, 1);
84
+ }
85
+ }
86
+ /**
87
+ * @returns {number}
88
+ */
89
+ get width() {
90
+ const ret = wasm.__wbg_get_decodedimage_width(this.__wbg_ptr);
91
+ return ret >>> 0;
92
+ }
93
+ /**
94
+ * @param {Uint8Array | null} [arg0]
95
+ */
96
+ set alpha(arg0) {
97
+ var ptr0 = isLikeNone(arg0) ? 0 : passArray8ToWasm0(arg0, wasm.__wbindgen_export);
98
+ var len0 = WASM_VECTOR_LEN;
99
+ wasm.__wbg_set_decodedimage_alpha(this.__wbg_ptr, ptr0, len0);
100
+ }
101
+ /**
102
+ * @param {Uint8Array} arg0
103
+ */
104
+ set data(arg0) {
105
+ const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_export);
106
+ const len0 = WASM_VECTOR_LEN;
107
+ wasm.__wbg_set_decodedimage_data(this.__wbg_ptr, ptr0, len0);
108
+ }
109
+ /**
110
+ * @param {number} arg0
111
+ */
112
+ set height(arg0) {
113
+ wasm.__wbg_set_decodedimage_height(this.__wbg_ptr, arg0);
114
+ }
115
+ /**
116
+ * @param {string} arg0
117
+ */
118
+ set space(arg0) {
119
+ const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_export, wasm.__wbindgen_export3);
120
+ const len0 = WASM_VECTOR_LEN;
121
+ wasm.__wbg_set_decodedimage_space(this.__wbg_ptr, ptr0, len0);
122
+ }
123
+ /**
124
+ * @param {number} arg0
125
+ */
126
+ set width(arg0) {
127
+ wasm.__wbg_set_decodedimage_width(this.__wbg_ptr, arg0);
128
+ }
129
+ }
130
+ if (Symbol.dispose) DecodedImage.prototype[Symbol.dispose] = DecodedImage.prototype.free;
131
+
132
+ /**
133
+ * Decodes a JBIG2 or JPEG 2000 file, with the decoders the writer uses
134
+ * where a standard refuses the file as it is.
135
+ * @param {Uint8Array} data
136
+ * @returns {DecodedImage}
137
+ */
138
+ export function decodeImage(data) {
139
+ try {
140
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
141
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_export);
142
+ const len0 = WASM_VECTOR_LEN;
143
+ wasm.decodeImage(retptr, ptr0, len0);
144
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
145
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
146
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
147
+ if (r2) {
148
+ throw takeObject(r1);
149
+ }
150
+ return DecodedImage.__wrap(r0);
151
+ } finally {
152
+ wasm.__wbindgen_add_to_stack_pointer(16);
153
+ }
154
+ }
155
+
156
+ /**
157
+ * Which format the browser can't decode a file is in: `jbig2`, `jpx`, or
158
+ * none for anything else.
159
+ * @param {Uint8Array} data
160
+ * @returns {string | undefined}
161
+ */
162
+ export function encodedImageKind(data) {
163
+ try {
164
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
165
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_export);
166
+ const len0 = WASM_VECTOR_LEN;
167
+ wasm.encodedImageKind(retptr, ptr0, len0);
168
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
169
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
170
+ let v2;
171
+ if (r0 !== 0) {
172
+ v2 = getStringFromWasm0(r0, r1);
173
+ wasm.__wbindgen_export2(r0, r1 * 1, 1);
174
+ }
175
+ return v2;
176
+ } finally {
177
+ wasm.__wbindgen_add_to_stack_pointer(16);
178
+ }
179
+ }
180
+
3
181
  /**
4
182
  * Writes a PDF. `document` is the JSON of a `model::Document`; its blobs
5
183
  * (fonts, images, ICC profiles) are `blobs[offsets[i]..offsets[i + 1]]`.
@@ -11,7 +189,7 @@
11
189
  export function writePdf(document, blobs, offsets) {
12
190
  try {
13
191
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
14
- const ptr0 = passStringToWasm0(document, wasm.__wbindgen_export, wasm.__wbindgen_export2);
192
+ const ptr0 = passStringToWasm0(document, wasm.__wbindgen_export, wasm.__wbindgen_export3);
15
193
  const len0 = WASM_VECTOR_LEN;
16
194
  const ptr1 = passArray8ToWasm0(blobs, wasm.__wbindgen_export);
17
195
  const len1 = WASM_VECTOR_LEN;
@@ -26,7 +204,7 @@ export function writePdf(document, blobs, offsets) {
26
204
  throw takeObject(r2);
27
205
  }
28
206
  var v4 = getArrayU8FromWasm0(r0, r1).slice();
29
- wasm.__wbindgen_export3(r0, r1 * 1, 1);
207
+ wasm.__wbindgen_export2(r0, r1 * 1, 1);
30
208
  return v4;
31
209
  } finally {
32
210
  wasm.__wbindgen_add_to_stack_pointer(16);
@@ -39,6 +217,9 @@ function __wbg_get_imports() {
39
217
  const ret = Error(getStringFromWasm0(arg0, arg1));
40
218
  return addHeapObject(ret);
41
219
  },
220
+ __wbg___wbindgen_throw_bb96b2010945f0bc: function(arg0, arg1) {
221
+ throw new Error(getStringFromWasm0(arg0, arg1));
222
+ },
42
223
  };
43
224
  return {
44
225
  __proto__: null,
@@ -46,6 +227,10 @@ function __wbg_get_imports() {
46
227
  };
47
228
  }
48
229
 
230
+ const DecodedImageFinalization = (typeof FinalizationRegistry === 'undefined')
231
+ ? { register: () => {}, unregister: () => {} }
232
+ : new FinalizationRegistry(ptr => wasm.__wbg_decodedimage_free(ptr, 1));
233
+
49
234
  function addHeapObject(obj) {
50
235
  if (heap_next === heap.length) heap.push(heap.length + 1);
51
236
  const idx = heap_next;
@@ -101,6 +286,10 @@ heap.push(undefined, null, true, false);
101
286
 
102
287
  let heap_next = heap.length;
103
288
 
289
+ function isLikeNone(x) {
290
+ return x === undefined || x === null;
291
+ }
292
+
104
293
  function passArray32ToWasm0(arg, malloc) {
105
294
  const ptr = malloc(arg.length * 4, 4) >>> 0;
106
295
  getUint32ArrayMemory0().set(arg, ptr / 4);
@@ -4,7 +4,7 @@
4
4
  * document gives the same bytes wherever it is written.
5
5
  */
6
6
  import { type InitInput } from './wasm/pulpweaver4_pdf.js';
7
- import type { PdfDocument } from './types.js';
7
+ import type { PdfDocument, PdfPixels } from './types.js';
8
8
  /**
9
9
  * Where the writer's WebAssembly sits beside this module. Vite and esbuild
10
10
  * leave `new URL(…, import.meta.url)` pointing at it; a Node host reads the
@@ -39,3 +39,15 @@ export declare class PdfRefusedError extends Error {
39
39
  * an `Error` saying what krilla couldn't write.
40
40
  */
41
41
  export declare function writePdf(doc: PdfDocument): Uint8Array;
42
+ /**
43
+ * Which format a file is in that the browser can't decode and the writer
44
+ * can: `jbig2` or `jpx` (JPEG 2000), or undefined for any other. Loads the
45
+ * writer from its default URL if it isn't loaded.
46
+ */
47
+ export declare function encodedImageKind(data: Uint8Array): Promise<'jbig2' | 'jpx' | undefined>;
48
+ /**
49
+ * A JBIG2 or JPEG 2000 file's samples, decoded as the writer decodes one a
50
+ * standard refuses: for the screen's stand-in and a CMYK edition's
51
+ * conversion. JBIG2 is grey, black 0.
52
+ */
53
+ export declare function decodeImage(data: Uint8Array): Promise<PdfPixels>;
@@ -3,7 +3,7 @@
3
3
  * one call. The same module runs in every browser and in Node, so a
4
4
  * document gives the same bytes wherever it is written.
5
5
  */
6
- import init, { writePdf as write } from './wasm/pulpweaver4_pdf.js';
6
+ import init, { decodeImage as decode, encodedImageKind as kind, writePdf as write } from './wasm/pulpweaver4_pdf.js';
7
7
  /**
8
8
  * Where the writer's WebAssembly sits beside this module. Vite and esbuild
9
9
  * leave `new URL(…, import.meta.url)` pointing at it; a Node host reads the
@@ -75,4 +75,29 @@ export function writePdf(doc) {
75
75
  throw e;
76
76
  }
77
77
  }
78
+ /**
79
+ * Which format a file is in that the browser can't decode and the writer
80
+ * can: `jbig2` or `jpx` (JPEG 2000), or undefined for any other. Loads the
81
+ * writer from its default URL if it isn't loaded.
82
+ */
83
+ export async function encodedImageKind(data) {
84
+ await initPdfWriter();
85
+ return kind(data);
86
+ }
87
+ /**
88
+ * A JBIG2 or JPEG 2000 file's samples, decoded as the writer decodes one a
89
+ * standard refuses: for the screen's stand-in and a CMYK edition's
90
+ * conversion. JBIG2 is grey, black 0.
91
+ */
92
+ export async function decodeImage(data) {
93
+ await initPdfWriter();
94
+ const d = decode(data);
95
+ try {
96
+ const alpha = d.alpha;
97
+ return { width: d.width, height: d.height, colourSpace: d.space, data: d.data, ...(alpha ? { alpha } : {}) };
98
+ }
99
+ finally {
100
+ d.free();
101
+ }
102
+ }
78
103
  //# sourceMappingURL=writer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"writer.js","sourceRoot":"","sources":["../../src/pdf/writer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,IAAI,EAAE,EAAkB,QAAQ,IAAI,KAAK,EAAE,MAAM,2BAA2B,CAAA;AAGnF;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAQ,IAAI,GAAG,CAAC,gCAAgC,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAA;AAElG,IAAI,KAAgC,CAAA;AACpC,IAAI,MAAM,GAAG,KAAK,CAAA;AAElB;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,MAAM,GAAmC,mBAAmB;IACxF,KAAK,KAAK,IAAI,CAAC,EAAE,cAAc,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,CAC7C,GAAG,EAAE;QACH,MAAM,GAAG,IAAI,CAAA;IACf,CAAC,EACD,CAAC,CAAU,EAAE,EAAE;QACb,KAAK,GAAG,SAAS,CAAA;QACjB,MAAM,CAAC,CAAA;IACT,CAAC,CACF,CAAA;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAYD,mGAAmG;AACnG,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACnB,QAAQ;IAA7B,YAAqB,QAAsB;QACzC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE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,CAAC,CAAC,KAAK,CAAA;QACrB,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC,KAAiC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAA;IAC1I,CAAC;YAAS,CAAC;QACT,CAAC,CAAC,IAAI,EAAE,CAAA;IACV,CAAC;AACH,CAAC"}
@@ -34,17 +34,24 @@
34
34
  import type { RawMatcherFn } from '@vitest/expect';
35
35
  import type { Document, PluginBlock, PluginInline } from '../ast/nodes.js';
36
36
  import type { HtmlRenderer, RendererDefinition } from '../html/registry.js';
37
+ import type { Hyphenator } from '../hyphenation/hyphenator.js';
38
+ import type { FontRegistry } from '../layout/fonts.js';
39
+ import type { LaidPage } from '../layout/pages.js';
37
40
  import type { Position } from '../ast/position.js';
41
+ import type { GlueOrder } from '../linebreak/items.js';
38
42
  import type { breakLines } from '../linebreak/knuth-plass.js';
43
+ import type { PageResolver } from '../layout/converge.js';
39
44
  import type { Bibliography } from '../bibliography/item.js';
45
+ import type { HyphenationException } from '../hyphenation/exceptions.js';
40
46
  import type { Schema } from '../config/schema.js';
41
47
  import type { OutputContext, OutputResult } from '../output/output.js';
48
+ import type { Renderers } from './register.js';
42
49
  import type { AstView, Pages, Target } from '../test/book.js';
43
50
  import { type Transform, type TransformDefinition } from '../transform/transform.js';
44
51
  import type { VFS } from '../vfs/vfs.js';
45
52
  /** The plugin API version this core speaks. A plugin states it as `api: 1`. */
46
53
  export declare const PLUGIN_API = 1;
47
- /** What a plugin may ask for besides the project's files, for running untrusted plugins later in a worker. */
54
+ /** What a plugin may ask for besides the project's files. The app's worker grants `fs` and `net` only when a plugin lists them. */
48
55
  export declare const CAPABILITIES: readonly ['fs', 'net'];
49
56
  /** A capability a plugin `needs`: `fs`, files beyond the project's, or `net`, the network. */
50
57
  export type Capability = (typeof CAPABILITIES)[number];
@@ -101,6 +108,15 @@ export interface PluginDefinition {
101
108
  readonly assets?: Readonly<Record<string, AssetProcessor>>;
102
109
  /** `pw <command>`s, by name. */
103
110
  readonly commands?: Readonly<Record<string, CommandDefinition>>;
111
+ /** Indexes it makes, by name (`scripture`): what a `::: index {name=…}` block heads it with, and how a test names its entries. */
112
+ readonly indexes?: Readonly<Record<string, IndexDefinition>>;
113
+ /**
114
+ * Hyphenation exceptions, as the project's `hyphenation.txt` writes them:
115
+ * a word with a hyphen wherever it may break (`Mel-chiz-e-dek`), for every
116
+ * language, or `{ word, lang }` for one language and those under it. The
117
+ * project's own file has the last word on any word it lists.
118
+ */
119
+ readonly hyphenation?: readonly (string | HyphenationException)[];
104
120
  }
105
121
  /** A plugin, checked and in one shape: what `definePlugin` returns and the registry reads. */
106
122
  export interface Plugin {
@@ -136,7 +152,10 @@ export interface Plugin {
136
152
  readonly languages: Readonly<Record<string, LineBreaker>>;
137
153
  readonly elements: Readonly<Record<string, LineBreaker>>;
138
154
  };
155
+ /** Element breakers, by selector: each replaces the element's own list. */
156
+ readonly elementBreakers: Readonly<Record<string, ElementBreaker>>;
139
157
  readonly pageBuilder?: PageBuilderHook;
158
+ readonly resolvers: readonly PageResolver[];
140
159
  };
141
160
  /** Its outputs, by the name an edition's `output` gives. */
142
161
  readonly output: Readonly<Record<string, OutputDefinition>>;
@@ -151,6 +170,10 @@ export interface Plugin {
151
170
  readonly assets: Readonly<Record<string, AssetProcessor>>;
152
171
  /** Its `pw` commands, by name. */
153
172
  readonly commands: Readonly<Record<string, CommandDefinition>>;
173
+ /** The indexes it makes, by name. */
174
+ readonly indexes: Readonly<Record<string, IndexDefinition>>;
175
+ /** Its hyphenation exceptions, each with its language if it is for one. */
176
+ readonly hyphenation: readonly HyphenationException[];
154
177
  }
155
178
  /** Parses one source file of the plugin's format into a document, with a position on every node. */
156
179
  export type Reader = (source: string, ctx: ReadContext) => Document | Promise<Document>;
@@ -228,18 +251,129 @@ export interface PenaltyRule {
228
251
  }
229
252
  /** Breaks lines for an element or a language (CJK, ragged right), as the core's Knuth–Plass breaker does. */
230
253
  export type LineBreaker = typeof breakLines;
231
- /** An insert class, a page template or a flow: their shapes are the page builder's (#23). */
232
- export interface LayoutSlot {
254
+ /**
255
+ * What an element breaker is told: the element's measure, the edition's
256
+ * fonts (and their HarfBuzz measurer, `fonts.measurer`) and, when the build
257
+ * has one, its hyphenator.
258
+ */
259
+ export interface ElementBreakContext {
260
+ /** The element the plugin claimed. */
261
+ readonly element: HTMLElement;
262
+ /** Its content-box width, in px: the measure its lines are set to. */
263
+ readonly measure: number;
264
+ /** The edition's fonts. `fonts.measurer` shapes text in them. */
265
+ readonly fonts: FontRegistry;
266
+ /** The edition's hyphenator, when the build has one (`Hyphenator.points`). */
267
+ readonly hyphenator?: Hyphenator;
268
+ }
269
+ /**
270
+ * One item of the vertical list an element breaker hands the page builder,
271
+ * as a paragraph's lines do: a box (one line, already in the element), glue,
272
+ * or a penalty. A penalty of 10000 or more keeps the boxes on either side
273
+ * on one page; a smaller one is a place the page may break.
274
+ */
275
+ export type ElementBreakItem = {
276
+ readonly type: 'box';
277
+ readonly element: HTMLElement;
278
+ } | {
279
+ readonly type: 'glue';
280
+ readonly width: number;
281
+ readonly stretch?: number;
282
+ readonly shrink?: number;
283
+ readonly stretchOrder?: GlueOrder;
284
+ } | {
285
+ readonly type: 'penalty';
286
+ readonly penalty: number;
287
+ };
288
+ /**
289
+ * Breaks a claimed element into the vertical list the page builder consumes.
290
+ * The list replaces the element's own layout. A box's element is the claimed
291
+ * element or a descendant of it, so the page can place it.
292
+ */
293
+ export type ElementBreaker = (ctx: ElementBreakContext) => readonly ElementBreakItem[];
294
+ /** Where on a page a plugin's insert class (`float: <name>`) places its material. */
295
+ export declare const INSERT_PLACEMENTS: readonly ['top', 'bottom', 'margin-left', 'margin-right', 'margin-outer', 'margin-inner'];
296
+ /** Placement region for a plugin's insert class: top, bottom, or a page margin. */
297
+ export type InsertPlacement = (typeof INSERT_PLACEMENTS)[number];
298
+ /** A plugin's insert class (`float: <name>`): TeX's insert registers and the region on the page where it is placed. */
299
+ export interface InsertClassDefinition {
300
+ /** What it is, for the docs and messages. */
301
+ readonly description?: string;
302
+ /** Where on the page its material goes: default `'margin-outer'`. */
303
+ readonly region?: InsertPlacement;
304
+ /** Width of a margin region (`margin-*`), as a CSS length (`1.5in`, `100px`); defaults to the margin less `gap`. */
305
+ readonly width?: string;
306
+ /** Gap between a margin region and the text area, as a CSS length (`12pt`); defaults to `12pt`. */
307
+ readonly gap?: string;
308
+ /** Space above the class's material when a page has one (TeX's `\skip`), as glue (`12pt plus 4pt minus 4pt`). */
309
+ readonly skip?: string;
310
+ /** The most of the class one page holds (TeX's `\dimen`), as a CSS length; defaults to the page's text height. */
311
+ readonly maxHeight?: string;
312
+ /** Penalty per insert held over after a split (TeX's `\floatingpenalty`): an integer, default `0`. */
313
+ readonly floatingPenalty?: number;
314
+ /** Space above a split insert's remainder (TeX's `\splittopskip`), as glue; default `0px`. */
315
+ readonly splitTopSkip?: string;
316
+ /** Deepest a split insert's last box may be (TeX's `\splitmaxdepth`), as a CSS length; default `0px`. */
317
+ readonly splitMaxDepth?: string;
318
+ }
319
+ /** One region of a plugin's page template (`@region <name>`). */
320
+ export interface PageTemplateRegionDefinition {
321
+ /** The region's name (`@region <name>`), lowercase letters, digits and hyphens. */
322
+ readonly name: string;
323
+ /** Flow feeding this region (`main` if omitted). */
324
+ readonly flow?: string;
325
+ /** Distance from the top of the page's text area, as a CSS length, percentage or `calc()`. */
326
+ readonly top?: string;
327
+ /** Distance from the right of the page's text area, as a CSS length, percentage or `calc()`. */
328
+ readonly right?: string;
329
+ /** Distance from the bottom of the page's text area, as a CSS length, percentage or `calc()`. */
330
+ readonly bottom?: string;
331
+ /** Distance from the left of the page's text area, as a CSS length, percentage or `calc()`. */
332
+ readonly left?: string;
333
+ /** Region width, as a CSS length, percentage or `calc()`. */
334
+ readonly width?: string;
335
+ /** Region height, as a CSS length, percentage or `calc()`. */
336
+ readonly height?: string;
337
+ /** Number of balanced or auto-filled columns inside this region. */
338
+ readonly columns?: number;
339
+ /** Gap between columns inside this region, as a CSS length. */
340
+ readonly columnGap?: string;
341
+ /** Whether the last page of columns in this region balances (`'balance'`, default) or fills sequentially (`'auto'`). */
342
+ readonly columnFill?: 'balance' | 'auto';
343
+ }
344
+ /** A plugin's page template: an `@page` selector and the regions dividing its text area. */
345
+ export interface PageTemplateDefinition {
346
+ /** What it is, for the docs and messages. */
347
+ readonly description?: string;
348
+ /** The `@page` selector it applies to (`''` for all pages, `':left'`, `'split'`); defaults to the template's name. */
349
+ readonly selector?: string;
350
+ /** The regions dividing the page's text area. */
351
+ readonly regions?: readonly PageTemplateRegionDefinition[];
352
+ }
353
+ /** A plugin's named flow: content moved out of the main text into its own `PageBuilder` stream. */
354
+ export interface FlowDefinition {
233
355
  /** What it is, for the docs and messages. */
234
356
  readonly description?: string;
235
- /** The rest of its definition, in the page builder's shape. */
236
- readonly [key: string]: unknown;
357
+ /** CSS selector of elements automatically directed into this flow (in addition to `flow-into: <name>`). */
358
+ readonly selector?: string;
359
+ /** Move matching elements (`element`, default) or only their children (`content`). */
360
+ readonly mode?: 'element' | 'content';
361
+ }
362
+ /** An insert class, a page template or a flow slot in `layout`. */
363
+ export type LayoutSlot = InsertClassDefinition | PageTemplateDefinition | FlowDefinition;
364
+ /** Event fired after each page is laid out, in read-only order so hook order cannot affect layout. */
365
+ export interface PageBuilderPageEvent {
366
+ /** Event kind: `'page'`, fired after a page is finalized. */
367
+ readonly type: 'page';
368
+ /** The page just laid out. */
369
+ readonly page: LaidPage;
370
+ /** Every page laid out so far, ending with `page`. */
371
+ readonly pages: readonly LaidPage[];
237
372
  }
238
- /** Called by the page builder at its events (sidenotes); its shape is the page builder's (#23). */
239
- export type PageBuilderHook = (event: {
240
- readonly type: string;
241
- readonly [key: string]: unknown;
242
- }, ctx: {
373
+ /** An event observed by a plugin's `layout.pageBuilder` hook. */
374
+ export type PageBuilderEvent = PageBuilderPageEvent;
375
+ /** Called by the page builder after each page is laid out (read-only observation). */
376
+ export type PageBuilderHook = (event: PageBuilderEvent, ctx: {
243
377
  readonly plugin: string;
244
378
  }) => void;
245
379
  /** A plugin's layout stage: what it tells the line and page breakers. */
@@ -249,18 +383,33 @@ export interface LayoutDefinition {
249
383
  /** Selectors of elements laid out as one box, never broken. These add up across plugins. */
250
384
  readonly boxes?: readonly string[];
251
385
  /** Insert classes (`float: <name>`), by name. */
252
- readonly inserts?: Readonly<Record<string, LayoutSlot>>;
386
+ readonly inserts?: Readonly<Record<string, InsertClassDefinition>>;
253
387
  /** Line breakers, by language tag (`ja`) or by selector. */
254
388
  readonly lineBreakers?: {
255
389
  readonly languages?: Readonly<Record<string, LineBreaker>>;
256
390
  readonly elements?: Readonly<Record<string, LineBreaker>>;
257
391
  };
392
+ /**
393
+ * Element breakers, by CSS selector. The one that claims an element breaks
394
+ * it into boxes, glue and penalties for the page builder, as the paragraph
395
+ * builder does for text. One selector has one owner.
396
+ */
397
+ readonly elementBreakers?: Readonly<Record<string, ElementBreaker>>;
258
398
  /** Page templates, by name: a page's regions and what flows into them. */
259
- readonly pageTemplates?: Readonly<Record<string, LayoutSlot>>;
399
+ readonly pageTemplates?: Readonly<Record<string, PageTemplateDefinition>>;
260
400
  /** Flows, by name: content set apart from the main text, such as a parallel translation. */
261
- readonly flows?: Readonly<Record<string, LayoutSlot>>;
262
- /** Called by the page builder at its events, such as for sidenotes. */
401
+ readonly flows?: Readonly<Record<string, FlowDefinition>>;
402
+ /** Called by the page builder after each page is laid out. */
263
403
  readonly pageBuilder?: PageBuilderHook;
404
+ /**
405
+ * What it fills in from the pages, in a print edition's converging layout:
406
+ * each is given the pages just laid out and the book's HTML, changes the
407
+ * HTML, and returns the elements it changed (none once they have
408
+ * settled), as the core's page references and indexes do. A link it adds
409
+ * (`a[href]`) is keyed after its nearest keyed ancestor, so a tagged PDF
410
+ * has it as a `Link` (#181).
411
+ */
412
+ readonly resolvers?: readonly PageResolver[];
264
413
  }
265
414
  /** An output a plugin writes, by the name an edition's `output` gives: the core's `Output`, less its name. */
266
415
  export interface OutputDefinition {
@@ -298,6 +447,23 @@ export interface CommandDefinition {
298
447
  /** Runs it; the result is the exit status (0 if none). */
299
448
  run(args: readonly string[], ctx: CommandContext): number | void | Promise<number | void>;
300
449
  }
450
+ /**
451
+ * An index a plugin makes, by putting `indexTerm`s with its name in the
452
+ * manuscript (`scripture`): the plugin owns the name, and says how the book
453
+ * and its tests refer to it.
454
+ */
455
+ export interface IndexDefinition {
456
+ /** What it indexes, for the docs and messages. */
457
+ readonly description?: string;
458
+ /** Its heading, where a `::: index` block places it with no `title` of its own and opens no section: `Scripture index`. */
459
+ readonly title?: string;
460
+ /**
461
+ * The term of the entry a test names as written (`1Ti 5:18` for
462
+ * `1 Timothy!5:18`), for `book.index(name).entry(…)`; undefined for one it
463
+ * can't read. An entry is found by its own term first.
464
+ */
465
+ lookup?(written: string): string | undefined;
466
+ }
301
467
  /**
302
468
  * What a lint rule reads: `source`, the AST and the sources, in every
303
469
  * edition and in `pw lint`; `html`, the rendered HTML; `layout`, the laid-out
@@ -324,6 +490,12 @@ export interface LintContext {
324
490
  readonly sources?: ReadonlyMap<string, string>;
325
491
  /** The project's bibliographies, read, for rules about citations. */
326
492
  readonly bibliographies?: readonly Bibliography[];
493
+ /**
494
+ * The plugins' renderers for their blocks and inlines in every format, by
495
+ * name, as an output is given them: for rules about what an edition can
496
+ * render, such as a node with no reStructuredText rendering.
497
+ */
498
+ readonly formatRenderers?: ReadonlyMap<string, Renderers>;
327
499
  /** The source position of a node, an element or a text of the HTML or the pages. */
328
500
  locate?(at: Target | Text): Position | undefined;
329
501
  /**
@@ -350,6 +522,11 @@ export interface LintEdition {
350
522
  readonly pdfStandards?: readonly string[];
351
523
  /** How its pages are imposed, if they are. */
352
524
  readonly impose?: 'booklet';
525
+ /** Its citations' style (`citation-style`, its own or the book's; absent for the default) and what an ibid may not point across in print (`citation-ibid`). */
526
+ readonly citations?: {
527
+ readonly style?: string;
528
+ readonly ibid: 'page' | 'spread';
529
+ };
353
530
  }
354
531
  /** A change to a source file: the text a position covers, replaced. */
355
532
  export interface TextEdit {
@@ -403,7 +580,15 @@ export interface LintPreset {
403
580
  export interface LintDefinition {
404
581
  /** Its rules. */
405
582
  readonly rules?: readonly LintRule[];
406
- /** By name, `<name>` or `<plugin>/<name>`. */
583
+ /**
584
+ * By name, `<name>` or `<plugin>/<name>`. One named `recommended` comes with
585
+ * the core's `recommended`: a project or edition whose presets reach that
586
+ * extends `<plugin>/recommended` too, without naming it, so put there the
587
+ * rules every project using the plugin wants. It has no order among the
588
+ * presets it joins, so it must set any rule a core preset sets as that one
589
+ * does (or the build reports `lint-preset-conflict`), and a project's own
590
+ * `rules` still decide over it.
591
+ */
407
592
  readonly presets?: Readonly<Record<string, LintPreset>>;
408
593
  }
409
594
  /** A plugin that can't be defined: a wrong `api`, a malformed stage, a bad name. */