An open source design system that's fully customizable and agent ready
TypeScript
feat(sandbox): open Chat tab when clicking Customize on 2nd docsite card (#1315)
rubyycheung177dcd5577b5
diff --git a/apps/sandbox/package.json b/apps/sandbox/package.jsonindex f87562bb7c..b92fe62e36 100644--- a/apps/sandbox/package.json+++ b/apps/sandbox/package.json@@ -4,9 +4,10 @@"private": true,"scripts": {"build:deps": "yarn workspace @xds/core build && yarn workspace @xds/theme-default build && yarn workspace @xds/theme-neutral build && yarn workspace @xds/theme-brutalist build && yarn workspace @xds/theme-meta build && yarn workspace @xds/theme-whatsapp build && yarn workspace @xds/theme-daily build",- "predev": "node ../../scripts/sync-templates.js",+ "generate:versions": "node scripts/generate-versions.js",+ "predev": "node ../../scripts/sync-templates.js && yarn generate:versions","dev": "next dev",- "prebuild": "node ../../scripts/sync-templates.js",+ "prebuild": "node ../../scripts/sync-templates.js && yarn generate:versions","build": "next build","start": "next start","postinstall": "xds agent-docs"diff --git a/apps/sandbox/scripts/generate-versions.js b/apps/sandbox/scripts/generate-versions.jsnew file mode 100644index 0000000000..9a0f03534f--- /dev/null+++ b/apps/sandbox/scripts/generate-versions.js@@ -0,0 +1,107 @@+/* eslint-env node */+/* eslint-disable no-undef, @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 = `// 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 2a2c8f791e..897a6b3a91 100644--- a/apps/sandbox/src/app/(fullscreen)/PreviewShell.tsx+++ b/apps/sandbox/src/app/(fullscreen)/PreviewShell.tsx@@ -1,6 +1,6 @@'use client';-import {useState, useCallback, useEffect, useMemo} from 'react';+import {useState, useCallback, useEffect, useMemo, useRef} from 'react';import {usePathname, useRouter} from 'next/navigation';import {XDSText} from '@xds/core/Text';import {XDSDropdownMenu} from '@xds/core/DropdownMenu';@@ -15,6 +15,7 @@ import {import {categories} from '../sandboxPages';import {useThemeControls} from '../providers';import {sourceRegistry} from '../../generated/sourceRegistry';+import {gitVersions} from '../../generated/versionRegistry';function EyeIcon(props: React.SVGProps<SVGSVGElement>) {return (@@ -180,6 +181,362 @@ 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> = {desktop: '100%',@@ -305,6 +662,8 @@ export function PreviewShell({children}: {children: React.ReactNode}) {</button></div>+ <VersionDropdown pathname={pathname} />+<XDSCommandPaletteisOpen={paletteOpen}onOpenChange={setPaletteOpen}diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/page.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/page.tsxindex 51941a02f7..d5538f221b 100644--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/page.tsx+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/page.tsx@@ -23,6 +23,9 @@ import {XDSDialog, XDSDialogHeader} from '@xds/core/Dialog';import {XDSDivider} from '@xds/core/Divider';import {XDSTooltip} from '@xds/core/Tooltip';import {XDSTable} from '@xds/core/Table';+import {XDSTextInput} from '@xds/core/TextInput';+import {XDSTextArea} from '@xds/core/TextArea';+import {XDSTokenizer} from '@xds/core/Tokenizer';import {createStaticSource} from '@xds/core/Typeahead';// ---------------------------------------------------------------------------@@ -78,14 +81,6 @@ const FilterIcon = (props: React.SVGProps<SVGSVGElement>) => (</svg>);-const MoreIcon = (props: React.SVGProps<SVGSVGElement>) => (- <svg viewBox="0 0 24 24" fill="currentColor" {...props}>- <circle cx="12" cy="5" r="2" />- <circle cx="12" cy="12" r="2" />- <circle cx="12" cy="19" r="2" />- </svg>-);-const PlusIcon = (props: React.SVGProps<SVGSVGElement>) => (<svgviewBox="0 0 24 24"@@ -110,25 +105,27 @@ const LinkIcon = (props: React.SVGProps<SVGSVGElement>) => (</svg>);-const HeartIcon = (props: React.SVGProps<SVGSVGElement>) => (+const CheckIcon = (props: React.SVGProps<SVGSVGElement>) => (<svgviewBox="0 0 24 24"fill="none"stroke="currentColor"strokeWidth={2}+ strokeLinecap="round"+ strokeLinejoin="round"{...props}>- <path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z" />+ <polyline points="20 6 9 17 4 12" /></svg>);-const ThumbsUpIcon = (props: React.SVGProps<SVGSVGElement>) => (+const HeartIcon = (props: React.SVGProps<SVGSVGElement>) => (<svgviewBox="0 0 24 24"fill="none"stroke="currentColor"strokeWidth={2}{...props}>- <path d="M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3H14zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3" />+ <path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z" /></svg>);@@ -143,37 +140,6 @@ const SendIcon = (props: React.SVGProps<SVGSVGElement>) => (</svg>);-const SidebarCollapseIcon = (props: React.SVGProps<SVGSVGElement>) => (- <svg- viewBox="0 0 24 24"- fill="none"- stroke="currentColor"- strokeWidth={2}- 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" />- <polyline points="14 9 11 12 14 15" />- </svg>-);--const AaIcon = (props: React.SVGProps<SVGSVGElement>) => (- <svg- viewBox="0 0 24 24"- fill="none"- stroke="currentColor"- strokeWidth={1.8}- strokeLinecap="round"- strokeLinejoin="round"- {...props}>- <path d="M3 18L8 6h1l5 12" />- <line x1="5" y1="14" x2="12" y2="14" />- <path d="M15 18c0-2.5 1.5-4 3.5-4s3.5 1.5 3.5 4" />- <line x1="22" y1="18" x2="22" y2="13" />- </svg>-);-const ChevronDownIcon = (props: React.SVGProps<SVGSVGElement>) => (<svgviewBox="0 0 24 24"@@ -905,6 +871,21 @@ function ShimmerText({isActive}: {isActive: boolean}) {// Chat Panel (shown when generating)// ---------------------------------------------------------------------------+const HamburgerIcon = (props: React.SVGProps<SVGSVGElement>) => (+ <svg+ viewBox="0 0 24 24"+ fill="none"+ stroke="currentColor"+ strokeWidth={2}+ strokeLinecap="round"+ strokeLinejoin="round"+ {...props}>+ <line x1="3" y1="6" x2="21" y2="6" />+ <line x1="3" y1="12" x2="21" y2="12" />+ <line x1="3" y1="18" x2="21" y2="18" />+ </svg>+);+const SidebarIcon = (props: React.SVGProps<SVGSVGElement>) => (<svgviewBox="0 0 24 24"@@ -929,8 +910,8 @@ function ChatPanel({}: {isGenerating: boolean;onSend?: () => void;- activeView: 'craft' | 'library' | 'learn' | 'profile';- setActiveView: (view: 'craft' | 'library' | 'learn' | 'profile') => void;+ activeView: 'craft' | 'library' | 'profile';+ setActiveView: (view: 'craft' | 'library' | 'profile') => void;templateName?: string;onBack?: () => void;}) {@@ -1196,7 +1177,7 @@ const BookmarkIcon = (props: React.SVGProps<SVGSVGElement>) => (</svg>);-const PaperPlaneIcon = (props: React.SVGProps<SVGSVGElement>) => (+const ShareIcon = (props: React.SVGProps<SVGSVGElement>) => (<svgviewBox="0 0 24 24"fill="none"@@ -1205,8 +1186,9 @@ const PaperPlaneIcon = (props: React.SVGProps<SVGSVGElement>) => (strokeLinecap="round"strokeLinejoin="round"{...props}>- <path d="M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z" />- <path d="M6 12h16" />+ <path d="M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8" />+ <polyline points="8 6 12 2 16 6" />+ <line x1="12" y1="2" x2="12" y2="16" /></svg>);@@ -1222,18 +1204,6 @@ const DesktopIcon = (props: React.SVGProps<SVGSVGElement>) => (</svg>);-const TabletIcon = (props: React.SVGProps<SVGSVGElement>) => (- <svg- viewBox="0 0 24 24"- fill="none"- stroke="currentColor"- strokeWidth={2}- {...props}>- <rect x="4" y="2" width="16" height="20" rx="2" />- <line x1="12" y1="18" x2="12" y2="18" strokeLinecap="round" />- </svg>-);-const PhoneIcon = (props: React.SVGProps<SVGSVGElement>) => (<svgviewBox="0 0 24 24"@@ -1287,6 +1257,20 @@ const CursorAIIcon = (props: React.SVGProps<SVGSVGElement>) => (</svg>);+const CopyIcon = (props: React.SVGProps<SVGSVGElement>) => (+ <svg+ viewBox="0 0 24 24"+ fill="none"+ stroke="currentColor"+ strokeWidth={2}+ strokeLinecap="round"+ strokeLinejoin="round"+ {...props}>+ <rect x="9" y="9" width="13" height="13" rx="2" ry="2" />+ <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" />+ </svg>+);+// ---------------------------------------------------------------------------// Mock code for the code block// ---------------------------------------------------------------------------@@ -1344,9 +1328,9 @@ const XDS_THEMES = [];function TemplatePreview({- templateName,+ templateName: _templateName,imageSrc,- onBack,+ onBack: _onBack,isGenerating,simulation,}: {@@ -1478,7 +1462,7 @@ function TemplatePreview({label: 'Share',variant: 'ghost',isIconOnly: true,- icon: <PaperPlaneIcon />,+ icon: <ShareIcon />,}}hasChevron={false}menuWidth={220}@@ -1692,6 +1676,15 @@ function ClassicTemplatePreview({const previewRef = useRef<HTMLDivElement>(null);const [previewSize, setPreviewSize] = useState({w: 0, h: 0});const [showCanvas, setShowCanvas] = useState(false);+ const [showSendPopover, setShowSendPopover] = useState(false);+ const [sendPopoverPos, setSendPopoverPos] = useState<{+ top: number;+ left: number;+ } | null>(null);+ const [sendCopied, setSendCopied] = useState(false);+ const sendPopoverRef = useRef<HTMLDivElement>(null);++ const shareCliCommand = `npx xds template ${templateName.toLowerCase().replace(/\s+/g, '-')} ./my-project`;useEffect(() => {if (isGenerating && previewRef.current) {@@ -1708,6 +1701,20 @@ function ClassicTemplatePreview({}}, [isGenerating, showCanvas]);+ useEffect(() => {+ if (!showSendPopover) return;+ const handleClickOutside = (e: MouseEvent) => {+ if (+ sendPopoverRef.current &&+ !sendPopoverRef.current.contains(e.target as Node)+ ) {+ setShowSendPopover(false);+ }+ };+ document.addEventListener('mousedown', handleClickOutside);+ return () => document.removeEventListener('mousedown', handleClickOutside);+ }, [showSendPopover]);+return (<divstyle={{@@ -1737,15 +1744,17 @@ function ClassicTemplatePreview({label="Template actions"startContent={<>- <XDSButton- label="Back"- variant="ghost"- size="sm"- icon={<ArrowLeftIcon />}- isIconOnly- onClick={onBack}- style={{marginLeft: -8}}- />+ <XDSTooltip content="Back">+ <XDSButton+ label="Back"+ variant="ghost"+ size="sm"+ icon={<ArrowLeftIcon />}+ isIconOnly+ onClick={onBack}+ style={{marginLeft: -8}}+ />+ </XDSTooltip><XDSHeading level={3}>{templateName}</XDSHeading></>}@@ -1771,64 +1780,210 @@ function ClassicTemplatePreview({}endContent={<>- <XDSButton- label="Code"- variant="ghost"- isIconOnly- icon={<CodeIcon />}- />- <XDSButton- label="Point"- variant="ghost"- isIconOnly- icon={<CursorIcon />}- />- <XDSDropdownMenu- button={{- label: 'Theme',- variant: 'ghost',- icon: <PaletteIcon />,- isIconOnly: true,- }}- hasChevron={false}- items={XDS_THEMES.map(t => ({- label: t.label,- onClick: () => {},- }))}- />- <XDSButton- label="Toggle theme"- variant="ghost"- isIconOnly- icon={<ContrastIcon />}- />- <XDSButton- label="Save"- variant="ghost"- isIconOnly- icon={<SaveIcon />}- />- <XDSDropdownMenu- button={{- label: 'Share',- variant: 'ghost',- icon: <PaperPlaneIcon />,- isIconOnly: true,- }}- hasChevron={false}- menuWidth={220}- items={[- {- label: 'Copy CLI Command...',- icon: TerminalIcon,+ <XDSTooltip content="Code">+ <XDSButton+ label="Code"+ variant="ghost"+ isIconOnly+ icon={<CodeIcon />}+ />+ </XDSTooltip>+ <XDSTooltip content="Point">+ <XDSButton+ label="Point"+ variant="ghost"+ isIconOnly+ icon={<CursorIcon />}+ />+ </XDSTooltip>+ <XDSTooltip content="Theme">+ <XDSDropdownMenu+ button={{+ label: 'Theme',+ variant: 'ghost',+ icon: <PaletteIcon />,+ isIconOnly: true,+ }}+ hasChevron={false}+ items={XDS_THEMES.map(t => ({+ label: t.label,onClick: () => {},- },- {type: 'divider' as const},- {label: 'Claude Code', icon: ClaudeIcon, onClick: () => {}},- {label: 'VSCode', icon: VSCodeIcon, onClick: () => {}},- {label: 'Cursor', icon: CursorAIIcon, onClick: () => {}},- ]}+ }))}+ />+ </XDSTooltip>+ <XDSTooltip content="Toggle theme">+ <XDSButton+ label="Toggle theme"+ variant="ghost"+ isIconOnly+ icon={<ContrastIcon />}+ />+ </XDSTooltip>+ <div+ style={{+ width: 1,+ height: 20,+ backgroundColor: 'var(--color-border-strong, #999)',+ margin: '0 4px',+ flexShrink: 0,+ }}/>+ <XDSTooltip content="Save">+ <XDSButton+ label="Save"+ variant="ghost"+ isIconOnly+ icon={<SaveIcon />}+ />+ </XDSTooltip>+ <div+ ref={sendPopoverRef}+ style={{position: 'relative' as const}}>+ <XDSTooltip content="Share">+ <XDSButton+ label="Share"+ variant="ghost"+ isIconOnly+ icon={<ShareIcon />}+ onClick={() => {+ setShowSendPopover(prev => {+ if (!prev && sendPopoverRef.current) {+ const rect =+ sendPopoverRef.current.getBoundingClientRect();+ const popoverWidth = 340;+ const popoverHeight = 400;+ const left = Math.min(+ Math.max(8, rect.right - popoverWidth),+ window.innerWidth - popoverWidth - 16,+ );+ const top =+ rect.bottom + 4 + popoverHeight + 16 >+ window.innerHeight+ ? rect.top - popoverHeight - 4+ : rect.bottom + 4;+ setSendPopoverPos({top, left});+ }+ return !prev;+ });+ }}+ />+ </XDSTooltip>+ {showSendPopover && sendPopoverPos && (+ <div+ style={{+ position: 'fixed' as const,+ left: sendPopoverPos.left,+ top: sendPopoverPos.top,+ zIndex: 100,+ width: 340,+ backgroundColor: 'var(--color-background-card, #fff)',+ borderRadius: 12,+ boxShadow:+ '0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08)',+ padding: 20,+ }}>+ <XDSHeading level={4}>Add to your project</XDSHeading>+ <div style={{marginTop: 8}}>+ <XDSText type="body" color="secondary">+ Copy this snippet and paste it in your terminal to get+ started.+ </XDSText>+ </div>++ {/* Code block */}+ <div+ style={{+ position: 'relative' as const,+ backgroundColor: '#1a1a2e',+ borderRadius: 10,+ padding: '14px 16px',+ paddingRight: 44,+ marginTop: 12,+ }}>+ <code+ style={{+ color: '#fff',+ fontFamily: '"Roboto Mono", monospace',+ fontSize: 13,+ lineHeight: 1.5,+ wordBreak: 'break-all' as const,+ }}>+ {shareCliCommand}+ </code>+ <div+ style={{+ position: 'absolute' as const,+ top: 8,+ right: 8,+ }}>+ <XDSButton+ label={sendCopied ? 'Copied' : 'Copy'}+ variant="ghost"+ size="sm"+ isIconOnly+ icon={<CopyIcon />}+ style={{+ color: sendCopied ? '#4ade80' : '#fff',+ }}+ onClick={() => {+ navigator.clipboard.writeText(shareCliCommand);+ setSendCopied(true);+ setTimeout(() => setSendCopied(false), 2000);+ }}+ />+ </div>+ </div>++ {/* Divider */}+ <div+ style={{+ height: 1,+ backgroundColor: 'var(--color-divider, #e0e0e0)',+ margin: '16px 0',+ }}+ />++ {/* IDE options */}+ <div style={{marginBottom: 8}}>+ <XDSText+ type="supporting"+ weight="semibold"+ color="secondary">+ Open in...+ </XDSText>+ </div>+ {[+ {+ label: 'Claude Code',+ Icon: ClaudeIcon,+ },+ {label: 'VSCode', Icon: VSCodeIcon},+ {label: 'Cursor', Icon: CursorAIIcon},+ ].map(item => (+ <div+ key={item.label}+ onClick={() => setShowSendPopover(false)}+ style={{+ display: 'flex',+ alignItems: 'center',+ gap: 10,+ padding: '8px 4px',+ cursor: 'pointer',+ borderRadius: 8,+ }}>+ <item.Icon+ style={{+ width: 18,+ height: 18,+ flexShrink: 0,+ }}+ />+ <XDSText type="body">{item.label}</XDSText>+ </div>+ ))}+ </div>+ )}+ </div></>}/>@@ -2118,10 +2273,9 @@ const XDS_LOGO_PLAIN = (</svg>);-const NAV_ITEMS: Array<{key: 'craft' | 'library' | 'learn'; label: string}> = [+const NAV_ITEMS: Array<{key: 'craft' | 'library'; label: string}> = [{key: 'craft', label: 'Craft'},{key: 'library', label: 'Library'},- {key: 'learn', label: 'Learn'},];function LogoNav({@@ -2129,70 +2283,83 @@ function LogoNav({setActiveView,logo,}: {- activeView: 'craft' | 'library' | 'learn' | 'profile';- setActiveView: (view: 'craft' | 'library' | 'learn' | 'profile') => void;+ activeView: 'craft' | 'library' | 'profile';+ setActiveView: (view: 'craft' | 'library' | 'profile') => void;logo?: React.ReactNode;}) {const [isOpen, setIsOpen] = useState(false);const [hoveredItem, setHoveredItem] = useState<string | null>(null);return (- <div- style={{position: 'relative'}}- onMouseEnter={() => setIsOpen(true)}- onMouseLeave={() => {- setIsOpen(false);- setHoveredItem(null);- }}>- <div style={{cursor: 'pointer'}}>{logo || XDS_LOGO_PLAIN}</div>- {isOpen && (- <div- style={{- position: 'absolute',- top: -8,- left: -16,- backgroundColor: 'var(--color-background-card, white)',- borderRadius: 16,- boxShadow: '0 4px 24px rgba(0,0,0,0.12)',- padding: 8,- minWidth: 200,- zIndex: 100,- }}>- <div style={{marginBottom: 12, paddingLeft: 8, paddingRight: 8}}>- {logo || XDS_LOGO_PLAIN}- </div>+ <div style={{display: 'flex', alignItems: 'center', gap: 4}}>+ <XDSButton+ label="Menu"+ variant="ghost"+ size="sm"+ isIconOnly+ icon={<HamburgerIcon />}+ />+ <div+ style={{position: 'relative'}}+ onMouseEnter={() => setIsOpen(true)}+ onMouseLeave={() => {+ setIsOpen(false);+ setHoveredItem(null);+ }}>+ <div style={{cursor: 'pointer'}}>{logo || XDS_LOGO_PLAIN}</div>+ {isOpen && (<div- style={{display: 'flex', flexDirection: 'column' as const, gap: 2}}>- {NAV_ITEMS.map(item => {- const isActive = activeView === item.key;- const isHovered = hoveredItem === item.key;- return (- <div- key={item.key}- onClick={() => setActiveView(item.key)}- onMouseEnter={() => setHoveredItem(item.key)}- onMouseLeave={() => setHoveredItem(null)}- style={{- padding: '8px 12px',- borderRadius: 8,- cursor: 'pointer',- backgroundColor:- isActive || isHovered- ? 'var(--color-background-body, #f1f4f7)'- : 'transparent',- transition: 'background-color 150ms ease',- }}>- <XDSText- type="body"- weight={isActive ? 'semibold' : 'normal'}>- {item.label}- </XDSText>- </div>- );- })}+ style={{+ position: 'absolute',+ top: -8,+ left: -16,+ backgroundColor: 'var(--color-background-card, white)',+ borderRadius: 16,+ boxShadow: '0 4px 24px rgba(0,0,0,0.12)',+ padding: 8,+ minWidth: 200,+ zIndex: 100,+ }}>+ <div style={{marginBottom: 12, paddingLeft: 8, paddingRight: 8}}>+ {logo || XDS_LOGO_PLAIN}+ </div>+ <div+ style={{+ display: 'flex',+ flexDirection: 'column' as const,+ gap: 2,+ }}>+ {NAV_ITEMS.map(item => {+ const isActive = activeView === item.key;+ const isHovered = hoveredItem === item.key;+ return (+ <div+ key={item.key}+ onClick={() => setActiveView(item.key)}+ onMouseEnter={() => setHoveredItem(item.key)}+ onMouseLeave={() => setHoveredItem(null)}+ style={{+ padding: '8px 12px',+ borderRadius: 8,+ cursor: 'pointer',+ backgroundColor:+ isActive || isHovered+ ? 'var(--color-background-body, #f1f4f7)'+ : 'transparent',+ transition: 'background-color 150ms ease',+ }}>+ <XDSText+ type="body"+ weight={isActive ? 'semibold' : 'normal'}>+ {item.label}+ </XDSText>+ </div>+ );+ })}+ </div></div>- </div>- )}+ )}+ </div></div>);}@@ -2202,8 +2369,8 @@ function AppTopNav({setActiveView,scrollContainerRef,}: {- activeView: 'craft' | 'library' | 'learn' | 'profile';- setActiveView: (view: 'craft' | 'library' | 'learn' | 'profile') => void;+ activeView: 'craft' | 'library' | 'profile';+ setActiveView: (view: 'craft' | 'library' | 'profile') => void;scrollContainerRef?: React.RefObject<HTMLDivElement | null>;}) {const [isSearchOpen, setIsSearchOpen] = useState(false);@@ -2502,72 +2669,7 @@ function SectionLabel({label}: {label: string}) {}// ----------------------------------------------------------------------------// Code Preview with syntax highlighting (for DocsView)-// -----------------------------------------------------------------------------const BUTTON_CODE_LINES: Array<{spans: Array<{text: string; color: string}>}> =- [- {- spans: [- {text: 'import ', color: '#c678dd'},- {text: '{', color: '#abb2bf'},- {text: 'XDSButton', color: '#e5c07b'},- {text: '}', color: '#abb2bf'},- {text: ' from ', color: '#c678dd'},- {text: "'@xds/core/Button'", color: '#98c379'},- {text: ';', color: '#abb2bf'},- ],- },- {spans: [{text: '', color: '#abb2bf'}]},- {- spans: [- {text: 'export default ', color: '#c678dd'},- {text: 'function ', color: '#c678dd'},- {text: 'Example', color: '#61afef'},- {text: '() {', color: '#abb2bf'},- ],- },- {- spans: [- {text: ' return ', color: '#c678dd'},- {text: '(', color: '#abb2bf'},- ],- },- {- spans: [- {text: ' <', color: '#abb2bf'},- {text: 'XDSButton', color: '#e5c07b'},- ],- },- {- spans: [- {text: ' label', color: '#d19a66'},- {text: '=', color: '#abb2bf'},- {text: '"Button"', color: '#98c379'},- ],- },- {- spans: [- {text: ' variant', color: '#d19a66'},- {text: '=', color: '#abb2bf'},- {text: '"primary"', color: '#98c379'},- ],- },- {- spans: [- {text: ' icon', color: '#d19a66'},- {text: '={<', color: '#abb2bf'},- {text: 'PlusIcon', color: '#e5c07b'},- {text: ' />}', color: '#abb2bf'},- ],- },- {spans: [{text: ' />', color: '#abb2bf'}]},- {spans: [{text: ' );', color: '#abb2bf'}]},- {spans: [{text: '}', color: '#abb2bf'}]},- ];--// ----------------------------------------------------------------------------// DialogPreview — stateful dialog preview for component previews+// DialogPreview — stateful dialog preview for component previews// ---------------------------------------------------------------------------function DialogPreview() {@@ -2603,12 +2705,12 @@ function DocsView({activeView,setActiveView,}: {- activeView: 'craft' | 'library' | 'learn' | 'profile';- setActiveView: (v: 'craft' | 'library' | 'learn' | 'profile') => void;+ activeView: 'craft' | 'library' | 'profile';+ setActiveView: (v: 'craft' | 'library' | 'profile') => void;}) {const [activeNav, setActiveNav] = useState('button');- const [showCode, setShowCode] = useState(true);- const [activeRightNav, setActiveRightNav] = useState('usage');+ const [_showCode, _setShowCode] = useState(true);+ const [_activeRightNav, _setActiveRightNav] = useState('usage');const [selectedComponent, setSelectedComponent] = useState<string | null>(null,);@@ -3377,13 +3479,6 @@ function DocsView({}onClick={() => setActiveNav('getting-started')}/>- <XDSListItem- label="Quick start"- isSelected={- selectedComponent !== null && activeNav === 'quick-start'- }- onClick={() => setActiveNav('quick-start')}- /></XDSList>{COMPONENT_CATEGORIES.map(category => (@@ -3730,8 +3825,8 @@ function ProfileView({activeView,setActiveView,}: {- activeView: 'craft' | 'library' | 'learn' | 'profile';- setActiveView: (v: 'craft' | 'library' | 'learn' | 'profile') => void;+ activeView: 'craft' | 'library' | 'profile';+ setActiveView: (v: 'craft' | 'library' | 'profile') => void;}) {const [profileTab, setProfileTab] = useState('used');const [expandedCollection, setExpandedCollection] = useState<string | null>(@@ -4102,6 +4197,100 @@ function ProfileView({);}+// ---------------------------------------------------------------------------+// InlinePublishPanel — publish flow rendered inline in the left panel+// ---------------------------------------------------------------------------++const PUBLISH_TAGS = [+ 'Landing Page',+ 'Dashboard',+ 'Marketing',+ 'E-commerce',+ 'Documentation',+ 'SaaS',+];++function InlinePublishPanel({+ templateName,+ isVisible: _isVisible,+ onBack,+}: {+ templateName: string;+ isVisible: boolean;+ onBack: () => void;+}) {+ const [name, setName] = useState(templateName);+ const [description, setDescription] = useState('');+ const [tags, setTags] = useState<Array<{id: string; label: string}>>([]);+ const tagSource = createStaticSource(+ PUBLISH_TAGS.map(t => ({id: t, label: t})),+ );++ return (+ <div+ style={{+ display: 'flex',+ flexDirection: 'column' as const,+ gap: 20,+ overflowY: 'auto' as const,+ flex: 1,+ }}>+ {/* Back button */}+ <XDSButton+ label="Back"+ variant="ghost"+ size="sm"+ icon={<ArrowLeftIcon />}+ onClick={onBack}+ style={{marginLeft: -8, alignSelf: 'flex-start'}}+ />++ {/* Header */}+ <XDSHeading level={3}>Publish to community</XDSHeading>+ <XDSText type="supporting" color="secondary">+ Share your work so others on the team can use it as a starting point.+ </XDSText>++ {/* 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 button */}+ <XDSButton+ variant="primary"+ label="Publish template"+ size="lg"+ style={{width: '100%'}}+ />+ </div>+ );+}+// ---------------------------------------------------------------------------// TemplateFullPreview — full-page preview (like Squarespace template demos)// ---------------------------------------------------------------------------@@ -4128,6 +4317,7 @@ function TemplateFullPreview({onSelectTemplate,showChat = false,showEditor = false,+ defaultTab = 'properties',}: {templateName: string;imageSrc: string;@@ -4136,6 +4326,7 @@ function TemplateFullPreview({onSelectTemplate?: (index: number) => void;showChat?: boolean;showEditor?: boolean;+ defaultTab?: 'properties' | 'chat';}) {const [viewMode, setViewMode] = useState<'desktop' | 'mobile'>('desktop');const [editorView, setEditorView] = useState<'preview' | 'code'>('preview');@@ -4146,8 +4337,31 @@ function TemplateFullPreview({const [selectedFontPack, setSelectedFontPack] = useState<string | null>(PREVIEW_FONT_PACKS[0].heading,);- const [panelTab, setPanelTab] = useState<'properties' | 'chat'>('properties');+ const [panelTab, setPanelTab] = useState<'properties' | 'chat'>(defaultTab);const [chatInput, setChatInput] = useState('');+ const [showPublishModal, setShowPublishModal] = useState(false);+ const [showSharePopover, setShowSharePopover] = useState(false);+ const [showSendPopover, setShowSendPopover] = useState(false);+ const [sendPopoverPos, setSendPopoverPos] = useState<{+ top: number;+ left: number;+ } | null>(null);+ const [sharePopoverPos, setSharePopoverPos] = useState<{+ top: number;+ left: number;+ } | null>(null);+ const [shareCopied, setShareCopied] = useState(false);+ const [sendCopied, setSendCopied] = useState(false);+ const [linkCopied, setLinkCopied] = useState(false);+ const [liked, setLiked] = useState(false);+ const [likeCount, setLikeCount] = useState(1645);+ const [bookmarked, setBookmarked] = useState(false);+ const [bookmarkCount, setBookmarkCount] = useState(892);+ const sharePopoverRef = useRef<HTMLDivElement>(null);+ const shareButtonRef = useRef<HTMLButtonElement>(null);+ const sendPopoverRef = useRef<HTMLDivElement>(null);++ const shareCliCommand = `npx xds template ${templateName.toLowerCase().replace(/\s+/g, '-')} ./my-project`;useEffect(() => {requestAnimationFrame(() => {@@ -4155,6 +4369,34 @@ function TemplateFullPreview({});}, []);+ useEffect(() => {+ if (!showSharePopover) return;+ const handleClickOutside = (e: MouseEvent) => {+ if (+ sharePopoverRef.current &&+ !sharePopoverRef.current.contains(e.target as Node)+ ) {+ setShowSharePopover(false);+ }+ };+ document.addEventListener('mousedown', handleClickOutside);+ return () => document.removeEventListener('mousedown', handleClickOutside);+ }, [showSharePopover]);++ useEffect(() => {+ if (!showSendPopover) return;+ const handleClickOutside = (e: MouseEvent) => {+ if (+ sendPopoverRef.current &&+ !sendPopoverRef.current.contains(e.target as Node)+ ) {+ setShowSendPopover(false);+ }+ };+ document.addEventListener('mousedown', handleClickOutside);+ return () => document.removeEventListener('mousedown', handleClickOutside);+ }, [showSendPopover]);+return (<divstyle={{@@ -4188,364 +4430,575 @@ function TemplateFullPreview({display: 'flex',flexDirection: 'column' as const,}}>- {/* Back button + tabs on same row */}+ {/* Details / Chat content — hidden when publish is visible */}<divstyle={{- display: 'flex',- alignItems: 'center',- gap: 8,- marginBottom: showChat ? 32 : 8,- paddingBottom: 0,- borderBottom: showChat- ? '1px solid var(--color-divider, #e0e0e0)'- : 'none',+ display: showPublishModal ? 'none' : 'flex',+ flexDirection: 'column' as const,+ flex: 1,}}>- <XDSButton- label="Craft"- variant="ghost"- size="sm"- icon={<ArrowLeftIcon />}- isIconOnly={!!showChat}- onClick={onBack}- style={{marginLeft: -8, flexShrink: 0}}- />- {showChat && (- <div style={{display: 'flex', flex: 1}}>- {(['properties', 'chat'] as const).map(tab => (- <button- key={tab}- onClick={() => setPanelTab(tab)}- style={{- flex: 1,- padding: '8px 0',- background: 'none',- border: 'none',- borderBottom:- panelTab === tab- ? '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={panelTab === tab ? 'primary' : 'secondary'}>- {tab === 'properties' ? 'Details' : 'Chat'}- </XDSText>- </button>- ))}- </div>- )}- </div>-- {/* Chat tab content */}- {showChat && panelTab === 'chat' ? (+ {/* Back button + tabs on same row */}<divstyle={{display: 'flex',- flexDirection: 'column' as const,- flex: 1,- minHeight: 0,+ alignItems: 'center',+ gap: 8,+ marginBottom: showChat ? 32 : 8,+ paddingBottom: 0,+ borderBottom: showChat+ ? '1px solid var(--color-divider, #e0e0e0)'+ : 'none',}}>- {/* Chat messages area */}- <div style={{flex: 1, overflowY: 'auto' as const}}>- {/* Welcome message bubble */}- <div- style={{- backgroundColor: 'var(--color-background-body, #f1f4f7)',- borderRadius: 12,- padding: 12,- }}>- <XDSText type="body">- Hi! I can help you customize this template. Try asking me to- change colors, layout, or content.- </XDSText>- </div>- </div>-- {/* Composer pinned to bottom */}- <div- style={{- borderTop: '1px solid var(--color-divider, #e0e0e0)',- padding: 8,- display: 'flex',- alignItems: 'center',- gap: 8,- margin: '0 -32px -32px -32px',- paddingInline: 32,- paddingBottom: 32,- }}>+ <XDSTooltip content="Craft"><XDSButton- label="Attach"+ label="Craft"variant="ghost"size="sm"- isIconOnly- icon={<PlusIcon />}- />- <input- value={chatInput}- onChange={e => setChatInput(e.target.value)}- placeholder="What should we build?"- style={{- flex: 1,- border: 'none',- outline: 'none',- backgroundColor: 'transparent',- fontSize: 14,- color: 'inherit',- }}- />- <XDSButton- label="Send"- variant="primary"- size="sm"- isIconOnly- icon={<SendIcon />}- style={{borderRadius: 9999}}+ icon={<ArrowLeftIcon />}+ isIconOnly={!!showChat}+ onClick={onBack}+ style={{marginLeft: -8, flexShrink: 0}}/>- </div>+ </XDSTooltip>+ {showChat && (+ <div style={{display: 'flex', flex: 1}}>+ {(['properties', 'chat'] as const).map(tab => (+ <button+ key={tab}+ onClick={() => setPanelTab(tab)}+ style={{+ flex: 1,+ padding: '8px 0',+ background: 'none',+ border: 'none',+ borderBottom:+ panelTab === tab+ ? '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={panelTab === tab ? 'primary' : 'secondary'}>+ {tab === 'properties' ? 'Details' : 'Chat'}+ </XDSText>+ </button>+ ))}+ </div>+ )}</div>- ) : (- <>- {/* Template name */}- <XDSText type="display-2">{templateName}</XDSText>- {/* Description */}- <div style={{marginTop: 8}}>- <XDSText type="body" color="secondary">- Buttons are clickable elements that are used to trigger- actions. They communicate calls to action to the user and- allow users to interact with pages in a variety of ways.- Button labels express what action will occur when the user- interacts with it.- </XDSText>- </div>-- {/* Author section */}+ {/* Chat tab content */}+ {showChat && panelTab === 'chat' ? (<divstyle={{- marginTop: 16,display: 'flex',- flexDirection: 'row' as const,- alignItems: 'center',- gap: 12,+ flexDirection: 'column' as const,+ flex: 1,+ minHeight: 0,}}>- <XDSAvatar- size={36}- src="https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=80&h=80&fit=crop&crop=face"- />- <div style={{display: 'flex', flexDirection: 'column', gap: 0}}>- <XDSText type="supporting" color="secondary">- Crafted by- </XDSText>- <XDSText type="body" style={{fontWeight: 600, fontSize: 16}}>- Andrea Anderson- </XDSText>+ {/* Chat messages area */}+ <div style={{flex: 1, overflowY: 'auto' as const}}>+ {/* Welcome message bubble */}+ <div+ style={{+ backgroundColor: 'var(--color-background-body, #f1f4f7)',+ borderRadius: 12,+ padding: 12,+ }}>+ <XDSText type="body">+ Hi! I can help you customize this template. Try asking me+ to change colors, layout, or content.+ </XDSText>+ </div></div>- </div>- {/* Stats buttons */}- <div- style={{- display: 'flex',- alignItems: 'center',- justifyContent: 'space-between',- marginTop: 16,- marginLeft: -8,- marginRight: -8,- }}>- <div style={{display: 'flex', alignItems: 'center', gap: 4}}>+ {/* Composer pinned to bottom */}+ <div+ style={{+ borderTop: '1px solid var(--color-divider, #e0e0e0)',+ padding: 8,+ display: 'flex',+ alignItems: 'center',+ gap: 8,+ margin: '0 -32px -32px -32px',+ paddingInline: 32,+ paddingBottom: 32,+ }}><XDSButton- label="Link"+ label="Attach"variant="ghost"size="sm"isIconOnly- icon={<LinkIcon />}+ icon={<PlusIcon />}/>- <XDSDropdownMenu- button={{- label: 'Share',- variant: 'ghost',- size: 'sm',- isIconOnly: true,- icon: <PaperPlaneIcon />,+ <input+ value={chatInput}+ onChange={e => setChatInput(e.target.value)}+ placeholder="What should we build?"+ style={{+ flex: 1,+ border: 'none',+ outline: 'none',+ backgroundColor: 'transparent',+ fontSize: 14,+ color: 'inherit',}}- hasChevron={false}- menuWidth={220}- items={[- {- label: 'Copy CLI Command...',- icon: TerminalIcon,- onClick: () => {},- },- {type: 'divider' as const},- {- label: 'Claude Code',- icon: ClaudeIcon,- onClick: () => {},- },- {label: 'VSCode', icon: VSCodeIcon, onClick: () => {}},- {label: 'Cursor', icon: CursorAIIcon, onClick: () => {}},- ]}- />- </div>- <div style={{display: 'flex', alignItems: 'center', gap: 4}}>- <XDSButton- label="1,645"- variant="ghost"- size="sm"- icon={<HeartIcon />}/><XDSButton- label="892"- variant="ghost"+ label="Send"+ variant="primary"size="sm"- icon={<BookmarkIcon />}+ isIconOnly+ icon={<SendIcon />}+ style={{borderRadius: 9999}}/></div></div>+ ) : (+ <>+ {/* Template name */}+ <XDSText type="display-2">{templateName}</XDSText>- {/* CTA button */}- {!showEditor && (- <div style={{marginTop: 16}}>- <XDSButton- variant="primary"- label="Start crafting"- onClick={onUse}- size="lg"- style={{width: '100%'}}+ {/* Description */}+ <div style={{marginTop: 8}}>+ <XDSText type="body" color="secondary">+ Buttons are clickable elements that are used to trigger+ actions. They communicate calls to action to the user and+ allow users to interact with pages in a variety of ways.+ Button labels express what action will occur when the user+ interacts with it.+ </XDSText>+ </div>++ {/* Author section */}+ <div+ style={{+ marginTop: 16,+ display: 'flex',+ flexDirection: 'row' as const,+ alignItems: 'center',+ gap: 12,+ }}>+ <XDSAvatar+ size={36}+ src="https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=80&h=80&fit=crop&crop=face"/>+ <div+ style={{display: 'flex', flexDirection: 'column', gap: 0}}>+ <XDSText type="supporting" color="secondary">+ Crafted by+ </XDSText>+ <XDSText+ type="body"+ style={{fontWeight: 600, fontSize: 16}}>+ Andrea Anderson+ </XDSText>+ </div></div>- )}- {/* Themes */}- <div style={{marginTop: 32}}>- <XDSHeading level={4}>Themes</XDSHeading>+ {/* Stats buttons */}<divstyle={{- display: 'grid',- gridTemplateColumns: '1fr 1fr',- gap: 10,- marginTop: 8,+ display: 'flex',+ alignItems: 'center',+ justifyContent: 'space-between',+ marginTop: 16,+ marginLeft: -8,+ marginRight: -8,}}>- {PREVIEW_COLOR_PALETTES.map(palette => (+ <div style={{display: 'flex', alignItems: 'center', gap: 4}}>+ <XDSTooltip content="Copy link">+ <XDSButton+ label="Link"+ variant="ghost"+ size="sm"+ isIconOnly+ icon={+ linkCopied ? (+ <CheckIcon+ style={{+ strokeDasharray: 24,+ strokeDashoffset: 0,+ animation: 'checkDraw 0.3s ease-out',+ }}+ />+ ) : (+ <LinkIcon />+ )+ }+ onClick={() => {+ void navigator.clipboard.writeText(+ 'https://xds.dev/templates/' ++ templateName.toLowerCase().replace(/\s+/g, '-'),+ );+ setLinkCopied(true);+ setTimeout(() => setLinkCopied(false), 2000);+ }}+ />+ </XDSTooltip><div- key={palette.name}- onClick={() => setSelectedPalette(palette.name)}- style={{- cursor: 'pointer',- border: `2px solid ${selectedPalette === palette.name ? 'var(--color-accent, #0066FF)' : 'transparent'}`,- borderRadius: 14,- overflow: 'hidden',- transition: 'border-color 0.15s ease',- }}>- <XDSCard padding={0}>+ ref={sendPopoverRef}+ style={{position: 'relative' as const}}>+ <XDSTooltip content="Share">+ <XDSButton+ label="Share"+ variant="ghost"+ size="sm"+ isIconOnly+ icon={<ShareIcon />}+ onClick={() => {+ setShowSendPopover(prev => {+ if (!prev && sendPopoverRef.current) {+ const rect =+ sendPopoverRef.current.getBoundingClientRect();+ const popoverWidth = 340;+ const popoverHeight = 400;+ const left = Math.min(+ Math.max(8, rect.left),+ window.innerWidth - popoverWidth - 16,+ );+ const top =+ rect.bottom + 4 + popoverHeight + 16 >+ window.innerHeight+ ? rect.top - popoverHeight - 4+ : rect.bottom + 4;+ setSendPopoverPos({top, left});+ }+ return !prev;+ });+ }}+ />+ </XDSTooltip>+ {showSendPopover && sendPopoverPos && (<divstyle={{- display: 'flex',- overflow: 'hidden',- height: 48,+ position: 'fixed' as const,+ left: sendPopoverPos.left,+ top: sendPopoverPos.top,+ zIndex: 100,+ width: 340,+ backgroundColor:+ 'var(--color-background-card, #fff)',+ borderRadius: 12,+ boxShadow:+ '0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08)',+ padding: 20,}}>- {palette.colors.map((color, i) => (+ <XDSHeading level={4}>Add to your project</XDSHeading>+ <div style={{marginTop: 8}}>+ <XDSText type="body" color="secondary">+ Copy this snippet and paste it in your terminal to+ get started.+ </XDSText>+ </div>++ {/* Code block */}+ <div+ style={{+ position: 'relative' as const,+ backgroundColor: '#1a1a2e',+ borderRadius: 10,+ padding: '14px 16px',+ paddingRight: 44,+ marginTop: 12,+ }}>+ <code+ style={{+ color: '#fff',+ fontFamily: '"Roboto Mono", monospace',+ fontSize: 13,+ lineHeight: 1.5,+ wordBreak: 'break-all' as const,+ }}>+ {shareCliCommand}+ </code><div- key={i}style={{- flex: 1,- backgroundColor: color,- }}- />+ position: 'absolute' as const,+ top: 8,+ right: 8,+ }}>+ <XDSButton+ label={sendCopied ? 'Copied' : 'Copy'}+ variant="ghost"+ size="sm"+ isIconOnly+ icon={<CopyIcon />}+ style={{+ color: sendCopied ? '#4ade80' : '#fff',+ }}+ onClick={() => {+ navigator.clipboard.writeText(+ shareCliCommand,+ );+ setSendCopied(true);+ setTimeout(() => setSendCopied(false), 2000);+ }}+ />+ </div>+ </div>++ {/* Divider */}+ <div+ style={{+ height: 1,+ backgroundColor: 'var(--color-divider, #e0e0e0)',+ margin: '16px 0',+ }}+ />++ {/* IDE options */}+ <div style={{marginBottom: 8}}>+ <XDSText+ type="supporting"+ weight="semibold"+ color="secondary">+ Open in...+ </XDSText>+ </div>+ {[+ {+ label: 'Claude Code',+ Icon: ClaudeIcon,+ },+ {label: 'VSCode', Icon: VSCodeIcon},+ {label: 'Cursor', Icon: CursorAIIcon},+ ].map(item => (+ <div+ key={item.label}+ onClick={() => setShowSendPopover(false)}+ style={{+ display: 'flex',+ alignItems: 'center',+ gap: 10,+ padding: '8px 4px',+ cursor: 'pointer',+ borderRadius: 8,+ }}>+ <item.Icon+ style={{+ width: 18,+ height: 18,+ flexShrink: 0,+ }}+ />+ <XDSText type="body">{item.label}</XDSText>+ </div>))}</div>- </XDSCard>+ )}</div>- ))}+ </div>+ <div style={{display: 'flex', alignItems: 'center', gap: 4}}>+ <XDSTooltip content="Like">+ <XDSButton+ label={likeCount.toLocaleString()}+ variant="ghost"+ size="sm"+ icon={+ <HeartIcon+ fill={liked ? 'currentColor' : 'none'}+ style={liked ? {color: '#e5484d'} : undefined}+ />+ }+ style={liked ? {color: '#e5484d'} : undefined}+ onClick={() => {+ setLiked(prev => !prev);+ setLikeCount(prev => (liked ? prev - 1 : prev + 1));+ }}+ />+ </XDSTooltip>+ <XDSTooltip content="Bookmark">+ <XDSButton+ label={bookmarkCount.toLocaleString()}+ variant="ghost"+ size="sm"+ icon={+ <BookmarkIcon+ fill={bookmarked ? 'currentColor' : 'none'}+ style={+ bookmarked+ ? {+ color:+ 'var(--color-icon-highlight, #3b82f6)',+ }+ : undefined+ }+ />+ }+ style={+ bookmarked+ ? {color: 'var(--color-icon-highlight, #3b82f6)'}+ : undefined+ }+ onClick={() => {+ setBookmarked(prev => !prev);+ setBookmarkCount(prev =>+ bookmarked ? prev - 1 : prev + 1,+ );+ }}+ />+ </XDSTooltip>+ </div></div>- </div>- {/* Font packs — removed */}- <div style={{marginTop: 32, display: 'none'}}>- <XDSHeading level={4}>Font packs</XDSHeading>- <div- style={{- display: 'grid',- gridTemplateColumns: '1fr 1fr',- gap: 10,- marginTop: 8,- }}>- {PREVIEW_FONT_PACKS.map(pack => (- <div- key={pack.heading}- onClick={() => setSelectedFontPack(pack.heading)}- style={{- cursor: 'pointer',- border: `2px solid ${selectedFontPack === pack.heading ? 'var(--color-accent, #0066FF)' : 'transparent'}`,- borderRadius: 14,- overflow: 'hidden',- transition: 'border-color 0.15s ease',- }}>- <XDSCard padding={2}>- <div style={{fontFamily: pack.heading}}>- <XDSText- type="body"- style={{fontWeight: 600, fontSize: 16}}>- Heading- </XDSText>- </div>- <div style={{fontFamily: pack.paragraph}}>- <XDSText type="supporting" color="secondary">- Paragraph text- </XDSText>- </div>- </XDSCard>- </div>- ))}+ {/* CTA button */}+ {!showEditor && (+ <div style={{marginTop: 16}}>+ <XDSButton+ variant="primary"+ label="Start crafting"+ onClick={onUse}+ size="lg"+ style={{width: '100%'}}+ />+ </div>+ )}++ {/* Themes */}+ <div style={{marginTop: 32}}>+ <XDSHeading level={4}>Themes</XDSHeading>+ <div+ style={{+ display: 'grid',+ gridTemplateColumns: '1fr 1fr',+ gap: 10,+ marginTop: 8,+ }}>+ {PREVIEW_COLOR_PALETTES.map(palette => (+ <div+ key={palette.name}+ onClick={() => setSelectedPalette(palette.name)}+ style={{+ cursor: 'pointer',+ border: `2px solid ${selectedPalette === palette.name ? 'var(--color-accent, #0066FF)' : 'transparent'}`,+ borderRadius: 14,+ overflow: 'hidden',+ transition: 'border-color 0.15s ease',+ }}>+ <XDSCard padding={0}>+ <div+ style={{+ display: 'flex',+ overflow: 'hidden',+ height: 48,+ }}>+ {palette.colors.map((color, i) => (+ <div+ key={i}+ style={{+ flex: 1,+ backgroundColor: color,+ }}+ />+ ))}+ </div>+ </XDSCard>+ </div>+ ))}+ </div></div>- </div>- {/* Component used */}- <div style={{marginTop: 32}}>- <XDSHeading level={3}>Component used</XDSHeading>- <div- style={{- display: 'flex',- flexWrap: 'wrap' as const,- gap: 8,- marginTop: 8,- }}>- <XDSToken label="XDSAppShell" />- <XDSToken label="XDSTopNav" />- <XDSToken label="XDSVStack" />- <XDSToken label="XDSHStack" />- <XDSToken label="XDSHeading" />- <XDSToken label="XDSText" />- <XDSToken label="XDSButton" />- <XDSToken label="XDSCard" />- <XDSToken label="XDSBadge" />- <XDSToken label="XDSAvatar" />+ {/* Font packs — removed */}+ <div style={{marginTop: 32, display: 'none'}}>+ <XDSHeading level={4}>Font packs</XDSHeading>+ <div+ style={{+ display: 'grid',+ gridTemplateColumns: '1fr 1fr',+ gap: 10,+ marginTop: 8,+ }}>+ {PREVIEW_FONT_PACKS.map(pack => (+ <div+ key={pack.heading}+ onClick={() => setSelectedFontPack(pack.heading)}+ style={{+ cursor: 'pointer',+ border: `2px solid ${selectedFontPack === pack.heading ? 'var(--color-accent, #0066FF)' : 'transparent'}`,+ borderRadius: 14,+ overflow: 'hidden',+ transition: 'border-color 0.15s ease',+ }}>+ <XDSCard padding={2}>+ <div style={{fontFamily: pack.heading}}>+ <XDSText+ type="body"+ style={{fontWeight: 600, fontSize: 16}}>+ Heading+ </XDSText>+ </div>+ <div style={{fontFamily: pack.paragraph}}>+ <XDSText type="supporting" color="secondary">+ Paragraph text+ </XDSText>+ </div>+ </XDSCard>+ </div>+ ))}+ </div></div>- </div>- {/* Keywords */}- <div style={{marginTop: 32}}>- <XDSHeading level={3}>Keywords</XDSHeading>- <div- style={{- display: 'flex',- flexWrap: 'wrap' as const,- gap: 4,- marginTop: 8,- }}>- <XDSToken label="Dashboard" size="sm" />- <XDSToken label="Admin" size="sm" />- <XDSToken label="Layout" size="sm" />- <XDSToken label="Navigation" size="sm" />- <XDSToken label="Settings" size="sm" />+ {/* Component used */}+ <div style={{marginTop: 32}}>+ <XDSHeading level={3}>Component used</XDSHeading>+ <div+ style={{+ display: 'flex',+ flexWrap: 'wrap' as const,+ gap: 8,+ marginTop: 8,+ }}>+ <XDSToken label="XDSAppShell" />+ <XDSToken label="XDSTopNav" />+ <XDSToken label="XDSVStack" />+ <XDSToken label="XDSHStack" />+ <XDSToken label="XDSHeading" />+ <XDSToken label="XDSText" />+ <XDSToken label="XDSButton" />+ <XDSToken label="XDSCard" />+ <XDSToken label="XDSBadge" />+ <XDSToken label="XDSAvatar" />+ </div></div>- </div>- </>- )}++ {/* Keywords */}+ <div style={{marginTop: 32}}>+ <XDSHeading level={3}>Keywords</XDSHeading>+ <div+ style={{+ display: 'flex',+ flexWrap: 'wrap' as const,+ gap: 4,+ marginTop: 8,+ }}>+ <XDSToken label="Dashboard" size="sm" />+ <XDSToken label="Admin" size="sm" />+ <XDSToken label="Layout" size="sm" />+ <XDSToken label="Navigation" size="sm" />+ <XDSToken label="Settings" size="sm" />+ </div>+ </div>+ </>+ )}+ </div>+ {/* Inline publish panel — shown when publish is active */}+ <div+ style={{+ display: showPublishModal ? 'flex' : 'none',+ flexDirection: 'column' as const,+ flex: 1,+ }}>+ <InlinePublishPanel+ templateName={templateName}+ isVisible={showPublishModal}+ onBack={() => setShowPublishModal(false)}+ />+ </div></div></div>@@ -4576,89 +5029,242 @@ function TemplateFullPreview({}label="Viewport size"size="sm">- <XDSSegmentedControlItem- value="desktop"- label="Desktop"- isLabelHidden- icon={<DesktopIcon />}- />- <XDSSegmentedControlItem- value="mobile"- label="Mobile"- isLabelHidden- icon={<PhoneIcon />}- />+ <XDSTooltip content="Desktop">+ <XDSSegmentedControlItem+ value="desktop"+ label="Desktop"+ isLabelHidden+ icon={<DesktopIcon />}+ />+ </XDSTooltip>+ <XDSTooltip content="Mobile">+ <XDSSegmentedControlItem+ value="mobile"+ label="Mobile"+ isLabelHidden+ icon={<PhoneIcon />}+ />+ </XDSTooltip></XDSSegmentedControl>}endContent={<>- <XDSButton- label="Point"- variant="ghost"- isIconOnly- icon={<CursorIcon />}- />- <XDSDropdownMenu- button={{- label: 'Theme',- variant: 'ghost',- isIconOnly: true,- icon: <PaletteIcon />,+ <XDSTooltip content="Point">+ <XDSButton+ label="Point"+ variant="ghost"+ isIconOnly+ icon={<CursorIcon />}+ />+ </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="Toggle theme">+ <XDSButton+ label="Toggle theme"+ variant="ghost"+ isIconOnly+ icon={<ContrastIcon />}+ />+ </XDSTooltip>+ <XDSTooltip content="Toggle code">+ <XDSButton+ label="Toggle code"+ variant={editorView === 'code' ? 'secondary' : 'ghost'}+ isIconOnly+ icon={<CodeIcon />}+ onClick={() =>+ setEditorView(+ editorView === 'preview' ? 'code' : 'preview',+ )+ }+ />+ </XDSTooltip>+ <div+ style={{+ width: 1,+ height: 20,+ backgroundColor: 'var(--color-border-strong, #999)',+ margin: '0 4px',+ flexShrink: 0,}}- hasChevron={false}- items={XDS_THEMES.map(t => ({- label: t.label,- onClick: () => {},- }))}- />- <XDSButton- label="Toggle theme"- variant="ghost"- isIconOnly- icon={<ContrastIcon />}- />- <XDSButton- label="Toggle code"- variant={editorView === 'code' ? 'secondary' : 'ghost'}- isIconOnly- icon={<CodeIcon />}- onClick={() =>- setEditorView(- editorView === 'preview' ? 'code' : 'preview',- )- }/>+ <XDSTooltip content="Save">+ <XDSButton+ label="Save"+ variant="ghost"+ icon={<SaveIcon />}+ isIconOnly+ onClick={() => {}}+ />+ </XDSTooltip>+ <div+ ref={sharePopoverRef}+ style={{position: 'relative' as const}}>+ <XDSTooltip content="Share">+ <XDSButton+ label="Share"+ variant="ghost"+ isIconOnly+ icon={<ShareIcon />}+ ref={shareButtonRef}+ onClick={() => {+ setShowSharePopover(prev => {+ if (!prev && shareButtonRef.current) {+ const rect =+ shareButtonRef.current.getBoundingClientRect();+ const popoverWidth = 340;+ const popoverHeight = 400;+ const left = Math.min(+ Math.max(8, rect.right - popoverWidth),+ window.innerWidth - popoverWidth - 16,+ );+ const top =+ rect.bottom + 4 + popoverHeight + 16 >+ window.innerHeight+ ? rect.top - popoverHeight - 4+ : rect.bottom + 4;+ setSharePopoverPos({top, left});+ }+ return !prev;+ });+ }}+ />+ </XDSTooltip>+ {showSharePopover && sharePopoverPos && (+ <div+ style={{+ position: 'fixed' as const,+ left: sharePopoverPos.left,+ top: sharePopoverPos.top,+ zIndex: 100,+ width: 340,+ backgroundColor: 'var(--color-background-card, #fff)',+ borderRadius: 12,+ boxShadow:+ '0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08)',+ padding: 20,+ }}>+ <XDSHeading level={4}>Add to your project</XDSHeading>+ <div style={{marginTop: 8}}>+ <XDSText type="body" color="secondary">+ Copy this snippet and paste it in your terminal to+ get started.+ </XDSText>+ </div>++ {/* Code block */}+ <div+ style={{+ position: 'relative' as const,+ backgroundColor: '#1a1a2e',+ borderRadius: 10,+ padding: '14px 16px',+ paddingRight: 44,+ marginTop: 12,+ }}>+ <code+ style={{+ color: '#fff',+ fontFamily: '"Roboto Mono", monospace',+ fontSize: 13,+ lineHeight: 1.5,+ wordBreak: 'break-all' as const,+ }}>+ {shareCliCommand}+ </code>+ <div+ style={{+ position: 'absolute' as const,+ top: 8,+ right: 8,+ }}>+ <XDSButton+ label={shareCopied ? 'Copied' : 'Copy'}+ variant="ghost"+ size="sm"+ isIconOnly+ icon={<CopyIcon />}+ style={{+ color: shareCopied ? '#4ade80' : '#fff',+ }}+ onClick={() => {+ navigator.clipboard.writeText(shareCliCommand);+ setShareCopied(true);+ setTimeout(() => setShareCopied(false), 2000);+ }}+ />+ </div>+ </div>++ {/* Divider */}+ <div+ style={{+ height: 1,+ backgroundColor: 'var(--color-divider, #e0e0e0)',+ margin: '16px 0',+ }}+ />++ {/* IDE options */}+ <div style={{marginBottom: 8}}>+ <XDSText+ type="supporting"+ weight="semibold"+ color="secondary">+ Open in...+ </XDSText>+ </div>+ {[+ {+ label: 'Claude Code',+ Icon: ClaudeIcon,+ },+ {label: 'VSCode', Icon: VSCodeIcon},+ {label: 'Cursor', Icon: CursorAIIcon},+ ].map(item => (+ <div+ key={item.label}+ onClick={() => setShowSharePopover(false)}+ style={{+ display: 'flex',+ alignItems: 'center',+ gap: 10,+ padding: '8px 4px',+ cursor: 'pointer',+ borderRadius: 8,+ }}>+ <item.Icon+ style={{+ width: 18,+ height: 18,+ flexShrink: 0,+ }}+ />+ <XDSText type="body">{item.label}</XDSText>+ </div>+ ))}+ </div>+ )}+ </div><XDSButton- label="Save"- variant="ghost"- icon={<SaveIcon />}- isIconOnly- onClick={() => {}}- />- <XDSDropdownMenu- button={{- label: 'Share',- variant: 'ghost',- isIconOnly: true,- icon: <PaperPlaneIcon />,- }}- hasChevron={false}- menuWidth={220}- items={[- {- label: 'Copy CLI Command...',- icon: TerminalIcon,- onClick: () => {},- },- {type: 'divider' as const},- {- label: 'Claude Code',- icon: ClaudeIcon,- onClick: () => {},- },- {label: 'VSCode', icon: VSCodeIcon, onClick: () => {}},- {label: 'Cursor', icon: CursorAIIcon, onClick: () => {}},- ]}+ label="Publish"+ variant="primary"+ size="sm"+ onClick={() => setShowPublishModal(true)}/></>}@@ -4772,9 +5378,9 @@ function TemplateFullPreview({{/* Code block */}<divstyle={{- margin: 0,- border: 'none',- borderRadius: 0,+ margin: '0 22px',+ border: '1px solid var(--color-divider, rgba(0,0,0,0.1))',+ borderRadius: 8,backgroundColor: 'var(--color-background-muted, rgba(0,0,0,0.03))',overflow: 'auto',flex: 1,@@ -4887,7 +5493,7 @@ function TemplateFullPreview({// TemplateCombinedView — preview + customization + chat in one view// ----------------------------------------------------------------------------function TemplateCombinedView({+function _TemplateCombinedView({templateName,imageSrc,onBack,@@ -4910,6 +5516,21 @@ function TemplateCombinedView({const [isVisible, setIsVisible] = useState(false);const [chatPrompt, setChatPrompt] = useState('');const [rightPanelTab, setRightPanelTab] = useState('properties');+ const [showSendPopover, setShowSendPopover] = useState(false);+ const [sendPopoverPos, setSendPopoverPos] = useState<{+ top: number;+ left: number;+ } | null>(null);+ const [sendCopied, setSendCopied] = useState(false);+ const [linkCopied, setLinkCopied] = useState(false);+ const [liked, setLiked] = useState(false);+ const [likeCount, setLikeCount] = useState(1645);+ const [bookmarked, setBookmarked] = useState(false);+ const [bookmarkCount, setBookmarkCount] = useState(892);+ const sendPopoverRef = useRef<HTMLDivElement>(null);+ const statsSendPopoverRef = useRef<HTMLDivElement>(null);++ const shareCliCommand = `npx xds template ${templateName.toLowerCase().replace(/\s+/g, '-')} ./my-project`;useEffect(() => {requestAnimationFrame(() => {@@ -4917,6 +5538,22 @@ function TemplateCombinedView({});}, []);+ useEffect(() => {+ if (!showSendPopover) return;+ const handleClickOutside = (e: MouseEvent) => {+ const target = e.target as Node;+ if (+ sendPopoverRef.current?.contains(target) ||+ statsSendPopoverRef.current?.contains(target)+ ) {+ return;+ }+ setShowSendPopover(false);+ };+ document.addEventListener('mousedown', handleClickOutside);+ return () => document.removeEventListener('mousedown', handleClickOutside);+ }, [showSendPopover]);+return (<div style={{display: 'flex', height: '100vh', overflow: 'hidden'}}>{/* LEFT PANEL — preview area (~70%) */}@@ -4967,29 +5604,154 @@ function TemplateCombinedView({icon={<PhoneIcon />}/></XDSSegmentedControl>- <div style={{justifySelf: 'end'}}>- <XDSDropdownMenu- button={{- label: 'Share',- variant: 'ghost',- size: 'sm',- isIconOnly: true,- icon: <PaperPlaneIcon />,- }}- hasChevron={false}- menuWidth={220}- items={[- {- label: 'Copy CLI Command...',- icon: TerminalIcon,- onClick: () => {},- },- {type: 'divider' as const},- {label: 'Claude Code', icon: ClaudeIcon, onClick: () => {}},- {label: 'VSCode', icon: VSCodeIcon, onClick: () => {}},- {label: 'Cursor', icon: CursorAIIcon, onClick: () => {}},- ]}- />+ <div+ ref={sendPopoverRef}+ style={{justifySelf: 'end', position: 'relative' as const}}>+ <XDSTooltip content="Share">+ <XDSButton+ label="Share"+ variant="ghost"+ size="sm"+ isIconOnly+ icon={<ShareIcon />}+ onClick={() => {+ setShowSendPopover(prev => {+ if (!prev && sendPopoverRef.current) {+ const rect =+ sendPopoverRef.current.getBoundingClientRect();+ const popoverWidth = 340;+ const popoverHeight = 400;+ const left = Math.min(+ Math.max(8, rect.right - popoverWidth),+ window.innerWidth - popoverWidth - 16,+ );+ const top =+ rect.bottom + 4 + popoverHeight + 16 >+ window.innerHeight+ ? rect.top - popoverHeight - 4+ : rect.bottom + 4;+ setSendPopoverPos({top, left});+ }+ return !prev;+ });+ }}+ />+ </XDSTooltip>+ {showSendPopover && sendPopoverPos && (+ <div+ style={{+ position: 'fixed' as const,+ left: sendPopoverPos.left,+ top: sendPopoverPos.top,+ zIndex: 100,+ width: 340,+ backgroundColor: 'var(--color-background-card, #fff)',+ borderRadius: 12,+ boxShadow:+ '0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08)',+ padding: 20,+ }}>+ <XDSHeading level={4}>Add to your project</XDSHeading>+ <div style={{marginTop: 8}}>+ <XDSText type="body" color="secondary">+ Copy this snippet and paste it in your terminal to get+ started.+ </XDSText>+ </div>++ {/* Code block */}+ <div+ style={{+ position: 'relative' as const,+ backgroundColor: '#1a1a2e',+ borderRadius: 10,+ padding: '14px 16px',+ paddingRight: 44,+ marginTop: 12,+ }}>+ <code+ style={{+ color: '#fff',+ fontFamily: '"Roboto Mono", monospace',+ fontSize: 13,+ lineHeight: 1.5,+ wordBreak: 'break-all' as const,+ }}>+ {shareCliCommand}+ </code>+ <div+ style={{+ position: 'absolute' as const,+ top: 8,+ right: 8,+ }}>+ <XDSButton+ label={sendCopied ? 'Copied' : 'Copy'}+ variant="ghost"+ size="sm"+ isIconOnly+ icon={<CopyIcon />}+ style={{+ color: sendCopied ? '#4ade80' : '#fff',+ }}+ onClick={() => {+ navigator.clipboard.writeText(shareCliCommand);+ setSendCopied(true);+ setTimeout(() => setSendCopied(false), 2000);+ }}+ />+ </div>+ </div>++ {/* Divider */}+ <div+ style={{+ height: 1,+ backgroundColor: 'var(--color-divider, #e0e0e0)',+ margin: '16px 0',+ }}+ />++ {/* IDE options */}+ <div style={{marginBottom: 8}}>+ <XDSText+ type="supporting"+ weight="semibold"+ color="secondary">+ Open in...+ </XDSText>+ </div>+ {[+ {+ label: 'Claude Code',+ Icon: ClaudeIcon,+ },+ {label: 'VSCode', Icon: VSCodeIcon},+ {label: 'Cursor', Icon: CursorAIIcon},+ ].map(item => (+ <div+ key={item.label}+ onClick={() => setShowSendPopover(false)}+ style={{+ display: 'flex',+ alignItems: 'center',+ gap: 10,+ padding: '8px 4px',+ cursor: 'pointer',+ borderRadius: 8,+ }}>+ <item.Icon+ style={{+ width: 18,+ height: 18,+ flexShrink: 0,+ }}+ />+ <XDSText type="body">{item.label}</XDSText>+ </div>+ ))}+ </div>+ )}</div></div>@@ -5140,52 +5902,227 @@ function TemplateCombinedView({marginRight: -8,}}><div style={{display: 'flex', alignItems: 'center', gap: 4}}>- <XDSButton- label="Link"- variant="ghost"- size="sm"- isIconOnly- icon={<LinkIcon />}- />- <XDSDropdownMenu- button={{- label: 'Share',- variant: 'ghost',- size: 'sm',- isIconOnly: true,- icon: <PaperPlaneIcon />,- }}- hasChevron={false}- menuWidth={220}- items={[- {- label: 'Copy CLI Command...',- icon: TerminalIcon,- onClick: () => {},- },- {type: 'divider' as const},- {- label: 'Claude Code',- icon: ClaudeIcon,- onClick: () => {},- },- {label: 'VSCode', icon: VSCodeIcon, onClick: () => {}},- {label: 'Cursor', icon: CursorAIIcon, onClick: () => {}},- ]}- />+ <XDSTooltip content="Copy link">+ <XDSButton+ label="Link"+ variant="ghost"+ size="sm"+ isIconOnly+ icon={+ linkCopied ? (+ <CheckIcon+ style={{+ strokeDasharray: 24,+ strokeDashoffset: 0,+ animation: 'checkDraw 0.3s ease-out',+ }}+ />+ ) : (+ <LinkIcon />+ )+ }+ onClick={() => {+ void navigator.clipboard.writeText(+ 'https://xds.dev/templates/' ++ templateName.toLowerCase().replace(/\s+/g, '-'),+ );+ setLinkCopied(true);+ setTimeout(() => setLinkCopied(false), 2000);+ }}+ />+ </XDSTooltip>+ <div+ ref={statsSendPopoverRef}+ style={{position: 'relative' as const}}>+ <XDSTooltip content="Share">+ <XDSButton+ label="Share"+ variant="ghost"+ size="sm"+ isIconOnly+ icon={<ShareIcon />}+ onClick={() => {+ setShowSendPopover(prev => {+ if (!prev && statsSendPopoverRef.current) {+ const rect =+ statsSendPopoverRef.current.getBoundingClientRect();+ const popoverWidth = 340;+ const popoverHeight = 400;+ const left = Math.min(+ Math.max(8, rect.left),+ window.innerWidth - popoverWidth - 16,+ );+ const top =+ rect.bottom + 4 + popoverHeight + 16 >+ window.innerHeight+ ? rect.top - popoverHeight - 4+ : rect.bottom + 4;+ setSendPopoverPos({top, left});+ }+ return !prev;+ });+ }}+ />+ </XDSTooltip>+ {showSendPopover && sendPopoverPos && (+ <div+ style={{+ position: 'fixed' as const,+ left: sendPopoverPos.left,+ top: sendPopoverPos.top,+ zIndex: 100,+ width: 340,+ backgroundColor: 'var(--color-background-card, #fff)',+ borderRadius: 12,+ boxShadow:+ '0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08)',+ padding: 20,+ }}>+ <XDSHeading level={4}>Add to your project</XDSHeading>+ <div style={{marginTop: 8}}>+ <XDSText type="body" color="secondary">+ Copy this snippet and paste it in your terminal to+ get started.+ </XDSText>+ </div>++ {/* Code block */}+ <div+ style={{+ position: 'relative' as const,+ backgroundColor: '#1a1a2e',+ borderRadius: 10,+ padding: '14px 16px',+ paddingRight: 44,+ marginTop: 12,+ }}>+ <code+ style={{+ color: '#fff',+ fontFamily: '"Roboto Mono", monospace',+ fontSize: 13,+ lineHeight: 1.5,+ wordBreak: 'break-all' as const,+ }}>+ {shareCliCommand}+ </code>+ <div+ style={{+ position: 'absolute' as const,+ top: 8,+ right: 8,+ }}>+ <XDSButton+ label={sendCopied ? 'Copied' : 'Copy'}+ variant="ghost"+ size="sm"+ isIconOnly+ icon={<CopyIcon />}+ style={{+ color: sendCopied ? '#4ade80' : '#fff',+ }}+ onClick={() => {+ navigator.clipboard.writeText(shareCliCommand);+ setSendCopied(true);+ setTimeout(() => setSendCopied(false), 2000);+ }}+ />+ </div>+ </div>++ {/* Divider */}+ <div+ style={{+ height: 1,+ backgroundColor: 'var(--color-divider, #e0e0e0)',+ margin: '16px 0',+ }}+ />++ {/* IDE options */}+ <div style={{marginBottom: 8}}>+ <XDSText+ type="supporting"+ weight="semibold"+ color="secondary">+ Open in...+ </XDSText>+ </div>+ {[+ {+ label: 'Claude Code',+ Icon: ClaudeIcon,+ },+ {label: 'VSCode', Icon: VSCodeIcon},+ {label: 'Cursor', Icon: CursorAIIcon},+ ].map(item => (+ <div+ key={item.label}+ onClick={() => setShowSendPopover(false)}+ style={{+ display: 'flex',+ alignItems: 'center',+ gap: 10,+ padding: '8px 4px',+ cursor: 'pointer',+ borderRadius: 8,+ }}>+ <item.Icon+ style={{+ width: 18,+ height: 18,+ flexShrink: 0,+ }}+ />+ <XDSText type="body">{item.label}</XDSText>+ </div>+ ))}+ </div>+ )}+ </div></div><div style={{display: 'flex', alignItems: 'center', gap: 4}}><XDSButton- label="1,645"+ label={likeCount.toLocaleString()}variant="ghost"size="sm"- icon={<HeartIcon />}+ icon={+ <HeartIcon+ fill={liked ? 'currentColor' : 'none'}+ style={liked ? {color: '#e5484d'} : undefined}+ />+ }+ style={liked ? {color: '#e5484d'} : undefined}+ onClick={() => {+ setLiked(prev => !prev);+ setLikeCount(prev => (liked ? prev - 1 : prev + 1));+ }}/><XDSButton- label="892"+ label={bookmarkCount.toLocaleString()}variant="ghost"size="sm"- icon={<BookmarkIcon />}+ icon={+ <BookmarkIcon+ fill={bookmarked ? 'currentColor' : 'none'}+ style={+ bookmarked+ ? {color: 'var(--color-icon-highlight, #3b82f6)'}+ : undefined+ }+ />+ }+ style={+ bookmarked+ ? {color: 'var(--color-icon-highlight, #3b82f6)'}+ : undefined+ }+ onClick={() => {+ setBookmarked(prev => !prev);+ setBookmarkCount(prev =>+ bookmarked ? prev - 1 : prev + 1,+ );+ }}/></div></div>@@ -5390,9 +6327,9 @@ function TemplateCombinedView({// ---------------------------------------------------------------------------export default function DocsiteLandingTemplate() {- const [activeView, setActiveView] = useState<- 'craft' | 'library' | 'learn' | 'profile'- >('craft');+ const [activeView, setActiveView] = useState<'craft' | 'library' | 'profile'>(+ 'craft',+ );const [selected, setSelected] = useState<Set<number>>(new Set());const [isMobile, setIsMobile] = useState(false);const [isTablet, setIsTablet] = useState(false);@@ -5559,6 +6496,28 @@ export default function DocsiteLandingTemplate() {);}+ // Customize flow for 2nd card (index 1) — opens with chat tab+ if (useTarget === 1 && activeView === 'craft') {+ const t = TEMPLATES[1];+ return (+ <TemplateFullPreview+ templateName={t.name}+ imageSrc={t.src}+ onBack={() => {+ setUseTarget(null);+ setChatOpen(false);+ }}+ onUse={() => {}}+ onSelectTemplate={index => {+ setPreviewTarget(index);+ }}+ showChat+ showEditor+ defaultTab="chat"+ />+ );+ }+// Editor flow for non-2nd cards that went through preview → useif (useTarget !== null && useTarget !== 1 && activeView === 'craft') {const t = TEMPLATES[useTarget % TEMPLATES.length];@@ -5579,9 +6538,8 @@ export default function DocsiteLandingTemplate() {animation: 'slideInLeft 500ms cubic-bezier(0.16, 1, 0.3, 1)',}}><style>- {- '@keyframes slideInLeft { from { opacity: 0; transform: translateX(-40px); } to { opacity: 1; transform: translateX(0); } }'- }+ {'@keyframes slideInLeft { from { opacity: 0; transform: translateX(-40px); } to { opacity: 1; transform: translateX(0); } }' ++ '@keyframes checkDraw { from { stroke-dashoffset: 24; } to { stroke-dashoffset: 0; } }'}</style><divstyle={{@@ -5643,47 +6601,6 @@ export default function DocsiteLandingTemplate() {return <DocsView activeView={activeView} setActiveView={setActiveView} />;}- if (activeView === 'learn') {- return (- <div- style={{- display: 'flex',- flexDirection: 'column',- height: '100vh',- backgroundColor: 'var(--color-background-card, white)',- }}>- <div- style={{- display: 'flex',- alignItems: 'center',- justifyContent: 'space-between',- padding: '12px 24px',- borderBottom: '1px solid var(--color-border-default, #e0e0e0)',- backgroundColor: 'var(--color-background-card, white)',- }}>- <LogoNav activeView={activeView} setActiveView={setActiveView} />- </div>- <div- style={{- flex: 1,- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- }}>- <div style={{textAlign: 'center', opacity: 0.5}}>- <div style={{fontSize: 48, marginBottom: 16}}>📚</div>- <div style={{marginBottom: 8}}>- <XDSHeading level={3}>Learn</XDSHeading>- </div>- <XDSText type="body" color="secondary">- Tutorials, guides, and resources — coming soon- </XDSText>- </div>- </div>- </div>- );- }-if (activeView === 'profile') {return (<ProfileView activeView={activeView} setActiveView={setActiveView} />