@rific/auto-paper 0.1.3 → 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/dist/index.js CHANGED
@@ -22,98 +22,834 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
22
22
  // src/index.ts
23
23
  var index_exports = {};
24
24
  __export(index_exports, {
25
+ Appbar: () => Appbar,
26
+ AppearancePicker: () => AppearancePicker,
27
+ BlurView: () => BlurView,
28
+ BottomNavigation: () => BottomNavigation,
25
29
  Button: () => Button,
26
30
  Chip: () => Chip,
31
+ ColorPicker: () => ColorPicker,
32
+ Dialog: () => Dialog,
27
33
  FAB: () => FAB,
34
+ HarmonyPicker: () => HarmonyPicker,
28
35
  IconButton: () => IconButton,
36
+ Menu: () => Menu,
29
37
  Provider: () => Provider,
30
38
  TextInput: () => TextInput,
39
+ ThemeSettingsContext: () => ThemeSettingsContext,
31
40
  createThemeReducer: () => createThemeReducer,
41
+ defaultColors: () => defaultColors,
42
+ defaultThemeSettings: () => defaultThemeSettings,
32
43
  getBlendedColor: () => getBlendedColor,
33
44
  getHex: () => getHex,
34
45
  getRgb: () => getRgb,
35
46
  getTriadicPalette: () => getTriadicPalette,
36
47
  isDarkColor: () => isDarkColor,
37
48
  selectThemeAppearance: () => selectThemeAppearance,
49
+ selectThemeBlur: () => selectThemeBlur,
38
50
  selectThemeColor: () => selectThemeColor,
51
+ selectThemeHarmony: () => selectThemeHarmony,
39
52
  themeActions: () => themeActions,
40
53
  themeReducer: () => themeReducer,
54
+ useBlur: () => useBlur,
41
55
  useComputedTheme: () => useComputedTheme,
42
- usePaperDefaults: () => usePaperDefaults
56
+ usePaperDefaults: () => usePaperDefaults,
57
+ useThemeSettings: () => useThemeSettings
43
58
  });
44
59
  module.exports = __toCommonJS(index_exports);
45
60
 
46
- // src/components/Button.tsx
61
+ // src/BlurContext.tsx
62
+ var import_react2 = require("react");
63
+
64
+ // src/ThemeSettingsContext.ts
65
+ var import_react = require("react");
66
+ var defaultThemeSettings = {
67
+ appearance: "system",
68
+ blur: true,
69
+ blurTint: 0.2,
70
+ color: "#6750a4",
71
+ harmony: "split-complementary"
72
+ };
73
+ var ThemeSettingsContext = (0, import_react.createContext)({
74
+ settings: defaultThemeSettings,
75
+ set: () => {
76
+ }
77
+ });
78
+
79
+ // src/BlurContext.tsx
80
+ function useBlur(override) {
81
+ const { settings } = (0, import_react2.useContext)(ThemeSettingsContext);
82
+ return override ?? settings.blur;
83
+ }
84
+
85
+ // src/components/Appbar.tsx
86
+ var import_react_native = require("react-native");
47
87
  var import_react_native_paper = require("react-native-paper");
48
88
 
49
89
  // src/PaperDefaultsContext.tsx
50
- var import_react = require("react");
51
- var PaperDefaultsContext = (0, import_react.createContext)({});
90
+ var import_react3 = require("react");
91
+ var PaperDefaultsContext = (0, import_react3.createContext)({});
52
92
  function usePaperDefaults() {
53
- return (0, import_react.useContext)(PaperDefaultsContext);
93
+ return (0, import_react3.useContext)(PaperDefaultsContext);
54
94
  }
55
95
 
56
- // src/components/Button.tsx
96
+ // src/components/Appbar.tsx
57
97
  var import_jsx_runtime = require("react/jsx-runtime");
58
- function Button(props) {
98
+ function Header({ style, ...props }) {
59
99
  const defaults = usePaperDefaults();
60
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native_paper.Button, { ...defaults.Button, ...props });
100
+ const theme = (0, import_react_native_paper.useTheme)();
101
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
102
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.StatusBar, { backgroundColor: theme.colors.surface, barStyle: theme.dark ? "light-content" : "dark-content" }),
103
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native_paper.Appbar.Header, { ...defaults.AppbarHeader, ...props, style })
104
+ ] });
61
105
  }
106
+ var Appbar = {
107
+ Header,
108
+ Content: import_react_native_paper.Appbar.Content,
109
+ Action: import_react_native_paper.Appbar.Action,
110
+ BackAction: import_react_native_paper.Appbar.BackAction
111
+ };
62
112
 
63
- // src/components/Chip.tsx
113
+ // src/components/AppearancePicker.tsx
64
114
  var import_react_native_paper2 = require("react-native-paper");
65
115
  var import_jsx_runtime2 = require("react/jsx-runtime");
66
- function Chip(props) {
67
- const defaults = usePaperDefaults();
68
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native_paper2.Chip, { ...defaults.Chip, ...props });
69
- }
116
+ var APPEARANCES = [
117
+ { label: "System", value: "system", icon: "brightness-auto" },
118
+ { label: "Light", value: "light", icon: "white-balance-sunny" },
119
+ { label: "Dark", value: "dark", icon: "weather-night" }
120
+ ];
121
+ var AppearancePicker = ({ value, onChange }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native_paper2.SegmentedButtons, { value, onValueChange: (v) => onChange(v), buttons: APPEARANCES.map((a) => ({ value: a.value, label: a.label, icon: a.icon })) });
70
122
 
71
- // src/components/FAB.tsx
123
+ // src/components/BlurView.tsx
124
+ var import_expo_blur = require("expo-blur");
125
+ var import_react4 = require("react");
126
+ var import_react_native2 = require("react-native");
72
127
  var import_react_native_paper3 = require("react-native-paper");
73
128
  var import_jsx_runtime3 = require("react/jsx-runtime");
74
- function FAB(props) {
75
- const defaults = usePaperDefaults();
76
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native_paper3.FAB, { ...defaults.FAB, ...props });
77
- }
129
+ var ELEVATION_OPACITY = { 0: 0, 1: 0.05, 2: 0.08, 3: 0.11, 4: 0.12, 5: 0.14 };
130
+ var BlurView = ({ blur = true, children, elevation, style, ...props }) => {
131
+ const { dark, colors } = (0, import_react_native_paper3.useTheme)();
132
+ const { settings } = (0, import_react4.useContext)(ThemeSettingsContext);
133
+ const tintOpacity = elevation !== void 0 ? ELEVATION_OPACITY[elevation] : 0;
134
+ const tint = tintOpacity > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native2.View, { style: [import_react_native2.StyleSheet.absoluteFill, { backgroundColor: colors.primary, opacity: tintOpacity }] }) : null;
135
+ if (blur)
136
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_expo_blur.BlurView, { ...props, tint: dark ? "dark" : "light", style, children: [
137
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native2.View, { style: [import_react_native2.StyleSheet.absoluteFill, { backgroundColor: colors.surface, opacity: settings.blurTint }] }),
138
+ tint,
139
+ children
140
+ ] });
141
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native2.View, { style: [{ backgroundColor: colors.surface }, style], children: [
142
+ tint,
143
+ children
144
+ ] });
145
+ };
78
146
 
79
- // src/components/IconButton.tsx
80
- var import_react_native_paper4 = require("react-native-paper");
81
- var import_jsx_runtime4 = require("react/jsx-runtime");
82
- function IconButton(props) {
83
- const defaults = usePaperDefaults();
84
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native_paper4.IconButton, { ...defaults.IconButton, ...props });
85
- }
147
+ // src/components/BottomNavigation.tsx
148
+ var import_react7 = require("react");
149
+ var import_react_native5 = require("react-native");
150
+ var import_react_native_paper6 = require("react-native-paper");
86
151
 
87
- // src/components/TextInput.tsx
88
- var import_react2 = require("react");
152
+ // src/ThemeProvider.tsx
153
+ var import_react6 = require("react");
154
+ var import_react_native4 = require("react-native");
89
155
  var import_react_native_paper5 = require("react-native-paper");
