Skip to content

feat(theme): revamped Theme - #893

Open
rohanchkrabrty wants to merge 1 commit into
mainfrom
worktree-theme-revamp
Open

feat(theme): revamped Theme#893
rohanchkrabrty wants to merge 1 commit into
mainfrom
worktree-theme-revamp

Conversation

@rohanchkrabrty

Copy link
Copy Markdown
Contributor

Summary

  • Adds ThemePreview, the element-mounted theme from RFC 004: tokens move off <html> onto a real element, so the root theme, a nested scope and a portal re-injection are the same component rendering the same attributes — which makes the theme server-renderable, allows more than one provider per page, and fixes scoped themes inside portals.
  • Rebuilds the token layer: every --rs-* declaration is wrapped in :where() so a consumer rule on the stable .rs-theme class wins without !important; spacing, effects and z-index move onto the theme selector so a scope can change them; adds --rs-scaling, a radius factor over a fixed base scale replacing the two hardcoded data-style scales, and panel/overlay/backdrop-filter tokens.
  • Adds seven independently seedable, controllable and persistable settings — appearance, accent, gray, radius, scaling, panel background, reduced motion — over useSyncExternalStore persistence gated on persistKey, plus a small pre-hydration script that patches its own parent and a :has() colour-scheme rule that writes nothing to <html>.
  • Adds theme re-injection and a container prop across the thirteen portalling components, and a shared radius cva variant and CSS module; Image and Avatar migrate onto the five-value scale.
  • Publishes style-no-fonts.css alongside style.css, reorders --rs-font-mono so JetBrains Mono precedes Menlo, and adds a theme playground panel plus a docs page with a migration guide.
  • The existing Theme ships unchanged, so this is additive — no consumer migration is forced by this PR.

…nel tokens (RFC 004)

Adds `ThemePreview`, an element-mounted theme alongside the existing `Theme`,
implementing RFC 004. Tokens move off `<html>` onto a real element, so the root
theme, a nested scope and a portal re-injection are the same component
rendering the same attributes.

Token layer:
- every `--rs-*` declaration wrapped in `:where()`, so a consumer rule on the
  stable `.rs-theme` class wins without `!important` or load-order control
- spacing, effects and z-index move off `:root` onto the theme selector, which
  is what makes them scopable
- `--rs-scaling` multiplies spacing, radius, font sizes and line heights
- radius becomes a factor over a fixed base scale plus a pill length, replacing
  the two hardcoded `data-style` scales
- panel, overlay and backdrop-filter tokens; `data-panel-background` selects
  solid or translucent, defaulting to solid
- each accent gets its own selector, so `indigo` resets inside an orange scope
- `sage` joins the gray union

Component:
- seven independently seedable, controllable and persistable settings
- `useSyncExternalStore` persistence, gated on `persistKey`, with merge-on-write
  so themes may share a namespace
- a small pre-hydration script that patches its own parent, emitted only for a
  namespace's uncontrolled settings
- `:has()` colour-scheme rule on `<html>`, no JavaScript and no writes to it
- `hasBackground`, `isRoot`, `render`, `useThemePreview().root`

Portals and per-component radius:
- theme re-injection and a `container` prop across the thirteen portalling
  components, fixing scoped themes inside portals
- a shared `radius` cva variant and CSS module; `Image` and `Avatar` migrate
  onto the five-value scale

Stylesheets:
- `style-no-fonts.css` published alongside `style.css`
- `--rs-font-mono` reordered so JetBrains Mono precedes Menlo

Docs: a theme playground panel and a preview page with a migration guide.

The existing `Theme` ships unchanged, so this is additive.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017vcxAxsBpKAvtUfDi2wFKr
@vercel

vercel Bot commented Sep 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
apsara Ready Ready Preview Sep 2, 2026 8:32pm UTC

@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Too many files!

This PR contains 113 files, which is 13 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 6a004e5c-c146-4ece-ab6a-e9846e8380f3

📥 Commits

Reviewing files that changed from the base of the PR and between fe977c2 and bc2b4e8.

