@tastic/shell 0.15.0 → 0.17.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
@@ -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:
@@ -140,10 +140,11 @@ PuckTastic and DuelTastic draw what they always did:
140
140
  | `resetStats?` | The stats screen's Reset where the pack resets stats itself (`PackStatsReset`: a `useReset` hook returning `(profileId) => void`, and the `labels` for a player's name, Guest, or `null` for Everyone). It follows the player picker, not the game picker. |
141
141
  | `statsGameTitles?` | `false` leaves each game's name off its sections on All Games, where the sections name it. |
142
142
  | `newProfileColor?` | A new profile's starting color on its Edit Profile screen. Unset is auto-paper's first swatch. |
143
+ | `ProfileSections?` | `ComponentType<{ profile }>`: the pack's own sections on a saved profile's Edit Profile screen, under Color and above Delete Profile, drawn with `@tastic/profile`'s `EditProfileSection` and `EditProfileRow`. A pack with online play puts its `ProfileOnlineSection` (`@tastic/profile/online`) there. |
143
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. |
144
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. |
145
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. |
146
- | `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. |
147
148
 
148
149
  ### `GameDefinition`
149
150
 
@@ -294,7 +295,9 @@ actions and defaults are exported for a pack's own code and its tests.
294
295
  `humanSeatsFor(mode)`: the seats that press Ready, `[1, 2]` in 2 Player and `[1]` otherwise.
295
296
  `seatTwoFor(saved, choices)`: seat 2's saved choice as one game reads it (see `GameDefinition`).
296
297
  - `SettingsDialog` (`SettingsDialogProps`): `visible`, `onDismiss`, `onShowHowToPlay` (optional: shows
297
- the How to Play row, as a loadout does; left out on Home and in a match) and `children` (a play
298
+ the How to Play row, as a loadout does; left out on Home and in a match), `showProfile` (optional:
299
+ the Profile row, "Profile" over seat 1's name, opening its Edit Profile screen, or Profiles while
300
+ seat 1 is Guest; Home and a loadout show it, a play screen leaves it off) and `children` (a play
298
301
  screen's own rows). The pack's `useSettingsRules` goes above the shell's rows, and `children` and
299
302
  then the pack's `SettingsSections` under them.
300
303
  - `safeBack()`: back, or Home (`/`) where there's nothing to go back to.
@@ -396,8 +399,8 @@ what the shell started using (noted in the table).
396
399
  | `@rific/feedback-press` | >=0.13.1 | haptic and sound settings, the UI sounds |
397
400
  | `@rific/toaster` | >=0.10.1 | toasts |
398
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`) |
399
- | `@tastic/hud` | >=0.35.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`) |
400
- | `@tastic/profile` | >=0.22.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`) |
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.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) |
401
404
  | `@tastic/achievements` | >=0.6.0 | `createGameStats`, `forgetProfileAchievements` |
402
405
  | `@tastic/split-screen` | >=0.5.5 | the 2 Player loadout's two halves |
403
406
  | `@tastic/edge-guard` | >=0.2.0 | Edge Guard during play (`useEdgeGestureGuard` on iOS, `edgeGuardScreenOptions` on Android) |
package/dist/index.d.mts CHANGED
@@ -5,6 +5,8 @@ import { ThemeAppearance, ThemeSettings } from '@rific/auto-paper';
5
5
  import { PopoverHost, AlignResult } from '@tastic/hud/chrome';
6
6
  import { GuideStep } from '@tastic/hud/guide';
7
7
  import { MenuOption } from '@tastic/hud/lobby';
8
+ import * as _tastic_profile from '@tastic/profile';
9
+ import { profilesReducer, Profile, CreateProfileInput, SeatColorsState as SeatColorsState$1 } from '@tastic/profile';
8
10
  import { FontSource } from 'expo-font';
9
11
  import { Href, Stack } from 'expo-router';
10
12
  import { TextStyle, ImageSourcePropType } from 'react-native';
@@ -12,8 +14,6 @@ import * as redux from 'redux';
12
14
  import { Reducer, Action } from 'redux';
13
15
  import * as _rific_core from '@rific/core';
14
16
  export { safeBack } from '@rific/core';
15
- import * as _tastic_profile from '@tastic/profile';
16
- import { profilesReducer, Profile, CreateProfileInput, SeatColorsState as SeatColorsState$1 } from '@tastic/profile';
17
17
  import * as _rific_feedback_press from '@rific/feedback-press';
18
18
  import * as redux_persist from 'redux-persist';
19
19
  import { PersistedState, Persistor } from 'redux-persist';
@@ -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;
@@ -309,6 +310,9 @@ interface PackDefinition {
309
310
  resetStats?: PackStatsReset;
310
311
  statsGameTitles?: boolean;
311
312
  newProfileColor?: string;
313
+ ProfileSections?: ComponentType<{
314
+ profile: Profile;
315
+ }>;
312
316
  usePickerAlign?: PickerAlign;
313
317
  }
314
318
  type PickerAlign = (open: boolean, contentWidth: number, contentHeight: number) => AlignResult;
@@ -431,9 +435,10 @@ interface SettingsDialogProps {
431
435
  visible: boolean;
432
436
  onDismiss: () => void;
433
437
  onShowHowToPlay?: () => void;
438
+ showProfile?: boolean;
434
439
  children?: ReactNode;
435
440
  }
436
- declare function SettingsDialog({ visible, onDismiss, onShowHowToPlay, children }: SettingsDialogProps): react.JSX.Element;
441
+ declare function SettingsDialog({ visible, onDismiss, onShowHowToPlay, showProfile, children }: SettingsDialogProps): react.JSX.Element;
437
442
 
438
443
  declare function useActiveRound<S extends object>(game: string, defaults: S): {
439
444
  mode: RoundMode;
package/dist/index.d.ts CHANGED
@@ -5,6 +5,8 @@ import { ThemeAppearance, ThemeSettings } from '@rific/auto-paper';
5
5
  import { PopoverHost, AlignResult } from '@tastic/hud/chrome';
6
6
  import { GuideStep } from '@tastic/hud/guide';
7
7
  import { MenuOption } from '@tastic/hud/lobby';
8
+ import * as _tastic_profile from '@tastic/profile';
9
+ import { profilesReducer, Profile, CreateProfileInput, SeatColorsState as SeatColorsState$1 } from '@tastic/profile';
8
10
  import { FontSource } from 'expo-font';
9
11
  import { Href, Stack } from 'expo-router';
10
12
  import { TextStyle, ImageSourcePropType } from 'react-native';
@@ -12,8 +14,6 @@ import * as redux from 'redux';
12
14
  import { Reducer, Action } from 'redux';
13
15
  import * as _rific_core from '@rific/core';
14
16
  export { safeBack } from '@rific/core';
15
- import * as _tastic_profile from '@tastic/profile';
16
- import { profilesReducer, Profile, CreateProfileInput, SeatColorsState as SeatColorsState$1 } from '@tastic/profile';
17
17
  import * as _rific_feedback_press from '@rific/feedback-press';
18
18
  import * as redux_persist from 'redux-persist';
19
19
  import { PersistedState, Persistor } from 'redux-persist';
@@ -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;
@@ -309,6 +310,9 @@ interface PackDefinition {
309
310
  resetStats?: PackStatsReset;
310
311
  statsGameTitles?: boolean;
311
312
  newProfileColor?: string;
313
+ ProfileSections?: ComponentType<{
314
+ profile: Profile;
315
+ }>;
312
316
  usePickerAlign?: PickerAlign;
313
317
  }
314
318
  type PickerAlign = (open: boolean, contentWidth: number, contentHeight: number) => AlignResult;
@@ -431,9 +435,10 @@ interface SettingsDialogProps {
431
435
  visible: boolean;
432
436
  onDismiss: () => void;
433
437
  onShowHowToPlay?: () => void;
438
+ showProfile?: boolean;
434
439
  children?: ReactNode;
435
440
  }
436
- declare function SettingsDialog({ visible, onDismiss, onShowHowToPlay, children }: SettingsDialogProps): react.JSX.Element;
441
+ declare function SettingsDialog({ visible, onDismiss, onShowHowToPlay, showProfile, children }: SettingsDialogProps): react.JSX.Element;
437
442
 
438
443
  declare function useActiveRound<S extends object>(game: string, defaults: S): {
439
444
  mode: RoundMode;
package/dist/index.js CHANGED
@@ -538,7 +538,7 @@ function HapticGatedToastProvider({ children }) {
538
538
  }
539
539
  function FramedToaster() {
540
540
  const renderFrame = (0, import_react9.useCallback)((toasts) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_chrome2.ScreenFrame, { passThrough: true, children: toasts }), []);
541
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_toaster2.Toaster, { historyButton: null, clearButton: null, limit: 3, renderFrame });
541
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_toaster2.Toaster, { historyButton: null, clearButton: null, limit: 1, renderFrame });
542
542
  }
