@tastic/shell 0.16.0 → 0.17.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/README.md CHANGED
@@ -115,7 +115,7 @@ the front of an in-app link, so a route starting with a game id equal to the bas
115
115
  | `useSettingsRules?` | A hook returning what goes first in every Settings dialog, above the shell's rows: the rules of the game it's opened in. Null where there's nothing (Home). |
116
116
  | `SettingsSections?` | The pack's own Settings sections, in every Settings dialog, under the shell's rows and any a play screen adds. |
117
117
  | `reducers?` | The pack's own store keys (what `SettingsSections` saves), beside the shell's and the games'. Never a key either already mounts. |
118
- | `StatsSections?` | A section across the pack's games (a calendar of play), first on the stats screen's Stats tab, handed its two filters (`PackStatsSectionsProps`: `profileId`, null for Everyone, and `gameId`, null for All Games). |
118
+ | `StatsSections?` | A section across the pack's games (a calendar of play), first on the stats screen's Stats tab, handed its two filters (`PackStatsSectionsProps`: `profileId`, null for Everyone; `gameId`, the one game picked, else null; and `gameIds`, the games picked: null for All Games, a Home tab's games, or `[gameId]`). |
119
119
 
120
120
  For a pack for one player at a time (CardTastic, from Solitaire), each optional and off when unset, so
121
121
  PuckTastic and DuelTastic draw what they always did:
@@ -125,7 +125,7 @@ PuckTastic and DuelTastic draw what they always did:
125
125
  | `Backdrop?` | A table drawn once behind the whole stack (Solitaire's felt). The stack's two layers go transparent (the screens' `contentStyle` and the navigation theme's `colors.background`, which React Navigation paints around every screen), the root window stays dark so light mode doesn't flash white on a push, Android's push and pop crossfade (its default holds the outgoing screen opaque), and Home, each loadout, the stats screen and Profiles draw transparent, with their buttons and tabs on the theme's surface (a loadout's Ready buttons too, filled with the seat's color once ready). |
126
126
  | `foreground?` | The color of what those screens draw straight on the background (the hero, the corner buttons, headers), and at half strength a loadout's muted options. Unset is black or white with the theme. |
127
127
  | `Provider?` | Mounted once around How to Play and the stack, inside the store, the theme, profiles and every game's `Provider` (one stats context across the pack's games). |
128
- | `useScreenOptions?` | A hook returning stack screen options (`StackScreenOptions`), merged after the shell's own (a status bar style of the pack's own, Reduce Motion's crossfade). The shell's already follow the app's theme, and stay dark over a `Backdrop`. |
128
+ | `useScreenOptions?` | A hook returning stack screen options (`StackScreenOptions`), merged after the shell's own (a status bar style of the pack's own, Reduce Motion's crossfade). The shell's already follow the app's theme, and stay dark over a `Backdrop`. They also slide a replaced screen in as a pop (`animationTypeForReplace: 'pop'`) on every screen but a play screen, since a replace there is a way back with nothing beneath to pop to (`safeBack`'s fallback to Home, a `dismissTo` whose screen isn't on the stack). |
129
129
  | `useFeedbackSounds?` | A hook returning the two sounds every button plays (`FeedbackSounds`: `selection`, `notification`), in place of the shell's two wavs. |
130
130
  | `Toaster?` | The pack's own toaster, drawn in a frame over the whole app (inside the safe area) in place of the shell's. The toast provider is given no Paper, so nothing portals it out of the frame. |
131
131
  | `edgeGuard?` | `false` leaves Edge Guard out of Settings (no edge controls, no Edge Guard plugin), and out of the play screens' options on Android. |
@@ -144,7 +144,7 @@ PuckTastic and DuelTastic draw what they always did:
144
144
  | `usePickerAlign?` | `(open, contentWidth, contentHeight) => 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) and the stats screen's two pickers 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. (A profile's color swatch used it too, until the swatches moved onto the Edit Profile screen.) Unset is hud's placement. |
145
145
  | `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. |
146
146
  | `homePlayerPicker?` | `false` leaves seat 1's button off Home, for a pack whose every game opens a loadout, where the player is picked anyway. |
147
- | `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. |
147
+ | `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. The stats screen's game picker groups its games by them too: All Games, then a row per tab opening its page of an All row (the pill then reads the tab's name) and its games. |
148
148
 
149
149
  ### `GameDefinition`
150
150
 
@@ -164,7 +164,7 @@ What a game can leave out or add, each optional, so a two-seat game sets none of
164
164
  | no `'cpu'` in `seatTwo` | A game with no CPU, such as `['nobody', 'person']`. Seat 2's saved choice is the whole pack's and starts on the CPU, so `seatTwoFor` reads a choice a game doesn't offer as the CPU where it has one, and as its first choice where it has none: a fresh install opens this game's loadout on that choice, its How to Play describes it, and `useActiveRound` falls back to it. The saved choice only changes when player 1 picks another. |
165
165
  | no `useLoadout` | Nothing to set up first: Home opens its play screen straight away, after its How to Play the first time, and a link to its loadout plays it. Its rule variants go in its play screen's Settings: `<SettingsDialog>` takes `children`. |
166
166
  | no `cpuDifficulty` (in `GameLoadout`) | A CPU with no levels: player 1's opponent menu offers one plain CPU. |
167
- | `resumable` | A cold launch drops the player back into its play screen if they left the app there rather than backing out of it. The shell remembers only which game (`lastActiveGame`); the game saves and restores its own board. |
167
+ | `resumable` | A cold launch drops the player back into its play screen if they left the app there rather than backing out of it, with its loadout (when it has one) and Home beneath it, as if they'd walked there, so every way back is a pop. The shell remembers only which game (`lastActiveGame`); the game saves and restores its own board. |
168
168
  | `Preview` | Drawn on Home in place of the icon (`GamePreviewProps`: `width`, `height`, the seats' colors, `dark`), in a box of `PREVIEW_ASPECT` (360:200), a frame after Home first paints. While any game has one, Home shows tiles: rows upright, and on a wide screen a grid beside the hero and seat 1's button. A game without one keeps its icon. |
169
169
  | no `icon` | Only with a `Preview`, which Home draws in its place. |
170
170
  | no `Provider` | A game whose stats live in the pack's own `Provider`. |
@@ -400,7 +400,7 @@ what the shell started using (noted in the table).
400
400
  | `@rific/toaster` | >=0.10.1 | toasts |
401
401
  | `@tastic/core` | >=0.16.0 | the seat mode from the window's shape, the root background, the test for a computer behind `useAtComputer` (0.16.0's `useIsTouchPrimaryDevice`) |
