diff --git a/README.md b/README.md index 4c3c9d5b..51c964de 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# React 18 Themes [![test](https://github.com/mayank1513/react18-themes/actions/workflows/test.yml/badge.svg)](https://github.com/mayank1513/react18-themes/actions/workflows/test.yml) [![codecov](https://codecov.io/gh/mayank1513/react18-themes/graph/badge.svg)](https://codecov.io/gh/mayank1513/react18-themes) [![Version](https://img.shields.io/npm/v/react18-themes.svg?colorB=green)](https://www.npmjs.com/package/react18-themes) [![Downloads](https://img.jsdelivr.com/img.shields.io/npm/dt/react18-themes.svg)](https://www.npmjs.com/package/react18-themes) [![Unit Tests](https://github.com/mayank1513/react18-themes/actions/workflows/test.yml/badge.svg)](https://github.com/mayank1513/react18-themes/actions/workflows/test.yml) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react18-themes) [![Get help](codementor.svg)](https://www.codementor.io/@mayank1513?refer=badge) +# React 18 Themes [![test](https://github.com/mayank1513/react18-themes/actions/workflows/test.yml/badge.svg)](https://github.com/mayank1513/react18-themes/actions/workflows/test.yml) [![codecov](https://codecov.io/gh/mayank1513/react18-themes/graph/badge.svg)](https://codecov.io/gh/mayank1513/react18-themes) [![Version](https://img.shields.io/npm/v/react18-themes.svg?colorB=green)](https://www.npmjs.com/package/react18-themes) [![Downloads](https://img.jsdelivr.com/img.shields.io/npm/dt/react18-themes.svg)](https://www.npmjs.com/package/react18-themes) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react18-themes) [![Get help](codementor.svg)](https://www.codementor.io/@mayank1513?refer=badge) 🤟 👉 [Unleash the Power of React Server Components](https://medium.com/javascript-in-plain-english/unleash-the-power-of-react-server-components-eb3fe7201231) diff --git a/examples/nextjs/CHANGELOG.md b/examples/nextjs/CHANGELOG.md index a848322f..2e85117f 100644 --- a/examples/nextjs/CHANGELOG.md +++ b/examples/nextjs/CHANGELOG.md @@ -1,5 +1,12 @@ # nextjs-example +## 0.0.3 + +### Patch Changes + +- Updated dependencies + - react18-themes@1.0.9 + ## 0.0.2 ### Patch Changes diff --git a/examples/nextjs/package.json b/examples/nextjs/package.json index 9ce9df40..2f1a3b3e 100644 --- a/examples/nextjs/package.json +++ b/examples/nextjs/package.json @@ -1,6 +1,6 @@ { "name": "nextjs-example", - "version": "0.0.2", + "version": "0.0.3", "private": true, "scripts": { "dev": "next dev", @@ -9,17 +9,17 @@ "lint": "next lint" }, "dependencies": { - "@mayank1513/fork-me": "^1.0.0", - "next": "^13.4.19", + "@mayank1513/fork-me": "^1.1.2", + "next": "^13.5.4", "react": "^18.2.0", "react-dom": "^18.2.0", "react18-themes": "workspace:*" }, "devDependencies": { - "@next/eslint-plugin-next": "^13.4.19", - "@types/node": "^20.6.2", - "@types/react": "^18.2.21", - "@types/react-dom": "^18.2.7", + "@next/eslint-plugin-next": "^13.5.4", + "@types/node": "^20.8.4", + "@types/react": "^18.2.28", + "@types/react-dom": "^18.2.13", "eslint-config-custom": "workspace:*", "tsconfig": "workspace:*", "typescript": "^5.2.2" diff --git a/examples/vite/CHANGELOG.md b/examples/vite/CHANGELOG.md index a16934ea..281cd1cb 100644 --- a/examples/vite/CHANGELOG.md +++ b/examples/vite/CHANGELOG.md @@ -1,5 +1,12 @@ # vite-example +## 0.0.3 + +### Patch Changes + +- Updated dependencies + - react18-themes@1.0.9 + ## 0.0.2 ### Patch Changes diff --git a/examples/vite/package.json b/examples/vite/package.json index 798c289d..e350a060 100644 --- a/examples/vite/package.json +++ b/examples/vite/package.json @@ -1,7 +1,7 @@ { "name": "vite-example", "private": true, - "version": "0.0.2", + "version": "0.0.3", "type": "module", "scripts": { "dev": "vite --port 3001", @@ -10,21 +10,21 @@ "preview": "vite preview" }, "dependencies": { - "@mayank1513/fork-me": "^1.0.0", + "@mayank1513/fork-me": "^1.1.2", "react": "^18.2.0", "react-dom": "^18.2.0", "react18-themes": "workspace:*" }, "devDependencies": { - "@types/react": "^18.2.21", - "@types/react-dom": "^18.2.7", - "@typescript-eslint/eslint-plugin": "^6.7.0", - "@typescript-eslint/parser": "^6.7.0", - "@vitejs/plugin-react-swc": "^3.3.2", - "eslint": "^8.49.0", + "@types/react": "^18.2.28", + "@types/react-dom": "^18.2.13", + "@typescript-eslint/eslint-plugin": "^6.7.5", + "@typescript-eslint/parser": "^6.7.5", + "@vitejs/plugin-react-swc": "^3.4.0", + "eslint": "^8.51.0", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.4.3", "typescript": "^5.2.2", - "vite": "^4.4.9" + "vite": "^4.4.11" } } diff --git a/examples/vite/src/App.tsx b/examples/vite/src/App.tsx index dc0b39f8..284f4cf6 100644 --- a/examples/vite/src/App.tsx +++ b/examples/vite/src/App.tsx @@ -1,4 +1,3 @@ -import { useState } from "react"; import reactLogo from "./assets/react.svg"; import viteLogo from "/vite.svg"; import { ThemeSwitcher } from "react18-themes"; diff --git a/package.json b/package.json index d944afcb..a47d24f9 100644 --- a/package.json +++ b/package.json @@ -9,10 +9,10 @@ }, "devDependencies": { "@changesets/cli": "^2.26.2", - "eslint": "^8.49.0", + "eslint": "^8.51.0", "prettier": "^3.0.3", "tsconfig": "workspace:*", - "turbo": "^1.10.14" + "turbo": "^1.10.15" }, "packageManager": "pnpm@8.6.10", "name": "react18-themes" diff --git a/packages/eslint-config-custom/package.json b/packages/eslint-config-custom/package.json index 1a178c7f..1b9873e1 100644 --- a/packages/eslint-config-custom/package.json +++ b/packages/eslint-config-custom/package.json @@ -5,6 +5,6 @@ "private": true, "devDependencies": { "@vercel/style-guide": "^5.0.1", - "eslint-config-turbo": "^1.10.14" + "eslint-config-turbo": "^1.10.15" } } diff --git a/packages/react18-themes/CHANGELOG.md b/packages/react18-themes/CHANGELOG.md index 105a2617..cc704cb8 100644 --- a/packages/react18-themes/CHANGELOG.md +++ b/packages/react18-themes/CHANGELOG.md @@ -1,5 +1,11 @@ # react18-themes +## 1.0.9 + +### Patch Changes + +- Add `data-color-scheme` attribute -> we will be simplifying the library use in near future + ## 1.0.7 ### Patch Changes diff --git a/packages/react18-themes/package.json b/packages/react18-themes/package.json index 94a44093..077a1121 100644 --- a/packages/react18-themes/package.json +++ b/packages/react18-themes/package.json @@ -2,7 +2,7 @@ "name": "react18-themes", "author": "Mayank Kumar Chaudhari ", "private": false, - "version": "1.0.8", + "version": "1.0.9", "description": "Unleash the Power of React Server Components! Use multiple themes on your site with confidence, without losing any advantages of React Server Components.", "main": "./index.ts", "types": "./index.ts", @@ -24,32 +24,30 @@ }, "devDependencies": { "@testing-library/react": "^14.0.0", - "@turbo/gen": "^1.10.14", - "@types/node": "^20.6.2", - "@types/react": "^18.2.21", - "@types/react-dom": "^18.2.7", - "@vitejs/plugin-react": "^4.0.4", - "@vitest/coverage-v8": "^0.34.4", - "esbuild-plugin-ignoretests": "^0.0.3", - "esbuild-plugin-removetestid": "^0.0.3", - "esbuild-react18-useclient": "^1.0.5", + "@turbo/gen": "^1.10.15", + "@types/node": "^20.8.4", + "@types/react": "^18.2.28", + "@types/react-dom": "^18.2.13", + "@vitejs/plugin-react": "^4.1.0", + "@vitest/coverage-v8": "^0.34.6", + "esbuild-plugin-react18": "^0.0.5", "eslint-config-custom": "workspace:*", "jsdom": "^22.1.0", - "next": "^13.4.19", - "octokit": "^3.1.0", + "next": "^13.5.4", + "octokit": "^3.1.1", "persist-and-sync": "^0.1.1", "react": "^18.2.0", "tsconfig": "workspace:*", "tsup": "^7.2.0", "typescript": "5.2.2", "vite-tsconfig-paths": "^4.2.1", - "vitest": "^0.34.4", - "zustand": "^4.4.1" + "vitest": "^0.34.6", + "zustand": "^4.4.3" }, "peerDependencies": { - "@types/react": "^16.8 || ^17 || ^18", - "next": "^8", - "react": "^16.8 || ^17 || ^18" + "@types/react": "16.8 - 18", + "next": "10 - 13", + "react": "16.8 - 18" }, "peerDependenciesMeta": { "next": { diff --git a/packages/react18-themes/src/client/theme-switcher/theme-switcher.tsx b/packages/react18-themes/src/client/theme-switcher/theme-switcher.tsx index b1941a2e..0f9b5e08 100644 --- a/packages/react18-themes/src/client/theme-switcher/theme-switcher.tsx +++ b/packages/react18-themes/src/client/theme-switcher/theme-switcher.tsx @@ -44,6 +44,7 @@ export function ThemeSwitcher(props: { } newTheme = newTheme === undefined ? theme : newTheme; document.documentElement.setAttribute("data-theme", newTheme); + document.documentElement.setAttribute("data-color-scheme", colorScheme); /** do not create cookie for forced page as they will interfere with normal prefs */ if (!forcedColorScheme && forcedTheme === undefined) document.cookie = `data-theme=${newTheme}`; diff --git a/packages/react18-themes/tsup.config.ts b/packages/react18-themes/tsup.config.ts index b8dfeb6b..75f602eb 100644 --- a/packages/react18-themes/tsup.config.ts +++ b/packages/react18-themes/tsup.config.ts @@ -1,7 +1,5 @@ import { defineConfig } from "tsup"; -import reactUseClientPlugin from "esbuild-react18-useclient"; -import ignoretestsPlugin from "esbuild-plugin-ignoretests"; -import removeTestidPluging from "esbuild-plugin-removetestid"; +import react18Plugin from "esbuild-plugin-react18"; // eslint-disable-next-line import/no-default-export -- export default is required for config files export default defineConfig(options => ({ @@ -10,6 +8,6 @@ export default defineConfig(options => ({ sourcemap: false, clean: true, minify: !options.watch, - esbuildPlugins: [reactUseClientPlugin, ignoretestsPlugin(), removeTestidPluging()], + esbuildPlugins: [react18Plugin()], legacyOutput: true, })); diff --git a/turbo.json b/turbo.json index 7f7738cf..26c4f88b 100644 --- a/turbo.json +++ b/turbo.json @@ -4,7 +4,7 @@ "pipeline": { "build": { "dependsOn": ["^build"], - "outputs": [".next/**", "!.next/cache/**"] + "outputs": [".next/**", "!.next/cache/**", "dist/**", "build/**", "public/build/**"] }, "lint": {}, "test": {},