@tastic/shell 0.18.0 → 0.19.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
@@ -27,7 +27,7 @@ package ecosystem, on [`@tastic/hud`](https://github.com/jayrdeaton/react-native
27
27
  - **Screens** for the routes: `HomeScreen` (the pack's hero, seat 1's button, a row per game, or a
28
28
  grid of preview tiles on a wide screen, split into tabs where the pack has them), `LoadoutRoute` and `PlayRoute` (`loadout/[game]`,
29
29
  `play/[game]`), `ProfilesRoute`, `EditProfileRoute` (`profile/[id]`, one profile's Edit Profile
30
- screen, which Profiles pushes with the profile's id or `new`) and `StatsScreen`.
30
+ screen, which Profiles pushes with the profile's id or `new`; a profile made there is picked for the seat whose Manage opened Profiles) and `StatsScreen`.
31
31
  - **The store**: `createPackStore(pack, { keyPrefix, migrate, blacklist, serializableIgnoredPaths,
32
32
  middleware })` builds one persisted store from the shell's keys (theme, haptics, sound, Keep Awake,
33
33
  profiles, seat selection, seat colors, app settings, seat 2, the never-saved `liveplay`, and
@@ -108,9 +108,9 @@ the front of an in-app link, so a route starting with a game id equal to the bas
108
108
  | `appearance?` | The theme's appearance on a fresh install (`'system'` when unset). |
109
109
  | `HeroTitle` | Home's wordmark, drawn by the pack (`HeroTitleProps`: `words`, `color`, `p1Color`, `p2Color`, `active`, false while Home is covered or the app is in the background, and `fit`, the box it has beside the preview grid on a wide screen, undefined at its own size). |
110
110
  | `fonts?` | Fonts the pack's own art needs, loaded behind the splash screen beside the icon font. |
111
- | `fontFamily?` | The typeface on every Paper text variant. Unset is Paper's own. |
112
- | `titleStyle?` | The lettering of the pack's titles alone (a title font, AlphaTastic's), laid over each title's own type: Home's game cards, the stats screen's title and game headings, and every hud dialog's title (the shell mounts hud's `DialogHeaderStyleProvider` in the standard tone, so the big icon and accent color stay). Needs `@tastic/hud` with `titleStyle` in the standard tone and on `BaseStatsScreen`. |
113
- | `labelStyle?` | The lettering of the pack's small labels alone, laid over each one's own type: the stats screen's and Home's tabs, the stats screen's section headings, the Settings sheet's sections and every `@tastic/profile` picker pill. The shell mounts hud's `LetteringProvider` with it and `titleStyle`. Needs `@tastic/hud` with `LetteringProvider` and `@tastic/profile` reading it. |
111
+ | `fontFamily?` | The typeface on every Paper text variant, and on every toast (`@rific/toaster` 0.14.0+ takes the theme's font). Unset is Paper's own. |
112
+ | `titleStyle?` | The lettering of the pack's titles alone (a title font, AlphaTastic's), laid over each title's own type: Home's game cards, each loadout's header, the stats screen's title and game headings, every hud dialog's title (the shell mounts hud's `DialogHeaderStyleProvider` in the standard tone, so the big icon and accent color stay), each How to Play card's title (`@tastic/hud` 0.38.0+) and the Profiles and Edit Profile titles (`@tastic/profile` 0.27.0+). Needs `@tastic/hud` with `titleStyle` in the standard tone and on `BaseStatsScreen`. |
113
+ | `labelStyle?` | The lettering of the pack's small labels alone, laid over each one's own type: the stats screen's and Home's tabs, the stats screen's section headings (the Achievements tab's too, `@tastic/hud` 0.38.0+), the Settings sheet's sections, every `@tastic/profile` picker pill, a loadout's READY? (`@tastic/hud` 0.38.0+) and Edit Profile's headings (`@tastic/profile` 0.28.0+). The shell mounts hud's `LetteringProvider` with it and `titleStyle`. Needs `@tastic/hud` with `LetteringProvider` and `@tastic/profile` reading it. |
114
114
  | `otaVersion` | The version label in Settings. |
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. |
package/dist/index.js CHANGED
@@ -586,34 +586,54 @@ var import_core6 = require("@rific/core");
586
586
  var import_expo_router2 = require("expo-router");
587
587
  (0, import_core6.configureNavigation)({ router: import_expo_router2.router });
588
588
 
589
- // src/screens/ProfilesRoute.tsx
590
- var import_chrome3 = require("@tastic/hud/chrome");
591
- var import_profile4 = require("@tastic/profile");
592
- var import_expo_router3 = require("expo-router");
593
-
594
589
  // src/routes.ts