📒 Files selected for processing (113)
  • apps/www/src/components/demo/demo.tsx
  • apps/www/src/components/theme-panel-demo.tsx
  • apps/www/src/content/docs/theme/meta.json
  • apps/www/src/content/docs/theme/overview/index.mdx
  • apps/www/src/content/docs/theme/preview/demo.ts
  • apps/www/src/content/docs/theme/preview/index.mdx
  • apps/www/src/content/docs/theme/preview/props.ts
  • packages/raystack/components/alert-dialog/alert-dialog-content.tsx
  • packages/raystack/components/announcement-bar/announcement-bar.module.css
  • packages/raystack/components/avatar/__tests__/avatar.test.tsx
  • packages/raystack/components/avatar/avatar.module.css
  • packages/raystack/components/avatar/avatar.tsx
  • packages/raystack/components/badge/badge.module.css
  • packages/raystack/components/badge/badge.tsx
  • packages/raystack/components/breadcrumb/breadcrumb.module.css
  • packages/raystack/components/button/button.module.css
  • packages/raystack/components/button/button.tsx
  • packages/raystack/components/calendar/calendar.module.css
  • packages/raystack/components/callout/callout.module.css
  • packages/raystack/components/callout/callout.tsx
  • packages/raystack/components/chat-panel/chat-panel.module.css
  • packages/raystack/components/chat/chat.module.css
  • packages/raystack/components/checkbox/checkbox.module.css
  • packages/raystack/components/chip/chip.module.css
  • packages/raystack/components/chip/chip.tsx
  • packages/raystack/components/code-block/code-block.module.css
  • packages/raystack/components/color-picker/color-picker.module.css
  • packages/raystack/components/combobox/combobox-content.tsx
  • packages/raystack/components/combobox/combobox.module.css
  • packages/raystack/components/command/command-dialog.tsx
  • packages/raystack/components/command/command.module.css
  • packages/raystack/components/context-menu/context-menu-content.tsx
  • packages/raystack/components/data-table/data-table.module.css
  • packages/raystack/components/data-view/data-view.module.css
  • packages/raystack/components/dialog/dialog-content.tsx
  • packages/raystack/components/dialog/dialog.module.css
  • packages/raystack/components/drawer/drawer-content.tsx
  • packages/raystack/components/drawer/drawer.module.css
  • packages/raystack/components/editor/editor.module.css
  • packages/raystack/components/empty-state/empty-state.module.css
  • packages/raystack/components/field/field.module.css
  • packages/raystack/components/filter-chip/filter-chip.module.css
  • packages/raystack/components/floating-actions/floating-actions.module.css
  • packages/raystack/components/icon-button/icon-button.module.css
  • packages/raystack/components/icon-button/icon-button.tsx
  • packages/raystack/components/image/__tests__/image.test.tsx
  • packages/raystack/components/image/image.module.css
  • packages/raystack/components/image/image.tsx
  • packages/raystack/components/input/input.module.css
  • packages/raystack/components/input/input.tsx
  • packages/raystack/components/kbd/kbd.module.css
  • packages/raystack/components/link/link.module.css
  • packages/raystack/components/menu/cell.module.css
  • packages/raystack/components/menu/menu-content.tsx
  • packages/raystack/components/menu/menu.module.css
  • packages/raystack/components/menubar/menubar.module.css
  • packages/raystack/components/message/message.module.css
  • packages/raystack/components/otp-field/otp-field.module.css
  • packages/raystack/components/popover/popover.module.css
  • packages/raystack/components/popover/popover.tsx
  • packages/raystack/components/preview-card/preview-card.module.css
  • packages/raystack/components/preview-card/preview-card.tsx
  • packages/raystack/components/prompt-input/prompt-input.module.css
  • packages/raystack/components/reasoning/reasoning.module.css
  • packages/raystack/components/scroll-area/scroll-area.module.css
  • packages/raystack/components/select/select-content.tsx
  • packages/raystack/components/select/select.module.css
  • packages/raystack/components/sidebar/sidebar.module.css
  • packages/raystack/components/slider/slider.module.css
  • packages/raystack/components/tabs/tabs.module.css
  • packages/raystack/components/text-area/text-area.module.css
  • packages/raystack/components/text-area/text-area.tsx
  • packages/raystack/components/theme-preview/__tests__/data-slots.test.tsx
  • packages/raystack/components/theme-preview/__tests__/mocks.ts
  • packages/raystack/components/theme-preview/__tests__/script.test.ts
  • packages/raystack/components/theme-preview/__tests__/ssr.test.tsx
  • packages/raystack/components/theme-preview/__tests__/store.test.ts
  • packages/raystack/components/theme-preview/__tests__/theme-preview.test.tsx
  • packages/raystack/components/theme-preview/context.ts
  • packages/raystack/components/theme-preview/index.tsx
  • packages/raystack/components/theme-preview/portal.ts
  • packages/raystack/components/theme-preview/radius.module.css
  • packages/raystack/components/theme-preview/radius.ts
  • packages/raystack/components/theme-preview/script.ts
  • packages/raystack/components/theme-preview/settings.ts
  • packages/raystack/components/theme-preview/store.ts
  • packages/raystack/components/theme-preview/switcher.tsx
  • packages/raystack/components/theme-preview/theme-preview.tsx
  • packages/raystack/components/theme-preview/use-system-appearance.ts
  • packages/raystack/components/toast/toast-provider.tsx
  • packages/raystack/components/toast/toast.module.css
  • packages/raystack/components/toggle/toggle.module.css
  • packages/raystack/components/toolbar/toolbar.module.css
  • packages/raystack/components/tooltip/tooltip-content.tsx
  • packages/raystack/components/tooltip/tooltip.module.css
  • packages/raystack/components/tour/tour-content.tsx
  • packages/raystack/components/tour/tour.module.css
  • packages/raystack/index.tsx
  • packages/raystack/package.json
  • packages/raystack/scripts/build-no-fonts-css.js
  • packages/raystack/styles/colors.css
  • packages/raystack/styles/effects.css
  • packages/raystack/styles/fonts-legacy.css
  • packages/raystack/styles/fonts.css
  • packages/raystack/styles/index.css
  • packages/raystack/styles/primitives/accent.css
  • packages/raystack/styles/primitives/appearance.css
  • packages/raystack/styles/primitives/gray.css
  • packages/raystack/styles/primitives/z-index.css
  • packages/raystack/styles/radius.css
  • packages/raystack/styles/spacing.css
  • packages/raystack/styles/theme.css
  • packages/raystack/styles/typography.css

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Sep 2, 2026

Copy link
Copy Markdown

Open in StackBlitz

pnpm add https://pkg.pr.new/@raystack/apsara@893

commit: bc2b4e8

@rohanchkrabrty rohanchkrabrty changed the title feat(theme): element-mounted ThemePreview with radius and scaling (RFC 004) feat(theme): revamped Theme Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant