Show one view control and name the file once

Phase 5-3.

- One radio group shows Write, Source, and Read at all times, with an
  icon and a name. Narrow panes show only the icons. The arrow keys
  move the choice, and the group has one Tab stop. The current choice
  gets the selection fill and an accent bar. Hover gets only a fill.
- A Split toggle shows Read beside Write or Source. Each document pane
  keeps a split flag beside its reading flag. Read ends Split.
- Ctrl+Shift+E switches between Read and the editor. Ctrl+E still
  switches between Write and Source.
- "IDE" becomes "Source" in the Chrome type, the tab menu (a View
  submenu), the status bar, the catalog, the tests, and the docs.
- Settings, General, File name title hides the title in Write and
  Read. It is on by default.
- The breadcrumb shows only the folder of the file. The status bar
  shows the view, not the path.
- ModeSwitcher.svelte and its hover test are gone. The new test
  layout/viewModes covers the control.
- The command palette from 5-2 gets its row in docs/menu-surfaces.json.
- The user guide Format table is whole again. The 5-2 edit had put
  the Paragraph and Insert rows under the shortcut table.
- 8 new catalog rows and 10 removed rows, in French, Japanese, and
  Simplified Chinese.
- Docs: UI-049, the user guide, ui-design.md, document-tools.md,
  development.md, and the README feature list.

