@tastic/hud 0.8.4 → 0.12.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 +301 -20
- package/dist/index.d.mts +107 -15
- package/dist/index.d.ts +107 -15
- package/dist/index.js +556 -315
- package/dist/index.mjs +483 -262
- package/package.json +16 -8
- package/src/AchievementCatalogSection.tsx +60 -0
- package/src/ActivityStatSection.tsx +29 -0
- package/src/ConfirmDialog.tsx +30 -11
- package/src/ControlSchemePicker.tsx +11 -2
- package/src/InlineColorPicker.tsx +38 -11
- package/src/LabeledDropdown.tsx +5 -17
- package/src/PlayerSetupPanel.tsx +196 -0
- package/src/SectionedDropdown.tsx +18 -7
- package/src/StaggeredWord.tsx +114 -0
- package/src/index.ts +8 -2
- package/src/useAutoAlign.ts +17 -1
- package/src/useQuitConfirmation.ts +61 -0
- package/src/useZoneClampedAlign.ts +135 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, RefObject } from 'react';
|
|
3
|
+
import { AchievementCatalogRow } from '@tastic/achievements';
|
|
3
4
|
import { ViewRotation } from '@tastic/core';
|
|
4
|
-
import { StyleProp, ViewStyle, View } from 'react-native';
|
|
5
|
+
import { StyleProp, ViewStyle, View, TextStyle, LayoutChangeEvent } from 'react-native';
|
|
5
6
|
import { SeedColor } from '@rific/auto-paper';
|
|
7
|
+
import { Profile } from '@tastic/profile';
|
|
6
8
|
export { SkiaGate, SkiaGateProps } from './SkiaGate.js';
|
|
7
9
|
|
|
10
|
+
interface Props$e {
|
|
11
|
+
rows: AchievementCatalogRow[];
|
|
12
|
+
label?: string;
|
|
13
|
+
fg?: string;
|
|
14
|
+
fgMuted?: string;
|
|
15
|
+
}
|
|
16
|
+
declare function AchievementCatalogSection({ rows, label, fg, fgMuted: fgMutedOverride }: Props$e): react.JSX.Element;
|
|
17
|
+
|
|
8
18
|
declare const LOCKED_BADGE_COLOR = "rgba(128,128,128,0.3)";
|
|
9
|
-
interface Props$
|
|
19
|
+
interface Props$d {
|
|
10
20
|
icon: string;
|
|
11
21
|
title: string;
|
|
12
22
|
description: string;
|
|
@@ -19,7 +29,17 @@ interface Props$c {
|
|
|
19
29
|
fgMuted?: string;
|
|
20
30
|
sectionBg?: string;
|
|
21
31
|
}
|
|
22
|
-
declare function AchievementRow({ icon, title, description, badgeColor, unlockedLabel, checkColor, progress, deviceMarker, fg: fgOverride, fgMuted: fgMutedOverride, sectionBg: sectionBgOverride }: Props$
|
|
32
|
+
declare function AchievementRow({ icon, title, description, badgeColor, unlockedLabel, checkColor, progress, deviceMarker, fg: fgOverride, fgMuted: fgMutedOverride, sectionBg: sectionBgOverride }: Props$d): react.JSX.Element;
|
|
33
|
+
|
|
34
|
+
interface ActivityStats {
|
|
35
|
+
distinctDaysPlayed: number;
|
|
36
|
+
currentDayStreak: number;
|
|
37
|
+
bestDayStreak: number;
|
|
38
|
+
}
|
|
39
|
+
interface Props$c {
|
|
40
|
+
stats: ActivityStats;
|
|
41
|
+
}
|
|
42
|
+
declare function ActivityStatSection({ stats }: Props$c): react.JSX.Element;
|
|
23
43
|
|
|
24
44
|
interface BaseSettingsDialogProps {
|
|
25
45
|
visible: boolean;
|
|
@@ -87,11 +107,18 @@ declare function ContentGutter({ maxContentWidth, leftGutter, rightGutter, style
|
|
|
87
107
|
type PopoverAlign = 'left' | 'right' | 'center';
|
|
88
108
|
type PopoverVerticalAlign = 'below' | 'above';
|
|
89
109
|
type PopoverRotation = ViewRotation;
|
|
110
|
+
interface AlignResult {
|
|
111
|
+
align: PopoverAlign;
|
|
112
|
+
verticalAlign: PopoverVerticalAlign;
|
|
113
|
+
maxHeight: number;
|
|
114
|
+
measured: boolean;
|
|
115
|
+
triggerRef: RefObject<View | null>;
|
|
116
|
+
}
|
|
90
117
|
declare function useAutoAlign(open: boolean, contentWidth: number, contentHeight: number, rotation?: PopoverRotation): {
|
|
91
118
|
align: PopoverAlign;
|
|
92
119
|
maxHeight: number;
|
|
93
120
|
measured: boolean;
|
|
94
|
-
triggerRef:
|
|
121
|
+
triggerRef: RefObject<View | null>;
|
|
95
122
|
verticalAlign: PopoverVerticalAlign;
|
|
96
123
|
};
|
|
97
124
|
|
|
@@ -137,6 +164,7 @@ interface Props$9 {
|
|
|
137
164
|
onAccentColor?: string;
|
|
138
165
|
dark: boolean;
|
|
139
166
|
align?: 'left' | 'right' | 'center';
|
|
167
|
+
alignOverride?: AlignResult;
|
|
140
168
|
rotation?: PopoverRotation;
|
|
141
169
|
autoDismiss?: boolean;
|
|
142
170
|
labelFontFamily?: string;
|
|
@@ -145,7 +173,7 @@ interface Props$9 {
|
|
|
145
173
|
clear: string;
|
|
146
174
|
};
|
|
147
175
|
}
|
|
148
|
-
declare function SectionedDropdown({ id, host, icon, accessibilityLabel, sections, accentColor, mutedColor, onAccentColor, dark, align: alignOverride, rotation: rotationOverride, autoDismiss, labelFontFamily, allClearLabels }: Props$9): react.JSX.Element;
|
|
176
|
+
declare function SectionedDropdown({ id, host, icon, accessibilityLabel, sections, accentColor, mutedColor, onAccentColor, dark, align: forcedAlign, alignOverride, rotation: rotationOverride, autoDismiss, labelFontFamily, allClearLabels }: Props$9): react.JSX.Element;
|
|
149
177
|
|
|
150
178
|
interface ControlSchemePickerProps<T extends string | number> {
|
|
151
179
|
id: string;
|
|
@@ -159,9 +187,11 @@ interface ControlSchemePickerProps<T extends string | number> {
|
|
|
159
187
|
onAccentColor?: string;
|
|
160
188
|
dark: boolean;
|
|
161
189
|
align?: 'left' | 'right' | 'center';
|
|
190
|
+
alignOverride?: AlignResult;
|
|
191
|
+
rotation?: PopoverRotation;
|
|
162
192
|
labelFontFamily?: string;
|
|
163
193
|
}
|
|
164
|
-
declare function ControlSchemePicker<T extends string | number>({ id, host, value, onChange, options, takenValue, accentColor, mutedColor, onAccentColor, dark, align, labelFontFamily }: ControlSchemePickerProps<T>): react.JSX.Element | null;
|
|
194
|
+
declare function ControlSchemePicker<T extends string | number>({ id, host, value, onChange, options, takenValue, accentColor, mutedColor, onAccentColor, dark, align, alignOverride, rotation, labelFontFamily }: ControlSchemePickerProps<T>): react.JSX.Element | null;
|
|
165
195
|
|
|
166
196
|
interface Props$8 {
|
|
167
197
|
onBack: () => void;
|
|
@@ -191,6 +221,10 @@ declare function CornerStatusBadges({ orientationMode, p1OnRight, p1, p2 }: Corn
|
|
|
191
221
|
|
|
192
222
|
declare const MONO_FONT: string;
|
|
193
223
|
|
|
224
|
+
declare function getInlineColorPickerContentSize(swatchCount: number, windowWidth: number, columns?: number): {
|
|
225
|
+
width: number;
|
|
226
|
+
height: number;
|
|
227
|
+
};
|
|
194
228
|
interface Props$7 {
|
|
195
229
|
id: string;
|
|
196
230
|
host: PopoverHost;
|
|
@@ -202,6 +236,7 @@ interface Props$7 {
|
|
|
202
236
|
allowSwapTaken?: boolean;
|
|
203
237
|
dark: boolean;
|
|
204
238
|
align?: 'left' | 'right' | 'center';
|
|
239
|
+
alignOverride?: AlignResult;
|
|
205
240
|
rotation?: PopoverRotation;
|
|
206
241
|
icon?: string;
|
|
207
242
|
tag?: string;
|
|
@@ -210,7 +245,7 @@ interface Props$7 {
|
|
|
210
245
|
columns?: number;
|
|
211
246
|
size?: number;
|
|
212
247
|
}
|
|
213
|
-
declare function InlineColorPicker({ id, host, value, onChange, previewValue, swatches, takenValue, allowSwapTaken, dark, align: alignOverride, rotation: rotationOverride, icon, tag, labelFontFamily, autoDismiss, columns, size }: Props$7): react.JSX.Element;
|
|
248
|
+
declare function InlineColorPicker({ id, host, value, onChange, previewValue, swatches, takenValue, allowSwapTaken, dark, align: forcedAlign, alignOverride, rotation: rotationOverride, icon, tag, labelFontFamily, autoDismiss, columns, size }: Props$7): react.JSX.Element;
|
|
214
249
|
|
|
215
250
|
declare const LABELED_DROPDOWN_POPOVER_WIDTH = 180;
|
|
216
251
|
declare function getLabeledDropdownContentHeight(optionCount: number): number;
|
|
@@ -219,13 +254,6 @@ interface LabeledDropdownOption<T extends string> {
|
|
|
219
254
|
label: string;
|
|
220
255
|
icon?: string;
|
|
221
256
|
}
|
|
222
|
-
interface AlignResult {
|
|
223
|
-
align: PopoverAlign;
|
|
224
|
-
verticalAlign: PopoverVerticalAlign;
|
|
225
|
-
maxHeight: number;
|
|
226
|
-
measured: boolean;
|
|
227
|
-
triggerRef: RefObject<View | null>;
|
|
228
|
-
}
|
|
229
257
|
interface Props$6<T extends string> {
|
|
230
258
|
id: string;
|
|
231
259
|
host: PopoverHost;
|
|
@@ -269,6 +297,42 @@ declare const overlayStyles: {
|
|
|
269
297
|
};
|
|
270
298
|
};
|
|
271
299
|
|
|
300
|
+
declare function getColorPopoverId(idPrefix: string): string;
|
|
301
|
+
declare function getCpuDifficultyPopoverId(idPrefix: string): string;
|
|
302
|
+
interface PlayerSetupPanelProps<C extends string = string> {
|
|
303
|
+
idPrefix: string;
|
|
304
|
+
host?: PopoverHost;
|
|
305
|
+
label?: string;
|
|
306
|
+
labelFontFamily?: string;
|
|
307
|
+
color: string;
|
|
308
|
+
onColorChange: (hex: string) => void;
|
|
309
|
+
swatches: SeedColor[];
|
|
310
|
+
takenColor?: string;
|
|
311
|
+
allowSwapTaken?: boolean;
|
|
312
|
+
colorAlignOverride?: AlignResult;
|
|
313
|
+
colorRotation?: PopoverRotation;
|
|
314
|
+
isHuman: boolean;
|
|
315
|
+
secondPicker?: ReactNode;
|
|
316
|
+
secondPickerId?: string;
|
|
317
|
+
ready?: boolean;
|
|
318
|
+
onToggleReady?: () => void;
|
|
319
|
+
dark: boolean;
|
|
320
|
+
showReadyButton?: boolean;
|
|
321
|
+
profiles?: Profile[];
|
|
322
|
+
selectedProfileId?: string | null;
|
|
323
|
+
takenProfileId?: string | null;
|
|
324
|
+
guestLabel?: string;
|
|
325
|
+
onProfileSelect?: (profile: Profile | null) => void;
|
|
326
|
+
onManageProfiles?: () => void;
|
|
327
|
+
cpuDifficulty?: C;
|
|
328
|
+
cpuDifficultyOptions?: LabeledDropdownOption<C>[];
|
|
329
|
+
onCpuDifficultyChange?: (value: C) => void;
|
|
330
|
+
cpuDifficultyAlignOverride?: AlignResult;
|
|
331
|
+
humanIcon?: string;
|
|
332
|
+
cpuIcon?: string;
|
|
333
|
+
}
|
|
334
|
+
declare function PlayerSetupPanel<C extends string = string>({ idPrefix, host, label, labelFontFamily, color, onColorChange, swatches, takenColor, allowSwapTaken, colorAlignOverride, colorRotation, isHuman, secondPicker, secondPickerId, ready, onToggleReady, dark, showReadyButton, profiles, selectedProfileId, takenProfileId, guestLabel, onProfileSelect, onManageProfiles, cpuDifficulty, cpuDifficultyOptions, onCpuDifficultyChange, cpuDifficultyAlignOverride, humanIcon, cpuIcon }: PlayerSetupPanelProps<C>): react.JSX.Element;
|
|
335
|
+
|
|
272
336
|
interface Props$5 {
|
|
273
337
|
visible: boolean;
|
|
274
338
|
children: ReactNode;
|
|
@@ -308,6 +372,22 @@ interface Props$2 {
|
|
|
308
372
|
}
|
|
309
373
|
declare function SharedActionBand({ onBack, onSettings, onRandomize, onReset, fg, popoverOpen, children }: Props$2): react.JSX.Element;
|
|
310
374
|
|
|
375
|
+
declare function getStaggeredWordDuration(letterCount: number): number;
|
|
376
|
+
interface StaggeredWordProps {
|
|
377
|
+
word: string;
|
|
378
|
+
color: string;
|
|
379
|
+
fontFamily: string;
|
|
380
|
+
fontSize: number;
|
|
381
|
+
lineHeight: number;
|
|
382
|
+
reducedMotion: boolean;
|
|
383
|
+
startIndex?: number;
|
|
384
|
+
fontWeight?: TextStyle['fontWeight'];
|
|
385
|
+
letterSpacing?: number;
|
|
386
|
+
style?: StyleProp<ViewStyle>;
|
|
387
|
+
onLayout?: (e: LayoutChangeEvent) => void;
|
|
388
|
+
}
|
|
389
|
+
declare function StaggeredWord({ word, color, fontFamily, fontSize, lineHeight, reducedMotion, startIndex, fontWeight, letterSpacing, style, onLayout }: StaggeredWordProps): react.JSX.Element;
|
|
390
|
+
|
|
311
391
|
interface Props$1 {
|
|
312
392
|
label: string;
|
|
313
393
|
value: string;
|
|
@@ -345,4 +425,16 @@ interface UpdateDialogProps {
|
|
|
345
425
|
}
|
|
346
426
|
declare function UpdateDialog({ rotation, autoCheck, autoPrompt, onError }: UpdateDialogProps): react.JSX.Element;
|
|
347
427
|
|
|
348
|
-
|
|
428
|
+
interface QuitConfirmation {
|
|
429
|
+
/** Wire directly to <ConfirmDialog visible={...}>. */
|
|
430
|
+
confirmVisible: boolean;
|
|
431
|
+
/** Wire directly to the back button's onPress (GameActionChips/IconButton onBack/onPress). */
|
|
432
|
+
requestBack: () => void;
|
|
433
|
+
/** Wire directly to <ConfirmDialog onCancel={...}>. */
|
|
434
|
+
cancelBack: () => void;
|
|
435
|
+
}
|
|
436
|
+
declare function useQuitConfirmation(hasProgress: () => boolean, onConfirmedBack: () => void): QuitConfirmation;
|
|
437
|
+
|
|
438
|
+
declare function useZoneClampedAlign(open: boolean, contentWidth: number, contentHeight: number, rotation?: PopoverRotation): ReturnType<typeof useAutoAlign>;
|
|
439
|
+
|
|
440
|
+
export { AchievementCatalogSection, AchievementRow, ActivityStatSection, type AlignResult, BaseSettingsDialog, type BaseSettingsDialogProps, BaseStatsScreen, ConfirmDialog, type ConfirmDialogProps, ContentGutter, ControlSchemePicker, type ControlSchemePickerProps, CornerActionButtons, type CornerStatusBadgeSeat, CornerStatusBadges, type CornerStatusBadgesProps, InlineColorPicker, LABELED_DROPDOWN_POPOVER_WIDTH, LOCKED_BADGE_COLOR, LabeledDropdown, type LabeledDropdownOption, MONO_FONT, type MenuOption, type MenuSection, type MultiSelectSection, type OrientationMode, type OverlayCardColors, PlayerSetupPanel, type PlayerSetupPanelProps, type PopoverAlign, PopoverBody, type PopoverHost, type PopoverRotation, type PopoverVerticalAlign, PressAwayOverlay, type QuitConfirmation, ReadyButton, SectionedDropdown, SharedActionBand, type SingleSelectSection, StaggeredWord, type StaggeredWordProps, StatRow, StatSection, TriggerGaugeHost, type TriggerGaugeProps, UpdateDialog, type UpdateDialogProps, getColorPopoverId, getCpuDifficultyPopoverId, getInlineColorPickerContentSize, getLabeledDropdownContentHeight, getOverlayCardColors, getStaggeredWordDuration, loadSkiaWeb, overlayStyles, useAutoAlign, usePopoverHost, useQuitConfirmation, useZoneClampedAlign };
|