@tastic/shell 0.11.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.
package/README.md CHANGED
@@ -134,6 +134,8 @@ PuckTastic and DuelTastic draw what they always did:
134
134
  | `statsGameTitles?` | `false` leaves each game's name off its sections on All Games, where the sections name it. |
135
135
  | `newProfileColor?` | A new profile's starting color on Profiles. Unset is auto-paper's first swatch. |
136
136
  | `usePickerAlign?` | `(open, contentWidth, contentHeight, options?) => AlignResult` (`PickerAlign`), a hook: where seat 1's menu on Home, both seat buttons' menus in a loadout's one-human row (2 Player keeps each menu in its own player's half), the stats screen's two pickers and a profile's color swatch open. It was added because hud's own placement measured a button in a frame turned by `@tastic/core`'s drawn rotation against the upright window (Solitaire's `useFrameAutoAlign`); nothing turns since core 0.15, so a pack may no longer need one. Profiles passes `{ maxContentWidth: 640 }`, its roster's column. Unset is hud's placement. |
137
+ | `resumeHref?` | `(gameId) => Href \| null`: where a cold launch goes back into a resumable game, for a pack with more than one way to be playing it. Null, or unset, is the game's play screen. |
138
+ | `homePlayerPicker?` | `false` leaves seat 1's button off Home, for a pack whose every game opens a loadout, where the player is picked anyway. |
137
139
  | `homeTabs?` | Tabs splitting Home's games (`HomeTab`: a `label`, and `includes(game)`, which of the pack's games it shows, in the pack's order): a switch under seat 1's button, or over the grid on a wide screen, on the theme's surface over a `Backdrop`, showing one tab's games at a time. It opens on the first tab and keeps the one picked while Home is covered or the window changes. The other tabs' games stay mounted, hidden, so a switch draws nothing new. A game no tab includes isn't on Home. Unset, or a single tab, shows every game with no switch. Solitaire's: Solitaire (no `seatTwo`) and Two Player. |
138
140
 
139
141
  ### `GameDefinition`
@@ -173,6 +175,7 @@ settings for the round `mode` seat 2 makes:
173
175
  | --- | --- |
174
176
  | `roundSettings` | The settings the round plays with, committed (liveplay's `activeRound.settings`) once every human seat is Ready. The play screen reads them back with `useActiveRound`. |
175
177
  | `options` | `(props: LoadoutOptionsProps) => ReactNode`: the match-options row (board, rules, puck), drawn under the loadout's popover `host` in its colors (`accentColor`, `mutedColor`, `onAccentColor`, `dark`). `onRandomize` and `onReset` are undefined while the loadout folds them into its shared action band. |
178
+ | `placesSeats?` | With one person the seat buttons sit under `options`, over Ready. `true` passes them to `options` as `seats` instead, so a game can put them where it likes (CardTastic: under the game's name, above its rules). 2 Player's seats stay in each person's half. |
176
179
  | `optionIds` | The popover ids the options row opens, so the loadout lifts the row while one is open. |
177
180
  | `randomize`, `reset` | The loadout's randomize and reset buttons. |
178
181
  | `seatControl` | `(seat, host, look) => ReactNode \| undefined`: a human seat's controls picker (shot style, keys) in `look`'s colors (`SeatControlLook`: `accentColor`, `seatColor`, `mutedColor`, `dark`), or undefined where the game has none. |
package/dist/index.d.mts CHANGED
@@ -6,7 +6,7 @@ import { PopoverHost, AlignResult } from '@tastic/hud/chrome';
6
6
  import { GuideStep } from '@tastic/hud/guide';
7
7
  import { MenuOption } from '@tastic/hud/lobby';
8
8
  import { FontSource } from 'expo-font';
9
- import { Stack } from 'expo-router';
9
+ import { Href, Stack } from 'expo-router';
10
10
  import * as redux from 'redux';
11
11
  import { Reducer, Action } from 'redux';
12
12
  import * as _rific_core from '@rific/core';
@@ -140,6 +140,7 @@ interface LoadoutOptionsProps {
140
140
  dark: boolean;
141
141
  onRandomize?: () => void;
142
142
  onReset?: () => void;
143
+ seats?: ReactNode;
143
144
  }
144
145
  interface SeatControlLook {
145
146
  accentColor: string;
@@ -150,6 +151,7 @@ interface SeatControlLook {
150
151
  interface GameLoadout {
151
152
  roundSettings: object;
152
153
  options: (props: LoadoutOptionsProps) => ReactNode;
154
+ placesSeats?: boolean;
153
155
  optionIds: readonly string[];
154
156
  randomize: () => void;
155
157
  reset: () => void;
@@ -270,6 +272,8 @@ interface PackDefinition {
270
272
  colorCaption: string;
271
273
  games: readonly PackGameDefinition[];
272
274
  homeTabs?: readonly HomeTab[];
275
+ homePlayerPicker?: boolean;
276
+ resumeHref?: (gameId: string) => Href | null;
273
277
  seatColors: Record<Seat, string>;
274
278
  appearance?: ThemeAppearance;
275
279
  HeroTitle: ComponentType<HeroTitleProps>;
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@ import { PopoverHost, AlignResult } from '@tastic/hud/chrome';
6
6
  import { GuideStep } from '@tastic/hud/guide';
7
7
  import { MenuOption } from '@tastic/hud/lobby';
8
8
  import { FontSource } from 'expo-font';
9
- import { Stack } from 'expo-router';
9
+ import { Href, Stack } from 'expo-router';
10
10
  import * as redux from 'redux';
11
11
  import { Reducer, Action } from 'redux';
12
12
  import * as _rific_core from '@rific/core';
@@ -140,6 +140,7 @@ interface LoadoutOptionsProps {
140
140
  dark: boolean;
141
141
  onRandomize?: () => void;
142
142
  onReset?: () => void;
143
+ seats?: ReactNode;
143
144
  }
144
145
  interface SeatControlLook {
145
146
  accentColor: string;
@@ -150,6 +151,7 @@ interface SeatControlLook {
150
151
  interface GameLoadout {
151
152
  roundSettings: object;
152
153
  options: (props: LoadoutOptionsProps) => ReactNode;
154
+ placesSeats?: boolean;
153
155
  optionIds: readonly string[];
154
156
  randomize: () => void;
155
157
  reset: () => void;
@@ -270,6 +272,8 @@ interface PackDefinition {
270
272
  colorCaption: string;
271
273
  games: readonly PackGameDefinition[];
272
274
  homeTabs?: readonly HomeTab[];
275
+ homePlayerPicker?: boolean;
276
+ resumeHref?: (gameId: string) => Href | null;
273
277
  seatColors: Record<Seat, string>;
274
278
  appearance?: ThemeAppearance;
275
279
  HeroTitle: ComponentType<HeroTitleProps>;
package/dist/index.js CHANGED
@@ -889,33 +889,36 @@ function LoadoutScreen({ game }) {
889
889
  const p2Host = (0, import_chrome4.usePopoverHost)();
890
890
  const p1PickerOpen = controlsHost.openId?.startsWith("p1-") ?? false;
891
891
  const p1ControlOpen = controlsHost.openId === P1_CONTROL_ID;
892
+ const controlLook = { accentColor: themeColors.tertiary, mutedColor: fgMuted, dark };
893
+ const p1Control = loadout.seatControl(1, controlsHost, { ...controlLook, seatColor: p1Drawn });
894
+ const p1Panel = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lobby2.PlayerSetupPanel, { idPrefix: "p1", host: controlsHost, color: p1Color, onColorChange: handleP1ColorChange, swatches: import_auto_paper4.defaultColors, takenColor: p2Exists ? p2Color : void 0, allowSwapTaken: mode === "vsCpu", colorCaption: pack.colorCaption, isHuman: true, dark, showReadyButton: false, profiles, selectedProfileId: lastSelected[1], takenProfileId: p2IsHuman ? lastSelected[2] : null, guestLabel: pack.guestLabel ?? "P1", nullLabel: pack.nullLabel, onProfileSelect: handleP1ProfileSelect, onManageProfiles: () => import_expo_router4.router.push(PROFILES_HREF), previewValue: seatPreview, triggerStyle, useSeatPickerAlign: seatPickerAlign }, `p1-${layoutKey}`);
895
+ const opponentPicker = game.seatTwo && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(OpponentPicker, { idPrefix: "p1", host: controlsHost, choices: game.seatTwo, seatTwo, onSeatTwoChange: changeSeatTwo, cpuDifficulty: loadout.cpuDifficulty, color: p2Color, onColorChange: handleP2ColorChange, swatches: import_auto_paper4.defaultColors, takenColor: p1Color, allowSwapTaken: mode === "vsCpu", dark, previewValue: seatPreview, triggerStyle, usePickerAlign: seatPickerAlign }, `opponent-${layoutKey}`);
896
+ const toggleP1Ready = () => setReady((r) => ({ ...r, 1: !r[1] }));
897
+ const seatButtons = /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native6.View, { style: [styles3.seatOneButtons, p1PickerOpen && styles3.raised], children: [
898
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native_reanimated2.default.View, { style: [styles3.playersRow, p1PickerOpen && styles3.raised, !p2IsHuman && playersRowFade], children: [
899
+ p1Panel,
900
+ opponentPicker
901
+ ] }),
902
+ p1Control && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native6.View, { style: [styles3.controlRow, p1ControlOpen && styles3.raised], children: p1Control })
903
+ ] });
904
+ const seatsInOptions = !p2IsHuman && !!loadout.placesSeats;
905
+ const seatOne = /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native6.View, { style: [styles3.seatOne, !p2IsHuman && styles3.seatOneAlone, p1PickerOpen && !seatsInOptions && styles3.raised], children: [
906
+ !seatsInOptions && seatButtons,
907
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lobby2.ReadyButton, { color: p1Drawn, ready: ready[1], onToggleReady: toggleP1Ready, surfaceColor: readySurface, dark, style: !p2IsHuman && p1PickerOpen && styles3.readyButtonHidden })
908
+ ] });
892
909
  const optionsRow = loadout.options({
893
910
  host: controlsHost,
894
911
  accentColor: themeColors.tertiary,
895
912
  mutedColor: fgMuted,
896
913
  onAccentColor: themeColors.onTertiary,
897
914
  dark,
915
+ seats: seatsInOptions ? seatButtons : void 0,
898
916
  // Left out (the row's own actions unrendered) whenever the shared band below carries them.
899
917
  onRandomize: showMetaInSharedBand ? void 0 : loadout.randomize,
900
918
  onReset: showMetaInSharedBand ? void 0 : loadout.reset
901
919
  });
902
920
  const optionsPopoverOpen = controlsHost.openId !== null && loadout.optionIds.includes(controlsHost.openId);
903
921
  const sharedControls = showMetaInSharedBand ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lobby2.SharedActionBand, { onBack: import_core8.safeBack, onSettings: () => setSettingsOpen(true), onRandomize: loadout.randomize, onReset: loadout.reset, fg, popoverOpen: optionsPopoverOpen, children: optionsRow }) : optionsRow;
904
- const controlLook = { accentColor: themeColors.tertiary, mutedColor: fgMuted, dark };
905
- const p1Control = loadout.seatControl(1, controlsHost, { ...controlLook, seatColor: p1Drawn });
906
- const p1Panel = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lobby2.PlayerSetupPanel, { idPrefix: "p1", host: controlsHost, color: p1Color, onColorChange: handleP1ColorChange, swatches: import_auto_paper4.defaultColors, takenColor: p2Exists ? p2Color : void 0, allowSwapTaken: mode === "vsCpu", colorCaption: pack.colorCaption, isHuman: true, dark, showReadyButton: false, profiles, selectedProfileId: lastSelected[1], takenProfileId: p2IsHuman ? lastSelected[2] : null, guestLabel: pack.guestLabel ?? "P1", nullLabel: pack.nullLabel, onProfileSelect: handleP1ProfileSelect, onManageProfiles: () => import_expo_router4.router.push(PROFILES_HREF), previewValue: seatPreview, triggerStyle, useSeatPickerAlign: seatPickerAlign }, `p1-${layoutKey}`);
907
- const opponentPicker = game.seatTwo && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(OpponentPicker, { idPrefix: "p1", host: controlsHost, choices: game.seatTwo, seatTwo, onSeatTwoChange: changeSeatTwo, cpuDifficulty: loadout.cpuDifficulty, color: p2Color, onColorChange: handleP2ColorChange, swatches: import_auto_paper4.defaultColors, takenColor: p1Color, allowSwapTaken: mode === "vsCpu", dark, previewValue: seatPreview, triggerStyle, usePickerAlign: seatPickerAlign }, `opponent-${layoutKey}`);
908
- const toggleP1Ready = () => setReady((r) => ({ ...r, 1: !r[1] }));
909
- const seatOne = /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native6.View, { style: [styles3.seatOne, !p2IsHuman && styles3.seatOneAlone, p1PickerOpen && styles3.raised], children: [
910
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native6.View, { style: [styles3.seatOneButtons, p1PickerOpen && styles3.raised], children: [
911
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native_reanimated2.default.View, { style: [styles3.playersRow, p1PickerOpen && styles3.raised, !p2IsHuman && playersRowFade], children: [
912
- p1Panel,
913
- opponentPicker
914
- ] }),
915
- p1Control && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native6.View, { style: [styles3.controlRow, p1ControlOpen && styles3.raised], children: p1Control })
916
- ] }),
917
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lobby2.ReadyButton, { color: p1Drawn, ready: ready[1], onToggleReady: toggleP1Ready, surfaceColor: readySurface, dark, style: !p2IsHuman && p1PickerOpen && styles3.readyButtonHidden })
918
- ] });
919
922
  const p2Control = p2IsHuman ? loadout.seatControl(2, p2Host, { ...controlLook, seatColor: p2Drawn }) : void 0;
