Skip to content

feat(themer): sync themes across tabs, Studio-style footer actions, and review follow-ups to #2065 - #2066

Merged
stipsan merged 16 commits into
mainfrom
cody/themer-state-refactor-ci-fixes-d6e5
Oct 5, 2026
Merged

stipsan merged 16 commits into
mainfrom
cody/themer-state-refactor-ci-fixes-d6e5

Conversation

@stipsan

@stipsan stipsan commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #2065, now that it has landed on main (this PR was stacked on it and GitHub retargeted it to main when the branch went). Sixteen commits, each a delta main lacks.

What it does

Cross-tab sync actually runs. main ships sync.ts (BroadcastChannel + a Web Lock electing the one tab that persists) but nothing calls it: PersistActorSnapshot still writes on requestIdleCallback. It now runs syncThemer(actorRef, {persist: writePersistedSnapshot}), so themes picked, edited, added or removed in one tab show in the others, writes are idle-deferred and flushed on pagehide, and knip stops flagging sync.ts.

Sidebar footers follow the Studio's document footer (one main action, the rest behind a … menu — see screenshots):

  • Header: only the split preview toggle and the close button (the code button and the back arrow are gone).
  • List footer: Edit when the applied theme is one of the user's own, Duplicate & Edit for a preset or the configured theme; the menu holds Add theme, Add from image, Add from code and — for a listed applied theme — Show theme code (the snippet dialog, moved here from the header). The image picker's hidden input is now its own ImageFileInput, which the menu item clicks; the menu button shows loading while an image's palette is read.
  • Editor footer: Done, with Remove in the menu.
  • Removed themes: a Done footer back to the list, in place of the header's back arrow.
  • Buttons are the Studio's own size (padding: 2, gap: 2, font size 1, as DEFAULT_BUTTON_PROPS in sanity's Button), in ghost mode, and the main actions carry an icon: Edit a pencil, Duplicate & Edit a copy, Done a checkmark. The footer menus animate like the cards' do.
  • The list's two dialogs are states of the machine's list flow (idle / pasting / snippet; events dialog.paste, dialog.snippet — guarded on an applied listed theme, left when it goes away — and dialog.close), so leaving the list closes them, and the persisted-snapshot schema restores a dialog-open snapshot to the plain list.
  • The cards' own … menus are untouched. Labels are short on purpose: your BoundaryElementProvider confines the menu to the sidebar, which can be narrow.
  • Every element id (menus, dialogs, the paste dialog's error) comes from useId(); no hardcoded ids remain under src/.

The Studio document footer (Publish and the more menu) next to the themer footer (Duplicate & Edit and the more menu), the buttons the same height
Themer list footer: Duplicate & Edit plus the menu with Add theme, Add from image, Add from code, Show theme code
Themer editor footer: Done plus the menu with Remove

Safari: the Studio scaled wrongly while it resized with the split copy. Safari (WebKit, as of Technology Preview 253) paints a view-transition snapshot that has a filter animating on it as raw layer contents, losing the object-fit stretch of resizeStudioRules — remove the blur and it animates like Chrome. The blur now sits on the ::view-transition-image-pair, which holds both snapshots and is a plain box, as one blur peaking at the cross-over (6px, what the two 12px blurs on the snapshots crossfaded into at that point), while the snapshots keep the stretch and only fade. Verified in Chromium and WebKit on the real Studio that the pair carries the blur and the snapshots keep their sizing rules. A reduced case for Safari (variant A = snapshots, variant B = image pair) is attached as an artifact: safari-snapshot-filter-repro.html.

Review comments on #2065 that still applied, fixed here:

  • Hidden list leaves picker busy (Bugbot) — useImagePalette guarded setBusy(false) with a mounted flag that goes false when the list's Activity hides on theme.add, so the image button stayed loading. The list's state survives being hidden; only the pick number guards the result now.
  • Wheel ignores reduced motion (Bugbot, Copilot) — the navbar renders the plain ColorWheelIcon under prefers-reduced-motion: reduce (usePrefersReducedMotion from @sanity/ui), so AnimatedColorWheelIcon and motion/react are not even loaded then.
  • Themer toggle inert on small viewports — per review, left to the toolbar's own breakpoints; ThemerProvider reads the sidebar threshold from MIN_MEDIA_INDEX_FOR_SIDEBAR (2).
  • Applied theme background is incomplete — reverted per review, for a follow-up PR.

Also: the commented-out crossfade experiment in ViewTransitions.css.ts (it refers to keyframes that are gone), docs for the layout (no more panel/split/moving tags or ThemerLayout.css.ts), the reducer and ThemerProps (minus images/view, which nothing picks), the README's title option in place of the removed config, a minor changeset, and the AGENTS.md note about Turbo's pnpm run re-resolving the lockfile locally.

Review comments on #2065 I did not act on

  • Split types clash on sidebar toggle — opening the sidebar with the split on adds both open and split-screen:open, so the Studio gets the resize and the blur-fade together. Looks deliberate (the split copy needs its type to slide in); your call.
  • Lazy AnimatedColorWheelIcon imports motion/react at navbar mount (Copilot) — a startup-cost question, not a bug; the hover spin needs the icon ready.
  • Closing the sidebar keeps the split — you marked it intentional. Theme rebuilt on every render — React Compiler, as you said. Config card shows the stock theme — by design until config returns. Changeset should be major — minor, 0.x.

Verification

  • Manual, in the test studio (video below): footer buttons measured at 24.98px, the same as the document footer's Publish, with copy/checkmark icons; header buttons, both footers and their menus, Duplicate & Edit → editor → Remove → Show removed (1) → Delete → back in the list, Show theme code present for a preset and absent for the configured theme; no console errors.
  • Dialogs, on the built studio (Playwright): Add from code opens the paste dialog (clipboard unavailable), a bad code shows the error, Escape closes it; Show theme code opens the snippet dialog for a preset and does not return after a reload; the configured theme's menu has no snippet item.
  • Split transition probed in Chromium and WebKit (Playwright) on the built Studio: ::view-transition-image-pair gets the 6px blur, the snapshots our fades plus the stretch rules, the split copy its slide, all at 480ms.
  • oxfmt --check clean; oxlint --disable-nested-config (whole repo, type-aware) 0 errors; CI=1 knip clean
  • @sanity/themer tsdown build (publint clean) and the Storybook static build
  • vitest run --project @sanity/themer: 13 files, 143 tests
  • Storybook browser tests (headless Chromium): 4 files, 7 stories
  • pnpm install --frozen-lockfile passes

themer-sidebar-footer-actions.mp4

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

@changeset-bot

changeset-bot Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: bfce6bd

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

This PR includes changesets to release 1 package
Name Type
@sanity/themer Minor

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 Oct 1, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
plugins-studio Ready Ready Preview Oct 5, 2026 1:32pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
plugins-e2e-test-studio Ignored Ignored Oct 5, 2026 1:32pm UTC

Request Review

@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

✅ E2E Tests

🟢 43 passed • 🟡 1 flaky • view full report • view run

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

Datasets: pr-2066-chromium-37317512607, pr-2066-firefox-37317512607

@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 35.79% 6535 / 18259
🔵 Statements 35.71% 6964 / 19501
🔵 Functions 31.91% 1750 / 5484
🔵 Branches 27.21% 3498 / 12851
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
plugins/@sanity/themer/src/tool/PersistActorSnapshot.tsx 0% 100% 0% 0% 17-19
plugins/@sanity/themer/src/tool/ThemerLayout.tsx 3.57% 0% 0% 4.16% 27-259
plugins/@sanity/themer/src/tool/ThemerNavbar.tsx 2.12% 0% 0% 2.5% 22-172
plugins/@sanity/themer/src/tool/ThemerProvider.tsx 0% 0% 0% 0% 27-62
plugins/@sanity/themer/src/tool/ViewTransitions.css.ts 0% 0% 0% 0%
plugins/@sanity/themer/src/tool/constants.ts 100% 100% 100% 100%
plugins/@sanity/themer/src/tool/machine.ts 98.82% 98.03% 98.43% 98.7% 386
plugins/@sanity/themer/src/tool/reducer.ts 84.61% 71.42% 100% 84.61% 41, 47
plugins/@sanity/themer/src/tool/schemas.ts 100% 94.82% 100% 100%
Generated in workflow #10345 for commit bfce6bd by the Vitest Coverage Report Action

@stipsan
stipsan added this pull request to stack #2067 October 1, 2026 10:48
@cursor
cursor Bot force-pushed the cody/themer-state-refactor-ci-fixes-d6e5 branch from cba9cd9 to 1e58c89 Compare October 1, 2026 13:35
@cursor cursor Bot changed the title fix(themer): clear CI for the <ViewTransition> / <Activity> rework (stacked on #2065) fix(themer): clear CI and simplify the machine for the <ViewTransition> / <Activity> rework (stacked on #2065) Oct 1, 2026
@stipsan
stipsan marked this pull request as ready for review October 1, 2026 13:36
@stipsan
stipsan requested a review from a team as a code owner October 1, 2026 13:36
@stipsan
stipsan requested review from juice49 and a balanced review from Copilot and removed request for a team October 1, 2026 13:36

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

Closing the sidebar preserves split state, causing the split preview to return unexpectedly when reopened.

Review effort: Balanced
Findings: 2 Medium severity · 3 Low severity

Open (5)
What changed in this PR

Cleans up the stacked Themer view-transition rework, simplifying state ownership and removing obsolete debug code.

Changes:

  • Moves sidebar/split state fully into toolReducer and simplifies the XState machine.
  • Cleans transition styles, hooks, contexts, dependencies, and Storybook fixtures.
  • Adds resolved config/title plugin options and updates tests and release notes.
File Description
.changeset/​themer-view-transitions-activity.md Adds Themer minor release notes.
dev/​storybook/​package.json Removes unused motion dependency.
dev/​storybook/​stories/​themer/​tool/​AnimatedColorWheelIcon.stories.tsx Updates stories to the new icon API.
dev/​test-studio/​src/​studio-secrets/​index.tsx Removes temporary transition probes.
plugins/​@sanity/​themer/​package.json Removes unused jsdom.
plugins/​@sanity/​themer/​src/​tool/​ViewTransitions.css.ts Cleans and consolidates transition styles.
plugins/​@sanity/​themer/​src/​tool/​useTypedDeferredValue.ts Removes obsolete deferred-value hook.
plugins/​@sanity/​themer/​src/​tool/​useTypedDeferredValue.test.tsx Removes obsolete hook tests.
plugins/​@sanity/​themer/​src/​tool/​useStudioNavbarHeight.ts Makes the selector private.
plugins/​@sanity/​themer/​src/​tool/​usePrefersReducedMotion.ts Removes CSS-replaced motion hook.
plugins/​@sanity/​themer/​src/​tool/​ThemerSidebar.tsx Corrects split transition identifiers.
plugins/​@sanity/​themer/​src/​tool/​ThemerNavbar.tsx Uses resolved configuration and local transition state.
plugins/​@sanity/​themer/​src/​tool/​ThemerLayout.tsx Simplifies transition-driven layout rendering.
plugins/​@sanity/​themer/​src/​tool/​reducer.ts Removes action aliases and adds exhaustiveness checking.
plugins/​@sanity/​themer/​src/​tool/​plugin.tsx Resolves plugin options and streamlines providers.
plugins/​@sanity/​themer/​src/​tool/​machine.ts Removes duplicated layout regions and refines switching.
plugins/​@sanity/​themer/​src/​tool/​machine.test.ts Updates tests for the simplified machine.
plugins/​@sanity/​themer/​src/​tool/​context.ts Removes unused contexts and adds configuration access.
plugins/​@sanity/​themer/​src/​tool/​addThemerTransitionType.ts Removes the debug transition hook.
pnpm-lock.yaml Updates removed development dependencies.
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.

open: false,
}
: state
return state.open ? {...state, open: false} : state

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

🔵 Needs a closer look

Closing the sidebar retains split mode contrary to documented behavior, and the updated mobile-layout documentation describes an unreachable state.

Review effort: Balanced
Findings: 1 Medium severity · 1 Low severity

Open (2)
Resolved since last review (3)
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file
Previously missed (1)

In code that hasn't changed since last review

Medium severity Align breakpoint gates so mobile split layout can render

plugins/​@sanity/​themer/​src/​tool/​ThemerLayout.tsx:105

The small-screen stacking described here is currently unreachable: plugin.tsx:117-121 forces the sidebar closed at media indexes ≤2 and only permits split at indexes >3. Either align those breakpoint gates so the mobile layout can render, or remove the claim that the split copy appears on top on small screens.

Copilot AI balanced review requested due to automatic review settings October 1, 2026 14:12
@cursor
cursor Bot force-pushed the cody/themer-state-refactor-ci-fixes-d6e5 branch from afafc4d to 007d361 Compare October 1, 2026 14:12

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

🔵 Needs a closer look

Closing the sidebar preserves split mode despite the documented behavior that closing ends the split preview.

Review effort: Balanced
Findings: 1 Medium severity · 1 Low severity

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

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.

Comment on lines +127 to +130
if (!state || typeof revision !== 'number' || !Number.isFinite(revision)) return null
if (typeof from !== 'string') return null

return {type, state, revision, from, ...(typeof to === 'string' ? {to} : {})}
}
const page = typeof window === 'undefined' ? undefined : window

