Skip to content

Commit d176afa

Browse files
authored
Merge pull request #34 from react18-tools/fix-imports
Fix imports
2 parents 1c0b28f + d8851eb commit d176afa

File tree

15 files changed

+69
-15
lines changed

15 files changed

+69
-15
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ interface UseThemeYield {
220220
### Next.js App Router
221221

222222
```tsx
223-
import { ForceTheme } from "nextjs-themes";
223+
import { ForceTheme } from "nextjs-themes/force-theme";
224224

225225
function MyPage() {
226226
return (
@@ -234,6 +234,8 @@ function MyPage() {
234234
export default MyPage;
235235
```
236236

237+
> If you are using TypeScript and have not set nodeResolution to `Bundler` or `Node16` or `NodeNext`, you need to import from `nextjs-themes/client/force-theme`
238+
237239
### Next.js Pages Router
238240

239241
For the pages router, you have two options. The first option is the same as the app router, and the second option, which is compatible with `next-themes`, involves adding the `theme` property to your page component like this:

examples/app-router/src/app/forced-color-scheme/[colorScheme]/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { ColorSchemeType } from "nextjs-themes";
2-
import { ForceColorScheme } from "nextjs-themes";
2+
import { ForceColorScheme } from "nextjs-themes/force-color-scheme";
33

44
interface PageWithForcedColorSchemeProps {
55
params: { colorScheme: ColorSchemeType };

examples/app-router/src/app/forced-color-scheme/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ForceColorScheme } from "nextjs-themes";
1+
import { ForceColorScheme } from "nextjs-themes/force-color-scheme";
22

33
export default function PageWithForcedColorScheme(): JSX.Element {
44
return (

examples/app-router/src/app/themed-page/[theme]/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ForceTheme } from "nextjs-themes";
1+
import { ForceTheme } from "nextjs-themes/force-theme";
22

33
interface PageProps {
44
params: { theme: string };

examples/app-router/src/app/themed-page/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ForceTheme } from "nextjs-themes";
1+
import { ForceTheme } from "nextjs-themes/force-theme";
22

33
export default function PageWithForcedTheme(): JSX.Element {
44
return (

examples/pages-router/src/pages/forced-color-scheme/[colorScheme].tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useRouter } from "next/router";
2-
import { ColorSchemeType, ForceColorScheme } from "nextjs-themes";
2+
import { ColorSchemeType } from "nextjs-themes";
3+
import { ForceColorScheme } from "nextjs-themes/force-color-scheme";
34

45
export default function PageWithForcedColorScheme() {
56
const router = useRouter();

examples/pages-router/src/pages/themed-page/[theme].tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useRouter } from "next/router";
2-
import { ForceTheme } from "nextjs-themes";
2+
import { ForceTheme } from "nextjs-themes/force-theme";
33

44
export default function PageWithForcedTheme() {
55
const router = useRouter();

examples/vite/src/app/forced-color-scheme-page.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from "react";
2-
import { ColorSchemeType, ForceColorScheme } from "nextjs-themes";
2+
import { ColorSchemeType } from "nextjs-themes";
3+
import { ForceColorScheme } from "nextjs-themes/force-color-scheme";
34
import { Link, useParams } from "react-router-dom";
45
import { Header } from "@repo/shared";
56

examples/vite/src/app/themed-page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from "react";
22
import { Link, useParams } from "react-router-dom";
3-
import { ForceTheme } from "nextjs-themes";
3+
import { ForceTheme } from "nextjs-themes/force-theme";
44
import { Header } from "@repo/shared";
55

66
export default function ThemedPage() {

lib/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# nextjs-themes
22

3+
## 3.1.7
4+
5+
### Patch Changes
6+
7+
- 99a0702: Update exports.
8+
39
## 3.1.6
410

511
### Patch Changes

lib/package.json

+22-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "nextjs-themes",
33
"author": "Mayank Kumar Chaudhari <https://mayank-chaudhari.vercel.app>",
44
"private": false,
5-
"version": "3.1.6",
5+
"version": "3.1.7",
66
"description": "Unleash the Power of React Server Components! Use multiple themes on your site with confidence, without losing any advantages of React Server Components.",
77
"license": "MPL-2.0",
88
"main": "./dist/index.js",
@@ -46,6 +46,26 @@
4646
"import": "./dist/client/theme-switcher/index.mjs",
4747
"types": "./dist/client/theme-switcher/index.d.ts"
4848
},
49+
"./client/force-color-scheme": {
50+
"require": "./dist/client/force-color-scheme/index.js",
51+
"import": "./dist/client/force-color-scheme/index.mjs",
52+
"types": "./dist/client/force-color-scheme/index.d.ts"
53+
},
54+
"./force-color-scheme": {
55+
"require": "./dist/client/force-color-scheme/index.js",
56+
"import": "./dist/client/force-color-scheme/index.mjs",
57+
"types": "./dist/client/force-color-scheme/index.d.ts"
58+
},
59+
"./client/force-theme": {
60+
"require": "./dist/client/force-theme/index.js",
61+
"import": "./dist/client/force-theme/index.mjs",
62+
"types": "./dist/client/force-theme/index.d.ts"
63+
},
64+
"./force-theme": {
65+
"require": "./dist/client/force-theme/index.js",
66+
"import": "./dist/client/force-theme/index.mjs",
67+
"types": "./dist/client/force-theme/index.d.ts"
68+
},
4969
"./server": {
5070
"require": "./dist/server/index.js",
5171
"import": "./dist/server/index.mjs",
@@ -104,7 +124,7 @@
104124
"vitest": "^1.6.0"
105125
},
106126
"dependencies": {
107-
"r18gs": "^1.1.3"
127+
"r18gs": "^2.0.0-alpha.0"
108128
},
109129
"peerDependencies": {
110130
"@types/react": "16.8 - 19",

lib/src/client/force-theme/force-theme.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { cleanup, render } from "@testing-library/react";
22
import { afterEach, describe, test } from "vitest";
3-
import { DARK, DEFAULT_ID } from "../../constants";
3+
import { DEFAULT_ID } from "../../constants";
44
import { ThemeSwitcher } from "../theme-switcher";
55
import { noFOUCScript } from "../theme-switcher/no-fouc";
66
import { initialState } from "../../store";

packages/shared/CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# @repo/shared
22

3+
## 0.0.5
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [99a0702]
8+
- nextjs-themes@3.1.7
9+
310
## 0.0.4
411

512
### Patch Changes

packages/shared/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@repo/shared",
3-
"version": "0.0.4",
3+
"version": "0.0.5",
44
"private": true,
55
"sideEffects": false,
66
"main": "./dist/index.js",

pnpm-lock.yaml

+19-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)