Add the theme editor tab and theme preview cards

Phase 5a-5.

- Settings → Appearance shows a preview card for each theme. The cards
  are one radio group. The arrow keys move and select, and the current
  card has the selection outline and a check mark (UI-047).
- Edit theme opens the theme editor as a workbench tab in the window
  that opened Settings. The window shows each change at once.
- The editor shows all 51 color roles in seven groups. Each role has a
  color picker, a hex field, its lowest readability result, and a reset
  button. A failure shows a warning icon and its ratio, or "Too close".
- Save writes a short schema 3 theme with the built-in theme as its
  base. A built-in theme does not change. Discard returns to the saved
  colors, and Duplicate saves a copy.
- The editor is a built-in package, like the browser, so it uses the
  editor tab code of plugins.
- 23 new catalog rows with French, Japanese, and Simplified Chinese.
- The smoke harness sends emit to every page and emit_to to the pages
  with the target window label.
- Docs: UI-047, ui-design.md, and "Edit a theme" in guides/themes.md.

New tests: appearance/themeEditor and tests/unit/theme/themeEditor.spec.ts.
Six smoke tests use the cards instead of the theme menu.
This commit is contained in:
Knotty Wyvern
2026-10-28 18:13:57 -07:00
parent d160568249
commit 5483881bc2
26 changed files with 722 additions and 97 deletions
+24 -1
View File
@@ -3468,7 +3468,30 @@ export const messageRows: [string, string, string, string][] = [
["Resolve the disk changes before saving.", "Résolvez les modifications sur le disque avant d’enregistrer.", "保存する前にディスク上の変更を解決してください。", "保存前请先处理磁盘上的更改。"],
["Open a workspace first.", "Ouvrez d’abord un espace de travail.", "先にワークスペースを開いてください。", "请先打开工作区。"],
["Collapse backlinks", "Réduire les liens entrants", "バックリンクを折りたたむ", "折叠反向链接"],
["Expand backlinks", "Développer les liens entrants", "バックリンクを展開", "展开反向链接"]
["Expand backlinks", "Développer les liens entrants", "バックリンクを展開", "展开反向链接"],
["Edit theme", "Modifier le thème", "テーマを編集", "编辑主题"],
["Theme editor", "Éditeur de thème", "テーマエディター", "主题编辑器"],
["My theme", "Mon thème", "マイテーマ", "我的主题"],
["Saved {name}.", "{name} enregistré.", "{name} を保存しました。", "已保存 {name}。"],
["Could not save the theme: {error}", "Impossible d’enregistrer le thème : {error}", "テーマを保存できませんでした: {error}", "无法保存主题:{error}"],
["Changes discarded.", "Modifications annulées.", "変更を破棄しました。", "已放弃更改。"],
["{name} copy", "Copie de {name}", "{name} のコピー", "{name} 副本"],
["Theme name", "Nom du thème", "テーマ名", "主题名称"],
["Discard", "Annuler les modifications", "破棄", "放弃"],
["Duplicate", "Dupliquer", "複製", "复制副本"],
["Built-in themes stay unchanged. Save creates a custom theme from this one.", "Les thèmes intégrés ne changent pas. Enregistrer crée un thème personnalisé à partir de celui-ci.", "組み込みテーマは変更されません。保存すると、このテーマからカスタムテーマを作成します。", "内置主题保持不变。保存会基于此主题创建自定义主题。"],
["Based on {name}. Reset a color to take the value of the base theme again.", "Basé sur {name}. Réinitialisez une couleur pour reprendre la valeur du thème de base.", "{name} がベースです。色をリセットすると、ベーステーマの値に戻ります。", "基于 {name}。重置颜色可恢复基础主题的值。"],
["{count} readability checks fail.", "{count} contrôles de lisibilité échouent.", "{count} 件の読みやすさチェックが失敗しています。", "{count} 项可读性检查未通过。"],
["All readability checks pass.", "Tous les contrôles de lisibilité réussissent.", "すべての読みやすさチェックに合格しています。", "所有可读性检查均已通过。"],
["Pick a color for {role}", "Choisir une couleur pour {role}", "{role} の色を選択", "为 {role} 选择颜色"],
["Hex value of {role}", "Valeur hexadécimale de {role}", "{role} の 16 進値", "{role} 的十六进制值"],
["Too close", "Trop proche", "近すぎます", "过于接近"],
["Reset {role}", "Réinitialiser {role}", "{role} をリセット", "重置 {role}"],
["Surfaces", "Surfaces", "サーフェス", "表面"],
["Text", "Texte", "テキスト", "文本"],
["Accents", "Accents", "アクセント", "强调色"],
["Selection and highlight", "Sélection et surlignage", "選択と強調表示", "选择和高亮"],
["Status", "État", "ステータス", "状态"]
];
export const catalogs: Record<Exclude<Locale, 'en'>, Record<string, string>> = {
fr: Object.fromEntries(messageRows.map(row => [row[0], row[1]])),