Skip to content

armgit / bento

Public Imported from GitHub
0

Bento, the office suite that fits in a file

UX: Slideshow split pill beside zoom; fixed Save split; share tooltips + divider

nyblnet97cdda8595b3
diff --git a/slides/src/editor/editor.ts b/slides/src/editor/editor.ts
index 3a2e49e6..6bcd356b 100644
--- a/slides/src/editor/editor.ts
+++ b/slides/src/editor/editor.ts
@@ -275,27 +275,35 @@ 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))
- const spkFab = document.createElement('button')
- spkFab.className = 'ed-fab ed-fab-small'
- spkFab.innerHTML = ICONS.presenter
- spkFab.title = t('Open the speaker view — notes, controls and thumbnails in a separate window (drag it to a second screen)')
- spkFab.addEventListener('click', () => this.openSpeakerView())
- fabs.append(fsFab, tabFab, spkFab)
- canvasWrap.appendChild(fabs)
+ // presenting lives in ONE split pill beside the zoom control: the main
+ // half starts the fullscreen show; its menu holds tab-fill and speaker view.
+ const pill = div('ed-dropdown ed-present-pill')
+ const showB = btn(ICONS.slideshow, t('Slideshow'), () => this.present(false, true),
+ t('Start the slideshow fullscreen — F toggles fullscreen, S opens speaker view, Esc ends'))
+ showB.classList.add('ed-pill-main')
+ const caret = btn('<span class="ed-caret">▾</span>', '', () => pill.classList.toggle('open'),
+ t('More ways to present'))
+ caret.classList.add('ed-pill-caret')
+ const pmenu = div('ed-menu')
+ const pItem = (label: string, title: string, onClick: () => void) => {
+ const b = btn('', label, () => { pill.classList.remove('open'); onClick() }, title)
+ pmenu.appendChild(b)
+ }
+ pItem(t('Present in this tab'), t('Fills this tab instead of going fullscreen — handy for testing or sharing a window'), () => this.present(false, false))
+ pItem(t('Open speaker view'), t('Notes, controls and slide thumbnails in a separate window — drag it to a second screen'), () => this.openSpeakerView())
+ pill.append(showB, caret, pmenu)
+ document.addEventListener('pointerdown', (ev) => {
+ if (!pill.contains(ev.target as Node)) pill.classList.remove('open')
+ })
+ // shared bottom-right cluster: [Slideshow pill] [zoom pill] — the canvas
+ // appends its zoombar to canvasWrap; we adopt it into the cluster below.
+ const corner = div('ed-corner-br')
+ corner.appendChild(pill)
+ canvasWrap.appendChild(corner)
+ queueMicrotask(() => {
+ const zb = canvasWrap.querySelector('.ed-zoombar')
+ if (zb) corner.appendChild(zb)
+ })
this.props = div('ed-props')
main.append(this.sidebar, this.makeResizer('left'), canvasWrap, this.makeResizer('right'), this.props)
@@ -650,10 +658,11 @@ export class Editor {
panel.appendChild(e)
return e
}
- const action = (label: string, primary: boolean, onClick: () => void) => {
+ const action = (label: string, primary: boolean, onClick: () => void, title = '') => {
const b = document.createElement('button')
b.className = primary ? 'ed-btn ed-btn-primary ed-share-btn' : 'ed-btn ed-share-btn'
b.textContent = label
+ if (title) b.title = title
b.addEventListener('click', onClick)
panel.appendChild(b)
return b
@@ -663,6 +672,7 @@ export class Editor {
const nameRow = div('ed-share-name')
const nameLabel = document.createElement('label')
nameLabel.textContent = t('Your name')
+ nameRow.title = t('Shown next to your cursor and in the People list — stored only in this browser.')
const nameInput = document.createElement('input')
nameInput.type = 'text'
nameInput.placeholder = t('Guest')
@@ -756,11 +766,14 @@ export class Editor {
// turns the live session on so whoever opens it lands in the room with you.
const canWrite = !!cme && cme.role !== 'reader'
if (canWrite) {
- action(t('Invite to edit — save a copy to send…'), true, () => void this.inviteToEdit())
- action(t('Share view-only copy…'), false, () => void this.saveReaderCopy())
- action(t('Export present-only file…'), false, () => void this.savePresentationPackage())
- action(t('Share as template…'), false, () => void this.saveAsTemplate())
- .title = t('A reusable starter: everyone who opens it gets their own fresh, independent deck.')
+ action(t('Invite to edit — save a copy to send…'), true, () => void this.inviteToEdit(),
+ t('Saves a copy that edits this deck live with you. You stay the owner and can remove them later from the People list.'))
+ action(t('Share view-only copy…'), false, () => void this.saveReaderCopy(),
+ t('A live viewer: it follows every edit as it happens but can never change the deck — the relay enforces it.'))
+ action(t('Export present-only file…'), false, () => void this.savePresentationPackage(),
+ t('A sealed hand-out that opens straight into the show — no editor, no live connection.'))
+ action(t('Share as template…'), false, () => void this.saveAsTemplate(),
+ t('A reusable starter: everyone who opens it gets their own fresh, independent deck.'))
note(t('Whoever opens your copy joins this deck live. Everything is end-to-end encrypted — the relay only ever sees ciphertext.'))
} else {
note(t('This is a view-only copy — it follows the live session but can’t change the deck.'))
@@ -768,15 +781,17 @@ export class Editor {
// advanced session controls, deliberately quiet at the bottom
if (canWrite) {
+ panel.appendChild(div('ed-share-sep'))
if (on) {
action(t('Stop sharing'), false, () => {
if (!this.session) return
stopSharing(this.session, this.store)
this.wireOnlineStatus()
this.renderSharePanel()
- })
+ }, t('Disconnect this deck from the live session. Copies keep their last state and can rejoin if you go live again.'))
} else {
- action(t('Go live without sharing a copy'), false, () => void this.goLive().then(() => this.renderSharePanel()))
+ action(t('Go live without sharing a copy'), false, () => void this.goLive().then(() => this.renderSharePanel()),
+ t('Connect to the live session now — copies you sent earlier will meet you there.'))
}
action(t('Reset access — cut off every copy sent so far'), false, async () => {
if (!this.session) return
@@ -784,7 +799,7 @@ export class Editor {
await rotateKeys(this.session, this.store)
this.toast(t('Access reset — only copies saved from now on can join'))
this.renderSharePanel()
- })
+ }, t('Mints brand-new keys. Every previously sent copy stops syncing for good; share fresh copies afterwards.'))
}
}
diff --git a/slides/src/editor/panels.ts b/slides/src/editor/panels.ts
index faefc22f..5ad643f5 100644
--- a/slides/src/editor/panels.ts
+++ b/slides/src/editor/panels.ts
@@ -279,7 +279,7 @@ export class PropsPanel {
const notesHint = document.createElement('p')
notesHint.className = 'ed-hint'
notesHint.innerHTML =
- t('Open the <b>speaker view</b> — the button below the slide, or <b>S</b> while presenting — for a separate window with these notes, the current and next slide, a timer, a thumbnail rail to jump anywhere, and a black-screen key. Move it to a second screen and present as usual.') +
+ t('Open the <b>speaker view</b> — in the Slideshow menu at the bottom right, or <b>S</b> while presenting — for a separate window with these notes, the current and next slide, a timer, a thumbnail rail to jump anywhere, and a black-screen key. Move it to a second screen and present as usual.') +
(isMacOS() ? ' ' + t('On macOS, open it BEFORE you go fullscreen — otherwise it lands on the slides’ screen.') : '')
this.host.appendChild(notesHint)
}
diff --git a/slides/src/icons.ts b/slides/src/icons.ts
index da8a2a01..9eb55c17 100644
--- a/slides/src/icons.ts
+++ b/slides/src/icons.ts
@@ -32,6 +32,7 @@ export const ICONS = {
connector: svg('<circle cx="5" cy="19" r="2.4"/><circle cx="19" cy="5" r="2.4"/><path d="M7 17 L 17 7"/>'),
freeform: svg('<path d="M3 17 C 6 7, 9 21, 12 12 S 18 4, 21 9"/>'),
polygon: svg('<polygon points="12 3 21 10 17 20 7 20 3 10"/>'),
+ slideshow: svg('<rect x="3" y="4" width="18" height="12" rx="2"/><polygon points="10 7.5 15 10 10 12.5" fill="currentColor" stroke="none"/><line x1="12" y1="16" x2="12" y2="20"/><line x1="8" y1="20" x2="16" y2="20"/>'),
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"/>'),
table: svg('<rect x="3" y="4" width="18" height="16" rx="2"/><line x1="3" y1="9" x2="21" y2="9"/><line x1="3" y1="14.5" x2="21" y2="14.5"/><line x1="9" y1="4" x2="9" y2="20"/><line x1="15" y1="4" x2="15" y2="20"/>'),
// shape menu entries
diff --git a/slides/src/styles.css b/slides/src/styles.css
index 9b228762..0de64b61 100644
--- a/slides/src/styles.css
+++ b/slides/src/styles.css
@@ -1420,25 +1420,65 @@ body.ed-col-resizing { cursor: col-resize; user-select: none; }
.ed-share-btn:not(.ed-btn-primary):hover { background: var(--chrome-2, #e8ebf1); }
.ed-share-btn { width: 100%; text-align: center; }
-/* Save is a split button: [ Save |▾] one visual unit */
+/* Save is a split button: [ Save |▾] one visual unit. The caret button is
+ NESTED inside the .ed-dropdown wrapper, so stretch through the wrapper. */
.ed-split { display: inline-flex; align-items: stretch; }
.ed-split > .ed-btn:first-child {
- border-top-right-radius: 0;
- border-bottom-right-radius: 0;
+ border-radius: 8px 0 0 8px;
border: 1px solid var(--line);
border-right: none;
background: var(--chrome, #f2f4f8);
}
+.ed-split .ed-dropdown { display: flex; align-items: stretch; }
.ed-split-caret {
- border-top-left-radius: 0 !important;
- border-bottom-left-radius: 0 !important;
+ height: 100%;
+ display: inline-flex;
+ align-items: center;
+ border-radius: 0 8px 8px 0;
border: 1px solid var(--line);
background: var(--chrome, #f2f4f8);
- padding: 6px 6px;
+ padding: 6px 7px;
}
-.ed-split > .ed-btn:hover { background: var(--chrome-2, #e8ebf1); }
+.ed-split .ed-btn:hover { background: var(--chrome-2, #e8ebf1); }
.ed-caret { font-size: 10px; line-height: 1; }
+/* quiet divider between share actions and advanced session controls */
+.ed-share-sep { height: 1px; background: var(--line); margin: 2px 0; }
+
+/* bottom-right cluster: [Slideshow pill] [zoom pill] */
+.ed-corner-br {
+ position: absolute;
+ right: 14px;
+ bottom: 14px;
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ z-index: 11;
+}
+.ed-corner-br .ed-zoombar { position: static; }
+.ed-present-pill {
+ display: inline-flex;
+ align-items: stretch;
+ background: #fff;
+ border: 1px solid var(--line);
+ border-radius: 999px;
+ box-shadow: 0 4px 14px rgb(20 30 45 / 0.10);
+ overflow: visible;
+}
+.ed-present-pill .ed-pill-main {
+ border-radius: 999px 0 0 999px;
+ padding: 6px 10px 6px 14px;
+ font-weight: 600;
+}
+.ed-present-pill .ed-pill-caret {
+ border-radius: 0 999px 999px 0;
+ border-left: 1px solid var(--line);
+ padding: 6px 10px 6px 7px;
+}
+.ed-present-pill .ed-btn:hover { background: var(--chrome, #f2f4f8); }
+/* its menu drops UP (the pill sits at the bottom edge) */
+.ed-present-pill .ed-menu { top: auto; bottom: calc(100% + 6px); left: auto; right: 0; }
+
.ed-share-peers { display: flex; flex-direction: column; gap: 2px; max-height: 240px; overflow-y: auto; }
.ed-share-peer {
display: flex;
@@ -1602,44 +1642,7 @@ body.ed-col-resizing { cursor: col-resize; user-select: none; }
/* floating present buttons, bottom-LEFT of the work area (zoombar owns the
right corner); side by side so neither ever covers the slide above */
-.ed-present-fabs {
- position: absolute;
- left: 14px;
- bottom: 14px;
- display: flex;
- flex-direction: row;
- 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; }
+
/* right panel: no horizontal scrollbar, ever */
.ed-props {