595
590
  var playHref = (game) => ({ pathname: "/play/[game]", params: { game } });
596
591
  var loadoutHref = (game) => ({ pathname: "/loadout/[game]", params: { game } });
597
592
  var STATS_HREF = "/stats";
598
593
  var PROFILES_HREF = "/profiles";
599
- var profileHref = (id) => ({ pathname: "/profile/[id]", params: { id } });
594
+ var profilesHref = (seat) => ({ pathname: "/profiles", params: { seat: String(seat) } });
595
+ var profileHref = (id, seat) => ({ pathname: "/profile/[id]", params: seat ? { id, seat: String(seat) } : { id } });
596
+ var seatParam = (value) => value === "1" ? 1 : value === "2" ? 2 : null;
600
597
 
601
598
  // src/screens/ProfilesRoute.tsx
599
+ var import_chrome3 = require("@tastic/hud/chrome");
600
+ var import_profile4 = require("@tastic/profile");
601
+ var import_expo_router3 = require("expo-router");
602
602
  var import_jsx_runtime11 = require("react/jsx-runtime");
603
603
  var ROSTER_MAX_WIDTH = 640;
604
604
  function ProfilesRoute() {
605
+ const { seat } = (0, import_expo_router3.useLocalSearchParams)();
606
+ const opener = seatParam(seat);
605
607
  const { profiles } = useProfiles();
606
608
  const { Backdrop, foreground } = usePack();
607
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_chrome3.ScreenFrame, { maxContentWidth: ROSTER_MAX_WIDTH, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_profile4.ProfilesScreen, { profiles, onEdit: (id) => import_expo_router3.router.push(profileHref(id)), onBack: import_core6.safeBack, fg: foreground, bg: Backdrop ? "transparent" : void 0 }) });
609
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_chrome3.ScreenFrame, { maxContentWidth: ROSTER_MAX_WIDTH, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_profile4.ProfilesScreen, { profiles, onEdit: (id) => import_expo_router3.router.push(profileHref(id, id === import_profile4.NEW_PROFILE_ID ? opener : null)), onBack: import_core6.safeBack, fg: foreground, bg: Backdrop ? "transparent" : void 0 }) });
608
610
  }
609
611
 
610
612
  // src/screens/EditProfileRoute.tsx
611
613
  var import_jsx_runtime12 = require("react/jsx-runtime");
612
614
  function EditProfileRoute() {
613
- const { id } = (0, import_expo_router4.useLocalSearchParams)();
614
- const { profiles, createProfile, updateProfile, deleteProfile } = useProfiles();
615
+ const { id, seat } = (0, import_expo_router4.useLocalSearchParams)();
616
+ const opener = seatParam(seat);
617
+ const { profiles, createProfile, updateProfile, deleteProfile, selectProfile } = useProfiles();
615
618
  const { Backdrop, foreground, newProfileColor, ProfileSections } = usePack();
616
- 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 }) });
619
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_chrome4.ScreenFrame, { portalHost: true, maxContentWidth: ROSTER_MAX_WIDTH, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
620
+ import_profile5.EditProfileScreen,
621
+ {
622
+ profileId: id,
623
+ profiles,
624
+ defaultColor: newProfileColor ?? import_auto_paper3.defaultColors[0].value,
625
+ onCreate: (patch) => {
626
+ const profile = createProfile(patch);
627
+ if (opener) selectProfile(opener, profile.id);
628
+ },
629
+ onSave: (profileId, patch) => updateProfile(profileId, patch),
630
+ onDelete: deleteProfile,
631
+ onBack: import_core6.safeBack,
632
+ fg: foreground,
633
+ bg: Backdrop ? "transparent" : void 0,
634
+ sections: ProfileSections ? (profile) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ProfileSections, { profile }) : void 0
635
+ }
636
+ ) });
617
637
  }
618
638
 
619
639
  // src/screens/GameRoute.tsx
@@ -701,7 +721,7 @@ function SettingsDialog({ visible, onDismiss, onShowHowToPlay, showProfile = fal
701
721
  const rules = useSettingsRules();
702
722
  const { profiles, lastSelected } = useProfiles();
703
723
  const seatOne = profiles.find((profile) => profile.id === lastSelected[1]) ?? null;
704
- 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) } : {};
724
+ 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(profilesHref(1)) } : {};
705
725
  const edgeGuardProps = edgeGuard ? { deferBottomEdgeGestures: settings.deferBottomEdgeGestures, onDeferBottomEdgeGestures: (value) => setSettings({ deferBottomEdgeGestures: value }) } : {};
