@tastic/hud 0.15.0 → 0.16.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
@@ -52,7 +52,13 @@ corner of the screen.
52
52
  instead of reusing this component there, a real (if minor) missed-reuse case worth fixing next
53
53
  time one of those screens gets touched. Not the right fit for a screen where the top corners fall
54
54
  *inside* one player's own rotated zone (two-player face-to-face) - see `SharedActionBand` for
55
- that case instead.
55
+ that case instead. Each button's touch target is its own 40pt box. Pass the optional `hitSlop`
56
+ (a number or `Insets`, forwarded to both buttons) to grow it without changing anything visible:
57
+ `hitSlop={4}` makes a 48pt target, and the glyphs and press ripple stay as they are. It needs
58
+ `@rific/feedback-press` 0.13.0 or later, whose `IconButton` makes `hitSlop` reach past Paper's
59
+ clipped box (older versions silently ignore it). Omit it to keep the 40pt target. Leave room for
60
+ it: the slop reaches past each button's box, and where it overlaps another touch target,
61
+ whichever is drawn on top gets the press.
56
62
  - **`StaggeredWord`** / **`getStaggeredWordDuration`** - the letter-by-letter stagger-in animation
57
63
  every app's own hero-title screen had hand-rolled independently, identical down to the same 45ms
58
64
  stagger, 320ms per-letter duration, and back-ease overshoot. Renders one word/line at a time - a
@@ -2,7 +2,7 @@ import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
3
  import { AchievementCatalogRow } from '@tastic/achievements';
4
4
  import { ViewRotation } from '@tastic/core';
5
- import { StyleProp, ViewStyle, TextStyle, LayoutChangeEvent } from 'react-native';
5
+ import { StyleProp, ViewStyle, Insets, TextStyle, LayoutChangeEvent } from 'react-native';
6
6
 
7
7
  interface Props$7 {
8
8
  rows: AchievementCatalogRow[];
@@ -113,8 +113,9 @@ interface Props$2 {
113
113
  };
114
114
  backIcon?: string;
115
115
  backLabel?: string;
116
+ hitSlop?: number | Insets;
116
117
  }
117
- declare function CornerActionButtons({ onBack, onSettings, fg, insets, backIcon, backLabel }: Props$2): react.JSX.Element;
118
+ declare function CornerActionButtons({ onBack, onSettings, fg, insets, backIcon, backLabel, hitSlop }: Props$2): react.JSX.Element;
118
119
 
119
120
  declare const MONO_FONT: string;
120
121
 
@@ -2,7 +2,7 @@ import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
3
  import { AchievementCatalogRow } from '@tastic/achievements';
4
4
  import { ViewRotation } from '@tastic/core';
5
- import { StyleProp, ViewStyle, TextStyle, LayoutChangeEvent } from 'react-native';
5
+ import { StyleProp, ViewStyle, Insets, TextStyle, LayoutChangeEvent } from 'react-native';
6
6
 
7
7
  interface Props$7 {
8
8
  rows: AchievementCatalogRow[];
@@ -113,8 +113,9 @@ interface Props$2 {
113
113
  };
114
114
  backIcon?: string;
115
115
  backLabel?: string;
116
+ hitSlop?: number | Insets;
116
117
  }
117
- declare function CornerActionButtons({ onBack, onSettings, fg, insets, backIcon, backLabel }: Props$2): react.JSX.Element;
118
+ declare function CornerActionButtons({ onBack, onSettings, fg, insets, backIcon, backLabel, hitSlop }: Props$2): react.JSX.Element;
118
119
 
119
120
  declare const MONO_FONT: string;
120
121
 
