@tastic/hud 0.6.0 → 0.8.1
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 +48 -8
- package/dist/SkiaGate.d.mts +13 -0
- package/dist/SkiaGate.d.ts +13 -0
- package/dist/SkiaGate.js +45 -0
- package/dist/SkiaGate.mjs +6 -0
- package/dist/chunk-XEOFR236.mjs +21 -0
- package/dist/index.d.mts +124 -75
- package/dist/index.d.ts +124 -75
- package/dist/index.js +476 -328
- package/dist/index.mjs +440 -310
- package/package.json +13 -6
- package/src/BaseSettingsDialog.tsx +9 -6
- package/src/BaseStatsScreen.tsx +10 -7
- package/src/ConfirmDialog.tsx +104 -0
- package/src/ControlSchemePicker.tsx +53 -0
- package/src/CornerActionButtons.tsx +10 -2
- package/src/CornerStatusBadges.tsx +87 -0
- package/src/InlineColorPicker.tsx +10 -4
- package/src/SectionedDropdown.tsx +17 -3
- package/src/SkiaGate.tsx +45 -0
- package/src/SkiaGate.web.tsx +9 -0
- package/src/TriggerGaugeHost.tsx +12 -20
- package/src/index.ts +11 -7
- package/src/useAutoAlign.ts +58 -16
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, RefObject } from 'react';
|
|
3
3
|
import { StyleProp, ViewStyle, View } from 'react-native';
|
|
4
|
+
import { ViewRotation } from '@tastic/core';
|
|
4
5
|
import { SeedColor } from '@rific/auto-paper';
|
|
6
|
+
export { SkiaGate, SkiaGateProps } from './SkiaGate.js';
|
|
5
7
|
|
|
6
8
|
declare const LOCKED_BADGE_COLOR = "rgba(128,128,128,0.3)";
|
|
7
9
|
interface Props$c {
|
|
@@ -35,7 +37,7 @@ interface BaseSettingsDialogProps {
|
|
|
35
37
|
onUpdateError?: (message: string) => void;
|
|
36
38
|
children?: ReactNode;
|
|
37
39
|
}
|
|
38
|
-
declare function BaseSettingsDialog({ visible, onDismiss, rotation, version, lockOrientation, onLockOrientationChange, deferBottomEdgeGestures, onDeferBottomEdgeGestures, hideSound, hideHaptics, hideAppearance, hideUpdateCheck, onUpdateError, children }: BaseSettingsDialogProps): react.JSX.Element;
|
|
40
|
+
declare function BaseSettingsDialog({ visible, onDismiss, rotation: rotationOverride, version, lockOrientation, onLockOrientationChange, deferBottomEdgeGestures, onDeferBottomEdgeGestures, hideSound, hideHaptics, hideAppearance, hideUpdateCheck, onUpdateError, children }: BaseSettingsDialogProps): react.JSX.Element;
|
|
39
41
|
|
|
40
42
|
type MD3TextVariant = 'displayLarge' | 'displayMedium' | 'displaySmall' | 'headlineLarge' | 'headlineMedium' | 'headlineSmall' | 'titleLarge' | 'titleMedium' | 'titleSmall' | 'labelLarge' | 'labelMedium' | 'labelSmall' | 'bodyLarge' | 'bodyMedium' | 'bodySmall';
|
|
41
43
|
interface Props$b {
|
|
@@ -59,7 +61,21 @@ interface Props$b {
|
|
|
59
61
|
accentColor?: string;
|
|
60
62
|
children: ReactNode;
|
|
61
63
|
}
|
|
62
|
-
declare function BaseStatsScreen({ rotation, title, titleVariant, onBack, insets, onReset, resetLabel, resetConfirmTitle, resetConfirmBody, fg: fgOverride, bg: bgOverride, cardBg: cardBgOverride, accentColor: accentColorOverride, children }: Props$b): react.JSX.Element;
|
|
64
|
+
declare function BaseStatsScreen({ rotation: rotationOverride, title, titleVariant, onBack, insets, onReset, resetLabel, resetConfirmTitle, resetConfirmBody, fg: fgOverride, bg: bgOverride, cardBg: cardBgOverride, accentColor: accentColorOverride, children }: Props$b): react.JSX.Element;
|
|
65
|
+
|
|
66
|
+
interface ConfirmDialogProps {
|
|
67
|
+
visible: boolean;
|
|
68
|
+
title: string;
|
|
69
|
+
message: string;
|
|
70
|
+
confirmLabel: string;
|
|
71
|
+
cancelLabel: string;
|
|
72
|
+
onConfirm: () => void;
|
|
73
|
+
onCancel: () => void;
|
|
74
|
+
rotation?: number;
|
|
75
|
+
icon?: string;
|
|
76
|
+
destructive?: boolean;
|
|
77
|
+
}
|
|
78
|
+
declare function ConfirmDialog({ visible, title, message, confirmLabel, cancelLabel, onConfirm, onCancel, rotation, icon, destructive }: ConfirmDialogProps): react.JSX.Element | null;
|
|
63
79
|
|
|
64
80
|
interface Props$a {
|
|
65
81
|
maxContentWidth?: number;
|
|
@@ -70,7 +86,86 @@ interface Props$a {
|
|
|
70
86
|
}
|
|
71
87
|
declare function ContentGutter({ maxContentWidth, leftGutter, rightGutter, style, children }: Props$a): react.JSX.Element;
|
|
72
88
|
|
|
89
|
+
type PopoverAlign = 'left' | 'right' | 'center';
|
|
90
|
+
type PopoverVerticalAlign = 'below' | 'above';
|
|
91
|
+
type PopoverRotation = ViewRotation;
|
|
92
|
+
declare function useAutoAlign(open: boolean, contentWidth: number, contentHeight: number, rotation?: PopoverRotation): {
|
|
93
|
+
align: PopoverAlign;
|
|
94
|
+
maxHeight: number;
|
|
95
|
+
measured: boolean;
|
|
96
|
+
triggerRef: react.RefObject<View | null>;
|
|
97
|
+
verticalAlign: PopoverVerticalAlign;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
interface PopoverHost {
|
|
101
|
+
openId: string | null;
|
|
102
|
+
toggle: (id: string) => void;
|
|
103
|
+
close: () => void;
|
|
104
|
+
}
|
|
105
|
+
declare function usePopoverHost(): PopoverHost;
|
|
106
|
+
|
|
107
|
+
interface MenuOption<T extends string | number> {
|
|
108
|
+
value: T;
|
|
109
|
+
label: string;
|
|
110
|
+
description?: string;
|
|
111
|
+
icon?: string;
|
|
112
|
+
iconSize?: number;
|
|
113
|
+
}
|
|
114
|
+
interface SingleSelectSection<T extends string | number> {
|
|
115
|
+
kind: 'single';
|
|
116
|
+
id: string;
|
|
117
|
+
options: MenuOption<T>[];
|
|
118
|
+
value: T;
|
|
119
|
+
onChange: (value: T) => void;
|
|
120
|
+
takenValue?: T;
|
|
121
|
+
}
|
|
122
|
+
interface MultiSelectSection<T extends string | number> {
|
|
123
|
+
kind: 'multi';
|
|
124
|
+
id: string;
|
|
125
|
+
options: MenuOption<T>[];
|
|
126
|
+
value: T[];
|
|
127
|
+
onChange: (value: T[]) => void;
|
|
128
|
+
allClear?: boolean;
|
|
129
|
+
}
|
|
130
|
+
type MenuSection = SingleSelectSection<any> | MultiSelectSection<any>;
|
|
73
131
|
interface Props$9 {
|
|
132
|
+
id: string;
|
|
133
|
+
host: PopoverHost;
|
|
134
|
+
icon: string;
|
|
135
|
+
accessibilityLabel: string;
|
|
136
|
+
sections: MenuSection[];
|
|
137
|
+
accentColor: string;
|
|
138
|
+
mutedColor: string;
|
|
139
|
+
onAccentColor?: string;
|
|
140
|
+
dark: boolean;
|
|
141
|
+
align?: 'left' | 'right' | 'center';
|
|
142
|
+
rotation?: PopoverRotation;
|
|
143
|
+
autoDismiss?: boolean;
|
|
144
|
+
labelFontFamily?: string;
|
|
145
|
+
allClearLabels?: {
|
|
146
|
+
all: string;
|
|
147
|
+
clear: string;
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
declare function SectionedDropdown({ id, host, icon, accessibilityLabel, sections, accentColor, mutedColor, onAccentColor, dark, align: alignOverride, rotation: rotationOverride, autoDismiss, labelFontFamily, allClearLabels }: Props$9): react.JSX.Element;
|
|
151
|
+
|
|
152
|
+
interface ControlSchemePickerProps<T extends string | number> {
|
|
153
|
+
id: string;
|
|
154
|
+
host: PopoverHost;
|
|
155
|
+
value: T;
|
|
156
|
+
onChange: (value: T) => void;
|
|
157
|
+
options: MenuOption<T>[];
|
|
158
|
+
takenValue?: T;
|
|
159
|
+
accentColor: string;
|
|
160
|
+
mutedColor: string;
|
|
161
|
+
onAccentColor?: string;
|
|
162
|
+
dark: boolean;
|
|
163
|
+
align?: 'left' | 'right' | 'center';
|
|
164
|
+
labelFontFamily?: string;
|
|
165
|
+
}
|
|
166
|
+
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;
|
|
167
|
+
|
|
168
|
+
interface Props$8 {
|
|
74
169
|
onBack: () => void;
|
|
75
170
|
onSettings: () => void;
|
|
76
171
|
fg: string;
|
|
@@ -79,19 +174,26 @@ interface Props$9 {
|
|
|
79
174
|
left: number;
|
|
80
175
|
right: number;
|
|
81
176
|
};
|
|
177
|
+
backIcon?: string;
|
|
178
|
+
backLabel?: string;
|
|
82
179
|
}
|
|
83
|
-
declare function CornerActionButtons({ onBack, onSettings, fg, insets }: Props$
|
|
180
|
+
declare function CornerActionButtons({ onBack, onSettings, fg, insets, backIcon, backLabel }: Props$8): react.JSX.Element;
|
|
84
181
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
openId: string | null;
|
|
89
|
-
toggle: (id: string) => void;
|
|
90
|
-
close: () => void;
|
|
182
|
+
type OrientationMode = 'faceToFace' | 'sideBySide';
|
|
183
|
+
interface CornerStatusBadgeSeat {
|
|
184
|
+
icon?: string;
|
|
91
185
|
}
|
|
92
|
-
|
|
186
|
+
interface CornerStatusBadgesProps {
|
|
187
|
+
orientationMode: OrientationMode;
|
|
188
|
+
p1OnRight: boolean;
|
|
189
|
+
p1?: CornerStatusBadgeSeat;
|
|
190
|
+
p2?: CornerStatusBadgeSeat;
|
|
191
|
+
}
|
|
192
|
+
declare function CornerStatusBadges({ orientationMode, p1OnRight, p1, p2 }: CornerStatusBadgesProps): react.JSX.Element;
|
|
93
193
|
|
|
94
|
-
|
|
194
|
+
declare const MONO_FONT: string;
|
|
195
|
+
|
|
196
|
+
interface Props$7 {
|
|
95
197
|
id: string;
|
|
96
198
|
host: PopoverHost;
|
|
97
199
|
value: string;
|
|
@@ -102,6 +204,7 @@ interface Props$8 {
|
|
|
102
204
|
allowSwapTaken?: boolean;
|
|
103
205
|
dark: boolean;
|
|
104
206
|
align?: 'left' | 'right' | 'center';
|
|
207
|
+
rotation?: PopoverRotation;
|
|
105
208
|
icon?: string;
|
|
106
209
|
tag?: string;
|
|
107
210
|
labelFontFamily?: string;
|
|
@@ -109,17 +212,7 @@ interface Props$8 {
|
|
|
109
212
|
columns?: number;
|
|
110
213
|
size?: number;
|
|
111
214
|
}
|
|
112
|
-
declare function InlineColorPicker({ id, host, value, onChange, previewValue, swatches, takenValue, allowSwapTaken, dark, align: alignOverride, icon, tag, labelFontFamily, autoDismiss, columns, size }: Props$
|
|
113
|
-
|
|
114
|
-
type PopoverAlign = 'left' | 'right' | 'center';
|
|
115
|
-
type PopoverVerticalAlign = 'below' | 'above';
|
|
116
|
-
declare function useAutoAlign(open: boolean, contentWidth: number, contentHeight: number): {
|
|
117
|
-
align: PopoverAlign;
|
|
118
|
-
maxHeight: number;
|
|
119
|
-
measured: boolean;
|
|
120
|
-
triggerRef: react.RefObject<View | null>;
|
|
121
|
-
verticalAlign: PopoverVerticalAlign;
|
|
122
|
-
};
|
|
215
|
+
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;
|
|
123
216
|
|
|
124
217
|
declare const LABELED_DROPDOWN_POPOVER_WIDTH = 180;
|
|
125
218
|
declare function getLabeledDropdownContentHeight(optionCount: number): number;
|
|
@@ -135,7 +228,7 @@ interface AlignResult {
|
|
|
135
228
|
measured: boolean;
|
|
136
229
|
triggerRef: RefObject<View | null>;
|
|
137
230
|
}
|
|
138
|
-
interface Props$
|
|
231
|
+
interface Props$6<T extends string> {
|
|
139
232
|
id: string;
|
|
140
233
|
host: PopoverHost;
|
|
141
234
|
options: LabeledDropdownOption<T>[];
|
|
@@ -146,11 +239,11 @@ interface Props$7<T extends string> {
|
|
|
146
239
|
align?: 'left' | 'right' | 'center';
|
|
147
240
|
alignOverride?: AlignResult;
|
|
148
241
|
}
|
|
149
|
-
declare function LabeledDropdown<T extends string>({ id, host, options, value, onChange, color, dark, align: forcedAlign, alignOverride }: Props$
|
|
242
|
+
declare function LabeledDropdown<T extends string>({ id, host, options, value, onChange, color, dark, align: forcedAlign, alignOverride }: Props$6<T>): react.JSX.Element;
|
|
150
243
|
|
|
151
244
|
declare function loadSkiaWeb(): Promise<void>;
|
|
152
245
|
|
|
153
|
-
interface Props$
|
|
246
|
+
interface Props$5 {
|
|
154
247
|
visible: boolean;
|
|
155
248
|
children: ReactNode;
|
|
156
249
|
align?: 'left' | 'right' | 'center';
|
|
@@ -160,67 +253,23 @@ interface Props$6 {
|
|
|
160
253
|
caretBorderWidth?: number;
|
|
161
254
|
triggerSize?: number;
|
|
162
255
|
}
|
|
163
|
-
declare function PopoverBody({ visible, children, align, verticalAlign, caretColor, caretBorderColor, caretBorderWidth, triggerSize }: Props$
|
|
256
|
+
declare function PopoverBody({ visible, children, align, verticalAlign, caretColor, caretBorderColor, caretBorderWidth, triggerSize }: Props$5): react.JSX.Element | null;
|
|
164
257
|
|
|
165
|
-
interface Props$
|
|
258
|
+
interface Props$4 {
|
|
166
259
|
active: boolean;
|
|
167
260
|
onPress: () => void;
|
|
168
261
|
style?: StyleProp<ViewStyle>;
|
|
169
262
|
}
|
|
170
|
-
declare function PressAwayOverlay({ active, onPress, style }: Props$
|
|
263
|
+
declare function PressAwayOverlay({ active, onPress, style }: Props$4): react.JSX.Element | null;
|
|
171
264
|
|
|
172
|
-
interface Props$
|
|
265
|
+
interface Props$3 {
|
|
173
266
|
color: string;
|
|
174
267
|
ready: boolean;
|
|
175
268
|
onToggleReady: () => void;
|
|
176
269
|
style?: StyleProp<ViewStyle>;
|
|
177
270
|
labelFontFamily?: string;
|
|
178
271
|
}
|
|
179
|
-
declare function ReadyButton({ color, ready, onToggleReady, style, labelFontFamily }: Props$
|
|
180
|
-
|
|
181
|
-
interface MenuOption<T extends string | number> {
|
|
182
|
-
value: T;
|
|
183
|
-
label: string;
|
|
184
|
-
description?: string;
|
|
185
|
-
icon?: string;
|
|
186
|
-
iconSize?: number;
|
|
187
|
-
}
|
|
188
|
-
interface SingleSelectSection<T extends string | number> {
|
|
189
|
-
kind: 'single';
|
|
190
|
-
id: string;
|
|
191
|
-
options: MenuOption<T>[];
|
|
192
|
-
value: T;
|
|
193
|
-
onChange: (value: T) => void;
|
|
194
|
-
takenValue?: T;
|
|
195
|
-
}
|
|
196
|
-
interface MultiSelectSection<T extends string | number> {
|
|
197
|
-
kind: 'multi';
|
|
198
|
-
id: string;
|
|
199
|
-
options: MenuOption<T>[];
|
|
200
|
-
value: T[];
|
|
201
|
-
onChange: (value: T[]) => void;
|
|
202
|
-
allClear?: boolean;
|
|
203
|
-
}
|
|
204
|
-
type MenuSection = SingleSelectSection<any> | MultiSelectSection<any>;
|
|
205
|
-
interface Props$3 {
|
|
206
|
-
id: string;
|
|
207
|
-
host: PopoverHost;
|
|
208
|
-
icon: string;
|
|
209
|
-
accessibilityLabel: string;
|
|
210
|
-
sections: MenuSection[];
|
|
211
|
-
accentColor: string;
|
|
212
|
-
mutedColor: string;
|
|
213
|
-
onAccentColor?: string;
|
|
214
|
-
dark: boolean;
|
|
215
|
-
align?: 'left' | 'right' | 'center';
|
|
216
|
-
autoDismiss?: boolean;
|
|
217
|
-
labelFontFamily?: string;
|
|
218
|
-
allClearLabels?: {
|
|
219
|
-
all: string;
|
|
220
|
-
clear: string;
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
declare function SectionedDropdown({ id, host, icon, accessibilityLabel, sections, accentColor, mutedColor, onAccentColor, dark, align: alignOverride, autoDismiss, labelFontFamily, allClearLabels }: Props$3): react.JSX.Element;
|
|
272
|
+
declare function ReadyButton({ color, ready, onToggleReady, style, labelFontFamily }: Props$3): react.JSX.Element;
|
|
224
273
|
|
|
225
274
|
interface Props$2 {
|
|
226
275
|
onBack: () => void;
|
|
@@ -262,4 +311,4 @@ interface TriggerGaugeProps {
|
|
|
262
311
|
|
|
263
312
|
declare function TriggerGaugeHost(props: TriggerGaugeProps): react.JSX.Element;
|
|
264
313
|
|
|
265
|
-
export { AchievementRow, BaseSettingsDialog, type BaseSettingsDialogProps, BaseStatsScreen, ContentGutter, CornerActionButtons, InlineColorPicker, LABELED_DROPDOWN_POPOVER_WIDTH, LOCKED_BADGE_COLOR, LabeledDropdown, type LabeledDropdownOption, MONO_FONT, type MenuOption, type MenuSection, type MultiSelectSection, type PopoverAlign, PopoverBody, type PopoverHost, type PopoverVerticalAlign, PressAwayOverlay, ReadyButton, SectionedDropdown, SharedActionBand, type SingleSelectSection, StatRow, StatSection, TriggerGaugeHost, type TriggerGaugeProps, getLabeledDropdownContentHeight, loadSkiaWeb, useAutoAlign, usePopoverHost };
|
|
314
|
+
export { AchievementRow, 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 PopoverAlign, PopoverBody, type PopoverHost, type PopoverRotation, type PopoverVerticalAlign, PressAwayOverlay, ReadyButton, SectionedDropdown, SharedActionBand, type SingleSelectSection, StatRow, StatSection, TriggerGaugeHost, type TriggerGaugeProps, getLabeledDropdownContentHeight, loadSkiaWeb, useAutoAlign, usePopoverHost };
|