@tastic/shell 0.19.0 → 0.21.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
@@ -11,6 +11,11 @@ How to Play and stats tabs into the same screens.
11
11
  The stats screen's player picker is always there, with no profile yet too: Everyone, each profile
12
12
  (and Guest, with `guestStats`, once one exists), then Manage, which opens the Profiles screen.
13
13
 
14
+ Every seat button names its seat in a small caption over it (0.20.0+, on `@tastic/profile` 0.29.0 and
15
+ `@tastic/hud` 0.40.0), as the stats screen's PLAYER and GAME pickers do: PLAYER over seat 1's button on
16
+ Home and in a loadout with one person, PLAYER 1 and PLAYER 2 in 2 Player's halves, and OPPONENT over
17
+ player 1's opponent button.
18
+
14
19
  Built from the shell PuckTastic and DuelTastic each carried in `src/shell/` (made identical on
15
20
  2026-10-28), so the packs and the next ones (CardTastic) share one copy. Part of the `@tastic`
16
21
  package ecosystem, on [`@tastic/hud`](https://github.com/jayrdeaton/react-native-hud),
@@ -126,7 +131,7 @@ PuckTastic and DuelTastic draw what they always did:
126
131
  | `foreground?` | The color of what those screens draw straight on the background (the hero, the corner buttons, headers), and at half strength a loadout's muted options. Unset is black or white with the theme. |
127
132
  | `Provider?` | Mounted once around How to Play and the stack, inside the store, the theme, profiles and every game's `Provider` (one stats context across the pack's games). |
128
133
  | `useScreenOptions?` | A hook returning stack screen options (`StackScreenOptions`), merged after the shell's own (a status bar style of the pack's own, Reduce Motion's crossfade). The shell's already follow the app's theme, and stay dark over a `Backdrop`. They also slide a replaced screen in as a pop (`animationTypeForReplace: 'pop'`) on every screen but a play screen, since a replace there is a way back with nothing beneath to pop to (`safeBack`'s fallback to Home, a `dismissTo` whose screen isn't on the stack). |
129
- | `useFeedbackSounds?` | A hook returning the two sounds every button plays (`FeedbackSounds`: `selection`, `notification`), in place of the shell's two wavs. |
134
+ | `useFeedbackSounds?` | A hook returning the two sounds every button plays (`FeedbackSounds`: `selection`, `notification`), in place of the shell's two wavs. The shell's own make no players while Sound is off; a pack's pools can do the same with `useAudioPool`'s `enabled`, read from the store (`state.sound.enabled`), since the hook runs above feedback-press's provider. |
130
135
  | `Toaster?` | The pack's own toaster, drawn in a frame over the whole app (inside the safe area) in place of the shell's. The toast provider is given no Paper, so nothing portals it out of the frame. |
131
136
  | `edgeGuard?` | `false` leaves Edge Guard out of Settings (no edge controls, no Edge Guard plugin), and out of the play screens' options on Android. |
132
137
  | `seatTheme?` | `(colors, dark) => ({ color, harmony })`: the theme the seats' colors make (a muted seed from seat 1's color), applied whenever they or dark mode change and as a fresh install's theme, in place of a triad of the raw colors. With it, `useSeatColors` reads each seat's color from where it's remembered (`seatColors`) rather than from the theme. |