920
923
  const p2Panel = p2IsHuman && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lobby2.PlayerSetupPanel, { idPrefix: "p2", host: p2Host, color: p2Color, onColorChange: handleP2ColorChange, swatches: import_auto_paper4.defaultColors, takenColor: p1Color, colorCaption: pack.colorCaption, isHuman: true, ready: ready[2], onToggleReady: () => setReady((r) => ({ ...r, 2: !r[2] })), dark, secondPicker: p2Control, secondPickerId: p2Control ? P2_CONTROL_ID : void 0, profiles, selectedProfileId: lastSelected[2], takenProfileId: lastSelected[1], guestLabel: pack.guestLabel ?? "P2", nullLabel: pack.nullLabel, onProfileSelect: handleP2ProfileSelect, previewValue: seatPreview, triggerStyle, readySurfaceColor: readySurface }, "p2-zones");
921
924
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native6.View, { style: [styles3.container, { backgroundColor: bg }], children: [
@@ -936,7 +939,7 @@ function LoadoutScreen({ game }) {
936
939
  sharedElevated: optionsPopoverOpen
937
940
  }
938
941
  ) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native6.View, { style: styles3.stackedZone, children: [
939
- sharedControls,
942
+ seatsInOptions ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native6.View, { style: p1PickerOpen && styles3.raised, children: sharedControls }) : sharedControls,
940
943
  seatOne
941
944
  ] })
