@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.mjs
CHANGED
|
@@ -31,7 +31,7 @@ import { ProfileColorProvider } from "@tastic/profile";
|
|
|
31
31
|
import * as Haptics from "expo-haptics";
|
|
32
32
|
import { DarkTheme, DefaultTheme, Stack, ThemeProvider as NavigationThemeProvider } from "expo-router";
|
|
33
33
|
import { useCallback as useCallback5, useMemo as useMemo3 } from "react";
|
|
34
|
-
import { Platform as
|
|
34
|
+
import { Platform as Platform3, StyleSheet, View } from "react-native";
|
|
35
35
|
import { GestureHandlerRootView } from "react-native-gesture-handler";
|
|
36
36
|
import * as RNPaper2 from "react-native-paper";
|
|
37
37
|
import { SafeAreaProvider } from "react-native-safe-area-context";
|
|
@@ -69,8 +69,9 @@ function roundModeFor(seatTwo) {
|
|
|
69
69
|
return seatTwo === "person" ? "twoPlayer" : seatTwo === "nobody" ? "solo" : "vsCpu";
|
|
70
70
|
}
|
|
71
71
|
function seatTwoFor(saved, choices) {
|
|
72
|
-
if (!choices) return "nobody";
|
|
73
|
-
|
|
72
|
+
if (!choices?.length) return "nobody";
|
|
73
|
+
if (choices.includes(saved)) return saved;
|
|
74
|
+
return choices.includes("cpu") ? "cpu" : choices[0];
|
|
74
75
|
}
|
|
75
76
|
function humanSeatsFor(mode) {
|
|
76
77
|
return mode === "twoPlayer" ? [1, 2] : [1];
|
|
@@ -232,6 +233,16 @@ function UpdateDialog() {
|
|
|
232
233
|
return /* @__PURE__ */ jsx6(SharedUpdateDialog, { onError });
|
|
233
234
|
}
|
|
234
235
|
|
|
236
|
+
// src/components/WindowControlsInsets.tsx
|
|
237
|
+
import { Platform as Platform2 } from "react-native";
|
|
238
|
+
import { SafeAreaInsetsContext, useSafeAreaInsets } from "react-native-safe-area-context";
|
|
239
|
+
import { Fragment as Fragment3, jsx as jsx7 } from "react/jsx-runtime";
|
|
240
|
+
function WindowControlsInsets({ children }) {
|
|
241
|
+
const vertical = useSafeAreaInsets({ cornerAdaptation: "vertical" });
|
|
242
|
+
if (Platform2.OS !== "ios" || !Platform2.isPad) return /* @__PURE__ */ jsx7(Fragment3, { children });
|
|
243
|
+
return /* @__PURE__ */ jsx7(SafeAreaInsetsContext.Provider, { value: vertical, children });
|
|
244
|
+
}
|
|
245
|
+
|
|
235
246
|
// src/hooks/useLastActiveGame.tsx
|
|
236
247
|
import { createContext as createContext3, useContext as useContext3, useMemo as useMemo2, useRef as useRef2, useState as useState2 } from "react";
|
|
237
248
|
import { useDispatch as useDispatch4, useStore as useStore2 } from "react-redux";
|
|
@@ -243,7 +254,7 @@ var lastActiveGameActions = actions;
|
|
|
243
254
|
var lastActiveGameSlice_default = reducer;
|
|
244
255
|
|
|
245
256
|
// src/hooks/useLastActiveGame.tsx
|
|
246
|
-
import { jsx as
|
|
257
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
247
258
|
var LastActiveGameContext = createContext3(null);
|
|
248
259
|
function LastActiveGameProvider({ children }) {
|
|
249
260
|
const store = useStore2();
|
|
@@ -276,7 +287,7 @@ function LastActiveGameProvider({ children }) {
|
|
|
276
287
|
}),
|
|
277
288
|
[dispatch]
|
|
278
289
|
);
|
|
279
|
-
return /* @__PURE__ */
|
|
290
|
+
return /* @__PURE__ */ jsx8(LastActiveGameContext.Provider, { value, children });
|
|
280
291
|
}
|
|
281
292
|
function useLastActiveGame() {
|
|
282
293
|
const ctx = useContext3(LastActiveGameContext);
|
|
@@ -297,7 +308,7 @@ var profileSelectionActions = actions2;
|
|
|
297
308
|
var profileSelectionSlice_default = reducer2;
|
|
298
309
|
|
|
299
310
|
// src/hooks/useProfiles.tsx
|
|
300
|
-
import { jsx as
|
|
311
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
301
312
|
var SHARED_GROUP_ID = "group.com.infinitetoken.tastic";
|
|
302
313
|
var ProfilesContext = createContext4(null);
|
|
303
314
|
function ProfilesProvider({ children }) {
|
|
@@ -357,7 +368,7 @@ function ProfilesProvider({ children }) {
|
|
|
357
368
|
},
|
|
358
369
|
[dispatch]
|
|
359
370
|
);
|
|
360
|
-
return /* @__PURE__ */
|
|
371
|
+
return /* @__PURE__ */ jsx9(ProfilesContext.Provider, { value: { profiles, lastSelected, loaded, createProfile, updateProfile, deleteProfile, selectProfile }, children });
|
|
361
372
|
}
|
|
362
373
|
function useProfiles() {
|
|
363
374
|
const ctx = useContext4(ProfilesContext);
|
|
@@ -366,7 +377,7 @@ function useProfiles() {
|
|
|
366
377
|
}
|
|
367
378
|
|
|
368
379
|
// src/RootLayout.tsx
|
|
369
|
-
import { Fragment as
|
|
380
|
+
import { Fragment as Fragment4, jsx as jsx10, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
370
381
|
var PLAY_OPTIONS = { statusBarHidden: true };
|
|
371
382
|
var KEEP_STATUS_BAR_OPTIONS = {};
|
|
372
383
|
var TRANSPARENT_CONTENT = { backgroundColor: "transparent" };
|
|
@@ -379,7 +390,7 @@ function AppStack() {
|
|
|
379
390
|
const rootBackground = useThemedRootBackground(darkRoot, false);
|
|
380
391
|
const statusBarStyle = darkRoot ? "light" : "dark";
|
|
381
392
|
const packOptions = (pack.useScreenOptions ?? noScreenOptions)();
|
|
382
|
-
const backdropOptions = Backdrop ? { contentStyle: TRANSPARENT_CONTENT, animation:
|
|
393
|
+
const backdropOptions = Backdrop ? { contentStyle: TRANSPARENT_CONTENT, animation: Platform3.select({ android: "fade" }) } : void 0;
|
|
383
394
|
const playOptions = useCallback5(
|
|
384
395
|
({ route }) => {
|
|
385
396
|
const id = route.params?.game;
|
|
@@ -392,54 +403,54 @@ function AppStack() {
|
|
|
392
403
|
const base = darkRoot ? DarkTheme : DefaultTheme;
|
|
393
404
|
return { ...base, colors: { ...base.colors, background: navigationBackground } };
|
|
394
405
|
}, [darkRoot, navigationBackground]);
|
|
395
|
-
const stack = /* @__PURE__ */
|
|
396
|
-
/* @__PURE__ */
|
|
397
|
-
/* @__PURE__ */
|
|
406
|
+
const stack = /* @__PURE__ */ jsx10(NavigationThemeProvider, { value: navigationTheme, children: /* @__PURE__ */ jsxs2(Stack, { screenOptions: { ...rootBackground, statusBarStyle, ...backdropOptions, ...packOptions }, children: [
|
|
407
|
+
/* @__PURE__ */ jsx10(Stack.Screen, { name: "index" }),
|
|
408
|
+
/* @__PURE__ */ jsx10(Stack.Screen, { name: "play/[game]", options: playOptions })
|
|
398
409
|
] }) });
|
|
399
410
|
if (!Backdrop) return stack;
|
|
400
411
|
return /* @__PURE__ */ jsxs2(View, { style: styles.root, children: [
|
|
401
|
-
/* @__PURE__ */
|
|
412
|
+
/* @__PURE__ */ jsx10(Backdrop, {}),
|
|
402
413
|
stack
|
|
403
414
|
] });
|
|
404
415
|
}
|
|
405
416
|
function GatedApp({ children }) {
|
|
406
417
|
const { loaded } = useProfiles();
|
|
407
|
-
return /* @__PURE__ */
|
|
418
|
+
return /* @__PURE__ */ jsx10(SplashGate, { gate: "profiles", ready: loaded, children });
|
|
408
419
|
}
|
|
409
420
|
function HapticGatedToastProvider({ children }) {
|
|
410
421
|
const { settings } = useHapticSettings();
|
|
411
422
|
const { Toaster: PackToasterComponent } = usePack();
|
|
412
|
-
return /* @__PURE__ */
|
|
423
|
+
return /* @__PURE__ */ jsx10(ToastProvider, { haptics: settings.vibrate ? Haptics : void 0, paper: PackToasterComponent ? void 0 : RNPaper2, children });
|
|
413
424
|
}
|
|
414
425
|
function RotatingToaster() {
|
|
415
426
|
const renderFrame = useCallback5(
|
|
416
|
-
(toasts) => /* @__PURE__ */
|
|
427
|
+
(toasts) => /* @__PURE__ */ jsx10(RotatedFrame, { rotatedSafeArea: true, passThrough: true, children: toasts }),
|
|
417
428
|
[]
|
|
418
429
|
);
|
|
419
|
-
return /* @__PURE__ */
|
|
430
|
+
return /* @__PURE__ */ jsx10(Toaster, { historyButton: null, clearButton: null, limit: 3, renderFrame });
|
|
420
431
|
}
|
|
421
432
|
function PackToaster({ Toaster: PackToasterComponent }) {
|
|
422
|
-
return /* @__PURE__ */
|
|
433
|
+
return /* @__PURE__ */ jsx10(View, { style: StyleSheet.absoluteFill, pointerEvents: "box-none", children: /* @__PURE__ */ jsx10(RotatedFrame, { rotatedSafeArea: true, passThrough: true, children: /* @__PURE__ */ jsx10(PackToasterComponent, {}) }) });
|
|
423
434
|
}
|
|
424
435
|
function GameProviders({ games, children }) {
|
|
425
|
-
return games.reduceRight((inner, game) => game.Provider ? /* @__PURE__ */
|
|
436
|
+
return games.reduceRight((inner, game) => game.Provider ? /* @__PURE__ */ jsx10(game.Provider, { children: inner }, game.id) : inner, children);
|
|
426
437
|
}
|
|
427
438
|
function PreviewColors({ previewColor, children }) {
|
|
428
439
|
const { dark } = useAutoPaperTheme();
|
|
429
440
|
const preview = useCallback5((hex) => previewColor(hex, dark), [previewColor, dark]);
|
|
430
|
-
return /* @__PURE__ */
|
|
441
|
+
return /* @__PURE__ */ jsx10(ProfileColorProvider, { preview, children });
|
|
431
442
|
}
|
|
432
443
|
function PackRoot({ pack, children }) {
|
|
433
444
|
const { Provider, previewColor } = pack;
|
|
434
|
-
const inner = Provider ? /* @__PURE__ */
|
|
435
|
-
return previewColor ? /* @__PURE__ */
|
|
445
|
+
const inner = Provider ? /* @__PURE__ */ jsx10(Provider, { children }) : children;
|
|
446
|
+
return previewColor ? /* @__PURE__ */ jsx10(PreviewColors, { previewColor, children: inner }) : /* @__PURE__ */ jsx10(Fragment4, { children: inner });
|
|
436
447
|
}
|
|
437
448
|
function RootLayout({ pack, store, persistor }) {
|
|
438
|
-
return /* @__PURE__ */
|
|
439
|
-
/* @__PURE__ */
|
|
440
|
-
pack.Toaster ? /* @__PURE__ */
|
|
441
|
-
/* @__PURE__ */
|
|
442
|
-
] }) }) }) }) }) }) }) }) }) }) }) });
|
|
449
|
+
return /* @__PURE__ */ jsx10(GestureHandlerRootView, { style: styles.root, children: /* @__PURE__ */ jsx10(SafeAreaProvider, { children: /* @__PURE__ */ jsx10(WindowControlsInsets, { children: /* @__PURE__ */ jsx10(PackProvider, { pack, children: /* @__PURE__ */ jsx10(Fonts, { children: /* @__PURE__ */ jsx10(Providers, { store, persistor, children: /* @__PURE__ */ jsx10(Theme, { children: /* @__PURE__ */ jsx10(ProfilesProvider, { children: /* @__PURE__ */ jsx10(LastActiveGameProvider, { children: /* @__PURE__ */ jsx10(GameProviders, { games: pack.games, children: /* @__PURE__ */ jsx10(PackRoot, { pack, children: /* @__PURE__ */ jsx10(GatedApp, { children: /* @__PURE__ */ jsxs2(HapticGatedToastProvider, { children: [
|
|
450
|
+
/* @__PURE__ */ jsx10(GuideHost, { children: /* @__PURE__ */ jsx10(AppStack, {}) }),
|
|
451
|
+
pack.Toaster ? /* @__PURE__ */ jsx10(PackToaster, { Toaster: pack.Toaster }) : /* @__PURE__ */ jsx10(RotatingToaster, {}),
|
|
452
|
+
/* @__PURE__ */ jsx10(UpdateDialog, {})
|
|
453
|
+
] }) }) }) }) }) }) }) }) }) }) }) }) });
|
|
443
454
|
}
|
|
444
455
|
var styles = StyleSheet.create({
|
|
445
456
|
root: { flex: 1 }
|
|
@@ -466,7 +477,7 @@ import { router as router2, useFocusEffect as useFocusEffect2 } from "expo-route
|
|
|
466
477
|
import { useCallback as useCallback9, useEffect as useEffect4, useMemo as useMemo5, useRef as useRef4, useState as useState4 } from "react";
|
|
467
478
|
import { StyleSheet as StyleSheet3, View as View3 } from "react-native";
|
|
468
479
|
import Animated from "react-native-reanimated";
|
|
469
|
-
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
480
|
+
import { useSafeAreaInsets as useSafeAreaInsets2 } from "react-native-safe-area-context";
|
|
470
481
|
import { useDispatch as useDispatch9 } from "react-redux";
|
|
471
482
|
|
|
472
483
|
// src/components/OpponentPicker.tsx
|
|
@@ -474,7 +485,7 @@ import { useZoneClampedAlign } from "@tastic/hud/lobby";
|
|
|
474
485
|
import { getOptionPickerContentSize, OptionPicker } from "@tastic/profile";
|
|
475
486
|
import { useMemo as useMemo4 } from "react";
|
|
476
487
|
import { StyleSheet as StyleSheet2, View as View2 } from "react-native";
|
|
477
|
-
import { jsx as
|
|
488
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
478
489
|
var CPU_PREFIX = "cpu:";
|
|
479
490
|
var NOBODY = "nobody";
|
|
480
491
|
var PERSON = "person";
|
|
@@ -509,7 +520,7 @@ function OpponentPicker({ idPrefix, host, choices, seatTwo, onSeatTwoChange, cpu
|
|
|
509
520
|
const size = getOptionPickerContentSize(options, colorSection);
|
|
510
521
|
const useAlign = usePickerAlign ?? useZoneClampedAlign;
|
|
511
522
|
const align = useAlign(host.openId === pickerId, size.width, size.height);
|
|
512
|
-
return /* @__PURE__ */
|
|
523
|
+
return /* @__PURE__ */ jsx11(View2, { style: [styles2.button, host.openId === pickerId && styles2.buttonOpen], children: /* @__PURE__ */ jsx11(OptionPicker, { id: pickerId, host, options, value, onChange: handleChange, color: drawn, dark, icon, colorSection, alignOverride: align, triggerStyle }) });
|
|
513
524
|
}
|
|
514
525
|
var styles2 = StyleSheet2.create({
|
|
515
526
|
// Its own column, so a row of seat buttons doesn't stretch the pill to the tallest of them.
|
|
@@ -557,7 +568,7 @@ function useAppSettings() {
|
|
|
557
568
|
}
|
|
558
569
|
|
|
559
570
|
// src/components/SettingsDialog.tsx
|
|
560
|
-
import { jsx as
|
|
571
|
+
import { jsx as jsx12, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
561
572
|
var noSettingsRules = () => null;
|
|
562
573
|
function SettingsDialog({ visible, onDismiss, onShowHowToPlay, children }) {
|
|
563
574
|
const onUpdateError = useUpdateErrorToast2();
|
|
@@ -567,16 +578,16 @@ function SettingsDialog({ visible, onDismiss, onShowHowToPlay, children }) {
|
|
|
567
578
|
const edgeGuardProps = edgeGuard ? { deferBottomEdgeGestures: settings.deferBottomEdgeGestures, onDeferBottomEdgeGestures: (value) => setSettings({ deferBottomEdgeGestures: value }) } : {};
|
|
568
579
|
return /* @__PURE__ */ jsxs3(BaseSettingsDialog, { visible, onDismiss, version: otaVersion, ...edgeGuardProps, onUpdateError, onShowHowToPlay, leading: rules, children: [
|
|
569
580
|
children,
|
|
570
|
-
SettingsSections && /* @__PURE__ */
|
|
581
|
+
SettingsSections && /* @__PURE__ */ jsx12(SettingsSections, {})
|
|
571
582
|
] });
|
|
572
583
|
}
|
|
573
584
|
|
|
574
585
|
// src/hooks/useAtComputer.ts
|
|
575
586
|
import { useIsTouchPrimaryDevice as useIsTouchPrimaryDevice2 } from "@tastic/core";
|
|
576
|
-
import { Platform as
|
|
587
|
+
import { Platform as Platform4 } from "react-native";
|
|
577
588
|
function useAtComputer() {
|
|
578
589
|
const touchPrimary = useIsTouchPrimaryDevice2();
|
|
579
|
-
return
|
|
590
|
+
return Platform4.OS === "web" && !touchPrimary;
|
|
580
591
|
}
|
|
581
592
|
|
|
582
593
|
// src/hooks/useOpponent.ts
|
|
@@ -732,7 +743,7 @@ var liveplayActions = actions5;
|
|
|
732
743
|
var liveplaySlice_default = reducer5;
|
|
733
744
|
|
|
734
745
|
// src/screens/LoadoutScreen.tsx
|
|
735
|
-
import { jsx as
|
|
746
|
+
import { jsx as jsx13, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
736
747
|
var PANEL_SWAP_FADE_MS = 180;
|
|
737
748
|
var P1_CONTROL_ID = "p1-control";
|
|
738
749
|
var P2_CONTROL_ID = "p2-control";
|
|
@@ -754,7 +765,7 @@ function LoadoutScreen({ game }) {
|
|
|
754
765
|
const { panelLayout, panelFadeStyle } = useDualZoneLayout(panelMode, false, true, false, PANEL_SWAP_FADE_MS);
|
|
755
766
|
const playersRowFade = panelFadeStyle;
|
|
756
767
|
const [settingsOpen, setSettingsOpen] = useState4(false);
|
|
757
|
-
const insets =
|
|
768
|
+
const insets = useSafeAreaInsets2();
|
|
758
769
|
const { colors: themeColors, dark } = useAutoPaperTheme3();
|
|
759
770
|
const { p1Color, p2Color, handleP1ColorChange, handleP2ColorChange } = useSeatColors(p2IsHuman);
|
|
760
771
|
const dispatch = useDispatch9();
|
|
@@ -811,11 +822,11 @@ function LoadoutScreen({ game }) {
|
|
|
811
822
|
onReset: showMetaInSharedBand ? void 0 : loadout.reset
|
|
812
823
|
});
|
|
813
824
|
const optionsPopoverOpen = controlsHost.openId !== null && loadout.optionIds.includes(controlsHost.openId);
|
|
814
|
-
const sharedControls = showMetaInSharedBand ? /* @__PURE__ */
|
|
825
|
+
const sharedControls = showMetaInSharedBand ? /* @__PURE__ */ jsx13(SharedActionBand, { onBack: safeBack, onSettings: () => setSettingsOpen(true), onRandomize: loadout.randomize, onReset: loadout.reset, fg, popoverOpen: optionsPopoverOpen, children: optionsRow }) : optionsRow;
|
|
815
826
|
const controlLook = { accentColor: themeColors.tertiary, mutedColor: fgMuted, dark };
|
|
816
827
|
const p1Control = loadout.seatControl(1, controlsHost, { ...controlLook, seatColor: p1Drawn });
|
|
817
|
-
const p1Panel = /* @__PURE__ */
|
|
818
|
-
const opponentPicker = game.seatTwo && /* @__PURE__ */
|
|
828
|
+
const p1Panel = /* @__PURE__ */ jsx13(PlayerSetupPanel, { idPrefix: "p1", host: controlsHost, color: p1Color, onColorChange: handleP1ColorChange, swatches: 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: () => router2.push(PROFILES_HREF), previewValue: seatPreview, triggerStyle, useSeatPickerAlign: seatPickerAlign }, `p1-${layoutKey}`);
|
|
829
|
+
const opponentPicker = game.seatTwo && /* @__PURE__ */ jsx13(OpponentPicker, { idPrefix: "p1", host: controlsHost, choices: game.seatTwo, seatTwo, onSeatTwoChange: changeSeatTwo, cpuDifficulty: loadout.cpuDifficulty, color: p2Color, onColorChange: handleP2ColorChange, swatches: defaultColors, takenColor: p1Color, allowSwapTaken: mode === "vsCpu", dark, previewValue: seatPreview, triggerStyle, usePickerAlign: seatPickerAlign }, `opponent-${layoutKey}`);
|
|
819
830
|
const toggleP1Ready = () => setReady((r) => ({ ...r, 1: !r[1] }));
|
|
820
831
|
const seatOne = /* @__PURE__ */ jsxs4(View3, { style: [styles3.seatOne, !p2IsHuman && styles3.seatOneAlone, p1PickerOpen && styles3.raised], children: [
|
|
821
832
|
/* @__PURE__ */ jsxs4(View3, { style: [styles3.seatOneButtons, p1PickerOpen && styles3.raised], children: [
|
|
@@ -823,18 +834,18 @@ function LoadoutScreen({ game }) {
|
|
|
823
834
|
p1Panel,
|
|
824
835
|
opponentPicker
|
|
825
836
|
] }),
|
|
826
|
-
p1Control && /* @__PURE__ */
|
|
837
|
+
p1Control && /* @__PURE__ */ jsx13(View3, { style: [styles3.controlRow, p1ControlOpen && styles3.raised], children: p1Control })
|
|
827
838
|
] }),
|
|
828
|
-
/* @__PURE__ */
|
|
839
|
+
/* @__PURE__ */ jsx13(ReadyButton, { color: p1Drawn, ready: ready[1], onToggleReady: toggleP1Ready, surfaceColor: readySurface, dark, style: !p2IsHuman && p1PickerOpen && styles3.readyButtonHidden })
|
|
829
840
|
] });
|
|
830
841
|
const p2Control = p2IsHuman ? loadout.seatControl(2, p2Host, { ...controlLook, seatColor: p2Drawn }) : void 0;
|
|
831
|
-
const p2Panel = p2IsHuman && /* @__PURE__ */
|
|
842
|
+
const p2Panel = p2IsHuman && /* @__PURE__ */ jsx13(PlayerSetupPanel, { idPrefix: "p2", host: p2Host, color: p2Color, onColorChange: handleP2ColorChange, swatches: 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");
|
|
832
843
|
return /* @__PURE__ */ jsxs4(View3, { style: [styles3.container, { backgroundColor: bg }], children: [
|
|
833
844
|
/* @__PURE__ */ jsxs4(View3, { style: styles3.frame, children: [
|
|
834
|
-
/* @__PURE__ */
|
|
835
|
-
p2ZoneStyle && /* @__PURE__ */
|
|
836
|
-
!showMetaInSharedBand && /* @__PURE__ */
|
|
837
|
-
p2IsHuman ? /* @__PURE__ */
|
|
845
|
+
/* @__PURE__ */ jsx13(PressAwayOverlay, { active: controlsHost.openId !== null, onPress: controlsHost.close }),
|
|
846
|
+
p2ZoneStyle && /* @__PURE__ */ jsx13(PressAwayOverlay, { active: controlsHost.openId !== null || p2Host.openId !== null, onPress: p2Host.close, style: p2ZoneStyle }),
|
|
847
|
+
!showMetaInSharedBand && /* @__PURE__ */ jsx13(CornerActionButtons, { onBack: safeBack, onSettings: () => setSettingsOpen(true), fg, insets }),
|
|
848
|
+
p2IsHuman ? /* @__PURE__ */ jsx13(
|
|
838
849
|
DualZoneLayout,
|
|
839
850
|
{
|
|
840
851
|
panelLayout,
|
|
@@ -851,7 +862,7 @@ function LoadoutScreen({ game }) {
|
|
|
851
862
|
seatOne
|
|
852
863
|
] })
|
|
853
864
|
] }),
|
|
854
|
-
/* @__PURE__ */
|
|
865
|
+
/* @__PURE__ */ jsx13(SettingsDialog, { visible: settingsOpen, onDismiss: () => setSettingsOpen(false), onShowHowToPlay: () => openFor(game.id) })
|
|
855
866
|
] });
|
|
856
867
|
}
|
|
857
868
|
function halfOf(color) {
|
|
@@ -932,13 +943,13 @@ var styles3 = StyleSheet3.create({
|
|
|
932
943
|
});
|
|
933
944
|
|
|
934
945
|
// src/screens/GameRoute.tsx
|
|
935
|
-
import { jsx as
|
|
946
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
936
947
|
function LoadoutRoute() {
|
|
937
948
|
const { game: id } = useLocalSearchParams();
|
|
938
949
|
const game = usePackGame(id);
|
|
939
|
-
if (!game) return /* @__PURE__ */
|
|
940
|
-
if (!hasLoadout(game)) return /* @__PURE__ */
|
|
941
|
-
return /* @__PURE__ */
|
|
950
|
+
if (!game) return /* @__PURE__ */ jsx14(Redirect, { href: "/" });
|
|
951
|
+
if (!hasLoadout(game)) return /* @__PURE__ */ jsx14(Redirect, { href: playHref(game.id) });
|
|
952
|
+
return /* @__PURE__ */ jsx14(LoadoutScreen, { game }, game.id);
|
|
942
953
|
}
|
|
943
954
|
function hasLoadout(game) {
|
|
944
955
|
return !!game.useLoadout;
|
|
@@ -947,9 +958,9 @@ function PlayRoute() {
|
|
|
947
958
|
const { game: id } = useLocalSearchParams();
|
|
948
959
|
const game = usePackGame(id);
|
|
949
960
|
useResumePoint(game?.resumable ? game.id : null);
|
|
950
|
-
if (!game) return /* @__PURE__ */
|
|
961
|
+
if (!game) return /* @__PURE__ */ jsx14(Redirect, { href: "/" });
|
|
951
962
|
const { PlayScreen } = game;
|
|
952
|
-
return /* @__PURE__ */
|
|
963
|
+
return /* @__PURE__ */ jsx14(PlayScreen, {}, game.id);
|
|
953
964
|
}
|
|
954
965
|
function useResumePoint(gameId) {
|
|
955
966
|
const { setLastActiveGame, clearLastActiveGame } = useLastActiveGame();
|
|
@@ -995,7 +1006,7 @@ function useFrozenWhileHidden(value, hidden) {
|
|
|
995
1006
|
// src/screens/homeLayout.ts
|
|
996
1007
|
import { clamp } from "@tastic/core";
|
|
997
1008
|
import { useWindowDimensions } from "react-native";
|
|
998
|
-
import { useSafeAreaInsets as
|
|
1009
|
+
import { useSafeAreaInsets as useSafeAreaInsets3 } from "react-native-safe-area-context";
|
|
999
1010
|
var PREVIEW_ASPECT = 360 / 200;
|
|
1000
1011
|
var ROW_PREVIEW_WIDTH = 92;
|
|
1001
1012
|
var HOME_WIDE_EDGE_PADDING = 16;
|
|
@@ -1049,12 +1060,12 @@ function computeHomeLayout(windowWidth, windowHeight, insets) {
|
|
|
1049
1060
|
}
|
|
1050
1061
|
function useHomeLayout() {
|
|
1051
1062
|
const { width, height } = useWindowDimensions();
|
|
1052
|
-
const insets =
|
|
1063
|
+
const insets = useSafeAreaInsets3();
|
|
1053
1064
|
return computeHomeLayout(width, height, insets);
|
|
1054
1065
|
}
|
|
1055
1066
|
|
|
1056
1067
|
// src/screens/HomeScreen.tsx
|
|
1057
|
-
import { Fragment as
|
|
1068
|
+
import { Fragment as Fragment5, jsx as jsx15, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1058
1069
|
function HomeScreen() {
|
|
1059
1070
|
const pack = usePack();
|
|
1060
1071
|
const { consumeResumeGame } = useLastActiveGame();
|
|
@@ -1066,8 +1077,8 @@ function HomeScreen() {
|
|
|
1066
1077
|
useEffect6(() => {
|
|
1067
1078
|
if (!resumeGame) autoShowPack();
|
|
1068
1079
|
}, [resumeGame, autoShowPack]);
|
|
1069
|
-
if (resumeGame) return /* @__PURE__ */
|
|
1070
|
-
return /* @__PURE__ */
|
|
1080
|
+
if (resumeGame) return /* @__PURE__ */ jsx15(Redirect2, { href: playHref(resumeGame.id) });
|
|
1081
|
+
return /* @__PURE__ */ jsx15(HomeMenu, {});
|
|
1071
1082
|
}
|
|
1072
1083
|
function HomeMenu() {
|
|
1073
1084
|
const pack = usePack();
|
|
@@ -1110,7 +1121,7 @@ function HomeMenu() {
|
|
|
1110
1121
|
const [tabLabel, setTabLabel] = useState6(() => tabs?.[0].label ?? null);
|
|
1111
1122
|
const tab = tabs ? tabs.find((t) => t.label === tabLabel) ?? tabs[0] : null;
|
|
1112
1123
|
const tabButtons = useMemo6(() => tabs?.map(({ label }) => ({ value: label, label })) ?? [], [tabs]);
|
|
1113
|
-
const tabBar = tab && /* @__PURE__ */
|
|
1124
|
+
const tabBar = tab && /* @__PURE__ */ jsx15(SegmentedButtons, { value: tab.label, onValueChange: setTabLabel, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles4.tabs, pack.Backdrop && { backgroundColor: colors.surface }] });
|
|
1114
1125
|
const columnClamp = useClampOnShrink();
|
|
1115
1126
|
const gridClamp = useClampOnShrink();
|
|
1116
1127
|
const openGame = useCallback10((game) => openFirstTime(game.id, () => router3.push(game.useLoadout ? loadoutHref(game.id) : playHref(game.id))), [openFirstTime]);
|
|
@@ -1119,33 +1130,33 @@ function HomeMenu() {
|
|
|
1119
1130
|
const usePickerAlign = pack.usePickerAlign ?? noPickerAlign;
|
|
1120
1131
|
const pickerSize = getProfilePickerContentSize(profiles.length, true, colorSection);
|
|
1121
1132
|
const pickerAlign = usePickerAlign(pickerHost.openId === `${SEAT_ONE_PICKER}-profile`, pickerSize.width, pickerSize.height);
|
|
1122
|
-
const picker = /* @__PURE__ */
|
|
1123
|
-
const pressAway = /* @__PURE__ */
|
|
1133
|
+
const picker = /* @__PURE__ */ jsx15(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: () => router3.push(PROFILES_HREF), colorSection, alignOverride: pickerAlign, triggerStyle });
|
|
1134
|
+
const pressAway = /* @__PURE__ */ jsx15(PressAwayOverlay2, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles4.pressAway });
|
|
1124
1135
|
const RulesSheet = rulesGame?.Rules;
|
|
1125
1136
|
return /* @__PURE__ */ jsxs5(View4, { style: [styles4.container, { backgroundColor: bg }], children: [
|
|
1126
|
-
/* @__PURE__ */
|
|
1127
|
-
isWide ? /* @__PURE__ */ jsxs5(
|
|
1137
|
+
/* @__PURE__ */ jsx15(View4, { style: styles4.frame, children: /* @__PURE__ */ jsxs5(RulesHost, { enabled: pack.games.some((game) => game.Rules), children: [
|
|
1138
|
+
isWide ? /* @__PURE__ */ jsxs5(Fragment5, { children: [
|
|
1128
1139
|
pressAway,
|
|
1129
1140
|
/* @__PURE__ */ jsxs5(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: [
|
|
1130
|
-
tabBar && /* @__PURE__ */
|
|
1131
|
-
/* @__PURE__ */
|
|
1141
|
+
tabBar && /* @__PURE__ */ jsx15(View4, { style: [styles4.wideTabs, { width: layout.rightPaneWidth }], children: tabBar }),
|
|
1142
|
+
/* @__PURE__ */ jsx15(View4, { style: [styles4.grid, { width: layout.rightPaneWidth }], children: pack.games.map((game) => /* @__PURE__ */ jsx15(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)) })
|
|
1132
1143
|
] }),
|
|
1133
1144
|
/* @__PURE__ */ jsxs5(View4, { 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: [
|
|
1134
|
-
/* @__PURE__ */
|
|
1135
|
-
/* @__PURE__ */
|
|
1145
|
+
/* @__PURE__ */ jsx15(pack.HeroTitle, { words: pack.wordmark, color: fg, p1Color, p2Color, active: heroActive, fit: layout.heroFit }),
|
|
1146
|
+
/* @__PURE__ */ jsx15(View4, { style: styles4.widePicker, children: picker })
|
|
1136
1147
|
] })
|
|
1137
1148
|
] }) : /* @__PURE__ */ jsxs5(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: [
|
|
1138
1149
|
pressAway,
|
|
1139
|
-
/* @__PURE__ */
|
|
1140
|
-
/* @__PURE__ */
|
|
1141
|
-
tabBar && /* @__PURE__ */
|
|
1142
|
-
/* @__PURE__ */
|
|
1150
|
+
/* @__PURE__ */ jsx15(pack.HeroTitle, { words: pack.wordmark, color: fg, p1Color, p2Color, active: heroActive }),
|
|
1151
|
+
/* @__PURE__ */ jsx15(View4, { style: [styles4.picker, pickerHost.openId !== null && styles4.pickerOpen], children: picker }),
|
|
1152
|
+
tabBar && /* @__PURE__ */ jsx15(View4, { style: styles4.listWidth, children: tabBar }),
|
|
1153
|
+
/* @__PURE__ */ jsx15(View4, { style: styles4.list, children: pack.games.map((game) => /* @__PURE__ */ jsx15(GameRow, { game, hidden: isHidden(tab, game), dark, p1Color, p2Color, previewRevealed: previewsRevealed, onPress: () => openGame(game), onRules: hasRules(game) ? () => openRules(game) : void 0 }, game.id)) })
|
|
1143
1154
|
] }),
|
|
1144
|
-
/* @__PURE__ */
|
|
1145
|
-
/* @__PURE__ */
|
|
1146
|
-
RulesSheet && /* @__PURE__ */
|
|
1155
|
+
/* @__PURE__ */ jsx15(IconButton, { icon: "trophy", iconColor: fg, size: 24, style: [styles4.corner, { top: 8 + insets.top, left: 8 + insets.left }], onPress: () => router3.push(STATS_HREF), accessibilityLabel: "Stats & Achievements" }),
|
|
1156
|
+
/* @__PURE__ */ jsx15(IconButton, { icon: "cog", iconColor: fg, size: 24, style: [styles4.corner, { top: 8 + insets.top, right: 8 + insets.right }], onPress: () => setSettingsOpen(true), accessibilityLabel: "Settings" }),
|
|
1157
|
+
RulesSheet && /* @__PURE__ */ jsx15(RulesSheet, { visible: true, onDismiss: () => setRulesGame(null) })
|
|
1147
1158
|
] }) }),
|
|
1148
|
-
/* @__PURE__ */
|
|
1159
|
+
/* @__PURE__ */ jsx15(SettingsDialog, { visible: settingsOpen, onDismiss: () => setSettingsOpen(false), onShowHowToPlay: pack.guide ? openPack : void 0 })
|
|
1149
1160
|
] });
|
|
1150
1161
|
}
|
|
1151
1162
|
var SEAT_ONE_PICKER = "home-p1";
|
|
@@ -1182,7 +1193,7 @@ function hasRules(game) {
|
|
|
1182
1193
|
return !!(game.Rules || game.guide);
|
|
1183
1194
|
}
|
|
1184
1195
|
function RulesHost({ enabled, children }) {
|
|
1185
|
-
return enabled ? /* @__PURE__ */
|
|
1196
|
+
return enabled ? /* @__PURE__ */ jsx15(Portal.Host, { children }) : /* @__PURE__ */ jsx15(Fragment5, { children });
|
|
1186
1197
|
}
|
|
1187
1198
|
var ROW_BLURB_LINES = 3;
|
|
1188
1199
|
function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPress, onRules }) {
|
|
@@ -1193,13 +1204,13 @@ function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPres
|
|
|
1193
1204
|
// inside a button is invalid on the web.
|
|
1194
1205
|
/* @__PURE__ */ jsxs5(View4, { style: hidden ? styles4.hidden : void 0, children: [
|
|
1195
1206
|
/* @__PURE__ */ jsxs5(Pressable, { onPress, style: [styles4.row, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
|
|
1196
|
-
game.Preview ? /* @__PURE__ */
|
|
1207
|
+
game.Preview ? /* @__PURE__ */ jsx15(PreviewBox, { game, width: ROW_PREVIEW_WIDTH, revealed: previewRevealed, dark, p1Color, p2Color }) : /* @__PURE__ */ jsx15(View4, { style: [styles4.rowIcon, { backgroundColor: dark ? ICON_DARK_BG : ICON_LIGHT_BG }], children: GameIcon && /* @__PURE__ */ jsx15(GameIcon, { size: ROW_ICON_SIZE, p1Color, p2Color, dark }) }),
|
|
1197
1208
|
/* @__PURE__ */ jsxs5(View4, { style: styles4.rowText, children: [
|
|
1198
|
-
/* @__PURE__ */
|
|
1199
|
-
/* @__PURE__ */
|
|
1209
|
+
/* @__PURE__ */ jsx15(Text, { variant: "titleLarge", style: [styles4.rowTitle, { color: well.fg }], numberOfLines: 1, children: game.title }),
|
|
1210
|
+
/* @__PURE__ */ jsx15(Text, { variant: "bodyMedium", style: { color: well.fgMuted }, numberOfLines: ROW_BLURB_LINES, children: game.blurb })
|
|
1200
1211
|
] })
|
|
1201
1212
|
] }),
|
|
1202
|
-
onRules && /* @__PURE__ */
|
|
1213
|
+
onRules && /* @__PURE__ */ jsx15(Pressable, { onPress: onRules, style: styles4.rulesButton, hitSlop: 12, accessibilityRole: "button", accessibilityLabel: `${game.title} rules`, children: /* @__PURE__ */ jsx15(Icon, { source: "information-outline", size: 22, color: well.fgMuted }) })
|
|
1203
1214
|
] })
|
|
1204
1215
|
);
|
|
1205
1216
|
}
|
|
@@ -1207,18 +1218,18 @@ function GameTile({ game, hidden, width, previewWidth, dark, p1Color, p2Color, p
|
|
|
1207
1218
|
const well = useWellColors();
|
|
1208
1219
|
return /* @__PURE__ */ jsxs5(View4, { style: [{ width }, hidden && styles4.hidden], children: [
|
|
1209
1220
|
/* @__PURE__ */ jsxs5(Pressable, { onPress, style: [styles4.tile, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
|
|
1210
|
-
/* @__PURE__ */
|
|
1211
|
-
/* @__PURE__ */
|
|
1212
|
-
/* @__PURE__ */
|
|
1221
|
+
/* @__PURE__ */ jsx15(PreviewBox, { game, width: previewWidth, revealed: previewRevealed, dark, p1Color, p2Color }),
|
|
1222
|
+
/* @__PURE__ */ jsx15(Text, { variant: "titleMedium", style: [styles4.rowTitle, { color: well.fg }], numberOfLines: 1, children: game.title }),
|
|
1223
|
+
/* @__PURE__ */ jsx15(Text, { variant: "bodySmall", style: { color: well.fgMuted }, numberOfLines: 3, children: game.blurb })
|
|
1213
1224
|
] }),
|
|
1214
|
-
onRules && /* @__PURE__ */
|
|
1225
|
+
onRules && /* @__PURE__ */ jsx15(Pressable, { onPress: onRules, style: styles4.tileRulesButton, hitSlop: 12, accessibilityRole: "button", accessibilityLabel: `${game.title} rules`, children: /* @__PURE__ */ jsx15(Icon, { source: "information-outline", size: 20, color: "#FFFFFF" }) })
|
|
1215
1226
|
] });
|
|
1216
1227
|
}
|
|
1217
1228
|
function PreviewBox({ game, width, revealed, dark, p1Color, p2Color }) {
|
|
1218
1229
|
const height = Math.round(width / PREVIEW_ASPECT);
|
|
1219
1230
|
const { Preview, icon: GameIcon } = game;
|
|
1220
1231
|
const iconSize = Math.min(height, ROW_ICON_SIZE);
|
|
1221
|
-
return /* @__PURE__ */
|
|
1232
|
+
return /* @__PURE__ */ jsx15(View4, { style: [styles4.preview, { width, height, backgroundColor: dark ? ICON_DARK_BG : ICON_LIGHT_BG }], children: Preview ? revealed && /* @__PURE__ */ jsx15(Preview, { width, height, p1Color, p2Color, dark }) : GameIcon && /* @__PURE__ */ jsx15(View4, { style: [styles4.previewIcon, { width: iconSize, height: iconSize, borderRadius: iconSize * 0.22 }], children: /* @__PURE__ */ jsx15(GameIcon, { size: iconSize, p1Color, p2Color, dark }) }) });
|
|
1222
1233
|
}
|
|
1223
1234
|
var ROW_ICON_SIZE = 56;
|
|
1224
1235
|
var ICON_LIGHT_BG = "#FAFAFA";
|
|
@@ -1371,7 +1382,7 @@ var styles4 = StyleSheet4.create({
|
|
|
1371
1382
|
import { defaultColors as defaultColors3 } from "@rific/auto-paper";
|
|
1372
1383
|
import { RotatedFrame as RotatedFrame2 } from "@tastic/hud/chrome";
|
|
1373
1384
|
import { ProfilesScreen } from "@tastic/profile";
|
|
1374
|
-
import { jsx as
|
|
1385
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1375
1386
|
var ROSTER_MAX_WIDTH = 640;
|
|
1376
1387
|
function useRosterAlign(open, contentWidth, contentHeight) {
|
|
1377
1388
|
const { usePickerAlign } = usePack();
|
|
@@ -1380,7 +1391,7 @@ function useRosterAlign(open, contentWidth, contentHeight) {
|
|
|
1380
1391
|
function ProfilesRoute() {
|
|
1381
1392
|
const { profiles, createProfile, updateProfile, deleteProfile } = useProfiles();
|
|
1382
1393
|
const { Backdrop, foreground, newProfileColor, usePickerAlign } = usePack();
|
|
1383
|
-
return /* @__PURE__ */
|
|
1394
|
+
return /* @__PURE__ */ jsx16(RotatedFrame2, { rotatedSafeArea: true, portalHost: true, maxContentWidth: ROSTER_MAX_WIDTH, children: /* @__PURE__ */ jsx16(ProfilesScreen, { profiles, defaultColor: newProfileColor ?? defaultColors3[0].value, onCreate: (patch) => createProfile(patch), onSave: (id, patch) => updateProfile(id, patch), onDelete: deleteProfile, onBack: safeBack, fg: foreground, bg: Backdrop ? "transparent" : void 0, useColorPickerAlign: usePickerAlign ? useRosterAlign : void 0 }) });
|
|
1384
1395
|
}
|
|
1385
1396
|
|
|
1386
1397
|
// src/screens/StatsScreen.tsx
|
|
@@ -1390,9 +1401,9 @@ import { getOptionPickerContentSize as getOptionPickerContentSize2, OptionPicker
|
|
|
1390
1401
|
import { useMemo as useMemo7, useState as useState7 } from "react";
|
|
1391
1402
|
import { StyleSheet as StyleSheet5, View as View5 } from "react-native";
|
|
1392
1403
|
import { SegmentedButtons as SegmentedButtons2, Text as Text2 } from "react-native-paper";
|
|
1393
|
-
import { useSafeAreaInsets as
|
|
1404
|
+
import { useSafeAreaInsets as useSafeAreaInsets4 } from "react-native-safe-area-context";
|
|
1394
1405
|
import { useDispatch as useDispatch10 } from "react-redux";
|
|
1395
|
-
import { jsx as
|
|
1406
|
+
import { jsx as jsx17, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1396
1407
|
var STATS = "stats";
|
|
1397
1408
|
var ACHIEVEMENTS = "achievements";
|
|
1398
1409
|
var TABS = [
|
|
@@ -1408,17 +1419,17 @@ var GAME_PICKER_ID = "stats-game";
|
|
|
1408
1419
|
var STATS_MAX_WIDTH = 640;
|
|
1409
1420
|
function StatsScreen() {
|
|
1410
1421
|
const pickerHost = usePopoverHost3();
|
|
1411
|
-
return /* @__PURE__ */
|
|
1422
|
+
return /* @__PURE__ */ jsx17(StatsPressAway, { host: pickerHost, children: /* @__PURE__ */ jsx17(RotatedFrame3, { rotatedSafeArea: true, portalHost: true, maxContentWidth: STATS_MAX_WIDTH, children: /* @__PURE__ */ jsx17(StatsContent, { pickerHost }) }) });
|
|
1412
1423
|
}
|
|
1413
1424
|
function StatsPressAway({ host, children }) {
|
|
1414
|
-
return /* @__PURE__ */
|
|
1425
|
+
return /* @__PURE__ */ jsx17(View5, { testID: "stats-press-away", style: styles5.screen, onStartShouldSetResponder: () => host.openId !== null, onResponderRelease: host.close, children });
|
|
1415
1426
|
}
|
|
1416
1427
|
var useNoPackReset = () => null;
|
|
1417
1428
|
var noPickerAlign2 = () => void 0;
|
|
1418
1429
|
function StatsContent({ pickerHost }) {
|
|
1419
1430
|
const pack = usePack();
|
|
1420
1431
|
const { dark, colors } = useAutoPaperTheme5();
|
|
1421
|
-
const insets =
|
|
1432
|
+
const insets = useSafeAreaInsets4();
|
|
1422
1433
|
const { profiles, lastSelected } = useProfiles();
|
|
1423
1434
|
const dispatch = useDispatch10();
|
|
1424
1435
|
const fg = pack.foreground ?? colors.onBackground;
|
|
@@ -1446,15 +1457,15 @@ function StatsContent({ pickerHost }) {
|
|
|
1446
1457
|
const triggerStyle = pack.Backdrop ? [styles5.pill, surface] : void 0;
|
|
1447
1458
|
const PackTabContent = packTab?.Content;
|
|
1448
1459
|
return /* @__PURE__ */ jsxs6(BaseStatsScreen, { title, onBack: 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: [
|
|
1449
|
-
/* @__PURE__ */
|
|
1450
|
-
/* @__PURE__ */
|
|
1460
|
+
/* @__PURE__ */ jsx17(PressAwayOverlay3, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles5.pressAway }),
|
|
1461
|
+
/* @__PURE__ */ jsx17(SegmentedButtons2, { value: tab, onValueChange: setTab, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles5.tabs, surface] }),
|
|
1451
1462
|
/* @__PURE__ */ jsxs6(View5, { style: [styles5.filters, pickerHost.openId !== null && styles5.filtersOpen], onStartShouldSetResponder: () => pickerHost.openId !== null, children: [
|
|
1452
|
-
profiles.length > 0 && /* @__PURE__ */
|
|
1453
|
-
showGamePicker && /* @__PURE__ */
|
|
1463
|
+
profiles.length > 0 && /* @__PURE__ */ jsx17(OptionPicker2, { id: PLAYER_PICKER_ID, host: pickerHost, options: playerOptions, value: profileId ?? EVERYONE, onChange: (value) => setSelectedProfileId(value === EVERYONE ? null : value), color: colors.primary, dark, icon: profileId ? "account" : "account-group", alignOverride: playerAlign, triggerStyle }),
|
|
1464
|
+
showGamePicker && /* @__PURE__ */ jsx17(OptionPicker2, { id: GAME_PICKER_ID, host: pickerHost, options: gameOptions, value: gameId, onChange: setGameId, color: colors.primary, dark, icon: "view-grid-outline", alignOverride: gameAlign, triggerStyle })
|
|
1454
1465
|
] }),
|
|
1455
|
-
tab === STATS && pack.StatsSections && /* @__PURE__ */
|
|
1456
|
-
PackTabContent && /* @__PURE__ */
|
|
1457
|
-
tab === ACHIEVEMENTS && pack.AchievementList ? /* @__PURE__ */
|
|
1466
|
+
tab === STATS && pack.StatsSections && /* @__PURE__ */ jsx17(pack.StatsSections, { profileId, gameId: gameId === ALL_GAMES ? null : gameId }),
|
|
1467
|
+
PackTabContent && /* @__PURE__ */ jsx17(PackTabContent, { profileId, gameId: gameId === ALL_GAMES ? null : gameId }),
|
|
1468
|
+
tab === ACHIEVEMENTS && pack.AchievementList ? /* @__PURE__ */ jsx17(pack.AchievementList, { profileId }) : (tab === STATS || tab === ACHIEVEMENTS) && games.map((game) => /* @__PURE__ */ jsx17(GameStats, { game, tab, profileId, showTitle: games.length > 1 && pack.statsGameTitles !== false, titleColor: fg }, game.id))
|
|
1458
1469
|
] });
|
|
1459
1470
|
}
|
|
1460
1471
|
function resetFor(pack, packReset, profileId, profiles, games, resetGames) {
|
|
@@ -1470,8 +1481,8 @@ function GameStats({ game, tab, profileId, showTitle, titleColor }) {
|
|
|
1470
1481
|
const Sections = tab === STATS ? StatsSections : AchievementList;
|
|
1471
1482
|
if (!Sections) return null;
|
|
1472
1483
|
return /* @__PURE__ */ jsxs6(View5, { style: styles5.game, children: [
|
|
1473
|
-
showTitle && /* @__PURE__ */
|
|
1474
|
-
/* @__PURE__ */
|
|
1484
|
+
showTitle && /* @__PURE__ */ jsx17(Text2, { variant: "titleLarge", style: [styles5.gameTitle, { color: titleColor }], children: game.title }),
|
|
1485
|
+
/* @__PURE__ */ jsx17(Sections, { profileId })
|
|
1475
1486
|
] });
|
|
1476
1487
|
}
|
|
1477
1488
|
var styles5 = StyleSheet5.create({
|
|
@@ -1509,10 +1520,10 @@ var styles5 = StyleSheet5.create({
|
|
|
1509
1520
|
|
|
1510
1521
|
// src/components/imageGameIcon.tsx
|
|
1511
1522
|
import { Image } from "react-native";
|
|
1512
|
-
import { jsx as
|
|
1523
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
1513
1524
|
function imageGameIcon(images) {
|
|
1514
1525
|
return function ImageGameIcon({ size, dark }) {
|
|
1515
|
-
return /* @__PURE__ */
|
|
1526
|
+
return /* @__PURE__ */ jsx18(Image, { source: dark ? images.dark : images.light, style: { height: size, width: size }, accessibilityIgnoresInvertColors: true });
|
|
1516
1527
|
};
|
|
1517
1528
|
}
|
|
1518
1529
|
|
|
@@ -1522,14 +1533,14 @@ import { IconButton as IconButton2 } from "@rific/feedback-press";
|
|
|
1522
1533
|
import { useEffect as useEffect7 } from "react";
|
|
1523
1534
|
import { StyleSheet as StyleSheet6, useWindowDimensions as useWindowDimensions2 } from "react-native";
|
|
1524
1535
|
import Animated2, { useAnimatedStyle, useSharedValue, withTiming } from "react-native-reanimated";
|
|
1525
|
-
import { useSafeAreaInsets as
|
|
1526
|
-
import { Fragment as
|
|
1536
|
+
import { useSafeAreaInsets as useSafeAreaInsets5 } from "react-native-safe-area-context";
|
|
1537
|
+
import { Fragment as Fragment6, jsx as jsx19, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1527
1538
|
var MATCH_CHIPS_FADE_MS = 150;
|
|
1528
1539
|
var CHIP_SIZE = 48;
|
|
1529
1540
|
var EDGE_PAD = 8;
|
|
1530
1541
|
function MatchChips({ playing, faceToFace, centerLineY, onBack, onSettings }) {
|
|
1531
1542
|
const { height } = useWindowDimensions2();
|
|
1532
|
-
const insets =
|
|
1543
|
+
const insets = useSafeAreaInsets5();
|
|
1533
1544
|
const { dark } = useAutoPaperTheme6();
|
|
1534
1545
|
const atComputer = useAtComputer();
|
|
1535
1546
|
const visible = atComputer || !playing;
|
|
@@ -1545,9 +1556,9 @@ function MatchChips({ playing, faceToFace, centerLineY, onBack, onSettings }) {
|
|
|
1545
1556
|
const backSlot = { top, left: EDGE_PAD + insets.left };
|
|
1546
1557
|
const settingsSlot = { top, right: EDGE_PAD + insets.right };
|
|
1547
1558
|
const pointerEvents = visible ? "box-none" : "none";
|
|
1548
|
-
return /* @__PURE__ */ jsxs7(
|
|
1549
|
-
/* @__PURE__ */
|
|
1550
|
-
/* @__PURE__ */
|
|
1559
|
+
return /* @__PURE__ */ jsxs7(Fragment6, { children: [
|
|
1560
|
+
/* @__PURE__ */ jsx19(Animated2.View, { pointerEvents, style: [styles6.slot, backSlot, fadeStyle], testID: "match-chips-back", children: /* @__PURE__ */ jsx19(IconButton2, { icon: "arrow-left", iconColor, containerColor, style: styles6.chip, size: 24, onPress: onBack, accessibilityLabel: "Back" }) }),
|
|
1561
|
+
/* @__PURE__ */ jsx19(Animated2.View, { pointerEvents, style: [styles6.slot, settingsSlot, fadeStyle], testID: "match-chips-settings", children: /* @__PURE__ */ jsx19(IconButton2, { icon: "cog", iconColor, containerColor, style: styles6.chip, size: 24, onPress: onSettings, accessibilityLabel: "Settings" }) })
|
|
1551
1562
|
] });
|
|
1552
1563
|
}
|
|
1553
1564
|
var styles6 = StyleSheet6.create({
|
|
@@ -1559,11 +1570,29 @@ var styles6 = StyleSheet6.create({
|
|
|
1559
1570
|
import { useSelector as useSelector8 } from "react-redux";
|
|
1560
1571
|
function useActiveRound(game, defaults) {
|
|
1561
1572
|
const round = useSelector8((state) => state.liveplay.activeRound);
|
|
1562
|
-
const
|
|
1563
|
-
if (!round || round.game !== game) return { mode:
|
|
1573
|
+
const choices = usePackGame(game)?.seatTwo;
|
|
1574
|
+
if (!round || round.game !== game) return { mode: roundModeFor(seatTwoFor(DEFAULT_OPPONENT.seatTwo, choices)), settings: defaults };
|
|
1564
1575
|
return { mode: round.mode, settings: { ...defaults, ...round.settings } };
|
|
1565
1576
|
}
|
|
1566
1577
|
|
|
1578
|
+
// src/hooks/useBackBlock.ts
|
|
1579
|
+
import { usePreventRemove } from "expo-router";
|
|
1580
|
+
import { useCallback as useCallback11, useRef as useRef6, useState as useState8 } from "react";
|
|
1581
|
+
function useBackBlock(held, onHeld) {
|
|
1582
|
+
const leavingRef = useRef6(false);
|
|
1583
|
+
const [leaving, setLeaving] = useState8(false);
|
|
1584
|
+
usePreventRemove(held && !leaving, ({ repeat }) => {
|
|
1585
|
+
if (leavingRef.current) {
|
|
1586
|
+
setLeaving(true);
|
|
1587
|
+
repeat();
|
|
1588
|
+
} else onHeld();
|
|
1589
|
+
});
|
|
1590
|
+
return useCallback11(() => {
|
|
1591
|
+
leavingRef.current = true;
|
|
1592
|
+
safeBack();
|
|
1593
|
+
}, []);
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1567
1596
|
// src/redux/createPackStore.ts
|
|
1568
1597
|
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
1569
1598
|
import { combineReducers, configureStore } from "@reduxjs/toolkit";
|
|
@@ -1698,8 +1727,8 @@ function forgetProfileAchievements(dropStats) {
|
|
|
1698
1727
|
|
|
1699
1728
|
// src/gameStats.tsx
|
|
1700
1729
|
import { createAchievementsSlice, mapUnlocksBySeat, useAchievements } from "@tastic/achievements";
|
|
1701
|
-
import { createContext as createContext5, useCallback as
|
|
1702
|
-
import { jsx as
|
|
1730
|
+
import { createContext as createContext5, useCallback as useCallback12, useContext as useContext5, useMemo as useMemo8 } from "react";
|
|
1731
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
1703
1732
|
var SEATS = [1, 2];
|
|
1704
1733
|
function createGameStats({ key, defaultStats, isValidStats, catalog, getProfileStatsView }) {
|
|
1705
1734
|
const { actions: actions6, reducer: sliceReducer } = createAchievementsSlice({
|
|
@@ -1724,7 +1753,7 @@ function createGameStats({ key, defaultStats, isValidStats, catalog, getProfileS
|
|
|
1724
1753
|
actions: actions6,
|
|
1725
1754
|
profileViews
|
|
1726
1755
|
});
|
|
1727
|
-
const record =
|
|
1756
|
+
const record = useCallback12(
|
|
1728
1757
|
(update, profileIds) => {
|
|
1729
1758
|
const result = recordOutcome(update);
|
|
1730
1759
|
return { device: result.device, profiles: mapUnlocksBySeat(SEATS, profileIds, result.profiles) };
|
|
@@ -1732,7 +1761,7 @@ function createGameStats({ key, defaultStats, isValidStats, catalog, getProfileS
|
|
|
1732
1761
|
[recordOutcome]
|
|
1733
1762
|
);
|
|
1734
1763
|
const value = useMemo8(() => ({ stats, unlockedAchievements, record, resetAll }), [stats, unlockedAchievements, record, resetAll]);
|
|
1735
|
-
return /* @__PURE__ */
|
|
1764
|
+
return /* @__PURE__ */ jsx20(Context.Provider, { value, children });
|
|
1736
1765
|
}
|
|
1737
1766
|
function useStats() {
|
|
1738
1767
|
const ctx = useContext5(Context);
|
|
@@ -1743,7 +1772,7 @@ function createGameStats({ key, defaultStats, isValidStats, catalog, getProfileS
|
|
|
1743
1772
|
}
|
|
1744
1773
|
|
|
1745
1774
|
// src/playerSettings.ts
|
|
1746
|
-
import { useCallback as
|
|
1775
|
+
import { useCallback as useCallback13, useMemo as useMemo9 } from "react";
|
|
1747
1776
|
import { useDispatch as useDispatch11, useSelector as useSelector9 } from "react-redux";
|
|
1748
1777
|
var SEATS2 = [1, 2];
|
|
1749
1778
|
function seatPlayerKey(selection, seat) {
|
|
@@ -1788,7 +1817,7 @@ function createPlayerSettings({ id, defaults, distinctControls }) {
|
|
|
1788
1817
|
const controls = useSelector9((state) => state[controlsKey]);
|
|
1789
1818
|
const dispatch = useDispatch11();
|
|
1790
1819
|
const settings = useMemo9(() => compose(saved, controls, selection, seatTwoIsPerson), [saved, controls, selection, seatTwoIsPerson]);
|
|
1791
|
-
const setSettings =
|
|
1820
|
+
const setSettings = useCallback13(
|
|
1792
1821
|
(next) => {
|
|
1793
1822
|
const { controlScheme, ...changes } = next;
|
|
1794
1823
|
if (Object.keys(changes).length > 0) dispatch(patch(seatPlayerKey(selection, 1), changes));
|
|
@@ -1848,6 +1877,7 @@ export {
|
|
|
1848
1877
|
useActiveRound,
|
|
1849
1878
|
useAppSettings,
|
|
1850
1879
|
useAtComputer,
|
|
1880
|
+
useBackBlock,
|
|
1851
1881
|
useGameGuide,
|
|
1852
1882
|
useOpponent,
|
|
1853
1883
|
usePack,
|