Bento, the office suite that fits in a file
TypeScript mit-licenseofficeoffice-365office-suiteoffice-toolsoffice365open-sourcepowerpointself-hostedsingle-page-appslidesslideshareslideshowslideshow-galleryslideshow-makerslideshows
Hide a slide from the show, without taking it out of the deck (#267)
nyblnet437c8811311a
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex c0b220a4..44556043 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -11,6 +11,23 @@ pre-1.0.## [Unreleased]+- **Hide a slide from the show.** Toggle *Hide slide* in the Slide panel and it+ stays in the deck, fully editable, but drops out of the walk: arrow keys pass+ over it, PDF export leaves it out, and it is never picked as the file's+ thumbnail. An element `link` still reaches it, which is the point — backup+ numbers, an appendix, the detail slide you only open if somebody asks.++ Hidden slides do not take a page number, so `{{page}}`/`{{pages}}` stay+ contiguous for the audience: the same rule interactive states already follow,+ rather than a second one to remember. If you prefer the office-suite+ behaviour, where a hidden slide keeps its number so the visible ones do not+ renumber while you toggle slides during rehearsal, turn on *Number hidden+ slides* under Slideshow.++ The sidebar shows what the audience would count — a hidden slide's number is+ struck through, or replaced by a dash when it has none — because a slide you+ have forgotten you hid is a slide you find out about mid-presentation.+- **Fix: a live session could crash when two people created the same element atthe same moment.** Sharing an element id across slides is the morph idiom —it is what id continuity is *for* — so two collaborators inserting onediff --git a/docs/agents.md b/docs/agents.mdindex 953eee08..cec99c20 100644--- a/docs/agents.md+++ b/docs/agents.md@@ -351,6 +351,17 @@ without them — and elements should carry the full field set shown.with `stateOf: "<parent-id>"` is a hidden variant reached only by links(arrow keys skip it, ← returns to parent). Give clickable things a paddedtransparent rect as the hit target, not the text itself.+- **Hidden slides**: `"hidden": true` keeps a slide in the deck and out of the+ show — arrow keys skip it, PDF export leaves it out, and it is never the+ file's thumbnail — but an element `link` still reaches it. That is what it is+ for: backup and appendix material you jump to only if asked. By default a+ hidden slide does not consume a page number either, so `{{page}}`/`{{pages}}`+ stay contiguous for the audience; set `present.numberHidden: true` for the+ office-suite behaviour where it keeps its number.++ Not the same as `stateOf`. A state is a variant OF another slide (← returns+ to its parent, and it morphs with it); hidden carries no such relationship.+ Use a state for "click to drill into this", hidden for "only if they ask".- **Numbers count up** with `fx: { countUp: true }`.- **Speaker notes** (`notes`) are part of the document — write them; theymake a template teach itself.diff --git a/scripts/test-validate.ts b/scripts/test-validate.tsindex 43ee7931..ad19229d 100644--- a/scripts/test-validate.ts+++ b/scripts/test-validate.ts@@ -193,5 +193,29 @@ const chartFindings = validateDoc(chartDoc, { measure: false }).findingsok(chartFindings.length === 0,`a realistic dual-axis chart produces no findings (got ${chartFindings.map((f) => f.path).join(', ') || 'none'})`)+// ------------------------------------------------- hidden slides+// Hidden is the one state a slide can be in where nothing on screen reveals a+// mistake: it is skipped silently, exactly as intended, whether or not anyone+// can still get to it.+const hiddenDoc = (link?: string): BentoDoc => ({+ ...clean,+ slides: [+ { id: 's1', name: 'one', background: '#FFF', transition: 'fade', notes: '', elements:+ link ? [{ id: 'go', type: 'shape', shape: 'rect', x: 10, y: 10, w: 50, h: 50, rotation: 0,+ opacity: 1, fill: '#000', stroke: 'none', strokeWidth: 0, radius: 0, link }] : [] },+ { id: 's2', name: 'appendix', background: '#FFF', transition: 'fade', notes: '', hidden: true, elements: [] },+ ],+} as any)+const unreachable = (d: BentoDoc) => validateDoc(d, { measure: false })+ .findings.filter((f) => f.code === 'unreachable-hidden-slide')++ok(unreachable(hiddenDoc()).length === 1,+ 'a hidden slide nothing links to is reported as unreachable')+ok(unreachable(hiddenDoc('s2')).length === 0,+ 'a hidden slide with an inbound link is not reported — that is the point of hiding it')+ok(unreachable(clean).length === 0, 'an ordinary deck reports nothing')+ok(validateDoc(hiddenDoc('s2'), { measure: false }).ok,+ 'hiding a slide is never an error')+console.log(`\n${checks - failures}/${checks} checks passed`)if (failures) process.exit(1)diff --git a/slides/src/editor/editor.ts b/slides/src/editor/editor.tsindex dfef2b58..234340ee 100644--- a/slides/src/editor/editor.ts+++ b/slides/src/editor/editor.ts@@ -8,7 +8,7 @@ import {FORMAT_VERSION,MEDIA_EMBED_BUDGET,applyChartPalette, applyLayout, builtinLayouts, defaultChart, defaultImage, defaultMedia, defaultShape, defaultTable, defaultText,- instantiateLayout, isLightBg, layoutElementIds, newDocId, parseDoc, readableInk, syncLinkedChart, uid,+ instantiateLayout, isLightBg, layoutElementIds, newDocId, paginates, inLinearFlow, parseDoc, readableInk, syncLinkedChart, uid,type ChartElement, type ShapeKind, type Slide, type SlideElement, type TableElement,} from '../model'import { APP_VERSION, applyUpdate, applyUpdateInPlace, autoCheckEnabled, canUpdateInPlace, checkForUpdates, compareVersions, offlineEnabled, setAutoCheck, setOffline } from '../update'@@ -1455,6 +1455,15 @@ export class Editor {const parentIdx = this.store.doc.slides.findIndex((s) => s.id === slide.stateOf)num.textContent = slide.name ?? `⤷ ${parentIdx + 1}`num.title = `Interactive state of slide ${parentIdx + 1} — reached via links while presenting`+ } else if (slide.hidden) {+ // The sidebar shows what the AUDIENCE would count. With the default+ // numbering a hidden slide has no number at all, so show the marker+ // alone; with office-suite numbering it keeps one, struck through — the+ // same affordance PowerPoint uses. Either way it must be obvious at a+ // glance, because a slide you forgot you hid is one you rediscover+ // mid-presentation.+ num.textContent = paginates(slide, this.store.doc) ? String(this.linearNumber(i)) : '—'+ num.title = t('Hidden — skipped while presenting and left out of PDF export')} else {num.textContent = String(this.linearNumber(i))}@@ -1479,7 +1488,7 @@ export class Editor {/** 1-based position among non-state slides (what the audience counts). */private linearNumber(i: number): number {- return this.store.doc.slides.slice(0, i + 1).filter((s) => !s.stateOf).length+ return this.store.doc.slides.slice(0, i + 1).filter((s) => paginates(s, this.store.doc)).length}private rebuildSidebar() {@@ -1493,6 +1502,7 @@ export class Editor {if (!slide.stateOf) this.sidebar.appendChild(this.insertGap(i))const item = this.makeThumb(slide, i, !!slide.stateOf)if (slide.stateOf) item.classList.add('ed-thumb-state')+ if (slide.hidden) item.classList.add('ed-thumb-hidden')this.sidebar.appendChild(item)})this.sidebar.appendChild(this.insertGap(slides.length))@@ -1722,8 +1732,9 @@ export class Editor {/*** Export the deck to PDF via the browser's print pipeline: every linear- * slide becomes one exact 1600×900 page (states are reachable only through- * interaction, so they stay out of the paper trail).+ * slide becomes one exact 1600×900 page. Anything outside the linear flow+ * stays off the paper: a state is reachable only through interaction, and a+ * hidden slide is material the audience was not meant to be handed.*/exportPdf() {this.canvas.commitTextEdit()@@ -1736,7 +1747,7 @@ export class Editor {pageCss.textContent = `@page { size: 1600px ${pageH}px; margin: 0; } #bento-print .bp-page { height: ${pageH}px; }`box.appendChild(pageCss)for (const slide of this.store.doc.slides) {- if (slide.stateOf) continue+ if (!inLinearFlow(slide)) continueconst page = div('bp-page')const surface = renderSlide(slide, this.store.doc, { svgAsImage: true, hidePlaceholders: true })// normalise to the print page size regardless of doc sizediff --git a/slides/src/editor/panels.ts b/slides/src/editor/panels.tsindex 574b374d..88d990ff 100644--- a/slides/src/editor/panels.ts+++ b/slides/src/editor/panels.ts@@ -252,6 +252,16 @@ export class PropsPanel {slide.transition,(v) => this.edit(() => { this.store.slide.transition = v as TransitionKind }, true),))+ // Hidden slides stay in the deck and stay editable; they drop out of the+ // walk, the PDF and the file thumbnail. Offered only on ordinary slides —+ // a state is already unreachable linearly, so hiding one means nothing.+ if (!slide.stateOf) {+ this.row('Hide slide', this.toggle(!!slide.hidden, (v) =>+ this.edit(() => {+ if (v) this.store.slide.hidden = true+ else delete this.store.slide.hidden+ }, true)))+ }if (slide.transition === 'morph') {const hint = document.createElement('p')hint.className = 'ed-hint'@@ -274,7 +284,7 @@ export class PropsPanel {// Each writes `undefined` at its default rather than the default value, so a// deck that never touches these carries no `present` block at all.const pres = this.store.doc.present ?? {}- const setPresent = (k: 'slideNumber' | 'progress' | 'controls', v: boolean, dflt: boolean) =>+ const setPresent = (k: 'slideNumber' | 'progress' | 'controls' | 'numberHidden', v: boolean, dflt: boolean) =>this.edit(() => {const d = this.store.docconst cur = { ...(d.present ?? {}) }@@ -289,6 +299,12 @@ export class PropsPanel {(v) => setPresent('progress', v, true)))this.row('Corner arrows', this.toggle(pres.controls ?? false,(v) => setPresent('controls', v, false)))+ // Off by default: skipped means uncounted, the same rule interactive states+ // already follow, which is what keeps the audience's numbering contiguous.+ // On matches PowerPoint and Keynote, where a hidden slide keeps its number+ // so the visible ones do not renumber as you toggle slides during rehearsal.+ this.row('Number hidden slides', this.toggle(pres.numberHidden ?? false,+ (v) => setPresent('numberHidden', v, false)))// interactivity: naming, state-of, hover focusdiff --git a/slides/src/i18n/de.ts b/slides/src/i18n/de.tsindex 847e4fb8..4a7a996f 100644--- a/slides/src/i18n/de.ts+++ b/slides/src/i18n/de.ts@@ -737,4 +737,7 @@ export const de: Catalog = {"Zoom in and out": "Vergrößern und verkleinern","Space-drag": "Leertaste + ziehen","Pan as well, if your mouse has a middle button": "Verschiebt ebenfalls, wenn die Maus eine mittlere Taste hat",+ "Hide slide": "Folie ausblenden",+ "Number hidden slides": "Ausgeblendete Folien nummerieren",+ "Hidden — skipped while presenting and left out of PDF export": "Ausgeblendet — wird beim Präsentieren übersprungen und nicht als PDF exportiert",}diff --git a/slides/src/i18n/es.ts b/slides/src/i18n/es.tsindex 0482fea0..9a79f7ab 100644--- a/slides/src/i18n/es.ts+++ b/slides/src/i18n/es.ts@@ -737,4 +737,7 @@ export const es: Catalog = {"Zoom in and out": "Acercar y alejar","Space-drag": "Espacio + arrastrar","Pan as well, if your mouse has a middle button": "También desplaza, si tu ratón tiene botón central",+ "Hide slide": "Ocultar diapositiva",+ "Number hidden slides": "Numerar diapositivas ocultas",+ "Hidden — skipped while presenting and left out of PDF export": "Oculta: se omite al presentar y no se incluye en la exportación a PDF",}diff --git a/slides/src/i18n/fr.ts b/slides/src/i18n/fr.tsindex 237e1c84..69e64ba8 100644--- a/slides/src/i18n/fr.ts+++ b/slides/src/i18n/fr.ts@@ -737,4 +737,7 @@ export const fr: Catalog = {"Zoom in and out": "Zoomer et dézoomer","Space-drag": "Espace + glisser","Pan as well, if your mouse has a middle button": "Déplace aussi, si votre souris a un bouton du milieu",+ "Hide slide": "Masquer la diapositive",+ "Number hidden slides": "Numéroter les diapositives masquées",+ "Hidden — skipped while presenting and left out of PDF export": "Masquée — ignorée pendant la présentation et absente de l’export PDF",}diff --git a/slides/src/i18n/it.ts b/slides/src/i18n/it.tsindex a1d57e5c..2bb6aee9 100644--- a/slides/src/i18n/it.ts+++ b/slides/src/i18n/it.ts@@ -737,4 +737,7 @@ export const it: Catalog = {"Zoom in and out": "Ingrandisci e riduci","Space-drag": "Spazio + trascina","Pan as well, if your mouse has a middle button": "Sposta anche, se il mouse ha il tasto centrale",+ "Hide slide": "Nascondi diapositiva",+ "Number hidden slides": "Numera le diapositive nascoste",+ "Hidden — skipped while presenting and left out of PDF export": "Nascosta — saltata durante la presentazione ed esclusa dall’esportazione PDF",}diff --git a/slides/src/i18n/ja.ts b/slides/src/i18n/ja.tsindex 702c09ae..f499cf8f 100644--- a/slides/src/i18n/ja.ts+++ b/slides/src/i18n/ja.ts@@ -737,4 +737,7 @@ export const ja: Catalog = {"Zoom in and out": "拡大・縮小","Space-drag": "スペース+ドラッグ","Pan as well, if your mouse has a middle button": "中ボタンのあるマウスでも移動できます",+ "Hide slide": "スライドを非表示",+ "Number hidden slides": "非表示スライドに番号を付ける",+ "Hidden — skipped while presenting and left out of PDF export": "非表示 — 発表中はスキップされ、PDF 書き出しにも含まれません",}diff --git a/slides/src/i18n/packed.ts b/slides/src/i18n/packed.tsindex f4f2f310..4879abc6 100644--- a/slides/src/i18n/packed.ts+++ b/slides/src/i18n/packed.ts@@ -743,4 +743,7 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {"Zoom in and out": ["拡大・縮小","放大与缩小","放大與縮小","Acercar y alejar","Zoomer et dézoomer","Vergrößern und verkleinern","Ingrandisci e riduci","Ampliar e reduzir"],"Space-drag": ["スペース+ドラッグ","空格键+拖动","空白鍵+拖曳","Espacio + arrastrar","Espace + glisser","Leertaste + ziehen","Spazio + trascina","Espaço + arrastar"],"Pan as well, if your mouse has a middle button": ["中ボタンのあるマウスでも移動できます","如果鼠标有中键,也可以平移","如果滑鼠有中鍵,也可以平移","También desplaza, si tu ratón tiene botón central","Déplace aussi, si votre souris a un bouton du milieu","Verschiebt ebenfalls, wenn die Maus eine mittlere Taste hat","Sposta anche, se il mouse ha il tasto centrale","Também desloca, se o rato tiver botão do meio"],+ "Hide slide": ["スライドを非表示","隐藏幻灯片","隱藏投影片","Ocultar diapositiva","Masquer la diapositive","Folie ausblenden","Nascondi diapositiva","Ocultar diapositivo"],+ "Number hidden slides": ["非表示スライドに番号を付ける","为隐藏幻灯片编号","為隱藏投影片編號","Numerar diapositivas ocultas","Numéroter les diapositives masquées","Ausgeblendete Folien nummerieren","Numera le diapositive nascoste","Numerar diapositivos ocultos"],+ "Hidden — skipped while presenting and left out of PDF export": ["非表示 — 発表中はスキップされ、PDF 書き出しにも含まれません","已隐藏 — 放映时跳过,且不包含在 PDF 导出中","已隱藏 — 放映時略過,且不包含在 PDF 匯出中","Oculta: se omite al presentar y no se incluye en la exportación a PDF","Masquée — ignorée pendant la présentation et absente de l’export PDF","Ausgeblendet — wird beim Präsentieren übersprungen und nicht als PDF exportiert","Nascosta — saltata durante la presentazione ed esclusa dall’esportazione PDF","Oculto — ignorado ao apresentar e excluído da exportação para PDF"],}diff --git a/slides/src/i18n/pt.ts b/slides/src/i18n/pt.tsindex 20d063bd..4da79d9f 100644--- a/slides/src/i18n/pt.ts+++ b/slides/src/i18n/pt.ts@@ -735,4 +735,7 @@ export const pt: Catalog = {"Zoom in and out": "Ampliar e reduzir","Space-drag": "Espaço + arrastar","Pan as well, if your mouse has a middle button": "Também desloca, se o rato tiver botão do meio",+ "Hide slide": "Ocultar diapositivo",+ "Number hidden slides": "Numerar diapositivos ocultos",+ "Hidden — skipped while presenting and left out of PDF export": "Oculto — ignorado ao apresentar e excluído da exportação para PDF",}diff --git a/slides/src/i18n/zh-Hans.ts b/slides/src/i18n/zh-Hans.tsindex 2f5aeaa7..13a69991 100644--- a/slides/src/i18n/zh-Hans.ts+++ b/slides/src/i18n/zh-Hans.ts@@ -737,4 +737,7 @@ export const zhHans: Catalog = {"Zoom in and out": "放大与缩小","Space-drag": "空格键+拖动","Pan as well, if your mouse has a middle button": "如果鼠标有中键,也可以平移",+ "Hide slide": "隐藏幻灯片",+ "Number hidden slides": "为隐藏幻灯片编号",+ "Hidden — skipped while presenting and left out of PDF export": "已隐藏 — 放映时跳过,且不包含在 PDF 导出中",}diff --git a/slides/src/i18n/zh-Hant.ts b/slides/src/i18n/zh-Hant.tsindex 96b68f32..3b745073 100644--- a/slides/src/i18n/zh-Hant.ts+++ b/slides/src/i18n/zh-Hant.ts@@ -737,4 +737,7 @@ export const zhHant: Catalog = {"Zoom in and out": "放大與縮小","Space-drag": "空白鍵+拖曳","Pan as well, if your mouse has a middle button": "如果滑鼠有中鍵,也可以平移",+ "Hide slide": "隱藏投影片",+ "Number hidden slides": "為隱藏投影片編號",+ "Hidden — skipped while presenting and left out of PDF export": "已隱藏 — 放映時略過,且不包含在 PDF 匯出中",}diff --git a/slides/src/model.ts b/slides/src/model.tsindex 421faafa..ca811168 100644--- a/slides/src/model.ts+++ b/slides/src/model.ts@@ -338,6 +338,22 @@ export interface Slide {* after the parent.*/stateOf?: string+ /**+ * Hidden from the show: skipped by linear navigation, left out of PDF+ * export, and never chosen as the file's thumbnail — but still an ordinary+ * slide you can edit, and still reachable by an element `link`, which is+ * what makes it useful for backup and appendix material you jump to only+ * if asked.+ *+ * Distinct from `stateOf`: a state is a VARIANT OF another slide (← returns+ * to its parent, and it morphs with it). Hidden carries no such+ * relationship — it is simply out of the linear flow.+ *+ * By default a hidden slide does not consume a page number either, so the+ * audience sees 1..N with no gaps; `doc.present.numberHidden` restores the+ * office-suite behaviour of counting it.+ */+ hidden?: boolean/*** present-mode hover behaviour:* - focus-group: dim every element outside the hovered element's group@@ -386,6 +402,16 @@ export interface BentoDoc {}/** present-mode chrome; decks with built-in chrome can turn Reveal's off */present?: {+ /**+ * Count hidden slides in {{page}}/{{pages}} and the presenter's counter.+ *+ * Default (absent/false): they are skipped, matching interactive states —+ * one rule, "skipped means uncounted", and contiguous numbering falls out+ * of it. True restores what PowerPoint and Keynote do, where a hidden+ * slide keeps its number so the visible ones do not renumber as you toggle+ * slides in and out during rehearsal.+ */+ numberHidden?: booleanslideNumber?: booleancontrols?: booleanprogress?: boolean@@ -996,6 +1022,27 @@ export function layoutElementIds(doc: BentoDoc): Set<string> {return ids}+/**+ * Does this slide consume a page number?+ *+ * The single answer to that question — page fields, the presenter's counter,+ * the sidebar — so they cannot disagree about which slide is "4". Interactive+ * states never count; hidden slides count only when the deck opts into+ * office-suite numbering.+ */+export const paginates = (s: Slide, doc: BentoDoc): boolean =>+ !s.stateOf && (!s.hidden || !!doc.present?.numberHidden)++/**+ * Is this slide part of the linear walk?+ *+ * Deliberately NOT the same question as `paginates`. Navigation, PDF export and+ * the file thumbnail all skip states and hidden slides unconditionally; only+ * NUMBERING is configurable. Collapsing the two would make `numberHidden` walk+ * the audience into a slide that was hidden on purpose.+ */+export const inLinearFlow = (s: Slide): boolean => !s.stateOf && !s.hidden+export const newDocId = (): string =>typeof crypto !== 'undefined' && crypto.randomUUID ? crypto.randomUUID() : uid('doc')diff --git a/slides/src/modelkeys.generated.ts b/slides/src/modelkeys.generated.tsindex 7d32c200..b8058646 100644--- a/slides/src/modelkeys.generated.ts+++ b/slides/src/modelkeys.generated.ts@@ -11,7 +11,7 @@export const MODEL_KEYS = {"doc": ["assets", "blobs", "collab", "docId", "fonts", "format", "layouts", "meta", "modified", "present", "readonly", "size", "slides", "template", "theme", "title", "version"],- "slide": ["background", "comments", "elements", "hover", "id", "name", "notes", "stateOf", "transition"],+ "slide": ["background", "comments", "elements", "hidden", "hover", "id", "name", "notes", "stateOf", "transition"],"comment": ["at", "author", "elementId", "id", "replies", "resolved", "text", "x", "y"],"element": {"text": ["align", "backdropFilter", "blend", "blur", "color", "colorGradient", "fontFamily", "fontSize", "fontWeight", "fx", "group", "groupId", "h", "html", "id", "letterSpacing", "lineHeight", "link", "morphId", "opacity", "placeholder", "role", "rotation", "shadow", "showOnHover", "textStroke", "type", "valign", "w", "x", "y"],diff --git a/slides/src/present.ts b/slides/src/present.tsindex 17e60bd5..f548fe8f 100644--- a/slides/src/present.ts+++ b/slides/src/present.ts@@ -9,7 +9,7 @@ import 'reveal.js/dist/reveal.css'import { anim, resetXform } from './anim'import { chartSnapshotSvg, mountChart } from './charts'import type { BentoDoc, GradientFill, ShapeElement, Slide, SlideElement } from './model'-import { morphKey } from './model'+import { morphKey, paginates, inLinearFlow } from './model'import { applyElementFrame, gradientLineCoords, renderSlide } from './render'import { paintSpeaker, setSpeakerWindow, speakerIdleBody, speakerWindow } from './screens'import { t } from './i18n'@@ -46,7 +46,7 @@ export function startPresentation(const section = document.createElement('section')// Morph slides swap instantly; the Flip animation supplies the motion.section.dataset.transition = slide.transition === 'morph' ? 'none' : slide.transition- if (slide.stateOf) section.dataset.bentoState = '1' // dimmed in overview+ if (!inLinearFlow(slide)) section.dataset.bentoState = '1' // dimmed in overviewconst surface = renderSlide(slide, doc, { hidePlaceholders: true, liveMedia: true })// reveal slides start with only the default hover set visibleif (slide.hover?.type === 'reveal') applyRevealSet(surface, slide.hover.default ?? null, slide.hover.default)@@ -64,7 +64,7 @@ export function startPresentation(// ——— state-aware linear navigation ———// Slides with stateOf are interactive states: linked-to, never walked-to.- const isState = (i: number) => !!doc.slides[i]?.stateOf+ const isState = (i: number) => { const sl = doc.slides[i]; return !!sl && !inLinearFlow(sl) }const anchorOf = (i: number) => {const pid = doc.slides[i]?.stateOfconst p = doc.slides.findIndex((s) => s.id === pid)@@ -98,8 +98,8 @@ export function startPresentation(}return false}- const visibleIndex = (i: number) => doc.slides.slice(0, i + 1).filter((s) => !s.stateOf).length- const visibleTotal = doc.slides.filter((s) => !s.stateOf).length+ const visibleIndex = (i: number) => doc.slides.slice(0, i + 1).filter((s) => paginates(s, doc)).length+ const visibleTotal = doc.slides.filter((s) => paginates(s, doc)).length// real slide indices that appear in linear navigation (states are excluded) —// the presenter-view thumbnail rail and grid iterate this.const railIndices = doc.slides.map((_, i) => i).filter((i) => !isState(i))diff --git a/slides/src/preview.ts b/slides/src/preview.tsindex 9859d1d0..9314f17e 100644--- a/slides/src/preview.ts+++ b/slides/src/preview.ts@@ -34,7 +34,7 @@// feature exists to serve.import { renderSlide } from './render'-import { PREVIEW_BUDGET, type BentoDoc, type Slide } from './model'+import { PREVIEW_BUDGET, type BentoDoc, type Slide, inLinearFlow } from './model'/** Elements that must never reach a static preview (active or external). */const BANNED = 'script,style,noscript,iframe,object,embed,link,video,audio,canvas,form,input,button'@@ -355,9 +355,11 @@ const byteLength = (el: HTMLElement) => new TextEncoder().encode(el.outerHTML).l* Tier 3 cannot exceed the budget, so this always terminates with something.*/export function buildSlidePreview(doc: BentoDoc): HTMLElement | null {- // The first page a reader sees: interactive states are hidden variants and- // never open a deck.- const slide = doc.slides.find((s) => !s.stateOf) ?? doc.slides[0]+ // The first page a reader sees. Nothing outside the linear flow can be it:+ // a state is a variant reachable only by clicking, and a hidden slide is+ // deliberately out of the show — neither should become the deck's face in a+ // file manager.+ const slide = doc.slides.find(inLinearFlow) ?? doc.slides[0]if (!slide) return nullfor (const keepImages of [true, false]) {diff --git a/slides/src/render.ts b/slides/src/render.tsindex 25260647..e6b66d00 100644--- a/slides/src/render.ts+++ b/slides/src/render.ts@@ -4,7 +4,7 @@// editor canvas, sidebar thumbnails, and Reveal.js sections.import type { BentoDoc, ShapeElement, Slide, SlideElement, SvgElement, TableElement } from './model'-import { morphKey } from './model'+import { morphKey, paginates } from './model'import { chartSnapshotSvg } from './charts'import temml from 'temml'@@ -34,8 +34,8 @@ export function fieldContext(doc: BentoDoc, slide: Slide): FieldContext {const upto = idx < 0 ? doc.slides : doc.slides.slice(0, idx + 1)const m = doc.meta ?? {}return {- page: upto.filter((s) => !s.stateOf).length,- pages: doc.slides.filter((s) => !s.stateOf).length,+ page: upto.filter((s) => paginates(s, doc)).length,+ pages: doc.slides.filter((s) => paginates(s, doc)).length,title: doc.title,date: new Date(),author: m.author ?? '',diff --git a/slides/src/store.ts b/slides/src/store.tsindex cd8e18be..fb415754 100644--- a/slides/src/store.ts+++ b/slides/src/store.ts@@ -1,5 +1,6 @@// SPDX-License-Identifier: MIT// Copyright (c) 2026 The Bento authors+import { inLinearFlow } from './model'import type { BentoDoc, Slide, SlideElement } from './model'export type StoreEvent =@@ -140,7 +141,7 @@ export class Store {goToLinear(dir: 1 | -1) {const slides = this.doc.slidesfor (let i = this.currentIndex + dir; i >= 0 && i < slides.length; i += dir) {- if (!slides[i].stateOf) { this.goTo(i); return }+ if (inLinearFlow(slides[i])) { this.goTo(i); return }}}diff --git a/slides/src/styles.css b/slides/src/styles.cssindex db108146..ff7a2cae 100644--- a/slides/src/styles.css+++ b/slides/src/styles.css@@ -420,6 +420,15 @@ a.ed-btn { text-decoration: none; } /* the update block's "What's new" link isoutline: none;cursor: default;}+/* A hidden slide is still an ordinary, editable slide — it is just out of the+ show. Dimmed rather than greyed out, and the number struck through, so the+ sidebar reads as "this one will be skipped" without looking broken. */+.ed-thumb-hidden .bento-thumb-surface { opacity: 0.42; }+.ed-thumb-hidden .ed-thumb-num {+ text-decoration: line-through;+ opacity: 0.75;+}+.ed-stage .bento-el { cursor: grab; }.ed-stage .bento-el:active { cursor: grabbing; }.ed-stage .bento-editing { cursor: text; }diff --git a/slides/src/validate.ts b/slides/src/validate.tsindex 4053a5d1..255280b0 100644--- a/slides/src/validate.ts+++ b/slides/src/validate.ts@@ -138,6 +138,10 @@ export function validateDoc(doc: BentoDoc, opts: ValidateOpts = {}): ValidateResconst slideIds = new Set(doc.slides.map((s) => s.id))const assets = doc.assets ?? {}const arrivals = morphArrivals(doc)+ // Every slide any element can jump to. A hidden slide is reachable ONLY this+ // way, so one with no inbound link is in the file and in nobody's path.+ const linkTargets = new Set<string>()+ for (const sl of doc.slides) for (const el of sl.elements) if (el.link) linkTargets.add(el.link)// ---- document level ------------------------------------------------------for (const k of Object.keys(doc)) {@@ -181,6 +185,10 @@ export function validateDoc(doc: BentoDoc, opts: ValidateOpts = {}): ValidateResmessage: `Slide key "${k}" is not part of the format — it is ignored.` })}}+ if (slide.hidden && !slide.stateOf && !linkTargets.has(sid)) {+ add({ code: 'unreachable-hidden-slide', severity: 'info', slide: sid, path: 'hidden',+ message: `Hidden, and nothing links to it — this slide cannot be reached at all while presenting. Give an element a link to it, or unhide it.` })+ }if (slide.stateOf && !slideIds.has(slide.stateOf)) {add({ code: 'broken-state-parent', severity: 'error', slide: sid, path: 'stateOf',message: `stateOf points at "${slide.stateOf}", which is not a slide in this deck — the state is unreachable.` })