Skip to content

refactor: remove @sanity/themer - #3057

Merged
stipsan merged 2 commits into
mainfrom
cody/remove-themer-from-ui-3adf
Sep 29, 2026
Merged

stipsan merged 2 commits into
mainfrom
cody/remove-themer-from-ui-3adf

Conversation

@stipsan

@stipsan stipsan commented Sep 29, 2026

Copy link
Copy Markdown
Member

Keep this a draft until sanity-io/plugins#2046 merges. That PR moves @sanity/themer into sanity-io/plugins (plugins/@sanity/themer), where it will be published from next (0.8.1).

This PR removes the package from ui, following the pattern of #3048 and #3056. @sanity/themer-legacy stays until sanity-io/themer#379 merges.

What changed

  • Removed: packages/themer.
  • Studio (apps/studio): the @sanity/themer dependency and its themerTool are gone entirely, not switched to the catalog. The @sanity/themer-legacy tool, the legacy docs schemas and scripts/export-docs-to-code.ts stay.
  • Nothing else in ui depends on @sanity/themer, so there's no catalog entry for it and no changeset.
    • @sanity/themer-legacy doesn't depend on it; the dependency ran the other way.
    • Neither do the docs, the Storybook, @sanity/ui nor the Figma plugin.
  • Catalog: drops lightningcss, which only packages/themer's tsdown config imported. @sanity/ui's build still runs its lightningcss pass through the vanilla-extract tsdown plugin, and its dist is byte-identical to main (97 files).
  • Config:
    • The root build and test scripts drop @sanity/themer.
    • pkg-pr-new.yml stops publishing ./packages/themer.
    • knip, oxlint, the workspace globs and the other workflows had no themer-specific entries.
  • Storybook: ui's Storybook has no themer-only stories. The stories/theme stories only use @sanity/ui, so they stay. There's no composition ref for themer, since plugins' Storybook doesn't have a URL yet. One can be added next to color, icons and logos once it does.
  • Docs: README, CONTRIBUTING and AGENTS.md now say @sanity/themer lives in sanity-io/plugins.
  • Lockfile: pure removal (91 lines), and identical with autoDedupe on or off.

What you need to do

Now: nothing. Keep this as a draft.

Once #2046 merges:

  1. Publish from plugins: make sure @sanity/themer 0.8.1 publishes from sanity-io/plugins' release.yml through its Version Packages PR.
  2. Guard ui's changesets: until this PR merges, keep @sanity/themer out of ui's pending changesets. For example, Renovate's dependency changesets list every package that uses the bumped dependency. Otherwise ui's release.yml would try to publish @sanity/themer too. There are none right now.
  3. Update and merge this PR: merge main into this branch (no force push), regenerate the lockfile if it conflicts, confirm CI is green, then mark it ready for review.
  4. Optional: remove sanity-io/ui as an npm trusted publisher for @sanity/themer.
  5. Storybook ref: once plugins' Storybook has a URL, add a composition ref in apps/storybook/.storybook/main.ts, like the color, icons and logos refs.

Nothing is undeployed. After this merges, the ui-studio Vercel deployment and the next sanity deploy of the hosted studio no longer include @sanity/themer's tool. The themer-legacy tool is still there.

Verification

From a fresh clone with pnpm install --frozen-lockfile, on Node 22.22 and pnpm 12.6.0, all of these pass:

  • oxfmt --check, pnpm lint (0 warnings and 0 errors), pnpm knip and pnpm build (@sanity/ui, @sanity/themer-legacy, the Figma plugin).
  • pnpm test: @sanity/ui 183 tests plus 1 skipped, and @sanity/themer-legacy 38 tests.
  • pnpm test:browser: 58 files, 249 tests, unchanged.
  • pnpm storybook:build, pnpm --filter sanity-ui-studio build and pnpm --filter sanity-ui-docs build.
Open in Web Open in Cursor 

@sanity/themer is developed and published from sanity-io/plugins. Remove its
`themerTool` from the studio together with the `@sanity/themer` dependency,
instead of installing it from npm. The `@sanity/themer-legacy` tool, the
legacy docs schemas and the docs export script stay.
@sanity/themer is developed and published from sanity-io/plugins
(plugins/@sanity/themer). Remove packages/themer and drop it from the build
and test scripts, pkg.pr.new and the docs. Nothing left in ui depends on it,
so there is no catalog entry for it, and the catalog drops lightningcss,
which only its tsdown config imported (the @sanity/ui build output is
unchanged). ui's Storybook has no themer-only stories to remove; a
composition ref to plugins' Storybook can be added once it has a URL.

