@tastic/shell 0.21.1 → 0.22.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
@@ -45,7 +45,7 @@ package ecosystem, on [`@tastic/hud`](https://github.com/jayrdeaton/react-native
45
45
  `usePack` and `usePackGame`, `useActiveRound`, `useProfiles`, `useSeatColors`, `useOpponent`,
46
46
  `useAppSettings`, `useGameGuide`, `useAtComputer`, `roundModeFor`, `humanSeatsFor`, `seatTwoFor`,
47
47
  `MatchChips`, `SettingsDialog`, `safeBack`, `useBackBlock` (Android's and the browser's back
48
- mid-match open Quit Match?) and `imageGameIcon` (see [Hooks and helpers](#hooks-and-helpers)).
48
+ mid-match open Quit Match?), `Staged` (a long page a few parts at a time) and `imageGameIcon` (see [Hooks and helpers](#hooks-and-helpers)).
49
49
 
50
50
  ## Install
51
51
 
@@ -381,6 +381,28 @@ const quit = useBackBlock(hasProgress, requestBack)
381
381
  - While it's on, the web also asks before the page unloads (expo-router's `usePreventRemove` adds a
382
382
  `beforeunload` handler with it). iOS's swipe back is off on every screen anyway.
383
383
 
384
+ ### A long page a few parts at a time (`Staged`, 0.22.0)
385
+
386
+ A stats screen's wells or an achievement list's rows, drawn all at once, hold the screen back until the last of them is
387
+ built: seconds on a budget phone, for parts past its bottom edge. `Staged` draws the `first` of its children with the screen
388
+ (default 1) and `step` more (default 1) each time what's drawn has reached the screen and the app has a moment. It draws no
389
+ view of its own, so the parts are flat siblings of what's round it (a stats page's gap still spaces them), and a part never
390
+ renders again as later ones come. Give it a `key` that changes with what's listed (a filter), so a longer list taking a
391
+ shorter one's place is drawn the same way.
392
+
393
+ `StatsScreen` draws the games' own sections in it, the first with the screen (none, under a pack's own `StatsSections`). Use
394
+ it inside a section of your own that is long: a pack's `AchievementList`, or a tab of its own (`statsTabs`).
395
+
396
+ ```tsx
397
+ import { Staged } from '@tastic/shell'
398
+
399
+ <Staged first={8} step={3}>
400
+ {rows.map((row) => (
401
+ <AchievementRow key={row.id} {...row} />
402
+ ))}
403
+ </Staged>
404
+ ```
405
+
384
406
  ## Peer dependencies
385
407
 
386
408
  None are bundled. The floors started as the versions PuckTastic and DuelTastic ran the shell on when
package/dist/index.d.mts CHANGED
@@ -443,6 +443,13 @@ interface SettingsDialogProps {
443
443
  }
444
444
  declare function SettingsDialog({ visible, onDismiss, onShowHowToPlay, showProfile, children }: SettingsDialogProps): react.JSX.Element;
445
445
 
446
+ interface Props$1 {
447
+ first?: number;
448
+ step?: number;
449
+ children: ReactNode;
450
+ }
451
+ declare function Staged({ first, step, children }: Props$1): react.JSX.Element;
452
+
446
453
  declare function useActiveRound<S extends object>(game: string, defaults: S): {
447
454
  mode: RoundMode;
448
455
  settings: S;
@@ -591,5 +598,5 @@ declare function createPlayerSettings<S extends WithControls<C>, C>({ id, defaul
591
598
  };
592
599
  };
593
600
 
594
- export { DEFAULT_APP_SETTINGS, DEFAULT_OPPONENT, EditProfileRoute, GUEST_PLAYER_ID, HomeScreen, LoadoutRoute, MATCH_CHIPS_FADE_MS, MatchChips, PREVIEW_ASPECT, PackProvider, PlayRoute, ProfilesProvider, ProfilesRoute, RootLayout, SettingsDialog, StatsScreen, appSettingsActions, reducer$1 as appSettingsReducer, createGameGuideSlice, createGameStats, createPackStore, createPlayerSettings, createSeatColorsReducer, createShellReducers, defaultProfileSelectionState, defaultSeatColorsState, forgetProfileAchievements, humanSeatsFor, imageGameIcon, liveplayActions, reducer$3 as liveplayReducer, onProfileRemoved, opponentActions, reducer$2 as opponentReducer, profileSelectionActions, reducer as profileSelectionReducer, roundModeFor, seatColorsActions, seatPlayerKey, seatTwoFor, useActiveRound, useAppSettings, useAtComputer, useBackBlock, useGameGuide, useOpponent, usePack, usePackGame, useProfiles, useSeatColors };
601
+ export { DEFAULT_APP_SETTINGS, DEFAULT_OPPONENT, EditProfileRoute, GUEST_PLAYER_ID, HomeScreen, LoadoutRoute, MATCH_CHIPS_FADE_MS, MatchChips, PREVIEW_ASPECT, PackProvider, PlayRoute, ProfilesProvider, ProfilesRoute, RootLayout, SettingsDialog, Staged, StatsScreen, appSettingsActions, reducer$1 as appSettingsReducer, createGameGuideSlice, createGameStats, createPackStore, createPlayerSettings, createSeatColorsReducer, createShellReducers, defaultProfileSelectionState, defaultSeatColorsState, forgetProfileAchievements, humanSeatsFor, imageGameIcon, liveplayActions, reducer$3 as liveplayReducer, onProfileRemoved, opponentActions, reducer$2 as opponentReducer, profileSelectionActions, reducer as profileSelectionReducer, roundModeFor, seatColorsActions, seatPlayerKey, seatTwoFor, useActiveRound, useAppSettings, useAtComputer, useBackBlock, useGameGuide, useOpponent, usePack, usePackGame, useProfiles, useSeatColors };
595
602
  export type { ActiveRound, AppSettings, FeedbackSounds, GameDefinition, GameGuide, GameGuideState, GameIconProps, GameLoadout, GamePreviewProps, GameRulesProps, GuidelessGameDefinition, HeroTitleProps, HomeTab, LiveplaySliceState, LoadoutOptionsProps, MatchChipsProps, OpponentState, PackDefinition, PackGameDefinition, PackGuide, PackStatsReset, PackStatsSectionsProps, PackStatsTab, PackStore, PackStoreConfig, PackStoreSource, PickerAlign, PlayerControlsState, PlayerSettingsState, ProfileSelectionState, RecordResult, RoundMode, Seat, SeatColorsState, SeatControlLook, SeatTwo, SettingsDialogProps, ShellState, StackScreenOptions };
package/dist/index.d.ts CHANGED
@@ -443,6 +443,13 @@ interface SettingsDialogProps {
443
443
  }
444
444
  declare function SettingsDialog({ visible, onDismiss, onShowHowToPlay, showProfile, children }: SettingsDialogProps): react.JSX.Element;
445
445
 
446
+ interface Props$1 {
447
+ first?: number;
448
+ step?: number;
449
+ children: ReactNode;
450
+ }
451
+ declare function Staged({ first, step, children }: Props$1): react.JSX.Element;
452
+
446
453
  declare function useActiveRound<S extends object>(game: string, defaults: S): {
447
454
  mode: RoundMode;
448
455
  settings: S;
@@ -591,5 +598,5 @@ declare function createPlayerSettings<S extends WithControls<C>, C>({ id, defaul
591
598
  };
592
599
  };
593
600
 
594
- export { DEFAULT_APP_SETTINGS, DEFAULT_OPPONENT, EditProfileRoute, GUEST_PLAYER_ID, HomeScreen, LoadoutRoute, MATCH_CHIPS_FADE_MS, MatchChips, PREVIEW_ASPECT, PackProvider, PlayRoute, ProfilesProvider, ProfilesRoute, RootLayout, SettingsDialog, StatsScreen, appSettingsActions, reducer$1 as appSettingsReducer, createGameGuideSlice, createGameStats, createPackStore, createPlayerSettings, createSeatColorsReducer, createShellReducers, defaultProfileSelectionState, defaultSeatColorsState, forgetProfileAchievements, humanSeatsFor, imageGameIcon, liveplayActions, reducer$3 as liveplayReducer, onProfileRemoved, opponentActions, reducer$2 as opponentReducer, profileSelectionActions, reducer as profileSelectionReducer, roundModeFor, seatColorsActions, seatPlayerKey, seatTwoFor, useActiveRound, useAppSettings, useAtComputer, useBackBlock, useGameGuide, useOpponent, usePack, usePackGame, useProfiles, useSeatColors };
601
+ export { DEFAULT_APP_SETTINGS, DEFAULT_OPPONENT, EditProfileRoute, GUEST_PLAYER_ID, HomeScreen, LoadoutRoute, MATCH_CHIPS_FADE_MS, MatchChips, PREVIEW_ASPECT, PackProvider, PlayRoute, ProfilesProvider, ProfilesRoute, RootLayout, SettingsDialog, Staged, StatsScreen, appSettingsActions, reducer$1 as appSettingsReducer, createGameGuideSlice, createGameStats, createPackStore, createPlayerSettings, createSeatColorsReducer, createShellReducers, defaultProfileSelectionState, defaultSeatColorsState, forgetProfileAchievements, humanSeatsFor, imageGameIcon, liveplayActions, reducer$3 as liveplayReducer, onProfileRemoved, opponentActions, reducer$2 as opponentReducer, profileSelectionActions, reducer as profileSelectionReducer, roundModeFor, seatColorsActions, seatPlayerKey, seatTwoFor, useActiveRound, useAppSettings, useAtComputer, useBackBlock, useGameGuide, useOpponent, usePack, usePackGame, useProfiles, useSeatColors };
595
602
  export type { ActiveRound, AppSettings, FeedbackSounds, GameDefinition, GameGuide, GameGuideState, GameIconProps, GameLoadout, GamePreviewProps, GameRulesProps, GuidelessGameDefinition, HeroTitleProps, HomeTab, LiveplaySliceState, LoadoutOptionsProps, MatchChipsProps, OpponentState, PackDefinition, PackGameDefinition, PackGuide, PackStatsReset, PackStatsSectionsProps, PackStatsTab, PackStore, PackStoreConfig, PackStoreSource, PickerAlign, PlayerControlsState, PlayerSettingsState, ProfileSelectionState, RecordResult, RoundMode, Seat, SeatColorsState, SeatControlLook, SeatTwo, SettingsDialogProps, ShellState, StackScreenOptions };
package/dist/index.js CHANGED
@@ -45,6 +45,7 @@ __export(index_exports, {
45
45
  ProfilesRoute: () => ProfilesRoute,
46
46
  RootLayout: () => RootLayout,
47
47
  SettingsDialog: () => SettingsDialog,
48
+ Staged: () => Staged,
48
49
  StatsScreen: () => StatsScreen,
49
50
  appSettingsActions: () => appSettingsActions,
50
51
  appSettingsReducer: () => appSettingsSlice_default,
@@ -1684,12 +1685,40 @@ var import_auto_paper7 = require("@rific/auto-paper");
1684
1685
  var import_chrome8 = require("@tastic/hud/chrome");
1685
1686
  var import_profile10 = require("@tastic/profile");
1686
1687
  var import_expo_router10 = require("expo-router");
1687
- var import_react17 = require("react");
1688
+ var import_react18 = require("react");
1688
1689
  var import_react_native10 = require("react-native");
1689
1690
  var import_react_native_paper3 = require("react-native-paper");
1690
1691
  var import_react_native_safe_area_context5 = require("react-native-safe-area-context");
1691
1692
  var import_react_redux10 = require("react-redux");
1693
+
1694
+ // src/components/Staged.tsx
1695
+ var import_react17 = require("react");
1692
1696
  var import_jsx_runtime18 = require("react/jsx-runtime");
1697
+ function onShown(run) {
1698
+ let idle;
1699
+ let frame = requestAnimationFrame(() => {
1700
+ frame = requestAnimationFrame(() => {
1701
+ if (typeof requestIdleCallback === "function") idle = requestIdleCallback(run);
1702
+ else run();
1703
+ });
1704
+ });
1705
+ return () => {
1706
+ cancelAnimationFrame(frame);
1707
+ if (idle !== void 0) cancelIdleCallback(idle);
1708
+ };
1709
+ }
1710
+ function Staged({ first = 1, step = 1, children }) {
1711
+ const parts = (0, import_react17.useMemo)(() => import_react17.Children.toArray(children), [children]);
1712
+ const [drawn, setDrawn] = (0, import_react17.useState)(first);
1713
+ (0, import_react17.useEffect)(() => {
1714
+ if (drawn >= parts.length) return;
1715
+ return onShown(() => setDrawn(drawn + step));
1716
+ }, [drawn, parts.length, step]);
1717
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jsx_runtime18.Fragment, { children: parts.slice(0, drawn) });
1718
+ }
1719
+
1720
+ // src/screens/StatsScreen.tsx
1721
+ var import_jsx_runtime19 = require("react/jsx-runtime");
1693
1722
  var STATS = "stats";
1694
1723
  var ACHIEVEMENTS = "achievements";
1695
1724
  var TABS = [
@@ -1709,10 +1738,10 @@ var MANAGE_OPTION = { value: MANAGE, label: "Manage", icon: "account-cog-outline
1709
1738
  var STATS_MAX_WIDTH = 640;
1710
1739
  function StatsScreen() {
1711
1740
  const pickerHost = (0, import_chrome8.usePopoverHost)();
1712
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(StatsPressAway, { host: pickerHost, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_chrome8.ScreenFrame, { portalHost: true, maxContentWidth: STATS_MAX_WIDTH, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(StatsContent, { pickerHost }) }) });
1741
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(StatsPressAway, { host: pickerHost, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_chrome8.ScreenFrame, { portalHost: true, maxContentWidth: STATS_MAX_WIDTH, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(StatsContent, { pickerHost }) }) });
1713
1742
  }
1714
1743
  function StatsPressAway({ host, children }) {
1715
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native10.View, { testID: "stats-press-away", style: styles5.screen, onStartShouldSetResponder: () => host.openId !== null, onResponderRelease: host.close, children });
1744
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native10.View, { testID: "stats-press-away", style: styles5.screen, onStartShouldSetResponder: () => host.openId !== null, onResponderRelease: host.close, children });
1716
1745
  }
1717
1746
  var useNoPackReset = () => null;
1718
1747
  var noPickerAlign2 = () => void 0;
@@ -1724,11 +1753,11 @@ function StatsContent({ pickerHost }) {
1724
1753
  const { profiles, lastSelected } = useProfiles();
1725
1754
  const dispatch = (0, import_react_redux10.useDispatch)();
1726
1755
  const fg = pack.foreground ?? colors.onBackground;
1727
- const [tab, setTab] = (0, import_react17.useState)(STATS);
1728
- const [gameId, setGameId] = (0, import_react17.useState)(ALL_GAMES2);
1756
+ const [tab, setTab] = (0, import_react18.useState)(STATS);
1757
+ const [gameId, setGameId] = (0, import_react18.useState)(ALL_GAMES2);
1729
1758
  const useStatsPlayer = pack.useStatsPlayer ?? useNoStatsPlayer;
1730
1759
  const statsPlayer = useStatsPlayer();
1731
- const [selectedProfileId, setSelectedProfileId] = (0, import_react17.useState)(() => pack.useStatsPlayer ? statsPlayer : pack.guestStats ? lastSelected[1] ?? GUEST_PLAYER_ID : null);
1760
+ const [selectedProfileId, setSelectedProfileId] = (0, import_react18.useState)(() => pack.useStatsPlayer ? statsPlayer : pack.guestStats ? lastSelected[1] ?? GUEST_PLAYER_ID : null);
1732
1761
  const profileId = selectedProfileId && profiles.length > 0 && (pack.guestStats && selectedProfileId === GUEST_PLAYER_ID || profiles.some((p) => p.id === selectedProfileId)) ? selectedProfileId : null;
1733
1762
  const homeTabs = pack.homeTabs && pack.homeTabs.length > 1 ? pack.homeTabs : null;
1734
1763
  const pickedTab = homeTabs?.findIndex((_, index) => gameId === tabGames(index)) ?? -1;
@@ -1738,14 +1767,14 @@ function StatsContent({ pickerHost }) {
1738
1767
  const packTabs = pack.statsTabs ?? NO_PACK_TABS;
1739
1768
  const packTab = packTabs.find((t) => t.value === tab);
1740
1769
  const showGamePicker = !(tab === ACHIEVEMENTS && pack.AchievementList);
1741
- 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]);
1742
- const gameOptions = (0, import_react17.useMemo)(() => {
1770
+ const playerOptions = (0, import_react18.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]);
1771
+ const gameOptions = (0, import_react18.useMemo)(() => {
1743
1772
  const all = { value: ALL_GAMES2, label: "All Games", icon: "view-grid-outline" };
1744
1773
  const option = (g) => ({ value: g.id, label: g.title, icon: "cards-playing-outline" });
1745
1774
  if (!homeTabs) return [all, ...pack.games.map(option)];
1746
1775
  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)] }))];
