Commit Graph
12 Commits
Author SHA1 Message Date
john-okeefe bd79aae3d5 chore: vendor ML/CV libraries for panel detection
Add machine learning and computer vision libraries to vendor/ directory
to support panel detection feature. Following foliate-js's existing pattern
of vendoring large dependencies (similar to pdf.js at 13MB).

Vendored libraries (~12.5MB):
- vendor/tfjs/tf.min.js (1.5MB): TensorFlow.js UMD build
  * Downloaded from unpkg.com during build via custom Rollup plugin
  * Required runtime for COCO-SSD model

- vendor/opencv/opencv.js (~11MB): OpenCV.js UMD build
  * Copied from @techstark/opencv-js npm package
  * Provides edge detection and image processing
  * Requires 'unsafe-eval' CSP directive due to eval() usage

- vendor/coco-ssd/coco-ssd.min.js (~9KB): COCO-SSD model
  * Copied from @tensorflow-models/coco-ssd npm package
  * Pre-trained object detection for irregular panel layouts

Total vendor size: ~25MB (was 13MB, added 12.5MB)

These UMD/global builds ensure browser compatibility without requiring
ES module imports, which would cause bare specifier errors in browsers.
All libraries are loaded dynamically via script injection when panel
detection is first used, minimizing initial load time.
2026-04-13 19:14:51 -04:00
john-okeefe fc29b463f4 Build: add vendored panel detection libraries
Add pre-built panel detection libraries to vendor directory.
These are copied from node_modules during the build process and
included with the application for panel detection functionality.

Included libraries:
- vendor/opencv/opencv.js - OpenCV.js for image processing
- vendor/tfjs/tf.min.js - TensorFlow.js for ML inference
- vendor/coco-ssd/coco-ssd.min.js - COCO-SSD model for object detection

These files enable the panel mode feature in the reader.
2026-04-13 18:50:13 -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 675fdafeeb Update dependencies 2026-03-05 06:08:53 +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 45d67a0db3 PDF: add CMaps and fonts 2024-09-28 17:41:38 +08:00
John Factotum 1e952102bd PDF: rerender when scale changes
The fixed-layout renderer now accepts an object for the return value of
`load()` (on the `book.sections` items). If it's an object, the `src`
is the URL of the section, and `onZoom`, if present, will be called
when the viewport is zoomed. With this you can scale the page yourself
rather than relying on the renderer's own scaling with CSS transform.

Also upgraded to PDF.js 4.6.82. And now internal links are broken...
Don't know how to fix that yet.
2024-09-28 12:12:59 +08:00
John Factotum ffceb8a4aa Reader: update vendored libraries
Note: these are built from running `npm run build` from the main repo
https://github.com/johnfactotum/foliate
2024-09-11 13:50:39 +08:00
John Factotum 7dcbc6921a Update vendored libraries 2023-11-02 12:26:38 +08:00
John Factotum a63a68eda0 Add PDF support 2023-10-08 21:27:06 +08:00
John Factotum 9949000a9e Use ES modules for zip.js and fflate 2023-03-20 23:49:33 +08:00
John Factotum d0cd085a22 Add sample reader 2022-10-19 11:04:43 +00:00