543
543
  function PackToaster({ Toaster: PackToasterComponent }) {
544
544
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native3.View, { style: import_react_native3.StyleSheet.absoluteFill, pointerEvents: "box-none", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_chrome2.ScreenFrame, { passThrough: true, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PackToasterComponent, {}) }) });
@@ -610,12 +610,12 @@ var import_jsx_runtime12 = require("react/jsx-runtime");
610
610
  function EditProfileRoute() {
611
611
  const { id } = (0, import_expo_router4.useLocalSearchParams)();
612
612
  const { profiles, createProfile, updateProfile, deleteProfile } = useProfiles();
613
- const { Backdrop, foreground, newProfileColor } = usePack();
614
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_chrome4.ScreenFrame, { portalHost: true, maxContentWidth: ROSTER_MAX_WIDTH, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_profile5.EditProfileScreen, { profileId: id, profiles, defaultColor: newProfileColor ?? import_auto_paper3.defaultColors[0].value, onCreate: (patch) => createProfile(patch), onSave: (profileId, patch) => updateProfile(profileId, patch), onDelete: deleteProfile, onBack: import_core6.safeBack, fg: foreground, bg: Backdrop ? "transparent" : void 0 }) });
613
+ const { Backdrop, foreground, newProfileColor, ProfileSections } = usePack();
614
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_chrome4.ScreenFrame, { portalHost: true, maxContentWidth: ROSTER_MAX_WIDTH, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_profile5.EditProfileScreen, { profileId: id, profiles, defaultColor: newProfileColor ?? import_auto_paper3.defaultColors[0].value, onCreate: (patch) => createProfile(patch), onSave: (profileId, patch) => updateProfile(profileId, patch), onDelete: deleteProfile, onBack: import_core6.safeBack, fg: foreground, bg: Backdrop ? "transparent" : void 0, sections: ProfileSections ? (profile) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ProfileSections, { profile }) : void 0 }) });
615
615
  }
616
616
 
617
617
  // src/screens/GameRoute.tsx
618
- var import_expo_router7 = require("expo-router");
618
+ var import_expo_router8 = require("expo-router");
619
619
  var import_react14 = require("react");
620
620
  var import_react_native7 = require("react-native");
621
621
 
@@ -625,7 +625,7 @@ var import_core10 = require("@tastic/core");
625
625
  var import_chrome6 = require("@tastic/hud/chrome");
626
626
  var import_lobby2 = require("@tastic/hud/lobby");
627
627
  var import_split_screen = require("@tastic/split-screen");
628
- var import_expo_router6 = require("expo-router");
628
+ var import_expo_router7 = require("expo-router");
629
629
  var import_react13 = require("react");
630
630
  var import_react_native6 = require("react-native");
631
631
  var import_react_native_reanimated2 = __toESM(require("react-native-reanimated"));
@@ -688,15 +688,19 @@ var styles2 = import_react_native4.StyleSheet.create({
688
688
  // src/components/SettingsDialog.tsx
689
689
  var import_toaster3 = require("@rific/toaster");
690
690
  var import_chrome5 = require("@tastic/hud/chrome");
691
+ var import_expo_router5 = require("expo-router");
691
692
  var import_jsx_runtime14 = require("react/jsx-runtime");
692
693
  var noSettingsRules = () => null;
693
- function SettingsDialog({ visible, onDismiss, onShowHowToPlay, children }) {
694
+ function SettingsDialog({ visible, onDismiss, onShowHowToPlay, showProfile = false, children }) {
694
695
  const onUpdateError = (0, import_toaster3.useUpdateErrorToast)();
695
696
  const { settings, setSettings } = useAppSettings();
696
697
  const { otaVersion, SettingsSections, edgeGuard = true, useSettingsRules = noSettingsRules } = usePack();
697
698
  const rules = useSettingsRules();
699
+ const { profiles, lastSelected } = useProfiles();
700
+ const seatOne = profiles.find((profile) => profile.id === lastSelected[1]) ?? null;
701
+ const profileRow = showProfile ? seatOne ? { onShowProfiles: () => import_expo_router5.router.push(profileHref(seatOne.id)), profilesRow: { label: "Profile", caption: seatOne.name, icon: "account-outline" } } : { onShowProfiles: () => import_expo_router5.router.push(PROFILES_HREF) } : {};
698
702
  const edgeGuardProps = edgeGuard ? { deferBottomEdgeGestures: settings.deferBottomEdgeGestures, onDeferBottomEdgeGestures: (value) => setSettings({ deferBottomEdgeGestures: value }) } : {};
699
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_chrome5.BaseSettingsDialog, { visible, onDismiss, version: otaVersion, ...edgeGuardProps, onUpdateError, onShowHowToPlay, leading: rules, children: [
703
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_chrome5.BaseSettingsDialog, { visible, onDismiss, version: otaVersion, ...edgeGuardProps, onUpdateError, onShowHowToPlay, ...profileRow, leading: rules, children: [
700
704
  children,
701
705
  SettingsSections && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SettingsSections, {})
702
706
  ] });
@@ -734,7 +738,7 @@ function useOpponent() {
734
738
  // src/hooks/useSeatColors.ts
735
739
  var import_auto_paper4 = require("@rific/auto-paper");
736
740
  var import_profile8 = require("@tastic/profile");
737
- var import_expo_router5 = require("expo-router");
741
+ var import_expo_router6 = require("expo-router");
738
742
  var import_react12 = require("react");
739
743
  var import_react_redux8 = require("react-redux");
740
744
 
@@ -805,7 +809,7 @@ function useSeatColors(p2IsHuman) {
805
809
  if (sameTheme(themeSettings, next)) return;
806
810
  setThemeColor(next);
807
811
  }, [lastSelected[1], lastSelected[2], p2IsHuman, guestColors, cpuColor, profileColors, profiles.length, dark]);
808
- (0, import_expo_router5.useFocusEffect)(
812
+ (0, import_expo_router6.useFocusEffect)(
809
813
  (0, import_react12.useCallback)(() => {
810
814
  const next = rememberedColors(p1ProfileRef.current, p2ProfileRef.current, profileColorsRef.current, guestColorsRef.current, cpuColorRef.current);
811
815
  setThemeColor(themeForRef.current(next.p1, next.p2));
@@ -887,7 +891,7 @@ function LoadoutScreen({ game }) {
887
891
  const handleP1ProfileSelect = (0, import_react13.useCallback)((profile) => selectProfile(1, profile?.id ?? null), [selectProfile]);
888
892
  const handleP2ProfileSelect = (0, import_react13.useCallback)((profile) => selectProfile(2, profile?.id ?? null), [selectProfile]);
889
893
  const [ready, setReady] = (0, import_react13.useState)({ 1: false, 2: false });
890
- (0, import_expo_router6.useFocusEffect)(
894
+ (0, import_expo_router7.useFocusEffect)(
891
895
  (0, import_react13.useCallback)(() => {
892
896
  setReady({ 1: false, 2: false });
893
897
  }, [setReady])
@@ -906,7 +910,7 @@ function LoadoutScreen({ game }) {
906
910
  (0, import_react13.useEffect)(() => {
907
911
  if (!humanSeats.every((s) => ready[s])) return;
908
912
  dispatch(liveplayActions.setActiveRound({ game: game.id, mode, settings: roundSettingsRef.current }));
909
- import_expo_router6.router.push(playHref(game.id));
913
+ import_expo_router7.router.push(playHref(game.id));
910
914
  }, [ready, humanSeats, game.id, mode, dispatch]);
911
915
  const bg = pack.Backdrop ? "transparent" : dark ? "#000000" : "#FFFFFF";
912
916
  const fg = pack.foreground ?? (dark ? "#FFFFFF" : "#000000");
@@ -928,7 +932,7 @@ function LoadoutScreen({ game }) {
928
932
  const p1ControlOpen = controlsHost.openId === P1_CONTROL_ID;
929
933
  const controlLook = { accentColor: themeColors.tertiary, mutedColor: fgMuted, dark };
930
934
  const p1Control = loadout.seatControl(1, controlsHost, { ...controlLook, seatColor: p1Drawn });
931
- const p1Panel = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lobby2.PlayerSetupPanel, { idPrefix: "p1", host: controlsHost, color: p1Color, onColorChange: handleP1ColorChange, swatches: import_auto_paper5.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_router6.router.push(PROFILES_HREF), previewValue: seatPreview, triggerStyle, useSeatPickerAlign: seatPickerAlign }, `p1-${layoutKey}`);
935
+ const p1Panel = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lobby2.PlayerSetupPanel, { idPrefix: "p1", host: controlsHost, color: p1Color, onColorChange: handleP1ColorChange, swatches: import_auto_paper5.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_router7.router.push(PROFILES_HREF), previewValue: seatPreview, triggerStyle, useSeatPickerAlign: seatPickerAlign }, `p1-${layoutKey}`);
932
936
  const opponentPicker = game.seatTwo && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(OpponentPicker, { idPrefix: "p1", host: controlsHost, choices: game.seatTwo, seatTwo, onSeatTwoChange: changeSeatTwo, cpuDifficulty: loadout.cpuDifficulty, color: p2Color, onColorChange: handleP2ColorChange, swatches: import_auto_paper5.defaultColors, takenColor: p1Color, allowSwapTaken: mode === "vsCpu", dark, previewValue: seatPreview, triggerStyle, usePickerAlign: seatPickerAlign }, `opponent-${layoutKey}`);
933
937
  const toggleP1Ready = () => setReady((r) => ({ ...r, 1: !r[1] }));
934
938
  const seatButtons = /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native6.View, { style: [styles3.seatOneButtons, p1PickerOpen && styles3.raised], children: [
@@ -980,7 +984,7 @@ function LoadoutScreen({ game }) {
980
984
  seatOne
981
985
  ] })
982
986
  ] }),
983
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SettingsDialog, { visible: settingsOpen, onDismiss: () => setSettingsOpen(false), onShowHowToPlay: () => openFor(game.id) })
987
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SettingsDialog, { visible: settingsOpen, onDismiss: () => setSettingsOpen(false), onShowHowToPlay: () => openFor(game.id), showProfile: true })
984
988
  ] });
985
989
  }
986
990
  function halfOf(color) {
@@ -1063,20 +1067,20 @@ var styles3 = import_react_native6.StyleSheet.create({
1063
1067
  // src/screens/GameRoute.tsx
1064
1068
  var import_jsx_runtime16 = require("react/jsx-runtime");
1065
1069
  function LoadoutRoute() {
1066
- const { game: id } = (0, import_expo_router7.useLocalSearchParams)();
1070
+ const { game: id } = (0, import_expo_router8.useLocalSearchParams)();
1067
1071
  const game = usePackGame(id);
1068
- if (!game) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_expo_router7.Redirect, { href: "/" });
1069
- if (!hasLoadout(game)) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_expo_router7.Redirect, { href: playHref(game.id) });
1072
+ if (!game) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_expo_router8.Redirect, { href: "/" });
1073
+ if (!hasLoadout(game)) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_expo_router8.Redirect, { href: playHref(game.id) });
1070
1074
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(LoadoutScreen, { game }, game.id);
1071
1075
  }
1072
1076
  function hasLoadout(game) {
1073
1077
  return !!game.useLoadout;
1074
1078
  }
1075
1079
  function PlayRoute() {
1076
- const { game: id } = (0, import_expo_router7.useLocalSearchParams)();
1080
+ const { game: id } = (0, import_expo_router8.useLocalSearchParams)();
1077
1081
  const game = usePackGame(id);
1078
1082
  useResumePoint(game?.resumable ? game.id : null);
1079
- if (!game) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_expo_router7.Redirect, { href: "/" });
1083
+ if (!game) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_expo_router8.Redirect, { href: "/" });
1080
1084
  const { PlayScreen } = game;
