From 4abc814c1b9931773adf3caeb86ab6975a4bbb61 Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Sat, 4 Apr 2026 18:17:11 -0400 Subject: [PATCH] types: add format_group, library_type_name, manga_type to ReaderMetadata - Move ReaderMetadata from api.ts to reader.d.ts as global type - Add format_group field for format detection (reflowable/fixed_layout/comic_archive) - Add library_type_name for library type (ebooks/comics/manga/pdf) - Add manga_type for manga-specific reading direction metadata - Remove duplicate mime_type field and fix typo (unkown -> unknown) --- web/src/api.ts | 11 ----------- web/src/reader/reader.ts | 13 +++++++++++++ web/src/types/reader.d.ts | 5 ++++- 3 files changed, 17 insertions(+), 12 deletions(-) create mode 100644 web/src/reader/reader.ts diff --git a/web/src/api.ts b/web/src/api.ts index 11e20c5..bd9eb86 100644 --- a/web/src/api.ts +++ b/web/src/api.ts @@ -91,17 +91,6 @@ function handleError(error: unknown, context: string): void { // ============================================================ // Reader API Functions // ============================================================ -interface ReaderMetadata { - media_item_id: string; - title: string; - author: string; - cover_image_path: string; - library_type: "ebook" | "comic" | "manga" | "pdf"; - mime_type: string; - file_path: string; - chapter_metadata?: ChapterMetadata; - total_pages?: number; -} interface ChapterMetadata { chapters: Chapter[]; } diff --git a/web/src/reader/reader.ts b/web/src/reader/reader.ts new file mode 100644 index 0000000..345b02c --- /dev/null +++ b/web/src/reader/reader.ts @@ -0,0 +1,13 @@ +import "../alpine"; +import { Alpine } from "../alpine"; +// Core utilities (minimal set needed by reader) +import "../api"; // API calls for reading progress +import "../dom"; // DOM helpers +import "../events"; // Event system +import "../storage"; // localStorage helpers +import "../theme"; // Theme support (reader needs theme) +import "../toast"; // Toast notifications +import "../toast-error"; // Error toasts +// Reader functionality +import "./reader-shell"; +Alpine.start(); diff --git a/web/src/types/reader.d.ts b/web/src/types/reader.d.ts index ecf273d..c1e6ab7 100644 --- a/web/src/types/reader.d.ts +++ b/web/src/types/reader.d.ts @@ -76,8 +76,11 @@ interface ReaderMetadata { title: string; author: string; cover_image_path: string; - library_type: "ebook" | "comic" | "manga" | "pdf"; + format_group: "reflowable" | "fixed_layout" | "comic_archive" | "unkown"; + library_type_name: "ebooks" | "comics" | "manga" | "pdf"; mime_type: string; + mime_type: string; + manga_type: "unknown" | "no" | "yes" | "yes_and_right_to_left"; file_path: string; chapter_metadata?: ChapterMetadata; total_pages?: number;