pulpweaver4 0.0.0-stage → 0.0.91
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 +124 -0
- package/dist/ast/djot.js +464 -0
- package/dist/ast/djot.js.map +1 -0
- package/dist/ast/index.d.ts +10 -0
- package/dist/ast/index.js +11 -0
- package/dist/ast/index.js.map +1 -0
- package/dist/ast/locator.d.ts +27 -0
- package/dist/ast/locator.js +77 -0
- package/dist/ast/locator.js.map +1 -0
- package/dist/ast/nodes.d.ts +543 -0
- package/dist/ast/nodes.js +56 -0
- package/dist/ast/nodes.js.map +1 -0
- package/dist/ast/position.d.ts +88 -0
- package/dist/ast/position.js +98 -0
- package/dist/ast/position.js.map +1 -0
- package/dist/ast/traverse.d.ts +12 -0
- package/dist/ast/traverse.js +37 -0
- package/dist/ast/traverse.js.map +1 -0
- package/dist/bibliography/biblatex.d.ts +13 -0
- package/dist/bibliography/biblatex.js +849 -0
- package/dist/bibliography/biblatex.js.map +1 -0
- package/dist/bibliography/bibtex.d.ts +39 -0
- package/dist/bibliography/bibtex.js +259 -0
- package/dist/bibliography/bibtex.js.map +1 -0
- package/dist/bibliography/csl.d.ts +9 -0
- package/dist/bibliography/csl.js +241 -0
- package/dist/bibliography/csl.js.map +1 -0
- package/dist/bibliography/dates.d.ts +33 -0
- package/dist/bibliography/dates.js +223 -0
- package/dist/bibliography/dates.js.map +1 -0
- package/dist/bibliography/index.d.ts +8 -0
- package/dist/bibliography/index.js +9 -0
- package/dist/bibliography/index.js.map +1 -0
- package/dist/bibliography/item.d.ts +142 -0
- package/dist/bibliography/item.js +181 -0
- package/dist/bibliography/item.js.map +1 -0
- package/dist/bibliography/latex.d.ts +21 -0
- package/dist/bibliography/latex.js +586 -0
- package/dist/bibliography/latex.js.map +1 -0
- package/dist/bibliography/names.d.ts +23 -0
- package/dist/bibliography/names.js +244 -0
- package/dist/bibliography/names.js.map +1 -0
- package/dist/bibliography/read.d.ts +24 -0
- package/dist/bibliography/read.js +50 -0
- package/dist/bibliography/read.js.map +1 -0
- package/dist/citations/book.d.ts +93 -0
- package/dist/citations/book.js +217 -0
- package/dist/citations/book.js.map +1 -0
- package/dist/citations/collect.d.ts +56 -0
- package/dist/citations/collect.js +129 -0
- package/dist/citations/collect.js.map +1 -0
- package/dist/citations/hast.d.ts +12 -0
- package/dist/citations/hast.js +49 -0
- package/dist/citations/hast.js.map +1 -0
- package/dist/citations/index.d.ts +14 -0
- package/dist/citations/index.js +15 -0
- package/dist/citations/index.js.map +1 -0
- package/dist/citations/lint.d.ts +70 -0
- package/dist/citations/lint.js +92 -0
- package/dist/citations/lint.js.map +1 -0
- package/dist/citations/notes.d.ts +11 -0
- package/dist/citations/notes.js +163 -0
- package/dist/citations/notes.js.map +1 -0
- package/dist/citations/positions.d.ts +34 -0
- package/dist/citations/positions.js +90 -0
- package/dist/citations/positions.js.map +1 -0
- package/dist/citations/project.d.ts +7 -0
- package/dist/citations/project.js +24 -0
- package/dist/citations/project.js.map +1 -0
- package/dist/colour/cmyk.d.ts +71 -0
- package/dist/colour/cmyk.js +210 -0
- package/dist/colour/cmyk.js.map +1 -0
- package/dist/colour/images.d.ts +36 -0
- package/dist/colour/images.js +106 -0
- package/dist/colour/images.js.map +1 -0
- package/dist/colour/index.d.ts +7 -0
- package/dist/colour/index.js +8 -0
- package/dist/colour/index.js.map +1 -0
- package/dist/colour/ink-limit.d.ts +68 -0
- package/dist/colour/ink-limit.js +109 -0
- package/dist/colour/ink-limit.js.map +1 -0
- package/dist/colour/intents.d.ts +145 -0
- package/dist/colour/intents.js +193 -0
- package/dist/colour/intents.js.map +1 -0
- package/dist/colour/lcms.d.ts +79 -0
- package/dist/colour/lcms.js +229 -0
- package/dist/colour/lcms.js.map +1 -0
- package/dist/colour/previews.d.ts +49 -0
- package/dist/colour/previews.js +116 -0
- package/dist/colour/previews.js.map +1 -0
- package/dist/colour/wasm/LICENSE-lcms2 +22 -0
- package/dist/colour/wasm/lcms2.wasm +0 -0
- package/dist/config/config.d.ts +114 -0
- package/dist/config/config.js +309 -0
- package/dist/config/config.js.map +1 -0
- package/dist/config/index.d.ts +6 -0
- package/dist/config/index.js +7 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/page.d.ts +42 -0
- package/dist/config/page.js +95 -0
- package/dist/config/page.js.map +1 -0
- package/dist/config/project-schema.d.ts +23 -0
- package/dist/config/project-schema.js +223 -0
- package/dist/config/project-schema.js.map +1 -0
- package/dist/config/schema.d.ts +68 -0
- package/dist/config/schema.js +333 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/toml.d.ts +54 -0
- package/dist/config/toml.js +238 -0
- package/dist/config/toml.js.map +1 -0
- package/dist/contents/index.d.ts +8 -0
- package/dist/contents/index.js +9 -0
- package/dist/contents/index.js.map +1 -0
- package/dist/contents/transform.d.ts +64 -0
- package/dist/contents/transform.js +149 -0
- package/dist/contents/transform.js.map +1 -0
- package/dist/csl/affix.d.ts +16 -0
- package/dist/csl/affix.js +74 -0
- package/dist/csl/affix.js.map +1 -0
- package/dist/csl/data/chicago-author-date.d.ts +2 -0
- package/dist/csl/data/chicago-author-date.js +3 -0
- package/dist/csl/data/chicago-author-date.js.map +1 -0
- package/dist/csl/data/chicago-notes-bibliography.d.ts +2 -0
- package/dist/csl/data/chicago-notes-bibliography.js +3 -0
- package/dist/csl/data/chicago-notes-bibliography.js.map +1 -0
- package/dist/csl/data/locales-en-GB.d.ts +2 -0
- package/dist/csl/data/locales-en-GB.js +3 -0
- package/dist/csl/data/locales-en-GB.js.map +1 -0
- package/dist/csl/data/locales-en-US.d.ts +2 -0
- package/dist/csl/data/locales-en-US.js +3 -0
- package/dist/csl/data/locales-en-US.js.map +1 -0
- package/dist/csl/dates.d.ts +30 -0
- package/dist/csl/dates.js +223 -0
- package/dist/csl/dates.js.map +1 -0
- package/dist/csl/format.d.ts +29 -0
- package/dist/csl/format.js +157 -0
- package/dist/csl/format.js.map +1 -0
- package/dist/csl/index.d.ts +26 -0
- package/dist/csl/index.js +16 -0
- package/dist/csl/index.js.map +1 -0
- package/dist/csl/ir.d.ts +103 -0
- package/dist/csl/ir.js +549 -0
- package/dist/csl/ir.js.map +1 -0
- package/dist/csl/load.d.ts +98 -0
- package/dist/csl/load.js +163 -0
- package/dist/csl/load.js.map +1 -0
- package/dist/csl/locale.d.ts +90 -0
- package/dist/csl/locale.js +251 -0
- package/dist/csl/locale.js.map +1 -0
- package/dist/csl/names.d.ts +41 -0
- package/dist/csl/names.js +203 -0
- package/dist/csl/names.js.map +1 -0
- package/dist/csl/numbers.d.ts +48 -0
- package/dist/csl/numbers.js +170 -0
- package/dist/csl/numbers.js.map +1 -0
- package/dist/csl/processor.d.ts +179 -0
- package/dist/csl/processor.js +765 -0
- package/dist/csl/processor.js.map +1 -0
- package/dist/csl/project.d.ts +21 -0
- package/dist/csl/project.js +85 -0
- package/dist/csl/project.js.map +1 -0
- package/dist/csl/render.d.ts +130 -0
- package/dist/csl/render.js +748 -0
- package/dist/csl/render.js.map +1 -0
- package/dist/csl/style.d.ts +168 -0
- package/dist/csl/style.js +262 -0
- package/dist/csl/style.js.map +1 -0
- package/dist/csl/xml.d.ts +28 -0
- package/dist/csl/xml.js +162 -0
- package/dist/csl/xml.js.map +1 -0
- package/dist/djot/djot.js/LICENSE +20 -0
- package/dist/djot/djot.js/src/ast.d.ts +327 -0
- package/dist/djot/djot.js/src/ast.js +68 -0
- package/dist/djot/djot.js/src/ast.js.map +1 -0
- package/dist/djot/djot.js/src/attributes.d.ts +31 -0
- package/dist/djot/djot.js/src/attributes.js +300 -0
- package/dist/djot/djot.js/src/attributes.js.map +1 -0
- package/dist/djot/djot.js/src/block.d.ts +87 -0
- package/dist/djot/djot.js/src/block.js +1201 -0
- package/dist/djot/djot.js/src/block.js.map +1 -0
- package/dist/djot/djot.js/src/djot-renderer.d.ts +8 -0
- package/dist/djot/djot.js/src/djot-renderer.js +755 -0
- package/dist/djot/djot.js/src/djot-renderer.js.map +1 -0
- package/dist/djot/djot.js/src/event.d.ts +6 -0
- package/dist/djot/djot.js/src/event.js +2 -0
- package/dist/djot/djot.js/src/event.js.map +1 -0
- package/dist/djot/djot.js/src/filter.d.ts +13 -0
- package/dist/djot/djot.js/src/filter.js +159 -0
- package/dist/djot/djot.js/src/filter.js.map +1 -0
- package/dist/djot/djot.js/src/find.d.ts +7 -0
- package/dist/djot/djot.js/src/find.js +33 -0
- package/dist/djot/djot.js/src/find.js.map +1 -0
- package/dist/djot/djot.js/src/html.d.ts +40 -0
- package/dist/djot/djot.js/src/html.js +657 -0
- package/dist/djot/djot.js/src/html.js.map +1 -0
- package/dist/djot/djot.js/src/index.d.ts +9 -0
- package/dist/djot/djot.js/src/index.js +9 -0
- package/dist/djot/djot.js/src/index.js.map +1 -0
- package/dist/djot/djot.js/src/inline.d.ts +62 -0
- package/dist/djot/djot.js/src/inline.js +1032 -0
- package/dist/djot/djot.js/src/inline.js.map +1 -0
- package/dist/djot/djot.js/src/options.d.ts +13 -0
- package/dist/djot/djot.js/src/options.js +27 -0
- package/dist/djot/djot.js/src/options.js.map +1 -0
- package/dist/djot/djot.js/src/pandoc.d.ts +20 -0
- package/dist/djot/djot.js/src/pandoc.js +1110 -0
- package/dist/djot/djot.js/src/pandoc.js.map +1 -0
- package/dist/djot/djot.js/src/parse.d.ts +19 -0
- package/dist/djot/djot.js/src/parse.js +1445 -0
- package/dist/djot/djot.js/src/parse.js.map +1 -0
- package/dist/djot/djot.js/src/version.d.ts +1 -0
- package/dist/djot/djot.js/src/version.js +2 -0
- package/dist/djot/djot.js/src/version.js.map +1 -0
- package/dist/djot/index.d.ts +5 -0
- package/dist/djot/index.js +6 -0
- package/dist/djot/index.js.map +1 -0
- package/dist/djot/read.d.ts +57 -0
- package/dist/djot/read.js +146 -0
- package/dist/djot/read.js.map +1 -0
- package/dist/fonts/css.d.ts +82 -0
- package/dist/fonts/css.js +329 -0
- package/dist/fonts/css.js.map +1 -0
- package/dist/fonts/faces.d.ts +101 -0
- package/dist/fonts/faces.js +226 -0
- package/dist/fonts/faces.js.map +1 -0
- package/dist/fonts/index.d.ts +12 -0
- package/dist/fonts/index.js +13 -0
- package/dist/fonts/index.js.map +1 -0
- package/dist/fonts/lint.d.ts +58 -0
- package/dist/fonts/lint.js +209 -0
- package/dist/fonts/lint.js.map +1 -0
- package/dist/fonts/match.d.ts +36 -0
- package/dist/fonts/match.js +104 -0
- package/dist/fonts/match.js.map +1 -0
- package/dist/fonts/names.d.ts +9 -0
- package/dist/fonts/names.js +50 -0
- package/dist/fonts/names.js.map +1 -0
- package/dist/fonts/subset.d.ts +72 -0
- package/dist/fonts/subset.js +169 -0
- package/dist/fonts/subset.js.map +1 -0
- package/dist/fonts/walk.d.ts +33 -0
- package/dist/fonts/walk.js +120 -0
- package/dist/fonts/walk.js.map +1 -0
- package/dist/fonts/wasm/LICENSE-harfbuzzjs +19 -0
- package/dist/fonts/wasm/harfbuzz-subset.wasm +0 -0
- package/dist/html/check.d.ts +62 -0
- package/dist/html/check.js +186 -0
- package/dist/html/check.js.map +1 -0
- package/dist/html/counters.d.ts +32 -0
- package/dist/html/counters.js +72 -0
- package/dist/html/counters.js.map +1 -0
- package/dist/html/css.d.ts +33 -0
- package/dist/html/css.js +72 -0
- package/dist/html/css.js.map +1 -0
- package/dist/html/dom.d.ts +28 -0
- package/dist/html/dom.js +162 -0
- package/dist/html/dom.js.map +1 -0
- package/dist/html/editions.d.ts +26 -0
- package/dist/html/editions.js +57 -0
- package/dist/html/editions.js.map +1 -0
- package/dist/html/images.d.ts +13 -0
- package/dist/html/images.js +62 -0
- package/dist/html/images.js.map +1 -0
- package/dist/html/index.d.ts +14 -0
- package/dist/html/index.js +15 -0
- package/dist/html/index.js.map +1 -0
- package/dist/html/registry.d.ts +120 -0
- package/dist/html/registry.js +48 -0
- package/dist/html/registry.js.map +1 -0
- package/dist/html/render.d.ts +99 -0
- package/dist/html/render.js +694 -0
- package/dist/html/render.js.map +1 -0
- package/dist/hyphenation/NOTICE +429 -0
- package/dist/hyphenation/exceptions.d.ts +60 -0
- package/dist/hyphenation/exceptions.js +79 -0
- package/dist/hyphenation/exceptions.js.map +1 -0
- package/dist/hyphenation/hyphenator.d.ts +66 -0
- package/dist/hyphenation/hyphenator.js +245 -0
- package/dist/hyphenation/hyphenator.js.map +1 -0
- package/dist/hyphenation/index.d.ts +4 -0
- package/dist/hyphenation/index.js +5 -0
- package/dist/hyphenation/index.js.map +1 -0
- package/dist/hyphenation/languages.d.ts +20 -0
- package/dist/hyphenation/languages.js +75 -0
- package/dist/hyphenation/languages.js.map +1 -0
- package/dist/hyphenation/patterns/af.wasm +0 -0
- package/dist/hyphenation/patterns/as.wasm +0 -0
- package/dist/hyphenation/patterns/be.wasm +0 -0
- package/dist/hyphenation/patterns/bg.wasm +0 -0
- package/dist/hyphenation/patterns/bn.wasm +0 -0
- package/dist/hyphenation/patterns/ca.wasm +0 -0
- package/dist/hyphenation/patterns/cy.wasm +0 -0
- package/dist/hyphenation/patterns/da.wasm +0 -0
- package/dist/hyphenation/patterns/de.wasm +0 -0
- package/dist/hyphenation/patterns/el-monoton.wasm +0 -0
- package/dist/hyphenation/patterns/el-polyton.wasm +0 -0
- package/dist/hyphenation/patterns/en-gb.wasm +0 -0
- package/dist/hyphenation/patterns/en-us.wasm +0 -0
- package/dist/hyphenation/patterns/eo.wasm +0 -0
- package/dist/hyphenation/patterns/es.wasm +0 -0
- package/dist/hyphenation/patterns/et.wasm +0 -0
- package/dist/hyphenation/patterns/eu.wasm +0 -0
- package/dist/hyphenation/patterns/fi-x-school.wasm +0 -0
- package/dist/hyphenation/patterns/fr.wasm +0 -0
- package/dist/hyphenation/patterns/fur.wasm +0 -0
- package/dist/hyphenation/patterns/ga.wasm +0 -0
- package/dist/hyphenation/patterns/gl.wasm +0 -0
- package/dist/hyphenation/patterns/gu.wasm +0 -0
- package/dist/hyphenation/patterns/hi.wasm +0 -0
- package/dist/hyphenation/patterns/hr.wasm +0 -0
- package/dist/hyphenation/patterns/hsb.wasm +0 -0
- package/dist/hyphenation/patterns/ia.wasm +0 -0
- package/dist/hyphenation/patterns/is.wasm +0 -0
- package/dist/hyphenation/patterns/it.wasm +0 -0
- package/dist/hyphenation/patterns/ka.wasm +0 -0
- package/dist/hyphenation/patterns/kmr.wasm +0 -0
- package/dist/hyphenation/patterns/kn.wasm +0 -0
- package/dist/hyphenation/patterns/la.wasm +0 -0
- package/dist/hyphenation/patterns/lt.wasm +0 -0
- package/dist/hyphenation/patterns/ml.wasm +0 -0
- package/dist/hyphenation/patterns/mn-cyrl.wasm +0 -0
- package/dist/hyphenation/patterns/mr.wasm +0 -0
- package/dist/hyphenation/patterns/nb.wasm +0 -0
- package/dist/hyphenation/patterns/nl.wasm +0 -0
- package/dist/hyphenation/patterns/nn.wasm +0 -0
- package/dist/hyphenation/patterns/no.wasm +0 -0
- package/dist/hyphenation/patterns/oc.wasm +0 -0
- package/dist/hyphenation/patterns/or.wasm +0 -0
- package/dist/hyphenation/patterns/pa.wasm +0 -0
- package/dist/hyphenation/patterns/pi.wasm +0 -0
- package/dist/hyphenation/patterns/pl.wasm +0 -0
- package/dist/hyphenation/patterns/pms.wasm +0 -0
- package/dist/hyphenation/patterns/pt.wasm +0 -0
- package/dist/hyphenation/patterns/rm.wasm +0 -0
- package/dist/hyphenation/patterns/ru.wasm +0 -0
- package/dist/hyphenation/patterns/sh-cyrl.wasm +0 -0
- package/dist/hyphenation/patterns/sh-latn.wasm +0 -0
- package/dist/hyphenation/patterns/sk.wasm +0 -0
- package/dist/hyphenation/patterns/sl.wasm +0 -0
- package/dist/hyphenation/patterns/sq.wasm +0 -0
- package/dist/hyphenation/patterns/sv.wasm +0 -0
- package/dist/hyphenation/patterns/ta.wasm +0 -0
- package/dist/hyphenation/patterns/te.wasm +0 -0
- package/dist/hyphenation/patterns/th.wasm +0 -0
- package/dist/hyphenation/patterns/tk.wasm +0 -0
- package/dist/hyphenation/patterns/tr.wasm +0 -0
- package/dist/hyphenation/patterns/uk.wasm +0 -0
- package/dist/hyphenation/patterns/zh-latn-pinyin.wasm +0 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.js +48 -0
- package/dist/index.js.map +1 -0
- package/dist/indexes/index.d.ts +10 -0
- package/dist/indexes/index.js +11 -0
- package/dist/indexes/index.js.map +1 -0
- package/dist/indexes/layout.d.ts +30 -0
- package/dist/indexes/layout.js +83 -0
- package/dist/indexes/layout.js.map +1 -0
- package/dist/indexes/locators.d.ts +33 -0
- package/dist/indexes/locators.js +51 -0
- package/dist/indexes/locators.js.map +1 -0
- package/dist/indexes/terms.d.ts +97 -0
- package/dist/indexes/terms.js +211 -0
- package/dist/indexes/terms.js.map +1 -0
- package/dist/indexes/transform.d.ts +90 -0
- package/dist/indexes/transform.js +154 -0
- package/dist/indexes/transform.js.map +1 -0
- package/dist/layout/calibrate.d.ts +12 -0
- package/dist/layout/calibrate.js +50 -0
- package/dist/layout/calibrate.js.map +1 -0
- package/dist/layout/converge.d.ts +31 -0
- package/dist/layout/converge.js +84 -0
- package/dist/layout/converge.js.map +1 -0
- package/dist/layout/counters.d.ts +16 -0
- package/dist/layout/counters.js +62 -0
- package/dist/layout/counters.js.map +1 -0
- package/dist/layout/first-letter.d.ts +34 -0
- package/dist/layout/first-letter.js +183 -0
- package/dist/layout/first-letter.js.map +1 -0
- package/dist/layout/fonts.d.ts +67 -0
- package/dist/layout/fonts.js +110 -0
- package/dist/layout/fonts.js.map +1 -0
- package/dist/layout/generated.d.ts +9 -0
- package/dist/layout/generated.js +83 -0
- package/dist/layout/generated.js.map +1 -0
- package/dist/layout/glue.d.ts +18 -0
- package/dist/layout/glue.js +48 -0
- package/dist/layout/glue.js.map +1 -0
- package/dist/layout/index.d.ts +17 -0
- package/dist/layout/index.js +18 -0
- package/dist/layout/index.js.map +1 -0
- package/dist/layout/lists.d.ts +91 -0
- package/dist/layout/lists.js +1068 -0
- package/dist/layout/lists.js.map +1 -0
- package/dist/layout/margin-boxes.d.ts +114 -0
- package/dist/layout/margin-boxes.js +429 -0
- package/dist/layout/margin-boxes.js.map +1 -0
- package/dist/layout/minipage.d.ts +85 -0
- package/dist/layout/minipage.js +83 -0
- package/dist/layout/minipage.js.map +1 -0
- package/dist/layout/page-box.d.ts +34 -0
- package/dist/layout/page-box.js +112 -0
- package/dist/layout/page-box.js.map +1 -0
- package/dist/layout/page-rules.d.ts +49 -0
- package/dist/layout/page-rules.js +205 -0
- package/dist/layout/page-rules.js.map +1 -0
- package/dist/layout/page.d.ts +51 -0
- package/dist/layout/page.js +133 -0
- package/dist/layout/page.js.map +1 -0
- package/dist/layout/pagebuilder.d.ts +243 -0
- package/dist/layout/pagebuilder.js +591 -0
- package/dist/layout/pagebuilder.js.map +1 -0
- package/dist/layout/pages.d.ts +77 -0
- package/dist/layout/pages.js +772 -0
- package/dist/layout/pages.js.map +1 -0
- package/dist/layout/paragraph.d.ts +194 -0
- package/dist/layout/paragraph.js +1148 -0
- package/dist/layout/paragraph.js.map +1 -0
- package/dist/layout/pre.d.ts +8 -0
- package/dist/layout/pre.js +151 -0
- package/dist/layout/pre.js.map +1 -0
- package/dist/layout/region.d.ts +66 -0
- package/dist/layout/region.js +200 -0
- package/dist/layout/region.js.map +1 -0
- package/dist/layout/vlist.d.ts +218 -0
- package/dist/layout/vlist.js +72 -0
- package/dist/layout/vlist.js.map +1 -0
- package/dist/linebreak/items.d.ts +69 -0
- package/dist/linebreak/items.js +44 -0
- package/dist/linebreak/items.js.map +1 -0
- package/dist/linebreak/knuth-plass.d.ts +149 -0
- package/dist/linebreak/knuth-plass.js +461 -0
- package/dist/linebreak/knuth-plass.js.map +1 -0
- package/dist/lint/config.d.ts +48 -0
- package/dist/lint/config.js +185 -0
- package/dist/lint/config.js.map +1 -0
- package/dist/lint/context.d.ts +64 -0
- package/dist/lint/context.js +37 -0
- package/dist/lint/context.js.map +1 -0
- package/dist/lint/fix.d.ts +40 -0
- package/dist/lint/fix.js +86 -0
- package/dist/lint/fix.js.map +1 -0
- package/dist/lint/index.d.ts +14 -0
- package/dist/lint/index.js +15 -0
- package/dist/lint/index.js.map +1 -0
- package/dist/lint/linter.d.ts +59 -0
- package/dist/lint/linter.js +239 -0
- package/dist/lint/linter.js.map +1 -0
- package/dist/lint/presets.d.ts +20 -0
- package/dist/lint/presets.js +65 -0
- package/dist/lint/presets.js.map +1 -0
- package/dist/lint/project.d.ts +31 -0
- package/dist/lint/project.js +100 -0
- package/dist/lint/project.js.map +1 -0
- package/dist/lint/rules/html.d.ts +30 -0
- package/dist/lint/rules/html.js +163 -0
- package/dist/lint/rules/html.js.map +1 -0
- package/dist/lint/rules/layout.d.ts +42 -0
- package/dist/lint/rules/layout.js +428 -0
- package/dist/lint/rules/layout.js.map +1 -0
- package/dist/lint/rules/source.d.ts +67 -0
- package/dist/lint/rules/source.js +339 -0
- package/dist/lint/rules/source.js.map +1 -0
- package/dist/lint/testing.d.ts +7 -0
- package/dist/lint/testing.js +77 -0
- package/dist/lint/testing.js.map +1 -0
- package/dist/math/hast.d.ts +46 -0
- package/dist/math/hast.js +297 -0
- package/dist/math/hast.js.map +1 -0
- package/dist/math/index.d.ts +9 -0
- package/dist/math/index.js +10 -0
- package/dist/math/index.js.map +1 -0
- package/dist/math/mathjax/LICENSE-mathjax +202 -0
- package/dist/math/mathjax/LICENSE-speech-rule-engine +177 -0
- package/dist/math/mathjax/sre/af.json +146 -0
- package/dist/math/mathjax/sre/base.json +140 -0
- package/dist/math/mathjax/sre/ca.json +140 -0
- package/dist/math/mathjax/sre/da.json +140 -0
- package/dist/math/mathjax/sre/de.json +146 -0
- package/dist/math/mathjax/sre/en.json +158 -0
- package/dist/math/mathjax/sre/es.json +140 -0
- package/dist/math/mathjax/sre/euro.json +32 -0
- package/dist/math/mathjax/sre/fr.json +146 -0
- package/dist/math/mathjax/sre/hi.json +146 -0
- package/dist/math/mathjax/sre/it.json +146 -0
- package/dist/math/mathjax/sre/ko.json +146 -0
- package/dist/math/mathjax/sre/nb.json +146 -0
- package/dist/math/mathjax/sre/nemeth.json +125 -0
- package/dist/math/mathjax/sre/nn.json +146 -0
- package/dist/math/mathjax/sre/sv.json +146 -0
- package/dist/math/mathjax/svg/PUA.json +1 -0
- package/dist/math/mathjax/svg/accents-b-i.json +1 -0
- package/dist/math/mathjax/svg/accents.json +1 -0
- package/dist/math/mathjax/svg/arabic.json +1 -0
- package/dist/math/mathjax/svg/arrows.json +1 -0
- package/dist/math/mathjax/svg/braille-d.json +1 -0
- package/dist/math/mathjax/svg/braille.json +1 -0
- package/dist/math/mathjax/svg/calligraphic.json +1 -0
- package/dist/math/mathjax/svg/cherokee.json +1 -0
- package/dist/math/mathjax/svg/cyrillic-ss.json +1 -0
- package/dist/math/mathjax/svg/cyrillic.json +1 -0
- package/dist/math/mathjax/svg/devanagari.json +1 -0
- package/dist/math/mathjax/svg/double-struck.json +1 -0
- package/dist/math/mathjax/svg/fraktur.json +1 -0
- package/dist/math/mathjax/svg/greek-ss.json +1 -0
- package/dist/math/mathjax/svg/greek.json +1 -0
- package/dist/math/mathjax/svg/hebrew.json +1 -0
- package/dist/math/mathjax/svg/latin-b.json +1 -0
- package/dist/math/mathjax/svg/latin-bi.json +1 -0
- package/dist/math/mathjax/svg/latin-i.json +1 -0
- package/dist/math/mathjax/svg/latin.json +1 -0
- package/dist/math/mathjax/svg/marrows.json +1 -0
- package/dist/math/mathjax/svg/math.json +1 -0
- package/dist/math/mathjax/svg/monospace-ex.json +1 -0
- package/dist/math/mathjax/svg/monospace-l.json +1 -0
- package/dist/math/mathjax/svg/monospace.json +1 -0
- package/dist/math/mathjax/svg/mshapes.json +1 -0
- package/dist/math/mathjax/svg/phonetics-ss.json +1 -0
- package/dist/math/mathjax/svg/phonetics.json +1 -0
- package/dist/math/mathjax/svg/sans-serif-b.json +1 -0
- package/dist/math/mathjax/svg/sans-serif-bi.json +1 -0
- package/dist/math/mathjax/svg/sans-serif-ex.json +1 -0
- package/dist/math/mathjax/svg/sans-serif-i.json +1 -0
- package/dist/math/mathjax/svg/sans-serif-r.json +1 -0
- package/dist/math/mathjax/svg/sans-serif.json +1 -0
- package/dist/math/mathjax/svg/script.json +1 -0
- package/dist/math/mathjax/svg/shapes.json +1 -0
- package/dist/math/mathjax/svg/symbols-b-i.json +1 -0
- package/dist/math/mathjax/svg/symbols.json +1 -0
- package/dist/math/mathjax/svg/variants.json +1 -0
- package/dist/math/mathjax.d.ts +67 -0
- package/dist/math/mathjax.js +162 -0
- package/dist/math/mathjax.js.map +1 -0
- package/dist/math/speech.d.ts +27 -0
- package/dist/math/speech.js +87 -0
- package/dist/math/speech.js.map +1 -0
- package/dist/math/typeset.d.ts +75 -0
- package/dist/math/typeset.js +108 -0
- package/dist/math/typeset.js.map +1 -0
- package/dist/measure/css.d.ts +44 -0
- package/dist/measure/css.js +158 -0
- package/dist/measure/css.js.map +1 -0
- package/dist/measure/index.d.ts +3 -0
- package/dist/measure/index.js +4 -0
- package/dist/measure/index.js.map +1 -0
- package/dist/measure/measurer.d.ts +159 -0
- package/dist/measure/measurer.js +300 -0
- package/dist/measure/measurer.js.map +1 -0
- package/dist/measure/model.d.ts +46 -0
- package/dist/measure/model.js +47 -0
- package/dist/measure/model.js.map +1 -0
- package/dist/output/assets.d.ts +10 -0
- package/dist/output/assets.js +65 -0
- package/dist/output/assets.js.map +1 -0
- package/dist/output/index.d.ts +4 -0
- package/dist/output/index.js +5 -0
- package/dist/output/index.js.map +1 -0
- package/dist/output/output.d.ts +103 -0
- package/dist/output/output.js +86 -0
- package/dist/output/output.js.map +1 -0
- package/dist/output/stylesheets.d.ts +45 -0
- package/dist/output/stylesheets.js +50 -0
- package/dist/output/stylesheets.js.map +1 -0
- package/dist/paint/backgrounds.d.ts +56 -0
- package/dist/paint/backgrounds.js +261 -0
- package/dist/paint/backgrounds.js.map +1 -0
- package/dist/paint/blend.d.ts +61 -0
- package/dist/paint/blend.js +157 -0
- package/dist/paint/blend.js.map +1 -0
- package/dist/paint/border-image.d.ts +13 -0
- package/dist/paint/border-image.js +149 -0
- package/dist/paint/border-image.js.map +1 -0
- package/dist/paint/borders.d.ts +47 -0
- package/dist/paint/borders.js +329 -0
- package/dist/paint/borders.js.map +1 -0
- package/dist/paint/canvas.d.ts +52 -0
- package/dist/paint/canvas.js +274 -0
- package/dist/paint/canvas.js.map +1 -0
- package/dist/paint/colours.d.ts +55 -0
- package/dist/paint/colours.js +380 -0
- package/dist/paint/colours.js.map +1 -0
- package/dist/paint/columns.d.ts +11 -0
- package/dist/paint/columns.js +42 -0
- package/dist/paint/columns.js.map +1 -0
- package/dist/paint/context.d.ts +47 -0
- package/dist/paint/context.js +2 -0
- package/dist/paint/context.js.map +1 -0
- package/dist/paint/decoration.d.ts +97 -0
- package/dist/paint/decoration.js +280 -0
- package/dist/paint/decoration.js.map +1 -0
- package/dist/paint/effects.d.ts +64 -0
- package/dist/paint/effects.js +342 -0
- package/dist/paint/effects.js.map +1 -0
- package/dist/paint/emphasis.d.ts +13 -0
- package/dist/paint/emphasis.js +95 -0
- package/dist/paint/emphasis.js.map +1 -0
- package/dist/paint/flatten.d.ts +33 -0
- package/dist/paint/flatten.js +968 -0
- package/dist/paint/flatten.js.map +1 -0
- package/dist/paint/geometry.d.ts +62 -0
- package/dist/paint/geometry.js +170 -0
- package/dist/paint/geometry.js.map +1 -0
- package/dist/paint/gradients.d.ts +31 -0
- package/dist/paint/gradients.js +394 -0
- package/dist/paint/gradients.js.map +1 -0
- package/dist/paint/images.d.ts +17 -0
- package/dist/paint/images.js +80 -0
- package/dist/paint/images.js.map +1 -0
- package/dist/paint/lint.d.ts +46 -0
- package/dist/paint/lint.js +105 -0
- package/dist/paint/lint.js.map +1 -0
- package/dist/paint/overprint.d.ts +13 -0
- package/dist/paint/overprint.js +12 -0
- package/dist/paint/overprint.js.map +1 -0
- package/dist/paint/painter.d.ts +92 -0
- package/dist/paint/painter.js +281 -0
- package/dist/paint/painter.js.map +1 -0
- package/dist/paint/path.d.ts +9 -0
- package/dist/paint/path.js +173 -0
- package/dist/paint/path.js.map +1 -0
- package/dist/paint/raster.d.ts +32 -0
- package/dist/paint/raster.js +180 -0
- package/dist/paint/raster.js.map +1 -0
- package/dist/paint/shadows.d.ts +28 -0
- package/dist/paint/shadows.js +104 -0
- package/dist/paint/shadows.js.map +1 -0
- package/dist/paint/sources.d.ts +13 -0
- package/dist/paint/sources.js +17 -0
- package/dist/paint/sources.js.map +1 -0
- package/dist/paint/stacking.d.ts +75 -0
- package/dist/paint/stacking.js +327 -0
- package/dist/paint/stacking.js.map +1 -0
- package/dist/paint/svg-lint.d.ts +57 -0
- package/dist/paint/svg-lint.js +119 -0
- package/dist/paint/svg-lint.js.map +1 -0
- package/dist/paint/svg.d.ts +95 -0
- package/dist/paint/svg.js +728 -0
- package/dist/paint/svg.js.map +1 -0
- package/dist/paint/tables.d.ts +18 -0
- package/dist/paint/tables.js +178 -0
- package/dist/paint/tables.js.map +1 -0
- package/dist/paint/text-shadow.d.ts +26 -0
- package/dist/paint/text-shadow.js +187 -0
- package/dist/paint/text-shadow.js.map +1 -0
- package/dist/paint/text.d.ts +144 -0
- package/dist/paint/text.js +713 -0
- package/dist/paint/text.js.map +1 -0
- package/dist/paint/values.d.ts +24 -0
- package/dist/paint/values.js +160 -0
- package/dist/paint/values.js.map +1 -0
- package/dist/paint/vertical.d.ts +19 -0
- package/dist/paint/vertical.js +236 -0
- package/dist/paint/vertical.js.map +1 -0
- package/dist/pdf/index.d.ts +6 -0
- package/dist/pdf/index.js +7 -0
- package/dist/pdf/index.js.map +1 -0
- package/dist/pdf/pdfx.d.ts +30 -0
- package/dist/pdf/pdfx.js +18 -0
- package/dist/pdf/pdfx.js.map +1 -0
- package/dist/pdf/structure/index.d.ts +53 -0
- package/dist/pdf/structure/index.js +52 -0
- package/dist/pdf/structure/index.js.map +1 -0
- package/dist/pdf/structure/labels.d.ts +16 -0
- package/dist/pdf/structure/labels.js +45 -0
- package/dist/pdf/structure/labels.js.map +1 -0
- package/dist/pdf/structure/links.d.ts +49 -0
- package/dist/pdf/structure/links.js +136 -0
- package/dist/pdf/structure/links.js.map +1 -0
- package/dist/pdf/structure/tags.d.ts +79 -0
- package/dist/pdf/structure/tags.js +314 -0
- package/dist/pdf/structure/tags.js.map +1 -0
- package/dist/pdf/types.d.ts +551 -0
- package/dist/pdf/types.js +16 -0
- package/dist/pdf/types.js.map +1 -0
- package/dist/pdf/wasm/pulpweaver4_pdf.d.ts +41 -0
- package/dist/pdf/wasm/pulpweaver4_pdf.js +286 -0
- package/dist/pdf/wasm/pulpweaver4_pdf_bg.wasm +0 -0
- package/dist/pdf/writer.d.ts +41 -0
- package/dist/pdf/writer.js +78 -0
- package/dist/pdf/writer.js.map +1 -0
- package/dist/plugin/attributes.d.ts +10 -0
- package/dist/plugin/attributes.js +63 -0
- package/dist/plugin/attributes.js.map +1 -0
- package/dist/plugin/define.d.ts +425 -0
- package/dist/plugin/define.js +311 -0
- package/dist/plugin/define.js.map +1 -0
- package/dist/plugin/failure.d.ts +80 -0
- package/dist/plugin/failure.js +97 -0
- package/dist/plugin/failure.js.map +1 -0
- package/dist/plugin/index.d.ts +11 -0
- package/dist/plugin/index.js +12 -0
- package/dist/plugin/index.js.map +1 -0
- package/dist/plugin/load.d.ts +105 -0
- package/dist/plugin/load.js +197 -0
- package/dist/plugin/load.js.map +1 -0
- package/dist/plugin/register.d.ts +166 -0
- package/dist/plugin/register.js +306 -0
- package/dist/plugin/register.js.map +1 -0
- package/dist/plugin/render.d.ts +4 -0
- package/dist/plugin/render.js +28 -0
- package/dist/plugin/render.js.map +1 -0
- package/dist/preflight/index.d.ts +3 -0
- package/dist/preflight/index.js +4 -0
- package/dist/preflight/index.js.map +1 -0
- package/dist/preflight/pdfx.d.ts +440 -0
- package/dist/preflight/pdfx.js +1781 -0
- package/dist/preflight/pdfx.js.map +1 -0
- package/dist/preflight/reader.d.ts +126 -0
- package/dist/preflight/reader.js +832 -0
- package/dist/preflight/reader.js.map +1 -0
- package/dist/preflight/xmp.d.ts +30 -0
- package/dist/preflight/xmp.js +145 -0
- package/dist/preflight/xmp.js.map +1 -0
- package/dist/print/index.d.ts +2 -0
- package/dist/print/index.js +3 -0
- package/dist/print/index.js.map +1 -0
- package/dist/print/output.d.ts +5 -0
- package/dist/print/output.js +215 -0
- package/dist/print/output.js.map +1 -0
- package/dist/problem.d.ts +142 -0
- package/dist/problem.js +234 -0
- package/dist/problem.js.map +1 -0
- package/dist/profile/index.d.ts +10 -0
- package/dist/profile/index.js +11 -0
- package/dist/profile/index.js.map +1 -0
- package/dist/profile/lint.d.ts +69 -0
- package/dist/profile/lint.js +282 -0
- package/dist/profile/lint.js.map +1 -0
- package/dist/profile/metadata.d.ts +27 -0
- package/dist/profile/metadata.js +38 -0
- package/dist/profile/metadata.js.map +1 -0
- package/dist/profile/profile.d.ts +92 -0
- package/dist/profile/profile.js +282 -0
- package/dist/profile/profile.js.map +1 -0
- package/dist/project.d.ts +56 -0
- package/dist/project.js +137 -0
- package/dist/project.js.map +1 -0
- package/dist/reproducible/clock.d.ts +46 -0
- package/dist/reproducible/clock.js +173 -0
- package/dist/reproducible/clock.js.map +1 -0
- package/dist/reproducible/date.d.ts +42 -0
- package/dist/reproducible/date.js +82 -0
- package/dist/reproducible/date.js.map +1 -0
- package/dist/reproducible/index.d.ts +8 -0
- package/dist/reproducible/index.js +9 -0
- package/dist/reproducible/index.js.map +1 -0
- package/dist/spike/spike-page.chromium.json +330 -0
- package/dist/spike/spike.d.ts +75 -0
- package/dist/spike/spike.js +106 -0
- package/dist/spike/spike.js.map +1 -0
- package/dist/style/borders.d.ts +25 -0
- package/dist/style/borders.js +177 -0
- package/dist/style/borders.js.map +1 -0
- package/dist/style/colours.d.ts +34 -0
- package/dist/style/colours.js +138 -0
- package/dist/style/colours.js.map +1 -0
- package/dist/style/compile.d.ts +79 -0
- package/dist/style/compile.js +325 -0
- package/dist/style/compile.js.map +1 -0
- package/dist/style/defaults.d.ts +20 -0
- package/dist/style/defaults.js +45 -0
- package/dist/style/defaults.js.map +1 -0
- package/dist/style/gcpm.d.ts +22 -0
- package/dist/style/gcpm.js +86 -0
- package/dist/style/gcpm.js.map +1 -0
- package/dist/style/index.d.ts +4 -0
- package/dist/style/index.js +5 -0
- package/dist/style/index.js.map +1 -0
- package/dist/style/media.d.ts +22 -0
- package/dist/style/media.js +342 -0
- package/dist/style/media.js.map +1 -0
- package/dist/style/properties.d.ts +44 -0
- package/dist/style/properties.js +497 -0
- package/dist/style/properties.js.map +1 -0
- package/dist/style/scope.d.ts +6 -0
- package/dist/style/scope.js +134 -0
- package/dist/style/scope.js.map +1 -0
- package/dist/style/values.d.ts +45 -0
- package/dist/style/values.js +106 -0
- package/dist/style/values.js.map +1 -0
- package/dist/test/book.d.ts +180 -0
- package/dist/test/book.js +314 -0
- package/dist/test/book.js.map +1 -0
- package/dist/test/build.d.ts +58 -0
- package/dist/test/build.js +222 -0
- package/dist/test/build.js.map +1 -0
- package/dist/test/environment.d.ts +63 -0
- package/dist/test/environment.js +46 -0
- package/dist/test/environment.js.map +1 -0
- package/dist/test/index.d.ts +17 -0
- package/dist/test/index.js +18 -0
- package/dist/test/index.js.map +1 -0
- package/dist/test/indexes.d.ts +4 -0
- package/dist/test/indexes.js +48 -0
- package/dist/test/indexes.js.map +1 -0
- package/dist/test/layout.d.ts +8 -0
- package/dist/test/layout.js +121 -0
- package/dist/test/layout.js.map +1 -0
- package/dist/test/matchers.d.ts +80 -0
- package/dist/test/matchers.js +177 -0
- package/dist/test/matchers.js.map +1 -0
- package/dist/test/pipeline.d.ts +231 -0
- package/dist/test/pipeline.js +75 -0
- package/dist/test/pipeline.js.map +1 -0
- package/dist/test/plugins.d.ts +13 -0
- package/dist/test/plugins.js +22 -0
- package/dist/test/plugins.js.map +1 -0
- package/dist/test/render.d.ts +46 -0
- package/dist/test/render.js +149 -0
- package/dist/test/render.js.map +1 -0
- package/dist/test/runner.d.ts +61 -0
- package/dist/test/runner.js +256 -0
- package/dist/test/runner.js.map +1 -0
- package/dist/test/select.d.ts +54 -0
- package/dist/test/select.js +193 -0
- package/dist/test/select.js.map +1 -0
- package/dist/test/snapshot.d.ts +52 -0
- package/dist/test/snapshot.js +175 -0
- package/dist/test/snapshot.js.map +1 -0
- package/dist/test/text.d.ts +7 -0
- package/dist/test/text.js +46 -0
- package/dist/test/text.js.map +1 -0
- package/dist/test/vitest.d.ts +3 -0
- package/dist/test/vitest.js +39 -0
- package/dist/test/vitest.js.map +1 -0
- package/dist/text/index.d.ts +5 -0
- package/dist/text/index.js +6 -0
- package/dist/text/index.js.map +1 -0
- package/dist/text/output.d.ts +5 -0
- package/dist/text/output.js +39 -0
- package/dist/text/output.js.map +1 -0
- package/dist/text/render.d.ts +82 -0
- package/dist/text/render.js +583 -0
- package/dist/text/render.js.map +1 -0
- package/dist/text/width.d.ts +16 -0
- package/dist/text/width.js +90 -0
- package/dist/text/width.js.map +1 -0
- package/dist/text/wrap.d.ts +19 -0
- package/dist/text/wrap.js +151 -0
- package/dist/text/wrap.js.map +1 -0
- package/dist/transform/core.d.ts +19 -0
- package/dist/transform/core.js +22 -0
- package/dist/transform/core.js.map +1 -0
- package/dist/transform/index.d.ts +10 -0
- package/dist/transform/index.js +11 -0
- package/dist/transform/index.js.map +1 -0
- package/dist/transform/numbering.d.ts +47 -0
- package/dist/transform/numbering.js +142 -0
- package/dist/transform/numbering.js.map +1 -0
- package/dist/transform/references.d.ts +38 -0
- package/dist/transform/references.js +182 -0
- package/dist/transform/references.js.map +1 -0
- package/dist/transform/run.d.ts +32 -0
- package/dist/transform/run.js +210 -0
- package/dist/transform/run.js.map +1 -0
- package/dist/transform/store.d.ts +111 -0
- package/dist/transform/store.js +331 -0
- package/dist/transform/store.js.map +1 -0
- package/dist/transform/testing.d.ts +31 -0
- package/dist/transform/testing.js +76 -0
- package/dist/transform/testing.js.map +1 -0
- package/dist/transform/transform.d.ts +104 -0
- package/dist/transform/transform.js +89 -0
- package/dist/transform/transform.js.map +1 -0
- package/dist/vfs/fsa.d.ts +14 -0
- package/dist/vfs/fsa.js +123 -0
- package/dist/vfs/fsa.js.map +1 -0
- package/dist/vfs/index.d.ts +7 -0
- package/dist/vfs/index.js +8 -0
- package/dist/vfs/index.js.map +1 -0
- package/dist/vfs/memory.d.ts +15 -0
- package/dist/vfs/memory.js +101 -0
- package/dist/vfs/memory.js.map +1 -0
- package/dist/vfs/path.d.ts +30 -0
- package/dist/vfs/path.js +67 -0
- package/dist/vfs/path.js.map +1 -0
- package/dist/vfs/vfs.d.ts +66 -0
- package/dist/vfs/vfs.js +68 -0
- package/dist/vfs/vfs.js.map +1 -0
- package/dist/vfs/zip.d.ts +27 -0
- package/dist/vfs/zip.js +67 -0
- package/dist/vfs/zip.js.map +1 -0
- package/dist/web/css.d.ts +15 -0
- package/dist/web/css.js +80 -0
- package/dist/web/css.js.map +1 -0
- package/dist/web/hast.d.ts +44 -0
- package/dist/web/hast.js +175 -0
- package/dist/web/hast.js.map +1 -0
- package/dist/web/index.d.ts +11 -0
- package/dist/web/index.js +12 -0
- package/dist/web/index.js.map +1 -0
- package/dist/web/justify-main.d.ts +1 -0
- package/dist/web/justify-main.js +38 -0
- package/dist/web/justify-main.js.map +1 -0
- package/dist/web/justify.d.ts +46 -0
- package/dist/web/justify.js +147 -0
- package/dist/web/justify.js.map +1 -0
- package/dist/web/output.d.ts +28 -0
- package/dist/web/output.js +251 -0
- package/dist/web/output.js.map +1 -0
- package/dist/web/runtime/LICENSE-harfbuzzjs.txt +19 -0
- package/dist/web/runtime/NOTICE-patterns.txt +429 -0
- package/dist/web/runtime/harfbuzz.wasm +0 -0
- package/dist/web/runtime/justify.js.txt +2 -0
- package/dist/web/site.d.ts +53 -0
- package/dist/web/site.js +219 -0
- package/dist/web/site.js.map +1 -0
- package/docs/README.md +16 -0
- package/docs/reference/css-properties/index.md +94 -0
- package/docs/reference/css-properties/pw-adj-demerits.md +22 -0
- package/docs/reference/css-properties/pw-border-bottom-width.md +24 -0
- package/docs/reference/css-properties/pw-border-left-width.md +24 -0
- package/docs/reference/css-properties/pw-border-right-width.md +24 -0
- package/docs/reference/css-properties/pw-border-top-width.md +24 -0
- package/docs/reference/css-properties/pw-box.md +28 -0
- package/docs/reference/css-properties/pw-broken-penalty.md +22 -0
- package/docs/reference/css-properties/pw-club-penalty.md +24 -0
- package/docs/reference/css-properties/pw-column-rule-width.md +23 -0
- package/docs/reference/css-properties/pw-content-after.md +31 -0
- package/docs/reference/css-properties/pw-content-before.md +31 -0
- package/docs/reference/css-properties/pw-double-hyphen-demerits.md +23 -0
- package/docs/reference/css-properties/pw-emergency-stretch.md +28 -0
- package/docs/reference/css-properties/pw-ex-hyphen-penalty.md +22 -0
- package/docs/reference/css-properties/pw-final-hyphen-demerits.md +22 -0
- package/docs/reference/css-properties/pw-float-skip.md +22 -0
- package/docs/reference/css-properties/pw-float.md +33 -0
- package/docs/reference/css-properties/pw-footnote-max-height.md +22 -0
- package/docs/reference/css-properties/pw-footnote-skip.md +23 -0
- package/docs/reference/css-properties/pw-hyphen-penalty.md +24 -0
- package/docs/reference/css-properties/pw-inter-line-penalty.md +24 -0
- package/docs/reference/css-properties/pw-leader-space.md +22 -0
- package/docs/reference/css-properties/pw-leader.md +29 -0
- package/docs/reference/css-properties/pw-left-hyphen-min.md +23 -0
- package/docs/reference/css-properties/pw-line-breaking.md +29 -0
- package/docs/reference/css-properties/pw-line-penalty.md +23 -0
- package/docs/reference/css-properties/pw-list-indent.md +18 -0
- package/docs/reference/css-properties/pw-looseness.md +30 -0
- package/docs/reference/css-properties/pw-max-depth.md +22 -0
- package/docs/reference/css-properties/pw-minipage-footnotes.md +23 -0
- package/docs/reference/css-properties/pw-orphans.md +24 -0
- package/docs/reference/css-properties/pw-outline-width.md +23 -0
- package/docs/reference/css-properties/pw-overprint.md +26 -0
- package/docs/reference/css-properties/pw-padding-bottom.md +22 -0
- package/docs/reference/css-properties/pw-padding-left.md +22 -0
- package/docs/reference/css-properties/pw-padding-right.md +22 -0
- package/docs/reference/css-properties/pw-padding-top.md +22 -0
- package/docs/reference/css-properties/pw-page-prefix.md +28 -0
- package/docs/reference/css-properties/pw-page.md +32 -0
- package/docs/reference/css-properties/pw-penalty-after.md +23 -0
- package/docs/reference/css-properties/pw-penalty-before.md +30 -0
- package/docs/reference/css-properties/pw-pretolerance.md +23 -0
- package/docs/reference/css-properties/pw-right-hyphen-min.md +22 -0
- package/docs/reference/css-properties/pw-running.md +23 -0
- package/docs/reference/css-properties/pw-site-background.md +21 -0
- package/docs/reference/css-properties/pw-site-link.md +17 -0
- package/docs/reference/css-properties/pw-site-measure.md +17 -0
- package/docs/reference/css-properties/pw-site-muted.md +21 -0
- package/docs/reference/css-properties/pw-site-rule.md +17 -0
- package/docs/reference/css-properties/pw-site-text.md +22 -0
- package/docs/reference/css-properties/pw-space-after.md +23 -0
- package/docs/reference/css-properties/pw-space-before.md +29 -0
- package/docs/reference/css-properties/pw-string-set.md +32 -0
- package/docs/reference/css-properties/pw-tolerance.md +33 -0
- package/docs/reference/css-properties/pw-top-skip.md +22 -0
- package/docs/reference/css-properties/pw-widow-penalty.md +32 -0
- package/docs/reference/css-properties/pw-widows.md +24 -0
- package/docs/reference/css-properties/pw-word-space.md +22 -0
- package/docs/reference/css-properties/pw-xspace.md +22 -0
- package/docs/reference/index.md +17 -0
- package/docs/reference/lint-rules/black-text.md +31 -0
- package/docs/reference/lint-rules/blank-page.md +35 -0
- package/docs/reference/lint-rules/chapter-verso.md +34 -0
- package/docs/reference/lint-rules/citation-in-heading.md +24 -0
- package/docs/reference/lint-rules/consecutive-hyphens.md +34 -0
- package/docs/reference/lint-rules/empty-link.md +32 -0
- package/docs/reference/lint-rules/figure-distance.md +34 -0
- package/docs/reference/lint-rules/fonts.md +24 -0
- package/docs/reference/lint-rules/generated-text.md +24 -0
- package/docs/reference/lint-rules/heading-levels.md +30 -0
- package/docs/reference/lint-rules/ibid-across-page.md +30 -0
- package/docs/reference/lint-rules/image-alt.md +30 -0
- package/docs/reference/lint-rules/image-resolution.md +34 -0
- package/docs/reference/lint-rules/index.md +120 -0
- package/docs/reference/lint-rules/ink-limit.md +30 -0
- package/docs/reference/lint-rules/missing-field.md +37 -0
- package/docs/reference/lint-rules/orphan.md +34 -0
- package/docs/reference/lint-rules/overfull-line.md +28 -0
- package/docs/reference/lint-rules/profile.md +24 -0
- package/docs/reference/lint-rules/raw-html.md +30 -0
- package/docs/reference/lint-rules/signature.md +34 -0
- package/docs/reference/lint-rules/straight-quotes.md +33 -0
- package/docs/reference/lint-rules/svg-use-css.md +24 -0
- package/docs/reference/lint-rules/underfull-line.md +35 -0
- package/docs/reference/lint-rules/unknown-citation.md +30 -0
- package/docs/reference/lint-rules/unknown-label.md +31 -0
- package/docs/reference/lint-rules/unpaintable.md +24 -0
- package/docs/reference/lint-rules/unplaced-index.md +31 -0
- package/docs/reference/lint-rules/unused-entry.md +38 -0
- package/docs/reference/lint-rules/widow.md +34 -0
- package/docs/reference/plugin-api/assert-no-errors.md +18 -0
- package/docs/reference/plugin-api/asset-processor.md +28 -0
- package/docs/reference/plugin-api/attribute-problem.md +26 -0
- package/docs/reference/plugin-api/attribute-type.md +18 -0
- package/docs/reference/plugin-api/capabilities.md +18 -0
- package/docs/reference/plugin-api/capability.md +22 -0
- package/docs/reference/plugin-api/check-attributes.md +18 -0
- package/docs/reference/plugin-api/claim-kind.md +20 -0
- package/docs/reference/plugin-api/combine-penalties.md +17 -0
- package/docs/reference/plugin-api/command-context.md +30 -0
- package/docs/reference/plugin-api/command-definition.md +34 -0
- package/docs/reference/plugin-api/core-claims.md +18 -0
- package/docs/reference/plugin-api/define-plugin.md +20 -0
- package/docs/reference/plugin-api/define-rule.md +19 -0
- package/docs/reference/plugin-api/describe-error.md +14 -0
- package/docs/reference/plugin-api/describe-node.md +14 -0
- package/docs/reference/plugin-api/empty-registry.md +18 -0
- package/docs/reference/plugin-api/failed-on.md +32 -0
- package/docs/reference/plugin-api/fails-as.md +18 -0
- package/docs/reference/plugin-api/import-plugins.md +20 -0
- package/docs/reference/plugin-api/import-text.md +14 -0
- package/docs/reference/plugin-api/index.md +123 -0
- package/docs/reference/plugin-api/layout-definition.md +42 -0
- package/docs/reference/plugin-api/layout-slot.md +28 -0
- package/docs/reference/plugin-api/line-breaker.md +18 -0
- package/docs/reference/plugin-api/lint-context.md +48 -0
- package/docs/reference/plugin-api/lint-definition.md +32 -0
- package/docs/reference/plugin-api/lint-edition.md +38 -0
- package/docs/reference/plugin-api/lint-fix.md +36 -0
- package/docs/reference/plugin-api/lint-level.md +20 -0
- package/docs/reference/plugin-api/lint-preset.md +30 -0
- package/docs/reference/plugin-api/lint-rule.md +42 -0
- package/docs/reference/plugin-api/load-failure.md +32 -0
- package/docs/reference/plugin-api/load-plugins-options.md +32 -0
- package/docs/reference/plugin-api/load-plugins.md +20 -0
- package/docs/reference/plugin-api/loaded-plugin.md +32 -0
- package/docs/reference/plugin-api/node-claim.md +34 -0
- package/docs/reference/plugin-api/output-definition.md +28 -0
- package/docs/reference/plugin-api/owned.md +28 -0
- package/docs/reference/plugin-api/page-builder-hook.md +18 -0
- package/docs/reference/plugin-api/penalty-rule.md +34 -0
- package/docs/reference/plugin-api/plugin-api.md +18 -0
- package/docs/reference/plugin-api/plugin-definition.md +66 -0
- package/docs/reference/plugin-api/plugin-error.md +22 -0
- package/docs/reference/plugin-api/plugin-failure.md +30 -0
- package/docs/reference/plugin-api/plugin-importer.md +34 -0
- package/docs/reference/plugin-api/plugin-problem.md +30 -0
- package/docs/reference/plugin-api/plugin-registry.md +83 -0
- package/docs/reference/plugin-api/plugin-scope.md +15 -0
- package/docs/reference/plugin-api/plugin-stage.md +18 -0
- package/docs/reference/plugin-api/plugin-threw-problem.md +34 -0
- package/docs/reference/plugin-api/plugin-threw.md +21 -0
- package/docs/reference/plugin-api/plugin.md +69 -0
- package/docs/reference/plugin-api/project-with-plugins.md +36 -0
- package/docs/reference/plugin-api/read-context.md +30 -0
- package/docs/reference/plugin-api/read-failure.md +18 -0
- package/docs/reference/plugin-api/read-plugin-styles.md +22 -0
- package/docs/reference/plugin-api/reader.md +22 -0
- package/docs/reference/plugin-api/register-options.md +28 -0
- package/docs/reference/plugin-api/register-plugins.md +20 -0
- package/docs/reference/plugin-api/render-format.md +18 -0
- package/docs/reference/plugin-api/render-formats.md +18 -0
- package/docs/reference/plugin-api/renderer-registry.md +18 -0
- package/docs/reference/plugin-api/renderer-set.md +34 -0
- package/docs/reference/plugin-api/renderers.md +34 -0
- package/docs/reference/plugin-api/specifier-kind.md +14 -0
- package/docs/reference/plugin-api/style-source.md +18 -0
- package/docs/reference/plugin-api/text-context.md +28 -0
- package/docs/reference/plugin-api/text-edit.md +28 -0
- package/docs/reference/plugin-api/text-renderer.md +24 -0
- package/docs/reference/plugin-api/try-plugin-async.md +18 -0
- package/docs/reference/plugin-api/try-plugin.md +20 -0
- package/docs/reference/pulpweaver4-toml/editions.md +208 -0
- package/docs/reference/pulpweaver4-toml/index.md +195 -0
- package/docs/reference/pulpweaver4-toml/inks.md +50 -0
- package/docs/reference/pulpweaver4-toml/lint.md +36 -0
- package/docs/reference/test-matchers/index.md +33 -0
- package/docs/reference/test-matchers/to-be-recto.md +20 -0
- package/docs/reference/test-matchers/to-cite.md +22 -0
- package/docs/reference/test-matchers/to-fit-on-one-page.md +20 -0
- package/docs/reference/test-matchers/to-have-no-overfull-lines.md +20 -0
- package/docs/reference/test-matchers/to-match-html-snapshot.md +20 -0
- package/docs/reference/test-matchers/to-match-page-snapshot.md +20 -0
- package/docs/reference/test-matchers/to-match-text-snapshot.md +21 -0
- package/docs/reference/test-matchers/to-start-page.md +20 -0
- package/package.json +75 -4
- package/README.md +0 -3
|
@@ -0,0 +1,772 @@
|
|
|
1
|
+
import { exactWidthRegistrations, rewriteExactWidths } from '../style/borders.js';
|
|
2
|
+
import { elementPropertyRegistrations } from '../style/gcpm.js';
|
|
3
|
+
import { formatCounter } from './counters.js';
|
|
4
|
+
import { BIGSKIP, parseGlue, parseLength } from './glue.js';
|
|
5
|
+
import { writeFirstLetters } from './first-letter.js';
|
|
6
|
+
import { buildVerticalList } from './lists.js';
|
|
7
|
+
import { makeMarginBoxes, parseContent } from './margin-boxes.js';
|
|
8
|
+
import { badness } from '../linebreak/knuth-plass.js';
|
|
9
|
+
import { pageBox } from './page-box.js';
|
|
10
|
+
import { PageRules, valueOf } from './page-rules.js';
|
|
11
|
+
import { PageBuilder, natural, pruneTop, vertBreak, vpack, } from './pagebuilder.js';
|
|
12
|
+
import { NATURAL, Region } from './region.js';
|
|
13
|
+
import { EJECT_PENALTY, INFINITE_VPENALTY } from './vlist.js';
|
|
14
|
+
/** TeX's `\vfuzz`, 0.1 pt in px: a page no taller than this past its height isn't overfull. */
|
|
15
|
+
const VFUZZ = 0.1 * 96 / 72;
|
|
16
|
+
/** px to TeX's sp: 1px is 0.75pt. */
|
|
17
|
+
const SP_PER_PX = 49152;
|
|
18
|
+
/** Where the page is measured and built: the same shell as the pages, so the same selectors apply. */
|
|
19
|
+
function shell(box, lang, extra = '') {
|
|
20
|
+
const { width, height, margin, offset: o } = box;
|
|
21
|
+
const page = document.createElement('div');
|
|
22
|
+
page.className = `pw-page${extra ? ` ${extra}` : ''}`;
|
|
23
|
+
page.lang = lang;
|
|
24
|
+
page.style.cssText = `position:relative;width:${width + 2 * o}px;height:${height + 2 * o}px;overflow:hidden;text-rendering:geometricPrecision`;
|
|
25
|
+
const area = document.createElement('div');
|
|
26
|
+
area.className = 'pw-area';
|
|
27
|
+
area.style.cssText = `position:absolute;left:${o + margin.left}px;top:${o + margin.top}px;width:${width - margin.left - margin.right}px;` +
|
|
28
|
+
`height:${height - margin.top - margin.bottom}px`;
|
|
29
|
+
const main = document.createElement('div');
|
|
30
|
+
main.className = 'pw-main';
|
|
31
|
+
main.style.cssText = 'position:absolute;left:0;top:0;width:100%';
|
|
32
|
+
area.append(main);
|
|
33
|
+
page.append(area);
|
|
34
|
+
return { page, area, main };
|
|
35
|
+
}
|
|
36
|
+
/** The pages' styles and boxes, from the `@page` rules and the defaults. */
|
|
37
|
+
class PageStyles {
|
|
38
|
+
opts;
|
|
39
|
+
rules;
|
|
40
|
+
rootFontSize;
|
|
41
|
+
boxes = new Map();
|
|
42
|
+
constructor(opts) {
|
|
43
|
+
this.opts = opts;
|
|
44
|
+
this.rules = opts.pageRules ?? PageRules.none;
|
|
45
|
+
this.rootFontSize = Number.parseFloat(getComputedStyle(document.documentElement).fontSize) || 16;
|
|
46
|
+
}
|
|
47
|
+
get named() {
|
|
48
|
+
return this.rules.names.size > 0;
|
|
49
|
+
}
|
|
50
|
+
style(context) {
|
|
51
|
+
return this.rules.resolve(context);
|
|
52
|
+
}
|
|
53
|
+
box(context) {
|
|
54
|
+
const style = this.style(context);
|
|
55
|
+
let box = this.boxes.get(style);
|
|
56
|
+
if (!box) {
|
|
57
|
+
const { geometry, bleed, marks, fixed = [] } = this.opts;
|
|
58
|
+
const defaults = { geometry, ...(bleed !== undefined ? { bleed } : {}), ...(marks ? { marks } : {}) };
|
|
59
|
+
const kept = (d) => !fixed.includes(d.prop) || style.named.has(d);
|
|
60
|
+
const page = style.page.filter(kept);
|
|
61
|
+
box = pageBox(page, defaults, this.rootFontSize);
|
|
62
|
+
if (page.length < style.page.length)
|
|
63
|
+
this.overridden(style.page.filter((d) => !kept(d)), pageBox(style.page, defaults, this.rootFontSize), box);
|
|
64
|
+
this.boxes.set(style, box);
|
|
65
|
+
}
|
|
66
|
+
return box;
|
|
67
|
+
}
|
|
68
|
+
/** What the edition's page, bleed and marks overrode, each property once: `page-overridden` where the author's would have made another box. */
|
|
69
|
+
warnings = [];
|
|
70
|
+
warned = new Set();
|
|
71
|
+
overridden(dropped, authored, box) {
|
|
72
|
+
const pt = (px) => `${Number((px * 0.75).toFixed(2))}pt`;
|
|
73
|
+
const marks = (m) => [m.crop && 'crop', m.cross && 'cross'].filter(Boolean).join(' ') || 'none';
|
|
74
|
+
const differs = {
|
|
75
|
+
size: authored.width !== box.width || authored.height !== box.height
|
|
76
|
+
? [`${pt(box.width)} × ${pt(box.height)}`, `${pt(authored.width)} × ${pt(authored.height)}`] : undefined,
|
|
77
|
+
bleed: authored.bleed !== box.bleed ? [pt(box.bleed), pt(authored.bleed)] : undefined,
|
|
78
|
+
marks: marks(authored.marks) !== marks(box.marks) ? [marks(box.marks), marks(authored.marks)] : undefined,
|
|
79
|
+
};
|
|
80
|
+
for (const prop of ['size', 'bleed', 'marks']) {
|
|
81
|
+
const value = valueOf(dropped, prop);
|
|
82
|
+
const d = differs[prop];
|
|
83
|
+
if (value === undefined || !d || this.warned.has(prop))
|
|
84
|
+
continue;
|
|
85
|
+
this.warned.add(prop);
|
|
86
|
+
const what = prop === 'size' ? 'page' : prop;
|
|
87
|
+
this.warnings.push({
|
|
88
|
+
code: 'page-overridden',
|
|
89
|
+
message: `@page { ${prop}: ${value} } isn't the edition's ${what}, which win${prop === 'marks' ? '' : 's'}: ${d[0]}, not ${d[1]}`,
|
|
90
|
+
elements: [],
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/** The width of the text area of a right page of the name, not the first: the measure its content is set at. */
|
|
95
|
+
measure(name) {
|
|
96
|
+
const b = this.box({ name, first: false, blank: false, side: 'right' });
|
|
97
|
+
return b.width - b.margin.left - b.margin.right;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/** An element's own page name (`page`, lowered to `--pw-page`), if it has one. */
|
|
101
|
+
function ownPageName(el) {
|
|
102
|
+
const cs = getComputedStyle(el);
|
|
103
|
+
const v = (cs.getPropertyValue('--pw-page').trim() || cs.getPropertyValue('page').trim());
|
|
104
|
+
return v && v !== 'auto' ? v : undefined;
|
|
105
|
+
}
|
|
106
|
+
/** Page names: each element's used `page`, its own or its nearest ancestor's, below and including the flow's root. */
|
|
107
|
+
class PageNames {
|
|
108
|
+
root;
|
|
109
|
+
enabled;
|
|
110
|
+
own = new Map();
|
|
111
|
+
constructor(root, enabled) {
|
|
112
|
+
this.root = root;
|
|
113
|
+
this.enabled = enabled;
|
|
114
|
+
}
|
|
115
|
+
of(el) {
|
|
116
|
+
if (!this.enabled)
|
|
117
|
+
return '';
|
|
118
|
+
for (let e = el; e; e = e === this.root ? null : e.parentElement) {
|
|
119
|
+
if (!this.own.has(e))
|
|
120
|
+
this.own.set(e, ownPageName(e));
|
|
121
|
+
const n = this.own.get(e);
|
|
122
|
+
if (n)
|
|
123
|
+
return n;
|
|
124
|
+
}
|
|
125
|
+
return '';
|
|
126
|
+
}
|
|
127
|
+
/** A box's: its element's, or its innermost container's that has one. */
|
|
128
|
+
ofBox(item) {
|
|
129
|
+
if (!this.enabled)
|
|
130
|
+
return '';
|
|
131
|
+
for (const el of [item.element, ...[...item.containers].reverse()]) {
|
|
132
|
+
if (!this.own.has(el))
|
|
133
|
+
this.own.set(el, ownPageName(el));
|
|
134
|
+
const n = this.own.get(el);
|
|
135
|
+
if (n)
|
|
136
|
+
return n;
|
|
137
|
+
}
|
|
138
|
+
return this.of(this.root);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Lays `root`'s content out into pages, appended to `opts.container`. The
|
|
143
|
+
* root is taken apart: its elements move onto the pages, and it is left out
|
|
144
|
+
* of the document.
|
|
145
|
+
*/
|
|
146
|
+
export function layoutPages(root, opts) {
|
|
147
|
+
const styles = new PageStyles(opts);
|
|
148
|
+
const plain = styles.box({ name: '', first: false, blank: false, side: 'right' });
|
|
149
|
+
// Measured where it will be shown: in a page's main region, at the measure.
|
|
150
|
+
const lang = opts.lang ?? languageOf(root) ?? languageOf(opts.container) ?? 'und';
|
|
151
|
+
register(opts.container);
|
|
152
|
+
const measuring = shell({ ...plain, offset: 0 }, lang, opts.pageClass);
|
|
153
|
+
measuring.page.style.height = 'auto';
|
|
154
|
+
measuring.area.style.height = 'auto';
|
|
155
|
+
measuring.page.style.overflow = 'visible';
|
|
156
|
+
measuring.page.style.visibility = 'hidden';
|
|
157
|
+
opts.container.append(measuring.page);
|
|
158
|
+
measuring.main.append(root);
|
|
159
|
+
root.style.marginTop = root.style.marginBottom = root.style.paddingTop = root.style.paddingBottom = '0';
|
|
160
|
+
// A styled `::first-letter` is a span of its own, which a float can be.
|
|
161
|
+
const firstLetters = writeFirstLetters(root);
|
|
162
|
+
const names = new PageNames(root, styles.named);
|
|
163
|
+
const restore = styles.named ? measureNamedPages(root, names, styles) : () => { };
|
|
164
|
+
const { fonts, hyphenator, penalty, boxes, lineBreaker } = opts;
|
|
165
|
+
const list = buildVerticalList(root, {
|
|
166
|
+
fonts, ...(hyphenator ? { hyphenator } : {}), ...(penalty ? { penalty } : {}), ...(boxes ? { boxes } : {}), ...(lineBreaker ? { lineBreaker } : {}),
|
|
167
|
+
});
|
|
168
|
+
const cs = getComputedStyle(root);
|
|
169
|
+
const em = Number.parseFloat(cs.fontSize) || 16;
|
|
170
|
+
const glue = (prop, fallback) => parseGlue(cs.getPropertyValue(prop).trim() || fallback, em);
|
|
171
|
+
const length = (prop, fallback) => {
|
|
172
|
+
const v = cs.getPropertyValue(prop).trim();
|
|
173
|
+
return v && v !== 'none' ? parseLength(v, em) : fallback;
|
|
174
|
+
};
|
|
175
|
+
const vsizeOf = (box) => box.height - box.margin.top - box.margin.bottom;
|
|
176
|
+
const vsize = vsizeOf(plain);
|
|
177
|
+
const maxDepth = length('--pw-max-depth', 0);
|
|
178
|
+
const floatSkip = glue('--pw-float-skip', BIGSKIP);
|
|
179
|
+
const zero = { width: 0, stretch: 0, shrink: 0 };
|
|
180
|
+
const floats = { skip: zero, maxHeight: vsize, floatingPenalty: 0, splitTopSkip: zero, splitMaxDepth: Number.MAX_SAFE_INTEGER };
|
|
181
|
+
const inserts = {
|
|
182
|
+
footnote: {
|
|
183
|
+
skip: glue('--pw-footnote-skip', BIGSKIP), maxHeight: length('--pw-footnote-max-height', vsize), floatingPenalty: 20000,
|
|
184
|
+
splitTopSkip: zero, splitMaxDepth: maxDepth,
|
|
185
|
+
},
|
|
186
|
+
top: floats,
|
|
187
|
+
bottom: { ...floats, skip: floatSkip },
|
|
188
|
+
};
|
|
189
|
+
fixTables(root);
|
|
190
|
+
restore();
|
|
191
|
+
const firstPage = opts.firstPage ?? 1;
|
|
192
|
+
const sideOf = (n) => (n % 2 === 1 ? 'right' : 'left');
|
|
193
|
+
const headers = new HeaderRows();
|
|
194
|
+
const builder = new PageBuilder({
|
|
195
|
+
vsize, maxDepth, topSkip: glue('--pw-top-skip', '0px'), inserts, unit: SP_PER_PX, firstPage,
|
|
196
|
+
vsizeOf: (n, first) => vsizeOf(styles.box({
|
|
197
|
+
name: first?.type === 'box' && first.kind !== 'null' ? names.ofBox(first) : '', first: n === firstPage, blank: false, side: sideOf(n),
|
|
198
|
+
})),
|
|
199
|
+
continuation: (last, next) => headers.repeat(last, next),
|
|
200
|
+
});
|
|
201
|
+
contribute(builder, contributions(list.items, floatSkip, names));
|
|
202
|
+
// The book's end: \vfill\eject, so the last page's text sits at its top.
|
|
203
|
+
builder.contribute([{ type: 'glue', width: 0, stretch: 1, shrink: 0, stretchOrder: 2 }, { type: 'penalty', penalty: -10000 }]);
|
|
204
|
+
const built = builder.finish();
|
|
205
|
+
// A box taller than the page is placed alone on one, overfull, and the
|
|
206
|
+
// page's foot cuts it off: named before it moves. (A page a little over
|
|
207
|
+
// its goal, as TeX's can be after an insert is split, is no such loss.)
|
|
208
|
+
const warnings = [...firstLetters, ...built.flatMap((b) => {
|
|
209
|
+
if (b.overfull <= VFUZZ)
|
|
210
|
+
return [];
|
|
211
|
+
const tallest = b.items.reduce((t, i) => i.type === 'box' && i.kind !== 'null' && (!t || i.height + i.depth > t.height + t.depth) ? i : t, undefined);
|
|
212
|
+
if (!tallest || tallest.height + tallest.depth <= b.height + VFUZZ)
|
|
213
|
+
return [];
|
|
214
|
+
const element = tallest.element.closest('[data-pw-key]') ?? tallest.element;
|
|
215
|
+
return [{
|
|
216
|
+
code: 'overfull-page',
|
|
217
|
+
message: `page ${b.number} is ${(b.overfull * 0.75).toFixed(1)}pt overfull: a ${element.localName} is taller than the page, and is cut off`,
|
|
218
|
+
elements: [element],
|
|
219
|
+
}];
|
|
220
|
+
})];
|
|
221
|
+
// Each page's name is its first box's; a blank page takes the next page's.
|
|
222
|
+
const pageNames = built.map((b) => {
|
|
223
|
+
const first = b.items.find((i) => i.type === 'box' && i.kind !== 'null');
|
|
224
|
+
return first ? names.ofBox(first) : undefined;
|
|
225
|
+
});
|
|
226
|
+
for (let i = pageNames.length - 1; i >= 0; i--)
|
|
227
|
+
pageNames[i] ??= pageNames[i + 1] ?? pageNames[i - 1] ?? '';
|
|
228
|
+
// Each page's elements that start on it, in order, with any `counter-reset: page` or
|
|
229
|
+
// `counter-set: page`: read before the pages change the document, so styles are computed once.
|
|
230
|
+
const started = new Set();
|
|
231
|
+
const resetsOn = built.map((b, i) => {
|
|
232
|
+
const out = [];
|
|
233
|
+
const starts = (el) => {
|
|
234
|
+
if (started.has(el))
|
|
235
|
+
return;
|
|
236
|
+
started.add(el);
|
|
237
|
+
const cs = getComputedStyle(el);
|
|
238
|
+
const n = counterValue(cs.getPropertyValue('counter-set'), 'page') ?? counterValue(cs.counterReset, 'page');
|
|
239
|
+
if (n !== undefined)
|
|
240
|
+
out.push(n);
|
|
241
|
+
};
|
|
242
|
+
if (i === 0)
|
|
243
|
+
starts(root);
|
|
244
|
+
for (const item of b.items) {
|
|
245
|
+
if (item.type !== 'box' || item.kind === 'null')
|
|
246
|
+
continue;
|
|
247
|
+
for (const el of item.containers)
|
|
248
|
+
starts(el);
|
|
249
|
+
if (item.kind !== 'line')
|
|
250
|
+
starts(item.element);
|
|
251
|
+
}
|
|
252
|
+
return out;
|
|
253
|
+
});
|
|
254
|
+
const fragments = new Set();
|
|
255
|
+
const pages = [];
|
|
256
|
+
for (const [i, b] of built.entries()) {
|
|
257
|
+
const context = { name: pageNames[i], first: i === 0, blank: b.blank, side: sideOf(b.number) };
|
|
258
|
+
const box = styles.box(context);
|
|
259
|
+
const { page, area, main } = shell(box, lang, `${opts.pageClass ?? ''}${b.blank ? ' pw-blank' : ''}`.trim());
|
|
260
|
+
if (context.name)
|
|
261
|
+
page.dataset.pwPageName = context.name;
|
|
262
|
+
if (box.offset > 0) {
|
|
263
|
+
const o = box.offset;
|
|
264
|
+
page.dataset.pwTrimBox = `${o} ${o} ${box.width} ${box.height}`;
|
|
265
|
+
page.dataset.pwBleedBox = `${o - box.bleed} ${o - box.bleed} ${box.width + 2 * box.bleed} ${box.height + 2 * box.bleed}`;
|
|
266
|
+
}
|
|
267
|
+
opts.container.append(page);
|
|
268
|
+
const lines = [];
|
|
269
|
+
pages.push({ b, element: page, context, box, lines, resets: resetsOn[i] });
|
|
270
|
+
if (b.blank) {
|
|
271
|
+
area.remove();
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
274
|
+
main.style.height = `${b.height}px`;
|
|
275
|
+
new Region(main, root, fragments, lines).build(b.items, b.glue);
|
|
276
|
+
const placed = (cls) => (b.inserts[cls] ?? []).filter((x) => x.list.some((i) => i.type === 'box'));
|
|
277
|
+
const top = placed('top');
|
|
278
|
+
const bottom = placed('bottom');
|
|
279
|
+
const notes = placed('footnote');
|
|
280
|
+
let topHeight = 0;
|
|
281
|
+
if (top.length) {
|
|
282
|
+
const region = floatRegion(area, 'pw-top-floats');
|
|
283
|
+
region.style.top = '0';
|
|
284
|
+
new Region(region, root, fragments, lines).build(top.flatMap((x) => x.list), NATURAL);
|
|
285
|
+
topHeight = natural(top.flatMap((x) => x.list));
|
|
286
|
+
main.style.top = `${topHeight}px`;
|
|
287
|
+
}
|
|
288
|
+
let bottomOffset = 0;
|
|
289
|
+
if (notes.length) {
|
|
290
|
+
const region = floatRegion(area, 'pw-footnotes');
|
|
291
|
+
region.style.bottom = '0';
|
|
292
|
+
const rule = document.createElement('div');
|
|
293
|
+
rule.className = 'pw-footnote-rule';
|
|
294
|
+
rule.style.cssText = 'position:absolute;left:0;bottom:100%';
|
|
295
|
+
region.append(rule);
|
|
296
|
+
new Region(region, root, fragments, lines).build(notes.flatMap((x) => x.list), NATURAL);
|
|
297
|
+
bottomOffset = natural(notes.flatMap((x) => x.list)) + inserts.footnote.skip.width;
|
|
298
|
+
}
|
|
299
|
+
if (bottom.length) {
|
|
300
|
+
const region = floatRegion(area, 'pw-bottom-floats');
|
|
301
|
+
region.style.bottom = `${bottomOffset}px`;
|
|
302
|
+
new Region(region, root, fragments, lines).build(bottom.flatMap((x) => x.list), NATURAL);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
// Page numbers, now that every page is made, then what shows them. A
|
|
306
|
+
// page without a folio is numbered in the style its page would have off
|
|
307
|
+
// its first and blank pages, else in the last folio's; a blank page, which
|
|
308
|
+
// ends what is before it, in the page's before it, as LaTeX's
|
|
309
|
+
// `\cleardoublepage` before `\mainmatter`; and pages before any folio in
|
|
310
|
+
// the first folio's, as LaTeX's `\frontmatter` numbers its title pages.
|
|
311
|
+
let counter = firstPage - 1;
|
|
312
|
+
const folios = pages.map((p) => {
|
|
313
|
+
const style = styles.style(p.context);
|
|
314
|
+
const own = folioStyle(style);
|
|
315
|
+
return { style, own, folio: own ?? folioStyle(styles.style({ ...p.context, first: false, blank: false })) };
|
|
316
|
+
});
|
|
317
|
+
let lastStyle = folios.find((f) => f.folio)?.folio ?? 'decimal';
|
|
318
|
+
const numbered = pages.map((p, i) => {
|
|
319
|
+
const { style } = folios[i];
|
|
320
|
+
const reset = pageCounterReset(style, p.resets);
|
|
321
|
+
counter = reset ?? counter + pageCounterIncrement(style);
|
|
322
|
+
const folio = (p.b.blank && i > 0 ? folios[i].own : folios[i].folio) ?? lastStyle;
|
|
323
|
+
lastStyle = folio;
|
|
324
|
+
const label = opts.label?.(p.b.number) ?? formatCounter(counter, folio);
|
|
325
|
+
p.element.dataset.pwPageNumber = String(counter);
|
|
326
|
+
p.element.dataset.pwPageStyle = folio;
|
|
327
|
+
// Every page says its prefix, empty where its rules give none, so one
|
|
328
|
+
// set for some pages doesn't run on into the next (#92).
|
|
329
|
+
const prefix = valueOf(style.page, '--pw-page-prefix');
|
|
330
|
+
p.element.dataset.pwPagePrefix = prefix === undefined ? '' : unquote(prefix);
|
|
331
|
+
return { ...p, style, counter, label };
|
|
332
|
+
});
|
|
333
|
+
const targets = new Map();
|
|
334
|
+
for (const p of numbered)
|
|
335
|
+
for (const el of p.element.querySelectorAll('[id]'))
|
|
336
|
+
if (!targets.has(el.id))
|
|
337
|
+
targets.set(el.id, p.counter);
|
|
338
|
+
const result = numbered.map((p) => {
|
|
339
|
+
background(p.element, p.box, p.style);
|
|
340
|
+
const margins = makeMarginBoxes(p.element, p.box, p.style, marginContext(p.b, p.counter, numbered.length, targets), {
|
|
341
|
+
fonts: opts.fonts, ...(opts.hyphenator ? { hyphenator: opts.hyphenator } : {}),
|
|
342
|
+
});
|
|
343
|
+
printerMarks(p.element, p.box);
|
|
344
|
+
return {
|
|
345
|
+
element: p.element, number: p.b.number, label: p.label, blank: p.b.blank, built: p.b, lines: p.lines,
|
|
346
|
+
name: p.context.name, side: p.context.side, counter: p.counter, box: p.box, margins,
|
|
347
|
+
};
|
|
348
|
+
});
|
|
349
|
+
measuring.page.remove();
|
|
350
|
+
return { pages: result, warnings: [...warnings, ...styles.warnings] };
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Lays each element whose page name gives another measure out at that
|
|
354
|
+
* measure, by moving its right margin, until the list is built; returns
|
|
355
|
+
* what puts the margins back.
|
|
356
|
+
*/
|
|
357
|
+
function measureNamedPages(root, names, styles) {
|
|
358
|
+
const changed = [];
|
|
359
|
+
for (const el of root.querySelectorAll('*')) {
|
|
360
|
+
const name = names.of(el);
|
|
361
|
+
const outer = el.parentElement ? names.of(el.parentElement) : '';
|
|
362
|
+
if (name === outer)
|
|
363
|
+
continue;
|
|
364
|
+
const delta = styles.measure(outer) - styles.measure(name);
|
|
365
|
+
if (Math.abs(delta) < 1e-9)
|
|
366
|
+
continue;
|
|
367
|
+
changed.push({ el, margin: el.style.marginRight });
|
|
368
|
+
el.style.marginRight = `${(Number.parseFloat(getComputedStyle(el).marginRight) || 0) + delta}px`;
|
|
369
|
+
}
|
|
370
|
+
return () => {
|
|
371
|
+
for (const { el, margin } of changed)
|
|
372
|
+
el.style.marginRight = margin;
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
/** What a page's margin boxes show: its numbers, strings, running elements and the pages elements are on. */
|
|
376
|
+
function marginContext(b, counter, total, targets) {
|
|
377
|
+
// The names whose first value on the page comes before its first box: `start` takes that value.
|
|
378
|
+
const leading = new Set();
|
|
379
|
+
for (const item of b.items) {
|
|
380
|
+
if (item.type === 'box' && item.kind !== 'null')
|
|
381
|
+
break;
|
|
382
|
+
if (item.type === 'mark')
|
|
383
|
+
leading.add(item.name);
|
|
384
|
+
}
|
|
385
|
+
const pick = (name, policy, kind) => {
|
|
386
|
+
const m = b.marks.get(name);
|
|
387
|
+
if (!m)
|
|
388
|
+
return undefined;
|
|
389
|
+
const own = m.all.filter((x) => x.kind === kind);
|
|
390
|
+
const ok = (x) => (x?.kind === kind ? x : undefined);
|
|
391
|
+
switch (policy) {
|
|
392
|
+
case 'first': return own[0] ?? ok(m.top);
|
|
393
|
+
case 'start': return leading.has(name) ? own[0] ?? ok(m.top) : ok(m.top);
|
|
394
|
+
case 'last': return own.at(-1) ?? ok(m.top);
|
|
395
|
+
case 'first-except': return own.length ? undefined : ok(m.top);
|
|
396
|
+
}
|
|
397
|
+
};
|
|
398
|
+
return {
|
|
399
|
+
counter: (name) => (name === 'page' ? counter : name === 'pages' ? total : undefined),
|
|
400
|
+
string: (name, policy) => {
|
|
401
|
+
const m = pick(name, policy, 'string');
|
|
402
|
+
return m?.kind === 'string' ? m.text : '';
|
|
403
|
+
},
|
|
404
|
+
element: (name, policy) => pick(name, policy, 'running')?.element,
|
|
405
|
+
target: (id, name) => (name === 'page' ? targets.get(id) : undefined),
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
/** A page's `counter-reset: page <n>` or `counter-set`, from its `@page` rules or, failing them, the last element starting on it to set one. */
|
|
409
|
+
function pageCounterReset(style, elements) {
|
|
410
|
+
const own = (prop) => {
|
|
411
|
+
const v = valueOf(style.page, prop);
|
|
412
|
+
return v === undefined ? undefined : counterValue(v, 'page');
|
|
413
|
+
};
|
|
414
|
+
const set = own('counter-set') ?? own('counter-reset');
|
|
415
|
+
if (set !== undefined)
|
|
416
|
+
return set;
|
|
417
|
+
return elements.at(-1);
|
|
418
|
+
}
|
|
419
|
+
function pageCounterIncrement(style) {
|
|
420
|
+
const v = valueOf(style.page, 'counter-increment');
|
|
421
|
+
return (v === undefined ? undefined : counterValue(v, 'page', 1)) ?? 1;
|
|
422
|
+
}
|
|
423
|
+
/** A counter's value in a `counter-reset`-like list (`page 3 chapter`); `fallback` when it has none. */
|
|
424
|
+
function counterValue(value, name, fallback = 0) {
|
|
425
|
+
const ws = value.trim().split(/\s+/);
|
|
426
|
+
for (let i = 0; i < ws.length; i++) {
|
|
427
|
+
if (ws[i] !== name)
|
|
428
|
+
continue;
|
|
429
|
+
const n = ws[i + 1] !== undefined && /^[-+]?\d+$/.test(ws[i + 1]) ? Number.parseInt(ws[i + 1], 10) : fallback;
|
|
430
|
+
return n;
|
|
431
|
+
}
|
|
432
|
+
return undefined;
|
|
433
|
+
}
|
|
434
|
+
/** The style a page's margin boxes write its number in, if any of them does. */
|
|
435
|
+
function folioStyle(style) {
|
|
436
|
+
for (const decls of style.margins.values()) {
|
|
437
|
+
for (const p of parseContent(valueOf(decls, 'content')) ?? [])
|
|
438
|
+
if (p.kind === 'counter' && p.name === 'page')
|
|
439
|
+
return p.style;
|
|
440
|
+
}
|
|
441
|
+
return undefined;
|
|
442
|
+
}
|
|
443
|
+
function unquote(s) {
|
|
444
|
+
const m = /^\s*(["'])(.*)\1\s*$/.exec(s);
|
|
445
|
+
return m ? m[2].replace(/\\(.)/g, '$1') : s.trim();
|
|
446
|
+
}
|
|
447
|
+
/** The page context's background, to the bleed's edge. */
|
|
448
|
+
function background(page, box, style) {
|
|
449
|
+
const decls = style.page.filter((d) => d.prop.startsWith('background'));
|
|
450
|
+
if (!decls.length)
|
|
451
|
+
return;
|
|
452
|
+
const el = document.createElement('div');
|
|
453
|
+
el.className = 'pw-page-background';
|
|
454
|
+
el.dataset.pwArtifact = 'background';
|
|
455
|
+
for (const d of decls)
|
|
456
|
+
el.style.setProperty(d.prop, d.value);
|
|
457
|
+
const at = box.offset - box.bleed;
|
|
458
|
+
el.style.position = 'absolute';
|
|
459
|
+
el.style.left = el.style.top = `${at}px`;
|
|
460
|
+
el.style.width = `${box.width + 2 * box.bleed}px`;
|
|
461
|
+
el.style.height = `${box.height + 2 * box.bleed}px`;
|
|
462
|
+
page.prepend(el);
|
|
463
|
+
}
|
|
464
|
+
/** Crop marks' and cross marks' sizes, in px: 0.5pt lines, 3pt from the bleed, 18pt long; a cross 18pt wide in a 12pt circle. */
|
|
465
|
+
const MARK = { line: 2 / 3, gap: 4, length: 24, cross: 24, circle: 16 };
|
|
466
|
+
/**
|
|
467
|
+
* CSS's `marks`: crop marks at the trim's corners, outside the bleed, and
|
|
468
|
+
* cross marks (registration targets) at the middle of each side, in the
|
|
469
|
+
* slug; black, a page artifact.
|
|
470
|
+
*/
|
|
471
|
+
function printerMarks(page, box) {
|
|
472
|
+
const { crop, cross } = box.marks;
|
|
473
|
+
if (!crop && !cross)
|
|
474
|
+
return;
|
|
475
|
+
const marks = document.createElement('div');
|
|
476
|
+
marks.className = 'pw-marks';
|
|
477
|
+
marks.dataset.pwArtifact = 'page';
|
|
478
|
+
marks.style.cssText = 'position:absolute;left:0;top:0;width:100%;height:100%';
|
|
479
|
+
const o = box.offset;
|
|
480
|
+
const sheet = { width: box.width + 2 * o, height: box.height + 2 * o };
|
|
481
|
+
const t = MARK.line;
|
|
482
|
+
const rect = (cls, x, y, w, h) => {
|
|
483
|
+
const el = document.createElement('div');
|
|
484
|
+
el.className = cls;
|
|
485
|
+
el.style.cssText = `position:absolute;left:${x}px;top:${y}px;width:${w}px;height:${h}px;background:#000`;
|
|
486
|
+
marks.append(el);
|
|
487
|
+
return el;
|
|
488
|
+
};
|
|
489
|
+
if (crop) {
|
|
490
|
+
const near = box.bleed + MARK.gap;
|
|
491
|
+
for (const x of [o, o + box.width]) {
|
|
492
|
+
for (const y of [o, o + box.height]) {
|
|
493
|
+
const out = (v, edge) => (v === edge ? -1 : 1);
|
|
494
|
+
const dx = out(x, o);
|
|
495
|
+
const dy = out(y, o);
|
|
496
|
+
// Horizontal, beside the corner, and vertical, above or below it.
|
|
497
|
+
rect('pw-crop-mark', dx < 0 ? x - near - MARK.length : x + near, y - t / 2, MARK.length, t);
|
|
498
|
+
rect('pw-crop-mark', x - t / 2, dy < 0 ? y - near - MARK.length : y + near, t, MARK.length);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
if (cross) {
|
|
503
|
+
// In the middle of the slug, beside the middle of each side.
|
|
504
|
+
const mid = (o - box.bleed) / 2;
|
|
505
|
+
for (const [cx, cy] of [[sheet.width / 2, mid], [sheet.width / 2, sheet.height - mid], [mid, sheet.height / 2], [sheet.width - mid, sheet.height / 2]]) {
|
|
506
|
+
rect('pw-cross-mark', cx - MARK.cross / 2, cy - t / 2, MARK.cross, t);
|
|
507
|
+
rect('pw-cross-mark', cx - t / 2, cy - MARK.cross / 2, t, MARK.cross);
|
|
508
|
+
const circle = document.createElement('div');
|
|
509
|
+
circle.className = 'pw-cross-mark';
|
|
510
|
+
const r = MARK.circle / 2;
|
|
511
|
+
circle.style.cssText = `position:absolute;left:${cx - r}px;top:${cy - r}px;width:${MARK.circle}px;height:${MARK.circle}px;box-sizing:border-box;border-radius:50%`;
|
|
512
|
+
const border = rewriteExactWidths('border', `${t}px solid #000`, 'ltr');
|
|
513
|
+
if (border && 'declarations' in border)
|
|
514
|
+
for (const d of border.declarations)
|
|
515
|
+
circle.style.setProperty(d.prop, d.value);
|
|
516
|
+
marks.append(circle);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
page.append(marks);
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* The engine's per-element properties (`--pw-float`, `--pw-space-before`…)
|
|
523
|
+
* registered as not inherited, as the stylesheet compiler registers them,
|
|
524
|
+
* for a stylesheet that wasn't compiled: else a footnote's `--pw-float`
|
|
525
|
+
* would reach its marker. And the exact border widths, which margin boxes
|
|
526
|
+
* and marks use as a print edition's stylesheet does.
|
|
527
|
+
*/
|
|
528
|
+
function register(container) {
|
|
529
|
+
if (container.ownerDocument.querySelector('style[data-pw-engine]'))
|
|
530
|
+
return;
|
|
531
|
+
const style = document.createElement('style');
|
|
532
|
+
style.dataset.pwEngine = '';
|
|
533
|
+
style.textContent = `${elementPropertyRegistrations()}\n${exactWidthRegistrations()}`;
|
|
534
|
+
container.ownerDocument.head.append(style);
|
|
535
|
+
}
|
|
536
|
+
/** The language an element is in, by its own `lang` or its nearest ancestor's. */
|
|
537
|
+
export function languageOf(el) {
|
|
538
|
+
return el.closest('[lang]')?.getAttribute('lang') ?? undefined;
|
|
539
|
+
}
|
|
540
|
+
function floatRegion(area, cls) {
|
|
541
|
+
const region = document.createElement('div');
|
|
542
|
+
region.className = cls;
|
|
543
|
+
region.style.cssText = 'position:absolute;left:0;width:100%';
|
|
544
|
+
area.append(region);
|
|
545
|
+
return region;
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* The list as the page builder takes it, broken where the page name
|
|
549
|
+
* changes: each float able to wait whole for
|
|
550
|
+
* a later page, as plain TeX's `\topinsert` is (`\penalty100` before it),
|
|
551
|
+
* and a top float with `--pw-float-skip` between it and the text below.
|
|
552
|
+
*
|
|
553
|
+
* CSS keeps the space after a forced break, and at the flow's start, where
|
|
554
|
+
* TeX discards glue at a page's top (CSS Fragmentation, §5.2: only an
|
|
555
|
+
* unforced break truncates margins). That space is kept as LaTeX's
|
|
556
|
+
* `\vspace*` keeps it: an empty box before it, held to it by `\nobreak`;
|
|
557
|
+
* so is space that is only stretch, `--pw-space-before: 0pt plus 1fil`.
|
|
558
|
+
*/
|
|
559
|
+
function contributions(items, floatSkip, names) {
|
|
560
|
+
const out = [];
|
|
561
|
+
let kept = true;
|
|
562
|
+
let name;
|
|
563
|
+
for (const item of items) {
|
|
564
|
+
if (item.type === 'box') {
|
|
565
|
+
// Where the page name changes, the page breaks: after the last box of
|
|
566
|
+
// the old name and what migrated out of its line.
|
|
567
|
+
const own = names.ofBox(item);
|
|
568
|
+
if (name !== undefined && own !== name) {
|
|
569
|
+
let at = out.findLastIndex((x) => x.type === 'box' && x.kind !== 'null') + 1;
|
|
570
|
+
while (at < out.length && (out[at].type === 'insert' || out[at].type === 'mark'))
|
|
571
|
+
at++;
|
|
572
|
+
out.splice(at, 0, { type: 'penalty', penalty: EJECT_PENALTY });
|
|
573
|
+
}
|
|
574
|
+
name = own;
|
|
575
|
+
}
|
|
576
|
+
// Stretchable space too, as `\vspace*{\fill}`: a copyright notice at its page's foot.
|
|
577
|
+
if (kept && item.type === 'glue' && (item.width > 0 || item.stretch > 0))
|
|
578
|
+
out.push({ type: 'box', kind: 'null', height: 0, depth: 0 }, { type: 'penalty', penalty: 10000 });
|
|
579
|
+
if (item.type === 'box')
|
|
580
|
+
kept = false;
|
|
581
|
+
else if (item.type === 'penalty' && item.penalty <= -10000)
|
|
582
|
+
kept = true;
|
|
583
|
+
if (item.type !== 'insert' || item.class === 'footnote') {
|
|
584
|
+
out.push(item);
|
|
585
|
+
continue;
|
|
586
|
+
}
|
|
587
|
+
const list = [{ type: 'penalty', penalty: 100 }, ...item.list];
|
|
588
|
+
if (item.class === 'top')
|
|
589
|
+
list.push({ type: 'penalty', penalty: 10000 }, { type: 'glue', ...floatSkip });
|
|
590
|
+
out.push({ ...item, list, height: natural(list) });
|
|
591
|
+
}
|
|
592
|
+
return out;
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* Gives the page builder the list, breaking each multi-column box into rows
|
|
596
|
+
* of columns as it comes, as LaTeX's `multicols` does: the first row fills
|
|
597
|
+
* what is left of its page (`builder.room()`), each next row a page, and
|
|
598
|
+
* the last is balanced, its columns as short as holds what is left. Each
|
|
599
|
+
* column is broken from the list as TeX's `\vsplit` breaks it
|
|
600
|
+
* (`vertBreak`), its last line's depth inside it. When the page has too
|
|
601
|
+
* little room left for what must stay with the columns (a heading before
|
|
602
|
+
* them, held to them by a +10000 penalty) and two lines of them, the page
|
|
603
|
+
* is broken before that, as `multicols` breaks it when less than
|
|
604
|
+
* `\premulticols` is left.
|
|
605
|
+
*/
|
|
606
|
+
function contribute(builder, items) {
|
|
607
|
+
let from = 0;
|
|
608
|
+
for (const [i, item] of items.entries()) {
|
|
609
|
+
if (item.type !== 'box' || item.kind !== 'columns')
|
|
610
|
+
continue;
|
|
611
|
+
const k = lastBreakpoint(items, from, i);
|
|
612
|
+
builder.contribute(items.slice(from, k));
|
|
613
|
+
const kept = items.slice(k, i);
|
|
614
|
+
if (builder.room() < natural(kept) + opening(item.list))
|
|
615
|
+
builder.contribute([{ type: 'penalty', penalty: EJECT_PENALTY }]);
|
|
616
|
+
builder.contribute(kept);
|
|
617
|
+
builder.contribute(columnRows(item, builder.room(), (k) => builder.vsizeAfter(k)));
|
|
618
|
+
from = i + 1;
|
|
619
|
+
}
|
|
620
|
+
builder.contribute(items.slice(from));
|
|
621
|
+
}
|
|
622
|
+
/** Where the page could last break before `end`: a penalty under 10000, or glue after a box. `from` if nowhere. */
|
|
623
|
+
function lastBreakpoint(items, from, end) {
|
|
624
|
+
for (let k = end - 1; k > from; k--) {
|
|
625
|
+
const p = items[k];
|
|
626
|
+
if (p.type === 'penalty' && p.penalty < INFINITE_VPENALTY)
|
|
627
|
+
return k;
|
|
628
|
+
const before = items[k - 1];
|
|
629
|
+
if (p.type === 'glue' && (before.type === 'box' || before.type === 'mark' || before.type === 'insert'))
|
|
630
|
+
return k;
|
|
631
|
+
}
|
|
632
|
+
return from;
|
|
633
|
+
}
|
|
634
|
+
/** The height of a column's first two boxes, and what is between them: the least a row of columns may start a page's foot with. */
|
|
635
|
+
function opening(list) {
|
|
636
|
+
const start = pruneTop(list, ZERO);
|
|
637
|
+
let boxes = 0;
|
|
638
|
+
let k = 0;
|
|
639
|
+
while (k < start.length && boxes < 2)
|
|
640
|
+
if (start[k++].type === 'box')
|
|
641
|
+
boxes++;
|
|
642
|
+
return natural(start.slice(0, k));
|
|
643
|
+
}
|
|
644
|
+
const ZERO = { width: 0, stretch: 0, shrink: 0 };
|
|
645
|
+
/** A hair under a row's height, so that rounding never makes a row that fills its page's room overfill it. */
|
|
646
|
+
const EPSILON = 1e-6;
|
|
647
|
+
/**
|
|
648
|
+
* The rows of columns a multi-column box is broken into, the first `room`
|
|
649
|
+
* high, each next its page's `\vsize` (`vsizeAfter(k)`, `k` pages on), the
|
|
650
|
+
* last balanced.
|
|
651
|
+
*/
|
|
652
|
+
function columnRows(box, room, vsizeAfter) {
|
|
653
|
+
const out = [];
|
|
654
|
+
const sp = (t, s) => badness(Math.round(t * SP_PER_PX), Math.round(s * SP_PER_PX));
|
|
655
|
+
/** The list broken into `box.count` columns of height `h`, and what is left. */
|
|
656
|
+
const split = (list, h) => {
|
|
657
|
+
const columns = [];
|
|
658
|
+
let rest = list;
|
|
659
|
+
for (let c = 0; c < box.count; c++) {
|
|
660
|
+
if (!rest.some((p) => p.type === 'box')) {
|
|
661
|
+
columns.push([]);
|
|
662
|
+
continue;
|
|
663
|
+
}
|
|
664
|
+
const at = vertBreak(rest, h, 0, sp).at;
|
|
665
|
+
columns.push(at === undefined ? [...rest] : rest.slice(0, at));
|
|
666
|
+
rest = at === undefined ? [] : pruneTop(rest.slice(at), ZERO);
|
|
667
|
+
}
|
|
668
|
+
return { columns, rest };
|
|
669
|
+
};
|
|
670
|
+
/** Whether the list goes in one row `h` high, no column overfull. */
|
|
671
|
+
const fits = (list, h) => {
|
|
672
|
+
const { columns, rest } = split(list, h);
|
|
673
|
+
return !rest.some((p) => p.type === 'box') && columns.every((c) => natural(c) <= h + EPSILON);
|
|
674
|
+
};
|
|
675
|
+
const row = (columns, h, set) => ({
|
|
676
|
+
...box, height: Math.max(0, h - EPSILON), depth: 0,
|
|
677
|
+
columns: columns.map((items) => ({ items: items, glue: set ? vpack(items, h, 0).glue : NATURAL })),
|
|
678
|
+
});
|
|
679
|
+
let rest = pruneTop(box.list, ZERO);
|
|
680
|
+
let h = room;
|
|
681
|
+
let ahead = 0;
|
|
682
|
+
for (let guard = 0; rest.some((p) => p.type === 'box'); guard++) {
|
|
683
|
+
if (guard > 10000)
|
|
684
|
+
throw new Error('a multi-column box never ends: its columns take nothing');
|
|
685
|
+
if (fits(rest, h)) {
|
|
686
|
+
// The last row: the shortest height that holds the rest.
|
|
687
|
+
let lo = natural(rest) / box.count;
|
|
688
|
+
let hi = h;
|
|
689
|
+
if (fits(rest, lo))
|
|
690
|
+
hi = lo;
|
|
691
|
+
else
|
|
692
|
+
for (let n = 0; n < 30 && hi - lo > 1 / 64; n++) {
|
|
693
|
+
const mid = (lo + hi) / 2;
|
|
694
|
+
if (fits(rest, mid))
|
|
695
|
+
hi = mid;
|
|
696
|
+
else
|
|
697
|
+
lo = mid;
|
|
698
|
+
}
|
|
699
|
+
const { columns } = split(rest, hi);
|
|
700
|
+
out.push(row(columns, Math.max(...columns.map((c) => natural(c))), false));
|
|
701
|
+
break;
|
|
702
|
+
}
|
|
703
|
+
const { columns, rest: left } = split(rest, h);
|
|
704
|
+
if (h < vsizeAfter(ahead) && columns.some((c) => natural(c) > h)) {
|
|
705
|
+
// Not even a line fits what is left of the page: the columns start on the next.
|
|
706
|
+
out.push({ type: 'penalty', penalty: EJECT_PENALTY });
|
|
707
|
+
h = vsizeAfter(++ahead);
|
|
708
|
+
continue;
|
|
709
|
+
}
|
|
710
|
+
out.push(row(columns, h, true), { type: 'penalty', penalty: 0 });
|
|
711
|
+
rest = left;
|
|
712
|
+
h = vsizeAfter(++ahead);
|
|
713
|
+
}
|
|
714
|
+
return out;
|
|
715
|
+
}
|
|
716
|
+
/**
|
|
717
|
+
* Before a table is broken, its columns are fixed at the widths the browser
|
|
718
|
+
* gave them, so each page's part of it, with only some of its rows, keeps
|
|
719
|
+
* them.
|
|
720
|
+
*/
|
|
721
|
+
function fixTables(root) {
|
|
722
|
+
for (const table of root.querySelectorAll('table')) {
|
|
723
|
+
const rows = [...table.rows];
|
|
724
|
+
if (!rows.length)
|
|
725
|
+
continue;
|
|
726
|
+
const row = rows.reduce((a, r) => (r.cells.length > a.cells.length ? r : a));
|
|
727
|
+
const widths = [...row.cells].flatMap((c) => Array.from({ length: c.colSpan }, () => c.getBoundingClientRect().width / c.colSpan));
|
|
728
|
+
const width = table.getBoundingClientRect().width;
|
|
729
|
+
const group = document.createElement('colgroup');
|
|
730
|
+
group.className = 'pw-columns';
|
|
731
|
+
for (const w of widths) {
|
|
732
|
+
const col = document.createElement('col');
|
|
733
|
+
col.style.width = `${w}px`;
|
|
734
|
+
group.append(col);
|
|
735
|
+
}
|
|
736
|
+
table.prepend(group);
|
|
737
|
+
table.style.tableLayout = 'fixed';
|
|
738
|
+
table.style.width = `${width}px`;
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
/** A table's header rows, repeated at the top of each page it continues on. */
|
|
742
|
+
class HeaderRows {
|
|
743
|
+
rows = new Map();
|
|
744
|
+
repeat(last, next) {
|
|
745
|
+
if (last?.type !== 'box' || last.kind !== 'row' || next.type !== 'box' || next.kind !== 'row' || next.header)
|
|
746
|
+
return [];
|
|
747
|
+
const t = next.containers.indexOf([...next.containers].reverse().find((c) => c instanceof HTMLTableElement));
|
|
748
|
+
const table = next.containers[t];
|
|
749
|
+
if (!table?.tHead || !last.containers.includes(table))
|
|
750
|
+
return [];
|
|
751
|
+
let rows = this.rows.get(table);
|
|
752
|
+
if (!rows) {
|
|
753
|
+
const containers = [...next.containers.slice(0, t + 1), table.tHead];
|
|
754
|
+
rows = [...table.tHead.rows].map((row) => {
|
|
755
|
+
const r = row.getBoundingClientRect();
|
|
756
|
+
return { row, box: { type: 'box', kind: 'row', header: true, height: r.height, depth: 0, width: r.width, shift: next.shift, containers } };
|
|
757
|
+
});
|
|
758
|
+
this.rows.set(table, rows);
|
|
759
|
+
}
|
|
760
|
+
// Each time a fresh copy of each row, without ids, kept with the next.
|
|
761
|
+
const out = [];
|
|
762
|
+
for (const { row, box } of rows) {
|
|
763
|
+
const clone = row.cloneNode(true);
|
|
764
|
+
for (const el of [clone, ...clone.querySelectorAll('[id]')])
|
|
765
|
+
el.removeAttribute('id');
|
|
766
|
+
clone.dataset.pwRepeated = '';
|
|
767
|
+
out.push({ ...box, element: clone }, { type: 'penalty', penalty: 10000 });
|
|
768
|
+
}
|
|
769
|
+
return out;
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
//# sourceMappingURL=pages.js.map
|