Skip to content

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

TypeScript

Theme editor in playground (#2596)

Kenton Quatmanb4bbf8087a95
diff --git a/apps/docsite/scripts/generate-data.mjs b/apps/docsite/scripts/generate-data.mjs
index 95d0485026..fd7f23fc86 100644
--- a/apps/docsite/scripts/generate-data.mjs
+++ b/apps/docsite/scripts/generate-data.mjs
@@ -928,7 +928,7 @@ export const docsCount = ${docTopics.length};
}
-function generateThemeRegistry(packages) {
+async function generateThemeRegistry(packages) {
console.log('Generating theme registry...');
const themePackages = packages.filter(p => p.name.startsWith('@xds/theme-'));
if (!themePackages.length) {
@@ -952,6 +952,35 @@ export const themeObjects: Record<string, XDSDefinedTheme> = {};
return ` '${p.name}': ${slug}Theme,`;
}).join('\n');
+ // The `/built` objects are tokens-only — component overrides are compiled into
+ // each theme's CSS file, not the JS object. Extract those overrides here at
+ // build time from the package's full (main) export. In Node the `use client`
+ // directive on defineTheme is ignored, so this import is safe; the values are
+ // plain string maps, so the generated file stays pure data and is safe to
+ // import from server components. They're re-attached to the built objects in
+ // `themeObjectsFull` for the theme editors/playground, which rebuild the theme
+ // at runtime and so need the overrides (e.g. display fonts) on the object.
+ const componentOverrides = {};
+ for (const p of themePackages) {
+ const slug = p.name.replace('@xds/theme-', '');
+ try {
+ const mod = await import(p.name);
+ const theme = mod[`${slug}Theme`];
+ if (theme?.components && Object.keys(theme.components).length > 0) {
+ componentOverrides[p.name] = theme.components;
+ }
+ } catch (err) {
+ console.warn(
+ ` warn: could not extract components for ${p.name}: ${err.message}`,
+ );
+ }
+ }
+
+ const fullEntries = themePackages.map(p => {
+ const slug = p.name.replace('@xds/theme-', '');
+ return ` '${p.name}': {...${slug}Theme, components: componentOverrides['${p.name}']},`;
+ }).join('\n');
+
const content = `// Auto-generated by scripts/generate-data.mjs — do not edit
import type {XDSDefinedTheme} from '@xds/core/theme';
@@ -960,6 +989,24 @@ ${imports}
export const themeObjects: Record<string, XDSDefinedTheme> = {
${entries}
};
+
+/**
+ * Component overrides extracted from each theme's full export (the /built
+ * objects above are tokens-only — their component styles live in CSS). Plain
+ * data, safe to import from server components.
+ */
+const componentOverrides: Record<string, XDSDefinedTheme['components']> =
+ ${JSON.stringify(componentOverrides, null, 2).split('\n').map((l, i) => (i === 0 ? l : ' ' + l)).join('\n')};
+
+/**
+ * Built theme objects with their component overrides re-attached. Used by the
+ * theme editors/playground, which serialize the theme over postMessage and
+ * rebuild it at runtime, so component overrides (e.g. display fonts) must live
+ * on the object rather than in a separate CSS file.
+ */
+export const themeObjectsFull: Record<string, XDSDefinedTheme> = {
+${fullEntries}
+};
`;
writeRegistry('themeRegistry.ts', content);
@@ -1137,7 +1184,7 @@ async function main() {
console.log('Generating docsite data...\n');
const packages = generatePackageRegistry();
- const themeCount = generateThemeRegistry(packages);
+ const themeCount = await generateThemeRegistry(packages);
const {allComponents, totalCount: componentCount} = await generateComponentRegistry();
generateGroupedComponentRegistry(allComponents);
const {blockCount, showcaseCount} = await generateBlockRegistry();
diff --git a/apps/docsite/src/app/(preview)/playground-preview/page.tsx b/apps/docsite/src/app/(preview)/playground-preview/page.tsx
index b0105e9b3d..0ed02f2c2f 100644
--- a/apps/docsite/src/app/(preview)/playground-preview/page.tsx
+++ b/apps/docsite/src/app/(preview)/playground-preview/page.tsx
@@ -12,8 +12,8 @@ import React, {
type ErrorInfo,
type ReactNode,
} from 'react';
-import {XDSTheme} from '@xds/core/theme';
-import type {ThemeMode} from '@xds/core/theme';
+import {XDSTheme, defineTheme} from '@xds/core/theme';
+import type {ThemeMode, XDSDefinedTheme} from '@xds/core/theme';
import {
themeByValue,
DEFAULT_PLAYGROUND_THEME,
@@ -96,7 +96,16 @@ type PreviewMessage =
| {type: 'preview-ping'}
| {type: 'preview-code'; code: string}
| {type: 'preview-clear'}
- | {type: 'preview-theme'; mode?: string; theme?: string}
+ | {
+ type: 'preview-theme';
+ mode?: string;
+ theme?: string;
+ // A custom theme authored in the editor. Sent as raw token map +
+ // components (not a defineTheme result) so the payload stays reliably
+ // structured-clone-safe across postMessage; the iframe rebuilds it.
+ customTokens?: Record<string, string>;
+ customComponents?: unknown;
+ }
| {type: 'preview-highlight'; id: string}
| {type: 'preview-select'; id: string}
| {type: 'targeting-enable'}
@@ -399,6 +408,9 @@ export default function PreviewPage() {
const [error, setError] = useState<string | null>(null);
const [themeMode, setThemeMode] = useState<ThemeMode>('system');
const [themeName, setThemeName] = useState(DEFAULT_PLAYGROUND_THEME);
+ // A custom theme authored in the playground theme editor. When set it takes
+ // precedence over the registered theme resolved from themeName.
+ const [customTheme, setCustomTheme] = useState<XDSDefinedTheme | null>(null);
const [resetKey, setResetKey] = useState(0);
const [tsReady, setTsReady] = useState(false);
// Whether the rendered output should fill the stage (full-page templates) vs
@@ -425,7 +437,7 @@ export default function PreviewPage() {
document.head.appendChild(script);
}, []);
- const theme = themeByValue[themeName] ?? FALLBACK_THEME;
+ const theme = customTheme ?? themeByValue[themeName] ?? FALLBACK_THEME;
const postToParent = useCallback((msg: Record<string, unknown>) => {
window.parent.postMessage(msg, '*');
@@ -466,14 +478,38 @@ export default function PreviewPage() {
setError(null);
}, []);
- const handleTheme = useCallback((msg: {mode?: string; theme?: string}) => {
- if (msg.mode === 'light' || msg.mode === 'dark' || msg.mode === 'system') {
- setThemeMode(msg.mode);
- }
- if (msg.theme && msg.theme in themeByValue) {
- setThemeName(msg.theme);
- }
- }, []);
+ const handleTheme = useCallback(
+ (msg: {
+ mode?: string;
+ theme?: string;
+ customTokens?: Record<string, string>;
+ customComponents?: unknown;
+ }) => {
+ if (
+ msg.mode === 'light' ||
+ msg.mode === 'dark' ||
+ msg.mode === 'system'
+ ) {
+ setThemeMode(msg.mode);
+ }
+ if (msg.customTokens) {
+ setCustomTheme(
+ defineTheme({
+ name: 'custom',
+ tokens: msg.customTokens,
+ components: msg.customComponents as XDSDefinedTheme['components'],
+ }),
+ );
+ } else {
+ // No custom tokens — fall back to the registered theme by key.
+ setCustomTheme(null);
+ if (msg.theme && msg.theme in themeByValue) {
+ setThemeName(msg.theme);
+ }
+ }
+ },
+ [],
+ );
useEffect(() => {
if (!tsReady) {
diff --git a/apps/docsite/src/app/(preview)/playground-preview/scope.ts b/apps/docsite/src/app/(preview)/playground-preview/scope.ts
index 959225f868..fd069da1fa 100644
--- a/apps/docsite/src/app/(preview)/playground-preview/scope.ts
+++ b/apps/docsite/src/app/(preview)/playground-preview/scope.ts
@@ -59,6 +59,7 @@ import * as Grid from '@xds/core/Grid';
import * as HoverCard from '@xds/core/HoverCard';
import * as Icon from '@xds/core/Icon';
import * as IconButton from '@xds/core/IconButton';
+import * as Item from '@xds/core/Item';
import * as Kbd from '@xds/core/Kbd';
import * as Layer from '@xds/core/Layer';
import * as Layout from '@xds/core/Layout';
@@ -197,6 +198,7 @@ export const scope: Record<string, Record<string, unknown>> = {
'@xds/core/HoverCard': HoverCard,
'@xds/core/Icon': Icon,
'@xds/core/IconButton': IconButton,
+ '@xds/core/Item': Item,
'@xds/core/Kbd': Kbd,
'@xds/core/Layer': Layer,
'@xds/core/Layout': Layout,
@@ -278,6 +280,7 @@ export const scope: Record<string, Record<string, unknown>> = {
...HoverCard,
...Icon,
...IconButton,
+ ...Item,
...Kbd,
...Layer,
...Layout,
diff --git a/apps/docsite/src/app/(site)/themes/page.tsx b/apps/docsite/src/app/(site)/themes/page.tsx
index f72906fcc7..e51ee704f2 100644
--- a/apps/docsite/src/app/(site)/themes/page.tsx
+++ b/apps/docsite/src/app/(site)/themes/page.tsx
@@ -278,7 +278,9 @@ export default function ThemesPage() {
{/* Tile is fully presentational. Navigation is
handled exclusively by the two XDSButtons inside
the hover overlay ("Preview" → /themes/<slug>;
- "Open in Playground" → /themes/playground/<slug>).
+ "Open in Playground" → /playground?theme=<slug>,
+ which opens the main playground with the theme
+ seeded into the Theme editor).
No card-wide click target — earlier iterations
wrapped this in XDSClickableCard, but the
overlay scrim's pointer-events: auto combined
@@ -329,7 +331,7 @@ export default function ThemesPage() {
label="Open in Playground"
variant="secondary"
size="sm"
- href={`/themes/playground/${slug}`}
+ href={`/playground?theme=${slug}`}
/>
</XDSHStack>
</XDSVStack>
diff --git a/apps/docsite/src/app/layout.tsx b/apps/docsite/src/app/layout.tsx
index fb58e84bd0..1049b9a8a6 100644
--- a/apps/docsite/src/app/layout.tsx
+++ b/apps/docsite/src/app/layout.tsx
@@ -32,7 +32,7 @@ export default function RootLayout({children}: {children: React.ReactNode}) {
/>
<link
rel="stylesheet"
- href="https://fonts.googleapis.com/css2?family=Albert+Sans:wght@400;500;600;700&family=DM+Sans:wght@400;500;600;700&family=Figtree:wght@400;500;600;700&family=Fraunces:opsz,[email protected],400;9..144,500;9..144,600;9..144,700&family=Fustat:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&family=Manufacturing+Consent&family=Montserrat:wght@400;500;600;700&family=PT+Serif:wght@400;700&family=Playwrite+US+Trad:[email protected]&display=swap"
+ href="https://fonts.googleapis.com/css2?family=Albert+Sans:wght@400;500;600;700&family=DM+Sans:wght@400;500;600;700&family=Figtree:wght@400;500;600;700&family=Fraunces:opsz,[email protected],400;9..144,500;9..144,600;9..144,700&family=Fustat:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&family=Manufacturing+Consent&family=Montserrat:wght@400;500;600;700&family=Outfit:wght@400;500;600;700&family=PT+Serif:wght@400;700&family=Playwrite+US+Trad:[email protected]&family=Poppins:wght@400;500;600;700&family=UnifrakturMaguntia&display=swap"
/>
</head>
<body>
diff --git a/apps/docsite/src/app/playground/PlaygroundClient.tsx b/apps/docsite/src/app/playground/PlaygroundClient.tsx
index f83b88683d..2ebc35fae3 100644
--- a/apps/docsite/src/app/playground/PlaygroundClient.tsx
+++ b/apps/docsite/src/app/playground/PlaygroundClient.tsx
@@ -22,6 +22,7 @@
'use client';
import {useCallback, useEffect, useMemo, useRef, useState} from 'react';
+import {useSearchParams} from 'next/navigation';
import dynamic from 'next/dynamic';
import {loader} from '@monaco-editor/react';
import * as stylex from '@stylexjs/stylex';
@@ -44,6 +45,7 @@ import {XDSToggleButton, XDSToggleButtonGroup} from '@xds/core/ToggleButton';
import {
Code2,
Moon,
+ Palette,
SlidersHorizontal,
Sun,
Monitor,
@@ -55,13 +57,16 @@ import {
import githubLight from './themes/github-light.json';
import githubDark from './themes/github-dark.json';
import {useThemeMode} from '../providers';
-import {DEFAULT_PLAYGROUND_THEME} from './playgroundThemes';
+import {DEFAULT_PLAYGROUND_THEME, themeByValue} from './playgroundThemes';
import {PreviewStage, type Viewport} from './PreviewStage';
import {BRAND_ICON} from '../../components/XDSWordmark';
import {PropertyPanel} from './PropertyPanel';
import {annotateInstanceIds} from './babelParser';
+import {PlaygroundThemeEditor} from '../../components/themePlayground/PlaygroundThemeEditor';
+import {DEFAULT_CODE} from './defaultCode';
import type * as MonacoTypes from 'monaco-editor';
+import type {XDSDefinedTheme} from '@xds/core/theme';
// Self-host Monaco from public/monaco/vs — corpnet blocks the default
// jsdelivr CDN. Configure the singleton loader before the editor initializes.
@@ -104,42 +109,6 @@ const MonacoEditor = dynamic(() => import('@monaco-editor/react'), {
),
});
-const DEFAULT_CODE = `import {
- XDSButton,
- XDSText,
- XDSHeading,
- XDSVStack,
- XDSHStack,
- XDSCard,
- XDSBadge,
-} from '@xds/core';
-
-export default function Demo() {
- const [count, setCount] = useState(0);
-
- return (
- <XDSCard maxWidth={400}>
- <XDSVStack gap={4}>
- <XDSVStack>
- <XDSHeading level={3}>
- Astryx Playground
- </XDSHeading>
- <XDSText color="secondary">
- Edit the code and see live changes.
- </XDSText>
- </XDSVStack>
- <XDSHStack gap={2} align="center">
- <XDSButton
- label={\`Count: \${count}\`}
- onClick={() => setCount(c => c + 1)}
- />
- <XDSBadge variant="info" label={\`\${count} clicks\`} />
- </XDSHStack>
- </XDSVStack>
- </XDSCard>
- );
-}`;
-
function getInitialCode(): string {
if (typeof window === 'undefined') {
return DEFAULT_CODE;
@@ -287,7 +256,7 @@ function configureMonaco(monaco: MonacoInstance) {
});
}
-type LeftView = 'code' | 'property';
+type LeftView = 'code' | 'property' | 'theme';
type BuildStatus = 'idle' | 'building' | 'finished' | 'error';
const BUILD_STATUS_META: Record<
@@ -327,7 +296,9 @@ const s = stylex.create({
},
leftPanelHeader: {
flexShrink: 0,
- padding: 'var(--spacing-3)',
+ paddingBlock: 'var(--spacing-2)',
+ paddingInline: 'var(--spacing-3)',
+ minHeight: 48,
},
tabBody: {
flex: 1,
@@ -341,6 +312,13 @@ const s = stylex.create({
minHeight: 0,
minWidth: 0,
},
+ themePane: {
+ flex: 1,
+ minHeight: 0,
+ minWidth: 0,
+ display: 'flex',
+ flexDirection: 'column',
+ },
rightPanel: {
flex: 1,
minWidth: 0,
@@ -364,7 +342,21 @@ export function PlaygroundClient() {
const editorTheme = siteMode === 'dark' ? 'github-dark' : 'github-light';
const [code, setCode] = useState(getInitialCode);
const [mode, setMode] = useState<'light' | 'dark'>('light');
- const theme = DEFAULT_PLAYGROUND_THEME;
+ // A ?theme=<value> query param (e.g. from the themes gallery's "Open in
+ // Playground") seeds the Theme view with that theme and applies it to the
+ // preview. useSearchParams reads it reliably across App Router client-side
+ // navigation (a window.location read at mount can be stale on soft nav).
+ // Validated against the registered themes; null when absent or unknown so
+ // the playground keeps its default, unseeded behavior.
+ const searchParams = useSearchParams();
+ const rawThemeParam = searchParams.get('theme');
+ const themeParam =
+ rawThemeParam && rawThemeParam in themeByValue ? rawThemeParam : null;
+ const theme = themeParam ?? DEFAULT_PLAYGROUND_THEME;
+ // The theme object the editor is seeded from — the ?theme= theme when present,
+ // otherwise the playground default (neutral). Always defined so the always-
+ // mounted Theme editor reflects the active theme and stays the source of truth.
+ const editorInitialTheme = themeByValue[theme];
const [activeView, setActiveView] = useState<LeftView>('code');
const [viewport, setViewport] = useState<Viewport>('desktop');
const [isFullscreen, setIsFullscreen] = useState(false);
@@ -390,6 +382,9 @@ export function PlaygroundClient() {
// re-creating the (stable) mount callback.
const activeViewRef = useRef(activeView);
activeViewRef.current = activeView;
+ // Latest theme authored in the Theme view, retained so a mode toggle can
+ // re-post it (the iframe clears the custom theme on any string-only push).
+ const customThemeRef = useRef<XDSDefinedTheme | null>(null);
const editorPanel = useXDSResizable({
defaultSize: 440,
@@ -420,6 +415,16 @@ export function PlaygroundClient() {
return () => window.removeEventListener('hashchange', onHashChange);
}, []);
+ // When a ?theme= param seeds the playground, open the Theme view so the
+ // populated theme editor is visible (and drives the preview) on arrival.
+ // Done in an effect (not the initial activeView state) to avoid an
+ // SSR/client hydration mismatch on the panel that renders.
+ useEffect(() => {
+ if (themeParam) {
+ setActiveView('theme');
+ }
+ }, [themeParam]);
+
const send = useCallback((c: string) => {
const win = iframeRef.current?.contentWindow;
if (!win) {
@@ -438,6 +443,24 @@ export function PlaygroundClient() {
[send],
);
+ // Push a theme authored in the Theme view to the preview. Sent as raw tokens
+ // + components (see the preview-theme protocol) so it survives postMessage.
+ const postCustomTheme = useCallback(
+ (customTheme: XDSDefinedTheme) => {
+ customThemeRef.current = customTheme;
+ iframeRef.current?.contentWindow?.postMessage(
+ {
+ type: 'preview-theme',
+ customTokens: customTheme.tokens,
+ customComponents: customTheme.components,
+ mode,
+ },
+ window.location.origin,
+ );
+ },
+ [mode],
+ );
+
// Persistently highlight the DOM node for a given component instance.
const selectInstance = useCallback((component: string, index: number) => {
iframeRef.current?.contentWindow?.postMessage(
@@ -533,13 +556,33 @@ export function PlaygroundClient() {
// Theme + mode → preview. Also re-sent once the preview signals ready so a
// non-default initial theme (e.g. neutral) applies even if this effect first
- // ran before the iframe was listening.
+ // ran before the iframe was listening. Once the Theme editor has produced a
+ // theme (seeded via ?theme= or edited by the user), it becomes the source of
+ // truth and is applied across ALL views (Code / Properties / Theme) so the
+ // preview stays consistent when switching tabs and when toggling light/dark.
useEffect(() => {
- iframeRef.current?.contentWindow?.postMessage(
- {type: 'preview-theme', theme, mode},
- window.location.origin,
- );
- }, [mode, previewReady]);
+ const win = iframeRef.current?.contentWindow;
+ if (!win) {
+ return;
+ }
+ if (customThemeRef.current) {
+ const custom = customThemeRef.current;
+ win.postMessage(
+ {
+ type: 'preview-theme',
+ customTokens: custom.tokens,
+ customComponents: custom.components,
+ mode,
+ },
+ window.location.origin,
+ );
+ } else {
+ win.postMessage(
+ {type: 'preview-theme', theme, mode},
+ window.location.origin,
+ );
+ }
+ }, [mode, previewReady, activeView, theme]);
// While the resize handle is dragged, the cursor can pass over the preview
// iframe — a separate document that swallows pointer events and stalls the
@@ -704,6 +747,13 @@ export function PlaygroundClient() {
isIconOnly
icon={<SlidersHorizontal size={20} />}
/>
+ <XDSToggleButton
+ value="theme"
+ label="Theme"
+ tooltip="Theme"
+ isIconOnly
+ icon={<Palette size={20} />}
+ />
</XDSToggleButtonGroup>
</XDSVStack>
@@ -714,9 +764,18 @@ export function PlaygroundClient() {
onPointerDownCapture={handleResizeProbe}>
{/* Left panel — editor */}
<XDSVStack xstyle={s.leftPanel} width={editorPanel.size || 440}>
- <div {...stylex.props(s.leftPanelHeader)}>
+ <XDSHStack
+ justify="between"
+ align="center"
+ xstyle={s.leftPanelHeader}>
<XDSHeading level={3}>Playground</XDSHeading>
- </div>
+ {activeView === 'code' && (
+ <XDSButton variant="secondary" size="sm" label="Copy Code" />
+ )}
+ {activeView === 'theme' && (
+ <XDSButton variant="secondary" size="sm" label="Export Theme" />
+ )}
+ </XDSHStack>
<div {...stylex.props(s.tabBody)}>
{/* Code: Monaco stays mounted to preserve typedefs + editor state */}
<div
@@ -752,6 +811,21 @@ export function PlaygroundClient() {
}}
/>
)}
+
+ {/* Theme: stays mounted (hidden when inactive) to preserve the
+ editor's token/component state across tab switches — it only
+ changes when the user edits it, not on navigation. */}
+ <div
+ {...stylex.props(
+ s.themePane,
+ activeView !== 'theme' && s.hidden,
+ )}>
+ <PlaygroundThemeEditor
+ mode={mode}
+ initialTheme={editorInitialTheme}
+ onThemeChange={postCustomTheme}
+ />
+ </div>
</div>
</XDSVStack>
diff --git a/apps/docsite/src/app/playground/defaultCode.ts b/apps/docsite/src/app/playground/defaultCode.ts
new file mode 100644
index 0000000000..1d52ea02fb
--- /dev/null
+++ b/apps/docsite/src/app/playground/defaultCode.ts
@@ -0,0 +1,1218 @@
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+
+/**
+ * @file defaultCode.ts
+ * @output The default TSX source shown in the playground's Monaco editor.
+ * @position Playground — the initial example users see and edit.
+ *
+ * A self-contained, no-prop adaptation of ThemeCardShowcase so it runs in the
+ * preview sandbox (see (preview)/playground-preview/scope.ts). Kept as a string
+ * because the playground edits/compiles it as user code rather than importing it.
+ *
+ * The sandbox mocks @stylexjs/stylex: `stylex.props()` returns no styles, so raw
+ * elements (div/img/span) must apply `styles.X` via the `style` prop. `xstyle`
+ * on XDS components still works because the real stylex runtime inside @xds/core
+ * treats the plain style objects as inline styles.
+ */
+
+export const DEFAULT_CODE = `import {type ReactNode} from 'react';
+import * as stylex from '@stylexjs/stylex';
+import {
+ Plus,
+ Search,
+ Tag,
+ Folder,
+ MapPin,
+ List,
+ LayoutGrid,
+ ShoppingBag,
+ Banknote,
+ Mic,
+ CreditCard,
+ Lock,
+ X,
+ Download,
+ Smartphone,
+ Wallet,
+ User,
+} from 'lucide-react';
+import {XDSText, XDSHeading} from '@xds/core/Text';
+import {XDSVStack, XDSHStack} from '@xds/core/Layout';
+import {XDSGrid, XDSGridSpan} from '@xds/core/Grid';
+import {XDSCard} from '@xds/core/Card';
+import {XDSButton} from '@xds/core/Button';
+import {XDSLink} from '@xds/core/Link';
+import {XDSBadge} from '@xds/core/Badge';
+import {XDSBanner} from '@xds/core/Banner';
+import {XDSDivider} from '@xds/core/Divider';
+import {XDSCheckboxInput} from '@xds/core/CheckboxInput';
+import {XDSItem} from '@xds/core/Item';
+import {XDSTable, proportional, pixel} from '@xds/core/Table';
+import {XDSTextInput} from '@xds/core/TextInput';
+import {XDSSelector} from '@xds/core/Selector';
+import {XDSRadioList, XDSRadioListItem} from '@xds/core/RadioList';
+import {XDSSelectableCard} from '@xds/core/SelectableCard';
+import {XDSMoreMenu} from '@xds/core/MoreMenu';
+import {XDSCenter} from '@xds/core/Center';
+import {XDSSection} from '@xds/core/Section';
+import {XDSAspectRatio} from '@xds/core/AspectRatio';
+import {XDSNumberInput} from '@xds/core/NumberInput';
+import {XDSTopNav, XDSTopNavHeading, XDSTopNavItem} from '@xds/core/TopNav';
+import {
+ XDSChatComposer,
+ XDSChatMessage,
+ XDSChatMessageBubble,
+ XDSChatMessageList,
+ XDSChatSystemMessage,
+} from '@xds/core/Chat';
+
+const styles = stylex.create({
+ card: {
+ backgroundColor: 'var(--color-background-body)',
+ color: 'var(--color-text-primary)',
+ minWidth: 0,
+ borderColor: 'transparent',
+ },
+ checkoutStack: {
+ minWidth: 0,
+ width: '100%',
+ },
+ paymentCardContent: {
+ minWidth: 0,
+ width: '100%',
+ textAlign: 'center',
+ wordBreak: 'break-word',
+ },
+ fullSpanAtNarrow: {
+ gridColumn: {
+ default: null,
+ '@media (max-width: 1024px)': '1 / -1',
+ },
+ },
+ inventoryCard: {
+ backgroundColor: 'var(--color-background-surface)',
+ color: 'var(--color-text-primary)',
+ overflow: 'hidden',
+ },
+ inventoryHeader: {
+ paddingBlock: 'var(--spacing-6)',
+ paddingInline: 'var(--spacing-6)',
+ },
+ inventoryFilterRow: {
+ paddingBlock: 'var(--spacing-4)',
+ paddingInline: 'var(--spacing-6)',
+ width: '100%',
+ },
+ inventoryBannerWrap: {
+ paddingInline: 'var(--spacing-6)',
+ paddingBottom: 'var(--spacing-4)',
+ },
+ searchInput: {
+ flex: 1,
+ minWidth: 0,
+ maxWidth: 240,
+ },
+ thumbnail: {
+ width: 32,
+ height: 32,
+ borderRadius: 'var(--radius-element)',
+ objectFit: 'cover' as const,
+ display: 'block',
+ flexShrink: 0,
+ },
+ thumbnailFallback: {
+ width: 32,
+ height: 32,
+ borderRadius: 'var(--radius-element)',
+ backgroundColor: 'var(--color-background-muted)',
+ color: 'var(--color-text-secondary)',
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ fontSize: 'var(--font-size-sm)',
+ fontWeight: 600,
+ flexShrink: 0,
+ },
+ activityCard: {
+ backgroundColor: 'var(--color-background-surface)',
+ color: 'var(--color-text-primary)',
+ minWidth: 0,
+ height: '100%',
+ },
+ sparkline: {
+ display: 'flex',
+ alignItems: 'flex-end',
+ justifyContent: 'space-around',
+ height: 120,
+ width: '100%',
+ gap: 8,
+ },
+ sparkBar: {
+ flex: 1,
+ minWidth: 0,
+ borderRadius: 'var(--radius-element)',
+ backgroundColor: 'var(--color-background-green)',
+ },
+ sparkLabels: {
+ display: 'flex',
+ justifyContent: 'space-around',
+ width: '100%',
+ color: 'var(--color-text-secondary)',
+ fontSize: 'var(--font-size-xs)',
+ },
+ kpiValue: {
+ fontSize: 24,
+ fontWeight: 700,
+ lineHeight: 1.1,
+ color: 'var(--color-text-primary)',
+ fontFamily: 'var(--font-family-heading)',
+ letterSpacing: '-0.01em',
+ },
+ chatCard: {
+ backgroundColor: 'var(--color-background-surface)',
+ color: 'var(--color-text-primary)',
+ minWidth: 0,
+ overflow: 'hidden',
+ display: 'flex',
+ flexDirection: 'column' as const,
+ },
+ chatHeader: {
+ paddingBlock: 'var(--spacing-4)',
+ paddingInline: 'var(--spacing-4)',
+ },
+ chatBody: {
+ flex: 1,
+ minHeight: 0,
+ overflow: 'hidden',
+ },
+ chatSuggestions: {
+ paddingInline: 'var(--spacing-4)',
+ paddingBottom: 'var(--spacing-2)',
+ },
+ chatComposer: {
+ paddingInline: 'var(--spacing-4)',
+ paddingBottom: 'var(--spacing-4)',
+ },
+ activityIcon: {
+ width: 32,
+ height: 32,
+ borderRadius: 'var(--radius-full)',
+ backgroundColor: 'var(--color-background-muted)',
+ color: 'var(--color-text-secondary)',
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ flexShrink: 0,
+ },
+ activityCardStack: {
+ height: '100%',
+ },
+ activityListFade: {
+ flex: 1,
+ minHeight: 0,
+ overflow: 'hidden',
+ maskImage:
+ 'linear-gradient(to bottom, black calc(100% - 48px), transparent)',
+ WebkitMaskImage:
+ 'linear-gradient(to bottom, black calc(100% - 48px), transparent)',
+ marginInline: 'calc(var(--spacing-2) * -1)',
+ },
+ content: {
+ maxWidth: 960,
+ marginInline: 'auto',
+ },
+ contentFluid: {
+ maxWidth: 880,
+ },
+ heroText: {
+ textAlign: 'center' as const,
+ maxWidth: 560,
+ },
+ centerText: {
+ textAlign: 'center',
+ },
+ productImage: {
+ width: '100%',
+ height: '100%',
+ objectFit: 'cover' as const,
+ },
+ cardStack: {
+ height: '100%',
+ },
+ cardBody: {
+ padding: 'var(--spacing-4)',
+ flex: 1,
+ display: 'flex',
+ flexDirection: 'column' as const,
+ },
+ cardDescription: {
+ flex: 1,
+ },
+ quantityInput: {
+ width: 40,
+ flexShrink: 0,
+ },
+ cartButton: {
+ flex: 1,
+ },
+});
+
+const PRODUCT_IMAGE_KEYS = ['watch', 'headphones', 'backpack'];
+
+const PRODUCTS = [
+ {
+ name: 'Minimalist Watch',
+ description: 'Clean design meets everyday durability.',
+ badge: 'New',
+ badgeVariant: 'blue' as const,
+ },
+ {
+ name: 'Wireless Headphones',
+ description: 'Immersive sound, all-day comfort.',
+ badge: 'Popular',
+ badgeVariant: 'green' as const,
+ },
+ {
+ name: 'Canvas Backpack',
+ description: 'Water-resistant canvas with a quiet, modern profile.',
+ badge: 'Limited',
+ badgeVariant: 'yellow' as const,
+ },
+];
+
+const PREVIEW_IMAGES: Record<string, string> = {
+ watch: '/neutral/preview-watch.png',
+ headphones: '/neutral/preview-headphones.png',
+ backpack: '/neutral/preview-backpack.png',
+ wallet: '/neutral/preview-wallet.png',
+ mug: '/neutral/preview-mug.png',
+ throw_: '/neutral/preview-throw.png',
+};
+
+export default function ThemeShowcase() {
+ const images: Record<string, string> = PREVIEW_IMAGES;
+ return (
+ <div
+ style={{
+ minHeight: '100%',
+ backgroundColor: 'var(--color-background-body)',
+ }}>
+ <StorePreview images={images} />
+ <div
+ style={{
+ padding: 'var(--spacing-6)',
+ backgroundColor: 'var(--color-background-surface)',
+ }}>
+ <CardShowcase images={images} />
+ </div>
+ </div>
+ );
+}
+
+function CardShowcase({images}: {images: Record<string, string>}) {
+ return (
+ <XDSVStack gap={8}>
+ <XDSGrid columns={{minWidth: 200, repeat: 'fit'}} gap={4}>
+ <XDSGridSpan columns={1} xstyle={styles.fullSpanAtNarrow}>
+ <CheckoutCard />
+ </XDSGridSpan>
+ <XDSGridSpan columns={2} xstyle={styles.fullSpanAtNarrow}>
+ <ChatCard />
+ </XDSGridSpan>
+ </XDSGrid>
+ <XDSGrid columns={{minWidth: 200, repeat: 'fit'}} gap={4}>
+ <XDSGridSpan columns={3} xstyle={styles.fullSpanAtNarrow}>
+ <InventoryCard images={images} />
+ </XDSGridSpan>
+ <XDSGridSpan columns={1} xstyle={styles.fullSpanAtNarrow}>
+ <LatestActivityCard />
+ </XDSGridSpan>
+ </XDSGrid>
+ </XDSVStack>
+ );
+}
+
+function StorePreview({images}: {images: Record<string, string>}) {
+ return (
+ <div data-theme-preview="true">
+ <XDSVStack gap={0}>
+ <XDSTopNav
+ label="Theme preview navigation"
+ heading={<XDSTopNavHeading heading="Studio" />}
+ centerContent={
+ <>
+ <XDSTopNavItem label="Shop" href="#" isSelected />
+ <XDSTopNavItem label="New In" href="#" />
+ <XDSTopNavItem label="Stories" href="#" />
+ <XDSTopNavItem label="Help" href="#" />
+ </>
+ }
+ endContent={
+ <XDSHStack gap={2} vAlign="center">
+ <XDSHStack gap={0.5}>
+ <XDSButton
+ label="Search"
+ tooltip="Search"
+ variant="ghost"
+ isIconOnly
+ icon={<Search size={20} />}
+ href="#"
+ />
+ <XDSButton
+ label="Account"
+ tooltip="Account"
+ variant="ghost"
+ isIconOnly
+ icon={<User size={20} />}
+ href="#"
+ />
+ <XDSButton
+ label="Cart"
+ tooltip="Cart"
+ variant="ghost"
+ isIconOnly
+ icon={<ShoppingBag size={20} />}
+ href="#"
+ />
+ </XDSHStack>
+ <XDSButton label="Sign in" variant="primary" href="#" />
+ </XDSHStack>
+ }
+ />
+
+ <XDSSection padding={8} variant="transparent">
+ <XDSVStack gap={10} xstyle={[styles.content, styles.contentFluid]}>
+ <XDSCenter>
+ <XDSVStack gap={4} hAlign="center" xstyle={styles.heroText}>
+ <XDSText type="display-3">
+ Little joys,
+ <br />
+ everywhere you go
+ </XDSText>
+ <XDSText type="body" color="secondary">
+ We believe the smallest details are the ones that matter most.
+ Turn an ordinary day into something worth remembering.
+ </XDSText>
+ </XDSVStack>
+ </XDSCenter>
+
+ <XDSGrid columns={{minWidth: 240}} gap={4}>
+ {PRODUCTS.map((p, i) => (
+ <XDSCard key={p.name} padding={0} height="100%">
+ <XDSVStack gap={0} xstyle={styles.cardStack}>
+ <XDSAspectRatio ratio={1}>
+ <img
+ src={images[PRODUCT_IMAGE_KEYS[i]]}
+ alt={p.name}
+ style={styles.productImage}
+ />
+ </XDSAspectRatio>
+ <div style={styles.cardBody}>
+ <XDSVStack
+ gap={2}
+ hAlign="center"
+ xstyle={styles.cardStack}>
+ <XDSHStack>
+ <XDSBadge label={p.badge} variant={p.badgeVariant} />
+ </XDSHStack>
+ <XDSHeading level={2} xstyle={styles.centerText}>
+ {p.name}
+ </XDSHeading>
+ <XDSText
+ type="supporting"
+ color="secondary"
+ xstyle={[styles.cardDescription, styles.centerText]}>
+ {p.description}
+ </XDSText>
+ <XDSHStack gap={2} vAlign="center" hAlign="center">
+ <XDSNumberInput
+ label="Quantity"
+ isLabelHidden
+ value={1}
+ onChange={() => {}}
+ min={1}
+ max={99}
+ size="sm"
+ xstyle={styles.quantityInput}
+ />
+ <XDSButton
+ label="Add to cart"
+ variant="secondary"
+ href="#"
+ xstyle={styles.cartButton}
+ />
+ </XDSHStack>
+ </XDSVStack>
+ </div>
+ </XDSVStack>
+ </XDSCard>
+ ))}
+ </XDSGrid>
+ </XDSVStack>
+ </XDSSection>
+ </XDSVStack>
+ </div>
+ );
+}
+
+function CheckoutCard() {
+ return (
+ <XDSCard padding={5} xstyle={styles.card}>
+ <XDSVStack gap={4} xstyle={styles.checkoutStack}>
+ <XDSHeading level={2}>Checkout</XDSHeading>
+
+ <XDSVStack gap={3} xstyle={styles.checkoutStack}>
+ <XDSTextInput
+ label="Email"
+ placeholder="[email protected]"
+ value=""
+ onChange={() => {}}
+ size="lg"
+ />
+
+ <XDSRadioList
+ label="Shipping method"
+ description="Delivery time may vary based on location and availability."
+ value="economy"
+ onChange={() => {}}>
+ <XDSRadioListItem
+ value="economy"
+ label="Economy Shipping"
+ description="Delivered in 5–7 business days"
+ endContent={
+ <XDSText type="body" weight="bold">
+ $12.00
+ </XDSText>
+ }
+ />
+ <XDSRadioListItem
+ value="standard"
+ label="Standard Shipping"
+ description="Delivered in 3–5 business days"
+ endContent={
+ <XDSText type="body" weight="bold">
+ $16.00
+ </XDSText>
+ }
+ />
+ <XDSRadioListItem
+ value="express"
+ label="Express Shipping"
+ description="Delivered in 1–2 business days"
+ endContent={
+ <XDSText type="body" weight="bold">
+ $24.00
+ </XDSText>
+ }
+ />
+ </XDSRadioList>
+
+ <XDSVStack gap={2} xstyle={styles.checkoutStack}>
+ <XDSText type="supporting" weight="bold">
+ Payment method
+ </XDSText>
+ <XDSGrid columns={{minWidth: 70, max: 3}} gap={2}>
+ <XDSSelectableCard
+ label="Pay with card"
+ isSelected={true}
+ onChange={() => {}}
+ padding={3}>
+ <XDSVStack
+ gap={1}
+ hAlign="center"
+ xstyle={styles.paymentCardContent}>
+ <CreditCard size={20} />
+ <XDSText type="supporting" weight="bold">
+ Card
+ </XDSText>
+ </XDSVStack>
+ </XDSSelectableCard>
+ <XDSSelectableCard
+ label="Pay with Apple Pay"
+ isSelected={false}
+ onChange={() => {}}
+ padding={3}>
+ <XDSVStack
+ gap={1}
+ hAlign="center"
+ xstyle={styles.paymentCardContent}>
+ <Smartphone size={20} />
+ <XDSText type="supporting" weight="bold">
+ Apple Pay
+ </XDSText>
+ </XDSVStack>
+ </XDSSelectableCard>
+ <XDSSelectableCard
+ label="Pay with Google Pay"
+ isSelected={false}
+ onChange={() => {}}
+ padding={3}>
+ <XDSVStack
+ gap={1}
+ hAlign="center"
+ xstyle={styles.paymentCardContent}>
+ <Wallet size={20} />
+ <XDSText type="supporting" weight="bold">
+ Google Pay
+ </XDSText>
+ </XDSVStack>
+ </XDSSelectableCard>
+ </XDSGrid>
+ </XDSVStack>
+
+ <XDSTextInput
+ label="Card number"
+ placeholder="1234 1234 1234 1234"
+ value=""
+ onChange={() => {}}
+ startIcon={<CreditCard size={16} />}
+ size="lg"
+ />
+
+ <XDSGrid columns={{minWidth: 90, max: 2}} gap={2}>
+ <XDSTextInput
+ label="Expiry"
+ placeholder="MM / YY"
+ value=""
+ onChange={() => {}}
+ size="lg"
+ />
+ <XDSTextInput
+ label="CVC"
+ placeholder="123"
+ value=""
+ onChange={() => {}}
+ size="lg"
+ />
+ </XDSGrid>
+
+ <XDSSelector
+ label="Country"
+ value="us"
+ onChange={() => {}}
+ size="lg"
+ options={[
+ {value: 'us', label: 'United States'},
+ {value: 'ca', label: 'Canada'},
+ {value: 'uk', label: 'United Kingdom'},
+ {value: 'de', label: 'Germany'},
+ {value: 'jp', label: 'Japan'},
+ {value: 'au', label: 'Australia'},
+ ]}
+ />
+ </XDSVStack>
+
+ <XDSCheckboxInput
+ label="Securely save my information for 1-click checkout"
+ description="Pay faster on Studio and everywhere Link is accepted."
+ value={true}
+ onChange={() => {}}
+ />
+
+ <XDSButton
+ variant="primary"
+ size="lg"
+ label="Pay now"
+ icon={<Lock size={16} />}
+ />
+ </XDSVStack>
+ </XDSCard>
+ );
+}
+
+const SUGGESTED_QUESTIONS = [
+ 'Reschedule delivery',
+ 'Update shipping address',
+ 'Start a return',
+];
+
+function ChatCard() {
+ return (
+ <XDSCard padding={0} xstyle={styles.chatCard}>
+ <XDSHStack
+ hAlign="between"
+ vAlign="center"
+ gap={3}
+ xstyle={styles.chatHeader}>
+ <XDSHeading level={2}>Studio AI</XDSHeading>
+
+ <XDSHStack gap={1} vAlign="center">
+ <XDSButton
+ variant="ghost"
+ size="sm"
+ isIconOnly
+ label="Export conversation"
+ tooltip="Export conversation"
+ icon={<Download size={16} />}
+ />
+ <XDSButton
+ variant="ghost"
+ size="sm"
+ isIconOnly
+ label="Close chat"
+ tooltip="Close chat"
+ icon={<X size={16} />}
+ />
+ </XDSHStack>
+ </XDSHStack>
+
+ <XDSDivider variant="subtle" />
+
+ <div style={styles.chatBody}>
+ <XDSChatMessageList>
+ <XDSChatSystemMessage>Today</XDSChatSystemMessage>
+
+ <XDSChatMessage sender="user">
+ <XDSChatMessageBubble variant="filled">
+ Where’s my order?
+ </XDSChatMessageBubble>
+ </XDSChatMessage>
+
+ <XDSChatMessage sender="assistant">
+ <XDSVStack gap={3}>
+ <XDSText type="body">
+ Your order #1043 — the Minimalist Watch and Linen Throw —
+ shipped this morning from the Aisle 3 warehouse and is currently
+ in transit with UPS. It’s on track to arrive at your address by
+ end of day tomorrow.
+ </XDSText>
+ <XDSText type="body">
+ Let me know if you’d like to reschedule the delivery, redirect
+ it to a pickup point, or start a return once it arrives.
+ </XDSText>
+ </XDSVStack>
+ </XDSChatMessage>
+
+ <XDSChatMessage sender="user">
+ <XDSChatMessageBubble variant="filled">
+ Can you show me the full details?
+ </XDSChatMessageBubble>
+ </XDSChatMessage>
+
+ <XDSChatMessage sender="assistant">
+ <XDSVStack gap={3}>
+ <XDSText type="body">
+ Here’s everything I have on order #1043:
+ </XDSText>
+ <XDSCard padding={3}>
+ <XDSVStack gap={1}>
+ <XDSItem
+ label="Items"
+ description="Minimalist Watch · Linen Throw"
+ trailing={
+ <XDSText type="body" weight="bold">
+ $248
+ </XDSText>
+ }
+ />
+ <XDSItem
+ label="Shipping"
+ description="UPS Ground"
+ trailing={
+ <XDSText type="body" weight="bold">
+ $12
+ </XDSText>
+ }
+ />
+ <XDSItem
+ label="Estimated arrival"
+ description="Tomorrow by 8pm"
+ trailing={<XDSBadge variant="green" label="On time" />}
+ />
+ <XDSItem
+ label="Tracking"
+ description="UPS 1Z 999 AA1 0123 4567 84"
+ trailing={<XDSLink href="#">Track →</XDSLink>}
+ />
+ </XDSVStack>
+ </XDSCard>
+ </XDSVStack>
+ </XDSChatMessage>
+ </XDSChatMessageList>
+ </div>
+
+ <div style={styles.chatSuggestions}>
+ <XDSHStack gap={1} hAlign="center" wrap="wrap">
+ {SUGGESTED_QUESTIONS.map(question => (
+ <XDSButton
+ key={question}
+ variant="secondary"
+ size="sm"
+ label={question}
+ />
+ ))}
+ </XDSHStack>
+ </div>
+
+ <div style={styles.chatComposer}>
+ <XDSChatComposer
+ value=""
+ onChange={() => {}}
+ onSubmit={() => {}}
+ placeholder="Ask Studio AI…"
+ footerActions={
+ <XDSButton
+ variant="ghost"
+ size="md"
+ isIconOnly
+ label="Attach"
+ tooltip="Attach"
+ icon={<Plus size={16} />}
+ />
+ }
+ sendActions={
+ <XDSButton
+ variant="ghost"
+ size="md"
+ isIconOnly
+ label="Voice input"
+ tooltip="Voice input"
+ icon={<Mic size={16} />}
+ />
+ }
+ />
+ </div>
+ </XDSCard>
+ );
+}
+
+const SPARKLINE_DATA = [55, 70, 92, 78, 60];
+const SPARKLINE_LABELS = ['Jan', 'Feb', 'Mar', 'Apr', 'May'];
+
+interface ActivityRow {
+ id: string;
+ icon: ReactNode;
+ label: string;
+ detail: string;
+ time: string;
+ amount: number;
+}
+
+const ACTIVITY: ActivityRow[] = [
+ {
+ id: '1',
+ icon: <ShoppingBag size={16} />,
+ label: 'Order #1043',
+ detail: 'Placed · 1:59 pm',
+ time: '1:59 pm',
+ amount: 248,
+ },
+ {
+ id: '2',
+ icon: <Banknote size={16} />,
+ label: 'Order #1041',
+ detail: 'Refunded · 12:40 pm',
+ time: '12:40 pm',
+ amount: -89,
+ },
+ {
+ id: '3',
+ icon: <ShoppingBag size={16} />,
+ label: 'Order #1040',
+ detail: 'Placed · 10:30 am',
+ time: '10:30 am',
+ amount: 156,
+ },
+ {
+ id: '4',
+ icon: <ShoppingBag size={16} />,
+ label: 'Order #1038',
+ detail: 'Placed · 9:11 am',
+ time: '9:11 am',
+ amount: 412,
+ },
+ {
+ id: '5',
+ icon: <ShoppingBag size={16} />,
+ label: 'Order #1037',
+ detail: 'Placed · 8:42 am',
+ time: '8:42 am',
+ amount: 95,
+ },
+];
+
+function formatAmount(amount: number): string {
+ const sign = amount < 0 ? '−' : '+';
+ return sign + '$' + Math.abs(amount).toLocaleString();
+}
+
+function LatestActivityCard() {
+ return (
+ <XDSCard padding={5} xstyle={styles.activityCard}>
+ <XDSVStack gap={4} xstyle={styles.activityCardStack}>
+ <XDSHeading level={2}>Revenue</XDSHeading>
+
+ <XDSVStack gap={2}>
+ <div style={styles.sparkline} aria-hidden="true">
+ {SPARKLINE_DATA.map((value, i) => (
+ <div
+ key={i}
+ style={{...styles.sparkBar, height: value + '%'}}
+ />
+ ))}
+ </div>
+ <div style={styles.sparkLabels} aria-hidden="true">
+ {SPARKLINE_LABELS.map(label => (
+ <span key={label}>{label}</span>
+ ))}
+ </div>
+ </XDSVStack>
+
+ <XDSGrid columns={2} gap={3}>
+ <XDSVStack gap={0}>
+ <span style={styles.kpiValue}>18K</span>
+ <XDSText type="supporting" color="secondary">
+ Monthly revenue
+ </XDSText>
+ </XDSVStack>
+ <XDSVStack gap={0}>
+ <span style={styles.kpiValue}>+12%</span>
+ <XDSText type="supporting" color="secondary">
+ Order growth
+ </XDSText>
+ </XDSVStack>
+ </XDSGrid>
+
+ <XDSDivider variant="subtle" />
+
+ <XDSHStack hAlign="between" vAlign="center">
+ <XDSHeading level={3}>Activity</XDSHeading>
+ <XDSLink href="#">See all</XDSLink>
+ </XDSHStack>
+
+ <XDSVStack gap={1} xstyle={styles.activityListFade}>
+ {ACTIVITY.map(item => (
+ <XDSItem
+ key={item.id}
+ media={
+ <div style={styles.activityIcon} aria-hidden="true">
+ {item.icon}
+ </div>
+ }
+ label={item.label}
+ description={item.detail}
+ trailing={
+ <XDSText
+ type="body"
+ weight="bold"
+ color={item.amount < 0 ? 'secondary' : 'primary'}>
+ {formatAmount(item.amount)}
+ </XDSText>
+ }
+ href="#"
+ />
+ ))}
+ </XDSVStack>
+ </XDSVStack>
+ </XDSCard>
+ );
+}
+
+type TagSpec = {label: string; variant: 'blue' | 'green' | 'orange' | 'yellow'};
+
+interface InventoryRow extends Record<string, unknown> {
+ id: string;
+ name: string;
+ meta: string;
+ available: number;
+ location: string;
+ tags: TagSpec[];
+ imageKey?: string;
+ thumbnailFallback: string;
+ selected: boolean;
+}
+
+const INVENTORY: InventoryRow[] = [
+ {
+ id: 'a',
+ name: 'Minimalist Watch',
+ meta: 'Stainless steel, sapphire crystal',
+ available: 42,
+ location: 'Aisle 3',
+ tags: [{label: 'New', variant: 'blue'}],
+ imageKey: 'watch',
+ thumbnailFallback: 'M',
+ selected: false,
+ },
+ {
+ id: 'b',
+ name: 'Wireless Headphones',
+ meta: 'ANC, 30hr battery',
+ available: 128,
+ location: 'Aisle 1',
+ tags: [{label: 'Popular', variant: 'green'}],
+ imageKey: 'headphones',
+ thumbnailFallback: 'W',
+ selected: true,
+ },
+ {
+ id: 'c',
+ name: 'Canvas Backpack',
+ meta: 'Water-resistant, 25L',
+ available: 63,
+ location: 'Aisle 2',
+ tags: [{label: 'Limited', variant: 'yellow'}],
+ imageKey: 'backpack',
+ thumbnailFallback: 'C',
+ selected: false,
+ },
+ {
+ id: 'd',
+ name: 'Leather Wallet',
+ meta: 'Full-grain, RFID blocking',
+ available: 15,
+ location: 'Aisle 4',
+ tags: [{label: 'Leather', variant: 'yellow'}],
+ imageKey: 'wallet',
+ thumbnailFallback: 'L',
+ selected: true,
+ },
+ {
+ id: 'e',
+ name: 'Travel Mug',
+ meta: 'Vacuum insulated, 16oz',
+ available: 87,
+ location: 'Aisle 5',
+ tags: [{label: 'Drinkware', variant: 'green'}],
+ imageKey: 'mug',
+ thumbnailFallback: 'T',
+ selected: false,
+ },
+ {
+ id: 'f',
+ name: 'Linen Throw',
+ meta: 'Heavyweight, oat',
+ available: 24,
+ location: 'Aisle 6',
+ tags: [{label: 'Home', variant: 'orange'}],
+ imageKey: 'throw_',
+ thumbnailFallback: 'L',
+ selected: true,
+ },
+];
+
+const LOW_STOCK_THRESHOLD = 25;
+const LOW_STOCK_COUNT = INVENTORY.filter(
+ row => row.available < LOW_STOCK_THRESHOLD,
+).length;
+
+function SelectCell({row}: {row: InventoryRow}) {
+ return (
+ <XDSCheckboxInput
+ label={'Select ' + row.name}
+ isLabelHidden
+ value={row.selected}
+ onChange={() => {}}
+ />
+ );
+}
+
+function ItemCell({
+ row,
+ images,
+}: {
+ row: InventoryRow;
+ images: Record<string, string>;
+}) {
+ const thumbnailSrc = row.imageKey ? images[row.imageKey] : undefined;
+ return (
+ <XDSHStack gap={3} vAlign="center">
+ {thumbnailSrc ? (
+ <img src={thumbnailSrc} alt="" style={styles.thumbnail} />
+ ) : (
+ <div style={styles.thumbnailFallback} aria-hidden="true">
+ {row.thumbnailFallback}
+ </div>
+ )}
+ <XDSVStack gap={0} style={{minWidth: 0}}>
+ <XDSText type="body" weight="bold">
+ {row.name}
+ </XDSText>
+ <XDSText type="supporting" color="secondary">
+ {row.meta}
+ </XDSText>
+ </XDSVStack>
+ </XDSHStack>
+ );
+}
+
+function TagsCell({row}: {row: InventoryRow}) {
+ return (
+ <XDSHStack gap={1} wrap="wrap" hAlign="end">
+ {row.tags.map(tag => (
+ <XDSBadge key={tag.label} label={tag.label} variant={tag.variant} />
+ ))}
+ </XDSHStack>
+ );
+}
+
+function ActionsCell() {
+ return (
+ <XDSMoreMenu
+ label="Row actions"
+ items={[
+ {label: 'Edit'},
+ {label: 'Duplicate'},
+ {label: 'Move to…'},
+ {type: 'divider'},
+ {label: 'Delete'},
+ ]}
+ />
+ );
+}
+
+function InventoryCard({images}: {images: Record<string, string>}) {
+ return (
+ <XDSCard padding={0} xstyle={styles.inventoryCard}>
+ <XDSHStack
+ hAlign="between"
+ vAlign="center"
+ xstyle={styles.inventoryHeader}>
+ <XDSHeading level={2}>Inventory</XDSHeading>
+ <XDSButton
+ label="Add item"
+ variant="primary"
+ size="sm"
+ icon={<Plus size={16} />}
+ />
+ </XDSHStack>
+
+ <XDSDivider variant="subtle" />
+
+ <XDSHStack
+ gap={3}
+ vAlign="center"
+ hAlign="between"
+ xstyle={styles.inventoryFilterRow}>
+ <XDSHStack gap={2} vAlign="center" style={{flex: 1, minWidth: 0}}>
+ <XDSTextInput
+ label="Search inventory"
+ isLabelHidden
+ placeholder="Type and hit enter…"
+ value=""
+ onChange={() => {}}
+ startIcon={<Search size={16} />}
+ xstyle={styles.searchInput}
+ />
+ <XDSSelector
+ label="Categories"
+ isLabelHidden
+ placeholder="Categories"
+ size="sm"
+ startIcon={<Folder size={16} />}
+ value={undefined}
+ onChange={() => {}}
+ options={['Wearables', 'Audio', 'Bags', 'Drinkware', 'Home']}
+ />
+ <XDSSelector
+ label="Locations"
+ isLabelHidden
+ placeholder="Locations"
+ size="sm"
+ startIcon={<MapPin size={16} />}
+ value={undefined}
+ onChange={() => {}}
+ options={[
+ 'Aisle 1',
+ 'Aisle 2',
+ 'Aisle 3',
+ 'Aisle 4',
+ 'Aisle 5',
+ 'Aisle 6',
+ ]}
+ />
+ <XDSSelector
+ label="Tags"
+ isLabelHidden
+ placeholder="Tags"
+ size="sm"
+ startIcon={<Tag size={16} />}
+ value={undefined}
+ onChange={() => {}}
+ options={[
+ 'New',
+ 'Popular',
+ 'Limited',
+ 'Leather',
+ 'Drinkware',
+ 'Home',
+ ]}
+ />
+ </XDSHStack>
+ <XDSHStack gap={1} vAlign="center">
+ <XDSButton
+ variant="ghost"
+ size="sm"
+ isIconOnly
+ label="List view"
+ tooltip="List view"
+ icon={<List size={18} />}
+ />
+ <XDSButton
+ variant="ghost"
+ size="sm"
+ isIconOnly
+ label="Grid view"
+ tooltip="Grid view"
+ icon={<LayoutGrid size={18} />}
+ />
+ </XDSHStack>
+ </XDSHStack>
+
+ {LOW_STOCK_COUNT > 0 && (
+ <div style={styles.inventoryBannerWrap}>
+ <XDSBanner
+ status="warning"
+ title={LOW_STOCK_COUNT + ' items are running low'}
+ />
+ </div>
+ )}
+
+ <XDSTable<InventoryRow>
+ data={INVENTORY}
+ columns={[
+ {
+ key: 'select',
+ header: '',
+ width: pixel(48),
+ renderCell: row => <SelectCell row={row} />,
+ },
+ {
+ key: 'item',
+ header: 'Item',
+ width: proportional(3),
+ renderCell: row => <ItemCell row={row} images={images} />,
+ },
+ {
+ key: 'available',
+ header: 'Available',
+ width: pixel(100),
+ renderCell: row => <XDSText type="body">{row.available}</XDSText>,
+ },
+ {
+ key: 'location',
+ header: 'Location',
+ width: pixel(100),
+ renderCell: row => <XDSText type="body">{row.location}</XDSText>,
+ },
+ {
+ key: 'tags',
+ header: 'Tags',
+ width: proportional(2),
+ align: 'end',
+ renderCell: row => <TagsCell row={row} />,
+ },
+ {
+ key: 'actions',
+ header: '',
+ width: pixel(48),
+ renderCell: () => <ActionsCell />,
+ },
+ ]}
+ density="spacious"
+ dividers="rows"
+ hasHover
+ />
+ </XDSCard>
+ );
+}`;
diff --git a/apps/docsite/src/app/playground/page.tsx b/apps/docsite/src/app/playground/page.tsx
index 691039ee04..845abd2b7b 100644
--- a/apps/docsite/src/app/playground/page.tsx
+++ b/apps/docsite/src/app/playground/page.tsx
@@ -1,6 +1,7 @@
// Copyright (c) Meta Platforms, Inc. and affiliates.
import type {Metadata} from 'next';
+import {Suspense} from 'react';
import {PlaygroundClient} from './PlaygroundClient';
export const metadata: Metadata = {
@@ -9,5 +10,9 @@ export const metadata: Metadata = {
};
export default function PlaygroundPage() {
- return <PlaygroundClient />;
+ return (
+ <Suspense fallback={null}>
+ <PlaygroundClient />
+ </Suspense>
+ );
}
diff --git a/apps/docsite/src/app/playground/playgroundThemes.ts b/apps/docsite/src/app/playground/playgroundThemes.ts
index 3d84ebd6e9..e816309254 100644
--- a/apps/docsite/src/app/playground/playgroundThemes.ts
+++ b/apps/docsite/src/app/playground/playgroundThemes.ts
@@ -12,7 +12,7 @@
*/
import type {XDSDefinedTheme} from '@xds/core/theme';
-import {themeObjects} from '../../generated/themeRegistry';
+import {themeObjectsFull} from '../../generated/themeRegistry';
import {packages} from '../../generated/packageRegistry';
export interface PlaygroundTheme {
@@ -24,7 +24,9 @@ export interface PlaygroundTheme {
theme: XDSDefinedTheme;
}
-const displayNameByPackage = new Map(packages.map(p => [p.name, p.displayName]));
+const displayNameByPackage = new Map(
+ packages.map(p => [p.name, p.displayName]),
+);
/** "@xds/theme-default" → "default" */
function toShortName(packageName: string): string {
@@ -43,7 +45,9 @@ function toLabel(packageName: string, shortName: string): string {
return base.charAt(0).toUpperCase() + base.slice(1);
}
-export const PLAYGROUND_THEMES: PlaygroundTheme[] = Object.entries(themeObjects)
+export const PLAYGROUND_THEMES: PlaygroundTheme[] = Object.entries(
+ themeObjectsFull,
+)
.map(([packageName, theme]) => {
const value = toShortName(packageName);
return {value, label: toLabel(packageName, value), theme};
diff --git a/apps/docsite/src/components/themePlayground/PlaygroundThemeEditor.tsx b/apps/docsite/src/components/themePlayground/PlaygroundThemeEditor.tsx
new file mode 100644
index 0000000000..75b67e95c9
--- /dev/null
+++ b/apps/docsite/src/components/themePlayground/PlaygroundThemeEditor.tsx
@@ -0,0 +1,347 @@
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+
+/**
+ * @file PlaygroundThemeEditor.tsx
+ * @input optional seed theme + the playground's light/dark mode
+ * @output the theme editor's left-panel content (tab strip + scrollable body)
+ * @position Playground — embeds the themePlayground editor as a left-panel view.
+ *
+ * A self-contained version of the editor portion of ThemeEditorView: it owns the
+ * token + scale state, renders the Theme/Components/Tokens tab strip and body, and
+ * reports the composed theme upward via onThemeChange so the playground can push it
+ * to the live preview iframe.
+ */
+
+'use client';
+
+import * as React from 'react';
+import {XDSTabList, XDSTab} from '@xds/core/TabList';
+import {
+ defineTheme,
+ expandTypeScale,
+ expandRadiusScale,
+ expandColorScale,
+ colorDefaults,
+ spacingDefaults,
+ radiusDefaults,
+ typographyDefaults,
+ textSizeDefaults,
+ fontWeightDefaults,
+ typeScaleDefaults,
+ sizeDefaults,
+ shadowDefaults,
+ durationDefaults,
+ easeDefaults,
+} from '@xds/core/theme';
+import type {XDSDefinedTheme} from '@xds/core/theme';
+import {EditorSections} from './EditorSections';
+import {ComponentTokensPanel} from './ComponentTokensPanel';
+import type {CustomOverride} from './ComponentTokensPanel';
+import {RawTokensPanel} from './RawTokensPanel';
+import {
+ UNIFIED_PRESETS,
+ COMPONENT_VAR_NAMES,
+ GOOGLE_FONTS_URL,
+} from './constants';
+import {buildComponentOverrides, mergeComponentStyleMaps} from './helpers';
+
+const ALL_DEFAULTS: Record<string, string> = {
+ ...colorDefaults,
+ ...spacingDefaults,
+ ...radiusDefaults,
+ ...typographyDefaults,
+ ...textSizeDefaults,
+ ...fontWeightDefaults,
+ ...typeScaleDefaults,
+ ...sizeDefaults,
+ ...shadowDefaults,
+ ...durationDefaults,
+ ...easeDefaults,
+};
+
+interface PlaygroundThemeEditorProps {
+ /** Light/dark mode, owned by the playground so editor + preview stay in sync. */
+ mode: 'light' | 'dark';
+ /** Optional theme to seed the editor's token + component state from. */
+ initialTheme?: XDSDefinedTheme;
+ /** Called whenever the composed theme changes so the parent can apply it. */
+ onThemeChange: (theme: XDSDefinedTheme) => void;
+}
+
+export function PlaygroundThemeEditor({
+ mode,
+ initialTheme,
+ onThemeChange,
+}: PlaygroundThemeEditorProps) {
+ const [tokens, setTokens] = React.useState<Record<string, string>>(() => ({
+ ...ALL_DEFAULTS,
+ ...initialTheme?.tokens,
+ }));
+ // Component-level overrides from the seeded theme. Kept separate from token
+ // state so they form the base layer that token + custom overrides compose on.
+ const [baseComponents] = React.useState<Record<string, unknown>>(
+ () => initialTheme?.components ?? {},
+ );
+ const [panelTab, setPanelTab] = React.useState<
+ 'theme' | 'components' | 'tokens'
+ >('theme');
+ const [typeScaleBase, setTypeScaleBase] = React.useState(14);
+ const [typeScaleRatio, setTypeScaleRatio] = React.useState(1.2);
+ const [radiusBase, setRadiusBase] = React.useState(4);
+ const [spacingBase, setSpacingBase] = React.useState(4);
+ const [sizeBase, setSizeBase] = React.useState(32);
+ const [durationStep, setDurationStep] = React.useState(1);
+ // A unified preset is only "active" once the user explicitly applies one.
+ const [activePreset, setActivePreset] = React.useState<string | null>(null);
+ const [autoPickColors, setAutoPickColors] = React.useState(false);
+ const [customOverrides, setCustomOverrides] = React.useState<
+ CustomOverride[]
+ >([]);
+
+ const currentTheme = React.useMemo(() => {
+ const coreTokens: Record<string, string> = {};
+ const componentTokens: Record<string, string> = {};
+ for (const [key, value] of Object.entries(tokens)) {
+ if (COMPONENT_VAR_NAMES.has(key)) {
+ componentTokens[key] = value;
+ } else {
+ coreTokens[key] = value;
+ }
+ }
+ const customMap: Record<string, {base: Record<string, string>}> = {};
+ for (const override of customOverrides) {
+ customMap[override.component] ??= {base: {}};
+ customMap[override.component].base[override.property] = override.value;
+ }
+ // Layer order: seeded component overrides (base) → token-derived overrides
+ // → freeform custom overrides. Later layers win at the leaf level.
+ const components = mergeComponentStyleMaps(
+ baseComponents,
+ buildComponentOverrides(componentTokens),
+ customMap,
+ ) as XDSDefinedTheme['components'];
+ return defineTheme({name: 'custom', tokens: coreTokens, components});
+ }, [tokens, customOverrides, baseComponents]);
+
+ // Report the composed theme upward so the playground can push it to the
+ // preview iframe whenever tokens or overrides change.
+ React.useEffect(() => {
+ onThemeChange(currentTheme);
+ }, [currentTheme, onThemeChange]);
+
+ const handleTokenChange = React.useCallback((name: string, value: string) => {
+ setTokens(prev => ({...prev, [name]: value}));
+ }, []);
+
+ const applyTypeScale = React.useCallback((base: number, ratio: number) => {
+ setActivePreset(null);
+ setTypeScaleBase(base);
+ setTypeScaleRatio(ratio);
+ setTokens(prev => ({...prev, ...expandTypeScale({base, ratio})}));
+ }, []);
+
+ const applySpacingScale = React.useCallback((base: number) => {
+ setActivePreset(null);
+ setSpacingBase(base);
+ const steps = [0, 0.5, 1, 1.5, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
+ const keys = [
+ '0',
+ '0-5',
+ '1',
+ '1-5',
+ '2',
+ '3',
+ '4',
+ '5',
+ '6',
+ '7',
+ '8',
+ '9',
+ '10',
+ '11',
+ '12',
+ ];
+ const patch: Record<string, string> = {};
+ steps.forEach((step, i) => {
+ patch[`--spacing-${keys[i]}`] = `${Math.round(base * step)}px`;
+ });
+ setTokens(prev => ({...prev, ...patch}));
+ }, []);
+
+ const applySizeScale = React.useCallback((base: number) => {
+ setActivePreset(null);
+ setSizeBase(base);
+ setTokens(prev => ({
+ ...prev,
+ '--size-element-sm': `${base - 4}px`,
+ '--size-element-md': `${base}px`,
+ '--size-element-lg': `${base + 4}px`,
+ }));
+ }, []);
+
+ const applyRadiusScale = React.useCallback((base: number) => {
+ setActivePreset(null);
+ setRadiusBase(base);
+ setTokens(prev => ({
+ ...prev,
+ ...expandRadiusScale({base, multiplier: 1}),
+ }));
+ }, []);
+
+ const applyDurationScale = React.useCallback((multiplier: number) => {
+ setDurationStep(multiplier);
+ const defaults: Record<string, number> = {
+ '--duration-fast-min': 130,
+ '--duration-fast': 175,
+ '--duration-fast-max': 230,
+ '--duration-medium-min': 310,
+ '--duration-medium': 410,
+ '--duration-medium-max': 550,
+ '--duration-slow-min': 730,
+ '--duration-slow': 975,
+ '--duration-slow-max': 1300,
+ };
+ const patch: Record<string, string> = {};
+ for (const [key, base] of Object.entries(defaults)) {
+ patch[key] = `${Math.round(base / multiplier)}ms`;
+ }
+ setTokens(prev => ({...prev, ...patch}));
+ }, []);
+
+ const applyUnifiedPreset = React.useCallback((presetKey: string) => {
+ const p = UNIFIED_PRESETS[presetKey as keyof typeof UNIFIED_PRESETS];
+ if (!p) {
+ return;
+ }
+ setActivePreset(presetKey);
+ setTypeScaleBase(p.typeBase);
+ setTypeScaleRatio(p.typeRatio);
+ setSpacingBase(p.spacing);
+ setRadiusBase(p.radius);
+ setSizeBase(p.sizeMd);
+ setTokens(prev => {
+ const spacingSteps = [0, 0.5, 1, 1.5, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
+ const spacingKeys = [
+ '0',
+ '0-5',
+ '1',
+ '1-5',
+ '2',
+ '3',
+ '4',
+ '5',
+ '6',
+ '7',
+ '8',
+ '9',
+ '10',
+ '11',
+ '12',
+ ];
+ const spacingPatch: Record<string, string> = {};
+ spacingSteps.forEach((step, i) => {
+ spacingPatch[`--spacing-${spacingKeys[i]}`] =
+ `${Math.round(p.spacing * step)}px`;
+ });
+ return {
+ ...prev,
+ ...expandTypeScale({base: p.typeBase, ratio: p.typeRatio}),
+ ...spacingPatch,
+ ...expandRadiusScale({base: p.radius, multiplier: 1}),
+ '--size-element-sm': `${p.sizeMd - p.spacing}px`,
+ '--size-element-md': `${p.sizeMd}px`,
+ '--size-element-lg': `${p.sizeMd + p.spacing}px`,
+ };
+ });
+ }, []);
+
+ const handleExpandColorScale = React.useCallback((accentHex: string) => {
+ const derived = expandColorScale({accent: accentHex});
+ let hex = accentHex.replace('#', '');
+ // Normalize 3-char short hex (e.g. "f00") to 6-char ("ff0000")
+ if (hex.length === 3) {
+ hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
+ }
+ // Guard against invalid hex — fall back to black
+ if (hex.length !== 6 || !/^[0-9a-fA-F]{6}$/.test(hex)) {
+ hex = '000000';
+ }
+ const r = parseInt(hex.slice(0, 2), 16);
+ const g = parseInt(hex.slice(2, 4), 16);
+ const b = parseInt(hex.slice(4, 6), 16);
+ derived['--shadow-inset-hover'] =
+ `inset 0px 0px 0px 2px rgba(${r}, ${g}, ${b}, 0.3)`;
+ derived['--shadow-inset-selected'] =
+ `inset 0px 0px 0px 2px rgba(${r}, ${g}, ${b}, 0.5)`;
+ setTokens(prev => ({...prev, ...derived}));
+ }, []);
+
+ return (
+ <div
+ style={{
+ flex: 1,
+ minHeight: 0,
+ display: 'flex',
+ flexDirection: 'column',
+ overflow: 'hidden',
+ }}>
+ {/* Self-load theme fonts (mirrors ThemeEditorView) so the editor's
+ controls render in the loaded theme's typeface even when used
+ standalone. */}
+ <style>{`@import url("${GOOGLE_FONTS_URL}");`}</style>
+ {/* Tab strip */}
+ <XDSTabList
+ hasDivider
+ value={panelTab}
+ onChange={v => setPanelTab(v as 'theme' | 'components' | 'tokens')}>
+ <XDSTab value="theme" label="Base Styles" />
+ <XDSTab value="components" label="Components" />
+ <XDSTab value="tokens" label="Advanced" />
+ </XDSTabList>
+
+ {/* Scrollable editor content */}
+ <div style={{flex: 1, overflow: 'auto', padding: 16}}>
+ {panelTab === 'theme' && (
+ <EditorSections
+ tokens={tokens}
+ mode={mode}
+ typeScaleBase={typeScaleBase}
+ typeScaleRatio={typeScaleRatio}
+ radiusBase={radiusBase}
+ spacingBase={spacingBase}
+ sizeBase={sizeBase}
+ durationStep={durationStep}
+ activePreset={activePreset}
+ autoPickColors={autoPickColors}
+ onTokenChange={handleTokenChange}
+ onApplyTypeScale={applyTypeScale}
+ onApplyRadiusScale={applyRadiusScale}
+ onApplySpacingScale={applySpacingScale}
+ onApplySizeScale={applySizeScale}
+ onApplyDurationScale={applyDurationScale}
+ onApplyUnifiedPreset={applyUnifiedPreset}
+ onSetAutoPickColors={setAutoPickColors}
+ onExpandColorScale={handleExpandColorScale}
+ onSetTokens={setTokens}
+ />
+ )}
+ {panelTab === 'components' && (
+ <ComponentTokensPanel
+ tokens={tokens}
+ onTokenChange={handleTokenChange}
+ customOverrides={customOverrides}
+ onCustomOverridesChange={setCustomOverrides}
+ baseComponents={baseComponents}
+ />
+ )}
+ {panelTab === 'tokens' && (
+ <RawTokensPanel
+ tokens={tokens}
+ mode={mode}
+ onTokenChange={handleTokenChange}
+ />
+ )}
+ </div>
+ </div>
+ );
+}
diff --git a/apps/docsite/src/components/themePlayground/constants.ts b/apps/docsite/src/components/themePlayground/constants.ts
index f1659d1472..2b9a3448aa 100644
--- a/apps/docsite/src/components/themePlayground/constants.ts
+++ b/apps/docsite/src/components/themePlayground/constants.ts
@@ -92,9 +92,13 @@ export function resolveOptionLabel(
option: {label: string; token?: string},
tokens: Record<string, string>,
): string {
- if (!option.token) {return option.label;}
+ if (!option.token) {
+ return option.label;
+ }
const resolved = tokens[option.token];
- if (resolved) {return `${option.label} — ${resolved}`;}
+ if (resolved) {
+ return `${option.label} — ${resolved}`;
+ }
return option.label;
}
@@ -468,4 +472,4 @@ export const TYPOGRAPHY_CATEGORIES: Record<
} as const;
export const GOOGLE_FONTS_URL =
- 'https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Roboto:wght@400;500;700&family=DM+Sans:wght@400;500;600;700&family=Figtree:wght@400;500;600;700&family=Poppins:wght@400;500;600;700&family=IBM+Plex+Sans:wght@400;500;600;700&family=Source+Sans+3:wght@400;500;600;700&family=Noto+Sans:wght@400;500;600;700&display=swap';
+ 'https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Figtree:wght@400;500;600;700&family=Fustat:wght@400;500;600;700&family=IBM+Plex+Sans:wght@400;500;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&family=Manufacturing+Consent&family=Montserrat:wght@400;500;600;700&family=Noto+Sans:wght@400;500;600;700&family=Outfit:wght@400;500;600;700&family=Playwrite+US+Trad:[email protected]&family=Poppins:wght@400;500;600;700&family=Roboto:wght@400;500;700&family=Source+Sans+3:wght@400;500;600;700&family=UnifrakturMaguntia&display=swap';
diff --git a/apps/docsite/src/components/themePlayground/themeList.ts b/apps/docsite/src/components/themePlayground/themeList.ts
index f5977dd0da..2f54923944 100644
--- a/apps/docsite/src/components/themePlayground/themeList.ts
+++ b/apps/docsite/src/components/themePlayground/themeList.ts
@@ -7,7 +7,7 @@
*/
import type {XDSDefinedTheme} from '@xds/core/theme';
-import {themeObjects} from '../../generated/themeRegistry';
+import {themeObjectsFull} from '../../generated/themeRegistry';
export interface ThemeListEntry {
name: string;
@@ -16,7 +16,7 @@ export interface ThemeListEntry {
}
export function getThemeList(): ThemeListEntry[] {
- return Object.values(themeObjects)
+ return Object.values(themeObjectsFull)
.map(theme => ({
name: theme.name,
label: theme.name.charAt(0).toUpperCase() + theme.name.slice(1),
diff --git a/packages/cli/bin/xds.mjs b/packages/cli/bin/xds.mjs
old mode 100644
new mode 100755