1081
1085
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(PlayScreen, {}, game.id);
1082
1086
  }
@@ -1096,7 +1100,7 @@ var import_auto_paper6 = require("@rific/auto-paper");
1096
1100
  var import_feedback_press3 = require("@rific/feedback-press");
1097
1101
  var import_chrome7 = require("@tastic/hud/chrome");
1098
1102
  var import_profile9 = require("@tastic/profile");
1099
- var import_expo_router8 = require("expo-router");
1103
+ var import_expo_router9 = require("expo-router");
1100
1104
  var import_react16 = require("react");
1101
1105
  var import_react_native9 = require("react-native");
1102
1106
  var import_react_native_paper = require("react-native-paper");
@@ -1195,7 +1199,7 @@ function HomeScreen() {
1195
1199
  (0, import_react16.useEffect)(() => {
1196
1200
  if (!resumeGame) autoShowPack();
1197
1201
  }, [resumeGame, autoShowPack]);
1198
- if (resumeGame) return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_expo_router8.Redirect, { href: pack.resumeHref?.(resumeGame.id) ?? playHref(resumeGame.id) });
1202
+ if (resumeGame) return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_expo_router9.Redirect, { href: pack.resumeHref?.(resumeGame.id) ?? playHref(resumeGame.id) });
1199
1203
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(HomeMenu, {});
1200
1204
  }
1201
1205
  function HomeMenu() {
@@ -1207,7 +1211,7 @@ function HomeMenu() {
1207
1211
  const { openFirstTime, openFor, openPack } = useGameGuide();
1208
1212
  const [settingsOpen, setSettingsOpen] = (0, import_react16.useState)(false);
1209
1213
  const [rulesGame, setRulesGame] = (0, import_react16.useState)(null);
1210
- const isFocused = (0, import_expo_router8.useIsFocused)();
1214
+ const isFocused = (0, import_expo_router9.useIsFocused)();
1211
1215
  const [appState, setAppState] = (0, import_react16.useState)(import_react_native9.AppState.currentState);
1212
1216
  (0, import_react16.useEffect)(() => {
1213
1217
  const subscription = import_react_native9.AppState.addEventListener("change", setAppState);
@@ -1243,13 +1247,13 @@ function HomeMenu() {
1243
1247
  const tabBar = tab && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper.SegmentedButtons, { value: tab.label, onValueChange: setTabLabel, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles4.tabs, pack.Backdrop && { backgroundColor: colors.surface }] });
1244
1248
  const columnClamp = useClampOnShrink();
1245
1249
  const gridClamp = useClampOnShrink();
1246
- const openGame = (0, import_react16.useCallback)((game) => openFirstTime(game.id, () => import_expo_router8.router.push(game.useLoadout ? loadoutHref(game.id) : playHref(game.id))), [openFirstTime]);
1250
+ const openGame = (0, import_react16.useCallback)((game) => openFirstTime(game.id, () => import_expo_router9.router.push(game.useLoadout ? loadoutHref(game.id) : playHref(game.id))), [openFirstTime]);
1247
1251
  const openRules = (0, import_react16.useCallback)((game) => game.Rules ? setRulesGame(game) : openFor(game.id), [openFor]);
1248
1252
  const colorSection = { value: p1Color, onChange: handleP1ColorChange, swatches: import_auto_paper6.defaultColors, caption: selectedProfile ? pack.colorCaption : void 0, previewValue: previewColor ? (hex) => previewColor(hex, dark) : void 0 };
1249
1253
  const usePickerAlign = pack.usePickerAlign ?? noPickerAlign;
1250
1254
  const pickerSize = (0, import_profile9.getProfilePickerContentSize)(profiles.length, true, colorSection);
1251
1255
  const pickerAlign = usePickerAlign(pickerHost.openId === `${SEAT_ONE_PICKER}-profile`, pickerSize.width, pickerSize.height);
1252
- const picker = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_profile9.ProfilePicker, { idPrefix: SEAT_ONE_PICKER, host: pickerHost, profiles, selectedId: lastSelected[1], color: p1Drawn, dark, guestLabel: pack.guestLabel ?? "P1", nullLabel: pack.nullLabel, onSelect: (profile) => selectProfile(1, profile?.id ?? null), onManage: () => import_expo_router8.router.push(PROFILES_HREF), colorSection, alignOverride: pickerAlign, triggerStyle });
1256
+ const picker = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_profile9.ProfilePicker, { idPrefix: SEAT_ONE_PICKER, host: pickerHost, profiles, selectedId: lastSelected[1], color: p1Drawn, dark, guestLabel: pack.guestLabel ?? "P1", nullLabel: pack.nullLabel, onSelect: (profile) => selectProfile(1, profile?.id ?? null), onManage: () => import_expo_router9.router.push(PROFILES_HREF), colorSection, alignOverride: pickerAlign, triggerStyle });
1253
1257
  const pressAway = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_chrome7.PressAwayOverlay, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles4.pressAway });
