diff --git a/.agents/skills/verify-codeimage/SKILL.md b/.agents/skills/verify-codeimage/SKILL.md index 247aa8499..a238b82ba 100644 --- a/.agents/skills/verify-codeimage/SKILL.md +++ b/.agents/skills/verify-codeimage/SKILL.md @@ -54,7 +54,7 @@ The helper's `finally` closes its browser/context and terminates only its own Vi ## Helpers -Select `VERIFY_CASES=keyboard-scroll` for keyboard opening of scrollable-panel menus and selects across Inspector, Dock, and Studio at desktop and phone sizes. The Node watchdog interrupts a frozen renderer after five seconds. Read [keyboard coverage](features/keyboard.md) for discovery rules and evidence. Run `fnm exec --using=v24.14.0 node --test .agents/skills/verify-codeimage/scripts/keyboard-scroll.test.mjs` for the dependency traversal regression. +Select `VERIFY_CASES=keyboard-scroll` for keyboard opening of scrollable-panel menus and selects across Inspector, Dock, and Studio at desktop and phone sizes. The Node watchdog interrupts a frozen renderer after five seconds. Read [keyboard coverage](features/keyboard.md) for discovery rules and evidence. `node .agents/skills/verify-codeimage/scripts/verify.mjs` runs the full baseline. It is executable and accepts `VERIFY_PORT` and `ARTIFACT_DIR` environment overrides. To re-run selected journeys, set `VERIFY_CASES=export-options,settings-persistence` together with `VERIFY_AUDIT=1`. Omit `VERIFY_CASES` for the complete pass. Unknown names fail the run. `audit.json` lists only the journeys actually selected and is flushed before recovery after a failure. On a shared machine, use short `VERIFY_CASES` batches, unique server/debugging ports, and retry a killed case at most twice. Never terminate another session’s processes. diff --git a/.agents/skills/verify-codeimage/features/export.md b/.agents/skills/verify-codeimage/features/export.md index dd9223ce0..a33314cb1 100644 --- a/.agents/skills/verify-codeimage/features/export.md +++ b/.agents/skills/verify-codeimage/features/export.md @@ -20,6 +20,8 @@ Run `export-options` for actual 1x and 2x PNG dimensions, JPEG magic bytes and a Run `VERIFY_AUDIT=1 VERIFY_CASES=export-dialog node .agents/skills/verify-codeimage/scripts/verify.mjs` for the Dialog export style. The case switches styles in Settings, checks the decoded preview, dismisses with Escape and checks trigger focus. It downloads and parses a one-off SVG, then checks that PNG remains the default until saving SVG with Remember as default. Each SVG must contain the editor text and have positive dimensions. +Run `export-notification` to check the notification after a PNG download. The case selects Copy alt text, checks that the success notification closes, and reads the exported code from the clipboard. + Run `export-fractional-geometry,export-padding-geometry` for fractional frame measurement and padding-only signature changes. The cases edit short, sample and long code through CodeMirror, fit the long document on desktop and phone, change padding and switch Card to Minimal through the signature controls. They compare live and export border boxes and decode real 1x/2x PNG downloads. At zoom 1, fractional geometry must match within 0.02 CSS pixels; fitted text allows one screen pixel of layout snapping. The signature case tolerates integer rounding but rejects stale reserved padding independently of fractional precision. Each case saves its geometry JSON, screenshots, traces, downloaded PNGs and persisted document snapshots. To compare those actual downloads with the CLI, run `scripts/parity/cli-vs-web/index.ts` with the corresponding `-1x.json` / `-2x.json` inputs and `P10_WEB_EXPORTS=`. `P10_WEB_OUT` selects the comparison directory. The runner records both sizes and pixelmatch percentages in `results.json`; a size mismatch fails without hiding later documents. Omit `P10_WEB_EXPORTS` for the existing static preview fixture comparison. diff --git a/.agents/skills/verify-codeimage/features/keyboard.md b/.agents/skills/verify-codeimage/features/keyboard.md index 50106556a..32c0d8bab 100644 --- a/.agents/skills/verify-codeimage/features/keyboard.md +++ b/.agents/skills/verify-codeimage/features/keyboard.md @@ -2,9 +2,9 @@ `keyboard-scroll` opens menu and select triggers with Enter, Space, and ArrowDown. The matrix uses fresh contexts at 1440×900 and 390×844 for Inspector, Dock, and Studio. Each context sets `codeimage:editor-settings` before loading the editor. The legacy `inspector` and `studio` values exercise their migration to the accordion and rail sidebar preferences. -The journey creates a preset through the UI, visits the sidebar sections, and opens the Signature overlay. Dock visits each More group and the Font and phone Language panels. Dock has no Presets panel. Discovery includes enabled menu, listbox, and combobox triggers inside the active control panel or overlay with a CSS `auto` or `scroll` ancestor. Closed accordion sections and controls behind an overlay are excluded. A CSS scroll container matters even when its contents currently fit, because Kobalte checks overflow styles rather than scroll dimensions. +The journey creates a preset through the UI, visits the sidebar sections, and opens the Signature overlay. Dock visits each More group and the Font and phone Language panels. Dock has no Presets panel. Discovery includes enabled menu, listbox, and combobox triggers inside the active control panel or overlay with a CSS `auto` or `scroll` ancestor. Closed accordion sections and controls behind an overlay are excluded. -Discovery waits for finite panel transitions and reads the candidate list in one browser evaluation. Every discovered trigger receives focus before each key. The journey asserts that its popup appears, `aria-expanded` becomes true, the renderer completes another animation frame, and Escape closes the popup and restores focus. An explicit control list for each layout prevents missing controls from silently passing. +Discovery waits for finite panel transitions and reads the candidate list in one browser evaluation. Every discovered trigger receives focus before each key. The journey asserts that its popup appears, `aria-expanded` becomes true, the renderer completes another animation frame, and Escape closes the popup and restores focus. After the Signature sweep, another Escape closes Signature and returns focus to its opener. An explicit control list for each layout prevents missing controls from silently passing. Sidebar coverage includes Preset menu, Padding, Saved signatures, Avatar source, Border, Shadow, Language, Theme, Font, and Font weight. Dock coverage includes Saved signatures, Avatar source, Border, Shadow, Syntax theme, and Font weight. The Signature fixture selects Card and Profile to reveal Avatar source. This produces 156 key openings across the six layout and viewport combinations. Native segmented controls, standalone listboxes, disabled controls, and triggers outside scrollable control panels are outside this case. @@ -20,8 +20,4 @@ VERIFY_AUDIT=1 VERIFY_CASES=keyboard-scroll VERIFY_BROWSER_CHANNEL=chrome VERIFY `rail-interrupted-close` closes Themes and immediately opens Frame on a 390 px Sidebar Rail. Frame must stay open after the Themes exit would have finished. The case repeats with reduced motion and verifies that closing Frame returns focus to its rail button. -The dependency patch is `patches/@kobalte__utils@0.9.1.patch`. Both ESM and CommonJS bundles start each `scrollIntoViewport` lookup at the target's parent. Each iteration therefore reaches a strict ancestor and eventually the document root. The exported `getScrollParent` behavior remains unchanged. The editor's root overflow and the Animate trigger placement workaround remain unchanged. - -`scripts/keyboard-scroll.test.mjs` runs the installed ESM utility against a hidden document root and nested CSS scroll containers. A visit limit fails the original loop without hanging the test process. The test also checks that `getScrollParent` keeps its exported behavior and that scrollable targets and detached elements terminate. `VERIFY_KOBALTE_UTILS` can point to the original package's `dist/index.cjs` to repeat the negative control; the test imports its adjacent ESM bundle. - -Installed Kobalte versions are core 0.13.11 and utils 0.9.1. The app, UI package, and kit share that utils resolution. On November 16, 2026, published utils 0.9.2 still contains the loop; core 0.13.14 depends on utils ^0.9.2. Their changelogs contain no fix for this loop. [Upstream PR 750](https://github.com/kobaltedev/kobalte/pull/750) proposes the same parent traversal and remains open. Recheck published source before removing the patch or updating Kobalte. +`signatures` verifies nested dismissal. The first Escape closes Saved signatures and returns focus to its trigger. The second closes Signature and returns focus to its opener. diff --git a/.agents/skills/verify-codeimage/features/projects.md b/.agents/skills/verify-codeimage/features/projects.md index 175c7ddbd..2c6d5948c 100644 --- a/.agents/skills/verify-codeimage/features/projects.md +++ b/.agents/skills/verify-codeimage/features/projects.md @@ -47,16 +47,16 @@ Ownership and failed-load fixtures use the existing MSW boundary. Navigation use To isolate a snippet matrix lane, set `VERIFY_SNIPPET_LAYOUT=inspector`, `dock`, or `studio`, and `VERIFY_SNIPPET_WIDTH=1440` or `390`. The default remains all six combinations. Each run writes the lanes actually exercised to `-matrix.json`; a selected lane does not establish full matrix coverage. All scenario assertions remain active. These selectors allow fresh Chrome processes when a long-lived local browser exits during repeated context changes. -## Bridged project actions +## Project actions from the dashboard -Run the dashboard case on Node 24 to exercise the Solid 2 project menu and its bridged Solid 1 CodeUI trigger. +Run the dashboard case on Node 24 to exercise the CodeUI project menu. ```sh -VERIFY_AUDIT=1 VERIFY_CASES=solid1-bridge-project-menu \ +VERIFY_AUDIT=1 VERIFY_CASES=project-menu \ VERIFY_BROWSER_CHANNEL=chrome node .agents/skills/verify-codeimage/scripts/verify.mjs ``` -The case creates a disposable MSW project, opens the menu by keyboard, checks Escape and focus, renames the project through the app dialog, clones it and follows the new URL, then deletes the original through the app dialog. It checks the mutation responses and verifies that the rename dialog blocks background clicks only while open. +The case creates a disposable project in MSW. It opens the menu with ArrowDown and checks that Escape returns focus to its trigger. It opens Rename with Enter and checks the rename response. Then it clones the project, follows the new URL, and deletes the original. It checks both mutation responses and confirms that the rename dialog blocks background clicks while open. ## Read-only notice diff --git a/.agents/skills/verify-codeimage/features/signatures.md b/.agents/skills/verify-codeimage/features/signatures.md index cf0f8feaa..a7d9bcbff 100644 --- a/.agents/skills/verify-codeimage/features/signatures.md +++ b/.agents/skills/verify-codeimage/features/signatures.md @@ -12,7 +12,9 @@ Open Frame then Signature (`#signature-options`); after creation the canvas sign ## Driving it with Playwright -The `signatures` case clicks `#signature-options` (the open overlay is `[data-control-overlay="signature"]`), fills @handle or profile link, chooses Saved signatures → Save as new → group Signature name → its textbox → Save. Assert `[data-frame-signature]` contains the handle; export PNG. Reload same context, open Saved signatures and apply named menuitem to prove persistence. Card exposes display name/avatar. Choose Initials for local proof. +The `signatures` case opens Signature with Enter and fills the handle. It opens Saved signatures with ArrowDown. Escape first dismisses the menu and returns focus to Saved signatures. A second Escape dismisses Signature and returns focus to its opener. + +The case reopens Signature, saves a new signature, checks the canvas handle, and decodes the downloaded PNG. It reloads the same context and selects the saved signature to check persistence. Card exposes the display name and avatar. Choose Initials for a local check. Source: `pages/UnifiedEditor/controls/SignatureFields.tsx`, `controls/SavedSignatures.tsx`, `state/signatures/bridge.ts`. diff --git a/.agents/skills/verify-codeimage/features/tabs.md b/.agents/skills/verify-codeimage/features/tabs.md index af3bf6fa8..21d06aa19 100644 --- a/.agents/skills/verify-codeimage/features/tabs.md +++ b/.agents/skills/verify-codeimage/features/tabs.md @@ -16,6 +16,8 @@ Run `VERIFY_AUDIT=1 VERIFY_CASES=tabs fnm exec --using=v24.14.0 node .agents/ski The `tabs` case uses the Editor window style. The `tabs-classic` case runs the same journey in macOS chrome. Each enters distinct code in two tabs, selects their extensions with keyboard and pointer, and switches between them. It focuses a tab, uses Enter to activate it, then uses Space and ArrowRight to pick up and move it. Escape preserves order and focus. Space commits the next move. A pointer drag verifies that order stays stable until drop. The dragged tab follows the pointer inside the frame and keeps its background and shadow. The other tab stays in place. The audit renames a tab, checks the reordered names and decodes the image entries in the downloaded ZIP, then closes the active tab and checks the remaining document. The trace and drag screenshot capture the interaction. +The `plain-text-tab-icon` case renames a tab through filename completion, switches from a dark frame to XCode Light, and checks the icon's computed fill in both modes. + Source: `components/Terminal/Tabs/TerminalWindowTabList.tsx`, `Tab/WindowTab.tsx`, `Tab/DraggableWindowTab.tsx` (Close tab and dragging), `TabAddButton/TabAddButton.tsx` (Add tab), `TabName/TabName.tsx`, `hooks/export-tabs.ts`, `hooks/export-tab-name.ts`. ## Gotchas diff --git a/.agents/skills/verify-codeimage/features/whats-new.md b/.agents/skills/verify-codeimage/features/whats-new.md index 96693e0d7..ed17d6847 100644 --- a/.agents/skills/verify-codeimage/features/whats-new.md +++ b/.agents/skills/verify-codeimage/features/whats-new.md @@ -16,6 +16,8 @@ Case `whats-new` opens `[data-settings-section="whats-new"]`, asserts at least o Case `whats-new-nudge` uses a fresh Inspector profile at 1440×900. The 2026-11-14 release is major, so a fresh profile gets the Showcase sheet first, not the Nudge. The case clicks Minimize what's new, waits for the collapsed Nudge, clicks See, checks the `Step N of M` indicator moves from 1 to 2 with Next, clicks Dismiss what's new, waits for the dismissal in IndexedDB (`keyval-store`, key `whats-new`, non-empty `dismissed`), reloads and asserts no announcement returns. +Case `whats-new-tooltip-escape` checks that Escape dismisses the Minimize tooltip, keeps the Showcase open and leaves focus on the button. A second press closes the Showcase. + `scripts/news.mjs` exports `dismissNews(page)`. The doctor and the baseline call it, because a fresh profile gets the announcement a moment after the editor settles and it covers the editor: the Showcase sheet for a major release, the Nudge otherwise. It closes the announcement with its own close button and waits for its exit. A `sessionStorage` flag keeps later doctor calls in the same tab from waiting for it again. Case `whats-new-line-marks-dot` uses a fresh Inspector profile at 1440×900. It closes the announcement, waits for the Line marks dot (`[data-line-marks-news]`, a badge fixed to the viewport beside the marker of the cursor line), moves the inspector to the left in Settings → Appearance, and checks that the dot kept its offset from the marker cell and that the element under the dot is the dot itself. Before the move it turns line numbers on and checks the dot is still on screen at the same offset, then turns them off again. Moving the inspector moves the canvas without a resize or a scroll event, which is how the dot used to be left behind over other controls. diff --git a/.agents/skills/verify-codeimage/scripts/audit-whats-new.mjs b/.agents/skills/verify-codeimage/scripts/audit-whats-new.mjs new file mode 100644 index 000000000..36f05ebcc --- /dev/null +++ b/.agents/skills/verify-codeimage/scripts/audit-whats-new.mjs @@ -0,0 +1,116 @@ +import assert from 'node:assert/strict'; +import {resolve} from 'node:path'; +import {verifyShowcaseAction} from './audit-line-marks-news.mjs'; + +export async function auditWhatsNew({base, out, feature, fresh}) { + await feature('whats-new-tooltip-escape', () => + fresh( + { + name: 'whats-new-tooltip-escape', + layout: 'inspector', + viewport: {width: 1440, height: 900}, + }, + async ({page}) => { + await page.goto(base); + const dialog = page.getByRole('dialog', { + name: "What's new", + exact: true, + }); + const label = "Minimize what's new"; + const minimize = dialog.getByRole('button', {name: label, exact: true}); + await dialog + .getByRole('heading', {name: "What's new", exact: true}) + .waitFor(); + await minimize.hover(); + const tooltip = page.getByRole('tooltip').filter({hasText: label}); + await tooltip.waitFor(); + await minimize.press('Escape'); + await tooltip.waitFor({state: 'hidden'}); + assert.ok(await dialog.isVisible()); + assert.ok( + await minimize.evaluate(node => node === document.activeElement), + ); + await page.keyboard.press('Escape'); + await dialog.waitFor({state: 'hidden'}); + await page.locator('[data-whats-new-trigger]:focus').waitFor(); + }, + ), + ); + await feature('whats-new-nudge', () => + fresh( + { + name: 'whats-new-nudge', + layout: 'inspector', + viewport: {width: 1440, height: 900}, + }, + async ({page}) => { + const ready = () => + page.locator('.cm-content[contenteditable="true"]').waitFor(); + await page.goto(base, {waitUntil: 'domcontentloaded'}); + await ready(); + const sheet = page.locator('[data-whats-new="showcase"]'); + await verifyShowcaseAction(sheet); + await page + .getByRole('button', {name: "Minimize what's new", exact: true}) + .click(); + await sheet.waitFor({state: 'hidden'}); + const nudge = page.locator('[data-whats-new="nudge"]'); + await nudge.waitFor(); + await page.screenshot({ + path: resolve(out, 'whats-new-nudge-collapsed.png'), + }); + await nudge.getByRole('button', {name: 'See', exact: true}).click(); + const step = n => + nudge + .getByRole('img', {name: new RegExp(`^Step ${n} of \\d+$`)}) + .waitFor(); + await step(1); + await nudge.getByRole('button', {name: 'Next', exact: true}).click(); + await step(2); + await page.screenshot({path: resolve(out, 'whats-new-nudge.png')}); + await nudge + .getByRole('button', {name: "Dismiss what's new", exact: true}) + .click(); + await nudge.waitFor({state: 'hidden'}); + const dismissed = () => + page.evaluate( + () => + new Promise(done => { + const open = indexedDB.open('keyval-store'); + open.onerror = () => done([]); + open.onsuccess = () => { + const db = open.result; + const read = db + .transaction('keyval') + .objectStore('keyval') + .get('whats-new'); + read.onsuccess = () => { + db.close(); + done(read.result?.dismissed ?? []); + }; + read.onerror = () => { + db.close(); + done([]); + }; + }; + }), + ); + const until = Date.now() + 5000; + while ((await dismissed()).length === 0) { + assert.ok(Date.now() < until, 'the dismissal reaches IndexedDB'); + await page.waitForTimeout(100); + } + await page.reload({waitUntil: 'domcontentloaded'}); + await ready(); + await page.waitForTimeout(3000); + assert.equal( + await page + .locator('[data-whats-new="showcase"], [data-whats-new="nudge"]') + .count(), + 0, + 'a dismissed announcement stays away after a reload', + ); + }, + ), + ); +} diff --git a/.agents/skills/verify-codeimage/scripts/audit.mjs b/.agents/skills/verify-codeimage/scripts/audit.mjs index e5dda498e..c8b37ab35 100755 --- a/.agents/skills/verify-codeimage/scripts/audit.mjs +++ b/.agents/skills/verify-codeimage/scripts/audit.mjs @@ -4,14 +4,19 @@ import {createDoctor} from './health/doctor.mjs'; import assert from 'node:assert/strict'; import {auditPresetCases, auditPresetPersistence} from './presets.mjs'; import {auditLineMarks} from './audit-line-marks.mjs'; -import * as newsAudits from './audit-line-marks-news.mjs'; -import {verifyExportDialog} from './export-dialog.mjs'; +import {auditLineMarksNews} from './audit-line-marks-news.mjs'; +import {auditWhatsNew} from './audit-whats-new.mjs'; +import { + verifyExportDialog, + verifyExportNotification, +} from './export-dialog.mjs'; import {auditEditor} from './editor-responsiveness.mjs'; import {auditKeyboard} from './shortcut-help.mjs'; import {createMockContext} from './mock-context.mjs'; import {animationMp4Cases} from './animation-mp4.mjs'; import {auditSavedProjects, verifyProjectSearch} from './saved-projects.mjs'; import {auditSettingsSearch, closeSettingsDialog} from './settings-search.mjs'; +import {auditSignatures} from './signatures.mjs'; import {auditTabLayouts} from './tab-reorder.mjs'; import {writeFile, readFile} from 'node:fs/promises'; import {resolve} from 'node:path'; @@ -323,48 +328,9 @@ export async function audit({page, context, base, out, server}) { download, shot, }); - await feature('signatures', async () => { - await section('frame'); - await page.locator('#signature-options').click(); - await writeFile( - resolve(out, 'signature-open.aria.txt'), - await page.locator('body').ariaSnapshot(), - ); - await page - .getByPlaceholder('@handle or profile link', {exact: true}) - .fill('@verification'); - await page - .getByRole('button', {name: 'Saved signatures', exact: true}) - .click(); - await page - .getByRole('menuitem', {name: 'Save as new', exact: true}) - .click(); - await page - .getByRole('group', {name: 'Signature name', exact: true}) - .getByRole('textbox') - .fill('Verification signature'); - await page.getByRole('button', {name: 'Save', exact: true}).click(); - await page.keyboard.press('Escape'); - assert.match( - await page.locator('[data-frame-signature]').first().innerText(), - /@verification/, - ); - PNG.sync.read(await download('signature.png')); - await page.reload(); - await editor().waitFor(); - await section('frame'); - await page.locator('#signature-options').click(); - await page - .getByRole('button', {name: 'Saved signatures', exact: true}) - .click(); - await page.getByRole('menuitem', {name: /Verification signature/}).click(); - assert.equal( - await page - .getByPlaceholder('@handle or profile link', {exact: true}) - .inputValue(), - '@verification', - ); - }); + await feature('signatures', () => + auditSignatures({page, editor, section, download, out}), + ); await feature('whats-new', async () => { await settings('whats-new'); assert.ok((await page.locator('[data-setting^="news-"]').count()) > 0); @@ -381,90 +347,8 @@ export async function audit({page, context, base, out, server}) { .locator('[data-settings-section=general]') .waitFor({state: 'hidden'}); }); - await newsAudits.auditLineMarksNews({base, out, feature, fresh}); - // The current release is major, so a fresh profile gets the Showcase - // sheet. Minimize turns it into the Nudge card, which steps through the - // highlights, and a dismissal survives a reload. - await feature('whats-new-nudge', () => - fresh( - { - name: 'whats-new-nudge', - layout: 'inspector', - viewport: {width: 1440, height: 900}, - }, - async ({page}) => { - const ready = () => - page.locator('.cm-content[contenteditable="true"]').waitFor(); - await page.goto(base, {waitUntil: 'domcontentloaded'}); - await ready(); - const sheet = page.locator('[data-whats-new="showcase"]'); - await newsAudits.verifyShowcaseAction(sheet); - await page - .getByRole('button', {name: "Minimize what's new", exact: true}) - .click(); - await sheet.waitFor({state: 'hidden'}); - const nudge = page.locator('[data-whats-new="nudge"]'); - await nudge.waitFor(); - await page.screenshot({ - path: resolve(out, 'whats-new-nudge-collapsed.png'), - }); - await nudge.getByRole('button', {name: 'See', exact: true}).click(); - const step = n => - nudge - .getByRole('img', {name: new RegExp(`^Step ${n} of \\d+$`)}) - .waitFor(); - await step(1); - await nudge.getByRole('button', {name: 'Next', exact: true}).click(); - await step(2); - await page.screenshot({path: resolve(out, 'whats-new-nudge.png')}); - await nudge - .getByRole('button', {name: "Dismiss what's new", exact: true}) - .click(); - await nudge.waitFor({state: 'hidden'}); - // The dismissal is an IndexedDB write. Reload only once it landed. - // waitForFunction would pass at once on a promise, so poll here. - const dismissed = () => - page.evaluate( - () => - new Promise(done => { - const open = indexedDB.open('keyval-store'); - open.onerror = () => done([]); - open.onsuccess = () => { - const db = open.result; - const read = db - .transaction('keyval') - .objectStore('keyval') - .get('whats-new'); - read.onsuccess = () => { - db.close(); - done(read.result?.dismissed ?? []); - }; - read.onerror = () => { - db.close(); - done([]); - }; - }; - }), - ); - const until = Date.now() + 5000; - while ((await dismissed()).length === 0) { - assert.ok(Date.now() < until, 'the dismissal reaches IndexedDB'); - await page.waitForTimeout(100); - } - await page.reload({waitUntil: 'domcontentloaded'}); - await ready(); - // The announcement arrives about 700 ms after the editor settles. - await page.waitForTimeout(3000); - assert.equal( - await page - .locator('[data-whats-new="showcase"], [data-whats-new="nudge"]') - .count(), - 0, - 'a dismissed announcement stays away after a reload', - ); - }, - ), - ); + await auditLineMarksNews({base, out, feature, fresh}); + await auditWhatsNew({base, out, feature, fresh}); await feature('exports', async () => { const fallbacks = []; const observe = message => { @@ -542,6 +426,9 @@ export async function audit({page, context, base, out, server}) { verifyExportDialog(fixture, out), ), ); + await feature('export-notification', () => + verifyExportNotification({page, editor, download}), + ); await feature('export-options', async () => { try { await editor().fill('const exportOptions = true;'); @@ -694,8 +581,7 @@ export async function audit({page, context, base, out, server}) { .getByRole('menuitem', {name: 'Save as new', exact: true}) .click(); await page - .getByRole('group', {name: 'Signature name', exact: true}) - .getByRole('textbox') + .getByRole('textbox', {name: 'Signature name', exact: true}) .fill('Management signature'); await page.getByRole('button', {name: 'Save', exact: true}).click(); @@ -704,8 +590,7 @@ export async function audit({page, context, base, out, server}) { .click(); await page.getByRole('menuitem', {name: 'Rename', exact: true}).click(); await page - .getByRole('group', {name: 'Signature name', exact: true}) - .getByRole('textbox') + .getByRole('textbox', {name: 'Signature name', exact: true}) .fill('Renamed signature'); await page.getByRole('button', {name: 'Save', exact: true}).click(); await page diff --git a/.agents/skills/verify-codeimage/scripts/editor-responsiveness.mjs b/.agents/skills/verify-codeimage/scripts/editor-responsiveness.mjs index 42caabcdd..8493fb5ac 100644 --- a/.agents/skills/verify-codeimage/scripts/editor-responsiveness.mjs +++ b/.agents/skills/verify-codeimage/scripts/editor-responsiveness.mjs @@ -59,14 +59,54 @@ export async function auditEditor({feature, fresh, doctor, editor, page}) { ); } }); + await auditThemeSearch({feature, fresh}); + await feature('system-colour-mode', async () => { + await fresh( + { + name: 'system-colour-mode', + layout: 'inspector', + viewport: {width: 1440, height: 900}, + }, + async ({page, doctor, settings}) => { + const theme = colour => + page.locator(`html[data-cui-theme="${colour}"]`); + await doctor(); + await page.emulateMedia({colorScheme: 'light'}); + await settings('appearance'); + const mode = page.locator('[data-setting="colour-mode"]'); + await mode.getByRole('radio', {name: /^System/}).press('Space'); + await theme('light').waitFor({state: 'attached'}); + await page.emulateMedia({colorScheme: 'dark'}); + await theme('dark').waitFor({state: 'attached'}); + await mode.getByRole('radio', {name: /^Light/}).press('Space'); + await theme('light').waitFor({state: 'attached'}); + await page.emulateMedia({colorScheme: 'light'}); + await page.emulateMedia({colorScheme: 'dark'}); + await page.evaluate( + () => + new Promise(resolve => { + requestAnimationFrame(() => requestAnimationFrame(resolve)); + }), + ); + assert.equal(await theme('light').count(), 1); + }, + ); + }); +} + +async function auditThemeSearch({feature, fresh}) { await feature('theme-search-field', async () => { - for (const width of [1440, 390]) { + for (const [width, hasTouch] of [ + [1440, false], + [390, true], + [390, false], + ]) { await fresh( { - name: `theme-search-field-${width}`, + name: `theme-search-field-${width}-${hasTouch ? 'touch' : 'mouse'}`, layout: 'inspector', viewport: {width, height: 900}, - hasTouch: width < 768, + hasTouch, }, async ({page, doctor}) => { await doctor(); @@ -80,7 +120,7 @@ export async function auditEditor({feature, fresh, doctor, editor, page}) { exact: true, }); await search.waitFor(); - const filter = picker.getByRole('tablist'); + const filter = picker.locator('[data-cui="segmentedcontrol"]'); const [fieldBox, filterBox] = await Promise.all([ search.boundingBox(), filter.boundingBox(), @@ -91,7 +131,28 @@ export async function auditEditor({feature, fresh, doctor, editor, page}) { height, 'Theme search uses the full field height', ); - assert.ok(Math.abs(fieldBox.height - filterBox.height) <= 8); + assert.equal( + filterBox.height, + height, + 'Theme filter aligns with search', + ); + if (width < 768) { + const dark = filter.getByRole('tab', {name: 'Dark', exact: true}); + const all = filter.getByRole('tab', {name: 'All', exact: true}); + const darkBox = await dark.boundingBox(); + const center = darkBox.x + darkBox.width / 2; + for (const y of [filterBox.y + 1, filterBox.y + height - 1]) { + await all.click(); + if (hasTouch) await page.touchscreen.tap(center, y); + else await page.mouse.click(center, y); + assert.equal(await dark.getAttribute('aria-selected'), 'true'); + } + await all.click(); + assert.equal( + await search.evaluate(el => getComputedStyle(el).fontSize), + '16px', + ); + } await search.fill('Dracula'); const option = picker.getByRole('option', { name: 'Dracula Dark theme', @@ -107,40 +168,31 @@ export async function auditEditor({feature, fresh, doctor, editor, page}) { await search.press('Escape'); assert.equal(await search.inputValue(), ''); assert.ok((await picker.getByRole('option').count()) > 1); + if (width > 768) await verifyThemeFilterMotion(page, filter); }, ); } }); - await feature('system-colour-mode', async () => { - await fresh( - { - name: 'system-colour-mode', - layout: 'inspector', - viewport: {width: 1440, height: 900}, - }, - async ({page, doctor, settings}) => { - const theme = colour => - page.locator(`html[data-cui-theme="${colour}"]`); - await doctor(); - await page.emulateMedia({colorScheme: 'light'}); - await settings('appearance'); - const mode = page.locator('[data-setting="colour-mode"]'); - await mode.getByRole('radio', {name: /^System/}).press('Space'); - await theme('light').waitFor({state: 'attached'}); - await page.emulateMedia({colorScheme: 'dark'}); - await theme('dark').waitFor({state: 'attached'}); - await mode.getByRole('radio', {name: /^Light/}).press('Space'); - await theme('light').waitFor({state: 'attached'}); - await page.emulateMedia({colorScheme: 'light'}); - await page.emulateMedia({colorScheme: 'dark'}); - await page.evaluate( - () => - new Promise(resolve => { - requestAnimationFrame(() => requestAnimationFrame(resolve)); - }), - ); - assert.equal(await theme('light').count(), 1); - }, +} + +async function verifyThemeFilterMotion(page, filter) { + const dark = filter.getByRole('tab', {name: 'Dark', exact: true}); + const indicator = filter.locator('[data-cui="segmentedcontrol-indicator"]'); + const indicatorMoves = () => + indicator.evaluate(element => + getComputedStyle(element) + .transitionDuration.split(',') + .some(duration => Number.parseFloat(duration) > 0), ); - }); + await dark.click(); + assert.ok(await indicatorMoves(), 'The indicator moves on pointer selection'); + await page.keyboard.press('ArrowLeft'); + assert.equal(await indicatorMoves(), false, 'Keyboard selection is instant'); + await page.emulateMedia({reducedMotion: 'reduce'}); + await dark.click(); + assert.equal( + await indicatorMoves(), + false, + 'Reduced motion keeps the indicator still', + ); } diff --git a/.agents/skills/verify-codeimage/scripts/export-dialog.mjs b/.agents/skills/verify-codeimage/scripts/export-dialog.mjs index 9cc45f2d4..90b772b9d 100644 --- a/.agents/skills/verify-codeimage/scripts/export-dialog.mjs +++ b/.agents/skills/verify-codeimage/scripts/export-dialog.mjs @@ -2,6 +2,20 @@ import assert from 'node:assert/strict'; import {resolve} from 'node:path'; import {readFile} from 'node:fs/promises'; +export async function verifyExportNotification({page, editor, download}) { + await editor().fill('const exportNotification = true;'); + await download('notification.png'); + const toast = page.getByRole('status').filter({hasText: 'Image exported'}); + await toast.getByRole('button', {name: 'Close notification'}).waitFor(); + await toast.getByRole('button', {name: 'Copy alt text', exact: true}).click(); + await toast.waitFor({state: 'hidden'}); + await page.getByRole('status').filter({hasText: 'Alt text copied'}).waitFor(); + assert.match( + await page.evaluate(() => navigator.clipboard.readText()), + /exportNotification/, + ); +} + export async function verifyExportDialog( {page, doctor, editor, settings, closeSettings}, out, diff --git a/.agents/skills/verify-codeimage/scripts/keyboard-scroll.mjs b/.agents/skills/verify-codeimage/scripts/keyboard-scroll.mjs index 213c778bf..9cd892eb1 100644 --- a/.agents/skills/verify-codeimage/scripts/keyboard-scroll.mjs +++ b/.agents/skills/verify-codeimage/scripts/keyboard-scroll.mjs @@ -169,18 +169,21 @@ export async function verifyKeyboardScroll({fresh, out}) { `${description.label}: trigger receives focus`, ); await page.keyboard.press(key); - await page - .getByRole( - ['true', 'menu'].includes(description.popup) - ? 'menu' - : 'listbox', - ) - .last() - .waitFor({state: 'visible'}); - assert.equal( - await trigger.getAttribute('aria-expanded'), - 'true', + await trigger + .and(page.locator('[aria-expanded="true"]')) + .waitFor({timeout: 3000}); + const popupId = await trigger.getAttribute('aria-controls'); + assert.ok( + popupId, + `${description.label}: controls a popup`, ); + const role = ['true', 'menu'].includes(description.popup) + ? 'menu' + : 'listbox'; + const popup = page + .getByRole(role) + .and(page.locator(`[id=${JSON.stringify(popupId)}]`)); + await popup.waitFor(); // A frame and an evaluation after keydown prove the renderer responds. await page.evaluate( () => @@ -189,6 +192,7 @@ export async function verifyKeyboardScroll({fresh, out}) { ), ); await page.keyboard.press('Escape'); + await popup.waitFor({state: 'hidden'}); assert.equal( await trigger.getAttribute('aria-expanded'), 'false', @@ -263,34 +267,15 @@ export async function verifyKeyboardScroll({fresh, out}) { await page.locator('#signature-options').click(); await signature(); await sweep('Signature'); + await page.keyboard.press('Escape'); await page - .getByRole('dialog', {name: 'Signature', exact: true}) - .getByRole('button', {name: 'Close', exact: true}) - .click(); + .locator('#signature-options:focus[aria-expanded="false"]') + .waitFor(); await open('window', 'Window'); await sweep('Window'); await open('code', 'Code'); await sweep('Code'); - assert.ok( - records.some( - record => - record.layout === layout && - record.viewport.width === viewport.width && - record.label === 'Preset menu', - ), - `${name}: preset regression exercised`, - ); } - for (const label of ['Saved signatures', 'Avatar source']) - assert.ok( - records.some( - record => - record.layout === layout && - record.viewport.width === viewport.width && - record.label === label, - ), - `${name}: ${label} exercised`, - ); const expected = layout === 'dock' ? [ diff --git a/.agents/skills/verify-codeimage/scripts/keyboard-scroll.test.mjs b/.agents/skills/verify-codeimage/scripts/keyboard-scroll.test.mjs deleted file mode 100644 index 36c59a8e5..000000000 --- a/.agents/skills/verify-codeimage/scripts/keyboard-scroll.test.mjs +++ /dev/null @@ -1,55 +0,0 @@ -import assert from 'node:assert/strict'; -import {createRequire} from 'node:module'; -import {pathToFileURL} from 'node:url'; -import {test} from 'node:test'; - -const require = createRequire( - new URL('../../../../apps/codeimage/package.json', import.meta.url), -); -const {Window} = require('happy-dom'); -const commonjs = - process.env.VERIFY_KOBALTE_UTILS ?? require.resolve('@kobalte/utils'); - -test('hidden-root traversal terminates through nested scroll parents', async () => { - const window = new Window(); - const previous = {window: globalThis.window, document: globalThis.document}; - globalThis.window = window; - globalThis.document = window.document; - try { - const utils = await import(new URL('index.js', pathToFileURL(commonjs))); - document.documentElement.style.overflow = 'hidden'; - document.body.innerHTML = - '
'; - const outer = document.body.firstElementChild; - const inner = outer.firstElementChild; - const trigger = inner.firstElementChild; - const computedStyle = window.getComputedStyle.bind(window); - const visited = []; - window.getComputedStyle = element => { - visited.push(element); - assert.ok( - visited.length < 32, - 'scrollIntoViewport must progress rather than revisit the same scroll parent forever', - ); - return computedStyle(element); - }; - utils.scrollIntoViewport(trigger); - assert.ok(visited.includes(inner)); - assert.ok( - visited.includes(outer), - 'nested traversal reaches the outer scroll container', - ); - assert.equal(document.documentElement.scrollTop, 0); - assert.equal( - utils.getScrollParent(inner), - inner, - 'exported getScrollParent still includes its starting element', - ); - utils.scrollIntoViewport(inner); - const detached = document.createElement('button'); - utils.scrollIntoViewport(detached); - } finally { - Object.assign(globalThis, previous); - await window.happyDOM.close(); - } -}); diff --git a/.agents/skills/verify-codeimage/scripts/saved-projects.mjs b/.agents/skills/verify-codeimage/scripts/saved-projects.mjs index 4021ebfb8..af0d5a970 100644 --- a/.agents/skills/verify-codeimage/scripts/saved-projects.mjs +++ b/.agents/skills/verify-codeimage/scripts/saved-projects.mjs @@ -16,7 +16,7 @@ export async function verifyProjectSearch(page, row) { await name.waitFor(); } -async function auditProjectMenuBridge({page}) { +async function auditProjectMenu({page}) { const errors = []; const captureError = error => errors.push(error.message); page.on('pageerror', captureError); @@ -40,10 +40,15 @@ async function auditProjectMenuBridge({page}) { .getByRole('listitem') .filter({has: page.locator(`a[href="/${project.id}"]`)}); const trigger = row.getByRole('button', {name: 'Menu', exact: true}); - const menu = page.locator( - '[role="menu"][data-cui="dropdown-menu-content"]', - ); + const menu = page.getByRole('menu', {includeHidden: true}).filter({ + has: page.getByRole('menuitem', { + name: 'Rename', + exact: true, + includeHidden: true, + }), + }); const rename = menu.getByRole('menuitem', {name: 'Rename', exact: true}); + const projectName = 'Renamed verification project'; const focused = page.locator(':focus'); await trigger.press('ArrowDown'); await rename.and(focused).waitFor(); @@ -52,10 +57,11 @@ async function auditProjectMenuBridge({page}) { await menu.waitFor({state: 'detached'}); await trigger.and(focused).waitFor(); - await trigger.click(); - await rename.click(); + await trigger.press('ArrowDown'); + await rename.and(focused).waitFor(); + await page.keyboard.press('Enter'); const dialog = page.getByRole('alertdialog', {name: 'Rename project'}); - await dialog.getByRole('textbox').fill('Renamed through the bridge'); + await dialog.getByRole('textbox').fill(projectName); await menu.waitFor({state: 'detached'}); const body = page.locator('body'); assert.equal( @@ -75,7 +81,7 @@ async function auditProjectMenuBridge({page}) { await body.evaluate(element => element.style.pointerEvents), 'none', ); - await row.getByText('Renamed through the bridge', {exact: true}).waitFor(); + await row.getByText(projectName, {exact: true}).waitFor(); await trigger.click(); const cloned = page.waitForResponse( @@ -93,7 +99,7 @@ async function auditProjectMenuBridge({page}) { await page.locator('.cm-content[contenteditable="true"]').first().waitFor(); await menu.waitFor({state: 'detached'}); await dashboard.click(); - await row.getByText('Renamed through the bridge', {exact: true}).waitFor(); + await row.getByText(projectName, {exact: true}).waitFor(); await trigger.click(); await menu.getByRole('menuitem', {name: 'Delete', exact: true}).click(); const confirm = page.getByRole('alertdialog', {name: 'Delete project'}); @@ -119,7 +125,7 @@ export async function auditSavedProjects(options) { ); for (const [name, audit] of [ ['read-only-notice', auditReadOnlyNotice], - ['solid1-bridge-project-menu', auditProjectMenuBridge], + ['project-menu', auditProjectMenu], ]) { if (!requested?.includes(name)) continue; await options.feature(name, () => diff --git a/.agents/skills/verify-codeimage/scripts/signatures.mjs b/.agents/skills/verify-codeimage/scripts/signatures.mjs new file mode 100644 index 000000000..ba8f57318 --- /dev/null +++ b/.agents/skills/verify-codeimage/scripts/signatures.mjs @@ -0,0 +1,88 @@ +import assert from 'node:assert/strict'; +import {writeFile} from 'node:fs/promises'; +import {resolve} from 'node:path'; +import {PNG} from 'pngjs'; + +export async function auditSignatures({page, editor, section, download, out}) { + await section('frame'); + const opener = page.locator('#signature-options'); + const panel = page.getByRole('dialog', {name: 'Signature', exact: true}); + const saved = panel.getByRole('button', { + name: 'Saved signatures', + exact: true, + }); + const saveAsNew = page.getByRole('menuitem', { + name: 'Save as new', + exact: true, + }); + const focused = page.locator(':focus'); + await opener.press('Enter'); + await writeFile( + resolve(out, 'signature-open.aria.txt'), + await page.locator('body').ariaSnapshot(), + ); + await page + .getByPlaceholder('@handle or profile link', {exact: true}) + .fill('@verification'); + await saved.press('ArrowDown'); + await saveAsNew.and(focused).waitFor(); + await page.keyboard.press('Escape'); + await saveAsNew.waitFor({state: 'hidden'}); + await saved.and(focused).waitFor(); + await page.keyboard.press('Escape'); + await panel.waitFor({state: 'hidden'}); + await opener.and(focused).waitFor(); + + await opener.press('Enter'); + await saved.click(); + await saveAsNew.click(); + await page + .getByRole('textbox', {name: 'Signature name', exact: true}) + .fill('Verification signature'); + await page.getByRole('button', {name: 'Save', exact: true}).click(); + await page.keyboard.press('Escape'); + assert.match( + await page.locator('[data-frame-signature]').first().innerText(), + /@verification/, + ); + PNG.sync.read(await download('signature.png')); + await page.reload(); + await editor().waitFor(); + await section('frame'); + await opener.click(); + await saved.click(); + await page.getByRole('menuitem', {name: /Verification signature/}).click(); + assert.equal( + await page + .getByPlaceholder('@handle or profile link', {exact: true}) + .inputValue(), + '@verification', + ); + + await panel + .locator('[data-control="signature.style"]') + .getByRole('tab', {name: 'Card', exact: true}) + .click(); + await panel + .locator('[data-control="signature.avatar"]') + .getByRole('tab', {name: 'Profile', exact: true}) + .click(); + const account = panel.getByPlaceholder('username', {exact: true}); + const source = panel.getByRole('button', {name: /^Avatar source\b/}); + const hasFocusRing = element => + element === document.activeElement && + getComputedStyle(element).outlineStyle !== 'none'; + await account.press('Shift+Tab'); + assert.ok(await source.evaluate(hasFocusRing)); + await page.keyboard.press('Tab'); + assert.ok(await account.evaluate(hasFocusRing)); + await source.press('Enter'); + const options = page.locator('[data-cui="select-listbox"]:visible'); + await options.waitFor(); + await page.keyboard.press('Escape'); + await options.waitFor({state: 'hidden'}); + await source.and(focused).waitFor(); + await page.keyboard.press('Escape'); + await panel.waitFor({state: 'hidden'}); + await opener.and(focused).waitFor(); +} diff --git a/.agents/skills/verify-codeimage/scripts/tab-reorder.mjs b/.agents/skills/verify-codeimage/scripts/tab-reorder.mjs index 04f27f5c0..686c81a54 100644 --- a/.agents/skills/verify-codeimage/scripts/tab-reorder.mjs +++ b/.agents/skills/verify-codeimage/scripts/tab-reorder.mjs @@ -146,6 +146,37 @@ export async function auditTabLayouts({feature, fresh, ...options}) { ), ); } + await feature('plain-text-tab-icon', () => + fresh( + {name: 'plain-text-tab-icon', layout: 'inspector'}, + async ({doctor, page}) => { + await doctor(); + await completeTabExtension( + page, + page.getByRole('combobox', {name: 'Tab name', exact: true}), + {prefix: 'plain.tx', extension: '.txt', method: 'keyboard'}, + ); + const icon = page.locator('main [data-active=true] svg path.path'); + await icon.waitFor(); + assert.equal( + await icon.evaluate(path => getComputedStyle(path).fill), + 'rgb(255, 255, 255)', + ); + await page + .getByRole('textbox', {name: 'Search themes'}) + .fill('XCode Light'); + await page.getByRole('option', {name: /XCode Light/i}).click(); + await page + .locator('main [data-codeimage-frame-mode=light]') + .filter({has: page.locator('[data-active=true] svg path.path')}) + .waitFor(); + assert.equal( + await icon.evaluate(path => getComputedStyle(path).fill), + 'rgb(60, 60, 60)', + ); + }, + ), + ); } async function auditTabs( diff --git a/AGENTS.md b/AGENTS.md index 923bb1cb6..13ea5047a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -49,6 +49,7 @@ An exception goes on the offending line and the operator approves it in review: | Reach an element through a ref, a prop or a store, not `document.querySelector`. | `codeimage/no-document-query` | | Put constant styles in a vanilla-extract `.css.ts` file. The `style` prop is for computed values. | `codeimage/no-static-inline-style` | | Style an element through its own `style()` class, with `selectors`, `styleVariants` or `recipe`. `globalStyle` is only for `theme/global.css.ts`. | `codeimage/no-global-style` | +| Use public CodeUI props, tokens and part classes. Use app classes or attributes on local JSX and leave `data-cui` part markers to the kit. | `codeimage/no-codeui-part-marker` | | Write app and UI kit styles in `.css.ts`, never plain CSS or SCSS. | `scripts/check-structure.mjs` | | Add browser checks as cases of `.agents/skills/verify-codeimage/scripts/audit.mjs`. Do not add `verify-*` or `capture-*` scripts to source folders. | `scripts/check-structure.mjs` | | Do not commit backup or leftover files (`.bak`, `.orig`, `.rej`, `.tmp`). | `scripts/check-structure.mjs` | diff --git a/DESIGN.md b/DESIGN.md index c59febeb8..87bdcd871 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -136,7 +136,9 @@ The What's new surfaces keep their own table of durations in `components/WhatsNe ## Styling -- Styles are vanilla-extract `.css.ts` files with tokens from `@codeimage/ui` (`themeVars`). Plain CSS files are not accepted, even for an experiment. +- Keep styles in vanilla-extract `.css.ts` files. Use `@codeui/kit/tokens` for the editor UI and use the kit's size and density settings for control dimensions. +- Customize a kit control with public props and tokens first. Use `class` or `classes` for a specific part. Scope changes to the affected control so button, role and wildcard selectors cannot restyle other controls in the panel. +- CodeUI owns `data-cui` part markers. Read documented markers where needed and use app classes or attributes for local markup. - Read state from data attributes on the page root, such as `data-layout`, `data-panel-nav` and `data-panel-side`, not from generated class names. - Use `zoom` to fit the frame, not `transform`. A transformed ancestor misplaces CodeMirror's tooltips. diff --git a/apps/codeimage/.oxlintrc.json b/apps/codeimage/.oxlintrc.json index 7166f84b2..39766fcd4 100644 --- a/apps/codeimage/.oxlintrc.json +++ b/apps/codeimage/.oxlintrc.json @@ -2,6 +2,7 @@ "extends": ["../../.oxlintrc.json"], "rules": { "codeimage/no-static-inline-style": "error", + "codeimage/no-codeui-part-marker": "error", "codeimage/no-document-query": "error", "codeimage/no-global-key-listener": "error", "no-restricted-imports": [ diff --git a/apps/codeimage/index.html b/apps/codeimage/index.html index c69fe4730..34917f9c7 100644 --- a/apps/codeimage/index.html +++ b/apps/codeimage/index.html @@ -91,6 +91,8 @@ ({ click: async () => {}, - success: vi.fn(), - error: vi.fn(), + show: vi.fn(), })); vi.mock('@codeimage/locale', () => ({ useI18n: () => [(key: string) => key], })); -vi.mock('@codeimage/ui', () => ({ - toast: {success: menu.success, error: menu.error}, +vi.mock('@ui/notifications', () => ({ + editorNotifications: {show: menu.show}, })); vi.mock('@ui/DropdownMenu', () => ({ DropdownMenuItem: (props: { @@ -74,10 +73,12 @@ it('copies exactly toCliConfig output from the menu action shared by both editor expect(html).toContain('cliConfig.copy'); await menu.click(); expect(writeText).toHaveBeenCalledExactlyOnceWith(toCliConfig(data)); - expect(menu.success).toHaveBeenCalledExactlyOnceWith('cliConfig.copied', { - position: 'bottom-center', + expect(menu.show).toHaveBeenCalledExactlyOnceWith({ + description: 'cliConfig.copied', + tone: 'success', + duration: 2000, + theme: 'page', }); - expect(menu.error).not.toHaveBeenCalled(); }); it('reports a clipboard failure without success feedback', async () => { @@ -86,8 +87,9 @@ it('reports a clipboard failure without success feedback', async () => { }); renderToString(() => createComponent(CopyCliConfigMenuItem, {data})); await menu.click(); - expect(menu.error).toHaveBeenCalledExactlyOnceWith('cliConfig.copyError', { - position: 'bottom-center', + expect(menu.show).toHaveBeenCalledExactlyOnceWith({ + description: 'cliConfig.copyError', + tone: 'danger', + theme: 'page', }); - expect(menu.success).not.toHaveBeenCalled(); }); diff --git a/apps/codeimage/src/components/Presets/CopyCliConfigMenuItem.tsx b/apps/codeimage/src/components/Presets/CopyCliConfigMenuItem.tsx index 9e2823fa2..2be5b8c30 100644 --- a/apps/codeimage/src/components/Presets/CopyCliConfigMenuItem.tsx +++ b/apps/codeimage/src/components/Presets/CopyCliConfigMenuItem.tsx @@ -1,6 +1,6 @@ import {useI18n} from '@codeimage/locale'; import type {PresetData} from '@codeimage/store/presets/types'; -import {toast} from '@codeimage/ui'; +import {editorNotifications} from '@ui/notifications'; import {DropdownMenuItem} from '@ui/DropdownMenu'; import type {AppLocaleEntries} from '../../i18n'; import {toCliConfig} from './cliConfig'; @@ -12,10 +12,19 @@ export function CopyCliConfigMenuItem(props: {data: PresetData}) { try { await navigator.clipboard.writeText(toCliConfig(props.data)); } catch { - toast.error(t('cliConfig.copyError'), {position: 'bottom-center'}); + editorNotifications.show({ + tone: 'danger', + description: t('cliConfig.copyError'), + theme: 'page', + }); return; } - toast.success(t('cliConfig.copied'), {position: 'bottom-center'}); + editorNotifications.show({ + tone: 'success', + description: t('cliConfig.copied'), + theme: 'page', + duration: 2000, + }); } return ( diff --git a/apps/codeimage/src/components/Presets/PresetUpdateDialog.tsx b/apps/codeimage/src/components/Presets/PresetUpdateDialog.tsx index 32b825c39..386d5d1c1 100644 --- a/apps/codeimage/src/components/Presets/PresetUpdateDialog.tsx +++ b/apps/codeimage/src/components/Presets/PresetUpdateDialog.tsx @@ -1,7 +1,7 @@ import {useI18n} from '@codeimage/locale'; import type {Preset} from '@codeimage/store/presets/types'; import {Box, HStack, SvgIcon, Text} from '@codeimage/ui'; -import {Button} from '@ui/legacy-controls'; +import {Button} from '@codeui/solid'; import {Dialog, DialogPanelContent, DialogPanelFooter} from '@ui/Dialog'; import type {ControlledDialogProps} from '@core/hooks/createControlledDialog'; import type {Element as JSXElement, VoidProps} from 'solid-js'; @@ -75,7 +75,7 @@ export function PresetUpdateDialog( block size={'sm'} type="button" - theme={'secondary'} + variant={'secondary'} onClick={() => propsWithDefault.onOpenChange(false)} > {t('common.close')} @@ -85,7 +85,7 @@ export function PresetUpdateDialog( block size={'sm'} type="submit" - theme={propsWithDefault.actionType} + variant={propsWithDefault.actionType} onClick={() => { propsWithDefault.onConfirm(); propsWithDefault.onOpenChange(false); diff --git a/apps/codeimage/src/components/PropertyEditor/SidebarPopover/SidebarPopover.css.ts b/apps/codeimage/src/components/PropertyEditor/SidebarPopover/SidebarPopover.css.ts index 3a9f31b67..0ca5d0bb6 100644 --- a/apps/codeimage/src/components/PropertyEditor/SidebarPopover/SidebarPopover.css.ts +++ b/apps/codeimage/src/components/PropertyEditor/SidebarPopover/SidebarPopover.css.ts @@ -1,5 +1,5 @@ import {themeVars} from '@codeimage/ui'; -import {responsiveStyle, themeTokens} from '@codeui/kit/foundation'; +import {responsiveStyle, themeTokens} from '@codeui/solid/tokens'; import {style} from '@vanilla-extract/css'; export const sidebarPopover = style([ diff --git a/apps/codeimage/src/components/PropertyEditor/controls/AspectRatioPicker/AspetRatioPicker.css.ts b/apps/codeimage/src/components/PropertyEditor/controls/AspectRatioPicker/AspetRatioPicker.css.ts index 3fd05dfca..7c87ce3b1 100644 --- a/apps/codeimage/src/components/PropertyEditor/controls/AspectRatioPicker/AspetRatioPicker.css.ts +++ b/apps/codeimage/src/components/PropertyEditor/controls/AspectRatioPicker/AspetRatioPicker.css.ts @@ -1,6 +1,6 @@ import {textFieldStyles, themeVars, withThemeMode} from '@codeimage/ui'; import {darkGrayScale} from '@codeimage/ui/themes/darkTheme'; -import {responsiveStyle} from '@codeui/kit/foundation'; +import {responsiveStyle} from '@codeui/solid/tokens'; import {createVar, style} from '@vanilla-extract/css'; export const input = style([ diff --git a/apps/codeimage/src/components/PropertyEditor/controls/ColorPicker/CustomColorPicker.css.ts b/apps/codeimage/src/components/PropertyEditor/controls/ColorPicker/CustomColorPicker.css.ts index 82d671c75..d4f9f45bf 100644 --- a/apps/codeimage/src/components/PropertyEditor/controls/ColorPicker/CustomColorPicker.css.ts +++ b/apps/codeimage/src/components/PropertyEditor/controls/ColorPicker/CustomColorPicker.css.ts @@ -5,7 +5,7 @@ import { withThemeMode, } from '@codeimage/ui'; import {darkGrayScale} from '@codeimage/ui/themes/darkTheme'; -import {responsiveStyle} from '@codeui/kit/foundation'; +import {responsiveStyle} from '@codeui/solid/tokens'; import {style} from '@vanilla-extract/css'; import type {RecipeVariants} from '@vanilla-extract/recipes'; import {recipe} from '@vanilla-extract/recipes'; diff --git a/apps/codeimage/src/components/PropertyEditor/controls/FontPicker/FontPicker.css.ts b/apps/codeimage/src/components/PropertyEditor/controls/FontPicker/FontPicker.css.ts index 42b4d9c4e..28372074e 100644 --- a/apps/codeimage/src/components/PropertyEditor/controls/FontPicker/FontPicker.css.ts +++ b/apps/codeimage/src/components/PropertyEditor/controls/FontPicker/FontPicker.css.ts @@ -1,6 +1,6 @@ import {textFieldStyles, themeVars} from '@codeimage/ui'; -import {responsiveStyle, themeTokens} from '@codeui/kit/foundation'; -import {createVar, style} from '@vanilla-extract/css'; +import {responsiveStyle, themeTokens} from '@codeui/solid/tokens'; +import {style} from '@vanilla-extract/css'; export const input = style([ textFieldStyles.baseField, @@ -26,22 +26,17 @@ export const inputIcon = style({ flexShrink: 0, }); -export const fontListboxHeight = createVar(); +const listHeight = '350px'; export const fontOption = style({fontSize: '80%'}); -export const fontPickerPopover = style([ - { - vars: { - [fontListboxHeight]: '350px', - }, - }, +export const fontPickerPopover = style( responsiveStyle({ md: { maxWidth: 'initial', }, }), -]); +); export const experimentalFlag = style({ color: themeVars.dynamicColors.descriptionTextColor, @@ -50,7 +45,7 @@ export const experimentalFlag = style({ export const centeredContent = style({ width: '100%', - height: fontListboxHeight, + height: listHeight, display: 'flex', flexDirection: 'column', gap: '1rem', @@ -60,11 +55,11 @@ export const centeredContent = style({ }); export const virtualizedFontListboxWrapper = style({ - height: fontListboxHeight, + height: listHeight, }); export const virtualizedFontListbox = style({ - maxHeight: fontListboxHeight, + maxHeight: listHeight, overflow: 'auto', height: '100%', }); diff --git a/apps/codeimage/src/components/PropertyEditor/controls/FontPicker/FontPickerListbox.tsx b/apps/codeimage/src/components/PropertyEditor/controls/FontPicker/FontPickerListbox.tsx index 659a7bc90..ff9581830 100644 --- a/apps/codeimage/src/components/PropertyEditor/controls/FontPicker/FontPickerListbox.tsx +++ b/apps/codeimage/src/components/PropertyEditor/controls/FontPicker/FontPickerListbox.tsx @@ -1,4 +1,4 @@ -import type {ListboxProps} from '@ui/legacy-listbox'; +import type {ListboxProps} from '@codeui/solid'; import {fontOption} from './FontPicker.css'; interface FontPickerListboxProps { @@ -25,15 +25,16 @@ export const createFontPickerListboxProps = (props: FontPickerListboxProps) => { get options() { return props.items; }, - optionValue: item => item.value, - optionTextValue: item => item.label, - itemLabel: item => { - const label = document.createElement('span'); - label.className = fontOption; - label.style.fontFamily = `${item.label}, monospace`; - label.textContent = item.label; - return label; - }, + optionValue: 'value', + optionTextValue: 'label', + itemLabel: item => ( + + {item.label} + + ), get value() { return [props.value]; }, @@ -41,5 +42,5 @@ export const createFontPickerListboxProps = (props: FontPickerListboxProps) => { const option = values.values().next().value; if (option !== undefined) props.onChange(option); }, - } satisfies ListboxProps; + } satisfies ListboxProps; }; diff --git a/apps/codeimage/src/components/PropertyEditor/controls/ImagePicker/ImagePicker.css.ts b/apps/codeimage/src/components/PropertyEditor/controls/ImagePicker/ImagePicker.css.ts index 7a4ce706b..0389561d9 100644 --- a/apps/codeimage/src/components/PropertyEditor/controls/ImagePicker/ImagePicker.css.ts +++ b/apps/codeimage/src/components/PropertyEditor/controls/ImagePicker/ImagePicker.css.ts @@ -1,6 +1,6 @@ import {themeVars, withThemeMode} from '@codeimage/ui'; import {darkGrayScale} from '@codeimage/ui/themes/darkTheme'; -import {responsiveStyle, themeTokens} from '@codeui/kit/foundation'; +import {responsiveStyle, themeTokens} from '@codeui/solid/tokens'; import {createVar, style} from '@vanilla-extract/css'; export const gridSize = createVar(); diff --git a/apps/codeimage/src/components/Terminal/GlassReflection/TerminalGlassReflection.css.ts b/apps/codeimage/src/components/Terminal/GlassReflection/TerminalGlassReflection.css.ts index 9add85781..31d0e6bae 100644 --- a/apps/codeimage/src/components/Terminal/GlassReflection/TerminalGlassReflection.css.ts +++ b/apps/codeimage/src/components/Terminal/GlassReflection/TerminalGlassReflection.css.ts @@ -20,11 +20,11 @@ export const content = style({ zIndex: '100', selectors: { - '[data-theme-mode=light] &': { + '[data-codeimage-frame-mode=light] &': { background: 'linear-gradient(rgba(100,100,100, .035) 35%, rgba(0,0,0,0%) 100%)', }, - '[data-theme-mode=dark] &': { + '[data-codeimage-frame-mode=dark] &': { background: 'linear-gradient(rgba(255,255,255, .035) 35%, rgba(255,255,255,0%) 100%)', }, diff --git a/apps/codeimage/src/components/Terminal/Tabs/Tab/Tab.css.ts b/apps/codeimage/src/components/Terminal/Tabs/Tab/Tab.css.ts index 2c2e1cff7..e940e7aad 100644 --- a/apps/codeimage/src/components/Terminal/Tabs/Tab/Tab.css.ts +++ b/apps/codeimage/src/components/Terminal/Tabs/Tab/Tab.css.ts @@ -86,12 +86,12 @@ export const tab = recipe({ backdropFilter: 'blur(20px) saturate(180%)', ['webkitBackdropFilter' as string]: 'blur(20px) saturate(180%)', }, - '[data-theme-mode=dark] &': { + '[data-codeimage-frame-mode=dark] &': { vars: { [tabVars.tabSecondaryHoverBg]: '255, 255, 255', }, }, - '[data-theme-mode=light] &': { + '[data-codeimage-frame-mode=light] &': { vars: { [tabVars.tabSecondaryHoverBg]: '0, 0, 0', }, @@ -244,10 +244,10 @@ export const tabCloseIcon = style({ width: '14px', minWidth: '14px', selectors: { - '[data-theme-mode=dark] &': { + '[data-codeimage-frame-mode=dark] &': { color: themeVars.backgroundColor.white, }, - '[data-theme-mode=light] &': { + '[data-codeimage-frame-mode=light] &': { color: themeVars.backgroundColor.black, }, }, diff --git a/apps/codeimage/src/components/Terminal/Tabs/TabAddButton/TabAddButton.css.ts b/apps/codeimage/src/components/Terminal/Tabs/TabAddButton/TabAddButton.css.ts index 839019186..01a7433e0 100644 --- a/apps/codeimage/src/components/Terminal/Tabs/TabAddButton/TabAddButton.css.ts +++ b/apps/codeimage/src/components/Terminal/Tabs/TabAddButton/TabAddButton.css.ts @@ -24,13 +24,13 @@ export const button = style({ backgroundColor: `rgba(${tabVars.tabSecondaryHoverBg}, .05)`, }, selectors: { - '[data-theme-mode=dark] &': { + '[data-codeimage-frame-mode=dark] &': { color: themeVars.backgroundColor.white, vars: { [tabVars.tabSecondaryHoverBg]: '255, 255, 255', }, }, - '[data-theme-mode=light] &': { + '[data-codeimage-frame-mode=light] &': { color: themeVars.backgroundColor.black, vars: { [tabVars.tabSecondaryHoverBg]: '0, 0, 0', diff --git a/apps/codeimage/src/components/Terminal/TerminalHost.tsx b/apps/codeimage/src/components/Terminal/TerminalHost.tsx index 867dd6cb0..1118031dc 100644 --- a/apps/codeimage/src/components/Terminal/TerminalHost.tsx +++ b/apps/codeimage/src/components/Terminal/TerminalHost.tsx @@ -89,7 +89,7 @@ export const TerminalHost: FlowComponent = props => { class={clsx(styles.wrapper, props.themeClass)} data-lite={props.lite === undefined ? undefined : String(props.lite)} data-preview={props.preview ? 'true' : ''} - data-theme-mode={darkMode() ? 'dark' : 'light'} + data-codeimage-frame-mode={darkMode() ? 'dark' : 'light'} data-header-visible={String(props.showHeader)} data-accent-header={String( props.accentVisible && !props.alternativeTheme, diff --git a/apps/codeimage/src/components/Terminal/WindowsTerminal/WindowsTerminal.css.ts b/apps/codeimage/src/components/Terminal/WindowsTerminal/WindowsTerminal.css.ts index d12f418d1..7859a7093 100644 --- a/apps/codeimage/src/components/Terminal/WindowsTerminal/WindowsTerminal.css.ts +++ b/apps/codeimage/src/components/Terminal/WindowsTerminal/WindowsTerminal.css.ts @@ -22,12 +22,12 @@ export const headerIconRow = style({ columnGap: themeVars.spacing['3'], }, - [`[data-theme-mode=light] &`]: { + [`[data-codeimage-frame-mode=light] &`]: { vars: { [vars.iconFill]: themeVars.backgroundColor.black, }, }, - [`[data-theme-mode=dark] &`]: { + [`[data-codeimage-frame-mode=dark] &`]: { vars: { [vars.iconFill]: themeVars.backgroundColor.white, }, diff --git a/apps/codeimage/src/components/Terminal/terminal.css.ts b/apps/codeimage/src/components/Terminal/terminal.css.ts index 09adaea47..b46a2378c 100644 --- a/apps/codeimage/src/components/Terminal/terminal.css.ts +++ b/apps/codeimage/src/components/Terminal/terminal.css.ts @@ -40,13 +40,13 @@ export const wrapper = style([ [terminalVars.headerHeight]: terminalVars.headerHeightLite, }, }, - '&[data-theme-mode=light]': { + '&[data-codeimage-frame-mode=light]': { vars: { [terminalVars.headerColor]: `255, 255, 255`, [glassBorderVar]: glassBorderLight, }, }, - '&[data-theme-mode=dark]': { + '&[data-codeimage-frame-mode=dark]': { vars: { [glassBorderVar]: glassBorderDark, [terminalVars.headerColor]: `0, 0, 0`, @@ -107,13 +107,13 @@ export const header = style({ transition: 'background-color .2s ease-in-out', selectors: { - '[data-theme-mode=light] &[data-accent-visible=true]': { + '[data-codeimage-frame-mode=light] &[data-accent-visible=true]': { backgroundColor: fallbackVar( terminalVars.headerBackgroundColor, `rgba(0, 0, 0, .06)`, ), }, - '[data-theme-mode=dark] &[data-accent-visible=true]': { + '[data-codeimage-frame-mode=dark] &[data-accent-visible=true]': { backgroundColor: fallbackVar( terminalVars.headerBackgroundColor, `rgba(255, 255, 255, .06)`, diff --git a/apps/codeimage/src/components/Toolbar/CopyAltTextButton.tsx b/apps/codeimage/src/components/Toolbar/CopyAltTextButton.tsx index d0e5f631a..8309d7f92 100644 --- a/apps/codeimage/src/components/Toolbar/CopyAltTextButton.tsx +++ b/apps/codeimage/src/components/Toolbar/CopyAltTextButton.tsx @@ -1,7 +1,7 @@ import {useI18n} from '@codeimage/locale'; import {getActiveEditorStore} from '@codeimage/store/editor/activeEditor'; -import {toast} from '@codeimage/ui'; -import {Button, Tooltip} from '@ui/legacy-controls'; +import {notifications} from '@ui/notifications'; +import {Button, Tooltip} from '@codeui/solid'; import {altText} from '@core/altText'; import type {AppLocaleEntries} from '../../i18n'; import {getWhatsNew} from '../../state/whats-new'; @@ -26,18 +26,28 @@ export function CopyAltTextButton(props: { () => { getWhatsNew().seen('alt'); onCopy?.(); - toast.success(() => t('altText.copied')); + notifications.show({ + tone: 'success', + description: () => t('altText.copied'), + theme: 'page', + duration: 2000, + }); }, - () => toast.error(() => t('altText.copyError')), + () => + notifications.show({ + tone: 'danger', + description: () => t('altText.copyError'), + theme: 'page', + }), ); } return ( - + close(fromKeyboard(event))} > @@ -213,7 +213,7 @@ export function Nudge(props: {