1747
1776
  }, [pack.games, homeTabs]);
1748
- const tabButtons = (0, import_react17.useMemo)(() => {
1777
+ const tabButtons = (0, import_react18.useMemo)(() => {
1749
1778
  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;
1750
1779
  return pack.labelStyle ? buttons.map((button) => ({ ...button, labelStyle: pack.labelStyle })) : buttons;
1751
1780
  }, [packTabs, pack.labelStyle]);
@@ -1761,16 +1790,16 @@ function StatsContent({ pickerHost }) {
1761
1790
  const surface = pack.Backdrop ? { backgroundColor: colors.surface } : void 0;
1762
1791
  const triggerStyle = pack.Backdrop ? [styles5.pill, surface] : void 0;
1763
1792
  const PackTabContent = packTab?.Content;
1764
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_chrome8.BaseStatsScreen, { title, titleStyle: pack.titleStyle, onBack: import_core6.safeBack, insets, onReset: reset.onReset, resetLabel: reset.label, resetConfirmTitle: reset.title, resetConfirmBody: reset.body, fg: pack.foreground, bg: pack.Backdrop ? "transparent" : void 0, children: [
1765
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_chrome8.PressAwayOverlay, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles5.pressAway }),
1766
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native_paper3.SegmentedButtons, { value: tab, onValueChange: setTab, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles5.tabs, surface] }),
1767
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native10.View, { style: [styles5.filters, pickerHost.openId !== null && styles5.filtersOpen], onStartShouldSetResponder: () => pickerHost.openId !== null, children: [
1768
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_profile10.OptionPicker, { id: PLAYER_PICKER_ID, host: pickerHost, options: playerOptions, value: profileId ?? EVERYONE, onChange: (value) => value === MANAGE ? import_expo_router10.router.push(PROFILES_HREF) : setSelectedProfileId(value === EVERYONE ? null : value), color: colors.primary, dark, icon: profileId ? "account" : "account-group", caption: "Player", alignOverride: playerAlign, triggerStyle }),
1769
- showGamePicker && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_profile10.OptionPicker, { id: GAME_PICKER_ID, host: pickerHost, options: gameOptions, value: gameId, onChange: setGameId, color: colors.primary, dark, icon: "view-grid-outline", caption: "Game", alignOverride: gameAlign, triggerStyle })
1793
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_chrome8.BaseStatsScreen, { title, titleStyle: pack.titleStyle, onBack: import_core6.safeBack, insets, onReset: reset.onReset, resetLabel: reset.label, resetConfirmTitle: reset.title, resetConfirmBody: reset.body, fg: pack.foreground, bg: pack.Backdrop ? "transparent" : void 0, children: [
1794
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_chrome8.PressAwayOverlay, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles5.pressAway }),
1795
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native_paper3.SegmentedButtons, { value: tab, onValueChange: setTab, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles5.tabs, surface] }),
1796
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_react_native10.View, { style: [styles5.filters, pickerHost.openId !== null && styles5.filtersOpen], onStartShouldSetResponder: () => pickerHost.openId !== null, children: [
1797
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_profile10.OptionPicker, { id: PLAYER_PICKER_ID, host: pickerHost, options: playerOptions, value: profileId ?? EVERYONE, onChange: (value) => value === MANAGE ? import_expo_router10.router.push(PROFILES_HREF) : setSelectedProfileId(value === EVERYONE ? null : value), color: colors.primary, dark, icon: profileId ? "account" : "account-group", caption: "Player", alignOverride: playerAlign, triggerStyle }),
1798
+ showGamePicker && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_profile10.OptionPicker, { id: GAME_PICKER_ID, host: pickerHost, options: gameOptions, value: gameId, onChange: setGameId, color: colors.primary, dark, icon: "view-grid-outline", caption: "Game", alignOverride: gameAlign, triggerStyle })
1770
1799
  ] }),
