@cyclone-ui/nextjs 0.0.13 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/README.md +86 -10
- package/dist/provider.cjs +1 -1
- package/dist/provider.d.cts +5 -4
- package/dist/provider.d.cts.map +1 -1
- package/dist/provider.d.mts +5 -4
- package/dist/provider.mjs +1 -1
- package/dist/provider.mjs.map +1 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog for Cyclone UI - Nextjs
|
|
4
4
|
|
|
5
|
+
## [0.0.14](https://github.com/storm-software/cyclone-ui/releases/tag/nextjs%400.0.14) (11/03/2026)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- **nextjs:** Improve our handling of NextJs cache component themes ([be9476b40](https://github.com/storm-software/cyclone-ui/commit/be9476b40))
|
|
10
|
+
|
|
11
|
+
### Updated Dependencies
|
|
12
|
+
|
|
13
|
+
- Updated **state** to **v0.0.44**
|
|
14
|
+
|
|
15
|
+
## [0.0.13](https://github.com/storm-software/cyclone-ui/releases/tag/nextjs%400.0.13) (11/03/2026)
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
- **theme-builder:** Added the `backdrop` color token and updated component responsiveness ([eaaf2aba9](https://github.com/storm-software/cyclone-ui/commit/eaaf2aba9))
|
|
20
|
+
|
|
21
|
+
### Updated Dependencies
|
|
22
|
+
|
|
23
|
+
- Updated **state** to **v0.0.43**
|
|
24
|
+
- Updated **theme-builder** to **v0.0.32**
|
|
25
|
+
- Updated **tokens** to **v0.3.31**
|
|
26
|
+
|
|
5
27
|
## [0.0.12](https://github.com/storm-software/cyclone-ui/releases/tag/nextjs%400.0.12) (11/03/2026)
|
|
6
28
|
|
|
7
29
|
### Updated Dependencies
|
package/README.md
CHANGED
|
@@ -52,7 +52,11 @@ before React hydrates, so add `suppressHydrationWarning` there:
|
|
|
52
52
|
// app/layout.tsx
|
|
53
53
|
import { CycloneUIProvider } from "@cyclone-ui/nextjs/provider";
|
|
54
54
|
|
|
55
|
-
export default function RootLayout({
|
|
55
|
+
export default function RootLayout({
|
|
56
|
+
children
|
|
57
|
+
}: {
|
|
58
|
+
children: React.ReactNode
|
|
59
|
+
}) {
|
|
56
60
|
return (
|
|
57
61
|
<html lang="en" suppressHydrationWarning>
|
|
58
62
|
<body>
|
|
@@ -73,7 +77,7 @@ import { useThemeSetting } from "@cyclone-ui/nextjs/provider";
|
|
|
73
77
|
export function ThemeToggle() {
|
|
74
78
|
const theme = useThemeSetting();
|
|
75
79
|
|
|
76
|
-
return <button onClick={theme.toggle}>
|
|
80
|
+
return <button onClick={theme.toggle}>Change theme</button>
|
|
77
81
|
}
|
|
78
82
|
```
|
|
79
83
|
|
|
@@ -81,6 +85,55 @@ export function ThemeToggle() {
|
|
|
81
85
|
Change the theme through `useThemeSetting`: `useThemeActions` changes the
|
|
82
86
|
Cyclone state only, so the choice isn't saved.
|
|
83
87
|
|
|
88
|
+
While `forcedTheme` is set, theme changes are blocked. Hide or disable the
|
|
89
|
+
toggle while a theme is forced; releasing it restores the stored preference.
|
|
90
|
+
System preference changes apply when the selected setting is `system`.
|
|
91
|
+
|
|
92
|
+
### Cache Components and static shells
|
|
93
|
+
|
|
94
|
+
Enable the caching options explicitly in the consuming App Router app:
|
|
95
|
+
|
|
96
|
+
```ts
|
|
97
|
+
import { withCycloneUI } from "@cyclone-ui/nextjs";
|
|
98
|
+
|
|
99
|
+
export default withCycloneUI({
|
|
100
|
+
cacheComponents: true,
|
|
101
|
+
partialPrefetching: true
|
|
102
|
+
});
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
`withCycloneUI` preserves these options; it does not enable them globally.
|
|
106
|
+
`partialPrefetching` requires `cacheComponents` and a Next.js version that
|
|
107
|
+
supports the option. It changes Link prefetch behavior to fetch the static App
|
|
108
|
+
Shell; it does not make request-dependent content static.
|
|
109
|
+
|
|
110
|
+
Keep the root layout synchronous and render `CycloneUIProvider` directly around
|
|
111
|
+
its children, as above. The provider does not read `cookies()` or `headers()`
|
|
112
|
+
on the server. Its inline script applies the saved or system theme to the same
|
|
113
|
+
prerendered shell before hydration. Keep the provider outside request-dependent
|
|
114
|
+
Suspense boundaries so it and its script are included in the shell.
|
|
115
|
+
|
|
116
|
+
Do not read a theme cookie in the root layout just to populate `mode`. `mode` is
|
|
117
|
+
an SSR/hydration fallback, not the user's persisted preference. `modeCookie` is
|
|
118
|
+
an optional client-written mirror of the resolved light/dark mode; it does not
|
|
119
|
+
require a server cookie read or preserve the distinction between system and an
|
|
120
|
+
explicit choice. If a server component needs request cookies, put that component
|
|
121
|
+
under a local `<Suspense>` boundary. Do not put cookie reads inside `"use cache"`
|
|
122
|
+
or move the whole provider behind that boundary. Cached Server Components can
|
|
123
|
+
be passed as children through the client provider.
|
|
124
|
+
|
|
125
|
+
Use semantic theme tokens and relative sub-themes such as `base` in the shell.
|
|
126
|
+
Avoid choosing server markup or literal colors from a browser theme preference.
|
|
127
|
+
Theme-dependent text from `useThemeSetting().current`, `resolvedTheme`,
|
|
128
|
+
`useRootTheme`, or `useThemeMode` must wait until that component mounts. These values can differ
|
|
129
|
+
between the server and the first browser render. The constant-label toggle
|
|
130
|
+
above needs no mount guard. If showing a current-mode label, guard only that
|
|
131
|
+
label/control, keeping the rest of the shell rendered. `suppressHydrationWarning`
|
|
132
|
+
on `<html>` does not suppress mismatches in descendants.
|
|
133
|
+
|
|
134
|
+
See [Next.js caching](https://nextjs.org/docs/app/getting-started/caching) and
|
|
135
|
+
[partialPrefetching](https://nextjs.org/docs/app/api-reference/config/next-config-js/partialPrefetching).
|
|
136
|
+
|
|
84
137
|
### Custom design tokens
|
|
85
138
|
|
|
86
139
|
Pass `tokens` to build the Tamagui config from your own design tokens instead
|
|
@@ -122,13 +175,13 @@ project root.
|
|
|
122
175
|
[`NextThemeProvider` props](https://tamagui.dev/docs/guides/next-js#themes)
|
|
123
176
|
(`defaultTheme`, `forcedTheme`, `storageKey`, `enableSystem`, and others), and:
|
|
124
177
|
|
|
125
|
-
| Prop | Default
|
|
126
|
-
| ------------------ |
|
|
127
|
-
| `config` | The config from `@cyclone-ui/tokens/tamagui` | The Tamagui config
|
|
128
|
-
| `disableInjectCSS` | `false`
|
|
129
|
-
| `skipNextHead` | `true`
|
|
130
|
-
| `mode` | `"light"`
|
|
131
|
-
| `modeCookie` | —
|
|
178
|
+
| Prop | Default | Description |
|
|
179
|
+
| ------------------ | -------------------------------------------- | ------------------------------------------------------------------------------------ |
|
|
180
|
+
| `config` | The config from `@cyclone-ui/tokens/tamagui` | The Tamagui config |
|
|
181
|
+
| `disableInjectCSS` | `false` | Skip runtime theme CSS when the app imports CSS generated by the Tamagui compiler |
|
|
182
|
+
| `skipNextHead` | `true` | Render the theme script inline. Set `false` in the Pages Router to use `next/script` |
|
|
183
|
+
| `mode` | `"light"` | The fallback mode shared by the server and initial client render |
|
|
184
|
+
| `modeCookie` | — | An optional client-written cookie containing the resolved mode |
|
|
132
185
|
|
|
133
186
|
### Webpack
|
|
134
187
|
|
|
@@ -140,7 +193,9 @@ as the second argument:
|
|
|
140
193
|
```ts
|
|
141
194
|
export default withCycloneUI(nextConfig, {
|
|
142
195
|
outputCSS:
|
|
143
|
-
process.env.NODE_ENV === "production"
|
|
196
|
+
process.env.NODE_ENV === "production"
|
|
197
|
+
? "./public/tamagui.generated.css"
|
|
198
|
+
: null,
|
|
144
199
|
disableExtraction: process.env.NODE_ENV === "development"
|
|
145
200
|
});
|
|
146
201
|
```
|
|
@@ -167,3 +222,24 @@ it with the Tamagui CLI (`@tamagui/cli`) before `next build`:
|
|
|
167
222
|
```bash
|
|
168
223
|
pnpm nx run nextjs:build
|
|
169
224
|
```
|
|
225
|
+
|
|
226
|
+
The production integration fixture exercises the source provider with Cache
|
|
227
|
+
Components and Partial Prefetching. From the workspace root (Node 22.18+ for
|
|
228
|
+
TypeScript imports in the fixture config), build and start it:
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
devenv shell -- env NODE_ENV=production node packages/nextjs/node_modules/next/dist/bin/next build packages/nextjs/test/fixture
|
|
232
|
+
devenv shell -- env NODE_ENV=production node packages/nextjs/node_modules/next/dist/bin/next start packages/nextjs/test/fixture -p 3197
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
In another terminal, run the browser checks with Playwright Chromium installed:
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
devenv shell -- node packages/nextjs/test/theme.browser.mjs
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
`CHROMIUM_PATH` selects an existing Chromium executable; `TEST_URL` overrides
|
|
242
|
+
`http://localhost:3197`. The checks cover shell CSS before hydration, persisted
|
|
243
|
+
preferences, forced themes, system changes, cookies, streamed content, and client
|
|
244
|
+
navigation. They use a mount-safe diagnostic label because a shared shell cannot
|
|
245
|
+
know the browser's stored preference.
|
package/dist/provider.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@cyclone-ui/state/theme"),t=require("@cyclone-ui/tokens/tamagui"),n=require("@tamagui/core"),r=require("@tamagui/next-theme"),i=require("next/navigation.js"),a=require("react"),o=require("react-native"),s=require("react/jsx-runtime");const c=[`light`,`dark`],l=({mode:t})=>{let{changeMode:
|
|
1
|
+
"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@cyclone-ui/state/theme"),t=require("@cyclone-ui/tokens/tamagui"),n=require("@tamagui/core"),r=require("@tamagui/next-theme"),i=require("next/navigation.js"),a=require("react"),o=require("react-native"),s=require("react/jsx-runtime");const c=[`light`,`dark`],l=({mode:t,onChangeMode:n,enableColorScheme:i})=>{let{forcedTheme:o,resolvedTheme:s}=(0,r.useThemeSetting)(),c=o??s,{changeMode:l}=(0,e.useThemeActions)();return(0,a.useLayoutEffect)(()=>{(c===`light`||c===`dark`)&&(n(c),i&&(document.documentElement.style.colorScheme=c))},[c,i,n]),(0,a.useEffect)(()=>{l(t)},[l,t]),null};function u({children:u,config:d=t.config,disableInjectCSS:f=!1,skipNextHead:p=!0,onChangeTheme:m,mode:h=`light`,modeCookie:g,..._}){let[v,y]=(0,a.useState)(h);return(0,a.useEffect)(()=>{g&&(document.cookie=`${g}=${v}; path=/; max-age=31536000; samesite=lax`)},[v,g]),(0,i.useServerInsertedHTML)(()=>{let e=o.StyleSheet.getSheet();return/* @__PURE__ */ (0,s.jsx)(`style`,{id:e.id,dangerouslySetInnerHTML:{__html:e.textContent}})}),/* @__PURE__ */ (0,s.jsx)(r.NextThemeProvider,{..._,skipNextHead:p,onChangeTheme:e=>{(e===`light`||e===`dark`)&&y(e),m?.(e)},children:/* @__PURE__ */ (0,s.jsxs)(e.ThemeApi.Provider,{scope:`theme`,initialState:{mode:v,items:c},children:[/* @__PURE__ */ (0,s.jsx)(l,{mode:v,onChangeMode:y,enableColorScheme:_.enableColorScheme??!0}),/* @__PURE__ */ (0,s.jsx)(n.TamaguiProvider,{config:d,defaultTheme:v,disableInjectCSS:f,children:/* @__PURE__ */ (0,s.jsx)(n.Theme,{name:`base`,children:u})})]})})}exports.CycloneUIProvider=u,Object.defineProperty(exports,"useRootTheme",{enumerable:!0,get:function(){return r.useRootTheme}}),Object.defineProperty(exports,"useThemeSetting",{enumerable:!0,get:function(){return r.useThemeSetting}});
|
package/dist/provider.d.cts
CHANGED
|
@@ -18,15 +18,16 @@ type CycloneUIProviderProps = PropsWithChildren<Omit<ThemeProviderProps$1, "chil
|
|
|
18
18
|
disableInjectCSS?: boolean;
|
|
19
19
|
/**
|
|
20
20
|
* The color mode the server rendered with. Hydration starts in this mode
|
|
21
|
-
* so
|
|
22
|
-
*
|
|
21
|
+
* so the initial client render matches the server HTML. Keep this fixed
|
|
22
|
+
* for a shared static shell; the browser preference is applied separately.
|
|
23
23
|
*
|
|
24
24
|
* @defaultValue "light"
|
|
25
25
|
*/
|
|
26
26
|
mode?: ColorThemeMode;
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
28
|
+
* An optional client-written cookie containing the resolved mode. Reading
|
|
29
|
+
* it on the server requires a dynamic boundary with Cache Components;
|
|
30
|
+
* omit it when only client-side theme persistence is needed.
|
|
30
31
|
*/
|
|
31
32
|
modeCookie?: string;
|
|
32
33
|
}>;
|
package/dist/provider.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.cts","names":["ThemeProviderProps"],"sources":["../src/provider.tsx"],"mappings":";;;;KAuCY,yBAAyB,kBACnC,KAAKA;;;;;;EAMH,SAAS;;;;;;;EAQT;;;;;;;;EASA,OAAO
|
|
1
|
+
{"version":3,"file":"provider.d.cts","names":["ThemeProviderProps"],"sources":["../src/provider.tsx"],"mappings":";;;;KAuCY,yBAAyB,kBACnC,KAAKA;;;;;;EAMH,SAAS;;;;;;;EAQT;;;;;;;;EASA,OAAO;;;;;;EAOP;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAmEY,oBACd,UACA,QACA,kBACA,cACA,eACA,MAAM,YACN,eACG,SACF,yCAAsB,IAAA"}
|
package/dist/provider.d.mts
CHANGED
|
@@ -18,15 +18,16 @@ type CycloneUIProviderProps = PropsWithChildren<Omit<ThemeProviderProps$1, "chil
|
|
|
18
18
|
disableInjectCSS?: boolean;
|
|
19
19
|
/**
|
|
20
20
|
* The color mode the server rendered with. Hydration starts in this mode
|
|
21
|
-
* so
|
|
22
|
-
*
|
|
21
|
+
* so the initial client render matches the server HTML. Keep this fixed
|
|
22
|
+
* for a shared static shell; the browser preference is applied separately.
|
|
23
23
|
*
|
|
24
24
|
* @defaultValue "light"
|
|
25
25
|
*/
|
|
26
26
|
mode?: ColorThemeMode;
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
28
|
+
* An optional client-written cookie containing the resolved mode. Reading
|
|
29
|
+
* it on the server requires a dynamic boundary with Cache Components;
|
|
30
|
+
* omit it when only client-side theme persistence is needed.
|
|
30
31
|
*/
|
|
31
32
|
modeCookie?: string;
|
|
32
33
|
}>;
|
package/dist/provider.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{ThemeApi as e,useThemeActions as t}from"@cyclone-ui/state/theme";import{config as n}from"@cyclone-ui/tokens/tamagui";import{TamaguiProvider as r,Theme as i}from"@tamagui/core";import{NextThemeProvider as a,useRootTheme as o,useThemeSetting as s}from"@tamagui/next-theme";import{useServerInsertedHTML as
|
|
1
|
+
"use client";import{ThemeApi as e,useThemeActions as t}from"@cyclone-ui/state/theme";import{config as n}from"@cyclone-ui/tokens/tamagui";import{TamaguiProvider as r,Theme as i}from"@tamagui/core";import{NextThemeProvider as a,useRootTheme as o,useThemeSetting as s,useThemeSetting as c}from"@tamagui/next-theme";import{useServerInsertedHTML as l}from"next/navigation.js";import{useEffect as u,useLayoutEffect as d,useState as f}from"react";import{StyleSheet as p}from"react-native";import{jsx as m,jsxs as h}from"react/jsx-runtime";const g=[`light`,`dark`],_=({mode:e,onChangeMode:n,enableColorScheme:r})=>{let{forcedTheme:i,resolvedTheme:a}=c(),o=i??a,{changeMode:s}=t();return d(()=>{(o===`light`||o===`dark`)&&(n(o),r&&(document.documentElement.style.colorScheme=o))},[o,r,n]),u(()=>{s(e)},[s,e]),null};function v({children:t,config:o=n,disableInjectCSS:s=!1,skipNextHead:c=!0,onChangeTheme:d,mode:v=`light`,modeCookie:y,...b}){let[x,S]=f(v);return u(()=>{y&&(document.cookie=`${y}=${x}; path=/; max-age=31536000; samesite=lax`)},[x,y]),l(()=>{let e=p.getSheet();return/* @__PURE__ */ m(`style`,{id:e.id,dangerouslySetInnerHTML:{__html:e.textContent}})}),/* @__PURE__ */ m(a,{...b,skipNextHead:c,onChangeTheme:e=>{(e===`light`||e===`dark`)&&S(e),d?.(e)},children:/* @__PURE__ */ h(e.Provider,{scope:`theme`,initialState:{mode:x,items:g},children:[/* @__PURE__ */ m(_,{mode:x,onChangeMode:S,enableColorScheme:b.enableColorScheme??!0}),/* @__PURE__ */ m(r,{config:o,defaultTheme:x,disableInjectCSS:s,children:/* @__PURE__ */ m(i,{name:`base`,children:t})})]})})}export{v as CycloneUIProvider,o as useRootTheme,s as useThemeSetting};
|
|
2
2
|
//# sourceMappingURL=provider.mjs.map
|
package/dist/provider.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.mjs","names":["cycloneConfig","config","ITEMS","SyncColorMode","useThemeActions","useEffect","changeMode","mode","CycloneUIProvider","config$1","config","serverMode","props","setMode","useState","
|
|
1
|
+
{"version":3,"file":"provider.mjs","names":["useThemeSetting","cycloneConfig","config","useThemeSetting$1","ITEMS","SyncColorMode","activeMode","forcedTheme","resolvedTheme","useThemeActions","useLayoutEffect","onChangeMode","enableColorScheme","useEffect","changeMode","mode","CycloneUIProvider","config$1","config","serverMode","props","setMode","useState","modeCookie","useServerInsertedHTML","sheet","StyleSheet","NextThemeProvider","name","onChangeTheme","ThemeApi","TamaguiProvider","Theme","useRootTheme","useThemeSetting"],"sources":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cyclone-ui/nextjs",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A Next.js config wrapper and root provider that set up Tamagui and Cyclone UI components in Next.js applications.",
|
|
6
6
|
"repository": {
|
|
@@ -45,16 +45,16 @@
|
|
|
45
45
|
"module": "./dist/index.mjs",
|
|
46
46
|
"types": "./dist/index.d.cts",
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@cyclone-ui/theme-builder": "0.0.
|
|
48
|
+
"@cyclone-ui/theme-builder": "0.0.33",
|
|
49
49
|
"@tamagui/next-theme": "3.0.13"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@cyclone-ui/state": "0.0.
|
|
53
|
-
"@cyclone-ui/tokens": "0.3.
|
|
52
|
+
"@cyclone-ui/state": "0.0.45",
|
|
53
|
+
"@cyclone-ui/tokens": "0.3.32",
|
|
54
54
|
"@tamagui/core": "3.0.13",
|
|
55
55
|
"@tamagui/next-plugin": "3.0.13",
|
|
56
56
|
"@tamagui/react-native-svg": "3.0.13",
|
|
57
|
-
"next": "^16.4.
|
|
57
|
+
"next": "^16.4.4",
|
|
58
58
|
"react": "^19.3.1",
|
|
59
59
|
"react-native": "^0.87.1",
|
|
60
60
|
"react-native-web": "0.19.12"
|
|
@@ -65,17 +65,17 @@
|
|
|
65
65
|
"react-native": { "optional": true }
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@cyclone-ui/state": "0.0.
|
|
69
|
-
"@cyclone-ui/tokens": "0.3.
|
|
68
|
+
"@cyclone-ui/state": "0.0.45",
|
|
69
|
+
"@cyclone-ui/tokens": "0.3.32",
|
|
70
70
|
"@powerlines/plugin-tsdown": "^0.1.619",
|
|
71
71
|
"@tamagui/core": "3.0.13",
|
|
72
72
|
"@tamagui/next-plugin": "3.0.13",
|
|
73
73
|
"@types/react": "^19.3.0",
|
|
74
|
-
"next": "^16.4.
|
|
74
|
+
"next": "^16.4.4",
|
|
75
75
|
"powerlines": "^0.47.218",
|
|
76
76
|
"react": "^19.3.1",
|
|
77
77
|
"react-native-web": "0.19.12"
|
|
78
78
|
},
|
|
79
79
|
"publishConfig": { "access": "public" },
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "2aea79c16eef482fc6e86a38189c8e404596803c"
|
|
81
81
|
}
|