@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/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, the screen's rotation, and the colors the row draws with.
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 turned frame, so it's already turned with it.
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
- // How the 2 Player loadout seats its players, to match where the game puts them: always face
156
- // to face (or only off the web, where a desktop window seats them side by side), and whether an
157
- // upside-down hold swaps who is at the bottom. Only read in 2 Player, so a game without 'person'
158
- // among its seatTwo choices can leave it out.
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 while the phone is held upright. Unset, the bar is hidden on
176
- // every play screen for the whole round, whatever the angle; set, it's hidden only while the
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 turned with the phone (with the safe-area insets turned
306
- // onto the frame's edges) in place of the shell's. It renders inline: the toast provider is given no
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 measures a turned button
345
- // against the upright window, so with the phone held sideways it can pick the side with no room and
346
- // run the menu off the screen (Solitaire's useFrameAutoAlign places it in the turned frame instead).
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