feat: initial LexAI Chrome extension scaffold
- WXT + React 18 + TypeScript setup - Background service worker (LLM API proxy) - Content script (floating toolbar + text selection) - Options page (provider/model/API key config) - Popup UI - Gitea Actions workflows (CI, preview, release) - Vitest unit tests + Playwright E2E setup - Supports: OpenAI, Anthropic, Groq, OpenRouter
This commit is contained in:
21
src/utils/REFERENCE_NOTES.md
Normal file
21
src/utils/REFERENCE_NOTES.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# Reference Project Notes
|
||||
|
||||
## Scramble (zlwaterfield/scramble) ⭐ 1,647
|
||||
- Uses `browserAPI` abstraction for Chrome/Firefox compat
|
||||
- Content script listens for messages, calls background to do actual LLM calls
|
||||
- **Key pattern:** `replaceSelectedText()` handles both:
|
||||
1. `TEXTAREA` / `INPUT` elements (uses selectionStart/End)
|
||||
2. Generic DOM selection (uses Range API)
|
||||
- Context menu integration for triggering actions
|
||||
- Good reference for: text replacement, context menu setup
|
||||
|
||||
## Proofly (onderceylan/proofly)
|
||||
- Privacy-first: uses Chrome's built-in on-device AI (no API key needed)
|
||||
- Good reference for: Manifest V3 structure, shadow DOM injection for UI
|
||||
|
||||
## Key Learnings for LexAI
|
||||
1. **Always handle both textarea AND contenteditable** — different replacement logic needed
|
||||
2. **Use shadow DOM for toolbar** — prevents host page CSS from breaking our UI
|
||||
3. **Background as CORS proxy** — content scripts can't call external APIs directly
|
||||
4. **Context menu = power user feature** — right-click → LexAI actions
|
||||
5. **Debounce selection events** — users drag text slowly, don't fire on every pixel
|
||||
Reference in New Issue
Block a user