@tastic/shell 0.15.0 → 0.16.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 +6 -3
- package/dist/index.d.mts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +33 -29
- package/dist/index.mjs +20 -16
- package/package.json +5 -5
- package/src/RootLayout.tsx +1 -1
- package/src/components/SettingsDialog.tsx +13 -2
- package/src/screens/EditProfileRoute.tsx +4 -3
- package/src/screens/HomeScreen.tsx +1 -1
- package/src/screens/LoadoutScreen.tsx +1 -1
- package/src/types.ts +5 -0
package/README.md
CHANGED
|
@@ -140,6 +140,7 @@ 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. |
|
|
@@ -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)
|
|
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.
|
|
400
|
-
| `@tastic/profile` | >=0.
|
|
402
|
+
| `@tastic/hud` | >=0.37.0 | Settings, the stats screen, the loadout's panels (its Skia-free `/lobby` entry, new in 0.26.0; 0.27.1's options for a pack drawn on its own backdrop; 0.28.0's Ready pill; 0.29.0's leading Settings sections), How to Play, and `ScreenFrame` around the stats screen, Profiles, Edit Profile and the toaster (0.34.0, where `RotatedFrame` became `ScreenFrame`), a pack's lettering (0.35.0's `LetteringProvider`), Settings' Profile row (0.37.0's `profilesRow`) |
|
|
403
|
+
| `@tastic/profile` | >=0.25.0 | profiles and the shared roster, the seat buttons, seat colors, the dividers in player 1's opponent menu (0.18.0's `dividerBefore`), and each profile's Edit Profile screen (0.22.0's `EditProfileScreen`, behind `EditProfileRoute`, with a pack's sections from 0.25.0) |
|
|
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';
|
|
@@ -309,6 +309,9 @@ interface PackDefinition {
|
|
|
309
309
|
resetStats?: PackStatsReset;
|
|
310
310
|
statsGameTitles?: boolean;
|
|
311
311
|
newProfileColor?: string;
|
|
312
|
+
ProfileSections?: ComponentType<{
|
|
313
|
+
profile: Profile;
|
|
314
|
+
}>;
|
|
312
315
|
usePickerAlign?: PickerAlign;
|
|
313
316
|
}
|
|
314
317
|
type PickerAlign = (open: boolean, contentWidth: number, contentHeight: number) => AlignResult;
|
|
@@ -431,9 +434,10 @@ interface SettingsDialogProps {
|
|
|
431
434
|
visible: boolean;
|
|
432
435
|
onDismiss: () => void;
|
|
433
436
|
onShowHowToPlay?: () => void;
|
|
437
|
+
showProfile?: boolean;
|
|
434
438
|
children?: ReactNode;
|
|
435
439
|
}
|
|
436
|
-
declare function SettingsDialog({ visible, onDismiss, onShowHowToPlay, children }: SettingsDialogProps): react.JSX.Element;
|
|
440
|
+
declare function SettingsDialog({ visible, onDismiss, onShowHowToPlay, showProfile, children }: SettingsDialogProps): react.JSX.Element;
|
|
437
441
|
|
|
438
442
|
declare function useActiveRound<S extends object>(game: string, defaults: S): {
|
|
439
443
|
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';
|
|
@@ -309,6 +309,9 @@ interface PackDefinition {
|
|
|
309
309
|
resetStats?: PackStatsReset;
|
|
310
310
|
statsGameTitles?: boolean;
|
|
311
311
|
newProfileColor?: string;
|
|
312
|
+
ProfileSections?: ComponentType<{
|
|
313
|
+
profile: Profile;
|
|
314
|
+
}>;
|
|
312
315
|
usePickerAlign?: PickerAlign;
|
|
313
316
|
}
|
|
314
317
|
type PickerAlign = (open: boolean, contentWidth: number, contentHeight: number) => AlignResult;
|
|
@@ -431,9 +434,10 @@ interface SettingsDialogProps {
|
|
|
431
434
|
visible: boolean;
|
|
432
435
|
onDismiss: () => void;
|
|
433
436
|
onShowHowToPlay?: () => void;
|
|
437
|
+
showProfile?: boolean;
|
|
434
438
|
children?: ReactNode;
|
|
435
439
|
}
|
|
436
|
-
declare function SettingsDialog({ visible, onDismiss, onShowHowToPlay, children }: SettingsDialogProps): react.JSX.Element;
|
|
440
|
+
declare function SettingsDialog({ visible, onDismiss, onShowHowToPlay, showProfile, children }: SettingsDialogProps): react.JSX.Element;
|
|
437
441
|
|
|
438
442
|
declare function useActiveRound<S extends object>(game: string, defaults: S): {
|
|
439
443
|
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:
|
|
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
|
|
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
|
|
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
|
|
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,
|
|
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,
|
|
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
|
-
|
|
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: () =>
|
|
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,
|
|
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)(
|
|
1069
|
-
if (!hasLoadout(game)) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
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,
|
|
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)(
|
|
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
|
|
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)(
|
|
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,
|
|
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, () =>
|
|
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: () =>
|
|
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: () =>
|
|
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
|
|
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");
|
|
@@ -1574,7 +1578,7 @@ function StatsContent({ pickerHost }) {
|
|
|
1574
1578
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_chrome8.PressAwayOverlay, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles5.pressAway }),
|
|
1575
1579
|
/* @__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
1580
|
/* @__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 ?
|
|
1581
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_profile10.OptionPicker, { id: PLAYER_PICKER_ID, host: pickerHost, options: playerOptions, value: profileId ?? EVERYONE, onChange: (value) => value === MANAGE ? import_expo_router10.router.push(PROFILES_HREF) : setSelectedProfileId(value === EVERYONE ? null : value), color: colors.primary, dark, icon: profileId ? "account" : "account-group", alignOverride: playerAlign, triggerStyle }),
|
|
1578
1582
|
showGamePicker && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_profile10.OptionPicker, { id: GAME_PICKER_ID, host: pickerHost, options: gameOptions, value: gameId, onChange: setGameId, color: colors.primary, dark, icon: "view-grid-outline", alignOverride: gameAlign, triggerStyle })
|
|
1579
1583
|
] }),
|
|
1580
1584
|
tab === STATS && pack.StatsSections && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(pack.StatsSections, { profileId, gameId: gameId === ALL_GAMES ? null : gameId }),
|
|
@@ -1691,7 +1695,7 @@ function useActiveRound(game, defaults) {
|
|
|
1691
1695
|
}
|
|
1692
1696
|
|
|
1693
1697
|
// src/hooks/useBackBlock.ts
|
|
1694
|
-
var
|
|
1698
|
+
var import_expo_router11 = require("expo-router");
|
|
1695
1699
|
var import_react19 = require("react");
|
|
1696
1700
|
function useBackBlock(held, onHeld, leave = import_core6.safeBack) {
|
|
1697
1701
|
const leavingRef = (0, import_react19.useRef)(false);
|
|
@@ -1700,7 +1704,7 @@ function useBackBlock(held, onHeld, leave = import_core6.safeBack) {
|
|
|
1700
1704
|
(0, import_react19.useEffect)(() => {
|
|
1701
1705
|
leaveRef.current = leave;
|
|
1702
1706
|
});
|
|
1703
|
-
(0,
|
|
1707
|
+
(0, import_expo_router11.usePreventRemove)(held && !leaving, ({ repeat }) => {
|
|
1704
1708
|
if (leavingRef.current) {
|
|
1705
1709
|
setLeaving(true);
|
|
1706
1710
|
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:
|
|
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
|
|
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
|
-
|
|
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: () =>
|
|
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
|
|
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, () =>
|
|
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: () =>
|
|
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: () =>
|
|
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
|
|
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";
|
|
@@ -1495,7 +1499,7 @@ function StatsContent({ pickerHost }) {
|
|
|
1495
1499
|
/* @__PURE__ */ jsx18(PressAwayOverlay3, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles5.pressAway }),
|
|
1496
1500
|
/* @__PURE__ */ jsx18(SegmentedButtons2, { value: tab, onValueChange: setTab, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles5.tabs, surface] }),
|
|
1497
1501
|
/* @__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 ?
|
|
1502
|
+
/* @__PURE__ */ jsx18(OptionPicker2, { id: PLAYER_PICKER_ID, host: pickerHost, options: playerOptions, value: profileId ?? EVERYONE, onChange: (value) => value === MANAGE ? router6.push(PROFILES_HREF) : setSelectedProfileId(value === EVERYONE ? null : value), color: colors.primary, dark, icon: profileId ? "account" : "account-group", alignOverride: playerAlign, triggerStyle }),
|
|
1499
1503
|
showGamePicker && /* @__PURE__ */ jsx18(OptionPicker2, { id: GAME_PICKER_ID, host: pickerHost, options: gameOptions, value: gameId, onChange: setGameId, color: colors.primary, dark, icon: "view-grid-outline", alignOverride: gameAlign, triggerStyle })
|
|
1500
1504
|
] }),
|
|
1501
1505
|
tab === STATS && pack.StatsSections && /* @__PURE__ */ jsx18(pack.StatsSections, { profileId, gameId: gameId === ALL_GAMES ? null : gameId }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tastic/shell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.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.
|
|
90
|
-
"@tastic/profile": "^0.
|
|
89
|
+
"@tastic/hud": "^0.37.0",
|
|
90
|
+
"@tastic/profile": "^0.25.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.
|
|
142
|
-
"@tastic/profile": ">=0.
|
|
141
|
+
"@tastic/hud": ">=0.37.0",
|
|
142
|
+
"@tastic/profile": ">=0.25.0",
|
|
143
143
|
"@tastic/split-screen": ">=0.5.5",
|
|
144
144
|
"expo-audio": ">=58.0.11",
|
|
145
145
|
"expo-blur": ">=58.0.4",
|
package/src/RootLayout.tsx
CHANGED
|
@@ -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={
|
|
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
|
}
|
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'
|
|
@@ -386,6 +387,10 @@ export interface PackDefinition {
|
|
|
386
387
|
statsGameTitles?: boolean
|
|
387
388
|
// A new profile's starting color on its Edit Profile screen. Unset is auto-paper's first swatch.
|
|
388
389
|
newProfileColor?: string
|
|
390
|
+
// The pack's own sections on a saved profile's Edit Profile screen (EditProfileRoute), under Color and above Delete Profile: its
|
|
391
|
+
// online play's, say (@tastic/profile/online's ProfileOnlineSection), which is where a profile's online life lives (Jay,
|
|
392
|
+
// 2026-11-20). Drawn in the screen's own colors (@tastic/profile's EditProfileSection and EditProfileRow).
|
|
393
|
+
ProfileSections?: ComponentType<{ profile: Profile }>
|
|
389
394
|
// Where a picker's menu opens (its alignOverride) on Home (seat 1's button), a loadout's one-human row
|
|
390
395
|
// (both seat buttons; 2 Player keeps each menu in its own player's half) and the stats screen (its two
|
|
391
396
|
// pickers). It was added because hud's own placement measured a button in a frame turned by
|