Commit Graph
8 Commits
Author SHA1 Message Date
John O'Keefe 50f56ee67f fix(paginator): tolerate not-yet-loaded section documents in early resize renders
The ResizeObserver can fire while the iframe document is still unset:
setImageSize dereferenced doc.body unconditionally and
setStylesImportant destructure-crashed on null, killing the render
loop — the view then never snapped or relocated again (observed in an
embedded Android WebView where the first observation lands pre-load).
Guard both paths.
2026-10-02 15:17:00 -04:00
John O'Keefe 8e1d5fc8d6 feat(docx): Word (.docx) support via mammoth (lazy npm dependency)
makeDocxBook: the docx blob goes straight to mammoth.convertToHtml
(mammoth unzips internally; the browser entry takes {arrayBuffer}, the
node entry {buffer}). Converted HTML is sectioned at block-element
boundaries into ~150KB chunks (string-level — no DOMParser), giving a
Part N TOC; images inline as data URIs by default.

makeBook: zip files whose entries contain word/document.xml route to
the docx branch before the EPUB fallback (previously they died inside
new EPUB(...) on the missing container.xml).

mammoth is the fork's first runtime dependency: updates and security
fixes flow via semver; the browser-field mappings swap its node unzip
for the browser one; the dynamic import keeps it out of every other
format's path.
2026-10-01 14:17:38 -04:00
John O'Keefe cd2fbf278e feat(text): plain-text (.txt) renderer
makeTextBook: UTF-8 decode (BOM stripped), blank-line paragraph split,
hard-wrapped lines joined (natural reflow under font-size changes), HTML
escaped, sections capped at ~150KB at paragraph boundaries (small Part N
TOC, avoids one giant DOM). Sections expose load/createDocument/size per
the reflowable interface; positions for txt books are percentage-based
(sections get fake CFIs from index, same as other non-EPUB books).

makeBook: dispatches text/plain or .txt in the final non-zip/non-pdf
branch. EPUB/PDF/CBZ/MOBI/FB2 routing untouched.

Tests: offline node harness (isText, paragraph join/split, escaping,
section capping, TOC shape, dispatch incl. zip-still-routes-to-EPUB).
2026-09-30 15:12:05 -04:00
John O'Keefe 734ce41a50 chore: bump version to 0.1.0
npm's cache reuse keyed on name@version (stuck at 0.0.0) silently served
stale tarballs to Docker builds; bumping on every deploy-worthy change
forces fresh resolution.
2026-09-17 10:10:24 -04:00
John Factotum 1217096245 Update PDF.js to 5.5.207
Fixes https://github.com/johnfactotum/foliate-js/issues/85
2026-03-05 15:52:38 +08:00
John Factotum ae61c5e85f Make zip.js, fflate, and PDF.js dev dependencies
Previously, zip.js and fflate were built from the main Foliate repo.
And PDF.js files were copied manually. Now they all build here.

Unfortunately, two CSS files still need to be copied manually.
2024-10-12 07:44:33 +08:00
John Factotum 7372c658cf Fix package.json 2024-04-27 16:51:04 +08:00
John Factotum 5600b6c0dc Migrate to ESLint 9 and fix linting issues 2024-04-23 12:59:31 +08:00