Skip to content

refactor(sanity-plugin-cloudinary): migrate styling to vanilla-extract - #1845

Open
stipsan wants to merge 4 commits into
mainfrom
cursor/cloudinary-vanilla-extract-0939
Open

refactor(sanity-plugin-cloudinary): migrate styling to vanilla-extract#1845
stipsan wants to merge 4 commits into
mainfrom
cursor/cloudinary-vanilla-extract-0939

Conversation

@stipsan

@stipsan stipsan commented Aug 6, 2026

Copy link
Copy Markdown
Member

Migrates sanity-plugin-cloudinary from styled-components to vanilla-extract (zero-runtime CSS), following the monorepo migration skill.

Changes

  • Replaced the two styled.div wrappers (Widget, SetupButtonContainer) with colocated .css.ts rules + thin component wrappers
  • Moved static inline style={{…}} objects into .css.ts (including layout variants via styleVariants)
  • Thin wrappers merge className with clsx/lite (skill guidance); clsx added to the workspace catalog
  • Enabled vanillaExtract: true in tsdown.config.ts and registered vanillaExtractPlugin() in Vitest
  • Removed the styled-components peer dependency (kept as a catalog: devDependency for @sanity/ui peer alignment)
  • Added a patch changeset

Verification

  • pnpm format
  • pnpm lint
  • pnpm knip
  • Package build (sanity-plugin-cloudinary + deps) — full pnpm build currently fails on test-studio due to prerelease sanity + auto-updates (unrelated to this PR)
  • pnpm test run / cloudinary project tests
  • Visual fidelity in test studio (Cloudinary asset / list / reference inputs)

Cloudinary asset field
Cloudinary list and reference fields
All Cloudinary fields

Note: style={{visibility: 'hidden'}} on the media-library widget host is intentionally kept — JS toggles contentRef.current.style.visibility after the iframe loads.

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

Replace styled-components and static inline styles with colocated
.css.ts modules, enable the tsdown vanilla-extract integration, and
drop the styled-components peer dependency.
@changeset-bot

changeset-bot Bot commented Aug 6, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2721ffe

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
sanity-plugin-cloudinary Patch

Not sure what this means? Click here to learn what changesets are.

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

@vercel

vercel Bot commented Aug 6, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
plugins-studio Ready Ready Preview Aug 6, 2026 8:59am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
plugins-e2e-test-studio Ignored Ignored Aug 6, 2026 8:59am

Request Review

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

✅ E2E Tests

🟢 26 passedview full reportview run

Studio: https://plugins-e2e-test-studio-aocvxrxh3.sanity.dev

Datasets: pr-1845-chromium-31087133312, pr-1845-firefox-31087133312

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

@stipsan
stipsan marked this pull request as ready for review August 6, 2026 08:52
@stipsan
stipsan requested a review from a team as a code owner August 6, 2026 08:52
@stipsan
stipsan requested review from Copilot and pedrobonamin and removed request for a team August 6, 2026 08:52
Use clsx/lite in thin style wrappers per the vanilla-extract migration
skill, and add clsx to the workspace catalog.

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.

Pull request overview

Migrates sanity-plugin-cloudinary off styled-components/inline styles to vanilla-extract, aligning the plugin with the monorepo’s zero-runtime styling approach and adding the standard ./bundle.css export.

Changes:

  • Replaced styled.div wrappers and several inline style={{...}} usages with colocated vanilla-extract .css.ts files plus thin wrapper components.
  • Enabled vanilla-extract in build/test tooling (tsdown.config.ts, vitest.config.ts) and added the ./bundle.css package export with a corresponding exports test snapshot update.
  • Updated lockfile for new styling/tooling deps (and also advanced sanity@next in the lockfile).

Reviewed changes

Copilot reviewed 18 out of 19 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pnpm-lock.yaml Adds vanilla-extract-related deps; also advances workspace sanity@next resolution.
plugins/sanity-plugin-cloudinary/vitest.config.ts Registers vanillaExtractPlugin() and disables runtime style injection in tests.
plugins/sanity-plugin-cloudinary/tsdown.config.ts Enables vanillaExtract: true for the package build.
plugins/sanity-plugin-cloudinary/src/index.test.ts Updates exports snapshot to include ./bundle.css.
plugins/sanity-plugin-cloudinary/src/components/WidgetInput.tsx Replaces styled/inline styles with wrapper components using vanilla-extract classes.
plugins/sanity-plugin-cloudinary/src/components/WidgetInput.css.ts New vanilla-extract styles for WidgetInput.
plugins/sanity-plugin-cloudinary/src/components/CloudinaryReferenceInput.tsx Moves inline layout styles to vanilla-extract wrappers/classes.
plugins/sanity-plugin-cloudinary/src/components/CloudinaryReferenceInput.css.ts New vanilla-extract styles for CloudinaryReferenceInput.
plugins/sanity-plugin-cloudinary/src/components/AssetPreview.tsx Moves thumbnail/video/raw label inline styles into vanilla-extract and uses style variants.
plugins/sanity-plugin-cloudinary/src/components/AssetPreview.css.ts New vanilla-extract styles + styleVariants for preview layout.
plugins/sanity-plugin-cloudinary/src/components/AssetListFunctions.tsx Replaces inline full-width button style with a wrapper + class.
plugins/sanity-plugin-cloudinary/src/components/AssetListFunctions.css.ts New vanilla-extract style using selectors: {'&&': ...} to override Button width.
plugins/sanity-plugin-cloudinary/src/components/AssetDiff.tsx Moves preview/diff layout styles to vanilla-extract classes.
plugins/sanity-plugin-cloudinary/src/components/AssetDiff.css.ts New vanilla-extract styles for diff preview layout.
plugins/sanity-plugin-cloudinary/src/components/asset-source/CloudinaryAssetSource.tsx Replaces styled wrapper with vanilla-extract widget class wrapper.
plugins/sanity-plugin-cloudinary/src/components/asset-source/CloudinaryAssetSource.css.ts New vanilla-extract style for asset source widget height.
plugins/sanity-plugin-cloudinary/package.json Adds ./bundle.css export and vanilla-extract-related devDependencies; removes styled-components from peers.
.changeset/cloudinary-vanilla-extract.md Adds a patch changeset describing the styling migration.
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pnpm-lock.yaml
Copilot AI review requested due to automatic review settings August 6, 2026 08:56
Revert the accidental sanity@next bump (next.6 → next.8) from the
migration install. Rebuild the lockfile from main and add only clsx
plus the vanilla-extract catalog entries for this plugin.

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.

Pull request overview

Copilot reviewed 18 out of 19 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Generated file
Suppressed comments (1)

pnpm-lock.yaml:10855

  • The lockfile update includes a broader bump of the prerelease Studio stack (e.g. sanity resolves to 6.9.1-next.8 here) in addition to the intended clsx + vanilla-extract additions. If this bump isn’t intentional, it would be better to regenerate the lockfile in a way that keeps the previous next.* resolutions to avoid unrelated dependency churn/risk in a styling-only PR.

Copilot AI review requested due to automatic review settings August 6, 2026 09:02

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.

Pull request overview

Copilot reviewed 18 out of 19 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants