Skip to content

armgit / bento

Public Imported from GitHub
0

Bento, the office suite that fits in a file

Reduce-motion: toast confirmation on M + list M in the ? help

nyblnetc42e87bc4e58
diff --git a/slides/src/editor/editor.ts b/slides/src/editor/editor.ts
index 0787872e..14b61914 100644
--- a/slides/src/editor/editor.ts
+++ b/slides/src/editor/editor.ts
@@ -1703,6 +1703,7 @@ export class Editor {
['F5', t('Present')],
['F', t('Toggle fullscreen while presenting')],
['S', t('Speaker view — notes on a second screen if you have one')],
+ ['M', t('Reduce motion — pause animations (also honours your OS setting)')],
['← · →', t('Previous · next slide')],
['Esc', t('End the show')],
])
diff --git a/slides/src/i18n/de.ts b/slides/src/i18n/de.ts
index c5c1f54e..585b804a 100644
--- a/slides/src/i18n/de.ts
+++ b/slides/src/i18n/de.ts
@@ -4,6 +4,9 @@
import type { Catalog } from '../i18n'
export const de: Catalog = {
+ "Reduced motion: on": "Bewegung reduziert: an",
+ "Reduced motion: off": "Bewegung reduziert: aus",
+ "Reduce motion — pause animations (also honours your OS setting)": "Bewegung reduzieren — Animationen pausieren (berücksichtigt auch die OS-Einstellung)",
"Reduce motion (M)": "Bewegung reduzieren (M)",
"Morph": "Morph",
"Morph id": "Morph-ID",
diff --git a/slides/src/i18n/es.ts b/slides/src/i18n/es.ts
index 2e153058..c3914b78 100644
--- a/slides/src/i18n/es.ts
+++ b/slides/src/i18n/es.ts
@@ -4,6 +4,9 @@
import type { Catalog } from '../i18n'
export const es: Catalog = {
+ "Reduced motion: on": "Movimiento reducido: activado",
+ "Reduced motion: off": "Movimiento reducido: desactivado",
+ "Reduce motion — pause animations (also honours your OS setting)": "Reducir movimiento — pausa las animaciones (respeta también el ajuste del sistema)",
"Reduce motion (M)": "Reducir movimiento (M)",
"Morph": "Morph",
"Morph id": "Id de morph",
diff --git a/slides/src/i18n/fr.ts b/slides/src/i18n/fr.ts
index f6e83fb3..c9aedb57 100644
--- a/slides/src/i18n/fr.ts
+++ b/slides/src/i18n/fr.ts
@@ -4,6 +4,9 @@
import type { Catalog } from '../i18n'
export const fr: Catalog = {
+ "Reduced motion: on": "Animations réduites : activées",
+ "Reduced motion: off": "Animations réduites : désactivées",
+ "Reduce motion — pause animations (also honours your OS setting)": "Réduire les animations — met en pause les animations (respecte aussi le réglage du système)",
"Reduce motion (M)": "Réduire les animations (M)",
"Morph": "Morph",
"Morph id": "Id de morph",
diff --git a/slides/src/i18n/it.ts b/slides/src/i18n/it.ts
index c3a3214c..9f7abb75 100644
--- a/slides/src/i18n/it.ts
+++ b/slides/src/i18n/it.ts
@@ -4,6 +4,9 @@
import type { Catalog } from '../i18n'
export const it: Catalog = {
+ "Reduced motion: on": "Movimento ridotto: attivo",
+ "Reduced motion: off": "Movimento ridotto: disattivato",
+ "Reduce motion — pause animations (also honours your OS setting)": "Riduci il movimento — mette in pausa le animazioni (rispetta anche l’impostazione del sistema)",
"Reduce motion (M)": "Riduci il movimento (M)",
"Morph": "Morph",
"Morph id": "Id morph",
diff --git a/slides/src/i18n/ja.ts b/slides/src/i18n/ja.ts
index 47c91182..74b44742 100644
--- a/slides/src/i18n/ja.ts
+++ b/slides/src/i18n/ja.ts
@@ -4,6 +4,9 @@
import type { Catalog } from '../i18n'
export const ja: Catalog = {
+ "Reduced motion: on": "モーション軽減:オン",
+ "Reduced motion: off": "モーション軽減:オフ",
+ "Reduce motion — pause animations (also honours your OS setting)": "モーションを減らす — アニメーションを一時停止(OS設定にも従います)",
"Reduce motion (M)": "モーションを減らす (M)",
"Morph": "モーフ",
"Morph id": "モーフ id",
diff --git a/slides/src/i18n/zh-Hans.ts b/slides/src/i18n/zh-Hans.ts
index e8acb732..342193a0 100644
--- a/slides/src/i18n/zh-Hans.ts
+++ b/slides/src/i18n/zh-Hans.ts
@@ -4,6 +4,9 @@
import type { Catalog } from '../i18n'
export const zhHans: Catalog = {
+ "Reduced motion: on": "减少动态效果:开",
+ "Reduced motion: off": "减少动态效果:关",
+ "Reduce motion — pause animations (also honours your OS setting)": "减少动态效果 — 暂停动画(也遵循系统设置)",
"Reduce motion (M)": "减少动态效果 (M)",
"Morph": "变形",
"Morph id": "变形 id",
diff --git a/slides/src/i18n/zh-Hant.ts b/slides/src/i18n/zh-Hant.ts
index e2e3f8f5..1da32366 100644
--- a/slides/src/i18n/zh-Hant.ts
+++ b/slides/src/i18n/zh-Hant.ts
@@ -4,6 +4,9 @@
import type { Catalog } from '../i18n'
export const zhHant: Catalog = {
+ "Reduced motion: on": "減少動態效果:開",
+ "Reduced motion: off": "減少動態效果:關",
+ "Reduce motion — pause animations (also honours your OS setting)": "減少動態效果 — 暫停動畫(也遵循系統設定)",
"Reduce motion (M)": "減少動態效果 (M)",
"Morph": "變形",
"Morph id": "變形 id",
diff --git a/slides/src/present.ts b/slides/src/present.ts
index 58638447..e38aa612 100644
--- a/slides/src/present.ts
+++ b/slides/src/present.ts
@@ -241,10 +241,25 @@ export function startPresentation(
nav('reduce')?.classList.toggle('active', reduceMotion)
}
+ // A brief centred pill so a keypress (M) gives visible confirmation — the
+ // audience overlay otherwise changes silently.
+ let toastTimer = 0
+ const flashPresentMsg = (text: string) => {
+ let el = overlay.querySelector<HTMLElement>('.bento-present-toast')
+ if (!el) { el = document.createElement('div'); el.className = 'bento-present-toast'; overlay.appendChild(el) }
+ el.textContent = text
+ el.classList.remove('show'); void el.offsetWidth; el.classList.add('show') // restart the fade
+ clearTimeout(toastTimer)
+ toastTimer = window.setTimeout(() => el!.classList.remove('show'), 1400)
+ }
+
const setReduceMotion = (on: boolean, persist = true) => {
reduceMotion = on
if (persist) { try { localStorage.setItem('bento-reduce-motion', on ? 'on' : 'off') } catch { /* storage off */ } }
overlay.classList.toggle('reduce-motion', on)
+ // Toast only on an explicit toggle (M / speaker button), not the silent
+ // OS-preference follow or the initial state.
+ if (persist) flashPresentMsg(on ? t('Reduced motion: on') : t('Reduced motion: off'))
// Re-settle the CURRENT slide: kill any running tweens and restore final
// frames (a killed entrance would otherwise strand an element at opacity 0);
// if motion is back on, replay this slide's entrance + ambient fx.
diff --git a/slides/src/styles.css b/slides/src/styles.css
index 5d3d2757..fe003060 100644
--- a/slides/src/styles.css
+++ b/slides/src/styles.css
@@ -1358,6 +1358,24 @@ body.ed-col-resizing { cursor: col-resize; user-select: none; }
}
.bento-blackout[hidden] { display: none; }
+/* transient confirmation pill in present mode (e.g. Reduced motion on/off) */
+.bento-present-toast {
+ position: absolute;
+ left: 50%;
+ bottom: 48px;
+ transform: translateX(-50%);
+ z-index: 61;
+ background: rgb(20 30 45 / 0.82);
+ color: #fff;
+ font-size: 14px;
+ padding: 8px 16px;
+ border-radius: 999px;
+ pointer-events: none;
+ opacity: 0;
+ transition: opacity 0.25s ease;
+}
+.bento-present-toast.show { opacity: 1; }
+
/* --- live collaboration ----------------------------------------------- */
.ed-avatars {
display: flex;