Skip to content

armgit / bento

Public Imported from GitHub
0

Bento, the office suite that fits in a file

Buzz playbook build-out: README, agents.md, 404 deck, Konami, QR deck

nyblnetaabb46185ce1
diff --git a/README.md b/README.md
index b76d4347..93a42ff6 100644
--- a/README.md
+++ b/README.md
@@ -1,42 +1,83 @@
-# Bento
+# Bento — the office suite that fits in a file
-**Documents that carry their own app.** Bento packages a document *and* its full
-display + editing functionality into a single HTML file any web browser can open —
-no install, no server, no cloud. Like a bento box: everything you need, in one container.
+**This PowerPoint alternative is a single HTML file.** A Bento deck carries
+its own viewer, presenter, and editor inside the document — open it in any
+browser, edit it, present it, send it. The person you send it to needs
+nothing: the file *is* the software.
-The inspiration is the single-file build of the commercial-architecture webapp
-(Vite + `vite-plugin-singlefile` → one self-contained HTML that runs from `file://`),
-combined with the TiddlyWiki idea of a file that can edit and re-save itself.
+**Try it in 10 seconds:** open [bento.page/slides](https://bento.page/slides)
+— that's the entire app, running on a starter deck that doubles as the
+feature tour. Or grab a designed template from the
+[gallery](https://bento.page/) and make it yours.
-## The format
+## Why this exists
-A Bento document (`*.bento.html`) is an ordinary HTML file with three parts:
+Office documents used to be things you *had*. Now they're things you rent —
+locked in someone's cloud, behind someone's login, readable only while a
+company keeps its servers on. Bento takes the other path:
-1. **Data block** — `<script type="application/bento+json" id="bento-doc">` holding the
- document model as JSON (all assets such as images embedded as data URIs).
-2. **Runtime** — one inlined JS/CSS bundle: the viewer, the presenter, and the editor.
-3. **Self-save** — at boot the runtime captures its own pristine HTML; on save it swaps
- in the updated data block and writes the file back via the File System Access API
- (Chrome/Edge) or a download fallback (Firefox/Safari). The saved file is again a
- complete, editable Bento document.
+- **One file, forever.** Deck, fonts, images, charts, animations, and the
+ full editor travel together. A copy from 2026 will open in 2036.
+- **View-source honest.** Your data sits in a plain, readable JSON block at
+ the top of the file. No binary formats, no lock-in, no archaeology.
+- **It saves itself.** The file rewrites its own data block on save (File
+ System Access API, with a download fallback). No app to install, ever.
+- **Local-first, provably.** Flip on Offline mode and nothing leaves your
+ machine — updates and collaboration are hard-blocked, and the app says so.
-## Apps
+## What's inside
-| App | Status | Libraries |
-|---|---|---|
-| `slides/` — Bento Slides (PowerPoint replacement) | in development | Reveal.js (present), in-house engine (morph/animation), Moveable + Selecto (editing), ECharts (charts) |
-| docs (Word replacement) | planned | TBD (e.g. ProseMirror/Tiptap) |
-| sheets (Excel replacement) | planned | TBD (e.g. HyperFormula + a grid) |
+| | |
+|---|---|
+| **Morph presenting** | Elements that share an id animate between slides — position, size, color, even gradients. Duplicate a slide, rearrange, and the motion designs itself. |
+| **Live collaboration** | E2EE (AES-GCM) with keys that live in your file, never on a server. The file itself is the invitation: anyone who opens a copy joins. Offline edits merge back precisely — our own CRDT, character-level text merging included. |
+| **A blind relay** | The optional sync relay ([`server/sync-worker/`](server/sync-worker/)) stores ciphertext and learns nothing. Read the source; it's about one file. |
+| **Charts, built in** | Bar / line / pie / scatter drawn by our own dependency-free engine, live during presentations: tooltips, zoom, and data that morphs when a bar chart becomes a pie. |
+| **Designed for AI** | The document is plain JSON in the file, so agents edit `.bento.html` files in place and chatbots round-trip the JSON (`window.bento.loadDoc`). See [docs/agents.md](docs/agents.md). |
+| **Signed self-updates** | Releases are ECDSA-signed and offered in-app. Updating writes a *new* file — the old one stays as your rollback. No server ever touches your documents. |
+| **Everything else** | Speaker view, comments, layouts, hidden interactive states, hover reveals, motion paths, PDF export, page sizes, 8 UI languages — in a ~400 KB shell. |
-## Bento Slides
+## Architecture in one paragraph
+
+`slides/src/model.ts` defines the JSON document model; one renderer
+(`render.ts`) draws it for the editor canvas, thumbnails, and present mode
+(Reveal.js drives navigation; morphs are computed from the model, not the
+DOM). Animation is an in-house engine (`anim.ts`), charts are in-house
+(`charts.ts`), collaboration is an in-house CRDT (`sync/crdt.ts` — pure
+data, fuzz-tested by `scripts/test-sync.ts` across hundreds of thousands of
+convergence checks). The shell compresses to ~400 KB with the document block
+left as plaintext so old files and outside tools can always splice it. The
+deep dive: [docs/architecture.md](docs/architecture.md).
+
+## Security model, honestly
+
+- Collab keys are minted client-side at document creation and live only in
+ the file. Possession of the file = membership; "Rotate keys" = revocation.
+- The relay sees: ciphertext, connection timing, and a hash of the room key.
+ It cannot read content, names, or structure.
+- Presence names are claims, not proofs — fine within a shared-key room;
+ enterprise identity would need signed frames (designed, not built).
+- Update checks fetch a static manifest and send nothing about you or your
+ document. Signature + hash + version monotonicity are verified in-app.
+- Known trade-offs: undo during live collab is snapshot-based and can revert
+ a collaborator's concurrent edit to the same property; editing is
+ desktop-first (phones view and present well).
+
+## Building
```bash
cd slides
npm install
-npm run dev # editor on http://localhost:5173
-npm run build:single # → dist-single/Bento_Slides.bento.html (the shippable format)
+npm run dev # dev server
+npm run build:single # → dist-single/Bento_Slides.bento.html (the product)
```
-The built file opens from disk, boots into the editor with a starter deck, presents
-with Reveal.js (morph transitions via GSAP Flip for elements whose IDs match across
-slides — PowerPoint "Morph" style), and saves itself with your edits embedded.
+`node scripts/test-sync.ts` runs the CRDT convergence rig. Releases are cut
+locally so the signing key never leaves the maintainer's machine — see
+[docs/RELEASING.md](docs/RELEASING.md).
+
+## Status
+
+**Bento/Slides** is the first app of Bento/Suite — Docs and Sheets are
+coming. The current release lives on [bento.page](https://bento.page) and
+reaches every existing file through the signed update channel.
diff --git a/docs/agents.md b/docs/agents.md
new file mode 100644
index 00000000..c3324998
--- /dev/null
+++ b/docs/agents.md
@@ -0,0 +1,114 @@
+# Bento for AI agents
+
+*Drop this file into your context (or point your harness at it) and you can
+author and edit Bento presentations directly. Also published at
+[bento.page/agents.md](https://bento.page/agents.md).*
+
+A Bento deck (`*.bento.html`) is a self-contained HTML file. The document
+lives in ONE plaintext block near the top:
+
+```html
+<script type="application/bento+json" id="bento-doc">
+{ "format": "bento/slides", ... }
+</script>
+```
+
+Two ways to work with it:
+
+1. **File harness** (Claude Code, agent sandboxes): edit the JSON inside the
+ `#bento-doc` block in place. Escape every `<` in the JSON as `\u003c`
+ so the block can never contain a literal `</script>`. Leave everything else in the
+ file untouched.
+2. **Chat round-trip** (any chatbot): the user copies the JSON out via
+ *About → Copy document JSON*, you return a full replacement document,
+ they paste it back via *About → Replace document from JSON…* (undoable).
+ In the browser console: `window.bento.doc` (read) /
+ `window.bento.loadDoc(json)` (write, undoable).
+
+## Minimal valid document
+
+```json
+{
+ "format": "bento/slides", "version": 1, "title": "My deck",
+ "size": { "width": 1280, "height": 720 },
+ "theme": { "background": "#101418", "color": "#F2F0EA",
+ "accent": "#FF9E8A", "fontFamily": "system-ui, sans-serif" },
+ "slides": [
+ { "id": "s1", "background": "#101418", "transition": "none",
+ "notes": "speaker notes here",
+ "elements": [
+ { "id": "t1", "type": "text", "x": 96, "y": 260, "w": 1088, "h": 160,
+ "rotation": 0, "opacity": 1,
+ "html": "Hello from an agent.",
+ "fontSize": 88, "fontFamily": "system-ui, sans-serif",
+ "fontWeight": 800, "color": "#F2F0EA",
+ "align": "left", "valign": "top", "lineHeight": 1.1 }
+ ] }
+ ]
+}
+```
+
+## Element types (all share `id,x,y,w,h,rotation,opacity`)
+
+- **text**: `html` (inline `<b> <i> <br>` ok), `fontSize`, `fontFamily`,
+ `fontWeight`, `color`, `align` (`left|center|right`), `valign`,
+ `lineHeight`, optional `letterSpacing`.
+- **shape**: `shape` = `rect|ellipse|triangle|line|path`, `fill`, `stroke`,
+ `strokeWidth`, `radius` (rect corner). Optional `fillGradient`
+ `{angle, stops:[{at:0..1, color}]}` (CSS-convention angle). Lines take
+ their color from `fill` and draw horizontally across the box (rotate for
+ vertical); `strokeStyle: solid|dashed|dotted`; tips `lineStart`/`lineEnd`
+ = `arrow|dot|bar`.
+- **image**: `src` = data URI or `"asset:<key>"` into `doc.assets`,
+ `fit: cover|contain|fill`, `radius`. Embed images as data URIs in
+ `doc.assets` and reference them — the file must stay self-contained.
+- **chart**: `preset: bar|line|pie|scatter`, `option` = ECharts-SHAPED pure
+ JSON. **Bar/line series data must be plain numbers** (`{value,itemStyle}`
+ objects coerce to 0 — only pie takes `{name,value}`); per-item bar colors
+ are unsupported, color by series; template formatters only (`{b}`, `{c}`,
+ `{d}`), never functions.
+- **svg**: `asset` or `markup` for static artwork. Prefer composing rects/
+ texts/paths — those stay editable and can morph.
+
+## The rules that make decks feel designed
+
+- **Morph = shared ids.** Slides with `"transition": "morph"` tween any
+ elements whose `id` matches the previous slide — position, size, color,
+ gradients. This is THE signature move: carry 2–4 ids through the deck and
+ rearrange them per slide. Generators must emit deterministic ids.
+- **Entrances**: `fx: { enter: "fade-up", order: 0 }` — equal `order` =
+ simultaneous. Entrance staggers only run on non-morph arrivals.
+- **Ken-burns**: `fx: { ambient: "kenburns", ken: { dir: "drift|out|in",
+ scale: 1.08, duration: 20 } }` — `drift` loops, `out`/`in` settle once on
+ slide entry. For full-bleed photos: image at 0,0,1280,720 + a scrim rect
+ + text on top. Never combine entrance tweens with motion-path loops.
+- **Loops**: `fx: { loop: { type: "dash-march" | "motion-path", ... } }`.
+- **Interactivity**: element `link: "<slide-id>"` jumps on click; a slide
+ with `stateOf: "<parent-id>"` is a hidden variant reached only by links
+ (arrow keys skip it, ← returns to parent). Give clickable things a padded
+ transparent rect as the hit target, not the text itself.
+- **Numbers count up** with `fx: { countUp: true }`.
+- **Speaker notes** (`notes`) are part of the document — write them; they
+ make a template teach itself.
+
+## Layout guardrails
+
+- Canonical canvas 1280×720 (`doc.size` can differ — read it first).
+- Keep 96 px side margins (right-most content x ≤ 1184).
+- One accent color; 2 typefaces max. `theme` sets deck defaults.
+- Fonts: `doc.fonts` (`{family, asset, weight}`) + woff2 data URIs in
+ `doc.assets` if you need embedded faces; otherwise stick to system stacks.
+
+## Gotchas
+
+- Escape `<` as `\u003c` anywhere in the JSON when writing the file block.
+- Don't invent property names — unknown keys are ignored, so a typo means
+ your styling silently doesn't apply.
+- `docId` is the document's identity — never regenerate it when editing.
+- If `template: true` is set, every open mints a fresh document (that's for
+ distributable templates; remove it for a personal deck).
+- Charts degrade gracefully but exotic ECharts config is ignored — keep
+ options minimal.
+
+Working examples of everything above: the template decks at
+[bento.page](https://bento.page) — open one and read its JSON block.
diff --git a/scripts/build-404-deck.mjs b/scripts/build-404-deck.mjs
new file mode 100644
index 00000000..6efabb39
--- /dev/null
+++ b/scripts/build-404-deck.mjs
@@ -0,0 +1,67 @@
+#!/usr/bin/env node
+// The 404 page's punchline: a tiny, fully working deck. Spliced from the
+// built shell like the gallery decks; template:true so every open is fresh.
+//
+// node scripts/build-404-deck.mjs [outFile] (default: working/404.bento.html)
+
+import { readFileSync, writeFileSync } from 'node:fs'
+import { dirname, join } from 'node:path'
+import { fileURLToPath } from 'node:url'
+
+const root = dirname(dirname(fileURLToPath(import.meta.url)))
+const out = process.argv[2] ?? join(root, 'working/404.bento.html')
+const shell = readFileSync(join(root, 'slides/dist-single/Bento_Slides.bento.html'), 'utf8')
+
+const fontSrc = readFileSync(join(root, 'slides/src/fontdata.ts'), 'utf8')
+const font = (name) => fontSrc.match(new RegExp(`export const ${name}\\s*=\\s*'(data:[^']+)'`))[1]
+
+const INK = '#0D1B2E', PANEL = '#16273E', PEACH = '#FF9E8A', PAPER = '#F0EBE0', STEEL = '#5E7699'
+const MIST = 'rgba(182,193,210,0.85)'
+const FR = 'Fraunces, Georgia, serif'
+const IN = "'Instrument Sans', 'Helvetica Neue', sans-serif"
+
+const doc = {
+ format: 'bento/slides', version: 1, title: '404 — this deck does not exist',
+ size: { width: 1280, height: 720 }, template: true,
+ theme: { background: INK, color: '#fff', accent: PEACH, fontFamily: IN },
+ assets: { 'font-fraunces': font('FRAUNCES_900'), 'font-instrument': font('INSTRUMENT_VAR') },
+ fonts: [
+ { family: 'Fraunces', asset: 'font-fraunces', weight: '900' },
+ { family: 'Instrument Sans', asset: 'font-instrument', weight: '100 900' },
+ ],
+ slides: [
+ {
+ id: 'nf-1', background: INK, transition: 'none',
+ notes: 'You found the easter egg. The 404 page of bento.page is, of course, a fully working Bento deck — press Escape and you are in the editor. Save a copy: it is yours (fresh identity, automatically).',
+ elements: [
+ { id: 'nf-tile-a', type: 'shape', shape: 'rect', x: 900, y: 130, w: 190, h: 190, rotation: 0, opacity: 1, fill: PEACH, stroke: 'none', strokeWidth: 0, radius: 34 },
+ { id: 'nf-tile-b', type: 'shape', shape: 'rect', x: 1010, y: 350, w: 130, h: 190, rotation: 0, opacity: 1, fill: STEEL, stroke: 'none', strokeWidth: 0, radius: 28 },
+ { id: 'nf-tile-c', type: 'shape', shape: 'rect', x: 850, y: 400, w: 120, h: 120, rotation: 0, opacity: 1, fill: PAPER, stroke: 'none', strokeWidth: 0, radius: 24 },
+ { id: 'nf-404', type: 'text', x: 80, y: 110, w: 700, h: 300, rotation: 0, opacity: 1, html: '404', fontSize: 260, fontFamily: FR, fontWeight: 900, color: PEACH, align: 'left', valign: 'top', lineHeight: 0.9 },
+ { id: 't-a', type: 'text', x: 96, y: 420, w: 760, h: 60, rotation: 0, opacity: 1, html: 'This slide does not exist.', fontSize: 40, fontFamily: FR, fontWeight: 900, color: '#fff', align: 'left', valign: 'top', lineHeight: 1.1, fx: { enter: 'fade-up', order: 1 } },
+ { id: 't-b', type: 'text', x: 96, y: 500, w: 760, h: 60, rotation: 0, opacity: 1, html: 'It is, however, a fully working presentation app.', fontSize: 19, fontFamily: IN, fontWeight: 400, color: MIST, align: 'left', valign: 'top', lineHeight: 1.5, fx: { enter: 'fade-up', order: 2 } },
+ { id: 't-c', type: 'text', x: 96, y: 640, w: 900, h: 24, rotation: 0, opacity: 1, html: '→ NEXT SLIDE · ESC OPENS THE EDITOR (REALLY)', fontSize: 12, fontFamily: IN, fontWeight: 700, color: 'rgba(255,158,138,0.8)', align: 'left', valign: 'top', lineHeight: 1.3, letterSpacing: 3 },
+ ],
+ },
+ {
+ id: 'nf-2', background: PANEL, transition: 'morph',
+ notes: 'The tiles morphed because they share ids with slide 1 — that is the whole trick. Links below are plain text on purpose: type them, or press Escape and keep this deck.',
+ elements: [
+ { id: 'nf-tile-a', type: 'shape', shape: 'rect', x: 96, y: 120, w: 90, h: 90, rotation: 0, opacity: 1, fill: PEACH, stroke: 'none', strokeWidth: 0, radius: 20 },
+ { id: 'nf-tile-b', type: 'shape', shape: 'rect', x: 206, y: 120, w: 62, h: 90, rotation: 0, opacity: 1, fill: STEEL, stroke: 'none', strokeWidth: 0, radius: 16 },
+ { id: 'nf-tile-c', type: 'shape', shape: 'rect', x: 288, y: 120, w: 58, h: 58, rotation: 0, opacity: 1, fill: PAPER, stroke: 'none', strokeWidth: 0, radius: 14 },
+ { id: 'nf-404', type: 'text', x: 96, y: 250, w: 1000, h: 140, rotation: 0, opacity: 1, html: 'Everything else exists.', fontSize: 76, fontFamily: FR, fontWeight: 900, color: '#fff', align: 'left', valign: 'top', lineHeight: 1 },
+ { id: 't-a2', type: 'text', x: 96, y: 430, w: 1000, h: 140, rotation: 0, opacity: 1, html: '<b>bento.page</b> — the site<br><b>bento.page/slides</b> — the app, in your browser<br><b>bento.page/#gallery</b> — decks to steal', fontSize: 22, fontFamily: IN, fontWeight: 400, color: MIST, align: 'left', valign: 'top', lineHeight: 1.75, fx: { enter: 'fade-up' } },
+ { id: 't-b2', type: 'text', x: 96, y: 640, w: 1000, h: 24, rotation: 0, opacity: 1, html: 'P.S. SAVE A COPY — THIS 404 IS YOURS NOW', fontSize: 12, fontFamily: IN, fontWeight: 700, color: 'rgba(255,158,138,0.8)', align: 'left', valign: 'top', lineHeight: 1.3, letterSpacing: 3, fx: { enter: 'fade-up', order: 2 } },
+ ],
+ },
+ ],
+ modified: new Date().toISOString(),
+}
+
+const blockRe = /<script type="application\/bento\+json" id="bento-doc">[\s\S]*?<\/script>/
+const json = JSON.stringify(doc).replace(/</g, '\\u003c')
+const spliced = shell.replace(blockRe, `<script type="application/bento+json" id="bento-doc">\n${json}\n</scr` + 'ipt>')
+if (!spliced.includes(json)) throw new Error('splice failed')
+writeFileSync(out, spliced)
+console.log(`404 deck → ${out} (${Math.round(spliced.length / 1024)} KB)`)
diff --git a/scripts/build-announcement-deck.mjs b/scripts/build-announcement-deck.mjs
new file mode 100644
index 00000000..3f102a97
--- /dev/null
+++ b/scripts/build-announcement-deck.mjs
@@ -0,0 +1,186 @@
+#!/usr/bin/env node
+// U1: the launch announcement IS a deck. This file becomes the Show HN link
+// target and the press kit. PRIVATE until launch — built into working/, not
+// wired into release.mjs (wire it at T-0, e.g. to site/hello.bento.html).
+//
+// node scripts/build-announcement-deck.mjs [outFile]
+// default: working/the-announcement.bento.html
+
+import { readFileSync, writeFileSync } from 'node:fs'
+import { dirname, join } from 'node:path'
+import { fileURLToPath } from 'node:url'
+
+const root = dirname(dirname(fileURLToPath(import.meta.url)))
+const out = process.argv[2] ?? join(root, 'working/the-announcement.bento.html')
+const shell = readFileSync(join(root, 'slides/dist-single/Bento_Slides.bento.html'), 'utf8')
+const fontSrc = readFileSync(join(root, 'slides/src/fontdata.ts'), 'utf8')
+const font = (n) => fontSrc.match(new RegExp(`export const ${n}\\s*=\\s*'(data:[^']+)'`))[1]
+
+// ——— bento.page palette, verbatim ———
+const INK = '#0D1B2E', PANEL = '#16273E', PAPER = '#F2F0EA', PEACH = '#FF9E8A'
+const PEACH_DEEP = '#C25A43', STEEL = '#5E7699', TILE = '#F0EBE0'
+const MIST = 'rgba(182,193,210,0.9)', MIST_DIM = 'rgba(182,193,210,0.55)'
+const INK_SOFT = 'rgba(20,34,54,0.75)'
+const FR = 'Fraunces, Georgia, serif'
+const IN = "'Instrument Sans', 'Helvetica Neue', sans-serif"
+const MONO = "ui-monospace, 'SF Mono', Menlo, monospace"
+
+let uid = 0
+const id = (p) => `${p}-${(++uid).toString(36)}`
+const text = (o) => ({
+ id: o.id ?? id('t'), type: 'text', x: o.x, y: o.y, w: o.w, h: o.h,
+ rotation: o.rotation ?? 0, opacity: o.opacity ?? 1, html: o.html,
+ fontSize: o.fontSize ?? 24, fontFamily: o.fontFamily ?? IN,
+ fontWeight: o.fontWeight ?? 400, color: o.color ?? '#fff',
+ align: o.align ?? 'left', valign: o.valign ?? 'top', lineHeight: o.lineHeight ?? 1.3,
+ ...(o.letterSpacing != null ? { letterSpacing: o.letterSpacing } : {}),
+ ...(o.fx ? { fx: o.fx } : {}), ...(o.shadow ? { shadow: o.shadow } : {}),
+})
+const rect = (o) => ({
+ id: o.id ?? id('s'), type: 'shape', shape: o.shape ?? 'rect', x: o.x, y: o.y, w: o.w, h: o.h,
+ rotation: o.rotation ?? 0, opacity: o.opacity ?? 1, fill: o.fill, stroke: o.stroke ?? 'none',
+ strokeWidth: o.strokeWidth ?? 0, radius: o.radius ?? 0,
+ ...(o.fillGradient ? { fillGradient: o.fillGradient } : {}),
+ ...(o.strokeStyle ? { strokeStyle: o.strokeStyle } : {}),
+ ...(o.fx ? { fx: o.fx } : {}), ...(o.shadow ? { shadow: o.shadow } : {}),
+})
+const slide = (o) => ({
+ id: o.id, background: o.background, transition: o.transition ?? 'fade',
+ notes: o.notes ?? '', elements: o.elements,
+})
+const kick = (x, y, s, color = PEACH) =>
+ text({ x, y, w: 900, h: 24, html: s, fontSize: 13, fontWeight: 700, letterSpacing: 5, color })
+const glowShadow = { blur: 46, color: 'rgba(255,238,214,0.28)' }
+
+// the three tiles — the deck's morph cast (same trick as the landing mark)
+const tiles = (a, b, c) => [
+ rect({ id: 'bn-a', fill: PEACH, radius: Math.min(a.w, a.h) * 0.18, shadow: glowShadow, ...a }),
+ rect({ id: 'bn-b', fill: STEEL, radius: Math.min(b.w, b.h) * 0.18, ...b }),
+ rect({ id: 'bn-c', fill: TILE, radius: Math.min(c.w, c.h) * 0.18, ...c }),
+]
+
+const s1 = slide({
+ id: 'an-cover', background: INK, transition: 'none',
+ notes: 'Hello, Hacker News. You are not reading a blog post about the product — you are inside it. This file is a complete, editable Bento deck: press Escape at any point and you are in the editor. Arrow keys to continue.',
+ elements: [
+ ...tiles({ x: 950, y: 110, w: 200, h: 200 }, { x: 1064, y: 340, w: 120, h: 180 }, { x: 900, y: 380, w: 120, h: 120 }),
+ kick(96, 96, 'SHOW HN — BENTO/SUITE'),
+ text({ x: 88, y: 150, w: 880, h: 340, html: 'This announcement<br>is the product.', fontSize: 96, fontFamily: FR, fontWeight: 900, color: '#fff', lineHeight: 1.02 }),
+ text({ x: 96, y: 470, w: 700, h: 90, html: 'You are inside a <b>.bento.html</b> file — a presentation that carries its own editor, presenter and format. One file. No install. No account.', fontSize: 20, color: MIST, lineHeight: 1.6, fx: { enter: 'fade-up', order: 1 } }),
+ text({ x: 96, y: 640, w: 1000, h: 24, html: '→ ADVANCE · ESC OPENS THE EDITOR ON THIS VERY FILE', fontSize: 12, fontWeight: 700, letterSpacing: 3, color: 'rgba(255,158,138,0.85)', fx: { enter: 'fade-up', order: 2 } }),
+ ],
+})
+
+const s2 = slide({
+ id: 'an-onefile', background: INK, transition: 'morph',
+ notes: 'The whole product in one sentence. The tiles just morphed because they share ids across slides — that is Bento’s native transition, computed from the model, not the DOM.',
+ elements: [
+ ...tiles({ x: 96, y: 120, w: 110, h: 110 }, { x: 226, y: 120, w: 70, h: 110 }, { x: 316, y: 120, w: 64, h: 64 }),
+ text({ x: 90, y: 280, w: 1100, h: 160, html: 'One file is the app.', fontSize: 84, fontFamily: FR, fontWeight: 900, color: '#fff', lineHeight: 1 }),
+ text({ x: 96, y: 440, w: 1000, h: 130, html: 'Deck, viewer, presenter, editor, fonts, images, charts — all inside one ~400 KB HTML file that <b>saves itself</b>. Email it, AirDrop it, archive it for a decade. Every copy is the complete product.', fontSize: 21, color: MIST, lineHeight: 1.65, fx: { enter: 'fade-up' } }),
+ text({ x: 96, y: 640, w: 900, h: 24, html: 'NOTHING TO INSTALL · NOTHING TO EXPIRE · WORKS FROM file://', fontSize: 12, fontWeight: 700, letterSpacing: 3, color: MIST_DIM, fx: { enter: 'fade-up', order: 2 } }),
+ ],
+})
+
+const s3 = slide({
+ id: 'an-source', background: PAPER, transition: 'fade',
+ notes: 'View-source honesty. The document is a plaintext JSON block at the top of the file — open this file in a text editor and there it is. No binary, no lock-in. This is also what makes AI editing trivial.',
+ elements: [
+ kick(96, 96, 'VIEW-SOURCE HONEST', PEACH_DEEP),
+ text({ x: 90, y: 140, w: 1000, h: 110, html: 'Your data is right there.', fontSize: 64, fontFamily: FR, fontWeight: 900, color: INK, lineHeight: 1 }),
+ rect({ x: 96, y: 270, w: 1088, h: 330, fill: '#0A1524', radius: 16, shadow: { y: 20, blur: 50, color: 'rgba(13,27,46,0.35)' }, fx: { enter: 'fade-up' } }),
+ text({ x: 130, y: 300, w: 1020, h: 280, fontFamily: MONO, fontSize: 17, lineHeight: 1.75, color: '#8FA3BF', fx: { enter: 'fade-up' }, html:
+ '&lt;script type="application/bento+json" id="bento-doc"&gt;<br>' +
+ '{ "format": "bento/slides",<br>' +
+ '&nbsp;&nbsp;"title": <span style="color:#cfe0c5">"This announcement is the product"</span>,<br>' +
+ '&nbsp;&nbsp;"slides": [ <span style="color:#FFBCA8">…the slide you are reading…</span> ] }<br>' +
+ '&lt;/script&gt;' }),
+ text({ x: 96, y: 632, w: 1000, h: 30, html: 'Open this file in a text editor — that block is the whole document. The rest is the runtime.', fontSize: 16, color: INK_SOFT, fx: { enter: 'fade-up', order: 2 } }),
+ ],
+})
+
+const s4 = slide({
+ id: 'an-collab', background: INK, transition: 'fade',
+ notes: 'Collaboration without accounts: keys are minted client-side at document creation and live in the file. The relay stores ciphertext and learns nothing — its source is about one file, read it. Offline edits merge back through our own CRDT (character-level text merging included), verified by a convergence rig across hundreds of thousands of checks.',
+ elements: [
+ kick(96, 96, 'TOGETHER, LIVE'),
+ text({ x: 90, y: 140, w: 1100, h: 200, html: 'The file is<br>the invitation.', fontSize: 76, fontFamily: FR, fontWeight: 900, color: '#fff', lineHeight: 1.02 }),
+ text({ x: 96, y: 360, w: 1000, h: 90, html: 'Start a live session and send the file — anyone who opens a copy joins. <b>E2EE</b>, keys never leave the file, and offline edits merge back both ways when people return.', fontSize: 20, color: MIST, lineHeight: 1.6, fx: { enter: 'fade-up' } }),
+ ...[['E2EE', 'AES-GCM, keys in your file'], ['BLIND RELAY', 'stores ciphertext, learns nothing'], ['OWN CRDT', 'char-level merges, fuzz-tested']].map(([h, b], i) => [
+ rect({ x: 96 + i * 372, y: 490, w: 340, h: 120, fill: PANEL, radius: 16, fx: { enter: 'fade-up', order: i + 1 } }),
+ text({ x: 120 + i * 372, y: 512, w: 292, h: 30, html: h, fontSize: 14, fontWeight: 800, letterSpacing: 3, color: PEACH, fx: { enter: 'fade-up', order: i + 1 } }),
+ text({ x: 120 + i * 372, y: 546, w: 292, h: 50, html: b, fontSize: 15, color: MIST, lineHeight: 1.45, fx: { enter: 'fade-up', order: i + 1 } }),
+ ]).flat(),
+ ],
+})
+
+const s5 = slide({
+ id: 'an-ai', background: PAPER, transition: 'fade',
+ notes: 'Full disclosure: an AI agent designed and wrote this deck — and the four templates in the gallery — by editing the JSON directly. The recipe your agent needs is one markdown file: bento.page/agents.md. If you never touch AI, nothing here ever will either.',
+ elements: [
+ kick(96, 96, 'DESIGNED FOR AI · ENTIRELY OPTIONAL', PEACH_DEEP),
+ text({ x: 90, y: 140, w: 1100, h: 200, html: 'An agent wrote<br>this deck.', fontSize: 76, fontFamily: FR, fontWeight: 900, color: INK, lineHeight: 1.02 }),
+ text({ x: 96, y: 370, w: 1000, h: 130, html: 'The document is plain JSON in the file, so agents edit <b>.bento.html</b> files in place and chatbots round-trip the JSON. No converters, no uploads, no .pptx archaeology — this deck and the whole template gallery were authored that way.', fontSize: 20, color: INK_SOFT, lineHeight: 1.6, fx: { enter: 'fade-up' } }),
+ rect({ x: 96, y: 540, w: 620, h: 70, fill: INK, radius: 35, fx: { enter: 'fade-up', order: 2 } }),
+ text({ x: 96, y: 562, w: 620, h: 30, html: 'bento.page/agents.md — the recipe for your agent', fontSize: 17, fontWeight: 600, color: TILE, align: 'center', fx: { enter: 'fade-up', order: 2 } }),
+ ],
+})
+
+const s6 = slide({
+ id: 'an-forever', background: INK, transition: 'fade',
+ notes: 'Local-first, provably: Offline mode hard-blocks every network feature. Updates are ECDSA-signed, verified in-app, and write a NEW file — the old one stays as rollback. If bento.page vanished tomorrow, every file keeps working. That is the whole point.',
+ elements: [
+ kick(96, 96, 'LOCAL-FIRST, PROVABLY'),
+ text({ x: 90, y: 140, w: 1100, h: 200, html: 'This file will open<br>in 2036.', fontSize: 76, fontFamily: FR, fontWeight: 900, color: '#fff', lineHeight: 1.02 }),
+ text({ x: 96, y: 370, w: 1000, h: 140, html: 'No account. No telemetry. An <b>Offline mode</b> that hard-blocks everything network-shaped. Signed updates you apply yourself — each one writes a new file, so the old one is your rollback. Documents should outlive the companies that made them.', fontSize: 20, color: MIST, lineHeight: 1.62, fx: { enter: 'fade-up' } }),
+ text({ x: 96, y: 620, w: 1000, h: 30, html: 'IF BENTO.PAGE VANISHED TONIGHT, EVERY FILE KEEPS OPENING, EDITING, PRESENTING.', fontSize: 12, fontWeight: 700, letterSpacing: 3, color: MIST_DIM, fx: { enter: 'fade-up', order: 2 } }),
+ ],
+})
+
+const s7 = slide({
+ id: 'an-honest', background: PANEL, transition: 'fade',
+ notes: 'The honest slide. Undo during live collab is snapshot-based and can revert a collaborator’s concurrent edit to the same property (documented LWW compromise). Editing is desktop-first; phones view and present well. Fullscreen needs a user gesture. Files grow with embedded images. We would rather you hear it from us.',
+ elements: [
+ kick(96, 96, 'WHAT IT DOESN’T DO (YET)'),
+ text({ x: 90, y: 140, w: 1000, h: 110, html: 'The honest slide.', fontSize: 64, fontFamily: FR, fontWeight: 900, color: '#fff', lineHeight: 1 }),
+ text({ x: 96, y: 280, w: 1040, h: 300, fontSize: 20, color: MIST, lineHeight: 1.9, fx: { enter: 'fade-up' }, html:
+ '· Undo during live collab is snapshot-based — it can revert a peer’s concurrent edit<br>' +
+ '· Editing is desktop-first; phones are for viewing and presenting<br>' +
+ '· Fullscreen needs a user gesture; some embeds deny it (we degrade to tab mode)<br>' +
+ '· Files grow with embedded images — no optimizer yet<br>' +
+ '· Docs and Sheets don’t exist yet. Slides came first.' }),
+ text({ x: 96, y: 620, w: 1000, h: 30, html: 'TRADE-OFFS ARE DESIGN. WE’D RATHER DISCLOSE THAN DISAPPOINT.', fontSize: 12, fontWeight: 700, letterSpacing: 3, color: 'rgba(255,158,138,0.7)', fx: { enter: 'fade-up', order: 2 } }),
+ ],
+})
+
+const s8 = slide({
+ id: 'an-close', background: INK, transition: 'morph',
+ notes: 'The close. This file is now the reader’s: because it is a template, saving mints a fresh identity automatically — their copy is theirs, keys and all. That is the viral loop: every shared deck is a working install.',
+ elements: [
+ ...tiles({ x: 540, y: 90, w: 200, h: 200 }, { x: 464, y: 210, w: 120, h: 180 }, { x: 700, y: 230, w: 120, h: 120 }),
+ text({ x: 140, y: 360, w: 1000, h: 130, html: 'One file. Yours. Forever.', fontSize: 74, fontFamily: FR, fontWeight: 900, color: '#fff', align: 'center', lineHeight: 1 }),
+ text({ x: 140, y: 500, w: 1000, h: 60, html: '<b>bento.page</b> — the site &nbsp;·&nbsp; <b>bento.page/slides</b> — the app &nbsp;·&nbsp; the gallery — decks to steal', fontSize: 19, color: MIST, align: 'center', lineHeight: 1.6, fx: { enter: 'fade-up' } }),
+ text({ x: 140, y: 600, w: 1000, h: 30, html: 'PRESS ESC AND SAVE A COPY — THIS ANNOUNCEMENT IS NOW YOUR DECK. FRESH IDENTITY INCLUDED.', fontSize: 12, fontWeight: 700, letterSpacing: 2.5, color: 'rgba(255,158,138,0.85)', align: 'center', fx: { enter: 'fade-up', order: 2 } }),
+ ],
+})
+
+const doc = {
+ format: 'bento/slides', version: 1, title: 'This announcement is the product',
+ size: { width: 1280, height: 720 }, template: true,
+ theme: { background: INK, color: '#fff', accent: PEACH, fontFamily: IN },
+ assets: { 'font-fraunces': font('FRAUNCES_900'), 'font-instrument': font('INSTRUMENT_VAR') },
+ fonts: [
+ { family: 'Fraunces', asset: 'font-fraunces', weight: '900' },
+ { family: 'Instrument Sans', asset: 'font-instrument', weight: '100 900' },
+ ],
+ present: { progress: true },
+ slides: [s1, s2, s3, s4, s5, s6, s7, s8],
+ modified: new Date().toISOString(),
+}
+
+const blockRe = /<script type="application\/bento\+json" id="bento-doc">[\s\S]*?<\/script>/
+const json = JSON.stringify(doc).replace(/</g, '\\u003c')
+const spliced = shell.replace(blockRe, `<script type="application/bento+json" id="bento-doc">\n${json}\n</scr` + 'ipt>')
+if (!spliced.includes(json)) throw new Error('splice failed')
+writeFileSync(out, spliced)
+console.log(`announcement → ${out} (${doc.slides.length} slides, ${Math.round(spliced.length / 1024)} KB)`)
diff --git a/scripts/build-qr-page.mjs b/scripts/build-qr-page.mjs
new file mode 100644
index 00000000..7fa905f1
--- /dev/null
+++ b/scripts/build-qr-page.mjs
@@ -0,0 +1,60 @@
+#!/usr/bin/env node
+// "This QR code is a presentation" — builds site/q/index.html from
+// site-src/q.html: composes a tiny deck, deflates it into a base64url
+// payload (the QR encodes URL#payload — the deck literally lives in the
+// code), and inlines a QR SVG generated with the `qrcode` npm CLI.
+//
+// node scripts/build-qr-page.mjs [outFile] (default: site/q/index.html)
+
+import { execFileSync } from 'node:child_process'
+import { deflateRawSync } from 'node:zlib'
+import { mkdirSync, readFileSync, writeFileSync, rmSync } from 'node:fs'
+import { dirname, join } from 'node:path'
+import { tmpdir } from 'node:os'
+import { fileURLToPath } from 'node:url'
+
+const root = dirname(dirname(fileURLToPath(import.meta.url)))
+const out = process.argv[2] ?? join(root, 'site/q/index.html')
+
+// the deck that fits in a QR — text + flat shapes only (the projector
+// page renders exactly this subset)
+const INK = '#0D1B2E', PEACH = '#FF9E8A', PAPER = '#F0EBE0', STEEL = '#5E7699'
+const doc = {
+ format: 'bento/slides', version: 1, title: 'The QR deck',
+ size: { width: 1280, height: 720 },
+ slides: [
+ { id: 'q1', background: INK, elements: [
+ { id: 'a', type: 'shape', shape: 'rect', x: 960, y: 120, w: 150, h: 150, fill: PEACH, radius: 30 },
+ { id: 'b', type: 'shape', shape: 'rect', x: 1010, y: 300, w: 100, h: 150, fill: STEEL, radius: 24 },
+ { id: 'c', type: 'shape', shape: 'ellipse', x: 900, y: 330, w: 90, h: 90, fill: PAPER },
+ { id: 't1', type: 'text', x: 96, y: 170, w: 800, h: 260, html: 'You scanned<br>a slideshow.', fontSize: 84, fontWeight: 800, color: '#fff', lineHeight: 1.05, fontFamily: 'Georgia, serif' },
+ { id: 't2', type: 'text', x: 96, y: 460, w: 760, h: 80, html: 'This entire deck travelled inside the QR code — compressed JSON in the URL fragment. No server ever saw it.', fontSize: 21, color: 'rgba(182,193,210,0.9)', lineHeight: 1.5 },
+ { id: 't3', type: 'text', x: 96, y: 620, w: 800, h: 30, html: '→ NEXT', fontSize: 13, fontWeight: 700, color: PEACH, letterSpacing: 4 },
+ ] },
+ { id: 'q2', background: PAPER, elements: [
+ { id: 't4', type: 'text', x: 96, y: 150, w: 1080, h: 220, html: 'A deck in 3 KB.<br>An office suite in one file.', fontSize: 66, fontWeight: 800, color: INK, lineHeight: 1.1, fontFamily: 'Georgia, serif' },
+ { id: 't5', type: 'text', x: 96, y: 420, w: 900, h: 120, html: 'Real Bento decks carry their own editor, presenter, charts and end-to-end-encrypted collaboration. Still just a file.', fontSize: 22, color: 'rgba(13,27,46,0.75)', lineHeight: 1.55 },
+ { id: 't6', type: 'text', x: 96, y: 590, w: 900, h: 60, html: 'bento.page', fontSize: 40, fontWeight: 800, color: '#C25A43' },
+ ] },
+ ],
+}
+
+const payload = deflateRawSync(JSON.stringify(doc), { level: 9 })
+ .toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '')
+const url = `https://bento.page/q#${payload}`
+console.log(`qr payload: ${payload.length} chars (${url.length} total in QR)`)
+
+// QR SVG via the qrcode npm package CLI (cached by npx after first run)
+const tmp = join(tmpdir(), `bento-qr-${process.pid}.svg`)
+execFileSync('npx', ['--yes', 'qrcode', '-t', 'svg', '-e', 'M', '-o', tmp, url], { stdio: 'inherit' })
+let svg = readFileSync(tmp, 'utf8')
+rmSync(tmp)
+svg = svg.replace(/<\?xml[^>]*\?>/, '')
+
+let html = readFileSync(join(root, 'site-src/q.html'), 'utf8')
+html = html.replace('__QR_SVG__', svg)
+html = html.replace('__PAYLOAD__', payload)
+if (/__(QR_SVG|PAYLOAD)__/.test(html)) throw new Error('placeholder not replaced')
+mkdirSync(dirname(out), { recursive: true })
+writeFileSync(out, html)
+console.log(`qr page → ${out} (${Math.round(html.length / 1024)} KB)`)
diff --git a/scripts/release.mjs b/scripts/release.mjs
index 399cfbdf..36598783 100644
--- a/scripts/release.mjs
+++ b/scripts/release.mjs
@@ -87,6 +87,16 @@ execFileSync('node', [join(root, 'scripts/build-landing.mjs'), join(site, 'index
// (each carries template:true; opening one mints a fresh, independent deck).
execFileSync('node', [join(root, 'scripts/build-example-decks.mjs'), join(site, 'gallery')], { stdio: 'inherit' })
+// The agent guide — the runnable version of the "designed for AI" claim.
+cpSync(join(root, 'docs/agents.md'), join(site, 'agents.md'))
+
+// 404 — of course it's a deck (see build-404-deck.mjs + site-src/404.html).
+execFileSync('node', [join(root, 'scripts/build-404-deck.mjs'), join(site, '404.bento.html')], { stdio: 'inherit' })
+cpSync(join(root, 'site-src/404.html'), join(site, '404.html'))
+
+// /q — "this QR code is a presentation" (deck lives in the URL fragment).
+execFileSync('node', [join(root, 'scripts/build-qr-page.mjs'), join(site, 'q/index.html')], { stdio: 'inherit' })
+
console.log(`\nSite assembled for v${version}:`)
execFileSync('find', [site, '-type', 'f'], { stdio: 'inherit' })
console.log('\nPublish ./site/ to the gh-pages branch (docs/RELEASING.md).')
diff --git a/site-src/404.html b/site-src/404.html
new file mode 100644
index 00000000..a66287dc
--- /dev/null
+++ b/site-src/404.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>404 — bento.page</title>
+<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='7' fill='%2316273E'/%3E%3Crect x='5' y='5' width='7' height='22' rx='2.5' fill='%235E7699'/%3E%3Crect x='14' y='5' width='13' height='10' rx='2.5' fill='%23FF9E8A'/%3E%3Crect x='14' y='17' width='13' height='10' rx='2.5' fill='%23F0EBE0'/%3E%3C/svg%3E">
+<style>
+* { margin: 0; padding: 0; box-sizing: border-box; }
+body {
+ min-height: 100vh; display: grid; place-items: center;
+ background: #0D1B2E; color: rgba(182,193,210,0.92);
+ font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
+ text-align: center; padding: 32px;
+}
+.n { font-family: 'Fraunces', Georgia, serif; font-weight: 900; font-size: clamp(90px, 22vw, 200px); color: #FF9E8A; line-height: 1; }
+h1 { color: #fff; font-size: clamp(20px, 3.4vw, 30px); margin: 18px 0 10px; font-weight: 700; }
+p { max-width: 34em; margin: 0 auto; line-height: 1.6; }
+.btn {
+ display: inline-block; margin-top: 28px; padding: 14px 28px; border-radius: 999px;
+ font-weight: 700; color: #0D1B2E; text-decoration: none;
+ background: linear-gradient(180deg, #FFB29B, #ED8266);
+ box-shadow: 0 10px 26px rgba(0,0,0,0.4), 0 0 42px rgba(255,238,214,0.22);
+}
+.home { display: inline-block; margin: 28px 0 0 14px; padding: 13px 24px; border-radius: 999px; color: #fff; text-decoration: none; border: 1px solid rgba(255,255,255,0.3); font-weight: 600; }
+.fine { margin-top: 26px; font-size: 12.5px; letter-spacing: 0.06em; color: rgba(182,193,210,0.55); }
+</style>
+</head>
+<body>
+<div>
+ <div class="n">404</div>
+ <h1>This page doesn't exist.</h1>
+ <p>In fairness, around here even the error page wanted to be a presentation
+ — and since every Bento deck is a whole app, the 404 below is one too.</p>
+ <a class="btn" href="/404.bento.html#present">▶&nbsp; Present the 404</a>
+ <a class="home" href="/">Go home</a>
+ <div class="fine">Yes, you can save the 404 and keep it. It's a file. That's the point.</div>
+</div>
+</body>
+</html>
diff --git a/site-src/landing.html b/site-src/landing.html
index bd2754a6..c6876bc9 100644
--- a/site-src/landing.html
+++ b/site-src/landing.html
@@ -438,6 +438,15 @@ footer {
footer .wrap { display: grid; gap: 10px; }
footer b { color: var(--mist); font-weight: 600; }
+/* konami deck mode — the page presents itself */
+body.kdeck { overflow: hidden; }
+body.kdeck section { display: none; }
+body.kdeck section.kactive { display: flex; align-items: center; position: fixed; inset: 0; z-index: 90; overflow: auto; padding: 60px 0; background: var(--ink); }
+body.kdeck section.kactive.paper { background: var(--paper); }
+body.kdeck section.kactive .wrap { width: 100%; }
+body.kdeck header, body.kdeck footer { display: none; }
+.kchip { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 95; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; color: var(--mist); background: rgba(13, 27, 46, 0.85); border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 999px; padding: 8px 18px; pointer-events: none; }
+
/* reveal choreography */
.rv { opacity: 0; transform: translateY(26px); transition: opacity 0.8s cubic-bezier(0.2, 0.6, 0.2, 1), transform 0.8s cubic-bezier(0.2, 0.6, 0.2, 1); }
.rv.in { opacity: 1; transform: none; }
@@ -615,6 +624,7 @@ footer b { color: var(--mist); font-weight: 600; }
<span class="chip"><b>The format is the API</b></span>
<span class="chip">No binary .pptx to decode</span>
<span class="chip">Agents edit the file in place</span>
+ <a class="chip" href="/agents.md" style="text-decoration:none"><b>bento.page/agents.md</b> — the recipe for your agent</a>
<span class="chip">Nothing phones home</span>
</div>
</div>
@@ -762,6 +772,35 @@ window.bento.loadDoc(json) <span class="c">// write, undoable</span></div>
}, { threshold: 0.18, rootMargin: '0px 0px -40px 0px' })
document.querySelectorAll('.rv:not(.in)').forEach((n) => io.observe(n))
})()
+
+// easter egg: ↑↑↓↓←→←→BA presents this page as a deck. Of course it does.
+;(() => {
+ const seq = ['arrowup','arrowup','arrowdown','arrowdown','arrowleft','arrowright','arrowleft','arrowright','b','a']
+ let ki = 0, on = false, i = 0
+ const sections = () => [...document.querySelectorAll('section')]
+ const chip = document.createElement('div')
+ chip.className = 'kchip'
+ const show = (n) => {
+ const ss = sections()
+ i = Math.max(0, Math.min(ss.length - 1, n))
+ ss.forEach((s, j) => s.classList.toggle('kactive', j === i))
+ ss[i].querySelectorAll('.rv').forEach((r) => r.classList.add('in'))
+ chip.textContent = `${i + 1} / ${ss.length} — this page is a deck now · esc exits`
+ }
+ const start = () => { on = true; document.body.classList.add('kdeck'); document.body.appendChild(chip); show(0) }
+ const end = () => { on = false; document.body.classList.remove('kdeck'); chip.remove(); sections().forEach((s) => s.classList.remove('kactive')) }
+ addEventListener('keydown', (e) => {
+ const k = e.key.toLowerCase()
+ if (!on) {
+ ki = k === seq[ki] ? ki + 1 : (k === seq[0] ? 1 : 0)
+ if (ki === seq.length) { ki = 0; start(); e.preventDefault() }
+ return
+ }
+ if (k === 'escape') end()
+ else if (k === 'arrowright' || k === ' ') { e.preventDefault(); i < sections().length - 1 ? show(i + 1) : end() }
+ else if (k === 'arrowleft') { e.preventDefault(); show(i - 1) }
+ })
+})()
</script>
</body>
</html>
diff --git a/site-src/q.html b/site-src/q.html
new file mode 100644
index 00000000..78ab2cf9
--- /dev/null
+++ b/site-src/q.html
@@ -0,0 +1,105 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>This QR code is a presentation — bento.page</title>
+<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='7' fill='%2316273E'/%3E%3Crect x='5' y='5' width='7' height='22' rx='2.5' fill='%235E7699'/%3E%3Crect x='14' y='5' width='13' height='10' rx='2.5' fill='%23FF9E8A'/%3E%3Crect x='14' y='17' width='13' height='10' rx='2.5' fill='%23F0EBE0'/%3E%3C/svg%3E">
+<style>
+* { margin: 0; padding: 0; box-sizing: border-box; }
+body { min-height: 100vh; background: #0D1B2E; color: rgba(182,193,210,0.92); font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
+.wrap { max-width: 980px; margin: 0 auto; padding: 64px 28px; display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 48px; align-items: center; min-height: 100vh; }
+@media (max-width: 760px) { .wrap { grid-template-columns: 1fr; padding: 44px 22px; } }
+.kicker { font-size: 12px; font-weight: 700; letter-spacing: 0.3em; color: #FF9E8A; }
+h1 { font-family: Fraunces, Georgia, serif; font-weight: 900; color: #fff; font-size: clamp(34px, 5vw, 54px); line-height: 1.02; margin: 16px 0 18px; }
+p { line-height: 1.65; margin-bottom: 14px; max-width: 34em; }
+b { color: #fff; font-weight: 600; }
+.btn { display: inline-block; margin-top: 14px; padding: 14px 28px; border-radius: 999px; font-weight: 700; color: #0D1B2E; text-decoration: none; cursor: pointer; border: 0; font-size: 15px; background: linear-gradient(180deg, #FFB29B, #ED8266); box-shadow: 0 10px 26px rgba(0,0,0,0.4); }
+.home { color: rgba(182,193,210,0.7); margin-left: 16px; }
+.qr { background: #fff; border-radius: 18px; padding: 22px; box-shadow: 0 24px 60px rgba(0,0,0,0.45); }
+.qr svg { display: block; width: 100%; height: auto; }
+.qcap { text-align: center; font-size: 12px; letter-spacing: 0.06em; color: rgba(182,193,210,0.55); margin-top: 12px; }
+/* projector */
+#stagewrap { position: fixed; inset: 0; background: #000; display: none; z-index: 50; }
+#stagewrap.on { display: block; }
+#stage { position: absolute; left: 50%; top: 50%; width: 1280px; height: 720px; transform-origin: center; overflow: hidden; }
+#stage .el { position: absolute; }
+#exit { position: fixed; top: 16px; right: 20px; z-index: 60; color: rgba(255,255,255,0.6); background: none; border: 1px solid rgba(255,255,255,0.3); border-radius: 999px; padding: 6px 14px; cursor: pointer; font-size: 12px; }
+#hint { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 60; color: rgba(255,255,255,0.45); font-size: 12px; letter-spacing: 0.08em; }
+</style>
+</head>
+<body>
+<div class="wrap">
+ <div>
+ <div class="kicker">A STUNT, TECHNICALLY TRUE</div>
+ <h1>This QR code is a presentation.</h1>
+ <p>Not a link to one — the deck itself. The QR encodes this page's URL
+ plus the <b>entire document as compressed JSON</b> in the fragment. The
+ fragment never leaves your device, and this page is just a projector:
+ a few kilobytes that decompress the hash and play it.</p>
+ <p>Real Bento decks go further — <b>the file carries the whole editor</b>.
+ This is merely the party-trick edition.</p>
+ <button class="btn" id="play">▶&nbsp; Play the deck in the code</button>
+ <a class="home" href="/">bento.page →</a>
+ </div>
+ <div>
+ <div class="qr">__QR_SVG__</div>
+ <div class="qcap">scan it — the slides are inside the squares</div>
+ </div>
+</div>
+<div id="stagewrap"><div id="stage"></div><button id="exit">esc</button><div id="hint">→ next · ← back</div></div>
+<script>
+const FALLBACK = '__PAYLOAD__'
+const b64ToBytes = (s) => Uint8Array.from(atob(s.replace(/-/g, '+').replace(/_/g, '/')), (c) => c.charCodeAt(0))
+async function loadDoc() {
+ const payload = location.hash.length > 1 ? location.hash.slice(1) : FALLBACK
+ const ds = new DecompressionStream('deflate-raw')
+ const stream = new Blob([b64ToBytes(payload)]).stream().pipeThrough(ds)
+ return JSON.parse(await new Response(stream).text())
+}
+const stage = document.getElementById('stage'), wrapEl = document.getElementById('stagewrap')
+let doc = null, idx = 0
+function fit() {
+ const s = Math.min(innerWidth / 1280, innerHeight / 720) * 0.96
+ stage.style.transform = `translate(-50%, -50%) scale(${s})`
+}
+function render() {
+ const sl = doc.slides[idx]
+ stage.style.background = sl.background || '#000'
+ stage.innerHTML = ''
+ for (const el of sl.elements || []) {
+ const d = document.createElement('div')
+ d.className = 'el'
+ d.style.cssText = `left:${el.x}px;top:${el.y}px;width:${el.w}px;height:${el.h}px;opacity:${el.opacity ?? 1};`
+ if (el.rotation) d.style.transform = `rotate(${el.rotation}deg)`
+ if (el.type === 'text') {
+ d.innerHTML = el.html || ''
+ d.style.font = `${el.fontWeight >= 700 ? el.fontWeight : el.fontWeight || 400} ${el.fontSize || 24}px/${el.lineHeight || 1.3} ${el.fontFamily || 'inherit'}`
+ d.style.color = el.color || '#fff'
+ d.style.textAlign = el.align || 'left'
+ if (el.letterSpacing) d.style.letterSpacing = el.letterSpacing + 'px'
+ } else if (el.type === 'shape') {
+ d.style.background = el.fill || '#888'
+ d.style.borderRadius = el.shape === 'ellipse' ? '50%' : (el.radius || 0) + 'px'
+ }
+ stage.appendChild(d)
+ }
+}
+async function start() {
+ if (!doc) doc = await loadDoc()
+ idx = 0; wrapEl.classList.add('on'); fit(); render()
+}
+function stop() { wrapEl.classList.remove('on') }
+document.getElementById('play').onclick = start
+document.getElementById('exit').onclick = stop
+addEventListener('resize', fit)
+addEventListener('keydown', (e) => {
+ if (!wrapEl.classList.contains('on')) return
+ if (e.key === 'Escape') stop()
+ else if (e.key === 'ArrowRight' || e.key === ' ') idx < doc.slides.length - 1 ? (idx++, render()) : stop()
+ else if (e.key === 'ArrowLeft' && idx > 0) { idx--; render() }
+})
+if (location.hash.length > 1) start()
+</script>
+</body>
+</html>