942
945
  ] }),
@@ -1103,7 +1106,7 @@ var HOME_LEFT_PANE_PICKER_HEIGHT = 44;
1103
1106
  var HOME_LEFT_PANE_PICKER_GAP = 12;
1104
1107
  var HOME_LEFT_PANE_BOTTOM_PADDING = 16;
1105
1108
  var HOME_HERO_SIDE_ROOM = 16;
1106
- function computeHomeLayout(windowWidth, windowHeight, insets) {
1109
+ function computeHomeLayout(windowWidth, windowHeight, insets, withPicker = true) {
1107
1110
  const isWide = windowWidth > windowHeight;
1108
1111
  if (!isWide) {
1109
1112
  return { isWide, windowWidth, windowHeight, insets, paddingLeft: 0, paddingRight: 0, leftPaneWidth: 0, rightPaneWidth: 0, columns: 1, tileWidth: 0, previewWidth: 0, heroFit: void 0 };
@@ -1119,7 +1122,7 @@ function computeHomeLayout(windowWidth, windowHeight, insets) {
1119
1122
  const previewWidth = Math.max(0, tileWidth - 2 * HOME_TILE_PADDING);
1120
1123
  const heroFit = {
1121
1124
  width: Math.max(0, leftPaneWidth - HOME_HERO_SIDE_ROOM),
1122
- 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)
1125
+ 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)
1123
1126
  };
1124
1127
  return {
1125
1128
  isWide,
@@ -1136,10 +1139,10 @@ function computeHomeLayout(windowWidth, windowHeight, insets) {
1136
1139
  heroFit
1137
1140
  };
1138
1141
  }
1139
- function useHomeLayout() {
1142
+ function useHomeLayout(withPicker = true) {
1140
1143
  const { width, height } = (0, import_react_native8.useWindowDimensions)();
1141
1144
  const insets = (0, import_react_native_safe_area_context4.useSafeAreaInsets)();
1142
- return computeHomeLayout(width, height, insets);
1145
+ return computeHomeLayout(width, height, insets, withPicker);
1143
1146
  }
1144
1147
 
1145
1148
  // src/screens/HomeScreen.tsx
@@ -1155,12 +1158,13 @@ function HomeScreen() {
1155
1158
  (0, import_react16.useEffect)(() => {
1156
1159
  if (!resumeGame) autoShowPack();
1157
1160
  }, [resumeGame, autoShowPack]);
1158
- if (resumeGame) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_expo_router6.Redirect, { href: playHref(resumeGame.id) });
1161
+ if (resumeGame) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_expo_router6.Redirect, { href: pack.resumeHref?.(resumeGame.id) ?? playHref(resumeGame.id) });
1159
1162
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(HomeMenu, {});
1160
1163
  }
1161
1164
  function HomeMenu() {
1162
1165
  const pack = usePack();
1163
- const layout = useHomeLayout();
1166
+ const showPicker = pack.homePlayerPicker !== false;
1167
+ const layout = useHomeLayout(showPicker);
1164
1168
  const { insets } = layout;
1165
1169
  const { dark, colors } = (0, import_auto_paper5.useAutoPaperTheme)();
1166
1170
  const { openFirstTime, openFor, openPack } = useGameGuide();
@@ -1221,12 +1225,12 @@ function HomeMenu() {
1221
1225
  ] }),
