@tastic/hud 0.12.0 → 0.13.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.
@@ -22,10 +22,10 @@ export function getOverlayCardColors(dark: boolean): OverlayCardColors {
22
22
  }
23
23
 
24
24
  // Only the shell shape every overlay card shares (backdrop + card geometry) — deliberately not the
25
- // button/title/body styling, which already legitimately varies by consumer (BaseSettingsDialog's
26
- // single centered OK button vs. ConfirmDialog's two-button flexBasis-wrap row vs. each app's own
27
- // score/badge/zone content). A consumer applies `{backgroundColor: cardBg, borderColor: cardBorder}`
28
- // from getOverlayCardColors on top of `card` itself, same as every existing call site already does.
25
+ // title/body styling, which already legitimately varies by consumer (each app's own score/badge/zone
26
+ // content). A consumer applies `{backgroundColor: cardBg, borderColor: cardBorder}` from
27
+ // getOverlayCardColors on top of `card` itself, same as every existing call site already does. The
28
+ // one button row every overlay card with actions shares lives in overlayActionStyles below.
29
29
  export const overlayStyles = StyleSheet.create({
30
30
  card: {
31
31
  alignItems: 'center',
@@ -46,3 +46,50 @@ export const overlayStyles = StyleSheet.create({
46
46
  top: 0
47
47
  }
48
48
  })
49
+
50
+ // The action row ConfirmDialog and guide/HowToPlayDialog share: an outlined secondary (Cancel, Skip,
51
+ // Back) on the left, a contained primary on the right, each growing to split the row but never
52
+ // narrower than 128. Moved here from ConfirmDialog when the how-to-play card needed the identical
53
+ // row, so the two can't drift into different button shapes (the guide briefly shipped text-mode
54
+ // Skip/Back — the only text buttons in the fleet).
55
+ export const overlayActionStyles = StyleSheet.create({
56
+ // minWidth (not flexBasis) is each button's real floor - whenever both fit side by side, flexGrow
57
+ // still splits any leftover width evenly beyond that floor, same visual result as a plain flex: 1
58
+ // on a roomy screen, but a button can never be squeezed narrower than 128, only wrap to its own
59
+ // row instead (see actions' flexWrap below). This used to be flexBasis: 128, which measured
60
+ // correctly on web but rendered every button roughly SQUARE on iOS - confirmed live (see the
61
+ // "Quit Match?" Cancel/Quit buttons and the single-button "OK" dialogs both coming out ~128pt
62
+ // tall instead of wide). Root cause: react-native-paper's Button renders its Surface as two
63
+ // nested views on iOS only (Surface.tsx's SurfaceIOS, for shadow rendering) - only a curated
64
+ // allowlist of style keys (flex/flexGrow/flexShrink/width/height/position/... - notably NOT
65
+ // flexBasis) reaches the outer view, which is the real flex item inside this row; every other
66
+ // key, flexBasis included, falls through to an inner view whose own unspecified flexDirection
67
+ // defaults to column. flexGrow: 1 landed on the (row-context) outer view and grew width
68
+ // correctly; flexBasis: 128 landed on the (column-context) inner view instead, where a flexBasis
69
+ // sets HEIGHT, not width. minWidth isn't axis-relative like flexBasis, so it constrains width
70
+ // correctly regardless of which of the two views it ends up on. react-native-paper's Button also
71
+ // hardcodes numberOfLines={1} on its label with no override, so a button squeezed under its
72
+ // label's natural width silently ellipsizes ("Cancel" -> "Can...") instead of wrapping - assumed
73
+ // fixable by just giving the row more width, until confirmed live that these two-word labels
74
+ // (Cancel/Reset/New Game) can still lose the truncation fight even with the extra room ConfirmDialog's own
75
+ // card width fix provides, on a narrow enough screen.
76
+ actionButton: {
77
+ flexGrow: 1,
78
+ minWidth: 128
79
+ },
80
+ // A lone confirm button (no cancel - BaseSettingsDialog's info-only "OK" dialogs, e.g. the
81
+ // update-check "no update found" message) has nothing left to share actions' width with, so
82
+ // actionButton's own flexGrow: 1 would stretch it across the entire row instead of reading as a
83
+ // normal button. Same 128 floor, no flexGrow, so it stays at that natural size instead of filling
84
+ // the card - centered by actions' own justifyContent below.
85
+ actionButtonSingle: {
86
+ minWidth: 128
87
+ },
88
+ actions: {
89
+ flexDirection: 'row',
90
+ flexWrap: 'wrap',
91
+ gap: 12,
92
+ justifyContent: 'center',
93
+ width: '100%'
94
+ }
95
+ })