Bento, the office suite that fits in a file
TypeScript mit-licenseofficeoffice-365office-suiteoffice-toolsoffice365open-sourcepowerpointself-hostedsingle-page-appslidesslideshareslideshowslideshow-galleryslideshow-makerslideshows
The web demo says where your deck went (#354)
nyblnet1c0fd4277a5d
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 7d561224..c8a9ef12 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -11,6 +11,21 @@ pre-1.0.## [Unreleased]+- **The web demo says where your deck went.** bento.page always hands out a new+ deck — that is what it is for — so anyone who saved from it and came back+ later got a blank starter and reasonably read it as lost work. Their file was+ on disk the whole time; nothing on screen said so.++ Saving from the web now leaves a line naming the file it went to, and saying+ that this page always starts a new deck. Coming back after a save says the+ same thing before you start typing into a fresh one, with the name of the file+ to open — and **Start a new deck anyway** is always there, because some+ visitors do want a fresh one.++ Two things genuinely do not survive that trip and are worth knowing: version+ history and the recovery snapshot belong to the browser, not the file, so they+ stay behind on bento.page when the deck moves to your disk.+- **Fix: several buttons were unreadable in dark mode.** White text on anear-white button — the main action in a dialog, the toast that confirms asave, the active chip in a settings row, and the + between slides. Thediff --git a/slides/src/editor/editor.ts b/slides/src/editor/editor.tsindex 54943100..8646453b 100644--- a/slides/src/editor/editor.ts+++ b/slides/src/editor/editor.ts@@ -22,7 +22,8 @@ import { startPresentation } from '../present'// serializeFile (plain output) is deliberately NOT imported here: every path// in this file writes a real file for a person, so all of them must inherit an// active password. serializeAuto is the only encryption-aware serializer.-import { adoptFileHandle, canWriteInPlace, currentFileName, fileBase, hasFileHandle, isEncryptionActive, openedFileName, saveFile, serializeAuto, setEncryptionPassword, writeUpdatedFile, writeUpdatedFileAs } from '../save'+import { adoptFileHandle, canWriteInPlace, currentFileName, fileBase, hasFileHandle, hostCan, isEncryptionActive, openedFileName, saveFile, serializeAuto, setEncryptionPassword, suggestedFileName, writeUpdatedFile, writeUpdatedFileAs } from '../save'+import { noteSavedFromWeb } from './returngate'import { addVersion, clearRecovery, clearVersions, docContentKey, getRecovery, listVersions, pruneOld, putRecovery, type Snapshot } from '../autosave'import { insertElements, insertSlides, parseClip, serializeElements, serializeSlides } from './clipboard'import { openSpeakerWindow, speakerIdleBody } from '../screens'@@ -2598,6 +2599,13 @@ export class Editor {// session too so author and recipient meet without another click.this.session?.enableSharing()this.tryJoin()+ // A save from the WEB changes what this page is: the deck now lives in a+ // file, and this URL will hand out a fresh starter next time. Said here,+ // persistently, so the next visit is not a surprise — and deliberately+ // NOT as a block, because this tab keeps working and keeps writing.+ noteSavedFromWeb(currentFileName() ?? suggestedFileName(this.store.doc), {+ fsAccess: canWriteInPlace(), canWrite: hostCan('write'),+ })this.toast(result === 'downloaded'? t('This browser can’t rewrite files in place — a fresh copy went to Downloads'): t('Saved'))diff --git a/slides/src/editor/returngate.ts b/slides/src/editor/returngate.tsnew file mode 100644index 00000000..633752fa--- /dev/null+++ b/slides/src/editor/returngate.ts@@ -0,0 +1,121 @@+// SPDX-License-Identifier: MIT+// Copyright (c) 2026 The Bento authors+//+// The words and the markup for "you saved a deck from here before".+//+// The remembering and the policy live in kernel/src/returngate.ts, because+// Spaces, Dash and Type have the identical problem and would each grow their+// own copy of it. What is app-shaped is only this: how slides says it.+//+// WHY THIS EXISTS. Someone works at https://bento.page/slides/, saves, comes+// back later and gets a fresh starter, because a never-saved deck stays+// dormant by design. It reads as lost work. It is not — the file is on disk —+// but nothing on screen said so, and version history and recovery genuinely do+// not survive, because they live in IndexedDB keyed to the ORIGIN and do not+// follow the file to file://.+//+// The gate is on RETURN, not on save: a tab that has just saved is a working+// session writing to disk every 2.5s through its handle, and interrupting it+// would sever something that functions.++import { t } from '../i18n'+import {+ clearSavedHere, isWebOrigin, noteSavedHere, offerFor, savedHere,+ shouldGateOnReturn, type Offer, type Platform,+} from '../../../kernel/src/returngate.ts'++/**+ * Which platform's link to show. A GUESS, and treated as one: the capability+ * test decides what is said, this only decides which download is named. iOS is+ * checked before "Mac" because iPadOS reports MacIntel with touch points.+ */+export function platformGuess(): Platform {+ const ua = navigator.userAgent || ''+ const touchMac = navigator.platform === 'MacIntel' && (navigator.maxTouchPoints ?? 0) > 1+ if (/iPhone|iPad|iPod/i.test(ua) || touchMac) return 'ios'+ if (/Android/i.test(ua)) return 'android'+ if (/Macintosh|Windows|Linux|CrOS/i.test(ua)) return 'desktop'+ return 'unknown'+}++/** One sentence for the offer, or '' where the honest answer is to say nothing. */+export function offerLine(offer: Offer): string {+ switch (offer.kind) {+ case 'silent':+ return ''+ case 'extension':+ return t('The bento/tray extension can reopen your files here.')+ case 'app':+ return t('The bento/tray app can keep your files on this device.')+ case 'use-chromium':+ return t('This browser cannot reopen a file in place — Chrome or Edge can.')+ case 'keep-file':+ return t('Keep the file somewhere you can find it again.')+ }+}++const el = (tag: string, cls: string, text?: string) => {+ const n = document.createElement(tag)+ n.className = cls+ if (text) n.textContent = text+ return n+}++/**+ * After a save from the web: change what the page CLAIMS TO BE, without+ * interrupting it. Persistent rather than a toast — a toast is exactly the+ * thing someone misses, and this is the sentence that stops the next visit+ * being a surprise.+ */+export function noteSavedFromWeb(fileName: string, env: { fsAccess: boolean; canWrite: boolean }): void {+ if (!isWebOrigin() || !fileName) return+ noteSavedHere(fileName)+ document.querySelector('.ed-savednote')?.remove()+ const note = el('div', 'ed-savednote')+ note.appendChild(el('strong', 'ed-savednote-name', fileName))+ note.appendChild(el('span', 'ed-savednote-body',+ t('This page always starts a new deck — open this file to come back to it.')))+ const line = offerLine(offerFor({ ...env, platform: platformGuess() }))+ if (line) note.appendChild(el('span', 'ed-savednote-offer', line))+ document.body.appendChild(note)+}++/**+ * On return: say what happened, and never stand in the way.+ *+ * "Start a new deck anyway" is ALWAYS present. Some visitors genuinely want a+ * fresh deck and some cannot install anything, and a gate with no way past it+ * is worse than the silent blank starter it replaces.+ */+export function maybeShowReturnGate(env: {+ docIsFresh: boolean+ fsAccess: boolean+ canWrite: boolean+}): void {+ const name = savedHere()+ if (!shouldGateOnReturn({ webOrigin: isWebOrigin(), savedName: name, docIsFresh: env.docIsFresh })) return++ const overlay = el('div', 'ed-gate-overlay')+ const card = el('div', 'ed-gate-card')+ card.appendChild(el('h2', 'ed-gate-h', t('You saved a deck from here before.')))+ card.appendChild(el('p', 'ed-gate-body',+ t('This page always starts fresh. Open your file to carry on with it:')))+ card.appendChild(el('div', 'ed-gate-name', name ?? ''))+ const line = offerLine(offerFor({ fsAccess: env.fsAccess, canWrite: env.canWrite, platform: platformGuess() }))+ if (line) card.appendChild(el('p', 'ed-gate-offer', line))++ const acts = el('div', 'ed-gate-acts')+ const go = document.createElement('button')+ go.className = 'ed-btn ed-btn-primary'+ go.textContent = t('Start a new deck anyway')+ go.addEventListener('click', () => {+ // Forget it, or the same person is asked the same question every visit.+ clearSavedHere()+ overlay.remove()+ })+ acts.appendChild(go)+ card.appendChild(acts)+ overlay.appendChild(card)+ document.body.appendChild(overlay)+ go.focus()+}diff --git a/slides/src/i18n/de.ts b/slides/src/i18n/de.tsindex 684b59b4..6497f646 100644--- a/slides/src/i18n/de.ts+++ b/slides/src/i18n/de.ts@@ -744,4 +744,12 @@ export const de: Catalog = {"Appearance": "Darstellung","Match my system": "Systemeinstellung folgen","Dark": "Dunkel",+ "You saved a deck from here before.": "Sie haben hier schon einmal ein Deck gespeichert.",+ "This page always starts fresh. Open your file to carry on with it:": "Diese Seite startet immer neu. Öffnen Sie Ihre Datei, um daran weiterzuarbeiten:",+ "Start a new deck anyway": "Trotzdem ein neues Deck beginnen",+ "This page always starts a new deck — open this file to come back to it.": "Diese Seite startet immer ein neues Deck — öffnen Sie diese Datei, um zurückzukehren.",+ "The bento/tray extension can reopen your files here.": "Die bento/tray-Erweiterung kann Ihre Dateien hier wieder öffnen.",+ "The bento/tray app can keep your files on this device.": "Die bento/tray-App kann Ihre Dateien auf diesem Gerät behalten.",+ "This browser cannot reopen a file in place — Chrome or Edge can.": "Dieser Browser kann eine Datei nicht direkt überschreiben — Chrome oder Edge schon.",+ "Keep the file somewhere you can find it again.": "Bewahren Sie die Datei an einem Ort auf, den Sie wiederfinden.",}diff --git a/slides/src/i18n/es.ts b/slides/src/i18n/es.tsindex 88b2428f..393266e9 100644--- a/slides/src/i18n/es.ts+++ b/slides/src/i18n/es.ts@@ -744,4 +744,12 @@ export const es: Catalog = {"Appearance": "Apariencia","Match my system": "Según el sistema","Dark": "Oscuro",+ "You saved a deck from here before.": "Ya has guardado una presentación desde aquí.",+ "This page always starts fresh. Open your file to carry on with it:": "Esta página siempre empieza de cero. Abre tu archivo para continuar con él:",+ "Start a new deck anyway": "Empezar una presentación nueva de todos modos",+ "This page always starts a new deck — open this file to come back to it.": "Esta página siempre empieza una presentación nueva — abre este archivo para volver a ella.",+ "The bento/tray extension can reopen your files here.": "La extensión bento/tray puede volver a abrir tus archivos aquí.",+ "The bento/tray app can keep your files on this device.": "La app bento/tray puede guardar tus archivos en este dispositivo.",+ "This browser cannot reopen a file in place — Chrome or Edge can.": "Este navegador no puede reescribir un archivo en su sitio — Chrome o Edge sí.",+ "Keep the file somewhere you can find it again.": "Guarda el archivo en un lugar donde puedas encontrarlo.",}diff --git a/slides/src/i18n/fr.ts b/slides/src/i18n/fr.tsindex 5782cd12..18d1eca2 100644--- a/slides/src/i18n/fr.ts+++ b/slides/src/i18n/fr.ts@@ -744,4 +744,12 @@ export const fr: Catalog = {"Appearance": "Apparence","Match my system": "Comme le système","Dark": "Sombre",+ "You saved a deck from here before.": "Vous avez déjà enregistré un deck depuis cette page.",+ "This page always starts fresh. Open your file to carry on with it:": "Cette page recommence toujours à zéro. Ouvrez votre fichier pour le poursuivre :",+ "Start a new deck anyway": "Commencer quand même un nouveau deck",+ "This page always starts a new deck — open this file to come back to it.": "Cette page commence toujours un nouveau deck — ouvrez ce fichier pour y revenir.",+ "The bento/tray extension can reopen your files here.": "L'extension bento/tray peut rouvrir vos fichiers ici.",+ "The bento/tray app can keep your files on this device.": "L'application bento/tray peut conserver vos fichiers sur cet appareil.",+ "This browser cannot reopen a file in place — Chrome or Edge can.": "Ce navigateur ne peut pas réécrire un fichier sur place — Chrome ou Edge le peuvent.",+ "Keep the file somewhere you can find it again.": "Conservez le fichier à un endroit où vous le retrouverez.",}diff --git a/slides/src/i18n/it.ts b/slides/src/i18n/it.tsindex f1a1edb0..a6d4de47 100644--- a/slides/src/i18n/it.ts+++ b/slides/src/i18n/it.ts@@ -744,4 +744,12 @@ export const it: Catalog = {"Appearance": "Aspetto","Match my system": "Come il sistema","Dark": "Scuro",+ "You saved a deck from here before.": "Hai già salvato una presentazione da qui.",+ "This page always starts fresh. Open your file to carry on with it:": "Questa pagina riparte sempre da zero. Apri il tuo file per continuare:",+ "Start a new deck anyway": "Inizia comunque una nuova presentazione",+ "This page always starts a new deck — open this file to come back to it.": "Questa pagina avvia sempre una nuova presentazione — apri questo file per tornarci.",+ "The bento/tray extension can reopen your files here.": "L'estensione bento/tray può riaprire i tuoi file qui.",+ "The bento/tray app can keep your files on this device.": "L'app bento/tray può conservare i tuoi file su questo dispositivo.",+ "This browser cannot reopen a file in place — Chrome or Edge can.": "Questo browser non può riscrivere un file al suo posto — Chrome o Edge sì.",+ "Keep the file somewhere you can find it again.": "Conserva il file in un posto dove potrai ritrovarlo.",}diff --git a/slides/src/i18n/ja.ts b/slides/src/i18n/ja.tsindex 960a2c05..b5e976bd 100644--- a/slides/src/i18n/ja.ts+++ b/slides/src/i18n/ja.ts@@ -744,4 +744,12 @@ export const ja: Catalog = {"Appearance": "外観","Match my system": "システムに合わせる","Dark": "ダーク",+ "You saved a deck from here before.": "以前このページからデッキを保存しています。",+ "This page always starts fresh. Open your file to carry on with it:": "このページは常に新規から始まります。続きはファイルを開いてください:",+ "Start a new deck anyway": "それでも新しいデッキを作成",+ "This page always starts a new deck — open this file to come back to it.": "このページは常に新しいデッキを開きます — 続きはこのファイルを開いてください。",+ "The bento/tray extension can reopen your files here.": "bento/tray 拡張機能を使うと、ここでファイルを開き直せます。",+ "The bento/tray app can keep your files on this device.": "bento/tray アプリはこの端末にファイルを保存できます。",+ "This browser cannot reopen a file in place — Chrome or Edge can.": "このブラウザーはファイルを直接上書きできません — Chrome または Edge なら可能です。",+ "Keep the file somewhere you can find it again.": "ファイルは後で見つけられる場所に保存しておいてください。",}diff --git a/slides/src/i18n/packed.ts b/slides/src/i18n/packed.tsindex 473d115e..c3f65b0b 100644--- a/slides/src/i18n/packed.ts+++ b/slides/src/i18n/packed.ts@@ -750,4 +750,12 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {"Appearance": ["外観","外观","外觀","Apariencia","Apparence","Darstellung","Aspetto","Aspeto"],"Match my system": ["システムに合わせる","跟随系统","跟隨系統","Según el sistema","Comme le système","Systemeinstellung folgen","Come il sistema","Acompanhar o sistema"],"Dark": ["ダーク","深色","深色","Oscuro","Sombre","Dunkel","Scuro","Escuro"],+ "You saved a deck from here before.": ["以前このページからデッキを保存しています。","你之前从这里保存过一份幻灯片。","你之前曾從這裡儲存過一份簡報。","Ya has guardado una presentación desde aquí.","Vous avez déjà enregistré un deck depuis cette page.","Sie haben hier schon einmal ein Deck gespeichert.","Hai già salvato una presentazione da qui.","Já guardou uma apresentação a partir daqui."],+ "This page always starts fresh. Open your file to carry on with it:": ["このページは常に新規から始まります。続きはファイルを開いてください:","此页面总是从新建开始。打开你的文件继续编辑:","此頁面總是從新建開始。開啟你的檔案以繼續編輯:","Esta página siempre empieza de cero. Abre tu archivo para continuar con él:","Cette page recommence toujours à zéro. Ouvrez votre fichier pour le poursuivre :","Diese Seite startet immer neu. Öffnen Sie Ihre Datei, um daran weiterzuarbeiten:","Questa pagina riparte sempre da zero. Apri il tuo file per continuare:","Esta página começa sempre do zero. Abra o seu ficheiro para continuar:"],+ "Start a new deck anyway": ["それでも新しいデッキを作成","仍然新建幻灯片","仍要新建簡報","Empezar una presentación nueva de todos modos","Commencer quand même un nouveau deck","Trotzdem ein neues Deck beginnen","Inizia comunque una nuova presentazione","Começar mesmo assim uma nova apresentação"],+ "This page always starts a new deck — open this file to come back to it.": ["このページは常に新しいデッキを開きます — 続きはこのファイルを開いてください。","此页面总是新建一份幻灯片 — 打开此文件即可回到它。","此頁面總是新建一份簡報 — 開啟此檔案即可回到它。","Esta página siempre empieza una presentación nueva — abre este archivo para volver a ella.","Cette page commence toujours un nouveau deck — ouvrez ce fichier pour y revenir.","Diese Seite startet immer ein neues Deck — öffnen Sie diese Datei, um zurückzukehren.","Questa pagina avvia sempre una nuova presentazione — apri questo file per tornarci.","Esta página começa sempre uma apresentação nova — abra este ficheiro para voltar a ela."],+ "The bento/tray extension can reopen your files here.": ["bento/tray 拡張機能を使うと、ここでファイルを開き直せます。","bento/tray 扩展可以在这里重新打开你的文件。","bento/tray 擴充功能可以在這裡重新開啟你的檔案。","La extensión bento/tray puede volver a abrir tus archivos aquí.","L'extension bento/tray peut rouvrir vos fichiers ici.","Die bento/tray-Erweiterung kann Ihre Dateien hier wieder öffnen.","L'estensione bento/tray può riaprire i tuoi file qui.","A extensão bento/tray pode reabrir os seus ficheiros aqui."],+ "The bento/tray app can keep your files on this device.": ["bento/tray アプリはこの端末にファイルを保存できます。","bento/tray 应用可以把文件保存在此设备上。","bento/tray 應用程式可以將檔案保存在此裝置上。","La app bento/tray puede guardar tus archivos en este dispositivo.","L'application bento/tray peut conserver vos fichiers sur cet appareil.","Die bento/tray-App kann Ihre Dateien auf diesem Gerät behalten.","L'app bento/tray può conservare i tuoi file su questo dispositivo.","A aplicação bento/tray pode guardar os seus ficheiros neste dispositivo."],+ "This browser cannot reopen a file in place — Chrome or Edge can.": ["このブラウザーはファイルを直接上書きできません — Chrome または Edge なら可能です。","此浏览器无法就地重写文件 — Chrome 或 Edge 可以。","此瀏覽器無法就地覆寫檔案 — Chrome 或 Edge 可以。","Este navegador no puede reescribir un archivo en su sitio — Chrome o Edge sí.","Ce navigateur ne peut pas réécrire un fichier sur place — Chrome ou Edge le peuvent.","Dieser Browser kann eine Datei nicht direkt überschreiben — Chrome oder Edge schon.","Questo browser non può riscrivere un file al suo posto — Chrome o Edge sì.","Este navegador não consegue reescrever um ficheiro no lugar — o Chrome ou o Edge conseguem."],+ "Keep the file somewhere you can find it again.": ["ファイルは後で見つけられる場所に保存しておいてください。","把文件保存在你以后能找到的位置。","請將檔案保存在你日後找得到的位置。","Guarda el archivo en un lugar donde puedas encontrarlo.","Conservez le fichier à un endroit où vous le retrouverez.","Bewahren Sie die Datei an einem Ort auf, den Sie wiederfinden.","Conserva il file in un posto dove potrai ritrovarlo.","Guarde o ficheiro num sítio onde o consiga encontrar."],}diff --git a/slides/src/i18n/pt.ts b/slides/src/i18n/pt.tsindex 2e49bee8..ddbcf4c6 100644--- a/slides/src/i18n/pt.ts+++ b/slides/src/i18n/pt.ts@@ -742,4 +742,12 @@ export const pt: Catalog = {"Appearance": "Aspeto","Match my system": "Acompanhar o sistema","Dark": "Escuro",+ "You saved a deck from here before.": "Já guardou uma apresentação a partir daqui.",+ "This page always starts fresh. Open your file to carry on with it:": "Esta página começa sempre do zero. Abra o seu ficheiro para continuar:",+ "Start a new deck anyway": "Começar mesmo assim uma nova apresentação",+ "This page always starts a new deck — open this file to come back to it.": "Esta página começa sempre uma apresentação nova — abra este ficheiro para voltar a ela.",+ "The bento/tray extension can reopen your files here.": "A extensão bento/tray pode reabrir os seus ficheiros aqui.",+ "The bento/tray app can keep your files on this device.": "A aplicação bento/tray pode guardar os seus ficheiros neste dispositivo.",+ "This browser cannot reopen a file in place — Chrome or Edge can.": "Este navegador não consegue reescrever um ficheiro no lugar — o Chrome ou o Edge conseguem.",+ "Keep the file somewhere you can find it again.": "Guarde o ficheiro num sítio onde o consiga encontrar.",}diff --git a/slides/src/i18n/zh-Hans.ts b/slides/src/i18n/zh-Hans.tsindex daec4464..9731c833 100644--- a/slides/src/i18n/zh-Hans.ts+++ b/slides/src/i18n/zh-Hans.ts@@ -744,4 +744,12 @@ export const zhHans: Catalog = {"Appearance": "外观","Match my system": "跟随系统","Dark": "深色",+ "You saved a deck from here before.": "你之前从这里保存过一份幻灯片。",+ "This page always starts fresh. Open your file to carry on with it:": "此页面总是从新建开始。打开你的文件继续编辑:",+ "Start a new deck anyway": "仍然新建幻灯片",+ "This page always starts a new deck — open this file to come back to it.": "此页面总是新建一份幻灯片 — 打开此文件即可回到它。",+ "The bento/tray extension can reopen your files here.": "bento/tray 扩展可以在这里重新打开你的文件。",+ "The bento/tray app can keep your files on this device.": "bento/tray 应用可以把文件保存在此设备上。",+ "This browser cannot reopen a file in place — Chrome or Edge can.": "此浏览器无法就地重写文件 — Chrome 或 Edge 可以。",+ "Keep the file somewhere you can find it again.": "把文件保存在你以后能找到的位置。",}diff --git a/slides/src/i18n/zh-Hant.ts b/slides/src/i18n/zh-Hant.tsindex 7c7d77d4..bc893719 100644--- a/slides/src/i18n/zh-Hant.ts+++ b/slides/src/i18n/zh-Hant.ts@@ -744,4 +744,12 @@ export const zhHant: Catalog = {"Appearance": "外觀","Match my system": "跟隨系統","Dark": "深色",+ "You saved a deck from here before.": "你之前曾從這裡儲存過一份簡報。",+ "This page always starts fresh. Open your file to carry on with it:": "此頁面總是從新建開始。開啟你的檔案以繼續編輯:",+ "Start a new deck anyway": "仍要新建簡報",+ "This page always starts a new deck — open this file to come back to it.": "此頁面總是新建一份簡報 — 開啟此檔案即可回到它。",+ "The bento/tray extension can reopen your files here.": "bento/tray 擴充功能可以在這裡重新開啟你的檔案。",+ "The bento/tray app can keep your files on this device.": "bento/tray 應用程式可以將檔案保存在此裝置上。",+ "This browser cannot reopen a file in place — Chrome or Edge can.": "此瀏覽器無法就地覆寫檔案 — Chrome 或 Edge 可以。",+ "Keep the file somewhere you can find it again.": "請將檔案保存在你日後找得到的位置。",}diff --git a/slides/src/main.ts b/slides/src/main.tsindex d8c0113c..2cda9bf2 100644--- a/slides/src/main.ts+++ b/slides/src/main.ts@@ -11,8 +11,9 @@ import { startNetGuard } from '../../kernel/src/net.ts'import {capturePristine, readEmbeddedDoc, serializeFile, serializeAuto, downloadFile,suggestedFileName, parseEnvelope, decryptEnvelope, setEncryptionPassword,- registerPreview,+ registerPreview, canWriteInPlace, hostCan,} from './save'+import { maybeShowReturnGate } from './editor/returngate'import { buildSlidePreview } from './preview'import { APP_VERSION, checkForUpdates, buildUpdatedFile, applyUpdate } from './update'import { i18nApi, t, applyDirection } from './i18n'@@ -74,7 +75,11 @@ const envelope = embedded ? parseEnvelope(embedded) : nullif (envelope) {void passwordGate()} else {- bootWith((embedded && parseDoc(embedded)) || starterDoc())+ const parsed = embedded ? parseDoc(embedded) : null+ // Whether this is OUR starter or someone's document is knowable only here —+ // downstream the two are indistinguishable, and the difference is what stops+ // the return gate appearing over real work.+ bootWith(parsed || starterDoc(), !parsed)}/** Encrypted file: ask for the password (looping on failure), then boot. */@@ -119,9 +124,9 @@ async function passwordGate() {input.focus()}-function bootWith(doc: BentoDoc) {+function bootWith(doc: BentoDoc, docIsFresh = false) {if (doc.readonly) playerMode(doc)- else editorMode(doc)+ else editorMode(doc, docIsFresh)}/**@@ -154,7 +159,7 @@ function playerMode(doc: BentoDoc) {start()}-function editorMode(doc: BentoDoc) {+function editorMode(doc: BentoDoc, docIsFresh = false) {document.title = `${doc.title} — ${appConfig().appName}`@@ -165,6 +170,11 @@ if (doc.fonts?.length) injectFonts(doc)const store = new Store(doc)const editor = new Editor(document.getElementById('app')!, store)+// A returning visitor who saved from this origin before is told so, rather+// than handed a silent blank starter that reads as lost work. No-ops off the+// web, for a first-time visitor, and over any real document.+maybeShowReturnGate({ docIsFresh, fsAccess: canWriteInPlace(), canWrite: hostCan('write') })+// Live collaboration (bento-sync): same-machine tabs sync automatically over// BroadcastChannel; the online relay transport joins via the Share UI.const session = new SyncSession(store)diff --git a/slides/src/styles.css b/slides/src/styles.cssindex e1a62c23..c79b3fcd 100644--- a/slides/src/styles.css+++ b/slides/src/styles.css@@ -2400,3 +2400,66 @@ input.ed-toggle { width: 16px; height: 16px; accent-color: #5E7699; cursor: poin[dir="rtl"] .ed-chart-json {direction: ltr;}++/* ————— saved-from-the-web notice, and the return gate ————————————————————+ The web demo always starts a new deck. Someone who saved from it and came+ back got a blank starter and read it as lost work (docs/DECISIONS.md+ 2026-08-23). Two surfaces: a persistent line after a save, and a gate on the+ NEXT visit. Both use theme tokens rather than literals — the notice is+ chrome, and a chrome surface pinned to white turns light text onto a light+ background the moment a reader is in dark mode. */+.ed-savednote {+ position: fixed;+ bottom: 18px;+ inset-inline-start: 18px;+ z-index: 60;+ max-width: 340px;+ display: flex;+ flex-direction: column;+ gap: 3px;+ padding: 10px 14px;+ background: var(--surface);+ color: var(--ink);+ border: 1px solid var(--line);+ border-radius: 10px;+ box-shadow: 0 8px 26px rgb(15 23 36 / 0.18);+ font-size: 12.5px;+ line-height: 1.5;+}+.ed-savednote-name { font-size: 13px; word-break: break-all; }+.ed-savednote-body, .ed-savednote-offer { color: var(--muted); }++.ed-gate-overlay {+ position: fixed;+ inset: 0;+ z-index: 1500;+ background: rgb(15 23 36 / 0.38);+ display: flex;+ align-items: center;+ justify-content: center;+ padding: 20px;+}+.ed-gate-card {+ width: min(420px, 100%);+ background: var(--surface);+ color: var(--ink);+ border: 1px solid var(--line);+ border-radius: var(--radius);+ box-shadow: 0 18px 50px rgb(15 23 36 / 0.28);+ padding: 22px;+ display: flex;+ flex-direction: column;+ gap: 10px;+}+.ed-gate-h { margin: 0; font-size: 17px; }+.ed-gate-body { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--ink-2); }+.ed-gate-name {+ font-size: 13px;+ padding: 8px 10px;+ border-radius: 8px;+ background: var(--chrome);+ border: 1px solid var(--line);+ word-break: break-all;+}+.ed-gate-offer { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); }+.ed-gate-acts { display: flex; justify-content: flex-end; margin-top: 4px; }