@@ -144,7 +149,7 @@ PuckTastic and DuelTastic draw what they always did:
144
149
  | `usePickerAlign?` | `(open, contentWidth, contentHeight) => AlignResult` (`PickerAlign`), a hook: where seat 1's menu on Home, both seat buttons' menus in a loadout's one-human row (2 Player keeps each menu in its own player's half) and the stats screen's two pickers open. It was added because hud's own placement measured a button in a frame turned by `@tastic/core`'s drawn rotation against the upright window (Solitaire's `useFrameAutoAlign`); nothing turns since core 0.15, so a pack may no longer need one. (A profile's color swatch used it too, until the swatches moved onto the Edit Profile screen.) Unset is hud's placement. |
145
150
  | `resumeHref?` | `(gameId) => Href \| null`: where a cold launch goes back into a resumable game, for a pack with more than one way to be playing it. Null, or unset, is the game's play screen. |
146
151
  | `homePlayerPicker?` | `false` leaves seat 1's button off Home, for a pack whose every game opens a loadout, where the player is picked anyway. |
147
- | `homeTabs?` | Tabs splitting Home's games (`HomeTab`: a `label`, and `includes(game)`, which of the pack's games it shows, in the pack's order): a switch under seat 1's button, or over the grid on a wide screen, on the theme's surface over a `Backdrop`, showing one tab's games at a time. It opens on the first tab and keeps the one picked while Home is covered or the window changes. The other tabs' games stay mounted, hidden, so a switch draws nothing new. A game no tab includes isn't on Home. Unset, or a single tab, shows every game with no switch. Solitaire's: Solitaire (no `seatTwo`) and Two Player. The stats screen's game picker groups its games by them too: All Games, then a row per tab opening its page of an All row (the pill then reads the tab's name) and its games. |
152
+ | `homeTabs?` | Tabs splitting Home's games (`HomeTab`: a `label`, and `includes(game)`, which of the pack's games it shows, in the pack's order): a switch under seat 1's button, or over the grid on a wide screen, on the theme's surface over a `Backdrop`, showing one tab's games at a time. It opens on the first tab and keeps the one picked while Home is covered or the window changes. The other tabs' games are built once Home has been on screen a moment (at once on the web, or when their tab is picked), and stay mounted, hidden, so a switch draws nothing new. A game no tab includes isn't on Home. Unset, or a single tab, shows every game with no switch. Solitaire's: Solitaire (no `seatTwo`) and Two Player. The stats screen's game picker groups its games by them too: All Games, then a row per tab opening its page of an All row (the pill then reads the tab's name) and its games. |
148
153
 
149
154
  ### `GameDefinition`
150
155
 
@@ -387,7 +392,7 @@ what the shell started using (noted in the table).
387
392
  | `react`, `react-native` | >=19.3.0, >=0.88.0 | everything |
388
393
  | `expo-router` | >=58.0.23 | the stack, the routes, `safeBack`, focus effects, the web tab title |
389
394
  | `expo-font`, `@expo/vector-icons` | >=58.0.8, >=15.1.1 | the icon font and the pack's `fonts`, behind the splash screen |
390
- | `expo-splash-screen`, `@rific/splash-gate` | >=58.0.10, >=0.2.3 | holding the splash screen until the theme, fonts and profiles are ready |
395
+ | `expo-splash-screen`, `@rific/splash-gate` | >=58.0.10, >=0.2.3 | holding the splash screen until the theme, fonts and profiles are ready and the first screen is drawn |
391
396
  | `expo-constants` | >=58.0.12 | the web tab title |
392
397
  | `expo-blur`, `@react-native-masked-view/masked-view` | >=58.0.4, >=0.3.2 | auto-paper's blur and its scroll fade, Home's fading scrollers |
393
398
  | `expo-haptics`, `expo-keep-awake` | >=58.0.7, >=58.0.3 | the toaster's haptics, Keep Awake |
@@ -397,7 +402,7 @@ what the shell started using (noted in the table).
397
402
  | `@reduxjs/toolkit`, `redux`, `react-redux`, `redux-persist`, `@react-native-async-storage/async-storage` | >=2.13.0, >=5.0.1, >=9.3.0, >=6.0.0, >=2.2.0 | the store and where it's saved |
398
403
  | `@rific/auto-paper` | >=0.13.4 | the theme |
399
404
  | `@rific/core` | >=0.5.0 | settings slices, Keep Awake, `safeBack` |
400
- | `@rific/feedback-press` | >=0.13.1 | haptic and sound settings, the UI sounds |
405
+ | `@rific/feedback-press` | >=0.15.0 | haptic and sound settings, the UI sounds |
401
406
  | `@rific/toaster` | >=0.10.1 | toasts |
402
407
  | `@tastic/core` | >=0.16.0 | the seat mode from the window's shape, the root background, the test for a computer behind `useAtComputer` (0.16.0's `useIsTouchPrimaryDevice`) |
403
408
  | `@tastic/hud` | >=0.37.0 | Settings, the stats screen, the loadout's panels (its Skia-free `/lobby` entry, new in 0.26.0; 0.27.1's options for a pack drawn on its own backdrop; 0.28.0's Ready pill; 0.29.0's leading Settings sections), How to Play, and `ScreenFrame` around the stats screen, Profiles, Edit Profile and the toaster (0.34.0, where `RotatedFrame` became `ScreenFrame`), a pack's lettering (0.35.0's `LetteringProvider`), Settings' Profile row (0.37.0's `profilesRow`) |
package/dist/index.js CHANGED
@@ -125,7 +125,7 @@ var import_react_native = require("react-native");
125
125
 
126
126
  // src/splashGate.ts
127
127
  var import_splash_gate = require("@rific/splash-gate");
128
- var { markReady: markSplashReady, useReady: useSplashReady, pendingGates: pendingSplashGates, Gate: SplashGate } = (0, import_splash_gate.createGate)(["theme", "fonts", "profiles"]);
128
+ var { markReady: markSplashReady, useReady: useSplashReady, pendingGates: pendingSplashGates, Gate: SplashGate } = (0, import_splash_gate.createGate)(["theme", "fonts", "profiles", "screen"]);
129
129
 
130
130
  // src/components/Fonts.tsx
