@tastic/shell 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +154 -2
- package/assets/sounds/notification.wav +0 -0
- package/assets/sounds/select.wav +0 -0
- package/dist/index.d.mts +487 -0
- package/dist/index.d.ts +487 -0
- package/dist/index.js +1636 -0
- package/dist/index.mjs +1562 -0
- package/dist/notification-CGGFPYK7.wav +0 -0
- package/dist/select-MLBNNA4N.wav +0 -0
- package/package.json +163 -4
- package/src/PackContext.tsx +22 -0
- package/src/RootLayout.tsx +186 -0
- package/src/components/Fonts.tsx +41 -0
- package/src/components/GuideHost.tsx +104 -0
- package/src/components/Providers.tsx +86 -0
- package/src/components/SeatTwoPanel.tsx +132 -0
- package/src/components/SettingsDialog.tsx +42 -0
- package/src/components/Theme.tsx +75 -0
- package/src/components/UpdateDialog.tsx +13 -0
- package/src/components/imageGameIcon.tsx +13 -0
- package/src/gameStats.tsx +90 -0
- package/src/hooks/useActiveRound.ts +16 -0
- package/src/hooks/useAppSettings.ts +19 -0
- package/src/hooks/useFrozenWhileHidden.ts +33 -0
- package/src/hooks/useLastActiveGame.tsx +73 -0
- package/src/hooks/useOpponent.ts +14 -0
- package/src/hooks/useProfiles.tsx +134 -0
- package/src/hooks/useSeatColors.ts +148 -0
- package/src/index.ts +39 -0
- package/src/navigation.ts +11 -0
- package/src/playerSettings.ts +112 -0
- package/src/redux/appSettingsSlice.ts +34 -0
- package/src/redux/createPackStore.ts +78 -0
- package/src/redux/gameGuideSlice.ts +39 -0
- package/src/redux/lastActiveGameSlice.ts +12 -0
- package/src/redux/liveplaySlice.ts +34 -0
- package/src/redux/onProfileRemoved.ts +25 -0
- package/src/redux/opponentSlice.ts +21 -0
- package/src/redux/profileSelectionSlice.ts +17 -0
- package/src/redux/seatColorsSlice.ts +24 -0
- package/src/redux/shellState.ts +59 -0
- package/src/screens/GameRoute.tsx +48 -0
- package/src/screens/HomeScreen.tsx +378 -0
- package/src/screens/LoadoutScreen.tsx +271 -0
- package/src/screens/ProfilesRoute.tsx +14 -0
- package/src/screens/StatsScreen.tsx +133 -0
- package/src/screens/homeLayout.ts +129 -0
- package/src/splashGate.ts +3 -0
- package/src/types.ts +216 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,487 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ComponentType, ReactNode } from 'react';
|
|
3
|
+
import * as _rific_auto_paper from '@rific/auto-paper';
|
|
4
|
+
import { ThemeAppearance } from '@rific/auto-paper';
|
|
5
|
+
import { ViewRotation } from '@tastic/core';
|
|
6
|
+
import { PopoverHost, MenuOption } from '@tastic/hud';
|
|
7
|
+
import { GuideStep } from '@tastic/hud/guide';
|
|
8
|
+
import { FontSource } from 'expo-font';
|
|
9
|
+
import * as redux from 'redux';
|
|
10
|
+
import { Reducer, Action } from 'redux';
|
|
11
|
+
import * as _rific_core from '@rific/core';
|
|
12
|
+
export { safeBack } from '@rific/core';
|
|
13
|
+
import * as _tastic_profile from '@tastic/profile';
|
|
14
|
+
import { profilesReducer, Profile, CreateProfileInput, SeatColorsState as SeatColorsState$1 } from '@tastic/profile';
|
|
15
|
+
import * as _rific_feedback_press from '@rific/feedback-press';
|
|
16
|
+
import { SoundSettings } from '@rific/feedback-press';
|
|
17
|
+
import * as redux_persist from 'redux-persist';
|
|
18
|
+
import { PersistedState, Persistor } from 'redux-persist';
|
|
19
|
+
import * as _reduxjs_toolkit from '@reduxjs/toolkit';
|
|
20
|
+
import * as redux_thunk from 'redux-thunk';
|
|
21
|
+
import * as redux_persist_es_persistReducer from 'redux-persist/es/persistReducer';
|
|
22
|
+
import { ImageSourcePropType } from 'react-native';
|
|
23
|
+
import * as _tastic_achievements from '@tastic/achievements';
|
|
24
|
+
import { UnlockedAchievementsState, AchievementDefinition, AchievementsState } from '@tastic/achievements';
|
|
25
|
+
|
|
26
|
+
interface ActiveRound {
|
|
27
|
+
game: string;
|
|
28
|
+
mode: RoundMode;
|
|
29
|
+
settings: object;
|
|
30
|
+
}
|
|
31
|
+
type LiveplaySliceState = {
|
|
32
|
+
activelyPlaying: boolean;
|
|
33
|
+
activeRound: ActiveRound | null;
|
|
34
|
+
};
|
|
35
|
+
declare const reducer$3: _rific_core.SettingsReducer<LiveplaySliceState>;
|
|
36
|
+
declare const liveplayActions: {
|
|
37
|
+
initialize: {
|
|
38
|
+
(payload: LiveplaySliceState): _rific_core.SettingsAction<LiveplaySliceState>;
|
|
39
|
+
type: string;
|
|
40
|
+
match: (action: {
|
|
41
|
+
type: string;
|
|
42
|
+
}) => action is _rific_core.SettingsAction<LiveplaySliceState>;
|
|
43
|
+
};
|
|
44
|
+
} & {
|
|
45
|
+
setActivelyPlaying: {
|
|
46
|
+
(payload: boolean): _rific_core.SettingsAction<boolean>;
|
|
47
|
+
type: string;
|
|
48
|
+
match: (action: {
|
|
49
|
+
type: string;
|
|
50
|
+
}) => action is _rific_core.SettingsAction<boolean>;
|
|
51
|
+
};
|
|
52
|
+
setActiveRound: {
|
|
53
|
+
(payload: ActiveRound | null): _rific_core.SettingsAction<ActiveRound | null>;
|
|
54
|
+
type: string;
|
|
55
|
+
match: (action: {
|
|
56
|
+
type: string;
|
|
57
|
+
}) => action is _rific_core.SettingsAction<ActiveRound | null>;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
interface OpponentState {
|
|
62
|
+
seatTwo: SeatTwo;
|
|
63
|
+
}
|
|
64
|
+
declare const DEFAULT_OPPONENT: OpponentState;
|
|
65
|
+
declare const reducer$2: _rific_core.SettingsReducer<OpponentState>;
|
|
66
|
+
declare const opponentActions: {
|
|
67
|
+
initialize: {
|
|
68
|
+
(payload: OpponentState): _rific_core.SettingsAction<OpponentState>;
|
|
69
|
+
type: string;
|
|
70
|
+
match: (action: {
|
|
71
|
+
type: string;
|
|
72
|
+
}) => action is _rific_core.SettingsAction<OpponentState>;
|
|
73
|
+
};
|
|
74
|
+
} & {
|
|
75
|
+
setSeatTwo: {
|
|
76
|
+
(payload: SeatTwo): _rific_core.SettingsAction<SeatTwo>;
|
|
77
|
+
type: string;
|
|
78
|
+
match: (action: {
|
|
79
|
+
type: string;
|
|
80
|
+
}) => action is _rific_core.SettingsAction<SeatTwo>;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
interface AppSettings {
|
|
85
|
+
lockOrientation: boolean;
|
|
86
|
+
lockedRotation?: ViewRotation;
|
|
87
|
+
deferBottomEdgeGestures: boolean;
|
|
88
|
+
}
|
|
89
|
+
declare const DEFAULT_APP_SETTINGS: AppSettings;
|
|
90
|
+
declare const reducer$1: _rific_core.SettingsReducer<AppSettings>;
|
|
91
|
+
declare const appSettingsActions: {
|
|
92
|
+
initialize: {
|
|
93
|
+
(payload: Partial<AppSettings>): _rific_core.SettingsAction<Partial<AppSettings>>;
|
|
94
|
+
type: string;
|
|
95
|
+
match: (action: {
|
|
96
|
+
type: string;
|
|
97
|
+
}) => action is _rific_core.SettingsAction<Partial<AppSettings>>;
|
|
98
|
+
};
|
|
99
|
+
} & {};
|
|
100
|
+
|
|
101
|
+
type LastActiveGameState = {
|
|
102
|
+
gameId: string | null;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
declare function createShellReducers({ seatColors, appearance }: Pick<PackDefinition, 'seatColors' | 'appearance'>): {
|
|
106
|
+
theme: _rific_core.SettingsReducer<_rific_auto_paper.ThemeState>;
|
|
107
|
+
haptic: _rific_core.SettingsReducer<_rific_feedback_press.HapticSettings>;
|
|
108
|
+
sound: (state: SoundSettings | undefined, action: {
|
|
109
|
+
type: string;
|
|
110
|
+
}) => SoundSettings;
|
|
111
|
+
keepAwake: _rific_core.SettingsReducer<_rific_core.KeepAwakeSettings>;
|
|
112
|
+
profiles: typeof profilesReducer;
|
|
113
|
+
profileSelection: (state: _tastic_profile.ProfileSelectionState<Seat> | undefined, action: {
|
|
114
|
+
type: string;
|
|
115
|
+
payload?: unknown;
|
|
116
|
+
}) => _tastic_profile.ProfileSelectionState<Seat>;
|
|
117
|
+
seatColors: (state: _tastic_profile.SeatColorsState<Seat> | undefined, action: {
|
|
118
|
+
type: string;
|
|
119
|
+
payload?: unknown;
|
|
120
|
+
}) => _tastic_profile.SeatColorsState<Seat>;
|
|
121
|
+
appSettings: _rific_core.SettingsReducer<AppSettings>;
|
|
122
|
+
opponent: _rific_core.SettingsReducer<OpponentState>;
|
|
123
|
+
liveplay: _rific_core.SettingsReducer<LiveplaySliceState>;
|
|
124
|
+
};
|
|
125
|
+
type ShellReducers = ReturnType<typeof createShellReducers>;
|
|
126
|
+
type ShellState = {
|
|
127
|
+
[K in keyof ShellReducers]: ReturnType<ShellReducers[K]>;
|
|
128
|
+
} & {
|
|
129
|
+
lastActiveGame?: LastActiveGameState;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
type Seat = 1 | 2;
|
|
133
|
+
type SeatTwo = 'cpu' | 'person' | 'nobody';
|
|
134
|
+
type RoundMode = 'vsCpu' | 'twoPlayer' | 'solo';
|
|
135
|
+
declare function roundModeFor(seatTwo: SeatTwo): RoundMode;
|
|
136
|
+
declare function seatTwoFor(saved: SeatTwo, choices: readonly SeatTwo[] | undefined): SeatTwo;
|
|
137
|
+
declare function humanSeatsFor(mode: RoundMode): Seat[];
|
|
138
|
+
interface LoadoutOptionsProps {
|
|
139
|
+
host: PopoverHost;
|
|
140
|
+
rotation: ViewRotation;
|
|
141
|
+
accentColor: string;
|
|
142
|
+
mutedColor: string;
|
|
143
|
+
onAccentColor: string;
|
|
144
|
+
dark: boolean;
|
|
145
|
+
onRandomize?: () => void;
|
|
146
|
+
onReset?: () => void;
|
|
147
|
+
}
|
|
148
|
+
interface SeatControlLook {
|
|
149
|
+
accentColor: string;
|
|
150
|
+
seatColor: string;
|
|
151
|
+
mutedColor: string;
|
|
152
|
+
dark: boolean;
|
|
153
|
+
rotation: ViewRotation;
|
|
154
|
+
}
|
|
155
|
+
interface GameLoadout {
|
|
156
|
+
roundSettings: object;
|
|
157
|
+
options: (props: LoadoutOptionsProps) => ReactNode;
|
|
158
|
+
optionIds: readonly string[];
|
|
159
|
+
randomize: () => void;
|
|
160
|
+
reset: () => void;
|
|
161
|
+
seatControl: (seat: Seat, host: PopoverHost, look: SeatControlLook) => ReactNode | undefined;
|
|
162
|
+
cpuDifficulty?: {
|
|
163
|
+
value: string;
|
|
164
|
+
options: MenuOption<string>[];
|
|
165
|
+
onChange: (value: string) => void;
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
interface GameGuide {
|
|
169
|
+
version: number;
|
|
170
|
+
selectVersionSeen: (state: ShellState) => number;
|
|
171
|
+
markSeen: (version: number) => Action;
|
|
172
|
+
selectInput: (state: ShellState) => object;
|
|
173
|
+
getSteps: (input: object, context: {
|
|
174
|
+
touch: boolean;
|
|
175
|
+
mode: RoundMode;
|
|
176
|
+
}) => GuideStep[];
|
|
177
|
+
}
|
|
178
|
+
interface GameIconProps {
|
|
179
|
+
size: number;
|
|
180
|
+
p1Color: string;
|
|
181
|
+
p2Color: string;
|
|
182
|
+
dark: boolean;
|
|
183
|
+
}
|
|
184
|
+
interface GamePreviewProps {
|
|
185
|
+
width: number;
|
|
186
|
+
height: number;
|
|
187
|
+
p1Color: string;
|
|
188
|
+
p2Color: string;
|
|
189
|
+
dark: boolean;
|
|
190
|
+
}
|
|
191
|
+
interface GameDefinition {
|
|
192
|
+
id: string;
|
|
193
|
+
title: string;
|
|
194
|
+
blurb: string;
|
|
195
|
+
icon: ComponentType<GameIconProps>;
|
|
196
|
+
Preview?: ComponentType<GamePreviewProps>;
|
|
197
|
+
seatTwo?: readonly SeatTwo[];
|
|
198
|
+
twoPlayerSeats?: {
|
|
199
|
+
faceToFaceOnWeb: boolean;
|
|
200
|
+
followUpsideDown: boolean;
|
|
201
|
+
};
|
|
202
|
+
reducers: Record<string, Reducer>;
|
|
203
|
+
Provider: ComponentType<{
|
|
204
|
+
children: ReactNode;
|
|
205
|
+
}>;
|
|
206
|
+
useLoadout?: (mode: RoundMode) => GameLoadout;
|
|
207
|
+
PlayScreen: ComponentType;
|
|
208
|
+
resumable?: boolean;
|
|
209
|
+
StatsSections: ComponentType<{
|
|
210
|
+
profileId: string | null;
|
|
211
|
+
}>;
|
|
212
|
+
AchievementList: ComponentType<{
|
|
213
|
+
profileId: string | null;
|
|
214
|
+
}>;
|
|
215
|
+
resetStats: () => Action;
|
|
216
|
+
guide: GameGuide;
|
|
217
|
+
}
|
|
218
|
+
interface HeroTitleProps {
|
|
219
|
+
words: readonly [string, string];
|
|
220
|
+
color: string;
|
|
221
|
+
p1Color: string;
|
|
222
|
+
p2Color: string;
|
|
223
|
+
active: boolean;
|
|
224
|
+
fit?: {
|
|
225
|
+
width: number;
|
|
226
|
+
height: number;
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
interface PackStatsSectionsProps {
|
|
230
|
+
profileId: string | null;
|
|
231
|
+
gameId: string | null;
|
|
232
|
+
}
|
|
233
|
+
interface PackDefinition {
|
|
234
|
+
name: string;
|
|
235
|
+
wordmark: readonly [string, string];
|
|
236
|
+
colorCaption: string;
|
|
237
|
+
games: readonly GameDefinition[];
|
|
238
|
+
seatColors: Record<Seat, string>;
|
|
239
|
+
appearance?: ThemeAppearance;
|
|
240
|
+
HeroTitle: ComponentType<HeroTitleProps>;
|
|
241
|
+
fonts?: Record<string, FontSource>;
|
|
242
|
+
fontFamily?: string;
|
|
243
|
+
otaVersion: number;
|
|
244
|
+
SettingsSections?: ComponentType;
|
|
245
|
+
reducers?: Record<string, Reducer>;
|
|
246
|
+
StatsSections?: ComponentType<PackStatsSectionsProps>;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
declare function PackProvider({ pack, children }: {
|
|
250
|
+
pack: PackDefinition;
|
|
251
|
+
children: ReactNode;
|
|
252
|
+
}): react.JSX.Element;
|
|
253
|
+
declare function usePack(): PackDefinition;
|
|
254
|
+
declare function usePackGame(id: string | undefined): GameDefinition | undefined;
|
|
255
|
+
|
|
256
|
+
interface PackStoreConfig {
|
|
257
|
+
keyPrefix: string;
|
|
258
|
+
migrate?: (state: PersistedState, version: number) => Promise<PersistedState>;
|
|
259
|
+
}
|
|
260
|
+
type PackStoreSource = Pick<PackDefinition, 'seatColors' | 'appearance' | 'reducers'> & {
|
|
261
|
+
games: readonly Pick<GameDefinition, 'reducers' | 'resumable'>[];
|
|
262
|
+
};
|
|
263
|
+
declare function createPackStore(pack: PackStoreSource, { keyPrefix, migrate }: PackStoreConfig): {
|
|
264
|
+
store: _reduxjs_toolkit.EnhancedStore<{
|
|
265
|
+
theme: _rific_auto_paper.ThemeState;
|
|
266
|
+
haptic: _rific_feedback_press.HapticSettings;
|
|
267
|
+
sound: _rific_feedback_press.SoundSettings;
|
|
268
|
+
keepAwake: _rific_core.KeepAwakeSettings;
|
|
269
|
+
profiles: _tastic_profile.Profile[];
|
|
270
|
+
profileSelection: _tastic_profile.ProfileSelectionState<Seat>;
|
|
271
|
+
seatColors: _tastic_profile.SeatColorsState<Seat>;
|
|
272
|
+
appSettings: AppSettings;
|
|
273
|
+
opponent: OpponentState;
|
|
274
|
+
liveplay: LiveplaySliceState;
|
|
275
|
+
} & redux_persist_es_persistReducer.PersistPartial, {
|
|
276
|
+
type: string;
|
|
277
|
+
payload?: unknown;
|
|
278
|
+
} | {
|
|
279
|
+
type: string;
|
|
280
|
+
payload?: unknown;
|
|
281
|
+
} | {
|
|
282
|
+
type: string;
|
|
283
|
+
} | {
|
|
284
|
+
type: string;
|
|
285
|
+
} | {
|
|
286
|
+
type: string;
|
|
287
|
+
}, _reduxjs_toolkit.Tuple<[redux.StoreEnhancer<{
|
|
288
|
+
dispatch: redux_thunk.ThunkDispatch<{
|
|
289
|
+
theme: _rific_auto_paper.ThemeState;
|
|
290
|
+
haptic: _rific_feedback_press.HapticSettings;
|
|
291
|
+
sound: _rific_feedback_press.SoundSettings;
|
|
292
|
+
keepAwake: _rific_core.KeepAwakeSettings;
|
|
293
|
+
profiles: _tastic_profile.Profile[];
|
|
294
|
+
profileSelection: _tastic_profile.ProfileSelectionState<Seat>;
|
|
295
|
+
seatColors: _tastic_profile.SeatColorsState<Seat>;
|
|
296
|
+
appSettings: AppSettings;
|
|
297
|
+
opponent: OpponentState;
|
|
298
|
+
liveplay: LiveplaySliceState;
|
|
299
|
+
} & redux_persist_es_persistReducer.PersistPartial, undefined, redux.UnknownAction>;
|
|
300
|
+
}>, redux.StoreEnhancer]>>;
|
|
301
|
+
persistor: redux_persist.Persistor;
|
|
302
|
+
};
|
|
303
|
+
type PackStore = ReturnType<typeof createPackStore>['store'];
|
|
304
|
+
|
|
305
|
+
interface RootLayoutProps {
|
|
306
|
+
pack: PackDefinition;
|
|
307
|
+
store: PackStore;
|
|
308
|
+
persistor: Persistor;
|
|
309
|
+
}
|
|
310
|
+
declare function RootLayout({ pack, store, persistor }: RootLayoutProps): react.JSX.Element;
|
|
311
|
+
|
|
312
|
+
declare function LoadoutRoute(): react.JSX.Element;
|
|
313
|
+
declare function PlayRoute(): react.JSX.Element;
|
|
314
|
+
|
|
315
|
+
declare function HomeScreen(): react.JSX.Element;
|
|
316
|
+
|
|
317
|
+
declare const PREVIEW_ASPECT: number;
|
|
318
|
+
|
|
319
|
+
declare function ProfilesRoute(): react.JSX.Element;
|
|
320
|
+
|
|
321
|
+
declare function StatsScreen(): react.JSX.Element;
|
|
322
|
+
|
|
323
|
+
interface GameGuideContextValue {
|
|
324
|
+
openFirstTime: (gameId: string, next: () => void) => void;
|
|
325
|
+
openFor: (gameId: string) => void;
|
|
326
|
+
}
|
|
327
|
+
declare function useGameGuide(): GameGuideContextValue;
|
|
328
|
+
|
|
329
|
+
declare function imageGameIcon(images: {
|
|
330
|
+
light: ImageSourcePropType;
|
|
331
|
+
dark: ImageSourcePropType;
|
|
332
|
+
}): ComponentType<GameIconProps>;
|
|
333
|
+
|
|
334
|
+
interface SettingsDialogProps {
|
|
335
|
+
visible: boolean;
|
|
336
|
+
onDismiss: () => void;
|
|
337
|
+
rotation?: ViewRotation;
|
|
338
|
+
onShowHowToPlay?: () => void;
|
|
339
|
+
children?: ReactNode;
|
|
340
|
+
}
|
|
341
|
+
declare function SettingsDialog({ visible, onDismiss, rotation, onShowHowToPlay, children }: SettingsDialogProps): react.JSX.Element;
|
|
342
|
+
|
|
343
|
+
declare function useActiveRound<S extends object>(game: string, defaults: S): {
|
|
344
|
+
mode: RoundMode;
|
|
345
|
+
settings: S;
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
declare function useAppSettings(): {
|
|
349
|
+
settings: AppSettings;
|
|
350
|
+
setSettings: (patch: Partial<AppSettings>) => void;
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
declare function useOpponent(): {
|
|
354
|
+
seatTwo: SeatTwo;
|
|
355
|
+
setSeatTwo: (seatTwo: SeatTwo) => void;
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
interface ProfilesContextValue {
|
|
359
|
+
profiles: Profile[];
|
|
360
|
+
lastSelected: Record<Seat, string | null>;
|
|
361
|
+
loaded: boolean;
|
|
362
|
+
createProfile: (input: CreateProfileInput) => Profile;
|
|
363
|
+
updateProfile: (id: string, patch: Partial<CreateProfileInput>) => void;
|
|
364
|
+
deleteProfile: (id: string) => void;
|
|
365
|
+
selectProfile: (seat: Seat, profileId: string | null) => void;
|
|
366
|
+
}
|
|
367
|
+
interface Props {
|
|
368
|
+
children: ReactNode;
|
|
369
|
+
}
|
|
370
|
+
declare function ProfilesProvider({ children }: Props): react.JSX.Element;
|
|
371
|
+
declare function useProfiles(): ProfilesContextValue;
|
|
372
|
+
|
|
373
|
+
declare function useSeatColors(p2IsHuman: boolean): {
|
|
374
|
+
p1Color: string;
|
|
375
|
+
p2Color: string;
|
|
376
|
+
handleP1ColorChange: (hex: string) => void;
|
|
377
|
+
handleP2ColorChange: (hex: string) => void;
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
interface GameGuideState {
|
|
381
|
+
versionSeen: number;
|
|
382
|
+
}
|
|
383
|
+
declare function createGameGuideSlice(mountKey: string): {
|
|
384
|
+
actions: {
|
|
385
|
+
markSeen: (version: number) => {
|
|
386
|
+
type: string;
|
|
387
|
+
payload: number;
|
|
388
|
+
};
|
|
389
|
+
};
|
|
390
|
+
reducer: (state: GameGuideState | undefined, action: Action & {
|
|
391
|
+
payload?: unknown;
|
|
392
|
+
}) => GameGuideState;
|
|
393
|
+
selectVersionSeen: (rootState: object) => number;
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
declare function onProfileRemoved<S>(reducer: Reducer<S>, forget: (state: S, profileId: string) => S): Reducer<S>;
|
|
397
|
+
declare function forgetProfileAchievements<T, S extends {
|
|
398
|
+
stats: T;
|
|
399
|
+
unlocked: UnlockedAchievementsState;
|
|
400
|
+
}>(dropStats: (stats: T, profileId: string) => T): (state: S, profileId: string) => S;
|
|
401
|
+
|
|
402
|
+
type ProfileSelectionState = Record<Seat, string | null>;
|
|
403
|
+
declare const defaultProfileSelectionState: ProfileSelectionState;
|
|
404
|
+
declare const reducer: (state: _tastic_profile.ProfileSelectionState<Seat> | undefined, action: {
|
|
405
|
+
type: string;
|
|
406
|
+
payload?: unknown;
|
|
407
|
+
}) => _tastic_profile.ProfileSelectionState<Seat>;
|
|
408
|
+
declare const profileSelectionActions: _tastic_profile.ProfileSelectionActions<Seat>;
|
|
409
|
+
|
|
410
|
+
type SeatColorsState = SeatColorsState$1<Seat>;
|
|
411
|
+
declare function defaultSeatColorsState(seatColors: Record<Seat, string>): SeatColorsState;
|
|
412
|
+
declare function createSeatColorsReducer(seatColors: Record<Seat, string>): (state: SeatColorsState$1<Seat> | undefined, action: {
|
|
413
|
+
type: string;
|
|
414
|
+
payload?: unknown;
|
|
415
|
+
}) => SeatColorsState$1<Seat>;
|
|
416
|
+
declare const seatColorsActions: _tastic_profile.SeatColorsActions<Seat>;
|
|
417
|
+
|
|
418
|
+
interface RecordResult<TStats> {
|
|
419
|
+
device: AchievementDefinition<TStats>[];
|
|
420
|
+
profiles: Partial<Record<Seat, AchievementDefinition<TStats>[]>>;
|
|
421
|
+
}
|
|
422
|
+
interface GameStatsContextValue<TStats> {
|
|
423
|
+
stats: TStats;
|
|
424
|
+
unlockedAchievements: UnlockedAchievementsState;
|
|
425
|
+
record: (update: (prev: TStats) => TStats, profileIds?: Partial<Record<Seat, string>>) => RecordResult<TStats>;
|
|
426
|
+
resetAll: () => void;
|
|
427
|
+
}
|
|
428
|
+
interface GameStatsOptions<TStats, TBucket> {
|
|
429
|
+
key: string;
|
|
430
|
+
defaultStats: TStats;
|
|
431
|
+
isValidStats?: (value: unknown) => boolean;
|
|
432
|
+
catalog: AchievementDefinition<TStats>[];
|
|
433
|
+
getProfileStatsView: (bucket: TBucket) => TStats;
|
|
434
|
+
}
|
|
435
|
+
declare function createGameStats<TStats extends {
|
|
436
|
+
profiles: Record<string, TBucket>;
|
|
437
|
+
}, TBucket>({ key, defaultStats, isValidStats, catalog, getProfileStatsView }: GameStatsOptions<TStats, TBucket>): {
|
|
438
|
+
reducer: redux.Reducer<AchievementsState<TStats>>;
|
|
439
|
+
actions: _tastic_achievements.AchievementsActions<TStats>;
|
|
440
|
+
Provider: ({ children }: {
|
|
441
|
+
children: ReactNode;
|
|
442
|
+
}) => react.JSX.Element;
|
|
443
|
+
useStats: () => GameStatsContextValue<TStats>;
|
|
444
|
+
};
|
|
445
|
+
|
|
446
|
+
declare function seatPlayerKey(selection: Record<Seat, string | null>, seat: Seat): string;
|
|
447
|
+
type WithControls<C> = {
|
|
448
|
+
controlScheme: Record<Seat, C>;
|
|
449
|
+
};
|
|
450
|
+
type PlayerSettingsState<S> = Record<string, Partial<Omit<S, 'controlScheme'>>>;
|
|
451
|
+
type PlayerControlsState<C> = Record<string, C>;
|
|
452
|
+
interface PlayerSettingsOptions<S extends WithControls<C>, C> {
|
|
453
|
+
id: string;
|
|
454
|
+
defaults: S;
|
|
455
|
+
distinctControls?: readonly C[];
|
|
456
|
+
}
|
|
457
|
+
declare function createPlayerSettings<S extends WithControls<C>, C>({ id, defaults, distinctControls }: PlayerSettingsOptions<S, C>): {
|
|
458
|
+
reducers: {
|
|
459
|
+
[x: string]: redux.Reducer<PlayerSettingsState<S>> | redux.Reducer<PlayerControlsState<C>>;
|
|
460
|
+
};
|
|
461
|
+
settingsReducer: redux.Reducer<PlayerSettingsState<S>>;
|
|
462
|
+
controlsReducer: redux.Reducer<PlayerControlsState<C>>;
|
|
463
|
+
actions: {
|
|
464
|
+
patch: (player: string, changes: Partial<Omit<S, "controlScheme">>) => {
|
|
465
|
+
type: string;
|
|
466
|
+
payload: {
|
|
467
|
+
player: string;
|
|
468
|
+
changes: Partial<Omit<S, "controlScheme">>;
|
|
469
|
+
};
|
|
470
|
+
};
|
|
471
|
+
setControl: (player: string, control: C) => {
|
|
472
|
+
type: string;
|
|
473
|
+
payload: {
|
|
474
|
+
player: string;
|
|
475
|
+
control: C;
|
|
476
|
+
};
|
|
477
|
+
};
|
|
478
|
+
};
|
|
479
|
+
compose: (saved: PlayerSettingsState<S> | undefined, controls: PlayerControlsState<C> | undefined, selection: Record<Seat, string | null>, seatTwoIsPerson: boolean) => S;
|
|
480
|
+
select: (state: ShellState) => S;
|
|
481
|
+
useSettings: () => {
|
|
482
|
+
settings: S;
|
|
483
|
+
setSettings: (patch: Partial<S>) => void;
|
|
484
|
+
};
|
|
485
|
+
};
|
|
486
|
+
|
|
487
|
+
export { type ActiveRound, type AppSettings, DEFAULT_APP_SETTINGS, DEFAULT_OPPONENT, type GameDefinition, type GameGuide, type GameGuideState, type GameIconProps, type GameLoadout, type GamePreviewProps, type HeroTitleProps, HomeScreen, type LiveplaySliceState, type LoadoutOptionsProps, LoadoutRoute, type OpponentState, PREVIEW_ASPECT, type PackDefinition, PackProvider, type PackStatsSectionsProps, type PackStore, type PackStoreConfig, type PackStoreSource, PlayRoute, type PlayerControlsState, type PlayerSettingsState, type ProfileSelectionState, ProfilesProvider, ProfilesRoute, type RecordResult, RootLayout, type RoundMode, type Seat, type SeatColorsState, type SeatControlLook, type SeatTwo, SettingsDialog, type SettingsDialogProps, type ShellState, StatsScreen, appSettingsActions, reducer$1 as appSettingsReducer, createGameGuideSlice, createGameStats, createPackStore, createPlayerSettings, createSeatColorsReducer, createShellReducers, defaultProfileSelectionState, defaultSeatColorsState, forgetProfileAchievements, humanSeatsFor, imageGameIcon, liveplayActions, reducer$3 as liveplayReducer, onProfileRemoved, opponentActions, reducer$2 as opponentReducer, profileSelectionActions, reducer as profileSelectionReducer, roundModeFor, seatColorsActions, seatPlayerKey, seatTwoFor, useActiveRound, useAppSettings, useGameGuide, useOpponent, usePack, usePackGame, useProfiles, useSeatColors };
|