feat(docsite): playground design editor + code-driven theming#3034
feat(docsite): playground design editor + code-driven theming#3034ernestt wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
🚀 Vercel Preview Deployment
|
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR No new or modified components detected. Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
cixzhang
left a comment
There was a problem hiding this comment.
There's a lot of changes from parts of the repo that don't seem intentional. Can you revert them and focus only on the docsite updates? Otherwise you'll likely run into merge conflict issues with the prefix update. Make sure you rebase over main only only bring in the intended changes to the docsite.
Reframe the playground around teaching global vs. local theming, with the
code as the single source of truth for the theme.
- Theme is authored in-code: the example wraps its UI in a `<Theme>` with an
inline `defineTheme({...})` literal. The Theme editor, presets, and element
targeting all read/write that literal (themeSource.ts), so panel edits and
hand-edits round-trip and the share URL carries the theme.
- New left-panel "Design Editor": select an element in the preview to edit it
via a Properties / Style switcher. Style applies either locally (a one-off
`xstyle` via a managed stylex.create block — instanceStyleSource.ts) or
globally (theme component overrides), with a hover preview of the affected
elements.
- Theme editor reorganized into Presets / Custom / Advanced; the preset picker
is extracted into a shared ThemePicker reused by the /themes explorer.
- Playground defaults to the Neutral theme (matching the docsite's component
previews); the default example is responsive with a cleaner footer.
- Targeting outlines hug each element's real border-radius; selecting an
element rings only that element (solid), and hovering "Apply Globally"
previews scope by ringing every instance of the type.
Verified: typecheck, 186 docsite tests (incl. new themeSource +
instanceStyleSource suites), and eslint all pass.
Co-authored-by: Cursor <cursoragent@cursor.com>
0d1e6b6 to
5217102
Compare
|
Thanks @cixzhang — good catch, and you were right that those weren't intentional. I've rebuilt the branch so it's now docsite-only (21 files) on top of latest Root cause: the ~300 non-docsite files were pure Fix: I reset the branch to current The diff is now just the playground/theming work. Sorry for the noise! |
Summary
Reframes the docsite playground around teaching global vs. local theming, with the code as the single source of truth for the theme.
<Theme>with an inlinedefineTheme({...})literal. The Theme editor, presets, and element targeting all read/write that literal (newthemeSource.ts), so panel edits and hand-edits round-trip and the share URL carries the theme.xstylevia a managedstylex.createblock — newinstanceStyleSource.ts) or globally (theme component overrides), with hover previews of the affected elements. Empty state prompts you to pick the select tool.ThemePickerreused by the/themesexplorer (dedupes the sidebar + carousel).border-radius; selection shows the element solid + same-type siblings faint.Files of note
themeSource.ts,styleOverride/(StyleScopeEditor, StyleOverrideFields, instanceStyleSource),designEditor/DesignEditor.tsx,themeEditor/componentThemeTargets.ts,components/ThemePicker.tsx.themeEditor/ComponentTokensPanel.tsx(folded into the targeting flow).PlaygroundClient,preview/page.tsx,targetingOverlay,ThemeEditor,ThemePackagePage,previewThemes,defaultCode.Test plan
pnpm -F @xds/docsite typecheckpnpm -F @xds/docsite test— 186 tests pass, incl. newthemeSource+instanceStyleSourcesuiteseslintclean on all changed filespgStyles/xstyle; Apply Globally writes the theme; presets/custom/advanced tabs; deselect; default Neutral seedMade with Cursor