1771
- tab === STATS && pack.StatsSections && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(pack.StatsSections, { profileId, gameId: oneGameId, gameIds }),
1772
- PackTabContent && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PackTabContent, { profileId, gameId: oneGameId, gameIds }),
1773
- tab === ACHIEVEMENTS && pack.AchievementList ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(pack.AchievementList, { profileId }) : (tab === STATS || tab === ACHIEVEMENTS) && games.map((game) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(GameStats, { game, tab, profileId, showTitle: games.length > 1 && pack.statsGameTitles !== false, titleColor: fg }, game.id))
1800
+ tab === STATS && pack.StatsSections && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(pack.StatsSections, { profileId, gameId: oneGameId, gameIds }),
1801
+ PackTabContent && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PackTabContent, { profileId, gameId: oneGameId, gameIds }),
1802
+ tab === ACHIEVEMENTS && pack.AchievementList ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(pack.AchievementList, { profileId }) : (tab === STATS || tab === ACHIEVEMENTS) && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Staged, { first: tab === STATS && pack.StatsSections ? 0 : 1, children: games.map((game) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(GameStats, { game, tab, profileId, showTitle: games.length > 1 && pack.statsGameTitles !== false, titleColor: fg }, game.id)) }, `${tab} ${gameId}`)
1774
1803
  ] });
1775
1804
  }
1776
1805
  function resetFor(pack, packReset, profileId, profiles, games, resetGames) {
@@ -1786,9 +1815,9 @@ function GameStats({ game, tab, profileId, showTitle, titleColor }) {
1786
1815
  const { StatsSections, AchievementList } = game;
1787
1816
  const Sections = tab === STATS ? StatsSections : AchievementList;
1788
1817
  if (!Sections) return null;
1789
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native10.View, { style: styles5.game, children: [
1790
- showTitle && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native_paper3.Text, { variant: "titleLarge", style: [styles5.gameTitle, { color: titleColor }, titleStyle], children: game.title }),
1791
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Sections, { profileId })
1818
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_react_native10.View, { style: styles5.game, children: [
1819
+ showTitle && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native_paper3.Text, { variant: "titleLarge", style: [styles5.gameTitle, { color: titleColor }, titleStyle], children: game.title }),
1820
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Sections, { profileId })
1792
1821
  ] });
