Update editor, themes, menus, backgrounds, and release tooling

This commit is contained in:
Knotty Wyvern
2026-10-14 16:19:51 -07:00
parent f6eaa52949
commit edef2520af
113 changed files with 5722 additions and 386 deletions
+15 -16
View File
@@ -81,11 +81,11 @@ try {
return expected ? JSON.stringify(colors) === JSON.stringify(expected) : Object.values(colors).every(Boolean) && new Set(Object.values(colors)).size === 3;
}, expected);
}
const themeName = theme => ({ default: 'RuneStone', claude: 'Claude', sakura: 'Sakura' })[theme];
const themeName = (theme, mode) => theme === 'sakura' ? 'Sakura' : `${({ default: 'RuneStone', claude: 'Claude' })[theme]} ${mode === 'light' ? 'Light' : 'Dark'}`;
const picker = (page, name) => page.locator('.picker').filter({ has: page.locator('svg') }).and(page.getByRole('button', { name, exact: true }));
async function choose(page, name, value) {
await picker(page, name).click();
await page.getByRole('menuitemradio', { name: name === 'Color theme' ? themeName(value) : value === 'light' ? 'Light' : 'Dark', exact: true }).click();
async function choose(page, theme, mode) {
await picker(page, 'Color theme').click();
await page.getByRole('menuitemradio', { name: themeName(theme, mode), exact: true }).click();
}
async function openAppearance(page) {
await page.goto(`${origin}/?settingsWindow=true`);
@@ -100,17 +100,18 @@ try {
await page.waitForFunction(({ theme, mode }) => document.documentElement.dataset.palette === theme && document.documentElement.dataset.theme === mode, { theme, mode });
assert.equal(await page.evaluate(() => getComputedStyle(document.documentElement).colorScheme), mode);
}
assert.equal((await picker(secondSettings, "Color theme").textContent()).trim(), themeName(theme));
assert.equal((await picker(secondSettings, "Appearance").textContent()).trim(), mode === "light" ? "Light" : "Dark");
assert.equal((await picker(secondSettings, "Color theme").textContent()).trim(), themeName(theme, mode));
await main.waitForFunction(() => {
const root = document.documentElement;
const probe = document.createElement("i");
probe.style.backgroundColor = getComputedStyle(root).getPropertyValue("--rs-bg");
probe.style.backgroundColor = getComputedStyle(root).getPropertyValue("--rs-workarea-editor-bg");
document.body.append(probe);
const expected = getComputedStyle(probe).backgroundColor;
probe.remove();
const surfaces = [...document.querySelectorAll(".monaco-editor .monaco-editor-background")];
return surfaces.length > 0 && surfaces.every(element => getComputedStyle(element).backgroundColor === expected);
const workarea = document.querySelector('.editor > .body');
return surfaces.length > 0 && surfaces.every(element => getComputedStyle(element).backgroundColor === 'rgba(0, 0, 0, 0)')
&& workarea && getComputedStyle(workarea).backgroundColor === expected;
});
return settings.evaluate(() => getComputedStyle(document.documentElement).getPropertyValue("--rs-bg").trim());
}
@@ -120,8 +121,7 @@ try {
for (const theme of ["default", "claude", "sakura"]) {
for (const mode of theme === "sakura" ? ["light"] : ["light", "dark"]) {
const before = await editorIds();
await choose(settings, 'Color theme', theme);
if (theme !== "sakura") await choose(settings, 'Appearance', mode);
await choose(settings, theme, mode);
backgrounds.add(await expectAppearance(theme, mode));
assert.deepEqual(await editorIds(), before, "Existing Monaco editors keep their identity when a theme changes");
await openCode(nextCode++);
@@ -154,10 +154,10 @@ try {
}
assert.equal(backgrounds.size, 5, "All supported combinations have distinct backgrounds");
await picker(settings, 'Color theme').click();
assert.deepEqual(await settings.getByRole('menuitemradio').allTextContents(), ['RuneStone', 'Claude', 'Sakura']);
assert.deepEqual(await settings.getByRole('menuitemradio').allTextContents(), ['RuneStone Light', 'RuneStone Dark', 'Claude Light', 'Claude Dark', 'Sakura', 'Harvest Moon', 'Crimson Pilot', 'Silver Serpent']);
await settings.keyboard.press('Escape');
assert.equal(await picker(settings, 'Appearance').isDisabled(), true);
assert.equal(await picker(secondSettings, 'Appearance').isDisabled(), true);
assert.equal(await picker(settings, 'Appearance').count(), 0);
assert.equal(await picker(secondSettings, 'Appearance').count(), 0);
const sakura = await settings.evaluate(() => {
const css = getComputedStyle(document.documentElement);
return Object.fromEntries(['bg', 'border', 'selection', 'bg-active', 'syntax-parameter', 'syntax-keyword', 'syntax-local', 'syntax-static', 'syntax-instance', 'syntax-global'].map(key => [key, css.getPropertyValue(`--rs-${key}`).trim()]));
@@ -177,14 +177,13 @@ try {
}
for (const [theme, mode] of [['default', 'dark'], ['claude', 'light'], ['claude', 'dark'], ['sakura', 'light']]) {
await settings.setViewportSize({ width: 1100, height: 780 });
await choose(settings, 'Color theme', theme);
if (theme !== 'sakura') await choose(settings, 'Appearance', mode);
await choose(settings, theme, mode);
await expectAppearance(theme, mode);
await settings.setViewportSize({ width: 360, height: 480 });
assert(await settings.evaluate(() => document.documentElement.scrollWidth <= innerWidth), 'Narrow settings do not overflow the viewport');
const content = settings.locator('dialog .content');
assert(await content.evaluate(node => node.scrollWidth <= node.clientWidth), 'Appearance controls do not overflow the content area');
for (const name of ['Color theme', 'Appearance']) {
for (const name of ['Color theme']) {
const control = picker(settings, name);
await control.scrollIntoViewIfNeeded();
const bounds = await control.boundingBox();