Skip to content

feat(preview): doc-route toolbar affordances, page-break and header/footer markers - #195

Open
ThatScalaGuy wants to merge 1 commit into
feat/preview-docs-landing-katexfrom
feat/doc-preview-affordances
Open

feat(preview): doc-route toolbar affordances, page-break and header/footer markers#195
ThatScalaGuy wants to merge 1 commit into
feat/preview-docs-landing-katexfrom
feat/doc-preview-affordances

Conversation

@ThatScalaGuy

Copy link
Copy Markdown
Contributor

Stacked on #194.

Document routes carried report-shaped chrome. This makes them feel designed-for:

  • Doc meta strip in the toolbar on /doc/* routes: a4 · portrait · en · 3 chapters · TOC · header/footer, fed by new document-only fields on the injected artefact payload (omitempty, so report artefacts are unchanged). Chapter counts resolve the same sources the renderer resolves.
  • Build PDF button (doc routes only) copies bino build --artefact <name> to the clipboard with a ✓ Copied state. The preview deliberately does not simulate pagination — this is the honest "show me the real pages" affordance. The textarea fallback is load-bearing inside the VS Code preview webview, whose iframe sandbox grants no clipboard permission.
  • Heading search: the search palette was dead on doc routes (it only indexed [data-bino-kind] elements and layout pages). A new pass indexes .bn-document-content headings — they carry auto-generated anchor ids, and the selector matches nothing on report routes. Placeholder switches to "Search headings..." on doc routes.
  • Honest Inspect tooltip on doc routes ("Inspect embedded engine components") — a prose-only document yields an empty inspector and the report wording promised more.
  • Page-break markers: pageBreakBetweenSources rendered as invisible 0-height divs. Preview now shows a dashed rule with a "page break" chip. preview.css never loads in builds, so PDFs keep the clean break.
  • Header/footer bands: displayHeaderFooter docs show labeled placeholder bands sized by the real margins (marginTop/marginBottom validated as CSS lengths, otherwise the Chrome print defaults 20mm/15mm). The geometry travels as bn-context attributes (withDocumentPreviewMeta, extending fix(preview): live-reload DocumentArtefact routes, pin doc page width #191's page-width attribute), so manifest edits update it live through SSE morphs — head-injected styles would go stale.

internal/web/static/preview.js regenerated.

…ooter markers

Document routes carried report-shaped chrome: search indexed only
[data-bino-kind] elements and layout pages (dead on docs), no document
settings were visible anywhere before build, page breaks rendered as
invisible 0-height divs, and displayHeaderFooter had no representation
at all.

- The toolbar shows a meta strip on /doc/* routes (format · orientation
  · locale · chapters · TOC · header/footer) fed by new doc-only fields
  on the injected artefact payload. Chapter counts resolve the same
  sources the renderer uses.
- A Build PDF button copies 'bino build --artefact <name>' — the honest
  affordance for 'show me the real pages'; the preview deliberately
  does not simulate pagination. The textarea fallback matters: the
  VS Code webview iframe grants no clipboard permission.
- Search gains a heading pass over .bn-document-content (headings carry
  auto-generated anchor ids; the selector matches nothing on report
  routes) and a route-aware placeholder.
- The Inspect tooltip says 'Inspect embedded engine components' on doc
  routes — a prose-only doc yields an empty inspector, and the report
  wording promised more than docs deliver.
- Page breaks show as a dashed rule with a 'page break' chip, and
  displayHeaderFooter docs get placeholder bands sized by the real
  margins (spec values validated as CSS lengths, else the Chrome
  defaults 20mm/15mm). Both are preview.css-only, so built PDFs are
  untouched. The geometry rides as bn-context attributes
  (withDocumentPreviewMeta, extending the page-width attribute from
  the live-reload fix) so manifest edits update it through SSE morphs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant