Skip to content

armgit / bento

Public Imported from GitHub
0

Bento, the office suite that fits in a file

v0.3.2: panel refreshes instantly on discrete edits; geometry-grid spacing

nyblnet9e3538ef759f
diff --git a/slides/package.json b/slides/package.json
index 24193b48..0656800f 100644
--- a/slides/package.json
+++ b/slides/package.json
@@ -1,7 +1,7 @@
{
"name": "bento-slides",
"private": true,
- "version": "0.3.1",
+ "version": "0.3.2",
"type": "module",
"scripts": {
"dev": "vite",
diff --git a/slides/src/editor/panels.ts b/slides/src/editor/panels.ts
index 2e2f1ce3..850917a1 100644
--- a/slides/src/editor/panels.ts
+++ b/slides/src/editor/panels.ts
@@ -31,6 +31,24 @@ export class PropsPanel {
private stale = false
+ /**
+ * True only while the user is mid-edit in a control a rebuild would
+ * disrupt: typing in text/number fields, or the native color popup.
+ * Discrete controls (selects, checkboxes, buttons) commit atomically, so
+ * the panel rebuilds the moment they change — structural rows (shadow
+ * color, fx options) appear immediately instead of after focus leaves.
+ */
+ private isActiveEditFocus(): boolean {
+ const a = document.activeElement as HTMLElement | null
+ if (!a || !this.host.contains(a)) return false
+ if (a.tagName === 'TEXTAREA' || a.isContentEditable) return true
+ if (a.tagName === 'INPUT') {
+ const t = (a as HTMLInputElement).type
+ return t !== 'checkbox' && t !== 'radio' && t !== 'button'
+ }
+ return false
+ }
+
/** checkpoint once per burst of continuous input, commit on change. */
private edit(mutate: () => void, final: boolean) {
if (!this.burst) {
@@ -43,8 +61,8 @@ export class PropsPanel {
}
private rebuild(force = false) {
- if (!force && this.host.matches(':focus-within')) {
- this.stale = true // don't rip inputs out from under the user; catch up on focusout
+ if (!force && this.isActiveEditFocus()) {
+ this.stale = true // don't rip the field out from under the user; catch up on focusout
return
}
this.stale = false
diff --git a/slides/src/styles.css b/slides/src/styles.css
index 7108ee0f..14d3d4ac 100644
--- a/slides/src/styles.css
+++ b/slides/src/styles.css
@@ -373,7 +373,7 @@ html, body {
background: #fff;
}
-.ed-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
+.ed-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.ed-mini { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ink-2); }
.ed-mini input {
width: 100%;