1254
1258
  const RulesSheet = rulesGame?.Rules;
1255
1259
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native9.View, { style: [styles4.container, { backgroundColor: bg }], children: [
@@ -1271,11 +1275,11 @@ function HomeMenu() {
1271
1275
  tabBar && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native9.View, { style: styles4.listWidth, children: tabBar }),
1272
1276
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native9.View, { style: styles4.list, children: pack.games.map((game) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(GameRow, { game, hidden: isHidden(tab, game), dark, p1Color, p2Color, previewRevealed: previewsRevealed, onPress: () => openGame(game), onRules: hasRules(game) ? () => openRules(game) : void 0 }, game.id)) })
1273
1277
  ] }),
1274
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_feedback_press3.IconButton, { icon: "trophy", iconColor: fg, size: 24, style: [styles4.corner, { top: 8 + insets.top, left: 8 + insets.left }], onPress: () => import_expo_router8.router.push(STATS_HREF), accessibilityLabel: "Stats & Achievements" }),
1278
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_feedback_press3.IconButton, { icon: "trophy", iconColor: fg, size: 24, style: [styles4.corner, { top: 8 + insets.top, left: 8 + insets.left }], onPress: () => import_expo_router9.router.push(STATS_HREF), accessibilityLabel: "Stats & Achievements" }),
1275
1279
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_feedback_press3.IconButton, { icon: "cog", iconColor: fg, size: 24, style: [styles4.corner, { top: 8 + insets.top, right: 8 + insets.right }], onPress: () => setSettingsOpen(true), accessibilityLabel: "Settings" }),
1276
1280
  RulesSheet && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(RulesSheet, { visible: true, onDismiss: () => setRulesGame(null) })
1277
1281
  ] }) }),
1278
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SettingsDialog, { visible: settingsOpen, onDismiss: () => setSettingsOpen(false), onShowHowToPlay: pack.guide ? openPack : void 0 })
1282
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SettingsDialog, { visible: settingsOpen, onDismiss: () => setSettingsOpen(false), onShowHowToPlay: pack.guide ? openPack : void 0, showProfile: true })
1279
1283
  ] });
1280
1284
  }
1281
1285
  var SEAT_ONE_PICKER = "home-p1";
@@ -1503,7 +1507,7 @@ var styles4 = import_react_native9.StyleSheet.create({
1503
1507
  var import_auto_paper7 = require("@rific/auto-paper");
1504
1508
  var import_chrome8 = require("@tastic/hud/chrome");
1505
1509
  var import_profile10 = require("@tastic/profile");
1506
- var import_expo_router9 = require("expo-router");
1510
+ var import_expo_router10 = require("expo-router");
1507
1511
  var import_react17 = require("react");
1508
1512
  var import_react_native10 = require("react-native");
1509
1513
  var import_react_native_paper2 = require("react-native-paper");
@@ -1520,6 +1524,8 @@ var LABEL_WIDE_TAB = { flex: 0, flexBasis: "auto", flexGrow: 1, flexShrink: 1 };
1520
1524
  var NO_PACK_TABS = [];
1521
1525
  var EVERYONE = "__everyone__";
1522
1526
  var ALL_GAMES = "__all__";
1527
+ var tabGroup = (index) => `__tab-group-${index}__`;
1528
+ var tabGames = (index) => `__tab-${index}__`;
1523
1529
  var PLAYER_PICKER_ID = "stats-player";
1524
1530
  var GAME_PICKER_ID = "stats-game";
1525
1531
  var MANAGE = "__manage__";
@@ -1548,12 +1554,21 @@ function StatsContent({ pickerHost }) {
1548
1554
  const statsPlayer = useStatsPlayer();
1549
1555
  const [selectedProfileId, setSelectedProfileId] = (0, import_react17.useState)(() => pack.useStatsPlayer ? statsPlayer : pack.guestStats ? lastSelected[1] ?? GUEST_PLAYER_ID : null);
1550
1556
  const profileId = selectedProfileId && profiles.length > 0 && (pack.guestStats && selectedProfileId === GUEST_PLAYER_ID || profiles.some((p) => p.id === selectedProfileId)) ? selectedProfileId : null;
1551
- const games = gameId === ALL_GAMES ? pack.games : pack.games.filter((g) => g.id === gameId);
1557
+ const homeTabs = pack.homeTabs && pack.homeTabs.length > 1 ? pack.homeTabs : null;
1558
+ const pickedTab = homeTabs?.findIndex((_, index) => gameId === tabGames(index)) ?? -1;
1559
+ const games = gameId === ALL_GAMES ? pack.games : pickedTab >= 0 ? pack.games.filter((g) => homeTabs[pickedTab].includes(g)) : pack.games.filter((g) => g.id === gameId);
1560
+ const gameIds = gameId === ALL_GAMES ? null : games.map((g) => g.id);
1561
+ const oneGameId = gameId === ALL_GAMES || pickedTab >= 0 ? null : gameId;
1552
1562
  const packTabs = pack.statsTabs ?? NO_PACK_TABS;
1553
1563
  const packTab = packTabs.find((t) => t.value === tab);
1554
1564
  const showGamePicker = !(tab === ACHIEVEMENTS && pack.AchievementList);
1555
1565
  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]);
1556
- 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]);
1566
+ const gameOptions = (0, import_react17.useMemo)(() => {
1567
+ const all = { value: ALL_GAMES, label: "All Games", icon: "view-grid-outline" };
1568
+ const option = (g) => ({ value: g.id, label: g.title, icon: "cards-playing-outline" });
1569
+ if (!homeTabs) return [all, ...pack.games.map(option)];
1570
+ 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)] }))];
1571
+ }, [pack.games, homeTabs]);
1557
1572
  const tabButtons = (0, import_react17.useMemo)(() => {
1558
1573
  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;
1559
1574
  return pack.labelStyle ? buttons.map((button) => ({ ...button, labelStyle: pack.labelStyle })) : buttons;
@@ -1564,7 +1579,7 @@ function StatsContent({ pickerHost }) {
1564
1579
  const reset = resetFor(pack, packReset, profileId, profiles, games, () => games.forEach((g) => g.resetStats && dispatch(g.resetStats())));
1565
1580
  const usePickerAlign = pack.usePickerAlign ?? noPickerAlign2;
1566
1581
  const playerSize = (0, import_profile10.getOptionPickerContentSize)(playerOptions);
1567
- const gameSize = (0, import_profile10.getOptionPickerContentSize)(gameOptions.length);
1582
+ const gameSize = (0, import_profile10.getOptionPickerContentSize)(gameOptions);
1568
1583
  const playerAlign = usePickerAlign(pickerHost.openId === PLAYER_PICKER_ID, playerSize.width, playerSize.height);
1569
1584
  const gameAlign = usePickerAlign(pickerHost.openId === GAME_PICKER_ID, gameSize.width, gameSize.height);
1570
1585
  const surface = pack.Backdrop ? { backgroundColor: colors.surface } : void 0;
@@ -1574,11 +1589,11 @@ function StatsContent({ pickerHost }) {
1574
1589
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_chrome8.PressAwayOverlay, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles5.pressAway }),
1575
1590
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native_paper2.SegmentedButtons, { value: tab, onValueChange: setTab, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles5.tabs, surface] }),
1576
1591
  /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native10.View, { style: [styles5.filters, pickerHost.openId !== null && styles5.filtersOpen], onStartShouldSetResponder: () => pickerHost.openId !== null, children: [
1577
- /* @__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_router9.router.push(PROFILES_HREF) : setSelectedProfileId(value === EVERYONE ? null : value), color: colors.primary, dark, icon: profileId ? "account" : "account-group", alignOverride: playerAlign, triggerStyle }),
1578
- 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 })
1592
+ /* @__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 }),
1593
+ 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 })
1579
1594
  ] }),
1580
- tab === STATS && pack.StatsSections && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(pack.StatsSections, { profileId, gameId: gameId === ALL_GAMES ? null : gameId }),
1581
- PackTabContent && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PackTabContent, { profileId, gameId: gameId === ALL_GAMES ? null : gameId }),
1595
+ tab === STATS && pack.StatsSections && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(pack.StatsSections, { profileId, gameId: oneGameId, gameIds }),
1596
+ PackTabContent && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PackTabContent, { profileId, gameId: oneGameId, gameIds }),
1582
1597
  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))
1583
1598
  ] });
1584
1599
  }
@@ -1691,7 +1706,7 @@ function useActiveRound(game, defaults) {
1691
1706
  }
1692
1707
 
1693
1708
  // src/hooks/useBackBlock.ts
1694
- var import_expo_router10 = require("expo-router");
1709
+ var import_expo_router11 = require("expo-router");
1695
1710
  var import_react19 = require("react");
1696
1711
  function useBackBlock(held, onHeld, leave = import_core6.safeBack) {
1697
1712
  const leavingRef = (0, import_react19.useRef)(false);
@@ -1700,7 +1715,7 @@ function useBackBlock(held, onHeld, leave = import_core6.safeBack) {
1700
1715
  (0, import_react19.useEffect)(() => {
1701
1716
  leaveRef.current = leave;
1702
1717
  });
1703
- (0, import_expo_router10.usePreventRemove)(held && !leaving, ({ repeat }) => {
1718
+ (0, import_expo_router11.usePreventRemove)(held && !leaving, ({ repeat }) => {
1704
1719
  if (leavingRef.current) {
1705
1720
  setLeaving(true);
1706
1721
  repeat();
package/dist/index.mjs CHANGED
@@ -459,7 +459,7 @@ function HapticGatedToastProvider({ children }) {
459
459
  }
460
460
  function FramedToaster() {
461
461
  const renderFrame = useCallback6((toasts) => /* @__PURE__ */ jsx10(ScreenFrame, { passThrough: true, children: toasts }), []);
462
- return /* @__PURE__ */ jsx10(Toaster, { historyButton: null, clearButton: null, limit: 3, renderFrame });
462
+ return /* @__PURE__ */ jsx10(Toaster, { historyButton: null, clearButton: null, limit: 1, renderFrame });
463
463
  }
