Skip to content

add component-specific variant theming - #4

Merged
cixzhang merged 1 commit into
mainfrom
theming
Jan 13, 2026
Merged

add component-specific variant theming#4
cixzhang merged 1 commit into
mainfrom
theming

Conversation

@cixzhang

@cixzhang cixzhang commented Jan 13, 2026

Copy link
Copy Markdown
Contributor

This completes the theming system. Typescript has some nice features that allow us to augment the theme type at the component level, so new components can register the ability to theme their variants. We demonstrate component variant theming in the neutral theme where the primary button's text needed adjustments in dark mode.

Screen.Recording.2026-01-13.at.8.04.15.AM.mov

For review, I recommend taking a look at neutralTheme.tsx to see what a custom theme looks like in this system.

This completes the theming system. Typescript has some nice features that allow us to augment the theme type at the component level, so new components can register the ability to theme their variants. We demonstrate component variant theming in the neutral theme where the primary button's text needed adjustments in dark mode.
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jan 13, 2026
@cixzhang
cixzhang requested a review from liyalabubu January 13, 2026 16:36
@cixzhang
cixzhang merged commit 4a32680 into main Jan 13, 2026
1 check passed
@cixzhang
cixzhang deleted the theming branch January 13, 2026 16:41
':focus-visible': {
outline: `2px solid ${colorTokens.focusOutline}`,
outlineOffset: '3px',
},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the modern pseudo-class syntax for proper style composition - you should be able to slot that as an instruction to the LLM for it to convert these.

Suggested change
backgroundImage: {
default: null,
':hover': `linear-gradient(${colorTokens.hoverOverlay}, ${colorTokens.hoverOverlay})`,
':active': `linear-gradient(${colorTokens.pressedOverlay}, ${colorTokens.pressedOverlay})`,
},
outline: {
default: null,
':focus-visible': `2px solid ${colorTokens.focusOutline}`,
},
outlineOffset: {
default: null,
':focus-visible': '3px',
},

