@tastic/hud 0.30.0 → 0.31.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
@@ -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
@@ -542,6 +549,9 @@ on MD3's level-1 shadow, with `onSurface`/`onSurfaceVariant` text. `useWellColor
542
549
  `WELL_SHADOW` the shadow, for an app's own cards (a menu tile) to match. Each component's `fg`/`fgMuted`/`sectionBg`
543
550
  props still override them.
544
551
 
552
+ **Captions.** `StatSection` takes an optional `caption`, a short key at the right end of its heading line over the rows'
553
+ values, in the well's muted text: `<StatSection label='BY MODE' caption='W-L-D'>` over rows reading "3-2-0".
554
+
545
555
  Composing both with `@tastic/achievements`' own row computation:
546
556
 
547
557
  ```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,7 +561,7 @@ 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;
@@ -733,11 +747,14 @@ var styles9 = import_react_native12.StyleSheet.create({
733
747
  overflow: "hidden",
734
748
  paddingVertical: 10
735
749
  },
736
- // Same shape as toggleButton, `flex: 1` instead of its own width - two of these side by side in
737
- // toggleRow share the row's own edge alignment instead of each carrying their own.
750
+ // Same shape as toggleButton, half the row instead of its own width - two of these side by side in
751
+ // toggleRow share the row's own edge alignment instead of each carrying their own. Two to a row:
752
+ // three (Sound, Music, Haptics) don't fit across a phone's dialog (Haptics was cut off on a 402pt
753
+ // iPhone), so a third wraps onto its own row and grows to fill it, like the full-width rows above.
738
754
  toggleButtonInRow: {
739
755
  borderRadius: 12,
740
- flex: 1,
756
+ flexBasis: "45%",
757
+ flexGrow: 1,
741
758
  overflow: "hidden",
742
759
  paddingVertical: 10
743
760
  },
@@ -756,6 +773,7 @@ var styles9 = import_react_native12.StyleSheet.create({
756
773
  // No horizontal margin of its own now either - see toggleButton's identical note.
757
774
  toggleRow: {
758
775
  flexDirection: "row",
776
+ flexWrap: "wrap",
759
777
  gap: 4
760
778
  }
761
779
  });
@@ -891,13 +909,15 @@ var import_jsx_runtime15 = require("react/jsx-runtime");
891
909
  var CARET_SIZE = 7;
892
910
  var CARET_RING_OFFSET = 2;
893
911
  var CARET_DIP = 1;
894
- function PopoverBody({ visible, children, align = "center", verticalAlign = "below", caretColor, caretBorderColor, caretBorderWidth = 1, triggerSize = 0 }) {
912
+ var BOX_RADIUS = 12;
913
+ function PopoverBody({ visible, children, align = "center", verticalAlign = "below", caretColor, caretBorderColor, caretBorderWidth = 1, triggerSize = 0, cornerRadius = BOX_RADIUS }) {
895
914
  if (!visible) return null;
896
915
  const above = verticalAlign === "above";
897
916
  const alignStyle = align === "left" ? styles13.contentLeft : align === "right" ? styles13.contentRight : styles13.contentCenter;
898
917
  const verticalStyle = above ? styles13.contentAbove : styles13.contentBelow;
899
918
  const ringSize = CARET_SIZE + caretBorderWidth;
900
- const caretOffset = (halfFootprint) => align === "right" ? { right: triggerSize / 2 - halfFootprint } : { left: triggerSize / 2 - halfFootprint };
919
+ const caretCenter = align === "center" ? triggerSize / 2 : Math.max(triggerSize / 2, cornerRadius + ringSize);
920
+ const caretOffset = (halfFootprint) => align === "right" ? { right: caretCenter - halfFootprint } : { left: caretCenter - halfFootprint };
901
921
  const caretFill = above ? "borderTopColor" : "borderBottomColor";
902
922
  const caretWidthProp = above ? "borderTopWidth" : "borderBottomWidth";
903
923
  const caretEdge = (size) => above ? { bottom: -size + CARET_DIP } : { top: -size + CARET_DIP };
@@ -18,15 +18,7 @@ import {
18
18
  getStaggeredWordDuration,
19
19
  useCompactDialog,
20
20
  useWellColors
21
- } from "../chunk-VDPL2WUK.mjs";
22
- import {
23
- InlineColorPicker,
24
- MONO_FONT,
25
- PopoverBody,
26
- getInlineColorPickerContentSize,
27
- useAutoAlign,
28
- usePopoverHost
29
- } from "../chunk-5ECU3722.mjs";
21
+ } from "../chunk-3DHXNGQS.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-ZZEW6AF5.mjs";
41
41
  export {
42
42
  AchievementCatalogSection,
43
43
  AchievementRow,
@@ -1,6 +1,3 @@
1
- import {
2
- MONO_FONT
3
- } from "./chunk-5ECU3722.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-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,7 +361,7 @@ 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;
@@ -533,11 +547,14 @@ var styles7 = StyleSheet7.create({
533
547
  overflow: "hidden",
534
548
  paddingVertical: 10
535
549
  },
536
- // Same shape as toggleButton, `flex: 1` instead of its own width - two of these side by side in
537
- // toggleRow share the row's own edge alignment instead of each carrying their own.
550
+ // Same shape as toggleButton, half the row instead of its own width - two of these side by side in
551
+ // toggleRow share the row's own edge alignment instead of each carrying their own. Two to a row:
552
+ // three (Sound, Music, Haptics) don't fit across a phone's dialog (Haptics was cut off on a 402pt
553
+ // iPhone), so a third wraps onto its own row and grows to fill it, like the full-width rows above.
538
554
  toggleButtonInRow: {
539
555
  borderRadius: 12,
540
- flex: 1,
556
+ flexBasis: "45%",
557
+ flexGrow: 1,
541
558
  overflow: "hidden",
542
559
  paddingVertical: 10
543
560
  },
@@ -556,6 +573,7 @@ var styles7 = StyleSheet7.create({
556
573
  // No horizontal margin of its own now either - see toggleButton's identical note.
557
574
  toggleRow: {
558
575
  flexDirection: "row",
576
+ flexWrap: "wrap",
559
577
  gap: 4
560
578
  }
561
579
  });
@@ -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,7 +760,7 @@ 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;
@@ -932,11 +946,14 @@ var styles10 = import_react_native13.StyleSheet.create({
932
946
  overflow: "hidden",
933
947
  paddingVertical: 10
934
948
  },
935
- // Same shape as toggleButton, `flex: 1` instead of its own width - two of these side by side in
936
- // toggleRow share the row's own edge alignment instead of each carrying their own.
949
+ // Same shape as toggleButton, half the row instead of its own width - two of these side by side in
950
+ // toggleRow share the row's own edge alignment instead of each carrying their own. Two to a row:
951
+ // three (Sound, Music, Haptics) don't fit across a phone's dialog (Haptics was cut off on a 402pt
952
+ // iPhone), so a third wraps onto its own row and grows to fill it, like the full-width rows above.
937
953
  toggleButtonInRow: {
938
954
  borderRadius: 12,
939
- flex: 1,
955
+ flexBasis: "45%",
956
+ flexGrow: 1,
940
957
  overflow: "hidden",
941
958
  paddingVertical: 10
942
959
  },
@@ -955,6 +972,7 @@ var styles10 = import_react_native13.StyleSheet.create({
955
972
  // No horizontal margin of its own now either - see toggleButton's identical note.
956
973
  toggleRow: {
957
974
  flexDirection: "row",
975
+ flexWrap: "wrap",
958
976
  gap: 4
959
977
  }
960
978
  });
@@ -1075,13 +1093,15 @@ var import_jsx_runtime15 = require("react/jsx-runtime");
1075
1093
  var CARET_SIZE = 7;
1076
1094
  var CARET_RING_OFFSET = 2;
1077
1095
  var CARET_DIP = 1;
1078
- function PopoverBody({ visible, children, align = "center", verticalAlign = "below", caretColor, caretBorderColor, caretBorderWidth = 1, triggerSize = 0 }) {
1096
+ var BOX_RADIUS = 12;
1097
+ function PopoverBody({ visible, children, align = "center", verticalAlign = "below", caretColor, caretBorderColor, caretBorderWidth = 1, triggerSize = 0, cornerRadius = BOX_RADIUS }) {
1079
1098
  if (!visible) return null;
1080
1099
  const above = verticalAlign === "above";
1081
1100
  const alignStyle = align === "left" ? styles13.contentLeft : align === "right" ? styles13.contentRight : styles13.contentCenter;
1082
1101
  const verticalStyle = above ? styles13.contentAbove : styles13.contentBelow;
1083
1102
  const ringSize = CARET_SIZE + caretBorderWidth;
1084
- const caretOffset = (halfFootprint) => align === "right" ? { right: triggerSize / 2 - halfFootprint } : { left: triggerSize / 2 - halfFootprint };
1103
+ const caretCenter = align === "center" ? triggerSize / 2 : Math.max(triggerSize / 2, cornerRadius + ringSize);
1104
+ const caretOffset = (halfFootprint) => align === "right" ? { right: caretCenter - halfFootprint } : { left: caretCenter - halfFootprint };
1085
1105
  const caretFill = above ? "borderTopColor" : "borderBottomColor";
1086
1106
  const caretWidthProp = above ? "borderTopWidth" : "borderBottomWidth";
1087
1107
  const caretEdge = (size) => above ? { bottom: -size + CARET_DIP } : { top: -size + CARET_DIP };
package/dist/index.mjs CHANGED
@@ -18,7 +18,18 @@ import {
18
18
  getStaggeredWordDuration,
19
19
  useCompactDialog,
20
20
  useWellColors
21
- } from "./chunk-VDPL2WUK.mjs";
21
+ } from "./chunk-3DHXNGQS.mjs";
22
+ import {
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";
22
33
  import {
23
34
  PlayerSetupPanel,
24
35
  ReadyButton,
@@ -27,7 +38,7 @@ import {
27
38
  getCpuDifficultyPopoverId,
28
39
  getProfilePopoverId,
29
40
  useZoneClampedAlign
30
- } from "./chunk-CPNDNJJR.mjs";
41
+ } from "./chunk-Z6SOVTKT.mjs";
31
42
  import {
32
43
  InlineColorPicker,
33
44
  MONO_FONT,
@@ -35,22 +46,11 @@ import {
35
46
  getInlineColorPickerContentSize,
36
47
  useAutoAlign,
37
48
  usePopoverHost
38
- } from "./chunk-5ECU3722.mjs";
49
+ } from "./chunk-ZZEW6AF5.mjs";
39
50
  import {
40
51
  loadSkiaWeb,
41
52
  locateSkiaWebFile
42
53
  } from "./chunk-3TCJHMJP.mjs";
43
- import {
44
- COMPACT_DIALOG_HEIGHT,
45
- DialogHeader,
46
- OverlayBackdrop,
47
- OverlayCard,
48
- SecondaryButton,
49
- isCompactDialogHeight,
50
- overlayActionStyles,
51
- overlayStyles,
52
- useOverlayCardColors
53
- } from "./chunk-CBH7GQKI.mjs";
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.0",
3
+ "version": "0.31.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",
@@ -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
@@ -243,12 +244,15 @@ export function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverr
243
244
  </TouchableRipple>
244
245
  )}
245
246
 
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. */}
247
+ {/* iOS and Android. On iOS the app mirrors it into UserDefaults for
248
+ @tastic/edge-guard's config plugin swizzle to read, guarding the top (Notification
249
+ Center/Control Center) and the bottom (home-indicator swipe, incidentally
250
+ Reachability too). On Android the app hands it to edge-guard's
251
+ edgeGuardScreenOptions, which hides the system bars on the play screen in sticky
252
+ immersive mode, so a swipe from any edge only brings them back for a moment. Either
253
+ way it's the same "Require second swipe". Off by default: a deliberate opt-in for
254
+ whoever's actually hit an accidental-swipe-near-an-edge problem mid-game and come
255
+ looking for a fix, not a surprise every player gets by default. */}
252
256
  {showEdgeGuard && (
253
257
  <TouchableRipple onPress={() => onDeferBottomEdgeGestures!(!deferBottomEdgeGestures)} style={styles.toggleButton} accessibilityLabel={`Edge guard ${deferBottomEdgeGestures ? 'on' : 'off'}`}>
254
258
  <View style={styles.toggleContent}>
@@ -507,11 +511,14 @@ const styles = StyleSheet.create({
507
511
  overflow: 'hidden',
508
512
  paddingVertical: 10
509
513
  },
510
- // Same shape as toggleButton, `flex: 1` instead of its own width - two of these side by side in
511
- // toggleRow share the row's own edge alignment instead of each carrying their own.
514
+ // Same shape as toggleButton, half the row instead of its own width - two of these side by side in
515
+ // toggleRow share the row's own edge alignment instead of each carrying their own. Two to a row:
516
+ // three (Sound, Music, Haptics) don't fit across a phone's dialog (Haptics was cut off on a 402pt
517
+ // iPhone), so a third wraps onto its own row and grows to fill it, like the full-width rows above.
512
518
  toggleButtonInRow: {
513
519
  borderRadius: 12,
514
- flex: 1,
520
+ flexBasis: '45%',
521
+ flexGrow: 1,
515
522
  overflow: 'hidden',
516
523
  paddingVertical: 10
517
524
  },
@@ -530,6 +537,7 @@ const styles = StyleSheet.create({
530
537
  // No horizontal margin of its own now either - see toggleButton's identical note.
531
538
  toggleRow: {
532
539
  flexDirection: 'row',
540
+ flexWrap: 'wrap',
533
541
  gap: 4
534
542
  }
535
543
  })
@@ -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"