464
464
  function PackToaster({ Toaster: PackToasterComponent }) {
465
465
  return /* @__PURE__ */ jsx10(View, { style: StyleSheet.absoluteFill, pointerEvents: "box-none", children: /* @__PURE__ */ jsx10(ScreenFrame, { passThrough: true, children: /* @__PURE__ */ jsx10(PackToasterComponent, {}) }) });
@@ -531,8 +531,8 @@ import { jsx as jsx12 } from "react/jsx-runtime";
531
531
  function EditProfileRoute() {
532
532
  const { id } = useLocalSearchParams();
533
533
  const { profiles, createProfile, updateProfile, deleteProfile } = useProfiles();
534
- const { Backdrop, foreground, newProfileColor } = usePack();
535
- return /* @__PURE__ */ jsx12(ScreenFrame3, { portalHost: true, maxContentWidth: ROSTER_MAX_WIDTH, children: /* @__PURE__ */ jsx12(EditProfileScreen, { profileId: id, profiles, defaultColor: newProfileColor ?? defaultColors[0].value, onCreate: (patch) => createProfile(patch), onSave: (profileId, patch) => updateProfile(profileId, patch), onDelete: deleteProfile, onBack: safeBack, fg: foreground, bg: Backdrop ? "transparent" : void 0 }) });
534
+ const { Backdrop, foreground, newProfileColor, ProfileSections } = usePack();
535
+ return /* @__PURE__ */ jsx12(ScreenFrame3, { portalHost: true, maxContentWidth: ROSTER_MAX_WIDTH, children: /* @__PURE__ */ jsx12(EditProfileScreen, { profileId: id, profiles, defaultColor: newProfileColor ?? defaultColors[0].value, onCreate: (patch) => createProfile(patch), onSave: (profileId, patch) => updateProfile(profileId, patch), onDelete: deleteProfile, onBack: safeBack, fg: foreground, bg: Backdrop ? "transparent" : void 0, sections: ProfileSections ? (profile) => /* @__PURE__ */ jsx12(ProfileSections, { profile }) : void 0 }) });
536
536
  }
537
537
 
538
538
  // src/screens/GameRoute.tsx
@@ -546,7 +546,7 @@ import { useOrientationState } from "@tastic/core";
546
546
  import { CornerActionButtons, PressAwayOverlay, usePopoverHost } from "@tastic/hud/chrome";
547
547
  import { PlayerSetupPanel, ReadyButton, SharedActionBand } from "@tastic/hud/lobby";
548
548
  import { DualZoneLayout, needsSharedNeutralZone, useDualZoneLayout } from "@tastic/split-screen";
549
- import { router as router3, useFocusEffect as useFocusEffect2 } from "expo-router";
549
+ import { router as router4, useFocusEffect as useFocusEffect2 } from "expo-router";
550
550
  import { useCallback as useCallback9, useEffect as useEffect4, useMemo as useMemo5, useRef as useRef4, useState as useState4 } from "react";
551
551
  import { StyleSheet as StyleSheet3, View as View3 } from "react-native";
552
552
  import Animated from "react-native-reanimated";
@@ -609,15 +609,19 @@ var styles2 = StyleSheet2.create({
609
609
  // src/components/SettingsDialog.tsx
610
610
  import { useUpdateErrorToast as useUpdateErrorToast2 } from "@rific/toaster";
611
611
  import { BaseSettingsDialog } from "@tastic/hud/chrome";
612
+ import { router as router3 } from "expo-router";
612
613
  import { jsx as jsx14, jsxs as jsxs3 } from "react/jsx-runtime";
613
614
  var noSettingsRules = () => null;
614
- function SettingsDialog({ visible, onDismiss, onShowHowToPlay, children }) {
615
+ function SettingsDialog({ visible, onDismiss, onShowHowToPlay, showProfile = false, children }) {
615
616
  const onUpdateError = useUpdateErrorToast2();
616
617
  const { settings, setSettings } = useAppSettings();
617
618
  const { otaVersion, SettingsSections, edgeGuard = true, useSettingsRules = noSettingsRules } = usePack();
618
619
  const rules = useSettingsRules();
620
+ const { profiles, lastSelected } = useProfiles();
621
+ const seatOne = profiles.find((profile) => profile.id === lastSelected[1]) ?? null;
622
+ const profileRow = showProfile ? seatOne ? { onShowProfiles: () => router3.push(profileHref(seatOne.id)), profilesRow: { label: "Profile", caption: seatOne.name, icon: "account-outline" } } : { onShowProfiles: () => router3.push(PROFILES_HREF) } : {};
619
623
  const edgeGuardProps = edgeGuard ? { deferBottomEdgeGestures: settings.deferBottomEdgeGestures, onDeferBottomEdgeGestures: (value) => setSettings({ deferBottomEdgeGestures: value }) } : {};
620
- return /* @__PURE__ */ jsxs3(BaseSettingsDialog, { visible, onDismiss, version: otaVersion, ...edgeGuardProps, onUpdateError, onShowHowToPlay, leading: rules, children: [
624
+ return /* @__PURE__ */ jsxs3(BaseSettingsDialog, { visible, onDismiss, version: otaVersion, ...edgeGuardProps, onUpdateError, onShowHowToPlay, ...profileRow, leading: rules, children: [
621
625
  children,
622
626
  SettingsSections && /* @__PURE__ */ jsx14(SettingsSections, {})
623
627
  ] });
@@ -827,7 +831,7 @@ function LoadoutScreen({ game }) {
827
831
  useEffect4(() => {
828
832
  if (!humanSeats.every((s) => ready[s])) return;
829
833
  dispatch(liveplayActions.setActiveRound({ game: game.id, mode, settings: roundSettingsRef.current }));
830
- router3.push(playHref(game.id));
834
+ router4.push(playHref(game.id));
831
835
  }, [ready, humanSeats, game.id, mode, dispatch]);
832
836
  const bg = pack.Backdrop ? "transparent" : dark ? "#000000" : "#FFFFFF";
833
837
  const fg = pack.foreground ?? (dark ? "#FFFFFF" : "#000000");
@@ -849,7 +853,7 @@ function LoadoutScreen({ game }) {
849
853
  const p1ControlOpen = controlsHost.openId === P1_CONTROL_ID;
850
854
  const controlLook = { accentColor: themeColors.tertiary, mutedColor: fgMuted, dark };
851
855
  const p1Control = loadout.seatControl(1, controlsHost, { ...controlLook, seatColor: p1Drawn });
852
- const p1Panel = /* @__PURE__ */ jsx15(PlayerSetupPanel, { idPrefix: "p1", host: controlsHost, color: p1Color, onColorChange: handleP1ColorChange, swatches: defaultColors2, 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: () => router3.push(PROFILES_HREF), previewValue: seatPreview, triggerStyle, useSeatPickerAlign: seatPickerAlign }, `p1-${layoutKey}`);
856
+ const p1Panel = /* @__PURE__ */ jsx15(PlayerSetupPanel, { idPrefix: "p1", host: controlsHost, color: p1Color, onColorChange: handleP1ColorChange, swatches: defaultColors2, 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: () => router4.push(PROFILES_HREF), previewValue: seatPreview, triggerStyle, useSeatPickerAlign: seatPickerAlign }, `p1-${layoutKey}`);
853
857
  const opponentPicker = game.seatTwo && /* @__PURE__ */ jsx15(OpponentPicker, { idPrefix: "p1", host: controlsHost, choices: game.seatTwo, seatTwo, onSeatTwoChange: changeSeatTwo, cpuDifficulty: loadout.cpuDifficulty, color: p2Color, onColorChange: handleP2ColorChange, swatches: defaultColors2, takenColor: p1Color, allowSwapTaken: mode === "vsCpu", dark, previewValue: seatPreview, triggerStyle, usePickerAlign: seatPickerAlign }, `opponent-${layoutKey}`);
854
858
  const toggleP1Ready = () => setReady((r) => ({ ...r, 1: !r[1] }));
855
859
  const seatButtons = /* @__PURE__ */ jsxs4(View3, { style: [styles3.seatOneButtons, p1PickerOpen && styles3.raised], children: [
@@ -901,7 +905,7 @@ function LoadoutScreen({ game }) {
901
905
  seatOne
902
906
  ] })
903
907
  ] }),
904
- /* @__PURE__ */ jsx15(SettingsDialog, { visible: settingsOpen, onDismiss: () => setSettingsOpen(false), onShowHowToPlay: () => openFor(game.id) })
908
+ /* @__PURE__ */ jsx15(SettingsDialog, { visible: settingsOpen, onDismiss: () => setSettingsOpen(false), onShowHowToPlay: () => openFor(game.id), showProfile: true })
905
909
  ] });
906
910
  }
907
911
  function halfOf(color) {
@@ -1017,7 +1021,7 @@ import { defaultColors as defaultColors3, FadingScrollView, useAutoPaperTheme as
1017
1021
  import { IconButton, Pressable } from "@rific/feedback-press";
1018
1022
  import { PressAwayOverlay as PressAwayOverlay2, usePopoverHost as usePopoverHost2, useWellColors, WELL_SHADOW } from "@tastic/hud/chrome";
1019
1023
  import { getProfilePickerContentSize, ProfilePicker } from "@tastic/profile";
1020
- import { Redirect as Redirect2, router as router4, useIsFocused } from "expo-router";
1024
+ import { Redirect as Redirect2, router as router5, useIsFocused } from "expo-router";
1021
1025
  import { useCallback as useCallback10, useEffect as useEffect6, useMemo as useMemo6, useRef as useRef5, useState as useState6 } from "react";
1022
1026
  import { AppState as AppState2, StyleSheet as StyleSheet4, View as View4 } from "react-native";
1023
1027
  import { Icon, Portal, SegmentedButtons, Text } from "react-native-paper";
@@ -1164,13 +1168,13 @@ function HomeMenu() {
1164
1168
  const tabBar = tab && /* @__PURE__ */ jsx17(SegmentedButtons, { value: tab.label, onValueChange: setTabLabel, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles4.tabs, pack.Backdrop && { backgroundColor: colors.surface }] });
1165
1169
  const columnClamp = useClampOnShrink();
1166
1170
  const gridClamp = useClampOnShrink();
1167
- const openGame = useCallback10((game) => openFirstTime(game.id, () => router4.push(game.useLoadout ? loadoutHref(game.id) : playHref(game.id))), [openFirstTime]);
1171
+ const openGame = useCallback10((game) => openFirstTime(game.id, () => router5.push(game.useLoadout ? loadoutHref(game.id) : playHref(game.id))), [openFirstTime]);
1168
1172
  const openRules = useCallback10((game) => game.Rules ? setRulesGame(game) : openFor(game.id), [openFor]);
1169
1173
  const colorSection = { value: p1Color, onChange: handleP1ColorChange, swatches: defaultColors3, caption: selectedProfile ? pack.colorCaption : void 0, previewValue: previewColor ? (hex) => previewColor(hex, dark) : void 0 };
1170
1174
  const usePickerAlign = pack.usePickerAlign ?? noPickerAlign;
1171
1175
  const pickerSize = getProfilePickerContentSize(profiles.length, true, colorSection);
1172
1176
  const pickerAlign = usePickerAlign(pickerHost.openId === `${SEAT_ONE_PICKER}-profile`, pickerSize.width, pickerSize.height);
1173
- const picker = /* @__PURE__ */ jsx17(ProfilePicker, { idPrefix: SEAT_ONE_PICKER, host: pickerHost, profiles, selectedId: lastSelected[1], color: p1Drawn, dark, guestLabel: pack.guestLabel ?? "P1", nullLabel: pack.nullLabel, onSelect: (profile) => selectProfile(1, profile?.id ?? null), onManage: () => router4.push(PROFILES_HREF), colorSection, alignOverride: pickerAlign, triggerStyle });
1177
+ const picker = /* @__PURE__ */ jsx17(ProfilePicker, { idPrefix: SEAT_ONE_PICKER, host: pickerHost, profiles, selectedId: lastSelected[1], color: p1Drawn, dark, guestLabel: pack.guestLabel ?? "P1", nullLabel: pack.nullLabel, onSelect: (profile) => selectProfile(1, profile?.id ?? null), onManage: () => router5.push(PROFILES_HREF), colorSection, alignOverride: pickerAlign, triggerStyle });
1174
1178
  const pressAway = /* @__PURE__ */ jsx17(PressAwayOverlay2, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles4.pressAway });
1175
1179
  const RulesSheet = rulesGame?.Rules;
1176
1180
  return /* @__PURE__ */ jsxs5(View4, { style: [styles4.container, { backgroundColor: bg }], children: [
@@ -1192,11 +1196,11 @@ function HomeMenu() {
1192
1196
  tabBar && /* @__PURE__ */ jsx17(View4, { style: styles4.listWidth, children: tabBar }),
1193
1197
  /* @__PURE__ */ jsx17(View4, { style: styles4.list, children: pack.games.map((game) => /* @__PURE__ */ jsx17(GameRow, { game, hidden: isHidden(tab, game), dark, p1Color, p2Color, previewRevealed: previewsRevealed, onPress: () => openGame(game), onRules: hasRules(game) ? () => openRules(game) : void 0 }, game.id)) })
1194
1198
  ] }),
1195
- /* @__PURE__ */ jsx17(IconButton, { icon: "trophy", iconColor: fg, size: 24, style: [styles4.corner, { top: 8 + insets.top, left: 8 + insets.left }], onPress: () => router4.push(STATS_HREF), accessibilityLabel: "Stats & Achievements" }),
1199
+ /* @__PURE__ */ jsx17(IconButton, { icon: "trophy", iconColor: fg, size: 24, style: [styles4.corner, { top: 8 + insets.top, left: 8 + insets.left }], onPress: () => router5.push(STATS_HREF), accessibilityLabel: "Stats & Achievements" }),
1196
1200
  /* @__PURE__ */ jsx17(IconButton, { icon: "cog", iconColor: fg, size: 24, style: [styles4.corner, { top: 8 + insets.top, right: 8 + insets.right }], onPress: () => setSettingsOpen(true), accessibilityLabel: "Settings" }),
1197
1201
  RulesSheet && /* @__PURE__ */ jsx17(RulesSheet, { visible: true, onDismiss: () => setRulesGame(null) })
1198
1202
  ] }) }),
1199
- /* @__PURE__ */ jsx17(SettingsDialog, { visible: settingsOpen, onDismiss: () => setSettingsOpen(false), onShowHowToPlay: pack.guide ? openPack : void 0 })
1203
+ /* @__PURE__ */ jsx17(SettingsDialog, { visible: settingsOpen, onDismiss: () => setSettingsOpen(false), onShowHowToPlay: pack.guide ? openPack : void 0, showProfile: true })
1200
1204
  ] });