706
726
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_chrome5.BaseSettingsDialog, { visible, onDismiss, version: otaVersion, ...edgeGuardProps, onUpdateError, onShowHowToPlay, ...profileRow, leading: rules, children: [
707
727
  children,
@@ -940,7 +960,7 @@ function LoadoutScreen({ game }) {
940
960
  const p1ControlOpen = controlsHost.openId === P1_CONTROL_ID;
941
961
  const controlLook = { accentColor: themeColors.tertiary, mutedColor: fgMuted, dark };
942
962
  const p1Control = loadout.seatControl(1, controlsHost, { ...controlLook, seatColor: p1Drawn });
943
- 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}`);
963
+ 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(profilesHref(1)), previewValue: seatPreview, triggerStyle, useSeatPickerAlign: seatPickerAlign }, `p1-${layoutKey}`);
944
964
  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}`);
945
965
  const toggleP1Ready = () => setReady((r) => ({ ...r, 1: !r[1] }));
946
966
  const readyInOptions = !p2IsHuman && !!loadout.drawsReady;
@@ -1295,7 +1315,7 @@ function HomeMenu() {
1295
1315
  const usePickerAlign = pack.usePickerAlign ?? noPickerAlign;
1296
1316
  const pickerSize = (0, import_profile9.getProfilePickerContentSize)(profiles.length, true, colorSection);
1297
1317
  const pickerAlign = usePickerAlign(pickerHost.openId === `${SEAT_ONE_PICKER}-profile`, pickerSize.width, pickerSize.height);
1298
- 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 });
1318
+ 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(profilesHref(1)), colorSection, alignOverride: pickerAlign, triggerStyle });
1299
1319
  const pressAway = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_chrome7.PressAwayOverlay, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles4.pressAway });
1300
1320
  const RulesSheet = rulesGame?.Rules;
1301
1321
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native9.View, { style: [styles4.container, { backgroundColor: bg }], children: [
package/dist/index.mjs CHANGED
@@ -500,45 +500,65 @@ var styles = StyleSheet.create({
500
500
  import { defaultColors } from "@rific/auto-paper";
501
501
  import { ScreenFrame as ScreenFrame3 } from "@tastic/hud/chrome";
502
502
  import { EditProfileScreen } from "@tastic/profile";
503
- import { useLocalSearchParams } from "expo-router";
503
+ import { useLocalSearchParams as useLocalSearchParams2 } from "expo-router";
504
504
 
505
505
  // src/navigation.ts
506
506
  import { configureNavigation, safeBack } from "@rific/core";
507
507
  import { router } from "expo-router";
508
508
  configureNavigation({ router });
509
509
 
510
- // src/screens/ProfilesRoute.tsx
511
- import { ScreenFrame as ScreenFrame2 } from "@tastic/hud/chrome";
512
- import { ProfilesScreen } from "@tastic/profile";
513
- import { router as router2 } from "expo-router";
514
-
515
510
  // src/routes.ts
516
511
  var playHref = (game) => ({ pathname: "/play/[game]", params: { game } });
517
512
  var loadoutHref = (game) => ({ pathname: "/loadout/[game]", params: { game } });
518
513
  var STATS_HREF = "/stats";
519
514
  var PROFILES_HREF = "/profiles";
520
- var profileHref = (id) => ({ pathname: "/profile/[id]", params: { id } });
515
+ var profilesHref = (seat) => ({ pathname: "/profiles", params: { seat: String(seat) } });
516
+ var profileHref = (id, seat) => ({ pathname: "/profile/[id]", params: seat ? { id, seat: String(seat) } : { id } });
517
+ var seatParam = (value) => value === "1" ? 1 : value === "2" ? 2 : null;
521
518
 
522
519
  // src/screens/ProfilesRoute.tsx
520
+ import { ScreenFrame as ScreenFrame2 } from "@tastic/hud/chrome";
521
+ import { NEW_PROFILE_ID, ProfilesScreen } from "@tastic/profile";
522
+ import { router as router2, useLocalSearchParams } from "expo-router";
523
523
  import { jsx as jsx11 } from "react/jsx-runtime";
524
524
  var ROSTER_MAX_WIDTH = 640;
525
525
  function ProfilesRoute() {
526
+ const { seat } = useLocalSearchParams();
527
+ const opener = seatParam(seat);
526
528
  const { profiles } = useProfiles();
527
529
  const { Backdrop, foreground } = usePack();
528
- return /* @__PURE__ */ jsx11(ScreenFrame2, { maxContentWidth: ROSTER_MAX_WIDTH, children: /* @__PURE__ */ jsx11(ProfilesScreen, { profiles, onEdit: (id) => router2.push(profileHref(id)), onBack: safeBack, fg: foreground, bg: Backdrop ? "transparent" : void 0 }) });
530
+ return /* @__PURE__ */ jsx11(ScreenFrame2, { maxContentWidth: ROSTER_MAX_WIDTH, children: /* @__PURE__ */ jsx11(ProfilesScreen, { profiles, onEdit: (id) => router2.push(profileHref(id, id === NEW_PROFILE_ID ? opener : null)), onBack: safeBack, fg: foreground, bg: Backdrop ? "transparent" : void 0 }) });
529
531
  }
530
532
 
531
533
  // src/screens/EditProfileRoute.tsx
532
534
  import { jsx as jsx12 } from "react/jsx-runtime";
533
535
  function EditProfileRoute() {
534
- const { id } = useLocalSearchParams();
535
- const { profiles, createProfile, updateProfile, deleteProfile } = useProfiles();
536
+ const { id, seat } = useLocalSearchParams2();
537
+ const opener = seatParam(seat);
538
+ const { profiles, createProfile, updateProfile, deleteProfile, selectProfile } = useProfiles();
536
539
  const { Backdrop, foreground, newProfileColor, ProfileSections } = usePack();
537
- 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 }) });
540
+ return /* @__PURE__ */ jsx12(ScreenFrame3, { portalHost: true, maxContentWidth: ROSTER_MAX_WIDTH, children: /* @__PURE__ */ jsx12(
541
+ EditProfileScreen,
542
+ {
543
+ profileId: id,
544
+ profiles,
545
+ defaultColor: newProfileColor ?? defaultColors[0].value,
546
+ onCreate: (patch) => {
547
+ const profile = createProfile(patch);
548
+ if (opener) selectProfile(opener, profile.id);
549
+ },
550
+ onSave: (profileId, patch) => updateProfile(profileId, patch),
551
+ onDelete: deleteProfile,
552
+ onBack: safeBack,
553
+ fg: foreground,
554
+ bg: Backdrop ? "transparent" : void 0,
555
+ sections: ProfileSections ? (profile) => /* @__PURE__ */ jsx12(ProfileSections, { profile }) : void 0
556
+ }
557
+ ) });
538
558
  }
