API reference
Hand-written from the source of each package's src/index.ts. Every page lists the public exports with signatures and a short explanation. Types use the package's own names; all geometry is in CSS px.
Keeping this in sync
node site/scripts/api-drift.mjs lists every name exported from each package's src/index.ts that these pages don't mention (and pages for packages that disappeared). Run it before a release, or after changing a package's public surface.
| Package | DOM | Depends on | Page |
|---|---|---|---|
@nextgensoftwares/folio-model | no | none | model |
@nextgensoftwares/folio-layout | no | model, bidi-js, linebreak | layout |
@nextgensoftwares/folio-fonts | no | layout, harfbuzzjs | fonts |
@nextgensoftwares/folio-formatter | no | model, layout | formatter |
@nextgensoftwares/folio-editor | yes (clipboard only) | model, layout, prosemirror-* | editor |
@nextgensoftwares/folio-sync | browser storage optional | editor, layout, model, prosemirror-* | sync |
@nextgensoftwares/folio-server-node | no (Node 22+) | sync, plugin-collab, model, prosemirror-*, ws | server-node |
@nextgensoftwares/folio-react | yes | editor, layout, model; peer react | react |
@nextgensoftwares/folio-reader | yes (view only) | model, layout, render-canvas; optional peers react, @nextgensoftwares/folio-fonts, @nextgensoftwares/folio-export-pdf. No editor, no ProseMirror | reader |
@nextgensoftwares/folio-plugin-media | painters only | editor, layout, model; optional peer react | plugin-media |
@nextgensoftwares/folio-plugin-file-preview | React parts only | editor, layout, model, plugin-media; lazy pdfjs-dist, xlsx, mammoth, fflate; optional peer react | plugin-file-preview |
@nextgensoftwares/folio-plugin-math | yes (popover) | editor, react; optional peer react | plugin-math |
@nextgensoftwares/folio-plugin-toc | React parts only | editor, layout, model; optional peer react | plugin-toc |
@nextgensoftwares/folio-plugin-watermark | React parts only | editor, layout; optional peer react | plugin-watermark |
@nextgensoftwares/folio-plugin-code | React parts only | editor, layout, model; optional peers react, docx | plugin-code |
@nextgensoftwares/folio-plugin-callout | React parts only | editor, layout, model, react; optional peers react, docx | plugin-callout |
@nextgensoftwares/folio-import | no | model | import |
@nextgensoftwares/folio-import-formats | no | import, model, htmlparser2, markdown-it, fflate; optional peer pdfjs-dist | import-formats |
@nextgensoftwares/folio-plugin-import | React parts only | editor, import, layout, model; peer react | plugin-import |
@nextgensoftwares/folio-export-pdf | browser helpers only | fonts, layout, model, pdf-lib | export-pdf |
@nextgensoftwares/folio-docx | no | import, model, fflate | docx |
@nextgensoftwares/folio-plugin-collab, @nextgensoftwares/folio-export-docx, @nextgensoftwares/folio-pdf | in progress & stubs |
Conventions
- Immutability. Functions never mutate document nodes they receive. Caches are keyed by object identity (
WeakMap). - Never throws on content.
validate,normalize,layoutDocumentand the theme validators report problems (issues, warnings) instead of throwing. Programming errors (e.g. no font loaded for a family) do throw. - Commands are ProseMirror
Commands:(state, dispatch?) => boolean. Withoutdispatchthey only answer "can this run?". - Versioning. All packages are
0.0.0(pre-release). Expect breaking changes until 1.0; they're recorded with changesets.