RuneStone 1.0.0

This commit is contained in:
Knotty Wyvern
2026-11-03 00:23:07 -07:00
commit 5557443ed1
818 changed files with 239368 additions and 0 deletions
@@ -0,0 +1,46 @@
// Import custom theme files in Settings > Appearance: schema 1 palettes for each mode, and a short schema 3 file with a base theme.
import assert from "node:assert/strict";
import path from "node:path";
import { mockTauri, outputDir, runSmoke, smokeUrl } from "../_harness/index.mjs";
const name = "appearance/themeImport";
await runSmoke(name, async ({ page }) => {
const output = await outputDir(name);
await mockTauri(page, {
commands: test => ({
...test.workspace({ root: "C:\\theme-import", files: { "a.md": "# Alpha\n" } }),
plugins_snapshot: () => ({ plugins: [], issues: [] }),
}),
});
await page.goto(smokeUrl + "/?settingsWindow=true");
await page.getByRole("button", { name: "Appearance", exact: true }).click();
const theme = { schema: 1, id: "smoke", name: "Smoke theme", light: { bg: "#fefefe", text: "#222222", accent: "#334499" }, dark: { bg: "#181820", text: "#eeeeee", accent: "#aabbff" } };
const importTheme = (file = theme) => page.locator('input[type=file][aria-label="Theme JSON file"]').setInputFiles({ name: "smoke.json", mimeType: "application/json", buffer: Buffer.from(JSON.stringify(file)) });
const token = name => page.evaluate(name => getComputedStyle(document.documentElement).getPropertyValue(`--rs-${name}`).trim(), name);
const background = () => token("bg");
await importTheme();
await page.waitForFunction(() => document.documentElement.dataset.palette === "custom:smoke");
assert.equal(await background(), "#181820");
// A custom theme now keeps one palette. A schema 1 file converts with the current mode (src/lib/theme/customThemes.ts:38,
// src/lib/theme/AppearanceSettings.svelte), and the light/dark select became the Color theme cards (src/lib/theme/ThemePicker.svelte).
await page.getByRole("radio", { name: "RuneStone Light", exact: true }).click();
await page.waitForFunction(() => document.documentElement.dataset.palette !== "custom:smoke");
await importTheme();
await page.waitForFunction(() => document.documentElement.dataset.palette === "custom:smoke");
assert.equal(await background(), "#fefefe");
await page.screenshot({ path: path.join(output, "custom-theme-light.png") });
// A short schema 3 file takes the missing colors and fonts from its base theme. An earlier theme ID names the base.
await importTheme({ schema: 3, id: "short", name: "Short theme", mode: "dark", base: "holo", colors: { accent: "#00c8ff" } });
await page.waitForFunction(() => document.documentElement.dataset.palette === "custom:short");
assert.deepEqual([await background(), await token("accent"), await token("link"), await token("syntax-keyword")], ["#1c0f0a", "#00c8ff", "#00c8ff", "#f38c48"]);
assert.match(await token("font-ui"), /Candara/);
assert.equal(await page.evaluate(() => document.documentElement.dataset.theme), "dark");
await page.screenshot({ path: path.join(output, "custom-theme-short.png") });
// A base without a palette in the file's mode stops the installation with an error.
await importTheme({ schema: 3, id: "wrong", name: "Wrong base", mode: "dark", base: "sakura", colors: {} });
await page.getByRole("alert").filter({ hasText: "Use a built-in theme with a dark palette as the base." }).waitFor();
assert.equal(await page.evaluate(() => document.documentElement.dataset.palette), "custom:short");
console.log("PASS: custom theme import applies schema 1 palettes, a short schema 3 file with a base, and rejects a wrong base");
}, { timeout: 15000 });