@tastic/shell 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,6 +8,9 @@ leave out its seat 2 and its loadout, come back on a cold launch, and show a pre
8
8
  pack for one player at a time (CardTastic, Solitaire renamed) can lay its own table, theme, toaster,
9
9
  How to Play and stats tabs into the same screens.
10
10
 
11
+ The stats screen's player picker is always there, with no profile yet too: Everyone, each profile
12
+ (and Guest, with `guestStats`, once one exists), then Manage, which opens the Profiles screen.
13
+
11
14
  Built from the shell PuckTastic and DuelTastic each carried in `src/shell/` (made identical on
12
15
  2026-10-28), so the packs and the next ones (CardTastic) share one copy. Part of the `@tastic`
13
16
  package ecosystem, on [`@tastic/hud`](https://github.com/jayrdeaton/react-native-hud),
package/dist/index.js CHANGED
@@ -1488,6 +1488,7 @@ function ProfilesRoute() {
1488
1488
  var import_auto_paper7 = require("@rific/auto-paper");
1489
1489
  var import_chrome7 = require("@tastic/hud/chrome");
1490
1490
  var import_profile9 = require("@tastic/profile");
1491
+ var import_expo_router7 = require("expo-router");
1491
1492
  var import_react17 = require("react");
1492
1493
  var import_react_native10 = require("react-native");
1493
1494
  var import_react_native_paper2 = require("react-native-paper");
@@ -1506,6 +1507,8 @@ var EVERYONE = "__everyone__";
1506
1507
  var ALL_GAMES = "__all__";
1507
1508
  var PLAYER_PICKER_ID = "stats-player";
1508
1509
  var GAME_PICKER_ID = "stats-game";
1510
+ var MANAGE = "__manage__";
1511
+ var MANAGE_OPTION = { value: MANAGE, label: "Manage", icon: "account-cog-outline", dividerBefore: true };
1509
1512
  var STATS_MAX_WIDTH = 640;
1510
1513
  function StatsScreen() {
1511
1514
  const pickerHost = (0, import_chrome7.usePopoverHost)();
@@ -1534,7 +1537,7 @@ function StatsContent({ pickerHost }) {
1534
1537
  const packTabs = pack.statsTabs ?? NO_PACK_TABS;
1535
1538
  const packTab = packTabs.find((t) => t.value === tab);
1536
1539
  const showGamePicker = !(tab === ACHIEVEMENTS && pack.AchievementList);
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]);
1540
+ const playerOptions = (0, import_react17.useMemo)(() => [{ value: EVERYONE, label: "Everyone", icon: "account-group" }, ...pack.guestStats && profiles.length > 0 ? [{ value: GUEST_PLAYER_ID, label: "Guest", icon: "account-outline" }] : [], ...profiles.map((p) => ({ value: p.id, label: p.name, icon: "account", color: pack.previewColor ? pack.previewColor(p.color, dark) : p.color })), MANAGE_OPTION], [profiles, pack, dark]);
1538
1541
  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]);
1539
1542
  const tabButtons = (0, import_react17.useMemo)(() => {
1540
1543
  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;
@@ -1545,7 +1548,7 @@ function StatsContent({ pickerHost }) {
1545
1548
  const packReset = usePackReset();
1546
1549
  const reset = resetFor(pack, packReset, profileId, profiles, games, () => games.forEach((g) => g.resetStats && dispatch(g.resetStats())));
1547
1550
  const usePickerAlign = pack.usePickerAlign ?? noPickerAlign2;
1548
- const playerSize = (0, import_profile9.getOptionPickerContentSize)(playerOptions.length);
1551
+ const playerSize = (0, import_profile9.getOptionPickerContentSize)(playerOptions);
1549
1552
  const gameSize = (0, import_profile9.getOptionPickerContentSize)(gameOptions.length);
1550
1553
  const playerAlign = usePickerAlign(pickerHost.openId === PLAYER_PICKER_ID, playerSize.width, playerSize.height);
1551
1554
  const gameAlign = usePickerAlign(pickerHost.openId === GAME_PICKER_ID, gameSize.width, gameSize.height);
@@ -1556,7 +1559,7 @@ function StatsContent({ pickerHost }) {
1556
1559
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_chrome7.PressAwayOverlay, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles5.pressAway }),
1557
1560
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper2.SegmentedButtons, { value: tab, onValueChange: setTab, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles5.tabs, surface] }),
1558
1561
  /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native10.View, { style: [styles5.filters, pickerHost.openId !== null && styles5.filtersOpen], onStartShouldSetResponder: () => pickerHost.openId !== null, children: [
1559
- profiles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_profile9.OptionPicker, { id: PLAYER_PICKER_ID, host: pickerHost, options: playerOptions, value: profileId ?? EVERYONE, onChange: (value) => setSelectedProfileId(value === EVERYONE ? null : value), color: colors.primary, dark, icon: profileId ? "account" : "account-group", alignOverride: playerAlign, triggerStyle }),
1562
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_profile9.OptionPicker, { id: PLAYER_PICKER_ID, host: pickerHost, options: playerOptions, value: profileId ?? EVERYONE, onChange: (value) => value === MANAGE ? import_expo_router7.router.push(PROFILES_HREF) : setSelectedProfileId(value === EVERYONE ? null : value), color: colors.primary, dark, icon: profileId ? "account" : "account-group", alignOverride: playerAlign, triggerStyle }),
1560
1563
  showGamePicker && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_profile9.OptionPicker, { id: GAME_PICKER_ID, host: pickerHost, options: gameOptions, value: gameId, onChange: setGameId, color: colors.primary, dark, icon: "view-grid-outline", alignOverride: gameAlign, triggerStyle })
