From b6c3e9f610599a8f83933ef8daf28101286d6a06 Mon Sep 17 00:00:00 2001 From: WooBin Date: Fri, 20 Nov 2026 11:46:54 -0800 Subject: [PATCH] @hanzo/ui 8.33.6: Effort and Mode lists seen again; Model, Effort and Mode titled on the row Releases #327 (the Effort and Mode lists open where they can be seen, hanzo-inc/app#444) and holds the row's titles in place (hanzo-inc/app#313). The closed words already read as their title over (or beside, on a phone) their value since 8.33.5: "Model Opus 5.5", "Effort Auto", "Mode Manual". Nothing held that. test:composer now requires each one's visible text to start with its title and end with its value, at every width and theme, in Chat and in Dev; with the titles taken out it fails 24 times. Tune.test.tsx says the same in jsdom. test:composer also opens the Model picker, beside Effort and Mode: a panel seen on screen, beside its word on a laptop, and put away by Escape. Co-Authored-By: Claude Opus 5.5 --- pkg/ui/package.json | 2 +- pkg/ui/scripts/composer.mjs | 22 ++++++++++++++-------- pkg/ui/src/chat/Tune.test.tsx | 9 +++++++++ 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/pkg/ui/package.json b/pkg/ui/package.json index 36ced5e2c..58d4753b2 100644 --- a/pkg/ui/package.json +++ b/pkg/ui/package.json @@ -1,6 +1,6 @@ { "name": "@hanzo/ui", - "version": "8.33.5", + "version": "8.33.6", "type": "module", "description": "Hanzo UI — the one canonical Hanzo component library, on @hanzo/gui + @hanzo/design. ONE substrate: every component renders through @hanzo/gui primitives, so the same import works on web, native (expo) and desktop (Tauri). Self-contained (theme.css), presentational, host-agnostic, clean-room.", "exports": { diff --git a/pkg/ui/scripts/composer.mjs b/pkg/ui/scripts/composer.mjs index b84dee017..f0fd53268 100644 --- a/pkg/ui/scripts/composer.mjs +++ b/pkg/ui/scripts/composer.mjs @@ -97,7 +97,7 @@ const measure = (tab) => const range = document.createRange() range.selectNodeContents(text) const ink = range.getBoundingClientRect() - return { name: el.getAttribute('aria-label') || el.textContent, ...box(el), chip: el.matches('[data-slot="composer-chip"]'), edge: parseFloat(s.borderTopWidth), edgeColor: s.borderTopColor, bg: s.backgroundColor, ink: { x: ink.left, r: ink.right } } + return { name: el.getAttribute('aria-label') || el.textContent, text: el.innerText.replace(/\s+/g, ' ').trim(), ...box(el), chip: el.matches('[data-slot="composer-chip"]'), edge: parseFloat(s.borderTopWidth), edgeColor: s.borderTopColor, bg: s.backgroundColor, ink: { x: ink.left, r: ink.right } } }) .sort((a, b) => a.x - b.x) const fr = box(frame) @@ -237,6 +237,11 @@ for (const [width, height, ratio] of [ // Under the frame: labelled controls at least a word tall, a transparent edge and no fill at rest, at the text edge. check(m.words.some((w) => /^Effort: /.test(w.name)) && m.words.some((w) => /^Model: /.test(w.name)), `${name}: the model and the effort are words under the frame (${m.words.map((w) => w.name).join(', ')})`) if (kind === 'dev') check(m.words.filter((w) => /Where the run runs|Repository|Branch/.test(w.name)).length === 3, `${name}: the pills are words under the frame`) + // Closed, each one reads as what it chooses, its title before its value: never two bare "Auto"s side by side (hanzo-inc/app#313). + for (const w of m.words.filter((w) => /^(Model|Effort|Mode): /.test(w.name))) { + const [title, value] = w.name.split(': ') + check(w.text.startsWith(title) && w.text.endsWith(value) && w.text !== value, `${name}: ${title} is titled on the row, not only its value ("${w.text}")`) + } for (const w of m.words) { // Model, Effort and Mode are labelled controls (the label over the value); the pills and chips stay words. const labelled = /^(Model|Effort|Mode): /.test(w.name) || w.chip @@ -284,15 +289,16 @@ for (const [width, height, ratio] of [ await tab.screenshot({ path: join(OUT, `${name}.png`) }) await tab.locator('[data-slot="composer-shell"]').screenshot({ path: join(OUT, `${name}-rest.png`) }) - // Effort and Mode open their list where it can be seen: drawn, on screen, beside the word that opened it. - for (const slotName of kind === 'dev' ? ['effort', 'mode'] : ['effort']) { + // Model, Effort and Mode open their list where it can be seen: drawn, on screen, beside the word that opened it. + const lists = { 'model-picker': '[data-slot="model-picker-panel"], [data-slot="model-picker-sheet"]', effort: '[data-slot="choices"]', mode: '[data-slot="choices"]' } + for (const slotName of kind === 'dev' ? ['model-picker', 'effort', 'mode'] : ['model-picker', 'effort']) { const trigger = tab.locator(`[data-slot="composer-foot"] [data-slot="${slotName}"]`) check((await trigger.count()) === 1, `${name}: ${slotName} is drawn under the frame`) if (!(await trigger.count())) continue await trigger.click() - await tab.locator('[data-slot="choices"]').last().waitFor({ state: 'visible', timeout: 5_000 }).catch(() => {}) - const panel = await tab.evaluate((s) => { - const list = [...document.querySelectorAll('[data-slot="choices"]')].at(-1) + await tab.locator(lists[slotName]).last().waitFor({ state: 'visible', timeout: 5_000 }).catch(() => {}) + const panel = await tab.evaluate(([s, sel]) => { + const list = [...document.querySelectorAll(sel)].at(-1) if (!list) return null const b = list.getBoundingClientRect() const t = document.querySelector(`[data-slot="composer-foot"] [data-slot="${s}"]`).getBoundingClientRect() @@ -302,14 +308,14 @@ for (const [width, height, ratio] of [ if (st.opacity === '0' || st.visibility === 'hidden' || st.display === 'none') seen = false } return { seen, x: b.x, y: b.y, r: b.right, bottom: b.bottom, w: b.width, vw: innerWidth, vh: innerHeight, gap: Math.min(Math.abs(t.top - b.bottom), Math.abs(b.top - t.bottom)) } - }, slotName) + }, [slotName, lists[slotName]]) check( panel && panel.seen && panel.w > 0 && panel.x >= 0 && panel.y >= 0 && panel.r <= panel.vw + 1 && panel.bottom <= panel.vh + 1, `${name}: ${slotName} opens a list that is seen on screen (${JSON.stringify(panel)})`, ) if (!phone) check(panel && panel.gap <= 24, `${name}: ${slotName}'s list opens beside its word (${panel?.gap})`) await tab.keyboard.press('Escape') - const shut = await tab.locator('[data-slot="choices"]').last().waitFor({ state: 'hidden', timeout: 5_000 }).then(() => true, () => false) + const shut = await tab.locator(lists[slotName]).last().waitFor({ state: 'hidden', timeout: 5_000 }).then(() => true, () => false) check(shut, `${name}: Escape puts ${slotName}'s list away`) await settle(tab) } diff --git a/pkg/ui/src/chat/Tune.test.tsx b/pkg/ui/src/chat/Tune.test.tsx index 952999615..abe12a6c7 100644 --- a/pkg/ui/src/chat/Tune.test.tsx +++ b/pkg/ui/src/chat/Tune.test.tsx @@ -115,6 +115,15 @@ describe('Tune', () => { expect(set).toHaveBeenCalledWith('auto') }) + it('titles each closed word with what it chooses, so two Autos never stand alone (hanzo-inc/app#313)', () => { + const auto = [{ id: 'auto', label: 'Auto', note: 'Adaptive' }] + mount( {}, items: auto }} mode={{ value: 'auto', set: () => {}, items: auto }} />) + const text = (slot: string) => host.querySelector(`[data-slot="${slot}"]`)!.textContent + expect(text('model-picker')).toBe('ModelEnso') + expect(text('effort')).toBe('EffortAuto') + expect(text('mode')).toBe('ModeAuto') + }) + it('draws nothing where the surface has no model, no effort and no mode', () => { mount() expect(host.querySelector('[data-slot="tune"]')?.children.length).toBe(0)