Bento, the office suite that fits in a file
TypeScript mit-licenseofficeoffice-365office-suiteoffice-toolsoffice365open-sourcepowerpointself-hostedsingle-page-appslidesslideshareslideshowslideshow-galleryslideshow-makerslideshows
Fix funny audio-player shape: don't wrap the native control in a box
nyblnet4470a0e8fda3
diff --git a/scripts/build-example-decks.mjs b/scripts/build-example-decks.mjsindex 5ad7e128..a298c21d 100644--- a/scripts/build-example-decks.mjs+++ b/scripts/build-example-decks.mjs@@ -597,7 +597,7 @@ function deckPicnic() {// build-example-decks.mjs, so it's unambiguously public domain. Demos the// media element's embed path: the sound travels inside the .bento.html.text({ x: 130, y: 556, w: 360, h: 26, html: '▶ press play — the picnic jingle', fontSize: 15, fontWeight: 800, color: INK, rotation: -1 }),- media({ id: 'pic-jingle', kind: 'audio', src: mediaFile('chime.wav', 'audio/wav'), x: 130, y: 590, w: 320, h: 44, radius: 12, controls: true }),+ media({ id: 'pic-jingle', kind: 'audio', src: mediaFile('chime.wav', 'audio/wav'), x: 130, y: 588, w: 300, h: 56, radius: 999, controls: true }),text({ x: 130, y: 682, w: 700, h: 20, html: 'PHOTOS: JACK DELANO, 1941 · LIBRARY OF CONGRESS — PUBLIC DOMAIN', fontSize: 9, fontWeight: 700, letterSpacing: 2, color: 'rgba(32,26,49,0.55)' }),],})diff --git a/slides/package.json b/slides/package.jsonindex 5caa026b..85f314c9 100644--- a/slides/package.json+++ b/slides/package.json@@ -1,7 +1,7 @@{"name": "bento-slides","private": true,- "version": "0.9.18",+ "version": "0.9.19","license": "MIT","type": "module","scripts": {diff --git a/slides/src/render.ts b/slides/src/render.tsindex 776cd582..017914a2 100644--- a/slides/src/render.ts+++ b/slides/src/render.ts@@ -450,17 +450,24 @@ export function renderElement(el: SlideElement, doc: BentoDoc, opts: RenderOpts}const inert = opts.liveMedia ? '' : ';pointer-events:none'if (el.kind === 'audio') {+ // The native <audio controls> is an opinionated pill with its own+ // surface and a fixed intrinsic height (~54px). Don't wrap it in a+ // SECOND background — that reads as a doubled box. Just centre it and+ // clip to the element's own radius. (A too-short box was the "funny+ // shape" bug; authors should size the box ≥ the control's height.)const audio = document.createElement('audio')if (el.src) audio.src = resolveAsset(doc, el.src)audio.controls = el.controls !== falseaudio.loop = !!el.loopaudio.preload = 'metadata'audio.dataset.autoplay = el.autoplay ? '1' : ''- audio.style.cssText = 'width:100%;display:block' + inert+ audio.style.cssText = `width:100%;display:block;border-radius:${radius}px` + inertconst wrap = document.createElement('div')- wrap.style.cssText = `width:100%;height:100%;display:flex;align-items:center;padding:0 6px;box-sizing:border-box;border-radius:${radius}px;background:#eef2f7`- if (!el.src) { wrap.style.color = '#93a2b6'; wrap.style.fontSize = '13px'; wrap.style.justifyContent = 'center'; wrap.textContent = '♪ ' + 'No audio source' }- else wrap.appendChild(audio)+ wrap.style.cssText = `width:100%;height:100%;display:flex;align-items:center;justify-content:center;overflow:hidden;border-radius:${radius}px`+ if (!el.src) {+ wrap.style.cssText += ';background:#eef2f7;color:#93a2b6;font-size:13px'+ wrap.textContent = '♪ ' + 'No audio source'+ } else wrap.appendChild(audio)node.appendChild(wrap)break}