# Adding Circle Lens to a project: instructions for AI coding agents You are adding **Circle Lens** to the project you're working in. Once it's added, a visitor draws a circle twice with the mouse and a magnifying lens opens at the pointer and follows it. `+`/`−` or Ctrl + wheel change the zoom, and Esc or another double circle closes it. The package is `circle-lens` on npm: 7 KB gzipped, no dependencies, TypeScript types included. It works with any framework. Follow these steps in order. Keep the change small: one install and one call to `circleLens()` in one place. ## 1. Find out what the project is Read the project before changing anything: - `package.json`: the framework (`next`, `react`, `vue`, `nuxt`, `svelte`, `@sveltejs/kit`, `astro`, `@angular/core`, `@remix-run/*`, `react-router`, `solid-js`, …) and whether there is a bundler at all. - The lockfile, to pick the package manager: `package-lock.json` → npm, `pnpm-lock.yaml` → pnpm, `yarn.lock` → yarn, `bun.lockb` or `bun.lock` → bun. - With no `package.json`, it is a static site, a CMS theme or a server-rendered app (WordPress, Shopify, Hugo, Jekyll, Django, Rails, Laravel, …). Use the script tag (step 2B). ## 2. Add it ### A. Projects with a bundler: install from npm ```bash npm install circle-lens # or: pnpm add circle-lens / yarn add circle-lens / bun add circle-lens ``` Then call `circleLens()` once, on the client, where the app starts. Pick the matching case below and add only that. **React with Vite, or any single-page app.** In the entry file (`src/main.tsx`, `src/main.jsx`, `src/index.tsx`), after the app mounts: ```ts import { circleLens } from 'circle-lens'; circleLens(); ``` **Vue with Vite.** In `src/main.ts`, after `app.mount(...)`, the same two lines. **Next.js, App Router.** Make a client component and render it once in the root layout: ```tsx // app/circle-lens-loader.tsx 'use client'; import { useEffect } from 'react'; import { circleLens } from 'circle-lens'; export function CircleLensLoader() { useEffect(() => { const lens = circleLens(); return () => lens.destroy(); }, []); return null; } ``` ```tsx // app/layout.tsx: inside
, next to {children} import { CircleLensLoader } from './circle-lens-loader'; // …