@rific/auto-paper 0.1.0 → 0.1.1
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/LICENSE +21 -0
- package/README.md +20 -27
- package/dist/index.d.mts +5 -11
- package/dist/index.d.ts +5 -11
- package/dist/index.js +9 -30
- package/dist/index.mjs +7 -19
- package/package.json +55 -41
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jay Deaton
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -7,8 +7,7 @@ Adaptive theming for [`react-native-paper`](https://callstack.github.io/react-na
|
|
|
7
7
|
- Triadic color palette from a single seed color (primary → secondary → tertiary, 120° apart on the color wheel)
|
|
8
8
|
- System/light/dark appearance with live updates via `Appearance` API
|
|
9
9
|
- Tinted surface, surfaceVariant, outline, and elevation levels derived from the seed
|
|
10
|
-
-
|
|
11
|
-
- Optional Redux slice (`themeReducer`, `themeActions`) for wiring into your store
|
|
10
|
+
- Optional Redux slice (`themeReducer`, `themeActions`, `selectThemeAppearance`, `selectThemeColor`) for wiring into your store
|
|
12
11
|
- All color utilities exported for standalone use
|
|
13
12
|
|
|
14
13
|
## Installation
|
|
@@ -21,22 +20,13 @@ Peer dependencies:
|
|
|
21
20
|
|
|
22
21
|
```bash
|
|
23
22
|
npm install react-native react-native-paper
|
|
24
|
-
# optional — only needed if using splashScreen:
|
|
25
|
-
npm install expo-splash-screen
|
|
26
23
|
```
|
|
27
24
|
|
|
28
25
|
## Usage
|
|
29
26
|
|
|
30
27
|
### ThemeProvider (simplest)
|
|
31
28
|
|
|
32
|
-
Call `configureSplashScreen` at your app entry point before any components mount, then wrap your tree:
|
|
33
|
-
|
|
34
29
|
```tsx
|
|
35
|
-
// index.ts / App.tsx top-level
|
|
36
|
-
import { configureSplashScreen } from '@rific/auto-paper'
|
|
37
|
-
configureSplashScreen({ duration: 500, fade: true })
|
|
38
|
-
|
|
39
|
-
// App.tsx
|
|
40
30
|
import { ThemeProvider } from '@rific/auto-paper'
|
|
41
31
|
|
|
42
32
|
export default function App() {
|
|
@@ -51,7 +41,7 @@ export default function App() {
|
|
|
51
41
|
}
|
|
52
42
|
```
|
|
53
43
|
|
|
54
|
-
`ThemeProvider` renders `null`
|
|
44
|
+
`ThemeProvider` renders `null` on the first render while the theme computes. If you use `expo-splash-screen`, gate `SplashScreen.hideAsync()` on the theme being ready in your own component.
|
|
55
45
|
|
|
56
46
|
### With React Navigation
|
|
57
47
|
|
|
@@ -104,10 +94,11 @@ export const store = configureStore({
|
|
|
104
94
|
```tsx
|
|
105
95
|
// App.tsx
|
|
106
96
|
import { useSelector } from 'react-redux'
|
|
107
|
-
import { ThemeProvider } from '@rific/auto-paper'
|
|
97
|
+
import { ThemeProvider, selectThemeAppearance, selectThemeColor } from '@rific/auto-paper'
|
|
108
98
|
|
|
109
99
|
export default function App() {
|
|
110
|
-
const
|
|
100
|
+
const appearance = useSelector((state: RootState) => selectThemeAppearance(state.theme))
|
|
101
|
+
const color = useSelector((state: RootState) => selectThemeColor(state.theme))
|
|
111
102
|
return (
|
|
112
103
|
<ThemeProvider appearance={appearance} color={color}>
|
|
113
104
|
{/* your app */}
|
|
@@ -139,23 +130,14 @@ store.dispatch(themeActions.initialize({ color: myStoredColor }))
|
|
|
139
130
|
|---|---|---|---|
|
|
140
131
|
| `appearance` | `'system' \| 'light' \| 'dark'` | — | Appearance mode |
|
|
141
132
|
| `color` | `string` | — | Seed color (hex, rgb, or CSS name) |
|
|
142
|
-
| `splashScreen` | `boolean` | `true` | Hide expo-splash-screen when theme is ready |
|
|
143
133
|
| `children` | `ReactNode` | — | |
|
|
144
134
|
|
|
145
|
-
### `useComputedTheme(appearance, color
|
|
135
|
+
### `useComputedTheme(appearance, color)`
|
|
146
136
|
|
|
147
|
-
Returns `MD3Theme | null`. `null`
|
|
137
|
+
Returns `MD3Theme | null`. `null` on the first render while the theme computes.
|
|
148
138
|
|
|
149
139
|
```ts
|
|
150
|
-
const theme = useComputedTheme('system', '#6750a4'
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
### `configureSplashScreen(options?)`
|
|
154
|
-
|
|
155
|
-
Call once at app entry. Wraps `SplashScreen.preventAutoHideAsync()` + `SplashScreen.setOptions()`.
|
|
156
|
-
|
|
157
|
-
```ts
|
|
158
|
-
configureSplashScreen({ duration: 500, fade: true })
|
|
140
|
+
const theme = useComputedTheme('system', '#6750a4')
|
|
159
141
|
```
|
|
160
142
|
|
|
161
143
|
### Color utilities
|
|
@@ -175,7 +157,7 @@ getHex('rgb(255, 0, 0)') // → '#ff0000'
|
|
|
175
157
|
### Redux slice
|
|
176
158
|
|
|
177
159
|
```ts
|
|
178
|
-
import { themeReducer, themeActions, ThemeState, ThemeAppearance } from '@rific/auto-paper'
|
|
160
|
+
import { themeReducer, themeActions, selectThemeAppearance, selectThemeColor, ThemeState, ThemeAppearance } from '@rific/auto-paper'
|
|
179
161
|
```
|
|
180
162
|
|
|
181
163
|
| Action | Payload |
|
|
@@ -184,6 +166,17 @@ import { themeReducer, themeActions, ThemeState, ThemeAppearance } from '@rific/
|
|
|
184
166
|
| `setAppearance` | `ThemeAppearance` |
|
|
185
167
|
| `setColor` | `string` |
|
|
186
168
|
|
|
169
|
+
| Selector | Returns |
|
|
170
|
+
|---|---|
|
|
171
|
+
| `selectThemeAppearance` | `ThemeAppearance` |
|
|
172
|
+
| `selectThemeColor` | `string` |
|
|
173
|
+
|
|
174
|
+
Selectors accept `ThemeState` directly — compose them with your root state selector:
|
|
175
|
+
|
|
176
|
+
```ts
|
|
177
|
+
const appearance = useSelector((state: RootState) => selectThemeAppearance(state.theme))
|
|
178
|
+
```
|
|
179
|
+
|
|
187
180
|
## License
|
|
188
181
|
|
|
189
182
|
MIT
|
package/dist/index.d.mts
CHANGED
|
@@ -6,10 +6,7 @@ import * as react from 'react';
|
|
|
6
6
|
import { ReactNode } from 'react';
|
|
7
7
|
|
|
8
8
|
type ThemeAppearance = 'system' | 'light' | 'dark';
|
|
9
|
-
|
|
10
|
-
splashScreen?: boolean;
|
|
11
|
-
};
|
|
12
|
-
declare function useComputedTheme(appearance: ThemeAppearance, color: string, options?: ComputedThemeOptions): MD3Theme | null;
|
|
9
|
+
declare function useComputedTheme(appearance: ThemeAppearance, color: string): MD3Theme | null;
|
|
13
10
|
|
|
14
11
|
type ThemeState = {
|
|
15
12
|
appearance: ThemeAppearance;
|
|
@@ -39,18 +36,15 @@ declare const themeActions: _reduxjs_toolkit.CaseReducerActions<{
|
|
|
39
36
|
};
|
|
40
37
|
}, "theme">;
|
|
41
38
|
declare const themeReducer: redux.Reducer<ThemeState>;
|
|
39
|
+
declare const selectThemeAppearance: (state: ThemeState) => ThemeAppearance;
|
|
40
|
+
declare const selectThemeColor: (state: ThemeState) => string;
|
|
42
41
|
|
|
43
42
|
type ThemeProviderProps = {
|
|
44
43
|
appearance: ThemeAppearance;
|
|
45
44
|
color: string;
|
|
46
|
-
splashScreen?: boolean;
|
|
47
45
|
children: ReactNode;
|
|
48
46
|
};
|
|
49
|
-
declare function
|
|
50
|
-
duration?: number;
|
|
51
|
-
fade?: boolean;
|
|
52
|
-
}): void;
|
|
53
|
-
declare function ThemeProvider({ appearance, color, splashScreen, children }: ThemeProviderProps): react.JSX.Element | null;
|
|
47
|
+
declare function ThemeProvider({ appearance, color, children }: ThemeProviderProps): react.JSX.Element | null;
|
|
54
48
|
|
|
55
49
|
declare const getBlendedColor: (foreground: string, background: string, alpha: number) => string;
|
|
56
50
|
|
|
@@ -73,4 +67,4 @@ declare function getTriadicPalette(primaryColor: string): TriadicPalette;
|
|
|
73
67
|
|
|
74
68
|
declare const isDarkColor: (value: string) => boolean;
|
|
75
69
|
|
|
76
|
-
export { type
|
|
70
|
+
export { type RGB, type ThemeAppearance, ThemeProvider, type ThemeProviderProps, type ThemeState, type TriadicPalette, getBlendedColor, getHex, getRgb, getTriadicPalette, isDarkColor, selectThemeAppearance, selectThemeColor, themeActions, themeReducer, useComputedTheme };
|
package/dist/index.d.ts
CHANGED
|
@@ -6,10 +6,7 @@ import * as react from 'react';
|
|
|
6
6
|
import { ReactNode } from 'react';
|
|
7
7
|
|
|
8
8
|
type ThemeAppearance = 'system' | 'light' | 'dark';
|
|
9
|
-
|
|
10
|
-
splashScreen?: boolean;
|
|
11
|
-
};
|
|
12
|
-
declare function useComputedTheme(appearance: ThemeAppearance, color: string, options?: ComputedThemeOptions): MD3Theme | null;
|
|
9
|
+
declare function useComputedTheme(appearance: ThemeAppearance, color: string): MD3Theme | null;
|
|
13
10
|
|
|
14
11
|
type ThemeState = {
|
|
15
12
|
appearance: ThemeAppearance;
|
|
@@ -39,18 +36,15 @@ declare const themeActions: _reduxjs_toolkit.CaseReducerActions<{
|
|
|
39
36
|
};
|
|
40
37
|
}, "theme">;
|
|
41
38
|
declare const themeReducer: redux.Reducer<ThemeState>;
|
|
39
|
+
declare const selectThemeAppearance: (state: ThemeState) => ThemeAppearance;
|
|
40
|
+
declare const selectThemeColor: (state: ThemeState) => string;
|
|
42
41
|
|
|
43
42
|
type ThemeProviderProps = {
|
|
44
43
|
appearance: ThemeAppearance;
|
|
45
44
|
color: string;
|
|
46
|
-
splashScreen?: boolean;
|
|
47
45
|
children: ReactNode;
|
|
48
46
|
};
|
|
49
|
-
declare function
|
|
50
|
-
duration?: number;
|
|
51
|
-
fade?: boolean;
|
|
52
|
-
}): void;
|
|
53
|
-
declare function ThemeProvider({ appearance, color, splashScreen, children }: ThemeProviderProps): react.JSX.Element | null;
|
|
47
|
+
declare function ThemeProvider({ appearance, color, children }: ThemeProviderProps): react.JSX.Element | null;
|
|
54
48
|
|
|
55
49
|
declare const getBlendedColor: (foreground: string, background: string, alpha: number) => string;
|
|
56
50
|
|
|
@@ -73,4 +67,4 @@ declare function getTriadicPalette(primaryColor: string): TriadicPalette;
|
|
|
73
67
|
|
|
74
68
|
declare const isDarkColor: (value: string) => boolean;
|
|
75
69
|
|
|
76
|
-
export { type
|
|
70
|
+
export { type RGB, type ThemeAppearance, ThemeProvider, type ThemeProviderProps, type ThemeState, type TriadicPalette, getBlendedColor, getHex, getRgb, getTriadicPalette, isDarkColor, selectThemeAppearance, selectThemeColor, themeActions, themeReducer, useComputedTheme };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
7
|
var __export = (target, all) => {
|
|
@@ -18,14 +16,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
16
|
}
|
|
19
17
|
return to;
|
|
20
18
|
};
|
|
21
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
-
mod
|
|
28
|
-
));
|
|
29
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
20
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
31
21
|
|
|
@@ -33,12 +23,13 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
33
23
|
var index_exports = {};
|
|
34
24
|
__export(index_exports, {
|
|
35
25
|
ThemeProvider: () => ThemeProvider,
|
|
36
|
-
configureSplashScreen: () => configureSplashScreen,
|
|
37
26
|
getBlendedColor: () => getBlendedColor,
|
|
38
27
|
getHex: () => getHex,
|
|
39
28
|
getRgb: () => getRgb,
|
|
40
29
|
getTriadicPalette: () => getTriadicPalette,
|
|
41
30
|
isDarkColor: () => isDarkColor,
|
|
31
|
+
selectThemeAppearance: () => selectThemeAppearance,
|
|
32
|
+
selectThemeColor: () => selectThemeColor,
|
|
42
33
|
themeActions: () => themeActions,
|
|
43
34
|
themeReducer: () => themeReducer,
|
|
44
35
|
useComputedTheme: () => useComputedTheme
|
|
@@ -1599,14 +1590,14 @@ var slice = createSlice({
|
|
|
1599
1590
|
});
|
|
1600
1591
|
var themeActions = slice.actions;
|
|
1601
1592
|
var themeReducer = slice.reducer;
|
|
1593
|
+
var selectThemeAppearance = (state) => state.appearance;
|
|
1594
|
+
var selectThemeColor = (state) => state.color;
|
|
1602
1595
|
|
|
1603
1596
|
// src/ThemeProvider.tsx
|
|
1604
|
-
var SplashScreen2 = __toESM(require("expo-splash-screen"));
|
|
1605
1597
|
var import_react_native2 = require("react-native");
|
|
1606
1598
|
var import_react_native_paper2 = require("react-native-paper");
|
|
1607
1599
|
|
|
1608
1600
|
// src/useComputedTheme.ts
|
|
1609
|
-
var SplashScreen = __toESM(require("expo-splash-screen"));
|
|
1610
1601
|
var import_react = require("react");
|
|
1611
1602
|
var import_react_native = require("react-native");
|
|
1612
1603
|
var import_react_native_paper = require("react-native-paper");
|
|
@@ -1919,8 +1910,7 @@ var isDarkColor = (value) => {
|
|
|
1919
1910
|
};
|
|
1920
1911
|
|
|
1921
1912
|
// src/useComputedTheme.ts
|
|
1922
|
-
function useComputedTheme(appearance, color
|
|
1923
|
-
const splashScreen = options?.splashScreen !== false;
|
|
1913
|
+
function useComputedTheme(appearance, color) {
|
|
1924
1914
|
const [theme, setTheme] = (0, import_react.useState)(null);
|
|
1925
1915
|
const computeTheme = (0, import_react.useCallback)(() => {
|
|
1926
1916
|
let resolved = appearance;
|
|
@@ -1972,24 +1962,12 @@ function useComputedTheme(appearance, color, options) {
|
|
|
1972
1962
|
const subscription = import_react_native.Appearance.addChangeListener(computeTheme);
|
|
1973
1963
|
return subscription.remove;
|
|
1974
1964
|
}, [computeTheme]);
|
|
1975
|
-
(0, import_react.useEffect)(() => {
|
|
1976
|
-
if (theme && splashScreen) SplashScreen.hideAsync();
|
|
1977
|
-
}, [theme, splashScreen]);
|
|
1978
1965
|
return theme;
|
|
1979
1966
|
}
|
|
1980
1967
|
|
|
1981
1968
|
// src/ThemeProvider.tsx
|
|
1982
|
-
function
|
|
1983
|
-
|
|
1984
|
-
if (options) {
|
|
1985
|
-
SplashScreen2.setOptions({
|
|
1986
|
-
duration: options.duration ?? 500,
|
|
1987
|
-
fade: options.fade ?? true
|
|
1988
|
-
});
|
|
1989
|
-
}
|
|
1990
|
-
}
|
|
1991
|
-
function ThemeProvider({ appearance, color, splashScreen = true, children }) {
|
|
1992
|
-
const theme = useComputedTheme(appearance, color, { splashScreen });
|
|
1969
|
+
function ThemeProvider({ appearance, color, children }) {
|
|
1970
|
+
const theme = useComputedTheme(appearance, color);
|
|
1993
1971
|
if (!theme) return null;
|
|
1994
1972
|
return /* @__PURE__ */ React.createElement(import_react_native_paper2.Provider, { theme }, /* @__PURE__ */ React.createElement(import_react_native2.StatusBar, { backgroundColor: theme.colors.background, barStyle: theme.dark ? "light-content" : "dark-content" }), /* @__PURE__ */ React.createElement(import_react_native2.View, { style: styles.flex }, children));
|
|
1995
1973
|
}
|
|
@@ -1999,12 +1977,13 @@ var styles = import_react_native2.StyleSheet.create({
|
|
|
1999
1977
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2000
1978
|
0 && (module.exports = {
|
|
2001
1979
|
ThemeProvider,
|
|
2002
|
-
configureSplashScreen,
|
|
2003
1980
|
getBlendedColor,
|
|
2004
1981
|
getHex,
|
|
2005
1982
|
getRgb,
|
|
2006
1983
|
getTriadicPalette,
|
|
2007
1984
|
isDarkColor,
|
|
1985
|
+
selectThemeAppearance,
|
|
1986
|
+
selectThemeColor,
|
|
2008
1987
|
themeActions,
|
|
2009
1988
|
themeReducer,
|
|
2010
1989
|
useComputedTheme
|
package/dist/index.mjs
CHANGED
|
@@ -1556,14 +1556,14 @@ var slice = createSlice({
|
|
|
1556
1556
|
});
|
|
1557
1557
|
var themeActions = slice.actions;
|
|
1558
1558
|
var themeReducer = slice.reducer;
|
|
1559
|
+
var selectThemeAppearance = (state) => state.appearance;
|
|
1560
|
+
var selectThemeColor = (state) => state.color;
|
|
1559
1561
|
|
|
1560
1562
|
// src/ThemeProvider.tsx
|
|
1561
|
-
import * as SplashScreen2 from "expo-splash-screen";
|
|
1562
1563
|
import { StatusBar, StyleSheet, View } from "react-native";
|
|
1563
1564
|
import { Provider as PaperProvider } from "react-native-paper";
|
|
1564
1565
|
|
|
1565
1566
|
// src/useComputedTheme.ts
|
|
1566
|
-
import * as SplashScreen from "expo-splash-screen";
|
|
1567
1567
|
import { useCallback, useEffect, useState } from "react";
|
|
1568
1568
|
import { Appearance } from "react-native";
|
|
1569
1569
|
import { MD3DarkTheme, MD3LightTheme } from "react-native-paper";
|
|
@@ -1876,8 +1876,7 @@ var isDarkColor = (value) => {
|
|
|
1876
1876
|
};
|
|
1877
1877
|
|
|
1878
1878
|
// src/useComputedTheme.ts
|
|
1879
|
-
function useComputedTheme(appearance, color
|
|
1880
|
-
const splashScreen = options?.splashScreen !== false;
|
|
1879
|
+
function useComputedTheme(appearance, color) {
|
|
1881
1880
|
const [theme, setTheme] = useState(null);
|
|
1882
1881
|
const computeTheme = useCallback(() => {
|
|
1883
1882
|
let resolved = appearance;
|
|
@@ -1929,24 +1928,12 @@ function useComputedTheme(appearance, color, options) {
|
|
|
1929
1928
|
const subscription = Appearance.addChangeListener(computeTheme);
|
|
1930
1929
|
return subscription.remove;
|
|
1931
1930
|
}, [computeTheme]);
|
|
1932
|
-
useEffect(() => {
|
|
1933
|
-
if (theme && splashScreen) SplashScreen.hideAsync();
|
|
1934
|
-
}, [theme, splashScreen]);
|
|
1935
1931
|
return theme;
|
|
1936
1932
|
}
|
|
1937
1933
|
|
|
1938
1934
|
// src/ThemeProvider.tsx
|
|
1939
|
-
function
|
|
1940
|
-
|
|
1941
|
-
if (options) {
|
|
1942
|
-
SplashScreen2.setOptions({
|
|
1943
|
-
duration: options.duration ?? 500,
|
|
1944
|
-
fade: options.fade ?? true
|
|
1945
|
-
});
|
|
1946
|
-
}
|
|
1947
|
-
}
|
|
1948
|
-
function ThemeProvider({ appearance, color, splashScreen = true, children }) {
|
|
1949
|
-
const theme = useComputedTheme(appearance, color, { splashScreen });
|
|
1935
|
+
function ThemeProvider({ appearance, color, children }) {
|
|
1936
|
+
const theme = useComputedTheme(appearance, color);
|
|
1950
1937
|
if (!theme) return null;
|
|
1951
1938
|
return /* @__PURE__ */ React.createElement(PaperProvider, { theme }, /* @__PURE__ */ React.createElement(StatusBar, { backgroundColor: theme.colors.background, barStyle: theme.dark ? "light-content" : "dark-content" }), /* @__PURE__ */ React.createElement(View, { style: styles.flex }, children));
|
|
1952
1939
|
}
|
|
@@ -1955,12 +1942,13 @@ var styles = StyleSheet.create({
|
|
|
1955
1942
|
});
|
|
1956
1943
|
export {
|
|
1957
1944
|
ThemeProvider,
|
|
1958
|
-
configureSplashScreen,
|
|
1959
1945
|
getBlendedColor,
|
|
1960
1946
|
getHex,
|
|
1961
1947
|
getRgb,
|
|
1962
1948
|
getTriadicPalette,
|
|
1963
1949
|
isDarkColor,
|
|
1950
|
+
selectThemeAppearance,
|
|
1951
|
+
selectThemeColor,
|
|
1964
1952
|
themeActions,
|
|
1965
1953
|
themeReducer,
|
|
1966
1954
|
useComputedTheme
|
package/package.json
CHANGED
|
@@ -1,13 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rific/auto-paper",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Adaptive react-native-paper theming: triadic palette from a seed color + system/light/dark appearance",
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
5
|
+
"keywords": [
|
|
6
|
+
"react-native",
|
|
7
|
+
"expo",
|
|
8
|
+
"react-native-paper",
|
|
9
|
+
"md3",
|
|
10
|
+
"material-you",
|
|
11
|
+
"material-design",
|
|
12
|
+
"theming",
|
|
13
|
+
"dark-mode",
|
|
14
|
+
"seed-color",
|
|
15
|
+
"color-palette",
|
|
16
|
+
"triadic",
|
|
17
|
+
"adaptive-theme",
|
|
18
|
+
"appearance"
|
|
19
|
+
],
|
|
20
|
+
"homepage": "https://github.com/jayrdeaton/react-native-auto-paper#readme",
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/jayrdeaton/react-native-auto-paper/issues"
|
|
23
|
+
},
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "git+https://github.com/jayrdeaton/react-native-auto-paper.git"
|
|
10
27
|
},
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"author": "Jay Deaton",
|
|
30
|
+
"sideEffects": false,
|
|
31
|
+
"type": "commonjs",
|
|
11
32
|
"exports": {
|
|
12
33
|
".": {
|
|
13
34
|
"types": "./dist/index.d.ts",
|
|
@@ -15,69 +36,62 @@
|
|
|
15
36
|
"require": "./dist/index.js"
|
|
16
37
|
}
|
|
17
38
|
},
|
|
39
|
+
"main": "dist/index.js",
|
|
40
|
+
"module": "dist/index.mjs",
|
|
41
|
+
"types": "dist/index.d.ts",
|
|
18
42
|
"files": [
|
|
19
43
|
"dist"
|
|
20
44
|
],
|
|
21
45
|
"scripts": {
|
|
22
46
|
"build": "tsup src/index.ts --format cjs,esm --dts --clean",
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
47
|
+
"fix": "eslint --fix",
|
|
48
|
+
"lint": "eslint",
|
|
49
|
+
"prepublishOnly": "npm run build",
|
|
50
|
+
"release": "git push --follow-tags",
|
|
51
|
+
"release:major": "npm version major && git push --follow-tags",
|
|
52
|
+
"release:minor": "npm version minor && git push --follow-tags",
|
|
53
|
+
"release:patch": "npm version patch && git push --follow-tags",
|
|
26
54
|
"test": "jest",
|
|
27
55
|
"test:watch": "jest --watchAll",
|
|
28
|
-
"
|
|
56
|
+
"typecheck": "tsc --noEmit",
|
|
29
57
|
"preversion": "npm run lint && npm test"
|
|
30
58
|
},
|
|
31
|
-
"peerDependencies": {
|
|
32
|
-
"expo-splash-screen": ">=0.26.0",
|
|
33
|
-
"react": ">=18.0.0",
|
|
34
|
-
"react-native": ">=0.73.0",
|
|
35
|
-
"react-native-paper": ">=5.0.0"
|
|
36
|
-
},
|
|
37
|
-
"peerDependenciesMeta": {
|
|
38
|
-
"expo-splash-screen": {
|
|
39
|
-
"optional": true
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
59
|
"devDependencies": {
|
|
43
60
|
"@reduxjs/toolkit": "^2.0.0",
|
|
44
61
|
"@testing-library/dom": "^10.4.1",
|
|
45
62
|
"@testing-library/react": "^16.0.0",
|
|
46
|
-
"@types/jest": "^
|
|
47
|
-
"@types/react": "^
|
|
63
|
+
"@types/jest": "^30.0.0",
|
|
64
|
+
"@types/react": "^19.0.0",
|
|
48
65
|
"@types/react-native": "^0.73.0",
|
|
49
|
-
"@typescript-eslint/eslint-plugin": "^8.59.3",
|
|
50
66
|
"@typescript-eslint/parser": "^8.59.3",
|
|
51
67
|
"eslint": "^9.39.4",
|
|
52
68
|
"eslint-config-prettier": "^10.1.8",
|
|
69
|
+
"eslint-plugin-package-json": "^1.0.0",
|
|
53
70
|
"eslint-plugin-prettier": "^5.5.5",
|
|
54
71
|
"eslint-plugin-react-native": "^5.0.0",
|
|
55
72
|
"eslint-plugin-simple-import-sort": "^13.0.0",
|
|
56
|
-
"
|
|
57
|
-
"jest": "^
|
|
58
|
-
"jest-environment-jsdom": "^29.0.0",
|
|
73
|
+
"jest": "^30.0.0",
|
|
74
|
+
"jest-environment-jsdom": "^30.0.0",
|
|
59
75
|
"prettier": "^3.8.3",
|
|
60
|
-
"react": "^
|
|
61
|
-
"react-dom": "^
|
|
76
|
+
"react": "^19.0.0",
|
|
77
|
+
"react-dom": "^19.0.0",
|
|
62
78
|
"react-native": "^0.76.0",
|
|
63
79
|
"react-native-paper": "^5.12.0",
|
|
64
|
-
"ts-jest": "^29.
|
|
80
|
+
"ts-jest": "^29.4.9",
|
|
81
|
+
"ts-node": "^10.9.2",
|
|
65
82
|
"tsup": "^8.0.0",
|
|
66
83
|
"typescript": "^5.0.0",
|
|
67
84
|
"typescript-eslint": "^8.59.3"
|
|
68
85
|
},
|
|
86
|
+
"peerDependencies": {
|
|
87
|
+
"react": ">=18.0.0",
|
|
88
|
+
"react-native": ">=0.73.0",
|
|
89
|
+
"react-native-paper": ">=5.0.0"
|
|
90
|
+
},
|
|
69
91
|
"optionalDependencies": {
|
|
70
92
|
"@reduxjs/toolkit": "^2.0.0"
|
|
71
93
|
},
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
|
|
75
|
-
"theme",
|
|
76
|
-
"material-design",
|
|
77
|
-
"adaptive",
|
|
78
|
-
"dark-mode",
|
|
79
|
-
"color-palette",
|
|
80
|
-
"triadic"
|
|
81
|
-
],
|
|
82
|
-
"license": "MIT"
|
|
94
|
+
"publishConfig": {
|
|
95
|
+
"access": "public"
|
|
96
|
+
}
|
|
83
97
|
}
|