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,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output intents (https://plans.inkylabs.com/pulpweaver#colour-and-prepress):
|
|
3
|
+
* the printing condition a print edition is made for, as `pulpweaver4.toml`’s
|
|
4
|
+
* `output-intent` names it, a standard one by name or a printer’s own
|
|
5
|
+
* profile by its file. A CMYK edition’s colours are converted through its
|
|
6
|
+
* profile, and a PDF/X file carries it with the condition’s registered name.
|
|
7
|
+
*
|
|
8
|
+
* No profile is bundled. The standard ones are in the ICC’s profile registry
|
|
9
|
+
* (https://registry.color.org/profile-registry/), each under its owner’s
|
|
10
|
+
* terms, which let some be shared and not others, so a host fetches a
|
|
11
|
+
* shareable one when a build needs it, and the core checks it against the
|
|
12
|
+
* hash here. FOGRA51’s may not be redistributed, but each user may download
|
|
13
|
+
* it from its owner, ECI: a host that can (the CLI’s `pw profiles get`)
|
|
14
|
+
* fetches it on the user’s own machine once they accept ECI’s terms, and
|
|
15
|
+
* otherwise the edition names the file the user downloaded.
|
|
16
|
+
*
|
|
17
|
+
* An edition with `output-profile = "registered"` names its condition in the
|
|
18
|
+
* PDF without the profile, as PDF/X-1a and X-3 allow for a condition of the
|
|
19
|
+
* ICC's registry, and the printer supplies the profile. The build still
|
|
20
|
+
* needs it, for the conversion alone: colours and images are converted
|
|
21
|
+
* through it to the condition's CMYK and the ink limit is its, exactly as
|
|
22
|
+
* when it is embedded, so it is loaded the same way, and a build that can't
|
|
23
|
+
* get it fails with the same error (never a guess at the conversion). Its
|
|
24
|
+
* ICC version then doesn't matter, as the file doesn't carry it: GRACoL
|
|
25
|
+
* 2013's 4.2 profile serves a PDF/X-1a edition.
|
|
26
|
+
*/
|
|
27
|
+
import { OUTPUT_INTENTS } from '../config/project-schema.js';
|
|
28
|
+
import { TomlDocument } from '../config/toml.js';
|
|
29
|
+
import { IccProfile, initColour } from './lcms.js';
|
|
30
|
+
/** The ICC’s registry of characterizations, PDF/X’s `RegistryName` for each standard condition here. */
|
|
31
|
+
export const ICC_REGISTRY = 'http://www.color.org';
|
|
32
|
+
const REGISTRY = 'https://registry.color.org/profile-registry/profiles/';
|
|
33
|
+
/**
|
|
34
|
+
* The output intents `pulpweaver4.toml` knows by name, checked against the
|
|
35
|
+
* ICC’s registry in November 2026.
|
|
36
|
+
*/
|
|
37
|
+
export const STANDARD_OUTPUT_INTENTS = {
|
|
38
|
+
GRACoL2013: {
|
|
39
|
+
name: 'GRACoL2013',
|
|
40
|
+
colourSpace: 'CMYK',
|
|
41
|
+
identifier: 'CGATS21-2-CRPC6',
|
|
42
|
+
condition: 'GRACoL 2013: Universal PremCoated, large gamut commercial printing (CGATS 21-2 CRPC6)',
|
|
43
|
+
profile: {
|
|
44
|
+
file: 'GRACoL2013_CRPC6.icc',
|
|
45
|
+
url: `${REGISTRY}GRACoL2013_CRPC6.icc`,
|
|
46
|
+
sha256: '4ebbfad6bc9cfc033fdafdd8ac5df8159208932cb16d9a6596d349ae7ab50443',
|
|
47
|
+
provider: 'Idealliance, with permission of X-Rite, Inc.',
|
|
48
|
+
terms: 'may be used, embedded, exchanged, and shared without restriction; may not be altered, or sold without written permission of Idealliance',
|
|
49
|
+
shareable: true,
|
|
50
|
+
inkLimit: 3.2,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
FOGRA39: {
|
|
54
|
+
name: 'FOGRA39',
|
|
55
|
+
colourSpace: 'CMYK',
|
|
56
|
+
identifier: 'FOGRA39',
|
|
57
|
+
condition: 'Offset printing according to ISO 12647-2:2004/Amd 1, paper type 1 or 2, coated (FOGRA39)',
|
|
58
|
+
profile: {
|
|
59
|
+
file: 'Coated_Fogra39L_VIGC_300.icc',
|
|
60
|
+
url: `${REGISTRY}Coated_Fogra39L_VIGC_300.icc`,
|
|
61
|
+
sha256: '6df43849a84d2632e7900a125f657bd09364ed56775bc4740c1e39a5492d47e3',
|
|
62
|
+
provider: 'VIGC, with permission of X-Rite, Inc.',
|
|
63
|
+
terms: 'may be used, embedded, exchanged, and shared without restriction; may not be altered or sold without written permission of VIGC',
|
|
64
|
+
shareable: true,
|
|
65
|
+
inkLimit: 3,
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
FOGRA51: {
|
|
69
|
+
name: 'FOGRA51',
|
|
70
|
+
colourSpace: 'CMYK',
|
|
71
|
+
identifier: 'FOGRA51',
|
|
72
|
+
condition: 'Offset printing according to ISO 12647-2:2013, printing substrate 1, premium coated (FOGRA51)',
|
|
73
|
+
profile: {
|
|
74
|
+
file: 'PSOcoated_v3.icc',
|
|
75
|
+
url: `${REGISTRY}PSOcoated_v3.icc`,
|
|
76
|
+
sha256: 'c30ad2c01e8f93135ec7682c535e0a81bc2d177c301e196376c5f5838b5c8e86',
|
|
77
|
+
provider: 'European Color Initiative (ECI), with permission of Heidelberger Druckmaschinen AG',
|
|
78
|
+
terms: 'may be used, embedded and exchanged without restriction; may not be distributed, sold or altered without written permission of ECI',
|
|
79
|
+
shareable: false,
|
|
80
|
+
inkLimit: 3,
|
|
81
|
+
// ECI's downloads page offers it to anyone, with no account or
|
|
82
|
+
// click-through; its terms are the profile's own copyright tag, checked
|
|
83
|
+
// in November 2026. The zip holds the profile and an info sheet.
|
|
84
|
+
download: {
|
|
85
|
+
page: 'https://www.eci.org/doku.php?id=en:downloads',
|
|
86
|
+
url: 'https://eci.org/lib/exe/pso-coated_v3.zip',
|
|
87
|
+
entry: 'PSOcoated_v3.icc',
|
|
88
|
+
owner: 'ECI',
|
|
89
|
+
licence: 'This profile is made available by ECI European Color Initiative (www.eci.org), with permission of Heidelberger Druckmaschinen AG (www.heidelberg.com), and may be used, embedded and exchanged without restriction. It may not be distributed, sold or altered without written permission of ECI European Color Initiative.',
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
SWOP: {
|
|
94
|
+
name: 'SWOP',
|
|
95
|
+
colourSpace: 'CMYK',
|
|
96
|
+
identifier: 'CGATS21-2-CRPC5',
|
|
97
|
+
condition: 'SWOP 2013 C3: publication printing on grade 3 paper (CGATS 21-2 CRPC5)',
|
|
98
|
+
profile: {
|
|
99
|
+
file: 'SWOP2013C3_CRPC5.icc',
|
|
100
|
+
url: `${REGISTRY}SWOP2013C3_CRPC5.icc`,
|
|
101
|
+
sha256: '01123776855855378ed540228875458dfe88fca233a14d5b537800353c04faaf',
|
|
102
|
+
provider: 'Idealliance, with permission of X-Rite, Inc.',
|
|
103
|
+
terms: 'may be used, embedded, exchanged, and shared without restriction; may not be altered, or sold without written permission of Idealliance',
|
|
104
|
+
shareable: true,
|
|
105
|
+
inkLimit: 3,
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
sRGB: {
|
|
109
|
+
name: 'sRGB',
|
|
110
|
+
colourSpace: 'RGB',
|
|
111
|
+
identifier: 'sRGB IEC61966-2.1',
|
|
112
|
+
condition: 'sRGB (IEC 61966-2-1)',
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* An output intent that can't be loaded, with a code and a fix: a host
|
|
117
|
+
* puts it at the edition's `output-intent` ({@link outputIntentProblem}).
|
|
118
|
+
*/
|
|
119
|
+
export class OutputIntentError extends Error {
|
|
120
|
+
code;
|
|
121
|
+
fix;
|
|
122
|
+
constructor(code, message, fix) {
|
|
123
|
+
super(message);
|
|
124
|
+
this.code = code;
|
|
125
|
+
this.fix = fix;
|
|
126
|
+
this.name = 'OutputIntentError';
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/** An output intent's error as the build's problem, at the edition's `output-intent` in `pulpweaver4.toml`. */
|
|
130
|
+
export function outputIntentProblem(error, configText, edition) {
|
|
131
|
+
return TomlDocument.parse(configText, 'pulpweaver4.toml').problem(['editions', edition, 'output-intent'], 'value', error.code, error.message, error.fix);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Loads an edition’s output intent: a standard one by name, or a profile’s
|
|
135
|
+
* file in the project. A file whose bytes are a standard profile’s takes
|
|
136
|
+
* that condition’s registered name; any other is PDF/X’s `Custom`, with its
|
|
137
|
+
* file as the condition.
|
|
138
|
+
*/
|
|
139
|
+
export async function loadOutputIntent(nameOrFile, host = {}) {
|
|
140
|
+
if (Object.hasOwn(STANDARD_OUTPUT_INTENTS, nameOrFile)) {
|
|
141
|
+
const intent = STANDARD_OUTPUT_INTENTS[nameOrFile];
|
|
142
|
+
const { profile } = intent;
|
|
143
|
+
const named = { colourSpace: intent.colourSpace, identifier: intent.identifier, condition: intent.condition, registryName: ICC_REGISTRY, standard: intent.name };
|
|
144
|
+
if (!profile)
|
|
145
|
+
return named;
|
|
146
|
+
const { download } = profile;
|
|
147
|
+
if (!profile.shareable && !(download && host.downloadedProfile)) {
|
|
148
|
+
const from = download ? `${download.owner}’s downloads page, ${download.page},` : profile.url;
|
|
149
|
+
throw new OutputIntentError('unshareable-profile', `output-intent ${intent.name}: its profile, ${profile.file} (${profile.provider}), ${profile.terms}, so pulpweaver4 doesn’t fetch it: download it from ${from} into the project and set output-intent to its path`, `download ${profile.file} from ${download?.page ?? profile.url} into the project and set output-intent = "${profile.file}"`);
|
|
150
|
+
}
|
|
151
|
+
const bytes = profile.shareable ? await (host.standardProfile ?? fetchProfile)({ ...intent, profile }) : await host.downloadedProfile({ ...intent, profile: { ...profile, download: download } });
|
|
152
|
+
const sha = await sha256(bytes);
|
|
153
|
+
if (sha !== profile.sha256)
|
|
154
|
+
throw new OutputIntentError('wrong-profile', `output-intent ${intent.name}: ${profile.file} isn’t the registered profile (its SHA-256 is ${sha}, not ${profile.sha256})`, `fetch it again from ${download?.page ?? profile.url}`);
|
|
155
|
+
return { ...named, profile: bytes };
|
|
156
|
+
}
|
|
157
|
+
if (!host.readFile)
|
|
158
|
+
throw new OutputIntentError('unreadable-profile', `output-intent ${nameOrFile}: the build can’t read the project’s files`);
|
|
159
|
+
const bytes = await host.readFile(nameOrFile);
|
|
160
|
+
await initColour();
|
|
161
|
+
let space;
|
|
162
|
+
try {
|
|
163
|
+
const p = IccProfile.fromBytes(bytes);
|
|
164
|
+
space = p.colourSpace;
|
|
165
|
+
p.close();
|
|
166
|
+
}
|
|
167
|
+
catch (e) {
|
|
168
|
+
throw new OutputIntentError('unreadable-profile', `output-intent ${nameOrFile}: ${e.message}`, 'name the printer’s ICC profile, an .icc file');
|
|
169
|
+
}
|
|
170
|
+
if (space !== 'CMYK' && space !== 'RGB' && space !== 'GRAY')
|
|
171
|
+
throw new OutputIntentError('bad-profile', `output-intent ${nameOrFile}: a ${space} profile can’t be an output intent`, 'name an output profile: CMYK, RGB or grey');
|
|
172
|
+
const sha = await sha256(bytes);
|
|
173
|
+
const known = Object.values(STANDARD_OUTPUT_INTENTS).find((i) => i.profile?.sha256 === sha);
|
|
174
|
+
if (known)
|
|
175
|
+
return { colourSpace: known.colourSpace, profile: bytes, identifier: known.identifier, condition: known.condition, registryName: ICC_REGISTRY, info: nameOrFile, standard: known.name };
|
|
176
|
+
return { colourSpace: space, profile: bytes, identifier: 'Custom', condition: nameOrFile, info: nameOrFile };
|
|
177
|
+
}
|
|
178
|
+
/** The standard condition a profile’s bytes are, if any. */
|
|
179
|
+
export async function standardOutputIntentOf(bytes) {
|
|
180
|
+
const sha = await sha256(bytes);
|
|
181
|
+
return Object.values(STANDARD_OUTPUT_INTENTS).find((i) => i.profile?.sha256 === sha);
|
|
182
|
+
}
|
|
183
|
+
async function fetchProfile(intent) {
|
|
184
|
+
const res = await fetch(intent.profile.url);
|
|
185
|
+
if (!res.ok)
|
|
186
|
+
throw new Error(`${intent.profile.url}: ${res.status}`);
|
|
187
|
+
return new Uint8Array(await res.arrayBuffer());
|
|
188
|
+
}
|
|
189
|
+
async function sha256(bytes) {
|
|
190
|
+
const digest = await crypto.subtle.digest('SHA-256', bytes);
|
|
191
|
+
return [...new Uint8Array(digest)].map((b) => b.toString(16).padStart(2, '0')).join('');
|
|
192
|
+
}
|
|
193
|
+
//# sourceMappingURL=intents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intents.js","sourceRoot":"","sources":["../../src/colour/intents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAKlD,wGAAwG;AACxG,MAAM,CAAC,MAAM,YAAY,GAA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AAK,GAAG,CAAC,MAAM,EAAE,CAAC,CAAA;IACpE,OAAO,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,WAAW,EAAE,CAAC,CAAA;AAChD,CAAC;AAED,KAAK,UAAU,MAAM,CAAC,KAAiB;IACrC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,KAAgC,CAAC,CAAA;IACtF,OAAO,CAAC,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACzF,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Little CMS (https://littlecms.com, MIT), compiled to WebAssembly from
|
|
3
|
+
* `third_party/lcms2`: colour conversion through ICC profiles, for print
|
|
4
|
+
* editions’ output intents (https://plans.inkylabs.com/pulpweaver#colour-and-prepress).
|
|
5
|
+
* The module is plain C over wasi-libc with no JavaScript runtime of its own,
|
|
6
|
+
* so the same bytes run in every browser and in Node; the few WASI calls the
|
|
7
|
+
* C library links are answered here, and none does anything.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Where the module sits beside this one. Vite and esbuild leave
|
|
11
|
+
* `new URL(…, import.meta.url)` pointing at it; a Node host reads the file at
|
|
12
|
+
* this URL and passes the bytes to {@link initColour}.
|
|
13
|
+
*/
|
|
14
|
+
export declare const LCMS_WASM_URL: URL;
|
|
15
|
+
/** The source of the module: bytes, a compiled module, a `Response` or a URL. */
|
|
16
|
+
export type ColourWasmSource = BufferSource | WebAssembly.Module | Response | URL | string;
|
|
17
|
+
/**
|
|
18
|
+
* Loads Little CMS. By default it is fetched from {@link LCMS_WASM_URL}, which
|
|
19
|
+
* works in browsers (Node’s `fetch` reads no `file:` URLs, so a Node host
|
|
20
|
+
* passes the bytes). Later calls return the first load.
|
|
21
|
+
*/
|
|
22
|
+
export declare function initColour(source?: ColourWasmSource | Promise<ColourWasmSource>): Promise<void>;
|
|
23
|
+
/** A colour space an ICC profile describes, as its four-letter signature names it. */
|
|
24
|
+
export type IccColourSpace = 'GRAY' | 'RGB' | 'CMYK' | 'Lab' | 'XYZ' | string;
|
|
25
|
+
/** The class of device a profile is for: `prtr` (output), `mntr`, `scnr`, `spac`… */
|
|
26
|
+
export type IccDeviceClass = 'prtr' | 'mntr' | 'scnr' | 'spac' | 'link' | 'abst' | 'nmcl' | string;
|
|
27
|
+
/** An ICC profile, opened in Little CMS. {@link close} it when done. */
|
|
28
|
+
export declare class IccProfile {
|
|
29
|
+
/** @internal Little CMS’s handle. */
|
|
30
|
+
readonly handle: number;
|
|
31
|
+
/** The profile’s colour space: what its device values are. */
|
|
32
|
+
readonly colourSpace: IccColourSpace;
|
|
33
|
+
readonly deviceClass: IccDeviceClass;
|
|
34
|
+
/** How many components a colour in {@link colourSpace} has. */
|
|
35
|
+
readonly channels: number;
|
|
36
|
+
private constructor();
|
|
37
|
+
/** A profile from its bytes, such as a printer’s CMYK `.icc` file. */
|
|
38
|
+
static fromBytes(bytes: Uint8Array): IccProfile;
|
|
39
|
+
/** sRGB, as Little CMS builds it: CSS’s colours. */
|
|
40
|
+
static srgb(): IccProfile;
|
|
41
|
+
/** CIELAB under D50, the profile connection space’s white (L* 0–100). */
|
|
42
|
+
static lab(): IccProfile;
|
|
43
|
+
close(): void;
|
|
44
|
+
}
|
|
45
|
+
/** How colours outside the destination’s gamut, and its white, are mapped (ICC.1’s rendering intents). */
|
|
46
|
+
export type RenderingIntent = 'perceptual' | 'relative' | 'saturation' | 'absolute';
|
|
47
|
+
export interface TransformOptions {
|
|
48
|
+
/** `relative` (relative colorimetric) by default, prepress’s usual choice. */
|
|
49
|
+
intent?: RenderingIntent;
|
|
50
|
+
/** Black-point compensation, mapping black to the destination’s black; on by default. */
|
|
51
|
+
blackPointCompensation?: boolean;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* A conversion from one profile’s colour space to another’s, for colours as
|
|
55
|
+
* numbers or images as 8-bit pixels. Device components run from 0 to 1
|
|
56
|
+
* (CMYK too, though Little CMS counts it in percent); Lab is L* 0–100 with a*
|
|
57
|
+
* and b* as they are. {@link close} it when done.
|
|
58
|
+
*/
|
|
59
|
+
export declare class ColourTransform {
|
|
60
|
+
private readonly float;
|
|
61
|
+
private readonly bytes;
|
|
62
|
+
private readonly scaleIn;
|
|
63
|
+
private readonly scaleOut;
|
|
64
|
+
/** Components per colour on each side. */
|
|
65
|
+
readonly channelsIn: number;
|
|
66
|
+
readonly channelsOut: number;
|
|
67
|
+
private constructor();
|
|
68
|
+
static create(from: IccProfile, to: IccProfile, opts?: TransformOptions): ColourTransform;
|
|
69
|
+
/** Converts one colour. */
|
|
70
|
+
convert(colour: readonly number[]): number[];
|
|
71
|
+
/** Converts colours packed one after another (`channelsIn` numbers each). */
|
|
72
|
+
convertMany(colours: Float64Array): Float64Array;
|
|
73
|
+
/**
|
|
74
|
+
* Converts 8-bit pixels, interleaved with no alpha (RGB as `r g b r g b …`),
|
|
75
|
+
* as an image’s are.
|
|
76
|
+
*/
|
|
77
|
+
convertPixels(pixels: Uint8Array): Uint8Array;
|
|
78
|
+
close(): void;
|
|
79
|
+
}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Little CMS (https://littlecms.com, MIT), compiled to WebAssembly from
|
|
3
|
+
* `third_party/lcms2`: colour conversion through ICC profiles, for print
|
|
4
|
+
* editions’ output intents (https://plans.inkylabs.com/pulpweaver#colour-and-prepress).
|
|
5
|
+
* The module is plain C over wasi-libc with no JavaScript runtime of its own,
|
|
6
|
+
* so the same bytes run in every browser and in Node; the few WASI calls the
|
|
7
|
+
* C library links are answered here, and none does anything.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Where the module sits beside this one. Vite and esbuild leave
|
|
11
|
+
* `new URL(…, import.meta.url)` pointing at it; a Node host reads the file at
|
|
12
|
+
* this URL and passes the bytes to {@link initColour}.
|
|
13
|
+
*/
|
|
14
|
+
export const LCMS_WASM_URL = new URL('./wasm/lcms2.wasm', import.meta.url);
|
|
15
|
+
let ready;
|
|
16
|
+
let lcms;
|
|
17
|
+
/**
|
|
18
|
+
* Loads Little CMS. By default it is fetched from {@link LCMS_WASM_URL}, which
|
|
19
|
+
* works in browsers (Node’s `fetch` reads no `file:` URLs, so a Node host
|
|
20
|
+
* passes the bytes). Later calls return the first load.
|
|
21
|
+
*/
|
|
22
|
+
export function initColour(source = LCMS_WASM_URL) {
|
|
23
|
+
ready ??= load(source).then((e) => {
|
|
24
|
+
lcms = e;
|
|
25
|
+
}, (e) => {
|
|
26
|
+
ready = undefined;
|
|
27
|
+
throw e;
|
|
28
|
+
});
|
|
29
|
+
return ready;
|
|
30
|
+
}
|
|
31
|
+
async function load(from) {
|
|
32
|
+
let source = await from;
|
|
33
|
+
if (source instanceof URL || typeof source === 'string')
|
|
34
|
+
source = await fetch(source);
|
|
35
|
+
if (source instanceof Response) {
|
|
36
|
+
if (!source.ok)
|
|
37
|
+
throw new Error(`initColour: ${source.url}: ${source.status}`);
|
|
38
|
+
source = await source.arrayBuffer();
|
|
39
|
+
}
|
|
40
|
+
const module = source instanceof WebAssembly.Module ? source : await WebAssembly.compile(source);
|
|
41
|
+
let memory;
|
|
42
|
+
// wasi-libc links its stdio and clock, which Little CMS reaches only for
|
|
43
|
+
// files and a profile's creation date: every call fails as unsupported,
|
|
44
|
+
// except the clock, which says 1970, so a built profile is the same
|
|
45
|
+
// everywhere.
|
|
46
|
+
const wasi = {};
|
|
47
|
+
for (const i of WebAssembly.Module.imports(module)) {
|
|
48
|
+
if (i.module !== 'wasi_snapshot_preview1' || i.kind !== 'function')
|
|
49
|
+
continue;
|
|
50
|
+
wasi[i.name] = i.name === 'clock_time_get'
|
|
51
|
+
? (_id, _precision, at) => {
|
|
52
|
+
new DataView(memory.buffer).setBigUint64(at, 0n, true);
|
|
53
|
+
return 0;
|
|
54
|
+
}
|
|
55
|
+
: i.name === 'proc_exit'
|
|
56
|
+
? () => {
|
|
57
|
+
throw new Error('Little CMS exited');
|
|
58
|
+
}
|
|
59
|
+
: () => 52; // ENOSYS
|
|
60
|
+
}
|
|
61
|
+
const instance = await WebAssembly.instantiate(module, { wasi_snapshot_preview1: wasi });
|
|
62
|
+
const e = instance.exports;
|
|
63
|
+
memory = e.memory;
|
|
64
|
+
e._initialize?.();
|
|
65
|
+
e.pw_init();
|
|
66
|
+
return e;
|
|
67
|
+
}
|
|
68
|
+
function api() {
|
|
69
|
+
if (!lcms)
|
|
70
|
+
throw new Error('colour: await initColour() first');
|
|
71
|
+
return lcms;
|
|
72
|
+
}
|
|
73
|
+
function lastError(fallback) {
|
|
74
|
+
const e = api();
|
|
75
|
+
const bytes = new Uint8Array(e.memory.buffer, e.pw_last_error());
|
|
76
|
+
const msg = new TextDecoder().decode(bytes.subarray(0, bytes.indexOf(0)));
|
|
77
|
+
return new Error(msg ? `${fallback}: ${msg}` : fallback);
|
|
78
|
+
}
|
|
79
|
+
const CHANNELS = { GRAY: 1, RGB: 3, CMYK: 4, Lab: 3, XYZ: 3 };
|
|
80
|
+
function signature(n) {
|
|
81
|
+
return String.fromCharCode(n >>> 24, (n >>> 16) & 255, (n >>> 8) & 255, n & 255).trimEnd();
|
|
82
|
+
}
|
|
83
|
+
/** An ICC profile, opened in Little CMS. {@link close} it when done. */
|
|
84
|
+
export class IccProfile {
|
|
85
|
+
handle;
|
|
86
|
+
/** The profile’s colour space: what its device values are. */
|
|
87
|
+
colourSpace;
|
|
88
|
+
deviceClass;
|
|
89
|
+
/** How many components a colour in {@link colourSpace} has. */
|
|
90
|
+
channels;
|
|
91
|
+
constructor(
|
|
92
|
+
/** @internal Little CMS’s handle. */
|
|
93
|
+
handle) {
|
|
94
|
+
this.handle = handle;
|
|
95
|
+
const e = api();
|
|
96
|
+
this.colourSpace = signature(e.pw_profile_space(handle));
|
|
97
|
+
this.deviceClass = signature(e.pw_profile_class(handle));
|
|
98
|
+
const n = CHANNELS[this.colourSpace];
|
|
99
|
+
if (n === undefined) {
|
|
100
|
+
e.pw_profile_close(handle);
|
|
101
|
+
throw new Error(`colour: profiles in ${this.colourSpace} are not supported`);
|
|
102
|
+
}
|
|
103
|
+
this.channels = n;
|
|
104
|
+
}
|
|
105
|
+
/** A profile from its bytes, such as a printer’s CMYK `.icc` file. */
|
|
106
|
+
static fromBytes(bytes) {
|
|
107
|
+
const e = api();
|
|
108
|
+
const p = e.pw_malloc(bytes.length);
|
|
109
|
+
new Uint8Array(e.memory.buffer, p, bytes.length).set(bytes);
|
|
110
|
+
const h = e.pw_profile_open(p, bytes.length);
|
|
111
|
+
e.pw_free(p);
|
|
112
|
+
if (!h)
|
|
113
|
+
throw lastError('colour: not an ICC profile Little CMS can read');
|
|
114
|
+
return new IccProfile(h);
|
|
115
|
+
}
|
|
116
|
+
/** sRGB, as Little CMS builds it: CSS’s colours. */
|
|
117
|
+
static srgb() {
|
|
118
|
+
return new IccProfile(api().pw_profile_srgb());
|
|
119
|
+
}
|
|
120
|
+
/** CIELAB under D50, the profile connection space’s white (L* 0–100). */
|
|
121
|
+
static lab() {
|
|
122
|
+
return new IccProfile(api().pw_profile_lab());
|
|
123
|
+
}
|
|
124
|
+
close() {
|
|
125
|
+
api().pw_profile_close(this.handle);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
const INTENTS = { perceptual: 0, relative: 1, saturation: 2, absolute: 3 };
|
|
129
|
+
/** Little CMS’s `cmsFLAGS_BLACKPOINTCOMPENSATION`. */
|
|
130
|
+
const BPC = 0x2000;
|
|
131
|
+
/**
|
|
132
|
+
* A conversion from one profile’s colour space to another’s, for colours as
|
|
133
|
+
* numbers or images as 8-bit pixels. Device components run from 0 to 1
|
|
134
|
+
* (CMYK too, though Little CMS counts it in percent); Lab is L* 0–100 with a*
|
|
135
|
+
* and b* as they are. {@link close} it when done.
|
|
136
|
+
*/
|
|
137
|
+
export class ColourTransform {
|
|
138
|
+
float;
|
|
139
|
+
bytes;
|
|
140
|
+
scaleIn;
|
|
141
|
+
scaleOut;
|
|
142
|
+
channelsIn;
|
|
143
|
+
channelsOut;
|
|
144
|
+
constructor(float, bytes, scaleIn, scaleOut,
|
|
145
|
+
/** Components per colour on each side. */
|
|
146
|
+
channelsIn, channelsOut) {
|
|
147
|
+
this.float = float;
|
|
148
|
+
this.bytes = bytes;
|
|
149
|
+
this.scaleIn = scaleIn;
|
|
150
|
+
this.scaleOut = scaleOut;
|
|
151
|
+
this.channelsIn = channelsIn;
|
|
152
|
+
this.channelsOut = channelsOut;
|
|
153
|
+
}
|
|
154
|
+
static create(from, to, opts = {}) {
|
|
155
|
+
const e = api();
|
|
156
|
+
const intent = INTENTS[opts.intent ?? 'relative'];
|
|
157
|
+
const flags = opts.blackPointCompensation ?? true ? BPC : 0;
|
|
158
|
+
const float = e.pw_transform_create(from.handle, to.handle, intent, flags, 0);
|
|
159
|
+
if (!float)
|
|
160
|
+
throw lastError('colour: no transform between these profiles');
|
|
161
|
+
const bytes = e.pw_transform_create(from.handle, to.handle, intent, flags, 1);
|
|
162
|
+
if (!bytes) {
|
|
163
|
+
e.pw_transform_delete(float);
|
|
164
|
+
throw lastError('colour: no 8-bit transform between these profiles');
|
|
165
|
+
}
|
|
166
|
+
return new ColourTransform(float, bytes, scale(from), scale(to), from.channels, to.channels);
|
|
167
|
+
}
|
|
168
|
+
/** Converts one colour. */
|
|
169
|
+
convert(colour) {
|
|
170
|
+
if (colour.length !== this.channelsIn)
|
|
171
|
+
throw new Error(`colour: expected ${this.channelsIn} components, got ${colour.length}`);
|
|
172
|
+
return [...this.convertMany(Float64Array.from(colour))];
|
|
173
|
+
}
|
|
174
|
+
/** Converts colours packed one after another (`channelsIn` numbers each). */
|
|
175
|
+
convertMany(colours) {
|
|
176
|
+
const n = colours.length / this.channelsIn;
|
|
177
|
+
if (!Number.isInteger(n))
|
|
178
|
+
throw new Error(`colour: ${colours.length} numbers aren't whole colours of ${this.channelsIn}`);
|
|
179
|
+
const e = api();
|
|
180
|
+
const src = e.pw_malloc(colours.length * 8);
|
|
181
|
+
const dst = e.pw_malloc(n * this.channelsOut * 8);
|
|
182
|
+
try {
|
|
183
|
+
const input = new Float64Array(e.memory.buffer, src, colours.length);
|
|
184
|
+
for (let i = 0; i < colours.length; i++)
|
|
185
|
+
input[i] = colours[i] * this.scaleIn[i % this.channelsIn];
|
|
186
|
+
e.pw_transform_run(this.float, src, dst, n);
|
|
187
|
+
const out = new Float64Array(new Float64Array(e.memory.buffer, dst, n * this.channelsOut));
|
|
188
|
+
for (let i = 0; i < out.length; i++)
|
|
189
|
+
out[i] = out[i] / this.scaleOut[i % this.channelsOut];
|
|
190
|
+
return out;
|
|
191
|
+
}
|
|
192
|
+
finally {
|
|
193
|
+
e.pw_free(src);
|
|
194
|
+
e.pw_free(dst);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Converts 8-bit pixels, interleaved with no alpha (RGB as `r g b r g b …`),
|
|
199
|
+
* as an image’s are.
|
|
200
|
+
*/
|
|
201
|
+
convertPixels(pixels) {
|
|
202
|
+
const n = pixels.length / this.channelsIn;
|
|
203
|
+
if (!Number.isInteger(n))
|
|
204
|
+
throw new Error(`colour: ${pixels.length} bytes aren't whole pixels of ${this.channelsIn}`);
|
|
205
|
+
const e = api();
|
|
206
|
+
const src = e.pw_malloc(pixels.length);
|
|
207
|
+
const dst = e.pw_malloc(n * this.channelsOut);
|
|
208
|
+
try {
|
|
209
|
+
new Uint8Array(e.memory.buffer, src, pixels.length).set(pixels);
|
|
210
|
+
e.pw_transform_run(this.bytes, src, dst, n);
|
|
211
|
+
return new Uint8Array(new Uint8Array(e.memory.buffer, dst, n * this.channelsOut));
|
|
212
|
+
}
|
|
213
|
+
finally {
|
|
214
|
+
e.pw_free(src);
|
|
215
|
+
e.pw_free(dst);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
close() {
|
|
219
|
+
const e = api();
|
|
220
|
+
e.pw_transform_delete(this.float);
|
|
221
|
+
e.pw_transform_delete(this.bytes);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
/** Little CMS’s units per our unit, per component: CMYK is in percent, Lab as is. */
|
|
225
|
+
function scale(p) {
|
|
226
|
+
const s = p.colourSpace === 'CMYK' ? 100 : 1;
|
|
227
|
+
return Array.from({ length: p.channels }, () => s);
|
|
228
|
+
}
|
|
229
|
+
//# sourceMappingURL=lcms.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lcms.js","sourceRoot":"","sources":["../../src/colour/lcms.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAQ,IAAI,GAAG,CAAC,mBAAmB,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAA;AAqB/E,IAAI,KAAgC,CAAA;AACpC,IAAI,IAAyB,CAAA;AAK7B;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,MAAM,GAAiD,aAAa;IAC7F,KAAK,KAAK,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CACzB,CAAC,CAAC,EAAE,EAAE;QACJ,IAAI,GAAG,CAAC,CAAA;IACV,CAAC,EACD,CAAC,CAAU,EAAE,EAAE;QACb,KAAK,GAAG,SAAS,CAAA;QACjB,MAAM,CAAC,CAAA;IACT,CAAC,CACF,CAAA;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAED,KAAK,UAAU,IAAI,CAAC,IAAkD;IACpE,IAAI,MAAM,GAAG,MAAM,IAAI,CAAA;IACvB,IAAI,MAAM,YAAY,GAAG,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,MAAM,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,CAAA;IACrF,IAAI,MAAM,YAA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AAED,qFAAqF;AACrF,SAAS,KAAK,CAAC,CAAa;IAC1B,MAAM,CAAC,GAAG,CAAC,CAAC,WAAW,KAAK,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAC5C,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAA;AACpD,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Preview colours for CMYK colours and named inks
|
|
3
|
+
* (https://plans.inkylabs.com/pulpweaver#colour-and-prepress). No browser
|
|
4
|
+
* implements `device-cmyk()`, so the stylesheet compiler lowers each CMYK
|
|
5
|
+
* colour and each ink to a `color(srgb …)` of its own, unique among the
|
|
6
|
+
* stylesheet’s colours, which the browser keeps to six significant digits
|
|
7
|
+
* through inheritance, `currentColor`, gradients and shadows. The painter
|
|
8
|
+
* looks that exact value up here to paint the CMYK colour or the ink it
|
|
9
|
+
* stands for. No preview is an 8-bit colour, which every hex colour, named
|
|
10
|
+
* colour, integer `rgb()` and the browser’s own defaults (black text, link
|
|
11
|
+
* blue) are, so registration black, which looks black, never takes black’s
|
|
12
|
+
* value.
|
|
13
|
+
*/
|
|
14
|
+
/** What a preview colour stands for. */
|
|
15
|
+
export interface ColourPreview {
|
|
16
|
+
/** The preview, in sRGB, each component a whole number of millionths. */
|
|
17
|
+
readonly rgb: readonly [number, number, number];
|
|
18
|
+
/** The CMYK colour, each component from 0 to 1, or an ink’s CMYK fallback. */
|
|
19
|
+
readonly cmyk: readonly [number, number, number, number];
|
|
20
|
+
/** The ink’s name in the PDF, for a named ink. */
|
|
21
|
+
readonly ink?: string;
|
|
22
|
+
}
|
|
23
|
+
/** The previews of a compiled stylesheet, and the way back from each to its colour. */
|
|
24
|
+
export declare class ColourMap {
|
|
25
|
+
private readonly byPreview;
|
|
26
|
+
private readonly byColour;
|
|
27
|
+
/** sRGB colours the stylesheet writes itself that aren’t 8-bit, which no preview may take. */
|
|
28
|
+
private readonly reserved;
|
|
29
|
+
constructor(entries?: Iterable<ColourPreview>);
|
|
30
|
+
/** Every preview, in the order they were made. */
|
|
31
|
+
get entries(): ColourPreview[];
|
|
32
|
+
/** What an sRGB colour (each component 0 to 1, as the browser computed it) is the preview of, if anything. */
|
|
33
|
+
lookup(rgb: readonly [number, number, number]): ColourPreview | undefined;
|
|
34
|
+
/** Keeps a stylesheet’s own sRGB colour from being taken as a preview. */
|
|
35
|
+
reserve(rgb: readonly [number, number, number]): void;
|
|
36
|
+
/**
|
|
37
|
+
* The preview of a CMYK colour, or of an ink if `ink` is given: the same
|
|
38
|
+
* one each time it is asked for, made from `near` (the colour it looks
|
|
39
|
+
* like) by the fewest millionths that make it unique.
|
|
40
|
+
*/
|
|
41
|
+
preview(cmyk: readonly [number, number, number, number], near: readonly [number, number, number], ink?: string): ColourPreview;
|
|
42
|
+
}
|
|
43
|
+
/** A preview as CSS: `color(srgb r g b)`, with the alpha if it isn’t 1. */
|
|
44
|
+
export declare function previewCss(rgb: readonly [number, number, number], alpha?: number): string;
|
|
45
|
+
/**
|
|
46
|
+
* CSS Color 5’s naive conversion of CMYK to sRGB, for a preview when there
|
|
47
|
+
* is no profile to convert it through.
|
|
48
|
+
*/
|
|
49
|
+
export declare function naiveCmykToSrgb([c, m, y, k]: readonly [number, number, number, number]): [number, number, number];
|