@tastic/hud 0.27.1 → 0.28.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 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
- Four optional props fit it to a host that draws on a backdrop (a felt) with muted profile colors,
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) and `useSeatPickerAlign` (a placement
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).
@@ -889,13 +889,13 @@ function PopoverBody({ visible, children, align = "center", verticalAlign = "bel
889
889
  const caretFill = above ? "borderTopColor" : "borderBottomColor";
890
890
  const caretWidthProp = above ? "borderTopWidth" : "borderBottomWidth";
891
891
  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: [
892
+ 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
893
  children,
894
894
  caretColor && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
895
895
  /* @__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
896
  /* @__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
897
  ] })
898
- ] });
898
+ ] }) });
899
899
  }
900
900
  var styles13 = import_react_native16.StyleSheet.create({
901
901
  caret: {
@@ -914,13 +914,15 @@ var styles13 = import_react_native16.StyleSheet.create({
914
914
  position: "absolute",
915
915
  zIndex: 50
916
916
  },
917
+ // The strip's bottom edge, which is the trigger's top: the box grows up from it.
917
918
  contentAbove: {
918
- bottom: "100%",
919
+ bottom: 0,
919
920
  marginBottom: 8
920
921
  },
922
+ // The strip's top edge, which is the trigger's bottom: the box grows down from it.
921
923
  contentBelow: {
922
924
  marginTop: 8,
923
- top: "100%"
925
+ top: 0
924
926
  },
925
927
  // Stretched to the anchor's own (trigger) width, with alignItems centering the actual (usually
926
928
  // much wider) popover box inside via plain flexbox - not `left:'50%'` plus a percentage
@@ -936,6 +938,22 @@ var styles13 = import_react_native16.StyleSheet.create({
936
938
  },
937
939
  contentRight: {
938
940
  right: 0
941
+ },
942
+ // The zero-height strip the box hangs off, spanning the trigger's wrapper (see PopoverBody's
943
+ // comment for why it isn't a percentage inset). Its zIndex matches the box's, so on the web, where
944
+ // every positioned view is its own stacking context, the box still paints over later siblings.
945
+ edge: {
946
+ height: 0,
947
+ left: 0,
948
+ position: "absolute",
949
+ right: 0,
950
+ zIndex: 50
951
+ },
952
+ edgeBottom: {
953
+ bottom: 0
954
+ },
955
+ edgeTop: {
956
+ top: 0
939
957
  }
940
958
  });
941
959
 
@@ -18,15 +18,7 @@ import {
18
18
  getStaggeredWordDuration,
19
19
  useCompactDialog,
20
20
  useWellColors
21
- } from "../chunk-JBE7IQC5.mjs";
22
- import {
23
- InlineColorPicker,
24
- MONO_FONT,
25
- PopoverBody,
26
- getInlineColorPickerContentSize,
27
- useAutoAlign,
28
- usePopoverHost
29
- } from "../chunk-FOJLQMKA.mjs";
21
+ } from "../chunk-75Q2VN5R.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: "100%",
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: "100%"
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";
@@ -3,20 +3,41 @@ import {
3
3
  MONO_FONT,
4
4
  useAutoAlign,
5
5
  usePopoverHost
6
- } from "./chunk-FOJLQMKA.mjs";
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
- function ReadyButton({ color, ready, onToggleReady, style, labelFontFamily = MONO_FONT }) {
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: ready ? "READY \u2713" : "READY?" }) });
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-Bhu3I6FN.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-Bhu3I6FN.mjs';
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-1fnoSjO0.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-1fnoSjO0.js';
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
@@ -1073,13 +1073,13 @@ function PopoverBody({ visible, children, align = "center", verticalAlign = "bel
1073
1073
  const caretFill = above ? "borderTopColor" : "borderBottomColor";
1074
1074
  const caretWidthProp = above ? "borderTopWidth" : "borderBottomWidth";
1075
1075
  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: [
1076
+ 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
1077
  children,
1078
1078
  caretColor && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
1079
1079
  /* @__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
1080
  /* @__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
1081
  ] })
1082
- ] });
1082
+ ] }) });
1083
1083
  }
1084
1084
  var styles13 = import_react_native16.StyleSheet.create({
1085
1085
  caret: {
@@ -1098,13 +1098,15 @@ var styles13 = import_react_native16.StyleSheet.create({
1098
1098
  position: "absolute",
1099
1099
  zIndex: 50
1100
1100
  },
1101
+ // The strip's bottom edge, which is the trigger's top: the box grows up from it.
1101
1102
  contentAbove: {
1102
- bottom: "100%",
1103
+ bottom: 0,
1103
1104
  marginBottom: 8
1104
1105
  },
1106
+ // The strip's top edge, which is the trigger's bottom: the box grows down from it.
1105
1107
  contentBelow: {
1106
1108
  marginTop: 8,
1107
- top: "100%"
1109
+ top: 0
1108
1110
  },
1109
1111
  // Stretched to the anchor's own (trigger) width, with alignItems centering the actual (usually
1110
1112
  // much wider) popover box inside via plain flexbox - not `left:'50%'` plus a percentage
@@ -1120,6 +1122,22 @@ var styles13 = import_react_native16.StyleSheet.create({
1120
1122
  },
1121
1123
  contentRight: {
1122
1124
  right: 0
1125
+ },
1126
+ // The zero-height strip the box hangs off, spanning the trigger's wrapper (see PopoverBody's
1127
+ // comment for why it isn't a percentage inset). Its zIndex matches the box's, so on the web, where
1128
+ // every positioned view is its own stacking context, the box still paints over later siblings.
1129
+ edge: {
1130
+ height: 0,
1131
+ left: 0,
1132
+ position: "absolute",
1133
+ right: 0,
1134
+ zIndex: 50
1135
+ },
1136
+ edgeBottom: {
1137
+ bottom: 0
1138
+ },
1139
+ edgeTop: {
1140
+ top: 0
1123
1141
  }
1124
1142
  });
1125
1143
 
@@ -1727,17 +1745,38 @@ var import_react_native27 = require("react-native");
1727
1745
  var import_react_native_paper16 = require("react-native-paper");
1728
1746
 
1729
1747
  // src/ReadyButton.tsx
1748
+ var import_auto_paper12 = require("@rific/auto-paper");
1730
1749
  var import_feedback_press9 = require("@rific/feedback-press");
1731
1750
  var import_react_native25 = require("react-native");
1732
1751
  var import_react_native_paper15 = require("react-native-paper");
1733
1752
  var import_jsx_runtime24 = require("react/jsx-runtime");
1734
- function ReadyButton({ color, ready, onToggleReady, style, labelFontFamily = MONO_FONT }) {
1753
+ var PILL_HEIGHT = 44;
1754
+ function ReadyButton({ color, ready, onToggleReady, style, labelFontFamily, surfaceColor, dark = false }) {
1755
+ const label = ready ? "READY \u2713" : "READY?";
1756
+ if (surfaceColor) {
1757
+ const pillStyle = [styles20.pill, { backgroundColor: ready ? color : surfaceColor }, style];
1758
+ const pillLabelColor = ready ? (0, import_auto_paper12.getTintTextColor)(color, color, 1) : dark ? "#FFFFFF" : "#000000";
1759
+ 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 }) });
1760
+ }
1735
1761
  const readyButtonStyle = [styles20.readyButton, { borderColor: color }, ready && { backgroundColor: color }, style];
1736
- const labelTextStyle = { fontFamily: labelFontFamily, fontWeight: "bold" };
1762
+ const labelTextStyle = { fontFamily: labelFontFamily ?? MONO_FONT, fontWeight: "bold" };
1737
1763
  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: ready ? "READY \u2713" : "READY?" }) });
1764
+ 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
1765
  }
1740
1766
  var styles20 = import_react_native25.StyleSheet.create({
1767
+ pill: {
1768
+ alignItems: "center",
1769
+ borderRadius: PILL_HEIGHT / 2,
1770
+ height: PILL_HEIGHT,
1771
+ justifyContent: "center",
1772
+ minWidth: 120,
1773
+ paddingHorizontal: 20
1774
+ },
1775
+ pillLabel: {
1776
+ fontSize: 13,
1777
+ fontWeight: "700",
1778
+ letterSpacing: 1
1779
+ },
1741
1780
  readyButton: {
1742
1781
  alignItems: "center",
1743
1782
  borderRadius: 12,
@@ -1810,7 +1849,7 @@ function getProfilePopoverId(idPrefix) {
1810
1849
  function getCpuDifficultyPopoverId(idPrefix) {
1811
1850
  return `${idPrefix}-difficulty`;
1812
1851
  }
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 }) {
1852
+ 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
1853
  const ownHost = usePopoverHost();
1815
1854
  const popover = host ?? ownHost;
1816
1855
  const ownPopoverOpen = popover.openId?.startsWith(`${idPrefix}-`) ?? false;
@@ -1831,7 +1870,7 @@ function PlayerSetupPanel({ idPrefix, host, label, labelFontFamily, color, onCol
1831
1870
  !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
1871
  secondPicker
1833
1872
  ] }),
1834
- isHuman && showReadyButton && onToggleReady && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ReadyButton, { color: drawn, ready: ready ?? false, onToggleReady })
1873
+ isHuman && showReadyButton && onToggleReady && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ReadyButton, { color: drawn, ready: ready ?? false, onToggleReady, surfaceColor: readySurfaceColor, dark })
1835
1874
  ] });
1836
1875
  }
1837
1876
  var styles21 = import_react_native27.StyleSheet.create({
package/dist/index.mjs CHANGED
@@ -18,11 +18,18 @@ import {
18
18
  getStaggeredWordDuration,
19
19
  useCompactDialog,
20
20
  useWellColors
21
- } from "./chunk-JBE7IQC5.mjs";
21
+ } from "./chunk-75Q2VN5R.mjs";
22
22
  import {
23
- loadSkiaWeb,
24
- locateSkiaWebFile
25
- } from "./chunk-3TCJHMJP.mjs";
23
+ COMPACT_DIALOG_HEIGHT,
24
+ DialogHeader,
25
+ OverlayBackdrop,
26
+ OverlayCard,
27
+ SecondaryButton,
28
+ isCompactDialogHeight,
29
+ overlayActionStyles,
30
+ overlayStyles,
31
+ useOverlayCardColors
32
+ } from "./chunk-CBH7GQKI.mjs";
26
33
  import {
27
34
  PlayerSetupPanel,
28
35
  ReadyButton,
@@ -31,7 +38,7 @@ import {
31
38
  getCpuDifficultyPopoverId,
32
39
  getProfilePopoverId,
33
40
  useZoneClampedAlign
34
- } from "./chunk-B2DSHZJT.mjs";
41
+ } from "./chunk-CPNDNJJR.mjs";
35
42
  import {
36
43
  InlineColorPicker,
37
44
  MONO_FONT,
@@ -39,18 +46,11 @@ import {
39
46
  getInlineColorPickerContentSize,
40
47
  useAutoAlign,
41
48
  usePopoverHost
42
- } from "./chunk-FOJLQMKA.mjs";
49
+ } from "./chunk-5ECU3722.mjs";
43
50
  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";
51
+ loadSkiaWeb,
52
+ locateSkiaWebFile
53
+ } from "./chunk-3TCJHMJP.mjs";
54
54
 
55
55
  // src/AchievementUnlockList.tsx
56
56
  import { getContrastColor, useAutoPaperTheme } from "@rific/auto-paper";
@@ -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-Bhu3I6FN.mjs';
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';
@@ -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-1fnoSjO0.js';
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';
@@ -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: "100%",
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: "100%"
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
- function ReadyButton({ color, ready, onToggleReady, style, labelFontFamily = MONO_FONT }) {
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: ready ? "READY \u2713" : "READY?" }) });
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({
@@ -6,8 +6,8 @@ import {
6
6
  getCpuDifficultyPopoverId,
7
7
  getProfilePopoverId,
8
8
  useZoneClampedAlign
9
- } from "../chunk-B2DSHZJT.mjs";
10
- import "../chunk-FOJLQMKA.mjs";
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.27.1",
3
+ "version": "0.28.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",
@@ -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
  }
@@ -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°. Positioned via percentage (`top:'100%'`/`bottom:'100%'`)
47
- // against the trigger's own wrapper rather than a measured pixel rect, so no onLayout/measurement
48
- // plumbing is needed here and it resolves correctly regardless of how deep the trigger sits in the
49
- // tree - the caller (useAutoAlign) is the one that actually measures, to decide which side to grow
50
- // toward in the first place.
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.content, alignStyle, verticalStyle]}>
77
- {children}
78
- {/* Painted after (on top of) the box above, dipping into its edge - see CARET_DIP - so it
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
- {caretColor && (
82
- <>
83
- <View style={[styles.caret, caretOffset(ringSize), caretEdge(ringSize), { [caretFill]: caretBorderColor ?? caretColor, [caretWidthProp]: ringSize, borderLeftWidth: ringSize, borderRightWidth: ringSize }]} />
84
- <View style={[styles.caret, caretOffset(CARET_SIZE), caretEdge(CARET_SIZE - CARET_RING_OFFSET), { [caretFill]: caretColor, [caretWidthProp]: CARET_SIZE, borderLeftWidth: CARET_SIZE, borderRightWidth: CARET_SIZE }]} />
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: '100%',
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: '100%'
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
  })
@@ -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 = MONO_FONT }: Props) {
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
- {ready ? 'READY ✓' : 'READY?'}
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,