1561
1564
  ] }),
1562
1565
  tab === STATS && pack.StatsSections && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(pack.StatsSections, { profileId, gameId: gameId === ALL_GAMES ? null : gameId }),
@@ -1673,7 +1676,7 @@ function useActiveRound(game, defaults) {
1673
1676
  }
1674
1677
 
1675
1678
  // src/hooks/useBackBlock.ts
1676
- var import_expo_router7 = require("expo-router");
1679
+ var import_expo_router8 = require("expo-router");
1677
1680
  var import_react19 = require("react");
1678
1681
  function useBackBlock(held, onHeld, leave = import_core8.safeBack) {
1679
1682
  const leavingRef = (0, import_react19.useRef)(false);
@@ -1682,7 +1685,7 @@ function useBackBlock(held, onHeld, leave = import_core8.safeBack) {
1682
1685
  (0, import_react19.useEffect)(() => {
1683
1686
  leaveRef.current = leave;
1684
1687
  });
1685
- (0, import_expo_router7.usePreventRemove)(held && !leaving, ({ repeat }) => {
1688
+ (0, import_expo_router8.usePreventRemove)(held && !leaving, ({ repeat }) => {
1686
1689
  if (leavingRef.current) {
1687
1690
  setLeaving(true);
1688
1691
  repeat();
package/dist/index.mjs CHANGED
@@ -1410,6 +1410,7 @@ function ProfilesRoute() {
1410
1410
  import { useAutoPaperTheme as useAutoPaperTheme5 } from "@rific/auto-paper";
1411
1411
  import { BaseStatsScreen, PressAwayOverlay as PressAwayOverlay3, ScreenFrame as ScreenFrame3, usePopoverHost as usePopoverHost3 } from "@tastic/hud/chrome";
1412
1412
  import { getOptionPickerContentSize as getOptionPickerContentSize2, OptionPicker as OptionPicker2 } from "@tastic/profile";
1413
+ import { router as router4 } from "expo-router";
1413
1414
  import { useMemo as useMemo7, useState as useState7 } from "react";
1414
1415
  import { StyleSheet as StyleSheet5, View as View5 } from "react-native";
1415
1416
  import { SegmentedButtons as SegmentedButtons2, Text as Text2 } from "react-native-paper";
@@ -1428,6 +1429,8 @@ var EVERYONE = "__everyone__";
1428
1429
  var ALL_GAMES = "__all__";
1429
1430
  var PLAYER_PICKER_ID = "stats-player";
1430
1431
  var GAME_PICKER_ID = "stats-game";
1432
+ var MANAGE = "__manage__";
1433
+ var MANAGE_OPTION = { value: MANAGE, label: "Manage", icon: "account-cog-outline", dividerBefore: true };
1431
1434
  var STATS_MAX_WIDTH = 640;
1432
1435
  function StatsScreen() {
1433
1436
  const pickerHost = usePopoverHost3();
@@ -1456,7 +1459,7 @@ function StatsContent({ pickerHost }) {
1456
1459
  const packTabs = pack.statsTabs ?? NO_PACK_TABS;
1457
1460
  const packTab = packTabs.find((t) => t.value === tab);
1458
1461
  const showGamePicker = !(tab === ACHIEVEMENTS && pack.AchievementList);
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]);
1462
+ const playerOptions = useMemo7(() => [{ value: EVERYONE, label: "Everyone", icon: "account-group" }, ...pack.guestStats && profiles.length > 0 ? [{ value: GUEST_PLAYER_ID, label: "Guest", icon: "account-outline" }] : [], ...profiles.map((p) => ({ value: p.id, label: p.name, icon: "account", color: pack.previewColor ? pack.previewColor(p.color, dark) : p.color })), MANAGE_OPTION], [profiles, pack, dark]);
1460
1463
  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]);
1461
1464
  const tabButtons = useMemo7(() => {
1462
1465
  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;
@@ -1467,7 +1470,7 @@ function StatsContent({ pickerHost }) {
1467
1470
  const packReset = usePackReset();
1468
1471
  const reset = resetFor(pack, packReset, profileId, profiles, games, () => games.forEach((g) => g.resetStats && dispatch(g.resetStats())));
1469
1472
  const usePickerAlign = pack.usePickerAlign ?? noPickerAlign2;
1470
- const playerSize = getOptionPickerContentSize2(playerOptions.length);
1473
+ const playerSize = getOptionPickerContentSize2(playerOptions);
1471
1474
  const gameSize = getOptionPickerContentSize2(gameOptions.length);
1472
1475
  const playerAlign = usePickerAlign(pickerHost.openId === PLAYER_PICKER_ID, playerSize.width, playerSize.height);
1473
1476
  const gameAlign = usePickerAlign(pickerHost.openId === GAME_PICKER_ID, gameSize.width, gameSize.height);
@@ -1478,7 +1481,7 @@ function StatsContent({ pickerHost }) {
1478
1481
  /* @__PURE__ */ jsx17(PressAwayOverlay3, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles5.pressAway }),
1479
1482
  /* @__PURE__ */ jsx17(SegmentedButtons2, { value: tab, onValueChange: setTab, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles5.tabs, surface] }),
1480
1483
  /* @__PURE__ */ jsxs6(View5, { style: [styles5.filters, pickerHost.openId !== null && styles5.filtersOpen], onStartShouldSetResponder: () => pickerHost.openId !== null, children: [
1481
- profiles.length > 0 && /* @__PURE__ */ jsx17(OptionPicker2, { id: PLAYER_PICKER_ID, host: pickerHost, options: playerOptions, value: profileId ?? EVERYONE, onChange: (value) => setSelectedProfileId(value === EVERYONE ? null : value), color: colors.primary, dark, icon: profileId ? "account" : "account-group", alignOverride: playerAlign, triggerStyle }),
1484
+ /* @__PURE__ */ jsx17(OptionPicker2, { id: PLAYER_PICKER_ID, host: pickerHost, options: playerOptions, value: profileId ?? EVERYONE, onChange: (value) => value === MANAGE ? router4.push(PROFILES_HREF) : setSelectedProfileId(value === EVERYONE ? null : value), color: colors.primary, dark, icon: profileId ? "account" : "account-group", alignOverride: playerAlign, triggerStyle }),
1482
1485
  showGamePicker && /* @__PURE__ */ jsx17(OptionPicker2, { id: GAME_PICKER_ID, host: pickerHost, options: gameOptions, value: gameId, onChange: setGameId, color: colors.primary, dark, icon: "view-grid-outline", alignOverride: gameAlign, triggerStyle })
1483
1486
  ] }),
1484
1487
  tab === STATS && pack.StatsSections && /* @__PURE__ */ jsx17(pack.StatsSections, { profileId, gameId: gameId === ALL_GAMES ? null : gameId }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tastic/shell",
3
- "version": "0.13.0",
3
+ "version": "0.14.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",
@@ -1,6 +1,7 @@
1
1
  import { useAutoPaperTheme } from '@rific/auto-paper'
2
2
  import { BaseStatsScreen, type PopoverHost, PressAwayOverlay, ScreenFrame, usePopoverHost } from '@tastic/hud/chrome'
3
3
  import { getOptionPickerContentSize, OptionPicker, type OptionPickerOption } from '@tastic/profile'
4
+ import { router } from 'expo-router'
4
5
  import { type ReactNode, useMemo, useState } from 'react'
5
6
  import { StyleSheet, View } from 'react-native'
6
7
  import { SegmentedButtons, Text } from 'react-native-paper'
@@ -11,6 +12,7 @@ import { SEGMENT_RADIUS, SEGMENT_THEME } from '../components/segmentTheme'
11
12
  import { useProfiles } from '../hooks/useProfiles'
12
13
  import { safeBack } from '../navigation'
13
14
  import { usePack } from '../PackContext'
15
+ import { PROFILES_HREF } from '../routes'
14
16
  import { GUEST_PLAYER_ID, type PackDefinition, type PackGameDefinition, type PackStatsTab } from '../types'
15
17
 
16
18
  // Two tabs, as on Solitaire's stats screen: a page with every game's stats above the achievements
@@ -38,12 +40,16 @@ const ALL_GAMES = '__all__'
38
40
 
39
41
  const PLAYER_PICKER_ID = 'stats-player'
40
42
  const GAME_PICKER_ID = 'stats-game'
43
+ // The player picker's last row: not a player, the way to the Profiles screen.
44
+ const MANAGE = '__manage__'
45
+ const MANAGE_OPTION: OptionPickerOption<string> = { value: MANAGE, label: 'Manage', icon: 'account-cog-outline', dividerBefore: true }
41
46
 
42
47
  // Widest the column gets in the wide layout (a landscape phone, a desktop window): a list of stat
43
48
  // rows stretched across an 874pt-wide screen reads badly. Upright it's never capped.
44
49
  const STATS_MAX_WIDTH = 640
45
50
 
46
- // Every game's stats and achievements on one screen, filtered by player (Everyone, or one profile)
51
+ // Every game's stats and achievements on one screen, filtered by player (Everyone, or one profile, the
52
+ // picker always there with Manage at its end)
47
53
  // and by game (All Games, or one), like Solitaire's. Each game keeps its own stats and its own
48
54
  // achievements; this screen only shows them side by side. With two seats there's no one player to
49
55
  // open on, so it opens on Everyone, and guests count only toward Everyone: two guests in one match
@@ -109,7 +115,9 @@ function StatsContent({ pickerHost }: { pickerHost: PopoverHost }) {
109
115
  // One achievement list across the pack's games doesn't narrow to a game, so the game picker goes.
110
116
  const showGamePicker = !(tab === ACHIEVEMENTS && pack.AchievementList)
111
117
 
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])
118
+ // Always there (Jay, 2026-11-19), with no profile yet too: Everyone, then each profile, then Manage, which
119
+ // opens the Profiles screen to make one.
120
+ const playerOptions = useMemo<OptionPickerOption<string>[]>(() => [{ value: EVERYONE, label: 'Everyone', icon: 'account-group' }, ...(pack.guestStats && profiles.length > 0 ? [{ value: GUEST_PLAYER_ID, label: 'Guest', icon: 'account-outline' }] : []), ...profiles.map((p) => ({ value: p.id, label: p.name, icon: 'account', color: pack.previewColor ? pack.previewColor(p.color, dark) : p.color })), MANAGE_OPTION], [profiles, pack, dark])
113
121
  const gameOptions = useMemo<OptionPickerOption<string>[]>(() => [{ value: ALL_GAMES, label: 'All Games', icon: 'view-grid-outline' }, ...pack.games.map((g) => ({ value: g.id, label: g.title }))], [pack.games])
114
122
  // The pack's label lettering (PackDefinition.labelStyle) on each tab.
115
123
  const tabButtons = useMemo(() => {
@@ -127,7 +135,7 @@ function StatsContent({ pickerHost }: { pickerHost: PopoverHost }) {
127
135
 
128
136
  // The pack's own placement for the pickers' menus (PackDefinition.usePickerAlign), sized from their rows.
129
137
  const usePickerAlign = pack.usePickerAlign ?? noPickerAlign
130
- const playerSize = getOptionPickerContentSize(playerOptions.length)
138
+ const playerSize = getOptionPickerContentSize(playerOptions)
131
139
  const gameSize = getOptionPickerContentSize(gameOptions.length)
132
140
  const playerAlign = usePickerAlign(pickerHost.openId === PLAYER_PICKER_ID, playerSize.width, playerSize.height)
133
141
  const gameAlign = usePickerAlign(pickerHost.openId === GAME_PICKER_ID, gameSize.width, gameSize.height)
@@ -149,7 +157,7 @@ function StatsContent({ pickerHost }: { pickerHost: PopoverHost }) {
149
157
  {/* Takes a press on its own blank parts (the gap, an open menu's padding) while a menu is open, so
150
158
  it never reaches StatsPressAway. */}
151
159
  <View style={[styles.filters, pickerHost.openId !== null && styles.filtersOpen]} onStartShouldSetResponder={() => pickerHost.openId !== null}>
152
- {profiles.length > 0 && <OptionPicker id={PLAYER_PICKER_ID} host={pickerHost} options={playerOptions} value={profileId ?? EVERYONE} onChange={(value) => setSelectedProfileId(value === EVERYONE ? null : value)} color={colors.primary} dark={dark} icon={profileId ? 'account' : 'account-group'} alignOverride={playerAlign} triggerStyle={triggerStyle} />}
160
+ <OptionPicker id={PLAYER_PICKER_ID} host={pickerHost} options={playerOptions} value={profileId ?? EVERYONE} onChange={(value) => (value === MANAGE ? router.push(PROFILES_HREF) : setSelectedProfileId(value === EVERYONE ? null : value))} color={colors.primary} dark={dark} icon={profileId ? 'account' : 'account-group'} alignOverride={playerAlign} triggerStyle={triggerStyle} />
153
161
  {showGamePicker && <OptionPicker id={GAME_PICKER_ID} host={pickerHost} options={gameOptions} value={gameId} onChange={setGameId} color={colors.primary} dark={dark} icon='view-grid-outline' alignOverride={gameAlign} triggerStyle={triggerStyle} />}
154
162
  </View>
155
163