Bento, the office suite that fits in a file
TypeScript mit-licenseofficeoffice-365office-suiteoffice-toolsoffice365open-sourcepowerpointself-hostedsingle-page-appslidesslideshareslideshowslideshow-galleryslideshow-makerslideshows
dash: every field wears the suite's one field look (#731)
nyblnet2d1a9ed807f9
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 1f6bb7ea..44bc25db 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -2502,6 +2502,32 @@ jobs:# beside the caret has no ring-blue in it; the text does not move.run: node scripts/test-slides-caret-ring-browser.mjs+ dash-fields-browser:+ runs-on: ubuntu-latest+ timeout-minutes: 15+ steps:+ - uses: actions/checkout@v4+ - uses: actions/setup-node@v4+ with:+ node-version: 24+ - name: Install browser test runtime+ # Pinned outside app packages: browser automation is not shipped in documents.+ run: |+ npm install --prefix "$RUNNER_TEMP/bento-browser" --no-package-lock --ignore-scripts [email protected]+ "$RUNNER_TEMP/bento-browser/node_modules/.bin/playwright" install --with-deps chromium+ echo "PLAYWRIGHT_MODULE=$RUNNER_TEMP/bento-browser/node_modules/playwright/index.mjs" >> "$GITHUB_ENV"+ - name: Build the tested standalone document+ run: |+ npm ci --prefix dash+ npm run build:single --prefix dash+ - name: Every dash field wears the suite's one field look+ # Slides' rig, ported: every text field, select and textarea on 17+ # surfaces, light and dark, has the 1px --line border, --field fill,+ # 6px radius and 26px height, and the --accent-ink focus ring; each+ # surface must show fields in its own container, and a planted+ # browser-dressed field must be flagged.+ run: node scripts/test-dash-fields-browser.mjs+spaces-save-browser:runs-on: ubuntu-latesttimeout-minutes: 15diff --git a/dash/CHANGELOG.md b/dash/CHANGELOG.mdindex 6dc4bd32..c41279c5 100644--- a/dash/CHANGELOG.md+++ b/dash/CHANGELOG.md@@ -12,6 +12,13 @@ There is no server, so a break here would be permanent.The release that came out of watching somebody use 0.2.0.+- **Every field looks the same, in light and dark.** Text fields, selects,+ text areas and colour wells across dash share one look: the same border,+ fill, corners and height, and the same focus ring. It matches slides. Before,+ each panel and dialog styled its own fields, so they drifted apart. The+ formula bar, tab rename and story captions were boxless until hovered, and+ are now ordinary fields.+- **Save a copy keeps you on the original.** The copy is written and you goon editing the file you opened: ⌘S, the automatic save and the unsaved dotall stay with the original, and the message says so. Before, the copy quietlydiff --git a/dash/src/about.css b/dash/src/about.cssindex 2d65e357..3b8c2bba 100644--- a/dash/src/about.css+++ b/dash/src/about.css@@ -86,20 +86,10 @@overflow-wrap: anywhere;}+/* The look is THE FIELD (styles.css); a context rule only sizes. */.dx-about-in,-.dx-about select {- font: inherit;- font-size: var(--fs-ui);- border: 1px solid var(--line-strong);- border-radius: var(--radius);- padding: 4px 7px;- background: var(--surface);- color: inherit;- width: 100%;-}-.dx-about-in:focus,-.dx-about select:focus { outline: none; border-color: var(--blue); }-.dx-about-in[disabled] { background: var(--panel); color: var(--muted); }+.dx-about select { width: 100%; }+.dx-about-in[disabled] { color: var(--muted); }.dx-about-actions {display: flex;@@ -108,19 +98,14 @@margin-top: 6px;}+/* The look is THE FIELD (styles.css); this sizes it and sets the monospace+ face, because it holds JSON. */.dx-about-paste {- font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;width: 100%;min-height: 9rem;margin-top: 8px;- border: 1px solid var(--line-strong);- border-radius: var(--radius);- padding: 8px;- resize: vertical;- background: var(--surface);- color: inherit;}-.dx-about-paste:focus { outline: none; border-color: var(--blue); }.dx-about-vers {display: flex;diff --git a/dash/src/ask.css b/dash/src/ask.cssindex 2ab682d4..1abe4e36 100644--- a/dash/src/ask.css+++ b/dash/src/ask.css@@ -29,18 +29,10 @@.dx-ask-title { margin: 0 0 14px; font-size: 15px; font-weight: 600; }.dx-ask-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }.dx-ask-row > span { font-size: 12px; color: var(--muted); }-.dx-ask-in {- width: 100%;- padding: 7px 9px;- font: inherit;- color: inherit;- background: var(--panel);- border: 1px solid var(--line-strong);- border-radius: var(--radius);-}-/* --blue, not --accent: the amber ring is 2.02:1 on white and misses the 3:1- WCAG 2.2 SC 1.4.11 asks of a focus indicator. See .dx-btn:focus-visible. */-.dx-ask-in:focus-visible { outline: 2px solid var(--blue); outline-offset: -1px; }+/* The look and the focus ring are THE FIELD (styles.css); this only sizes.+ The shared ring is --accent-ink, not --accent: dark amber passes the 3:1+ WCAG 2.2 SC 1.4.11 asks of a focus indicator where bright amber did not. */+.dx-ask-in { width: 100%; }/* A formula is read character by character — an l and a 1 have to differ. */.dx-ask-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }.dx-ask-hint {diff --git a/dash/src/cellprops.css b/dash/src/cellprops.cssindex aeb16b4f..b4012df4 100644--- a/dash/src/cellprops.css+++ b/dash/src/cellprops.css@@ -49,14 +49,10 @@width: 100%; /* the control column — see .dc-preview */min-width: 0;}+/* The box is THE FIELD's colour well (styles.css); this only sizes. */.dc-colour input[type='color'] {flex: 1 1 auto;min-width: 0;- height: var(--dp-row, 26px);- padding: 0 1px;- border: 1px solid var(--line);- border-radius: var(--dp-radius);- background: var(--surface);cursor: pointer;}.dc-colour input[type='color']:disabled { cursor: default; opacity: 0.5; }@@ -65,7 +61,9 @@to say so — otherwise every unstyled cell looks like it was painted. */.dc-colour-off input[type='color'] {opacity: 0.4;- background:+ /* an IMAGE over the field's own fill: the `background` shorthand used to+ reset the fill to transparent along with drawing the strike */+ background-image:linear-gradient(to top right,transparent calc(50% - 1px), var(--line-strong) 50%, transparent calc(50% + 1px));}diff --git a/dash/src/comments.css b/dash/src/comments.cssindex 87f3d8ef..2d9dbfec 100644--- a/dash/src/comments.css+++ b/dash/src/comments.css@@ -202,19 +202,8 @@}.dxc-who input { flex: 1 1 auto; min-width: 0; }-.dxc-text {- width: 100%;- font: inherit;- font-size: 12.5px;- line-height: 1.45;- padding: 6px 8px;- border: 1px solid var(--line-strong);- border-radius: var(--radius);- background: var(--surface);- color: var(--ink);- resize: vertical;-}-.dxc-text:focus { outline: none; border-color: var(--cmt); }+/* The look is THE FIELD (styles.css); this only sizes. */+.dxc-text { width: 100%; }.dxc-foot {display: flex;diff --git a/dash/src/find.css b/dash/src/find.cssindex 90306dcc..1ce80e63 100644--- a/dash/src/find.css+++ b/dash/src/find.css@@ -78,21 +78,11 @@.dx-find-line[hidden] { display: none; }+/* The look and the focus ring are THE FIELD (styles.css); this only sizes. */.dx-find input[type='search'],.dx-find .dx-find-r {flex: 1 1 auto;min-width: 0;- font: inherit;- color: var(--ink);- background: var(--bg);- border: 1px solid var(--line-strong);- border-radius: var(--radius);- padding: 5px 8px;-}--.dx-find input:focus-visible {- outline: 2px solid var(--sel-ring);- outline-offset: -1px;}/* Tabular figures, so "9 of 47" does not shuffle sideways into "10 of 47"@@ -133,15 +123,6 @@.dx-find-opts { flex-wrap: wrap; }-.dx-find select {- font: inherit;- font-size: var(--fs-small);- color: var(--ink);- background: var(--surface);- border: 1px solid var(--line-strong);- border-radius: var(--radius);- padding: 3px 4px;-}/* Where the refusals are written down. It is never decorative: if it isvisible, something was NOT replaced and the reader has to be able to readdiff --git a/dash/src/panels.css b/dash/src/panels.cssindex 06e7a014..ff073c94 100644--- a/dash/src/panels.css+++ b/dash/src/panels.css@@ -350,20 +350,10 @@ body.dp-resizing { cursor: col-resize; user-select: none; }.dp-row select {width: 100%;min-width: 0;- /* one height for every control, so the row pitch does not depend on which- control the row happens to hold. MEASURED before: text 28.1px, select- 26.5px, checkbox 18.1px — three rhythms in one panel. */- height: var(--dp-row);- font: inherit;- font-size: 12.5px;- padding: 3px 6px;- border: 1px solid var(--line);- border-radius: var(--dp-radius);- background: var(--surface);- color: var(--ink);+ /* The look — and the one 26px height every control shares, so the row+ pitch does not depend on which control a row holds — is THE FIELD+ (styles.css). This rule only sizes. */}-.dp-row input:focus,-.dp-row select:focus { outline: none; border-color: var(--blue); }.dp-row .dp-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }/* ————— THE CHECKBOX IS A FIELD, LIKE EVERY OTHER CONTROL —————diff --git a/dash/src/print.css b/dash/src/print.cssindex a911dfdc..46431339 100644--- a/dash/src/print.css+++ b/dash/src/print.css@@ -141,7 +141,5 @@like `.dx-ask-in`, which was written for inputs. Same box, same focus ring —a second dialog style is a second thing to keep in step with the theme. */.dx-print-card select.dx-ask-in {- appearance: auto;- height: 32px;cursor: pointer;}diff --git a/dash/src/story.css b/dash/src/story.cssindex 00e84fa9..8634c18d 100644--- a/dash/src/story.css+++ b/dash/src/story.css@@ -204,17 +204,8 @@font-variant-numeric: tabular-nums;}.ds-fields { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }-.ds-cap-in {- font: inherit;- width: 100%;- padding: 3px 6px;- border: 1px solid transparent;- border-radius: var(--radius);- background: transparent;- color: inherit;-}-.ds-cap-in:hover { border-color: var(--line-strong); }-.ds-cap-in:focus { outline: none; border-color: var(--accent); background: var(--surface); }+/* The look is THE FIELD (styles.css); this only sizes. */+.ds-cap-in { width: 100%; }.ds-meta { font-size: var(--fs-micro); color: var(--muted); padding-left: 6px; }.ds-warn { color: var(--err-ink); font-weight: 600; }.ds-hint { margin: 0; padding: 14px 14px 6px; color: var(--muted); }diff --git a/dash/src/styles.css b/dash/src/styles.cssindex b77e8e29..3d587a9c 100644--- a/dash/src/styles.css+++ b/dash/src/styles.css@@ -79,6 +79,9 @@the page or a menu floating over the grid has no edge but its shadow, andshadows barely read on a dark ground. */--surface: #ffffff;+ /* form-control fill — THE FIELD below. Dash's fields have always sat on+ --surface; naming it lets the shared block read slides' token as is. */+ --field: var(--surface);/* menu rows, buttons, list items. slides: --chrome-2 */--hover: #eceff4;/* A wash for hover states drawn OVER unknown content (a chart band, a table@@ -379,6 +382,42 @@ html, body {#app { display: flex; flex-direction: column; height: 100%; }+/* ————— THE FIELD — one look for every text field, select and textarea ———————+ The suite's reference: dash, spaces and type copy this block as it stands.+ Every chrome field gets it with no class to remember, so a new field cannot+ come out in the browser's own dress — the grey inset 2px border, square+ corners, and in dark theme a #3b3b3b fill nobody chose (five of slides'+ fields had exactly that, each with its own rule that forgot one property).++ :where() keeps the specificity at ZERO, so a context rule that only sizes a+ field (width, flex, font-weight) layers on top without restating the look,+ and a field that is deliberately not a box (the ghost title, the password+ gate's own card) overrides it with an ordinary class. The ring sits ON the+ border (offset -1px), so no scroll container can clip it. Checkboxes,+ radios, ranges and file pickers keep their native controls. Guarded here by+ scripts/test-dash-fields-browser.mjs (slides' rig, ported). */+:where(input:not([type='checkbox'], [type='radio'], [type='range'], [type='file'], [type='color'], [type='button'], [type='submit'], [type='reset'], [type='image'], [type='hidden']), select, textarea) {+ box-sizing: border-box;+ height: 26px;+ padding: 0 6px;+ font: inherit;+ font-size: 12.5px;+ color: var(--ink);+ background: var(--field);+ border: 1px solid var(--line);+ border-radius: 6px;+}+:where(textarea) { height: auto; padding: 6px 8px; line-height: 1.5; resize: vertical; }+:where(input[type='color']) {+ box-sizing: border-box;+ height: 26px;+ padding: 1px 2px;+ background: var(--field);+ border: 1px solid var(--line);+ border-radius: 6px;+}+:where(input, select, textarea):focus-visible { outline: 2px solid var(--accent-ink); outline-offset: -1px; }+/* ————— top bar ————— */.dx-bar {display: flex;@@ -1226,19 +1265,14 @@ html, body {margin-inline-start: 8px;border-inline-start: 1px solid var(--line);}+/* The look is THE FIELD; this sizes it and sets the monospace face, because+ a formula is read character by character. */.dx-fx-input {flex: 1 1 auto;- font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;- border: 1px solid transparent;- border-radius: var(--radius);- padding: 3px 8px;- background: transparent;- color: inherit;+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;min-width: 0;align-self: center;}-.dx-fx-input:hover { border-color: var(--line); }-.dx-fx-input:focus { outline: none; border-color: var(--blue); background: var(--surface); }/* ————— status bar —————Excel's reads left: what you are looking at; right: what the selection adds@@ -1473,15 +1507,6 @@ html, body {font-size: var(--fs-micro);color: var(--muted);}-.dx-pop-in {- font: inherit;- font-size: var(--fs-ui);- border: 1px solid var(--line-strong);- border-radius: var(--radius);- padding: 4px 7px;- color: var(--ink);-}-.dx-pop-in:focus { outline: none; border-color: var(--blue); }/* ————— selection outline and fill handle ————— */.dg-outline {diff --git a/dash/src/tabs.css b/dash/src/tabs.cssindex 62690de7..c0bfed70 100644--- a/dash/src/tabs.css+++ b/dash/src/tabs.css@@ -237,18 +237,8 @@.dx-tab.active.dx-tab-drop-before { box-shadow: inset 2px 0 0 var(--ink); }.dx-tab.active.dx-tab-drop-after { box-shadow: inset -2px 0 0 var(--ink); }-.dx-tab-rename {- width: 8em;- font: inherit;- font-size: 12.5px;- font-weight: 650;- padding: 1px 4px;- border: 1px solid var(--accent);- border-radius: 4px;- background: var(--surface);- color: var(--ink);-}-.dx-tab-rename:focus { outline: none; }+/* The look is THE FIELD (styles.css); this sizes it and keeps the tab's weight. */+.dx-tab-rename { width: 8em; font-weight: 650; }/* ————— the menus —————ABOVE the anchor: the strip is the last row on the screen, so a menu thatdiff --git a/docs/DECISIONS.md b/docs/DECISIONS.mdindex 3cd1e0b3..bb2d682e 100644--- a/docs/DECISIONS.md+++ b/docs/DECISIONS.md@@ -10435,6 +10435,29 @@ choices are dash's and are recorded because a later change could undo them:`recoveryLooksOlder` is read against the workbook AS LOADED, because dashstamps `modified` on every edit.+## 2026-10-17 — dash adopts the suite's one field look++Dash copies slides' `THE FIELD` block as written, into `dash/src/styles.css`+(see "the suite's one field look, set in slides"). What is dash's own:++- **`--field` is `var(--surface)`.** It's the fill dash's fields have always+ had, so dark theme keeps dash's palette instead of importing slides' value.+ `--accent-ink` was already defined, and the ring uses it, not `--blue`. Dark+ amber passes the 3:1 that WCAG 2.2 SC 1.4.11 asks of a focus indicator.+- **One exception, by class: `.dx-title`**, the ghost workbook title, as in+ slides. The boot password gate reuses that class and stays as it is.+- **Formerly ghost fields are now ordinary fields:** the formula bar, tab+ rename and the story caption. Each had been boxless at rest. Recording why:+ only the title is a ghost, so anything else that should be one needs a reason+ here.+- **Context rules only size.** Every `:focus { outline: none }` is gone; it+ would outrank the zero-specificity ring and remove it. The "colour not set"+ strike on a colour well is now a `background-image` over the fill, because+ the `background` shorthand reset the fill.++`scripts/test-dash-fields-browser.mjs` is slides' rig ported to 17 dash+surfaces. Its five mutations are slides' own, and each fails it.+## 2026-10-17 — Rescue: a file moved onto the latest shell of its own app, its document block carried byte for byteSlides 1.2.4–1.2.8 cannot open password-protected decks: the loader refusesdiff --git a/scripts/test-dash-fields-browser.mjs b/scripts/test-dash-fields-browser.mjsnew file mode 100644index 00000000..2cb52b51--- /dev/null+++ b/scripts/test-dash-fields-browser.mjs@@ -0,0 +1,219 @@+// SPDX-License-Identifier: MIT+// Copyright (c) 2026 The Bento authors+// Every text field, select and textarea in dash's chrome wears the ONE field look.+//+// npm run build:single --prefix dash && node scripts/test-dash-fields-browser.mjs+//+// Ported from scripts/test-slides-fields-browser.mjs (slides is the reference;+// docs/DECISIONS.md 2026-10-17, "the suite's one field look"). WHAT THIS PROVES,+// measured in the packaged document, in light AND dark theme:+// 1. every visible field on every surface — the formula bar, the properties+// panel on a dataset and on a spreadsheet, About with Replace from JSON,+// Settings, find, the column filter, the formula column, chart, pivot, 3D,+// a story step, the comment composer, tab rename, conditional formatting,+// split into columns, print — has a 1px SOLID border in the computed+// --line colour, a --field fill, a 6px radius and (single-line fields) a+// 26px height. The browser's own dress is a 2px INSET border, square+// corners, and in dark theme a #3b3b3b fill;+// 2. a focused field shows the ring: a 2px solid --accent-ink outline;+// 3. each surface really opened — a floor on how many fields it shows INSIDE+// its own container — so a surface that silently failed to open cannot+// pass, since the panel's fields are on the page whatever else is open;+// 4. the check itself works: a field with its author styles reverted (the+// browser's dress) is planted in the page and must be flagged.+// The one deliberate exception is the ghost workbook title, `.dx-title`+// (boxless at rest), which the password gate also uses.+const { chromium } = await import(process.env.PLAYWRIGHT_MODULE || 'playwright')++let checks = 0+let failures = 0+function ok(cond, msg) {+ checks+++ if (!cond) { failures++; console.log(` FAIL ${msg}`) } else console.log(` ok ${msg}`)+}++const SHELL = new URL('../dash/dist-single/Bento_Dash.bento.html', import.meta.url).href++// Every visible field on the page, with what the rule governs. Native widgets+// (checkbox, radio, range, file) keep the platform look and are skipped.+function measure(scope) {+ const root = getComputedStyle(document.documentElement)+ const probe = document.createElement('div')+ document.body.appendChild(probe)+ const resolve = (v) => { probe.style.color = v; return getComputedStyle(probe).color }+ const tok = { line: resolve(root.getPropertyValue('--line')), field: resolve(root.getPropertyValue('--field')), ring: resolve(root.getPropertyValue('--accent-ink')) }+ probe.remove()+ const out = []+ for (const el of document.querySelectorAll('input, textarea, select')) {+ const r = el.getBoundingClientRect()+ const s = getComputedStyle(el)+ if (!r.width || !r.height || s.visibility === 'hidden') continue+ const type = el.tagName === 'INPUT' ? el.type : el.tagName.toLowerCase()+ if (['checkbox', 'radio', 'range', 'file', 'hidden'].includes(type)) continue+ // the deliberate exception: the ghost workbook title (boxless at rest)+ if (el.matches('.dx-title')) continue+ // a colour well is measured for its box, not its height+ const sides = ['Top', 'Right', 'Bottom', 'Left']+ const name = (el.className && `.${String(el.className).trim().split(/\s+/)[0]}`) || el.closest('[class]')?.className.split(' ')[0] || ''+ out.push({+ id: `${type} ${name}${el.placeholder ? ` "${el.placeholder}"` : ''}`.trim(),+ type,+ styles: sides.map((x) => s[`border${x}Style`]),+ widths: sides.map((x) => s[`border${x}Width`]),+ colors: sides.map((x) => s[`border${x}Color`]),+ bg: s.backgroundColor,+ radius: s.borderTopLeftRadius,+ h: +r.height.toFixed(1),+ planted: el.hasAttribute('data-planted'),+ inScope: !scope || !!el.closest(scope),+ })+ }+ return { tok, fields: out }+}++function problems(f, tok) {+ const p = []+ if (f.styles.some((x) => x === 'inset' || x === 'outset')) p.push(`${f.styles[0]} border (browser default)`)+ else if (f.styles.some((x) => x !== 'solid')) p.push(`border ${f.styles.join('/')}`)+ if (f.widths.some((w) => w !== '1px')) p.push(`border ${f.widths.join('/')}`)+ if (f.colors.some((c) => c !== tok.line)) p.push(`border ${f.colors[0]} ≠ --line ${tok.line}`)+ if (f.bg !== tok.field) p.push(`fill ${f.bg} ≠ --field ${tok.field}`)+ if (f.radius !== '6px') p.push(`radius ${f.radius}`)+ if (f.type !== 'textarea' && Math.abs(f.h - 26) > 0.5) p.push(`height ${f.h}`)+ return p+}++const cell = (p, n) => p.locator('.dg-cell').nth(n)+const byText = (p, txt) => p.getByText(txt, { exact: true }).first().click({ timeout: 4000 })+const ctxItem = async (p, label) => { await cell(p, 12).click({ button: 'right' }); await byText(p, label) }++// each surface gets a fresh page; `open` brings it up, and `min` is the floor+// on how many fields it shows INSIDE `scope`. Surfaces hosted IN the panel+// (chart, pivot, 3D, conditional formatting) can only name the panel; for them+// "opened" also rests on `open` succeeding. Dashboard and Paste special have no+// fields and are not listed.+const SURFACES = [+ { name: 'formula bar', scope: '.dx-formula', min: 1, open: (p) => cell(p, 12).click() },+ { name: 'properties panel (dataset)', scope: '.dp-panel', min: 6, open: (p) => cell(p, 12).click() },+ { name: 'About, with Replace from JSON', scope: '.dx-about', min: 2, open: async (p) => { await p.locator('[data-act="about"]').click(); await byText(p, 'Replace from JSON…') } },+ { name: 'Settings', scope: '.dx-about', min: 2, open: (p) => p.locator('[data-act="settings"]').click() },+ { name: 'find', scope: '.dx-find', min: 1, open: async (p) => { await cell(p, 12).click(); await p.keyboard.press('ControlOrMeta+f') } },+ { name: 'column filter', scope: '.dx-pop', min: 1, open: (p) => p.locator('.dg-filter').first().click() },+ { name: 'formula column', scope: '.dx-about, .dx-pop, .dx-ask, .dp-panel', min: 1, open: (p) => p.locator('[data-act="formula"]').click() },+ { name: 'chart', scope: '.dp-panel', min: 4, open: (p) => p.locator('[data-act="chart"]').click() },+ { name: 'pivot', scope: '.dp-panel', min: 4, open: (p) => p.locator('[data-act="pivot"]').click() },+ { name: '3D', scope: '.dp-panel', min: 4, open: (p) => p.locator('[data-act="viz3d"]').click() },+ { name: 'story step', scope: '.ds-step', min: 1, open: async (p) => { await p.locator('[data-act="story"]').click(); await p.locator('[data-act="capture"]').first().click() } },+ { name: 'comment composer', scope: '[class^="dxc"]', min: 1, open: async (p) => { await cell(p, 12).click(); await p.locator('.dxc-pill').click(); await byText(p, '+ Comment on the selected cell') } },+ { name: 'tab rename', scope: '.dx-tab-rename, .dx-tab', min: 1, open: (p) => p.locator('.dx-tab').first().dblclick() },+ { name: 'conditional formatting', scope: '.dp-panel', min: 4, open: (p) => ctxItem(p, 'More conditional formatting…') },+ { name: 'split into columns', scope: '.dx-ask', min: 1, open: (p) => ctxItem(p, 'Split into columns…') },+ { name: 'print', scope: '.dx-print-card', min: 1, open: async (p) => { await p.locator('.dx-dd-trig', { hasText: 'Data' }).first().click(); await byText(p, 'Print…') } },+ { name: 'spreadsheet sheet + panel', scope: '.dp-panel', min: 4, open: async (p) => { await p.locator('.dx-tab').nth(1).click(); await p.waitForTimeout(200); await cell(p, 30).click() } },+]++const browser = await chromium.launch({ executablePath: process.env.CHROME_PATH, headless: true })+try {+ for (const theme of ['light', 'dark']) {+ console.log(`\n${theme} theme\n`)+ const ctx = await browser.newContext({ viewport: { width: 1440, height: 960 } })+ await ctx.addInitScript((th) => { try { localStorage.setItem('bento-theme', th) } catch {} }, theme)+ await ctx.route(/^https?:/, (r) => r.abort())+ const fresh = async () => {+ const p = await ctx.newPage()+ p.on('dialog', (d) => d.dismiss())+ p.on('pageerror', (e) => ok(false, `no page error (${e.message})`))+ await p.goto(SHELL)+ await p.waitForFunction(() => window.bento?.doc && document.querySelector('.dg-cell'))+ await p.waitForTimeout(250)+ return p+ }++ const p0 = await fresh()+ ok(await p0.evaluate(() => document.documentElement.dataset.theme) === theme, `the page is in ${theme} theme`)+ await p0.close()++ let total = 0+ let focusPage = null+ for (const s of SURFACES) {+ const p = await fresh()+ let res+ try {+ await s.open(p)+ await p.waitForTimeout(300)+ res = await p.evaluate(measure, s.scope)+ } catch (e) {+ ok(false, `${s.name}: opens (${e.message.split('\n')[0]})`)+ await p.close()+ continue+ }+ const bad = res.fields.map((f) => [f, problems(f, res.tok)]).filter(([, pr]) => pr.length)+ total += res.fields.length+ const own = res.fields.filter((f) => f.inScope).length+ ok(own >= s.min && bad.length === 0,+ `${s.name}: ${own} field(s) of its own (floor ${s.min}), all ${res.fields.length} on the page in the field look` ++ bad.map(([f, pr]) => `\n ${f.id}: ${pr.join('; ')}`).join(''))+ if (s.name === 'chart') focusPage = p+ else await p.close()+ }+ ok(total >= 150, `${total} fields measured across ${SURFACES.length} surfaces`)++ // 2. the focus ring, on each kind of field the chart panel carries+ const p = focusPage+ for (const sel of ['input[type="text"]', 'input[type="number"]', 'select']) {+ const ring = await p.evaluate((sel) => {+ const el = [...document.querySelectorAll(`.dp-panel ${sel}`)].find((e) => e.getBoundingClientRect().width)+ if (!el) return null+ el.focus({ focusVisible: true })+ const s = getComputedStyle(el)+ const probe = document.createElement('div')+ probe.style.color = getComputedStyle(document.documentElement).getPropertyValue('--accent-ink')+ document.body.appendChild(probe)+ const want = getComputedStyle(probe).color+ probe.remove()+ return { style: s.outlineStyle, width: s.outlineWidth, color: s.outlineColor, want, focusVisible: el.matches(':focus-visible') }+ }, sel)+ ok(ring && ring.focusVisible && ring.style === 'solid' && ring.width === '2px' && ring.color === ring.want,+ `focused ${sel} shows the ring (${ring ? `${ring.width} ${ring.style} ${ring.color}, want ${ring.want}` : 'none found'})`)+ }+ // a textarea, on the surface that has one+ {+ const tp = await fresh()+ await tp.locator('[data-act="about"]').click(); await byText(tp, 'Replace from JSON…'); await tp.waitForTimeout(200)+ const ring = await tp.evaluate(() => {+ const el = document.querySelector('.dx-about textarea')+ if (!el) return null+ el.focus({ focusVisible: true })+ const s = getComputedStyle(el)+ const probe = document.createElement('div')+ probe.style.color = getComputedStyle(document.documentElement).getPropertyValue('--accent-ink')+ document.body.appendChild(probe)+ const want = getComputedStyle(probe).color+ probe.remove()+ return { style: s.outlineStyle, width: s.outlineWidth, color: s.outlineColor, want, focusVisible: el.matches(':focus-visible') }+ })+ ok(ring && ring.focusVisible && ring.style === 'solid' && ring.width === '2px' && ring.color === ring.want,+ `focused textarea shows the ring (${ring ? `${ring.width} ${ring.style} ${ring.color}, want ${ring.want}` : 'none found'})`)+ await tp.close()+ }++ // 4. the check catches the browser's dress: plant a field whose author+ // styles are reverted, and it must come back with problems+ const planted = await p.evaluate(() => {+ const el = document.createElement('input')+ el.setAttribute('data-planted', '')+ el.style.all = 'revert'+ document.querySelector('.dp-panel, body').appendChild(el)+ return true+ }) && (await p.evaluate(measure))+ const pf = planted.fields.find((f) => f.planted)+ const pr = pf ? problems(pf, planted.tok) : []+ ok(pf && pr.some((x) => /browser default|fill|radius/.test(x)), `a browser-dressed field is flagged (${pr.join('; ') || 'not flagged'})`)+ await p.close()+ await ctx.close()+ }+} finally {+ await browser.close()+}+console.log(`\n${checks - failures}/${checks} checks passed`)+if (failures) process.exit(1)