Skip to content

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

TypeScript

feat: merge @xds/theme-syntax presets into @xds/core (#1304)

Cindy Zhangcf4409feb9c8
diff --git a/apps/storybook/package.json b/apps/storybook/package.json
index 1d71c16bce..bce9f42f4f 100644
--- a/apps/storybook/package.json
+++ b/apps/storybook/package.json
@@ -10,7 +10,6 @@
"@xds/core": "*",
"@xds/theme-default": "*",
"@xds/theme-neutral": "*",
- "@xds/theme-syntax": "*",
"react": "^19.2.4",
"react-dom": "^19.2.4",
"unplugin": "^2.3.11"
diff --git a/apps/storybook/stories/CodeTheme.stories.tsx b/apps/storybook/stories/CodeTheme.stories.tsx
index 66aef0e281..1cb90d6e39 100644
--- a/apps/storybook/stories/CodeTheme.stories.tsx
+++ b/apps/storybook/stories/CodeTheme.stories.tsx
@@ -20,7 +20,7 @@ import {
catppuccinLatte,
tokyoNightLight,
allSyntaxPresets,
-} from '@xds/theme-syntax';
+} from '@xds/core/theme/syntax';
const sampleCode = [
"import {useState, useEffect} from 'react';",
@@ -69,7 +69,7 @@ const meta: Meta = {
description: {
component:
'Syntax theme provider for code components. Wraps XDSCodeBlock and XDSCodeEditor ' +
- 'to apply community syntax color themes. 11 presets ship in @xds/theme-syntax.',
+ 'to apply community syntax color themes. 12 presets ship in @xds/core/theme/syntax.',
},
},
},
diff --git a/package.json b/package.json
index 5bc0e41e49..e2857de07b 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 && yarn workspace @xds/theme-brutalist build && yarn workspace @xds/theme-daily build && yarn workspace @xds/theme-whatsapp build && yarn workspace @xds/theme-meta build && yarn workspace @xds/theme-syntax 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 && yarn workspace @xds/theme-daily build && yarn workspace @xds/theme-whatsapp build && yarn workspace @xds/theme-meta build",
"dev": "yarn workspace @xds/storybook dev",
"test": "vitest run",
"test:watch": "vitest",
diff --git a/packages/core/src/theme/defineTheme.ts b/packages/core/src/theme/defineTheme.ts
index 58cf69da60..d4c32598e9 100644
--- a/packages/core/src/theme/defineTheme.ts
+++ b/packages/core/src/theme/defineTheme.ts
@@ -251,7 +251,7 @@ export interface XDSDefineThemeInput {
*
* @example
* ```tsx
- * import {dracula} from '@xds/theme-syntax';
+ * import {dracula} from '@xds/core/theme/syntax';
* defineTheme({ name: 'my-theme', syntax: dracula, ... })
* ```
*/
diff --git a/packages/themes/syntax/THIRD_PARTY_LICENSES.md b/packages/core/src/theme/syntax/THIRD_PARTY_LICENSES.md
similarity index 100%
rename from packages/themes/syntax/THIRD_PARTY_LICENSES.md
rename to packages/core/src/theme/syntax/THIRD_PARTY_LICENSES.md
diff --git a/packages/core/src/theme/syntax/index.ts b/packages/core/src/theme/syntax/index.ts
index 7964dc818b..a11eda0152 100644
--- a/packages/core/src/theme/syntax/index.ts
+++ b/packages/core/src/theme/syntax/index.ts
@@ -20,3 +20,22 @@ export type {
export {XDSSyntaxTheme, useXDSSyntaxTheme} from './XDSSyntaxTheme';
export type {UseXDSSyntaxThemeReturn} from './XDSSyntaxTheme';
+
+// Community syntax theme presets (formerly @xds/theme-syntax)
+export {
+ oneDarkPro,
+ dracula,
+ monokai,
+ nord,
+ tokyoNight,
+ catppuccinMocha,
+ githubDark,
+ githubLight,
+ solarizedLight,
+ oneLight,
+ catppuccinLatte,
+ tokyoNightLight,
+ darkSyntaxPresets,
+ lightSyntaxPresets,
+ allSyntaxPresets,
+} from './presets';
diff --git a/packages/themes/syntax/src/presets.ts b/packages/core/src/theme/syntax/presets.ts
similarity index 98%
rename from packages/themes/syntax/src/presets.ts
rename to packages/core/src/theme/syntax/presets.ts
index b6d53d2328..dd8eb88a14 100644
--- a/packages/themes/syntax/src/presets.ts
+++ b/packages/core/src/theme/syntax/presets.ts
@@ -1,5 +1,5 @@
/**
- * @file presets.ts
+ * @file theme/syntax/presets.ts
* @output 12 community syntax theme presets
*
* Color values sourced from each theme's official VS Code extension.
@@ -9,7 +9,7 @@
* @see https://github.com/facebookexperimental/xds/issues/1148
*/
-import {defineSyntaxTheme, type SyntaxTheme} from '@xds/core/theme/syntax';
+import {defineSyntaxTheme, type SyntaxTheme} from './defineSyntaxTheme';
/** One Dark Pro (Binaryify) — MIT */
export const oneDarkPro: SyntaxTheme = defineSyntaxTheme({
diff --git a/packages/themes/syntax/package.json b/packages/themes/syntax/package.json
deleted file mode 100644
index ded2af2bc5..0000000000
--- a/packages/themes/syntax/package.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "name": "@xds/theme-syntax",
- "version": "0.0.11",
- "description": "Syntax highlighting theme presets for XDS — 11 community themes mapped to the XDS 14-token syntax architecture",
- "license": "MIT",
- "sideEffects": false,
- "main": "./dist/index.js",
- "types": "./dist/index.d.ts",
- "exports": {
- ".": {
- "types": "./dist/index.d.ts",
- "import": "./dist/index.mjs",
- "require": "./dist/index.js"
- }
- },
- "files": [
- "dist",
- "src"
- ],
- "scripts": {
- "build": "tsup"
- },
- "peerDependencies": {
- "@xds/core": "*"
- }
-}
diff --git a/packages/themes/syntax/src/index.ts b/packages/themes/syntax/src/index.ts
deleted file mode 100644
index 50159690c2..0000000000
--- a/packages/themes/syntax/src/index.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * @xds/theme-syntax — Community syntax theme presets for XDS
- *
- * 12 themes (7 dark, 5 light) mapped to the XDS 14-token syntax architecture.
- * All original themes are MIT licensed. See THIRD_PARTY_LICENSES.md.
- *
- * @example
- * import {dracula} from '@xds/theme-syntax';
- * import {XDSCodeTheme} from '@xds/core/theme';
- *
- * <XDSCodeTheme theme={dracula}>
- * <XDSCodeBlock code={code} />
- * </XDSCodeTheme>
- */
-
-// Dark themes
-export {oneDarkPro} from './presets';
-export {dracula} from './presets';
-export {monokai} from './presets';
-export {nord} from './presets';
-export {tokyoNight} from './presets';
-export {catppuccinMocha} from './presets';
-export {githubDark} from './presets';
-
-// Light themes
-export {githubLight} from './presets';
-export {solarizedLight} from './presets';
-export {oneLight} from './presets';
-export {catppuccinLatte} from './presets';
-export {tokyoNightLight} from './presets';
-
-// Collections
-export {
- darkSyntaxPresets,
- lightSyntaxPresets,
- allSyntaxPresets,
-} from './presets';
diff --git a/packages/themes/syntax/tsup.config.ts b/packages/themes/syntax/tsup.config.ts
deleted file mode 100644
index 5e3a45aff4..0000000000
--- a/packages/themes/syntax/tsup.config.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import {defineConfig} from 'tsup';
-
-export default defineConfig({
- entry: ['src/index.ts'],
- format: ['cjs', 'esm'],
- dts: true,
- clean: true,
-});