@cyclone-ui/nextjs 0.0.0-stage → 0.0.3

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 ADDED
@@ -0,0 +1,14 @@
1
+ ![Cyclone UI's logo banner](https://public.storm-cdn.com/cyclone-ui/media/banner-1280x320-dark.gif)
2
+
3
+ # Changelog for Cyclone UI - Nextjs
4
+
5
+ ## [0.0.2](https://github.com/storm-software/cyclone-ui/releases/tag/nextjs%400.0.2) (10/24/2026)
6
+
7
+ ### Features
8
+
9
+ - **nextjs:** Added NextJS and Vite build packages, setup skills, and documentation updates ([2759b41c](https://github.com/storm-software/cyclone-ui/commit/2759b41c))
10
+
11
+ ### Updated Dependencies
12
+
13
+ - Updated **state** to **v0.0.32**
14
+ - Updated **tokens** to **v0.3.20**
package/LICENSE ADDED
@@ -0,0 +1,187 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and
10
+ distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by the
13
+ copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all other
16
+ entities that control, are controlled by, or are under common control with
17
+ that entity. For the purposes of this definition, "control" means (i) the
18
+ power, direct or indirect, to cause the direction or management of such
19
+ entity, whether by contract or otherwise, or (ii) ownership of fifty percent
20
+ (50%) or more of the outstanding shares, or (iii) beneficial ownership of
21
+ such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
24
+ permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation source, and
28
+ configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical transformation or
31
+ translation of a Source form, including but not limited to compiled object
32
+ code, generated documentation, and conversions to other media types.
33
+
34
+ "Work" shall mean the work of authorship, whether in Source or Object form,
35
+ made available under the License, as indicated by a copyright notice that is
36
+ included in or attached to the work (an example is provided in the Appendix
37
+ below).
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object form,
40
+ that is based on (or derived from) the Work and for which the editorial
41
+ revisions, annotations, elaborations, or other modifications represent, as a
42
+ whole, an original work of authorship. For the purposes of this License,
43
+ Derivative Works shall not include works that remain separable from, or
44
+ merely link (or bind by name) to the interfaces of, the Work and Derivative
45
+ Works thereof.
46
+
47
+ "Contribution" shall mean any work of authorship, including the original
48
+ version of the Work and any modifications or additions to that Work or
49
+ Derivative Works thereof, that is intentionally submitted to Licensor for
50
+ inclusion in the Work by the copyright owner or by an individual or Legal
51
+ Entity authorized to submit on behalf of the copyright owner. For the
52
+ purposes of this definition, "submitted" means any form of electronic,
53
+ verbal, or written communication sent to the Licensor or its representatives,
54
+ including but not limited to communication on electronic mailing lists,
55
+ source code control systems, and issue tracking systems that are managed by,
56
+ or on behalf of, the Licensor for the purpose of discussing and improving the
57
+ Work, but excluding communication that is conspicuously marked or otherwise
58
+ designated in writing by the copyright owner as "Not a Contribution."
59
+
60
+ "Contributor" shall mean Licensor and any individual or Legal Entity on
61
+ behalf of whom a Contribution has been received by Licensor and subsequently
62
+ incorporated within the Work.
63
+
64
+ 2. Grant of Copyright License. Subject to the terms and conditions of this
65
+ License, each Contributor hereby grants to You a perpetual, worldwide,
66
+ non-exclusive, no-charge, royalty-free, irrevocable copyright license to
67
+ reproduce, prepare Derivative Works of, publicly display, publicly perform,
68
+ sublicense, and distribute the Work and such Derivative Works in Source or
69
+ Object form.
70
+
71
+ 3. Grant of Patent License. Subject to the terms and conditions of this License,
72
+ each Contributor hereby grants to You a perpetual, worldwide, non-exclusive,
73
+ no-charge, royalty-free, irrevocable (except as stated in this section)
74
+ patent license to make, have made, use, offer to sell, sell, import, and
75
+ otherwise transfer the Work, where such license applies only to those patent
76
+ claims licensable by such Contributor that are necessarily infringed by their
77
+ Contribution(s) alone or by combination of their Contribution(s) with the
78
+ Work to which such Contribution(s) was submitted. If You institute patent
79
+ litigation against any entity (including a cross-claim or counterclaim in a
80
+ lawsuit) alleging that the Work or a Contribution incorporated within the
81
+ Work constitutes direct or contributory patent infringement, then any patent
82
+ licenses granted to You under this License for that Work shall terminate as
83
+ of the date such litigation is filed.
84
+
85
+ 4. Redistribution. You may reproduce and distribute copies of the Work or
86
+ Derivative Works thereof in any medium, with or without modifications, and in
87
+ Source or Object form, provided that You meet the following conditions:
88
+
89
+ (a) You must give any other recipients of the Work or Derivative Works a copy
90
+ of this License; and
91
+
92
+ (b) You must cause any modified files to carry prominent notices stating that
93
+ You changed the files; and
94
+
95
+ (c) You must retain, in the Source form of any Derivative Works that You
96
+ distribute, all copyright, patent, trademark, and attribution notices from
97
+ the Source form of the Work, excluding those notices that do not pertain to
98
+ any part of the Derivative Works; and
99
+
100
+ (d) If the Work includes a "NOTICE" text file as part of its distribution,
101
+ then any Derivative Works that You distribute must include a readable copy of
102
+ the attribution notices contained within such NOTICE file, excluding those
103
+ notices that do not pertain to any part of the Derivative Works, in at least
104
+ one of the following places: within a NOTICE text file distributed as part of
105
+ the Derivative Works; within the Source form or documentation, if provided
106
+ along with the Derivative Works; or, within a display generated by the
107
+ Derivative Works, if and wherever such third-party notices normally appear.
108
+ The contents of the NOTICE file are for informational purposes only and do
109
+ not modify the License. You may add Your own attribution notices within
110
+ Derivative Works that You distribute, alongside or as an addendum to the
111
+ NOTICE text from the Work, provided that such additional attribution notices
112
+ cannot be construed as modifying the License.
113
+
114
+ You may add Your own copyright statement to Your modifications and may
115
+ provide additional or different license terms and conditions for use,
116
+ reproduction, or distribution of Your modifications, or for any such
117
+ Derivative Works as a whole, provided Your use, reproduction, and
118
+ distribution of the Work otherwise complies with the conditions stated in
119
+ this License.
120
+
121
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any
122
+ Contribution intentionally submitted for inclusion in the Work by You to the
123
+ Licensor shall be under the terms and conditions of this License, without any
124
+ additional terms or conditions. Notwithstanding the above, nothing herein
125
+ shall supersede or modify the terms of any separate license agreement you may
126
+ have executed with Licensor regarding such Contributions.
127
+
128
+ 6. Trademarks. This License does not grant permission to use the trade names,
129
+ trademarks, service marks, or product names of the Licensor, except as
130
+ required for reasonable and customary use in describing the origin of the
131
+ Work and reproducing the content of the NOTICE file.
132
+
133
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
134
+ writing, Licensor provides the Work (and each Contributor provides its
135
+ Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
136
+ KIND, either express or implied, including, without limitation, any
137
+ warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or
138
+ FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining
139
+ the appropriateness of using or redistributing the Work and assume any risks
140
+ associated with Your exercise of permissions under this License.
141
+
142
+ 8. Limitation of Liability. In no event and under no legal theory, whether in
143
+ tort (including negligence), contract, or otherwise, unless required by
144
+ applicable law (such as deliberate and grossly negligent acts) or agreed to
145
+ in writing, shall any Contributor be liable to You for damages, including any
146
+ direct, indirect, special, incidental, or consequential damages of any
147
+ character arising as a result of this License or out of the use or inability
148
+ to use the Work (including but not limited to damages for loss of goodwill,
149
+ work stoppage, computer failure or malfunction, or any and all other
150
+ commercial damages or losses), even if such Contributor has been advised of
151
+ the possibility of such damages.
152
+
153
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or
154
+ Derivative Works thereof, You may choose to offer, and charge a fee for,
155
+ acceptance of support, warranty, indemnity, or other liability obligations
156
+ and/or rights consistent with this License. However, in accepting such
157
+ obligations, You may act only on Your own behalf and on Your sole
158
+ responsibility, not on behalf of any other Contributor, and only if You agree
159
+ to indemnify, defend, and hold each Contributor harmless for any liability
160
+ incurred by, or claims asserted against, such Contributor by reason of your
161
+ accepting any such warranty or additional liability.
162
+
163
+ END OF TERMS AND CONDITIONS
164
+
165
+ APPENDIX: How to apply the Apache License to your work.
166
+
167
+ To apply the Apache License to your work, attach the following
168
+ boilerplate notice, with the fields enclosed by brackets "[]"
169
+ replaced with your own identifying information. (Don't include
170
+ the brackets!) The text should be enclosed in the appropriate
171
+ comment syntax for the file format. We also recommend that a
172
+ file or class name and description of purpose be included on the
173
+ same "printed page" as the copyright notice for easier
174
+ identification within third-party archives.
175
+
176
+ Copyright [yyyy] [name of copyright owner]
177
+
178
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
179
+ this file except in compliance with the License. You may obtain a copy of the
180
+ License at
181
+
182
+ http://www.apache.org/licenses/LICENSE-2.0
183
+
184
+ Unless required by applicable law or agreed to in writing, software distributed
185
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
186
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
187
+ specific language governing permissions and limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,167 @@
1
- # Temporary Holding Version
1
+ # @cyclone-ui/nextjs
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Set up [Tamagui](https://tamagui.dev) and Cyclone UI components in a Next.js
4
+ application. The package has two entry points:
5
+
6
+ - `@cyclone-ui/nextjs`: `withCycloneUI`, a wrapper for `next.config.ts`
7
+ - `@cyclone-ui/nextjs/provider`: `CycloneUIProvider`, the root client provider
8
+ with server-rendered light and dark themes
9
+
10
+ They follow the [Tamagui Next.js guide](https://tamagui.dev/docs/guides/next-js),
11
+ using `@tamagui/next-plugin` and `@tamagui/next-theme`.
12
+
13
+ ## Quick Features
14
+
15
+ - Turbopack aliases for `react-native` → `react-native-web` and
16
+ `react-native-svg` → `@tamagui/react-native-svg`
17
+ - The Tamagui compiler for Webpack builds through `@tamagui/next-plugin`
18
+ - Builds the Tamagui config from your own design tokens (`tokens` option)
19
+ - Defines `process.env.TAMAGUI_TARGET`, which Cyclone components read to render
20
+ web-only styles
21
+ - Stores the light, dark or system setting and applies it before hydration
22
+ - Collects react-native-web styles during server rendering
23
+
24
+ ## Installing
25
+
26
+ Using [pnpm](http://pnpm.io):
27
+
28
+ ```bash
29
+ pnpm add @cyclone-ui/nextjs @cyclone-ui/state @cyclone-ui/tokens @tamagui/core jotai react-native-web
30
+ ```
31
+
32
+ Add `@tamagui/react-native-svg` if the app renders SVG icons, and
33
+ `@tamagui/next-plugin` if it builds with Webpack.
34
+
35
+ ## Usage
36
+
37
+ Wrap the Next.js config:
38
+
39
+ ```ts
40
+ // next.config.ts
41
+ import { withCycloneUI } from "@cyclone-ui/nextjs";
42
+
43
+ export default withCycloneUI({
44
+ reactStrictMode: true
45
+ });
46
+ ```
47
+
48
+ Render the provider in the root layout. The provider sets a class on `<html>`
49
+ before React hydrates, so add `suppressHydrationWarning` there:
50
+
51
+ ```tsx
52
+ // app/layout.tsx
53
+ import { CycloneUIProvider } from "@cyclone-ui/nextjs/provider";
54
+
55
+ export default function RootLayout({ children }: { children: React.ReactNode }) {
56
+ return (
57
+ <html lang="en" suppressHydrationWarning>
58
+ <body>
59
+ <CycloneUIProvider>{children}</CycloneUIProvider>
60
+ </body>
61
+ </html>
62
+ );
63
+ }
64
+ ```
65
+
66
+ Read or change the theme with `useThemeSetting`:
67
+
68
+ ```tsx
69
+ "use client";
70
+
71
+ import { useThemeSetting } from "@cyclone-ui/nextjs/provider";
72
+
73
+ export function ThemeToggle() {
74
+ const theme = useThemeSetting();
75
+
76
+ return <button onClick={theme.toggle}>Theme: {theme.current}</button>;
77
+ }
78
+ ```
79
+
80
+ `useThemeMode` from `@cyclone-ui/state/theme` also returns the active mode.
81
+ Change the theme through `useThemeSetting`: `useThemeActions` changes the
82
+ Cyclone state only, so the choice isn't saved.
83
+
84
+ ### Custom design tokens
85
+
86
+ Pass `tokens` to build the Tamagui config from your own design tokens instead
87
+ of the Cyclone UI defaults. Use a DTCG token object, or token file paths or
88
+ globs relative to the working directory:
89
+
90
+ ```ts
91
+ // next.config.ts
92
+ import { withCycloneUI } from "@cyclone-ui/nextjs";
93
+
94
+ export default withCycloneUI(
95
+ { reactStrictMode: true },
96
+ {
97
+ tokens: [
98
+ "tokens/primitives.json",
99
+ "tokens/light.tokens.json",
100
+ "tokens/dark.tokens.json"
101
+ ]
102
+ }
103
+ );
104
+ ```
105
+
106
+ Files with a theme name (`light.tokens.json`, `dark.tokens.json`, …) become
107
+ the `light` and `dark` themes. The tokens go through the same preprocessor and
108
+ generator as `@cyclone-ui/tokens`, and a `razorwind.config.ts` in the project
109
+ still applies (for example its fonts).
110
+
111
+ With `tokens`, `withCycloneUI` returns a promise, which Next.js accepts as the
112
+ config export. The config is written to `.cyclone-ui/tamagui.config.ts`
113
+ (add `.cyclone-ui` to `.gitignore`) and replaces `@cyclone-ui/tokens/tamagui`
114
+ everywhere, so `CycloneUIProvider` and the Webpack compiler use it. With
115
+ pnpm, Webpack builds also need `@tamagui/web` and `motion` installed in the
116
+ app, because the Tamagui compiler evaluates the generated config from the
117
+ project root.
118
+
119
+ ### Provider props
120
+
121
+ `CycloneUIProvider` accepts the
122
+ [`NextThemeProvider` props](https://tamagui.dev/docs/guides/next-js#themes)
123
+ (`defaultTheme`, `forcedTheme`, `storageKey`, `enableSystem`, and others), and:
124
+
125
+ | Prop | Default | Description |
126
+ | ------------------ | ----------------------------------------- | ------------------------------------------------------------------------------------- |
127
+ | `config` | The config from `@cyclone-ui/tokens/tamagui` | The Tamagui config |
128
+ | `disableInjectCSS` | `false` | Skip runtime theme CSS when the app imports CSS generated by the Tamagui compiler |
129
+ | `skipNextHead` | `true` | Render the theme script inline. Set `false` in the Pages Router to use `next/script` |
130
+
131
+ ### Webpack
132
+
133
+ `next build --webpack` and `next dev --webpack` run the Tamagui compiler through
134
+ `@tamagui/next-plugin`. Install it, then pass any
135
+ [plugin options](https://tamagui.dev/docs/guides/next-js#older-versions-webpack)
136
+ as the second argument:
137
+
138
+ ```ts
139
+ export default withCycloneUI(nextConfig, {
140
+ outputCSS:
141
+ process.env.NODE_ENV === "production" ? "./public/tamagui.generated.css" : null,
142
+ disableExtraction: process.env.NODE_ENV === "development"
143
+ });
144
+ ```
145
+
146
+ The defaults are `config: "@cyclone-ui/tokens/tamagui"`,
147
+ `components: ["@tamagui/core"]` and `appDir: true`. A `tamagui.build.ts` file
148
+ in the project root overrides them.
149
+
150
+ ### Optimizing Turbopack builds
151
+
152
+ Turbopack doesn't run the Tamagui compiler. To optimize production builds, run
153
+ it with the Tamagui CLI (`@tamagui/cli`) before `next build`:
154
+
155
+ ```json
156
+ {
157
+ "scripts": {
158
+ "build": "tamagui build --target web ./app -- next build"
159
+ }
160
+ }
161
+ ```
162
+
163
+ ## Development
164
+
165
+ ```bash
166
+ pnpm nx run nextjs:build
167
+ ```
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("node:module"),t=require("node:path");const n=(n,r,i)=>({...n,env:{TAMAGUI_TARGET:`web`,...n.env},turbopack:{...n.turbopack,resolveAlias:{"react-native":`react-native-web`,"react-native-svg":`@tamagui/react-native-svg`,...i&&{"@cyclone-ui/tokens/tamagui":`./${(0,t.relative)(process.cwd(),i)}`},...n.turbopack?.resolveAlias}},webpack:(a,o)=>{let{withTamagui:s}=(0,e.createRequire)((0,t.join)(o.dir,`package.json`))(`@tamagui/next-plugin`),c=s({config:i??`@cyclone-ui/tokens/tamagui`,components:[`@tamagui/core`],appDir:!0,...r})(n).webpack(a,o);return i&&(c.resolve.alias[`@cyclone-ui/tokens/tamagui$`]=i),c}});function r(e={},{tokens:t,...r}={}){return t?import(`@cyclone-ui/theme-builder`).then(async({buildTamaguiConfig:e})=>e({tokens:t})).then(t=>n(e,r,t)):n(e,r)}exports.withCycloneUI=r;
@@ -0,0 +1,67 @@
1
+ import { BuildTamaguiConfigOptions } from "@cyclone-ui/theme-builder";
2
+ import { WithTamaguiProps } from "@tamagui/next-plugin";
3
+ import { NextConfig } from "next";
4
+ /**
5
+ * The design tokens, plus options forwarded to `@tamagui/next-plugin` when
6
+ * Next.js builds with Webpack.
7
+ */
8
+ type WithCycloneUIOptions = Partial<WithTamaguiProps> & {
9
+ /**
10
+ * Design tokens to build the app's Tamagui config from: a DTCG token
11
+ * object, or token file path(s) or globs relative to the working directory.
12
+ * Theme-named files (`light.tokens.json`, `dark.tokens.json`, …) become the
13
+ * `light` / `dark` themes.
14
+ *
15
+ * @remarks
16
+ * The config is generated into `.cyclone-ui/tamagui.config.ts` (add
17
+ * `.cyclone-ui` to `.gitignore`) when Next.js loads its config, and replaces
18
+ * `@cyclone-ui/tokens/tamagui` for the compiler and every import in the app,
19
+ * including `CycloneUIProvider`.
20
+ *
21
+ * @defaultValue The Cyclone UI config from `@cyclone-ui/tokens/tamagui`
22
+ */
23
+ tokens?: BuildTamaguiConfigOptions["tokens"];
24
+ };
25
+ /**
26
+ * Wrap a Next.js config with the setup Tamagui and Cyclone UI components need.
27
+ *
28
+ * @remarks
29
+ * - Turbopack (the Next.js default): aliases `react-native` to
30
+ * `react-native-web` and `react-native-svg` to `@tamagui/react-native-svg`.
31
+ * - Webpack (`next build --webpack`): applies `@tamagui/next-plugin`, which
32
+ * must be installed, with the Cyclone UI Tamagui config.
33
+ * - Both: defines `process.env.TAMAGUI_TARGET`.
34
+ *
35
+ * With `tokens`, the Tamagui config is built from them first, so this returns
36
+ * a promise, which Next.js accepts as the config export.
37
+ *
38
+ * Turbopack builds don't run the Tamagui compiler. To optimize them, use the
39
+ * Tamagui CLI: `tamagui build --target web ./src -- next build`.
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * // next.config.ts
44
+ * import { withCycloneUI } from "@cyclone-ui/nextjs";
45
+ *
46
+ * export default withCycloneUI({ reactStrictMode: true });
47
+ * ```
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * // next.config.ts — build the Tamagui config from your own tokens
52
+ * import { withCycloneUI } from "@cyclone-ui/nextjs";
53
+ *
54
+ * export default withCycloneUI({}, { tokens: "tokens/**\/*.json" });
55
+ * ```
56
+ *
57
+ * @param nextConfig - The Next.js config to extend.
58
+ * @param options - The design `tokens`, plus options forwarded to
59
+ * `@tamagui/next-plugin` (Webpack only).
60
+ * @returns The extended Next.js config.
61
+ */
62
+ declare function withCycloneUI(nextConfig?: NextConfig, options?: WithCycloneUIOptions & {
63
+ tokens?: undefined;
64
+ }): NextConfig;
65
+ declare function withCycloneUI(nextConfig: NextConfig | undefined, options: WithCycloneUIOptions): NextConfig | Promise<NextConfig>;
66
+ export { WithCycloneUIOptions, withCycloneUI };
67
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;KA4BY,uBAAuB,QAAQ;;;;;;;;;;;;;;;EAezC,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkFK,cACd,aAAa,YACb,UAAU;EAAyB;IAClC;iBACa,cACd,YAAY,wBACZ,SAAS,uBACR,aAAa,QAAQ"}
@@ -0,0 +1,67 @@
1
+ import { BuildTamaguiConfigOptions } from "@cyclone-ui/theme-builder";
2
+ import { WithTamaguiProps } from "@tamagui/next-plugin";
3
+ import { NextConfig } from "next";
4
+ /**
5
+ * The design tokens, plus options forwarded to `@tamagui/next-plugin` when
6
+ * Next.js builds with Webpack.
7
+ */
8
+ type WithCycloneUIOptions = Partial<WithTamaguiProps> & {
9
+ /**
10
+ * Design tokens to build the app's Tamagui config from: a DTCG token
11
+ * object, or token file path(s) or globs relative to the working directory.
12
+ * Theme-named files (`light.tokens.json`, `dark.tokens.json`, …) become the
13
+ * `light` / `dark` themes.
14
+ *
15
+ * @remarks
16
+ * The config is generated into `.cyclone-ui/tamagui.config.ts` (add
17
+ * `.cyclone-ui` to `.gitignore`) when Next.js loads its config, and replaces
18
+ * `@cyclone-ui/tokens/tamagui` for the compiler and every import in the app,
19
+ * including `CycloneUIProvider`.
20
+ *
21
+ * @defaultValue The Cyclone UI config from `@cyclone-ui/tokens/tamagui`
22
+ */
23
+ tokens?: BuildTamaguiConfigOptions["tokens"];
24
+ };
25
+ /**
26
+ * Wrap a Next.js config with the setup Tamagui and Cyclone UI components need.
27
+ *
28
+ * @remarks
29
+ * - Turbopack (the Next.js default): aliases `react-native` to
30
+ * `react-native-web` and `react-native-svg` to `@tamagui/react-native-svg`.
31
+ * - Webpack (`next build --webpack`): applies `@tamagui/next-plugin`, which
32
+ * must be installed, with the Cyclone UI Tamagui config.
33
+ * - Both: defines `process.env.TAMAGUI_TARGET`.
34
+ *
35
+ * With `tokens`, the Tamagui config is built from them first, so this returns
36
+ * a promise, which Next.js accepts as the config export.
37
+ *
38
+ * Turbopack builds don't run the Tamagui compiler. To optimize them, use the
39
+ * Tamagui CLI: `tamagui build --target web ./src -- next build`.
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * // next.config.ts
44
+ * import { withCycloneUI } from "@cyclone-ui/nextjs";
45
+ *
46
+ * export default withCycloneUI({ reactStrictMode: true });
47
+ * ```
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * // next.config.ts — build the Tamagui config from your own tokens
52
+ * import { withCycloneUI } from "@cyclone-ui/nextjs";
53
+ *
54
+ * export default withCycloneUI({}, { tokens: "tokens/**\/*.json" });
55
+ * ```
56
+ *
57
+ * @param nextConfig - The Next.js config to extend.
58
+ * @param options - The design `tokens`, plus options forwarded to
59
+ * `@tamagui/next-plugin` (Webpack only).
60
+ * @returns The extended Next.js config.
61
+ */
62
+ declare function withCycloneUI(nextConfig?: NextConfig, options?: WithCycloneUIOptions & {
63
+ tokens?: undefined;
64
+ }): NextConfig;
65
+ declare function withCycloneUI(nextConfig: NextConfig | undefined, options: WithCycloneUIOptions): NextConfig | Promise<NextConfig>;
66
+ export { WithCycloneUIOptions, withCycloneUI };
67
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":""}
package/dist/index.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import{createRequire as e}from"node:module";import{join as t,relative as n}from"node:path";const r=(r,i,a)=>({...r,env:{TAMAGUI_TARGET:`web`,...r.env},turbopack:{...r.turbopack,resolveAlias:{"react-native":`react-native-web`,"react-native-svg":`@tamagui/react-native-svg`,...a&&{"@cyclone-ui/tokens/tamagui":`./${n(process.cwd(),a)}`},...r.turbopack?.resolveAlias}},webpack:(n,o)=>{let{withTamagui:s}=e(t(o.dir,`package.json`))(`@tamagui/next-plugin`),c=s({config:a??`@cyclone-ui/tokens/tamagui`,components:[`@tamagui/core`],appDir:!0,...i})(r).webpack(n,o);return a&&(c.resolve.alias[`@cyclone-ui/tokens/tamagui$`]=a),c}});function i(e={},{tokens:t,...n}={}){return t?import(`@cyclone-ui/theme-builder`).then(async({buildTamaguiConfig:e})=>e({tokens:t})).then(t=>r(e,n,t)):r(e,n)}export{i as withCycloneUI};
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["extend","nextConfig","configPath","relative","createRequire","join","context","result","withTamagui","options","config","withCycloneUI","tokens","buildTamaguiConfig"],"sources":[],"mappings":""}
@@ -0,0 +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:n}=(0,e.useThemeActions)();return(0,a.useEffect)(()=>{n(t)},[n,t]),null};function u({children:a,config:u=t.config,disableInjectCSS:d=!1,skipNextHead:f=!0,onChangeTheme:p,...m}){let[h,g]=(0,r.useRootTheme)();return(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,{...m,skipNextHead:f,onChangeTheme:e=>{g(e),p?.(e)},children:/* @__PURE__ */ (0,s.jsxs)(e.ThemeApi.Provider,{scope:`theme`,initialState:{mode:h,items:c},children:[/* @__PURE__ */ (0,s.jsx)(l,{mode:h}),/* @__PURE__ */ (0,s.jsx)(n.TamaguiProvider,{config:u,defaultTheme:h,disableInjectCSS:d,children:/* @__PURE__ */ (0,s.jsx)(n.Theme,{name:`${h}_base`,children:a})})]})})}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}});
@@ -0,0 +1,47 @@
1
+ import { TamaguiProviderProps } from "@tamagui/core";
2
+ import { ColorScheme, ThemeProviderProps, ThemeProviderProps as ThemeProviderProps$1, UseThemeProps, useRootTheme, useThemeSetting } from "@tamagui/next-theme";
3
+ import { PropsWithChildren } from "react";
4
+ type CycloneUIProviderProps = PropsWithChildren<Omit<ThemeProviderProps$1, "children"> & {
5
+ /**
6
+ * The Tamagui config.
7
+ *
8
+ * @defaultValue The Cyclone UI config from `@cyclone-ui/tokens/tamagui`
9
+ */
10
+ config?: TamaguiProviderProps["config"];
11
+ /**
12
+ * Skip injecting the Tamagui theme and token CSS at runtime. Set this when
13
+ * the app imports CSS generated by the Tamagui compiler (`outputCSS`).
14
+ *
15
+ * @defaultValue false
16
+ */
17
+ disableInjectCSS?: boolean;
18
+ }>;
19
+ /**
20
+ * The root provider for Cyclone UI components in a Next.js app.
21
+ *
22
+ * @remarks
23
+ * Renders `NextThemeProvider` from `@tamagui/next-theme`, which stores the
24
+ * light/dark/system setting and applies it before hydration, around a
25
+ * `TamaguiProvider` and the matching `<mode>_base` theme. It also collects
26
+ * react-native-web styles during server rendering. Read or change the theme
27
+ * with `useThemeSetting`.
28
+ *
29
+ * @example
30
+ * ```tsx
31
+ * // app/layout.tsx
32
+ * import { CycloneUIProvider } from "@cyclone-ui/nextjs/provider";
33
+ *
34
+ * export default function RootLayout({ children }: { children: React.ReactNode }) {
35
+ * return (
36
+ * <html lang="en" suppressHydrationWarning>
37
+ * <body>
38
+ * <CycloneUIProvider>{children}</CycloneUIProvider>
39
+ * </body>
40
+ * </html>
41
+ * );
42
+ * }
43
+ * ```
44
+ */
45
+ declare function CycloneUIProvider({ children, config, disableInjectCSS, skipNextHead, onChangeTheme, ...props }: CycloneUIProviderProps): import("react").JSX.Element;
46
+ export { type ColorScheme, CycloneUIProvider, CycloneUIProviderProps, type ThemeProviderProps, type UseThemeProps, useRootTheme, useThemeSetting };
47
+ //# sourceMappingURL=provider.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.d.cts","names":["ThemeProviderProps"],"sources":["../src/provider.tsx"],"mappings":";;;KAuCY,yBAAyB,kBACnC,KAAKA;;;;;;EAMH,SAAS;;;;;;;EAQT;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4CY,oBACd,UACA,QACA,kBACA,cACA,kBACG,SACF,yCAAsB,IAAA"}
@@ -0,0 +1,47 @@
1
+ import { TamaguiProviderProps } from "@tamagui/core";
2
+ import { ColorScheme, ThemeProviderProps, ThemeProviderProps as ThemeProviderProps$1, UseThemeProps, useRootTheme, useThemeSetting } from "@tamagui/next-theme";
3
+ import { PropsWithChildren } from "react";
4
+ type CycloneUIProviderProps = PropsWithChildren<Omit<ThemeProviderProps$1, "children"> & {
5
+ /**
6
+ * The Tamagui config.
7
+ *
8
+ * @defaultValue The Cyclone UI config from `@cyclone-ui/tokens/tamagui`
9
+ */
10
+ config?: TamaguiProviderProps["config"];
11
+ /**
12
+ * Skip injecting the Tamagui theme and token CSS at runtime. Set this when
13
+ * the app imports CSS generated by the Tamagui compiler (`outputCSS`).
14
+ *
15
+ * @defaultValue false
16
+ */
17
+ disableInjectCSS?: boolean;
18
+ }>;
19
+ /**
20
+ * The root provider for Cyclone UI components in a Next.js app.
21
+ *
22
+ * @remarks
23
+ * Renders `NextThemeProvider` from `@tamagui/next-theme`, which stores the
24
+ * light/dark/system setting and applies it before hydration, around a
25
+ * `TamaguiProvider` and the matching `<mode>_base` theme. It also collects
26
+ * react-native-web styles during server rendering. Read or change the theme
27
+ * with `useThemeSetting`.
28
+ *
29
+ * @example
30
+ * ```tsx
31
+ * // app/layout.tsx
32
+ * import { CycloneUIProvider } from "@cyclone-ui/nextjs/provider";
33
+ *
34
+ * export default function RootLayout({ children }: { children: React.ReactNode }) {
35
+ * return (
36
+ * <html lang="en" suppressHydrationWarning>
37
+ * <body>
38
+ * <CycloneUIProvider>{children}</CycloneUIProvider>
39
+ * </body>
40
+ * </html>
41
+ * );
42
+ * }
43
+ * ```
44
+ */
45
+ declare function CycloneUIProvider({ children, config, disableInjectCSS, skipNextHead, onChangeTheme, ...props }: CycloneUIProviderProps): import("react").JSX.Element;
46
+ export { type ColorScheme, CycloneUIProvider, CycloneUIProviderProps, type ThemeProviderProps, type UseThemeProps, useRootTheme, useThemeSetting };
47
+ //# sourceMappingURL=provider.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.d.mts","names":["ThemeProviderProps"],"sources":["../src/provider.tsx"],"mappings":""}
@@ -0,0 +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,useRootTheme as s,useThemeSetting as c}from"@tamagui/next-theme";import{useServerInsertedHTML as l}from"next/navigation.js";import{useEffect as u}from"react";import{StyleSheet as d}from"react-native";import{jsx as f,jsxs as p}from"react/jsx-runtime";const m=[`light`,`dark`],h=({mode:e})=>{let{changeMode:n}=t();return u(()=>{n(e)},[n,e]),null};function g({children:t,config:o=n,disableInjectCSS:c=!1,skipNextHead:u=!0,onChangeTheme:g,..._}){let[v,y]=s();return l(()=>{let e=d.getSheet();return/* @__PURE__ */ f(`style`,{id:e.id,dangerouslySetInnerHTML:{__html:e.textContent}})}),/* @__PURE__ */ f(a,{..._,skipNextHead:u,onChangeTheme:e=>{y(e),g?.(e)},children:/* @__PURE__ */ p(e.Provider,{scope:`theme`,initialState:{mode:v,items:m},children:[/* @__PURE__ */ f(h,{mode:v}),/* @__PURE__ */ f(r,{config:o,defaultTheme:v,disableInjectCSS:c,children:/* @__PURE__ */ f(i,{name:`${v}_base`,children:t})})]})})}export{g as CycloneUIProvider,o as useRootTheme,c as useThemeSetting};
2
+ //# sourceMappingURL=provider.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.mjs","names":["cycloneConfig","useRootTheme","config","useRootTheme$1","ITEMS","SyncColorMode","useThemeActions","useEffect","changeMode","mode","CycloneUIProvider","config$1","config","props","setMode","useServerInsertedHTML","sheet","StyleSheet","NextThemeProvider","name","onChangeTheme","ThemeApi","TamaguiProvider","Theme","useRootTheme","useThemeSetting"],"sources":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,81 @@
1
1
  {
2
2
  "name": "@cyclone-ui/nextjs",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.0.3",
4
+ "type": "module",
5
+ "description": "A Next.js config wrapper and root provider that set up Tamagui and Cyclone UI components in Next.js applications.",
6
+ "repository": {
7
+ "type": "github",
8
+ "url": "https://github.com/storm-software/cyclone-ui.git",
9
+ "directory": "packages/nextjs"
10
+ },
11
+ "private": false,
12
+ "keywords": ["cyclone-ui", "tamagui", "nextjs", "next-plugin"],
13
+ "exports": {
14
+ ".": {
15
+ "require": {
16
+ "types": "./dist/index.d.cts",
17
+ "default": "./dist/index.cjs"
18
+ },
19
+ "import": {
20
+ "types": "./dist/index.d.mts",
21
+ "default": "./dist/index.mjs"
22
+ },
23
+ "default": {
24
+ "types": "./dist/index.d.mts",
25
+ "default": "./dist/index.mjs"
26
+ }
27
+ },
28
+ "./package.json": "./package.json",
29
+ "./provider": {
30
+ "require": {
31
+ "types": "./dist/provider.d.cts",
32
+ "default": "./dist/provider.cjs"
33
+ },
34
+ "import": {
35
+ "types": "./dist/provider.d.mts",
36
+ "default": "./dist/provider.mjs"
37
+ },
38
+ "default": {
39
+ "types": "./dist/provider.d.mts",
40
+ "default": "./dist/provider.mjs"
41
+ }
42
+ }
43
+ },
44
+ "main": "./dist/index.cjs",
45
+ "module": "./dist/index.mjs",
46
+ "types": "./dist/index.d.cts",
47
+ "dependencies": {
48
+ "@cyclone-ui/theme-builder": "0.0.22",
49
+ "@tamagui/next-theme": "3.0.13"
50
+ },
51
+ "peerDependencies": {
52
+ "@cyclone-ui/state": "0.0.33",
53
+ "@cyclone-ui/tokens": "0.3.21",
54
+ "@tamagui/core": "3.0.13",
55
+ "@tamagui/next-plugin": "3.0.13",
56
+ "@tamagui/react-native-svg": "3.0.13",
57
+ "next": "^16.4.3",
58
+ "react": "^19.3.1",
59
+ "react-native": "^0.87.1",
60
+ "react-native-web": "0.19.12"
61
+ },
62
+ "peerDependenciesMeta": {
63
+ "@tamagui/next-plugin": { "optional": true },
64
+ "@tamagui/react-native-svg": { "optional": true },
65
+ "react-native": { "optional": true }
66
+ },
67
+ "devDependencies": {
68
+ "@cyclone-ui/state": "0.0.33",
69
+ "@cyclone-ui/tokens": "0.3.21",
70
+ "@powerlines/plugin-tsdown": "^0.1.618",
71
+ "@tamagui/core": "3.0.13",
72
+ "@tamagui/next-plugin": "3.0.13",
73
+ "@types/react": "^19.3.0",
74
+ "next": "^16.4.3",
75
+ "powerlines": "^0.47.217",
76
+ "react": "^19.3.1",
77
+ "react-native-web": "0.19.12"
78
+ },
79
+ "publishConfig": { "access": "public" },
80
+ "gitHead": "68d40b14f80f4c14e19d0491cdca0148fadfcf10"
81
+ }