@rific/auto-paper 0.9.2 → 0.9.4
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 +53 -4
- package/dist/index.d.mts +54 -34
- package/dist/index.d.ts +54 -34
- package/dist/index.js +350 -329
- package/dist/index.mjs +326 -308
- package/package.json +1 -1
- package/src/components/AutoAppearancePicker.tsx +17 -0
- package/src/components/AutoPalettePicker.tsx +21 -0
- package/src/components/HarmonyPicker.tsx +44 -34
- package/src/components/PalettePicker.tsx +14 -1
- package/src/index.ts +3 -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,39 @@ 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,
|
|
693
|
+
const onChangeRef = (0, import_react7.useRef)(onChange);
|
|
646
694
|
onChangeRef.current = onChange;
|
|
647
|
-
const prevSettings = (0,
|
|
648
|
-
(0,
|
|
695
|
+
const prevSettings = (0, import_react7.useRef)(settings);
|
|
696
|
+
(0, import_react7.useEffect)(() => {
|
|
649
697
|
if (prevSettings.current !== settings) {
|
|
650
698
|
prevSettings.current = settings;
|
|
651
699
|
onChangeRef.current?.(settings);
|
|
652
700
|
}
|
|
653
701
|
}, [settings]);
|
|
654
702
|
const theme = useComputedTheme(settings.appearance, settings.color, settings.harmony);
|
|
655
|
-
const called = (0,
|
|
656
|
-
(0,
|
|
703
|
+
const called = (0, import_react7.useRef)(false);
|
|
704
|
+
(0, import_react7.useEffect)(() => {
|
|
657
705
|
if (theme && !called.current) {
|
|
658
706
|
called.current = true;
|
|
659
707
|
onReady?.();
|
|
660
708
|
}
|
|
661
709
|
}, [theme, onReady]);
|
|
662
710
|
if (!theme) return null;
|
|
663
|
-
return /* @__PURE__ */ (0,
|
|
664
|
-
/* @__PURE__ */ (0,
|
|
665
|
-
/* @__PURE__ */ (0,
|
|
711
|
+
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: [
|
|
712
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native3.StatusBar, { backgroundColor: theme.colors.background, barStyle: theme.dark ? "light-content" : "dark-content", ...statusBarProps }),
|
|
713
|
+
/* @__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
714
|
] }) });
|
|
667
715
|
}
|
|
668
716
|
var styles = import_react_native3.StyleSheet.create({
|
|
@@ -670,132 +718,52 @@ var styles = import_react_native3.StyleSheet.create({
|
|
|
670
718
|
});
|
|
671
719
|
|
|
672
720
|
// src/components/BlurView.tsx
|
|
673
|
-
var
|
|
721
|
+
var import_react8 = require("react");
|
|
722
|
+
var import_react_native4 = require("react-native");
|
|
723
|
+
var import_react_native_paper5 = require("react-native-paper");
|
|
724
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
674
725
|
var ELEVATION_OPACITY = { 0: 0, 1: 0.05, 2: 0.08, 3: 0.11, 4: 0.12, 5: 0.14 };
|
|
675
726
|
var VARIANT_TINT_OPACITY = { light: 0.12, dark: 0.18 };
|
|
676
727
|
var BlurView = ({ blur = true, children, elevation, style, tintColor, tintOpacity, variant = "surface", ...props }) => {
|
|
677
728
|
const { dark, colors } = (0, import_react_native_paper5.useTheme)();
|
|
678
|
-
const { settings } = (0,
|
|
729
|
+
const { settings } = (0, import_react8.useContext)(ThemeSettingsContext);
|
|
679
730
|
const expoBlur = useBlurModule();
|
|
680
731
|
const surfaceColor = variant === "surfaceVariant" ? colors.surfaceVariant : colors.surface;
|
|
681
732
|
const variantColor = variant === "primary" ? colors.primary : variant === "secondary" ? colors.secondary : variant === "tertiary" ? colors.tertiary : variant === "error" ? colors.error : void 0;
|
|
682
733
|
const resolvedTintColor = tintColor ?? variantColor ?? (elevation !== void 0 ? colors.primary : void 0);
|
|
683
734
|
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,
|
|
735
|
+
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
736
|
if (blur && expoBlur)
|
|
686
|
-
return /* @__PURE__ */ (0,
|
|
687
|
-
/* @__PURE__ */ (0,
|
|
737
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(expoBlur.BlurView, { ...props, tint: dark ? "dark" : "light", style, children: [
|
|
738
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native4.View, { style: [import_react_native4.StyleSheet.absoluteFill, { backgroundColor: surfaceColor, opacity: settings.blurTint }] }),
|
|
688
739
|
tint,
|
|
689
740
|
children
|
|
690
741
|
] });
|
|
691
|
-
return /* @__PURE__ */ (0,
|
|
742
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react_native4.View, { ...props, style: [{ backgroundColor: surfaceColor }, style], children: [
|
|
692
743
|
tint,
|
|
693
744
|
children
|
|
694
745
|
] });
|
|
695
746
|
};
|
|
696
747
|
|
|
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
748
|
// 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");
|
|
749
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
782
750
|
var ANIMATION_DURATION = 220;
|
|
783
751
|
var DIALOG_MARGIN = 32;
|
|
784
752
|
function DialogComponent({ animatedStyle, blur: blurProp, dismissable = true, dismissableBackButton = dismissable, visible, onDismiss, children, style, testID = "dialog" }) {
|
|
785
753
|
const blur = useBlur(blurProp);
|
|
786
754
|
const reanimated = useReanimatedModule();
|
|
787
|
-
const theme = (0,
|
|
755
|
+
const theme = (0, import_react_native_paper6.useTheme)();
|
|
788
756
|
const { colors, isV3, roundness } = theme;
|
|
789
757
|
const { scale } = theme.animation;
|
|
790
758
|
const { bottom, left, right, top } = (0, import_react_native_safe_area_context.useSafeAreaInsets)();
|
|
791
|
-
const opacity = (0, import_react9.useRef)(new
|
|
759
|
+
const opacity = (0, import_react9.useRef)(new import_react_native5.Animated.Value(visible ? 1 : 0)).current;
|
|
792
760
|
const [mounted, setMounted] = (0, import_react9.useState)(visible);
|
|
793
761
|
(0, import_react9.useEffect)(() => {
|
|
794
762
|
if (visible) {
|
|
795
763
|
setMounted(true);
|
|
796
|
-
|
|
764
|
+
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
765
|
} else {
|
|
798
|
-
|
|
766
|
+
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
767
|
if (finished) setMounted(false);
|
|
800
768
|
});
|
|
801
769
|
}
|
|
@@ -806,7 +774,7 @@ function DialogComponent({ animatedStyle, blur: blurProp, dismissable = true, di
|
|
|
806
774
|
if (dismissable || dismissableBackButton) onDismiss?.();
|
|
807
775
|
return true;
|
|
808
776
|
};
|
|
809
|
-
const subscription =
|
|
777
|
+
const subscription = import_react_native5.BackHandler.addEventListener("hardwareBackPress", onHardwareBackPress);
|
|
810
778
|
return () => subscription.remove();
|
|
811
779
|
}, [dismissable, dismissableBackButton, onDismiss, visible]);
|
|
812
780
|
if (!mounted) return null;
|
|
@@ -816,30 +784,30 @@ function DialogComponent({ animatedStyle, blur: blurProp, dismissable = true, di
|
|
|
816
784
|
return import_react9.default.cloneElement(child, { style: [{ marginTop: 24 }, child.props.style] });
|
|
817
785
|
}
|
|
818
786
|
}
|
|
819
|
-
if (i === 0 && import_react9.default.isValidElement(child) && child.type ===
|
|
787
|
+
if (i === 0 && import_react9.default.isValidElement(child) && child.type === import_react_native_paper6.Dialog.Content) {
|
|
820
788
|
return import_react9.default.cloneElement(child, { style: [{ paddingTop: 24 }, child.props.style] });
|
|
821
789
|
}
|
|
822
790
|
return child;
|
|
823
791
|
});
|
|
824
792
|
const borderRadius = (isV3 ? 7 : 1) * roundness;
|
|
825
|
-
return /* @__PURE__ */ (0,
|
|
826
|
-
/* @__PURE__ */ (0,
|
|
827
|
-
/* @__PURE__ */ (0,
|
|
793
|
+
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: [
|
|
794
|
+
/* @__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` }),
|
|
795
|
+
/* @__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
796
|
] }) });
|
|
829
797
|
}
|
|
830
|
-
DialogComponent.Title =
|
|
831
|
-
DialogComponent.Content =
|
|
832
|
-
DialogComponent.Actions =
|
|
833
|
-
DialogComponent.ScrollArea =
|
|
798
|
+
DialogComponent.Title = import_react_native_paper6.Dialog.Title;
|
|
799
|
+
DialogComponent.Content = import_react_native_paper6.Dialog.Content;
|
|
800
|
+
DialogComponent.Actions = import_react_native_paper6.Dialog.Actions;
|
|
801
|
+
DialogComponent.ScrollArea = import_react_native_paper6.Dialog.ScrollArea;
|
|
834
802
|
var Dialog = DialogComponent;
|
|
835
|
-
var styles2 =
|
|
803
|
+
var styles2 = import_react_native5.StyleSheet.create({
|
|
836
804
|
// Width cap keeps dialogs card-sized on wide viewports (web/tablet); no effect on phones.
|
|
837
805
|
card: { alignSelf: "center", maxWidth: 400, overflow: "hidden", width: "100%" },
|
|
838
806
|
wrapper: { flex: 1, justifyContent: "center", paddingVertical: DIALOG_MARGIN }
|
|
839
807
|
});
|
|
840
808
|
|
|
841
809
|
// src/components/ColorPicker.tsx
|
|
842
|
-
var
|
|
810
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
843
811
|
var SIZE = 48;
|
|
844
812
|
var defaultColors = [
|
|
845
813
|
{ label: "Red", value: "#f44336" },
|
|
@@ -865,60 +833,34 @@ var defaultColors = [
|
|
|
865
833
|
];
|
|
866
834
|
var ColorPicker = ({ value, onChange, colors = defaultColors, blur: blurProp }) => {
|
|
867
835
|
const blur = useBlur(blurProp);
|
|
868
|
-
const { colors: themeColors } = (0,
|
|
836
|
+
const { colors: themeColors } = (0, import_react_native_paper7.useTheme)();
|
|
869
837
|
const [open, setOpen] = (0, import_react10.useState)(false);
|
|
870
838
|
const { onLayout, size } = useSwatchSize(SIZE);
|
|
871
|
-
return /* @__PURE__ */ (0,
|
|
872
|
-
/* @__PURE__ */ (0,
|
|
873
|
-
/* @__PURE__ */ (0,
|
|
874
|
-
|
|
839
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
840
|
+
/* @__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) }) }),
|
|
841
|
+
/* @__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)(
|
|
842
|
+
import_react_native6.TouchableOpacity,
|
|
875
843
|
{
|
|
876
844
|
onPress: () => {
|
|
877
845
|
onChange(hex);
|
|
878
846
|
setOpen(false);
|
|
879
847
|
},
|
|
880
848
|
style: [styles3.swatch, { backgroundColor: hex, borderRadius: size / 2, height: size, width: size }, getSwatchRing(hex, value === hex, themeColors.outlineVariant)],
|
|
881
|
-
children: value === hex && /* @__PURE__ */ (0,
|
|
849
|
+
children: value === hex && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native_paper7.Icon, { source: "check", size: 20, color: getContrastColor(hex) })
|
|
882
850
|
},
|
|
883
851
|
hex
|
|
884
852
|
)) }) }) })
|
|
885
853
|
] });
|
|
886
854
|
};
|
|
887
|
-
var styles3 =
|
|
855
|
+
var styles3 = import_react_native6.StyleSheet.create({
|
|
888
856
|
swatch: { alignItems: "center", justifyContent: "center" },
|
|
889
857
|
swatches: { flexDirection: "row", flexWrap: "wrap", gap: SWATCH_GRID_GAP, paddingTop: 12 },
|
|
890
858
|
trigger: { alignItems: "center", alignSelf: "flex-start", borderRadius: SIZE / 2, height: SIZE, justifyContent: "center", width: SIZE }
|
|
891
859
|
});
|
|
892
860
|
|
|
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
861
|
// src/components/HarmonyPicker.tsx
|
|
902
|
-
var
|
|
903
|
-
var
|
|
904
|
-
|
|
905
|
-
// src/components/Menu.tsx
|
|
906
|
-
var import_react_native8 = require("react-native");
|
|
907
|
-
var import_react_native_paper12 = require("react-native-paper");
|
|
908
|
-
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
909
|
-
var MenuComponent = ({ blur: blurProp, children, ...props }) => {
|
|
910
|
-
const blur = useBlur(blurProp);
|
|
911
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native_paper12.Menu, { ...props, contentStyle: [styles4.content, props.contentStyle], children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(BlurView, { blur, children }) });
|
|
912
|
-
};
|
|
913
|
-
var Menu = Object.assign(MenuComponent, {
|
|
914
|
-
Item: import_react_native_paper12.Menu.Item
|
|
915
|
-
});
|
|
916
|
-
var styles4 = import_react_native8.StyleSheet.create({
|
|
917
|
-
content: { backgroundColor: "transparent", paddingVertical: 0 }
|
|
918
|
-
});
|
|
919
|
-
|
|
920
|
-
// src/components/HarmonyPicker.tsx
|
|
921
|
-
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
862
|
+
var import_react_native_paper8 = require("react-native-paper");
|
|
863
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
922
864
|
var HARMONIES = [
|
|
923
865
|
{ label: "Triadic", value: "triadic", icon: "triangle-outline" },
|
|
924
866
|
{ label: "Split", value: "split-complementary", icon: "arrow-split-vertical" },
|
|
@@ -927,49 +869,30 @@ var HARMONIES = [
|
|
|
927
869
|
{ label: "Complement", value: "complementary", icon: "circle-half-full" },
|
|
928
870
|
{ label: "Dbl Split", value: "double-split", icon: "arrow-expand-horizontal" }
|
|
929
871
|
];
|
|
930
|
-
var
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
{
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
h.value
|
|
952
|
-
))
|
|
953
|
-
}
|
|
954
|
-
);
|
|
955
|
-
};
|
|
956
|
-
|
|
957
|
-
// src/components/IconButton.tsx
|
|
958
|
-
var import_react_native_paper14 = require("react-native-paper");
|
|
959
|
-
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
960
|
-
function IconButton({ variant, iconColor, containerColor, ...props }) {
|
|
961
|
-
const defaults = usePaperDefaults();
|
|
962
|
-
const { colors } = (0, import_react_native_paper14.useTheme)();
|
|
963
|
-
const variantContainerColor = variant === "primary" ? colors.primaryContainer : variant === "secondary" ? colors.secondaryContainer : variant === "tertiary" ? colors.tertiaryContainer : variant === "surface" ? colors.surface : void 0;
|
|
964
|
-
const variantIconColor = variant === "primary" ? colors.onPrimaryContainer : variant === "secondary" ? colors.onSecondaryContainer : variant === "tertiary" ? colors.onTertiaryContainer : variant === "surface" ? colors.onSurface : void 0;
|
|
965
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native_paper14.IconButton, { ...defaults.IconButton, containerColor: containerColor ?? variantContainerColor, iconColor: iconColor ?? variantIconColor, ...props });
|
|
966
|
-
}
|
|
872
|
+
var COMPACT_MIN_WIDTH = 0;
|
|
873
|
+
var HarmonyPicker = ({ value, onChange, showLabels = true, checkedColor, uncheckedColor, checkedContainerColor, uncheckedContainerColor }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
874
|
+
import_react_native_paper8.SegmentedButtons,
|
|
875
|
+
{
|
|
876
|
+
value,
|
|
877
|
+
onValueChange: (v) => onChange(v),
|
|
878
|
+
buttons: HARMONIES.map((h) => {
|
|
879
|
+
const checked = h.value === value;
|
|
880
|
+
const containerColor = checked ? checkedContainerColor : uncheckedContainerColor;
|
|
881
|
+
return {
|
|
882
|
+
value: h.value,
|
|
883
|
+
icon: h.icon,
|
|
884
|
+
label: showLabels ? h.label : void 0,
|
|
885
|
+
accessibilityLabel: h.label,
|
|
886
|
+
checkedColor,
|
|
887
|
+
uncheckedColor,
|
|
888
|
+
style: [showLabels ? void 0 : { minWidth: COMPACT_MIN_WIDTH }, containerColor ? { backgroundColor: containerColor } : void 0]
|
|
889
|
+
};
|
|
890
|
+
})
|
|
891
|
+
}
|
|
892
|
+
);
|
|
967
893
|
|
|
968
894
|
// src/components/PalettePicker.tsx
|
|
969
|
-
var
|
|
970
|
-
var import_react_native9 = require("react-native");
|
|
971
|
-
var import_react_native_paper15 = require("react-native-paper");
|
|
972
|
-
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
895
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
973
896
|
var SIZE2 = 48;
|
|
974
897
|
var defaultWeights = { primary: 2, secondary: 1, tertiary: 1 };
|
|
975
898
|
var buildWedges = (weights) => {
|
|
@@ -983,36 +906,40 @@ var buildWedges = (weights) => {
|
|
|
983
906
|
{ key: "secondary", rotate: primary / 2 + tertiary, share: secondary }
|
|
984
907
|
];
|
|
985
908
|
};
|
|
986
|
-
var Pie = ({ palette, weights = defaultWeights, size = SIZE2 }) => /* @__PURE__ */ (0,
|
|
987
|
-
var PalettePicker = ({ value, onChange, harmony = "split-complementary", weights, colors = defaultColors, blur: blurProp }) => {
|
|
909
|
+
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)) });
|
|
910
|
+
var PalettePicker = ({ value, onChange, harmony = "split-complementary", onHarmonyChange, weights, colors = defaultColors, blur: blurProp }) => {
|
|
988
911
|
const blur = useBlur(blurProp);
|
|
989
|
-
const { colors: themeColors } = (0,
|
|
990
|
-
const [open, setOpen] = (0,
|
|
912
|
+
const { colors: themeColors } = (0, import_react_native_paper9.useTheme)();
|
|
913
|
+
const [open, setOpen] = (0, import_react11.useState)(false);
|
|
991
914
|
const { onLayout, size } = useSwatchSize(SIZE2);
|
|
992
|
-
return /* @__PURE__ */ (0,
|
|
993
|
-
/* @__PURE__ */ (0,
|
|
994
|
-
/* @__PURE__ */ (0,
|
|
995
|
-
/* @__PURE__ */ (0,
|
|
915
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
916
|
+
/* @__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: [
|
|
917
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Pie, { palette: getTriadicPalette(value, harmony), weights }),
|
|
918
|
+
/* @__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) }) })
|
|
996
919
|
] }) }),
|
|
997
|
-
/* @__PURE__ */ (0,
|
|
998
|
-
|
|
999
|
-
{
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
920
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Dialog, { blur, visible: open, onDismiss: () => setOpen(false), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Dialog.Content, { children: [
|
|
921
|
+
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 }) }),
|
|
922
|
+
/* @__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)(
|
|
923
|
+
import_react_native7.TouchableOpacity,
|
|
924
|
+
{
|
|
925
|
+
onPress: () => {
|
|
926
|
+
onChange(hex);
|
|
927
|
+
setOpen(false);
|
|
928
|
+
},
|
|
929
|
+
style: [styles4.swatch, { height: size, width: size }],
|
|
930
|
+
children: [
|
|
931
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Pie, { palette: getTriadicPalette(hex, harmony), weights, size }),
|
|
932
|
+
/* @__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) }) })
|
|
933
|
+
]
|
|
1003
934
|
},
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native9.View, { pointerEvents: "none", style: [styles5.ring, { borderRadius: size / 2 }, getSwatchRing(hex, value === hex, themeColors.outlineVariant)], children: value === hex && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native_paper15.Icon, { source: "check", size: 20, color: getContrastColor(hex) }) })
|
|
1008
|
-
]
|
|
1009
|
-
},
|
|
1010
|
-
hex
|
|
1011
|
-
)) }) }) })
|
|
935
|
+
hex
|
|
936
|
+
)) })
|
|
937
|
+
] }) })
|
|
1012
938
|
] });
|
|
1013
939
|
};
|
|
1014
|
-
var
|
|
940
|
+
var styles4 = import_react_native7.StyleSheet.create({
|
|
1015
941
|
halfMask: { height: "100%", left: "50%", overflow: "hidden", position: "absolute", top: 0, width: "50%" },
|
|
942
|
+
harmonyRow: { marginBottom: 4 },
|
|
1016
943
|
innerRotator: { height: "100%", left: "-100%", overflow: "hidden", position: "absolute", top: 0, width: "200%" },
|
|
1017
944
|
pie: { overflow: "hidden" },
|
|
1018
945
|
rotator: { height: "100%", left: 0, overflow: "hidden", position: "absolute", top: 0, width: "100%" },
|
|
@@ -1025,13 +952,108 @@ var styles5 = import_react_native9.StyleSheet.create({
|
|
|
1025
952
|
wedgeFill: { height: "100%", left: "50%", position: "absolute", top: 0, width: "50%" }
|
|
1026
953
|
});
|
|
1027
954
|
|
|
955
|
+
// src/components/AutoPalettePicker.tsx
|
|
956
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
957
|
+
var AutoPalettePicker = (props) => {
|
|
958
|
+
const { settings, set } = useThemeSettings();
|
|
959
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PalettePicker, { ...props, value: resolveSeedColor(settings.color), onChange: (color) => set({ color }), harmony: settings.harmony, onHarmonyChange: (harmony) => set({ harmony }) });
|
|
960
|
+
};
|
|
961
|
+
|
|
962
|
+
// src/components/BottomNavigation.tsx
|
|
963
|
+
var import_react12 = require("react");
|
|
964
|
+
var import_react_native8 = require("react-native");
|
|
965
|
+
var import_react_native_paper10 = require("react-native-paper");
|
|
966
|
+
|
|
967
|
+
// src/navigation-bar.ts
|
|
968
|
+
var setNavigationBarStyle = (navigationBar, dark) => {
|
|
969
|
+
if (!navigationBar) return;
|
|
970
|
+
navigationBar.NavigationBar.setStyle(dark ? "light" : "dark");
|
|
971
|
+
};
|
|
972
|
+
|
|
973
|
+
// src/components/BottomNavigation.tsx
|
|
974
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
975
|
+
function useNavigationBarSync() {
|
|
976
|
+
const theme = (0, import_react_native_paper10.useTheme)();
|
|
977
|
+
const { navigationBar, onNavBarChange } = useNavBarContext();
|
|
978
|
+
(0, import_react12.useEffect)(() => {
|
|
979
|
+
if (import_react_native8.Platform.OS !== "android") return;
|
|
980
|
+
if (onNavBarChange) onNavBarChange(theme.colors.surface, theme.dark);
|
|
981
|
+
else if (navigationBar) setNavigationBarStyle(navigationBar, theme.dark);
|
|
982
|
+
}, [theme, onNavBarChange, navigationBar]);
|
|
983
|
+
}
|
|
984
|
+
function BottomNavigationComponent(props) {
|
|
985
|
+
const defaults = usePaperDefaults();
|
|
986
|
+
useNavigationBarSync();
|
|
987
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native_paper10.BottomNavigation, { ...defaults.BottomNavigation, ...props });
|
|
988
|
+
}
|
|
989
|
+
function Bar(props) {
|
|
990
|
+
useNavigationBarSync();
|
|
991
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native_paper10.BottomNavigation.Bar, { ...props });
|
|
992
|
+
}
|
|
993
|
+
BottomNavigationComponent.Bar = Bar;
|
|
994
|
+
BottomNavigationComponent.SceneMap = import_react_native_paper10.BottomNavigation?.SceneMap;
|
|
995
|
+
var BottomNavigation = BottomNavigationComponent;
|
|
996
|
+
|
|
997
|
+
// src/components/Button.tsx
|
|
998
|
+
var import_react_native_paper11 = require("react-native-paper");
|
|
999
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1000
|
+
function Button(props) {
|
|
1001
|
+
const defaults = usePaperDefaults();
|
|
1002
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native_paper11.Button, { ...defaults.Button, ...props });
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
// src/components/Chip.tsx
|
|
1006
|
+
var import_react_native_paper12 = require("react-native-paper");
|
|
1007
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1008
|
+
function Chip({ variant, style, selectedColor, ...props }) {
|
|
1009
|
+
const defaults = usePaperDefaults();
|
|
1010
|
+
const { colors } = (0, import_react_native_paper12.useTheme)();
|
|
1011
|
+
const variantStyle = variant === "primary" ? { backgroundColor: colors.primaryContainer } : variant === "secondary" ? { backgroundColor: colors.secondaryContainer } : variant === "tertiary" ? { backgroundColor: colors.tertiaryContainer } : variant === "surface" ? { backgroundColor: colors.surface } : void 0;
|
|
1012
|
+
const variantSelectedColor = variant === "primary" ? colors.onPrimaryContainer : variant === "secondary" ? colors.onSecondaryContainer : variant === "tertiary" ? colors.onTertiaryContainer : variant === "surface" ? colors.onSurface : void 0;
|
|
1013
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native_paper12.Chip, { ...defaults.Chip, selectedColor: selectedColor ?? variantSelectedColor, ...props, style: [variantStyle, style] });
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
// src/components/FAB.tsx
|
|
1017
|
+
var import_react_native_paper13 = require("react-native-paper");
|
|
1018
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1019
|
+
function FAB(props) {
|
|
1020
|
+
const defaults = usePaperDefaults();
|
|
1021
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native_paper13.FAB, { ...defaults.FAB, ...props });
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
// src/components/IconButton.tsx
|
|
1025
|
+
var import_react_native_paper14 = require("react-native-paper");
|
|
1026
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1027
|
+
function IconButton({ variant, iconColor, containerColor, ...props }) {
|
|
1028
|
+
const defaults = usePaperDefaults();
|
|
1029
|
+
const { colors } = (0, import_react_native_paper14.useTheme)();
|
|
1030
|
+
const variantContainerColor = variant === "primary" ? colors.primaryContainer : variant === "secondary" ? colors.secondaryContainer : variant === "tertiary" ? colors.tertiaryContainer : variant === "surface" ? colors.surface : void 0;
|
|
1031
|
+
const variantIconColor = variant === "primary" ? colors.onPrimaryContainer : variant === "secondary" ? colors.onSecondaryContainer : variant === "tertiary" ? colors.onTertiaryContainer : variant === "surface" ? colors.onSurface : void 0;
|
|
1032
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native_paper14.IconButton, { ...defaults.IconButton, containerColor: containerColor ?? variantContainerColor, iconColor: iconColor ?? variantIconColor, ...props });
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
// src/components/Menu.tsx
|
|
1036
|
+
var import_react_native9 = require("react-native");
|
|
1037
|
+
var import_react_native_paper15 = require("react-native-paper");
|
|
1038
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1039
|
+
var MenuComponent = ({ blur: blurProp, children, ...props }) => {
|
|
1040
|
+
const blur = useBlur(blurProp);
|
|
1041
|
+
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 }) });
|
|
1042
|
+
};
|
|
1043
|
+
var Menu = Object.assign(MenuComponent, {
|
|
1044
|
+
Item: import_react_native_paper15.Menu.Item
|
|
1045
|
+
});
|
|
1046
|
+
var styles5 = import_react_native9.StyleSheet.create({
|
|
1047
|
+
content: { backgroundColor: "transparent", paddingVertical: 0 }
|
|
1048
|
+
});
|
|
1049
|
+
|
|
1028
1050
|
// src/components/TextInput.tsx
|
|
1029
1051
|
var import_react13 = require("react");
|
|
1030
1052
|
var import_react_native_paper16 = require("react-native-paper");
|
|
1031
|
-
var
|
|
1053
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1032
1054
|
var TextInput = (0, import_react13.forwardRef)(function TextInput2(props, ref) {
|
|
1033
1055
|
const defaults = usePaperDefaults();
|
|
1034
|
-
return /* @__PURE__ */ (0,
|
|
1056
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper16.TextInput, { ref, ...defaults.TextInput, ...props });
|
|
1035
1057
|
});
|
|
1036
1058
|
|
|
1037
1059
|
// src/redux/themeSlice.ts
|
|
@@ -1075,10 +1097,6 @@ var selectThemeHarmony = (state) => state.harmony;
|
|
|
1075
1097
|
var import_react_native_paper17 = require("react-native-paper");
|
|
1076
1098
|
var useAutoPaperTheme = () => (0, import_react_native_paper17.useTheme)();
|
|
1077
1099
|
|
|
1078
|
-
// src/useThemeSettings.ts
|
|
1079
|
-
var import_react14 = require("react");
|
|
1080
|
-
var useThemeSettings = () => (0, import_react14.useContext)(ThemeSettingsContext);
|
|
1081
|
-
|
|
1082
1100
|
// src/utils/getThirdColor.ts
|
|
1083
1101
|
function rgbToHsl(r, g, b) {
|
|
1084
1102
|
r /= 255;
|
|
@@ -1164,6 +1182,8 @@ var getTintTextColor = (tintColor, backdropColor, tintOpacity) => {
|
|
|
1164
1182
|
0 && (module.exports = {
|
|
1165
1183
|
Appbar,
|
|
1166
1184
|
AppearancePicker,
|
|
1185
|
+
AutoAppearancePicker,
|
|
1186
|
+
AutoPalettePicker,
|
|
1167
1187
|
BlurView,
|
|
1168
1188
|
BottomNavigation,
|
|
1169
1189
|
Button,
|
|
@@ -1192,6 +1212,7 @@ var getTintTextColor = (tintColor, backdropColor, tintOpacity) => {
|
|
|
1192
1212
|
getTonalColor,
|
|
1193
1213
|
getTriadicPalette,
|
|
1194
1214
|
isDarkColor,
|
|
1215
|
+
resolveSeedColor,
|
|
1195
1216
|
selectThemeAppearance,
|
|
1196
1217
|
selectThemeBlur,
|
|
1197
1218
|
selectThemeColor,
|