@@ -693,10 +693,10 @@ var styles9 = import_react_native11.StyleSheet.create({
693
693
  var import_feedback_press4 = require("@rific/feedback-press");
694
694
  var import_react_native12 = require("react-native");
695
695
  var import_jsx_runtime11 = require("react/jsx-runtime");
696
- function CornerActionButtons({ onBack, onSettings, fg, insets, backIcon = "arrow-left", backLabel = "Back" }) {
696
+ function CornerActionButtons({ onBack, onSettings, fg, insets, backIcon = "arrow-left", backLabel = "Back", hitSlop }) {
697
697
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
698
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_feedback_press4.IconButton, { icon: backIcon, iconColor: fg, size: 24, style: [styles10.back, { top: 8 + insets.top, left: 8 + insets.left }], onPress: onBack, accessibilityLabel: backLabel }),
699
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_feedback_press4.IconButton, { icon: "cog", iconColor: fg, size: 24, style: [styles10.topRight, { top: 8 + insets.top, right: 8 + insets.right }], onPress: onSettings, accessibilityLabel: "Settings" })
698
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_feedback_press4.IconButton, { icon: backIcon, iconColor: fg, size: 24, style: [styles10.back, { top: 8 + insets.top, left: 8 + insets.left }], hitSlop, onPress: onBack, accessibilityLabel: backLabel }),
699
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_feedback_press4.IconButton, { icon: "cog", iconColor: fg, size: 24, style: [styles10.topRight, { top: 8 + insets.top, right: 8 + insets.right }], hitSlop, onPress: onSettings, accessibilityLabel: "Settings" })
700
700
  ] });
701
701
  }