1793
1822
  }
1794
1823
  var styles5 = import_react_native10.StyleSheet.create({
@@ -1826,21 +1855,21 @@ var styles5 = import_react_native10.StyleSheet.create({
1826
1855
 
1827
1856
  // src/components/imageGameIcon.tsx
1828
1857
  var import_react_native11 = require("react-native");
1829
- var import_jsx_runtime19 = require("react/jsx-runtime");
1858
+ var import_jsx_runtime20 = require("react/jsx-runtime");
1830
1859
  function imageGameIcon(images) {
1831
1860
  return function ImageGameIcon({ size, dark }) {
1832
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native11.Image, { source: dark ? images.dark : images.light, style: { height: size, width: size }, accessibilityIgnoresInvertColors: true });
1861
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native11.Image, { source: dark ? images.dark : images.light, style: { height: size, width: size }, accessibilityIgnoresInvertColors: true });
1833
1862
  };
1834
1863
  }
1835
1864
 
1836
1865
  // src/components/MatchChips.tsx
1837
1866
  var import_auto_paper8 = require("@rific/auto-paper");
1838
1867
  var import_feedback_press4 = require("@rific/feedback-press");
1839
- var import_react18 = require("react");
1868
+ var import_react19 = require("react");
1840
1869
  var import_react_native12 = require("react-native");
1841
1870
  var import_react_native_reanimated3 = __toESM(require("react-native-reanimated"));
1842
1871
  var import_react_native_safe_area_context6 = require("react-native-safe-area-context");
1843
- var import_jsx_runtime20 = require("react/jsx-runtime");
1872
+ var import_jsx_runtime21 = require("react/jsx-runtime");
1844
1873
  var MATCH_CHIPS_FADE_MS = 150;
1845
1874
  var CHIP_SIZE = 48;
1846
1875
  var EDGE_PAD = 8;
@@ -1851,7 +1880,7 @@ function MatchChips({ playing, faceToFace, centerLineY, onBack, onSettings }) {
1851
1880
  const atComputer = useAtComputer();
1852
1881
  const visible = atComputer || !playing;
1853
1882
  const opacity = (0, import_react_native_reanimated3.useSharedValue)(visible ? 1 : 0);
1854
- (0, import_react18.useEffect)(() => {
1883
+ (0, import_react19.useEffect)(() => {
1855
1884
  opacity.value = (0, import_react_native_reanimated3.withTiming)(visible ? 1 : 0, { duration: MATCH_CHIPS_FADE_MS });
1856
1885
  }, [visible]);
1857
1886
  const fadeStyle = (0, import_react_native_reanimated3.useAnimatedStyle)(() => ({ opacity: opacity.value }));
@@ -1862,9 +1891,9 @@ function MatchChips({ playing, faceToFace, centerLineY, onBack, onSettings }) {
1862
1891
  const backSlot = { top, left: EDGE_PAD + insets.left };
1863
1892
  const settingsSlot = { top, right: EDGE_PAD + insets.right };
1864
1893
  const pointerEvents = visible ? "box-none" : "none";
1865
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
1866
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native_reanimated3.default.View, { pointerEvents, style: [styles6.slot, backSlot, fadeStyle], testID: "match-chips-back", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_feedback_press4.IconButton, { icon: "arrow-left", iconColor, containerColor, style: styles6.chip, size: 24, onPress: onBack, accessibilityLabel: "Back" }) }),
1867
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native_reanimated3.default.View, { pointerEvents, style: [styles6.slot, settingsSlot, fadeStyle], testID: "match-chips-settings", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_feedback_press4.IconButton, { icon: "cog", iconColor, containerColor, style: styles6.chip, size: 24, onPress: onSettings, accessibilityLabel: "Settings" }) })
1894
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
1895
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native_reanimated3.default.View, { pointerEvents, style: [styles6.slot, backSlot, fadeStyle], testID: "match-chips-back", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_feedback_press4.IconButton, { icon: "arrow-left", iconColor, containerColor, style: styles6.chip, size: 24, onPress: onBack, accessibilityLabel: "Back" }) }),
1896
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native_reanimated3.default.View, { pointerEvents, style: [styles6.slot, settingsSlot, fadeStyle], testID: "match-chips-settings", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_feedback_press4.IconButton, { icon: "cog", iconColor, containerColor, style: styles6.chip, size: 24, onPress: onSettings, accessibilityLabel: "Settings" }) })
1868
1897
  ] });
1869
1898
  }
