Skip to content

armgit / bento

Public Imported from GitHub
0

Bento, the office suite that fits in a file

v0.8.5: Present moves to the work area as floating buttons

nyblnetc929ce69dd09
diff --git a/CLAUDE.md b/CLAUDE.md
index 478728ac..f00bb7b3 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -191,7 +191,10 @@ One HTML file = the document + viewer + editor. See `README.md` for the vision.
flush to the screen edge when collapsed); phones (<700px) boot with
both panels collapsed (canvas-first; chevrons/[/] bring them back).
Update chip sits beside the wordmark and exists ONLY when an update
- is found. Save is a dropdown: copy (identity-keeping invite) / new
+ is found. Present lives as FLOATING buttons over the canvas (not the
+ topbar): big round FAB = fullscreen present, small one above it =
+ tab-fill mode (testing/window-sharing); both call editor.present(
+ fromStart, fullscreen) → startPresentation opts.fullscreen. Save is a dropdown: copy (identity-keeping invite) / new
deck (fresh identity) / template. "Live" button popover: name field,
collaborator list (click follows), join/leave toasts. Deck buttons use
ONE invisible hit-rect above button+label (hard-won #7) — never put
diff --git a/slides/package.json b/slides/package.json
index dddb393b..8b033664 100644
--- a/slides/package.json
+++ b/slides/package.json
@@ -1,7 +1,7 @@
{
"name": "bento-slides",
"private": true,
- "version": "0.8.4",
+ "version": "0.8.5",
"type": "module",
"scripts": {
"dev": "vite",
diff --git a/slides/src/editor/editor.ts b/slides/src/editor/editor.ts
index 9e5d0aba..b8d9d2a1 100644
--- a/slides/src/editor/editor.ts
+++ b/slides/src/editor/editor.ts
@@ -204,11 +204,9 @@ export class Editor {
}, 1500)
const undoB = btn(ICONS.undo, '', () => this.store.undo(), t('Undo (⌘Z)'))
const redoB = btn(ICONS.redo, '', () => this.store.redo(), t('Redo (⇧⌘Z)'))
- const presentB = btn(ICONS.play, t('Present'), () => this.present(), t('Present from current slide — F toggles fullscreen, S opens speaker view, Esc ends'))
- presentB.classList.add('ed-btn-primary')
const saveB = btn(ICONS.save, t('Save'), () => this.save(false), t('Save — rewrite this file in place (⌘S)'))
const pdfB = btn(ICONS.pdf, '', () => this.exportPdf(), t('Export PDF (print)'))
- actions.append(undoB, redoB, pdfB, this.shareDropdown(), presentB, saveB, this.saveDropdown())
+ actions.append(undoB, redoB, pdfB, this.shareDropdown(), saveB, this.saveDropdown())
this.avatarsBox = div('ed-avatars')
bar.append(logo, this.updatesB, title, this.dirtyDot, this.avatarsBox, insert, actions)
@@ -217,6 +215,22 @@ export class Editor {
const main = div('ed-main')
this.sidebar = div('ed-sidebar')
const canvasWrap = div('ed-canvas-wrap')
+ // presenting is a canvas action: a floating pair over the work area —
+ // the big one goes fullscreen, the small one fills this tab (testing,
+ // sharing a window, projector quirks)
+ const fabs = div('ed-present-fabs')
+ const fsFab = document.createElement('button')
+ fsFab.className = 'ed-fab'
+ fsFab.innerHTML = ICONS.play
+ fsFab.title = t('Present fullscreen — F toggles fullscreen, S opens speaker view, Esc ends')
+ fsFab.addEventListener('click', () => this.present(false, true))
+ const tabFab = document.createElement('button')
+ tabFab.className = 'ed-fab ed-fab-small'
+ tabFab.innerHTML = ICONS.window
+ tabFab.title = t('Present in this tab — handy for testing or sharing a window')
+ tabFab.addEventListener('click', () => this.present(false, false))
+ fabs.append(tabFab, fsFab)
+ canvasWrap.appendChild(fabs)
this.props = div('ed-props')
main.append(this.sidebar, this.makeResizer('left'), canvasWrap, this.makeResizer('right'), this.props)
@@ -861,7 +875,7 @@ export class Editor {
// --- present & save ------------------------------------------------------------------
- present(fromStart = false) {
+ present(fromStart = false, fullscreen = true) {
if (this.presenting) return
this.canvas.commitTextEdit()
this.presenting = true
@@ -869,7 +883,7 @@ export class Editor {
this.presenting = false
this.store.goTo(last)
this.canvas.render()
- })
+ }, { fullscreen })
}
async save(forcePicker: boolean) {
diff --git a/slides/src/i18n/de.ts b/slides/src/i18n/de.ts
index 031f2a91..6d3abbf6 100644
--- a/slides/src/i18n/de.ts
+++ b/slides/src/i18n/de.ts
@@ -283,4 +283,6 @@ export const de: Catalog = {
"slide {n}": "Folie {n}",
"{name} joined": "{name} ist beigetreten",
"{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",
}
diff --git a/slides/src/i18n/es.ts b/slides/src/i18n/es.ts
index 3f530608..6e025d0f 100644
--- a/slides/src/i18n/es.ts
+++ b/slides/src/i18n/es.ts
@@ -283,4 +283,6 @@ export const es: Catalog = {
"slide {n}": "diapositiva {n}",
"{name} joined": "{name} se ha unido",
"{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",
}
diff --git a/slides/src/i18n/fr.ts b/slides/src/i18n/fr.ts
index 78bfa688..426a141e 100644
--- a/slides/src/i18n/fr.ts
+++ b/slides/src/i18n/fr.ts
@@ -283,4 +283,6 @@ export const fr: Catalog = {
"slide {n}": "diapositive {n}",
"{name} joined": "{name} a rejoint",
"{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",
}
diff --git a/slides/src/i18n/it.ts b/slides/src/i18n/it.ts
index c3097a85..2b36d3e1 100644
--- a/slides/src/i18n/it.ts
+++ b/slides/src/i18n/it.ts
@@ -283,4 +283,6 @@ export const it: Catalog = {
"slide {n}": "diapositiva {n}",
"{name} joined": "{name} si è unito",
"{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",
}
diff --git a/slides/src/i18n/ja.ts b/slides/src/i18n/ja.ts
index 5a03181c..df256069 100644
--- a/slides/src/i18n/ja.ts
+++ b/slides/src/i18n/ja.ts
@@ -283,4 +283,6 @@ export const ja: Catalog = {
"slide {n}": "スライド {n}",
"{name} joined": "{name} が参加しました",
"{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": "このタブ内でプレゼン — テストやウィンドウ共有に便利",
}
diff --git a/slides/src/i18n/zh-Hans.ts b/slides/src/i18n/zh-Hans.ts
index c7081d87..e7753f6f 100644
--- a/slides/src/i18n/zh-Hans.ts
+++ b/slides/src/i18n/zh-Hans.ts
@@ -283,4 +283,6 @@ export const zhHans: Catalog = {
"slide {n}": "第 {n} 页",
"{name} joined": "{name} 已加入",
"{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": "在此标签页中演示 — 便于测试或共享窗口",
}
diff --git a/slides/src/i18n/zh-Hant.ts b/slides/src/i18n/zh-Hant.ts
index 987ac40f..aea34e27 100644
--- a/slides/src/i18n/zh-Hant.ts
+++ b/slides/src/i18n/zh-Hant.ts
@@ -283,4 +283,6 @@ export const zhHant: Catalog = {
"slide {n}": "第 {n} 頁",
"{name} joined": "{name} 已加入",
"{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": "在此分頁中簡報 — 便於測試或分享視窗",
}
diff --git a/slides/src/icons.ts b/slides/src/icons.ts
index fcb68395..27542a55 100644
--- a/slides/src/icons.ts
+++ b/slides/src/icons.ts
@@ -23,6 +23,7 @@ export const ICONS = {
panelRight: svg('<rect x="3" y="4" width="18" height="16" rx="2"/><line x1="15" y1="4" x2="15" y2="20"/>'),
pdf: svg('<polyline points="6 9 6 3 18 3 18 9"/><path d="M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"/><rect x="6" y="14" width="12" height="8"/>'),
sync: svg('<path d="M21 12a9 9 0 1 1-2.64-6.36"/><polyline points="21 3 21 9 15 9"/>'),
+ window: svg('<rect x="3" y="5" width="18" height="14" rx="2"/><line x1="3" y1="9" x2="21" y2="9"/>'),
share: svg('<circle cx="9" cy="8" r="3.2"/><path d="M3.5 20c.6-3.2 2.8-5 5.5-5s4.9 1.8 5.5 5"/><circle cx="17.5" cy="10.5" r="2.4"/><path d="M15.8 15.6c1.9.3 3.6 1.6 4.4 3.9"/>'),
// shape menu entries
rect: svg('<rect x="3" y="5" width="18" height="14" rx="2"/>'),
diff --git a/slides/src/present.ts b/slides/src/present.ts
index 6232646c..58275f8d 100644
--- a/slides/src/present.ts
+++ b/slides/src/present.ts
@@ -21,6 +21,7 @@ export function startPresentation(
doc: BentoDoc,
startIndex: number,
onExit: (lastIndex: number) => void,
+ opts: { fullscreen?: boolean } = {},
): PresentSession {
const overlay = document.createElement('div')
overlay.className = 'bento-present-overlay'
@@ -207,7 +208,7 @@ export function startPresentation(
if (document.fullscreenElement) document.exitFullscreen().catch(() => {})
else enterFullscreen()
}
- enterFullscreen()
+ if (opts.fullscreen !== false) enterFullscreen()
const exit = () => {
if (exited) return
diff --git a/slides/src/styles.css b/slides/src/styles.css
index 0bfbd38d..3cc82354 100644
--- a/slides/src/styles.css
+++ b/slides/src/styles.css
@@ -1208,3 +1208,43 @@ body.ed-col-resizing { cursor: col-resize; user-select: none; }
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
+
+/* floating present buttons over the work area (zoombar sits below them) */
+.ed-present-fabs {
+ position: absolute;
+ right: 14px;
+ bottom: 64px;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 10px;
+ z-index: 11;
+}
+.ed-fab {
+ width: 52px;
+ height: 52px;
+ border-radius: 50%;
+ border: none;
+ background: #16273e;
+ color: #fff;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ cursor: pointer;
+ box-shadow: 0 6px 18px rgb(20 30 45 / 0.28);
+ transition: transform 0.12s ease, box-shadow 0.12s ease;
+}
+.ed-fab:hover {
+ transform: translateY(-1px);
+ box-shadow: 0 9px 24px rgb(20 30 45 / 0.34);
+}
+.ed-fab svg { width: 20px; height: 20px; }
+.ed-fab-small {
+ width: 32px;
+ height: 32px;
+ background: #fff;
+ color: #45566b;
+ border: 1px solid var(--line);
+ box-shadow: 0 3px 10px rgb(20 30 45 / 0.14);
+}
+.ed-fab-small svg { width: 15px; height: 15px; }