@tastic/hud 0.30.1 → 0.31.1

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
@@ -23,7 +23,9 @@ corner of the screen.
23
23
  - **`usePopoverHost()`**: tracks which *one* popover (by id) is open within a group, so opening one
24
24
  closes any sibling already open in the same group.
25
25
  - **`PopoverBody`**: the low-level popover shell (position, caret, alignment). `SectionedDropdown`
26
- and `InlineColorPicker` are built on it.
26
+ and `InlineColorPicker` are built on it. With the box aligned left or right, the caret keeps its
27
+ base clear of the box's rounded corner (`cornerRadius`, 12 by default, every fleet menu's), so a
28
+ narrow trigger gets a clean outline instead of a jagged notch where the caret crosses the curve.
27
29
  - **`useAutoAlign`**: measures a trigger's actual on-screen position and picks whichever alignment
28
30
  (left/right/center, above/below) keeps a popover from overflowing a screen edge - including a
29
31
  `maxHeight` for the caller to cap content and scroll when neither direction has enough room. An
@@ -233,6 +235,11 @@ across every app and read their own shared settings, so `lockOrientation`/`onLoc
233
235
  and `deferBottomEdgeGestures`/`onDeferBottomEdgeGestures` are the only settings an adapter actually
234
236
  needs to source itself, however it does that. Each pair is optional: omit one and its row doesn't show.
235
237
 
238
+ The Edge Guard row ("Require second swipe") shows on iOS and Android, never on the web. The setting does
239
+ nothing on its own: on iOS the app passes it to `@tastic/edge-guard`'s `useEdgeGestureGuard`, and on
240
+ Android it spreads `edgeGuardScreenOptions(setting)` over its play screen's options. An app that wires
241
+ only the iOS half shows a row on Android that does nothing. `@tastic/shell` wires both for its packs.
242
+
236
243
  The Keep Awake row reads `@rific/core`'s Keep Awake setting (`useKeepAwakeSettings()`), the same way
237
244
  the Sound row reads `@rific/feedback-press`. It shows on touch-first devices (where Lock Orientation
238
245
  shows) in any app whose `KeepAwakeProvider` was given `expo-keep-awake` (`useExpoKeepAwake()` returns
@@ -273,6 +280,13 @@ A game with music passes `showMusic`, which adds a Music toggle beside Sound and
273
280
  follow; it's apart from Sound, so a player can keep the effects and turn the music off. Hidden unless
274
281
  asked for, since most games have no music.
275
282
 
283
+ On iOS a line under the Sound, Music and Haptics row says that silent mode mutes Sound and Music
284
+ ("Silent mode mutes sound and music", or just the one that shows).
285
+ `@rific/feedback-press` plays both in the ambient audio session, the convention for game sounds, so
286
+ silent mode mutes them; a player who doesn't know that takes the sound for broken, and iOS gives apps
287
+ no reliable way to read the switch, so the rows can't grey themselves out. Always shown on iOS while
288
+ either row is, never on Android (its silent mode leaves media playing) or the web.
289
+
276
290
  ## Overlay cards (`OverlayCard`, `OverlayBackdrop`, `useOverlayCardColors`)
277
291
 
278
292
  `ConfirmDialog` and `HowToPlayDialog` draw their card and the dim behind it with these, and a game's
@@ -542,6 +556,9 @@ on MD3's level-1 shadow, with `onSurface`/`onSurfaceVariant` text. `useWellColor
542
556
  `WELL_SHADOW` the shadow, for an app's own cards (a menu tile) to match. Each component's `fg`/`fgMuted`/`sectionBg`
543
557
  props still override them.
544
558
 
559
+ **Captions.** `StatSection` takes an optional `caption`, a short key at the right end of its heading line over the rows'
560
+ values, in the well's muted text: `<StatSection label='BY MODE' caption='W-L-D'>` over rows reading "3-2-0".
561
+
545
562
  Composing both with `@tastic/achievements`' own row computation:
546
563
 