131
131
  var import_jsx_runtime2 = require("react/jsx-runtime");
@@ -252,8 +252,9 @@ var import_react_redux2 = require("react-redux");
252
252
  var import_react4 = require("redux-persist/integration/react");
253
253
  var import_jsx_runtime4 = require("react/jsx-runtime");
254
254
  function useShellFeedbackSounds() {
255
- const selection = (0, import_audio.useAudioPool)(require("./select-MLBNNA4N.wav"));
256
- const notification = (0, import_audio.useAudioPool)(require("./notification-CGGFPYK7.wav"));
255
+ const enabled = (0, import_react_redux2.useSelector)((state) => state.sound.enabled);
256
+ const selection = (0, import_audio.useAudioPool)(require("./select-MLBNNA4N.wav"), { enabled });
257
+ const notification = (0, import_audio.useAudioPool)(require("./notification-CGGFPYK7.wav"), { enabled });
257
258
  return { selection, notification };
258
259
  }
259
260
  var FeedbackBridge = ({ children }) => {
@@ -494,8 +495,17 @@ var REPLACE_AS_BACK = { animationTypeForReplace: "pop" };
494
495
  var REPLACE_AS_FORWARD = { animationTypeForReplace: "push" };
495
496
  var TRANSPARENT_CONTENT = { backgroundColor: "transparent" };
496
497
  var noScreenOptions = () => ({});
498
+ function useFirstScreenGate() {
499
+ const marked = (0, import_react9.useRef)(false);
500
+ return (0, import_react9.useCallback)(() => {
501
+ if (marked.current) return;
502
+ marked.current = true;
503
+ requestAnimationFrame(() => requestAnimationFrame(() => markSplashReady("screen")));
504
+ }, []);
505
+ }
497
506
  function AppStack() {
498
507
  const pack = usePack();
508
+ const onFirstLayout = useFirstScreenGate();
499
509
  const { Backdrop } = pack;
500
510
  const { dark } = (0, import_auto_paper2.useAutoPaperTheme)();
501
511
  const darkRoot = Backdrop ? true : dark;
@@ -519,14 +529,12 @@ function AppStack() {
519
529
  const base = darkRoot ? import_expo_router.DarkTheme : import_expo_router.DefaultTheme;
520
530
  return { ...base, colors: { ...base.colors, background: navigationBackground } };
521
531
  }, [darkRoot, navigationBackground]);
522
- const stack = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_expo_router.ThemeProvider, { value: navigationTheme, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_expo_router.Stack, { screenOptions: { ...rootBackground, statusBarStyle, ...REPLACE_AS_BACK, ...backdropOptions, ...packOptions }, children: [
523
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_expo_router.Stack.Screen, { name: "index" }),
524
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_expo_router.Stack.Screen, { name: "play/[game]", options: playOptions })
525
- ] }) });
526
- if (!Backdrop) return stack;
527
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react_native3.View, { style: styles.root, children: [
528
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Backdrop, {}),
529
- stack
532
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react_native3.View, { style: styles.root, onLayout: onFirstLayout, children: [
533
+ Backdrop && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Backdrop, {}),
534
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_expo_router.ThemeProvider, { value: navigationTheme, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_expo_router.Stack, { screenOptions: { ...rootBackground, statusBarStyle, ...REPLACE_AS_BACK, ...backdropOptions, ...packOptions }, children: [
535
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_expo_router.Stack.Screen, { name: "index" }),
536
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_expo_router.Stack.Screen, { name: "play/[game]", options: playOptions })
537
+ ] }) })
530
538
  ] });
531
539
  }
532
540
  function GatedApp({ children }) {
@@ -695,7 +703,7 @@ function OpponentPicker({ idPrefix, host, choices, seatTwo, onSeatTwoChange, cpu
695
703
  const size = (0, import_profile6.getOptionPickerContentSize)(options, colorSection);
696
704
  const useAlign = usePickerAlign ?? import_lobby.useZoneClampedAlign;
697
705
  const align = useAlign(host.openId === pickerId, size.width, size.height);
698
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native4.View, { style: [styles2.button, host.openId === pickerId && styles2.buttonOpen], children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_profile6.OptionPicker, { id: pickerId, host, options, value, onChange: handleChange, color: drawn, dark, icon, colorSection, alignOverride: align, triggerStyle }) });
706
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native4.View, { style: [styles2.button, host.openId === pickerId && styles2.buttonOpen], children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_profile6.OptionPicker, { id: pickerId, host, caption: "Opponent", options, value, onChange: handleChange, color: drawn, dark, icon, colorSection, alignOverride: align, triggerStyle }) });
699
707
  }
