@tastic/shell 0.20.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 +4 -4
- package/dist/index.js +93 -47
- package/dist/index.mjs +114 -68
- package/package.json +12 -12
- package/src/RootLayout.tsx +26 -14
- package/src/components/Providers.tsx +6 -3
- package/src/screens/HomeScreen.tsx +168 -76
- package/src/splashGate.ts +2 -1
package/README.md
CHANGED
|
@@ -131,7 +131,7 @@ PuckTastic and DuelTastic draw what they always did:
|
|
|
131
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. |
|
|
132
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). |
|
|
133
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). |
|
|
134
|
-
| `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. |
|
|
135
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. |
|
|
136
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. |
|
|
137
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. |
|
|
@@ -149,7 +149,7 @@ PuckTastic and DuelTastic draw what they always did:
|
|
|
149
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. |
|
|
150
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. |
|
|
151
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. |
|
|
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 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. |
|
|
153
153
|
|
|
154
154
|
### `GameDefinition`
|
|
155
155
|
|
|
@@ -392,7 +392,7 @@ what the shell started using (noted in the table).
|
|
|
392
392
|
| `react`, `react-native` | >=19.3.0, >=0.88.0 | everything |
|
|
393
393
|
| `expo-router` | >=58.0.23 | the stack, the routes, `safeBack`, focus effects, the web tab title |
|
|
394
394
|
| `expo-font`, `@expo/vector-icons` | >=58.0.8, >=15.1.1 | the icon font and the pack's `fonts`, behind the splash screen |
|
|
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 |
|
|
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 |
|
|
396
396
|
| `expo-constants` | >=58.0.12 | the web tab title |
|
|
397
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 |
|
|
398
398
|
| `expo-haptics`, `expo-keep-awake` | >=58.0.7, >=58.0.3 | the toaster's haptics, Keep Awake |
|
|
@@ -402,7 +402,7 @@ what the shell started using (noted in the table).
|
|
|
402
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 |
|
|
403
403
|
| `@rific/auto-paper` | >=0.13.4 | the theme |
|
|
404
404
|
| `@rific/core` | >=0.5.0 | settings slices, Keep Awake, `safeBack` |
|
|
405
|
-
| `@rific/feedback-press` | >=0.
|
|
405
|
+
| `@rific/feedback-press` | >=0.15.0 | haptic and sound settings, the UI sounds |
|
|
406
406
|
| `@rific/toaster` | >=0.10.1 | toasts |
|
|
407
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`) |
|
|
408
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
|
|
256
|
-
const
|
|
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
|
-
|
|
523
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
524
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_expo_router.
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
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 }) {
|
|
@@ -1308,6 +1316,10 @@ function HomeMenu() {
|
|
|
1308
1316
|
const tab = tabs ? tabs.find((t) => t.label === tabLabel) ?? tabs[0] : null;
|
|
1309
1317
|
const tabButtons = (0, import_react16.useMemo)(() => tabs?.map(({ label }) => ({ value: label, label, labelStyle: pack.labelStyle })) ?? [], [tabs, pack.labelStyle]);
|
|
1310
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]);
|
|
1311
1323
|
const columnClamp = useClampOnShrink();
|
|
1312
1324
|
const gridClamp = useClampOnShrink();
|
|
1313
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]);
|
|
@@ -1321,23 +1333,23 @@ function HomeMenu() {
|
|
|
1321
1333
|
const RulesSheet = rulesGame?.Rules;
|
|
1322
1334
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native9.View, { style: [styles4.container, { backgroundColor: bg }], children: [
|
|
1323
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: [
|
|
1324
|
-
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: [
|
|
1325
1337
|
pressAway,
|
|
1326
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: [
|
|
1327
1339
|
tabBar && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native9.View, { style: [styles4.wideTabs, { width: layout.rightPaneWidth }], children: tabBar }),
|
|
1328
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native9.View, { style:
|
|
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 }) }) })
|
|
1329
1341
|
] }),
|
|
1330
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: [
|
|
1331
|
-
|
|
1343
|
+
hero,
|
|
1332
1344
|
showPicker && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native9.View, { style: styles4.widePicker, children: picker })
|
|
1333
1345
|
] })
|
|
1334
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: [
|
|
1335
1347
|
pressAway,
|
|
1336
|
-
|
|
1348
|
+
hero,
|
|
1337
1349
|
showPicker && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native9.View, { style: [styles4.picker, pickerHost.openId !== null && styles4.pickerOpen], children: picker }),
|
|
1338
1350
|
tabBar && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native9.View, { style: styles4.listWidth, children: tabBar }),
|
|
1339
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native9.View, { style: styles4.
|
|
1340
|
-
] }),
|
|
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
|
+
] }) }),
|
|
1341
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" }),
|
|
1342
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" }),
|
|
1343
1355
|
RulesSheet && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(RulesSheet, { visible: true, onDismiss: () => setRulesGame(null) })
|
|
@@ -1347,9 +1359,36 @@ function HomeMenu() {
|
|
|
1347
1359
|
}
|
|
1348
1360
|
var SEAT_ONE_PICKER = "home-p1";
|
|
1349
1361
|
var noPickerAlign = () => void 0;
|
|
1350
|
-
|
|
1351
|
-
|
|
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
|
+
});
|
|
1352
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;
|
|
1353
1392
|
function useClampOnShrink() {
|
|
1354
1393
|
const view = (0, import_react16.useRef)(null);
|
|
1355
1394
|
const sizes = (0, import_react16.useRef)({ viewport: 0, offset: 0 });
|
|
@@ -1381,39 +1420,46 @@ function hasRules(game) {
|
|
|
1381
1420
|
function RulesHost({ enabled, children }) {
|
|
1382
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 });
|
|
1383
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
|
+
});
|
|
1384
1429
|
var ROW_BLURB_LINES = 3;
|
|
1385
|
-
|
|
1430
|
+
var GameRow = (0, import_react16.memo)(function GameRow2({ game, dark, p1Color, p2Color, onOpen, onRules }) {
|
|
1386
1431
|
const { titleStyle } = usePack();
|
|
1387
1432
|
const well = (0, import_chrome7.useWellColors)();
|
|
1388
1433
|
const GameIcon = game.icon;
|
|
1389
1434
|
return (
|
|
1390
1435
|
// The rules button sits beside the row's own button, laid over its end, not inside it: a button
|
|
1391
1436
|
// inside a button is invalid on the web.
|
|
1392
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native9.View, {
|
|
1393
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_feedback_press3.Pressable, { onPress, style: [styles4.row, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
|
|
1394
|
-
game.Preview ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PreviewBox, { game, width: ROW_PREVIEW_WIDTH,
|
|
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 }) }),
|
|
1395
1440
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native9.View, { style: styles4.rowText, children: [
|
|
1396
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 }),
|
|
1397
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 })
|
|
1398
1443
|
] })
|
|
1399
1444
|
] }),
|
|
1400
|
-
|
|
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 }) })
|
|
1401
1446
|
] })
|
|
1402
1447
|
);
|
|
1403
|
-
}
|
|
1404
|
-
|
|
1448
|
+
});
|
|
1449
|
+
var GameTile = (0, import_react16.memo)(function GameTile2({ game, width, previewWidth, dark, p1Color, p2Color, onOpen, onRules }) {
|
|
1405
1450
|
const { titleStyle } = usePack();
|
|
1406
1451
|
const well = (0, import_chrome7.useWellColors)();
|
|
1407
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native9.View, { style:
|
|
1408
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_feedback_press3.Pressable, { onPress, style: [styles4.tile, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
|
|
1409
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PreviewBox, { game, width: previewWidth,
|
|
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 }),
|
|
1410
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 }),
|
|
1411
1456
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper2.Text, { variant: "bodySmall", style: { color: well.fgMuted }, numberOfLines: 3, children: game.blurb })
|
|
1412
1457
|
] }),
|
|
1413
|
-
|
|
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" }) })
|
|
1414
1459
|
] });
|
|
1415
|
-
}
|
|
1416
|
-
function PreviewBox({ game, width,
|
|
1460
|
+
});
|
|
1461
|
+
function PreviewBox({ game, width, dark, p1Color, p2Color }) {
|
|
1462
|
+
const revealed = (0, import_react16.useContext)(PreviewsRevealedContext);
|
|
1417
1463
|
const height = Math.round(width / PREVIEW_ASPECT);
|
|
1418
1464
|
const { Preview, icon: GameIcon } = game;
|
|
1419
1465
|
const iconSize = Math.min(height, ROW_ICON_SIZE);
|
|
@@ -1443,21 +1489,21 @@ var styles4 = import_react_native9.StyleSheet.create({
|
|
|
1443
1489
|
flexWrap: "wrap",
|
|
1444
1490
|
gap: HOME_GRID_GAP
|
|
1445
1491
|
},
|
|
1446
|
-
//
|
|
1447
|
-
hidden: {
|
|
1448
|
-
display: "none"
|
|
1449
|
-
},
|
|
1450
|
-
// Solitaire's list: one column, never wider than a phone's, centred on a wide screen.
|
|
1492
|
+
// Solitaire's list: one column.
|
|
1451
1493
|
list: {
|
|
1452
|
-
gap: 14
|
|
1453
|
-
maxWidth: 480,
|
|
1454
|
-
width: "100%"
|
|
1494
|
+
gap: 14
|
|
1455
1495
|
},
|
|
1456
|
-
// The list's width,
|
|
1496
|
+
// The list's width, and the tabs' over it: never wider than a phone's, centred on a wide screen.
|
|
1457
1497
|
listWidth: {
|
|
1458
1498
|
maxWidth: 480,
|
|
1459
1499
|
width: "100%"
|
|
1460
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
|
+
}),
|
|
1461
1507
|
picker: {
|
|
1462
1508
|
alignItems: "center"
|
|
1463
1509
|
},
|
|
@@ -1586,7 +1632,7 @@ var TABS = [
|
|
|
1586
1632
|
var LABEL_WIDE_TAB = { flex: 0, flexBasis: "auto", flexGrow: 1, flexShrink: 1 };
|
|
1587
1633
|
var NO_PACK_TABS = [];
|
|
1588
1634
|
var EVERYONE = "__everyone__";
|
|
1589
|
-
var
|
|
1635
|
+
var ALL_GAMES2 = "__all__";
|
|
1590
1636
|
var tabGroup = (index) => `__tab-group-${index}__`;
|
|
1591
1637
|
var tabGames = (index) => `__tab-${index}__`;
|
|
1592
1638
|
var PLAYER_PICKER_ID = "stats-player";
|
|
@@ -1612,22 +1658,22 @@ function StatsContent({ pickerHost }) {
|
|
|
1612
1658
|
const dispatch = (0, import_react_redux10.useDispatch)();
|
|
1613
1659
|
const fg = pack.foreground ?? colors.onBackground;
|
|
1614
1660
|
const [tab, setTab] = (0, import_react17.useState)(STATS);
|
|
1615
|
-
const [gameId, setGameId] = (0, import_react17.useState)(
|
|
1661
|
+
const [gameId, setGameId] = (0, import_react17.useState)(ALL_GAMES2);
|
|
1616
1662
|
const useStatsPlayer = pack.useStatsPlayer ?? useNoStatsPlayer;
|
|
1617
1663
|
const statsPlayer = useStatsPlayer();
|
|
1618
1664
|
const [selectedProfileId, setSelectedProfileId] = (0, import_react17.useState)(() => pack.useStatsPlayer ? statsPlayer : pack.guestStats ? lastSelected[1] ?? GUEST_PLAYER_ID : null);
|
|
1619
1665
|
const profileId = selectedProfileId && profiles.length > 0 && (pack.guestStats && selectedProfileId === GUEST_PLAYER_ID || profiles.some((p) => p.id === selectedProfileId)) ? selectedProfileId : null;
|
|
1620
1666
|
const homeTabs = pack.homeTabs && pack.homeTabs.length > 1 ? pack.homeTabs : null;
|
|
1621
1667
|
const pickedTab = homeTabs?.findIndex((_, index) => gameId === tabGames(index)) ?? -1;
|
|
1622
|
-
const games = gameId ===
|
|
1623
|
-
const gameIds = gameId ===
|
|
1624
|
-
const oneGameId = 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;
|
|
1625
1671
|
const packTabs = pack.statsTabs ?? NO_PACK_TABS;
|
|
1626
1672
|
const packTab = packTabs.find((t) => t.value === tab);
|
|
1627
1673
|
const showGamePicker = !(tab === ACHIEVEMENTS && pack.AchievementList);
|
|
1628
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]);
|
|
1629
1675
|
const gameOptions = (0, import_react17.useMemo)(() => {
|
|
1630
|
-
const all = { value:
|
|
1676
|
+
const all = { value: ALL_GAMES2, label: "All Games", icon: "view-grid-outline" };
|
|
1631
1677
|
const option = (g) => ({ value: g.id, label: g.title, icon: "cards-playing-outline" });
|
|
1632
1678
|
if (!homeTabs) return [all, ...pack.games.map(option)];
|
|
1633
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)] }))];
|