30 Commits
Author SHA1 Message Date
adminandClaude Opus 5 7ce2f4ff73 fix: recess the sidebar in light mode, document the theme switcher
In light mode the sidebar was #fff while the toolbar is gray-0, which made it the
brightest surface on screen — it read as a glaring slab beside the chrome rather
than as part of it. A sidebar should sit level with the chrome or slightly below
it, never above. Moving it to gray-1 with a gray-2 header gives a consistent
ladder from the toolbar down to the document surround (L 0.946 / 0.894 / 0.835 /
0.756) and keeps text contrast high (7.35 and 9.70).

Also adds the theme switcher to the README's feature list — it shipped in #16
without being documented there.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-04 16:12:43 +02:00
admin 10d09bd294 Update README.md 2026-06-30 20:48:16 +02:00
adminandClaude Opus 4.8 3df5627b9f feat: add PostScript/EPS support via Riposte + bump deps
Render PostScript and EPS (.ps / .eps / .epsf). Riposte (pure-JS, zero-dep, MIT)
interprets each page and rasterizes it to a <canvas>; the new PostScriptRenderer
drives Riposte's engine and lays pages out as `.postscript-page`, matching the
PDF/DjVu/comic paged-canvas model. A per-page try/catch keeps an unsupported
operator from sinking the whole document.

