Skip to content

mdkhaledbin/Focus-Chrome-Dictionary-Extension

Repository files navigation

🎯 Focus

Stay in the flow. Instant word definitions β€” no new tab, no distraction.

Manifest V3 Vite React TypeScript Tailwind CSS License: GPL--3.0--or--later


✨ What is Focus?

Focus is a Chrome Extension built on Manifest V3 that empowers readers to look up word definitions instantly β€” directly within the page. No context switching, no new tabs. Just highlight a word, get the definition, and keep reading.

Philosophy: Minimum Distraction. Maximum Context.


πŸš€ Key Features

  • πŸ“– Inline Definitions β€” Highlight any word to reveal an elegant floating definition card, rendered directly on the page.
  • ⚑ Local-First Lookup β€” Uses a bundled Webster-based dictionary_compact.json loaded into IndexedDB for near-instant lookups β€” no internet required.
  • 🌐 API Fallback β€” Automatically queries the Free Dictionary API for words not found in the local store.
  • 🧠 Smart Caching β€” An in-memory cache layer sits on top of IndexedDB to eliminate redundant disk reads during a session.
  • 🎨 Glassmorphic UI β€” A polished, dark-mode aware popup and definition card with smooth animations.
  • πŸ”’ Privacy-First β€” All local lookups are fully offline. No user data is ever transmitted unless an API fallback is triggered.
  • βš™οΈ Settings Popup β€” A dedicated popup UI accessible from the Chrome toolbar for extension controls.

πŸ“Έ How to Use β€” Step by Step

βœ… This repository includes a ready-to-use dist/ folder for quick install without any build steps.

The following screenshots walk you through the full experience.

Step 1 β€” Load in Chrome
Load unpacked in Chrome

Navigate to chrome://extensions, enable Developer Mode, and click Load unpacked β†’ select the dist/ folder.

Step 2 β€” (Contributors) Build the Extension
Build the dist folder

Only needed if you changed source code. Run npm run build to regenerate dist/.

Step 3 β€” Extension is Active
Extension active in toolbar

Focus appears in your Chrome toolbar. Click the icon to open the settings popup.

Step 4 β€” Select a Word
Select a word on the page

Highlight any word on any webpage. A definition button will appear near your selection.

Step 5 β€” See the Definition
Definition card appears

The definition card appears inline β€” rich, clean, and fully non-intrusive.


πŸ› οΈ Installation & Development

Option A β€” Easy Setup (No Build Required)

  • Direct dist/ folder download: Download dist folder
  • If that link is blocked in your network, download the repo ZIP and use its dist/ folder.
  1. Download or clone this repository
  2. Open Chrome and go to chrome://extensions
  3. Enable Developer Mode (top-right toggle)
  4. Click "Load unpacked"
  5. Select the dist/ folder from this repository

βœ… You can use the extension immediately. No Node.js, npm, or build step required.

Option B β€” Contributor Setup (Build from Source)

Prerequisites

1. Clone & Install Dependencies

git clone https://github.com/<your-username>/focus-extension.git
cd focus-extension
npm install

2. Build the Extension

npm run build

This uses tsc + Vite to compile TypeScript and bundle all three entry points (popup, background, content) into the dist/ folder.

3. Load into Chrome

  1. Open Chrome and go to chrome://extensions
  2. Enable Developer Mode (top-right toggle)
  3. Click "Load unpacked"
  4. Select the dist/ folder inside the project root

βœ… The extension will now appear in your toolbar and be active on all pages.

4. Development Mode (Hot Reload)

npm run dev

Note: Vite's dev server powers the popup UI. For content script and background changes, you must rebuild and reload the extension in Chrome manually.


πŸ—οΈ Tech Stack

Layer Technology
Build Tool Vite 8.x
Language TypeScript 5.9
UI Framework React 19
Styling Tailwind CSS 4.x
Extension API Chrome Manifest V3
Local Data IndexedDB + In-Memory Cache
Dictionary Source Webster's English (Compact JSON) + dictionaryapi.dev

πŸ“ Project Structure

focus/
β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ manifest.json          # Chrome Extension manifest (MV3)
β”‚   β”œβ”€β”€ dictionary_compact.json # Bundled Webster's dictionary (~22MB)
β”‚   β”œβ”€β”€ favicon.svg
β”‚   └── icons.svg
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ background.ts          # Service Worker: dictionary load, lookup, API fallback
β”‚   β”œβ”€β”€ content.tsx            # Content Script: highlight detection, definition card UI
β”‚   β”œβ”€β”€ App.tsx                # Popup UI: settings and status
β”‚   β”œβ”€β”€ main.tsx               # Popup entry point
β”‚   └── index.css              # Global styles
β”œβ”€β”€ images/                    # Step-by-step screenshots
β”œβ”€β”€ index.html                 # Popup HTML entry
β”œβ”€β”€ vite.config.ts             # Multi-entry Vite configuration
└── package.json

🀝 Contributing

Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.


πŸ“„ License

This project is licensed under the GNU General Public License v3.0 or later (GPL-3.0-or-later) β€” see the LICENSE.md file for details.


πŸ™ Credits & Acknowledgments

Dictionary data and related resources are credited to the following sources:

Focus uses bundled Webster-derived local dictionary data as the primary source, and the Free Dictionary API as a secondary fallback for terms not present in local storage.


Built with ❀️ to keep you in the flow.

About

A fully free, privacy-first Chrome extension for instant inline word definitions with a local Webster-based dictionary and Free Dictionary API fallback.

Resources

License

Stars

10 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors