pulpweaver4 0.0.88 → 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.
- package/dist/ast/djot.d.ts +2 -1
- package/dist/ast/djot.js +31 -2
- package/dist/ast/djot.js.map +1 -1
- package/dist/ast/index.d.ts +1 -0
- package/dist/ast/index.js +1 -0
- package/dist/ast/index.js.map +1 -1
- package/dist/ast/nodes.d.ts +72 -9
- package/dist/ast/nodes.js +8 -0
- package/dist/ast/nodes.js.map +1 -1
- package/dist/ast/table.d.ts +27 -0
- package/dist/ast/table.js +32 -0
- package/dist/ast/table.js.map +1 -0
- package/dist/browser.js +2420 -0
- package/dist/citations/book.d.ts +2 -0
- package/dist/citations/book.js +17 -6
- package/dist/citations/book.js.map +1 -1
- package/dist/citations/collect.d.ts +5 -1
- package/dist/citations/collect.js +5 -1
- package/dist/citations/collect.js.map +1 -1
- package/dist/citations/index.d.ts +1 -1
- package/dist/citations/index.js +1 -1
- package/dist/citations/index.js.map +1 -1
- package/dist/citations/notes.js +54 -11
- package/dist/citations/notes.js.map +1 -1
- package/dist/citations/positions.js +4 -4
- package/dist/citations/positions.js.map +1 -1
- package/dist/citations/project.d.ts +12 -2
- package/dist/citations/project.js +21 -7
- package/dist/citations/project.js.map +1 -1
- package/dist/colour/images.d.ts +11 -2
- package/dist/colour/images.js +53 -3
- package/dist/colour/images.js.map +1 -1
- package/dist/colour/ink-limit.d.ts +2 -2
- package/dist/colour/ink-limit.js +6 -0
- package/dist/colour/ink-limit.js.map +1 -1
- package/dist/colour/intents.d.ts +10 -0
- package/dist/colour/intents.js +10 -0
- package/dist/colour/intents.js.map +1 -1
- package/dist/colour/previews.d.ts +8 -4
- package/dist/colour/previews.js +11 -8
- package/dist/colour/previews.js.map +1 -1
- package/dist/config/config.d.ts +99 -6
- package/dist/config/config.js +217 -6
- package/dist/config/config.js.map +1 -1
- package/dist/config/project-schema.d.ts +0 -8
- package/dist/config/project-schema.js +221 -12
- package/dist/config/project-schema.js.map +1 -1
- package/dist/config/schema.js +10 -0
- package/dist/config/schema.js.map +1 -1
- package/dist/config/secrets.d.ts +11 -0
- package/dist/config/secrets.js +19 -0
- package/dist/config/secrets.js.map +1 -0
- package/dist/csl/processor.d.ts +3 -1
- package/dist/csl/processor.js +19 -13
- package/dist/csl/processor.js.map +1 -1
- package/dist/csl/project.d.ts +19 -4
- package/dist/csl/project.js +31 -11
- package/dist/csl/project.js.map +1 -1
- package/dist/djot/djot.js/src/ast.d.ts +4 -1
- package/dist/djot/djot.js/src/ast.js +8 -1
- package/dist/djot/djot.js/src/ast.js.map +1 -1
- package/dist/djot/djot.js/src/djot-renderer.js +3 -3
- package/dist/djot/djot.js/src/djot-renderer.js.map +1 -1
- package/dist/djot/djot.js/src/html.js +2 -1
- package/dist/djot/djot.js/src/html.js.map +1 -1
- package/dist/djot/djot.js/src/inline.d.ts +1 -1
- package/dist/djot/djot.js/src/inline.js +25 -12
- package/dist/djot/djot.js/src/inline.js.map +1 -1
- package/dist/djot/djot.js/src/pandoc.js +81 -11
- package/dist/djot/djot.js/src/pandoc.js.map +1 -1
- package/dist/djot/djot.js/src/parse.js +12 -3
- package/dist/djot/djot.js/src/parse.js.map +1 -1
- package/dist/fonts/index.d.ts +1 -1
- package/dist/fonts/index.js +1 -1
- package/dist/fonts/index.js.map +1 -1
- package/dist/fonts/lint.d.ts +51 -0
- package/dist/fonts/lint.js +101 -16
- package/dist/fonts/lint.js.map +1 -1
- package/dist/fonts/walk.d.ts +13 -0
- package/dist/fonts/walk.js +50 -33
- package/dist/fonts/walk.js.map +1 -1
- package/dist/html/css.d.ts +4 -0
- package/dist/html/css.js +11 -3
- package/dist/html/css.js.map +1 -1
- package/dist/html/dom.d.ts +6 -1
- package/dist/html/dom.js +28 -6
- package/dist/html/dom.js.map +1 -1
- package/dist/html/generated.d.ts +17 -0
- package/dist/html/generated.js +21 -0
- package/dist/html/generated.js.map +1 -0
- package/dist/html/images.d.ts +18 -0
- package/dist/html/images.js +49 -2
- package/dist/html/images.js.map +1 -1
- package/dist/html/index.d.ts +1 -0
- package/dist/html/index.js +1 -0
- package/dist/html/index.js.map +1 -1
- package/dist/html/render.d.ts +5 -4
- package/dist/html/render.js +34 -9
- package/dist/html/render.js.map +1 -1
- package/dist/hyphenation/exceptions.d.ts +5 -0
- package/dist/hyphenation/exceptions.js +11 -0
- package/dist/hyphenation/exceptions.js.map +1 -1
- package/dist/hyphenation/index.d.ts +1 -1
- package/dist/hyphenation/index.js +1 -1
- package/dist/hyphenation/index.js.map +1 -1
- package/dist/import/convert.d.ts +21 -0
- package/dist/import/convert.js +65 -0
- package/dist/import/convert.js.map +1 -0
- package/dist/incremental/cache.d.ts +59 -0
- package/dist/incremental/cache.js +64 -0
- package/dist/incremental/cache.js.map +1 -0
- package/dist/incremental/index.d.ts +3 -0
- package/dist/incremental/index.js +4 -0
- package/dist/incremental/index.js.map +1 -0
- package/dist/incremental/keys.d.ts +27 -0
- package/dist/incremental/keys.js +89 -0
- package/dist/incremental/keys.js.map +1 -0
- package/dist/incremental/session.d.ts +180 -0
- package/dist/incremental/session.js +401 -0
- package/dist/incremental/session.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/indexes/layout.d.ts +8 -2
- package/dist/indexes/layout.js +6 -4
- package/dist/indexes/layout.js.map +1 -1
- package/dist/layout/cache.d.ts +174 -0
- package/dist/layout/cache.js +150 -0
- package/dist/layout/cache.js.map +1 -0
- package/dist/layout/converge.d.ts +28 -0
- package/dist/layout/converge.js +102 -9
- package/dist/layout/converge.js.map +1 -1
- package/dist/layout/counters.d.ts +4 -0
- package/dist/layout/counters.js +15 -0
- package/dist/layout/counters.js.map +1 -1
- package/dist/layout/index.d.ts +5 -2
- package/dist/layout/index.js +3 -0
- package/dist/layout/index.js.map +1 -1
- package/dist/layout/lists.d.ts +52 -3
- package/dist/layout/lists.js +513 -46
- package/dist/layout/lists.js.map +1 -1
- package/dist/layout/lookahead.d.ts +151 -0
- package/dist/layout/lookahead.js +581 -0
- package/dist/layout/lookahead.js.map +1 -0
- package/dist/layout/margin-boxes.d.ts +11 -1
- package/dist/layout/margin-boxes.js +24 -1
- package/dist/layout/margin-boxes.js.map +1 -1
- package/dist/layout/page-box.d.ts +2 -0
- package/dist/layout/page-box.js +6 -4
- package/dist/layout/page-box.js.map +1 -1
- package/dist/layout/page-rules.d.ts +8 -1
- package/dist/layout/page-rules.js +46 -2
- package/dist/layout/page-rules.js.map +1 -1
- package/dist/layout/page.js +4 -2
- package/dist/layout/page.js.map +1 -1
- package/dist/layout/pagebuilder.d.ts +248 -3
- package/dist/layout/pagebuilder.js +512 -19
- package/dist/layout/pagebuilder.js.map +1 -1
- package/dist/layout/pages.d.ts +116 -3
- package/dist/layout/pages.js +1396 -162
- package/dist/layout/pages.js.map +1 -1
- package/dist/layout/paragraph.d.ts +14 -0
- package/dist/layout/paragraph.js +304 -31
- package/dist/layout/paragraph.js.map +1 -1
- package/dist/layout/pre.js +4 -0
- package/dist/layout/pre.js.map +1 -1
- package/dist/layout/protrusion.d.ts +26 -0
- package/dist/layout/protrusion.js +39 -0
- package/dist/layout/protrusion.js.map +1 -0
- package/dist/layout/ranges.d.ts +2 -0
- package/dist/layout/ranges.js +22 -0
- package/dist/layout/ranges.js.map +1 -0
- package/dist/layout/region.d.ts +2 -1
- package/dist/layout/region.js +9 -5
- package/dist/layout/region.js.map +1 -1
- package/dist/layout/templates.d.ts +71 -0
- package/dist/layout/templates.js +290 -0
- package/dist/layout/templates.js.map +1 -0
- package/dist/layout/vlist.d.ts +3 -3
- package/dist/linebreak/items.d.ts +27 -2
- package/dist/linebreak/items.js +10 -3
- package/dist/linebreak/items.js.map +1 -1
- package/dist/linebreak/knuth-plass.d.ts +20 -0
- package/dist/linebreak/knuth-plass.js +68 -16
- package/dist/linebreak/knuth-plass.js.map +1 -1
- package/dist/lint/book.d.ts +13 -0
- package/dist/lint/book.js +52 -0
- package/dist/lint/book.js.map +1 -0
- package/dist/lint/config.d.ts +9 -0
- package/dist/lint/config.js +40 -6
- package/dist/lint/config.js.map +1 -1
- package/dist/lint/linter.js +1 -0
- package/dist/lint/linter.js.map +1 -1
- package/dist/lint/project.js +1 -1
- package/dist/lint/project.js.map +1 -1
- package/dist/lint/rules/layout.d.ts +3 -1
- package/dist/lint/rules/layout.js +8 -6
- package/dist/lint/rules/layout.js.map +1 -1
- package/dist/lint/rules/source.d.ts +3 -1
- package/dist/lint/rules/source.js +9 -4
- package/dist/lint/rules/source.js.map +1 -1
- package/dist/lint/testing.js +1 -0
- package/dist/lint/testing.js.map +1 -1
- package/dist/measure/bidi-data.d.ts +14 -0
- package/dist/measure/bidi-data.js +69 -0
- package/dist/measure/bidi-data.js.map +1 -0
- package/dist/measure/bidi.d.ts +70 -0
- package/dist/measure/bidi.js +225 -0
- package/dist/measure/bidi.js.map +1 -0
- package/dist/measure/css.d.ts +5 -0
- package/dist/measure/css.js +2 -0
- package/dist/measure/css.js.map +1 -1
- package/dist/measure/measurer.d.ts +36 -2
- package/dist/measure/measurer.js +220 -22
- package/dist/measure/measurer.js.map +1 -1
- package/dist/measure/model.d.ts +20 -2
- package/dist/measure/model.js +13 -6
- package/dist/measure/model.js.map +1 -1
- package/dist/measure/script-data.d.ts +6 -0
- package/dist/measure/script-data.js +34 -0
- package/dist/measure/script-data.js.map +1 -0
- package/dist/measure/scripts.d.ts +36 -0
- package/dist/measure/scripts.js +293 -0
- package/dist/measure/scripts.js.map +1 -0
- package/dist/output/output.d.ts +35 -3
- package/dist/output/output.js +26 -4
- package/dist/output/output.js.map +1 -1
- package/dist/paint/backgrounds.js +7 -20
- package/dist/paint/backgrounds.js.map +1 -1
- package/dist/paint/blend.d.ts +33 -13
- package/dist/paint/blend.js +73 -21
- package/dist/paint/blend.js.map +1 -1
- package/dist/paint/cache.d.ts +80 -0
- package/dist/paint/cache.js +537 -0
- package/dist/paint/cache.js.map +1 -0
- package/dist/paint/canvas.d.ts +4 -13
- package/dist/paint/canvas.js +45 -5
- package/dist/paint/canvas.js.map +1 -1
- package/dist/paint/context.d.ts +2 -0
- package/dist/paint/emphasis.js +1 -1
- package/dist/paint/emphasis.js.map +1 -1
- package/dist/paint/flatten.d.ts +24 -2
- package/dist/paint/flatten.js +55 -12
- package/dist/paint/flatten.js.map +1 -1
- package/dist/paint/forms.d.ts +64 -0
- package/dist/paint/forms.js +319 -0
- package/dist/paint/forms.js.map +1 -0
- package/dist/paint/images.d.ts +4 -1
- package/dist/paint/images.js +13 -2
- package/dist/paint/images.js.map +1 -1
- package/dist/paint/layers.d.ts +64 -0
- package/dist/paint/layers.js +137 -0
- package/dist/paint/layers.js.map +1 -0
- package/dist/paint/painter.d.ts +19 -6
- package/dist/paint/painter.js +15 -135
- package/dist/paint/painter.js.map +1 -1
- package/dist/paint/stacking.d.ts +1 -1
- package/dist/paint/stacking.js +9 -2
- package/dist/paint/stacking.js.map +1 -1
- package/dist/paint/text.d.ts +14 -3
- package/dist/paint/text.js +25 -4
- package/dist/paint/text.js.map +1 -1
- package/dist/paint/vertical.js +2 -2
- package/dist/paint/vertical.js.map +1 -1
- package/dist/pdf/encoded.d.ts +16 -0
- package/dist/pdf/encoded.js +35 -0
- package/dist/pdf/encoded.js.map +1 -0
- package/dist/pdf/include/colour.d.ts +105 -0
- package/dist/pdf/include/colour.js +349 -0
- package/dist/pdf/include/colour.js.map +1 -0
- package/dist/pdf/include/functions.d.ts +17 -0
- package/dist/pdf/include/functions.js +389 -0
- package/dist/pdf/include/functions.js.map +1 -0
- package/dist/pdf/include/pages.d.ts +14 -0
- package/dist/pdf/include/pages.js +27 -0
- package/dist/pdf/include/pages.js.map +1 -0
- package/dist/pdf/include/pdfjs/LICENSE +177 -0
- package/dist/pdf/include/pdfjs/pdf.min.mjs +27 -0
- package/dist/pdf/include/pdfjs/pdf.worker.min.mjs +27 -0
- package/dist/pdf/include/pdfjs/standard_fonts/FoxitDingbats.pfb +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/FoxitFixed.pfb +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/FoxitFixedBold.pfb +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/FoxitFixedItalic.pfb +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/FoxitSerif.pfb +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/FoxitSerifBold.pfb +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/FoxitSerifItalic.pfb +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/FoxitSymbol.pfb +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/LICENSE_FOXIT +27 -0
- package/dist/pdf/include/pdfjs/standard_fonts/LICENSE_LIBERATION +363 -0
- package/dist/pdf/include/pdfjs/standard_fonts/LiberationSans-Bold.ttf +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/LiberationSans-Italic.ttf +0 -0
- package/dist/pdf/include/pdfjs/standard_fonts/LiberationSans-Regular.ttf +0 -0
- package/dist/pdf/include/pdfjs/wasm/LICENSE_JBIG2 +196 -0
- package/dist/pdf/include/pdfjs/wasm/LICENSE_OPENJPEG +39 -0
- package/dist/pdf/include/pdfjs/wasm/LICENSE_PDFJS_JBIG2 +13 -0
- package/dist/pdf/include/pdfjs/wasm/LICENSE_PDFJS_OPENJPEG +22 -0
- package/dist/pdf/include/pdfjs/wasm/LICENSE_PDFJS_QCMS +19 -0
- package/dist/pdf/include/pdfjs/wasm/LICENSE_QCMS +21 -0
- package/dist/pdf/include/pdfjs/wasm/jbig2.wasm +0 -0
- package/dist/pdf/include/pdfjs/wasm/openjpeg.wasm +0 -0
- package/dist/pdf/include/pdfjs/wasm/qcms_bg.wasm +0 -0
- package/dist/pdf/include/pdfjs/wasm/quickjs-eval.wasm +0 -0
- package/dist/pdf/include/prepare.d.ts +58 -0
- package/dist/pdf/include/prepare.js +266 -0
- package/dist/pdf/include/prepare.js.map +1 -0
- package/dist/pdf/include/preview.d.ts +38 -0
- package/dist/pdf/include/preview.js +101 -0
- package/dist/pdf/include/preview.js.map +1 -0
- package/dist/pdf/include/rewrite.d.ts +57 -0
- package/dist/pdf/include/rewrite.js +803 -0
- package/dist/pdf/include/rewrite.js.map +1 -0
- package/dist/pdf/include/serialize.d.ts +32 -0
- package/dist/pdf/include/serialize.js +158 -0
- package/dist/pdf/include/serialize.js.map +1 -0
- package/dist/pdf/include/testing.d.ts +26 -0
- package/dist/pdf/include/testing.js +50 -0
- package/dist/pdf/include/testing.js.map +1 -0
- package/dist/pdf/index.d.ts +1 -0
- package/dist/pdf/index.js +1 -0
- package/dist/pdf/index.js.map +1 -1
- package/dist/pdf/structure/annotations.d.ts +33 -0
- package/dist/pdf/structure/annotations.js +112 -0
- package/dist/pdf/structure/annotations.js.map +1 -0
- package/dist/pdf/structure/forms.d.ts +10 -0
- package/dist/pdf/structure/forms.js +46 -0
- package/dist/pdf/structure/forms.js.map +1 -0
- package/dist/pdf/structure/index.d.ts +41 -5
- package/dist/pdf/structure/index.js +40 -5
- package/dist/pdf/structure/index.js.map +1 -1
- package/dist/pdf/structure/links.d.ts +2 -0
- package/dist/pdf/structure/links.js +1 -1
- package/dist/pdf/structure/links.js.map +1 -1
- package/dist/pdf/structure/presentation.d.ts +28 -0
- package/dist/pdf/structure/presentation.js +79 -0
- package/dist/pdf/structure/presentation.js.map +1 -0
- package/dist/pdf/structure/tags.d.ts +34 -2
- package/dist/pdf/structure/tags.js +117 -14
- package/dist/pdf/structure/tags.js.map +1 -1
- package/dist/pdf/types.d.ts +378 -15
- package/dist/pdf/wasm/pulpweaver4_pdf.d.ts +44 -2
- package/dist/pdf/wasm/pulpweaver4_pdf.js +191 -2
- package/dist/pdf/wasm/pulpweaver4_pdf_bg.wasm +0 -0
- package/dist/pdf/writer.d.ts +13 -1
- package/dist/pdf/writer.js +26 -1
- package/dist/pdf/writer.js.map +1 -1
- package/dist/plugin/define.d.ts +200 -15
- package/dist/plugin/define.js +124 -15
- package/dist/plugin/define.js.map +1 -1
- package/dist/plugin/failure.d.ts +1 -1
- package/dist/plugin/index.d.ts +5 -4
- package/dist/plugin/index.js +5 -4
- package/dist/plugin/index.js.map +1 -1
- package/dist/plugin/reference.d.ts +38 -0
- package/dist/plugin/reference.js +287 -0
- package/dist/plugin/reference.js.map +1 -0
- package/dist/plugin/register.d.ts +39 -7
- package/dist/plugin/register.js +83 -2
- package/dist/plugin/register.js.map +1 -1
- package/dist/preflight/index.d.ts +1 -1
- package/dist/preflight/index.js +1 -1
- package/dist/preflight/index.js.map +1 -1
- package/dist/preflight/pdfx.d.ts +35 -0
- package/dist/preflight/pdfx.js +37 -4
- package/dist/preflight/pdfx.js.map +1 -1
- package/dist/preflight/reader.d.ts +10 -3
- package/dist/preflight/reader.js +86 -5
- package/dist/preflight/reader.js.map +1 -1
- package/dist/print/impose.d.ts +66 -0
- package/dist/print/impose.js +331 -0
- package/dist/print/impose.js.map +1 -0
- package/dist/print/output.js +426 -60
- package/dist/print/output.js.map +1 -1
- package/dist/problem.js +4 -3
- package/dist/problem.js.map +1 -1
- package/dist/profile/index.d.ts +1 -0
- package/dist/profile/index.js +1 -0
- package/dist/profile/index.js.map +1 -1
- package/dist/profile/lint.d.ts +1 -1
- package/dist/profile/lint.js +29 -1
- package/dist/profile/lint.js.map +1 -1
- package/dist/profile/list-table.d.ts +51 -0
- package/dist/profile/list-table.js +137 -0
- package/dist/profile/list-table.js.map +1 -0
- package/dist/profile/metadata.js +3 -0
- package/dist/profile/metadata.js.map +1 -1
- package/dist/profile/profile.d.ts +3 -0
- package/dist/profile/profile.js +9 -1
- package/dist/profile/profile.js.map +1 -1
- package/dist/project.js +3 -0
- package/dist/project.js.map +1 -1
- package/dist/qpdf/index.d.ts +2 -0
- package/dist/qpdf/index.js +3 -0
- package/dist/qpdf/index.js.map +1 -0
- package/dist/qpdf/qpdf.d.ts +125 -0
- package/dist/qpdf/qpdf.js +205 -0
- package/dist/qpdf/qpdf.js.map +1 -0
- package/dist/qpdf/testing.d.ts +12 -0
- package/dist/qpdf/testing.js +9 -0
- package/dist/qpdf/testing.js.map +1 -0
- package/dist/qpdf/wasm/LICENSE-qpdf +202 -0
- package/dist/qpdf/wasm/LICENSE-zlib +22 -0
- package/dist/qpdf/wasm/NOTICE-qpdf.md +42 -0
- package/dist/qpdf/wasm/qpdf.wasm +0 -0
- package/dist/render/index.d.ts +3 -0
- package/dist/render/index.js +2 -0
- package/dist/render/index.js.map +1 -0
- package/dist/render/render.d.ts +98 -0
- package/dist/render/render.js +243 -0
- package/dist/render/render.js.map +1 -0
- package/dist/reproducible/clock.d.ts +4 -5
- package/dist/reproducible/clock.js +4 -5
- package/dist/reproducible/clock.js.map +1 -1
- package/dist/spike/spike-page.chromium.json +4 -4
- package/dist/style/colours.d.ts +7 -2
- package/dist/style/colours.js +24 -2
- package/dist/style/colours.js.map +1 -1
- package/dist/style/compile.js +1 -1
- package/dist/style/compile.js.map +1 -1
- package/dist/style/defaults.d.ts +9 -3
- package/dist/style/defaults.js +14 -2
- package/dist/style/defaults.js.map +1 -1
- package/dist/style/gcpm.d.ts +1 -1
- package/dist/style/gcpm.js +17 -5
- package/dist/style/gcpm.js.map +1 -1
- package/dist/style/properties.js +84 -0
- package/dist/style/properties.js.map +1 -1
- package/dist/test/book.d.ts +22 -2
- package/dist/test/book.js +35 -2
- package/dist/test/book.js.map +1 -1
- package/dist/test/build.d.ts +23 -0
- package/dist/test/build.js +86 -33
- package/dist/test/build.js.map +1 -1
- package/dist/test/layout.js +132 -22
- package/dist/test/layout.js.map +1 -1
- package/dist/test/limits.d.ts +8 -0
- package/dist/test/limits.js +9 -0
- package/dist/test/limits.js.map +1 -0
- package/dist/test/pipeline.d.ts +26 -0
- package/dist/test/pipeline.js +4 -2
- package/dist/test/pipeline.js.map +1 -1
- package/dist/test/render.d.ts +26 -3
- package/dist/test/render.js +151 -23
- package/dist/test/render.js.map +1 -1
- package/dist/test/runner.d.ts +6 -3
- package/dist/test/runner.js +172 -105
- package/dist/test/runner.js.map +1 -1
- package/dist/test/text.js +2 -2
- package/dist/test/text.js.map +1 -1
- package/dist/text/output.js +2 -2
- package/dist/text/output.js.map +1 -1
- package/dist/text/render.d.ts +4 -3
- package/dist/text/render.js +128 -6
- package/dist/text/render.js.map +1 -1
- package/dist/transform/index.d.ts +1 -1
- package/dist/transform/index.js +1 -1
- package/dist/transform/index.js.map +1 -1
- package/dist/transform/run.d.ts +2 -0
- package/dist/transform/run.js +32 -16
- package/dist/transform/run.js.map +1 -1
- package/dist/web/output.js +116 -10
- package/dist/web/output.js.map +1 -1
- package/dist/web/runtime/justify.js.txt +2 -2
- package/dist/web/site.d.ts +2 -0
- package/dist/web/site.js +8 -1
- package/dist/web/site.js.map +1 -1
- package/docs/README.md +6 -1
- package/docs/manual/chapters/front.dj +34 -0
- package/docs/manual/chapters/guides/citations.dj +426 -0
- package/docs/manual/chapters/guides/colour-and-prepress.dj +261 -0
- package/docs/manual/chapters/guides/editions.dj +329 -0
- package/docs/manual/chapters/guides/in-a-web-page.dj +143 -0
- package/docs/manual/chapters/guides/lines-and-pages.dj +681 -0
- package/docs/manual/chapters/guides/lint-rules.dj +355 -0
- package/docs/manual/chapters/guides/pdfs.dj +501 -0
- package/docs/manual/chapters/guides/plugins.dj +425 -0
- package/docs/manual/chapters/guides/testing.dj +264 -0
- package/docs/manual/chapters/guides/writing-in-djot.dj +537 -0
- package/docs/manual/chapters/start/for-latex-users.dj +256 -0
- package/docs/manual/chapters/start/getting-started.dj +167 -0
- package/docs/manual/chapters/start/your-first-book.dj +426 -0
- package/docs/manual/fonts/CrimsonPro-Italic-VF.ttf +0 -0
- package/docs/manual/fonts/CrimsonPro-VF.ttf +0 -0
- package/docs/manual/fonts/JetBrainsMono-Regular.otf +0 -0
- package/docs/manual/fonts/NotoSansSymbols2-Boxes.ttf +0 -0
- package/docs/manual/fonts/OFL.txt +95 -0
- package/docs/manual/pulpweaver4.toml +39 -0
- package/docs/manual/styles/manual.css +137 -0
- package/docs/reference/css-properties/index.md +9 -0
- package/docs/reference/css-properties/pw-expansion.md +31 -0
- package/docs/reference/css-properties/pw-flow-into.md +31 -0
- package/docs/reference/css-properties/pw-knockout.md +26 -0
- package/docs/reference/css-properties/pw-layer.md +24 -0
- package/docs/reference/css-properties/pw-page-breaking.md +30 -0
- package/docs/reference/css-properties/pw-page-duration.md +28 -0
- package/docs/reference/css-properties/pw-page-rotate.md +29 -0
- package/docs/reference/css-properties/pw-page-transition.md +29 -0
- package/docs/reference/css-properties/pw-protrusion.md +31 -0
- package/docs/reference/lint-rules/ibid-across-page.md +2 -2
- package/docs/reference/lint-rules/unused-entry.md +3 -1
- package/docs/reference/plugin-api/capabilities.md +2 -2
- package/docs/reference/plugin-api/claim-kind.md +1 -1
- package/docs/reference/plugin-api/combine-exceptions.md +19 -0
- package/docs/reference/plugin-api/element-break-context.md +34 -0
- package/docs/reference/plugin-api/element-break-item.md +24 -0
- package/docs/reference/plugin-api/element-breaker.md +24 -0
- package/docs/reference/plugin-api/flow-definition.md +30 -0
- package/docs/reference/plugin-api/generated-reference.md +32 -0
- package/docs/reference/plugin-api/index-definition.md +32 -0
- package/docs/reference/plugin-api/index-titles.md +18 -0
- package/docs/reference/plugin-api/index.md +27 -3
- package/docs/reference/plugin-api/insert-class-definition.md +46 -0
- package/docs/reference/plugin-api/insert-placement.md +22 -0
- package/docs/reference/plugin-api/insert-placements.md +18 -0
- package/docs/reference/plugin-api/layout-definition.md +9 -5
- package/docs/reference/plugin-api/layout-slot.md +6 -16
- package/docs/reference/plugin-api/lint-context.md +3 -1
- package/docs/reference/plugin-api/lint-definition.md +1 -1
- package/docs/reference/plugin-api/lint-edition.md +2 -0
- package/docs/reference/plugin-api/page-builder-event.md +22 -0
- package/docs/reference/plugin-api/page-builder-hook.md +7 -3
- package/docs/reference/plugin-api/page-builder-page-event.md +30 -0
- package/docs/reference/plugin-api/page-template-definition.md +34 -0
- package/docs/reference/plugin-api/page-template-region-definition.md +46 -0
- package/docs/reference/plugin-api/plugin-definition.md +5 -1
- package/docs/reference/plugin-api/plugin-reference-options.md +32 -0
- package/docs/reference/plugin-api/plugin-reference.md +22 -0
- package/docs/reference/plugin-api/plugin-registry.md +15 -5
- package/docs/reference/plugin-api/plugin-stage.md +1 -1
- package/docs/reference/plugin-api/plugin.md +9 -2
- package/docs/reference/plugin-api/reference-page.md +34 -0
- package/docs/reference/plugin-api/render-reference-page.md +18 -0
- package/docs/reference/plugin-api/renderers.md +1 -1
- package/docs/reference/pulpweaver4-toml/editions.md +253 -2
- package/docs/reference/pulpweaver4-toml/index.md +57 -1
- package/docs/reference/pulpweaver4-toml/inks.md +15 -4
- package/docs/reference/pulpweaver4-toml/lint.md +1 -1
- 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.
|
|
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.
|
|
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);
|
|
Binary file
|
package/dist/pdf/writer.d.ts
CHANGED
|
@@ -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>;
|
package/dist/pdf/writer.js
CHANGED
|
@@ -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
|
package/dist/pdf/writer.js.map
CHANGED
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"writer.js","sourceRoot":"","sources":["../../src/pdf/writer.ts"],"names":[],"mappings":"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"}
|
package/dist/plugin/define.d.ts
CHANGED
|
@@ -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
|
|
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
|
-
/**
|
|
232
|
-
|
|
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
|
-
/**
|
|
236
|
-
readonly
|
|
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
|
-
/**
|
|
239
|
-
export type
|
|
240
|
-
|
|
241
|
-
|
|
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,
|
|
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,
|
|
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,
|
|
262
|
-
/** Called by the page builder
|
|
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
|
-
/**
|
|
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. */
|