402
402
  | `@tastic/hud` | >=0.37.0 | Settings, the stats screen, the loadout's panels (its Skia-free `/lobby` entry, new in 0.26.0; 0.27.1's options for a pack drawn on its own backdrop; 0.28.0's Ready pill; 0.29.0's leading Settings sections), How to Play, and `ScreenFrame` around the stats screen, Profiles, Edit Profile and the toaster (0.34.0, where `RotatedFrame` became `ScreenFrame`), a pack's lettering (0.35.0's `LetteringProvider`), Settings' Profile row (0.37.0's `profilesRow`) |
403
- | `@tastic/profile` | >=0.25.0 | profiles and the shared roster, the seat buttons, seat colors, the dividers in player 1's opponent menu (0.18.0's `dividerBefore`), and each profile's Edit Profile screen (0.22.0's `EditProfileScreen`, behind `EditProfileRoute`, with a pack's sections from 0.25.0) |
403
+ | `@tastic/profile` | >=0.26.0 | profiles and the shared roster, the seat buttons, seat colors, the dividers in player 1's opponent menu (0.18.0's `dividerBefore`), and each profile's Edit Profile screen (0.22.0's `EditProfileScreen`, behind `EditProfileRoute`, with a pack's sections from 0.25.0) |
404
404
  | `@tastic/achievements` | >=0.6.0 | `createGameStats`, `forgetProfileAchievements` |
405
405
  | `@tastic/split-screen` | >=0.5.5 | the 2 Player loadout's two halves |
406
406
  | `@tastic/edge-guard` | >=0.2.0 | Edge Guard during play (`useEdgeGestureGuard` on iOS, `edgeGuardScreenOptions` on Android) |
