Bento, the office suite that fits in a file
TypeScript mit-licenseofficeoffice-365office-suiteoffice-toolsoffice365open-sourcepowerpointself-hostedsingle-page-appslidesslideshareslideshowslideshow-galleryslideshow-makerslideshows
v0.8.7: fullscreen-exit ends show, swipe navigation, deck page sizes
nyblnetb6f9ce08f3bb
diff --git a/CLAUDE.md b/CLAUDE.mdindex 02d5faec..794eb988 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -195,7 +195,15 @@ One HTML file = the document + viewer + editor. See `README.md` for the vision.(zoombar owns the right corner): big round FAB = fullscreen present,small one BESIDE it (never above — it would cover the slide) =tab-fill mode (testing/window-sharing); both call editor.present(- fromStart, fullscreen) → startPresentation opts.fullscreen. Save is a dropdown: copy (identity-keeping invite) / new+ fromStart, fullscreen) → startPresentation opts.fullscreen. Leaving+ fullscreen (Esc/F/browser UI) ENDS the show — it never drops to+ tab-fill (fullscreenchange listener; tab mode only via the small+ FAB). Touch: our own swipe nav (Reveal touch OFF — it would walk+ into hidden states); swiping past either end exits to the editor.+ Deck PAGE SIZE: presets + custom in the slide panel (doc.size —+ already per-doc in the format); print @page is generated per-deck+ (width normalised to 1600, height follows aspect). Size changes+ reframe the canvas, never rescale elements. Save is a dropdown: copy (identity-keeping invite) / newdeck (fresh identity) / template. "Live" button popover: name field,collaborator list (click follows), join/leave toasts. Deck buttons useONE invisible hit-rect above button+label (hard-won #7) — never putdiff --git a/slides/package.json b/slides/package.jsonindex 61f60771..6db0fa44 100644--- a/slides/package.json+++ b/slides/package.json@@ -1,7 +1,7 @@{"name": "bento-slides","private": true,- "version": "0.8.6",+ "version": "0.8.7","type": "module","scripts": {"dev": "vite",diff --git a/slides/src/editor/editor.ts b/slides/src/editor/editor.tsindex 21bd7e51..54ce6fbf 100644--- a/slides/src/editor/editor.ts+++ b/slides/src/editor/editor.ts@@ -825,6 +825,11 @@ export class Editor {document.getElementById('bento-print')?.remove()const box = div('')box.id = 'bento-print'+ // page geometry follows the deck's aspect (width normalised to 1600)+ const pageH = Math.round((1600 * this.store.doc.size.height) / this.store.doc.size.width)+ const pageCss = document.createElement('style')+ 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) continueconst page = div('bp-page')diff --git a/slides/src/editor/panels.ts b/slides/src/editor/panels.tsindex cf689e9e..8e1ebe4b 100644--- a/slides/src/editor/panels.ts+++ b/slides/src/editor/panels.ts@@ -117,9 +117,38 @@ export class PropsPanel {// --- builders ---------------------------------------------------------------+ private static readonly PAGE_PRESETS: Record<string, { w: number; h: number }> = {+ 'Widescreen 16:9': { w: 1600, h: 900 },+ 'Classic 4:3': { w: 1200, h: 900 },+ 'Square 1:1': { w: 1080, h: 1080 },+ 'Portrait 9:16': { w: 1080, h: 1920 },+ 'A4 landscape': { w: 1123, h: 794 },+ 'A4 portrait': { w: 794, h: 1123 },+ }+private buildSlidePanel() {const slide = this.store.slidethis.section(t('Slide'))+ // deck-wide page size: presets + custom. Elements keep their absolute+ // positions — a size change reframes the canvas, it never rescales art.+ const { width: dw, height: dh } = this.store.doc.size+ const presetKey =+ Object.entries(PropsPanel.PAGE_PRESETS).find(([, s]) => s.w === dw && s.h === dh)?.[0] ?? 'Custom…'+ this.row(t('Page size'), this.select(+ [...Object.keys(PropsPanel.PAGE_PRESETS), 'Custom…'],+ presetKey,+ (v) => {+ const s = PropsPanel.PAGE_PRESETS[v]+ if (s) this.edit(() => { this.store.doc.size = { width: s.w, height: s.h } }, true)+ else this.rebuild(true) // custom: just reveal the W/H inputs+ },+ ))+ if (presetKey === 'Custom…') {+ this.row(t('Width'), this.number(dw, 10, (v, fin) =>+ this.edit(() => { this.store.doc.size.width = Math.max(320, Math.min(4000, Math.round(v))) }, fin)))+ this.row(t('Height'), this.number(dh, 10, (v, fin) =>+ this.edit(() => { this.store.doc.size.height = Math.max(320, Math.min(4000, Math.round(v))) }, fin)))+ }this.row(t('Background'), this.color(slide.background, (v, fin) =>this.edit(() => { this.store.slide.background = v }, fin)))this.row(t('Transition'), this.select(diff --git a/slides/src/i18n/de.ts b/slides/src/i18n/de.tsindex 6d3abbf6..75bceb01 100644--- a/slides/src/i18n/de.ts+++ b/slides/src/i18n/de.ts@@ -285,4 +285,14 @@ export const de: Catalog = {"{name} left": "{name} hat verlassen","Present fullscreen — F toggles fullscreen, S opens speaker view, Esc ends": "Im Vollbild präsentieren — F wechselt Vollbild, S öffnet die Referentenansicht, Esc beendet","Present in this tab — handy for testing or sharing a window": "In diesem Tab präsentieren — praktisch zum Testen oder Teilen eines Fensters",+ "Page size": "Seitengröße",+ "Width": "Breite",+ "Height": "Höhe",+ "Widescreen 16:9": "Breitbild 16:9",+ "Classic 4:3": "Klassisch 4:3",+ "Square 1:1": "Quadrat 1:1",+ "Portrait 9:16": "Hochformat 9:16",+ "A4 landscape": "A4 quer",+ "A4 portrait": "A4 hoch",+ "Custom…": "Benutzerdefiniert…",}diff --git a/slides/src/i18n/es.ts b/slides/src/i18n/es.tsindex 6e025d0f..6408e8ca 100644--- a/slides/src/i18n/es.ts+++ b/slides/src/i18n/es.ts@@ -285,4 +285,14 @@ export const es: Catalog = {"{name} left": "{name} se ha ido","Present fullscreen — F toggles fullscreen, S opens speaker view, Esc ends": "Presentar a pantalla completa — F alterna pantalla completa, S abre la vista de ponente, Esc termina","Present in this tab — handy for testing or sharing a window": "Presentar en esta pestaña — útil para probar o compartir una ventana",+ "Page size": "Tamaño de página",+ "Width": "Ancho",+ "Height": "Alto",+ "Widescreen 16:9": "Panorámico 16:9",+ "Classic 4:3": "Clásico 4:3",+ "Square 1:1": "Cuadrado 1:1",+ "Portrait 9:16": "Vertical 9:16",+ "A4 landscape": "A4 horizontal",+ "A4 portrait": "A4 vertical",+ "Custom…": "Personalizado…",}diff --git a/slides/src/i18n/fr.ts b/slides/src/i18n/fr.tsindex 426a141e..50ef7407 100644--- a/slides/src/i18n/fr.ts+++ b/slides/src/i18n/fr.ts@@ -285,4 +285,14 @@ export const fr: Catalog = {"{name} left": "{name} est parti","Present fullscreen — F toggles fullscreen, S opens speaker view, Esc ends": "Présenter en plein écran — F bascule le plein écran, S ouvre la vue présentateur, Échap termine","Present in this tab — handy for testing or sharing a window": "Présenter dans cet onglet — pratique pour tester ou partager une fenêtre",+ "Page size": "Taille de page",+ "Width": "Largeur",+ "Height": "Hauteur",+ "Widescreen 16:9": "Large 16:9",+ "Classic 4:3": "Classique 4:3",+ "Square 1:1": "Carré 1:1",+ "Portrait 9:16": "Portrait 9:16",+ "A4 landscape": "A4 paysage",+ "A4 portrait": "A4 portrait",+ "Custom…": "Personnalisé…",}diff --git a/slides/src/i18n/it.ts b/slides/src/i18n/it.tsindex 2b36d3e1..b8dfd45a 100644--- a/slides/src/i18n/it.ts+++ b/slides/src/i18n/it.ts@@ -285,4 +285,14 @@ export const it: Catalog = {"{name} left": "{name} se n'è andato","Present fullscreen — F toggles fullscreen, S opens speaker view, Esc ends": "Presenta a schermo intero — F alterna lo schermo intero, S apre la vista relatore, Esc termina","Present in this tab — handy for testing or sharing a window": "Presenta in questa scheda — utile per testare o condividere una finestra",+ "Page size": "Dimensioni pagina",+ "Width": "Larghezza",+ "Height": "Altezza",+ "Widescreen 16:9": "Widescreen 16:9",+ "Classic 4:3": "Classico 4:3",+ "Square 1:1": "Quadrato 1:1",+ "Portrait 9:16": "Verticale 9:16",+ "A4 landscape": "A4 orizzontale",+ "A4 portrait": "A4 verticale",+ "Custom…": "Personalizzato…",}diff --git a/slides/src/i18n/ja.ts b/slides/src/i18n/ja.tsindex df256069..b8c9a039 100644--- a/slides/src/i18n/ja.ts+++ b/slides/src/i18n/ja.ts@@ -285,4 +285,14 @@ export const ja: Catalog = {"{name} left": "{name} が退出しました","Present fullscreen — F toggles fullscreen, S opens speaker view, Esc ends": "全画面でプレゼン — F で全画面切替、S で発表者ビュー、Esc で終了","Present in this tab — handy for testing or sharing a window": "このタブ内でプレゼン — テストやウィンドウ共有に便利",+ "Page size": "ページサイズ",+ "Width": "幅",+ "Height": "高さ",+ "Widescreen 16:9": "ワイド 16:9",+ "Classic 4:3": "クラシック 4:3",+ "Square 1:1": "正方形 1:1",+ "Portrait 9:16": "縦型 9:16",+ "A4 landscape": "A4 横",+ "A4 portrait": "A4 縦",+ "Custom…": "カスタム…",}diff --git a/slides/src/i18n/zh-Hans.ts b/slides/src/i18n/zh-Hans.tsindex e7753f6f..5e7657c1 100644--- a/slides/src/i18n/zh-Hans.ts+++ b/slides/src/i18n/zh-Hans.ts@@ -285,4 +285,14 @@ export const zhHans: Catalog = {"{name} left": "{name} 已离开","Present fullscreen — F toggles fullscreen, S opens speaker view, Esc ends": "全屏演示 — F 切换全屏,S 打开演讲者视图,Esc 结束","Present in this tab — handy for testing or sharing a window": "在此标签页中演示 — 便于测试或共享窗口",+ "Page size": "页面尺寸",+ "Width": "宽度",+ "Height": "高度",+ "Widescreen 16:9": "宽屏 16:9",+ "Classic 4:3": "经典 4:3",+ "Square 1:1": "正方形 1:1",+ "Portrait 9:16": "竖屏 9:16",+ "A4 landscape": "A4 横向",+ "A4 portrait": "A4 纵向",+ "Custom…": "自定义…",}diff --git a/slides/src/i18n/zh-Hant.ts b/slides/src/i18n/zh-Hant.tsindex aea34e27..654314dd 100644--- a/slides/src/i18n/zh-Hant.ts+++ b/slides/src/i18n/zh-Hant.ts@@ -285,4 +285,14 @@ export const zhHant: Catalog = {"{name} left": "{name} 已離開","Present fullscreen — F toggles fullscreen, S opens speaker view, Esc ends": "全螢幕簡報 — F 切換全螢幕,S 開啟簡報者檢視,Esc 結束","Present in this tab — handy for testing or sharing a window": "在此分頁中簡報 — 便於測試或分享視窗",+ "Page size": "頁面尺寸",+ "Width": "寬度",+ "Height": "高度",+ "Widescreen 16:9": "寬螢幕 16:9",+ "Classic 4:3": "傳統 4:3",+ "Square 1:1": "正方形 1:1",+ "Portrait 9:16": "直向 9:16",+ "A4 landscape": "A4 橫向",+ "A4 portrait": "A4 直向",+ "Custom…": "自訂…",}diff --git a/slides/src/present.ts b/slides/src/present.tsindex 58275f8d..d38d255b 100644--- a/slides/src/present.ts+++ b/slides/src/present.ts@@ -78,6 +78,21 @@ export function startPresentation(if (!isState(i)) return deck.slide(i, 0)}}+ const hasNext = () => {+ const cur = deck.getIndices().h+ for (let i = (isState(cur) ? anchorOf(cur) : cur) + 1; i < doc.slides.length; i++) {+ if (!isState(i)) return true+ }+ return false+ }+ const hasPrev = () => {+ const cur = deck.getIndices().h+ if (isState(cur)) return true // right-swipe returns to the parent slide+ for (let i = cur - 1; i >= 0; i--) {+ if (!isState(i)) return true+ }+ return false+ }const visibleIndex = (i: number) => doc.slides.slice(0, i + 1).filter((s) => !s.stateOf).lengthconst visibleTotal = doc.slides.filter((s) => !s.stateOf).length@@ -101,8 +116,8 @@ export function startPresentation(return [`${visibleIndex(i)} / ${visibleTotal}`]}) as any): false,- // swipes would walk into hidden state slides; arrows are handled below- touch: !doc.slides.some((s) => s.stateOf),+ // touch is handled by our own swipe logic below (state-aware + ends exit)+ touch: false,// heavy decks: paint only the neighbourhood of the current slideviewDistance: 1,keyboardCondition: null,@@ -208,6 +223,15 @@ export function startPresentation(if (document.fullscreenElement) document.exitFullscreen().catch(() => {})else enterFullscreen()}+ // leaving fullscreen — Esc, F, the browser's own UI, an OS gesture —+ // ends the show outright; it never drops into tab-fill mode. (Tab mode+ // is only ever entered deliberately, via the small present button.)+ let wentFullscreen = false+ const onFsChange = () => {+ if (document.fullscreenElement === overlay) wentFullscreen = true+ else if (wentFullscreen && !exited) exit()+ }+ document.addEventListener('fullscreenchange', onFsChange)if (opts.fullscreen !== false) enterFullscreen()const exit = () => {@@ -223,6 +247,7 @@ export function startPresentation(overlay.remove()window.removeEventListener('resize', onResize)document.removeEventListener('keydown', onKeydown, true)+ document.removeEventListener('fullscreenchange', onFsChange)clearInterval(speakerTimer)if (speaker && !speaker.closed) speaker.close()onExit(last)@@ -265,6 +290,29 @@ export function startPresentation(}document.addEventListener('keydown', onKeydown, true)+ // ——— touch: swipe left/right to navigate; swiping past either end of+ // the deck drops back into the editor (phones have no Esc) ———+ let touchX = 0+ let touchY = 0+ overlay.addEventListener('touchstart', (ev) => {+ touchX = ev.touches[0].clientX+ touchY = ev.touches[0].clientY+ }, { passive: true })+ overlay.addEventListener('touchend', (ev) => {+ const t0 = ev.changedTouches[0]+ if (!t0) return+ const dx = t0.clientX - touchX+ const dy = t0.clientY - touchY+ if (Math.abs(dx) < 50 || Math.abs(dx) < Math.abs(dy) * 1.2) return // a tap or a scroll+ if (dx < 0) {+ if (hasNext()) goNext()+ else exit()+ } else {+ if (hasPrev()) goPrev()+ else exit()+ }+ }, { passive: true })+deck.on('slidechanged', ((event: any) => {const from = event.previousSlide as HTMLElement | undefinedconst to = event.currentSlide as HTMLElement