page?.addEventListener('pagehide', flush)

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 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.

cancelOrClear()
}
}, [actorRef])
useEffect(() => syncThemer(actorRef, {persist: writePersistedSnapshot}), [actorRef])

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.


Your themes stay the same across the Studio's tabs: a theme picked, edited, added or removed in one tab shows in the others right away, while which tab has the sidebar open, or the split preview on, stays each tab's own. The tool picks up where you left off after a reload, and what it keeps in `localStorage` is validated as it is read back — what earlier versions stored is migrated — and written from one tab at a time.

The sidebar's footers follow the Studio's document footer: one primary action — `Edit` for your own applied theme, `Duplicate & Edit` for a preset or the configured theme, `Done` in the editor and among the removed themes — with the other actions (adding a theme, from an image or from a shared code, the applied theme's code, removing the theme being edited) behind the menu button next to it. The header keeps the split preview toggle and the close button.
## Studio tool

`@sanity/themer/tool` adds a themer sidebar to the Studio for these themes. It lists the configured theme, the presets and your own themes, each previewed as a tiny Studio in both color schemes, and picking one applies it live to the whole Studio while you browse around — in the appearance the Studio is set to or, with the split-screen toggle in the sidebar header, twice: the Studio next to the sidebar keeps the appearance it is set to, and a copy in the opposite scheme slides in from off screen on the far side (or on top, on small screens, where the sidebar covers the Studio instead of standing next to it), through React's `ViewTransition` — which is why the tool requires React 19.3. The cards drag into any order (or move from their menu), which sticks between sessions, and a theme's menu copies it as a short code to share — paste a code into the list, or add it through the paste button, to get the theme in another Studio. Your own themes are edited scheme by scheme — a light mode and a dark mode card with accent/text/background pickers and a contrast slider each, the one the Studio is showing marked as active — add one from scratch, duplicate a preset to start from it, or take the colors from an image: its palette is read on device (the image is drawn onto a canvas and its vibrant and muted colors extracted right there, nothing is uploaded), the vibrant color becomes the accent (adjusted until a button label reads on it), the muted one the text color and the light and dark muted colors tint the backgrounds, and a row of variants previews the theme built around each swatch instead — with an "I'm feeling lucky" button that picks an interesting one. Themes can be removed and restored, and a dialog shows the `buildTheme` snippet that makes the applied theme permanent:
`@sanity/themer/tool` adds a themer sidebar to the Studio for these themes. It lists the configured theme, the presets and your own themes, each previewed as a tiny Studio in both color schemes, and picking one applies it live to the whole Studio while you browse around — in the appearance the Studio is set to or, with the split-screen toggle in the sidebar header, twice: the Studio next to the sidebar keeps the appearance it is set to, and a copy in the opposite scheme slides in from off screen on the far side, through React's `ViewTransition` — which is why the tool requires React 19.3. The cards drag into any order (or move from their menu), which sticks between sessions, and a theme's menu copies it as a short code to share — paste a code into the list, or add it through the paste button, to get the theme in another Studio. Your own themes are edited scheme by scheme — a light mode and a dark mode card with accent/text/background pickers and a contrast slider each, the one the Studio is showing marked as active — add one from scratch, duplicate a preset to start from it, or take the colors from an image: its palette is read on device (the image is drawn onto a canvas and its vibrant and muted colors extracted right there, nothing is uploaded), the vibrant color becomes the accent (adjusted until a button label reads on it), the muted one the text color and the light and dark muted colors tint the backgrounds, and a row of variants previews the theme built around each swatch instead — with an "I'm feeling lucky" button that picks an interesting one. Themes can be removed and restored, and a dialog shows the `buildTheme` snippet that makes the applied theme permanent:
cursoragent and others added 9 commits October 2, 2026 17:17
The flip keyframes it refers to are gone; nothing else changes in the stylesheet.

Co-authored-by: Cody Olsen <[email protected]>
`PersistActorSnapshot` runs `syncThemer` — the cross-tab sync over BroadcastChannel with the one persisting tab elected through a Web Lock — in place of its own idle-deferred write, which is what makes `sync.ts` run at all.

Co-authored-by: Cody Olsen <[email protected]>
…are, and the title option

The layout's doc no longer describes machine tags that are gone (`panel`, `split`, `moving`) or a stylesheet by another name; the reducer's state and `initialToolState` get their docs; `ThemerProps` loses `images` and `view`, which the sidebar and the editor select from the actor now; the README describes the `title` option in place of the removed `config`.

Co-authored-by: Cody Olsen <[email protected]>
Adding the theme from an image opens the editor, which hides the list in an `Activity`: its effects are torn down, the mounted flag went false, and the flag stayed set — the picker was still loading when the list showed again. The list's state survives being hidden, so only the pick number guards the result now.

Co-authored-by: Cody Olsen <[email protected]>
The spin is a transform the motion value drives, which `MotionConfig`'s reduced-motion setting does not reach — as the icon's own doc promised, only the colors come and go now.

Co-authored-by: Cody Olsen <[email protected]>
…resolve the layout's background

`ThemerProvider` keeps the sidebar closed below the media index the sidebar needs, so the toggle there span its icon and set `open` without anything showing — `ThemerNavbar` no longer registers it there, and both read the threshold from one constant. The layout's background is the applied theme's resolved one, so a theme that only sets an accent has one too.

Co-authored-by: Cody Olsen <[email protected]>
…u, like the Studio's document footer

The header keeps the split preview toggle and the close button. The list's footer takes the applied theme on to the editor — `Edit` for a custom theme, `Duplicate & Edit` for a preset or the configured theme — with adding a theme (plain, from an image, from a shared code) and the applied theme's code behind the menu button; the editor's footer is `Done` with `Remove` in its menu; the removed themes get a `Done` footer in place of the header's back arrow. The hidden image input moves out of `ImageFileButton` into `ImageFileInput`, which the menu item clicks.

Co-authored-by: Cody Olsen <[email protected]>

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.

Comment on lines +34 to +38
// Whether this pick is still the latest one. Nothing checks whether the
// component still shows: adding the theme opens the editor, which hides
// the list in an `Activity` — its state survives that, and the flag
// must clear before the list shows again
const isCurrent = () => latestPickRef.current === pick
The Studio's own buttons are `padding: 2`, `gap: 2` at font size 1 — the sidebar footers were a size up. The primary actions carry an icon like the document footer's `Publish`: `Edit` a pencil, `Duplicate & Edit` a copy, `Done` a checkmark.

Co-authored-by: Cody Olsen <[email protected]>

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

🔵 Needs a closer look

The layout background can still differ from the adjusted background produced by the applied theme palette.

Review effort: Balanced
Findings: 3 High severity · 6 Medium severity · 2 Low severity

Open (11)
Previously missed (1)

In code that hasn't changed since last review

Medium severity Use the built palette background for split/view transitions

plugins/​@sanity/​themer/​src/​tool/​ThemerProvider.tsx:53

resolveThemeOptions is not the final background used by the applied theme: buildTheme goes through buildPalette, which can darken or lighten user-entered backgrounds to satisfy contrast (see theme/theme.test.ts:169-188). For example, a dark #888888 option makes this layout #888888 while the Studio uses the adjusted palette.dark.black, so the wrong color can still show behind split/view transitions. Derive this value from the built palette (dark.black / light.white) instead.

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.

<MenuItem icon={TrashIcon} onClick={onRemove} text="Remove" tone="critical" />
</Menu>
}
popover={{placement: 'top-end', portal: true}}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Suggested change
popover={{placement: 'top-end', portal: true}}
popover={{animate: true, placement: 'top-end', portal: true}}

)}
</Menu>
}
popover={{placement: 'top-end', portal: true}}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Suggested change
popover={{placement: 'top-end', portal: true}}
popover={{animate: true, placement: 'top-end', portal: true}}