package/dist/index.d.mts CHANGED
@@ -243,6 +243,7 @@ interface HeroTitleProps {
243
243
  interface PackStatsSectionsProps {
244
244
  profileId: string | null;
245
245
  gameId: string | null;
246
+ gameIds: readonly string[] | null;
246
247
  }
247
248
  interface HomeTab {
248
249
  label: string;
@@ -385,7 +386,7 @@ declare function EditProfileRoute(): react.JSX.Element;
385
386
  declare function LoadoutRoute(): react.JSX.Element;
386
387
  declare function PlayRoute(): react.JSX.Element;
387
388
 
388
- declare function HomeScreen(): react.JSX.Element;
389
+ declare function HomeScreen(): react.JSX.Element | null;
389
390
 
390
391
  declare const PREVIEW_ASPECT: number;
391
392
 
package/dist/index.d.ts CHANGED
@@ -243,6 +243,7 @@ interface HeroTitleProps {
243
243
  interface PackStatsSectionsProps {
244
244
  profileId: string | null;
245
245
  gameId: string | null;
246
+ gameIds: readonly string[] | null;
246
247
  }
247
248
  interface HomeTab {
248
249
  label: string;
@@ -385,7 +386,7 @@ declare function EditProfileRoute(): react.JSX.Element;
385
386
  declare function LoadoutRoute(): react.JSX.Element;
386
387
  declare function PlayRoute(): react.JSX.Element;
387
388
 
388
- declare function HomeScreen(): react.JSX.Element;
389
+ declare function HomeScreen(): react.JSX.Element | null;
389
390
 
390
391
  declare const PREVIEW_ASPECT: number;
391
392
 
package/dist/index.js CHANGED
@@ -490,6 +490,8 @@ function useProfiles() {
490
490
  var import_jsx_runtime10 = require("react/jsx-runtime");
491
491
  var PLAY_OPTIONS = { statusBarHidden: true };
492
492
  var KEEP_STATUS_BAR_OPTIONS = {};
493
+ var REPLACE_AS_BACK = { animationTypeForReplace: "pop" };
494
+ var REPLACE_AS_FORWARD = { animationTypeForReplace: "push" };
493
495
  var TRANSPARENT_CONTENT = { backgroundColor: "transparent" };
494
496
  var noScreenOptions = () => ({});
495
497
  function AppStack() {
@@ -508,7 +510,7 @@ function AppStack() {
508
510
  ({ route }) => {
509
511
  const id = route.params?.game;
510
512
  const statusBarOptions = pack.games.some((g) => g.id === id && g.keepStatusBar) ? KEEP_STATUS_BAR_OPTIONS : PLAY_OPTIONS;
511
- return { ...statusBarOptions, ...edgeGuardOptions };
513
+ return { ...statusBarOptions, ...edgeGuardOptions, ...REPLACE_AS_FORWARD };
512
514
  },
513
515
  [pack.games, edgeGuardOptions]
514
516
  );
@@ -517,7 +519,7 @@ function AppStack() {
517
519
  const base = darkRoot ? import_expo_router.DarkTheme : import_expo_router.DefaultTheme;
518
520
  return { ...base, colors: { ...base.colors, background: navigationBackground } };
519
521
  }, [darkRoot, navigationBackground]);
520
- const stack = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_expo_router.ThemeProvider, { value: navigationTheme, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_expo_router.Stack, { screenOptions: { ...rootBackground, statusBarStyle, ...backdropOptions, ...packOptions }, children: [
522
+ const stack = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_expo_router.ThemeProvider, { value: navigationTheme, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_expo_router.Stack, { screenOptions: { ...rootBackground, statusBarStyle, ...REPLACE_AS_BACK, ...backdropOptions, ...packOptions }, children: [
521
523
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_expo_router.Stack.Screen, { name: "index" }),
522
524
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_expo_router.Stack.Screen, { name: "play/[game]", options: playOptions })
523
525
  ] }) });
@@ -1199,8 +1201,26 @@ function HomeScreen() {
1199
1201
  (0, import_react16.useEffect)(() => {
1200
1202
  if (!resumeGame) autoShowPack();
1201
1203
  }, [resumeGame, autoShowPack]);
1202
- if (resumeGame) return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_expo_router9.Redirect, { href: pack.resumeHref?.(resumeGame.id) ?? playHref(resumeGame.id) });
1203
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(HomeMenu, {});
1204
+ useResume(resumeGame);
1205
+ return useMenuShown(!!resumeGame) ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(HomeMenu, {}) : null;
1206
+ }
1207
+ function useResume(game) {
1208
+ const pack = usePack();
1209
+ const done = (0, import_react16.useRef)(false);
1210
+ (0, import_expo_router9.useFocusEffect)(
1211
+ (0, import_react16.useCallback)(() => {
1212
+ if (!game || done.current) return;
1213
+ done.current = true;
1214
+ if (game.useLoadout) import_expo_router9.router.push(loadoutHref(game.id));
1215
+ import_expo_router9.router.push(pack.resumeHref?.(game.id) ?? playHref(game.id));
1216
+ }, [game, pack])
1217
+ );
1218
+ }
1219
+ function useMenuShown(resuming) {
1220
+ const isFocused = (0, import_expo_router9.useIsFocused)();
1221
+ const [covered, setCovered] = (0, import_react16.useState)(false);
1222
+ if (resuming && !covered && !isFocused) setCovered(true);
1223
+ return (0, import_react16.useDeferredValue)(!resuming || covered);
1204
1224
  }
1205
1225
  function HomeMenu() {
1206
1226
  const pack = usePack();
@@ -1524,6 +1544,8 @@ var LABEL_WIDE_TAB = { flex: 0, flexBasis: "auto", flexGrow: 1, flexShrink: 1 };
1524
1544
  var NO_PACK_TABS = [];
1525
1545
  var EVERYONE = "__everyone__";
1526
1546
  var ALL_GAMES = "__all__";
1547
+ var tabGroup = (index) => `__tab-group-${index}__`;
1548
+ var tabGames = (index) => `__tab-${index}__`;
1527
1549
  var PLAYER_PICKER_ID = "stats-player";
1528
1550
  var GAME_PICKER_ID = "stats-game";
1529
1551
  var MANAGE = "__manage__";
@@ -1552,12 +1574,21 @@ function StatsContent({ pickerHost }) {
1552
1574
  const statsPlayer = useStatsPlayer();
1553
1575
  const [selectedProfileId, setSelectedProfileId] = (0, import_react17.useState)(() => pack.useStatsPlayer ? statsPlayer : pack.guestStats ? lastSelected[1] ?? GUEST_PLAYER_ID : null);
1554
1576
  const profileId = selectedProfileId && profiles.length > 0 && (pack.guestStats && selectedProfileId === GUEST_PLAYER_ID || profiles.some((p) => p.id === selectedProfileId)) ? selectedProfileId : null;
1555
- const games = gameId === ALL_GAMES ? pack.games : pack.games.filter((g) => g.id === gameId);
1577
+ const homeTabs = pack.homeTabs && pack.homeTabs.length > 1 ? pack.homeTabs : null;
1578
+ const pickedTab = homeTabs?.findIndex((_, index) => gameId === tabGames(index)) ?? -1;
1579
+ const games = gameId === ALL_GAMES ? pack.games : pickedTab >= 0 ? pack.games.filter((g) => homeTabs[pickedTab].includes(g)) : pack.games.filter((g) => g.id === gameId);
1580
+ const gameIds = gameId === ALL_GAMES ? null : games.map((g) => g.id);
1581
+ const oneGameId = gameId === ALL_GAMES || pickedTab >= 0 ? null : gameId;
1556
1582
  const packTabs = pack.statsTabs ?? NO_PACK_TABS;
1557
1583
  const packTab = packTabs.find((t) => t.value === tab);
1558
1584
  const showGamePicker = !(tab === ACHIEVEMENTS && pack.AchievementList);
1559
1585
  const playerOptions = (0, import_react17.useMemo)(() => [{ value: EVERYONE, label: "Everyone", icon: "account-group" }, ...pack.guestStats && profiles.length > 0 ? [{ value: GUEST_PLAYER_ID, label: "Guest", icon: "account-outline" }] : [], ...profiles.map((p) => ({ value: p.id, label: p.name, icon: "account", color: pack.previewColor ? pack.previewColor(p.color, dark) : p.color })), MANAGE_OPTION], [profiles, pack, dark]);
1560
- const gameOptions = (0, import_react17.useMemo)(() => [{ value: ALL_GAMES, label: "All Games", icon: "view-grid-outline" }, ...pack.games.map((g) => ({ value: g.id, label: g.title }))], [pack.games]);
1586
+ const gameOptions = (0, import_react17.useMemo)(() => {
1587
+ const all = { value: ALL_GAMES, label: "All Games", icon: "view-grid-outline" };
1588
+ const option = (g) => ({ value: g.id, label: g.title, icon: "cards-playing-outline" });
1589
+ if (!homeTabs) return [all, ...pack.games.map(option)];
1590
+ return [all, ...homeTabs.map((tab2, index) => ({ value: tabGroup(index), label: tab2.label, icon: "folder-outline", options: [{ value: tabGames(index), label: "All", triggerLabel: tab2.label, icon: "view-grid-outline" }, ...pack.games.filter((g) => tab2.includes(g)).map(option)] }))];
1591
+ }, [pack.games, homeTabs]);
1561
1592
  const tabButtons = (0, import_react17.useMemo)(() => {
1562
1593
  const buttons = packTabs.length > 0 ? [{ value: STATS, label: "Stats" }, ...packTabs.map(({ value, label }) => ({ value, label })), { value: ACHIEVEMENTS, label: "Achievements" }].map((button) => ({ ...button, style: LABEL_WIDE_TAB })) : TABS;
1563
1594
  return pack.labelStyle ? buttons.map((button) => ({ ...button, labelStyle: pack.labelStyle })) : buttons;
@@ -1568,7 +1599,7 @@ function StatsContent({ pickerHost }) {
1568
1599
  const reset = resetFor(pack, packReset, profileId, profiles, games, () => games.forEach((g) => g.resetStats && dispatch(g.resetStats())));
1569
1600
  const usePickerAlign = pack.usePickerAlign ?? noPickerAlign2;
1570
1601
  const playerSize = (0, import_profile10.getOptionPickerContentSize)(playerOptions);
1571
- const gameSize = (0, import_profile10.getOptionPickerContentSize)(gameOptions.length);
1602
+ const gameSize = (0, import_profile10.getOptionPickerContentSize)(gameOptions);
1572
1603
  const playerAlign = usePickerAlign(pickerHost.openId === PLAYER_PICKER_ID, playerSize.width, playerSize.height);
1573
1604
  const gameAlign = usePickerAlign(pickerHost.openId === GAME_PICKER_ID, gameSize.width, gameSize.height);
1574
1605
  const surface = pack.Backdrop ? { backgroundColor: colors.surface } : void 0;
@@ -1578,11 +1609,11 @@ function StatsContent({ pickerHost }) {
1578
1609
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_chrome8.PressAwayOverlay, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles5.pressAway }),
1579
1610
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native_paper2.SegmentedButtons, { value: tab, onValueChange: setTab, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles5.tabs, surface] }),
1580
1611
  /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native10.View, { style: [styles5.filters, pickerHost.openId !== null && styles5.filtersOpen], onStartShouldSetResponder: () => pickerHost.openId !== null, children: [
1581
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_profile10.OptionPicker, { id: PLAYER_PICKER_ID, host: pickerHost, options: playerOptions, value: profileId ?? EVERYONE, onChange: (value) => value === MANAGE ? import_expo_router10.router.push(PROFILES_HREF) : setSelectedProfileId(value === EVERYONE ? null : value), color: colors.primary, dark, icon: profileId ? "account" : "account-group", alignOverride: playerAlign, triggerStyle }),
1582
- showGamePicker && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_profile10.OptionPicker, { id: GAME_PICKER_ID, host: pickerHost, options: gameOptions, value: gameId, onChange: setGameId, color: colors.primary, dark, icon: "view-grid-outline", alignOverride: gameAlign, triggerStyle })
1612
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_profile10.OptionPicker, { id: PLAYER_PICKER_ID, host: pickerHost, options: playerOptions, value: profileId ?? EVERYONE, onChange: (value) => value === MANAGE ? import_expo_router10.router.push(PROFILES_HREF) : setSelectedProfileId(value === EVERYONE ? null : value), color: colors.primary, dark, icon: profileId ? "account" : "account-group", caption: "Player", alignOverride: playerAlign, triggerStyle }),
1613
+ showGamePicker && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_profile10.OptionPicker, { id: GAME_PICKER_ID, host: pickerHost, options: gameOptions, value: gameId, onChange: setGameId, color: colors.primary, dark, icon: "view-grid-outline", caption: "Game", alignOverride: gameAlign, triggerStyle })
1583
1614
  ] }),
