@rific/auto-paper 0.9.3 → 0.9.5
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 +29 -2
- package/dist/index.d.mts +49 -34
- package/dist/index.d.ts +49 -34
- package/dist/index.js +327 -298
- package/dist/index.mjs +299 -273
- package/package.json +2 -1
- package/src/ThemeProvider.tsx +3 -1
- package/src/components/AutoAppearancePicker.tsx +17 -0
- package/src/components/AutoPalettePicker.tsx +21 -0
- package/src/components/Dialog.tsx +7 -4
- package/src/index.ts +3 -0
- package/src/useComputedTheme.ts +1 -0
- package/src/utils/resolveSeedColor.ts +8 -0
package/dist/index.mjs
CHANGED
|
@@ -68,20 +68,35 @@ var AppearancePicker = ({ value, onChange, showLabels = true, icons }) => {
|
|
|
68
68
|
return /* @__PURE__ */ jsx2(SegmentedButtons, { value, onValueChange: (v) => onChange(v), buttons: APPEARANCES.map((a) => ({ value: a.value, label: showLabels ? a.label : void 0, icon: resolvedIcons[a.value], accessibilityLabel: a.label })) });
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
-
// src/
|
|
72
|
-
import { useContext as
|
|
73
|
-
|
|
74
|
-
import { useTheme as useTheme2 } from "react-native-paper";
|
|
71
|
+
// src/useThemeSettings.ts
|
|
72
|
+
import { useContext as useContext3 } from "react";
|
|
73
|
+
var useThemeSettings = () => useContext3(ThemeSettingsContext);
|
|
75
74
|
|
|
76
|
-
// src/
|
|
77
|
-
import {
|
|
78
|
-
|
|
79
|
-
|
|
75
|
+
// src/components/AutoAppearancePicker.tsx
|
|
76
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
77
|
+
var AutoAppearancePicker = (props) => {
|
|
78
|
+
const { settings, set } = useThemeSettings();
|
|
79
|
+
return /* @__PURE__ */ jsx3(AppearancePicker, { ...props, value: settings.appearance, onChange: (appearance) => set({ appearance }) });
|
|
80
|
+
};
|
|
80
81
|
|
|
81
|
-
// src/
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
// src/utils/resolveSeedColor.ts
|
|
83
|
+
var resolveSeedColor = (color) => typeof color === "string" ? color : color.primary;
|
|
84
|
+
|
|
85
|
+
// src/components/PalettePicker.tsx
|
|
86
|
+
import { useState as useState6 } from "react";
|
|
87
|
+
import { StyleSheet as StyleSheet5, TouchableOpacity as TouchableOpacity2, View as View5 } from "react-native";
|
|
88
|
+
import { Icon as Icon2, TouchableRipple as TouchableRipple2, useTheme as useTheme5 } from "react-native-paper";
|
|
89
|
+
|
|
90
|
+
// src/useSwatchGrid.ts
|
|
91
|
+
import { useState } from "react";
|
|
92
|
+
var SWATCH_GRID_COLUMNS = 5;
|
|
93
|
+
var SWATCH_GRID_GAP = 12;
|
|
94
|
+
function useSwatchSize(fallback) {
|
|
95
|
+
const [width, setWidth] = useState(0);
|
|
96
|
+
const onLayout = ({ nativeEvent }) => setWidth(nativeEvent.layout.width);
|
|
97
|
+
const size = width > 0 ? (width - SWATCH_GRID_GAP * (SWATCH_GRID_COLUMNS - 1)) / SWATCH_GRID_COLUMNS : fallback;
|
|
98
|
+
return { onLayout, size };
|
|
99
|
+
}
|
|
85
100
|
|
|
86
101
|
// src/utils/colorNames.ts
|
|
87
102
|
var colorNames = {
|
|
@@ -281,6 +296,25 @@ var getRgb = (value) => {
|
|
|
281
296
|
return null;
|
|
282
297
|
};
|
|
283
298
|
|
|
299
|
+
// src/utils/isDarkColor.ts
|
|
300
|
+
var isDarkColor = (value) => {
|
|
301
|
+
const rgb = getRgb(value);
|
|
302
|
+
if (!rgb) return false;
|
|
303
|
+
const [r, g, b] = [rgb.r / 255, rgb.g / 255, rgb.b / 255];
|
|
304
|
+
const [rs, gs, bs] = [r, g, b].map((c) => c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4));
|
|
305
|
+
const luminance = 0.2126 * rs + 0.7152 * gs + 0.0722 * bs;
|
|
306
|
+
return luminance < 0.5;
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
// src/utils/getSwatchContrast.ts
|
|
310
|
+
var RING_WIDTH = 1;
|
|
311
|
+
var SELECTED_RING_WIDTH = 3;
|
|
312
|
+
var getContrastColor = (color) => isDarkColor(color) ? "#ffffff" : "#000000";
|
|
313
|
+
var getSwatchRing = (color, selected, outlineColor) => ({
|
|
314
|
+
borderColor: selected ? getContrastColor(color) : outlineColor,
|
|
315
|
+
borderWidth: selected ? SELECTED_RING_WIDTH : RING_WIDTH
|
|
316
|
+
});
|
|
317
|
+
|
|
284
318
|
// src/utils/getHex.ts
|
|
285
319
|
var getHex = (value) => {
|
|
286
320
|
const rgb = getRgb(value);
|
|
@@ -296,92 +330,6 @@ var getHex = (value) => {
|
|
|
296
330
|
return hexString;
|
|
297
331
|
};
|
|
298
332
|
|
|
299
|
-
// src/utils/getBlendedColor.ts
|
|
300
|
-
var getBlendedColor = (foreground, background, alpha) => {
|
|
301
|
-
const fg = getRgb(foreground);
|
|
302
|
-
const bg = getRgb(background);
|
|
303
|
-
if (!fg || !bg) return background;
|
|
304
|
-
const safeAlpha = Math.min(1, Math.max(0, alpha));
|
|
305
|
-
const r = Math.round(fg.r * safeAlpha + bg.r * (1 - safeAlpha));
|
|
306
|
-
const g = Math.round(fg.g * safeAlpha + bg.g * (1 - safeAlpha));
|
|
307
|
-
const b = Math.round(fg.b * safeAlpha + bg.b * (1 - safeAlpha));
|
|
308
|
-
return getHex(`rgb(${r}, ${g}, ${b})`) ?? background;
|
|
309
|
-
};
|
|
310
|
-
|
|
311
|
-
// src/utils/getTonalColor.ts
|
|
312
|
-
var getTonalColor = (color, lightness) => {
|
|
313
|
-
const rgb = getRgb(color);
|
|
314
|
-
if (!rgb) return color;
|
|
315
|
-
const r = rgb.r / 255;
|
|
316
|
-
const g = rgb.g / 255;
|
|
317
|
-
const b = rgb.b / 255;
|
|
318
|
-
const max = Math.max(r, g, b);
|
|
319
|
-
const min = Math.min(r, g, b);
|
|
320
|
-
const delta = max - min;
|
|
321
|
-
let h = 0;
|
|
322
|
-
if (delta !== 0) {
|
|
323
|
-
if (max === r) h = (g - b) / delta % 6;
|
|
324
|
-
else if (max === g) h = (b - r) / delta + 2;
|
|
325
|
-
else h = (r - g) / delta + 4;
|
|
326
|
-
h = (h * 60 + 360) % 360;
|
|
327
|
-
}
|
|
328
|
-
const l = (max + min) / 2;
|
|
329
|
-
const s = delta === 0 ? 0 : delta / (1 - Math.abs(2 * l - 1));
|
|
330
|
-
const targetL = Math.min(1, Math.max(0, lightness));
|
|
331
|
-
const c = (1 - Math.abs(2 * targetL - 1)) * s;
|
|
332
|
-
const x = c * (1 - Math.abs(h / 60 % 2 - 1));
|
|
333
|
-
const m = targetL - c / 2;
|
|
334
|
-
let r2 = 0, g2 = 0, b2 = 0;
|
|
335
|
-
if (h < 60) {
|
|
336
|
-
r2 = c;
|
|
337
|
-
g2 = x;
|
|
338
|
-
b2 = 0;
|
|
339
|
-
} else if (h < 120) {
|
|
340
|
-
r2 = x;
|
|
341
|
-
g2 = c;
|
|
342
|
-
b2 = 0;
|
|
343
|
-
} else if (h < 180) {
|
|
344
|
-
r2 = 0;
|
|
345
|
-
g2 = c;
|
|
346
|
-
b2 = x;
|
|
347
|
-
} else if (h < 240) {
|
|
348
|
-
r2 = 0;
|
|
349
|
-
g2 = x;
|
|
350
|
-
b2 = c;
|
|
351
|
-
} else if (h < 300) {
|
|
352
|
-
r2 = x;
|
|
353
|
-
g2 = 0;
|
|
354
|
-
b2 = c;
|
|
355
|
-
} else {
|
|
356
|
-
r2 = c;
|
|
357
|
-
g2 = 0;
|
|
358
|
-
b2 = x;
|
|
359
|
-
}
|
|
360
|
-
const toInt = (n) => Math.round((n + m) * 255);
|
|
361
|
-
return getHex(`rgb(${toInt(r2)}, ${toInt(g2)}, ${toInt(b2)})`) ?? color;
|
|
362
|
-
};
|
|
363
|
-
|
|
364
|
-
// src/utils/isDarkColor.ts
|
|
365
|
-
var isDarkColor = (value) => {
|
|
366
|
-
const rgb = getRgb(value);
|
|
367
|
-
if (!rgb) return false;
|
|
368
|
-
const [r, g, b] = [rgb.r / 255, rgb.g / 255, rgb.b / 255];
|
|
369
|
-
const [rs, gs, bs] = [r, g, b].map((c) => c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4));
|
|
370
|
-
const luminance = 0.2126 * rs + 0.7152 * gs + 0.0722 * bs;
|
|
371
|
-
return luminance < 0.5;
|
|
372
|
-
};
|
|
373
|
-
|
|
374
|
-
// src/utils/getColorRoles.ts
|
|
375
|
-
var getColorRoles = (base, surface, containerAlpha = 0.15) => {
|
|
376
|
-
const container = getBlendedColor(base, surface, containerAlpha);
|
|
377
|
-
return {
|
|
378
|
-
color: base,
|
|
379
|
-
onColor: getTonalColor(base, isDarkColor(base) ? 0.95 : 0.08),
|
|
380
|
-
container,
|
|
381
|
-
onContainer: getTonalColor(base, isDarkColor(container) ? 0.92 : 0.12)
|
|
382
|
-
};
|
|
383
|
-
};
|
|
384
|
-
|
|
385
333
|
// src/utils/getTriadicPalette.ts
|
|
386
334
|
var HARMONY_OFFSETS = {
|
|
387
335
|
analogous: [1 / 12, 2 / 12],
|
|
@@ -463,6 +411,103 @@ function hslToHex(h, s, l) {
|
|
|
463
411
|
return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
|
|
464
412
|
}
|
|
465
413
|
|
|
414
|
+
// src/components/ColorPicker.tsx
|
|
415
|
+
import { useState as useState5 } from "react";
|
|
416
|
+
import { StyleSheet as StyleSheet4, TouchableOpacity, View as View4 } from "react-native";
|
|
417
|
+
import { Icon, TouchableRipple, useTheme as useTheme4 } from "react-native-paper";
|
|
418
|
+
|
|
419
|
+
// src/components/Dialog.tsx
|
|
420
|
+
import React, { useEffect as useEffect3, useState as useState4 } from "react";
|
|
421
|
+
import { Animated, BackHandler, Easing, Pressable, StyleSheet as StyleSheet3, View as View3 } from "react-native";
|
|
422
|
+
import { Dialog as PaperDialog, Portal, useTheme as useTheme3 } from "react-native-paper";
|
|
423
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
424
|
+
|
|
425
|
+
// src/ThemeProvider.tsx
|
|
426
|
+
import { createContext as createContext3, useCallback as useCallback2, useContext as useContext4, useEffect as useEffect2, useRef, useState as useState3 } from "react";
|
|
427
|
+
import { StatusBar as StatusBar2, StyleSheet, View } from "react-native";
|
|
428
|
+
import { Provider as PaperProvider } from "react-native-paper";
|
|
429
|
+
|
|
430
|
+
// src/useComputedTheme.ts
|
|
431
|
+
import { useCallback, useEffect, useState as useState2 } from "react";
|
|
432
|
+
import { Appearance } from "react-native";
|
|
433
|
+
import { MD3DarkTheme, MD3LightTheme } from "react-native-paper";
|
|
434
|
+
|
|
435
|
+
// src/utils/getBlendedColor.ts
|
|
436
|
+
var getBlendedColor = (foreground, background, alpha) => {
|
|
437
|
+
const fg = getRgb(foreground);
|
|
438
|
+
const bg = getRgb(background);
|
|
439
|
+
if (!fg || !bg) return background;
|
|
440
|
+
const safeAlpha = Math.min(1, Math.max(0, alpha));
|
|
441
|
+
const r = Math.round(fg.r * safeAlpha + bg.r * (1 - safeAlpha));
|
|
442
|
+
const g = Math.round(fg.g * safeAlpha + bg.g * (1 - safeAlpha));
|
|
443
|
+
const b = Math.round(fg.b * safeAlpha + bg.b * (1 - safeAlpha));
|
|
444
|
+
return getHex(`rgb(${r}, ${g}, ${b})`) ?? background;
|
|
445
|
+
};
|
|
446
|
+
|
|
447
|
+
// src/utils/getTonalColor.ts
|
|
448
|
+
var getTonalColor = (color, lightness) => {
|
|
449
|
+
const rgb = getRgb(color);
|
|
450
|
+
if (!rgb) return color;
|
|
451
|
+
const r = rgb.r / 255;
|
|
452
|
+
const g = rgb.g / 255;
|
|
453
|
+
const b = rgb.b / 255;
|
|
454
|
+
const max = Math.max(r, g, b);
|
|
455
|
+
const min = Math.min(r, g, b);
|
|
456
|
+
const delta = max - min;
|
|
457
|
+
let h = 0;
|
|
458
|
+
if (delta !== 0) {
|
|
459
|
+
if (max === r) h = (g - b) / delta % 6;
|
|
460
|
+
else if (max === g) h = (b - r) / delta + 2;
|
|
461
|
+
else h = (r - g) / delta + 4;
|
|
462
|
+
h = (h * 60 + 360) % 360;
|
|
463
|
+
}
|
|
464
|
+
const l = (max + min) / 2;
|
|
465
|
+
const s = delta === 0 ? 0 : delta / (1 - Math.abs(2 * l - 1));
|
|
466
|
+
const targetL = Math.min(1, Math.max(0, lightness));
|
|
467
|
+
const c = (1 - Math.abs(2 * targetL - 1)) * s;
|
|
468
|
+
const x = c * (1 - Math.abs(h / 60 % 2 - 1));
|
|
469
|
+
const m = targetL - c / 2;
|
|
470
|
+
let r2 = 0, g2 = 0, b2 = 0;
|
|
471
|
+
if (h < 60) {
|
|
472
|
+
r2 = c;
|
|
473
|
+
g2 = x;
|
|
474
|
+
b2 = 0;
|
|
475
|
+
} else if (h < 120) {
|
|
476
|
+
r2 = x;
|
|
477
|
+
g2 = c;
|
|
478
|
+
b2 = 0;
|
|
479
|
+
} else if (h < 180) {
|
|
480
|
+
r2 = 0;
|
|
481
|
+
g2 = c;
|
|
482
|
+
b2 = x;
|
|
483
|
+
} else if (h < 240) {
|
|
484
|
+
r2 = 0;
|
|
485
|
+
g2 = x;
|
|
486
|
+
b2 = c;
|
|
487
|
+
} else if (h < 300) {
|
|
488
|
+
r2 = x;
|
|
489
|
+
g2 = 0;
|
|
490
|
+
b2 = c;
|
|
491
|
+
} else {
|
|
492
|
+
r2 = c;
|
|
493
|
+
g2 = 0;
|
|
494
|
+
b2 = x;
|
|
495
|
+
}
|
|
496
|
+
const toInt = (n) => Math.round((n + m) * 255);
|
|
497
|
+
return getHex(`rgb(${toInt(r2)}, ${toInt(g2)}, ${toInt(b2)})`) ?? color;
|
|
498
|
+
};
|
|
499
|
+
|
|
500
|
+
// src/utils/getColorRoles.ts
|
|
501
|
+
var getColorRoles = (base, surface, containerAlpha = 0.15) => {
|
|
502
|
+
const container = getBlendedColor(base, surface, containerAlpha);
|
|
503
|
+
return {
|
|
504
|
+
color: base,
|
|
505
|
+
onColor: getTonalColor(base, isDarkColor(base) ? 0.95 : 0.08),
|
|
506
|
+
container,
|
|
507
|
+
onContainer: getTonalColor(base, isDarkColor(container) ? 0.92 : 0.12)
|
|
508
|
+
};
|
|
509
|
+
};
|
|
510
|
+
|
|
466
511
|
// src/useComputedTheme.ts
|
|
467
512
|
function normalizeExplicitColor(value) {
|
|
468
513
|
if (!getRgb(value)) throw new Error(`Invalid color format: ${value}`);
|
|
@@ -474,7 +519,7 @@ var SEMANTIC_BASE_COLORS = {
|
|
|
474
519
|
danger: "#B00020"
|
|
475
520
|
};
|
|
476
521
|
function useComputedTheme(appearance, color, harmony = "split-complementary") {
|
|
477
|
-
const [theme, setTheme] =
|
|
522
|
+
const [theme, setTheme] = useState2(null);
|
|
478
523
|
const primaryInput = typeof color === "string" ? color : color.primary;
|
|
479
524
|
const secondaryInput = typeof color === "string" ? null : color.secondary;
|
|
480
525
|
const tertiaryInput = typeof color === "string" ? null : color.tertiary;
|
|
@@ -551,20 +596,22 @@ function useComputedTheme(appearance, color, harmony = "split-complementary") {
|
|
|
551
596
|
}
|
|
552
597
|
|
|
553
598
|
// src/ThemeProvider.tsx
|
|
554
|
-
import { jsx as
|
|
599
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
555
600
|
var NavBarContext = createContext3({});
|
|
556
|
-
var useNavBarContext = () =>
|
|
601
|
+
var useNavBarContext = () => useContext4(NavBarContext);
|
|
557
602
|
var BlurModuleContext = createContext3(void 0);
|
|
558
|
-
var useBlurModule = () =>
|
|
603
|
+
var useBlurModule = () => useContext4(BlurModuleContext);
|
|
559
604
|
var ReanimatedModuleContext = createContext3(void 0);
|
|
560
|
-
var useReanimatedModule = () =>
|
|
605
|
+
var useReanimatedModule = () => useContext4(ReanimatedModuleContext);
|
|
561
606
|
function Provider({ children, defaults, expoBlur, initialValue, navigationBar, onChange, onNavBarChange, onReady, reanimated, statusBarProps, style }) {
|
|
562
|
-
const [settings, setSettings] =
|
|
607
|
+
const [settings, setSettings] = useState3(() => ({ ...defaultThemeSettings, ...initialValue }));
|
|
563
608
|
const set = useCallback2((patch) => {
|
|
564
609
|
setSettings((prev) => ({ ...prev, ...patch }));
|
|
565
610
|
}, []);
|
|
566
611
|
const onChangeRef = useRef(onChange);
|
|
567
|
-
|
|
612
|
+
useEffect2(() => {
|
|
613
|
+
onChangeRef.current = onChange;
|
|
614
|
+
});
|
|
568
615
|
const prevSettings = useRef(settings);
|
|
569
616
|
useEffect2(() => {
|
|
570
617
|
if (prevSettings.current !== settings) {
|
|
@@ -581,9 +628,9 @@ function Provider({ children, defaults, expoBlur, initialValue, navigationBar, o
|
|
|
581
628
|
}
|
|
582
629
|
}, [theme, onReady]);
|
|
583
630
|
if (!theme) return null;
|
|
584
|
-
return /* @__PURE__ */
|
|
585
|
-
/* @__PURE__ */
|
|
586
|
-
/* @__PURE__ */
|
|
631
|
+
return /* @__PURE__ */ jsx4(ThemeSettingsContext.Provider, { value: { settings, set }, children: /* @__PURE__ */ jsxs2(PaperProvider, { theme, children: [
|
|
632
|
+
/* @__PURE__ */ jsx4(StatusBar2, { backgroundColor: theme.colors.background, barStyle: theme.dark ? "light-content" : "dark-content", ...statusBarProps }),
|
|
633
|
+
/* @__PURE__ */ jsx4(PaperDefaultsContext.Provider, { value: defaults ?? {}, children: /* @__PURE__ */ jsx4(NavBarContext.Provider, { value: { navigationBar, onNavBarChange }, children: /* @__PURE__ */ jsx4(BlurModuleContext.Provider, { value: expoBlur, children: /* @__PURE__ */ jsx4(ReanimatedModuleContext.Provider, { value: reanimated, children: /* @__PURE__ */ jsx4(View, { style: [styles.flex, { backgroundColor: theme.colors.background }, style], children }) }) }) }) })
|
|
587
634
|
] }) });
|
|
588
635
|
}
|
|
589
636
|
var styles = StyleSheet.create({
|
|
@@ -591,21 +638,24 @@ var styles = StyleSheet.create({
|
|
|
591
638
|
});
|
|
592
639
|
|
|
593
640
|
// src/components/BlurView.tsx
|
|
594
|
-
import {
|
|
641
|
+
import { useContext as useContext5 } from "react";
|
|
642
|
+
import { StyleSheet as StyleSheet2, View as View2 } from "react-native";
|
|
643
|
+
import { useTheme as useTheme2 } from "react-native-paper";
|
|
644
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
595
645
|
var ELEVATION_OPACITY = { 0: 0, 1: 0.05, 2: 0.08, 3: 0.11, 4: 0.12, 5: 0.14 };
|
|
596
646
|
var VARIANT_TINT_OPACITY = { light: 0.12, dark: 0.18 };
|
|
597
647
|
var BlurView = ({ blur = true, children, elevation, style, tintColor, tintOpacity, variant = "surface", ...props }) => {
|
|
598
648
|
const { dark, colors } = useTheme2();
|
|
599
|
-
const { settings } =
|
|
649
|
+
const { settings } = useContext5(ThemeSettingsContext);
|
|
600
650
|
const expoBlur = useBlurModule();
|
|
601
651
|
const surfaceColor = variant === "surfaceVariant" ? colors.surfaceVariant : colors.surface;
|
|
602
652
|
const variantColor = variant === "primary" ? colors.primary : variant === "secondary" ? colors.secondary : variant === "tertiary" ? colors.tertiary : variant === "error" ? colors.error : void 0;
|
|
603
653
|
const resolvedTintColor = tintColor ?? variantColor ?? (elevation !== void 0 ? colors.primary : void 0);
|
|
604
654
|
const resolvedTintOpacity = tintOpacity ?? (tintColor ? dark ? 0.24 : 0.16 : variantColor ? dark ? VARIANT_TINT_OPACITY.dark : VARIANT_TINT_OPACITY.light : elevation !== void 0 ? ELEVATION_OPACITY[elevation] : 0);
|
|
605
|
-
const tint = resolvedTintColor && resolvedTintOpacity > 0 ? /* @__PURE__ */
|
|
655
|
+
const tint = resolvedTintColor && resolvedTintOpacity > 0 ? /* @__PURE__ */ jsx5(View2, { style: [StyleSheet2.absoluteFill, { backgroundColor: resolvedTintColor, opacity: resolvedTintOpacity }] }) : null;
|
|
606
656
|
if (blur && expoBlur)
|
|
607
657
|
return /* @__PURE__ */ jsxs3(expoBlur.BlurView, { ...props, tint: dark ? "dark" : "light", style, children: [
|
|
608
|
-
/* @__PURE__ */
|
|
658
|
+
/* @__PURE__ */ jsx5(View2, { style: [StyleSheet2.absoluteFill, { backgroundColor: surfaceColor, opacity: settings.blurTint }] }),
|
|
609
659
|
tint,
|
|
610
660
|
children
|
|
611
661
|
] });
|
|
@@ -615,113 +665,32 @@ var BlurView = ({ blur = true, children, elevation, style, tintColor, tintOpacit
|
|
|
615
665
|
] });
|
|
616
666
|
};
|
|
617
667
|
|
|
618
|
-
// src/components/BottomNavigation.tsx
|
|
619
|
-
import { useEffect as useEffect3 } from "react";
|
|
620
|
-
import { Platform } from "react-native";
|
|
621
|
-
import { BottomNavigation as PaperBottomNavigation, useTheme as useTheme3 } from "react-native-paper";
|
|
622
|
-
|
|
623
|
-
// src/navigation-bar.ts
|
|
624
|
-
var setNavigationBarStyle = (navigationBar, dark) => {
|
|
625
|
-
if (!navigationBar) return;
|
|
626
|
-
navigationBar.NavigationBar.setStyle(dark ? "light" : "dark");
|
|
627
|
-
};
|
|
628
|
-
|
|
629
|
-
// src/components/BottomNavigation.tsx
|
|
630
|
-
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
631
|
-
function useNavigationBarSync() {
|
|
632
|
-
const theme = useTheme3();
|
|
633
|
-
const { navigationBar, onNavBarChange } = useNavBarContext();
|
|
634
|
-
useEffect3(() => {
|
|
635
|
-
if (Platform.OS !== "android") return;
|
|
636
|
-
if (onNavBarChange) onNavBarChange(theme.colors.surface, theme.dark);
|
|
637
|
-
else if (navigationBar) setNavigationBarStyle(navigationBar, theme.dark);
|
|
638
|
-
}, [theme, onNavBarChange, navigationBar]);
|
|
639
|
-
}
|
|
640
|
-
function BottomNavigationComponent(props) {
|
|
641
|
-
const defaults = usePaperDefaults();
|
|
642
|
-
useNavigationBarSync();
|
|
643
|
-
return /* @__PURE__ */ jsx5(PaperBottomNavigation, { ...defaults.BottomNavigation, ...props });
|
|
644
|
-
}
|
|
645
|
-
function Bar(props) {
|
|
646
|
-
useNavigationBarSync();
|
|
647
|
-
return /* @__PURE__ */ jsx5(PaperBottomNavigation.Bar, { ...props });
|
|
648
|
-
}
|
|
649
|
-
BottomNavigationComponent.Bar = Bar;
|
|
650
|
-
BottomNavigationComponent.SceneMap = PaperBottomNavigation?.SceneMap;
|
|
651
|
-
var BottomNavigation = BottomNavigationComponent;
|
|
652
|
-
|
|
653
|
-
// src/components/Button.tsx
|
|
654
|
-
import { Button as PaperButton } from "react-native-paper";
|
|
655
|
-
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
656
|
-
function Button(props) {
|
|
657
|
-
const defaults = usePaperDefaults();
|
|
658
|
-
return /* @__PURE__ */ jsx6(PaperButton, { ...defaults.Button, ...props });
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
// src/components/Chip.tsx
|
|
662
|
-
import { Chip as PaperChip, useTheme as useTheme4 } from "react-native-paper";
|
|
663
|
-
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
664
|
-
function Chip({ variant, style, selectedColor, ...props }) {
|
|
665
|
-
const defaults = usePaperDefaults();
|
|
666
|
-
const { colors } = useTheme4();
|
|
667
|
-
const variantStyle = variant === "primary" ? { backgroundColor: colors.primaryContainer } : variant === "secondary" ? { backgroundColor: colors.secondaryContainer } : variant === "tertiary" ? { backgroundColor: colors.tertiaryContainer } : variant === "surface" ? { backgroundColor: colors.surface } : void 0;
|
|
668
|
-
const variantSelectedColor = variant === "primary" ? colors.onPrimaryContainer : variant === "secondary" ? colors.onSecondaryContainer : variant === "tertiary" ? colors.onTertiaryContainer : variant === "surface" ? colors.onSurface : void 0;
|
|
669
|
-
return /* @__PURE__ */ jsx7(PaperChip, { ...defaults.Chip, selectedColor: selectedColor ?? variantSelectedColor, ...props, style: [variantStyle, style] });
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
// src/components/ColorPicker.tsx
|
|
673
|
-
import { useState as useState5 } from "react";
|
|
674
|
-
import { StyleSheet as StyleSheet4, TouchableOpacity, View as View4 } from "react-native";
|
|
675
|
-
import { Icon, TouchableRipple, useTheme as useTheme6 } from "react-native-paper";
|
|
676
|
-
|
|
677
|
-
// src/useSwatchGrid.ts
|
|
678
|
-
import { useState as useState3 } from "react";
|
|
679
|
-
var SWATCH_GRID_COLUMNS = 5;
|
|
680
|
-
var SWATCH_GRID_GAP = 12;
|
|
681
|
-
function useSwatchSize(fallback) {
|
|
682
|
-
const [width, setWidth] = useState3(0);
|
|
683
|
-
const onLayout = ({ nativeEvent }) => setWidth(nativeEvent.layout.width);
|
|
684
|
-
const size = width > 0 ? (width - SWATCH_GRID_GAP * (SWATCH_GRID_COLUMNS - 1)) / SWATCH_GRID_COLUMNS : fallback;
|
|
685
|
-
return { onLayout, size };
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
// src/utils/getSwatchContrast.ts
|
|
689
|
-
var RING_WIDTH = 1;
|
|
690
|
-
var SELECTED_RING_WIDTH = 3;
|
|
691
|
-
var getContrastColor = (color) => isDarkColor(color) ? "#ffffff" : "#000000";
|
|
692
|
-
var getSwatchRing = (color, selected, outlineColor) => ({
|
|
693
|
-
borderColor: selected ? getContrastColor(color) : outlineColor,
|
|
694
|
-
borderWidth: selected ? SELECTED_RING_WIDTH : RING_WIDTH
|
|
695
|
-
});
|
|
696
|
-
|
|
697
668
|
// src/components/Dialog.tsx
|
|
698
|
-
import
|
|
699
|
-
import { Animated, BackHandler, Easing, Pressable, StyleSheet as StyleSheet3, View as View3 } from "react-native";
|
|
700
|
-
import { Dialog as PaperDialog, Portal, useTheme as useTheme5 } from "react-native-paper";
|
|
701
|
-
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
702
|
-
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
669
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
703
670
|
var ANIMATION_DURATION = 220;
|
|
704
671
|
var DIALOG_MARGIN = 32;
|
|
705
672
|
function DialogComponent({ animatedStyle, blur: blurProp, dismissable = true, dismissableBackButton = dismissable, visible, onDismiss, children, style, testID = "dialog" }) {
|
|
706
673
|
const blur = useBlur(blurProp);
|
|
707
674
|
const reanimated = useReanimatedModule();
|
|
708
|
-
const theme =
|
|
675
|
+
const theme = useTheme3();
|
|
709
676
|
const { colors, isV3, roundness } = theme;
|
|
710
677
|
const { scale } = theme.animation;
|
|
711
678
|
const { bottom, left, right, top } = useSafeAreaInsets();
|
|
712
|
-
const opacity =
|
|
679
|
+
const [opacity] = useState4(() => new Animated.Value(visible ? 1 : 0));
|
|
713
680
|
const [mounted, setMounted] = useState4(visible);
|
|
714
|
-
|
|
681
|
+
if (visible && !mounted) {
|
|
682
|
+
setMounted(true);
|
|
683
|
+
}
|
|
684
|
+
useEffect3(() => {
|
|
715
685
|
if (visible) {
|
|
716
|
-
setMounted(true);
|
|
717
686
|
Animated.timing(opacity, { duration: scale * ANIMATION_DURATION, easing: Easing.out(Easing.cubic), toValue: 1, useNativeDriver: true }).start();
|
|
718
687
|
} else {
|
|
719
688
|
Animated.timing(opacity, { duration: scale * ANIMATION_DURATION, easing: Easing.out(Easing.cubic), toValue: 0, useNativeDriver: true }).start(({ finished }) => {
|
|
720
689
|
if (finished) setMounted(false);
|
|
721
690
|
});
|
|
722
691
|
}
|
|
723
|
-
}, [visible]);
|
|
724
|
-
|
|
692
|
+
}, [visible, opacity, scale]);
|
|
693
|
+
useEffect3(() => {
|
|
725
694
|
if (!visible) return void 0;
|
|
726
695
|
const onHardwareBackPress = () => {
|
|
727
696
|
if (dismissable || dismissableBackButton) onDismiss?.();
|
|
@@ -731,21 +700,21 @@ function DialogComponent({ animatedStyle, blur: blurProp, dismissable = true, di
|
|
|
731
700
|
return () => subscription.remove();
|
|
732
701
|
}, [dismissable, dismissableBackButton, onDismiss, visible]);
|
|
733
702
|
if (!mounted) return null;
|
|
734
|
-
const content =
|
|
703
|
+
const content = React.Children.toArray(children).filter((child) => child != null && typeof child !== "boolean").map((child, i) => {
|
|
735
704
|
if (isV3) {
|
|
736
|
-
if (i === 0 &&
|
|
737
|
-
return
|
|
705
|
+
if (i === 0 && React.isValidElement(child)) {
|
|
706
|
+
return React.cloneElement(child, { style: [{ marginTop: 24 }, child.props.style] });
|
|
738
707
|
}
|
|
739
708
|
}
|
|
740
|
-
if (i === 0 &&
|
|
741
|
-
return
|
|
709
|
+
if (i === 0 && React.isValidElement(child) && child.type === PaperDialog.Content) {
|
|
710
|
+
return React.cloneElement(child, { style: [{ paddingTop: 24 }, child.props.style] });
|
|
742
711
|
}
|
|
743
712
|
return child;
|
|
744
713
|
});
|
|
745
714
|
const borderRadius = (isV3 ? 7 : 1) * roundness;
|
|
746
|
-
return /* @__PURE__ */
|
|
747
|
-
/* @__PURE__ */
|
|
748
|
-
/* @__PURE__ */
|
|
715
|
+
return /* @__PURE__ */ jsx6(Portal, { children: /* @__PURE__ */ jsxs4(Animated.View, { accessibilityLiveRegion: "polite", accessibilityViewIsModal: true, pointerEvents: visible ? "box-none" : "none", style: [StyleSheet3.absoluteFill, { opacity }], testID, children: [
|
|
716
|
+
/* @__PURE__ */ jsx6(Pressable, { accessibilityLabel: "Close modal", accessibilityRole: "button", disabled: !dismissable, onPress: dismissable ? onDismiss : void 0, style: [StyleSheet3.absoluteFill, { backgroundColor: colors.backdrop }], testID: `${testID}-backdrop` }),
|
|
717
|
+
/* @__PURE__ */ jsx6(View3, { pointerEvents: "box-none", style: [styles2.wrapper, { marginBottom: bottom, marginTop: top, paddingHorizontal: Math.max(left, right, DIALOG_MARGIN) }], testID: `${testID}-wrapper`, children: reanimated && animatedStyle ? /* @__PURE__ */ jsx6(reanimated.View, { style: animatedStyle, testID: `${testID}-animated-wrapper`, children: /* @__PURE__ */ jsx6(BlurView, { blur, style: [styles2.card, { borderRadius }, style], testID: `${testID}-surface`, children: content }) }) : /* @__PURE__ */ jsx6(BlurView, { blur, style: [styles2.card, { borderRadius }, style], testID: `${testID}-surface`, children: content }) })
|
|
749
718
|
] }) });
|
|
750
719
|
}
|
|
751
720
|
DialogComponent.Title = PaperDialog.Title;
|
|
@@ -760,7 +729,7 @@ var styles2 = StyleSheet3.create({
|
|
|
760
729
|
});
|
|
761
730
|
|
|
762
731
|
// src/components/ColorPicker.tsx
|
|
763
|
-
import { Fragment as Fragment2, jsx as
|
|
732
|
+
import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
764
733
|
var SIZE = 48;
|
|
765
734
|
var defaultColors = [
|
|
766
735
|
{ label: "Red", value: "#f44336" },
|
|
@@ -786,12 +755,12 @@ var defaultColors = [
|
|
|
786
755
|
];
|
|
787
756
|
var ColorPicker = ({ value, onChange, colors = defaultColors, blur: blurProp }) => {
|
|
788
757
|
const blur = useBlur(blurProp);
|
|
789
|
-
const { colors: themeColors } =
|
|
758
|
+
const { colors: themeColors } = useTheme4();
|
|
790
759
|
const [open, setOpen] = useState5(false);
|
|
791
760
|
const { onLayout, size } = useSwatchSize(SIZE);
|
|
792
761
|
return /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
793
|
-
/* @__PURE__ */
|
|
794
|
-
/* @__PURE__ */
|
|
762
|
+
/* @__PURE__ */ jsx7(TouchableRipple, { onPress: () => setOpen(true), style: [styles3.trigger, { backgroundColor: value }, getSwatchRing(value, false, themeColors.outlineVariant)], borderless: true, children: /* @__PURE__ */ jsx7(Icon, { source: "palette", size: 20, color: getContrastColor(value) }) }),
|
|
763
|
+
/* @__PURE__ */ jsx7(Dialog, { blur, visible: open, onDismiss: () => setOpen(false), children: /* @__PURE__ */ jsx7(Dialog.Content, { children: /* @__PURE__ */ jsx7(View4, { style: styles3.swatches, onLayout, children: colors.map(({ value: hex }) => /* @__PURE__ */ jsx7(
|
|
795
764
|
TouchableOpacity,
|
|
796
765
|
{
|
|
797
766
|
onPress: () => {
|
|
@@ -799,7 +768,7 @@ var ColorPicker = ({ value, onChange, colors = defaultColors, blur: blurProp })
|
|
|
799
768
|
setOpen(false);
|
|
800
769
|
},
|
|
801
770
|
style: [styles3.swatch, { backgroundColor: hex, borderRadius: size / 2, height: size, width: size }, getSwatchRing(hex, value === hex, themeColors.outlineVariant)],
|
|
802
|
-
children: value === hex && /* @__PURE__ */
|
|
771
|
+
children: value === hex && /* @__PURE__ */ jsx7(Icon, { source: "check", size: 20, color: getContrastColor(hex) })
|
|
803
772
|
},
|
|
804
773
|
hex
|
|
805
774
|
)) }) }) })
|
|
@@ -811,17 +780,9 @@ var styles3 = StyleSheet4.create({
|
|
|
811
780
|
trigger: { alignItems: "center", alignSelf: "flex-start", borderRadius: SIZE / 2, height: SIZE, justifyContent: "center", width: SIZE }
|
|
812
781
|
});
|
|
813
782
|
|
|
814
|
-
// src/components/FAB.tsx
|
|
815
|
-
import { FAB as PaperFAB } from "react-native-paper";
|
|
816
|
-
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
817
|
-
function FAB(props) {
|
|
818
|
-
const defaults = usePaperDefaults();
|
|
819
|
-
return /* @__PURE__ */ jsx10(PaperFAB, { ...defaults.FAB, ...props });
|
|
820
|
-
}
|
|
821
|
-
|
|
822
783
|
// src/components/HarmonyPicker.tsx
|
|
823
784
|
import { SegmentedButtons as SegmentedButtons2 } from "react-native-paper";
|
|
824
|
-
import { jsx as
|
|
785
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
825
786
|
var HARMONIES = [
|
|
826
787
|
{ label: "Triadic", value: "triadic", icon: "triangle-outline" },
|
|
827
788
|
{ label: "Split", value: "split-complementary", icon: "arrow-split-vertical" },
|
|
@@ -831,7 +792,7 @@ var HARMONIES = [
|
|
|
831
792
|
{ label: "Dbl Split", value: "double-split", icon: "arrow-expand-horizontal" }
|
|
832
793
|
];
|
|
833
794
|
var COMPACT_MIN_WIDTH = 0;
|
|
834
|
-
var HarmonyPicker = ({ value, onChange, showLabels = true, checkedColor, uncheckedColor, checkedContainerColor, uncheckedContainerColor }) => /* @__PURE__ */
|
|
795
|
+
var HarmonyPicker = ({ value, onChange, showLabels = true, checkedColor, uncheckedColor, checkedContainerColor, uncheckedContainerColor }) => /* @__PURE__ */ jsx8(
|
|
835
796
|
SegmentedButtons2,
|
|
836
797
|
{
|
|
837
798
|
value,
|
|
@@ -852,37 +813,8 @@ var HarmonyPicker = ({ value, onChange, showLabels = true, checkedColor, uncheck
|
|
|
852
813
|
}
|
|
853
814
|
);
|
|
854
815
|
|
|
855
|
-
// src/components/IconButton.tsx
|
|
856
|
-
import { IconButton as PaperIconButton, useTheme as useTheme7 } from "react-native-paper";
|
|
857
|
-
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
858
|
-
function IconButton({ variant, iconColor, containerColor, ...props }) {
|
|
859
|
-
const defaults = usePaperDefaults();
|
|
860
|
-
const { colors } = useTheme7();
|
|
861
|
-
const variantContainerColor = variant === "primary" ? colors.primaryContainer : variant === "secondary" ? colors.secondaryContainer : variant === "tertiary" ? colors.tertiaryContainer : variant === "surface" ? colors.surface : void 0;
|
|
862
|
-
const variantIconColor = variant === "primary" ? colors.onPrimaryContainer : variant === "secondary" ? colors.onSecondaryContainer : variant === "tertiary" ? colors.onTertiaryContainer : variant === "surface" ? colors.onSurface : void 0;
|
|
863
|
-
return /* @__PURE__ */ jsx12(PaperIconButton, { ...defaults.IconButton, containerColor: containerColor ?? variantContainerColor, iconColor: iconColor ?? variantIconColor, ...props });
|
|
864
|
-
}
|
|
865
|
-
|
|
866
|
-
// src/components/Menu.tsx
|
|
867
|
-
import { StyleSheet as StyleSheet5 } from "react-native";
|
|
868
|
-
import { Menu as PaperMenu } from "react-native-paper";
|
|
869
|
-
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
870
|
-
var MenuComponent = ({ blur: blurProp, children, ...props }) => {
|
|
871
|
-
const blur = useBlur(blurProp);
|
|
872
|
-
return /* @__PURE__ */ jsx13(PaperMenu, { ...props, contentStyle: [styles4.content, props.contentStyle], children: /* @__PURE__ */ jsx13(BlurView, { blur, children }) });
|
|
873
|
-
};
|
|
874
|
-
var Menu = Object.assign(MenuComponent, {
|
|
875
|
-
Item: PaperMenu.Item
|
|
876
|
-
});
|
|
877
|
-
var styles4 = StyleSheet5.create({
|
|
878
|
-
content: { backgroundColor: "transparent", paddingVertical: 0 }
|
|
879
|
-
});
|
|
880
|
-
|
|
881
816
|
// src/components/PalettePicker.tsx
|
|
882
|
-
import {
|
|
883
|
-
import { StyleSheet as StyleSheet6, TouchableOpacity as TouchableOpacity2, View as View5 } from "react-native";
|
|
884
|
-
import { Icon as Icon2, TouchableRipple as TouchableRipple2, useTheme as useTheme8 } from "react-native-paper";
|
|
885
|
-
import { Fragment as Fragment3, jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
817
|
+
import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
886
818
|
var SIZE2 = 48;
|
|
887
819
|
var defaultWeights = { primary: 2, secondary: 1, tertiary: 1 };
|
|
888
820
|
var buildWedges = (weights) => {
|
|
@@ -896,30 +828,30 @@ var buildWedges = (weights) => {
|
|
|
896
828
|
{ key: "secondary", rotate: primary / 2 + tertiary, share: secondary }
|
|
897
829
|
];
|
|
898
830
|
};
|
|
899
|
-
var Pie = ({ palette, weights = defaultWeights, size = SIZE2 }) => /* @__PURE__ */
|
|
831
|
+
var Pie = ({ palette, weights = defaultWeights, size = SIZE2 }) => /* @__PURE__ */ jsx9(View5, { style: [styles4.pie, { borderRadius: size / 2, height: size, width: size }], children: buildWedges(weights).map(({ key, rotate, share }) => /* @__PURE__ */ jsx9(View5, { style: [styles4.rotator, { transform: [{ rotate: `${rotate}deg` }] }], children: /* @__PURE__ */ jsx9(View5, { style: styles4.halfMask, children: /* @__PURE__ */ jsx9(View5, { style: [styles4.innerRotator, { transform: [{ rotate: `${share - 180}deg` }] }], children: /* @__PURE__ */ jsx9(View5, { style: [styles4.wedgeFill, { backgroundColor: palette[key] }] }) }) }) }, key)) });
|
|
900
832
|
var PalettePicker = ({ value, onChange, harmony = "split-complementary", onHarmonyChange, weights, colors = defaultColors, blur: blurProp }) => {
|
|
901
833
|
const blur = useBlur(blurProp);
|
|
902
|
-
const { colors: themeColors } =
|
|
834
|
+
const { colors: themeColors } = useTheme5();
|
|
903
835
|
const [open, setOpen] = useState6(false);
|
|
904
836
|
const { onLayout, size } = useSwatchSize(SIZE2);
|
|
905
837
|
return /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
906
|
-
/* @__PURE__ */
|
|
907
|
-
/* @__PURE__ */
|
|
908
|
-
/* @__PURE__ */
|
|
838
|
+
/* @__PURE__ */ jsx9(TouchableRipple2, { onPress: () => setOpen(true), style: styles4.trigger, borderless: true, children: /* @__PURE__ */ jsxs6(View5, { style: styles4.triggerContent, children: [
|
|
839
|
+
/* @__PURE__ */ jsx9(Pie, { palette: getTriadicPalette(value, harmony), weights }),
|
|
840
|
+
/* @__PURE__ */ jsx9(View5, { pointerEvents: "none", style: [styles4.triggerIcon, { borderRadius: SIZE2 / 2 }, getSwatchRing(value, false, themeColors.outlineVariant)], children: /* @__PURE__ */ jsx9(Icon2, { source: "palette", size: 20, color: getContrastColor(value) }) })
|
|
909
841
|
] }) }),
|
|
910
|
-
/* @__PURE__ */
|
|
911
|
-
onHarmonyChange && /* @__PURE__ */
|
|
912
|
-
/* @__PURE__ */
|
|
842
|
+
/* @__PURE__ */ jsx9(Dialog, { blur, visible: open, onDismiss: () => setOpen(false), children: /* @__PURE__ */ jsxs6(Dialog.Content, { children: [
|
|
843
|
+
onHarmonyChange && /* @__PURE__ */ jsx9(View5, { style: styles4.harmonyRow, children: /* @__PURE__ */ jsx9(HarmonyPicker, { value: harmony, onChange: onHarmonyChange, showLabels: false }) }),
|
|
844
|
+
/* @__PURE__ */ jsx9(View5, { style: styles4.swatches, onLayout, children: colors.map(({ value: hex }) => /* @__PURE__ */ jsxs6(
|
|
913
845
|
TouchableOpacity2,
|
|
914
846
|
{
|
|
915
847
|
onPress: () => {
|
|
916
848
|
onChange(hex);
|
|
917
849
|
setOpen(false);
|
|
918
850
|
},
|
|
919
|
-
style: [
|
|
851
|
+
style: [styles4.swatch, { height: size, width: size }],
|
|
920
852
|
children: [
|
|
921
|
-
/* @__PURE__ */
|
|
922
|
-
/* @__PURE__ */
|
|
853
|
+
/* @__PURE__ */ jsx9(Pie, { palette: getTriadicPalette(hex, harmony), weights, size }),
|
|
854
|
+
/* @__PURE__ */ jsx9(View5, { pointerEvents: "none", style: [styles4.ring, { borderRadius: size / 2 }, getSwatchRing(hex, value === hex, themeColors.outlineVariant)], children: value === hex && /* @__PURE__ */ jsx9(Icon2, { source: "check", size: 20, color: getContrastColor(hex) }) })
|
|
923
855
|
]
|
|
924
856
|
},
|
|
925
857
|
hex
|
|
@@ -927,7 +859,7 @@ var PalettePicker = ({ value, onChange, harmony = "split-complementary", onHarmo
|
|
|
927
859
|
] }) })
|
|
928
860
|
] });
|
|
929
861
|
};
|
|
930
|
-
var
|
|
862
|
+
var styles4 = StyleSheet5.create({
|
|
931
863
|
halfMask: { height: "100%", left: "50%", overflow: "hidden", position: "absolute", top: 0, width: "50%" },
|
|
932
864
|
harmonyRow: { marginBottom: 4 },
|
|
933
865
|
innerRotator: { height: "100%", left: "-100%", overflow: "hidden", position: "absolute", top: 0, width: "200%" },
|
|
@@ -942,13 +874,108 @@ var styles5 = StyleSheet6.create({
|
|
|
942
874
|
wedgeFill: { height: "100%", left: "50%", position: "absolute", top: 0, width: "50%" }
|
|
943
875
|
});
|
|
944
876
|
|
|
877
|
+
// src/components/AutoPalettePicker.tsx
|
|
878
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
879
|
+
var AutoPalettePicker = (props) => {
|
|
880
|
+
const { settings, set } = useThemeSettings();
|
|
881
|
+
return /* @__PURE__ */ jsx10(PalettePicker, { ...props, value: resolveSeedColor(settings.color), onChange: (color) => set({ color }), harmony: settings.harmony, onHarmonyChange: (harmony) => set({ harmony }) });
|
|
882
|
+
};
|
|
883
|
+
|
|
884
|
+
// src/components/BottomNavigation.tsx
|
|
885
|
+
import { useEffect as useEffect4 } from "react";
|
|
886
|
+
import { Platform } from "react-native";
|
|
887
|
+
import { BottomNavigation as PaperBottomNavigation, useTheme as useTheme6 } from "react-native-paper";
|
|
888
|
+
|
|
889
|
+
// src/navigation-bar.ts
|
|
890
|
+
var setNavigationBarStyle = (navigationBar, dark) => {
|
|
891
|
+
if (!navigationBar) return;
|
|
892
|
+
navigationBar.NavigationBar.setStyle(dark ? "light" : "dark");
|
|
893
|
+
};
|
|
894
|
+
|
|
895
|
+
// src/components/BottomNavigation.tsx
|
|
896
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
897
|
+
function useNavigationBarSync() {
|
|
898
|
+
const theme = useTheme6();
|
|
899
|
+
const { navigationBar, onNavBarChange } = useNavBarContext();
|
|
900
|
+
useEffect4(() => {
|
|
901
|
+
if (Platform.OS !== "android") return;
|
|
902
|
+
if (onNavBarChange) onNavBarChange(theme.colors.surface, theme.dark);
|
|
903
|
+
else if (navigationBar) setNavigationBarStyle(navigationBar, theme.dark);
|
|
904
|
+
}, [theme, onNavBarChange, navigationBar]);
|
|
905
|
+
}
|
|
906
|
+
function BottomNavigationComponent(props) {
|
|
907
|
+
const defaults = usePaperDefaults();
|
|
908
|
+
useNavigationBarSync();
|
|
909
|
+
return /* @__PURE__ */ jsx11(PaperBottomNavigation, { ...defaults.BottomNavigation, ...props });
|
|
910
|
+
}
|
|
911
|
+
function Bar(props) {
|
|
912
|
+
useNavigationBarSync();
|
|
913
|
+
return /* @__PURE__ */ jsx11(PaperBottomNavigation.Bar, { ...props });
|
|
914
|
+
}
|
|
915
|
+
BottomNavigationComponent.Bar = Bar;
|
|
916
|
+
BottomNavigationComponent.SceneMap = PaperBottomNavigation?.SceneMap;
|
|
917
|
+
var BottomNavigation = BottomNavigationComponent;
|
|
918
|
+
|
|
919
|
+
// src/components/Button.tsx
|
|
920
|
+
import { Button as PaperButton } from "react-native-paper";
|
|
921
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
922
|
+
function Button(props) {
|
|
923
|
+
const defaults = usePaperDefaults();
|
|
924
|
+
return /* @__PURE__ */ jsx12(PaperButton, { ...defaults.Button, ...props });
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
// src/components/Chip.tsx
|
|
928
|
+
import { Chip as PaperChip, useTheme as useTheme7 } from "react-native-paper";
|
|
929
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
930
|
+
function Chip({ variant, style, selectedColor, ...props }) {
|
|
931
|
+
const defaults = usePaperDefaults();
|
|
932
|
+
const { colors } = useTheme7();
|
|
933
|
+
const variantStyle = variant === "primary" ? { backgroundColor: colors.primaryContainer } : variant === "secondary" ? { backgroundColor: colors.secondaryContainer } : variant === "tertiary" ? { backgroundColor: colors.tertiaryContainer } : variant === "surface" ? { backgroundColor: colors.surface } : void 0;
|
|
934
|
+
const variantSelectedColor = variant === "primary" ? colors.onPrimaryContainer : variant === "secondary" ? colors.onSecondaryContainer : variant === "tertiary" ? colors.onTertiaryContainer : variant === "surface" ? colors.onSurface : void 0;
|
|
935
|
+
return /* @__PURE__ */ jsx13(PaperChip, { ...defaults.Chip, selectedColor: selectedColor ?? variantSelectedColor, ...props, style: [variantStyle, style] });
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
// src/components/FAB.tsx
|
|
939
|
+
import { FAB as PaperFAB } from "react-native-paper";
|
|
940
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
941
|
+
function FAB(props) {
|
|
942
|
+
const defaults = usePaperDefaults();
|
|
943
|
+
return /* @__PURE__ */ jsx14(PaperFAB, { ...defaults.FAB, ...props });
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
// src/components/IconButton.tsx
|
|
947
|
+
import { IconButton as PaperIconButton, useTheme as useTheme8 } from "react-native-paper";
|
|
948
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
949
|
+
function IconButton({ variant, iconColor, containerColor, ...props }) {
|
|
950
|
+
const defaults = usePaperDefaults();
|
|
951
|
+
const { colors } = useTheme8();
|
|
952
|
+
const variantContainerColor = variant === "primary" ? colors.primaryContainer : variant === "secondary" ? colors.secondaryContainer : variant === "tertiary" ? colors.tertiaryContainer : variant === "surface" ? colors.surface : void 0;
|
|
953
|
+
const variantIconColor = variant === "primary" ? colors.onPrimaryContainer : variant === "secondary" ? colors.onSecondaryContainer : variant === "tertiary" ? colors.onTertiaryContainer : variant === "surface" ? colors.onSurface : void 0;
|
|
954
|
+
return /* @__PURE__ */ jsx15(PaperIconButton, { ...defaults.IconButton, containerColor: containerColor ?? variantContainerColor, iconColor: iconColor ?? variantIconColor, ...props });
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
// src/components/Menu.tsx
|
|
958
|
+
import { StyleSheet as StyleSheet6 } from "react-native";
|
|
959
|
+
import { Menu as PaperMenu } from "react-native-paper";
|
|
960
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
961
|
+
var MenuComponent = ({ blur: blurProp, children, ...props }) => {
|
|
962
|
+
const blur = useBlur(blurProp);
|
|
963
|
+
return /* @__PURE__ */ jsx16(PaperMenu, { ...props, contentStyle: [styles5.content, props.contentStyle], children: /* @__PURE__ */ jsx16(BlurView, { blur, children }) });
|
|
964
|
+
};
|
|
965
|
+
var Menu = Object.assign(MenuComponent, {
|
|
966
|
+
Item: PaperMenu.Item
|
|
967
|
+
});
|
|
968
|
+
var styles5 = StyleSheet6.create({
|
|
969
|
+
content: { backgroundColor: "transparent", paddingVertical: 0 }
|
|
970
|
+
});
|
|
971
|
+
|
|
945
972
|
// src/components/TextInput.tsx
|
|
946
973
|
import { forwardRef } from "react";
|
|
947
974
|
import { TextInput as PaperTextInput } from "react-native-paper";
|
|
948
|
-
import { jsx as
|
|
975
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
949
976
|
var TextInput = forwardRef(function TextInput2(props, ref) {
|
|
950
977
|
const defaults = usePaperDefaults();
|
|
951
|
-
return /* @__PURE__ */
|
|
978
|
+
return /* @__PURE__ */ jsx17(PaperTextInput, { ref, ...defaults.TextInput, ...props });
|
|
952
979
|
});
|
|
953
980
|
|
|
954
981
|
// src/redux/themeSlice.ts
|
|
@@ -992,10 +1019,6 @@ var selectThemeHarmony = (state) => state.harmony;
|
|
|
992
1019
|
import { useTheme as usePaperTheme } from "react-native-paper";
|
|
993
1020
|
var useAutoPaperTheme = () => usePaperTheme();
|
|
994
1021
|
|
|
995
|
-
// src/useThemeSettings.ts
|
|
996
|
-
import { useContext as useContext5 } from "react";
|
|
997
|
-
var useThemeSettings = () => useContext5(ThemeSettingsContext);
|
|
998
|
-
|
|
999
1022
|
// src/utils/getThirdColor.ts
|
|
1000
1023
|
function rgbToHsl(r, g, b) {
|
|
1001
1024
|
r /= 255;
|
|
@@ -1080,6 +1103,8 @@ var getTintTextColor = (tintColor, backdropColor, tintOpacity) => {
|
|
|
1080
1103
|
export {
|
|
1081
1104
|
Appbar,
|
|
1082
1105
|
AppearancePicker,
|
|
1106
|
+
AutoAppearancePicker,
|
|
1107
|
+
AutoPalettePicker,
|
|
1083
1108
|
BlurView,
|
|
1084
1109
|
BottomNavigation,
|
|
1085
1110
|
Button,
|
|
@@ -1108,6 +1133,7 @@ export {
|
|
|
1108
1133
|
getTonalColor,
|
|
1109
1134
|
getTriadicPalette,
|
|
1110
1135
|
isDarkColor,
|
|
1136
|
+
resolveSeedColor,
|
|
1111
1137
|
selectThemeAppearance,
|
|
1112
1138
|
selectThemeBlur,
|
|
1113
1139
|
selectThemeColor,
|