feat(nextjs): export Mosaic UserButton from an experimental subpath - #9338
feat(nextjs): export Mosaic UserButton from an experimental subpath#9338alexcarpenter wants to merge 2 commits into
Conversation
🦋 Changeset detectedLatest commit: 68af5d1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
!snapshot mosaic-user-button |
|
!snapshot mosaic-user-button |
This comment has been minimized.
This comment has been minimized.
|
!snapshot mosaic-user-button |
This comment has been minimized.
This comment has been minimized.
|
!snapshot |
This comment has been minimized.
This comment has been minimized.
2510022 to
f20871a
Compare
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/electron
@clerk/electron-passkeys
@clerk/eslint-plugin
@clerk/expo
@clerk/expo-google-signin
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
API Changes Report
Summary
🔴 Breaking changes index (1)Every breaking change, up front. Full diffs are in the package sections below.
@clerk/uiCurrent version: 1.28.0 Subpath
|
f20871a to
f0a356d
Compare
|
!snapshot |
|
Hey @alexcarpenter - the snapshot version command generated the following package versions:
Tip: Use the snippet copy button below to quickly install the required packages. npm i @clerk/astro@4.0.7-snapshot.v20260805161708 --save-exact
npm i @clerk/backend@3.15.2-snapshot.v20260805161708 --save-exact
npm i @clerk/chrome-extension@3.1.66-snapshot.v20260805161708 --save-exact
npm i @clerk/clerk-js@6.27.0-snapshot.v20260805161708 --save-exact
npm i @clerk/electron@0.0.27-snapshot.v20260805161708 --save-exact
npm i @clerk/electron-passkeys@0.0.4-snapshot.v20260805161708 --save-exact
npm i @clerk/eslint-plugin@0.2.1-snapshot.v20260805161708 --save-exact
npm i @clerk/expo@4.2.2-snapshot.v20260805161708 --save-exact
npm i @clerk/expo-google-signin@1.0.1-snapshot.v20260805161708 --save-exact
npm i @clerk/expo-passkeys@2.0.6-snapshot.v20260805161708 --save-exact
npm i @clerk/express@2.1.51-snapshot.v20260805161708 --save-exact
npm i @clerk/fastify@3.1.61-snapshot.v20260805161708 --save-exact
npm i @clerk/headless@0.0.20-snapshot.v20260805161708 --save-exact
npm i @clerk/hono@0.1.61-snapshot.v20260805161708 --save-exact
npm i @clerk/localizations@4.14.1-snapshot.v20260805161708 --save-exact
npm i @clerk/msw@0.0.56-snapshot.v20260805161708 --save-exact
npm i @clerk/nextjs@7.7.0-snapshot.v20260805161708 --save-exact
npm i @clerk/nuxt@3.0.3-snapshot.v20260805161708 --save-exact
npm i @clerk/react@6.13.0-snapshot.v20260805161708 --save-exact
npm i @clerk/react-router@3.6.5-snapshot.v20260805161708 --save-exact
npm i @clerk/shared@4.27.0-snapshot.v20260805161708 --save-exact
npm i @clerk/swingset@0.0.30-snapshot.v20260805161708 --save-exact
npm i @clerk/tanstack-react-start@1.4.28-snapshot.v20260805161708 --save-exact
npm i @clerk/testing@2.2.18-snapshot.v20260805161708 --save-exact
npm i @clerk/ui@1.29.0-snapshot.v20260805161708 --save-exact
npm i @clerk/upgrade@2.0.5-snapshot.v20260805161708 --save-exact
npm i @clerk/vue@2.4.24-snapshot.v20260805161708 --save-exact |
f0a356d to
f34b620
Compare
f34b620 to
22d1b0b
Compare
|
!snapshot |
Adds `@clerk/nextjs/experimental/mosaic` (via `@clerk/react` and `@clerk/ui`) so the Mosaic UserButton can mount directly in a host app's tree, plus the matching `experimental/mosaic/styles.css`. The `@clerk/ui` mosaic entry is now a client boundary in whole (the bundle collapses the per-file directives) and is guarded against Emotion creeping back in, which meant replacing the UserButton trigger skeleton with StyleX.
The experimental subpath pointed at `src/mosaic/styles`, which is the StyleX build barrel: it pulls every migrated component into the graph so one stylesheet can be extracted. Publishing it made all of those components, and the headless primitive types behind them, part of the API. Give the export its own narrow entry instead. `@clerk/headless` is private, so leaving it external published a dependency that 404s on install. Bundling it broke differently: the declaration builder cannot follow the re-export chains in its emitted `dist/*.d.ts`. Correct the `tsconfig.mosaic.json` paths so it resolves to source (primitives live under `src/primitives`, so the old wildcard missed menu, popover, dialog and tabs and silently fell back to `dist`). StyleX moves to devDependencies and gets bundled: it compiles away at build time, so consumers should not inherit our version.
22d1b0b to
68af5d1
Compare
|
!snapshot |
Description
Stacked on #9191.
Adds an experimental subpath so Mosaic components mount directly in the host app's tree rather than being rendered by clerk-js.
UserButtonis the first one. It reads Clerk through hooks, so aClerkProviderabove it is all it needs:The chain is
@clerk/nextjs→@clerk/react→@clerk/ui, each subpath re-exporting the one below it.Stylesheet delivery. A package can't re-export a CSS file from a dependency, so
@clerk/reactand@clerk/nextjseach ship a physical copy written byscripts/copy-mosaic-styles.mjsduring their own builds. Worth knowing when working locally: rebuilding@clerk/uialone leaves those copies stale.Emotion guard.
check-mosaic-emotion-free.mjsfails the@clerk/uibuild if@emotionappears indist-mosaic/index.js. Mounting in the host tree means anything Emotion reachable from the barrel ships a second styling runtime to every consumer, and a singlesxprop orBoxin the graph is enough to pull it back in silently.Stylesheet move. In
@clerk/uithe Mosaic stylesheet moves from@clerk/ui/styles.cssto@clerk/ui/experimental/mosaic/styles.css, to sit alongside the components it styles. Called out in the changeset.Browser support. The sheet ships
light-dark()andoklch()unpolyfilled: Lightning CSS targets are pinned to Chrome/Edge 123, Firefox 121, Safari/iOS 17.5, because down-levellinglight-dark()emits invalid two-token color values. Below those versions the colors silently do not apply. That floor is not documented on the export yet.Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change