Comment on lines +91 to +94
// The spin is a transform the motion value drives, which `MotionConfig`'s
// reduced-motion setting does not reach, so it is left out here
const reducedMotion = useReducedMotion()
const rotate = useTransform(progress, (value) => (reducedMotion ? 0 : wheelRotation(value)))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

no, this is the wrong place to have this. Put this one level up as there is no point at all in rendering <AnimatedColorWheelIcon> if it should have zero motion, <ColorWheelIcon> can be used instead

cursoragent and others added 3 commits October 5, 2026 11:42
Every element id — the menus of the cards and the footers, the two dialogs and the paste dialog's error the input is described by — comes from `useId()` instead of a hardcoded string, so two Studios on a page cannot share one. The footer menus animate like the cards' do.

Co-authored-by: Cody Olsen <[email protected]>
…motion

The check moves up to the navbar: there is nothing for `AnimatedColorWheelIcon` to do when nothing may move, so the plain `ColorWheelIcon` renders instead — and `motion/react` stays out of the navbar's chunk, as `usePrefersReducedMotion` comes from `@sanity/ui`.

Co-authored-by: Cody Olsen <[email protected]>
…for Safari

Safari (WebKit, as of Technology Preview 253) paints a filtered view-transition snapshot as raw layer contents and loses the `object-fit` stretch of `resizeStudioRules`, so the Studio scaled wrongly while it resized with the split copy; without the filter it animates as in Chrome. The blur now sits on the `::view-transition-image-pair`, which holds both snapshots and is a plain box, as one blur peaking at the cross-over — 6px, what the two 12px blurs on the snapshots crossfaded into at that point — while the snapshots keep the stretch and only fade.

