@tastic/hud 0.16.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 +45 -2
- package/dist/chrome/index.d.mts +26 -1
- package/dist/chrome/index.d.ts +26 -1
- package/dist/chrome/index.js +137 -103
- package/dist/chrome/index.mjs +10 -4
- package/dist/{chunk-JXRBXQLQ.mjs → chunk-27FIA26F.mjs} +16 -8
- 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 +250 -216
- 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/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
|
@@ -76,6 +76,9 @@ corner of the screen.
|
|
|
76
76
|
out after being independently copied into several games. See Rotation below for how each of these
|
|
77
77
|
(plus `SectionedDropdown`/`InlineColorPicker`) handles rotating inside a `@tastic/split-screen`
|
|
78
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.
|
|
79
82
|
|
|
80
83
|
## Rotation
|
|
81
84
|
|
|
@@ -235,6 +238,45 @@ export function SettingsDialog({ visible, onDismiss, rotation = 0, settings, set
|
|
|
235
238
|
}
|
|
236
239
|
```
|
|
237
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
|
+
|
|
238
280
|
## Zone-aware popovers (`useZoneClampedAlign`)
|
|
239
281
|
|
|
240
282
|
`useAutoAlign` - and everything built on it, including `SectionedDropdown`, `InlineColorPicker`, and
|
|
@@ -565,7 +607,8 @@ touches the main barrel. It's for an app that has `@tastic/core` and `@rific/upd
|
|
|
565
607
|
- Stats: `BaseStatsScreen`, `StatSection`, `StatRow`, `AchievementRow`, `LOCKED_BADGE_COLOR`,
|
|
566
608
|
`AchievementCatalogSection`, `ActivityStatSection`
|
|
567
609
|
- Chrome: `CornerActionButtons`, `ContentGutter`, `StaggeredWord`, `getStaggeredWordDuration`
|
|
568
|
-
-
|
|
610
|
+
- Overlay cards: `OverlayCard`, `OverlayBackdrop`, `useOverlayCardColors`
|
|
611
|
+
- Style tokens: `overlayStyles`, `overlayActionStyles`, `MONO_FONT`, and the deprecated `getOverlayCardColors`
|
|
569
612
|
|
|
570
613
|
Each is the same component the main entry exports and is documented above. Only the import path changes:
|
|
571
614
|
|
|
@@ -619,7 +662,7 @@ resolve module".
|
|
|
619
662
|
| `react`, `react-native` | >=19.0.0, >=0.76.0 | every entry |
|
|
620
663
|
| `react-native-paper` | >=5.0.0 | main entry, `./guide`, `./chrome` |
|
|
621
664
|
| `react-native-reanimated` | >=3.0.0 | main entry (`StaggeredWord`), `./guide`, `./chrome` (`StaggeredWord`) |
|
|
622
|
-
| `@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` |
|
|
623
666
|
| `@rific/feedback-press` | >=0.10.2 | main entry (`useSoundSettings` first shipped in 0.10.2), `./guide`, `./chrome` |
|
|
624
667
|
| `react-native-safe-area-context` | >=5.0.0 | main entry (`useZoneClampedAlign`), `./chrome` (`RotatedFrame`, `BaseSettingsDialog`) |
|
|
625
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
|
@@ -125,6 +125,11 @@ interface OverlayCardColors {
|
|
|
125
125
|
cardBg: string;
|
|
126
126
|
cardBorder: string;
|
|
127
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
|
+
*/
|
|
128
133
|
declare function getOverlayCardColors(dark: boolean): OverlayCardColors;
|
|
129
134
|
declare const overlayStyles: {
|
|
130
135
|
card: {
|
|
@@ -163,6 +168,26 @@ declare const overlayActionStyles: {
|
|
|
163
168
|
};
|
|
164
169
|
};
|
|
165
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
|
+
|
|
166
191
|
interface RotatedFrameProps {
|
|
167
192
|
children: ReactNode;
|
|
168
193
|
/** The angle to turn the frame by. Defaults to the live physical hold (@tastic/core's useRotation); pass it
|
|
@@ -237,4 +262,4 @@ interface UpdateDialogProps {
|
|
|
237
262
|
}
|
|
238
263
|
declare function UpdateDialog({ rotation, autoCheck, autoPrompt, onError }: UpdateDialogProps): react.JSX.Element;
|
|
239
264
|
|
|
240
|
-
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
|
@@ -125,6 +125,11 @@ interface OverlayCardColors {
|
|
|
125
125
|
cardBg: string;
|
|
126
126
|
cardBorder: string;
|
|
127
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
|
+
*/
|
|
128
133
|
declare function getOverlayCardColors(dark: boolean): OverlayCardColors;
|
|
129
134
|
declare const overlayStyles: {
|
|
130
135
|
card: {
|
|
@@ -163,6 +168,26 @@ declare const overlayActionStyles: {
|
|
|
163
168
|
};
|
|
164
169
|
};
|
|
165
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
|
+
|
|
166
191
|
interface RotatedFrameProps {
|
|
167
192
|
children: ReactNode;
|
|
168
193
|
/** The angle to turn the frame by. Defaults to the live physical hold (@tastic/core's useRotation); pass it
|
|
@@ -237,4 +262,4 @@ interface UpdateDialogProps {
|
|
|
237
262
|
}
|
|
238
263
|
declare function UpdateDialog({ rotation, autoCheck, autoPrompt, onError }: UpdateDialogProps): react.JSX.Element;
|
|
239
264
|
|
|
240
|
-
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 };
|