Bento, the office suite that fits in a file
TypeScript mit-licenseofficeoffice-365office-suiteoffice-toolsoffice365open-sourcepowerpointself-hostedsingle-page-appslidesslideshareslideshowslideshow-galleryslideshow-makerslideshows
Present: reduce-motion toggle (M / speaker view / prefers-reduced-motion)
nyblnetc8bb26cc52b4
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 43e6a75a..059e256e 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -9,6 +9,17 @@ below opens files from every earlier version, and unknown fields are preserved.This project's versions roughly follow semantic-ish `0.MINOR.PATCH` while it ispre-1.0.+## [Unreleased]++- **Reduce motion during a presentation.** A calmer show for motion sensitivity,+ a laggy projector, or a weak machine. It honours the OS *prefers-reduced-motion*+ setting automatically; the presenter can also toggle it with **M** (or the ⏸+ button in speaker view). When on, slide transitions cut instantly and every+ animation — morph, entrance staggers, count-ups, dash-march / motion-path loops,+ ken-burns — is skipped, so elements just show their final state. It's a+ viewer/presenter preference (persisted per browser), never written into the+ document.+## [1.0.7] — 2026-07-22- **In-place update keeps its handle.** When a deck opened *without* a Filediff --git a/CLAUDE.md b/CLAUDE.mdindex 06cf7a77..47ac06c4 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -85,7 +85,17 @@ One HTML file = the document + viewer + editor. See `README.md` for the vision.out/in are one-shot settles per slide entry), `loop` dash-march/motion-path), `link`(click → slide id) and `group`; slides can set `hover:'focus-group'` (dim othergroups). Present arrows are handled capture-phase (focus-proof). Editing UI for- fx/link lives in the panel's "Presenting" section. Motion-path loops are edited+ fx/link lives in the panel's "Presenting" section.+ **Reduced motion (v1.0.8)**: a VIEWER/PRESENTER preference (localStorage+ `bento-reduce-motion` 'on'/'off', default = OS `prefers-reduced-motion`),+ never in the doc — mirrors how locale is viewer-scoped. Toggle with `M` or the+ ⏸ speaker-view button (`setReduceMotion`/`toggleReduceMotion`). When on, the+ fx call sites in `slidechanged`/init are gated OFF (no runMorph/runEnterFx/+ runAmbientFx/restartSvgAnimations — elements render at their final frame,+ count-ups show final values) and the `.reduce-motion` overlay class kills+ CSS motion (Reveal section transitions + svg keyframe animations). Toggling+ mid-show re-settles the current slide: kill tweens + applyElementFrame, and+ replay enter/ambient fx if motion came back on. Motion-path loops are editedvisually on canvas (`editor/patheditor.ts`) — a HYBRID bezier editor built onthe shared `editor/bezier.ts` core (same exact-cubic engine as the shape-curveeditor). Waypoints are AUTO by default: their in/out tangents are auto-computeddiff --git a/slides/src/i18n/de.ts b/slides/src/i18n/de.tsindex a20d2808..c5c1f54e 100644--- a/slides/src/i18n/de.ts+++ b/slides/src/i18n/de.ts@@ -4,6 +4,7 @@import type { Catalog } from '../i18n'export const de: Catalog = {+ "Reduce motion (M)": "Bewegung reduzieren (M)","Morph": "Morph","Morph id": "Morph-ID","Pair with": "Verknüpfen mit",diff --git a/slides/src/i18n/es.ts b/slides/src/i18n/es.tsindex 0d2608c4..2e153058 100644--- a/slides/src/i18n/es.ts+++ b/slides/src/i18n/es.ts@@ -4,6 +4,7 @@import type { Catalog } from '../i18n'export const es: Catalog = {+ "Reduce motion (M)": "Reducir movimiento (M)","Morph": "Morph","Morph id": "Id de morph","Pair with": "Emparejar con",diff --git a/slides/src/i18n/fr.ts b/slides/src/i18n/fr.tsindex 75caa830..f6e83fb3 100644--- a/slides/src/i18n/fr.ts+++ b/slides/src/i18n/fr.ts@@ -4,6 +4,7 @@import type { Catalog } from '../i18n'export const fr: Catalog = {+ "Reduce motion (M)": "Réduire les animations (M)","Morph": "Morph","Morph id": "Id de morph","Pair with": "Associer à",diff --git a/slides/src/i18n/it.ts b/slides/src/i18n/it.tsindex 7986ee72..c3a3214c 100644--- a/slides/src/i18n/it.ts+++ b/slides/src/i18n/it.ts@@ -4,6 +4,7 @@import type { Catalog } from '../i18n'export const it: Catalog = {+ "Reduce motion (M)": "Riduci il movimento (M)","Morph": "Morph","Morph id": "Id morph","Pair with": "Abbina a",diff --git a/slides/src/i18n/ja.ts b/slides/src/i18n/ja.tsindex 391cabdc..47c91182 100644--- a/slides/src/i18n/ja.ts+++ b/slides/src/i18n/ja.ts@@ -4,6 +4,7 @@import type { Catalog } from '../i18n'export const ja: Catalog = {+ "Reduce motion (M)": "モーションを減らす (M)","Morph": "モーフ","Morph id": "モーフ id","Pair with": "ペア設定",diff --git a/slides/src/i18n/zh-Hans.ts b/slides/src/i18n/zh-Hans.tsindex 278cee6c..e8acb732 100644--- a/slides/src/i18n/zh-Hans.ts+++ b/slides/src/i18n/zh-Hans.ts@@ -4,6 +4,7 @@import type { Catalog } from '../i18n'export const zhHans: Catalog = {+ "Reduce motion (M)": "减少动态效果 (M)","Morph": "变形","Morph id": "变形 id","Pair with": "配对",diff --git a/slides/src/i18n/zh-Hant.ts b/slides/src/i18n/zh-Hant.tsindex aad282c6..e2e3f8f5 100644--- a/slides/src/i18n/zh-Hant.ts+++ b/slides/src/i18n/zh-Hant.ts@@ -4,6 +4,7 @@import type { Catalog } from '../i18n'export const zhHant: Catalog = {+ "Reduce motion (M)": "減少動態效果 (M)","Morph": "變形","Morph id": "變形 id","Pair with": "配對",diff --git a/slides/src/present.ts b/slides/src/present.tsindex 52b503f6..58638447 100644--- a/slides/src/present.ts+++ b/slides/src/present.ts@@ -117,6 +117,24 @@ export function startPresentation(}const toggleBlack = () => setBlack(!blacked)+ // ——— reduced motion (a VIEWER/PRESENTER preference, never in the doc) ———+ // Defaults to the OS 'prefers-reduced-motion'; an explicit toggle (M, or the+ // speaker view) overrides it and persists per browser. When on, slide+ // transitions cut instantly and every fx animation (morph, entrances,+ // count-ups, loops, ken-burns) is skipped — elements just show their final+ // state. The '.reduce-motion' class also neutralises CSS motion (svg+ // animations, Reveal's section transitions). Mirrors how locale/auto-check+ // are viewer prefs that never enter the document format.+ const reduceQuery = window.matchMedia('(prefers-reduced-motion: reduce)')+ const readMotionPref = (): boolean | null => {+ try {+ const v = localStorage.getItem('bento-reduce-motion')+ return v === 'on' ? true : v === 'off' ? false : null+ } catch { return null }+ }+ let reduceMotion = readMotionPref() ?? reduceQuery.matches+ overlay.classList.toggle('reduce-motion', reduceMotion)+let exited = falseconst deck = new Reveal(revealEl, {embedded: true,@@ -220,7 +238,36 @@ export function startPresentation(nav('next')?.toggleAttribute('disabled', !hasNext())nav('last')?.toggleAttribute('disabled', !hasNext())nav('black')?.classList.toggle('active', blacked)+ nav('reduce')?.classList.toggle('active', reduceMotion)+ }++ 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)+ // 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.+ if (deckReady) {+ const cur = deck.getIndices().h+ const section = slidesEl.children[cur] as HTMLElement | undefined+ const slide = doc.slides[cur]+ if (section && slide) {+ anim.killTweensOf(section.querySelectorAll('.bento-el'))+ for (const el of slide.elements) {+ const node = section.querySelector<HTMLElement>(`[data-el-id="${CSS.escape(el.id)}"]`)+ if (node) { applyElementFrame(node, el); resetXform(node) }+ }+ if (!on) { runEnterFx(slide, section); runAmbientFx(slide, section); restartSvgAnimations(section) }+ }+ }+ updateSpeakerControls()}+ const toggleReduceMotion = () => setReduceMotion(!reduceMotion)+ // Follow later OS changes ONLY while the user hasn't set an explicit choice.+ const onMotionQuery = (e: MediaQueryListEvent) => { if (readMotionPref() === null) setReduceMotion(e.matches, false) }+ reduceQuery.addEventListener?.('change', onMotionQuery)+const updateSpeaker = () => {if (!speaker || speaker.closed) returnif (!deckReady) return // opened pre-init — populated on ready@@ -282,6 +329,7 @@ export function startPresentation(navBtn('last', '⇥', t('Last slide')) +navBtn('black', '■', t('Black screen (B)')) +navBtn('grid', '▦', t('All slides (G)')) ++ navBtn('reduce', '⏸', t('Reduce motion (M)')) +`</div>` +`</div>` +`<div class="sv-main">` +@@ -346,6 +394,7 @@ export function startPresentation(else if (k === 'last') goLast()else if (k === 'black') toggleBlack()else if (k === 'grid') toggleGrid()+ else if (k === 'reduce') toggleReduceMotion()}d.querySelectorAll<HTMLButtonElement>('.sv-btn[data-nav]').forEach((b) => {b.addEventListener('click', () => doNav(b.dataset.nav!))@@ -360,6 +409,7 @@ export function startPresentation(else if (k === 'End') { ev.preventDefault(); goLast() }else if (k === 'b' || k === 'B') { ev.preventDefault(); toggleBlack() }else if (k === 'g' || k === 'G') { ev.preventDefault(); toggleGrid() }+ else if (k === 'm' || k === 'M') { ev.preventDefault(); toggleReduceMotion() }else if (k === 'Escape' && !grid.hasAttribute('hidden')) { ev.preventDefault(); toggleGrid(false) }})@@ -414,6 +464,7 @@ export function startPresentation(window.removeEventListener('resize', onResize)document.removeEventListener('keydown', onKeydown, true)document.removeEventListener('fullscreenchange', onFsChange)+ reduceQuery.removeEventListener?.('change', onMotionQuery)clearInterval(speakerTimer)if (speaker && !speaker.closed) {if (speakerAdopted) {@@ -453,6 +504,12 @@ export function startPresentation(toggleFullscreen()return}+ if (ev.key === 'm' || ev.key === 'M') {+ ev.preventDefault()+ ev.stopPropagation()+ toggleReduceMotion()+ return+ }const key = ev.key || ({ 32: ' ', 37: 'ArrowLeft', 39: 'ArrowRight', 33: 'PageUp', 34: 'PageDown' } as Record<number, string>)[ev.keyCode]if (key === 'ArrowRight' || key === 'PageDown' || key === ' ') {ev.preventDefault()@@ -518,10 +575,12 @@ export function startPresentation(from &&((forward && doc.slides[toIdx]?.transition === 'morph') ||(!forward && doc.slides[fromIdx]?.transition === 'morph'))- if (morphing) runMorph(doc, from!, to, fromIdx, toIdx)- else runEnterFx(doc.slides[toIdx], to)- runAmbientFx(doc.slides[toIdx], to)- restartSvgAnimations(to)+ if (morphing) { if (!reduceMotion) runMorph(doc, from!, to, fromIdx, toIdx) }+ else if (!reduceMotion) runEnterFx(doc.slides[toIdx], to)+ if (!reduceMotion) {+ runAmbientFx(doc.slides[toIdx], to)+ restartSvgAnimations(to)+ }wireHoverFocus(doc.slides[toIdx], to)if (from) disposeLiveCharts(doc.slides[fromIdx], from)mountLiveCharts(doc.slides[toIdx], to, morphing ? doc.slides[fromIdx] : undefined)@@ -554,9 +613,11 @@ export function startPresentation(setTimeout(onResize, 600)const first = slidesEl.children[startIndex] as HTMLElement | undefinedif (first) {- runEnterFx(doc.slides[startIndex], first)- runAmbientFx(doc.slides[startIndex], first)- restartSvgAnimations(first)+ if (!reduceMotion) {+ runEnterFx(doc.slides[startIndex], first)+ runAmbientFx(doc.slides[startIndex], first)+ restartSvgAnimations(first)+ }wireHoverFocus(doc.slides[startIndex], first)mountLiveCharts(doc.slides[startIndex], first)startMediaIn(first)diff --git a/slides/src/styles.css b/slides/src/styles.cssindex 1d13efb3..5d3d2757 100644--- a/slides/src/styles.css+++ b/slides/src/styles.css@@ -590,6 +590,11 @@ option { background: #fff; color: #1e2a3a; }--r-overlay-element-fg-color: 0, 0, 0;}.bento-present-overlay .reveal .slides section { padding: 0; }+/* Reduced motion (M / speaker toggle / OS prefers-reduced-motion): JS fx are+ skipped in present.ts; this neutralises CSS-driven motion too — Reveal's+ slide transitions cut instantly and svg keyframe animations don't play. */+.bento-present-overlay.reduce-motion .reveal .slides section { transition: none !important; }+.bento-present-overlay.reduce-motion .bento-el-svg * { animation: none !important; }/* dual-screen: one-click permission grant + transient toast */.bento-present-grant {position: fixed;