@rific/auto-paper 0.9.3 → 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 +29 -2
- package/dist/index.d.mts +49 -34
- package/dist/index.d.ts +49 -34
- package/dist/index.js +320 -295
- package/dist/index.mjs +291 -269
- package/package.json +1 -1
- package/src/components/AutoAppearancePicker.tsx +17 -0
- package/src/components/AutoPalettePicker.tsx +21 -0
- 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,42 +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
|
|
862
|
+
var import_react_native_paper8 = require("react-native-paper");
|
|
863
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
904
864
|
var HARMONIES = [
|
|
905
865
|
{ label: "Triadic", value: "triadic", icon: "triangle-outline" },
|
|
906
866
|
{ label: "Split", value: "split-complementary", icon: "arrow-split-vertical" },
|
|
@@ -910,8 +870,8 @@ var HARMONIES = [
|
|
|
910
870
|
{ label: "Dbl Split", value: "double-split", icon: "arrow-expand-horizontal" }
|
|
911
871
|
];
|
|
912
872
|
var COMPACT_MIN_WIDTH = 0;
|
|
913
|
-
var HarmonyPicker = ({ value, onChange, showLabels = true, checkedColor, uncheckedColor, checkedContainerColor, uncheckedContainerColor }) => /* @__PURE__ */ (0,
|
|
914
|
-
|
|
873
|
+
var HarmonyPicker = ({ value, onChange, showLabels = true, checkedColor, uncheckedColor, checkedContainerColor, uncheckedContainerColor }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
874
|
+
import_react_native_paper8.SegmentedButtons,
|
|
915
875
|
{
|
|
916
876
|
value,
|
|
917
877
|
onValueChange: (v) => onChange(v),
|
|
@@ -931,37 +891,8 @@ var HarmonyPicker = ({ value, onChange, showLabels = true, checkedColor, uncheck
|
|
|
931
891
|
}
|
|
932
892
|
);
|
|
933
893
|
|
|
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
894
|
// 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");
|
|
895
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
965
896
|
var SIZE2 = 48;
|
|
966
897
|
var defaultWeights = { primary: 2, secondary: 1, tertiary: 1 };
|
|
967
898
|
var buildWedges = (weights) => {
|
|
@@ -975,30 +906,30 @@ var buildWedges = (weights) => {
|
|
|
975
906
|
{ key: "secondary", rotate: primary / 2 + tertiary, share: secondary }
|
|
976
907
|
];
|
|
977
908
|
};
|
|
978
|
-
var Pie = ({ palette, weights = defaultWeights, size = SIZE2 }) => /* @__PURE__ */ (0,
|
|
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)) });
|
|
979
910
|
var PalettePicker = ({ value, onChange, harmony = "split-complementary", onHarmonyChange, weights, colors = defaultColors, blur: blurProp }) => {
|
|
980
911
|
const blur = useBlur(blurProp);
|
|
981
|
-
const { colors: themeColors } = (0,
|
|
912
|
+
const { colors: themeColors } = (0, import_react_native_paper9.useTheme)();
|
|
982
913
|
const [open, setOpen] = (0, import_react11.useState)(false);
|
|
983
914
|
const { onLayout, size } = useSwatchSize(SIZE2);
|
|
984
|
-
return /* @__PURE__ */ (0,
|
|
985
|
-
/* @__PURE__ */ (0,
|
|
986
|
-
/* @__PURE__ */ (0,
|
|
987
|
-
/* @__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) }) })
|
|
988
919
|
] }) }),
|
|
989
|
-
/* @__PURE__ */ (0,
|
|
990
|
-
onHarmonyChange && /* @__PURE__ */ (0,
|
|
991
|
-
/* @__PURE__ */ (0,
|
|
992
|
-
|
|
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,
|
|
993
924
|
{
|
|
994
925
|
onPress: () => {
|
|
995
926
|
onChange(hex);
|
|
996
927
|
setOpen(false);
|
|
997
928
|
},
|
|
998
|
-
style: [
|
|
929
|
+
style: [styles4.swatch, { height: size, width: size }],
|
|
999
930
|
children: [
|
|
1000
|
-
/* @__PURE__ */ (0,
|
|
1001
|
-
/* @__PURE__ */ (0,
|
|
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) }) })
|
|
1002
933
|
]
|
|
1003
934
|
},
|
|
1004
935
|
hex
|
|
@@ -1006,7 +937,7 @@ var PalettePicker = ({ value, onChange, harmony = "split-complementary", onHarmo
|
|
|
1006
937
|
] }) })
|
|
1007
938
|
] });
|
|
1008
939
|
};
|
|
1009
|
-
var
|
|
940
|
+
var styles4 = import_react_native7.StyleSheet.create({
|
|
1010
941
|
halfMask: { height: "100%", left: "50%", overflow: "hidden", position: "absolute", top: 0, width: "50%" },
|
|
1011
942
|
harmonyRow: { marginBottom: 4 },
|
|
1012
943
|
innerRotator: { height: "100%", left: "-100%", overflow: "hidden", position: "absolute", top: 0, width: "200%" },
|
|
@@ -1021,13 +952,108 @@ var styles5 = import_react_native9.StyleSheet.create({
|
|
|
1021
952
|
wedgeFill: { height: "100%", left: "50%", position: "absolute", top: 0, width: "50%" }
|
|
1022
953
|
});
|
|
1023
954
|
|
|
1024
|
-
// src/components/
|
|
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
|
|
1025
963
|
var import_react12 = require("react");
|
|
1026
|
-
var
|
|
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");
|
|
1027
1026
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1028
|
-
|
|
1027
|
+
function IconButton({ variant, iconColor, containerColor, ...props }) {
|
|
1029
1028
|
const defaults = usePaperDefaults();
|
|
1030
|
-
|
|
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
|
+
|
|
1050
|
+
// src/components/TextInput.tsx
|
|
1051
|
+
var import_react13 = require("react");
|
|
1052
|
+
var import_react_native_paper16 = require("react-native-paper");
|
|
1053
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1054
|
+
var TextInput = (0, import_react13.forwardRef)(function TextInput2(props, ref) {
|
|
1055
|
+
const defaults = usePaperDefaults();
|
|
1056
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper16.TextInput, { ref, ...defaults.TextInput, ...props });
|
|
1031
1057
|
});
|
|
1032
1058
|
|
|
1033
1059
|
// src/redux/themeSlice.ts
|
|
@@ -1071,10 +1097,6 @@ var selectThemeHarmony = (state) => state.harmony;
|
|
|
1071
1097
|
var import_react_native_paper17 = require("react-native-paper");
|
|
1072
1098
|
var useAutoPaperTheme = () => (0, import_react_native_paper17.useTheme)();
|
|
1073
1099
|
|
|
1074
|
-
// src/useThemeSettings.ts
|
|
1075
|
-
var import_react13 = require("react");
|
|
1076
|
-
var useThemeSettings = () => (0, import_react13.useContext)(ThemeSettingsContext);
|
|
1077
|
-
|
|
1078
1100
|
// src/utils/getThirdColor.ts
|
|
1079
1101
|
function rgbToHsl(r, g, b) {
|
|
1080
1102
|
r /= 255;
|
|
@@ -1160,6 +1182,8 @@ var getTintTextColor = (tintColor, backdropColor, tintOpacity) => {
|
|
|
1160
1182
|
0 && (module.exports = {
|
|
1161
1183
|
Appbar,
|
|
1162
1184
|
AppearancePicker,
|
|
1185
|
+
AutoAppearancePicker,
|
|
1186
|
+
AutoPalettePicker,
|
|
1163
1187
|
BlurView,
|
|
1164
1188
|
BottomNavigation,
|
|
1165
1189
|
Button,
|
|
@@ -1188,6 +1212,7 @@ var getTintTextColor = (tintColor, backdropColor, tintOpacity) => {
|
|
|
1188
1212
|
getTonalColor,
|
|
1189
1213
|
getTriadicPalette,
|
|
1190
1214
|
isDarkColor,
|
|
1215
|
+
resolveSeedColor,
|
|
1191
1216
|
selectThemeAppearance,
|
|
1192
1217
|
selectThemeBlur,
|
|
1193
1218
|
selectThemeColor,
|