From 1e6f2e9a5760ca6c9f91b1ba17aa44933ceb9f05 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Thu, 4 Jun 2026 15:46:46 -0400 Subject: [PATCH] =?UTF-8?q?feat(book):=20Phase=20J1.a=20=E2=80=94=20Chapte?= =?UTF-8?q?rs=20tab=20+=20Pages/Cover/Chapters=20split?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit First step on the phase-j-linked-content branch. Splits the book view's pages-and-chapters mash-up into three tabs (Pages / Chapters / Cover) without yet touching the data model or the pagination engine. Foundation for J2..J6. What changed: - New 'Chapters' tab between Pages and Cover. Lists every reflow entry in book.pages as a row with title, source (naddr or local draft), size, pin / live / private pills, and per-row Edit / Pin / Delete actions. - '+ Add chapter' button moved off the Pages overview's toolbar and onto the new Chapters tab. Pages toolbar now reads cleanly: Add page / Add 10 pages / Import page / Read / Export PDF. - Pages overview hides reflow-entry tiles via a CSS rule (display:none on .bookPageTile.reflowSegment). Data still lives in book.pages — drag-reorder indices unchanged, pagination engine unchanged, PDF export unchanged. J2+ migrates the data out. - Count readout updated from '0 pages · 0 reflow' to 'N pages · M chapters' (uses 'design' count + 'reflow' count). - defaultBookState + ensureBookState now scaffold empty links[] and threads[] arrays so the rest of the codebase can assume they exist. No code reads them yet. - setBookSubView extended to handle three views, sets active class + display + repaints the active list. renderBookChaptersList hooked into the main render() loop only when its tab is visible. Everything that worked before still works — chapter editor, publish flow, PDF export, Reader Mode, all untouched. The visible change is the new tab + the cleaner Pages overview. Co-Authored-By: Claude Opus 4.7 --- src/index.html | 239 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 220 insertions(+), 19 deletions(-) diff --git a/src/index.html b/src/index.html index e7ec03f..84dce89 100644 --- a/src/index.html +++ b/src/index.html @@ -1888,6 +1888,64 @@ .bookCountReadout { font-size: .82rem; color: var(--muted); white-space: nowrap; } + + /* Phase J1: hide reflow-entry tiles from the Pages overview — + chapters now live in the dedicated Chapters tab. The data still + lives in book.pages for now (drag-reorder indices stay stable); + J2+ migrates them out into book.links / book.threads. */ + body.template-book #bookPagesView .bookPageTile.reflowSegment { + display: none !important; + } + + /* Chapters tab — list view of every reflow / linked-chapter + entry in the book. Each row shows kind, label, source + (pinned event id or live coord), and per-row actions. */ + .bookChaptersList { + display: flex; flex-direction: column; gap: 8px; + margin-top: 10px; + } + .bookChapterRow { + display: grid; + grid-template-columns: auto 1fr auto; + gap: 10px; align-items: center; + padding: 10px 14px; + border: 1px solid var(--line); + border-radius: 6px; + background: var(--panel, #fff); + } + body.dark .bookChapterRow { background: rgba(255,255,255,.03); } + .bookChapterRow .bookChapterIcon { font-size: 1.2rem; opacity: .8; } + .bookChapterRow .bookChapterMeta { min-width: 0; } + .bookChapterRow .bookChapterTitle { + font-weight: 600; font-size: .92rem; + overflow: hidden; text-overflow: ellipsis; white-space: nowrap; + } + .bookChapterRow .bookChapterSub { + font-size: .72rem; color: var(--muted); + overflow: hidden; text-overflow: ellipsis; white-space: nowrap; + } + .bookChapterRow .bookChapterActions { + display: flex; gap: 6px; align-items: center; flex-wrap: wrap; + } + .bookChapterRow .bookChapterActions button { + font-size: .76rem; padding: 4px 10px; + } + .bookChapterPill { + display: inline-block; + font-size: .62rem; font-weight: 700; + letter-spacing: .06em; text-transform: uppercase; + padding: 1px 6px; border-radius: 3px; + vertical-align: middle; + margin-right: 4px; + } + .bookChapterPill.live { background: rgba(34,197,94,.18); color: #15803d; } + .bookChapterPill.pinned { background: rgba(245,158,11,.18); color: #92400e; } + .bookChapterPill.private { background: rgba(99,102,241,.18); color: #4338ca; } + .bookChapterEmpty { + padding: 24px; text-align: center; + color: var(--muted); font-size: .85rem; + border: 1px dashed var(--line); border-radius: 6px; + } .bookVisibilityChip { font-size: .76rem; padding: 2px 10px; border: 1px solid var(--line); background: #fff; @@ -4754,18 +4812,18 @@
- - + + + ⓘ - 0 pages · 0 reflow + 0 pages · 0 chapters
- @@ -4773,7 +4831,17 @@
-

Click a designed-page tile to edit it on the canvas. Click a chapter tile to edit its markdown. PDF export is raster-only in v1 (real-text mode for embeddable fonts lands in a follow-up slice).

+

Click a designed-page tile to edit it on the canvas. Chapter text lives under the 📎 Chapters tab. PDF export is raster-only in v1 (real-text mode for embeddable fonts lands in a follow-up slice).

+
+