1222
1226
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native9.View, { style: [styles4.wideLeftPane, { left: layout.paddingLeft, width: layout.leftPaneWidth, paddingTop: HOME_TOP_BAND + insets.top, paddingBottom: 16 + insets.bottom }, pickerHost.openId !== null && styles4.pickerOpen], children: [
1223
1227
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(pack.HeroTitle, { words: pack.wordmark, color: fg, p1Color, p2Color, active: heroActive, fit: layout.heroFit }),
1224
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native9.View, { style: styles4.widePicker, children: picker })
1228
+ showPicker && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native9.View, { style: styles4.widePicker, children: picker })
1225
1229
  ] })
1226
1230
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_auto_paper5.FadingScrollView, { ...tab && columnClamp, style: styles4.scroll, contentContainerStyle: [styles4.content, { paddingTop: 56 + insets.top, paddingBottom: 24 + insets.bottom, paddingLeft: 16 + insets.left, paddingRight: 16 + insets.right }], children: [
1227
1231
  pressAway,
1228
1232
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(pack.HeroTitle, { words: pack.wordmark, color: fg, p1Color, p2Color, active: heroActive }),
1229
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native9.View, { style: [styles4.picker, pickerHost.openId !== null && styles4.pickerOpen], children: picker }),
1233
+ showPicker && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native9.View, { style: [styles4.picker, pickerHost.openId !== null && styles4.pickerOpen], children: picker }),
1230
1234
  tabBar && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native9.View, { style: styles4.listWidth, children: tabBar }),
1231
1235
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native9.View, { style: styles4.list, children: pack.games.map((game) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(GameRow, { game, hidden: isHidden(tab, game), dark, p1Color, p2Color, previewRevealed: previewsRevealed, onPress: () => openGame(game), onRules: hasRules(game) ? () => openRules(game) : void 0 }, game.id)) })
1232
1236
  ] }),
