From f1a35c7ab655154af620c2efa67b01ddc7754b1d Mon Sep 17 00:00:00 2001 From: dillonstreator Date: Fri, 6 Nov 2026 16:20:43 -0600 Subject: [PATCH] feat(extension): share the redesigned theme with web via @crypt.fyi/theme The web redesign left the extension settings page on the old neutral palette, with tokens copied by hand. Its dark tokens also nested @theme in a media query, which Tailwind flattens, so the page always rendered dark. - Add a private, build-free @crypt.fyi/theme package holding the tokens, fonts, preference logic and the pre-paint theme-init.js script. - Move web onto the package. Its compiled CSS changes only in how fonts are referenced, plus the removal of an unused .ring class. - Rebuild the settings page on the shared tokens with a System/Light/Dark control. It stays plain HTML, so UI components are not shared. - Override the font and 75% text size Chrome injects on extension pages, which would otherwise beat the theme's layered base styles. - Test the colors copied into theme-init.js so they cannot drift. --- .changeset/shared-theme-package.md | 6 + AGENTS.md | 5 + packages/extension/README.md | 4 + packages/extension/package.json | 1 + packages/extension/src/options/index.html | 237 +++++++++++------- packages/extension/src/options/main.ts | 1 + packages/extension/src/options/styles.css | 103 ++++---- packages/extension/src/options/theme.ts | 45 ++++ packages/extension/vite.config.ts | 2 + packages/theme/README.md | 14 ++ packages/theme/package.json | 33 +++ packages/theme/src/fonts/inter.ts | 1 + packages/theme/src/fonts/jetbrains-mono.ts | 1 + packages/theme/src/fonts/space-grotesk.ts | 1 + packages/theme/src/index.ts | 78 ++++++ .../{web/public => theme/src}/theme-init.js | 6 +- packages/theme/src/theme.test.ts | 117 +++++++++ packages/theme/src/tokens.css | 113 +++++++++ packages/theme/tsconfig.json | 17 ++ packages/theme/vite.d.ts | 3 + packages/theme/vite.js | 33 +++ packages/web/e2e/theme.spec.ts | 2 +- packages/web/index.html | 2 - packages/web/package.json | 4 +- packages/web/src/index.css | 76 +----- packages/web/src/main.tsx | 6 +- packages/web/src/theme/ThemeProvider.tsx | 76 ++---- packages/web/src/theme/theme.ts | 14 +- packages/web/tailwind.config.js | 33 +-- packages/web/vite.config.ts | 3 +- pnpm-lock.yaml | 52 +++- 31 files changed, 748 insertions(+), 341 deletions(-) create mode 100644 .changeset/shared-theme-package.md create mode 100644 packages/extension/src/options/theme.ts create mode 100644 packages/theme/README.md create mode 100644 packages/theme/package.json create mode 100644 packages/theme/src/fonts/inter.ts create mode 100644 packages/theme/src/fonts/jetbrains-mono.ts create mode 100644 packages/theme/src/fonts/space-grotesk.ts create mode 100644 packages/theme/src/index.ts rename packages/{web/public => theme/src}/theme-init.js (90%) create mode 100644 packages/theme/src/theme.test.ts create mode 100644 packages/theme/src/tokens.css create mode 100644 packages/theme/tsconfig.json create mode 100644 packages/theme/vite.d.ts create mode 100644 packages/theme/vite.js diff --git a/.changeset/shared-theme-package.md b/.changeset/shared-theme-package.md new file mode 100644 index 0000000..8ad3fe3 --- /dev/null +++ b/.changeset/shared-theme-package.md @@ -0,0 +1,6 @@ +--- +'@crypt.fyi/extension': patch +'@crypt.fyi/web': patch +--- + +Share design tokens, fonts and theme logic through a new private `@crypt.fyi/theme` package. The extension settings page adopts the redesigned look with a System/Light/Dark control, which also fixes it always rendering dark. diff --git a/AGENTS.md b/AGENTS.md index f8a524a..5323460 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -15,6 +15,7 @@ pnpm + Turborepo monorepo (`Node >= 22`, Active LTS 26 in `.nvmrc`/CI/Docker; `p | `@crypt.fyi/server` | Fastify API + Redis | | `@crypt.fyi/cli` | npm CLI | | `@crypt.fyi/extension` | Chrome extension | +| `@crypt.fyi/theme` | Design tokens, fonts and theme logic shared by web and extension (private, no build) | Encryption/decryption and key material live in `@crypt.fyi/core` and must stay client-side. The server stores ciphertext and verification hashes only — never plaintext secrets or raw keys/passwords. @@ -58,6 +59,10 @@ When adding or changing UI copy: 2. Update **every** locale file (`en`, `es`, `de`, `fr`, `zh`) 3. Register new languages in `index.ts` (`resources` + `supportedLanguages`) +## Theming + +Change colors, fonts, radii and theme behavior in `packages/theme`, not per package, so web and the extension stay in step. UI components are not shared: web uses React/shadcn and the extension settings page is plain HTML. + ## Coding norms - TypeScript everywhere; avoid `any`. Match existing Prettier/ESLint setup — do not restate style guides here. diff --git a/packages/extension/README.md b/packages/extension/README.md index 29836bb..8d2bbbf 100644 --- a/packages/extension/README.md +++ b/packages/extension/README.md @@ -13,6 +13,10 @@ This browser extension allows you to quickly encrypt and share text selections u Password defaults are intentionally not supported — use the web app when a password is required. +## Theme + +Settings page styling comes from [`@crypt.fyi/theme`](../theme/README.md), the same tokens, fonts and System/Light/Dark logic the web client uses. Its theme choice is stored separately from the web client because the two have different origins. + ## Development 1. Install dependencies: diff --git a/packages/extension/package.json b/packages/extension/package.json index cd2a7af..f15d06f 100644 --- a/packages/extension/package.json +++ b/packages/extension/package.json @@ -6,6 +6,7 @@ "type": "module", "dependencies": { "@crypt.fyi/core": "workspace:*", + "@crypt.fyi/theme": "workspace:*", "webextension-polyfill": "^0.12.0", "zod": "^4.1.5" }, diff --git a/packages/extension/src/options/index.html b/packages/extension/src/options/index.html index e9cf1b8..7fb8598 100644 --- a/packages/extension/src/options/index.html +++ b/packages/extension/src/options/index.html @@ -6,46 +6,128 @@ crypt.fyi settings -
-
-

Browser extension

-

crypt.fyi

-

+

+
+
+
+ +
+

crypt.fyi

+

Browser extension

+
+
+
+ + + +
+
+

Defaults used when you encrypt text from the context menu.

-
-
-

- Endpoints -

-