An open source design system that's fully customizable and agent ready
TypeScript
fix(sandbox): polish docsite component tab and fix tab switching perf (#1632)
rubyycheungb76442b0622d
diff --git a/apps/sandbox/public/templates/ChatGPT Web 120.png b/apps/sandbox/public/docsite/ChatGPT Web 120.pngsimilarity index 100%rename from apps/sandbox/public/templates/ChatGPT Web 120.pngrename to apps/sandbox/public/docsite/ChatGPT Web 120.pngdiff --git a/apps/sandbox/public/templates/ChatGPT Web 122.png b/apps/sandbox/public/docsite/ChatGPT Web 122.pngsimilarity index 100%rename from apps/sandbox/public/templates/ChatGPT Web 122.pngrename to apps/sandbox/public/docsite/ChatGPT Web 122.pngdiff --git a/apps/sandbox/public/templates/ChatGPT Web 140.png b/apps/sandbox/public/docsite/ChatGPT Web 140.pngsimilarity index 100%rename from apps/sandbox/public/templates/ChatGPT Web 140.pngrename to apps/sandbox/public/docsite/ChatGPT Web 140.pngdiff --git a/apps/sandbox/public/templates/ChatGPT Web 22.png b/apps/sandbox/public/docsite/ChatGPT Web 22.pngsimilarity index 100%rename from apps/sandbox/public/templates/ChatGPT Web 22.pngrename to apps/sandbox/public/docsite/ChatGPT Web 22.pngdiff --git a/apps/sandbox/public/templates/apple-logo.png b/apps/sandbox/public/docsite/apple-logo.pngsimilarity index 100%rename from apps/sandbox/public/templates/apple-logo.pngrename to apps/sandbox/public/docsite/apple-logo.pngdiff --git a/apps/sandbox/public/docsite/card4-carousel-daily.png b/apps/sandbox/public/docsite/card4-carousel-daily.pngnew file mode 100644index 0000000000..a7e5823a85Binary files /dev/null and b/apps/sandbox/public/docsite/card4-carousel-daily.png differdiff --git a/apps/sandbox/public/docsite/card4-carousel-default.png b/apps/sandbox/public/docsite/card4-carousel-default.pngnew file mode 100644index 0000000000..5786105df2Binary files /dev/null and b/apps/sandbox/public/docsite/card4-carousel-default.png differdiff --git a/apps/sandbox/public/docsite/card4-carousel-meta.png b/apps/sandbox/public/docsite/card4-carousel-meta.pngnew file mode 100644index 0000000000..fd470ef038Binary files /dev/null and b/apps/sandbox/public/docsite/card4-carousel-meta.png differdiff --git a/apps/sandbox/public/docsite/card4-grid-daily.png b/apps/sandbox/public/docsite/card4-grid-daily.pngnew file mode 100644index 0000000000..725c142d97Binary files /dev/null and b/apps/sandbox/public/docsite/card4-grid-daily.png differdiff --git a/apps/sandbox/public/docsite/card4-grid-default.png b/apps/sandbox/public/docsite/card4-grid-default.pngnew file mode 100644index 0000000000..dd3c78b65aBinary files /dev/null and b/apps/sandbox/public/docsite/card4-grid-default.png differdiff --git a/apps/sandbox/public/docsite/card4-grid-meta.png b/apps/sandbox/public/docsite/card4-grid-meta.pngnew file mode 100644index 0000000000..832a904680Binary files /dev/null and b/apps/sandbox/public/docsite/card4-grid-meta.png differdiff --git a/apps/sandbox/public/docsite/card4-hero-daily.png b/apps/sandbox/public/docsite/card4-hero-daily.pngnew file mode 100644index 0000000000..7ec4717219Binary files /dev/null and b/apps/sandbox/public/docsite/card4-hero-daily.png differdiff --git a/apps/sandbox/public/docsite/card4-hero-default.png b/apps/sandbox/public/docsite/card4-hero-default.pngnew file mode 100644index 0000000000..727d56a2e5Binary files /dev/null and b/apps/sandbox/public/docsite/card4-hero-default.png differdiff --git a/apps/sandbox/public/docsite/card4-hero-meta.png b/apps/sandbox/public/docsite/card4-hero-meta.pngnew file mode 100644index 0000000000..4895b89989Binary files /dev/null and b/apps/sandbox/public/docsite/card4-hero-meta.png differdiff --git a/apps/sandbox/public/docsite/card4-preview-daily.png b/apps/sandbox/public/docsite/card4-preview-daily.pngnew file mode 100644index 0000000000..157f56be6eBinary files /dev/null and b/apps/sandbox/public/docsite/card4-preview-daily.png differdiff --git a/apps/sandbox/public/docsite/card4-preview-default.png b/apps/sandbox/public/docsite/card4-preview-default.pngnew file mode 100644index 0000000000..efb4f3573dBinary files /dev/null and b/apps/sandbox/public/docsite/card4-preview-default.png differdiff --git a/apps/sandbox/public/docsite/card4-preview-meta.png b/apps/sandbox/public/docsite/card4-preview-meta.pngnew file mode 100644index 0000000000..fe38bcfd66Binary files /dev/null and b/apps/sandbox/public/docsite/card4-preview-meta.png differdiff --git a/apps/sandbox/public/docsite/card4-preview.png b/apps/sandbox/public/docsite/card4-preview.pngnew file mode 100644index 0000000000..efb4f3573dBinary files /dev/null and b/apps/sandbox/public/docsite/card4-preview.png differdiff --git a/apps/sandbox/public/templates/card4-related-1.png b/apps/sandbox/public/docsite/card4-related-1.pngsimilarity index 100%rename from apps/sandbox/public/templates/card4-related-1.pngrename to apps/sandbox/public/docsite/card4-related-1.pngdiff --git a/apps/sandbox/public/templates/card4-related-2.png b/apps/sandbox/public/docsite/card4-related-2.pngsimilarity index 100%rename from apps/sandbox/public/templates/card4-related-2.pngrename to apps/sandbox/public/docsite/card4-related-2.pngdiff --git a/apps/sandbox/public/templates/card4-related-3.png b/apps/sandbox/public/docsite/card4-related-3.pngsimilarity index 100%rename from apps/sandbox/public/templates/card4-related-3.pngrename to apps/sandbox/public/docsite/card4-related-3.pngdiff --git a/apps/sandbox/public/templates/card4-related-4.png b/apps/sandbox/public/docsite/card4-related-4.pngsimilarity index 100%rename from apps/sandbox/public/templates/card4-related-4.pngrename to apps/sandbox/public/docsite/card4-related-4.pngdiff --git a/apps/sandbox/public/docsite/card4-split-daily.png b/apps/sandbox/public/docsite/card4-split-daily.pngnew file mode 100644index 0000000000..61080e7c13Binary files /dev/null and b/apps/sandbox/public/docsite/card4-split-daily.png differdiff --git a/apps/sandbox/public/docsite/card4-split-default.png b/apps/sandbox/public/docsite/card4-split-default.pngnew file mode 100644index 0000000000..53dc97a994Binary files /dev/null and b/apps/sandbox/public/docsite/card4-split-default.png differdiff --git a/apps/sandbox/public/docsite/card4-split-meta.png b/apps/sandbox/public/docsite/card4-split-meta.pngnew file mode 100644index 0000000000..92bd8770edBinary files /dev/null and b/apps/sandbox/public/docsite/card4-split-meta.png differdiff --git a/apps/sandbox/public/templates/colorful-home-vertical-3.png b/apps/sandbox/public/docsite/colorful-home-vertical-3.pngsimilarity index 100%rename from apps/sandbox/public/templates/colorful-home-vertical-3.pngrename to apps/sandbox/public/docsite/colorful-home-vertical-3.pngdiff --git a/apps/sandbox/public/templates/colorful-working-horizontal-1.png b/apps/sandbox/public/docsite/colorful-working-horizontal-1.pngsimilarity index 100%rename from apps/sandbox/public/templates/colorful-working-horizontal-1.pngrename to apps/sandbox/public/docsite/colorful-working-horizontal-1.pngdiff --git a/apps/sandbox/public/templates/dummy-placeholder.png b/apps/sandbox/public/docsite/dummy-placeholder.pngsimilarity index 100%rename from apps/sandbox/public/templates/dummy-placeholder.pngrename to apps/sandbox/public/docsite/dummy-placeholder.pngdiff --git a/apps/sandbox/public/templates/first-card.png b/apps/sandbox/public/docsite/first-card.pngsimilarity index 100%rename from apps/sandbox/public/templates/first-card.pngrename to apps/sandbox/public/docsite/first-card.pngdiff --git a/apps/sandbox/public/templates/google-logo.png b/apps/sandbox/public/docsite/google-logo.pngsimilarity index 100%rename from apps/sandbox/public/templates/google-logo.pngrename to apps/sandbox/public/docsite/google-logo.pngdiff --git a/apps/sandbox/public/templates/light-working-vertical-1.png b/apps/sandbox/public/docsite/light-working-vertical-1.pngsimilarity index 100%rename from apps/sandbox/public/templates/light-working-vertical-1.pngrename to apps/sandbox/public/docsite/light-working-vertical-1.pngdiff --git a/apps/sandbox/public/templates/login-split-cover.png b/apps/sandbox/public/docsite/login-split-cover.pngsimilarity index 100%rename from apps/sandbox/public/templates/login-split-cover.pngrename to apps/sandbox/public/docsite/login-split-cover.pngdiff --git a/apps/sandbox/public/templates/more-like-this-1-meta.png b/apps/sandbox/public/docsite/more-like-this-1-meta.pngsimilarity index 100%rename from apps/sandbox/public/templates/more-like-this-1-meta.pngrename to apps/sandbox/public/docsite/more-like-this-1-meta.pngdiff --git a/apps/sandbox/public/templates/more-like-this-1.png b/apps/sandbox/public/docsite/more-like-this-1.pngsimilarity index 100%rename from apps/sandbox/public/templates/more-like-this-1.pngrename to apps/sandbox/public/docsite/more-like-this-1.pngdiff --git a/apps/sandbox/public/templates/more-like-this-2-meta.png b/apps/sandbox/public/docsite/more-like-this-2-meta.pngsimilarity index 100%rename from apps/sandbox/public/templates/more-like-this-2-meta.pngrename to apps/sandbox/public/docsite/more-like-this-2-meta.pngdiff --git a/apps/sandbox/public/templates/more-like-this-2.png b/apps/sandbox/public/docsite/more-like-this-2.pngsimilarity index 100%rename from apps/sandbox/public/templates/more-like-this-2.pngrename to apps/sandbox/public/docsite/more-like-this-2.pngdiff --git a/apps/sandbox/public/templates/more-like-this-3-meta.png b/apps/sandbox/public/docsite/more-like-this-3-meta.pngsimilarity index 100%rename from apps/sandbox/public/templates/more-like-this-3-meta.pngrename to apps/sandbox/public/docsite/more-like-this-3-meta.pngdiff --git a/apps/sandbox/public/templates/more-like-this-3.png b/apps/sandbox/public/docsite/more-like-this-3.pngsimilarity index 100%rename from apps/sandbox/public/templates/more-like-this-3.pngrename to apps/sandbox/public/docsite/more-like-this-3.pngdiff --git a/apps/sandbox/public/templates/more-like-this-4-meta.png b/apps/sandbox/public/docsite/more-like-this-4-meta.pngsimilarity index 100%rename from apps/sandbox/public/templates/more-like-this-4-meta.pngrename to apps/sandbox/public/docsite/more-like-this-4-meta.pngdiff --git a/apps/sandbox/public/templates/more-like-this-4.png b/apps/sandbox/public/docsite/more-like-this-4.pngsimilarity index 100%rename from apps/sandbox/public/templates/more-like-this-4.pngrename to apps/sandbox/public/docsite/more-like-this-4.pngdiff --git a/apps/sandbox/public/templates/screenshot-3.png b/apps/sandbox/public/docsite/screenshot-3.pngsimilarity index 100%rename from apps/sandbox/public/templates/screenshot-3.pngrename to apps/sandbox/public/docsite/screenshot-3.pngdiff --git a/apps/sandbox/public/templates/shopping-details.png b/apps/sandbox/public/docsite/shopping-details.pngsimilarity index 100%rename from apps/sandbox/public/templates/shopping-details.pngrename to apps/sandbox/public/docsite/shopping-details.pngdiff --git a/apps/sandbox/public/templates/theme-preview-daily.png b/apps/sandbox/public/docsite/theme-preview-daily.pngsimilarity index 100%rename from apps/sandbox/public/templates/theme-preview-daily.pngrename to apps/sandbox/public/docsite/theme-preview-daily.pngdiff --git a/apps/sandbox/public/templates/theme-preview-forest.png b/apps/sandbox/public/docsite/theme-preview-forest.pngsimilarity index 100%rename from apps/sandbox/public/templates/theme-preview-forest.pngrename to apps/sandbox/public/docsite/theme-preview-forest.pngdiff --git a/apps/sandbox/public/templates/theme-preview-midnight.png b/apps/sandbox/public/docsite/theme-preview-midnight.pngsimilarity index 100%rename from apps/sandbox/public/templates/theme-preview-midnight.pngrename to apps/sandbox/public/docsite/theme-preview-midnight.pngdiff --git a/apps/sandbox/public/templates/theme-preview.png b/apps/sandbox/public/docsite/theme-preview.pngsimilarity index 100%rename from apps/sandbox/public/templates/theme-preview.pngrename to apps/sandbox/public/docsite/theme-preview.pngdiff --git a/apps/sandbox/public/templates/card4-preview-meta.png b/apps/sandbox/public/templates/card4-preview-meta.pngdeleted file mode 100644index d13c353d4a..0000000000Binary files a/apps/sandbox/public/templates/card4-preview-meta.png and /dev/null differdiff --git a/apps/sandbox/public/templates/card4-preview.png b/apps/sandbox/public/templates/card4-preview.pngdeleted file mode 100644index fe0a22f856..0000000000Binary files a/apps/sandbox/public/templates/card4-preview.png and /dev/null differdiff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/AppTopNav.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/AppTopNav.tsxindex 48ca649316..cf5a7e5b79 100644--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/AppTopNav.tsx+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/AppTopNav.tsx@@ -86,7 +86,7 @@ export function AppTopNav({}, []);const headingMenu = (- <XDSList density="spacious" style={{minWidth: 240}}>+ <XDSList density="spacious" style={{width: 240}}><XDSListItem label="Craft" onClick={() => setActiveView('craft')} /><XDSListItem label="Library" onClick={() => setActiveView('docs')} /></XDSList>diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/ChatPanel.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/ChatPanel.tsxindex 4848133b69..77001f3be3 100644--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/ChatPanel.tsx+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/ChatPanel.tsx@@ -1,7 +1,7 @@'use client';import * as stylex from '@stylexjs/stylex';-import React, {useState} from 'react';+import React, {useState, useEffect, useRef} from 'react';import {XDSButton} from '@xds/core/Button';import {XDSChatComposer,@@ -14,7 +14,8 @@ import {XDSDivider} from '@xds/core/Divider';import {XDSEmptyState} from '@xds/core/EmptyState';import {XDSMetadataList, XDSMetadataListItem} from '@xds/core/MetadataList';import {XDSText} from '@xds/core/Text';-import {ArrowLeftIcon} from './docsite-icons';+import {XDSTextInput} from '@xds/core/TextInput';+import {ArrowLeftIcon, CursorIcon, SparklesIcon} from './docsite-icons';import {ShimmerText} from './ShimmerText';import {MOCK_CODE} from './constants';@@ -28,6 +29,286 @@ const composerStyles = stylex.create({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;@@ -37,6 +318,7 @@ export type PointedElement = {export function ChatPanel({isGenerating,onSend,+ reply,activeView: _activeView,setActiveView: _setActiveView,templateName,@@ -47,7 +329,8 @@ export function ChatPanel({hideHeader = false,}: {isGenerating: boolean;- onSend?: () => void;+ onSend?: (prompt: string) => void;+ reply?: string | null;activeView: 'craft' | 'explore' | 'docs' | 'profile' | 'theme';setActiveView: (view: 'craft' | 'explore' | 'docs' | 'profile' | 'theme',@@ -60,7 +343,26 @@ export function ChatPanel({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@@ -124,18 +426,40 @@ export function ChatPanel({{/* Configure tab (or default when no tabs) */}{(!templateName || !onTabChange || tab === 'configure') && (<>- <div style={{flex: 1, padding: 16, overflow: 'auto'}}>- <div style={{marginBottom: 16}}>- <XDSChatMessage sender="user">- <XDSChatMessageBubble>- Can you customize this template by adding a divider line under- the header and use a card for the lists- </XDSChatMessageBubble>- </XDSChatMessage>- </div>- <div style={{padding: '0 4px'}}>- <ShimmerText isActive={isGenerating} />- </div>+ <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><div@@ -149,7 +473,12 @@ export function ChatPanel({}><XDSChatComposeronSubmit={() => {- onSend?.();+ if (!prompt.trim()) return;+ setMessages(prev => [+ ...prev,+ {role: 'user', text: prompt.trim()},+ ]);+ onSend?.(prompt);setPrompt('');}}value={prompt}@@ -161,6 +490,8 @@ export function ChatPanel({{'--shadow-low': 'none','--shadow-med': 'none',+ '--_chat-composer-radius': 'var(--radius-container)',+ '--_button-radius': 'var(--radius-full)',} as React.CSSProperties}/>@@ -170,7 +501,18 @@ export function ChatPanel({{/* Properties tab */}{templateName && onTabChange && tab === 'properties' && (- <div style={{flex: 1, padding: 16, overflow: 'auto'}}>+ <div+ style={{+ flex: 1,+ minHeight: 0,+ padding: pointedElement ? '16px 16px 32px' : 16,+ overflow: 'auto',+ display: 'flex',+ flexDirection: 'column',+ ...(pointedElement+ ? {}+ : {alignItems: 'center', justifyContent: 'center'}),+ }}>{pointedElement ? (<divstyle={{@@ -200,34 +542,19 @@ export function ChatPanel({</XDSText></div><XDSDivider variant="strong" />- <XDSMetadataList title="Layout">- <XDSMetadataListItem label="Width">- {pointedElement.rect- ? `${Math.round(pointedElement.rect.width)}px`- : '—'}- </XDSMetadataListItem>- <XDSMetadataListItem label="Height">- {pointedElement.rect- ? `${Math.round(pointedElement.rect.height)}px`- : '—'}- </XDSMetadataListItem>- </XDSMetadataList>- <XDSDivider variant="strong" />- <XDSMetadataList title="Styles">- <XDSMetadataListItem label="Background">- #ffffff- </XDSMetadataListItem>- <XDSMetadataListItem label="Border radius">- 12px- </XDSMetadataListItem>- <XDSMetadataListItem label="Padding">16px</XDSMetadataListItem>- <XDSMetadataListItem label="Font size">- 14px- </XDSMetadataListItem>- </XDSMetadataList>+ <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@@ -237,16 +564,7 @@ export function ChatPanel({)}{/* Code tab */}- {templateName && onTabChange && tab === 'code' && (- <div style={{flex: 1, minHeight: 0, overflow: 'auto'}}>- <XDSCodeBlock- code={MOCK_CODE}- language="typescript"- title="useUser.ts"- hasLineNumbers- />- </div>- )}+ {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.tsxindex e2712089c3..62c5019046 100644--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/ComponentPreviews.tsx+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/ComponentPreviews.tsx@@ -1,221 +1,365 @@'use client';-import React from 'react';+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 {XDSDivider} from '@xds/core/Divider';+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';-import {DialogPreview} from './ProfileView';-export const COMPONENT_PREVIEWS: {[key: string]: React.ReactNode} = {- button: (- <div>- <div style={{marginBottom: 16}}>- <XDSHeading level={3}>Variants</XDSHeading>- </div>+export const COMPONENT_PREVIEW_LIST: {+ key: string;+ label: string;+ preview: React.ReactNode;+}[] = [+ {+ key: 'button',+ label: 'Button',+ preview: (<divstyle={{display: 'flex',- gap: 12,- flexWrap: 'wrap' as const,- marginBottom: 32,+ gap: 10,+ flexWrap: 'wrap',+ alignItems: 'center',}}><XDSButton label="Primary" variant="primary" /><XDSButton label="Secondary" variant="secondary" /><XDSButton label="Ghost" variant="ghost" /></div>- <div style={{marginBottom: 16}}>- <XDSHeading level={3}>Sizes</XDSHeading>- </div>- <div- style={{- display: 'flex',- gap: 12,- alignItems: 'center',- flexWrap: 'wrap' as const,- }}>- <XDSButton label="Small" variant="primary" size="sm" />- <XDSButton label="Medium" variant="primary" size="md" />- <XDSButton label="Large" variant="primary" size="lg" />- </div>- </div>- ),- avatar: (- <div>- <div style={{marginBottom: 16}}>- <XDSHeading level={3}>Sizes</XDSHeading>- </div>- <div- style={{- display: 'flex',- gap: 16,- alignItems: 'center',- flexWrap: 'wrap' as const,- }}>+ ),+ },+ {+ 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>- </div>- ),- badge: (- <div>- <div style={{marginBottom: 16}}>- <XDSHeading level={3}>Variants</XDSHeading>- </div>- <div- style={{- display: 'flex',- gap: 12,- flexWrap: 'wrap' as const,- }}>+ ),+ },+ {+ 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>- </div>- ),- card: (- <div>- <div style={{marginBottom: 16}}>- <XDSHeading level={3}>Card</XDSHeading>- </div>- <div style={{maxWidth: 400}}>- <XDSCard>- <div style={{padding: 16}}>- <XDSHeading level={4}>Card Title</XDSHeading>- <div style={{marginTop: 8}}>- <XDSText type="body" color="secondary">- Cards are containers for grouping related content and actions.- They provide a flexible surface for displaying information.- </XDSText>- </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>- </XDSCard>- </div>- </div>- ),- banner: (- <div>- <div style={{marginBottom: 16}}>- <XDSHeading level={3}>Status Variants</XDSHeading>- </div>+ </div>+ </XDSCard>+ ),+ },+ {+ key: 'banner',+ label: 'Banner',+ preview: (<div- style={{display: 'flex', flexDirection: 'column' as const, gap: 12}}>+ style={{+ display: 'flex',+ flexDirection: 'column',+ gap: 10,+ width: '100%',+ }}><XDSBanner status="info" title="Information">- <XDSText type="body">- This is an informational banner message.- </XDSText>+ <XDSText type="body">Informational message.</XDSText></XDSBanner><XDSBanner status="success" title="Success">- <XDSText type="body">Operation completed successfully.</XDSText>- </XDSBanner>- <XDSBanner status="warning" title="Warning">- <XDSText type="body">Please review before continuing.</XDSText>+ <XDSText type="body">Operation completed.</XDSText></XDSBanner></div>- </div>- ),- dialog: <DialogPreview />,- text: (- <div>- <div style={{marginBottom: 16}}>- <XDSHeading level={3}>Typography Scale</XDSHeading>- </div>+ ),+ },+ {+ key: 'textinput',+ label: 'TextInput',+ preview: (<div- style={{display: 'flex', flexDirection: 'column' as const, gap: 12}}>- <XDSText type="display-1">Display 1</XDSText>- <XDSText type="display-2">Display 2</XDSText>- <XDSText type="display-3">Display 3</XDSText>- <XDSHeading level={1}>Heading 1</XDSHeading>- <XDSHeading level={2}>Heading 2</XDSHeading>- <XDSHeading level={3}>Heading 3</XDSHeading>- <XDSHeading level={4}>Heading 4</XDSHeading>- <XDSText type="body">Body text</XDSText>- <XDSText type="supporting">Supporting text</XDSText>+ 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>- </div>- ),- divider: (- <div>- <div style={{marginBottom: 16}}>- <XDSHeading level={3}>Divider</XDSHeading>+ ),+ },+ {+ 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' as const, gap: 24}}>- <div>+ style={{+ display: 'flex',+ flexDirection: 'column',+ gap: 16,+ width: '100%',+ minWidth: 280,+ }}>+ <div style={{width: '100%'}}><XDSText type="supporting" color="secondary">- Subtle (default)+ 25%</XDSText>- <div style={{marginTop: 8}}>- <XDSDivider />+ <div style={{marginTop: 6, width: '100%'}}>+ <XDSProgressBar value={25} label="Progress" isLabelHidden /></div></div>- <div>+ <div style={{width: '100%'}}><XDSText type="supporting" color="secondary">- Strong+ 60%</XDSText>- <div style={{marginTop: 8}}>- <XDSDivider variant="strong" />+ <div style={{marginTop: 6, width: '100%'}}>+ <XDSProgressBar value={60} label="Progress" isLabelHidden /></div></div>- <div>+ <div style={{width: '100%'}}><XDSText type="supporting" color="secondary">- With label+ 100%</XDSText>- <div style={{marginTop: 8}}>- <XDSDivider label="Section" />+ <div style={{marginTop: 6, width: '100%'}}>+ <XDSProgressBar value={100} label="Progress" isLabelHidden /></div></div></div>- </div>- ),- token: (- <div>- <div style={{marginBottom: 16}}>- <XDSHeading level={3}>Tokens</XDSHeading>- </div>- <div- style={{- display: 'flex',- gap: 8,- flexWrap: 'wrap' as const,- }}>+ ),+ },+ {+ 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>- </div>- ),- tooltip: (- <div>- <div style={{marginBottom: 16}}>- <XDSHeading level={3}>Tooltip</XDSHeading>- </div>- <div- style={{- display: 'flex',- gap: 12,- flexWrap: 'wrap' as const,- }}>+ ),+ },+ {+ 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>- <XDSTooltip content="Ghost action">- <XDSButton label="Or me" variant="ghost" />- </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.tsxindex 81f3208188..0e08886570 100644--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/CraftingCat.tsx+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/CraftingCat.tsx@@ -1,32 +1,53 @@'use client';-import React, {useState, useEffect} from 'react';+import React from 'react';-const FRAMES = [- ' /\\_/\\\n ( o.o )\n \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 \u258b \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n /| \u2550\u2550\u2550\u2550\u2550\u2550\u2550 |\\',- ' /\\_/\\\n ( o.o )\n \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 _\u258b \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n \\| \u2550\u2550\u2550\u2550\u2550\u2550\u2550 |/',- ' /\\_/\\\n ( -.- )\n \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 __\u258b \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n /| \u2550\u2550\u2550\u2550\u2550\u2550\u2550 |\\',- ' /\\_/\\\n ( o.o )\n \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 ___\u258b \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n \\| \u2550\u2550\u2550\u2550\u2550\u2550\u2550 |/',- ' /\\_/\\\n ( o.o )\n \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 ____\u258b \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n /| \u2550\u2550\u2550\u2550\u2550\u2550\u2550 |\\',- ' /\\_/\\\n ( ^.^ )\n \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 \u258b \u2502\n \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n \\| \u2550\u2550\u2550\u2550\u2550\u2550\u2550 |/',+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() {- const [frame, setFrame] = useState(0);-- useEffect(() => {- const id = setInterval(() => {- setFrame(prev => (prev + 1) % FRAMES.length);- }, 350);- return () => clearInterval(id);- }, []);-return (<><style>{`- @keyframes craftingShimmer {- 0% { background-position: -200% center; }- 100% { background-position: 200% center; }+ @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@@ -37,33 +58,55 @@ export function CraftingCat() {flexDirection: 'column',alignItems: 'center',justifyContent: 'center',- gap: 16,backgroundColor: 'var(--color-background-surface, #fff)',}}>- <pre+ <divstyle={{- fontFamily:- '"JetBrains Mono", "Fira Code", "SF Mono", "Cascadia Code", monospace',- fontSize: 18,- lineHeight: 1.35,- color: 'var(--color-text-secondary, #65676B)',- margin: 0,+ display: 'flex',+ gap: 20,+ alignItems: 'flex-end',+ height: 80,}}>- {FRAMES[frame]}- </pre>+ {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><spanstyle={{+ marginTop: 24,fontSize: 13,fontWeight: 500,- letterSpacing: 0.5,- background:- 'linear-gradient(90deg, var(--color-text-secondary, #65676B) 40%, var(--color-text-primary, #111) 50%, var(--color-text-secondary, #65676B) 60%)',- backgroundSize: '200% auto',- WebkitBackgroundClip: 'text',- WebkitTextFillColor: 'transparent',- animation: 'craftingShimmer 2s linear infinite',+ letterSpacing: 0.3,+ color: 'var(--color-text-secondary, #65676B)',+ animation: 'craftPulse 2s ease-in-out infinite',}}>- Crafting your UI...+ Crafting your layout...</span></div></>diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplateCard.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplateCard.tsxindex a521162e2e..71a9893b1f 100644--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplateCard.tsx+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplateCard.tsx@@ -22,6 +22,8 @@ export function TemplateCard({onUse,onPreview,cardSize: _cardSize = 'medium',+ isCached = false,+ onIframeLoad,}: {src: string;slug?: string;@@ -33,12 +35,15 @@ export function TemplateCard({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(() => {@@ -50,9 +55,13 @@ export function TemplateCard({useEffect(() => {if (!slug) return;updateIframeScale();- const observer = new ResizeObserver(updateIframeScale);- if (iframeWrapperRef.current) observer.observe(iframeWrapperRef.current);- return () => observer.disconnect();+ const el = iframeWrapperRef.current;+ if (!el) return;++ const resizeObs = new ResizeObserver(updateIframeScale);+ resizeObs.observe(el);++ return () => resizeObs.disconnect();}, [slug, updateIframeScale]);useEffect(() => {@@ -77,7 +86,13 @@ export function TemplateCard({cursor: 'pointer',overflow: 'hidden',}}- onMouseEnter={() => setHovered(true)}+ 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 */}@@ -92,21 +107,36 @@ export function TemplateCard({opacity: isGenerating ? 0 : 1,transition: 'opacity 600ms ease',}}>- <iframe- src={`${basePath}/templates/${slug}/?embed=1`}- title={name}- style={{- position: 'absolute',- top: 0,- left: 0,- width: 1920,- height: 1205,- border: 'none',- transform: `scale(${iframeScale})`,- transformOrigin: 'top left',- pointerEvents: 'none',- }}- />+ {!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`}+ 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>) : (<imgdiff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplatePreviewModal.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplatePreviewModal.tsxindex 5f30822cbf..4b8199e3be 100644--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplatePreviewModal.tsx+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/TemplatePreviewModal.tsx@@ -74,12 +74,15 @@ export type TemplatePreviewItem = {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({@@ -121,6 +124,20 @@ export function TemplatePreviewModal({),);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)',+ meta: 'sepia(0.15) saturate(1.4) hue-rotate(200deg)',+ whatsapp: 'sepia(0.2) saturate(1.3) hue-rotate(100deg)',+ 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 => {@@ -133,15 +150,25 @@ export function TemplatePreviewModal({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 (<XDSDialogisOpen={isOpen}onOpenChange={open => {- if (!open) onClose();+ if (!open) {+ onClose();+ setPreviewLoaded(false);+ }}}width="90vw"maxHeight="90vh"@@ -176,28 +203,40 @@ export function TemplatePreviewModal({style={{flex: 1,aspectRatio: '16 / 10',- backgroundColor: 'var(--color-background-muted, #f9f9f9)',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 ? (<iframesrc={`${basePath}/templates/${item.slug}/?embed=1`}title={item.name}+ onLoad={() => setPreviewLoaded(true)}style={{width: '100%',height: '100%',border: 'none',display: 'block',- opacity: transitioning ? 0 : 1,+ opacity: transitioning || !previewLoaded ? 0 : 1,transition: 'opacity 250ms ease',}}/>) : (<img- src={item.img}- alt={item.name}+ src={themedImg}+ alt={`${item.name} — ${selectedTheme}`}+ onLoad={() => setPreviewLoaded(true)}style={{width: '100%',display: 'block',@@ -640,22 +679,39 @@ export function TemplatePreviewModal({aspectRatio: '16/10',overflow: 'hidden',}}>- <img- src={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',- }}- />+ {mlItem.slug ? (+ <iframe+ src={`${basePath}/templates/${mlItem.slug}/?embed=1`}+ 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>diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/constants.ts b/apps/sandbox/src/app/(fullscreen)/pages/docsite/constants.tsindex 0562d59e0d..45b8b4f01e 100644--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/constants.ts+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/constants.ts@@ -72,12 +72,12 @@ export const SIM_COUNT = 350;// ---------------------------------------------------------------------------export const basePath = process.env.NEXT_PUBLIC_BASE_PATH || '';-export const DUMMY_IMAGE = `${basePath}/templates/dummy-placeholder.png`;+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}/templates/first-card.png`;-export const SHOPPING_DETAILS_IMAGE = `${basePath}/templates/shopping-details.png`;-export const SCREENSHOT_3_IMAGE = `${basePath}/templates/screenshot-3.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@@ -194,16 +194,8 @@ export const TEMPLATES: {isOfficial: true,},{- name: 'Product Detail',- src: DUMMY_IMAGE,- slug: 'product-detail',- size: 'large',- author: 'XDS Design',- isOfficial: true,- },- {- name: 'Settings Page',- src: `${basePath}/templates/card4-preview.png`,+ name: 'Landing Page',+ src: `${basePath}/docsite/card4-preview.png`,size: 'small',author: 'XDS Design',isOfficial: true,@@ -358,7 +350,7 @@ export const PROFILE_USED_ITEMS: {'Responsive contact form with validation, file upload, and success state.',lastUsed: '2026-04-13T11:00:00Z',usageCount: 4,- img: `${basePath}/templates/card4-preview.png`,+ img: `${basePath}/docsite/card4-preview.png`,},{name: 'Badge',@@ -388,13 +380,13 @@ export const PROFILE_USED_ITEMS: {img: SHOPPING_DETAILS_IMAGE,},{- name: 'Settings Page',+ 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}/templates/card4-preview.png`,+ img: `${basePath}/docsite/card4-preview.png`,},{name: 'Dialog',@@ -461,7 +453,7 @@ export const PROFILE_LIKED_ITEMS: {type: 'Template',bookmarkedAt: '2026-04-07T09:00:00Z',description: 'E-commerce product page with image gallery and reviews.',- img: `${basePath}/templates/card4-preview.png`,+ img: `${basePath}/docsite/card4-preview.png`,author: 'XDS Design',},{@@ -599,13 +591,13 @@ export const PROFILE_CRAFT_ITEMS: {tags: ['Dashboard', 'Charts', 'Analytics'],},{- name: 'Settings Page',+ name: 'Landing Page',type: 'Template',status: 'Published',used: 67,views: 248,bookmarks: 18,- img: `${basePath}/templates/card4-preview.png`,+ img: `${basePath}/docsite/card4-preview.png`,lastUpdated: '2026-02-20T08:00:00Z',description:'Sidebar settings layout with inline editing and expandable rows.',@@ -788,6 +780,7 @@ export const THEME_PICKER_ENTRIES: ThemePickerEntry[] = [name: 'Meta',category: 'official',accent: '#0064E0',+ isPinnedByDefault: true,description: 'Meta brand with Figtree typography',preview: {bg: '#FFFFFF',@@ -818,6 +811,7 @@ export const THEME_PICKER_ENTRIES: ThemePickerEntry[] = [name: 'Threads',category: 'official',accent: '#000000',+ isPinnedByDefault: true,description: 'Threads brand with clean monochrome palette',preview: {bg: '#FFFFFF',diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/page.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/page.tsxindex 8968c7e135..231cab38b9 100644--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/page.tsx+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/page.tsx@@ -9,7 +9,7 @@ import React, {useCallback,useMemo,} from 'react';-import {useSearchParams, useRouter} from 'next/navigation';+import {useSearchParams} from 'next/navigation';import {TEMPLATES,@@ -23,6 +23,7 @@ import {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';@@ -193,7 +194,7 @@ function ThemeCard({onClick={onCustomize}>{theme.preview.img ? (<img- src={`${basePath}/templates/${theme.preview.img}`}+ src={`${basePath}/docsite/${theme.preview.img}`}alt={theme.name}style={{display: 'block',@@ -388,7 +389,6 @@ export default function DocsiteLandingPage() {function DocsiteLandingTemplate() {const searchParams = useSearchParams();- const router = useRouter();const [previewMode, setPreviewMode] = useState<'light' | 'dark'>('light');const [previewTheme, setPreviewTheme] = useState('default');@@ -516,6 +516,10 @@ function DocsiteLandingTemplate() {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@@ -553,6 +557,16 @@ function DocsiteLandingTemplate() {const [isHeaderCollapsed, setIsHeaderCollapsed] = useState(false);const [card4Bookmarked, setCard4Bookmarked] = useState(false);const [themePreviewKey, setThemePreviewKey] = useState<string | 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) => {@@ -622,7 +636,8 @@ function DocsiteLandingTemplate() {const qs = params.toString();if (qs === window.location.search.slice(1)) return;- router.replace(`/pages/docsite/${qs ? '?' + qs : ''}`, {scroll: false});+ const url = `/pages/docsite/${qs ? '?' + qs : ''}`;+ window.history.replaceState(window.history.state, '', url);}, [previewTarget,useTarget,@@ -634,7 +649,6 @@ function DocsiteLandingTemplate() {profileUsedName,profileSettingsOpen,profileCollectionName,- router,]);const prevViewRef = useRef(activeView);@@ -713,6 +727,8 @@ function DocsiteLandingTemplate() {setUseTarget(null);setChatOpen(false);setShowPublishCard1(false);+ setEditorVariantImage(null);+ setChatReply(null);const returnTo = viewBeforeEditorRef.current;if (returnTo !== 'craft') {skipViewResetRef.current = true;@@ -724,14 +740,45 @@ function DocsiteLandingTemplate() {setPreviewTarget(index);}, []);- const handlePreviewSend = useCallback(() => {- if (previewGenerating) return;- setPreviewGenerating(true);- previewTimerRef.current = setTimeout(() => {- setPreviewGenerating(false);- previewTimerRef.current = null;- }, 5000);- }, [previewGenerating]);+ 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 () => {@@ -914,6 +961,7 @@ function DocsiteLandingTemplate() {<ChatPanelisGenerating={previewGenerating}onSend={handlePreviewSend}+ reply={chatReply}activeView={activeView}setActiveView={setActiveView}templateName={t.name}@@ -969,8 +1017,8 @@ function DocsiteLandingTemplate() {}}><TemplatePreviewtemplateName={t.name}- imageSrc={t.src}- slug={t.slug}+ imageSrc={editorVariantImage ?? t.src}+ slug={editorVariantImage ? undefined : t.slug}onBack={handleBackFromUse}isGenerating={previewGenerating}onPublish={() => {@@ -1784,6 +1832,7 @@ function DocsiteLandingTemplate() {</div>) : (<div+ key={activeTab}style={{maxWidth: 2000,margin: '0 auto',@@ -1795,67 +1844,162 @@ function DocsiteLandingTemplate() {: 'repeat(3, 1fr)',gap: 16,}}>- {filteredTemplates.flatMap((template, i) => {- const items = [- <div- key={`${template.name}-${template.originalIndex}`}- style={{- ...(craftTitle- ? {- animation: `craftCardFadeIn 400ms ${i * 50}ms cubic-bezier(0.16, 1, 0.3, 1) both`,+ {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}- : undefined),- 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}- onSelect={() =>- setSelected(prev => {- const next = new Set(prev);- if (next.has(template.originalIndex)) {- next.delete(template.originalIndex);- } else {- next.add(template.originalIndex);+ cardSize={template.size}+ isCached={+ !!template.slug &&+ loadedIframesRef.current.has(template.slug)}- return next;- })- }- onMoreLikeThis={() =>- handleMoreLikeThis(template.originalIndex)- }- onUse={() => handleUse(template.originalIndex)}- onPreview={() =>- handlePreview(template.originalIndex)- }- />- </div>,- ];- if (activeTab === 'all' && i === 2) {- items.push(- ...THEME_PICKER_ENTRIES.filter(- t => t.key === 'daily' || t.key === 'forest',- ).map((t, ti) => (- <ThemeCard- key={`theme-${t.key}`}- theme={t}- index={i + ti + 1}- onCustomize={() => setThemePreviewKey(t.key)}- onEdit={() => setActiveView('theme')}- />- )),- );- }- return items;- })}+ 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={() => 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>@@ -1871,23 +2015,101 @@ function DocsiteLandingTemplate() {{/* Bottom drawer overlay */}{previewTarget !== null &&(() => {- const t = TEMPLATES[previewTarget % TEMPLATES.length];- const moreLikeThisImages = TEMPLATES.map((tmpl, i) => ({- img: tmpl.src,- name: tmpl.name,- key: i,- }))- .filter(item => item.key !== previewTarget)- .slice(0, 4);+ 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`,+ meta: `${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`,+ meta: `${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`,+ meta: `${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`,+ meta: `${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`,+ meta: `${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 (<TemplatePreviewModalisOpen={true}- onClose={() => setPreviewTarget(null)}+ onClose={() => {+ setPreviewTarget(null);+ setSelectedVariant(null);+ }}item={{- name: t.name,- img: t.src,- slug: t.slug,+ 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;@@ -1898,9 +2120,19 @@ function DocsiteLandingTemplate() {isBookmarked={card4Bookmarked}onBookmarkToggle={() => setCard4Bookmarked(prev => !prev)}moreLikeThis={moreLikeThisImages}- onMoreLikeThisClick={mlItem =>- setPreviewTarget(mlItem.key as number)- }+ 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',