Co-authored-by: Cody Olsen <[email protected]>

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

🔵 Needs a closer look

The transition backdrop can still differ from the adjusted background produced by the applied theme palette.

Review effort: Balanced
Findings: 3 High severity · 6 Medium severity · 2 Low severity

Open (11)
Previously missed (1)

In code that hasn't changed since last review

Medium severity Use generated palette color for the outer theme background

plugins/​@sanity/​themer/​src/​tool/​ThemerProvider.tsx:54

resolveThemeOptions returns the requested background, but buildTheme uses buildPalette, which can darken or lighten that value to enforce contrast (buildPalette.ts:106-114; covered by theme.test.ts:169-188). For example, a dark background of #888888 makes this outer layout #888888 while the themed Studio uses a darker palette.black, so the backdrop exposed during split/view transitions still has the wrong color. Derive this value from the same generated palette (the scheme's black/white) or a shared helper instead.

Comment on lines +51 to +54
// The resolved background, not the raw option: a theme that only sets an accent has one too
backgroundColor={
state.theme ? resolveThemeOptions(state.theme)[scheme].background : undefined
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Revert this change for now, and do it in a follow-up PR instead

const scheme = useColorSchemeValue()
const index = useMediaIndex()
const isMobile = index <= 2
const isMobile = index < MIN_MEDIA_INDEX_FOR_SIDEBAR

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Suggested change
const isMobile = index < MIN_MEDIA_INDEX_FOR_SIDEBAR
const isMobile = index <= MIN_MEDIA_INDEX_FOR_SIDEBAR

And MIN_MEDIA_INDEX_FOR_SIDEBAR should be 2 not 3

Comment on lines +142 to +146

// The tool has no layout for phone-sized screens yet: `ThemerProvider`
// keeps the sidebar closed there, so the toggle would do nothing
if (mediaIndex < MIN_MEDIA_INDEX_FOR_SIDEBAR) return props.renderDefault(props)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Revert this, the toolbar already handles the responsive breakpoints for us so we don't need to reconstruct __internal_actions in this way

}: Pick<ThemerProps, 'actorRef' | 'themes' | 'removed' | 'active'>) {
const {addThemeFromClipboard} = useThemeCodes({actorRef})
const [pasting, setPasting] = useState(false)
const [snippetOpen, setSnippetOpen] = useState(false)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This state, and the pasting state, should live in the state machine

cursoragent and others added 2 commits October 5, 2026 13:31
… were

Per review: the toolbar handles the responsive breakpoints itself, so the navbar does not reconstruct `__internal_actions` by media index; the sidebar threshold stays in `MIN_MEDIA_INDEX_FOR_SIDEBAR` (2, the largest index that is too small) for `ThemerProvider` alone; the resolved background comes back in a follow-up PR.

Co-authored-by: Cody Olsen <[email protected]>
The paste dialog and the applied theme's snippet dialog were `useState`s of the list. They are child states of the list flow now (`idle`, `pasting`, `snippet`), with `dialog.paste`, `dialog.snippet` — guarded on an applied listed theme, and left when it goes away — and `dialog.close`; leaving the list closes them. The persisted-snapshot schema accepts the nested value and restores to the plain list, so a dialog does not reopen after a reload.

Co-authored-by: Cody Olsen <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Comment on lines +64 to +67
* transition of its own. The Studio next to the sidebar always follows the
* appearance setting (light/dark/system) and the picked theme like any other
* theme would; the split preview adds a second copy in the opposite scheme
* on the far side.
const scheme = useColorSchemeValue()
const index = useMediaIndex()
const isMobile = index <= 2
const isMobile = index <= MIN_MEDIA_INDEX_FOR_SIDEBAR

This branch was successfully deployed

1 active deployment
Preview – plugins-studio — bfce6bd9 Deployed Oct 5, 2026 by vercel[bot]
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