1584
- tab === STATS && pack.StatsSections && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(pack.StatsSections, { profileId, gameId: gameId === ALL_GAMES ? null : gameId }),
1585
- PackTabContent && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PackTabContent, { profileId, gameId: gameId === ALL_GAMES ? null : gameId }),
1615
+ tab === STATS && pack.StatsSections && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(pack.StatsSections, { profileId, gameId: oneGameId, gameIds }),
1616
+ PackTabContent && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PackTabContent, { profileId, gameId: oneGameId, gameIds }),
1586
1617
  tab === ACHIEVEMENTS && pack.AchievementList ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(pack.AchievementList, { profileId }) : (tab === STATS || tab === ACHIEVEMENTS) && games.map((game) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(GameStats, { game, tab, profileId, showTitle: games.length > 1 && pack.statsGameTitles !== false, titleColor: fg }, game.id))
1587
1618
  ] });
1588
1619
  }
package/dist/index.mjs CHANGED
@@ -411,6 +411,8 @@ function useProfiles() {
411
411
  import { Fragment as Fragment4, jsx as jsx10, jsxs as jsxs2 } from "react/jsx-runtime";
412
412
  var PLAY_OPTIONS = { statusBarHidden: true };
413
413
  var KEEP_STATUS_BAR_OPTIONS = {};
414
+ var REPLACE_AS_BACK = { animationTypeForReplace: "pop" };
415
+ var REPLACE_AS_FORWARD = { animationTypeForReplace: "push" };
414
416
  var TRANSPARENT_CONTENT = { backgroundColor: "transparent" };
415
417
  var noScreenOptions = () => ({});
416
418
  function AppStack() {
@@ -429,7 +431,7 @@ function AppStack() {
429
431
  ({ route }) => {
430
432
  const id = route.params?.game;
431
433
  const statusBarOptions = pack.games.some((g) => g.id === id && g.keepStatusBar) ? KEEP_STATUS_BAR_OPTIONS : PLAY_OPTIONS;
432
- return { ...statusBarOptions, ...edgeGuardOptions };
434
+ return { ...statusBarOptions, ...edgeGuardOptions, ...REPLACE_AS_FORWARD };
433
435
  },
434
436
  [pack.games, edgeGuardOptions]
435
437
  );
@@ -438,7 +440,7 @@ function AppStack() {
438
440
  const base = darkRoot ? DarkTheme : DefaultTheme;
439
441
  return { ...base, colors: { ...base.colors, background: navigationBackground } };
440
442
  }, [darkRoot, navigationBackground]);
441
- const stack = /* @__PURE__ */ jsx10(NavigationThemeProvider, { value: navigationTheme, children: /* @__PURE__ */ jsxs2(Stack, { screenOptions: { ...rootBackground, statusBarStyle, ...backdropOptions, ...packOptions }, children: [
443
+ const stack = /* @__PURE__ */ jsx10(NavigationThemeProvider, { value: navigationTheme, children: /* @__PURE__ */ jsxs2(Stack, { screenOptions: { ...rootBackground, statusBarStyle, ...REPLACE_AS_BACK, ...backdropOptions, ...packOptions }, children: [
442
444
  /* @__PURE__ */ jsx10(Stack.Screen, { name: "index" }),
443
445
  /* @__PURE__ */ jsx10(Stack.Screen, { name: "play/[game]", options: playOptions })
444
446
  ] }) });
@@ -1021,8 +1023,8 @@ import { defaultColors as defaultColors3, FadingScrollView, useAutoPaperTheme as
1021
1023
  import { IconButton, Pressable } from "@rific/feedback-press";
1022
1024
  import { PressAwayOverlay as PressAwayOverlay2, usePopoverHost as usePopoverHost2, useWellColors, WELL_SHADOW } from "@tastic/hud/chrome";
1023
1025
  import { getProfilePickerContentSize, ProfilePicker } from "@tastic/profile";
1024
- import { Redirect as Redirect2, router as router5, useIsFocused } from "expo-router";
1025
- import { useCallback as useCallback10, useEffect as useEffect6, useMemo as useMemo6, useRef as useRef5, useState as useState6 } from "react";
1026
+ import { router as router5, useFocusEffect as useFocusEffect3, useIsFocused } from "expo-router";
1027
+ import { useCallback as useCallback10, useDeferredValue, useEffect as useEffect6, useMemo as useMemo6, useRef as useRef5, useState as useState6 } from "react";
1026
1028
  import { AppState as AppState2, StyleSheet as StyleSheet4, View as View4 } from "react-native";
1027
1029
  import { Icon, Portal, SegmentedButtons, Text } from "react-native-paper";
1028
1030
 
@@ -1120,8 +1122,26 @@ function HomeScreen() {
1120
1122
  useEffect6(() => {
1121
1123
  if (!resumeGame) autoShowPack();
1122
1124
  }, [resumeGame, autoShowPack]);
1123
- if (resumeGame) return /* @__PURE__ */ jsx17(Redirect2, { href: pack.resumeHref?.(resumeGame.id) ?? playHref(resumeGame.id) });
1124
- return /* @__PURE__ */ jsx17(HomeMenu, {});
1125
+ useResume(resumeGame);
1126
+ return useMenuShown(!!resumeGame) ? /* @__PURE__ */ jsx17(HomeMenu, {}) : null;
1127
+ }
1128
+ function useResume(game) {
1129
+ const pack = usePack();
1130
+ const done = useRef5(false);
1131
+ useFocusEffect3(
1132
+ useCallback10(() => {
1133
+ if (!game || done.current) return;
1134
+ done.current = true;
1135
+ if (game.useLoadout) router5.push(loadoutHref(game.id));
1136
+ router5.push(pack.resumeHref?.(game.id) ?? playHref(game.id));
1137
+ }, [game, pack])
1138
+ );
1139
+ }
1140
+ function useMenuShown(resuming) {
1141
+ const isFocused = useIsFocused();
1142
+ const [covered, setCovered] = useState6(false);
1143
+ if (resuming && !covered && !isFocused) setCovered(true);
1144
+ return useDeferredValue(!resuming || covered);
1125
1145
  }
1126
1146
  function HomeMenu() {
1127
1147
  const pack = usePack();
@@ -1445,6 +1465,8 @@ var LABEL_WIDE_TAB = { flex: 0, flexBasis: "auto", flexGrow: 1, flexShrink: 1 };
1445
1465
  var NO_PACK_TABS = [];
1446
1466
  var EVERYONE = "__everyone__";
1447
1467
  var ALL_GAMES = "__all__";
1468
+ var tabGroup = (index) => `__tab-group-${index}__`;
1469
+ var tabGames = (index) => `__tab-${index}__`;
1448
1470
  var PLAYER_PICKER_ID = "stats-player";
1449
1471
  var GAME_PICKER_ID = "stats-game";
1450
1472
  var MANAGE = "__manage__";
@@ -1473,12 +1495,21 @@ function StatsContent({ pickerHost }) {
1473
1495
  const statsPlayer = useStatsPlayer();
1474
1496
  const [selectedProfileId, setSelectedProfileId] = useState7(() => pack.useStatsPlayer ? statsPlayer : pack.guestStats ? lastSelected[1] ?? GUEST_PLAYER_ID : null);
1475
1497
  const profileId = selectedProfileId && profiles.length > 0 && (pack.guestStats && selectedProfileId === GUEST_PLAYER_ID || profiles.some((p) => p.id === selectedProfileId)) ? selectedProfileId : null;
1476
- const games = gameId === ALL_GAMES ? pack.games : pack.games.filter((g) => g.id === gameId);
1498
+ const homeTabs = pack.homeTabs && pack.homeTabs.length > 1 ? pack.homeTabs : null;
1499
+ const pickedTab = homeTabs?.findIndex((_, index) => gameId === tabGames(index)) ?? -1;
1500
+ const games = gameId === ALL_GAMES ? pack.games : pickedTab >= 0 ? pack.games.filter((g) => homeTabs[pickedTab].includes(g)) : pack.games.filter((g) => g.id === gameId);
1501
+ const gameIds = gameId === ALL_GAMES ? null : games.map((g) => g.id);
1502
+ const oneGameId = gameId === ALL_GAMES || pickedTab >= 0 ? null : gameId;
1477
1503
  const packTabs = pack.statsTabs ?? NO_PACK_TABS;
1478
1504
  const packTab = packTabs.find((t) => t.value === tab);
1479
1505
  const showGamePicker = !(tab === ACHIEVEMENTS && pack.AchievementList);
1480
1506
  const playerOptions = useMemo7(() => [{ value: EVERYONE, label: "Everyone", icon: "account-group" }, ...pack.guestStats && profiles.length > 0 ? [{ value: GUEST_PLAYER_ID, label: "Guest", icon: "account-outline" }] : [], ...profiles.map((p) => ({ value: p.id, label: p.name, icon: "account", color: pack.previewColor ? pack.previewColor(p.color, dark) : p.color })), MANAGE_OPTION], [profiles, pack, dark]);
1481
- const gameOptions = useMemo7(() => [{ value: ALL_GAMES, label: "All Games", icon: "view-grid-outline" }, ...pack.games.map((g) => ({ value: g.id, label: g.title }))], [pack.games]);
1507
+ const gameOptions = useMemo7(() => {
1508
+ const all = { value: ALL_GAMES, label: "All Games", icon: "view-grid-outline" };
1509
+ const option = (g) => ({ value: g.id, label: g.title, icon: "cards-playing-outline" });
1510
+ if (!homeTabs) return [all, ...pack.games.map(option)];
1511
+ return [all, ...homeTabs.map((tab2, index) => ({ value: tabGroup(index), label: tab2.label, icon: "folder-outline", options: [{ value: tabGames(index), label: "All", triggerLabel: tab2.label, icon: "view-grid-outline" }, ...pack.games.filter((g) => tab2.includes(g)).map(option)] }))];
1512
+ }, [pack.games, homeTabs]);
1482
1513
  const tabButtons = useMemo7(() => {
1483
1514
  const buttons = packTabs.length > 0 ? [{ value: STATS, label: "Stats" }, ...packTabs.map(({ value, label }) => ({ value, label })), { value: ACHIEVEMENTS, label: "Achievements" }].map((button) => ({ ...button, style: LABEL_WIDE_TAB })) : TABS;
1484
1515
  return pack.labelStyle ? buttons.map((button) => ({ ...button, labelStyle: pack.labelStyle })) : buttons;
@@ -1489,7 +1520,7 @@ function StatsContent({ pickerHost }) {
1489
1520
  const reset = resetFor(pack, packReset, profileId, profiles, games, () => games.forEach((g) => g.resetStats && dispatch(g.resetStats())));
1490
1521
  const usePickerAlign = pack.usePickerAlign ?? noPickerAlign2;
1491
1522
  const playerSize = getOptionPickerContentSize2(playerOptions);
1492
- const gameSize = getOptionPickerContentSize2(gameOptions.length);
1523
+ const gameSize = getOptionPickerContentSize2(gameOptions);
1493
1524
  const playerAlign = usePickerAlign(pickerHost.openId === PLAYER_PICKER_ID, playerSize.width, playerSize.height);
1494
1525
  const gameAlign = usePickerAlign(pickerHost.openId === GAME_PICKER_ID, gameSize.width, gameSize.height);
1495
1526
  const surface = pack.Backdrop ? { backgroundColor: colors.surface } : void 0;
@@ -1499,11 +1530,11 @@ function StatsContent({ pickerHost }) {
1499
1530
  /* @__PURE__ */ jsx18(PressAwayOverlay3, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles5.pressAway }),
1500
1531
  /* @__PURE__ */ jsx18(SegmentedButtons2, { value: tab, onValueChange: setTab, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles5.tabs, surface] }),
1501
1532
  /* @__PURE__ */ jsxs6(View5, { style: [styles5.filters, pickerHost.openId !== null && styles5.filtersOpen], onStartShouldSetResponder: () => pickerHost.openId !== null, children: [
1502
- /* @__PURE__ */ jsx18(OptionPicker2, { id: PLAYER_PICKER_ID, host: pickerHost, options: playerOptions, value: profileId ?? EVERYONE, onChange: (value) => value === MANAGE ? router6.push(PROFILES_HREF) : setSelectedProfileId(value === EVERYONE ? null : value), color: colors.primary, dark, icon: profileId ? "account" : "account-group", alignOverride: playerAlign, triggerStyle }),
1503
- showGamePicker && /* @__PURE__ */ jsx18(OptionPicker2, { id: GAME_PICKER_ID, host: pickerHost, options: gameOptions, value: gameId, onChange: setGameId, color: colors.primary, dark, icon: "view-grid-outline", alignOverride: gameAlign, triggerStyle })
1533
+ /* @__PURE__ */ jsx18(OptionPicker2, { id: PLAYER_PICKER_ID, host: pickerHost, options: playerOptions, value: profileId ?? EVERYONE, onChange: (value) => value === MANAGE ? router6.push(PROFILES_HREF) : setSelectedProfileId(value === EVERYONE ? null : value), color: colors.primary, dark, icon: profileId ? "account" : "account-group", caption: "Player", alignOverride: playerAlign, triggerStyle }),
1534
+ showGamePicker && /* @__PURE__ */ jsx18(OptionPicker2, { id: GAME_PICKER_ID, host: pickerHost, options: gameOptions, value: gameId, onChange: setGameId, color: colors.primary, dark, icon: "view-grid-outline", caption: "Game", alignOverride: gameAlign, triggerStyle })
1504
1535
  ] }),
1505
- tab === STATS && pack.StatsSections && /* @__PURE__ */ jsx18(pack.StatsSections, { profileId, gameId: gameId === ALL_GAMES ? null : gameId }),
1506
- PackTabContent && /* @__PURE__ */ jsx18(PackTabContent, { profileId, gameId: gameId === ALL_GAMES ? null : gameId }),
1536
+ tab === STATS && pack.StatsSections && /* @__PURE__ */ jsx18(pack.StatsSections, { profileId, gameId: oneGameId, gameIds }),
1537
+ PackTabContent && /* @__PURE__ */ jsx18(PackTabContent, { profileId, gameId: oneGameId, gameIds }),
1507
1538
  tab === ACHIEVEMENTS && pack.AchievementList ? /* @__PURE__ */ jsx18(pack.AchievementList, { profileId }) : (tab === STATS || tab === ACHIEVEMENTS) && games.map((game) => /* @__PURE__ */ jsx18(GameStats, { game, tab, profileId, showTitle: games.length > 1 && pack.statsGameTitles !== false, titleColor: fg }, game.id))
1508
1539
  ] });
1509
1540
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tastic/shell",
3
- "version": "0.16.0",
3
+ "version": "0.17.1",
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",
@@ -87,7 +87,7 @@
87
87
  "@tastic/core": "^0.17.0",
88
88
  "@tastic/edge-guard": "^0.2.1",
89
89
  "@tastic/hud": "^0.37.0",
90
- "@tastic/profile": "^0.25.0",
90
+ "@tastic/profile": "^0.26.0",
91
91
  "@tastic/split-screen": "^0.6.0",
92
92
  "@testing-library/react-native": "^14.1.0",
93
93
  "@types/jest": "30.0.0",
@@ -139,7 +139,7 @@
139
139
  "@tastic/core": ">=0.16.0",
140
140
  "@tastic/edge-guard": ">=0.2.0",
141
141
  "@tastic/hud": ">=0.37.0",
142
- "@tastic/profile": ">=0.25.0",
142
+ "@tastic/profile": ">=0.26.0",
143
143
  "@tastic/split-screen": ">=0.5.5",
144
144
  "expo-audio": ">=58.0.11",
145
145
  "expo-blur": ">=58.0.4",
@@ -56,6 +56,16 @@ import type { PackDefinition, PackGameDefinition } from './types'
56
56
  const PLAY_OPTIONS = { statusBarHidden: true }
57
57
  const KEEP_STATUS_BAR_OPTIONS = {}
58
58
 
59
+ // Which way a replace slides on iOS (react-native-screens: the incoming screen's replaceAnimation picks
60
+ // it; a push unless told otherwise). A replace here is nearly always a way back with nothing beneath to
61
+ // pop to: safeBack's fallback to Home, a dismissTo whose screen isn't on the stack (a game's back to its
62
+ // setup screen after a deep link), a Redirect out of a game the pack doesn't have. So every screen slides
63
+ // a replace in as a pop, from the left, except a play screen, which a replace only ever opens (a loadout
64
+ // link to a game with nothing to set up). Android's crossfade over a backdrop and the web don't animate a
65
+ // direction.
66
+ const REPLACE_AS_BACK = { animationTypeForReplace: 'pop' as const }
67
+ const REPLACE_AS_FORWARD = { animationTypeForReplace: 'push' as const }
68
+
59
69
  // The navigation theme is the root background too. React Navigation paints its theme's
60
70
  // `colors.background` on the layers around every screen (the ScreenStack's container on native, each
61
71
  // screen's wrapper on the web), and expo-router hands its container no theme, so that was always
@@ -95,7 +105,7 @@ function AppStack() {
95
105
  ({ route }: { route: { params?: object } }) => {
96
106
  const id = (route.params as { game?: string } | undefined)?.game
97
107
  const statusBarOptions = pack.games.some((g) => g.id === id && g.keepStatusBar) ? KEEP_STATUS_BAR_OPTIONS : PLAY_OPTIONS
98
- return { ...statusBarOptions, ...edgeGuardOptions }
108
+ return { ...statusBarOptions, ...edgeGuardOptions, ...REPLACE_AS_FORWARD }
99
109
  },
100
110
  [pack.games, edgeGuardOptions]
101
111
  )
@@ -106,7 +116,7 @@ function AppStack() {
106
116
  }, [darkRoot, navigationBackground])
107
117
  const stack = (
108
118
  <NavigationThemeProvider value={navigationTheme}>
109
- <Stack screenOptions={{ ...rootBackground, statusBarStyle, ...backdropOptions, ...packOptions }}>
119
+ <Stack screenOptions={{ ...rootBackground, statusBarStyle, ...REPLACE_AS_BACK, ...backdropOptions, ...packOptions }}>
110
120
  <Stack.Screen name='index' />
111
121
  <Stack.Screen name='play/[game]' options={playOptions} />
112
122
  </Stack>
@@ -2,8 +2,8 @@ import { defaultColors, FadingScrollView, useAutoPaperTheme } from '@rific/auto-
2
2
  import { IconButton, Pressable } from '@rific/feedback-press'
3
3
  import { PressAwayOverlay, usePopoverHost, useWellColors, WELL_SHADOW } from '@tastic/hud/chrome'
4
4
  import { getProfilePickerContentSize, type Profile, ProfilePicker, type ProfilePickerColorSection } from '@tastic/profile'
5
- import { Redirect, router, useIsFocused } from 'expo-router'
6
- import { type ReactNode, useCallback, useEffect, useMemo, useRef, useState } from 'react'
5
+ import { router, useFocusEffect, useIsFocused } from 'expo-router'
6
+ import { type ReactNode, useCallback, useDeferredValue, useEffect, useMemo, useRef, useState } from 'react'
7
7
  import { AppState, type AppStateStatus, type LayoutChangeEvent, type NativeScrollEvent, type NativeSyntheticEvent, type ScrollView, StyleSheet, View } from 'react-native'
8
8
  import { Icon, Portal, SegmentedButtons, Text } from 'react-native-paper'
9
9
 
@@ -28,7 +28,8 @@ import { HOME_GRID_GAP, HOME_LEFT_PANE_PICKER_GAP, HOME_TILE_PADDING, HOME_TOP_B
28
28
  // (PackDefinition.homeTabs) shows one tab's games at a time, from a switch over the rows.
29
29
  //
30
30
  // A cold launch that finds the player left the app inside a resumable game's play screen
31
- // (GameDefinition.resumable) goes straight back there instead, before the menu ever paints. The
31
+ // (GameDefinition.resumable) goes straight back there instead, before the menu ever paints, with the
32
+ // game's setup screen and this Home beneath it (useResume). The
32
33
  // pack's own How to Play (PackDefinition.guide) shows by itself on a first launch, held back while
33
34
  // that launch is about to drop into a game: it must never open over a game in progress.
34
35
  export function HomeScreen() {
@@ -47,8 +48,40 @@ export function HomeScreen() {
47
48
  useEffect(() => {
48
49
  if (!resumeGame) autoShowPack()
49
50
  }, [resumeGame, autoShowPack])
50
- if (resumeGame) return <Redirect href={pack.resumeHref?.(resumeGame.id) ?? playHref(resumeGame.id)} />
51
- return <HomeMenu />
51
+ useResume(resumeGame)
52
+ return useMenuShown(!!resumeGame) ? <HomeMenu /> : null
53
+ }
54
+
55
+ // The resume itself: the game's setup screen (when it has one), then its play screen (or where the pack
56
+ // says, PackDefinition.resumeHref), pushed over this Home, the stack the player had when they left. Every
57
+ // way back from there is then a pop, which slides the right way: the game's back to its setup screen, that
58
+ // one's back to Home, and Android's back the same (with the play screen alone on the stack, it closed the
59
+ // app). A Redirect replaced Home instead, and with nothing beneath the game each of those backs had to
60
+ // replace the screen too, which iOS animates as a push: the screen came in from the right, as if going
61
+ // forward. Run once, on focus, as Redirect runs its own (the stack is ready by then). Both pushes are
62
+ // queued in one go, so the stack takes them in one update and only the play screen slides in.
63
+ function useResume(game: PackGameDefinition | null) {
64
+ const pack = usePack()
65
+ const done = useRef(false)
66
+ useFocusEffect(
67
+ useCallback(() => {
68
+ if (!game || done.current) return
69
+ done.current = true
70
+ if (game.useLoadout) router.push(loadoutHref(game.id))
71
+ router.push(pack.resumeHref?.(game.id) ?? playHref(game.id))
72
+ }, [game, pack])
73
+ )
74
+ }
75
+
76
+ // Whether Home draws its menu. A Home resuming a game draws nothing until the game covers it (Home no
77
+ // longer focused), so a launch never shows the menu ahead of the game, and then draws it at low priority
78
+ // (useDeferredValue), behind the game's own first renders. From then on it's mounted beneath the game like
79
+ // any Home that opened one, so going back to it is quick.
80
+ function useMenuShown(resuming: boolean): boolean {
81
+ const isFocused = useIsFocused()
82
+ const [covered, setCovered] = useState(false)
83
+ if (resuming && !covered && !isFocused) setCovered(true)
84
+ return useDeferredValue(!resuming || covered)
52
85
  }
53
86
 
54
87
  function HomeMenu() {
@@ -37,6 +37,9 @@ const NO_PACK_TABS: readonly PackStatsTab[] = []
37
37
  // The pickers' values for Everyone and All Games (neither is ever a profile or game id).
38
38
  const EVERYONE = '__everyone__'
39
39
  const ALL_GAMES = '__all__'
40
+ // A Home tab's games (PackDefinition.homeTabs) on the game picker: the group's row, and its "All" row
41
+ const tabGroup = (index: number) => `__tab-group-${index}__`
42
+ const tabGames = (index: number) => `__tab-${index}__`
40
43
 
41
44
  const PLAYER_PICKER_ID = 'stats-player'
42
45
  const GAME_PICKER_ID = 'stats-game'
@@ -109,7 +112,13 @@ function StatsContent({ pickerHost }: { pickerHost: PopoverHost }) {
109
112
  const [selectedProfileId, setSelectedProfileId] = useState<string | null>(() => (pack.useStatsPlayer ? statsPlayer : pack.guestStats ? (lastSelected[1] ?? GUEST_PLAYER_ID) : null))
110
113
  const profileId = selectedProfileId && profiles.length > 0 && ((pack.guestStats && selectedProfileId === GUEST_PLAYER_ID) || profiles.some((p) => p.id === selectedProfileId)) ? selectedProfileId : null
111
114
 
112
- const games = gameId === ALL_GAMES ? pack.games : pack.games.filter((g) => g.id === gameId)
115
+ // With Home's tabs, the game picker groups the games by them (Jay, 2026-11-20: Solitaire and Two Player, a shorter list), and can be
116
+ // on a whole tab's games
117
+ const homeTabs = pack.homeTabs && pack.homeTabs.length > 1 ? pack.homeTabs : null
118
+ const pickedTab = homeTabs?.findIndex((_, index) => gameId === tabGames(index)) ?? -1
119
+ const games = gameId === ALL_GAMES ? pack.games : pickedTab >= 0 ? pack.games.filter((g) => homeTabs![pickedTab].includes(g)) : pack.games.filter((g) => g.id === gameId)
120
+ const gameIds = gameId === ALL_GAMES ? null : games.map((g) => g.id)
121
+ const oneGameId = gameId === ALL_GAMES || pickedTab >= 0 ? null : gameId
113
122
  const packTabs = pack.statsTabs ?? NO_PACK_TABS
114
123
  const packTab = packTabs.find((t) => t.value === tab)
115
124
  // One achievement list across the pack's games doesn't narrow to a game, so the game picker goes.
@@ -118,7 +127,12 @@ function StatsContent({ pickerHost }: { pickerHost: PopoverHost }) {
118
127
  // Always there (Jay, 2026-11-19), with no profile yet too: Everyone, then each profile, then Manage, which
119
128
  // opens the Profiles screen to make one.
120
129
  const playerOptions = useMemo<OptionPickerOption<string>[]>(() => [{ value: EVERYONE, label: 'Everyone', icon: 'account-group' }, ...(pack.guestStats && profiles.length > 0 ? [{ value: GUEST_PLAYER_ID, label: 'Guest', icon: 'account-outline' }] : []), ...profiles.map((p) => ({ value: p.id, label: p.name, icon: 'account', color: pack.previewColor ? pack.previewColor(p.color, dark) : p.color })), MANAGE_OPTION], [profiles, pack, dark])
121
- const gameOptions = useMemo<OptionPickerOption<string>[]>(() => [{ value: ALL_GAMES, label: 'All Games', icon: 'view-grid-outline' }, ...pack.games.map((g) => ({ value: g.id, label: g.title }))], [pack.games])
130
+ const gameOptions = useMemo<OptionPickerOption<string>[]>(() => {
131
+ const all = { value: ALL_GAMES, label: 'All Games', icon: 'view-grid-outline' }
132
+ const option = (g: PackGameDefinition) => ({ value: g.id, label: g.title, icon: 'cards-playing-outline' })
133
+ if (!homeTabs) return [all, ...pack.games.map(option)]
134
+ return [all, ...homeTabs.map((tab, index) => ({ value: tabGroup(index), label: tab.label, icon: 'folder-outline', options: [{ value: tabGames(index), label: 'All', triggerLabel: tab.label, icon: 'view-grid-outline' }, ...pack.games.filter((g) => tab.includes(g)).map(option)] }))]
135
+ }, [pack.games, homeTabs])
122
136
  // The pack's label lettering (PackDefinition.labelStyle) on each tab.
123
137
  const tabButtons = useMemo(() => {
124
138
  const buttons = packTabs.length > 0 ? [{ value: STATS, label: 'Stats' }, ...packTabs.map(({ value, label }) => ({ value, label })), { value: ACHIEVEMENTS, label: 'Achievements' }].map((button) => ({ ...button, style: LABEL_WIDE_TAB })) : TABS
@@ -136,7 +150,7 @@ function StatsContent({ pickerHost }: { pickerHost: PopoverHost }) {
136
150
  // The pack's own placement for the pickers' menus (PackDefinition.usePickerAlign), sized from their rows.
137
151
  const usePickerAlign = pack.usePickerAlign ?? noPickerAlign
138
152
  const playerSize = getOptionPickerContentSize(playerOptions)
139
- const gameSize = getOptionPickerContentSize(gameOptions.length)
153
+ const gameSize = getOptionPickerContentSize(gameOptions)
140
154
  const playerAlign = usePickerAlign(pickerHost.openId === PLAYER_PICKER_ID, playerSize.width, playerSize.height)
141
155
  const gameAlign = usePickerAlign(pickerHost.openId === GAME_PICKER_ID, gameSize.width, gameSize.height)
142
156
 
@@ -157,15 +171,15 @@ function StatsContent({ pickerHost }: { pickerHost: PopoverHost }) {
157
171
  {/* Takes a press on its own blank parts (the gap, an open menu's padding) while a menu is open, so
158
172
  it never reaches StatsPressAway. */}
159
173
  <View style={[styles.filters, pickerHost.openId !== null && styles.filtersOpen]} onStartShouldSetResponder={() => pickerHost.openId !== null}>
160
- <OptionPicker id={PLAYER_PICKER_ID} host={pickerHost} options={playerOptions} value={profileId ?? EVERYONE} onChange={(value) => (value === MANAGE ? router.push(PROFILES_HREF) : setSelectedProfileId(value === EVERYONE ? null : value))} color={colors.primary} dark={dark} icon={profileId ? 'account' : 'account-group'} alignOverride={playerAlign} triggerStyle={triggerStyle} />
161
- {showGamePicker && <OptionPicker id={GAME_PICKER_ID} host={pickerHost} options={gameOptions} value={gameId} onChange={setGameId} color={colors.primary} dark={dark} icon='view-grid-outline' alignOverride={gameAlign} triggerStyle={triggerStyle} />}
174
+ <OptionPicker id={PLAYER_PICKER_ID} host={pickerHost} options={playerOptions} value={profileId ?? EVERYONE} onChange={(value) => (value === MANAGE ? router.push(PROFILES_HREF) : setSelectedProfileId(value === EVERYONE ? null : value))} color={colors.primary} dark={dark} icon={profileId ? 'account' : 'account-group'} caption='Player' alignOverride={playerAlign} triggerStyle={triggerStyle} />
175
+ {showGamePicker && <OptionPicker id={GAME_PICKER_ID} host={pickerHost} options={gameOptions} value={gameId} onChange={setGameId} color={colors.primary} dark={dark} icon='view-grid-outline' caption='Game' alignOverride={gameAlign} triggerStyle={triggerStyle} />}
162
176
  </View>
163
177
 
164
178
  {/* The pack's own section across its games (a calendar of play), first on the Stats tab: it
165
179
  follows both filters, so narrowed to one game it shows that game's part. */}
166
- {tab === STATS && pack.StatsSections && <pack.StatsSections profileId={profileId} gameId={gameId === ALL_GAMES ? null : gameId} />}
180
+ {tab === STATS && pack.StatsSections && <pack.StatsSections profileId={profileId} gameId={oneGameId} gameIds={gameIds} />}
167
181
 
168
- {PackTabContent && <PackTabContent profileId={profileId} gameId={gameId === ALL_GAMES ? null : gameId} />}
182
+ {PackTabContent && <PackTabContent profileId={profileId} gameId={oneGameId} gameIds={gameIds} />}
169
183
 
170
184
  {tab === ACHIEVEMENTS && pack.AchievementList ? <pack.AchievementList profileId={profileId} /> : (tab === STATS || tab === ACHIEVEMENTS) && games.map((game) => <GameStats key={game.id} game={game} tab={tab} profileId={profileId} showTitle={games.length > 1 && pack.statsGameTitles !== false} titleColor={fg} />)}
171
185
  </BaseStatsScreen>
package/src/types.ts CHANGED
@@ -237,7 +237,10 @@ export interface HeroTitleProps {
237
237
  // the player (null is Everyone) and the game (null is All Games).
238
238
  export interface PackStatsSectionsProps {
239
239
  profileId: string | null
240
+ // The one game the game picker is on, or null for several
240
241
  gameId: string | null
242
+ // The games it's on: null for All Games, one of the pack's Home tabs' games (its Solitaire, its Two Player), or [gameId]
243
+ gameIds: readonly string[] | null
241
244
  }
242
245
 
243
246
  // A tab on Home (PackDefinition.homeTabs): its label, and which of the pack's games it shows, in the