700
708
  var styles2 = import_react_native4.StyleSheet.create({
701
709
  // Its own column, so a row of seat buttons doesn't stretch the pill to the tallest of them.
@@ -960,7 +968,8 @@ function LoadoutScreen({ game }) {
960
968
  const p1ControlOpen = controlsHost.openId === P1_CONTROL_ID;
961
969
  const controlLook = { accentColor: themeColors.tertiary, mutedColor: fgMuted, dark };
962
970
  const p1Control = loadout.seatControl(1, controlsHost, { ...controlLook, seatColor: p1Drawn });
963
- const p1Panel = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lobby2.PlayerSetupPanel, { idPrefix: "p1", host: controlsHost, color: p1Color, onColorChange: handleP1ColorChange, swatches: import_auto_paper5.defaultColors, takenColor: p2Exists ? p2Color : void 0, allowSwapTaken: mode === "vsCpu", colorCaption: pack.colorCaption, isHuman: true, dark, showReadyButton: false, profiles, selectedProfileId: lastSelected[1], takenProfileId: p2IsHuman ? lastSelected[2] : null, guestLabel: pack.guestLabel ?? "P1", nullLabel: pack.nullLabel, onProfileSelect: handleP1ProfileSelect, onManageProfiles: () => import_expo_router7.router.push(profilesHref(1)), previewValue: seatPreview, triggerStyle, useSeatPickerAlign: seatPickerAlign }, `p1-${layoutKey}`);
971
+ const p1Caption = p2IsHuman ? "Player 1" : "Player";
972
+ const p1Panel = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lobby2.PlayerSetupPanel, { idPrefix: "p1", caption: p1Caption, host: controlsHost, color: p1Color, onColorChange: handleP1ColorChange, swatches: import_auto_paper5.defaultColors, takenColor: p2Exists ? p2Color : void 0, allowSwapTaken: mode === "vsCpu", colorCaption: pack.colorCaption, isHuman: true, dark, showReadyButton: false, profiles, selectedProfileId: lastSelected[1], takenProfileId: p2IsHuman ? lastSelected[2] : null, guestLabel: pack.guestLabel ?? "P1", nullLabel: pack.nullLabel, onProfileSelect: handleP1ProfileSelect, onManageProfiles: () => import_expo_router7.router.push(profilesHref(1)), previewValue: seatPreview, triggerStyle, useSeatPickerAlign: seatPickerAlign }, `p1-${layoutKey}`);
964
973
  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}`);
965
974
  const toggleP1Ready = () => setReady((r) => ({ ...r, 1: !r[1] }));
966
975
  const readyInOptions = !p2IsHuman && !!loadout.drawsReady;
@@ -992,7 +1001,7 @@ function LoadoutScreen({ game }) {
992
1001
  const optionsPopoverOpen = controlsHost.openId !== null && loadout.optionIds.includes(controlsHost.openId);
993
1002
  const sharedControls = showMetaInSharedBand ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lobby2.SharedActionBand, { onBack: import_core6.safeBack, onSettings: () => setSettingsOpen(true), onRandomize: loadout.randomize, onReset: loadout.reset, fg, popoverOpen: optionsPopoverOpen, children: optionsRow }) : optionsRow;
994
1003
  const p2Control = p2IsHuman ? loadout.seatControl(2, p2Host, { ...controlLook, seatColor: p2Drawn }) : void 0;
995
- 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");
1004
+ const p2Panel = p2IsHuman && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lobby2.PlayerSetupPanel, { idPrefix: "p2", caption: "Player 2", 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");
996
1005
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native6.View, { style: [styles3.container, { backgroundColor: bg }], children: [
997
1006
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native6.View, { style: [styles3.frame, !showMetaInSharedBand && { paddingTop: HEADER_TOP + HEADER_ROW_HEIGHT + insets.top }], children: [
998
1007
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_chrome6.PressAwayOverlay, { active: controlsHost.openId !== null, onPress: controlsHost.close }),
@@ -1307,6 +1316,10 @@ function HomeMenu() {
1307
1316
  const tab = tabs ? tabs.find((t) => t.label === tabLabel) ?? tabs[0] : null;
1308
1317
  const tabButtons = (0, import_react16.useMemo)(() => tabs?.map(({ label }) => ({ value: label, label, labelStyle: pack.labelStyle })) ?? [], [tabs, pack.labelStyle]);
1309
1318
  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 }] });
1319
+ const panes = (0, import_react16.useMemo)(() => tabs ? tabs.map((t) => ({ key: t.label, games: pack.games.filter(t.includes) })) : [{ key: ALL_GAMES, games: pack.games }], [tabs, pack.games]);
1320
+ const shownPane = tab?.label ?? ALL_GAMES;
1321
+ const { width: fitWidth, height: fitHeight } = layout.heroFit ?? NO_FIT;
1322
+ const hero = (0, import_react16.useMemo)(() => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(pack.HeroTitle, { words: pack.wordmark, color: fg, p1Color, p2Color, active: heroActive, fit: isWide && fitWidth !== void 0 ? { width: fitWidth, height: fitHeight } : void 0 }), [pack, fg, p1Color, p2Color, heroActive, isWide, fitWidth, fitHeight]);
1310
1323
  const columnClamp = useClampOnShrink();
1311
1324
  const gridClamp = useClampOnShrink();
1312
1325
  const openGame = (0, import_react16.useCallback)((game) => openFirstTime(game.id, () => import_expo_router9.router.push(game.useLoadout ? loadoutHref(game.id) : playHref(game.id))), [openFirstTime]);
@@ -1315,28 +1328,28 @@ function HomeMenu() {
1315
1328
  const usePickerAlign = pack.usePickerAlign ?? noPickerAlign;
1316
1329
  const pickerSize = (0, import_profile9.getProfilePickerContentSize)(profiles.length, true, colorSection);
1317
1330
  const pickerAlign = usePickerAlign(pickerHost.openId === `${SEAT_ONE_PICKER}-profile`, pickerSize.width, pickerSize.height);
1318
- const picker = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_profile9.ProfilePicker, { idPrefix: SEAT_ONE_PICKER, host: pickerHost, profiles, selectedId: lastSelected[1], color: p1Drawn, dark, guestLabel: pack.guestLabel ?? "P1", nullLabel: pack.nullLabel, onSelect: (profile) => selectProfile(1, profile?.id ?? null), onManage: () => import_expo_router9.router.push(profilesHref(1)), colorSection, alignOverride: pickerAlign, triggerStyle });
1331
+ const picker = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_profile9.ProfilePicker, { idPrefix: SEAT_ONE_PICKER, host: pickerHost, caption: "Player", profiles, selectedId: lastSelected[1], color: p1Drawn, dark, guestLabel: pack.guestLabel ?? "P1", nullLabel: pack.nullLabel, onSelect: (profile) => selectProfile(1, profile?.id ?? null), onManage: () => import_expo_router9.router.push(profilesHref(1)), colorSection, alignOverride: pickerAlign, triggerStyle });
1319
1332
  const pressAway = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_chrome7.PressAwayOverlay, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles4.pressAway });
1320
1333
  const RulesSheet = rulesGame?.Rules;
1321
1334
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native9.View, { style: [styles4.container, { backgroundColor: bg }], children: [
1322
1335
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native9.View, { style: styles4.frame, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(RulesHost, { enabled: pack.games.some((game) => game.Rules), children: [
1323
- isWide ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
1336
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PreviewsRevealed, { value: previewsRevealed, children: isWide ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
1324
1337
  pressAway,
1325
1338
  /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_auto_paper6.FadingScrollView, { ...tab && gridClamp, style: [styles4.wideRightPane, { left: layout.paddingLeft + layout.leftPaneWidth + HOME_WIDE_PANE_GAP }], contentContainerStyle: { paddingTop: 16 + insets.top, paddingBottom: 16 + insets.bottom, paddingRight: layout.paddingRight }, children: [
1326
1339
  tabBar && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native9.View, { style: [styles4.wideTabs, { width: layout.rightPaneWidth }], children: tabBar }),
1327
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native9.View, { style: [styles4.grid, { width: layout.rightPaneWidth }], children: pack.games.map((game) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(GameTile, { game, hidden: isHidden(tab, game), width: layout.tileWidth, previewWidth: layout.previewWidth, previewRevealed: previewsRevealed, dark, p1Color, p2Color, onPress: () => openGame(game), onRules: hasRules(game) ? () => openRules(game) : void 0 }, game.id)) })
1340
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native9.View, { style: { width: layout.rightPaneWidth }, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TabPanes, { panes, shown: shownPane, buildOthers: isFocused, style: styles4.grid, children: (games, built) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(GameGrid, { games, built, width: layout.tileWidth, previewWidth: layout.previewWidth, dark, p1Color, p2Color, onOpen: openGame, onRules: openRules }) }) })
1328
1341
  ] }),
1329
1342
  /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native9.View, { style: [styles4.wideLeftPane, { left: layout.paddingLeft, width: layout.leftPaneWidth, paddingTop: HOME_TOP_BAND + insets.top, paddingBottom: 16 + insets.bottom }, pickerHost.openId !== null && styles4.pickerOpen], children: [
1330
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(pack.HeroTitle, { words: pack.wordmark, color: fg, p1Color, p2Color, active: heroActive, fit: layout.heroFit }),
1343
+ hero,
1331
1344
  showPicker && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native9.View, { style: styles4.widePicker, children: picker })
1332
1345
  ] })
1333
1346
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_auto_paper6.FadingScrollView, { ...tab && columnClamp, style: styles4.scroll, contentContainerStyle: [styles4.content, { paddingTop: 56 + insets.top, paddingBottom: 24 + insets.bottom, paddingLeft: 16 + insets.left, paddingRight: 16 + insets.right }], children: [
1334
1347
  pressAway,
1335
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(pack.HeroTitle, { words: pack.wordmark, color: fg, p1Color, p2Color, active: heroActive }),
1348
+ hero,
1336
1349
  showPicker && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native9.View, { style: [styles4.picker, pickerHost.openId !== null && styles4.pickerOpen], children: picker }),
1337
1350
  tabBar && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native9.View, { style: styles4.listWidth, children: tabBar }),
1338
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native9.View, { style: styles4.list, children: pack.games.map((game) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(GameRow, { game, hidden: isHidden(tab, game), dark, p1Color, p2Color, previewRevealed: previewsRevealed, onPress: () => openGame(game), onRules: hasRules(game) ? () => openRules(game) : void 0 }, game.id)) })
1339
- ] }),
1351
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native9.View, { style: styles4.listWidth, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TabPanes, { panes, shown: shownPane, buildOthers: isFocused, style: styles4.list, children: (games, built) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(GameList, { games, built, dark, p1Color, p2Color, onOpen: openGame, onRules: openRules }) }) })
1352
+ ] }) }),
1340
1353
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_feedback_press3.IconButton, { icon: "trophy", iconColor: fg, size: 24, style: [styles4.corner, { top: 8 + insets.top, left: 8 + insets.left }], onPress: () => import_expo_router9.router.push(STATS_HREF), accessibilityLabel: "Stats & Achievements" }),
1341
1354
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_feedback_press3.IconButton, { icon: "cog", iconColor: fg, size: 24, style: [styles4.corner, { top: 8 + insets.top, right: 8 + insets.right }], onPress: () => setSettingsOpen(true), accessibilityLabel: "Settings" }),
1342
1355
  RulesSheet && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(RulesSheet, { visible: true, onDismiss: () => setRulesGame(null) })
@@ -1346,9 +1359,36 @@ function HomeMenu() {
1346
1359
  }
1347
1360
  var SEAT_ONE_PICKER = "home-p1";
1348
1361
  var noPickerAlign = () => void 0;
1349
- function isHidden(tab, game) {
1350
- return !!tab && !tab.includes(game);
1362
+ var NO_FIT = { height: 0 };
1363
+ var ALL_GAMES = "__all__";
1364
+ function TabPanes({ panes, shown, buildOthers, style, children }) {
1365
+ const mostGames = Math.max(...panes.map(({ games }) => games.length));
1366
+ const builtGames = useBuiltGames(shown, mostGames, buildOthers && panes.length > 1);
1367
+ return panes.map(({ key, games }) => {
1368
+ const built = builtGames(key);
1369
+ if (built === 0) return null;
1370
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TabPane, { shown: key === shown, style, children: children(games, built) }, key);
1371
+ });
1351
1372
  }
1373
+ function useBuiltGames(shown, total, buildOthers) {
1374
+ const [picked, setPicked] = (0, import_react16.useState)([shown]);
1375
+ if (!picked.includes(shown)) setPicked([...picked, shown]);
1376
+ const [others, setOthers] = (0, import_react16.useState)(import_react_native9.Platform.OS === "web" ? total : 0);
1377
+ const building = buildOthers && others < total;
1378
+ (0, import_react16.useEffect)(() => {
1379
+ if (!building) return;
1380
+ const id = setTimeout(() => (0, import_react16.startTransition)(() => setOthers(others + 1)), others === 0 ? OTHER_PANES_DELAY_MS : OTHER_PANES_STEP_MS);
1381
+ return () => clearTimeout(id);
1382
+ }, [building, others]);
1383
+ return (pane) => pane === shown || picked.includes(pane) ? total : others;
1384
+ }
1385
+ var OTHER_PANES_DELAY_MS = 1200;
1386
+ var OTHER_PANES_STEP_MS = 150;
1387
+ function TabPane({ shown, style, children }) {
1388
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native9.View, { collapsable: false, "aria-hidden": !shown, style: [style, !shown && styles4.paneHidden], children });
1389
+ }
1390
+ var PreviewsRevealedContext = (0, import_react16.createContext)(false);
1391
+ var PreviewsRevealed = PreviewsRevealedContext.Provider;
1352
1392
  function useClampOnShrink() {
1353
1393
  const view = (0, import_react16.useRef)(null);
1354
1394
  const sizes = (0, import_react16.useRef)({ viewport: 0, offset: 0 });
@@ -1380,39 +1420,46 @@ function hasRules(game) {
1380
1420
  function RulesHost({ enabled, children }) {
1381
1421
  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 });
1382
1422
  }
1423
+ var GameList = (0, import_react16.memo)(function GameList2({ games, built, ...rest }) {
1424
+ return games.slice(0, built).map((game) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(GameRow, { game, ...rest }, game.id));
1425
+ });
1426
+ var GameGrid = (0, import_react16.memo)(function GameGrid2({ games, built, ...rest }) {
1427
+ return games.slice(0, built).map((game) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(GameTile, { game, ...rest }, game.id));
1428
+ });
1383
1429
  var ROW_BLURB_LINES = 3;
1384
- function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPress, onRules }) {
1430
+ var GameRow = (0, import_react16.memo)(function GameRow2({ game, dark, p1Color, p2Color, onOpen, onRules }) {
1385
1431
  const { titleStyle } = usePack();
1386
1432
  const well = (0, import_chrome7.useWellColors)();
1387
1433
  const GameIcon = game.icon;
1388
1434
  return (
1389
1435
  // The rules button sits beside the row's own button, laid over its end, not inside it: a button
1390
1436
  // inside a button is invalid on the web.
1391
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native9.View, { style: hidden ? styles4.hidden : void 0, children: [
1392
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_feedback_press3.Pressable, { onPress, style: [styles4.row, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
1393
- 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 }) }),
1437
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native9.View, { children: [
1438
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_feedback_press3.Pressable, { onPress: () => onOpen(game), style: [styles4.row, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
1439
+ game.Preview ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PreviewBox, { game, width: ROW_PREVIEW_WIDTH, 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 }) }),
1394
1440
  /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native9.View, { style: styles4.rowText, children: [
1395
1441
  /* @__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 }),
1396
1442
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper2.Text, { variant: "bodyMedium", style: { color: well.fgMuted }, numberOfLines: ROW_BLURB_LINES, children: game.blurb })
1397
1443
  ] })
1398
1444
  ] }),
1399
- 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 }) })
1445
+ hasRules(game) && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_feedback_press3.Pressable, { onPress: () => onRules(game), 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 }) })
1400
1446
  ] })
1401
1447
  );
1402
- }
1403
- function GameTile({ game, hidden, width, previewWidth, dark, p1Color, p2Color, previewRevealed, onPress, onRules }) {
1448
+ });
1449
+ var GameTile = (0, import_react16.memo)(function GameTile2({ game, width, previewWidth, dark, p1Color, p2Color, onOpen, onRules }) {
1404
1450
  const { titleStyle } = usePack();
1405
1451
  const well = (0, import_chrome7.useWellColors)();
1406
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native9.View, { style: [{ width }, hidden && styles4.hidden], children: [
1407
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_feedback_press3.Pressable, { onPress, style: [styles4.tile, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
1408
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PreviewBox, { game, width: previewWidth, revealed: previewRevealed, dark, p1Color, p2Color }),
1452
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native9.View, { style: { width }, children: [
1453
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_feedback_press3.Pressable, { onPress: () => onOpen(game), style: [styles4.tile, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
1454
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PreviewBox, { game, width: previewWidth, dark, p1Color, p2Color }),
1409
1455
  /* @__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 }),
1410
1456
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper2.Text, { variant: "bodySmall", style: { color: well.fgMuted }, numberOfLines: 3, children: game.blurb })
1411
1457
  ] }),
1412
- 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" }) })
1458
+ hasRules(game) && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_feedback_press3.Pressable, { onPress: () => onRules(game), 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" }) })
1413
1459
  ] });
1414
- }
1415
- function PreviewBox({ game, width, revealed, dark, p1Color, p2Color }) {
1460
+ });
1461
+ function PreviewBox({ game, width, dark, p1Color, p2Color }) {
1462
+ const revealed = (0, import_react16.useContext)(PreviewsRevealedContext);
1416
1463
  const height = Math.round(width / PREVIEW_ASPECT);
1417
1464
  const { Preview, icon: GameIcon } = game;
1418
1465
  const iconSize = Math.min(height, ROW_ICON_SIZE);
@@ -1442,21 +1489,21 @@ var styles4 = import_react_native9.StyleSheet.create({
1442
1489
  flexWrap: "wrap",
1443
1490
  gap: HOME_GRID_GAP
1444
1491
  },
1445
- // Out of the layout (a grid closes up around it) and hidden from screen readers.
1446
- hidden: {
1447
- display: "none"
1448
- },
1449
- // Solitaire's list: one column, never wider than a phone's, centred on a wide screen.
1492
+ // Solitaire's list: one column.
1450
1493
  list: {
1451
- gap: 14,
1452
- maxWidth: 480,
1453
- width: "100%"
1494
+ gap: 14
1454
1495
  },
1455
- // The list's width, for the tabs over it.
1496
+ // The list's width, and the tabs' over it: never wider than a phone's, centred on a wide screen.
1456
1497
  listWidth: {
1457
1498
  maxWidth: 480,
1458
1499
  width: "100%"
1459
1500
  },
1501
+ // A tab's pane that isn't shown (TabPane): out of the layout, over the shown pane's place, drawing
1502
+ // nothing.
1503
+ paneHidden: import_react_native9.Platform.select({
1504
+ web: { display: "none" },
1505
+ default: { left: 0, opacity: 0, pointerEvents: "none", position: "absolute", right: 0, top: 0 }
1506
+ }),
1460
1507
  picker: {
1461
1508
  alignItems: "center"
1462
1509
  },
@@ -1585,7 +1632,7 @@ var TABS = [
1585
1632
  var LABEL_WIDE_TAB = { flex: 0, flexBasis: "auto", flexGrow: 1, flexShrink: 1 };
1586
1633
  var NO_PACK_TABS = [];
1587
1634
  var EVERYONE = "__everyone__";
1588
- var ALL_GAMES = "__all__";
1635
+ var ALL_GAMES2 = "__all__";
1589
1636
  var tabGroup = (index) => `__tab-group-${index}__`;
1590
1637
  var tabGames = (index) => `__tab-${index}__`;
1591
1638
  var PLAYER_PICKER_ID = "stats-player";
@@ -1611,22 +1658,22 @@ function StatsContent({ pickerHost }) {
1611
1658
  const dispatch = (0, import_react_redux10.useDispatch)();
1612
1659
  const fg = pack.foreground ?? colors.onBackground;
1613
1660
  const [tab, setTab] = (0, import_react17.useState)(STATS);
1614
- const [gameId, setGameId] = (0, import_react17.useState)(ALL_GAMES);
1661
+ const [gameId, setGameId] = (0, import_react17.useState)(ALL_GAMES2);
1615
1662
  const useStatsPlayer = pack.useStatsPlayer ?? useNoStatsPlayer;
1616
1663
  const statsPlayer = useStatsPlayer();
1617
1664
  const [selectedProfileId, setSelectedProfileId] = (0, import_react17.useState)(() => pack.useStatsPlayer ? statsPlayer : pack.guestStats ? lastSelected[1] ?? GUEST_PLAYER_ID : null);
1618
1665
  const profileId = selectedProfileId && profiles.length > 0 && (pack.guestStats && selectedProfileId === GUEST_PLAYER_ID || profiles.some((p) => p.id === selectedProfileId)) ? selectedProfileId : null;
1619
1666
  const homeTabs = pack.homeTabs && pack.homeTabs.length > 1 ? pack.homeTabs : null;
1620
1667
  const pickedTab = homeTabs?.findIndex((_, index) => gameId === tabGames(index)) ?? -1;
1621
- const games = gameId === ALL_GAMES ? pack.games : pickedTab >= 0 ? pack.games.filter((g) => homeTabs[pickedTab].includes(g)) : pack.games.filter((g) => g.id === gameId);
1622
- const gameIds = gameId === ALL_GAMES ? null : games.map((g) => g.id);
1623
- const oneGameId = gameId === ALL_GAMES || pickedTab >= 0 ? null : gameId;
1668
+ const games = gameId === ALL_GAMES2 ? pack.games : pickedTab >= 0 ? pack.games.filter((g) => homeTabs[pickedTab].includes(g)) : pack.games.filter((g) => g.id === gameId);
1669
+ const gameIds = gameId === ALL_GAMES2 ? null : games.map((g) => g.id);
1670
+ const oneGameId = gameId === ALL_GAMES2 || pickedTab >= 0 ? null : gameId;
1624
1671
  const packTabs = pack.statsTabs ?? NO_PACK_TABS;
1625
1672
  const packTab = packTabs.find((t) => t.value === tab);
1626
1673
  const showGamePicker = !(tab === ACHIEVEMENTS && pack.AchievementList);
1627
1674
  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]);
1628
1675
  const gameOptions = (0, import_react17.useMemo)(() => {
1629
- const all = { value: ALL_GAMES, label: "All Games", icon: "view-grid-outline" };
1676
+ const all = { value: ALL_GAMES2, label: "All Games", icon: "view-grid-outline" };
1630
1677
  const option = (g) => ({ value: g.id, label: g.title, icon: "cards-playing-outline" });
1631
1678
  if (!homeTabs) return [all, ...pack.games.map(option)];
1632
1679
  return [all, ...homeTabs.map((tab2, index) => ({ value: tabGroup(index), label: tab2.label, icon: "folder-outline", options: [{ value: tabGames(index), label: "All", triggerLabel: tab2.label, icon: "view-grid-outline" }, ...pack.games.filter((g) => tab2.includes(g)).map(option)] }))];