@tastic/shell 0.8.2 → 0.9.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 +32 -2
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +192 -161
- package/dist/index.mjs +147 -117
- package/package.json +3 -2
- package/src/RootLayout.tsx +38 -35
- package/src/components/GuideHost.tsx +3 -2
- package/src/components/WindowControlsInsets.tsx +19 -0
- package/src/hooks/useActiveRound.ts +7 -5
- package/src/hooks/useBackBlock.ts +38 -0
- package/src/index.ts +1 -0
- package/src/redux/opponentSlice.ts +2 -2
- package/src/types.ts +8 -5
package/dist/index.js
CHANGED
|
@@ -73,6 +73,7 @@ __export(index_exports, {
|
|
|
73
73
|
useActiveRound: () => useActiveRound,
|
|
74
74
|
useAppSettings: () => useAppSettings,
|
|
75
75
|
useAtComputer: () => useAtComputer,
|
|
76
|
+
useBackBlock: () => useBackBlock,
|
|
76
77
|
useGameGuide: () => useGameGuide,
|
|
77
78
|
useOpponent: () => useOpponent,
|
|
78
79
|
usePack: () => usePack,
|
|
@@ -108,10 +109,10 @@ var import_profile3 = require("@tastic/profile");
|
|
|
108
109
|
var Haptics = __toESM(require("expo-haptics"));
|
|
109
110
|
var import_expo_router = require("expo-router");
|
|
110
111
|
var import_react8 = require("react");
|
|
111
|
-
var
|
|
112
|
+
var import_react_native3 = require("react-native");
|
|
112
113
|
var import_react_native_gesture_handler = require("react-native-gesture-handler");
|
|
113
114
|
var RNPaper2 = __toESM(require("react-native-paper"));
|
|
114
|
-
var
|
|
115
|
+
var import_react_native_safe_area_context2 = require("react-native-safe-area-context");
|
|
115
116
|
|
|
116
117
|
// src/components/Fonts.tsx
|
|
117
118
|
var import_vector_icons = require("@expo/vector-icons");
|
|
@@ -146,8 +147,9 @@ function roundModeFor(seatTwo) {
|
|
|
146
147
|
return seatTwo === "person" ? "twoPlayer" : seatTwo === "nobody" ? "solo" : "vsCpu";
|
|
147
148
|
}
|
|
148
149
|
function seatTwoFor(saved, choices) {
|
|
149
|
-
if (!choices) return "nobody";
|
|
150
|
-
|
|
150
|
+
if (!choices?.length) return "nobody";
|
|
151
|
+
if (choices.includes(saved)) return saved;
|
|
152
|
+
return choices.includes("cpu") ? "cpu" : choices[0];
|
|
151
153
|
}
|
|
152
154
|
function humanSeatsFor(mode) {
|
|
153
155
|
return mode === "twoPlayer" ? [1, 2] : [1];
|
|
@@ -309,6 +311,16 @@ function UpdateDialog() {
|
|
|
309
311
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_chrome.UpdateDialog, { onError });
|
|
310
312
|
}
|
|
311
313
|
|
|
314
|
+
// src/components/WindowControlsInsets.tsx
|
|
315
|
+
var import_react_native2 = require("react-native");
|
|
316
|
+
var import_react_native_safe_area_context = require("react-native-safe-area-context");
|
|
317
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
318
|
+
function WindowControlsInsets({ children }) {
|
|
319
|
+
const vertical = (0, import_react_native_safe_area_context.useSafeAreaInsets)({ cornerAdaptation: "vertical" });
|
|
320
|
+
if (import_react_native2.Platform.OS !== "ios" || !import_react_native2.Platform.isPad) return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children });
|
|
321
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native_safe_area_context.SafeAreaInsetsContext.Provider, { value: vertical, children });
|
|
322
|
+
}
|
|
323
|
+
|
|
312
324
|
// src/hooks/useLastActiveGame.tsx
|
|
313
325
|
var import_react6 = require("react");
|
|
314
326
|
var import_react_redux4 = require("react-redux");
|
|
@@ -320,7 +332,7 @@ var lastActiveGameActions = actions;
|
|
|
320
332
|
var lastActiveGameSlice_default = reducer;
|
|
321
333
|
|
|
322
334
|
// src/hooks/useLastActiveGame.tsx
|
|
323
|
-
var
|
|
335
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
324
336
|
var LastActiveGameContext = (0, import_react6.createContext)(null);
|
|
325
337
|
function LastActiveGameProvider({ children }) {
|
|
326
338
|
const store = (0, import_react_redux4.useStore)();
|
|
@@ -353,7 +365,7 @@ function LastActiveGameProvider({ children }) {
|
|
|
353
365
|
}),
|
|
354
366
|
[dispatch]
|
|
355
367
|
);
|
|
356
|
-
return /* @__PURE__ */ (0,
|
|
368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(LastActiveGameContext.Provider, { value, children });
|
|
357
369
|
}
|
|
358
370
|
function useLastActiveGame() {
|
|
359
371
|
const ctx = (0, import_react6.useContext)(LastActiveGameContext);
|
|
@@ -374,7 +386,7 @@ var profileSelectionActions = actions2;
|
|
|
374
386
|
var profileSelectionSlice_default = reducer2;
|
|
375
387
|
|
|
376
388
|
// src/hooks/useProfiles.tsx
|
|
377
|
-
var
|
|
389
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
378
390
|
var SHARED_GROUP_ID = "group.com.infinitetoken.tastic";
|
|
379
391
|
var ProfilesContext = (0, import_react7.createContext)(null);
|
|
380
392
|
function ProfilesProvider({ children }) {
|
|
@@ -434,7 +446,7 @@ function ProfilesProvider({ children }) {
|
|
|
434
446
|
},
|
|
435
447
|
[dispatch]
|
|
436
448
|
);
|
|
437
|
-
return /* @__PURE__ */ (0,
|
|
449
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ProfilesContext.Provider, { value: { profiles, lastSelected, loaded, createProfile, updateProfile, deleteProfile, selectProfile }, children });
|
|
438
450
|
}
|
|
439
451
|
function useProfiles() {
|
|
440
452
|
const ctx = (0, import_react7.useContext)(ProfilesContext);
|
|
@@ -443,7 +455,7 @@ function useProfiles() {
|
|
|
443
455
|
}
|
|
444
456
|
|
|
445
457
|
// src/RootLayout.tsx
|
|
446
|
-
var
|
|
458
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
447
459
|
var PLAY_OPTIONS = { statusBarHidden: true };
|
|
448
460
|
var KEEP_STATUS_BAR_OPTIONS = {};
|
|
449
461
|
var TRANSPARENT_CONTENT = { backgroundColor: "transparent" };
|
|
@@ -456,7 +468,7 @@ function AppStack() {
|
|
|
456
468
|
const rootBackground = (0, import_core4.useThemedRootBackground)(darkRoot, false);
|
|
457
469
|
const statusBarStyle = darkRoot ? "light" : "dark";
|
|
458
470
|
const packOptions = (pack.useScreenOptions ?? noScreenOptions)();
|
|
459
|
-
const backdropOptions = Backdrop ? { contentStyle: TRANSPARENT_CONTENT, animation:
|
|
471
|
+
const backdropOptions = Backdrop ? { contentStyle: TRANSPARENT_CONTENT, animation: import_react_native3.Platform.select({ android: "fade" }) } : void 0;
|
|
460
472
|
const playOptions = (0, import_react8.useCallback)(
|
|
461
473
|
({ route }) => {
|
|
462
474
|
const id = route.params?.game;
|
|
@@ -469,63 +481,63 @@ function AppStack() {
|
|
|
469
481
|
const base = darkRoot ? import_expo_router.DarkTheme : import_expo_router.DefaultTheme;
|
|
470
482
|
return { ...base, colors: { ...base.colors, background: navigationBackground } };
|
|
471
483
|
}, [darkRoot, navigationBackground]);
|
|
472
|
-
const stack = /* @__PURE__ */ (0,
|
|
473
|
-
/* @__PURE__ */ (0,
|
|
474
|
-
/* @__PURE__ */ (0,
|
|
484
|
+
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, ...backdropOptions, ...packOptions }, children: [
|
|
485
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_expo_router.Stack.Screen, { name: "index" }),
|
|
486
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_expo_router.Stack.Screen, { name: "play/[game]", options: playOptions })
|
|
475
487
|
] }) });
|
|
476
488
|
if (!Backdrop) return stack;
|
|
477
|
-
return /* @__PURE__ */ (0,
|
|
478
|
-
/* @__PURE__ */ (0,
|
|
489
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react_native3.View, { style: styles.root, children: [
|
|
490
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Backdrop, {}),
|
|
479
491
|
stack
|
|
480
492
|
] });
|
|
481
493
|
}
|
|
482
494
|
function GatedApp({ children }) {
|
|
483
495
|
const { loaded } = useProfiles();
|
|
484
|
-
return /* @__PURE__ */ (0,
|
|
496
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SplashGate, { gate: "profiles", ready: loaded, children });
|
|
485
497
|
}
|
|
486
498
|
function HapticGatedToastProvider({ children }) {
|
|
487
499
|
const { settings } = (0, import_feedback_press2.useHapticSettings)();
|
|
488
500
|
const { Toaster: PackToasterComponent } = usePack();
|
|
489
|
-
return /* @__PURE__ */ (0,
|
|
501
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_toaster2.ToastProvider, { haptics: settings.vibrate ? Haptics : void 0, paper: PackToasterComponent ? void 0 : RNPaper2, children });
|
|
490
502
|
}
|
|
491
503
|
function RotatingToaster() {
|
|
492
504
|
const renderFrame = (0, import_react8.useCallback)(
|
|
493
|
-
(toasts) => /* @__PURE__ */ (0,
|
|
505
|
+
(toasts) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_chrome2.RotatedFrame, { rotatedSafeArea: true, passThrough: true, children: toasts }),
|
|
494
506
|
[]
|
|
495
507
|
);
|
|
496
|
-
return /* @__PURE__ */ (0,
|
|
508
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_toaster2.Toaster, { historyButton: null, clearButton: null, limit: 3, renderFrame });
|
|
497
509
|
}
|
|
498
510
|
function PackToaster({ Toaster: PackToasterComponent }) {
|
|
499
|
-
return /* @__PURE__ */ (0,
|
|
511
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native3.View, { style: import_react_native3.StyleSheet.absoluteFill, pointerEvents: "box-none", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_chrome2.RotatedFrame, { rotatedSafeArea: true, passThrough: true, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PackToasterComponent, {}) }) });
|
|
500
512
|
}
|
|
501
513
|
function GameProviders({ games, children }) {
|
|
502
|
-
return games.reduceRight((inner, game) => game.Provider ? /* @__PURE__ */ (0,
|
|
514
|
+
return games.reduceRight((inner, game) => game.Provider ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(game.Provider, { children: inner }, game.id) : inner, children);
|
|
503
515
|
}
|
|
504
516
|
function PreviewColors({ previewColor, children }) {
|
|
505
517
|
const { dark } = (0, import_auto_paper2.useAutoPaperTheme)();
|
|
506
518
|
const preview = (0, import_react8.useCallback)((hex) => previewColor(hex, dark), [previewColor, dark]);
|
|
507
|
-
return /* @__PURE__ */ (0,
|
|
519
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_profile3.ProfileColorProvider, { preview, children });
|
|
508
520
|
}
|
|
509
521
|
function PackRoot({ pack, children }) {
|
|
510
522
|
const { Provider, previewColor } = pack;
|
|
511
|
-
const inner = Provider ? /* @__PURE__ */ (0,
|
|
512
|
-
return previewColor ? /* @__PURE__ */ (0,
|
|
523
|
+
const inner = Provider ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Provider, { children }) : children;
|
|
524
|
+
return previewColor ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PreviewColors, { previewColor, children: inner }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: inner });
|
|
513
525
|
}
|
|
514
526
|
function RootLayout({ pack, store, persistor }) {
|
|
515
|
-
return /* @__PURE__ */ (0,
|
|
516
|
-
/* @__PURE__ */ (0,
|
|
517
|
-
pack.Toaster ? /* @__PURE__ */ (0,
|
|
518
|
-
/* @__PURE__ */ (0,
|
|
519
|
-
] }) }) }) }) }) }) }) }) }) }) }) });
|
|
527
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native_gesture_handler.GestureHandlerRootView, { style: styles.root, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native_safe_area_context2.SafeAreaProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(WindowControlsInsets, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PackProvider, { pack, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Fonts, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Providers, { store, persistor, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Theme, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ProfilesProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(LastActiveGameProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(GameProviders, { games: pack.games, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PackRoot, { pack, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(GatedApp, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(HapticGatedToastProvider, { children: [
|
|
528
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(GuideHost, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(AppStack, {}) }),
|
|
529
|
+
pack.Toaster ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PackToaster, { Toaster: pack.Toaster }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(RotatingToaster, {}),
|
|
530
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(UpdateDialog, {})
|
|
531
|
+
] }) }) }) }) }) }) }) }) }) }) }) }) });
|
|
520
532
|
}
|
|
521
|
-
var styles =
|
|
533
|
+
var styles = import_react_native3.StyleSheet.create({
|
|
522
534
|
root: { flex: 1 }
|
|
523
535
|
});
|
|
524
536
|
|
|
525
537
|
// src/screens/GameRoute.tsx
|
|
526
538
|
var import_expo_router5 = require("expo-router");
|
|
527
539
|
var import_react14 = require("react");
|
|
528
|
-
var
|
|
540
|
+
var import_react_native7 = require("react-native");
|
|
529
541
|
|
|
530
542
|
// src/routes.ts
|
|
531
543
|
var playHref = (game) => ({ pathname: "/play/[game]", params: { game } });
|
|
@@ -541,17 +553,17 @@ var import_lobby2 = require("@tastic/hud/lobby");
|
|
|
541
553
|
var import_split_screen = require("@tastic/split-screen");
|
|
542
554
|
var import_expo_router4 = require("expo-router");
|
|
543
555
|
var import_react13 = require("react");
|
|
544
|
-
var
|
|
556
|
+
var import_react_native6 = require("react-native");
|
|
545
557
|
var import_react_native_reanimated2 = __toESM(require("react-native-reanimated"));
|
|
546
|
-
var
|
|
558
|
+
var import_react_native_safe_area_context3 = require("react-native-safe-area-context");
|
|
547
559
|
var import_react_redux9 = require("react-redux");
|
|
548
560
|
|
|
549
561
|
// src/components/OpponentPicker.tsx
|
|
550
562
|
var import_lobby = require("@tastic/hud/lobby");
|
|
551
563
|
var import_profile4 = require("@tastic/profile");
|
|
552
564
|
var import_react9 = require("react");
|
|
553
|
-
var
|
|
554
|
-
var
|
|
565
|
+
var import_react_native4 = require("react-native");
|
|
566
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
555
567
|
var CPU_PREFIX = "cpu:";
|
|
556
568
|
var NOBODY = "nobody";
|
|
557
569
|
var PERSON = "person";
|
|
@@ -586,9 +598,9 @@ function OpponentPicker({ idPrefix, host, choices, seatTwo, onSeatTwoChange, cpu
|
|
|
586
598
|
const size = (0, import_profile4.getOptionPickerContentSize)(options, colorSection);
|
|
587
599
|
const useAlign = usePickerAlign ?? import_lobby.useZoneClampedAlign;
|
|
588
600
|
const align = useAlign(host.openId === pickerId, size.width, size.height);
|
|
589
|
-
return /* @__PURE__ */ (0,
|
|
601
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native4.View, { style: [styles2.button, host.openId === pickerId && styles2.buttonOpen], children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_profile4.OptionPicker, { id: pickerId, host, options, value, onChange: handleChange, color: drawn, dark, icon, colorSection, alignOverride: align, triggerStyle }) });
|
|
590
602
|
}
|
|
591
|
-
var styles2 =
|
|
603
|
+
var styles2 = import_react_native4.StyleSheet.create({
|
|
592
604
|
// Its own column, so a row of seat buttons doesn't stretch the pill to the tallest of them.
|
|
593
605
|
button: {
|
|
594
606
|
alignItems: "center"
|
|
@@ -634,7 +646,7 @@ function useAppSettings() {
|
|
|
634
646
|
}
|
|
635
647
|
|
|
636
648
|
// src/components/SettingsDialog.tsx
|
|
637
|
-
var
|
|
649
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
638
650
|
var noSettingsRules = () => null;
|
|
639
651
|
function SettingsDialog({ visible, onDismiss, onShowHowToPlay, children }) {
|
|
640
652
|
const onUpdateError = (0, import_toaster3.useUpdateErrorToast)();
|
|
@@ -642,18 +654,18 @@ function SettingsDialog({ visible, onDismiss, onShowHowToPlay, children }) {
|
|
|
642
654
|
const { otaVersion, SettingsSections, edgeGuard = true, useSettingsRules = noSettingsRules } = usePack();
|
|
643
655
|
const rules = useSettingsRules();
|
|
644
656
|
const edgeGuardProps = edgeGuard ? { deferBottomEdgeGestures: settings.deferBottomEdgeGestures, onDeferBottomEdgeGestures: (value) => setSettings({ deferBottomEdgeGestures: value }) } : {};
|
|
645
|
-
return /* @__PURE__ */ (0,
|
|
657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_chrome3.BaseSettingsDialog, { visible, onDismiss, version: otaVersion, ...edgeGuardProps, onUpdateError, onShowHowToPlay, leading: rules, children: [
|
|
646
658
|
children,
|
|
647
|
-
SettingsSections && /* @__PURE__ */ (0,
|
|
659
|
+
SettingsSections && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SettingsSections, {})
|
|
648
660
|
] });
|
|
649
661
|
}
|
|
650
662
|
|
|
651
663
|
// src/hooks/useAtComputer.ts
|
|
652
664
|
var import_core6 = require("@tastic/core");
|
|
653
|
-
var
|
|
665
|
+
var import_react_native5 = require("react-native");
|
|
654
666
|
function useAtComputer() {
|
|
655
667
|
const touchPrimary = (0, import_core6.useIsTouchPrimaryDevice)();
|
|
656
|
-
return
|
|
668
|
+
return import_react_native5.Platform.OS === "web" && !touchPrimary;
|
|
657
669
|
}
|
|
658
670
|
|
|
659
671
|
// src/hooks/useOpponent.ts
|
|
@@ -809,7 +821,7 @@ var liveplayActions = actions5;
|
|
|
809
821
|
var liveplaySlice_default = reducer5;
|
|
810
822
|
|
|
811
823
|
// src/screens/LoadoutScreen.tsx
|
|
812
|
-
var
|
|
824
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
813
825
|
var PANEL_SWAP_FADE_MS = 180;
|
|
814
826
|
var P1_CONTROL_ID = "p1-control";
|
|
815
827
|
var P2_CONTROL_ID = "p2-control";
|
|
@@ -831,7 +843,7 @@ function LoadoutScreen({ game }) {
|
|
|
831
843
|
const { panelLayout, panelFadeStyle } = (0, import_split_screen.useDualZoneLayout)(panelMode, false, true, false, PANEL_SWAP_FADE_MS);
|
|
832
844
|
const playersRowFade = panelFadeStyle;
|
|
833
845
|
const [settingsOpen, setSettingsOpen] = (0, import_react13.useState)(false);
|
|
834
|
-
const insets = (0,
|
|
846
|
+
const insets = (0, import_react_native_safe_area_context3.useSafeAreaInsets)();
|
|
835
847
|
const { colors: themeColors, dark } = (0, import_auto_paper4.useAutoPaperTheme)();
|
|
836
848
|
const { p1Color, p2Color, handleP1ColorChange, handleP2ColorChange } = useSeatColors(p2IsHuman);
|
|
837
849
|
const dispatch = (0, import_react_redux9.useDispatch)();
|
|
@@ -888,30 +900,30 @@ function LoadoutScreen({ game }) {
|
|
|
888
900
|
onReset: showMetaInSharedBand ? void 0 : loadout.reset
|
|
889
901
|
});
|
|
890
902
|
const optionsPopoverOpen = controlsHost.openId !== null && loadout.optionIds.includes(controlsHost.openId);
|
|
891
|
-
const sharedControls = showMetaInSharedBand ? /* @__PURE__ */ (0,
|
|
903
|
+
const sharedControls = showMetaInSharedBand ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lobby2.SharedActionBand, { onBack: import_core8.safeBack, onSettings: () => setSettingsOpen(true), onRandomize: loadout.randomize, onReset: loadout.reset, fg, popoverOpen: optionsPopoverOpen, children: optionsRow }) : optionsRow;
|
|
892
904
|
const controlLook = { accentColor: themeColors.tertiary, mutedColor: fgMuted, dark };
|
|
893
905
|
const p1Control = loadout.seatControl(1, controlsHost, { ...controlLook, seatColor: p1Drawn });
|
|
894
|
-
const p1Panel = /* @__PURE__ */ (0,
|
|
895
|
-
const opponentPicker = game.seatTwo && /* @__PURE__ */ (0,
|
|
906
|
+
const p1Panel = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lobby2.PlayerSetupPanel, { idPrefix: "p1", host: controlsHost, color: p1Color, onColorChange: handleP1ColorChange, swatches: import_auto_paper4.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_router4.router.push(PROFILES_HREF), previewValue: seatPreview, triggerStyle, useSeatPickerAlign: seatPickerAlign }, `p1-${layoutKey}`);
|
|
907
|
+
const opponentPicker = game.seatTwo && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(OpponentPicker, { idPrefix: "p1", host: controlsHost, choices: game.seatTwo, seatTwo, onSeatTwoChange: changeSeatTwo, cpuDifficulty: loadout.cpuDifficulty, color: p2Color, onColorChange: handleP2ColorChange, swatches: import_auto_paper4.defaultColors, takenColor: p1Color, allowSwapTaken: mode === "vsCpu", dark, previewValue: seatPreview, triggerStyle, usePickerAlign: seatPickerAlign }, `opponent-${layoutKey}`);
|
|
896
908
|
const toggleP1Ready = () => setReady((r) => ({ ...r, 1: !r[1] }));
|
|
897
|
-
const seatOne = /* @__PURE__ */ (0,
|
|
898
|
-
/* @__PURE__ */ (0,
|
|
899
|
-
/* @__PURE__ */ (0,
|
|
909
|
+
const seatOne = /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native6.View, { style: [styles3.seatOne, !p2IsHuman && styles3.seatOneAlone, p1PickerOpen && styles3.raised], children: [
|
|
910
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native6.View, { style: [styles3.seatOneButtons, p1PickerOpen && styles3.raised], children: [
|
|
911
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native_reanimated2.default.View, { style: [styles3.playersRow, p1PickerOpen && styles3.raised, !p2IsHuman && playersRowFade], children: [
|
|
900
912
|
p1Panel,
|
|
901
913
|
opponentPicker
|
|
902
914
|
] }),
|
|
903
|
-
p1Control && /* @__PURE__ */ (0,
|
|
915
|
+
p1Control && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native6.View, { style: [styles3.controlRow, p1ControlOpen && styles3.raised], children: p1Control })
|
|
904
916
|
] }),
|
|
905
|
-
/* @__PURE__ */ (0,
|
|
917
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lobby2.ReadyButton, { color: p1Drawn, ready: ready[1], onToggleReady: toggleP1Ready, surfaceColor: readySurface, dark, style: !p2IsHuman && p1PickerOpen && styles3.readyButtonHidden })
|
|
906
918
|
] });
|
|
907
919
|
const p2Control = p2IsHuman ? loadout.seatControl(2, p2Host, { ...controlLook, seatColor: p2Drawn }) : void 0;
|
|
908
|
-
const p2Panel = p2IsHuman && /* @__PURE__ */ (0,
|
|
909
|
-
return /* @__PURE__ */ (0,
|
|
910
|
-
/* @__PURE__ */ (0,
|
|
911
|
-
/* @__PURE__ */ (0,
|
|
912
|
-
p2ZoneStyle && /* @__PURE__ */ (0,
|
|
913
|
-
!showMetaInSharedBand && /* @__PURE__ */ (0,
|
|
914
|
-
p2IsHuman ? /* @__PURE__ */ (0,
|
|
920
|
+
const p2Panel = p2IsHuman && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lobby2.PlayerSetupPanel, { idPrefix: "p2", host: p2Host, color: p2Color, onColorChange: handleP2ColorChange, swatches: import_auto_paper4.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");
|
|
921
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native6.View, { style: [styles3.container, { backgroundColor: bg }], children: [
|
|
922
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native6.View, { style: styles3.frame, children: [
|
|
923
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_chrome4.PressAwayOverlay, { active: controlsHost.openId !== null, onPress: controlsHost.close }),
|
|
924
|
+
p2ZoneStyle && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_chrome4.PressAwayOverlay, { active: controlsHost.openId !== null || p2Host.openId !== null, onPress: p2Host.close, style: p2ZoneStyle }),
|
|
925
|
+
!showMetaInSharedBand && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_chrome4.CornerActionButtons, { onBack: import_core8.safeBack, onSettings: () => setSettingsOpen(true), fg, insets }),
|
|
926
|
+
p2IsHuman ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
915
927
|
import_split_screen.DualZoneLayout,
|
|
916
928
|
{
|
|
917
929
|
panelLayout,
|
|
@@ -923,19 +935,19 @@ function LoadoutScreen({ game }) {
|
|
|
923
935
|
p2Elevated: p2Host.openId !== null,
|
|
924
936
|
sharedElevated: optionsPopoverOpen
|
|
925
937
|
}
|
|
926
|
-
) : /* @__PURE__ */ (0,
|
|
938
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native6.View, { style: styles3.stackedZone, children: [
|
|
927
939
|
sharedControls,
|
|
928
940
|
seatOne
|
|
929
941
|
] })
|
|
930
942
|
] }),
|
|
931
|
-
/* @__PURE__ */ (0,
|
|
943
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SettingsDialog, { visible: settingsOpen, onDismiss: () => setSettingsOpen(false), onShowHowToPlay: () => openFor(game.id) })
|
|
932
944
|
] });
|
|
933
945
|
}
|
|
934
946
|
function halfOf(color) {
|
|
935
947
|
const rgb = (0, import_auto_paper4.getRgb)(color);
|
|
936
948
|
return rgb ? `rgba(${rgb.r},${rgb.g},${rgb.b},0.5)` : void 0;
|
|
937
949
|
}
|
|
938
|
-
var styles3 =
|
|
950
|
+
var styles3 = import_react_native6.StyleSheet.create({
|
|
939
951
|
container: {
|
|
940
952
|
flex: 1
|
|
941
953
|
},
|
|
@@ -1009,13 +1021,13 @@ var styles3 = import_react_native5.StyleSheet.create({
|
|
|
1009
1021
|
});
|
|
1010
1022
|
|
|
1011
1023
|
// src/screens/GameRoute.tsx
|
|
1012
|
-
var
|
|
1024
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1013
1025
|
function LoadoutRoute() {
|
|
1014
1026
|
const { game: id } = (0, import_expo_router5.useLocalSearchParams)();
|
|
1015
1027
|
const game = usePackGame(id);
|
|
1016
|
-
if (!game) return /* @__PURE__ */ (0,
|
|
1017
|
-
if (!hasLoadout(game)) return /* @__PURE__ */ (0,
|
|
1018
|
-
return /* @__PURE__ */ (0,
|
|
1028
|
+
if (!game) return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_expo_router5.Redirect, { href: "/" });
|
|
1029
|
+
if (!hasLoadout(game)) return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_expo_router5.Redirect, { href: playHref(game.id) });
|
|
1030
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(LoadoutScreen, { game }, game.id);
|
|
1019
1031
|
}
|
|
1020
1032
|
function hasLoadout(game) {
|
|
1021
1033
|
return !!game.useLoadout;
|
|
@@ -1024,9 +1036,9 @@ function PlayRoute() {
|
|
|
1024
1036
|
const { game: id } = (0, import_expo_router5.useLocalSearchParams)();
|
|
1025
1037
|
const game = usePackGame(id);
|
|
1026
1038
|
useResumePoint(game?.resumable ? game.id : null);
|
|
1027
|
-
if (!game) return /* @__PURE__ */ (0,
|
|
1039
|
+
if (!game) return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_expo_router5.Redirect, { href: "/" });
|
|
1028
1040
|
const { PlayScreen } = game;
|
|
1029
|
-
return /* @__PURE__ */ (0,
|
|
1041
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PlayScreen, {}, game.id);
|
|
1030
1042
|
}
|
|
1031
1043
|
function useResumePoint(gameId) {
|
|
1032
1044
|
const { setLastActiveGame, clearLastActiveGame } = useLastActiveGame();
|
|
@@ -1034,7 +1046,7 @@ function useResumePoint(gameId) {
|
|
|
1034
1046
|
if (!gameId) return;
|
|
1035
1047
|
setLastActiveGame(gameId);
|
|
1036
1048
|
return () => {
|
|
1037
|
-
if (
|
|
1049
|
+
if (import_react_native7.AppState.currentState === "active") clearLastActiveGame();
|
|
1038
1050
|
};
|
|
1039
1051
|
}, [gameId, setLastActiveGame, clearLastActiveGame]);
|
|
1040
1052
|
}
|
|
@@ -1046,7 +1058,7 @@ var import_chrome5 = require("@tastic/hud/chrome");
|
|
|
1046
1058
|
var import_profile7 = require("@tastic/profile");
|
|
1047
1059
|
var import_expo_router6 = require("expo-router");
|
|
1048
1060
|
var import_react16 = require("react");
|
|
1049
|
-
var
|
|
1061
|
+
var import_react_native9 = require("react-native");
|
|
1050
1062
|
var import_react_native_paper = require("react-native-paper");
|
|
1051
1063
|
|
|
1052
1064
|
// src/components/segmentTheme.ts
|
|
@@ -1071,8 +1083,8 @@ function useFrozenWhileHidden(value, hidden) {
|
|
|
1071
1083
|
|
|
1072
1084
|
// src/screens/homeLayout.ts
|
|
1073
1085
|
var import_core11 = require("@tastic/core");
|
|
1074
|
-
var
|
|
1075
|
-
var
|
|
1086
|
+
var import_react_native8 = require("react-native");
|
|
1087
|
+
var import_react_native_safe_area_context4 = require("react-native-safe-area-context");
|
|
1076
1088
|
var PREVIEW_ASPECT = 360 / 200;
|
|
1077
1089
|
var ROW_PREVIEW_WIDTH = 92;
|
|
1078
1090
|
var HOME_WIDE_EDGE_PADDING = 16;
|
|
@@ -1125,13 +1137,13 @@ function computeHomeLayout(windowWidth, windowHeight, insets) {
|
|
|
1125
1137
|
};
|
|
1126
1138
|
}
|
|
1127
1139
|
function useHomeLayout() {
|
|
1128
|
-
const { width, height } = (0,
|
|
1129
|
-
const insets = (0,
|
|
1140
|
+
const { width, height } = (0, import_react_native8.useWindowDimensions)();
|
|
1141
|
+
const insets = (0, import_react_native_safe_area_context4.useSafeAreaInsets)();
|
|
1130
1142
|
return computeHomeLayout(width, height, insets);
|
|
1131
1143
|
}
|
|
1132
1144
|
|
|
1133
1145
|
// src/screens/HomeScreen.tsx
|
|
1134
|
-
var
|
|
1146
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1135
1147
|
function HomeScreen() {
|
|
1136
1148
|
const pack = usePack();
|
|
1137
1149
|
const { consumeResumeGame } = useLastActiveGame();
|
|
@@ -1143,8 +1155,8 @@ function HomeScreen() {
|
|
|
1143
1155
|
(0, import_react16.useEffect)(() => {
|
|
1144
1156
|
if (!resumeGame) autoShowPack();
|
|
1145
1157
|
}, [resumeGame, autoShowPack]);
|
|
1146
|
-
if (resumeGame) return /* @__PURE__ */ (0,
|
|
1147
|
-
return /* @__PURE__ */ (0,
|
|
1158
|
+
if (resumeGame) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_expo_router6.Redirect, { href: playHref(resumeGame.id) });
|
|
1159
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(HomeMenu, {});
|
|
1148
1160
|
}
|
|
1149
1161
|
function HomeMenu() {
|
|
1150
1162
|
const pack = usePack();
|
|
@@ -1155,9 +1167,9 @@ function HomeMenu() {
|
|
|
1155
1167
|
const [settingsOpen, setSettingsOpen] = (0, import_react16.useState)(false);
|
|
1156
1168
|
const [rulesGame, setRulesGame] = (0, import_react16.useState)(null);
|
|
1157
1169
|
const isFocused = (0, import_expo_router6.useIsFocused)();
|
|
1158
|
-
const [appState, setAppState] = (0, import_react16.useState)(
|
|
1170
|
+
const [appState, setAppState] = (0, import_react16.useState)(import_react_native9.AppState.currentState);
|
|
1159
1171
|
(0, import_react16.useEffect)(() => {
|
|
1160
|
-
const subscription =
|
|
1172
|
+
const subscription = import_react_native9.AppState.addEventListener("change", setAppState);
|
|
1161
1173
|
return () => subscription.remove();
|
|
1162
1174
|
}, []);
|
|
1163
1175
|
const heroActive = isFocused && appState === "active";
|
|
@@ -1187,7 +1199,7 @@ function HomeMenu() {
|
|
|
1187
1199
|
const [tabLabel, setTabLabel] = (0, import_react16.useState)(() => tabs?.[0].label ?? null);
|
|
1188
1200
|
const tab = tabs ? tabs.find((t) => t.label === tabLabel) ?? tabs[0] : null;
|
|
1189
1201
|
const tabButtons = (0, import_react16.useMemo)(() => tabs?.map(({ label }) => ({ value: label, label })) ?? [], [tabs]);
|
|
1190
|
-
const tabBar = tab && /* @__PURE__ */ (0,
|
|
1202
|
+
const tabBar = tab && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native_paper.SegmentedButtons, { value: tab.label, onValueChange: setTabLabel, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles4.tabs, pack.Backdrop && { backgroundColor: colors.surface }] });
|
|
1191
1203
|
const columnClamp = useClampOnShrink();
|
|
1192
1204
|
const gridClamp = useClampOnShrink();
|
|
1193
1205
|
const openGame = (0, import_react16.useCallback)((game) => openFirstTime(game.id, () => import_expo_router6.router.push(game.useLoadout ? loadoutHref(game.id) : playHref(game.id))), [openFirstTime]);
|
|
@@ -1196,33 +1208,33 @@ function HomeMenu() {
|
|
|
1196
1208
|
const usePickerAlign = pack.usePickerAlign ?? noPickerAlign;
|
|
1197
1209
|
const pickerSize = (0, import_profile7.getProfilePickerContentSize)(profiles.length, true, colorSection);
|
|
1198
1210
|
const pickerAlign = usePickerAlign(pickerHost.openId === `${SEAT_ONE_PICKER}-profile`, pickerSize.width, pickerSize.height);
|
|
1199
|
-
const picker = /* @__PURE__ */ (0,
|
|
1200
|
-
const pressAway = /* @__PURE__ */ (0,
|
|
1211
|
+
const picker = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_profile7.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_router6.router.push(PROFILES_HREF), colorSection, alignOverride: pickerAlign, triggerStyle });
|
|
1212
|
+
const pressAway = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_chrome5.PressAwayOverlay, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles4.pressAway });
|
|
1201
1213
|
const RulesSheet = rulesGame?.Rules;
|
|
1202
|
-
return /* @__PURE__ */ (0,
|
|
1203
|
-
/* @__PURE__ */ (0,
|
|
1204
|
-
isWide ? /* @__PURE__ */ (0,
|
|
1214
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native9.View, { style: [styles4.container, { backgroundColor: bg }], children: [
|
|
1215
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native9.View, { style: styles4.frame, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(RulesHost, { enabled: pack.games.some((game) => game.Rules), children: [
|
|
1216
|
+
isWide ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
1205
1217
|
pressAway,
|
|
1206
|
-
/* @__PURE__ */ (0,
|
|
1207
|
-
tabBar && /* @__PURE__ */ (0,
|
|
1208
|
-
/* @__PURE__ */ (0,
|
|
1218
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_auto_paper5.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: [
|
|
1219
|
+
tabBar && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native9.View, { style: [styles4.wideTabs, { width: layout.rightPaneWidth }], children: tabBar }),
|
|
1220
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native9.View, { style: [styles4.grid, { width: layout.rightPaneWidth }], children: pack.games.map((game) => /* @__PURE__ */ (0, import_jsx_runtime15.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)) })
|
|
1209
1221
|
] }),
|
|
1210
|
-
/* @__PURE__ */ (0,
|
|
1211
|
-
/* @__PURE__ */ (0,
|
|
1212
|
-
/* @__PURE__ */ (0,
|
|
1222
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.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: [
|
|
1223
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(pack.HeroTitle, { words: pack.wordmark, color: fg, p1Color, p2Color, active: heroActive, fit: layout.heroFit }),
|
|
1224
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native9.View, { style: styles4.widePicker, children: picker })
|
|
1213
1225
|
] })
|
|
1214
|
-
] }) : /* @__PURE__ */ (0,
|
|
1226
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_auto_paper5.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: [
|
|
1215
1227
|
pressAway,
|
|
1216
|
-
/* @__PURE__ */ (0,
|
|
1217
|
-
/* @__PURE__ */ (0,
|
|
1218
|
-
tabBar && /* @__PURE__ */ (0,
|
|
1219
|
-
/* @__PURE__ */ (0,
|
|
1228
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(pack.HeroTitle, { words: pack.wordmark, color: fg, p1Color, p2Color, active: heroActive }),
|
|
1229
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native9.View, { style: [styles4.picker, pickerHost.openId !== null && styles4.pickerOpen], children: picker }),
|
|
1230
|
+
tabBar && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native9.View, { style: styles4.listWidth, children: tabBar }),
|
|
1231
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native9.View, { style: styles4.list, children: pack.games.map((game) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(GameRow, { game, hidden: isHidden(tab, game), dark, p1Color, p2Color, previewRevealed: previewsRevealed, onPress: () => openGame(game), onRules: hasRules(game) ? () => openRules(game) : void 0 }, game.id)) })
|
|
1220
1232
|
] }),
|
|
1221
|
-
/* @__PURE__ */ (0,
|
|
1222
|
-
/* @__PURE__ */ (0,
|
|
1223
|
-
RulesSheet && /* @__PURE__ */ (0,
|
|
1233
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.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_router6.router.push(STATS_HREF), accessibilityLabel: "Stats & Achievements" }),
|
|
1234
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.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" }),
|
|
1235
|
+
RulesSheet && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(RulesSheet, { visible: true, onDismiss: () => setRulesGame(null) })
|
|
1224
1236
|
] }) }),
|
|
1225
|
-
/* @__PURE__ */ (0,
|
|
1237
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SettingsDialog, { visible: settingsOpen, onDismiss: () => setSettingsOpen(false), onShowHowToPlay: pack.guide ? openPack : void 0 })
|
|
1226
1238
|
] });
|
|
1227
1239
|
}
|
|
1228
1240
|
var SEAT_ONE_PICKER = "home-p1";
|
|
@@ -1259,7 +1271,7 @@ function hasRules(game) {
|
|
|
1259
1271
|
return !!(game.Rules || game.guide);
|
|
1260
1272
|
}
|
|
1261
1273
|
function RulesHost({ enabled, children }) {
|
|
1262
|
-
return enabled ? /* @__PURE__ */ (0,
|
|
1274
|
+
return enabled ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native_paper.Portal.Host, { children }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jsx_runtime15.Fragment, { children });
|
|
1263
1275
|
}
|
|
1264
1276
|
var ROW_BLURB_LINES = 3;
|
|
1265
1277
|
function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPress, onRules }) {
|
|
@@ -1268,40 +1280,40 @@ function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPres
|
|
|
1268
1280
|
return (
|
|
1269
1281
|
// The rules button sits beside the row's own button, laid over its end, not inside it: a button
|
|
1270
1282
|
// inside a button is invalid on the web.
|
|
1271
|
-
/* @__PURE__ */ (0,
|
|
1272
|
-
/* @__PURE__ */ (0,
|
|
1273
|
-
game.Preview ? /* @__PURE__ */ (0,
|
|
1274
|
-
/* @__PURE__ */ (0,
|
|
1275
|
-
/* @__PURE__ */ (0,
|
|
1276
|
-
/* @__PURE__ */ (0,
|
|
1283
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native9.View, { style: hidden ? styles4.hidden : void 0, children: [
|
|
1284
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_feedback_press3.Pressable, { onPress, style: [styles4.row, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
|
|
1285
|
+
game.Preview ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PreviewBox, { game, width: ROW_PREVIEW_WIDTH, revealed: previewRevealed, dark, p1Color, p2Color }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native9.View, { style: [styles4.rowIcon, { backgroundColor: dark ? ICON_DARK_BG : ICON_LIGHT_BG }], children: GameIcon && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(GameIcon, { size: ROW_ICON_SIZE, p1Color, p2Color, dark }) }),
|
|
1286
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native9.View, { style: styles4.rowText, children: [
|
|
1287
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native_paper.Text, { variant: "titleLarge", style: [styles4.rowTitle, { color: well.fg }], numberOfLines: 1, children: game.title }),
|
|
1288
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native_paper.Text, { variant: "bodyMedium", style: { color: well.fgMuted }, numberOfLines: ROW_BLURB_LINES, children: game.blurb })
|
|
1277
1289
|
] })
|
|
1278
1290
|
] }),
|
|
1279
|
-
onRules && /* @__PURE__ */ (0,
|
|
1291
|
+
onRules && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_feedback_press3.Pressable, { onPress: onRules, style: styles4.rulesButton, hitSlop: 12, accessibilityRole: "button", accessibilityLabel: `${game.title} rules`, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native_paper.Icon, { source: "information-outline", size: 22, color: well.fgMuted }) })
|
|
1280
1292
|
] })
|
|
1281
1293
|
);
|
|
1282
1294
|
}
|
|
1283
1295
|
function GameTile({ game, hidden, width, previewWidth, dark, p1Color, p2Color, previewRevealed, onPress, onRules }) {
|
|
1284
1296
|
const well = (0, import_chrome5.useWellColors)();
|
|
1285
|
-
return /* @__PURE__ */ (0,
|
|
1286
|
-
/* @__PURE__ */ (0,
|
|
1287
|
-
/* @__PURE__ */ (0,
|
|
1288
|
-
/* @__PURE__ */ (0,
|
|
1289
|
-
/* @__PURE__ */ (0,
|
|
1297
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native9.View, { style: [{ width }, hidden && styles4.hidden], children: [
|
|
1298
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_feedback_press3.Pressable, { onPress, style: [styles4.tile, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
|
|
1299
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PreviewBox, { game, width: previewWidth, revealed: previewRevealed, dark, p1Color, p2Color }),
|
|
1300
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native_paper.Text, { variant: "titleMedium", style: [styles4.rowTitle, { color: well.fg }], numberOfLines: 1, children: game.title }),
|
|
1301
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native_paper.Text, { variant: "bodySmall", style: { color: well.fgMuted }, numberOfLines: 3, children: game.blurb })
|
|
1290
1302
|
] }),
|
|
1291
|
-
onRules && /* @__PURE__ */ (0,
|
|
1303
|
+
onRules && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_feedback_press3.Pressable, { onPress: onRules, style: styles4.tileRulesButton, hitSlop: 12, accessibilityRole: "button", accessibilityLabel: `${game.title} rules`, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native_paper.Icon, { source: "information-outline", size: 20, color: "#FFFFFF" }) })
|
|
1292
1304
|
] });
|
|
1293
1305
|
}
|
|
1294
1306
|
function PreviewBox({ game, width, revealed, dark, p1Color, p2Color }) {
|
|
1295
1307
|
const height = Math.round(width / PREVIEW_ASPECT);
|
|
1296
1308
|
const { Preview, icon: GameIcon } = game;
|
|
1297
1309
|
const iconSize = Math.min(height, ROW_ICON_SIZE);
|
|
1298
|
-
return /* @__PURE__ */ (0,
|
|
1310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native9.View, { style: [styles4.preview, { width, height, backgroundColor: dark ? ICON_DARK_BG : ICON_LIGHT_BG }], children: Preview ? revealed && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Preview, { width, height, p1Color, p2Color, dark }) : GameIcon && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native9.View, { style: [styles4.previewIcon, { width: iconSize, height: iconSize, borderRadius: iconSize * 0.22 }], children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(GameIcon, { size: iconSize, p1Color, p2Color, dark }) }) });
|
|
1299
1311
|
}
|
|
1300
1312
|
var ROW_ICON_SIZE = 56;
|
|
1301
1313
|
var ICON_LIGHT_BG = "#FAFAFA";
|
|
1302
1314
|
var ICON_DARK_BG = "#050505";
|
|
1303
1315
|
var RULES_BUTTON_SPACE = 44;
|
|
1304
|
-
var styles4 =
|
|
1316
|
+
var styles4 = import_react_native9.StyleSheet.create({
|
|
1305
1317
|
container: {
|
|
1306
1318
|
flex: 1
|
|
1307
1319
|
},
|
|
@@ -1448,7 +1460,7 @@ var styles4 = import_react_native8.StyleSheet.create({
|
|
|
1448
1460
|
var import_auto_paper6 = require("@rific/auto-paper");
|
|
1449
1461
|
var import_chrome6 = require("@tastic/hud/chrome");
|
|
1450
1462
|
var import_profile8 = require("@tastic/profile");
|
|
1451
|
-
var
|
|
1463
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1452
1464
|
var ROSTER_MAX_WIDTH = 640;
|
|
1453
1465
|
function useRosterAlign(open, contentWidth, contentHeight) {
|
|
1454
1466
|
const { usePickerAlign } = usePack();
|
|
@@ -1457,7 +1469,7 @@ function useRosterAlign(open, contentWidth, contentHeight) {
|
|
|
1457
1469
|
function ProfilesRoute() {
|
|
1458
1470
|
const { profiles, createProfile, updateProfile, deleteProfile } = useProfiles();
|
|
1459
1471
|
const { Backdrop, foreground, newProfileColor, usePickerAlign } = usePack();
|
|
1460
|
-
return /* @__PURE__ */ (0,
|
|
1472
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_chrome6.RotatedFrame, { rotatedSafeArea: true, portalHost: true, maxContentWidth: ROSTER_MAX_WIDTH, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_profile8.ProfilesScreen, { profiles, defaultColor: newProfileColor ?? import_auto_paper6.defaultColors[0].value, onCreate: (patch) => createProfile(patch), onSave: (id, patch) => updateProfile(id, patch), onDelete: deleteProfile, onBack: import_core8.safeBack, fg: foreground, bg: Backdrop ? "transparent" : void 0, useColorPickerAlign: usePickerAlign ? useRosterAlign : void 0 }) });
|
|
1461
1473
|
}
|
|
1462
1474
|
|
|
1463
1475
|
// src/screens/StatsScreen.tsx
|
|
@@ -1465,11 +1477,11 @@ var import_auto_paper7 = require("@rific/auto-paper");
|
|
|
1465
1477
|
var import_chrome7 = require("@tastic/hud/chrome");
|
|
1466
1478
|
var import_profile9 = require("@tastic/profile");
|
|
1467
1479
|
var import_react17 = require("react");
|
|
1468
|
-
var
|
|
1480
|
+
var import_react_native10 = require("react-native");
|
|
1469
1481
|
var import_react_native_paper2 = require("react-native-paper");
|
|
1470
|
-
var
|
|
1482
|
+
var import_react_native_safe_area_context5 = require("react-native-safe-area-context");
|
|
1471
1483
|
var import_react_redux10 = require("react-redux");
|
|
1472
|
-
var
|
|
1484
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1473
1485
|
var STATS = "stats";
|
|
1474
1486
|
var ACHIEVEMENTS = "achievements";
|
|
1475
1487
|
var TABS = [
|
|
@@ -1485,17 +1497,17 @@ var GAME_PICKER_ID = "stats-game";
|
|
|
1485
1497
|
var STATS_MAX_WIDTH = 640;
|
|
1486
1498
|
function StatsScreen() {
|
|
1487
1499
|
const pickerHost = (0, import_chrome7.usePopoverHost)();
|
|
1488
|
-
return /* @__PURE__ */ (0,
|
|
1500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(StatsPressAway, { host: pickerHost, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_chrome7.RotatedFrame, { rotatedSafeArea: true, portalHost: true, maxContentWidth: STATS_MAX_WIDTH, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(StatsContent, { pickerHost }) }) });
|
|
1489
1501
|
}
|
|
1490
1502
|
function StatsPressAway({ host, children }) {
|
|
1491
|
-
return /* @__PURE__ */ (0,
|
|
1503
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native10.View, { testID: "stats-press-away", style: styles5.screen, onStartShouldSetResponder: () => host.openId !== null, onResponderRelease: host.close, children });
|
|
1492
1504
|
}
|
|
1493
1505
|
var useNoPackReset = () => null;
|
|
1494
1506
|
var noPickerAlign2 = () => void 0;
|
|
1495
1507
|
function StatsContent({ pickerHost }) {
|
|
1496
1508
|
const pack = usePack();
|
|
1497
1509
|
const { dark, colors } = (0, import_auto_paper7.useAutoPaperTheme)();
|
|
1498
|
-
const insets = (0,
|
|
1510
|
+
const insets = (0, import_react_native_safe_area_context5.useSafeAreaInsets)();
|
|
1499
1511
|
const { profiles, lastSelected } = useProfiles();
|
|
1500
1512
|
const dispatch = (0, import_react_redux10.useDispatch)();
|
|
1501
1513
|
const fg = pack.foreground ?? colors.onBackground;
|
|
@@ -1522,16 +1534,16 @@ function StatsContent({ pickerHost }) {
|
|
|
1522
1534
|
const surface = pack.Backdrop ? { backgroundColor: colors.surface } : void 0;
|
|
1523
1535
|
const triggerStyle = pack.Backdrop ? [styles5.pill, surface] : void 0;
|
|
1524
1536
|
const PackTabContent = packTab?.Content;
|
|
1525
|
-
return /* @__PURE__ */ (0,
|
|
1526
|
-
/* @__PURE__ */ (0,
|
|
1527
|
-
/* @__PURE__ */ (0,
|
|
1528
|
-
/* @__PURE__ */ (0,
|
|
1529
|
-
profiles.length > 0 && /* @__PURE__ */ (0,
|
|
1530
|
-
showGamePicker && /* @__PURE__ */ (0,
|
|
1537
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_chrome7.BaseStatsScreen, { title, onBack: import_core8.safeBack, insets, onReset: reset.onReset, resetLabel: reset.label, resetConfirmTitle: reset.title, resetConfirmBody: reset.body, fg: pack.foreground, bg: pack.Backdrop ? "transparent" : void 0, rotation: 0, children: [
|
|
1538
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_chrome7.PressAwayOverlay, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles5.pressAway }),
|
|
1539
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper2.SegmentedButtons, { value: tab, onValueChange: setTab, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles5.tabs, surface] }),
|
|
1540
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native10.View, { style: [styles5.filters, pickerHost.openId !== null && styles5.filtersOpen], onStartShouldSetResponder: () => pickerHost.openId !== null, children: [
|
|
1541
|
+
profiles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_profile9.OptionPicker, { id: PLAYER_PICKER_ID, host: pickerHost, options: playerOptions, value: profileId ?? EVERYONE, onChange: (value) => setSelectedProfileId(value === EVERYONE ? null : value), color: colors.primary, dark, icon: profileId ? "account" : "account-group", alignOverride: playerAlign, triggerStyle }),
|
|
1542
|
+
showGamePicker && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_profile9.OptionPicker, { id: GAME_PICKER_ID, host: pickerHost, options: gameOptions, value: gameId, onChange: setGameId, color: colors.primary, dark, icon: "view-grid-outline", alignOverride: gameAlign, triggerStyle })
|
|
1531
1543
|
] }),
|
|
1532
|
-
tab === STATS && pack.StatsSections && /* @__PURE__ */ (0,
|
|
1533
|
-
PackTabContent && /* @__PURE__ */ (0,
|
|
1534
|
-
tab === ACHIEVEMENTS && pack.AchievementList ? /* @__PURE__ */ (0,
|
|
1544
|
+
tab === STATS && pack.StatsSections && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(pack.StatsSections, { profileId, gameId: gameId === ALL_GAMES ? null : gameId }),
|
|
1545
|
+
PackTabContent && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PackTabContent, { profileId, gameId: gameId === ALL_GAMES ? null : gameId }),
|
|
1546
|
+
tab === ACHIEVEMENTS && pack.AchievementList ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(pack.AchievementList, { profileId }) : (tab === STATS || tab === ACHIEVEMENTS) && games.map((game) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(GameStats, { game, tab, profileId, showTitle: games.length > 1 && pack.statsGameTitles !== false, titleColor: fg }, game.id))
|
|
1535
1547
|
] });
|
|
1536
1548
|
}
|
|
1537
1549
|
function resetFor(pack, packReset, profileId, profiles, games, resetGames) {
|
|
@@ -1546,12 +1558,12 @@ function GameStats({ game, tab, profileId, showTitle, titleColor }) {
|
|
|
1546
1558
|
const { StatsSections, AchievementList } = game;
|
|
1547
1559
|
const Sections = tab === STATS ? StatsSections : AchievementList;
|
|
1548
1560
|
if (!Sections) return null;
|
|
1549
|
-
return /* @__PURE__ */ (0,
|
|
1550
|
-
showTitle && /* @__PURE__ */ (0,
|
|
1551
|
-
/* @__PURE__ */ (0,
|
|
1561
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native10.View, { style: styles5.game, children: [
|
|
1562
|
+
showTitle && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper2.Text, { variant: "titleLarge", style: [styles5.gameTitle, { color: titleColor }], children: game.title }),
|
|
1563
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Sections, { profileId })
|
|
1552
1564
|
] });
|
|
1553
1565
|
}
|
|
1554
|
-
var styles5 =
|
|
1566
|
+
var styles5 = import_react_native10.StyleSheet.create({
|
|
1555
1567
|
filters: {
|
|
1556
1568
|
flexDirection: "row",
|
|
1557
1569
|
flexWrap: "wrap",
|
|
@@ -1585,11 +1597,11 @@ var styles5 = import_react_native9.StyleSheet.create({
|
|
|
1585
1597
|
});
|
|
1586
1598
|
|
|
1587
1599
|
// src/components/imageGameIcon.tsx
|
|
1588
|
-
var
|
|
1589
|
-
var
|
|
1600
|
+
var import_react_native11 = require("react-native");
|
|
1601
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1590
1602
|
function imageGameIcon(images) {
|
|
1591
1603
|
return function ImageGameIcon({ size, dark }) {
|
|
1592
|
-
return /* @__PURE__ */ (0,
|
|
1604
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native11.Image, { source: dark ? images.dark : images.light, style: { height: size, width: size }, accessibilityIgnoresInvertColors: true });
|
|
1593
1605
|
};
|
|
1594
1606
|
}
|
|
1595
1607
|
|
|
@@ -1597,16 +1609,16 @@ function imageGameIcon(images) {
|
|
|
1597
1609
|
var import_auto_paper8 = require("@rific/auto-paper");
|
|
1598
1610
|
var import_feedback_press4 = require("@rific/feedback-press");
|
|
1599
1611
|
var import_react18 = require("react");
|
|
1600
|
-
var
|
|
1612
|
+
var import_react_native12 = require("react-native");
|
|
1601
1613
|
var import_react_native_reanimated3 = __toESM(require("react-native-reanimated"));
|
|
1602
|
-
var
|
|
1603
|
-
var
|
|
1614
|
+
var import_react_native_safe_area_context6 = require("react-native-safe-area-context");
|
|
1615
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1604
1616
|
var MATCH_CHIPS_FADE_MS = 150;
|
|
1605
1617
|
var CHIP_SIZE = 48;
|
|
1606
1618
|
var EDGE_PAD = 8;
|
|
1607
1619
|
function MatchChips({ playing, faceToFace, centerLineY, onBack, onSettings }) {
|
|
1608
|
-
const { height } = (0,
|
|
1609
|
-
const insets = (0,
|
|
1620
|
+
const { height } = (0, import_react_native12.useWindowDimensions)();
|
|
1621
|
+
const insets = (0, import_react_native_safe_area_context6.useSafeAreaInsets)();
|
|
1610
1622
|
const { dark } = (0, import_auto_paper8.useAutoPaperTheme)();
|
|
1611
1623
|
const atComputer = useAtComputer();
|
|
1612
1624
|
const visible = atComputer || !playing;
|
|
@@ -1622,12 +1634,12 @@ function MatchChips({ playing, faceToFace, centerLineY, onBack, onSettings }) {
|
|
|
1622
1634
|
const backSlot = { top, left: EDGE_PAD + insets.left };
|
|
1623
1635
|
const settingsSlot = { top, right: EDGE_PAD + insets.right };
|
|
1624
1636
|
const pointerEvents = visible ? "box-none" : "none";
|
|
1625
|
-
return /* @__PURE__ */ (0,
|
|
1626
|
-
/* @__PURE__ */ (0,
|
|
1627
|
-
/* @__PURE__ */ (0,
|
|
1637
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
1638
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native_reanimated3.default.View, { pointerEvents, style: [styles6.slot, backSlot, fadeStyle], testID: "match-chips-back", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_feedback_press4.IconButton, { icon: "arrow-left", iconColor, containerColor, style: styles6.chip, size: 24, onPress: onBack, accessibilityLabel: "Back" }) }),
|
|
1639
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native_reanimated3.default.View, { pointerEvents, style: [styles6.slot, settingsSlot, fadeStyle], testID: "match-chips-settings", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_feedback_press4.IconButton, { icon: "cog", iconColor, containerColor, style: styles6.chip, size: 24, onPress: onSettings, accessibilityLabel: "Settings" }) })
|
|
1628
1640
|
] });
|
|
1629
1641
|
}
|
|
1630
|
-
var styles6 =
|
|
1642
|
+
var styles6 = import_react_native12.StyleSheet.create({
|
|
1631
1643
|
chip: { margin: 0 },
|
|
1632
1644
|
slot: { position: "absolute" }
|
|
1633
1645
|
});
|
|
@@ -1636,11 +1648,29 @@ var styles6 = import_react_native11.StyleSheet.create({
|
|
|
1636
1648
|
var import_react_redux11 = require("react-redux");
|
|
1637
1649
|
function useActiveRound(game, defaults) {
|
|
1638
1650
|
const round = (0, import_react_redux11.useSelector)((state) => state.liveplay.activeRound);
|
|
1639
|
-
const
|
|
1640
|
-
if (!round || round.game !== game) return { mode:
|
|
1651
|
+
const choices = usePackGame(game)?.seatTwo;
|
|
1652
|
+
if (!round || round.game !== game) return { mode: roundModeFor(seatTwoFor(DEFAULT_OPPONENT.seatTwo, choices)), settings: defaults };
|
|
1641
1653
|
return { mode: round.mode, settings: { ...defaults, ...round.settings } };
|
|
1642
1654
|
}
|
|
1643
1655
|
|
|
1656
|
+
// src/hooks/useBackBlock.ts
|
|
1657
|
+
var import_expo_router7 = require("expo-router");
|
|
1658
|
+
var import_react19 = require("react");
|
|
1659
|
+
function useBackBlock(held, onHeld) {
|
|
1660
|
+
const leavingRef = (0, import_react19.useRef)(false);
|
|
1661
|
+
const [leaving, setLeaving] = (0, import_react19.useState)(false);
|
|
1662
|
+
(0, import_expo_router7.usePreventRemove)(held && !leaving, ({ repeat }) => {
|
|
1663
|
+
if (leavingRef.current) {
|
|
1664
|
+
setLeaving(true);
|
|
1665
|
+
repeat();
|
|
1666
|
+
} else onHeld();
|
|
1667
|
+
});
|
|
1668
|
+
return (0, import_react19.useCallback)(() => {
|
|
1669
|
+
leavingRef.current = true;
|
|
1670
|
+
(0, import_core8.safeBack)();
|
|
1671
|
+
}, []);
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1644
1674
|
// src/redux/createPackStore.ts
|
|
1645
1675
|
var import_async_storage = __toESM(require("@react-native-async-storage/async-storage"));
|
|
1646
1676
|
var import_toolkit = require("@reduxjs/toolkit");
|
|
@@ -1775,8 +1805,8 @@ function forgetProfileAchievements(dropStats) {
|
|
|
1775
1805
|
|
|
1776
1806
|
// src/gameStats.tsx
|
|
1777
1807
|
var import_achievements2 = require("@tastic/achievements");
|
|
1778
|
-
var
|
|
1779
|
-
var
|
|
1808
|
+
var import_react20 = require("react");
|
|
1809
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1780
1810
|
var SEATS = [1, 2];
|
|
1781
1811
|
function createGameStats({ key, defaultStats, isValidStats, catalog, getProfileStatsView }) {
|
|
1782
1812
|
const { actions: actions6, reducer: sliceReducer } = (0, import_achievements2.createAchievementsSlice)({
|
|
@@ -1793,7 +1823,7 @@ function createGameStats({ key, defaultStats, isValidStats, catalog, getProfileS
|
|
|
1793
1823
|
};
|
|
1794
1824
|
const reducer6 = onProfileRemoved(sliceReducer, forgetProfileAchievements(dropProfileStats));
|
|
1795
1825
|
const profileViews = (stats) => Object.fromEntries(Object.entries(stats.profiles).map(([profileId, bucket]) => [profileId, getProfileStatsView(bucket)]));
|
|
1796
|
-
const Context = (0,
|
|
1826
|
+
const Context = (0, import_react20.createContext)(null);
|
|
1797
1827
|
function Provider({ children }) {
|
|
1798
1828
|
const { stats, unlockedAchievements, recordOutcome, resetAll } = (0, import_achievements2.useAchievements)({
|
|
1799
1829
|
catalog,
|
|
@@ -1801,18 +1831,18 @@ function createGameStats({ key, defaultStats, isValidStats, catalog, getProfileS
|
|
|
1801
1831
|
actions: actions6,
|
|
1802
1832
|
profileViews
|
|
1803
1833
|
});
|
|
1804
|
-
const record = (0,
|
|
1834
|
+
const record = (0, import_react20.useCallback)(
|
|
1805
1835
|
(update, profileIds) => {
|
|
1806
1836
|
const result = recordOutcome(update);
|
|
1807
1837
|
return { device: result.device, profiles: (0, import_achievements2.mapUnlocksBySeat)(SEATS, profileIds, result.profiles) };
|
|
1808
1838
|
},
|
|
1809
1839
|
[recordOutcome]
|
|
1810
1840
|
);
|
|
1811
|
-
const value = (0,
|
|
1812
|
-
return /* @__PURE__ */ (0,
|
|
1841
|
+
const value = (0, import_react20.useMemo)(() => ({ stats, unlockedAchievements, record, resetAll }), [stats, unlockedAchievements, record, resetAll]);
|
|
1842
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Context.Provider, { value, children });
|
|
1813
1843
|
}
|
|
1814
1844
|
function useStats() {
|
|
1815
|
-
const ctx = (0,
|
|
1845
|
+
const ctx = (0, import_react20.useContext)(Context);
|
|
1816
1846
|
if (!ctx) throw new Error(`The ${key} stats are read within their game's Provider`);
|
|
1817
1847
|
return ctx;
|
|
1818
1848
|
}
|
|
@@ -1820,7 +1850,7 @@ function createGameStats({ key, defaultStats, isValidStats, catalog, getProfileS
|
|
|
1820
1850
|
}
|
|
1821
1851
|
|
|
1822
1852
|
// src/playerSettings.ts
|
|
1823
|
-
var
|
|
1853
|
+
var import_react21 = require("react");
|
|
1824
1854
|
var import_react_redux12 = require("react-redux");
|
|
1825
1855
|
var SEATS2 = [1, 2];
|
|
1826
1856
|
function seatPlayerKey(selection, seat) {
|
|
@@ -1864,8 +1894,8 @@ function createPlayerSettings({ id, defaults, distinctControls }) {
|
|
|
1864
1894
|
const saved = (0, import_react_redux12.useSelector)((state) => state[settingsKey]);
|
|
1865
1895
|
const controls = (0, import_react_redux12.useSelector)((state) => state[controlsKey]);
|
|
1866
1896
|
const dispatch = (0, import_react_redux12.useDispatch)();
|
|
1867
|
-
const settings = (0,
|
|
1868
|
-
const setSettings = (0,
|
|
1897
|
+
const settings = (0, import_react21.useMemo)(() => compose(saved, controls, selection, seatTwoIsPerson), [saved, controls, selection, seatTwoIsPerson]);
|
|
1898
|
+
const setSettings = (0, import_react21.useCallback)(
|
|
1869
1899
|
(next) => {
|
|
1870
1900
|
const { controlScheme, ...changes } = next;
|
|
1871
1901
|
if (Object.keys(changes).length > 0) dispatch(patch(seatPlayerKey(selection, 1), changes));
|
|
@@ -1926,6 +1956,7 @@ function createPlayerSettings({ id, defaults, distinctControls }) {
|
|
|
1926
1956
|
useActiveRound,
|
|
1927
1957
|
useAppSettings,
|
|
1928
1958
|
useAtComputer,
|
|
1959
|
+
useBackBlock,
|
|
1929
1960
|
useGameGuide,
|
|
1930
1961
|
useOpponent,
|
|
1931
1962
|
usePack,
|