Skip to content

armgit / bento

Public Imported from GitHub
0

Bento, the office suite that fits in a file

feat(element): optional per-element blur + mix-blend-mode

sergioerm4e9f5c604c7d
diff --git a/slides/src/model.ts b/slides/src/model.ts
index 54082973..b3dee00d 100644
--- a/slides/src/model.ts
+++ b/slides/src/model.ts
@@ -35,6 +35,12 @@ export interface ElementBase {
* white glow.
*/
shadow?: ShadowSpec | ShadowSpec[]
+ /** Gaussian blur ON this element, in px. Composed into the SAME CSS `filter`
+ * as `shadow` (both apply). Survives PDF/print, unlike backdrop blur. */
+ blur?: number
+ /** CSS mix-blend-mode for this element ('screen' for neon light glows,
+ * 'multiply'/'overlay' for editorial duotones). Omitted/'' = normal. */
+ blend?: string
/** presentation effects, run in present mode only */
fx?: {
/** entrance animation when the slide is shown. fade-* nudge ~16px; slide-*
diff --git a/slides/src/render.ts b/slides/src/render.ts
index 89610716..c7353059 100644
--- a/slides/src/render.ts
+++ b/slides/src/render.ts
@@ -129,9 +129,10 @@ export function applyElementFrame(node: HTMLElement, el: SlideElement) {
node.style.transform = el.rotation ? `rotate(${el.rotation}deg)` : ''
node.style.opacity = String(el.opacity)
const shadows = Array.isArray(el.shadow) ? el.shadow : el.shadow ? [el.shadow] : []
- node.style.filter = shadows.length
- ? shadows.map((s) => `drop-shadow(${s.x ?? 0}px ${s.y ?? 0}px ${s.blur}px ${s.color})`).join(' ')
- : ''
+ const parts = shadows.map((s) => `drop-shadow(${s.x ?? 0}px ${s.y ?? 0}px ${s.blur}px ${s.color})`)
+ if (el.blur) parts.push(`blur(${el.blur}px)`)
+ node.style.filter = parts.length ? parts.join(' ') : ''
+ node.style.mixBlendMode = el.blend || ''
}
// Gradient ids must be unique per rendered instance: the same element renders