- New src/renderers/postscript-renderer.js; wired into EXT_MAP (.ps/.eps/.epsf)
  + RENDERER_LOADERS, dropzone pill + toolbar badge (#880e4f), accept list, CSS
- riposte pinned as a git dep (no Vite alias needed — it declares no package exports)
- README / CREDITS / EMBEDDING updated (riposte is the 4th git-dep engine)
- Bump deps: mammoth 1.8->1.12, pdfjs-dist 6.0.227->6.1.200, vite 8.1.0->8.1.2

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 20:44:27 +02:00
adminandClaude Opus 4.8 4643132582 feat: add CHM (.chm) support via CHMate
Render Microsoft Compiled HTML Help files. CHMate (pure-JS, MIT) parses the ITSF
container and LZX-decompresses topics; its hardened renderTopic sanitizes each
topic, inlines resources as blob: URLs and adds a strict CSP. The new
CHMRenderer shows topics in a sandboxed iframe (no allow-scripts), wires
internal (data-chm-href) and external (confirm + new tab) link navigation, and
builds the .hhc table of contents into the sidebar.

- New src/renderers/chm-renderer.js; wired into EXT_MAP + RENDERER_LOADERS,
  dropzone pill + toolbar badge (#006064), file-picker accept list
- chmate pinned as a git dep; `chmate/render` exposed via a Vite resolve alias
  (CHMate's package exports only "."), inherited by the embed-app build
- README / CREDITS / EMBEDDING updated (chmate is the 3rd git-dep engine)
- Also: re-fit the page when the viewer area resizes — a ResizeObserver on
  #viewerContainer re-applies the fit-to-width/height/page scale, so opening the
  sidebar (or resizing the window) no longer leaves the page clipped at its old
  scale. Benefits every renderer, not just CHM.
- /simplify applied: merged duplicate MHTML/CHM iframe CSS, dropped a dead
  field + an inert TOC wrapper div, replaced a parallel Map with data-target.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 18:06:58 +02:00
adminandClaude Opus 4.8 e16a032dd9 feat: add MHTML (.mht/.mhtml) web-archive renderer
Render saved Web Archive (MHTML) pages — the "single file" saves from
Chrome/IE — via mhtml-to-html (MIT, gildas-lormeau). The library unpacks the
MIME container and inlines every resource as a data: URI; the result renders in
a sandboxed iframe (allow-scripts intentionally omitted) so the page's own CSS
can't leak into the app and nothing executes or touches the network.

- New src/renderers/mhtml-renderer.js, lazy-loaded; wired into EXT_MAP and
  RENDERER_LOADERS for .mht/.mhtml, plus the file-picker accept list
- README / CREDITS / EMBEDDING updated; mhtml-to-html stays permissive (MIT)
- Removed dead .odf-frame CSS (an abandoned, unreferenced iframe rule)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 15:37:06 +02:00
adminandClaude Opus 4.8 3c97ffd1f5 docs: README — page-by-page compare + credit jsdiff and Open-Color
Reflect the compare feature accurately (DjVu, page-by-page for multi-page
PDF/DjVu, word-level highlights) and add the two compare-related libraries to
the credits table.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 23:58:40 +02:00
adminandClaude Opus 4.8 e407565e94 feat: compare DjVu and e-books too (extractText via dejaview / foliate)
- DjVuRenderer.extractText(): the dejaview worker's 'text' message returns word
  zones per page; group them into lines by baseline. Worker setup factored into
  _spawnWorker() (shared with load()).
- EPUBRenderer.extractText(): foliate's makeBook() parses any e-book
  (epub/mobi/azw3/fb2) into sections; walk each section document block-aware.
- _extractText already prefers a renderer's extractText(), so both become
  comparable with no other changes. Now only image/comic/pptx (no text) show
  the 'unavailable' message.
- Docs: EMBEDDING/README compare format lists updated (PDF + DjVu + e-books).

Verified: EPUB diff shows changes across chapters (GPL->MIT, required->optional);
DjVu extracts its text layer (757 chars) and renders the diff.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 22:37:24 +02:00
adminandClaude Opus 4.8 defc9e9373 feat: compare two versions with jsdiff — pinnable, blame-aware tooltips
Compare two versions of a text document (txt, md, code, csv, xlsx, docx, rtf,
odf, doc) using jsdiff. Three switchable view modes — side-by-side (default),
unified, inline — all rendered from one diff. Each changed line has a hover
tooltip that can be pinned open; tooltips show blame (author/date/commit/
message) the host supplies, keyed by the new-side line number.

- src/diff-view.js (new, lazy): Diff.diffLines -> aligned row model (del+add
  paired as 'mod'), intra-line word diff, three renderers from one rows[],
  shared hover tooltip + pinnable popovers. DOM-built (no innerHTML).
- main.js: compare(srcA,nameA,srcB,nameB,{blame,mode}); _extractText renders
  each version with a FRESH renderer into a detached node (never the live
  viewer) and extracts text per format (block-aware walk for rich HTML,
  tab/newline for tables); DIFFABLE gate; teardown on normal load.
- Embed: readerjs.js inst.compare(a,b,opts) + a 'compare' mount opt; reader.js
  readerjs:compare message. Blame is plain data (postMessage-safe).
- Demo: a Compare control (pick two files) in index.html, gated to the full app.
- i18n: compare.*/blame.* in all 9 languages; CSS for the diff grid, ins/del,
  tooltip/pin (reusing the .image-info look) + badge-compare.
- diff (jsdiff, BSD-3) added; lazy-split into its own chunk.
- Docs: CREDITS (jsdiff), EMBEDDING (compare + blame API), README feature.

Verified (demo + built embed): side-by-side aligns; unified/inline toggle
instantly; word-level ins/del; hover tooltip shows blame; pin -> persistent
popover; setLang re-translates; pdf/etc -> unsupported without breaking the
view; normal load after compare tears down cleanly. Blame round-trips through
the embed's postMessage.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 20:37:49 +02:00
adminandClaude Opus 4.8 982a85151f refactor: unify on npm dependencies, drop all git submodules
One library-fetching method: everything is an npm dependency, no git
submodules. 'npm install' alone yields a working build.

- foliate-js (e-books) and dejaview (DjVu) aren't published to npm, so they
  are pinned to a commit as git dependencies in package.json (were submodules).
  Imports updated: epub-renderer -> 'foliate-js/view.js'; djvu-renderer worker
  -> node_modules/dejaview.
- vite: optimizeDeps.exclude foliate-js — its stubbed/unused pdf.js uses
  top-level await, which fails esbuild's es2020 prebundle; served as source it
  goes through the existing stubFoliatePdf plugin.
- Removed the 5 reference-only submodules (pdf.js, docx, WebODF, rtf.js,
  marked) — never imported; the runtime uses the npm packages.
- Dropped .gitmodules, submodules/, the monthly update-submodules workflow, the
  deploy checkout's 'submodules: recursive', and the submodules:init script.
  JSDoc's docToText.js stays (already committed under public/jsdoc).
- README: removed the Submodules table; clone no longer needs --recurse-submodules.

Verified: npm ci (fresh-clone sim) + build green; DjVu renders via the
node_modules dejaview worker (dev + build); app boots with foliate loaded.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 16:36:50 +02:00
admin d11396691d Merge pull request #5 from Alpaq92/feat/embeddable
feat: embeddable, byte-based ReaderJS (iframe widget + lazy engines)
2026-06-25 16:02:58 +02:00
adminandClaude Opus 4.8 1e785cd69f feat: embeddable, byte-based ReaderJS (iframe widget + lazy engines)
Expose ReaderJS as a read-only, self-contained, same-origin embed:

  ReaderJS.mount(container, { blob|arrayBuffer, name, mime }) -> { load, destroy }

The host hands in document bytes (not a File); the filename's extension picks
the renderer. Isolated in a same-origin iframe so the viewer's full-page CSS,
JS globals and CSP surface stay out of the host page. Also supports a zero-JS
iframe variant: reader.html?src=<url>&name=<file> (self-fetches same-origin).

- main.js: lazy per-format renderer registry (pdf.js/jszip/foliate split into
  on-demand chunks) + loadBytes(bytes, name, mime); openFile delegates; export
  DocumentViewer; null-tolerant UI wiring; auto-init gated on #dropzone.
- reader.html (trimmed index.html, no upload UI) + src/reader.js bootstrap
  (?src self-fetch or origin-checked postMessage handshake).
- src/readerjs.js: IIFE loader exposing window.ReaderJS.mount (sandboxed iframe,
  structured-clone copy so the host buffer is not neutered).
- vite.config.app.js + vite.config.embed.js -> dist-embed/ (base:'./', workers/
  wasm/public assets bundle-relative); npm run build:embed.
- i18n.js: localStorage guarded for sandboxed contexts.
- CREDITS.md (all engines permissive; pptxviewjs MIT; WebODF reference-only, not
  bundled) + EMBEDDING.md (API, iframe variant, CSP asset list).

Verified against the built artifact: bytes-mode renders DjVu (dejaview module
worker under base:'./'), ?src mode renders CSV, per-format lazy chunks, zero
external-origin requests, destroy() cleanup. Demo app build unaffected.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 15:53:35 +02:00
adminandClaude Opus 4.8 5339effffd docs: use an optimized PPTX screenshot as the README preview
Replace the placeholder hero.svg with a real app screenshot (PPTX viewer
with the thumbnail rail and toolbar). Downscaled 1920->1456px and
re-encoded to 92 KB.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 15:08:50 +02:00
adminandClaude Opus 4.8 d05d1fe17d feat: add DjVu (.djvu/.djv) support via DejaView
Pure-JS, MIT-licensed DjVu decoder (DejaView) running in a Web Worker.
Pages render lazily to canvas (window around the current page plus an
IntersectionObserver for scroll), fit-to-height by default, with sidebar
thumbnails.

- New DjVuRenderer (src/renderers/djvu-renderer.js)
- Register djvu/djv in EXT_MAP + renderers (src/main.js)
- DJVU dropzone pill, accept list, Powered-by footer link (index.html)
- .djvu-page / badge / tag styles (src/style.css)
- dejaview submodule (pinned 5a4ef8a), README format table + credits

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 14:34:54 +02:00
adminandClaude Sonnet 4.6 48e47bd4c1 docs: refresh README hero image
Replace the outdated docx-viewer.png with a crisp SVG of the current dropzone —
shows the MDI toolbar, the cloud-upload drop area, and all supported format
pills (PDF…XLSX, CSV, JSON/XML/YAML, images+EXIF, comics, e-books).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-25 13:30:35 +02:00
adminandClaude Sonnet 4.6 4a28ce13c5 feat: add CSV/TSV, source-code, and spreadsheet (XLSX) support
- CSVRenderer: CSV/TSV → HTML table via Papa Parse (MIT); robust quoting,
  header row, horizontal scroll.
- CodeRenderer: source/config files (JS/TS/JSON/XML/YAML/CSS/Python/…) with
  highlight.js (BSD-3); JSON is pretty-printed. ~35 extensions.
- XLSXRenderer: .xlsx/.xls/.xlsm/.xlsb → one titled HTML table per sheet via
  SheetJS (Apache-2.0, from the official CDN build — current & secure).
- Register all in EXT_MAP; dropzone tags + badges; shared .data-table styling.
- Add the EXIF pill to the dropzone; list SheetJS / Papa Parse / highlight.js
  in the footer + README credits.

All three deps are permissive (Apache-2.0 / MIT / BSD-3), so the license policy
holds. Verified in preview: CSV (quoted commas parsed), JSON/Python highlighted
+ pretty-printed, 2-sheet XLSX renders both sheets. vite build ok.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-25 13:10:50 +02:00
adminandClaude Sonnet 4.6 7e72ab60e9 feat: add PowerPoint (PPTX) support via PptxViewJS
- PPTXRenderer renders .pptx slides to a canvas with PptxViewJS (MIT). The
  toolbar's page nav drives slide changes; opens fit-to-view (page-fit).
- PptxViewJS always paints at the slide's native pixel size and fits the slide
  into the canvas's current backing, so we pin the canvas to native dims
  (from presentation.slideSize, EMU→px) and scale the wrapper via CSS zoom —
  touching canvas.style distorts the slide via its post-load re-render.
- Deps: pptxviewjs (MIT) + chart.js (MIT, peer dep it imports for charts).
- Register pptx in EXT_MAP; dropzone tag + badge; README + credits.
- Also list exifr + UTIF.js in the dropzone "Powered by" footer (were missing
  after the image feature).

Verified in preview: 3-slide deck renders at correct 4:3 aspect, fits the
viewport, zoom (wrapper) and slide navigation work. vite build ok.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-25 12:36:40 +02:00
adminandClaude Sonnet 4.6 e6ae8c5877 feat: add image support (+ EXIF), TIFF, and FB2/FBZ
- ImageRenderer for PNG/JPEG/GIF/WebP/AVIF/BMP/SVG/ICO (native <img>) and TIFF
  (decoded with UTIF.js, multi-page TIFFs become multiple pages). Fits the whole
  image to the viewport on open (page-fit); thumbnails + scroll tracking.
- EXIF/info panel via exifr: format, dimensions, size, plus camera, lens, date,
  focal length, exposure (ƒ/shutter/ISO) and GPS when present. Labels carry
  data-i18n so they translate and react to language switches (added info.* keys
  to all 9 locales).
- FB2 / FBZ routed to the existing foliate-js EPUBRenderer (foliate already
  parses FictionBook) — just register the extensions.
- Register image + fb2/fbz in EXT_MAP; dropzone tags, badge/tag colors; README.
- New deps: utif (MIT), exifr (MIT).

Verified in preview: JPEG renders with full EXIF (incl. GPS), PNG shows basic
info, multi-page TIFF decodes to 2 pages, FB2 renders via foliate; panel labels
switch language live. vite build ok.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-25 12:05:03 +02:00
adminandClaude Sonnet 4.6 163fb10b6f feat: translatable UI with 9 languages and a switcher
- Add a lightweight i18n module (src/i18n.js): per-locale dictionaries, t() for
  dynamic strings, applyTranslations() for data-i18n / -title / -aria markup,
  setLang() with localStorage persistence. No dependency.
- Languages: EN, PL, ES, FR, DE, PT, ZH, JA, RU. Auto-detected from
  navigator.language, falling back to English.
- Mark up all UI strings in index.html (tooltips, zoom options, dropzone text,
  aria-labels, <title>); localize main.js error messages.
- Add a language switcher <select> in the toolbar (shares the zoom select's
  slim-chevron styling); sets <html lang> for accessibility.

Verified: browser-locale auto-detect works (preview detected Polish); switching
to RU/PL/EN updates tooltips, dropzone, zoom labels and title live. vite build ok.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-25 11:33:33 +02:00
adminandClaude Sonnet 4.6 d015368f70 docs: refresh "Powered by" credits
- Dropzone footer now lists marked, JSZip and libarchive.js alongside the
  existing PDF.js / JSDoc / RTF.js / mammoth.js / foliate-js
- README: credit Material Design Icons (Pictogrammers, Apache-2.0)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-25 10:56:03 +02:00
adminandClaude Sonnet 4.6 fe3c84f2a3 feat: add plain-text (TXT) support; fix page-number vertical alignment
- TXTRenderer renders .txt/.text/.log into a monospace <pre> (pre-wrap) inside
  a .doc-page; uses textContent so content is never parsed as markup. Inherits
  the HTML-doc fit-to-width behavior. Adds TXT badge/dropzone tag (brown).
- Fix: drop the `position:relative; top:2px` on #pageNumber. It was nudging the
  input 2px below the hamburger, chevrons and the "/—" text (all centered at
  20.5px); removing it re-centers the input to match.

Verified: TXT renders with preserved line breaks, soft-wraps long lines, ASCII
escaped safely, fits width; toolbar elements all align at the same center.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-25 10:32:22 +02:00
adminandClaude Sonnet 4.6 fe2548190d feat: add EPUB / MOBI / AZW3 support via foliate-js
- Add foliate-js (MIT) as a git submodule, pinned at 78914ae
- Add EPUBRenderer wrapping foliate's <foliate-view> paginator: drives the
  existing toolbar (prev/next/jump via relocate's location.current/total) and
  maps zoom to font-size reflow; reflowable books use content-based locations
- Register epub/mobi/azw3/azw/kf8 in EXT_MAP; thread file name through for
  foliate's format hinting; add format badge + dropzone tags
- Stub foliate's pdf.js (we use our own PDFRenderer) via a Vite resolveId
  plugin — it bundles pdf.mjs through a `new URL` glob that breaks vite build
- README + index.html: document EPUB/MOBI and credit foliate-js

Verified: vite build succeeds (modules code-split); EPUB renders, paginates,
navigates and zooms in the dev preview.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-25 09:01:41 +02:00
adminandClaude Sonnet 4.6 99c09f1a7f feat: add comic-book support (CBZ / CBR / CBT)
- Add ComicRenderer: renders archive page images as a vertical stack with
  scroll-synced page tracking and thumbnails, matching the PDF renderer model
- CBZ unpacked via JSZip (existing dep); CBR/CBT via libarchive.js, whose
  RAR decoder is libarchive's own BSD implementation — no UnRAR-licensed code
- Vendor libarchive.js worker + wasm under public/libarchive/ (served statically)
- Register cbz/cbr/cbt in EXT_MAP; add format badge + dropzone tags
- Also backfill the Markdown (.md) dropzone tag and file-input accept entry
- README: document comic formats and credit libarchive.js

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-25 08:46:41 +02:00
adminandClaude Sonnet 4.6 8f8cd1c4e9 docs: add Markdown support to README
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-25 08:24:59 +02:00
admin 948c6c0c79 refactor: rename PreviewJS to ReaderJS across all files and repo 2026-06-24 18:44:20 +02:00
admin 7bb6347f9f docs: replace standalone Live Demo link with natural sentence 2026-06-20 18:36:16 +02:00
admin 34111602e1 docs: add gallery screenshots, optimize PNGs, add screenshot to README 2026-06-20 18:36:04 +02:00
admin 719eea02ca docs: revert Live Demo link position 2026-06-20 18:33:39 +02:00
admin 733da9f720 docs: use Alpaq92 as copyright holder in README and LICENSE 2026-06-20 18:31:33 +02:00
admin 119c09ce2d docs: move Live Demo link above description in README 2026-06-20 18:31:03 +02:00
adminandClaude Sonnet 4.6 013ebe15e9 feat: add DOC/RTF renderers, GitHub Pages CI/CD, README and MIT license
- Replace mammoth.js .doc handler with JSDoc (Alpaq92/JSDoc submodule)
- Fix RTF.js rendering via jQuery append instead of appendChild
- Use import.meta.env.BASE_URL for asset paths to support /PreviewJS/ base
- Add GitHub Actions: deploy.yml (push-triggered Pages deploy) and
  update-submodules.yml (monthly cron with release creation)
- Add .gitignore, README.md with Credits, MIT LICENSE

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-20 18:27:23 +02:00