@tastic/shell 0.17.1 → 0.18.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 +3 -2
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +38 -16
- package/dist/index.mjs +34 -12
- package/package.json +1 -1
- package/src/screens/GameRoute.tsx +8 -2
- package/src/screens/LoadoutScreen.tsx +38 -4
- package/src/types.ts +12 -0
package/README.md
CHANGED
|
@@ -182,8 +182,9 @@ settings for the round `mode` seat 2 makes:
|
|
|
182
182
|
| Field | |
|
|
183
183
|
| --- | --- |
|
|
184
184
|
| `roundSettings` | The settings the round plays with, committed (liveplay's `activeRound.settings`) once every human seat is Ready. The play screen reads them back with `useActiveRound`. |
|
|
185
|
-
| `options` | `(props: LoadoutOptionsProps) => ReactNode`: the match-options row (board, rules, puck), drawn under the loadout's popover `host` in its colors (`accentColor`, `mutedColor`, `onAccentColor`, `dark`). `onRandomize` and `onReset` are undefined while the loadout folds them into its shared action band. |
|
|
186
|
-
| `placesSeats?` | With one person the seat buttons sit under `options`, over Ready. `true` passes them to `options` as `seats` instead, so a game can put them where it likes (CardTastic:
|
|
185
|
+
| `options` | `(props: LoadoutOptionsProps) => ReactNode`: the match-options row (board, rules, puck), drawn under the loadout's popover `host` in its colors (`accentColor`, `mutedColor`, `onAccentColor`, `dark`). `onRandomize` and `onReset` are undefined while the loadout folds them into its shared action band. `titleShown` says whether the loadout's header already names the game (beside Back, as the stats screen's title): everywhere but 2 Player face to face, whose back and settings fold into the band between the players, so a game that names itself among its options does so only when it's false. |
|
|
186
|
+
| `placesSeats?` | With one person the seat buttons sit under `options`, over Ready. `true` passes them to `options` as `seats` instead, so a game can put them where it likes (CardTastic: first, above its Daily Deal and rules). 2 Player's seats stay in each person's half. |
|
|
187
|
+
| `drawsReady?` | With one person Ready sits under `options` (and the seat buttons). `true` draws no Ready and passes `options` an `onReady` that starts the round, for a game that starts it from a control of its own (CardTastic's solitaire games: a New Deal or Continue row in a card, as their Daily Deal's). 2 Player's Ready buttons stay in each person's half. |
|
|
187
188
|
| `optionIds` | The popover ids the options row opens, so the loadout lifts the row while one is open. |
|
|
188
189
|
| `randomize`, `reset` | The loadout's randomize and reset buttons. |
|
|
189
190
|
| `seatControl` | `(seat, host, look) => ReactNode \| undefined`: a human seat's controls picker (shot style, keys) in `look`'s colors (`SeatControlLook`: `accentColor`, `seatColor`, `mutedColor`, `dark`), or undefined where the game has none. |
|
package/dist/index.d.mts
CHANGED
|
@@ -141,6 +141,8 @@ interface LoadoutOptionsProps {
|
|
|
141
141
|
onRandomize?: () => void;
|
|
142
142
|
onReset?: () => void;
|
|
143
143
|
seats?: ReactNode;
|
|
144
|
+
onReady?: () => void;
|
|
145
|
+
titleShown: boolean;
|
|
144
146
|
}
|
|
145
147
|
interface SeatControlLook {
|
|
146
148
|
accentColor: string;
|
|
@@ -152,6 +154,7 @@ interface GameLoadout {
|
|
|
152
154
|
roundSettings: object;
|
|
153
155
|
options: (props: LoadoutOptionsProps) => ReactNode;
|
|
154
156
|
placesSeats?: boolean;
|
|
157
|
+
drawsReady?: boolean;
|
|
155
158
|
optionIds: readonly string[];
|
|
156
159
|
randomize: () => void;
|
|
157
160
|
reset: () => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -141,6 +141,8 @@ interface LoadoutOptionsProps {
|
|
|
141
141
|
onRandomize?: () => void;
|
|
142
142
|
onReset?: () => void;
|
|
143
143
|
seats?: ReactNode;
|
|
144
|
+
onReady?: () => void;
|
|
145
|
+
titleShown: boolean;
|
|
144
146
|
}
|
|
145
147
|
interface SeatControlLook {
|
|
146
148
|
accentColor: string;
|
|
@@ -152,6 +154,7 @@ interface GameLoadout {
|
|
|
152
154
|
roundSettings: object;
|
|
153
155
|
options: (props: LoadoutOptionsProps) => ReactNode;
|
|
154
156
|
placesSeats?: boolean;
|
|
157
|
+
drawsReady?: boolean;
|
|
155
158
|
optionIds: readonly string[];
|
|
156
159
|
randomize: () => void;
|
|
157
160
|
reset: () => void;
|
package/dist/index.js
CHANGED
|
@@ -630,6 +630,7 @@ var import_split_screen = require("@tastic/split-screen");
|
|
|
630
630
|
var import_expo_router7 = require("expo-router");
|
|
631
631
|
var import_react13 = require("react");
|
|
632
632
|
var import_react_native6 = require("react-native");
|
|
633
|
+
var import_react_native_paper = require("react-native-paper");
|
|
633
634
|
var import_react_native_reanimated2 = __toESM(require("react-native-reanimated"));
|
|
634
635
|
var import_react_native_safe_area_context3 = require("react-native-safe-area-context");
|
|
635
636
|
var import_react_redux9 = require("react-redux");
|
|
@@ -868,6 +869,10 @@ var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
|
868
869
|
var PANEL_SWAP_FADE_MS = 180;
|
|
869
870
|
var P1_CONTROL_ID = "p1-control";
|
|
870
871
|
var P2_CONTROL_ID = "p2-control";
|
|
872
|
+
var HEADER_TOP = 8;
|
|
873
|
+
var HEADER_ROW_HEIGHT = 52;
|
|
874
|
+
var HEADER_TITLE_LEFT = 64;
|
|
875
|
+
var HEADER_TITLE_RIGHT = 60;
|
|
871
876
|
function LoadoutScreen({ game }) {
|
|
872
877
|
const pack = usePack();
|
|
873
878
|
const { seatTwo: savedSeatTwo, setSeatTwo } = useOpponent();
|
|
@@ -887,6 +892,7 @@ function LoadoutScreen({ game }) {
|
|
|
887
892
|
const playersRowFade = panelFadeStyle;
|
|
888
893
|
const [settingsOpen, setSettingsOpen] = (0, import_react13.useState)(false);
|
|
889
894
|
const insets = (0, import_react_native_safe_area_context3.useSafeAreaInsets)();
|
|
895
|
+
const { title: lettering } = (0, import_chrome6.useLettering)();
|
|
890
896
|
const { colors: themeColors, dark } = (0, import_auto_paper5.useAutoPaperTheme)();
|
|
891
897
|
const { p1Color, p2Color, handleP1ColorChange, handleP2ColorChange } = useSeatColors(p2IsHuman);
|
|
892
898
|
const dispatch = (0, import_react_redux9.useDispatch)();
|
|
@@ -937,6 +943,7 @@ function LoadoutScreen({ game }) {
|
|
|
937
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}`);
|
|
938
944
|
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}`);
|
|
939
945
|
const toggleP1Ready = () => setReady((r) => ({ ...r, 1: !r[1] }));
|
|
946
|
+
const readyInOptions = !p2IsHuman && !!loadout.drawsReady;
|
|
940
947
|
const seatButtons = /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native6.View, { style: [styles3.seatOneButtons, p1PickerOpen && styles3.raised], children: [
|
|
941
948
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native_reanimated2.default.View, { style: [styles3.playersRow, p1PickerOpen && styles3.raised, !p2IsHuman && playersRowFade], children: [
|
|
942
949
|
p1Panel,
|
|
@@ -947,7 +954,7 @@ function LoadoutScreen({ game }) {
|
|
|
947
954
|
const seatsInOptions = !p2IsHuman && !!loadout.placesSeats;
|
|
948
955
|
const seatOne = /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native6.View, { style: [styles3.seatOne, !p2IsHuman && styles3.seatOneAlone, p1PickerOpen && !seatsInOptions && styles3.raised], children: [
|
|
949
956
|
!seatsInOptions && seatButtons,
|
|
950
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lobby2.ReadyButton, { color: p1Drawn, ready: ready[1], onToggleReady: toggleP1Ready, surfaceColor: readySurface, dark, style: !p2IsHuman && p1PickerOpen && styles3.readyButtonHidden })
|
|
957
|
+
!readyInOptions && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lobby2.ReadyButton, { color: p1Drawn, ready: ready[1], onToggleReady: toggleP1Ready, surfaceColor: readySurface, dark, style: !p2IsHuman && p1PickerOpen && styles3.readyButtonHidden })
|
|
951
958
|
] });
|
|
952
959
|
const optionsRow = loadout.options({
|
|
953
960
|
host: controlsHost,
|
|
@@ -956,6 +963,8 @@ function LoadoutScreen({ game }) {
|
|
|
956
963
|
onAccentColor: themeColors.onTertiary,
|
|
957
964
|
dark,
|
|
958
965
|
seats: seatsInOptions ? seatButtons : void 0,
|
|
966
|
+
onReady: readyInOptions ? () => setReady((r) => ({ ...r, 1: true })) : void 0,
|
|
967
|
+
titleShown: !showMetaInSharedBand,
|
|
959
968
|
// Left out (the row's own actions unrendered) whenever the shared band below carries them.
|
|
960
969
|
onRandomize: showMetaInSharedBand ? void 0 : loadout.randomize,
|
|
961
970
|
onReset: showMetaInSharedBand ? void 0 : loadout.reset
|
|
@@ -965,10 +974,11 @@ function LoadoutScreen({ game }) {
|
|
|
965
974
|
const p2Control = p2IsHuman ? loadout.seatControl(2, p2Host, { ...controlLook, seatColor: p2Drawn }) : void 0;
|
|
966
975
|
const p2Panel = p2IsHuman && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lobby2.PlayerSetupPanel, { idPrefix: "p2", host: p2Host, color: p2Color, onColorChange: handleP2ColorChange, swatches: import_auto_paper5.defaultColors, takenColor: p1Color, colorCaption: pack.colorCaption, isHuman: true, ready: ready[2], onToggleReady: () => setReady((r) => ({ ...r, 2: !r[2] })), dark, secondPicker: p2Control, secondPickerId: p2Control ? P2_CONTROL_ID : void 0, profiles, selectedProfileId: lastSelected[2], takenProfileId: lastSelected[1], guestLabel: pack.guestLabel ?? "P2", nullLabel: pack.nullLabel, onProfileSelect: handleP2ProfileSelect, previewValue: seatPreview, triggerStyle, readySurfaceColor: readySurface }, "p2-zones");
|
|
967
976
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native6.View, { style: [styles3.container, { backgroundColor: bg }], children: [
|
|
968
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native6.View, { style: styles3.frame, children: [
|
|
977
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native6.View, { style: [styles3.frame, !showMetaInSharedBand && { paddingTop: HEADER_TOP + HEADER_ROW_HEIGHT + insets.top }], children: [
|
|
969
978
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_chrome6.PressAwayOverlay, { active: controlsHost.openId !== null, onPress: controlsHost.close }),
|
|
970
979
|
p2ZoneStyle && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_chrome6.PressAwayOverlay, { active: controlsHost.openId !== null || p2Host.openId !== null, onPress: p2Host.close, style: p2ZoneStyle }),
|
|
971
980
|
!showMetaInSharedBand && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_chrome6.CornerActionButtons, { onBack: import_core6.safeBack, onSettings: () => setSettingsOpen(true), fg, insets }),
|
|
981
|
+
!showMetaInSharedBand && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native6.View, { style: [styles3.headerTitle, { top: HEADER_TOP + insets.top, left: HEADER_TITLE_LEFT + insets.left, right: HEADER_TITLE_RIGHT + insets.right }], pointerEvents: "none", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native_paper.Text, { variant: "headlineSmall", numberOfLines: 1, accessibilityRole: "header", style: [styles3.title, { color: fg }, lettering], children: game.title }) }),
|
|
972
982
|
p2IsHuman ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
973
983
|
import_split_screen.DualZoneLayout,
|
|
974
984
|
{
|
|
@@ -983,7 +993,7 @@ function LoadoutScreen({ game }) {
|
|
|
983
993
|
}
|
|
984
994
|
) : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native6.View, { style: styles3.stackedZone, children: [
|
|
985
995
|
seatsInOptions ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native6.View, { style: p1PickerOpen && styles3.raised, children: sharedControls }) : sharedControls,
|
|
986
|
-
seatOne
|
|
996
|
+
!(seatsInOptions && readyInOptions) && seatOne
|
|
987
997
|
] })
|
|
988
998
|
] }),
|
|
989
999
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SettingsDialog, { visible: settingsOpen, onDismiss: () => setSettingsOpen(false), onShowHowToPlay: () => openFor(game.id), showProfile: true })
|
|
@@ -1011,6 +1021,11 @@ var styles3 = import_react_native6.StyleSheet.create({
|
|
|
1011
1021
|
justifyContent: "center",
|
|
1012
1022
|
paddingHorizontal: 16
|
|
1013
1023
|
},
|
|
1024
|
+
headerTitle: {
|
|
1025
|
+
height: HEADER_ROW_HEIGHT,
|
|
1026
|
+
justifyContent: "center",
|
|
1027
|
+
position: "absolute"
|
|
1028
|
+
},
|
|
1014
1029
|
p2ZoneRight: {
|
|
1015
1030
|
bottom: 0,
|
|
1016
1031
|
position: "absolute",
|
|
@@ -1063,6 +1078,10 @@ var styles3 = import_react_native6.StyleSheet.create({
|
|
|
1063
1078
|
stackedZone: {
|
|
1064
1079
|
alignItems: "center",
|
|
1065
1080
|
gap: 28
|
|
1081
|
+
},
|
|
1082
|
+
// hud's BaseStatsScreen title: the stats screen's header, in the pack's title lettering.
|
|
1083
|
+
title: {
|
|
1084
|
+
fontWeight: "bold"
|
|
1066
1085
|
}
|
|
1067
1086
|
});
|
|
1068
1087
|
|
|
@@ -1086,13 +1105,16 @@ function PlayRoute() {
|
|
|
1086
1105
|
const { PlayScreen } = game;
|
|
1087
1106
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(PlayScreen, {}, game.id);
|
|
1088
1107
|
}
|
|
1108
|
+
var playScreensUp = 0;
|
|
1089
1109
|
function useResumePoint(gameId) {
|
|
1090
1110
|
const { setLastActiveGame, clearLastActiveGame } = useLastActiveGame();
|
|
1091
1111
|
(0, import_react14.useEffect)(() => {
|
|
1092
1112
|
if (!gameId) return;
|
|
1113
|
+
playScreensUp += 1;
|
|
1093
1114
|
setLastActiveGame(gameId);
|
|
1094
1115
|
return () => {
|
|
1095
|
-
|
|
1116
|
+
playScreensUp -= 1;
|
|
1117
|
+
if (playScreensUp === 0 && import_react_native7.AppState.currentState === "active") clearLastActiveGame();
|
|
1096
1118
|
};
|
|
1097
1119
|
}, [gameId, setLastActiveGame, clearLastActiveGame]);
|
|
1098
1120
|
}
|
|
@@ -1105,7 +1127,7 @@ var import_profile9 = require("@tastic/profile");
|
|
|
1105
1127
|
var import_expo_router9 = require("expo-router");
|
|
1106
1128
|
var import_react16 = require("react");
|
|
1107
1129
|
var import_react_native9 = require("react-native");
|
|
1108
|
-
var
|
|
1130
|
+
var import_react_native_paper2 = require("react-native-paper");
|
|
1109
1131
|
|
|
1110
1132
|
// src/components/segmentTheme.ts
|
|
1111
1133
|
var SEGMENT_THEME = { roundness: 3.8 };
|
|
@@ -1264,7 +1286,7 @@ function HomeMenu() {
|
|
|
1264
1286
|
const [tabLabel, setTabLabel] = (0, import_react16.useState)(() => tabs?.[0].label ?? null);
|
|
1265
1287
|
const tab = tabs ? tabs.find((t) => t.label === tabLabel) ?? tabs[0] : null;
|
|
1266
1288
|
const tabButtons = (0, import_react16.useMemo)(() => tabs?.map(({ label }) => ({ value: label, label, labelStyle: pack.labelStyle })) ?? [], [tabs, pack.labelStyle]);
|
|
1267
|
-
const tabBar = tab && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1289
|
+
const tabBar = tab && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper2.SegmentedButtons, { value: tab.label, onValueChange: setTabLabel, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles4.tabs, pack.Backdrop && { backgroundColor: colors.surface }] });
|
|
1268
1290
|
const columnClamp = useClampOnShrink();
|
|
1269
1291
|
const gridClamp = useClampOnShrink();
|
|
1270
1292
|
const openGame = (0, import_react16.useCallback)((game) => openFirstTime(game.id, () => import_expo_router9.router.push(game.useLoadout ? loadoutHref(game.id) : playHref(game.id))), [openFirstTime]);
|
|
@@ -1336,7 +1358,7 @@ function hasRules(game) {
|
|
|
1336
1358
|
return !!(game.Rules || game.guide);
|
|
1337
1359
|
}
|
|
1338
1360
|
function RulesHost({ enabled, children }) {
|
|
1339
|
-
return enabled ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1361
|
+
return enabled ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper2.Portal.Host, { children }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_jsx_runtime17.Fragment, { children });
|
|
1340
1362
|
}
|
|
1341
1363
|
var ROW_BLURB_LINES = 3;
|
|
1342
1364
|
function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPress, onRules }) {
|
|
@@ -1350,11 +1372,11 @@ function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPres
|
|
|
1350
1372
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_feedback_press3.Pressable, { onPress, style: [styles4.row, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
|
|
1351
1373
|
game.Preview ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PreviewBox, { game, width: ROW_PREVIEW_WIDTH, revealed: previewRevealed, dark, p1Color, p2Color }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native9.View, { style: [styles4.rowIcon, { backgroundColor: dark ? ICON_DARK_BG : ICON_LIGHT_BG }], children: GameIcon && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(GameIcon, { size: ROW_ICON_SIZE, p1Color, p2Color, dark }) }),
|
|
1352
1374
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native9.View, { style: styles4.rowText, children: [
|
|
1353
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1354
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1375
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper2.Text, { variant: "titleLarge", style: [styles4.rowTitle, { color: well.fg }, titleStyle], numberOfLines: 1, children: game.title }),
|
|
1376
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper2.Text, { variant: "bodyMedium", style: { color: well.fgMuted }, numberOfLines: ROW_BLURB_LINES, children: game.blurb })
|
|
1355
1377
|
] })
|
|
1356
1378
|
] }),
|
|
1357
|
-
onRules && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_feedback_press3.Pressable, { onPress: onRules, style: styles4.rulesButton, hitSlop: 12, accessibilityRole: "button", accessibilityLabel: `${game.title} rules`, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1379
|
+
onRules && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_feedback_press3.Pressable, { onPress: onRules, style: styles4.rulesButton, hitSlop: 12, accessibilityRole: "button", accessibilityLabel: `${game.title} rules`, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper2.Icon, { source: "information-outline", size: 22, color: well.fgMuted }) })
|
|
1358
1380
|
] })
|
|
1359
1381
|
);
|
|
1360
1382
|
}
|
|
@@ -1364,10 +1386,10 @@ function GameTile({ game, hidden, width, previewWidth, dark, p1Color, p2Color, p
|
|
|
1364
1386
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native9.View, { style: [{ width }, hidden && styles4.hidden], children: [
|
|
1365
1387
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_feedback_press3.Pressable, { onPress, style: [styles4.tile, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
|
|
1366
1388
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PreviewBox, { game, width: previewWidth, revealed: previewRevealed, dark, p1Color, p2Color }),
|
|
1367
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1368
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1389
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper2.Text, { variant: "titleMedium", style: [styles4.rowTitle, { color: well.fg }, titleStyle], numberOfLines: 1, children: game.title }),
|
|
1390
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper2.Text, { variant: "bodySmall", style: { color: well.fgMuted }, numberOfLines: 3, children: game.blurb })
|
|
1369
1391
|
] }),
|
|
1370
|
-
onRules && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_feedback_press3.Pressable, { onPress: onRules, style: styles4.tileRulesButton, hitSlop: 12, accessibilityRole: "button", accessibilityLabel: `${game.title} rules`, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1392
|
+
onRules && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_feedback_press3.Pressable, { onPress: onRules, style: styles4.tileRulesButton, hitSlop: 12, accessibilityRole: "button", accessibilityLabel: `${game.title} rules`, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper2.Icon, { source: "information-outline", size: 20, color: "#FFFFFF" }) })
|
|
1371
1393
|
] });
|
|
1372
1394
|
}
|
|
1373
1395
|
function PreviewBox({ game, width, revealed, dark, p1Color, p2Color }) {
|
|
@@ -1530,7 +1552,7 @@ var import_profile10 = require("@tastic/profile");
|
|
|
1530
1552
|
var import_expo_router10 = require("expo-router");
|
|
1531
1553
|
var import_react17 = require("react");
|
|
1532
1554
|
var import_react_native10 = require("react-native");
|
|
1533
|
-
var
|
|
1555
|
+
var import_react_native_paper3 = require("react-native-paper");
|
|
1534
1556
|
var import_react_native_safe_area_context5 = require("react-native-safe-area-context");
|
|
1535
1557
|
var import_react_redux10 = require("react-redux");
|
|
1536
1558
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
@@ -1607,7 +1629,7 @@ function StatsContent({ pickerHost }) {
|
|
|
1607
1629
|
const PackTabContent = packTab?.Content;
|
|
1608
1630
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_chrome8.BaseStatsScreen, { title, titleStyle: pack.titleStyle, onBack: import_core6.safeBack, insets, onReset: reset.onReset, resetLabel: reset.label, resetConfirmTitle: reset.title, resetConfirmBody: reset.body, fg: pack.foreground, bg: pack.Backdrop ? "transparent" : void 0, children: [
|
|
1609
1631
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_chrome8.PressAwayOverlay, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles5.pressAway }),
|
|
1610
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1632
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native_paper3.SegmentedButtons, { value: tab, onValueChange: setTab, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles5.tabs, surface] }),
|
|
1611
1633
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native10.View, { style: [styles5.filters, pickerHost.openId !== null && styles5.filtersOpen], onStartShouldSetResponder: () => pickerHost.openId !== null, children: [
|
|
1612
1634
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_profile10.OptionPicker, { id: PLAYER_PICKER_ID, host: pickerHost, options: playerOptions, value: profileId ?? EVERYONE, onChange: (value) => value === MANAGE ? import_expo_router10.router.push(PROFILES_HREF) : setSelectedProfileId(value === EVERYONE ? null : value), color: colors.primary, dark, icon: profileId ? "account" : "account-group", caption: "Player", alignOverride: playerAlign, triggerStyle }),
|
|
1613
1635
|
showGamePicker && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_profile10.OptionPicker, { id: GAME_PICKER_ID, host: pickerHost, options: gameOptions, value: gameId, onChange: setGameId, color: colors.primary, dark, icon: "view-grid-outline", caption: "Game", alignOverride: gameAlign, triggerStyle })
|
|
@@ -1631,7 +1653,7 @@ function GameStats({ game, tab, profileId, showTitle, titleColor }) {
|
|
|
1631
1653
|
const Sections = tab === STATS ? StatsSections : AchievementList;
|
|
1632
1654
|
if (!Sections) return null;
|
|
1633
1655
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native10.View, { style: styles5.game, children: [
|
|
1634
|
-
showTitle && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1656
|
+
showTitle && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native_paper3.Text, { variant: "titleLarge", style: [styles5.gameTitle, { color: titleColor }, titleStyle], children: game.title }),
|
|
1635
1657
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Sections, { profileId })
|
|
1636
1658
|
] });
|
|
1637
1659
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -545,12 +545,13 @@ import { AppState } from "react-native";
|
|
|
545
545
|
// src/screens/LoadoutScreen.tsx
|
|
546
546
|
import { defaultColors as defaultColors2, getRgb, useAutoPaperTheme as useAutoPaperTheme3 } from "@rific/auto-paper";
|
|
547
547
|
import { useOrientationState } from "@tastic/core";
|
|
548
|
-
import { CornerActionButtons, PressAwayOverlay, usePopoverHost } from "@tastic/hud/chrome";
|
|
548
|
+
import { CornerActionButtons, PressAwayOverlay, useLettering, usePopoverHost } from "@tastic/hud/chrome";
|
|
549
549
|
import { PlayerSetupPanel, ReadyButton, SharedActionBand } from "@tastic/hud/lobby";
|
|
550
550
|
import { DualZoneLayout, needsSharedNeutralZone, useDualZoneLayout } from "@tastic/split-screen";
|
|
551
551
|
import { router as router4, useFocusEffect as useFocusEffect2 } from "expo-router";
|
|
552
552
|
import { useCallback as useCallback9, useEffect as useEffect4, useMemo as useMemo5, useRef as useRef4, useState as useState4 } from "react";
|
|
553
553
|
import { StyleSheet as StyleSheet3, View as View3 } from "react-native";
|
|
554
|
+
import { Text } from "react-native-paper";
|
|
554
555
|
import Animated from "react-native-reanimated";
|
|
555
556
|
import { useSafeAreaInsets as useSafeAreaInsets2 } from "react-native-safe-area-context";
|
|
556
557
|
import { useDispatch as useDispatch9 } from "react-redux";
|
|
@@ -789,6 +790,10 @@ import { jsx as jsx15, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
|
789
790
|
var PANEL_SWAP_FADE_MS = 180;
|
|
790
791
|
var P1_CONTROL_ID = "p1-control";
|
|
791
792
|
var P2_CONTROL_ID = "p2-control";
|
|
793
|
+
var HEADER_TOP = 8;
|
|
794
|
+
var HEADER_ROW_HEIGHT = 52;
|
|
795
|
+
var HEADER_TITLE_LEFT = 64;
|
|
796
|
+
var HEADER_TITLE_RIGHT = 60;
|
|
792
797
|
function LoadoutScreen({ game }) {
|
|
793
798
|
const pack = usePack();
|
|
794
799
|
const { seatTwo: savedSeatTwo, setSeatTwo } = useOpponent();
|
|
@@ -808,6 +813,7 @@ function LoadoutScreen({ game }) {
|
|
|
808
813
|
const playersRowFade = panelFadeStyle;
|
|
809
814
|
const [settingsOpen, setSettingsOpen] = useState4(false);
|
|
810
815
|
const insets = useSafeAreaInsets2();
|
|
816
|
+
const { title: lettering } = useLettering();
|
|
811
817
|
const { colors: themeColors, dark } = useAutoPaperTheme3();
|
|
812
818
|
const { p1Color, p2Color, handleP1ColorChange, handleP2ColorChange } = useSeatColors(p2IsHuman);
|
|
813
819
|
const dispatch = useDispatch9();
|
|
@@ -858,6 +864,7 @@ function LoadoutScreen({ game }) {
|
|
|
858
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}`);
|
|
859
865
|
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}`);
|
|
860
866
|
const toggleP1Ready = () => setReady((r) => ({ ...r, 1: !r[1] }));
|
|
867
|
+
const readyInOptions = !p2IsHuman && !!loadout.drawsReady;
|
|
861
868
|
const seatButtons = /* @__PURE__ */ jsxs4(View3, { style: [styles3.seatOneButtons, p1PickerOpen && styles3.raised], children: [
|
|
862
869
|
/* @__PURE__ */ jsxs4(Animated.View, { style: [styles3.playersRow, p1PickerOpen && styles3.raised, !p2IsHuman && playersRowFade], children: [
|
|
863
870
|
p1Panel,
|
|
@@ -868,7 +875,7 @@ function LoadoutScreen({ game }) {
|
|
|
868
875
|
const seatsInOptions = !p2IsHuman && !!loadout.placesSeats;
|
|
869
876
|
const seatOne = /* @__PURE__ */ jsxs4(View3, { style: [styles3.seatOne, !p2IsHuman && styles3.seatOneAlone, p1PickerOpen && !seatsInOptions && styles3.raised], children: [
|
|
870
877
|
!seatsInOptions && seatButtons,
|
|
871
|
-
/* @__PURE__ */ jsx15(ReadyButton, { color: p1Drawn, ready: ready[1], onToggleReady: toggleP1Ready, surfaceColor: readySurface, dark, style: !p2IsHuman && p1PickerOpen && styles3.readyButtonHidden })
|
|
878
|
+
!readyInOptions && /* @__PURE__ */ jsx15(ReadyButton, { color: p1Drawn, ready: ready[1], onToggleReady: toggleP1Ready, surfaceColor: readySurface, dark, style: !p2IsHuman && p1PickerOpen && styles3.readyButtonHidden })
|
|
872
879
|
] });
|
|
873
880
|
const optionsRow = loadout.options({
|
|
874
881
|
host: controlsHost,
|
|
@@ -877,6 +884,8 @@ function LoadoutScreen({ game }) {
|
|
|
877
884
|
onAccentColor: themeColors.onTertiary,
|
|
878
885
|
dark,
|
|
879
886
|
seats: seatsInOptions ? seatButtons : void 0,
|
|
887
|
+
onReady: readyInOptions ? () => setReady((r) => ({ ...r, 1: true })) : void 0,
|
|
888
|
+
titleShown: !showMetaInSharedBand,
|
|
880
889
|
// Left out (the row's own actions unrendered) whenever the shared band below carries them.
|
|
881
890
|
onRandomize: showMetaInSharedBand ? void 0 : loadout.randomize,
|
|
882
891
|
onReset: showMetaInSharedBand ? void 0 : loadout.reset
|
|
@@ -886,10 +895,11 @@ function LoadoutScreen({ game }) {
|
|
|
886
895
|
const p2Control = p2IsHuman ? loadout.seatControl(2, p2Host, { ...controlLook, seatColor: p2Drawn }) : void 0;
|
|
887
896
|
const p2Panel = p2IsHuman && /* @__PURE__ */ jsx15(PlayerSetupPanel, { idPrefix: "p2", host: p2Host, color: p2Color, onColorChange: handleP2ColorChange, swatches: defaultColors2, takenColor: p1Color, colorCaption: pack.colorCaption, isHuman: true, ready: ready[2], onToggleReady: () => setReady((r) => ({ ...r, 2: !r[2] })), dark, secondPicker: p2Control, secondPickerId: p2Control ? P2_CONTROL_ID : void 0, profiles, selectedProfileId: lastSelected[2], takenProfileId: lastSelected[1], guestLabel: pack.guestLabel ?? "P2", nullLabel: pack.nullLabel, onProfileSelect: handleP2ProfileSelect, previewValue: seatPreview, triggerStyle, readySurfaceColor: readySurface }, "p2-zones");
|
|
888
897
|
return /* @__PURE__ */ jsxs4(View3, { style: [styles3.container, { backgroundColor: bg }], children: [
|
|
889
|
-
/* @__PURE__ */ jsxs4(View3, { style: styles3.frame, children: [
|
|
898
|
+
/* @__PURE__ */ jsxs4(View3, { style: [styles3.frame, !showMetaInSharedBand && { paddingTop: HEADER_TOP + HEADER_ROW_HEIGHT + insets.top }], children: [
|
|
890
899
|
/* @__PURE__ */ jsx15(PressAwayOverlay, { active: controlsHost.openId !== null, onPress: controlsHost.close }),
|
|
891
900
|
p2ZoneStyle && /* @__PURE__ */ jsx15(PressAwayOverlay, { active: controlsHost.openId !== null || p2Host.openId !== null, onPress: p2Host.close, style: p2ZoneStyle }),
|
|
892
901
|
!showMetaInSharedBand && /* @__PURE__ */ jsx15(CornerActionButtons, { onBack: safeBack, onSettings: () => setSettingsOpen(true), fg, insets }),
|
|
902
|
+
!showMetaInSharedBand && /* @__PURE__ */ jsx15(View3, { style: [styles3.headerTitle, { top: HEADER_TOP + insets.top, left: HEADER_TITLE_LEFT + insets.left, right: HEADER_TITLE_RIGHT + insets.right }], pointerEvents: "none", children: /* @__PURE__ */ jsx15(Text, { variant: "headlineSmall", numberOfLines: 1, accessibilityRole: "header", style: [styles3.title, { color: fg }, lettering], children: game.title }) }),
|
|
893
903
|
p2IsHuman ? /* @__PURE__ */ jsx15(
|
|
894
904
|
DualZoneLayout,
|
|
895
905
|
{
|
|
@@ -904,7 +914,7 @@ function LoadoutScreen({ game }) {
|
|
|
904
914
|
}
|
|
905
915
|
) : /* @__PURE__ */ jsxs4(View3, { style: styles3.stackedZone, children: [
|
|
906
916
|
seatsInOptions ? /* @__PURE__ */ jsx15(View3, { style: p1PickerOpen && styles3.raised, children: sharedControls }) : sharedControls,
|
|
907
|
-
seatOne
|
|
917
|
+
!(seatsInOptions && readyInOptions) && seatOne
|
|
908
918
|
] })
|
|
909
919
|
] }),
|
|
910
920
|
/* @__PURE__ */ jsx15(SettingsDialog, { visible: settingsOpen, onDismiss: () => setSettingsOpen(false), onShowHowToPlay: () => openFor(game.id), showProfile: true })
|
|
@@ -932,6 +942,11 @@ var styles3 = StyleSheet3.create({
|
|
|
932
942
|
justifyContent: "center",
|
|
933
943
|
paddingHorizontal: 16
|
|
934
944
|
},
|
|
945
|
+
headerTitle: {
|
|
946
|
+
height: HEADER_ROW_HEIGHT,
|
|
947
|
+
justifyContent: "center",
|
|
948
|
+
position: "absolute"
|
|
949
|
+
},
|
|
935
950
|
p2ZoneRight: {
|
|
936
951
|
bottom: 0,
|
|
937
952
|
position: "absolute",
|
|
@@ -984,6 +999,10 @@ var styles3 = StyleSheet3.create({
|
|
|
984
999
|
stackedZone: {
|
|
985
1000
|
alignItems: "center",
|
|
986
1001
|
gap: 28
|
|
1002
|
+
},
|
|
1003
|
+
// hud's BaseStatsScreen title: the stats screen's header, in the pack's title lettering.
|
|
1004
|
+
title: {
|
|
1005
|
+
fontWeight: "bold"
|
|
987
1006
|
}
|
|
988
1007
|
});
|
|
989
1008
|
|
|
@@ -1007,13 +1026,16 @@ function PlayRoute() {
|
|
|
1007
1026
|
const { PlayScreen } = game;
|
|
1008
1027
|
return /* @__PURE__ */ jsx16(PlayScreen, {}, game.id);
|
|
1009
1028
|
}
|
|
1029
|
+
var playScreensUp = 0;
|
|
1010
1030
|
function useResumePoint(gameId) {
|
|
1011
1031
|
const { setLastActiveGame, clearLastActiveGame } = useLastActiveGame();
|
|
1012
1032
|
useEffect5(() => {
|
|
1013
1033
|
if (!gameId) return;
|
|
1034
|
+
playScreensUp += 1;
|
|
1014
1035
|
setLastActiveGame(gameId);
|
|
1015
1036
|
return () => {
|
|
1016
|
-
|
|
1037
|
+
playScreensUp -= 1;
|
|
1038
|
+
if (playScreensUp === 0 && AppState.currentState === "active") clearLastActiveGame();
|
|
1017
1039
|
};
|
|
1018
1040
|
}, [gameId, setLastActiveGame, clearLastActiveGame]);
|
|
1019
1041
|
}
|
|
@@ -1026,7 +1048,7 @@ import { getProfilePickerContentSize, ProfilePicker } from "@tastic/profile";
|
|
|
1026
1048
|
import { router as router5, useFocusEffect as useFocusEffect3, useIsFocused } from "expo-router";
|
|
1027
1049
|
import { useCallback as useCallback10, useDeferredValue, useEffect as useEffect6, useMemo as useMemo6, useRef as useRef5, useState as useState6 } from "react";
|
|
1028
1050
|
import { AppState as AppState2, StyleSheet as StyleSheet4, View as View4 } from "react-native";
|
|
1029
|
-
import { Icon, Portal, SegmentedButtons, Text } from "react-native-paper";
|
|
1051
|
+
import { Icon, Portal, SegmentedButtons, Text as Text2 } from "react-native-paper";
|
|
1030
1052
|
|
|
1031
1053
|
// src/components/segmentTheme.ts
|
|
1032
1054
|
var SEGMENT_THEME = { roundness: 3.8 };
|
|
@@ -1271,8 +1293,8 @@ function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPres
|
|
|
1271
1293
|
/* @__PURE__ */ jsxs5(Pressable, { onPress, style: [styles4.row, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
|
|
1272
1294
|
game.Preview ? /* @__PURE__ */ jsx17(PreviewBox, { game, width: ROW_PREVIEW_WIDTH, revealed: previewRevealed, dark, p1Color, p2Color }) : /* @__PURE__ */ jsx17(View4, { style: [styles4.rowIcon, { backgroundColor: dark ? ICON_DARK_BG : ICON_LIGHT_BG }], children: GameIcon && /* @__PURE__ */ jsx17(GameIcon, { size: ROW_ICON_SIZE, p1Color, p2Color, dark }) }),
|
|
1273
1295
|
/* @__PURE__ */ jsxs5(View4, { style: styles4.rowText, children: [
|
|
1274
|
-
/* @__PURE__ */ jsx17(
|
|
1275
|
-
/* @__PURE__ */ jsx17(
|
|
1296
|
+
/* @__PURE__ */ jsx17(Text2, { variant: "titleLarge", style: [styles4.rowTitle, { color: well.fg }, titleStyle], numberOfLines: 1, children: game.title }),
|
|
1297
|
+
/* @__PURE__ */ jsx17(Text2, { variant: "bodyMedium", style: { color: well.fgMuted }, numberOfLines: ROW_BLURB_LINES, children: game.blurb })
|
|
1276
1298
|
] })
|
|
1277
1299
|
] }),
|
|
1278
1300
|
onRules && /* @__PURE__ */ jsx17(Pressable, { onPress: onRules, style: styles4.rulesButton, hitSlop: 12, accessibilityRole: "button", accessibilityLabel: `${game.title} rules`, children: /* @__PURE__ */ jsx17(Icon, { source: "information-outline", size: 22, color: well.fgMuted }) })
|
|
@@ -1285,8 +1307,8 @@ function GameTile({ game, hidden, width, previewWidth, dark, p1Color, p2Color, p
|
|
|
1285
1307
|
return /* @__PURE__ */ jsxs5(View4, { style: [{ width }, hidden && styles4.hidden], children: [
|
|
1286
1308
|
/* @__PURE__ */ jsxs5(Pressable, { onPress, style: [styles4.tile, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
|
|
1287
1309
|
/* @__PURE__ */ jsx17(PreviewBox, { game, width: previewWidth, revealed: previewRevealed, dark, p1Color, p2Color }),
|
|
1288
|
-
/* @__PURE__ */ jsx17(
|
|
1289
|
-
/* @__PURE__ */ jsx17(
|
|
1310
|
+
/* @__PURE__ */ jsx17(Text2, { variant: "titleMedium", style: [styles4.rowTitle, { color: well.fg }, titleStyle], numberOfLines: 1, children: game.title }),
|
|
1311
|
+
/* @__PURE__ */ jsx17(Text2, { variant: "bodySmall", style: { color: well.fgMuted }, numberOfLines: 3, children: game.blurb })
|
|
1290
1312
|
] }),
|
|
1291
1313
|
onRules && /* @__PURE__ */ jsx17(Pressable, { onPress: onRules, style: styles4.tileRulesButton, hitSlop: 12, accessibilityRole: "button", accessibilityLabel: `${game.title} rules`, children: /* @__PURE__ */ jsx17(Icon, { source: "information-outline", size: 20, color: "#FFFFFF" }) })
|
|
1292
1314
|
] });
|
|
@@ -1451,7 +1473,7 @@ import { getOptionPickerContentSize as getOptionPickerContentSize2, OptionPicker
|
|
|
1451
1473
|
import { router as router6 } from "expo-router";
|
|
1452
1474
|
import { useMemo as useMemo7, useState as useState7 } from "react";
|
|
1453
1475
|
import { StyleSheet as StyleSheet5, View as View5 } from "react-native";
|
|
1454
|
-
import { SegmentedButtons as SegmentedButtons2, Text as
|
|
1476
|
+
import { SegmentedButtons as SegmentedButtons2, Text as Text3 } from "react-native-paper";
|
|
1455
1477
|
import { useSafeAreaInsets as useSafeAreaInsets4 } from "react-native-safe-area-context";
|
|
1456
1478
|
import { useDispatch as useDispatch10 } from "react-redux";
|
|
1457
1479
|
import { jsx as jsx18, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
@@ -1552,7 +1574,7 @@ function GameStats({ game, tab, profileId, showTitle, titleColor }) {
|
|
|
1552
1574
|
const Sections = tab === STATS ? StatsSections : AchievementList;
|
|
1553
1575
|
if (!Sections) return null;
|
|
1554
1576
|
return /* @__PURE__ */ jsxs6(View5, { style: styles5.game, children: [
|
|
1555
|
-
showTitle && /* @__PURE__ */ jsx18(
|
|
1577
|
+
showTitle && /* @__PURE__ */ jsx18(Text3, { variant: "titleLarge", style: [styles5.gameTitle, { color: titleColor }, titleStyle], children: game.title }),
|
|
1556
1578
|
/* @__PURE__ */ jsx18(Sections, { profileId })
|
|
1557
1579
|
] });
|
|
1558
1580
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tastic/shell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.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",
|
|
@@ -43,14 +43,20 @@ export function PlayRoute() {
|
|
|
43
43
|
// terminates an app it hasn't suspended yet (swiped away from the app switcher soon after leaving
|
|
44
44
|
// it), React Native's renderer stops every surface (RCTSurfacePresenter's will-terminate handler),
|
|
45
45
|
// which unmounts the whole tree, and clearing then sent every such relaunch to Home. Runs once per
|
|
46
|
-
// play screen: the context's functions never change.
|
|
46
|
+
// play screen: the context's functions never change. A play screen that goes while another is up
|
|
47
|
+
// (a pack replacing one play screen with another, CardTastic's regular game with its Daily Deal: the
|
|
48
|
+
// stack keeps the old one drawn until its transition ends, so it unmounts after the new one mounted)
|
|
49
|
+
// leaves the resume point to the one still up.
|
|
50
|
+
let playScreensUp = 0
|
|
47
51
|
function useResumePoint(gameId: string | null) {
|
|
48
52
|
const { setLastActiveGame, clearLastActiveGame } = useLastActiveGame()
|
|
49
53
|
useEffect(() => {
|
|
50
54
|
if (!gameId) return
|
|
55
|
+
playScreensUp += 1
|
|
51
56
|
setLastActiveGame(gameId)
|
|
52
57
|
return () => {
|
|
53
|
-
|
|
58
|
+
playScreensUp -= 1
|
|
59
|
+
if (playScreensUp === 0 && AppState.currentState === 'active') clearLastActiveGame()
|
|
54
60
|
}
|
|
55
61
|
}, [gameId, setLastActiveGame, clearLastActiveGame])
|
|
56
62
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { defaultColors, getRgb, useAutoPaperTheme } from '@rific/auto-paper'
|
|
2
2
|
import { useOrientationState } from '@tastic/core'
|
|
3
|
-
import { CornerActionButtons, PressAwayOverlay, usePopoverHost } from '@tastic/hud/chrome'
|
|
3
|
+
import { CornerActionButtons, PressAwayOverlay, useLettering, usePopoverHost } from '@tastic/hud/chrome'
|
|
4
4
|
import { PlayerSetupPanel, ReadyButton, SharedActionBand } from '@tastic/hud/lobby'
|
|
5
5
|
import type { Profile } from '@tastic/profile'
|
|
6
6
|
import { DualZoneLayout, needsSharedNeutralZone, useDualZoneLayout } from '@tastic/split-screen'
|
|
7
7
|
import { router, useFocusEffect } from 'expo-router'
|
|
8
8
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
9
9
|
import { type StyleProp, StyleSheet, View, type ViewStyle } from 'react-native'
|
|
10
|
+
import { Text } from 'react-native-paper'
|
|
10
11
|
import Animated from 'react-native-reanimated'
|
|
11
12
|
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
12
13
|
import { useDispatch } from 'react-redux'
|
|
@@ -36,6 +37,14 @@ const PANEL_SWAP_FADE_MS = 180
|
|
|
36
37
|
const P1_CONTROL_ID = 'p1-control'
|
|
37
38
|
const P2_CONTROL_ID = 'p2-control'
|
|
38
39
|
|
|
40
|
+
// The header's title, placed as the stats screen's (hud's BaseStatsScreen): beside the corner Back
|
|
41
|
+
// button (8pt from the edge, Paper's 6pt IconButton margin, its 40pt box, 6pt margin, 4pt gap), clear
|
|
42
|
+
// of the Settings button on the right, and centered on the buttons' 52pt row.
|
|
43
|
+
const HEADER_TOP = 8
|
|
44
|
+
const HEADER_ROW_HEIGHT = 52
|
|
45
|
+
const HEADER_TITLE_LEFT = 64
|
|
46
|
+
const HEADER_TITLE_RIGHT = 60
|
|
47
|
+
|
|
39
48
|
// A game that has a loadout (GameDefinition.useLoadout): the loadout route sends any other straight
|
|
40
49
|
// to its play screen.
|
|
41
50
|
export type LoadoutGame = PackGameDefinition & Required<Pick<PackGameDefinition, 'useLoadout'>>
|
|
@@ -81,6 +90,7 @@ export function LoadoutScreen({ game }: { game: LoadoutGame }) {
|
|
|
81
90
|
|
|
82
91
|
const [settingsOpen, setSettingsOpen] = useState(false)
|
|
83
92
|
const insets = useSafeAreaInsets()
|
|
93
|
+
const { title: lettering } = useLettering()
|
|
84
94
|
const { colors: themeColors, dark } = useAutoPaperTheme()
|
|
85
95
|
const { p1Color, p2Color, handleP1ColorChange, handleP2ColorChange } = useSeatColors(p2IsHuman)
|
|
86
96
|
const dispatch = useDispatch<Dispatch<Action>>()
|
|
@@ -178,6 +188,8 @@ export function LoadoutScreen({ game }: { game: LoadoutGame }) {
|
|
|
178
188
|
// seat 1's button stands alone.
|
|
179
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} />
|
|
180
190
|
const toggleP1Ready = () => setReady((r) => ({ ...r, 1: !r[1] }))
|
|
191
|
+
// With one person a game can draw its own start among its options (GameLoadout.drawsReady)
|
|
192
|
+
const readyInOptions = !p2IsHuman && !!loadout.drawsReady
|
|
181
193
|
const seatButtons = (
|
|
182
194
|
<View style={[styles.seatOneButtons, p1PickerOpen && styles.raised]}>
|
|
183
195
|
<Animated.View style={[styles.playersRow, p1PickerOpen && styles.raised, !p2IsHuman && playersRowFade]}>
|
|
@@ -192,7 +204,7 @@ export function LoadoutScreen({ game }: { game: LoadoutGame }) {
|
|
|
192
204
|
const seatOne = (
|
|
193
205
|
<View style={[styles.seatOne, !p2IsHuman && styles.seatOneAlone, p1PickerOpen && !seatsInOptions && styles.raised]}>
|
|
194
206
|
{!seatsInOptions && seatButtons}
|
|
195
|
-
<ReadyButton color={p1Drawn} ready={ready[1]} onToggleReady={toggleP1Ready} surfaceColor={readySurface} dark={dark} style={!p2IsHuman && p1PickerOpen && styles.readyButtonHidden} />
|
|
207
|
+
{!readyInOptions && <ReadyButton color={p1Drawn} ready={ready[1]} onToggleReady={toggleP1Ready} surfaceColor={readySurface} dark={dark} style={!p2IsHuman && p1PickerOpen && styles.readyButtonHidden} />}
|
|
196
208
|
</View>
|
|
197
209
|
)
|
|
198
210
|
|
|
@@ -203,6 +215,8 @@ export function LoadoutScreen({ game }: { game: LoadoutGame }) {
|
|
|
203
215
|
onAccentColor: themeColors.onTertiary,
|
|
204
216
|
dark,
|
|
205
217
|
seats: seatsInOptions ? seatButtons : undefined,
|
|
218
|
+
onReady: readyInOptions ? () => setReady((r) => ({ ...r, 1: true })) : undefined,
|
|
219
|
+
titleShown: !showMetaInSharedBand,
|
|
206
220
|
// Left out (the row's own actions unrendered) whenever the shared band below carries them.
|
|
207
221
|
onRandomize: showMetaInSharedBand ? undefined : loadout.randomize,
|
|
208
222
|
onReset: showMetaInSharedBand ? undefined : loadout.reset
|
|
@@ -225,7 +239,7 @@ export function LoadoutScreen({ game }: { game: LoadoutGame }) {
|
|
|
225
239
|
return (
|
|
226
240
|
<View style={[styles.container, { backgroundColor: bg }]}>
|
|
227
241
|
{/* The Settings dialog stays outside this frame: it renders through a Portal. */}
|
|
228
|
-
<View style={styles.frame}>
|
|
242
|
+
<View style={[styles.frame, !showMetaInSharedBand && { paddingTop: HEADER_TOP + HEADER_ROW_HEIGHT + insets.top }]}>
|
|
229
243
|
{/* Press-away overlays for the loadout's own menus. P1's covers the whole screen (their
|
|
230
244
|
panel plus the match options read as theirs), while P2's covers only their half and, as a
|
|
231
245
|
later sibling, takes priority there. P2's mounts whenever either host has a menu open, so it
|
|
@@ -234,6 +248,16 @@ export function LoadoutScreen({ game }: { game: LoadoutGame }) {
|
|
|
234
248
|
{p2ZoneStyle && <PressAwayOverlay active={controlsHost.openId !== null || p2Host.openId !== null} onPress={p2Host.close} style={p2ZoneStyle} />}
|
|
235
249
|
|
|
236
250
|
{!showMetaInSharedBand && <CornerActionButtons onBack={safeBack} onSettings={() => setSettingsOpen(true)} fg={fg} insets={insets} />}
|
|
251
|
+
{/* The game's name in the header, as a screen's title beside Back (Jay, 2026-11-21: over the
|
|
252
|
+
seat buttons it read as part of the options). 2 Player face to face has no header: its back
|
|
253
|
+
and settings sit in the band between the players, where a game names itself. */}
|
|
254
|
+
{!showMetaInSharedBand && (
|
|
255
|
+
<View style={[styles.headerTitle, { top: HEADER_TOP + insets.top, left: HEADER_TITLE_LEFT + insets.left, right: HEADER_TITLE_RIGHT + insets.right }]} pointerEvents='none'>
|
|
256
|
+
<Text variant='headlineSmall' numberOfLines={1} accessibilityRole='header' style={[styles.title, { color: fg }, lettering]}>
|
|
257
|
+
{game.title}
|
|
258
|
+
</Text>
|
|
259
|
+
</View>
|
|
260
|
+
)}
|
|
237
261
|
|
|
238
262
|
{p2IsHuman ? (
|
|
239
263
|
<DualZoneLayout
|
|
@@ -252,7 +276,8 @@ export function LoadoutScreen({ game }: { game: LoadoutGame }) {
|
|
|
252
276
|
<View style={styles.stackedZone}>
|
|
253
277
|
{/* A menu opening from seat buttons placed in the options has to clear Ready, the next sibling */}
|
|
254
278
|
{seatsInOptions ? <View style={p1PickerOpen && styles.raised}>{sharedControls}</View> : sharedControls}
|
|
255
|
-
{
|
|
279
|
+
{/* Nothing left of seat 1's column once a game places its buttons and draws its own start (no empty gap) */}
|
|
280
|
+
{!(seatsInOptions && readyInOptions) && seatOne}
|
|
256
281
|
</View>
|
|
257
282
|
)}
|
|
258
283
|
</View>
|
|
@@ -287,6 +312,11 @@ const styles = StyleSheet.create({
|
|
|
287
312
|
justifyContent: 'center',
|
|
288
313
|
paddingHorizontal: 16
|
|
289
314
|
},
|
|
315
|
+
headerTitle: {
|
|
316
|
+
height: HEADER_ROW_HEIGHT,
|
|
317
|
+
justifyContent: 'center',
|
|
318
|
+
position: 'absolute'
|
|
319
|
+
},
|
|
290
320
|
p2ZoneRight: {
|
|
291
321
|
bottom: 0,
|
|
292
322
|
position: 'absolute',
|
|
@@ -339,5 +369,9 @@ const styles = StyleSheet.create({
|
|
|
339
369
|
stackedZone: {
|
|
340
370
|
alignItems: 'center',
|
|
341
371
|
gap: 28
|
|
372
|
+
},
|
|
373
|
+
// hud's BaseStatsScreen title: the stats screen's header, in the pack's title lettering.
|
|
374
|
+
title: {
|
|
375
|
+
fontWeight: 'bold'
|
|
342
376
|
}
|
|
343
377
|
})
|
package/src/types.ts
CHANGED
|
@@ -56,6 +56,13 @@ export interface LoadoutOptionsProps {
|
|
|
56
56
|
// With one person, player 1's row of buttons (their seat's, the opponent's and their controls), for a
|
|
57
57
|
// game whose loadout sets placesSeats to put where it likes. Undefined otherwise.
|
|
58
58
|
seats?: ReactNode
|
|
59
|
+
// With one person, what starts the round (player 1 readying up), for a game whose loadout sets
|
|
60
|
+
// drawsReady to draw its own start among its options. Undefined otherwise.
|
|
61
|
+
onReady?: () => void
|
|
62
|
+
// Whether the loadout's header already shows the game's name (beside Back, as the stats screen's
|
|
63
|
+
// title does): everywhere but 2 Player face to face, whose back and settings fold into the band
|
|
64
|
+
// between the players. A game that names itself among its options does so only when this is false.
|
|
65
|
+
titleShown: boolean
|
|
59
66
|
}
|
|
60
67
|
|
|
61
68
|
// The colors a seat's controls picker draws with: the loadout's tertiary accent, or the seat's own.
|
|
@@ -78,6 +85,11 @@ export interface GameLoadout {
|
|
|
78
85
|
// instead (LoadoutOptionsProps.seats), for a game that wants them among its own (over its rules, under
|
|
79
86
|
// its name). 2 Player's seats stay in each person's half.
|
|
80
87
|
placesSeats?: boolean
|
|
88
|
+
// With one person Ready sits under the options row (and the seat buttons). True draws no Ready and
|
|
89
|
+
// hands `options` an onReady to call instead, for a game that starts the round from a control of its
|
|
90
|
+
// own (CardTastic's solitaire games: a New Deal or Continue row in a card, like their Daily Deal's, since
|
|
91
|
+
// READY? means nothing to one person). 2 Player's Ready buttons stay in each person's half.
|
|
92
|
+
drawsReady?: boolean
|
|
81
93
|
// The popover ids the options row opens, so the loadout can elevate the row while one is open.
|
|
82
94
|
optionIds: readonly string[]
|
|
83
95
|
randomize: () => void
|