@sanity/themer-legacy stays until it moves to sanity-io/themer.
@changeset-bot

changeset-bot Bot commented Sep 29, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 74e4b66

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel

vercel Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
sanity-ui-storybook Ready Ready Preview Sep 29, 2026 1:46am UTC
ui-docs Ready Ready Preview Sep 29, 2026 1:46am UTC
ui-studio Ready Ready Preview Sep 29, 2026 1:46am UTC
1 Skipped Deployment
Project Deployment Actions Updated
sanity-ui-workshop Ignored Ignored Sep 29, 2026 1:46am UTC

Request Review

@stipsan
stipsan marked this pull request as ready for review September 29, 2026 01:47
Copilot AI balanced review requested due to automatic review settings September 29, 2026 01:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The prerequisite transfer PR remains unmerged, so this PR must be returned to draft as its description requires.

Review effort: Balanced
Findings: 1 High severity

Open (1)
What changed in this PR

Removes @sanity/themer from this monorepo after transferring ownership to sanity-io/plugins.

Changes:

  • Deletes the package, source, tests, and build configuration.
  • Removes the Studio integration and root build/test/publishing references.
  • Updates documentation, workspace catalog, and lockfile.
File Description
.github/​workflows/​pkg-pr-new.yml Stops preview-publishing the package.
AGENTS.md Documents the package’s new repository.
CONTRIBUTING.md Removes the package from testing guidance.
README.md Updates ownership and test documentation.
apps/​studio/​package.json Removes the workspace dependency.
apps/​studio/​sanity.config.ts Removes the current themer tool.
package.json Removes package build and test commands.
packages/​themer/​CHANGELOG.md Removes package release history.
packages/​themer/​README.md Removes package documentation.
packages/​themer/​package.json Removes the package manifest.
packages/​themer/​src/​index.ts Removes root exports.
packages/​themer/​src/​legacy/​index.ts Removes legacy re-exports.
packages/​themer/​src/​legacy/​reexport.test.ts Removes legacy export tests.
packages/​themer/​src/​lib/​mix.ts Removes color validation helper.
packages/​themer/​src/​theme/​buildPalette.ts Removes palette generation.
packages/​themer/​src/​theme/​buildTheme.ts Removes theme generation.
packages/​themer/​src/​theme/​hsl.ts Removes color conversion utilities.
packages/​themer/​src/​theme/​options.ts Removes theme option handling.
packages/​themer/​src/​theme/​presets.ts Removes theme presets.
packages/​themer/​src/​theme/​theme.test.ts Removes theme tests.
packages/​themer/​src/​tool/​AnimatedColorWheelIcon.tsx Removes animated tool icon.
packages/​themer/​src/​tool/​ImageFileButton.tsx Removes image picker control.
packages/​themer/​src/​tool/​ImagePaletteSection.css.ts Removes palette section styles.
packages/​themer/​src/​tool/​ImagePaletteSection.tsx Removes image palette UI.
packages/​themer/​src/​tool/​PasteThemeDialog.tsx Removes shared-theme dialog.
packages/​themer/​src/​tool/​RemovedThemes.css.ts Removes removed-theme styles.
packages/​themer/​src/​tool/​RemovedThemes.tsx Removes restoration UI.
packages/​themer/​src/​tool/​ResizableSidebar.css.ts Removes sidebar styles.
packages/​themer/​src/​tool/​ResizableSidebar.tsx Removes resizable sidebar.
packages/​themer/​src/​tool/​ScrollArea.css.ts Removes scroll-area styles.
packages/​themer/​src/​tool/​ScrollArea.tsx Removes scroll-area components.
packages/​themer/​src/​tool/​ThemeCard.css.ts Removes theme-card styles.
packages/​themer/​src/​tool/​ThemeCard.tsx Removes theme-card UI.
packages/​themer/​src/​tool/​ThemeEditor.css.ts Removes editor styles.
packages/​themer/​src/​tool/​ThemeEditor.tsx Removes theme editor.
packages/​themer/​src/​tool/​ThemeList.css.ts Removes theme-list styles.
packages/​themer/​src/​tool/​ThemeList.tsx Removes theme list.
packages/​themer/​src/​tool/​ThemePreview.css.ts Removes preview styles.
packages/​themer/​src/​tool/​ThemePreview.tsx Removes theme preview.
packages/​themer/​src/​tool/​ThemeSnippetDialog.tsx Removes snippet dialog.
packages/​themer/​src/​tool/​ThemeThumbnail.tsx Removes theme thumbnails.
packages/​themer/​src/​tool/​ThemerLayout.css.ts Removes tool layout styles.
packages/​themer/​src/​tool/​ThemerLayout.tsx Removes tool layout integration.
packages/​themer/​src/​tool/​ThemerNavbar.tsx Removes navbar integration.
packages/​themer/​src/​tool/​ThemerSidebar.css.ts Removes sidebar header styles.
packages/​themer/​src/​tool/​ThemerSidebar.tsx Removes sidebar UI.
packages/​themer/​src/​tool/​TooltipButton.tsx Removes tooltip button helper.
packages/​themer/​src/​tool/​colorWheel.test.ts Removes icon animation tests.
packages/​themer/​src/​tool/​colorWheel.ts Removes icon animation logic.
packages/​themer/​src/​tool/​context.ts Removes tool context.
packages/​themer/​src/​tool/​imageFile.ts Removes image decoding.
packages/​themer/​src/​tool/​imagePalette.test.ts Removes palette tests.
packages/​themer/​src/​tool/​imagePalette.ts Removes palette extraction.
packages/​themer/​src/​tool/​index.ts Removes tool exports.
packages/​themer/​src/​tool/​machine.test.ts Removes state-machine tests.
packages/​themer/​src/​tool/​machine.ts Removes tool state machine.
packages/​themer/​src/​tool/​options.ts Removes option comparison helpers.
packages/​themer/​src/​tool/​plugin.test.ts Removes plugin tests.
packages/​themer/​src/​tool/​plugin.tsx Removes Studio plugin definition.
packages/​themer/​src/​tool/​share.test.ts Removes sharing tests.
packages/​themer/​src/​tool/​share.ts Removes theme-code sharing.
packages/​themer/​src/​tool/​sidebarWidth.ts Removes sidebar width constants.
packages/​themer/​src/​tool/​snippet.ts Removes snippet generation.
packages/​themer/​src/​tool/​storage.test.ts Removes persistence tests.
packages/​themer/​src/​tool/​storage.ts Removes tool persistence.
packages/​themer/​src/​tool/​themes.test.ts Removes theme-list tests.
packages/​themer/​src/​tool/​themes.ts Removes theme-list modeling.
packages/​themer/​src/​tool/​useImagePalette.ts Removes image palette hook.
packages/​themer/​src/​tool/​usePrefersReducedMotion.ts Removes motion preference hook.
packages/​themer/​src/​tool/​useStudioNavbarHeight.ts Removes navbar measurement hook.
packages/​themer/​src/​tool/​useThemeCodes.ts Removes sharing hooks.
packages/​themer/​src/​tool/​useTypedDeferredValue.test.tsx Removes deferred-value tests.
packages/​themer/​src/​tool/​useTypedDeferredValue.ts Removes deferred-value hook.
packages/​themer/​tsconfig.json Removes TypeScript configuration.
packages/​themer/​tsdown.config.mts Removes package build configuration.
packages/​themer/​typings/​babel-plugin-react-compiler.d.ts Removes compiler type shim.
packages/​themer/​vitest.config.ts Removes test configuration.
pnpm-lock.yaml Removes package importer dependencies.
pnpm-workspace.yaml Removes its direct Lightning CSS catalog entry.
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread package.json
"author": "Sanity.io <hello@sanity.io>",
"scripts": {
"build": "pnpm --filter @sanity/ui build && pnpm --filter @sanity/themer-legacy build && pnpm --filter @sanity/themer build && pnpm --filter figma-plugin-sanity-ui build",
"build": "pnpm --filter @sanity/ui build && pnpm --filter @sanity/themer-legacy build && pnpm --filter figma-plugin-sanity-ui build",
@stipsan
stipsan merged commit 4994c06 into main Sep 29, 2026
17 checks passed
@stipsan
stipsan deleted the cody/remove-themer-from-ui-3adf branch September 29, 2026 01:51

This branch was successfully deployed

3 active deployments
Preview – ui-docs — 74e4b668 Deployed Sep 29, 2026 by vercel[bot]
Preview – sanity-ui-storybook — 74e4b668 Deployed Sep 29, 2026 by vercel[bot]
Preview – ui-studio — 74e4b668 Deployed Sep 29, 2026 by vercel[bot]
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.

3 participants