Skip to content

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

TypeScript

feat(docsite): add foundation and hero assets to home page (#1960)

Cindy Zhang56dba0695a80
diff --git a/apps/docsite/public/FoundationsColors.png b/apps/docsite/public/FoundationsColors.png
new file mode 100644
index 0000000000..8289c3696d
Binary files /dev/null and b/apps/docsite/public/FoundationsColors.png differ
diff --git a/apps/docsite/public/FoundationsIcons.png b/apps/docsite/public/FoundationsIcons.png
new file mode 100644
index 0000000000..25f0440c7d
Binary files /dev/null and b/apps/docsite/public/FoundationsIcons.png differ
diff --git a/apps/docsite/public/FoundationsShape.png b/apps/docsite/public/FoundationsShape.png
new file mode 100644
index 0000000000..bb0d20642e
Binary files /dev/null and b/apps/docsite/public/FoundationsShape.png differ
diff --git a/apps/docsite/public/FoundationsSpacing.png b/apps/docsite/public/FoundationsSpacing.png
new file mode 100644
index 0000000000..688b3574f2
Binary files /dev/null and b/apps/docsite/public/FoundationsSpacing.png differ
diff --git a/apps/docsite/public/FoundationsTypogrpahy.png b/apps/docsite/public/FoundationsTypogrpahy.png
new file mode 100644
index 0000000000..ae7225b79f
Binary files /dev/null and b/apps/docsite/public/FoundationsTypogrpahy.png differ
diff --git a/apps/docsite/public/LibrariesCli.png b/apps/docsite/public/LibrariesCli.png
new file mode 100644
index 0000000000..618367cdd7
Binary files /dev/null and b/apps/docsite/public/LibrariesCli.png differ
diff --git a/apps/docsite/public/LibrariesCore.png b/apps/docsite/public/LibrariesCore.png
new file mode 100644
index 0000000000..e0d9186293
Binary files /dev/null and b/apps/docsite/public/LibrariesCore.png differ
diff --git a/apps/docsite/public/hero-bg.png b/apps/docsite/public/hero-bg.png
new file mode 100644
index 0000000000..d9e7ef86d6
Binary files /dev/null and b/apps/docsite/public/hero-bg.png differ
diff --git a/apps/docsite/scripts/generate-data.mjs b/apps/docsite/scripts/generate-data.mjs
index ba2ca5be39..42b047dcfd 100644
--- a/apps/docsite/scripts/generate-data.mjs
+++ b/apps/docsite/scripts/generate-data.mjs
@@ -527,12 +527,49 @@ export const docsCount = ${docTopics.length};
return {docTopics, docsCount: docTopics.length};
}
-// ── Main ───────────────────────────────────────────────────────────────
+
+function generateThemeRegistry(packages) {
+ console.log('Generating theme registry...');
+ const themePackages = packages.filter(p => p.name.startsWith('@xds/theme-'));
+ if (!themePackages.length) {
+ writeRegistry('themeRegistry.ts', `// Auto-generated — no theme packages found
+import type {XDSDefinedTheme} from '@xds/core/theme';
+export const themeObjects: Record<string, XDSDefinedTheme> = {};
+`);
+ return 0;
+ }
+
+ const imports = themePackages.map(p => {
+ const slug = p.name.replace('@xds/theme-', '');
+ const exportName = `${slug}Theme`;
+ return `import {${exportName}} from '${p.name}/built';`;
+ }).join('\n');
+
+ const entries = themePackages.map(p => {
+ const slug = p.name.replace('@xds/theme-', '');
+ return ` '${p.name}': ${slug}Theme,`;
+ }).join('\n');
+
+ const content = `// Auto-generated by scripts/generate-data.mjs — do not edit
+
+import type {XDSDefinedTheme} from '@xds/core/theme';
+${imports}
+
+export const themeObjects: Record<string, XDSDefinedTheme> = {
+${entries}
+};
+`;
+ writeRegistry('themeRegistry.ts', content);
+ return themePackages.length;
+}
+
+// ── Main
async function main() {
console.log('Generating docsite data...\n');
const packages = generatePackageRegistry();
+ const themeCount = generateThemeRegistry(packages);
const {totalCount: componentCount} = await generateComponentRegistry();
const {blockCount, showcaseCount} = await generateBlockRegistry();
const {templateCount} = await generateTemplateRegistry();
@@ -544,6 +581,7 @@ async function main() {
console.log(` ${blockCount} blocks (${showcaseCount} showcases)`);
console.log(` ${templateCount} templates`);
console.log(` ${docsCount} doc topics`);
+ console.log(` ${themeCount} themes`);
console.log('Done.');
}
diff --git a/apps/docsite/src/__tests__/data-extraction.test.ts b/apps/docsite/src/__tests__/data-extraction.test.ts
index a804c91fa0..fcbda600ca 100644
--- a/apps/docsite/src/__tests__/data-extraction.test.ts
+++ b/apps/docsite/src/__tests__/data-extraction.test.ts
@@ -5,6 +5,7 @@
* Run: yarn workspace @xds/docsite test
*/
+import * as fs from 'node:fs';
import {describe, it, expect} from 'vitest';
import {packages} from '../generated/packageRegistry';
import {components, componentCount} from '../generated/componentRegistry';
@@ -373,3 +374,36 @@ describe('docsRegistry', () => {
expect(new Set(topics).size).toBe(topics.length);
});
});
+
+// ── Theme Registry ─────────────────────────────────────────────────────
+
+describe('themeRegistry', () => {
+ const registryPath = new URL(
+ '../generated/themeRegistry.ts',
+ import.meta.url,
+ );
+ const registrySource = fs.readFileSync(registryPath, 'utf-8');
+
+ it('generates a themeRegistry file', () => {
+ expect(registrySource).toContain('themeObjects');
+ });
+
+ it('has an import and entry for every theme package', () => {
+ const themePackages = packages.filter(p =>
+ p.name.startsWith('@xds/theme-'),
+ );
+ expect(themePackages.length).toBeGreaterThan(0);
+ for (const pkg of themePackages) {
+ const slug = pkg.name.replace('@xds/theme-', '');
+ expect(registrySource).toContain(`from '${pkg.name}/built'`);
+ expect(registrySource).toContain(`'${pkg.name}': ${slug}Theme`);
+ }
+ });
+
+ it('has no entries for non-theme packages', () => {
+ const nonTheme = packages.filter(p => !p.name.startsWith('@xds/theme-'));
+ for (const pkg of nonTheme) {
+ expect(registrySource).not.toContain(`'${pkg.name}':`);
+ }
+ });
+});
diff --git a/apps/docsite/src/app/page.tsx b/apps/docsite/src/app/page.tsx
index 1bd96843ed..55a7f1cadf 100644
--- a/apps/docsite/src/app/page.tsx
+++ b/apps/docsite/src/app/page.tsx
@@ -10,11 +10,67 @@ import {XDSHeading, XDSText} from '@xds/core/Text';
import {XDSVStack, XDSHStack} from '@xds/core/Layout';
import {XDSGrid} from '@xds/core/Grid';
import {XDSSection} from '@xds/core/Section';
-import {XDSBadge} from '@xds/core/Badge';
import {XDSButton} from '@xds/core/Button';
+import {XDSTheme, XDSMediaTheme} from '@xds/core/theme';
import {packages} from '../generated/packageRegistry';
import {componentCount} from '../generated/componentRegistry';
import {docTopics} from '../generated/docsRegistry';
+import {ThemeShowcaseTile} from '../components/ThemeShowcaseTile';
+import {themeObjects} from '../generated/themeRegistry';
+
+const TerminalIcon = (props: React.SVGProps<SVGSVGElement>) => (
+ <svg
+ aria-hidden="true"
+ width="48"
+ height="48"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth="1.5"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ {...props}>
+ <path d="m7 11 2-2-2-2" />
+ <path d="M11 13h4" />
+ <rect width="18" height="18" x="3" y="3" rx="2" ry="2" />
+ </svg>
+);
+
+const CodeIcon = (props: React.SVGProps<SVGSVGElement>) => (
+ <svg
+ aria-hidden="true"
+ width="48"
+ height="48"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth="1.5"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ {...props}>
+ <path d="m18 16 4-4-4-4" />
+ <path d="m6 8-4 4 4 4" />
+ <path d="m14.5 4-5 16" />
+ </svg>
+);
+
+const PACKAGE_ICONS: Record<string, React.ReactNode> = {
+ '@xds/cli': <TerminalIcon />,
+ '@xds/core': <CodeIcon />,
+};
+
+const PACKAGE_IMAGES: Record<string, string> = {
+ '@xds/cli': '/LibrariesCli.png',
+ '@xds/core': '/LibrariesCore.png',
+};
+
+const foundationImages: Record<string, string> = {
+ color: '/FoundationsColors.png',
+ icons: '/FoundationsIcons.png',
+ shape: '/FoundationsShape.png',
+ spacing: '/FoundationsSpacing.png',
+ typography: '/FoundationsTypogrpahy.png',
+};
const styles = stylex.create({
pageContainer: {
@@ -32,6 +88,9 @@ const styles = stylex.create({
borderRadius: 16,
overflow: 'hidden',
backgroundColor: 'var(--color-background-card)',
+ backgroundImage: 'url(/hero-bg.png)',
+ backgroundSize: 'cover',
+ backgroundPosition: 'center',
minHeight: 300,
display: 'flex',
flexDirection: 'column',
@@ -70,10 +129,19 @@ const styles = stylex.create({
},
packageImageWrapper: {
aspectRatio: '2/1',
+ backgroundSize: 'cover',
+ backgroundPosition: 'center',
borderRadius: 12,
position: 'relative' as const,
marginBottom: 12,
backgroundColor: 'var(--color-background-card)',
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ },
+ packageIconOverlay: {
+ color: '#484233',
+ opacity: 0.8,
},
monoText: {
fontFamily: 'monospace',
@@ -88,8 +156,6 @@ const styles = stylex.create({
},
});
-const isThemePkg = (name: string) => name.includes('theme-');
-
const foundationTopics = docTopics
.filter(d => d.category === 'foundations')
.sort((a, b) => {
@@ -100,9 +166,6 @@ const foundationTopics = docTopics
export default function HomePage() {
const coreCount = componentCount;
- const libraryPackages = packages.filter(p => !isThemePkg(p.name));
- const themePackages = packages.filter(p => isThemePkg(p.name));
- const allPackages = [...libraryPackages, ...themePackages];
return (
<div {...stylex.props(styles.pageContainer)}>
@@ -110,32 +173,34 @@ export default function HomePage() {
<XDSVStack gap={10} style={{rowGap: 60}}>
{/* Hero */}
<div {...stylex.props(styles.heroContainer)}>
- <XDSText type="large" weight="semibold" xstyle={styles.heroTitle}>
- XDS Open Source
- </XDSText>
- <XDSText type="display-1" xstyle={styles.heroSubtitle}>
- Build with AI
- </XDSText>
- <XDSText
- type="body"
- color="secondary"
- xstyle={styles.heroDescription}>
- An open design system for building internal tools with AI-powered
- development. Ship faster with {coreCount} accessible, themeable
- components.
- </XDSText>
- <XDSHStack gap={3} xstyle={styles.heroButtons}>
- <XDSButton
- variant="primary"
- label="Get started"
- href="/docs/getting-started"
- />
- <XDSButton
- variant="secondary"
- label="Browse components"
- href="/packages/core"
- />
- </XDSHStack>
+ <XDSMediaTheme mode="light">
+ <XDSText type="large" weight="semibold" xstyle={styles.heroTitle}>
+ XDS Open Source
+ </XDSText>
+ <XDSText type="display-1" xstyle={styles.heroSubtitle}>
+ Build with AI
+ </XDSText>
+ <XDSText
+ type="body"
+ color="secondary"
+ xstyle={styles.heroDescription}>
+ An open design system for building internal tools with
+ AI-powered development. Ship faster with {coreCount} accessible,
+ themeable components.
+ </XDSText>
+ <XDSHStack gap={3} xstyle={styles.heroButtons}>
+ <XDSButton
+ variant="primary"
+ label="Get started"
+ href="/docs/getting-started"
+ />
+ <XDSButton
+ variant="secondary"
+ label="Browse components"
+ href="/packages/core"
+ />
+ </XDSHStack>
+ </XDSMediaTheme>
</div>
{/* Libraries & Packages */}
@@ -151,29 +216,51 @@ export default function HomePage() {
columns={{minWidth: 260, repeat: 'fit'}}
gap={4}
rowGap={8}>
- {allPackages.map(pkg => (
- <Link
- key={pkg.name}
- href={`/packages/${pkg.name.replace('@xds/', '')}`}
- {...stylex.props(styles.linkReset)}>
- <div {...stylex.props(styles.packageImageWrapper)} />
- <XDSVStack gap={0.5}>
- <span {...stylex.props(styles.monoText)}>
- <XDSText type="body" weight="bold">
- {pkg.name}
- </XDSText>
- <span {...stylex.props(styles.versionText)}>
- <XDSText type="supporting" color="secondary">
- v{pkg.version}
+ {packages.map(pkg => {
+ const theme = themeObjects[pkg.name];
+ const image = PACKAGE_IMAGES[pkg.name] ?? '/LibrariesCore.png';
+ const icon = PACKAGE_ICONS[pkg.name] ?? null;
+
+ return (
+ <Link
+ key={pkg.name}
+ href={`/packages/${pkg.name.replace('@xds/', '')}`}
+ {...stylex.props(styles.linkReset)}>
+ {theme ? (
+ <XDSTheme theme={theme}>
+ <div {...stylex.props(styles.packageImageWrapper)}>
+ <ThemeShowcaseTile label={pkg.displayName} />
+ </div>
+ </XDSTheme>
+ ) : (
+ <div
+ {...stylex.props(styles.packageImageWrapper)}
+ style={{backgroundImage: `url(${image})`}}>
+ {icon && (
+ <div {...stylex.props(styles.packageIconOverlay)}>
+ {icon}
+ </div>
+ )}
+ </div>
+ )}
+ <XDSVStack gap={0.5}>
+ <span {...stylex.props(styles.monoText)}>
+ <XDSText type="body" weight="bold">
+ {pkg.name}
</XDSText>
+ <span {...stylex.props(styles.versionText)}>
+ <XDSText type="supporting" color="secondary">
+ v{pkg.version}
+ </XDSText>
+ </span>
</span>
- </span>
- <XDSText type="supporting" color="secondary">
- {pkg.description}
- </XDSText>
- </XDSVStack>
- </Link>
- ))}
+ <XDSText type="supporting" color="secondary">
+ {pkg.description}
+ </XDSText>
+ </XDSVStack>
+ </Link>
+ );
+ })}
</XDSGrid>
</XDSVStack>
@@ -195,7 +282,15 @@ export default function HomePage() {
key={topic.topic}
href={`/docs/${topic.topic}`}
{...stylex.props(styles.linkReset)}>
- <div {...stylex.props(styles.foundationImage)} />
+ {foundationImages[topic.topic] ? (
+ <img
+ src={foundationImages[topic.topic]}
+ alt={topic.title}
+ {...stylex.props(styles.foundationImage)}
+ />
+ ) : (
+ <div {...stylex.props(styles.foundationImage)} />
+ )}
<XDSVStack gap={1}>
<XDSText type="body" weight="bold">
{topic.title}
diff --git a/apps/docsite/src/components/ThemeShowcaseTile.tsx b/apps/docsite/src/components/ThemeShowcaseTile.tsx
new file mode 100644
index 0000000000..3c59b5c4e4
--- /dev/null
+++ b/apps/docsite/src/components/ThemeShowcaseTile.tsx
@@ -0,0 +1,141 @@
+'use client';
+
+import * as stylex from '@stylexjs/stylex';
+import {
+ colorVars,
+ radiusVars,
+ typographyVars,
+ borderVars,
+} from '@xds/core/theme/tokens.stylex';
+import {XDSButton} from '@xds/core/Button';
+
+const styles = stylex.create({
+ tile: {
+ display: 'flex',
+ flexDirection: 'column',
+ justifyContent: 'center',
+ gap: 4,
+ padding: 20,
+ borderRadius: radiusVars['--radius-container'],
+ backgroundColor: colorVars['--color-background-body'],
+ overflow: 'hidden',
+ width: '100%',
+ height: '100%',
+ boxSizing: 'border-box',
+ },
+ topRow: {
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'space-between',
+ gap: 12,
+ },
+ fontSamples: {
+ display: 'flex',
+ flexDirection: 'column',
+ gap: 2,
+ },
+ headingFont: {
+ fontFamily: typographyVars['--font-family-heading'],
+ fontSize: 36,
+ fontWeight: 300,
+ lineHeight: 1,
+ color: colorVars['--color-text-primary'],
+ letterSpacing: '-0.02em',
+ },
+ bodyFont: {
+ fontFamily: typographyVars['--font-family-body'],
+ fontSize: 13,
+ fontWeight: 400,
+ lineHeight: 1.3,
+ color: colorVars['--color-text-secondary'],
+ },
+ codeFont: {
+ fontFamily: typographyVars['--font-family-code'],
+ fontSize: 11,
+ fontWeight: 400,
+ lineHeight: 1.3,
+ color: colorVars['--color-text-disabled'],
+ },
+ rightGroup: {
+ display: 'flex',
+ alignItems: 'center',
+ gap: 12,
+ },
+ colorStack: {
+ display: 'flex',
+ flexDirection: 'column',
+ gap: 3,
+ },
+ colorDot: {
+ width: 16,
+ height: 16,
+ borderRadius: radiusVars['--radius-full'],
+ },
+ dotAccent: {
+ backgroundColor: colorVars['--color-accent'],
+ },
+ dotPrimary: {
+ backgroundColor: colorVars['--color-text-primary'],
+ },
+ dotSecondary: {
+ backgroundColor: colorVars['--color-text-secondary'],
+ },
+ dotDisabled: {
+ backgroundColor: colorVars['--color-text-disabled'],
+ },
+ shapeRow: {
+ display: 'flex',
+ gap: 6,
+ },
+ shape: {
+ width: 36,
+ height: 36,
+ backgroundColor: colorVars['--color-background-card'],
+ borderWidth: borderVars['--border-width'],
+ borderStyle: 'solid',
+ borderColor: colorVars['--color-border-emphasized'],
+ boxSizing: 'border-box',
+ },
+ shapeInner: {
+ borderRadius: radiusVars['--radius-inner'],
+ },
+ shapeElement: {
+ borderRadius: radiusVars['--radius-element'],
+ },
+ shapeContainer: {
+ borderRadius: radiusVars['--radius-container'],
+ },
+ shapeFull: {
+ borderRadius: radiusVars['--radius-full'],
+ },
+});
+
+export function ThemeShowcaseTile({label}: {label: string}) {
+ return (
+ <div {...stylex.props(styles.tile)} inert>
+ <div {...stylex.props(styles.topRow)}>
+ <div {...stylex.props(styles.fontSamples)}>
+ <span {...stylex.props(styles.headingFont)}>Aa</span>
+ <span {...stylex.props(styles.bodyFont)}>Body text</span>
+ <span {...stylex.props(styles.codeFont)}>{'<Code />'}</span>
+ </div>
+ <div {...stylex.props(styles.rightGroup)}>
+ <XDSButton variant="primary" label={label} size="sm" />
+ <div {...stylex.props(styles.colorStack)}>
+ <div {...stylex.props(styles.colorDot, styles.dotAccent)} />
+ <div {...stylex.props(styles.colorDot, styles.dotPrimary)} />
+ <div {...stylex.props(styles.colorDot, styles.dotSecondary)} />
+ <div {...stylex.props(styles.colorDot, styles.dotDisabled)} />
+ </div>
+ </div>
+ </div>
+ <div {...stylex.props(styles.shapeRow)}>
+ <div {...stylex.props(styles.shape, styles.shapeFull)} />
+ <div {...stylex.props(styles.shape, styles.shapeFull)} />
+ <div {...stylex.props(styles.shape, styles.shapeContainer)} />
+ <div {...stylex.props(styles.shape, styles.shapeElement)} />
+ <div {...stylex.props(styles.shape, styles.shapeInner)} />
+ </div>
+ </div>
+ );
+}