Tests: the new layout/viewModes, new cases in documentPanes.spec.ts
and settings.spec.ts, and the chooseView harness helper. 21 smoke
tests use the new control. Tests that read the full path from the
breadcrumb now read its tooltip.
This commit is contained in:
Knotty Wyvern
2026-10-28 19:45:08 -07:00
parent ebacdb8164
commit 9cf82503d0
64 changed files with 675 additions and 590 deletions
@@ -1,7 +1,7 @@
// Workarea backgrounds in both themes: splash, writer, reader, split, IDE, narrow layouts, fades, reduced motion, and removal.
// Workarea backgrounds in both themes: splash, writer, reader, split, Source, narrow layouts, fades, reduced motion, and removal.
import assert from 'node:assert/strict';
import { writeFile } from 'node:fs/promises';
import { mockTauri, openPage, outputDir, runSmoke, smokeUrl } from '../_harness/index.mjs';
import { chooseView, mockTauri, openPage, outputDir, runSmoke, smokeUrl } from '../_harness/index.mjs';
const viewport = { width: 1280, height: 820 };
@@ -94,20 +94,19 @@ await runSmoke('appearance/backgroundFrames', async ({ browser }) => {
await page.getByRole('textbox', { name: 'Writing editor', exact: true }).waitFor();
assert.match(await style(page.locator('.editor > .body'), 'backgroundColor'), /(?:0\.9|90%)/);
await page.screenshot({ path: `${output}/${theme}-writer.png` });
await page.getByRole('group', { name: 'Document view', exact: true }).hover();
await page.getByRole('button', { name: 'Read', exact: true }).click();
await chooseView(page, 'Read');
await page.locator('.md-page').waitFor();
const beforeScroll = await background.boundingBox();
await page.locator('.md-page').evaluate(node => { node.scrollTop = 600; });
assert.deepEqual(await background.boundingBox(), beforeScroll);
await page.screenshot({ path: `${output}/${theme}-reader.png` });
await page.getByRole('button', { name: 'Split', exact: true }).click();
await page.locator('.source-editor .cm-content').waitFor();
assert.equal(await style(page.locator('.source-editor .cm-editor').first(), 'backgroundColor'), 'rgba(0, 0, 0, 0)');
// Split shows the Write editor beside Read.
await chooseView(page, 'Split');
await page.locator('.live-writer .cm-content').waitFor();
assert.equal(await style(page.locator('.live-writer .cm-editor').first(), 'backgroundColor'), 'rgba(0, 0, 0, 0)');
await page.screenshot({ path: `${output}/${theme}-split.png` });
await page.getByRole('button', { name: 'Edit', exact: true }).click();
await page.getByRole('group', { name: 'Editor layout', exact: true }).hover();
await page.getByRole('button', { name: 'IDE', exact: true }).click();
await chooseView(page, 'Split');
await chooseView(page, 'Source');
await page.locator('.source-editor .cm-content').waitFor();
await page.screenshot({ path: `${output}/${theme}-ide.png` });
await page.setViewportSize({ width: 680, height: 720 });
@@ -133,7 +132,7 @@ await runSmoke('appearance/backgroundFrames', async ({ browser }) => {
assert.equal(await style(page.locator('.editor > .body'), 'backgroundColor'), await style(page.locator('.shell'), 'backgroundColor'));
await page.screenshot({ path: `${output}/${theme}-removed.png` });
assert.deepEqual(page.errors, []);
report.push({ theme, passed: ['saved image', 'continuous workarea', 'sidebar transparency', 'button-only splash', 'keyboard focus', 'writer', 'reader scrolling', 'split', 'IDE transparency', 'narrow layout', 'fade', 'reduced motion', 'slideshow removal', 'saved image removal'], screenshots: `${output}/${theme}-*.png`, nativeDesktop: 'not tested' });
report.push({ theme, passed: ['saved image', 'continuous workarea', 'sidebar transparency', 'button-only splash', 'keyboard focus', 'writer', 'reader scrolling', 'split', 'Source transparency', 'narrow layout', 'fade', 'reduced motion', 'slideshow removal', 'saved image removal'], screenshots: `${output}/${theme}-*.png`, nativeDesktop: 'not tested' });
await page.close();
console.log(`PASS: ${theme} workarea backgrounds, editors, keyboard, narrow layout, fade, and restoration`);
}
@@ -1,4 +1,4 @@
// Character themes: colors, fonts, IDE syntax, export, window sync, narrow theme cards, selection fills, and legacy or removed theme IDs.
// Character themes: colors, fonts, Source syntax, export, window sync, narrow theme cards, selection fills, and legacy or removed theme IDs.
import assert from 'node:assert/strict';
import path from 'node:path';
import { mockTauri, openPage, outputDir, runSmoke, smokeUrl } from '../_harness/index.mjs';
@@ -148,7 +148,7 @@ await runSmoke('appearance/characterThemes', async ({ browser }) => {
});
await ide.locator('.source-editor .cm-selectionBackground').first().waitFor();
assert.equal(await ide.locator('.source-editor .cm-selectionBackground').first().evaluate(node => getComputedStyle(node).backgroundColor),
warmFill, 'IDE selection uses the same warm fill');
warmFill, 'Source selection uses the same warm fill');
await ide.screenshot({ path: path.join(output, `${theme}-${mode}-ide-selection.png`) });
await ide.evaluate(async () => {
const { EditorView } = await import('/node_modules/@codemirror/view/dist/index.js');
@@ -185,7 +185,7 @@ await runSmoke('appearance/characterThemes', async ({ browser }) => {
await settings.getByRole('button', { name: 'Plugin settings 16', exact: true }).scrollIntoViewIfNeeded();
await settings.screenshot({ path: path.join(output, `${theme}-${mode}-360-long-navigation.png`) });
await setPluginTools(0);
console.log(`PASS: ${theme} ${mode}, colors, fonts, IDE syntax, export, saved state, window sync, narrow theme cards, keyboard and focus`);
console.log(`PASS: ${theme} ${mode}, colors, fonts, Source syntax, export, saved state, window sync, narrow theme cards, keyboard and focus`);
}
for (const [previous, theme, label] of [['holo', 'harvest-moon', 'Harvest Moon'], ['asuka', 'crimson-pilot', 'Crimson Pilot'], ['malfoid', 'silver-serpent', 'Silver Serpent']]) {
await settings.evaluate(theme => window.__TEST__.writeSettings('appearance', { theme, mode: 'dark' }), previous);
+6 -6
View File
@@ -16,8 +16,8 @@ await runSmoke("appearance/density", async ({ page }) => {
}),
});
const row = page.locator('[data-tree-rel="note.md"]');
const documentView = () => page.getByRole("group", { name: "Document view" }).locator("button.current");
const editorLayout = () => page.getByRole("group", { name: "Editor layout" }).locator("button.current");
// The checked choice of the view control. Arrow keys, Home, and End move the choice (src/lib/layout/ViewModes.svelte).
const view = () => page.getByRole("radiogroup", { name: "View" }).getByRole("radio", { checked: true });
const setTheme = theme => page.evaluate(theme => { document.documentElement.dataset.theme = theme; }, theme);
await page.goto(smokeUrl);
@@ -65,21 +65,21 @@ await runSmoke("appearance/density", async ({ page }) => {
assert.equal(tab.shadow, "none");
await line.hover();
await page.screenshot({ path: path.join(output, `writer-${theme}.png`) });
await documentView().press("ArrowRight");
await view().press("End");
await page.locator(".md-page .reading").waitFor();
const paragraph = page.locator(".md-page p").filter({ hasText: "A second paragraph." });
await paragraph.hover();
assert.equal(await paragraph.evaluate(el => getComputedStyle(el, "::before").width), "3px");
assert.ok((await page.locator(".md-page table").boundingBox()).width < 400);
await page.screenshot({ path: path.join(output, `read-${theme}.png`) });
await documentView().press("Home");
await view().press("Home");
}
await editorLayout().press("Home");
await view().press("ArrowRight");
await page.locator(".source-editor .cm-content").waitFor();
await page.locator(".line-history").waitFor();
await page.evaluate(() => window.removeGit());
await page.locator(".line-history").waitFor({ state: "hidden" });
await editorLayout().press("End");
await view().press("Home");
await page.getByRole("button", { name: "Hide outline", exact: true }).click();
await page.setViewportSize({ width: 760, height: 640 });
for (const theme of ["dark", "light"]) {
+1 -1
View File
@@ -29,7 +29,7 @@ await runSmoke("appearance/palettes", async ({ browser }) => {
await main.getByRole("dialog").getByRole("button").filter({ hasText: `theme-${index}.py` }).first().waitFor();
await main.getByRole("textbox", { name: "Find a file" }).press("Enter");
await main.locator(".source-editor .cm-content").waitFor();
await main.waitForFunction(file => document.querySelector(".editor .breadcrumb")?.textContent.endsWith(file)
await main.waitForFunction(file => document.querySelector(".editor .breadcrumb")?.title.endsWith(file)
&& document.querySelector(".source-editor .cm-content")?.dataset.language === "python", `theme-${index}.py`);
await main.locator(".source-editor .cm-line").filter({ hasText: `Theme sample ${index}` }).waitFor();
}