539
559
 
540
560
  // src/screens/GameRoute.tsx
541
- import { Redirect, useLocalSearchParams as useLocalSearchParams2 } from "expo-router";
561
+ import { Redirect, useLocalSearchParams as useLocalSearchParams3 } from "expo-router";
542
562
  import { useEffect as useEffect5 } from "react";
543
563
  import { AppState } from "react-native";
544
564
 
@@ -622,7 +642,7 @@ function SettingsDialog({ visible, onDismiss, onShowHowToPlay, showProfile = fal
622
642
  const rules = useSettingsRules();
623
643
  const { profiles, lastSelected } = useProfiles();
624
644
  const seatOne = profiles.find((profile) => profile.id === lastSelected[1]) ?? null;
625
- const profileRow = showProfile ? seatOne ? { onShowProfiles: () => router3.push(profileHref(seatOne.id)), profilesRow: { label: "Profile", caption: seatOne.name, icon: "account-outline" } } : { onShowProfiles: () => router3.push(PROFILES_HREF) } : {};
645
+ const profileRow = showProfile ? seatOne ? { onShowProfiles: () => router3.push(profileHref(seatOne.id)), profilesRow: { label: "Profile", caption: seatOne.name, icon: "account-outline" } } : { onShowProfiles: () => router3.push(profilesHref(1)) } : {};
626
646
  const edgeGuardProps = edgeGuard ? { deferBottomEdgeGestures: settings.deferBottomEdgeGestures, onDeferBottomEdgeGestures: (value) => setSettings({ deferBottomEdgeGestures: value }) } : {};
627
647
  return /* @__PURE__ */ jsxs3(BaseSettingsDialog, { visible, onDismiss, version: otaVersion, ...edgeGuardProps, onUpdateError, onShowHowToPlay, ...profileRow, leading: rules, children: [
628
648
  children,
@@ -861,7 +881,7 @@ function LoadoutScreen({ game }) {
861
881
  const p1ControlOpen = controlsHost.openId === P1_CONTROL_ID;
862
882
  const controlLook = { accentColor: themeColors.tertiary, mutedColor: fgMuted, dark };
863
883
  const p1Control = loadout.seatControl(1, controlsHost, { ...controlLook, seatColor: p1Drawn });
864
- 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}`);
884
+ 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(profilesHref(1)), previewValue: seatPreview, triggerStyle, useSeatPickerAlign: seatPickerAlign }, `p1-${layoutKey}`);
865
885
  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}`);
866
886
  const toggleP1Ready = () => setReady((r) => ({ ...r, 1: !r[1] }));
867
887
  const readyInOptions = !p2IsHuman && !!loadout.drawsReady;
@@ -1009,7 +1029,7 @@ var styles3 = StyleSheet3.create({
1009
1029
  // src/screens/GameRoute.tsx
1010
1030
  import { jsx as jsx16 } from "react/jsx-runtime";
1011
1031
  function LoadoutRoute() {
1012
- const { game: id } = useLocalSearchParams2();
1032
+ const { game: id } = useLocalSearchParams3();
1013
1033
  const game = usePackGame(id);
1014
1034
  if (!game) return /* @__PURE__ */ jsx16(Redirect, { href: "/" });
1015
1035
  if (!hasLoadout(game)) return /* @__PURE__ */ jsx16(Redirect, { href: playHref(game.id) });
@@ -1019,7 +1039,7 @@ function hasLoadout(game) {
1019
1039
  return !!game.useLoadout;
1020
1040
  }
1021
1041
  function PlayRoute() {
1022
- const { game: id } = useLocalSearchParams2();
1042
+ const { game: id } = useLocalSearchParams3();
1023
1043
  const game = usePackGame(id);
1024
1044
  useResumePoint(game?.resumable ? game.id : null);
1025
1045
  if (!game) return /* @__PURE__ */ jsx16(Redirect, { href: "/" });
@@ -1216,7 +1236,7 @@ function HomeMenu() {
1216
1236
  const usePickerAlign = pack.usePickerAlign ?? noPickerAlign;
1217
1237
  const pickerSize = getProfilePickerContentSize(profiles.length, true, colorSection);
1218
1238
  const pickerAlign = usePickerAlign(pickerHost.openId === `${SEAT_ONE_PICKER}-profile`, pickerSize.width, pickerSize.height);
1219
- 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 });
1239
+ 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(profilesHref(1)), colorSection, alignOverride: pickerAlign, triggerStyle });
1220
1240
  const pressAway = /* @__PURE__ */ jsx17(PressAwayOverlay2, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles4.pressAway });
1221
1241
  const RulesSheet = rulesGame?.Rules;
1222
1242
  return /* @__PURE__ */ jsxs5(View4, { style: [styles4.container, { backgroundColor: bg }], children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tastic/shell",
3
- "version": "0.18.0",
3
+ "version": "0.19.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",
@@ -6,7 +6,7 @@ import type { ReactNode } from 'react'
6
6
  import { useAppSettings } from '../hooks/useAppSettings'
7
7
  import { useProfiles } from '../hooks/useProfiles'
8
8
  import { usePack } from '../PackContext'
9
- import { profileHref, PROFILES_HREF } from '../routes'
9
+ import { profileHref, profilesHref } from '../routes'
10
10
 
11
11
  export interface SettingsDialogProps {
12
12
  visible: boolean
@@ -42,7 +42,7 @@ export function SettingsDialog({ visible, onDismiss, onShowHowToPlay, showProfil
42
42
  const rules = useSettingsRules()
43
43
  const { profiles, lastSelected } = useProfiles()
44
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) }) : {}
45
+ const profileRow = showProfile ? (seatOne ? { onShowProfiles: () => router.push(profileHref(seatOne.id)), profilesRow: { label: 'Profile', caption: seatOne.name, icon: 'account-outline' } } : { onShowProfiles: () => router.push(profilesHref(1)) }) : {}
46
46
  const edgeGuardProps = edgeGuard ? { deferBottomEdgeGestures: settings.deferBottomEdgeGestures, onDeferBottomEdgeGestures: (value: boolean) => setSettings({ deferBottomEdgeGestures: value }) } : {}
47
47
 
48
48
  return (
package/src/routes.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import type { Href } from 'expo-router'
2
2
 
3
+ import type { Seat } from './types'
4
+
3
5
  // The shell's own routes, the ones every pack's src/app/ has (play/[game], loadout/[game], stats,
4
6
  // profiles, profile/[id]). An app with expo-router's typed routes type-checks this source against its own route tree
5
7
  // (its tsc reads the package's src/), and an app moving onto the shell (Solitaire) has these routes only
@@ -7,6 +9,14 @@ import type { Href } from 'expo-router'
7
9
  export const playHref = (game: string) => ({ pathname: '/play/[game]', params: { game } }) as unknown as Href
8
10
  export const loadoutHref = (game: string) => ({ pathname: '/loadout/[game]', params: { game } }) as unknown as Href
9
11
  export const STATS_HREF = '/stats' as unknown as Href
12
+ // The roster, opened by no seat (the stats screen's Manage).
10
13
  export const PROFILES_HREF = '/profiles' as unknown as Href
11
- // One profile's Edit Profile screen: a profile's id, or @tastic/profile's NEW_PROFILE_ID ('new') for New Profile.
12
- export const profileHref = (id: string) => ({ pathname: '/profile/[id]', params: { id } }) as unknown as Href
14
+ // The roster, opened by a seat: its picker's Manage, or Settings' Profiles row for seat 1's guest. The seat rides along to New
15
+ // Profile, and the profile made there is picked for it (Jay, 2026-11-16 in HexFleet: a new profile is selected in the seat that
16
+ // went to make it).
17
+ export const profilesHref = (seat: Seat) => ({ pathname: '/profiles', params: { seat: String(seat) } }) as unknown as Href
18
+ // One profile's Edit Profile screen: a profile's id, or @tastic/profile's NEW_PROFILE_ID ('new') for New Profile, with the seat
19
+ // that opened the roster for a new one.
20
+ export const profileHref = (id: string, seat?: Seat | null) => ({ pathname: '/profile/[id]', params: seat ? { id, seat: String(seat) } : { id } }) as unknown as Href
21
+ // The seat a profiles route was opened for (its `seat` param), or null: none, or anything but 1 or 2.
22
+ export const seatParam = (value: string | string[] | undefined): Seat | null => (value === '1' ? 1 : value === '2' ? 2 : null)
@@ -6,6 +6,7 @@ import { useLocalSearchParams } from 'expo-router'
6
6
  import { useProfiles } from '../hooks/useProfiles'
7
7
  import { safeBack } from '../navigation'
8
8
  import { usePack } from '../PackContext'
9
+ import { seatParam } from '../routes'
9
10
  import { ROSTER_MAX_WIDTH } from './ProfilesRoute'
10
11
 
11
12
  // One profile's Edit Profile screen (@tastic/profile's EditProfileScreen), the pack's profile/[id]
@@ -18,14 +19,35 @@ import { ROSTER_MAX_WIDTH } from './ProfilesRoute'
18
19
  // pack's newProfileColor, or auto-paper's first swatch. Over a pack's Backdrop the screen is
19
20
  // transparent, drawn in the pack's foreground. A saved profile's screen also draws the pack's own
20
21
  // ProfileSections (its online play's, say) under Color.
22
+ //
23
+ // A new profile is picked for the seat that went to make it (the `seat` param, which Profiles passes on
24
+ // when a seat opened it): seat 1's Manage on Home or in a loadout, or Settings' Profiles row for seat
25
+ // 1's guest, so the player comes back to their new profile in their seat (Jay, 2026-11-16 in HexFleet;
26
+ // every pack since @tastic/shell 0.19.0). The newest made wins. Opened by no seat (the stats screen's
27
+ // Manage), or left without making one, it picks nothing.
21
28
  export function EditProfileRoute() {
22
- const { id } = useLocalSearchParams<{ id: string }>()
23
- const { profiles, createProfile, updateProfile, deleteProfile } = useProfiles()
29
+ const { id, seat } = useLocalSearchParams<{ id: string; seat?: string }>()
30
+ const opener = seatParam(seat)
31
+ const { profiles, createProfile, updateProfile, deleteProfile, selectProfile } = useProfiles()
24
32
  const { Backdrop, foreground, newProfileColor, ProfileSections } = usePack()
25
33
 
26
34
  return (
27
35
  <ScreenFrame portalHost maxContentWidth={ROSTER_MAX_WIDTH}>
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} />
36
+ <EditProfileScreen
37
+ profileId={id}
38
+ profiles={profiles}
39
+ defaultColor={newProfileColor ?? defaultColors[0].value}
40
+ onCreate={(patch) => {
41
+ const profile = createProfile(patch)
42
+ if (opener) selectProfile(opener, profile.id)
43
+ }}
44
+ onSave={(profileId, patch) => updateProfile(profileId, patch)}
45
+ onDelete={deleteProfile}
46
+ onBack={safeBack}
47
+ fg={foreground}
48
+ bg={Backdrop ? 'transparent' : undefined}
49
+ sections={ProfileSections ? (profile) => <ProfileSections profile={profile} /> : undefined}
50
+ />
29
51
  </ScreenFrame>
30
52
  )
31
53
  }
@@ -16,7 +16,7 @@ import { useOpponent } from '../hooks/useOpponent'
16
16
  import { useProfiles } from '../hooks/useProfiles'
17
17
  import { useSeatColors } from '../hooks/useSeatColors'
18
18
  import { usePack } from '../PackContext'
19
- import { loadoutHref, playHref, PROFILES_HREF, STATS_HREF } from '../routes'
19
+ import { loadoutHref, playHref, profilesHref, STATS_HREF } from '../routes'
20
20
  import type { HomeTab, PackGameDefinition } from '../types'
21
21
  import { HOME_GRID_GAP, HOME_LEFT_PANE_PICKER_GAP, HOME_TILE_PADDING, HOME_TOP_BAND, HOME_WIDE_PANE_GAP, PREVIEW_ASPECT, ROW_PREVIEW_WIDTH, useHomeLayout } from './homeLayout'
22
22
 
@@ -171,7 +171,7 @@ function HomeMenu() {
171
171
  const pickerAlign = usePickerAlign(pickerHost.openId === `${SEAT_ONE_PICKER}-profile`, pickerSize.width, pickerSize.height)
172
172
 
173
173
  // A pack can leave seat 1's button off Home (PackDefinition.homePlayerPicker)
174
- const picker = <ProfilePicker idPrefix={SEAT_ONE_PICKER} host={pickerHost} profiles={profiles} selectedId={lastSelected[1]} color={p1Drawn} dark={dark} guestLabel={pack.guestLabel ?? 'P1'} nullLabel={pack.nullLabel} onSelect={(profile: Profile | null) => selectProfile(1, profile?.id ?? null)} onManage={() => router.push(PROFILES_HREF)} colorSection={colorSection} alignOverride={pickerAlign} triggerStyle={triggerStyle} />
174
+ const picker = <ProfilePicker idPrefix={SEAT_ONE_PICKER} host={pickerHost} profiles={profiles} selectedId={lastSelected[1]} color={p1Drawn} dark={dark} guestLabel={pack.guestLabel ?? 'P1'} nullLabel={pack.nullLabel} onSelect={(profile: Profile | null) => selectProfile(1, profile?.id ?? null)} onManage={() => router.push(profilesHref(1))} colorSection={colorSection} alignOverride={pickerAlign} triggerStyle={triggerStyle} />
175
175
 
176
176
  // Closes seat 1's menu on a press anywhere but the menu and its button. Where it's mounted matters on
177
177
  // a phone, where zIndex only orders the children of one parent: the menu lives inside the scroller in
@@ -23,7 +23,7 @@ import { useSeatColors } from '../hooks/useSeatColors'
23
23
  import { safeBack } from '../navigation'
24
24
  import { usePack } from '../PackContext'
25
25
  import { liveplayActions } from '../redux/liveplaySlice'
26
- import { playHref, PROFILES_HREF } from '../routes'
26
+ import { playHref, profilesHref } from '../routes'
27
27
  import { humanSeatsFor, type PackGameDefinition, roundModeFor, type Seat, type SeatTwo, seatTwoFor } from '../types'
28
28
 
29
29
  // The player-panel area: whenever the window changes shape (a tablet turning, a browser window
@@ -183,7 +183,7 @@ export function LoadoutScreen({ game }: { game: LoadoutGame }) {
183
183
  const p1Control = loadout.seatControl(1, controlsHost, { ...controlLook, seatColor: p1Drawn })
184
184
  // Seat 1's button alone: player 1's controls and Ready sit under the row it shares with the
185
185
  // opponent button, centered under both.
186
- const p1Panel = <PlayerSetupPanel key={`p1-${layoutKey}`} idPrefix='p1' host={controlsHost} color={p1Color} onColorChange={handleP1ColorChange} swatches={defaultColors} takenColor={p2Exists ? p2Color : undefined} allowSwapTaken={mode === 'vsCpu'} colorCaption={pack.colorCaption} isHuman dark={dark} showReadyButton={false} profiles={profiles} selectedProfileId={lastSelected[1]} takenProfileId={p2IsHuman ? lastSelected[2] : null} guestLabel={pack.guestLabel ?? 'P1'} nullLabel={pack.nullLabel} onProfileSelect={handleP1ProfileSelect} onManageProfiles={() => router.push(PROFILES_HREF)} previewValue={seatPreview} triggerStyle={triggerStyle} useSeatPickerAlign={seatPickerAlign} />
186
+ const p1Panel = <PlayerSetupPanel key={`p1-${layoutKey}`} idPrefix='p1' host={controlsHost} color={p1Color} onColorChange={handleP1ColorChange} swatches={defaultColors} takenColor={p2Exists ? p2Color : undefined} allowSwapTaken={mode === 'vsCpu'} colorCaption={pack.colorCaption} isHuman dark={dark} showReadyButton={false} profiles={profiles} selectedProfileId={lastSelected[1]} takenProfileId={p2IsHuman ? lastSelected[2] : null} guestLabel={pack.guestLabel ?? 'P1'} nullLabel={pack.nullLabel} onProfileSelect={handleP1ProfileSelect} onManageProfiles={() => router.push(profilesHref(1))} previewValue={seatPreview} triggerStyle={triggerStyle} useSeatPickerAlign={seatPickerAlign} />
187
187
  // Who sits in seat 2, player 1's to pick in every mode. A game for one player (no seatTwo) has none:
188
188
  // seat 1's button stands alone.
189
189
  const opponentPicker = game.seatTwo && <OpponentPicker key={`opponent-${layoutKey}`} idPrefix='p1' host={controlsHost} choices={game.seatTwo} seatTwo={seatTwo} onSeatTwoChange={changeSeatTwo} cpuDifficulty={loadout.cpuDifficulty} color={p2Color} onColorChange={handleP2ColorChange} swatches={defaultColors} takenColor={p1Color} allowSwapTaken={mode === 'vsCpu'} dark={dark} previewValue={seatPreview} triggerStyle={triggerStyle} usePickerAlign={seatPickerAlign} />
@@ -1,30 +1,34 @@
1
1
  import { ScreenFrame } from '@tastic/hud/chrome'
2
- import { ProfilesScreen } from '@tastic/profile'
3
- import { router } from 'expo-router'
2
+ import { NEW_PROFILE_ID, ProfilesScreen } from '@tastic/profile'
3
+ import { router, useLocalSearchParams } from 'expo-router'
4
4
 
5
5
  import { useProfiles } from '../hooks/useProfiles'
6
6
  import { safeBack } from '../navigation'
7
7
  import { usePack } from '../PackContext'
8
- import { profileHref } from '../routes'
8
+ import { profileHref, seatParam } from '../routes'
9
9
 
10
10
  // Widest the roster and a profile's screen get in the wide layout (a landscape phone, a desktop
11
11
  // window). Upright they're never capped.
12
12
  export const ROSTER_MAX_WIDTH = 640
13
13
 
14
- // The Profiles screen (Manage, from either seat 1 button): @tastic/profile's roster. A profile opens
15
- // its own Edit Profile screen, the pack's profile/[id] route (EditProfileRoute), where profiles are
16
- // made, saved and deleted.
14
+ // The Profiles screen (Manage, from either seat 1 button, Settings' Profiles row for a guest and the
15
+ // stats screen): @tastic/profile's roster. A profile opens its own Edit Profile screen, the pack's
16
+ // profile/[id] route (EditProfileRoute), where profiles are made, saved and deleted. Opened by a seat
17
+ // (the `seat` param, routes.ts' profilesHref), New Profile carries the seat along, so the profile made
18
+ // there is picked for it.
17
19
  //
18
20
  // In hud's ScreenFrame: ProfilesManager reads the safe-area insets itself (the header's padding), and
19
21
  // the roster's column is capped in the wide layout. Over a pack's Backdrop the screen is transparent,
20
22
  // drawn in the pack's foreground.
21
23
  export function ProfilesRoute() {
24
+ const { seat } = useLocalSearchParams<{ seat?: string }>()
25
+ const opener = seatParam(seat)
22
26
  const { profiles } = useProfiles()
23
27
  const { Backdrop, foreground } = usePack()
24
28
 
25
29
  return (
26
30
  <ScreenFrame maxContentWidth={ROSTER_MAX_WIDTH}>
27
- <ProfilesScreen profiles={profiles} onEdit={(id) => router.push(profileHref(id))} onBack={safeBack} fg={foreground} bg={Backdrop ? 'transparent' : undefined} />
31
+ <ProfilesScreen profiles={profiles} onEdit={(id) => router.push(profileHref(id, id === NEW_PROFILE_ID ? opener : null))} onBack={safeBack} fg={foreground} bg={Backdrop ? 'transparent' : undefined} />
28
32
  </ScreenFrame>
29
33
  )
30
34
  }