1201
1205
  }
1202
1206
  var SEAT_ONE_PICKER = "home-p1";
@@ -1424,7 +1428,7 @@ var styles4 = StyleSheet4.create({
1424
1428
  import { useAutoPaperTheme as useAutoPaperTheme5 } from "@rific/auto-paper";
1425
1429
  import { BaseStatsScreen, PressAwayOverlay as PressAwayOverlay3, ScreenFrame as ScreenFrame4, usePopoverHost as usePopoverHost3 } from "@tastic/hud/chrome";
1426
1430
  import { getOptionPickerContentSize as getOptionPickerContentSize2, OptionPicker as OptionPicker2 } from "@tastic/profile";
1427
- import { router as router5 } from "expo-router";
1431
+ import { router as router6 } from "expo-router";
1428
1432
  import { useMemo as useMemo7, useState as useState7 } from "react";
1429
1433
  import { StyleSheet as StyleSheet5, View as View5 } from "react-native";
1430
1434
  import { SegmentedButtons as SegmentedButtons2, Text as Text2 } from "react-native-paper";
@@ -1441,6 +1445,8 @@ var LABEL_WIDE_TAB = { flex: 0, flexBasis: "auto", flexGrow: 1, flexShrink: 1 };
1441
1445
  var NO_PACK_TABS = [];
1442
1446
  var EVERYONE = "__everyone__";
1443
1447
  var ALL_GAMES = "__all__";
1448
+ var tabGroup = (index) => `__tab-group-${index}__`;
1449
+ var tabGames = (index) => `__tab-${index}__`;
1444
1450
  var PLAYER_PICKER_ID = "stats-player";
1445
1451
  var GAME_PICKER_ID = "stats-game";
1446
1452
  var MANAGE = "__manage__";
@@ -1469,12 +1475,21 @@ function StatsContent({ pickerHost }) {
1469
1475
  const statsPlayer = useStatsPlayer();
1470
1476
  const [selectedProfileId, setSelectedProfileId] = useState7(() => pack.useStatsPlayer ? statsPlayer : pack.guestStats ? lastSelected[1] ?? GUEST_PLAYER_ID : null);
1471
1477
  const profileId = selectedProfileId && profiles.length > 0 && (pack.guestStats && selectedProfileId === GUEST_PLAYER_ID || profiles.some((p) => p.id === selectedProfileId)) ? selectedProfileId : null;
1472
- const games = gameId === ALL_GAMES ? pack.games : pack.games.filter((g) => g.id === gameId);
1478
+ const homeTabs = pack.homeTabs && pack.homeTabs.length > 1 ? pack.homeTabs : null;
1479
+ const pickedTab = homeTabs?.findIndex((_, index) => gameId === tabGames(index)) ?? -1;
1480
+ const games = gameId === ALL_GAMES ? pack.games : pickedTab >= 0 ? pack.games.filter((g) => homeTabs[pickedTab].includes(g)) : pack.games.filter((g) => g.id === gameId);
1481
+ const gameIds = gameId === ALL_GAMES ? null : games.map((g) => g.id);
1482
+ const oneGameId = gameId === ALL_GAMES || pickedTab >= 0 ? null : gameId;
1473
1483
  const packTabs = pack.statsTabs ?? NO_PACK_TABS;
1474
1484
  const packTab = packTabs.find((t) => t.value === tab);
1475
1485
  const showGamePicker = !(tab === ACHIEVEMENTS && pack.AchievementList);
1476
1486
  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]);
1477
- 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]);
1487
+ const gameOptions = useMemo7(() => {
1488
+ const all = { value: ALL_GAMES, label: "All Games", icon: "view-grid-outline" };
1489
+ const option = (g) => ({ value: g.id, label: g.title, icon: "cards-playing-outline" });
1490
+ if (!homeTabs) return [all, ...pack.games.map(option)];
1491
+ 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)] }))];
1492
+ }, [pack.games, homeTabs]);
1478
1493
  const tabButtons = useMemo7(() => {
1479
1494
  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;
1480
1495
  return pack.labelStyle ? buttons.map((button) => ({ ...button, labelStyle: pack.labelStyle })) : buttons;
@@ -1485,7 +1500,7 @@ function StatsContent({ pickerHost }) {
1485
1500
  const reset = resetFor(pack, packReset, profileId, profiles, games, () => games.forEach((g) => g.resetStats && dispatch(g.resetStats())));
1486
1501
  const usePickerAlign = pack.usePickerAlign ?? noPickerAlign2;
1487
1502
  const playerSize = getOptionPickerContentSize2(playerOptions);
1488
- const gameSize = getOptionPickerContentSize2(gameOptions.length);
1503
+ const gameSize = getOptionPickerContentSize2(gameOptions);
1489
1504
  const playerAlign = usePickerAlign(pickerHost.openId === PLAYER_PICKER_ID, playerSize.width, playerSize.height);
1490
1505
  const gameAlign = usePickerAlign(pickerHost.openId === GAME_PICKER_ID, gameSize.width, gameSize.height);
1491
1506
  const surface = pack.Backdrop ? { backgroundColor: colors.surface } : void 0;
@@ -1495,11 +1510,11 @@ function StatsContent({ pickerHost }) {
1495
1510
  /* @__PURE__ */ jsx18(PressAwayOverlay3, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles5.pressAway }),
1496
1511
  /* @__PURE__ */ jsx18(SegmentedButtons2, { value: tab, onValueChange: setTab, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles5.tabs, surface] }),
1497
1512
  /* @__PURE__ */ jsxs6(View5, { style: [styles5.filters, pickerHost.openId !== null && styles5.filtersOpen], onStartShouldSetResponder: () => pickerHost.openId !== null, children: [
1498
- /* @__PURE__ */ jsx18(OptionPicker2, { id: PLAYER_PICKER_ID, host: pickerHost, options: playerOptions, value: profileId ?? EVERYONE, onChange: (value) => value === MANAGE ? router5.push(PROFILES_HREF) : setSelectedProfileId(value === EVERYONE ? null : value), color: colors.primary, dark, icon: profileId ? "account" : "account-group", alignOverride: playerAlign, triggerStyle }),
1499
- 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 })
1513
+ /* @__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 }),
1514
+ 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 })
1500
1515
  ] }),
1501
- tab === STATS && pack.StatsSections && /* @__PURE__ */ jsx18(pack.StatsSections, { profileId, gameId: gameId === ALL_GAMES ? null : gameId }),
1502
- PackTabContent && /* @__PURE__ */ jsx18(PackTabContent, { profileId, gameId: gameId === ALL_GAMES ? null : gameId }),
1516
+ tab === STATS && pack.StatsSections && /* @__PURE__ */ jsx18(pack.StatsSections, { profileId, gameId: oneGameId, gameIds }),
1517
+ PackTabContent && /* @__PURE__ */ jsx18(PackTabContent, { profileId, gameId: oneGameId, gameIds }),
1503
1518
  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))
1504
1519
  ] });
