@tastic/shell 0.3.1 → 0.5.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 +27 -15
- package/dist/index.d.mts +10 -14
- package/dist/index.d.ts +10 -14
- package/dist/index.js +203 -167
- package/dist/index.mjs +161 -125
- package/package.json +16 -18
- package/src/RootLayout.tsx +27 -66
- package/src/components/GuideHost.tsx +4 -6
- package/src/components/SettingsDialog.tsx +4 -10
- package/src/components/Theme.tsx +3 -2
- package/src/components/UpdateDialog.tsx +1 -3
- package/src/hooks/useFrozenWhileHidden.ts +2 -2
- package/src/index.ts +1 -1
- package/src/redux/appSettingsSlice.ts +0 -11
- package/src/screens/HomeScreen.tsx +98 -30
- package/src/screens/LoadoutScreen.tsx +35 -53
- package/src/screens/ProfilesRoute.tsx +5 -5
- package/src/screens/StatsScreen.tsx +4 -5
- package/src/screens/homeLayout.ts +15 -19
- package/src/types.ts +24 -21
package/src/types.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { ThemeAppearance, ThemeSettings } from '@rific/auto-paper'
|
|
2
|
-
import type { ViewRotation } from '@tastic/core'
|
|
3
2
|
import type { AlignResult, PopoverHost } from '@tastic/hud/chrome'
|
|
4
3
|
import type { GuideStep } from '@tastic/hud/guide'
|
|
5
4
|
import type { MenuOption } from '@tastic/hud/lobby'
|
|
@@ -39,10 +38,9 @@ export function humanSeatsFor(mode: RoundMode): Seat[] {
|
|
|
39
38
|
}
|
|
40
39
|
|
|
41
40
|
// What the loadout's match-options row is handed (see GameLoadout.options): the popover host it
|
|
42
|
-
// shares with seat 1's panel,
|
|
41
|
+
// shares with seat 1's panel, and the colors the row draws with.
|
|
43
42
|
export interface LoadoutOptionsProps {
|
|
44
43
|
host: PopoverHost
|
|
45
|
-
rotation: ViewRotation
|
|
46
44
|
accentColor: string
|
|
47
45
|
mutedColor: string
|
|
48
46
|
onAccentColor: string
|
|
@@ -58,7 +56,6 @@ export interface SeatControlLook {
|
|
|
58
56
|
seatColor: string
|
|
59
57
|
mutedColor: string
|
|
60
58
|
dark: boolean
|
|
61
|
-
rotation: ViewRotation
|
|
62
59
|
}
|
|
63
60
|
|
|
64
61
|
// One game's part of the shared loadout (shell/screens/LoadoutScreen.tsx), built by the game's
|
|
@@ -131,7 +128,7 @@ export interface PackGuide {
|
|
|
131
128
|
}
|
|
132
129
|
|
|
133
130
|
// A game's rules sheet (GameDefinition.Rules), opened from its tile's rules button on Home. It renders
|
|
134
|
-
// through a Paper Portal into a host Home mounts inside its
|
|
131
|
+
// through a Paper Portal into a host Home mounts inside its own frame.
|
|
135
132
|
export interface GameRulesProps {
|
|
136
133
|
visible: boolean
|
|
137
134
|
onDismiss: () => void
|
|
@@ -152,11 +149,10 @@ export interface GameDefinition {
|
|
|
152
149
|
// Seat 2's choices in this game, in menu order. 'nobody' only where the game has a solo mode.
|
|
153
150
|
// Left out by a game for one player only: its loadout has no seat 2 button and every round is solo.
|
|
154
151
|
seatTwo?: readonly SeatTwo[]
|
|
155
|
-
//
|
|
156
|
-
// to
|
|
157
|
-
//
|
|
158
|
-
|
|
159
|
-
twoPlayerSeats?: { faceToFaceOnWeb: boolean; followUpsideDown: boolean }
|
|
152
|
+
// The 2 Player loadout seats its players side by side (P1 on the left) in a window wider than tall,
|
|
153
|
+
// to match a game whose board does the same there. Unset, they sit face to face in any window (P1 at
|
|
154
|
+
// the bottom). Only read in 2 Player, so a game without 'person' among its seatTwo choices leaves it out.
|
|
155
|
+
sideBySideWhenWide?: boolean
|
|
160
156
|
// The store keys this game mounts (settings, achievements, guide), merged into the pack's store.
|
|
161
157
|
reducers: Record<string, Reducer>
|
|
162
158
|
// Mounted at the app root for the game's lifetime (its stats and achievements context). Left out by
|
|
@@ -172,9 +168,8 @@ export interface GameDefinition {
|
|
|
172
168
|
// board: the shell only remembers which game it was (redux/lastActiveGameSlice.ts). A match that
|
|
173
169
|
// isn't saved (liveplay) shouldn't opt in, or a relaunch would open a fresh one.
|
|
174
170
|
resumable?: boolean
|
|
175
|
-
// The play screen keeps the status bar
|
|
176
|
-
//
|
|
177
|
-
// content is turned, as on every other screen.
|
|
171
|
+
// The play screen keeps the status bar. Unset, the bar is hidden on every play screen for the whole
|
|
172
|
+
// round; set, it shows as on every other screen.
|
|
178
173
|
keepStatusBar?: boolean
|
|
179
174
|
// The game's stats sections and its achievement list for the stats screen, for one profile
|
|
180
175
|
// (null is Everyone).
|
|
@@ -225,6 +220,13 @@ export interface PackStatsSectionsProps {
|
|
|
225
220
|
gameId: string | null
|
|
226
221
|
}
|
|
227
222
|
|
|
223
|
+
// A tab on Home (PackDefinition.homeTabs): its label, and which of the pack's games it shows, in the
|
|
224
|
+
// pack's order (Solitaire's: the games with no seat 2, and the ones with one).
|
|
225
|
+
export interface HomeTab {
|
|
226
|
+
label: string
|
|
227
|
+
includes: (game: PackGameDefinition) => boolean
|
|
228
|
+
}
|
|
229
|
+
|
|
228
230
|
// The stack's screen options (expo-router's Stack), as an object: what PackDefinition.useScreenOptions
|
|
229
231
|
// returns.
|
|
230
232
|
export type StackScreenOptions = Exclude<NonNullable<ComponentProps<typeof Stack>['screenOptions']>, (...args: never[]) => unknown>
|
|
@@ -260,6 +262,10 @@ export interface PackDefinition {
|
|
|
260
262
|
// A seat's color pick for a profile is kept for this pack only; the seat button says so.
|
|
261
263
|
colorCaption: string
|
|
262
264
|
games: readonly PackGameDefinition[]
|
|
265
|
+
// Home splits the games into these tabs, a switch under seat 1's button (over the grid on a wide
|
|
266
|
+
// screen) showing one tab's games at a time. It opens on the first, and keeps the tab picked while Home
|
|
267
|
+
// is covered. Unset, or a single tab, shows every game with no switch.
|
|
268
|
+
homeTabs?: readonly HomeTab[]
|
|
263
269
|
// Player 1's and player 2's own default colors. They seed the theme's primary and secondary (the
|
|
264
270
|
// tertiary is derived from them, see shellState.ts) and the guest and CPU colors a fresh install
|
|
265
271
|
// starts with (seatColorsSlice.ts), so a fresh install's live theme and its remembered colors agree.
|
|
@@ -302,13 +308,10 @@ export interface PackDefinition {
|
|
|
302
308
|
useScreenOptions?: () => StackScreenOptions
|
|
303
309
|
// The two sounds every button plays, in place of the shell's own.
|
|
304
310
|
useFeedbackSounds?: () => FeedbackSounds
|
|
305
|
-
// The pack's own toaster, drawn in a frame
|
|
306
|
-
//
|
|
311
|
+
// The pack's own toaster, drawn in a frame over the whole app (inside the safe area) in place of the
|
|
312
|
+
// shell's. It renders inline: the toast provider is given no
|
|
307
313
|
// Paper, so nothing portals it out of the frame.
|
|
308
314
|
Toaster?: ComponentType
|
|
309
|
-
// Every screen reads upright while the software keyboard is up (@tastic/core's OrientationProvider),
|
|
310
|
-
// for typing a profile's name with the phone sideways.
|
|
311
|
-
portraitWhileKeyboard?: boolean
|
|
312
315
|
// false leaves Edge Guard out of Settings (a pack with no edge controls and no Edge Guard plugin).
|
|
313
316
|
edgeGuard?: boolean
|
|
314
317
|
// The theme seat 1's color makes (a muted seed with a harmony), applied whenever the seats' colors or
|
|
@@ -341,9 +344,9 @@ export interface PackDefinition {
|
|
|
341
344
|
newProfileColor?: string
|
|
342
345
|
// Where a picker's menu opens (its alignOverride) on Home (seat 1's button), a loadout's one-human row
|
|
343
346
|
// (both seat buttons; 2 Player keeps each menu in its own player's half), the stats screen (its two
|
|
344
|
-
// pickers) and Profiles (a profile's color swatch). hud's own placement
|
|
345
|
-
//
|
|
346
|
-
//
|
|
347
|
+
// pickers) and Profiles (a profile's color swatch). It was added because hud's own placement measured
|
|
348
|
+
// a button in a frame turned by @tastic/core's drawn rotation against the upright window; nothing turns
|
|
349
|
+
// since core 0.15, so a pack may no longer need one.
|
|
347
350
|
// `open` is whether this picker's menu is open, the size is its content's, and `maxContentWidth` is a
|
|
348
351
|
// capped column's width the menu stays inside (Profiles' roster). Unset is hud's own placement.
|
|
349
352
|
usePickerAlign?: PickerAlign
|