refactor: single source for writing styles + action labels; add theme module

- src/lib/actions.ts: canonical ACTIONS/ACTION_LABELS/WRITING_STYLES;
  context-menu styles derived (WRITING_STYLES minus Default). Replaces
  the three duplicated style arrays in popup, content, and background.
- src/lib/theme.ts: canonical palette. Existing hex literals in the
  entrypoints are swapped wholesale when light/dark theming lands, so
  the color plumbing is only rewritten once.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
john kevin asprec
2026-07-14 21:35:54 +08:00
parent 324cfcc486
commit 47d9152bda
5 changed files with 62 additions and 17 deletions

View File

@@ -1,5 +1,6 @@
import { defineContentScript } from 'wxt/utils/define-content-script';
import { isExtensionValid, safeSendMessage } from '@lib/messaging';
import { WRITING_STYLES } from '@lib/actions';
export default defineContentScript({
matches: ['<all_urls>'],
@@ -744,7 +745,7 @@ export default defineContentScript({
modal.appendChild(body);
// ─── Style selector row ───────────────────────────────────────────────
const STYLES = ['Default', 'Formal', 'Casual', 'Academic', 'Creative', 'Concise'];
const STYLES = WRITING_STYLES;
const styleRow = document.createElement('div');
Object.assign(styleRow.style, {