547
564
  ```tsx
@@ -238,8 +238,9 @@ interface Props$3 {
238
238
  caretBorderColor?: string;
239
239
  caretBorderWidth?: number;
240
240
  triggerSize?: number;
241
+ cornerRadius?: number;
241
242
  }
242
- declare function PopoverBody({ visible, children, align, verticalAlign, caretColor, caretBorderColor, caretBorderWidth, triggerSize }: Props$3): react.JSX.Element | null;
243
+ declare function PopoverBody({ visible, children, align, verticalAlign, caretColor, caretBorderColor, caretBorderWidth, triggerSize, cornerRadius }: Props$3): react.JSX.Element | null;
243
244
 
244
245
  interface Props$2 {
245
246
  active: boolean;
@@ -311,11 +312,12 @@ declare function StatRow({ label, value, fg: fgOverride, fgMuted: fgMutedOverrid
311
312
 
312
313
  interface Props {
313
314
  label: string;
315
+ caption?: string;
314
316
  fg?: string;
315
317
  sectionBg?: string;
316
318
  children: ReactNode;
317
319
  }
318
- declare function StatSection({ label, fg: fgOverride, sectionBg: sectionBgOverride, children }: Props): react.JSX.Element;
320
+ declare function StatSection({ label, caption, fg: fgOverride, sectionBg: sectionBgOverride, children }: Props): react.JSX.Element;
319
321
 
320
322
  interface UpdateDialogProps {
321
323
  rotation?: ViewRotation;
@@ -238,8 +238,9 @@ interface Props$3 {
238
238
  caretBorderColor?: string;
239
239
  caretBorderWidth?: number;
240
240
  triggerSize?: number;
241
+ cornerRadius?: number;
241
242
  }
242
- declare function PopoverBody({ visible, children, align, verticalAlign, caretColor, caretBorderColor, caretBorderWidth, triggerSize }: Props$3): react.JSX.Element | null;
243
+ declare function PopoverBody({ visible, children, align, verticalAlign, caretColor, caretBorderColor, caretBorderWidth, triggerSize, cornerRadius }: Props$3): react.JSX.Element | null;
243
244
 
244
245
  interface Props$2 {
245
246
  active: boolean;
@@ -311,11 +312,12 @@ declare function StatRow({ label, value, fg: fgOverride, fgMuted: fgMutedOverrid
311
312
 
312
313
  interface Props {
313
314
  label: string;
315
+ caption?: string;
314
316
  fg?: string;
315
317
  sectionBg?: string;
316
318
  children: ReactNode;
317
319
  }
318
- declare function StatSection({ label, fg: fgOverride, sectionBg: sectionBgOverride, children }: Props): react.JSX.Element;
320
+ declare function StatSection({ label, caption, fg: fgOverride, sectionBg: sectionBgOverride, children }: Props): react.JSX.Element;
319
321
 
320
322
  interface UpdateDialogProps {
321
323
  rotation?: ViewRotation;
@@ -201,16 +201,30 @@ var styles3 = import_react_native4.StyleSheet.create({
201
201
  var import_react_native5 = require("react-native");
202
202
  var import_react_native_paper4 = require("react-native-paper");
203
203
  var import_jsx_runtime4 = require("react/jsx-runtime");
204
- function StatSection({ label, fg: fgOverride, sectionBg: sectionBgOverride, children }) {
204
+ function StatSection({ label, caption, fg: fgOverride, sectionBg: sectionBgOverride, children }) {
205
205
  const well = useWellColors();
206
206
  const fg = fgOverride ?? well.fg;
207
207
  const sectionBg = sectionBgOverride ?? well.bg;
208
+ const heading = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native_paper4.Text, { variant: "labelMedium", style: [styles4.label, { color: fg }], children: label });
208
209
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react_native5.View, { style: [styles4.section, { backgroundColor: sectionBg }], children: [
209
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native_paper4.Text, { variant: "labelMedium", style: [styles4.label, { color: fg }], children: label }),
210
+ caption ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react_native5.View, { style: styles4.heading, children: [
211
+ heading,
212
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native_paper4.Text, { variant: "labelMedium", style: [styles4.caption, { color: well.fgMuted }], children: caption })
213
+ ] }) : heading,
210
214
  children
211
215
  ] });
212
216
  }
213
217
  var styles4 = import_react_native5.StyleSheet.create({
218
+ // The label's spacing, without its weight: a key to the values, not a second heading
219
+ caption: {
220
+ letterSpacing: 2
221
+ },
222
+ heading: {
223
+ alignItems: "baseline",
224
+ flexDirection: "row",
225
+ gap: 12,
226
+ justifyContent: "space-between"
227
+ },
214
228
  // Bold and full-contrast (fg), not the original fontless/fgMuted treatment - that read at the
215
229
  // same visual weight as StatRow's own row labels below it (both used the identical muted color;
216
230
  // letterSpacing/variant alone didn't separate them enough to read as "this is the group header"
@@ -547,13 +561,14 @@ function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, ve
547
561
  const [opened, setOpened] = (0, import_react6.useState)(visible);
548
562
  if (visible && !opened) setOpened(true);
549
563
  const showLockOrientation = isTouchPrimary && lockOrientation !== void 0 && onLockOrientationChange !== void 0;
550
- const showEdgeGuard = import_react_native12.Platform.OS === "ios" && deferBottomEdgeGestures !== void 0 && onDeferBottomEdgeGestures !== void 0;
564
+ const showEdgeGuard = import_react_native12.Platform.OS !== "web" && deferBottomEdgeGestures !== void 0 && onDeferBottomEdgeGestures !== void 0;
551
565
  const showKeepAwake = isTouchPrimary && expoKeepAwake !== void 0;
552
566
  const showHaptics = import_react_native12.Platform.OS !== "web" && !hideHaptics;
553
567
  const showSound = !hideSound;
554
568
  const showAppearance = !hideAppearance;
555
569
  const showBlur = showAppearance && import_react_native12.Platform.OS !== "android" && expoBlur !== void 0 && expoBlur !== null;
556
570
  const showUpdateCheck = import_react_native12.Platform.OS !== "web" && !hideUpdateCheck;
571
+ const silentNote = import_react_native12.Platform.OS !== "ios" ? null : showSound && showMusic ? "Silent mode mutes sound and music" : showSound ? "Silent mode mutes sound" : showMusic ? "Silent mode mutes music" : null;
557
572
  const hasLeading = leading !== void 0 && leading !== null && leading !== false;
558
573
  if (!opened) return null;
559
574
  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: [
@@ -625,6 +640,7 @@ function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, ve
625
640
  }
626
641
  )
627
642
  ] }),
643
+ silentNote && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native_paper8.Text, { variant: "bodySmall", style: [styles9.silentNote, { color: colors.onSurfaceVariant }], children: silentNote }),
628
644
  onShowHowToPlay && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
629
645
  import_feedback_press3.TouchableRipple,
630
646
  {
@@ -720,6 +736,11 @@ var styles9 = import_react_native12.StyleSheet.create({
720
736
  sectionLabel: {
721
737
  letterSpacing: 2
722
738
  },
739
+ // Lined up with the toggles' labels: past the 36pt icon badge (SettingIcon) and the 12pt gap
740
+ silentNote: {
741
+ marginBottom: 4,
742
+ paddingLeft: 48
743
+ },
723
744
  // Used to carry marginHorizontal: -12 + paddingHorizontal: 12 (netting to the same inset as
724
745
  // APPEARANCE/SOUND & HAPTICS below, while giving the ripple/hover highlight room to breathe
725
746
  // into the dialog's own gutter beyond that). Removed: this dialog scrolls (Dialog.ScrollArea +
@@ -895,13 +916,15 @@ var import_jsx_runtime15 = require("react/jsx-runtime");
895
916
  var CARET_SIZE = 7;
896
917
  var CARET_RING_OFFSET = 2;
897
918
  var CARET_DIP = 1;
898
- function PopoverBody({ visible, children, align = "center", verticalAlign = "below", caretColor, caretBorderColor, caretBorderWidth = 1, triggerSize = 0 }) {
919
+ var BOX_RADIUS = 12;
920
+ function PopoverBody({ visible, children, align = "center", verticalAlign = "below", caretColor, caretBorderColor, caretBorderWidth = 1, triggerSize = 0, cornerRadius = BOX_RADIUS }) {
899
921
  if (!visible) return null;
900
922
  const above = verticalAlign === "above";
901
923
  const alignStyle = align === "left" ? styles13.contentLeft : align === "right" ? styles13.contentRight : styles13.contentCenter;
902
924
  const verticalStyle = above ? styles13.contentAbove : styles13.contentBelow;
903
925
  const ringSize = CARET_SIZE + caretBorderWidth;
904
- const caretOffset = (halfFootprint) => align === "right" ? { right: triggerSize / 2 - halfFootprint } : { left: triggerSize / 2 - halfFootprint };
926
+ const caretCenter = align === "center" ? triggerSize / 2 : Math.max(triggerSize / 2, cornerRadius + ringSize);
927
+ const caretOffset = (halfFootprint) => align === "right" ? { right: caretCenter - halfFootprint } : { left: caretCenter - halfFootprint };
905
928
  const caretFill = above ? "borderTopColor" : "borderBottomColor";
906
929
  const caretWidthProp = above ? "borderTopWidth" : "borderBottomWidth";
907
930
  const caretEdge = (size) => above ? { bottom: -size + CARET_DIP } : { top: -size + CARET_DIP };
@@ -18,7 +18,7 @@ import {
18
18
  getStaggeredWordDuration,
19
19
  useCompactDialog,
20
20
  useWellColors
21
- } from "../chunk-4666H2UG.mjs";
21
+ } from "../chunk-QOFASZIX.mjs";
22
22
  import {
23
23
  COMPACT_DIALOG_HEIGHT,
24
24
  DialogHeader,
@@ -37,7 +37,7 @@ import {
37
37
  getInlineColorPickerContentSize,
38
38
  useAutoAlign,
39
39
  usePopoverHost
40
- } from "../chunk-5ECU3722.mjs";
40
+ } from "../chunk-ZZEW6AF5.mjs";
41
41
  export {
42
42
  AchievementCatalogSection,
43
43
  AchievementRow,
@@ -10,7 +10,7 @@ import {
10
10
  } from "./chunk-CBH7GQKI.mjs";
11
11
  import {
12
12
  MONO_FONT
13
- } from "./chunk-5ECU3722.mjs";
13
+ } from "./chunk-ZZEW6AF5.mjs";
14
14
 
15
15
  // src/wellSurface.ts
16
16
  import { useAutoPaperTheme } from "@rific/auto-paper";
@@ -138,16 +138,30 @@ var styles3 = StyleSheet3.create({
138
138
  import { StyleSheet as StyleSheet4, View as View3 } from "react-native";
139
139
  import { Text as Text4 } from "react-native-paper";
140
140
  import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
141
- function StatSection({ label, fg: fgOverride, sectionBg: sectionBgOverride, children }) {
141
+ function StatSection({ label, caption, fg: fgOverride, sectionBg: sectionBgOverride, children }) {
142
142
  const well = useWellColors();
143
143
  const fg = fgOverride ?? well.fg;
144
144
  const sectionBg = sectionBgOverride ?? well.bg;
145
+ const heading = /* @__PURE__ */ jsx4(Text4, { variant: "labelMedium", style: [styles4.label, { color: fg }], children: label });
145
146
  return /* @__PURE__ */ jsxs4(View3, { style: [styles4.section, { backgroundColor: sectionBg }], children: [
146
- /* @__PURE__ */ jsx4(Text4, { variant: "labelMedium", style: [styles4.label, { color: fg }], children: label }),
147
+ caption ? /* @__PURE__ */ jsxs4(View3, { style: styles4.heading, children: [
148
+ heading,
149
+ /* @__PURE__ */ jsx4(Text4, { variant: "labelMedium", style: [styles4.caption, { color: well.fgMuted }], children: caption })
150
+ ] }) : heading,
147
151
  children
148
152
  ] });
149
153
  }
150
154
  var styles4 = StyleSheet4.create({
155
+ // The label's spacing, without its weight: a key to the values, not a second heading
156
+ caption: {
157
+ letterSpacing: 2
158
+ },
159
+ heading: {
160
+ alignItems: "baseline",
161
+ flexDirection: "row",
162
+ gap: 12,
163
+ justifyContent: "space-between"
164
+ },
151
165
  // Bold and full-contrast (fg), not the original fontless/fgMuted treatment - that read at the
152
166
  // same visual weight as StatRow's own row labels below it (both used the identical muted color;
153
167
  // letterSpacing/variant alone didn't separate them enough to read as "this is the group header"
@@ -347,13 +361,14 @@ function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, ve
347
361
  const [opened, setOpened] = useState3(visible);
348
362
  if (visible && !opened) setOpened(true);
349
363
  const showLockOrientation = isTouchPrimary && lockOrientation !== void 0 && onLockOrientationChange !== void 0;
350
- const showEdgeGuard = Platform.OS === "ios" && deferBottomEdgeGestures !== void 0 && onDeferBottomEdgeGestures !== void 0;
364
+ const showEdgeGuard = Platform.OS !== "web" && deferBottomEdgeGestures !== void 0 && onDeferBottomEdgeGestures !== void 0;
351
365
  const showKeepAwake = isTouchPrimary && expoKeepAwake !== void 0;
352
366
  const showHaptics = Platform.OS !== "web" && !hideHaptics;
353
367
  const showSound = !hideSound;
354
368
  const showAppearance = !hideAppearance;
355
369
  const showBlur = showAppearance && Platform.OS !== "android" && expoBlur !== void 0 && expoBlur !== null;
356
370
  const showUpdateCheck = Platform.OS !== "web" && !hideUpdateCheck;
371
+ const silentNote = Platform.OS !== "ios" ? null : showSound && showMusic ? "Silent mode mutes sound and music" : showSound ? "Silent mode mutes sound" : showMusic ? "Silent mode mutes music" : null;
357
372
  const hasLeading = leading !== void 0 && leading !== null && leading !== false;
358
373
  if (!opened) return null;
359
374
  return /* @__PURE__ */ jsx8(Portal3, { children: /* @__PURE__ */ jsxs7(RotatedFrame, { rotation, rotatedSafeArea: true, portalHost: true, passThrough: true, children: [
@@ -425,6 +440,7 @@ function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, ve
425
440
  }
426
441
  )
427
442
  ] }),
443
+ silentNote && /* @__PURE__ */ jsx8(Text6, { variant: "bodySmall", style: [styles7.silentNote, { color: colors.onSurfaceVariant }], children: silentNote }),
428
444
  onShowHowToPlay && /* @__PURE__ */ jsx8(
429
445
  TouchableRipple,
430
446
  {
@@ -520,6 +536,11 @@ var styles7 = StyleSheet7.create({
520
536
  sectionLabel: {
521
537
  letterSpacing: 2
522
538
  },
539
+ // Lined up with the toggles' labels: past the 36pt icon badge (SettingIcon) and the 12pt gap
540
+ silentNote: {
541
+ marginBottom: 4,
542
+ paddingLeft: 48
543
+ },
523
544
  // Used to carry marginHorizontal: -12 + paddingHorizontal: 12 (netting to the same inset as
524
545
  // APPEARANCE/SOUND & HAPTICS below, while giving the ripple/hover highlight room to breathe
525
546
  // into the dialog's own gutter beyond that). Removed: this dialog scrolls (Dialog.ScrollArea +
@@ -3,7 +3,7 @@ import {
3
3
  MONO_FONT,
4
4
  useAutoAlign,
5
5
  usePopoverHost
6
- } from "./chunk-5ECU3722.mjs";
6
+ } from "./chunk-ZZEW6AF5.mjs";
7
7
 
8
8
  // src/ReadyButton.tsx
9
9
  import { getTintTextColor } from "@rific/auto-paper";
@@ -8,13 +8,15 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
8
  var CARET_SIZE = 7;
9
9
  var CARET_RING_OFFSET = 2;
10
10
  var CARET_DIP = 1;
11
- function PopoverBody({ visible, children, align = "center", verticalAlign = "below", caretColor, caretBorderColor, caretBorderWidth = 1, triggerSize = 0 }) {
11
+ var BOX_RADIUS = 12;
12
+ function PopoverBody({ visible, children, align = "center", verticalAlign = "below", caretColor, caretBorderColor, caretBorderWidth = 1, triggerSize = 0, cornerRadius = BOX_RADIUS }) {
12
13
  if (!visible) return null;
13
14
  const above = verticalAlign === "above";
14
15
  const alignStyle = align === "left" ? styles.contentLeft : align === "right" ? styles.contentRight : styles.contentCenter;
15
16
  const verticalStyle = above ? styles.contentAbove : styles.contentBelow;
16
17
  const ringSize = CARET_SIZE + caretBorderWidth;
17
- const caretOffset = (halfFootprint) => align === "right" ? { right: triggerSize / 2 - halfFootprint } : { left: triggerSize / 2 - halfFootprint };
18
+ const caretCenter = align === "center" ? triggerSize / 2 : Math.max(triggerSize / 2, cornerRadius + ringSize);
19
+ const caretOffset = (halfFootprint) => align === "right" ? { right: caretCenter - halfFootprint } : { left: caretCenter - halfFootprint };
18
20
  const caretFill = above ? "borderTopColor" : "borderBottomColor";
19
21
  const caretWidthProp = above ? "borderTopWidth" : "borderBottomWidth";
20
22
  const caretEdge = (size) => above ? { bottom: -size + CARET_DIP } : { top: -size + CARET_DIP };
package/dist/index.js CHANGED
@@ -400,16 +400,30 @@ var styles4 = import_react_native5.StyleSheet.create({
400
400
  var import_react_native6 = require("react-native");
401
401
  var import_react_native_paper5 = require("react-native-paper");
402
402
  var import_jsx_runtime5 = require("react/jsx-runtime");
403
- function StatSection({ label, fg: fgOverride, sectionBg: sectionBgOverride, children }) {
403
+ function StatSection({ label, caption, fg: fgOverride, sectionBg: sectionBgOverride, children }) {
404
404
  const well = useWellColors();
405
405
  const fg = fgOverride ?? well.fg;
406
406
  const sectionBg = sectionBgOverride ?? well.bg;
407
+ const heading = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native_paper5.Text, { variant: "labelMedium", style: [styles5.label, { color: fg }], children: label });
407
408
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react_native6.View, { style: [styles5.section, { backgroundColor: sectionBg }], children: [
408
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native_paper5.Text, { variant: "labelMedium", style: [styles5.label, { color: fg }], children: label }),
409
+ caption ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react_native6.View, { style: styles5.heading, children: [
410
+ heading,
411
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native_paper5.Text, { variant: "labelMedium", style: [styles5.caption, { color: well.fgMuted }], children: caption })
412
+ ] }) : heading,
409
413
  children
410
414
  ] });
411
415
  }
412
416
  var styles5 = import_react_native6.StyleSheet.create({
417
+ // The label's spacing, without its weight: a key to the values, not a second heading
418
+ caption: {
419
+ letterSpacing: 2
420
+ },
421
+ heading: {
422
+ alignItems: "baseline",
423
+ flexDirection: "row",
424
+ gap: 12,
425
+ justifyContent: "space-between"
426
+ },
413
427
  // Bold and full-contrast (fg), not the original fontless/fgMuted treatment - that read at the
414
428
  // same visual weight as StatRow's own row labels below it (both used the identical muted color;
415
429
  // letterSpacing/variant alone didn't separate them enough to read as "this is the group header"
@@ -746,13 +760,14 @@ function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, ve
746
760
  const [opened, setOpened] = (0, import_react6.useState)(visible);
747
761
  if (visible && !opened) setOpened(true);
748
762
  const showLockOrientation = isTouchPrimary && lockOrientation !== void 0 && onLockOrientationChange !== void 0;
749
- const showEdgeGuard = import_react_native13.Platform.OS === "ios" && deferBottomEdgeGestures !== void 0 && onDeferBottomEdgeGestures !== void 0;
763
+ const showEdgeGuard = import_react_native13.Platform.OS !== "web" && deferBottomEdgeGestures !== void 0 && onDeferBottomEdgeGestures !== void 0;
750
764
  const showKeepAwake = isTouchPrimary && expoKeepAwake !== void 0;
751
765
  const showHaptics = import_react_native13.Platform.OS !== "web" && !hideHaptics;
752
766
  const showSound = !hideSound;
753
767
  const showAppearance = !hideAppearance;
754
768
  const showBlur = showAppearance && import_react_native13.Platform.OS !== "android" && expoBlur !== void 0 && expoBlur !== null;
755
769
  const showUpdateCheck = import_react_native13.Platform.OS !== "web" && !hideUpdateCheck;
770
+ const silentNote = import_react_native13.Platform.OS !== "ios" ? null : showSound && showMusic ? "Silent mode mutes sound and music" : showSound ? "Silent mode mutes sound" : showMusic ? "Silent mode mutes music" : null;
756
771
  const hasLeading = leading !== void 0 && leading !== null && leading !== false;
757
772
  if (!opened) return null;
758
773
  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: [
@@ -824,6 +839,7 @@ function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, ve
824
839
  }
825
840
  )
826
841
  ] }),
842
+ silentNote && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native_paper9.Text, { variant: "bodySmall", style: [styles10.silentNote, { color: colors.onSurfaceVariant }], children: silentNote }),
827
843
  onShowHowToPlay && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
828
844
  import_feedback_press3.TouchableRipple,
829
845
  {
@@ -919,6 +935,11 @@ var styles10 = import_react_native13.StyleSheet.create({
919
935
  sectionLabel: {
920
936
  letterSpacing: 2
921
937
  },
938
+ // Lined up with the toggles' labels: past the 36pt icon badge (SettingIcon) and the 12pt gap
939
+ silentNote: {
940
+ marginBottom: 4,
941
+ paddingLeft: 48
942
+ },
922
943
  // Used to carry marginHorizontal: -12 + paddingHorizontal: 12 (netting to the same inset as
923
944
  // APPEARANCE/SOUND & HAPTICS below, while giving the ripple/hover highlight room to breathe
924
945
  // into the dialog's own gutter beyond that). Removed: this dialog scrolls (Dialog.ScrollArea +
@@ -1079,13 +1100,15 @@ var import_jsx_runtime15 = require("react/jsx-runtime");
1079
1100
  var CARET_SIZE = 7;
1080
1101
  var CARET_RING_OFFSET = 2;
1081
1102
  var CARET_DIP = 1;
1082
- function PopoverBody({ visible, children, align = "center", verticalAlign = "below", caretColor, caretBorderColor, caretBorderWidth = 1, triggerSize = 0 }) {
1103
+ var BOX_RADIUS = 12;
1104
+ function PopoverBody({ visible, children, align = "center", verticalAlign = "below", caretColor, caretBorderColor, caretBorderWidth = 1, triggerSize = 0, cornerRadius = BOX_RADIUS }) {
1083
1105
  if (!visible) return null;
1084
1106
  const above = verticalAlign === "above";
1085
1107
  const alignStyle = align === "left" ? styles13.contentLeft : align === "right" ? styles13.contentRight : styles13.contentCenter;
1086
1108
  const verticalStyle = above ? styles13.contentAbove : styles13.contentBelow;
1087
1109
  const ringSize = CARET_SIZE + caretBorderWidth;
1088
- const caretOffset = (halfFootprint) => align === "right" ? { right: triggerSize / 2 - halfFootprint } : { left: triggerSize / 2 - halfFootprint };
1110
+ const caretCenter = align === "center" ? triggerSize / 2 : Math.max(triggerSize / 2, cornerRadius + ringSize);
1111
+ const caretOffset = (halfFootprint) => align === "right" ? { right: caretCenter - halfFootprint } : { left: caretCenter - halfFootprint };
1089
1112
  const caretFill = above ? "borderTopColor" : "borderBottomColor";
1090
1113
  const caretWidthProp = above ? "borderTopWidth" : "borderBottomWidth";
1091
1114
  const caretEdge = (size) => above ? { bottom: -size + CARET_DIP } : { top: -size + CARET_DIP };
package/dist/index.mjs CHANGED
@@ -18,7 +18,7 @@ import {
18
18
  getStaggeredWordDuration,
19
19
  useCompactDialog,
20
20
  useWellColors
21
- } from "./chunk-4666H2UG.mjs";
21
+ } from "./chunk-QOFASZIX.mjs";
22
22
  import {
23
23
  COMPACT_DIALOG_HEIGHT,
24
24
  DialogHeader,
@@ -30,10 +30,6 @@ import {
30
30
  overlayStyles,
31
31
  useOverlayCardColors
32
32
  } from "./chunk-CBH7GQKI.mjs";
33
- import {
34
- loadSkiaWeb,
35
- locateSkiaWebFile
36
- } from "./chunk-3TCJHMJP.mjs";
37
33
  import {
38
34
  PlayerSetupPanel,
39
35
  ReadyButton,
@@ -42,7 +38,7 @@ import {
42
38
  getCpuDifficultyPopoverId,
43
39
  getProfilePopoverId,
44
40
  useZoneClampedAlign
45
- } from "./chunk-CPNDNJJR.mjs";
41
+ } from "./chunk-Z6SOVTKT.mjs";
46
42
  import {
47
43
  InlineColorPicker,
48
44
  MONO_FONT,
@@ -50,7 +46,11 @@ import {
50
46
  getInlineColorPickerContentSize,
51
47
  useAutoAlign,
52
48
  usePopoverHost
53
- } from "./chunk-5ECU3722.mjs";
49
+ } from "./chunk-ZZEW6AF5.mjs";
50
+ import {
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";
@@ -52,13 +52,15 @@ var import_jsx_runtime = require("react/jsx-runtime");
52
52
  var CARET_SIZE = 7;
53
53
  var CARET_RING_OFFSET = 2;
54
54
  var CARET_DIP = 1;
55
- function PopoverBody({ visible, children, align = "center", verticalAlign = "below", caretColor, caretBorderColor, caretBorderWidth = 1, triggerSize = 0 }) {
55
+ var BOX_RADIUS = 12;
56
+ function PopoverBody({ visible, children, align = "center", verticalAlign = "below", caretColor, caretBorderColor, caretBorderWidth = 1, triggerSize = 0, cornerRadius = BOX_RADIUS }) {
56
57
  if (!visible) return null;
57
58
  const above = verticalAlign === "above";
58
59
  const alignStyle = align === "left" ? styles.contentLeft : align === "right" ? styles.contentRight : styles.contentCenter;
59
60
  const verticalStyle = above ? styles.contentAbove : styles.contentBelow;
60
61
  const ringSize = CARET_SIZE + caretBorderWidth;
61
- const caretOffset = (halfFootprint) => align === "right" ? { right: triggerSize / 2 - halfFootprint } : { left: triggerSize / 2 - halfFootprint };
62
+ const caretCenter = align === "center" ? triggerSize / 2 : Math.max(triggerSize / 2, cornerRadius + ringSize);
63
+ const caretOffset = (halfFootprint) => align === "right" ? { right: caretCenter - halfFootprint } : { left: caretCenter - halfFootprint };
62
64
  const caretFill = above ? "borderTopColor" : "borderBottomColor";
63
65
  const caretWidthProp = above ? "borderTopWidth" : "borderBottomWidth";
64
66
  const caretEdge = (size) => above ? { bottom: -size + CARET_DIP } : { top: -size + CARET_DIP };
@@ -6,8 +6,8 @@ import {
6
6
  getCpuDifficultyPopoverId,
7
7
  getProfilePopoverId,
8
8
  useZoneClampedAlign
9
- } from "../chunk-CPNDNJJR.mjs";
10
- import "../chunk-5ECU3722.mjs";
9
+ } from "../chunk-Z6SOVTKT.mjs";
10
+ import "../chunk-ZZEW6AF5.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.30.1",
3
+ "version": "0.31.1",
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",
@@ -53,8 +53,9 @@ export interface BaseSettingsDialogProps {
53
53
  lockOrientation?: boolean
54
54
  onLockOrientationChange?: (value: boolean) => void
55
55
  // Optional, and always passed as a pair - omit both entirely for a game with no full-screen edge-
56
- // anchored swipe controls (nothing to guard). iOS-only regardless of whether the pair is passed:
57
- // @tastic/edge-guard's own swizzle is a no-op on every other platform.
56
+ // anchored swipe controls (nothing to guard). Native only regardless of whether the pair is passed:
57
+ // a browser has no system edge gestures to guard. On Android the app also has to spread
58
+ // @tastic/edge-guard's edgeGuardScreenOptions over its play screen's options, or the row does nothing.
58
59
  deferBottomEdgeGestures?: boolean
59
60
  onDeferBottomEdgeGestures?: (value: boolean) => void
60
61
  // No Keep Awake props: that row reads @rific/core's Keep Awake setting itself (see showKeepAwake).
@@ -167,7 +168,7 @@ export function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverr
167
168
  if (visible && !opened) setOpened(true)
168
169
 
169
170
  const showLockOrientation = isTouchPrimary && lockOrientation !== undefined && onLockOrientationChange !== undefined
170
- const showEdgeGuard = Platform.OS === 'ios' && deferBottomEdgeGestures !== undefined && onDeferBottomEdgeGestures !== undefined
171
+ const showEdgeGuard = Platform.OS !== 'web' && deferBottomEdgeGestures !== undefined && onDeferBottomEdgeGestures !== undefined
171
172
  // Only in an app that opted in by handing expo-keep-awake to @rific/core's KeepAwakeProvider, and
172
173
  // only where it can work: core withholds the module from a browser without the Screen Wake Lock
173
174
  // API (from @rific/core 0.4.1), so without it the setting would do nothing. On the same devices
@@ -180,6 +181,8 @@ export function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverr
180
181
  // See the Blur row's own comment below for why it hides on Android and without expo-blur.
181
182
  const showBlur = showAppearance && Platform.OS !== 'android' && expoBlur !== undefined && expoBlur !== null
182
183
  const showUpdateCheck = Platform.OS !== 'web' && !hideUpdateCheck
184
+ // See the note's own comment below
185
+ const silentNote = Platform.OS !== 'ios' ? null : showSound && showMusic ? 'Silent mode mutes sound and music' : showSound ? 'Silent mode mutes sound' : showMusic ? 'Silent mode mutes music' : null
183
186
  const hasLeading = leading !== undefined && leading !== null && leading !== false
184
187
 
185
188
  // Laid out in its own turned frame rather than rotated in place. Paper's Portal mounts at the app
@@ -243,12 +246,15 @@ export function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverr
243
246
  </TouchableRipple>
244
247
  )}
245
248
 
246
- {/* iOS only - mirrors into UserDefaults for @tastic/edge-guard's own config plugin
247
- swizzle to read. Guards both edges - the top (Notification Center/Control Center)
248
- and the bottom (home-indicator swipe, incidentally Reachability too), per that
249
- package's own doc. Off by default: a deliberate opt-in for whoever's actually hit an
250
- accidental-swipe-near-an-edge problem mid-game and come looking for a fix, not a
251
- surprise every player gets by default. */}
249
+ {/* iOS and Android. On iOS the app mirrors it into UserDefaults for
250
+ @tastic/edge-guard's config plugin swizzle to read, guarding the top (Notification
251
+ Center/Control Center) and the bottom (home-indicator swipe, incidentally
252
+ Reachability too). On Android the app hands it to edge-guard's
253
+ edgeGuardScreenOptions, which hides the system bars on the play screen in sticky
254
+ immersive mode, so a swipe from any edge only brings them back for a moment. Either
255
+ way it's the same "Require second swipe". Off by default: a deliberate opt-in for
256
+ whoever's actually hit an accidental-swipe-near-an-edge problem mid-game and come
257
+ looking for a fix, not a surprise every player gets by default. */}
252
258
  {showEdgeGuard && (
253
259
  <TouchableRipple onPress={() => onDeferBottomEdgeGestures!(!deferBottomEdgeGestures)} style={styles.toggleButton} accessibilityLabel={`Edge guard ${deferBottomEdgeGestures ? 'on' : 'off'}`}>
254
260
  <View style={styles.toggleContent}>
@@ -349,6 +355,17 @@ export function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverr
349
355
  </View>
350
356
  )}
351
357
 
358
+ {/* iOS's silent mode mutes Sound and Music: feedback-press plays them in the ambient audio
359
+ session, the convention for game sounds. A player who doesn't know that thinks the sound
360
+ is broken (Jay, HexFleet, 2026-11-15), and iOS gives apps no reliable way to read the
361
+ switch, so the rows can't show it themselves; this says so under them, always, on iOS.
362
+ Android's silent mode leaves media playing, and the web has none. */}
363
+ {silentNote && (
364
+ <Text variant='bodySmall' style={[styles.silentNote, { color: colors.onSurfaceVariant }]}>
365
+ {silentNote}
366
+ </Text>
367
+ )}
368
+
352
369
  {/* Not a toggle, but it reads like one of the rows above and belongs with them rather than
353
370
  down in `children` (which sits below Appearance) - this is the "replay the intro"
354
371
  entry point every game's own how-to-play flow shares. Dismisses this dialog first so
@@ -494,6 +511,11 @@ const styles = StyleSheet.create({
494
511
  sectionLabel: {
495
512
  letterSpacing: 2
496
513
  },
514
+ // Lined up with the toggles' labels: past the 36pt icon badge (SettingIcon) and the 12pt gap
515
+ silentNote: {
516
+ marginBottom: 4,
517
+ paddingLeft: 48
518
+ },
497
519
  // Used to carry marginHorizontal: -12 + paddingHorizontal: 12 (netting to the same inset as
498
520
  // APPEARANCE/SOUND & HAPTICS below, while giving the ripple/hover highlight room to breathe
499
521
  // into the dialog's own gutter beyond that). Removed: this dialog scrolls (Dialog.ScrollArea +
@@ -10,6 +10,10 @@ const CARET_RING_OFFSET = 2
10
10
  // lets it paint over the box's own border there instead of butting up against it - a seam shows if
11
11
  // the two edges only touch, since neither is guaranteed to land on the exact same subpixel.
12
12
  const CARET_DIP = 1
13
+ // The popover box's corner radius, every fleet menu's (12). A caret whose base reaches into the
14
+ // rounded corner meets the box's curved border at an angle and leaves a jagged notch where they
15
+ // cross, so a box aligned to one side keeps its caret's base on the straight part of the edge.
16
+ const BOX_RADIUS = 12
13
17
 
14
18
  interface Props {
15
19
  visible: boolean
@@ -38,6 +42,11 @@ interface Props {
38
42
  // to the trigger's actual center via a fixed offset rather than the (usually much wider) content
39
43
  // box's own midpoint, which only coincides with the trigger's center by coincidence, if at all.
40
44
  triggerSize?: number
45
+ // The box's own corner radius (default BOX_RADIUS). With the box aligned 'left' or 'right', the
46
+ // caret's base stays clear of that corner: a trigger narrower than the corner needs (a short text
47
+ // trigger flush with the box's edge, like @tastic/profile's plain picker) gets its caret pointing a
48
+ // few px in from its center rather than a notch where the caret's outline crosses the curve.
49
+ cornerRadius?: number
41
50
  }
42
51
 
43
52
  // Rendered inline as an absolutely-positioned sibling of its own trigger (never via Portal), so it
@@ -57,7 +66,7 @@ interface Props {
57
66
  // box now hangs off a zero-height strip pinned to the wrapper's bottom edge (`bottom: 0`) or top edge
58
67
  // (`top: 0`), spanning its width, and sits at the strip's `top: 0` or `bottom: 0`. The web never had
59
68
  // the errata and lands exactly where it did.
60
- export function PopoverBody({ visible, children, align = 'center', verticalAlign = 'below', caretColor, caretBorderColor, caretBorderWidth = 1, triggerSize = 0 }: Props) {
69
+ export function PopoverBody({ visible, children, align = 'center', verticalAlign = 'below', caretColor, caretBorderColor, caretBorderWidth = 1, triggerSize = 0, cornerRadius = BOX_RADIUS }: Props) {
61
70
  if (!visible) return null
62
71
 
63
72
  const above = verticalAlign === 'above'
@@ -73,7 +82,10 @@ export function PopoverBody({ visible, children, align = 'center', verticalAlign
73
82
  // back into the transform, which native has been unreliable about; plain flexbox centering
74
83
  // doesn't), so triggerSize/2 from that shared edge always lands on the trigger's true center,
75
84
  // however much wider the actual popover box grows.
76
- const caretOffset = (halfFootprint: number): ViewStyle => (align === 'right' ? { right: triggerSize / 2 - halfFootprint } : { left: triggerSize / 2 - halfFootprint })
85
+ // A centered box is wider than its trigger, so its caret is never near a corner; a box aligned to
86
+ // a side keeps the caret's whole base (the ring's, the wider of the two) past its rounded corner.
87
+ const caretCenter = align === 'center' ? triggerSize / 2 : Math.max(triggerSize / 2, cornerRadius + ringSize)
88
+ const caretOffset = (halfFootprint: number): ViewStyle => (align === 'right' ? { right: caretCenter - halfFootprint } : { left: caretCenter - halfFootprint })
77
89
  // Below the trigger: caret sits at content's top edge, apex pointing up (a filled border-bottom
78
90
  // makes an apex-up triangle), dipping upward past that edge. Above the trigger: mirrored - caret
79
91
  // sits at content's bottom edge, apex pointing down (filled border-top), dipping downward past it.
@@ -6,6 +6,9 @@ import { useWellColors, WELL_SHADOW } from './wellSurface'
6
6
 
7
7
  interface Props {
8
8
  label: string
9
+ // A short key at the right end of the heading line, over the rows' values (a record's "W-L-D"), in the
10
+ // well's muted text. Omit it and the heading is the label alone, as it always was.
11
+ caption?: string
9
12
  // Independently optional overrides for this section's own label color/background - default to the well's
10
13
  // (wellSurface.ts: the theme's surface and its onSurface text).
11
14
  fg?: string
@@ -19,22 +22,44 @@ interface Props {
19
22
  // overridable via the matching prop for a caller with its own chrome palette. It was a faint tint until
20
23
  // 2026-10-17 (6% white in dark mode, 4% black in light). The label itself carries the section's own meaning
21
24
  // (what it's a section OF), so this component has no opinion on that beyond rendering the string it's given.
22
- export function StatSection({ label, fg: fgOverride, sectionBg: sectionBgOverride, children }: Props) {
25
+ export function StatSection({ label, caption, fg: fgOverride, sectionBg: sectionBgOverride, children }: Props) {
23
26
  const well = useWellColors()
24
27
  const fg = fgOverride ?? well.fg
25
28
  const sectionBg = sectionBgOverride ?? well.bg
29
+ const heading = (
30
+ <Text variant='labelMedium' style={[styles.label, { color: fg }]}>
31
+ {label}
32
+ </Text>
33
+ )
26
34
 
27
35
  return (
28
36
  <View style={[styles.section, { backgroundColor: sectionBg }]}>
29
- <Text variant='labelMedium' style={[styles.label, { color: fg }]}>
30
- {label}
31
- </Text>
37
+ {caption ? (
38
+ <View style={styles.heading}>
39
+ {heading}
40
+ <Text variant='labelMedium' style={[styles.caption, { color: well.fgMuted }]}>
41
+ {caption}
42
+ </Text>
43
+ </View>
44
+ ) : (
45
+ heading
46
+ )}
32
47
  {children}
33
48
  </View>
34
49
  )
35
50
  }
36
51
 
37
52
  const styles = StyleSheet.create({
53
+ // The label's spacing, without its weight: a key to the values, not a second heading
54
+ caption: {
55
+ letterSpacing: 2
56
+ },
57
+ heading: {
58
+ alignItems: 'baseline',
59
+ flexDirection: 'row',
60
+ gap: 12,
61
+ justifyContent: 'space-between'
62
+ },
38
63
  // Bold and full-contrast (fg), not the original fontless/fgMuted treatment - that read at the
39
64
  // same visual weight as StatRow's own row labels below it (both used the identical muted color;
40
65
  // letterSpacing/variant alone didn't separate them enough to read as "this is the group header"