@tastic/hud 0.27.1 → 0.29.0
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 +7 -3
- package/dist/chrome/index.d.mts +2 -1
- package/dist/chrome/index.d.ts +2 -1
- package/dist/chrome/index.js +30 -5
- package/dist/chrome/index.mjs +9 -9
- package/dist/{chunk-FOJLQMKA.mjs → chunk-5ECU3722.mjs} +22 -4
- package/dist/{chunk-JBE7IQC5.mjs → chunk-ACY6UK4V.mjs} +11 -4
- package/dist/{chunk-B2DSHZJT.mjs → chunk-CPNDNJJR.mjs} +27 -6
- package/dist/{index-1fnoSjO0.d.ts → index-B2sz-9jr.d.ts} +5 -2
- package/dist/{index-Bhu3I6FN.d.mts → index-BOMA2rLU.d.mts} +5 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +56 -10
- package/dist/index.mjs +17 -17
- package/dist/lobby/index.d.mts +1 -1
- package/dist/lobby/index.d.ts +1 -1
- package/dist/lobby/index.js +48 -9
- package/dist/lobby/index.mjs +2 -2
- package/package.json +7 -7
- package/src/BaseSettingsDialog.tsx +20 -1
- package/src/PlayerSetupPanel.tsx +5 -2
- package/src/PopoverBody.tsx +45 -16
- package/src/ReadyButton.tsx +42 -3
package/README.md
CHANGED
|
@@ -43,7 +43,10 @@ corner of the screen.
|
|
|
43
43
|
sits in (see `useAutoAlign`).
|
|
44
44
|
- **`TriggerGauge`**: decorative ring of tick marks around a trigger, showing which option(s) are
|
|
45
45
|
active without opening the popover.
|
|
46
|
-
- **`ReadyButton`**: a per-player or standalone ready toggle
|
|
46
|
+
- **`ReadyButton`**: a per-player or standalone ready toggle: an outline and mono label in the seat's
|
|
47
|
+
color until ready, then filled with it. Over a backdrop (a felt) pass `surfaceColor` (the theme's
|
|
48
|
+
surface) and `dark`: it is then a pill the size of `@tastic/profile`'s chip pill, its label black or
|
|
49
|
+
white in the theme's font, filled with the seat's color (its label in that color's own ink) once ready.
|
|
47
50
|
- **`PlayerSetupPanel`**: one panel per player slot in a local-multiplayer loadout/lobby screen: a
|
|
48
51
|
name header (a saved-profile switcher for a human seat, a CPU-difficulty `LabeledDropdown` for a
|
|
49
52
|
non-human one, or a plain label when neither applies), a color picker (`InlineColorPicker`)
|
|
@@ -51,12 +54,13 @@ corner of the screen.
|
|
|
51
54
|
Ported from five apps' own near-identical `PlayerSetupPanel.tsx`/`LobbyPlayerPanel.tsx`
|
|
52
55
|
(AirHockey, BoxHockey, Pong, LightCycles, Snake), which had all independently converged on this
|
|
53
56
|
exact skeleton. See "The secondPicker slot" below before wiring up that one prop.
|
|
54
|
-
|
|
57
|
+
Five optional props fit it to a host that draws on a backdrop (a felt) with muted profile colors,
|
|
55
58
|
each changing nothing when left unset: `nullLabel` (the no-profile row's label in the seat button's
|
|
56
59
|
dropdown, e.g. `'Guest'` beside a `'GUEST'` `guestLabel`), `previewValue` (how the seat's color is
|
|
57
60
|
drawn: the button's chip, its Color row and swatches, the fallback swatch, the plain label and the
|
|
58
61
|
Ready button, while `color` and what `onColorChange` receives stay the saved values), `triggerStyle`
|
|
59
|
-
(the seat button's trigger, e.g. a surface behind its pill)
|
|
62
|
+
(the seat button's trigger, e.g. a surface behind its pill), `readySurfaceColor` (the Ready button's
|
|
63
|
+
pill look, `ReadyButton`'s `surfaceColor`) and `useSeatPickerAlign` (a placement
|
|
60
64
|
hook of the host's own for the seat button's dropdown, in place of `useZoneClampedAlign`, for a
|
|
61
65
|
screen turned by a fake landscape; leave it unset inside a split-screen zone, and keep the same hook
|
|
62
66
|
for the panel's life).
|
package/dist/chrome/index.d.mts
CHANGED
|
@@ -62,8 +62,9 @@ interface BaseSettingsDialogProps {
|
|
|
62
62
|
onUpdateError?: (message: string) => void;
|
|
63
63
|
onShowHowToPlay?: () => void;
|
|
64
64
|
children?: ReactNode;
|
|
65
|
+
leading?: ReactNode;
|
|
65
66
|
}
|
|
66
|
-
declare function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, version, lockOrientation, onLockOrientationChange, deferBottomEdgeGestures, onDeferBottomEdgeGestures, hideSound, hideHaptics, hideAppearance, hideUpdateCheck, onUpdateError, onShowHowToPlay, children }: BaseSettingsDialogProps): react.JSX.Element | null;
|
|
67
|
+
declare function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, version, lockOrientation, onLockOrientationChange, deferBottomEdgeGestures, onDeferBottomEdgeGestures, hideSound, hideHaptics, hideAppearance, hideUpdateCheck, onUpdateError, onShowHowToPlay, children, leading }: BaseSettingsDialogProps): react.JSX.Element | null;
|
|
67
68
|
|
|
68
69
|
type MD3TextVariant = 'displayLarge' | 'displayMedium' | 'displaySmall' | 'headlineLarge' | 'headlineMedium' | 'headlineSmall' | 'titleLarge' | 'titleMedium' | 'titleSmall' | 'labelLarge' | 'labelMedium' | 'labelSmall' | 'bodyLarge' | 'bodyMedium' | 'bodySmall';
|
|
69
70
|
interface Props$7 {
|
package/dist/chrome/index.d.ts
CHANGED
|
@@ -62,8 +62,9 @@ interface BaseSettingsDialogProps {
|
|
|
62
62
|
onUpdateError?: (message: string) => void;
|
|
63
63
|
onShowHowToPlay?: () => void;
|
|
64
64
|
children?: ReactNode;
|
|
65
|
+
leading?: ReactNode;
|
|
65
66
|
}
|
|
66
|
-
declare function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, version, lockOrientation, onLockOrientationChange, deferBottomEdgeGestures, onDeferBottomEdgeGestures, hideSound, hideHaptics, hideAppearance, hideUpdateCheck, onUpdateError, onShowHowToPlay, children }: BaseSettingsDialogProps): react.JSX.Element | null;
|
|
67
|
+
declare function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, version, lockOrientation, onLockOrientationChange, deferBottomEdgeGestures, onDeferBottomEdgeGestures, hideSound, hideHaptics, hideAppearance, hideUpdateCheck, onUpdateError, onShowHowToPlay, children, leading }: BaseSettingsDialogProps): react.JSX.Element | null;
|
|
67
68
|
|
|
68
69
|
type MD3TextVariant = 'displayLarge' | 'displayMedium' | 'displaySmall' | 'headlineLarge' | 'headlineMedium' | 'headlineSmall' | 'titleLarge' | 'titleMedium' | 'titleSmall' | 'labelLarge' | 'labelMedium' | 'labelSmall' | 'bodyLarge' | 'bodyMedium' | 'bodySmall';
|
|
69
70
|
interface Props$7 {
|
package/dist/chrome/index.js
CHANGED
|
@@ -515,7 +515,7 @@ var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
|
515
515
|
function SettingIcon({ source, color, containerColor }) {
|
|
516
516
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native12.View, { style: [styles9.iconBadge, { backgroundColor: containerColor }], children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native_paper8.Icon, { source, size: 18, color }) });
|
|
517
517
|
}
|
|
518
|
-
function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, version, lockOrientation, onLockOrientationChange, deferBottomEdgeGestures, onDeferBottomEdgeGestures, hideSound = false, hideHaptics = false, hideAppearance = false, hideUpdateCheck = false, onUpdateError, onShowHowToPlay, children }) {
|
|
518
|
+
function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, version, lockOrientation, onLockOrientationChange, deferBottomEdgeGestures, onDeferBottomEdgeGestures, hideSound = false, hideHaptics = false, hideAppearance = false, hideUpdateCheck = false, onUpdateError, onShowHowToPlay, children, leading }) {
|
|
519
519
|
const { colors } = (0, import_auto_paper6.useAutoPaperTheme)();
|
|
520
520
|
const ambientRotation = (0, import_core5.useRotation)();
|
|
521
521
|
const rotation = rotationOverride ?? ambientRotation;
|
|
@@ -553,13 +553,16 @@ function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, ve
|
|
|
553
553
|
const showAppearance = !hideAppearance;
|
|
554
554
|
const showBlur = showAppearance && import_react_native12.Platform.OS !== "android" && expoBlur !== void 0 && expoBlur !== null;
|
|
555
555
|
const showUpdateCheck = import_react_native12.Platform.OS !== "web" && !hideUpdateCheck;
|
|
556
|
+
const hasLeading = leading !== void 0 && leading !== null && leading !== false;
|
|
556
557
|
if (!opened) return null;
|
|
557
558
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native_paper8.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(RotatedFrame, { rotation, rotatedSafeArea: true, portalHost: true, passThrough: true, children: [
|
|
558
559
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_auto_paper6.Dialog, { visible, onDismiss, style: [styles9.dialog, { width: sheetWidth }], children: [
|
|
559
560
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_auto_paper6.Dialog.ScrollArea, { style: styles9.scrollArea, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_auto_paper6.FadingScrollView, { contentContainerStyle: styles9.scrollContent, showsVerticalScrollIndicator: false, children: [
|
|
560
561
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DialogHeader, { icon: "cog", title: "Settings", compact: compactHeader }),
|
|
561
562
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react_native12.View, { style: styles9.content, children: [
|
|
563
|
+
hasLeading && leading,
|
|
562
564
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react_native12.View, { style: styles9.toggleGroup, children: [
|
|
565
|
+
hasLeading && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native_paper8.Text, { variant: "labelMedium", style: [styles9.sectionLabel, styles9.toggleGroupLabel, { color: colors.onSurfaceVariant }], children: "GENERAL" }),
|
|
563
566
|
showLockOrientation && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_feedback_press3.TouchableRipple, { onPress: () => onLockOrientationChange(!lockOrientation), style: styles9.toggleButton, accessibilityLabel: `Lock orientation ${lockOrientation ? "on" : "off"}`, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react_native12.View, { style: styles9.toggleContent, children: [
|
|
564
567
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SettingIcon, { source: lockOrientation ? "lock" : "lock-open-variant-outline", color: lockOrientation ? colors.tertiary : colors.onSurfaceVariant, containerColor: lockOrientation ? colors.tertiaryContainer : colors.surfaceVariant }),
|
|
565
568
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react_native12.View, { style: styles9.flexShrink, children: [
|
|
@@ -741,6 +744,10 @@ var styles9 = import_react_native12.StyleSheet.create({
|
|
|
741
744
|
toggleGroup: {
|
|
742
745
|
gap: 4
|
|
743
746
|
},
|
|
747
|
+
// The 12pt a section's label sits above its rows (styles.section), less the group's own 4pt gap.
|
|
748
|
+
toggleGroupLabel: {
|
|
749
|
+
marginBottom: 8
|
|
750
|
+
},
|
|
744
751
|
// No horizontal margin of its own now either - see toggleButton's identical note.
|
|
745
752
|
toggleRow: {
|
|
746
753
|
flexDirection: "row",
|
|
@@ -889,13 +896,13 @@ function PopoverBody({ visible, children, align = "center", verticalAlign = "bel
|
|
|
889
896
|
const caretFill = above ? "borderTopColor" : "borderBottomColor";
|
|
890
897
|
const caretWidthProp = above ? "borderTopWidth" : "borderBottomWidth";
|
|
891
898
|
const caretEdge = (size) => above ? { bottom: -size + CARET_DIP } : { top: -size + CARET_DIP };
|
|
892
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native16.View, { style: [styles13.content, alignStyle, verticalStyle], children: [
|
|
899
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native16.View, { style: [styles13.edge, above ? styles13.edgeTop : styles13.edgeBottom], children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native16.View, { style: [styles13.content, alignStyle, verticalStyle], children: [
|
|
893
900
|
children,
|
|
894
901
|
caretColor && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
895
902
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native16.View, { style: [styles13.caret, caretOffset(ringSize), caretEdge(ringSize), { [caretFill]: caretBorderColor ?? caretColor, [caretWidthProp]: ringSize, borderLeftWidth: ringSize, borderRightWidth: ringSize }] }),
|
|
896
903
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native16.View, { style: [styles13.caret, caretOffset(CARET_SIZE), caretEdge(CARET_SIZE - CARET_RING_OFFSET), { [caretFill]: caretColor, [caretWidthProp]: CARET_SIZE, borderLeftWidth: CARET_SIZE, borderRightWidth: CARET_SIZE }] })
|
|
897
904
|
] })
|
|
898
|
-
] });
|
|
905
|
+
] }) });
|
|
899
906
|
}
|
|
900
907
|
var styles13 = import_react_native16.StyleSheet.create({
|
|
901
908
|
caret: {
|
|
@@ -914,13 +921,15 @@ var styles13 = import_react_native16.StyleSheet.create({
|
|
|
914
921
|
position: "absolute",
|
|
915
922
|
zIndex: 50
|
|
916
923
|
},
|
|
924
|
+
// The strip's bottom edge, which is the trigger's top: the box grows up from it.
|
|
917
925
|
contentAbove: {
|
|
918
|
-
bottom:
|
|
926
|
+
bottom: 0,
|
|
919
927
|
marginBottom: 8
|
|
920
928
|
},
|
|
929
|
+
// The strip's top edge, which is the trigger's bottom: the box grows down from it.
|
|
921
930
|
contentBelow: {
|
|
922
931
|
marginTop: 8,
|
|
923
|
-
top:
|
|
932
|
+
top: 0
|
|
924
933
|
},
|
|
925
934
|
// Stretched to the anchor's own (trigger) width, with alignItems centering the actual (usually
|
|
926
935
|
// much wider) popover box inside via plain flexbox - not `left:'50%'` plus a percentage
|
|
@@ -936,6 +945,22 @@ var styles13 = import_react_native16.StyleSheet.create({
|
|
|
936
945
|
},
|
|
937
946
|
contentRight: {
|
|
938
947
|
right: 0
|
|
948
|
+
},
|
|
949
|
+
// The zero-height strip the box hangs off, spanning the trigger's wrapper (see PopoverBody's
|
|
950
|
+
// comment for why it isn't a percentage inset). Its zIndex matches the box's, so on the web, where
|
|
951
|
+
// every positioned view is its own stacking context, the box still paints over later siblings.
|
|
952
|
+
edge: {
|
|
953
|
+
height: 0,
|
|
954
|
+
left: 0,
|
|
955
|
+
position: "absolute",
|
|
956
|
+
right: 0,
|
|
957
|
+
zIndex: 50
|
|
958
|
+
},
|
|
959
|
+
edgeBottom: {
|
|
960
|
+
bottom: 0
|
|
961
|
+
},
|
|
962
|
+
edgeTop: {
|
|
963
|
+
top: 0
|
|
939
964
|
}
|
|
940
965
|
});
|
|
941
966
|
|
package/dist/chrome/index.mjs
CHANGED
|
@@ -18,15 +18,7 @@ import {
|
|
|
18
18
|
getStaggeredWordDuration,
|
|
19
19
|
useCompactDialog,
|
|
20
20
|
useWellColors
|
|
21
|
-
} from "../chunk-
|
|
22
|
-
import {
|
|
23
|
-
InlineColorPicker,
|
|
24
|
-
MONO_FONT,
|
|
25
|
-
PopoverBody,
|
|
26
|
-
getInlineColorPickerContentSize,
|
|
27
|
-
useAutoAlign,
|
|
28
|
-
usePopoverHost
|
|
29
|
-
} from "../chunk-FOJLQMKA.mjs";
|
|
21
|
+
} from "../chunk-ACY6UK4V.mjs";
|
|
30
22
|
import {
|
|
31
23
|
COMPACT_DIALOG_HEIGHT,
|
|
32
24
|
DialogHeader,
|
|
@@ -38,6 +30,14 @@ import {
|
|
|
38
30
|
overlayStyles,
|
|
39
31
|
useOverlayCardColors
|
|
40
32
|
} from "../chunk-CBH7GQKI.mjs";
|
|
33
|
+
import {
|
|
34
|
+
InlineColorPicker,
|
|
35
|
+
MONO_FONT,
|
|
36
|
+
PopoverBody,
|
|
37
|
+
getInlineColorPickerContentSize,
|
|
38
|
+
useAutoAlign,
|
|
39
|
+
usePopoverHost
|
|
40
|
+
} from "../chunk-5ECU3722.mjs";
|
|
41
41
|
export {
|
|
42
42
|
AchievementCatalogSection,
|
|
43
43
|
AchievementRow,
|
|
@@ -18,13 +18,13 @@ function PopoverBody({ visible, children, align = "center", verticalAlign = "bel
|
|
|
18
18
|
const caretFill = above ? "borderTopColor" : "borderBottomColor";
|
|
19
19
|
const caretWidthProp = above ? "borderTopWidth" : "borderBottomWidth";
|
|
20
20
|
const caretEdge = (size) => above ? { bottom: -size + CARET_DIP } : { top: -size + CARET_DIP };
|
|
21
|
-
return /* @__PURE__ */ jsxs(View, { style: [styles.content, alignStyle, verticalStyle], children: [
|
|
21
|
+
return /* @__PURE__ */ jsx(View, { style: [styles.edge, above ? styles.edgeTop : styles.edgeBottom], children: /* @__PURE__ */ jsxs(View, { style: [styles.content, alignStyle, verticalStyle], children: [
|
|
22
22
|
children,
|
|
23
23
|
caretColor && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
24
24
|
/* @__PURE__ */ jsx(View, { style: [styles.caret, caretOffset(ringSize), caretEdge(ringSize), { [caretFill]: caretBorderColor ?? caretColor, [caretWidthProp]: ringSize, borderLeftWidth: ringSize, borderRightWidth: ringSize }] }),
|
|
25
25
|
/* @__PURE__ */ jsx(View, { style: [styles.caret, caretOffset(CARET_SIZE), caretEdge(CARET_SIZE - CARET_RING_OFFSET), { [caretFill]: caretColor, [caretWidthProp]: CARET_SIZE, borderLeftWidth: CARET_SIZE, borderRightWidth: CARET_SIZE }] })
|
|
26
26
|
] })
|
|
27
|
-
] });
|
|
27
|
+
] }) });
|
|
28
28
|
}
|
|
29
29
|
var styles = StyleSheet.create({
|
|
30
30
|
caret: {
|
|
@@ -43,13 +43,15 @@ var styles = StyleSheet.create({
|
|
|
43
43
|
position: "absolute",
|
|
44
44
|
zIndex: 50
|
|
45
45
|
},
|
|
46
|
+
// The strip's bottom edge, which is the trigger's top: the box grows up from it.
|
|
46
47
|
contentAbove: {
|
|
47
|
-
bottom:
|
|
48
|
+
bottom: 0,
|
|
48
49
|
marginBottom: 8
|
|
49
50
|
},
|
|
51
|
+
// The strip's top edge, which is the trigger's bottom: the box grows down from it.
|
|
50
52
|
contentBelow: {
|
|
51
53
|
marginTop: 8,
|
|
52
|
-
top:
|
|
54
|
+
top: 0
|
|
53
55
|
},
|
|
54
56
|
// Stretched to the anchor's own (trigger) width, with alignItems centering the actual (usually
|
|
55
57
|
// much wider) popover box inside via plain flexbox - not `left:'50%'` plus a percentage
|
|
@@ -65,6 +67,22 @@ var styles = StyleSheet.create({
|
|
|
65
67
|
},
|
|
66
68
|
contentRight: {
|
|
67
69
|
right: 0
|
|
70
|
+
},
|
|
71
|
+
// The zero-height strip the box hangs off, spanning the trigger's wrapper (see PopoverBody's
|
|
72
|
+
// comment for why it isn't a percentage inset). Its zIndex matches the box's, so on the web, where
|
|
73
|
+
// every positioned view is its own stacking context, the box still paints over later siblings.
|
|
74
|
+
edge: {
|
|
75
|
+
height: 0,
|
|
76
|
+
left: 0,
|
|
77
|
+
position: "absolute",
|
|
78
|
+
right: 0,
|
|
79
|
+
zIndex: 50
|
|
80
|
+
},
|
|
81
|
+
edgeBottom: {
|
|
82
|
+
bottom: 0
|
|
83
|
+
},
|
|
84
|
+
edgeTop: {
|
|
85
|
+
top: 0
|
|
68
86
|
}
|
|
69
87
|
});
|
|
70
88
|
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
MONO_FONT
|
|
3
|
-
} from "./chunk-FOJLQMKA.mjs";
|
|
4
1
|
import {
|
|
5
2
|
DialogHeader,
|
|
6
3
|
OverlayBackdrop,
|
|
@@ -11,6 +8,9 @@ import {
|
|
|
11
8
|
overlayStyles,
|
|
12
9
|
useOverlayCardColors
|
|
13
10
|
} from "./chunk-CBH7GQKI.mjs";
|
|
11
|
+
import {
|
|
12
|
+
MONO_FONT
|
|
13
|
+
} from "./chunk-5ECU3722.mjs";
|
|
14
14
|
|
|
15
15
|
// src/wellSurface.ts
|
|
16
16
|
import { useAutoPaperTheme } from "@rific/auto-paper";
|
|
@@ -315,7 +315,7 @@ import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
|
315
315
|
function SettingIcon({ source, color, containerColor }) {
|
|
316
316
|
return /* @__PURE__ */ jsx8(View6, { style: [styles7.iconBadge, { backgroundColor: containerColor }], children: /* @__PURE__ */ jsx8(Icon2, { source, size: 18, color }) });
|
|
317
317
|
}
|
|
318
|
-
function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, version, lockOrientation, onLockOrientationChange, deferBottomEdgeGestures, onDeferBottomEdgeGestures, hideSound = false, hideHaptics = false, hideAppearance = false, hideUpdateCheck = false, onUpdateError, onShowHowToPlay, children }) {
|
|
318
|
+
function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, version, lockOrientation, onLockOrientationChange, deferBottomEdgeGestures, onDeferBottomEdgeGestures, hideSound = false, hideHaptics = false, hideAppearance = false, hideUpdateCheck = false, onUpdateError, onShowHowToPlay, children, leading }) {
|
|
319
319
|
const { colors } = useAutoPaperTheme4();
|
|
320
320
|
const ambientRotation = useRotation2();
|
|
321
321
|
const rotation = rotationOverride ?? ambientRotation;
|
|
@@ -353,13 +353,16 @@ function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, ve
|
|
|
353
353
|
const showAppearance = !hideAppearance;
|
|
354
354
|
const showBlur = showAppearance && Platform.OS !== "android" && expoBlur !== void 0 && expoBlur !== null;
|
|
355
355
|
const showUpdateCheck = Platform.OS !== "web" && !hideUpdateCheck;
|
|
356
|
+
const hasLeading = leading !== void 0 && leading !== null && leading !== false;
|
|
356
357
|
if (!opened) return null;
|
|
357
358
|
return /* @__PURE__ */ jsx8(Portal3, { children: /* @__PURE__ */ jsxs7(RotatedFrame, { rotation, rotatedSafeArea: true, portalHost: true, passThrough: true, children: [
|
|
358
359
|
/* @__PURE__ */ jsxs7(Dialog, { visible, onDismiss, style: [styles7.dialog, { width: sheetWidth }], children: [
|
|
359
360
|
/* @__PURE__ */ jsx8(Dialog.ScrollArea, { style: styles7.scrollArea, children: /* @__PURE__ */ jsxs7(FadingScrollView, { contentContainerStyle: styles7.scrollContent, showsVerticalScrollIndicator: false, children: [
|
|
360
361
|
/* @__PURE__ */ jsx8(DialogHeader, { icon: "cog", title: "Settings", compact: compactHeader }),
|
|
361
362
|
/* @__PURE__ */ jsxs7(View6, { style: styles7.content, children: [
|
|
363
|
+
hasLeading && leading,
|
|
362
364
|
/* @__PURE__ */ jsxs7(View6, { style: styles7.toggleGroup, children: [
|
|
365
|
+
hasLeading && /* @__PURE__ */ jsx8(Text6, { variant: "labelMedium", style: [styles7.sectionLabel, styles7.toggleGroupLabel, { color: colors.onSurfaceVariant }], children: "GENERAL" }),
|
|
363
366
|
showLockOrientation && /* @__PURE__ */ jsx8(TouchableRipple, { onPress: () => onLockOrientationChange(!lockOrientation), style: styles7.toggleButton, accessibilityLabel: `Lock orientation ${lockOrientation ? "on" : "off"}`, children: /* @__PURE__ */ jsxs7(View6, { style: styles7.toggleContent, children: [
|
|
364
367
|
/* @__PURE__ */ jsx8(SettingIcon, { source: lockOrientation ? "lock" : "lock-open-variant-outline", color: lockOrientation ? colors.tertiary : colors.onSurfaceVariant, containerColor: lockOrientation ? colors.tertiaryContainer : colors.surfaceVariant }),
|
|
365
368
|
/* @__PURE__ */ jsxs7(View6, { style: styles7.flexShrink, children: [
|
|
@@ -541,6 +544,10 @@ var styles7 = StyleSheet7.create({
|
|
|
541
544
|
toggleGroup: {
|
|
542
545
|
gap: 4
|
|
543
546
|
},
|
|
547
|
+
// The 12pt a section's label sits above its rows (styles.section), less the group's own 4pt gap.
|
|
548
|
+
toggleGroupLabel: {
|
|
549
|
+
marginBottom: 8
|
|
550
|
+
},
|
|
544
551
|
// No horizontal margin of its own now either - see toggleButton's identical note.
|
|
545
552
|
toggleRow: {
|
|
546
553
|
flexDirection: "row",
|
|
@@ -3,20 +3,41 @@ import {
|
|
|
3
3
|
MONO_FONT,
|
|
4
4
|
useAutoAlign,
|
|
5
5
|
usePopoverHost
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-5ECU3722.mjs";
|
|
7
7
|
|
|
8
8
|
// src/ReadyButton.tsx
|
|
9
|
+
import { getTintTextColor } from "@rific/auto-paper";
|
|
9
10
|
import { TouchableRipple } from "@rific/feedback-press";
|
|
10
11
|
import { StyleSheet } from "react-native";
|
|
11
12
|
import { Text } from "react-native-paper";
|
|
12
13
|
import { jsx } from "react/jsx-runtime";
|
|
13
|
-
|
|
14
|
+
var PILL_HEIGHT = 44;
|
|
15
|
+
function ReadyButton({ color, ready, onToggleReady, style, labelFontFamily, surfaceColor, dark = false }) {
|
|
16
|
+
const label = ready ? "READY \u2713" : "READY?";
|
|
17
|
+
if (surfaceColor) {
|
|
18
|
+
const pillStyle = [styles.pill, { backgroundColor: ready ? color : surfaceColor }, style];
|
|
19
|
+
const pillLabelColor = ready ? getTintTextColor(color, color, 1) : dark ? "#FFFFFF" : "#000000";
|
|
20
|
+
return /* @__PURE__ */ jsx(TouchableRipple, { onPress: onToggleReady, borderless: true, style: pillStyle, accessibilityRole: "button", accessibilityLabel: label, children: /* @__PURE__ */ jsx(Text, { style: [styles.pillLabel, { color: pillLabelColor }, labelFontFamily ? { fontFamily: labelFontFamily } : null], children: label }) });
|
|
21
|
+
}
|
|
14
22
|
const readyButtonStyle = [styles.readyButton, { borderColor: color }, ready && { backgroundColor: color }, style];
|
|
15
|
-
const labelTextStyle = { fontFamily: labelFontFamily, fontWeight: "bold" };
|
|
23
|
+
const labelTextStyle = { fontFamily: labelFontFamily ?? MONO_FONT, fontWeight: "bold" };
|
|
16
24
|
const labelColorStyle = { color: ready ? "#000000" : color };
|
|
17
|
-
return /* @__PURE__ */ jsx(TouchableRipple, { onPress: onToggleReady, borderless: true, style: readyButtonStyle, children: /* @__PURE__ */ jsx(Text, { variant: "labelLarge", style: [labelTextStyle, labelColorStyle], children:
|
|
25
|
+
return /* @__PURE__ */ jsx(TouchableRipple, { onPress: onToggleReady, borderless: true, style: readyButtonStyle, children: /* @__PURE__ */ jsx(Text, { variant: "labelLarge", style: [labelTextStyle, labelColorStyle], children: label }) });
|
|
18
26
|
}
|
|
19
27
|
var styles = StyleSheet.create({
|
|
28
|
+
pill: {
|
|
29
|
+
alignItems: "center",
|
|
30
|
+
borderRadius: PILL_HEIGHT / 2,
|
|
31
|
+
height: PILL_HEIGHT,
|
|
32
|
+
justifyContent: "center",
|
|
33
|
+
minWidth: 120,
|
|
34
|
+
paddingHorizontal: 20
|
|
35
|
+
},
|
|
36
|
+
pillLabel: {
|
|
37
|
+
fontSize: 13,
|
|
38
|
+
fontWeight: "700",
|
|
39
|
+
letterSpacing: 1
|
|
40
|
+
},
|
|
20
41
|
readyButton: {
|
|
21
42
|
alignItems: "center",
|
|
22
43
|
borderRadius: 12,
|
|
@@ -81,7 +102,7 @@ function getProfilePopoverId(idPrefix) {
|
|
|
81
102
|
function getCpuDifficultyPopoverId(idPrefix) {
|
|
82
103
|
return `${idPrefix}-difficulty`;
|
|
83
104
|
}
|
|
84
|
-
function PlayerSetupPanel({ idPrefix, host, label, labelFontFamily, color, onColorChange, swatches, takenColor, allowSwapTaken, colorCaption, showColor = true, colorAlignOverride, colorRotation, isHuman, secondPicker, secondPickerId, ready, onToggleReady, dark, showReadyButton = true, profiles, selectedProfileId, takenProfileId, guestLabel, nullLabel, onProfileSelect, onManageProfiles, cpuDifficulty, cpuDifficultyOptions, onCpuDifficultyChange, humanIcon = "face-man", cpuIcon = "robot", previewValue, triggerStyle, useSeatPickerAlign }) {
|
|
105
|
+
function PlayerSetupPanel({ idPrefix, host, label, labelFontFamily, color, onColorChange, swatches, takenColor, allowSwapTaken, colorCaption, showColor = true, colorAlignOverride, colorRotation, isHuman, secondPicker, secondPickerId, ready, onToggleReady, dark, showReadyButton = true, profiles, selectedProfileId, takenProfileId, guestLabel, nullLabel, onProfileSelect, onManageProfiles, cpuDifficulty, cpuDifficultyOptions, onCpuDifficultyChange, humanIcon = "face-man", cpuIcon = "robot", previewValue, triggerStyle, readySurfaceColor, useSeatPickerAlign }) {
|
|
85
106
|
const ownHost = usePopoverHost();
|
|
86
107
|
const popover = host ?? ownHost;
|
|
87
108
|
const ownPopoverOpen = popover.openId?.startsWith(`${idPrefix}-`) ?? false;
|
|
@@ -102,7 +123,7 @@ function PlayerSetupPanel({ idPrefix, host, label, labelFontFamily, color, onCol
|
|
|
102
123
|
!seatButton && /* @__PURE__ */ jsx2(InlineColorPicker, { id: getColorPopoverId(idPrefix), host: popover, value: color, onChange: onColorChange, swatches, takenValue: takenColor, allowSwapTaken, previewValue, alignOverride: colorAlignOverride, rotation: colorRotation, dark, tag: isHuman ? selectedProfile?.tag : void 0, icon: isHuman ? humanIcon : cpuIcon }),
|
|
103
124
|
secondPicker
|
|
104
125
|
] }),
|
|
105
|
-
isHuman && showReadyButton && onToggleReady && /* @__PURE__ */ jsx2(ReadyButton, { color: drawn, ready: ready ?? false, onToggleReady })
|
|
126
|
+
isHuman && showReadyButton && onToggleReady && /* @__PURE__ */ jsx2(ReadyButton, { color: drawn, ready: ready ?? false, onToggleReady, surfaceColor: readySurfaceColor, dark })
|
|
106
127
|
] });
|
|
107
128
|
}
|
|
108
129
|
var styles2 = StyleSheet2.create({
|
|
@@ -71,9 +71,10 @@ interface PlayerSetupPanelProps<C extends string = string> {
|
|
|
71
71
|
cpuIcon?: string;
|
|
72
72
|
previewValue?: (hex: string) => string;
|
|
73
73
|
triggerStyle?: StyleProp<ViewStyle>;
|
|
74
|
+
readySurfaceColor?: string;
|
|
74
75
|
useSeatPickerAlign?: (open: boolean, contentWidth: number, contentHeight: number) => AlignResult;
|
|
75
76
|
}
|
|
76
|
-
declare function PlayerSetupPanel<C extends string = string>({ idPrefix, host, label, labelFontFamily, color, onColorChange, swatches, takenColor, allowSwapTaken, colorCaption, showColor, colorAlignOverride, colorRotation, isHuman, secondPicker, secondPickerId, ready, onToggleReady, dark, showReadyButton, profiles, selectedProfileId, takenProfileId, guestLabel, nullLabel, onProfileSelect, onManageProfiles, cpuDifficulty, cpuDifficultyOptions, onCpuDifficultyChange, humanIcon, cpuIcon, previewValue, triggerStyle, useSeatPickerAlign }: PlayerSetupPanelProps<C>): react.JSX.Element;
|
|
77
|
+
declare function PlayerSetupPanel<C extends string = string>({ idPrefix, host, label, labelFontFamily, color, onColorChange, swatches, takenColor, allowSwapTaken, colorCaption, showColor, colorAlignOverride, colorRotation, isHuman, secondPicker, secondPickerId, ready, onToggleReady, dark, showReadyButton, profiles, selectedProfileId, takenProfileId, guestLabel, nullLabel, onProfileSelect, onManageProfiles, cpuDifficulty, cpuDifficultyOptions, onCpuDifficultyChange, humanIcon, cpuIcon, previewValue, triggerStyle, readySurfaceColor, useSeatPickerAlign }: PlayerSetupPanelProps<C>): react.JSX.Element;
|
|
77
78
|
|
|
78
79
|
interface Props$1 {
|
|
79
80
|
color: string;
|
|
@@ -81,8 +82,10 @@ interface Props$1 {
|
|
|
81
82
|
onToggleReady: () => void;
|
|
82
83
|
style?: StyleProp<ViewStyle>;
|
|
83
84
|
labelFontFamily?: string;
|
|
85
|
+
surfaceColor?: string;
|
|
86
|
+
dark?: boolean;
|
|
84
87
|
}
|
|
85
|
-
declare function ReadyButton({ color, ready, onToggleReady, style, labelFontFamily }: Props$1): react.JSX.Element;
|
|
88
|
+
declare function ReadyButton({ color, ready, onToggleReady, style, labelFontFamily, surfaceColor, dark }: Props$1): react.JSX.Element;
|
|
86
89
|
|
|
87
90
|
interface Props {
|
|
88
91
|
onBack: () => void;
|
|
@@ -71,9 +71,10 @@ interface PlayerSetupPanelProps<C extends string = string> {
|
|
|
71
71
|
cpuIcon?: string;
|
|
72
72
|
previewValue?: (hex: string) => string;
|
|
73
73
|
triggerStyle?: StyleProp<ViewStyle>;
|
|
74
|
+
readySurfaceColor?: string;
|
|
74
75
|
useSeatPickerAlign?: (open: boolean, contentWidth: number, contentHeight: number) => AlignResult;
|
|
75
76
|
}
|
|
76
|
-
declare function PlayerSetupPanel<C extends string = string>({ idPrefix, host, label, labelFontFamily, color, onColorChange, swatches, takenColor, allowSwapTaken, colorCaption, showColor, colorAlignOverride, colorRotation, isHuman, secondPicker, secondPickerId, ready, onToggleReady, dark, showReadyButton, profiles, selectedProfileId, takenProfileId, guestLabel, nullLabel, onProfileSelect, onManageProfiles, cpuDifficulty, cpuDifficultyOptions, onCpuDifficultyChange, humanIcon, cpuIcon, previewValue, triggerStyle, useSeatPickerAlign }: PlayerSetupPanelProps<C>): react.JSX.Element;
|
|
77
|
+
declare function PlayerSetupPanel<C extends string = string>({ idPrefix, host, label, labelFontFamily, color, onColorChange, swatches, takenColor, allowSwapTaken, colorCaption, showColor, colorAlignOverride, colorRotation, isHuman, secondPicker, secondPickerId, ready, onToggleReady, dark, showReadyButton, profiles, selectedProfileId, takenProfileId, guestLabel, nullLabel, onProfileSelect, onManageProfiles, cpuDifficulty, cpuDifficultyOptions, onCpuDifficultyChange, humanIcon, cpuIcon, previewValue, triggerStyle, readySurfaceColor, useSeatPickerAlign }: PlayerSetupPanelProps<C>): react.JSX.Element;
|
|
77
78
|
|
|
78
79
|
interface Props$1 {
|
|
79
80
|
color: string;
|
|
@@ -81,8 +82,10 @@ interface Props$1 {
|
|
|
81
82
|
onToggleReady: () => void;
|
|
82
83
|
style?: StyleProp<ViewStyle>;
|
|
83
84
|
labelFontFamily?: string;
|
|
85
|
+
surfaceColor?: string;
|
|
86
|
+
dark?: boolean;
|
|
84
87
|
}
|
|
85
|
-
declare function ReadyButton({ color, ready, onToggleReady, style, labelFontFamily }: Props$1): react.JSX.Element;
|
|
88
|
+
declare function ReadyButton({ color, ready, onToggleReady, style, labelFontFamily, surfaceColor, dark }: Props$1): react.JSX.Element;
|
|
86
89
|
|
|
87
90
|
interface Props {
|
|
88
91
|
onBack: () => void;
|
package/dist/index.d.mts
CHANGED
|
@@ -3,8 +3,8 @@ import * as react from 'react';
|
|
|
3
3
|
import { AchievementTier } from '@tastic/achievements';
|
|
4
4
|
import { Profile } from '@tastic/profile';
|
|
5
5
|
import { ViewStyle } from 'react-native';
|
|
6
|
-
import { M as MenuOption } from './index-
|
|
7
|
-
export { L as LABELED_DROPDOWN_POPOVER_WIDTH, a as LabeledDropdown, b as LabeledDropdownOption, P as PlayerSetupPanel, c as PlayerSetupPanelProps, R as ReadyButton, S as SharedActionBand, g as getColorPopoverId, d as getCpuDifficultyPopoverId, e as getLabeledDropdownContentHeight, f as getProfilePopoverId, u as useZoneClampedAlign } from './index-
|
|
6
|
+
import { M as MenuOption } from './index-BOMA2rLU.mjs';
|
|
7
|
+
export { L as LABELED_DROPDOWN_POPOVER_WIDTH, a as LabeledDropdown, b as LabeledDropdownOption, P as PlayerSetupPanel, c as PlayerSetupPanelProps, R as ReadyButton, S as SharedActionBand, g as getColorPopoverId, d as getCpuDifficultyPopoverId, e as getLabeledDropdownContentHeight, f as getProfilePopoverId, u as useZoneClampedAlign } from './index-BOMA2rLU.mjs';
|
|
8
8
|
import { P as PopoverHost, A as AlignResult, a as PopoverRotation } from './usePopoverHost-T8QWb2_A.mjs';
|
|
9
9
|
export { b as PopoverAlign, c as PopoverVerticalAlign, V as ViewInstance, u as useAutoAlign, d as usePopoverHost } from './usePopoverHost-T8QWb2_A.mjs';
|
|
10
10
|
export { loadSkiaWeb, locateSkiaWebFile } from './skia/index.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import * as react from 'react';
|
|
|
3
3
|
import { AchievementTier } from '@tastic/achievements';
|
|
4
4
|
import { Profile } from '@tastic/profile';
|
|
5
5
|
import { ViewStyle } from 'react-native';
|
|
6
|
-
import { M as MenuOption } from './index-
|
|
7
|
-
export { L as LABELED_DROPDOWN_POPOVER_WIDTH, a as LabeledDropdown, b as LabeledDropdownOption, P as PlayerSetupPanel, c as PlayerSetupPanelProps, R as ReadyButton, S as SharedActionBand, g as getColorPopoverId, d as getCpuDifficultyPopoverId, e as getLabeledDropdownContentHeight, f as getProfilePopoverId, u as useZoneClampedAlign } from './index-
|
|
6
|
+
import { M as MenuOption } from './index-B2sz-9jr.js';
|
|
7
|
+
export { L as LABELED_DROPDOWN_POPOVER_WIDTH, a as LabeledDropdown, b as LabeledDropdownOption, P as PlayerSetupPanel, c as PlayerSetupPanelProps, R as ReadyButton, S as SharedActionBand, g as getColorPopoverId, d as getCpuDifficultyPopoverId, e as getLabeledDropdownContentHeight, f as getProfilePopoverId, u as useZoneClampedAlign } from './index-B2sz-9jr.js';
|
|
8
8
|
import { P as PopoverHost, A as AlignResult, a as PopoverRotation } from './usePopoverHost-T8QWb2_A.js';
|
|
9
9
|
export { b as PopoverAlign, c as PopoverVerticalAlign, V as ViewInstance, u as useAutoAlign, d as usePopoverHost } from './usePopoverHost-T8QWb2_A.js';
|
|
10
10
|
export { loadSkiaWeb, locateSkiaWebFile } from './skia/index.js';
|
package/dist/index.js
CHANGED
|
@@ -714,7 +714,7 @@ var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
|
714
714
|
function SettingIcon({ source, color, containerColor }) {
|
|
715
715
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native13.View, { style: [styles10.iconBadge, { backgroundColor: containerColor }], children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native_paper9.Icon, { source, size: 18, color }) });
|
|
716
716
|
}
|
|
717
|
-
function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, version, lockOrientation, onLockOrientationChange, deferBottomEdgeGestures, onDeferBottomEdgeGestures, hideSound = false, hideHaptics = false, hideAppearance = false, hideUpdateCheck = false, onUpdateError, onShowHowToPlay, children }) {
|
|
717
|
+
function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, version, lockOrientation, onLockOrientationChange, deferBottomEdgeGestures, onDeferBottomEdgeGestures, hideSound = false, hideHaptics = false, hideAppearance = false, hideUpdateCheck = false, onUpdateError, onShowHowToPlay, children, leading }) {
|
|
718
718
|
const { colors } = (0, import_auto_paper7.useAutoPaperTheme)();
|
|
719
719
|
const ambientRotation = (0, import_core5.useRotation)();
|
|
720
720
|
const rotation = rotationOverride ?? ambientRotation;
|
|
@@ -752,13 +752,16 @@ function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, ve
|
|
|
752
752
|
const showAppearance = !hideAppearance;
|
|
753
753
|
const showBlur = showAppearance && import_react_native13.Platform.OS !== "android" && expoBlur !== void 0 && expoBlur !== null;
|
|
754
754
|
const showUpdateCheck = import_react_native13.Platform.OS !== "web" && !hideUpdateCheck;
|
|
755
|
+
const hasLeading = leading !== void 0 && leading !== null && leading !== false;
|
|
755
756
|
if (!opened) return null;
|
|
756
757
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native_paper9.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(RotatedFrame, { rotation, rotatedSafeArea: true, portalHost: true, passThrough: true, children: [
|
|
757
758
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_auto_paper7.Dialog, { visible, onDismiss, style: [styles10.dialog, { width: sheetWidth }], children: [
|
|
758
759
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_auto_paper7.Dialog.ScrollArea, { style: styles10.scrollArea, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_auto_paper7.FadingScrollView, { contentContainerStyle: styles10.scrollContent, showsVerticalScrollIndicator: false, children: [
|
|
759
760
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DialogHeader, { icon: "cog", title: "Settings", compact: compactHeader }),
|
|
760
761
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react_native13.View, { style: styles10.content, children: [
|
|
762
|
+
hasLeading && leading,
|
|
761
763
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react_native13.View, { style: styles10.toggleGroup, children: [
|
|
764
|
+
hasLeading && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native_paper9.Text, { variant: "labelMedium", style: [styles10.sectionLabel, styles10.toggleGroupLabel, { color: colors.onSurfaceVariant }], children: "GENERAL" }),
|
|
762
765
|
showLockOrientation && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_feedback_press3.TouchableRipple, { onPress: () => onLockOrientationChange(!lockOrientation), style: styles10.toggleButton, accessibilityLabel: `Lock orientation ${lockOrientation ? "on" : "off"}`, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react_native13.View, { style: styles10.toggleContent, children: [
|
|
763
766
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SettingIcon, { source: lockOrientation ? "lock" : "lock-open-variant-outline", color: lockOrientation ? colors.tertiary : colors.onSurfaceVariant, containerColor: lockOrientation ? colors.tertiaryContainer : colors.surfaceVariant }),
|
|
764
767
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react_native13.View, { style: styles10.flexShrink, children: [
|
|
@@ -940,6 +943,10 @@ var styles10 = import_react_native13.StyleSheet.create({
|
|
|
940
943
|
toggleGroup: {
|
|
941
944
|
gap: 4
|
|
942
945
|
},
|
|
946
|
+
// The 12pt a section's label sits above its rows (styles.section), less the group's own 4pt gap.
|
|
947
|
+
toggleGroupLabel: {
|
|
948
|
+
marginBottom: 8
|
|
949
|
+
},
|
|
943
950
|
// No horizontal margin of its own now either - see toggleButton's identical note.
|
|
944
951
|
toggleRow: {
|
|
945
952
|
flexDirection: "row",
|
|
@@ -1073,13 +1080,13 @@ function PopoverBody({ visible, children, align = "center", verticalAlign = "bel
|
|
|
1073
1080
|
const caretFill = above ? "borderTopColor" : "borderBottomColor";
|
|
1074
1081
|
const caretWidthProp = above ? "borderTopWidth" : "borderBottomWidth";
|
|
1075
1082
|
const caretEdge = (size) => above ? { bottom: -size + CARET_DIP } : { top: -size + CARET_DIP };
|
|
1076
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native16.View, { style: [styles13.content, alignStyle, verticalStyle], children: [
|
|
1083
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native16.View, { style: [styles13.edge, above ? styles13.edgeTop : styles13.edgeBottom], children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native16.View, { style: [styles13.content, alignStyle, verticalStyle], children: [
|
|
1077
1084
|
children,
|
|
1078
1085
|
caretColor && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
1079
1086
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native16.View, { style: [styles13.caret, caretOffset(ringSize), caretEdge(ringSize), { [caretFill]: caretBorderColor ?? caretColor, [caretWidthProp]: ringSize, borderLeftWidth: ringSize, borderRightWidth: ringSize }] }),
|
|
1080
1087
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native16.View, { style: [styles13.caret, caretOffset(CARET_SIZE), caretEdge(CARET_SIZE - CARET_RING_OFFSET), { [caretFill]: caretColor, [caretWidthProp]: CARET_SIZE, borderLeftWidth: CARET_SIZE, borderRightWidth: CARET_SIZE }] })
|
|
1081
1088
|
] })
|
|
1082
|
-
] });
|
|
1089
|
+
] }) });
|
|
1083
1090
|
}
|
|
1084
1091
|
var styles13 = import_react_native16.StyleSheet.create({
|
|
1085
1092
|
caret: {
|
|
@@ -1098,13 +1105,15 @@ var styles13 = import_react_native16.StyleSheet.create({
|
|
|
1098
1105
|
position: "absolute",
|
|
1099
1106
|
zIndex: 50
|
|
1100
1107
|
},
|
|
1108
|
+
// The strip's bottom edge, which is the trigger's top: the box grows up from it.
|
|
1101
1109
|
contentAbove: {
|
|
1102
|
-
bottom:
|
|
1110
|
+
bottom: 0,
|
|
1103
1111
|
marginBottom: 8
|
|
1104
1112
|
},
|
|
1113
|
+
// The strip's top edge, which is the trigger's bottom: the box grows down from it.
|
|
1105
1114
|
contentBelow: {
|
|
1106
1115
|
marginTop: 8,
|
|
1107
|
-
top:
|
|
1116
|
+
top: 0
|
|
1108
1117
|
},
|
|
1109
1118
|
// Stretched to the anchor's own (trigger) width, with alignItems centering the actual (usually
|
|
1110
1119
|
// much wider) popover box inside via plain flexbox - not `left:'50%'` plus a percentage
|
|
@@ -1120,6 +1129,22 @@ var styles13 = import_react_native16.StyleSheet.create({
|
|
|
1120
1129
|
},
|
|
1121
1130
|
contentRight: {
|
|
1122
1131
|
right: 0
|
|
1132
|
+
},
|
|
1133
|
+
// The zero-height strip the box hangs off, spanning the trigger's wrapper (see PopoverBody's
|
|
1134
|
+
// comment for why it isn't a percentage inset). Its zIndex matches the box's, so on the web, where
|
|
1135
|
+
// every positioned view is its own stacking context, the box still paints over later siblings.
|
|
1136
|
+
edge: {
|
|
1137
|
+
height: 0,
|
|
1138
|
+
left: 0,
|
|
1139
|
+
position: "absolute",
|
|
1140
|
+
right: 0,
|
|
1141
|
+
zIndex: 50
|
|
1142
|
+
},
|
|
1143
|
+
edgeBottom: {
|
|
1144
|
+
bottom: 0
|
|
1145
|
+
},
|
|
1146
|
+
edgeTop: {
|
|
1147
|
+
top: 0
|
|
1123
1148
|
}
|
|
1124
1149
|
});
|
|
1125
1150
|
|
|
@@ -1727,17 +1752,38 @@ var import_react_native27 = require("react-native");
|
|
|
1727
1752
|
var import_react_native_paper16 = require("react-native-paper");
|
|
1728
1753
|
|
|
1729
1754
|
// src/ReadyButton.tsx
|
|
1755
|
+
var import_auto_paper12 = require("@rific/auto-paper");
|
|
1730
1756
|
var import_feedback_press9 = require("@rific/feedback-press");
|
|
1731
1757
|
var import_react_native25 = require("react-native");
|
|
1732
1758
|
var import_react_native_paper15 = require("react-native-paper");
|
|
1733
1759
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1734
|
-
|
|
1760
|
+
var PILL_HEIGHT = 44;
|
|
1761
|
+
function ReadyButton({ color, ready, onToggleReady, style, labelFontFamily, surfaceColor, dark = false }) {
|
|
1762
|
+
const label = ready ? "READY \u2713" : "READY?";
|
|
1763
|
+
if (surfaceColor) {
|
|
1764
|
+
const pillStyle = [styles20.pill, { backgroundColor: ready ? color : surfaceColor }, style];
|
|
1765
|
+
const pillLabelColor = ready ? (0, import_auto_paper12.getTintTextColor)(color, color, 1) : dark ? "#FFFFFF" : "#000000";
|
|
1766
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_feedback_press9.TouchableRipple, { onPress: onToggleReady, borderless: true, style: pillStyle, accessibilityRole: "button", accessibilityLabel: label, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react_native_paper15.Text, { style: [styles20.pillLabel, { color: pillLabelColor }, labelFontFamily ? { fontFamily: labelFontFamily } : null], children: label }) });
|
|
1767
|
+
}
|
|
1735
1768
|
const readyButtonStyle = [styles20.readyButton, { borderColor: color }, ready && { backgroundColor: color }, style];
|
|
1736
|
-
const labelTextStyle = { fontFamily: labelFontFamily, fontWeight: "bold" };
|
|
1769
|
+
const labelTextStyle = { fontFamily: labelFontFamily ?? MONO_FONT, fontWeight: "bold" };
|
|
1737
1770
|
const labelColorStyle = { color: ready ? "#000000" : color };
|
|
1738
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_feedback_press9.TouchableRipple, { onPress: onToggleReady, borderless: true, style: readyButtonStyle, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react_native_paper15.Text, { variant: "labelLarge", style: [labelTextStyle, labelColorStyle], children:
|
|
1771
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_feedback_press9.TouchableRipple, { onPress: onToggleReady, borderless: true, style: readyButtonStyle, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react_native_paper15.Text, { variant: "labelLarge", style: [labelTextStyle, labelColorStyle], children: label }) });
|
|
1739
1772
|
}
|
|
1740
1773
|
var styles20 = import_react_native25.StyleSheet.create({
|
|
1774
|
+
pill: {
|
|
1775
|
+
alignItems: "center",
|
|
1776
|
+
borderRadius: PILL_HEIGHT / 2,
|
|
1777
|
+
height: PILL_HEIGHT,
|
|
1778
|
+
justifyContent: "center",
|
|
1779
|
+
minWidth: 120,
|
|
1780
|
+
paddingHorizontal: 20
|
|
1781
|
+
},
|
|
1782
|
+
pillLabel: {
|
|
1783
|
+
fontSize: 13,
|
|
1784
|
+
fontWeight: "700",
|
|
1785
|
+
letterSpacing: 1
|
|
1786
|
+
},
|
|
1741
1787
|
readyButton: {
|
|
1742
1788
|
alignItems: "center",
|
|
1743
1789
|
borderRadius: 12,
|
|
@@ -1810,7 +1856,7 @@ function getProfilePopoverId(idPrefix) {
|
|
|
1810
1856
|
function getCpuDifficultyPopoverId(idPrefix) {
|
|
1811
1857
|
return `${idPrefix}-difficulty`;
|
|
1812
1858
|
}
|
|
1813
|
-
function PlayerSetupPanel({ idPrefix, host, label, labelFontFamily, color, onColorChange, swatches, takenColor, allowSwapTaken, colorCaption, showColor = true, colorAlignOverride, colorRotation, isHuman, secondPicker, secondPickerId, ready, onToggleReady, dark, showReadyButton = true, profiles, selectedProfileId, takenProfileId, guestLabel, nullLabel, onProfileSelect, onManageProfiles, cpuDifficulty, cpuDifficultyOptions, onCpuDifficultyChange, humanIcon = "face-man", cpuIcon = "robot", previewValue, triggerStyle, useSeatPickerAlign }) {
|
|
1859
|
+
function PlayerSetupPanel({ idPrefix, host, label, labelFontFamily, color, onColorChange, swatches, takenColor, allowSwapTaken, colorCaption, showColor = true, colorAlignOverride, colorRotation, isHuman, secondPicker, secondPickerId, ready, onToggleReady, dark, showReadyButton = true, profiles, selectedProfileId, takenProfileId, guestLabel, nullLabel, onProfileSelect, onManageProfiles, cpuDifficulty, cpuDifficultyOptions, onCpuDifficultyChange, humanIcon = "face-man", cpuIcon = "robot", previewValue, triggerStyle, readySurfaceColor, useSeatPickerAlign }) {
|
|
1814
1860
|
const ownHost = usePopoverHost();
|
|
1815
1861
|
const popover = host ?? ownHost;
|
|
1816
1862
|
const ownPopoverOpen = popover.openId?.startsWith(`${idPrefix}-`) ?? false;
|
|
@@ -1831,7 +1877,7 @@ function PlayerSetupPanel({ idPrefix, host, label, labelFontFamily, color, onCol
|
|
|
1831
1877
|
!seatButton && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(InlineColorPicker, { id: getColorPopoverId(idPrefix), host: popover, value: color, onChange: onColorChange, swatches, takenValue: takenColor, allowSwapTaken, previewValue, alignOverride: colorAlignOverride, rotation: colorRotation, dark, tag: isHuman ? selectedProfile?.tag : void 0, icon: isHuman ? humanIcon : cpuIcon }),
|
|
1832
1878
|
secondPicker
|
|
1833
1879
|
] }),
|
|
1834
|
-
isHuman && showReadyButton && onToggleReady && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ReadyButton, { color: drawn, ready: ready ?? false, onToggleReady })
|
|
1880
|
+
isHuman && showReadyButton && onToggleReady && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ReadyButton, { color: drawn, ready: ready ?? false, onToggleReady, surfaceColor: readySurfaceColor, dark })
|
|
1835
1881
|
] });
|
|
1836
1882
|
}
|
|
1837
1883
|
var styles21 = import_react_native27.StyleSheet.create({
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
loadSkiaWeb,
|
|
3
|
+
locateSkiaWebFile
|
|
4
|
+
} from "./chunk-3TCJHMJP.mjs";
|
|
1
5
|
import {
|
|
2
6
|
AchievementCatalogSection,
|
|
3
7
|
AchievementRow,
|
|
@@ -18,11 +22,18 @@ import {
|
|
|
18
22
|
getStaggeredWordDuration,
|
|
19
23
|
useCompactDialog,
|
|
20
24
|
useWellColors
|
|
21
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-ACY6UK4V.mjs";
|
|
22
26
|
import {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
COMPACT_DIALOG_HEIGHT,
|
|
28
|
+
DialogHeader,
|
|
29
|
+
OverlayBackdrop,
|
|
30
|
+
OverlayCard,
|
|
31
|
+
SecondaryButton,
|
|
32
|
+
isCompactDialogHeight,
|
|
33
|
+
overlayActionStyles,
|
|
34
|
+
overlayStyles,
|
|
35
|
+
useOverlayCardColors
|
|
36
|
+
} from "./chunk-CBH7GQKI.mjs";
|
|
26
37
|
import {
|
|
27
38
|
PlayerSetupPanel,
|
|
28
39
|
ReadyButton,
|
|
@@ -31,7 +42,7 @@ import {
|
|
|
31
42
|
getCpuDifficultyPopoverId,
|
|
32
43
|
getProfilePopoverId,
|
|
33
44
|
useZoneClampedAlign
|
|
34
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-CPNDNJJR.mjs";
|
|
35
46
|
import {
|
|
36
47
|
InlineColorPicker,
|
|
37
48
|
MONO_FONT,
|
|
@@ -39,18 +50,7 @@ import {
|
|
|
39
50
|
getInlineColorPickerContentSize,
|
|
40
51
|
useAutoAlign,
|
|
41
52
|
usePopoverHost
|
|
42
|
-
} from "./chunk-
|
|
43
|
-
import {
|
|
44
|
-
COMPACT_DIALOG_HEIGHT,
|
|
45
|
-
DialogHeader,
|
|
46
|
-
OverlayBackdrop,
|
|
47
|
-
OverlayCard,
|
|
48
|
-
SecondaryButton,
|
|
49
|
-
isCompactDialogHeight,
|
|
50
|
-
overlayActionStyles,
|
|
51
|
-
overlayStyles,
|
|
52
|
-
useOverlayCardColors
|
|
53
|
-
} from "./chunk-CBH7GQKI.mjs";
|
|
53
|
+
} from "./chunk-5ECU3722.mjs";
|
|
54
54
|
|
|
55
55
|
// src/AchievementUnlockList.tsx
|
|
56
56
|
import { getContrastColor, useAutoPaperTheme } from "@rific/auto-paper";
|
package/dist/lobby/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { M as MenuOption, P as PlayerSetupPanel, c as PlayerSetupPanelProps, R as ReadyButton, S as SharedActionBand, g as getColorPopoverId, d as getCpuDifficultyPopoverId, f as getProfilePopoverId, u as useZoneClampedAlign } from '../index-
|
|
1
|
+
export { M as MenuOption, P as PlayerSetupPanel, c as PlayerSetupPanelProps, R as ReadyButton, S as SharedActionBand, g as getColorPopoverId, d as getCpuDifficultyPopoverId, f as getProfilePopoverId, u as useZoneClampedAlign } from '../index-BOMA2rLU.mjs';
|
|
2
2
|
import 'react';
|
|
3
3
|
import '@rific/auto-paper';
|
|
4
4
|
import '@tastic/profile';
|
package/dist/lobby/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { M as MenuOption, P as PlayerSetupPanel, c as PlayerSetupPanelProps, R as ReadyButton, S as SharedActionBand, g as getColorPopoverId, d as getCpuDifficultyPopoverId, f as getProfilePopoverId, u as useZoneClampedAlign } from '../index-
|
|
1
|
+
export { M as MenuOption, P as PlayerSetupPanel, c as PlayerSetupPanelProps, R as ReadyButton, S as SharedActionBand, g as getColorPopoverId, d as getCpuDifficultyPopoverId, f as getProfilePopoverId, u as useZoneClampedAlign } from '../index-B2sz-9jr.js';
|
|
2
2
|
import 'react';
|
|
3
3
|
import '@rific/auto-paper';
|
|
4
4
|
import '@tastic/profile';
|
package/dist/lobby/index.js
CHANGED
|
@@ -62,13 +62,13 @@ function PopoverBody({ visible, children, align = "center", verticalAlign = "bel
|
|
|
62
62
|
const caretFill = above ? "borderTopColor" : "borderBottomColor";
|
|
63
63
|
const caretWidthProp = above ? "borderTopWidth" : "borderBottomWidth";
|
|
64
64
|
const caretEdge = (size) => above ? { bottom: -size + CARET_DIP } : { top: -size + CARET_DIP };
|
|
65
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_native2.View, { style: [styles.content, alignStyle, verticalStyle], children: [
|
|
65
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native2.View, { style: [styles.edge, above ? styles.edgeTop : styles.edgeBottom], children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_native2.View, { style: [styles.content, alignStyle, verticalStyle], children: [
|
|
66
66
|
children,
|
|
67
67
|
caretColor && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
68
68
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native2.View, { style: [styles.caret, caretOffset(ringSize), caretEdge(ringSize), { [caretFill]: caretBorderColor ?? caretColor, [caretWidthProp]: ringSize, borderLeftWidth: ringSize, borderRightWidth: ringSize }] }),
|
|
69
69
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native2.View, { style: [styles.caret, caretOffset(CARET_SIZE), caretEdge(CARET_SIZE - CARET_RING_OFFSET), { [caretFill]: caretColor, [caretWidthProp]: CARET_SIZE, borderLeftWidth: CARET_SIZE, borderRightWidth: CARET_SIZE }] })
|
|
70
70
|
] })
|
|
71
|
-
] });
|
|
71
|
+
] }) });
|
|
72
72
|
}
|
|
73
73
|
var styles = import_react_native2.StyleSheet.create({
|
|
74
74
|
caret: {
|
|
@@ -87,13 +87,15 @@ var styles = import_react_native2.StyleSheet.create({
|
|
|
87
87
|
position: "absolute",
|
|
88
88
|
zIndex: 50
|
|
89
89
|
},
|
|
90
|
+
// The strip's bottom edge, which is the trigger's top: the box grows up from it.
|
|
90
91
|
contentAbove: {
|
|
91
|
-
bottom:
|
|
92
|
+
bottom: 0,
|
|
92
93
|
marginBottom: 8
|
|
93
94
|
},
|
|
95
|
+
// The strip's top edge, which is the trigger's bottom: the box grows down from it.
|
|
94
96
|
contentBelow: {
|
|
95
97
|
marginTop: 8,
|
|
96
|
-
top:
|
|
98
|
+
top: 0
|
|
97
99
|
},
|
|
98
100
|
// Stretched to the anchor's own (trigger) width, with alignItems centering the actual (usually
|
|
99
101
|
// much wider) popover box inside via plain flexbox - not `left:'50%'` plus a percentage
|
|
@@ -109,6 +111,22 @@ var styles = import_react_native2.StyleSheet.create({
|
|
|
109
111
|
},
|
|
110
112
|
contentRight: {
|
|
111
113
|
right: 0
|
|
114
|
+
},
|
|
115
|
+
// The zero-height strip the box hangs off, spanning the trigger's wrapper (see PopoverBody's
|
|
116
|
+
// comment for why it isn't a percentage inset). Its zIndex matches the box's, so on the web, where
|
|
117
|
+
// every positioned view is its own stacking context, the box still paints over later siblings.
|
|
118
|
+
edge: {
|
|
119
|
+
height: 0,
|
|
120
|
+
left: 0,
|
|
121
|
+
position: "absolute",
|
|
122
|
+
right: 0,
|
|
123
|
+
zIndex: 50
|
|
124
|
+
},
|
|
125
|
+
edgeBottom: {
|
|
126
|
+
bottom: 0
|
|
127
|
+
},
|
|
128
|
+
edgeTop: {
|
|
129
|
+
top: 0
|
|
112
130
|
}
|
|
113
131
|
});
|
|
114
132
|
|
|
@@ -334,17 +352,38 @@ var styles2 = import_react_native4.StyleSheet.create({
|
|
|
334
352
|
});
|
|
335
353
|
|
|
336
354
|
// src/ReadyButton.tsx
|
|
355
|
+
var import_auto_paper2 = require("@rific/auto-paper");
|
|
337
356
|
var import_feedback_press2 = require("@rific/feedback-press");
|
|
338
357
|
var import_react_native5 = require("react-native");
|
|
339
358
|
var import_react_native_paper2 = require("react-native-paper");
|
|
340
359
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
341
|
-
|
|
360
|
+
var PILL_HEIGHT = 44;
|
|
361
|
+
function ReadyButton({ color, ready, onToggleReady, style, labelFontFamily, surfaceColor, dark = false }) {
|
|
362
|
+
const label = ready ? "READY \u2713" : "READY?";
|
|
363
|
+
if (surfaceColor) {
|
|
364
|
+
const pillStyle = [styles3.pill, { backgroundColor: ready ? color : surfaceColor }, style];
|
|
365
|
+
const pillLabelColor = ready ? (0, import_auto_paper2.getTintTextColor)(color, color, 1) : dark ? "#FFFFFF" : "#000000";
|
|
366
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_feedback_press2.TouchableRipple, { onPress: onToggleReady, borderless: true, style: pillStyle, accessibilityRole: "button", accessibilityLabel: label, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native_paper2.Text, { style: [styles3.pillLabel, { color: pillLabelColor }, labelFontFamily ? { fontFamily: labelFontFamily } : null], children: label }) });
|
|
367
|
+
}
|
|
342
368
|
const readyButtonStyle = [styles3.readyButton, { borderColor: color }, ready && { backgroundColor: color }, style];
|
|
343
|
-
const labelTextStyle = { fontFamily: labelFontFamily, fontWeight: "bold" };
|
|
369
|
+
const labelTextStyle = { fontFamily: labelFontFamily ?? MONO_FONT, fontWeight: "bold" };
|
|
344
370
|
const labelColorStyle = { color: ready ? "#000000" : color };
|
|
345
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_feedback_press2.TouchableRipple, { onPress: onToggleReady, borderless: true, style: readyButtonStyle, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native_paper2.Text, { variant: "labelLarge", style: [labelTextStyle, labelColorStyle], children:
|
|
371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_feedback_press2.TouchableRipple, { onPress: onToggleReady, borderless: true, style: readyButtonStyle, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native_paper2.Text, { variant: "labelLarge", style: [labelTextStyle, labelColorStyle], children: label }) });
|
|
346
372
|
}
|
|
347
373
|
var styles3 = import_react_native5.StyleSheet.create({
|
|
374
|
+
pill: {
|
|
375
|
+
alignItems: "center",
|
|
376
|
+
borderRadius: PILL_HEIGHT / 2,
|
|
377
|
+
height: PILL_HEIGHT,
|
|
378
|
+
justifyContent: "center",
|
|
379
|
+
minWidth: 120,
|
|
380
|
+
paddingHorizontal: 20
|
|
381
|
+
},
|
|
382
|
+
pillLabel: {
|
|
383
|
+
fontSize: 13,
|
|
384
|
+
fontWeight: "700",
|
|
385
|
+
letterSpacing: 1
|
|
386
|
+
},
|
|
348
387
|
readyButton: {
|
|
349
388
|
alignItems: "center",
|
|
350
389
|
borderRadius: 12,
|
|
@@ -417,7 +456,7 @@ function getProfilePopoverId(idPrefix) {
|
|
|
417
456
|
function getCpuDifficultyPopoverId(idPrefix) {
|
|
418
457
|
return `${idPrefix}-difficulty`;
|
|
419
458
|
}
|
|
420
|
-
function PlayerSetupPanel({ idPrefix, host, label, labelFontFamily, color, onColorChange, swatches, takenColor, allowSwapTaken, colorCaption, showColor = true, colorAlignOverride, colorRotation, isHuman, secondPicker, secondPickerId, ready, onToggleReady, dark, showReadyButton = true, profiles, selectedProfileId, takenProfileId, guestLabel, nullLabel, onProfileSelect, onManageProfiles, cpuDifficulty, cpuDifficultyOptions, onCpuDifficultyChange, humanIcon = "face-man", cpuIcon = "robot", previewValue, triggerStyle, useSeatPickerAlign }) {
|
|
459
|
+
function PlayerSetupPanel({ idPrefix, host, label, labelFontFamily, color, onColorChange, swatches, takenColor, allowSwapTaken, colorCaption, showColor = true, colorAlignOverride, colorRotation, isHuman, secondPicker, secondPickerId, ready, onToggleReady, dark, showReadyButton = true, profiles, selectedProfileId, takenProfileId, guestLabel, nullLabel, onProfileSelect, onManageProfiles, cpuDifficulty, cpuDifficultyOptions, onCpuDifficultyChange, humanIcon = "face-man", cpuIcon = "robot", previewValue, triggerStyle, readySurfaceColor, useSeatPickerAlign }) {
|
|
421
460
|
const ownHost = usePopoverHost();
|
|
422
461
|
const popover = host ?? ownHost;
|
|
423
462
|
const ownPopoverOpen = popover.openId?.startsWith(`${idPrefix}-`) ?? false;
|
|
@@ -438,7 +477,7 @@ function PlayerSetupPanel({ idPrefix, host, label, labelFontFamily, color, onCol
|
|
|
438
477
|
!seatButton && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(InlineColorPicker, { id: getColorPopoverId(idPrefix), host: popover, value: color, onChange: onColorChange, swatches, takenValue: takenColor, allowSwapTaken, previewValue, alignOverride: colorAlignOverride, rotation: colorRotation, dark, tag: isHuman ? selectedProfile?.tag : void 0, icon: isHuman ? humanIcon : cpuIcon }),
|
|
439
478
|
secondPicker
|
|
440
479
|
] }),
|
|
441
|
-
isHuman && showReadyButton && onToggleReady && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ReadyButton, { color: drawn, ready: ready ?? false, onToggleReady })
|
|
480
|
+
isHuman && showReadyButton && onToggleReady && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ReadyButton, { color: drawn, ready: ready ?? false, onToggleReady, surfaceColor: readySurfaceColor, dark })
|
|
442
481
|
] });
|
|
443
482
|
}
|
|
444
483
|
var styles4 = import_react_native7.StyleSheet.create({
|
package/dist/lobby/index.mjs
CHANGED
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
getCpuDifficultyPopoverId,
|
|
7
7
|
getProfilePopoverId,
|
|
8
8
|
useZoneClampedAlign
|
|
9
|
-
} from "../chunk-
|
|
10
|
-
import "../chunk-
|
|
9
|
+
} from "../chunk-CPNDNJJR.mjs";
|
|
10
|
+
import "../chunk-5ECU3722.mjs";
|
|
11
11
|
export {
|
|
12
12
|
PlayerSetupPanel,
|
|
13
13
|
ReadyButton,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tastic/hud",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"description": "Visual component kit for local-multiplayer React Native games: inline (non-modal) popovers, dropdowns, color pickers, gauges, ready buttons, and dialogs, built to stay scoped to one player's own zone on a shared screen",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -93,15 +93,15 @@
|
|
|
93
93
|
"devDependencies": {
|
|
94
94
|
"@infinitetoken/eslint-config": "^0.2.1",
|
|
95
95
|
"@infinitetoken/jest-config": "^0.5.2",
|
|
96
|
-
"@infinitetoken/tsconfig": "^0.
|
|
97
|
-
"@rific/auto-paper": "^0.
|
|
96
|
+
"@infinitetoken/tsconfig": "^0.7.0",
|
|
97
|
+
"@rific/auto-paper": "^0.14.0",
|
|
98
98
|
"@rific/core": "^0.5.0",
|
|
99
99
|
"@rific/feedback-press": "^0.13.1",
|
|
100
|
-
"@rific/updater": "^0.
|
|
100
|
+
"@rific/updater": "^0.8.0",
|
|
101
101
|
"@shopify/react-native-skia": "^2.14.0",
|
|
102
102
|
"@tastic/achievements": "^0.6.0",
|
|
103
|
-
"@tastic/core": "^0.
|
|
104
|
-
"@tastic/profile": "^0.
|
|
103
|
+
"@tastic/core": "^0.16.0",
|
|
104
|
+
"@tastic/profile": "^0.18.0",
|
|
105
105
|
"@tastic/split-screen": "^0.5.5",
|
|
106
106
|
"@testing-library/dom": "^10.4.1",
|
|
107
107
|
"@testing-library/react": "^16.3.2",
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
"typescript": "^6.0.3"
|
|
124
124
|
},
|
|
125
125
|
"peerDependencies": {
|
|
126
|
-
"@rific/auto-paper": "
|
|
126
|
+
"@rific/auto-paper": ">=0.13.0",
|
|
127
127
|
"@rific/core": ">=0.4.0",
|
|
128
128
|
"@rific/feedback-press": ">=0.10.2",
|
|
129
129
|
"@rific/updater": ">=0.4.0",
|
|
@@ -83,6 +83,12 @@ export interface BaseSettingsDialogProps {
|
|
|
83
83
|
// rendered between Appearance and Check for Updates - this component only owns the settings
|
|
84
84
|
// every game shares, never anything about how a particular game plays.
|
|
85
85
|
children?: ReactNode
|
|
86
|
+
// App-specific sections shown FIRST, above every shared row: a game's own rules, which someone
|
|
87
|
+
// opening Settings from that game is most likely there for (Solitaire, Jay 2026-11-10: rules below
|
|
88
|
+
// Sound, How to Play and Appearance went unfound). When given, the shared rows get a GENERAL
|
|
89
|
+
// label, so every gap between sections is still followed by a label. Omit it (or pass null) where
|
|
90
|
+
// there is nothing to put first: the sheet is then exactly as before.
|
|
91
|
+
leading?: ReactNode
|
|
86
92
|
}
|
|
87
93
|
|
|
88
94
|
// The settings shell every @tastic game shares - orientation lock, the optional edge-guard and
|
|
@@ -92,7 +98,7 @@ export interface BaseSettingsDialogProps {
|
|
|
92
98
|
// is the seam for whatever isn't shared: a game with its own board/difficulty settings (or a stats
|
|
93
99
|
// backup flow, or anything else genuinely specific to it) renders those below Appearance, not by
|
|
94
100
|
// forking this component.
|
|
95
|
-
export function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, version, lockOrientation, onLockOrientationChange, deferBottomEdgeGestures, onDeferBottomEdgeGestures, hideSound = false, hideHaptics = false, hideAppearance = false, hideUpdateCheck = false, onUpdateError, onShowHowToPlay, children }: BaseSettingsDialogProps) {
|
|
101
|
+
export function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, version, lockOrientation, onLockOrientationChange, deferBottomEdgeGestures, onDeferBottomEdgeGestures, hideSound = false, hideHaptics = false, hideAppearance = false, hideUpdateCheck = false, onUpdateError, onShowHowToPlay, children, leading }: BaseSettingsDialogProps) {
|
|
96
102
|
const { colors } = useAutoPaperTheme()
|
|
97
103
|
const ambientRotation = useRotation()
|
|
98
104
|
const rotation = rotationOverride ?? ambientRotation
|
|
@@ -169,6 +175,7 @@ export function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverr
|
|
|
169
175
|
// See the Blur row's own comment below for why it hides on Android and without expo-blur.
|
|
170
176
|
const showBlur = showAppearance && Platform.OS !== 'android' && expoBlur !== undefined && expoBlur !== null
|
|
171
177
|
const showUpdateCheck = Platform.OS !== 'web' && !hideUpdateCheck
|
|
178
|
+
const hasLeading = leading !== undefined && leading !== null && leading !== false
|
|
172
179
|
|
|
173
180
|
// Laid out in its own turned frame rather than rotated in place. Paper's Portal mounts at the app
|
|
174
181
|
// root, full screen and portrait-shaped, so a sheet that only rotated its card kept resolving its
|
|
@@ -197,11 +204,19 @@ export function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverr
|
|
|
197
204
|
closes it too. */}
|
|
198
205
|
<DialogHeader icon='cog' title='Settings' compact={compactHeader} />
|
|
199
206
|
<View style={styles.content}>
|
|
207
|
+
{hasLeading && leading}
|
|
200
208
|
{/* Grouped tightly together (styles.toggleGroup's small internal gap, not the 24px gap
|
|
201
209
|
between sections below) - same bare-row shape for all of them, no segmented control
|
|
202
210
|
and no section heading (each row's own label already says what it is). Haptics only
|
|
203
211
|
joins on native - there's nothing for it to control on web. */}
|
|
204
212
|
<View style={styles.toggleGroup}>
|
|
213
|
+
{/* Unlabeled while it opens the sheet (each row's own label says what it is); labeled
|
|
214
|
+
once an app's leading sections sit above it, like every other section after a gap. */}
|
|
215
|
+
{hasLeading && (
|
|
216
|
+
<Text variant='labelMedium' style={[styles.sectionLabel, styles.toggleGroupLabel, { color: colors.onSurfaceVariant }]}>
|
|
217
|
+
GENERAL
|
|
218
|
+
</Text>
|
|
219
|
+
)}
|
|
205
220
|
{/* Omitted entirely for a portrait-only game (no lockOrientation/onLockOrientationChange
|
|
206
221
|
passed at all - nothing to lock), and hidden (not just disabled) on a desktop/laptop
|
|
207
222
|
browser even when they are - see isTouchPrimary's own doc above. Still shown on
|
|
@@ -489,6 +504,10 @@ const styles = StyleSheet.create({
|
|
|
489
504
|
toggleGroup: {
|
|
490
505
|
gap: 4
|
|
491
506
|
},
|
|
507
|
+
// The 12pt a section's label sits above its rows (styles.section), less the group's own 4pt gap.
|
|
508
|
+
toggleGroupLabel: {
|
|
509
|
+
marginBottom: 8
|
|
510
|
+
},
|
|
492
511
|
// No horizontal margin of its own now either - see toggleButton's identical note.
|
|
493
512
|
toggleRow: {
|
|
494
513
|
flexDirection: 'row',
|
package/src/PlayerSetupPanel.tsx
CHANGED
|
@@ -121,6 +121,9 @@ export interface PlayerSetupPanelProps<C extends string = string> {
|
|
|
121
121
|
// Extra style for the seat button's trigger, e.g. a background behind its pill so it reads on a
|
|
122
122
|
// busy backdrop (ProfilePicker's and OptionPicker's `triggerStyle`).
|
|
123
123
|
triggerStyle?: StyleProp<ViewStyle>
|
|
124
|
+
// The Ready button's pill look over a busy backdrop (ReadyButton's `surfaceColor`): pass the
|
|
125
|
+
// theme's surface, as `triggerStyle` puts one behind the seat button. Unset keeps the outline.
|
|
126
|
+
readySurfaceColor?: string
|
|
124
127
|
// A placement of the host's own for the seat button's dropdown, in place of useZoneClampedAlign:
|
|
125
128
|
// called as a hook with whether the dropdown is open and the size it draws, and its result handed
|
|
126
129
|
// to the picker as `alignOverride` (for a screen turned by a fake landscape, whose button
|
|
@@ -144,7 +147,7 @@ export interface PlayerSetupPanelProps<C extends string = string> {
|
|
|
144
147
|
// Owns its own popover host shared by its own pickers unless a `host` is passed in to share with
|
|
145
148
|
// another panel (or a shared-controls row) instead - same convention as every popover-hosting
|
|
146
149
|
// component in this package.
|
|
147
|
-
export function PlayerSetupPanel<C extends string = string>({ idPrefix, host, label, labelFontFamily, color, onColorChange, swatches, takenColor, allowSwapTaken, colorCaption, showColor = true, colorAlignOverride, colorRotation, isHuman, secondPicker, secondPickerId, ready, onToggleReady, dark, showReadyButton = true, profiles, selectedProfileId, takenProfileId, guestLabel, nullLabel, onProfileSelect, onManageProfiles, cpuDifficulty, cpuDifficultyOptions, onCpuDifficultyChange, humanIcon = 'face-man', cpuIcon = 'robot', previewValue, triggerStyle, useSeatPickerAlign }: PlayerSetupPanelProps<C>) {
|
|
150
|
+
export function PlayerSetupPanel<C extends string = string>({ idPrefix, host, label, labelFontFamily, color, onColorChange, swatches, takenColor, allowSwapTaken, colorCaption, showColor = true, colorAlignOverride, colorRotation, isHuman, secondPicker, secondPickerId, ready, onToggleReady, dark, showReadyButton = true, profiles, selectedProfileId, takenProfileId, guestLabel, nullLabel, onProfileSelect, onManageProfiles, cpuDifficulty, cpuDifficultyOptions, onCpuDifficultyChange, humanIcon = 'face-man', cpuIcon = 'robot', previewValue, triggerStyle, readySurfaceColor, useSeatPickerAlign }: PlayerSetupPanelProps<C>) {
|
|
148
151
|
const ownHost = usePopoverHost()
|
|
149
152
|
const popover = host ?? ownHost
|
|
150
153
|
// Checking *this panel's own* ids, not just "is anything open on the host" - when `host` is
|
|
@@ -202,7 +205,7 @@ export function PlayerSetupPanel<C extends string = string>({ idPrefix, host, la
|
|
|
202
205
|
</View>
|
|
203
206
|
)}
|
|
204
207
|
|
|
205
|
-
{isHuman && showReadyButton && onToggleReady && <ReadyButton color={drawn} ready={ready ?? false} onToggleReady={onToggleReady} />}
|
|
208
|
+
{isHuman && showReadyButton && onToggleReady && <ReadyButton color={drawn} ready={ready ?? false} onToggleReady={onToggleReady} surfaceColor={readySurfaceColor} dark={dark} />}
|
|
206
209
|
</View>
|
|
207
210
|
)
|
|
208
211
|
}
|
package/src/PopoverBody.tsx
CHANGED
|
@@ -43,11 +43,20 @@ interface Props {
|
|
|
43
43
|
// Rendered inline as an absolutely-positioned sibling of its own trigger (never via Portal), so it
|
|
44
44
|
// inherits any rotation transform the trigger's zone applies - a Portal-based popover renders at
|
|
45
45
|
// the app root, outside that transform, and would end up upside-down relative to its own trigger
|
|
46
|
-
// once a face-to-face zone gets flipped 180°.
|
|
47
|
-
//
|
|
48
|
-
//
|
|
49
|
-
//
|
|
50
|
-
//
|
|
46
|
+
// once a face-to-face zone gets flipped 180°. Placed against the trigger's own wrapper rather than a
|
|
47
|
+
// measured pixel rect, so no onLayout/measurement plumbing is needed here and it resolves correctly
|
|
48
|
+
// regardless of how deep the trigger sits in the tree - the caller (useAutoAlign) is the one that
|
|
49
|
+
// actually measures, to decide which side to grow toward in the first place.
|
|
50
|
+
//
|
|
51
|
+
// No percentage insets (2026-11-07): it used to sit at `top:'100%'`/`bottom:'100%'` of the wrapper,
|
|
52
|
+
// and React Native's default Yoga errata (YGErrataAll, its "compatibility" layout conformance)
|
|
53
|
+
// includes AbsolutePercentAgainstInnerSize, which resolves an absolute child's percentage insets
|
|
54
|
+
// against the space its containing view was offered rather than its real size. In a wrapping row
|
|
55
|
+
// (a loadout's options on a narrow phone) that space is the whole multi-line row, so a menu in the
|
|
56
|
+
// first line opened a full row below its trigger. Plain insets use the view's measured size, so the
|
|
57
|
+
// box now hangs off a zero-height strip pinned to the wrapper's bottom edge (`bottom: 0`) or top edge
|
|
58
|
+
// (`top: 0`), spanning its width, and sits at the strip's `top: 0` or `bottom: 0`. The web never had
|
|
59
|
+
// the errata and lands exactly where it did.
|
|
51
60
|
export function PopoverBody({ visible, children, align = 'center', verticalAlign = 'below', caretColor, caretBorderColor, caretBorderWidth = 1, triggerSize = 0 }: Props) {
|
|
52
61
|
if (!visible) return null
|
|
53
62
|
|
|
@@ -73,17 +82,19 @@ export function PopoverBody({ visible, children, align = 'center', verticalAlign
|
|
|
73
82
|
const caretEdge = (size: number): ViewStyle => (above ? { bottom: -size + CARET_DIP } : { top: -size + CARET_DIP })
|
|
74
83
|
|
|
75
84
|
return (
|
|
76
|
-
<View style={[styles.
|
|
77
|
-
{
|
|
78
|
-
|
|
85
|
+
<View style={[styles.edge, above ? styles.edgeTop : styles.edgeBottom]}>
|
|
86
|
+
<View style={[styles.content, alignStyle, verticalStyle]}>
|
|
87
|
+
{children}
|
|
88
|
+
{/* Painted after (on top of) the box above, dipping into its edge - see CARET_DIP - so it
|
|
79
89
|
reads as one continuous outline flowing from the trigger into the box, not a separate chip
|
|
80
90
|
butted up against it. */}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
91
|
+
{caretColor && (
|
|
92
|
+
<>
|
|
93
|
+
<View style={[styles.caret, caretOffset(ringSize), caretEdge(ringSize), { [caretFill]: caretBorderColor ?? caretColor, [caretWidthProp]: ringSize, borderLeftWidth: ringSize, borderRightWidth: ringSize }]} />
|
|
94
|
+
<View style={[styles.caret, caretOffset(CARET_SIZE), caretEdge(CARET_SIZE - CARET_RING_OFFSET), { [caretFill]: caretColor, [caretWidthProp]: CARET_SIZE, borderLeftWidth: CARET_SIZE, borderRightWidth: CARET_SIZE }]} />
|
|
95
|
+
</>
|
|
96
|
+
)}
|
|
97
|
+
</View>
|
|
87
98
|
</View>
|
|
88
99
|
)
|
|
89
100
|
}
|
|
@@ -105,13 +116,15 @@ const styles = StyleSheet.create({
|
|
|
105
116
|
position: 'absolute',
|
|
106
117
|
zIndex: 50
|
|
107
118
|
},
|
|
119
|
+
// The strip's bottom edge, which is the trigger's top: the box grows up from it.
|
|
108
120
|
contentAbove: {
|
|
109
|
-
bottom:
|
|
121
|
+
bottom: 0,
|
|
110
122
|
marginBottom: 8
|
|
111
123
|
},
|
|
124
|
+
// The strip's top edge, which is the trigger's bottom: the box grows down from it.
|
|
112
125
|
contentBelow: {
|
|
113
126
|
marginTop: 8,
|
|
114
|
-
top:
|
|
127
|
+
top: 0
|
|
115
128
|
},
|
|
116
129
|
// Stretched to the anchor's own (trigger) width, with alignItems centering the actual (usually
|
|
117
130
|
// much wider) popover box inside via plain flexbox - not `left:'50%'` plus a percentage
|
|
@@ -127,5 +140,21 @@ const styles = StyleSheet.create({
|
|
|
127
140
|
},
|
|
128
141
|
contentRight: {
|
|
129
142
|
right: 0
|
|
143
|
+
},
|
|
144
|
+
// The zero-height strip the box hangs off, spanning the trigger's wrapper (see PopoverBody's
|
|
145
|
+
// comment for why it isn't a percentage inset). Its zIndex matches the box's, so on the web, where
|
|
146
|
+
// every positioned view is its own stacking context, the box still paints over later siblings.
|
|
147
|
+
edge: {
|
|
148
|
+
height: 0,
|
|
149
|
+
left: 0,
|
|
150
|
+
position: 'absolute',
|
|
151
|
+
right: 0,
|
|
152
|
+
zIndex: 50
|
|
153
|
+
},
|
|
154
|
+
edgeBottom: {
|
|
155
|
+
bottom: 0
|
|
156
|
+
},
|
|
157
|
+
edgeTop: {
|
|
158
|
+
top: 0
|
|
130
159
|
}
|
|
131
160
|
})
|
package/src/ReadyButton.tsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getTintTextColor } from '@rific/auto-paper'
|
|
1
2
|
import { TouchableRipple } from '@rific/feedback-press'
|
|
2
3
|
import { StyleProp, StyleSheet, TextStyle, ViewStyle } from 'react-native'
|
|
3
4
|
import { Text } from 'react-native-paper'
|
|
@@ -14,27 +15,65 @@ interface Props {
|
|
|
14
15
|
// unmounting.
|
|
15
16
|
style?: StyleProp<ViewStyle>
|
|
16
17
|
// Defaults to the system monospace font - pass your own game's registered font to match its UI.
|
|
18
|
+
// The pill look (`surfaceColor`) keeps the theme's own font unless this is passed.
|
|
17
19
|
labelFontFamily?: string
|
|
20
|
+
// For a loadout drawn over a pack's backdrop (Solitaire on its felt), where the outline and label
|
|
21
|
+
// in the seat's color read dim: Ready is then a pill on this color (the theme's surface), the size
|
|
22
|
+
// and style of the seat buttons beside it (@tastic/profile's chip pill), its label black or white
|
|
23
|
+
// (`dark`), and once ready it fills with `color` and its label turns to that color's own ink.
|
|
24
|
+
// Unset keeps the outline on a plain black or white screen.
|
|
25
|
+
surfaceColor?: string
|
|
26
|
+
// Only read with `surfaceColor`: the not-ready label's white (dark) or black, as the seat buttons'.
|
|
27
|
+
dark?: boolean
|
|
18
28
|
}
|
|
19
29
|
|
|
30
|
+
// The pill look's height and label: @tastic/profile's chip pill (a 32pt chip in 6pt of padding,
|
|
31
|
+
// a 13pt bold label spaced 1pt), so Ready lines up with the seat and option buttons around it.
|
|
32
|
+
const PILL_HEIGHT = 44
|
|
33
|
+
|
|
20
34
|
// Standalone toggle so it can render either embedded in a per-player panel or centered on its own
|
|
21
35
|
// below a shared row - e.g. a vs-CPU mode with only one human player needs just one Ready toggle,
|
|
22
36
|
// not one tucked under each slot.
|
|
23
|
-
export function ReadyButton({ color, ready, onToggleReady, style, labelFontFamily =
|
|
37
|
+
export function ReadyButton({ color, ready, onToggleReady, style, labelFontFamily, surfaceColor, dark = false }: Props) {
|
|
38
|
+
const label = ready ? 'READY ✓' : 'READY?'
|
|
39
|
+
|
|
40
|
+
if (surfaceColor) {
|
|
41
|
+
const pillStyle = [styles.pill, { backgroundColor: ready ? color : surfaceColor }, style]
|
|
42
|
+
const pillLabelColor = ready ? getTintTextColor(color, color, 1) : dark ? '#FFFFFF' : '#000000'
|
|
43
|
+
return (
|
|
44
|
+
<TouchableRipple onPress={onToggleReady} borderless style={pillStyle} accessibilityRole='button' accessibilityLabel={label}>
|
|
45
|
+
<Text style={[styles.pillLabel, { color: pillLabelColor }, labelFontFamily ? { fontFamily: labelFontFamily } : null]}>{label}</Text>
|
|
46
|
+
</TouchableRipple>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
24
50
|
const readyButtonStyle = [styles.readyButton, { borderColor: color }, ready && { backgroundColor: color }, style]
|
|
25
|
-
const labelTextStyle: TextStyle = { fontFamily: labelFontFamily, fontWeight: 'bold' }
|
|
51
|
+
const labelTextStyle: TextStyle = { fontFamily: labelFontFamily ?? MONO_FONT, fontWeight: 'bold' }
|
|
26
52
|
const labelColorStyle = { color: ready ? '#000000' : color }
|
|
27
53
|
|
|
28
54
|
return (
|
|
29
55
|
<TouchableRipple onPress={onToggleReady} borderless style={readyButtonStyle}>
|
|
30
56
|
<Text variant='labelLarge' style={[labelTextStyle, labelColorStyle]}>
|
|
31
|
-
{
|
|
57
|
+
{label}
|
|
32
58
|
</Text>
|
|
33
59
|
</TouchableRipple>
|
|
34
60
|
)
|
|
35
61
|
}
|
|
36
62
|
|
|
37
63
|
const styles = StyleSheet.create({
|
|
64
|
+
pill: {
|
|
65
|
+
alignItems: 'center',
|
|
66
|
+
borderRadius: PILL_HEIGHT / 2,
|
|
67
|
+
height: PILL_HEIGHT,
|
|
68
|
+
justifyContent: 'center',
|
|
69
|
+
minWidth: 120,
|
|
70
|
+
paddingHorizontal: 20
|
|
71
|
+
},
|
|
72
|
+
pillLabel: {
|
|
73
|
+
fontSize: 13,
|
|
74
|
+
fontWeight: '700',
|
|
75
|
+
letterSpacing: 1
|
|
76
|
+
},
|
|
38
77
|
readyButton: {
|
|
39
78
|
alignItems: 'center',
|
|
40
79
|
borderRadius: 12,
|