Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

refactor(themes): migrate default and neutral themes to defineTheme (#512)

Cindy Zhang39a770bfe972
diff --git a/.claude/commands/create-theme.md b/.claude/commands/create-theme.md
index 12f99df735..38e3cbeff1 100644
--- a/.claude/commands/create-theme.md
+++ b/.claude/commands/create-theme.md
@@ -1,6 +1,6 @@
# Create XDS Theme
-Create a new XDS theme following established patterns.
+Create a new XDS theme using `defineTheme`.
## Theme Name
@@ -8,230 +8,154 @@ $ARGUMENTS
## Instructions
-Create a new theme file at `/packages/core/src/theme/{themeName}Theme.stylex.ts`.
+Create a new theme package at `packages/themes/{themeName}/`.
-### Theme File Template
+### File Structure
-```tsx
-/**
- * {ThemeName} Theme
- *
- * Description of this theme's visual style.
- *
- * Inspired by: [source if applicable]
- */
-
-import * as stylex from '@stylexjs/stylex';
-import {
- colorTokens,
- elevationTokens,
- spacingTokens,
- radiusTokens,
- transitionTokens,
- typographyTokens,
-} from './tokens.stylex';
-import type { Theme } from './types';
-
-// =============================================================================
-// Color Theme
-// =============================================================================
-// Use light-dark() for automatic light/dark mode switching.
-// Format: 'light-dark(lightValue, darkValue)'
-
-const colorTheme = stylex.createTheme(colorTokens, {
- // Core semantic
- accent: 'light-dark(#YOUR_LIGHT, #YOUR_DARK)',
- accentDeemphasized: 'light-dark(#YOUR_LIGHT33, #YOUR_DARK3F)',
- accentText: 'light-dark(#YOUR_LIGHT, #YOUR_DARK)',
- surface: 'light-dark(#FFFFFF, #1C1C1C)',
- wash: 'light-dark(#F5F5F5, #121212)',
- overlay: 'light-dark(#00000066, #00000099)',
- hoverOverlay: 'light-dark(#0000000C, #FFFFFF0C)',
- pressedOverlay: 'light-dark(#00000019, #FFFFFF19)',
- focusOutline: 'light-dark(#YOUR_LIGHT, #YOUR_DARK)',
- deemphasized: 'light-dark(#0000000C, #FFFFFF0C)',
-
- // Text
- textPrimary: 'light-dark(#171717, #FAFAFA)',
- textSecondary: 'light-dark(#737373, #A3A3A3)',
- textDisabled: 'light-dark(#A3A3A3, #525252)',
- textLink: 'light-dark(#YOUR_LIGHT, #YOUR_DARK)',
- textPlaceholder: 'light-dark(#737373, #A3A3A3)',
-
- // Icon
- iconPrimary: 'light-dark(#171717, #FAFAFA)',
- iconSecondary: 'light-dark(#737373, #A3A3A3)',
- iconTertiary: 'light-dark(#A3A3A3, #737373)',
- iconDisabled: 'light-dark(#D4D4D4, #525252)',
-
- // Surface variants
- card: 'light-dark(#FFFFFF, #262626)',
- popover: 'light-dark(#FFFFFF, #262626)',
- navbar: 'light-dark(#FFFFFF, #171717)',
-
- // Status/Sentiment
- positive: 'light-dark(#22C55E, #22C55E)',
- positiveDeemphasized: 'light-dark(#22C55E33, #22C55E3F)',
- negative: 'light-dark(#EF4444, #EF4444)',
- negativeDeemphasized: 'light-dark(#EF444433, #EF44443F)',
- warning: 'light-dark(#F59E0B, #F59E0B)',
- warningDeemphasized: 'light-dark(#F59E0B33, #F59E0B3F)',
- educational: 'light-dark(#8B5CF6, #8B5CF6)',
- educationalDeemphasized: 'light-dark(#8B5CF633, #8B5CF63F)',
-
- // Divider
- divider: 'light-dark(#E5E5E5, #404040)',
- dividerHighContrast: 'light-dark(#A3A3A3, #737373)',
- dividerEmphasized: 'light-dark(#D4D4D4, #525252)',
-
- // Disabled/Effects
- disabledOverlay: 'light-dark(#FFFFFF7F, #1717177F)',
- glimmer: 'light-dark(#E5E5E5, #404040)',
- glimmerHighContrast: 'light-dark(#D4D4D4, #525252)',
- shadowElevation: 'light-dark(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.5))',
-
- // Literal color sets (customize as needed)
- blueBackground: 'light-dark(#3B82F633, #3B82F633)',
- blueBorder: 'light-dark(#3B82F6, #60A5FA)',
- blueIcon: 'light-dark(#3B82F6, #60A5FA)',
- blueText: 'light-dark(#1D4ED8, #93C5FD)',
-
- // ... add other color sets as needed
-});
-
-// =============================================================================
-// Elevation Theme
-// =============================================================================
-
-const elevationTheme = stylex.createTheme(elevationTokens, {
- base: 'light-dark(0px 0px 1px rgba(0, 0, 0, 0.1), 0px 0px 1px rgba(0, 0, 0, 0.3))',
- thumb: 'light-dark(0 1px 3px rgba(0, 0, 0, 0.2), 0 1px 3px rgba(0, 0, 0, 0.4))',
- dialog: 'light-dark(0px 2px 2px rgba(0, 0, 0, 0.1), 0px 8px 24px rgba(0, 0, 0, 0.1), 0px 2px 2px rgba(0, 0, 0, 0.2), 0px 8px 24px rgba(0, 0, 0, 0.3))',
- hover: 'light-dark(0px 1px 2px rgba(0, 0, 0, 0.1), 0px 2px 12px rgba(0, 0, 0, 0.1), 0px 1px 2px rgba(0, 0, 0, 0.2), 0px 2px 12px rgba(0, 0, 0, 0.2))',
- menu: 'light-dark(0px 1px 1px rgba(0, 0, 0, 0.1), 0px 2px 8px rgba(0, 0, 0, 0.1), 0px 1px 1px rgba(0, 0, 0, 0.2), 0px 2px 8px rgba(0, 0, 0, 0.2))',
-});
-
-// =============================================================================
-// Spacing Theme (optional - inherit from default if unchanged)
-// =============================================================================
-
-const spacingTheme = stylex.createTheme(spacingTokens, {
- space0: '0px',
- space0_5: '2px',
- space1: '4px',
- space2: '8px',
- space3: '12px',
- space4: '16px',
- space5: '20px',
- space6: '24px',
- space7: '32px',
-});
-
-// =============================================================================
-// Radius Theme (optional - customize for different feel)
-// =============================================================================
-
-const radiusTheme = stylex.createTheme(radiusTokens, {
- rounded: '9999px',
- container: '12px',
- element: '8px',
- content: '4px',
-});
-
-// =============================================================================
-// Transition Theme
-// =============================================================================
-
-const transitionTheme = stylex.createTheme(transitionTokens, {
- fast: '0.15s ease',
- normal: '0.2s ease',
-});
+```
+packages/themes/{themeName}/
+├── package.json
+└── src/
+ └── index.ts
+```
-// =============================================================================
-// Typography Theme
-// =============================================================================
+### package.json
+
+```json
+{
+ "name": "@xds/theme-{themeName}",
+ "version": "0.0.1",
+ "private": false,
+ "description": "{Description} theme for XDS",
+ "license": "MIT",
+ "sideEffects": false,
+ "main": "./src/index.ts",
+ "types": "./src/index.ts",
+ "exports": {
+ ".": "./src/index.ts",
+ "./theme.css": "./dist/theme.css"
+ },
+ "files": ["dist", "src"],
+ "scripts": {
+ "build:theme": "xds build-theme src/index.ts -o dist/theme.css"
+ },
+ "peerDependencies": {
+ "@xds/core": "*"
+ },
+ "devDependencies": {
+ "@xds/cli": "*"
+ }
+}
+```
-const typographyTheme = stylex.createTheme(typographyTokens, {
- fontFamilyBody: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',
- fontFamilyCode: '"SF Mono", Monaco, Consolas, monospace',
- fontFamilyHeading: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',
-});
+### Theme File (src/index.ts)
-// =============================================================================
-// Theme Export
-// =============================================================================
+```tsx
+import {defineTheme} from '@xds/core/theme';
-export const {themeName}Theme: Theme = {
+export const {themeName}Theme = defineTheme({
name: '{themeName}',
- colorTheme,
- elevationTheme,
- spacingTheme,
- radiusTheme,
- transitionTheme,
- typographyTheme,
-};
-```
-
-### Export from index.ts
-Add to `/packages/core/src/theme/index.ts`:
-
-```tsx
-export { {themeName}Theme } from './{themeName}Theme.stylex';
+ tokens: {
+ // Colors — use [light, dark] tuples for automatic light-dark() conversion
+ '--color-accent': ['#YOUR_LIGHT', '#YOUR_DARK'],
+ '--color-accent-deemphasized': ['#YOUR_LIGHT33', '#YOUR_DARK3F'],
+ '--color-surface': ['#FFFFFF', '#1C1C1C'],
+ '--color-wash': ['#F5F5F5', '#121212'],
+
+ // Radius — customize for different feel
+ '--radius-container': '12px',
+ '--radius-element': '8px',
+ '--radius-content': '4px',
+
+ // Typography — font families
+ '--font-body': '-apple-system, BlinkMacSystemFont, sans-serif',
+ '--font-heading': '-apple-system, BlinkMacSystemFont, sans-serif',
+ '--font-code': '"SF Mono", Monaco, Consolas, monospace',
+
+ // Only include tokens you want to override.
+ // See packages/core/src/theme/tokens.stylex.ts for all available tokens.
+ },
+
+ components: {
+ // Component style overrides using CSS class selectors
+ // Keys: 'base' for all instances, 'prop:value' for variants
+ button: {
+ base: { fontWeight: '600' },
+ 'variant:secondary': { backgroundColor: 'rgba(0,0,0,0.06)' },
+ },
+ heading: {
+ 'level:1': {
+ fontFamily: 'var(--font-heading)',
+ fontSize: 'var(--text-2xl)',
+ fontWeight: 'var(--font-weight-semibold)',
+ lineHeight: '1.2',
+ color: 'var(--color-text-primary)',
+ margin: '0',
+ },
+ // ... levels 2-6
+ },
+ text: {
+ 'type:body': {
+ fontFamily: 'var(--font-body)',
+ fontSize: 'var(--text-base)',
+ fontWeight: 'var(--font-weight-normal)',
+ lineHeight: 'var(--leading-base)',
+ color: 'var(--color-text-primary)',
+ margin: '0',
+ },
+ // ... other types: large, label, supporting, code
+ },
+ },
+
+ // Optional: icon registry (import from a separate icons file)
+ // icons: myIconRegistry,
+});
```
## Key Concepts
-### light-dark() Function
-
-All color values use CSS `light-dark()` for automatic mode switching:
+### Token Values
-```tsx
-accent: 'light-dark(#0064E0, #2694FE)',
-// ^ light ^ dark
-```
+- **String**: Used as-is for both light and dark modes
+- **[light, dark] tuple**: Converted to CSS `light-dark(light, dark)`
-The Theme provider sets `color-scheme` to control which value is used.
+### Component Override Keys
-### Token Categories
+- `base` — styles applied to all instances
+- `prop:value` — styles when a visual prop matches (e.g. `variant:secondary`)
+- `prop:value+prop:value` — intersection of multiple props (e.g. `variant:editorial+level:1`)
-| Category | Purpose |
-|----------|---------|
-| `colorTokens` | All colors including semantic, text, icon, status, dividers |
-| `elevationTokens` | Box shadows for different elevation levels |
-| `spacingTokens` | Consistent spacing scale |
-| `radiusTokens` | Border radius for different contexts |
-| `transitionTokens` | Animation durations |
-| `typographyTokens` | Font families |
+### CSS Output
-### Minimal Theme (Extending Default)
+Component overrides generate scoped CSS:
-If you only need to change colors, you can spread the default theme:
-
-```tsx
-import { defaultTheme } from './defaultTheme.stylex';
+```css
+@scope ([data-xds-theme="{themeName}"]) to ([data-xds-theme]) {
+ .xds-button.secondary {
+ background-color: ...;
+ }
+ .xds-heading.level-1 {
+ font-size: var(--text-2xl);
+ }
+}
+```
-const colorTheme = stylex.createTheme(colorTokens, {
- // Only override what you need
- accent: 'light-dark(#YOUR_COLOR, #YOUR_DARK)',
- // ...
-});
+### Distribution
-export const myTheme: Theme = {
- ...defaultTheme,
- name: 'myTheme',
- colorTheme,
-};
-```
+- **Unbuilt**: `XDSTheme` generates CSS and injects `<style>` at runtime
+- **Built**: `npx xds build-theme` pre-compiles to a CSS file
## Reference
See existing themes for examples:
-- `/packages/core/src/theme/defaultTheme.stylex.ts` - Complete reference theme
-- `/packages/core/src/theme/neutralTheme.stylex.ts` - Grayscale theme with custom typography
+
+- `packages/themes/default/src/defaultTheme.ts` — Complete reference theme
+- `packages/themes/neutral/src/neutralTheme.ts` — Grayscale theme with Geist font
+- `packages/themes/brutalist/src/index.ts` — Minimal showcase theme
## After Creation
-1. Run `yarn workspace @xds/core build` to verify the build
-2. Add theme to Storybook preview for testing: `/apps/storybook/.storybook/preview.tsx`
+1. Add to workspace in root `package.json` if needed
+2. Add theme to Storybook preview: `apps/storybook/.storybook/preview.tsx`
3. Test in both light and dark modes
diff --git a/package.json b/package.json
index 4d63d4d8ae..fafd97e02c 100644
--- a/package.json
+++ b/package.json
@@ -9,7 +9,7 @@
"internal/*"
],
"scripts": {
- "build": "yarn workspace @xds/core build && yarn workspace @xds/theme-default build && yarn workspace @xds/theme-neutral build",
+ "build": "yarn workspace @xds/core build && yarn workspace @xds/theme-default build && yarn workspace @xds/theme-neutral build && yarn workspace @xds/theme-brutalist build",
"dev": "yarn workspace @xds/storybook dev",
"test": "vitest run",
"test:watch": "vitest",
diff --git a/packages/core/src/Text/XDSHeading.tsx b/packages/core/src/Text/XDSHeading.tsx
index 75d21d7f08..92a8f34f7e 100644
--- a/packages/core/src/Text/XDSHeading.tsx
+++ b/packages/core/src/Text/XDSHeading.tsx
@@ -279,7 +279,7 @@ export const XDSHeading = forwardRef<HTMLHeadingElement, XDSHeadingProps>(
<Component
ref={mergedRef}
{...mergeProps(
- xdsClassName('heading', {level}),
+ xdsClassName('heading', {variant, level}),
stylex.props(
levelStyle,
colorStyles[color],
diff --git a/packages/core/src/theme/types.ts b/packages/core/src/theme/types.ts
index 3637058158..a758507a19 100644
--- a/packages/core/src/theme/types.ts
+++ b/packages/core/src/theme/types.ts
@@ -169,6 +169,9 @@ export interface ComponentStyles {
* Theme styles - StyleX styles that set CSS variables.
* All fields are optional — omitted groups use the defineVars defaults
* from tokens.stylex.ts, enabling partial theme overrides.
+ *
+ * @deprecated Use `defineTheme()` from `@xds/core/theme` instead.
+ * StyleX-based themes are being replaced by CSS-based theming.
*/
export interface ThemeStyles {
/** Color CSS variables */
@@ -197,6 +200,8 @@ export interface ThemeStyles {
* Raw token values for programmatic access.
* Useful for charting libraries, theme editors, or parsing light-dark() values.
* All fields are optional — partial themes only include overridden groups.
+ *
+ * @deprecated Use `defineTheme()` — token values are accessible via `theme.tokens`.
*/
export interface ThemeRaw {
colors?: Record<string, string>;
@@ -212,7 +217,11 @@ export interface ThemeRaw {
}
/**
- * Theme object - pre-compiled StyleX styles that set CSS variables
+ * Theme object - pre-compiled StyleX styles that set CSS variables.
+ *
+ * @deprecated Use `defineTheme()` from `@xds/core/theme` to create themes.
+ * The `XDSDefinedTheme` type replaces this interface. All shipped themes
+ * (default, neutral, brutalist) now use `defineTheme()`.
*/
export interface Theme {
/** Theme name */
diff --git a/packages/themes/brutalist/package.json b/packages/themes/brutalist/package.json
index aff74bc04b..d5be23222e 100644
--- a/packages/themes/brutalist/package.json
+++ b/packages/themes/brutalist/package.json
@@ -16,7 +16,7 @@
"src"
],
"scripts": {
- "build:theme": "xds build-theme src/index.ts -o dist/theme.css"
+ "build": "xds build-theme src/index.ts -o dist/theme.css"
},
"peerDependencies": {
"@xds/core": "*"
diff --git a/packages/themes/default/package.json b/packages/themes/default/package.json
index 9b33bf6f68..c6b8ec1407 100644
--- a/packages/themes/default/package.json
+++ b/packages/themes/default/package.json
@@ -5,15 +5,10 @@
"description": "Default theme for XDS components (Heroicons)",
"license": "MIT",
"sideEffects": false,
- "main": "./dist/index.js",
- "module": "./dist/index.mjs",
- "types": "./dist/index.d.ts",
+ "main": "./src/defaultTheme.ts",
+ "types": "./src/defaultTheme.ts",
"exports": {
- ".": {
- "types": "./dist/index.d.ts",
- "import": "./dist/index.mjs",
- "require": "./dist/index.js"
- },
+ ".": "./src/defaultTheme.ts",
"./theme.css": "./dist/theme.css"
},
"files": [
@@ -21,25 +16,16 @@
"src"
],
"scripts": {
- "build": "tsup",
- "dev": "tsup --watch",
- "build:css": "node ../../../scripts/build-theme-css.mjs packages/themes/default",
- "postbuild": "yarn build:css"
+ "build": "xds build-theme src/defaultTheme.ts -o dist/theme.css"
},
"dependencies": {
"@heroicons/react": "^2.2.0"
},
"peerDependencies": {
- "@stylexjs/stylex": ">=0.10.0",
"@xds/core": "*",
"react": ">=19"
},
"devDependencies": {
- "@babel/core": "^7.28.5",
- "@babel/preset-react": "^7.28.5",
- "@babel/preset-typescript": "^7.28.5",
- "@stylexjs/babel-plugin": "^0.17.4",
- "esbuild-plugin-babel": "^0.2.3",
- "tsup": "^8.3.0"
+ "@xds/cli": "*"
}
-}
\ No newline at end of file
+}
diff --git a/packages/themes/default/src/defaultTheme.stylex.ts b/packages/themes/default/src/defaultTheme.stylex.ts
deleted file mode 100644
index 02f0e2b5b2..0000000000
--- a/packages/themes/default/src/defaultTheme.stylex.ts
+++ /dev/null
@@ -1,394 +0,0 @@
-/**
- * XDS Default Theme
- *
- * The reference theme — provides all 10 token groups explicitly.
- * Uses CSS light-dark() for automatic light/dark mode switching.
- *
- * To create a custom theme:
- * 1. Copy this file
- * 2. Rename it (e.g., myBrandTheme.stylex.ts)
- * 3. Update only the values you want to change
- * 4. Remove token groups you don't override (they'll use defineVars defaults)
- * 5. Export from index.ts
- */
-
-import * as stylex from '@stylexjs/stylex';
-import type {ThemeType as Theme} from '@xds/core/theme';
-import {
- colorDefaults,
- spacingDefaults,
- sizeDefaults,
- radiusDefaults,
- elevationDefaults,
- transitionDefaults,
- typographyDefaults,
- textSizeDefaults,
- lineHeightDefaults,
- fontWeightDefaults,
- colorVars,
- spacingVars,
- sizeVars,
- radiusVars,
- elevationVars,
- transitionVars,
- typographyVars,
- textSizeVars,
- lineHeightVars,
- fontWeightVars,
-} from '@xds/core/theme/tokens.stylex';
-import {defaultIconRegistry} from './icons';
-
-// =============================================================================
-// Theme Overrides using createTheme
-// =============================================================================
-// The default theme's values are identical to the defineVars defaults.
-// We still create explicit themes so the default is a complete reference.
-
-const colorTheme = stylex.createTheme(colorVars, colorDefaults);
-
-const spacingTheme = stylex.createTheme(spacingVars, spacingDefaults);
-
-const sizeTheme = stylex.createTheme(sizeVars, sizeDefaults);
-
-const radiusTheme = stylex.createTheme(radiusVars, radiusDefaults);
-
-const elevationTheme = stylex.createTheme(elevationVars, elevationDefaults);
-
-const transitionTheme = stylex.createTheme(transitionVars, transitionDefaults);
-
-const typographyTheme = stylex.createTheme(typographyVars, typographyDefaults);
-
-const textSizeTheme = stylex.createTheme(textSizeVars, textSizeDefaults);
-
-const lineHeightTheme = stylex.createTheme(lineHeightVars, lineHeightDefaults);
-
-const fontWeightTheme = stylex.createTheme(fontWeightVars, fontWeightDefaults);
-
-// =============================================================================
-// Component Style Overrides
-// =============================================================================
-
-const buttonVariants = stylex.create({
- secondary: {
- backgroundColor:
- 'light-dark(rgba(5 ,54 ,89 ,0.1), rgba(223, 226, 229, 0.2))',
- },
-});
-
-/**
- * Semantic heading styles (h1-h6) - default variant
- * Uses XDS dense scale for internal tools
- */
-const headingStyles = stylex.create({
- // Default variant (dense scale for internal tools)
- h1: {
- fontFamily: typographyVars['--font-heading'],
- fontSize: textSizeVars['--text-2xl'], // 20px
- fontWeight: fontWeightVars['--font-weight-semibold'],
- lineHeight: 1.2, // 24px
- color: colorVars['--color-text-primary'],
- margin: 0,
- },
- h2: {
- fontFamily: typographyVars['--font-heading'],
- fontSize: textSizeVars['--text-xl'], // 18px
- fontWeight: fontWeightVars['--font-weight-semibold'],
- lineHeight: 1.3333333333333333, // 24px
- color: colorVars['--color-text-primary'],
- margin: 0,
- },
- h3: {
- fontFamily: typographyVars['--font-heading'],
- fontSize: textSizeVars['--text-lg'], // 16px
- fontWeight: fontWeightVars['--font-weight-semibold'],
- lineHeight: 1.25, // 20px
- color: colorVars['--color-text-primary'],
- margin: 0,
- },
- h4: {
- fontFamily: typographyVars['--font-heading'],
- fontSize: textSizeVars['--text-base'], // 14px
- fontWeight: fontWeightVars['--font-weight-semibold'],
- lineHeight: lineHeightVars['--leading-base'], // 20px
- color: colorVars['--color-text-primary'],
- margin: 0,
- },
- h5: {
- fontFamily: typographyVars['--font-heading'],
- fontSize: textSizeVars['--text-base'], // 14px (same as h4)
- fontWeight: fontWeightVars['--font-weight-semibold'],
- lineHeight: lineHeightVars['--leading-base'], // 20px
- color: colorVars['--color-text-primary'],
- margin: 0,
- },
- h6: {
- fontFamily: typographyVars['--font-heading'],
- fontSize: textSizeVars['--text-xsm'], // 12px
- fontWeight: fontWeightVars['--font-weight-semibold'],
- lineHeight: 1.3333333333333333, // 16px
- color: colorVars['--color-text-primary'],
- margin: 0,
- },
-});
-
-/**
- * Editorial heading styles (h1-h4) - larger scale for content-heavy pages
- */
-const headingEditorialStyles = stylex.create({
- h1: {
- fontFamily: typographyVars['--font-heading'],
- fontSize: textSizeVars['--text-4xl'], // 32px
- fontWeight: fontWeightVars['--font-weight-semibold'],
- lineHeight: 1.5, // 48px
- color: colorVars['--color-text-primary'],
- margin: 0,
- },
- h2: {
- fontFamily: typographyVars['--font-heading'],
- fontSize: textSizeVars['--text-3xl'], // 24px
- fontWeight: fontWeightVars['--font-weight-semibold'],
- lineHeight: 1.3333333333333333, // 32px
- color: colorVars['--color-text-primary'],
- margin: 0,
- },
- h3: {
- fontFamily: typographyVars['--font-heading'],
- fontSize: textSizeVars['--text-2xl'], // 20px
- fontWeight: fontWeightVars['--font-weight-semibold'],
- lineHeight: 1.4, // 28px
- color: colorVars['--color-text-primary'],
- margin: 0,
- },
- h4: {
- fontFamily: typographyVars['--font-heading'],
- fontSize: textSizeVars['--text-lg'], // 16px
- fontWeight: fontWeightVars['--font-weight-semibold'],
- lineHeight: 1.5, // 24px
- color: colorVars['--color-text-primary'],
- margin: 0,
- },
- // h5 and h6 fall back to default variant
- h5: {
- fontFamily: typographyVars['--font-heading'],
- fontSize: textSizeVars['--text-base'], // 14px
- fontWeight: fontWeightVars['--font-weight-semibold'],
- lineHeight: lineHeightVars['--leading-base'], // 20px
- color: colorVars['--color-text-primary'],
- margin: 0,
- },
- h6: {
- fontFamily: typographyVars['--font-heading'],
- fontSize: textSizeVars['--text-xsm'], // 12px
- fontWeight: fontWeightVars['--font-weight-semibold'],
- lineHeight: 1.3333333333333333, // 16px
- color: colorVars['--color-text-primary'],
- margin: 0,
- },
-});
-
-/**
- * Semantic text styles for body content
- */
-const textStyles = stylex.create({
- /** Body text (14px, regular) - The bulk of content */
- body: {
- fontFamily: typographyVars['--font-heading'], // Optimistic
- fontSize: textSizeVars['--text-base'], // 14px
- fontWeight: fontWeightVars['--font-weight-normal'],
- lineHeight: lineHeightVars['--leading-base'], // 20px
- color: colorVars['--color-text-primary'],
- margin: 0,
- },
- /** Large body text (16px, regular) - Emphasized content, quotes */
- large: {
- fontFamily: typographyVars['--font-heading'], // Optimistic
- fontSize: textSizeVars['--text-lg'], // 16px
- fontWeight: fontWeightVars['--font-weight-normal'],
- lineHeight: 1.5, // 24px
- color: colorVars['--color-text-primary'],
- margin: 0,
- },
- /** Emphasized text (14px, medium) - Labels for form/chart/table columns */
- label: {
- fontFamily: typographyVars['--font-heading'], // Optimistic
- fontSize: textSizeVars['--text-base'], // 14px
- fontWeight: fontWeightVars['--font-weight-medium'],
- lineHeight: lineHeightVars['--leading-base'], // 20px
- color: colorVars['--color-text-primary'],
- margin: 0,
- },
- /** Supporting/helper text (12px, regular) - Supplemental info */
- supporting: {
- fontFamily: typographyVars['--font-heading'], // Optimistic
- fontSize: textSizeVars['--text-xsm'], // 12px
- fontWeight: fontWeightVars['--font-weight-normal'],
- lineHeight: 1.3333333333333333, // 16px
- color: colorVars['--color-text-secondary'],
- margin: 0,
- },
- /** Code/monospace text (14px, regular) */
- code: {
- fontFamily: typographyVars['--font-code'], // Menlo
- fontSize: textSizeVars['--text-base'], // 14px
- fontWeight: fontWeightVars['--font-weight-normal'],
- lineHeight: lineHeightVars['--leading-base'], // 20px
- color: colorVars['--color-text-primary'],
- margin: 0,
- },
-});
-
-/**
- * Prose base styles for XDSFontWrapper
- */
-const proseBaseStyles = stylex.create({
- base: {
- fontSize: textSizeVars['--text-base'], // 14px
- fontFamily: typographyVars['--font-body'],
- lineHeight: lineHeightVars['--leading-base'], // 20px
- color: colorVars['--color-text-primary'],
- },
-});
-
-/**
- * Prose element styles for XDSFontWrapper
- */
-const proseElementStyles = stylex.create({
- p: {
- marginTop: 0,
- marginBottom: spacingVars['--spacing-3'], // 12px
- },
- ul: {
- marginTop: 0,
- marginBottom: spacingVars['--spacing-3'], // 12px
- paddingInlineStart: spacingVars['--spacing-5'], // 20px
- },
- ol: {
- marginTop: 0,
- marginBottom: spacingVars['--spacing-3'], // 12px
- paddingInlineStart: spacingVars['--spacing-5'], // 20px
- },
- li: {
- marginBottom: spacingVars['--spacing-1'], // 4px
- },
- liLast: {
- marginBottom: 0,
- },
- blockquote: {
- marginTop: 0,
- marginBottom: spacingVars['--spacing-3'], // 12px
- marginInlineStart: 0,
- marginInlineEnd: 0,
- paddingInlineStart: spacingVars['--spacing-4'], // 16px
- borderInlineStartWidth: '3px',
- borderInlineStartStyle: 'solid',
- borderInlineStartColor: colorVars['--color-divider-emphasized'],
- color: colorVars['--color-text-secondary'],
- fontStyle: 'italic',
- },
- code: {
- fontFamily: typographyVars['--font-code'],
- fontSize: '0.9em',
- backgroundColor: colorVars['--color-wash'],
- paddingBlock: spacingVars['--spacing-0-5'], // 2px
- paddingInline: spacingVars['--spacing-1'], // 4px
- borderRadius: radiusVars['--radius-content'], // 4px
- },
- pre: {
- fontFamily: typographyVars['--font-code'],
- fontSize: textSizeVars['--text-sm'], // 13px
- lineHeight: 1.5,
- marginTop: 0,
- marginBottom: spacingVars['--spacing-3'], // 12px
- padding: spacingVars['--spacing-3'], // 12px
- backgroundColor: colorVars['--color-wash'],
- borderRadius: radiusVars['--radius-element'], // 8px
- overflow: 'auto',
- whiteSpace: 'pre',
- },
- preCode: {
- backgroundColor: 'transparent',
- padding: 0,
- borderRadius: 0,
- fontSize: 'inherit',
- },
- hr: {
- marginBlock: spacingVars['--spacing-4'], // 16px
- border: 'none',
- borderTopWidth: '1px',
- borderTopStyle: 'solid',
- borderTopColor: colorVars['--color-divider'],
- },
- strong: {
- fontWeight: fontWeightVars['--font-weight-semibold'],
- },
- em: {
- fontStyle: 'italic',
- },
- a: {
- color: colorVars['--color-text-link'],
- textDecoration: 'underline',
- textUnderlineOffset: '2px',
- },
- aHover: {
- textDecorationThickness: '2px',
- },
- firstChild: {
- marginTop: 0,
- },
- lastChild: {
- marginBottom: 0,
- },
-});
-
-// =============================================================================
-// Theme Export
-// =============================================================================
-
-export const defaultTheme: Theme = {
- name: 'default',
- icons: defaultIconRegistry,
- styles: {
- colors: colorTheme,
- spacing: spacingTheme,
- size: sizeTheme,
- radius: radiusTheme,
- elevation: elevationTheme,
- transition: transitionTheme,
- typography: typographyTheme,
- textSize: textSizeTheme,
- lineHeight: lineHeightTheme,
- fontWeight: fontWeightTheme,
- },
- raw: {
- colors: colorDefaults,
- spacing: spacingDefaults,
- size: sizeDefaults,
- radius: radiusDefaults,
- elevation: elevationDefaults,
- transition: transitionDefaults,
- typography: typographyDefaults,
- textSize: textSizeDefaults,
- lineHeight: lineHeightDefaults,
- fontWeight: fontWeightDefaults,
- },
- // Component style overrides — typed loosely here because ComponentStyles
- // is augmented by individual components via `declare module`. The theme
- // package doesn't import those components, so the augmentations aren't
- // visible at compile time. The types are enforced at the consumer site.
- components: {
- button: {
- variants: buttonVariants,
- },
- heading: {
- styles: headingStyles,
- editorialStyles: headingEditorialStyles,
- },
- text: {
- styles: textStyles,
- },
- prose: {
- base: proseBaseStyles.base,
- styles: proseElementStyles,
- },
- } as Theme['components'],
-};
diff --git a/packages/themes/default/src/defaultTheme.ts b/packages/themes/default/src/defaultTheme.ts
new file mode 100644
index 0000000000..8493c11eb1
--- /dev/null
+++ b/packages/themes/default/src/defaultTheme.ts
@@ -0,0 +1,189 @@
+/**
+ * XDS Default Theme
+ *
+ * The reference theme — provides the standard XDS visual language.
+ * Uses defineTheme for CSS-based theming (no StyleX build required for consumers).
+ *
+ * Token values use [light, dark] tuples for automatic light-dark() conversion.
+ * Only tokens that differ from the built-in defaults need to be specified,
+ * but the default theme is explicit as a reference.
+ *
+ * Component overrides use CSS class selectors:
+ * .xds-button.secondary { ... }
+ * .xds-heading.level-1 { ... }
+ */
+
+import {defineTheme} from '@xds/core/theme';
+import {defaultIconRegistry} from './icons';
+
+export const defaultTheme = defineTheme({
+ name: 'default',
+
+ // The default theme uses the built-in token defaults from tokens.stylex.ts.
+ // No token overrides needed — defineTheme fills in defaults automatically.
+ // See packages/core/src/theme/tokens.stylex.ts for all token values.
+ tokens: {},
+
+ components: {
+ // =========================================================================
+ // Button
+ // =========================================================================
+ button: {
+ 'variant:secondary': {
+ backgroundColor:
+ 'light-dark(rgba(5, 54, 89, 0.1), rgba(223, 226, 229, 0.2))',
+ },
+ },
+
+ // =========================================================================
+ // Heading — default variant (dense scale for internal tools)
+ // =========================================================================
+ heading: {
+ 'level:1': {
+ fontFamily: 'var(--font-heading)',
+ fontSize: 'var(--text-2xl)',
+ fontWeight: 'var(--font-weight-semibold)',
+ lineHeight: '1.2',
+ color: 'var(--color-text-primary)',
+ margin: '0',
+ },
+ 'level:2': {
+ fontFamily: 'var(--font-heading)',
+ fontSize: 'var(--text-xl)',
+ fontWeight: 'var(--font-weight-semibold)',
+ lineHeight: '1.333',
+ color: 'var(--color-text-primary)',
+ margin: '0',
+ },
+ 'level:3': {
+ fontFamily: 'var(--font-heading)',
+ fontSize: 'var(--text-lg)',
+ fontWeight: 'var(--font-weight-semibold)',
+ lineHeight: '1.25',
+ color: 'var(--color-text-primary)',
+ margin: '0',
+ },
+ 'level:4': {
+ fontFamily: 'var(--font-heading)',
+ fontSize: 'var(--text-base)',
+ fontWeight: 'var(--font-weight-semibold)',
+ lineHeight: 'var(--leading-base)',
+ color: 'var(--color-text-primary)',
+ margin: '0',
+ },
+ 'level:5': {
+ fontFamily: 'var(--font-heading)',
+ fontSize: 'var(--text-base)',
+ fontWeight: 'var(--font-weight-semibold)',
+ lineHeight: 'var(--leading-base)',
+ color: 'var(--color-text-primary)',
+ margin: '0',
+ },
+ 'level:6': {
+ fontFamily: 'var(--font-heading)',
+ fontSize: 'var(--text-xsm)',
+ fontWeight: 'var(--font-weight-semibold)',
+ lineHeight: '1.333',
+ color: 'var(--color-text-primary)',
+ margin: '0',
+ },
+ // Editorial variant — larger scale for content-heavy pages
+ 'variant:editorial+level:1': {
+ fontFamily: 'var(--font-heading)',
+ fontSize: 'var(--text-4xl)',
+ fontWeight: 'var(--font-weight-semibold)',
+ lineHeight: '1.5',
+ color: 'var(--color-text-primary)',
+ margin: '0',
+ },
+ 'variant:editorial+level:2': {
+ fontFamily: 'var(--font-heading)',
+ fontSize: 'var(--text-3xl)',
+ fontWeight: 'var(--font-weight-semibold)',
+ lineHeight: '1.333',
+ color: 'var(--color-text-primary)',
+ margin: '0',
+ },
+ 'variant:editorial+level:3': {
+ fontFamily: 'var(--font-heading)',
+ fontSize: 'var(--text-2xl)',
+ fontWeight: 'var(--font-weight-semibold)',
+ lineHeight: '1.4',
+ color: 'var(--color-text-primary)',
+ margin: '0',
+ },
+ 'variant:editorial+level:4': {
+ fontFamily: 'var(--font-heading)',
+ fontSize: 'var(--text-lg)',
+ fontWeight: 'var(--font-weight-semibold)',
+ lineHeight: '1.5',
+ color: 'var(--color-text-primary)',
+ margin: '0',
+ },
+ 'variant:editorial+level:5': {
+ fontFamily: 'var(--font-heading)',
+ fontSize: 'var(--text-base)',
+ fontWeight: 'var(--font-weight-semibold)',
+ lineHeight: 'var(--leading-base)',
+ color: 'var(--color-text-primary)',
+ margin: '0',
+ },
+ 'variant:editorial+level:6': {
+ fontFamily: 'var(--font-heading)',
+ fontSize: 'var(--text-xsm)',
+ fontWeight: 'var(--font-weight-semibold)',
+ lineHeight: '1.333',
+ color: 'var(--color-text-primary)',
+ margin: '0',
+ },
+ },
+
+ // =========================================================================
+ // Text — semantic text styles
+ // =========================================================================
+ text: {
+ 'type:body': {
+ fontFamily: 'var(--font-heading)',
+ fontSize: 'var(--text-base)',
+ fontWeight: 'var(--font-weight-normal)',
+ lineHeight: 'var(--leading-base)',
+ color: 'var(--color-text-primary)',
+ margin: '0',
+ },
+ 'type:large': {
+ fontFamily: 'var(--font-heading)',
+ fontSize: 'var(--text-lg)',
+ fontWeight: 'var(--font-weight-normal)',
+ lineHeight: '1.5',
+ color: 'var(--color-text-primary)',
+ margin: '0',
+ },
+ 'type:label': {
+ fontFamily: 'var(--font-heading)',
+ fontSize: 'var(--text-base)',
+ fontWeight: 'var(--font-weight-medium)',
+ lineHeight: 'var(--leading-base)',
+ color: 'var(--color-text-primary)',
+ margin: '0',
+ },
+ 'type:supporting': {
+ fontFamily: 'var(--font-heading)',
+ fontSize: 'var(--text-xsm)',
+ fontWeight: 'var(--font-weight-normal)',
+ lineHeight: '1.333',
+ color: 'var(--color-text-secondary)',
+ margin: '0',
+ },
+ 'type:code': {
+ fontFamily: 'var(--font-code)',
+ fontSize: 'var(--text-base)',
+ fontWeight: 'var(--font-weight-normal)',
+ lineHeight: 'var(--leading-base)',
+ color: 'var(--color-text-primary)',
+ margin: '0',
+ },
+ },
+ },
+
+ icons: defaultIconRegistry,
+});
diff --git a/packages/themes/default/src/index.ts b/packages/themes/default/src/index.ts
index af25f235a1..212cbc0ded 100644
--- a/packages/themes/default/src/index.ts
+++ b/packages/themes/default/src/index.ts
@@ -1,2 +1,2 @@
-export {defaultTheme} from './defaultTheme.stylex';
+export {defaultTheme} from './defaultTheme';
export {defaultIconRegistry} from './icons';
diff --git a/packages/themes/default/tsup.config.ts b/packages/themes/default/tsup.config.ts
deleted file mode 100644
index f3d2e313dd..0000000000
--- a/packages/themes/default/tsup.config.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-import {defineConfig} from 'tsup';
-import babel from 'esbuild-plugin-babel';
-import path from 'path';
-
-export default defineConfig({
- entry: ['src/index.ts'],
- format: ['cjs', 'esm'],
- dts: true,
- splitting: true,
- clean: true,
- external: ['react', 'react-dom', '@stylexjs/stylex', '@xds/core'],
- esbuildPlugins: [
- babel({
- filter: /\.[jt]sx?$/,
- config: {
- presets: [
- ['@babel/preset-react', {runtime: 'automatic'}],
- '@babel/preset-typescript',
- ],
- plugins: [
- [
- '@stylexjs/babel-plugin',
- {
- dev: false,
- runtimeInjection: false,
- genConditionalClasses: true,
- treeshakeCompensation: true,
- aliases: {
- '@xds/core/*': [
- path.join(__dirname, '..', '..', 'core', 'src', '*'),
- ],
- },
- unstable_moduleResolution: {
- type: 'commonJS',
- rootDir: path.resolve(__dirname, '../../..'),
- },
- },
- ],
- ],
- },
- }),
- ],
-});
diff --git a/packages/themes/neutral/package.json b/packages/themes/neutral/package.json
index 752fe151e5..302b755421 100644
--- a/packages/themes/neutral/package.json
+++ b/packages/themes/neutral/package.json
@@ -5,15 +5,10 @@
"description": "Neutral theme for XDS components (Lucide icons)",
"license": "MIT",
"sideEffects": false,
- "main": "./dist/index.js",
- "module": "./dist/index.mjs",
- "types": "./dist/index.d.ts",
+ "main": "./src/neutralTheme.ts",
+ "types": "./src/neutralTheme.ts",
"exports": {
- ".": {
- "types": "./dist/index.d.ts",
- "import": "./dist/index.mjs",
- "require": "./dist/index.js"
- },
+ ".": "./src/neutralTheme.ts",
"./theme.css": "./dist/theme.css"
},
"files": [
@@ -21,25 +16,16 @@
"src"
],
"scripts": {
- "build": "tsup",
- "dev": "tsup --watch",
- "build:css": "node ../../../scripts/build-theme-css.mjs packages/themes/neutral",
- "postbuild": "yarn build:css"
+ "build": "xds build-theme src/neutralTheme.ts -o dist/theme.css"
},
"dependencies": {
"lucide-react": "^0.575.0"
},
"peerDependencies": {
- "@stylexjs/stylex": ">=0.10.0",
"@xds/core": "*",
"react": ">=19"
},
"devDependencies": {
- "@babel/core": "^7.28.5",
- "@babel/preset-react": "^7.28.5",
- "@babel/preset-typescript": "^7.28.5",
- "@stylexjs/babel-plugin": "^0.17.4",
- "esbuild-plugin-babel": "^0.2.3",
- "tsup": "^8.3.0"
+ "@xds/cli": "*"
}
-}
\ No newline at end of file
+}
diff --git a/packages/themes/neutral/src/index.ts b/packages/themes/neutral/src/index.ts
index f71ddaf4c9..18b948ac80 100644
--- a/packages/themes/neutral/src/index.ts
+++ b/packages/themes/neutral/src/index.ts
@@ -1,2 +1,2 @@
-export {neutralTheme} from './neutralTheme.stylex';
+export {neutralTheme} from './neutralTheme';
export {neutralIconRegistry} from './icons';
diff --git a/packages/themes/neutral/src/neutralTheme.stylex.ts b/packages/themes/neutral/src/neutralTheme.stylex.ts
deleted file mode 100644
index 7916ed4284..0000000000
--- a/packages/themes/neutral/src/neutralTheme.stylex.ts
+++ /dev/null
@@ -1,470 +0,0 @@
-/**
- * Neutral Theme
- *
- * A grayscale theme with neutral colors and modern aesthetics.
- * Uses oklch color space for perceptually uniform colors.
- *
- * Only overrides token groups that differ from the defaults:
- * colors, radius, elevation, and typography.
- * Spacing, size, textSize, lineHeight, fontWeight, and transition
- * use the defineVars defaults automatically.
- */
-
-import * as stylex from '@stylexjs/stylex';
-import type {ThemeType as Theme} from '@xds/core/theme';
-import {
- colorVars,
- radiusVars,
- elevationVars,
- typographyVars,
- textSizeVars,
- lineHeightVars,
- fontWeightVars,
- spacingVars,
- colorDefaults,
- radiusDefaults,
- elevationDefaults,
- typographyDefaults,
-} from '@xds/core/theme/tokens.stylex';
-import {neutralIconRegistry} from './icons';
-
-// =============================================================================
-// Theme Overrides — only token groups that differ from defaults
-// =============================================================================
-
-const colorOverrides = {
- // Core semantic - neutral grayscale palette
- '--color-accent': 'light-dark(oklch(0.205 0 0), oklch(0.922 0 0))',
- '--color-accent-deemphasized':
- 'light-dark(oklch(0.97 0 0), oklch(0.269 0 0))',
- '--color-accent-text': 'light-dark(oklch(0.205 0 0), oklch(0.985 0 0))',
- '--color-surface': 'light-dark(oklch(1 0 0), oklch(0.145 0 0))',
- '--color-wash': 'light-dark(oklch(0.97 0 0), oklch(0.269 0 0))',
- '--color-overlay': 'light-dark(oklch(0 0 0 / 50%), oklch(0 0 0 / 80%))',
- '--color-hover-overlay': 'light-dark(oklch(0 0 0 / 5%), oklch(1 0 0 / 5%))',
- '--color-pressed-overlay':
- 'light-dark(oklch(0 0 0 / 10%), oklch(1 0 0 / 10%))',
- '--color-focus-outline': 'light-dark(oklch(0.708 0 0), oklch(0.556 0 0))',
- '--color-focus-outline-error': 'light-dark(#E3193B, #F5394F)',
- '--color-focus-outline-success': 'light-dark(#0D8626, #0D8626)',
- '--color-focus-outline-warning': 'light-dark(#F2C00B, #E9AF08)',
- '--color-deemphasized': 'light-dark(oklch(0.97 0 0), oklch(0.269 0 0))',
-
- // Text
- '--color-text-primary': 'light-dark(oklch(0.145 0 0), oklch(0.985 0 0))',
- '--color-text-secondary': 'light-dark(oklch(0.556 0 0), oklch(0.708 0 0))',
- '--color-text-disabled': 'light-dark(oklch(0.708 0 0), oklch(0.439 0 0))',
- '--color-text-link': 'light-dark(oklch(0.205 0 0), oklch(0.922 0 0))',
- '--color-text-placeholder': 'light-dark(oklch(0.556 0 0), oklch(0.556 0 0))',
- '--color-text-on-media': 'light-dark(oklch(1 0 0), oklch(0.145 0 0))',
-
- // Icon
- '--color-icon-primary': 'light-dark(oklch(0.145 0 0), oklch(0.985 0 0))',
- '--color-icon-secondary': 'light-dark(oklch(0.556 0 0), oklch(0.708 0 0))',
- '--color-icon-tertiary': 'light-dark(oklch(0.708 0 0), oklch(0.556 0 0))',
- '--color-icon-disabled': 'light-dark(oklch(0.708 0 0), oklch(0.439 0 0))',
- '--color-icon-on-media': 'light-dark(oklch(1 0 0), oklch(0.145 0 0))',
-
- // Surface variants
- '--color-card': 'light-dark(oklch(1 0 0), oklch(0.205 0 0))',
- '--color-popover': 'light-dark(oklch(1 0 0), oklch(0.269 0 0))',
- '--color-navbar': 'light-dark(oklch(0.985 0 0), oklch(0.205 0 0))',
-
- // Status/Sentiment
- '--color-positive': 'light-dark(oklch(0.6 0.15 145), oklch(0.7 0.15 145))',
- '--color-positive-deemphasized':
- 'light-dark(oklch(0.6 0.15 145 / 20%), oklch(0.7 0.15 145 / 20%))',
- '--color-negative':
- 'light-dark(oklch(0.577 0.245 27.325), oklch(0.704 0.191 22.216))',
- '--color-negative-deemphasized':
- 'light-dark(oklch(0.577 0.245 27.325 / 20%), oklch(0.704 0.191 22.216 / 20%))',
- '--color-warning':
- 'light-dark(oklch(0.828 0.189 84.429), oklch(0.769 0.188 70.08))',
- '--color-warning-deemphasized':
- 'light-dark(oklch(0.828 0.189 84.429 / 20%), oklch(0.769 0.188 70.08 / 20%))',
- '--color-educational':
- 'light-dark(oklch(0.488 0.243 264.376), oklch(0.627 0.265 303.9))',
- '--color-educational-deemphasized':
- 'light-dark(oklch(0.488 0.243 264.376 / 20%), oklch(0.627 0.265 303.9 / 20%))',
-
- // Divider
- '--color-divider': 'light-dark(oklch(0.922 0 0), oklch(1 0 0 / 10%))',
- '--color-divider-high-contrast':
- 'light-dark(oklch(0.708 0 0), oklch(0.556 0 0))',
- '--color-divider-emphasized': 'light-dark(oklch(0.85 0 0), oklch(0.371 0 0))',
-
- // Disabled/Effects
- '--color-disabled-overlay':
- 'light-dark(oklch(1 0 0 / 50%), oklch(0.145 0 0 / 50%))',
- '--color-glimmer': 'light-dark(oklch(0.922 0 0), oklch(0.371 0 0))',
- '--color-glimmer-high-contrast':
- 'light-dark(oklch(0.85 0 0), oklch(0.439 0 0))',
- '--color-shadow-elevation':
- 'light-dark(oklch(0 0 0 / 10%), oklch(0 0 0 / 30%))',
- '--color-hover-tint': 'light-dark(black, white)',
-
- // Literal color sets - Blue
- '--color-blue-background':
- 'light-dark(oklch(0.488 0.243 264.376 / 20%), oklch(0.488 0.243 264.376 / 20%))',
- '--color-blue-border':
- 'light-dark(oklch(0.488 0.243 264.376), oklch(0.488 0.243 264.376))',
- '--color-blue-icon':
- 'light-dark(oklch(0.488 0.243 264.376), oklch(0.488 0.243 264.376))',
- '--color-blue-text': 'light-dark(oklch(0.398 0.2 264), oklch(0.7 0.2 264))',
-
- // Cyan
- '--color-cyan-background':
- 'light-dark(oklch(0.6 0.118 184.704 / 20%), oklch(0.696 0.17 162.48 / 20%))',
- '--color-cyan-border':
- 'light-dark(oklch(0.6 0.118 184.704), oklch(0.696 0.17 162.48))',
- '--color-cyan-icon':
- 'light-dark(oklch(0.6 0.118 184.704), oklch(0.696 0.17 162.48))',
- '--color-cyan-text': 'light-dark(oklch(0.398 0.07 184), oklch(0.8 0.1 162))',
-
- // Gray
- '--color-gray-background':
- 'light-dark(oklch(0.922 0 0 / 50%), oklch(0.371 0 0 / 50%))',
- '--color-gray-border': 'light-dark(oklch(0.708 0 0), oklch(0.556 0 0))',
- '--color-gray-icon': 'light-dark(oklch(0.556 0 0), oklch(0.708 0 0))',
- '--color-gray-text': 'light-dark(oklch(0.145 0 0), oklch(0.985 0 0))',
-
- // Green
- '--color-green-background':
- 'light-dark(oklch(0.6 0.118 184.704 / 20%), oklch(0.696 0.17 162.48 / 20%))',
- '--color-green-border':
- 'light-dark(oklch(0.6 0.118 184.704), oklch(0.696 0.17 162.48))',
- '--color-green-icon':
- 'light-dark(oklch(0.6 0.118 184.704), oklch(0.696 0.17 162.48))',
- '--color-green-text': 'light-dark(oklch(0.398 0.07 184), oklch(0.8 0.1 162))',
-
- // Orange
- '--color-orange-background':
- 'light-dark(oklch(0.646 0.222 41.116 / 20%), oklch(0.645 0.246 16.439 / 20%))',
- '--color-orange-border':
- 'light-dark(oklch(0.646 0.222 41.116), oklch(0.645 0.246 16.439))',
- '--color-orange-icon':
- 'light-dark(oklch(0.646 0.222 41.116), oklch(0.645 0.246 16.439))',
- '--color-orange-text': 'light-dark(oklch(0.5 0.18 41), oklch(0.8 0.2 16))',
-
- // Pink
- '--color-pink-background':
- 'light-dark(oklch(0.627 0.265 303.9 / 20%), oklch(0.627 0.265 303.9 / 20%))',
- '--color-pink-border':
- 'light-dark(oklch(0.627 0.265 303.9), oklch(0.627 0.265 303.9))',
- '--color-pink-icon':
- 'light-dark(oklch(0.627 0.265 303.9), oklch(0.627 0.265 303.9))',
- '--color-pink-text': 'light-dark(oklch(0.5 0.2 303), oklch(0.8 0.2 303))',
-
- // Purple
- '--color-purple-background':
- 'light-dark(oklch(0.627 0.265 303.9 / 20%), oklch(0.627 0.265 303.9 / 20%))',
- '--color-purple-border':
- 'light-dark(oklch(0.627 0.265 303.9), oklch(0.627 0.265 303.9))',
- '--color-purple-icon':
- 'light-dark(oklch(0.627 0.265 303.9), oklch(0.627 0.265 303.9))',
- '--color-purple-text': 'light-dark(oklch(0.5 0.2 303), oklch(0.8 0.2 303))',
-
- // Red
- '--color-red-background':
- 'light-dark(oklch(0.577 0.245 27.325 / 20%), oklch(0.704 0.191 22.216 / 20%))',
- '--color-red-border':
- 'light-dark(oklch(0.577 0.245 27.325), oklch(0.704 0.191 22.216))',
- '--color-red-icon':
- 'light-dark(oklch(0.577 0.245 27.325), oklch(0.704 0.191 22.216))',
- '--color-red-text': 'light-dark(oklch(0.45 0.2 27), oklch(0.85 0.15 22))',
-
- // Teal
- '--color-teal-background':
- 'light-dark(oklch(0.6 0.118 184.704 / 20%), oklch(0.696 0.17 162.48 / 20%))',
- '--color-teal-border':
- 'light-dark(oklch(0.6 0.118 184.704), oklch(0.696 0.17 162.48))',
- '--color-teal-icon':
- 'light-dark(oklch(0.6 0.118 184.704), oklch(0.696 0.17 162.48))',
- '--color-teal-text': 'light-dark(oklch(0.398 0.07 184), oklch(0.8 0.1 162))',
-
- // Yellow
- '--color-yellow-background':
- 'light-dark(oklch(0.828 0.189 84.429 / 20%), oklch(0.769 0.188 70.08 / 20%))',
- '--color-yellow-border':
- 'light-dark(oklch(0.828 0.189 84.429), oklch(0.769 0.188 70.08))',
- '--color-yellow-icon':
- 'light-dark(oklch(0.828 0.189 84.429), oklch(0.769 0.188 70.08))',
- '--color-yellow-text': 'light-dark(oklch(0.6 0.15 84), oklch(0.9 0.15 70))',
-} as const;
-
-const radiusOverrides = {
- '--radius-rounded': '9999px',
- '--radius-container': '0.75rem',
- '--radius-element': '0.625rem',
- '--radius-content': '0.375rem',
- '--radius-inner': '0.25rem',
-} as const;
-
-const elevationOverrides = {
- '--elevation-base':
- '0 1px 2px light-dark(oklch(0 0 0 / 5%), oklch(0 0 0 / 20%))',
- '--elevation-thumb':
- '0 1px 3px light-dark(oklch(0 0 0 / 10%), oklch(0 0 0 / 30%))',
- '--elevation-dialog':
- '0 4px 6px light-dark(oklch(0 0 0 / 10%), oklch(0 0 0 / 25%)), 0 12px 24px light-dark(oklch(0 0 0 / 15%), oklch(0 0 0 / 35%))',
- '--elevation-hover':
- '0 2px 4px light-dark(oklch(0 0 0 / 5%), oklch(0 0 0 / 15%)), 0 4px 12px light-dark(oklch(0 0 0 / 10%), oklch(0 0 0 / 20%))',
- '--elevation-menu':
- '0 2px 4px light-dark(oklch(0 0 0 / 5%), oklch(0 0 0 / 15%)), 0 4px 8px light-dark(oklch(0 0 0 / 10%), oklch(0 0 0 / 20%))',
- '--elevation-input-hover': 'inset 0px 0px 0px 2px rgba(1, 113, 227, 0.3)',
- '--elevation-input-hover-success':
- 'inset 0px 0px 0px 2px rgba(38, 167, 86, 0.3)',
- '--elevation-input-hover-warning':
- 'inset 0px 0px 0px 2px rgba(226, 164, 0, 0.3)',
- '--elevation-input-hover-error':
- 'inset 0px 0px 0px 2px rgba(227, 25, 59, 0.3)',
-} as const;
-
-const typographyOverrides = {
- '--font-body':
- 'Geist, "Geist Fallback", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',
- '--font-code': '"Geist Mono", "SF Mono", Monaco, Consolas, monospace',
- '--font-heading':
- 'Geist, "Geist Fallback", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',
-} as const;
-
-// =============================================================================
-// createTheme calls — only for overridden token groups
-// =============================================================================
-
-const colorTheme = stylex.createTheme(
- colorVars,
- colorOverrides as unknown as typeof colorDefaults,
-);
-
-const radiusTheme = stylex.createTheme(
- radiusVars,
- radiusOverrides as unknown as typeof radiusDefaults,
-);
-
-const elevationTheme = stylex.createTheme(
- elevationVars,
- elevationOverrides as unknown as typeof elevationDefaults,
-);
-
-const typographyTheme = stylex.createTheme(
- typographyVars,
- typographyOverrides as unknown as typeof typographyDefaults,
-);
-
-// =============================================================================
-// Component Style Overrides
-// =============================================================================
-
-const buttonVariants = stylex.create({
- primary: {
- color: 'light-dark(white, oklch(0.145 0 0))',
- },
- secondary: {
- borderWidth: '1px',
- borderStyle: 'solid',
- borderColor: colorVars['--color-divider'],
- },
-});
-
-const cardStyles = stylex.create({
- content: {
- '--layout-padding-inner-x': spacingVars['--spacing-3'],
- '--layout-padding-inner-y': spacingVars['--spacing-3'],
- '--layout-padding-outer-x': spacingVars['--spacing-3'],
- '--layout-padding-outer-y': spacingVars['--spacing-3'],
- },
-});
-
-const sectionStyles = stylex.create({
- content: {
- '--layout-padding-inner-x': spacingVars['--spacing-3'],
- '--layout-padding-inner-y': spacingVars['--spacing-3'],
- '--layout-padding-outer-x': spacingVars['--spacing-3'],
- '--layout-padding-outer-y': spacingVars['--spacing-3'],
- },
-});
-
-const headingStyles = stylex.create({
- h1: {
- fontFamily: typographyVars['--font-heading'],
- fontSize: textSizeVars['--text-2xl'],
- fontWeight: fontWeightVars['--font-weight-semibold'],
- lineHeight: 1.2,
- color: colorVars['--color-text-primary'],
- margin: 0,
- },
- h2: {
- fontFamily: typographyVars['--font-heading'],
- fontSize: textSizeVars['--text-xl'],
- fontWeight: fontWeightVars['--font-weight-semibold'],
- lineHeight: 1.3333333333333333,
- color: colorVars['--color-text-primary'],
- margin: 0,
- },
- h3: {
- fontFamily: typographyVars['--font-heading'],
- fontSize: textSizeVars['--text-lg'],
- fontWeight: fontWeightVars['--font-weight-bold'],
- lineHeight: 1.25,
- color: colorVars['--color-text-primary'],
- margin: 0,
- },
- h4: {
- fontFamily: typographyVars['--font-heading'],
- fontSize: textSizeVars['--text-base'],
- fontWeight: fontWeightVars['--font-weight-bold'],
- lineHeight: lineHeightVars['--leading-base'],
- color: colorVars['--color-text-primary'],
- margin: 0,
- },
- h5: {
- fontFamily: typographyVars['--font-heading'],
- fontSize: textSizeVars['--text-base'],
- fontWeight: fontWeightVars['--font-weight-semibold'],
- lineHeight: lineHeightVars['--leading-base'],
- color: colorVars['--color-text-primary'],
- margin: 0,
- },
- h6: {
- fontFamily: typographyVars['--font-heading'],
- fontSize: textSizeVars['--text-xsm'],
- fontWeight: fontWeightVars['--font-weight-semibold'],
- lineHeight: 1.3333333333333333,
- color: colorVars['--color-text-primary'],
- margin: 0,
- },
-});
-
-const headingEditorialStyles = stylex.create({
- h1: {
- fontFamily: typographyVars['--font-heading'],
- fontSize: textSizeVars['--text-4xl'],
- fontWeight: fontWeightVars['--font-weight-semibold'],
- lineHeight: 1.5,
- color: colorVars['--color-text-primary'],
- margin: 0,
- },
- h2: {
- fontFamily: typographyVars['--font-heading'],
- fontSize: textSizeVars['--text-3xl'],
- fontWeight: fontWeightVars['--font-weight-semibold'],
- lineHeight: 1.3333333333333333,
- color: colorVars['--color-text-primary'],
- margin: 0,
- },
- h3: {
- fontFamily: typographyVars['--font-heading'],
- fontSize: textSizeVars['--text-2xl'],
- fontWeight: fontWeightVars['--font-weight-bold'],
- lineHeight: 1.4,
- color: colorVars['--color-text-primary'],
- margin: 0,
- },
- h4: {
- fontFamily: typographyVars['--font-heading'],
- fontSize: textSizeVars['--text-lg'],
- fontWeight: fontWeightVars['--font-weight-bold'],
- lineHeight: 1.5,
- color: colorVars['--color-text-primary'],
- margin: 0,
- },
- h5: {
- fontFamily: typographyVars['--font-heading'],
- fontSize: textSizeVars['--text-base'],
- fontWeight: fontWeightVars['--font-weight-semibold'],
- lineHeight: lineHeightVars['--leading-base'],
- color: colorVars['--color-text-primary'],
- margin: 0,
- },
- h6: {
- fontFamily: typographyVars['--font-heading'],
- fontSize: textSizeVars['--text-xsm'],
- fontWeight: fontWeightVars['--font-weight-semibold'],
- lineHeight: 1.3333333333333333,
- color: colorVars['--color-text-primary'],
- margin: 0,
- },
-});
-
-const textStyles = stylex.create({
- body: {
- fontFamily: typographyVars['--font-body'],
- fontSize: textSizeVars['--text-base'],
- fontWeight: fontWeightVars['--font-weight-normal'],
- lineHeight: lineHeightVars['--leading-base'],
- color: colorVars['--color-text-primary'],
- margin: 0,
- },
- large: {
- fontFamily: typographyVars['--font-body'],
- fontSize: textSizeVars['--text-lg'],
- fontWeight: fontWeightVars['--font-weight-normal'],
- lineHeight: 1.5,
- color: colorVars['--color-text-primary'],
- margin: 0,
- },
- label: {
- fontFamily: typographyVars['--font-body'],
- fontSize: textSizeVars['--text-base'],
- fontWeight: fontWeightVars['--font-weight-medium'],
- lineHeight: lineHeightVars['--leading-base'],
- color: colorVars['--color-text-primary'],
- margin: 0,
- },
- supporting: {
- fontFamily: typographyVars['--font-body'],
- fontSize: textSizeVars['--text-xsm'],
- fontWeight: fontWeightVars['--font-weight-normal'],
- lineHeight: 1.3333333333333333,
- color: colorVars['--color-text-secondary'],
- margin: 0,
- },
- code: {
- fontFamily: typographyVars['--font-code'],
- fontSize: textSizeVars['--text-base'],
- fontWeight: fontWeightVars['--font-weight-normal'],
- lineHeight: lineHeightVars['--leading-base'],
- color: colorVars['--color-text-primary'],
- margin: 0,
- },
-});
-
-// =============================================================================
-// Theme Export
-// =============================================================================
-
-export const neutralTheme: Theme = {
- name: 'neutral',
- icons: neutralIconRegistry,
- styles: {
- colors: colorTheme,
- radius: radiusTheme,
- elevation: elevationTheme,
- typography: typographyTheme,
- },
- raw: {
- colors: colorOverrides,
- radius: radiusOverrides,
- elevation: elevationOverrides,
- typography: typographyOverrides,
- },
- components: {
- button: {
- variants: buttonVariants,
- },
- card: {
- content: cardStyles.content,
- },
- section: {
- content: sectionStyles.content,
- },
- heading: {
- styles: headingStyles,
- editorialStyles: headingEditorialStyles,
- },
- text: {
- styles: textStyles,
- },
- } as Theme['components'],
-};
diff --git a/packages/themes/neutral/src/neutralTheme.ts b/packages/themes/neutral/src/neutralTheme.ts
new file mode 100644
index 0000000000..0a4db0e1f7
--- /dev/null
+++ b/packages/themes/neutral/src/neutralTheme.ts
@@ -0,0 +1,479 @@
+/**
+ * Neutral Theme
+ *
+ * A grayscale theme with neutral colors and modern aesthetics.
+ * Uses oklch color space for perceptually uniform colors.
+ * Uses Geist font family for a clean, modern look.
+ *
+ * Only overrides tokens that differ from the defaults.
+ * Spacing, size, textSize, lineHeight, fontWeight, and transition
+ * use the built-in defaults automatically.
+ */
+
+import {defineTheme} from '@xds/core/theme';
+import {neutralIconRegistry} from './icons';
+
+export const neutralTheme = defineTheme({
+ name: 'neutral',
+
+ tokens: {
+ // =========================================================================
+ // Colors — neutral grayscale palette using oklch
+ // =========================================================================
+
+ // Core semantic
+ '--color-accent': ['oklch(0.205 0 0)', 'oklch(0.922 0 0)'],
+ '--color-accent-deemphasized': ['oklch(0.97 0 0)', 'oklch(0.269 0 0)'],
+ '--color-accent-text': ['oklch(0.205 0 0)', 'oklch(0.985 0 0)'],
+ '--color-surface': ['oklch(1 0 0)', 'oklch(0.145 0 0)'],
+ '--color-wash': ['oklch(0.97 0 0)', 'oklch(0.269 0 0)'],
+ '--color-overlay': ['oklch(0 0 0 / 50%)', 'oklch(0 0 0 / 80%)'],
+ '--color-hover-overlay': ['oklch(0 0 0 / 5%)', 'oklch(1 0 0 / 5%)'],
+ '--color-pressed-overlay': ['oklch(0 0 0 / 10%)', 'oklch(1 0 0 / 10%)'],
+ '--color-focus-outline': ['oklch(0.708 0 0)', 'oklch(0.556 0 0)'],
+ '--color-focus-outline-error': ['#E3193B', '#F5394F'],
+ '--color-focus-outline-success': ['#0D8626', '#0D8626'],
+ '--color-focus-outline-warning': ['#F2C00B', '#E9AF08'],
+ '--color-deemphasized': ['oklch(0.97 0 0)', 'oklch(0.269 0 0)'],
+
+ // Text
+ '--color-text-primary': ['oklch(0.145 0 0)', 'oklch(0.985 0 0)'],
+ '--color-text-secondary': ['oklch(0.556 0 0)', 'oklch(0.708 0 0)'],
+ '--color-text-disabled': ['oklch(0.708 0 0)', 'oklch(0.439 0 0)'],
+ '--color-text-link': ['oklch(0.205 0 0)', 'oklch(0.922 0 0)'],
+ '--color-text-placeholder': ['oklch(0.556 0 0)', 'oklch(0.556 0 0)'],
+ '--color-text-on-media': ['oklch(1 0 0)', 'oklch(0.145 0 0)'],
+
+ // Icon
+ '--color-icon-primary': ['oklch(0.145 0 0)', 'oklch(0.985 0 0)'],
+ '--color-icon-secondary': ['oklch(0.556 0 0)', 'oklch(0.708 0 0)'],
+ '--color-icon-tertiary': ['oklch(0.708 0 0)', 'oklch(0.556 0 0)'],
+ '--color-icon-disabled': ['oklch(0.708 0 0)', 'oklch(0.439 0 0)'],
+ '--color-icon-on-media': ['oklch(1 0 0)', 'oklch(0.145 0 0)'],
+
+ // Surface variants
+ '--color-card': ['oklch(1 0 0)', 'oklch(0.205 0 0)'],
+ '--color-popover': ['oklch(1 0 0)', 'oklch(0.269 0 0)'],
+ '--color-navbar': ['oklch(0.985 0 0)', 'oklch(0.205 0 0)'],
+
+ // Status/Sentiment
+ '--color-positive': ['oklch(0.6 0.15 145)', 'oklch(0.7 0.15 145)'],
+ '--color-positive-deemphasized': [
+ 'oklch(0.6 0.15 145 / 20%)',
+ 'oklch(0.7 0.15 145 / 20%)',
+ ],
+ '--color-negative': [
+ 'oklch(0.577 0.245 27.325)',
+ 'oklch(0.704 0.191 22.216)',
+ ],
+ '--color-negative-deemphasized': [
+ 'oklch(0.577 0.245 27.325 / 20%)',
+ 'oklch(0.704 0.191 22.216 / 20%)',
+ ],
+ '--color-warning': [
+ 'oklch(0.828 0.189 84.429)',
+ 'oklch(0.769 0.188 70.08)',
+ ],
+ '--color-warning-deemphasized': [
+ 'oklch(0.828 0.189 84.429 / 20%)',
+ 'oklch(0.769 0.188 70.08 / 20%)',
+ ],
+ '--color-educational': [
+ 'oklch(0.488 0.243 264.376)',
+ 'oklch(0.627 0.265 303.9)',
+ ],
+ '--color-educational-deemphasized': [
+ 'oklch(0.488 0.243 264.376 / 20%)',
+ 'oklch(0.627 0.265 303.9 / 20%)',
+ ],
+
+ // Divider
+ '--color-divider': ['oklch(0.922 0 0)', 'oklch(1 0 0 / 10%)'],
+ '--color-divider-high-contrast': ['oklch(0.708 0 0)', 'oklch(0.556 0 0)'],
+ '--color-divider-emphasized': ['oklch(0.85 0 0)', 'oklch(0.371 0 0)'],
+
+ // Disabled/Effects
+ '--color-disabled-overlay': [
+ 'oklch(1 0 0 / 50%)',
+ 'oklch(0.145 0 0 / 50%)',
+ ],
+ '--color-glimmer': ['oklch(0.922 0 0)', 'oklch(0.371 0 0)'],
+ '--color-glimmer-high-contrast': ['oklch(0.85 0 0)', 'oklch(0.439 0 0)'],
+ '--color-shadow-elevation': ['oklch(0 0 0 / 10%)', 'oklch(0 0 0 / 30%)'],
+ '--color-hover-tint': ['black', 'white'],
+
+ // Blue
+ '--color-blue-background': [
+ 'oklch(0.488 0.243 264.376 / 20%)',
+ 'oklch(0.488 0.243 264.376 / 20%)',
+ ],
+ '--color-blue-border': [
+ 'oklch(0.488 0.243 264.376)',
+ 'oklch(0.488 0.243 264.376)',
+ ],
+ '--color-blue-icon': [
+ 'oklch(0.488 0.243 264.376)',
+ 'oklch(0.488 0.243 264.376)',
+ ],
+ '--color-blue-text': ['oklch(0.398 0.2 264)', 'oklch(0.7 0.2 264)'],
+
+ // Cyan
+ '--color-cyan-background': [
+ 'oklch(0.6 0.118 184.704 / 20%)',
+ 'oklch(0.696 0.17 162.48 / 20%)',
+ ],
+ '--color-cyan-border': [
+ 'oklch(0.6 0.118 184.704)',
+ 'oklch(0.696 0.17 162.48)',
+ ],
+ '--color-cyan-icon': [
+ 'oklch(0.6 0.118 184.704)',
+ 'oklch(0.696 0.17 162.48)',
+ ],
+ '--color-cyan-text': ['oklch(0.398 0.07 184)', 'oklch(0.8 0.1 162)'],
+
+ // Gray
+ '--color-gray-background': [
+ 'oklch(0.922 0 0 / 50%)',
+ 'oklch(0.371 0 0 / 50%)',
+ ],
+ '--color-gray-border': ['oklch(0.708 0 0)', 'oklch(0.556 0 0)'],
+ '--color-gray-icon': ['oklch(0.556 0 0)', 'oklch(0.708 0 0)'],
+ '--color-gray-text': ['oklch(0.145 0 0)', 'oklch(0.985 0 0)'],
+
+ // Green
+ '--color-green-background': [
+ 'oklch(0.6 0.118 184.704 / 20%)',
+ 'oklch(0.696 0.17 162.48 / 20%)',
+ ],
+ '--color-green-border': [
+ 'oklch(0.6 0.118 184.704)',
+ 'oklch(0.696 0.17 162.48)',
+ ],
+ '--color-green-icon': [
+ 'oklch(0.6 0.118 184.704)',
+ 'oklch(0.696 0.17 162.48)',
+ ],
+ '--color-green-text': ['oklch(0.398 0.07 184)', 'oklch(0.8 0.1 162)'],
+
+ // Orange
+ '--color-orange-background': [
+ 'oklch(0.646 0.222 41.116 / 20%)',
+ 'oklch(0.645 0.246 16.439 / 20%)',
+ ],
+ '--color-orange-border': [
+ 'oklch(0.646 0.222 41.116)',
+ 'oklch(0.645 0.246 16.439)',
+ ],
+ '--color-orange-icon': [
+ 'oklch(0.646 0.222 41.116)',
+ 'oklch(0.645 0.246 16.439)',
+ ],
+ '--color-orange-text': ['oklch(0.5 0.18 41)', 'oklch(0.8 0.2 16)'],
+
+ // Pink
+ '--color-pink-background': [
+ 'oklch(0.627 0.265 303.9 / 20%)',
+ 'oklch(0.627 0.265 303.9 / 20%)',
+ ],
+ '--color-pink-border': [
+ 'oklch(0.627 0.265 303.9)',
+ 'oklch(0.627 0.265 303.9)',
+ ],
+ '--color-pink-icon': [
+ 'oklch(0.627 0.265 303.9)',
+ 'oklch(0.627 0.265 303.9)',
+ ],
+ '--color-pink-text': ['oklch(0.5 0.2 303)', 'oklch(0.8 0.2 303)'],
+
+ // Purple
+ '--color-purple-background': [
+ 'oklch(0.627 0.265 303.9 / 20%)',
+ 'oklch(0.627 0.265 303.9 / 20%)',
+ ],
+ '--color-purple-border': [
+ 'oklch(0.627 0.265 303.9)',
+ 'oklch(0.627 0.265 303.9)',
+ ],
+ '--color-purple-icon': [
+ 'oklch(0.627 0.265 303.9)',
+ 'oklch(0.627 0.265 303.9)',
+ ],
+ '--color-purple-text': ['oklch(0.5 0.2 303)', 'oklch(0.8 0.2 303)'],
+
+ // Red
+ '--color-red-background': [
+ 'oklch(0.577 0.245 27.325 / 20%)',
+ 'oklch(0.704 0.191 22.216 / 20%)',
+ ],
+ '--color-red-border': [
+ 'oklch(0.577 0.245 27.325)',
+ 'oklch(0.704 0.191 22.216)',
+ ],
+ '--color-red-icon': [
+ 'oklch(0.577 0.245 27.325)',
+ 'oklch(0.704 0.191 22.216)',
+ ],
+ '--color-red-text': ['oklch(0.45 0.2 27)', 'oklch(0.85 0.15 22)'],
+
+ // Teal
+ '--color-teal-background': [
+ 'oklch(0.6 0.118 184.704 / 20%)',
+ 'oklch(0.696 0.17 162.48 / 20%)',
+ ],
+ '--color-teal-border': [
+ 'oklch(0.6 0.118 184.704)',
+ 'oklch(0.696 0.17 162.48)',
+ ],
+ '--color-teal-icon': [
+ 'oklch(0.6 0.118 184.704)',
+ 'oklch(0.696 0.17 162.48)',
+ ],
+ '--color-teal-text': ['oklch(0.398 0.07 184)', 'oklch(0.8 0.1 162)'],
+
+ // Yellow
+ '--color-yellow-background': [
+ 'oklch(0.828 0.189 84.429 / 20%)',
+ 'oklch(0.769 0.188 70.08 / 20%)',
+ ],
+ '--color-yellow-border': [
+ 'oklch(0.828 0.189 84.429)',
+ 'oklch(0.769 0.188 70.08)',
+ ],
+ '--color-yellow-icon': [
+ 'oklch(0.828 0.189 84.429)',
+ 'oklch(0.769 0.188 70.08)',
+ ],
+ '--color-yellow-text': ['oklch(0.6 0.15 84)', 'oklch(0.9 0.15 70)'],
+
+ // =========================================================================
+ // Radius — slightly larger than default
+ // =========================================================================
+ '--radius-rounded': '9999px',
+ '--radius-container': '0.75rem',
+ '--radius-element': '0.625rem',
+ '--radius-content': '0.375rem',
+ '--radius-inner': '0.25rem',
+
+ // =========================================================================
+ // Elevation — oklch-based shadows
+ // =========================================================================
+ '--elevation-base':
+ '0 1px 2px light-dark(oklch(0 0 0 / 5%), oklch(0 0 0 / 20%))',
+ '--elevation-thumb':
+ '0 1px 3px light-dark(oklch(0 0 0 / 10%), oklch(0 0 0 / 30%))',
+ '--elevation-dialog':
+ '0 4px 6px light-dark(oklch(0 0 0 / 10%), oklch(0 0 0 / 25%)), 0 12px 24px light-dark(oklch(0 0 0 / 15%), oklch(0 0 0 / 35%))',
+ '--elevation-hover':
+ '0 2px 4px light-dark(oklch(0 0 0 / 5%), oklch(0 0 0 / 15%)), 0 4px 12px light-dark(oklch(0 0 0 / 10%), oklch(0 0 0 / 20%))',
+ '--elevation-menu':
+ '0 2px 4px light-dark(oklch(0 0 0 / 5%), oklch(0 0 0 / 15%)), 0 4px 8px light-dark(oklch(0 0 0 / 10%), oklch(0 0 0 / 20%))',
+ '--elevation-input-hover': 'inset 0px 0px 0px 2px rgba(1, 113, 227, 0.3)',
+ '--elevation-input-hover-success':
+ 'inset 0px 0px 0px 2px rgba(38, 167, 86, 0.3)',
+ '--elevation-input-hover-warning':
+ 'inset 0px 0px 0px 2px rgba(226, 164, 0, 0.3)',
+ '--elevation-input-hover-error':
+ 'inset 0px 0px 0px 2px rgba(227, 25, 59, 0.3)',
+
+ // =========================================================================
+ // Typography — Geist font family
+ // =========================================================================
+ '--font-body':
+ 'Geist, "Geist Fallback", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',
+ '--font-code': '"Geist Mono", "SF Mono", Monaco, Consolas, monospace',
+ '--font-heading':
+ 'Geist, "Geist Fallback", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',
+ },
+
+ components: {
+ // =========================================================================
+ // Button — primary gets white text, secondary gets a border
+ // =========================================================================
+ button: {
+ 'variant:primary': {
+ color: 'light-dark(white, oklch(0.145 0 0))',
+ },
+ 'variant:secondary': {
+ borderWidth: '1px',
+ borderStyle: 'solid',
+ borderColor: 'var(--color-divider)',
+ },
+ },
+
+ // =========================================================================
+ // Card — tighter padding
+ // =========================================================================
+ card: {
+ base: {
+ '--layout-padding-inner-x': 'var(--spacing-3)',
+ '--layout-padding-inner-y': 'var(--spacing-3)',
+ '--layout-padding-outer-x': 'var(--spacing-3)',
+ '--layout-padding-outer-y': 'var(--spacing-3)',
+ },
+ },
+
+ // =========================================================================
+ // Section — tighter padding
+ // =========================================================================
+ section: {
+ base: {
+ '--layout-padding-inner-x': 'var(--spacing-3)',
+ '--layout-padding-inner-y': 'var(--spacing-3)',
+ '--layout-padding-outer-x': 'var(--spacing-3)',
+ '--layout-padding-outer-y': 'var(--spacing-3)',
+ },
+ },
+
+ // =========================================================================
+ // Heading — Geist font, same dense scale
+ // =========================================================================
+ heading: {
+ 'level:1': {
+ fontFamily: 'var(--font-heading)',
+ fontSize: 'var(--text-2xl)',
+ fontWeight: 'var(--font-weight-semibold)',
+ lineHeight: '1.2',
+ color: 'var(--color-text-primary)',
+ margin: '0',
+ },
+ 'level:2': {
+ fontFamily: 'var(--font-heading)',
+ fontSize: 'var(--text-xl)',
+ fontWeight: 'var(--font-weight-semibold)',
+ lineHeight: '1.333',
+ color: 'var(--color-text-primary)',
+ margin: '0',
+ },
+ 'level:3': {
+ fontFamily: 'var(--font-heading)',
+ fontSize: 'var(--text-lg)',
+ fontWeight: 'var(--font-weight-bold)',
+ lineHeight: '1.25',
+ color: 'var(--color-text-primary)',
+ margin: '0',
+ },
+ 'level:4': {
+ fontFamily: 'var(--font-heading)',
+ fontSize: 'var(--text-base)',
+ fontWeight: 'var(--font-weight-bold)',
+ lineHeight: 'var(--leading-base)',
+ color: 'var(--color-text-primary)',
+ margin: '0',
+ },
+ 'level:5': {
+ fontFamily: 'var(--font-heading)',
+ fontSize: 'var(--text-base)',
+ fontWeight: 'var(--font-weight-semibold)',
+ lineHeight: 'var(--leading-base)',
+ color: 'var(--color-text-primary)',
+ margin: '0',
+ },
+ 'level:6': {
+ fontFamily: 'var(--font-heading)',
+ fontSize: 'var(--text-xsm)',
+ fontWeight: 'var(--font-weight-semibold)',
+ lineHeight: '1.333',
+ color: 'var(--color-text-primary)',
+ margin: '0',
+ },
+ // Editorial variant
+ 'variant:editorial+level:1': {
+ fontFamily: 'var(--font-heading)',
+ fontSize: 'var(--text-4xl)',
+ fontWeight: 'var(--font-weight-semibold)',
+ lineHeight: '1.5',
+ color: 'var(--color-text-primary)',
+ margin: '0',
+ },
+ 'variant:editorial+level:2': {
+ fontFamily: 'var(--font-heading)',
+ fontSize: 'var(--text-3xl)',
+ fontWeight: 'var(--font-weight-semibold)',
+ lineHeight: '1.333',
+ color: 'var(--color-text-primary)',
+ margin: '0',
+ },
+ 'variant:editorial+level:3': {
+ fontFamily: 'var(--font-heading)',
+ fontSize: 'var(--text-2xl)',
+ fontWeight: 'var(--font-weight-bold)',
+ lineHeight: '1.4',
+ color: 'var(--color-text-primary)',
+ margin: '0',
+ },
+ 'variant:editorial+level:4': {
+ fontFamily: 'var(--font-heading)',
+ fontSize: 'var(--text-lg)',
+ fontWeight: 'var(--font-weight-bold)',
+ lineHeight: '1.5',
+ color: 'var(--color-text-primary)',
+ margin: '0',
+ },
+ 'variant:editorial+level:5': {
+ fontFamily: 'var(--font-heading)',
+ fontSize: 'var(--text-base)',
+ fontWeight: 'var(--font-weight-semibold)',
+ lineHeight: 'var(--leading-base)',
+ color: 'var(--color-text-primary)',
+ margin: '0',
+ },
+ 'variant:editorial+level:6': {
+ fontFamily: 'var(--font-heading)',
+ fontSize: 'var(--text-xsm)',
+ fontWeight: 'var(--font-weight-semibold)',
+ lineHeight: '1.333',
+ color: 'var(--color-text-primary)',
+ margin: '0',
+ },
+ },
+
+ // =========================================================================
+ // Text — Geist body font
+ // =========================================================================
+ text: {
+ 'type:body': {
+ fontFamily: 'var(--font-body)',
+ fontSize: 'var(--text-base)',
+ fontWeight: 'var(--font-weight-normal)',
+ lineHeight: 'var(--leading-base)',
+ color: 'var(--color-text-primary)',
+ margin: '0',
+ },
+ 'type:large': {
+ fontFamily: 'var(--font-body)',
+ fontSize: 'var(--text-lg)',
+ fontWeight: 'var(--font-weight-normal)',
+ lineHeight: '1.5',
+ color: 'var(--color-text-primary)',
+ margin: '0',
+ },
+ 'type:label': {
+ fontFamily: 'var(--font-body)',
+ fontSize: 'var(--text-base)',
+ fontWeight: 'var(--font-weight-medium)',
+ lineHeight: 'var(--leading-base)',
+ color: 'var(--color-text-primary)',
+ margin: '0',
+ },
+ 'type:supporting': {
+ fontFamily: 'var(--font-body)',
+ fontSize: 'var(--text-xsm)',
+ fontWeight: 'var(--font-weight-normal)',
+ lineHeight: '1.333',
+ color: 'var(--color-text-secondary)',
+ margin: '0',
+ },
+ 'type:code': {
+ fontFamily: 'var(--font-code)',
+ fontSize: 'var(--text-base)',
+ fontWeight: 'var(--font-weight-normal)',
+ lineHeight: 'var(--leading-base)',
+ color: 'var(--color-text-primary)',
+ margin: '0',
+ },
+ },
+ },
+
+ icons: neutralIconRegistry,
+});
diff --git a/packages/themes/neutral/tsup.config.ts b/packages/themes/neutral/tsup.config.ts
deleted file mode 100644
index f3d2e313dd..0000000000
--- a/packages/themes/neutral/tsup.config.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-import {defineConfig} from 'tsup';
-import babel from 'esbuild-plugin-babel';
-import path from 'path';
-
-export default defineConfig({
- entry: ['src/index.ts'],
- format: ['cjs', 'esm'],
- dts: true,
- splitting: true,
- clean: true,
- external: ['react', 'react-dom', '@stylexjs/stylex', '@xds/core'],
- esbuildPlugins: [
- babel({
- filter: /\.[jt]sx?$/,
- config: {
- presets: [
- ['@babel/preset-react', {runtime: 'automatic'}],
- '@babel/preset-typescript',
- ],
- plugins: [
- [
- '@stylexjs/babel-plugin',
- {
- dev: false,
- runtimeInjection: false,
- genConditionalClasses: true,
- treeshakeCompensation: true,
- aliases: {
- '@xds/core/*': [
- path.join(__dirname, '..', '..', 'core', 'src', '*'),
- ],
- },
- unstable_moduleResolution: {
- type: 'commonJS',
- rootDir: path.resolve(__dirname, '../../..'),
- },
- },
- ],
- ],
- },
- }),
- ],
-});
diff --git a/scripts/build-theme-css.mjs b/scripts/build-theme-css.mjs
deleted file mode 100644
index 37fc4df735..0000000000
--- a/scripts/build-theme-css.mjs
+++ /dev/null
@@ -1,118 +0,0 @@
-/**
- * @file build-theme-css.mjs
- * Post-build script that extracts StyleX CSS from theme packages
- * and outputs theme.css files.
- *
- * Usage: node scripts/build-theme-css.mjs <theme-dir>
- * Example: node scripts/build-theme-css.mjs packages/themes/default
- */
-
-import {transformAsync} from '@babel/core';
-import stylexBabelPlugin from '@stylexjs/babel-plugin';
-import fs from 'fs/promises';
-import path from 'path';
-import {fileURLToPath} from 'url';
-import {glob} from 'glob';
-
-const __dirname = path.dirname(fileURLToPath(import.meta.url));
-const ROOT = path.resolve(__dirname, '..');
-
-const themeDir = process.argv[2];
-if (!themeDir) {
- console.error('Usage: node scripts/build-theme-css.mjs <theme-dir>');
- process.exit(1);
-}
-
-const THEME_SRC = path.resolve(ROOT, themeDir, 'src');
-const THEME_DIST = path.resolve(ROOT, themeDir, 'dist');
-
-async function collectThemeCSS() {
- const files = await glob('**/*.{ts,tsx}', {
- cwd: THEME_SRC,
- absolute: true,
- ignore: ['**/*.test.*', '**/*.d.ts'],
- });
-
- console.log(`Processing ${files.length} theme files from ${themeDir}...`);
-
- const allRules = [];
-
- for (const file of files) {
- const code = await fs.readFile(file, 'utf8');
- if (!code.includes('@stylexjs/stylex')) continue;
-
- try {
- const result = await transformAsync(code, {
- babelrc: false,
- filename: file,
- presets: [
- ['@babel/preset-typescript', {isTSX: true, allExtensions: true}],
- ['@babel/preset-react', {runtime: 'automatic'}],
- ],
- plugins: [
- [
- stylexBabelPlugin,
- {
- dev: false,
- runtimeInjection: false,
- genConditionalClasses: true,
- treeshakeCompensation: true,
- aliases: {
- '@xds/core/*': [path.join(ROOT, 'packages/core/src/*')],
- },
- unstable_moduleResolution: {
- type: 'commonJS',
- rootDir: ROOT,
- },
- },
- ],
- ],
- });
-
- if (result?.metadata?.stylex) {
- allRules.push(...result.metadata.stylex);
- }
- } catch (err) {
- console.warn(` Warning: ${path.relative(ROOT, file)}: ${err.message}`);
- }
- }
-
- console.log(`Collected ${allRules.length} StyleX rules`);
-
- if (allRules.length === 0) {
- console.warn('No StyleX rules found in theme!');
- return '';
- }
-
- const css = stylexBabelPlugin.processStylexRules(allRules, false);
- const themeName = path.basename(themeDir);
-
- const layeredCSS = `/* XDS Theme: ${themeName} — Pre-compiled StyleX CSS */
-/* This file is auto-generated. Do not edit manually. */
-
-@layer xds.theme {
-${css.split('\n').map(line => ' ' + line).join('\n')}
-}
-`;
-
- return layeredCSS;
-}
-
-async function main() {
- const css = await collectThemeCSS();
- if (!css) {
- console.error('Failed to collect theme CSS');
- process.exit(1);
- }
-
- await fs.mkdir(THEME_DIST, {recursive: true});
- const outPath = path.resolve(THEME_DIST, 'theme.css');
- await fs.writeFile(outPath, css, 'utf8');
- console.log(`Written to ${path.relative(ROOT, outPath)}`);
- console.log(`Size: ${(css.length / 1024).toFixed(1)} KB`);
-}
-
-main().catch(err => {
- console.error(err);
- process.exit(1);
-});