@tastic/hud 0.15.0 → 0.17.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 +52 -3
- package/dist/chrome/index.d.mts +29 -3
- package/dist/chrome/index.d.ts +29 -3
- package/dist/chrome/index.js +138 -104
- package/dist/chrome/index.mjs +10 -4
- package/dist/{chunk-OTMMST5M.mjs → chunk-27FIA26F.mjs} +19 -11
- package/dist/{chunk-32U2OIRW.mjs → chunk-AX4GC5KU.mjs} +25 -1
- package/dist/guide/index.js +73 -57
- package/dist/guide/index.mjs +10 -6
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +251 -217
- package/dist/index.mjs +9 -3
- package/package.json +1 -1
- package/src/BaseSettingsDialog.tsx +22 -1
- package/src/ConfirmDialog.tsx +14 -12
- package/src/CornerActionButtons.tsx +12 -4
- package/src/OverlaySurface.tsx +62 -0
- package/src/chrome/index.ts +1 -0
- package/src/guide/HowToPlayDialog.tsx +14 -8
- package/src/index.ts +1 -0
- package/src/overlayCard.ts +13 -8
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
|
|
@@ -70,6 +76,9 @@ corner of the screen.
|
|
|
70
76
|
out after being independently copied into several games. See Rotation below for how each of these
|
|
71
77
|
(plus `SectionedDropdown`/`InlineColorPicker`) handles rotating inside a `@tastic/split-screen`
|
|
72
78
|
zone.
|
|
79
|
+
- **`OverlayCard`** / **`OverlayBackdrop`** / **`useOverlayCardColors`** - the card and dim behind
|
|
80
|
+
`ConfirmDialog` and the how-to-play guide, in the app's own theme colors and blurred when the
|
|
81
|
+
player's Blur setting allows it. See Overlay cards below.
|
|
73
82
|
|
|
74
83
|
## Rotation
|
|
75
84
|
|
|
@@ -229,6 +238,45 @@ export function SettingsDialog({ visible, onDismiss, rotation = 0, settings, set
|
|
|
229
238
|
}
|
|
230
239
|
```
|
|
231
240
|
|
|
241
|
+
## Overlay cards (`OverlayCard`, `OverlayBackdrop`, `useOverlayCardColors`)
|
|
242
|
+
|
|
243
|
+
`ConfirmDialog` and `HowToPlayDialog` draw their card and the dim behind it with these, and a game's
|
|
244
|
+
own overlay (a result banner, a game-over card) should too, so every card in the fleet looks the same:
|
|
245
|
+
|
|
246
|
+
```tsx
|
|
247
|
+
import { OverlayBackdrop, OverlayCard, overlayActionStyles, useOverlayCardColors } from '@tastic/hud'
|
|
248
|
+
|
|
249
|
+
function GameOverCard({ onRestart }: { onRestart: () => void }) {
|
|
250
|
+
const { fg, fgMuted } = useOverlayCardColors()
|
|
251
|
+
return (
|
|
252
|
+
<OverlayBackdrop>
|
|
253
|
+
<OverlayCard accessibilityViewIsModal>
|
|
254
|
+
<Text style={{ color: fg }}>Game Over</Text>
|
|
255
|
+
<Text style={{ color: fgMuted }}>Score 42</Text>
|
|
256
|
+
<View style={overlayActionStyles.actions}>...</View>
|
|
257
|
+
</OverlayCard>
|
|
258
|
+
</OverlayBackdrop>
|
|
259
|
+
)
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
- **Colors come from the app's theme.** Text is `onSurface` (`fg`) and `onSurfaceVariant` (`fgMuted`),
|
|
264
|
+
the edge is `outlineVariant`, and the dim is the theme's `backdrop`, the same scrim auto-paper's own
|
|
265
|
+
`Dialog` uses. The card is auto-paper's `BlurView` at elevation 3: the theme's surface with a light
|
|
266
|
+
wash of its primary, MD3's dialog color. So a card follows each game's palette and light/dark mode.
|
|
267
|
+
- **Blur is automatic.** The card blurs what's behind it when the player's Blur setting is on and the
|
|
268
|
+
app hands `expo-blur` to auto-paper's `Provider` (`expoBlur={ExpoBlur}`). Otherwise it paints that
|
|
269
|
+
raised surface color instead: on Android (`BlurView` needs a blur target there, which a card has
|
|
270
|
+
none of), in an app without `expo-blur`, or with Blur off. Beyond passing `expoBlur`, a game wires
|
|
271
|
+
nothing for this.
|
|
272
|
+
- **The Blur setting lives in `BaseSettingsDialog`.** Its APPEARANCE section shows a Blur row under the
|
|
273
|
+
appearance picker that flips auto-paper's own `blur` theme setting, which the settings sheet, Paper
|
|
274
|
+
menus and these cards all follow. The row only shows where blur can actually happen: not on
|
|
275
|
+
Android, not in an app that never passed `expoBlur`, and not with `hideAppearance`.
|
|
276
|
+
- **`getOverlayCardColors(dark)` is deprecated.** It returns the old fixed black/white card
|
|
277
|
+
(`#F2F2F2`/`#111111`), which ignores the theme and never blurs. It stays until every game has moved
|
|
278
|
+
its own cards onto `OverlayCard`.
|
|
279
|
+
|
|
232
280
|
## Zone-aware popovers (`useZoneClampedAlign`)
|
|
233
281
|
|
|
234
282
|
`useAutoAlign` - and everything built on it, including `SectionedDropdown`, `InlineColorPicker`, and
|
|
@@ -559,7 +607,8 @@ touches the main barrel. It's for an app that has `@tastic/core` and `@rific/upd
|
|
|
559
607
|
- Stats: `BaseStatsScreen`, `StatSection`, `StatRow`, `AchievementRow`, `LOCKED_BADGE_COLOR`,
|
|
560
608
|
`AchievementCatalogSection`, `ActivityStatSection`
|
|
561
609
|
- Chrome: `CornerActionButtons`, `ContentGutter`, `StaggeredWord`, `getStaggeredWordDuration`
|
|
562
|
-
-
|
|
610
|
+
- Overlay cards: `OverlayCard`, `OverlayBackdrop`, `useOverlayCardColors`
|
|
611
|
+
- Style tokens: `overlayStyles`, `overlayActionStyles`, `MONO_FONT`, and the deprecated `getOverlayCardColors`
|
|
563
612
|
|
|
564
613
|
Each is the same component the main entry exports and is documented above. Only the import path changes:
|
|
565
614
|
|
|
@@ -613,7 +662,7 @@ resolve module".
|
|
|
613
662
|
| `react`, `react-native` | >=19.0.0, >=0.76.0 | every entry |
|
|
614
663
|
| `react-native-paper` | >=5.0.0 | main entry, `./guide`, `./chrome` |
|
|
615
664
|
| `react-native-reanimated` | >=3.0.0 | main entry (`StaggeredWord`), `./guide`, `./chrome` (`StaggeredWord`) |
|
|
616
|
-
| `@rific/auto-paper` | >=0.12.2 | main entry (`BaseSettingsDialog` needs the nested `Portal.Host` first shipped in 0.12.2), `./guide`, `./chrome` |
|
|
665
|
+
| `@rific/auto-paper` | >=0.12.2 | main entry (`BaseSettingsDialog` needs the nested `Portal.Host` first shipped in 0.12.2; `OverlayCard` uses `BlurView` and `useBlur`, and `BaseSettingsDialog`'s Blur row uses `useBlurModule` and `useThemeSettings`, all in 0.12.2), `./guide`, `./chrome` |
|
|
617
666
|
| `@rific/feedback-press` | >=0.10.2 | main entry (`useSoundSettings` first shipped in 0.10.2), `./guide`, `./chrome` |
|
|
618
667
|
| `react-native-safe-area-context` | >=5.0.0 | main entry (`useZoneClampedAlign`), `./chrome` (`RotatedFrame`, `BaseSettingsDialog`) |
|
|
619
668
|
| `@tastic/core` | >=0.12.0, optional | main entry: `useRotation()` and most dialogs; `RotatedFrame` and `BaseSettingsDialog` need `FakeLandscapeView`'s `rotation`/`passThrough`, first shipped in 0.12.0; `./chrome` (the same dialogs) |
|
package/dist/chrome/index.d.mts
CHANGED
|
@@ -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
|
|
|
@@ -124,6 +125,11 @@ interface OverlayCardColors {
|
|
|
124
125
|
cardBg: string;
|
|
125
126
|
cardBorder: string;
|
|
126
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* @deprecated The literal black/white card colors. hud's own cards moved to the theme-driven, blur-aware
|
|
130
|
+
* OverlayCard / OverlayBackdrop / useOverlayCardColors (OverlaySurface.tsx) on 2026-10-15; this stays
|
|
131
|
+
* only until every app's own result cards have moved over too.
|
|
132
|
+
*/
|
|
127
133
|
declare function getOverlayCardColors(dark: boolean): OverlayCardColors;
|
|
128
134
|
declare const overlayStyles: {
|
|
129
135
|
card: {
|
|
@@ -162,6 +168,26 @@ declare const overlayActionStyles: {
|
|
|
162
168
|
};
|
|
163
169
|
};
|
|
164
170
|
|
|
171
|
+
interface OverlayCardThemeColors {
|
|
172
|
+
fg: string;
|
|
173
|
+
fgMuted: string;
|
|
174
|
+
cardBorder: string;
|
|
175
|
+
backdrop: string;
|
|
176
|
+
}
|
|
177
|
+
declare function useOverlayCardColors(): OverlayCardThemeColors;
|
|
178
|
+
interface OverlayBackdropProps {
|
|
179
|
+
children?: ReactNode;
|
|
180
|
+
style?: StyleProp<ViewStyle>;
|
|
181
|
+
}
|
|
182
|
+
declare function OverlayBackdrop({ children, style }: OverlayBackdropProps): react.JSX.Element;
|
|
183
|
+
interface OverlayCardProps {
|
|
184
|
+
children?: ReactNode;
|
|
185
|
+
style?: StyleProp<ViewStyle>;
|
|
186
|
+
accessibilityViewIsModal?: boolean;
|
|
187
|
+
testID?: string;
|
|
188
|
+
}
|
|
189
|
+
declare function OverlayCard({ children, style, ...rest }: OverlayCardProps): react.JSX.Element;
|
|
190
|
+
|
|
165
191
|
interface RotatedFrameProps {
|
|
166
192
|
children: ReactNode;
|
|
167
193
|
/** The angle to turn the frame by. Defaults to the live physical hold (@tastic/core's useRotation); pass it
|
|
@@ -236,4 +262,4 @@ interface UpdateDialogProps {
|
|
|
236
262
|
}
|
|
237
263
|
declare function UpdateDialog({ rotation, autoCheck, autoPrompt, onError }: UpdateDialogProps): react.JSX.Element;
|
|
238
264
|
|
|
239
|
-
export { AchievementCatalogSection, AchievementRow, ActivityStatSection, BaseSettingsDialog, type BaseSettingsDialogProps, BaseStatsScreen, ConfirmDialog, type ConfirmDialogProps, ContentGutter, CornerActionButtons, LOCKED_BADGE_COLOR, MONO_FONT, type OverlayCardColors, RotatedFrame, type RotatedFrameProps, StaggeredWord, type StaggeredWordProps, StatRow, StatSection, UpdateDialog, type UpdateDialogProps, getOverlayCardColors, getStaggeredWordDuration, overlayActionStyles, overlayStyles };
|
|
265
|
+
export { AchievementCatalogSection, AchievementRow, ActivityStatSection, BaseSettingsDialog, type BaseSettingsDialogProps, BaseStatsScreen, ConfirmDialog, type ConfirmDialogProps, ContentGutter, CornerActionButtons, LOCKED_BADGE_COLOR, MONO_FONT, OverlayBackdrop, type OverlayBackdropProps, OverlayCard, type OverlayCardColors, type OverlayCardProps, type OverlayCardThemeColors, RotatedFrame, type RotatedFrameProps, StaggeredWord, type StaggeredWordProps, StatRow, StatSection, UpdateDialog, type UpdateDialogProps, getOverlayCardColors, getStaggeredWordDuration, overlayActionStyles, overlayStyles, useOverlayCardColors };
|
package/dist/chrome/index.d.ts
CHANGED
|
@@ -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
|
|
|
@@ -124,6 +125,11 @@ interface OverlayCardColors {
|
|
|
124
125
|
cardBg: string;
|
|
125
126
|
cardBorder: string;
|
|
126
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* @deprecated The literal black/white card colors. hud's own cards moved to the theme-driven, blur-aware
|
|
130
|
+
* OverlayCard / OverlayBackdrop / useOverlayCardColors (OverlaySurface.tsx) on 2026-10-15; this stays
|
|
131
|
+
* only until every app's own result cards have moved over too.
|
|
132
|
+
*/
|
|
127
133
|
declare function getOverlayCardColors(dark: boolean): OverlayCardColors;
|
|
128
134
|
declare const overlayStyles: {
|
|
129
135
|
card: {
|
|
@@ -162,6 +168,26 @@ declare const overlayActionStyles: {
|
|
|
162
168
|
};
|
|
163
169
|
};
|
|
164
170
|
|
|
171
|
+
interface OverlayCardThemeColors {
|
|
172
|
+
fg: string;
|
|
173
|
+
fgMuted: string;
|
|
174
|
+
cardBorder: string;
|
|
175
|
+
backdrop: string;
|
|
176
|
+
}
|
|
177
|
+
declare function useOverlayCardColors(): OverlayCardThemeColors;
|
|
178
|
+
interface OverlayBackdropProps {
|
|
179
|
+
children?: ReactNode;
|
|
180
|
+
style?: StyleProp<ViewStyle>;
|
|
181
|
+
}
|
|
182
|
+
declare function OverlayBackdrop({ children, style }: OverlayBackdropProps): react.JSX.Element;
|
|
183
|
+
interface OverlayCardProps {
|
|
184
|
+
children?: ReactNode;
|
|
185
|
+
style?: StyleProp<ViewStyle>;
|
|
186
|
+
accessibilityViewIsModal?: boolean;
|
|
187
|
+
testID?: string;
|
|
188
|
+
}
|
|
189
|
+
declare function OverlayCard({ children, style, ...rest }: OverlayCardProps): react.JSX.Element;
|
|
190
|
+
|
|
165
191
|
interface RotatedFrameProps {
|
|
166
192
|
children: ReactNode;
|
|
167
193
|
/** The angle to turn the frame by. Defaults to the live physical hold (@tastic/core's useRotation); pass it
|
|
@@ -236,4 +262,4 @@ interface UpdateDialogProps {
|
|
|
236
262
|
}
|
|
237
263
|
declare function UpdateDialog({ rotation, autoCheck, autoPrompt, onError }: UpdateDialogProps): react.JSX.Element;
|
|
238
264
|
|
|
239
|
-
export { AchievementCatalogSection, AchievementRow, ActivityStatSection, BaseSettingsDialog, type BaseSettingsDialogProps, BaseStatsScreen, ConfirmDialog, type ConfirmDialogProps, ContentGutter, CornerActionButtons, LOCKED_BADGE_COLOR, MONO_FONT, type OverlayCardColors, RotatedFrame, type RotatedFrameProps, StaggeredWord, type StaggeredWordProps, StatRow, StatSection, UpdateDialog, type UpdateDialogProps, getOverlayCardColors, getStaggeredWordDuration, overlayActionStyles, overlayStyles };
|
|
265
|
+
export { AchievementCatalogSection, AchievementRow, ActivityStatSection, BaseSettingsDialog, type BaseSettingsDialogProps, BaseStatsScreen, ConfirmDialog, type ConfirmDialogProps, ContentGutter, CornerActionButtons, LOCKED_BADGE_COLOR, MONO_FONT, OverlayBackdrop, type OverlayBackdropProps, OverlayCard, type OverlayCardColors, type OverlayCardProps, type OverlayCardThemeColors, RotatedFrame, type RotatedFrameProps, StaggeredWord, type StaggeredWordProps, StatRow, StatSection, UpdateDialog, type UpdateDialogProps, getOverlayCardColors, getStaggeredWordDuration, overlayActionStyles, overlayStyles, useOverlayCardColors };
|