@philiprehberger/react-theme-provider 0.1.5 → 0.1.7

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.
Files changed (2) hide show
  1. package/README.md +35 -5
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # @philiprehberger/react-theme-provider
2
2
 
3
- [![CI](https://github.com/philiprehberger/react-theme-provider/actions/workflows/publish.yml/badge.svg)](https://github.com/philiprehberger/react-theme-provider/actions/workflows/publish.yml)
3
+ [![CI](https://github.com/philiprehberger/react-theme-provider/actions/workflows/ci.yml/badge.svg)](https://github.com/philiprehberger/react-theme-provider/actions/workflows/ci.yml)
4
4
  [![npm version](https://img.shields.io/npm/v/@philiprehberger/react-theme-provider.svg)](https://www.npmjs.com/package/@philiprehberger/react-theme-provider)
5
- [![License](https://img.shields.io/github/license/philiprehberger/react-theme-provider)](LICENSE)
5
+ [![Last updated](https://img.shields.io/github/last-commit/philiprehberger/react-theme-provider)](https://github.com/philiprehberger/react-theme-provider/commits/main)
6
6
 
7
- Dark/light/system theme provider for React with localStorage persistence and system preference detection.
7
+ Dark/light/system theme provider for React with localStorage persistence and system preference detection
8
8
 
9
9
  ## Installation
10
10
 
@@ -54,6 +54,19 @@ import { ThemeToggle } from '@philiprehberger/react-theme-provider';
54
54
  <ThemeToggle />
55
55
  ```
56
56
 
57
+ ## API
58
+
59
+ | Export | Type | Description |
60
+ |--------|------|-------------|
61
+ | `ThemeProvider` | Component | Context provider with localStorage persistence and system preference detection |
62
+ | `useTheme()` | Hook | Returns `{ theme, setTheme, resolvedTheme }` for reading/setting theme |
63
+ | `ThemeToggle` | Component | Pre-built three-way toggle (light/dark/system) with sun/moon/system icons |
64
+ | `Theme` | Type | `'light' \| 'dark' \| 'system'` |
65
+ | `ResolvedTheme` | Type | `'light' \| 'dark'` (the actual applied theme) |
66
+ | `ThemeContextType` | Type | Shape of the theme context value |
67
+ | `ThemeProviderProps` | Type | Props for `ThemeProvider` (`children`, `storageKey?`, `defaultTheme?`) |
68
+ | `ThemeToggleProps` | Type | Props for `ThemeToggle` (`className?`, `activeClassName?`, `inactiveClassName?`) |
69
+
57
70
  ## How It Works
58
71
 
59
72
  - Applies `light` or `dark` class to `document.documentElement`
@@ -61,7 +74,6 @@ import { ThemeToggle } from '@philiprehberger/react-theme-provider';
61
74
  - Listens for system `prefers-color-scheme` changes when set to `system`
62
75
  - Works with Tailwind CSS `dark:` variant out of the box
63
76
 
64
-
65
77
  ## Development
66
78
 
67
79
  ```bash
@@ -70,6 +82,24 @@ npm run build
70
82
  npm test
71
83
  ```
72
84
 
85
+ ## Support
86
+
87
+ If you find this project useful:
88
+
89
+ ⭐ [Star the repo](https://github.com/philiprehberger/react-theme-provider)
90
+
91
+ 🐛 [Report issues](https://github.com/philiprehberger/react-theme-provider/issues?q=is%3Aissue+is%3Aopen+label%3Abug)
92
+
93
+ 💡 [Suggest features](https://github.com/philiprehberger/react-theme-provider/issues?q=is%3Aissue+is%3Aopen+label%3Aenhancement)
94
+
95
+ ❤️ [Sponsor development](https://github.com/sponsors/philiprehberger)
96
+
97
+ 🌐 [All Open Source Projects](https://philiprehberger.com/open-source-packages)
98
+
99
+ 💻 [GitHub Profile](https://github.com/philiprehberger)
100
+
101
+ 🔗 [LinkedIn Profile](https://www.linkedin.com/in/philiprehberger)
102
+
73
103
  ## License
74
104
 
75
- MIT
105
+ [MIT](LICENSE)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@philiprehberger/react-theme-provider",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Dark/light/system theme provider for React with localStorage persistence and system preference detection",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -24,7 +24,7 @@
24
24
  "scripts": {
25
25
  "build": "tsup",
26
26
  "dev": "tsup --watch",
27
- "test": "node --test src/__tests__/index.test.mjs",
27
+ "test": "node --test",
28
28
  "typecheck": "tsc --noEmit",
29
29
  "prepublishOnly": "npm run build"
30
30
  },