package/dist/index.mjs CHANGED
@@ -811,33 +811,36 @@ function LoadoutScreen({ game }) {
811
811
  const p2Host = usePopoverHost();
812
812
  const p1PickerOpen = controlsHost.openId?.startsWith("p1-") ?? false;
813
813
  const p1ControlOpen = controlsHost.openId === P1_CONTROL_ID;
814
+ const controlLook = { accentColor: themeColors.tertiary, mutedColor: fgMuted, dark };
815
+ const p1Control = loadout.seatControl(1, controlsHost, { ...controlLook, seatColor: p1Drawn });
816
+ const p1Panel = /* @__PURE__ */ jsx13(PlayerSetupPanel, { idPrefix: "p1", host: controlsHost, color: p1Color, onColorChange: handleP1ColorChange, swatches: defaultColors, takenColor: p2Exists ? p2Color : void 0, allowSwapTaken: mode === "vsCpu", colorCaption: pack.colorCaption, isHuman: true, dark, showReadyButton: false, profiles, selectedProfileId: lastSelected[1], takenProfileId: p2IsHuman ? lastSelected[2] : null, guestLabel: pack.guestLabel ?? "P1", nullLabel: pack.nullLabel, onProfileSelect: handleP1ProfileSelect, onManageProfiles: () => router2.push(PROFILES_HREF), previewValue: seatPreview, triggerStyle, useSeatPickerAlign: seatPickerAlign }, `p1-${layoutKey}`);
817
+ const opponentPicker = game.seatTwo && /* @__PURE__ */ jsx13(OpponentPicker, { idPrefix: "p1", host: controlsHost, choices: game.seatTwo, seatTwo, onSeatTwoChange: changeSeatTwo, cpuDifficulty: loadout.cpuDifficulty, color: p2Color, onColorChange: handleP2ColorChange, swatches: defaultColors, takenColor: p1Color, allowSwapTaken: mode === "vsCpu", dark, previewValue: seatPreview, triggerStyle, usePickerAlign: seatPickerAlign }, `opponent-${layoutKey}`);
818
+ const toggleP1Ready = () => setReady((r) => ({ ...r, 1: !r[1] }));
819
+ const seatButtons = /* @__PURE__ */ jsxs4(View3, { style: [styles3.seatOneButtons, p1PickerOpen && styles3.raised], children: [
820
+ /* @__PURE__ */ jsxs4(Animated.View, { style: [styles3.playersRow, p1PickerOpen && styles3.raised, !p2IsHuman && playersRowFade], children: [
821
+ p1Panel,
822
+ opponentPicker
823
+ ] }),
824
+ p1Control && /* @__PURE__ */ jsx13(View3, { style: [styles3.controlRow, p1ControlOpen && styles3.raised], children: p1Control })
825
+ ] });
826
+ const seatsInOptions = !p2IsHuman && !!loadout.placesSeats;
827
+ const seatOne = /* @__PURE__ */ jsxs4(View3, { style: [styles3.seatOne, !p2IsHuman && styles3.seatOneAlone, p1PickerOpen && !seatsInOptions && styles3.raised], children: [
828
+ !seatsInOptions && seatButtons,
829
+ /* @__PURE__ */ jsx13(ReadyButton, { color: p1Drawn, ready: ready[1], onToggleReady: toggleP1Ready, surfaceColor: readySurface, dark, style: !p2IsHuman && p1PickerOpen && styles3.readyButtonHidden })
830
+ ] });
814
831
  const optionsRow = loadout.options({
815
832
  host: controlsHost,
816
833
  accentColor: themeColors.tertiary,
817
834
  mutedColor: fgMuted,
818
835
  onAccentColor: themeColors.onTertiary,
819
836
  dark,
837
+ seats: seatsInOptions ? seatButtons : void 0,
820
838
  // Left out (the row's own actions unrendered) whenever the shared band below carries them.
821
839
  onRandomize: showMetaInSharedBand ? void 0 : loadout.randomize,
822
840
  onReset: showMetaInSharedBand ? void 0 : loadout.reset
823
841
  });
824
842
  const optionsPopoverOpen = controlsHost.openId !== null && loadout.optionIds.includes(controlsHost.openId);
825
843
  const sharedControls = showMetaInSharedBand ? /* @__PURE__ */ jsx13(SharedActionBand, { onBack: safeBack, onSettings: () => setSettingsOpen(true), onRandomize: loadout.randomize, onReset: loadout.reset, fg, popoverOpen: optionsPopoverOpen, children: optionsRow }) : optionsRow;
826
- const controlLook = { accentColor: themeColors.tertiary, mutedColor: fgMuted, dark };
827
- const p1Control = loadout.seatControl(1, controlsHost, { ...controlLook, seatColor: p1Drawn });
828
- const p1Panel = /* @__PURE__ */ jsx13(PlayerSetupPanel, { idPrefix: "p1", host: controlsHost, color: p1Color, onColorChange: handleP1ColorChange, swatches: defaultColors, takenColor: p2Exists ? p2Color : void 0, allowSwapTaken: mode === "vsCpu", colorCaption: pack.colorCaption, isHuman: true, dark, showReadyButton: false, profiles, selectedProfileId: lastSelected[1], takenProfileId: p2IsHuman ? lastSelected[2] : null, guestLabel: pack.guestLabel ?? "P1", nullLabel: pack.nullLabel, onProfileSelect: handleP1ProfileSelect, onManageProfiles: () => router2.push(PROFILES_HREF), previewValue: seatPreview, triggerStyle, useSeatPickerAlign: seatPickerAlign }, `p1-${layoutKey}`);
829
- const opponentPicker = game.seatTwo && /* @__PURE__ */ jsx13(OpponentPicker, { idPrefix: "p1", host: controlsHost, choices: game.seatTwo, seatTwo, onSeatTwoChange: changeSeatTwo, cpuDifficulty: loadout.cpuDifficulty, color: p2Color, onColorChange: handleP2ColorChange, swatches: defaultColors, takenColor: p1Color, allowSwapTaken: mode === "vsCpu", dark, previewValue: seatPreview, triggerStyle, usePickerAlign: seatPickerAlign }, `opponent-${layoutKey}`);
830
- const toggleP1Ready = () => setReady((r) => ({ ...r, 1: !r[1] }));
831
- const seatOne = /* @__PURE__ */ jsxs4(View3, { style: [styles3.seatOne, !p2IsHuman && styles3.seatOneAlone, p1PickerOpen && styles3.raised], children: [
832
- /* @__PURE__ */ jsxs4(View3, { style: [styles3.seatOneButtons, p1PickerOpen && styles3.raised], children: [
833
- /* @__PURE__ */ jsxs4(Animated.View, { style: [styles3.playersRow, p1PickerOpen && styles3.raised, !p2IsHuman && playersRowFade], children: [
834
- p1Panel,
835
- opponentPicker
836
- ] }),
837
- p1Control && /* @__PURE__ */ jsx13(View3, { style: [styles3.controlRow, p1ControlOpen && styles3.raised], children: p1Control })
838
- ] }),
839
- /* @__PURE__ */ jsx13(ReadyButton, { color: p1Drawn, ready: ready[1], onToggleReady: toggleP1Ready, surfaceColor: readySurface, dark, style: !p2IsHuman && p1PickerOpen && styles3.readyButtonHidden })
840
- ] });
841
844
  const p2Control = p2IsHuman ? loadout.seatControl(2, p2Host, { ...controlLook, seatColor: p2Drawn }) : void 0;
842
845
  const p2Panel = p2IsHuman && /* @__PURE__ */ jsx13(PlayerSetupPanel, { idPrefix: "p2", host: p2Host, color: p2Color, onColorChange: handleP2ColorChange, swatches: defaultColors, takenColor: p1Color, colorCaption: pack.colorCaption, isHuman: true, ready: ready[2], onToggleReady: () => setReady((r) => ({ ...r, 2: !r[2] })), dark, secondPicker: p2Control, secondPickerId: p2Control ? P2_CONTROL_ID : void 0, profiles, selectedProfileId: lastSelected[2], takenProfileId: lastSelected[1], guestLabel: pack.guestLabel ?? "P2", nullLabel: pack.nullLabel, onProfileSelect: handleP2ProfileSelect, previewValue: seatPreview, triggerStyle, readySurfaceColor: readySurface }, "p2-zones");
843
846
  return /* @__PURE__ */ jsxs4(View3, { style: [styles3.container, { backgroundColor: bg }], children: [
@@ -858,7 +861,7 @@ function LoadoutScreen({ game }) {
858
861
  sharedElevated: optionsPopoverOpen
859
862
  }
860
863
  ) : /* @__PURE__ */ jsxs4(View3, { style: styles3.stackedZone, children: [
861
- sharedControls,
864
+ seatsInOptions ? /* @__PURE__ */ jsx13(View3, { style: p1PickerOpen && styles3.raised, children: sharedControls }) : sharedControls,
862
865
  seatOne
863
866
  ] })
864
867
  ] }),
