@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.js
CHANGED
|
@@ -32,6 +32,8 @@ var index_exports = {};
|
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
Appbar: () => Appbar,
|
|
34
34
|
AppearancePicker: () => AppearancePicker,
|
|
35
|
+
AutoAppearancePicker: () => AutoAppearancePicker,
|
|
36
|
+
AutoPalettePicker: () => AutoPalettePicker,
|
|
35
37
|
BlurView: () => BlurView,
|
|
36
38
|
BottomNavigation: () => BottomNavigation,
|
|
37
39
|
Button: () => Button,
|
|
@@ -60,6 +62,7 @@ __export(index_exports, {
|
|
|
60
62
|
getTonalColor: () => getTonalColor,
|
|
61
63
|
getTriadicPalette: () => getTriadicPalette,
|
|
62
64
|
isDarkColor: () => isDarkColor,
|
|
65
|
+
resolveSeedColor: () => resolveSeedColor,
|
|
63
66
|
selectThemeAppearance: () => selectThemeAppearance,
|
|
64
67
|
selectThemeBlur: () => selectThemeBlur,
|
|
65
68
|
selectThemeColor: () => selectThemeColor,
|
|
@@ -147,20 +150,35 @@ var AppearancePicker = ({ value, onChange, showLabels = true, icons }) => {
|
|
|
147
150
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native_paper2.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 })) });
|
|
148
151
|
};
|
|
149
152
|
|
|
150
|
-
// src/
|
|
151
|
-
var
|
|
152
|
-
var
|
|
153
|
-
var import_react_native_paper5 = require("react-native-paper");
|
|
153
|
+
// src/useThemeSettings.ts
|
|
154
|
+
var import_react4 = require("react");
|
|
155
|
+
var useThemeSettings = () => (0, import_react4.useContext)(ThemeSettingsContext);
|
|
154
156
|
|
|
155
|
-
// src/
|
|
156
|
-
var
|
|
157
|
-
var
|
|
158
|
-
|
|
157
|
+
// src/components/AutoAppearancePicker.tsx
|
|
158
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
159
|
+
var AutoAppearancePicker = (props) => {
|
|
160
|
+
const { settings, set } = useThemeSettings();
|
|
161
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(AppearancePicker, { ...props, value: settings.appearance, onChange: (appearance) => set({ appearance }) });
|
|
162
|
+
};
|
|
159
163
|
|
|
160
|
-
// src/
|
|
161
|
-
var
|
|
162
|
-
|
|
163
|
-
|
|
164
|
+
// src/utils/resolveSeedColor.ts
|
|
165
|
+
var resolveSeedColor = (color) => typeof color === "string" ? color : color.primary;
|
|
166
|
+
|
|
167
|
+
// src/components/PalettePicker.tsx
|
|
168
|
+
var import_react11 = require("react");
|
|
169
|
+
var import_react_native7 = require("react-native");
|
|
170
|
+
var import_react_native_paper9 = require("react-native-paper");
|
|
171
|
+
|
|
172
|
+
// src/useSwatchGrid.ts
|
|
173
|
+
var import_react5 = require("react");
|
|
174
|
+
var SWATCH_GRID_COLUMNS = 5;
|
|
175
|
+
var SWATCH_GRID_GAP = 12;
|
|
176
|
+
function useSwatchSize(fallback) {
|
|
177
|
+
const [width, setWidth] = (0, import_react5.useState)(0);
|
|
178
|
+
const onLayout = ({ nativeEvent }) => setWidth(nativeEvent.layout.width);
|
|
179
|
+
const size = width > 0 ? (width - SWATCH_GRID_GAP * (SWATCH_GRID_COLUMNS - 1)) / SWATCH_GRID_COLUMNS : fallback;
|
|
180
|
+
return { onLayout, size };
|
|
181
|
+
}
|
|
164
182
|
|
|
165
183
|
// src/utils/colorNames.ts
|
|
166
184
|
var colorNames = {
|
|
@@ -360,6 +378,25 @@ var getRgb = (value) => {
|
|
|
360
378
|
return null;
|
|
361
379
|
};
|
|
362
380
|
|
|
381
|
+
// src/utils/isDarkColor.ts
|
|
382
|
+
var isDarkColor = (value) => {
|
|
383
|
+
const rgb = getRgb(value);
|
|
384
|
+
if (!rgb) return false;
|
|
385
|
+
const [r, g, b] = [rgb.r / 255, rgb.g / 255, rgb.b / 255];
|
|
386
|
+
const [rs, gs, bs] = [r, g, b].map((c) => c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4));
|
|
387
|
+
const luminance = 0.2126 * rs + 0.7152 * gs + 0.0722 * bs;
|
|
388
|
+
return luminance < 0.5;
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
// src/utils/getSwatchContrast.ts
|
|
392
|
+
var RING_WIDTH = 1;
|
|
393
|
+
var SELECTED_RING_WIDTH = 3;
|
|
394
|
+
var getContrastColor = (color) => isDarkColor(color) ? "#ffffff" : "#000000";
|
|
395
|
+
var getSwatchRing = (color, selected, outlineColor) => ({
|
|
396
|
+
borderColor: selected ? getContrastColor(color) : outlineColor,
|
|
397
|
+
borderWidth: selected ? SELECTED_RING_WIDTH : RING_WIDTH
|
|
398
|
+
});
|
|
399
|
+
|
|
363
400
|
// src/utils/getHex.ts
|
|
364
401
|
var getHex = (value) => {
|
|
365
402
|
const rgb = getRgb(value);
|
|
@@ -375,92 +412,6 @@ var getHex = (value) => {
|
|
|
375
412
|
return hexString;
|
|
376
413
|
};
|
|
377
414
|
|
|
378
|
-
// src/utils/getBlendedColor.ts
|
|
379
|
-
var getBlendedColor = (foreground, background, alpha) => {
|
|
380
|
-
const fg = getRgb(foreground);
|
|
381
|
-
const bg = getRgb(background);
|
|
382
|
-
if (!fg || !bg) return background;
|
|
383
|
-
const safeAlpha = Math.min(1, Math.max(0, alpha));
|
|
384
|
-
const r = Math.round(fg.r * safeAlpha + bg.r * (1 - safeAlpha));
|
|
385
|
-
const g = Math.round(fg.g * safeAlpha + bg.g * (1 - safeAlpha));
|
|
386
|
-
const b = Math.round(fg.b * safeAlpha + bg.b * (1 - safeAlpha));
|
|
387
|
-
return getHex(`rgb(${r}, ${g}, ${b})`) ?? background;
|
|
388
|
-
};
|
|
389
|
-
|
|
390
|
-
// src/utils/getTonalColor.ts
|
|
391
|
-
var getTonalColor = (color, lightness) => {
|
|
392
|
-
const rgb = getRgb(color);
|
|
393
|
-
if (!rgb) return color;
|
|
394
|
-
const r = rgb.r / 255;
|
|
395
|
-
const g = rgb.g / 255;
|
|
396
|
-
const b = rgb.b / 255;
|
|
397
|
-
const max = Math.max(r, g, b);
|
|
398
|
-
const min = Math.min(r, g, b);
|
|
399
|
-
const delta = max - min;
|
|
400
|
-
let h = 0;
|
|
401
|
-
if (delta !== 0) {
|
|
402
|
-
if (max === r) h = (g - b) / delta % 6;
|
|
403
|
-
else if (max === g) h = (b - r) / delta + 2;
|
|
404
|
-
else h = (r - g) / delta + 4;
|
|
405
|
-
h = (h * 60 + 360) % 360;
|
|
406
|
-
}
|
|
407
|
-
const l = (max + min) / 2;
|
|
408
|
-
const s = delta === 0 ? 0 : delta / (1 - Math.abs(2 * l - 1));
|
|
409
|
-
const targetL = Math.min(1, Math.max(0, lightness));
|
|
410
|
-
const c = (1 - Math.abs(2 * targetL - 1)) * s;
|
|
411
|
-
const x = c * (1 - Math.abs(h / 60 % 2 - 1));
|
|
412
|
-
const m = targetL - c / 2;
|
|
413
|
-
let r2 = 0, g2 = 0, b2 = 0;
|
|
414
|
-
if (h < 60) {
|
|
415
|
-
r2 = c;
|
|
416
|
-
g2 = x;
|
|
417
|
-
b2 = 0;
|
|
418
|
-
} else if (h < 120) {
|
|
419
|
-
r2 = x;
|
|
420
|
-
g2 = c;
|
|
421
|
-
b2 = 0;
|
|
422
|
-
} else if (h < 180) {
|
|
423
|
-
r2 = 0;
|
|
424
|
-
g2 = c;
|
|
425
|
-
b2 = x;
|
|
426
|
-
} else if (h < 240) {
|
|
427
|
-
r2 = 0;
|
|
428
|
-
g2 = x;
|
|
429
|
-
b2 = c;
|
|
430
|
-
} else if (h < 300) {
|
|
431
|
-
r2 = x;
|
|
432
|
-
g2 = 0;
|
|
433
|
-
b2 = c;
|
|
434
|
-
} else {
|
|
435
|
-
r2 = c;
|
|
436
|
-
g2 = 0;
|
|
437
|
-
b2 = x;
|
|
438
|
-
}
|
|
439
|
-
const toInt = (n) => Math.round((n + m) * 255);
|
|
440
|
-
return getHex(`rgb(${toInt(r2)}, ${toInt(g2)}, ${toInt(b2)})`) ?? color;
|
|
441
|
-
};
|
|
442
|
-
|
|
443
|
-
// src/utils/isDarkColor.ts
|
|
444
|
-
var isDarkColor = (value) => {
|
|
445
|
-
const rgb = getRgb(value);
|
|
446
|
-
if (!rgb) return false;
|
|
447
|
-
const [r, g, b] = [rgb.r / 255, rgb.g / 255, rgb.b / 255];
|
|
448
|
-
const [rs, gs, bs] = [r, g, b].map((c) => c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4));
|
|
449
|
-
const luminance = 0.2126 * rs + 0.7152 * gs + 0.0722 * bs;
|
|
450
|
-
return luminance < 0.5;
|
|
451
|
-
};
|
|
452
|
-
|
|
453
|
-
// src/utils/getColorRoles.ts
|
|
454
|
-
var getColorRoles = (base, surface, containerAlpha = 0.15) => {
|
|
455
|
-
const container = getBlendedColor(base, surface, containerAlpha);
|
|
456
|
-
return {
|
|
457
|
-
color: base,
|
|
458
|
-
onColor: getTonalColor(base, isDarkColor(base) ? 0.95 : 0.08),
|
|
459
|
-
container,
|
|
460
|
-
onContainer: getTonalColor(base, isDarkColor(container) ? 0.92 : 0.12)
|
|
461
|
-
};
|
|
462
|
-
};
|
|
463
|
-
|
|
464
415
|
// src/utils/getTriadicPalette.ts
|
|
465
416
|
var HARMONY_OFFSETS = {
|
|
466
417
|
analogous: [1 / 12, 2 / 12],
|
|
@@ -542,6 +493,103 @@ function hslToHex(h, s, l) {
|
|
|
542
493
|
return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
|
|
543
494
|
}
|
|
544
495
|
|
|
496
|
+
// src/components/ColorPicker.tsx
|
|
497
|
+
var import_react10 = require("react");
|
|
498
|
+
var import_react_native6 = require("react-native");
|
|
499
|
+
var import_react_native_paper7 = require("react-native-paper");
|
|
500
|
+
|
|
501
|
+
// src/components/Dialog.tsx
|
|
502
|
+
var import_react9 = __toESM(require("react"));
|
|
503
|
+
var import_react_native5 = require("react-native");
|
|
504
|
+
var import_react_native_paper6 = require("react-native-paper");
|
|
505
|
+
var import_react_native_safe_area_context = require("react-native-safe-area-context");
|
|
506
|
+
|
|
507
|
+
// src/ThemeProvider.tsx
|
|
508
|
+
var import_react7 = require("react");
|
|
509
|
+
var import_react_native3 = require("react-native");
|
|
510
|
+
var import_react_native_paper4 = require("react-native-paper");
|
|
511
|
+
|
|
512
|
+
// src/useComputedTheme.ts
|
|
513
|
+
var import_react6 = require("react");
|
|
514
|
+
var import_react_native2 = require("react-native");
|
|
515
|
+
var import_react_native_paper3 = require("react-native-paper");
|
|
516
|
+
|
|
517
|
+
// src/utils/getBlendedColor.ts
|
|
518
|
+
var getBlendedColor = (foreground, background, alpha) => {
|
|
519
|
+
const fg = getRgb(foreground);
|
|
520
|
+
const bg = getRgb(background);
|
|
521
|
+
if (!fg || !bg) return background;
|
|
522
|
+
const safeAlpha = Math.min(1, Math.max(0, alpha));
|
|
523
|
+
const r = Math.round(fg.r * safeAlpha + bg.r * (1 - safeAlpha));
|
|
524
|
+
const g = Math.round(fg.g * safeAlpha + bg.g * (1 - safeAlpha));
|
|
525
|
+
const b = Math.round(fg.b * safeAlpha + bg.b * (1 - safeAlpha));
|
|
526
|
+
return getHex(`rgb(${r}, ${g}, ${b})`) ?? background;
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
// src/utils/getTonalColor.ts
|
|
530
|
+
var getTonalColor = (color, lightness) => {
|
|
531
|
+
const rgb = getRgb(color);
|
|
532
|
+
if (!rgb) return color;
|
|
533
|
+
const r = rgb.r / 255;
|
|
534
|
+
const g = rgb.g / 255;
|
|
535
|
+
const b = rgb.b / 255;
|
|
536
|
+
const max = Math.max(r, g, b);
|
|
537
|
+
const min = Math.min(r, g, b);
|
|
538
|
+
const delta = max - min;
|
|
539
|
+
let h = 0;
|
|
540
|
+
if (delta !== 0) {
|
|
541
|
+
if (max === r) h = (g - b) / delta % 6;
|
|
542
|
+
else if (max === g) h = (b - r) / delta + 2;
|
|
543
|
+
else h = (r - g) / delta + 4;
|
|
544
|
+
h = (h * 60 + 360) % 360;
|
|
545
|
+
}
|
|
546
|
+
const l = (max + min) / 2;
|
|
547
|
+
const s = delta === 0 ? 0 : delta / (1 - Math.abs(2 * l - 1));
|
|
548
|
+
const targetL = Math.min(1, Math.max(0, lightness));
|
|
549
|
+
const c = (1 - Math.abs(2 * targetL - 1)) * s;
|
|
550
|
+
const x = c * (1 - Math.abs(h / 60 % 2 - 1));
|
|
551
|
+
const m = targetL - c / 2;
|
|
552
|
+
let r2 = 0, g2 = 0, b2 = 0;
|
|
553
|
+
if (h < 60) {
|
|
554
|
+
r2 = c;
|
|
555
|
+
g2 = x;
|
|
556
|
+
b2 = 0;
|
|
557
|
+
} else if (h < 120) {
|
|
558
|
+
r2 = x;
|
|
559
|
+
g2 = c;
|
|
560
|
+
b2 = 0;
|
|
561
|
+
} else if (h < 180) {
|
|
562
|
+
r2 = 0;
|
|
563
|
+
g2 = c;
|
|
564
|
+
b2 = x;
|
|
565
|
+
} else if (h < 240) {
|
|
566
|
+
r2 = 0;
|
|
567
|
+
g2 = x;
|
|
568
|
+
b2 = c;
|
|
569
|
+
} else if (h < 300) {
|
|
570
|
+
r2 = x;
|
|
571
|
+
g2 = 0;
|
|
572
|
+
b2 = c;
|
|
573
|
+
} else {
|
|
574
|
+
r2 = c;
|
|
575
|
+
g2 = 0;
|
|
576
|
+
b2 = x;
|
|
577
|
+
}
|
|
578
|
+
const toInt = (n) => Math.round((n + m) * 255);
|
|
579
|
+
return getHex(`rgb(${toInt(r2)}, ${toInt(g2)}, ${toInt(b2)})`) ?? color;
|
|
580
|
+
};
|
|
581
|
+
|
|
582
|
+
// src/utils/getColorRoles.ts
|
|
583
|
+
var getColorRoles = (base, surface, containerAlpha = 0.15) => {
|
|
584
|
+
const container = getBlendedColor(base, surface, containerAlpha);
|
|
585
|
+
return {
|
|
586
|
+
color: base,
|
|
587
|
+
onColor: getTonalColor(base, isDarkColor(base) ? 0.95 : 0.08),
|
|
588
|
+
container,
|
|
589
|
+
onContainer: getTonalColor(base, isDarkColor(container) ? 0.92 : 0.12)
|
|
590
|
+
};
|
|
591
|
+
};
|
|
592
|
+
|
|
545
593
|
// src/useComputedTheme.ts
|
|
546
594
|
function normalizeExplicitColor(value) {
|
|
547
595
|
if (!getRgb(value)) throw new Error(`Invalid color format: ${value}`);
|
|
@@ -553,11 +601,11 @@ var SEMANTIC_BASE_COLORS = {
|
|
|
553
601
|
danger: "#B00020"
|
|
554
602
|
};
|
|
555
603
|
function useComputedTheme(appearance, color, harmony = "split-complementary") {
|
|
556
|
-
const [theme, setTheme] = (0,
|
|
604
|
+
const [theme, setTheme] = (0, import_react6.useState)(null);
|
|
557
605
|
const primaryInput = typeof color === "string" ? color : color.primary;
|
|
558
606
|
const secondaryInput = typeof color === "string" ? null : color.secondary;
|
|
559
607
|
const tertiaryInput = typeof color === "string" ? null : color.tertiary;
|
|
560
|
-
const computeTheme = (0,
|
|
608
|
+
const computeTheme = (0, import_react6.useCallback)(() => {
|
|
561
609
|
let resolved = appearance;
|
|
562
610
|
if (resolved === "system") resolved = import_react_native2.Appearance.getColorScheme();
|
|
563
611
|
if (resolved === "no-preference" || !resolved) resolved = "light";
|
|
@@ -619,10 +667,10 @@ function useComputedTheme(appearance, color, harmony = "split-complementary") {
|
|
|
619
667
|
};
|
|
620
668
|
setTheme(_theme);
|
|
621
669
|
}, [appearance, primaryInput, secondaryInput, tertiaryInput, harmony]);
|
|
622
|
-
(0,
|
|
670
|
+
(0, import_react6.useEffect)(() => {
|
|
623
671
|
computeTheme();
|
|
624
672
|
}, [computeTheme]);
|
|
625
|
-
(0,
|
|
673
|
+
(0, import_react6.useEffect)(() => {
|
|
626
674
|
const subscription = import_react_native2.Appearance.addChangeListener(computeTheme);
|
|
627
675
|
return subscription.remove;
|
|
628
676
|
}, [computeTheme]);
|
|
@@ -630,39 +678,41 @@ function useComputedTheme(appearance, color, harmony = "split-complementary") {
|
|
|
630
678
|
}
|
|
631
679
|
|
|
632
680
|
// src/ThemeProvider.tsx
|
|
633
|
-
var
|
|
634
|
-
var NavBarContext = (0,
|
|
635
|
-
var useNavBarContext = () => (0,
|
|
636
|
-
var BlurModuleContext = (0,
|
|
637
|
-
var useBlurModule = () => (0,
|
|
638
|
-
var ReanimatedModuleContext = (0,
|
|
639
|
-
var useReanimatedModule = () => (0,
|
|
681
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
682
|
+
var NavBarContext = (0, import_react7.createContext)({});
|
|
683
|
+
var useNavBarContext = () => (0, import_react7.useContext)(NavBarContext);
|
|
684
|
+
var BlurModuleContext = (0, import_react7.createContext)(void 0);
|
|
685
|
+
var useBlurModule = () => (0, import_react7.useContext)(BlurModuleContext);
|
|
686
|
+
var ReanimatedModuleContext = (0, import_react7.createContext)(void 0);
|
|
687
|
+
var useReanimatedModule = () => (0, import_react7.useContext)(ReanimatedModuleContext);
|
|
640
688
|
function Provider({ children, defaults, expoBlur, initialValue, navigationBar, onChange, onNavBarChange, onReady, reanimated, statusBarProps, style }) {
|
|
641
|
-
const [settings, setSettings] = (0,
|
|
642
|
-
const set = (0,
|
|
689
|
+
const [settings, setSettings] = (0, import_react7.useState)(() => ({ ...defaultThemeSettings, ...initialValue }));
|
|
690
|
+
const set = (0, import_react7.useCallback)((patch) => {
|
|
643
691
|
setSettings((prev) => ({ ...prev, ...patch }));
|
|
644
692
|
}, []);
|
|
645
|
-
const onChangeRef = (0,
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
693
|
+
const onChangeRef = (0, import_react7.useRef)(onChange);
|
|
694
|
+
(0, import_react7.useEffect)(() => {
|
|
695
|
+
onChangeRef.current = onChange;
|
|
696
|
+
});
|
|
697
|
+
const prevSettings = (0, import_react7.useRef)(settings);
|
|
698
|
+
(0, import_react7.useEffect)(() => {
|
|
649
699
|
if (prevSettings.current !== settings) {
|
|
650
700
|
prevSettings.current = settings;
|
|
651
701
|
onChangeRef.current?.(settings);
|
|
652
702
|
}
|
|
653
703
|
}, [settings]);
|
|
654
704
|
const theme = useComputedTheme(settings.appearance, settings.color, settings.harmony);
|
|
655
|
-
const called = (0,
|
|
656
|
-
(0,
|
|
705
|
+
const called = (0, import_react7.useRef)(false);
|
|
706
|
+
(0, import_react7.useEffect)(() => {
|
|
657
707
|
if (theme && !called.current) {
|
|
658
708
|
called.current = true;
|
|
659
709
|
onReady?.();
|
|
660
710
|
}
|
|
661
711
|
}, [theme, onReady]);
|
|
662
712
|
if (!theme) return null;
|
|
663
|
-
return /* @__PURE__ */ (0,
|
|
664
|
-
/* @__PURE__ */ (0,
|
|
665
|
-
/* @__PURE__ */ (0,
|
|
713
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ThemeSettingsContext.Provider, { value: { settings, set }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react_native_paper4.Provider, { theme, children: [
|
|
714
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native3.StatusBar, { backgroundColor: theme.colors.background, barStyle: theme.dark ? "light-content" : "dark-content", ...statusBarProps }),
|
|
715
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PaperDefaultsContext.Provider, { value: defaults ?? {}, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(NavBarContext.Provider, { value: { navigationBar, onNavBarChange }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BlurModuleContext.Provider, { value: expoBlur, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ReanimatedModuleContext.Provider, { value: reanimated, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native3.View, { style: [styles.flex, { backgroundColor: theme.colors.background }, style], children }) }) }) }) })
|
|
666
716
|
] }) });
|
|
667
717
|
}
|
|
668
718
|
var styles = import_react_native3.StyleSheet.create({
|
|
@@ -670,143 +720,65 @@ var styles = import_react_native3.StyleSheet.create({
|
|
|
670
720
|
});
|
|
671
721
|
|
|
672
722
|
// src/components/BlurView.tsx
|
|
673
|
-
var
|
|
723
|
+
var import_react8 = require("react");
|
|
724
|
+
var import_react_native4 = require("react-native");
|
|
725
|
+
var import_react_native_paper5 = require("react-native-paper");
|
|
726
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
674
727
|
var ELEVATION_OPACITY = { 0: 0, 1: 0.05, 2: 0.08, 3: 0.11, 4: 0.12, 5: 0.14 };
|
|
675
728
|
var VARIANT_TINT_OPACITY = { light: 0.12, dark: 0.18 };
|
|
676
729
|
var BlurView = ({ blur = true, children, elevation, style, tintColor, tintOpacity, variant = "surface", ...props }) => {
|
|
677
730
|
const { dark, colors } = (0, import_react_native_paper5.useTheme)();
|
|
678
|
-
const { settings } = (0,
|
|
731
|
+
const { settings } = (0, import_react8.useContext)(ThemeSettingsContext);
|
|
679
732
|
const expoBlur = useBlurModule();
|
|
680
733
|
const surfaceColor = variant === "surfaceVariant" ? colors.surfaceVariant : colors.surface;
|
|
681
734
|
const variantColor = variant === "primary" ? colors.primary : variant === "secondary" ? colors.secondary : variant === "tertiary" ? colors.tertiary : variant === "error" ? colors.error : void 0;
|
|
682
735
|
const resolvedTintColor = tintColor ?? variantColor ?? (elevation !== void 0 ? colors.primary : void 0);
|
|
683
736
|
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);
|
|
684
|
-
const tint = resolvedTintColor && resolvedTintOpacity > 0 ? /* @__PURE__ */ (0,
|
|
737
|
+
const tint = resolvedTintColor && resolvedTintOpacity > 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native4.View, { style: [import_react_native4.StyleSheet.absoluteFill, { backgroundColor: resolvedTintColor, opacity: resolvedTintOpacity }] }) : null;
|
|
685
738
|
if (blur && expoBlur)
|
|
686
|
-
return /* @__PURE__ */ (0,
|
|
687
|
-
/* @__PURE__ */ (0,
|
|
739
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(expoBlur.BlurView, { ...props, tint: dark ? "dark" : "light", style, children: [
|
|
740
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native4.View, { style: [import_react_native4.StyleSheet.absoluteFill, { backgroundColor: surfaceColor, opacity: settings.blurTint }] }),
|
|
688
741
|
tint,
|
|
689
742
|
children
|
|
690
743
|
] });
|
|
691
|
-
return /* @__PURE__ */ (0,
|
|
744
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react_native4.View, { ...props, style: [{ backgroundColor: surfaceColor }, style], children: [
|
|
692
745
|
tint,
|
|
693
746
|
children
|
|
694
747
|
] });
|
|
695
748
|
};
|
|
696
749
|
|
|
697
|
-
// src/components/BottomNavigation.tsx
|
|
698
|
-
var import_react7 = require("react");
|
|
699
|
-
var import_react_native5 = require("react-native");
|
|
700
|
-
var import_react_native_paper6 = require("react-native-paper");
|
|
701
|
-
|
|
702
|
-
// src/navigation-bar.ts
|
|
703
|
-
var setNavigationBarStyle = (navigationBar, dark) => {
|
|
704
|
-
if (!navigationBar) return;
|
|
705
|
-
navigationBar.NavigationBar.setStyle(dark ? "light" : "dark");
|
|
706
|
-
};
|
|
707
|
-
|
|
708
|
-
// src/components/BottomNavigation.tsx
|
|
709
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
710
|
-
function useNavigationBarSync() {
|
|
711
|
-
const theme = (0, import_react_native_paper6.useTheme)();
|
|
712
|
-
const { navigationBar, onNavBarChange } = useNavBarContext();
|
|
713
|
-
(0, import_react7.useEffect)(() => {
|
|
714
|
-
if (import_react_native5.Platform.OS !== "android") return;
|
|
715
|
-
if (onNavBarChange) onNavBarChange(theme.colors.surface, theme.dark);
|
|
716
|
-
else if (navigationBar) setNavigationBarStyle(navigationBar, theme.dark);
|
|
717
|
-
}, [theme, onNavBarChange, navigationBar]);
|
|
718
|
-
}
|
|
719
|
-
function BottomNavigationComponent(props) {
|
|
720
|
-
const defaults = usePaperDefaults();
|
|
721
|
-
useNavigationBarSync();
|
|
722
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native_paper6.BottomNavigation, { ...defaults.BottomNavigation, ...props });
|
|
723
|
-
}
|
|
724
|
-
function Bar(props) {
|
|
725
|
-
useNavigationBarSync();
|
|
726
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native_paper6.BottomNavigation.Bar, { ...props });
|
|
727
|
-
}
|
|
728
|
-
BottomNavigationComponent.Bar = Bar;
|
|
729
|
-
BottomNavigationComponent.SceneMap = import_react_native_paper6.BottomNavigation?.SceneMap;
|
|
730
|
-
var BottomNavigation = BottomNavigationComponent;
|
|
731
|
-
|
|
732
|
-
// src/components/Button.tsx
|
|
733
|
-
var import_react_native_paper7 = require("react-native-paper");
|
|
734
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
735
|
-
function Button(props) {
|
|
736
|
-
const defaults = usePaperDefaults();
|
|
737
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native_paper7.Button, { ...defaults.Button, ...props });
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
// src/components/Chip.tsx
|
|
741
|
-
var import_react_native_paper8 = require("react-native-paper");
|
|
742
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
743
|
-
function Chip({ variant, style, selectedColor, ...props }) {
|
|
744
|
-
const defaults = usePaperDefaults();
|
|
745
|
-
const { colors } = (0, import_react_native_paper8.useTheme)();
|
|
746
|
-
const variantStyle = variant === "primary" ? { backgroundColor: colors.primaryContainer } : variant === "secondary" ? { backgroundColor: colors.secondaryContainer } : variant === "tertiary" ? { backgroundColor: colors.tertiaryContainer } : variant === "surface" ? { backgroundColor: colors.surface } : void 0;
|
|
747
|
-
const variantSelectedColor = variant === "primary" ? colors.onPrimaryContainer : variant === "secondary" ? colors.onSecondaryContainer : variant === "tertiary" ? colors.onTertiaryContainer : variant === "surface" ? colors.onSurface : void 0;
|
|
748
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native_paper8.Chip, { ...defaults.Chip, selectedColor: selectedColor ?? variantSelectedColor, ...props, style: [variantStyle, style] });
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
// src/components/ColorPicker.tsx
|
|
752
|
-
var import_react10 = require("react");
|
|
753
|
-
var import_react_native7 = require("react-native");
|
|
754
|
-
var import_react_native_paper10 = require("react-native-paper");
|
|
755
|
-
|
|
756
|
-
// src/useSwatchGrid.ts
|
|
757
|
-
var import_react8 = require("react");
|
|
758
|
-
var SWATCH_GRID_COLUMNS = 5;
|
|
759
|
-
var SWATCH_GRID_GAP = 12;
|
|
760
|
-
function useSwatchSize(fallback) {
|
|
761
|
-
const [width, setWidth] = (0, import_react8.useState)(0);
|
|
762
|
-
const onLayout = ({ nativeEvent }) => setWidth(nativeEvent.layout.width);
|
|
763
|
-
const size = width > 0 ? (width - SWATCH_GRID_GAP * (SWATCH_GRID_COLUMNS - 1)) / SWATCH_GRID_COLUMNS : fallback;
|
|
764
|
-
return { onLayout, size };
|
|
765
|
-
}
|
|
766
|
-
|
|
767
|
-
// src/utils/getSwatchContrast.ts
|
|
768
|
-
var RING_WIDTH = 1;
|
|
769
|
-
var SELECTED_RING_WIDTH = 3;
|
|
770
|
-
var getContrastColor = (color) => isDarkColor(color) ? "#ffffff" : "#000000";
|
|
771
|
-
var getSwatchRing = (color, selected, outlineColor) => ({
|
|
772
|
-
borderColor: selected ? getContrastColor(color) : outlineColor,
|
|
773
|
-
borderWidth: selected ? SELECTED_RING_WIDTH : RING_WIDTH
|
|
774
|
-
});
|
|
775
|
-
|
|
776
750
|
// src/components/Dialog.tsx
|
|
777
|
-
var
|
|
778
|
-
var import_react_native6 = require("react-native");
|
|
779
|
-
var import_react_native_paper9 = require("react-native-paper");
|
|
780
|
-
var import_react_native_safe_area_context = require("react-native-safe-area-context");
|
|
781
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
751
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
782
752
|
var ANIMATION_DURATION = 220;
|
|
783
753
|
var DIALOG_MARGIN = 32;
|
|
784
754
|
function DialogComponent({ animatedStyle, blur: blurProp, dismissable = true, dismissableBackButton = dismissable, visible, onDismiss, children, style, testID = "dialog" }) {
|
|
785
755
|
const blur = useBlur(blurProp);
|
|
786
756
|
const reanimated = useReanimatedModule();
|
|
787
|
-
const theme = (0,
|
|
757
|
+
const theme = (0, import_react_native_paper6.useTheme)();
|
|
788
758
|
const { colors, isV3, roundness } = theme;
|
|
789
759
|
const { scale } = theme.animation;
|
|
790
760
|
const { bottom, left, right, top } = (0, import_react_native_safe_area_context.useSafeAreaInsets)();
|
|
791
|
-
const opacity = (0, import_react9.
|
|
761
|
+
const [opacity] = (0, import_react9.useState)(() => new import_react_native5.Animated.Value(visible ? 1 : 0));
|
|
792
762
|
const [mounted, setMounted] = (0, import_react9.useState)(visible);
|
|
763
|
+
if (visible && !mounted) {
|
|
764
|
+
setMounted(true);
|
|
765
|
+
}
|
|
793
766
|
(0, import_react9.useEffect)(() => {
|
|
794
767
|
if (visible) {
|
|
795
|
-
|
|
796
|
-
import_react_native6.Animated.timing(opacity, { duration: scale * ANIMATION_DURATION, easing: import_react_native6.Easing.out(import_react_native6.Easing.cubic), toValue: 1, useNativeDriver: true }).start();
|
|
768
|
+
import_react_native5.Animated.timing(opacity, { duration: scale * ANIMATION_DURATION, easing: import_react_native5.Easing.out(import_react_native5.Easing.cubic), toValue: 1, useNativeDriver: true }).start();
|
|
797
769
|
} else {
|
|
798
|
-
|
|
770
|
+
import_react_native5.Animated.timing(opacity, { duration: scale * ANIMATION_DURATION, easing: import_react_native5.Easing.out(import_react_native5.Easing.cubic), toValue: 0, useNativeDriver: true }).start(({ finished }) => {
|
|
799
771
|
if (finished) setMounted(false);
|
|
800
772
|
});
|
|
801
773
|
}
|
|
802
|
-
}, [visible]);
|
|
774
|
+
}, [visible, opacity, scale]);
|
|
803
775
|
(0, import_react9.useEffect)(() => {
|
|
804
776
|
if (!visible) return void 0;
|
|
805
777
|
const onHardwareBackPress = () => {
|
|
806
778
|
if (dismissable || dismissableBackButton) onDismiss?.();
|
|
807
779
|
return true;
|
|
808
780
|
};
|
|
809
|
-
const subscription =
|
|
781
|
+
const subscription = import_react_native5.BackHandler.addEventListener("hardwareBackPress", onHardwareBackPress);
|
|
810
782
|
return () => subscription.remove();
|
|
811
783
|
}, [dismissable, dismissableBackButton, onDismiss, visible]);
|
|
812
784
|
if (!mounted) return null;
|
|
@@ -816,30 +788,30 @@ function DialogComponent({ animatedStyle, blur: blurProp, dismissable = true, di
|
|
|
816
788
|
return import_react9.default.cloneElement(child, { style: [{ marginTop: 24 }, child.props.style] });
|
|
817
789
|
}
|
|
818
790
|
}
|
|
819
|
-
if (i === 0 && import_react9.default.isValidElement(child) && child.type ===
|
|
791
|
+
if (i === 0 && import_react9.default.isValidElement(child) && child.type === import_react_native_paper6.Dialog.Content) {
|
|
820
792
|
return import_react9.default.cloneElement(child, { style: [{ paddingTop: 24 }, child.props.style] });
|
|
821
793
|
}
|
|
822
794
|
return child;
|
|
823
795
|
});
|
|
824
796
|
const borderRadius = (isV3 ? 7 : 1) * roundness;
|
|
825
|
-
return /* @__PURE__ */ (0,
|
|
826
|
-
/* @__PURE__ */ (0,
|
|
827
|
-
/* @__PURE__ */ (0,
|
|
797
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native_paper6.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react_native5.Animated.View, { accessibilityLiveRegion: "polite", accessibilityViewIsModal: true, pointerEvents: visible ? "box-none" : "none", style: [import_react_native5.StyleSheet.absoluteFill, { opacity }], testID, children: [
|
|
798
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native5.Pressable, { accessibilityLabel: "Close modal", accessibilityRole: "button", disabled: !dismissable, onPress: dismissable ? onDismiss : void 0, style: [import_react_native5.StyleSheet.absoluteFill, { backgroundColor: colors.backdrop }], testID: `${testID}-backdrop` }),
|
|
799
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native5.View, { pointerEvents: "box-none", style: [styles2.wrapper, { marginBottom: bottom, marginTop: top, paddingHorizontal: Math.max(left, right, DIALOG_MARGIN) }], testID: `${testID}-wrapper`, children: reanimated && animatedStyle ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(reanimated.View, { style: animatedStyle, testID: `${testID}-animated-wrapper`, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(BlurView, { blur, style: [styles2.card, { borderRadius }, style], testID: `${testID}-surface`, children: content }) }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(BlurView, { blur, style: [styles2.card, { borderRadius }, style], testID: `${testID}-surface`, children: content }) })
|
|
828
800
|
] }) });
|
|
829
801
|
}
|
|
830
|
-
DialogComponent.Title =
|
|
831
|
-
DialogComponent.Content =
|
|
832
|
-
DialogComponent.Actions =
|
|
833
|
-
DialogComponent.ScrollArea =
|
|
802
|
+
DialogComponent.Title = import_react_native_paper6.Dialog.Title;
|
|
803
|
+
DialogComponent.Content = import_react_native_paper6.Dialog.Content;
|
|
804
|
+
DialogComponent.Actions = import_react_native_paper6.Dialog.Actions;
|
|
805
|
+
DialogComponent.ScrollArea = import_react_native_paper6.Dialog.ScrollArea;
|
|
834
806
|
var Dialog = DialogComponent;
|
|
835
|
-
var styles2 =
|
|
807
|
+
var styles2 = import_react_native5.StyleSheet.create({
|
|
836
808
|
// Width cap keeps dialogs card-sized on wide viewports (web/tablet); no effect on phones.
|
|
837
809
|
card: { alignSelf: "center", maxWidth: 400, overflow: "hidden", width: "100%" },
|
|
838
810
|
wrapper: { flex: 1, justifyContent: "center", paddingVertical: DIALOG_MARGIN }
|
|
839
811
|
});
|
|
840
812
|
|
|
841
813
|
// src/components/ColorPicker.tsx
|
|
842
|
-
var
|
|
814
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
843
815
|
var SIZE = 48;
|
|
844
816
|
var defaultColors = [
|
|
845
817
|
{ label: "Red", value: "#f44336" },
|
|
@@ -865,42 +837,34 @@ var defaultColors = [
|
|
|
865
837
|
];
|
|
866
838
|
var ColorPicker = ({ value, onChange, colors = defaultColors, blur: blurProp }) => {
|
|
867
839
|
const blur = useBlur(blurProp);
|
|
868
|
-
const { colors: themeColors } = (0,
|
|
840
|
+
const { colors: themeColors } = (0, import_react_native_paper7.useTheme)();
|
|
869
841
|
const [open, setOpen] = (0, import_react10.useState)(false);
|
|
870
842
|
const { onLayout, size } = useSwatchSize(SIZE);
|
|
871
|
-
return /* @__PURE__ */ (0,
|
|
872
|
-
/* @__PURE__ */ (0,
|
|
873
|
-
/* @__PURE__ */ (0,
|
|
874
|
-
|
|
843
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
844
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native_paper7.TouchableRipple, { onPress: () => setOpen(true), style: [styles3.trigger, { backgroundColor: value }, getSwatchRing(value, false, themeColors.outlineVariant)], borderless: true, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native_paper7.Icon, { source: "palette", size: 20, color: getContrastColor(value) }) }),
|
|
845
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Dialog, { blur, visible: open, onDismiss: () => setOpen(false), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Dialog.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native6.View, { style: styles3.swatches, onLayout, children: colors.map(({ value: hex }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
846
|
+
import_react_native6.TouchableOpacity,
|
|
875
847
|
{
|
|
876
848
|
onPress: () => {
|
|
877
849
|
onChange(hex);
|
|
878
850
|
setOpen(false);
|
|
879
851
|
},
|
|
880
852
|
style: [styles3.swatch, { backgroundColor: hex, borderRadius: size / 2, height: size, width: size }, getSwatchRing(hex, value === hex, themeColors.outlineVariant)],
|
|
881
|
-
children: value === hex && /* @__PURE__ */ (0,
|
|
853
|
+
children: value === hex && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native_paper7.Icon, { source: "check", size: 20, color: getContrastColor(hex) })
|
|
882
854
|
},
|
|
883
855
|
hex
|
|
884
856
|
)) }) }) })
|
|
885
857
|
] });
|
|
886
858
|
};
|
|
887
|
-
var styles3 =
|
|
859
|
+
var styles3 = import_react_native6.StyleSheet.create({
|
|
888
860
|
swatch: { alignItems: "center", justifyContent: "center" },
|
|
889
861
|
swatches: { flexDirection: "row", flexWrap: "wrap", gap: SWATCH_GRID_GAP, paddingTop: 12 },
|
|
890
862
|
trigger: { alignItems: "center", alignSelf: "flex-start", borderRadius: SIZE / 2, height: SIZE, justifyContent: "center", width: SIZE }
|
|
891
863
|
});
|
|
892
864
|
|
|
893
|
-
// src/components/FAB.tsx
|
|
894
|
-
var import_react_native_paper11 = require("react-native-paper");
|
|
895
|
-
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
896
|
-
function FAB(props) {
|
|
897
|
-
const defaults = usePaperDefaults();
|
|
898
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native_paper11.FAB, { ...defaults.FAB, ...props });
|
|
899
|
-
}
|
|
900
|
-
|
|
901
865
|
// src/components/HarmonyPicker.tsx
|
|
902
|
-
var
|
|
903
|
-
var
|
|
866
|
+
var import_react_native_paper8 = require("react-native-paper");
|
|
867
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
904
868
|
var HARMONIES = [
|
|
905
869
|
{ label: "Triadic", value: "triadic", icon: "triangle-outline" },
|
|
906
870
|
{ label: "Split", value: "split-complementary", icon: "arrow-split-vertical" },
|
|
@@ -910,8 +874,8 @@ var HARMONIES = [
|
|
|
910
874
|
{ label: "Dbl Split", value: "double-split", icon: "arrow-expand-horizontal" }
|
|
911
875
|
];
|
|
912
876
|
var COMPACT_MIN_WIDTH = 0;
|
|
913
|
-
var HarmonyPicker = ({ value, onChange, showLabels = true, checkedColor, uncheckedColor, checkedContainerColor, uncheckedContainerColor }) => /* @__PURE__ */ (0,
|
|
914
|
-
|
|
877
|
+
var HarmonyPicker = ({ value, onChange, showLabels = true, checkedColor, uncheckedColor, checkedContainerColor, uncheckedContainerColor }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
878
|
+
import_react_native_paper8.SegmentedButtons,
|
|
915
879
|
{
|
|
916
880
|
value,
|
|
917
881
|
onValueChange: (v) => onChange(v),
|
|
@@ -931,37 +895,8 @@ var HarmonyPicker = ({ value, onChange, showLabels = true, checkedColor, uncheck
|
|
|
931
895
|
}
|
|
932
896
|
);
|
|
933
897
|
|
|
934
|
-
// src/components/IconButton.tsx
|
|
935
|
-
var import_react_native_paper13 = require("react-native-paper");
|
|
936
|
-
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
937
|
-
function IconButton({ variant, iconColor, containerColor, ...props }) {
|
|
938
|
-
const defaults = usePaperDefaults();
|
|
939
|
-
const { colors } = (0, import_react_native_paper13.useTheme)();
|
|
940
|
-
const variantContainerColor = variant === "primary" ? colors.primaryContainer : variant === "secondary" ? colors.secondaryContainer : variant === "tertiary" ? colors.tertiaryContainer : variant === "surface" ? colors.surface : void 0;
|
|
941
|
-
const variantIconColor = variant === "primary" ? colors.onPrimaryContainer : variant === "secondary" ? colors.onSecondaryContainer : variant === "tertiary" ? colors.onTertiaryContainer : variant === "surface" ? colors.onSurface : void 0;
|
|
942
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native_paper13.IconButton, { ...defaults.IconButton, containerColor: containerColor ?? variantContainerColor, iconColor: iconColor ?? variantIconColor, ...props });
|
|
943
|
-
}
|
|
944
|
-
|
|
945
|
-
// src/components/Menu.tsx
|
|
946
|
-
var import_react_native8 = require("react-native");
|
|
947
|
-
var import_react_native_paper14 = require("react-native-paper");
|
|
948
|
-
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
949
|
-
var MenuComponent = ({ blur: blurProp, children, ...props }) => {
|
|
950
|
-
const blur = useBlur(blurProp);
|
|
951
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native_paper14.Menu, { ...props, contentStyle: [styles4.content, props.contentStyle], children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(BlurView, { blur, children }) });
|
|
952
|
-
};
|
|
953
|
-
var Menu = Object.assign(MenuComponent, {
|
|
954
|
-
Item: import_react_native_paper14.Menu.Item
|
|
955
|
-
});
|
|
956
|
-
var styles4 = import_react_native8.StyleSheet.create({
|
|
957
|
-
content: { backgroundColor: "transparent", paddingVertical: 0 }
|
|
958
|
-
});
|
|
959
|
-
|
|
960
898
|
// src/components/PalettePicker.tsx
|
|
961
|
-
var
|
|
962
|
-
var import_react_native9 = require("react-native");
|
|
963
|
-
var import_react_native_paper15 = require("react-native-paper");
|
|
964
|
-
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
899
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
965
900
|
var SIZE2 = 48;
|
|
966
901
|
var defaultWeights = { primary: 2, secondary: 1, tertiary: 1 };
|
|
967
902
|
var buildWedges = (weights) => {
|
|
@@ -975,30 +910,30 @@ var buildWedges = (weights) => {
|
|
|
975
910
|
{ key: "secondary", rotate: primary / 2 + tertiary, share: secondary }
|
|
976
911
|
];
|
|
977
912
|
};
|
|
978
|
-
var Pie = ({ palette, weights = defaultWeights, size = SIZE2 }) => /* @__PURE__ */ (0,
|
|
913
|
+
var Pie = ({ palette, weights = defaultWeights, size = SIZE2 }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native7.View, { style: [styles4.pie, { borderRadius: size / 2, height: size, width: size }], children: buildWedges(weights).map(({ key, rotate, share }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native7.View, { style: [styles4.rotator, { transform: [{ rotate: `${rotate}deg` }] }], children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native7.View, { style: styles4.halfMask, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native7.View, { style: [styles4.innerRotator, { transform: [{ rotate: `${share - 180}deg` }] }], children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native7.View, { style: [styles4.wedgeFill, { backgroundColor: palette[key] }] }) }) }) }, key)) });
|
|
979
914
|
var PalettePicker = ({ value, onChange, harmony = "split-complementary", onHarmonyChange, weights, colors = defaultColors, blur: blurProp }) => {
|
|
980
915
|
const blur = useBlur(blurProp);
|
|
981
|
-
const { colors: themeColors } = (0,
|
|
916
|
+
const { colors: themeColors } = (0, import_react_native_paper9.useTheme)();
|
|
982
917
|
const [open, setOpen] = (0, import_react11.useState)(false);
|
|
983
918
|
const { onLayout, size } = useSwatchSize(SIZE2);
|
|
984
|
-
return /* @__PURE__ */ (0,
|
|
985
|
-
/* @__PURE__ */ (0,
|
|
986
|
-
/* @__PURE__ */ (0,
|
|
987
|
-
/* @__PURE__ */ (0,
|
|
919
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
920
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native_paper9.TouchableRipple, { onPress: () => setOpen(true), style: styles4.trigger, borderless: true, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react_native7.View, { style: styles4.triggerContent, children: [
|
|
921
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Pie, { palette: getTriadicPalette(value, harmony), weights }),
|
|
922
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native7.View, { pointerEvents: "none", style: [styles4.triggerIcon, { borderRadius: SIZE2 / 2 }, getSwatchRing(value, false, themeColors.outlineVariant)], children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native_paper9.Icon, { source: "palette", size: 20, color: getContrastColor(value) }) })
|
|
988
923
|
] }) }),
|
|
989
|
-
/* @__PURE__ */ (0,
|
|
990
|
-
onHarmonyChange && /* @__PURE__ */ (0,
|
|
991
|
-
/* @__PURE__ */ (0,
|
|
992
|
-
|
|
924
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Dialog, { blur, visible: open, onDismiss: () => setOpen(false), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Dialog.Content, { children: [
|
|
925
|
+
onHarmonyChange && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native7.View, { style: styles4.harmonyRow, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(HarmonyPicker, { value: harmony, onChange: onHarmonyChange, showLabels: false }) }),
|
|
926
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native7.View, { style: styles4.swatches, onLayout, children: colors.map(({ value: hex }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
927
|
+
import_react_native7.TouchableOpacity,
|
|
993
928
|
{
|
|
994
929
|
onPress: () => {
|
|
995
930
|
onChange(hex);
|
|
996
931
|
setOpen(false);
|
|
997
932
|
},
|
|
998
|
-
style: [
|
|
933
|
+
style: [styles4.swatch, { height: size, width: size }],
|
|
999
934
|
children: [
|
|
1000
|
-
/* @__PURE__ */ (0,
|
|
1001
|
-
/* @__PURE__ */ (0,
|
|
935
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Pie, { palette: getTriadicPalette(hex, harmony), weights, size }),
|
|
936
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native7.View, { pointerEvents: "none", style: [styles4.ring, { borderRadius: size / 2 }, getSwatchRing(hex, value === hex, themeColors.outlineVariant)], children: value === hex && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native_paper9.Icon, { source: "check", size: 20, color: getContrastColor(hex) }) })
|
|
1002
937
|
]
|
|
1003
938
|
},
|
|
1004
939
|
hex
|
|
@@ -1006,7 +941,7 @@ var PalettePicker = ({ value, onChange, harmony = "split-complementary", onHarmo
|
|
|
1006
941
|
] }) })
|
|
1007
942
|
] });
|
|
1008
943
|
};
|
|
1009
|
-
var
|
|
944
|
+
var styles4 = import_react_native7.StyleSheet.create({
|
|
1010
945
|
halfMask: { height: "100%", left: "50%", overflow: "hidden", position: "absolute", top: 0, width: "50%" },
|
|
1011
946
|
harmonyRow: { marginBottom: 4 },
|
|
1012
947
|
innerRotator: { height: "100%", left: "-100%", overflow: "hidden", position: "absolute", top: 0, width: "200%" },
|
|
@@ -1021,13 +956,108 @@ var styles5 = import_react_native9.StyleSheet.create({
|
|
|
1021
956
|
wedgeFill: { height: "100%", left: "50%", position: "absolute", top: 0, width: "50%" }
|
|
1022
957
|
});
|
|
1023
958
|
|
|
1024
|
-
// src/components/
|
|
959
|
+
// src/components/AutoPalettePicker.tsx
|
|
960
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
961
|
+
var AutoPalettePicker = (props) => {
|
|
962
|
+
const { settings, set } = useThemeSettings();
|
|
963
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PalettePicker, { ...props, value: resolveSeedColor(settings.color), onChange: (color) => set({ color }), harmony: settings.harmony, onHarmonyChange: (harmony) => set({ harmony }) });
|
|
964
|
+
};
|
|
965
|
+
|
|
966
|
+
// src/components/BottomNavigation.tsx
|
|
1025
967
|
var import_react12 = require("react");
|
|
1026
|
-
var
|
|
968
|
+
var import_react_native8 = require("react-native");
|
|
969
|
+
var import_react_native_paper10 = require("react-native-paper");
|
|
970
|
+
|
|
971
|
+
// src/navigation-bar.ts
|
|
972
|
+
var setNavigationBarStyle = (navigationBar, dark) => {
|
|
973
|
+
if (!navigationBar) return;
|
|
974
|
+
navigationBar.NavigationBar.setStyle(dark ? "light" : "dark");
|
|
975
|
+
};
|
|
976
|
+
|
|
977
|
+
// src/components/BottomNavigation.tsx
|
|
978
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
979
|
+
function useNavigationBarSync() {
|
|
980
|
+
const theme = (0, import_react_native_paper10.useTheme)();
|
|
981
|
+
const { navigationBar, onNavBarChange } = useNavBarContext();
|
|
982
|
+
(0, import_react12.useEffect)(() => {
|
|
983
|
+
if (import_react_native8.Platform.OS !== "android") return;
|
|
984
|
+
if (onNavBarChange) onNavBarChange(theme.colors.surface, theme.dark);
|
|
985
|
+
else if (navigationBar) setNavigationBarStyle(navigationBar, theme.dark);
|
|
986
|
+
}, [theme, onNavBarChange, navigationBar]);
|
|
987
|
+
}
|
|
988
|
+
function BottomNavigationComponent(props) {
|
|
989
|
+
const defaults = usePaperDefaults();
|
|
990
|
+
useNavigationBarSync();
|
|
991
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native_paper10.BottomNavigation, { ...defaults.BottomNavigation, ...props });
|
|
992
|
+
}
|
|
993
|
+
function Bar(props) {
|
|
994
|
+
useNavigationBarSync();
|
|
995
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native_paper10.BottomNavigation.Bar, { ...props });
|
|
996
|
+
}
|
|
997
|
+
BottomNavigationComponent.Bar = Bar;
|
|
998
|
+
BottomNavigationComponent.SceneMap = import_react_native_paper10.BottomNavigation?.SceneMap;
|
|
999
|
+
var BottomNavigation = BottomNavigationComponent;
|
|
1000
|
+
|
|
1001
|
+
// src/components/Button.tsx
|
|
1002
|
+
var import_react_native_paper11 = require("react-native-paper");
|
|
1003
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1004
|
+
function Button(props) {
|
|
1005
|
+
const defaults = usePaperDefaults();
|
|
1006
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native_paper11.Button, { ...defaults.Button, ...props });
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
// src/components/Chip.tsx
|
|
1010
|
+
var import_react_native_paper12 = require("react-native-paper");
|
|
1011
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1012
|
+
function Chip({ variant, style, selectedColor, ...props }) {
|
|
1013
|
+
const defaults = usePaperDefaults();
|
|
1014
|
+
const { colors } = (0, import_react_native_paper12.useTheme)();
|
|
1015
|
+
const variantStyle = variant === "primary" ? { backgroundColor: colors.primaryContainer } : variant === "secondary" ? { backgroundColor: colors.secondaryContainer } : variant === "tertiary" ? { backgroundColor: colors.tertiaryContainer } : variant === "surface" ? { backgroundColor: colors.surface } : void 0;
|
|
1016
|
+
const variantSelectedColor = variant === "primary" ? colors.onPrimaryContainer : variant === "secondary" ? colors.onSecondaryContainer : variant === "tertiary" ? colors.onTertiaryContainer : variant === "surface" ? colors.onSurface : void 0;
|
|
1017
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native_paper12.Chip, { ...defaults.Chip, selectedColor: selectedColor ?? variantSelectedColor, ...props, style: [variantStyle, style] });
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
// src/components/FAB.tsx
|
|
1021
|
+
var import_react_native_paper13 = require("react-native-paper");
|
|
1022
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1023
|
+
function FAB(props) {
|
|
1024
|
+
const defaults = usePaperDefaults();
|
|
1025
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native_paper13.FAB, { ...defaults.FAB, ...props });
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
// src/components/IconButton.tsx
|
|
1029
|
+
var import_react_native_paper14 = require("react-native-paper");
|
|
1027
1030
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1028
|
-
|
|
1031
|
+
function IconButton({ variant, iconColor, containerColor, ...props }) {
|
|
1029
1032
|
const defaults = usePaperDefaults();
|
|
1030
|
-
|
|
1033
|
+
const { colors } = (0, import_react_native_paper14.useTheme)();
|
|
1034
|
+
const variantContainerColor = variant === "primary" ? colors.primaryContainer : variant === "secondary" ? colors.secondaryContainer : variant === "tertiary" ? colors.tertiaryContainer : variant === "surface" ? colors.surface : void 0;
|
|
1035
|
+
const variantIconColor = variant === "primary" ? colors.onPrimaryContainer : variant === "secondary" ? colors.onSecondaryContainer : variant === "tertiary" ? colors.onTertiaryContainer : variant === "surface" ? colors.onSurface : void 0;
|
|
1036
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native_paper14.IconButton, { ...defaults.IconButton, containerColor: containerColor ?? variantContainerColor, iconColor: iconColor ?? variantIconColor, ...props });
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
// src/components/Menu.tsx
|
|
1040
|
+
var import_react_native9 = require("react-native");
|
|
1041
|
+
var import_react_native_paper15 = require("react-native-paper");
|
|
1042
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1043
|
+
var MenuComponent = ({ blur: blurProp, children, ...props }) => {
|
|
1044
|
+
const blur = useBlur(blurProp);
|
|
1045
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_native_paper15.Menu, { ...props, contentStyle: [styles5.content, props.contentStyle], children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(BlurView, { blur, children }) });
|
|
1046
|
+
};
|
|
1047
|
+
var Menu = Object.assign(MenuComponent, {
|
|
1048
|
+
Item: import_react_native_paper15.Menu.Item
|
|
1049
|
+
});
|
|
1050
|
+
var styles5 = import_react_native9.StyleSheet.create({
|
|
1051
|
+
content: { backgroundColor: "transparent", paddingVertical: 0 }
|
|
1052
|
+
});
|
|
1053
|
+
|
|
1054
|
+
// src/components/TextInput.tsx
|
|
1055
|
+
var import_react13 = require("react");
|
|
1056
|
+
var import_react_native_paper16 = require("react-native-paper");
|
|
1057
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1058
|
+
var TextInput = (0, import_react13.forwardRef)(function TextInput2(props, ref) {
|
|
1059
|
+
const defaults = usePaperDefaults();
|
|
1060
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper16.TextInput, { ref, ...defaults.TextInput, ...props });
|
|
1031
1061
|
});
|
|
1032
1062
|
|
|
1033
1063
|
// src/redux/themeSlice.ts
|
|
@@ -1071,10 +1101,6 @@ var selectThemeHarmony = (state) => state.harmony;
|
|
|
1071
1101
|
var import_react_native_paper17 = require("react-native-paper");
|
|
1072
1102
|
var useAutoPaperTheme = () => (0, import_react_native_paper17.useTheme)();
|
|
1073
1103
|
|
|
1074
|
-
// src/useThemeSettings.ts
|
|
1075
|
-
var import_react13 = require("react");
|
|
1076
|
-
var useThemeSettings = () => (0, import_react13.useContext)(ThemeSettingsContext);
|
|
1077
|
-
|
|
1078
1104
|
// src/utils/getThirdColor.ts
|
|
1079
1105
|
function rgbToHsl(r, g, b) {
|
|
1080
1106
|
r /= 255;
|
|
@@ -1160,6 +1186,8 @@ var getTintTextColor = (tintColor, backdropColor, tintOpacity) => {
|
|
|
1160
1186
|
0 && (module.exports = {
|
|
1161
1187
|
Appbar,
|
|
1162
1188
|
AppearancePicker,
|
|
1189
|
+
AutoAppearancePicker,
|
|
1190
|
+
AutoPalettePicker,
|
|
1163
1191
|
BlurView,
|
|
1164
1192
|
BottomNavigation,
|
|
1165
1193
|
Button,
|
|
@@ -1188,6 +1216,7 @@ var getTintTextColor = (tintColor, backdropColor, tintOpacity) => {
|
|
|
1188
1216
|
getTonalColor,
|
|
1189
1217
|
getTriadicPalette,
|
|
1190
1218
|
isDarkColor,
|
|
1219
|
+
resolveSeedColor,
|
|
1191
1220
|
selectThemeAppearance,
|
|
1192
1221
|
selectThemeBlur,
|
|
1193
1222
|
selectThemeColor,
|