@tastic/shell 0.10.0 → 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.
@@ -74,7 +74,7 @@ export interface HomeLayout {
74
74
  }
75
75
 
76
76
  // Pure form of useHomeLayout, for tests.
77
- export function computeHomeLayout(windowWidth: number, windowHeight: number, insets: EdgeInsets): HomeLayout {
77
+ export function computeHomeLayout(windowWidth: number, windowHeight: number, insets: EdgeInsets, withPicker = true): HomeLayout {
78
78
  const isWide = windowWidth > windowHeight
79
79
  if (!isWide) {
80
80
  return { isWide, windowWidth, windowHeight, insets, paddingLeft: 0, paddingRight: 0, leftPaneWidth: 0, rightPaneWidth: 0, columns: 1, tileWidth: 0, previewWidth: 0, heroFit: undefined }
@@ -95,10 +95,10 @@ export function computeHomeLayout(windowWidth: number, windowHeight: number, ins
95
95
  const previewWidth = Math.max(0, tileWidth - 2 * HOME_TILE_PADDING)
96
96
 
97
97
  // The hero gets the pane's width and whatever height the pane has left once the corner buttons'
98
- // band, seat 1's button and the bottom padding are taken: how it shrinks to fit is the pack's own.
98
+ // band, seat 1's button (where Home has one) and the bottom padding are taken: how it shrinks to fit is the pack's own.
99
99
  const heroFit = {
100
100
  width: Math.max(0, leftPaneWidth - HOME_HERO_SIDE_ROOM),
101
- height: Math.max(0, windowHeight - insets.top - insets.bottom - HOME_TOP_BAND - HOME_LEFT_PANE_PICKER_GAP - HOME_LEFT_PANE_PICKER_HEIGHT - HOME_LEFT_PANE_BOTTOM_PADDING)
101
+ height: Math.max(0, windowHeight - insets.top - insets.bottom - HOME_TOP_BAND - (withPicker ? HOME_LEFT_PANE_PICKER_GAP + HOME_LEFT_PANE_PICKER_HEIGHT : 0) - HOME_LEFT_PANE_BOTTOM_PADDING)
102
102
  }
103
103
 
104
104
  return {
@@ -118,8 +118,8 @@ export function computeHomeLayout(windowWidth: number, windowHeight: number, ins
118
118
  }
119
119
 
120
120
  // The live layout for the current window.
121
- export function useHomeLayout(): HomeLayout {
121
+ export function useHomeLayout(withPicker = true): HomeLayout {
122
122
  const { width, height } = useWindowDimensions()
123
123
  const insets = useSafeAreaInsets()
124
- return computeHomeLayout(width, height, insets)
124
+ return computeHomeLayout(width, height, insets, withPicker)
125
125
  }
package/src/types.ts CHANGED
@@ -3,7 +3,7 @@ import type { AlignResult, PopoverHost } from '@tastic/hud/chrome'
3
3
  import type { GuideStep } from '@tastic/hud/guide'
4
4
  import type { MenuOption } from '@tastic/hud/lobby'
5
5
  import type { FontSource } from 'expo-font'
6
- import type { Stack } from 'expo-router'
6
+ import type { Href, Stack } from 'expo-router'
7
7
  import type { ComponentProps, ComponentType, ReactNode } from 'react'
8
8
  import type { Action, Reducer } from 'redux'
9
9
 
@@ -51,6 +51,9 @@ export interface LoadoutOptionsProps {
51
51
  // Undefined while the loadout folds randomize/reset into its shared action band instead.
52
52
  onRandomize?: () => void
53
53
  onReset?: () => void
54
+ // With one person, player 1's row of buttons (their seat's, the opponent's and their controls), for a
55
+ // game whose loadout sets placesSeats to put where it likes. Undefined otherwise.
56
+ seats?: ReactNode
54
57
  }
55
58
 
56
59
  // The colors a seat's controls picker draws with: the loadout's tertiary accent, or the seat's own.
@@ -69,6 +72,10 @@ export interface GameLoadout {
69
72
  // The match-options row (board, rules, puck): the game's own controls, drawn under the shared
70
73
  // popover host so its menus open, elevate and close like every other loadout menu.
71
74
  options: (props: LoadoutOptionsProps) => ReactNode
75
+ // With one person the seat buttons sit under the options row, over Ready. True hands them to `options`
76
+ // instead (LoadoutOptionsProps.seats), for a game that wants them among its own (over its rules, under
77
+ // its name). 2 Player's seats stay in each person's half.
78
+ placesSeats?: boolean
72
79
  // The popover ids the options row opens, so the loadout can elevate the row while one is open.
73
80
  optionIds: readonly string[]
74
81
  randomize: () => void
@@ -277,6 +284,12 @@ export interface PackDefinition {
277
284
  // screen) showing one tab's games at a time. It opens on the first, and keeps the tab picked while Home
278
285
  // is covered. Unset, or a single tab, shows every game with no switch.
279
286
  homeTabs?: readonly HomeTab[]
287
+ // False leaves seat 1's button off Home, for a pack whose every game opens a loadout, where the
288
+ // player is picked anyway (CardTastic). Home's hero then takes its room.
289
+ homePlayerPicker?: boolean
290
+ // Where a cold launch goes back into a resumable game, for a pack with more than one way to be playing
291
+ // it (CardTastic's Daily Deals). Null, or unset, is the game's play screen.
292
+ resumeHref?: (gameId: string) => Href | null
280
293
  // Player 1's and player 2's own default colors. They seed the theme's primary and secondary (the
281
294
  // tertiary is derived from them, see shellState.ts) and the guest and CPU colors a fresh install
282
295
  // starts with (seatColorsSlice.ts), so a fresh install's live theme and its remembered colors agree.
@@ -342,7 +355,8 @@ export interface PackDefinition {
342
355
  // game) and from Home's Settings, never in a play screen.
343
356
  guide?: PackGuide
344
357
  // Seat 1's button, on Home and in every loadout: the chip's label for a guest (default 'P1') and the
345
- // guest row's in its menu (default @tastic/profile's).
358
+ // guest row's in its menu (default @tastic/profile's). A 2 Player loadout's seat 2 button takes the
359
+ // same two, its guest label defaulting to 'P2'.
346
360
  guestLabel?: string
347
361
  nullLabel?: string
348
362
  // The stats screen keeps a guest's stats under GUEST_PLAYER_ID: a Guest entry in the player picker