@@ -1025,7 +1028,7 @@ var HOME_LEFT_PANE_PICKER_HEIGHT = 44;
1025
1028
  var HOME_LEFT_PANE_PICKER_GAP = 12;
1026
1029
  var HOME_LEFT_PANE_BOTTOM_PADDING = 16;
1027
1030
  var HOME_HERO_SIDE_ROOM = 16;
1028
- function computeHomeLayout(windowWidth, windowHeight, insets) {
1031
+ function computeHomeLayout(windowWidth, windowHeight, insets, withPicker = true) {
1029
1032
  const isWide = windowWidth > windowHeight;
1030
1033
  if (!isWide) {
1031
1034
  return { isWide, windowWidth, windowHeight, insets, paddingLeft: 0, paddingRight: 0, leftPaneWidth: 0, rightPaneWidth: 0, columns: 1, tileWidth: 0, previewWidth: 0, heroFit: void 0 };
@@ -1041,7 +1044,7 @@ function computeHomeLayout(windowWidth, windowHeight, insets) {
1041
1044
  const previewWidth = Math.max(0, tileWidth - 2 * HOME_TILE_PADDING);
1042
1045
  const heroFit = {
1043
1046
  width: Math.max(0, leftPaneWidth - HOME_HERO_SIDE_ROOM),
1044
- 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)
1047
+ 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)
1045
1048
  };
1046
1049
  return {
1047
1050
  isWide,
@@ -1058,10 +1061,10 @@ function computeHomeLayout(windowWidth, windowHeight, insets) {
1058
1061
  heroFit
1059
1062
  };
1060
1063
  }
1061
- function useHomeLayout() {
1064
+ function useHomeLayout(withPicker = true) {
1062
1065
  const { width, height } = useWindowDimensions();
1063
1066
  const insets = useSafeAreaInsets3();
1064
- return computeHomeLayout(width, height, insets);
1067
+ return computeHomeLayout(width, height, insets, withPicker);
1065
1068
  }
1066
1069
 
1067
1070
  // src/screens/HomeScreen.tsx
@@ -1077,12 +1080,13 @@ function HomeScreen() {
1077
1080
  useEffect6(() => {
1078
1081
  if (!resumeGame) autoShowPack();
1079
1082
  }, [resumeGame, autoShowPack]);
1080
- if (resumeGame) return /* @__PURE__ */ jsx15(Redirect2, { href: playHref(resumeGame.id) });
1083
+ if (resumeGame) return /* @__PURE__ */ jsx15(Redirect2, { href: pack.resumeHref?.(resumeGame.id) ?? playHref(resumeGame.id) });
1081
1084
  return /* @__PURE__ */ jsx15(HomeMenu, {});
1082
1085
  }
1083
1086
  function HomeMenu() {
1084
1087
  const pack = usePack();
1085
- const layout = useHomeLayout();
1088
+ const showPicker = pack.homePlayerPicker !== false;
1089
+ const layout = useHomeLayout(showPicker);
1086
1090
  const { insets } = layout;
1087
1091
  const { dark, colors } = useAutoPaperTheme4();
1088
1092
  const { openFirstTime, openFor, openPack } = useGameGuide();
@@ -1143,12 +1147,12 @@ function HomeMenu() {
1143
1147
  ] }),
1144
1148
  /* @__PURE__ */ jsxs5(View4, { style: [styles4.wideLeftPane, { left: layout.paddingLeft, width: layout.leftPaneWidth, paddingTop: HOME_TOP_BAND + insets.top, paddingBottom: 16 + insets.bottom }, pickerHost.openId !== null && styles4.pickerOpen], children: [
1145
1149
  /* @__PURE__ */ jsx15(pack.HeroTitle, { words: pack.wordmark, color: fg, p1Color, p2Color, active: heroActive, fit: layout.heroFit }),
1146
- /* @__PURE__ */ jsx15(View4, { style: styles4.widePicker, children: picker })
1150
+ showPicker && /* @__PURE__ */ jsx15(View4, { style: styles4.widePicker, children: picker })
1147
1151
  ] })
1148
1152
  ] }) : /* @__PURE__ */ jsxs5(FadingScrollView, { ...tab && columnClamp, style: styles4.scroll, contentContainerStyle: [styles4.content, { paddingTop: 56 + insets.top, paddingBottom: 24 + insets.bottom, paddingLeft: 16 + insets.left, paddingRight: 16 + insets.right }], children: [
1149
1153
  pressAway,
1150
1154
  /* @__PURE__ */ jsx15(pack.HeroTitle, { words: pack.wordmark, color: fg, p1Color, p2Color, active: heroActive }),
1151
- /* @__PURE__ */ jsx15(View4, { style: [styles4.picker, pickerHost.openId !== null && styles4.pickerOpen], children: picker }),
1155
+ showPicker && /* @__PURE__ */ jsx15(View4, { style: [styles4.picker, pickerHost.openId !== null && styles4.pickerOpen], children: picker }),
1152
1156
  tabBar && /* @__PURE__ */ jsx15(View4, { style: styles4.listWidth, children: tabBar }),
1153
1157
  /* @__PURE__ */ jsx15(View4, { style: styles4.list, children: pack.games.map((game) => /* @__PURE__ */ jsx15(GameRow, { game, hidden: isHidden(tab, game), dark, p1Color, p2Color, previewRevealed: previewsRevealed, onPress: () => openGame(game), onRules: hasRules(game) ? () => openRules(game) : void 0 }, game.id)) })
1154
1158
  ] }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tastic/shell",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "The app around a pack of React Native games, two-seat or for one player: Home, the loadout, the stats screen, Profiles and Settings, the pack's Redux store and its root providers, driven by one PackDefinition",
5
5
  "keywords": [
6
6
  "react-native",
@@ -47,13 +47,14 @@ export function HomeScreen() {
47
47
  useEffect(() => {
48
48
  if (!resumeGame) autoShowPack()
49
49
  }, [resumeGame, autoShowPack])
50
- if (resumeGame) return <Redirect href={playHref(resumeGame.id)} />
50
+ if (resumeGame) return <Redirect href={pack.resumeHref?.(resumeGame.id) ?? playHref(resumeGame.id)} />
51
51
  return <HomeMenu />
52
52
  }
53
53
 
54
54
  function HomeMenu() {
55
55
  const pack = usePack()
56
- const layout = useHomeLayout()
56
+ const showPicker = pack.homePlayerPicker !== false
57
+ const layout = useHomeLayout(showPicker)
57
58
  const { insets } = layout
58
59
  const { dark, colors } = useAutoPaperTheme()
59
60
  const { openFirstTime, openFor, openPack } = useGameGuide()
@@ -136,6 +137,7 @@ function HomeMenu() {
136
137
  const pickerSize = getProfilePickerContentSize(profiles.length, true, colorSection)
137
138
  const pickerAlign = usePickerAlign(pickerHost.openId === `${SEAT_ONE_PICKER}-profile`, pickerSize.width, pickerSize.height)
138
139
 
140
+ // A pack can leave seat 1's button off Home (PackDefinition.homePlayerPicker)
139
141
  const picker = <ProfilePicker idPrefix={SEAT_ONE_PICKER} host={pickerHost} profiles={profiles} selectedId={lastSelected[1]} color={p1Drawn} dark={dark} guestLabel={pack.guestLabel ?? 'P1'} nullLabel={pack.nullLabel} onSelect={(profile: Profile | null) => selectProfile(1, profile?.id ?? null)} onManage={() => router.push(PROFILES_HREF)} colorSection={colorSection} alignOverride={pickerAlign} triggerStyle={triggerStyle} />
140
142
 
141
143
  // Closes seat 1's menu on a press anywhere but the menu and its button. Where it's mounted matters on
@@ -173,7 +175,7 @@ function HomeMenu() {
173
175
  paints over the tiles. box-none: only its controls claim taps. */}
174
176
  <View style={[styles.wideLeftPane, { left: layout.paddingLeft, width: layout.leftPaneWidth, paddingTop: HOME_TOP_BAND + insets.top, paddingBottom: 16 + insets.bottom }, pickerHost.openId !== null && styles.pickerOpen]}>
175
177
  <pack.HeroTitle words={pack.wordmark} color={fg} p1Color={p1Color} p2Color={p2Color} active={heroActive} fit={layout.heroFit} />
176
- <View style={styles.widePicker}>{picker}</View>
178
+ {showPicker && <View style={styles.widePicker}>{picker}</View>}
177
179
  </View>
178
180
  </>
179
181
  ) : (
@@ -183,7 +185,7 @@ function HomeMenu() {
183
185
 
184
186
  {/* Who's playing: seat 1's button, the same one each loadout starts with. Lifted above the
185
187
  tiles while its menu is open, so the menu paints over them. */}
186
- <View style={[styles.picker, pickerHost.openId !== null && styles.pickerOpen]}>{picker}</View>
188
+ {showPicker && <View style={[styles.picker, pickerHost.openId !== null && styles.pickerOpen]}>{picker}</View>}
187
189
 
188
190
  {tabBar && <View style={styles.listWidth}>{tabBar}</View>}
189
191
 
@@ -169,12 +169,40 @@ export function LoadoutScreen({ game }: { game: LoadoutGame }) {
169
169
  const p1PickerOpen = controlsHost.openId?.startsWith('p1-') ?? false
170
170
  const p1ControlOpen = controlsHost.openId === P1_CONTROL_ID
171
171
 
172
+ const controlLook = { accentColor: themeColors.tertiary, mutedColor: fgMuted, dark }
173
+ const p1Control = loadout.seatControl(1, controlsHost, { ...controlLook, seatColor: p1Drawn })
174
+ // Seat 1's button alone: player 1's controls and Ready sit under the row it shares with the
175
+ // opponent button, centered under both.
176
+ const p1Panel = <PlayerSetupPanel key={`p1-${layoutKey}`} idPrefix='p1' host={controlsHost} color={p1Color} onColorChange={handleP1ColorChange} swatches={defaultColors} takenColor={p2Exists ? p2Color : undefined} allowSwapTaken={mode === 'vsCpu'} colorCaption={pack.colorCaption} isHuman dark={dark} showReadyButton={false} profiles={profiles} selectedProfileId={lastSelected[1]} takenProfileId={p2IsHuman ? lastSelected[2] : null} guestLabel={pack.guestLabel ?? 'P1'} nullLabel={pack.nullLabel} onProfileSelect={handleP1ProfileSelect} onManageProfiles={() => router.push(PROFILES_HREF)} previewValue={seatPreview} triggerStyle={triggerStyle} useSeatPickerAlign={seatPickerAlign} />
177
+ // Who sits in seat 2, player 1's to pick in every mode. A game for one player (no seatTwo) has none:
178
+ // seat 1's button stands alone.
179
+ const opponentPicker = game.seatTwo && <OpponentPicker key={`opponent-${layoutKey}`} idPrefix='p1' host={controlsHost} choices={game.seatTwo} seatTwo={seatTwo} onSeatTwoChange={changeSeatTwo} cpuDifficulty={loadout.cpuDifficulty} color={p2Color} onColorChange={handleP2ColorChange} swatches={defaultColors} takenColor={p1Color} allowSwapTaken={mode === 'vsCpu'} dark={dark} previewValue={seatPreview} triggerStyle={triggerStyle} usePickerAlign={seatPickerAlign} />
180
+ const toggleP1Ready = () => setReady((r) => ({ ...r, 1: !r[1] }))
181
+ const seatButtons = (
182
+ <View style={[styles.seatOneButtons, p1PickerOpen && styles.raised]}>
183
+ <Animated.View style={[styles.playersRow, p1PickerOpen && styles.raised, !p2IsHuman && playersRowFade]}>
184
+ {p1Panel}
185
+ {opponentPicker}
186
+ </Animated.View>
187
+ {p1Control && <View style={[styles.controlRow, p1ControlOpen && styles.raised]}>{p1Control}</View>}
188
+ </View>
189
+ )
190
+ // With one person a game can place the seat buttons among its own options (GameLoadout.placesSeats).
191
+ const seatsInOptions = !p2IsHuman && !!loadout.placesSeats
192
+ const seatOne = (
193
+ <View style={[styles.seatOne, !p2IsHuman && styles.seatOneAlone, p1PickerOpen && !seatsInOptions && styles.raised]}>
194
+ {!seatsInOptions && seatButtons}
195
+ <ReadyButton color={p1Drawn} ready={ready[1]} onToggleReady={toggleP1Ready} surfaceColor={readySurface} dark={dark} style={!p2IsHuman && p1PickerOpen && styles.readyButtonHidden} />
196
+ </View>
197
+ )
198
+
172
199
  const optionsRow = loadout.options({
173
200
  host: controlsHost,
174
201
  accentColor: themeColors.tertiary,
175
202
  mutedColor: fgMuted,
176
203
  onAccentColor: themeColors.onTertiary,
177
204
  dark,
205
+ seats: seatsInOptions ? seatButtons : undefined,
178
206
  // Left out (the row's own actions unrendered) whenever the shared band below carries them.
179
207
  onRandomize: showMetaInSharedBand ? undefined : loadout.randomize,
180
208
  onReset: showMetaInSharedBand ? undefined : loadout.reset
@@ -189,27 +217,6 @@ export function LoadoutScreen({ game }: { game: LoadoutGame }) {
189
217
  optionsRow
190
218
  )
191
219
 
192
- const controlLook = { accentColor: themeColors.tertiary, mutedColor: fgMuted, dark }
193
- const p1Control = loadout.seatControl(1, controlsHost, { ...controlLook, seatColor: p1Drawn })
194
- // Seat 1's button alone: player 1's controls and Ready sit under the row it shares with the
195
- // opponent button, centered under both.
196
- const p1Panel = <PlayerSetupPanel key={`p1-${layoutKey}`} idPrefix='p1' host={controlsHost} color={p1Color} onColorChange={handleP1ColorChange} swatches={defaultColors} takenColor={p2Exists ? p2Color : undefined} allowSwapTaken={mode === 'vsCpu'} colorCaption={pack.colorCaption} isHuman dark={dark} showReadyButton={false} profiles={profiles} selectedProfileId={lastSelected[1]} takenProfileId={p2IsHuman ? lastSelected[2] : null} guestLabel={pack.guestLabel ?? 'P1'} nullLabel={pack.nullLabel} onProfileSelect={handleP1ProfileSelect} onManageProfiles={() => router.push(PROFILES_HREF)} previewValue={seatPreview} triggerStyle={triggerStyle} useSeatPickerAlign={seatPickerAlign} />
197
- // Who sits in seat 2, player 1's to pick in every mode. A game for one player (no seatTwo) has none:
198
- // seat 1's button stands alone.
199
- const opponentPicker = game.seatTwo && <OpponentPicker key={`opponent-${layoutKey}`} idPrefix='p1' host={controlsHost} choices={game.seatTwo} seatTwo={seatTwo} onSeatTwoChange={changeSeatTwo} cpuDifficulty={loadout.cpuDifficulty} color={p2Color} onColorChange={handleP2ColorChange} swatches={defaultColors} takenColor={p1Color} allowSwapTaken={mode === 'vsCpu'} dark={dark} previewValue={seatPreview} triggerStyle={triggerStyle} usePickerAlign={seatPickerAlign} />
200
- const toggleP1Ready = () => setReady((r) => ({ ...r, 1: !r[1] }))
201
- const seatOne = (
202
- <View style={[styles.seatOne, !p2IsHuman && styles.seatOneAlone, p1PickerOpen && styles.raised]}>
203
- <View style={[styles.seatOneButtons, p1PickerOpen && styles.raised]}>
204
- <Animated.View style={[styles.playersRow, p1PickerOpen && styles.raised, !p2IsHuman && playersRowFade]}>
205
- {p1Panel}
206
- {opponentPicker}
207
- </Animated.View>
208
- {p1Control && <View style={[styles.controlRow, p1ControlOpen && styles.raised]}>{p1Control}</View>}
209
- </View>
210
- <ReadyButton color={p1Drawn} ready={ready[1]} onToggleReady={toggleP1Ready} surfaceColor={readySurface} dark={dark} style={!p2IsHuman && p1PickerOpen && styles.readyButtonHidden} />
211
- </View>
212
- )
213
220
  // A person in seat 2: their own seat button (Player 2 or a profile, never the CPU), controls and
214
221
  // Ready, in their half.
215
222
  const p2Control = p2IsHuman ? loadout.seatControl(2, p2Host, { ...controlLook, seatColor: p2Drawn }) : undefined
@@ -243,7 +250,8 @@ export function LoadoutScreen({ game }: { game: LoadoutGame }) {
243
250
  />
244
251
  ) : (
245
252
  <View style={styles.stackedZone}>
246
- {sharedControls}
253
+ {/* A menu opening from seat buttons placed in the options has to clear Ready, the next sibling */}
254
+ {seatsInOptions ? <View style={p1PickerOpen && styles.raised}>{sharedControls}</View> : sharedControls}
247
255
  {seatOne}
248
256
  </View>
249
257
  )}
@@ -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.