@rific/auto-paper 0.2.0 → 0.3.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/README.md +30 -6
- package/dist/index.d.mts +121 -23
- package/dist/index.d.ts +121 -23
- package/dist/index.js +1293 -988
- package/dist/index.mjs +1275 -973
- package/package.json +3 -7
package/dist/index.mjs
CHANGED
|
@@ -2,15 +2,39 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
|
|
5
|
+
// src/BlurContext.tsx
|
|
6
|
+
import { useContext } from "react";
|
|
7
|
+
|
|
8
|
+
// src/ThemeSettingsContext.ts
|
|
9
|
+
import { createContext } from "react";
|
|
10
|
+
var defaultThemeSettings = {
|
|
11
|
+
appearance: "system",
|
|
12
|
+
blur: true,
|
|
13
|
+
blurTint: 0.2,
|
|
14
|
+
color: "#6750a4",
|
|
15
|
+
harmony: "split-complementary"
|
|
16
|
+
};
|
|
17
|
+
var ThemeSettingsContext = createContext({
|
|
18
|
+
settings: defaultThemeSettings,
|
|
19
|
+
set: () => {
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// src/BlurContext.tsx
|
|
24
|
+
function useBlur(override) {
|
|
25
|
+
const { settings } = useContext(ThemeSettingsContext);
|
|
26
|
+
return override ?? settings.blur;
|
|
27
|
+
}
|
|
28
|
+
|
|
5
29
|
// src/components/Appbar.tsx
|
|
6
30
|
import { StatusBar } from "react-native";
|
|
7
31
|
import { Appbar as PaperAppbar, useTheme } from "react-native-paper";
|
|
8
32
|
|
|
9
33
|
// src/PaperDefaultsContext.tsx
|
|
10
|
-
import { createContext, useContext } from "react";
|
|
11
|
-
var PaperDefaultsContext =
|
|
34
|
+
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
35
|
+
var PaperDefaultsContext = createContext2({});
|
|
12
36
|
function usePaperDefaults() {
|
|
13
|
-
return
|
|
37
|
+
return useContext2(PaperDefaultsContext);
|
|
14
38
|
}
|
|
15
39
|
|
|
16
40
|
// src/components/Appbar.tsx
|
|
@@ -30,474 +54,1123 @@ var Appbar = {
|
|
|
30
54
|
BackAction: PaperAppbar.BackAction
|
|
31
55
|
};
|
|
32
56
|
|
|
33
|
-
// src/components/
|
|
34
|
-
import {
|
|
35
|
-
import { Platform } from "react-native";
|
|
36
|
-
import { BottomNavigation as PaperBottomNavigation, useTheme as useTheme2 } from "react-native-paper";
|
|
57
|
+
// src/components/AppearancePicker.tsx
|
|
58
|
+
import { SegmentedButtons } from "react-native-paper";
|
|
37
59
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
setButtonStyleAsync(theme.dark ? "light" : "dark");
|
|
45
|
-
}).catch(() => {
|
|
46
|
-
});
|
|
47
|
-
}, [theme]);
|
|
48
|
-
}
|
|
49
|
-
function BottomNavigationComponent(props) {
|
|
50
|
-
const defaults = usePaperDefaults();
|
|
51
|
-
useNavigationBarSync();
|
|
52
|
-
return /* @__PURE__ */ jsx2(PaperBottomNavigation, { ...defaults.BottomNavigation, ...props });
|
|
53
|
-
}
|
|
54
|
-
function Bar(props) {
|
|
55
|
-
useNavigationBarSync();
|
|
56
|
-
return /* @__PURE__ */ jsx2(PaperBottomNavigation.Bar, { ...props });
|
|
57
|
-
}
|
|
58
|
-
BottomNavigationComponent.Bar = Bar;
|
|
59
|
-
BottomNavigationComponent.SceneMap = PaperBottomNavigation.SceneMap;
|
|
60
|
-
var BottomNavigation = BottomNavigationComponent;
|
|
60
|
+
var APPEARANCES = [
|
|
61
|
+
{ label: "System", value: "system", icon: "brightness-auto" },
|
|
62
|
+
{ label: "Light", value: "light", icon: "white-balance-sunny" },
|
|
63
|
+
{ label: "Dark", value: "dark", icon: "weather-night" }
|
|
64
|
+
];
|
|
65
|
+
var AppearancePicker = ({ value, onChange }) => /* @__PURE__ */ jsx2(SegmentedButtons, { value, onValueChange: (v) => onChange(v), buttons: APPEARANCES.map((a) => ({ value: a.value, label: a.label, icon: a.icon })) });
|
|
61
66
|
|
|
62
|
-
// src/components/
|
|
63
|
-
import {
|
|
64
|
-
import {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
67
|
+
// src/components/BlurView.tsx
|
|
68
|
+
import { BlurView as ExpoBlurView } from "expo-blur";
|
|
69
|
+
import { useContext as useContext3 } from "react";
|
|
70
|
+
import { StyleSheet, View } from "react-native";
|
|
71
|
+
import { useTheme as useTheme2 } from "react-native-paper";
|
|
72
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
73
|
+
var ELEVATION_OPACITY = { 0: 0, 1: 0.05, 2: 0.08, 3: 0.11, 4: 0.12, 5: 0.14 };
|
|
74
|
+
var BlurView = ({ blur = true, children, elevation, style, ...props }) => {
|
|
75
|
+
const { dark, colors } = useTheme2();
|
|
76
|
+
const { settings } = useContext3(ThemeSettingsContext);
|
|
77
|
+
const tintOpacity = elevation !== void 0 ? ELEVATION_OPACITY[elevation] : 0;
|
|
78
|
+
const tint = tintOpacity > 0 ? /* @__PURE__ */ jsx3(View, { style: [StyleSheet.absoluteFill, { backgroundColor: colors.primary, opacity: tintOpacity }] }) : null;
|
|
79
|
+
if (blur)
|
|
80
|
+
return /* @__PURE__ */ jsxs2(ExpoBlurView, { ...props, tint: dark ? "dark" : "light", style, children: [
|
|
81
|
+
/* @__PURE__ */ jsx3(View, { style: [StyleSheet.absoluteFill, { backgroundColor: colors.surface, opacity: settings.blurTint }] }),
|
|
82
|
+
tint,
|
|
83
|
+
children
|
|
84
|
+
] });
|
|
85
|
+
return /* @__PURE__ */ jsxs2(View, { style: [{ backgroundColor: colors.surface }, style], children: [
|
|
86
|
+
tint,
|
|
87
|
+
children
|
|
88
|
+
] });
|
|
89
|
+
};
|
|
77
90
|
|
|
78
|
-
// src/components/
|
|
79
|
-
import {
|
|
80
|
-
import {
|
|
81
|
-
|
|
82
|
-
const defaults = usePaperDefaults();
|
|
83
|
-
return /* @__PURE__ */ jsx5(PaperFAB, { ...defaults.FAB, ...props });
|
|
84
|
-
}
|
|
91
|
+
// src/components/BottomNavigation.tsx
|
|
92
|
+
import { useEffect as useEffect3 } from "react";
|
|
93
|
+
import { Platform } from "react-native";
|
|
94
|
+
import { BottomNavigation as PaperBottomNavigation, useTheme as useTheme3 } from "react-native-paper";
|
|
85
95
|
|
|
86
|
-
// src/
|
|
87
|
-
import {
|
|
88
|
-
import {
|
|
89
|
-
|
|
90
|
-
const defaults = usePaperDefaults();
|
|
91
|
-
return /* @__PURE__ */ jsx6(PaperIconButton, { ...defaults.IconButton, ...props });
|
|
92
|
-
}
|
|
96
|
+
// src/ThemeProvider.tsx
|
|
97
|
+
import { createContext as createContext3, useCallback as useCallback2, useContext as useContext4, useEffect as useEffect2, useRef, useState as useState2 } from "react";
|
|
98
|
+
import { StatusBar as StatusBar2, StyleSheet as StyleSheet2, View as View2 } from "react-native";
|
|
99
|
+
import { Provider as PaperProvider } from "react-native-paper";
|
|
93
100
|
|
|
94
|
-
// src/
|
|
95
|
-
import {
|
|
96
|
-
import {
|
|
97
|
-
import {
|
|
98
|
-
var TextInput = forwardRef(function TextInput2(props, ref) {
|
|
99
|
-
const defaults = usePaperDefaults();
|
|
100
|
-
return /* @__PURE__ */ jsx7(PaperTextInput, { ref, ...defaults.TextInput, ...props });
|
|
101
|
-
});
|
|
101
|
+
// src/useComputedTheme.ts
|
|
102
|
+
import { useCallback, useEffect, useState } from "react";
|
|
103
|
+
import { Appearance } from "react-native";
|
|
104
|
+
import { MD3DarkTheme, MD3LightTheme } from "react-native-paper";
|
|
102
105
|
|
|
103
|
-
//
|
|
104
|
-
var
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
// src/utils/colorNames.ts
|
|
107
|
+
var colorNames = {
|
|
108
|
+
aliceblue: "#f0f8ff",
|
|
109
|
+
antiquewhite: "#faebd7",
|
|
110
|
+
aqua: "#00ffff",
|
|
111
|
+
aquamarine: "#7fffd4",
|
|
112
|
+
azure: "#f0ffff",
|
|
113
|
+
beige: "#f5f5dc",
|
|
114
|
+
bisque: "#ffe4c4",
|
|
115
|
+
black: "#000000",
|
|
116
|
+
blanchedalmond: "#ffebcd",
|
|
117
|
+
blue: "#0000ff",
|
|
118
|
+
blueviolet: "#8a2be2",
|
|
119
|
+
brown: "#a52a2a",
|
|
120
|
+
burlywood: "#deb887",
|
|
121
|
+
cadetblue: "#5f9ea0",
|
|
122
|
+
chartreuse: "#7fff00",
|
|
123
|
+
chocolate: "#d2691e",
|
|
124
|
+
coral: "#ff7f50",
|
|
125
|
+
cornflowerblue: "#6495ed",
|
|
126
|
+
cornsilk: "#fff8dc",
|
|
127
|
+
crimson: "#dc143c",
|
|
128
|
+
cyan: "#00ffff",
|
|
129
|
+
darkblue: "#00008b",
|
|
130
|
+
darkcyan: "#008b8b",
|
|
131
|
+
darkgoldenrod: "#b8860b",
|
|
132
|
+
darkgray: "#a9a9a9",
|
|
133
|
+
darkgrey: "#a9a9a9",
|
|
134
|
+
darkgreen: "#006400",
|
|
135
|
+
darkkhaki: "#bdb76b",
|
|
136
|
+
darkmagenta: "#8b008b",
|
|
137
|
+
darkolivegreen: "#556b2f",
|
|
138
|
+
darkorange: "#ff8c00",
|
|
139
|
+
darkorchid: "#9932cc",
|
|
140
|
+
darkred: "#8b0000",
|
|
141
|
+
darksalmon: "#e9967a",
|
|
142
|
+
darkseagreen: "#8fbc8f",
|
|
143
|
+
darkslateblue: "#483d8b",
|
|
144
|
+
darkslategray: "#2f4f4f",
|
|
145
|
+
darkslategrey: "#2f4f4f",
|
|
146
|
+
darkturquoise: "#00ced1",
|
|
147
|
+
darkviolet: "#9400d3",
|
|
148
|
+
deeppink: "#ff1493",
|
|
149
|
+
deepskyblue: "#00bfff",
|
|
150
|
+
dimgray: "#696969",
|
|
151
|
+
dimgrey: "#696969",
|
|
152
|
+
dodgerblue: "#1e90ff",
|
|
153
|
+
firebrick: "#b22222",
|
|
154
|
+
floralwhite: "#fffaf0",
|
|
155
|
+
forestgreen: "#228b22",
|
|
156
|
+
fuchsia: "#ff00ff",
|
|
157
|
+
gainsboro: "#dcdcdc",
|
|
158
|
+
ghostwhite: "#f8f8ff",
|
|
159
|
+
gold: "#ffd700",
|
|
160
|
+
goldenrod: "#daa520",
|
|
161
|
+
gray: "#808080",
|
|
162
|
+
grey: "#808080",
|
|
163
|
+
green: "#008000",
|
|
164
|
+
greenyellow: "#adff2f",
|
|
165
|
+
honeydew: "#f0fff0",
|
|
166
|
+
hotpink: "#ff69b4",
|
|
167
|
+
indianred: "#cd5c5c",
|
|
168
|
+
indigo: "#4b0082",
|
|
169
|
+
ivory: "#fffff0",
|
|
170
|
+
khaki: "#f0e68c",
|
|
171
|
+
lavender: "#e6e6fa",
|
|
172
|
+
lavenderblush: "#fff0f5",
|
|
173
|
+
lawngreen: "#7cfc00",
|
|
174
|
+
lemonchiffon: "#fffacd",
|
|
175
|
+
lightblue: "#add8e6",
|
|
176
|
+
lightcoral: "#f08080",
|
|
177
|
+
lightcyan: "#e0ffff",
|
|
178
|
+
lightgoldenrodyellow: "#fafad2",
|
|
179
|
+
lightgray: "#d3d3d3",
|
|
180
|
+
lightgrey: "#d3d3d3",
|
|
181
|
+
lightgreen: "#90ee90",
|
|
182
|
+
lightpink: "#ffb6c1",
|
|
183
|
+
lightsalmon: "#ffa07a",
|
|
184
|
+
lightseagreen: "#20b2aa",
|
|
185
|
+
lightskyblue: "#87cefa",
|
|
186
|
+
lightslategray: "#778899",
|
|
187
|
+
lightslategrey: "#778899",
|
|
188
|
+
lightsteelblue: "#b0c4de",
|
|
189
|
+
lightyellow: "#ffffe0",
|
|
190
|
+
lime: "#00ff00",
|
|
191
|
+
limegreen: "#32cd32",
|
|
192
|
+
linen: "#faf0e6",
|
|
193
|
+
magenta: "#ff00ff",
|
|
194
|
+
maroon: "#800000",
|
|
195
|
+
mediumaquamarine: "#66cdaa",
|
|
196
|
+
mediumblue: "#0000cd",
|
|
197
|
+
mediumorchid: "#ba55d3",
|
|
198
|
+
mediumpurple: "#9370db",
|
|
199
|
+
mediumseagreen: "#3cb371",
|
|
200
|
+
mediumslateblue: "#7b68ee",
|
|
201
|
+
mediumspringgreen: "#00fa9a",
|
|
202
|
+
mediumturquoise: "#48d1cc",
|
|
203
|
+
mediumvioletred: "#c71585",
|
|
204
|
+
midnightblue: "#191970",
|
|
205
|
+
mintcream: "#f5fffa",
|
|
206
|
+
mistyrose: "#ffe4e1",
|
|
207
|
+
moccasin: "#ffe4b5",
|
|
208
|
+
navajowhite: "#ffdead",
|
|
209
|
+
navy: "#000080",
|
|
210
|
+
oldlace: "#fdf5e6",
|
|
211
|
+
olive: "#808000",
|
|
212
|
+
olivedrab: "#6b8e23",
|
|
213
|
+
orange: "#ffa500",
|
|
214
|
+
orangered: "#ff4500",
|
|
215
|
+
orchid: "#da70d6",
|
|
216
|
+
palegoldenrod: "#eee8aa",
|
|
217
|
+
palegreen: "#98fb98",
|
|
218
|
+
paleturquoise: "#afeeee",
|
|
219
|
+
palevioletred: "#db7093",
|
|
220
|
+
papayawhip: "#ffefd5",
|
|
221
|
+
peachpuff: "#ffdab9",
|
|
222
|
+
peru: "#cd853f",
|
|
223
|
+
pink: "#ffc0cb",
|
|
224
|
+
plum: "#dda0dd",
|
|
225
|
+
powderblue: "#b0e0e6",
|
|
226
|
+
purple: "#800080",
|
|
227
|
+
rebeccapurple: "#663399",
|
|
228
|
+
red: "#ff0000",
|
|
229
|
+
rosybrown: "#bc8f8f",
|
|
230
|
+
royalblue: "#4169e1",
|
|
231
|
+
saddlebrown: "#8b4513",
|
|
232
|
+
salmon: "#fa8072",
|
|
233
|
+
sandybrown: "#f4a460",
|
|
234
|
+
seagreen: "#2e8b57",
|
|
235
|
+
seashell: "#fff5ee",
|
|
236
|
+
sienna: "#a0522d",
|
|
237
|
+
silver: "#c0c0c0",
|
|
238
|
+
skyblue: "#87ceeb",
|
|
239
|
+
slateblue: "#6a5acd",
|
|
240
|
+
slategray: "#708090",
|
|
241
|
+
slategrey: "#708090",
|
|
242
|
+
snow: "#fffafa",
|
|
243
|
+
springgreen: "#00ff7f",
|
|
244
|
+
steelblue: "#4682b4",
|
|
245
|
+
tan: "#d2b48c",
|
|
246
|
+
teal: "#008080",
|
|
247
|
+
thistle: "#d8bfd8",
|
|
248
|
+
tomato: "#ff6347",
|
|
249
|
+
transparent: "transparent",
|
|
250
|
+
turquoise: "#40e0d0",
|
|
251
|
+
violet: "#ee82ee",
|
|
252
|
+
wheat: "#f5deb3",
|
|
253
|
+
white: "#ffffff",
|
|
254
|
+
whitesmoke: "#f5f5f5",
|
|
255
|
+
yellow: "#ffff00",
|
|
256
|
+
yellowgreen: "#9acd32"
|
|
109
257
|
};
|
|
110
|
-
function isPlainObject(obj) {
|
|
111
|
-
if (typeof obj !== "object" || obj === null)
|
|
112
|
-
return false;
|
|
113
|
-
let proto = obj;
|
|
114
|
-
while (Object.getPrototypeOf(proto) !== null) {
|
|
115
|
-
proto = Object.getPrototypeOf(proto);
|
|
116
|
-
}
|
|
117
|
-
return Object.getPrototypeOf(obj) === proto || Object.getPrototypeOf(obj) === null;
|
|
118
|
-
}
|
|
119
|
-
function compose(...funcs) {
|
|
120
|
-
if (funcs.length === 0) {
|
|
121
|
-
return (arg) => arg;
|
|
122
|
-
}
|
|
123
|
-
if (funcs.length === 1) {
|
|
124
|
-
return funcs[0];
|
|
125
|
-
}
|
|
126
|
-
return funcs.reduce((a, b) => (...args) => a(b(...args)));
|
|
127
|
-
}
|
|
128
|
-
function isAction(action) {
|
|
129
|
-
return isPlainObject(action) && "type" in action && typeof action.type === "string";
|
|
130
|
-
}
|
|
131
258
|
|
|
132
|
-
//
|
|
133
|
-
var
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
function(thing) {
|
|
162
|
-
return `'original' expects a draft, got: ${thing}`;
|
|
163
|
-
}
|
|
164
|
-
// Note: if more errors are added, the errorOffset in Patches.ts should be increased
|
|
165
|
-
// See Patches.ts for additional errors
|
|
166
|
-
] : [];
|
|
167
|
-
function die(error, ...args) {
|
|
168
|
-
if (process.env.NODE_ENV !== "production") {
|
|
169
|
-
const e = errors[error];
|
|
170
|
-
const msg = isFunction(e) ? e.apply(null, args) : e;
|
|
171
|
-
throw new Error(`[Immer] ${msg}`);
|
|
172
|
-
}
|
|
173
|
-
throw new Error(
|
|
174
|
-
`[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf`
|
|
175
|
-
);
|
|
176
|
-
}
|
|
177
|
-
var O = Object;
|
|
178
|
-
var getPrototypeOf = O.getPrototypeOf;
|
|
179
|
-
var CONSTRUCTOR = "constructor";
|
|
180
|
-
var PROTOTYPE = "prototype";
|
|
181
|
-
var CONFIGURABLE = "configurable";
|
|
182
|
-
var ENUMERABLE = "enumerable";
|
|
183
|
-
var WRITABLE = "writable";
|
|
184
|
-
var VALUE = "value";
|
|
185
|
-
var isDraft = (value) => !!value && !!value[DRAFT_STATE];
|
|
186
|
-
function isDraftable(value) {
|
|
187
|
-
if (!value)
|
|
188
|
-
return false;
|
|
189
|
-
return isPlainObject2(value) || isArray(value) || !!value[DRAFTABLE] || !!value[CONSTRUCTOR]?.[DRAFTABLE] || isMap(value) || isSet(value);
|
|
190
|
-
}
|
|
191
|
-
var objectCtorString = O[PROTOTYPE][CONSTRUCTOR].toString();
|
|
192
|
-
var cachedCtorStrings = /* @__PURE__ */ new WeakMap();
|
|
193
|
-
function isPlainObject2(value) {
|
|
194
|
-
if (!value || !isObjectish(value))
|
|
195
|
-
return false;
|
|
196
|
-
const proto = getPrototypeOf(value);
|
|
197
|
-
if (proto === null || proto === O[PROTOTYPE])
|
|
198
|
-
return true;
|
|
199
|
-
const Ctor = O.hasOwnProperty.call(proto, CONSTRUCTOR) && proto[CONSTRUCTOR];
|
|
200
|
-
if (Ctor === Object)
|
|
201
|
-
return true;
|
|
202
|
-
if (!isFunction(Ctor))
|
|
203
|
-
return false;
|
|
204
|
-
let ctorString = cachedCtorStrings.get(Ctor);
|
|
205
|
-
if (ctorString === void 0) {
|
|
206
|
-
ctorString = Function.toString.call(Ctor);
|
|
207
|
-
cachedCtorStrings.set(Ctor, ctorString);
|
|
259
|
+
// src/utils/getRgb.ts
|
|
260
|
+
var getRgb = (value) => {
|
|
261
|
+
if (!value) return null;
|
|
262
|
+
let trimmed = value.trim().toLowerCase();
|
|
263
|
+
const namedColor = colorNames[trimmed];
|
|
264
|
+
if (namedColor) trimmed = namedColor;
|
|
265
|
+
const hexMatch = trimmed.match(/^#?([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i);
|
|
266
|
+
if (hexMatch) {
|
|
267
|
+
const hex = hexMatch[1];
|
|
268
|
+
let normalized = hex;
|
|
269
|
+
if (hex.length === 3) {
|
|
270
|
+
normalized = hex.split("").map((c) => c + c).join("");
|
|
271
|
+
} else if (hex.length === 8) {
|
|
272
|
+
const alpha = parseInt(hex.substring(6, 8), 16);
|
|
273
|
+
normalized = hex.substring(0, 6);
|
|
274
|
+
const intVal2 = parseInt(normalized, 16);
|
|
275
|
+
return {
|
|
276
|
+
r: intVal2 >> 16 & 255,
|
|
277
|
+
g: intVal2 >> 8 & 255,
|
|
278
|
+
b: intVal2 & 255,
|
|
279
|
+
a: alpha / 255
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
const intVal = parseInt(normalized, 16);
|
|
283
|
+
return {
|
|
284
|
+
r: intVal >> 16 & 255,
|
|
285
|
+
g: intVal >> 8 & 255,
|
|
286
|
+
b: intVal & 255
|
|
287
|
+
};
|
|
208
288
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
289
|
+
const rgbMatch = trimmed.match(/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*([0-9.]+))?\s*\)$/i);
|
|
290
|
+
if (rgbMatch) {
|
|
291
|
+
const result = {
|
|
292
|
+
r: Number(rgbMatch[1]),
|
|
293
|
+
g: Number(rgbMatch[2]),
|
|
294
|
+
b: Number(rgbMatch[3])
|
|
295
|
+
};
|
|
296
|
+
if (rgbMatch[4] !== void 0) {
|
|
297
|
+
result.a = Number(rgbMatch[4]);
|
|
298
|
+
}
|
|
299
|
+
return result;
|
|
219
300
|
}
|
|
220
|
-
|
|
221
|
-
function getArchtype(thing) {
|
|
222
|
-
const state = thing[DRAFT_STATE];
|
|
223
|
-
return state ? state.type_ : isArray(thing) ? 1 : isMap(thing) ? 2 : isSet(thing) ? 3 : 0;
|
|
224
|
-
}
|
|
225
|
-
var has = (thing, prop, type = getArchtype(thing)) => type === 2 ? thing.has(prop) : O[PROTOTYPE].hasOwnProperty.call(thing, prop);
|
|
226
|
-
var get = (thing, prop, type = getArchtype(thing)) => (
|
|
227
|
-
// @ts-ignore
|
|
228
|
-
type === 2 ? thing.get(prop) : thing[prop]
|
|
229
|
-
);
|
|
230
|
-
var set = (thing, propOrOldValue, value, type = getArchtype(thing)) => {
|
|
231
|
-
if (type === 2)
|
|
232
|
-
thing.set(propOrOldValue, value);
|
|
233
|
-
else if (type === 3) {
|
|
234
|
-
thing.add(value);
|
|
235
|
-
} else
|
|
236
|
-
thing[propOrOldValue] = value;
|
|
301
|
+
return null;
|
|
237
302
|
};
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
var isBoolean = (target) => typeof target === "boolean";
|
|
251
|
-
function isArrayIndex(value) {
|
|
252
|
-
const n = +value;
|
|
253
|
-
return Number.isInteger(n) && String(n) === value;
|
|
254
|
-
}
|
|
255
|
-
var latest = (state) => state.copy_ || state.base_;
|
|
256
|
-
var getFinalValue = (state) => state.modified_ ? state.copy_ : state.base_;
|
|
257
|
-
function shallowCopy(base, strict) {
|
|
258
|
-
if (isMap(base)) {
|
|
259
|
-
return new Map(base);
|
|
303
|
+
|
|
304
|
+
// src/utils/getHex.ts
|
|
305
|
+
var getHex = (value) => {
|
|
306
|
+
const rgb = getRgb(value);
|
|
307
|
+
if (!rgb) return null;
|
|
308
|
+
const toHex = (n) => {
|
|
309
|
+
const hex = Math.round(n).toString(16);
|
|
310
|
+
return hex.length === 1 ? "0" + hex : hex;
|
|
311
|
+
};
|
|
312
|
+
const hexString = `#${toHex(rgb.r)}${toHex(rgb.g)}${toHex(rgb.b)}`;
|
|
313
|
+
if (rgb.a !== void 0) {
|
|
314
|
+
return `${hexString}${toHex(rgb.a * 255)}`;
|
|
260
315
|
}
|
|
261
|
-
|
|
262
|
-
|
|
316
|
+
return hexString;
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
// src/utils/getBlendedColor.ts
|
|
320
|
+
var getBlendedColor = (foreground, background, alpha) => {
|
|
321
|
+
const fg = getRgb(foreground);
|
|
322
|
+
const bg = getRgb(background);
|
|
323
|
+
if (!fg || !bg) return background;
|
|
324
|
+
const safeAlpha = Math.min(1, Math.max(0, alpha));
|
|
325
|
+
const r = Math.round(fg.r * safeAlpha + bg.r * (1 - safeAlpha));
|
|
326
|
+
const g = Math.round(fg.g * safeAlpha + bg.g * (1 - safeAlpha));
|
|
327
|
+
const b = Math.round(fg.b * safeAlpha + bg.b * (1 - safeAlpha));
|
|
328
|
+
return getHex(`rgb(${r}, ${g}, ${b})`) ?? background;
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
// src/utils/getTonalColor.ts
|
|
332
|
+
var getTonalColor = (color, lightness) => {
|
|
333
|
+
const rgb = getRgb(color);
|
|
334
|
+
if (!rgb) return color;
|
|
335
|
+
const r = rgb.r / 255;
|
|
336
|
+
const g = rgb.g / 255;
|
|
337
|
+
const b = rgb.b / 255;
|
|
338
|
+
const max = Math.max(r, g, b);
|
|
339
|
+
const min = Math.min(r, g, b);
|
|
340
|
+
const delta = max - min;
|
|
341
|
+
let h = 0;
|
|
342
|
+
if (delta !== 0) {
|
|
343
|
+
if (max === r) h = (g - b) / delta % 6;
|
|
344
|
+
else if (max === g) h = (b - r) / delta + 2;
|
|
345
|
+
else h = (r - g) / delta + 4;
|
|
346
|
+
h = (h * 60 + 360) % 360;
|
|
263
347
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
const
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
348
|
+
const l = (max + min) / 2;
|
|
349
|
+
const s = delta === 0 ? 0 : delta / (1 - Math.abs(2 * l - 1));
|
|
350
|
+
const targetL = Math.min(1, Math.max(0, lightness));
|
|
351
|
+
const c = (1 - Math.abs(2 * targetL - 1)) * s;
|
|
352
|
+
const x = c * (1 - Math.abs(h / 60 % 2 - 1));
|
|
353
|
+
const m = targetL - c / 2;
|
|
354
|
+
let r2 = 0, g2 = 0, b2 = 0;
|
|
355
|
+
if (h < 60) {
|
|
356
|
+
r2 = c;
|
|
357
|
+
g2 = x;
|
|
358
|
+
b2 = 0;
|
|
359
|
+
} else if (h < 120) {
|
|
360
|
+
r2 = x;
|
|
361
|
+
g2 = c;
|
|
362
|
+
b2 = 0;
|
|
363
|
+
} else if (h < 180) {
|
|
364
|
+
r2 = 0;
|
|
365
|
+
g2 = c;
|
|
366
|
+
b2 = x;
|
|
367
|
+
} else if (h < 240) {
|
|
368
|
+
r2 = 0;
|
|
369
|
+
g2 = x;
|
|
370
|
+
b2 = c;
|
|
371
|
+
} else if (h < 300) {
|
|
372
|
+
r2 = x;
|
|
373
|
+
g2 = 0;
|
|
374
|
+
b2 = c;
|
|
288
375
|
} else {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
376
|
+
r2 = c;
|
|
377
|
+
g2 = 0;
|
|
378
|
+
b2 = x;
|
|
379
|
+
}
|
|
380
|
+
const toInt = (n) => Math.round((n + m) * 255);
|
|
381
|
+
return getHex(`rgb(${toInt(r2)}, ${toInt(g2)}, ${toInt(b2)})`) ?? color;
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
// src/utils/getTriadicPalette.ts
|
|
385
|
+
var HARMONY_OFFSETS = {
|
|
386
|
+
analogous: [1 / 12, 2 / 12],
|
|
387
|
+
complementary: [1 / 4, 1 / 2],
|
|
388
|
+
"double-split": [1 / 12, 11 / 12],
|
|
389
|
+
"split-complementary": [5 / 12, 7 / 12],
|
|
390
|
+
square: [1 / 4, 3 / 4],
|
|
391
|
+
triadic: [1 / 3, 2 / 3]
|
|
392
|
+
};
|
|
393
|
+
function getTriadicPalette(primaryColor, harmony = "split-complementary") {
|
|
394
|
+
const rgb = getRgb(primaryColor);
|
|
395
|
+
if (!rgb) throw new Error(`Invalid color format: ${primaryColor}`);
|
|
396
|
+
const r = rgb.r / 255;
|
|
397
|
+
const g = rgb.g / 255;
|
|
398
|
+
const b = rgb.b / 255;
|
|
399
|
+
const max = Math.max(r, g, b);
|
|
400
|
+
const min = Math.min(r, g, b);
|
|
401
|
+
const l = (max + min) / 2;
|
|
402
|
+
let h = 0;
|
|
403
|
+
let s = 0;
|
|
404
|
+
if (max !== min) {
|
|
405
|
+
const d = max - min;
|
|
406
|
+
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
407
|
+
switch (max) {
|
|
408
|
+
case r:
|
|
409
|
+
h = ((g - b) / d + (g < b ? 6 : 0)) / 6;
|
|
410
|
+
break;
|
|
411
|
+
case g:
|
|
412
|
+
h = ((b - r) / d + 2) / 6;
|
|
413
|
+
break;
|
|
414
|
+
case b:
|
|
415
|
+
h = ((r - g) / d + 4) / 6;
|
|
416
|
+
break;
|
|
292
417
|
}
|
|
293
|
-
const obj = O.create(proto);
|
|
294
|
-
return O.assign(obj, base);
|
|
295
418
|
}
|
|
419
|
+
const [o1, o2] = HARMONY_OFFSETS[harmony];
|
|
420
|
+
return {
|
|
421
|
+
primary: getHex(primaryColor) ?? primaryColor,
|
|
422
|
+
secondary: hslToHex((h + o1) % 1, s, l),
|
|
423
|
+
tertiary: hslToHex((h + o2) % 1, s, l)
|
|
424
|
+
};
|
|
296
425
|
}
|
|
297
|
-
function
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
426
|
+
function hslToHex(h, s, l) {
|
|
427
|
+
const c = (1 - Math.abs(2 * l - 1)) * s;
|
|
428
|
+
const x = c * (1 - Math.abs(h * 6 % 2 - 1));
|
|
429
|
+
const m = l - c / 2;
|
|
430
|
+
let r = 0;
|
|
431
|
+
let g = 0;
|
|
432
|
+
let b = 0;
|
|
433
|
+
if (h < 1 / 6) {
|
|
434
|
+
r = c;
|
|
435
|
+
g = x;
|
|
436
|
+
b = 0;
|
|
437
|
+
} else if (h < 2 / 6) {
|
|
438
|
+
r = x;
|
|
439
|
+
g = c;
|
|
440
|
+
b = 0;
|
|
441
|
+
} else if (h < 3 / 6) {
|
|
442
|
+
r = 0;
|
|
443
|
+
g = c;
|
|
444
|
+
b = x;
|
|
445
|
+
} else if (h < 4 / 6) {
|
|
446
|
+
r = 0;
|
|
447
|
+
g = x;
|
|
448
|
+
b = c;
|
|
449
|
+
} else if (h < 5 / 6) {
|
|
450
|
+
r = x;
|
|
451
|
+
g = 0;
|
|
452
|
+
b = c;
|
|
453
|
+
} else {
|
|
454
|
+
r = c;
|
|
455
|
+
g = 0;
|
|
456
|
+
b = x;
|
|
307
457
|
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
freeze(value, true);
|
|
314
|
-
},
|
|
315
|
-
false
|
|
316
|
-
);
|
|
317
|
-
return obj;
|
|
318
|
-
}
|
|
319
|
-
function dontMutateFrozenCollections() {
|
|
320
|
-
die(2);
|
|
458
|
+
const toHex = (value) => {
|
|
459
|
+
const hex = Math.round((value + m) * 255).toString(16);
|
|
460
|
+
return hex.length === 1 ? `0${hex}` : hex;
|
|
461
|
+
};
|
|
462
|
+
return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
|
|
321
463
|
}
|
|
322
|
-
|
|
323
|
-
|
|
464
|
+
|
|
465
|
+
// src/utils/isDarkColor.ts
|
|
466
|
+
var isDarkColor = (value) => {
|
|
467
|
+
const rgb = getRgb(value);
|
|
468
|
+
if (!rgb) return false;
|
|
469
|
+
const [r, g, b] = [rgb.r / 255, rgb.g / 255, rgb.b / 255];
|
|
470
|
+
const [rs, gs, bs] = [r, g, b].map((c) => c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4));
|
|
471
|
+
const luminance = 0.2126 * rs + 0.7152 * gs + 0.0722 * bs;
|
|
472
|
+
return luminance < 0.5;
|
|
324
473
|
};
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
474
|
+
|
|
475
|
+
// src/useComputedTheme.ts
|
|
476
|
+
function useComputedTheme(appearance, color, harmony = "split-complementary") {
|
|
477
|
+
const [theme, setTheme] = useState(null);
|
|
478
|
+
const computeTheme = useCallback(() => {
|
|
479
|
+
let resolved = appearance;
|
|
480
|
+
if (resolved === "system") resolved = Appearance.getColorScheme();
|
|
481
|
+
if (resolved === "no-preference" || !resolved) resolved = "light";
|
|
482
|
+
const base = resolved === "dark" ? MD3DarkTheme : MD3LightTheme;
|
|
483
|
+
const _theme = {
|
|
484
|
+
...base,
|
|
485
|
+
colors: {
|
|
486
|
+
...base.colors,
|
|
487
|
+
elevation: { ...base.colors.elevation }
|
|
488
|
+
}
|
|
489
|
+
};
|
|
490
|
+
const palette = getTriadicPalette(color, harmony);
|
|
491
|
+
const surface = base.colors.surface;
|
|
492
|
+
_theme.colors.primary = palette.primary;
|
|
493
|
+
_theme.colors.onPrimary = getTonalColor(palette.primary, isDarkColor(palette.primary) ? 0.95 : 0.08);
|
|
494
|
+
_theme.colors.primaryContainer = getBlendedColor(palette.primary, surface, 0.15);
|
|
495
|
+
_theme.colors.onPrimaryContainer = getTonalColor(palette.primary, isDarkColor(_theme.colors.primaryContainer) ? 0.92 : 0.12);
|
|
496
|
+
_theme.colors.secondary = palette.secondary;
|
|
497
|
+
_theme.colors.onSecondary = getTonalColor(palette.secondary, isDarkColor(palette.secondary) ? 0.95 : 0.08);
|
|
498
|
+
_theme.colors.secondaryContainer = getBlendedColor(palette.secondary, surface, 0.15);
|
|
499
|
+
_theme.colors.onSecondaryContainer = getTonalColor(palette.secondary, isDarkColor(_theme.colors.secondaryContainer) ? 0.92 : 0.12);
|
|
500
|
+
_theme.colors.tertiary = palette.tertiary;
|
|
501
|
+
_theme.colors.onTertiary = getTonalColor(palette.tertiary, isDarkColor(palette.tertiary) ? 0.95 : 0.08);
|
|
502
|
+
_theme.colors.tertiaryContainer = getBlendedColor(palette.tertiary, surface, 0.15);
|
|
503
|
+
_theme.colors.onTertiaryContainer = getTonalColor(palette.tertiary, isDarkColor(_theme.colors.tertiaryContainer) ? 0.92 : 0.12);
|
|
504
|
+
const blended = getBlendedColor(color, palette.secondary, 0.5);
|
|
505
|
+
const tintSurface = (alpha) => getBlendedColor(blended, surface, alpha);
|
|
506
|
+
_theme.colors.background = base.dark ? "#0F0F0F" : "#F0F0F0";
|
|
507
|
+
_theme.colors.surface = surface;
|
|
508
|
+
_theme.colors.surfaceVariant = tintSurface(0.2);
|
|
509
|
+
_theme.colors.outline = getBlendedColor(color, base.colors.outline, 0.45);
|
|
510
|
+
const grey = base.dark ? "#424242" : "#c2c2c2";
|
|
511
|
+
const blendedGrey = getBlendedColor(blended, grey, 0.05);
|
|
512
|
+
_theme.colors.elevation = {
|
|
513
|
+
..._theme.colors.elevation,
|
|
514
|
+
level1: _theme.colors.surface,
|
|
515
|
+
level2: getBlendedColor(blendedGrey, _theme.colors.surface, 0.25),
|
|
516
|
+
level3: getBlendedColor(blendedGrey, _theme.colors.surface, 0.4),
|
|
517
|
+
level4: getBlendedColor(blendedGrey, _theme.colors.surface, 0.55),
|
|
518
|
+
level5: getBlendedColor(blendedGrey, _theme.colors.surface, 0.7)
|
|
519
|
+
};
|
|
520
|
+
setTheme(_theme);
|
|
521
|
+
}, [appearance, color, harmony]);
|
|
522
|
+
useEffect(() => {
|
|
523
|
+
computeTheme();
|
|
524
|
+
}, [computeTheme]);
|
|
525
|
+
useEffect(() => {
|
|
526
|
+
const subscription = Appearance.addChangeListener(computeTheme);
|
|
527
|
+
return subscription.remove;
|
|
528
|
+
}, [computeTheme]);
|
|
529
|
+
return theme;
|
|
329
530
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
var
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
531
|
+
|
|
532
|
+
// src/ThemeProvider.tsx
|
|
533
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
534
|
+
var NavBarContext = createContext3({});
|
|
535
|
+
var useNavBarContext = () => useContext4(NavBarContext);
|
|
536
|
+
function Provider({ overrides, onChange, children, defaults, onNavBarChange, onReady, statusBarProps, style }) {
|
|
537
|
+
const [settings, setSettings] = useState2(() => ({ ...defaultThemeSettings, ...overrides }));
|
|
538
|
+
const set2 = useCallback2(
|
|
539
|
+
(patch) => {
|
|
540
|
+
setSettings((prev) => {
|
|
541
|
+
const next = { ...prev, ...patch };
|
|
542
|
+
onChange?.(next);
|
|
543
|
+
return next;
|
|
544
|
+
});
|
|
545
|
+
},
|
|
546
|
+
[onChange]
|
|
547
|
+
);
|
|
548
|
+
const theme = useComputedTheme(settings.appearance, settings.color, settings.harmony);
|
|
549
|
+
const called = useRef(false);
|
|
550
|
+
useEffect2(() => {
|
|
551
|
+
if (theme && !called.current) {
|
|
552
|
+
called.current = true;
|
|
553
|
+
onReady?.();
|
|
554
|
+
}
|
|
555
|
+
}, [theme, onReady]);
|
|
556
|
+
if (!theme) return null;
|
|
557
|
+
return /* @__PURE__ */ jsx4(ThemeSettingsContext.Provider, { value: { settings, set: set2 }, children: /* @__PURE__ */ jsxs3(PaperProvider, { theme, children: [
|
|
558
|
+
/* @__PURE__ */ jsx4(StatusBar2, { backgroundColor: theme.colors.background, barStyle: theme.dark ? "light-content" : "dark-content", ...statusBarProps }),
|
|
559
|
+
/* @__PURE__ */ jsx4(PaperDefaultsContext.Provider, { value: defaults ?? {}, children: /* @__PURE__ */ jsx4(NavBarContext.Provider, { value: { onNavBarChange }, children: /* @__PURE__ */ jsx4(View2, { style: [styles.flex, { backgroundColor: theme.colors.background }, style], children }) }) })
|
|
560
|
+
] }) });
|
|
340
561
|
}
|
|
341
|
-
var
|
|
342
|
-
|
|
343
|
-
var getCurrentScope = () => currentScope;
|
|
344
|
-
var createScope = (parent_, immer_) => ({
|
|
345
|
-
drafts_: [],
|
|
346
|
-
parent_,
|
|
347
|
-
immer_,
|
|
348
|
-
// Whenever the modified draft contains a draft from another scope, we
|
|
349
|
-
// need to prevent auto-freezing so the unowned draft can be finalized.
|
|
350
|
-
canAutoFreeze_: true,
|
|
351
|
-
unfinalizedDrafts_: 0,
|
|
352
|
-
handledSet_: /* @__PURE__ */ new Set(),
|
|
353
|
-
processedForPatches_: /* @__PURE__ */ new Set(),
|
|
354
|
-
mapSetPlugin_: isPluginLoaded(PluginMapSet) ? getPlugin(PluginMapSet) : void 0,
|
|
355
|
-
arrayMethodsPlugin_: isPluginLoaded(PluginArrayMethods) ? getPlugin(PluginArrayMethods) : void 0
|
|
562
|
+
var styles = StyleSheet2.create({
|
|
563
|
+
flex: { flex: 1 }
|
|
356
564
|
});
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
565
|
+
|
|
566
|
+
// src/components/BottomNavigation.tsx
|
|
567
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
568
|
+
function useNavigationBarSync() {
|
|
569
|
+
const theme = useTheme3();
|
|
570
|
+
const { onNavBarChange } = useNavBarContext();
|
|
571
|
+
useEffect3(() => {
|
|
572
|
+
if (Platform.OS !== "android" || !onNavBarChange) return;
|
|
573
|
+
onNavBarChange(theme.colors.surface, theme.dark);
|
|
574
|
+
}, [theme, onNavBarChange]);
|
|
364
575
|
}
|
|
365
|
-
function
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
576
|
+
function BottomNavigationComponent(props) {
|
|
577
|
+
const defaults = usePaperDefaults();
|
|
578
|
+
useNavigationBarSync();
|
|
579
|
+
return /* @__PURE__ */ jsx5(PaperBottomNavigation, { ...defaults.BottomNavigation, ...props });
|
|
369
580
|
}
|
|
370
|
-
function
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
}
|
|
581
|
+
function Bar(props) {
|
|
582
|
+
useNavigationBarSync();
|
|
583
|
+
return /* @__PURE__ */ jsx5(PaperBottomNavigation.Bar, { ...props });
|
|
374
584
|
}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
585
|
+
BottomNavigationComponent.Bar = Bar;
|
|
586
|
+
BottomNavigationComponent.SceneMap = PaperBottomNavigation.SceneMap;
|
|
587
|
+
var BottomNavigation = BottomNavigationComponent;
|
|
588
|
+
|
|
589
|
+
// src/components/Button.tsx
|
|
590
|
+
import { Button as PaperButton } from "react-native-paper";
|
|
591
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
592
|
+
function Button(props) {
|
|
593
|
+
const defaults = usePaperDefaults();
|
|
594
|
+
return /* @__PURE__ */ jsx6(PaperButton, { ...defaults.Button, ...props });
|
|
382
595
|
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
596
|
+
|
|
597
|
+
// src/components/Chip.tsx
|
|
598
|
+
import { Chip as PaperChip } from "react-native-paper";
|
|
599
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
600
|
+
function Chip(props) {
|
|
601
|
+
const defaults = usePaperDefaults();
|
|
602
|
+
return /* @__PURE__ */ jsx7(PaperChip, { ...defaults.Chip, ...props });
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
// src/components/ColorPicker.tsx
|
|
606
|
+
import { useState as useState4 } from "react";
|
|
607
|
+
import { StyleSheet as StyleSheet4, TouchableOpacity, View as View4 } from "react-native";
|
|
608
|
+
import { Icon, TouchableRipple } from "react-native-paper";
|
|
609
|
+
|
|
610
|
+
// src/components/Dialog.tsx
|
|
611
|
+
import { useEffect as useEffect4, useRef as useRef2, useState as useState3 } from "react";
|
|
612
|
+
import { Animated, StyleSheet as StyleSheet3, TouchableWithoutFeedback, View as View3 } from "react-native";
|
|
613
|
+
import { Dialog as PaperDialog, Portal, useTheme as useTheme4 } from "react-native-paper";
|
|
614
|
+
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
615
|
+
function DialogComponent({ blur: blurProp, visible, onDismiss, children, style, ...rest }) {
|
|
616
|
+
const blur = useBlur(blurProp);
|
|
617
|
+
const { roundness, colors } = useTheme4();
|
|
618
|
+
const opacity = useRef2(new Animated.Value(0)).current;
|
|
619
|
+
const [mounted, setMounted] = useState3(visible);
|
|
620
|
+
useEffect4(() => {
|
|
621
|
+
if (visible) {
|
|
622
|
+
setMounted(true);
|
|
623
|
+
Animated.timing(opacity, { toValue: 1, duration: 200, useNativeDriver: true }).start();
|
|
624
|
+
} else {
|
|
625
|
+
Animated.timing(opacity, { toValue: 0, duration: 150, useNativeDriver: true }).start(() => setMounted(false));
|
|
394
626
|
}
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
627
|
+
}, [visible]);
|
|
628
|
+
if (!blur) {
|
|
629
|
+
return /* @__PURE__ */ jsx8(PaperDialog, { visible, onDismiss, style, ...rest, children });
|
|
630
|
+
}
|
|
631
|
+
if (!mounted) return null;
|
|
632
|
+
return /* @__PURE__ */ jsx8(Portal, { children: /* @__PURE__ */ jsxs4(Animated.View, { style: [StyleSheet3.absoluteFill, { opacity }], pointerEvents: visible ? "box-none" : "none", children: [
|
|
633
|
+
/* @__PURE__ */ jsx8(TouchableWithoutFeedback, { onPress: onDismiss, children: /* @__PURE__ */ jsx8(View3, { style: [StyleSheet3.absoluteFill, { backgroundColor: colors.backdrop }] }) }),
|
|
634
|
+
/* @__PURE__ */ jsx8(View3, { style: styles2.wrapper, pointerEvents: "box-none", children: /* @__PURE__ */ jsx8(BlurView, { style: [styles2.card, { borderRadius: roundness * 7 }], children }) })
|
|
635
|
+
] }) });
|
|
636
|
+
}
|
|
637
|
+
DialogComponent.Title = PaperDialog.Title;
|
|
638
|
+
DialogComponent.Content = PaperDialog.Content;
|
|
639
|
+
DialogComponent.Actions = PaperDialog.Actions;
|
|
640
|
+
DialogComponent.ScrollArea = PaperDialog.ScrollArea;
|
|
641
|
+
var Dialog = DialogComponent;
|
|
642
|
+
var styles2 = StyleSheet3.create({
|
|
643
|
+
card: { overflow: "hidden" },
|
|
644
|
+
wrapper: { flex: 1, justifyContent: "center", paddingHorizontal: 26 }
|
|
645
|
+
});
|
|
646
|
+
|
|
647
|
+
// src/components/ColorPicker.tsx
|
|
648
|
+
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
649
|
+
var defaultColors = [
|
|
650
|
+
{ label: "Red", value: "#f44336" },
|
|
651
|
+
{ label: "Coral", value: "#ff5722" },
|
|
652
|
+
{ label: "Orange", value: "#ff6d00" },
|
|
653
|
+
{ label: "Amber", value: "#ff9800" },
|
|
654
|
+
{ label: "Yellow", value: "#fdd835" },
|
|
655
|
+
{ label: "Lime", value: "#8bc34a" },
|
|
656
|
+
{ label: "Emerald", value: "#4caf50" },
|
|
657
|
+
{ label: "Teal", value: "#009688" },
|
|
658
|
+
{ label: "Cyan", value: "#00bcd4" },
|
|
659
|
+
{ label: "Blue", value: "#2196f3" },
|
|
660
|
+
{ label: "Indigo", value: "#3f51b5" },
|
|
661
|
+
{ label: "Deep Purple", value: "#673ab7" },
|
|
662
|
+
{ label: "Violet", value: "#9c27b0" },
|
|
663
|
+
{ label: "Magenta", value: "#d500f9" },
|
|
664
|
+
{ label: "Pink", value: "#ec407a" },
|
|
665
|
+
{ label: "Rose", value: "#e91e63" },
|
|
666
|
+
{ label: "Brown", value: "#795548" },
|
|
667
|
+
{ label: "Blue Grey", value: "#607d8b" }
|
|
668
|
+
];
|
|
669
|
+
var ColorPicker = ({ value, onChange, colors = defaultColors, blur: blurProp }) => {
|
|
670
|
+
const blur = useBlur(blurProp);
|
|
671
|
+
const [open, setOpen] = useState4(false);
|
|
672
|
+
return /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
673
|
+
/* @__PURE__ */ jsx9(TouchableRipple, { onPress: () => setOpen(true), style: [styles3.trigger, { backgroundColor: value }], borderless: true, children: /* @__PURE__ */ jsx9(Icon, { source: "palette", size: 20, color: "white" }) }),
|
|
674
|
+
/* @__PURE__ */ jsx9(Dialog, { blur, visible: open, onDismiss: () => setOpen(false), children: /* @__PURE__ */ jsx9(Dialog.Content, { children: /* @__PURE__ */ jsx9(View4, { style: styles3.swatches, children: colors.map(({ value: hex }) => /* @__PURE__ */ jsx9(
|
|
675
|
+
TouchableOpacity,
|
|
676
|
+
{
|
|
677
|
+
onPress: () => {
|
|
678
|
+
onChange(hex);
|
|
679
|
+
setOpen(false);
|
|
680
|
+
},
|
|
681
|
+
style: [styles3.swatch, { backgroundColor: hex }, value === hex && styles3.selected],
|
|
682
|
+
children: value === hex && /* @__PURE__ */ jsx9(Icon, { source: "check", size: 20, color: "white" })
|
|
683
|
+
},
|
|
684
|
+
hex
|
|
685
|
+
)) }) }) })
|
|
686
|
+
] });
|
|
687
|
+
};
|
|
688
|
+
var styles3 = StyleSheet4.create({
|
|
689
|
+
selected: { borderColor: "white", borderWidth: 3 },
|
|
690
|
+
swatch: { alignItems: "center", borderRadius: 24, height: 48, justifyContent: "center", width: 48 },
|
|
691
|
+
swatches: { flexDirection: "row", flexWrap: "wrap", gap: 12, paddingTop: 12 },
|
|
692
|
+
trigger: { alignItems: "center", alignSelf: "flex-start", borderRadius: 24, height: 48, justifyContent: "center", width: 48 }
|
|
693
|
+
});
|
|
694
|
+
|
|
695
|
+
// src/components/FAB.tsx
|
|
696
|
+
import { FAB as PaperFAB } from "react-native-paper";
|
|
697
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
698
|
+
function FAB(props) {
|
|
699
|
+
const defaults = usePaperDefaults();
|
|
700
|
+
return /* @__PURE__ */ jsx10(PaperFAB, { ...defaults.FAB, ...props });
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
// src/components/HarmonyPicker.tsx
|
|
704
|
+
import { useState as useState5 } from "react";
|
|
705
|
+
import { Button as Button2 } from "react-native-paper";
|
|
706
|
+
|
|
707
|
+
// src/components/Menu.tsx
|
|
708
|
+
import { StyleSheet as StyleSheet5 } from "react-native";
|
|
709
|
+
import { Menu as PaperMenu } from "react-native-paper";
|
|
710
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
711
|
+
var MenuComponent = ({ blur: blurProp, children, ...props }) => {
|
|
712
|
+
const blur = useBlur(blurProp);
|
|
713
|
+
return /* @__PURE__ */ jsx11(PaperMenu, { ...props, contentStyle: [styles4.content, props.contentStyle], children: /* @__PURE__ */ jsx11(BlurView, { blur, children }) });
|
|
714
|
+
};
|
|
715
|
+
var Menu = Object.assign(MenuComponent, {
|
|
716
|
+
Item: PaperMenu.Item
|
|
717
|
+
});
|
|
718
|
+
var styles4 = StyleSheet5.create({
|
|
719
|
+
content: { backgroundColor: "transparent", paddingVertical: 0 }
|
|
720
|
+
});
|
|
721
|
+
|
|
722
|
+
// src/components/HarmonyPicker.tsx
|
|
723
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
724
|
+
var HARMONIES = [
|
|
725
|
+
{ label: "Triadic", value: "triadic", icon: "triangle-outline" },
|
|
726
|
+
{ label: "Split", value: "split-complementary", icon: "arrow-split-vertical" },
|
|
727
|
+
{ label: "Analogous", value: "analogous", icon: "ray-end-arrow" },
|
|
728
|
+
{ label: "Square", value: "square", icon: "square-outline" },
|
|
729
|
+
{ label: "Complement", value: "complementary", icon: "circle-half-full" },
|
|
730
|
+
{ label: "Dbl Split", value: "double-split", icon: "arrow-expand-horizontal" }
|
|
731
|
+
];
|
|
732
|
+
var HarmonyPicker = ({ value, onChange, blur: blurProp }) => {
|
|
733
|
+
const blur = useBlur(blurProp);
|
|
734
|
+
const [open, setOpen] = useState5(false);
|
|
735
|
+
const selected = HARMONIES.find((h) => h.value === value);
|
|
736
|
+
return /* @__PURE__ */ jsx12(
|
|
737
|
+
Menu,
|
|
738
|
+
{
|
|
739
|
+
blur,
|
|
740
|
+
visible: open,
|
|
741
|
+
onDismiss: () => setOpen(false),
|
|
742
|
+
anchor: /* @__PURE__ */ jsx12(Button2, { mode: "outlined", icon: selected.icon, onPress: () => setOpen(true), children: selected.label }),
|
|
743
|
+
children: HARMONIES.map((h) => /* @__PURE__ */ jsx12(
|
|
744
|
+
Menu.Item,
|
|
745
|
+
{
|
|
746
|
+
leadingIcon: h.value === value ? "check" : h.icon,
|
|
747
|
+
title: h.label,
|
|
748
|
+
onPress: () => {
|
|
749
|
+
onChange(h.value);
|
|
750
|
+
setOpen(false);
|
|
751
|
+
}
|
|
752
|
+
},
|
|
753
|
+
h.value
|
|
754
|
+
))
|
|
402
755
|
}
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
return
|
|
756
|
+
);
|
|
757
|
+
};
|
|
758
|
+
|
|
759
|
+
// src/components/IconButton.tsx
|
|
760
|
+
import { IconButton as PaperIconButton } from "react-native-paper";
|
|
761
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
762
|
+
function IconButton(props) {
|
|
763
|
+
const defaults = usePaperDefaults();
|
|
764
|
+
return /* @__PURE__ */ jsx13(PaperIconButton, { ...defaults.IconButton, ...props });
|
|
412
765
|
}
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
|
|
766
|
+
|
|
767
|
+
// src/components/TextInput.tsx
|
|
768
|
+
import { forwardRef } from "react";
|
|
769
|
+
import { TextInput as PaperTextInput } from "react-native-paper";
|
|
770
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
771
|
+
var TextInput = forwardRef(function TextInput2(props, ref) {
|
|
772
|
+
const defaults = usePaperDefaults();
|
|
773
|
+
return /* @__PURE__ */ jsx14(PaperTextInput, { ref, ...defaults.TextInput, ...props });
|
|
774
|
+
});
|
|
775
|
+
|
|
776
|
+
// node_modules/redux/dist/redux.mjs
|
|
777
|
+
var randomString = () => Math.random().toString(36).substring(7).split("").join(".");
|
|
778
|
+
var ActionTypes = {
|
|
779
|
+
INIT: `@@redux/INIT${/* @__PURE__ */ randomString()}`,
|
|
780
|
+
REPLACE: `@@redux/REPLACE${/* @__PURE__ */ randomString()}`,
|
|
781
|
+
PROBE_UNKNOWN_ACTION: () => `@@redux/PROBE_UNKNOWN_ACTION${randomString()}`
|
|
782
|
+
};
|
|
783
|
+
function isPlainObject(obj) {
|
|
784
|
+
if (typeof obj !== "object" || obj === null)
|
|
785
|
+
return false;
|
|
786
|
+
let proto = obj;
|
|
787
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
788
|
+
proto = Object.getPrototypeOf(proto);
|
|
423
789
|
}
|
|
424
|
-
|
|
425
|
-
|
|
790
|
+
return Object.getPrototypeOf(obj) === proto || Object.getPrototypeOf(obj) === null;
|
|
791
|
+
}
|
|
792
|
+
function compose(...funcs) {
|
|
793
|
+
if (funcs.length === 0) {
|
|
794
|
+
return (arg) => arg;
|
|
426
795
|
}
|
|
427
|
-
if (
|
|
428
|
-
|
|
429
|
-
if (callbacks_) {
|
|
430
|
-
while (callbacks_.length > 0) {
|
|
431
|
-
const callback = callbacks_.pop();
|
|
432
|
-
callback(rootScope);
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
generatePatchesAndFinalize(state, rootScope);
|
|
796
|
+
if (funcs.length === 1) {
|
|
797
|
+
return funcs[0];
|
|
436
798
|
}
|
|
437
|
-
return
|
|
799
|
+
return funcs.reduce((a, b) => (...args) => a(b(...args)));
|
|
438
800
|
}
|
|
439
|
-
function
|
|
440
|
-
|
|
441
|
-
|
|
801
|
+
function isAction(action) {
|
|
802
|
+
return isPlainObject(action) && "type" in action && typeof action.type === "string";
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
// node_modules/immer/dist/immer.mjs
|
|
806
|
+
var NOTHING = /* @__PURE__ */ Symbol.for("immer-nothing");
|
|
807
|
+
var DRAFTABLE = /* @__PURE__ */ Symbol.for("immer-draftable");
|
|
808
|
+
var DRAFT_STATE = /* @__PURE__ */ Symbol.for("immer-state");
|
|
809
|
+
var errors = process.env.NODE_ENV !== "production" ? [
|
|
810
|
+
// All error codes, starting by 0:
|
|
811
|
+
function(plugin) {
|
|
812
|
+
return `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \`enable${plugin}()\` when initializing your application.`;
|
|
813
|
+
},
|
|
814
|
+
function(thing) {
|
|
815
|
+
return `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${thing}'`;
|
|
816
|
+
},
|
|
817
|
+
"This object has been frozen and should not be mutated",
|
|
818
|
+
function(data) {
|
|
819
|
+
return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + data;
|
|
820
|
+
},
|
|
821
|
+
"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",
|
|
822
|
+
"Immer forbids circular references",
|
|
823
|
+
"The first or second argument to `produce` must be a function",
|
|
824
|
+
"The third argument to `produce` must be a function or undefined",
|
|
825
|
+
"First argument to `createDraft` must be a plain object, an array, or an immerable object",
|
|
826
|
+
"First argument to `finishDraft` must be a draft returned by `createDraft`",
|
|
827
|
+
function(thing) {
|
|
828
|
+
return `'current' expects a draft, got: ${thing}`;
|
|
829
|
+
},
|
|
830
|
+
"Object.defineProperty() cannot be used on an Immer draft",
|
|
831
|
+
"Object.setPrototypeOf() cannot be used on an Immer draft",
|
|
832
|
+
"Immer only supports deleting array indices",
|
|
833
|
+
"Immer only supports setting array indices and the 'length' property",
|
|
834
|
+
function(thing) {
|
|
835
|
+
return `'original' expects a draft, got: ${thing}`;
|
|
836
|
+
}
|
|
837
|
+
// Note: if more errors are added, the errorOffset in Patches.ts should be increased
|
|
838
|
+
// See Patches.ts for additional errors
|
|
839
|
+
] : [];
|
|
840
|
+
function die(error, ...args) {
|
|
841
|
+
if (process.env.NODE_ENV !== "production") {
|
|
842
|
+
const e = errors[error];
|
|
843
|
+
const msg = isFunction(e) ? e.apply(null, args) : e;
|
|
844
|
+
throw new Error(`[Immer] ${msg}`);
|
|
442
845
|
}
|
|
846
|
+
throw new Error(
|
|
847
|
+
`[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf`
|
|
848
|
+
);
|
|
443
849
|
}
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
850
|
+
var O = Object;
|
|
851
|
+
var getPrototypeOf = O.getPrototypeOf;
|
|
852
|
+
var CONSTRUCTOR = "constructor";
|
|
853
|
+
var PROTOTYPE = "prototype";
|
|
854
|
+
var CONFIGURABLE = "configurable";
|
|
855
|
+
var ENUMERABLE = "enumerable";
|
|
856
|
+
var WRITABLE = "writable";
|
|
857
|
+
var VALUE = "value";
|
|
858
|
+
var isDraft = (value) => !!value && !!value[DRAFT_STATE];
|
|
859
|
+
function isDraftable(value) {
|
|
860
|
+
if (!value)
|
|
861
|
+
return false;
|
|
862
|
+
return isPlainObject2(value) || isArray(value) || !!value[DRAFTABLE] || !!value[CONSTRUCTOR]?.[DRAFTABLE] || isMap(value) || isSet(value);
|
|
447
863
|
}
|
|
448
|
-
var
|
|
449
|
-
var
|
|
450
|
-
function
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
864
|
+
var objectCtorString = O[PROTOTYPE][CONSTRUCTOR].toString();
|
|
865
|
+
var cachedCtorStrings = /* @__PURE__ */ new WeakMap();
|
|
866
|
+
function isPlainObject2(value) {
|
|
867
|
+
if (!value || !isObjectish(value))
|
|
868
|
+
return false;
|
|
869
|
+
const proto = getPrototypeOf(value);
|
|
870
|
+
if (proto === null || proto === O[PROTOTYPE])
|
|
871
|
+
return true;
|
|
872
|
+
const Ctor = O.hasOwnProperty.call(proto, CONSTRUCTOR) && proto[CONSTRUCTOR];
|
|
873
|
+
if (Ctor === Object)
|
|
874
|
+
return true;
|
|
875
|
+
if (!isFunction(Ctor))
|
|
876
|
+
return false;
|
|
877
|
+
let ctorString = cachedCtorStrings.get(Ctor);
|
|
878
|
+
if (ctorString === void 0) {
|
|
879
|
+
ctorString = Function.toString.call(Ctor);
|
|
880
|
+
cachedCtorStrings.set(Ctor, ctorString);
|
|
459
881
|
}
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
}
|
|
882
|
+
return ctorString === objectCtorString;
|
|
883
|
+
}
|
|
884
|
+
function each(obj, iter, strict = true) {
|
|
885
|
+
if (getArchtype(obj) === 0) {
|
|
886
|
+
const keys = strict ? Reflect.ownKeys(obj) : O.keys(obj);
|
|
887
|
+
keys.forEach((key) => {
|
|
888
|
+
iter(key, obj[key], obj);
|
|
468
889
|
});
|
|
890
|
+
} else {
|
|
891
|
+
obj.forEach((entry, index) => iter(index, entry, obj));
|
|
469
892
|
}
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
893
|
+
}
|
|
894
|
+
function getArchtype(thing) {
|
|
895
|
+
const state = thing[DRAFT_STATE];
|
|
896
|
+
return state ? state.type_ : isArray(thing) ? 1 : isMap(thing) ? 2 : isSet(thing) ? 3 : 0;
|
|
897
|
+
}
|
|
898
|
+
var has = (thing, prop, type = getArchtype(thing)) => type === 2 ? thing.has(prop) : O[PROTOTYPE].hasOwnProperty.call(thing, prop);
|
|
899
|
+
var get = (thing, prop, type = getArchtype(thing)) => (
|
|
900
|
+
// @ts-ignore
|
|
901
|
+
type === 2 ? thing.get(prop) : thing[prop]
|
|
902
|
+
);
|
|
903
|
+
var set = (thing, propOrOldValue, value, type = getArchtype(thing)) => {
|
|
904
|
+
if (type === 2)
|
|
905
|
+
thing.set(propOrOldValue, value);
|
|
906
|
+
else if (type === 3) {
|
|
907
|
+
thing.add(value);
|
|
908
|
+
} else
|
|
909
|
+
thing[propOrOldValue] = value;
|
|
910
|
+
};
|
|
911
|
+
function is(x, y) {
|
|
912
|
+
if (x === y) {
|
|
913
|
+
return x !== 0 || 1 / x === 1 / y;
|
|
914
|
+
} else {
|
|
915
|
+
return x !== x && y !== y;
|
|
473
916
|
}
|
|
474
917
|
}
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
generatePatchesAndFinalize(state, rootScope);
|
|
485
|
-
});
|
|
918
|
+
var isArray = Array.isArray;
|
|
919
|
+
var isMap = (target) => target instanceof Map;
|
|
920
|
+
var isSet = (target) => target instanceof Set;
|
|
921
|
+
var isObjectish = (target) => typeof target === "object";
|
|
922
|
+
var isFunction = (target) => typeof target === "function";
|
|
923
|
+
var isBoolean = (target) => typeof target === "boolean";
|
|
924
|
+
function isArrayIndex(value) {
|
|
925
|
+
const n = +value;
|
|
926
|
+
return Number.isInteger(n) && String(n) === value;
|
|
486
927
|
}
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
928
|
+
var latest = (state) => state.copy_ || state.base_;
|
|
929
|
+
var getFinalValue = (state) => state.modified_ ? state.copy_ : state.base_;
|
|
930
|
+
function shallowCopy(base, strict) {
|
|
931
|
+
if (isMap(base)) {
|
|
932
|
+
return new Map(base);
|
|
933
|
+
}
|
|
934
|
+
if (isSet(base)) {
|
|
935
|
+
return new Set(base);
|
|
936
|
+
}
|
|
937
|
+
if (isArray(base))
|
|
938
|
+
return Array[PROTOTYPE].slice.call(base);
|
|
939
|
+
const isPlain = isPlainObject2(base);
|
|
940
|
+
if (strict === true || strict === "class_only" && !isPlain) {
|
|
941
|
+
const descriptors = O.getOwnPropertyDescriptors(base);
|
|
942
|
+
delete descriptors[DRAFT_STATE];
|
|
943
|
+
let keys = Reflect.ownKeys(descriptors);
|
|
944
|
+
for (let i = 0; i < keys.length; i++) {
|
|
945
|
+
const key = keys[i];
|
|
946
|
+
const desc = descriptors[key];
|
|
947
|
+
if (desc[WRITABLE] === false) {
|
|
948
|
+
desc[WRITABLE] = true;
|
|
949
|
+
desc[CONFIGURABLE] = true;
|
|
495
950
|
}
|
|
951
|
+
if (desc.get || desc.set)
|
|
952
|
+
descriptors[key] = {
|
|
953
|
+
[CONFIGURABLE]: true,
|
|
954
|
+
[WRITABLE]: true,
|
|
955
|
+
// could live with !!desc.set as well here...
|
|
956
|
+
[ENUMERABLE]: desc[ENUMERABLE],
|
|
957
|
+
[VALUE]: base[key]
|
|
958
|
+
};
|
|
496
959
|
}
|
|
497
|
-
|
|
960
|
+
return O.create(getPrototypeOf(base), descriptors);
|
|
961
|
+
} else {
|
|
962
|
+
const proto = getPrototypeOf(base);
|
|
963
|
+
if (proto !== null && isPlain) {
|
|
964
|
+
return { ...base };
|
|
965
|
+
}
|
|
966
|
+
const obj = O.create(proto);
|
|
967
|
+
return O.assign(obj, base);
|
|
498
968
|
}
|
|
499
969
|
}
|
|
500
|
-
function
|
|
970
|
+
function freeze(obj, deep = false) {
|
|
971
|
+
if (isFrozen(obj) || isDraft(obj) || !isDraftable(obj))
|
|
972
|
+
return obj;
|
|
973
|
+
if (getArchtype(obj) > 1) {
|
|
974
|
+
O.defineProperties(obj, {
|
|
975
|
+
set: dontMutateMethodOverride,
|
|
976
|
+
add: dontMutateMethodOverride,
|
|
977
|
+
clear: dontMutateMethodOverride,
|
|
978
|
+
delete: dontMutateMethodOverride
|
|
979
|
+
});
|
|
980
|
+
}
|
|
981
|
+
O.freeze(obj);
|
|
982
|
+
if (deep)
|
|
983
|
+
each(
|
|
984
|
+
obj,
|
|
985
|
+
(_key, value) => {
|
|
986
|
+
freeze(value, true);
|
|
987
|
+
},
|
|
988
|
+
false
|
|
989
|
+
);
|
|
990
|
+
return obj;
|
|
991
|
+
}
|
|
992
|
+
function dontMutateFrozenCollections() {
|
|
993
|
+
die(2);
|
|
994
|
+
}
|
|
995
|
+
var dontMutateMethodOverride = {
|
|
996
|
+
[VALUE]: dontMutateFrozenCollections
|
|
997
|
+
};
|
|
998
|
+
function isFrozen(obj) {
|
|
999
|
+
if (obj === null || !isObjectish(obj))
|
|
1000
|
+
return true;
|
|
1001
|
+
return O.isFrozen(obj);
|
|
1002
|
+
}
|
|
1003
|
+
var PluginMapSet = "MapSet";
|
|
1004
|
+
var PluginPatches = "Patches";
|
|
1005
|
+
var PluginArrayMethods = "ArrayMethods";
|
|
1006
|
+
var plugins = {};
|
|
1007
|
+
function getPlugin(pluginKey) {
|
|
1008
|
+
const plugin = plugins[pluginKey];
|
|
1009
|
+
if (!plugin) {
|
|
1010
|
+
die(0, pluginKey);
|
|
1011
|
+
}
|
|
1012
|
+
return plugin;
|
|
1013
|
+
}
|
|
1014
|
+
var isPluginLoaded = (pluginKey) => !!plugins[pluginKey];
|
|
1015
|
+
var currentScope;
|
|
1016
|
+
var getCurrentScope = () => currentScope;
|
|
1017
|
+
var createScope = (parent_, immer_) => ({
|
|
1018
|
+
drafts_: [],
|
|
1019
|
+
parent_,
|
|
1020
|
+
immer_,
|
|
1021
|
+
// Whenever the modified draft contains a draft from another scope, we
|
|
1022
|
+
// need to prevent auto-freezing so the unowned draft can be finalized.
|
|
1023
|
+
canAutoFreeze_: true,
|
|
1024
|
+
unfinalizedDrafts_: 0,
|
|
1025
|
+
handledSet_: /* @__PURE__ */ new Set(),
|
|
1026
|
+
processedForPatches_: /* @__PURE__ */ new Set(),
|
|
1027
|
+
mapSetPlugin_: isPluginLoaded(PluginMapSet) ? getPlugin(PluginMapSet) : void 0,
|
|
1028
|
+
arrayMethodsPlugin_: isPluginLoaded(PluginArrayMethods) ? getPlugin(PluginArrayMethods) : void 0
|
|
1029
|
+
});
|
|
1030
|
+
function usePatchesInScope(scope, patchListener) {
|
|
1031
|
+
if (patchListener) {
|
|
1032
|
+
scope.patchPlugin_ = getPlugin(PluginPatches);
|
|
1033
|
+
scope.patches_ = [];
|
|
1034
|
+
scope.inversePatches_ = [];
|
|
1035
|
+
scope.patchListener_ = patchListener;
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
function revokeScope(scope) {
|
|
1039
|
+
leaveScope(scope);
|
|
1040
|
+
scope.drafts_.forEach(revokeDraft);
|
|
1041
|
+
scope.drafts_ = null;
|
|
1042
|
+
}
|
|
1043
|
+
function leaveScope(scope) {
|
|
1044
|
+
if (scope === currentScope) {
|
|
1045
|
+
currentScope = scope.parent_;
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
var enterScope = (immer2) => currentScope = createScope(currentScope, immer2);
|
|
1049
|
+
function revokeDraft(draft) {
|
|
1050
|
+
const state = draft[DRAFT_STATE];
|
|
1051
|
+
if (state.type_ === 0 || state.type_ === 1)
|
|
1052
|
+
state.revoke_();
|
|
1053
|
+
else
|
|
1054
|
+
state.revoked_ = true;
|
|
1055
|
+
}
|
|
1056
|
+
function processResult(result, scope) {
|
|
1057
|
+
scope.unfinalizedDrafts_ = scope.drafts_.length;
|
|
1058
|
+
const baseDraft = scope.drafts_[0];
|
|
1059
|
+
const isReplaced = result !== void 0 && result !== baseDraft;
|
|
1060
|
+
if (isReplaced) {
|
|
1061
|
+
if (baseDraft[DRAFT_STATE].modified_) {
|
|
1062
|
+
revokeScope(scope);
|
|
1063
|
+
die(4);
|
|
1064
|
+
}
|
|
1065
|
+
if (isDraftable(result)) {
|
|
1066
|
+
result = finalize(scope, result);
|
|
1067
|
+
}
|
|
1068
|
+
const { patchPlugin_ } = scope;
|
|
1069
|
+
if (patchPlugin_) {
|
|
1070
|
+
patchPlugin_.generateReplacementPatches_(
|
|
1071
|
+
baseDraft[DRAFT_STATE].base_,
|
|
1072
|
+
result,
|
|
1073
|
+
scope
|
|
1074
|
+
);
|
|
1075
|
+
}
|
|
1076
|
+
} else {
|
|
1077
|
+
result = finalize(scope, baseDraft);
|
|
1078
|
+
}
|
|
1079
|
+
maybeFreeze(scope, result, true);
|
|
1080
|
+
revokeScope(scope);
|
|
1081
|
+
if (scope.patches_) {
|
|
1082
|
+
scope.patchListener_(scope.patches_, scope.inversePatches_);
|
|
1083
|
+
}
|
|
1084
|
+
return result !== NOTHING ? result : void 0;
|
|
1085
|
+
}
|
|
1086
|
+
function finalize(rootScope, value) {
|
|
1087
|
+
if (isFrozen(value))
|
|
1088
|
+
return value;
|
|
1089
|
+
const state = value[DRAFT_STATE];
|
|
1090
|
+
if (!state) {
|
|
1091
|
+
const finalValue = handleValue(value, rootScope.handledSet_, rootScope);
|
|
1092
|
+
return finalValue;
|
|
1093
|
+
}
|
|
1094
|
+
if (!isSameScope(state, rootScope)) {
|
|
1095
|
+
return value;
|
|
1096
|
+
}
|
|
1097
|
+
if (!state.modified_) {
|
|
1098
|
+
return state.base_;
|
|
1099
|
+
}
|
|
1100
|
+
if (!state.finalized_) {
|
|
1101
|
+
const { callbacks_ } = state;
|
|
1102
|
+
if (callbacks_) {
|
|
1103
|
+
while (callbacks_.length > 0) {
|
|
1104
|
+
const callback = callbacks_.pop();
|
|
1105
|
+
callback(rootScope);
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
generatePatchesAndFinalize(state, rootScope);
|
|
1109
|
+
}
|
|
1110
|
+
return state.copy_;
|
|
1111
|
+
}
|
|
1112
|
+
function maybeFreeze(scope, value, deep = false) {
|
|
1113
|
+
if (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) {
|
|
1114
|
+
freeze(value, deep);
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
function markStateFinalized(state) {
|
|
1118
|
+
state.finalized_ = true;
|
|
1119
|
+
state.scope_.unfinalizedDrafts_--;
|
|
1120
|
+
}
|
|
1121
|
+
var isSameScope = (state, rootScope) => state.scope_ === rootScope;
|
|
1122
|
+
var EMPTY_LOCATIONS_RESULT = [];
|
|
1123
|
+
function updateDraftInParent(parent, draftValue, finalizedValue, originalKey) {
|
|
1124
|
+
const parentCopy = latest(parent);
|
|
1125
|
+
const parentType = parent.type_;
|
|
1126
|
+
if (originalKey !== void 0) {
|
|
1127
|
+
const currentValue = get(parentCopy, originalKey, parentType);
|
|
1128
|
+
if (currentValue === draftValue) {
|
|
1129
|
+
set(parentCopy, originalKey, finalizedValue, parentType);
|
|
1130
|
+
return;
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
if (!parent.draftLocations_) {
|
|
1134
|
+
const draftLocations = parent.draftLocations_ = /* @__PURE__ */ new Map();
|
|
1135
|
+
each(parentCopy, (key, value) => {
|
|
1136
|
+
if (isDraft(value)) {
|
|
1137
|
+
const keys = draftLocations.get(value) || [];
|
|
1138
|
+
keys.push(key);
|
|
1139
|
+
draftLocations.set(value, keys);
|
|
1140
|
+
}
|
|
1141
|
+
});
|
|
1142
|
+
}
|
|
1143
|
+
const locations = parent.draftLocations_.get(draftValue) ?? EMPTY_LOCATIONS_RESULT;
|
|
1144
|
+
for (const location of locations) {
|
|
1145
|
+
set(parentCopy, location, finalizedValue, parentType);
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
function registerChildFinalizationCallback(parent, child, key) {
|
|
1149
|
+
parent.callbacks_.push(function childCleanup(rootScope) {
|
|
1150
|
+
const state = child;
|
|
1151
|
+
if (!state || !isSameScope(state, rootScope)) {
|
|
1152
|
+
return;
|
|
1153
|
+
}
|
|
1154
|
+
rootScope.mapSetPlugin_?.fixSetContents(state);
|
|
1155
|
+
const finalizedValue = getFinalValue(state);
|
|
1156
|
+
updateDraftInParent(parent, state.draft_ ?? state, finalizedValue, key);
|
|
1157
|
+
generatePatchesAndFinalize(state, rootScope);
|
|
1158
|
+
});
|
|
1159
|
+
}
|
|
1160
|
+
function generatePatchesAndFinalize(state, rootScope) {
|
|
1161
|
+
const shouldFinalize = state.modified_ && !state.finalized_ && (state.type_ === 3 || state.type_ === 1 && state.allIndicesReassigned_ || (state.assigned_?.size ?? 0) > 0);
|
|
1162
|
+
if (shouldFinalize) {
|
|
1163
|
+
const { patchPlugin_ } = rootScope;
|
|
1164
|
+
if (patchPlugin_) {
|
|
1165
|
+
const basePath = patchPlugin_.getPath(state);
|
|
1166
|
+
if (basePath) {
|
|
1167
|
+
patchPlugin_.generatePatches_(state, basePath, rootScope);
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
markStateFinalized(state);
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
function handleCrossReference(target, key, value) {
|
|
501
1174
|
const { scope_ } = target;
|
|
502
1175
|
if (isDraft(value)) {
|
|
503
1176
|
const state = value[DRAFT_STATE];
|
|
@@ -1498,585 +2171,214 @@ function buildCreateSlice({
|
|
|
1498
2171
|
reducer
|
|
1499
2172
|
}, config);
|
|
1500
2173
|
return {
|
|
1501
|
-
...slice,
|
|
1502
|
-
...makeSelectorProps(newReducerPath, true)
|
|
1503
|
-
};
|
|
1504
|
-
}
|
|
1505
|
-
};
|
|
1506
|
-
return slice;
|
|
1507
|
-
};
|
|
1508
|
-
}
|
|
1509
|
-
function wrapSelector(selector, selectState, getInitialState, injected) {
|
|
1510
|
-
function wrapper(rootState, ...args) {
|
|
1511
|
-
let sliceState = selectState(rootState);
|
|
1512
|
-
if (typeof sliceState === "undefined") {
|
|
1513
|
-
if (injected) {
|
|
1514
|
-
sliceState = getInitialState();
|
|
1515
|
-
} else if (process.env.NODE_ENV !== "production") {
|
|
1516
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(16) : "selectState returned undefined for an uninjected slice reducer");
|
|
1517
|
-
}
|
|
1518
|
-
}
|
|
1519
|
-
return selector(sliceState, ...args);
|
|
1520
|
-
}
|
|
1521
|
-
wrapper.unwrapped = selector;
|
|
1522
|
-
return wrapper;
|
|
1523
|
-
}
|
|
1524
|
-
var createSlice = /* @__PURE__ */ buildCreateSlice();
|
|
1525
|
-
function buildReducerCreators() {
|
|
1526
|
-
function asyncThunk(payloadCreator, config) {
|
|
1527
|
-
return {
|
|
1528
|
-
_reducerDefinitionType: "asyncThunk",
|
|
1529
|
-
payloadCreator,
|
|
1530
|
-
...config
|
|
1531
|
-
};
|
|
1532
|
-
}
|
|
1533
|
-
asyncThunk.withTypes = () => asyncThunk;
|
|
1534
|
-
return {
|
|
1535
|
-
reducer(caseReducer) {
|
|
1536
|
-
return Object.assign({
|
|
1537
|
-
// hack so the wrapping function has the same name as the original
|
|
1538
|
-
// we need to create a wrapper so the `reducerDefinitionType` is not assigned to the original
|
|
1539
|
-
[caseReducer.name](...args) {
|
|
1540
|
-
return caseReducer(...args);
|
|
1541
|
-
}
|
|
1542
|
-
}[caseReducer.name], {
|
|
1543
|
-
_reducerDefinitionType: "reducer"
|
|
1544
|
-
/* reducer */
|
|
1545
|
-
});
|
|
1546
|
-
},
|
|
1547
|
-
preparedReducer(prepare, reducer) {
|
|
1548
|
-
return {
|
|
1549
|
-
_reducerDefinitionType: "reducerWithPrepare",
|
|
1550
|
-
prepare,
|
|
1551
|
-
reducer
|
|
1552
|
-
};
|
|
1553
|
-
},
|
|
1554
|
-
asyncThunk
|
|
1555
|
-
};
|
|
1556
|
-
}
|
|
1557
|
-
function handleNormalReducerDefinition({
|
|
1558
|
-
type,
|
|
1559
|
-
reducerName,
|
|
1560
|
-
createNotation
|
|
1561
|
-
}, maybeReducerWithPrepare, context) {
|
|
1562
|
-
let caseReducer;
|
|
1563
|
-
let prepareCallback;
|
|
1564
|
-
if ("reducer" in maybeReducerWithPrepare) {
|
|
1565
|
-
if (createNotation && !isCaseReducerWithPrepareDefinition(maybeReducerWithPrepare)) {
|
|
1566
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(17) : "Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");
|
|
1567
|
-
}
|
|
1568
|
-
caseReducer = maybeReducerWithPrepare.reducer;
|
|
1569
|
-
prepareCallback = maybeReducerWithPrepare.prepare;
|
|
1570
|
-
} else {
|
|
1571
|
-
caseReducer = maybeReducerWithPrepare;
|
|
1572
|
-
}
|
|
1573
|
-
context.addCase(type, caseReducer).exposeCaseReducer(reducerName, caseReducer).exposeAction(reducerName, prepareCallback ? createAction(type, prepareCallback) : createAction(type));
|
|
1574
|
-
}
|
|
1575
|
-
function isAsyncThunkSliceReducerDefinition(reducerDefinition) {
|
|
1576
|
-
return reducerDefinition._reducerDefinitionType === "asyncThunk";
|
|
1577
|
-
}
|
|
1578
|
-
function isCaseReducerWithPrepareDefinition(reducerDefinition) {
|
|
1579
|
-
return reducerDefinition._reducerDefinitionType === "reducerWithPrepare";
|
|
1580
|
-
}
|
|
1581
|
-
function handleThunkCaseReducerDefinition({
|
|
1582
|
-
type,
|
|
1583
|
-
reducerName
|
|
1584
|
-
}, reducerDefinition, context, cAT) {
|
|
1585
|
-
if (!cAT) {
|
|
1586
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(18) : "Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");
|
|
1587
|
-
}
|
|
1588
|
-
const {
|
|
1589
|
-
payloadCreator,
|
|
1590
|
-
fulfilled,
|
|
1591
|
-
pending,
|
|
1592
|
-
rejected,
|
|
1593
|
-
settled,
|
|
1594
|
-
options
|
|
1595
|
-
} = reducerDefinition;
|
|
1596
|
-
const thunk = cAT(type, payloadCreator, options);
|
|
1597
|
-
context.exposeAction(reducerName, thunk);
|
|
1598
|
-
if (fulfilled) {
|
|
1599
|
-
context.addCase(thunk.fulfilled, fulfilled);
|
|
1600
|
-
}
|
|
1601
|
-
if (pending) {
|
|
1602
|
-
context.addCase(thunk.pending, pending);
|
|
1603
|
-
}
|
|
1604
|
-
if (rejected) {
|
|
1605
|
-
context.addCase(thunk.rejected, rejected);
|
|
1606
|
-
}
|
|
1607
|
-
if (settled) {
|
|
1608
|
-
context.addMatcher(thunk.settled, settled);
|
|
1609
|
-
}
|
|
1610
|
-
context.exposeCaseReducer(reducerName, {
|
|
1611
|
-
fulfilled: fulfilled || noop,
|
|
1612
|
-
pending: pending || noop,
|
|
1613
|
-
rejected: rejected || noop,
|
|
1614
|
-
settled: settled || noop
|
|
1615
|
-
});
|
|
1616
|
-
}
|
|
1617
|
-
function noop() {
|
|
1618
|
-
}
|
|
1619
|
-
var listener = "listener";
|
|
1620
|
-
var completed = "completed";
|
|
1621
|
-
var cancelled = "cancelled";
|
|
1622
|
-
var taskCancelled = `task-${cancelled}`;
|
|
1623
|
-
var taskCompleted = `task-${completed}`;
|
|
1624
|
-
var listenerCancelled = `${listener}-${cancelled}`;
|
|
1625
|
-
var listenerCompleted = `${listener}-${completed}`;
|
|
1626
|
-
var {
|
|
1627
|
-
assign
|
|
1628
|
-
} = Object;
|
|
1629
|
-
var alm = "listenerMiddleware";
|
|
1630
|
-
var addListener = /* @__PURE__ */ assign(/* @__PURE__ */ createAction(`${alm}/add`), {
|
|
1631
|
-
withTypes: () => addListener
|
|
1632
|
-
});
|
|
1633
|
-
var clearAllListeners = /* @__PURE__ */ createAction(`${alm}/removeAll`);
|
|
1634
|
-
var removeListener = /* @__PURE__ */ assign(/* @__PURE__ */ createAction(`${alm}/remove`), {
|
|
1635
|
-
withTypes: () => removeListener
|
|
1636
|
-
});
|
|
1637
|
-
function formatProdErrorMessage(code) {
|
|
1638
|
-
return `Minified Redux Toolkit error #${code}; visit https://redux-toolkit.js.org/Errors?code=${code} for the full message or use the non-minified dev environment for full errors. `;
|
|
1639
|
-
}
|
|
1640
|
-
|
|
1641
|
-
// src/redux/themeSlice.ts
|
|
1642
|
-
var defaultInitialState = {
|
|
1643
|
-
appearance: "system",
|
|
1644
|
-
color: "#6750a4"
|
|
1645
|
-
};
|
|
1646
|
-
var reducers = {
|
|
1647
|
-
initialize: (state, action) => ({ ...state, ...action.payload }),
|
|
1648
|
-
setAppearance: (state, action) => ({ ...state, appearance: action.payload }),
|
|
1649
|
-
setColor: (state, action) => ({ ...state, color: action.payload })
|
|
1650
|
-
};
|
|
1651
|
-
function createThemeReducer(initialState) {
|
|
1652
|
-
return createSlice({
|
|
1653
|
-
name: "theme",
|
|
1654
|
-
initialState: { ...defaultInitialState, ...initialState },
|
|
1655
|
-
reducers
|
|
1656
|
-
}).reducer;
|
|
1657
|
-
}
|
|
1658
|
-
var defaultSlice = createSlice({
|
|
1659
|
-
name: "theme",
|
|
1660
|
-
initialState: defaultInitialState,
|
|
1661
|
-
reducers
|
|
1662
|
-
});
|
|
1663
|
-
var themeActions = defaultSlice.actions;
|
|
1664
|
-
var themeReducer = defaultSlice.reducer;
|
|
1665
|
-
var selectThemeAppearance = (state) => state.appearance;
|
|
1666
|
-
var selectThemeColor = (state) => state.color;
|
|
1667
|
-
|
|
1668
|
-
// src/ThemeProvider.tsx
|
|
1669
|
-
import { useEffect as useEffect3, useRef } from "react";
|
|
1670
|
-
import { StatusBar as StatusBar2, StyleSheet, View } from "react-native";
|
|
1671
|
-
import { Provider as PaperProvider } from "react-native-paper";
|
|
1672
|
-
|
|
1673
|
-
// src/useComputedTheme.ts
|
|
1674
|
-
import { useCallback, useEffect as useEffect2, useState } from "react";
|
|
1675
|
-
import { Appearance } from "react-native";
|
|
1676
|
-
import { MD3DarkTheme, MD3LightTheme } from "react-native-paper";
|
|
1677
|
-
|
|
1678
|
-
// src/utils/colorNames.ts
|
|
1679
|
-
var colorNames = {
|
|
1680
|
-
aliceblue: "#f0f8ff",
|
|
1681
|
-
antiquewhite: "#faebd7",
|
|
1682
|
-
aqua: "#00ffff",
|
|
1683
|
-
aquamarine: "#7fffd4",
|
|
1684
|
-
azure: "#f0ffff",
|
|
1685
|
-
beige: "#f5f5dc",
|
|
1686
|
-
bisque: "#ffe4c4",
|
|
1687
|
-
black: "#000000",
|
|
1688
|
-
blanchedalmond: "#ffebcd",
|
|
1689
|
-
blue: "#0000ff",
|
|
1690
|
-
blueviolet: "#8a2be2",
|
|
1691
|
-
brown: "#a52a2a",
|
|
1692
|
-
burlywood: "#deb887",
|
|
1693
|
-
cadetblue: "#5f9ea0",
|
|
1694
|
-
chartreuse: "#7fff00",
|
|
1695
|
-
chocolate: "#d2691e",
|
|
1696
|
-
coral: "#ff7f50",
|
|
1697
|
-
cornflowerblue: "#6495ed",
|
|
1698
|
-
cornsilk: "#fff8dc",
|
|
1699
|
-
crimson: "#dc143c",
|
|
1700
|
-
cyan: "#00ffff",
|
|
1701
|
-
darkblue: "#00008b",
|
|
1702
|
-
darkcyan: "#008b8b",
|
|
1703
|
-
darkgoldenrod: "#b8860b",
|
|
1704
|
-
darkgray: "#a9a9a9",
|
|
1705
|
-
darkgrey: "#a9a9a9",
|
|
1706
|
-
darkgreen: "#006400",
|
|
1707
|
-
darkkhaki: "#bdb76b",
|
|
1708
|
-
darkmagenta: "#8b008b",
|
|
1709
|
-
darkolivegreen: "#556b2f",
|
|
1710
|
-
darkorange: "#ff8c00",
|
|
1711
|
-
darkorchid: "#9932cc",
|
|
1712
|
-
darkred: "#8b0000",
|
|
1713
|
-
darksalmon: "#e9967a",
|
|
1714
|
-
darkseagreen: "#8fbc8f",
|
|
1715
|
-
darkslateblue: "#483d8b",
|
|
1716
|
-
darkslategray: "#2f4f4f",
|
|
1717
|
-
darkslategrey: "#2f4f4f",
|
|
1718
|
-
darkturquoise: "#00ced1",
|
|
1719
|
-
darkviolet: "#9400d3",
|
|
1720
|
-
deeppink: "#ff1493",
|
|
1721
|
-
deepskyblue: "#00bfff",
|
|
1722
|
-
dimgray: "#696969",
|
|
1723
|
-
dimgrey: "#696969",
|
|
1724
|
-
dodgerblue: "#1e90ff",
|
|
1725
|
-
firebrick: "#b22222",
|
|
1726
|
-
floralwhite: "#fffaf0",
|
|
1727
|
-
forestgreen: "#228b22",
|
|
1728
|
-
fuchsia: "#ff00ff",
|
|
1729
|
-
gainsboro: "#dcdcdc",
|
|
1730
|
-
ghostwhite: "#f8f8ff",
|
|
1731
|
-
gold: "#ffd700",
|
|
1732
|
-
goldenrod: "#daa520",
|
|
1733
|
-
gray: "#808080",
|
|
1734
|
-
grey: "#808080",
|
|
1735
|
-
green: "#008000",
|
|
1736
|
-
greenyellow: "#adff2f",
|
|
1737
|
-
honeydew: "#f0fff0",
|
|
1738
|
-
hotpink: "#ff69b4",
|
|
1739
|
-
indianred: "#cd5c5c",
|
|
1740
|
-
indigo: "#4b0082",
|
|
1741
|
-
ivory: "#fffff0",
|
|
1742
|
-
khaki: "#f0e68c",
|
|
1743
|
-
lavender: "#e6e6fa",
|
|
1744
|
-
lavenderblush: "#fff0f5",
|
|
1745
|
-
lawngreen: "#7cfc00",
|
|
1746
|
-
lemonchiffon: "#fffacd",
|
|
1747
|
-
lightblue: "#add8e6",
|
|
1748
|
-
lightcoral: "#f08080",
|
|
1749
|
-
lightcyan: "#e0ffff",
|
|
1750
|
-
lightgoldenrodyellow: "#fafad2",
|
|
1751
|
-
lightgray: "#d3d3d3",
|
|
1752
|
-
lightgrey: "#d3d3d3",
|
|
1753
|
-
lightgreen: "#90ee90",
|
|
1754
|
-
lightpink: "#ffb6c1",
|
|
1755
|
-
lightsalmon: "#ffa07a",
|
|
1756
|
-
lightseagreen: "#20b2aa",
|
|
1757
|
-
lightskyblue: "#87cefa",
|
|
1758
|
-
lightslategray: "#778899",
|
|
1759
|
-
lightslategrey: "#778899",
|
|
1760
|
-
lightsteelblue: "#b0c4de",
|
|
1761
|
-
lightyellow: "#ffffe0",
|
|
1762
|
-
lime: "#00ff00",
|
|
1763
|
-
limegreen: "#32cd32",
|
|
1764
|
-
linen: "#faf0e6",
|
|
1765
|
-
magenta: "#ff00ff",
|
|
1766
|
-
maroon: "#800000",
|
|
1767
|
-
mediumaquamarine: "#66cdaa",
|
|
1768
|
-
mediumblue: "#0000cd",
|
|
1769
|
-
mediumorchid: "#ba55d3",
|
|
1770
|
-
mediumpurple: "#9370db",
|
|
1771
|
-
mediumseagreen: "#3cb371",
|
|
1772
|
-
mediumslateblue: "#7b68ee",
|
|
1773
|
-
mediumspringgreen: "#00fa9a",
|
|
1774
|
-
mediumturquoise: "#48d1cc",
|
|
1775
|
-
mediumvioletred: "#c71585",
|
|
1776
|
-
midnightblue: "#191970",
|
|
1777
|
-
mintcream: "#f5fffa",
|
|
1778
|
-
mistyrose: "#ffe4e1",
|
|
1779
|
-
moccasin: "#ffe4b5",
|
|
1780
|
-
navajowhite: "#ffdead",
|
|
1781
|
-
navy: "#000080",
|
|
1782
|
-
oldlace: "#fdf5e6",
|
|
1783
|
-
olive: "#808000",
|
|
1784
|
-
olivedrab: "#6b8e23",
|
|
1785
|
-
orange: "#ffa500",
|
|
1786
|
-
orangered: "#ff4500",
|
|
1787
|
-
orchid: "#da70d6",
|
|
1788
|
-
palegoldenrod: "#eee8aa",
|
|
1789
|
-
palegreen: "#98fb98",
|
|
1790
|
-
paleturquoise: "#afeeee",
|
|
1791
|
-
palevioletred: "#db7093",
|
|
1792
|
-
papayawhip: "#ffefd5",
|
|
1793
|
-
peachpuff: "#ffdab9",
|
|
1794
|
-
peru: "#cd853f",
|
|
1795
|
-
pink: "#ffc0cb",
|
|
1796
|
-
plum: "#dda0dd",
|
|
1797
|
-
powderblue: "#b0e0e6",
|
|
1798
|
-
purple: "#800080",
|
|
1799
|
-
rebeccapurple: "#663399",
|
|
1800
|
-
red: "#ff0000",
|
|
1801
|
-
rosybrown: "#bc8f8f",
|
|
1802
|
-
royalblue: "#4169e1",
|
|
1803
|
-
saddlebrown: "#8b4513",
|
|
1804
|
-
salmon: "#fa8072",
|
|
1805
|
-
sandybrown: "#f4a460",
|
|
1806
|
-
seagreen: "#2e8b57",
|
|
1807
|
-
seashell: "#fff5ee",
|
|
1808
|
-
sienna: "#a0522d",
|
|
1809
|
-
silver: "#c0c0c0",
|
|
1810
|
-
skyblue: "#87ceeb",
|
|
1811
|
-
slateblue: "#6a5acd",
|
|
1812
|
-
slategray: "#708090",
|
|
1813
|
-
slategrey: "#708090",
|
|
1814
|
-
snow: "#fffafa",
|
|
1815
|
-
springgreen: "#00ff7f",
|
|
1816
|
-
steelblue: "#4682b4",
|
|
1817
|
-
tan: "#d2b48c",
|
|
1818
|
-
teal: "#008080",
|
|
1819
|
-
thistle: "#d8bfd8",
|
|
1820
|
-
tomato: "#ff6347",
|
|
1821
|
-
transparent: "transparent",
|
|
1822
|
-
turquoise: "#40e0d0",
|
|
1823
|
-
violet: "#ee82ee",
|
|
1824
|
-
wheat: "#f5deb3",
|
|
1825
|
-
white: "#ffffff",
|
|
1826
|
-
whitesmoke: "#f5f5f5",
|
|
1827
|
-
yellow: "#ffff00",
|
|
1828
|
-
yellowgreen: "#9acd32"
|
|
1829
|
-
};
|
|
1830
|
-
|
|
1831
|
-
// src/utils/getRgb.ts
|
|
1832
|
-
var getRgb = (value) => {
|
|
1833
|
-
if (!value) return null;
|
|
1834
|
-
let trimmed = value.trim().toLowerCase();
|
|
1835
|
-
const namedColor = colorNames[trimmed];
|
|
1836
|
-
if (namedColor) trimmed = namedColor;
|
|
1837
|
-
const hexMatch = trimmed.match(/^#?([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i);
|
|
1838
|
-
if (hexMatch) {
|
|
1839
|
-
const hex = hexMatch[1];
|
|
1840
|
-
let normalized = hex;
|
|
1841
|
-
if (hex.length === 3) {
|
|
1842
|
-
normalized = hex.split("").map((c) => c + c).join("");
|
|
1843
|
-
} else if (hex.length === 8) {
|
|
1844
|
-
const alpha = parseInt(hex.substring(6, 8), 16);
|
|
1845
|
-
normalized = hex.substring(0, 6);
|
|
1846
|
-
const intVal2 = parseInt(normalized, 16);
|
|
1847
|
-
return {
|
|
1848
|
-
r: intVal2 >> 16 & 255,
|
|
1849
|
-
g: intVal2 >> 8 & 255,
|
|
1850
|
-
b: intVal2 & 255,
|
|
1851
|
-
a: alpha / 255
|
|
1852
|
-
};
|
|
1853
|
-
}
|
|
1854
|
-
const intVal = parseInt(normalized, 16);
|
|
1855
|
-
return {
|
|
1856
|
-
r: intVal >> 16 & 255,
|
|
1857
|
-
g: intVal >> 8 & 255,
|
|
1858
|
-
b: intVal & 255
|
|
1859
|
-
};
|
|
1860
|
-
}
|
|
1861
|
-
const rgbMatch = trimmed.match(/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*([0-9.]+))?\s*\)$/i);
|
|
1862
|
-
if (rgbMatch) {
|
|
1863
|
-
const result = {
|
|
1864
|
-
r: Number(rgbMatch[1]),
|
|
1865
|
-
g: Number(rgbMatch[2]),
|
|
1866
|
-
b: Number(rgbMatch[3])
|
|
1867
|
-
};
|
|
1868
|
-
if (rgbMatch[4] !== void 0) {
|
|
1869
|
-
result.a = Number(rgbMatch[4]);
|
|
1870
|
-
}
|
|
1871
|
-
return result;
|
|
1872
|
-
}
|
|
1873
|
-
return null;
|
|
1874
|
-
};
|
|
1875
|
-
|
|
1876
|
-
// src/utils/getHex.ts
|
|
1877
|
-
var getHex = (value) => {
|
|
1878
|
-
const rgb = getRgb(value);
|
|
1879
|
-
if (!rgb) return null;
|
|
1880
|
-
const toHex = (n) => {
|
|
1881
|
-
const hex = Math.round(n).toString(16);
|
|
1882
|
-
return hex.length === 1 ? "0" + hex : hex;
|
|
1883
|
-
};
|
|
1884
|
-
const hexString = `#${toHex(rgb.r)}${toHex(rgb.g)}${toHex(rgb.b)}`;
|
|
1885
|
-
if (rgb.a !== void 0) {
|
|
1886
|
-
return `${hexString}${toHex(rgb.a * 255)}`;
|
|
1887
|
-
}
|
|
1888
|
-
return hexString;
|
|
1889
|
-
};
|
|
1890
|
-
|
|
1891
|
-
// src/utils/getBlendedColor.ts
|
|
1892
|
-
var getBlendedColor = (foreground, background, alpha) => {
|
|
1893
|
-
const fg = getRgb(foreground);
|
|
1894
|
-
const bg = getRgb(background);
|
|
1895
|
-
if (!fg || !bg) return background;
|
|
1896
|
-
const safeAlpha = Math.min(1, Math.max(0, alpha));
|
|
1897
|
-
const r = Math.round(fg.r * safeAlpha + bg.r * (1 - safeAlpha));
|
|
1898
|
-
const g = Math.round(fg.g * safeAlpha + bg.g * (1 - safeAlpha));
|
|
1899
|
-
const b = Math.round(fg.b * safeAlpha + bg.b * (1 - safeAlpha));
|
|
1900
|
-
return getHex(`rgb(${r}, ${g}, ${b})`) ?? background;
|
|
1901
|
-
};
|
|
1902
|
-
|
|
1903
|
-
// src/utils/getTriadicPalette.ts
|
|
1904
|
-
function getTriadicPalette(primaryColor) {
|
|
1905
|
-
const rgb = getRgb(primaryColor);
|
|
1906
|
-
if (!rgb) throw new Error(`Invalid color format: ${primaryColor}`);
|
|
1907
|
-
const r = rgb.r / 255;
|
|
1908
|
-
const g = rgb.g / 255;
|
|
1909
|
-
const b = rgb.b / 255;
|
|
1910
|
-
const max = Math.max(r, g, b);
|
|
1911
|
-
const min = Math.min(r, g, b);
|
|
1912
|
-
const l = (max + min) / 2;
|
|
1913
|
-
let h = 0;
|
|
1914
|
-
let s = 0;
|
|
1915
|
-
if (max !== min) {
|
|
1916
|
-
const d = max - min;
|
|
1917
|
-
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
1918
|
-
switch (max) {
|
|
1919
|
-
case r:
|
|
1920
|
-
h = ((g - b) / d + (g < b ? 6 : 0)) / 6;
|
|
1921
|
-
break;
|
|
1922
|
-
case g:
|
|
1923
|
-
h = ((b - r) / d + 2) / 6;
|
|
1924
|
-
break;
|
|
1925
|
-
case b:
|
|
1926
|
-
h = ((r - g) / d + 4) / 6;
|
|
1927
|
-
break;
|
|
2174
|
+
...slice,
|
|
2175
|
+
...makeSelectorProps(newReducerPath, true)
|
|
2176
|
+
};
|
|
2177
|
+
}
|
|
2178
|
+
};
|
|
2179
|
+
return slice;
|
|
2180
|
+
};
|
|
2181
|
+
}
|
|
2182
|
+
function wrapSelector(selector, selectState, getInitialState, injected) {
|
|
2183
|
+
function wrapper(rootState, ...args) {
|
|
2184
|
+
let sliceState = selectState(rootState);
|
|
2185
|
+
if (typeof sliceState === "undefined") {
|
|
2186
|
+
if (injected) {
|
|
2187
|
+
sliceState = getInitialState();
|
|
2188
|
+
} else if (process.env.NODE_ENV !== "production") {
|
|
2189
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(16) : "selectState returned undefined for an uninjected slice reducer");
|
|
2190
|
+
}
|
|
1928
2191
|
}
|
|
2192
|
+
return selector(sliceState, ...args);
|
|
2193
|
+
}
|
|
2194
|
+
wrapper.unwrapped = selector;
|
|
2195
|
+
return wrapper;
|
|
2196
|
+
}
|
|
2197
|
+
var createSlice = /* @__PURE__ */ buildCreateSlice();
|
|
2198
|
+
function buildReducerCreators() {
|
|
2199
|
+
function asyncThunk(payloadCreator, config) {
|
|
2200
|
+
return {
|
|
2201
|
+
_reducerDefinitionType: "asyncThunk",
|
|
2202
|
+
payloadCreator,
|
|
2203
|
+
...config
|
|
2204
|
+
};
|
|
1929
2205
|
}
|
|
2206
|
+
asyncThunk.withTypes = () => asyncThunk;
|
|
1930
2207
|
return {
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
2208
|
+
reducer(caseReducer) {
|
|
2209
|
+
return Object.assign({
|
|
2210
|
+
// hack so the wrapping function has the same name as the original
|
|
2211
|
+
// we need to create a wrapper so the `reducerDefinitionType` is not assigned to the original
|
|
2212
|
+
[caseReducer.name](...args) {
|
|
2213
|
+
return caseReducer(...args);
|
|
2214
|
+
}
|
|
2215
|
+
}[caseReducer.name], {
|
|
2216
|
+
_reducerDefinitionType: "reducer"
|
|
2217
|
+
/* reducer */
|
|
2218
|
+
});
|
|
2219
|
+
},
|
|
2220
|
+
preparedReducer(prepare, reducer) {
|
|
2221
|
+
return {
|
|
2222
|
+
_reducerDefinitionType: "reducerWithPrepare",
|
|
2223
|
+
prepare,
|
|
2224
|
+
reducer
|
|
2225
|
+
};
|
|
2226
|
+
},
|
|
2227
|
+
asyncThunk
|
|
1934
2228
|
};
|
|
1935
2229
|
}
|
|
1936
|
-
function
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
let
|
|
1942
|
-
let
|
|
1943
|
-
if (
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
g = c;
|
|
1950
|
-
b = 0;
|
|
1951
|
-
} else if (h < 3 / 6) {
|
|
1952
|
-
r = 0;
|
|
1953
|
-
g = c;
|
|
1954
|
-
b = x;
|
|
1955
|
-
} else if (h < 4 / 6) {
|
|
1956
|
-
r = 0;
|
|
1957
|
-
g = x;
|
|
1958
|
-
b = c;
|
|
1959
|
-
} else if (h < 5 / 6) {
|
|
1960
|
-
r = x;
|
|
1961
|
-
g = 0;
|
|
1962
|
-
b = c;
|
|
2230
|
+
function handleNormalReducerDefinition({
|
|
2231
|
+
type,
|
|
2232
|
+
reducerName,
|
|
2233
|
+
createNotation
|
|
2234
|
+
}, maybeReducerWithPrepare, context) {
|
|
2235
|
+
let caseReducer;
|
|
2236
|
+
let prepareCallback;
|
|
2237
|
+
if ("reducer" in maybeReducerWithPrepare) {
|
|
2238
|
+
if (createNotation && !isCaseReducerWithPrepareDefinition(maybeReducerWithPrepare)) {
|
|
2239
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(17) : "Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");
|
|
2240
|
+
}
|
|
2241
|
+
caseReducer = maybeReducerWithPrepare.reducer;
|
|
2242
|
+
prepareCallback = maybeReducerWithPrepare.prepare;
|
|
1963
2243
|
} else {
|
|
1964
|
-
|
|
1965
|
-
g = 0;
|
|
1966
|
-
b = x;
|
|
2244
|
+
caseReducer = maybeReducerWithPrepare;
|
|
1967
2245
|
}
|
|
1968
|
-
|
|
1969
|
-
const hex = Math.round((value + m) * 255).toString(16);
|
|
1970
|
-
return hex.length === 1 ? `0${hex}` : hex;
|
|
1971
|
-
};
|
|
1972
|
-
return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
|
|
2246
|
+
context.addCase(type, caseReducer).exposeCaseReducer(reducerName, caseReducer).exposeAction(reducerName, prepareCallback ? createAction(type, prepareCallback) : createAction(type));
|
|
1973
2247
|
}
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
}
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
const
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
}
|
|
2038
|
-
return theme;
|
|
2248
|
+
function isAsyncThunkSliceReducerDefinition(reducerDefinition) {
|
|
2249
|
+
return reducerDefinition._reducerDefinitionType === "asyncThunk";
|
|
2250
|
+
}
|
|
2251
|
+
function isCaseReducerWithPrepareDefinition(reducerDefinition) {
|
|
2252
|
+
return reducerDefinition._reducerDefinitionType === "reducerWithPrepare";
|
|
2253
|
+
}
|
|
2254
|
+
function handleThunkCaseReducerDefinition({
|
|
2255
|
+
type,
|
|
2256
|
+
reducerName
|
|
2257
|
+
}, reducerDefinition, context, cAT) {
|
|
2258
|
+
if (!cAT) {
|
|
2259
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(18) : "Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");
|
|
2260
|
+
}
|
|
2261
|
+
const {
|
|
2262
|
+
payloadCreator,
|
|
2263
|
+
fulfilled,
|
|
2264
|
+
pending,
|
|
2265
|
+
rejected,
|
|
2266
|
+
settled,
|
|
2267
|
+
options
|
|
2268
|
+
} = reducerDefinition;
|
|
2269
|
+
const thunk = cAT(type, payloadCreator, options);
|
|
2270
|
+
context.exposeAction(reducerName, thunk);
|
|
2271
|
+
if (fulfilled) {
|
|
2272
|
+
context.addCase(thunk.fulfilled, fulfilled);
|
|
2273
|
+
}
|
|
2274
|
+
if (pending) {
|
|
2275
|
+
context.addCase(thunk.pending, pending);
|
|
2276
|
+
}
|
|
2277
|
+
if (rejected) {
|
|
2278
|
+
context.addCase(thunk.rejected, rejected);
|
|
2279
|
+
}
|
|
2280
|
+
if (settled) {
|
|
2281
|
+
context.addMatcher(thunk.settled, settled);
|
|
2282
|
+
}
|
|
2283
|
+
context.exposeCaseReducer(reducerName, {
|
|
2284
|
+
fulfilled: fulfilled || noop,
|
|
2285
|
+
pending: pending || noop,
|
|
2286
|
+
rejected: rejected || noop,
|
|
2287
|
+
settled: settled || noop
|
|
2288
|
+
});
|
|
2289
|
+
}
|
|
2290
|
+
function noop() {
|
|
2291
|
+
}
|
|
2292
|
+
var listener = "listener";
|
|
2293
|
+
var completed = "completed";
|
|
2294
|
+
var cancelled = "cancelled";
|
|
2295
|
+
var taskCancelled = `task-${cancelled}`;
|
|
2296
|
+
var taskCompleted = `task-${completed}`;
|
|
2297
|
+
var listenerCancelled = `${listener}-${cancelled}`;
|
|
2298
|
+
var listenerCompleted = `${listener}-${completed}`;
|
|
2299
|
+
var {
|
|
2300
|
+
assign
|
|
2301
|
+
} = Object;
|
|
2302
|
+
var alm = "listenerMiddleware";
|
|
2303
|
+
var addListener = /* @__PURE__ */ assign(/* @__PURE__ */ createAction(`${alm}/add`), {
|
|
2304
|
+
withTypes: () => addListener
|
|
2305
|
+
});
|
|
2306
|
+
var clearAllListeners = /* @__PURE__ */ createAction(`${alm}/removeAll`);
|
|
2307
|
+
var removeListener = /* @__PURE__ */ assign(/* @__PURE__ */ createAction(`${alm}/remove`), {
|
|
2308
|
+
withTypes: () => removeListener
|
|
2309
|
+
});
|
|
2310
|
+
function formatProdErrorMessage(code) {
|
|
2311
|
+
return `Minified Redux Toolkit error #${code}; visit https://redux-toolkit.js.org/Errors?code=${code} for the full message or use the non-minified dev environment for full errors. `;
|
|
2039
2312
|
}
|
|
2040
2313
|
|
|
2041
|
-
// src/
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2314
|
+
// src/redux/themeSlice.ts
|
|
2315
|
+
var defaultInitialState = {
|
|
2316
|
+
appearance: "system",
|
|
2317
|
+
blur: true,
|
|
2318
|
+
color: "#6750a4",
|
|
2319
|
+
harmony: "split-complementary"
|
|
2320
|
+
};
|
|
2321
|
+
var reducers = {
|
|
2322
|
+
initialize: (state, action) => ({ ...state, ...action.payload }),
|
|
2323
|
+
setAppearance: (state, action) => ({ ...state, appearance: action.payload }),
|
|
2324
|
+
setBlur: (state, action) => ({ ...state, blur: action.payload }),
|
|
2325
|
+
setColor: (state, action) => ({ ...state, color: action.payload }),
|
|
2326
|
+
setHarmony: (state, action) => ({ ...state, harmony: action.payload })
|
|
2327
|
+
};
|
|
2328
|
+
function createThemeReducer(initialState) {
|
|
2329
|
+
return createSlice({
|
|
2330
|
+
name: "theme",
|
|
2331
|
+
initialState: { ...defaultInitialState, ...initialState },
|
|
2332
|
+
reducers
|
|
2333
|
+
}).reducer;
|
|
2057
2334
|
}
|
|
2058
|
-
var
|
|
2059
|
-
|
|
2335
|
+
var defaultSlice = createSlice({
|
|
2336
|
+
name: "theme",
|
|
2337
|
+
initialState: defaultInitialState,
|
|
2338
|
+
reducers
|
|
2060
2339
|
});
|
|
2340
|
+
var themeActions = defaultSlice.actions;
|
|
2341
|
+
var themeReducer = defaultSlice.reducer;
|
|
2342
|
+
var selectThemeAppearance = (state) => state.appearance;
|
|
2343
|
+
var selectThemeBlur = (state) => state.blur;
|
|
2344
|
+
var selectThemeColor = (state) => state.color;
|
|
2345
|
+
var selectThemeHarmony = (state) => state.harmony;
|
|
2346
|
+
|
|
2347
|
+
// src/useThemeSettings.ts
|
|
2348
|
+
import { useContext as useContext5 } from "react";
|
|
2349
|
+
var useThemeSettings = () => useContext5(ThemeSettingsContext);
|
|
2061
2350
|
export {
|
|
2062
2351
|
Appbar,
|
|
2352
|
+
AppearancePicker,
|
|
2353
|
+
BlurView,
|
|
2063
2354
|
BottomNavigation,
|
|
2064
2355
|
Button,
|
|
2065
2356
|
Chip,
|
|
2357
|
+
ColorPicker,
|
|
2358
|
+
Dialog,
|
|
2066
2359
|
FAB,
|
|
2360
|
+
HarmonyPicker,
|
|
2067
2361
|
IconButton,
|
|
2362
|
+
Menu,
|
|
2068
2363
|
Provider,
|
|
2069
2364
|
TextInput,
|
|
2365
|
+
ThemeSettingsContext,
|
|
2070
2366
|
createThemeReducer,
|
|
2367
|
+
defaultColors,
|
|
2368
|
+
defaultThemeSettings,
|
|
2071
2369
|
getBlendedColor,
|
|
2072
2370
|
getHex,
|
|
2073
2371
|
getRgb,
|
|
2074
2372
|
getTriadicPalette,
|
|
2075
2373
|
isDarkColor,
|
|
2076
2374
|
selectThemeAppearance,
|
|
2375
|
+
selectThemeBlur,
|
|
2077
2376
|
selectThemeColor,
|
|
2377
|
+
selectThemeHarmony,
|
|
2078
2378
|
themeActions,
|
|
2079
2379
|
themeReducer,
|
|
2380
|
+
useBlur,
|
|
2080
2381
|
useComputedTheme,
|
|
2081
|
-
usePaperDefaults
|
|
2382
|
+
usePaperDefaults,
|
|
2383
|
+
useThemeSettings
|
|
2082
2384
|
};
|