1870
1899
  var styles6 = import_react_native12.StyleSheet.create({
@@ -1883,12 +1912,12 @@ function useActiveRound(game, defaults) {
1883
1912
 
1884
1913
  // src/hooks/useBackBlock.ts
1885
1914
  var import_expo_router11 = require("expo-router");
1886
- var import_react19 = require("react");
1915
+ var import_react20 = require("react");
1887
1916
  function useBackBlock(held, onHeld, leave = import_core6.safeBack) {
1888
- const leavingRef = (0, import_react19.useRef)(false);
1889
- const [leaving, setLeaving] = (0, import_react19.useState)(false);
1890
- const leaveRef = (0, import_react19.useRef)(leave);
1891
- (0, import_react19.useEffect)(() => {
1917
+ const leavingRef = (0, import_react20.useRef)(false);
1918
+ const [leaving, setLeaving] = (0, import_react20.useState)(false);
1919
+ const leaveRef = (0, import_react20.useRef)(leave);
1920
+ (0, import_react20.useEffect)(() => {
1892
1921
  leaveRef.current = leave;
1893
1922
  });
1894
1923
  (0, import_expo_router11.usePreventRemove)(held && !leaving, ({ repeat }) => {
@@ -1897,7 +1926,7 @@ function useBackBlock(held, onHeld, leave = import_core6.safeBack) {
1897
1926
  repeat();
1898
1927
  } else onHeld();
1899
1928
  });
1900
- return (0, import_react19.useCallback)(() => {
1929
+ return (0, import_react20.useCallback)(() => {
1901
1930
  leavingRef.current = true;
1902
1931
  leaveRef.current();
1903
1932
  }, []);
@@ -2032,8 +2061,8 @@ function forgetProfileAchievements(dropStats) {
2032
2061
 
2033
2062
  // src/gameStats.tsx
2034
2063
  var import_achievements2 = require("@tastic/achievements");
2035
- var import_react20 = require("react");
2036
- var import_jsx_runtime21 = require("react/jsx-runtime");
2064
+ var import_react21 = require("react");
2065
+ var import_jsx_runtime22 = require("react/jsx-runtime");
2037
2066
  var SEATS = [1, 2];
2038
2067
  function createGameStats({ key, defaultStats, isValidStats, catalog, getProfileStatsView }) {
2039
2068
  const { actions: actions6, reducer: sliceReducer } = (0, import_achievements2.createAchievementsSlice)({
@@ -2050,7 +2079,7 @@ function createGameStats({ key, defaultStats, isValidStats, catalog, getProfileS
2050
2079
  };
2051
2080
  const reducer6 = onProfileRemoved(sliceReducer, forgetProfileAchievements(dropProfileStats));
2052
2081
  const profileViews = (stats) => Object.fromEntries(Object.entries(stats.profiles).map(([profileId, bucket]) => [profileId, getProfileStatsView(bucket)]));
2053
- const Context = (0, import_react20.createContext)(null);
2082
+ const Context = (0, import_react21.createContext)(null);
2054
2083
  function Provider({ children }) {
2055
2084
  const { stats, unlockedAchievements, recordOutcome, resetAll } = (0, import_achievements2.useAchievements)({
2056
2085
  catalog,
@@ -2058,18 +2087,18 @@ function createGameStats({ key, defaultStats, isValidStats, catalog, getProfileS
2058
2087
  actions: actions6,
2059
2088
  profileViews
2060
2089
  });
2061
- const record = (0, import_react20.useCallback)(
2090
+ const record = (0, import_react21.useCallback)(
2062
2091
  (update, profileIds) => {
2063
2092
  const result = recordOutcome(update);
2064
2093
  return { device: result.device, profiles: (0, import_achievements2.mapUnlocksBySeat)(SEATS, profileIds, result.profiles) };
2065
2094
  },
2066
2095
  [recordOutcome]
2067
2096
  );
2068
- const value = (0, import_react20.useMemo)(() => ({ stats, unlockedAchievements, record, resetAll }), [stats, unlockedAchievements, record, resetAll]);
2069
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Context.Provider, { value, children });
2097
+ const value = (0, import_react21.useMemo)(() => ({ stats, unlockedAchievements, record, resetAll }), [stats, unlockedAchievements, record, resetAll]);
2098
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Context.Provider, { value, children });
2070
2099
  }
2071
2100
  function useStats() {
2072
- const ctx = (0, import_react20.useContext)(Context);
2101
+ const ctx = (0, import_react21.useContext)(Context);
2073
2102
  if (!ctx) throw new Error(`The ${key} stats are read within their game's Provider`);
2074
2103
  return ctx;
2075
2104
  }
@@ -2077,7 +2106,7 @@ function createGameStats({ key, defaultStats, isValidStats, catalog, getProfileS
2077
2106
  }
2078
2107
 
2079
2108
  // src/playerSettings.ts
2080
- var import_react21 = require("react");
2109
+ var import_react22 = require("react");
2081
2110
  var import_react_redux12 = require("react-redux");
2082
2111
  var SEATS2 = [1, 2];
2083
2112
  function seatPlayerKey(selection, seat) {
@@ -2121,8 +2150,8 @@ function createPlayerSettings({ id, defaults, distinctControls }) {
2121
2150
  const saved = (0, import_react_redux12.useSelector)((state) => state[settingsKey]);
2122
2151
  const controls = (0, import_react_redux12.useSelector)((state) => state[controlsKey]);
2123
2152
  const dispatch = (0, import_react_redux12.useDispatch)();
2124
- const settings = (0, import_react21.useMemo)(() => compose(saved, controls, selection, seatTwoIsPerson), [saved, controls, selection, seatTwoIsPerson]);
2125
- const setSettings = (0, import_react21.useCallback)(
2153
+ const settings = (0, import_react22.useMemo)(() => compose(saved, controls, selection, seatTwoIsPerson), [saved, controls, selection, seatTwoIsPerson]);
2154
+ const setSettings = (0, import_react22.useCallback)(
2126
2155
  (next) => {
2127
2156
  const { controlScheme, ...changes } = next;
2128
2157
  if (Object.keys(changes).length > 0) dispatch(patch(seatPlayerKey(selection, 1), changes));
@@ -2155,6 +2184,7 @@ function createPlayerSettings({ id, defaults, distinctControls }) {
2155
2184
  ProfilesRoute,
2156
2185
  RootLayout,
2157
2186
  SettingsDialog,
2187
+ Staged,
2158
2188
  StatsScreen,
2159
2189
  appSettingsActions,
2160
2190
  appSettingsReducer,
package/dist/index.mjs CHANGED
@@ -1605,12 +1605,40 @@ import { useAutoPaperTheme as useAutoPaperTheme5 } from "@rific/auto-paper";
1605
1605
  import { BaseStatsScreen, PressAwayOverlay as PressAwayOverlay3, ScreenFrame as ScreenFrame4, usePopoverHost as usePopoverHost3 } from "@tastic/hud/chrome";
1606
1606
  import { getOptionPickerContentSize as getOptionPickerContentSize2, OptionPicker as OptionPicker2 } from "@tastic/profile";
1607
1607
  import { router as router6 } from "expo-router";
1608
- import { useMemo as useMemo7, useState as useState7 } from "react";
1608
+ import { useMemo as useMemo8, useState as useState8 } from "react";
1609
1609
  import { StyleSheet as StyleSheet5, View as View5 } from "react-native";
1610
1610
  import { SegmentedButtons as SegmentedButtons2, Text as Text3 } from "react-native-paper";
1611
1611
  import { useSafeAreaInsets as useSafeAreaInsets4 } from "react-native-safe-area-context";
1612
1612
  import { useDispatch as useDispatch10 } from "react-redux";
1613
- import { jsx as jsx18, jsxs as jsxs6 } from "react/jsx-runtime";
1613
+
1614
+ // src/components/Staged.tsx
1615
+ import { Children, useEffect as useEffect7, useMemo as useMemo7, useState as useState7 } from "react";
1616
+ import { Fragment as Fragment6, jsx as jsx18 } from "react/jsx-runtime";
1617
+ function onShown(run) {
1618
+ let idle;
1619
+ let frame = requestAnimationFrame(() => {
1620
+ frame = requestAnimationFrame(() => {
1621
+ if (typeof requestIdleCallback === "function") idle = requestIdleCallback(run);
1622
+ else run();
1623
+ });
1624
+ });
1625
+ return () => {
1626
+ cancelAnimationFrame(frame);
1627
+ if (idle !== void 0) cancelIdleCallback(idle);
1628
+ };
1629
+ }
1630
+ function Staged({ first = 1, step = 1, children }) {
1631
+ const parts = useMemo7(() => Children.toArray(children), [children]);
1632
+ const [drawn, setDrawn] = useState7(first);
1633
+ useEffect7(() => {
1634
+ if (drawn >= parts.length) return;
1635
+ return onShown(() => setDrawn(drawn + step));
1636
+ }, [drawn, parts.length, step]);
1637
+ return /* @__PURE__ */ jsx18(Fragment6, { children: parts.slice(0, drawn) });
1638
+ }
1639
+
1640
+ // src/screens/StatsScreen.tsx
1641
+ import { jsx as jsx19, jsxs as jsxs6 } from "react/jsx-runtime";
1614
1642
  var STATS = "stats";
1615
1643
  var ACHIEVEMENTS = "achievements";
1616
1644
  var TABS = [
@@ -1630,10 +1658,10 @@ var MANAGE_OPTION = { value: MANAGE, label: "Manage", icon: "account-cog-outline
1630
1658
  var STATS_MAX_WIDTH = 640;
1631
1659
  function StatsScreen() {
1632
1660
  const pickerHost = usePopoverHost3();
1633
- return /* @__PURE__ */ jsx18(StatsPressAway, { host: pickerHost, children: /* @__PURE__ */ jsx18(ScreenFrame4, { portalHost: true, maxContentWidth: STATS_MAX_WIDTH, children: /* @__PURE__ */ jsx18(StatsContent, { pickerHost }) }) });
1661
+ return /* @__PURE__ */ jsx19(StatsPressAway, { host: pickerHost, children: /* @__PURE__ */ jsx19(ScreenFrame4, { portalHost: true, maxContentWidth: STATS_MAX_WIDTH, children: /* @__PURE__ */ jsx19(StatsContent, { pickerHost }) }) });
1634
1662
  }
1635
1663
  function StatsPressAway({ host, children }) {
1636
- return /* @__PURE__ */ jsx18(View5, { testID: "stats-press-away", style: styles5.screen, onStartShouldSetResponder: () => host.openId !== null, onResponderRelease: host.close, children });
1664
+ return /* @__PURE__ */ jsx19(View5, { testID: "stats-press-away", style: styles5.screen, onStartShouldSetResponder: () => host.openId !== null, onResponderRelease: host.close, children });
1637
1665
  }
1638
1666
  var useNoPackReset = () => null;
1639
1667
  var noPickerAlign2 = () => void 0;
@@ -1645,11 +1673,11 @@ function StatsContent({ pickerHost }) {
1645
1673
  const { profiles, lastSelected } = useProfiles();
1646
1674
  const dispatch = useDispatch10();
1647
1675
  const fg = pack.foreground ?? colors.onBackground;
1648
- const [tab, setTab] = useState7(STATS);
1649
- const [gameId, setGameId] = useState7(ALL_GAMES2);
1676
+ const [tab, setTab] = useState8(STATS);
1677
+ const [gameId, setGameId] = useState8(ALL_GAMES2);
1650
1678
  const useStatsPlayer = pack.useStatsPlayer ?? useNoStatsPlayer;
1651
1679
  const statsPlayer = useStatsPlayer();
1652
- const [selectedProfileId, setSelectedProfileId] = useState7(() => pack.useStatsPlayer ? statsPlayer : pack.guestStats ? lastSelected[1] ?? GUEST_PLAYER_ID : null);
1680
+ const [selectedProfileId, setSelectedProfileId] = useState8(() => pack.useStatsPlayer ? statsPlayer : pack.guestStats ? lastSelected[1] ?? GUEST_PLAYER_ID : null);
1653
1681
  const profileId = selectedProfileId && profiles.length > 0 && (pack.guestStats && selectedProfileId === GUEST_PLAYER_ID || profiles.some((p) => p.id === selectedProfileId)) ? selectedProfileId : null;
1654
1682
  const homeTabs = pack.homeTabs && pack.homeTabs.length > 1 ? pack.homeTabs : null;
1655
1683
  const pickedTab = homeTabs?.findIndex((_, index) => gameId === tabGames(index)) ?? -1;
@@ -1659,14 +1687,14 @@ function StatsContent({ pickerHost }) {
1659
1687
  const packTabs = pack.statsTabs ?? NO_PACK_TABS;
1660
1688
  const packTab = packTabs.find((t) => t.value === tab);
1661
1689
  const showGamePicker = !(tab === ACHIEVEMENTS && pack.AchievementList);
1662
- 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]);
1663
- const gameOptions = useMemo7(() => {
1690
+ const playerOptions = useMemo8(() => [{ 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]);
1691
+ const gameOptions = useMemo8(() => {
1664
1692
  const all = { value: ALL_GAMES2, label: "All Games", icon: "view-grid-outline" };
1665
1693
  const option = (g) => ({ value: g.id, label: g.title, icon: "cards-playing-outline" });
1666
1694
  if (!homeTabs) return [all, ...pack.games.map(option)];
1667
1695
  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)] }))];
1668
1696
  }, [pack.games, homeTabs]);
1669
- const tabButtons = useMemo7(() => {
1697
+ const tabButtons = useMemo8(() => {
1670
1698
  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;
1671
1699
  return pack.labelStyle ? buttons.map((button) => ({ ...button, labelStyle: pack.labelStyle })) : buttons;
1672
1700
  }, [packTabs, pack.labelStyle]);
@@ -1683,15 +1711,15 @@ function StatsContent({ pickerHost }) {
1683
1711
  const triggerStyle = pack.Backdrop ? [styles5.pill, surface] : void 0;
1684
1712
  const PackTabContent = packTab?.Content;
1685
1713
  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: [
1686
- /* @__PURE__ */ jsx18(PressAwayOverlay3, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles5.pressAway }),
1687
- /* @__PURE__ */ jsx18(SegmentedButtons2, { value: tab, onValueChange: setTab, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles5.tabs, surface] }),
1714
+ /* @__PURE__ */ jsx19(PressAwayOverlay3, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles5.pressAway }),
1715
+ /* @__PURE__ */ jsx19(SegmentedButtons2, { value: tab, onValueChange: setTab, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles5.tabs, surface] }),
1688
1716
  /* @__PURE__ */ jsxs6(View5, { style: [styles5.filters, pickerHost.openId !== null && styles5.filtersOpen], onStartShouldSetResponder: () => pickerHost.openId !== null, children: [
1689
- /* @__PURE__ */ jsx18(OptionPicker2, { id: PLAYER_PICKER_ID, host: pickerHost, options: playerOptions, value: profileId ?? EVERYONE, onChange: (value) => value === MANAGE ? router6.push(PROFILES_HREF) : setSelectedProfileId(value === EVERYONE ? null : value), color: colors.primary, dark, icon: profileId ? "account" : "account-group", caption: "Player", alignOverride: playerAlign, triggerStyle }),
1690
- showGamePicker && /* @__PURE__ */ jsx18(OptionPicker2, { id: GAME_PICKER_ID, host: pickerHost, options: gameOptions, value: gameId, onChange: setGameId, color: colors.primary, dark, icon: "view-grid-outline", caption: "Game", alignOverride: gameAlign, triggerStyle })
1717
+ /* @__PURE__ */ jsx19(OptionPicker2, { id: PLAYER_PICKER_ID, host: pickerHost, options: playerOptions, value: profileId ?? EVERYONE, onChange: (value) => value === MANAGE ? router6.push(PROFILES_HREF) : setSelectedProfileId(value === EVERYONE ? null : value), color: colors.primary, dark, icon: profileId ? "account" : "account-group", caption: "Player", alignOverride: playerAlign, triggerStyle }),
1718
+ showGamePicker && /* @__PURE__ */ jsx19(OptionPicker2, { id: GAME_PICKER_ID, host: pickerHost, options: gameOptions, value: gameId, onChange: setGameId, color: colors.primary, dark, icon: "view-grid-outline", caption: "Game", alignOverride: gameAlign, triggerStyle })
1691
1719
  ] }),
1692
- tab === STATS && pack.StatsSections && /* @__PURE__ */ jsx18(pack.StatsSections, { profileId, gameId: oneGameId, gameIds }),
1693
- PackTabContent && /* @__PURE__ */ jsx18(PackTabContent, { profileId, gameId: oneGameId, gameIds }),
1694
- tab === ACHIEVEMENTS && pack.AchievementList ? /* @__PURE__ */ jsx18(pack.AchievementList, { profileId }) : (tab === STATS || tab === ACHIEVEMENTS) && games.map((game) => /* @__PURE__ */ jsx18(GameStats, { game, tab, profileId, showTitle: games.length > 1 && pack.statsGameTitles !== false, titleColor: fg }, game.id))
1720
+ tab === STATS && pack.StatsSections && /* @__PURE__ */ jsx19(pack.StatsSections, { profileId, gameId: oneGameId, gameIds }),
1721
+ PackTabContent && /* @__PURE__ */ jsx19(PackTabContent, { profileId, gameId: oneGameId, gameIds }),
1722
+ tab === ACHIEVEMENTS && pack.AchievementList ? /* @__PURE__ */ jsx19(pack.AchievementList, { profileId }) : (tab === STATS || tab === ACHIEVEMENTS) && /* @__PURE__ */ jsx19(Staged, { first: tab === STATS && pack.StatsSections ? 0 : 1, children: games.map((game) => /* @__PURE__ */ jsx19(GameStats, { game, tab, profileId, showTitle: games.length > 1 && pack.statsGameTitles !== false, titleColor: fg }, game.id)) }, `${tab} ${gameId}`)
1695
1723
  ] });
1696
1724
  }
1697
1725
  function resetFor(pack, packReset, profileId, profiles, games, resetGames) {
@@ -1708,8 +1736,8 @@ function GameStats({ game, tab, profileId, showTitle, titleColor }) {
1708
1736
  const Sections = tab === STATS ? StatsSections : AchievementList;
1709
1737
  if (!Sections) return null;
1710
1738
  return /* @__PURE__ */ jsxs6(View5, { style: styles5.game, children: [
1711
- showTitle && /* @__PURE__ */ jsx18(Text3, { variant: "titleLarge", style: [styles5.gameTitle, { color: titleColor }, titleStyle], children: game.title }),
1712
- /* @__PURE__ */ jsx18(Sections, { profileId })
1739
+ showTitle && /* @__PURE__ */ jsx19(Text3, { variant: "titleLarge", style: [styles5.gameTitle, { color: titleColor }, titleStyle], children: game.title }),
1740
+ /* @__PURE__ */ jsx19(Sections, { profileId })
1713
1741
  ] });
1714
1742
  }
1715
1743
  var styles5 = StyleSheet5.create({
@@ -1747,21 +1775,21 @@ var styles5 = StyleSheet5.create({
1747
1775
 
1748
1776
  // src/components/imageGameIcon.tsx
1749
1777
  import { Image } from "react-native";
1750
- import { jsx as jsx19 } from "react/jsx-runtime";
1778
+ import { jsx as jsx20 } from "react/jsx-runtime";
1751
1779
  function imageGameIcon(images) {
1752
1780
  return function ImageGameIcon({ size, dark }) {
1753
- return /* @__PURE__ */ jsx19(Image, { source: dark ? images.dark : images.light, style: { height: size, width: size }, accessibilityIgnoresInvertColors: true });
1781
+ return /* @__PURE__ */ jsx20(Image, { source: dark ? images.dark : images.light, style: { height: size, width: size }, accessibilityIgnoresInvertColors: true });
1754
1782
  };
1755
1783
  }
1756
1784
 
1757
1785
  // src/components/MatchChips.tsx
1758
1786
  import { useAutoPaperTheme as useAutoPaperTheme6 } from "@rific/auto-paper";
1759
1787
  import { IconButton as IconButton2 } from "@rific/feedback-press";
1760
- import { useEffect as useEffect7 } from "react";
1788
+ import { useEffect as useEffect8 } from "react";
1761
1789
  import { StyleSheet as StyleSheet6, useWindowDimensions as useWindowDimensions2 } from "react-native";
1762
1790
  import Animated2, { useAnimatedStyle, useSharedValue, withTiming } from "react-native-reanimated";
1763
1791
  import { useSafeAreaInsets as useSafeAreaInsets5 } from "react-native-safe-area-context";
1764
- import { Fragment as Fragment6, jsx as jsx20, jsxs as jsxs7 } from "react/jsx-runtime";
1792
+ import { Fragment as Fragment7, jsx as jsx21, jsxs as jsxs7 } from "react/jsx-runtime";
1765
1793
  var MATCH_CHIPS_FADE_MS = 150;
1766
1794
  var CHIP_SIZE = 48;
1767
1795
  var EDGE_PAD = 8;
@@ -1772,7 +1800,7 @@ function MatchChips({ playing, faceToFace, centerLineY, onBack, onSettings }) {
1772
1800
  const atComputer = useAtComputer();
1773
1801
  const visible = atComputer || !playing;
1774
1802
  const opacity = useSharedValue(visible ? 1 : 0);
1775
- useEffect7(() => {
1803
+ useEffect8(() => {
1776
1804
  opacity.value = withTiming(visible ? 1 : 0, { duration: MATCH_CHIPS_FADE_MS });
1777
1805
  }, [visible]);
1778
1806
  const fadeStyle = useAnimatedStyle(() => ({ opacity: opacity.value }));
@@ -1783,9 +1811,9 @@ function MatchChips({ playing, faceToFace, centerLineY, onBack, onSettings }) {
1783
1811
  const backSlot = { top, left: EDGE_PAD + insets.left };
1784
1812
  const settingsSlot = { top, right: EDGE_PAD + insets.right };
1785
1813
  const pointerEvents = visible ? "box-none" : "none";
1786
- return /* @__PURE__ */ jsxs7(Fragment6, { children: [
1787
- /* @__PURE__ */ jsx20(Animated2.View, { pointerEvents, style: [styles6.slot, backSlot, fadeStyle], testID: "match-chips-back", children: /* @__PURE__ */ jsx20(IconButton2, { icon: "arrow-left", iconColor, containerColor, style: styles6.chip, size: 24, onPress: onBack, accessibilityLabel: "Back" }) }),
1788
- /* @__PURE__ */ jsx20(Animated2.View, { pointerEvents, style: [styles6.slot, settingsSlot, fadeStyle], testID: "match-chips-settings", children: /* @__PURE__ */ jsx20(IconButton2, { icon: "cog", iconColor, containerColor, style: styles6.chip, size: 24, onPress: onSettings, accessibilityLabel: "Settings" }) })
1814
+ return /* @__PURE__ */ jsxs7(Fragment7, { children: [
1815
+ /* @__PURE__ */ jsx21(Animated2.View, { pointerEvents, style: [styles6.slot, backSlot, fadeStyle], testID: "match-chips-back", children: /* @__PURE__ */ jsx21(IconButton2, { icon: "arrow-left", iconColor, containerColor, style: styles6.chip, size: 24, onPress: onBack, accessibilityLabel: "Back" }) }),
1816
+ /* @__PURE__ */ jsx21(Animated2.View, { pointerEvents, style: [styles6.slot, settingsSlot, fadeStyle], testID: "match-chips-settings", children: /* @__PURE__ */ jsx21(IconButton2, { icon: "cog", iconColor, containerColor, style: styles6.chip, size: 24, onPress: onSettings, accessibilityLabel: "Settings" }) })
1789
1817
  ] });
1790
1818
  }
1791
1819
  var styles6 = StyleSheet6.create({
@@ -1804,12 +1832,12 @@ function useActiveRound(game, defaults) {
1804
1832
 
1805
1833
  // src/hooks/useBackBlock.ts
1806
1834
  import { usePreventRemove } from "expo-router";
1807
- import { useCallback as useCallback11, useEffect as useEffect8, useRef as useRef7, useState as useState8 } from "react";
1835
+ import { useCallback as useCallback11, useEffect as useEffect9, useRef as useRef7, useState as useState9 } from "react";
1808
1836
  function useBackBlock(held, onHeld, leave = safeBack) {
1809
1837
  const leavingRef = useRef7(false);
1810
- const [leaving, setLeaving] = useState8(false);
1838
+ const [leaving, setLeaving] = useState9(false);
1811
1839
  const leaveRef = useRef7(leave);
1812
- useEffect8(() => {
1840
+ useEffect9(() => {
1813
1841
  leaveRef.current = leave;
1814
1842
  });
1815
1843
  usePreventRemove(held && !leaving, ({ repeat }) => {
@@ -1953,8 +1981,8 @@ function forgetProfileAchievements(dropStats) {
1953
1981
 
1954
1982
  // src/gameStats.tsx
1955
1983
  import { createAchievementsSlice, mapUnlocksBySeat, useAchievements } from "@tastic/achievements";
1956
- import { createContext as createContext6, useCallback as useCallback12, useContext as useContext6, useMemo as useMemo8 } from "react";
1957
- import { jsx as jsx21 } from "react/jsx-runtime";
1984
+ import { createContext as createContext6, useCallback as useCallback12, useContext as useContext6, useMemo as useMemo9 } from "react";
1985
+ import { jsx as jsx22 } from "react/jsx-runtime";
1958
1986
  var SEATS = [1, 2];
1959
1987
  function createGameStats({ key, defaultStats, isValidStats, catalog, getProfileStatsView }) {
1960
1988
  const { actions: actions6, reducer: sliceReducer } = createAchievementsSlice({
@@ -1986,8 +2014,8 @@ function createGameStats({ key, defaultStats, isValidStats, catalog, getProfileS
1986
2014
  },
1987
2015
  [recordOutcome]
1988
2016
  );
1989
- const value = useMemo8(() => ({ stats, unlockedAchievements, record, resetAll }), [stats, unlockedAchievements, record, resetAll]);
1990
- return /* @__PURE__ */ jsx21(Context.Provider, { value, children });
2017
+ const value = useMemo9(() => ({ stats, unlockedAchievements, record, resetAll }), [stats, unlockedAchievements, record, resetAll]);
2018
+ return /* @__PURE__ */ jsx22(Context.Provider, { value, children });
1991
2019
  }
1992
2020
  function useStats() {
1993
2021
  const ctx = useContext6(Context);
@@ -1998,7 +2026,7 @@ function createGameStats({ key, defaultStats, isValidStats, catalog, getProfileS
1998
2026
  }
1999
2027
 
2000
2028
  // src/playerSettings.ts
2001
- import { useCallback as useCallback13, useMemo as useMemo9 } from "react";
2029
+ import { useCallback as useCallback13, useMemo as useMemo10 } from "react";
2002
2030
  import { useDispatch as useDispatch11, useSelector as useSelector9 } from "react-redux";
2003
2031
  var SEATS2 = [1, 2];
2004
2032
  function seatPlayerKey(selection, seat) {
@@ -2042,7 +2070,7 @@ function createPlayerSettings({ id, defaults, distinctControls }) {
2042
2070
  const saved = useSelector9((state) => state[settingsKey]);
2043
2071
  const controls = useSelector9((state) => state[controlsKey]);
2044
2072
  const dispatch = useDispatch11();
2045
- const settings = useMemo9(() => compose(saved, controls, selection, seatTwoIsPerson), [saved, controls, selection, seatTwoIsPerson]);
2073
+ const settings = useMemo10(() => compose(saved, controls, selection, seatTwoIsPerson), [saved, controls, selection, seatTwoIsPerson]);
2046
2074
  const setSettings = useCallback13(
2047
2075
  (next) => {
2048
2076
  const { controlScheme, ...changes } = next;
@@ -2075,6 +2103,7 @@ export {
2075
2103
  ProfilesRoute,
2076
2104
  RootLayout,
2077
2105
  SettingsDialog,
2106
+ Staged,
2078
2107
  StatsScreen,
2079
2108
  appSettingsActions,
2080
2109
  appSettingsSlice_default as appSettingsReducer,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tastic/shell",
3
- "version": "0.21.1",
3
+ "version": "0.22.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",
@@ -0,0 +1,46 @@
1
+ import { Children, type ReactNode, useEffect, useMemo, useState } from 'react'
2
+
3
+ interface Props {
4
+ // How many children to draw at once: what a screen shows before any scrolling
5
+ first?: number
6
+ // How many more at each idle moment after that
7
+ step?: number
8
+ children: ReactNode
9
+ }
10
+
11
+ // Runs once what's drawn so far has reached the screen and the app has a moment, and returns its cancel. The frames come first:
12
+ // on Android a screen's views are built on the main thread, a frame's work at a time, and parts handed over before it has drawn
13
+ // are built before it can, so a page drawn in idle moments alone was no sooner on screen than one drawn at once. The first frame
14
+ // is the one that builds what was just drawn, the second the one after it's shown. Then an idle moment, with no timeout: idle
15
+ // callbacks run soonest deadline first, and one would put these parts, past the screen's bottom edge, ahead of what else waits
16
+ // for one, a calendar at the top of the screen included. Safari has no idle callbacks, so there it's the frames alone.
17
+ function onShown(run: () => void): () => void {
18
+ let idle: number | undefined
19
+ let frame = requestAnimationFrame(() => {
20
+ frame = requestAnimationFrame(() => {
21
+ if (typeof requestIdleCallback === 'function') idle = requestIdleCallback(run)
22
+ else run()
23
+ })
24
+ })
25
+ return () => {
26
+ cancelAnimationFrame(frame)
27
+ if (idle !== undefined) cancelIdleCallback(idle)
28
+ }
29
+ }
30
+
31
+ // A long page's parts (a stats screen's wells, an achievement list's rows) drawn a few at a time: the first ones with the
32
+ // screen, the rest at the idle moments after it's shown. Every part at once was a screen that took a budget phone two seconds to open,
33
+ // frozen, for rows far past its bottom edge (CardTastic's twenty games on the LG Stylo 6, 2026-11-30). The parts drawn keep
34
+ // their elements as more come, so none of them renders again. It draws no view of its own: the parts are flat siblings of
35
+ // whatever is round it, as they were. Give it a `key` that changes with what's listed (a tab, a filter), or a longer list
36
+ // taking a shorter one's place comes in all at once.
37
+ export function Staged({ first = 1, step = 1, children }: Props) {
38
+ // Kept while the children are the same, so a step hands React the very elements it has
39
+ const parts = useMemo(() => Children.toArray(children), [children])
40
+ const [drawn, setDrawn] = useState(first)
41
+ useEffect(() => {
42
+ if (drawn >= parts.length) return
43
+ return onShown(() => setDrawn(drawn + step))
44
+ }, [drawn, parts.length, step])
45
+ return <>{parts.slice(0, drawn)}</>
46
+ }
package/src/index.ts CHANGED
@@ -18,6 +18,7 @@ export { useGameGuide } from './components/GuideHost'
18
18
  export { imageGameIcon } from './components/imageGameIcon'
19
19
  export { MATCH_CHIPS_FADE_MS, MatchChips, type MatchChipsProps } from './components/MatchChips'
20
20
  export { SettingsDialog, type SettingsDialogProps } from './components/SettingsDialog'
21
+ export { Staged } from './components/Staged'
21
22
  export { useActiveRound } from './hooks/useActiveRound'
22
23
  export { useAppSettings } from './hooks/useAppSettings'
23
24
  export { useAtComputer } from './hooks/useAtComputer'
@@ -9,6 +9,7 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context'
9
9
  import { useDispatch } from 'react-redux'
10
10
 
11
11
  import { SEGMENT_RADIUS, SEGMENT_THEME } from '../components/segmentTheme'
12
+ import { Staged } from '../components/Staged'
12
13
  import { useProfiles } from '../hooks/useProfiles'
13
14
  import { safeBack } from '../navigation'
14
15
  import { usePack } from '../PackContext'
@@ -181,7 +182,20 @@ function StatsContent({ pickerHost }: { pickerHost: PopoverHost }) {
181
182
 
182
183
  {PackTabContent && <PackTabContent profileId={profileId} gameId={oneGameId} gameIds={gameIds} />}
183
184
 
184
- {tab === ACHIEVEMENTS && pack.AchievementList ? <pack.AchievementList profileId={profileId} /> : (tab === STATS || tab === ACHIEVEMENTS) && games.map((game) => <GameStats key={game.id} game={game} tab={tab} profileId={profileId} showTitle={games.length > 1 && pack.statsGameTitles !== false} titleColor={fg} />)}
185
+ {/* Each game's own sections: the first with the screen, unless the pack's own section is above it, and the rest a game at
186
+ each idle moment after it's shown. Every game's at once held the screen back for seconds on a budget phone, for wells past
187
+ its bottom edge. The parts are flat siblings on the page, as they were. */}
188
+ {tab === ACHIEVEMENTS && pack.AchievementList ? (
189
+ <pack.AchievementList profileId={profileId} />
190
+ ) : (
191
+ (tab === STATS || tab === ACHIEVEMENTS) && (
192
+ <Staged key={`${tab} ${gameId}`} first={tab === STATS && pack.StatsSections ? 0 : 1}>
193
+ {games.map((game) => (
194
+ <GameStats key={game.id} game={game} tab={tab} profileId={profileId} showTitle={games.length > 1 && pack.statsGameTitles !== false} titleColor={fg} />
195
+ ))}
196
+ </Staged>
197
+ )
198
+ )}
185
199
  </BaseStatsScreen>
186
200
  )
187
201
  }