Bento, the office suite that fits in a file
TypeScript mit-licenseofficeoffice-365office-suiteoffice-toolsoffice365open-sourcepowerpointself-hostedsingle-page-appslidesslideshareslideshowslideshow-galleryslideshow-makerslideshows
Starter deck: the same trick on code (#365)
nyblnet82e9a434d80c
diff --git a/CLAUDE.md b/CLAUDE.mdindex 63d49603..b23e7e53 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -22,9 +22,16 @@ names provisional.- `src/model.ts` — the `bento/slides` JSON document model. This is the format.- `src/starterdeck.ts` — the showcase starter deck (what a fresh build openswith): four 'sd-tile-*' elements morph through EVERY slide (the id-continuity- demo), one deliberate 'fade' beat exists because entrance staggers/count-ups- only run on non-morph entries, charts slide + hidden pie state demo the- bar⇄pie data morph, speaker notes double as the feature tour. Gotchas learned+ demo) — only the title arrives by 'fade', so nothing interrupts that thread.+ The stats beat used to fade too, on the belief that entrance staggers and+ count-ups needed a non-morph arrival; that has been FALSE since #197 (runMorph+ gives every unpartnered element its fx.enter, and runMorphArrivalCountUps+ counts up anything not carried from the previous slide), and the fade was+ costing the deck its best tile moment — the four scattered tiles collapsing+ into the row of chips. Verified by measurement, not belief: on that morph+ arrival all four tiles travel, 13 elements stagger in, and the count-up runs+ 0→100%. Charts slide + hidden pie state demo the bar⇄pie data morph, speaker+ notes double as the feature tour. Gotchas learnedbuilding it: line shapes take their color from `fill` (not `stroke` — thestroke attr is what morphs tween), and the renderer draws lines horizontallyacross the element box (vertical lines = rotation), keep 96px side marginsdiff --git a/docs/DECISIONS.md b/docs/DECISIONS.mdindex e98cad74..cabfe30c 100644--- a/docs/DECISIONS.md+++ b/docs/DECISIONS.md@@ -5439,3 +5439,112 @@ language: "An update check is the only network this app makes on its own. Itasks the release server for a signed manifest and sends nothing about you orthis document — no ids, no telemetry." Live collaboration is network too, butit is network the reader started.++## 2026-08-25 — the square root: Chromium's radical join, accepted unfixed++**The symptom.** In a formula, the radical's hook does not meet its overbar —+a visible step where the two should be one stroke.++**Status: accepted, unfixed.** Formulas keep the generic `math` family. There+is a mitigation that helps on macOS and it is written down below, deliberately+not shipped. This waits for an upstream fix.++**Every font tested breaks.** Measured on the affected engine, not inferred:++| platform | what generic `math` picks | radical join |+|---|---|---|+| macOS | STIX Two Math | broken |+| Windows | Cambria Math | broken, same way |+| Windows, forced `serif` | Times New Roman | smaller break, still broken |++Three fonts, three breaks. That is what rules the font out as the cause: a+defect belonging to STIX would not follow us to Cambria Math and Times New+Roman, on another operating system, in another font family.++**It is not a version regression.** An earlier version of this entry claimed+Chromium 148 was clean and 151 broken. That table was wrong and is the reason+this entry was rewritten. The "clean" engine was an embedded browser that ships+almost no fonts, so it silently fell back to a plain serif and never rendered+STIX at all. It was not a newer engine breaking a radical; it was two engines+drawing two different fonts. STIX breaks in 148 too.++**What the mechanism appears to be.** Chromium paints the arm of the radical+from the font's glyph and then draws the overbar itself as a rule, and the+break is those two disagreeing by a fraction of a pixel. Two measurements+support this. Sweeping the radicand height from 10px to 200px, the glyph's+advance width never moves off 109.1px, so the radical stretches by a glyph+assembly rather than by wider size variants — the engine is compositing, not+picking one drawn glyph. And the size of the break tracks the font's arm+thickness rather than anything about the formula. It follows that the mismatch+is resolution-dependent, which is why Windows breaks *differently* rather than+not at all, and why zoom level can change the verdict on a given row.++**The radicand's height is not the cause, so do not try to fix this by making+formulas shorter.** Tested directly, because it is the intuitive suspect. In+the starter deck's own quadratic formula the `b²` raises the radicand from+64.4px to 84.3px, but the msqrt box stays at 113.8px — the *minimum*,+single-glyph size — exactly as it is for a flat `b − 4ac` and for four other+radicands. Same glyph, same size, same position, same bar. Only a fraction+inside the root (radicand 159.7px, box 220.3px) actually stretches it. The+radical in `√(b²−4ac)` is pixel-identical to the one in `√(b−4ac)`, so the+exponent cannot be raising the bar.++**The mitigation, documented and not shipped.** Scoping a non-maths font to the+radical only, and putting the contents back:++```css+.bento-el math msqrt { font-family: serif; }+.bento-el math msqrt * { font-family: math; }+```++The second rule is what makes it viable: it keeps the whole formula in the+maths font and swaps only the glyph that is drawn wrong. A blanket `serif` on+the formula is not an option — it collapses stretchy delimiters (a tall `(`+measured 315px in the maths font and 94px in serif) and shrinks large+operators.++Verified clean on macOS/Chrome, where it swaps STIX's radical for the serif+one. **It is not shipped because it does not hold on Windows**, where `serif`+is Times New Roman and the break is smaller but still there. It trades one+rounding mismatch for another, and a fix that only works on the author's own+machine is worse than a known defect. If a font is ever found that joins+cleanly on both platforms, this rule is the shape the fix should take — scoped+to `msqrt`, contents restored to `math`. Note also that the stack matters: on+Windows `'Cambria Math', serif` selects what generic `math` already selects, so+that variant is a no-op there.++`slides/probe/radical-join.html` is the cross-platform test rig:+one row per candidate font applying exactly the rule above, each row reporting+whether the font actually resolved, and a paste-back block carrying platform,+UA and DPR.++**If it ever becomes worth fixing on our side**, the only route that bypasses+the engine's radical painting is drawing the hook and bar ourselves — an+`<mo>√</mo>` plus a CSS rule for the bar, overlapped so the join cannot+separate at any DPI. That costs the semantic `msqrt` (accessibility, and the+morph would need the bar tagged as its own symbol), and an earlier hand-built+approximation still showed problems, so it needs verifying in the affected+engine before anyone commits to it.++**How this went wrong, which is the part worth keeping.** Six or more confident+wrong answers were reported before the right one, every one from an instrument+that lied:++- `document.fonts.check()` returns true for fonts that are NOT installed, so a+ four-font comparison was three fallbacks wearing different labels. Control: a+ nonsense font name — every fallback returns identical metrics.+- A "step size" metric compared the bar against the ink just left of it, which+ is the diagonal, not the flag. It scored a perfect radical as broken and+ returned an identical 21px for every variant.+- An SVG foreignObject rasteriser ignores `font-family` entirely, proven when+ `NoSuchFontXYZ` produced byte-identical output to STIX.+- And the one that cost the most: **every test page was judged in a browser+ that resolved the fonts differently from the one showing the bug.** Nine test+ matrices came back "all fine" for that reason alone, each one clearing a+ suspect that had never actually been rendered.++**The lesson: pin the environment before trusting any comparison, and prove the+thing under test is really on screen.** Record engine, version and *resolved*+font in the test artefact itself — a named font that silently fell back is not+a test of that font. "It looks fine here" is not evidence until "here" is+named.diff --git a/scripts/test-codediff.ts b/scripts/test-codediff.tsindex 52ffc537..dc45671a 100644--- a/scripts/test-codediff.ts+++ b/scripts/test-codediff.ts@@ -148,5 +148,19 @@ const toksOf = (states: State[] | undefined) =>inserts.every((v: string) => !/\S/.test(v)))}+// 9. A WORD THAT CHANGES CLASS KEEPS ITS IDENTITY — `render(` is classed a+// call, `.then(render)` a plain reference. The tokenizer flips the class+// exactly when a refactor changes style, so keying identity on the class+// made the word die and respawn instead of travelling. The audience pairs+// tokens by their glyphs; the key buckets call/identifier together and+// rendering still colours by the true class.+{+ const states = new HeckelDiff(codeDoc(['render(deck)\nship()', 'queue(render)\nship()'])).computeDiffs('g')+ const t0 = toksOf(states.get(0)), t1 = toksOf(states.get(1))+ const a = t0.find((t: any) => t.content === 'render')+ const b = t1.find((t: any) => t.content === 'render')+ check('call -> plain reference keeps identity', !!a && !!b && a.morphId() === b.morphId())+}+console.log(FAILS.length ? `\n${FAILS.length} FAILED` : '\nall passed')process.exit(FAILS.length ? 1 : 0)diff --git a/slides/probe/README.md b/slides/probe/README.mdnew file mode 100644index 00000000..02ac7884--- /dev/null+++ b/slides/probe/README.md@@ -0,0 +1,23 @@+# slides/probe++Manual browser rigs. Not run by CI — these exist for defects that only a+human eye, on a specific engine and platform, can judge.++## radical-join.html++The square root's hook not meeting its overbar. Open it directly (no server+needed) on each platform you care about.++One row per candidate font, each applying the fix in its real shape — the+font on `msqrt` only, contents put back to `math`. Every row reports whether+that font ACTUALLY resolved, by measuring `√` against a font name that cannot+exist: a named font that silently fell back is not a test of that font, and+believing otherwise cost this investigation nine "all fine" test matrices.++Judge the point where the diagonal meets the bar. Check 150% and 200% zoom+too — the mismatch is sub-pixel, so zoom can change the verdict.++Known results (2026-08-28): macOS/Chrome picks STIX Two Math and breaks;+Windows/Chrome picks Cambria Math and breaks the same way; forcing serif is+clean on macOS and still broken (smaller) on Windows as Times New Roman.+Background in docs/DECISIONS.md, 2026-08-25.diff --git a/slides/probe/radical-join.html b/slides/probe/radical-join.htmlnew file mode 100644index 00000000..c2653d13--- /dev/null+++ b/slides/probe/radical-join.html@@ -0,0 +1,133 @@+<!doctype html><html><head><meta charset="utf-8">+<title>Bento — radical join test (run me on Windows)</title>+<style>+ body{background:#fff;color:#111;margin:0;padding:24px 28px 60px;+ font-family:system-ui,'Segoe UI',sans-serif}+ h1{font-size:16px;margin:0 0 6px}+ .intro{font-size:13px;color:#444;max-width:80ch;line-height:1.55;margin:0 0 4px}+ .intro b{color:#000}+ #env{font-size:12px;font-family:ui-monospace,Consolas,monospace;color:#555;+ background:#F4F6F8;border:1px solid #DDE3EA;border-radius:6px;+ padding:8px 10px;margin:14px 0 20px;white-space:pre-wrap}+ .row{border-top:1px solid #E4E9EF;padding:14px 0;display:flex;align-items:center;gap:18px}+ .meta{width:250px;flex:none;text-align:right;line-height:1.4}+ .name{font-size:12px;font-weight:700;font-family:ui-monospace,Consolas,monospace}+ .got{font-size:11px;margin-top:3px}+ .yes{color:#1B7F4B}.no{color:#B3261E}.gen{color:#8A6D00}+ .art{flex:1;min-width:0}+ math{font-size:74px;line-height:1.5}+ textarea{width:100%;box-sizing:border-box;height:150px;margin-top:10px;+ font-family:ui-monospace,Consolas,monospace;font-size:12px;padding:10px;+ border:1px solid #C9D2DC;border-radius:6px}+ .foot{border-top:2px solid #111;margin-top:26px;padding-top:16px}+ kbd{background:#EEF1F5;border:1px solid #CCD4DE;border-radius:4px;padding:1px 5px;font-size:11px}+</style></head><body>++<h1>Radical join test — which font joins the bar cleanly?</h1>+<p class="intro">Each row applies one font to <code>msqrt</code> only (contents stay in the+maths font), which is the exact shape of the fix. <b>Look at the point where the diagonal of the+√ meets the horizontal bar.</b> A good row has one unbroken stroke; a bad row has a step, a gap,+or a doubled edge there. Row 1 is the control — it's what Bento ships today.</p>+<p class="intro">Please also try it at <kbd>Ctrl</kbd>+<kbd>+</kbd> zoom 150% and 200%: this+defect is a sub-pixel rounding mismatch, so zoom can change the verdict, and that matters.</p>+<p class="intro"><b>Ignore any row marked “font missing”</b> — it silently fell back and tells+us nothing.</p>++<div id="env"></div>+<div id="rows"></div>++<div class="foot">+ <b style="font-size:13px">Paste this back:</b>+ <p class="intro">Type the row numbers that join cleanly, then copy the whole box.</p>+ <textarea id="report"></textarea>+</div>++<script>+const CANDIDATES = [+ ['math', 'CONTROL — what ships today'],+ ['serif', 'generic serif'],+ ['"Times New Roman", serif', 'Windows default serif'],+ ['Georgia, serif', ''],+ ['"Palatino Linotype", serif', 'Windows'],+ ['Cambria, serif', 'the TEXT face, not Cambria Math'],+ ['"Cambria Math"', 'Windows maths font'],+ ['"STIX Two Math"', 'what macOS picks for generic math'],+ ['"Latin Modern Math"', 'usually absent unless TeX installed'],+ ['"DejaVu Serif"', 'usually Linux'],+ ['"Segoe UI Symbol"', 'Windows'],+ ['sans-serif', 'generic sans'],+ ['Arial', ''],+ ['Consolas, monospace', '']+];++// Does the font actually supply a radical glyph? Compare the width of U+221A+// against a font name that cannot exist. Identical width == it fell back.+// (document.fonts.check() reports true for fonts that are not installed.)+function radicalResolves(stack){+ const mk = (ff) => {+ const s = document.createElement('span');+ s.textContent = '√';+ s.style.cssText = 'position:absolute;left:-9999px;top:0;font-size:200px;'+ + 'white-space:pre;font-family:' + ff;+ document.body.appendChild(s);+ const w = s.getBoundingClientRect().width; s.remove(); return w;+ };+ const bogus = mk('NoSuchFontXYZ123');+ return Math.abs(mk(stack) - bogus) > 0.5;+}+const isGeneric = (s) => /^(serif|sans-serif|monospace|math|system-ui)$/.test(s.trim());++const FORMULA = `<math display="block"><mrow>+ <mi>x</mi><mo>=</mo>+ <mfrac>+ <mrow><mo>−</mo><mi>b</mi><mo>±</mo>+ <msqrt><mrow><msup><mi>b</mi><mn>2</mn></msup>+ <mo>−</mo><mn>4</mn><mi>a</mi><mi>c</mi></mrow></msqrt>+ </mrow>+ <mrow><mn>2</mn><mi>a</mi></mrow>+ </mfrac>+</mrow></math>`;++const host = document.getElementById('rows');+const css = document.createElement('style');+let sheet = '', lines = [];++CANDIDATES.forEach(([stack, note], i) => {+ const n = i + 1, cls = 'rad' + n;+ // the fix, exactly as it would ship: font on msqrt, contents back to math+ sheet += `.${cls} msqrt{font-family:${stack}}+ .${cls} msqrt *{font-family:math}\n`;++ let state, cl;+ if (isGeneric(stack)) { state = 'generic family'; cl = 'gen'; }+ else if (radicalResolves(stack)) { state = 'font present ✓'; cl = 'yes'; }+ else { state = 'font missing ✗ (ignore row)'; cl = 'no'; }++ const row = document.createElement('div');+ row.className = 'row';+ row.innerHTML = `<div class="meta">+ <div class="name">${n}. ${stack.replace(/"/g,'')}</div>+ <div class="got ${cl}">${state}${note ? ' · ' + note : ''}</div>+ </div><div class="art ${cls}">${FORMULA}</div>`;+ host.appendChild(row);+ lines.push(`${String(n).padStart(2)}. ${state.padEnd(26)} ${stack}`);+});+css.textContent = sheet;+document.head.appendChild(css);++function env(){+ return 'platform : ' + navigator.platform+ + '\nUA : ' + navigator.userAgent+ + '\nDPR : ' + window.devicePixelRatio+ + '\nviewport : ' + window.innerWidth + 'x' + window.innerHeight;+}+document.getElementById('env').textContent = env();+document.getElementById('report').value =+ 'RADICAL JOIN TEST\n' + env()+ + '\n\nrows that JOIN CLEANLY (100% zoom): \nrows that JOIN CLEANLY (200% zoom): \nnotes: \n\n'+ + lines.join('\n');+addEventListener('resize', () => {+ document.getElementById('env').textContent = env();+});+</script>+</body></html>diff --git a/slides/src/code.ts b/slides/src/code.tsindex 2129b176..b064d2eb 100644--- a/slides/src/code.ts+++ b/slides/src/code.ts@@ -72,7 +72,13 @@ function diffFor(doc: BentoDoc, morphKey: string) {*/export function renderCodeInto(pre: HTMLElement, el: CodeElement, doc: BentoDoc): boolean {const morphKey = el.morphId ?? el.id- const slideIdx = doc.slides.findIndex((s) => s.elements.some((e) => e.id === el.id))+ // REFERENCE equality, not id: the duplicate-a-slide idiom gives every twin+ // the SAME element id across slides (that is the default morph pairing), so+ // an id lookup finds the first twin and every later slide would render the+ // first slide's tokens — same text, zero travel. The element handed to the+ // renderer is the model object itself, so identity is exact. (The original+ // implementation got this right; a rewrite briefly did not.)+ const slideIdx = doc.slides.findIndex((s) => (s.elements as unknown[]).includes(el))if (slideIdx < 0) return falseconst states = diffFor(doc, morphKey)const slideStates = states.get(slideIdx)diff --git a/slides/src/diff.ts b/slides/src/diff.tsindex 9475b49b..b04ac622 100644--- a/slides/src/diff.ts+++ b/slides/src/diff.ts@@ -47,9 +47,17 @@ export class Token {}key(): string {+ // Calls and plain identifiers share an identity bucket. The tokenizer+ // classes a word by its role — `render(` is a call, `.then(render)` a+ // plain reference — so the SAME word flips class exactly when a refactor+ // changes style (callback -> point-free -> await). Keying on the class+ // made such a word die and respawn instead of travelling; the audience+ // pairs tokens by their glyphs, not their colour, so identity does too.+ // Rendering still uses the true class — a paired token recolours at rest.+ const buckets = this.scopes.map((sc) => (sc === 'f' ? 'x' : sc))const json = {content: this.content,- scopes: this.scopes,+ scopes: buckets,depth: this.depth()}return JSON.stringify(json)diff --git a/slides/src/present.ts b/slides/src/present.tsindex e0812e41..6fc91d19 100644--- a/slides/src/present.ts+++ b/slides/src/present.ts@@ -951,6 +951,7 @@ export function startPresentation(// a tween killed during its delay would otherwise leave the element// stuck at its "from" state (invisible) for every future visit.anim.killTweensOf(from.querySelectorAll('.bento-el'))+ sweepSymbolSpans(from)const fromSlide = doc.slides[fromIdx]for (const el of fromSlide?.elements ?? []) {const node = from.querySelector<HTMLElement>(`[data-el-id="${CSS.escape(el.id)}"]`)@@ -963,6 +964,9 @@ export function startPresentation(applyRevealSet(from, null, fromSlide.hover.default)}}+ // The incoming section may still carry span state from a PREVIOUS visit+ // (Reveal keeps sections mounted) — start clean before any fx runs.+ sweepSymbolSpans(to)const forward = toIdx > fromIdx// Morph forward into a morph slide, and un-morph when backing out of one.const morphing =@@ -1453,7 +1457,38 @@ function modelByMorphKey(doc: BentoDoc, index: number): Map<string, SlideElement* source for where a symbol WAS is a measurement taken while it was visible.* Captured on slide entry; read on slide exit.*/+/**+ * Clear runtime inline state from a section's morph symbols. Token and formula+ * spans carry state no model frame can restore — the symbol morph's transform,+ * the fresh-token fade's opacity — because applyElementFrame knows elements,+ * not spans, and the settle guarantee filters to elements with model entries.+ * An interrupted visit (fast advance, hidden tab, starved render loop) leaves+ * opacity:0 written inline on spans of a section Reveal keeps MOUNTED, and the+ * next visit shows code with holes: seen as "confetti() disappeared and came+ * back after the animations", and reproduced exactly by driving a hidden tab.+ * Swept on every exit and every entry; the entering morph recreates what it+ * actually needs.+ */+function sweepSymbolSpans(section: HTMLElement) {+ for (const sym of Array.from(section.querySelectorAll<HTMLElement>('[data-sym],[data-msx]'))) {+ anim.killTweensOf(sym)+ sym.style.opacity = ''+ sym.style.transform = ''+ sym.style.willChange = ''+ // Colour is cleared ONLY where the scaffolding fade pinned it. Code tokens+ // carry their syntax colour as an inline style straight from the renderer,+ // so clearing colour unconditionally here stripped every highlight in the+ // deck the first time a slide was swept.+ if (sym.dataset.inkpin !== undefined) {+ sym.style.color = ''+ delete sym.dataset.inkpin+ }+ }+}+const symCache = new Map<string, Map<string, { x: number; y: number }>>()+/** Scaffolding geometry (fraction bars, radicals) per slide, by host. */+const structCache = new Map<string, Map<string, { x: number; y: number; w: number; h: number }>>()const symKey = (idx: number, flipId: string) => `${idx}${flipId}`/** Measure and cache every formula on a slide that is currently displayed. */@@ -1467,9 +1502,33 @@ function cacheSlideSymbols(doc: BentoDoc, section: HTMLElement, idx: number) {if (!model) continueconst offsets = symbolOffsets(host, model.w, model.h)if (offsets.size) symCache.set(symKey(idx, host.dataset.flipId!), offsets)+ structCache.set(symKey(idx, host.dataset.flipId!), structGeometry(host, model.w, model.h))}}+/**+ * Where a formula's scaffolding sits and how big it is, in model units. Size+ * matters as much as position: a fraction bar is as wide as its widest side,+ * so an equation that keeps its outer fraction across a step can still have+ * that bar change length completely — 14px to 79px across the derivation's+ * last beat, snapping in one frame while every symbol around it travelled.+ */+function structGeometry(host: HTMLElement, modelW: number, modelH: number) {+ const out = new Map<string, { x: number; y: number; w: number; h: number }>()+ const box = host.getBoundingClientRect()+ if (!box.width || !box.height) return out+ const sx = box.width / Math.max(modelW, 0.01)+ const sy = box.height / Math.max(modelH, 0.01)+ for (const node of Array.from(host.querySelectorAll<HTMLElement>('[data-msx]'))) {+ const r = node.getBoundingClientRect()+ out.set(node.dataset.msx!, {+ x: (r.left - box.left) / sx, y: (r.top - box.top) / sy,+ w: r.width / sx, h: r.height / sy,+ })+ }+ return out+}+function symbolOffsets(host: HTMLElement, modelW: number, modelH: number): Map<string, { x: number; y: number }> {const out = new Map<string, { x: number; y: number }>()const box = host.getBoundingClientRect()@@ -1502,6 +1561,7 @@ function symbolOffsets(host: HTMLElement, modelW: number, modelH: number): Map<s*/function morphMathSymbols(fromAt: Map<string, { x: number; y: number }> | undefined,+ fromStruct: Map<string, { x: number; y: number; w: number; h: number }> | undefined,to: HTMLElement,a: SlideElement,b: SlideElement,@@ -1527,6 +1587,75 @@ function morphMathSymbols(})})+ // Scaffolding that is new this step arrives on the SAME beat as the fresh+ // tokens — but via `color`, never `opacity`.+ //+ // A fraction bar and a radical are painted by their box in currentColor, and+ // opacity groups a whole subtree: fading the box would take the terms+ // travelling into it along too, hiding them for the first 40% of their+ // journey and popping them into view mid-flight. Animating colour touches+ // only what the box itself paints — verified by pinning the leaves and+ // setting the box transparent, which leaves every symbol legible and in+ // place with the bars gone. Pinning is what makes it work: leaves inherit+ // colour, so they must carry their own before the box's is animated.+ const toStruct = structGeometry(to, b.w, b.h)+ // TWO passes, and the order is load-bearing. Scaffolding nests — a radical+ // inside a fraction — and anim renders a fromTo's from-state at creation, so+ // starting the outer box's fade first leaves the inner one inheriting a+ // transparent colour at the moment its own ink is read. It then animates+ // towards transparent and only becomes visible when the tween clears, which+ // is the pop this is meant to remove, one level down. Read every ink first,+ // against untouched colours, then start the tweens.+ const fades: Array<{ box: HTMLElement; ink: string; leaves: HTMLElement[] }> = []+ for (const box of Array.from(to.querySelectorAll<HTMLElement>('[data-msx]'))) {+ // New scaffolding fades in — and so does scaffolding that SURVIVES but+ // changes shape, because it cannot travel: transforming a container would+ // drag its children off their own paths. A bar that merely resizes would+ // otherwise snap in a single frame while everything inside it glided.+ // Absent, or so different it is plainly not the same bar. The key is+ // positional (tag#occurrence), not semantic, so it can claim an identity+ // that does not exist: across the derivation's last beat mfrac#0 is+ // `b OVER 2a` on one side and `-b±√(b²-4ac) OVER 2a` on the other. Those+ // are two different bars, and stretching one into the other would animate+ // a fiction. Judge by how much changed instead, generously enough that a+ // bar which genuinely persists and merely shifts a pixel or two is left+ // alone rather than blinking for no reason.+ const was = fromStruct?.get(box.dataset.msx!)+ const now = toStruct.get(box.dataset.msx!)+ const resized = (x: number, y: number) => Math.abs(x - y) > Math.max(x, y, 1) * 0.15+ const changed = !was || !now+ || Math.abs(was.x - now.x) > 6 || Math.abs(was.y - now.y) > 6+ || resized(was.w, now.w) || resized(was.h, now.h)+ if (!changed) continue+ // Read the ink from the BOX, not the flip host: the host is the element+ // wrapper and computes to its own colour (black here), while the box+ // inherits the formula's. Fading from the wrong one made the bar arrive+ // as black and snap to white on completion — invisible for the whole fade+ // on a dark slide, which looks exactly like the pop this replaces.+ fades.push({+ box,+ ink: getComputedStyle(box).color,+ leaves: Array.from(box.querySelectorAll<HTMLElement>('[data-sym]')),+ })+ }+ for (const { box, ink, leaves } of fades) {+ const inkClear = ink.startsWith('rgb(')+ ? ink.replace('rgb(', 'rgba(').replace(')', ', 0)')+ : 'rgba(0, 0, 0, 0)'+ // Marked, so the slide sweep knows which colours are ours to undo.+ for (const leaf of leaves) { leaf.style.color = ink; leaf.dataset.inkpin = '' }+ anim.fromTo(box, { color: inkClear }, {+ color: ink,+ duration: 0.3,+ delay: MORPH_DURATION * 0.4,+ ease: 'power2.out',+ onComplete() {+ box.style.color = ''+ for (const leaf of leaves) { leaf.style.color = ''; delete leaf.dataset.inkpin }+ },+ })+ }+const pairs: Array<{ node: HTMLElement; dx: number; dy: number }> = []for (const sym of Array.from(to.querySelectorAll<HTMLElement>('[data-sym]'))) {const src = fromAt.get(sym.dataset.sym!)@@ -1636,8 +1765,9 @@ function runMorph(// frames are in the doc), so the outgoing section's Reveal styling is// irrelevant. Each matched node animates from the from-slide's frame to its// own via translate+scale about the top-left corner (scale mode like- // PowerPoint: text scales instead of reflowing mid-morph). Rotating morphs- // pivot slightly differently than center-origin — rare and acceptable.+ // PowerPoint: text scales instead of reflowing mid-morph), while rotation+ // pivots about the element's centre so the finished frame is identical to+ // the one applyElementFrame writes at rest.for (const node of matchedTo) {const id = node.dataset.flipId!const a = fromModel.get(id)@@ -1657,10 +1787,21 @@ function runMorph(const w = a.w + (b.w - a.w) * pconst h = a.h + (b.h - a.h) * pconst r = (a.rotation ?? 0) + ((b.rotation ?? 0) - (a.rotation ?? 0)) * p+ // Rotate about the element's own CENTRE, spelled out around an origin+ // of 0 0 rather than by moving the origin. Position and scale want the+ // top-left (PowerPoint scale mode), but the resting frame that+ // applyElementFrame writes — a plain `rotate()` with the default centre+ // origin — must be exactly what p=1 lands on, or a rotated element+ // snaps the instant the tween completes and the origin flips back.+ // Measured on the choreography scene: 7deg jumped 4.1px across and+ // 5.1px up, -6deg the other way, on the frame the morph finished. The+ // triplet below collapses to identity at p=1, so the two frames agree.+ const cx = b.w / 2+ const cy = b.h / 2node.style.transform =`translate(${x - b.x}px, ${y - b.y}px)` +- (r ? ` rotate(${r}deg)` : '') +- ` scale(${w / Math.max(b.w, 0.01)}, ${h / Math.max(b.h, 0.01)})`+ ` scale(${w / Math.max(b.w, 0.01)}, ${h / Math.max(b.h, 0.01)})` ++ (r ? ` translate(${cx}px, ${cy}px) rotate(${r}deg) translate(${-cx}px, ${-cy}px)` : '')},onComplete() {node.style.transformOrigin = ''@@ -1678,7 +1819,7 @@ function runMorph(const a = fromModel.get(id)const b = toModel.get(id)if (!a || !b) continue- morphMathSymbols(symCache.get(symKey(fromIdx, id)), to, a, b)+ morphMathSymbols(symCache.get(symKey(fromIdx, id)), structCache.get(symKey(fromIdx, id)), to, a, b)}// Styles morph straight from the model — exact values, no DOM sniffing.diff --git a/slides/src/preview.ts b/slides/src/preview.tsindex 7de9562c..a31e603f 100644--- a/slides/src/preview.ts+++ b/slides/src/preview.ts@@ -52,7 +52,7 @@ const BANNED = 'script,style,noscript,iframe,object,embed,link,video,audio,canvaconst DROP_ATTRS = ['data-el-id', 'data-flip-id', 'data-slide-id', 'data-link', 'data-group','data-show-on-hover', 'data-chart', 'data-table', 'data-autoplay',- 'data-r', 'data-c', 'data-sym', 'data-tok', 'contenteditable', 'draggable', 'tabindex',+ 'data-r', 'data-c', 'data-sym', 'data-msx', 'data-tok', 'data-inkpin', 'contenteditable', 'draggable', 'tabindex',]/**diff --git a/slides/src/render.ts b/slides/src/render.tsindex 10f2af20..8759efc5 100644--- a/slides/src/render.ts+++ b/slides/src/render.ts@@ -431,6 +431,22 @@ function tagSymbols(mathml: string): string {seen.set(txt, n + 1); (leaf as HTMLElement).dataset.sym = `${txt}#${n}`}+ // Scaffolding gets its own key, on a SEPARATE attribute. A fraction bar and+ // a radical are drawn by the mfrac/msqrt box itself, not by any token, so+ // they carry no data-sym and used to be the one part of a formula that+ // neither travelled nor faded — they were simply there from frame one while+ // everything around them animated. They must never enter the symbol morph:+ // transforming a container would move its children a second time, on top of+ // their own travel. Keyed by tag occurrence so scaffolding that SURVIVES a+ // step (the outer fraction of a rearranged equation) is recognised and left+ // alone, while genuinely new scaffolding can be faded in.+ const struct = new Map<string, number>()+ for (const box of Array.from(tpl.content.querySelectorAll('mfrac, msqrt, mroot, menclose, mover, munder, munderover'))) {+ const tag = box.tagName.toLowerCase()+ const n = struct.get(tag) ?? 0+ struct.set(tag, n + 1)+ ; (box as HTMLElement).dataset.msx = `${tag}#${n}`+ }return tpl.innerHTML}@@ -1159,6 +1175,13 @@ export function renderElement(el: SlideElement, doc: BentoDoc, opts: RenderOptsnode.style.display = 'flex'node.style.flexDirection = 'column'node.style.justifyContent = VALIGN[el.valign]+ // Clip at the ELEMENT box — the size the author chose — and never at the+ // <pre> (see below). Code sets `white-space: pre`, so a long line does+ // not wrap and would otherwise run across the slide over whatever sits+ // beside it; bounding it to its own box keeps the author's layout+ // contract. The box is normally far larger than the lines inside it,+ // which is exactly the room a morphing token needs.+ node.style.overflow = 'hidden'const inner = document.createElement('pre')inner.className = 'bento-text-inner'inner.dir = 'auto'@@ -1171,7 +1194,16 @@ export function renderElement(el: SlideElement, doc: BentoDoc, opts: RenderOptsinner.classList.add('bento-code')inner.style.whiteSpace = 'pre'inner.style.margin = '0'- inner.style.overflow = 'hidden'+ // NOT overflow:hidden here. A <pre> is only as tall as its own lines,+ // and a morphing token starts at its position on the OTHER slide —+ // outside those bounds whenever the block gets shorter. Clipping at this+ // level painted a travelling token 48px below the box and cut it away:+ // it vanished for the first half of its journey and popped into view+ // mid-flight, and only in the direction where the code got shorter,+ // since the taller side had room for the same motion. That asymmetry is+ // what made it read as a pairing bug rather than a painting one.+ // Found in a screenshot — the DOM reported opacity 1, a correct 80px+ // transform and a sensible rect, all true, all outside a clipping box.if (!renderCodeInto(inner, el, doc)) {// Fallback to unformatted textinner.innerText = el.contentdiff --git a/slides/src/starterdeck.ts b/slides/src/starterdeck.tsindex f9d16b0d..daab6461 100644--- a/slides/src/starterdeck.ts+++ b/slides/src/starterdeck.ts@@ -17,7 +17,7 @@// Never let system-font defaults show: every text sets a face on purpose.import {- newDoc, uid, defaultText, defaultShape, defaultChart, defaultTable,+ newDoc, uid, defaultText, defaultShape, defaultChart, defaultTable, defaultCode,type BentoDoc, type Slide, type SlideElement, type TextElement, type ShapeElement,type SvgElement, type TableElement,} from './model'@@ -57,6 +57,7 @@ const T_C = 'sd-tile-c' // paper/whiteconst T_D = 'sd-tile-d' // ink panel / card/** The formula that rearranges across the morph beat — one id, two slides. */const EQ = 'sd-eq'+const CODE_ID = 'sd-code'const TITLE = 'sd-title'const KICKER = 'sd-kicker'const GLOW = 'sd-glow'@@ -478,7 +479,50 @@ export function starterDoc(): BentoDoc {],}),- // ── 3 · MORPH MANIFESTO ────────────────────────────────────────────────+ // ── 3 · NO MOVING PARTS (staggers + count-ups, arriving by morph) ─────+ // This was a 'fade' because entrance fx and count-ups once needed a+ // non-morph arrival. Both have worked on morph arrivals since #197 —+ // runMorph gives every unpartnered element its fx.enter, and+ // runMorphArrivalCountUps counts up anything not carried from the previous+ // slide — so the fade only cost the deck its best tile moment: the four+ // scattered tiles collapsing into the row of chips at the top-left.+ slide({+ background: PEACH,+ notes:+ 'The four tiles just collapsed into that row of chips — same four shapes, all deck long. ' ++ 'The numbers counted up as the slide entered; ' ++ 'that’s one checkbox on any text element. The little lines show line endings: arrow, dot, bar.',+ elements: [+ shape('rect', { id: T_D, x: 96, y: 54, w: 34, h: 34, radius: 9, fill: INK }),+ shape('rect', { id: T_B, x: 140, y: 54, w: 34, h: 34, radius: 9, fill: STEEL }),+ shape('rect', { id: T_A, x: 184, y: 54, w: 34, h: 34, radius: 9, fill: PEACH_SOFT }),+ shape('rect', { id: T_C, x: 228, y: 54, w: 34, h: 34, radius: 9, fill: PAPER }),+ text({+ x: 1024, y: 54, w: 160, h: 26, html: '{{page:2}}', align: 'right',+ fontSize: 13, fontWeight: 700, letterSpacing: 2, color: 'rgba(15,23,36,0.45)',+ }),+ shape('rect', { x: 96, y: 108, w: 1088, h: 1.5, radius: 0, fill: 'rgba(15,23,36,0.18)' }),+ // No fx on these two: the kicker and title carry the SAME ids as the+ // slide before, so they morph across and are already in motion. An+ // fx.enter here would be silently skipped — the entrance only runs for+ // elements with no partner on the previous slide.+ kicker('NO MOVING PARTS', { y: 132, color: INK }),+ title('Software with nothing<br>to install, break, or expire.', {+ y: 170, w: 1060, h: 150, color: INK, fontSize: 50,+ }),+ text({ x: 96, y: 356, w: 352, h: 180, html: '1', fontSize: 150, fontWeight: 900, fontFamily: DISPLAY, color: INK, fx: { enter: 'fade-up', order: 2, countUp: true } }),+ text({ x: 464, y: 356, w: 352, h: 180, html: '0', fontSize: 150, fontWeight: 900, fontFamily: DISPLAY, color: INK, fx: { enter: 'fade-up', order: 3, countUp: true } }),+ text({ x: 832, y: 356, w: 352, h: 180, html: '100%', fontSize: 130, fontWeight: 900, fontFamily: DISPLAY, color: INK, fx: { enter: 'fade-up', order: 4, countUp: true } }),+ shape('line', { x: 100, y: 542, w: 150, h: 8, fill: INK, strokeWidth: 3, lineEnd: 'arrow', fx: { enter: 'fade', order: 5 } }),+ shape('line', { x: 468, y: 542, w: 150, h: 8, fill: INK, strokeWidth: 3, lineStart: 'dot', lineEnd: 'dot', fx: { enter: 'fade', order: 5 } }),+ shape('line', { x: 836, y: 542, w: 150, h: 8, fill: INK, strokeWidth: 3, lineStart: 'bar', lineEnd: 'bar', fx: { enter: 'fade', order: 5 } }),+ text({ x: 96, y: 570, w: 352, h: 30, html: 'FILE TO SEND', fontSize: 14, fontWeight: 700, letterSpacing: 2, color: INK_SOFT, fx: { enter: 'fade', order: 6 } }),+ text({ x: 464, y: 570, w: 352, h: 30, html: 'SERVERS REQUIRED', fontSize: 14, fontWeight: 700, letterSpacing: 2, color: INK_SOFT, fx: { enter: 'fade', order: 6 } }),+ text({ x: 832, y: 570, w: 352, h: 30, html: 'YOURS, FOREVER', fontSize: 14, fontWeight: 700, letterSpacing: 2, color: INK_SOFT, fx: { enter: 'fade', order: 6 } }),+ ],+ }),++ // ── 4 · MORPH MANIFESTO ────────────────────────────────────────────────slide({notes:'The tiles scattered and grew — and picked up GRADIENT fills mid-morph (solid⇄gradient tweening). ' +@@ -515,102 +559,204 @@ export function starterDoc(): BentoDoc {html: 'Shared ids animate between slides — position, size, color, <b>even gradients</b>.<br>Press ← then → to replay it.',fontSize: 19, fontWeight: 500, color: MIST, align: 'center', lineHeight: 1.65,}),- // Sits quietly here and becomes the point of the next slide: same id,- // so its SYMBOLS morph across rather than the formula crossfading.+ ],+ }),++ // ── 5 · SYMBOL MORPH, SIDE BY SIDE (maths and code, one mechanism) ────+ // The deck's sub-element morph, shown on BOTH content types at once: a+ // quadratic derivation on the left, three eras of JavaScript on the right.+ // Same engine underneath (tokens carry identities across slides and travel+ // to their new positions), two very different surfaces on top — which is+ // the claim this pair of columns is here to make.+ //+ // The maths is the classic three-step derivation, so the beats line up+ // with the code's callbacks -> promises (ES2015) -> async/await (ES2017):+ // a, b and c survive all three on the left while load, render, present and+ // confetti survive all three on the right. Both probed before authoring.+ slide({+ transition: 'morph',+ notes:+ 'Two token streams, one mechanism. Both sides of this slide morph symbol by symbol: the maths is plain \u0024\u2026\u0024 in an ordinary text box, the code is a code element with 77 languages built in (about 7KB of rules, no highlighter library). Press \u2192 and watch BOTH at once \u2014 a, b and c travel through the derivation while the callback pyramid flattens into promises.',+ elements: [+ grain(),+ glow(20, [+ { at: 0, color: 'rgba(62,86,120,0.24)' },+ { at: 0.55, color: 'rgba(15,23,36,0)' },+ { at: 1, color: 'rgba(255,158,138,0.16)' },+ ]),+ shape('rect', {+ id: T_A, x: -130, y: 470, w: 300, h: 300, radius: 92, fill: PEACH,+ fillGradient: { angle: 45, stops: [{ at: 0, color: PEACH }, { at: 1, color: PEACH_SOFT }] },+ }),+ shape('rect', {+ id: T_B, x: 1060, y: -150, w: 340, h: 340, radius: 100, fill: STEEL,+ fillGradient: { angle: 200, stops: [{ at: 0, color: '#41597A' }, { at: 1, color: STEEL_SOFT }] },+ }),+ shape('rect', {+ id: T_C, x: 1080, y: 520, w: 260, h: 260, radius: 78, fill: TILE_PAPER, opacity: 0.85,+ fillGradient: { angle: 30, stops: [{ at: 0, color: '#FFFFFF' }, { at: 1, color: '#D8D3C6' }] },+ }),+ shape('rect', {+ id: T_D, x: -80, y: -120, w: 240, h: 240, radius: 68, fill: 'transparent',+ stroke: 'rgba(185,196,212,0.4)', strokeWidth: 2, strokeStyle: 'dashed',+ }),+ kicker('ONE MECHANISM, TWO LANGUAGES', { x: 340, y: 128, w: 600, h: 26, align: 'center' }),+ // Column labels — small, so the two halves read as a comparison.+ text({+ x: 96, y: 186, w: 480, h: 24, html: 'MATHS \u2014 plain <b>\\$\u2026\\$</b> in a text box',+ fontSize: 13, fontWeight: 700, letterSpacing: 1.5, color: 'rgba(185,196,212,0.62)',+ align: 'left', valign: 'middle',+ }),text({- id: EQ, x: 340, y: 600, w: 600, h: 60, html: '$ax^2 + bx + c = 0$',- fontSize: 30, color: 'rgba(185,196,212,0.75)', align: 'center', valign: 'middle',+ x: 640, y: 186, w: 544, h: 24, html: 'CODE \u2014 <b>77 languages</b> built in',+ fontSize: 13, fontWeight: 700, letterSpacing: 1.5, color: 'rgba(185,196,212,0.62)',+ align: 'left', valign: 'middle',+ }),+ // LEFT: the derivation. Display mode so fractions and the radical set+ // at full size; a, b and c travel between the three beats.+ text({+ id: EQ, x: 96, y: 226, w: 480, h: 280,+ html: '$$ax^2 + bx + c = 0$$',+ fontSize: 30, color: '#FFFFFF', align: 'center', valign: 'middle',+ }),+ // RIGHT: the same trick on code, running at the same time.+ {+ ...defaultCode({ id: CODE_ID, x: 640, y: 226, w: 544, h: 280 }),+ content: "load(deck, (slides) => {\n render(slides, (frame) => {\n present(frame)\n })\n})\nconfetti()",+ grammarName: 'js', fontSize: 19, lineHeight: 1.62, color: '#DCE3EC',+ align: 'left', valign: 'middle',+ },+ text({+ x: 190, y: 560, w: 900, h: 60,+ html: 'A derivation on the left, two revisions of JavaScript on the right. Press <b>→</b> twice.',+ fontSize: 19, fontWeight: 500, color: MIST, align: 'center', lineHeight: 1.65,}),],}),- // ── 3b · SYMBOL MORPH (the formula rearranges, term by term) ───────────slide({transition: 'morph',notes:- 'The quadratic on the last slide did not crossfade into this one — a, b and c TRAVELLED, ' +- 'out of ax² + bx + c = 0 and into the fraction, the radical and the discriminant. Tokens ' +- 'pair by what they are and which occurrence they are, so a term that moves is seen to move. ' +- 'Everything here is one ordinary text box: type the LaTeX between dollar signs (two for a ' +- 'display equation like this one) and the document stores exactly that — not a picture, not ' +- 'a font, no library fetched at runtime. Backslash-escape a dollar to show one literally, ' +- 'as the caption does.',+ 'Left: completing the square \u2014 a, b and c did not crossfade, they moved into their new places. Right: the pyramid flattened and confetti() rose two lines to meet it. Point-free promises really did drop the parameter names, so slides and frame fading out is the diff being honest. One more \u2192.',elements: [grain(),- glow(20, [- { at: 0, color: 'rgba(255,158,138,0.20)' },- { at: 0.6, color: 'rgba(15,23,36,0)' },- { at: 1, color: 'rgba(62,86,120,0.24)' },+ glow(200, [+ { at: 0, color: 'rgba(62,86,120,0.24)' },+ { at: 0.55, color: 'rgba(15,23,36,0)' },+ { at: 1, color: 'rgba(255,158,138,0.16)' },]),shape('rect', {- id: T_A, x: 1000, y: 420, w: 300, h: 300, radius: 90, fill: PEACH,- fillGradient: { angle: 135, stops: [{ at: 0, color: PEACH }, { at: 1, color: PEACH_SOFT }] },+ id: T_A, x: -100, y: 500, w: 270, h: 270, radius: 84, fill: PEACH,+ fillGradient: { angle: 45, stops: [{ at: 0, color: PEACH }, { at: 1, color: PEACH_SOFT }] },}),shape('rect', {- id: T_B, x: -120, y: -110, w: 380, h: 380, radius: 100, fill: STEEL,- fillGradient: { angle: 225, stops: [{ at: 0, color: '#41597A' }, { at: 1, color: STEEL_SOFT }] },+ id: T_B, x: 1084, y: -128, w: 310, h: 310, radius: 92, fill: STEEL,+ fillGradient: { angle: 200, stops: [{ at: 0, color: '#41597A' }, { at: 1, color: STEEL_SOFT }] },}),shape('rect', {- id: T_C, x: -80, y: 470, w: 300, h: 300, radius: 84, fill: TILE_PAPER, opacity: 0.85,- fillGradient: { angle: 315, stops: [{ at: 0, color: '#FFFFFF' }, { at: 1, color: '#D8D3C6' }] },+ id: T_C, x: 1054, y: 500, w: 286, h: 286, radius: 84, fill: TILE_PAPER, opacity: 0.85,+ fillGradient: { angle: 30, stops: [{ at: 0, color: '#FFFFFF' }, { at: 1, color: '#D8D3C6' }] },}),shape('rect', {- id: T_D, x: 1030, y: -90, w: 250, h: 250, radius: 70, fill: 'transparent',+ id: T_D, x: -90, y: -134, w: 260, h: 260, radius: 74, fill: 'transparent',stroke: 'rgba(185,196,212,0.4)', strokeWidth: 2, strokeStyle: 'dashed',}),- kicker('EVEN INSIDE A FORMULA', { x: 340, y: 176, w: 600, h: 26, align: 'center' }),- // Display mode ($$) so the fraction, radical and ± set at full size.- // a, b and c fly out of the quadratic and into their places here.+ kicker('EVERY TERM KEEPS ITS PLACE', { x: 340, y: 128, w: 600, h: 26, align: 'center' }),+ // Column labels — small, so the two halves read as a comparison.text({- id: EQ, x: 190, y: 240, w: 900, h: 230,- html: '$$x = \\frac{-b \\pm \\sqrt{b^2 - 4ac}}{2a}$$',- fontSize: 62, color: '#FFFFFF', align: 'center', valign: 'middle',+ x: 96, y: 186, w: 480, h: 24, html: 'MATHS \u2014 plain <b>\\$\u2026\\$</b> in a text box',+ fontSize: 13, fontWeight: 700, letterSpacing: 1.5, color: 'rgba(185,196,212,0.62)',+ align: 'left', valign: 'middle',+ }),+ text({+ x: 640, y: 186, w: 544, h: 24, html: 'CODE \u2014 <b>77 languages</b> built in',+ fontSize: 13, fontWeight: 700, letterSpacing: 1.5, color: 'rgba(185,196,212,0.62)',+ align: 'left', valign: 'middle',}),+ // LEFT: the derivation. Display mode so fractions and the radical set+ // at full size; a, b and c travel between the three beats.+ text({+ id: EQ, x: 96, y: 226, w: 480, h: 280,+ html: '$$\\left(x + \\frac{b}{2a}\\right)^2 = \\frac{b^2 - 4ac}{4a^2}$$',+ fontSize: 30, color: '#FFFFFF', align: 'center', valign: 'middle',+ }),+ // RIGHT: the same trick on code, running at the same time.+ {+ ...defaultCode({ id: CODE_ID, x: 640, y: 226, w: 544, h: 280 }),+ content: "load(deck)\n .then(render)\n .then(present)\nconfetti()",+ grammarName: 'js', fontSize: 19, lineHeight: 1.62, color: '#DCE3EC',+ align: 'left', valign: 'middle',+ },text({- x: 340, y: 500, w: 600, h: 80,- // \$ escapes the delimiter so this line SHOWS "$…$" instead of- // rendering it — the first thing anyone copying this deck will hit.- html: 'Maths is plain <b>\\$…\\$</b> in a text box — the terms morph, not the picture.',+ x: 190, y: 560, w: 900, h: 60,+ html: 'Completing the square, and the pyramid flattening — <b>both travelling at once</b>.',fontSize: 19, fontWeight: 500, color: MIST, align: 'center', lineHeight: 1.65,}),],}),- // ── 4 · STATS BEAT (fade → staggers + count-ups) ───────────────────────slide({- background: PEACH,- transition: 'fade',+ transition: 'morph',notes:- 'A hard cut on purpose — rhythm. The numbers counted up as the slide entered; ' +- 'that’s one checkbox on any text element. The little lines show line endings: arrow, dot, bar.',+ 'async/await on the right, the quadratic formula on the left \u2014 and every symbol that survived the rewrite kept its identity the whole way. This is what a walkthrough is in Bento: duplicate the slide, edit the content, and the transition explains the change for you. No recording, no screenshots.',elements: [- shape('rect', { id: T_D, x: 96, y: 54, w: 34, h: 34, radius: 9, fill: INK }),- shape('rect', { id: T_B, x: 140, y: 54, w: 34, h: 34, radius: 9, fill: STEEL }),- shape('rect', { id: T_A, x: 184, y: 54, w: 34, h: 34, radius: 9, fill: PEACH_SOFT }),- shape('rect', { id: T_C, x: 228, y: 54, w: 34, h: 34, radius: 9, fill: PAPER }),+ grain(),+ glow(20, [+ { at: 0, color: 'rgba(62,86,120,0.24)' },+ { at: 0.55, color: 'rgba(15,23,36,0)' },+ { at: 1, color: 'rgba(255,158,138,0.16)' },+ ]),+ shape('rect', {+ id: T_A, x: -70, y: 520, w: 250, h: 250, radius: 78, fill: PEACH,+ fillGradient: { angle: 45, stops: [{ at: 0, color: PEACH }, { at: 1, color: PEACH_SOFT }] },+ }),+ shape('rect', {+ id: T_B, x: 1100, y: -110, w: 290, h: 290, radius: 88, fill: STEEL,+ fillGradient: { angle: 200, stops: [{ at: 0, color: '#41597A' }, { at: 1, color: STEEL_SOFT }] },+ }),+ shape('rect', {+ id: T_C, x: 1030, y: 480, w: 310, h: 310, radius: 92, fill: TILE_PAPER, opacity: 0.85,+ fillGradient: { angle: 30, stops: [{ at: 0, color: '#FFFFFF' }, { at: 1, color: '#D8D3C6' }] },+ }),+ shape('rect', {+ id: T_D, x: -100, y: -150, w: 280, h: 280, radius: 80, fill: 'transparent',+ stroke: 'rgba(185,196,212,0.4)', strokeWidth: 2, strokeStyle: 'dashed',+ }),+ kicker('NOTHING HERE REDREW', { x: 340, y: 128, w: 600, h: 26, align: 'center' }),+ // Column labels — small, so the two halves read as a comparison.text({- x: 1024, y: 54, w: 160, h: 26, html: '04', align: 'right',- fontSize: 13, fontWeight: 700, letterSpacing: 2, color: 'rgba(15,23,36,0.45)',+ x: 96, y: 186, w: 480, h: 24, html: 'MATHS \u2014 plain <b>\\$\u2026\\$</b> in a text box',+ fontSize: 13, fontWeight: 700, letterSpacing: 1.5, color: 'rgba(185,196,212,0.62)',+ align: 'left', valign: 'middle',}),- shape('rect', { x: 96, y: 108, w: 1088, h: 1.5, radius: 0, fill: 'rgba(15,23,36,0.18)' }),- kicker('NO MOVING PARTS', { y: 132, color: INK, fx: { enter: 'fade-up', order: 0 } }),- title('Software with nothing<br>to install, break, or expire.', {- y: 170, w: 1060, h: 150, color: INK, fontSize: 50,- fx: { enter: 'fade-up', order: 1 },+ text({+ x: 640, y: 186, w: 544, h: 24, html: 'CODE \u2014 <b>77 languages</b> built in',+ fontSize: 13, fontWeight: 700, letterSpacing: 1.5, color: 'rgba(185,196,212,0.62)',+ align: 'left', valign: 'middle',+ }),+ // LEFT: the derivation. Display mode so fractions and the radical set+ // at full size; a, b and c travel between the three beats.+ text({+ id: EQ, x: 96, y: 226, w: 480, h: 280,+ html: '$$x = \\frac{-b \\pm \\sqrt{b^2 - 4ac}}{2a}$$',+ fontSize: 30, color: '#FFFFFF', align: 'center', valign: 'middle',+ }),+ // RIGHT: the same trick on code, running at the same time.+ {+ ...defaultCode({ id: CODE_ID, x: 640, y: 226, w: 544, h: 280 }),+ content: "const slides = await load(deck)\nconst frame = await render(slides)\npresent(frame)\nconfetti()",+ grammarName: 'js', fontSize: 19, lineHeight: 1.62, color: '#DCE3EC',+ align: 'left', valign: 'middle',+ },+ text({+ x: 190, y: 560, w: 900, h: 60,+ html: 'Same <b>a</b>, <b>b</b>, <b>c</b>. Same <b>load</b>, <b>render</b>, <b>present</b>. The diff is the animation.',+ fontSize: 19, fontWeight: 500, color: MIST, align: 'center', lineHeight: 1.65,}),- text({ x: 96, y: 356, w: 352, h: 180, html: '1', fontSize: 150, fontWeight: 900, fontFamily: DISPLAY, color: INK, fx: { enter: 'fade-up', order: 2, countUp: true } }),- text({ x: 464, y: 356, w: 352, h: 180, html: '0', fontSize: 150, fontWeight: 900, fontFamily: DISPLAY, color: INK, fx: { enter: 'fade-up', order: 3, countUp: true } }),- text({ x: 832, y: 356, w: 352, h: 180, html: '100%', fontSize: 130, fontWeight: 900, fontFamily: DISPLAY, color: INK, fx: { enter: 'fade-up', order: 4, countUp: true } }),- shape('line', { x: 100, y: 542, w: 150, h: 8, fill: INK, strokeWidth: 3, lineEnd: 'arrow', fx: { enter: 'fade', order: 5 } }),- shape('line', { x: 468, y: 542, w: 150, h: 8, fill: INK, strokeWidth: 3, lineStart: 'dot', lineEnd: 'dot', fx: { enter: 'fade', order: 5 } }),- shape('line', { x: 836, y: 542, w: 150, h: 8, fill: INK, strokeWidth: 3, lineStart: 'bar', lineEnd: 'bar', fx: { enter: 'fade', order: 5 } }),- text({ x: 96, y: 570, w: 352, h: 30, html: 'FILE TO SEND', fontSize: 14, fontWeight: 700, letterSpacing: 2, color: INK_SOFT, fx: { enter: 'fade', order: 6 } }),- text({ x: 464, y: 570, w: 352, h: 30, html: 'SERVERS REQUIRED', fontSize: 14, fontWeight: 700, letterSpacing: 2, color: INK_SOFT, fx: { enter: 'fade', order: 6 } }),- text({ x: 832, y: 570, w: 352, h: 30, html: 'YOURS, FOREVER', fontSize: 14, fontWeight: 700, letterSpacing: 2, color: INK_SOFT, fx: { enter: 'fade', order: 6 } }),],}),- // ── 5 · CHARTS ALIVE (+ hidden pie state) ──────────────────────────────+ // ── 6 · CHARTS ALIVE (+ hidden pie state) ──────────────────────────────slide({id: S_CHARTS,background: PAPER,@@ -721,7 +867,7 @@ export function starterDoc(): BentoDoc {],}),- // ── 6 · TABLES (real HTML table) ───────────────────────────────────────+ // ── 7 · TABLES (real HTML table) ───────────────────────────────────────slide({background: PAPER,notes:@@ -807,7 +953,7 @@ export function starterDoc(): BentoDoc {],}),- // ── 7 · MOMENTUM (line-chart hero) ─────────────────────────────────────+ // ── 8 · MOMENTUM (line-chart hero) ─────────────────────────────────────slide({notes:'A chart as scenery: full-width live area chart on ink. Drag horizontally inside it to zoom — ' +@@ -834,7 +980,7 @@ export function starterDoc(): BentoDoc {],}),- // ── 8 · MOTION & LINES ─────────────────────────────────────────────────+ // ── 9 · MOTION & LINES ─────────────────────────────────────────────────slide({background: PAPER,notes:@@ -879,7 +1025,7 @@ export function starterDoc(): BentoDoc {}),- // ── 9 · CHOREOGRAPHY (base + two hidden states) ───────────────────────+ // ── 10 · CHOREOGRAPHY (base + two hidden states) ──────────────────────...(() => {type Scene = {id: string; step: string; label: string; chip: string; to: string@@ -969,7 +1115,7 @@ export function starterDoc(): BentoDoc {)})(),- // ── 10 · HOVER FOCUS ────────────────────────────────────────────────────+ // ── 11 · HOVER FOCUS ───────────────────────────────────────────────────slide({hover: { type: 'focus-group', dim: 0.22 },notes:@@ -1019,7 +1165,7 @@ export function starterDoc(): BentoDoc {],}),- // ── 11 · MARKDOWN ───────────────────────────────────────────────────────+ // ── 12 · MARKDOWN ──────────────────────────────────────────────────────slide({background: PAPER,notes:@@ -1052,7 +1198,7 @@ export function starterDoc(): BentoDoc {],}),- // ── 12 · CLOSE ─────────────────────────────────────────────────────────+ // ── 13 · CLOSE ─────────────────────────────────────────────────────────slide({notes:'The cast reassembles into the logo. Press Esc — this deck is already your copy of the app: ' +diff --git a/slides/src/styles.css b/slides/src/styles.cssindex eea98ac9..efe66512 100644--- a/slides/src/styles.css+++ b/slides/src/styles.css@@ -478,6 +478,21 @@ a.ed-btn { text-decoration: none; } /* the update block's "What's new" link is.bento-el { position: absolute; contain: layout style; }+/* Formulas are left on the browser's own `math` family ON PURPOSE — naming a+ maths font here fixes nothing and has been reverted three times. The+ radical's hook falling short of its overbar is Chromium drawing the overbar+ as its own rule and missing the arm the font's glyph paints, by a fraction+ of a pixel. It is not the font: generic `math` picks STIX on macOS and+ Cambria Math on Windows and BOTH break, and forcing Times New Roman only+ makes the break smaller. It is not our markup, our tagging, the stage+ transform, the font size, or the height of the radicand (measured: the+ deck's `b²−4ac` and a flat `b−4ac` get a byte-identical 113.8px radical).++ There IS a mitigation — `msqrt { font-family: serif }` with the contents put+ back to `math` — and it is deliberately NOT shipped: it is clean on macOS+ and still broken on Windows. Read docs/DECISIONS.md, 2026-08-25, before+ touching this; the rig is slides/probe/radical-join.html. */+.bento-el-text,.bento-el-code.bento-text-inner {