/**
* Theme context value
*/
export interface ThemeContextValue {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would like to better understand why we're going the route of using a React Context instead of defineVars/createTheme and if we're set on pre-transpiling the components. If we use -- key syntax within defineVars the variables should be modifiable in the consuming apps.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, it's so we can deliver fully composed styles. Like for button variants, a primary button is the combination of a background color + text color + border radius. We can't easily provide arbitrary compositions through purely CSS variables as far as I'm aware.

cixzhang added a commit that referenced this pull request Apr 21, 2026
XDS prompt: packages/core/README.md (has docs.mjs + component doc.mjs files)
Baseline prompt: .baseline/README.md (has real shadcn component sources)
HTML prompt: no docs (correct — plain HTML)

Fixes checker protocol invariant #4 — agents now see what a real
consumer would see for each target. Removes references to
non-existent .baseline-docs/ and AGENTS.baseline.md.

Co-authored-by: Navi <navi@navibot.dev>
cixzhang added a commit that referenced this pull request Apr 21, 2026
* feat(core): ship docs.mjs + README, fix vibe test fairness

- Add docs.mjs: lightweight component doc script (234 lines, zero deps)
  Ships with @xds/core, reads *.doc.mjs source files
  Equivalent correctness to CLI (10/10 vs 10/10 in vibe test)
  Agents discover it via README.md without any CLAUDE.md instruction

- Replace xds.md with README.md in core package
  README documents docs.mjs for component lookup
  Also recommends CLI for richer features (templates, scaffolding)

- Fix vibe test prompt fairness (checker protocol invariants 2+3):
  Remove expectedComponents leak from XDS prompt in both
  setup-iteration.mjs and setup-nightly.mjs
  XDS prompt now equivalent to baseline: 'read the docs, do the task'
  Bug existed since original interactive.ts

- Fix vibe test evaluation fairness (checker protocol invariant 1):
  Remove darkModeSupport bonus (10pts) - was string matching not
  actual dark mode verification, penalized XDS for automatic support
  Remove XDS input a11y skip - all targets now held to same standard

- Add baseline README.md pointing to real shadcn component sources

Co-authored-by: Navi <navi@navibot.dev>

* docs(vibe-tests): add README with checker protocol, prompt examples, and battery reference

Co-authored-by: Navi <navi@navibot.dev>

* docs(core): add npx xds --help to README CLI section

Co-authored-by: Navi <navi@navibot.dev>

* docs(core): clarify CLI docs includes theming and styling reference

Co-authored-by: Navi <navi@navibot.dev>

* fix(vibe-tests): representative environment paths for all targets

XDS prompt: packages/core/README.md (has docs.mjs + component doc.mjs files)
Baseline prompt: .baseline/README.md (has real shadcn component sources)
HTML prompt: no docs (correct — plain HTML)

Fixes checker protocol invariant #4 — agents now see what a real
consumer would see for each target. Removes references to
non-existent .baseline-docs/ and AGENTS.baseline.md.

Co-authored-by: Navi <navi@navibot.dev>

* fix: replace xds.md export with docs.mjs in sync-exports and package.json

The verify-exports CI check was failing because xds.md was deleted
but still referenced in the exports map. sync-exports.js was
re-adding it on every run.

Co-authored-by: Navi <navi@navibot.dev>

---------

Co-authored-by: Navi <navi@navibot.dev>
cixzhang added a commit that referenced this pull request Apr 21, 2026
Each sub-agent gets its own cloned project directory with only
the files a real consumer would see:

- XDS: package.json + node_modules/@xds/core (symlinked)
- Baseline: package.json + components/ui/ + lib/ + README.md
- HTML: package.json only

Templates in environments/project-{a,b,c}/ (generic names to
avoid leaking target identity). setup-environment.mjs creates
per-agent clones at runtime: results/<iter>/projects/<prompt-id>/

Agents write output to their own project dir — no cross-contamination
between agents or targets. Satisfies checker protocol invariant #4
(representative environment) and #5 (context-free agents).

Co-authored-by: Navi <navi@navibot.dev>
cixzhang added a commit that referenced this pull request Apr 21, 2026
* feat(vibe-tests): per-agent isolated project environments

Each sub-agent gets its own cloned project directory:
- XDS: package.json + node_modules/@xds/core (symlinked to source)
- Baseline: package.json + components/ui/ + lib/ + README.md
- HTML: package.json only (bare React project)

Templates: environments/project-{a,b,c}/ (generic names)
Runtime: setup-environment.mjs creates per-agent clones
Pipeline: collect-results.mjs copies output to eval path

Nightly prompts updated: 'Your project is at <path>. Explore it.'
No system-specific hints, no expected components, no coaching rules.

Tested: 2 prompts × 3 targets, all 6 passed tsc with 0 errors.
XDS agents found README → docs.mjs. Baseline found README → components/ui/.

Fixes checker protocol invariant #4 (representative environment)
and #5 (agent isolation — no cross-contamination).

Related: #1576, #1577

Co-authored-by: Navi <navi@navibot.dev>

* feat(vibe-tests): symlink CLI for XDS agents, add layout guidance to README

- Symlink @xds/cli + .bin/xds into agent project dirs so npx xds works
  Lets us measure whether agents reach for CLI (templates, theming docs)
  vs docs.mjs (component API)

- Add 'Page Layouts' section to core README recommending templates for
  full-page composition (AppShell, Layout, TopNav, SideNav patterns)

Co-authored-by: Navi <navi@navibot.dev>

* refactor: rename environment templates, add @xds/cli to devDeps

Templates renamed: project-{a,b,c} → project-{xds,baseline,html}
(agents see cloned copies, not the template names)

Added @xds/cli as devDependency in project-xds template so the
package.json looks like a real XDS project.

Co-authored-by: Navi <navi@navibot.dev>

* docs: add CLI install note to README templates section, use * versions

- Templates section now notes @xds/cli is required
- CLI section reworded to describe additional tooling beyond templates
- Removed duplicate template commands from CLI section
- Environment template uses * versions (always matches current)

Co-authored-by: Navi <navi@navibot.dev>

* docs(core): complete CLI command reference in README

List all CLI commands with descriptions so agents (and humans)
can see the full capability surface at a glance.

Co-authored-by: Navi <navi@navibot.dev>

---------

Co-authored-by: Navi <navi@navibot.dev>
cixzhang added a commit that referenced this pull request Apr 26, 2026
add component-specific variant theming
cixzhang added a commit that referenced this pull request Apr 26, 2026
* feat(core): ship docs.mjs + README, fix vibe test fairness

- Add docs.mjs: lightweight component doc script (234 lines, zero deps)
  Ships with @xds/core, reads *.doc.mjs source files
  Equivalent correctness to CLI (10/10 vs 10/10 in vibe test)
  Agents discover it via README.md without any CLAUDE.md instruction

- Replace xds.md with README.md in core package
  README documents docs.mjs for component lookup
  Also recommends CLI for richer features (templates, scaffolding)

- Fix vibe test prompt fairness (checker protocol invariants 2+3):
  Remove expectedComponents leak from XDS prompt in both
  setup-iteration.mjs and setup-nightly.mjs
  XDS prompt now equivalent to baseline: 'read the docs, do the task'
  Bug existed since original interactive.ts

- Fix vibe test evaluation fairness (checker protocol invariant 1):
  Remove darkModeSupport bonus (10pts) - was string matching not
  actual dark mode verification, penalized XDS for automatic support
  Remove XDS input a11y skip - all targets now held to same standard

- Add baseline README.md pointing to real shadcn component sources

Co-authored-by: Navi <navi@users.noreply.github.com>

* docs(vibe-tests): add README with checker protocol, prompt examples, and battery reference

Co-authored-by: Navi <navi@users.noreply.github.com>

* docs(core): add npx xds --help to README CLI section

Co-authored-by: Navi <navi@users.noreply.github.com>

* docs(core): clarify CLI docs includes theming and styling reference

Co-authored-by: Navi <navi@users.noreply.github.com>

* fix(vibe-tests): representative environment paths for all targets

XDS prompt: packages/core/README.md (has docs.mjs + component doc.mjs files)
Baseline prompt: .baseline/README.md (has real shadcn component sources)
HTML prompt: no docs (correct — plain HTML)

Fixes checker protocol invariant #4 — agents now see what a real
consumer would see for each target. Removes references to
non-existent .baseline-docs/ and AGENTS.baseline.md.

Co-authored-by: Navi <navi@users.noreply.github.com>

* fix: replace xds.md export with docs.mjs in sync-exports and package.json

The verify-exports CI check was failing because xds.md was deleted
but still referenced in the exports map. sync-exports.js was
re-adding it on every run.

Co-authored-by: Navi <navi@users.noreply.github.com>

---------

Co-authored-by: Navi <navi@users.noreply.github.com>
cixzhang added a commit that referenced this pull request Apr 26, 2026
* feat(vibe-tests): per-agent isolated project environments

Each sub-agent gets its own cloned project directory:
- XDS: package.json + node_modules/@xds/core (symlinked to source)
- Baseline: package.json + components/ui/ + lib/ + README.md
- HTML: package.json only (bare React project)

Templates: environments/project-{a,b,c}/ (generic names)
Runtime: setup-environment.mjs creates per-agent clones
Pipeline: collect-results.mjs copies output to eval path

Nightly prompts updated: 'Your project is at <path>. Explore it.'
No system-specific hints, no expected components, no coaching rules.

Tested: 2 prompts × 3 targets, all 6 passed tsc with 0 errors.
XDS agents found README → docs.mjs. Baseline found README → components/ui/.

Fixes checker protocol invariant #4 (representative environment)
and #5 (agent isolation — no cross-contamination).

Related: #1576, #1577

Co-authored-by: Navi <navi@users.noreply.github.com>

* feat(vibe-tests): symlink CLI for XDS agents, add layout guidance to README

- Symlink @xds/cli + .bin/xds into agent project dirs so npx xds works
  Lets us measure whether agents reach for CLI (templates, theming docs)
  vs docs.mjs (component API)

- Add 'Page Layouts' section to core README recommending templates for
  full-page composition (AppShell, Layout, TopNav, SideNav patterns)

Co-authored-by: Navi <navi@users.noreply.github.com>

* refactor: rename environment templates, add @xds/cli to devDeps

Templates renamed: project-{a,b,c} → project-{xds,baseline,html}
(agents see cloned copies, not the template names)

Added @xds/cli as devDependency in project-xds template so the
package.json looks like a real XDS project.

Co-authored-by: Navi <navi@users.noreply.github.com>

* docs: add CLI install note to README templates section, use * versions

- Templates section now notes @xds/cli is required
- CLI section reworded to describe additional tooling beyond templates
- Removed duplicate template commands from CLI section
- Environment template uses * versions (always matches current)

Co-authored-by: Navi <navi@users.noreply.github.com>

* docs(core): complete CLI command reference in README

List all CLI commands with descriptions so agents (and humans)
can see the full capability surface at a glance.

Co-authored-by: Navi <navi@users.noreply.github.com>

---------

Co-authored-by: Navi <navi@users.noreply.github.com>
cixzhang added a commit that referenced this pull request Jun 21, 2026
* feat(core): ship docs.mjs + README, fix vibe test fairness

- Add docs.mjs: lightweight component doc script (234 lines, zero deps)
  Ships with @xds/core, reads *.doc.mjs source files
  Equivalent correctness to CLI (10/10 vs 10/10 in vibe test)
  Agents discover it via README.md without any CLAUDE.md instruction

- Replace xds.md with README.md in core package
  README documents docs.mjs for component lookup
  Also recommends CLI for richer features (templates, scaffolding)

- Fix vibe test prompt fairness (checker protocol invariants 2+3):
  Remove expectedComponents leak from XDS prompt in both
  setup-iteration.mjs and setup-nightly.mjs
  XDS prompt now equivalent to baseline: 'read the docs, do the task'
  Bug existed since original interactive.ts

- Fix vibe test evaluation fairness (checker protocol invariant 1):
  Remove darkModeSupport bonus (10pts) - was string matching not
  actual dark mode verification, penalized XDS for automatic support
  Remove XDS input a11y skip - all targets now held to same standard

- Add baseline README.md pointing to real shadcn component sources

Co-authored-by: Navi <navi@users.noreply.github.com>

* docs(vibe-tests): add README with checker protocol, prompt examples, and battery reference

Co-authored-by: Navi <navi@users.noreply.github.com>

* docs(core): add npx xds --help to README CLI section

Co-authored-by: Navi <navi@users.noreply.github.com>

* docs(core): clarify CLI docs includes theming and styling reference

Co-authored-by: Navi <navi@users.noreply.github.com>

* fix(vibe-tests): representative environment paths for all targets

XDS prompt: packages/core/README.md (has docs.mjs + component doc.mjs files)
Baseline prompt: .baseline/README.md (has real shadcn component sources)
HTML prompt: no docs (correct — plain HTML)

Fixes checker protocol invariant #4 — agents now see what a real
consumer would see for each target. Removes references to
non-existent .baseline-docs/ and AGENTS.baseline.md.

Co-authored-by: Navi <navi@users.noreply.github.com>

* fix: replace xds.md export with docs.mjs in sync-exports and package.json

The verify-exports CI check was failing because xds.md was deleted
but still referenced in the exports map. sync-exports.js was
re-adding it on every run.

Co-authored-by: Navi <navi@users.noreply.github.com>

---------

Co-authored-by: Navi <navi@users.noreply.github.com>
cixzhang added a commit that referenced this pull request Jun 21, 2026
* feat(vibe-tests): per-agent isolated project environments

Each sub-agent gets its own cloned project directory:
- XDS: package.json + node_modules/@xds/core (symlinked to source)
- Baseline: package.json + components/ui/ + lib/ + README.md
- HTML: package.json only (bare React project)

Templates: environments/project-{a,b,c}/ (generic names)
Runtime: setup-environment.mjs creates per-agent clones
Pipeline: collect-results.mjs copies output to eval path

Nightly prompts updated: 'Your project is at <path>. Explore it.'
No system-specific hints, no expected components, no coaching rules.

Tested: 2 prompts × 3 targets, all 6 passed tsc with 0 errors.
XDS agents found README → docs.mjs. Baseline found README → components/ui/.

Fixes checker protocol invariant #4 (representative environment)
and #5 (agent isolation — no cross-contamination).

Related: #1576, #1577

Co-authored-by: Navi <navi@users.noreply.github.com>

* feat(vibe-tests): symlink CLI for XDS agents, add layout guidance to README

- Symlink @xds/cli + .bin/xds into agent project dirs so npx xds works
  Lets us measure whether agents reach for CLI (templates, theming docs)
  vs docs.mjs (component API)

- Add 'Page Layouts' section to core README recommending templates for
  full-page composition (AppShell, Layout, TopNav, SideNav patterns)

Co-authored-by: Navi <navi@users.noreply.github.com>

* refactor: rename environment templates, add @xds/cli to devDeps

Templates renamed: project-{a,b,c} → project-{xds,baseline,html}
(agents see cloned copies, not the template names)

Added @xds/cli as devDependency in project-xds template so the
package.json looks like a real XDS project.

Co-authored-by: Navi <navi@users.noreply.github.com>

* docs: add CLI install note to README templates section, use * versions

- Templates section now notes @xds/cli is required
- CLI section reworded to describe additional tooling beyond templates
- Removed duplicate template commands from CLI section
- Environment template uses * versions (always matches current)

Co-authored-by: Navi <navi@users.noreply.github.com>

* docs(core): complete CLI command reference in README

List all CLI commands with descriptions so agents (and humans)
can see the full capability surface at a glance.

Co-authored-by: Navi <navi@users.noreply.github.com>

---------

Co-authored-by: Navi <navi@users.noreply.github.com>
cixzhang added a commit that referenced this pull request Jun 21, 2026
* feat(core): ship docs.mjs + README, fix vibe test fairness

- Add docs.mjs: lightweight component doc script (234 lines, zero deps)
  Ships with @xds/core, reads *.doc.mjs source files
  Equivalent correctness to CLI (10/10 vs 10/10 in vibe test)
  Agents discover it via README.md without any CLAUDE.md instruction

- Replace xds.md with README.md in core package
  README documents docs.mjs for component lookup
  Also recommends CLI for richer features (templates, scaffolding)

- Fix vibe test prompt fairness (checker protocol invariants 2+3):
  Remove expectedComponents leak from XDS prompt in both
  setup-iteration.mjs and setup-nightly.mjs
  XDS prompt now equivalent to baseline: 'read the docs, do the task'
  Bug existed since original interactive.ts

- Fix vibe test evaluation fairness (checker protocol invariant 1):
  Remove darkModeSupport bonus (10pts) - was string matching not
  actual dark mode verification, penalized XDS for automatic support
  Remove XDS input a11y skip - all targets now held to same standard

- Add baseline README.md pointing to real shadcn component sources


* docs(vibe-tests): add README with checker protocol, prompt examples, and battery reference


* docs(core): add npx xds --help to README CLI section


* docs(core): clarify CLI docs includes theming and styling reference


* fix(vibe-tests): representative environment paths for all targets

XDS prompt: packages/core/README.md (has docs.mjs + component doc.mjs files)
Baseline prompt: .baseline/README.md (has real shadcn component sources)
HTML prompt: no docs (correct — plain HTML)

Fixes checker protocol invariant #4 — agents now see what a real
consumer would see for each target. Removes references to
non-existent .baseline-docs/ and AGENTS.baseline.md.


* fix: replace xds.md export with docs.mjs in sync-exports and package.json

The verify-exports CI check was failing because xds.md was deleted
but still referenced in the exports map. sync-exports.js was
re-adding it on every run.


---------
cixzhang added a commit that referenced this pull request Jun 21, 2026
* feat(vibe-tests): per-agent isolated project environments

Each sub-agent gets its own cloned project directory:
- XDS: package.json + node_modules/@xds/core (symlinked to source)
- Baseline: package.json + components/ui/ + lib/ + README.md
- HTML: package.json only (bare React project)

Templates: environments/project-{a,b,c}/ (generic names)
Runtime: setup-environment.mjs creates per-agent clones
Pipeline: collect-results.mjs copies output to eval path

Nightly prompts updated: 'Your project is at <path>. Explore it.'
No system-specific hints, no expected components, no coaching rules.

Tested: 2 prompts × 3 targets, all 6 passed tsc with 0 errors.
XDS agents found README → docs.mjs. Baseline found README → components/ui/.

Fixes checker protocol invariant #4 (representative environment)
and #5 (agent isolation — no cross-contamination).

Related: #1576, #1577


* feat(vibe-tests): symlink CLI for XDS agents, add layout guidance to README

- Symlink @xds/cli + .bin/xds into agent project dirs so npx xds works
  Lets us measure whether agents reach for CLI (templates, theming docs)
  vs docs.mjs (component API)

- Add 'Page Layouts' section to core README recommending templates for
  full-page composition (AppShell, Layout, TopNav, SideNav patterns)


* refactor: rename environment templates, add @xds/cli to devDeps

Templates renamed: project-{a,b,c} → project-{xds,baseline,html}
(agents see cloned copies, not the template names)

Added @xds/cli as devDependency in project-xds template so the
package.json looks like a real XDS project.


* docs: add CLI install note to README templates section, use * versions

- Templates section now notes @xds/cli is required
- CLI section reworded to describe additional tooling beyond templates
- Removed duplicate template commands from CLI section
- Environment template uses * versions (always matches current)


* docs(core): complete CLI command reference in README

List all CLI commands with descriptions so agents (and humans)
can see the full capability surface at a glance.


---------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants