An open source design system that's fully customizable and agent ready
TypeScript
fix(sandbox): remove legacy docsite page and 65MB of images (#2748)
Cindy Zhangc10b472d6eed
diff --git a/apps/sandbox/package.json b/apps/sandbox/package.jsonindex e2e865b7a1..365b7f6498 100644--- a/apps/sandbox/package.json+++ b/apps/sandbox/package.json@@ -4,10 +4,9 @@"private": true,"scripts": {"build:deps": "pnpm -F @xds/theme-default build && pnpm -F @xds/theme-neutral build && pnpm -F @xds/theme-brutalist build && pnpm -F @xds/theme-matcha build && pnpm -F @xds/theme-daily build && pnpm -F @xds/theme-stone build && pnpm -F @xds/theme-gothic build && pnpm -F @xds/theme-chocolate build && pnpm -F @xds/theme-y2k build && pnpm -F @xds/theme-butter build",- "generate:versions": "node scripts/generate-versions.js","generate:changelog": "node scripts/generate-changelog.js","generate:cli": "node scripts/generate-cli-registry.mjs",- "generate": "node ../../scripts/sync-templates.js && pnpm generate:versions && pnpm generate:changelog && pnpm generate:cli && node scripts/generate-foundation-docs.mjs",+ "generate": "node ../../scripts/sync-templates.js && pnpm generate:changelog && pnpm generate:cli && node scripts/generate-foundation-docs.mjs","dev": "pnpm generate && (node ../../scripts/sync-templates.js --watch & next dev)","build": "pnpm generate && next build","start": "next start",diff --git a/apps/sandbox/public/docsite/ChatGPT Web 120.png b/apps/sandbox/public/docsite/ChatGPT Web 120.pngdeleted file mode 100644index a70dac499b..0000000000Binary files a/apps/sandbox/public/docsite/ChatGPT Web 120.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/ChatGPT Web 122.png b/apps/sandbox/public/docsite/ChatGPT Web 122.pngdeleted file mode 100644index a41e00870c..0000000000Binary files a/apps/sandbox/public/docsite/ChatGPT Web 122.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/ChatGPT Web 140.png b/apps/sandbox/public/docsite/ChatGPT Web 140.pngdeleted file mode 100644index cd0f292c08..0000000000Binary files a/apps/sandbox/public/docsite/ChatGPT Web 140.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/ChatGPT Web 22.png b/apps/sandbox/public/docsite/ChatGPT Web 22.pngdeleted file mode 100644index a89b9c3297..0000000000Binary files a/apps/sandbox/public/docsite/ChatGPT Web 22.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/FoundationsColors.png b/apps/sandbox/public/docsite/FoundationsColors.pngdeleted file mode 100644index 8289c3696d..0000000000Binary files a/apps/sandbox/public/docsite/FoundationsColors.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/FoundationsIcons.png b/apps/sandbox/public/docsite/FoundationsIcons.pngdeleted file mode 100644index 25f0440c7d..0000000000Binary files a/apps/sandbox/public/docsite/FoundationsIcons.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/FoundationsIllustrations.png b/apps/sandbox/public/docsite/FoundationsIllustrations.pngdeleted file mode 100644index 9c53824e7c..0000000000Binary files a/apps/sandbox/public/docsite/FoundationsIllustrations.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/FoundationsShape.png b/apps/sandbox/public/docsite/FoundationsShape.pngdeleted file mode 100644index bb0d20642e..0000000000Binary files a/apps/sandbox/public/docsite/FoundationsShape.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/FoundationsSpacing.png b/apps/sandbox/public/docsite/FoundationsSpacing.pngdeleted file mode 100644index 688b3574f2..0000000000Binary files a/apps/sandbox/public/docsite/FoundationsSpacing.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/FoundationsTypogrpahy.png b/apps/sandbox/public/docsite/FoundationsTypogrpahy.pngdeleted file mode 100644index ae7225b79f..0000000000Binary files a/apps/sandbox/public/docsite/FoundationsTypogrpahy.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/LibrariesChat.png b/apps/sandbox/public/docsite/LibrariesChat.pngdeleted file mode 100644index a1e46ec09c..0000000000Binary files a/apps/sandbox/public/docsite/LibrariesChat.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/LibrariesCli.png b/apps/sandbox/public/docsite/LibrariesCli.pngdeleted file mode 100644index 618367cdd7..0000000000Binary files a/apps/sandbox/public/docsite/LibrariesCli.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/LibrariesCore.png b/apps/sandbox/public/docsite/LibrariesCore.pngdeleted file mode 100644index e0d9186293..0000000000Binary files a/apps/sandbox/public/docsite/LibrariesCore.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/LibrariesVega.png b/apps/sandbox/public/docsite/LibrariesVega.pngdeleted file mode 100644index aa3368aab0..0000000000Binary files a/apps/sandbox/public/docsite/LibrariesVega.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/apple-logo.png b/apps/sandbox/public/docsite/apple-logo.pngdeleted file mode 100644index 31fa44e6ee..0000000000Binary files a/apps/sandbox/public/docsite/apple-logo.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/card4-carousel-daily.png b/apps/sandbox/public/docsite/card4-carousel-daily.pngdeleted file mode 100644index a7e5823a85..0000000000Binary files a/apps/sandbox/public/docsite/card4-carousel-daily.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/card4-carousel-default.png b/apps/sandbox/public/docsite/card4-carousel-default.pngdeleted file mode 100644index 5786105df2..0000000000Binary files a/apps/sandbox/public/docsite/card4-carousel-default.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/card4-carousel-meta.png b/apps/sandbox/public/docsite/card4-carousel-meta.pngdeleted file mode 100644index fd470ef038..0000000000Binary files a/apps/sandbox/public/docsite/card4-carousel-meta.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/card4-grid-daily.png b/apps/sandbox/public/docsite/card4-grid-daily.pngdeleted file mode 100644index 725c142d97..0000000000Binary files a/apps/sandbox/public/docsite/card4-grid-daily.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/card4-grid-default.png b/apps/sandbox/public/docsite/card4-grid-default.pngdeleted file mode 100644index dd3c78b65a..0000000000Binary files a/apps/sandbox/public/docsite/card4-grid-default.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/card4-grid-meta.png b/apps/sandbox/public/docsite/card4-grid-meta.pngdeleted file mode 100644index 832a904680..0000000000Binary files a/apps/sandbox/public/docsite/card4-grid-meta.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/card4-hero-daily.png b/apps/sandbox/public/docsite/card4-hero-daily.pngdeleted file mode 100644index 7ec4717219..0000000000Binary files a/apps/sandbox/public/docsite/card4-hero-daily.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/card4-hero-default.png b/apps/sandbox/public/docsite/card4-hero-default.pngdeleted file mode 100644index 727d56a2e5..0000000000Binary files a/apps/sandbox/public/docsite/card4-hero-default.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/card4-hero-meta.png b/apps/sandbox/public/docsite/card4-hero-meta.pngdeleted file mode 100644index 4895b89989..0000000000Binary files a/apps/sandbox/public/docsite/card4-hero-meta.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/card4-preview-daily.png b/apps/sandbox/public/docsite/card4-preview-daily.pngdeleted file mode 100644index 157f56be6e..0000000000Binary files a/apps/sandbox/public/docsite/card4-preview-daily.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/card4-preview-default.png b/apps/sandbox/public/docsite/card4-preview-default.pngdeleted file mode 100644index efb4f3573d..0000000000Binary files a/apps/sandbox/public/docsite/card4-preview-default.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/card4-preview-meta.png b/apps/sandbox/public/docsite/card4-preview-meta.pngdeleted file mode 100644index fe38bcfd66..0000000000Binary files a/apps/sandbox/public/docsite/card4-preview-meta.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/card4-related-1.png b/apps/sandbox/public/docsite/card4-related-1.pngdeleted file mode 100644index d420d75b70..0000000000Binary files a/apps/sandbox/public/docsite/card4-related-1.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/card4-related-2.png b/apps/sandbox/public/docsite/card4-related-2.pngdeleted file mode 100644index c933bf7411..0000000000Binary files a/apps/sandbox/public/docsite/card4-related-2.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/card4-related-3.png b/apps/sandbox/public/docsite/card4-related-3.pngdeleted file mode 100644index b0926d7468..0000000000Binary files a/apps/sandbox/public/docsite/card4-related-3.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/card4-related-4.png b/apps/sandbox/public/docsite/card4-related-4.pngdeleted file mode 100644index 4107d90013..0000000000Binary files a/apps/sandbox/public/docsite/card4-related-4.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/card4-split-daily.png b/apps/sandbox/public/docsite/card4-split-daily.pngdeleted file mode 100644index 61080e7c13..0000000000Binary files a/apps/sandbox/public/docsite/card4-split-daily.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/card4-split-default.png b/apps/sandbox/public/docsite/card4-split-default.pngdeleted file mode 100644index 53dc97a994..0000000000Binary files a/apps/sandbox/public/docsite/card4-split-default.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/card4-split-meta.png b/apps/sandbox/public/docsite/card4-split-meta.pngdeleted file mode 100644index 92bd8770ed..0000000000Binary files a/apps/sandbox/public/docsite/card4-split-meta.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/colorful-home-vertical-3.png b/apps/sandbox/public/docsite/colorful-home-vertical-3.pngdeleted file mode 100644index 43eaedf07a..0000000000Binary files a/apps/sandbox/public/docsite/colorful-home-vertical-3.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/colorful-working-horizontal-1.png b/apps/sandbox/public/docsite/colorful-working-horizontal-1.pngdeleted file mode 100644index 249000dea6..0000000000Binary files a/apps/sandbox/public/docsite/colorful-working-horizontal-1.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/dummy-placeholder.png b/apps/sandbox/public/docsite/dummy-placeholder.pngdeleted file mode 100644index 4b7afe8e91..0000000000Binary files a/apps/sandbox/public/docsite/dummy-placeholder.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/figma-logo.png b/apps/sandbox/public/docsite/figma-logo.pngdeleted file mode 100644index 9c77ffdc29..0000000000Binary files a/apps/sandbox/public/docsite/figma-logo.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/first-card.png b/apps/sandbox/public/docsite/first-card.pngdeleted file mode 100644index ce45b86aed..0000000000Binary files a/apps/sandbox/public/docsite/first-card.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/foundation-preview.png b/apps/sandbox/public/docsite/foundation-preview.pngdeleted file mode 100644index caf2cd7cc9..0000000000Binary files a/apps/sandbox/public/docsite/foundation-preview.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/google-logo.png b/apps/sandbox/public/docsite/google-logo.pngdeleted file mode 100644index 6171bacf9f..0000000000Binary files a/apps/sandbox/public/docsite/google-logo.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/hero-bg.png b/apps/sandbox/public/docsite/hero-bg.pngdeleted file mode 100644index d9e7ef86d6..0000000000Binary files a/apps/sandbox/public/docsite/hero-bg.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/light-working-vertical-1.png b/apps/sandbox/public/docsite/light-working-vertical-1.pngdeleted file mode 100644index 175e700cac..0000000000Binary files a/apps/sandbox/public/docsite/light-working-vertical-1.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/login-split-cover.png b/apps/sandbox/public/docsite/login-split-cover.pngdeleted file mode 100644index 175e700cac..0000000000Binary files a/apps/sandbox/public/docsite/login-split-cover.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/meta-logo.png b/apps/sandbox/public/docsite/meta-logo.pngdeleted file mode 100644index bf5cfd90de..0000000000Binary files a/apps/sandbox/public/docsite/meta-logo.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/more-like-this-1-meta.png b/apps/sandbox/public/docsite/more-like-this-1-meta.pngdeleted file mode 100644index 4414fe389b..0000000000Binary files a/apps/sandbox/public/docsite/more-like-this-1-meta.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/more-like-this-1.png b/apps/sandbox/public/docsite/more-like-this-1.pngdeleted file mode 100644index 4c0b823d65..0000000000Binary files a/apps/sandbox/public/docsite/more-like-this-1.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/more-like-this-2-meta.png b/apps/sandbox/public/docsite/more-like-this-2-meta.pngdeleted file mode 100644index c6e4caa849..0000000000Binary files a/apps/sandbox/public/docsite/more-like-this-2-meta.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/more-like-this-2.png b/apps/sandbox/public/docsite/more-like-this-2.pngdeleted file mode 100644index 82c5c1721b..0000000000Binary files a/apps/sandbox/public/docsite/more-like-this-2.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/more-like-this-3-meta.png b/apps/sandbox/public/docsite/more-like-this-3-meta.pngdeleted file mode 100644index 8505a5f0b0..0000000000Binary files a/apps/sandbox/public/docsite/more-like-this-3-meta.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/more-like-this-3.png b/apps/sandbox/public/docsite/more-like-this-3.pngdeleted file mode 100644index 63baeccdc4..0000000000Binary files a/apps/sandbox/public/docsite/more-like-this-3.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/more-like-this-4-meta.png b/apps/sandbox/public/docsite/more-like-this-4-meta.pngdeleted file mode 100644index e22f5f3608..0000000000Binary files a/apps/sandbox/public/docsite/more-like-this-4-meta.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/more-like-this-4.png b/apps/sandbox/public/docsite/more-like-this-4.pngdeleted file mode 100644index a58a5ac060..0000000000Binary files a/apps/sandbox/public/docsite/more-like-this-4.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/nest-logo.png b/apps/sandbox/public/docsite/nest-logo.pngdeleted file mode 100644index 8b6fec3696..0000000000Binary files a/apps/sandbox/public/docsite/nest-logo.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/screenshot-3.png b/apps/sandbox/public/docsite/screenshot-3.pngdeleted file mode 100644index d0cdc797df..0000000000Binary files a/apps/sandbox/public/docsite/screenshot-3.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/shopping-details.png b/apps/sandbox/public/docsite/shopping-details.pngdeleted file mode 100644index a020ef1924..0000000000Binary files a/apps/sandbox/public/docsite/shopping-details.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/theme-preview-daily.png b/apps/sandbox/public/docsite/theme-preview-daily.pngdeleted file mode 100644index 151fcf436b..0000000000Binary files a/apps/sandbox/public/docsite/theme-preview-daily.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/theme-preview-forest.png b/apps/sandbox/public/docsite/theme-preview-forest.pngdeleted file mode 100644index fff8ac42d9..0000000000Binary files a/apps/sandbox/public/docsite/theme-preview-forest.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/theme-preview-midnight.png b/apps/sandbox/public/docsite/theme-preview-midnight.pngdeleted file mode 100644index f0f90db15b..0000000000Binary files a/apps/sandbox/public/docsite/theme-preview-midnight.png and /dev/null differdiff --git a/apps/sandbox/public/docsite/theme-preview.png b/apps/sandbox/public/docsite/theme-preview.pngdeleted file mode 100644index 8ce46e0ad1..0000000000Binary files a/apps/sandbox/public/docsite/theme-preview.png and /dev/null differdiff --git a/apps/sandbox/scripts/generate-versions.js b/apps/sandbox/scripts/generate-versions.jsdeleted file mode 100644index acb10cb828..0000000000--- a/apps/sandbox/scripts/generate-versions.js+++ /dev/null@@ -1,111 +0,0 @@-// Copyright (c) Meta Platforms, Inc. and affiliates.--/* global require, console, __dirname */-/* eslint-disable @typescript-eslint/no-require-imports */-/**- * Generates apps/sandbox/src/generated/versionRegistry.ts from git tags.- * Finds all tags matching 'docsite-*' and writes them as a typed array.- */--const {execSync} = require('child_process');-const fs = require('fs');-const path = require('path');--const REPO_ROOT = path.resolve(__dirname, '..', '..', '..');-const OUT_DIR = path.resolve(__dirname, '..', 'src', 'generated');-const OUT_FILE = path.join(OUT_DIR, 'versionRegistry.ts');--function prettifyTagName(tag) {- // Remove 'docsite-v' or 'docsite-' prefix- const stripped = tag.replace(/^docsite-v?\d*-?/, '');- if (!stripped) return tag;- // Replace hyphens with spaces, title case- return stripped- .split('-')- .map(w => w.charAt(0).toUpperCase() + w.slice(1))- .join(' ');-}--function run() {- let tagsRaw;- try {- tagsRaw = execSync('git tag -l "docsite-*"', {- cwd: REPO_ROOT,- encoding: 'utf-8',- }).trim();- } catch {- tagsRaw = '';- }-- if (!tagsRaw) {- writeOutput([]);- return;- }-- const tags = tagsRaw.split('\n').filter(Boolean);-- const versions = tags.map(tag => {- const dateStr = execSync(`git log -1 --format=%cI "${tag}"`, {- cwd: REPO_ROOT,- encoding: 'utf-8',- }).trim();-- const message = execSync(- `git tag -l --format="%(contents:subject)" "${tag}"`,- {cwd: REPO_ROOT, encoding: 'utf-8'},- ).trim();-- return {- id: tag,- name: prettifyTagName(tag),- tag,- message: message || undefined,- timestamp: new Date(dateStr).getTime(),- };- });-- // Sort newest first- versions.sort((a, b) => b.timestamp - a.timestamp);-- writeOutput(versions);-}--function writeOutput(versions) {- fs.mkdirSync(OUT_DIR, {recursive: true});-- const entries = versions- .map(v => {- const fields = [- ` id: ${JSON.stringify(v.id)}`,- ` name: ${JSON.stringify(v.name)}`,- ` tag: ${JSON.stringify(v.tag)}`,- ...(v.message ? [` message: ${JSON.stringify(v.message)}`] : []),- ` timestamp: ${v.timestamp}`,- ];- return ` {\n${fields.join(',\n')},\n }`;- })- .join(',\n');-- const content = `// Copyright (c) Meta Platforms, Inc. and affiliates.--// Auto-generated by scripts/generate-versions.js — do not edit-export type GitVersion = {- id: string;- name: string;- tag: string;- message?: string;- timestamp: number;-};--export const gitVersions: GitVersion[] = [-${entries}-];-`;-- fs.writeFileSync(OUT_FILE, content, 'utf-8');- console.log(- `Wrote ${versions.length} version(s) to ${path.relative(REPO_ROOT, OUT_FILE)}`,- );-}--run();diff --git a/apps/sandbox/src/app/(fullscreen)/PreviewShell.tsx b/apps/sandbox/src/app/(fullscreen)/PreviewShell.tsxindex 7802500205..1b462c2c1b 100644--- a/apps/sandbox/src/app/(fullscreen)/PreviewShell.tsx+++ b/apps/sandbox/src/app/(fullscreen)/PreviewShell.tsx@@ -21,7 +21,6 @@ import {useThemeControls, SANDBOX_THEMES} from '../providers';import {sourceRegistry} from '../../generated/sourceRegistry';import {templates} from '../../generated/templateRegistry';import {blocks} from '../../generated/blockRegistry';-import {gitVersions} from '../../generated/versionRegistry';const blocksByHref = new Map(blocks.map(b => [b.href.replace(/\/$/, ''), b]));const basePath = process.env.NEXT_PUBLIC_BASE_PATH || '';@@ -261,373 +260,6 @@ function ChevronDownIcon(props: React.SVGProps<SVGSVGElement>) {);}-type Version = {- id: string;- name: string;- timestamp: number;- source?: 'local' | 'git';- tag?: string;- message?: string;-};--function formatRelativeTime(ts: number): string {- const diff = Date.now() - ts;- const seconds = Math.floor(diff / 1000);- if (seconds < 60) {- return 'just now';- }- const minutes = Math.floor(seconds / 60);- if (minutes < 60) {- return `${minutes} min ago`;- }- const hours = Math.floor(minutes / 60);- if (hours < 24) {- return `${hours}h ago`;- }- const days = Math.floor(hours / 24);- return `${days}d ago`;-}--function getStorageKey(pathname: string) {- return `sandbox-versions-${pathname.replace(/\/$/, '')}`;-}--function VersionRow({- version,- isActive,- onClick,- detail,- subtitle,-}: {- version: Version;- isActive: boolean;- onClick: () => void;- detail: string;- subtitle?: string;-}) {- return (- <button- onClick={onClick}- style={{- display: 'flex',- alignItems: 'center',- gap: 8,- width: '100%',- padding: '8px 12px',- border: 'none',- background: isActive ? 'rgba(10,124,255,0.06)' : 'none',- cursor: 'pointer',- textAlign: 'left',- fontSize: 13,- }}>- <span- style={{- width: 6,- height: 6,- borderRadius: '50%',- backgroundColor: isActive ? '#0A7CFF' : 'transparent',- border: isActive ? 'none' : '1px solid #ccc',- flexShrink: 0,- }}- />- <span- style={{- overflow: 'hidden',- textOverflow: 'ellipsis',- whiteSpace: 'nowrap',- minWidth: 0,- }}>- <span style={{fontWeight: isActive ? 600 : 400}}>{version.name}</span>- {subtitle && (- <span- style={{- display: 'block',- fontSize: 10,- color: '#999',- overflow: 'hidden',- textOverflow: 'ellipsis',- whiteSpace: 'nowrap',- }}>- {subtitle}- </span>- )}- </span>- <span- style={{- fontSize: 11,- color: '#999',- marginLeft: 'auto',- flexShrink: 0,- }}>- {detail}- </span>- </button>- );-}--function VersionDropdown({pathname}: {pathname: string}) {- const [localVersions, setLocalVersions] = useState<Version[]>([]);- const [activeVersionId, setActiveVersionId] = useState<string | null>(null);- const [isOpen, setIsOpen] = useState(false);- const dropdownRef = useRef<HTMLDivElement>(null);- const buttonRef = useRef<HTMLButtonElement>(null);- const [panelPos, setPanelPos] = useState<{top: number; left: number} | null>(- null,- );-- // Load local versions from localStorage- useEffect(() => {- try {- const stored = localStorage.getItem(getStorageKey(pathname));- if (stored) {- setLocalVersions(JSON.parse(stored));- }- } catch {- // ignore- }- }, [pathname]);-- // Persist local versions- useEffect(() => {- localStorage.setItem(- getStorageKey(pathname),- JSON.stringify(localVersions),- );- }, [localVersions, pathname]);-- // Merge local versions (first) + git versions- const versions: Version[] = useMemo(() => {- const local = localVersions.map(v => ({...v, source: 'local' as const}));- const git = gitVersions.map(v => ({- ...v,- source: 'git' as const,- }));- return [...local, ...git];- }, [localVersions]);-- // Calculate panel position when opening- useEffect(() => {- if (isOpen && buttonRef.current) {- const rect = buttonRef.current.getBoundingClientRect();- setPanelPos({top: rect.bottom + 4, left: rect.left});- }- }, [isOpen]);-- // Click outside to close- useEffect(() => {- if (!isOpen) {- return;- }- const handler = (e: MouseEvent) => {- if (- dropdownRef.current &&- !dropdownRef.current.contains(e.target as Node)- ) {- setIsOpen(false);- }- };- document.addEventListener('mousedown', handler);- return () => document.removeEventListener('mousedown', handler);- }, [isOpen]);-- const handleSave = () => {- const nextNum = localVersions.length + 1;- const name = prompt('Version name:', `Version ${nextNum}`);- if (!name) {- return;- }- const newVersion: Version = {- id: crypto.randomUUID(),- name,- timestamp: Date.now(),- source: 'local',- };- setLocalVersions(prev => [newVersion, ...prev]);- setActiveVersionId(newVersion.id);- };-- const activeName =- activeVersionId == null- ? 'Current'- : (versions.find(v => v.id === activeVersionId)?.name ?? 'Current');-- return (- <div ref={dropdownRef} style={{position: 'relative'}}>- <button- ref={buttonRef}- onClick={() => setIsOpen(prev => !prev)}- style={{- display: 'inline-flex',- alignItems: 'center',- gap: 4,- padding: '4px 8px',- border: 'none',- background: 'none',- cursor: 'pointer',- borderRadius: 6,- fontSize: 13,- fontWeight: 600,- color: 'inherit',- }}>- {activeName}- {versions.length > 0 && (- <span- style={{- width: 6,- height: 6,- borderRadius: '50%',- backgroundColor: '#0A7CFF',- flexShrink: 0,- }}- />- )}- <ChevronDownIcon width={14} height={14} style={{opacity: 0.5}} />- </button>- {isOpen && panelPos && (- <div- style={{- position: 'fixed',- top: panelPos.top,- left: panelPos.left,- width: 240,- backgroundColor: '#fff',- border: 'none',- borderRadius: 8,- boxShadow:- '0 4px 16px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.06)',- zIndex: 9999,- overflow: 'hidden',- }}>- {/* Header */}- <div- style={{- display: 'flex',- alignItems: 'center',- justifyContent: 'space-between',- padding: '8px 12px',- borderBottom: '1px solid rgba(0,0,0,0.08)',- }}>- <span style={{fontSize: 12, fontWeight: 600, color: '#666'}}>- Versions- </span>- <button- onClick={handleSave}- style={{- fontSize: 12,- padding: '2px 8px',- border: 'none',- background: 'none',- cursor: 'pointer',- color: '#0A7CFF',- fontWeight: 500,- borderRadius: 4,- }}>- Save version- </button>- </div>- {/* Current (live) */}- <button- onClick={() => {- setActiveVersionId(null);- setIsOpen(false);- }}- style={{- display: 'flex',- alignItems: 'center',- gap: 8,- width: '100%',- padding: '8px 12px',- border: 'none',- background:- activeVersionId == null ? 'rgba(10,124,255,0.06)' : 'none',- cursor: 'pointer',- textAlign: 'left',- fontSize: 13,- }}>- <span- style={{- width: 6,- height: 6,- borderRadius: '50%',- backgroundColor:- activeVersionId == null ? '#0A7CFF' : 'transparent',- border: activeVersionId == null ? 'none' : '1px solid #ccc',- flexShrink: 0,- }}- />- <span style={{fontWeight: activeVersionId == null ? 600 : 400}}>- Current- </span>- <span style={{fontSize: 11, color: '#999', marginLeft: 'auto'}}>- live- </span>- </button>- {/* Local versions */}- {versions.filter(v => v.source === 'local').length > 0 && (- <div- style={{- padding: '6px 12px 2px',- fontSize: 10,- fontWeight: 600,- color: '#999',- textTransform: 'uppercase',- letterSpacing: '0.05em',- }}>- Local- </div>- )}- {versions- .filter(v => v.source === 'local')- .map(v => (- <VersionRow- key={v.id}- version={v}- isActive={activeVersionId === v.id}- onClick={() => {- setActiveVersionId(v.id);- setIsOpen(false);- }}- detail={formatRelativeTime(v.timestamp)}- />- ))}- {/* Git tag versions */}- {versions.filter(v => v.source === 'git').length > 0 && (- <div- style={{- padding: '6px 12px 2px',- fontSize: 10,- fontWeight: 600,- color: '#999',- textTransform: 'uppercase',- letterSpacing: '0.05em',- borderTop:- versions.filter(v => v.source === 'local').length > 0- ? '1px solid rgba(0,0,0,0.08)'- : 'none',- }}>- Tagged- </div>- )}- {versions- .filter(v => v.source === 'git')- .map(v => (- <VersionRow- key={v.id}- version={v}- isActive={activeVersionId === v.id}- onClick={() => {- setActiveVersionId(v.id);- setIsOpen(false);- }}- detail={formatRelativeTime(v.timestamp)}- subtitle={v.tag}- />- ))}- </div>- )}- </div>- );-}type ViewportSize = 'desktop' | 'tablet' | 'mobile';const viewportWidths: Record<ViewportSize, string> = {@@ -813,10 +445,6 @@ export function PreviewShell({children}: {children: React.ReactNode}) {</button></div>- {pathname.replace(/\/$/, '').endsWith('/pages/docsite') && (- <VersionDropdown pathname={pathname} />- )}-<XDSCommandPaletteisOpen={paletteOpen}onOpenChange={setPaletteOpen}diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/AIComposer.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/AIComposer.tsxdeleted file mode 100644index 86ce4af49b..0000000000--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/AIComposer.tsx+++ /dev/null@@ -1,108 +0,0 @@-// Copyright (c) Meta Platforms, Inc. and affiliates.--'use client';--import React, {useState, useEffect} from 'react';-import {XDSChatComposer, XDSChatComposerInput} from '@xds/core/Chat';-import {XDSDropdownMenu} from '@xds/core/DropdownMenu';-import {GridIcon, PaletteIcon} from './docsite-icons';--export type ComposerMode = 'template' | 'theme';--const PLACEHOLDER: Record<ComposerMode, string> = {- template: 'What should we build?',- theme: 'Describe or drop in a screenshot of your brand...',-};--const MODE_ICON: Record<ComposerMode, React.ReactNode> = {- template: <GridIcon width={16} height={16} />,- theme: <PaletteIcon width={16} height={16} />,-};--export function AIComposer({- tabMode,- onThemeMode,-}: {- tabMode: ComposerMode;- onThemeMode?: () => void;-}) {- const [prompt, setPrompt] = useState('');- const [mode, setMode] = useState<ComposerMode>(tabMode);-- useEffect(() => {- setMode(tabMode);- }, [tabMode]);-- const handleSubmit = () => {- if (mode === 'theme' && onThemeMode) {- onThemeMode();- }- setPrompt('');- };-- return (- <>- <div- style={{- position: 'fixed',- bottom: 0,- left: 0,- right: 0,- height: 120,- background:- 'linear-gradient(to bottom, transparent, var(--color-background-surface, white))',- pointerEvents: 'none',- zIndex: 99,- }}- />- <div- style={{- position: 'fixed',- bottom: 24,- left: 0,- right: 0,- display: 'flex',- justifyContent: 'center',- pointerEvents: 'none',- zIndex: 100,- }}>- <div- style={{- width: 680,- maxWidth: 'calc(100% - 48px)',- pointerEvents: 'auto',- }}>- <XDSChatComposer- onSubmit={handleSubmit}- value={prompt}- onChange={setPrompt}- placeholder={PLACEHOLDER[mode]}- footerActions={- <XDSDropdownMenu- button={{- label: mode === 'template' ? 'Template' : 'Theme',- icon: MODE_ICON[mode],- variant: 'ghost',- size: 'sm',- }}- items={[- {- label: 'Template',- icon: GridIcon,- onClick: () => setMode('template'),- },- {- label: 'Theme',- icon: PaletteIcon,- onClick: () => setMode('theme'),- },- ]}- />- }- input={<XDSChatComposerInput placeholder={PLACEHOLDER[mode]} />}- />- </div>- </div>- </>- );-}diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/AppTopNav.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/AppTopNav.tsxdeleted file mode 100644index f83519accb..0000000000--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/AppTopNav.tsx+++ /dev/null@@ -1,200 +0,0 @@-// Copyright (c) Meta Platforms, Inc. and affiliates.--'use client';--import React, {useState, useEffect} from 'react';-import {XDSTopNav, XDSTopNavHeading} from '@xds/core/TopNav';-import {XDSTabList, XDSTab} from '@xds/core/TabList';-import {XDSButton} from '@xds/core/Button';-import {XDSStack} from '@xds/core/Layout';-import {XDSList, XDSListItem} from '@xds/core/List';-import {XDSDropdownMenu} from '@xds/core/DropdownMenu';-import {XDSCommandPalette} from '@xds/core/CommandPalette';--import {SearchIcon, ProfileIcon, FilterIcon} from './docsite-icons';-import {SEARCH_COMMANDS, basePath} from './constants';--const XDS_WORDMARK = (- <svg- width="46"- height="24"- viewBox="0 0 46 24"- fill="none"- xmlns="http://www.w3.org/2000/svg">- <path- d="M2.4239 15.8011C2.03945 16.3796 1.66972 16.9538 1.3147 17.524C0.707427 18.4992 1.42354 19.7348 2.57241 19.7348C3.13302 19.7348 3.64463 19.4209 3.91525 18.93C4.29391 18.243 4.71274 17.5352 5.17173 16.8066C5.38894 16.4618 5.60743 16.12 5.82721 15.7812C6.25251 15.1254 6.46516 14.7976 6.76252 14.68C6.99255 14.5891 7.27368 14.5899 7.50317 14.6822C7.79984 14.8014 8.00881 15.1278 8.42675 15.7804C8.64287 16.1179 8.85732 16.46 9.07008 16.8066C9.52175 17.534 9.93823 18.2339 10.3195 18.9063C10.6075 19.4141 11.1428 19.7348 11.7266 19.7348C12.9476 19.7348 13.7063 18.4203 13.0547 17.3877C12.7332 16.8781 12.3991 16.3639 12.0525 15.8453C11.3983 14.8527 10.7379 13.8906 10.0714 12.9592C9.81687 12.6036 9.68962 12.4258 9.64377 12.2384C9.60589 12.0836 9.60492 11.9307 9.64085 11.7754C9.68435 11.5874 9.80856 11.4091 10.057 11.0526C10.7093 10.1164 11.3596 9.15781 12.0078 8.1768C12.3869 7.60474 12.7521 7.03681 13.1035 6.47298C13.71 5.49987 12.9962 4.26519 11.8496 4.26519C11.2943 4.26519 10.7868 4.57405 10.5169 5.05923C10.1399 5.73688 9.72461 6.43721 9.27114 7.16022C9.06143 7.49458 8.8505 7.82569 8.63835 8.15358C8.21478 8.80819 8.003 9.1355 7.70554 9.25334C7.47561 9.34442 7.19397 9.34375 6.96448 9.25156C6.66759 9.13229 6.45853 8.80578 6.04043 8.15276C5.83116 7.82591 5.62351 7.49506 5.41747 7.16022C4.97918 6.44793 4.5738 5.76096 4.20132 5.0993C3.9136 4.58821 3.37617 4.26519 2.78967 4.26519C1.56624 4.26519 0.805692 5.58299 1.45419 6.62041C1.76588 7.11903 2.08912 7.6231 2.4239 8.1326C3.0752 9.10994 3.73263 10.059 4.3962 10.9796C4.65373 11.337 4.7825 11.5156 4.82882 11.7042C4.86709 11.86 4.86797 12.0139 4.83149 12.1702C4.78732 12.3593 4.66122 12.5385 4.40903 12.897C3.74526 13.8406 3.08355 14.8086 2.4239 15.8011Z"- fill="currentColor"- />- <path- fillRule="evenodd"- clipRule="evenodd"- d="M22.4734 4.26519C20.4471 4.26519 19.434 4.26519 18.6657 4.67201C18.0456 5.00031 17.5385 5.50739 17.2102 6.12744C16.8034 6.89579 16.8034 7.90892 16.8034 9.9352V14.0648C16.8034 16.0911 16.8034 17.1042 17.2102 17.8726C17.5385 18.4926 18.0456 18.9997 18.6657 19.328C19.434 19.7348 20.4471 19.7348 22.4734 19.7348H23.2039C24.8496 19.7348 26.2644 19.4033 27.4485 18.7403C28.6399 18.07 29.5559 17.1529 30.1963 15.989C30.8367 14.825 31.1569 13.4954 31.1569 12C31.1569 10.5046 30.8367 9.17495 30.1963 8.01105C29.5559 6.84714 28.6399 5.9337 27.4485 5.27072C26.2644 4.60037 24.8496 4.26519 23.2039 4.26519H22.4734ZM20.0092 8.74707C20.0092 8.16814 20.0092 7.87867 20.1255 7.65914C20.2193 7.48198 20.3641 7.33711 20.5413 7.24331C20.7608 7.12707 21.0503 7.12707 21.6292 7.12707H23.1927C24.6522 7.12707 25.7916 7.57274 26.6107 8.46409C27.4299 9.34807 27.8394 10.5267 27.8394 12C27.8394 13.4659 27.4299 14.6446 26.6107 15.5359C25.7916 16.4273 24.6522 16.8729 23.1927 16.8729H21.6292C21.0503 16.8729 20.7608 16.8729 20.5413 16.7567C20.3641 16.6629 20.2193 16.518 20.1255 16.3409C20.0092 16.1213 20.0092 15.8319 20.0092 15.2529V8.74707Z"- fill="currentColor"- />- <path- d="M35.4666 19.2376C36.6134 19.7459 37.9501 20 39.4767 20H39.8006C41.7144 20 43.2261 19.5801 44.3357 18.7403C45.4452 17.9006 46 16.7403 46 15.2597C46 14.3757 45.8213 13.6501 45.4638 13.0829C45.1064 12.5083 44.6559 12.0589 44.1123 11.7348C43.5761 11.4033 43.0325 11.1565 42.4814 10.9945C41.9304 10.8324 41.4575 10.7145 41.0628 10.6409L38.706 10.1878C38.0283 10.0552 37.4698 9.87477 37.0305 9.64641C36.5985 9.41068 36.3826 9.02762 36.3826 8.49724C36.3826 7.96685 36.6395 7.55064 37.1533 7.24862C37.6671 6.93923 38.3857 6.78453 39.3091 6.78453H39.6219C40.3964 6.78453 41.1224 6.93186 41.8001 7.22652C42.0982 7.35474 42.3899 7.5234 42.6754 7.73251C43.326 8.20923 44.2444 8.27802 44.8243 7.71734C45.34 7.21868 45.4053 6.39786 44.8761 5.91349C44.3498 5.43171 43.7638 5.03698 43.1181 4.72928C42.1054 4.24309 40.9511 4 39.6554 4H39.3315C38.0953 4 37.0156 4.19521 36.0922 4.58564C35.1762 4.97606 34.4613 5.52486 33.9475 6.23204C33.4411 6.93186 33.188 7.76059 33.188 8.71823C33.188 9.49171 33.3406 10.1436 33.6459 10.674C33.9587 11.2044 34.3571 11.6354 34.8411 11.9669C35.3326 12.2983 35.8539 12.5599 36.4049 12.7514C36.956 12.9355 37.4698 13.0718 37.9464 13.1602L40.3033 13.6243C40.6905 13.698 41.074 13.8011 41.4538 13.9337C41.841 14.0589 42.1612 14.2431 42.4144 14.4862C42.6676 14.7293 42.7942 15.0608 42.7942 15.4807C42.7942 16.6151 41.7814 17.1823 39.7559 17.1823H39.4432C38.49 17.1823 37.615 17.0055 36.8182 16.6519C36.4847 16.4994 36.1665 16.3134 35.8635 16.0938C35.17 15.5911 34.1857 15.5241 33.5784 16.1282C33.0651 16.6388 32.9912 17.4631 33.5198 17.9578C34.0797 18.4818 34.7287 18.9083 35.4666 19.2376Z"- fill="currentColor"- />- </svg>-);--export function AppTopNav({- activeView: _activeView,- setActiveView,- scrollContainerRef: _scrollContainerRef,- activeTab,- onActiveTabChange,- templateFilter: _templateFilter,- onTemplateFilterChange: _onTemplateFilterChange,- templateAuthors: _templateAuthors,- activeFilters: _activeFilters,- onToggleFilter: _onToggleFilter,- onClearFilters: _onClearFilters,- sortOption,- onSortChange,- isFilterOpen,- onFilterOpenChange,- craftTitle,-}: {- activeView: 'craft' | 'explore' | 'docs' | 'profile' | 'theme';- setActiveView: (- view: 'craft' | 'explore' | 'docs' | 'profile' | 'theme',- ) => void;- scrollContainerRef?: React.RefObject<HTMLDivElement | null>;- activeTab: string;- onActiveTabChange: (tab: string) => void;- templateFilter?: 'all' | 'official' | string;- onTemplateFilterChange?: (filter: 'all' | 'official' | string) => void;- templateAuthors?: string[];- activeFilters?: Set<string>;- onToggleFilter?: (filter: string) => void;- onClearFilters?: () => void;- sortOption?: string;- onSortChange?: (option: string) => void;- isFilterOpen?: boolean;- onFilterOpenChange?: (open: boolean) => void;- craftTitle?: string | null;-}) {- const [isSearchOpen, setIsSearchOpen] = useState(false);- const [isScrolled, setIsScrolled] = useState(false);-- useEffect(() => {- const el = document.getElementById('docsite-scroll');- if (!el) {- return;- }- const handleScroll = () => setIsScrolled(el.scrollTop > 170);- el.addEventListener('scroll', handleScroll, {passive: true});- handleScroll();- return () => el.removeEventListener('scroll', handleScroll);- }, []);-- const headingMenu = (- <XDSList density="spacious" style={{width: 240}}>- <XDSListItem label="Craft" onClick={() => setActiveView('craft')} />- <XDSListItem label="Library" onClick={() => setActiveView('docs')} />- </XDSList>- );-- return (- <>- <XDSTopNav- label="XDS navigation"- style={{- paddingLeft: 16,- paddingRight: 24,- position: 'relative',- zIndex: 1,- boxShadow: isScrolled ? '0 1px 3px rgba(0,0,0,0.08)' : 'none',- transition: 'box-shadow 200ms ease',- }}- heading={- <XDSTopNavHeading- logo={XDS_WORDMARK}- headingHref={`${basePath}/pages/docsite/`}- menu={headingMenu}- />- }- centerContent={- isScrolled && !craftTitle ? (- <XDSTabList- value={activeTab}- onChange={onActiveTabChange}- size="sm">- <XDSTab value="all" label="All" />- <XDSTab value="templates" label="Templates" />- <XDSTab value="theme" label="Theme" />- <XDSTab value="components" label="Components" />- </XDSTabList>- ) : undefined- }- endContent={- <XDSStack direction="horizontal" gap={2}>- {isScrolled && !craftTitle && (- <>- <XDSButton- label="Filter"- variant="ghost"- size="sm"- isIconOnly- icon={<FilterIcon />}- onClick={() => onFilterOpenChange?.(!isFilterOpen)}- />- <XDSDropdownMenu- button={{- label:- sortOption === 'trending'- ? 'Trending'- : sortOption === 'newest'- ? 'Newest'- : 'Oldest',- variant: 'ghost',- size: 'sm',- style: {marginRight: -8},- }}- items={[- {- label: 'Trending',- onClick: () => onSortChange?.('trending'),- },- {- label: 'Newest',- onClick: () => onSortChange?.('newest'),- },- {- label: 'Oldest',- onClick: () => onSortChange?.('oldest'),- },- ]}- />- </>- )}- <XDSButton- label="Search"- variant="ghost"- size="sm"- isIconOnly- icon={<SearchIcon />}- onClick={() => setIsSearchOpen(true)}- />- <XDSButton- label="Profile"- variant="ghost"- size="sm"- isIconOnly- icon={<ProfileIcon />}- onClick={() => setActiveView('profile')}- />- </XDSStack>- }- />-- <XDSCommandPalette- isOpen={isSearchOpen}- onOpenChange={setIsSearchOpen}- searchSource={SEARCH_COMMANDS}- label="Search templates and components"- />- </>- );-}diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/ChatPanel.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/ChatPanel.tsxdeleted file mode 100644index 8ca1947654..0000000000--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/ChatPanel.tsx+++ /dev/null@@ -1,574 +0,0 @@-// Copyright (c) Meta Platforms, Inc. and affiliates.--'use client';--import * as stylex from '@stylexjs/stylex';-import React, {useState, useEffect, useRef} from 'react';-import {XDSButton} from '@xds/core/Button';-import {- XDSChatComposer,- XDSChatComposerInput,- XDSChatMessage,- XDSChatMessageBubble,-} from '@xds/core/Chat';-import {XDSDivider} from '@xds/core/Divider';-import {XDSEmptyState} from '@xds/core/EmptyState';-import {XDSText} from '@xds/core/Text';-import {XDSTextInput} from '@xds/core/TextInput';-import {ArrowLeftIcon, CursorIcon} from './docsite-icons';-import {MOCK_CODE} from './constants';--const composerStyles = stylex.create({- border: {- borderWidth: 1,- borderStyle: 'solid',- borderColor: 'var(--color-border-emphasized, #CCD3DB)',- },-});--export type PanelTab = 'configure' | 'properties' | 'code';--function PropertyInputs() {- const [fontFamily, setFontFamily] = useState('System UI');- const [fontSize, setFontSize] = useState('32px');- const [fontWeight, setFontWeight] = useState('700');- const [lineHeight, setLineHeight] = useState('1.25');- const [letterSpacing, setLetterSpacing] = useState('-0.02em');- const [color, setColor] = useState('#1C2B33');- const [marginTop, setMarginTop] = useState('0px');- const [marginBottom, setMarginBottom] = useState('16px');- const [padding, setPadding] = useState('0px');- const [imgSrc, setImgSrc] = useState('hero-banner.png');- const [altText, setAltText] = useState('Hero banner illustration');- const [objectFit, setObjectFit] = useState('cover');- const [aspectRatio, setAspectRatio] = useState('16 / 9');- const [background, setBackground] = useState('transparent');- const [borderRadius, setBorderRadius] = useState('0px');- const [opacity, setOpacity] = useState('1');-- return (- <div style={{display: 'flex', flexDirection: 'column', gap: 16}}>- <XDSText type="label" color="secondary">- Typography- </XDSText>- <div style={{display: 'flex', flexDirection: 'column', gap: 8}}>- <XDSTextInput- label="Font family"- value={fontFamily}- onChange={setFontFamily}- size="sm"- />- <div style={{display: 'flex', gap: 8}}>- <div style={{flex: 1, minWidth: 0}}>- <XDSTextInput- label="Font size"- value={fontSize}- onChange={setFontSize}- size="sm"- />- </div>- <div style={{flex: 1, minWidth: 0}}>- <XDSTextInput- label="Weight"- value={fontWeight}- onChange={setFontWeight}- size="sm"- />- </div>- </div>- <div style={{display: 'flex', gap: 8}}>- <div style={{flex: 1, minWidth: 0}}>- <XDSTextInput- label="Line height"- value={lineHeight}- onChange={setLineHeight}- size="sm"- />- </div>- <div style={{flex: 1, minWidth: 0}}>- <XDSTextInput- label="Letter spacing"- value={letterSpacing}- onChange={setLetterSpacing}- size="sm"- />- </div>- </div>- <XDSTextInput- label="Color"- value={color}- onChange={setColor}- size="sm"- />- </div>-- <XDSDivider variant="strong" />-- <XDSText type="label" color="secondary">- Spacing- </XDSText>- <div style={{display: 'flex', flexDirection: 'column', gap: 8}}>- <div style={{display: 'flex', gap: 8}}>- <div style={{flex: 1, minWidth: 0}}>- <XDSTextInput- label="Margin top"- value={marginTop}- onChange={setMarginTop}- size="sm"- />- </div>- <div style={{flex: 1, minWidth: 0}}>- <XDSTextInput- label="Margin bottom"- value={marginBottom}- onChange={setMarginBottom}- size="sm"- />- </div>- </div>- <XDSTextInput- label="Padding"- value={padding}- onChange={setPadding}- size="sm"- />- </div>-- <XDSDivider variant="strong" />-- <XDSText type="label" color="secondary">- Image- </XDSText>- <div style={{display: 'flex', flexDirection: 'column', gap: 8}}>- <XDSTextInput- label="Source"- value={imgSrc}- onChange={setImgSrc}- size="sm"- />- <XDSTextInput- label="Alt text"- value={altText}- onChange={setAltText}- size="sm"- />- <div style={{display: 'flex', gap: 8}}>- <div style={{flex: 1, minWidth: 0}}>- <XDSTextInput- label="Object fit"- value={objectFit}- onChange={setObjectFit}- size="sm"- />- </div>- <div style={{flex: 1, minWidth: 0}}>- <XDSTextInput- label="Aspect ratio"- value={aspectRatio}- onChange={setAspectRatio}- size="sm"- />- </div>- </div>- </div>-- <XDSDivider variant="strong" />-- <XDSText type="label" color="secondary">- Appearance- </XDSText>- <div style={{display: 'flex', flexDirection: 'column', gap: 8}}>- <XDSTextInput- label="Background"- value={background}- onChange={setBackground}- size="sm"- />- <div style={{display: 'flex', gap: 8}}>- <div style={{flex: 1, minWidth: 0}}>- <XDSTextInput- label="Border radius"- value={borderRadius}- onChange={setBorderRadius}- size="sm"- />- </div>- <div style={{flex: 1, minWidth: 0}}>- <XDSTextInput- label="Opacity"- value={opacity}- onChange={setOpacity}- size="sm"- />- </div>- </div>- </div>- </div>- );-}--function CodeEditor() {- const [code, setCode] = useState(MOCK_CODE);- const textareaRef = useRef<HTMLTextAreaElement>(null);- const lineCount = code.split('\n').length;-- return (- <div- style={{- flex: 1,- minHeight: 0,- display: 'flex',- flexDirection: 'column',- overflow: 'hidden',- }}>- <div- style={{- display: 'flex',- alignItems: 'center',- justifyContent: 'space-between',- padding: '8px 12px',- borderBottom:- '1px solid var(--color-border-default, rgba(0,0,0,0.1))',- }}>- <XDSText type="supporting" color="secondary">- useUser.ts- </XDSText>- <XDSText type="supporting" color="secondary">- TypeScript- </XDSText>- </div>- <div- style={{- flex: 1,- overflow: 'auto',- display: 'flex',- background: 'var(--color-background-wash, #F5F6F7)',- }}>- <div- aria-hidden- style={{- padding: '12px 0',- textAlign: 'right',- userSelect: 'none',- minWidth: 40,- flexShrink: 0,- }}>- {Array.from({length: lineCount}, (_, i) => (- <div- key={i}- style={{- fontFamily: 'monospace',- fontSize: 13,- lineHeight: '20px',- padding: '0 10px',- color: 'var(--color-text-quaternary, #BCC0C4)',- }}>- {i + 1}- </div>- ))}- </div>- <textarea- ref={textareaRef}- value={code}- onChange={e => setCode(e.target.value)}- spellCheck={false}- style={{- flex: 1,- border: 'none',- outline: 'none',- resize: 'none',- padding: '12px 12px 12px 4px',- fontFamily: 'monospace',- fontSize: 13,- lineHeight: '20px',- background: 'transparent',- color: 'var(--color-text-primary, #1C2B33)',- tabSize: 2,- whiteSpace: 'pre',- overflowWrap: 'normal',- overflowX: 'auto',- }}- onKeyDown={e => {- if (e.key === 'Tab') {- e.preventDefault();- const ta = textareaRef.current;- if (!ta) {- return;- }- const start = ta.selectionStart;- const end = ta.selectionEnd;- const val = ta.value;- setCode(val.substring(0, start) + ' ' + val.substring(end));- requestAnimationFrame(() => {- ta.selectionStart = ta.selectionEnd = start + 2;- });- }- }}- />- </div>- </div>- );-}--export type PointedElement = {- tagName: string;- componentName?: string;- rect?: {x: number; y: number; width: number; height: number};-} | null;--export function ChatPanel({- isGenerating,- onSend,- reply,- activeView: _activeView,- setActiveView: _setActiveView,- templateName,- onBack,- activeTab,- onTabChange,- pointedElement,- hideHeader = false,-}: {- isGenerating: boolean;- onSend?: (prompt: string) => void;- reply?: string | null;- activeView: 'craft' | 'explore' | 'docs' | 'profile' | 'theme';- setActiveView: (- view: 'craft' | 'explore' | 'docs' | 'profile' | 'theme',- ) => void;- templateName?: string;- onBack?: () => void;- activeTab?: PanelTab;- onTabChange?: (tab: PanelTab) => void;- pointedElement?: PointedElement;- hideHeader?: boolean;-}) {- const [prompt, setPrompt] = useState('');- const [messages, setMessages] = useState<- {role: 'user' | 'assistant'; text: string}[]- >([]);- const tab = activeTab ?? 'configure';- const scrollAreaRef = useRef<HTMLDivElement>(null);- const prevReplyRef = useRef<string | null>(null);-- useEffect(() => {- if (reply && reply !== prevReplyRef.current) {- setMessages(prev => [...prev, {role: 'assistant', text: reply}]);- prevReplyRef.current = reply;- }- }, [reply]);-- useEffect(() => {- scrollAreaRef.current?.scrollTo({- top: scrollAreaRef.current.scrollHeight,- behavior: 'smooth',- });- }, [messages, isGenerating]);-- return (- <div- style={{- display: 'flex',- flexDirection: 'column' as const,- height: '100%',- width: '100%',- }}>- {/* Tab bar (editor mode only) */}- {!hideHeader && templateName && onTabChange && (- <div- style={{- display: 'flex',- alignItems: 'center',- padding: '0 8px 0 16px',- borderBottom: 'none',- flexShrink: 0,- }}>- {onBack && (- <XDSButton- label="Back"- variant="ghost"- size="sm"- icon={<ArrowLeftIcon />}- isIconOnly- onClick={onBack}- style={{flexShrink: 0, marginRight: 4}}- />- )}- {(['configure', 'properties', 'code'] as const).map(t => (- <button- key={t}- onClick={() => onTabChange(t)}- style={{- flex: 1,- padding: '10px 0',- background: 'none',- border: 'none',- borderBottom:- tab === t- ? '2px solid var(--color-text-primary, #111)'- : '2px solid transparent',- marginBottom: -1,- cursor: 'pointer',- textAlign: 'center' as const,- transition: 'border-color 150ms ease',- }}>- <XDSText type="body" color={tab === t ? 'primary' : 'secondary'}>- {t === 'configure'- ? 'Craft'- : t === 'properties'- ? 'Properties'- : 'Code'}- </XDSText>- </button>- ))}- </div>- )}-- {/* Configure tab (or default when no tabs) */}- {(!templateName || !onTabChange || tab === 'configure') && (- <>- <div- ref={scrollAreaRef}- style={{flex: 1, padding: 16, overflow: 'auto'}}>- {messages.length === 0 && (- <div- style={{- display: 'flex',- flexDirection: 'column',- alignItems: 'center',- justifyContent: 'center',- height: '100%',- gap: 8,- textAlign: 'center',- padding: '0 24px',- }}>- <XDSText type="display-3">- What would you- <br />- like to change?- </XDSText>- <XDSText type="body" color="secondary">- Describe layout changes, swap components, or ask for a- different style.- </XDSText>- </div>- )}- {messages.map((msg, i) => (- <div key={i} style={{marginBottom: 16}}>- <XDSChatMessage- sender={msg.role === 'user' ? 'user' : 'assistant'}>- <XDSChatMessageBubble>{msg.text}</XDSChatMessageBubble>- </XDSChatMessage>- </div>- ))}- </div>-- {(() => {- const wrapperStyle: React.CSSProperties &- Record<`--${string}`, string> = {- padding: 12,- // Override shadow tokens so the composer body inherits none- '--shadow-low': 'none',- '--shadow-med': 'none',- };- const composerStyle: React.CSSProperties &- Record<`--${string}`, string> = {- '--shadow-low': 'none',- '--shadow-med': 'none',- '--_chat-composer-radius': 'var(--radius-container)',- '--_button-radius': 'var(--radius-full)',- };- return (- <div style={wrapperStyle}>- <XDSChatComposer- onSubmit={() => {- if (!prompt.trim()) {- return;- }- setMessages(prev => [- ...prev,- {role: 'user', text: prompt.trim()},- ]);- onSend?.(prompt);- setPrompt('');- }}- value={prompt}- onChange={setPrompt}- placeholder="Ask for changes"- input={<XDSChatComposerInput placeholder="Ask for changes" />}- xstyle={composerStyles.border}- style={composerStyle}- />- </div>- );- })()}- </>- )}- {templateName && onTabChange && tab === 'properties' && (- <div- style={{- flex: 1,- minHeight: 0,- padding: pointedElement ? '16px 16px 32px' : 16,- overflow: 'auto',- display: 'flex',- flexDirection: 'column',- ...(pointedElement- ? {}- : {alignItems: 'center', justifyContent: 'center'}),- }}>- {pointedElement ? (- <div- style={{- display: 'flex',- flexDirection: 'column' as const,- gap: 16,- }}>- <div>- <XDSText type="supporting" color="secondary">- Element- </XDSText>- <XDSText type="body" style={{fontWeight: 600, marginTop: 4}}>- {'<'}- {pointedElement.tagName.toLowerCase()}- {'>'}- {pointedElement.componentName && (- <span- style={{- marginLeft: 8,- fontSize: 12,- color: 'var(--color-text-secondary, #65676B)',- fontWeight: 400,- }}>- {pointedElement.componentName}- </span>- )}- </XDSText>- </div>- <XDSDivider variant="strong" />- <PropertyInputs />- </div>- ) : (- <XDSEmptyState- icon={- <CursorIcon- style={{- width: 32,- height: 32,- color: 'var(--color-text-quaternary, #BCC0C4)',- }}- />- }- title="No element selected"- description="Click the Point tool in the toolbar, then click an element in the preview"- isCompact- />- )}- </div>- )}-- {/* Code tab */}- {templateName && onTabChange && tab === 'code' && <CodeEditor />}- </div>- );-}diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/ComponentPreviews.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/ComponentPreviews.tsxdeleted file mode 100644index c98f78c5c0..0000000000--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/ComponentPreviews.tsx+++ /dev/null@@ -1,367 +0,0 @@-// Copyright (c) Meta Platforms, Inc. and affiliates.--'use client';--import React, {useState} from 'react';-import {XDSHeading, XDSText} from '@xds/core/Text';-import {XDSButton} from '@xds/core/Button';-import {XDSCard} from '@xds/core/Card';-import {XDSAvatar} from '@xds/core/Avatar';-import {XDSBadge} from '@xds/core/Badge';-import {XDSBanner} from '@xds/core/Banner';-import {XDSCheckboxInput} from '@xds/core/CheckboxInput';-import {XDSDropdownMenu} from '@xds/core/DropdownMenu';-import {XDSProgressBar} from '@xds/core/ProgressBar';-import {XDSRadioList, XDSRadioListItem} from '@xds/core/RadioList';-import {XDSSlider} from '@xds/core/Slider';-import {XDSSpinner} from '@xds/core/Spinner';-import {XDSSwitch} from '@xds/core/Switch';-import {XDSTabList, XDSTab} from '@xds/core/TabList';-import {XDSTextInput} from '@xds/core/TextInput';-import {XDSSelector} from '@xds/core/Selector';-import {XDSTextArea} from '@xds/core/TextArea';-import {XDSToken} from '@xds/core/Token';-import {XDSTooltip} from '@xds/core/Tooltip';--export const COMPONENT_PREVIEW_LIST: {- key: string;- label: string;- preview: React.ReactNode;-}[] = [- {- key: 'button',- label: 'Button',- preview: (- <div- style={{- display: 'flex',- gap: 10,- flexWrap: 'wrap',- alignItems: 'center',- }}>- <XDSButton label="Primary" variant="primary" />- <XDSButton label="Secondary" variant="secondary" />- <XDSButton label="Ghost" variant="ghost" />- </div>- ),- },- {- key: 'avatar',- label: 'Avatar',- preview: (- <div style={{display: 'flex', gap: 16, alignItems: 'center'}}>- <XDSAvatar name="Alice" size="small" />- <XDSAvatar name="Bob" size="medium" />- <XDSAvatar name="Charlie" size="large" />- </div>- ),- },- {- key: 'badge',- label: 'Badge',- preview: (- <div style={{display: 'flex', gap: 10, flexWrap: 'wrap'}}>- <XDSBadge label="Default" />- <XDSBadge label="Info" variant="info" />- <XDSBadge label="Success" variant="success" />- <XDSBadge label="Warning" variant="warning" />- <XDSBadge label="Error" variant="error" />- </div>- ),- },- {- key: 'card',- label: 'Card',- preview: (- <XDSCard>- <div style={{padding: 16}}>- <XDSHeading level={4}>Card Title</XDSHeading>- <div style={{marginTop: 8}}>- <XDSText type="body" color="secondary">- A flexible surface for grouping related content.- </XDSText>- </div>- </div>- </XDSCard>- ),- },- {- key: 'banner',- label: 'Banner',- preview: (- <div- style={{- display: 'flex',- flexDirection: 'column',- gap: 10,- width: '100%',- }}>- <XDSBanner status="info" title="Information">- <XDSText type="body">Informational message.</XDSText>- </XDSBanner>- <XDSBanner status="success" title="Success">- <XDSText type="body">Operation completed.</XDSText>- </XDSBanner>- </div>- ),- },- {- key: 'textinput',- label: 'TextInput',- preview: (- <div- style={{- display: 'flex',- flexDirection: 'column',- gap: 12,- maxWidth: 320,- }}>- <XDSTextInput label="Name" placeholder="Enter your name" value="" />- <XDSTextInput label="Email" placeholder="[email protected]" value="" />- </div>- ),- },- {- key: 'tablist',- label: 'TabList',- preview: <TabListPreview />,- },- {- key: 'dropdownmenu',- label: 'DropdownMenu',- preview: (- <div style={{display: 'flex', gap: 12}}>- <XDSDropdownMenu- button={{label: 'Actions', variant: 'secondary', size: 'md'}}- items={[- {label: 'Edit'},- {label: 'Duplicate'},- {label: 'Archive'},- {label: 'Delete'},- ]}- />- <XDSDropdownMenu- button={{label: 'Options', variant: 'ghost', size: 'md'}}- items={[{label: 'Settings'}, {label: 'Preferences'}, {label: 'Help'}]}- />- </div>- ),- },- {- key: 'switch',- label: 'Switch',- preview: <SwitchPreview />,- },- {- key: 'checkbox',- label: 'Checkbox',- preview: <CheckboxPreview />,- },- {- key: 'radiolist',- label: 'RadioList',- preview: <RadioListPreview />,- },- {- key: 'progressbar',- label: 'ProgressBar',- preview: (- <div- style={{- display: 'flex',- flexDirection: 'column',- gap: 16,- width: '100%',- minWidth: 280,- }}>- <div style={{width: '100%'}}>- <XDSText type="supporting" color="secondary">- 25%- </XDSText>- <div style={{marginTop: 6, width: '100%'}}>- <XDSProgressBar value={25} label="Progress" isLabelHidden />- </div>- </div>- <div style={{width: '100%'}}>- <XDSText type="supporting" color="secondary">- 60%- </XDSText>- <div style={{marginTop: 6, width: '100%'}}>- <XDSProgressBar value={60} label="Progress" isLabelHidden />- </div>- </div>- <div style={{width: '100%'}}>- <XDSText type="supporting" color="secondary">- 100%- </XDSText>- <div style={{marginTop: 6, width: '100%'}}>- <XDSProgressBar value={100} label="Progress" isLabelHidden />- </div>- </div>- </div>- ),- },- {- key: 'slider',- label: 'Slider',- preview: <SliderPreview />,- },- {- key: 'token',- label: 'Token',- preview: (- <div style={{display: 'flex', gap: 8, flexWrap: 'wrap'}}>- <XDSToken label="Design" />- <XDSToken label="Engineering" />- <XDSToken label="Product" />- <XDSToken label="Research" />- </div>- ),- },- {- key: 'tooltip',- label: 'Tooltip',- preview: (- <div style={{display: 'flex', gap: 12}}>- <XDSTooltip content="Primary action">- <XDSButton label="Hover me" variant="primary" />- </XDSTooltip>- <XDSTooltip content="Secondary action">- <XDSButton label="Or me" variant="secondary" />- </XDSTooltip>- </div>- ),- },- {- key: 'selector',- label: 'Selector',- preview: <SelectorPreview />,- },- {- key: 'spinner',- label: 'Spinner',- preview: (- <div style={{display: 'flex', gap: 24, alignItems: 'center'}}>- <XDSSpinner size="sm" />- <XDSSpinner size="md" />- <XDSSpinner size="lg" />- </div>- ),- },- {- key: 'text',- label: 'Text',- preview: (- <div style={{display: 'flex', flexDirection: 'column', gap: 6}}>- <XDSHeading level={2}>Heading</XDSHeading>- <XDSText type="body">Body text for content and descriptions.</XDSText>- <XDSText type="supporting" color="secondary">- Supporting text for metadata.- </XDSText>- </div>- ),- },- {- key: 'textarea',- label: 'TextArea',- preview: (- <div style={{width: '100%'}}>- <XDSTextArea- label="Message"- placeholder="Write something..."- value=""- />- </div>- ),- },-];--export const COMPONENT_PREVIEWS: {[key: string]: React.ReactNode} =- Object.fromEntries(COMPONENT_PREVIEW_LIST.map(c => [c.key, c.preview]));--function SwitchPreview() {- const [a, setA] = useState(true);- const [b, setB] = useState(true);- return (- <div- style={{- display: 'flex',- flexDirection: 'column',- gap: 12,- maxWidth: 240,- }}>- <XDSSwitch label="Notifications" value={a} onChange={v => setA(v)} />- <XDSSwitch label="Dark mode" value={b} onChange={v => setB(v)} />- </div>- );-}--function TabListPreview() {- const [tab, setTab] = useState('overview');- return (- <XDSTabList value={tab} onChange={setTab}>- <XDSTab value="overview" label="Overview" />- <XDSTab value="analytics" label="Analytics" />- <XDSTab value="settings" label="Settings" />- </XDSTabList>- );-}--function CheckboxPreview() {- const [a, setA] = useState(true);- const [b, setB] = useState(false);- const [c, setC] = useState(false);- return (- <div style={{display: 'flex', flexDirection: 'column', gap: 8}}>- <XDSCheckboxInput- label="Accept terms"- value={a}- onChange={v => setA(v)}- />- <XDSCheckboxInput- label="Subscribe to newsletter"- value={b}- onChange={v => setB(v)}- />- <XDSCheckboxInput label="Remember me" value={c} onChange={v => setC(v)} />- </div>- );-}--function RadioListPreview() {- const [val, setVal] = useState('medium');- return (- <XDSRadioList label="Size" value={val} onChange={setVal}>- <XDSRadioListItem value="small" label="Small" />- <XDSRadioListItem value="medium" label="Medium" />- <XDSRadioListItem value="large" label="Large" />- </XDSRadioList>- );-}--function SliderPreview() {- const [val, setVal] = useState(50);- return (- <div style={{width: '100%'}}>- <XDSSlider label="Volume" value={val} onChange={setVal} />- </div>- );-}--function SelectorPreview() {- const [val, setVal] = useState('option1');- return (- <div style={{width: '100%'}}>- <XDSSelector- label="Category"- value={val}- onChange={setVal}- options={[- {value: 'option1', label: 'Design'},- {value: 'option2', label: 'Engineering'},- {value: 'option3', label: 'Product'},- ]}- />- </div>- );-}diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/CraftingCat.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/CraftingCat.tsxdeleted file mode 100644index e65cea771c..0000000000--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/CraftingCat.tsx+++ /dev/null@@ -1,116 +0,0 @@-// Copyright (c) Meta Platforms, Inc. and affiliates.--'use client';--import React from 'react';--const SHAPES = [- {- gradient: 'linear-gradient(135deg, #F5B8C8, #FDCEB0)',- size: 22,- radius: '50%' as const,- delay: 0,- },- {- gradient: 'linear-gradient(135deg, #A8E6CF, #A0D2F5)',- size: 22,- radius: 5,- delay: 0.12,- },- {- gradient: 'linear-gradient(135deg, #C4B8F5, #F2B5D4)',- size: 22,- radius: '50%' as const,- delay: 0.24,- },- {- gradient: 'linear-gradient(135deg, #80D8C4, #FFE0A3)',- size: 22,- radius: 5,- delay: 0.36,- },-];--export function CraftingCat() {- return (- <>- <style>{`- @keyframes craftBounce {- 0%, 100% { transform: translateY(0); }- 40% { transform: translateY(-36px); }- 55% { transform: translateY(-2px); }- 70% { transform: translateY(-14px); }- }- @keyframes craftShadow {- 0%, 100% { transform: scaleX(1); opacity: 0.15; }- 40% { transform: scaleX(0.4); opacity: 0.05; }- 55% { transform: scaleX(0.95); opacity: 0.14; }- 70% { transform: scaleX(0.6); opacity: 0.08; }- }- @keyframes craftPulse {- 0%, 100% { opacity: 0.5; }- 50% { opacity: 1; }- }- `}</style>- <div- style={{- width: '100%',- height: '100%',- display: 'flex',- flexDirection: 'column',- alignItems: 'center',- justifyContent: 'center',- backgroundColor: 'var(--color-background-surface, #fff)',- }}>- <div- style={{- display: 'flex',- gap: 20,- alignItems: 'flex-end',- height: 80,- }}>- {SHAPES.map((s, i) => (- <div- key={i}- style={{- display: 'flex',- flexDirection: 'column',- alignItems: 'center',- }}>- <div- style={{- width: s.size,- height: s.size,- borderRadius: s.radius,- background: s.gradient,- animation: `craftBounce 2s cubic-bezier(0.34, 1.56, 0.64, 1) ${s.delay}s infinite`,- }}- />- <div- style={{- width: 14,- height: 4,- borderRadius: '50%',- background: 'var(--color-text-quaternary, rgba(0,0,0,0.08))',- marginTop: 8,- animation: `craftShadow 2s ease-in-out ${s.delay}s infinite`,- }}- />- </div>- ))}- </div>- <span- style={{- marginTop: 24,- fontSize: 13,- fontWeight: 500,- letterSpacing: 0.3,- color: 'var(--color-text-secondary, #65676B)',- animation: 'craftPulse 2s ease-in-out infinite',- }}>- Crafting your layout...- </span>- </div>- </>- );-}diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/DocsView.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/DocsView.tsxdeleted file mode 100644index f9a73746b4..0000000000--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/DocsView.tsx+++ /dev/null@@ -1,5233 +0,0 @@-// Copyright (c) Meta Platforms, Inc. and affiliates.--'use client';--import React, {useState, useEffect, useMemo} from 'react';--import * as stylex from '@stylexjs/stylex';-import {XDSAppShell} from '@xds/core/AppShell';-import {XDSTopNav, XDSTopNavHeading} from '@xds/core/TopNav';-import {XDSSideNav, XDSSideNavItem, XDSSideNavSection} from '@xds/core/SideNav';-import {XDSHeading, XDSText} from '@xds/core/Text';-import {XDSButton} from '@xds/core/Button';-import {XDSStack} from '@xds/core/Layout';-import {XDSCard} from '@xds/core/Card';-import {XDSList, XDSListItem} from '@xds/core/List';-import {XDSNavMenuItem} from '@xds/core/NavMenu';-import {XDSTable, pixel} from '@xds/core/Table';-import {XDSSection} from '@xds/core/Section';-import {XDSCenter} from '@xds/core/Center';-import {XDSIconButton} from '@xds/core/IconButton';-import {XDSCodeBlock} from '@xds/core/CodeBlock';-import {XDSCommandPalette} from '@xds/core/CommandPalette';-import {- ExternalLinkIcon,- FullscreenIcon,- SearchIcon,- ProfileIcon,- PaletteIcon,- GridIcon,- CodeIcon,- SparklesIcon,- HeartIcon,- TerminalIcon,- ChatIcon,- ChartsIcon,- DownloadIcon,- ChevronDownIcon,-} from './docsite-icons';-import {XDSBadge} from '@xds/core/Badge';-import {XDSStatusDot} from '@xds/core/StatusDot';-import {useXDSCollapsible} from '@xds/core/Collapsible';-import {XDSSwitch} from '@xds/core/Switch';-import {XDSAvatar} from '@xds/core/Avatar';-import {XDSProgressBar} from '@xds/core/ProgressBar';-import {XDSIcon} from '@xds/core/Icon';-import {XDSDivider} from '@xds/core/Divider';-import {XDSTabList, XDSTab} from '@xds/core/TabList';-import {XDSTextInput} from '@xds/core/TextInput';-import {XDSChatComposer} from '@xds/core/Chat';-import {XDSLink} from '@xds/core/Link';-import {- changelogVersions,- deprecations,- GITHUB_REPO,- type ChangelogVersion,- type ChangelogItem,-} from '@/generated/changelogRegistry';-import {- commands as cliCommands,- globalOptions as cliGlobalOptions,- CLI_VERSION,- type CliCommand,-} from '@/generated/cliRegistry';-import {XDSPopover} from '@xds/core/Popover';-import {XDSGrid} from '@xds/core/Grid';-import {XDSTheme, defineTheme} from '@xds/core/theme';-import type {XDSDefinedTheme} from '@xds/core/theme';-import {defaultTheme} from '@xds/theme-default/built';-import {neutralTheme} from '@xds/theme-neutral/built';-import {brutalistTheme} from '@xds/theme-brutalist/built';-import {matchaTheme} from '@xds/theme-matcha/built';-import {dailyTheme} from '@xds/theme-daily/built';-import {XDSNumberInput} from '@xds/core/NumberInput';-import {XDSSelector} from '@xds/core/Selector';-import {defaultIconRegistry} from '@xds/theme-default';-import {COMPONENT_PREVIEWS} from './ComponentPreviews';-import {SEARCH_COMMANDS, basePath} from './constants';-import {- COMPONENT_CATEGORIES,- getComponentName,- getComponentDesc,-} from './docsview-data';--const localStyles = stylex.create({- previewCard: {- borderRadius: 12,- cursor: 'pointer',- },- tabListFlush: {- marginInlineStart: '-12px',- },- pageContainer: {- maxWidth: 840,- marginInline: 'auto',- paddingBlock: 32,- paddingInline: 40,- },-});--// ----------------------------------------------------------------------------// Library overview data-// -----------------------------------------------------------------------------const FOUNDATION_ITEMS: {- key: string;- title: string;- description: string;- image: string;-}[] = [- {- key: 'typography',- title: 'Typography',- image: `${basePath}/docsite/FoundationsTypogrpahy.png`,- description:- 'A type scale from display-1 down to supporting text, with weight and color options. Establishes visual hierarchy without guessing font sizes.',- },- {- key: 'colors',- title: 'Colors',- image: `${basePath}/docsite/FoundationsColors.png`,- description:- 'A semantic palette that adapts across themes. Use surface, text, border, and accent tokens instead of raw hex values so your UI stays consistent in light, dark, and custom themes.',- },- {- key: 'shape',- title: 'Shape',- image: `${basePath}/docsite/FoundationsShape.png`,- description:- 'Border radius tokens from sharp (2px) to fully rounded (pill). Controls, cards, and containers each have a designated radius so shapes feel intentional.',- },- {- key: 'spacing',- title: 'Spacing',- image: `${basePath}/docsite/FoundationsSpacing.png`,- description:- 'A 4px-based scale (0–10) used for padding, margins, and gaps. Keeps layouts aligned to a consistent rhythm across every component and page.',- },- {- key: 'icons',- title: 'Icons',- image: `${basePath}/docsite/FoundationsIcons.png`,- description:- 'A consistent icon set built for XDS components. Semantic and non-semantic color options with multiple sizes.',- },- {- key: 'illustrations',- title: 'Illustrations',- image: `${basePath}/docsite/FoundationsIllustrations.png`,- description:- 'Illustration guidelines and assets for empty states, onboarding, and feature highlights.',- },-];--type PackageCategory = 'building' | 'designing';--const PACKAGE_FILTERS: {label: string; value: PackageCategory | 'all'}[] = [- {label: 'All', value: 'all'},- {label: 'Building', value: 'building'},- {label: 'Designing', value: 'designing'},-];--const LIBRARY_PACKAGES: {- key: string;- name: string;- description: string;- version?: string;- status: 'Stable' | 'Published' | 'Experimental' | 'Coming Soon';- iconType: 'core' | 'charts' | 'chat' | 'cli' | 'theme' | 'design';- image: string;- category: PackageCategory;- href?: string;-}[] = [- {- key: 'pkg-cli',- name: '@xds/cli',- description:- 'CLI for scaffolding projects, theming, templates, swizzling components, and agent docs.',- version: '0.0.12',- status: 'Stable',- iconType: 'cli',- image: `${basePath}/docsite/LibrariesCli.png`,- category: 'building',- },- {- key: 'pkg-core',- name: '@xds/core',- description:- 'Core UI component library with 60+ accessible, themeable React components built on StyleX.',- version: '0.0.12',- status: 'Stable',- iconType: 'core',- image: `${basePath}/docsite/LibrariesCore.png`,- category: 'building',- },- {- key: 'pkg-vega',- name: '@xds/vega',- description:- 'Chart and data visualization components. Bar, line, area, pie, and more — built for dashboards and analytics.',- status: 'Coming Soon',- iconType: 'charts',- image: `${basePath}/docsite/LibrariesVega.png`,- category: 'building',- },- {- key: 'pkg-theme-default',- name: '@xds/theme-default',- description:- 'Clean, professional theme with blue accent and Heroicons. The default look for XDS applications.',- version: '0.0.12',- status: 'Stable',- iconType: 'theme',- image: `${basePath}/docsite/theme-preview-forest.png`,- category: 'building',- },- {- key: 'pkg-theme-neutral',- name: '@xds/theme-neutral',- description:- 'Muted, minimal theme with warm gray tones and Lucide icons. Ideal for productivity tools.',- version: '0.0.12',- status: 'Stable',- iconType: 'theme',- image: `${basePath}/docsite/theme-preview-daily.png`,- category: 'building',- },- {- key: 'figma',- name: 'Figma Library',- description: 'Design files, tokens, and component specs for designers.',- status: 'Stable',- iconType: 'design',- image: `${basePath}/docsite/figma-logo.png`,- category: 'designing',- href: 'https://www.figma.com/design/c9CR0F4jJQwhue60Ec7qOz/XDS-Open-Source-Library',- },-];--const RESOURCE_NAV_ITEMS: {key: string; title: string}[] = [- {key: 'res-npm', title: 'NPM Packages'},- {key: 'res-agent-docs', title: 'AI / Agent Docs'},- {key: 'res-publishing', title: 'Publishing'},-];--const GitHubIcon = (props: React.SVGProps<SVGSVGElement>) => (- <svg viewBox="0 0 24 24" fill="currentColor" {...props}>- <path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" />- </svg>-);--const VercelIcon = (props: React.SVGProps<SVGSVGElement>) => (- <svg viewBox="0 0 24 24" fill="currentColor" {...props}>- <circle cx="12" cy="12" r="12" />- <path d="M12 7l6.928 10.5H5.072L12 7z" fill="white" />- </svg>-);--const XDS_OFFERINGS: {- title: string;- subtitle: string;- pkg: string | null;- description: string;- label?: string;- href?: string;- descriptionLinkText?: string;- descriptionLinkHref?: string;- icons?: React.ComponentType<React.SVGProps<SVGSVGElement>>[];- logos?: string[];-}[] = [- {- title: 'GitHub or Vercel',- subtitle: 'Open source, use anywhere',- pkg: '@xds/core',- icons: [GitHubIcon, VercelIcon],- description:- 'Install @xds/core from npm. Works with Next.js, Vite, or any React framework. Use @xds/theme-default for the default look, or swap in any theme. Follow the quickstart in the @xds/core README to get started.',- descriptionLinkText: '@xds/core README',- descriptionLinkHref: 'https://github.com/facebookexperimental/xds',- },-];--// ----------------------------------------------------------------------------// LibraryOverview component-// -----------------------------------------------------------------------------// ----------------------------------------------------------------------------// What's New — driven by generated changelogRegistry.ts-// -----------------------------------------------------------------------------type ChangelogFilter =- | 'All'- | 'Breaking'- | 'Features'- | 'Fixes'- | 'Deprecations';--const CHANGELOG_FILTERS: ChangelogFilter[] = [- 'Breaking',- 'Features',- 'Fixes',- 'Deprecations',-];--function versionMatchesFilter(- v: ChangelogVersion,- filter: ChangelogFilter,-): boolean {- switch (filter) {- case 'All':- return true;- case 'Breaking':- return v.breakingChanges.length > 0;- case 'Features':- return v.features.length > 0;- case 'Fixes':- return v.fixes.length > 0;- case 'Deprecations':- return false;- }-}--function ItemText({item}: {item: ChangelogItem}) {- const text = item.text;- const hasExplicitBold = text.includes('**');-- if (hasExplicitBold) {- const parts = text.split(/(\*\*[^*]+\*\*)/g);- return (- <span>- {parts.map((part, i) => {- const boldMatch = part.match(/^\*\*(.+)\*\*$/);- if (boldMatch) {- return <strong key={i}>{boldMatch[1]}</strong>;- }- return <span key={i}>{part}</span>;- })}- </span>- );- }-- const delimIdx = Math.min(- text.includes(' — ') ? text.indexOf(' — ') : Infinity,- text.includes(': ') ? text.indexOf(': ') : Infinity,- );- if (delimIdx !== Infinity) {- const delim = text[delimIdx + 1] === '—' ? ' — ' : ': ';- return (- <span>- <strong>{text.slice(0, delimIdx)}</strong>- {delim}- {text.slice(delimIdx + delim.length)}- </span>- );- }-- return <span>{text}</span>;-}--function ChangelogItemRow({item}: {item: ChangelogItem}) {- return (- <XDSStack- direction="horizontal"- gap={2}- vAlign="start"- style={{padding: '5px 0', lineHeight: 1.55}}>- <XDSText type="body" style={{flex: 1, minWidth: 0}}>- <ItemText item={item} />- </XDSText>- {item.pr != null && (- <XDSLink- href={`https://github.com/${GITHUB_REPO}/pull/${item.pr}`}- target="_blank"- rel="noopener noreferrer"- size="sm"- color="secondary"- style={{- fontFamily: 'monospace',- fontSize: 11,- flexShrink: 0,- opacity: 0.5,- }}>- #{item.pr}- </XDSLink>- )}- </XDSStack>- );-}--function ChangelogSection({- label,- items,- dotVariant,-}: {- label: string;- items: ChangelogItem[];- dotVariant: 'error' | 'success' | 'warning' | 'accent';-}) {- if (items.length === 0) {- return null;- }- return (- <XDSStack direction="vertical" gap={0} style={{marginBottom: 20}}>- <XDSStack- direction="horizontal"- gap={2}- vAlign="center"- style={{marginBottom: 10}}>- <XDSStatusDot variant={dotVariant} label={label} />- <XDSText- type="supporting"- color="secondary"- weight="bold"- style={{- fontSize: 11,- textTransform: 'uppercase',- letterSpacing: '0.08em',- }}>- {label}- </XDSText>- </XDSStack>- {items.map((item, i) => (- <ChangelogItemRow key={`${item.text.slice(0, 30)}-${i}`} item={item} />- ))}- </XDSStack>- );-}--function hasContent(v: ChangelogVersion) {- return (- v.breakingChanges.length > 0 ||- v.features.length > 0 ||- v.fixes.length > 0 ||- v.codemods.length > 0 ||- v.note- );-}--function VersionCard({- version,- defaultIsOpen,- visibleSection,-}: {- version: ChangelogVersion;- defaultIsOpen: boolean;- visibleSection: 'Breaking' | 'Features' | 'Fixes' | null;-}) {- const {isOpen, toggle} = useXDSCollapsible({- isCollapsible: {defaultIsOpen: defaultIsOpen},- });- const [showUpgrade, setShowUpgrade] = useState(false);- const totalChanges =- version.breakingChanges.length +- version.features.length +- version.fixes.length;-- if (!hasContent(version)) {- return (- <XDSCard padding={4} style={{marginBottom: 8}}>- <XDSStack direction="horizontal" gap={3} vAlign="center">- <XDSText- type="body"- weight="bold"- style={{fontFamily: 'monospace', fontSize: 14}}>- v{version.version}- </XDSText>- <XDSText type="supporting" color="secondary">- {version.packages.join(', ')}- </XDSText>- {version.note && (- <XDSText- type="supporting"- color="secondary"- style={{fontStyle: 'italic'}}>- — {version.note.replace(/\*\*/g, '')}- </XDSText>- )}- </XDSStack>- </XDSCard>- );- }-- return (- <XDSCard padding={0} style={{marginBottom: 12, overflow: 'hidden'}}>- <XDSStack- direction="horizontal"- gap={3}- vAlign="start"- onClick={toggle}- onKeyDown={(e: React.KeyboardEvent) => {- if (e.key === 'Enter' || e.key === ' ') {- e.preventDefault();- toggle();- }- }}- role="button"- tabIndex={0}- aria-expanded={isOpen}- style={{padding: '16px 24px', cursor: 'pointer'}}>- <XDSStack direction="vertical" gap={0} style={{flex: 1, minWidth: 0}}>- <XDSHeading level={3} style={{fontFamily: 'monospace', fontSize: 16}}>- v{version.version}- </XDSHeading>- <XDSStack direction="horizontal" gap={2} vAlign="center">- {totalChanges > 0 && (- <XDSText- type="supporting"- color="secondary"- style={{fontSize: 12}}>- {totalChanges} change{totalChanges !== 1 ? 's' : ''}- </XDSText>- )}- {totalChanges > 0 && (- <XDSText type="supporting" color="secondary">- ·- </XDSText>- )}- <XDSText type="supporting" color="secondary" style={{fontSize: 12}}>- {version.packages.join(', ')}- </XDSText>- </XDSStack>- </XDSStack>- {version.breakingChanges.length > 0 && (- <XDSBadge label="Breaking" variant="red" />- )}- <XDSIcon- icon={ChevronDownIcon}- size="sm"- color="secondary"- style={{- flexShrink: 0,- transition: 'transform 150ms ease',- transform: isOpen ? 'rotate(180deg)' : 'rotate(0deg)',- }}- />- </XDSStack>- {isOpen && (- <>- <XDSDivider />- <XDSStack direction="vertical" gap={0} style={{padding: '20px 24px'}}>- {version.note && (- <>- <XDSText- type="supporting"- color="secondary"- display="block"- style={{fontStyle: 'italic', paddingBottom: 16}}>- {version.note.replace(/\*\*/g, '')}- </XDSText>- <XDSDivider style={{marginBottom: 16}} />- </>- )}-- {(!visibleSection || visibleSection === 'Breaking') && (- <ChangelogSection- label="Breaking Changes"- items={version.breakingChanges}- dotVariant="error"- />- )}- {(!visibleSection || visibleSection === 'Features') && (- <ChangelogSection- label="New Features"- items={version.features}- dotVariant="success"- />- )}- {(!visibleSection || visibleSection === 'Fixes') && (- <ChangelogSection- label="Fixes"- items={version.fixes}- dotVariant="warning"- />- )}-- {(!visibleSection || visibleSection === 'Breaking') &&- version.codemods.length > 0 && (- <XDSStack- direction="vertical"- gap={0}- style={{marginBottom: 20}}>- <XDSStack- direction="horizontal"- gap={2}- vAlign="center"- style={{marginBottom: 10}}>- <XDSStatusDot variant="accent" label="Codemods" />- <XDSText- type="supporting"- color="secondary"- weight="bold"- style={{- fontSize: 11,- textTransform: 'uppercase',- letterSpacing: '0.08em',- }}>- Codemods- </XDSText>- </XDSStack>- <XDSStack- direction="horizontal"- gap={1}- style={{flexWrap: 'wrap'}}>- {version.codemods.map((item, i) => (- <XDSBadge- key={i}- label={- item.codemod ||- item.text.replace(/^`([\w-]+)`.*/, '$1')- }- variant="neutral"- />- ))}- </XDSStack>- </XDSStack>- )}-- {(!visibleSection || visibleSection === 'Breaking') &&- (version.upgradeCommand || version.dryRunCommand) && (- <>- {!showUpgrade ? (- <XDSButton- label="Show upgrade commands"- variant="ghost"- size="sm"- onClick={() => setShowUpgrade(true)}- />- ) : (- <XDSCard padding={0}>- <XDSCodeBlock- language="bash"- code={[- version.upgradeCommand,- version.dryRunCommand- ? `# Dry run: ${version.dryRunCommand}`- : null,- ]- .filter(Boolean)- .join('\n')}- hasCopyButton- />- </XDSCard>- )}- </>- )}- </XDSStack>- </>- )}- </XDSCard>- );-}--function DeprecationsPanel() {- const grouped = useMemo(() => {- const map = new Map<string, typeof deprecations>();- for (const d of deprecations) {- const key = d.file;- let items = map.get(key);- if (items == null) {- items = [];- map.set(key, items);- }- items.push(d);- }- return Array.from(map.entries());- }, []);-- return (- <XDSStack direction="vertical" gap={2}>- <XDSText- type="body"- color="secondary"- display="block"- style={{marginBottom: 8}}>- These symbols are deprecated in the current codebase. Migrate away from- them before they are removed in a future release.- </XDSText>-- {grouped.map(([file, items]) => (- <XDSCard key={file} padding={0}>- <XDSStack- direction="horizontal"- gap={2}- vAlign="center"- style={{- padding: '10px 16px',- background: 'var(--color-background-secondary, #f9fafb)',- }}>- <XDSText type="code" style={{fontSize: 12}}>- {file}- </XDSText>- </XDSStack>- <XDSDivider />- <XDSStack direction="vertical" gap={0} style={{padding: '4px 16px'}}>- {items.map((d, i) => (- <React.Fragment key={i}>- <XDSStack- direction="horizontal"- gap={3}- vAlign="start"- style={{padding: '8px 0'}}>- <XDSText- type="code"- style={{- fontSize: 13,- fontWeight: 600,- flexShrink: 0,- minWidth: 140,- color: 'var(--color-error, #e3193b)',- }}>- {d.symbol}- </XDSText>- <XDSText type="body" color="secondary" style={{fontSize: 13}}>- {d.message}- </XDSText>- </XDSStack>- {i < items.length - 1 && <XDSDivider />}- </React.Fragment>- ))}- </XDSStack>- </XDSCard>- ))}- </XDSStack>- );-}--function WhatsNewPage() {- const [activeFilter, setActiveFilter] = useState<ChangelogFilter>('All');-- const showDeprecations = activeFilter === 'Deprecations';-- const filteredVersions = useMemo(- () =>- activeFilter === 'All' || activeFilter === 'Deprecations'- ? changelogVersions- : changelogVersions.filter(v => versionMatchesFilter(v, activeFilter)),- [activeFilter],- );-- return (- <XDSSection- maxWidth={800}- padding={8}- variant="transparent"- style={{marginInline: 'auto'}}>- {/* Header */}- <XDSStack direction="vertical" gap={2} style={{marginBottom: 32}}>- <XDSText type="display-1" display="block">- What's New- </XDSText>- <XDSText- type="body"- color="secondary"- display="block"- style={{maxWidth: 520}}>- Release history across all XDS packages — features, breaking changes,- fixes, and codemods.- </XDSText>- </XDSStack>-- {/* Filter tabs */}- <XDSStack- direction="vertical"- gap={0}- style={{- position: 'sticky',- top: 0,- zIndex: 10,- backgroundColor: 'var(--color-background-surface)',- marginBottom: 24,- paddingTop: 8,- paddingBottom: 1,- }}>- <XDSTabList- value={activeFilter}- onChange={v => setActiveFilter(v as ChangelogFilter)}- size="sm">- <XDSTab value="All" label="All" />- {CHANGELOG_FILTERS.map(filter => (- <XDSTab key={filter} value={filter} label={filter} />- ))}- </XDSTabList>- <XDSDivider />- </XDSStack>-- {showDeprecations ? (- <DeprecationsPanel />- ) : (- filteredVersions.map((version, i) => (- <VersionCard- key={version.version}- version={version}- defaultIsOpen={i === 0 || activeFilter !== 'All'}- visibleSection={activeFilter === 'All' ? null : activeFilter}- />- ))- )}- </XDSSection>- );-}--// ----------------------------------------------------------------------------// FoundationPage component (placeholder for non-typography foundations)-// -----------------------------------------------------------------------------function FoundationPage({foundationKey}: {foundationKey: string}) {- if (foundationKey === 'typography') {- return <TypographyFoundationPage />;- }- if (foundationKey === 'colors') {- return <ColorsFoundationPage />;- }- if (foundationKey === 'spacing') {- return <SpacingFoundationPage />;- }- if (foundationKey === 'icons') {- return <IconsFoundationPage />;- }- if (foundationKey === 'shape') {- return <ShapeFoundationPage />;- }- if (foundationKey === 'illustrations') {- return <IllustrationsFoundationPage />;- }- return null;-}--// ----------------------------------------------------------------------------// ColorsFoundationPage-// -----------------------------------------------------------------------------type ColorRow = Record<string, unknown>;--const SEMANTIC_PALETTE: ColorRow[] = [- {token: 'accent', light: '#0064E0', dark: '#2694FE'},- {token: 'success', light: '#0D8626', dark: '#0D8626'},- {token: 'warning', light: '#E9AF08', dark: '#F2C00B'},- {token: 'error', light: '#E3193B', dark: '#F5394F'},-];--const TEXT_COLORS: ColorRow[] = [- {token: 'primary', light: '#0A1317', dark: '#DFE2E5'},- {token: 'secondary', light: '#4E606F', dark: '#AAAFB5'},- {token: 'disabled', light: '#A4B0BC', dark: '#6F747C'},- {token: 'accent', light: '#0064E0', dark: '#3E9EFB'},-];--const SURFACE_COLORS: ColorRow[] = [- {token: 'surface', light: '#FFFFFF', dark: '#1F1F22'},- {token: 'body', light: '#F1F4F7', dark: '#111112'},- {token: 'card', light: '#FFFFFF', dark: '#1F1F22'},- {token: 'popover', light: '#FFFFFF', dark: '#28292C'},- {token: 'muted', light: 'rgba(0,0,0,0.04)', dark: 'rgba(255,255,255,0.06)'},-];--const BORDER_COLORS: ColorRow[] = [- {token: 'border', light: 'rgba(0,0,0,0.08)', dark: 'rgba(255,255,255,0.1)'},- {- token: 'border-emphasized',- light: 'rgba(0,0,0,0.16)',- dark: 'rgba(255,255,255,0.2)',- },-];--function ColorSwatch({value}: {value: string}) {- return (- <div style={{display: 'flex', alignItems: 'center', gap: 8}}>- <div- style={{- width: 20,- height: 20,- borderRadius: 4,- backgroundColor: value,- border: '1px solid rgba(0,0,0,0.1)',- flexShrink: 0,- }}- />- <XDSText type="code">{value}</XDSText>- </div>- );-}--function colorColumns() {- return [- {- key: 'token',- header: 'Token',- width: pixel(180),- renderCell: (row: ColorRow) => (- <XDSText type="code">{row.token as string}</XDSText>- ),- },- {- key: 'light',- header: 'Light',- renderCell: (row: ColorRow) => (- <ColorSwatch value={row.light as string} />- ),- },- {- key: 'dark',- header: 'Dark',- renderCell: (row: ColorRow) => <ColorSwatch value={row.dark as string} />,- },- ];-}--function ColorsFoundationPage() {- return (- <XDSSection- maxWidth={960}- padding={8}- variant="transparent"- style={{marginInline: 'auto'}}>- <XDSStack direction="vertical" gap={10}>- {/* Header */}- <XDSStack direction="vertical" gap={2}>- <XDSText type="display-1">Colors</XDSText>- <XDSText type="large" weight="normal" color="secondary">- XDS uses semantic color tokens instead of raw hex values. Tokens- adapt automatically across light, dark, and custom themes so your UI- stays consistent without manual overrides.- </XDSText>- </XDSStack>-- {/* Semantic palette */}- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>Semantic palette</XDSHeading>- <XDSText type="body" color="secondary">- Four intent-based colors that carry meaning across your entire UI.- Use accent for interactive elements, success/warning/error for- feedback states.- </XDSText>- <XDSCard padding={0}>- <XDSTable- data={SEMANTIC_PALETTE}- columns={colorColumns()}- density="spacious"- dividers="rows"- />- </XDSCard>- </XDSStack>-- {/* Text colors */}- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>Text colors</XDSHeading>- <XDSText type="body" color="secondary">- Text tokens control foreground color for headings, body copy, and- labels. They maintain accessible contrast ratios in every theme.- </XDSText>- <XDSCard padding={0}>- <XDSTable- data={TEXT_COLORS}- columns={colorColumns()}- density="spacious"- dividers="rows"- />- </XDSCard>- </XDSStack>-- {/* Surface colors */}- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>Surface colors</XDSHeading>- <XDSText type="body" color="secondary">- Surfaces define backgrounds for pages, cards, popovers, and muted- regions. Layering surfaces creates visual depth without shadows.- </XDSText>- <XDSCard padding={0}>- <XDSTable- data={SURFACE_COLORS}- columns={colorColumns()}- density="spacious"- dividers="rows"- />- </XDSCard>- </XDSStack>-- {/* Border */}- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>Border</XDSHeading>- <XDSText type="body" color="secondary">- Border tokens use alpha transparency so they blend naturally over- any surface. Use border-emphasized when you need stronger visual- separation.- </XDSText>- <XDSCard padding={0}>- <XDSTable- data={BORDER_COLORS}- columns={colorColumns()}- density="spacious"- dividers="rows"- />- </XDSCard>- </XDSStack>-- {/* Usage */}- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>Usage</XDSHeading>- <XDSGrid columns={2} gap={4}>- <XDSCard padding={4}>- <XDSStack direction="vertical" gap={2}>- <XDSBadge label="Do" variant="success" />- <XDSList>- <XDSListItem- label="Use semantic tokens (accent, surface, primary) instead of- hard-coded hex values"- />- <XDSListItem- label="Pair text tokens with surface tokens to guarantee accessible- contrast"- />- <XDSListItem- label="Use the muted surface for secondary content areas and- disabled backgrounds"- />- <XDSListItem- label="Let tokens handle light/dark adaptation — avoid manual- dark-mode overrides"- />- </XDSList>- </XDSStack>- </XDSCard>- <XDSCard padding={4}>- <XDSStack direction="vertical" gap={2}>- <XDSBadge label="Don't" variant="error" />- <XDSList>- <XDSListItem- label="Hard-code hex or rgba values in component styles — they- break when themes change"- />- <XDSListItem- label="Use opacity to lighten text — use the secondary or disabled- text token instead"- />- <XDSListItem- label="Repurpose semantic colors for decoration (e.g. error-red as- a brand color)"- />- <XDSListItem- label="Mix raw CSS custom properties with token imports — use- colorVars consistently"- />- </XDSList>- </XDSStack>- </XDSCard>- </XDSGrid>- </XDSStack>-- {/* Code */}- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>Code</XDSHeading>- <XDSText type="body" color="secondary">- Import colorVars from the token module and reference tokens inside- StyleX styles. Token names map directly to CSS custom properties- scoped by the active theme.- </XDSText>- <XDSCodeBlock- language="tsx"- code={`import * as stylex from '@stylexjs/stylex';-import { colorVars } from '@xds/core/tokens';--const styles = stylex.create({- container: {- backgroundColor: colorVars.backgroundSurface,- color: colorVars.textPrimary,- borderColor: colorVars.border,- },- accent: {- color: colorVars.accent,- },- error: {- color: colorVars.error,- },-});`}- />- </XDSStack>- </XDSStack>- </XDSSection>- );-}--// ----------------------------------------------------------------------------// TypographyFoundationPage-// -----------------------------------------------------------------------------const TYPO_RATIO_OPTIONS = [- {value: 1.067, label: '1.067 — Minor Second'},- {value: 1.125, label: '1.125 — Major Second'},- {value: 1.2, label: '1.200 — Minor Third'},- {value: 1.25, label: '1.250 — Major Third'},- {value: 1.333, label: '1.333 — Perfect Fourth'},- {value: 1.414, label: '1.414 — Augmented Fourth'},- {value: 1.5, label: '1.500 — Perfect Fifth'},- {value: 1.618, label: '1.618 — Golden Ratio'},-];--const TYPO_THEME_OPTIONS: {- key: string;- label: string;- theme: XDSDefinedTheme;- desc: string;- fonts: {body: string; heading: string; code: string};-}[] = [- {- key: 'default',- label: 'Default',- theme: defaultTheme,- desc: 'System fonts · base 14px · ratio 1.2',- fonts: {body: 'System', heading: 'System', code: 'SF Mono'},- },- {- key: 'neutral',- label: 'Neutral',- theme: neutralTheme,- desc: 'Geist · base 14px · ratio 1.2 · bold h3/h4',- fonts: {body: 'Geist', heading: 'Geist', code: 'Geist Mono'},- },- {- key: 'brutalist',- label: 'Brutalist',- theme: brutalistTheme,- desc: 'Courier New · monospace everywhere',- fonts: {body: 'Courier New', heading: 'Courier New', code: 'Courier New'},- },- {- key: 'matcha',- label: 'Matcha',- theme: matchaTheme,- desc: 'Figtree · earthy greens · serif headings',- fonts: {body: 'Figtree', heading: 'Figtree', code: 'SF Mono'},- },- {- key: 'daily',- label: 'Daily',- theme: dailyTheme,- desc: 'Figtree · warm neutrals · Lucide icons',- fonts: {body: 'Figtree', heading: 'Figtree', code: 'SF Mono'},- },-];--const TYPO_SCALE_STEPS: {label: string; step: number}[] = [- {label: 'Display 1', step: 6},- {label: 'Display 2', step: 5},- {label: 'Display 3', step: 4},- {label: 'Heading 1', step: 3},- {label: 'Heading 2', step: 2},- {label: 'Heading 3', step: 1},- {label: 'H4 / Body', step: 0},- {label: 'Supporting', step: -1},- {label: 'Heading 6', step: -2},-];--const TYPE_SCALE_ROWS: {- label: string;- step: number;- weight: string;- family: string;- render: (text: string) => React.ReactNode;-}[] = [- {- label: 'Display 1',- step: 6,- weight: 'Normal',- family: 'Heading',- render: t => <XDSText type="display-1">{t}</XDSText>,- },- {- label: 'Display 2',- step: 5,- weight: 'Normal',- family: 'Heading',- render: t => <XDSText type="display-2">{t}</XDSText>,- },- {- label: 'Display 3',- step: 4,- weight: 'Normal',- family: 'Heading',- render: t => <XDSText type="display-3">{t}</XDSText>,- },- {- label: 'Heading 1',- step: 3,- weight: 'Semibold',- family: 'Heading',- render: t => <XDSHeading level={1}>{t}</XDSHeading>,- },- {- label: 'Heading 2',- step: 2,- weight: 'Semibold',- family: 'Heading',- render: t => <XDSHeading level={2}>{t}</XDSHeading>,- },- {- label: 'Heading 3',- step: 1,- weight: 'Semibold',- family: 'Heading',- render: t => <XDSHeading level={3}>{t}</XDSHeading>,- },- {- label: 'Heading 4',- step: 0,- weight: 'Semibold',- family: 'Heading',- render: t => <XDSHeading level={4}>{t}</XDSHeading>,- },- {- label: 'Body',- step: 0,- weight: 'Normal',- family: 'Body',- render: t => <XDSText type="body">{t}</XDSText>,- },- {- label: 'Label',- step: 0,- weight: 'Medium',- family: 'Body',- render: t => <XDSText type="label">{t}</XDSText>,- },- {- label: 'Supporting',- step: -1,- weight: 'Normal',- family: 'Body',- render: t => <XDSText type="supporting">{t}</XDSText>,- },- {- label: 'Code',- step: 0,- weight: 'Normal',- family: 'Code',- render: t => <XDSText type="code">{t}</XDSText>,- },-];--function TypographyFoundationPage() {- const [previewTheme, setPreviewTheme] = useState('default');- const [scaleTheme, setScaleTheme] = useState('default');- const [scaleBase, setScaleBase] = useState(14);- const [scaleRatio, setScaleRatio] = useState(1.2);- const [refTab, setRefTab] = useState<'usage' | 'api'>('usage');-- const activeThemeOption =- TYPO_THEME_OPTIONS.find(t => t.key === previewTheme) ??- TYPO_THEME_OPTIONS[0];-- const scaleSizes = useMemo(- () =>- TYPO_SCALE_STEPS.map(s => ({- ...s,- px: Math.round(scaleBase * Math.pow(scaleRatio, s.step)),- })),- [scaleBase, scaleRatio],- );- const scalePreviewTheme = useMemo(- () =>- defineTheme({- name: 'scale-preview',- typography: {scale: {base: scaleBase, ratio: scaleRatio}},- tokens: {},- icons: defaultIconRegistry,- }),- [scaleBase, scaleRatio],- );- const maxPx = scaleSizes[0]?.px ?? 42;-- return (- <XDSSection- maxWidth={960}- padding={8}- variant="transparent"- style={{marginInline: 'auto'}}>- <XDSStack direction="vertical" gap={8}>- {/* Header */}- <XDSStack direction="vertical" gap={2}>- <XDSText type="display-1">Typography</XDSText>- <XDSText type="large" weight="normal" color="secondary">- Typography establishes hierarchy, readability, and accessibility- across your UI. XDS handles it with two components and a- token-driven type scale.- </XDSText>- </XDSStack>-- <XDSStack direction="vertical" gap={0}>- <XDSTabList- value={refTab}- onChange={v => setRefTab(v as 'usage' | 'api')}- size="sm">- <XDSTab value="usage" label="Usage" />- <XDSTab value="api" label="API" />- </XDSTabList>- <XDSDivider />- </XDSStack>-- {refTab === 'usage' && (- <>- {/* Type scale preview */}- {(() => {- const scaleThemeOption =- TYPO_THEME_OPTIONS.find(t => t.key === scaleTheme) ??- TYPO_THEME_OPTIONS[0];- return (- <XDSCard variant="muted" padding={0}>- <XDSSection padding={3} variant="transparent">- <div- style={{- display: 'flex',- alignItems: 'center',- justifyContent: 'space-between',- }}>- <XDSText type="label" color="secondary">- Scale- </XDSText>- <XDSStack direction="horizontal" gap={1} vAlign="center">- {TYPO_THEME_OPTIONS.map(opt => (- <XDSButton- key={opt.key}- label={opt.label}- variant={- scaleTheme === opt.key ? 'primary' : 'ghost'- }- size="sm"- onClick={() => setScaleTheme(opt.key)}- />- ))}- </XDSStack>- </div>- </XDSSection>- <XDSTheme theme={scaleThemeOption.theme}>- <div style={{padding: '8px 24px 24px'}}>- <XDSStack direction="vertical" gap={0}>- {TYPE_SCALE_ROWS.map(row => {- const px = Math.round(- scaleBase * Math.pow(scaleRatio, row.step),- );- const fontName =- row.family === 'Code'- ? scaleThemeOption.fonts.code- : row.family === 'Heading'- ? scaleThemeOption.fonts.heading- : scaleThemeOption.fonts.body;- return (- <div- key={row.label}- style={{- display: 'flex',- alignItems: 'baseline',- gap: 16,- paddingBlock: 12,- borderBottom:- '1px solid var(--color-border, rgba(0,0,0,0.06))',- }}>- <div style={{flex: 1, minWidth: 0}}>- {row.render(row.label)}- </div>- <XDSText- type="supporting"- color="secondary"- style={{width: 80, flexShrink: 0}}>- {fontName}- </XDSText>- <XDSText- type="supporting"- color="secondary"- style={{width: 70, flexShrink: 0}}>- {row.weight}- </XDSText>- <XDSText- type="supporting"- color="secondary"- style={{- width: 40,- flexShrink: 0,- textAlign: 'right',- }}>- {px}px- </XDSText>- </div>- );- })}- </XDSStack>- </div>- </XDSTheme>- </XDSCard>- );- })()}-- {/* Pick the right type */}- <XDSStack direction="vertical" gap={4}>- <XDSHeading level={2}>Pick the right type</XDSHeading>- <XDSText type="body" color="secondary">- Every piece of text uses one of two components. Pick based on- semantic purpose, not visual size.- </XDSText>-- <XDSTable- data={- [- {- component: 'XDSHeading',- when: 'Section titles that define document structure (renders h1–h6)',- },- {- component: 'XDSText type="display-*"',- when: 'Large decorative text without heading semantics (hero headlines, splash screens)',- },- {- component: 'XDSText type="large"',- when: 'Introductory or emphasized body text (section intros, feature lead-ins)',- },- {- component: 'XDSText type="body"',- when: 'General content, paragraphs, and descriptions',- },- {- component: 'XDSText type="label"',- when: 'Form labels, column headers, and category names',- },- {- component: 'XDSText type="supporting"',- when: 'Secondary metadata, captions, and helper text',- },- {- component: 'XDSText type="code"',- when: 'Inline code, variable names, and token references',- },- ] as Record<string, unknown>[]- }- columns={[- {- key: 'component',- header: 'Component',- width: pixel(250),- renderCell: (row: Record<string, unknown>) => (- <XDSText type="code" textWrap="wrap">- {row.component as string}- </XDSText>- ),- },- {- key: 'when',- header: 'When to use',- renderCell: (row: Record<string, unknown>) => (- <XDSText type="body" textWrap="wrap">- {row.when as string}- </XDSText>- ),- },- ]}- density="spacious"- dividers="rows"- />-- <XDSHeading level={3}>Best practices</XDSHeading>- <XDSTable- data={- [- {- type: 'do',- text: 'Use XDSHeading with sequential levels to create a real document outline that screen readers can navigate',- },- {- type: 'do',- text: 'Use XDSText type="display-*" or type="large" for visually large text that is not a section title',- },- {- type: 'do',- text: 'Use color="secondary" on supporting text instead of reducing opacity — tokens adapt to light/dark mode',- },- {- type: 'do',- text: 'Use maxLines for truncation — the component handles ellipsis and line clamping',- },- {- type: 'dont',- text: "Don't use XDSText for section titles — screen readers only build a navigable outline from heading elements (h1–h6). XDSText renders a span, which is invisible to assistive technology",- },- {- type: 'dont',- text: "Don't use XDSHeading just for visual size — it creates false document structure that confuses screen reader navigation",- },- {- type: 'dont',- text: "Don't skip heading levels (e.g. h1 → h3) — screen readers expose headings as a navigable tree",- },- {- type: 'dont',- text: "Don't set font-size or font-family in inline styles — always use component props or design tokens",- },- ] as Record<string, unknown>[]- }- columns={[- {- key: 'type',- header: 'Guidance',- width: pixel(100),- renderCell: (item: Record<string, unknown>) => (- <XDSBadge- label={item.type === 'do' ? 'Do' : 'Dont'}- variant={item.type === 'do' ? 'success' : 'error'}- />- ),- },- {- key: 'text',- header: '',- renderCell: (item: Record<string, unknown>) => (- <XDSText type="body" textWrap="wrap">- {item.text as string}- </XDSText>- ),- },- ]}- density="spacious"- dividers="rows"- />- </XDSStack>-- {/* ================================================================- SECTION 2 — Preview (theme toggle + scale explorer merged)- ================================================================ */}- <XDSStack direction="vertical" gap={4}>- <XDSHeading level={2}>Preview</XDSHeading>- <XDSText type="body" color="secondary">- Toggle between themes and adjust the type scale to see how- typography adapts across the system.- </XDSText>-- {/* Side-by-side: controls panel + live specimen */}- <div style={{display: 'flex', gap: 16, alignItems: 'stretch'}}>- {/* Left panel — controls + scale chart */}- <div- style={{- width: 300,- flexShrink: 0,- display: 'flex',- flexDirection: 'column',- gap: 12,- }}>- {/* Theme */}- <XDSCard padding={3}>- <XDSText- type="label"- color="secondary"- display="block"- style={{marginBottom: 8}}>- Theme- </XDSText>- <XDSStack- direction="horizontal"- gap={1}- vAlign="center"- style={{flexWrap: 'wrap'}}>- {TYPO_THEME_OPTIONS.map(opt => (- <XDSButton- key={opt.key}- label={opt.label}- variant={- previewTheme === opt.key ? 'primary' : 'secondary'- }- size="sm"- onClick={() => setPreviewTheme(opt.key)}- />- ))}- </XDSStack>- <XDSText- type="supporting"- color="secondary"- style={{marginTop: 6}}>- {activeThemeOption.desc}- </XDSText>- </XDSCard>-- {/* Scale controls + bar chart */}- <XDSCard padding={3} style={{flex: 1}}>- <XDSStack direction="vertical" gap={3}>- <div>- <XDSText- type="label"- color="secondary"- display="block"- style={{marginBottom: 6}}>- Base size- </XDSText>- <XDSStack- direction="horizontal"- gap={1}- vAlign="center">- {(- [- {label: 'S', value: 12},- {label: 'M', value: 14},- {label: 'L', value: 16},- {label: 'XL', value: 18},- ] as const- ).map(p => (- <XDSButton- key={p.value}- label={p.label}- variant={- scaleBase === p.value ? 'primary' : 'ghost'- }- size="sm"- onClick={() => setScaleBase(p.value)}- />- ))}- <div style={{flex: 1}} />- <XDSNumberInput- label="Base size"- isLabelHidden- value={scaleBase}- onChange={(v: number) => setScaleBase(v)}- min={10}- max={24}- step={1}- units="px"- size="sm"- />- </XDSStack>- </div>- <div>- <XDSText- type="label"- color="secondary"- display="block"- style={{marginBottom: 6}}>- Scale ratio- </XDSText>- <XDSSelector- label="Scale ratio"- isLabelHidden- options={[- ...TYPO_RATIO_OPTIONS.map(opt => ({- value: String(opt.value),- label: opt.label,- })),- {- value: 'custom',- label: !TYPO_RATIO_OPTIONS.some(- o => Math.abs(o.value - scaleRatio) < 0.001,- )- ? `Custom — ${scaleRatio.toFixed(3)}`- : 'Custom...',- },- ]}- value={- !TYPO_RATIO_OPTIONS.some(- o => Math.abs(o.value - scaleRatio) < 0.001,- )- ? 'custom'- : String(scaleRatio)- }- onChange={(v: string) => {- if (v !== 'custom') {- setScaleRatio(Number(v));- }- }}- />- </div>- <XDSDivider />- <XDSStack direction="vertical" gap={1}>- {scaleSizes.map(s => (- <div- key={s.label}- style={{- display: 'flex',- alignItems: 'center',- gap: 8,- }}>- <div style={{width: 72, flexShrink: 0}}>- <XDSText type="supporting" color="secondary">- {s.label}- </XDSText>- </div>- <div- style={{- width: 32,- flexShrink: 0,- textAlign: 'right',- }}>- <XDSText type="supporting" color="secondary">- {s.px}- </XDSText>- </div>- <div style={{flex: 1, minWidth: 0}}>- <div- style={{- height: Math.max(s.px * 0.45, 3),- width: `${(s.px / maxPx) * 100}%`,- borderRadius: 2,- backgroundColor:- s.step === 0- ? 'var(--color-accent)'- : 'var(--color-accent-muted, rgba(0,100,224,0.25))',- transition:- 'width 300ms ease, height 300ms ease',- }}- />- </div>- </div>- ))}- </XDSStack>- </XDSStack>- </XDSCard>- </div>-- {/* Right — live themed specimen */}- <div style={{flex: 1, minWidth: 0}}>- <XDSTheme theme={activeThemeOption.theme}>- <XDSTheme theme={scalePreviewTheme}>- <div- style={{- padding: 32,- borderRadius: 12,- backgroundColor: 'var(--color-background-surface)',- color: 'var(--color-text-primary)',- border: '1px solid var(--color-border)',- height: '100%',- boxSizing: 'border-box',- }}>- <XDSStack direction="vertical" gap={5}>- {/* display */}- <XDSStack direction="vertical" gap={1}>- <XDSText type="display-1">Welcome back</XDSText>- <XDSText type="large">- Here's what's happening with your- projects today.- </XDSText>- </XDSStack>- <XDSDivider />- {/* h1 + body */}- <XDSStack direction="vertical" gap={2}>- <XDSHeading level={1}>Project settings</XDSHeading>- <XDSText type="body">- Manage who has access to this project and what- permissions they have. Changes take effect- immediately.- </XDSText>- </XDSStack>- {/* h2 + label + supporting */}- <XDSStack direction="vertical" gap={2}>- <XDSHeading level={2}>Team members</XDSHeading>- <XDSStack direction="vertical" gap={1}>- <XDSText type="label">Email address</XDSText>- <XDSText type="supporting" color="secondary">- We'll send an invite to this address.- </XDSText>- </XDSStack>- </XDSStack>- {/* h3 + h4 */}- <XDSStack direction="vertical" gap={2}>- <XDSHeading level={3}>Notifications</XDSHeading>- <XDSHeading level={4}>Email preferences</XDSHeading>- <XDSText type="body" color="secondary">- Choose which updates you'd like to receive.- </XDSText>- </XDSStack>- <XDSDivider />- {/* h5 + h6 + code + supporting */}- <XDSStack direction="vertical" gap={2}>- <XDSHeading level={5}>Advanced</XDSHeading>- <XDSHeading level={6}>API Configuration</XDSHeading>- <XDSText type="code">- const config = { theme: 'default'- };- </XDSText>- <XDSText type="supporting" color="secondary">- Last updated 2 hours ago · 3 members online- </XDSText>- </XDSStack>- </XDSStack>- </div>- </XDSTheme>- </XDSTheme>- </div>- </div>- </XDSStack>-- {/* Why typography matters — context at the bottom */}- <XDSStack direction="vertical" gap={4}>- <XDSHeading level={2}>Why typography matters</XDSHeading>- <XDSText type="body" color="secondary">- In most interfaces, text makes up over 80% of the content users- interact with. Typography is not decoration — it is the- interface. When type is inconsistent, users slow down, miss- actions, and lose trust in the product.- </XDSText>- <XDSList density="spacious" listStyle="disc">- <XDSListItem- label={- <>- <XDSHeading level={4}>- Users scan before they read.- </XDSHeading>{' '}- <XDSText type="body" textWrap="wrap">- Size and weight differences create a visual hierarchy- that tells people where to look first, what's- actionable, and what's secondary — without reading- a single word.- </XDSText>- </>- }- />- <XDSListItem- label={- <>- <XDSHeading level={4}>- Inconsistent sizing breaks rhythm.- </XDSHeading>{' '}- <XDSText type="body" textWrap="wrap">- When one screen uses 13px body text and another uses- 15px, the interface feels stitched together. A shared- type scale eliminates this drift across teams.- </XDSText>- </>- }- />- <XDSListItem- label={- <>- <XDSHeading level={4}>- Screen readers depend on heading elements.- </XDSHeading>{' '}- <XDSText type="body" textWrap="wrap">- If a section title uses XDSText instead of XDSHeading,- assistive technology can't build a page outline.- Users who navigate by headings will miss entire- sections.- </XDSText>- </>- }- />- <XDSListItem- label={- <>- <XDSHeading level={4}>- Font loading affects perceived performance.- </XDSHeading>{' '}- <XDSText type="body" textWrap="wrap">- System fonts render instantly; custom fonts can cause- layout shift. XDS font declarations include fallback- stacks so text is always readable while fonts load.- </XDSText>- </>- }- />- <XDSListItem- label={- <>- <XDSHeading level={4}>- Line height and measure affect comprehension.- </XDSHeading>{' '}- <XDSText type="body" textWrap="wrap">- Lines that are too tight or too wide make readers lose- their place. The XDS type scale snaps line heights to a- 4px grid and targets proven ratios by size tier.- </XDSText>- </>- }- />- </XDSList>- <XDSText type="body" color="secondary">- A design system centralizes these decisions so individual- features don't reinvent them. Every text element in XDS- inherits from the same token-driven scale, which means switching- themes updates every heading, label, and caption system-wide —- no manual migration required.- </XDSText>- </XDSStack>- </>- )}-- {refTab === 'api' && (- <XDSStack direction="vertical" gap={8}>- {/* How it works */}- <XDSStack direction="vertical" gap={4}>- <XDSHeading level={2}>How it works</XDSHeading>- <XDSText type="body" color="secondary">- Typography is built on three layers: raw size tokens (geometric- scale in rem), semantic tokens (size + weight + line height- bundles), and components that consume them. Themes can override- any layer.- </XDSText>- <XDSCard padding={0}>- <XDSCodeBlock- title="Layers 1-2: Design tokens (CSS)"- code={`/* Layer 1: Raw size token — set by theme scale */---font-size-2xl: 1.5rem; /* 24px */--/* Layer 2: Semantic token — references Layer 1 */---text-heading-1-size: var(--font-size-2xl);---text-heading-1-weight: var(--font-weight-semibold);---text-heading-1-leading: 1.3333; /* 24px → 32px (4px grid) */`}- language="css"- hasCopyButton- />- </XDSCard>- <XDSCard padding={0}>- <XDSCodeBlock- title="Layer 3: Component (TSX)"- code={`// Component consumes the semantic tokens automatically-<XDSHeading level={1}>Page title</XDSHeading>`}- language="tsx"- hasCopyButton- />- </XDSCard>- </XDSStack>-- {/* Code */}- <XDSStack direction="vertical" gap={4}>- <XDSHeading level={2}>Code</XDSHeading>- <XDSCard padding={0}>- <XDSCodeBlock- title="Basic usage"- code={`import { XDSHeading, XDSText } from '@xds/core/Text';--// Section structure — use XDSHeading-<XDSHeading level={1}>Page title</XDSHeading>-<XDSHeading level={2}>Section title</XDSHeading>--// Content — use XDSText with a type-<XDSText type="display-1">Hero headline</XDSText>-<XDSText type="body">Paragraph content.</XDSText>-<XDSText type="body" weight="bold">Emphasized.</XDSText>-<XDSText type="label">Form label</XDSText>-<XDSText type="supporting" color="secondary">Helper text</XDSText>-<XDSText type="code">variableName</XDSText>--// Truncation-<XDSText type="body" maxLines={2}>Long content...</XDSText>-<XDSHeading level={2} textWrap="balance">Balanced heading</XDSHeading>`}- language="tsx"- hasCopyButton- />- </XDSCard>- <XDSCard padding={0}>- <XDSCodeBlock- title="Theming typography"- code={`import { defineTheme } from '@xds/core/theme';--export const myTheme = defineTheme({- name: 'my-theme',- typography: {- scale: { base: 16, ratio: 1.25 }, // Dense: 12/1.125, Default: 14/1.2, Airy: 16/1.25- body: { family: 'Geist', fallbacks: '-apple-system, sans-serif' },- heading: { weight: 'semibold', weights: { 3: 'bold', 4: 'bold' } },- code: { family: 'Geist Mono', fallbacks: '"SF Mono", monospace' },- },-});`}- language="tsx"- hasCopyButton- />- </XDSCard>- </XDSStack>-- {/* Props */}- <XDSStack direction="vertical" gap={4}>- <XDSHeading level={2}>Props</XDSHeading>- <XDSHeading level={3}>XDSHeading</XDSHeading>- <XDSTable- data={- [- {- prop: 'level',- type: '1 | 2 | 3 | 4 | 5 | 6',- req: 'Yes',- desc: 'HTML heading tag and visual size.',- },- {- prop: 'weight',- type: "'normal' | 'medium' | 'semibold' | 'bold'",- req: 'No',- desc: 'Override default weight (semibold).',- },- {- prop: 'color',- type: "'primary' | 'secondary' | 'disabled' | 'active' | 'inherit'",- req: 'No',- desc: 'Semantic text color.',- },- {- prop: 'maxLines',- type: 'number',- req: 'No',- desc: 'Truncate with ellipsis after N lines.',- },- {- prop: 'textWrap',- type: "'wrap' | 'nowrap' | 'balance' | 'pretty'",- req: 'No',- desc: 'CSS text-wrap value.',- },- ] as Record<string, unknown>[]- }- columns={[- {- key: 'prop',- header: 'Prop',- width: pixel(100),- renderCell: (r: Record<string, unknown>) => (- <XDSText type="code">{r.prop as string}</XDSText>- ),- },- {- key: 'type',- header: 'Type',- width: pixel(220),- renderCell: (r: Record<string, unknown>) => (- <XDSText type="code" maxLines={2}>- {r.type as string}- </XDSText>- ),- },- {key: 'req', header: 'Req', width: pixel(50)},- {- key: 'desc',- header: 'Description',- renderCell: (r: Record<string, unknown>) => (- <XDSText type="body" textWrap="wrap">- {r.desc as string}- </XDSText>- ),- },- ]}- density="spacious"- dividers="rows"- />- <XDSHeading level={3}>XDSText</XDSHeading>- <XDSTable- data={- [- {- prop: 'type',- type: "'body' | 'large' | 'label' | 'supporting' | 'code' | 'display-1' | 'display-2' | 'display-3'",- req: 'Yes',- desc: 'Semantic text role. Controls size, weight, font family.',- },- {- prop: 'weight',- type: "'normal' | 'medium' | 'semibold' | 'bold'",- req: 'No',- desc: 'Override default weight for the type.',- },- {- prop: 'color',- type: "'primary' | 'secondary' | 'disabled' | 'active' | 'inherit'",- req: 'No',- desc: 'Semantic text color.',- },- {- prop: 'display',- type: "'inline' | 'block'",- req: 'No',- desc: 'CSS display. Default inline.',- },- {- prop: 'maxLines',- type: 'number',- req: 'No',- desc: 'Truncate with ellipsis after N lines.',- },- {- prop: 'textWrap',- type: "'wrap' | 'nowrap' | 'balance' | 'pretty'",- req: 'No',- desc: 'CSS text-wrap value.',- },- ] as Record<string, unknown>[]- }- columns={[- {- key: 'prop',- header: 'Prop',- width: pixel(100),- renderCell: (r: Record<string, unknown>) => (- <XDSText type="code">{r.prop as string}</XDSText>- ),- },- {- key: 'type',- header: 'Type',- width: pixel(220),- renderCell: (r: Record<string, unknown>) => (- <XDSText type="code" maxLines={2}>- {r.type as string}- </XDSText>- ),- },- {key: 'req', header: 'Req', width: pixel(50)},- {- key: 'desc',- header: 'Description',- renderCell: (r: Record<string, unknown>) => (- <XDSText type="body" textWrap="wrap">- {r.desc as string}- </XDSText>- ),- },- ]}- density="spacious"- dividers="rows"- />- </XDSStack>-- {/* Tokens */}- <XDSStack direction="vertical" gap={4}>- <XDSHeading level={2}>Tokens</XDSHeading>- <XDSTable- data={- [- {- type: 'Display 1',- sizeToken: '--text-display-1-size',- weightToken: '--text-display-1-weight',- component: '<XDSText type="display-1">',- },- {- type: 'Display 2',- sizeToken: '--text-display-2-size',- weightToken: '--text-display-2-weight',- component: '<XDSText type="display-2">',- },- {- type: 'Display 3',- sizeToken: '--text-display-3-size',- weightToken: '--text-display-3-weight',- component: '<XDSText type="display-3">',- },- {- type: 'Heading 1',- sizeToken: '--text-heading-1-size',- weightToken: '--text-heading-1-weight',- component: '<XDSHeading level={1}>',- },- {- type: 'Heading 2',- sizeToken: '--text-heading-2-size',- weightToken: '--text-heading-2-weight',- component: '<XDSHeading level={2}>',- },- {- type: 'Heading 3',- sizeToken: '--text-heading-3-size',- weightToken: '--text-heading-3-weight',- component: '<XDSHeading level={3}>',- },- {- type: 'Heading 4',- sizeToken: '--text-heading-4-size',- weightToken: '--text-heading-4-weight',- component: '<XDSHeading level={4}>',- },- {- type: 'Heading 5',- sizeToken: '--text-heading-5-size',- weightToken: '--text-heading-5-weight',- component: '<XDSHeading level={5}>',- },- {- type: 'Heading 6',- sizeToken: '--text-heading-6-size',- weightToken: '--text-heading-6-weight',- component: '<XDSHeading level={6}>',- },- {- type: 'Large',- sizeToken: '--text-large-size',- weightToken: '--text-large-weight',- component: '<XDSText type="large">',- },- {- type: 'Body',- sizeToken: '--text-body-size',- weightToken: '--text-body-weight',- component: '<XDSText type="body">',- },- {- type: 'Label',- sizeToken: '--text-label-size',- weightToken: '--text-label-weight',- component: '<XDSText type="label">',- },- {- type: 'Supporting',- sizeToken: '--text-supporting-size',- weightToken: '--text-supporting-weight',- component: '<XDSText type="supporting">',- },- {- type: 'Code',- sizeToken: '--text-code-size',- weightToken: '--text-code-weight',- component: '<XDSText type="code">',- },- ] as Record<string, unknown>[]- }- columns={[- {- key: 'type',- header: 'Type',- width: pixel(100),- renderCell: (r: Record<string, unknown>) => (- <XDSText type="label">{r.type as string}</XDSText>- ),- },- {- key: 'sizeToken',- header: 'Size token',- renderCell: (r: Record<string, unknown>) => (- <XDSText type="code">{r.sizeToken as string}</XDSText>- ),- },- {- key: 'weightToken',- header: 'Weight token',- renderCell: (r: Record<string, unknown>) => (- <XDSText type="code">{r.weightToken as string}</XDSText>- ),- },- {- key: 'component',- header: 'Component',- renderCell: (r: Record<string, unknown>) => (- <XDSText type="code">{r.component as string}</XDSText>- ),- },- ]}- density="spacious"- dividers="rows"- />- <XDSGrid columns={2} gap={4}>- <XDSCard padding={4}>- <XDSText- type="label"- display="block"- style={{marginBottom: 8}}>- Font families- </XDSText>- <XDSStack direction="vertical" gap={2}>- {[- {- token: '--font-family-body',- note: 'body, large, label, supporting',- },- {- token: '--font-family-heading',- note: 'headings, display sizes',- },- {- token: '--font-family-code',- note: 'code text, CodeBlock',- },- ].map(f => (- <div key={f.token}>- <XDSText type="code" display="block">- {f.token}- </XDSText>- <XDSText type="supporting" color="secondary">- {f.note}- </XDSText>- </div>- ))}- </XDSStack>- </XDSCard>- <XDSCard padding={4}>- <XDSText- type="label"- display="block"- style={{marginBottom: 8}}>- Weights- </XDSText>- <XDSStack direction="vertical" gap={2}>- {[- {- token: '--font-weight-normal',- val: '400',- note: 'body, code, supporting',- },- {- token: '--font-weight-medium',- val: '500',- note: 'label',- },- {- token: '--font-weight-semibold',- val: '600',- note: 'headings, large',- },- {- token: '--font-weight-bold',- val: '700',- note: 'weight="bold" prop',- },- ].map(w => (- <div- key={w.token}- style={{- display: 'flex',- gap: 8,- alignItems: 'baseline',- }}>- <XDSText type="code">{w.val}</XDSText>- <XDSText type="supporting" color="secondary">- {w.note}- </XDSText>- </div>- ))}- </XDSStack>- </XDSCard>- </XDSGrid>- <XDSCard padding={4}>- <XDSText type="label" display="block" style={{marginBottom: 8}}>- Text colors (color prop)- </XDSText>- <XDSStack- direction="horizontal"- gap={6}- style={{flexWrap: 'wrap'}}>- {[- {prop: 'primary', note: 'Default — body, headings'},- {prop: 'secondary', note: 'Descriptions, metadata'},- {prop: 'disabled', note: 'Inactive content'},- {prop: 'active', note: 'Links, accents'},- {prop: 'inherit', note: 'Parent color'},- ].map(c => (- <XDSStack key={c.prop} direction="vertical" gap={0}>- <XDSText- type="code"- display="block">{`"${c.prop}"`}</XDSText>- <XDSText type="supporting" color="secondary">- {c.note}- </XDSText>- </XDSStack>- ))}- </XDSStack>- </XDSCard>- </XDSStack>- </XDSStack>- )}- </XDSStack>- </XDSSection>- );-}--// ----------------------------------------------------------------------------// SpacingFoundationPage-// -----------------------------------------------------------------------------const SPACING_TOKENS: {step: string; token: string; value: string}[] = [- {step: '0', token: '--spacing-0', value: '0px'},- {step: '0.5', token: '--spacing-0-5', value: '2px'},- {step: '1', token: '--spacing-1', value: '4px'},- {step: '1.5', token: '--spacing-1-5', value: '6px'},- {step: '2', token: '--spacing-2', value: '8px'},- {step: '3', token: '--spacing-3', value: '12px'},- {step: '4', token: '--spacing-4', value: '16px'},- {step: '5', token: '--spacing-5', value: '20px'},- {step: '6', token: '--spacing-6', value: '24px'},- {step: '7', token: '--spacing-7', value: '28px'},- {step: '8', token: '--spacing-8', value: '32px'},- {step: '9', token: '--spacing-9', value: '36px'},- {step: '10', token: '--spacing-10', value: '40px'},- {step: '11', token: '--spacing-11', value: '44px'},- {step: '12', token: '--spacing-12', value: '48px'},-];--const SPACING_RANGES: {range: string; pixels: string; usage: string}[] = [- {- range: '0–1',- pixels: '0–4px',- usage: 'Tight gaps between inline elements, icon-to-label spacing',- },- {- range: '1.5–2',- pixels: '6–8px',- usage: 'Component internal spacing, badge padding',- },- {- range: '3–4',- pixels: '12–16px',- usage: 'Standard component gaps, card padding, list item spacing',- },- {- range: '5–6',- pixels: '20–24px',- usage: 'Section spacing, larger card padding',- },- {- range: '8–10',- pixels: '32–40px',- usage: 'Page-level spacing, section separators',- },- {- range: '11–12',- pixels: '44–48px',- usage: 'Hero spacing, major section breaks',- },-];--function SpacingFoundationPage() {- return (- <XDSSection- maxWidth={960}- padding={8}- variant="transparent"- style={{marginInline: 'auto'}}>- <XDSStack direction="vertical" gap={10}>- {/* Header */}- <XDSStack direction="vertical" gap={3}>- <XDSText type="display-1">Spacing</XDSText>- <XDSText type="large" weight="normal" color="secondary">- XDS uses a 4px-based spacing scale to keep layouts consistent and- aligned. Every gap, padding, and margin maps to a token so your UI- stays rhythmic across components and pages.- </XDSText>- </XDSStack>-- {/* Spacing scale */}- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>Spacing scale</XDSHeading>- <XDSCard padding={0}>- <XDSTable- data={SPACING_TOKENS as Record<string, unknown>[]}- columns={[- {key: 'step', header: 'Step', width: pixel(100)},- {- key: 'token',- header: 'Token',- width: pixel(220),- renderCell: (row: Record<string, unknown>) => (- <XDSText type="code">{row.token as string}</XDSText>- ),- },- {key: 'value', header: 'Value', width: pixel(100)},- ]}- />- </XDSCard>- </XDSStack>-- {/* When to use each range */}- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>When to use each range</XDSHeading>- <XDSCard padding={0}>- <XDSTable- data={SPACING_RANGES as Record<string, unknown>[]}- columns={[- {key: 'range', header: 'Steps', width: pixel(100)},- {key: 'pixels', header: 'Pixels', width: pixel(100)},- {key: 'usage', header: 'Usage'},- ]}- />- </XDSCard>- </XDSStack>-- {/* Usage */}- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>Usage</XDSHeading>- <XDSList>- <XDSListItem label="Always use spacing tokens instead of hard-coded pixel values." />- <XDSListItem- label={- <>- Prefer the <XDSText type="code">gap</XDSText> prop on{' '}- <XDSText type="code">XDSStack</XDSText> over manual margins- between siblings.- </>- }- />- <XDSListItem- label="Use smaller steps (0–2) inside components and larger steps (4+)- between sections."- />- <XDSListItem- label={- <>- Keep spacing symmetric — if a card has{' '}- <XDSText type="code">padding={4}</XDSText>, use the- same value on all sides unless deliberately asymmetric.- </>- }- />- <XDSListItem- label="Avoid mixing spacing scales; stick to the 4px grid for predictable- alignment."- />- </XDSList>- </XDSStack>-- {/* Code */}- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>Code</XDSHeading>- <XDSCodeBlock- code={`// StyleX — reference spacing tokens directly-import { spacingVars } from '@xds/core/theme';--const styles = stylex.create({- container: {- padding: spacingVars.spacing4, // 16px- gap: spacingVars.spacing3, // 12px- marginBlock: spacingVars.spacing6, // 24px- },-});`}- language="tsx"- />- <XDSCodeBlock- code={`// XDSStack — use the gap prop with scale steps-<XDSStack direction="vertical" gap={4}>- <Card />- <Card />-</XDSStack>--<XDSStack direction="horizontal" gap={2}>- <Icon />- <Label />-</XDSStack>`}- language="tsx"- />- </XDSStack>- </XDSStack>- </XDSSection>- );-}--// ----------------------------------------------------------------------------// IllustrationsFoundationPage-// -----------------------------------------------------------------------------const ILLUSTRATION_CONTEXTS: Record<string, unknown>[] = [- {- context: 'Empty states',- examples: 'No data, first-time experience, search with no results',- },- {- context: 'Onboarding',- examples: 'Welcome screens, feature introduction, setup wizards',- },- {- context: 'Feature highlights',- examples: 'New feature announcements, upgrade prompts',- },- {- context: 'Error states',- examples: 'Permission denied, not found, service unavailable',- },-];--function IllustrationsFoundationPage() {- return (- <XDSSection- maxWidth={960}- padding={8}- variant="transparent"- style={{marginInline: 'auto'}}>- <XDSStack direction="vertical" gap={10}>- {/* Header */}- <XDSStack direction="vertical" gap={3}>- <XDSText type="display-1">Illustrations</XDSText>- <XDSText type="large" weight="normal" color="secondary">- Illustration guidelines for empty states, onboarding flows, and- feature highlights. Consistent illustration usage reinforces brand- identity and helps users understand context at a glance.- </XDSText>- </XDSStack>-- {/* When to use */}- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>When to use</XDSHeading>- <XDSCard padding={0}>- <XDSTable- data={ILLUSTRATION_CONTEXTS}- columns={[- {key: 'context', header: 'Context', width: pixel(180)},- {key: 'examples', header: 'Examples'},- ]}- density="spacious"- dividers="rows"- />- </XDSCard>- </XDSStack>-- {/* Guidelines */}- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>Guidelines</XDSHeading>- <XDSList>- <XDSListItem label="Keep illustrations consistent in style across the product." />- <XDSListItem- label="Use simple, flat illustrations that work in both light and dark- mode."- />- <XDSListItem- label="Size illustrations proportionally to the container — typically- 120–240px."- />- <XDSListItem label="Center illustrations with supporting text below." />- <XDSListItem label="Don't mix illustration styles from different sources." />- <XDSListItem label="Don't use illustrations as decoration without purpose." />- </XDSList>- </XDSStack>-- {/* Placement */}- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>Placement</XDSHeading>- <XDSText type="body" color="secondary">- Center illustrations inside <XDSText type="code">XDSCenter</XDSText>{' '}- with supporting text stacked below. Typical illustration sizes range- from 120px for inline empty states to 240px for full-page onboarding- screens. Always pair the illustration with a heading and optional- body text to explain what the user should do next.- </XDSText>- </XDSStack>-- {/* Code */}- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>Code</XDSHeading>- <XDSCodeBlock- code={`<XDSCenter>- <XDSStack direction="vertical" gap={3} hAlign="center">- <img- src="/illustrations/empty-search.svg"- alt="No results"- style={{ width: 200, height: 200 }}- />- <XDSHeading level={3}>No results found</XDSHeading>- <XDSText type="body" color="secondary">- Try adjusting your search or filters to find what you're- looking for.- </XDSText>- </XDSStack>-</XDSCenter>`}- language="tsx"- />- </XDSStack>- </XDSStack>- </XDSSection>- );-}--// ----------------------------------------------------------------------------// ShapeFoundationPage-// -----------------------------------------------------------------------------const SHAPE_TOKENS: {- token: string;- value: string;- usage: string;- cssVar: string;-}[] = [- {- token: '--radius-none',- value: '0px',- usage: 'Sharp corners',- cssVar: 'var(--radius-none)',- },- {- token: '--radius-inner',- value: '4px',- usage: 'Grouped corners, chips inside containers',- cssVar: 'var(--radius-inner)',- },- {- token: '--radius-element',- value: '8px',- usage: 'Buttons, inputs, badges',- cssVar: 'var(--radius-element)',- },- {- token: '--radius-container',- value: '12px',- usage: 'Cards, panels, sections',- cssVar: 'var(--radius-container)',- },- {- token: '--radius-page',- value: '28px',- usage: 'Modals, dialogs, chat composer',- cssVar: 'var(--radius-page)',- },- {- token: '--radius-full',- value: '9999px',- usage: 'Pills, avatars, circular buttons',- cssVar: 'var(--radius-full)',- },-];--function ShapeFoundationPage() {- return (- <XDSSection- maxWidth={960}- padding={8}- variant="transparent"- style={{marginInline: 'auto'}}>- <XDSStack direction="vertical" gap={10}>- {/* Header */}- <XDSStack direction="vertical" gap={3}>- <XDSText type="display-1">Shape</XDSText>- <XDSText type="large" weight="normal" color="secondary">- Border radius tokens define the curvature of UI surfaces. XDS- provides a six-step scale from sharp corners to fully rounded pills,- giving every element an intentional shape that adapts across themes.- </XDSText>- </XDSStack>-- {/* Radius scale */}- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>Radius scale</XDSHeading>- <XDSText type="body" color="secondary">- Six tokens cover every corner radius in the system. Each maps to a- semantic role so components pick the right curvature automatically.- </XDSText>- <XDSCard padding={0}>- <XDSTable- data={SHAPE_TOKENS as Record<string, unknown>[]}- columns={[- {- key: 'token',- header: 'Token',- width: pixel(220),- renderCell: (row: Record<string, unknown>) => (- <XDSText type="code">{row.token as string}</XDSText>- ),- },- {- key: 'value',- header: 'Value',- width: pixel(100),- renderCell: (row: Record<string, unknown>) => (- <XDSText type="body">{row.value as string}</XDSText>- ),- },- {- key: 'usage',- header: 'Usage',- renderCell: (row: Record<string, unknown>) => (- <XDSText type="body" color="secondary" textWrap="wrap">- {row.usage as string}- </XDSText>- ),- },- ]}- density="spacious"- dividers="rows"- />- </XDSCard>- </XDSStack>-- {/* Visual reference */}- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>Visual reference</XDSHeading>- <XDSText type="body" color="secondary">- Each square below uses the corresponding radius token via CSS custom- property, so it responds to theme changes automatically.- </XDSText>- <XDSGrid columns={3} gap={4}>- {SHAPE_TOKENS.map(t => (- <XDSStack- key={t.token}- direction="vertical"- gap={1}- hAlign="center">- <div- style={{- width: 120,- height: 120,- borderRadius: t.cssVar,- backgroundColor:- 'var(--color-accent-muted, rgba(0,100,224,0.15))',- border: '2px solid var(--color-accent, #0064E0)',- }}- />- <XDSText type="code" color="secondary">- {t.token}- </XDSText>- <XDSText type="supporting" color="secondary">- {t.value}- </XDSText>- </XDSStack>- ))}- </XDSGrid>- </XDSStack>-- {/* Concentric radius */}- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>Concentric radius</XDSHeading>- <XDSText type="body" color="secondary">- When an element is nested inside a rounded container, its corner- radius should equal the outer radius minus the padding between them.- This keeps the inner and outer curves concentric so the whitespace- between them stays visually even.- </XDSText>- <XDSText type="body" color="secondary">- <strong>inner radius = outer radius − padding</strong>- </XDSText>- <XDSCard padding={0}>- <XDSCodeBlock- language="tsx"- hasCopyButton- code={`// A card (container radius) with a nested button (element radius).-// outer = 12px, padding = 4px → inner should be 8px.--<div style={{ borderRadius: 'var(--radius-container)', padding: 4 }}>- <button style={{ borderRadius: 'var(--radius-element)' }}>- Save- </button>-</div>`}- />- </XDSCard>- <XDSText type="supporting" color="secondary">- If the padding is larger than the outer radius, use radius-none- (0px) for the inner element instead of going negative.- </XDSText>- </XDSStack>-- {/* Usage best practices */}- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>Usage</XDSHeading>- <XDSList density="balanced" listStyle="disc">- <XDSListItem label="Use semantic tokens (--radius-element, --radius-container) instead of hard-coded pixel values so shapes adapt when the theme changes." />- <XDSListItem label="Match the token to the element's role: buttons and inputs get --radius-element, cards and panels get --radius-container." />- <XDSListItem label="Apply the concentric radius rule whenever nesting rounded surfaces to keep curves optically smooth." />- <XDSListItem label="Reserve --radius-full for elements that should always appear circular regardless of size (avatars, status dots, pill badges)." />- <XDSListItem label="Use --radius-none intentionally for elements that need a sharp, authoritative edge (data tables, toolbars)." />- <XDSListItem label="Never mix token levels on the same surface — e.g. don't combine --radius-page on one corner and --radius-element on another." />- </XDSList>- </XDSStack>-- {/* Code */}- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>Code</XDSHeading>- <XDSText type="body" color="secondary">- Import radius tokens from the XDS theme package and apply them with- StyleX.- </XDSText>- <XDSCard padding={0}>- <XDSCodeBlock- language="typescript"- hasCopyButton- code={`import * as stylex from '@stylexjs/stylex';-import { radiusVars } from '@xds/core/theme';--const styles = stylex.create({- card: {- borderRadius: radiusVars.container,- },- button: {- borderRadius: radiusVars.element,- },- avatar: {- borderRadius: radiusVars.full,- },- modal: {- borderRadius: radiusVars.page,- },-});`}- />- </XDSCard>- </XDSStack>- </XDSStack>- </XDSSection>- );-}--// ----------------------------------------------------------------------------// IconsFoundationPage-// -----------------------------------------------------------------------------const ICON_SLOTS: {name: string; purpose: string}[] = [- {name: 'close', purpose: 'Dismiss dialogs, remove items'},- {name: 'chevronDown', purpose: 'Expand menus, dropdowns'},- {name: 'chevronLeft', purpose: 'Navigate back'},- {name: 'chevronRight', purpose: 'Navigate forward'},- {name: 'check', purpose: 'Confirm, success indicator'},- {name: 'success', purpose: 'Success state'},- {name: 'error', purpose: 'Error state'},- {name: 'warning', purpose: 'Warning state'},- {name: 'info', purpose: 'Information callouts'},- {name: 'calendar', purpose: 'Date pickers'},- {name: 'clock', purpose: 'Time, scheduling'},- {name: 'externalLink', purpose: 'External navigation'},- {name: 'menu', purpose: 'Mobile nav toggle'},- {name: 'moreHorizontal', purpose: 'Overflow actions'},- {name: 'search', purpose: 'Search triggers'},- {name: 'arrowUp', purpose: 'Sort ascending'},- {name: 'arrowDown', purpose: 'Sort descending'},- {name: 'arrowsUpDown', purpose: 'Bidirectional sort'},- {name: 'funnel', purpose: 'Filter controls'},- {name: 'eyeSlash', purpose: 'Hide/reveal toggle'},- {name: 'viewColumns', purpose: 'Column visibility'},- {name: 'copy', purpose: 'Copy to clipboard'},- {name: 'checkDouble', purpose: 'Delivered/read status'},- {name: 'wrench', purpose: 'Tool calls, settings'},- {name: 'stop', purpose: 'Stop streaming'},- {name: 'microphone', purpose: 'Voice input'},-];--const ICON_SIZES: {size: string; pixels: string}[] = [- {size: 'xsm', pixels: '12px'},- {size: 'sm', pixels: '16px'},- {size: 'md', pixels: '20px'},- {size: 'lg', pixels: '24px'},-];--const ICON_COLORS: {color: string}[] = [- {color: 'primary'},- {color: 'secondary'},- {color: 'disabled'},- {color: 'accent'},- {color: 'error'},- {color: 'warning'},- {color: 'success'},- {color: 'inherit'},-];--function IconsFoundationPage() {- return (- <XDSSection- maxWidth={960}- padding={8}- variant="transparent"- style={{marginInline: 'auto'}}>- <XDSStack direction="vertical" gap={10}>- {/* Header */}- <XDSStack direction="vertical" gap={3}>- <XDSText type="display-1">Icons</XDSText>- <XDSText type="large" weight="normal" color="secondary">- XDS uses semantic icon slots so components always get the right icon- regardless of which icon library your theme provides. Instead of- importing SVGs directly, you reference a slot name and the active- theme resolves it at render time.- </XDSText>- </XDSStack>-- {/* Semantic icon slots */}- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>Semantic icon slots</XDSHeading>- <XDSText type="body" color="secondary">- Every XDS theme must provide an SVG for each slot. Components like{' '}- <XDSText type="code">XDSIcon</XDSText>,{' '}- <XDSText type="code">XDSIconButton</XDSText>, and status indicators- resolve icons through these names.- </XDSText>- <XDSCard padding={0}>- <XDSTable- data={ICON_SLOTS as Record<string, unknown>[]}- columns={[- {- key: 'name',- header: 'Name',- width: pixel(200),- renderCell: (row: Record<string, unknown>) => (- <XDSText type="code">{row.name as string}</XDSText>- ),- },- {key: 'purpose', header: 'Purpose'},- ]}- />- </XDSCard>- </XDSStack>-- {/* Sizes */}- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>Sizes</XDSHeading>- <XDSText type="body" color="secondary">- Pass a <XDSText type="code">size</XDSText> prop to control the- rendered dimensions. All sizes align to the 4px grid.- </XDSText>- <XDSCard padding={0}>- <XDSTable- data={ICON_SIZES as Record<string, unknown>[]}- columns={[- {- key: 'size',- header: 'Size',- width: pixel(120),- renderCell: (row: Record<string, unknown>) => (- <XDSText type="code">{row.size as string}</XDSText>- ),- },- {key: 'pixels', header: 'Pixels', width: pixel(120)},- ]}- />- </XDSCard>- </XDSStack>-- {/* Colors */}- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>Colors</XDSHeading>- <XDSText type="body" color="secondary">- The <XDSText type="code">color</XDSText> prop maps to semantic- tokens from the active theme. Use{' '}- <XDSText type="code">inherit</XDSText> to pick up the parent's text- color.- </XDSText>- <XDSCard padding={0}>- <XDSTable- data={ICON_COLORS as Record<string, unknown>[]}- columns={[- {- key: 'color',- header: 'Color',- width: pixel(200),- renderCell: (row: Record<string, unknown>) => (- <XDSText type="code">{row.color as string}</XDSText>- ),- },- ]}- />- </XDSCard>- </XDSStack>-- {/* Theme icon sets */}- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>Theme icon sets</XDSHeading>- <XDSText type="body" color="secondary">- Each XDS theme ships its own icon set that fulfills every semantic- slot. Switching themes automatically swaps the underlying SVGs.- </XDSText>- <XDSList>- <XDSListItem- label={- <>- <XDSText type="body">- <XDSText type="code" weight="bold">- Heroicons- </XDSText>{' '}- — the default icon set, used by the Default and Meta themes.- Outlined style with rounded caps.- </XDSText>- </>- }- />- <XDSListItem- label={- <>- <XDSText type="body">- <XDSText type="code" weight="bold">- Lucide- </XDSText>{' '}- — used by the Neutral theme. Slightly thinner stroke with a- geometric feel.- </XDSText>- </>- }- />- <XDSListItem- label={- <>- <XDSText type="body">- <XDSText type="code" weight="bold">- registerIcons()- </XDSText>{' '}- — supply your own SVG components for any or all slots when- defining a custom theme.- </XDSText>- </>- }- />- </XDSList>- </XDSStack>-- {/* Code */}- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>Code</XDSHeading>- <XDSCodeBlock- code={`import { XDSIcon } from '@xds/core/Icon';--// Basic usage — reference a semantic slot by name-<XDSIcon icon="check" size="md" color="success" />-<XDSIcon icon="close" size="sm" color="secondary" />-<XDSIcon icon="warning" size="lg" color="warning" />`}- language="tsx"- />- <XDSCodeBlock- code={`import { registerIcons } from '@xds/core/Icon';-import { defineTheme } from '@xds/core/theme';--// Custom theme with your own icon set-const myIcons = registerIcons({- close: MyCloseIcon,- check: MyCheckIcon,- chevronDown: MyChevronDownIcon,- // ... provide all 26 slots-});--const myTheme = defineTheme({- name: 'my-brand',- icons: myIcons,- tokens: { /* ... */ },-});`}- language="tsx"- />- </XDSStack>- </XDSStack>- </XDSSection>- );-}--// ----------------------------------------------------------------------------// LibraryPackagePage components-// -----------------------------------------------------------------------------const VEGA_COMPONENTS: {- label: string;- items: {key: string; name: string; desc: string}[];-}[] = [- {- label: 'Charts',- items: [- {- key: 'bar-chart',- name: 'BarChart',- desc: 'Vertical and horizontal bar charts for categorical data comparison.',- },- {- key: 'line-chart',- name: 'LineChart',- desc: 'Line charts for trends over time with multiple series support.',- },- {- key: 'area-chart',- name: 'AreaChart',- desc: 'Filled area charts for volume and cumulative data visualization.',- },- {- key: 'pie-chart',- name: 'PieChart',- desc: 'Pie and donut charts for part-to-whole relationships.',- },- ],- },- {- label: 'Utilities',- items: [- {- key: 'chart-legend',- name: 'ChartLegend',- desc: 'Legend component for labeling chart series and categories.',- },- {- key: 'chart-tooltip',- name: 'ChartTooltip',- desc: 'Tooltip overlay for displaying data point details on hover.',- },- {- key: 'chart-axis',- name: 'ChartAxis',- desc: 'Configurable axis component for labels, ticks, and gridlines.',- },- ],- },-];--function PackageGridPage({- packageKey,- components,- onSelectComponent,-}: {- packageKey: string;- components: {- label: string;- items: {key: string; name: string; desc: string}[];- }[];- onSelectComponent: (key: string) => void;-}) {- const [hoveredComponent, setHoveredComponent] = useState<string | null>(null);- const pkg = LIBRARY_PACKAGES.find(p => p.key === packageKey);- if (pkg == null) {- return null;- }- const totalComponents = components.reduce(- (sum, cat) => sum + cat.items.length,- 0,- );-- return (- <div style={{display: 'flex', height: '100%', overflow: 'hidden'}}>- <div style={{width: '45%', flexShrink: 0, padding: 16}}>- <XDSCard- variant="muted"- padding={6}- style={{- height: '100%',- display: 'flex',- flexDirection: 'column',- alignItems: 'center',- justifyContent: 'center',- }}>- {hoveredComponent && COMPONENT_PREVIEWS[hoveredComponent] ? (- <XDSStack direction="vertical" gap={3} hAlign="center">- {COMPONENT_PREVIEWS[hoveredComponent]}- <XDSText type="supporting" weight="semibold" color="secondary">- {hoveredComponent}- </XDSText>- </XDSStack>- ) : (- <XDSStack- direction="vertical"- gap={2}- hAlign="center"- style={{textAlign: 'center'}}>- <XDSText type="display-2">{pkg.name}</XDSText>- <XDSText type="body" color="secondary">- {totalComponents} components- </XDSText>- {pkg.status === 'Coming Soon' ? (- <XDSBadge label="Coming Soon" variant="blue" />- ) : (- <XDSText- type="supporting"- color="secondary"- style={{maxWidth: 300}}>- Hover a component on the right to preview it here.- </XDSText>- )}- </XDSStack>- )}- </XDSCard>- </div>-- <div style={{flex: 1, overflowY: 'auto'}}>- <div- style={{- position: 'sticky',- top: 0,- zIndex: 10,- backgroundColor: 'var(--color-background-surface, #fff)',- padding: '24px 32px 16px',- }}>- <XDSStack- direction="horizontal"- gap={3}- vAlign="center"- style={{marginBottom: 8}}>- <XDSText type="display-1">{pkg.name}</XDSText>- {pkg.version && (- <XDSText- type="supporting"- color="secondary"- style={{fontFamily: 'monospace'}}>- v{pkg.version}- </XDSText>- )}- </XDSStack>- <XDSStack direction="horizontal" gap={2} vAlign="center">- <XDSText type="body" color="secondary" style={{flex: 1}}>- {pkg.description}- </XDSText>- <XDSPopover- label="Install"- placement="below"- alignment="end"- width={360}- content={- <XDSStack direction="vertical" gap={3}>- <XDSStack direction="vertical" gap={1}>- <XDSText type="label">1. Install the package</XDSText>- <XDSCard padding={0}>- <XDSCodeBlock- code={`npm install ${pkg.name}`}- language="bash"- hasCopyButton- size="sm"- />- </XDSCard>- </XDSStack>- <XDSStack direction="vertical" gap={1}>- <XDSText type="label">2. Import a component</XDSText>- <XDSCard padding={0}>- <XDSCodeBlock- code={`import {...} from '${pkg.name}/ComponentName';`}- language="typescript"- size="sm"- />- </XDSCard>- </XDSStack>- <XDSText type="supporting" color="secondary">- See Getting Started for full setup with ThemeProvider.- </XDSText>- </XDSStack>- }>- <XDSButton- label="Install"- variant="primary"- size="sm"- icon={<DownloadIcon />}- />- </XDSPopover>- </XDSStack>- </div>- <div style={{padding: '24px 32px'}}>- {components.map(cat => (- <div key={cat.label} style={{marginBottom: 28}}>- <XDSText- type="label"- color="secondary"- style={{display: 'block', marginBottom: 10}}>- {cat.label}- </XDSText>- <div- style={{- display: 'grid',- gridTemplateColumns: 'repeat(auto-fill, minmax(200px, 1fr))',- gap: 10,- }}>- {cat.items.map(item => (- <div- key={item.key}- onMouseEnter={() => setHoveredComponent(item.key)}- onMouseLeave={() => setHoveredComponent(null)}- onClick={() => onSelectComponent(item.key)}- style={{cursor: 'pointer'}}>- <XDSCard padding={3}>- <XDSText- type="body"- weight="bold"- style={{display: 'block', marginBottom: 2}}>- {item.name}- </XDSText>- <XDSText type="supporting" color="secondary" maxLines={2}>- {item.desc}- </XDSText>- </XDSCard>- </div>- ))}- </div>- </div>- ))}- </div>- </div>- </div>- );-}--// ----------------------------------------------------------------------------// Theme package detail data-// -----------------------------------------------------------------------------type ThemeCharacteristic = {- label: string;- value: string;- detail?: string;-};--type ThemeTokenOverride = {- token: string;- default: string;- override: string;-};--type ThemeDetail = {- name: string;- npmName: string;- version: string;- description: string;- characteristics: ThemeCharacteristic[];- setupCode: string;- tokenOverrides: ThemeTokenOverride[];-};--const THEME_DETAILS: Record<string, ThemeDetail> = {- 'pkg-theme-default': {- name: 'Default',- npmName: '@xds/theme-default',- version: '0.0.12',- description:- 'The reference theme for XDS. Clean and professional with a blue accent, system fonts, and Heroicons. Designed to work out of the box with zero configuration.',- characteristics: [- {- label: 'Typography',- value: 'System fonts',- detail: 'Scale base 14px, ratio 1.2',- },- {label: 'Icons', value: 'Heroicons', detail: 'Outline + solid variants'},- {- label: 'Accent',- value: 'Blue (#0066FF)',- detail: 'Semantic color palette',- },- {- label: 'Radius',- value: 'Standard',- detail: 'element 8px, container 12px',- },- {- label: 'Motion',- value: 'Balanced',- detail: 'fast 175ms, medium 410ms, slow 975ms',- },- {label: 'Syntax', value: 'GitHub theme', detail: 'Light + dark variants'},- ],- setupCode: `// app/globals.css-@import "@xds/core/reset.css";-@import "@xds/theme-default/theme.css";--// app/providers.tsx-import {XDSTheme} from '@xds/core/theme';-import {defaultTheme} from '@xds/theme-default/built';--export function Providers({children}: {children: React.ReactNode}) {- return (- <XDSTheme theme={defaultTheme}>- {children}- </XDSTheme>- );-}`,- tokenOverrides: [- {token: '--radius-element', default: '—', override: '0.5rem (8px)'},- {token: '--radius-container', default: '—', override: '0.625rem (10px)'},- {token: '--radius-page', default: '—', override: '0.75rem (12px)'},- {- token: '--font-family-body',- default: '—',- override: 'system-ui, sans-serif',- },- {- token: '--font-family-heading',- default: '—',- override: 'system-ui, sans-serif',- },- {token: '--font-family-code', default: '—', override: 'monospace'},- {token: '--color-accent', default: '—', override: '#0064E0 / #2694FE'},- {token: '--duration-fast', default: '—', override: '175ms'},- {token: '--duration-medium', default: '—', override: '410ms'},- {token: '--duration-slow', default: '—', override: '975ms'},- ],- },- 'pkg-theme-neutral': {- name: 'Neutral',- npmName: '@xds/theme-neutral',- version: '0.0.12',- description:- 'A muted, minimal theme with warm gray tones and desaturated colors. Uses Geist font for body and headings, Geist Mono for code, and Lucide icons. Ideal for productivity tools and developer-facing interfaces.',- characteristics: [- {- label: 'Typography',- value: 'Geist / Geist Mono',- detail: 'Scale base 14px, ratio 1.2, h3/h4 bold',- },- {label: 'Icons', value: 'Lucide', detail: 'Outline style'},- {label: 'Accent', value: 'Desaturated', detail: 'Full oklch color space'},- {- label: 'Radius',- value: 'Larger',- detail: 'element 10px, container 12px',- },- {- label: 'Motion',- value: 'Snappy',- detail: 'fast 125ms, medium 300ms, slow 700ms',- },- {- label: 'Syntax',- value: 'Desaturated',- detail: 'Matches grayscale palette',- },- ],- setupCode: `// app/globals.css-@import "@xds/core/reset.css";-@import "@xds/theme-neutral/theme.css";--// app/providers.tsx-import {XDSTheme} from '@xds/core/theme';-import {neutralTheme} from '@xds/theme-neutral/built';--export function Providers({children}: {children: React.ReactNode}) {- return (- <XDSTheme theme={neutralTheme}>- {children}- </XDSTheme>- );-}`,- tokenOverrides: [- {token: '--radius-element', default: '0.5rem', override: '0.625rem'},- {token: '--radius-container', default: '0.625rem', override: '0.75rem'},- {token: '--radius-page', default: '0.75rem', override: '1rem'},- {- token: '--font-family-body',- default: 'system-ui',- override: 'Geist, sans-serif',- },- {- token: '--font-family-heading',- default: 'system-ui',- override: 'Geist, sans-serif',- },- {- token: '--font-family-code',- default: 'monospace',- override: 'Geist Mono, monospace',- },- {token: '--duration-fast', default: '175ms', override: '125ms'},- {token: '--duration-medium', default: '410ms', override: '300ms'},- {token: '--duration-slow', default: '975ms', override: '700ms'},- ],- },-};--const THEME_OBJECTS: Record<string, XDSDefinedTheme> = {- 'pkg-theme-default': defaultTheme,- 'pkg-theme-neutral': neutralTheme,-};--const PALETTE_SWATCHES = [- {label: 'Accent', var: '--color-accent'},- {label: 'Success', var: '--color-success'},- {label: 'Warning', var: '--color-warning'},- {label: 'Error', var: '--color-error'},- {label: 'Surface', var: '--color-background-surface'},- {label: 'Body', var: '--color-background-body'},- {label: 'Neutral', var: '--color-neutral'},-];--function ThemePreview() {- return (- <XDSStack direction="vertical" gap={6}>- <XDSGrid columns={7} gap={2}>- {PALETTE_SWATCHES.map(swatch => (- <XDSStack- key={swatch.label}- direction="vertical"- gap={1}- vAlign="center">- <div- style={{- width: '100%',- aspectRatio: '1',- borderRadius: 'var(--radius-element, 8px)',- backgroundColor: `var(${swatch.var})`,- border: '1px solid var(--color-border, rgba(0,0,0,0.1))',- }}- />- <XDSText type="supporting" color="secondary">- {swatch.label}- </XDSText>- </XDSStack>- ))}- </XDSGrid>-- <XDSDivider />-- <XDSGrid columns={2} gap={4}>- <XDSStack direction="horizontal" gap={2}>- <XDSButton label="Primary" variant="primary" />- <XDSButton label="Secondary" variant="secondary" />- <XDSButton- label="Ghost"- variant="ghost"- icon={<XDSIcon icon={HeartIcon} size="sm" />}- />- </XDSStack>-- <XDSStack direction="horizontal" gap={2}>- <XDSBadge label="Default" />- <XDSBadge label="Info" variant="info" />- <XDSBadge label="Success" variant="success" />- <XDSBadge label="Warning" variant="warning" />- </XDSStack>-- <XDSTextInput- label="Example"- placeholder="Type something..."- value=""- onChange={() => {}}- />-- <XDSStack direction="horizontal" gap={4} vAlign="center">- <XDSSwitch label="Toggle" value={true} onChange={() => {}} />- <XDSProgressBar value={65} label="Progress" />- </XDSStack>- </XDSGrid>-- <XDSGrid columns={2} gap={4}>- <XDSCard padding={4}>- <XDSStack direction="vertical" gap={2}>- <XDSHeading level={4}>Card Title</XDSHeading>- <XDSText type="body" color="secondary">- A flexible surface for grouping related content and actions.- </XDSText>- <XDSButton label="Action" variant="secondary" size="sm" />- </XDSStack>- </XDSCard>-- <XDSStack direction="horizontal" gap={3} vAlign="center">- <XDSAvatar name="Alice" size="small" />- <XDSAvatar name="Bob" size="medium" />- <XDSAvatar name="Charlie" size="large" />- </XDSStack>- </XDSGrid>-- <XDSTable- data={- [- {name: 'Alice', role: 'Engineer', status: 'Active'},- {name: 'Bob', role: 'Designer', status: 'Away'},- {name: 'Charlie', role: 'PM', status: 'Active'},- ] as {[key: string]: unknown}[]- }- columns={[- {key: 'name', header: 'Name'},- {key: 'role', header: 'Role'},- {key: 'status', header: 'Status'},- ]}- />- </XDSStack>- );-}--// ----------------------------------------------------------------------------// ThemePackagePage component-// -----------------------------------------------------------------------------function ThemePackagePage({- packageKey,- onCraft,-}: {- packageKey: string;- onCraft?: () => void;-}) {- const theme = THEME_DETAILS[packageKey];- if (!theme) {- return null;- }- const isDefault = packageKey === 'pkg-theme-default';- const themeObject = THEME_OBJECTS[packageKey];-- return (- <XDSSection- maxWidth={960}- padding={8}- variant="transparent"- style={{marginInline: 'auto'}}>- <XDSStack direction="vertical" gap={10}>- {/* Header */}- <XDSStack direction="vertical" gap={3}>- <XDSStack direction="horizontal" gap={3} vAlign="center">- <XDSText type="display-1">{theme.npmName}</XDSText>- <XDSText type="code" color="secondary" size="xsm">- v{theme.version}- </XDSText>- </XDSStack>- <XDSText type="body" color="secondary">- {theme.description}- </XDSText>- {onCraft && (- <XDSStack direction="horizontal" gap={2}>- <XDSButton- label="Try in Craft"- variant="secondary"- icon={<XDSIcon icon={PaletteIcon} size="sm" />}- onClick={onCraft}- />- </XDSStack>- )}- </XDSStack>-- {/* Live preview */}- {themeObject && (- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>Preview</XDSHeading>- <XDSTheme theme={themeObject}>- <XDSCard variant="muted" padding={6}>- <ThemePreview />- </XDSCard>- </XDSTheme>- </XDSStack>- )}-- {/* Characteristics grid */}- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>Characteristics</XDSHeading>- <XDSGrid columns={3} gap={3}>- {theme.characteristics.map(char => (- <XDSCard key={char.label} padding={4}>- <XDSStack direction="vertical" gap={1}>- <XDSText- type="code"- color="secondary"- size="xsm"- style={{- textTransform: 'uppercase',- letterSpacing: '0.06em',- }}>- {char.label}- </XDSText>- <XDSText type="body" weight="bold">- {char.value}- </XDSText>- {char.detail && (- <XDSText type="supporting" color="secondary">- {char.detail}- </XDSText>- )}- </XDSStack>- </XDSCard>- ))}- </XDSGrid>- </XDSStack>-- {/* Install */}- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>Install</XDSHeading>- <XDSCard padding={0}>- <XDSCodeBlock- code={`npm install ${theme.npmName}`}- title="Terminal"- language="bash"- hasCopyButton- />- </XDSCard>- </XDSStack>-- {/* Setup */}- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>Setup</XDSHeading>- <XDSText type="body" color="secondary">- Import the theme CSS and wrap your app in XDSTheme. All components- will inherit the theme's tokens for colors, typography, spacing,- and radius.- </XDSText>- <XDSCard padding={0}>- <XDSCodeBlock- code={theme.setupCode}- title={`Using ${theme.npmName}`}- language="tsx"- hasCopyButton- />- </XDSCard>- </XDSStack>-- {/* Token values / overrides */}- {theme.tokenOverrides.length > 0 && (- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>- {isDefault ? 'Token values' : 'Token overrides'}- </XDSHeading>- <XDSText type="body" color="secondary">- {isDefault- ? 'Reference values for the default theme. Other themes override these.'- : 'These tokens differ from the default theme. All other tokens use built-in defaults.'}- </XDSText>- <XDSCard padding={0}>- <XDSTable- data={theme.tokenOverrides as {[key: string]: unknown}[]}- columns={- isDefault- ? [- {key: 'token', header: 'Token'},- {key: 'override', header: 'Value'},- ]- : [- {key: 'token', header: 'Token'},- {key: 'default', header: 'Default'},- {key: 'override', header: theme.name},- ]- }- />- </XDSCard>- </XDSStack>- )}-- {/* What's included */}- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>What's included</XDSHeading>- <XDSList density="balanced" listStyle="disc">- <XDSListItem label="Full color palette with light and dark mode support" />- <XDSListItem label="Typography scale with heading, body, label, code, and supporting sizes" />- <XDSListItem label="Radius, spacing, shadow, and motion tokens" />- <XDSListItem label="Icon registry with 26 semantic icon slots" />- <XDSListItem label="Syntax highlighting theme for CodeBlock" />- <XDSListItem label="Component-level style overrides (e.g. Button secondary)" />- </XDSList>- </XDSStack>-- {/* Switching themes */}- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>Switching themes</XDSHeading>- <XDSText type="body" color="secondary">- Swap themes by changing the CSS import and theme object. No- component code changes required.- </XDSText>- <XDSCard padding={0}>- <XDSCodeBlock- code={`# Available themes:\nnpm install @xds/theme-default # Clean blue, Heroicons\nnpm install @xds/theme-neutral # Muted gray, Lucide`}- title="Terminal"- language="bash"- hasCopyButton- />- </XDSCard>- </XDSStack>- </XDSStack>- </XDSSection>- );-}--function LibraryPackagePage({- packageKey,- onSelectComponent,- onCraft,-}: {- packageKey: string;- onSelectComponent: (key: string) => void;- onCraft?: () => void;-}) {- if (packageKey === 'pkg-core') {- return (- <PackageGridPage- packageKey={packageKey}- components={COMPONENT_CATEGORIES}- onSelectComponent={onSelectComponent}- />- );- }- if (packageKey === 'pkg-vega') {- return (- <PackageGridPage- packageKey={packageKey}- components={VEGA_COMPONENTS}- onSelectComponent={onSelectComponent}- />- );- }- if (packageKey === 'pkg-cli') {- return <CliPage />;- }- if (THEME_DETAILS[packageKey]) {- return <ThemePackagePage packageKey={packageKey} onCraft={onCraft} />;- }- return null;-}--function CliCommandView({cmd}: {cmd: CliCommand}) {- const allOptions = [- ...cmd.arguments.map(a => ({- flags: a.required- ? `<${a.name}${a.variadic ? '...' : ''}>`- : `[${a.name}]`,- description: a.description || 'Positional argument',- })),- ...cmd.options.map(o => ({flags: o.flags, description: o.description})),- ...cmd.subcommands.flatMap(sub => [- {flags: sub.name, description: `Subcommand: ${sub.description}`},- ...sub.options.map(o => ({- flags: `${sub.name} ${o.flags}`,- description: o.description,- })),- ]),- ];-- return (- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>xds {cmd.name}</XDSHeading>- <XDSText type="body" color="secondary">- {cmd.description}- </XDSText>- {allOptions.length > 0 && (- <XDSCard padding={0} style={{overflow: 'auto'}}>- <XDSTable- data={allOptions as {[key: string]: unknown}[]}- columns={[- {key: 'flags', header: 'Flag / Argument'},- {key: 'description', header: 'Description'},- ]}- />- </XDSCard>- )}- </XDSStack>- );-}--function CliPage() {- return (- <XDSSection- maxWidth={960}- padding={8}- variant="transparent"- style={{marginInline: 'auto'}}>- <XDSStack direction="vertical" gap={10}>- {/* Header */}- <XDSStack direction="vertical" gap={2}>- <XDSStack direction="horizontal" gap={3} vAlign="center">- <XDSText type="display-1">@xds/cli</XDSText>- <XDSBadge label={`v${CLI_VERSION}`} variant="neutral" />- </XDSStack>- <XDSText type="body" color="secondary">- Command-line interface for project setup, component docs, page- templates, theming, component ejection, upgrade codemods, and AI- agent context generation.- </XDSText>- </XDSStack>-- {/* Install */}- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>Install</XDSHeading>- <XDSCard padding={0}>- <XDSCodeBlock- code={`# Run without installing\nnpx xds <command>\n\n# Or install globally\nnpm install -g @xds/cli`}- title="Terminal"- language="bash"- hasCopyButton- />- </XDSCard>- </XDSStack>-- {/* Global options */}- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>Global options</XDSHeading>- <XDSText type="body" color="secondary">- These flags work with any command.- </XDSText>- <XDSCard padding={0} style={{overflow: 'auto'}}>- <XDSTable- data={- [- {flags: '--version, -V', description: 'Print CLI version'},- ...cliGlobalOptions.map(o => ({- flags: o.flags,- description: o.description,- })),- {flags: '--help', description: 'Show help for any command'},- ] as {[key: string]: unknown}[]- }- columns={[- {key: 'flags', header: 'Flag'},- {key: 'description', header: 'Description'},- ]}- />- </XDSCard>- </XDSStack>-- {/* Commands */}- {cliCommands.map(cmd => (- <CliCommandView key={cmd.name} cmd={cmd} />- ))}-- {/* Configuration */}- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>Configuration</XDSHeading>- <XDSText type="body" color="secondary">- Create an xds.config.mjs in your project root to configure package- discovery paths, gap report delivery, and theme settings.- </XDSText>- <XDSCard padding={0}>- <XDSCodeBlock- code={`// xds.config.mjs\nexport default {\n packageDirs: ['./packages'],\n gapReport: { target: 'github' },\n};`}- language="javascript"- hasCopyButton- />- </XDSCard>- </XDSStack>-- {/* Programmatic API */}- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>Programmatic API</XDSHeading>- <XDSText type="body" color="secondary">- Use the CLI programmatically via @xds/cli/api for build scripts, CI- pipelines, and custom tooling.- </XDSText>- <XDSCard padding={0}>- <XDSCodeBlock- code={`import { component, docs, discover, template } from '@xds/cli/api';\n\nconst buttonDocs = await component('Button', { dense: true });\nconst tokenDocs = await docs('tokens', { json: true });\nconst templates = await template({ list: true });\nconst packages = await discover();`}- language="typescript"- hasCopyButton- />- </XDSCard>- </XDSStack>-- {/* Best practices */}- <XDSStack direction="vertical" gap={3}>- <XDSHeading level={2}>Best practices</XDSHeading>- <XDSList density="balanced" listStyle="disc">- <XDSListItem label="Run xds init when setting up a new project to generate AI agent docs and a starter theme" />- <XDSListItem label="Use xds component <Name> --dense before modifying or building with any component" />- <XDSListItem label="After upgrading @xds/core, run xds upgrade --apply --to <version> to auto-migrate breaking changes" />- <XDSListItem label="When swizzling, use --gap to report why you needed to eject" />- <XDSListItem label="Use xds gap-report to request missing components or features" />- <XDSListItem label="Use xds theme build to compile custom themes for production" />- </XDSList>- </XDSStack>- </XDSStack>- </XDSSection>- );-}--// ----------------------------------------------------------------------------// ResourcePage components-// -----------------------------------------------------------------------------function ResourceHeader({- icon,- title,- description,- bg,-}: {- icon: React.ComponentType<React.SVGProps<SVGSVGElement>>;- title: string;- description: string;- bg: string;-}) {- return (- <div- style={{- backgroundColor: bg,- borderRadius: 16,- padding: '32px 36px',- display: 'flex',- alignItems: 'center',- gap: 20,- marginBottom: 40,- }}>- <div- style={{- width: 48,- height: 48,- borderRadius: 14,- backgroundColor: 'rgba(255,255,255,0.6)',- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- flexShrink: 0,- }}>- <XDSIcon icon={icon} size="md" color="accent" />- </div>- <XDSStack direction="vertical" gap={0}>- <XDSText type="display-2">{title}</XDSText>- <XDSText type="body" color="secondary">- {description}- </XDSText>- </XDSStack>- </div>- );-}--function NpmPackagesPage() {- return (- <XDSSection- maxWidth={960}- padding={8}- variant="transparent"- style={{marginInline: 'auto'}}>- <ResourceHeader- icon={DownloadIcon}- title="NPM Packages"- description="All packages are published under the @xds scope on npm."- bg="#FEE2E2"- />- <div>- <XDSHeading level={2} style={{marginBottom: 16}}>- Install- </XDSHeading>- <XDSCard padding={0}>- <XDSCodeBlock- code={`# Core components\nnpm install @xds/core\n\n# Charts & data visualization\nnpm install @xds/vega\n\n# CLI tooling\nnpm install -g @xds/cli`}- title="Terminal"- language="bash"- hasCopyButton- />- </XDSCard>- </div>- <div style={{marginTop: 40}}>- <XDSHeading level={2} style={{marginBottom: 16}}>- Packages- </XDSHeading>- <XDSCard padding={0} style={{overflow: 'auto'}}>- <XDSTable- data={- [- {- package: '@xds/core',- description: 'Core UI components (60+)',- version: '0.0.12',- status: 'Stable',- },- {- package: '@xds/vega',- description: 'Charts & data visualization',- version: '—',- status: 'Coming Soon',- },- {- package: '@xds/cli',- description: 'CLI for scaffolding & tooling',- version: '0.0.12',- status: 'Stable',- },- {- package: '@xds/theme-default',- description: 'Default theme (blue accent)',- version: '0.0.12',- status: 'Stable',- },- {- package: '@xds/theme-neutral',- description: 'Neutral warm gray theme',- version: '0.0.12',- status: 'Stable',- },- ] as {[key: string]: unknown}[]- }- columns={[- {key: 'package', header: 'Package'},- {key: 'description', header: 'Description'},- {key: 'version', header: 'Version'},- {key: 'status', header: 'Status'},- ]}- />- </XDSCard>- </div>- <div style={{marginTop: 40}}>- <XDSHeading level={2} style={{marginBottom: 16}}>- Peer dependencies- </XDSHeading>- <XDSText type="body" color="secondary">- All packages require React 19+ and StyleX 0.10+. Theme packages are- optional — if no theme is installed, components use built-in defaults.- </XDSText>- </div>- </XDSSection>- );-}--function AgentDocsPage() {- return (- <XDSSection- maxWidth={960}- padding={8}- variant="transparent"- style={{marginInline: 'auto'}}>- <ResourceHeader- icon={SparklesIcon}- title="AI / Agent Docs"- description="Generate context docs so your AI knows every component, prop, and pattern."- bg="#FEF3C7"- />- <div>- <XDSHeading level={2} style={{marginBottom: 16}}>- Generate agent docs- </XDSHeading>- <XDSText type="body" color="secondary" style={{marginBottom: 16}}>- The CLI produces a comprehensive AGENTS.md that AI assistants can use- as context when generating XDS code.- </XDSText>- <XDSCard padding={0}>- <XDSCodeBlock- code={`# Generate docs for all components\nxds docs\n\n# List available doc topics\nxds docs --list\n\n# Get specific docs (dense format for AI)\nxds docs principles --dense\nxds docs tokens --dense\nxds docs theme --dense\n\n# Get docs for a specific component\nxds component Button --dense\nxds component Table --dense`}- title="Terminal"- language="bash"- hasCopyButton- />- </XDSCard>- </div>- <div style={{marginTop: 40}}>- <XDSHeading level={2} style={{marginBottom: 16}}>- What's included- </XDSHeading>- <XDSList density="spacious" listStyle="disc">- <XDSListItem label="Component props, variants, and usage examples for every component" />- <XDSListItem label="Design token reference — spacing, colors, typography, radius, elevation" />- <XDSListItem label="Theme provider setup and customization patterns" />- <XDSListItem label="Anti-patterns and common mistakes to avoid" />- <XDSListItem label="StyleX conventions and CSS capabilities" />- </XDSList>- </div>- <div style={{marginTop: 40}}>- <XDSHeading level={2} style={{marginBottom: 16}}>- Using with Cursor / AI assistants- </XDSHeading>- <XDSText type="body" color="secondary" style={{marginBottom: 16}}>- Add the generated AGENTS.md to your project root. AI assistants like- Cursor, Copilot, and Claude will automatically use it as context when- you ask them to build UI with XDS components.- </XDSText>- <XDSCard padding={0}>- <XDSCodeBlock- code={`# Generate and save to project root\nxds docs > AGENTS.md\n\n# Or use the CLI bootstrap commands\nxds help # discover all commands\nxds component --list # all components by category\nxds template --list # available page templates`}- title="Terminal"- language="bash"- hasCopyButton- />- </XDSCard>- </div>- </XDSSection>- );-}--function PublishingPage() {- return (- <XDSSection- maxWidth={960}- padding={8}- variant="transparent"- style={{marginInline: 'auto'}}>- <ResourceHeader- icon={HeartIcon}- title="Publishing"- description="Publish components, themes, and templates to Craft for others to discover and use."- bg="#FCE7F3"- />- <div>- <XDSHeading level={2} style={{marginBottom: 16}}>- What you can publish- </XDSHeading>- <div- style={{- display: 'grid',- gridTemplateColumns: 'repeat(3, 1fr)',- gap: 12,- }}>- {[- {- icon: CodeIcon,- title: 'Components',- desc: 'Build and publish custom components to the Craft library for others to use.',- },- {- icon: PaletteIcon,- title: 'Themes',- desc: 'Create and share theme packages with custom colors, typography, and radius.',- },- {- icon: GridIcon,- title: 'Templates',- desc: 'Publish page templates and layouts that others can browse and use in Craft.',- },- ].map(item => (- <XDSCard key={item.title} padding={4}>- <XDSStack direction="horizontal" gap={3}>- <div- style={{- width: 36,- height: 36,- borderRadius: 10,- backgroundColor:- 'var(--color-background-accent-muted, #DBEAFE)',- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- flexShrink: 0,- }}>- <XDSIcon icon={item.icon} size="sm" color="accent" />- </div>- <XDSStack direction="vertical" gap={0}>- <XDSText type="body" weight="bold">- {item.title}- </XDSText>- <XDSText type="supporting" color="secondary">- {item.desc}- </XDSText>- </XDSStack>- </XDSStack>- </XDSCard>- ))}- </div>- </div>- <div style={{marginTop: 40}}>- <XDSHeading level={2} style={{marginBottom: 16}}>- Getting started- </XDSHeading>- <XDSCard padding={0}>- <XDSCodeBlock- code={`# Clone the repo\ngit clone https://github.com/facebookexperimental/xds.git\ncd xds\n\n# Install dependencies\npnpm install\n\n# Start the sandbox\npnpm -F @xds/sandbox dev\n\n# Run tests\npnpm test\n\n# Run storybook\npnpm storybook`}- title="Terminal"- language="bash"- hasCopyButton- />- </XDSCard>- </div>- <div style={{marginTop: 40}}>- <XDSHeading level={2} style={{marginBottom: 16}}>- Publishing guidelines- </XDSHeading>- <XDSList density="spacious" listStyle="disc">- <XDSListItem label="Use only XDS components — no raw HTML or inline styles" />- <XDSListItem label="Include a .doc.mjs file with a description, tags, and preview metadata" />- <XDSListItem label="Templates should use XDSAppShell for page layout" />- <XDSListItem label="Themes must define all required tokens (colors, typography, radius, elevation)" />- <XDSListItem label="Add block examples that demonstrate your component in realistic contexts" />- </XDSList>- </div>- </XDSSection>- );-}--function ResourcePage({resourceKey}: {resourceKey: string}) {- if (resourceKey === 'res-npm') {- return <NpmPackagesPage />;- }- if (resourceKey === 'res-agent-docs') {- return <AgentDocsPage />;- }- if (resourceKey === 'res-publishing') {- return <PublishingPage />;- }- return null;-}--// ----------------------------------------------------------------------------// GettingStartedPage component-// -----------------------------------------------------------------------------const INSTALL_CODE = `# Install XDS and a theme-npm install @xds/core @xds/theme-default`;--const PROVIDER_CODE = `// app/globals.css-@import "@xds/core/reset.css";-@import "@xds/theme-default/theme.css";--// app/providers.tsx-import Link from 'next/link';-import {XDSTheme} from '@xds/core/theme';-import {XDSLinkProvider} from '@xds/core/Link';-import {defaultTheme} from '@xds/theme-default/built';--export function Providers({children}: {children: React.ReactNode}) {- return (- <XDSTheme theme={defaultTheme}>- <XDSLinkProvider component={Link}>{children}</XDSLinkProvider>- </XDSTheme>- );-}`;--const FIRST_COMPONENT_CODE = `import {XDSButton} from '@xds/core/Button';-import {XDSStack} from '@xds/core/Layout';-import {XDSHeading, XDSText} from '@xds/core/Text';--export function WelcomeCard() {- return (- <XDSStack direction="vertical" gap={4}>- <XDSHeading level={1}>Welcome</XDSHeading>- <XDSText type="body">- You're ready to build with XDS.- </XDSText>- <XDSButton- label="Get started"- variant="primary"- onClick={() => console.log('clicked')}- />- </XDSStack>- );-}`;--const THEME_CODE = `# Install a different theme-npm install @xds/theme-neutral--# Available themes:-# @xds/theme-default — Clean, professional (Heroicons)-# @xds/theme-neutral — Muted, minimal (Lucide)-`;--const CLI_CODE = `# Install the CLI as a dev dependency-npm install -D @xds/cli--# Initialize XDS in your project-npx xds init--# Look up component docs-npx xds component Button--# Generate a page template-npx xds template dashboard--# Eject a component for customization-npx xds swizzle Button--# Load agent docs for AI assistants-npx xds docs`;--const GETTING_STARTED_STEPS: {- step: string;- title: string;- description: string;- code: string;- codeLabel?: string;- language: string;-}[] = [- {- step: '01',- title: 'Install XDS',- description:- 'Add @xds/core and a theme to your project. XDS works with Next.js, Vite, or any React framework.',- code: INSTALL_CODE,- codeLabel: 'Terminal',- language: 'bash',- },- {- step: '02',- title: 'Set up styles and theme',- description:- 'Import the CSS reset, component styles, and theme, then wrap your app in XDSTheme with a link provider. This provides design tokens — colors, typography, spacing, and radius — that all components inherit.',- code: PROVIDER_CODE,- codeLabel: 'app/globals.css + app/providers.tsx',- language: 'tsx',- },- {- step: '03',- title: 'Use a component',- description:- 'Import any component from its subpath. Only the components you use are included in your bundle.',- code: FIRST_COMPONENT_CODE,- codeLabel: 'app/page.tsx',- language: 'tsx',- },- {- step: '04',- title: 'Pick a theme',- description:- 'Swap the entire look and feel by installing a different theme package. Colors, typography, radius, and elevation all update automatically.',- code: THEME_CODE,- codeLabel: 'Terminal',- language: 'bash',- },- {- step: '05',- title: 'Use the CLI',- description:- 'The XDS CLI generates page templates, ejects components for customization, and produces structured docs that AI coding assistants can use as context.',- code: CLI_CODE,- codeLabel: 'Terminal',- language: 'bash',- },-];--function GettingStartedPage() {- return (- <XDSSection- maxWidth={960}- padding={8}- variant="transparent"- style={{marginInline: 'auto'}}>- <XDSStack direction="vertical" gap={2}>- <XDSText type="display-1">Getting Started</XDSText>- <XDSText type="large" weight="normal" color="secondary">- Go from zero to a working XDS app in five steps.- </XDSText>- </XDSStack>-- <XDSStack direction="vertical" gap={10} style={{marginTop: 48}}>- {GETTING_STARTED_STEPS.map(item => (- <XDSStack key={item.step} direction="vertical" gap={2}>- <XDSText- type="code"- color="secondary"- weight="semibold"- size="xsm"- style={{letterSpacing: '0.06em'}}>- STEP {item.step}- </XDSText>- <XDSHeading level={2}>{item.title}</XDSHeading>- <XDSText type="body" color="secondary" style={{maxWidth: 600}}>- {item.description}- </XDSText>- <XDSCard padding={0}>- <XDSCodeBlock- code={item.code}- title={item.codeLabel}- language={item.language}- hasCopyButton- />- </XDSCard>- </XDSStack>- ))}- </XDSStack>- </XDSSection>- );-}--// ----------------------------------------------------------------------------// LibraryOverview component-// -----------------------------------------------------------------------------function LibraryOverview({- onGetStarted,- onSelectComponent,- onCraft,-}: {- onGetStarted: () => void;- onSelectComponent: (key: string) => void;- onCraft: () => void;-}) {- const [packageFilter, setPackageFilter] = useState<PackageCategory | 'all'>(- 'all',- );- const filteredPackages =- packageFilter === 'all'- ? LIBRARY_PACKAGES- : LIBRARY_PACKAGES.filter(pkg => pkg.category === packageFilter);- return (- <XDSSection- maxWidth={960}- padding={8}- variant="transparent"- style={{marginInline: 'auto'}}>- {/* ── Section 1: Hero ── */}- <div- style={{- marginBottom: 64,- backgroundImage: `url(${basePath}/docsite/hero-bg.png)`,- backgroundSize: 'cover',- backgroundPosition: 'center',- borderRadius: 24,- padding: '64px 60px',- display: 'flex',- alignItems: 'center',- gap: 48,- overflow: 'hidden',- aspectRatio: '1513 / 657',- }}>- <XDSStack- direction="vertical"- gap={0}- hAlign="center"- style={{flex: 1, minWidth: 0, textAlign: 'center'}}>- <XDSText type="display-1" style={{fontSize: '3.25rem'}}>- XDS OSS- <br />- Build with AI- </XDSText>- <XDSText- type="body"- color="secondary"- style={{marginTop: 12, maxWidth: 480}}>- An open-source design system- <br />- for building Nest products and external apps.- </XDSText>- <XDSStack direction="horizontal" gap={3} style={{marginTop: 28}}>- <XDSButton- label="Get started"- variant="primary"- size="lg"- onClick={onGetStarted}- style={{width: 180}}- />- <XDSButton- label="Find inspiration"- variant="secondary"- size="lg"- onClick={onCraft}- style={{width: 180}}- />- </XDSStack>- </XDSStack>- </div>-- {/* ── Section 2: Foundations ── */}- <XDSStack direction="vertical" gap={0} style={{marginBottom: 64}}>- <XDSHeading level={2}>Foundations</XDSHeading>- <XDSText- type="body"- color="secondary"- style={{marginTop: 8, marginBottom: 24}}>- The design tokens and primitives that every component is built on.- </XDSText>- <XDSGrid columns={3} gap={4} style={{rowGap: 32}}>- {FOUNDATION_ITEMS.map(item => (- <div- key={item.key}- onClick={() => onSelectComponent(item.key)}- style={{cursor: 'pointer'}}>- <img- src={item.image}- alt={item.title}- style={{- display: 'block',- width: '100%',- aspectRatio: '16 / 9',- objectFit: 'cover',- borderRadius: 12,- marginBottom: 12,- }}- />- <XDSText- type="body"- weight="bold"- style={{display: 'block', marginBottom: 4}}>- {item.title}- </XDSText>- <XDSText type="supporting" color="secondary">- {item.description}- </XDSText>- </div>- ))}- </XDSGrid>- </XDSStack>-- {/* ── Section 3: Libraries & Packages ── */}- <XDSStack direction="vertical" gap={0} style={{marginBottom: 64}}>- <XDSHeading level={2}>Libraries & Packages</XDSHeading>- <XDSText- type="body"- color="secondary"- style={{marginTop: 8, marginBottom: 24}}>- Install what you need. All packages are published to npm under the{' '}- <XDSText- type="body"- color="secondary"- style={{fontFamily: 'monospace'}}>- @xds- </XDSText>{' '}- scope.- </XDSText>-- <XDSTabList- value={packageFilter}- onChange={v => setPackageFilter(v as PackageCategory | 'all')}- size="sm"- style={{marginBottom: 24}}>- {PACKAGE_FILTERS.map(filter => (- <XDSTab- key={filter.value}- value={filter.value}- label={filter.label}- />- ))}- </XDSTabList>- <XDSGrid columns={4} gap={4}>- {filteredPackages.map(pkg => {- const ICON_MAP: Record<- string,- React.ComponentType<React.SVGProps<SVGSVGElement>>- > = {- core: CodeIcon,- charts: ChartsIcon,- chat: ChatIcon,- cli: TerminalIcon,- };- const IconComp = ICON_MAP[pkg.iconType];- return (- <div- key={pkg.key}- onClick={- pkg.href- ? () => window.open(pkg.href, '_blank')- : () => onSelectComponent(pkg.key)- }- style={{cursor: 'pointer'}}>- <div- style={{- aspectRatio: '16 / 9',- backgroundImage: `url(${pkg.image})`,- backgroundSize: 'cover',- backgroundPosition: 'center',- borderRadius: 12,- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- position: 'relative',- marginBottom: 12,- }}>- {IconComp && (- <XDSIcon- icon={IconComp}- size="lg"- style={{- width: 48,- height: 48,- color: '#484233',- strokeWidth: 1.8,- }}- />- )}- {pkg.status === 'Coming Soon' && (- <div style={{position: 'absolute', top: 12, right: 12}}>- <XDSBadge label="Coming Soon" variant="blue" />- </div>- )}- </div>- <XDSText- type="body"- weight="bold"- style={{- fontFamily:- pkg.category !== 'designing' ? 'monospace' : undefined,- fontSize: 14,- display: 'block',- marginBottom: 4,- }}>- {pkg.name}- {pkg.version && (- <XDSText- type="supporting"- color="secondary"- style={{- fontFamily: 'monospace',- fontSize: 12,- marginLeft: 8,- }}>- v{pkg.version}- </XDSText>- )}- </XDSText>- <XDSText type="supporting" color="secondary">- {pkg.description}- </XDSText>- </div>- );- })}- </XDSGrid>- </XDSStack>-- {/* ── Section 4: Where to use XDS ── */}- <XDSStack direction="vertical" gap={0} style={{marginBottom: 64}}>- <XDSHeading level={2}>Where to use XDS</XDSHeading>- <XDSText- type="body"- color="secondary"- style={{marginTop: 8, marginBottom: 24, maxWidth: 680}}>- XDS is available in three contexts. Choose the right one based on- where you're building.- </XDSText>- <XDSGrid columns={3} gap={4}>- {XDS_OFFERINGS.map(offering => (- <XDSCard key={offering.title} padding={6} style={{height: '100%'}}>- <XDSStack direction="vertical" gap={0} style={{height: '100%'}}>- {offering.icons?.length || offering.logos?.length ? (- <XDSStack- direction="horizontal"- gap={2}- vAlign="center"- style={{marginBottom: 24}}>- {offering.icons?.map((IconComp, idx) => (- <IconComp key={idx} width={28} height={28} />- ))}- {offering.logos?.map((src, idx) => (- <img- key={idx}- src={src}- alt=""- width={28}- height={28}- style={{objectFit: 'contain'}}- />- ))}- </XDSStack>- ) : null}- {(offering.pkg || offering.label) && (- <XDSText- type="supporting"- color="secondary"- style={{- fontFamily: offering.pkg ? 'monospace' : 'inherit',- fontStyle:- offering.label && !offering.pkg ? 'italic' : undefined,- marginBottom: 8,- }}>- {offering.pkg ?? offering.label}- </XDSText>- )}- <XDSText type="display-2" style={{marginBottom: 4}}>- {offering.title}- </XDSText>- <XDSText- type="supporting"- color="secondary"- style={{marginBottom: 16}}>- {offering.subtitle}- </XDSText>- <XDSText type="supporting" color="secondary">- {offering.descriptionLinkText && offering.descriptionLinkHref- ? (() => {- const idx = offering.description.lastIndexOf(- offering.descriptionLinkText,- );- if (idx === -1) {- return offering.description;- }- return (- <>- {offering.description.slice(0, idx)}- <XDSLink- href={offering.descriptionLinkHref}- type="supporting"- color="secondary"- hasUnderline>- {offering.descriptionLinkText}- </XDSLink>- {offering.description.slice(- idx + offering.descriptionLinkText.length,- )}- </>- );- })()- : offering.description}- </XDSText>- </XDSStack>- </XDSCard>- ))}- </XDSGrid>- </XDSStack>-- {/* ── Section 5: Have a question? ── */}- <XDSStack- direction="vertical"- gap={3}- hAlign="center"- style={{marginBottom: 64, textAlign: 'center'}}>- <XDSText type="display-1">Need help?</XDSText>- <XDSText type="body" color="secondary">- Ask our AI assistant first — it knows the docs better than we do.- </XDSText>- <div- style={{- width: '100%',- maxWidth: 560,- marginTop: 16,- marginBottom: 16,- textAlign: 'left',- }}>- <XDSChatComposer- onSubmit={() => {}}- placeholder="Ask a question about XDS..."- density="compact"- />- </div>- <XDSText type="supporting" color="secondary">- Prefer a human? Open an issue on{' '}- <XDSLink- href="https://github.com/facebookexperimental/xds/issues"- color="secondary"- type="supporting">- GitHub- </XDSLink>- </XDSText>- </XDSStack>- <div style={{height: 100}} />- </XDSSection>- );-}--// ----------------------------------------------------------------------------// XDS wordmark SVG-// -----------------------------------------------------------------------------const XDS_WORDMARK = (- <svg- width="46"- height="24"- viewBox="0 0 46 24"- fill="none"- xmlns="http://www.w3.org/2000/svg">- <path- d="M2.4239 15.8011C2.03945 16.3796 1.66972 16.9538 1.3147 17.524C0.707427 18.4992 1.42354 19.7348 2.57241 19.7348C3.13302 19.7348 3.64463 19.4209 3.91525 18.93C4.29391 18.243 4.71274 17.5352 5.17173 16.8066C5.38894 16.4618 5.60743 16.12 5.82721 15.7812C6.25251 15.1254 6.46516 14.7976 6.76252 14.68C6.99255 14.5891 7.27368 14.5899 7.50317 14.6822C7.79984 14.8014 8.00881 15.1278 8.42675 15.7804C8.64287 16.1179 8.85732 16.46 9.07008 16.8066C9.52175 17.534 9.93823 18.2339 10.3195 18.9063C10.6075 19.4141 11.1428 19.7348 11.7266 19.7348C12.9476 19.7348 13.7063 18.4203 13.0547 17.3877C12.7332 16.8781 12.3991 16.3639 12.0525 15.8453C11.3983 14.8527 10.7379 13.8906 10.0714 12.9592C9.81687 12.6036 9.68962 12.4258 9.64377 12.2384C9.60589 12.0836 9.60492 11.9307 9.64085 11.7754C9.68435 11.5874 9.80856 11.4091 10.057 11.0526C10.7093 10.1164 11.3596 9.15781 12.0078 8.1768C12.3869 7.60474 12.7521 7.03681 13.1035 6.47298C13.71 5.49987 12.9962 4.26519 11.8496 4.26519C11.2943 4.26519 10.7868 4.57405 10.5169 5.05923C10.1399 5.73688 9.72461 6.43721 9.27114 7.16022C9.06143 7.49458 8.8505 7.82569 8.63835 8.15358C8.21478 8.80819 8.003 9.1355 7.70554 9.25334C7.47561 9.34442 7.19397 9.34375 6.96448 9.25156C6.66759 9.13229 6.45853 8.80578 6.04043 8.15276C5.83116 7.82591 5.62351 7.49506 5.41747 7.16022C4.97918 6.44793 4.5738 5.76096 4.20132 5.0993C3.9136 4.58821 3.37617 4.26519 2.78967 4.26519C1.56624 4.26519 0.805692 5.58299 1.45419 6.62041C1.76588 7.11903 2.08912 7.6231 2.4239 8.1326C3.0752 9.10994 3.73263 10.059 4.3962 10.9796C4.65373 11.337 4.7825 11.5156 4.82882 11.7042C4.86709 11.86 4.86797 12.0139 4.83149 12.1702C4.78732 12.3593 4.66122 12.5385 4.40903 12.897C3.74526 13.8406 3.08355 14.8086 2.4239 15.8011Z"- fill="currentColor"- />- <path- fillRule="evenodd"- clipRule="evenodd"- d="M22.4734 4.26519C20.4471 4.26519 19.434 4.26519 18.6657 4.67201C18.0456 5.00031 17.5385 5.50739 17.2102 6.12744C16.8034 6.89579 16.8034 7.90892 16.8034 9.9352V14.0648C16.8034 16.0911 16.8034 17.1042 17.2102 17.8726C17.5385 18.4926 18.0456 18.9997 18.6657 19.328C19.434 19.7348 20.4471 19.7348 22.4734 19.7348H23.2039C24.8496 19.7348 26.2644 19.4033 27.4485 18.7403C28.6399 18.07 29.5559 17.1529 30.1963 15.989C30.8367 14.825 31.1569 13.4954 31.1569 12C31.1569 10.5046 30.8367 9.17495 30.1963 8.01105C29.5559 6.84714 28.6399 5.9337 27.4485 5.27072C26.2644 4.60037 24.8496 4.26519 23.2039 4.26519H22.4734ZM20.0092 8.74707C20.0092 8.16814 20.0092 7.87867 20.1255 7.65914C20.2193 7.48198 20.3641 7.33711 20.5413 7.24331C20.7608 7.12707 21.0503 7.12707 21.6292 7.12707H23.1927C24.6522 7.12707 25.7916 7.57274 26.6107 8.46409C27.4299 9.34807 27.8394 10.5267 27.8394 12C27.8394 13.4659 27.4299 14.6446 26.6107 15.5359C25.7916 16.4273 24.6522 16.8729 23.1927 16.8729H21.6292C21.0503 16.8729 20.7608 16.8729 20.5413 16.7567C20.3641 16.6629 20.2193 16.518 20.1255 16.3409C20.0092 16.1213 20.0092 15.8319 20.0092 15.2529V8.74707Z"- fill="currentColor"- />- <path- d="M35.4666 19.2376C36.6134 19.7459 37.9501 20 39.4767 20H39.8006C41.7144 20 43.2261 19.5801 44.3357 18.7403C45.4452 17.9006 46 16.7403 46 15.2597C46 14.3757 45.8213 13.6501 45.4638 13.0829C45.1064 12.5083 44.6559 12.0589 44.1123 11.7348C43.5761 11.4033 43.0325 11.1565 42.4814 10.9945C41.9304 10.8324 41.4575 10.7145 41.0628 10.6409L38.706 10.1878C38.0283 10.0552 37.4698 9.87477 37.0305 9.64641C36.5985 9.41068 36.3826 9.02762 36.3826 8.49724C36.3826 7.96685 36.6395 7.55064 37.1533 7.24862C37.6671 6.93923 38.3857 6.78453 39.3091 6.78453H39.6219C40.3964 6.78453 41.1224 6.93186 41.8001 7.22652C42.0982 7.35474 42.3899 7.5234 42.6754 7.73251C43.326 8.20923 44.2444 8.27802 44.8243 7.71734C45.34 7.21868 45.4053 6.39786 44.8761 5.91349C44.3498 5.43171 43.7638 5.03698 43.1181 4.72928C42.1054 4.24309 40.9511 4 39.6554 4H39.3315C38.0953 4 37.0156 4.19521 36.0922 4.58564C35.1762 4.97606 34.4613 5.52486 33.9475 6.23204C33.4411 6.93186 33.188 7.76059 33.188 8.71823C33.188 9.49171 33.3406 10.1436 33.6459 10.674C33.9587 11.2044 34.3571 11.6354 34.8411 11.9669C35.3326 12.2983 35.8539 12.5599 36.4049 12.7514C36.956 12.9355 37.4698 13.0718 37.9464 13.1602L40.3033 13.6243C40.6905 13.698 41.074 13.8011 41.4538 13.9337C41.841 14.0589 42.1612 14.2431 42.4144 14.4862C42.6676 14.7293 42.7942 15.0608 42.7942 15.4807C42.7942 16.6151 41.7814 17.1823 39.7559 17.1823H39.4432C38.49 17.1823 37.615 17.0055 36.8182 16.6519C36.4847 16.4994 36.1665 16.3134 35.8635 16.0938C35.17 15.5911 34.1857 15.5241 33.5784 16.1282C33.0651 16.6388 32.9912 17.4631 33.5198 17.9578C34.0797 18.4818 34.7287 18.9083 35.4666 19.2376Z"- fill="currentColor"- />- </svg>-);--// ----------------------------------------------------------------------------// ComponentDetailPage — documentation-design template style-// -----------------------------------------------------------------------------function ComponentDetailPage({- activeNav,- onCraft,-}: {- activeNav: string;- onCraft: () => void;-}) {- const [exampleTabs, setExampleTabs] = useState<Record<string, string>>({});- const componentName = getComponentName(activeNav);- const desc = getComponentDesc(activeNav);-- const bestPractices = [- {- type: 'do' as const,- text: `Use ${componentName} in the appropriate context to provide the functionality described above.`,- },- {- type: 'do' as const,- text: `Pair ${componentName} with related components to create cohesive, accessible interfaces.`,- },- {- type: 'dont' as const,- text: `Use ${componentName} when a simpler alternative achieves the same goal with less complexity.`,- },- ];-- const examples = [- {- title: `Basic ${componentName}`,- description: `A simple example of the ${componentName} component with default settings.`,- code: `<XDS${componentName} />`,- },- ];-- return (- <XDSSection- maxWidth={960}- padding={8}- variant="transparent"- style={{marginInline: 'auto'}}>- <XDSStack direction="vertical" gap={8}>- {/* Header */}- <XDSStack direction="vertical" gap={2}>- <XDSText type="display-1">{componentName}</XDSText>- <XDSText type="supporting" color="secondary">- March 30, 2026 · Updated 5:40 p.m. PST- </XDSText>- </XDSStack>-- <XDSDivider />-- {/* Preview */}- <XDSCard variant="muted" padding={0}>- <XDSCenter height={360}>- {COMPONENT_PREVIEWS[activeNav] ?? (- <XDSText type="supporting" color="secondary">- Preview coming soon- </XDSText>- )}- </XDSCenter>- </XDSCard>-- {/* Usage + Best Practices */}- <XDSStack direction="vertical" gap={4}>- <XDSHeading level={2}>Usage</XDSHeading>- <XDSText type="large" weight="normal">- {desc}- </XDSText>- <XDSHeading level={3}>Best practices</XDSHeading>- <XDSTable- data={bestPractices as Record<string, unknown>[]}- columns={[- {- key: 'type',- header: 'Guidance',- width: pixel(125),- renderCell: (item: Record<string, unknown>) => (- <XDSBadge- label={item.type === 'do' ? 'Do' : 'Dont'}- variant={item.type === 'do' ? 'success' : 'error'}- />- ),- },- {- key: 'text',- header: 'Practices',- renderCell: (item: Record<string, unknown>) => (- <XDSText type="body" textWrap="wrap">- {item.text as string}- </XDSText>- ),- },- ]}- density="spacious"- dividers="rows"- />- </XDSStack>-- <XDSDivider />-- {/* Examples */}- <XDSStack direction="vertical" gap={4}>- <XDSHeading level={2}>Examples</XDSHeading>- <XDSText type="large" weight="normal">- Explore common configurations, variations, and states for this- component.- </XDSText>- </XDSStack>- <XDSStack direction="vertical" gap={8}>- {examples.map((example, i) => {- const tabKey = `${activeNav}-${i}`;- const activeTab = exampleTabs[tabKey] ?? 'description';- return (- <XDSCard key={i} padding={0}>- <XDSSection padding={3} variant="transparent">- <XDSStack direction="horizontal" gap={3} vAlign="center">- <div style={{flex: 1}}>- <XDSText type="body" weight="medium">- {example.title}- </XDSText>- </div>- <XDSStack direction="horizontal" gap={1} vAlign="center">- <XDSButton- label="Open in Craft"- variant="ghost"- size="sm"- icon={<ExternalLinkIcon />}- onClick={onCraft}- />- <XDSIconButton- label="Fullscreen"- variant="ghost"- size="sm"- icon={<XDSIcon icon={FullscreenIcon} />}- />- </XDSStack>- </XDSStack>- </XDSSection>- <XDSCenter height={280}>- {COMPONENT_PREVIEWS[activeNav] ?? (- <XDSText type="supporting" color="secondary">- Preview coming soon- </XDSText>- )}- </XDSCenter>- <XDSSection variant="muted" padding={3} dividers={['top']}>- <XDSStack direction="vertical" gap={3}>- <XDSTabList- value={activeTab}- onChange={value =>- setExampleTabs(prev => ({- ...prev,- [tabKey]: value,- }))- }- size="sm"- xstyle={localStyles.tabListFlush}>- <XDSTab value="description" label="Description" />- <XDSTab value="code" label="Code" />- </XDSTabList>- {activeTab === 'description' ? (- <XDSText type="body">{example.description}</XDSText>- ) : (- <XDSCodeBlock code={example.code} language="tsx" />- )}- </XDSStack>- </XDSSection>- </XDSCard>- );- })}- </XDSStack>- </XDSStack>- </XDSSection>- );-}--export function DocsView({- setActiveView,- selectedComponent,- onComponentChange,-}: {- setActiveView: (- v: 'craft' | 'explore' | 'docs' | 'profile' | 'theme',- ) => void;- selectedComponent: string | null;- onComponentChange: (key: string | null) => void;-}) {- const [activeNav, setActiveNav] = useState(selectedComponent ?? 'button');- const [_showCode, _setShowCode] = useState(true);- const [_activeRightNav, _setActiveRightNav] = useState('usage');- const [isSearchOpen, setIsSearchOpen] = useState(false);-- useEffect(() => {- if (selectedComponent !== null) {- setActiveNav(selectedComponent);- }- }, [selectedComponent]);-- const headingMenu = (- <>- <XDSNavMenuItem label="Craft" onClick={() => setActiveView('craft')} />- <XDSNavMenuItem label="Library" onClick={() => setActiveView('docs')} />- </>- );-- return (- <>- <XDSAppShell- variant="surface"- height="fill"- mobileNav={{breakpoint: 'none'}}- topNav={- <XDSTopNav- label="XDS navigation"- style={{paddingLeft: 16, paddingRight: 24}}- heading={- <XDSTopNavHeading- logo={XDS_WORDMARK}- headingHref={`${basePath}/pages/docsite/`}- menu={headingMenu}- />- }- endContent={- <XDSStack direction="horizontal" gap={2}>- <XDSButton- label="Search"- variant="ghost"- isIconOnly- icon={<SearchIcon />}- onClick={() => setIsSearchOpen(true)}- />- <XDSButton- label="Profile"- variant="ghost"- isIconOnly- icon={<ProfileIcon />}- onClick={() => setActiveView('profile')}- />- </XDSStack>- }- />- }- sideNav={- <XDSSideNav style={{paddingLeft: 8}}>- <XDSSideNavSection title="Home" isHeaderHidden>- <XDSSideNavItem- label="Home"- isSelected={selectedComponent === null}- onClick={() => onComponentChange(null)}- />- </XDSSideNavSection>- <XDSSideNavSection title="Overview" isHeaderHidden>- <XDSSideNavItem label="Guide" collapsible>- <XDSSideNavItem- label="Getting Started"- isSelected={- selectedComponent !== null &&- activeNav === 'getting-started'- }- onClick={() => {- onComponentChange('getting-started');- setActiveNav('getting-started');- }}- />- <XDSSideNavItem- label="What's New"- isSelected={selectedComponent === 'whats-new'}- onClick={() => {- onComponentChange('whats-new');- setActiveNav('whats-new');- }}- />- <XDSSideNavItem label="Foundations" collapsible>- {FOUNDATION_ITEMS.map(item => (- <XDSSideNavItem- key={item.key}- label={item.title}- isSelected={- selectedComponent !== null && activeNav === item.key- }- onClick={() => {- onComponentChange(item.key);- setActiveNav(item.key);- }}- />- ))}- </XDSSideNavItem>- <XDSSideNavItem label="Libraries" collapsible>- {LIBRARY_PACKAGES.filter(pkg => !pkg.href).map(pkg => (- <XDSSideNavItem- key={pkg.key}- label={pkg.name}- isSelected={- selectedComponent !== null && activeNav === pkg.key- }- onClick={() => {- onComponentChange(pkg.key);- setActiveNav(pkg.key);- }}- />- ))}- </XDSSideNavItem>- </XDSSideNavItem>- </XDSSideNavSection>-- {COMPONENT_CATEGORIES.map(category => (- <XDSSideNavSection key={category.label} title={category.label}>- {category.items.map(item => (- <XDSSideNavItem- key={item.key}- label={item.name}- isSelected={- selectedComponent !== null && activeNav === item.key- }- onClick={() => {- onComponentChange(item.key);- setActiveNav(item.key);- }}- />- ))}- </XDSSideNavSection>- ))}- </XDSSideNav>- }>- {/* MAIN CONTENT */}- {selectedComponent === null ? (- <LibraryOverview- onGetStarted={() => {- onComponentChange('getting-started');- setActiveNav('getting-started');- }}- onSelectComponent={(key: string) => {- onComponentChange(key);- setActiveNav(key);- }}- onCraft={() => setActiveView('craft')}- />- ) : selectedComponent === 'whats-new' ? (- <WhatsNewPage />- ) : selectedComponent === 'getting-started' ? (- <GettingStartedPage />- ) : FOUNDATION_ITEMS.some(f => f.key === selectedComponent) ? (- <FoundationPage foundationKey={selectedComponent} />- ) : LIBRARY_PACKAGES.some(p => p.key === selectedComponent) ? (- <LibraryPackagePage- packageKey={selectedComponent}- onSelectComponent={(key: string) => {- onComponentChange(key);- setActiveNav(key);- }}- onCraft={() => setActiveView('craft')}- />- ) : RESOURCE_NAV_ITEMS.some(r => r.key === selectedComponent) ? (- <ResourcePage resourceKey={selectedComponent} />- ) : (- <ComponentDetailPage- activeNav={activeNav}- onCraft={() => setActiveView('craft')}- />- )}- </XDSAppShell>-- <XDSCommandPalette- isOpen={isSearchOpen}- onOpenChange={setIsSearchOpen}- searchSource={SEARCH_COMMANDS}- label="Search templates and components"- />- </>- );-}diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/InlinePublishPanel.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/InlinePublishPanel.tsxdeleted file mode 100644index c5f59a25b4..0000000000--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/InlinePublishPanel.tsx+++ /dev/null@@ -1,132 +0,0 @@-// Copyright (c) Meta Platforms, Inc. and affiliates.--'use client';--import React, {useState} from 'react';-import {XDSButton} from '@xds/core/Button';-import {XDSLink} from '@xds/core/Link';-import {XDSHeading, XDSText} from '@xds/core/Text';-import {XDSTextInput} from '@xds/core/TextInput';-import {XDSTextArea} from '@xds/core/TextArea';-import {XDSTokenizer} from '@xds/core/Tokenizer';-import {createStaticSource} from '@xds/core/Typeahead';-import {PUBLISH_TAGS} from './constants';--// ----------------------------------------------------------------------------// InlinePublishPanel — publish flow rendered inline in the left panel-// -----------------------------------------------------------------------------export function InlinePublishPanel({- templateName,- isVisible: _isVisible,- onBack,- onPublish,-}: {- templateName: string;- isVisible: boolean;- onBack: () => void;- onPublish?: () => void;-}) {- const [name, setName] = useState(templateName);- const [description, setDescription] = useState('');- const [tags, setTags] = useState([] as {id: string; label: string}[]);- const tagSource = createStaticSource(- PUBLISH_TAGS.map(t => ({id: t, label: t})),- );-- return (- <>- <style>- {- '@keyframes publishFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }'- }- </style>- <div- style={{- display: 'flex',- flexDirection: 'column' as const,- gap: 20,- overflowY: 'auto' as const,- flex: 1,- margin: 16,- animation: 'publishFadeIn 400ms cubic-bezier(0.16, 1, 0.3, 1)',- }}>- {/* Header */}- <div- style={{display: 'flex', flexDirection: 'column' as const, gap: 8}}>- <XDSHeading level={2}>Publish to community</XDSHeading>- <XDSText type="body" color="secondary">- Share your work so others on the team can use it as a starting- point.- </XDSText>- </div>-- {/* Template name input */}- <XDSTextInput- label="Template name"- value={name}- onChange={v => setName(v)}- size="lg"- />-- {/* Description textarea */}- <XDSTextArea- label="Description"- placeholder="Describe what makes this template unique..."- value={description}- onChange={v => setDescription(v)}- rows={3}- />-- {/* Tags */}- <XDSTokenizer- label="Tags"- searchSource={tagSource}- value={tags}- onChange={items => setTags(items)}- placeholder="Add tags..."- hasEntriesOnFocus- hasCreate- size="md"- />-- {/* Publish / Cancel buttons */}- <div- style={{- display: 'flex',- flexDirection: 'column' as const,- gap: 8,- marginTop: 'auto',- }}>- <XDSText- type="supporting"- color="secondary"- style={{textAlign: 'center' as const}}>- Your template will go through a review process before appearing in- the community grid.{' '}- <XDSLink- label="Learn more"- href="#"- onClick={e => e.preventDefault()}>- Learn more- </XDSLink>- </XDSText>- <XDSButton- variant="primary"- label="Submit template"- size="lg"- onClick={onPublish}- style={{width: '100%'}}- />- <XDSButton- variant="secondary"- label="Go back to editing"- size="lg"- onClick={onBack}- style={{width: '100%'}}- />- </div>- </div>- </>- );-}diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/ProfileView.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/ProfileView.tsxdeleted file mode 100644index f3b63c8a26..0000000000--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/ProfileView.tsx+++ /dev/null@@ -1,2141 +0,0 @@-// Copyright (c) Meta Platforms, Inc. and affiliates.--'use client';--import {useState, useMemo, useCallback} from 'react';-import {XDSText, XDSHeading} from '@xds/core/Text';-import {XDSButton} from '@xds/core/Button';-import {XDSDialog, XDSDialogHeader} from '@xds/core/Dialog';-import {XDSTextInput} from '@xds/core/TextInput';-import {XDSTabList, XDSTab} from '@xds/core/TabList';-import {XDSHStack, XDSVStack, XDSStackItem} from '@xds/core/Layout';-import {XDSRadioList, XDSRadioListItem} from '@xds/core/RadioList';-import {XDSGrid} from '@xds/core/Grid';-import {XDSBadge} from '@xds/core/Badge';-import {XDSDropdownMenu} from '@xds/core/DropdownMenu';-import {XDSEmptyState} from '@xds/core/EmptyState';-import {XDSCard} from '@xds/core/Card';-import {XDSLink} from '@xds/core/Link';-import {XDSBanner} from '@xds/core/Banner';-import {XDSList, XDSListItem} from '@xds/core/List';-import {XDSSelector} from '@xds/core/Selector';-import {XDSCheckboxInput} from '@xds/core/CheckboxInput';-import {- XDSTable,- pixel,- proportional,- useXDSTableSortable,- useXDSTableSortableState,-} from '@xds/core/Table';-import type {XDSTableColumn} from '@xds/core/Table';-import {- PROFILE_CRAFT_ITEMS,- PROFILE_USED_ITEMS,- PROFILE_LIKED_ITEMS,- PROFILE_COLLECTIONS,- THEME_PICKER_ENTRIES,-} from './constants';-import {- SearchIcon,- BookmarkIcon,- BookmarkFilledIcon,- FolderIcon,-} from './docsite-icons';--import {TemplatePreviewModal} from './TemplatePreviewModal';-import {getComponentName, getComponentDocs} from './docsview-data';-import {COMPONENT_PREVIEWS} from './ComponentPreviews';-import {AppTopNav} from './AppTopNav';-import {- Cog6ToothIcon,- EllipsisHorizontalIcon,- PencilIcon,- DocumentDuplicateIcon,- TrashIcon,- ArrowUpTrayIcon,- ArrowLeftIcon,- EyeIcon,- CursorArrowRaysIcon,- ClockIcon,- PlusIcon,-} from '@heroicons/react/24/outline';--function timeAgo(dateStr: string): string {- const now = new Date();- const then = new Date(dateStr);- const diffMs = now.getTime() - then.getTime();- const days = Math.floor(diffMs / (1000 * 60 * 60 * 24));- if (days < 1) {- return 'today';- }- if (days < 7) {- return `${days}d ago`;- }- if (days < 30) {- return `${Math.floor(days / 7)}w ago`;- }- if (days < 365) {- return `${Math.floor(days / 30)}mo ago`;- }- return `${Math.floor(days / 365)}y ago`;-}--const STATUS_VARIANT: Record<- string,- 'success' | 'warning' | 'neutral' | 'error'-> = {- Published: 'success',- 'In Review': 'warning',- Draft: 'neutral',- 'Needs Fixes': 'error',-};--const TYPE_VARIANT: Record<string, 'blue' | 'purple' | 'teal'> = {- Template: 'blue',- Theme: 'purple',- Component: 'teal',-};--type CraftItem = (typeof PROFILE_CRAFT_ITEMS)[number] & Record<string, unknown>;--function makeCraftColumns(- onPreview: (item: CraftItem) => void,-): XDSTableColumn<CraftItem>[] {- return [- {- key: 'name',- header: 'Name',- width: proportional(3, {minWidth: 200}),- renderCell: item => (- <XDSHStack- gap={3}- vAlign="center"- style={{cursor: 'pointer'}}- onClick={() => onPreview(item)}>- <div- style={{- width: 80,- height: 52,- borderRadius: 8,- overflow: 'hidden',- flexShrink: 0,- backgroundColor: 'var(--color-background-muted, #f0f0f0)',- }}>- <img- src={item.img}- alt=""- style={{- width: '100%',- height: '100%',- objectFit: 'cover',- display: 'block',- }}- />- </div>- <XDSVStack gap={0}>- <XDSText type="body" style={{fontWeight: 600}}>- {item.name}- </XDSText>- <XDSText type="supporting" color="secondary">- {item.type}- </XDSText>- </XDSVStack>- </XDSHStack>- ),- },- {- key: 'status',- header: 'Status',- width: pixel(120),- sortable: true,- renderCell: item => (- <XDSBadge label={item.status} variant={STATUS_VARIANT[item.status]} />- ),- },- {- key: 'views',- header: 'Views',- width: pixel(100),- align: 'end',- sortable: true,- renderCell: item =>- item.status === 'Draft' ||- item.status === 'Needs Fixes' ||- item.status === 'In Review' ? (- <XDSText type="body" color="secondary">- —- </XDSText>- ) : (- <XDSText type="body" color="secondary">- {item.views.toLocaleString()}- </XDSText>- ),- },- {- key: 'used',- header: 'Uses',- width: pixel(80),- align: 'end',- sortable: true,- renderCell: item =>- item.status === 'Draft' ||- item.status === 'Needs Fixes' ||- item.status === 'In Review' ? (- <XDSText type="body" color="secondary">- —- </XDSText>- ) : (- <XDSText type="body" color="secondary">- {item.used.toLocaleString()}- </XDSText>- ),- },- {- key: 'lastUpdated',- header: 'Updated',- width: pixel(100),- sortable: true,- renderCell: item => (- <XDSText type="body" color="secondary">- {timeAgo(item.lastUpdated)}- </XDSText>- ),- },- {- key: 'actions',- header: '',- width: pixel(48),- renderCell: item => (- <div style={{position: 'relative'}}>- <XDSDropdownMenu- button={{- label: 'Actions',- variant: 'ghost',- size: 'sm',- isIconOnly: true,- icon: <EllipsisHorizontalIcon style={{width: 18, height: 18}} />,- }}- hasChevron={false}- items={[- {label: 'Edit', icon: PencilIcon, onClick: () => {}},- {- label: 'Duplicate',- icon: DocumentDuplicateIcon,- onClick: () => {},- },- {- label: item.status === 'Published' ? 'Unpublish' : 'Publish',- icon: ArrowUpTrayIcon,- onClick: () => {},- },- {type: 'divider' as const},- {label: 'Delete', icon: TrashIcon, onClick: () => {}},- ]}- />- </div>- ),- },- ];-}--type UsedItem = (typeof PROFILE_USED_ITEMS)[number] & Record<string, unknown>;--function makeUsedColumns(- onPreviewTemplate: (item: UsedItem) => void,- onOpenComponentDocs: (componentKey: string) => void,-): XDSTableColumn<UsedItem>[] {- return [- {- key: 'name',- header: 'Name',- width: proportional(3, {minWidth: 200}),- renderCell: item => (- <XDSHStack- gap={3}- vAlign="center"- style={{cursor: 'pointer'}}- onClick={() => {- if (item.type === 'Component') {- onOpenComponentDocs(item.name.toLowerCase().replace(/\s+/g, ''));- } else {- onPreviewTemplate(item);- }- }}>- <div- style={{- width: 80,- height: 52,- borderRadius: 8,- overflow: 'hidden',- flexShrink: 0,- backgroundColor: 'var(--color-background-muted, #f0f0f0)',- }}>- <img- src={item.img}- alt=""- style={{- width: '100%',- height: '100%',- objectFit: 'cover',- display: 'block',- }}- />- </div>- <XDSVStack gap={0.5} style={{minWidth: 0}}>- <XDSText type="body" style={{fontWeight: 600}}>- {item.name}- </XDSText>- <XDSText- type="supporting"- color="secondary"- style={{- overflow: 'hidden',- textOverflow: 'ellipsis',- whiteSpace: 'nowrap',- }}>- {item.description}- </XDSText>- </XDSVStack>- </XDSHStack>- ),- },- {- key: 'type',- header: 'Type',- width: pixel(120),- sortable: true,- renderCell: item => (- <XDSBadge label={item.type} variant={TYPE_VARIANT[item.type]} />- ),- },- {- key: 'usageCount',- header: 'Times Used',- width: pixel(100),- align: 'end',- sortable: true,- renderCell: item => (- <XDSText type="body" color="secondary">- {item.usageCount}- </XDSText>- ),- },- {- key: 'lastUsed',- header: 'Last Used',- width: pixel(100),- sortable: true,- renderCell: item => (- <XDSText type="body" color="secondary">- {timeAgo(item.lastUsed)}- </XDSText>- ),- },- ];-}--function BookmarkCard({- item,- index,- onRemove,- onClick,-}: {- item: (typeof PROFILE_LIKED_ITEMS)[number];- index: number;- onRemove: () => void;- onClick: () => void;-}) {- const [hovered, setHovered] = useState(false);- return (- <div- style={{- animation: `craftCardFadeIn 400ms ${index * 60}ms cubic-bezier(0.16, 1, 0.3, 1) both`,- }}>- <XDSCard padding={0}>- <div- style={{- position: 'relative',- cursor: 'pointer',- overflow: 'hidden',- }}- onMouseEnter={() => setHovered(true)}- onMouseLeave={() => setHovered(false)}- onClick={onClick}>- <img- src={item.img}- alt={item.name}- style={{- display: 'block',- width: '100%',- aspectRatio: '1920 / 1205',- objectFit: 'cover',- objectPosition: 'top',- }}- />- <div- style={{- position: 'absolute',- inset: 0,- backgroundColor: 'var(--color-overlay, rgba(0,0,0,0.5))',- opacity: hovered ? 1 : 0,- transition: 'opacity 300ms ease',- }}>- {/* Top-right: remove bookmark */}- <div- style={{- position: 'absolute',- top: 12,- right: 12,- }}- onClick={e => e.stopPropagation()}>- <XDSButton- label="Remove bookmark"- variant="ghost"- size="sm"- isIconOnly- icon={<BookmarkFilledIcon style={{width: 16, height: 16}} />}- style={{color: '#fff'}}- onClick={onRemove}- />- </div>- {/* Bottom: info + actions */}- <div- onClick={e => e.stopPropagation()}- style={{- position: 'absolute',- bottom: 0,- left: 0,- right: 0,- padding: 16,- background:- 'linear-gradient(to top, rgba(0,0,0,0.6), transparent)',- display: 'flex',- alignItems: 'flex-end',- justifyContent: 'space-between',- }}>- <XDSVStack gap={0}>- <XDSHeading level={3} style={{color: '#fff'}}>- {item.name}- </XDSHeading>- <XDSText- type="supporting"- style={{color: 'rgba(255,255,255,0.7)'}}>- {item.type} · Bookmarked {timeAgo(item.bookmarkedAt)}- </XDSText>- </XDSVStack>- <XDSHStack gap={2} style={{flexShrink: 0}}>- <XDSButton- label="Use"- variant="secondary"- size="sm"- style={{backgroundColor: 'var(--color-background-surface)'}}- onClick={() => {}}- />- <XDSButton- label="Craft"- variant="secondary"- size="sm"- style={{backgroundColor: 'var(--color-background-surface)'}}- onClick={() => {}}- />- </XDSHStack>- </div>- </div>- </div>- </XDSCard>- </div>- );-}--function PreviewDialogShell({- isOpen,- onClose,- imgSrc,- imgAlt,- children,-}: {- isOpen: boolean;- onClose: () => void;- imgSrc: string;- imgAlt: string;- children: React.ReactNode;-}) {- return (- <XDSDialog- isOpen={isOpen}- onOpenChange={open => {- if (!open) {- onClose();- }- }}- width="90vw"- maxHeight="90vh"- purpose="info"- style={- {- padding: 0,- overflow: 'visible',- maxWidth: 1600,- '--xds-dialog-padding': '0px',- } satisfies React.CSSProperties- }>- {isOpen && (- <>- <div style={{position: 'absolute', top: 0, right: -40, zIndex: 1}}>- <XDSCard padding={0} style={{borderRadius: '50%'}}>- <XDSButton- label="Close"- variant="ghost"- size="sm"- isIconOnly- icon={<span style={{fontSize: 16, lineHeight: 1}}>✕</span>}- onClick={onClose}- />- </XDSCard>- </div>- <div style={{overflowY: 'auto', height: '100%'}}>- <div- style={{display: 'flex', minHeight: '100%', padding: '0 32px'}}>- <XDSVStack- gap={3}- style={{flex: 1, minWidth: 0, padding: '32px 32px 32px 0'}}>- <div- style={{- flex: 1,- aspectRatio: '16 / 10',- backgroundColor: 'var(--color-background-muted, #f9f9f9)',- borderRadius: 12,- overflowY: 'auto',- overflowX: 'hidden',- border: '1px solid var(--color-border, #e0e0e0)',- }}>- <img- src={imgSrc}- alt={imgAlt}- style={{width: '100%', display: 'block'}}- />- </div>- </XDSVStack>- <XDSVStack style={{width: 360, flexShrink: 0, padding: '32px 0'}}>- {children}- </XDSVStack>- </div>- </div>- </>- )}- </XDSDialog>- );-}--export function DialogPreview() {- const [isOpen, setIsOpen] = useState(false);- return (- <div>- <div style={{marginBottom: 16}}>- <XDSHeading level={3}>Dialog</XDSHeading>- </div>- <XDSButton- label="Open Dialog"- variant="primary"- onClick={() => setIsOpen(true)}- />- <XDSDialog isOpen={isOpen} onOpenChange={setIsOpen}>- <XDSDialogHeader title="Example Dialog" onOpenChange={setIsOpen} />- <div style={{padding: 16}}>- <XDSText type="body">- This is an example dialog. Dialogs are used to require user action- or display important information that needs acknowledgment.- </XDSText>- </div>- </XDSDialog>- </div>- );-}--const PROFILE_TABS = ['Crafted', 'Used', 'Bookmarks'] as const;--const CRAFT_TYPE_OPTIONS = [- {value: 'all', label: 'All types'},- {value: 'Template', label: 'Template'},- {value: 'Theme', label: 'Theme'},- {value: 'Component', label: 'Component'},-];--const CRAFT_STATUS_OPTIONS = [- {value: 'all', label: 'All statuses'},- {value: 'Published', label: 'Published'},- {value: 'In Review', label: 'In Review'},- {value: 'Needs Fixes', label: 'Needs Fixes'},- {value: 'Draft', label: 'Draft'},-];--const CRAFT_SORT_OPTIONS = [- {value: 'recent', label: 'Most recent'},- {value: 'views', label: 'Most views'},- {value: 'uses', label: 'Most used'},-];--const USED_SORT_OPTIONS = [- {value: 'recent', label: 'Last used'},- {value: 'frequency', label: 'Most used'},- {value: 'name', label: 'Name'},-];--export function ProfileView({- activeView,- setActiveView,- onStartCrafting,- profileTab,- onTabChange,- profileCraftName,- onCraftPreviewChange,- profileUsedName,- onUsedPreviewChange,- profileSettingsOpen,- onSettingsChange,- profileCollectionName,- onCollectionChange,-}: {- activeView: 'craft' | 'explore' | 'docs' | 'profile' | 'theme';- setActiveView: (- v: 'craft' | 'explore' | 'docs' | 'profile' | 'theme',- ) => void;- onStartCrafting: () => void;- profileTab: 'Crafted' | 'Used' | 'Bookmarks';- onTabChange: (tab: 'Crafted' | 'Used' | 'Bookmarks') => void;- profileCraftName: string | null;- onCraftPreviewChange: (name: string | null) => void;- profileUsedName: string | null;- onUsedPreviewChange: (name: string | null) => void;- profileSettingsOpen: boolean;- onSettingsChange: (open: boolean) => void;- profileCollectionName: string | null;- onCollectionChange: (name: string | null) => void;-}) {- const activeTab = profileTab;- const setActiveTab = onTabChange;- const isSettingsOpen = profileSettingsOpen;- const setIsSettingsOpen = onSettingsChange;-- const previewItem = useMemo(() => {- if (!profileCraftName) {- return null;- }- return (PROFILE_CRAFT_ITEMS.find(i => i.name === profileCraftName) ??- null) as CraftItem | null;- }, [profileCraftName]);- const setPreviewItem = useCallback(- (item: CraftItem | null) => onCraftPreviewChange(item ? item.name : null),- [onCraftPreviewChange],- );-- const [selectedTheme, setSelectedTheme] = useState('default');- const [sendTo, setSendTo] = useState('clipboard');-- // Crafted tab state- const [craftTypeFilter, setCraftTypeFilter] = useState('all');- const [craftStatusFilter, setCraftStatusFilter] = useState('all');- const [craftSort, setCraftSort] = useState('recent');-- const handlePreview = useCallback(- (item: CraftItem) => {- setPreviewItem(item);- },- [setPreviewItem],- );-- const craftColumns = useMemo(- () => makeCraftColumns(handlePreview),- [handlePreview],- );-- // Crafted table sorting- const craftSortState = useXDSTableSortableState<- CraftItem,- 'lastUpdated' | 'views' | 'used'- >({- data: [] as CraftItem[],- defaultSort: [{sortKey: 'lastUpdated', direction: 'descending'}],- comparators: {- views: (a, b) => a.views - b.views,- used: (a, b) => a.used - b.used,- lastUpdated: (a, b) =>- new Date(a.lastUpdated).getTime() - new Date(b.lastUpdated).getTime(),- },- });- const craftSortPlugin = useXDSTableSortable<- CraftItem,- 'lastUpdated' | 'views' | 'used'- >(craftSortState.sortConfig);-- // Used tab state- const [usedSearch, setUsedSearch] = useState('');- const [usedSort, setUsedSort] = useState('recent');- const [usedTypeFilter, setUsedTypeFilter] = useState('all');- const previewUsedItem = useMemo(() => {- if (!profileUsedName) {- return null;- }- return (PROFILE_USED_ITEMS.find(i => i.name === profileUsedName) ??- null) as UsedItem | null;- }, [profileUsedName]);- const setPreviewUsedItem = useCallback(- (item: UsedItem | null) => onUsedPreviewChange(item ? item.name : null),- [onUsedPreviewChange],- );-- const [componentDrawerKey, setComponentDrawerKey] = useState<string | null>(- null,- );-- const handlePreviewUsed = useCallback(- (item: UsedItem) => {- setPreviewUsedItem(item);- },- [setPreviewUsedItem],- );-- const handleOpenComponentDocs = useCallback((key: string) => {- setComponentDrawerKey(key);- }, []);-- const usedColumns = useMemo(- () => makeUsedColumns(handlePreviewUsed, handleOpenComponentDocs),- [handlePreviewUsed, handleOpenComponentDocs],- );-- // Used table sorting- const usedSortState = useXDSTableSortableState<- UsedItem,- 'lastUsed' | 'usageCount'- >({- data: [] as UsedItem[],- defaultSort: [{sortKey: 'lastUsed', direction: 'descending'}],- comparators: {- usageCount: (a, b) => a.usageCount - b.usageCount,- lastUsed: (a, b) =>- new Date(a.lastUsed).getTime() - new Date(b.lastUsed).getTime(),- },- });- const usedSortPlugin = useXDSTableSortable<- UsedItem,- 'lastUsed' | 'usageCount'- >(usedSortState.sortConfig);-- // Bookmarks tab state- const [bookmarkSearch, setBookmarkSearch] = useState('');- const [removedBookmarks, setRemovedBookmarks] = useState<Set<string>>(- () => new Set(),- );- const [previewBookmarkItem, setPreviewBookmarkItem] = useState<- (typeof PROFILE_LIKED_ITEMS)[number] | null- >(null);- const [editingCollectionName, setEditingCollectionName] = useState(false);- const [collectionNameDraft, setCollectionNameDraft] = useState('');- const [editingCollectionItems, setEditingCollectionItems] = useState(false);- const [collectionItemsDraft, setCollectionItemsDraft] = useState<Set<string>>(- () => new Set(),- );- const [isNewCollection, setIsNewCollection] = useState(false);-- const handleBookmarkClick = useCallback(- (item: (typeof PROFILE_LIKED_ITEMS)[number]) => {- if (item.type === 'Component') {- setComponentDrawerKey(item.name.toLowerCase().replace(/\s+/g, ''));- } else {- setPreviewBookmarkItem(item);- }- },- [],- );- const selectedCollection = useMemo(() => {- if (isNewCollection) {- return {- name: collectionNameDraft || 'Untitled',- count: 0,- color: '#6B7280',- items: [] as string[],- };- }- if (!profileCollectionName) {- return null;- }- return (- PROFILE_COLLECTIONS.find(c => c.name === profileCollectionName) ?? null- );- }, [profileCollectionName, isNewCollection, collectionNameDraft]);- const setSelectedCollection = useCallback(- (col: (typeof PROFILE_COLLECTIONS)[number] | null) =>- onCollectionChange(col ? col.name : null),- [onCollectionChange],- );-- const filteredCrafts = useMemo(() => {- let items = [...PROFILE_CRAFT_ITEMS];- if (craftTypeFilter !== 'all') {- items = items.filter(i => i.type === craftTypeFilter);- }- if (craftStatusFilter !== 'all') {- items = items.filter(i => i.status === craftStatusFilter);- }- items.sort((a, b) => {- if (craftSort === 'views') {- return b.views - a.views;- }- if (craftSort === 'uses') {- return b.used - a.used;- }- return (- new Date(b.lastUpdated).getTime() - new Date(a.lastUpdated).getTime()- );- });- return items;- }, [craftTypeFilter, craftStatusFilter, craftSort]);-- const filteredUsed = useMemo(() => {- let items = [...PROFILE_USED_ITEMS];- if (usedTypeFilter !== 'all') {- items = items.filter(i => i.type === usedTypeFilter);- }- if (usedSearch) {- const q = usedSearch.toLowerCase();- items = items.filter(- i =>- i.name.toLowerCase().includes(q) ||- i.description.toLowerCase().includes(q),- );- }- items.sort((a, b) => {- if (usedSort === 'frequency') {- return b.usageCount - a.usageCount;- }- if (usedSort === 'name') {- return a.name.localeCompare(b.name);- }- return new Date(b.lastUsed).getTime() - new Date(a.lastUsed).getTime();- });- return items;- }, [usedSearch, usedSort, usedTypeFilter]);-- const filteredBookmarks = useMemo(() => {- let items = PROFILE_LIKED_ITEMS.filter(i => !removedBookmarks.has(i.name));- if (bookmarkSearch) {- const q = bookmarkSearch.toLowerCase();- items = items.filter(- i =>- i.name.toLowerCase().includes(q) ||- i.description.toLowerCase().includes(q),- );- }- return items;- }, [bookmarkSearch, removedBookmarks]);-- const collectionItems = useMemo(() => {- if (!selectedCollection) {- return [];- }- const itemNames = new Set(selectedCollection.items);- return PROFILE_LIKED_ITEMS.filter(- i => itemNames.has(i.name) && !removedBookmarks.has(i.name),- );- }, [selectedCollection, removedBookmarks]);-- return (- <div- style={{- display: 'flex',- flexDirection: 'column' as const,- height: '100vh',- }}>- <AppTopNav- activeView={activeView}- setActiveView={setActiveView}- activeTab="all"- onActiveTabChange={() => setActiveView('craft')}- />- <div- style={{- flex: 1,- overflowY: 'auto' as const,- padding: '32px 24px 140px',- }}>- <style>{`- @keyframes craftCardFadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }- `}</style>-- <div style={{maxWidth: 1400, margin: '0 auto'}}>- {/* Profile header */}- <div style={{marginBottom: 32}}>- <XDSText type="display-1">Your crafts</XDSText>- </div>- </div>-- {/* Tab bar + settings — full-width divider with tabs resting on the line */}- <div- style={{- borderBottom: '1px solid var(--color-divider, #e0e0e0)',- }}>- <div style={{maxWidth: 1400, margin: '0 auto', marginBottom: -1}}>- <XDSHStack vAlign="end">- <XDSTabList- value={activeTab}- onChange={v => {- setActiveTab(v as (typeof PROFILE_TABS)[number]);- setSelectedCollection(null);- }}- size="lg"- hasDivider={false}>- {PROFILE_TABS.map(tab => (- <XDSTab key={tab} value={tab} label={tab} />- ))}- </XDSTabList>- <XDSStackItem size="fill" />- <div style={{paddingBottom: 8}}>- <XDSButton- label="Settings"- variant="ghost"- size="lg"- isIconOnly- icon={<Cog6ToothIcon style={{width: 24, height: 24}} />}- onClick={() => setIsSettingsOpen(true)}- />- </div>- </XDSHStack>- </div>- </div>-- <div style={{maxWidth: 1400, margin: '0 auto'}}>- {/* ===== CRAFTED TAB ===== */}- {activeTab === 'Crafted' && (- <>- {/* Filter + sort + actions row */}- <XDSHStack- gap={2}- vAlign="center"- style={{marginTop: 32, marginBottom: 20}}>- <XDSSelector- label="Type"- isLabelHidden- options={CRAFT_TYPE_OPTIONS}- value={craftTypeFilter}- onChange={setCraftTypeFilter}- size="md"- />- <XDSSelector- label="Status"- isLabelHidden- options={CRAFT_STATUS_OPTIONS}- value={craftStatusFilter}- onChange={setCraftStatusFilter}- size="md"- />- <XDSSelector- label="Sort"- isLabelHidden- options={CRAFT_SORT_OPTIONS}- value={craftSort}- onChange={setCraftSort}- size="md"- />- <XDSStackItem size="fill" />- <XDSButton- label="Start crafting"- variant="primary"- size="md"- onClick={onStartCrafting}- />- </XDSHStack>-- <XDSTable- data={filteredCrafts as CraftItem[]}- columns={craftColumns}- idKey="name"- hasHover- plugins={{sort: craftSortPlugin}}- emptyState={- <XDSEmptyState- title="No crafts yet"- description="Create your first template, theme, or component and publish it to the community."- actions={- <XDSButton- label="Start crafting"- variant="primary"- onClick={onStartCrafting}- />- }- />- }- />- </>- )}-- {/* ===== USED TAB ===== */}- {activeTab === 'Used' && (- <>- <XDSHStack- gap={2}- vAlign="center"- style={{marginTop: 32, marginBottom: 20}}>- <div style={{width: 280}}>- <XDSTextInput- label="Search"- isLabelHidden- placeholder="Search used items..."- value={usedSearch}- onChange={setUsedSearch}- size="md"- startIcon={SearchIcon}- />- </div>- <XDSSelector- label="Type"- isLabelHidden- options={CRAFT_TYPE_OPTIONS}- value={usedTypeFilter}- onChange={setUsedTypeFilter}- size="md"- />- <XDSSelector- label="Sort"- isLabelHidden- options={USED_SORT_OPTIONS}- value={usedSort}- onChange={setUsedSort}- size="md"- />- <XDSStackItem size="fill" />- </XDSHStack>-- {filteredUsed.length === 0 ? (- <div style={{marginTop: 48}}>- <XDSEmptyState- title={- usedSearch- ? 'No results found'- : "You haven't used anything yet"- }- description={- usedSearch- ? 'Try a different search term.'- : 'Browse the community and start using templates, themes, and components in your projects.'- }- actions={- !usedSearch ? (- <XDSButton- label="Explore"- variant="primary"- onClick={() => setActiveView('explore')}- />- ) : undefined- }- />- </div>- ) : (- <XDSTable- data={- filteredUsed as Array<- (typeof filteredUsed)[number] & Record<string, unknown>- >- }- columns={usedColumns}- idKey="name"- hasHover- plugins={{sort: usedSortPlugin}}- />- )}- </>- )}-- {/* ===== BOOKMARKS TAB ===== */}- {activeTab === 'Bookmarks' && (- <>- {selectedCollection ? (- <>- {/* Collection detail view */}- <div style={{marginTop: 32, marginBottom: 32}}>- <XDSHStack- gap={2}- vAlign="center"- style={{marginBottom: 4}}>- <XDSButton- label="Back to bookmarks"- variant="ghost"- size="sm"- isIconOnly- icon={<ArrowLeftIcon style={{width: 18, height: 18}} />}- onClick={() => {- setSelectedCollection(null);- setIsNewCollection(false);- setEditingCollectionName(false);- setEditingCollectionItems(false);- }}- />- <div- style={{- width: 32,- height: 32,- borderRadius: 8,- backgroundColor:- 'var(--color-background-muted, #f0f0f0)',- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- flexShrink: 0,- }}>- <FolderIcon- style={{- width: 16,- height: 16,- color: 'var(--color-text-secondary, #6b7280)',- }}- />- </div>- <XDSVStack gap={0}>- {editingCollectionName ? (- <input- autoFocus- value={collectionNameDraft}- onChange={e =>- setCollectionNameDraft(e.target.value)- }- onBlur={() => setEditingCollectionName(false)}- onKeyDown={e => {- if (e.key === 'Enter' || e.key === 'Escape') {- setEditingCollectionName(false);- }- }}- style={{- font: 'inherit',- fontSize: 20,- fontWeight: 600,- border: 'none',- outline: 'none',- padding: '2px 0',- background: 'transparent',- borderBottom:- '2px solid var(--color-accent, #0066FF)',- width: Math.max(- 120,- collectionNameDraft.length * 11,- ),- }}- />- ) : (- <div- role="button"- tabIndex={0}- style={{cursor: 'pointer'}}- onClick={() => {- setCollectionNameDraft(selectedCollection.name);- setEditingCollectionName(true);- }}- onKeyDown={e => {- if (e.key === 'Enter' || e.key === ' ') {- setCollectionNameDraft(selectedCollection.name);- setEditingCollectionName(true);- }- }}>- <XDSHeading level={3}>- {selectedCollection.name}- </XDSHeading>- </div>- )}- <XDSText type="supporting" color="secondary">- {collectionItems.length}{' '}- {collectionItems.length === 1 ? 'item' : 'items'}- </XDSText>- </XDSVStack>- <XDSStackItem size="fill" />- {editingCollectionItems ? (- <XDSHStack gap={2}>- <XDSButton- label="Cancel"- variant="ghost"- size="sm"- onClick={() => setEditingCollectionItems(false)}- />- <XDSButton- label="Save"- variant="primary"- size="sm"- onClick={() => setEditingCollectionItems(false)}- />- </XDSHStack>- ) : (- <XDSButton- label="Add item"- variant="ghost"- size="sm"- isIconOnly- icon={<PlusIcon style={{width: 20, height: 20}} />}- onClick={() => {- setCollectionItemsDraft(- new Set(selectedCollection.items),- );- setEditingCollectionItems(true);- }}- />- )}- </XDSHStack>- </div>-- {editingCollectionItems ? (- <div- style={{- display: 'grid',- gridTemplateColumns: 'repeat(3, 1fr)',- gap: 16,- }}>- {PROFILE_LIKED_ITEMS.filter(- item => !removedBookmarks.has(item.name),- ).map((item, i) => {- const isInCollection = collectionItemsDraft.has(- item.name,- );- return (- <div- key={item.name}- onClick={() => {- setCollectionItemsDraft(prev => {- const next = new Set(prev);- if (next.has(item.name)) {- next.delete(item.name);- } else {- next.add(item.name);- }- return next;- });- }}- style={{- animation: `craftCardFadeIn 400ms ${i * 60}ms cubic-bezier(0.16, 1, 0.3, 1) both`,- cursor: 'pointer',- }}>- <XDSCard padding={0}>- <div- style={{- position: 'relative',- overflow: 'hidden',- }}>- <img- src={item.img}- alt={item.name}- style={{- display: 'block',- width: '100%',- aspectRatio: '1920 / 1205',- objectFit: 'cover',- objectPosition: 'top',- opacity: isInCollection ? 1 : 0.5,- transition: 'opacity 200ms ease',- }}- />- <div- style={{- position: 'absolute',- top: 12,- left: 12,- }}>- <XDSCheckboxInput- label={item.name}- isLabelHidden- value={isInCollection}- onChange={() => {- setCollectionItemsDraft(prev => {- const next = new Set(prev);- if (next.has(item.name)) {- next.delete(item.name);- } else {- next.add(item.name);- }- return next;- });- }}- />- </div>- <div- style={{- position: 'absolute',- bottom: 0,- left: 0,- right: 0,- padding: '24px 12px 12px',- background:- 'linear-gradient(to top, rgba(0,0,0,0.6), transparent)',- }}>- <div- style={{- display: 'flex',- flexDirection: 'column',- gap: 8,- }}>- <XDSText- type="body"- style={{color: '#fff', fontWeight: 600}}>- {item.name}- </XDSText>- <XDSText- type="supporting"- style={{color: 'rgba(255,255,255,0.7)'}}>- {item.type}- </XDSText>- </div>- </div>- </div>- </XDSCard>- </div>- );- })}- </div>- ) : collectionItems.length === 0 ? (- <div style={{marginTop: 48}}>- <XDSEmptyState- title="This collection is empty"- description="Bookmark items and add them to this collection."- actions={- <XDSButton- label="Add items"- variant="primary"- onClick={() => {- setCollectionItemsDraft(- new Set(selectedCollection.items),- );- setEditingCollectionItems(true);- }}- />- }- />- </div>- ) : (- <div- style={{- display: 'grid',- gridTemplateColumns: 'repeat(3, 1fr)',- gap: 16,- }}>- {collectionItems.map((item, i) => (- <BookmarkCard- key={item.name}- item={item}- index={i}- onClick={() => handleBookmarkClick(item)}- onRemove={() =>- setRemovedBookmarks(prev => {- const next = new Set(prev);- next.add(item.name);- return next;- })- }- />- ))}- </div>- )}- </>- ) : (- <>- {/* Collections */}- <div style={{marginTop: 32, marginBottom: 32}}>- <XDSHStack vAlign="center" style={{marginBottom: 12}}>- <XDSHeading level={2}>Collections</XDSHeading>- <XDSStackItem size="fill" />- <XDSButton- label="Add collection"- variant="ghost"- size="sm"- isIconOnly- icon={<PlusIcon style={{width: 20, height: 20}} />}- onClick={() => {- setIsNewCollection(true);- setCollectionNameDraft('Untitled');- setEditingCollectionName(true);- setEditingCollectionItems(false);- setCollectionItemsDraft(new Set());- }}- />- </XDSHStack>- <XDSGrid columns={{minWidth: 180}} gap={3}>- {PROFILE_COLLECTIONS.map((col, i) => (- <div- key={col.name}- onClick={() => setSelectedCollection(col)}- style={{- cursor: 'pointer',- animation: `craftCardFadeIn 300ms ${i * 50}ms cubic-bezier(0.16, 1, 0.3, 1) both`,- }}>- <XDSCard padding={3}>- <XDSHStack gap={3} vAlign="center">- <div- style={{- width: 36,- height: 36,- borderRadius: 10,- backgroundColor:- 'var(--color-background-muted, #f0f0f0)',- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- flexShrink: 0,- }}>- <FolderIcon- style={{- width: 18,- height: 18,- color:- 'var(--color-text-secondary, #6b7280)',- }}- />- </div>- <XDSVStack gap={0}>- <XDSText type="body" style={{fontWeight: 600}}>- {col.name}- </XDSText>- <XDSText type="supporting" color="secondary">- {col.count}{' '}- {col.count === 1 ? 'item' : 'items'}- </XDSText>- </XDSVStack>- </XDSHStack>- </XDSCard>- </div>- ))}- </XDSGrid>- </div>-- {/* Bookmark items */}- <XDSHStack vAlign="center" style={{marginBottom: 16}}>- <XDSHeading level={2}>All bookmarks</XDSHeading>- <XDSStackItem size="fill" />- <div style={{width: 280}}>- <XDSTextInput- label="Search bookmarks"- isLabelHidden- placeholder="Search bookmarks..."- value={bookmarkSearch}- onChange={setBookmarkSearch}- size="md"- startIcon={SearchIcon}- />- </div>- </XDSHStack>-- {filteredBookmarks.length === 0 ? (- <div style={{marginTop: 32}}>- <XDSEmptyState- title={- bookmarkSearch- ? 'No bookmarks match'- : 'No bookmarks yet'- }- description={- bookmarkSearch- ? 'Try a different search term.'- : 'Bookmark templates, themes, and components to save them for later.'- }- actions={- !bookmarkSearch ? (- <XDSButton- label="Explore"- variant="primary"- onClick={() => setActiveView('explore')}- />- ) : undefined- }- />- </div>- ) : (- <div- style={{- display: 'grid',- gridTemplateColumns: 'repeat(3, 1fr)',- gap: 16,- }}>- {filteredBookmarks.map((item, i) => (- <BookmarkCard- key={item.name}- item={item}- index={i}- onClick={() => handleBookmarkClick(item)}- onRemove={() =>- setRemovedBookmarks(prev => {- const next = new Set(prev);- next.add(item.name);- return next;- })- }- />- ))}- </div>- )}- </>- )}- </>- )}- </div>- </div>-- {/* Craft preview dialog */}- <PreviewDialogShell- isOpen={previewItem !== null}- onClose={() => setPreviewItem(null)}- imgSrc={previewItem?.img ?? ''}- imgAlt={previewItem?.name ?? ''}>- {previewItem && (- <>- <XDSText type="display-2">{previewItem.name}</XDSText>-- <div style={{marginTop: 8}}>- <XDSText type="body" color="secondary">- {previewItem.description}- </XDSText>- </div>-- <XDSHStack gap={2} vAlign="center" style={{marginTop: 16}}>- <XDSBadge- label={previewItem.status}- variant={STATUS_VARIANT[previewItem.status]}- />- <XDSText type="supporting" color="secondary">- {previewItem.type} · Updated {timeAgo(previewItem.lastUpdated)}- </XDSText>- </XDSHStack>-- {(previewItem.status === 'In Review' ||- previewItem.status === 'Needs Fixes') && (- <div style={{marginTop: 16}}>- <XDSBanner- status={- previewItem.status === 'Needs Fixes' ? 'warning' : 'info'- }- title={- previewItem.status === 'Needs Fixes'- ? 'Changes requested'- : 'In review'- }- description={- <>- {previewItem.status === 'Needs Fixes'- ? 'Reviewers have left comments on your craft. Open the diffs tool to resolve them.'- : 'Your craft is being reviewed by the XDS team. This usually takes 2–3 business days.'}{' '}- <XDSText type="supporting">- <XDSLink- label="Learn more"- href="#"- color="secondary"- hasUnderline- onClick={e => {- e.preventDefault();- setPreviewItem(null);- setActiveView('docs');- }}>- Learn more- </XDSLink>- </XDSText>- </>- }- />- </div>- )}-- {previewItem.status === 'Published' && (- <div style={{marginTop: 12}}>- <XDSList hasDividers density="balanced">- <XDSListItem- label="Views"- startContent={- <EyeIcon- style={{- width: 18,- height: 18,- color: 'var(--color-secondary)',- }}- />- }- endContent={- <XDSText type="label">- {previewItem.views.toLocaleString()}- </XDSText>- }- />- <XDSListItem- label="Uses"- startContent={- <CursorArrowRaysIcon- style={{- width: 18,- height: 18,- color: 'var(--color-secondary)',- }}- />- }- endContent={- <XDSText type="label">- {previewItem.used.toLocaleString()}- </XDSText>- }- />- <XDSListItem- label="Bookmarked"- startContent={- <BookmarkIcon- style={{- width: 18,- height: 18,- color: 'var(--color-secondary)',- }}- />- }- endContent={- <XDSText type="label">- {previewItem.bookmarks.toLocaleString()}- </XDSText>- }- />- </XDSList>- </div>- )}-- <XDSVStack gap={2} style={{marginTop: 'auto', paddingTop: 32}}>- {previewItem.status === 'In Review' ||- previewItem.status === 'Needs Fixes' ? (- <XDSButton- variant="secondary"- label="Edit"- size="lg"- style={{width: '100%'}}- onClick={() => setPreviewItem(null)}- />- ) : (- <>- <XDSButton- variant={- previewItem.status === 'Published'- ? 'primary'- : 'secondary'- }- label="Edit"- size="lg"- style={{width: '100%'}}- onClick={() => setPreviewItem(null)}- />- <XDSButton- variant={- previewItem.status === 'Published'- ? 'secondary'- : 'primary'- }- label={- previewItem.status === 'Published'- ? 'Unpublish'- : 'Submit for review'- }- size="lg"- style={{width: '100%'}}- onClick={() => setPreviewItem(null)}- />- </>- )}- </XDSVStack>- </>- )}- </PreviewDialogShell>-- {/* Used item preview dialog */}- <PreviewDialogShell- isOpen={previewUsedItem !== null}- onClose={() => setPreviewUsedItem(null)}- imgSrc={previewUsedItem?.img ?? ''}- imgAlt={previewUsedItem?.name ?? ''}>- {previewUsedItem && (- <>- <XDSText type="display-2">{previewUsedItem.name}</XDSText>-- <div style={{marginTop: 8}}>- <XDSText type="body" color="secondary">- {previewUsedItem.description}- </XDSText>- </div>-- <XDSHStack gap={2} vAlign="center" style={{marginTop: 16}}>- <XDSBadge- label={previewUsedItem.type}- variant={TYPE_VARIANT[previewUsedItem.type]}- />- </XDSHStack>-- <div style={{marginTop: 12}}>- <XDSList hasDividers density="balanced">- <XDSListItem- label="Times used"- startContent={- <CursorArrowRaysIcon- style={{- width: 18,- height: 18,- color: 'var(--color-secondary)',- }}- />- }- endContent={- <XDSText type="label">{previewUsedItem.usageCount}</XDSText>- }- />- <XDSListItem- label="Last used"- startContent={- <ClockIcon- style={{- width: 18,- height: 18,- color: 'var(--color-secondary)',- }}- />- }- endContent={- <XDSText type="label">- {timeAgo(previewUsedItem.lastUsed)}- </XDSText>- }- />- </XDSList>- </div>-- <XDSVStack gap={2} style={{marginTop: 'auto', paddingTop: 32}}>- <XDSButton- variant="primary"- label="Use again"- size="lg"- style={{width: '100%'}}- onClick={() => setPreviewUsedItem(null)}- />- <XDSButton- variant="secondary"- label="Start crafting"- size="lg"- style={{width: '100%'}}- onClick={() => setPreviewUsedItem(null)}- />- </XDSVStack>- </>- )}- </PreviewDialogShell>-- {/* Component docs drawer */}- <XDSDialog- isOpen={componentDrawerKey !== null}- onOpenChange={open => {- if (!open) {- setComponentDrawerKey(null);- }- }}- width="90vw"- maxHeight="90vh"- purpose="info"- style={- {- padding: 0,- overflow: 'visible',- maxWidth: 1200,- '--xds-dialog-padding': '0px',- } satisfies React.CSSProperties- }>- {componentDrawerKey &&- (() => {- const docs = getComponentDocs(componentDrawerKey);- const name = getComponentName(componentDrawerKey);- return (- <>- <div- style={{position: 'absolute', top: 0, right: -40, zIndex: 1}}>- <XDSCard padding={0} style={{borderRadius: '50%'}}>- <XDSButton- label="Close"- variant="ghost"- size="sm"- isIconOnly- icon={- <span style={{fontSize: 16, lineHeight: 1}}>✕</span>- }- onClick={() => setComponentDrawerKey(null)}- />- </XDSCard>- </div>- <div style={{overflowY: 'auto', maxHeight: '85vh'}}>- <div- style={{- maxWidth: 840,- margin: '0 auto',- padding: '32px 40px',- }}>- <XDSText type="display-1">{name}</XDSText>- <div style={{marginTop: 4, marginBottom: 32}}>- <XDSText type="supporting" color="secondary">- Component- </XDSText>- </div>-- {/* Live preview */}- <div- style={{- border:- '1px solid var(--color-divider, rgba(0,0,0,0.1))',- borderRadius: 12,- overflow: 'hidden',- marginBottom: 48,- }}>- <div- style={{- display: 'flex',- alignItems: 'center',- justifyContent: 'space-between',- padding: '8px 12px',- borderBottom:- '1px solid var(--color-divider, rgba(0,0,0,0.08))',- backgroundColor:- 'var(--color-background-surface, #ffffff)',- }}>- <XDSText- type="supporting"- weight="semibold"- color="secondary">- Live preview- </XDSText>- <XDSButton- label="Open full docs"- variant="ghost"- size="sm"- onClick={() => {- setComponentDrawerKey(null);- setActiveView('docs');- }}- />- </div>- <div- style={{- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- minHeight: 240,- padding: 24,- backgroundColor:- 'var(--color-background-muted, #f5f5f5)',- }}>- {COMPONENT_PREVIEWS[componentDrawerKey] ?? (- <XDSText type="supporting" color="secondary">- Preview coming soon- </XDSText>- )}- </div>- </div>-- {/* Description */}- <div style={{marginBottom: 48}}>- <XDSHeading level={3}>{docs.tagline}</XDSHeading>- <div style={{marginTop: 12}}>- <XDSText type="body">{docs.description}</XDSText>- </div>- <div style={{marginTop: 24}}>- <XDSHeading level={4}>When to use</XDSHeading>- <div style={{marginTop: 8}}>- <XDSList density="compact" listStyle="disc">- {docs.whenToUse.map((item, i) => (- <XDSListItem key={i} label={item} />- ))}- </XDSList>- </div>- </div>- <div style={{marginTop: 24}}>- <XDSHeading level={4}>When NOT to use</XDSHeading>- <div style={{marginTop: 8}}>- <XDSList density="compact" listStyle="disc">- {docs.whenNotToUse.map((item, i) => (- <XDSListItem key={i} label={item} />- ))}- </XDSList>- </div>- </div>- </div>-- {/* Anatomy */}- <div style={{marginBottom: 48}}>- <XDSHeading level={2}>Anatomy</XDSHeading>- <div style={{marginTop: 16}}>- <XDSText type="body">- The {name} is composed of the following elements.- Required elements must always be present, while- optional elements can be included as needed.- </XDSText>- </div>- <div style={{marginTop: 16}}>- <XDSTable- data={docs.anatomy as {[key: string]: unknown}[]}- columns={[- {key: 'element', header: 'Element'},- {key: 'required', header: 'Required'},- {key: 'description', header: 'Description'},- ]}- />- </div>- </div>- </div>- </div>- </>- );- })()}- </XDSDialog>-- {/* Bookmark preview dialog — reuses the exact same modal as the home page */}- <TemplatePreviewModal- isOpen={previewBookmarkItem !== null}- onClose={() => setPreviewBookmarkItem(null)}- item={- previewBookmarkItem- ? {- name: previewBookmarkItem.name,- img: previewBookmarkItem.img,- author: previewBookmarkItem.author,- description: previewBookmarkItem.description,- }- : null- }- onStartCrafting={() => {- setPreviewBookmarkItem(null);- onStartCrafting();- }}- isBookmarked={true}- onBookmarkToggle={() => {- if (previewBookmarkItem) {- setRemovedBookmarks(prev => {- const next = new Set(prev);- next.add(previewBookmarkItem.name);- return next;- });- setPreviewBookmarkItem(null);- }- }}- moreLikeThis={- previewBookmarkItem- ? PROFILE_LIKED_ITEMS.filter(- i =>- i.name !== previewBookmarkItem.name &&- !removedBookmarks.has(i.name),- )- .slice(0, 4)- .map(i => ({name: i.name, img: i.img, key: i.name}))- : []- }- onMoreLikeThisClick={mlItem => {- const found = PROFILE_LIKED_ITEMS.find(i => i.name === mlItem.name);- if (found) {- setPreviewBookmarkItem(found);- }- }}- exploreTags={[- 'website',- 'dashboard',- 'admin panel',- 'settings',- 'form layout',- 'data table',- 'sidebar nav',- 'landing page',- 'e-commerce',- 'documentation',- 'profile page',- ]}- componentTags={[- 'XDSAppShell',- 'XDSTopNav',- 'XDSVStack',- 'XDSHStack',- 'XDSHeading',- 'XDSText',- 'XDSButton',- 'XDSCard',- 'XDSBadge',- 'XDSAvatar',- ]}- />-- {/* Settings dialog */}- <XDSDialog- isOpen={isSettingsOpen}- onOpenChange={setIsSettingsOpen}- width={720}>- <XDSDialogHeader title="Settings" onOpenChange={setIsSettingsOpen} />- <div- style={{- padding: 24,- maxHeight: '70vh',- overflowY: 'auto' as const,- }}>- <XDSVStack gap={6}>- <XDSRadioList- label="Send to"- value={sendTo}- onChange={setSendTo}- description="Choose where templates and code are sent when you use them.">- <XDSRadioListItem- value="clipboard"- label="Clipboard"- description="Copy code to your clipboard"- />- <XDSRadioListItem- value="vscode"- label="VS Code"- description="Open directly in VS Code"- />- <XDSRadioListItem- value="github"- label="GitHub"- description="Create a new repo or gist"- />- <XDSRadioListItem- value="download"- label="Download"- description="Save as a file to your device"- />- </XDSRadioList>- <div>- <XDSHeading level={3} style={{marginBottom: 16}}>- Theme preference- </XDSHeading>- {(['official', 'community'] as const).map(category => {- const entries = THEME_PICKER_ENTRIES.filter(- e => e.category === category,- );- if (entries.length === 0) {- return null;- }- return (- <div key={category} style={{marginBottom: 20}}>- <div style={{marginBottom: 8}}>- <XDSText type="supporting" color="secondary">- {category.charAt(0).toUpperCase() + category.slice(1)}- </XDSText>- </div>- <XDSGrid columns={4} gap={3}>- {entries.map(entry => {- const isSelected = selectedTheme === entry.key;- const p = entry.preview;- return (- <div- key={entry.key}- onClick={() => setSelectedTheme(entry.key)}- style={{- borderRadius: 12,- overflow: 'hidden',- cursor: 'pointer',- border: isSelected- ? '2px solid var(--color-accent, #0066FF)'- : '1px solid var(--color-border-emphasized, #e0e0e0)',- transition: 'border-color 0.15s ease',- }}>- <XDSVStack>- <div- style={{- height: 80,- backgroundColor: p.bg,- display: 'flex',- flexDirection: 'column' as const,- overflow: 'hidden',- }}>- <XDSHStack- gap={1}- vAlign="center"- style={{- height: 14,- backgroundColor: p.surface,- borderBottom: `1px solid ${p.text}1A`,- paddingInline: 8,- }}>- <div- style={{- width: 5,- height: 5,- borderRadius: '50%',- backgroundColor: p.accent,- }}- />- <div- style={{- width: 16,- height: 2,- borderRadius: 1,- backgroundColor: p.text,- opacity: 0.3,- }}- />- </XDSHStack>- <XDSVStack- gap={1}- style={{- flex: 1,- padding: 8,- }}>- <div- style={{- width: '65%',- height: 4,- borderRadius: 2,- backgroundColor: p.text,- opacity: 0.6,- }}- />- <div- style={{- width: '45%',- height: 3,- borderRadius: 1.5,- backgroundColor: p.text,- opacity: 0.25,- }}- />- <div- style={{- width: 28,- height: 10,- borderRadius: 4,- backgroundColor: p.accent,- marginTop: 'auto',- }}- />- </XDSVStack>- </div>- <div- style={{- padding: '8px 10px',- }}>- <XDSText- type="supporting"- style={{- fontWeight: isSelected ? 600 : 400,- }}>- {entry.name}- </XDSText>- {entry.description && (- <div- style={{- marginTop: 2,- }}>- <XDSText- type="supporting"- color="secondary">- {entry.description}- </XDSText>- </div>- )}- </div>- </XDSVStack>- </div>- );- })}- </XDSGrid>- </div>- );- })}- </div>- </XDSVStack>- </div>- </XDSDialog>- </div>- );-}diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/SharePopover.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/SharePopover.tsxdeleted file mode 100644index 56b0716ee6..0000000000--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/SharePopover.tsx+++ /dev/null@@ -1,61 +0,0 @@-// Copyright (c) Meta Platforms, Inc. and affiliates.--'use client';--import React from 'react';-import {XDSHeading, XDSText} from '@xds/core/Text';-import {XDSCard} from '@xds/core/Card';-import {XDSCodeBlock} from '@xds/core/CodeBlock';-import {XDSList, XDSListItem} from '@xds/core/List';-import {XDSStack} from '@xds/core/Layout';-import {ClaudeIcon, VSCodeIcon, CursorAIIcon} from './docsite-icons';--export function SharePopoverContent({- cliCommand,- onClose,-}: {- cliCommand: string;- onClose: () => void;-}) {- return (- <XDSStack direction="vertical" gap={4}>- <XDSStack direction="vertical" gap={0}>- <XDSHeading level={3}>Add to your project</XDSHeading>- <XDSText type="body" color="secondary">- Copy this snippet and paste it in your terminal to get started.- </XDSText>- </XDSStack>-- <XDSCard padding={0}>- <XDSCodeBlock code={cliCommand} language="bash" />- </XDSCard>-- <XDSText type="label" color="secondary">- Or open in- </XDSText>- <XDSList style={{margin: '-8px'}}>- <XDSListItem- label="Claude Code"- startContent={- <ClaudeIcon style={{width: 18, height: 18, flexShrink: 0}} />- }- onClick={onClose}- />- <XDSListItem- label="VSCode"- startContent={- <VSCodeIcon style={{width: 18, height: 18, flexShrink: 0}} />- }- onClick={onClose}- />- <XDSListItem- label="Cursor"- startContent={- <CursorAIIcon style={{width: 18, height: 18, flexShrink: 0}} />- }- onClick={onClose}- />- </XDSList>- </XDSStack>- );-}diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/ShimmerText.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/ShimmerText.tsxdeleted file mode 100644index 76ebbad988..0000000000--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/ShimmerText.tsx+++ /dev/null@@ -1,39 +0,0 @@-// Copyright (c) Meta Platforms, Inc. and affiliates.--'use client';--import React, {useState, useEffect} from 'react';-import {XDSSkeleton} from '@xds/core/Skeleton';-import {XDSText} from '@xds/core/Text';--export function ShimmerText({isActive}: {isActive: boolean}) {- const [dots, setDots] = useState('');-- useEffect(() => {- if (!isActive) {- return;- }- const id = setInterval(() => {- setDots(prev => (prev.length >= 3 ? '' : prev + '.'));- }, 500);- return () => clearInterval(id);- }, [isActive]);-- return (- <div- style={{- display: 'flex',- flexDirection: 'column' as const,- gap: 8,- opacity: isActive ? 1 : 0,- transition: 'opacity 600ms ease',- }}>- <XDSSkeleton width="90%" height={14} radius={3} index={0} />- <XDSSkeleton width="75%" height={14} radius={3} index={1} />- <XDSSkeleton width="60%" height={14} radius={3} index={2} />- <XDSText type="supporting" color="secondary">- {isActive ? `Generating templates${dots}` : 'Done'}- </XDSText>- </div>- );-}diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplateCard.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplateCard.tsxdeleted file mode 100644index f39a02e1de..0000000000--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplateCard.tsx+++ /dev/null@@ -1,267 +0,0 @@-// Copyright (c) Meta Platforms, Inc. and affiliates.--'use client';--import React, {useState, useEffect, useRef, useCallback} from 'react';-import {XDSCard} from '@xds/core/Card';-import {XDSButton} from '@xds/core/Button';-import {XDSHeading, XDSText} from '@xds/core/Text';-import {XDSStack} from '@xds/core/Layout';-import {XDSPopover} from '@xds/core/Popover';-import {BookmarkIcon, BookmarkFilledIcon} from './docsite-icons';-import {CraftingCat} from './CraftingCat';-import {SharePopoverContent} from './SharePopover';-import {basePath} from './constants';--export function TemplateCard({- src,- slug,- name,- isSelected: _isSelected,- onSelect: _onSelect,- isGenerating,- onMoreLikeThis: _onMoreLikeThis,- onUse,- onPreview,- cardSize: _cardSize = 'medium',- isCached = false,- onIframeLoad,-}: {- src: string;- slug?: string;- name: string;- isSelected?: boolean;- onSelect?: () => void;- isGenerating: boolean;- onMoreLikeThis?: () => void;- onUse: () => void;- onPreview: () => void;- cardSize?: 'xlarge' | 'large' | 'medium' | 'small';- isCached?: boolean;- onIframeLoad?: (slug: string) => void;-}) {- const [hovered, setHovered] = useState(false);- const [showCanvas, setShowCanvas] = useState(false);- const [showUsePopover, setShowUsePopover] = useState(false);- const [bookmarked, setBookmarked] = useState(false);- const [iframeScale, setIframeScale] = useState(0.25);- const [loadIframe, setLoadIframe] = useState(isCached);- const iframeWrapperRef = useRef<HTMLDivElement>(null);-- const updateIframeScale = useCallback(() => {- if (iframeWrapperRef.current) {- setIframeScale(iframeWrapperRef.current.offsetWidth / 1920);- }- }, []);-- useEffect(() => {- if (!slug) {- return;- }- updateIframeScale();- const el = iframeWrapperRef.current;- if (!el) {- return;- }-- const resizeObs = new ResizeObserver(updateIframeScale);- resizeObs.observe(el);-- return () => resizeObs.disconnect();- }, [slug, updateIframeScale]);-- useEffect(() => {- if (isGenerating) {- setShowCanvas(true);- }- }, [isGenerating]);-- // Keep canvas mounted briefly after generating ends for fade-out- useEffect(() => {- if (!isGenerating && showCanvas) {- const id = setTimeout(() => setShowCanvas(false), 800);- return () => clearTimeout(id);- }- }, [isGenerating, showCanvas]);-- return (- <XDSCard padding={0}>- <div- style={{- position: 'relative',- cursor: 'pointer',- overflow: 'hidden',- }}- onMouseEnter={() => {- setHovered(true);- if (slug && !loadIframe) {- setLoadIframe(true);- onIframeLoad?.(slug);- }- }}- onMouseLeave={() => setHovered(false)}- onClick={onPreview}>- {/* Preview layer — live iframe when slug is provided, static image otherwise */}- {slug ? (- <div- ref={iframeWrapperRef}- style={{- position: 'relative',- width: '100%',- aspectRatio: '1920 / 1205',- overflow: 'hidden',- opacity: isGenerating ? 0 : 1,- transition: 'opacity 600ms ease',- }}>- {!loadIframe && (- <div- style={{- width: '100%',- height: '100%',- background:- 'linear-gradient(90deg, var(--color-background-muted, #f0f0f0) 0%, var(--color-background-surface, #fafafa) 50%, var(--color-background-muted, #f0f0f0) 100%)',- backgroundSize: '800px 100%',- animation: 'craftShimmer 1.6s ease-in-out infinite',- }}- />- )}- {loadIframe && (- <iframe- src={`${basePath}/templates/${slug}/?embed=1`}- sandbox="allow-scripts allow-same-origin"- title={name}- loading="lazy"- style={{- position: 'absolute',- top: 0,- left: 0,- width: 1920,- height: 1205,- border: 'none',- transform: `scale(${iframeScale})`,- transformOrigin: 'top left',- pointerEvents: 'none',- }}- />- )}- </div>- ) : (- <img- src={src}- alt={name}- style={{- display: 'block',- width: '100%',- aspectRatio: '1920 / 1205',- objectFit: 'cover' as const,- objectPosition: 'top',- opacity: isGenerating ? 0 : 1,- transition: 'opacity 600ms ease',- }}- />- )}- {/* Canvas layer — overlaid, fades in/out */}- {showCanvas && (- <div- style={{- position: 'absolute',- inset: 0,- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- opacity: isGenerating ? 1 : 0,- transition: 'opacity 600ms ease',- }}>- <CraftingCat />- </div>- )}- {!isGenerating && (- <div- style={{- position: 'absolute',- inset: 0,- backgroundColor: 'var(--color-overlay, rgba(0,0,0,0.5))',- opacity: hovered ? 1 : 0,- transition: 'opacity 300ms ease',- }}>- {/* Top-right: bookmark */}- <div- style={{- position: 'absolute',- top: 12,- right: 12,- }}- onClick={e => e.stopPropagation()}>- <XDSButton- label="Bookmark"- variant="ghost"- size="sm"- isIconOnly- icon={bookmarked ? <BookmarkFilledIcon /> : <BookmarkIcon />}- style={{color: '#fff'}}- onClick={() => setBookmarked(prev => !prev)}- />- </div>- {/* Bottom: info + actions */}- <div- onClick={e => e.stopPropagation()}- style={{- position: 'absolute',- bottom: 0,- left: 0,- right: 0,- padding: 16,- background:- 'linear-gradient(to top, rgba(0,0,0,0.6), transparent)',- display: 'flex',- alignItems: 'flex-end',- justifyContent: 'space-between',- }}>- {/* Template info */}- <XDSStack direction="vertical" gap={0}>- <XDSHeading level={3} style={{color: '#fff'}}>- {name}- </XDSHeading>- <XDSText- type="supporting"- style={{color: 'rgba(255,255,255,0.7)'}}>- Andrea Anderson- </XDSText>- </XDSStack>- {/* Action buttons */}- <XDSStack direction="horizontal" gap={2}>- <XDSPopover- label="Add to project"- isOpen={showUsePopover}- onOpenChange={setShowUsePopover}- placement="above"- alignment="start"- width={340}- content={- <SharePopoverContent- cliCommand={`npx xds template ${name.toLowerCase().replace(/\s+/g, '-')}`}- onClose={() => setShowUsePopover(false)}- />- }>- <XDSButton- label="Use"- variant="secondary"- size="sm"- style={{backgroundColor: 'var(--color-background-surface)'}}- />- </XDSPopover>- <XDSButton- label="Craft"- variant="secondary"- size="sm"- style={{backgroundColor: 'var(--color-background-surface)'}}- onClick={onUse}- />- </XDSStack>- </div>- </div>- )}- </div>- </XDSCard>- );-}diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplatePreview.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplatePreview.tsxdeleted file mode 100644index 58e735b2b1..0000000000--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplatePreview.tsx+++ /dev/null@@ -1,466 +0,0 @@-// Copyright (c) Meta Platforms, Inc. and affiliates.--'use client';--import React, {useState, useEffect, useRef, useCallback} from 'react';-import {XDSButton} from '@xds/core/Button';-import {XDSDropdownMenu} from '@xds/core/DropdownMenu';-import {- XDSSegmentedControl,- XDSSegmentedControlItem,-} from '@xds/core/SegmentedControl';-import {XDSSpinner} from '@xds/core/Spinner';--import {XDSTooltip} from '@xds/core/Tooltip';--import {- DesktopIcon,- PhoneIcon,- CursorIcon,- PaletteIcon,- ContrastIcon,- SaveIcon,- FullscreenIcon,- MoonIcon,- LinkIcon,- CheckIcon,-} from './docsite-icons';-import {XDSPopover} from '@xds/core/Popover';-import {SharePopoverContent} from './SharePopover';--import {XDS_THEMES, basePath} from './constants';-import {CraftingCat} from './CraftingCat';--import type {PointedElement} from './ChatPanel';--export function TemplatePreview({- templateName,- imageSrc,- slug,- onBack: _onBack,- isGenerating,- onPublish,- isPointing,- onPointingChange,- onElementPointed,- hideToolbar = false,- externalViewportSize,- isPublishing = false,- isFullPreview = false,- onFullPreviewChange,- previewBackground,-}: {- templateName: string;- imageSrc: string;- slug?: string;- onBack: () => void;- isGenerating: boolean;- onPublish?: () => void;- isPointing?: boolean;- onPointingChange?: (pointing: boolean) => void;- onElementPointed?: (el: PointedElement) => void;- hideToolbar?: boolean;- externalViewportSize?: string;- isPublishing?: boolean;- isFullPreview?: boolean;- onFullPreviewChange?: (full: boolean) => void;- previewBackground?: string;-}) {- const [internalViewportSize, setViewportSize] = useState('desktop');- const viewportSize = externalViewportSize ?? internalViewportSize;- const previewRef = useRef(null);-- const [showCanvas, setShowCanvas] = useState(false);- const [isDarkMode, setIsDarkMode] = useState(false);- const [saveState, setSaveState] = useState<'idle' | 'saving' | 'saved'>(- 'idle',- );- const [linkCopied, setLinkCopied] = useState(false);- const [_isScrolled, setIsScrolled] = useState(false);-- const handleSave = useCallback(() => {- setSaveState('saving');- setTimeout(() => setSaveState('saved'), 1200);- }, []);-- const handleCopyLink = useCallback(() => {- navigator.clipboard.writeText(window.location.href);- setLinkCopied(true);- setTimeout(() => setLinkCopied(false), 2000);- }, []);- const scrollRef = useRef<HTMLDivElement>(null);- const [showSharePopover, setShowSharePopover] = useState(false);- const shareCliCommand = `npx xds template ${templateName.toLowerCase().replace(/\s+/g, '-')} ./my-project`;-- useEffect(() => {- const el = scrollRef.current;- if (!el) {- return;- }- const handleScroll = () => setIsScrolled(el.scrollTop > 8);- el.addEventListener('scroll', handleScroll, {passive: true});- return () => el.removeEventListener('scroll', handleScroll);- }, []);-- useEffect(() => {- if (isGenerating) {- setShowCanvas(true);- }- }, [isGenerating]);-- useEffect(() => {- if (!isGenerating && showCanvas) {- const id = setTimeout(() => setShowCanvas(false), 800);- return () => clearTimeout(id);- }- }, [isGenerating, showCanvas]);-- return (- <div- style={{- display: 'flex',- flexDirection: 'column' as const,- height: '100%',- overflow: 'visible',- paddingTop: 0,- position: 'relative' as const,- }}>- {/* Toolbar — outside overflow:hidden so dropdowns aren't clipped */}- {!hideToolbar && (- <div- style={{- background: 'var(--color-background-card, #fff)',- position: 'absolute',- top: 0,- left: 0,- right: 0,- zIndex: 10,- paddingTop: 8,- display: 'flex',- justifyContent: 'center',- }}>- <div- style={{- border: 'none',- display: 'flex',- justifyContent: 'center',- width: '100%',- padding: '4px 0 12px 0',- boxShadow: 'none',- transition: 'background-color 200ms ease, box-shadow 300ms ease',- }}>- <div- role="toolbar"- aria-label="Template actions"- style={{- display: 'flex',- alignItems: 'center',- flex: 1,- padding: '0 32px 0 8px',- position: 'relative',- }}>- {!isPublishing && (- <div style={{display: 'flex', alignItems: 'center'}}>- <XDSTooltip content="Point">- <XDSButton- label="Point"- variant={isPointing ? 'secondary' : 'ghost'}- isIconOnly- icon={<CursorIcon />}- onClick={() => onPointingChange?.(!isPointing)}- />- </XDSTooltip>- <XDSTooltip content="Theme">- <XDSDropdownMenu- button={{- label: 'Theme',- variant: 'ghost',- isIconOnly: true,- icon: <PaletteIcon />,- }}- hasChevron={false}- items={XDS_THEMES.map(t => ({- label: t.label,- onClick: () => {},- }))}- />- </XDSTooltip>- <XDSTooltip content={isDarkMode ? 'Dark mode' : 'Light mode'}>- <XDSButton- label={isDarkMode ? 'Dark mode' : 'Light mode'}- variant="ghost"- isIconOnly- icon={isDarkMode ? <MoonIcon /> : <ContrastIcon />}- onClick={() => setIsDarkMode(prev => !prev)}- />- </XDSTooltip>- </div>- )}- <div- style={{- position: 'absolute',- left: 16,- right: 32,- display: 'flex',- justifyContent: 'center',- pointerEvents: 'none',- }}>- <XDSSegmentedControl- value={viewportSize}- onChange={setViewportSize}- label="Viewport size"- size="sm"- style={{pointerEvents: 'auto'}}>- <XDSTooltip content="Desktop">- <XDSSegmentedControlItem- value="desktop"- label="Desktop"- isLabelHidden- icon={<DesktopIcon />}- />- </XDSTooltip>- <XDSTooltip content="Phone">- <XDSSegmentedControlItem- value="phone"- label="Phone"- isLabelHidden- icon={<PhoneIcon />}- />- </XDSTooltip>- </XDSSegmentedControl>- </div>- <div style={{flex: 1}} />- {!isPublishing && (- <div style={{display: 'flex', alignItems: 'center', gap: 8}}>- <XDSTooltip content="Preview">- <XDSButton- label="Preview"- variant="ghost"- isIconOnly- icon={<FullscreenIcon />}- onClick={() => onFullPreviewChange?.(true)}- />- </XDSTooltip>- {saveState === 'saved' ? (- <XDSTooltip content={linkCopied ? 'Copied!' : 'Copy link'}>- <XDSButton- label={linkCopied ? 'Copied' : 'Copy link'}- variant="ghost"- icon={- linkCopied ? (- <CheckIcon color="var(--color-icon-primary, #111)" />- ) : (- <LinkIcon />- )- }- isIconOnly- onClick={handleCopyLink}- />- </XDSTooltip>- ) : saveState === 'saving' ? (- <div- style={{- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- width: 32,- height: 32,- }}>- <XDSSpinner size="sm" />- </div>- ) : (- <XDSTooltip content="Save">- <XDSButton- label="Save"- variant="ghost"- icon={<SaveIcon />}- isIconOnly- onClick={handleSave}- />- </XDSTooltip>- )}- <XDSButton- label="Submit"- variant="secondary"- size="sm"- onClick={() => onPublish?.()}- />- <XDSPopover- label="Add to project"- isOpen={showSharePopover}- onOpenChange={setShowSharePopover}- placement="below"- alignment="end"- width={340}- content={- <SharePopoverContent- cliCommand={shareCliCommand}- onClose={() => setShowSharePopover(false)}- />- }>- <XDSButton label="Use" variant="primary" size="sm" />- </XDSPopover>- </div>- )}- </div>- </div>- </div>- )}-- {/* Bordered container: preview/code/publish */}- <div- style={{- flex: 1,- overflow: 'visible',- padding: 0,- display: 'flex',- flexDirection: 'column' as const,- minHeight: 0,- position: 'relative' as const,- }}>- {/* Exit preview button — shown in full preview mode */}- {isFullPreview && (- <div- style={{- position: 'absolute',- top: 16,- right: 16,- zIndex: 20,- }}>- <XDSButton- label="Exit preview"- variant="secondary"- size="sm"- onClick={() => onFullPreviewChange?.(false)}- />- </div>- )}-- {/* Preview — full-bleed image */}- <div- ref={el => {- (- previewRef as React.MutableRefObject<HTMLDivElement | null>- ).current = el;- (- scrollRef as React.MutableRefObject<HTMLDivElement | null>- ).current = el;- }}- style={{- position: 'relative',- flex: 1,- overflow: 'auto',- display: 'flex',- justifyContent: 'center',- alignItems: 'flex-start',- backgroundColor:- previewBackground ?? 'var(--color-background-surface, #fff)',- padding: isFullPreview- ? 0- : viewportSize === 'phone'- ? 24- : previewBackground- ? '64px 16px 16px 16px'- : '64px 32px 16px 16px',- cursor: isPointing ? 'crosshair' : undefined,- transition: 'background-color 300ms ease, padding 300ms ease',- }}- onClick={- isPointing- ? (e: React.MouseEvent) => {- const target = e.target as HTMLElement;- const rect = target.getBoundingClientRect();- onElementPointed?.({- tagName: target.tagName,- componentName: target.dataset.component,- rect: {- x: rect.x,- y: rect.y,- width: rect.width,- height: rect.height,- },- });- onPointingChange?.(false);- }- : undefined- }>- <div- style={{- position: 'relative',- width: viewportSize === 'phone' ? 390 : '100%',- borderRadius:- viewportSize === 'phone'- ? 36- : isFullPreview- ? 0- : 'var(--radius-container, 12px)',- border: 'none',- boxShadow: isFullPreview- ? 'none'- : 'rgba(0, 0, 0, 0.08) 0px 1px 3px, rgba(0, 0, 0, 0.06) 0px 4px 12px',- overflow: 'hidden',- flexShrink: 0,- margin: isFullPreview ? 0 : 'auto 0',- transition: 'width 300ms ease, border-radius 300ms ease',- }}>- {slug ? (- <iframe- src={`${basePath}/templates/${slug}/?embed=1`}- sandbox="allow-scripts allow-same-origin"- title={templateName}- style={{- display: 'block',- width: '100%',- height: '100vh',- border: 'none',- opacity: isGenerating ? 0 : 1,- transition: 'opacity 600ms ease',- }}- />- ) : imageSrc ? (- <img- src={imageSrc}- alt="Template preview"- style={{- display: 'block',- width: '100%',- aspectRatio: undefined,- objectFit: undefined,- opacity: isGenerating ? 0 : 1,- transition: 'opacity 600ms ease',- }}- />- ) : (- <div- style={{- width: '100%',- aspectRatio: '1920 / 1205',- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- backgroundColor: '#fff',- opacity: isGenerating ? 0 : 1,- transition: 'opacity 600ms ease',- }}- />- )}- {showCanvas && (- <div- style={{- position: 'absolute',- inset: 0,- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- opacity: isGenerating ? 1 : 0,- transition: 'opacity 600ms ease',- }}>- <CraftingCat />- </div>- )}- </div>- </div>- </div>- </div>- );-}diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplatePreviewModal.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplatePreviewModal.tsxdeleted file mode 100644index 13486f3b87..0000000000--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplatePreviewModal.tsx+++ /dev/null@@ -1,784 +0,0 @@-// Copyright (c) Meta Platforms, Inc. and affiliates.--'use client';--import React, {useState, useRef, useCallback} from 'react';-import * as stylex from '@stylexjs/stylex';-import {XDSAvatar} from '@xds/core/Avatar';-import {XDSButton} from '@xds/core/Button';-import {XDSCard} from '@xds/core/Card';-import {XDSDialog} from '@xds/core/Dialog';-import {XDSHeading, XDSText} from '@xds/core/Text';-import {XDSPopover} from '@xds/core/Popover';-import {XDSTextInput} from '@xds/core/TextInput';-import {XDSToken} from '@xds/core/Token';-import {XDSTooltip} from '@xds/core/Tooltip';-import {XDSVStack, XDSHStack} from '@xds/core/Layout';-import {- AVATAR_IMAGE,- XDS_DESIGN_AVATAR,- THEME_PICKER_ENTRIES,- basePath,-} from './constants';-import {SharePopoverContent} from './SharePopover';-import {- BookmarkIcon,- BookmarkFilledIcon,- StarIcon,- StarFilledIcon,- SearchIcon,- ThreadsLogo,- FacebookLogo,- DefaultThemeIcon,- ForestThemeIcon,- SunsetThemeIcon,- MidnightThemeIcon,-} from './docsite-icons';--const BRAND_LOGOS: Record<- string,- React.ComponentType<React.SVGProps<SVGSVGElement>>-> = {- default: DefaultThemeIcon,- threads: ThreadsLogo,- facebook: FacebookLogo,- forest: ForestThemeIcon,- sunset: SunsetThemeIcon,- midnight: MidnightThemeIcon,-};--const popoverStyles = stylex.create({- themeBrowse: {- zIndex: 100,- },-});--const tokenStyles = stylex.create({- outline: {- borderWidth: 1,- borderStyle: 'solid',- borderColor: 'var(--color-border-strong, #999)',- },- pill: {- borderWidth: 1,- borderStyle: 'solid',- borderColor: 'var(--color-border-strong, #999)',- },-});--export type TemplatePreviewItem = {- name: string;- img: string;- slug?: string;- author: string;- description?: string;- themeImages?: Record<string, string>;-};--export type MoreLikeThisItem = {- name: string;- img: string;- slug?: string;- key: string | number;- themeImages?: Record<string, string>;-};--export function TemplatePreviewModal({- isOpen,- onClose,- item,- onStartCrafting,- isBookmarked,- onBookmarkToggle,- moreLikeThis,- onMoreLikeThisClick,- exploreTags,- onExploreTagClick,- componentTags,- onComponentTagClick,-}: {- isOpen: boolean;- onClose: () => void;- item: TemplatePreviewItem | null;- onStartCrafting?: () => void;- isBookmarked?: boolean;- onBookmarkToggle?: () => void;- moreLikeThis?: MoreLikeThisItem[];- onMoreLikeThisClick?: (item: MoreLikeThisItem) => void;- exploreTags?: string[];- onExploreTagClick?: (tag: string) => void;- componentTags?: string[];- onComponentTagClick?: (tag: string) => void;-}) {- const scrollRef = useRef<HTMLDivElement>(null);- const [selectedTheme, setSelectedTheme] = useState('default');- const [themeBrowseOpen, setThemeBrowseOpen] = useState(false);- const [themeSearch, setThemeSearch] = useState('');- const [showAddPopover, setShowAddPopover] = useState(false);- const [pinnedThemes, setPinnedThemes] = useState(- () =>- new Set(- THEME_PICKER_ENTRIES.filter(t => t.isPinnedByDefault).map(t => t.key),- ),- );- const [transitioning, setTransitioning] = useState(false);- const [previewLoaded, setPreviewLoaded] = useState(false);-- const themeFilters: Record<string, string> = {- neutral: 'saturate(0.3)',- brutalist: 'contrast(1.2) saturate(0.5)',- threads: 'saturate(0.8) contrast(1.1)',- facebook: 'sepia(0.1) saturate(1.3) hue-rotate(190deg)',- matcha: 'sepia(0.2) saturate(1.2) hue-rotate(80deg)',- midnight: 'invert(0.88) hue-rotate(180deg)',- daily: 'sepia(0.1) saturate(1.1) hue-rotate(10deg)',- };- const previewFilter = themeFilters[selectedTheme] ?? undefined;-- const togglePin = useCallback((key: string) => {- setPinnedThemes(prev => {- const next = new Set(prev);- if (next.has(key)) {- next.delete(key);- } else {- next.add(key);- }- return next;- });- }, []);-- if (!item) {- return null;- }-- const themedImg = item.themeImages?.[selectedTheme] ?? item.img;- const hasThemedImage =- item.themeImages != null && selectedTheme in item.themeImages;-- const description =- item.description ??- `A ready-to-use ${item.name.toLowerCase()} template built with XDS components. Customize it with your own content and theme to match your brand.`;-- const shimmerBg =- 'linear-gradient(90deg, var(--color-background-muted, #f0f0f0) 0%, var(--color-background-surface, #fafafa) 50%, var(--color-background-muted, #f0f0f0) 100%)';-- return (- <XDSDialog- isOpen={isOpen}- onOpenChange={open => {- if (!open) {- onClose();- setPreviewLoaded(false);- }- }}- width="90vw"- maxHeight="90vh"- purpose="info"- style={- {- padding: 0,- overflow: 'visible',- maxWidth: 1600,- '--xds-dialog-padding': '0px',- } satisfies React.CSSProperties- }>- <div style={{position: 'absolute', top: 0, right: -40, zIndex: 1}}>- <XDSCard padding={0} style={{borderRadius: '50%'}}>- <XDSButton- label="Close"- variant="ghost"- size="sm"- isIconOnly- icon={<span style={{fontSize: 16, lineHeight: 1}}>✕</span>}- onClick={onClose}- />- </XDSCard>- </div>- <div ref={scrollRef} style={{overflowY: 'auto'}}>- <div style={{display: 'flex', minHeight: 0, padding: '0 32px'}}>- {/* Left — Preview image */}- <XDSVStack- gap={3}- style={{flex: 1, minWidth: 0, padding: '32px 32px 32px 0'}}>- <div- style={{- flex: 1,- aspectRatio: '16 / 10',- borderRadius: 12,- overflow: 'hidden',- border: '1px solid var(--color-border, #e0e0e0)',- filter: hasThemedImage ? undefined : previewFilter,- transition: 'filter 300ms ease',- ...(!previewLoaded- ? {- background: shimmerBg,- backgroundSize: '800px 100%',- animation: 'craftShimmer 1.6s ease-in-out infinite',- }- : {- backgroundColor: 'var(--color-background-muted, #f9f9f9)',- }),- }}>- {item.slug ? (- <iframe- src={`${basePath}/templates/${item.slug}/?embed=1`}- sandbox="allow-scripts allow-same-origin"- title={item.name}- onLoad={() => setPreviewLoaded(true)}- style={{- width: '100%',- height: '100%',- border: 'none',- display: 'block',- opacity: transitioning || !previewLoaded ? 0 : 1,- transition: 'opacity 250ms ease',- }}- />- ) : (- <img- src={themedImg}- alt={`${item.name} — ${selectedTheme}`}- onLoad={() => setPreviewLoaded(true)}- style={{- width: '100%',- display: 'block',- opacity: transitioning ? 0 : 1,- transition: 'opacity 250ms ease',- animation: transitioning- ? 'none'- : 'previewFadeIn 300ms ease',- }}- />- )}- </div>- </XDSVStack>-- {/* Right — Details panel */}- <XDSVStack style={{width: 360, flexShrink: 0, padding: '32px 0'}}>- <div- style={{- opacity: transitioning ? 0 : 1,- transition: 'opacity 250ms ease',- animation: transitioning ? 'none' : 'previewFadeIn 300ms ease',- }}>- <XDSText type="display-2">{item.name}</XDSText>-- <div style={{marginTop: 8}}>- <XDSText type="body" color="secondary">- {description}- </XDSText>- </div>-- {/* Author */}- <XDSHStack gap={3} vAlign="center" style={{marginTop: 16}}>- <XDSAvatar- name={item.author}- size={36}- src={- item.author === 'XDS Design'- ? XDS_DESIGN_AVATAR- : AVATAR_IMAGE- }- />- <XDSVStack gap={0}>- <XDSText type="supporting" color="secondary">- Crafted by- </XDSText>- <XDSText type="body" style={{fontWeight: 600, fontSize: 16}}>- {item.author}- </XDSText>- </XDSVStack>- </XDSHStack>- </div>-- {/* CTA buttons */}- <XDSVStack gap={2} style={{marginTop: 32, position: 'relative'}}>- <XDSButton- variant="primary"- label="Start crafting"- size="lg"- style={{width: '100%'}}- onClick={() => {- onStartCrafting?.();- onClose();- }}- />- <div style={{display: 'flex', gap: 8, width: '100%'}}>- <XDSButton- variant="secondary"- label="Use in your product"- size="lg"- style={{flex: 1}}- onClick={() => setShowAddPopover(!showAddPopover)}- />- <XDSTooltip content="Bookmark">- <XDSButton- label={isBookmarked ? '893' : '892'}- variant="secondary"- size="lg"- isIconOnly- icon={- isBookmarked ? <BookmarkFilledIcon /> : <BookmarkIcon />- }- onClick={onBookmarkToggle}- />- </XDSTooltip>- </div>- {showAddPopover && (- <XDSCard- style={{- position: 'absolute',- top: '100%',- left: 0,- right: 0,- marginTop: 8,- zIndex: 10,- }}>- <SharePopoverContent- cliCommand={`npx xds template ${item.name.toLowerCase().replace(/\s+/g, '-')} ./my-project`}- onClose={() => setShowAddPopover(false)}- />- </XDSCard>- )}- </XDSVStack>-- {/* Themes — pinned grid */}- <div style={{marginTop: 24}}>- <div- style={{- display: 'flex',- alignItems: 'center',- justifyContent: 'space-between',- }}>- <XDSText type="body" style={{fontWeight: 600}}>- Apply your themes- </XDSText>- <XDSPopover- label="Browse themes"- placement="below"- alignment="end"- width={480}- isOpen={themeBrowseOpen}- onOpenChange={open => {- setThemeBrowseOpen(open);- if (!open) {- setThemeSearch('');- }- }}- xstyle={popoverStyles.themeBrowse}- content={- <div- style={{- display: 'flex',- flexDirection: 'column',- gap: 16,- }}>- <div- tabIndex={0}- style={{- position: 'absolute',- opacity: 0,- width: 0,- height: 0,- overflow: 'hidden',- }}- />- <XDSTextInput- label="Search"- isLabelHidden- placeholder="Search themes..."- value={themeSearch}- onChange={setThemeSearch}- size="lg"- startIcon={SearchIcon}- />- <div- style={{- maxHeight: 560,- overflowY: 'auto',- display: 'flex',- flexDirection: 'column',- gap: 16,- }}>- {(['official', 'community'] as const).map(category => {- const entries = THEME_PICKER_ENTRIES.filter(- e =>- e.category === category &&- e.name- .toLowerCase()- .includes(themeSearch.toLowerCase()),- );- if (entries.length === 0) {- return null;- }- return (- <div key={category}>- <div style={{marginBottom: 8}}>- <XDSText type="supporting" color="secondary">- {category.charAt(0).toUpperCase() +- category.slice(1)}- </XDSText>- </div>- <div- style={{- display: 'grid',- gridTemplateColumns: '1fr 1fr 1fr',- gap: 8,- }}>- {entries.map(entry => {- const isSelected =- selectedTheme === entry.key;- const isPinned = pinnedThemes.has(entry.key);- const p = entry.preview;- return (- <div- key={entry.key}- style={{- borderRadius: 12,- overflow: 'hidden',- cursor: 'pointer',- border: isSelected- ? '1.5px solid var(--color-accent)'- : '1px solid var(--color-border-emphasized)',- transition: 'border-color 0.15s ease',- }}>- <div- onClick={() => {- setSelectedTheme(entry.key);- setThemeBrowseOpen(false);- setThemeSearch('');- }}- style={{- height: 100,- backgroundColor: p.bg,- display: 'flex',- flexDirection: 'column',- overflow: 'hidden',- }}>- <div- style={{- height: 14,- backgroundColor: p.surface,- borderBottom: `1px solid ${p.text}1A`,- display: 'flex',- alignItems: 'center',- paddingInline: 8,- gap: 4,- }}>- <div- style={{- width: 5,- height: 5,- borderRadius: '50%',- backgroundColor: p.accent,- }}- />- <div- style={{- width: 16,- height: 2,- borderRadius: 1,- backgroundColor: p.text,- opacity: 0.3,- }}- />- </div>- <div- style={{- flex: 1,- padding: 8,- display: 'flex',- flexDirection: 'column',- gap: 5,- }}>- <div- style={{- width: '65%',- height: 4,- borderRadius: 2,- backgroundColor: p.text,- opacity: 0.6,- }}- />- <div- style={{- width: '45%',- height: 3,- borderRadius: 1.5,- backgroundColor: p.text,- opacity: 0.25,- }}- />- <div- style={{- width: 28,- height: 10,- borderRadius: 4,- backgroundColor: p.accent,- marginTop: 'auto',- }}- />- </div>- </div>- <div- style={{- display: 'flex',- alignItems: 'center',- justifyContent: 'space-between',- padding: '6px 8px',- backgroundColor:- 'var(--color-surface, #f5f5f5)',- }}>- <div- style={{- display: 'flex',- alignItems: 'center',- gap: 6,- }}>- {(() => {- const Logo = BRAND_LOGOS[entry.key];- return Logo ? (- <Logo width={14} height={14} />- ) : (- <div- style={{- width: 14,- height: 14,- borderRadius: '50%',- backgroundColor: entry.accent,- }}- />- );- })()}- <XDSText- type="supporting"- style={{- fontWeight: isSelected- ? 600- : 400,- }}>- {entry.name}- </XDSText>- </div>- <div- onClick={e => {- e.stopPropagation();- togglePin(entry.key);- }}- style={{- cursor: 'pointer',- display: 'flex',- padding: 2,- }}>- {isPinned ? (- <StarFilledIcon- width={14}- height={14}- style={{- color:- 'var(--color-text-primary, #111)',- }}- />- ) : (- <StarIcon- width={14}- height={14}- style={{- color:- 'var(--color-secondary, #999)',- }}- />- )}- </div>- </div>- </div>- );- })}- </div>- </div>- );- })}- </div>- </div>- }>- <XDSButton label="Browse" variant="ghost" size="sm" />- </XDSPopover>- </div>- <div- style={{- display: 'grid',- gridTemplateColumns: 'repeat(auto-fill, 44px)',- gap: 8,- marginTop: 16,- }}>- {THEME_PICKER_ENTRIES.filter(e => pinnedThemes.has(e.key)).map(- entry => {- const isSelected = selectedTheme === entry.key;- const BrandLogo = BRAND_LOGOS[entry.key];- return (- <XDSTooltip key={entry.key} content={entry.name}>- <div- onClick={() => setSelectedTheme(entry.key)}- style={{- width: 44,- height: 44,- borderRadius: 10,- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- cursor: 'pointer',- border: isSelected- ? '1.5px solid var(--color-accent)'- : '1px solid var(--color-border-emphasized)',- backgroundColor: '#fff',- transition: 'border-color 0.15s ease',- }}>- {BrandLogo ? (- <BrandLogo width={28} height={28} />- ) : (- <div- style={{- width: 24,- height: 24,- borderRadius: '50%',- backgroundColor: entry.accent,- }}- />- )}- </div>- </XDSTooltip>- );- },- )}- </div>- </div>- </XDSVStack>- </div>-- {/* More like this */}- {moreLikeThis && moreLikeThis.length > 0 && (- <div style={{padding: '0 32px'}}>- <XDSHeading level={3}>More like this</XDSHeading>- <div- style={{- display: 'grid',- gridTemplateColumns: 'repeat(4, 1fr)',- gap: 12,- marginTop: 16,- }}>- {moreLikeThis.map(mlItem => (- <XDSCard- key={mlItem.key}- padding={0}- onClick={() => {- if (onMoreLikeThisClick) {- setTransitioning(true);- setTimeout(() => {- onMoreLikeThisClick(mlItem);- scrollRef.current?.scrollTo({top: 0});- setTimeout(() => setTransitioning(false), 50);- }, 250);- }- }}- style={{- cursor: 'pointer',- aspectRatio: '16/10',- overflow: 'hidden',- }}>- {mlItem.slug ? (- <iframe- src={`${basePath}/templates/${mlItem.slug}/?embed=1`}- sandbox="allow-scripts allow-same-origin"- title={mlItem.name}- loading="lazy"- style={{- width: '100%',- height: '100%',- border: 'none',- display: 'block',- pointerEvents: 'none',- opacity: transitioning ? 0 : 1,- transition: 'opacity 250ms ease',- }}- />- ) : (- <img- src={mlItem.themeImages?.[selectedTheme] ?? mlItem.img}- alt={mlItem.name}- style={{- width: '100%',- height: '100%',- objectFit: 'cover',- objectPosition: 'top',- display: 'block',- opacity: transitioning ? 0 : 1,- transition: 'opacity 250ms ease',- animation: transitioning- ? 'none'- : 'previewFadeIn 300ms ease',- }}- />- )}- </XDSCard>- ))}- </div>- </div>- )}-- {/* Explore more */}- {exploreTags && exploreTags.length > 0 && (- <div style={{padding: '32px 32px 0'}}>- <XDSHeading level={3}>Explore more</XDSHeading>- <div- style={{- display: 'flex',- flexWrap: 'wrap',- gap: 8,- marginTop: 16,- opacity: transitioning ? 0 : 1,- transition: 'opacity 250ms ease',- animation: transitioning ? 'none' : 'previewFadeIn 300ms ease',- }}>- {exploreTags.map(tag => (- <XDSToken- key={tag}- label={tag}- xstyle={tokenStyles.pill}- style={{backgroundColor: 'transparent', cursor: 'pointer'}}- onClick={() => onExploreTagClick?.(tag)}- />- ))}- </div>- </div>- )}-- {/* Component used */}- {componentTags && componentTags.length > 0 && (- <div style={{padding: '32px 32px 32px'}}>- <XDSHeading level={3}>Component used</XDSHeading>- <div- style={{- display: 'flex',- flexWrap: 'wrap',- gap: 8,- marginTop: 16,- opacity: transitioning ? 0 : 1,- transition: 'opacity 250ms ease',- animation: transitioning ? 'none' : 'previewFadeIn 300ms ease',- }}>- {componentTags.map(c => (- <XDSToken- key={c}- label={c}- xstyle={tokenStyles.outline}- style={{backgroundColor: 'transparent', cursor: 'pointer'}}- onClick={() => onComponentTagClick?.(c)}- />- ))}- </div>- </div>- )}- </div>- </XDSDialog>- );-}diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/ThemeEditorView.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/ThemeEditorView.tsxdeleted file mode 100644index c32ccdb01c..0000000000--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/ThemeEditorView.tsx+++ /dev/null@@ -1,5244 +0,0 @@-// Copyright (c) Meta Platforms, Inc. and affiliates.--'use client';--import * as React from 'react';-import {XDSButton} from '@xds/core/Button';-import {XDSIconButton} from '@xds/core/IconButton';-import {XDSToggleButton, XDSToggleButtonGroup} from '@xds/core/ToggleButton';-import {XDSTextInput} from '@xds/core/TextInput';-import {XDSNumberInput} from '@xds/core/NumberInput';-import {XDSBadge} from '@xds/core/Badge';-import {XDSCard} from '@xds/core/Card';-import {XDSHStack, XDSVStack} from '@xds/core/Stack';-import {- XDSLayout,- XDSLayoutHeader,- XDSLayoutContent,- XDSLayoutFooter,-} from '@xds/core/Layout';-import {XDSText, XDSHeading} from '@xds/core/Text';-import {XDSSwitch} from '@xds/core/Switch';-import {XDSAvatar} from '@xds/core/Avatar';-import {XDSBanner} from '@xds/core/Banner';-import {XDSChatToolCalls} from '@xds/core/Chat';-import type {XDSChatToolCallItem} from '@xds/core/Chat';-import {XDSTabList, XDSTab} from '@xds/core/TabList';-import {XDSDialog, XDSDialogHeader} from '@xds/core/Dialog';-import {XDSToken} from '@xds/core/Token';-import {XDSSlider} from '@xds/core/Slider';-import {XDSSelector} from '@xds/core/Selector';-import {XDSProgressBar} from '@xds/core/ProgressBar';-import {XDSCheckboxInput} from '@xds/core/CheckboxInput';-import {XDSRadioList, XDSRadioListItem} from '@xds/core/RadioList';-import {XDSTable, proportional, pixel} from '@xds/core/Table';-import type {XDSTableColumn} from '@xds/core/Table';-import {XDSDivider} from '@xds/core/Divider';-import {XDSDropdownMenu} from '@xds/core/DropdownMenu';-import {XDSPopover} from '@xds/core/Popover';-import {XDSHoverCard} from '@xds/core/HoverCard';-import {XDSTooltip} from '@xds/core/Tooltip';-import {XDSSpinner} from '@xds/core/Spinner';-import {XDSCodeBlock} from '@xds/core/CodeBlock';-import {- XDSSegmentedControl,- XDSSegmentedControlItem,-} from '@xds/core/SegmentedControl';-import {XDSSkeleton} from '@xds/core/Skeleton';-import {XDSStatusDot} from '@xds/core/StatusDot';-import {XDSIcon} from '@xds/core/Icon';-import {XDSLink} from '@xds/core/Link';-import {XDSBreadcrumbs, XDSBreadcrumbItem} from '@xds/core/Breadcrumbs';-import {XDSCollapsible, XDSCollapsibleGroup} from '@xds/core/Collapsible';-import {XDSCalendar} from '@xds/core/Calendar';-import {XDSList, XDSListItem} from '@xds/core/List';-import {XDSAppShell} from '@xds/core/AppShell';-import {- XDSSideNav,- XDSSideNavItem,- XDSSideNavSection,- XDSSideNavCollapseButton,- XDSSideNavHeading,-} from '@xds/core/SideNav';-import {XDSNavIcon} from '@xds/core/NavIcon';-import {XDSPowerSearch, usePowerSearchConfig} from '@xds/core/PowerSearch';-import type {PowerSearchFilter} from '@xds/core/PowerSearch';-import {- XDSTheme,- defineTheme,- expandTypeScale,- expandRadiusScale,- expandColorScale,- generateThemeCSSFlat,-} from '@xds/core/theme';-import type {XDSDefinedTheme} from '@xds/core/theme';-import {templates} from '../../../../generated/templateRegistry';-import {- colorDefaults,- spacingDefaults,- radiusDefaults,- typographyDefaults,- textSizeDefaults,- fontWeightDefaults,- typeScaleDefaults,- sizeDefaults,- shadowDefaults,- durationDefaults,- easeDefaults,- transitionDefaults,-} from '@xds/core/theme';-import {defaultIconRegistry} from '@xds/theme-default';-import {- HomeIcon,- FolderIcon,- CubeIcon,- XMarkIcon,- ChartBarIcon,- UserGroupIcon,- DocumentTextIcon,- SwatchIcon,- Square3Stack3DIcon,- StopIcon,- LanguageIcon,- ArrowsPointingOutIcon,- SunIcon,- ClockIcon,- BoltIcon,- SparklesIcon,- CodeBracketIcon,- ViewfinderCircleIcon,- ArrowLeftIcon,-} from '@heroicons/react/24/outline';-import {- HomeIcon as HomeIconSolid,- FolderIcon as FolderIconSolid,-} from '@heroicons/react/24/solid';-import {MoonIcon, ContrastIcon} from './docsite-icons';--// =============================================================================-// Font Options (shared between Body and Heading selectors)-// =============================================================================--const FONT_OPTIONS = [- {- value:- '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',- label: 'System (Default)',- },- {value: '"Inter", -apple-system, sans-serif', label: 'Inter'},- {value: '"Roboto", -apple-system, sans-serif', label: 'Roboto'},- {value: '"DM Sans", -apple-system, sans-serif', label: 'DM Sans'},- {value: '"Figtree", -apple-system, sans-serif', label: 'Figtree'},- {value: '"Poppins", -apple-system, sans-serif', label: 'Poppins'},- {- value: '"IBM Plex Sans", -apple-system, sans-serif',- label: 'IBM Plex Sans',- },- {- value: '"Source Sans 3", -apple-system, sans-serif',- label: 'Source Sans',- },- {value: '"Noto Sans", -apple-system, sans-serif', label: 'Noto Sans'},- {value: 'Georgia, "Times New Roman", serif', label: 'Georgia (Serif)'},-];--// =============================================================================-// Collapsible Section-// =============================================================================--function CollapsibleSection({- title,- children,- onTarget,-}: {- id: string;- title: string;- collapsed?: Record<string, boolean>;- onToggle?: (id: string) => void;- children: React.ReactNode;- defaultIsOpen?: boolean;- onTarget?: () => void;-}) {- return (- <XDSVStack gap={3}>- <XDSHStack gap={1} align="center">- <XDSText type="label" weight="semibold">- {title}- </XDSText>- {onTarget && (- <XDSIconButton- icon={<ViewfinderCircleIcon width="1em" height="1em" />}- label={`Highlight ${title} in preview`}- variant="ghost"- size="sm"- onClick={onTarget}- />- )}- </XDSHStack>- {children}- </XDSVStack>- );-}--// =============================================================================-// Token Groups-// =============================================================================--const TOKEN_GROUP_ICONS: Record<- string,- React.ComponentType<React.SVGProps<SVGSVGElement>>-> = {- colors: SwatchIcon,- spacing: Square3Stack3DIcon,- radius: StopIcon,- typography: LanguageIcon,- size: ArrowsPointingOutIcon,- shadow: SunIcon,- duration: ClockIcon,- easing: BoltIcon,-};--const TOKEN_GROUPS = {- colors: {- label: 'Colors',- description:- 'Semantic color tokens for text, backgrounds, borders, and states',- tokens: colorDefaults,- },- spacing: {- label: 'Spacing',- description: 'Consistent spacing scale for margins, padding, and gaps',- tokens: spacingDefaults,- },- radius: {- label: 'Radius',- description: 'Border radius tokens for rounded corners',- tokens: radiusDefaults,- },- typography: {- label: 'Typography',- description: 'Font families, sizes, weights, and line heights',- tokens: {- ...typographyDefaults,- ...textSizeDefaults,- ...fontWeightDefaults,- },- },- size: {- label: 'Size',- description: 'Component size tokens (sm, md, lg)',- tokens: sizeDefaults,- },- shadow: {- label: 'Elevation',- description: 'Shadow tokens',- tokens: shadowDefaults,- },- duration: {- label: 'Duration',- description: 'Motion duration tokens',- tokens: durationDefaults,- },- easing: {- label: 'Easing',- description: 'Motion easing tokens',- tokens: easeDefaults,- },-} as const;--type TokenGroupKey = keyof typeof TOKEN_GROUPS;--// =============================================================================-// Component-Scoped CSS Custom Properties-// =============================================================================--interface ComponentVar {- name: string;- default: string;- description: string;- options: Array<{value: string; label: string}>;-}--const RADIUS_OPTIONS = [- {value: 'var(--radius-none)', label: 'None — 0px'},- {value: 'var(--radius-inner)', label: 'Inner — 2px'},- {value: 'var(--radius-element)', label: 'Element — 4px'},- {value: 'var(--radius-container)', label: 'Container — 8px'},- {value: 'var(--radius-page)', label: 'Page — 16px'},- {value: 'var(--radius-full)', label: 'Full — 9999px'},-];--const SPACING_OPTIONS = [- {value: 'var(--spacing-0-5)', label: '0.5'},- {value: 'var(--spacing-1)', label: '1'},- {value: 'var(--spacing-2)', label: '2'},- {value: 'var(--spacing-3)', label: '3'},- {value: 'var(--spacing-4)', label: '4'},- {value: 'var(--spacing-6)', label: '6'},- {value: 'var(--spacing-8)', label: '8'},-];--const COMPONENT_VAR_TO_OVERRIDE: Record<- string,- {component: string; cssProperty: string}-> = {- '--button-radius': {component: 'button', cssProperty: 'borderRadius'},- '--button-focus-offset': {- component: 'button',- cssProperty: '--button-focus-offset',- },- '--button-icon-only-aspect': {- component: 'button',- cssProperty: '--button-icon-only-aspect',- },- '--card-radius': {component: 'card', cssProperty: 'borderRadius'},- '--dialog-radius': {component: 'dialog', cssProperty: 'borderRadius'},- '--dropdown-radius': {- component: 'dropdown-menu',- cssProperty: 'borderRadius',- },- '--dropdown-padding': {component: 'dropdown-menu', cssProperty: 'padding'},- '--popover-radius': {component: 'popover', cssProperty: 'borderRadius'},- '--hovercard-radius': {component: 'hovercard', cssProperty: 'borderRadius'},- '--input-radius': {component: 'field', cssProperty: 'borderRadius'},- '--banner-radius': {component: 'banner', cssProperty: 'borderRadius'},- '--composer-radius': {- component: 'chat-composer',- cssProperty: 'borderRadius',- },- '--composer-padding': {component: 'chat-composer', cssProperty: 'padding'},-};--const COMPONENT_VARS: Record<string, {label: string; vars: ComponentVar[]}> = {- button: {- label: 'Button',- vars: [- {- name: '--button-radius',- default: 'var(--radius-element)',- description: 'Border radius',- options: RADIUS_OPTIONS,- },- {- name: '--button-press-scale',- default: 'scale(0.98)',- description: 'Active press transform',- options: [- {value: 'scale(1)', label: 'None'},- {value: 'scale(0.99)', label: 'Subtle'},- {value: 'scale(0.98)', label: 'Default'},- {value: 'scale(0.96)', label: 'Strong'},- {value: 'scale(0.94)', label: 'Heavy'},- ],- },- {- name: '--button-disabled-opacity',- default: '0.5',- description: 'Opacity when disabled',- options: [- {value: '0.3', label: '0.3'},- {value: '0.4', label: '0.4'},- {value: '0.5', label: '0.5 (Default)'},- {value: '0.6', label: '0.6'},- {value: '0.7', label: '0.7'},- {value: '1', label: '1.0 (Opaque)'},- ],- },- {- name: '--button-focus-offset',- default: '3px',- description: 'Focus ring outline offset',- options: [- {value: '1px', label: '1px'},- {value: '2px', label: '2px'},- {value: '3px', label: '3px (Default)'},- {value: '4px', label: '4px'},- {value: '6px', label: '6px'},- ],- },- {- name: '--button-icon-only-aspect',- default: '1 / 1',- description: 'Aspect ratio for icon-only buttons',- options: [- {value: '1 / 1', label: '1:1 Square (Default)'},- {value: 'auto', label: 'Auto'},- ],- },- ],- },- card: {- label: 'Card',- vars: [- {- name: '--card-radius',- default: 'var(--radius-container)',- description: 'Border radius',- options: RADIUS_OPTIONS,- },- ],- },- dialog: {- label: 'Dialog',- vars: [- {- name: '--dialog-radius',- default: 'var(--radius-container)',- description: 'Border radius',- options: RADIUS_OPTIONS,- },- ],- },- 'dropdown-menu': {- label: 'Dropdown Menu',- vars: [- {- name: '--dropdown-radius',- default: 'var(--radius-element)',- description: 'Border radius of menu popup',- options: RADIUS_OPTIONS,- },- {- name: '--dropdown-padding',- default: 'var(--spacing-1)',- description: 'Inner padding of menu popup',- options: SPACING_OPTIONS,- },- ],- },- popover: {- label: 'Popover',- vars: [- {- name: '--popover-radius',- default: 'var(--radius-element)',- description: 'Border radius',- options: RADIUS_OPTIONS,- },- ],- },- hovercard: {- label: 'Hover Card',- vars: [- {- name: '--hovercard-radius',- default: 'var(--radius-container)',- description: 'Border radius',- options: RADIUS_OPTIONS,- },- ],- },- field: {- label: 'Field / Input',- vars: [- {- name: '--input-radius',- default: 'var(--radius-element)',- description: 'Border radius of input fields',- options: RADIUS_OPTIONS,- },- ],- },- banner: {- label: 'Banner',- vars: [- {- name: '--banner-radius',- default: 'var(--radius-container)',- description: 'Border radius',- options: RADIUS_OPTIONS,- },- ],- },- 'chat-composer': {- label: 'Chat Composer',- vars: [- {- name: '--composer-radius',- default: 'var(--radius-page)',- description: 'Border radius of composer body',- options: RADIUS_OPTIONS,- },- {- name: '--composer-padding',- default: 'var(--spacing-3)',- description: 'Padding of composer body',- options: SPACING_OPTIONS,- },- ],- },-};--const RATIO_OPTIONS = [- {value: 1.067, label: '1.067 — Minor Second'},- {value: 1.125, label: '1.125 — Major Second'},- {value: 1.2, label: '1.200 — Minor Third'},- {value: 1.25, label: '1.250 — Major Third'},- {value: 1.333, label: '1.333 — Perfect Fourth'},- {value: 1.414, label: '1.414 — Augmented Fourth'},- {value: 1.5, label: '1.500 — Perfect Fifth'},- {value: 1.618, label: '1.618 — Golden Ratio'},-];--// =============================================================================-// Color Categories-// =============================================================================--const COLOR_CATEGORIES = {- 'Core Semantic': [- '--color-accent',- '--color-accent-muted',- '--color-neutral',- '--color-overlay',- ],- 'Interactive States': [- '--color-overlay-hover',- '--color-overlay-pressed',- '--color-accent',- '--color-error',- '--color-success',- '--color-warning',- '--color-background-muted',- ],- Text: [- '--color-text-primary',- '--color-text-secondary',- '--color-text-disabled',- '--color-text-accent',- '--color-on-dark',- ],- Icon: [- '--color-icon-primary',- '--color-icon-secondary',- '--color-icon-disabled',- ],- 'Surface Variants': [- '--color-background-surface',- '--color-background-body',- '--color-background-card',- '--color-background-popover',- ],- 'Status/Sentiment': [- '--color-success',- '--color-success-muted',- '--color-error',- '--color-error-muted',- '--color-warning',- '--color-warning-muted',- ],- Divider: ['--color-border', '--color-border-emphasized'],- Effects: ['--color-skeleton', '--color-shadow', '--color-tint-hover'],- 'Palette: Blue': [- '--color-background-blue',- '--color-border-blue',- '--color-icon-blue',- '--color-text-blue',- ],- 'Palette: Green': [- '--color-background-green',- '--color-border-green',- '--color-icon-green',- '--color-text-green',- ],- 'Palette: Red': [- '--color-background-red',- '--color-border-red',- '--color-icon-red',- '--color-text-red',- ],- 'Palette: Yellow': [- '--color-background-yellow',- '--color-border-yellow',- '--color-icon-yellow',- '--color-text-yellow',- ],- 'Palette: Orange': [- '--color-background-orange',- '--color-border-orange',- '--color-icon-orange',- '--color-text-orange',- ],- 'Palette: Purple': [- '--color-background-purple',- '--color-border-purple',- '--color-icon-purple',- '--color-text-purple',- ],- 'Palette: Pink': [- '--color-background-pink',- '--color-border-pink',- '--color-icon-pink',- '--color-text-pink',- ],- 'Palette: Teal': [- '--color-background-teal',- '--color-border-teal',- '--color-icon-teal',- '--color-text-teal',- ],- 'Palette: Cyan': [- '--color-background-cyan',- '--color-border-cyan',- '--color-icon-cyan',- '--color-text-cyan',- ],- 'Palette: Gray': [- '--color-background-gray',- '--color-border-gray',- '--color-icon-gray',- '--color-text-gray',- ],-} as const;--// =============================================================================-// Typography Categories-// =============================================================================--const TYPOGRAPHY_CATEGORIES = {- 'Font Families': [- '--font-family-body',- '--font-family-heading',- '--font-family-code',- ],- 'Heading 1': {- description: 'Primary page title (24px default)',- tokens: [- '--text-heading-1-size',- '--text-heading-1-weight',- '--text-heading-1-leading',- ],- },- 'Heading 2': {- description: 'Section title (20px default)',- tokens: [- '--text-heading-2-size',- '--text-heading-2-weight',- '--text-heading-2-leading',- ],- },- 'Heading 3': {- description: 'Subsection title (17px default)',- tokens: [- '--text-heading-3-size',- '--text-heading-3-weight',- '--text-heading-3-leading',- ],- },- 'Heading 4': {- description: 'Card/component title (14px — base anchor)',- tokens: [- '--text-heading-4-size',- '--text-heading-4-weight',- '--text-heading-4-leading',- ],- },- 'Heading 5': {- description: 'Minor heading (12px default)',- tokens: [- '--text-heading-5-size',- '--text-heading-5-weight',- '--text-heading-5-leading',- ],- },- 'Heading 6': {- description: 'Smallest heading (10px default)',- tokens: [- '--text-heading-6-size',- '--text-heading-6-weight',- '--text-heading-6-leading',- ],- },- 'Body Text': {- description: 'Default paragraph text',- tokens: ['--text-body-size', '--text-body-weight', '--text-body-leading'],- },- 'Large Text': {- description: 'Intro/lead paragraphs',- tokens: [- '--text-large-size',- '--text-large-weight',- '--text-large-leading',- ],- },- 'Label Text': {- description: 'Form labels, UI labels',- tokens: [- '--text-label-size',- '--text-label-weight',- '--text-label-leading',- ],- },- 'Supporting Text': {- description: 'Captions, helper text',- tokens: [- '--text-supporting-size',- '--text-supporting-weight',- '--text-supporting-leading',- ],- },- 'Code Text': {- description: 'Inline code, code blocks',- tokens: ['--text-code-size', '--text-code-weight', '--text-code-leading'],- },- 'All Text Sizes': [- '--font-size-4xs',- '--font-size-3xs',- '--font-size-2xs',- '--font-size-xs',- '--font-size-sm',- '--font-size-base',- '--font-size-lg',- '--font-size-xl',- '--font-size-2xl',- '--font-size-3xl',- '--font-size-4xl',- ],- 'All Font Weights': [- '--font-weight-normal',- '--font-weight-medium',- '--font-weight-semibold',- '--font-weight-bold',- ],- 'All Line Heights': [- '--leading-tight',- '--leading-snug',- '--leading-base',- '--leading-normal',- '--leading-relaxed',- ],-} as const;--// =============================================================================-// Helper Functions-// =============================================================================--function parseLightDark(value: string): {light: string; dark: string} | null {- const match = value.match(/^light-dark\(([^,]+),\s*([^)]+)\)$/);- if (match) {- return {light: match[1].trim(), dark: match[2].trim()};- }- return null;-}--function parseColorWithAlpha(- value: string,-): {hex: string; alpha: number} | null {- const hex8Match = value.match(/^#([0-9A-Fa-f]{8})$/);- if (hex8Match) {- const hex = '#' + hex8Match[1].slice(0, 6);- const alpha = parseInt(hex8Match[1].slice(6, 8), 16) / 255;- return {hex, alpha: Math.round(alpha * 100) / 100};- }- const hex6Match = value.match(/^#([0-9A-Fa-f]{6})$/);- if (hex6Match) {- return {hex: value, alpha: 1};- }- const hex3Match = value.match(/^#([0-9A-Fa-f]{3})$/);- if (hex3Match) {- const r = hex3Match[1][0];- const g = hex3Match[1][1];- const b = hex3Match[1][2];- return {hex: `#${r}${r}${g}${g}${b}${b}`, alpha: 1};- }- const rgbaMatch = value.match(- /rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/,- );- if (rgbaMatch) {- const r = parseInt(rgbaMatch[1], 10).toString(16).padStart(2, '0');- const g = parseInt(rgbaMatch[2], 10).toString(16).padStart(2, '0');- const b = parseInt(rgbaMatch[3], 10).toString(16).padStart(2, '0');- const alpha = rgbaMatch[4] ? parseFloat(rgbaMatch[4]) : 1;- return {hex: `#${r}${g}${b}`, alpha};- }- return null;-}--function colorWithAlphaToString(hex: string, alpha: number): string {- if (alpha >= 1) {- return hex.toUpperCase();- }- const alphaHex = Math.round(alpha * 255)- .toString(16)- .padStart(2, '0');- return `${hex}${alphaHex}`.toUpperCase();-}--function getTokenLabel(tokenName: string): string {- return tokenName- .replace(/^--/, '')- .replace(/-/g, ' ')- .replace(/\b\w/g, c => c.toUpperCase());-}--// =============================================================================-// Token Editor Components-// =============================================================================--function ColorSwatch({- tokenName,- value,- onChange,- mode,-}: {- tokenName: string;- value: string;- onChange: (tokenName: string, value: string) => void;- mode: 'light' | 'dark';-}) {- const parsed = parseLightDark(value);- const displayValue = parsed- ? mode === 'light'- ? parsed.light- : parsed.dark- : value;- const colorParsed = parseColorWithAlpha(displayValue);- const hasColorPicker = colorParsed !== null;-- const handleColorChange = (newHex: string, newAlpha?: number) => {- const alpha = newAlpha ?? colorParsed?.alpha ?? 1;- const newColor = colorWithAlphaToString(newHex, alpha);- const newValue = parsed- ? mode === 'light'- ? `light-dark(${newColor}, ${parsed.dark})`- : `light-dark(${parsed.light}, ${newColor})`- : newColor;- onChange(tokenName, newValue);- };-- return (- <div- style={{- padding: '10px 0',- display: 'flex',- alignItems: 'center',- justifyContent: 'space-between',- gap: 12,- }}>- <XDSText- type="supporting"- color="primary"- maxLines={1}- style={{flexShrink: 0}}>- {getTokenLabel(tokenName)}- </XDSText>- <div- style={{- display: 'flex',- alignItems: 'center',- gap: 8,- flexShrink: 0,- justifyContent: 'flex-end',- }}>- <div- style={{- width: 28,- height: 28,- borderRadius: 6,- backgroundColor: displayValue,- border: '1px solid var(--color-border-emphasized)',- flexShrink: 0,- position: 'relative',- cursor: hasColorPicker ? 'pointer' : undefined,- backgroundImage:- colorParsed && colorParsed.alpha < 1- ? `linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(-45deg, #ccc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ccc 75%), linear-gradient(-45deg, transparent 75%, #ccc 75%)`- : undefined,- backgroundSize: '8px 8px',- backgroundPosition: '0 0, 0 4px, 4px -4px, -4px 0px',- }}>- <div- style={{- width: '100%',- height: '100%',- borderRadius: 6,- backgroundColor: displayValue,- pointerEvents: 'none',- }}- />- {hasColorPicker && colorParsed && (- <input- type="color"- value={colorParsed.hex}- onChange={e => handleColorChange(e.target.value)}- style={{- position: 'absolute',- inset: 0,- width: '100%',- height: '100%',- opacity: 0,- cursor: 'pointer',- border: 'none',- padding: 0,- zIndex: 1,- }}- />- )}- </div>- <XDSTextInput- label={tokenName}- isLabelHidden- size="sm"- value={- hasColorPicker && colorParsed- ? `${colorParsed.hex} ${Math.round(colorParsed.alpha * 100)}%`- : displayValue- }- onChange={(val: string) => {- const parts = val.trim().split(/\s+/);- const hex = parts[0] || '';- const pctStr = parts.find(p => p.endsWith('%'));- const alpha = pctStr- ? Math.min(100, Math.max(0, Number(pctStr.replace('%', '')))) /- 100- : (colorParsed?.alpha ?? 1);- if (hex.startsWith('#') && hex.length >= 4) {- handleColorChange(hex, alpha);- } else {- const newValue = parsed- ? mode === 'light'- ? `light-dark(${val}, ${parsed.dark})`- : `light-dark(${parsed.light}, ${val})`- : val;- onChange(tokenName, newValue);- }- }}- style={{width: 120}}- />- </div>- </div>- );-}--function SpacingEditor({- tokenName,- value,- onChange,-}: {- tokenName: string;- value: string;- onChange: (tokenName: string, value: string) => void;-}) {- const numValue = parseInt(value, 10);- return (- <XDSHStack- gap={3}- vAlign="center"- style={{- padding: '8px 12px',- borderRadius: 8,- backgroundColor: 'var(--color-background-body)',- }}>- <div- style={{- width: Math.min(numValue, 48),- height: 24,- backgroundColor: 'var(--color-accent)',- borderRadius: 4,- flexShrink: 0,- }}- />- <XDSVStack gap={0} style={{flex: 1, minWidth: 0}}>- <XDSText type="supporting" color="primary" maxLines={1}>- {getTokenLabel(tokenName)}- </XDSText>- <XDSText type="supporting" color="secondary" maxLines={1}>- {tokenName}- </XDSText>- </XDSVStack>- <div style={{width: 80}}>- <XDSTextInput- label="Value"- isLabelHidden- value={value}- onChange={val => onChange(tokenName, val)}- size="sm"- />- </div>- </XDSHStack>- );-}--function RadiusEditor({- tokenName,- value,- onChange,-}: {- tokenName: string;- value: string;- onChange: (tokenName: string, value: string) => void;-}) {- return (- <XDSHStack- gap={3}- vAlign="center"- style={{- padding: '8px 12px',- borderRadius: 8,- backgroundColor: 'var(--color-background-body)',- }}>- <div- style={{- width: 32,- height: 32,- backgroundColor: 'var(--color-accent)',- borderRadius: value,- flexShrink: 0,- }}- />- <XDSVStack gap={0} style={{flex: 1, minWidth: 0}}>- <XDSText type="supporting" color="primary" maxLines={1}>- {getTokenLabel(tokenName)}- </XDSText>- <XDSText type="supporting" color="secondary" maxLines={1}>- {tokenName}- </XDSText>- </XDSVStack>- <div style={{width: 80}}>- <XDSTextInput- label="Value"- isLabelHidden- value={value}- onChange={val => onChange(tokenName, val)}- size="sm"- />- </div>- </XDSHStack>- );-}--function TypographyEditor({- tokenName,- value,- onChange,-}: {- tokenName: string;- value: string;- onChange: (tokenName: string, value: string) => void;-}) {- const isFont = tokenName.includes('font-') && !tokenName.includes('weight');- const isSize = tokenName.includes('text-');- const isWeight = tokenName.includes('weight');- const isLeading = tokenName.includes('leading');-- return (- <XDSHStack- gap={3}- vAlign="center"- style={{- padding: '8px 12px',- borderRadius: 8,- backgroundColor: 'var(--color-background-body)',- }}>- <div- style={{- width: 48,- height: 32,- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- fontSize: isSize ? value : '14px',- fontWeight: isWeight ? value : 400,- fontFamily: isFont ? value : 'inherit',- lineHeight: isLeading ? value : 1.4,- color: 'var(--color-text-primary)',- flexShrink: 0,- }}>- Aa- </div>- <XDSVStack gap={0} style={{flex: 1, minWidth: 0}}>- <XDSText type="supporting" color="primary" maxLines={1}>- {getTokenLabel(tokenName)}- </XDSText>- <XDSText type="supporting" color="secondary" maxLines={1}>- {tokenName}- </XDSText>- </XDSVStack>- <div style={{width: 200}}>- <XDSTextInput- label="Value"- isLabelHidden- value={value}- onChange={val => onChange(tokenName, val)}- size="sm"- />- </div>- </XDSHStack>- );-}--// =============================================================================-// Preview Components-// =============================================================================--const ROW: React.CSSProperties = {- display: 'flex',- alignItems: 'center',- justifyContent: 'space-between',-};-const FULL_W: React.CSSProperties = {width: '100%'};-const CHART: React.CSSProperties = {- display: 'flex',- alignItems: 'flex-end',- gap: 'var(--spacing-1)',- height: 80,-};-const BAR_BASE: React.CSSProperties = {- flex: 1,- borderRadius: 'var(--radius-inner)',- backgroundColor: 'var(--color-accent)',- minWidth: 0,-};-const SEC_BOX: React.CSSProperties = {- backgroundColor: 'var(--color-background-muted)',- borderRadius: 'var(--radius-container)',- padding: 'var(--spacing-3)',-};-const CARD_WRAP: React.CSSProperties = {- breakInside: 'avoid' as const,- marginBottom: 'var(--spacing-6)',-};--function Sparkline({values}: {values: number[]}) {- return (- <XDSHStack gap={0.5} vAlign="end">- {values.map((v, i) => (- <div- key={i}- style={{- width: 4,- height: v,- borderRadius: 2,- backgroundColor: 'var(--color-accent)',- }}- />- ))}- </XDSHStack>- );-}--function ComponentPreview() {- const [settingsTab, setSettingsTab] = React.useState('general');- const [brightness, setBrightness] = React.useState(65);- const [colorTemp, setColorTemp] = React.useState(45);- const [switch1, setSwitch1] = React.useState(false);- const [switch2, setSwitch2] = React.useState(true);- const [check1, setCheck1] = React.useState(false);- const [check2, setCheck2] = React.useState(true);- const [sliderValue, setSliderValue] = React.useState(50);- const [selectorValue, setSelectorValue] = React.useState('Apple');- const [progressValue, setProgressValue] = React.useState(65);- const [interactionsTab, setInteractionsTab] = React.useState('overview');-- return (- <div- style={{- columnCount: 3,- columnGap: 'var(--spacing-6)',- minHeight: '100%',- }}>- {/* Contribution History */}- <div style={CARD_WRAP}>- <XDSCard>- <XDSLayout- height="auto"- header={- <XDSLayoutHeader>- <XDSVStack gap={1}>- <div style={ROW}>- <XDSHeading level={3}>Contribution History</XDSHeading>- <XDSBadge label="+12% vs last month" variant="info" />- </div>- <XDSText type="supporting" color="secondary">- Last 6 months of activity- </XDSText>- </XDSVStack>- </XDSLayoutHeader>- }- content={- <XDSLayoutContent>- <XDSVStack gap={3}>- <div style={CHART}>- {[40, 55, 60, 70, 55, 65].map((h, i) => (- <div key={i} style={{...BAR_BASE, height: h}} />- ))}- </div>- <XDSHStack gap={4}>- {['Dec', 'Jan', 'Feb', 'Mar', 'Apr', 'May'].map(m => (- <XDSText key={m} type="supporting" color="secondary">- {m}- </XDSText>- ))}- </XDSHStack>- <XDSDivider variant="strong" />- <XDSHStack gap={3}>- <div style={{...SEC_BOX, flex: 1}}>- <XDSVStack gap={1}>- <XDSText type="supporting" color="secondary">- UPCOMING- </XDSText>- <XDSText type="label">May 25, 2024</XDSText>- <XDSText type="supporting" color="secondary">- $1,000 scheduled- </XDSText>- </XDSVStack>- </div>- <div style={{...SEC_BOX, flex: 1}}>- <XDSVStack gap={1}>- <XDSText type="supporting" color="secondary">- AUTO-SAVE PLAN- </XDSText>- <XDSText type="label">Accelerated</XDSText>- <XDSText type="supporting" color="secondary">- Recurring weekly- </XDSText>- </XDSVStack>- </div>- </XDSHStack>- </XDSVStack>- </XDSLayoutContent>- }- footer={- <XDSLayoutFooter>- <XDSButton- label="View Full Report"- variant="primary"- style={FULL_W}- />- </XDSLayoutFooter>- }- />- </XDSCard>- </div>- {/* Savings Targets */}- <div style={CARD_WRAP}>- <XDSCard>- <XDSLayout- height="auto"- header={- <XDSLayoutHeader>- <div style={ROW}>- <XDSHeading level={3}>Savings Targets</XDSHeading>- <XDSButton label="New Goal" size="sm" />- </div>- </XDSLayoutHeader>- }- content={- <XDSLayoutContent>- <XDSVStack gap={4}>- <XDSBanner- status="info"- title="On Track"- description="Your retirement savings are ahead of schedule by $12,000 this quarter."- />- <XDSText type="supporting" color="secondary">- Active milestones for 2024- </XDSText>- <XDSVStack gap={1}>- <XDSText type="supporting" color="secondary">- RETIREMENT- </XDSText>- <XDSHeading level={2}>$420,000</XDSHeading>- <XDSProgressBar label="Retirement" value={65} />- <div style={ROW}>- <XDSText type="supporting" color="secondary">- 65% achieved- </XDSText>- <XDSText type="supporting" color="secondary">- $273,000- </XDSText>- </div>- </XDSVStack>- <XDSVStack gap={1}>- <XDSText type="supporting" color="secondary">- REAL ESTATE- </XDSText>- <XDSHeading level={2}>$85,000</XDSHeading>- <XDSProgressBar label="Real Estate" value={32} />- <div style={ROW}>- <XDSText type="supporting" color="secondary">- 32% achieved- </XDSText>- <XDSText type="supporting" color="secondary">- $27,200- </XDSText>- </div>- </XDSVStack>- </XDSVStack>- </XDSLayoutContent>- }- />- </XDSCard>- </div>- {/* Buy Investment */}- <div style={CARD_WRAP}>- <XDSCard>- <XDSLayout- height="auto"- header={- <XDSLayoutHeader>- <XDSHeading level={3}>Buy Investment</XDSHeading>- </XDSLayoutHeader>- }- content={- <XDSLayoutContent>- <XDSVStack gap={4}>- <XDSTextInput- label="Amount to Invest"- value="1,000.00"- onChange={() => {}}- />- <XDSSelector- label="Order Type"- options={['Market Order', 'Limit Order', 'Stop Order']}- value="Market Order"- onChange={() => {}}- />- <XDSText type="supporting" color="secondary">- Market orders execute at the current price.- </XDSText>- <XDSDivider variant="strong" />- <div style={ROW}>- <XDSText type="body">Estimated Shares</XDSText>- <XDSText type="body" weight="bold">- 1.95- </XDSText>- </div>- <div style={ROW}>- <XDSText type="body">Buying Power</XDSText>- <XDSText type="body" weight="bold">- $12,450.00- </XDSText>- </div>- </XDSVStack>- </XDSLayoutContent>- }- footer={- <XDSLayoutFooter>- <XDSButton- label="Review Order"- variant="primary"- style={FULL_W}- />- </XDSLayoutFooter>- }- />- </XDSCard>- </div>- {/* Recent Transactions */}- <div style={CARD_WRAP}>- <XDSCard>- <XDSLayout- height="auto"- header={- <XDSLayoutHeader>- <div style={ROW}>- <XDSVStack gap={1}>- <XDSHeading level={3}>Recent Transactions</XDSHeading>- <XDSText type="supporting" color="secondary">- Your latest account activity.- </XDSText>- </XDSVStack>- <XDSLink href="#">View All</XDSLink>- </div>- </XDSLayoutHeader>- }- content={- <XDSLayoutContent>- <XDSTable- data={[- {- id: '1',- name: 'Blue Bottle Coffee',- cat: 'Food & Drink',- date: 'Today, 10:24 AM',- amt: '-$6.50',- },- {- id: '2',- name: 'Whole Foods Market',- cat: 'Groceries',- date: 'Yesterday',- amt: '-$142.30',- },- {- id: '3',- name: 'Stripe Payout',- cat: 'Income',- date: 'Oct 12',- amt: '+$4,200.00',- },- {- id: '4',- name: 'Uber Technologies',- cat: 'Transport',- date: 'Oct 11',- amt: '-$24.10',- },- ]}- idKey="id"- density="compact"- isStriped- dividers="none"- columns={[- {- key: 'name',- header: '',- width: proportional(2),- renderCell: (txn: {name: string; cat: string}) => (- <XDSHStack gap={3} vAlign="center">- <XDSAvatar name={txn.name} size="small" />- <XDSVStack gap={0}>- <XDSText type="body" weight="bold">- {txn.name}- </XDSText>- <XDSText type="supporting" color="secondary">- {txn.cat}- </XDSText>- </XDSVStack>- </XDSHStack>- ),- },- {- key: 'amt',- header: '',- width: proportional(1),- renderCell: (txn: {amt: string; date: string}) => (- <XDSVStack gap={0} style={{alignItems: 'flex-end'}}>- <XDSText type="body" weight="bold">- {txn.amt}- </XDSText>- <XDSText type="supporting" color="secondary">- {txn.date}- </XDSText>- </XDSVStack>- ),- },- ]}- />- </XDSLayoutContent>- }- />- </XDSCard>- </div>- {/* Stock Performance */}- <div style={CARD_WRAP}>- <XDSCard>- <XDSVStack gap={3}>- <XDSHeading level={3}>Stock Performance</XDSHeading>- <XDSText type="supporting" color="secondary">- 6-month price history.- </XDSText>- <XDSSelector- label="Ticker"- options={['VOO', 'AAPL', 'GOOGL', 'MSFT']}- value="VOO"- onChange={() => {}}- />- <div style={CHART}>- {[30, 45, 38, 52, 48, 55, 42, 60, 58, 65, 50, 70].map((h, i) => (- <div key={i} style={{...BAR_BASE, height: h}} />- ))}- </div>- </XDSVStack>- </XDSCard>- </div>- {/* Card Balance */}- <div style={CARD_WRAP}>- <XDSCard>- <XDSVStack gap={3}>- <div style={ROW}>- <XDSVStack gap={0}>- <XDSText type="supporting" color="secondary">- Card Balance- </XDSText>- <XDSHeading level={3}>US$12.94</XDSHeading>- <XDSText type="supporting" color="secondary">- US$ 1,337.06 Available- </XDSText>- </XDSVStack>- <XDSVStack gap={0} style={{alignItems: 'flex-end'}}>- <XDSText type="supporting" color="secondary">- Payment Due- </XDSText>- <XDSHeading level={3}>1 Apr</XDSHeading>- <XDSLink href="#">Pay Early</XDSLink>- </XDSVStack>- </div>- <XDSText type="supporting" color="secondary">- Yearly Activity- </XDSText>- <div style={CHART}>- {[20, 35, 15, 45, 30, 50, 25, 40, 55, 35, 45, 30].map((h, i) => (- <div key={i} style={{...BAR_BASE, height: h}} />- ))}- </div>- </XDSVStack>- </XDSCard>- </div>- {/* Power Usage */}- <div style={CARD_WRAP}>- <XDSCard>- <XDSVStack gap={3}>- <XDSHeading level={3}>Power Usage</XDSHeading>- <XDSText type="supporting" color="secondary">- Whole Home- </XDSText>- <div style={CHART}>- {[60, 45, 70, 55, 40, 65, 50, 35, 55, 45, 60, 50].map((h, i) => (- <div key={i} style={{...BAR_BASE, height: h}} />- ))}- </div>- <XDSDivider variant="strong" />- <div style={ROW}>- <XDSVStack gap={0}>- <XDSText type="supporting" color="secondary">- Currently Using- </XDSText>- <XDSText type="label" weight="bold">- 3.4 kW- </XDSText>- </XDSVStack>- <XDSVStack gap={0}>- <XDSText type="supporting" color="secondary">- Solar Gen- </XDSText>- <XDSText type="label" weight="bold" color="active">- +1.2 kW- </XDSText>- </XDSVStack>- </div>- <XDSVStack gap={1}>- <XDSText type="supporting" color="secondary">- Battery Level- </XDSText>- <XDSProgressBar label="Battery" value={85} hasValueLabel />- </XDSVStack>- </XDSVStack>- </XDSCard>- </div>- {/* Clearinghouse Balance */}- <div style={CARD_WRAP}>- <XDSCard>- <XDSVStack gap={4}>- <XDSText type="supporting" color="secondary">- Clearhouse Balance- </XDSText>- <XDSHeading level={1}>$0.00</XDSHeading>- <XDSHStack gap={2} vAlign="center">- <div- style={{- width: 8,- height: 8,- borderRadius: '50%',- backgroundColor: 'var(--color-success)',- }}- />- <XDSText type="supporting" color="secondary">- Pending Setup- </XDSText>- </XDSHStack>- <XDSDivider variant="strong" />- <div style={ROW}>- <XDSText type="body">Net Royalties</XDSText>- <XDSText type="body" weight="bold">- $0.00- </XDSText>- </div>- <div style={ROW}>- <XDSText type="body">Processing Fee</XDSText>- <XDSText type="body" weight="bold">- -$0.00- </XDSText>- </div>- <XDSDivider variant="strong" />- <div style={ROW}>- <XDSText type="body">Total Ready to Claim</XDSText>- <XDSText type="body" weight="bold">- $0.00 USD- </XDSText>- </div>- <XDSText type="supporting" color="secondary">- Once your bank is connected, balances over $10.00 are- automatically eligible for monthly distribution.- </XDSText>- </XDSVStack>- </XDSCard>- </div>- {/* Payout Preferences */}- <div style={CARD_WRAP}>- <XDSCard>- <XDSLayout- height="auto"- header={- <XDSLayoutHeader>- <div style={ROW}>- <XDSHeading level={3}>Payout Preferences</XDSHeading>- <XDSButton- label="Close"- icon={<XDSIcon icon="close" size="sm" />}- variant="ghost"- size="sm"- isIconOnly- />- </div>- </XDSLayoutHeader>- }- content={- <XDSLayoutContent>- <XDSVStack gap={4}>- <XDSText type="supporting" color="secondary">- Receiving Method- </XDSText>- <XDSTextInput- label="Account Holder Name"- value="Synthetic Horizons Music LLC"- onChange={() => {}}- />- <XDSRadioList- label="Receiving Method"- value="bank"- onChange={() => {}}>- <XDSRadioListItem- value="bank"- label="Bank Transfer — SWIFT / IBAN"- />- <XDSRadioListItem- value="paypal"- label="PayPal — Instant Payout"- />- </XDSRadioList>- <XDSTextInput- label="IBAN / Account Number"- value="DE89 3704 0044 ..."- onChange={() => {}}- />- </XDSVStack>- </XDSLayoutContent>- }- footer={- <XDSLayoutFooter>- <XDSButton- label="Save Payout Settings"- variant="primary"- style={FULL_W}- />- </XDSLayoutFooter>- }- />- </XDSCard>- </div>- {/* Q2 Dividend Income */}- <div style={CARD_WRAP}>- <XDSCard>- <XDSLayout- height="auto"- header={- <XDSLayoutHeader>- <div style={ROW}>- <XDSVStack gap={1}>- <XDSHeading level={3}>Q2 Dividend Income</XDSHeading>- <XDSText type="supporting" color="secondary">- Quarterly dividend payouts across your portfolio holdings.- </XDSText>- </XDSVStack>- <XDSButton- label="Close"- icon={<XDSIcon icon="close" size="sm" />}- variant="ghost"- size="sm"- isIconOnly- />- </div>- </XDSLayoutHeader>- }- content={- <XDSLayoutContent>- <XDSVStack gap={3}>- {[- {- name: 'Vanguard VIG',- shares: '450 Shares',- amt: '$1,842.10',- },- {name: 'S&P 500 VOO', shares: '112 Shares', amt: '$928.40'},- {name: 'Apple AAPL', shares: '85 Shares', amt: '$340.00'},- {- name: 'Realty Income',- shares: '320 Shares',- amt: '$1,139.50',- },- ].map((d, i) => (- <div key={i} style={ROW}>- <XDSVStack gap={0}>- <XDSText type="body" weight="bold">- {d.name}- </XDSText>- <XDSText type="supporting" color="secondary">- {d.shares}- </XDSText>- </XDSVStack>- <XDSHStack gap={2} vAlign="center">- <Sparkline values={[8, 12, 6, 15, 10, 18]} />- <XDSText type="body" weight="bold">- {d.amt}- </XDSText>- </XDSHStack>- </div>- ))}- </XDSVStack>- </XDSLayoutContent>- }- />- </XDSCard>- </div>- {/* Payments Navigation */}- <div style={CARD_WRAP}>- <XDSCard>- <XDSVStack gap={4}>- <XDSBreadcrumbs variant="supporting">- <XDSBreadcrumbItem href="#">Home</XDSBreadcrumbItem>- <XDSBreadcrumbItem href="#">...</XDSBreadcrumbItem>- <XDSBreadcrumbItem isCurrent>Payments</XDSBreadcrumbItem>- </XDSBreadcrumbs>- <XDSDivider variant="strong" />- <XDSCollapsibleGroup type="single" defaultValue="0">- {[- {- title: 'Change transfer limit',- desc: 'Adjust how much you can send from your balance.',- },- {- title: 'Scheduled transfers',- desc: 'Set up a transfer to send at a later date.',- },- {- title: 'Direct Debits',- desc: 'Set up and manage regular payments.',- },- {- title: 'Recurring card payments',- desc: 'Manage your repeated card transactions.',- },- ].map((item, i) => (- <XDSCollapsible- key={i}- value={String(i)}- defaultIsOpen={i === 0}- trigger={- <XDSText type="body" weight="bold">- {item.title}- </XDSText>- }>- <XDSText type="supporting" color="secondary">- {item.desc}- </XDSText>- </XDSCollapsible>- ))}- </XDSCollapsibleGroup>- </XDSVStack>- </XDSCard>- </div>- {/* FAQ / Settings Tabs */}- <div style={CARD_WRAP}>- <XDSCard>- <XDSLayout- height="auto"- header={- <XDSLayoutHeader>- <XDSTabList value={settingsTab} onChange={setSettingsTab}>- <XDSTab value="general" label="General" />- <XDSTab value="billing" label="Billing" />- <XDSTab value="goals" label="Goals" />- </XDSTabList>- </XDSLayoutHeader>- }- content={- <XDSLayoutContent>- <XDSVStack gap={3}>- <XDSText type="label" weight="bold">- How do I set up a custom financial goal?- </XDSText>- <XDSText type="body" color="secondary">- Click New Goal from the Savings Targets card. Choose a- category, set a target amount and date, and we'll- calculate the monthly contribution needed.- </XDSText>- <XDSDivider variant="strong" />- <XDSText type="label" weight="bold">- Can I track multiple goals at once?- </XDSText>- <XDSDivider variant="strong" />- <XDSText type="label" weight="bold">- How are monthly contributions calculated?- </XDSText>- </XDSVStack>- </XDSLayoutContent>- }- footer={- <XDSLayoutFooter>- <XDSButton- label="Contact Support"- variant="secondary"- style={FULL_W}- />- </XDSLayoutFooter>- }- />- </XDSCard>- </div>- {/* Savings Target Progress */}- <div style={CARD_WRAP}>- <XDSCard>- <XDSVStack gap={3}>- <XDSHeading level={2}>$24,000</XDSHeading>- <XDSText type="supporting" color="secondary">- 80% of $30,000- </XDSText>- <XDSProgressBar label="Savings Progress" value={80} />- <XDSDivider variant="strong" />- <div style={ROW}>- <XDSText type="body">Projected Finish</XDSText>- <XDSText type="body" weight="bold">- October 2024- </XDSText>- </div>- <div style={ROW}>- <XDSText type="body">Monthly Average</XDSText>- <XDSText type="body" weight="bold">- $1,250- </XDSText>- </div>- <div style={ROW}>- <XDSText type="body">Top Contributor</XDSText>- <XDSText type="body" weight="bold">- Auto-Transfer- </XDSText>- </div>- </XDSVStack>- </XDSCard>- </div>- {/* Kitchen Island (Smart Home) */}- <div style={CARD_WRAP}>- <XDSCard>- <XDSLayout- height="auto"- header={- <XDSLayoutHeader>- <div style={ROW}>- <XDSHeading level={3}>Kitchen Island</XDSHeading>- <XDSSwitch label="On" value={true} onChange={() => {}} />- </div>- </XDSLayoutHeader>- }- content={- <XDSLayoutContent>- <XDSVStack gap={4}>- <XDSText type="supporting" color="secondary">- Hue Color Ambient- </XDSText>- <XDSHStack gap={2}>- {['Cooking', 'Dining', 'Nightlight', 'Focus'].map(m => (- <XDSToken key={m} label={m} />- ))}- </XDSHStack>- <XDSSlider- label="Brightness"- value={brightness}- onChange={(v: number) => setBrightness(v)}- />- <XDSSlider- label="Color Temp"- value={colorTemp}- onChange={(v: number) => setColorTemp(v)}- />- </XDSVStack>- </XDSLayoutContent>- }- />- </XDSCard>- </div>- {/* Upcoming Payments */}- <div style={CARD_WRAP}>- <XDSCard>- <XDSVStack gap={3}>- <XDSHeading level={3}>Upcoming Payments</XDSHeading>- <XDSText type="supporting" color="secondary">- Select a date to view scheduled payments.- </XDSText>- <XDSCalendar />- <XDSDivider variant="strong" />- {[- {- name: 'Netflix Subscription',- date: 'Apr 15, 2024',- amt: '$19.99',- },- {name: 'Rent Payment', date: 'Apr 1, 2024', amt: '$2,400.00'},- {name: 'Auto Insurance', date: 'Apr 22, 2024', amt: '$186.00'},- ].map((p, i) => (- <div key={i} style={ROW}>- <XDSVStack gap={0}>- <XDSText type="body" weight="bold">- {p.name}- </XDSText>- <XDSText type="supporting" color="secondary">- {p.date}- </XDSText>- </XDSVStack>- <XDSText type="body" weight="bold">- {p.amt}- </XDSText>- </div>- ))}- </XDSVStack>- </XDSCard>- </div>- {/* Syncing Accounts */}- <div style={CARD_WRAP}>- <XDSCard>- <XDSLayout- height="auto"- content={- <XDSLayoutContent>- <XDSHStack gap={3} vAlign="center">- <XDSSpinner size="sm" />- <XDSVStack gap={1}>- <XDSHeading level={3}>Syncing your accounts</XDSHeading>- <XDSText type="supporting" color="secondary">- We're pulling in your latest transactions. This- usually takes a few seconds.- </XDSText>- </XDSVStack>- </XDSHStack>- </XDSLayoutContent>- }- footer={- <XDSLayoutFooter>- <XDSButton label="Cancel" variant="ghost" style={FULL_W} />- </XDSLayoutFooter>- }- />- </XDSCard>- </div>- {/* Notifications */}- <div style={CARD_WRAP}>- <XDSCard>- <XDSLayout- height="auto"- header={- <XDSLayoutHeader>- <XDSVStack gap={1}>- <XDSHeading level={3}>Notifications</XDSHeading>- <XDSText type="supporting" color="secondary">- Choose what you want to be notified about.- </XDSText>- </XDSVStack>- </XDSLayoutHeader>- }- content={- <XDSLayoutContent>- <XDSVStack gap={4}>- <XDSCheckboxInput- label="Transaction alerts"- value={true}- onChange={() => {}}- />- <XDSText type="supporting" color="secondary">- Deposits, withdrawals, and transfers.- </XDSText>- <XDSCheckboxInput- label="Security alerts"- value={false}- onChange={() => {}}- />- <XDSText type="supporting" color="secondary">- Login attempts and account changes.- </XDSText>- <XDSCheckboxInput- label="Goal milestones"- value={false}- onChange={() => {}}- />- <XDSText type="supporting" color="secondary">- Updates at 25%, 50%, 75%, and 100%.- </XDSText>- </XDSVStack>- </XDSLayoutContent>- }- footer={- <XDSLayoutFooter>- <XDSButton- label="Save Preferences"- variant="primary"- style={FULL_W}- />- </XDSLayoutFooter>- }- />- </XDSCard>- </div>- {/* Dollar-Cost Averaging */}- <div style={CARD_WRAP}>- <XDSCard>- <XDSVStack gap={3}>- <XDSHeading level={3}>Dollar-Cost Averaging</XDSHeading>- <XDSText type="supporting" color="secondary">- A strategy for building wealth over time.- </XDSText>- <XDSText type="body" color="secondary">- Over time, this smooths out the average cost of your investments.- When prices drop, your fixed amount buys more shares. When prices- rise, you buy fewer.- </XDSText>- </XDSVStack>- </XDSCard>- </div>- {/* Buttons & Overlays */}- <div style={CARD_WRAP}>- <XDSCard>- <XDSVStack gap={4}>- <XDSHeading level={3}>Buttons & Overlays</XDSHeading>- <XDSHStack gap={2} wrap="wrap">- <XDSButton label="Primary" variant="primary" onClick={() => {}} />- <XDSButton- label="Secondary"- variant="secondary"- onClick={() => {}}- />- <XDSButton label="Ghost" variant="ghost" onClick={() => {}} />- <XDSDropdownMenu- button={{label: 'Dropdown', variant: 'secondary'}}- items={[- {label: 'Edit', onClick: () => {}},- {label: 'Duplicate', onClick: () => {}},- {type: 'divider' as const},- {label: 'Delete', onClick: () => {}},- ]}- />- </XDSHStack>- <XDSDivider variant="strong" />- <XDSHStack gap={2} vAlign="center" wrap="wrap">- <XDSPopover- content={<PopoverSettingsContent />}- placement="below">- <XDSButton label="Popover" variant="secondary" size="sm" />- </XDSPopover>- <XDSHoverCard- content={- <XDSVStack gap={1} style={{padding: 12, maxWidth: 240}}>- <XDSText type="label" display="block">- HoverCard- </XDSText>- <XDSText type="supporting" color="secondary">- Hover to trigger.- </XDSText>- </XDSVStack>- }- placement="below">- <XDSButton- label="HoverCard"- variant="secondary"- size="sm"- onClick={() => {}}- />- </XDSHoverCard>- <XDSTooltip content="Tooltip preview">- <XDSButton- label="Tooltip"- variant="secondary"- size="sm"- onClick={() => {}}- />- </XDSTooltip>- </XDSHStack>- </XDSVStack>- </XDSCard>- </div>- {/* Form Controls */}- <div style={CARD_WRAP}>- <XDSCard>- <XDSVStack gap={4}>- <XDSHeading level={3}>Form Controls</XDSHeading>- <XDSHStack gap={4} wrap="wrap">- <XDSSwitch- label="Switch A"- value={switch1}- onChange={setSwitch1}- />- <XDSSwitch- label="Switch B"- value={switch2}- onChange={setSwitch2}- />- <XDSCheckboxInput- label="Check A"- value={check1}- onChange={setCheck1}- />- <XDSCheckboxInput- label="Check B"- value={check2}- onChange={setCheck2}- />- </XDSHStack>- <XDSDivider variant="strong" />- <XDSHStack gap={4} vAlign="end">- <div style={{flex: 1, maxWidth: 200}}>- <XDSSlider- label="Volume"- value={sliderValue}- onChange={setSliderValue}- min={0}- max={100}- />- </div>- <div style={{maxWidth: 160}}>- <XDSSelector- label="Fruit"- options={['Apple', 'Banana', 'Orange', 'Mango']}- value={selectorValue}- onChange={setSelectorValue}- />- </div>- </XDSHStack>- </XDSVStack>- </XDSCard>- </div>- {/* Loading & Status */}- <div style={CARD_WRAP}>- <XDSCard>- <XDSVStack gap={4}>- <XDSHeading level={3}>Loading & Status</XDSHeading>- <XDSHStack gap={4} vAlign="center">- <XDSSpinner size="sm" />- <XDSSpinner size="md" />- <XDSSpinner size="lg" />- </XDSHStack>- <XDSDivider variant="strong" />- <XDSVStack gap={2}>- <XDSHStack gap={3} vAlign="center">- <XDSSkeleton- width={40}- height={40}- radius="rounded"- index={0}- />- <XDSVStack gap={1} style={{flex: 1}}>- <XDSSkeleton width={160} height={14} index={1} />- <XDSSkeleton width={100} height={10} index={2} />- </XDSVStack>- </XDSHStack>- <XDSSkeleton width="100%" height={12} index={3} />- <XDSSkeleton width="80%" height={12} index={4} />- </XDSVStack>- <XDSDivider variant="strong" />- <XDSVStack gap={3}>- <XDSProgressBar- value={progressValue}- label={`${progressValue}%`}- />- <XDSHStack gap={2}>- {[0, 25, 50, 75, 100].map(v => (- <XDSButton- key={v}- label={`${v}%`}- variant="ghost"- size="sm"- onClick={() => setProgressValue(v)}- />- ))}- </XDSHStack>- </XDSVStack>- <XDSDivider variant="strong" />- <XDSHStack gap={4} vAlign="center">- <XDSHStack gap={2} vAlign="center">- <XDSStatusDot variant="success" label="Online" isPulsing />- <XDSText type="body">Online</XDSText>- </XDSHStack>- <XDSHStack gap={2} vAlign="center">- <XDSStatusDot variant="warning" label="Away" isPulsing />- <XDSText type="body">Away</XDSText>- </XDSHStack>- <XDSHStack gap={2} vAlign="center">- <XDSStatusDot variant="error" label="Busy" isPulsing />- <XDSText type="body">Busy</XDSText>- </XDSHStack>- </XDSHStack>- </XDSVStack>- </XDSCard>- </div>- {/* Surface Interactions */}- <div style={CARD_WRAP}>- <XDSCard>- <XDSVStack gap={4}>- <XDSHeading level={3}>Surface Interactions</XDSHeading>- <XDSTabList value={interactionsTab} onChange={setInteractionsTab}>- <XDSTab value="overview" label="Overview" />- <XDSTab value="analytics" label="Analytics" />- <XDSTab value="reports" label="Reports" />- <XDSTab value="settings" label="Settings" />- </XDSTabList>- <XDSDivider variant="strong" />- <XDSList density="balanced">- <XDSListItem- label="Dashboard"- description="View your metrics"- onClick={() => {}}- />- <XDSListItem- label="Projects"- description="Manage active projects"- onClick={() => {}}- />- <XDSListItem- label="Settings"- description="Configure preferences"- onClick={() => {}}- />- </XDSList>- </XDSVStack>- </XDSCard>- </div>- </div>- );-}--function LandingPagePreview() {- return (- <div style={{display: 'flex', flexDirection: 'column', gap: '48px'}}>- <div style={{textAlign: 'center', padding: '48px 24px'}}>- <XDSBadge variant="info" label="New Release" />- <XDSHeading level={1} style={{marginTop: 16, marginBottom: 12}}>- Ship faster with XDS- </XDSHeading>- <XDSText- type="large"- color="secondary"- display="block"- style={{- marginBottom: 24,- maxWidth: 520,- marginLeft: 'auto',- marginRight: 'auto',- }}>- A design system for building internal tools. Open internals, plugin- architecture, and automatic spacing.- </XDSText>- <div style={{display: 'flex', gap: '8px', justifyContent: 'center'}}>- <XDSButton label="Get Started" />- <XDSButton label="Documentation" variant="secondary" />- </div>- </div>- <XDSDivider variant="strong" />- <div>- <XDSHeading level={2} style={{marginBottom: 16}}>- Features- </XDSHeading>- <div- style={{- display: 'grid',- gridTemplateColumns: 'repeat(3, 1fr)',- gap: '16px',- }}>- {[- {- title: 'Open Internals',- desc: 'All primitives exported and composable. No black boxes.',- },- {- title: 'Plugin Architecture',- desc: 'Transform and extend components through a unified plugin system.',- },- {- title: 'AI-Ready',- desc: 'JSDoc annotations with composition hints for LLM-assisted development.',- },- ].map(f => (- <XDSCard key={f.title} padding={3}>- <XDSHeading level={3} style={{marginBottom: 8}}>- {f.title}- </XDSHeading>- <XDSText type="body" color="secondary">- {f.desc}- </XDSText>- </XDSCard>- ))}- </div>- </div>- <XDSCard padding={4}>- <XDSText type="large" display="block" style={{marginBottom: 12}}>- “XDS cut our dev time in half. The type scale system alone saved- us weeks of bikeshedding.”- </XDSText>- <div style={{display: 'flex', alignItems: 'center', gap: '8px'}}>- <XDSAvatar name="Alex Chen" size="small" />- <div>- <XDSText type="label">Alex Chen</XDSText>- <XDSText type="supporting" color="secondary">- {' '}- · Engineering Lead- </XDSText>- </div>- </div>- </XDSCard>- <div style={{textAlign: 'center', padding: '32px 0'}}>- <XDSHeading level={2} style={{marginBottom: 8}}>- Ready to build?- </XDSHeading>- <XDSText- type="body"- color="secondary"- display="block"- style={{marginBottom: 16}}>- Get started with XDS in under 5 minutes.- </XDSText>- <XDSButton label="Start Building" />- </div>- </div>- );-}--interface MetricRow extends Record<string, unknown> {- metric: string;- value: string;- change: string;- trend: 'up' | 'down' | 'flat';-}--const dashboardColumns: XDSTableColumn<MetricRow>[] = [- {key: 'metric', header: 'Metric'},- {key: 'value', header: 'Value'},- {key: 'change', header: 'Change'},-];--function DashboardPreview() {- const [tab, setTab] = React.useState('overview');- const metrics: MetricRow[] = [- {metric: 'Total Users', value: '12,847', change: '+12.3%', trend: 'up'},- {metric: 'Active Sessions', value: '3,421', change: '+8.1%', trend: 'up'},- {- metric: 'Avg Response Time',- value: '142ms',- change: '-5.2%',- trend: 'down',- },- {metric: 'Error Rate', value: '0.03%', change: '-18.7%', trend: 'down'},- {metric: 'API Calls (24h)', value: '2.4M', change: '+3.1%', trend: 'up'},- {metric: 'Storage Used', value: '847 GB', change: '+1.2%', trend: 'flat'},- ];-- return (- <div style={{display: 'flex', flexDirection: 'column', gap: '24px'}}>- <div- style={{- display: 'flex',- justifyContent: 'space-between',- alignItems: 'center',- }}>- <div>- <XDSHeading level={1}>Dashboard</XDSHeading>- <XDSText type="supporting" color="secondary">- Last updated 2 minutes ago- </XDSText>- </div>- <div style={{display: 'flex', gap: '8px'}}>- <XDSButton label="Export" variant="secondary" size="sm" />- <XDSButton label="Refresh" size="sm" />- </div>- </div>- <div- style={{- display: 'grid',- gridTemplateColumns: 'repeat(4, 1fr)',- gap: '12px',- }}>- {[- {label: 'Revenue', value: '$48.2K', delta: '+12%'},- {label: 'Users', value: '12,847', delta: '+8%'},- {label: 'Uptime', value: '99.97%', delta: '—'},- {label: 'NPS', value: '72', delta: '+3'},- ].map(kpi => (- <XDSCard key={kpi.label} padding={3}>- <XDSText type="supporting" color="secondary" display="block">- {kpi.label}- </XDSText>- <XDSHeading level={2} style={{marginTop: 4}}>- {kpi.value}- </XDSHeading>- <XDSText- type="supporting"- color={kpi.delta.startsWith('+') ? 'active' : 'secondary'}>- {kpi.delta}- </XDSText>- </XDSCard>- ))}- </div>- <div>- <XDSTabList value={tab} onChange={setTab}>- <XDSTab value="overview" label="Overview" />- <XDSTab value="performance" label="Performance" />- <XDSTab value="errors" label="Errors" />- </XDSTabList>- <div style={{marginTop: '16px'}}>- <XDSTable- columns={dashboardColumns}- data={metrics}- density="compact"- />- </div>- </div>- <XDSBanner- status="info"- title="System Update"- description="A new version of the API is available. Review the changelog for breaking changes."- endContent={- <XDSButton label="View Changelog" variant="secondary" size="sm" />- }- />- <div- style={{display: 'grid', gridTemplateColumns: '2fr 1fr', gap: '16px'}}>- <XDSCard padding={3}>- <XDSHeading level={3} style={{marginBottom: 12}}>- Recent Activity- </XDSHeading>- {[- {- user: 'Sarah K.',- action: 'deployed v2.4.1 to production',- time: '5 min ago',- },- {- user: 'Mike R.',- action: 'merged PR #247: fix auth flow',- time: '23 min ago',- },- {- user: 'Cindy Z.',- action: 'created issue #312: token audit',- time: '1 hr ago',- },- {- user: 'Alex C.',- action: 'updated dashboard metrics query',- time: '2 hr ago',- },- ].map((item, i) => (- <div- key={i}- style={{- display: 'flex',- alignItems: 'center',- gap: '8px',- padding: '8px 0',- borderBottom: i < 3 ? '1px solid var(--color-divider)' : 'none',- }}>- <XDSAvatar name={item.user} size="small" />- <div style={{flex: 1}}>- <XDSText type="label">{item.user}</XDSText>- <XDSText type="body" color="secondary">- {' '}- {item.action}- </XDSText>- </div>- <XDSText type="supporting" color="secondary">- {item.time}- </XDSText>- </div>- ))}- </XDSCard>- <XDSCard padding={3}>- <XDSHeading level={3} style={{marginBottom: 12}}>- Quick Stats- </XDSHeading>- <div style={{display: 'flex', flexDirection: 'column', gap: '12px'}}>- {[- {label: 'CPU Usage', value: 43},- {label: 'Memory', value: 67},- {label: 'Storage', value: 82},- ].map(stat => (- <div key={stat.label}>- <div- style={{- display: 'flex',- justifyContent: 'space-between',- marginBottom: '4px',- }}>- <XDSText type="supporting">{stat.label}</XDSText>- <XDSText type="supporting" color="secondary">- {stat.value}%- </XDSText>- </div>- <XDSProgressBar- value={stat.value}- label={stat.label}- isLabelHidden- />- </div>- ))}- </div>- </XDSCard>- </div>- </div>- );-}--// Minimal motion preview sub-components — kept compact since the full-// MotionPreview table page provides the richest test surface.--function PopoverSettingsContent() {- const [notifications, setNotifications] = React.useState(true);- const [darkMode, setDarkMode] = React.useState(false);- const [sounds, setSounds] = React.useState(true);-- return (- <XDSVStack gap={3} style={{width: 240}}>- <XDSText type="label" display="block">- Settings- </XDSText>- <XDSDivider variant="strong" />- <XDSSwitch- label="Notifications"- description="Receive push notifications"- value={notifications}- onChange={setNotifications}- />- <XDSSwitch- label="Dark mode"- description="Use dark color theme"- value={darkMode}- onChange={setDarkMode}- />- <XDSSwitch- label="Sounds"- description="Play sounds for actions"- value={sounds}- onChange={setSounds}- />- </XDSVStack>- );-}--function MotionPreview() {- const [sidebarCollapsed, setSidebarCollapsed] = React.useState(false);- const [overlayOpen, setOverlayOpen] = React.useState(false);- const [pushOpen, setPushOpen] = React.useState(false);- const [selectedUser, setSelectedUser] = React.useState<{- id: string;- name: string;- email: string;- role: string;- } | null>(null);- const [modalOpen, setModalOpen] = React.useState(false);- const containerRef = React.useRef<HTMLDivElement>(null);- const [containerWidth, setContainerWidth] = React.useState(1200);-- React.useEffect(() => {- const el = containerRef.current;- if (!el) {- return;- }- const ro = new ResizeObserver(entries => {- for (const entry of entries) {- setContainerWidth(entry.contentRect.width);- }- });- ro.observe(el);- return () => ro.disconnect();- }, []);-- const [filters, setFilters] = React.useState<PowerSearchFilter[]>([]);- const fieldDefs = [- {key: 'name', type: 'string', label: 'Name'},- {key: 'email', type: 'string', label: 'Email'},- {- key: 'role',- type: 'enum',- label: 'Role',- enumValues: [- {value: 'engineer', label: 'Engineer'},- {value: 'designer', label: 'Designer'},- {value: 'pm', label: 'PM'},- ],- },- ] as const;- const {config, applyFilters} = usePowerSearchConfig(fieldDefs, 'Users');-- const allUsers = [- {- id: '1',- name: 'Alice Johnson',- email: '[email protected]',- role: 'engineer',- },- {id: '2', name: 'Bob Smith', email: '[email protected]', role: 'designer'},- {id: '3', name: 'Charlie Brown', email: '[email protected]', role: 'pm'},- {- id: '4',- name: 'Diana Prince',- email: '[email protected]',- role: 'engineer',- },- {id: '5', name: 'Eve Davis', email: '[email protected]', role: 'designer'},- ];- const filteredUsers = applyFilters(filters, allUsers);- const roleLabels: Record<string, string> = {- Engineer: 'Engineer',- Designer: 'Designer',- PM: 'PM',- engineer: 'Engineer',- designer: 'Designer',- pm: 'PM',- };-- const tableColumns: XDSTableColumn<(typeof allUsers)[0]>[] = [- {key: 'name', header: 'Name', width: proportional(2)},- ...(containerWidth > 975- ? [{key: 'email' as const, header: 'Email', width: proportional(2)}]- : []),- {- key: 'role',- header: 'Role',- width: pixel(120),- renderCell: (user: (typeof allUsers)[0]) =>- roleLabels[user.role] ?? user.role,- },- ];-- const dur = {- medMin: 'var(--duration-medium-min)',- med: 'var(--duration-medium)',- };- const ease = 'var(--ease-standard)';- const motionSlideIn = `${dur.med} ${ease}`;- const motionSlideOut = `${dur.medMin} ${ease}`;-- return (- <div- ref={containerRef}- style={{- border: '1px solid var(--color-border)',- borderRadius: '12px',- overflow: 'hidden',- height: '630px',- position: 'relative',- fontFamily: 'var(--font-family-body)',- fontSize: 'var(--font-size-base)',- lineHeight: 'var(--leading-base)',- color: 'var(--color-text-primary)',- }}>- <XDSAppShell- height="fill"- style={{height: '100%'}}- variant="section"- contentPadding={0}- sideNav={- <XDSSideNav- collapsible={{- isCollapsed: sidebarCollapsed,- onCollapsedChange: setSidebarCollapsed,- hasButton: false,- }}- header={- <XDSSideNavHeading- icon={- <XDSNavIcon- icon={<CubeIcon style={{width: 16, height: 16}} />}- />- }- heading="My App"- headingHref="/"- />- }- footerIcons={<XDSSideNavCollapseButton />}>- <XDSSideNavSection title="Main">- <XDSSideNavItem- label="Dashboard"- icon={HomeIcon}- selectedIcon={HomeIconSolid}- isSelected- onClick={() => {}}- />- <XDSSideNavItem- label="Projects"- icon={FolderIcon}- selectedIcon={FolderIconSolid}- onClick={() => {}}- endContent={<XDSBadge label="3" />}- />- <XDSSideNavItem- label="Analytics"- icon={ChartBarIcon}- onClick={() => {}}- />- <XDSSideNavItem- label="Team"- icon={UserGroupIcon}- onClick={() => {}}- />- </XDSSideNavSection>- <XDSSideNavSection title="Documents">- <XDSSideNavItem- label="All Documents"- icon={DocumentTextIcon}- onClick={() => {}}- />- </XDSSideNavSection>- </XDSSideNav>- }>- <div style={{display: 'flex', flexDirection: 'column', height: '100%'}}>- <div- style={{- padding: '12px var(--spacing-3)',- display: 'flex',- flexDirection: 'column',- gap: '12px',- borderBottom: '1px solid var(--color-border)',- }}>- <XDSHeading level={2}>Users</XDSHeading>- <div style={{display: 'flex', alignItems: 'center', gap: '8px'}}>- <div style={{flex: 1}}>- <XDSPowerSearch- config={config}- filters={filters}- onChange={newFilters => setFilters([...newFilters])}- placeholder="Search..."- label="Filter users"- resultCount={filteredUsers.length}- />- </div>- <XDSHStack gap={1}>- <XDSButton- label="Modal"- variant="secondary"- onClick={() => setModalOpen(true)}- />- <XDSButton- label="Overlay"- variant={overlayOpen ? 'primary' : 'secondary'}- onClick={() => setOverlayOpen(!overlayOpen)}- />- <XDSButton- label="Push"- variant="secondary"- onClick={() => setPushOpen(!pushOpen)}- />- </XDSHStack>- </div>- </div>- <div- style={{- display: 'flex',- flex: 1,- overflow: 'hidden',- position: 'relative',- }}>- <div- style={{- flex: 1,- overflow: 'auto',- minWidth: 0,- cursor: 'pointer',- }}- onClick={e => {- const row = (e.target as HTMLElement).closest('tr');- if (- !row ||- !row.parentElement ||- row.parentElement.tagName === 'THEAD'- ) {- return;- }- const index = Array.from(row.parentElement.children).indexOf(- row,- );- const user = filteredUsers[index];- if (user) {- setSelectedUser(user);- setPushOpen(true);- }- }}>- <XDSTable- data={filteredUsers}- columns={tableColumns}- hasHover- idKey="id"- />- </div>- <div- style={{- position: 'absolute',- top: 0,- right: 0,- bottom: 0,- width: '40%',- maxWidth: '480px',- borderLeft: '1px solid var(--color-border)',- backgroundColor: 'var(--color-background-surface)',- transform: overlayOpen ? 'translateX(0)' : 'translateX(100%)',- opacity: overlayOpen ? 1 : 0,- transition: overlayOpen- ? `transform ${motionSlideIn}, opacity ${motionSlideIn}`- : `transform ${motionSlideOut}, opacity ${motionSlideOut}`,- display: 'flex',- flexDirection: 'column',- zIndex: 5,- }}>- <div- style={{- padding: 'var(--spacing-2) var(--spacing-3)',- borderBottom: '1px solid var(--color-border)',- display: 'flex',- alignItems: 'center',- justifyContent: 'space-between',- }}>- <XDSText type="label">Details</XDSText>- <XDSButton- label="Close"- icon={<XMarkIcon style={{width: 16, height: 16}} />}- variant="ghost"- size="sm"- onClick={() => setOverlayOpen(false)}- isIconOnly- />- </div>- </div>- <div- style={{- flexShrink: 0,- width: pushOpen ? '40%' : '0px',- maxWidth: pushOpen ? '480px' : '0px',- overflow: 'hidden',- borderLeft: pushOpen ? '1px solid var(--color-border)' : 'none',- backgroundColor: 'var(--color-background-surface)',- opacity: pushOpen ? 1 : 0,- transition: pushOpen- ? `width ${motionSlideIn}, max-width ${motionSlideIn}, opacity ${motionSlideIn}`- : `width ${motionSlideOut}, max-width ${motionSlideOut}, opacity ${motionSlideOut}`,- display: 'flex',- flexDirection: 'column',- }}>- <div- style={{- padding: 'var(--spacing-2) var(--spacing-3)',- borderBottom: '1px solid var(--color-border)',- display: 'flex',- alignItems: 'center',- justifyContent: 'space-between',- whiteSpace: 'nowrap',- }}>- <XDSText type="label">- {selectedUser?.name ?? 'Details'}- </XDSText>- <XDSButton- label="Close"- icon={<XMarkIcon style={{width: 16, height: 16}} />}- variant="ghost"- size="sm"- onClick={() => setPushOpen(false)}- isIconOnly- />- </div>- {selectedUser && (- <div- style={{padding: 'var(--spacing-3)', whiteSpace: 'nowrap'}}>- <XDSVStack gap={2}>- <div>- <XDSText- type="supporting"- color="secondary"- display="block">- </XDSText>- <XDSText type="body">{selectedUser.email}</XDSText>- </div>- <div>- <XDSText- type="supporting"- color="secondary"- display="block">- Role- </XDSText>- <XDSText type="body">- {roleLabels[selectedUser.role] ?? selectedUser.role}- </XDSText>- </div>- </XDSVStack>- </div>- )}- </div>- </div>- </div>- </XDSAppShell>- <XDSDialog isOpen={modalOpen} onOpenChange={setModalOpen}>- <div style={{padding: 'var(--spacing-3)', flex: 1}}>- <XDSText type="body" color="secondary">- Modal dialog with directional entry animation.- </XDSText>- </div>- <div- style={{- padding: 'var(--spacing-2) var(--spacing-3)',- borderTop: '1px solid var(--color-border)',- display: 'flex',- justifyContent: 'flex-end',- gap: 'var(--spacing-2)',- }}>- <XDSButton- label="Cancel"- variant="secondary"- onClick={() => setModalOpen(false)}- />- <XDSButton- label="Confirm"- variant="primary"- onClick={() => setModalOpen(false)}- />- </div>- </XDSDialog>- </div>- );-}--// =============================================================================-// Token Scale Preview-// =============================================================================--const SECTION_STYLE: React.CSSProperties = {- display: 'flex',- flexDirection: 'column',- gap: 12,-};--const SECTION_TITLE: React.CSSProperties = {- fontSize: 11,- fontWeight: 600,- textTransform: 'uppercase',- letterSpacing: '0.05em',- color: '#888',-};--const SCALE_ROW: React.CSSProperties = {- display: 'grid',- gridTemplateColumns: '1fr 200px 200px',- alignItems: 'center',- gap: 8,-};--const CODE_LABEL: React.CSSProperties = {- fontSize: 12,- fontFamily: 'monospace',- color: '#888',- whiteSpace: 'nowrap',- overflow: 'hidden',- textOverflow: 'ellipsis',-};--function TokenScalePreview({tokens}: {tokens: Record<string, string>}) {- const resolveSize = (raw: string) => {- if (!raw) {- return raw;- }- const resolved = raw.startsWith('var(')- ? tokens[raw.slice(4, -1)] || raw- : raw;- return resolved;- };- const toPx = (raw: string) => {- const resolved = resolveSize(raw);- if (resolved.endsWith('rem')) {- return `${Math.round(parseFloat(resolved) * 16)}px`;- }- return resolved;- };-- const colorsSection = (- <div style={SECTION_STYLE}>- <span style={SECTION_TITLE}>Colors</span>- <div style={{display: 'flex', flexDirection: 'column', gap: 4}}>- {[- {token: '--color-accent', label: 'accent'},- {token: '--color-accent-muted', label: 'accent-muted'},- {token: '--color-neutral', label: 'neutral'},- {token: '--color-background-card', label: 'card'},- {token: '--color-background-surface', label: 'surface'},- {token: '--color-text-primary', label: 'text'},- {token: '--color-text-secondary', label: 'text-secondary'},- {token: '--color-border', label: 'border'},- ].map(({token, label}) => {- const raw = tokens[token] || '';- const parsed = parseLightDark(raw);- const displayVal = parsed ? parsed.light : raw;- return (- <div key={token} style={SCALE_ROW}>- <div- style={{- width: 48,- height: 48,- borderRadius: 8,- backgroundColor: `var(${token})`,- border: '1px solid #ddd',- flexShrink: 0,- }}- />- <span style={CODE_LABEL}>{label}</span>- <span style={CODE_LABEL}>{displayVal}</span>- </div>- );- })}- </div>- </div>- );-- const typographySection = (- <div style={SECTION_STYLE}>- <span style={SECTION_TITLE}>Typography</span>- <div style={{display: 'flex', flexDirection: 'column', gap: 8}}>- {(['display-1', 'display-2', 'display-3'] as const).map(type => (- <div key={type} style={SCALE_ROW}>- <div style={{overflow: 'hidden'}}>- <XDSText type={type} maxLines={1}>- Display- </XDSText>- </div>- <span style={CODE_LABEL}>{type}</span>- <span style={CODE_LABEL}>- {toPx(tokens[`--text-${type}-size`] || '')}- </span>- </div>- ))}- {([1, 2, 3, 4] as const).map(level => (- <div key={level} style={SCALE_ROW}>- <div style={{overflow: 'hidden'}}>- <XDSHeading level={level} maxLines={1}>- Heading {level}- </XDSHeading>- </div>- <span style={CODE_LABEL}>h{level}</span>- <span style={CODE_LABEL}>- {toPx(tokens[`--text-heading-${level}-size`] || '')}- </span>- </div>- ))}- {(['large', 'body', 'label', 'supporting', 'code'] as const).map(- type => (- <div key={type} style={SCALE_ROW}>- <div style={{overflow: 'hidden'}}>- <XDSText type={type} maxLines={1}>- {type === 'code'- ? 'const theme = defineTheme()'- : 'The quick brown fox'}- </XDSText>- </div>- <span style={CODE_LABEL}>{type}</span>- <span style={CODE_LABEL}>- {toPx(tokens[`--text-${type}-size`] || '')}- </span>- </div>- ),- )}- </div>- </div>- );-- const spacingSection = (- <div style={SECTION_STYLE}>- <span style={SECTION_TITLE}>Spacing</span>- <div style={{display: 'flex', flexDirection: 'column', gap: 4}}>- {[0.5, 1, 2, 3, 4, 6, 8, 12].map(step => {- const key = String(step).replace('.', '-');- const val = tokens[`--spacing-${key}`] || '0px';- return (- <div key={step} style={SCALE_ROW}>- <div style={{display: 'flex', alignItems: 'center'}}>- <div- style={{- width: val,- height: val,- backgroundColor: 'var(--color-accent-muted)',- border: '1px dashed var(--color-accent)',- transition: 'width 200ms ease, height 200ms ease',- }}- />- </div>- <span style={CODE_LABEL}>{step}</span>- <span style={CODE_LABEL}>{val}</span>- </div>- );- })}- </div>- </div>- );-- const radiusSection = (- <div style={SECTION_STYLE}>- <span style={SECTION_TITLE}>Corner Radius</span>- <div style={{display: 'flex', flexDirection: 'column', gap: 8}}>- {(['none', 'inner', 'element', 'container', 'page'] as const).map(- name => {- const val = tokens[`--radius-${name}`] || '0px';- return (- <div key={name} style={SCALE_ROW}>- <div- style={{- width: 48,- height: 48,- backgroundColor: 'var(--color-accent-muted)',- border: '1px dashed var(--color-accent)',- borderRadius: val,- flexShrink: 0,- transition: 'border-radius 200ms ease',- }}- />- <span style={CODE_LABEL}>{name}</span>- <span style={CODE_LABEL}>{val}</span>- </div>- );- },- )}- </div>- </div>- );-- const sizeSection = (- <div style={SECTION_STYLE}>- <span style={SECTION_TITLE}>Element Size</span>- <div style={{display: 'flex', flexDirection: 'column', gap: 8}}>- {(['sm', 'md', 'lg'] as const).map(size => {- const val = tokens[`--size-element-${size}`] || '32px';- return (- <div key={size} style={SCALE_ROW}>- <div- style={{- width: `calc(${val} * 2.4)`,- height: val,- backgroundColor: 'var(--color-accent-muted)',- border: '1px dashed var(--color-accent)',- borderRadius: 8,- flexShrink: 0,- transition: 'width 200ms ease, height 200ms ease',- }}- />- <span style={CODE_LABEL}>{size}</span>- <span style={CODE_LABEL}>{val}</span>- </div>- );- })}- </div>- </div>- );-- return (- <div style={{containerType: 'inline-size'}}>- <div- style={{- display: 'grid',- gridTemplateColumns: '1fr',- gap: 32,- }}>- <style>{`@container (min-width: 720px) { .token-scale-grid { grid-template-columns: 1fr auto 1fr !important; } }`}</style>- <div- className="token-scale-grid"- style={{display: 'grid', gridTemplateColumns: '1fr', gap: 32}}>- <div style={{display: 'flex', flexDirection: 'column', gap: 32}}>- {colorsSection}- {spacingSection}- {sizeSection}- </div>- <div- className="token-scale-divider"- style={{width: 1, backgroundColor: 'var(--color-border)'}}- />- <div style={{display: 'flex', flexDirection: 'column', gap: 32}}>- {typographySection}- {radiusSection}- </div>- </div>- <style>{`@container (max-width: 719px) { .token-scale-divider { display: none !important; } }`}</style>- </div>- </div>- );-}--// =============================================================================-// Preview Tabs-// =============================================================================--function TemplateIframePreview({- slug,- theme,- mode,-}: {- slug: string;- theme: XDSDefinedTheme;- mode: 'light' | 'dark';-}) {- const iframeRef = React.useRef<HTMLIFrameElement>(null);- const href =- templates.find((t: {slug: string; href: string}) => t.slug === slug)- ?.href ?? `/templates/${slug}/`;-- React.useEffect(() => {- const iframe = iframeRef.current;- if (!iframe) {- return;- }- const inject = () => {- const doc = iframe.contentDocument;- if (!doc) {- return;- }- doc.documentElement.setAttribute('data-xds-theme', theme.name);- doc.documentElement.setAttribute('data-color-scheme', mode);- doc.documentElement.style.colorScheme = mode;-- // Hide the PreviewShell toolbar inside the iframe- const root = doc.body?.firstElementChild as HTMLElement | null;- if (root) {- const toolbar = root.firstElementChild as HTMLElement | null;- if (toolbar) {- toolbar.style.display = 'none';- }- }-- let styleEl = doc.querySelector<HTMLStyleElement>(- 'style[data-xds-editor-theme]',- );- if (!styleEl) {- styleEl = doc.createElement('style');- styleEl.setAttribute('data-xds-editor-theme', 'true');- doc.head.appendChild(styleEl);- }- styleEl.textContent = generateThemeCSSFlat(theme);- };- iframe.addEventListener('load', inject);- inject();- return () => iframe.removeEventListener('load', inject);- }, [theme, mode, slug]);-- return (- <iframe- ref={iframeRef}- src={href}- sandbox="allow-scripts allow-same-origin"- title="Theme preview"- style={{- width: '100%',- height: '100%',- border: 'none',- borderRadius: 'var(--radius-container)',- }}- />- );-}--function PreviewContent({- activePreview,- tokens,- theme,- mode,-}: {- activePreview: string;- tokens?: Record<string, string>;- theme?: XDSDefinedTheme;- mode?: 'light' | 'dark';-}) {- return (- <div- style={- activePreview.startsWith('template:') ? {height: '100%'} : undefined- }>- {activePreview === 'preview' && <ComponentPreview />}- {activePreview === 'landing' && <LandingPagePreview />}- {activePreview === 'dashboard' && <DashboardPreview />}- {activePreview === 'table' && <MotionPreview />}- {activePreview === 'tokens' && tokens && (- <TokenScalePreview tokens={tokens} />- )}- {activePreview.startsWith('template:') && theme && mode && (- <TemplateIframePreview- slug={activePreview.slice(9)}- theme={theme}- mode={mode}- />- )}- </div>- );-}--// =============================================================================-// Code Generator-// =============================================================================--function generateThemeCode(- themeName: string,- tokens: Record<string, string>,- defaults: Record<string, string>,- typeScaleBase?: number,- typeScaleRatio?: number,-): string {- const changedTokens: Record<string, string> = {};- const hasCustomTypeScale =- typeScaleBase !== undefined &&- typeScaleRatio !== undefined &&- (typeScaleBase !== 14 || typeScaleRatio !== 1.2);- const typeScaleTokenKeys = new Set(Object.keys(typeScaleDefaults));-- const componentOverrides: Record<- string,- Record<string, Record<string, string>>- > = {};-- for (const [key, value] of Object.entries(tokens)) {- if (value === defaults[key]) {- continue;- }- if (hasCustomTypeScale && typeScaleTokenKeys.has(key)) {- continue;- }- const mapping = COMPONENT_VAR_TO_OVERRIDE[key];- if (mapping) {- const {component, cssProperty} = mapping;- if (!componentOverrides[component]) {- componentOverrides[component] = {};- }- if (!componentOverrides[component].base) {- componentOverrides[component].base = {};- }- componentOverrides[component].base[cssProperty] = value;- } else {- changedTokens[key] = value;- }- }-- const hasTokenOverrides = Object.keys(changedTokens).length > 0;- const hasComponentOverrides = Object.keys(componentOverrides).length > 0;-- const setupComment = [- `// Setup:`,- `// 1. Save this file as src/theme.ts`,- `// 2. Import in your app:`,- `//`,- `// import { XDSTheme } from '@xds/core';`,- `// import { ${themeName}Theme } from './theme';`,- `//`,- `// <XDSTheme theme={${themeName}Theme}>`,- `// <App />`,- `// </XDSTheme>`,- ].join('\n');-- if (!hasTokenOverrides && !hasCustomTypeScale && !hasComponentOverrides) {- return `import { defineTheme } from '@xds/core/theme';\n\n${setupComment}\n\nexport const ${themeName}Theme = defineTheme({\n name: '${themeName}',\n tokens: {},\n});`;- }-- const parts: string[] = [];- if (hasCustomTypeScale) {- parts.push(- ` typography: { scale: { base: ${typeScaleBase}, ratio: ${typeScaleRatio} } },`,- );- }- if (hasTokenOverrides) {- const tokenEntries = Object.entries(changedTokens)- .map(([key, value]) => {- const parsed = parseLightDark(value);- if (parsed) {- return ` '${key}': ['${parsed.light}', '${parsed.dark}'],`;- }- return ` '${key}': '${value}',`;- })- .join('\n');- parts.push(` tokens: {\n${tokenEntries}\n },`);- } else {- parts.push(` tokens: {},`);- }- if (hasComponentOverrides) {- const compEntries = Object.entries(componentOverrides)- .map(([comp, rules]) => {- const ruleEntries = Object.entries(rules)- .map(([ruleKey, props]) => {- const propEntries = Object.entries(props)- .map(([prop, val]) => ` ${prop}: '${val}',`)- .join('\n');- return ` '${ruleKey}': {\n${propEntries}\n },`;- })- .join('\n');- return ` '${comp}': {\n${ruleEntries}\n },`;- })- .join('\n');- parts.push(` components: {\n${compEntries}\n },`);- }-- return `import { defineTheme } from '@xds/core/theme';\n\n${setupComment}\n\nexport const ${themeName}Theme = defineTheme({\n name: '${themeName}',\n${parts.join('\n')}\n});`;-}--// =============================================================================-// Main ThemeEditorView Component-// =============================================================================--export function ThemeEditorView({- activeView: _activeView,- setActiveView,- initialImage,- initialTheme,- onImageConsumed,-}: {- activeView: string;- setActiveView: (- view: 'craft' | 'explore' | 'docs' | 'profile' | 'theme',- ) => void;- initialImage?: string | null;- initialTheme?: {accent: string; font?: string; radius?: number} | null;- onImageConsumed?: () => void;-}) {- // Token editing state- const [activeGroup, setActiveGroup] = React.useState<TokenGroupKey>('colors');- const [_activeColorCategory, _setActiveColorCategory] =- React.useState<string>('Core Semantic');- const [_activeTypographyCategory, _setActiveTypographyCategory] =- React.useState<string>('Heading 1');- const [themeName] = React.useState('custom');- const [mode, setMode] = React.useState<'light' | 'dark'>('light');- const [showCode, setShowCode] = React.useState(false);- const [pushPanelOpen, setPushPanelOpen] = React.useState(false);- const [overlayPanelOpen, setOverlayPanelOpen] = React.useState(false);- const [activePreview, setActivePreview] = React.useState('preview');-- const [typeScaleBase, setTypeScaleBase] = React.useState(14);- const [typeScaleRatio, setTypeScaleRatio] = React.useState(1.2);- const [panelMode, setPanelMode] = React.useState<'editor' | 'target' | 'raw'>(- 'editor',- );- const [_targetComponent, _setTargetComponent] = React.useState<string | null>(- null,- );- const [collapsedSections, setCollapsedSections] = React.useState<- Record<string, boolean>- >({});- const toggleSection = React.useCallback((id: string) => {- setCollapsedSections(prev => ({...prev, [id]: !prev[id]}));- }, []);-- React.useEffect(() => {- if (panelMode === 'editor') {- setActivePreview('tokens');- }- if (panelMode === 'target') {- setActivePreview('preview');- }- }, [panelMode]);- const [flashComponent, setFlashComponent] = React.useState<string | null>(- null,- );- const [customVars, setCustomVars] = React.useState<Set<string>>(new Set());- const previewRef = React.useRef<HTMLDivElement>(null);-- React.useEffect(() => {- if (!flashComponent || !previewRef.current) {- return;- }- const container = previewRef.current;- const selector = `.xds-${flashComponent}`;- const elements = container.querySelectorAll<HTMLElement>(selector);- if (elements.length === 0) {- setFlashComponent(null);- return;- }- elements.forEach(el => el.classList.add('xds-target-flash'));- const timer = setTimeout(() => {- elements.forEach(el => el.classList.remove('xds-target-flash'));- setFlashComponent(null);- }, 3000);- return () => {- clearTimeout(timer);- elements.forEach(el => el.classList.remove('xds-target-flash'));- };- }, [flashComponent]);-- const [radiusBase, setRadiusBase] = React.useState(4);- const [spacingBase, setSpacingBase] = React.useState(4);- const [sizeBase, setSizeBase] = React.useState(32);- const [durationStep, setDurationStep] = React.useState(1);- const [activePreset, setActivePreset] = React.useState<string | null>(- 'default',- );- const [autoPickColors, setAutoPickColors] = React.useState(false);-- const [aiImagePreview, setAiImagePreview] = React.useState<string | null>(- null,- );- const [aiAnalyzing, setAiAnalyzing] = React.useState(false);- const [aiError, setAiError] = React.useState<string | null>(null);- const [showGenerate, setShowGenerate] = React.useState(false);- const [aiToolCalls, setAiToolCalls] = React.useState<XDSChatToolCallItem[]>(- [],- );-- const UNIFIED_PRESETS = React.useMemo(- () => ({- compact: {- typeBase: 12,- typeRatio: 1.125,- spacing: 2,- radius: 2,- sizeMd: 28,- },- default: {- typeBase: 14,- typeRatio: 1.2,- spacing: 4,- radius: 4,- sizeMd: 32,- },- comfortable: {- typeBase: 16,- typeRatio: 1.25,- spacing: 6,- radius: 6,- sizeMd: 40,- },- gigantic: {- typeBase: 18,- typeRatio: 1.414,- spacing: 8,- radius: 12,- sizeMd: 48,- },- }),- [],- );-- 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 = {- '--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`,- };- });- },- [UNIFIED_PRESETS],- );-- const FONT_LABEL_TO_VALUE: Record<string, string> = React.useMemo(- () => ({- System:- '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',- Inter: '"Inter", -apple-system, sans-serif',- Roboto: '"Roboto", -apple-system, sans-serif',- 'DM Sans': '"DM Sans", -apple-system, sans-serif',- Figtree: '"Figtree", -apple-system, sans-serif',- Poppins: '"Poppins", -apple-system, sans-serif',- 'IBM Plex Sans': '"IBM Plex Sans", -apple-system, sans-serif',- 'Source Sans': '"Source Sans 3", -apple-system, sans-serif',- 'Noto Sans': '"Noto Sans", -apple-system, sans-serif',- Georgia: 'Georgia, "Times New Roman", serif',- }),- [],- );-- const applyAITheme = React.useCallback(- (result: {- accentColor: string;- headingFont: string;- bodyFont: string;- spacingBase: number;- radiusBase: number;- typeScaleBase: number;- typeScaleRatio: number;- sizeBase: number;- }) => {- const clampedSpacing = Math.max(- 2,- Math.min(16, Math.round(result.spacingBase / 2) * 2),- );- const clampedRadius = Math.max(- 0,- Math.min(18, Math.round(result.radiusBase / 2) * 2),- );- const clampedTypeBase = Math.max(- 10,- Math.min(24, Math.round(result.typeScaleBase)),- );- const clampedSize = Math.max(- 24,- Math.min(56, Math.round(result.sizeBase / 2) * 2),- );-- const validRatios = [1.067, 1.125, 1.2, 1.25, 1.333, 1.414, 1.5, 1.618];- const closestRatio = validRatios.reduce((best, r) =>- Math.abs(r - result.typeScaleRatio) <- Math.abs(best - result.typeScaleRatio)- ? r- : best,- );-- setActivePreset(null);- setTypeScaleBase(clampedTypeBase);- setTypeScaleRatio(closestRatio);- setSpacingBase(clampedSpacing);- setRadiusBase(clampedRadius);- setSizeBase(clampedSize);- setAutoPickColors(true);-- const headingValue =- FONT_LABEL_TO_VALUE[result.headingFont] ||- FONT_LABEL_TO_VALUE['System'];- const bodyValue =- FONT_LABEL_TO_VALUE[result.bodyFont] || FONT_LABEL_TO_VALUE['System'];-- 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(clampedSpacing * step)}px`;- });-- const accentHex = result.accentColor?.startsWith('#')- ? result.accentColor- : '#0066FF';- const colorPatch = expandColorScale({accent: accentHex});-- setTokens(prev => ({- ...prev,- ...expandTypeScale({base: clampedTypeBase, ratio: closestRatio}),- ...spacingPatch,- ...expandRadiusScale({base: clampedRadius, multiplier: 1}),- ...colorPatch,- '--color-accent': accentHex,- '--font-family-heading': headingValue,- '--font-family-body': bodyValue,- '--size-element-sm': `${clampedSize - 4}px`,- '--size-element-md': `${clampedSize}px`,- '--size-element-lg': `${clampedSize + 4}px`,- }));- },- [FONT_LABEL_TO_VALUE],- );-- const handleImageUpload = React.useCallback(- async (file: File) => {- setAiError(null);- setAiAnalyzing(true);- setShowGenerate(true);-- const previewUrl = URL.createObjectURL(file);- setAiImagePreview(previewUrl);-- const steps: XDSChatToolCallItem[] = [- {name: 'Analyzing image', target: file.name, status: 'running'},- {name: 'Extracting color palette', status: 'pending'},- {name: 'Detecting typography', status: 'pending'},- {name: 'Generating theme tokens', status: 'pending'},- ];- setAiToolCalls([...steps]);-- try {- await new Promise(resolve => setTimeout(resolve, 600));- steps[0] = {...steps[0], status: 'complete', duration: '0.6s'};- steps[1] = {...steps[1], status: 'running'};- setAiToolCalls([...steps]);-- await new Promise(resolve => setTimeout(resolve, 400));- steps[1] = {...steps[1], status: 'complete', duration: '0.4s'};- steps[2] = {...steps[2], status: 'running'};- setAiToolCalls([...steps]);-- await new Promise(resolve => setTimeout(resolve, 300));- steps[2] = {...steps[2], status: 'complete', duration: '0.3s'};- steps[3] = {...steps[3], status: 'running'};- setAiToolCalls([...steps]);-- await new Promise(resolve => setTimeout(resolve, 200));- steps[3] = {...steps[3], status: 'complete', duration: '0.2s'};- setAiToolCalls([...steps]);-- const mockResult = {- accentColor: '#0064E0',- headingFont: 'Inter',- bodyFont: 'System',- spacingBase: 4,- radiusBase: 8,- typeScaleBase: 14,- typeScaleRatio: 1.2,- sizeBase: 36,- density: 'default' as const,- notes:- 'Demo extraction — upload triggers a mock response to show the flow.',- };-- applyAITheme(mockResult);- } catch (err) {- const errMsg = err instanceof Error ? err.message : String(err);- setAiError(errMsg);- const runningIdx = steps.findIndex(s => s.status === 'running');- if (runningIdx >= 0) {- steps[runningIdx] = {- ...steps[runningIdx],- status: 'error',- errorMessage: errMsg,- };- setAiToolCalls([...steps]);- }- } finally {- setAiAnalyzing(false);- }- },- [applyAITheme],- );-- React.useEffect(() => {- if (!initialTheme) {- return;- }- const fontLabel = initialTheme.font- ? initialTheme.font.split(',')[0].replace(/["']/g, '').trim()- : 'System';- applyAITheme({- accentColor: initialTheme.accent,- headingFont: fontLabel,- bodyFont: fontLabel,- spacingBase: 4,- radiusBase: initialTheme.radius ?? 8,- typeScaleBase: 14,- typeScaleRatio: 1.2,- sizeBase: 32,- });- if (initialImage) {- setAiImagePreview(initialImage);- }- onImageConsumed?.();- }, [initialTheme]);-- // Resize state (docsite layout pattern)- const [editorPanelWidth, setEditorPanelWidth] = React.useState(400);- const [isEditorResizing, setIsEditorResizing] = React.useState(false);-- const allDefaults: Record<string, string> = React.useMemo(- () => ({- ...colorDefaults,- ...spacingDefaults,- ...radiusDefaults,- ...typographyDefaults,- ...textSizeDefaults,- ...fontWeightDefaults,- ...typeScaleDefaults,- ...sizeDefaults,- ...shadowDefaults,- ...durationDefaults,- ...easeDefaults,- ...transitionDefaults,- }),- [],- );-- const [tokens, setTokens] =- React.useState<Record<string, string>>(allDefaults);-- const handleTokenChange = React.useCallback(- (tokenName: string, value: string) => {- setTokens(prev => ({...prev, [tokenName]: value}));- },- [],- );-- const handleReset = React.useCallback(() => {- setTokens(allDefaults);- setTypeScaleBase(14);- setTypeScaleRatio(1.2);- setRadiusBase(4);- setSpacingBase(4);- setSizeBase(32);- setDurationStep(1);- setActivePreset('default');- }, [allDefaults]);-- const typeScaleKeys = React.useMemo(- () => new Set(Object.keys(typeScaleDefaults)),- [],- );-- const currentTheme = React.useMemo(() => {- const tokenOverrides: Record<string, string> = {};- const componentOverrides: Record<- string,- Record<string, Record<string, string>>- > = {};- for (const [key, value] of Object.entries(tokens)) {- const mapping = COMPONENT_VAR_TO_OVERRIDE[key];- if (mapping && value !== allDefaults[key]) {- const {component, cssProperty} = mapping;- if (!componentOverrides[component]) {- componentOverrides[component] = {};- }- if (!componentOverrides[component].base) {- componentOverrides[component].base = {};- }- componentOverrides[component].base[cssProperty] = value;- } else if (typeScaleKeys.has(key) || value !== allDefaults[key]) {- tokenOverrides[key] = value;- }- }- return defineTheme({- name: themeName,- typography: {scale: {base: typeScaleBase, ratio: typeScaleRatio}},- tokens: tokenOverrides as Partial<Record<string, string>>,- components:- Object.keys(componentOverrides).length > 0- ? componentOverrides- : undefined,- icons: defaultIconRegistry,- });- }, [- tokens,- themeName,- allDefaults,- typeScaleBase,- typeScaleRatio,- typeScaleKeys,- ]);-- const handleEditorResizeStart = React.useCallback(- (e: React.MouseEvent) => {- e.preventDefault();- setIsEditorResizing(true);- const startX = e.clientX;- const startWidth = editorPanelWidth;- const onMouseMove = (ev: MouseEvent) => {- const maxWidth = Math.floor(window.innerWidth / 2);- const newWidth = Math.min(- Math.max(startWidth + (ev.clientX - startX), 280),- maxWidth,- );- setEditorPanelWidth(newWidth);- };- const onMouseUp = () => {- setIsEditorResizing(false);- document.removeEventListener('mousemove', onMouseMove);- document.removeEventListener('mouseup', onMouseUp);- document.body.style.cursor = '';- document.body.style.userSelect = '';- };- document.body.style.cursor = 'col-resize';- document.body.style.userSelect = 'none';- document.addEventListener('mousemove', onMouseMove);- document.addEventListener('mouseup', onMouseUp);- },- [editorPanelWidth],- );-- // ---------------------------------------------------------------------------- // Token Editor Renderer- // ----------------------------------------------------------------------------- const renderTokenEditor = () => {- const group = TOKEN_GROUPS[activeGroup];-- if (activeGroup === 'colors') {- const seen = new Set<string>();- return (- <div style={{display: 'flex', flexDirection: 'column', gap: '4px'}}>- {Object.entries(COLOR_CATEGORIES).map(([category, tokenNames]) => {- const uniqueTokens = tokenNames.filter(t => {- if (seen.has(t)) {- return false;- }- seen.add(t);- return true;- });- if (uniqueTokens.length === 0) {- return null;- }- return (- <React.Fragment key={category}>- <XDSText- type="supporting"- color="secondary"- style={{marginTop: 8, marginBottom: 2}}>- {category}- </XDSText>- {uniqueTokens.map(tokenName => (- <ColorSwatch- key={tokenName}- tokenName={tokenName}- value={tokens[tokenName] || ''}- onChange={handleTokenChange}- mode={mode}- />- ))}- </React.Fragment>- );- })}- </div>- );- }-- if (activeGroup === 'spacing' || activeGroup === 'size') {- return (- <div style={{display: 'flex', flexDirection: 'column', gap: '8px'}}>- {Object.keys(group.tokens).map(tokenName => (- <SpacingEditor- key={tokenName}- tokenName={tokenName}- value={tokens[tokenName] || ''}- onChange={handleTokenChange}- />- ))}- </div>- );- }-- if (activeGroup === 'radius') {- return (- <div style={{display: 'flex', flexDirection: 'column', gap: '8px'}}>- {Object.keys(group.tokens).map(tokenName => (- <RadiusEditor- key={tokenName}- tokenName={tokenName}- value={tokens[tokenName] || ''}- onChange={handleTokenChange}- />- ))}- </div>- );- }-- if (activeGroup === 'typography') {- const seen = new Set<string>();- return (- <div style={{display: 'flex', flexDirection: 'column', gap: '4px'}}>- {Object.entries(TYPOGRAPHY_CATEGORIES).map(- ([category, categoryValue]) => {- const catTokens: string[] = Array.isArray(categoryValue)- ? (categoryValue as string[])- : (categoryValue as unknown as {tokens: string[]}).tokens;- const uniqueTokens = catTokens.filter(t => {- if (seen.has(t)) {- return false;- }- seen.add(t);- return true;- });- if (uniqueTokens.length === 0) {- return null;- }- return (- <React.Fragment key={category}>- <XDSText- type="supporting"- color="secondary"- style={{marginTop: 8, marginBottom: 2}}>- {category}- </XDSText>- {uniqueTokens.map(tokenName => (- <TypographyEditor- key={tokenName}- tokenName={tokenName}- value={tokens[tokenName] || ''}- onChange={handleTokenChange}- />- ))}- </React.Fragment>- );- },- )}- </div>- );- }-- return (- <XDSVStack gap={2}>- {Object.keys(group.tokens).map(tokenName => (- <XDSHStack- key={tokenName}- gap={3}- vAlign="center"- style={{- padding: '8px 12px',- borderRadius: 8,- backgroundColor: 'var(--color-background-body)',- }}>- <XDSVStack gap={0} style={{flex: 1, minWidth: 0}}>- <XDSText type="supporting" color="primary" maxLines={1}>- {getTokenLabel(tokenName)}- </XDSText>- <XDSText type="supporting" color="secondary" maxLines={1}>- {tokenName}- </XDSText>- </XDSVStack>- <div style={{width: 200}}>- <XDSTextInput- label="Value"- isLabelHidden- value={tokens[tokenName] || ''}- onChange={val => handleTokenChange(tokenName, val)}- size="sm"- />- </div>- </XDSHStack>- ))}- </XDSVStack>- );- };-- // ---------------------------------------------------------------------------- // Layout — docsite split-panel pattern- // ----------------------------------------------------------------------------- return (- <div- style={{- display: 'flex',- height: '100vh',- overflow: 'hidden',- backgroundColor: 'var(--color-background-surface, #fff)',- }}>- <style>- {'@import 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&family=JetBrains+Mono:wght@400;500;600;700&family=Fira+Code:wght@400;500;600;700&family=Source+Code+Pro:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600;700&display=swap");' +- '.xds-editor-resize-handle { opacity: 0; transition: opacity 150ms ease, background-color 150ms ease; }' +- '.xds-editor-resize-grip:hover .xds-editor-resize-handle { opacity: 0.6; }' +- '.xds-editor-resize-grip[data-resizing="true"] .xds-editor-resize-handle { opacity: 1; }' +- '@keyframes xds-flash-fade { 0% { outline: 2px solid var(--color-accent); outline-offset: 2px; } 100% { outline: 2px solid transparent; outline-offset: 2px; } }' +- '.xds-target-flash { animation: xds-flash-fade 3s ease-out forwards; }'}- </style>-- {/* Left Panel — Sidebar Nav + Editor */}- <div- style={{- width: editorPanelWidth,- minWidth: 280,- maxWidth: '50vw',- flexShrink: 0,- display: 'flex',- gap: 0,- }}>- {/* Sidebar Navigation Rail */}- <XDSSideNav- collapsible={{isCollapsed: true, hasButton: false}}- header={- <XDSIconButton- icon={<ArrowLeftIcon width="1em" height="1em" />}- label="Back"- variant="ghost"- size="md"- onClick={() => setActiveView('craft')}- />- }>- <XDSSideNavSection title="Views" isHeaderHidden>- <XDSSideNavItem- label="Theme Editor"- icon={SparklesIcon}- selectedIcon={SparklesIcon}- isSelected={panelMode === 'editor'}- onClick={() => setPanelMode('editor')}- />- <XDSSideNavItem- label="Component Tokens"- icon={CubeIcon}- selectedIcon={CubeIcon}- isSelected={panelMode === 'target'}- onClick={() => {- setPanelMode('target');- setActivePreview('preview');- }}- />- <XDSSideNavItem- label="Raw Tokens"- icon={CodeBracketIcon}- selectedIcon={CodeBracketIcon}- isSelected={panelMode === 'raw'}- onClick={() => setPanelMode('raw')}- />- </XDSSideNavSection>- </XDSSideNav>-- {/* Editor Panel Content */}- <div- style={{- flex: 1,- backgroundColor: 'var(--color-background-card, #fff)',- borderRadius: 16,- border: '1px solid var(--color-divider, #e0e0e0)',- overflow: 'hidden',- display: 'flex',- flexDirection: 'column' as const,- margin: '8px 0 8px 0',- }}>- {/* Panel Header */}- <div- style={{- padding: '14px 16px',- borderBottom: '1px solid var(--color-border)',- display: 'flex',- alignItems: 'center',- justifyContent: 'space-between',- }}>- <XDSHeading level={4}>- {panelMode === 'editor'- ? 'Theme Editor'- : panelMode === 'target'- ? 'Component Tokens'- : 'Raw Tokens'}- </XDSHeading>- <XDSHStack gap={1}>- <XDSButton- label="Generate"- variant="ghost"- size="sm"- onClick={() => setShowGenerate(true)}- />- <XDSButton- label="Reset"- variant="ghost"- size="sm"- onClick={handleReset}- />- </XDSHStack>- </div>-- {/* Raw Tokens sub-tabs */}- {panelMode === 'raw' && (- <div- style={{- padding: '8px 12px',- marginLeft: 0,- marginRight: 0,- borderBottom: '1px solid var(--color-border)',- overflowX: 'auto',- }}>- <XDSToggleButtonGroup- label="Token category"- type="single"- size="sm"- value={activeGroup}- onChange={(v: string | null) => {- if (v != null) {- setActiveGroup(v as TokenGroupKey);- }- }}>- {(Object.keys(TOKEN_GROUPS) as TokenGroupKey[]).map(- groupKey => {- const IconComp = TOKEN_GROUP_ICONS[groupKey];- const isActive = activeGroup === groupKey;- return (- <XDSToggleButton- key={groupKey}- label={TOKEN_GROUPS[groupKey].label}- value={groupKey}- isIconOnly={!isActive}- icon={- IconComp ? (- <XDSIcon icon={IconComp} size="xsm" />- ) : undefined- }- />- );- },- )}- </XDSToggleButtonGroup>- </div>- )}-- {/* Scrollable editor content */}- <div style={{flex: 1, overflow: 'auto', padding: '16px'}}>- {panelMode === 'editor' ? (- <XDSVStack gap={5}>- {/* Color — Collapsible */}- <CollapsibleSection- id="color"- title="Color"- collapsed={collapsedSections}- onToggle={toggleSection}>- <XDSHStack- vAlign="center"- style={{marginBottom: 4, justifyContent: 'space-between'}}>- <XDSText type="label" color="secondary">- Create from accent- </XDSText>- <XDSSwitch- label="Create from accent"- isLabelHidden- value={autoPickColors}- onChange={val => {- setAutoPickColors(val);- if (val) {- const accentRaw = tokens['--color-accent'] || '';- const parsed = parseLightDark(accentRaw);- const accentHex = parsed ? parsed.light : accentRaw;- if (accentHex && accentHex.startsWith('#')) {- const derived = expandColorScale({- accent: accentHex,- });- setTokens(prev => ({...prev, ...derived}));- }- }- }}- />- </XDSHStack>- <ColorSwatch- tokenName="--color-accent"- value={tokens['--color-accent'] || ''}- onChange={(name, value) => {- handleTokenChange(name, value);- if (autoPickColors) {- const parsed = parseLightDark(value);- const hex = parsed ? parsed.light : value;- if (hex && hex.startsWith('#') && hex.length >= 7) {- const derived = expandColorScale({accent: hex});- setTokens(prev => ({- ...prev,- [name]: value,- ...derived,- }));- }- }- }}- mode={mode}- />- {!autoPickColors && (- <XDSVStack gap={0}>- {[- '--color-neutral',- '--color-background-card',- '--color-background-surface',- '--color-text-primary',- ].map(tokenName => (- <ColorSwatch- key={tokenName}- tokenName={tokenName}- value={tokens[tokenName] || ''}- onChange={handleTokenChange}- mode={mode}- />- ))}- </XDSVStack>- )}- </CollapsibleSection>-- <XDSDivider />- {/* Presets — Collapsible */}- <CollapsibleSection- id="presets"- title="Presets"- collapsed={collapsedSections}- onToggle={toggleSection}>- <div style={{display: 'flex', gap: 6}}>- {Object.entries(UNIFIED_PRESETS).map(([key, _p]) => {- const isSelected = activePreset === key;- const gap =- key === 'compact'- ? 1- : key === 'default'- ? 2- : key === 'comfortable'- ? 3- : 4;- const cornerR =- key === 'compact'- ? 1- : key === 'default'- ? 2- : key === 'comfortable'- ? 3- : 5;- return (- <div- key={key}- onClick={() => applyUnifiedPreset(key)}- style={{- flex: 1,- padding: '10px 6px 8px',- borderRadius: 10,- border: 'none',- backgroundColor: isSelected- ? 'var(--color-accent-muted, rgba(0,100,224,0.1))'- : 'var(--color-background-wash, rgba(0,0,0,0.04))',- cursor: 'pointer',- transition: 'background-color 0.15s ease',- display: 'flex',- flexDirection: 'column' as const,- alignItems: 'center',- gap: 6,- }}>- <svg width={32} height={32} viewBox="0 0 32 32">- <rect- x={0}- y={0}- width={32}- height={8}- rx={cornerR}- fill={- isSelected- ? 'var(--color-accent, #0064E0)'- : 'var(--color-text-quaternary)'- }- opacity={0.5}- />- <rect- x={0}- y={8 + gap}- width={15 - gap / 2}- height={32 - 8 - gap}- rx={cornerR}- fill={- isSelected- ? 'var(--color-accent, #0064E0)'- : 'var(--color-text-quaternary)'- }- />- <rect- x={15 + gap / 2}- y={8 + gap}- width={32 - 15 - gap / 2}- height={(32 - 8 - gap * 2) / 2}- rx={cornerR}- fill={- isSelected- ? 'var(--color-accent, #0064E0)'- : 'var(--color-text-quaternary)'- }- opacity={0.7}- />- <rect- x={15 + gap / 2}- y={8 + gap + (32 - 8 - gap * 2) / 2 + gap}- width={32 - 15 - gap / 2}- height={(32 - 8 - gap * 2) / 2}- rx={cornerR}- fill={- isSelected- ? 'var(--color-accent, #0064E0)'- : 'var(--color-text-quaternary)'- }- opacity={0.7}- />- </svg>- <XDSText- type="supporting"- style={{- fontSize: 10,- color: isSelected- ? 'var(--color-accent, #0064E0)'- : 'var(--color-text-secondary)',- }}>- {key.charAt(0).toUpperCase() + key.slice(1)}- </XDSText>- </div>- );- })}- </div>- </CollapsibleSection>-- {/* Typography — Collapsible */}- <CollapsibleSection- id="typography"- title="Typography"- collapsed={collapsedSections}- onToggle={toggleSection}>- <XDSVStack gap={4}>- <div style={{display: 'flex', gap: 8}}>- {[- {- token: '--font-family-heading',- label: 'Heading',- },- {- token: '--font-family-body',- label: 'Body',- },- ].map(({token, label}) => (- <div key={token} style={{flex: 1, minWidth: 0}}>- <XDSText- type="label"- color="secondary"- style={{marginBottom: 4, display: 'block'}}>- {label}- </XDSText>- <XDSSelector- label={label}- isLabelHidden- options={FONT_OPTIONS}- value={tokens[token] || FONT_OPTIONS[0].value}- onChange={(val: string) =>- handleTokenChange(token, val)- }- />- </div>- ))}- </div>- <div>- <XDSHStack- gap={1}- vAlign="center"- style={{marginBottom: 4}}>- <XDSText type="label" color="secondary">- Type Size- </XDSText>- <XDSTooltip- content={`Geometric scale: size = round(base × ratio^step). Base = ${typeScaleBase}px, ratio = ${typeScaleRatio.toFixed(3)}.`}>- <XDSIcon icon="info" size="sm" color="secondary" />- </XDSTooltip>- </XDSHStack>- <div- style={{display: 'flex', alignItems: 'center', gap: 8}}>- <XDSToggleButtonGroup- label="Type size preset"- type="single"- size="sm"- value={String(typeScaleBase)}- onChange={(v: string | null) => {- if (v != null) {- applyTypeScale(Number(v), typeScaleRatio);- }- }}>- <XDSToggleButton label="S" value="12">- S- </XDSToggleButton>- <XDSToggleButton label="M" value="14">- M- </XDSToggleButton>- <XDSToggleButton label="L" value="16">- L- </XDSToggleButton>- <XDSToggleButton label="XL" value="18">- XL- </XDSToggleButton>- </XDSToggleButtonGroup>- <div style={{flex: 1}} />- <XDSNumberInput- label="Type size"- isLabelHidden- value={typeScaleBase}- onChange={(v: number) =>- applyTypeScale(v, typeScaleRatio)- }- min={10}- max={24}- step={1}- units="px"- size="sm"- />- </div>- </div>- <div>- <XDSText- type="label"- color="secondary"- style={{marginBottom: 4}}>- Type Scale- </XDSText>- <XDSSelector- label="Type Scale"- isLabelHidden- options={[- ...RATIO_OPTIONS.map(opt => ({- value: String(opt.value),- label: opt.label,- })),- {- value: 'custom',- label: !RATIO_OPTIONS.some(- o => Math.abs(o.value - typeScaleRatio) < 0.001,- )- ? `Custom — ${typeScaleRatio.toFixed(3)}`- : 'Custom...',- },- ]}- value={- !RATIO_OPTIONS.some(- o => Math.abs(o.value - typeScaleRatio) < 0.001,- )- ? 'custom'- : String(typeScaleRatio)- }- onChange={(v: string) => {- if (v !== 'custom') {- applyTypeScale(typeScaleBase, Number(v));- }- }}- />- </div>- </XDSVStack>- </CollapsibleSection>-- {/* Shape & Layout — Collapsible */}- <CollapsibleSection- id="shape"- title="Shape & Layout"- collapsed={collapsedSections}- onToggle={toggleSection}>- <XDSVStack gap={4}>- <div>- <XDSHStack- gap={1}- vAlign="center"- style={{marginBottom: 4}}>- <XDSText type="label" color="secondary">- Corner Radius- </XDSText>- <XDSTooltip- content={`Linear scale: inner = ${radiusBase}px (1×), element = ${radiusBase * 2}px (2×), container = ${radiusBase * 3}px (3×), page = ${Math.round(radiusBase * 7)}px (7×).`}>- <XDSIcon icon="info" size="sm" color="secondary" />- </XDSTooltip>- </XDSHStack>- <div- style={{display: 'flex', alignItems: 'center', gap: 8}}>- <XDSToggleButtonGroup- label="Radius preset"- type="single"- size="sm"- value={String(radiusBase)}- onChange={(v: string | null) => {- if (v != null) {- applyRadiusScale(Number(v));- }- }}>- <XDSToggleButton label="S" value="2">- S- </XDSToggleButton>- <XDSToggleButton label="M" value="4">- M- </XDSToggleButton>- <XDSToggleButton label="L" value="6">- L- </XDSToggleButton>- <XDSToggleButton label="XL" value="12">- XL- </XDSToggleButton>- </XDSToggleButtonGroup>- <div style={{flex: 1}} />- <XDSNumberInput- label="Radius"- isLabelHidden- value={radiusBase}- onChange={(v: number) => applyRadiusScale(v)}- min={0}- max={18}- step={2}- units="px"- size="sm"- />- </div>- </div>- <div>- <XDSHStack- gap={1}- vAlign="center"- style={{marginBottom: 4}}>- <XDSText type="label" color="secondary">- Spacing- </XDSText>- <XDSTooltip- content={`Linear scale: step N = ${spacingBase}px × N. All spacing tokens are multiples of the base unit.`}>- <XDSIcon icon="info" size="sm" color="secondary" />- </XDSTooltip>- </XDSHStack>- <div- style={{display: 'flex', alignItems: 'center', gap: 8}}>- <XDSToggleButtonGroup- label="Spacing preset"- type="single"- size="sm"- value={String(spacingBase)}- onChange={(v: string | null) => {- if (v != null) {- applySpacingScale(Number(v));- }- }}>- <XDSToggleButton label="S" value="2">- S- </XDSToggleButton>- <XDSToggleButton label="M" value="4">- M- </XDSToggleButton>- <XDSToggleButton label="L" value="6">- L- </XDSToggleButton>- <XDSToggleButton label="XL" value="8">- XL- </XDSToggleButton>- </XDSToggleButtonGroup>- <div style={{flex: 1}} />- <XDSNumberInput- label="Spacing"- isLabelHidden- value={spacingBase}- onChange={(v: number) => applySpacingScale(v)}- min={0}- max={16}- step={2}- units="px"- size="sm"- />- </div>- </div>- <div>- <XDSHStack- gap={1}- vAlign="center"- style={{marginBottom: 4}}>- <XDSText type="label" color="secondary">- Element Size- </XDSText>- <XDSTooltip- content={`Step scale: sm = ${sizeBase - 4}px (md − grid), md = ${sizeBase}px (base), lg = ${sizeBase + 4}px (md + grid).`}>- <XDSIcon icon="info" size="sm" color="secondary" />- </XDSTooltip>- </XDSHStack>- <div- style={{display: 'flex', alignItems: 'center', gap: 8}}>- <XDSToggleButtonGroup- label="Element size preset"- type="single"- size="sm"- value={String(sizeBase)}- onChange={(v: string | null) => {- if (v != null) {- applySizeScale(Number(v));- }- }}>- <XDSToggleButton label="S" value="28">- S- </XDSToggleButton>- <XDSToggleButton label="M" value="32">- M- </XDSToggleButton>- <XDSToggleButton label="L" value="40">- L- </XDSToggleButton>- <XDSToggleButton label="XL" value="48">- XL- </XDSToggleButton>- </XDSToggleButtonGroup>- <div style={{flex: 1}} />- <XDSNumberInput- label="Element size"- isLabelHidden- value={sizeBase}- onChange={(v: number) => applySizeScale(v)}- min={24}- max={56}- step={2}- units="px"- size="sm"- />- </div>- </div>- </XDSVStack>- </CollapsibleSection>-- {/* Motion — Collapsible */}- <CollapsibleSection- id="motion"- title="Motion"- collapsed={collapsedSections}- onToggle={toggleSection}>- <XDSHStack gap={1} vAlign="center" style={{marginBottom: 4}}>- <XDSText type="label" color="secondary">- Duration- </XDSText>- <XDSTooltip- content={`Speed multiplier for all motion. Current: ${durationStep}× (e.g. medium = ${Math.round(410 / durationStep)}ms).`}>- <XDSIcon icon="info" size="sm" color="secondary" />- </XDSTooltip>- </XDSHStack>- <div style={{display: 'flex', alignItems: 'center', gap: 8}}>- <XDSToggleButtonGroup- label="Duration preset"- type="single"- size="sm"- value={String(durationStep)}- onChange={(v: string | null) => {- if (v != null) {- applyDurationScale(Number(v));- }- }}>- <XDSToggleButton label="0.5×" value="0.5">- 0.5×- </XDSToggleButton>- <XDSToggleButton label="1×" value="1">- 1×- </XDSToggleButton>- <XDSToggleButton label="1.5×" value="1.5">- 1.5×- </XDSToggleButton>- <XDSToggleButton label="2×" value="2">- 2×- </XDSToggleButton>- </XDSToggleButtonGroup>- <div style={{flex: 1}} />- <XDSNumberInput- label="Duration"- isLabelHidden- value={durationStep}- onChange={(v: number) =>- applyDurationScale(Math.round(v * 10) / 10)- }- min={0.5}- max={2}- step={0.1}- units="×"- size="sm"- />- </div>- </CollapsibleSection>- </XDSVStack>- ) : panelMode === 'target' ? (- <XDSVStack gap={2}>- {Object.entries(COMPONENT_VARS).map(([key, comp]) => (- <CollapsibleSection- key={key}- id={`comp-${key}`}- title={comp.label}- collapsed={collapsedSections}- onToggle={id => {- toggleSection(id);- }}- onTarget={() => setFlashComponent(key)}>- <XDSVStack gap={1}>- {comp.vars.map(v => {- const currentValue = tokens[v.name] || '';- const isCustom = customVars.has(v.name);- const isPresetValue =- !isCustom &&- (!currentValue ||- v.options.some(o => o.value === currentValue));-- return (- <div- key={v.name}- style={{- padding: '6px 0',- display: 'flex',- alignItems: 'center',- justifyContent: 'space-between',- gap: 10,- }}>- <div style={{flex: 1, minWidth: 0}}>- <XDSText- type="supporting"- color="primary"- maxLines={1}>- {v.description}- </XDSText>- </div>- <div style={{flexShrink: 0, width: 130}}>- {!isPresetValue ? (- <XDSTextInput- label={v.name}- isLabelHidden- size="sm"- value={currentValue}- placeholder={v.default}- onChange={(val: string) => {- if (val.trim() === '') {- setTokens(prev => {- const next = {...prev};- delete next[v.name];- return next;- });- setCustomVars(prev => {- const next = new Set(prev);- next.delete(v.name);- return next;- });- } else {- handleTokenChange(v.name, val);- }- }}- />- ) : (- <XDSSelector- label={v.name}- isLabelHidden- size="sm"- options={[- ...v.options,- {value: '__custom__', label: 'Custom...'},- ]}- value={currentValue || v.default}- onChange={(val: string) => {- if (val === '__custom__') {- setCustomVars(prev =>- new Set(prev).add(v.name),- );- } else {- handleTokenChange(v.name, val);- }- }}- />- )}- </div>- </div>- );- })}- </XDSVStack>- </CollapsibleSection>- ))}- </XDSVStack>- ) : (- renderTokenEditor()- )}- </div>- </div>- </div>-- {/* Resize Handle */}- <div- onMouseDown={handleEditorResizeStart}- data-resizing={isEditorResizing}- className="xds-editor-resize-grip"- style={{- width: 16,- flexShrink: 0,- cursor: 'col-resize',- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- zIndex: 10,- backgroundColor: 'transparent',- }}>- <div- className="xds-editor-resize-handle"- style={{- width: 3,- height: 32,- borderRadius: 2,- backgroundColor: isEditorResizing- ? 'var(--color-icon-primary, #111)'- : 'var(--color-border-strong, #ccc)',- }}- />- </div>-- {/* Right Panel — Preview */}- <div- style={{- flex: 1,- display: 'flex',- flexDirection: 'column' as const,- minWidth: 0,- overflow: 'hidden',- marginLeft: -16,- paddingLeft: 0,- }}>- {/* Preview toolbar */}- <div- style={{- padding: '8px 16px',- backgroundColor: 'var(--color-background-surface)',- display: 'flex',- alignItems: 'center',- justifyContent: 'space-between',- }}>- <div style={{display: 'flex', alignItems: 'center', gap: 12}}>- <XDSDropdownMenu- button={{- label: activePreview.startsWith('template:')- ? (templates.find(- (t: {slug: string; name: string}) =>- t.slug === activePreview.slice(9),- )?.name ?? 'Template')- : (() => {- const previewLabels: Record<string, string> = {- preview: 'Component Preview',- landing: 'Landing Page',- dashboard: 'Dashboard',- tokens: 'Token Preview',- table: 'Table Page',- };- return previewLabels[activePreview] ?? activePreview;- })(),- variant: 'ghost',- size: 'md',- }}- items={[- {- label: 'Token Preview',- onClick: () => setActivePreview('tokens'),- },- {- label: 'Component Preview',- onClick: () => setActivePreview('preview'),- },- {- label: 'Landing Page',- onClick: () => setActivePreview('landing'),- },- {- label: 'Dashboard',- onClick: () => setActivePreview('dashboard'),- },- {label: 'Table Page', onClick: () => setActivePreview('table')},- {type: 'divider' as const},- ...templates- .filter((t: {isReady?: boolean}) => t.isReady)- .map((t: {name: string; slug: string}) => ({- label: t.name,- onClick: () => setActivePreview(`template:${t.slug}`),- })),- ]}- />- </div>- <XDSSegmentedControl- label="Color mode"- value={mode}- onChange={v => setMode(v as 'light' | 'dark')}- size="sm">- <XDSSegmentedControlItem- value="light"- label="Light"- icon={<ContrastIcon />}- isLabelHidden- />- <XDSSegmentedControlItem- value="dark"- label="Dark"- icon={<MoonIcon />}- isLabelHidden- />- </XDSSegmentedControl>- <XDSButton- label={showCode ? 'Hide Code' : 'Export Theme'}- variant="secondary"- size="sm"- onClick={() => setShowCode(!showCode)}- />- </div>-- {/* Code panel (collapsible) */}- {showCode && (- <div- style={{- borderBottom: '1px solid var(--color-border)',- backgroundColor: 'var(--color-background-body)',- maxHeight: '300px',- overflow: 'auto',- }}>- <XDSCodeBlock- code={generateThemeCode(- themeName,- tokens,- allDefaults,- typeScaleBase,- typeScaleRatio,- )}- language="typescript"- size="sm"- />- </div>- )}-- {/* Preview content wrapped in theme */}- <div- style={{- flex: 1,- display: 'flex',- flexDirection: 'column',- minHeight: 0,- }}>- <XDSTheme theme={currentTheme} mode={mode}>- <div- ref={previewRef}- style={{- flex: 1,- overflow: 'auto',- position: 'relative',- padding: 24,- marginLeft: 16,- marginRight: 16,- backgroundColor: 'var(--color-background-surface)',- borderRadius: 'var(--radius-container)',- }}>- <PreviewContent- activePreview={activePreview}- tokens={tokens}- theme={currentTheme}- mode={mode}- />-- {/* Overlay panel */}- <div- style={{- position: 'absolute',- top: 0,- right: 0,- bottom: 0,- width: '40%',- maxWidth: 480,- borderLeft: '1px solid var(--color-border)',- backgroundColor: mode === 'dark' ? '#1F1F22' : '#FFFFFF',- transform: overlayPanelOpen- ? 'translateX(0)'- : 'translateX(100%)',- opacity: overlayPanelOpen ? 1 : 0,- transition:- 'transform var(--duration-medium) var(--ease-standard), opacity var(--duration-medium) var(--ease-standard)',- display: 'flex',- flexDirection: 'column',- zIndex: 10,- boxShadow: overlayPanelOpen ? 'var(--shadow-high)' : 'none',- }}>- <div- style={{- padding: 'var(--spacing-2) var(--spacing-3)',- borderBottom: '1px solid var(--color-border)',- display: 'flex',- alignItems: 'center',- justifyContent: 'space-between',- }}>- <XDSText type="label">Overlay Panel</XDSText>- <XDSButton- label="Close"- icon={<XMarkIcon style={{width: 16, height: 16}} />}- variant="ghost"- size="sm"- onClick={() => setOverlayPanelOpen(false)}- isIconOnly- />- </div>- <div style={{padding: 'var(--spacing-3)'}}>- <XDSText type="supporting" color="secondary">- Slides over content without resizing it.- </XDSText>- </div>- </div>-- {/* Push panel */}- <div- style={{- flexShrink: 0,- width: pushPanelOpen ? '40%' : '0px',- maxWidth: pushPanelOpen ? 480 : 0,- overflow: 'hidden',- borderLeft: pushPanelOpen- ? '1px solid var(--color-border)'- : 'none',- backgroundColor: mode === 'dark' ? '#1F1F22' : '#FFFFFF',- opacity: pushPanelOpen ? 1 : 0,- transition:- 'width var(--duration-medium) var(--ease-standard), max-width var(--duration-medium) var(--ease-standard), opacity var(--duration-medium) var(--ease-standard)',- display: 'flex',- flexDirection: 'column',- }}>- <div- style={{- padding: 'var(--spacing-2) var(--spacing-3)',- borderBottom: '1px solid var(--color-border)',- display: 'flex',- alignItems: 'center',- justifyContent: 'space-between',- whiteSpace: 'nowrap',- }}>- <XDSText type="label">Push Panel</XDSText>- <XDSButton- label="Close"- icon={<XMarkIcon style={{width: 16, height: 16}} />}- variant="ghost"- size="sm"- onClick={() => setPushPanelOpen(false)}- isIconOnly- />- </div>- <div- style={{padding: 'var(--spacing-3)', whiteSpace: 'nowrap'}}>- <XDSText type="supporting" color="secondary">- Pushes content to make room.- </XDSText>- </div>- </div>- </div>- </XDSTheme>- </div>- </div>- <XDSDialog- isOpen={showGenerate}- onOpenChange={setShowGenerate}- width={480}>- <XDSDialogHeader- title="Generate from image"- onOpenChange={setShowGenerate}- />- <XDSVStack gap={3} style={{padding: 'var(--spacing-3)'}}>- <XDSText type="body" color="secondary">- Upload a screenshot or design mockup and the AI will extract accent- colors, typography, spacing, and radius to generate a complete- theme.- </XDSText>- <XDSButton- label={aiAnalyzing ? 'Analyzing...' : 'Upload image'}- variant="secondary"- size="sm"- isDisabled={aiAnalyzing}- onClick={() => {- const input = document.createElement('input');- input.type = 'file';- input.accept = 'image/png,image/jpeg,image/webp';- input.onchange = () => {- const file = input.files?.[0];- if (file) {- handleImageUpload(file);- }- };- input.click();- }}- />- {aiImagePreview && (- <img- src={aiImagePreview}- alt="Uploaded reference"- style={{- width: '100%',- borderRadius: 8,- objectFit: 'cover',- maxHeight: 240,- }}- />- )}- {aiToolCalls.length > 0 && (- <XDSChatToolCalls calls={aiToolCalls} defaultIsExpanded />- )}- {aiError && (- <XDSBanner- status="error"- title="Generation failed"- description={aiError}- isDismissable- onDismiss={() => setAiError(null)}- />- )}- </XDSVStack>- </XDSDialog>- </div>- );-}diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/constants.ts b/apps/sandbox/src/app/(fullscreen)/pages/docsite/constants.tsdeleted file mode 100644index 074fd4206f..0000000000--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/constants.ts+++ /dev/null@@ -1,964 +0,0 @@-// Copyright (c) Meta Platforms, Inc. and affiliates.--import {createStaticSource} from '@xds/core/Typeahead';--// ----------------------------------------------------------------------------// Boids constants-// -----------------------------------------------------------------------------export const CELL_W = 7;-export const CELL_H = 13;--export const DENSITY_LEVELS: {- min: number;- chars: string[];- font: string;- alpha: number;- usePrimary: boolean;-}[] = [- {- min: 0,- chars: ['·'],- font: `${CELL_H - 3}px monospace`,- alpha: 0.25,- usePrimary: false,- },- {- min: 1,- chars: ['∘'],- font: `${CELL_H - 1}px monospace`,- alpha: 0.4,- usePrimary: false,- },- {- min: 2,- chars: ['○'],- font: `${CELL_H}px monospace`,- alpha: 0.5,- usePrimary: false,- },- {- min: 3,- chars: ['◎'],- font: `${CELL_H}px monospace`,- alpha: 0.55,- usePrimary: true,- },- {- min: 4,- chars: ['◉'],- font: `bold ${CELL_H}px monospace`,- alpha: 0.65,- usePrimary: true,- },- {- min: 5,- chars: ['●'],- font: `bold ${CELL_H + 1}px monospace`,- alpha: 0.8,- usePrimary: true,- },- {- min: 7,- chars: ['⬤'],- font: `bold ${CELL_H + 2}px monospace`,- alpha: 0.95,- usePrimary: true,- },-];--export const SIM_COUNT = 350;--// ----------------------------------------------------------------------------// Template data — real images from /public/templates/-// -----------------------------------------------------------------------------export const basePath = process.env.NEXT_PUBLIC_BASE_PATH || '';-export const DUMMY_IMAGE = `${basePath}/docsite/dummy-placeholder.png`;-export const AVATAR_IMAGE = `${basePath}/avatars/avatar-profile.jpg`;-export const XDS_DESIGN_AVATAR = `${basePath}/avatars/xds-design-avatar.png`;-export const FIRST_CARD_IMAGE = `${basePath}/docsite/first-card.png`;-export const SHOPPING_DETAILS_IMAGE = `${basePath}/docsite/shopping-details.png`;-export const SCREENSHOT_3_IMAGE = `${basePath}/docsite/screenshot-3.png`;--// ----------------------------------------------------------------------------// Mock code for the code block-// -----------------------------------------------------------------------------export const MOCK_CODE = `'use client';--import {XDSTopNav, XDSTopNavHeading} from '@xds/core/TopNav';-import {XDSVStack, XDSHStack} from '@xds/core/Layout';-import {XDSHeading, XDSText} from '@xds/core/Text';-import {XDSButton} from '@xds/core/Button';-import {XDSCard} from '@xds/core/Card';-import {XDSBadge} from '@xds/core/Badge';-import {XDSAvatar} from '@xds/core/Avatar';--export default function DetailPage() {- return (- <XDSAppShell variant="surface">- <XDSVStack gap={6}>- <XDSHeading level={1}>Detail Page</XDSHeading>- <XDSCard>- <XDSVStack gap={4}>- <XDSHStack gap={2} vAlign="center">- <XDSAvatar name="Jane Doe" size="medium" />- <XDSText type="body" weight="bold">Jane Doe</XDSText>- <XDSBadge label="Active" variant="success" />- </XDSHStack>- <XDSText type="body">- This is a detail page template with structured- content sections, metadata, and action buttons.- </XDSText>- <XDSHStack gap={2}>- <XDSButton label="Edit" variant="secondary" />- <XDSButton label="Share" variant="ghost" />- </XDSHStack>- </XDSVStack>- </XDSCard>- </XDSVStack>- </div>- );-}`;--// ----------------------------------------------------------------------------// Template Preview constants-// -----------------------------------------------------------------------------export const VIEWPORT_WIDTHS: {[key: string]: number | '100%'} = {- desktop: 1600,- phone: 375,-};--export const XDS_THEMES = [- {label: 'Default', value: 'default'},- {label: 'Neutral', value: 'neutral'},- {label: 'Dark', value: 'dark'},-];--// ----------------------------------------------------------------------------// Search commands-// -----------------------------------------------------------------------------export const SEARCH_COMMANDS = createStaticSource([- {- id: 'templates',- label: 'Browse Templates',- auxiliaryData: {group: 'Navigation'},- },- {id: 'docs', label: 'Documentation', auxiliaryData: {group: 'Navigation'}},- {id: 'button', label: 'XDSButton', auxiliaryData: {group: 'Components'}},- {id: 'card', label: 'XDSCard', auxiliaryData: {group: 'Components'}},- {id: 'dialog', label: 'XDSDialog', auxiliaryData: {group: 'Components'}},- {id: 'table', label: 'XDSTable', auxiliaryData: {group: 'Components'}},- {id: 'topnav', label: 'XDSTopNav', auxiliaryData: {group: 'Components'}},- {- id: 'theme-default',- label: 'Switch to Default Theme',- auxiliaryData: {group: 'Settings'},- },- {- id: 'theme-dark',- label: 'Switch to Dark Theme',- auxiliaryData: {group: 'Settings'},- },-]);--// ----------------------------------------------------------------------------// Logo & Nav-// -----------------------------------------------------------------------------export const NAV_ITEMS: {key: 'craft' | 'explore' | 'docs'; label: string}[] = [- {key: 'craft', label: 'Craft'},- {key: 'explore', label: 'Explore'},- {key: 'docs', label: 'Docs'},-];--// ----------------------------------------------------------------------------// Templates-// -----------------------------------------------------------------------------export const TEMPLATES: {- name: string;- src: string;- slug?: string;- size: 'xlarge' | 'large' | 'medium' | 'small';- author: string;- isOfficial: boolean;-}[] = [- {- name: 'Login (SSO)',- src: DUMMY_IMAGE,- slug: 'login-sso',- size: 'large',- author: 'XDS Design',- isOfficial: true,- },- {- name: 'Landing Page',- src: `${basePath}/docsite/card4-preview.png`,- size: 'small',- author: 'XDS Design',- isOfficial: true,- },- {- name: 'Classic Gallery',- src: DUMMY_IMAGE,- slug: 'classic-gallery',- size: 'large',- author: 'XDS Design',- isOfficial: true,- },- {- name: 'Payment Form',- src: DUMMY_IMAGE,- slug: 'payment-form',- size: 'large',- author: 'XDS Design',- isOfficial: true,- },- {- name: 'Login (Split)',- src: DUMMY_IMAGE,- slug: 'login-split',- size: 'large',- author: 'XDS Design',- isOfficial: true,- },- {- name: 'Side Gallery',- src: DUMMY_IMAGE,- slug: 'side-gallery',- size: 'large',- author: 'XDS Design',- isOfficial: true,- },- {- name: 'Settings Sidebar',- src: DUMMY_IMAGE,- slug: 'settings-sidebar',- size: 'large',- author: 'XDS Design',- isOfficial: true,- },- {- name: 'Product Gallery',- src: DUMMY_IMAGE,- slug: 'product-gallery',- size: 'large',- author: 'XDS Design',- isOfficial: true,- },- {- name: 'Mixed Gallery',- src: DUMMY_IMAGE,- slug: 'mixed-gallery',- size: 'large',- author: 'XDS Design',- isOfficial: true,- },- {- name: 'Dashboard',- src: DUMMY_IMAGE,- slug: 'dashboard',- size: 'large',- author: 'XDS Design',- isOfficial: true,- },-];--// ----------------------------------------------------------------------------// Filter panel columns-// -----------------------------------------------------------------------------export const FILTER_COLUMNS: {heading: string; items: string[]}[] = [- {- heading: 'Categories',- items: ['AI', 'Health & Fitness', 'Productivity', 'Shopping', 'Education'],- },- {- heading: 'Templates',- items: [- 'My Account & Profile',- 'Charts',- 'Login',- 'Filter & Sort',- 'Signup',- ],- },- {- heading: 'Components',- items: [- 'Dropdown Menu',- 'Side Navigation',- 'Stepper',- 'Text Field',- 'Navigation Menu',- ],- },-];--// ----------------------------------------------------------------------------// Profile data-// -----------------------------------------------------------------------------export const PROFILE_USED_ITEMS: {- name: string;- type: 'Template' | 'Theme' | 'Component';- description: string;- lastUsed: string;- usageCount: number;- img: string;-}[] = [- {- name: 'Admin Dashboard',- type: 'Template',- description:- 'Full admin panel with sidebar nav, KPI cards, and data tables.',- lastUsed: '2026-04-15T09:00:00Z',- usageCount: 7,- img: SCREENSHOT_3_IMAGE,- },- {- name: 'AppShell',- type: 'Component',- description:- 'Foundational page layout with header, sidebar, and content regions.',- lastUsed: '2026-04-14T10:30:00Z',- usageCount: 12,- img: FIRST_CARD_IMAGE,- },- {- name: 'Matcha Theme',- type: 'Theme',- description: 'Earthy greens and warm browns with serif typography.',- lastUsed: '2026-04-14T08:00:00Z',- usageCount: 9,- img: SHOPPING_DETAILS_IMAGE,- },- {- name: 'Button',- type: 'Component',- description: 'Primary action element for forms, dialogs, and toolbars.',- lastUsed: '2026-04-14T16:00:00Z',- usageCount: 24,- img: FIRST_CARD_IMAGE,- },- {- name: 'Contact Form',- type: 'Template',- description:- 'Responsive contact form with validation, file upload, and success state.',- lastUsed: '2026-04-13T11:00:00Z',- usageCount: 4,- img: `${basePath}/docsite/card4-preview.png`,- },- {- name: 'Badge',- type: 'Component',- description:- 'Displays small counts or status labels on icons, buttons, or list items.',- lastUsed: '2026-04-12T09:20:00Z',- usageCount: 15,- img: SCREENSHOT_3_IMAGE,- },- {- name: 'Dark Mode Palette',- type: 'Theme',- description:- 'High-contrast dark theme with WCAG AA compliant color ratios.',- lastUsed: '2026-04-11T18:30:00Z',- usageCount: 3,- img: DUMMY_IMAGE,- },- {- name: 'Avatar',- type: 'Component',- description:- 'Represents a person or entity with an image, initials, or icon.',- lastUsed: '2026-04-13T15:45:00Z',- usageCount: 8,- img: SHOPPING_DETAILS_IMAGE,- },- {- name: 'Landing Page',- type: 'Template',- description:- 'Sidebar settings layout with inline editing and expandable rows.',- lastUsed: '2026-04-10T14:00:00Z',- usageCount: 5,- img: `${basePath}/docsite/card4-preview.png`,- },- {- name: 'Dialog',- type: 'Component',- description: 'Modal overlays that require user attention or action.',- lastUsed: '2026-04-11T13:15:00Z',- usageCount: 6,- img: DUMMY_IMAGE,- },- {- name: 'Daily Theme',- type: 'Theme',- description:- 'Soft blues and warm neutrals for everyday tools.',- lastUsed: '2026-04-09T10:00:00Z',- usageCount: 2,- img: DUMMY_IMAGE,- },- {- name: 'DropdownMenu',- type: 'Component',- description: 'Presents actions or options in a floating overlay.',- lastUsed: '2026-04-09T16:45:00Z',- usageCount: 5,- img: DUMMY_IMAGE,- },-];--export const PROFILE_LIKED_ITEMS: {- name: string;- type: 'Template' | 'Theme' | 'Component';- bookmarkedAt: string;- description: string;- img: string;- author: string;-}[] = [- {- name: 'Matcha Theme',- type: 'Theme',- bookmarkedAt: '2026-04-13T08:00:00Z',- description: 'Earthy greens and warm browns with serif typography.',- img: FIRST_CARD_IMAGE,- author: 'XDS Design',- },- {- name: 'Brutalist Theme',- type: 'Theme',- bookmarkedAt: '2026-04-11T10:30:00Z',- description: 'Bold, raw aesthetic with heavy borders and sharp angles.',- img: SHOPPING_DETAILS_IMAGE,- author: 'Andrea Anderson',- },- {- name: 'Admin Dashboard',- type: 'Template',- bookmarkedAt: '2026-04-10T14:20:00Z',- description:- 'Full admin panel with sidebar nav, KPI cards, and data tables.',- img: SCREENSHOT_3_IMAGE,- author: 'Andrea Anderson',- },- {- name: 'Product Detail',- type: 'Template',- bookmarkedAt: '2026-04-07T09:00:00Z',- description: 'E-commerce product page with image gallery and reviews.',- img: `${basePath}/docsite/card4-preview.png`,- author: 'XDS Design',- },- {- name: 'Toast Notification',- type: 'Component',- bookmarkedAt: '2026-04-05T11:00:00Z',- description: 'Stackable toast with auto-dismiss and action support.',- img: DUMMY_IMAGE,- author: 'Andrea Anderson',- },- {- name: 'Kanban Board',- type: 'Template',- bookmarkedAt: '2026-04-02T16:30:00Z',- description: 'Drag-and-drop board with swimlanes and card detail drawers.',- img: DUMMY_IMAGE,- author: 'XDS Design',- },-];--export const PROFILE_COLLECTIONS: {- name: string;- count: number;- color: string;- items: string[];-}[] = [- {- name: 'Work Projects',- count: 4,- color: '#3B82F6',- items: [- 'Admin Dashboard',- 'Matcha Theme',- 'Toast Notification',- 'Kanban Board',- ],- },- {- name: 'Design Inspiration',- count: 6,- color: '#8B5CF6',- items: [- 'Matcha Theme',- 'Brutalist Theme',- 'Admin Dashboard',- 'Product Detail',- 'Toast Notification',- 'Kanban Board',- ],- },- {- name: 'Client Templates',- count: 3,- color: '#F59E0B',- items: ['Admin Dashboard', 'Product Detail', 'Kanban Board'],- },- {- name: 'Dashboard Ideas',- count: 5,- color: '#10B981',- items: [- 'Admin Dashboard',- 'Matcha Theme',- 'Brutalist Theme',- 'Product Detail',- 'Kanban Board',- ],- },- {- name: 'Landing Pages',- count: 8,- color: '#EF4444',- items: [- 'Matcha Theme',- 'Brutalist Theme',- 'Admin Dashboard',- 'Product Detail',- 'Toast Notification',- 'Kanban Board',- 'Matcha Theme',- 'Brutalist Theme',- ],- },-];--export const PROFILE_CRAFT_ITEMS: {- name: string;- type: 'Template' | 'Theme' | 'Component';- status: 'Published' | 'Draft' | 'In Review' | 'Needs Fixes';- used: number;- views: number;- bookmarks: number;- img: string;- lastUpdated: string;- description: string;- tags: string[];-}[] = [- {- name: 'My Dashboard Theme',- type: 'Theme',- status: 'Published',- used: 342,- views: 1205,- bookmarks: 89,- img: FIRST_CARD_IMAGE,- lastUpdated: '2026-03-01T10:00:00Z',- description:- 'Dark-mode friendly theme with custom color tokens and typography overrides.',- tags: ['Dashboard', 'Dark Mode', 'SaaS'],- },- {- name: 'Custom Login Template',- type: 'Template',- status: 'Published',- used: 128,- views: 580,- bookmarks: 34,- img: SHOPPING_DETAILS_IMAGE,- lastUpdated: '2026-03-15T14:30:00Z',- description:- 'Branded login page with social auth buttons and form validation.',- tags: ['Login', 'Authentication', 'Form'],- },- {- name: 'Data Visualization Kit',- type: 'Template',- status: 'Published',- used: 89,- views: 312,- bookmarks: 27,- img: SCREENSHOT_3_IMAGE,- lastUpdated: '2026-04-02T11:00:00Z',- description:- 'Charts, graphs, and data table layouts for analytics dashboards.',- tags: ['Dashboard', 'Charts', 'Analytics'],- },- {- name: 'Landing Page',- type: 'Template',- status: 'Published',- used: 67,- views: 248,- bookmarks: 18,- img: `${basePath}/docsite/card4-preview.png`,- lastUpdated: '2026-02-20T08:00:00Z',- description:- 'Sidebar settings layout with inline editing and expandable rows.',- tags: ['Settings', 'SaaS', 'Admin'],- },- {- name: 'Product Detail Page',- type: 'Template',- status: 'Published',- used: 54,- views: 190,- bookmarks: 15,- img: DUMMY_IMAGE,- lastUpdated: '2026-03-28T12:00:00Z',- description:- 'E-commerce product page with image gallery, reviews, and add-to-cart.',- tags: ['E-commerce', 'Shopping', 'Product'],- },- {- name: 'Custom Notification Card',- type: 'Component',- status: 'Published',- used: 203,- views: 870,- bookmarks: 62,- img: DUMMY_IMAGE,- lastUpdated: '2026-01-15T09:00:00Z',- description:- 'Toast-style notification card with dismiss, action buttons, and auto-hide.',- tags: ['Notification', 'Toast', 'Feedback'],- },- {- name: 'Metric Summary Card',- type: 'Component',- status: 'Published',- used: 156,- views: 620,- bookmarks: 41,- img: DUMMY_IMAGE,- lastUpdated: '2026-02-10T14:00:00Z',- description:- 'KPI card with sparkline, trend indicator, and comparison period.',- tags: ['Dashboard', 'KPI', 'Analytics'],- },- {- name: 'Analytics Dashboard',- type: 'Template',- status: 'In Review',- used: 0,- views: 45,- bookmarks: 0,- img: DUMMY_IMAGE,- lastUpdated: '2026-04-12T09:00:00Z',- description:- 'Full-page analytics dashboard with filters, charts, and data tables.',- tags: ['Dashboard', 'Analytics', 'Data Table'],- },- {- name: 'Team Directory',- type: 'Template',- status: 'In Review',- used: 0,- views: 32,- bookmarks: 0,- img: DUMMY_IMAGE,- lastUpdated: '2026-04-10T16:30:00Z',- description:- 'Searchable team roster with profile cards, org chart, and role filters.',- tags: ['Directory', 'Team', 'Admin'],- },- {- name: 'Checkout Flow',- type: 'Template',- status: 'Needs Fixes',- used: 0,- views: 18,- bookmarks: 0,- img: DUMMY_IMAGE,- lastUpdated: '2026-04-11T14:00:00Z',- description:- 'Multi-step checkout with cart summary, address form, and payment integration.',- tags: ['E-commerce', 'Checkout', 'Form'],- },- {- name: 'Onboarding Flow',- type: 'Template',- status: 'Draft',- used: 0,- views: 12,- bookmarks: 0,- img: DUMMY_IMAGE,- lastUpdated: '2026-04-14T16:00:00Z',- description:- 'Multi-step onboarding wizard with progress bar and skip logic.',- tags: ['Onboarding', 'Wizard', 'Form'],- },- {- name: 'Dark Mode Palette',- type: 'Theme',- status: 'Draft',- used: 0,- views: 8,- bookmarks: 0,- img: DUMMY_IMAGE,- lastUpdated: '2026-04-13T11:30:00Z',- description:- 'High-contrast dark theme with WCAG AA compliant color ratios.',- tags: ['Dark Mode', 'Accessibility', 'Theme'],- },- {- name: 'File Upload Dropzone',- type: 'Component',- status: 'Draft',- used: 0,- views: 5,- bookmarks: 0,- img: DUMMY_IMAGE,- lastUpdated: '2026-04-15T10:00:00Z',- description:- 'Drag-and-drop file uploader with preview thumbnails and progress bars.',- tags: ['Upload', 'Form', 'File'],- },-];--// ----------------------------------------------------------------------------// Publish tags-// -----------------------------------------------------------------------------export const PUBLISH_TAGS = [- 'Landing Page',- 'Dashboard',- 'Marketing',- 'E-commerce',- 'Documentation',- 'SaaS',-];--// ----------------------------------------------------------------------------// Theme picker entries (used in TemplateFullPreview)-// -----------------------------------------------------------------------------export type ThemePickerEntry = {- key: string;- name: string;- category: 'official' | 'community';- accent: string;- description?: string;- isPinnedByDefault?: boolean;- preview: {- bg: string;- surface: string;- accent: string;- text: string;- radius?: number;- font?: string;- img?: string;- };-};--export const THEME_PICKER_ENTRIES: ThemePickerEntry[] = [- // Official — shipped theme packages- {- key: 'default',- name: 'Default',- category: 'official',- accent: '#0066FF',- isPinnedByDefault: true,- description: 'Clean blue accent with neutral grays',- preview: {- bg: '#FFFFFF',- surface: '#F5F5F5',- accent: '#0066FF',- text: '#111111',- radius: 8,- font: 'system-ui, sans-serif',- },- },- {- key: 'threads',- name: 'Threads',- category: 'official',- accent: '#000000',- isPinnedByDefault: true,- description: 'Threads brand with clean monochrome palette',- preview: {- bg: '#FFFFFF',- surface: '#F5F5F5',- accent: '#000000',- text: '#111111',- radius: 16,- font: 'system-ui, sans-serif',- },- },- {- key: 'facebook',- name: 'Facebook',- category: 'official',- accent: '#1877F2',- description: 'Classic Facebook blue brand colors',- preview: {- bg: '#FFFFFF',- surface: '#F0F2F5',- accent: '#1877F2',- text: '#1C1E21',- radius: 8,- font: 'Helvetica, Arial, sans-serif',- },- },- // Community — future user-contributed themes- {- key: 'forest',- name: 'Matcha',- category: 'community',- accent: '#2D8A4E',- description: 'Earthy greens and warm browns',- preview: {- bg: '#F4F7F4',- surface: '#E8EDE8',- accent: '#2D8A4E',- text: '#1A2E1A',- radius: 6,- font: 'Georgia, serif',- img: 'theme-preview-forest.png',- },- },- {- key: 'midnight',- name: 'Midnight',- category: 'community',- accent: '#C9A96E',- description: 'Dark tones with warm bronze accents',- preview: {- bg: '#121212',- surface: '#1E1E1E',- accent: '#C9A96E',- text: '#E8E0D4',- radius: 4,- font: 'SF Mono, monospace',- img: 'theme-preview-midnight.png',- },- },- {- key: 'daily',- name: 'Daily',- category: 'community',- accent: '#4A90D9',- description: 'Soft blues and warm neutrals for everyday tools',- preview: {- bg: '#E8F0FE',- surface: '#FFFFFF',- accent: '#4A90D9',- text: '#1A1A2E',- radius: 8,- font: 'Inter, sans-serif',- img: 'theme-preview-daily.png',- },- },-];--// ----------------------------------------------------------------------------// Preview palettes and font packs-// -----------------------------------------------------------------------------export const PREVIEW_COLOR_PALETTES = [- {name: 'Warm', colors: ['#2D2926', '#D4A574', '#F5E6D3', '#FFFFFF']},- {name: 'Cool', colors: ['#1B2838', '#4A90D9', '#B8D4E3', '#F0F4F8']},- {name: 'Earth', colors: ['#3D2B1F', '#8B6914', '#C4A35A', '#F5F0E1']},- {name: 'Mono', colors: ['#111111', '#555555', '#AAAAAA', '#F5F5F5']},-];--export const PREVIEW_THEMES: Array<{- key: string;- name: string;- category: 'pinned' | 'official' | 'community';- colors: {- background: string;- surface: string;- border: string;- accent: string;- text: string;- };-}> = [- {- key: 'default',- name: 'Default',- category: 'pinned',- colors: {- background: '#FFFFFF',- surface: '#F5F5F5',- border: '#E0E0E0',- accent: '#0066FF',- text: '#1A1A1A',- },- },- {- key: 'dark',- name: 'Dark',- category: 'pinned',- colors: {- background: '#1A1A1A',- surface: '#2A2A2A',- border: '#3A3A3A',- accent: '#4D9EFF',- text: '#F0F0F0',- },- },- {- key: 'warm',- name: 'Warm Sand',- category: 'official',- colors: {- background: '#FDF8F3',- surface: '#F5EDE3',- border: '#E8DDD0',- accent: '#C87941',- text: '#2D2926',- },- },- {- key: 'cool',- name: 'Cool Slate',- category: 'official',- colors: {- background: '#F0F4F8',- surface: '#E2EAF2',- border: '#CBD5E1',- accent: '#3B82F6',- text: '#1E293B',- },- },- {- key: 'forest',- name: 'Matcha',- category: 'community',- colors: {- background: '#F0F5F1',- surface: '#E0EBE2',- border: '#C1D6C5',- accent: '#2D8A4E',- text: '#1A2E1F',- },- },- {- key: 'lavender',- name: 'Lavender',- category: 'community',- colors: {- background: '#F5F0FA',- surface: '#EBE0F5',- border: '#D4C4E8',- accent: '#7C3AED',- text: '#2E1A47',- },- },-];--export const PREVIEW_FONT_PACKS = [- {heading: 'Georgia', paragraph: 'Helvetica Neue'},- {heading: 'Playfair Display', paragraph: 'Source Sans Pro'},- {heading: 'Montserrat', paragraph: 'Merriweather'},- {heading: 'Futura', paragraph: 'Garamond'},-];diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/docsite-icons.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/docsite-icons.tsxdeleted file mode 100644index 0e2de9baf7..0000000000--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/docsite-icons.tsx+++ /dev/null@@ -1,254 +0,0 @@-// Copyright (c) Meta Platforms, Inc. and affiliates.--'use client';--import React from 'react';--export {- PlusIcon,- LinkIcon,- CheckIcon,- HeartIcon,- ChevronDownIcon,- FolderIcon,- ArrowLeftIcon,- BookmarkIcon,- ArrowRightIcon as SendIcon,- PaintBrushIcon as PaletteIcon,- SunIcon as ContrastIcon,- ArrowUpTrayIcon as UploadIcon,- ArrowUpTrayIcon as ShareIcon,- ArrowDownTrayIcon as DownloadIcon,- ArrowTopRightOnSquareIcon as ExternalLinkIcon,- ArrowUpOnSquareIcon as ShareOutIcon,- MoonIcon,- ArrowsPointingOutIcon as FullscreenIcon,- Bars3Icon as HamburgerIcon,- CodeBracketIcon as CodeIcon,- ComputerDesktopIcon as DesktopIcon,- CommandLineIcon as TerminalIcon,- CursorArrowRaysIcon as CursorIcon,- DevicePhoneMobileIcon as PhoneIcon,- DocumentDuplicateIcon as CopyIcon,- MagnifyingGlassIcon as SearchIcon,- UserIcon as ProfileIcon,- AdjustmentsHorizontalIcon as FilterIcon,- BarsArrowDownIcon as SortIcon,- Squares2X2Icon as GridIcon,- XMarkIcon,- SparklesIcon,- StopIcon,- StarIcon,- CheckBadgeIcon as VerifiedIcon,- ChatBubbleLeftRightIcon as ChatIcon,- ChartBarIcon as ChartsIcon,-} from '@heroicons/react/24/outline';--export {- BookmarkIcon as BookmarkFilledIcon,- HeartIcon as HeartFilledIcon,- StarIcon as StarFilledIcon,- CheckBadgeIcon as VerifiedFilledIcon,-} from '@heroicons/react/24/solid';--// Brand logos for theme picker--export const PinIcon = (props: React.SVGProps<SVGSVGElement>) => (- <svg- viewBox="0 0 24 24"- fill="none"- stroke="currentColor"- strokeWidth={2}- strokeLinecap="round"- strokeLinejoin="round"- {...props}>- <path d="M12 17v5" />- <path d="M9 2h6l-1 7h4l-2 4H8L6 9h4z" />- </svg>-);--export const PinFilledIcon = (props: React.SVGProps<SVGSVGElement>) => (- <svg viewBox="0 0 24 24" fill="currentColor" stroke="none" {...props}>- <path d="M9 2h6l-1 7h4l-2 4H8L6 9h4z" />- <rect x="11" y="17" width="2" height="5" rx="1" />- </svg>-);--export const ThreadsLogo = (props: React.SVGProps<SVGSVGElement>) => (- <svg aria-label="Threads" viewBox="0 0 192 192" {...props}>- <path- d="M141.537 88.9883C140.71 88.5919 139.87 88.2104 139.019 87.8451C137.537 60.5382 122.616 44.905 97.5619 44.745C97.4484 44.7443 97.3355 44.7443 97.222 44.7443C82.2364 44.7443 69.7731 51.1409 62.102 62.7807L75.881 72.2328C81.6116 63.5383 90.6052 61.6848 97.2286 61.6848C97.3051 61.6848 97.3819 61.6848 97.4576 61.6855C105.707 61.7381 111.932 64.1366 115.961 68.814C118.893 72.2193 120.854 76.925 121.825 82.8638C114.511 81.6207 106.601 81.2385 98.145 81.7233C74.3247 83.0954 59.0111 96.9879 60.0396 116.292C60.5615 126.084 65.4397 134.508 73.775 140.011C80.8224 144.663 89.899 146.938 99.3323 146.423C111.79 145.74 121.563 140.987 128.381 132.296C133.559 125.696 136.834 117.143 138.28 106.366C144.217 109.949 148.617 114.664 151.047 120.332C155.179 129.967 155.42 145.8 142.501 158.708C131.182 170.016 117.576 174.908 97.0135 175.059C74.2042 174.89 56.9538 167.575 45.7381 153.317C35.2355 139.966 29.8077 120.682 29.6052 96C29.8077 71.3178 35.2355 52.0336 45.7381 38.6827C56.9538 24.4249 74.2039 17.11 97.0132 16.9405C119.988 17.1113 137.539 24.4614 149.184 38.788C154.894 45.8136 159.199 54.6488 162.037 64.9503L178.184 60.6422C174.744 47.9622 169.331 37.0357 161.965 27.974C147.036 9.60668 125.202 0.195148 97.0695 0H96.9569C68.8816 0.19447 47.2921 9.6418 32.7883 28.0793C19.8819 44.4864 13.2244 67.3157 13.0007 95.9325L13 96L13.0007 96.0675C13.2244 124.684 19.8819 147.514 32.7883 163.921C47.2921 182.358 68.8816 191.806 96.9569 192H97.0695C122.03 191.827 139.624 185.292 154.118 170.811C173.081 151.866 172.51 128.119 166.26 113.541C161.776 103.087 153.227 94.5962 141.537 88.9883ZM98.4405 129.507C88.0005 130.095 77.1544 125.409 76.6196 115.372C76.2232 107.93 81.9158 99.626 99.0812 98.6368C101.047 98.5234 102.976 98.468 104.871 98.468C111.106 98.468 116.939 99.0737 122.242 100.233C120.264 124.935 108.662 128.946 98.4405 129.507Z"- fill="#000"- />- </svg>-);--export const FacebookLogo = (props: React.SVGProps<SVGSVGElement>) => (- <svg viewBox="0 0 24 24" fill="none" {...props}>- <path- d="M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"- fill="#1877F2"- />- </svg>-);--// Theme icons — distinctive identifiers for each theme--export const DefaultThemeIcon = (props: React.SVGProps<SVGSVGElement>) => (- <svg viewBox="0 0 46 24" fill="currentColor" {...props}>- <path d="M2.4239 15.8011C2.03945 16.3796 1.66972 16.9538 1.3147 17.524C0.707427 18.4992 1.42354 19.7348 2.57241 19.7348C3.13302 19.7348 3.64463 19.4209 3.91525 18.93C4.29391 18.243 4.71274 17.5352 5.17173 16.8066C5.38894 16.4618 5.60743 16.12 5.82721 15.7812C6.25251 15.1254 6.46516 14.7976 6.76252 14.68C6.99255 14.5891 7.27368 14.5899 7.50317 14.6822C7.79984 14.8014 8.00881 15.1278 8.42675 15.7804C8.64287 16.1179 8.85732 16.46 9.07008 16.8066C9.52175 17.534 9.93823 18.2339 10.3195 18.9063C10.6075 19.4141 11.1428 19.7348 11.7266 19.7348C12.9476 19.7348 13.7063 18.4203 13.0547 17.3877C12.7332 16.8781 12.3991 16.3639 12.0525 15.8453C11.3983 14.8527 10.7379 13.8906 10.0714 12.9592C9.81687 12.6036 9.68962 12.4258 9.64377 12.2384C9.60589 12.0836 9.60492 11.9307 9.64085 11.7754C9.68435 11.5874 9.80856 11.4091 10.057 11.0526C10.7093 10.1164 11.3596 9.15781 12.0078 8.1768C12.3869 7.60474 12.7521 7.03681 13.1035 6.47298C13.71 5.49987 12.9962 4.26519 11.8496 4.26519C11.2943 4.26519 10.7868 4.57405 10.5169 5.05923C10.1399 5.73688 9.72461 6.43721 9.27114 7.16022C9.06143 7.49458 8.8505 7.82569 8.63835 8.15358C8.21478 8.80819 8.003 9.1355 7.70554 9.25334C7.47561 9.34442 7.19397 9.34375 6.96448 9.25156C6.66759 9.13229 6.45853 8.80578 6.04043 8.15276C5.83116 7.82591 5.62351 7.49506 5.41747 7.16022C4.97918 6.44793 4.5738 5.76096 4.20132 5.0993C3.9136 4.58821 3.37617 4.26519 2.78967 4.26519C1.56624 4.26519 0.805692 5.58299 1.45419 6.62041C1.76588 7.11903 2.08912 7.6231 2.4239 8.1326C3.0752 9.10994 3.73263 10.059 4.3962 10.9796C4.65373 11.337 4.7825 11.5156 4.82882 11.7042C4.86709 11.86 4.86797 12.0139 4.83149 12.1702C4.78732 12.3593 4.66122 12.5385 4.40903 12.897C3.74526 13.8406 3.08355 14.8086 2.4239 15.8011Z" />- <path- fillRule="evenodd"- clipRule="evenodd"- d="M22.4734 4.26519C20.4471 4.26519 19.434 4.26519 18.6657 4.67201C18.0456 5.00031 17.5385 5.50739 17.2102 6.12744C16.8034 6.89579 16.8034 7.90892 16.8034 9.9352V14.0648C16.8034 16.0911 16.8034 17.1042 17.2102 17.8726C17.5385 18.4926 18.0456 18.9997 18.6657 19.328C19.434 19.7348 20.4471 19.7348 22.4734 19.7348H23.2039C24.8496 19.7348 26.2644 19.4033 27.4485 18.7403C28.6399 18.07 29.5559 17.1529 30.1963 15.989C30.8367 14.825 31.1569 13.4954 31.1569 12C31.1569 10.5046 30.8367 9.17495 30.1963 8.01105C29.5559 6.84714 28.6399 5.9337 27.4485 5.27072C26.2644 4.60037 24.8496 4.26519 23.2039 4.26519H22.4734ZM20.0092 8.74707C20.0092 8.16814 20.0092 7.87867 20.1255 7.65914C20.2193 7.48198 20.3641 7.33711 20.5413 7.24331C20.7608 7.12707 21.0503 7.12707 21.6292 7.12707H23.1927C24.6522 7.12707 25.7916 7.57274 26.6107 8.46409C27.4299 9.34807 27.8394 10.5267 27.8394 12C27.8394 13.4659 27.4299 14.6446 26.6107 15.5359C25.7916 16.4273 24.6522 16.8729 23.1927 16.8729H21.6292C21.0503 16.8729 20.7608 16.8729 20.5413 16.7567C20.3641 16.6629 20.2193 16.518 20.1255 16.3409C20.0092 16.1213 20.0092 15.8319 20.0092 15.2529V8.74707Z"- />- <path d="M35.4666 19.2376C36.6134 19.7459 37.9501 20 39.4767 20H39.8006C41.7144 20 43.2261 19.5801 44.3357 18.7403C45.4452 17.9006 46 16.7403 46 15.2597C46 14.3757 45.8213 13.6501 45.4638 13.0829C45.1064 12.5083 44.6559 12.0589 44.1123 11.7348C43.5761 11.4033 43.0325 11.1565 42.4814 10.9945C41.9304 10.8324 41.4575 10.7145 41.0628 10.6409L38.706 10.1878C38.0283 10.0552 37.4698 9.87477 37.0305 9.64641C36.5985 9.41068 36.3826 9.02762 36.3826 8.49724C36.3826 7.96685 36.6395 7.55064 37.1533 7.24862C37.6671 6.93923 38.3857 6.78453 39.3091 6.78453H39.6219C40.3964 6.78453 41.1224 6.93186 41.8001 7.22652C42.0982 7.35474 42.3899 7.5234 42.6754 7.73251C43.326 8.20923 44.2444 8.27802 44.8243 7.71734C45.34 7.21868 45.4053 6.39786 44.8761 5.91349C44.3498 5.43171 43.7638 5.03698 43.1181 4.72928C42.1054 4.24309 40.9511 4 39.6554 4H39.3315C38.0953 4 37.0156 4.19521 36.0922 4.58564C35.1762 4.97606 34.4613 5.52486 33.9475 6.23204C33.4411 6.93186 33.188 7.76059 33.188 8.71823C33.188 9.49171 33.3406 10.1436 33.6459 10.674C33.9587 11.2044 34.3571 11.6354 34.8411 11.9669C35.3326 12.2983 35.8539 12.5599 36.4049 12.7514C36.956 12.9355 37.4698 13.0718 37.9464 13.1602L40.3033 13.6243C40.6905 13.698 41.074 13.8011 41.4538 13.9337C41.841 14.0589 42.1612 14.2431 42.4144 14.4862C42.6676 14.7293 42.7942 15.0608 42.7942 15.4807C42.7942 16.6151 41.7814 17.1823 39.7559 17.1823H39.4432C38.49 17.1823 37.615 17.0055 36.8182 16.6519C36.4847 16.4994 36.1665 16.3134 35.8635 16.0938C35.17 15.5911 34.1857 15.5241 33.5784 16.1282C33.0651 16.6388 32.9912 17.4631 33.5198 17.9578C34.0797 18.4818 34.7287 18.9083 35.4666 19.2376Z" />- </svg>-);--export const NeutralThemeIcon = (props: React.SVGProps<SVGSVGElement>) => (- <svg viewBox="0 0 20 20" fill="none" {...props}>- <circle cx="10" cy="10" r="8" stroke="#525252" strokeWidth="2" />- <path d="M10 2a8 8 0 010 16V2z" fill="#525252" />- </svg>-);--export const BrutalistThemeIcon = (props: React.SVGProps<SVGSVGElement>) => (- <svg viewBox="0 0 20 20" fill="none" {...props}>- <path d="M10 1L19 10L10 19L1 10Z" fill="#FF1493" />- <path d="M10 5L15 10L10 15L5 10Z" fill="#fff" />- </svg>-);--export const DailyThemeIcon = (props: React.SVGProps<SVGSVGElement>) => (- <svg viewBox="0 0 20 20" fill="none" {...props}>- <circle cx="10" cy="10" r="4" fill="#0064E0" />- {[0, 45, 90, 135, 180, 225, 270, 315].map(deg => (- <line- key={deg}- x1="10"- y1="2"- x2="10"- y2="4.5"- stroke="#0064E0"- strokeWidth="1.8"- strokeLinecap="round"- transform={`rotate(${deg} 10 10)`}- />- ))}- </svg>-);--export const ForestThemeIcon = (props: React.SVGProps<SVGSVGElement>) => (- <svg viewBox="0 0 20 20" fill="none" {...props}>- <path- d="M10 2C10 2 4 8 4 12.5C4 15.5 6.7 18 10 18C13.3 18 16 15.5 16 12.5C16 8 10 2 10 2Z"- fill="#2D8A4E"- />- <path- d="M10 10V17"- stroke="#1A5C33"- strokeWidth="1.5"- strokeLinecap="round"- />- <path- d="M10 13C8.5 11.5 7 12 7 12"- stroke="#1A5C33"- strokeWidth="1.2"- strokeLinecap="round"- />- </svg>-);--export const SunsetThemeIcon = (props: React.SVGProps<SVGSVGElement>) => (- <svg viewBox="0 0 20 20" fill="none" {...props}>- <path- d="M3 14h14"- stroke="#E5484D"- strokeWidth="1.5"- strokeLinecap="round"- />- <path d="M5 14a5 5 0 0110 0" fill="#E5484D" />- <path- d="M10 3v2M15.5 8.5l-1.4 1.4M4.5 8.5l1.4 1.4M17 14h0M3 14h0"- stroke="#F59E0B"- strokeWidth="1.5"- strokeLinecap="round"- />- </svg>-);--export const MidnightThemeIcon = (props: React.SVGProps<SVGSVGElement>) => (- <svg viewBox="0 0 20 20" fill="none" {...props}>- <path- d="M15.5 11.5A6.5 6.5 0 018.5 4.5 6.5 6.5 0 1015.5 11.5z"- fill="#818CF8"- />- <circle cx="14" cy="5" r="1" fill="#818CF8" opacity={0.6} />- <circle cx="16.5" cy="8" r="0.6" fill="#818CF8" opacity={0.4} />- </svg>-);--// Brand icons — no Heroicons equivalent--export const ClaudeIcon = (props: React.SVGProps<SVGSVGElement>) => (- <svg viewBox="0 0 248 248" fill="none" {...props}>- <path- d="M52.4285 162.873L98.7844 136.879L99.5485 134.602L98.7844 133.334H96.4921L88.7237 132.862L62.2346 132.153L39.3113 131.207L17.0249 130.026L11.4214 128.844L6.2 121.873L6.7094 118.447L11.4214 115.257L18.171 115.847L33.0711 116.911L55.485 118.447L71.6586 119.392L95.728 121.873H99.5485L100.058 120.337L98.7844 119.392L97.7656 118.447L74.5877 102.732L49.4995 86.1905L36.3823 76.62L29.3779 71.7757L25.8121 67.2858L24.2839 57.3608L30.6515 50.2716L39.3113 50.8623L41.4763 51.4531L50.2636 58.1879L68.9842 72.7209L93.4357 90.6804L97.0015 93.6343L98.4374 92.6652L98.6571 91.9801L97.0015 89.2625L83.757 65.2772L69.621 40.8192L63.2534 30.6579L61.5978 24.632C60.9565 22.1032 60.579 20.0111 60.579 17.4246L67.8381 7.49965L71.9133 6.19995L81.7193 7.49965L85.7946 11.0443L91.9074 24.9865L101.714 46.8451L116.996 76.62L121.453 85.4816L123.873 93.6343L124.764 96.1155H126.292V94.6976L127.566 77.9197L129.858 57.3608L132.15 30.8942L132.915 23.4505L136.608 14.4708L143.994 9.62643L149.725 12.344L154.437 19.0788L153.8 23.4505L150.998 41.6463L145.522 70.1215L141.957 89.2625H143.994L146.414 86.7813L156.093 74.0206L172.266 53.698L179.398 45.6635L187.803 36.802L193.152 32.5484H203.34L210.726 43.6549L207.415 55.1159L196.972 68.3492L188.312 79.5739L175.896 96.2095L168.191 109.585L168.882 110.689L170.738 110.53L198.755 104.504L213.91 101.787L231.994 98.7149L240.144 102.496L241.036 106.395L237.852 114.311L218.495 119.037L195.826 123.645L162.07 131.592L161.696 131.893L162.137 132.547L177.36 133.925L183.855 134.279H199.774L229.447 136.524L237.215 141.605L241.8 147.867L241.036 152.711L229.065 158.737L213.019 154.956L175.45 145.977L162.587 142.787H160.805V143.85L171.502 154.366L191.242 172.089L215.82 195.011L217.094 200.682L213.91 205.172L210.599 204.699L188.949 188.394L180.544 181.069L161.696 165.118H160.422V166.772L164.752 173.152L187.803 207.771L188.949 218.405L187.294 221.832L181.308 223.959L174.813 222.777L161.187 203.754L147.305 182.486L136.098 163.345L134.745 164.2L128.075 235.42L125.019 239.082L117.887 241.8L111.902 237.31L108.718 229.984L111.902 215.452L115.722 196.547L118.779 181.541L121.58 162.873L123.291 156.636L123.14 156.219L121.773 156.449L107.699 175.752L86.304 204.699L69.3663 222.777L65.291 224.431L58.2867 220.768L58.9235 214.27L62.8713 208.48L86.304 178.705L100.44 160.155L109.551 149.507L109.462 147.967L108.959 147.924L46.6977 188.512L35.6182 189.93L30.7788 185.44L31.4156 178.115L33.7079 175.752L52.4285 162.873Z"- fill="#D97757"- />- </svg>-);--export const VSCodeIcon = (props: React.SVGProps<SVGSVGElement>) => (- <svg viewBox="0 0 100 100" fill="none" {...props}>- <path- fillRule="evenodd"- clipRule="evenodd"- d="M70.9119 99.3171C72.4869 99.9307 74.2828 99.8914 75.8725 99.1264L96.4608 89.2197C98.6242 88.1787 100 85.9892 100 83.5872V16.4133C100 14.0113 98.6243 11.8218 96.4609 10.7808L75.8725 0.873756C73.7862 -0.130129 71.3446 0.11576 69.5135 1.44695C69.252 1.63711 69.0028 1.84943 68.769 2.08341L29.3551 38.0415L12.1872 25.0096C10.589 23.7965 8.35363 23.8959 6.86933 25.2461L1.36303 30.2549C-0.452552 31.9064 -0.454633 34.7627 1.35853 36.417L16.2471 50.0001L1.35853 63.5832C-0.454633 65.2374 -0.452552 68.0938 1.36303 69.7453L6.86933 74.7541C8.35363 76.1043 10.589 76.2037 12.1872 74.9905L29.3551 61.9587L68.769 97.9167C69.3925 98.5406 70.1246 99.0104 70.9119 99.3171ZM75.0152 27.2989L45.1091 50.0001L75.0152 72.7012V27.2989Z"- fill="#007ACC"- />- </svg>-);--export const CursorAIIcon = (props: React.SVGProps<SVGSVGElement>) => (- <svg viewBox="0 0 512 512" fill="none" {...props}>- <path- d="M415.035 156.35l-151.503-87.4695c-4.865-2.8094-10.868-2.8094-15.733 0l-151.4969 87.4695c-4.0897 2.362-6.6146 6.729-6.6146 11.459v176.383c0 4.73 2.5249 9.097 6.6146 11.458l151.5039 87.47c4.865 2.809 10.868 2.809 15.733 0l151.504-87.47c4.089-2.361 6.614-6.728 6.614-11.458v-176.383c0-4.73-2.525-9.097-6.614-11.459zm-9.516 18.528l-146.255 253.32c-.988 1.707-3.599 1.01-3.599-.967v-165.872c0-3.314-1.771-6.379-4.644-8.044l-143.645-82.932c-1.707-.988-1.01-3.599.968-3.599h292.509c4.154 0 6.75 4.503 4.673 8.101h-.007z"- fill="currentColor"- />- </svg>-);--// Layout icon — no Heroicons equivalent--export const SidebarIcon = (props: React.SVGProps<SVGSVGElement>) => (- <svg- viewBox="0 0 24 24"- fill="none"- stroke="currentColor"- strokeWidth={1.5}- strokeLinecap="round"- strokeLinejoin="round"- {...props}>- <rect x="3" y="3" width="18" height="18" rx="2" />- <line x1="9" y1="3" x2="9" y2="21" />- </svg>-);--// Floppy-disk save icon — no Heroicons equivalent--export const SaveIcon = (props: React.SVGProps<SVGSVGElement>) => (- <svg- viewBox="0 0 24 24"- fill="none"- stroke="currentColor"- strokeWidth={1.5}- strokeLinecap="round"- strokeLinejoin="round"- {...props}>- <path d="M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z" />- <polyline points="17 21 17 13 7 13 7 21" />- <polyline points="7 3 7 8 15 8" />- </svg>-);diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/docsview-data.ts b/apps/sandbox/src/app/(fullscreen)/pages/docsite/docsview-data.tsdeleted file mode 100644index 739a0760b9..0000000000--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/docsview-data.ts+++ /dev/null@@ -1,502 +0,0 @@-// Copyright (c) Meta Platforms, Inc. and affiliates.--export const COMPONENT_CATEGORIES = [- {- label: 'Core',- items: [- {- key: 'appshell',- name: 'AppShell',- desc: 'AppShell provides a foundational page layout with header, sidebar, and content regions. Use it to establish consistent structure across your application.',- },- {- key: 'avatar',- name: 'Avatar',- desc: 'Avatars represent a person or entity with an image, initials, or icon. They are commonly used in user profiles, comments, and contact lists.',- },- {- key: 'badge',- name: 'Badge',- desc: 'Badges display small counts or status labels. They can be attached to icons, buttons, or list items to surface key information at a glance.',- },- {- key: 'banner',- name: 'Banner',- desc: 'Banners show important, non-modal messages at the top of a page or section. They communicate status, warnings, or promotional information.',- },- {- key: 'button',- name: 'Button',- desc: 'Buttons let people take action. They can be used in forms, dialogs, and toolbars, or as standalone links.',- },- {- key: 'calendar',- name: 'Calendar',- desc: 'Calendar provides a date-picking grid for selecting single dates or date ranges. It integrates with form fields for date input.',- },- {- key: 'dialog',- name: 'Dialog',- desc: 'Dialogs are modal overlays that require user attention or action before continuing. They are used for confirmations, forms, and critical decisions.',- },- {- key: 'dropdownmenu',- name: 'DropdownMenu',- desc: 'DropdownMenu presents a list of actions or options in a floating overlay. It is triggered by a button and supports nested submenus.',- },- {- key: 'emptystate',- name: 'EmptyState',- desc: 'EmptyState provides a placeholder when there is no content to display. It guides users with a message, illustration, and optional call-to-action.',- },- {- key: 'hovercard',- name: 'HoverCard',- desc: 'HoverCard shows a rich preview of content when users hover over a trigger element. It is ideal for previewing profiles, links, or details.',- },- {- key: 'icon',- name: 'Icon',- desc: 'Icons are small visual symbols that represent actions, objects, or concepts. They improve scannability and reinforce meaning alongside text.',- },- {- key: 'kbd',- name: 'Kbd',- desc: 'Kbd renders keyboard shortcut hints in a styled inline element. Use it to show users which key combinations perform specific actions.',- },- {- key: 'link',- name: 'Link',- desc: 'Links provide navigation between pages or to external resources. They follow accessible anchor semantics with visual affordance.',- },- {- key: 'list',- name: 'List',- desc: 'List displays a vertical set of related items. It supports selection, icons, and metadata for building menus, nav lists, and more.',- },- {- key: 'metadatalist',- name: 'MetadataList',- desc: 'MetadataList displays key-value pairs in a structured layout. Use it for detail panels, settings summaries, and record information.',- },- {- key: 'moremenu',- name: 'MoreMenu',- desc: 'MoreMenu provides an overflow menu triggered by an icon button. It collects secondary actions that do not fit in the primary toolbar.',- },- {- key: 'overflowlist',- name: 'OverflowList',- desc: 'OverflowList renders as many items as fit in the available space and collapses the rest into an overflow menu automatically.',- },- {- key: 'pagination',- name: 'Pagination',- desc: 'Pagination lets users navigate through pages of content. It supports page numbers, previous/next controls, and page-size selection.',- },- {- key: 'popover',- name: 'Popover',- desc: 'Popover displays rich content in a floating panel anchored to a trigger element. It is used for forms, filters, and contextual tools.',- },- {- key: 'progressbar',- name: 'ProgressBar',- desc: 'ProgressBar shows the completion status of a task or process. It provides visual feedback for uploads, installations, and multi-step flows.',- },- {- key: 'skeleton',- name: 'Skeleton',- desc: 'Skeleton renders placeholder shapes that mimic content layout while loading. It reduces perceived wait time and prevents layout shifts.',- },- {- key: 'spinner',- name: 'Spinner',- desc: 'Spinner indicates that a process is in progress when the duration is unknown. It draws attention without blocking the interface.',- },- {- key: 'statusdot',- name: 'StatusDot',- desc: 'StatusDot shows a small colored indicator for online, offline, busy, or custom statuses. It is often paired with avatars or list items.',- },- {- key: 'table',- name: 'Table',- desc: 'Table displays structured data in rows and columns with support for sorting, selection, and custom cell rendering.',- },- {- key: 'thumbnail',- name: 'Thumbnail',- desc: 'Thumbnail renders a small image preview with consistent sizing and optional rounded corners. It is used in media lists, cards, and galleries.',- },- {- key: 'timestamp',- name: 'Timestamp',- desc: 'Timestamp formats and displays dates and times with relative or absolute labels. It updates automatically to stay current.',- },- {- key: 'toast',- name: 'Toast',- desc: 'Toasts display brief, non-blocking notifications at the edge of the screen. They auto-dismiss and are used for success, error, or info messages.',- },- {- key: 'togglebutton',- name: 'ToggleButton',- desc: 'ToggleButton is a button that switches between an on and off state. Use it for binary options like bookmarking, favoriting, or muting.',- },- {- key: 'token',- name: 'Token',- desc: 'Tokens display compact metadata labels such as tags, categories, or filters. They can be dismissible and support selection state.',- },- {- key: 'tooltip',- name: 'Tooltip',- desc: 'Tooltips show concise helper text when users hover over or focus an element. They clarify icons, truncated labels, and controls.',- },- {- key: 'treelist',- name: 'TreeList',- desc: 'TreeList renders hierarchical data in an expandable tree structure. It supports multi-level nesting, selection, and lazy loading.',- },- ],- },- {- label: 'Typography',- items: [- {- key: 'heading',- name: 'Heading',- desc: 'Heading renders semantic section titles from h1 through h6. It establishes visual hierarchy and supports multiple weight and size options.',- },- {- key: 'text',- name: 'Text',- desc: 'Text renders body copy, labels, and supporting content with consistent typography. It supports sizes from display down to caption.',- },- ],- },- {- label: 'Layout',- items: [- {- key: 'aspectratio',- name: 'AspectRatio',- desc: 'AspectRatio constrains its child to a specified width-to-height ratio. Use it for responsive images, videos, and embedded media.',- },- {- key: 'card',- name: 'Card',- desc: 'Cards group related content and actions in a contained surface. They can include headers, media, body text, and action bars.',- },- {- key: 'center',- name: 'Center',- desc: 'Center aligns its child horizontally and vertically within the available space. It is useful for empty states, loading screens, and hero sections.',- },- {- key: 'divider',- name: 'Divider',- desc: 'Dividers separate content into distinct sections with a subtle or strong horizontal line. They can optionally include a label.',- },- {- key: 'grid',- name: 'Grid',- desc: 'Grid provides a CSS grid-based layout container with configurable columns, rows, and gap. It simplifies responsive multi-column designs.',- },- {- key: 'layout',- name: 'Layout',- desc: 'Layout provides foundational page-level primitives for header, sidebar, and content regions. It establishes consistent spacing and structure.',- },- {- key: 'section',- name: 'Section',- desc: 'Section wraps a block of content with consistent vertical spacing and an optional heading. It structures pages into logical groups.',- },- {- key: 'stack',- name: 'Stack',- desc: 'Stack arranges child elements in a row or column with consistent gap spacing. It is the primary tool for one-dimensional layout composition.',- },- {- key: 'toolbar',- name: 'Toolbar',- desc: 'Toolbar arranges a row of action buttons and controls in a compact, aligned strip. It is used at the top of panels, editors, and cards.',- },- ],- },- {- label: 'Navigation',- items: [- {- key: 'breadcrumbs',- name: 'Breadcrumbs',- desc: "Breadcrumbs show the user's current location within a navigation hierarchy. They provide quick links back to parent pages.",- },- {- key: 'mobilenav',- name: 'MobileNav',- desc: 'MobileNav provides a responsive navigation menu optimized for small screens. It typically slides in from the edge of the viewport.',- },- {- key: 'sidenav',- name: 'SideNav',- desc: 'SideNav renders a vertical navigation panel with links, sections, and collapsible groups. It is used as the primary nav in dashboard layouts.',- },- {- key: 'tablist',- name: 'TabList',- desc: 'TabList switches between content views using a horizontal row of tabs. Only one tab is active at a time, and content changes without a page reload.',- },- {- key: 'topnav',- name: 'TopNav',- desc: 'TopNav provides an app-level navigation bar across the top of the page. It holds branding, primary links, search, and user actions.',- },- ],- },- {- label: 'Form',- items: [- {- key: 'checkboxinput',- name: 'CheckboxInput',- desc: 'CheckboxInput renders a single checkbox with a label. It is used for boolean opt-in choices like terms acceptance or feature toggles.',- },- {- key: 'checkboxlist',- name: 'CheckboxList',- desc: 'CheckboxList displays a group of checkboxes for selecting multiple options. It manages shared state and supports select-all behavior.',- },- {- key: 'dateinput',- name: 'DateInput',- desc: 'DateInput provides a text field with calendar picker for entering dates. It validates format and supports min/max date constraints.',- },- {- key: 'field',- name: 'Field',- desc: 'Field wraps a form control with a label, helper text, and error message. It ensures consistent layout and accessibility across all form inputs.',- },- {- key: 'formlayout',- name: 'FormLayout',- desc: 'FormLayout arranges form fields in a structured vertical or horizontal layout with consistent spacing and alignment.',- },- {- key: 'multiselector',- name: 'MultiSelector',- desc: 'MultiSelector lets users pick multiple items from a searchable list with tokenized selections. It is ideal for assigning tags, teams, or categories.',- },- {- key: 'numberinput',- name: 'NumberInput',- desc: 'NumberInput provides a text field for numeric values with optional increment/decrement controls. It supports min, max, and step constraints.',- },- {- key: 'powersearch',- name: 'PowerSearch',- desc: 'PowerSearch provides an advanced search interface with filters, suggestions, and structured query support for complex data exploration.',- },- {- key: 'radiolist',- name: 'RadioList',- desc: 'RadioList presents a group of mutually exclusive options. Only one option can be selected at a time, making it ideal for settings and preferences.',- },- {- key: 'selector',- name: 'Selector',- desc: 'Selector lets users pick a single item from a dropdown list. It supports search, grouping, and custom option rendering.',- },- {- key: 'slider',- name: 'Slider',- desc: 'Slider lets users select a value or range by dragging a handle along a track. It is used for volume, brightness, and numeric range inputs.',- },- {- key: 'switch',- name: 'Switch',- desc: 'Switch toggles a setting between on and off states with immediate effect. It is used for preferences, feature flags, and real-time controls.',- },- {- key: 'textarea',- name: 'TextArea',- desc: 'TextArea provides a multi-line text field for longer-form content like comments, descriptions, and messages. It supports auto-resize.',- },- {- key: 'textinput',- name: 'TextInput',- desc: 'TextInput is a single-line text field for short user input like names, emails, and search queries. It supports icons, prefixes, and validation.',- },- {- key: 'timeinput',- name: 'TimeInput',- desc: 'TimeInput provides a field for entering times with optional picker support. It validates format and supports 12- and 24-hour modes.',- },- {- key: 'tokenizer',- name: 'Tokenizer',- desc: 'Tokenizer is a text input that converts entries into removable tokens. It is used for multi-value fields like email recipients and tags.',- },- {- key: 'typeahead',- name: 'Typeahead',- desc: 'Typeahead provides an autocomplete search input that suggests results as the user types. It supports async data sources and custom rendering.',- },- ],- },- {- label: 'Inputs',- items: [- {- key: 'segmentedcontrol',- name: 'SegmentedControl',- desc: 'SegmentedControl lets users toggle between a small set of mutually exclusive options displayed as connected segments. It works like a visual radio group.',- },- ],- },- {- label: 'Components',- items: [- {- key: 'codeblock',- name: 'CodeBlock',- desc: 'CodeBlock displays formatted, syntax-highlighted source code. It supports line numbers, copy-to-clipboard, and language detection.',- },- {- key: 'collapsible',- name: 'Collapsible',- desc: 'Collapsible wraps content that can be expanded or collapsed with a trigger. It is used for FAQs, advanced settings, and progressive disclosure.',- },- {- key: 'markdown',- name: 'Markdown',- desc: 'Markdown renders markdown-formatted text into styled HTML. It supports headings, lists, links, code blocks, and inline formatting.',- },- ],- },- {- label: 'Chat',- items: [- {- key: 'chat',- name: 'Chat',- desc: 'Chat provides a conversational message interface with message bubbles, input, and thread support. It is used for AI assistants and messaging UIs.',- },- ],- },- {- label: 'CommandPalette',- items: [- {- key: 'commandpalette',- name: 'CommandPalette',- desc: 'CommandPalette is a keyboard-driven command menu for quick navigation and actions. It is opened with a hotkey and supports fuzzy search.',- },- ],- },-];--const COMPONENT_DOCS: {- [key: string]: {- tagline: string;- description: string;- whenToUse: string[];- whenNotToUse: string[];- anatomy: {element: string; required: string; description: string}[];- };-} = {- button: {- tagline: 'Trigger actions and navigate',- description:- 'Buttons communicate the action that will occur when the user touches them. They can be placed in dialogs, forms, cards, and toolbars. The primary variant is used for the most important action on a page, while secondary and ghost variants provide visual hierarchy.',- whenToUse: [- 'To trigger an action such as submitting a form or opening a dialog',- 'As a call-to-action in marketing or onboarding surfaces',- 'In toolbars and action bars for contextual operations',- ],- whenNotToUse: [- 'For navigation to another page — use Link instead',- 'To toggle a state on/off — use ToggleButton or Switch instead',- 'When the action is part of a menu — use DropdownMenu instead',- ],- anatomy: [- {- element: 'Root',- required: 'Yes',- description:- 'The outer <button> element that handles click events and focus state',- },- {- element: 'Label',- required: 'Yes',- description: 'Text content describing the action the button performs',- },- {- element: 'Icon',- required: 'No',- description:- 'Optional leading or trailing icon for visual reinforcement',- },- {- element: 'Spinner',- required: 'No',- description:- 'Shown when the button is in a loading state, replaces the icon slot',- },- ],- },-};--export function getComponentName(key: string): string {- for (const cat of COMPONENT_CATEGORIES) {- const item = cat.items.find(i => i.key === key);- if (item) {- return item.name;- }- }- return key;-}--export function getComponentDesc(key: string): string {- for (const cat of COMPONENT_CATEGORIES) {- const item = cat.items.find(i => i.key === key);- if (item) {- return item.desc;- }- }- return '';-}--export function getComponentDocs(key: string) {- if (COMPONENT_DOCS[key]) {- return COMPONENT_DOCS[key];- }- const name = getComponentName(key);- const desc = getComponentDesc(key);- return {- tagline: desc.split('.')[0] + '.',- description: desc,- whenToUse: [- `Use ${name} when you need the functionality it provides`,- 'Integrate it into forms, pages, or panels as appropriate',- ],- whenNotToUse: [- 'When a simpler alternative achieves the same goal',- 'If the use case falls outside the intended scope of this component',- ],- anatomy: [- {- element: 'Root',- required: 'Yes',- description: `The outermost container element for ${name}`,- },- {- element: 'Content',- required: 'Yes',- description: 'The primary content area',- },- ],- };-}diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/page.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/page.tsxdeleted file mode 100644index a71337e859..0000000000--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/page.tsx+++ /dev/null@@ -1,2715 +0,0 @@-// Copyright (c) Meta Platforms, Inc. and affiliates.--'use client';--import * as stylex from '@stylexjs/stylex';-import React, {- Suspense,- useState,- useEffect,- useRef,- useCallback,- useMemo,-} from 'react';-import {useSearchParams} from 'next/navigation';--import {- TEMPLATES,- FILTER_COLUMNS,- PROFILE_CRAFT_ITEMS,- THEME_PICKER_ENTRIES,- basePath,-} from './constants';-import type {ThemePickerEntry} from './constants';-import {TemplateCard} from './TemplateCard';-import {AIComposer} from './AIComposer';-import {COMPONENT_PREVIEW_LIST} from './ComponentPreviews';--import {ChatPanel} from './ChatPanel';-import type {PanelTab, PointedElement} from './ChatPanel';-import {InlinePublishPanel} from './InlinePublishPanel';-import {TemplatePreview} from './TemplatePreview';-import {TemplatePreviewModal} from './TemplatePreviewModal';-import {AppTopNav} from './AppTopNav';-import {DocsView} from './DocsView';-import {ThemeEditorView} from './ThemeEditorView';-import {ProfileView} from './ProfileView';-import {XDSAppShell} from '@xds/core/AppShell';-import {XDSStack} from '@xds/core/Layout';-import {XDSButton} from '@xds/core/Button';-import {XDSCard} from '@xds/core/Card';-import {XDSDialog} from '@xds/core/Dialog';-import {XDSDivider} from '@xds/core/Divider';-import {XDSHeading, XDSText} from '@xds/core/Text';-import {XDSTabList, XDSTab} from '@xds/core/TabList';-import {XDSToken} from '@xds/core/Token';-import {XDSIcon} from '@xds/core/Icon';-import {XDSLink} from '@xds/core/Link';-import {XDSList, XDSListItem} from '@xds/core/List';-import {XDSPopover} from '@xds/core/Popover';-import {XDSTextInput} from '@xds/core/TextInput';-import {XDSToolbar} from '@xds/core/Toolbar';--import {XDSDropdownMenu} from '@xds/core/DropdownMenu';-import {- ArrowLeftIcon,- SearchIcon,- PaletteIcon,- ContrastIcon,- MoonIcon,- VerifiedIcon,- FilterIcon,- BookmarkIcon,- BookmarkFilledIcon,-} from './docsite-icons';--const popoverStyles = stylex.create({- filterDropdown: {- padding: 8,- },-});--function SearchableFilterDropdown({- label,- items,- selectedFilters,- onToggle,- verifiedItems,-}: {- label: string;- items: string[];- selectedFilters: Set<string>;- onToggle: (item: string) => void;- verifiedItems?: Set<string>;-}) {- const [isOpen, setIsOpen] = useState(false);- const [search, setSearch] = useState('');- const filtered = items.filter(item =>- item.toLowerCase().includes(search.toLowerCase()),- );- return (- <XDSPopover- label={label}- placement="below"- alignment="start"- width={280}- isOpen={isOpen}- onOpenChange={open => {- setIsOpen(open);- if (!open) {- setSearch('');- }- }}- xstyle={popoverStyles.filterDropdown}- content={- <div style={{display: 'flex', flexDirection: 'column', gap: 4}}>- <div- tabIndex={0}- style={{- position: 'absolute',- opacity: 0,- width: 0,- height: 0,- overflow: 'hidden',- }}- />- <XDSTextInput- label="Search"- isLabelHidden- placeholder={`Search ${label.toLowerCase()}...`}- value={search}- onChange={setSearch}- size="lg"- startIcon={SearchIcon}- />- <div style={{maxHeight: 280, overflowY: 'auto', margin: '0 -8px'}}>- {filtered.length === 0 ? (- <div style={{padding: '12px 16px'}}>- <XDSText type="body" color="secondary">- No results- </XDSText>- </div>- ) : (- <XDSList density="spacious">- {filtered.map(item => (- <XDSListItem- key={item}- label={item}- isSelected={selectedFilters.has(item)}- onClick={() => onToggle(item)}- endContent={- verifiedItems?.has(item) ? (- <XDSIcon icon={VerifiedIcon} size="sm" color="accent" />- ) : undefined- }- />- ))}- </XDSList>- )}- </div>- </div>- }>- <XDSButton- label={label}- variant="ghost"- size="sm"- endContent={<XDSIcon icon="chevronDown" size="sm" color="inherit" />}- />- </XDSPopover>- );-}--// ----------------------------------------------------------------------------// ThemeCard — mirrors TemplateCard layout for visual consistency-// -----------------------------------------------------------------------------function ThemeCard({- theme,- index,- onCustomize,- onEdit,-}: {- theme: ThemePickerEntry;- index: number;- onCustomize: () => void;- onEdit: (theme: ThemePickerEntry) => void;-}) {- const [hovered, setHovered] = useState(false);- const [bookmarked, setBookmarked] = useState(false);-- return (- <div- style={{- animation: `craftCardFadeIn 400ms ${index * 60}ms cubic-bezier(0.16, 1, 0.3, 1) both`,- }}>- <XDSCard padding={0}>- <div- style={{- position: 'relative',- cursor: 'pointer',- overflow: 'hidden',- }}- onMouseEnter={() => setHovered(true)}- onMouseLeave={() => setHovered(false)}- onClick={onCustomize}>- {theme.preview.img ? (- <img- src={`${basePath}/docsite/${theme.preview.img}`}- alt={theme.name}- style={{- display: 'block',- width: '100%',- aspectRatio: '1920 / 1205',- objectFit: 'cover',- }}- />- ) : (- <div- style={{- aspectRatio: '1920 / 1205',- backgroundColor: theme.preview.bg,- padding: '6% 7%',- display: 'flex',- flexDirection: 'column',- justifyContent: 'space-between',- fontFamily: theme.preview.font ?? 'system-ui, sans-serif',- overflow: 'hidden',- }}>- {/* Brand name + accent dot */}- <div style={{display: 'flex', alignItems: 'center', gap: 8}}>- <div- style={{- width: 14,- height: 14,- borderRadius: theme.preview.radius ?? 4,- backgroundColor: theme.preview.accent,- flexShrink: 0,- }}- />- <span- style={{- fontSize: 20,- fontWeight: 700,- color: theme.preview.text,- lineHeight: 1,- }}>- {theme.name}- </span>- </div>- {/* Color palette */}- <div style={{display: 'flex', gap: '3%'}}>- {[- {color: theme.preview.accent, label: 'Accent'},- {color: theme.preview.bg, label: 'Background'},- {color: theme.preview.surface, label: 'Surface'},- {color: theme.preview.text, label: 'Text'},- ].map(swatch => (- <div key={swatch.label} style={{flex: 1}}>- <div- style={{- aspectRatio: '1',- borderRadius: theme.preview.radius ?? 8,- backgroundColor: swatch.color,- border:- swatch.color === theme.preview.bg- ? `1px solid ${theme.preview.surface}`- : 'none',- }}- />- <div- style={{- fontSize: 7,- color: theme.preview.text,- opacity: 0.5,- marginTop: 3,- textAlign: 'center',- textTransform: 'uppercase',- letterSpacing: '0.05em',- }}>- {swatch.label}- </div>- </div>- ))}- </div>- {/* Font + description */}- <div>- <div- style={{- fontSize: 28,- fontWeight: 300,- color: theme.preview.text,- lineHeight: 1,- opacity: 0.8,- }}>- Aa- </div>- <div- style={{- fontSize: 8,- color: theme.preview.text,- opacity: 0.4,- marginTop: 2,- }}>- {(theme.preview.font ?? 'System UI').split(',')[0].trim()}- </div>- </div>- </div>- )}- <div- style={{- position: 'absolute',- inset: 0,- backgroundColor: 'var(--color-overlay, rgba(0,0,0,0.5))',- opacity: hovered ? 1 : 0,- transition: 'opacity 300ms ease',- }}>- <div- style={{- position: 'absolute',- top: 12,- right: 12,- }}- onClick={e => e.stopPropagation()}>- <XDSButton- label="Bookmark"- variant="ghost"- size="sm"- isIconOnly- icon={bookmarked ? <BookmarkFilledIcon /> : <BookmarkIcon />}- style={{color: '#fff'}}- onClick={() => setBookmarked(prev => !prev)}- />- </div>- <div- style={{- position: 'absolute',- bottom: 0,- left: 0,- right: 0,- padding: 16,- background:- 'linear-gradient(to top, rgba(0,0,0,0.6), transparent)',- display: 'flex',- alignItems: 'flex-end',- justifyContent: 'space-between',- }}>- <XDSStack direction="vertical" gap={0}>- <XDSHeading level={3} style={{color: '#fff'}}>- {theme.name}- </XDSHeading>- {theme.description && (- <XDSText- type="supporting"- style={{color: 'rgba(255,255,255,0.7)'}}>- {theme.description}- </XDSText>- )}- </XDSStack>- <XDSStack direction="horizontal" gap={2}>- <XDSButton- label="Use"- variant="secondary"- size="sm"- style={{backgroundColor: 'var(--color-background-surface)'}}- onClick={e => {- e.stopPropagation();- onCustomize();- }}- />- <XDSButton- label="Craft"- variant="secondary"- size="sm"- style={{backgroundColor: 'var(--color-background-surface)'}}- onClick={e => {- e.stopPropagation();- onEdit(theme);- }}- />- </XDSStack>- </div>- </div>- </div>- </XDSCard>- </div>- );-}--// ----------------------------------------------------------------------------// Page-// -----------------------------------------------------------------------------export default function DocsiteLandingPage() {- return (- <Suspense fallback={null}>- <DocsiteLandingTemplate />- </Suspense>- );-}--function DocsiteLandingTemplate() {- const searchParams = useSearchParams();- const [previewMode, setPreviewMode] = useState<'light' | 'dark'>('light');- const [previewTheme, setPreviewTheme] = useState('default');-- const previewImageFilter = useMemo(() => {- const filters: string[] = [];- if (previewMode === 'dark') {- filters.push('invert(0.88)', 'hue-rotate(180deg)');- }- const themeFilters: Record<string, string> = {- neutral: 'saturate(0.3)',- brutalist: 'contrast(1.2) saturate(0.5)',- matcha: 'sepia(0.2) saturate(1.2) hue-rotate(80deg)',- daily: 'sepia(0.1) saturate(1.1) hue-rotate(10deg)',- };- if (themeFilters[previewTheme]) {- filters.push(themeFilters[previewTheme]);- }- return filters.length > 0 ? filters.join(' ') : undefined;- }, [previewMode, previewTheme]);-- // Read initial state from URL params- const initialView = useMemo(() => {- const v = searchParams.get('view');- const t = searchParams.get('template');- const q = searchParams.get('q');- const page = searchParams.get('page');- const tab = searchParams.get('tab');- const craft = searchParams.get('craft');- const used = searchParams.get('used');- const settings = searchParams.get('settings');- const collection = searchParams.get('collection');- const templateIdx = t !== null ? parseInt(t, 10) : null;-- // Tab values like "theme", "components", "templates" are tabs within the- // craft view, not standalone pages. Map them so ?page=theme opens the craft- // view with the correct tab pre-selected.- const CRAFT_TABS = ['all', 'templates', 'components'];- const isCraftTab = page !== null && CRAFT_TABS.includes(page);-- const component = searchParams.get('component');- let docsComponent: string | null = null;- if (page === 'docs') {- if (tab === 'whats-new' || tab === 'getting-started') {- docsComponent = tab;- } else if (component) {- docsComponent = component;- }- }-- return {- view: v,- templateIdx: isNaN(templateIdx as number) ? null : templateIdx,- query: q,- page: isCraftTab- ? ('craft' as const)- : (page as 'craft' | 'explore' | 'docs' | 'profile' | 'theme' | null),- craftTab: isCraftTab ? page : null,- tab:- tab && ['Crafted', 'Used', 'Bookmarks'].includes(tab)- ? (tab as 'Crafted' | 'Used' | 'Bookmarks')- : null,- craft,- used,- settings: settings === '1',- collection,- docsComponent,- };- }, [searchParams]);-- const [activeView, setActiveView] = useState(- (initialView.page ?? 'craft') as- | 'craft'- | 'explore'- | 'docs'- | 'profile'- | 'theme',- );- const [docsComponent, setDocsComponent] = useState<string | null>(- initialView.docsComponent,- );- const [profileTab, setProfileTab] = useState<- 'Crafted' | 'Used' | 'Bookmarks'- >(initialView.tab ?? 'Crafted');- const [profileCraftName, setProfileCraftName] = useState<string | null>(- initialView.craft,- );- const [profileUsedName, setProfileUsedName] = useState<string | null>(- initialView.used,- );- const [profileSettingsOpen, setProfileSettingsOpen] = useState(- initialView.settings,- );- const [profileCollectionName, setProfileCollectionName] = useState<- string | null- >(initialView.collection);- const [craftTitle, setCraftTitle] = useState<string | null>(- initialView.query,- );- const [isProfileResults, setIsProfileResults] = useState(false);- const [isCraftResults, setIsCraftResults] = useState(false);- const [craftStatusFilter, setCraftStatusFilter] = useState('all');- const [craftLoading, setCraftLoading] = useState(false);- const [craftExiting, setCraftExiting] = useState(false);- const [resultFilters, setResultFilters] = useState<Set<string>>(- () => new Set(),- );- const handleToggleResultFilter = useCallback((filter: string) => {- setResultFilters(prev => {- const next = new Set(prev);- if (next.has(filter)) {- next.delete(filter);- } else {- next.add(filter);- }- return next;- });- }, []);- const craftLoadingTimer = useRef<ReturnType<typeof setTimeout> | null>(null);- const handleBackFromResults = useCallback(() => {- setCraftExiting(true);- setCraftLoading(true);- setResultFilters(new Set());- setIsProfileResults(false);- setIsCraftResults(false);- setCraftStatusFilter('all');- if (craftLoadingTimer.current) {- clearTimeout(craftLoadingTimer.current);- }- craftLoadingTimer.current = setTimeout(() => {- setCraftTitle(null);- setCraftLoading(false);- setCraftExiting(false);- craftLoadingTimer.current = null;- }, 600);- }, []);- const handleTokenClick = useCallback((label: string) => {- setPreviewTarget(null);- setCraftTitle(label);- setIsProfileResults(false);- setCraftLoading(true);- if (craftLoadingTimer.current) {- clearTimeout(craftLoadingTimer.current);- }- craftLoadingTimer.current = setTimeout(() => {- setCraftLoading(false);- craftLoadingTimer.current = null;- }, 900);- }, []);- const loadedIframesRef = useRef<Set<string>>(new Set());- const handleIframeLoad = useCallback((slug: string) => {- loadedIframesRef.current.add(slug);- }, []);- const [selected, setSelected] = useState(new Set());- const [templateFilter, setTemplateFilter] = useState<- 'all' | 'official' | string- >('all');- const [activeFilters, setActiveFilters] = useState<Set<string>>(- () => new Set(),- );- const [sortOption, setSortOption] = useState('trending');- const [isFilterOpen, setIsFilterOpen] = useState(false);- const [isSettingsOpen, setIsSettingsOpen] = useState(false);- const [activeTab, setActiveTab] = useState(initialView.craftTab ?? 'all');- const [isMobile, setIsMobile] = useState(false);- const [isTablet, setIsTablet] = useState(false);- const [generatingSource, setGeneratingSource] = useState(- null as number | null,- );- const [chatOpen, setChatOpen] = useState(false);- const [previewTarget, setPreviewTarget] = useState(- initialView.view === 'preview' ? initialView.templateIdx : null,- );- const [useTarget, setUseTarget] = useState(- initialView.view === 'editor' ? initialView.templateIdx : null,- );- const [previewGenerating, setPreviewGenerating] = useState(false);- const [showPublishCard1, setShowPublishCard1] = useState(false);- const [panelTab, setPanelTab] = useState<PanelTab>('configure');- const [isPointing, setIsPointing] = useState(false);- const [pointedElement, setPointedElement] = useState<PointedElement>(null);- const [editorPanelWidth, setEditorPanelWidth] = useState(380);- const [isEditorResizing, setIsEditorResizing] = useState(false);- const [_editorViewport, _setEditorViewport] = useState('desktop');- const [fullPreview, setFullPreview] = useState(false);-- const scrollContainerRef = useRef<HTMLDivElement>(null);- const [isHeaderCollapsed, setIsHeaderCollapsed] = useState(false);- const [card4Bookmarked, setCard4Bookmarked] = useState(false);- const [themePreviewKey, setThemePreviewKey] = useState<string | null>(null);- const [themeEditorImage, setThemeEditorImage] = useState<string | null>(null);- const [themeEditorInitial, setThemeEditorInitial] = useState<{- accent: string;- font?: string;- radius?: number;- } | null>(null);- const [selectedVariant, setSelectedVariant] = useState<{- name: string;- img: string;- key: string;- themeImages?: Record<string, string>;- } | null>(null);- const [editorVariantImage, setEditorVariantImage] = useState<string | null>(- null,- );- const [chatReply, setChatReply] = useState<string | null>(null);-- const handleEditorResizeStart = useCallback(- (e: React.MouseEvent) => {- e.preventDefault();- setIsEditorResizing(true);- const startX = e.clientX;- const startWidth = editorPanelWidth;-- const onMouseMove = (ev: MouseEvent) => {- const maxWidth = Math.floor(window.innerWidth / 2);- const newWidth = Math.min(- Math.max(startWidth + (ev.clientX - startX), 280),- maxWidth,- );- setEditorPanelWidth(newWidth);- };- const onMouseUp = () => {- setIsEditorResizing(false);- document.removeEventListener('mousemove', onMouseMove);- document.removeEventListener('mouseup', onMouseUp);- document.body.style.cursor = '';- document.body.style.userSelect = '';- };-- document.body.style.cursor = 'col-resize';- document.body.style.userSelect = 'none';- document.addEventListener('mousemove', onMouseMove);- document.addEventListener('mouseup', onMouseUp);- },- [editorPanelWidth],- );-- const isPopstateRef = useRef(false);- const prevUrlRef = useRef('');-- // Sync URL when view state changes- useEffect(() => {- const params = new URLSearchParams();-- if (previewTarget !== null) {- params.set('view', 'preview');- params.set('template', String(previewTarget));- } else if (useTarget !== null) {- params.set('view', 'editor');- params.set('template', String(useTarget));- } else if (craftTitle) {- params.set('q', craftTitle);- } else if (activeView === 'craft' && activeTab !== 'all') {- params.set('page', activeTab);- } else if (activeView !== 'craft') {- params.set('page', activeView);- if (activeView === 'docs') {- if (- docsComponent === 'whats-new' ||- docsComponent === 'getting-started'- ) {- params.set('tab', docsComponent);- } else if (docsComponent !== null) {- params.set('component', docsComponent);- }- } else if (activeView === 'profile') {- if (profileCraftName) {- params.set('tab', 'Crafted');- params.set('craft', profileCraftName);- } else if (profileUsedName) {- params.set('tab', 'Used');- params.set('used', profileUsedName);- } else if (profileCollectionName) {- params.set('tab', 'Bookmarks');- params.set('collection', profileCollectionName);- } else if (profileTab !== 'Crafted') {- params.set('tab', profileTab);- }- if (profileSettingsOpen) {- params.set('settings', '1');- }- }- }-- const qs = params.toString();- if (qs === window.location.search.slice(1)) {- return;- }- const url = `${basePath}/pages/docsite/${qs ? '?' + qs : ''}`;-- if (isPopstateRef.current) {- isPopstateRef.current = false;- prevUrlRef.current = qs;- return;- }-- const prevParams = new URLSearchParams(prevUrlRef.current);- const prevPage = prevParams.get('page');- const prevComponent = prevParams.get('component');- const prevTab = prevParams.get('tab');- const prevView = prevParams.get('view');- const curPage = params.get('page');- const curComponent = params.get('component');- const curTab = params.get('tab');- const curView = params.get('view');-- const isSignificant =- curView !== prevView ||- curPage !== prevPage ||- curComponent !== prevComponent ||- (curPage === 'docs' && curTab !== prevTab);-- if (isSignificant) {- window.history.pushState(null, '', url);- } else {- window.history.replaceState(window.history.state, '', url);- }- prevUrlRef.current = qs;- }, [- previewTarget,- useTarget,- craftTitle,- activeView,- activeTab,- docsComponent,- profileTab,- profileCraftName,- profileUsedName,- profileSettingsOpen,- profileCollectionName,- ]);-- useEffect(() => {- const onPopState = () => {- isPopstateRef.current = true;- const params = new URLSearchParams(window.location.search);- const page = params.get('page');- const view = params.get('view');- const template = params.get('template');- const q = params.get('q');-- if (view === 'preview' && template !== null) {- setPreviewTarget(parseInt(template, 10));- setUseTarget(null);- } else if (view === 'editor' && template !== null) {- setUseTarget(parseInt(template, 10));- setPreviewTarget(null);- } else if (q) {- setCraftTitle(q);- setPreviewTarget(null);- setUseTarget(null);- } else {- setPreviewTarget(null);- setUseTarget(null);- setCraftTitle(null);- const CRAFT_TABS = ['all', 'templates', 'components'];- if (page && CRAFT_TABS.includes(page)) {- setActiveView('craft');- setActiveTab(page);- } else if (page === 'docs') {- setActiveView('docs');- const tab = params.get('tab');- const component = params.get('component');- if (tab === 'whats-new' || tab === 'getting-started') {- setDocsComponent(tab);- } else if (component) {- setDocsComponent(component);- } else {- setDocsComponent(null);- }- } else if (page === 'profile' || page === 'theme') {- setActiveView(page);- } else {- setActiveView('craft');- setActiveTab('all');- }- }- };- window.addEventListener('popstate', onPopState);- return () => window.removeEventListener('popstate', onPopState);- }, []);-- const prevViewRef = useRef(activeView);- const skipViewResetRef = useRef(false);- useEffect(() => {- if (prevViewRef.current === activeView) {- return;- }- prevViewRef.current = activeView;- if (skipViewResetRef.current) {- skipViewResetRef.current = false;- return;- }- setPreviewTarget(null);- setUseTarget(null);- setChatOpen(false);- setCraftTitle(null);- setResultFilters(new Set());- if (activeView !== 'docs') {- setDocsComponent(null);- }- }, [activeView]);- const timerRef = useRef(null as ReturnType<typeof setTimeout> | null);- const previewTimerRef = useRef(null as ReturnType<typeof setTimeout> | null);- useEffect(() => {- const mobileMql = window.matchMedia('(max-width: 768px)');- const tabletMql = window.matchMedia(- '(min-width: 769px) and (max-width: 1280px)',- );- setIsMobile(mobileMql.matches);- setIsTablet(tabletMql.matches);-- const mobileHandler = (e: MediaQueryListEvent) => {- setIsMobile(e.matches);- };- const tabletHandler = (e: MediaQueryListEvent) => setIsTablet(e.matches);- mobileMql.addEventListener('change', mobileHandler);- tabletMql.addEventListener('change', tabletHandler);- return () => {- mobileMql.removeEventListener('change', mobileHandler);- tabletMql.removeEventListener('change', tabletHandler);- };- }, []);-- useEffect(() => {- const el = document.getElementById('docsite-scroll');- if (!el) {- return;- }- const onScroll = () => setIsHeaderCollapsed(el.scrollTop > 170);- el.addEventListener('scroll', onScroll, {passive: true});- return () => el.removeEventListener('scroll', onScroll);- }, []);-- const handleMoreLikeThis = useCallback(- (index: number) => {- if (generatingSource !== null) {- return;- }- setGeneratingSource(index);- setChatOpen(true);- timerRef.current = setTimeout(() => {- setGeneratingSource(null);- timerRef.current = null;- }, 5000);- },- [generatingSource],- );-- const handleUse = useCallback(- (index: number) => {- viewBeforeEditorRef.current = activeView;- setPreviewTarget(null);- setUseTarget(index);- setPanelTab('configure');- setChatOpen(true);- },- [activeView],- );-- const viewBeforeEditorRef = useRef<- 'craft' | 'explore' | 'docs' | 'profile' | 'theme'- >('craft');- const handleBackFromUse = useCallback(() => {- setUseTarget(null);- setChatOpen(false);- setShowPublishCard1(false);- setEditorVariantImage(null);- setChatReply(null);- const returnTo = viewBeforeEditorRef.current;- if (returnTo !== 'craft') {- skipViewResetRef.current = true;- setActiveView(returnTo);- }- }, []);-- const handlePreview = useCallback((index: number) => {- setPreviewTarget(index);- }, []);-- const layoutVariantMap: Record<string, string> = {- hero: `${basePath}/docsite/card4-hero-default.png`,- split: `${basePath}/docsite/card4-split-default.png`,- grid: `${basePath}/docsite/card4-grid-default.png`,- carousel: `${basePath}/docsite/card4-carousel-default.png`,- preview: `${basePath}/docsite/card4-preview-default.png`,- settings: `${basePath}/docsite/card4-preview-default.png`,- default: `${basePath}/docsite/card4-preview-default.png`,- };-- const handlePreviewSend = useCallback(- (prompt?: string) => {- if (previewGenerating) {- return;- }-- const lower = (prompt ?? '').toLowerCase();- const matchedKey = Object.keys(layoutVariantMap).find(key =>- lower.includes(key),- );-- setPreviewGenerating(true);- previewTimerRef.current = setTimeout(() => {- if (matchedKey) {- setEditorVariantImage(layoutVariantMap[matchedKey]);- const label =- matchedKey.charAt(0).toUpperCase() + matchedKey.slice(1);- setChatReply(- `Done! I've switched the template to the ${label} layout. Let me know if you'd like any other changes.`,- );- } else {- setChatReply(- "I've updated the template based on your request. Let me know if you'd like further changes.",- );- }- setPreviewGenerating(false);- previewTimerRef.current = null;- }, 1500);- },- [previewGenerating],- );-- useEffect(() => {- return () => {- if (timerRef.current) {- clearTimeout(timerRef.current);- }- if (previewTimerRef.current) {- clearTimeout(previewTimerRef.current);- }- if (craftLoadingTimer.current) {- clearTimeout(craftLoadingTimer.current);- }- };- }, []);-- const isGenerating = generatingSource !== null;-- const templateAuthors = useMemo(() => {- const authors = Array.from(new Set(TEMPLATES.map(t => t.author)));- return authors.sort((a, b) => {- if (a === 'XDS Design') {- return -1;- }- if (b === 'XDS Design') {- return 1;- }- return a.localeCompare(b);- });- }, []);-- const handleToggleFilter = useCallback((filter: string) => {- setActiveFilters(prev => {- const next = new Set(prev);- if (next.has(filter)) {- next.delete(filter);- } else {- next.add(filter);- }- return next;- });- }, []);-- const handleClearFilters = useCallback(() => {- setActiveFilters(new Set());- }, []);-- const filteredTemplates = useMemo(() => {- return TEMPLATES.map((t, i) => ({...t, originalIndex: i})).filter(t => {- if (templateFilter === 'all') {- return true;- }- if (templateFilter === 'official') {- return t.isOfficial;- }- return t.author.toLowerCase().includes(templateFilter.toLowerCase());- });- }, [templateFilter]);-- const craftStatusCounts = useMemo(- () => ({- published: PROFILE_CRAFT_ITEMS.filter(i => i.status === 'Published')- .length,- draft: PROFILE_CRAFT_ITEMS.filter(i => i.status === 'Draft').length,- review: PROFILE_CRAFT_ITEMS.filter(i => i.status === 'In Review').length,- }),- [],- );-- const filteredCraftItems = useMemo(() => {- if (craftStatusFilter === 'all') {- return PROFILE_CRAFT_ITEMS;- }- return PROFILE_CRAFT_ITEMS.filter(- item => item.status === craftStatusFilter,- );- }, [craftStatusFilter]);-- // Editor flow — same layout for all cards- if (useTarget !== null && activeView === 'craft') {- const isBlankCanvas = useTarget === -1;- const t = isBlankCanvas- ? {- name: 'Untitled',- src: '',- size: 'medium' as const,- author: '',- isOfficial: false,- }- : TEMPLATES[useTarget % TEMPLATES.length];- return (- <div- style={{- display: 'flex',- height: '100vh',- overflow: 'hidden',- backgroundColor: 'var(--color-background-surface, #fff)',- }}>- <style>- {'@keyframes slideInLeft { from { opacity: 0; transform: translateX(-40px); } to { opacity: 1; transform: translateX(0); } }' +- '@keyframes checkDraw { from { stroke-dashoffset: 24; } to { stroke-dashoffset: 0; } }' +- '.xds-editor-resize-handle { opacity: 0; transition: opacity 150ms ease, background-color 150ms ease; }' +- '.xds-editor-resize-grip:hover .xds-editor-resize-handle { opacity: 0.6; }' +- '.xds-editor-resize-grip[data-resizing="true"] .xds-editor-resize-handle { opacity: 1; }'}- </style>- {!fullPreview && (- <div- style={{- width: editorPanelWidth,- minWidth: 280,- maxWidth: '50vw',- flexShrink: 0,- padding: 16,- paddingRight: 0,- display: 'flex',- animation: 'slideInLeft 500ms cubic-bezier(0.16, 1, 0.3, 1)',- }}>- <div- style={{- flex: 1,- backgroundColor: 'var(--color-background-card, #fff)',- borderRadius: 16,- border: '1px solid var(--color-divider, #e0e0e0)',- overflow: 'hidden',- display: 'flex',- flexDirection: 'column' as const,- }}>- {/* Persistent tab bar — hidden when publishing */}- {!showPublishCard1 && (- <XDSStack direction="vertical" gap={0} style={{flexShrink: 0}}>- <XDSStack- direction="horizontal"- gap={0}- vAlign="center"- style={{paddingLeft: 8, paddingTop: 8, paddingRight: 8}}>- <XDSButton- label="Back"- variant="ghost"- size="sm"- icon={<ArrowLeftIcon />}- isIconOnly- onClick={handleBackFromUse}- />- <XDSTabList- value={panelTab}- onChange={v =>- setPanelTab(v as 'configure' | 'properties' | 'code')- }- size="md"- layout="fill">- <XDSTab value="configure" label="Craft" />- <XDSTab value="code" label="Code" />- <XDSTab value="properties" label="Properties" />- </XDSTabList>- </XDSStack>- <XDSDivider variant="strong" />- </XDSStack>- )}- {showPublishCard1 ? (- <InlinePublishPanel- templateName={t.name}- isVisible={showPublishCard1}- onBack={() => setShowPublishCard1(false)}- onPublish={handleBackFromUse}- />- ) : (- <ChatPanel- isGenerating={previewGenerating}- onSend={handlePreviewSend}- reply={chatReply}- activeView={activeView}- setActiveView={setActiveView}- templateName={t.name}- onBack={handleBackFromUse}- activeTab={panelTab}- onTabChange={setPanelTab}- pointedElement={pointedElement}- hideHeader- />- )}- </div>- </div>- )}- {/* Resize handle */}- {!fullPreview && (- <div- onMouseDown={handleEditorResizeStart}- data-resizing={isEditorResizing}- className="xds-editor-resize-grip"- style={{- width: 16,- flexShrink: 0,- cursor: 'col-resize',- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- zIndex: 10,- backgroundColor: 'transparent',- marginRight: 0,- }}>- <div- className="xds-editor-resize-handle"- style={{- width: 3,- height: 32,- borderRadius: 2,- backgroundColor: isEditorResizing- ? 'var(--color-icon-primary, #111)'- : 'var(--color-border-strong, #ccc)',- }}- />- </div>- )}- <div- style={{- flex: 1,- display: 'flex',- flexDirection: 'column' as const,- minWidth: 0,- overflow: 'visible',- marginLeft: -16,- paddingLeft: 16,- }}>- <TemplatePreview- templateName={t.name}- imageSrc={editorVariantImage ?? t.src}- slug={editorVariantImage ? undefined : t.slug}- onBack={handleBackFromUse}- isGenerating={previewGenerating}- onPublish={() => {- setShowPublishCard1(true);- setEditorPanelWidth(380);- }}- isPointing={isPointing}- onPointingChange={setIsPointing}- onElementPointed={el => {- setPointedElement(el);- setPanelTab('properties');- }}- isPublishing={showPublishCard1}- isFullPreview={fullPreview}- onFullPreviewChange={setFullPreview}- hideToolbar={fullPreview}- previewBackground={undefined}- />- </div>- </div>- );- }-- // All card previews are handled as a bottom drawer overlay on the craft grid below.-- if (activeView === 'theme') {- return (- <ThemeEditorView- activeView={activeView}- setActiveView={setActiveView}- initialImage={themeEditorImage}- initialTheme={themeEditorInitial}- onImageConsumed={() => {- setThemeEditorImage(null);- setThemeEditorInitial(null);- }}- />- );- }-- if (activeView === 'docs') {- return (- <DocsView- setActiveView={setActiveView}- selectedComponent={docsComponent}- onComponentChange={setDocsComponent}- />- );- }-- if (activeView === 'profile') {- return (- <ProfileView- activeView={activeView}- setActiveView={setActiveView}- onStartCrafting={() => {- viewBeforeEditorRef.current = 'profile';- skipViewResetRef.current = true;- setActiveView('craft');- setUseTarget(-1);- setPanelTab('configure');- setChatOpen(true);- }}- profileTab={profileTab}- onTabChange={setProfileTab}- profileCraftName={profileCraftName}- onCraftPreviewChange={setProfileCraftName}- profileUsedName={profileUsedName}- onUsedPreviewChange={setProfileUsedName}- profileSettingsOpen={profileSettingsOpen}- onSettingsChange={setProfileSettingsOpen}- profileCollectionName={profileCollectionName}- onCollectionChange={setProfileCollectionName}- />- );- }-- return (- <XDSAppShell- variant="surface"- height="fill"- style={{} satisfies React.CSSProperties}- topNav={- <AppTopNav- activeView={activeView}- setActiveView={setActiveView}- scrollContainerRef={scrollContainerRef}- activeTab={activeTab}- onActiveTabChange={setActiveTab}- templateFilter={templateFilter}- onTemplateFilterChange={setTemplateFilter}- templateAuthors={templateAuthors}- activeFilters={activeFilters}- onToggleFilter={handleToggleFilter}- onClearFilters={handleClearFilters}- sortOption={sortOption}- onSortChange={setSortOption}- isFilterOpen={isFilterOpen}- onFilterOpenChange={setIsFilterOpen}- craftTitle={craftTitle}- />- }>- <div- style={{- display: 'flex',- height: '100%',- overflow: 'hidden',- }}>- {/* Chat panel */}- <div- style={{- width: chatOpen ? 400 : 0,- minWidth: chatOpen ? 400 : 0,- overflow: 'hidden',- transition:- 'width var(--duration-medium, 410ms) var(--ease-standard, cubic-bezier(0.24, 1, 0.4, 1)), min-width var(--duration-medium, 410ms) var(--ease-standard, cubic-bezier(0.24, 1, 0.4, 1))',- borderRight: 'none',- backgroundColor: 'var(--color-background-surface, white)',- }}>- {chatOpen && (- <ChatPanel- isGenerating={isGenerating || previewGenerating}- onSend={undefined}- activeView={activeView}- setActiveView={setActiveView}- />- )}- </div>-- {/* Main content area */}- <div- style={{- flex: 1,- overflow: 'hidden',- display: 'flex',- flexDirection: 'column' as const,- }}>- <div style={{display: 'flex', flex: 1, overflow: 'hidden'}}>- <div- id="docsite-scroll"- ref={scrollContainerRef}- style={{- flex: 1,- overflow: 'auto',- padding: '0 24px 140px',- }}>- <style>{`- @keyframes craftShimmer {- 0% { background-position: -400px 0; }- 100% { background-position: 400px 0; }- }- @keyframes craftCardFadeIn {- from { opacity: 0; transform: translateY(12px); }- to { opacity: 1; transform: translateY(0); }- }- @keyframes craftTitleSlideIn {- from { opacity: 0; transform: translateX(-16px); }- to { opacity: 1; transform: translateX(0); }- }- @keyframes previewFadeIn {- from { opacity: 0; transform: translateY(8px); }- to { opacity: 1; transform: translateY(0); }- }- `}</style>- {craftTitle && (- <div- style={{- maxWidth: 2000,- margin: '0 auto 16px',- paddingTop: 16,- display: 'flex',- alignItems: 'center',- gap: 12,- ...(craftExiting- ? {- opacity: 0,- transform: 'translateX(-16px)',- transition:- 'opacity 300ms ease, transform 300ms ease',- }- : {- animation:- 'craftTitleSlideIn 400ms cubic-bezier(0.16, 1, 0.3, 1)',- }),- }}>- {!isProfileResults && (- <XDSButton- label="Back"- variant="ghost"- size="lg"- icon={<ArrowLeftIcon />}- isIconOnly- onClick={handleBackFromResults}- style={{marginLeft: -8}}- />- )}- <XDSText type="display-1">{craftTitle}</XDSText>- </div>- )}- {craftTitle && !craftLoading && isCraftResults && (- <div- style={{- maxWidth: 2000,- margin: '0 auto 20px',- display: 'flex',- gap: 6,- flexWrap: 'wrap' as const,- animation:- 'craftTitleSlideIn 400ms 100ms cubic-bezier(0.16, 1, 0.3, 1) both',- }}>- {[- {- value: 'all',- label: `All (${PROFILE_CRAFT_ITEMS.length})`,- },- {- value: 'Published',- label: `Published (${craftStatusCounts.published})`,- },- {- value: 'Draft',- label: `Draft (${craftStatusCounts.draft})`,- },- {- value: 'In Review',- label: `In Review (${craftStatusCounts.review})`,- },- ].map(tab => (- <XDSButton- key={tab.value}- label={tab.label}- variant={- craftStatusFilter === tab.value- ? 'primary'- : 'secondary'- }- size="sm"- onClick={() => setCraftStatusFilter(tab.value)}- />- ))}- </div>- )}- {craftTitle && !craftLoading && !isCraftResults && (- <div- style={{- maxWidth: 2000,- margin: '0 auto 20px',- display: 'flex',- flexDirection: 'column',- gap: 4,- animation:- 'craftTitleSlideIn 400ms 100ms cubic-bezier(0.16, 1, 0.3, 1) both',- }}>- <div- style={{- display: 'flex',- alignItems: 'center',- gap: 4,- marginLeft: -8,- marginRight: -8,- }}>- {FILTER_COLUMNS.map(col => (- <SearchableFilterDropdown- key={col.heading}- label={col.heading}- items={col.items}- selectedFilters={resultFilters}- onToggle={handleToggleResultFilter}- />- ))}- <SearchableFilterDropdown- label="Author"- items={templateAuthors}- selectedFilters={resultFilters}- onToggle={handleToggleResultFilter}- verifiedItems={new Set(['XDS Design'])}- />- <div- style={{- marginLeft: 'auto',- display: 'flex',- alignItems: 'center',- gap: 16,- }}>- <XDSText- type="supporting"- color="secondary"- style={{whiteSpace: 'nowrap'}}>- Showing {filteredTemplates.length} screens- </XDSText>- <XDSToolbar- label="View controls"- size="sm"- startContent={- <>- <XDSButton- label={- previewMode === 'dark'- ? 'Light mode'- : 'Dark mode'- }- variant="ghost"- size="sm"- isIconOnly- icon={- previewMode === 'dark' ? (- <ContrastIcon />- ) : (- <MoonIcon />- )- }- onClick={() =>- setPreviewMode(- previewMode === 'dark' ? 'light' : 'dark',- )- }- />- <XDSDropdownMenu- button={{- label:- previewTheme.charAt(0).toUpperCase() +- previewTheme.slice(1),- variant: 'ghost',- size: 'sm',- icon: <PaletteIcon />,- }}- menuWidth={160}- items={[- {- label: 'Default',- onClick: () => setPreviewTheme('default'),- },- {- label: 'Neutral',- onClick: () => setPreviewTheme('neutral'),- },- {- label: 'Brutalist',- onClick: () => setPreviewTheme('brutalist'),- },- {- label: 'Matcha',- onClick: () => setPreviewTheme('matcha'),- },- {- label: 'Daily',- onClick: () => setPreviewTheme('daily'),- },- ]}- />- </>- }- />- <XDSDropdownMenu- button={{- label:- sortOption === 'trending'- ? 'Trending'- : sortOption === 'newest'- ? 'Newest'- : 'Oldest',- variant: 'ghost',- size: 'sm',- }}- items={[- {- label: 'Trending',- onClick: () => setSortOption('trending'),- },- {- label: 'Newest',- onClick: () => setSortOption('newest'),- },- {- label: 'Oldest',- onClick: () => setSortOption('oldest'),- },- ]}- />- </div>- </div>- {resultFilters.size > 0 && (- <div- style={{- display: 'flex',- alignItems: 'center',- gap: 8,- flexWrap: 'wrap',- }}>- {Array.from(resultFilters).map(f => (- <XDSToken- key={f}- label={f}- size="sm"- onRemove={() => handleToggleResultFilter(f)}- />- ))}- <XDSText type="supporting">- <XDSLink- label="Clear all"- color="secondary"- onClick={() => setResultFilters(new Set())}>- Clear all- </XDSLink>- </XDSText>- </div>- )}- </div>- )}-- {/* Hero heading */}- {!craftTitle && (- <div- style={{- maxWidth: 2000,- margin: '0 auto',- paddingTop: 48,- paddingBottom: 32,- textAlign: 'center',- }}>- <XDSText type="display-1">Craft what you imagine.</XDSText>- </div>- )}-- {/* Tab row — scrolls away, AppTopNav takes over */}- {!craftTitle && (- <div- style={{- maxWidth: 2000,- margin: '0 auto',- paddingBottom: 24,- display: 'grid',- gridTemplateColumns: '1fr auto 1fr',- alignItems: 'center',- }}>- <div />- <XDSTabList- value={activeTab}- onChange={setActiveTab}- size="sm">- <XDSTab value="all" label="All" />- <XDSTab value="templates" label="Templates" />- <XDSTab value="theme" label="Theme" />- <XDSTab value="components" label="Components" />- </XDSTabList>- <div style={{justifySelf: 'end', display: 'flex', gap: 4}}>- {activeTab !== 'theme' && (- <>- <XDSButton- label="Filter"- variant="ghost"- size="sm"- isIconOnly- icon={<FilterIcon />}- onClick={() => setIsFilterOpen(!isFilterOpen)}- />- <XDSDropdownMenu- button={{- label:- sortOption === 'trending'- ? 'Trending'- : sortOption === 'newest'- ? 'Newest'- : 'Oldest',- variant: 'ghost',- size: 'sm',- }}- items={[- {- label: 'Trending',- onClick: () => setSortOption('trending'),- },- {- label: 'Newest',- onClick: () => setSortOption('newest'),- },- {- label: 'Oldest',- onClick: () => setSortOption('oldest'),- },- ]}- />- </>- )}- </div>- </div>- )}-- {/* Filter panel — sticky, independent of tab row */}- {!craftTitle && isFilterOpen && activeTab !== 'theme' && (- <div- style={{- position: 'sticky',- top: 0,- zIndex: 9,- backgroundColor: 'var(--color-background-surface, #fff)',- marginInline: -24,- paddingInline: 24,- boxShadow: isHeaderCollapsed- ? '0 1px 3px rgba(0,0,0,0.08)'- : 'none',- transition: 'box-shadow 200ms ease',- }}>- <div- style={{- maxWidth: 2000,- margin: '0 auto',- display: 'grid',- gridTemplateColumns: 'repeat(4, 1fr)',- gap: 24,- padding: '24px 8px',- }}>- <div>- <XDSText- type="supporting"- color="secondary"- style={{marginBottom: 12, display: 'block'}}>- Author- </XDSText>- <div style={{marginLeft: -8, marginRight: -8}}>- <XDSList density="compact">- <XDSListItem- label="All"- isSelected={templateFilter === 'all'}- onClick={() => setTemplateFilter('all')}- />- <XDSListItem- label="XDS Official"- isSelected={templateFilter === 'official'}- onClick={() => setTemplateFilter('official')}- />- </XDSList>- </div>- </div>- {FILTER_COLUMNS.map(col => (- <div key={col.heading}>- <XDSText- type="supporting"- color="secondary"- style={{marginBottom: 12, display: 'block'}}>- {col.heading}- </XDSText>- <div style={{marginLeft: -8, marginRight: -8}}>- <XDSList density="compact">- {col.items.map(item => (- <XDSListItem- key={item}- label={item}- isSelected={activeFilters.has(item)}- onClick={() => handleToggleFilter(item)}- />- ))}- </XDSList>- </div>- </div>- ))}- </div>- </div>- )}-- {/* Active filter chips */}- {!craftTitle &&- activeFilters.size > 0 &&- activeTab !== 'theme' && (- <div- style={{- maxWidth: 2000,- margin: '0 auto 16px',- display: 'flex',- alignItems: 'center',- gap: 8,- flexWrap: 'wrap',- }}>- {Array.from(activeFilters).map(filter => (- <XDSToken- key={filter}- label={filter}- onRemove={() => handleToggleFilter(filter)}- />- ))}- <XDSText type="supporting">- <XDSLink- label="Clear all"- color="secondary"- onClick={handleClearFilters}>- Clear all- </XDSLink>- </XDSText>- </div>- )}-- {/* Theme tab content */}- {!craftTitle && activeTab === 'theme' && (- <div- style={{- maxWidth: 2000,- margin: '0 auto',- display: 'grid',- gridTemplateColumns: isMobile- ? '1fr'- : isTablet- ? 'repeat(2, 1fr)'- : 'repeat(3, 1fr)',- gap: 16,- }}>- {[...THEME_PICKER_ENTRIES]- .sort((a, b) => {- const imgOrder = [- 'forest',- 'daily',- 'midnight',- 'sunset',- ];- const ai = a.preview.img- ? imgOrder.indexOf(a.key)- : imgOrder.length;- const bi = b.preview.img- ? imgOrder.indexOf(b.key)- : imgOrder.length;- return (- (ai === -1 ? imgOrder.length : ai) -- (bi === -1 ? imgOrder.length : bi)- );- })- .map((theme, i) => (- <ThemeCard- key={theme.key}- theme={theme}- index={i}- onCustomize={() => setThemePreviewKey(theme.key)}- onEdit={(t: ThemePickerEntry) => {- setThemeEditorInitial({- accent: t.preview.accent,- font: t.preview.font,- radius: t.preview.radius,- });- setThemeEditorImage(- t.preview.img- ? `${basePath}/docsite/${t.preview.img}`- : null,- );- setActiveView('theme');- }}- />- ))}- </div>- )}-- {/* Template grid */}- {(craftTitle || activeTab !== 'theme') &&- (craftLoading ? (- <div- style={{- maxWidth: 2000,- margin: '0 auto',- display: 'grid',- gridTemplateColumns: isMobile- ? '1fr'- : isTablet- ? 'repeat(2, 1fr)'- : 'repeat(3, 1fr)',- gap: 16,- }}>- {Array.from({length: 8}).map((_, i) => (- <div- key={i}- style={{- borderRadius: 16,- overflow: 'hidden',- animation: `craftCardFadeIn 400ms ${i * 60}ms cubic-bezier(0.16, 1, 0.3, 1) both`,- }}>- <div- style={{- aspectRatio: '4 / 3',- background:- 'linear-gradient(90deg, var(--color-background-muted, #f0f0f0) 0%, var(--color-background-surface, #fafafa) 50%, var(--color-background-muted, #f0f0f0) 100%)',- backgroundSize: '800px 100%',- animation: 'craftShimmer 1.6s ease-in-out infinite',- borderRadius: '16px 16px 0 0',- }}- />- <div- style={{- padding: 16,- display: 'flex',- flexDirection: 'column',- gap: 10,- }}>- <div- style={{- height: 14,- width: '60%',- borderRadius: 6,- background:- 'linear-gradient(90deg, var(--color-background-muted, #f0f0f0) 0%, var(--color-background-surface, #fafafa) 50%, var(--color-background-muted, #f0f0f0) 100%)',- backgroundSize: '800px 100%',- animation:- 'craftShimmer 1.6s ease-in-out infinite',- }}- />- <div- style={{- height: 10,- width: '40%',- borderRadius: 6,- background:- 'linear-gradient(90deg, var(--color-background-muted, #f0f0f0) 0%, var(--color-background-surface, #fafafa) 50%, var(--color-background-muted, #f0f0f0) 100%)',- backgroundSize: '800px 100%',- animation:- 'craftShimmer 1.6s ease-in-out infinite',- }}- />- </div>- </div>- ))}- </div>- ) : isCraftResults ? (- <div- style={{- maxWidth: 2000,- margin: '0 auto',- display: 'grid',- gridTemplateColumns: isMobile- ? '1fr'- : isTablet- ? 'repeat(2, 1fr)'- : 'repeat(3, 1fr)',- gap: 16,- }}>- {filteredCraftItems.map((item, i) => (- <XDSCard- key={item.name}- padding={0}- style={{- overflow: 'hidden',- animation: `craftCardFadeIn 400ms ${i * 60}ms cubic-bezier(0.16, 1, 0.3, 1) both`,- }}>- <div- style={{- aspectRatio: '16 / 9',- overflow: 'hidden',- backgroundColor:- 'var(--color-background-muted, #f0f0f0)',- }}>- <img- src={item.img}- alt={item.name}- style={{- width: '100%',- height: '100%',- objectFit: 'cover',- objectPosition: 'top',- display: 'block',- }}- />- </div>- <div style={{padding: 16}}>- <div- style={{- display: 'flex',- alignItems: 'center',- justifyContent: 'space-between',- gap: 8,- }}>- <XDSText type="body" weight="bold">- {item.name}- </XDSText>- <span- style={{- fontSize: 11,- fontWeight: 600,- padding: '2px 8px',- borderRadius: 'var(--radius-control)',- whiteSpace: 'nowrap' as const,- flexShrink: 0,- backgroundColor:- item.status === 'Published'- ? '#ECFDF3'- : item.status === 'In Review'- ? '#FFFAEB'- : '#F2F4F7',- color:- item.status === 'Published'- ? '#027A48'- : item.status === 'In Review'- ? '#B54708'- : '#667085',- }}>- {item.status}- </span>- </div>- <div style={{marginTop: 4}}>- <XDSText type="supporting" color="secondary">- {item.type}- </XDSText>- </div>- <div- style={{- display: 'flex',- alignItems: 'center',- gap: 16,- marginTop: 12,- }}>- <div>- <XDSText type="supporting" color="secondary">- {item.used} uses- </XDSText>- </div>- <div>- <XDSText type="supporting" color="secondary">- {item.views} views- </XDSText>- </div>- <div style={{marginLeft: 'auto'}}>- <XDSText type="supporting" color="secondary">- {new Date(item.lastUpdated).toLocaleDateString(- 'en-US',- {month: 'short', day: 'numeric'},- )}- </XDSText>- </div>- </div>- </div>- </XDSCard>- ))}- {filteredCraftItems.length === 0 && (- <div- style={{- gridColumn: '1 / -1',- padding: 32,- textAlign: 'center' as const,- }}>- <XDSText type="body" color="secondary">- No items match this filter.- </XDSText>- </div>- )}- </div>- ) : (- <div- key={activeTab}- style={{- maxWidth: 2000,- margin: '0 auto',- display: 'grid',- gridTemplateColumns: isMobile- ? '1fr'- : isTablet- ? 'repeat(2, 1fr)'- : 'repeat(3, 1fr)',- gap: 16,- }}>- {activeTab === 'components'- ? COMPONENT_PREVIEW_LIST.map(- ({key, label, preview}, i) => (- <XDSCard- key={key}- padding={0}- style={{- animation: `craftCardFadeIn 400ms ${i * 60}ms cubic-bezier(0.16, 1, 0.3, 1) both`,- }}>- <div- style={{- display: 'flex',- flexDirection: 'column',- height: '100%',- }}>- <div- style={{- padding: '32px 20px',- flex: 1,- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- backgroundColor:- 'var(--color-background-body)',- }}>- {preview}- </div>- <div- style={{- padding: '12px 16px',- borderTop:- '1px solid var(--color-border-emphasized)',- backgroundColor:- 'var(--color-background-body)',- }}>- <XDSText type="body" weight="bold">- {label}- </XDSText>- </div>- </div>- </XDSCard>- ),- )- : filteredTemplates.flatMap((template, i) => {- const items = [- <div- key={`${template.name}-${template.originalIndex}`}- style={{- animation: `craftCardFadeIn 400ms ${i * 60}ms cubic-bezier(0.16, 1, 0.3, 1) both`,- filter: previewImageFilter,- transition: 'filter 300ms ease',- }}>- <TemplateCard- src={template.src}- slug={template.slug}- name={template.name}- isSelected={selected.has(- template.originalIndex,- )}- isGenerating={- isGenerating &&- generatingSource !== template.originalIndex- }- cardSize={template.size}- isCached={- !!template.slug &&- loadedIframesRef.current.has(template.slug)- }- onIframeLoad={handleIframeLoad}- onSelect={() =>- setSelected(prev => {- const next = new Set(prev);- if (next.has(template.originalIndex)) {- next.delete(template.originalIndex);- } else {- next.add(template.originalIndex);- }- return next;- })- }- onMoreLikeThis={() =>- handleMoreLikeThis(template.originalIndex)- }- onUse={() => handleUse(template.originalIndex)}- onPreview={() =>- handlePreview(template.originalIndex)- }- />- </div>,- ];- if (activeTab === 'all' && i === 0) {- items.unshift(- ...THEME_PICKER_ENTRIES.filter(- t => t.key === 'daily' || t.key === 'forest',- ).map((t, ti) => (- <ThemeCard- key={`theme-${t.key}`}- theme={t}- index={ti}- onCustomize={() => setThemePreviewKey(t.key)}- onEdit={(t: ThemePickerEntry) => {- setThemeEditorInitial({- accent: t.preview.accent,- font: t.preview.font,- radius: t.preview.radius,- });- setThemeEditorImage(- t.preview.img- ? `${basePath}/docsite/${t.preview.img}`- : null,- );- setActiveView('theme');- }}- />- )),- );- }- if (activeTab === 'all' && i === 7) {- const picks = COMPONENT_PREVIEW_LIST.filter(c =>- ['slider', 'switch', 'progressbar'].includes(- c.key,- ),- );- items.push(- ...picks.map((comp, ci) => (- <XDSCard- key={`comp-${comp.key}`}- padding={0}- style={{- animation: `craftCardFadeIn 400ms ${(i + ci + 1) * 60}ms cubic-bezier(0.16, 1, 0.3, 1) both`,- }}>- <div- style={{- display: 'flex',- flexDirection: 'column',- height: '100%',- }}>- <div- style={{- padding: '32px 20px',- flex: 1,- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- backgroundColor:- 'var(--color-background-body)',- }}>- {comp.preview}- </div>- <div- style={{- padding: '12px 16px',- borderTop:- '1px solid var(--color-border-emphasized)',- backgroundColor:- 'var(--color-background-body)',- }}>- <XDSText type="body" weight="bold">- {comp.label}- </XDSText>- </div>- </div>- </XDSCard>- )),- );- }- return items;- })}- </div>- ))}- </div>- </div>- </div>- </div>- {!chatOpen && (- <AIComposer- tabMode={activeTab === 'theme' ? 'theme' : 'template'}- onThemeMode={() => setActiveView('theme')}- />- )}- {/* Bottom drawer overlay */}- {previewTarget !== null &&- (() => {- const t =- TEMPLATES[- typeof previewTarget === 'number'- ? previewTarget % TEMPLATES.length- : 0- ];- if (!t) {- return null;- }- const isLandingPage = t.name === 'Landing Page';- const settingsVariants = [- {- img: `${basePath}/docsite/card4-preview-default.png`,- name: 'Landing Page',- key: 'preview',- themeImages: {- default: `${basePath}/docsite/card4-preview-default.png`,- matcha: `${basePath}/docsite/card4-preview-meta.png`,- daily: `${basePath}/docsite/card4-preview-daily.png`,- threads: `${basePath}/docsite/card4-preview-daily.png`,- },- },- {- img: `${basePath}/docsite/card4-hero-default.png`,- name: 'Hero Layout',- key: 'hero',- themeImages: {- default: `${basePath}/docsite/card4-hero-default.png`,- matcha: `${basePath}/docsite/card4-hero-meta.png`,- daily: `${basePath}/docsite/card4-hero-daily.png`,- threads: `${basePath}/docsite/card4-hero-daily.png`,- },- },- {- img: `${basePath}/docsite/card4-split-default.png`,- name: 'Split Layout',- key: 'split',- themeImages: {- default: `${basePath}/docsite/card4-split-default.png`,- matcha: `${basePath}/docsite/card4-split-meta.png`,- daily: `${basePath}/docsite/card4-split-daily.png`,- threads: `${basePath}/docsite/card4-split-daily.png`,- },- },- {- img: `${basePath}/docsite/card4-grid-default.png`,- name: 'Grid Layout',- key: 'grid',- themeImages: {- default: `${basePath}/docsite/card4-grid-default.png`,- matcha: `${basePath}/docsite/card4-grid-meta.png`,- daily: `${basePath}/docsite/card4-grid-daily.png`,- threads: `${basePath}/docsite/card4-grid-daily.png`,- },- },- {- img: `${basePath}/docsite/card4-carousel-default.png`,- name: 'Carousel Layout',- key: 'carousel',- themeImages: {- default: `${basePath}/docsite/card4-carousel-default.png`,- matcha: `${basePath}/docsite/card4-carousel-meta.png`,- daily: `${basePath}/docsite/card4-carousel-daily.png`,- threads: `${basePath}/docsite/card4-carousel-daily.png`,- },- },- ];- const activeVariantKey = selectedVariant?.key ?? 'preview';- const moreLikeThisImages = isLandingPage- ? settingsVariants.filter(v => v.key !== activeVariantKey)- : TEMPLATES.map((tmpl, i) => ({- img: tmpl.src,- slug: tmpl.slug,- name: tmpl.name,- key: i,- }))- .filter(item => item.key !== previewTarget)- .slice(0, 4);- const activeSettingsVariant = isLandingPage- ? (settingsVariants.find(v => v.key === activeVariantKey) ??- settingsVariants[0])- : null;- return (- <TemplatePreviewModal- isOpen={true}- onClose={() => {- setPreviewTarget(null);- setSelectedVariant(null);- }}- item={{- name: activeSettingsVariant?.name ?? t.name,- img: activeSettingsVariant?.img ?? t.src,- slug: isLandingPage ? undefined : t.slug,- author: t.author,- ...(activeSettingsVariant- ? {themeImages: activeSettingsVariant.themeImages}- : undefined),- }}- onStartCrafting={() => {- viewBeforeEditorRef.current = activeView;- setUseTarget(previewTarget);- setPanelTab('configure');- setChatOpen(true);- }}- isBookmarked={card4Bookmarked}- onBookmarkToggle={() => setCard4Bookmarked(prev => !prev)}- moreLikeThis={moreLikeThisImages}- onMoreLikeThisClick={mlItem => {- if (typeof mlItem.key === 'number') {- setPreviewTarget(mlItem.key);- setSelectedVariant(null);- } else {- setSelectedVariant({- name: mlItem.name,- img: mlItem.img,- key: String(mlItem.key),- themeImages: mlItem.themeImages,- });- }- }}- exploreTags={[- 'website',- 'dashboard',- 'admin panel',- 'settings',- 'form layout',- 'data table',- 'sidebar nav',- 'landing page',- 'e-commerce',- 'documentation',- 'profile page',- ]}- onExploreTagClick={handleTokenClick}- componentTags={[- 'XDSAppShell',- 'XDSTopNav',- 'XDSVStack',- 'XDSHStack',- 'XDSHeading',- 'XDSText',- 'XDSButton',- 'XDSCard',- 'XDSBadge',- 'XDSAvatar',- ]}- onComponentTagClick={handleTokenClick}- />- );- })()}- {/* Theme preview modal */}- {themePreviewKey !== null &&- (() => {- const t = THEME_PICKER_ENTRIES.find(e => e.key === themePreviewKey);- if (!t) {- return null;- }- const r = t.preview.radius ?? 8;- const font = t.preview.font ?? 'system-ui, sans-serif';- return (- <XDSDialog- isOpen={true}- onOpenChange={open => {- if (!open) {- setThemePreviewKey(null);- }- }}- width="90vw"- maxHeight="90vh"- purpose="info"- style={- {- padding: 0,- overflow: 'visible',- maxWidth: 900,- '--xds-dialog-padding': '0px',- } satisfies React.CSSProperties- }>- <div- style={{position: 'absolute', top: 0, right: -40, zIndex: 1}}>- <XDSCard padding={0} style={{borderRadius: '50%'}}>- <XDSButton- label="Close"- variant="ghost"- size="sm"- isIconOnly- icon={<span style={{fontSize: 16, lineHeight: 1}}>✕</span>}- onClick={() => setThemePreviewKey(null)}- />- </XDSCard>- </div>- <div style={{overflowY: 'auto', maxHeight: '85vh'}}>- <div- style={{- display: 'flex',- gap: 32,- padding: 32,- fontFamily: font,- }}>- {/* Left — brand moodboard */}- <div style={{flex: 1, minWidth: 0}}>- {/* Header */}- <div- style={{- display: 'flex',- alignItems: 'center',- gap: 12,- marginBottom: 24,- }}>- <div- style={{- width: 32,- height: 32,- borderRadius: r,- backgroundColor: t.preview.accent,- }}- />- <XDSHeading level={2}>{t.name}</XDSHeading>- <span- style={{- fontSize: 11,- fontWeight: 600,- padding: '2px 10px',- borderRadius: 'var(--radius-control)',- backgroundColor: 'var(--color-background-muted)',- color: 'var(--color-text-secondary)',- }}>- {t.category === 'official' ? 'Official' : 'Community'}- </span>- </div>- {t.description && (- <XDSText- type="body"- color="secondary"- style={{marginBottom: 24}}>- {t.description}- </XDSText>- )}- {/* Color palette */}- <XDSText- type="label"- color="secondary"- style={{marginBottom: 12, display: 'block'}}>- Colors- </XDSText>- <div style={{display: 'flex', gap: 12, marginBottom: 28}}>- {[- {- color: t.preview.accent,- label: 'Accent',- hex: t.preview.accent,- },- {- color: t.preview.bg,- label: 'Background',- hex: t.preview.bg,- },- {- color: t.preview.surface,- label: 'Surface',- hex: t.preview.surface,- },- {- color: t.preview.text,- label: 'Text',- hex: t.preview.text,- },- ].map(swatch => (- <div- key={swatch.label}- style={{flex: 1, textAlign: 'center'}}>- <div- style={{- aspectRatio: '1',- borderRadius: r,- backgroundColor: swatch.color,- border:- swatch.color.toUpperCase() === '#FFFFFF'- ? '1px solid var(--color-border-default)'- : 'none',- marginBottom: 6,- }}- />- <XDSText type="supporting" style={{display: 'block'}}>- {swatch.label}- </XDSText>- <XDSText- type="supporting"- color="secondary"- style={{display: 'block', fontSize: 10}}>- {swatch.hex}- </XDSText>- </div>- ))}- </div>- {/* Typography */}- <XDSText- type="label"- color="secondary"- style={{marginBottom: 12, display: 'block'}}>- Typography- </XDSText>- <div- style={{- padding: 20,- borderRadius: r,- backgroundColor: 'var(--color-background-muted)',- marginBottom: 28,- }}>- <div- style={{- fontSize: 48,- fontWeight: 300,- lineHeight: 1,- marginBottom: 8,- }}>- Aa- </div>- <XDSText type="body" color="secondary">- {font.split(',')[0].trim()}- </XDSText>- <div- style={{- marginTop: 12,- fontSize: 13,- lineHeight: 1.6,- opacity: 0.6,- }}>- ABCDEFGHIJKLMNOPQRSTUVWXYZ- <br />- abcdefghijklmnopqrstuvwxyz- <br />- 0123456789- </div>- </div>- {/* Radius */}- <XDSText- type="label"- color="secondary"- style={{marginBottom: 12, display: 'block'}}>- Border Radius- </XDSText>- <div- style={{- display: 'flex',- gap: 12,- alignItems: 'flex-end',- marginBottom: 28,- }}>- {[r * 0.5, r, r * 1.5, r * 2].map((rv, i) => (- <div key={i} style={{textAlign: 'center'}}>- <div- style={{- width: 40 + i * 8,- height: 40 + i * 8,- borderRadius: rv,- backgroundColor:- i === 1- ? t.preview.accent- : 'var(--color-background-muted)',- border:- i !== 1- ? '1px solid var(--color-border-default)'- : 'none',- }}- />- <XDSText- type="supporting"- color="secondary"- style={{- display: 'block',- marginTop: 4,- fontSize: 10,- }}>- {Math.round(rv)}px- </XDSText>- </div>- ))}- </div>- </div>- {/* Right — actions */}- <div style={{width: 220, flexShrink: 0, paddingTop: 8}}>- <XDSButton- label="Customize theme"- onClick={() => {- setThemePreviewKey(null);- setActiveView('theme');- }}- style={{width: '100%', marginBottom: 12}}- />- <XDSButton- label="Close"- variant="secondary"- onClick={() => setThemePreviewKey(null)}- style={{width: '100%', marginBottom: 24}}- />- {/* More themes */}- <XDSText- type="label"- color="secondary"- style={{marginBottom: 12, display: 'block'}}>- More themes- </XDSText>- <div- style={{- display: 'flex',- flexDirection: 'column',- gap: 8,- }}>- {THEME_PICKER_ENTRIES.filter(- e => e.key !== themePreviewKey,- )- .slice(0, 4)- .map(other => (- <div- key={other.key}- style={{- display: 'flex',- alignItems: 'center',- gap: 10,- padding: '8px 10px',- borderRadius: 8,- cursor: 'pointer',- transition: 'background-color 150ms',- }}- onClick={() => setThemePreviewKey(other.key)}- onMouseEnter={e =>- (e.currentTarget.style.backgroundColor =- 'var(--color-background-muted)')- }- onMouseLeave={e =>- (e.currentTarget.style.backgroundColor =- 'transparent')- }>- <div- style={{- width: 20,- height: 20,- borderRadius: other.preview.radius ?? 4,- backgroundColor: other.preview.accent,- flexShrink: 0,- }}- />- <XDSText type="body" style={{fontSize: 13}}>- {other.name}- </XDSText>- </div>- ))}- </div>- </div>- </div>- </div>- </XDSDialog>- );- })()}- {/* Settings dialog */}- <XDSDialog- isOpen={isSettingsOpen}- onOpenChange={setIsSettingsOpen}- width={560}- purpose="form">- <XDSStack direction="vertical" gap={4} style={{padding: '8px 0'}}>- <XDSStack direction="horizontal" hAlign="between" vAlign="center">- <XDSStack direction="vertical" gap={1}>- <XDSText type="body" style={{fontWeight: 600}}>- Dark mode- </XDSText>- <XDSText type="supporting" color="secondary">- Switch between light and dark appearance- </XDSText>- </XDSStack>- <XDSButton- label={previewMode === 'dark' ? 'On' : 'Off'}- variant="secondary"- size="sm"- onClick={() =>- setPreviewMode(previewMode === 'dark' ? 'light' : 'dark')- }- />- </XDSStack>- <XDSDivider variant="strong" />- <XDSStack direction="horizontal" hAlign="between" vAlign="center">- <XDSStack direction="vertical" gap={1}>- <XDSText type="body" style={{fontWeight: 600}}>- Theme- </XDSText>- <XDSText type="supporting" color="secondary">- Choose a visual theme for previews- </XDSText>- </XDSStack>- <XDSDropdownMenu- button={{- label:- previewTheme.charAt(0).toUpperCase() + previewTheme.slice(1),- variant: 'secondary',- size: 'sm',- }}- items={[- {label: 'Default', onClick: () => setPreviewTheme('default')},- {label: 'Neutral', onClick: () => setPreviewTheme('neutral')},- {- label: 'Brutalist',- onClick: () => setPreviewTheme('brutalist'),- },- {label: 'Matcha', onClick: () => setPreviewTheme('matcha')},- {label: 'Daily', onClick: () => setPreviewTheme('daily')},- ]}- />- </XDSStack>- <XDSDivider variant="strong" />- <XDSStack direction="horizontal" hAlign="between" vAlign="center">- <XDSStack direction="vertical" gap={1}>- <XDSText type="body" style={{fontWeight: 600}}>- Default sort- </XDSText>- <XDSText type="supporting" color="secondary">- How templates are ordered by default- </XDSText>- </XDSStack>- <XDSDropdownMenu- button={{- label:- sortOption === 'trending'- ? 'Trending'- : sortOption === 'newest'- ? 'Newest'- : 'Oldest',- variant: 'secondary',- size: 'sm',- }}- items={[- {label: 'Trending', onClick: () => setSortOption('trending')},- {label: 'Newest', onClick: () => setSortOption('newest')},- {label: 'Oldest', onClick: () => setSortOption('oldest')},- ]}- />- </XDSStack>- </XDSStack>- </XDSDialog>- </XDSAppShell>- );-}diff --git a/apps/sandbox/src/app/sandboxPages.ts b/apps/sandbox/src/app/sandboxPages.tsindex 5ae0b465df..9fecb051b8 100644--- a/apps/sandbox/src/app/sandboxPages.ts+++ b/apps/sandbox/src/app/sandboxPages.ts@@ -177,12 +177,6 @@ export const categories: SandboxCategory[] = [description:'Token reference docs with live theme previews — color, spacing, typography, and more',},- {- name: 'Docsite',- href: '/pages/docsite/',- description:- 'Template gallery with AI composer and component documentation',- },{name: 'Media Mode',href: '/pages/media-mode/',