Skip to content

feat(editor): add Barebone, Matte, Protocol, Arcane, Studio themes#3417

Draft
danilowoz wants to merge 2 commits intocanaryfrom
claude/abstract-email-themes-HOVY7
Draft

feat(editor): add Barebone, Matte, Protocol, Arcane, Studio themes#3417
danilowoz wants to merge 2 commits intocanaryfrom
claude/abstract-email-themes-HOVY7

Conversation

@danilowoz
Copy link
Copy Markdown
Member

@danilowoz danilowoz commented Apr 24, 2026

Extracts the visual languages used by the demo email folders (apps/demo/emails/0{1..5}-*) into first-class editor themes, so the email-theming plugin can expose them alongside Basic and Minimal.

  • ThemeDef + buildThemePanels/buildThemeReset factory keeps each theme declarative (one config object → panel groups + reset styles).
  • Each theme captures body background, container padding/radius/border, heading scale (h1–h3) with letter-spacing and weight, paragraph, link decoration, image radius, button surface/padding/border, and code-block/inline-code tokens mirroring the Tailwind themes.
  • EDITOR_THEMES and RESET_THEMES maps now satisfy the broader EditorTheme union; theme resolution in extension.tsx uses a shared isKnownEditorTheme guard instead of hardcoded 'basic'|'minimal' checks.
  • applyStyleChange in the inspector document accepts any EditorTheme so user-picked themes flow through the override path.
  • Adds theme-config tests that assert every new theme registers all required panels and reset tokens.

Summary by cubic

Adds five new editor themes—Barebone, Matte, Protocol, Arcane, Studio—and exposes them alongside Basic and Minimal. The example page now lets you switch between all built-in themes with broader sample content and updated copy.

  • New Features

    • Added Barebone, Matte, Protocol, Arcane, Studio themes with body/container/typography/link/image/button/code tokens.
    • Declarative setup via ThemeDef, buildThemePanels, and buildThemeReset.
    • Updated the web example to toggle between Basic, Minimal, Barebone, Matte, Protocol, Arcane, Studio, and Custom; added a button and extra headings; refreshed metadata/descriptions.
  • Refactors

    • Expanded EditorTheme and updated EDITOR_THEMES/RESET_THEMES.
    • Replaced hardcoded checks with isKnownEditorTheme in extension.tsx.
    • Inspector applyStyleChange accepts any EditorTheme.

Written for commit aef43e3. Summary will update on new commits.

Extracts the visual languages used by the demo email folders
(apps/demo/emails/0{1..5}-*) into first-class editor themes, so the
email-theming plugin can expose them alongside Basic and Minimal.

- ThemeDef + buildThemePanels/buildThemeReset factory keeps each theme
  declarative (one config object → panel groups + reset styles).
- Each theme captures body background, container padding/radius/border,
  heading scale (h1–h3) with letter-spacing and weight, paragraph,
  link decoration, image radius, button surface/padding/border, and
  code-block/inline-code tokens mirroring the Tailwind themes.
- EDITOR_THEMES and RESET_THEMES maps now satisfy the broader EditorTheme
  union; theme resolution in extension.tsx uses a shared
  isKnownEditorTheme guard instead of hardcoded 'basic'|'minimal' checks.
- applyStyleChange in the inspector document accepts any EditorTheme so
  user-picked themes flow through the override path.
- Adds theme-config tests that assert every new theme registers all
  required panels and reset tokens.
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 24, 2026

⚠️ No Changeset found

Latest commit: aef43e3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
react-email Ready Ready Preview, Comment Apr 24, 2026 10:32am
react-email-demo Ready Ready Preview, Comment Apr 24, 2026 10:32am

Request Review

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 24, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@react-email/editor@3417

commit: aef43e3

Extends the existing /editor/email-theming example so reviewers can
switch between Basic, Minimal, the five new themes (Barebone, Matte,
Protocol, Arcane, Studio), and a Custom example side-by-side, using the
same editable content for each. Updates the sample document to include
a button (to exercise button theming) and broader heading coverage.

Also refreshes the index description and page metadata to list all
available themes.
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 5 files

Confidence score: 3/5

  • There is moderate regression risk: in packages/editor/src/plugins/email-theming/extension.tsx, theme validation uses in, which can match inherited keys and may allow invalid non-theme strings through validation.
  • packages/editor/src/plugins/email-theming/themes.ts introduces container.borderWidth values that are not wired into panel input generation or style reset logic, so some theme settings (like matte/studio borders) won’t actually apply for users.
  • Given one medium-severity validation flaw and one concrete behavior gap, this looks mergeable with caution but not fully low-risk until these are addressed.
  • Pay close attention to packages/editor/src/plugins/email-theming/extension.tsx and packages/editor/src/plugins/email-theming/themes.ts - validation strictness and missing container.borderWidth plumbing are the main user-visible risks.

Shadow auto-approve: would not auto-approve because issues were found.

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/editor/src/plugins/email-theming/extension.tsx">

<violation number="1" location="packages/editor/src/plugins/email-theming/extension.tsx:231">
P2: Theme validation is too permissive because `in` accepts inherited object keys; use an own-key check to avoid accepting non-theme strings.</violation>
</file>

<file name="packages/editor/src/plugins/email-theming/themes.ts">

<violation number="1" location="packages/editor/src/plugins/email-theming/themes.ts:646">
P2: `container.borderWidth` is currently dead config: it is declared and set in new theme defs, but never used to generate panel inputs or reset styles, so themes that specify container borders (e.g. matte/studio) won’t actually render that border width.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

}

function isKnownEditorTheme(value: unknown): value is EditorTheme {
return typeof value === 'string' && value in EDITOR_THEMES;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Theme validation is too permissive because in accepts inherited object keys; use an own-key check to avoid accepting non-theme strings.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/editor/src/plugins/email-theming/extension.tsx, line 231:

<comment>Theme validation is too permissive because `in` accepts inherited object keys; use an own-key check to avoid accepting non-theme strings.</comment>

<file context>
@@ -227,6 +227,10 @@ export function setGlobalCssInjected(editor: Editor, css: string): boolean {
 }
 
+function isKnownEditorTheme(value: unknown): value is EditorTheme {
+  return typeof value === 'string' && value in EDITOR_THEMES;
+}
+
</file context>
Suggested change
return typeof value === 'string' && value in EDITOR_THEMES;
return typeof value === 'string' && Object.hasOwn(EDITOR_THEMES, value);

padding: [number, number, number, number];
borderRadius: number;
borderColor: string;
borderWidth: number;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: container.borderWidth is currently dead config: it is declared and set in new theme defs, but never used to generate panel inputs or reset styles, so themes that specify container borders (e.g. matte/studio) won’t actually render that border width.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/editor/src/plugins/email-theming/themes.ts, line 646:

<comment>`container.borderWidth` is currently dead config: it is declared and set in new theme defs, but never used to generate panel inputs or reset styles, so themes that specify container borders (e.g. matte/studio) won’t actually render that border width.</comment>

<file context>
@@ -618,6 +619,859 @@ const THEME_MINIMAL: PanelGroup[] = [
+    padding: [number, number, number, number];
+    borderRadius: number;
+    borderColor: string;
+    borderWidth: number;
+  };
+  h1: HeadingDef;
</file context>

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 3 files (changes from recent commits).

Shadow auto-approve: would not auto-approve. Auto-approval blocked by 2 unresolved issues from previous reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants