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');
|
||||
32
src/lib/theme.ts
Normal file
32
src/lib/theme.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
// Canonical LexAI palette (Catppuccin Mocha-derived). This is the single
|
||||
// source of truth for UI colors; a light variant can be added here later.
|
||||
//
|
||||
// NOTE: the entrypoints still contain literal hex values from before this
|
||||
// module existed. New/edited styles should reference THEME; the wholesale
|
||||
// swap of existing literals happens together with light/dark theming so the
|
||||
// color plumbing is only rewritten once.
|
||||
|
||||
export const THEME = {
|
||||
// Surfaces
|
||||
base: '#1e1e2e',
|
||||
mantle: '#181825',
|
||||
surface: '#313244',
|
||||
surfaceGradient: 'linear-gradient(135deg, #1e1e2e 0%, #181825 100%)',
|
||||
|
||||
// Text
|
||||
text: '#cdd6f4',
|
||||
subtext: '#a6adc8',
|
||||
muted: '#6c7086',
|
||||
|
||||
// Accents
|
||||
accent: '#89b4fa', // blue — primary actions, links
|
||||
success: '#a6e3a1', // green — success toasts
|
||||
danger: '#f38ba8', // red — errors
|
||||
warning: '#f9e2af', // yellow
|
||||
|
||||
// Borders
|
||||
border: 'rgba(205,214,244,0.12)',
|
||||
borderStrong: 'rgba(205,214,244,0.15)',
|
||||
} as const;
|
||||
|
||||
export type Theme = typeof THEME;
|
||||
Reference in New Issue
Block a user