Commit Graph
3 Commits
Author SHA1 Message Date
john-okeefe 925228f7cf docs: comprehensive reader implementation plan updates
Major changes:
- Convert all 22 OOP classes to procedural TypeScript functions
- Add complete PDF reader implementation (15 subsections, 6.1-6.15)
- Add 8 technical textbook features for PDFs (TOC, bookmarks, clipboard,
  dual-page, mini-map, rotation, variable page sizes)
- Remove duplicate sections and fix section numbering (1-19 sequential)
- Add 7 new comic/manga features (7.4-7.10):
  * Page order presets with auto-detect and user override
  * Extended keyboard shortcuts (Space, PageUp/Down, +/-, B, F, 1-9)
  * Page slider/scrubber for quick navigation
  * Touch gesture controls (swipe, pinch-to-zoom, tap, double-tap)
  * Panel gap controls with adjustable spacing and borders
  * Background color options (black/white/gray/sepia)
  * Chapter markers with visual boundaries

Architecture improvements:
- Universal reader + pluggable parser pipeline (all ebooks → CIF)
- Client-side parsers: EPUB, FB2, TXT, HTML
- Server-side parsers: MOBI, AZW3, DOCX, RTF (Go backend)
- ~500 KB total dependencies vs 182 MB Calibre

Database schema updates:
- Rename pdf_bookmarks to media_bookmarks
- Add chapter_number and cfi_position fields for all media types
- Unified bookmarks for ebooks, comics, manga, and PDFs

Preserved features:
- 8 bundled libre reading fonts with complete setup scripts
- 5 reading-optimized themes (light, sepia, dark, night, high-contrast)
- Hybrid theming strategy (11 themes for UI, 5 for ebook text)
- Panel detection (grid-based + ML + manual override)
- All 4 media types: ebook, comic, manga, PDF

All code follows PROJECT_GUIDELINES.md:
- No OOP (no classes, no this-capture)
- Procedural/imperative style
- Backend handles all position calculations (CFI, character offsets, etc.)
- Frontend receives positions from backend, no duplication
2026-04-02 16:58:45 -04:00
john-okeefe 9dd217afb6 docs: Complete Reader Implementation Plan overhaul with PDF support and universal reader architecture
Major Architecture Changes:
- Added PDF support (Mozilla pdf.js) with text selection, highlights, search, bookmarks
- Universal reader with pluggable parser pipeline for all reflowable ebooks
- Common Intermediate Format (CIF) to standardize ebook parsing
- Server-side parsing for complex formats (MOBI, AZW3, DOCX, RTF)
- Client-side parsing for simple formats (EPUB, FB2, TXT, HTML)
- PDF-specific features: TOC navigation, bookmarks, dual-page view, mini-map

Procedural TypeScript:
- Refactored all code to follow PROJECT_GUIDELINES.md (no classes, no OOP)
- Functions and modules instead of classes
- Functional techniques where appropriate

New Components:
- Parser manager (router) to detect format and route to appropriate parser
- CIF types for universal ebook representation
- PDF reader with full feature set (text-layer, annotation, search, etc.)
- Server-side Go handlers for MOBI/AZW3/DOCX/RTF parsing

Database Schema:
- Added pdf_bookmarks table for custom PDF bookmarks

API Routes:
- Added PDF outline/TOC endpoint
- Added PDF thumbnail endpoint for mini-map

Theming:
- Added PDF-specific reading themes (5 options: light, sepia, dark, night, high-contrast)
- Hybrid approach maintained: chrome_theme for UI, reading_theme for content
2026-04-02 16:54:34 -04:00
john-okeefe 9f7dffd292 docs: add comprehensive reader implementation plan
Add detailed 8-week implementation plan for ebook, comic, and manga reader
with hybrid architecture, panel detection, offline support, and libre fonts.

Key Features:
- Hybrid reader architecture: Shared infrastructure + specialized components
- Ebook reader: EPUB parsing, HTML rendering, CFI navigation, typography engine
- Comic reader: Grid-based + ML + manual panel detection, zoom animations
- Manga reader: RTL navigation, vertical scroll mode
- Offline support: PWA with service worker, cached pages
- Dictionary: Offline-capable word lookup
- Annotations: Bookmarks, highlights, notes (reuses existing DB schema)
- Reading statistics: Speed tracking, time estimation
- KOReader-style progress: Pages, chapter-relative, percentage, time-left

Theming Strategy:
- UI Chrome: All 11 Bookhoard themes
- Ebook text: 5 reading-optimized themes (light, sepia, dark, night, high-contrast)
- Comics/manga: All 11 themes (visual content works well with colors)

Typography:
- 8 bundled libre fonts (~1.2MB WOFF2): Literata, Crimson Text,
  Source Serif 4, EB Garamond, Libertinus, Noto Serif, Charis SIL, IBM Plex
- Standard weights only (400, 400i, 700, 700i)
- Font acquisition script included
- Offline-ready (no network requests for fonts)

Database Schema:
- panel_data: Hybrid panel detection (grid/ML/manual)
- reading_speed: Per-user reading speed tracking
- dictionary_cache: Offline dictionary support
- reader_settings: Per-user preferences (DB + localStorage fallback)

API Endpoints:
- 10 new reader routes (/api/readers/*)
- Lazy-loading page cache (5-page ahead)
- WebSocket integration for real-time sync
- Bruno API tests included

Phased Timeline:
- Week 1-2: Infrastructure & basic reader
- Week 3-4: Comic/manga features
- Week 5-6: Advanced features
- Week 7: Offline support
- Week 8: Polish & testing

Code Reuse:
- Reuses existing WebSocket sync, progress tracking, annotations
- Surgical code edits (extend, don't duplicate)
- Follows existing Bookhoard patterns and conventions

Includes:
- Database schema changes (SQL)
- API endpoint specifications
- TypeScript type definitions
- Frontend architecture (SSR-first with Alpine.js)
- Integration test patterns
- Bruno OpenCollection YAML tests
- User and developer documentation locations

Estimated total implementation time: 8 weeks
2026-04-01 21:10:34 -04:00