Skip to content

armgit / bento

Public Imported from GitHub
0

Bento, the office suite that fits in a file

v0.5.1: subtler hero glow; shadow values visible and editable

nyblnet32bf6e5f37ab
diff --git a/slides/package.json b/slides/package.json
index ed770b6d..e2df50b1 100644
--- a/slides/package.json
+++ b/slides/package.json
@@ -1,7 +1,7 @@
{
"name": "bento-slides",
"private": true,
- "version": "0.5.0",
+ "version": "0.5.1",
"type": "module",
"scripts": {
"dev": "vite",
diff --git a/slides/src/editor/panels.ts b/slides/src/editor/panels.ts
index ebfb40c4..25a3c9fa 100644
--- a/slides/src/editor/panels.ts
+++ b/slides/src/editor/panels.ts
@@ -293,11 +293,32 @@ export class PropsPanel {
if (v === 'none') delete e.shadow
else if (v !== 'custom') e.shadow = { ...SHADOW_PRESETS[v] }
}, true)))
- if (el.shadow && !Array.isArray(el.shadow)) {
- // recoloring a preset makes it 'custom' on next rebuild — that's fine
- this.row('Shadow color', this.colorAlpha(el.shadow.color, (v, fin) =>
- this.mutate(el.id, (e) => { if (e.shadow) e.shadow = { ...e.shadow, color: v } }, fin)))
- }
+ // Always show the concrete values (per layer when stacked) — editing any
+ // of them turns a preset into 'custom' on the next rebuild, which is fine.
+ const shadows = Array.isArray(el.shadow) ? el.shadow : el.shadow ? [el.shadow] : []
+ const setShadow = (i: number, patch: Record<string, unknown>, fin = true) =>
+ this.mutate(el.id, (e) => {
+ const arr = Array.isArray(e.shadow) ? [...e.shadow] : e.shadow ? [e.shadow] : []
+ arr[i] = { ...arr[i], ...patch }
+ e.shadow = Array.isArray(e.shadow) ? arr : arr[0]
+ }, fin)
+ shadows.forEach((sh, i) => {
+ if (shadows.length > 1) {
+ const cap = document.createElement('div')
+ cap.className = 'ed-shadow-cap'
+ cap.textContent = `Layer ${i + 1}`
+ this.host.appendChild(cap)
+ }
+ const grid = document.createElement('div')
+ grid.className = 'ed-grid2'
+ grid.append(
+ this.mini('X', sh.x ?? 0, (v) => setShadow(i, { x: v })),
+ this.mini('Y', sh.y ?? 0, (v) => setShadow(i, { y: v })),
+ this.mini('Blur', sh.blur, (v) => setShadow(i, { blur: Math.max(v, 0) })),
+ )
+ this.host.appendChild(grid)
+ this.row('Color', this.colorAlpha(sh.color, (v, fin) => setShadow(i, { color: v }, fin)))
+ })
if (el.type === 'text') this.buildTextProps(el)
diff --git a/slides/src/starterdeck.ts b/slides/src/starterdeck.ts
index 95fdd5d9..80a40049 100644
--- a/slides/src/starterdeck.ts
+++ b/slides/src/starterdeck.ts
@@ -358,7 +358,7 @@ export function starterDoc(): BentoDoc {
// the bento logo, built from the cast
shape('rect', {
id: T_D, x: 850, y: 170, w: 320, h: 320, radius: 40, fill: PANEL, fillGradient: GRAD_CARD,
- shadow: [{ blur: 48, color: 'rgba(255,240,220,0.38)' }, { y: 28, blur: 60, color: 'rgba(0,0,0,0.5)' }],
+ shadow: [{ blur: 56, color: 'rgba(255,240,220,0.18)' }, { y: 28, blur: 60, color: 'rgba(0,0,0,0.5)' }],
fx: { enter: 'fade', order: 1 },
}),
shape('rect', { id: T_B, x: 886, y: 206, w: 84, h: 248, radius: 16, fill: STEEL, fillGradient: GRAD_STEEL, fx: { enter: 'fade-up', order: 2 } }),
@@ -863,7 +863,7 @@ export function starterDoc(): BentoDoc {
bokeh(900, 478, 8, true, 0.18, 20, 9, 18),
shape('rect', {
id: T_D, x: 500, y: 120, w: 280, h: 280, radius: 52, fill: PANEL, fillGradient: GRAD_CARD,
- shadow: [{ blur: 48, color: 'rgba(255,240,220,0.38)' }, { y: 28, blur: 60, color: 'rgba(0,0,0,0.5)' }],
+ shadow: [{ blur: 56, color: 'rgba(255,240,220,0.18)' }, { y: 28, blur: 60, color: 'rgba(0,0,0,0.5)' }],
}),
shape('rect', { id: T_B, x: 532, y: 152, w: 70, h: 216, radius: 14, fill: STEEL, fillGradient: GRAD_STEEL }),
shape('rect', { id: T_A, x: 618, y: 152, w: 130, h: 96, radius: 14, fill: PEACH, fillGradient: GRAD_PEACH }),
diff --git a/slides/src/styles.css b/slides/src/styles.css
index a18cc009..e9d524c4 100644
--- a/slides/src/styles.css
+++ b/slides/src/styles.css
@@ -416,6 +416,14 @@ html, body {
color: #0D1B2E !important;
font-weight: 700;
}
+.ed-shadow-cap {
+ font-size: 11px;
+ font-weight: 700;
+ letter-spacing: 0.06em;
+ text-transform: uppercase;
+ color: var(--muted);
+ margin: 4px 0 6px;
+}
.ed-about-auto {
display: flex;
align-items: center;