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.
- package/dist/ast/djot.js +23 -0
- 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 +59 -5
- 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/index.d.ts +1 -1
- package/dist/citations/index.js +1 -1
- package/dist/citations/index.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/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 +91 -3
- package/dist/config/config.js +200 -3
- package/dist/config/config.js.map +1 -1
- package/dist/config/project-schema.d.ts +0 -8
- package/dist/config/project-schema.js +207 -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/project.d.ts +19 -4
- package/dist/csl/project.js +23 -10
- package/dist/csl/project.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 +24 -6
- 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-rules.d.ts +6 -1
- package/dist/layout/page-rules.js +42 -1
- 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 +108 -1
- package/dist/layout/pages.js +1362 -159
- 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.js +1 -1
- 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 +357 -11
- 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 +33 -2
- 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 +400 -50
- 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 +128 -19
- 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 +23 -0
- 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 +126 -4
- 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/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 +239 -2
- package/docs/reference/pulpweaver4-toml/index.md +44 -1
- package/docs/reference/pulpweaver4-toml/inks.md +15 -4
- package/docs/reference/pulpweaver4-toml/lint.md +1 -1
- package/package.json +5 -1
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What an incremental build keeps of one layout for the next
|
|
3
|
+
* (https://plans.inkylabs.com/pulpweaver#performance-and-incremental-builds):
|
|
4
|
+
* each paragraph's lines, and the page builder's state at each page
|
|
5
|
+
* (`pages.ts`), so that the next layout sets again only what changed and
|
|
6
|
+
* builds again only the pages it changes.
|
|
7
|
+
*
|
|
8
|
+
* A paragraph is reused when what it was laid out from is the same: its
|
|
9
|
+
* HTML (its `data-pw-key`s among it, which a build session keeps from one
|
|
10
|
+
* build to the next where the HTML is the same: `incremental/keys.ts`), its
|
|
11
|
+
* ancestors' tags and attributes, its own computed style (the properties
|
|
12
|
+
* that set its text and break its lines, {@link PARAGRAPH_STYLE}) and its
|
|
13
|
+
* measure. Its ancestors' `id`s are left out, as a section's is its
|
|
14
|
+
* heading's text, which an edit to the heading changes. Its inline
|
|
15
|
+
* elements' styles are taken to follow from those, as they do but for a
|
|
16
|
+
* selector that reaches into it from outside by an ancestor's `id` or a
|
|
17
|
+
* sibling (`#preface em`, `p:first-child em`). Its lines, already set,
|
|
18
|
+
* are taken as they are: the same elements, on whatever page they now go
|
|
19
|
+
* to.
|
|
20
|
+
*
|
|
21
|
+
* A container (a chapter's `section`) is reused whole on the same terms,
|
|
22
|
+
* read before anything is styled ({@link containerKey}): the items its
|
|
23
|
+
* content gave, from the space and breaks waiting before it to those it
|
|
24
|
+
* left after it, so that the browser neither styles nor lays out a chapter
|
|
25
|
+
* that hasn't changed. Its own style and the space before it are checked
|
|
26
|
+
* when the list reaches it.
|
|
27
|
+
*
|
|
28
|
+
* Only what the cache was made with may change between layouts: the fonts,
|
|
29
|
+
* the hyphenation, the stylesheet and the plugins stay, or the build makes
|
|
30
|
+
* a new cache.
|
|
31
|
+
*/
|
|
32
|
+
import type { LaidOut } from '../test/pipeline.js';
|
|
33
|
+
import type { PageLayoutState, PendingSearch } from './pages.js';
|
|
34
|
+
import type { ParagraphLayout } from './paragraph.js';
|
|
35
|
+
import type { VItem, VMark } from './vlist.js';
|
|
36
|
+
/** A paragraph as laid out, for a later layout to reuse. */
|
|
37
|
+
export interface CachedParagraph {
|
|
38
|
+
readonly kind: 'paragraph';
|
|
39
|
+
/** What it was laid out from ({@link paragraphKey}). */
|
|
40
|
+
readonly key: string;
|
|
41
|
+
/** Its content box's width: its measure. */
|
|
42
|
+
readonly measure: number;
|
|
43
|
+
readonly layout: ParagraphLayout;
|
|
44
|
+
/** Each line's box, its shift from the paragraph's content box, and what migrated out after it (notes, marks). */
|
|
45
|
+
readonly lines: readonly CachedLine[];
|
|
46
|
+
/** Running elements that left it, held again by each layout that reuses it. */
|
|
47
|
+
readonly held: readonly HTMLElement[];
|
|
48
|
+
}
|
|
49
|
+
export interface CachedLine {
|
|
50
|
+
readonly height: number;
|
|
51
|
+
readonly depth: number;
|
|
52
|
+
readonly width: number;
|
|
53
|
+
readonly shift: number;
|
|
54
|
+
readonly migrated: readonly VItem[];
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* A container's content as the list made it (`lists.ts`), for a later
|
|
58
|
+
* layout to reuse whole: its items, whose containers below it are its own
|
|
59
|
+
* descendants, and what waited at the boundary before and after them.
|
|
60
|
+
*/
|
|
61
|
+
export interface CachedContainer {
|
|
62
|
+
readonly kind: 'container';
|
|
63
|
+
/** Its HTML and its ancestors' ({@link containerKey}). */
|
|
64
|
+
readonly key: string;
|
|
65
|
+
/** Its own style ({@link styleKey}) and its content box's width. */
|
|
66
|
+
readonly style: string;
|
|
67
|
+
readonly measure: number;
|
|
68
|
+
/** How many containers its items' chains had above its content: itself and those it sat in. */
|
|
69
|
+
readonly depth: number;
|
|
70
|
+
/** The boundary waiting before its content and after it (`lists.ts`'s). */
|
|
71
|
+
readonly before: unknown;
|
|
72
|
+
readonly after: unknown;
|
|
73
|
+
readonly items: readonly VItem[];
|
|
74
|
+
/** Running elements its content held, and its own marks (`string-set`), from its content. */
|
|
75
|
+
readonly held: readonly HTMLElement[];
|
|
76
|
+
readonly marks: readonly VMark[];
|
|
77
|
+
/** The paragraphs and containers in it, kept again with it. */
|
|
78
|
+
readonly inside: readonly (readonly [string, CachedEntry])[];
|
|
79
|
+
}
|
|
80
|
+
export type CachedEntry = CachedParagraph | CachedContainer;
|
|
81
|
+
/**
|
|
82
|
+
* The properties of a paragraph's computed style that its lines depend on:
|
|
83
|
+
* its fonts, its spacing, its alignment, its hyphenation and the engine's
|
|
84
|
+
* own (`--pw-*`), read by `layoutParagraph`. Its width is its measure.
|
|
85
|
+
*/
|
|
86
|
+
export declare const PARAGRAPH_STYLE: readonly ['font-family', 'font-size', 'font-weight', 'font-style', 'font-stretch', 'font-variant', 'font-feature-settings', 'font-variation-settings', 'font-kerning', 'font-optical-sizing', 'font-synthesis', 'font-size-adjust', 'line-height', 'letter-spacing', 'word-spacing', 'text-indent', 'text-align', 'text-align-last', 'text-transform', 'text-rendering', 'hyphens', 'white-space', 'tab-size', 'direction', 'unicode-bidi', 'writing-mode', 'text-orientation', 'vertical-align', 'padding-left', 'padding-right', 'border-left-width', 'border-right-width', 'box-sizing', 'display', '--pw-word-space', '--pw-xspace', '--pw-line-breaking', '--pw-leader', '--pw-leader-space', '--pw-tolerance', '--pw-pretolerance', '--pw-looseness', '--pw-line-penalty', '--pw-hyphen-penalty', '--pw-ex-hyphen-penalty', '--pw-adj-demerits', '--pw-double-hyphen-demerits', '--pw-final-hyphen-demerits', '--pw-emergency-stretch', '--pw-left-hyphen-min', '--pw-right-hyphen-min', '--pw-protrusion', '--pw-expansion'];
|
|
87
|
+
/**
|
|
88
|
+
* What a paragraph is laid out from, as one string: its HTML, its
|
|
89
|
+
* ancestors' tags and attributes up to `root`, and its style.
|
|
90
|
+
*/
|
|
91
|
+
export declare function paragraphKey(el: HTMLElement, cs: CSSStyleDeclaration, root: HTMLElement): string;
|
|
92
|
+
/** What a container is laid out from, read before it is styled: its HTML and its ancestors' tags and attributes up to `root`, but their `id`s. */
|
|
93
|
+
export declare function containerKey(el: HTMLElement, root: HTMLElement): string;
|
|
94
|
+
/** An element's style, as far as the lines in it depend on it ({@link PARAGRAPH_STYLE}). */
|
|
95
|
+
export declare function styleKey(cs: CSSStyleDeclaration): string;
|
|
96
|
+
/** Counts of what a layout reused and set again, for tests and benchmarks. */
|
|
97
|
+
export interface CacheStats {
|
|
98
|
+
/** Paragraphs reused, and laid out. */
|
|
99
|
+
hits: number;
|
|
100
|
+
misses: number;
|
|
101
|
+
/** Pages built anew by the page builder, the rest kept (some renumbered) from the last layout (#199). */
|
|
102
|
+
pages: number;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* The paragraphs and pages of the last layout, for the next. A layout
|
|
106
|
+
* starts with {@link begin}: what the layout before it kept is what it may
|
|
107
|
+
* reuse, and what it keeps (reused or new) is the next one's.
|
|
108
|
+
*/
|
|
109
|
+
export declare class LayoutCache {
|
|
110
|
+
private last;
|
|
111
|
+
private next;
|
|
112
|
+
/** What was kept, in order, for a container to carry what is in it. */
|
|
113
|
+
private journal;
|
|
114
|
+
/** The last layout's pages, as the page layout keeps them to start from (`pages.ts`). */
|
|
115
|
+
pages: PageLayoutState | undefined;
|
|
116
|
+
/**
|
|
117
|
+
* A lookahead search the last layout left to finish (#180): its pages
|
|
118
|
+
* are a preview's until it does. A build session runs it on in idle time,
|
|
119
|
+
* and the next layout of the same list follows what it found.
|
|
120
|
+
*/
|
|
121
|
+
search: PendingSearch | undefined;
|
|
122
|
+
/**
|
|
123
|
+
* How long a lookahead search after an edit runs before the layout
|
|
124
|
+
* leaves it to finish and shows a preview (`approximateBreaks`): called
|
|
125
|
+
* as the search starts, it gives what says, between slices (`lookahead.ts`'s
|
|
126
|
+
* `SLICE`), whether to go on. Unset, every search finishes. A build
|
|
127
|
+
* session's (`BuildSessionOptions.previewMs`): the clock decides only
|
|
128
|
+
* whether a preview is shown first, never what is written.
|
|
129
|
+
*/
|
|
130
|
+
preview: (() => () => boolean) | undefined;
|
|
131
|
+
/**
|
|
132
|
+
* Set while a build session swaps a finished search's pages in for a
|
|
133
|
+
* preview's a run at a time (#199): the layout follows the search's
|
|
134
|
+
* breaks for this many pages past where they part from the last
|
|
135
|
+
* layout's, then takes up the last layout's again, its pages still a
|
|
136
|
+
* preview's (the search left in {@link search} for the next run).
|
|
137
|
+
*/
|
|
138
|
+
swap: number | undefined;
|
|
139
|
+
/**
|
|
140
|
+
* Lays the last build's HTML out again, with nothing read or rendered
|
|
141
|
+
* again (`layoutAgain`), and gives what the layout stage gives of it:
|
|
142
|
+
* what a run of a swap is (#199). Undefined if the pages, exact, moved a
|
|
143
|
+
* page number, so that the book must be built again.
|
|
144
|
+
*/
|
|
145
|
+
again: (() => LaidOut | undefined) | undefined;
|
|
146
|
+
stats: CacheStats;
|
|
147
|
+
/**
|
|
148
|
+
* The page counter each element of a reused container sets (`counter-reset:
|
|
149
|
+
* page`, `counter-set: page`), read while it was in the document: its
|
|
150
|
+
* elements are the last layout's, out of the document now.
|
|
151
|
+
*/
|
|
152
|
+
readonly resets: WeakMap<Element, number>;
|
|
153
|
+
/** Pages' margin boxes by what they were made from, for a page made from the same (`MarginBoxOptions.cache`). */
|
|
154
|
+
readonly margins: Map<string, readonly HTMLElement[]>;
|
|
155
|
+
/** How many times each page element was made or changed (renumbered, its margin boxes made again), for what shows the pages to know which to show again. */
|
|
156
|
+
readonly revisions: WeakMap<HTMLElement, number>;
|
|
157
|
+
/** Notes that a page element was made, or changed. */
|
|
158
|
+
revise(page: HTMLElement): void;
|
|
159
|
+
/** Starts a layout. */
|
|
160
|
+
begin(): void;
|
|
161
|
+
/** The last layout's entry of the element's key, of the kind asked for, if it was laid out from `key`. */
|
|
162
|
+
find<K extends CachedEntry['kind']>(el: HTMLElement, kind: K, key: string): Extract<CachedEntry, {
|
|
163
|
+
kind: K;
|
|
164
|
+
}> | undefined;
|
|
165
|
+
/** Whether the last layout has an entry of the kind for the element's key at all: whether it is worth working out its key. */
|
|
166
|
+
has(el: HTMLElement, kind: CachedEntry['kind']): boolean;
|
|
167
|
+
private entry;
|
|
168
|
+
/** Keeps an entry for the next layout, reused or new, and, with a container, what it carries. */
|
|
169
|
+
keep(el: HTMLElement, entry: CachedEntry, reused: boolean): void;
|
|
170
|
+
private put;
|
|
171
|
+
/** Where the journal of what is kept stands, and what was kept since: what a container carries. */
|
|
172
|
+
mark(): number;
|
|
173
|
+
since(mark: number): (readonly [string, CachedEntry])[];
|
|
174
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The properties of a paragraph's computed style that its lines depend on:
|
|
3
|
+
* its fonts, its spacing, its alignment, its hyphenation and the engine's
|
|
4
|
+
* own (`--pw-*`), read by `layoutParagraph`. Its width is its measure.
|
|
5
|
+
*/
|
|
6
|
+
export const PARAGRAPH_STYLE = [
|
|
7
|
+
'font-family', 'font-size', 'font-weight', 'font-style', 'font-stretch', 'font-variant', 'font-feature-settings',
|
|
8
|
+
'font-variation-settings', 'font-kerning', 'font-optical-sizing', 'font-synthesis', 'font-size-adjust', 'line-height',
|
|
9
|
+
'letter-spacing', 'word-spacing', 'text-indent', 'text-align', 'text-align-last', 'text-transform', 'text-rendering',
|
|
10
|
+
'hyphens', 'white-space', 'tab-size', 'direction', 'unicode-bidi', 'writing-mode', 'text-orientation', 'vertical-align',
|
|
11
|
+
'padding-left', 'padding-right', 'border-left-width', 'border-right-width', 'box-sizing', 'display',
|
|
12
|
+
'--pw-word-space', '--pw-xspace', '--pw-line-breaking', '--pw-leader', '--pw-leader-space', '--pw-tolerance',
|
|
13
|
+
'--pw-pretolerance', '--pw-looseness', '--pw-line-penalty', '--pw-hyphen-penalty', '--pw-ex-hyphen-penalty',
|
|
14
|
+
'--pw-adj-demerits', '--pw-double-hyphen-demerits', '--pw-final-hyphen-demerits', '--pw-emergency-stretch',
|
|
15
|
+
'--pw-left-hyphen-min', '--pw-right-hyphen-min', '--pw-protrusion', '--pw-expansion',
|
|
16
|
+
];
|
|
17
|
+
/**
|
|
18
|
+
* What a paragraph is laid out from, as one string: its HTML, its
|
|
19
|
+
* ancestors' tags and attributes up to `root`, and its style.
|
|
20
|
+
*/
|
|
21
|
+
export function paragraphKey(el, cs, root) {
|
|
22
|
+
return `${containerKey(el, root)}\n${styleKey(cs)}`;
|
|
23
|
+
}
|
|
24
|
+
/** What a container is laid out from, read before it is styled: its HTML and its ancestors' tags and attributes up to `root`, but their `id`s. */
|
|
25
|
+
export function containerKey(el, root) {
|
|
26
|
+
const parts = [el.outerHTML];
|
|
27
|
+
for (let a = el.parentElement; a; a = a === root ? null : a.parentElement) {
|
|
28
|
+
let s = a.localName;
|
|
29
|
+
for (const name of a.getAttributeNames())
|
|
30
|
+
if (name !== 'id')
|
|
31
|
+
s += ` ${name}=${a.getAttribute(name)}`;
|
|
32
|
+
parts.push(s);
|
|
33
|
+
}
|
|
34
|
+
return parts.join('\n');
|
|
35
|
+
}
|
|
36
|
+
/** An element's style, as far as the lines in it depend on it ({@link PARAGRAPH_STYLE}). */
|
|
37
|
+
export function styleKey(cs) {
|
|
38
|
+
return PARAGRAPH_STYLE.map((p) => cs.getPropertyValue(p)).join('\n');
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The paragraphs and pages of the last layout, for the next. A layout
|
|
42
|
+
* starts with {@link begin}: what the layout before it kept is what it may
|
|
43
|
+
* reuse, and what it keeps (reused or new) is the next one's.
|
|
44
|
+
*/
|
|
45
|
+
export class LayoutCache {
|
|
46
|
+
last = new Map();
|
|
47
|
+
next = new Map();
|
|
48
|
+
/** What was kept, in order, for a container to carry what is in it. */
|
|
49
|
+
journal = [];
|
|
50
|
+
/** The last layout's pages, as the page layout keeps them to start from (`pages.ts`). */
|
|
51
|
+
pages;
|
|
52
|
+
/**
|
|
53
|
+
* A lookahead search the last layout left to finish (#180): its pages
|
|
54
|
+
* are a preview's until it does. A build session runs it on in idle time,
|
|
55
|
+
* and the next layout of the same list follows what it found.
|
|
56
|
+
*/
|
|
57
|
+
search;
|
|
58
|
+
/**
|
|
59
|
+
* How long a lookahead search after an edit runs before the layout
|
|
60
|
+
* leaves it to finish and shows a preview (`approximateBreaks`): called
|
|
61
|
+
* as the search starts, it gives what says, between slices (`lookahead.ts`'s
|
|
62
|
+
* `SLICE`), whether to go on. Unset, every search finishes. A build
|
|
63
|
+
* session's (`BuildSessionOptions.previewMs`): the clock decides only
|
|
64
|
+
* whether a preview is shown first, never what is written.
|
|
65
|
+
*/
|
|
66
|
+
preview;
|
|
67
|
+
/**
|
|
68
|
+
* Set while a build session swaps a finished search's pages in for a
|
|
69
|
+
* preview's a run at a time (#199): the layout follows the search's
|
|
70
|
+
* breaks for this many pages past where they part from the last
|
|
71
|
+
* layout's, then takes up the last layout's again, its pages still a
|
|
72
|
+
* preview's (the search left in {@link search} for the next run).
|
|
73
|
+
*/
|
|
74
|
+
swap;
|
|
75
|
+
/**
|
|
76
|
+
* Lays the last build's HTML out again, with nothing read or rendered
|
|
77
|
+
* again (`layoutAgain`), and gives what the layout stage gives of it:
|
|
78
|
+
* what a run of a swap is (#199). Undefined if the pages, exact, moved a
|
|
79
|
+
* page number, so that the book must be built again.
|
|
80
|
+
*/
|
|
81
|
+
again;
|
|
82
|
+
stats = { hits: 0, misses: 0, pages: 0 };
|
|
83
|
+
/**
|
|
84
|
+
* The page counter each element of a reused container sets (`counter-reset:
|
|
85
|
+
* page`, `counter-set: page`), read while it was in the document: its
|
|
86
|
+
* elements are the last layout's, out of the document now.
|
|
87
|
+
*/
|
|
88
|
+
resets = new WeakMap();
|
|
89
|
+
/** Pages' margin boxes by what they were made from, for a page made from the same (`MarginBoxOptions.cache`). */
|
|
90
|
+
margins = new Map();
|
|
91
|
+
/** How many times each page element was made or changed (renumbered, its margin boxes made again), for what shows the pages to know which to show again. */
|
|
92
|
+
revisions = new WeakMap();
|
|
93
|
+
/** Notes that a page element was made, or changed. */
|
|
94
|
+
revise(page) {
|
|
95
|
+
this.revisions.set(page, (this.revisions.get(page) ?? 0) + 1);
|
|
96
|
+
}
|
|
97
|
+
/** Starts a layout. */
|
|
98
|
+
begin() {
|
|
99
|
+
this.last = this.next;
|
|
100
|
+
this.next = new Map();
|
|
101
|
+
this.journal = [];
|
|
102
|
+
this.stats = { hits: 0, misses: 0, pages: 0 };
|
|
103
|
+
}
|
|
104
|
+
/** The last layout's entry of the element's key, of the kind asked for, if it was laid out from `key`. */
|
|
105
|
+
find(el, kind, key) {
|
|
106
|
+
const found = this.entry(el, kind);
|
|
107
|
+
return found?.key === key ? found : undefined;
|
|
108
|
+
}
|
|
109
|
+
/** Whether the last layout has an entry of the kind for the element's key at all: whether it is worth working out its key. */
|
|
110
|
+
has(el, kind) {
|
|
111
|
+
return this.entry(el, kind) !== undefined;
|
|
112
|
+
}
|
|
113
|
+
entry(el, kind) {
|
|
114
|
+
const id = el.dataset['pwKey'];
|
|
115
|
+
const found = id === undefined ? undefined : this.last.get(id);
|
|
116
|
+
return found?.kind === kind ? found : undefined;
|
|
117
|
+
}
|
|
118
|
+
/** Keeps an entry for the next layout, reused or new, and, with a container, what it carries. */
|
|
119
|
+
keep(el, entry, reused) {
|
|
120
|
+
const id = el.dataset['pwKey'];
|
|
121
|
+
if (id !== undefined)
|
|
122
|
+
this.put(id, entry);
|
|
123
|
+
if (entry.kind === 'container') {
|
|
124
|
+
// What was laid out in it was kept as it was; what is reused with it is kept again.
|
|
125
|
+
if (reused) {
|
|
126
|
+
for (const [k, e] of entry.inside) {
|
|
127
|
+
this.put(k, e);
|
|
128
|
+
if (e.kind === 'paragraph')
|
|
129
|
+
this.stats.hits++;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
else if (reused)
|
|
134
|
+
this.stats.hits++;
|
|
135
|
+
else
|
|
136
|
+
this.stats.misses++;
|
|
137
|
+
}
|
|
138
|
+
put(id, entry) {
|
|
139
|
+
this.next.set(id, entry);
|
|
140
|
+
this.journal.push([id, entry]);
|
|
141
|
+
}
|
|
142
|
+
/** Where the journal of what is kept stands, and what was kept since: what a container carries. */
|
|
143
|
+
mark() {
|
|
144
|
+
return this.journal.length;
|
|
145
|
+
}
|
|
146
|
+
since(mark) {
|
|
147
|
+
return this.journal.slice(mark);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../src/layout/cache.ts"],"names":[],"mappings":"AAqFA;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,uBAAuB;IAChH,yBAAyB,EAAE,cAAc,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,aAAa;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CAAA;QACzC,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;YAC/B,oFAAoF;YACpF,IAAI,MAAM,EAAE,CAAC;gBACX,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;oBAClC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;oBACd,IAAI,CAAC,CAAC,IAAI,KAAK,WAAW;wBAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAA;gBAC/C,CAAC;YACH,CAAC;QACH,CAAC;aAAM,IAAI,MAAM;YAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAA;;YAC/B,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAA;IAC1B,CAAC;IAEO,GAAG,CAAC,EAAU,EAAE,KAAkB;QACxC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,CAAC,CAAA;QACxB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAA;IAChC,CAAC;IAED,mGAAmG;IACnG,IAAI;QACF,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAA;IAC5B,CAAC;IAED,KAAK,CAAC,IAAY;QAChB,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IACjC,CAAC;CACF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PageBuilderPageEvent } from '../plugin/define.js';
|
|
1
2
|
import { type LaidPage, type LayoutWarning, type PageLayout, type PageLayoutOptions } from './pages.js';
|
|
2
3
|
/**
|
|
3
4
|
* Fills in the HTML whatever depends on the pages just laid out, returning
|
|
@@ -9,6 +10,15 @@ export interface BookLayoutOptions extends PageLayoutOptions {
|
|
|
9
10
|
resolvers?: readonly PageResolver[];
|
|
10
11
|
/** The most layouts: 3. */
|
|
11
12
|
maxPasses?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Whether the stylesheet may give `::before` and `::after` content that
|
|
15
|
+
* depends on the pages (`--pw-content-before`, `--pw-content-after`),
|
|
16
|
+
* which every element is read for (`writeGeneratedContent`): true if
|
|
17
|
+
* absent. The layout stage says false for a stylesheet with none.
|
|
18
|
+
*/
|
|
19
|
+
generatedContent?: boolean;
|
|
20
|
+
/** Fired read-only after the pages settle, so a hook cannot change the layout or depend on another hook. */
|
|
21
|
+
onPage?: (event: PageBuilderPageEvent) => void;
|
|
12
22
|
}
|
|
13
23
|
export type { LayoutWarning } from './pages.js';
|
|
14
24
|
export interface BookLayout extends PageLayout {
|
|
@@ -22,6 +32,24 @@ export interface BookLayout extends PageLayout {
|
|
|
22
32
|
* ends with the page numbers of the last layout filled in.
|
|
23
33
|
*/
|
|
24
34
|
export declare function layoutBook(html: HTMLElement, opts: BookLayoutOptions): BookLayout;
|
|
35
|
+
/**
|
|
36
|
+
* Lays `html`, as `layoutBook` left it, out once more, with nothing read
|
|
37
|
+
* or rendered again: a run of a build session's swap (#199), the cache's
|
|
38
|
+
* last layout its start. Its pages' numbers are filled in, unless they are
|
|
39
|
+
* a preview's (the cache's `search` left `approximate`); undefined if that
|
|
40
|
+
* changed any, as the book must then be built again.
|
|
41
|
+
*/
|
|
42
|
+
export declare function layoutAgain(html: HTMLElement, opts: BookLayoutOptions): PageLayout | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Keys every link under `root` that has no key of its own: none, or its
|
|
45
|
+
* parent's (a resolver's new HTML keyed as what it replaced, as citations'
|
|
46
|
+
* is). It, and those of its descendants keyed as it was, are keyed
|
|
47
|
+
* `<key>:a<n>` after its nearest keyed ancestor's key, the first `n` no
|
|
48
|
+
* element has: a key no rendered element has, so a lookup of its node or
|
|
49
|
+
* source goes on to the ancestor's, as an index's locators are keyed
|
|
50
|
+
* (`<key>:<n>`, #161).
|
|
51
|
+
*/
|
|
52
|
+
export declare function keyLinks(root: HTMLElement): void;
|
|
25
53
|
/**
|
|
26
54
|
* The core's resolver: each page number the renderer left for the layout
|
|
27
55
|
* (`[data-pw-generated="page"]`, in a page reference's link) becomes the
|
package/dist/layout/converge.js
CHANGED
|
@@ -11,7 +11,18 @@
|
|
|
11
11
|
* fill in: the core's own, {@link pageReferences}, fills every page number
|
|
12
12
|
* the renderer left for the layout, `targetCounters` the stylesheet's
|
|
13
13
|
* `target-counter()`s (`generated.ts`), and `indexPages` every index's
|
|
14
|
-
* locators (`indexes/layout.ts`)
|
|
14
|
+
* locators (`indexes/layout.ts`), and a plugin's resolvers
|
|
15
|
+
* (`layout.resolvers`) whatever else it fills in.
|
|
16
|
+
*
|
|
17
|
+
* Before each layout, every link (`a[href]`) without a key of its own, one
|
|
18
|
+
* a resolver added or one keyed as its parent is, is keyed after its
|
|
19
|
+
* nearest keyed ancestor ({@link keyLinks}), so a tagged PDF has it as a
|
|
20
|
+
* `Link` holding its annotation (#181).
|
|
21
|
+
*
|
|
22
|
+
* Given a cache (`ListOptions.cache`), each layout starts from the last
|
|
23
|
+
* (`cache.ts`): its paragraphs are reused, and its pages kept, but those
|
|
24
|
+
* from the first that changed to where the pages are the same again,
|
|
25
|
+
* whether the last layout was this build's or the build before's.
|
|
15
26
|
*/
|
|
16
27
|
import { indexPages } from '../indexes/layout.js';
|
|
17
28
|
import { targetCounters, writeGeneratedContent } from './generated.js';
|
|
@@ -22,24 +33,73 @@ import { languageOf, layoutPages } from './pages.js';
|
|
|
22
33
|
* ends with the page numbers of the last layout filled in.
|
|
23
34
|
*/
|
|
24
35
|
export function layoutBook(html, opts) {
|
|
25
|
-
const resolvers =
|
|
36
|
+
const resolvers = resolversOf(opts);
|
|
26
37
|
const max = opts.maxPasses ?? 3;
|
|
27
38
|
// `target-counter()` in `::before` and `::after`, written as text: read
|
|
28
39
|
// from the styles, so `html` is put in the document if it isn't.
|
|
29
40
|
const attached = html.isConnected;
|
|
30
41
|
if (!attached)
|
|
31
42
|
opts.container.append(html);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
html.remove();
|
|
43
|
+
if (opts.generatedContent !== false)
|
|
44
|
+
writeGeneratedContent(html);
|
|
35
45
|
// The copy is out of the document, so it is told the language `html` is in.
|
|
36
46
|
const lang = opts.lang ?? languageOf(html) ?? languageOf(opts.container) ?? 'und';
|
|
47
|
+
// An incremental layout lays out only what changed: the book itself is
|
|
48
|
+
// out of the document meanwhile, so the browser doesn't lay it out either.
|
|
49
|
+
const place = attached && opts.cache ? { parent: html.parentNode, next: html.nextSibling } : undefined;
|
|
50
|
+
if (!attached || place)
|
|
51
|
+
html.remove();
|
|
52
|
+
try {
|
|
53
|
+
return passes(html, { ...opts, lang }, resolvers, max);
|
|
54
|
+
}
|
|
55
|
+
finally {
|
|
56
|
+
if (place)
|
|
57
|
+
place.parent.insertBefore(html, place.next);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Lays `html`, as `layoutBook` left it, out once more, with nothing read
|
|
62
|
+
* or rendered again: a run of a build session's swap (#199), the cache's
|
|
63
|
+
* last layout its start. Its pages' numbers are filled in, unless they are
|
|
64
|
+
* a preview's (the cache's `search` left `approximate`); undefined if that
|
|
65
|
+
* changed any, as the book must then be built again.
|
|
66
|
+
*/
|
|
67
|
+
export function layoutAgain(html, opts) {
|
|
68
|
+
const lang = opts.lang ?? languageOf(html) ?? languageOf(opts.container) ?? 'und';
|
|
69
|
+
opts.cache?.begin();
|
|
70
|
+
const layout = layoutPages(html.cloneNode(true), { ...opts, lang });
|
|
71
|
+
if (opts.cache?.pages?.search?.approximate) {
|
|
72
|
+
firePageHooks(opts.onPage, layout.pages);
|
|
73
|
+
return layout;
|
|
74
|
+
}
|
|
75
|
+
const changed = resolversOf(opts).flatMap((r) => r(layout.pages, html));
|
|
76
|
+
if (changed.length)
|
|
77
|
+
return undefined;
|
|
78
|
+
firePageHooks(opts.onPage, layout.pages);
|
|
79
|
+
return layout;
|
|
80
|
+
}
|
|
81
|
+
function resolversOf(opts) {
|
|
82
|
+
return [pageReferences, targetCounters, indexPages, ...(opts.resolvers ?? [])];
|
|
83
|
+
}
|
|
84
|
+
/** A plugin's page-builder hook, after the pages have settled, so its order cannot change them. */
|
|
85
|
+
function firePageHooks(onPage, pages) {
|
|
86
|
+
if (!onPage)
|
|
87
|
+
return;
|
|
88
|
+
for (let i = 0; i < pages.length; i++)
|
|
89
|
+
onPage({ type: 'page', page: pages[i], pages: pages.slice(0, i + 1) });
|
|
90
|
+
}
|
|
91
|
+
function passes(html, opts, resolvers, max) {
|
|
37
92
|
for (let pass = 1;; pass++) {
|
|
38
|
-
|
|
93
|
+
opts.cache?.begin();
|
|
94
|
+
keyLinks(html);
|
|
95
|
+
const layout = layoutPages(html.cloneNode(true), opts);
|
|
39
96
|
const changed = resolvers.flatMap((r) => r(layout.pages, html));
|
|
40
|
-
if (!changed.length)
|
|
97
|
+
if (!changed.length) {
|
|
98
|
+
firePageHooks(opts.onPage, layout.pages);
|
|
41
99
|
return { ...layout, passes: pass };
|
|
100
|
+
}
|
|
42
101
|
if (pass >= max) {
|
|
102
|
+
firePageHooks(opts.onPage, layout.pages);
|
|
43
103
|
return {
|
|
44
104
|
...layout,
|
|
45
105
|
passes: pass,
|
|
@@ -50,8 +110,41 @@ export function layoutBook(html, opts) {
|
|
|
50
110
|
}],
|
|
51
111
|
};
|
|
52
112
|
}
|
|
53
|
-
|
|
54
|
-
|
|
113
|
+
// The next layout starts from these pages, if it can, and takes away those it doesn't keep.
|
|
114
|
+
if (!opts.cache)
|
|
115
|
+
for (const page of layout.pages)
|
|
116
|
+
page.element.remove();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Keys every link under `root` that has no key of its own: none, or its
|
|
121
|
+
* parent's (a resolver's new HTML keyed as what it replaced, as citations'
|
|
122
|
+
* is). It, and those of its descendants keyed as it was, are keyed
|
|
123
|
+
* `<key>:a<n>` after its nearest keyed ancestor's key, the first `n` no
|
|
124
|
+
* element has: a key no rendered element has, so a lookup of its node or
|
|
125
|
+
* source goes on to the ancestor's, as an index's locators are keyed
|
|
126
|
+
* (`<key>:<n>`, #161).
|
|
127
|
+
*/
|
|
128
|
+
export function keyLinks(root) {
|
|
129
|
+
let used;
|
|
130
|
+
for (const a of root.querySelectorAll('a[href]')) {
|
|
131
|
+
const own = a.dataset.pwKey;
|
|
132
|
+
const parent = a.parentElement?.closest('[data-pw-key]')?.dataset.pwKey;
|
|
133
|
+
if (own !== undefined && own !== parent)
|
|
134
|
+
continue;
|
|
135
|
+
if (parent === undefined)
|
|
136
|
+
continue;
|
|
137
|
+
used ??= new Set([...root.querySelectorAll('[data-pw-key]')].map((e) => e.dataset.pwKey));
|
|
138
|
+
let n = 0;
|
|
139
|
+
while (used.has(`${parent}:a${n}`))
|
|
140
|
+
n++;
|
|
141
|
+
const key = `${parent}:a${n}`;
|
|
142
|
+
used.add(key);
|
|
143
|
+
a.dataset.pwKey = key;
|
|
144
|
+
if (own !== undefined)
|
|
145
|
+
for (const el of a.querySelectorAll('*'))
|
|
146
|
+
if (el.dataset.pwKey === own)
|
|
147
|
+
el.dataset.pwKey = key;
|
|
55
148
|
}
|
|
56
149
|
}
|
|
57
150
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"converge.js","sourceRoot":"","sources":["../../src/layout/converge.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"converge.js","sourceRoot":"","sources":["../../src/layout/converge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEjD,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AACtE,OAAO,EAAiB,UAAU,EAA+D,WAAW,EAAE,MAAM,YAAY,CAAA;AAgChI;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,IAAiB,EAAE,IAAuB;IACnE,MAAM,SA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;AACH,MAAM,UAAU,cAAc,CAAC,KAA0B,EAAE,IAAiB;IAC1E,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAA;IACvC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,MAAM,CAAC;YAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;gBAAE,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,CAAA;IAC7G,CAAC;IACD,MAAM,OAAO,GAAc,EAAE,CAAA;IAC7B,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,gBAAgB,CAAc,4BAA4B,CAAC,EAAE,CAAC;QACpF,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAc,gCAAgC,CAAC,CAAA;QACvE,MAAM,MAAM,GAAG,GAAG,EAAE,OAAO,CAAC,QAAQ,IAAI,GAAG,EAAE,YAAY,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAA;QAC3E,IAAI,CAAC,MAAM;YAAE,SAAQ;QACrB,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,CAAA;QACvC,IAAI,IAAI,CAAC,WAAW,KAAK,KAAK,EAAE,CAAC;YAC/B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAA;YACxB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACpB,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
|
@@ -14,3 +14,7 @@ export declare function isCounterStyle(s: string): s is CounterStyle;
|
|
|
14
14
|
* the alphabetic styles below 1, are written in decimal.
|
|
15
15
|
*/
|
|
16
16
|
export declare function formatCounter(n: number, style?: CounterStyle): string;
|
|
17
|
+
/** A counter's value in a `counter-reset`-like list (`page 3 chapter`); `fallback` when it has none. */
|
|
18
|
+
export declare function counterValue(value: string, name: string, fallback?: number): number | undefined;
|
|
19
|
+
/** The page counter an element sets as it starts (`counter-set: page`, else `counter-reset: page`), if it does. */
|
|
20
|
+
export declare function pageCounterOf(cs: CSSStyleDeclaration): number | undefined;
|
package/dist/layout/counters.js
CHANGED
|
@@ -59,4 +59,19 @@ export function formatCounter(n, style = 'decimal') {
|
|
|
59
59
|
return String(n);
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
+
/** A counter's value in a `counter-reset`-like list (`page 3 chapter`); `fallback` when it has none. */
|
|
63
|
+
export function counterValue(value, name, fallback = 0) {
|
|
64
|
+
const ws = value.trim().split(/\s+/);
|
|
65
|
+
for (let i = 0; i < ws.length; i++) {
|
|
66
|
+
if (ws[i] !== name)
|
|
67
|
+
continue;
|
|
68
|
+
const n = ws[i + 1] !== undefined && /^[-+]?\d+$/.test(ws[i + 1]) ? Number.parseInt(ws[i + 1], 10) : fallback;
|
|
69
|
+
return n;
|
|
70
|
+
}
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
/** The page counter an element sets as it starts (`counter-set: page`, else `counter-reset: page`), if it does. */
|
|
74
|
+
export function pageCounterOf(cs) {
|
|
75
|
+
return counterValue(cs.getPropertyValue('counter-set'), 'page') ?? counterValue(cs.counterReset, 'page');
|
|
76
|
+
}
|
|
62
77
|
//# sourceMappingURL=counters.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"counters.js","sourceRoot":"","sources":["../../src/layout/counters.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,+CAA+C;AAC/C,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,SAAS,EAAE,sBAAsB,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa;IAC3H,aAAa,EAAE,MAAM;CACb,CAAA;AAIV,MAAM,UAAU,cAAc,CAAC,CAAS;IACt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AAa,EAAE,IAAY,EAAE,QAAQ,GAAG,CAAC;IACpE,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACnC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI;YAAE,SAAQ;QAC5B,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,SAAS,IAAI,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAA;QAC/G,OAAO,CAAC,CAAA;IACV,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,mHAAmH;AACnH,MAAM,UAAU,aAAa,CAAC,EAAuB;IACnD,OAAO,YAAY,CAAC,EAAE,CAAC,gBAAgB,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC,IAAI,YAAY,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,CAAC,CAAA;AAC1G,CAAC"}
|
package/dist/layout/index.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
export { calibrateSize } from './calibrate.js';
|
|
2
|
+
export { PROTRUSION_FACTORS, protrusionFactor, type ProtrusionFactor } from './protrusion.js';
|
|
2
3
|
export { type FontFaceOptions, FontRegistry, splitFamilies } from './fonts.js';
|
|
3
4
|
export { DEFAULT_WORD_SPACE, parseGlue, parseLength } from './glue.js';
|
|
4
5
|
export { type InsertedHyphen, type LaidOutLine, type MigratedElement, type ParagraphLayout, type ParagraphOptions, type TextAlignment, textAlignment, endsSentence, isAtomicInline, layoutParagraph, OBJECT_REPLACEMENT, } from './paragraph.js';
|
|
5
6
|
export { type BuiltPage, type PageGeometry, type PageOptions, buildPage } from './page.js';
|
|
6
7
|
export { type BookLayout, type BookLayoutOptions, layoutBook, type LayoutWarning, pageReferences, type PageResolver } from './converge.js';
|
|
7
|
-
export { type BuilderGlue, type PageContent, type GlueSet, glueAdjustment, type InsertClass, type InsertParameters, natural, type NullBox, PageBuilder, type PageBuilderOptions, type PageItem, type PageMarks, type PlacedInsert, pruneTop, scaled, vertBreak, vpack, } from './pagebuilder.js';
|
|
8
|
-
export { type LaidPage, layoutPages, type PageLayout, type PageLayoutOptions } from './pages.js';
|
|
8
|
+
export { type BuilderGlue, type PageContent, type GlueSet, glueAdjustment, type HeldInsert, type InsertClass, type InsertParameters, type MarkValues, natural, type NullBox, PageBuilder, type PageBuilderOptions, type PageBuilderState, type PageItem, type PageMarks, type PlacedInsert, pruneTop, scaled, vertBreak, vpack, } from './pagebuilder.js';
|
|
9
|
+
export { type KeptPage, type LaidPage, type LaidRegion, layoutPages, type PageLayout, type PageLayoutOptions, type PageLayoutState } from './pages.js';
|
|
10
|
+
export { balancedColumnHeight, type ColumnSplit, DEFAULT_FLOW, pageRegions, pluginTemplatesCss, type RegionBox, type RegionColumn, resolveLength, splitColumns, } from './templates.js';
|
|
11
|
+
export { type CachedLine, type CachedParagraph, type CacheStats, LayoutCache, PARAGRAPH_STYLE, paragraphKey } from './cache.js';
|
|
9
12
|
export { COUNTER_STYLES, type CounterStyle, formatCounter } from './counters.js';
|
|
10
13
|
export { targetCounters, writeGeneratedContent } from './generated.js';
|
|
11
14
|
export { type ContentPart, type MarginContext, makeMarginBoxes, type MarkPolicy, parseContent } from './margin-boxes.js';
|
package/dist/layout/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { calibrateSize } from './calibrate.js';
|
|
2
|
+
export { PROTRUSION_FACTORS, protrusionFactor } from './protrusion.js';
|
|
2
3
|
export { FontRegistry, splitFamilies } from './fonts.js';
|
|
3
4
|
export { DEFAULT_WORD_SPACE, parseGlue, parseLength } from './glue.js';
|
|
4
5
|
export { textAlignment, endsSentence, isAtomicInline, layoutParagraph, OBJECT_REPLACEMENT, } from './paragraph.js';
|
|
@@ -6,6 +7,8 @@ export { buildPage } from './page.js';
|
|
|
6
7
|
export { layoutBook, pageReferences } from './converge.js';
|
|
7
8
|
export { glueAdjustment, natural, PageBuilder, pruneTop, scaled, vertBreak, vpack, } from './pagebuilder.js';
|
|
8
9
|
export { layoutPages } from './pages.js';
|
|
10
|
+
export { balancedColumnHeight, DEFAULT_FLOW, pageRegions, pluginTemplatesCss, resolveLength, splitColumns, } from './templates.js';
|
|
11
|
+
export { LayoutCache, PARAGRAPH_STYLE, paragraphKey } from './cache.js';
|
|
9
12
|
export { COUNTER_STYLES, formatCounter } from './counters.js';
|
|
10
13
|
export { targetCounters, writeGeneratedContent } from './generated.js';
|
|
11
14
|
export { makeMarginBoxes, parseContent } from './margin-boxes.js';
|
package/dist/layout/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EAAwB,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC9E,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AACtE,OAAO,EAEe,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,kBAAkB,GACrG,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAuD,SAAS,EAAE,MAAM,WAAW,CAAA;AAC1F,OAAO,EAA2C,UAAU,EAAsB,cAAc,EAAqB,MAAM,eAAe,CAAA;AAC1I,OAAO,EAC6C,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"AAAA,OAAO,EA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