Skip to content

armgit / bento

Public Imported from GitHub
0

Bento, the office suite that fits in a file

Docs: record that the preview left <noscript>, and why not to retry the rest

nyblnet193ea04886f7
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d61ef147..cebe116f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -46,8 +46,10 @@ pre-1.0.
slide over the canvas instead of squeezing it, so the slide you're editing
is no longer the smallest thing on screen. Nothing changes on a laptop.
- Known gap: the save-as menu (copy, new deck, template, password) doesn't fit
- on a phone yet and is unreachable there for now.
+ The save-as list — save a copy, duplicate as a new deck, the password
+ actions, version history and the JSON round-trip — sits at the bottom of ⋯ on
+ a phone, because the caret that opens it on a laptop doesn't fit beside a
+ touch-sized Save button.
- **Decks carry a page-one preview, so Finder and Files thumbnail them
properly.** Every Bento file used to thumbnail as the same dark box, because
diff --git a/CLAUDE.md b/CLAUDE.md
index 240e898a..95e1127d 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -36,10 +36,19 @@ names provisional.
file-manager thumbnails**. Thumbnailers (iOS Files, macOS QuickLook/Finder,
Bento Tray) render HTML with JS OFF, so every deck used to thumbnail as the
same boot splash. Every save now writes a still render of page one into the
- shell, parked in `<noscript data-bento-preview>` — rendered only when
- scripting is off, so with JS on the host node has ZERO element children (raw
- text) and a 0×0 box: no flash, no layout, nothing for print/present to
- exclude. Reuses `renderSlide` with `svgAsImage:true` (svg → one `<img>`,
+ shell as a plain `[data-bento-preview]` element, followed IMMEDIATELY by a
+ parser-blocking `<script data-bento-preview>` that deletes both. The
+ thumbnailer keeps the preview (it runs no script); the reader never sees it
+ (the remover executes before the browser paints — measured: at removal
+ `readyState` is `loading` and `getEntriesByType('paint')` is EMPTY). **NOT
+ `<noscript>`** — that was v1 and it does nothing on iOS, whose thumbnailer
+ runs no script AND does not render `<noscript>` (probe: red default / green
+ from inline script / blue in noscript renders RED). Anything between host and
+ remover is markup a browser could paint, so the gate asserts the ordering.
+ A QLThumbnailProvider extension does NOT work — registers fine, never
+ launches, because iOS owns `public.html`; nor does
+ `NSURLThumbnailDictionaryKey`, silently dropped for local files.
+ Reuses `renderSlide` with `svgAsImage:true` (svg → one `<img>`,
media → poster/icon still) + `hidePlaceholders`; `staticize()` strips active
elements, runtime data-attrs and `on*`, and INLINES the few `.bento-*` rules
from styles.css (the runtime CSS ships deflated and is never inflated in
diff --git a/docs/DECISIONS.md b/docs/DECISIONS.md
index cf6600ab..0c517e12 100644
--- a/docs/DECISIONS.md
+++ b/docs/DECISIONS.md
@@ -14,6 +14,50 @@ Decision. Why. Pointers.
---
+## 2026-07-27 — Thumbnails: plain markup plus a parser-blocking remover, NOT `<noscript>`
+
+**Supersedes the 2026-07-26 entry below** on the one point of where the preview
+lives. Everything else in it still stands: written at save time, replaced never
+appended, `PREVIEW_BUDGET` tiers, and above all **encrypted decks get no
+preview**.
+
+`<noscript>` renders only where scripting is DISABLED, and iOS satisfies
+neither half of that. Probed with a page that is red by default, turns green
+from an inline script, and carries a blue `<noscript>`, the iOS thumbnailer
+renders **RED** — it runs no script AND does not render `<noscript>`. So the
+feature worked in Finder and macOS QuickLook and did nothing on the platform it
+was built for; every deck in Bento Tray stayed a dark box.
+
+That same gap is the fix. A renderer that runs no script still renders ordinary
+markup, and every real reader does run script — so the preview ships as a plain
+`[data-bento-preview]` element with a **parser-blocking inline remover**
+immediately after it. The thumbnailer keeps the preview (it never runs the
+remover); the reader never sees it (the script executes before the browser
+paints). Measured: at removal `document.readyState` is `"loading"` and
+`performance.getEntriesByType('paint')` is EMPTY — zero frames containing the
+preview were ever presented. Not a fast flash; no flash.
+
+The 2026-07-26 entry chose `<noscript>` to avoid exactly that flash, and
+accepted "a thumbnailer that does run scripts sees no preview" as the trade.
+Both halves turned out to be wrong about iOS, and the replacement costs neither.
+
+**A QLThumbnailProvider extension does not work and should not be retried.** It
+registers correctly (`pluginkit` shows `SDK = com.apple.quicklook.thumbnail`)
+but its process never launches: iOS uses its own generator for `public.html`
+and does not consult third-party extensions for types it already handles.
+Likewise `NSURLThumbnailDictionaryKey` via `UIDocument.fileAttributesToWrite`,
+which is accepted and then silently dropped for local files — inspecting the
+xattrs afterwards finds only `com.apple.lastuseddate`.
+
+`previewIsSafe` is now MORE load-bearing, not less: the preview lands in the
+live DOM rather than sitting inert inside `<noscript>`, so the refusal that
+keeps a script tag out of it protects the page and not just the file structure.
+`shell-gate.mjs` gained two source assertions — that the remover is emitted at
+all, and that it sits immediately after the preview, since anything between
+them is markup a browser could paint first.
+
+---
+
## 2026-07-26 — File-manager thumbnails: a `<noscript>` render of page one, written at save time
**Decided:** 2026-07-26. Kernel zone (`kernel/src/save.ts`), so it binds every