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

@@ -2,9 +2,7 @@ import React, { useEffect, useRef, useState } from 'react';
import { createRoot } from 'react-dom/client';
import { safeSendMessage, safeStorageGet, safeStorageSet } from '@lib/messaging';
// ─── Constants ───────────────────────────────────────────────────────────────
const WRITING_STYLES = ['Default', 'Formal', 'Casual', 'Academic', 'Creative', 'Concise'];
import { WRITING_STYLES } from '@lib/actions';
// ─── Types ───────────────────────────────────────────────────────────────────