@philiprehberger/react-theme-provider 0.1.5 → 0.1.6
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/README.md +16 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# @philiprehberger/react-theme-provider
|
|
2
2
|
|
|
3
|
-
[](https://github.com/philiprehberger/ts-react-theme-provider/actions/workflows/ci.yml)
|
|
4
4
|
[](https://www.npmjs.com/package/@philiprehberger/react-theme-provider)
|
|
5
|
-
[](LICENSE)
|
|
5
|
+
[](LICENSE)
|
|
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`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@philiprehberger/react-theme-provider",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
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
|
|
27
|
+
"test": "node --test",
|
|
28
28
|
"typecheck": "tsc --noEmit",
|
|
29
29
|
"prepublishOnly": "npm run build"
|
|
30
30
|
},
|