Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
feat(chrome-extension): add extension package scaffold
Richie McIlroy5cb764a9e2a1
diff --git a/apps/chrome-extension/.gitignore b/apps/chrome-extension/.gitignorenew file mode 100644index 000000000..aaa9103e4--- /dev/null+++ b/apps/chrome-extension/.gitignore@@ -0,0 +1,2 @@+test-results/+playwright-report/diff --git a/apps/chrome-extension/camera-permission.html b/apps/chrome-extension/camera-permission.htmlnew file mode 100644index 000000000..5451ff7bf--- /dev/null+++ b/apps/chrome-extension/camera-permission.html@@ -0,0 +1,12 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="UTF-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />+ <title>Camera access - Cap</title>+ <script type="module" src="/src/permission/camera-permission.tsx"></script>+ </head>+ <body>+ <div id="root"></div>+ </body>+</html>diff --git a/apps/chrome-extension/camera-preview.html b/apps/chrome-extension/camera-preview.htmlnew file mode 100644index 000000000..ca9d94312--- /dev/null+++ b/apps/chrome-extension/camera-preview.html@@ -0,0 +1,12 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="UTF-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />+ <title>Cap Camera Preview</title>+ <script type="module" src="/src/preview/camera-preview.tsx"></script>+ </head>+ <body>+ <div id="root"></div>+ </body>+</html>diff --git a/apps/chrome-extension/how-it-works.html b/apps/chrome-extension/how-it-works.htmlnew file mode 100644index 000000000..3734907d4--- /dev/null+++ b/apps/chrome-extension/how-it-works.html@@ -0,0 +1,164 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="UTF-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />+ <title>How it works - Cap</title>+ </head>+ <body>+ <main class="stage">+ <header class="brand">+ <svg+ class="brand-logo"+ xmlns="http://www.w3.org/2000/svg"+ fill="none"+ viewBox="0 0 103 40"+ aria-label="Cap"+ >+ <title>Cap</title>+ <path+ fill="#4785FF"+ d="M20 36c8.837 0 16-7.163 16-16S28.837 4 20 4 4 11.164 4 20s7.164 16 16 16"+ ></path>+ <path+ fill="#ADC9FF"+ d="M20 33c7.18 0 13-5.82 13-13S27.18 7 20 7 7 12.82 7 20s5.82 13 13 13"+ ></path>+ <path+ fill="#fff"+ d="M20 30c5.523 0 10-4.477 10-10s-4.477-10-10-10-10 4.477-10 10 4.477 10 10 10"+ ></path>+ <path+ fill="currentColor"+ d="M58.416 30.448c-5.404 0-9.212-3.864-9.212-10.36 0-6.384 3.668-10.416 9.268-10.416 5.068 0 7.784 2.66 8.624 7.168l-3.808.196c-.476-2.604-2.072-4.2-4.816-4.2-3.388 0-5.488 2.828-5.488 7.252 0 4.48 2.156 7.196 5.46 7.196 2.94 0 4.508-1.708 4.956-4.564l3.808.196c-.784 4.676-3.752 7.532-8.792 7.532m16.23-.112c-3.137 0-5.209-1.484-5.209-4.088 0-2.576 1.596-3.948 4.872-4.592l4.956-.98c0-2.1-.98-3.192-2.856-3.192-1.764 0-2.716.812-3.052 2.324l-3.668-.168c.588-3.136 2.996-4.928 6.72-4.928 4.256 0 6.44 2.24 6.44 6.216v5.432c0 .812.28 1.036.84 1.036h.476V30c-.224.056-.812.112-1.288.112-1.624 0-2.828-.588-3.136-2.436-.728 1.596-2.632 2.66-5.096 2.66m.727-2.604c2.38 0 3.892-1.512 3.892-3.78v-.84l-3.864.784c-1.596.308-2.24.98-2.24 2.016 0 1.176.784 1.82 2.212 1.82M86.874 34.2V15.048h3.444l.056 2.212c.868-1.652 2.52-2.548 4.48-2.548 4.256 0 6.356 3.5 6.356 7.812s-2.128 7.812-6.384 7.812c-1.904 0-3.556-.924-4.368-2.38V34.2zm7.112-6.776c2.184 0 3.5-1.82 3.5-4.9s-1.316-4.9-3.5-4.9-3.528 1.652-3.528 4.9 1.316 4.9 3.528 4.9"+ ></path>+ </svg>+ </header>+ <svg class="doodle" viewBox="0 0 120 104" aria-hidden="true">+ <defs>+ <filter id="boil" x="-15%" y="-15%" width="130%" height="130%">+ <feTurbulence+ type="fractalNoise"+ baseFrequency="0.05"+ numOctaves="2"+ seed="1"+ result="noise"+ >+ <animate+ attributeName="seed"+ values="1;3;5;7"+ dur="0.6s"+ repeatCount="indefinite"+ calcMode="discrete"+ ></animate>+ </feTurbulence>+ <feDisplacementMap+ in="SourceGraphic"+ in2="noise"+ scale="3"+ xChannelSelector="R"+ yChannelSelector="G"+ ></feDisplacementMap>+ </filter>+ </defs>+ <g class="doodle-boil">+ <path+ class="doodle-stroke bolt-body"+ pathLength="1"+ d="M 66 10 L 36 58 L 56 58 L 50 94 L 84 42 L 62 42 Z"+ ></path>+ <path+ class="spark spark-1"+ d="M 18 22 L 18 28 M 18 36 L 18 42 M 8 32 L 14 32 M 22 32 L 28 32"+ ></path>+ <path+ class="spark spark-2"+ d="M 100 10 L 100 16 M 100 24 L 100 30 M 90 20 L 96 20 M 104 20 L 110 20"+ ></path>+ <path+ class="spark spark-3"+ d="M 102 64 L 102 69 M 102 75 L 102 80 M 94 72 L 99 72 M 105 72 L 110 72"+ ></path>+ </g>+ </svg>+ <h1>How Cap works</h1>+ <p class="lede">+ Instant Mode uploads while you record, so your share link is ready the+ moment you stop.+ </p>+ <ol class="steps">+ <li class="step">+ <svg class="step-doodle" viewBox="0 0 48 48" aria-hidden="true">+ <circle class="doodle-stroke-sm" cx="24" cy="24" r="14"></circle>+ <circle class="record-dot" cx="24" cy="24" r="5.5"></circle>+ </svg>+ <span class="step-count">Step 1</span>+ <p>+ Click the Cap icon, pick a tab, window, screen or camera, and press+ start.+ </p>+ </li>+ <li class="step">+ <svg class="step-doodle" viewBox="0 0 48 48" aria-hidden="true">+ <path+ class="doodle-stroke-sm cloud-body"+ d="M 13 33 a 7 7 0 0 1 1.5 -13.8 a 10 10 0 0 1 19 -2.6 a 7.5 7.5 0 0 1 1 14.8"+ ></path>+ <path class="upload-arrow" d="M 24 42 L 24 24"></path>+ <path+ class="doodle-stroke-sm arrow-head"+ d="M 18 29 L 24 23 L 30 29"+ ></path>+ </svg>+ <span class="step-count">Step 2</span>+ <p>+ Your video streams to the cloud while you record. No exports, no+ waiting at the end.+ </p>+ </li>+ <li class="step">+ <svg class="step-doodle" viewBox="0 0 48 48" aria-hidden="true">+ <path+ class="doodle-stroke-sm link-piece"+ d="M 21 27 l -5 5 a 6.5 6.5 0 0 0 9.2 9.2 l 5 -5"+ ></path>+ <path+ class="doodle-stroke-sm link-piece link-piece-2"+ d="M 27 21 l 5 -5 a 6.5 6.5 0 0 1 9.2 9.2 l -5 5"+ ></path>+ <path class="doodle-stroke-sm link-bar" d="M 20 37 L 37 20"></path>+ </svg>+ <span class="step-count">Step 3</span>+ <p>+ Stop the recording and the share link is live instantly. Paste it+ anywhere.+ </p>+ </li>+ </ol>+ <div class="card tips-card">+ <h2>Good to know</h2>+ <ul class="tips">+ <li>+ <span class="tip-dot" aria-hidden="true"></span>+ Drag the camera preview anywhere on the page, resize it, or pop it+ out with Picture in Picture.+ </li>+ <li>+ <span class="tip-dot" aria-hidden="true"></span>+ Pause and resume from the floating recording bar without losing+ your take.+ </li>+ <li>+ <span class="tip-dot" aria-hidden="true"></span>+ Click the Cap icon in your toolbar while recording to stop and jump+ straight to your video.+ </li>+ </ul>+ </div>+ </main>+ <p class="footnote">+ Click the Cap icon in your toolbar whenever you're ready to record.+ </p>+ <script type="module" src="/src/how-it-works/main.ts"></script>+ </body>+</html>diff --git a/apps/chrome-extension/offscreen.html b/apps/chrome-extension/offscreen.htmlnew file mode 100644index 000000000..07811d502--- /dev/null+++ b/apps/chrome-extension/offscreen.html@@ -0,0 +1,11 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="UTF-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />+ <title>Cap Recorder Offscreen</title>+ </head>+ <body>+ <script type="module" src="/src/offscreen/recorder.ts"></script>+ </body>+</html>diff --git a/apps/chrome-extension/options.html b/apps/chrome-extension/options.htmlnew file mode 100644index 000000000..583f37990--- /dev/null+++ b/apps/chrome-extension/options.html@@ -0,0 +1,12 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="UTF-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />+ <title>Options - Cap</title>+ </head>+ <body>+ <div id="root"></div>+ <script type="module" src="/src/options/main.tsx"></script>+ </body>+</html>diff --git a/apps/chrome-extension/package.json b/apps/chrome-extension/package.jsonnew file mode 100644index 000000000..f3965dfca--- /dev/null+++ b/apps/chrome-extension/package.json@@ -0,0 +1,41 @@+{+ "name": "@cap/chrome-extension",+ "version": "0.1.0",+ "private": true,+ "type": "module",+ "scripts": {+ "build": "rm -rf dist && vite build && vite build --config vite.content.config.ts && vite build --config vite.content-overlay.config.ts",+ "dev": "rm -rf dist && (trap 'kill 0' INT TERM; vite build --watch --config vite.content.config.ts --mode development & vite build --watch --config vite.content-overlay.config.ts --mode development & vite build --watch --mode development & wait)",+ "typecheck": "tsc --noEmit",+ "test": "vitest run src",+ "test:e2e:install": "playwright install chromium",+ "test:e2e": "pnpm build && playwright test",+ "test:e2e:headed": "pnpm build && playwright test --headed"+ },+ "dependencies": {+ "@cap/recorder-core": "workspace:*",+ "@cap/web-domain": "workspace:*",+ "@radix-ui/colors": "^3.0.0",+ "@radix-ui/react-select": "^2.2.5",+ "@radix-ui/react-switch": "^1.1.0",+ "class-variance-authority": "^0.7.0",+ "clsx": "^2.1.1",+ "lucide-react": "^0.525.0",+ "react": "19.2.4",+ "react-dom": "19.2.4",+ "tailwind-merge": "^2.6.0"+ },+ "devDependencies": {+ "@playwright/test": "^1.51.1",+ "@types/chrome": "^0.0.323",+ "@types/react": "19.2.14",+ "@types/react-dom": "19.2.3",+ "@vitejs/plugin-react": "4.4.1",+ "autoprefixer": "^10.4.16",+ "postcss": "^8.4.31",+ "tailwindcss": "^3.4.0",+ "typescript": "^5.8.3",+ "vite": "6.3.5",+ "vitest": "^3.2.0"+ }+}diff --git a/apps/chrome-extension/playwright.config.ts b/apps/chrome-extension/playwright.config.tsnew file mode 100644index 000000000..d59f32a42--- /dev/null+++ b/apps/chrome-extension/playwright.config.ts@@ -0,0 +1,12 @@+import { defineConfig } from "@playwright/test";++export default defineConfig({+ testDir: "./e2e",+ fullyParallel: false,+ workers: 1,+ timeout: 60_000,+ expect: {+ timeout: 15_000,+ },+ reporter: [["list"]],+});diff --git a/apps/chrome-extension/popup.html b/apps/chrome-extension/popup.htmlnew file mode 100644index 000000000..9573af9a3--- /dev/null+++ b/apps/chrome-extension/popup.html@@ -0,0 +1,12 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="UTF-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />+ <title>Cap Recorder</title>+ </head>+ <body>+ <div id="root"></div>+ <script type="module" src="/src/popup/main.tsx"></script>+ </body>+</html>diff --git a/apps/chrome-extension/postcss.config.cjs b/apps/chrome-extension/postcss.config.cjsnew file mode 100644index 000000000..e873f1a4f--- /dev/null+++ b/apps/chrome-extension/postcss.config.cjs@@ -0,0 +1,6 @@+module.exports = {+ plugins: {+ tailwindcss: {},+ autoprefixer: {},+ },+};diff --git a/apps/chrome-extension/public/fonts/NeueMontreal-Bold.otf b/apps/chrome-extension/public/fonts/NeueMontreal-Bold.otfnew file mode 100644index 000000000..a1c6974f0Binary files /dev/null and b/apps/chrome-extension/public/fonts/NeueMontreal-Bold.otf differdiff --git a/apps/chrome-extension/public/fonts/NeueMontreal-BoldItalic.otf b/apps/chrome-extension/public/fonts/NeueMontreal-BoldItalic.otfnew file mode 100644index 000000000..798048d1fBinary files /dev/null and b/apps/chrome-extension/public/fonts/NeueMontreal-BoldItalic.otf differdiff --git a/apps/chrome-extension/public/fonts/NeueMontreal-Italic.otf b/apps/chrome-extension/public/fonts/NeueMontreal-Italic.otfnew file mode 100644index 000000000..a8c17e707Binary files /dev/null and b/apps/chrome-extension/public/fonts/NeueMontreal-Italic.otf differdiff --git a/apps/chrome-extension/public/fonts/NeueMontreal-Medium.otf b/apps/chrome-extension/public/fonts/NeueMontreal-Medium.otfnew file mode 100644index 000000000..43030e87dBinary files /dev/null and b/apps/chrome-extension/public/fonts/NeueMontreal-Medium.otf differdiff --git a/apps/chrome-extension/public/fonts/NeueMontreal-MediumItalic.otf b/apps/chrome-extension/public/fonts/NeueMontreal-MediumItalic.otfnew file mode 100644index 000000000..78b2fc548Binary files /dev/null and b/apps/chrome-extension/public/fonts/NeueMontreal-MediumItalic.otf differdiff --git a/apps/chrome-extension/public/fonts/NeueMontreal-Regular.otf b/apps/chrome-extension/public/fonts/NeueMontreal-Regular.otfnew file mode 100644index 000000000..0265060cbBinary files /dev/null and b/apps/chrome-extension/public/fonts/NeueMontreal-Regular.otf differdiff --git a/apps/chrome-extension/public/icons/icon-128.png b/apps/chrome-extension/public/icons/icon-128.pngnew file mode 100644index 000000000..90f925321Binary files /dev/null and b/apps/chrome-extension/public/icons/icon-128.png differdiff --git a/apps/chrome-extension/public/icons/icon-16.png b/apps/chrome-extension/public/icons/icon-16.pngnew file mode 100644index 000000000..044fde5b7Binary files /dev/null and b/apps/chrome-extension/public/icons/icon-16.png differdiff --git a/apps/chrome-extension/public/icons/icon-256.png b/apps/chrome-extension/public/icons/icon-256.pngnew file mode 100644index 000000000..5beba0696Binary files /dev/null and b/apps/chrome-extension/public/icons/icon-256.png differdiff --git a/apps/chrome-extension/public/icons/icon-32.png b/apps/chrome-extension/public/icons/icon-32.pngnew file mode 100644index 000000000..d3acd87a8Binary files /dev/null and b/apps/chrome-extension/public/icons/icon-32.png differdiff --git a/apps/chrome-extension/public/icons/icon-48.png b/apps/chrome-extension/public/icons/icon-48.pngnew file mode 100644index 000000000..ed909f6d2Binary files /dev/null and b/apps/chrome-extension/public/icons/icon-48.png differdiff --git a/apps/chrome-extension/public/manifest.json b/apps/chrome-extension/public/manifest.jsonnew file mode 100644index 000000000..de8c8170c--- /dev/null+++ b/apps/chrome-extension/public/manifest.json@@ -0,0 +1,56 @@+{+ "manifest_version": 3,+ "name": "Cap - Screen Recorder & Screen Capture",+ "short_name": "Cap",+ "description": "Free, open source screen recorder. Capture your screen, tab, camera & mic in Chrome and share a video link the moment you stop.",+ "version": "0.1.0",+ "homepage_url": "https://cap.so",+ "minimum_chrome_version": "116",+ "icons": {+ "16": "icons/icon-16.png",+ "32": "icons/icon-32.png",+ "48": "icons/icon-48.png",+ "128": "icons/icon-128.png"+ },+ "action": {+ "default_title": "Record your screen with Cap",+ "default_icon": {+ "16": "icons/icon-16.png",+ "32": "icons/icon-32.png",+ "48": "icons/icon-48.png",+ "128": "icons/icon-128.png"+ }+ },+ "background": {+ "service_worker": "assets/service-worker.js",+ "type": "module"+ },+ "options_page": "options.html",+ "permissions": [+ "activeTab",+ "identity",+ "offscreen",+ "scripting",+ "storage",+ "tabCapture"+ ],+ "host_permissions": ["<all_urls>"],+ "content_scripts": [+ {+ "matches": ["<all_urls>"],+ "js": ["assets/content-bootstrap.js"],+ "run_at": "document_idle"+ }+ ],+ "web_accessible_resources": [+ {+ "resources": ["icons/*", "content/overlay.js"],+ "matches": ["<all_urls>"]+ },+ {+ "resources": ["camera-preview.html", "popup.html"],+ "matches": ["<all_urls>"],+ "use_dynamic_url": true+ }+ ]+}diff --git a/apps/chrome-extension/public/sounds/start-recording.ogg b/apps/chrome-extension/public/sounds/start-recording.oggnew file mode 100644index 000000000..3c2937567Binary files /dev/null and b/apps/chrome-extension/public/sounds/start-recording.ogg differdiff --git a/apps/chrome-extension/public/sounds/stop-recording.ogg b/apps/chrome-extension/public/sounds/stop-recording.oggnew file mode 100644index 000000000..fb1728530Binary files /dev/null and b/apps/chrome-extension/public/sounds/stop-recording.ogg differdiff --git a/apps/chrome-extension/tailwind.config.cjs b/apps/chrome-extension/tailwind.config.cjsnew file mode 100644index 000000000..8bcd9d5e0--- /dev/null+++ b/apps/chrome-extension/tailwind.config.cjs@@ -0,0 +1,12 @@+const sharedConfig = require("@cap/ui/tailwind")("chrome-extension");++module.exports = {+ ...sharedConfig,+ content: [+ "./popup.html",+ "./options.html",+ "./camera-preview.html",+ "./camera-permission.html",+ "./src/**/*.{ts,tsx}",+ ],+};diff --git a/apps/chrome-extension/tsconfig.json b/apps/chrome-extension/tsconfig.jsonnew file mode 100644index 000000000..badcd2393--- /dev/null+++ b/apps/chrome-extension/tsconfig.json@@ -0,0 +1,30 @@+{+ "compilerOptions": {+ "target": "ES2022",+ "useDefineForClassFields": true,+ "lib": ["DOM", "DOM.Iterable", "ES2022"],+ "allowJs": false,+ "skipLibCheck": true,+ "esModuleInterop": true,+ "allowSyntheticDefaultImports": true,+ "strict": true,+ "forceConsistentCasingInFileNames": true,+ "module": "ESNext",+ "moduleResolution": "bundler",+ "allowImportingTsExtensions": true,+ "resolveJsonModule": true,+ "isolatedModules": true,+ "noEmit": true,+ "jsx": "react-jsx",+ "baseUrl": "."+ },+ "include": [+ "src",+ "e2e",+ "vite.config.ts",+ "vite.content.config.ts",+ "vite.content-overlay.config.ts",+ "playwright.config.ts"+ ],+ "references": [{ "path": "../../packages/recorder-core" }]+}diff --git a/apps/chrome-extension/uploading.html b/apps/chrome-extension/uploading.htmlnew file mode 100644index 000000000..81be0f861--- /dev/null+++ b/apps/chrome-extension/uploading.html@@ -0,0 +1,145 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="UTF-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />+ <title>Uploading - Cap</title>+ </head>+ <body>+ <main id="stage" class="stage" data-mode="waiting">+ <header class="brand">+ <svg+ class="brand-logo"+ xmlns="http://www.w3.org/2000/svg"+ fill="none"+ viewBox="0 0 103 40"+ aria-label="Cap"+ >+ <title>Cap</title>+ <path+ fill="#4785FF"+ d="M20 36c8.837 0 16-7.163 16-16S28.837 4 20 4 4 11.164 4 20s7.164 16 16 16"+ ></path>+ <path+ fill="#ADC9FF"+ d="M20 33c7.18 0 13-5.82 13-13S27.18 7 20 7 7 12.82 7 20s5.82 13 13 13"+ ></path>+ <path+ fill="#fff"+ d="M20 30c5.523 0 10-4.477 10-10s-4.477-10-10-10-10 4.477-10 10 4.477 10 10 10"+ ></path>+ <path+ fill="currentColor"+ d="M58.416 30.448c-5.404 0-9.212-3.864-9.212-10.36 0-6.384 3.668-10.416 9.268-10.416 5.068 0 7.784 2.66 8.624 7.168l-3.808.196c-.476-2.604-2.072-4.2-4.816-4.2-3.388 0-5.488 2.828-5.488 7.252 0 4.48 2.156 7.196 5.46 7.196 2.94 0 4.508-1.708 4.956-4.564l3.808.196c-.784 4.676-3.752 7.532-8.792 7.532m16.23-.112c-3.137 0-5.209-1.484-5.209-4.088 0-2.576 1.596-3.948 4.872-4.592l4.956-.98c0-2.1-.98-3.192-2.856-3.192-1.764 0-2.716.812-3.052 2.324l-3.668-.168c.588-3.136 2.996-4.928 6.72-4.928 4.256 0 6.44 2.24 6.44 6.216v5.432c0 .812.28 1.036.84 1.036h.476V30c-.224.056-.812.112-1.288.112-1.624 0-2.828-.588-3.136-2.436-.728 1.596-2.632 2.66-5.096 2.66m.727-2.604c2.38 0 3.892-1.512 3.892-3.78v-.84l-3.864.784c-1.596.308-2.24.98-2.24 2.016 0 1.176.784 1.82 2.212 1.82M86.874 34.2V15.048h3.444l.056 2.212c.868-1.652 2.52-2.548 4.48-2.548 4.256 0 6.356 3.5 6.356 7.812s-2.128 7.812-6.384 7.812c-1.904 0-3.556-.924-4.368-2.38V34.2zm7.112-6.776c2.184 0 3.5-1.82 3.5-4.9s-1.316-4.9-3.5-4.9-3.528 1.652-3.528 4.9 1.316 4.9 3.528 4.9"+ ></path>+ </svg>+ </header>+ <svg class="doodle" viewBox="0 0 120 104" aria-hidden="true">+ <defs>+ <filter id="boil" x="-15%" y="-15%" width="130%" height="130%">+ <feTurbulence+ type="fractalNoise"+ baseFrequency="0.05"+ numOctaves="2"+ seed="1"+ result="noise"+ >+ <animate+ attributeName="seed"+ values="1;3;5;7"+ dur="0.6s"+ repeatCount="indefinite"+ calcMode="discrete"+ ></animate>+ </feTurbulence>+ <feDisplacementMap+ in="SourceGraphic"+ in2="noise"+ scale="3"+ xChannelSelector="R"+ yChannelSelector="G"+ ></feDisplacementMap>+ </filter>+ </defs>+ <g class="doodle-boil">+ <g class="doodle-cloud">+ <path+ class="doodle-stroke cloud-path"+ pathLength="1"+ d="M 34 58 L 88 58 C 98 58 106 50 106 41 C 106 32 98.5 25 89.5 25 C 86.5 25 84 25.7 81.8 27 C 79 16.5 69.5 9 58.5 9 C 47 9 37.5 16.8 34.8 27.5 C 25.2 28 17.5 35.4 17.5 44 C 17.5 52 24.8 58 34 58 Z"+ ></path>+ <path+ class="doodle-stroke cloud-arrow"+ d="M 60 92 L 60 68 M 49 78 L 60 66 L 71 78"+ ></path>+ </g>+ <g class="doodle-check">+ <path+ class="doodle-stroke check-path"+ pathLength="1"+ d="M 34 58 L 52 76 L 90 30"+ ></path>+ <path+ class="spark spark-1"+ d="M 24 12 L 24 18 M 24 26 L 24 32 M 14 22 L 20 22 M 28 22 L 34 22"+ ></path>+ <path+ class="spark spark-2"+ d="M 98 4 L 98 10 M 98 18 L 98 24 M 88 14 L 94 14 M 102 14 L 108 14"+ ></path>+ <path+ class="spark spark-3"+ d="M 104 56 L 104 61 M 104 67 L 104 72 M 96 64 L 101 64 M 107 64 L 112 64"+ ></path>+ </g>+ <g class="doodle-error">+ <path+ class="doodle-stroke error-path"+ pathLength="1"+ d="M 60 24 L 60 60 M 60 75 L 60 75.4"+ ></path>+ </g>+ </g>+ </svg>+ <h1 id="upload-title" aria-live="polite">Connecting to your recording</h1>+ <p id="upload-detail">One moment…</p>+ <div class="squiggle-row">+ <svg class="squiggle" viewBox="0 0 360 26" aria-hidden="true">+ <path+ class="squiggle-track"+ pathLength="100"+ d="M 6 14 q 6 -7 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0"+ ></path>+ <path+ id="squiggle-progress"+ class="squiggle-progress"+ pathLength="100"+ d="M 6 14 q 6 -7 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0"+ ></path>+ </svg>+ <span id="percent-value" class="percent">0%</span>+ </div>+ <p id="upload-meta" class="upload-meta" hidden></p>+ <a id="share-link" class="share-link" target="_self" hidden+ >Open your Cap</a+ >+ <div id="error-actions" class="error-actions" hidden>+ <button id="retry-upload" class="action-button" type="button">+ Try again+ </button>+ <button+ id="download-recording"+ class="action-button is-secondary"+ type="button"+ >+ Download recording+ </button>+ </div>+ </main>+ <p class="footnote">+ Keep this tab in the background. We'll take you to your Cap the moment+ it's ready.+ </p>+ <script type="module" src="/src/uploading/main.ts"></script>+ </body>+</html>diff --git a/apps/chrome-extension/vite.config.ts b/apps/chrome-extension/vite.config.tsnew file mode 100644index 000000000..ca761254d--- /dev/null+++ b/apps/chrome-extension/vite.config.ts@@ -0,0 +1,32 @@+import { resolve } from "node:path";+import react from "@vitejs/plugin-react";+import { defineConfig } from "vite";++export default defineConfig({+ plugins: [react()],+ build: {+ emptyOutDir: false,+ outDir: "dist",+ rollupOptions: {+ input: {+ popup: resolve(__dirname, "popup.html"),+ options: resolve(__dirname, "options.html"),+ welcome: resolve(__dirname, "welcome.html"),+ "how-it-works": resolve(__dirname, "how-it-works.html"),+ uploading: resolve(__dirname, "uploading.html"),+ offscreen: resolve(__dirname, "offscreen.html"),+ "camera-preview": resolve(__dirname, "camera-preview.html"),+ "camera-permission": resolve(__dirname, "camera-permission.html"),+ "service-worker": resolve(+ __dirname,+ "src/background/service-worker.ts",+ ),+ },+ output: {+ entryFileNames: "assets/[name].js",+ chunkFileNames: "assets/[name].js",+ assetFileNames: "assets/[name][extname]",+ },+ },+ },+});diff --git a/apps/chrome-extension/vite.content-overlay.config.ts b/apps/chrome-extension/vite.content-overlay.config.tsnew file mode 100644index 000000000..91b72a1ad--- /dev/null+++ b/apps/chrome-extension/vite.content-overlay.config.ts@@ -0,0 +1,25 @@+import { resolve } from "node:path";+import react from "@vitejs/plugin-react";+import { defineConfig } from "vite";++// The full overlay/recording-bar UI, lazily import()ed by the bootstrap+// content script. It must be an ES module (the bootstrap dynamic-imports+// it), self-contained, and emitted at a stable hash-free path so the+// manifest's web_accessible_resources entry can list it.+export default defineConfig({+ plugins: [react()],+ build: {+ emptyOutDir: false,+ outDir: "dist",+ rollupOptions: {+ input: resolve(__dirname, "src/content/overlay.tsx"),+ // Keep the init() export the bootstrap calls after import().+ preserveEntrySignatures: "exports-only",+ output: {+ format: "es",+ entryFileNames: "content/overlay.js",+ inlineDynamicImports: true,+ },+ },+ },+});diff --git a/apps/chrome-extension/vite.content.config.ts b/apps/chrome-extension/vite.content.config.tsnew file mode 100644index 000000000..012b5b95b--- /dev/null+++ b/apps/chrome-extension/vite.content.config.ts@@ -0,0 +1,21 @@+import { resolve } from "node:path";+import { defineConfig } from "vite";++// Chrome runs manifest content scripts as classic scripts, so this entry+// must be a single self-contained IIFE with no ES module imports. Only the+// tiny dependency-free bootstrap ships this way; it lazily import()s the+// real overlay UI (built by vite.content-overlay.config.ts) from+// web_accessible_resources when a tab actually needs it.+export default defineConfig({+ build: {+ emptyOutDir: false,+ outDir: "dist",+ rollupOptions: {+ input: resolve(__dirname, "src/content/bootstrap.ts"),+ output: {+ format: "iife",+ entryFileNames: "assets/content-bootstrap.js",+ },+ },+ },+});diff --git a/apps/chrome-extension/welcome.html b/apps/chrome-extension/welcome.htmlnew file mode 100644index 000000000..edae27320--- /dev/null+++ b/apps/chrome-extension/welcome.html@@ -0,0 +1,191 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="UTF-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />+ <title>Welcome - Cap</title>+ </head>+ <body>+ <div class="corner" aria-hidden="true">+ <svg class="corner-arrow" viewBox="0 0 140 150">+ <defs>+ <filter id="boil-corner" x="-15%" y="-15%" width="130%" height="130%">+ <feTurbulence+ type="fractalNoise"+ baseFrequency="0.05"+ numOctaves="2"+ seed="2"+ result="noise"+ >+ <animate+ attributeName="seed"+ values="2;4;6;8"+ dur="0.6s"+ repeatCount="indefinite"+ calcMode="discrete"+ ></animate>+ </feTurbulence>+ <feDisplacementMap+ in="SourceGraphic"+ in2="noise"+ scale="3"+ xChannelSelector="R"+ yChannelSelector="G"+ ></feDisplacementMap>+ </filter>+ </defs>+ <g class="corner-boil">+ <g class="corner-nudge">+ <path+ class="doodle-stroke corner-arrow-path"+ pathLength="1"+ d="M 22 140 C 64 126 100 88 109 30"+ ></path>+ <path+ class="doodle-stroke corner-arrow-head"+ pathLength="1"+ d="M 88 44 L 110 24 L 115 53"+ ></path>+ </g>+ </g>+ </svg>+ <p class="corner-hint">Cap hides up here</p>+ </div>+ <main id="stage" class="stage" data-mode="pin">+ <header class="brand">+ <svg+ class="brand-logo"+ xmlns="http://www.w3.org/2000/svg"+ fill="none"+ viewBox="0 0 103 40"+ aria-label="Cap"+ >+ <title>Cap</title>+ <path+ fill="#4785FF"+ d="M20 36c8.837 0 16-7.163 16-16S28.837 4 20 4 4 11.164 4 20s7.164 16 16 16"+ ></path>+ <path+ fill="#ADC9FF"+ d="M20 33c7.18 0 13-5.82 13-13S27.18 7 20 7 7 12.82 7 20s5.82 13 13 13"+ ></path>+ <path+ fill="#fff"+ d="M20 30c5.523 0 10-4.477 10-10s-4.477-10-10-10-10 4.477-10 10 4.477 10 10 10"+ ></path>+ <path+ fill="currentColor"+ d="M58.416 30.448c-5.404 0-9.212-3.864-9.212-10.36 0-6.384 3.668-10.416 9.268-10.416 5.068 0 7.784 2.66 8.624 7.168l-3.808.196c-.476-2.604-2.072-4.2-4.816-4.2-3.388 0-5.488 2.828-5.488 7.252 0 4.48 2.156 7.196 5.46 7.196 2.94 0 4.508-1.708 4.956-4.564l3.808.196c-.784 4.676-3.752 7.532-8.792 7.532m16.23-.112c-3.137 0-5.209-1.484-5.209-4.088 0-2.576 1.596-3.948 4.872-4.592l4.956-.98c0-2.1-.98-3.192-2.856-3.192-1.764 0-2.716.812-3.052 2.324l-3.668-.168c.588-3.136 2.996-4.928 6.72-4.928 4.256 0 6.44 2.24 6.44 6.216v5.432c0 .812.28 1.036.84 1.036h.476V30c-.224.056-.812.112-1.288.112-1.624 0-2.828-.588-3.136-2.436-.728 1.596-2.632 2.66-5.096 2.66m.727-2.604c2.38 0 3.892-1.512 3.892-3.78v-.84l-3.864.784c-1.596.308-2.24.98-2.24 2.016 0 1.176.784 1.82 2.212 1.82M86.874 34.2V15.048h3.444l.056 2.212c.868-1.652 2.52-2.548 4.48-2.548 4.256 0 6.356 3.5 6.356 7.812s-2.128 7.812-6.384 7.812c-1.904 0-3.556-.924-4.368-2.38V34.2zm7.112-6.776c2.184 0 3.5-1.82 3.5-4.9s-1.316-4.9-3.5-4.9-3.528 1.652-3.528 4.9 1.316 4.9 3.528 4.9"+ ></path>+ </svg>+ </header>+ <svg class="doodle" viewBox="0 0 120 104" aria-hidden="true">+ <defs>+ <filter id="boil" x="-15%" y="-15%" width="130%" height="130%">+ <feTurbulence+ type="fractalNoise"+ baseFrequency="0.05"+ numOctaves="2"+ seed="1"+ result="noise"+ >+ <animate+ attributeName="seed"+ values="1;3;5;7"+ dur="0.6s"+ repeatCount="indefinite"+ calcMode="discrete"+ ></animate>+ </feTurbulence>+ <feDisplacementMap+ in="SourceGraphic"+ in2="noise"+ scale="3"+ xChannelSelector="R"+ yChannelSelector="G"+ ></feDisplacementMap>+ </filter>+ </defs>+ <g class="doodle-boil">+ <g class="doodle-pin">+ <path+ class="doodle-stroke pin-body"+ pathLength="1"+ d="M 50 24 L 47 24 Q 42 24 42 19 L 42 15 Q 42 10 47 10 L 73 10 Q 78 10 78 15 L 78 19 Q 78 24 73 24 L 70 24 L 74 40 L 83 40 Q 88 40 88 46 Q 88 52 83 52 L 37 52 Q 32 52 32 46 Q 32 40 37 40 L 46 40 Z"+ ></path>+ <path+ class="doodle-stroke pin-needle"+ pathLength="1"+ d="M 60 52 L 60 86"+ ></path>+ <path+ class="spark spark-1"+ d="M 22 26 L 22 32 M 22 40 L 22 46 M 12 36 L 18 36 M 26 36 L 32 36"+ ></path>+ <path+ class="spark spark-2"+ d="M 98 8 L 98 14 M 98 22 L 98 28 M 88 18 L 94 18 M 102 18 L 108 18"+ ></path>+ <path+ class="spark spark-3"+ d="M 104 60 L 104 65 M 104 71 L 104 76 M 96 68 L 101 68 M 107 68 L 112 68"+ ></path>+ </g>+ </g>+ </svg>+ <h1>Pin Cap to your toolbar</h1>+ <p class="lede">+ Keep one-click recording within reach. It only takes a second.+ </p>+ <ol class="steps">+ <li class="step">+ <svg class="step-doodle" viewBox="0 0 48 48" aria-hidden="true">+ <path+ class="doodle-stroke-sm"+ d="M 10 18 L 19 18 a 4.5 4.5 0 1 1 9 0 L 38 18 L 38 24 a 4.5 4.5 0 1 1 0 9 L 38 38 L 10 38 Z"+ ></path>+ </svg>+ <span class="step-count">Step 1</span>+ <p>Click the puzzle piece next to the address bar.</p>+ </li>+ <li class="step">+ <svg class="step-doodle" viewBox="0 0 48 48" aria-hidden="true">+ <path+ class="doodle-stroke-sm"+ d="M 20 14 L 17 14 L 17 8 L 31 8 L 31 14 L 28 14 L 29 22 L 36 22 L 36 28 L 12 28 L 12 22 L 19 22 Z"+ ></path>+ <path class="doodle-stroke-sm" d="M 24 28 L 24 40"></path>+ </svg>+ <span class="step-count">Step 2</span>+ <p>Hit the pin beside Cap Screen Recorder.</p>+ </li>+ <li class="step">+ <svg class="step-doodle" viewBox="0 0 48 48" aria-hidden="true">+ <circle class="doodle-stroke-sm" cx="24" cy="24" r="14"></circle>+ <circle class="record-dot" cx="24" cy="24" r="5.5"></circle>+ </svg>+ <span class="step-count">Step 3</span>+ <p>Click the Cap icon whenever you're ready to record.</p>+ </li>+ </ol>+ <div class="cta-row">+ <button id="sign-in" class="cta" type="button">Sign in to Cap</button>+ <p id="signed-in" class="paper-pill success" hidden>+ <svg class="check-mini" viewBox="0 0 24 24" aria-hidden="true">+ <path+ class="check-mini-path"+ pathLength="1"+ d="M 4 13 L 9.5 18 L 20 6"+ ></path>+ </svg>+ You're signed in. Click the Cap icon to start recording.+ </p>+ </div>+ <p id="cta-note" class="cta-note" hidden>+ Finish signing in using the Cap tab. This page updates automatically.+ </p>+ </main>+ <p class="footnote">You can close this tab once Cap is pinned.</p>+ <script type="module" src="/src/welcome/main.ts"></script>+ </body>+</html>