@tastic/hud 0.30.1 → 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 +11 -1
- package/dist/chrome/index.d.mts +4 -2
- package/dist/chrome/index.d.ts +4 -2
- package/dist/chrome/index.js +21 -5
- package/dist/chrome/index.mjs +2 -2
- package/dist/{chunk-4666H2UG.mjs → chunk-3DHXNGQS.mjs} +18 -4
- package/dist/{chunk-CPNDNJJR.mjs → chunk-Z6SOVTKT.mjs} +1 -1
- package/dist/{chunk-5ECU3722.mjs → chunk-ZZEW6AF5.mjs} +4 -2
- package/dist/index.js +21 -5
- package/dist/index.mjs +7 -7
- package/dist/lobby/index.js +4 -2
- package/dist/lobby/index.mjs +2 -2
- package/package.json +1 -1
- package/src/BaseSettingsDialog.tsx +13 -9
- package/src/PopoverBody.tsx +14 -2
- package/src/StatSection.tsx +29 -4
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
|
package/dist/chrome/index.d.mts
CHANGED
|
@@ -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;
|
package/dist/chrome/index.d.ts
CHANGED
|
@@ -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;
|
package/dist/chrome/index.js
CHANGED
|
@@ -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.
|
|
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
|
|
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;
|
|
@@ -895,13 +909,15 @@ var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
|
895
909
|
var CARET_SIZE = 7;
|
|
896
910
|
var CARET_RING_OFFSET = 2;
|
|
897
911
|
var CARET_DIP = 1;
|
|
898
|
-
|
|
912
|
+
var BOX_RADIUS = 12;
|
|
913
|
+
function PopoverBody({ visible, children, align = "center", verticalAlign = "below", caretColor, caretBorderColor, caretBorderWidth = 1, triggerSize = 0, cornerRadius = BOX_RADIUS }) {
|
|
899
914
|
if (!visible) return null;
|
|
900
915
|
const above = verticalAlign === "above";
|
|
901
916
|
const alignStyle = align === "left" ? styles13.contentLeft : align === "right" ? styles13.contentRight : styles13.contentCenter;
|
|
902
917
|
const verticalStyle = above ? styles13.contentAbove : styles13.contentBelow;
|
|
903
918
|
const ringSize = CARET_SIZE + caretBorderWidth;
|
|
904
|
-
const
|
|
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 };
|
|
905
921
|
const caretFill = above ? "borderTopColor" : "borderBottomColor";
|
|
906
922
|
const caretWidthProp = above ? "borderTopWidth" : "borderBottomWidth";
|
|
907
923
|
const caretEdge = (size) => above ? { bottom: -size + CARET_DIP } : { top: -size + CARET_DIP };
|
package/dist/chrome/index.mjs
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
getStaggeredWordDuration,
|
|
19
19
|
useCompactDialog,
|
|
20
20
|
useWellColors
|
|
21
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-3DHXNGQS.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-
|
|
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-
|
|
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__ */
|
|
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
|
|
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;
|
|
@@ -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
|
-
|
|
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
|
|
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.
|
|
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
|
|
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;
|
|
@@ -1079,13 +1093,15 @@ var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
|
1079
1093
|
var CARET_SIZE = 7;
|
|
1080
1094
|
var CARET_RING_OFFSET = 2;
|
|
1081
1095
|
var CARET_DIP = 1;
|
|
1082
|
-
|
|
1096
|
+
var BOX_RADIUS = 12;
|
|
1097
|
+
function PopoverBody({ visible, children, align = "center", verticalAlign = "below", caretColor, caretBorderColor, caretBorderWidth = 1, triggerSize = 0, cornerRadius = BOX_RADIUS }) {
|
|
1083
1098
|
if (!visible) return null;
|
|
1084
1099
|
const above = verticalAlign === "above";
|
|
1085
1100
|
const alignStyle = align === "left" ? styles13.contentLeft : align === "right" ? styles13.contentRight : styles13.contentCenter;
|
|
1086
1101
|
const verticalStyle = above ? styles13.contentAbove : styles13.contentBelow;
|
|
1087
1102
|
const ringSize = CARET_SIZE + caretBorderWidth;
|
|
1088
|
-
const
|
|
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 };
|
|
1089
1105
|
const caretFill = above ? "borderTopColor" : "borderBottomColor";
|
|
1090
1106
|
const caretWidthProp = above ? "borderTopWidth" : "borderBottomWidth";
|
|
1091
1107
|
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-
|
|
21
|
+
} from "./chunk-3DHXNGQS.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-
|
|
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-
|
|
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";
|
package/dist/lobby/index.js
CHANGED
|
@@ -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
|
-
|
|
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
|
|
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 };
|
package/dist/lobby/index.mjs
CHANGED
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
getCpuDifficultyPopoverId,
|
|
7
7
|
getProfilePopoverId,
|
|
8
8
|
useZoneClampedAlign
|
|
9
|
-
} from "../chunk-
|
|
10
|
-
import "../chunk-
|
|
9
|
+
} from "../chunk-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.
|
|
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).
|
|
57
|
-
//
|
|
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
|
|
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
|
|
247
|
-
swizzle to read
|
|
248
|
-
and the bottom (home-indicator swipe, incidentally
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
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}>
|
package/src/PopoverBody.tsx
CHANGED
|
@@ -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
|
-
|
|
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.
|
package/src/StatSection.tsx
CHANGED
|
@@ -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
|
-
|
|
30
|
-
{
|
|
31
|
-
|
|
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"
|