@tastic/shell 0.12.0 → 0.13.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 -0
- package/dist/index.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +24 -9
- package/dist/index.mjs +25 -10
- package/package.json +3 -3
- package/src/RootLayout.tsx +43 -23
- package/src/screens/HomeScreen.tsx +5 -3
- package/src/screens/StatsScreen.tsx +17 -7
- package/src/types.ts +14 -0
package/README.md
CHANGED
|
@@ -105,6 +105,8 @@ the front of an in-app link, so a route starting with a game id equal to the bas
|
|
|
105
105
|
| `HeroTitle` | Home's wordmark, drawn by the pack (`HeroTitleProps`: `words`, `color`, `p1Color`, `p2Color`, `active`, false while Home is covered or the app is in the background, and `fit`, the box it has beside the preview grid on a wide screen, undefined at its own size). |
|
|
106
106
|
| `fonts?` | Fonts the pack's own art needs, loaded behind the splash screen beside the icon font. |
|
|
107
107
|
| `fontFamily?` | The typeface on every Paper text variant. Unset is Paper's own. |
|
|
108
|
+
| `titleStyle?` | The lettering of the pack's titles alone (a title font, AlphaTastic's), laid over each title's own type: Home's game cards, the stats screen's title and game headings, and every hud dialog's title (the shell mounts hud's `DialogHeaderStyleProvider` in the standard tone, so the big icon and accent color stay). Needs `@tastic/hud` with `titleStyle` in the standard tone and on `BaseStatsScreen`. |
|
|
109
|
+
| `labelStyle?` | The lettering of the pack's small labels alone, laid over each one's own type: the stats screen's and Home's tabs, the stats screen's section headings, the Settings sheet's sections and every `@tastic/profile` picker pill. The shell mounts hud's `LetteringProvider` with it and `titleStyle`. Needs `@tastic/hud` with `LetteringProvider` and `@tastic/profile` reading it. |
|
|
108
110
|
| `otaVersion` | The version label in Settings. |
|
|
109
111
|
| `useSettingsRules?` | A hook returning what goes first in every Settings dialog, above the shell's rows: the rules of the game it's opened in. Null where there's nothing (Home). |
|
|
110
112
|
| `SettingsSections?` | The pack's own Settings sections, in every Settings dialog, under the shell's rows and any a play screen adds. |
|
|
@@ -128,6 +130,7 @@ PuckTastic and DuelTastic draw what they always did:
|
|
|
128
130
|
| `guide?` | The pack's own How to Play (`PackGuide`: `version`, `selectVersionSeen`, `markSeen`, `getSteps({ touch })`), for cards that teach every game at once: shown on Home's first launch (never while a cold launch resumes a game), replayed from Home's Settings, never in a play screen. Its seen version is a key of the pack's own. |
|
|
129
131
|
| `guestLabel?`, `nullLabel?` | Seat 1's button on Home and in every loadout: the chip's label for a guest (default `'P1'`) and the guest row's in its menu. A 2 Player loadout's seat 2 button takes the same two (its guest default `'P2'`). |
|
|
130
132
|
| `guestStats?` | The stats screen keeps a guest's stats under `GUEST_PLAYER_ID` (`'guest'`): a Guest entry between Everyone and the profiles once a profile exists, and the screen opens on seat 1's player. Without it the screen opens on Everyone, where guests count. |
|
|
133
|
+
| `useStatsPlayer?` | A hook returning the profile id the stats screen opens on, for a pack that keeps its own idea of who is playing (AlphaTastic's active player). Null, or an id not on the roster, opens on Everyone. Takes precedence over `guestStats`' opening on seat 1. |
|
|
131
134
|
| `AchievementList?` | One achievement list across the pack's games, on the Achievements tab, with the game picker hidden there. |
|
|
132
135
|
| `statsTabs?` | Tabs of the pack's own between Stats and Achievements (`PackStatsTab`: `value`, `label`, `Content`, handed both filters). With them every tab is as wide as its label, with no icons, so three fit a phone. |
|
|
133
136
|
| `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. |
|
package/dist/index.d.mts
CHANGED
|
@@ -7,6 +7,7 @@ import { GuideStep } from '@tastic/hud/guide';
|
|
|
7
7
|
import { MenuOption } from '@tastic/hud/lobby';
|
|
8
8
|
import { FontSource } from 'expo-font';
|
|
9
9
|
import { Href, Stack } from 'expo-router';
|
|
10
|
+
import { TextStyle, ImageSourcePropType } from 'react-native';
|
|
10
11
|
import * as redux from 'redux';
|
|
11
12
|
import { Reducer, Action } from 'redux';
|
|
12
13
|
import * as _rific_core from '@rific/core';
|
|
@@ -20,7 +21,6 @@ import * as _reduxjs_toolkit from '@reduxjs/toolkit';
|
|
|
20
21
|
import { Middleware } from '@reduxjs/toolkit';
|
|
21
22
|
import * as redux_thunk from 'redux-thunk';
|
|
22
23
|
import * as redux_persist_es_persistReducer from 'redux-persist/es/persistReducer';
|
|
23
|
-
import { ImageSourcePropType } from 'react-native';
|
|
24
24
|
import * as _tastic_achievements from '@tastic/achievements';
|
|
25
25
|
import { UnlockedAchievementsState, AchievementDefinition, AchievementsState } from '@tastic/achievements';
|
|
26
26
|
|
|
@@ -279,6 +279,8 @@ interface PackDefinition {
|
|
|
279
279
|
HeroTitle: ComponentType<HeroTitleProps>;
|
|
280
280
|
fonts?: Record<string, FontSource>;
|
|
281
281
|
fontFamily?: string;
|
|
282
|
+
titleStyle?: TextStyle;
|
|
283
|
+
labelStyle?: TextStyle;
|
|
282
284
|
otaVersion: number;
|
|
283
285
|
SettingsSections?: ComponentType;
|
|
284
286
|
useSettingsRules?: () => ReactNode;
|
|
@@ -299,6 +301,7 @@ interface PackDefinition {
|
|
|
299
301
|
guestLabel?: string;
|
|
300
302
|
nullLabel?: string;
|
|
301
303
|
guestStats?: boolean;
|
|
304
|
+
useStatsPlayer?: () => string | null;
|
|
302
305
|
AchievementList?: ComponentType<{
|
|
303
306
|
profileId: string | null;
|
|
304
307
|
}>;
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { GuideStep } from '@tastic/hud/guide';
|
|
|
7
7
|
import { MenuOption } from '@tastic/hud/lobby';
|
|
8
8
|
import { FontSource } from 'expo-font';
|
|
9
9
|
import { Href, Stack } from 'expo-router';
|
|
10
|
+
import { TextStyle, ImageSourcePropType } from 'react-native';
|
|
10
11
|
import * as redux from 'redux';
|
|
11
12
|
import { Reducer, Action } from 'redux';
|
|
12
13
|
import * as _rific_core from '@rific/core';
|
|
@@ -20,7 +21,6 @@ import * as _reduxjs_toolkit from '@reduxjs/toolkit';
|
|
|
20
21
|
import { Middleware } from '@reduxjs/toolkit';
|
|
21
22
|
import * as redux_thunk from 'redux-thunk';
|
|
22
23
|
import * as redux_persist_es_persistReducer from 'redux-persist/es/persistReducer';
|
|
23
|
-
import { ImageSourcePropType } from 'react-native';
|
|
24
24
|
import * as _tastic_achievements from '@tastic/achievements';
|
|
25
25
|
import { UnlockedAchievementsState, AchievementDefinition, AchievementsState } from '@tastic/achievements';
|
|
26
26
|
|
|
@@ -279,6 +279,8 @@ interface PackDefinition {
|
|
|
279
279
|
HeroTitle: ComponentType<HeroTitleProps>;
|
|
280
280
|
fonts?: Record<string, FontSource>;
|
|
281
281
|
fontFamily?: string;
|
|
282
|
+
titleStyle?: TextStyle;
|
|
283
|
+
labelStyle?: TextStyle;
|
|
282
284
|
otaVersion: number;
|
|
283
285
|
SettingsSections?: ComponentType;
|
|
284
286
|
useSettingsRules?: () => ReactNode;
|
|
@@ -299,6 +301,7 @@ interface PackDefinition {
|
|
|
299
301
|
guestLabel?: string;
|
|
300
302
|
nullLabel?: string;
|
|
301
303
|
guestStats?: boolean;
|
|
304
|
+
useStatsPlayer?: () => string | null;
|
|
302
305
|
AchievementList?: ComponentType<{
|
|
303
306
|
profileId: string | null;
|
|
304
307
|
}>;
|
package/dist/index.js
CHANGED
|
@@ -555,12 +555,18 @@ function PackRoot({ pack, children }) {
|
|
|
555
555
|
const inner = Provider ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Provider, { children }) : children;
|
|
556
556
|
return previewColor ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PreviewColors, { previewColor, children: inner }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: inner });
|
|
557
557
|
}
|
|
558
|
+
function DialogTitles({ children }) {
|
|
559
|
+
const { titleStyle, labelStyle } = usePack();
|
|
560
|
+
const lettered = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_chrome2.LetteringProvider, { title: titleStyle, label: labelStyle, children });
|
|
561
|
+
if (!titleStyle) return lettered;
|
|
562
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_chrome2.DialogHeaderStyleProvider, { tone: "standard", titleStyle, children: lettered });
|
|
563
|
+
}
|
|
558
564
|
function RootLayout({ pack, store, persistor }) {
|
|
559
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native_gesture_handler.GestureHandlerRootView, { style: styles.root, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native_safe_area_context2.SafeAreaProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(WindowControlsInsets, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PackProvider, { pack, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Fonts, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Providers, { store, persistor, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Theme, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ProfilesProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(LastActiveGameProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(GameProviders, { games: pack.games, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PackRoot, { pack, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(GatedApp, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(HapticGatedToastProvider, { children: [
|
|
565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native_gesture_handler.GestureHandlerRootView, { style: styles.root, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native_safe_area_context2.SafeAreaProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(WindowControlsInsets, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PackProvider, { pack, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Fonts, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Providers, { store, persistor, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DialogTitles, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Theme, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ProfilesProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(LastActiveGameProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(GameProviders, { games: pack.games, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PackRoot, { pack, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(GatedApp, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(HapticGatedToastProvider, { children: [
|
|
560
566
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(GuideHost, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(AppStack, {}) }),
|
|
561
567
|
pack.Toaster ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PackToaster, { Toaster: pack.Toaster }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FramedToaster, {}),
|
|
562
568
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(UpdateDialog, {})
|
|
563
|
-
] }) }) }) }) }) }) }) }) }) }) }) }) });
|
|
569
|
+
] }) }) }) }) }) }) }) }) }) }) }) }) }) });
|
|
564
570
|
}
|
|
565
571
|
var styles = import_react_native3.StyleSheet.create({
|
|
566
572
|
root: { flex: 1 }
|
|
@@ -1202,7 +1208,7 @@ function HomeMenu() {
|
|
|
1202
1208
|
const tabs = pack.homeTabs && pack.homeTabs.length > 1 ? pack.homeTabs : null;
|
|
1203
1209
|
const [tabLabel, setTabLabel] = (0, import_react16.useState)(() => tabs?.[0].label ?? null);
|
|
1204
1210
|
const tab = tabs ? tabs.find((t) => t.label === tabLabel) ?? tabs[0] : null;
|
|
1205
|
-
const tabButtons = (0, import_react16.useMemo)(() => tabs?.map(({ label }) => ({ value: label, label })) ?? [], [tabs]);
|
|
1211
|
+
const tabButtons = (0, import_react16.useMemo)(() => tabs?.map(({ label }) => ({ value: label, label, labelStyle: pack.labelStyle })) ?? [], [tabs, pack.labelStyle]);
|
|
1206
1212
|
const tabBar = tab && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native_paper.SegmentedButtons, { value: tab.label, onValueChange: setTabLabel, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles4.tabs, pack.Backdrop && { backgroundColor: colors.surface }] });
|
|
1207
1213
|
const columnClamp = useClampOnShrink();
|
|
1208
1214
|
const gridClamp = useClampOnShrink();
|
|
@@ -1279,6 +1285,7 @@ function RulesHost({ enabled, children }) {
|
|
|
1279
1285
|
}
|
|
1280
1286
|
var ROW_BLURB_LINES = 3;
|
|
1281
1287
|
function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPress, onRules }) {
|
|
1288
|
+
const { titleStyle } = usePack();
|
|
1282
1289
|
const well = (0, import_chrome5.useWellColors)();
|
|
1283
1290
|
const GameIcon = game.icon;
|
|
1284
1291
|
return (
|
|
@@ -1288,7 +1295,7 @@ function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPres
|
|
|
1288
1295
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_feedback_press3.Pressable, { onPress, style: [styles4.row, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
|
|
1289
1296
|
game.Preview ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PreviewBox, { game, width: ROW_PREVIEW_WIDTH, revealed: previewRevealed, dark, p1Color, p2Color }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native9.View, { style: [styles4.rowIcon, { backgroundColor: dark ? ICON_DARK_BG : ICON_LIGHT_BG }], children: GameIcon && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(GameIcon, { size: ROW_ICON_SIZE, p1Color, p2Color, dark }) }),
|
|
1290
1297
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native9.View, { style: styles4.rowText, children: [
|
|
1291
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native_paper.Text, { variant: "titleLarge", style: [styles4.rowTitle, { color: well.fg }], numberOfLines: 1, children: game.title }),
|
|
1298
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native_paper.Text, { variant: "titleLarge", style: [styles4.rowTitle, { color: well.fg }, titleStyle], numberOfLines: 1, children: game.title }),
|
|
1292
1299
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native_paper.Text, { variant: "bodyMedium", style: { color: well.fgMuted }, numberOfLines: ROW_BLURB_LINES, children: game.blurb })
|
|
1293
1300
|
] })
|
|
1294
1301
|
] }),
|
|
@@ -1297,11 +1304,12 @@ function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPres
|
|
|
1297
1304
|
);
|
|
1298
1305
|
}
|
|
1299
1306
|
function GameTile({ game, hidden, width, previewWidth, dark, p1Color, p2Color, previewRevealed, onPress, onRules }) {
|
|
1307
|
+
const { titleStyle } = usePack();
|
|
1300
1308
|
const well = (0, import_chrome5.useWellColors)();
|
|
1301
1309
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native9.View, { style: [{ width }, hidden && styles4.hidden], children: [
|
|
1302
1310
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_feedback_press3.Pressable, { onPress, style: [styles4.tile, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
|
|
1303
1311
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PreviewBox, { game, width: previewWidth, revealed: previewRevealed, dark, p1Color, p2Color }),
|
|
1304
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native_paper.Text, { variant: "titleMedium", style: [styles4.rowTitle, { color: well.fg }], numberOfLines: 1, children: game.title }),
|
|
1312
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native_paper.Text, { variant: "titleMedium", style: [styles4.rowTitle, { color: well.fg }, titleStyle], numberOfLines: 1, children: game.title }),
|
|
1305
1313
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native_paper.Text, { variant: "bodySmall", style: { color: well.fgMuted }, numberOfLines: 3, children: game.blurb })
|
|
1306
1314
|
] }),
|
|
1307
1315
|
onRules && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_feedback_press3.Pressable, { onPress: onRules, style: styles4.tileRulesButton, hitSlop: 12, accessibilityRole: "button", accessibilityLabel: `${game.title} rules`, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native_paper.Icon, { source: "information-outline", size: 20, color: "#FFFFFF" }) })
|
|
@@ -1508,6 +1516,7 @@ function StatsPressAway({ host, children }) {
|
|
|
1508
1516
|
}
|
|
1509
1517
|
var useNoPackReset = () => null;
|
|
1510
1518
|
var noPickerAlign2 = () => void 0;
|
|
1519
|
+
var useNoStatsPlayer = () => null;
|
|
1511
1520
|
function StatsContent({ pickerHost }) {
|
|
1512
1521
|
const pack = usePack();
|
|
1513
1522
|
const { dark, colors } = (0, import_auto_paper7.useAutoPaperTheme)();
|
|
@@ -1517,7 +1526,9 @@ function StatsContent({ pickerHost }) {
|
|
|
1517
1526
|
const fg = pack.foreground ?? colors.onBackground;
|
|
1518
1527
|
const [tab, setTab] = (0, import_react17.useState)(STATS);
|
|
1519
1528
|
const [gameId, setGameId] = (0, import_react17.useState)(ALL_GAMES);
|
|
1520
|
-
const
|
|
1529
|
+
const useStatsPlayer = pack.useStatsPlayer ?? useNoStatsPlayer;
|
|
1530
|
+
const statsPlayer = useStatsPlayer();
|
|
1531
|
+
const [selectedProfileId, setSelectedProfileId] = (0, import_react17.useState)(() => pack.useStatsPlayer ? statsPlayer : pack.guestStats ? lastSelected[1] ?? GUEST_PLAYER_ID : null);
|
|
1521
1532
|
const profileId = selectedProfileId && profiles.length > 0 && (pack.guestStats && selectedProfileId === GUEST_PLAYER_ID || profiles.some((p) => p.id === selectedProfileId)) ? selectedProfileId : null;
|
|
1522
1533
|
const games = gameId === ALL_GAMES ? pack.games : pack.games.filter((g) => g.id === gameId);
|
|
1523
1534
|
const packTabs = pack.statsTabs ?? NO_PACK_TABS;
|
|
@@ -1525,7 +1536,10 @@ function StatsContent({ pickerHost }) {
|
|
|
1525
1536
|
const showGamePicker = !(tab === ACHIEVEMENTS && pack.AchievementList);
|
|
1526
1537
|
const playerOptions = (0, import_react17.useMemo)(() => [{ value: EVERYONE, label: "Everyone", icon: "account-group" }, ...pack.guestStats ? [{ value: GUEST_PLAYER_ID, label: "Guest", icon: "account-outline" }] : [], ...profiles.map((p) => ({ value: p.id, label: p.name, icon: "account", color: pack.previewColor ? pack.previewColor(p.color, dark) : p.color }))], [profiles, pack, dark]);
|
|
1527
1538
|
const gameOptions = (0, import_react17.useMemo)(() => [{ value: ALL_GAMES, label: "All Games", icon: "view-grid-outline" }, ...pack.games.map((g) => ({ value: g.id, label: g.title }))], [pack.games]);
|
|
1528
|
-
const tabButtons = (0, import_react17.useMemo)(() =>
|
|
1539
|
+
const tabButtons = (0, import_react17.useMemo)(() => {
|
|
1540
|
+
const buttons = packTabs.length > 0 ? [{ value: STATS, label: "Stats" }, ...packTabs.map(({ value, label }) => ({ value, label })), { value: ACHIEVEMENTS, label: "Achievements" }].map((button) => ({ ...button, style: LABEL_WIDE_TAB })) : TABS;
|
|
1541
|
+
return pack.labelStyle ? buttons.map((button) => ({ ...button, labelStyle: pack.labelStyle })) : buttons;
|
|
1542
|
+
}, [packTabs, pack.labelStyle]);
|
|
1529
1543
|
const title = tab === STATS ? "Stats" : tab === ACHIEVEMENTS ? "Achievements" : packTab?.label ?? "";
|
|
1530
1544
|
const usePackReset = pack.resetStats?.useReset ?? useNoPackReset;
|
|
1531
1545
|
const packReset = usePackReset();
|
|
@@ -1538,7 +1552,7 @@ function StatsContent({ pickerHost }) {
|
|
|
1538
1552
|
const surface = pack.Backdrop ? { backgroundColor: colors.surface } : void 0;
|
|
1539
1553
|
const triggerStyle = pack.Backdrop ? [styles5.pill, surface] : void 0;
|
|
1540
1554
|
const PackTabContent = packTab?.Content;
|
|
1541
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_chrome7.BaseStatsScreen, { title, onBack: import_core8.safeBack, insets, onReset: reset.onReset, resetLabel: reset.label, resetConfirmTitle: reset.title, resetConfirmBody: reset.body, fg: pack.foreground, bg: pack.Backdrop ? "transparent" : void 0, children: [
|
|
1555
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_chrome7.BaseStatsScreen, { title, titleStyle: pack.titleStyle, onBack: import_core8.safeBack, insets, onReset: reset.onReset, resetLabel: reset.label, resetConfirmTitle: reset.title, resetConfirmBody: reset.body, fg: pack.foreground, bg: pack.Backdrop ? "transparent" : void 0, children: [
|
|
1542
1556
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_chrome7.PressAwayOverlay, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles5.pressAway }),
|
|
1543
1557
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper2.SegmentedButtons, { value: tab, onValueChange: setTab, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles5.tabs, surface] }),
|
|
1544
1558
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native10.View, { style: [styles5.filters, pickerHost.openId !== null && styles5.filtersOpen], onStartShouldSetResponder: () => pickerHost.openId !== null, children: [
|
|
@@ -1559,11 +1573,12 @@ function resetFor(pack, packReset, profileId, profiles, games, resetGames) {
|
|
|
1559
1573
|
return { onReset: resetGames, label: games.length === 1 ? `Reset ${scope} Stats` : "Reset All Stats", title: "Reset Stats?", body: `Erases every player's stats and achievements in ${scope}. This cannot be undone.` };
|
|
1560
1574
|
}
|
|
1561
1575
|
function GameStats({ game, tab, profileId, showTitle, titleColor }) {
|
|
1576
|
+
const { titleStyle } = usePack();
|
|
1562
1577
|
const { StatsSections, AchievementList } = game;
|
|
1563
1578
|
const Sections = tab === STATS ? StatsSections : AchievementList;
|
|
1564
1579
|
if (!Sections) return null;
|
|
1565
1580
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native10.View, { style: styles5.game, children: [
|
|
1566
|
-
showTitle && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper2.Text, { variant: "titleLarge", style: [styles5.gameTitle, { color: titleColor }], children: game.title }),
|
|
1581
|
+
showTitle && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper2.Text, { variant: "titleLarge", style: [styles5.gameTitle, { color: titleColor }, titleStyle], children: game.title }),
|
|
1567
1582
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Sections, { profileId })
|
|
1568
1583
|
] });
|
|
1569
1584
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -27,7 +27,7 @@ import { useHapticSettings } from "@rific/feedback-press";
|
|
|
27
27
|
import { Toaster, ToastProvider } from "@rific/toaster";
|
|
28
28
|
import { useThemedRootBackground } from "@tastic/core";
|
|
29
29
|
import { edgeGuardScreenOptions } from "@tastic/edge-guard";
|
|
30
|
-
import { ScreenFrame } from "@tastic/hud/chrome";
|
|
30
|
+
import { DialogHeaderStyleProvider, LetteringProvider, ScreenFrame } from "@tastic/hud/chrome";
|
|
31
31
|
import { ProfileColorProvider } from "@tastic/profile";
|
|
32
32
|
import * as Haptics from "expo-haptics";
|
|
33
33
|
import { DarkTheme, DefaultTheme, Stack, ThemeProvider as NavigationThemeProvider } from "expo-router";
|
|
@@ -477,12 +477,18 @@ function PackRoot({ pack, children }) {
|
|
|
477
477
|
const inner = Provider ? /* @__PURE__ */ jsx10(Provider, { children }) : children;
|
|
478
478
|
return previewColor ? /* @__PURE__ */ jsx10(PreviewColors, { previewColor, children: inner }) : /* @__PURE__ */ jsx10(Fragment4, { children: inner });
|
|
479
479
|
}
|
|
480
|
+
function DialogTitles({ children }) {
|
|
481
|
+
const { titleStyle, labelStyle } = usePack();
|
|
482
|
+
const lettered = /* @__PURE__ */ jsx10(LetteringProvider, { title: titleStyle, label: labelStyle, children });
|
|
483
|
+
if (!titleStyle) return lettered;
|
|
484
|
+
return /* @__PURE__ */ jsx10(DialogHeaderStyleProvider, { tone: "standard", titleStyle, children: lettered });
|
|
485
|
+
}
|
|
480
486
|
function RootLayout({ pack, store, persistor }) {
|
|
481
|
-
return /* @__PURE__ */ jsx10(GestureHandlerRootView, { style: styles.root, children: /* @__PURE__ */ jsx10(SafeAreaProvider, { children: /* @__PURE__ */ jsx10(WindowControlsInsets, { children: /* @__PURE__ */ jsx10(PackProvider, { pack, children: /* @__PURE__ */ jsx10(Fonts, { children: /* @__PURE__ */ jsx10(Providers, { store, persistor, children: /* @__PURE__ */ jsx10(Theme, { children: /* @__PURE__ */ jsx10(ProfilesProvider, { children: /* @__PURE__ */ jsx10(LastActiveGameProvider, { children: /* @__PURE__ */ jsx10(GameProviders, { games: pack.games, children: /* @__PURE__ */ jsx10(PackRoot, { pack, children: /* @__PURE__ */ jsx10(GatedApp, { children: /* @__PURE__ */ jsxs2(HapticGatedToastProvider, { children: [
|
|
487
|
+
return /* @__PURE__ */ jsx10(GestureHandlerRootView, { style: styles.root, children: /* @__PURE__ */ jsx10(SafeAreaProvider, { children: /* @__PURE__ */ jsx10(WindowControlsInsets, { children: /* @__PURE__ */ jsx10(PackProvider, { pack, children: /* @__PURE__ */ jsx10(Fonts, { children: /* @__PURE__ */ jsx10(Providers, { store, persistor, children: /* @__PURE__ */ jsx10(DialogTitles, { children: /* @__PURE__ */ jsx10(Theme, { children: /* @__PURE__ */ jsx10(ProfilesProvider, { children: /* @__PURE__ */ jsx10(LastActiveGameProvider, { children: /* @__PURE__ */ jsx10(GameProviders, { games: pack.games, children: /* @__PURE__ */ jsx10(PackRoot, { pack, children: /* @__PURE__ */ jsx10(GatedApp, { children: /* @__PURE__ */ jsxs2(HapticGatedToastProvider, { children: [
|
|
482
488
|
/* @__PURE__ */ jsx10(GuideHost, { children: /* @__PURE__ */ jsx10(AppStack, {}) }),
|
|
483
489
|
pack.Toaster ? /* @__PURE__ */ jsx10(PackToaster, { Toaster: pack.Toaster }) : /* @__PURE__ */ jsx10(FramedToaster, {}),
|
|
484
490
|
/* @__PURE__ */ jsx10(UpdateDialog, {})
|
|
485
|
-
] }) }) }) }) }) }) }) }) }) }) }) }) });
|
|
491
|
+
] }) }) }) }) }) }) }) }) }) }) }) }) }) });
|
|
486
492
|
}
|
|
487
493
|
var styles = StyleSheet.create({
|
|
488
494
|
root: { flex: 1 }
|
|
@@ -1124,7 +1130,7 @@ function HomeMenu() {
|
|
|
1124
1130
|
const tabs = pack.homeTabs && pack.homeTabs.length > 1 ? pack.homeTabs : null;
|
|
1125
1131
|
const [tabLabel, setTabLabel] = useState6(() => tabs?.[0].label ?? null);
|
|
1126
1132
|
const tab = tabs ? tabs.find((t) => t.label === tabLabel) ?? tabs[0] : null;
|
|
1127
|
-
const tabButtons = useMemo6(() => tabs?.map(({ label }) => ({ value: label, label })) ?? [], [tabs]);
|
|
1133
|
+
const tabButtons = useMemo6(() => tabs?.map(({ label }) => ({ value: label, label, labelStyle: pack.labelStyle })) ?? [], [tabs, pack.labelStyle]);
|
|
1128
1134
|
const tabBar = tab && /* @__PURE__ */ jsx15(SegmentedButtons, { value: tab.label, onValueChange: setTabLabel, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles4.tabs, pack.Backdrop && { backgroundColor: colors.surface }] });
|
|
1129
1135
|
const columnClamp = useClampOnShrink();
|
|
1130
1136
|
const gridClamp = useClampOnShrink();
|
|
@@ -1201,6 +1207,7 @@ function RulesHost({ enabled, children }) {
|
|
|
1201
1207
|
}
|
|
1202
1208
|
var ROW_BLURB_LINES = 3;
|
|
1203
1209
|
function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPress, onRules }) {
|
|
1210
|
+
const { titleStyle } = usePack();
|
|
1204
1211
|
const well = useWellColors();
|
|
1205
1212
|
const GameIcon = game.icon;
|
|
1206
1213
|
return (
|
|
@@ -1210,7 +1217,7 @@ function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPres
|
|
|
1210
1217
|
/* @__PURE__ */ jsxs5(Pressable, { onPress, style: [styles4.row, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
|
|
1211
1218
|
game.Preview ? /* @__PURE__ */ jsx15(PreviewBox, { game, width: ROW_PREVIEW_WIDTH, revealed: previewRevealed, dark, p1Color, p2Color }) : /* @__PURE__ */ jsx15(View4, { style: [styles4.rowIcon, { backgroundColor: dark ? ICON_DARK_BG : ICON_LIGHT_BG }], children: GameIcon && /* @__PURE__ */ jsx15(GameIcon, { size: ROW_ICON_SIZE, p1Color, p2Color, dark }) }),
|
|
1212
1219
|
/* @__PURE__ */ jsxs5(View4, { style: styles4.rowText, children: [
|
|
1213
|
-
/* @__PURE__ */ jsx15(Text, { variant: "titleLarge", style: [styles4.rowTitle, { color: well.fg }], numberOfLines: 1, children: game.title }),
|
|
1220
|
+
/* @__PURE__ */ jsx15(Text, { variant: "titleLarge", style: [styles4.rowTitle, { color: well.fg }, titleStyle], numberOfLines: 1, children: game.title }),
|
|
1214
1221
|
/* @__PURE__ */ jsx15(Text, { variant: "bodyMedium", style: { color: well.fgMuted }, numberOfLines: ROW_BLURB_LINES, children: game.blurb })
|
|
1215
1222
|
] })
|
|
1216
1223
|
] }),
|
|
@@ -1219,11 +1226,12 @@ function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPres
|
|
|
1219
1226
|
);
|
|
1220
1227
|
}
|
|
1221
1228
|
function GameTile({ game, hidden, width, previewWidth, dark, p1Color, p2Color, previewRevealed, onPress, onRules }) {
|
|
1229
|
+
const { titleStyle } = usePack();
|
|
1222
1230
|
const well = useWellColors();
|
|
1223
1231
|
return /* @__PURE__ */ jsxs5(View4, { style: [{ width }, hidden && styles4.hidden], children: [
|
|
1224
1232
|
/* @__PURE__ */ jsxs5(Pressable, { onPress, style: [styles4.tile, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
|
|
1225
1233
|
/* @__PURE__ */ jsx15(PreviewBox, { game, width: previewWidth, revealed: previewRevealed, dark, p1Color, p2Color }),
|
|
1226
|
-
/* @__PURE__ */ jsx15(Text, { variant: "titleMedium", style: [styles4.rowTitle, { color: well.fg }], numberOfLines: 1, children: game.title }),
|
|
1234
|
+
/* @__PURE__ */ jsx15(Text, { variant: "titleMedium", style: [styles4.rowTitle, { color: well.fg }, titleStyle], numberOfLines: 1, children: game.title }),
|
|
1227
1235
|
/* @__PURE__ */ jsx15(Text, { variant: "bodySmall", style: { color: well.fgMuted }, numberOfLines: 3, children: game.blurb })
|
|
1228
1236
|
] }),
|
|
1229
1237
|
onRules && /* @__PURE__ */ jsx15(Pressable, { onPress: onRules, style: styles4.tileRulesButton, hitSlop: 12, accessibilityRole: "button", accessibilityLabel: `${game.title} rules`, children: /* @__PURE__ */ jsx15(Icon, { source: "information-outline", size: 20, color: "#FFFFFF" }) })
|
|
@@ -1430,6 +1438,7 @@ function StatsPressAway({ host, children }) {
|
|
|
1430
1438
|
}
|
|
1431
1439
|
var useNoPackReset = () => null;
|
|
1432
1440
|
var noPickerAlign2 = () => void 0;
|
|
1441
|
+
var useNoStatsPlayer = () => null;
|
|
1433
1442
|
function StatsContent({ pickerHost }) {
|
|
1434
1443
|
const pack = usePack();
|
|
1435
1444
|
const { dark, colors } = useAutoPaperTheme5();
|
|
@@ -1439,7 +1448,9 @@ function StatsContent({ pickerHost }) {
|
|
|
1439
1448
|
const fg = pack.foreground ?? colors.onBackground;
|
|
1440
1449
|
const [tab, setTab] = useState7(STATS);
|
|
1441
1450
|
const [gameId, setGameId] = useState7(ALL_GAMES);
|
|
1442
|
-
const
|
|
1451
|
+
const useStatsPlayer = pack.useStatsPlayer ?? useNoStatsPlayer;
|
|
1452
|
+
const statsPlayer = useStatsPlayer();
|
|
1453
|
+
const [selectedProfileId, setSelectedProfileId] = useState7(() => pack.useStatsPlayer ? statsPlayer : pack.guestStats ? lastSelected[1] ?? GUEST_PLAYER_ID : null);
|
|
1443
1454
|
const profileId = selectedProfileId && profiles.length > 0 && (pack.guestStats && selectedProfileId === GUEST_PLAYER_ID || profiles.some((p) => p.id === selectedProfileId)) ? selectedProfileId : null;
|
|
1444
1455
|
const games = gameId === ALL_GAMES ? pack.games : pack.games.filter((g) => g.id === gameId);
|
|
1445
1456
|
const packTabs = pack.statsTabs ?? NO_PACK_TABS;
|
|
@@ -1447,7 +1458,10 @@ function StatsContent({ pickerHost }) {
|
|
|
1447
1458
|
const showGamePicker = !(tab === ACHIEVEMENTS && pack.AchievementList);
|
|
1448
1459
|
const playerOptions = useMemo7(() => [{ value: EVERYONE, label: "Everyone", icon: "account-group" }, ...pack.guestStats ? [{ value: GUEST_PLAYER_ID, label: "Guest", icon: "account-outline" }] : [], ...profiles.map((p) => ({ value: p.id, label: p.name, icon: "account", color: pack.previewColor ? pack.previewColor(p.color, dark) : p.color }))], [profiles, pack, dark]);
|
|
1449
1460
|
const gameOptions = useMemo7(() => [{ value: ALL_GAMES, label: "All Games", icon: "view-grid-outline" }, ...pack.games.map((g) => ({ value: g.id, label: g.title }))], [pack.games]);
|
|
1450
|
-
const tabButtons = useMemo7(() =>
|
|
1461
|
+
const tabButtons = useMemo7(() => {
|
|
1462
|
+
const buttons = packTabs.length > 0 ? [{ value: STATS, label: "Stats" }, ...packTabs.map(({ value, label }) => ({ value, label })), { value: ACHIEVEMENTS, label: "Achievements" }].map((button) => ({ ...button, style: LABEL_WIDE_TAB })) : TABS;
|
|
1463
|
+
return pack.labelStyle ? buttons.map((button) => ({ ...button, labelStyle: pack.labelStyle })) : buttons;
|
|
1464
|
+
}, [packTabs, pack.labelStyle]);
|
|
1451
1465
|
const title = tab === STATS ? "Stats" : tab === ACHIEVEMENTS ? "Achievements" : packTab?.label ?? "";
|
|
1452
1466
|
const usePackReset = pack.resetStats?.useReset ?? useNoPackReset;
|
|
1453
1467
|
const packReset = usePackReset();
|
|
@@ -1460,7 +1474,7 @@ function StatsContent({ pickerHost }) {
|
|
|
1460
1474
|
const surface = pack.Backdrop ? { backgroundColor: colors.surface } : void 0;
|
|
1461
1475
|
const triggerStyle = pack.Backdrop ? [styles5.pill, surface] : void 0;
|
|
1462
1476
|
const PackTabContent = packTab?.Content;
|
|
1463
|
-
return /* @__PURE__ */ jsxs6(BaseStatsScreen, { title, onBack: safeBack, insets, onReset: reset.onReset, resetLabel: reset.label, resetConfirmTitle: reset.title, resetConfirmBody: reset.body, fg: pack.foreground, bg: pack.Backdrop ? "transparent" : void 0, children: [
|
|
1477
|
+
return /* @__PURE__ */ jsxs6(BaseStatsScreen, { title, titleStyle: pack.titleStyle, onBack: safeBack, insets, onReset: reset.onReset, resetLabel: reset.label, resetConfirmTitle: reset.title, resetConfirmBody: reset.body, fg: pack.foreground, bg: pack.Backdrop ? "transparent" : void 0, children: [
|
|
1464
1478
|
/* @__PURE__ */ jsx17(PressAwayOverlay3, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles5.pressAway }),
|
|
1465
1479
|
/* @__PURE__ */ jsx17(SegmentedButtons2, { value: tab, onValueChange: setTab, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles5.tabs, surface] }),
|
|
1466
1480
|
/* @__PURE__ */ jsxs6(View5, { style: [styles5.filters, pickerHost.openId !== null && styles5.filtersOpen], onStartShouldSetResponder: () => pickerHost.openId !== null, children: [
|
|
@@ -1481,11 +1495,12 @@ function resetFor(pack, packReset, profileId, profiles, games, resetGames) {
|
|
|
1481
1495
|
return { onReset: resetGames, label: games.length === 1 ? `Reset ${scope} Stats` : "Reset All Stats", title: "Reset Stats?", body: `Erases every player's stats and achievements in ${scope}. This cannot be undone.` };
|
|
1482
1496
|
}
|
|
1483
1497
|
function GameStats({ game, tab, profileId, showTitle, titleColor }) {
|
|
1498
|
+
const { titleStyle } = usePack();
|
|
1484
1499
|
const { StatsSections, AchievementList } = game;
|
|
1485
1500
|
const Sections = tab === STATS ? StatsSections : AchievementList;
|
|
1486
1501
|
if (!Sections) return null;
|
|
1487
1502
|
return /* @__PURE__ */ jsxs6(View5, { style: styles5.game, children: [
|
|
1488
|
-
showTitle && /* @__PURE__ */ jsx17(Text2, { variant: "titleLarge", style: [styles5.gameTitle, { color: titleColor }], children: game.title }),
|
|
1503
|
+
showTitle && /* @__PURE__ */ jsx17(Text2, { variant: "titleLarge", style: [styles5.gameTitle, { color: titleColor }, titleStyle], children: game.title }),
|
|
1489
1504
|
/* @__PURE__ */ jsx17(Sections, { profileId })
|
|
1490
1505
|
] });
|
|
1491
1506
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tastic/shell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.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,7 +86,7 @@
|
|
|
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.
|
|
89
|
+
"@tastic/hud": "^0.35.0",
|
|
90
90
|
"@tastic/profile": "^0.19.0",
|
|
91
91
|
"@tastic/split-screen": "^0.6.0",
|
|
92
92
|
"@testing-library/react-native": "^14.1.0",
|
|
@@ -138,7 +138,7 @@
|
|
|
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.
|
|
141
|
+
"@tastic/hud": ">=0.35.0",
|
|
142
142
|
"@tastic/profile": ">=0.18.0",
|
|
143
143
|
"@tastic/split-screen": ">=0.5.5",
|
|
144
144
|
"expo-audio": ">=58.0.11",
|
package/src/RootLayout.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { useHapticSettings } from '@rific/feedback-press'
|
|
|
3
3
|
import { Toaster, ToastProvider } from '@rific/toaster'
|
|
4
4
|
import { useThemedRootBackground } from '@tastic/core'
|
|
5
5
|
import { edgeGuardScreenOptions } from '@tastic/edge-guard'
|
|
6
|
-
import { ScreenFrame } from '@tastic/hud/chrome'
|
|
6
|
+
import { DialogHeaderStyleProvider, LetteringProvider, ScreenFrame } from '@tastic/hud/chrome'
|
|
7
7
|
import { ProfileColorProvider } from '@tastic/profile'
|
|
8
8
|
import * as Haptics from 'expo-haptics'
|
|
9
9
|
import { DarkTheme, DefaultTheme, Stack, ThemeProvider as NavigationThemeProvider } from 'expo-router'
|
|
@@ -198,6 +198,24 @@ interface RootLayoutProps {
|
|
|
198
198
|
persistor: Persistor
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
+
// The pack's own lettering (PackDefinition.titleStyle and labelStyle): every hud dialog's title, the
|
|
202
|
+
// fleet's big header kept, and hud's and @tastic/profile's titles and labels (LetteringProvider). Above
|
|
203
|
+
// Theme, so it reaches the dialogs in auto-paper's portal host.
|
|
204
|
+
function DialogTitles({ children }: { children: ReactNode }) {
|
|
205
|
+
const { titleStyle, labelStyle } = usePack()
|
|
206
|
+
const lettered = (
|
|
207
|
+
<LetteringProvider title={titleStyle} label={labelStyle}>
|
|
208
|
+
{children}
|
|
209
|
+
</LetteringProvider>
|
|
210
|
+
)
|
|
211
|
+
if (!titleStyle) return lettered
|
|
212
|
+
return (
|
|
213
|
+
<DialogHeaderStyleProvider tone='standard' titleStyle={titleStyle}>
|
|
214
|
+
{lettered}
|
|
215
|
+
</DialogHeaderStyleProvider>
|
|
216
|
+
)
|
|
217
|
+
}
|
|
218
|
+
|
|
201
219
|
export function RootLayout({ pack, store, persistor }: RootLayoutProps) {
|
|
202
220
|
return (
|
|
203
221
|
<GestureHandlerRootView style={styles.root}>
|
|
@@ -206,35 +224,37 @@ export function RootLayout({ pack, store, persistor }: RootLayoutProps) {
|
|
|
206
224
|
<PackProvider pack={pack}>
|
|
207
225
|
<Fonts>
|
|
208
226
|
<Providers store={store} persistor={persistor}>
|
|
209
|
-
<
|
|
210
|
-
<
|
|
211
|
-
|
|
227
|
+
<DialogTitles>
|
|
228
|
+
<Theme>
|
|
229
|
+
<ProfilesProvider>
|
|
230
|
+
{/* Inside Providers' PersistGate, so the game a cold launch resumes (read once, as
|
|
212
231
|
it mounts) is the saved one. */}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
232
|
+
<LastActiveGameProvider>
|
|
233
|
+
<GameProviders games={pack.games}>
|
|
234
|
+
<PackRoot pack={pack}>
|
|
235
|
+
<GatedApp>
|
|
236
|
+
<HapticGatedToastProvider>
|
|
237
|
+
{/* Wraps the stack (rather than sitting beside it like UpdateDialog)
|
|
219
238
|
because Home's tiles and the loadout's How to Play row reach it through
|
|
220
239
|
context (see GuideHost). Inside the toast provider because the card renders
|
|
221
240
|
through a Portal, and inside the gate so it mounts together with Home rather
|
|
222
241
|
than before it. */}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
242
|
+
<GuideHost>
|
|
243
|
+
<AppStack />
|
|
244
|
+
</GuideHost>
|
|
245
|
+
{/* historyButton/clearButton off: there's no toast history to open, and a
|
|
227
246
|
control row for it above the toast stack would go nowhere. limit pins the
|
|
228
247
|
package's current default (3) so a future toaster release can't change it. */}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
248
|
+
{pack.Toaster ? <PackToaster Toaster={pack.Toaster} /> : <FramedToaster />}
|
|
249
|
+
<UpdateDialog />
|
|
250
|
+
</HapticGatedToastProvider>
|
|
251
|
+
</GatedApp>
|
|
252
|
+
</PackRoot>
|
|
253
|
+
</GameProviders>
|
|
254
|
+
</LastActiveGameProvider>
|
|
255
|
+
</ProfilesProvider>
|
|
256
|
+
</Theme>
|
|
257
|
+
</DialogTitles>
|
|
238
258
|
</Providers>
|
|
239
259
|
</Fonts>
|
|
240
260
|
</PackProvider>
|
|
@@ -119,7 +119,7 @@ function HomeMenu() {
|
|
|
119
119
|
const tabs = pack.homeTabs && pack.homeTabs.length > 1 ? pack.homeTabs : null
|
|
120
120
|
const [tabLabel, setTabLabel] = useState(() => tabs?.[0].label ?? null)
|
|
121
121
|
const tab = tabs ? (tabs.find((t) => t.label === tabLabel) ?? tabs[0]) : null
|
|
122
|
-
const tabButtons = useMemo(() => tabs?.map(({ label }) => ({ value: label, label })) ?? [], [tabs])
|
|
122
|
+
const tabButtons = useMemo(() => tabs?.map(({ label }) => ({ value: label, label, labelStyle: pack.labelStyle })) ?? [], [tabs, pack.labelStyle])
|
|
123
123
|
const tabBar = tab && <SegmentedButtons value={tab.label} onValueChange={setTabLabel} buttons={tabButtons} theme={SEGMENT_THEME} style={[styles.tabs, pack.Backdrop && { backgroundColor: colors.surface }]} />
|
|
124
124
|
const columnClamp = useClampOnShrink()
|
|
125
125
|
const gridClamp = useClampOnShrink()
|
|
@@ -285,6 +285,7 @@ interface GameRowProps {
|
|
|
285
285
|
export const ROW_BLURB_LINES = 3
|
|
286
286
|
|
|
287
287
|
function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPress, onRules }: GameRowProps) {
|
|
288
|
+
const { titleStyle } = usePack()
|
|
288
289
|
const well = useWellColors()
|
|
289
290
|
const GameIcon = game.icon
|
|
290
291
|
return (
|
|
@@ -294,7 +295,7 @@ function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPres
|
|
|
294
295
|
<Pressable onPress={onPress} style={[styles.row, { backgroundColor: well.bg }]} accessibilityRole='button' accessibilityLabel={game.title}>
|
|
295
296
|
{game.Preview ? <PreviewBox game={game} width={ROW_PREVIEW_WIDTH} revealed={previewRevealed} dark={dark} p1Color={p1Color} p2Color={p2Color} /> : <View style={[styles.rowIcon, { backgroundColor: dark ? ICON_DARK_BG : ICON_LIGHT_BG }]}>{GameIcon && <GameIcon size={ROW_ICON_SIZE} p1Color={p1Color} p2Color={p2Color} dark={dark} />}</View>}
|
|
296
297
|
<View style={styles.rowText}>
|
|
297
|
-
<Text variant='titleLarge' style={[styles.rowTitle, { color: well.fg }]} numberOfLines={1}>
|
|
298
|
+
<Text variant='titleLarge' style={[styles.rowTitle, { color: well.fg }, titleStyle]} numberOfLines={1}>
|
|
298
299
|
{game.title}
|
|
299
300
|
</Text>
|
|
300
301
|
{/* Three lines, as a tile allows: a narrow phone (an iPhone SE, a 411dp Android phone) wraps a
|
|
@@ -322,12 +323,13 @@ interface GameTileProps extends GameRowProps {
|
|
|
322
323
|
// name and blurb under it, since a row needs ~290pt, more than a grid column beside the hero has. The
|
|
323
324
|
// rules button floats over the preview's corner, beside the tile's button rather than inside it.
|
|
324
325
|
function GameTile({ game, hidden, width, previewWidth, dark, p1Color, p2Color, previewRevealed, onPress, onRules }: GameTileProps) {
|
|
326
|
+
const { titleStyle } = usePack()
|
|
325
327
|
const well = useWellColors()
|
|
326
328
|
return (
|
|
327
329
|
<View style={[{ width }, hidden && styles.hidden]}>
|
|
328
330
|
<Pressable onPress={onPress} style={[styles.tile, { backgroundColor: well.bg }]} accessibilityRole='button' accessibilityLabel={game.title}>
|
|
329
331
|
<PreviewBox game={game} width={previewWidth} revealed={previewRevealed} dark={dark} p1Color={p1Color} p2Color={p2Color} />
|
|
330
|
-
<Text variant='titleMedium' style={[styles.rowTitle, { color: well.fg }]} numberOfLines={1}>
|
|
332
|
+
<Text variant='titleMedium' style={[styles.rowTitle, { color: well.fg }, titleStyle]} numberOfLines={1}>
|
|
331
333
|
{game.title}
|
|
332
334
|
</Text>
|
|
333
335
|
<Text variant='bodySmall' style={{ color: well.fgMuted }} numberOfLines={3}>
|
|
@@ -81,6 +81,8 @@ const useNoPackReset = () => null
|
|
|
81
81
|
|
|
82
82
|
// No placement of the pack's own: hud places the pickers' menus itself.
|
|
83
83
|
const noPickerAlign = () => undefined
|
|
84
|
+
// No player of the pack's own to open on.
|
|
85
|
+
const useNoStatsPlayer = (): string | null => null
|
|
84
86
|
|
|
85
87
|
function StatsContent({ pickerHost }: { pickerHost: PopoverHost }) {
|
|
86
88
|
const pack = usePack()
|
|
@@ -92,10 +94,13 @@ function StatsContent({ pickerHost }: { pickerHost: PopoverHost }) {
|
|
|
92
94
|
|
|
93
95
|
const [tab, setTab] = useState<string>(STATS)
|
|
94
96
|
const [gameId, setGameId] = useState<string>(ALL_GAMES)
|
|
95
|
-
// Opens on
|
|
96
|
-
//
|
|
97
|
-
//
|
|
98
|
-
|
|
97
|
+
// Opens on the pack's own player where it says who is playing (PackDefinition.useStatsPlayer), on
|
|
98
|
+
// whoever is in seat 1 (Guest for a guest) where the pack keeps a guest's stats, else on Everyone.
|
|
99
|
+
// Self-heals to Everyone if the selected profile is deleted while this screen is mounted, and from
|
|
100
|
+
// Guest once there is no profile (Everyone is then just the guest).
|
|
101
|
+
const useStatsPlayer = pack.useStatsPlayer ?? useNoStatsPlayer
|
|
102
|
+
const statsPlayer = useStatsPlayer()
|
|
103
|
+
const [selectedProfileId, setSelectedProfileId] = useState<string | null>(() => (pack.useStatsPlayer ? statsPlayer : pack.guestStats ? (lastSelected[1] ?? GUEST_PLAYER_ID) : null))
|
|
99
104
|
const profileId = selectedProfileId && profiles.length > 0 && ((pack.guestStats && selectedProfileId === GUEST_PLAYER_ID) || profiles.some((p) => p.id === selectedProfileId)) ? selectedProfileId : null
|
|
100
105
|
|
|
101
106
|
const games = gameId === ALL_GAMES ? pack.games : pack.games.filter((g) => g.id === gameId)
|
|
@@ -106,7 +111,11 @@ function StatsContent({ pickerHost }: { pickerHost: PopoverHost }) {
|
|
|
106
111
|
|
|
107
112
|
const playerOptions = useMemo<OptionPickerOption<string>[]>(() => [{ value: EVERYONE, label: 'Everyone', icon: 'account-group' }, ...(pack.guestStats ? [{ value: GUEST_PLAYER_ID, label: 'Guest', icon: 'account-outline' }] : []), ...profiles.map((p) => ({ value: p.id, label: p.name, icon: 'account', color: pack.previewColor ? pack.previewColor(p.color, dark) : p.color }))], [profiles, pack, dark])
|
|
108
113
|
const gameOptions = useMemo<OptionPickerOption<string>[]>(() => [{ value: ALL_GAMES, label: 'All Games', icon: 'view-grid-outline' }, ...pack.games.map((g) => ({ value: g.id, label: g.title }))], [pack.games])
|
|
109
|
-
|
|
114
|
+
// The pack's label lettering (PackDefinition.labelStyle) on each tab.
|
|
115
|
+
const tabButtons = useMemo(() => {
|
|
116
|
+
const buttons = packTabs.length > 0 ? [{ value: STATS, label: 'Stats' }, ...packTabs.map(({ value, label }) => ({ value, label })), { value: ACHIEVEMENTS, label: 'Achievements' }].map((button) => ({ ...button, style: LABEL_WIDE_TAB })) : TABS
|
|
117
|
+
return pack.labelStyle ? buttons.map((button) => ({ ...button, labelStyle: pack.labelStyle })) : buttons
|
|
118
|
+
}, [packTabs, pack.labelStyle])
|
|
110
119
|
const title = tab === STATS ? 'Stats' : tab === ACHIEVEMENTS ? 'Achievements' : (packTab?.label ?? '')
|
|
111
120
|
|
|
112
121
|
// Reset: the pack's own (PackDefinition.resetStats) follows the player picker, one player's or
|
|
@@ -129,7 +138,7 @@ function StatsContent({ pickerHost }: { pickerHost: PopoverHost }) {
|
|
|
129
138
|
const PackTabContent = packTab?.Content
|
|
130
139
|
|
|
131
140
|
return (
|
|
132
|
-
<BaseStatsScreen title={title} onBack={safeBack} insets={insets} onReset={reset.onReset} resetLabel={reset.label} resetConfirmTitle={reset.title} resetConfirmBody={reset.body} fg={pack.foreground} bg={pack.Backdrop ? 'transparent' : undefined}>
|
|
141
|
+
<BaseStatsScreen title={title} titleStyle={pack.titleStyle} onBack={safeBack} insets={insets} onReset={reset.onReset} resetLabel={reset.label} resetConfirmTitle={reset.title} resetConfirmBody={reset.body} fg={pack.foreground} bg={pack.Backdrop ? 'transparent' : undefined}>
|
|
133
142
|
{/* Inside the page, not before it: BaseStatsScreen paints an opaque full-screen container that
|
|
134
143
|
would hide a tap catcher placed underneath it. Over the stat sections and under the open
|
|
135
144
|
filters (pressAway's zIndex sits below filtersOpen's), so a tap anywhere on the page but a
|
|
@@ -169,13 +178,14 @@ function resetFor(pack: PackDefinition, packReset: ((profileId: string | null) =
|
|
|
169
178
|
// One game's part of the page: its own sections, under its name when more than one game is shown. A
|
|
170
179
|
// game with no achievement list of its own shows nothing on Achievements.
|
|
171
180
|
function GameStats({ game, tab, profileId, showTitle, titleColor }: { game: PackGameDefinition; tab: string; profileId: string | null; showTitle: boolean; titleColor: string }) {
|
|
181
|
+
const { titleStyle } = usePack()
|
|
172
182
|
const { StatsSections, AchievementList } = game
|
|
173
183
|
const Sections = tab === STATS ? StatsSections : AchievementList
|
|
174
184
|
if (!Sections) return null
|
|
175
185
|
return (
|
|
176
186
|
<View style={styles.game}>
|
|
177
187
|
{showTitle && (
|
|
178
|
-
<Text variant='titleLarge' style={[styles.gameTitle, { color: titleColor }]}>
|
|
188
|
+
<Text variant='titleLarge' style={[styles.gameTitle, { color: titleColor }, titleStyle]}>
|
|
179
189
|
{game.title}
|
|
180
190
|
</Text>
|
|
181
191
|
)}
|
package/src/types.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type { MenuOption } from '@tastic/hud/lobby'
|
|
|
5
5
|
import type { FontSource } from 'expo-font'
|
|
6
6
|
import type { Href, Stack } from 'expo-router'
|
|
7
7
|
import type { ComponentProps, ComponentType, ReactNode } from 'react'
|
|
8
|
+
import type { TextStyle } from 'react-native'
|
|
8
9
|
import type { Action, Reducer } from 'redux'
|
|
9
10
|
|
|
10
11
|
import type { ShellState } from './redux/shellState'
|
|
@@ -304,6 +305,14 @@ export interface PackDefinition {
|
|
|
304
305
|
fonts?: Record<string, FontSource>
|
|
305
306
|
// The typeface every Paper text variant is set in (auto-paper's Provider). Unset is Paper's own.
|
|
306
307
|
fontFamily?: string
|
|
308
|
+
// The lettering of the pack's titles alone (a title font, AlphaTastic's), laid over each title's own
|
|
309
|
+
// type: Home's game cards, the stats screen's title and game headings, and every hud dialog's title
|
|
310
|
+
// (through hud's DialogHeaderStyleProvider, in the standard tone). Unset, titles keep their type.
|
|
311
|
+
titleStyle?: TextStyle
|
|
312
|
+
// The lettering of the pack's small labels alone, laid over each one's own type: the stats screen's
|
|
313
|
+
// tabs and section headings, the Settings sheet's sections and every picker pill (through hud's
|
|
314
|
+
// LetteringProvider). Unset, labels keep their type.
|
|
315
|
+
labelStyle?: TextStyle
|
|
307
316
|
// The version label in Settings: src/constants/release.ts's otaVersion, which the OTA tooling bumps.
|
|
308
317
|
otaVersion: number
|
|
309
318
|
// The pack's own Settings sections (how cards look, how play is helped along), in every Settings
|
|
@@ -362,6 +371,11 @@ export interface PackDefinition {
|
|
|
362
371
|
// The stats screen keeps a guest's stats under GUEST_PLAYER_ID: a Guest entry in the player picker
|
|
363
372
|
// once a profile exists, and the screen opens on whoever is in seat 1.
|
|
364
373
|
guestStats?: boolean
|
|
374
|
+
// The profile the stats screen opens on, for a pack that keeps its own idea of who is playing (a
|
|
375
|
+
// hook, called on every render of the screen; only its value as the screen mounts is used): the
|
|
376
|
+
// player picker starts there, and on Everyone when it's null or not a profile. Without it, Everyone
|
|
377
|
+
// (or seat 1's player, with guestStats).
|
|
378
|
+
useStatsPlayer?: () => string | null
|
|
365
379
|
// One achievement list across the pack's games, on the Achievements tab (the game picker hidden there).
|
|
366
380
|
AchievementList?: ComponentType<{ profileId: string | null }>
|
|
367
381
|
// Tabs of the pack's own between Stats and Achievements.
|