702
702
  var styles10 = import_react_native12.StyleSheet.create({
@@ -15,7 +15,7 @@ import {
15
15
  StatSection,
16
16
  UpdateDialog,
17
17
  getStaggeredWordDuration
18
- } from "../chunk-OTMMST5M.mjs";
18
+ } from "../chunk-JXRBXQLQ.mjs";
19
19
  import {
20
20
  getOverlayCardColors,
21
21
  overlayActionStyles,
@@ -569,10 +569,10 @@ var styles9 = StyleSheet9.create({
569
569
  import { IconButton as IconButton2 } from "@rific/feedback-press";
570
570
  import { StyleSheet as StyleSheet10 } from "react-native";
571
571
  import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
572
- function CornerActionButtons({ onBack, onSettings, fg, insets, backIcon = "arrow-left", backLabel = "Back" }) {
572
+ function CornerActionButtons({ onBack, onSettings, fg, insets, backIcon = "arrow-left", backLabel = "Back", hitSlop }) {
573
573
  return /* @__PURE__ */ jsxs10(Fragment2, { children: [
574
- /* @__PURE__ */ jsx11(IconButton2, { icon: backIcon, iconColor: fg, size: 24, style: [styles10.back, { top: 8 + insets.top, left: 8 + insets.left }], onPress: onBack, accessibilityLabel: backLabel }),
575
- /* @__PURE__ */ jsx11(IconButton2, { icon: "cog", iconColor: fg, size: 24, style: [styles10.topRight, { top: 8 + insets.top, right: 8 + insets.right }], onPress: onSettings, accessibilityLabel: "Settings" })
574
+ /* @__PURE__ */ jsx11(IconButton2, { icon: backIcon, iconColor: fg, size: 24, style: [styles10.back, { top: 8 + insets.top, left: 8 + insets.left }], hitSlop, onPress: onBack, accessibilityLabel: backLabel }),
575
+ /* @__PURE__ */ jsx11(IconButton2, { icon: "cog", iconColor: fg, size: 24, style: [styles10.topRight, { top: 8 + insets.top, right: 8 + insets.right }], hitSlop, onPress: onSettings, accessibilityLabel: "Settings" })
576
576
  ] });
577
577
  }
578
578
  var styles10 = StyleSheet10.create({
package/dist/index.js CHANGED
@@ -1251,10 +1251,10 @@ function ControlSchemePicker({ id, host, value, onChange, options, takenValue, a
1251
1251
  var import_feedback_press5 = require("@rific/feedback-press");
1252
1252
  var import_react_native18 = require("react-native");
1253
1253
  var import_jsx_runtime18 = require("react/jsx-runtime");
1254
- function CornerActionButtons({ onBack, onSettings, fg, insets, backIcon = "arrow-left", backLabel = "Back" }) {
1254
+ function CornerActionButtons({ onBack, onSettings, fg, insets, backIcon = "arrow-left", backLabel = "Back", hitSlop }) {
1255
1255
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
1256
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_feedback_press5.IconButton, { icon: backIcon, iconColor: fg, size: 24, style: [styles14.back, { top: 8 + insets.top, left: 8 + insets.left }], onPress: onBack, accessibilityLabel: backLabel }),
1257
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_feedback_press5.IconButton, { icon: "cog", iconColor: fg, size: 24, style: [styles14.topRight, { top: 8 + insets.top, right: 8 + insets.right }], onPress: onSettings, accessibilityLabel: "Settings" })
1256
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_feedback_press5.IconButton, { icon: backIcon, iconColor: fg, size: 24, style: [styles14.back, { top: 8 + insets.top, left: 8 + insets.left }], hitSlop, onPress: onBack, accessibilityLabel: backLabel }),
1257
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_feedback_press5.IconButton, { icon: "cog", iconColor: fg, size: 24, style: [styles14.topRight, { top: 8 + insets.top, right: 8 + insets.right }], hitSlop, onPress: onSettings, accessibilityLabel: "Settings" })
1258
1258
  ] });
1259
1259
  }
1260
1260
  var styles14 = import_react_native18.StyleSheet.create({
package/dist/index.mjs CHANGED
@@ -18,7 +18,7 @@ import {
18
18
  StatSection,
19
19
  UpdateDialog,
20
20
  getStaggeredWordDuration
21
- } from "./chunk-OTMMST5M.mjs";
21
+ } from "./chunk-JXRBXQLQ.mjs";
22
22
  import {
23
23
  getOverlayCardColors,
24
24
  overlayActionStyles,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tastic/hud",
3
- "version": "0.15.0",
3
+ "version": "0.16.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",
@@ -1,5 +1,5 @@
1
1
  import { IconButton } from '@rific/feedback-press'
2
- import { StyleSheet } from 'react-native'
2
+ import { type Insets, StyleSheet } from 'react-native'
3
3
 
4
4
  interface Props {
5
5
  onBack: () => void
@@ -20,6 +20,14 @@ interface Props {
20
20
  // together - an icon without a matching label (or vice versa) misleads screen readers/tooltips.
21
21
  backIcon?: string
22
22
  backLabel?: string
23
+ // Opt-in extra touch area on both buttons, forwarded as each IconButton's own hitSlop (RN's
24
+ // number | Insets). Each button's target is its 40pt box (24pt glyph plus Paper's 8pt padding), so
25
+ // 4 makes it 48pt. Nothing visible changes: the glyphs, the press ripple and the 8pt corner offset
26
+ // all stay put. Needs @rific/feedback-press 0.13.0 or later, whose IconButton makes hitSlop reach
27
+ // past Paper's clipped box; on older versions it's silently ignored. Omitted means no slop, as
28
+ // before. The caller owns what sits near its corners, so it's the one that knows how much room
29
+ // there is.
30
+ hitSlop?: number | Insets
23
31
  }
24
32
 
25
33
  // Back (top-left) + Settings (top-right) icon buttons, fixed at the screen's rotated corners - the
@@ -28,11 +36,11 @@ interface Props {
28
36
  // right answer for a screen where the top corners themselves fall *inside* one player's own rotated
29
37
  // zone (two-player face-to-face) - see SharedActionBand for that case instead, which callers select
30
38
  // between based on their own game-mode/orientation state (this component has no opinion on which).
31
- export function CornerActionButtons({ onBack, onSettings, fg, insets, backIcon = 'arrow-left', backLabel = 'Back' }: Props) {
39
+ export function CornerActionButtons({ onBack, onSettings, fg, insets, backIcon = 'arrow-left', backLabel = 'Back', hitSlop }: Props) {
32
40
  return (
33
41
  <>
34
- <IconButton icon={backIcon} iconColor={fg} size={24} style={[styles.back, { top: 8 + insets.top, left: 8 + insets.left }]} onPress={onBack} accessibilityLabel={backLabel} />
35
- <IconButton icon='cog' iconColor={fg} size={24} style={[styles.topRight, { top: 8 + insets.top, right: 8 + insets.right }]} onPress={onSettings} accessibilityLabel='Settings' />
42
+ <IconButton icon={backIcon} iconColor={fg} size={24} style={[styles.back, { top: 8 + insets.top, left: 8 + insets.left }]} hitSlop={hitSlop} onPress={onBack} accessibilityLabel={backLabel} />
43
+ <IconButton icon='cog' iconColor={fg} size={24} style={[styles.topRight, { top: 8 + insets.top, right: 8 + insets.right }]} hitSlop={hitSlop} onPress={onSettings} accessibilityLabel='Settings' />
36
44
  </>
37
45
  )
38
46
  }