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:
23
src/lib/actions.ts
Normal file
23
src/lib/actions.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
// Canonical action + writing-style lists shared by the toolbar, popup,
|
||||
// context menus, and result modal. Values must stay in sync with the system
|
||||
// prompts in the background worker.
|
||||
|
||||
// 'fix' is the user-facing id emitted by the context menu and popup; the
|
||||
// background normalizes it to the 'grammar' prompt.
|
||||
export const ACTIONS = ['fix', 'rephrase', 'shorten', 'expand', 'explain'] as const;
|
||||
export type ActionId = (typeof ACTIONS)[number];
|
||||
|
||||
export const ACTION_LABELS: Record<ActionId, string> = {
|
||||
fix: 'Fix Grammar',
|
||||
rephrase: 'Rephrase',
|
||||
shorten: 'Shorten',
|
||||
expand: 'Expand',
|
||||
explain: 'Explain',
|
||||
};
|
||||
|
||||
// Full list, including the 'Default' pseudo-style (= no style modifier).
|
||||
export const WRITING_STYLES = ['Default', 'Formal', 'Casual', 'Academic', 'Creative', 'Concise'] as const;
|
||||
export type WritingStyle = (typeof WRITING_STYLES)[number];
|
||||
|
||||
// Context menus omit 'Default' — the parent action item already covers it.
|
||||
export const CONTEXT_MENU_STYLES = WRITING_STYLES.filter((s) => s !== 'Default');
|
||||
Reference in New Issue
Block a user