1505
1520
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tastic/shell",
3
- "version": "0.15.0",
3
+ "version": "0.17.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",
@@ -86,8 +86,8 @@
86
86
  "@tastic/achievements": "^0.6.1",
87
87
  "@tastic/core": "^0.17.0",
88
88
  "@tastic/edge-guard": "^0.2.1",
89
- "@tastic/hud": "^0.36.0",
90
- "@tastic/profile": "^0.24.0",
89
+ "@tastic/hud": "^0.37.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",
@@ -138,8 +138,8 @@
138
138
  "@tastic/achievements": ">=0.6.0",
139
139
  "@tastic/core": ">=0.16.0",
140
140
  "@tastic/edge-guard": ">=0.2.0",
141
- "@tastic/hud": ">=0.35.0",
142
- "@tastic/profile": ">=0.22.0",
141
+ "@tastic/hud": ">=0.37.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",
@@ -154,7 +154,7 @@ function HapticGatedToastProvider({ children }: { children: ReactNode }) {
154
154
 
155
155
  function FramedToaster() {
156
156
  const renderFrame = useCallback((toasts: ReactNode) => <ScreenFrame passThrough>{toasts}</ScreenFrame>, [])
157
- return <Toaster historyButton={null} clearButton={null} limit={3} renderFrame={renderFrame} />
157
+ return <Toaster historyButton={null} clearButton={null} limit={1} renderFrame={renderFrame} />
158
158
  }
159
159
 
160
160
  // The pack's own toaster (PackDefinition.Toaster), laid over the whole app in hud's ScreenFrame:
@@ -1,9 +1,12 @@
1
1
  import { useUpdateErrorToast } from '@rific/toaster'
2
2
  import { BaseSettingsDialog } from '@tastic/hud/chrome'
3
+ import { router } from 'expo-router'
3
4
  import type { ReactNode } from 'react'
4
5
 
5
6
  import { useAppSettings } from '../hooks/useAppSettings'
7
+ import { useProfiles } from '../hooks/useProfiles'
6
8
  import { usePack } from '../PackContext'
9
+ import { profileHref, PROFILES_HREF } from '../routes'
7
10
 
8
11
  export interface SettingsDialogProps {
9
12
  visible: boolean
@@ -12,6 +15,11 @@ export interface SettingsDialogProps {
12
15
  // Left out on Home, where each tile's rules button does it, and in a match, where opening
13
16
  // Settings pauses play.
14
17
  onShowHowToPlay?: () => void
18
+ // Shows the Profile row: seat 1's profile, "Profile" over its name, opening its Edit Profile screen, or Profiles (the roster)
19
+ // while seat 1 is Guest (Jay, 2026-11-20: straight to your own profile, especially for someone with just the one; adding a second
20
+ // stays a seat picker's Manage away). Home and a loadout pass it; a play screen leaves it off, as How to Play, since leaving a game
21
+ // in play for another screen would keep its clock running.
22
+ showProfile?: boolean
15
23
  // A play screen's own rows (a game's rule variants, where it has no loadout to set them in, see
16
24
  // GameDefinition.useLoadout), above the pack's own sections.
17
25
  children?: ReactNode
@@ -26,16 +34,19 @@ const noSettingsRules = () => null
26
34
  // under them, a play screen's own rows and then the pack's own sections
27
35
  // (PackDefinition.SettingsSections), in every Settings dialog the pack opens. A pack with edgeGuard
28
36
  // false gets no Edge Guard row: hud draws it on iOS whenever its props are passed.
29
- export function SettingsDialog({ visible, onDismiss, onShowHowToPlay, children }: SettingsDialogProps) {
37
+ export function SettingsDialog({ visible, onDismiss, onShowHowToPlay, showProfile = false, children }: SettingsDialogProps) {
30
38
  const onUpdateError = useUpdateErrorToast()
31
39
  const { settings, setSettings } = useAppSettings()
32
40
  // The pack's otaVersion (src/constants/release.ts, which the OTA tooling bumps).
33
41
  const { otaVersion, SettingsSections, edgeGuard = true, useSettingsRules = noSettingsRules } = usePack()
34
42
  const rules = useSettingsRules()
43
+ const { profiles, lastSelected } = useProfiles()
44
+ const seatOne = profiles.find((profile) => profile.id === lastSelected[1]) ?? null
45
+ const profileRow = showProfile ? (seatOne ? { onShowProfiles: () => router.push(profileHref(seatOne.id)), profilesRow: { label: 'Profile', caption: seatOne.name, icon: 'account-outline' } } : { onShowProfiles: () => router.push(PROFILES_HREF) }) : {}
35
46
  const edgeGuardProps = edgeGuard ? { deferBottomEdgeGestures: settings.deferBottomEdgeGestures, onDeferBottomEdgeGestures: (value: boolean) => setSettings({ deferBottomEdgeGestures: value }) } : {}
36
47
 
37
48
  return (
38
- <BaseSettingsDialog visible={visible} onDismiss={onDismiss} version={otaVersion} {...edgeGuardProps} onUpdateError={onUpdateError} onShowHowToPlay={onShowHowToPlay} leading={rules}>
49
+ <BaseSettingsDialog visible={visible} onDismiss={onDismiss} version={otaVersion} {...edgeGuardProps} onUpdateError={onUpdateError} onShowHowToPlay={onShowHowToPlay} {...profileRow} leading={rules}>
39
50
  {children}
40
51
  {SettingsSections && <SettingsSections />}
41
52
  </BaseSettingsDialog>
@@ -16,15 +16,16 @@ import { ROSTER_MAX_WIDTH } from './ProfilesRoute'
16
16
  // In hud's ScreenFrame, as Profiles: the delete confirm is a Paper Portal, which lands in a host inside
17
17
  // the frame (portalHost), and the column is capped in the wide layout. A new profile starts on the
18
18
  // pack's newProfileColor, or auto-paper's first swatch. Over a pack's Backdrop the screen is
19
- // transparent, drawn in the pack's foreground.
19
+ // transparent, drawn in the pack's foreground. A saved profile's screen also draws the pack's own
20
+ // ProfileSections (its online play's, say) under Color.
20
21
  export function EditProfileRoute() {
21
22
  const { id } = useLocalSearchParams<{ id: string }>()
22
23
  const { profiles, createProfile, updateProfile, deleteProfile } = useProfiles()
23
- const { Backdrop, foreground, newProfileColor } = usePack()
24
+ const { Backdrop, foreground, newProfileColor, ProfileSections } = usePack()
24
25
 
25
26
  return (
26
27
  <ScreenFrame portalHost maxContentWidth={ROSTER_MAX_WIDTH}>
27
- <EditProfileScreen profileId={id} profiles={profiles} defaultColor={newProfileColor ?? defaultColors[0].value} onCreate={(patch) => createProfile(patch)} onSave={(profileId, patch) => updateProfile(profileId, patch)} onDelete={deleteProfile} onBack={safeBack} fg={foreground} bg={Backdrop ? 'transparent' : undefined} />
28
+ <EditProfileScreen profileId={id} profiles={profiles} defaultColor={newProfileColor ?? defaultColors[0].value} onCreate={(patch) => createProfile(patch)} onSave={(profileId, patch) => updateProfile(profileId, patch)} onDelete={deleteProfile} onBack={safeBack} fg={foreground} bg={Backdrop ? 'transparent' : undefined} sections={ProfileSections ? (profile) => <ProfileSections profile={profile} /> : undefined} />
28
29
  </ScreenFrame>
29
30
  )
30
31
  }
@@ -205,7 +205,7 @@ function HomeMenu() {
205
205
 
206
206
  {/* Home's How to Play row replays the pack's own cards (PackDefinition.guide); without them each
207
207
  tile's rules button shows its game's. */}
208
- <SettingsDialog visible={settingsOpen} onDismiss={() => setSettingsOpen(false)} onShowHowToPlay={pack.guide ? openPack : undefined} />
208
+ <SettingsDialog visible={settingsOpen} onDismiss={() => setSettingsOpen(false)} onShowHowToPlay={pack.guide ? openPack : undefined} showProfile />
209
209
  </View>
210
210
  )
211
211
  }
@@ -257,7 +257,7 @@ export function LoadoutScreen({ game }: { game: LoadoutGame }) {
257
257
  )}
258
258
  </View>
259
259
 
260
- <SettingsDialog visible={settingsOpen} onDismiss={() => setSettingsOpen(false)} onShowHowToPlay={() => openFor(game.id)} />
260
+ <SettingsDialog visible={settingsOpen} onDismiss={() => setSettingsOpen(false)} onShowHowToPlay={() => openFor(game.id)} showProfile />
261
261
  </View>
262
262
  )
263
263
  }
@@ -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
@@ -2,6 +2,7 @@ import type { ThemeAppearance, ThemeSettings } from '@rific/auto-paper'
2
2
  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
+ import type { Profile } from '@tastic/profile'
5
6
  import type { FontSource } from 'expo-font'
6
7
  import type { Href, Stack } from 'expo-router'
7
8
  import type { ComponentProps, ComponentType, ReactNode } from 'react'
@@ -236,7 +237,10 @@ export interface HeroTitleProps {
236
237
  // the player (null is Everyone) and the game (null is All Games).
237
238
  export interface PackStatsSectionsProps {
238
239
  profileId: string | null
240
+ // The one game the game picker is on, or null for several
239
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
240
244
  }
241
245
 
242
246
  // A tab on Home (PackDefinition.homeTabs): its label, and which of the pack's games it shows, in the
@@ -386,6 +390,10 @@ export interface PackDefinition {
386
390
  statsGameTitles?: boolean
387
391
  // A new profile's starting color on its Edit Profile screen. Unset is auto-paper's first swatch.
388
392
  newProfileColor?: string
393
+ // The pack's own sections on a saved profile's Edit Profile screen (EditProfileRoute), under Color and above Delete Profile: its
394
+ // online play's, say (@tastic/profile/online's ProfileOnlineSection), which is where a profile's online life lives (Jay,
395
+ // 2026-11-20). Drawn in the screen's own colors (@tastic/profile's EditProfileSection and EditProfileRow).
396
+ ProfileSections?: ComponentType<{ profile: Profile }>
389
397
  // Where a picker's menu opens (its alignOverride) on Home (seat 1's button), a loadout's one-human row
390
398
  // (both seat buttons; 2 Player keeps each menu in its own player's half) and the stats screen (its two
391
399
  // pickers). It was added because hud's own placement measured a button in a frame turned by