90
- var import_jsx_runtime5 = require("react/jsx-runtime");
91
- var TextInput = (0, import_react2.forwardRef)(function TextInput2(props, ref) {
92
- const defaults = usePaperDefaults();
93
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native_paper5.TextInput, { ref, ...defaults.TextInput, ...props });
94
- });
95
156
 
96
- // node_modules/redux/dist/redux.mjs
97
- var randomString = () => Math.random().toString(36).substring(7).split("").join(".");
98
- var ActionTypes = {
99
- INIT: `@@redux/INIT${/* @__PURE__ */ randomString()}`,
100
- REPLACE: `@@redux/REPLACE${/* @__PURE__ */ randomString()}`,
101
- PROBE_UNKNOWN_ACTION: () => `@@redux/PROBE_UNKNOWN_ACTION${randomString()}`
157
+ // src/useComputedTheme.ts
158
+ var import_react5 = require("react");
159
+ var import_react_native3 = require("react-native");
160
+ var import_react_native_paper4 = require("react-native-paper");
161
+
162
+ // src/utils/colorNames.ts
163
+ var colorNames = {
164
+ aliceblue: "#f0f8ff",
165
+ antiquewhite: "#faebd7",
166
+ aqua: "#00ffff",
167
+ aquamarine: "#7fffd4",
168
+ azure: "#f0ffff",
169
+ beige: "#f5f5dc",
170
+ bisque: "#ffe4c4",
171
+ black: "#000000",
172
+ blanchedalmond: "#ffebcd",
173
+ blue: "#0000ff",
174
+ blueviolet: "#8a2be2",
175
+ brown: "#a52a2a",
176
+ burlywood: "#deb887",
177
+ cadetblue: "#5f9ea0",
178
+ chartreuse: "#7fff00",
179
+ chocolate: "#d2691e",
180
+ coral: "#ff7f50",
181
+ cornflowerblue: "#6495ed",
182
+ cornsilk: "#fff8dc",
183
+ crimson: "#dc143c",
184
+ cyan: "#00ffff",
185
+ darkblue: "#00008b",
186
+ darkcyan: "#008b8b",
187
+ darkgoldenrod: "#b8860b",
188
+ darkgray: "#a9a9a9",
189
+ darkgrey: "#a9a9a9",
190
+ darkgreen: "#006400",
191
+ darkkhaki: "#bdb76b",
192
+ darkmagenta: "#8b008b",
193
+ darkolivegreen: "#556b2f",
194
+ darkorange: "#ff8c00",
195
+ darkorchid: "#9932cc",
196
+ darkred: "#8b0000",
197
+ darksalmon: "#e9967a",
198
+ darkseagreen: "#8fbc8f",
199
+ darkslateblue: "#483d8b",
200
+ darkslategray: "#2f4f4f",
201
+ darkslategrey: "#2f4f4f",
202
+ darkturquoise: "#00ced1",
203
+ darkviolet: "#9400d3",
204
+ deeppink: "#ff1493",
205
+ deepskyblue: "#00bfff",
206
+ dimgray: "#696969",
207
+ dimgrey: "#696969",
208
+ dodgerblue: "#1e90ff",
209
+ firebrick: "#b22222",
210
+ floralwhite: "#fffaf0",
211
+ forestgreen: "#228b22",
212
+ fuchsia: "#ff00ff",
213
+ gainsboro: "#dcdcdc",
214
+ ghostwhite: "#f8f8ff",
215
+ gold: "#ffd700",
216
+ goldenrod: "#daa520",
217
+ gray: "#808080",
218
+ grey: "#808080",
219
+ green: "#008000",
220
+ greenyellow: "#adff2f",
221
+ honeydew: "#f0fff0",
222
+ hotpink: "#ff69b4",
223
+ indianred: "#cd5c5c",
224
+ indigo: "#4b0082",
225
+ ivory: "#fffff0",
226
+ khaki: "#f0e68c",
227
+ lavender: "#e6e6fa",
228
+ lavenderblush: "#fff0f5",
229
+ lawngreen: "#7cfc00",
230
+ lemonchiffon: "#fffacd",
231
+ lightblue: "#add8e6",
232
+ lightcoral: "#f08080",
233
+ lightcyan: "#e0ffff",
234
+ lightgoldenrodyellow: "#fafad2",
235
+ lightgray: "#d3d3d3",
236
+ lightgrey: "#d3d3d3",
237
+ lightgreen: "#90ee90",
238
+ lightpink: "#ffb6c1",
239
+ lightsalmon: "#ffa07a",
240
+ lightseagreen: "#20b2aa",
241
+ lightskyblue: "#87cefa",
242
+ lightslategray: "#778899",
243
+ lightslategrey: "#778899",
244
+ lightsteelblue: "#b0c4de",
245
+ lightyellow: "#ffffe0",
246
+ lime: "#00ff00",
247
+ limegreen: "#32cd32",
248
+ linen: "#faf0e6",
249
+ magenta: "#ff00ff",
250
+ maroon: "#800000",
251
+ mediumaquamarine: "#66cdaa",
252
+ mediumblue: "#0000cd",
253
+ mediumorchid: "#ba55d3",
254
+ mediumpurple: "#9370db",
255
+ mediumseagreen: "#3cb371",
256
+ mediumslateblue: "#7b68ee",
257
+ mediumspringgreen: "#00fa9a",
258
+ mediumturquoise: "#48d1cc",
259
+ mediumvioletred: "#c71585",
260
+ midnightblue: "#191970",
261
+ mintcream: "#f5fffa",
262
+ mistyrose: "#ffe4e1",
263
+ moccasin: "#ffe4b5",
264
+ navajowhite: "#ffdead",
265
+ navy: "#000080",
266
+ oldlace: "#fdf5e6",
267
+ olive: "#808000",
268
+ olivedrab: "#6b8e23",
269
+ orange: "#ffa500",
270
+ orangered: "#ff4500",
271
+ orchid: "#da70d6",
272
+ palegoldenrod: "#eee8aa",
273
+ palegreen: "#98fb98",
274
+ paleturquoise: "#afeeee",
275
+ palevioletred: "#db7093",
276
+ papayawhip: "#ffefd5",
277
+ peachpuff: "#ffdab9",
278
+ peru: "#cd853f",
279
+ pink: "#ffc0cb",
280
+ plum: "#dda0dd",
281
+ powderblue: "#b0e0e6",
282
+ purple: "#800080",
283
+ rebeccapurple: "#663399",
284
+ red: "#ff0000",
285
+ rosybrown: "#bc8f8f",
286
+ royalblue: "#4169e1",
287
+ saddlebrown: "#8b4513",
288
+ salmon: "#fa8072",
289
+ sandybrown: "#f4a460",
290
+ seagreen: "#2e8b57",
291
+ seashell: "#fff5ee",
292
+ sienna: "#a0522d",
293
+ silver: "#c0c0c0",
294
+ skyblue: "#87ceeb",
295
+ slateblue: "#6a5acd",
296
+ slategray: "#708090",
297
+ slategrey: "#708090",
298
+ snow: "#fffafa",
299
+ springgreen: "#00ff7f",
300
+ steelblue: "#4682b4",
301
+ tan: "#d2b48c",
302
+ teal: "#008080",
303
+ thistle: "#d8bfd8",
304
+ tomato: "#ff6347",
305
+ transparent: "transparent",
306
+ turquoise: "#40e0d0",
307
+ violet: "#ee82ee",
308
+ wheat: "#f5deb3",
309
+ white: "#ffffff",
310
+ whitesmoke: "#f5f5f5",
311
+ yellow: "#ffff00",
312
+ yellowgreen: "#9acd32"
102
313
  };
103
- function isPlainObject(obj) {
104
- if (typeof obj !== "object" || obj === null)
105
- return false;
106
- let proto = obj;
107
- while (Object.getPrototypeOf(proto) !== null) {
108
- proto = Object.getPrototypeOf(proto);
314
+
315
+ // src/utils/getRgb.ts
316
+ var getRgb = (value) => {
317
+ if (!value) return null;
318
+ let trimmed = value.trim().toLowerCase();
319
+ const namedColor = colorNames[trimmed];
320
+ if (namedColor) trimmed = namedColor;
321
+ const hexMatch = trimmed.match(/^#?([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i);
322
+ if (hexMatch) {
323
+ const hex = hexMatch[1];
324
+ let normalized = hex;
325
+ if (hex.length === 3) {
326
+ normalized = hex.split("").map((c) => c + c).join("");
327
+ } else if (hex.length === 8) {
328
+ const alpha = parseInt(hex.substring(6, 8), 16);
329
+ normalized = hex.substring(0, 6);
330
+ const intVal2 = parseInt(normalized, 16);
331
+ return {
332
+ r: intVal2 >> 16 & 255,
333
+ g: intVal2 >> 8 & 255,
334
+ b: intVal2 & 255,
335
+ a: alpha / 255
336
+ };
337
+ }
338
+ const intVal = parseInt(normalized, 16);
339
+ return {
340
+ r: intVal >> 16 & 255,
341
+ g: intVal >> 8 & 255,
342
+ b: intVal & 255
343
+ };
109
344
  }
110
- return Object.getPrototypeOf(obj) === proto || Object.getPrototypeOf(obj) === null;
111
- }
112
- function compose(...funcs) {
113
- if (funcs.length === 0) {
114
- return (arg) => arg;
345
+ 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);
346
+ if (rgbMatch) {
347
+ const result = {
348
+ r: Number(rgbMatch[1]),
349
+ g: Number(rgbMatch[2]),
350
+ b: Number(rgbMatch[3])
351
+ };
352
+ if (rgbMatch[4] !== void 0) {
353
+ result.a = Number(rgbMatch[4]);
354
+ }
355
+ return result;
115
356
  }
116
- if (funcs.length === 1) {
357
+ return null;
358
+ };
359
+
360
+ // src/utils/getHex.ts
361
+ var getHex = (value) => {
362
+ const rgb = getRgb(value);
363
+ if (!rgb) return null;
364
+ const toHex = (n) => {
365
+ const hex = Math.round(n).toString(16);
366
+ return hex.length === 1 ? "0" + hex : hex;
367
+ };
368
+ const hexString = `#${toHex(rgb.r)}${toHex(rgb.g)}${toHex(rgb.b)}`;
369
+ if (rgb.a !== void 0) {
370
+ return `${hexString}${toHex(rgb.a * 255)}`;
371
+ }
372
+ return hexString;
373
+ };
374
+
375
+ // src/utils/getBlendedColor.ts
376
+ var getBlendedColor = (foreground, background, alpha) => {
377
+ const fg = getRgb(foreground);
378
+ const bg = getRgb(background);
379
+ if (!fg || !bg) return background;
380
+ const safeAlpha = Math.min(1, Math.max(0, alpha));
381
+ const r = Math.round(fg.r * safeAlpha + bg.r * (1 - safeAlpha));
382
+ const g = Math.round(fg.g * safeAlpha + bg.g * (1 - safeAlpha));
383
+ const b = Math.round(fg.b * safeAlpha + bg.b * (1 - safeAlpha));
384
+ return getHex(`rgb(${r}, ${g}, ${b})`) ?? background;
385
+ };
386
+
387
+ // src/utils/getTonalColor.ts
388
+ var getTonalColor = (color, lightness) => {
389
+ const rgb = getRgb(color);
390
+ if (!rgb) return color;
391
+ const r = rgb.r / 255;
392
+ const g = rgb.g / 255;
393
+ const b = rgb.b / 255;
394
+ const max = Math.max(r, g, b);
395
+ const min = Math.min(r, g, b);
396
+ const delta = max - min;
397
+ let h = 0;
398
+ if (delta !== 0) {
399
+ if (max === r) h = (g - b) / delta % 6;
400
+ else if (max === g) h = (b - r) / delta + 2;
401
+ else h = (r - g) / delta + 4;
402
+ h = (h * 60 + 360) % 360;
403
+ }
404
+ const l = (max + min) / 2;
405
+ const s = delta === 0 ? 0 : delta / (1 - Math.abs(2 * l - 1));
406
+ const targetL = Math.min(1, Math.max(0, lightness));
407
+ const c = (1 - Math.abs(2 * targetL - 1)) * s;
408
+ const x = c * (1 - Math.abs(h / 60 % 2 - 1));
409
+ const m = targetL - c / 2;
410
+ let r2 = 0, g2 = 0, b2 = 0;
411
+ if (h < 60) {
412
+ r2 = c;
413
+ g2 = x;
414
+ b2 = 0;
415
+ } else if (h < 120) {
416
+ r2 = x;
417
+ g2 = c;
418
+ b2 = 0;
419
+ } else if (h < 180) {
420
+ r2 = 0;
421
+ g2 = c;
422
+ b2 = x;
423
+ } else if (h < 240) {
424
+ r2 = 0;
425
+ g2 = x;
426
+ b2 = c;
427
+ } else if (h < 300) {
428
+ r2 = x;
429
+ g2 = 0;
430
+ b2 = c;
431
+ } else {
432
+ r2 = c;
433
+ g2 = 0;
434
+ b2 = x;
435
+ }
436
+ const toInt = (n) => Math.round((n + m) * 255);
437
+ return getHex(`rgb(${toInt(r2)}, ${toInt(g2)}, ${toInt(b2)})`) ?? color;
438
+ };
439
+
440
+ // src/utils/getTriadicPalette.ts
441
+ var HARMONY_OFFSETS = {
442
+ analogous: [1 / 12, 2 / 12],
443
+ complementary: [1 / 4, 1 / 2],
444
+ "double-split": [1 / 12, 11 / 12],
445
+ "split-complementary": [5 / 12, 7 / 12],
446
+ square: [1 / 4, 3 / 4],
447
+ triadic: [1 / 3, 2 / 3]
448
+ };
449
+ function getTriadicPalette(primaryColor, harmony = "split-complementary") {
450
+ const rgb = getRgb(primaryColor);
451
+ if (!rgb) throw new Error(`Invalid color format: ${primaryColor}`);
452
+ const r = rgb.r / 255;
453
+ const g = rgb.g / 255;
454
+ const b = rgb.b / 255;
455
+ const max = Math.max(r, g, b);
456
+ const min = Math.min(r, g, b);
457
+ const l = (max + min) / 2;
458
+ let h = 0;
459
+ let s = 0;
460
+ if (max !== min) {
461
+ const d = max - min;
462
+ s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
463
+ switch (max) {
464
+ case r:
465
+ h = ((g - b) / d + (g < b ? 6 : 0)) / 6;
466
+ break;
467
+ case g:
468
+ h = ((b - r) / d + 2) / 6;
469
+ break;
470
+ case b:
471
+ h = ((r - g) / d + 4) / 6;
472
+ break;
473
+ }
474
+ }
475
+ const [o1, o2] = HARMONY_OFFSETS[harmony];
476
+ return {
477
+ primary: getHex(primaryColor) ?? primaryColor,
478
+ secondary: hslToHex((h + o1) % 1, s, l),
479
+ tertiary: hslToHex((h + o2) % 1, s, l)
480
+ };
481
+ }
482
+ function hslToHex(h, s, l) {
483
+ const c = (1 - Math.abs(2 * l - 1)) * s;
484
+ const x = c * (1 - Math.abs(h * 6 % 2 - 1));
485
+ const m = l - c / 2;
486
+ let r = 0;
487
+ let g = 0;
488
+ let b = 0;
489
+ if (h < 1 / 6) {
490
+ r = c;
491
+ g = x;
492
+ b = 0;
493
+ } else if (h < 2 / 6) {
494
+ r = x;
495
+ g = c;
496
+ b = 0;
497
+ } else if (h < 3 / 6) {
498
+ r = 0;
499
+ g = c;
500
+ b = x;
501
+ } else if (h < 4 / 6) {
502
+ r = 0;
503
+ g = x;
504
+ b = c;
505
+ } else if (h < 5 / 6) {
506
+ r = x;
507
+ g = 0;
508
+ b = c;
509
+ } else {
510
+ r = c;
511
+ g = 0;
512
+ b = x;
513
+ }
514
+ const toHex = (value) => {
515
+ const hex = Math.round((value + m) * 255).toString(16);
516
+ return hex.length === 1 ? `0${hex}` : hex;
517
+ };
518
+ return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
519
+ }
520
+
521
+ // src/utils/isDarkColor.ts
522
+ var isDarkColor = (value) => {
523
+ const rgb = getRgb(value);
524
+ if (!rgb) return false;
525
+ const [r, g, b] = [rgb.r / 255, rgb.g / 255, rgb.b / 255];
526
+ const [rs, gs, bs] = [r, g, b].map((c) => c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4));
527
+ const luminance = 0.2126 * rs + 0.7152 * gs + 0.0722 * bs;
528
+ return luminance < 0.5;
529
+ };
530
+
531
+ // src/useComputedTheme.ts
532
+ function useComputedTheme(appearance, color, harmony = "split-complementary") {
533
+ const [theme, setTheme] = (0, import_react5.useState)(null);
534
+ const computeTheme = (0, import_react5.useCallback)(() => {
535
+ let resolved = appearance;
536
+ if (resolved === "system") resolved = import_react_native3.Appearance.getColorScheme();
537
+ if (resolved === "no-preference" || !resolved) resolved = "light";
538
+ const base = resolved === "dark" ? import_react_native_paper4.MD3DarkTheme : import_react_native_paper4.MD3LightTheme;
539
+ const _theme = {
540
+ ...base,
541
+ colors: {
542
+ ...base.colors,
543
+ elevation: { ...base.colors.elevation }
544
+ }
545
+ };
546
+ const palette = getTriadicPalette(color, harmony);
547
+ const surface = base.colors.surface;
548
+ _theme.colors.primary = palette.primary;
549
+ _theme.colors.onPrimary = getTonalColor(palette.primary, isDarkColor(palette.primary) ? 0.95 : 0.08);
550
+ _theme.colors.primaryContainer = getBlendedColor(palette.primary, surface, 0.15);
551
+ _theme.colors.onPrimaryContainer = getTonalColor(palette.primary, isDarkColor(_theme.colors.primaryContainer) ? 0.92 : 0.12);
552
+ _theme.colors.secondary = palette.secondary;
553
+ _theme.colors.onSecondary = getTonalColor(palette.secondary, isDarkColor(palette.secondary) ? 0.95 : 0.08);
554
+ _theme.colors.secondaryContainer = getBlendedColor(palette.secondary, surface, 0.15);
555
+ _theme.colors.onSecondaryContainer = getTonalColor(palette.secondary, isDarkColor(_theme.colors.secondaryContainer) ? 0.92 : 0.12);
556
+ _theme.colors.tertiary = palette.tertiary;
557
+ _theme.colors.onTertiary = getTonalColor(palette.tertiary, isDarkColor(palette.tertiary) ? 0.95 : 0.08);
558
+ _theme.colors.tertiaryContainer = getBlendedColor(palette.tertiary, surface, 0.15);
559
+ _theme.colors.onTertiaryContainer = getTonalColor(palette.tertiary, isDarkColor(_theme.colors.tertiaryContainer) ? 0.92 : 0.12);
560
+ const blended = getBlendedColor(color, palette.secondary, 0.5);
561
+ const tintSurface = (alpha) => getBlendedColor(blended, surface, alpha);
562
+ _theme.colors.background = base.dark ? "#0F0F0F" : "#F0F0F0";
563
+ _theme.colors.surface = surface;
564
+ _theme.colors.surfaceVariant = tintSurface(0.2);
565
+ _theme.colors.outline = getBlendedColor(color, base.colors.outline, 0.45);
566
+ const grey = base.dark ? "#424242" : "#c2c2c2";
567
+ const blendedGrey = getBlendedColor(blended, grey, 0.05);
568
+ _theme.colors.elevation = {
569
+ ..._theme.colors.elevation,
570
+ level1: _theme.colors.surface,
571
+ level2: getBlendedColor(blendedGrey, _theme.colors.surface, 0.25),
572
+ level3: getBlendedColor(blendedGrey, _theme.colors.surface, 0.4),
573
+ level4: getBlendedColor(blendedGrey, _theme.colors.surface, 0.55),
574
+ level5: getBlendedColor(blendedGrey, _theme.colors.surface, 0.7)
575
+ };
576
+ setTheme(_theme);
577
+ }, [appearance, color, harmony]);
578
+ (0, import_react5.useEffect)(() => {
579
+ computeTheme();
580
+ }, [computeTheme]);
581
+ (0, import_react5.useEffect)(() => {
582
+ const subscription = import_react_native3.Appearance.addChangeListener(computeTheme);
583
+ return subscription.remove;
584
+ }, [computeTheme]);
585
+ return theme;
586
+ }
587
+
588
+ // src/ThemeProvider.tsx
589
+ var import_jsx_runtime4 = require("react/jsx-runtime");
590
+ var NavBarContext = (0, import_react6.createContext)({});
591
+ var useNavBarContext = () => (0, import_react6.useContext)(NavBarContext);
592
+ function Provider({ overrides, onChange, children, defaults, onNavBarChange, onReady, statusBarProps, style }) {
593
+ const [settings, setSettings] = (0, import_react6.useState)(() => ({ ...defaultThemeSettings, ...overrides }));
594
+ const set2 = (0, import_react6.useCallback)(
595
+ (patch) => {
596
+ setSettings((prev) => {
597
+ const next = { ...prev, ...patch };
598
+ onChange?.(next);
599
+ return next;
600
+ });
601
+ },
602
+ [onChange]
603
+ );
604
+ const theme = useComputedTheme(settings.appearance, settings.color, settings.harmony);
605
+ const called = (0, import_react6.useRef)(false);
606
+ (0, import_react6.useEffect)(() => {
607
+ if (theme && !called.current) {
608
+ called.current = true;
609
+ onReady?.();
610
+ }
611
+ }, [theme, onReady]);
612
+ if (!theme) return null;
613
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ThemeSettingsContext.Provider, { value: { settings, set: set2 }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react_native_paper5.Provider, { theme, children: [
614
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.StatusBar, { backgroundColor: theme.colors.background, barStyle: theme.dark ? "light-content" : "dark-content", ...statusBarProps }),
615
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PaperDefaultsContext.Provider, { value: defaults ?? {}, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(NavBarContext.Provider, { value: { onNavBarChange }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.View, { style: [styles.flex, { backgroundColor: theme.colors.background }, style], children }) }) })
616
+ ] }) });
617
+ }
618
+ var styles = import_react_native4.StyleSheet.create({
619
+ flex: { flex: 1 }
620
+ });
621
+
622
+ // src/components/BottomNavigation.tsx
623
+ var import_jsx_runtime5 = require("react/jsx-runtime");
624
+ function useNavigationBarSync() {
625
+ const theme = (0, import_react_native_paper6.useTheme)();
626
+ const { onNavBarChange } = useNavBarContext();
627
+ (0, import_react7.useEffect)(() => {
628
+ if (import_react_native5.Platform.OS !== "android" || !onNavBarChange) return;
629
+ onNavBarChange(theme.colors.surface, theme.dark);
630
+ }, [theme, onNavBarChange]);
631
+ }
632
+ function BottomNavigationComponent(props) {
633
+ const defaults = usePaperDefaults();
634
+ useNavigationBarSync();
635
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native_paper6.BottomNavigation, { ...defaults.BottomNavigation, ...props });
636
+ }
637
+ function Bar(props) {
638
+ useNavigationBarSync();
639
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native_paper6.BottomNavigation.Bar, { ...props });
640
+ }
641
+ BottomNavigationComponent.Bar = Bar;
642
+ BottomNavigationComponent.SceneMap = import_react_native_paper6.BottomNavigation.SceneMap;
643
+ var BottomNavigation = BottomNavigationComponent;
644
+
645
+ // src/components/Button.tsx
646
+ var import_react_native_paper7 = require("react-native-paper");
647
+ var import_jsx_runtime6 = require("react/jsx-runtime");
648
+ function Button(props) {
649
+ const defaults = usePaperDefaults();
650
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native_paper7.Button, { ...defaults.Button, ...props });
651
+ }
652
+
653
+ // src/components/Chip.tsx
654
+ var import_react_native_paper8 = require("react-native-paper");
655
+ var import_jsx_runtime7 = require("react/jsx-runtime");
656
+ function Chip(props) {
657
+ const defaults = usePaperDefaults();
658
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native_paper8.Chip, { ...defaults.Chip, ...props });
659
+ }
660
+
661
+ // src/components/ColorPicker.tsx
662
+ var import_react9 = require("react");
663
+ var import_react_native7 = require("react-native");
664
+ var import_react_native_paper10 = require("react-native-paper");
665
+
666
+ // src/components/Dialog.tsx
667
+ var import_react8 = require("react");
668
+ var import_react_native6 = require("react-native");
669
+ var import_react_native_paper9 = require("react-native-paper");
670
+ var import_jsx_runtime8 = require("react/jsx-runtime");
671
+ function DialogComponent({ blur: blurProp, visible, onDismiss, children, style, ...rest }) {
672
+ const blur = useBlur(blurProp);
673
+ const { roundness, colors } = (0, import_react_native_paper9.useTheme)();
674
+ const opacity = (0, import_react8.useRef)(new import_react_native6.Animated.Value(0)).current;
675
+ const [mounted, setMounted] = (0, import_react8.useState)(visible);
676
+ (0, import_react8.useEffect)(() => {
677
+ if (visible) {
678
+ setMounted(true);
679
+ import_react_native6.Animated.timing(opacity, { toValue: 1, duration: 200, useNativeDriver: true }).start();
680
+ } else {
681
+ import_react_native6.Animated.timing(opacity, { toValue: 0, duration: 150, useNativeDriver: true }).start(() => setMounted(false));
682
+ }
683
+ }, [visible]);
684
+ if (!blur) {
685
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_native_paper9.Dialog, { visible, onDismiss, style, ...rest, children });
686
+ }
687
+ if (!mounted) return null;
688
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_native_paper9.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react_native6.Animated.View, { style: [import_react_native6.StyleSheet.absoluteFill, { opacity }], pointerEvents: visible ? "box-none" : "none", children: [
689
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_native6.TouchableWithoutFeedback, { onPress: onDismiss, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_native6.View, { style: [import_react_native6.StyleSheet.absoluteFill, { backgroundColor: colors.backdrop }] }) }),
690
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_native6.View, { style: styles2.wrapper, pointerEvents: "box-none", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(BlurView, { style: [styles2.card, { borderRadius: roundness * 7 }], children }) })
691
+ ] }) });
692
+ }
693
+ DialogComponent.Title = import_react_native_paper9.Dialog.Title;
694
+ DialogComponent.Content = import_react_native_paper9.Dialog.Content;
695
+ DialogComponent.Actions = import_react_native_paper9.Dialog.Actions;
696
+ DialogComponent.ScrollArea = import_react_native_paper9.Dialog.ScrollArea;
697
+ var Dialog = DialogComponent;
698
+ var styles2 = import_react_native6.StyleSheet.create({
699
+ card: { overflow: "hidden" },
700
+ wrapper: { flex: 1, justifyContent: "center", paddingHorizontal: 26 }
701
+ });
702
+
703
+ // src/components/ColorPicker.tsx
704
+ var import_jsx_runtime9 = require("react/jsx-runtime");
705
+ var defaultColors = [
706
+ { label: "Red", value: "#f44336" },
707
+ { label: "Coral", value: "#ff5722" },
708
+ { label: "Orange", value: "#ff6d00" },
709
+ { label: "Amber", value: "#ff9800" },
710
+ { label: "Yellow", value: "#fdd835" },
711
+ { label: "Lime", value: "#8bc34a" },
712
+ { label: "Emerald", value: "#4caf50" },
713
+ { label: "Teal", value: "#009688" },
714
+ { label: "Cyan", value: "#00bcd4" },
715
+ { label: "Blue", value: "#2196f3" },
716
+ { label: "Indigo", value: "#3f51b5" },
717
+ { label: "Deep Purple", value: "#673ab7" },
718
+ { label: "Violet", value: "#9c27b0" },
719
+ { label: "Magenta", value: "#d500f9" },
720
+ { label: "Pink", value: "#ec407a" },
721
+ { label: "Rose", value: "#e91e63" },
722
+ { label: "Brown", value: "#795548" },
723
+ { label: "Blue Grey", value: "#607d8b" }
724
+ ];
725
+ var ColorPicker = ({ value, onChange, colors = defaultColors, blur: blurProp }) => {
726
+ const blur = useBlur(blurProp);
727
+ const [open, setOpen] = (0, import_react9.useState)(false);
728
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
729
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native_paper10.TouchableRipple, { onPress: () => setOpen(true), style: [styles3.trigger, { backgroundColor: value }], borderless: true, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native_paper10.Icon, { source: "palette", size: 20, color: "white" }) }),
730
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Dialog, { blur, visible: open, onDismiss: () => setOpen(false), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Dialog.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native7.View, { style: styles3.swatches, children: colors.map(({ value: hex }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
731
+ import_react_native7.TouchableOpacity,
732
+ {
733
+ onPress: () => {
734
+ onChange(hex);
735
+ setOpen(false);
736
+ },
737
+ style: [styles3.swatch, { backgroundColor: hex }, value === hex && styles3.selected],
738
+ children: value === hex && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native_paper10.Icon, { source: "check", size: 20, color: "white" })
739
+ },
740
+ hex
741
+ )) }) }) })
742
+ ] });
743
+ };
744
+ var styles3 = import_react_native7.StyleSheet.create({
745
+ selected: { borderColor: "white", borderWidth: 3 },
746
+ swatch: { alignItems: "center", borderRadius: 24, height: 48, justifyContent: "center", width: 48 },
747
+ swatches: { flexDirection: "row", flexWrap: "wrap", gap: 12, paddingTop: 12 },
748
+ trigger: { alignItems: "center", alignSelf: "flex-start", borderRadius: 24, height: 48, justifyContent: "center", width: 48 }
749
+ });
750
+
751
+ // src/components/FAB.tsx
752
+ var import_react_native_paper11 = require("react-native-paper");
753
+ var import_jsx_runtime10 = require("react/jsx-runtime");
754
+ function FAB(props) {
755
+ const defaults = usePaperDefaults();
756
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native_paper11.FAB, { ...defaults.FAB, ...props });
757
+ }
758
+
759
+ // src/components/HarmonyPicker.tsx
760
+ var import_react10 = require("react");
761
+ var import_react_native_paper13 = require("react-native-paper");
762
+
763
+ // src/components/Menu.tsx
764
+ var import_react_native8 = require("react-native");
765
+ var import_react_native_paper12 = require("react-native-paper");
766
+ var import_jsx_runtime11 = require("react/jsx-runtime");
767
+ var MenuComponent = ({ blur: blurProp, children, ...props }) => {
768
+ const blur = useBlur(blurProp);
769
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native_paper12.Menu, { ...props, contentStyle: [styles4.content, props.contentStyle], children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(BlurView, { blur, children }) });
770
+ };
771
+ var Menu = Object.assign(MenuComponent, {
772
+ Item: import_react_native_paper12.Menu.Item
773
+ });
774
+ var styles4 = import_react_native8.StyleSheet.create({
775
+ content: { backgroundColor: "transparent", paddingVertical: 0 }
776
+ });
777
+
778
+ // src/components/HarmonyPicker.tsx
779
+ var import_jsx_runtime12 = require("react/jsx-runtime");
780
+ var HARMONIES = [
781
+ { label: "Triadic", value: "triadic", icon: "triangle-outline" },
782
+ { label: "Split", value: "split-complementary", icon: "arrow-split-vertical" },
783
+ { label: "Analogous", value: "analogous", icon: "ray-end-arrow" },
784
+ { label: "Square", value: "square", icon: "square-outline" },
785
+ { label: "Complement", value: "complementary", icon: "circle-half-full" },
786
+ { label: "Dbl Split", value: "double-split", icon: "arrow-expand-horizontal" }
787
+ ];
788
+ var HarmonyPicker = ({ value, onChange, blur: blurProp }) => {
789
+ const blur = useBlur(blurProp);
790
+ const [open, setOpen] = (0, import_react10.useState)(false);
791
+ const selected = HARMONIES.find((h) => h.value === value);
792
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
793
+ Menu,
794
+ {
795
+ blur,
796
+ visible: open,
797
+ onDismiss: () => setOpen(false),
798
+ anchor: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native_paper13.Button, { mode: "outlined", icon: selected.icon, onPress: () => setOpen(true), children: selected.label }),
799
+ children: HARMONIES.map((h) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
800
+ Menu.Item,
801
+ {
802
+ leadingIcon: h.value === value ? "check" : h.icon,
803
+ title: h.label,
804
+ onPress: () => {
805
+ onChange(h.value);
806
+ setOpen(false);
807
+ }
808
+ },
809
+ h.value
810
+ ))
811
+ }
812
+ );
813
+ };
814
+
815
+ // src/components/IconButton.tsx
816
+ var import_react_native_paper14 = require("react-native-paper");
817
+ var import_jsx_runtime13 = require("react/jsx-runtime");
818
+ function IconButton(props) {
819
+ const defaults = usePaperDefaults();
820
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native_paper14.IconButton, { ...defaults.IconButton, ...props });
821
+ }
822
+
823
+ // src/components/TextInput.tsx
824
+ var import_react11 = require("react");
825
+ var import_react_native_paper15 = require("react-native-paper");
826
+ var import_jsx_runtime14 = require("react/jsx-runtime");
827
+ var TextInput = (0, import_react11.forwardRef)(function TextInput2(props, ref) {
828
+ const defaults = usePaperDefaults();
829
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native_paper15.TextInput, { ref, ...defaults.TextInput, ...props });
830
+ });
831
+
832
+ // node_modules/redux/dist/redux.mjs
833
+ var randomString = () => Math.random().toString(36).substring(7).split("").join(".");
834
+ var ActionTypes = {
835
+ INIT: `@@redux/INIT${/* @__PURE__ */ randomString()}`,
836
+ REPLACE: `@@redux/REPLACE${/* @__PURE__ */ randomString()}`,
837
+ PROBE_UNKNOWN_ACTION: () => `@@redux/PROBE_UNKNOWN_ACTION${randomString()}`
838
+ };
839
+ function isPlainObject(obj) {
840
+ if (typeof obj !== "object" || obj === null)
841
+ return false;
842
+ let proto = obj;
843
+ while (Object.getPrototypeOf(proto) !== null) {
844
+ proto = Object.getPrototypeOf(proto);
845
+ }
846
+ return Object.getPrototypeOf(obj) === proto || Object.getPrototypeOf(obj) === null;
847
+ }
848
+ function compose(...funcs) {
849
+ if (funcs.length === 0) {
850
+ return (arg) => arg;
851
+ }
852
+ if (funcs.length === 1) {
117
853
  return funcs[0];
118
854
  }
119
855
  return funcs.reduce((a, b) => (...args) => a(b(...args)));
@@ -1634,12 +2370,16 @@ function formatProdErrorMessage(code) {
1634
2370
  // src/redux/themeSlice.ts
1635
2371
  var defaultInitialState = {
1636
2372
  appearance: "system",
1637
- color: "#6750a4"
2373
+ blur: true,
2374
+ color: "#6750a4",
2375
+ harmony: "split-complementary"
1638
2376
  };
1639
2377
  var reducers = {
1640
2378
  initialize: (state, action) => ({ ...state, ...action.payload }),
1641
2379
  setAppearance: (state, action) => ({ ...state, appearance: action.payload }),
1642
- setColor: (state, action) => ({ ...state, color: action.payload })
2380
+ setBlur: (state, action) => ({ ...state, blur: action.payload }),
2381
+ setColor: (state, action) => ({ ...state, color: action.payload }),
2382
+ setHarmony: (state, action) => ({ ...state, harmony: action.payload })
1643
2383
  };
1644
2384
  function createThemeReducer(initialState) {
1645
2385
  return createSlice({
@@ -1656,419 +2396,46 @@ var defaultSlice = createSlice({
1656
2396
  var themeActions = defaultSlice.actions;
1657
2397
  var themeReducer = defaultSlice.reducer;
1658
2398
  var selectThemeAppearance = (state) => state.appearance;
2399
+ var selectThemeBlur = (state) => state.blur;
1659
2400
  var selectThemeColor = (state) => state.color;
2401
+ var selectThemeHarmony = (state) => state.harmony;
1660
2402
 
1661
- // src/ThemeProvider.tsx
1662
- var import_react4 = require("react");
1663
- var import_react_native2 = require("react-native");
1664
- var import_react_native_paper7 = require("react-native-paper");
1665
-
1666
- // src/useComputedTheme.ts
1667
- var import_react3 = require("react");
1668
- var import_react_native = require("react-native");
1669
- var import_react_native_paper6 = require("react-native-paper");
1670
-
1671
- // src/utils/colorNames.ts
1672
- var colorNames = {
1673
- aliceblue: "#f0f8ff",
1674
- antiquewhite: "#faebd7",
1675
- aqua: "#00ffff",
1676
- aquamarine: "#7fffd4",
1677
- azure: "#f0ffff",
1678
- beige: "#f5f5dc",
1679
- bisque: "#ffe4c4",
1680
- black: "#000000",
1681
- blanchedalmond: "#ffebcd",
1682
- blue: "#0000ff",
1683
- blueviolet: "#8a2be2",
1684
- brown: "#a52a2a",
1685
- burlywood: "#deb887",
1686
- cadetblue: "#5f9ea0",
1687
- chartreuse: "#7fff00",
1688
- chocolate: "#d2691e",
1689
- coral: "#ff7f50",
1690
- cornflowerblue: "#6495ed",
1691
- cornsilk: "#fff8dc",
1692
- crimson: "#dc143c",
1693
- cyan: "#00ffff",
1694
- darkblue: "#00008b",
1695
- darkcyan: "#008b8b",
1696
- darkgoldenrod: "#b8860b",
1697
- darkgray: "#a9a9a9",
1698
- darkgrey: "#a9a9a9",
1699
- darkgreen: "#006400",
1700
- darkkhaki: "#bdb76b",
1701
- darkmagenta: "#8b008b",
1702
- darkolivegreen: "#556b2f",
1703
- darkorange: "#ff8c00",
1704
- darkorchid: "#9932cc",
1705
- darkred: "#8b0000",
1706
- darksalmon: "#e9967a",
1707
- darkseagreen: "#8fbc8f",
1708
- darkslateblue: "#483d8b",
1709
- darkslategray: "#2f4f4f",
1710
- darkslategrey: "#2f4f4f",
1711
- darkturquoise: "#00ced1",
1712
- darkviolet: "#9400d3",
1713
- deeppink: "#ff1493",
1714
- deepskyblue: "#00bfff",
1715
- dimgray: "#696969",
1716
- dimgrey: "#696969",
1717
- dodgerblue: "#1e90ff",
1718
- firebrick: "#b22222",
1719
- floralwhite: "#fffaf0",
1720
- forestgreen: "#228b22",
1721
- fuchsia: "#ff00ff",
1722
- gainsboro: "#dcdcdc",
1723
- ghostwhite: "#f8f8ff",
1724
- gold: "#ffd700",
1725
- goldenrod: "#daa520",
1726
- gray: "#808080",
1727
- grey: "#808080",
1728
- green: "#008000",
1729
- greenyellow: "#adff2f",
1730
- honeydew: "#f0fff0",
1731
- hotpink: "#ff69b4",
1732
- indianred: "#cd5c5c",
1733
- indigo: "#4b0082",
1734
- ivory: "#fffff0",
1735
- khaki: "#f0e68c",
1736
- lavender: "#e6e6fa",
1737
- lavenderblush: "#fff0f5",
1738
- lawngreen: "#7cfc00",
1739
- lemonchiffon: "#fffacd",
1740
- lightblue: "#add8e6",
1741
- lightcoral: "#f08080",
1742
- lightcyan: "#e0ffff",
1743
- lightgoldenrodyellow: "#fafad2",
1744
- lightgray: "#d3d3d3",
1745
- lightgrey: "#d3d3d3",
1746
- lightgreen: "#90ee90",
1747
- lightpink: "#ffb6c1",
1748
- lightsalmon: "#ffa07a",
1749
- lightseagreen: "#20b2aa",
1750
- lightskyblue: "#87cefa",
1751
- lightslategray: "#778899",
1752
- lightslategrey: "#778899",
1753
- lightsteelblue: "#b0c4de",
1754
- lightyellow: "#ffffe0",
1755
- lime: "#00ff00",
1756
- limegreen: "#32cd32",
1757
- linen: "#faf0e6",
1758
- magenta: "#ff00ff",
1759
- maroon: "#800000",
1760
- mediumaquamarine: "#66cdaa",
1761
- mediumblue: "#0000cd",
1762
- mediumorchid: "#ba55d3",
1763
- mediumpurple: "#9370db",
1764
- mediumseagreen: "#3cb371",
1765
- mediumslateblue: "#7b68ee",
1766
- mediumspringgreen: "#00fa9a",
1767
- mediumturquoise: "#48d1cc",
1768
- mediumvioletred: "#c71585",
1769
- midnightblue: "#191970",
1770
- mintcream: "#f5fffa",
1771
- mistyrose: "#ffe4e1",
1772
- moccasin: "#ffe4b5",
1773
- navajowhite: "#ffdead",
1774
- navy: "#000080",
1775
- oldlace: "#fdf5e6",
1776
- olive: "#808000",
1777
- olivedrab: "#6b8e23",
1778
- orange: "#ffa500",
1779
- orangered: "#ff4500",
1780
- orchid: "#da70d6",
1781
- palegoldenrod: "#eee8aa",
1782
- palegreen: "#98fb98",
1783
- paleturquoise: "#afeeee",
1784
- palevioletred: "#db7093",
1785
- papayawhip: "#ffefd5",
1786
- peachpuff: "#ffdab9",
1787
- peru: "#cd853f",
1788
- pink: "#ffc0cb",
1789
- plum: "#dda0dd",
1790
- powderblue: "#b0e0e6",
1791
- purple: "#800080",
1792
- rebeccapurple: "#663399",
1793
- red: "#ff0000",
1794
- rosybrown: "#bc8f8f",
1795
- royalblue: "#4169e1",
1796
- saddlebrown: "#8b4513",
1797
- salmon: "#fa8072",
1798
- sandybrown: "#f4a460",
1799
- seagreen: "#2e8b57",
1800
- seashell: "#fff5ee",
1801
- sienna: "#a0522d",
1802
- silver: "#c0c0c0",
1803
- skyblue: "#87ceeb",
1804
- slateblue: "#6a5acd",
1805
- slategray: "#708090",
1806
- slategrey: "#708090",
1807
- snow: "#fffafa",
1808
- springgreen: "#00ff7f",
1809
- steelblue: "#4682b4",
1810
- tan: "#d2b48c",
1811
- teal: "#008080",
1812
- thistle: "#d8bfd8",
1813
- tomato: "#ff6347",
1814
- transparent: "transparent",
1815
- turquoise: "#40e0d0",
1816
- violet: "#ee82ee",
1817
- wheat: "#f5deb3",
1818
- white: "#ffffff",
1819
- whitesmoke: "#f5f5f5",
1820
- yellow: "#ffff00",
1821
- yellowgreen: "#9acd32"
1822
- };
1823
-
1824
- // src/utils/getRgb.ts
1825
- var getRgb = (value) => {
1826
- if (!value) return null;
1827
- let trimmed = value.trim().toLowerCase();
1828
- const namedColor = colorNames[trimmed];
1829
- if (namedColor) trimmed = namedColor;
1830
- const hexMatch = trimmed.match(/^#?([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i);
1831
- if (hexMatch) {
1832
- const hex = hexMatch[1];
1833
- let normalized = hex;
1834
- if (hex.length === 3) {
1835
- normalized = hex.split("").map((c) => c + c).join("");
1836
- } else if (hex.length === 8) {
1837
- const alpha = parseInt(hex.substring(6, 8), 16);
1838
- normalized = hex.substring(0, 6);
1839
- const intVal2 = parseInt(normalized, 16);
1840
- return {
1841
- r: intVal2 >> 16 & 255,
1842
- g: intVal2 >> 8 & 255,
1843
- b: intVal2 & 255,
1844
- a: alpha / 255
1845
- };
1846
- }
1847
- const intVal = parseInt(normalized, 16);
1848
- return {
1849
- r: intVal >> 16 & 255,
1850
- g: intVal >> 8 & 255,
1851
- b: intVal & 255
1852
- };
1853
- }
1854
- 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);
1855
- if (rgbMatch) {
1856
- const result = {
1857
- r: Number(rgbMatch[1]),
1858
- g: Number(rgbMatch[2]),
1859
- b: Number(rgbMatch[3])
1860
- };
1861
- if (rgbMatch[4] !== void 0) {
1862
- result.a = Number(rgbMatch[4]);
1863
- }
1864
- return result;
1865
- }
1866
- return null;
1867
- };
1868
-
1869
- // src/utils/getHex.ts
1870
- var getHex = (value) => {
1871
- const rgb = getRgb(value);
1872
- if (!rgb) return null;
1873
- const toHex = (n) => {
1874
- const hex = Math.round(n).toString(16);
1875
- return hex.length === 1 ? "0" + hex : hex;
1876
- };
1877
- const hexString = `#${toHex(rgb.r)}${toHex(rgb.g)}${toHex(rgb.b)}`;
1878
- if (rgb.a !== void 0) {
1879
- return `${hexString}${toHex(rgb.a * 255)}`;
1880
- }
1881
- return hexString;
1882
- };
1883
-
1884
- // src/utils/getBlendedColor.ts
1885
- var getBlendedColor = (foreground, background, alpha) => {
1886
- const fg = getRgb(foreground);
1887
- const bg = getRgb(background);
1888
- if (!fg || !bg) return background;
1889
- const safeAlpha = Math.min(1, Math.max(0, alpha));
1890
- const r = Math.round(fg.r * safeAlpha + bg.r * (1 - safeAlpha));
1891
- const g = Math.round(fg.g * safeAlpha + bg.g * (1 - safeAlpha));
1892
- const b = Math.round(fg.b * safeAlpha + bg.b * (1 - safeAlpha));
1893
- return getHex(`rgb(${r}, ${g}, ${b})`) ?? background;
1894
- };
1895
-
1896
- // src/utils/getTriadicPalette.ts
1897
- function getTriadicPalette(primaryColor) {
1898
- const rgb = getRgb(primaryColor);
1899
- if (!rgb) throw new Error(`Invalid color format: ${primaryColor}`);
1900
- const r = rgb.r / 255;
1901
- const g = rgb.g / 255;
1902
- const b = rgb.b / 255;
1903
- const max = Math.max(r, g, b);
1904
- const min = Math.min(r, g, b);
1905
- const l = (max + min) / 2;
1906
- let h = 0;
1907
- let s = 0;
1908
- if (max !== min) {
1909
- const d = max - min;
1910
- s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
1911
- switch (max) {
1912
- case r:
1913
- h = ((g - b) / d + (g < b ? 6 : 0)) / 6;
1914
- break;
1915
- case g:
1916
- h = ((b - r) / d + 2) / 6;
1917
- break;
1918
- case b:
1919
- h = ((r - g) / d + 4) / 6;
1920
- break;
1921
- }
1922
- }
1923
- return {
1924
- primary: getHex(primaryColor) ?? primaryColor,
1925
- secondary: hslToHex((h + 1 / 3) % 1, s, l),
1926
- tertiary: hslToHex((h + 2 / 3) % 1, s, l)
1927
- };
1928
- }
1929
- function hslToHex(h, s, l) {
1930
- const c = (1 - Math.abs(2 * l - 1)) * s;
1931
- const x = c * (1 - Math.abs(h * 6 % 2 - 1));
1932
- const m = l - c / 2;
1933
- let r = 0;
1934
- let g = 0;
1935
- let b = 0;
1936
- if (h < 1 / 6) {
1937
- r = c;
1938
- g = x;
1939
- b = 0;
1940
- } else if (h < 2 / 6) {
1941
- r = x;
1942
- g = c;
1943
- b = 0;
1944
- } else if (h < 3 / 6) {
1945
- r = 0;
1946
- g = c;
1947
- b = x;
1948
- } else if (h < 4 / 6) {
1949
- r = 0;
1950
- g = x;
1951
- b = c;
1952
- } else if (h < 5 / 6) {
1953
- r = x;
1954
- g = 0;
1955
- b = c;
1956
- } else {
1957
- r = c;
1958
- g = 0;
1959
- b = x;
1960
- }
1961
- const toHex = (value) => {
1962
- const hex = Math.round((value + m) * 255).toString(16);
1963
- return hex.length === 1 ? `0${hex}` : hex;
1964
- };
1965
- return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
1966
- }
1967
-
1968
- // src/utils/isDarkColor.ts
1969
- var isDarkColor = (value) => {
1970
- const rgb = getRgb(value);
1971
- if (!rgb) return false;
1972
- const [r, g, b] = [rgb.r / 255, rgb.g / 255, rgb.b / 255];
1973
- const [rs, gs, bs] = [r, g, b].map((c) => c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4));
1974
- const luminance = 0.2126 * rs + 0.7152 * gs + 0.0722 * bs;
1975
- return luminance < 0.5;
1976
- };
1977
-
1978
- // src/useComputedTheme.ts
1979
- function useComputedTheme(appearance, color) {
1980
- const [theme, setTheme] = (0, import_react3.useState)(null);
1981
- const computeTheme = (0, import_react3.useCallback)(() => {
1982
- let resolved = appearance;
1983
- if (resolved === "system") resolved = import_react_native.Appearance.getColorScheme();
1984
- if (resolved === "no-preference" || !resolved) resolved = "light";
1985
- const base = resolved === "dark" ? import_react_native_paper6.MD3DarkTheme : import_react_native_paper6.MD3LightTheme;
1986
- const _theme = {
1987
- ...base,
1988
- colors: {
1989
- ...base.colors,
1990
- elevation: { ...base.colors.elevation }
1991
- }
1992
- };
1993
- const palette = getTriadicPalette(color);
1994
- const surface = base.colors.surface;
1995
- _theme.colors.primary = palette.primary;
1996
- _theme.colors.onPrimary = isDarkColor(palette.primary) ? "#ffffff" : "#000000";
1997
- _theme.colors.primaryContainer = getBlendedColor(palette.primary, surface, 0.15);
1998
- _theme.colors.onPrimaryContainer = isDarkColor(_theme.colors.primaryContainer) ? "#ffffff" : "#000000";
1999
- _theme.colors.secondary = palette.secondary;
2000
- _theme.colors.onSecondary = isDarkColor(palette.secondary) ? "#ffffff" : "#000000";
2001
- _theme.colors.secondaryContainer = getBlendedColor(palette.secondary, surface, 0.15);
2002
- _theme.colors.onSecondaryContainer = isDarkColor(_theme.colors.secondaryContainer) ? "#ffffff" : "#000000";
2003
- _theme.colors.tertiary = palette.tertiary;
2004
- _theme.colors.onTertiary = isDarkColor(palette.tertiary) ? "#ffffff" : "#000000";
2005
- _theme.colors.tertiaryContainer = getBlendedColor(palette.tertiary, surface, 0.15);
2006
- _theme.colors.onTertiaryContainer = isDarkColor(_theme.colors.tertiaryContainer) ? "#ffffff" : "#000000";
2007
- const blended = getBlendedColor(color, palette.secondary, 0.5);
2008
- const tintSurface = (alpha) => getBlendedColor(blended, surface, alpha);
2009
- _theme.colors.surface = surface;
2010
- _theme.colors.surfaceVariant = tintSurface(0.2);
2011
- _theme.colors.outline = getBlendedColor(color, base.colors.outline, 0.45);
2012
- const grey = base.dark ? "#424242" : "#c2c2c2";
2013
- const blendedGrey = getBlendedColor(blended, grey, 0.05);
2014
- _theme.colors.elevation = {
2015
- ..._theme.colors.elevation,
2016
- level1: _theme.colors.surface,
2017
- level2: getBlendedColor(blendedGrey, _theme.colors.surface, 0.25),
2018
- level3: getBlendedColor(blendedGrey, _theme.colors.surface, 0.4),
2019
- level4: getBlendedColor(blendedGrey, _theme.colors.surface, 0.55),
2020
- level5: getBlendedColor(blendedGrey, _theme.colors.surface, 0.7)
2021
- };
2022
- setTheme(_theme);
2023
- }, [appearance, color]);
2024
- (0, import_react3.useEffect)(() => {
2025
- computeTheme();
2026
- }, [computeTheme]);
2027
- (0, import_react3.useEffect)(() => {
2028
- const subscription = import_react_native.Appearance.addChangeListener(computeTheme);
2029
- return subscription.remove;
2030
- }, [computeTheme]);
2031
- return theme;
2032
- }
2033
-
2034
- // src/ThemeProvider.tsx
2035
- var import_jsx_runtime6 = require("react/jsx-runtime");
2036
- function Provider({ appearance, color, children, defaults, onReady, statusBarProps, style }) {
2037
- const theme = useComputedTheme(appearance, color);
2038
- const called = (0, import_react4.useRef)(false);
2039
- (0, import_react4.useEffect)(() => {
2040
- if (theme && !called.current) {
2041
- called.current = true;
2042
- onReady?.();
2043
- }
2044
- }, [theme, onReady]);
2045
- if (!theme) return null;
2046
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react_native_paper7.Provider, { theme, children: [
2047
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native2.StatusBar, { backgroundColor: theme.colors.background, barStyle: theme.dark ? "light-content" : "dark-content", ...statusBarProps }),
2048
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PaperDefaultsContext.Provider, { value: defaults ?? {}, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native2.View, { style: [styles.flex, { backgroundColor: theme.colors.background }, style], children }) })
2049
- ] });
2050
- }
2051
- var styles = import_react_native2.StyleSheet.create({
2052
- flex: { flex: 1 }
2053
- });
2403
+ // src/useThemeSettings.ts
2404
+ var import_react12 = require("react");
2405
+ var useThemeSettings = () => (0, import_react12.useContext)(ThemeSettingsContext);
2054
2406
  // Annotate the CommonJS export names for ESM import in node:
2055
2407
  0 && (module.exports = {
2408
+ Appbar,
2409
+ AppearancePicker,
2410
+ BlurView,
2411
+ BottomNavigation,
2056
2412
  Button,
2057
2413
  Chip,
2414
+ ColorPicker,
2415
+ Dialog,
2058
2416
  FAB,
2417
+ HarmonyPicker,
2059
2418
  IconButton,
2419
+ Menu,
2060
2420
  Provider,
2061
2421
  TextInput,
2422
+ ThemeSettingsContext,
2062
2423
  createThemeReducer,
2424
+ defaultColors,
2425
+ defaultThemeSettings,
2063
2426
  getBlendedColor,
2064
2427
  getHex,
2065
2428
  getRgb,
2066
2429
  getTriadicPalette,
2067
2430
  isDarkColor,
2068
2431
  selectThemeAppearance,
2432
+ selectThemeBlur,
2069
2433
  selectThemeColor,
2434
+ selectThemeHarmony,
2070
2435
  themeActions,
2071
2436
  themeReducer,
2437
+ useBlur,
2072
2438
  useComputedTheme,
2073
- usePaperDefaults
2439
+ usePaperDefaults,
2440
+ useThemeSettings
2074
2441
  });