@tastic/shell 0.8.1 → 0.8.3
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 +1 -1
- package/dist/index.js +168 -154
- package/dist/index.mjs +128 -114
- package/package.json +2 -2
- package/src/RootLayout.tsx +38 -35
- package/src/components/WindowControlsInsets.tsx +19 -0
- package/src/components/segmentTheme.ts +14 -0
- package/src/screens/HomeScreen.tsx +4 -3
- package/src/screens/StatsScreen.tsx +10 -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";
|
|
@@ -232,6 +232,16 @@ function UpdateDialog() {
|
|
|
232
232
|
return /* @__PURE__ */ jsx6(SharedUpdateDialog, { onError });
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
+
// src/components/WindowControlsInsets.tsx
|
|
236
|
+
import { Platform as Platform2 } from "react-native";
|
|
237
|
+
import { SafeAreaInsetsContext, useSafeAreaInsets } from "react-native-safe-area-context";
|
|
238
|
+
import { Fragment as Fragment3, jsx as jsx7 } from "react/jsx-runtime";
|
|
239
|
+
function WindowControlsInsets({ children }) {
|
|
240
|
+
const vertical = useSafeAreaInsets({ cornerAdaptation: "vertical" });
|
|
241
|
+
if (Platform2.OS !== "ios" || !Platform2.isPad) return /* @__PURE__ */ jsx7(Fragment3, { children });
|
|
242
|
+
return /* @__PURE__ */ jsx7(SafeAreaInsetsContext.Provider, { value: vertical, children });
|
|
243
|
+
}
|
|
244
|
+
|
|
235
245
|
// src/hooks/useLastActiveGame.tsx
|
|
236
246
|
import { createContext as createContext3, useContext as useContext3, useMemo as useMemo2, useRef as useRef2, useState as useState2 } from "react";
|
|
237
247
|
import { useDispatch as useDispatch4, useStore as useStore2 } from "react-redux";
|
|
@@ -243,7 +253,7 @@ var lastActiveGameActions = actions;
|
|
|
243
253
|
var lastActiveGameSlice_default = reducer;
|
|
244
254
|
|
|
245
255
|
// src/hooks/useLastActiveGame.tsx
|
|
246
|
-
import { jsx as
|
|
256
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
247
257
|
var LastActiveGameContext = createContext3(null);
|
|
248
258
|
function LastActiveGameProvider({ children }) {
|
|
249
259
|
const store = useStore2();
|
|
@@ -276,7 +286,7 @@ function LastActiveGameProvider({ children }) {
|
|
|
276
286
|
}),
|
|
277
287
|
[dispatch]
|
|
278
288
|
);
|
|
279
|
-
return /* @__PURE__ */
|
|
289
|
+
return /* @__PURE__ */ jsx8(LastActiveGameContext.Provider, { value, children });
|
|
280
290
|
}
|
|
281
291
|
function useLastActiveGame() {
|
|
282
292
|
const ctx = useContext3(LastActiveGameContext);
|
|
@@ -297,7 +307,7 @@ var profileSelectionActions = actions2;
|
|
|
297
307
|
var profileSelectionSlice_default = reducer2;
|
|
298
308
|
|
|
299
309
|
// src/hooks/useProfiles.tsx
|
|
300
|
-
import { jsx as
|
|
310
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
301
311
|
var SHARED_GROUP_ID = "group.com.infinitetoken.tastic";
|
|
302
312
|
var ProfilesContext = createContext4(null);
|
|
303
313
|
function ProfilesProvider({ children }) {
|
|
@@ -357,7 +367,7 @@ function ProfilesProvider({ children }) {
|
|
|
357
367
|
},
|
|
358
368
|
[dispatch]
|
|
359
369
|
);
|
|
360
|
-
return /* @__PURE__ */
|
|
370
|
+
return /* @__PURE__ */ jsx9(ProfilesContext.Provider, { value: { profiles, lastSelected, loaded, createProfile, updateProfile, deleteProfile, selectProfile }, children });
|
|
361
371
|
}
|
|
362
372
|
function useProfiles() {
|
|
363
373
|
const ctx = useContext4(ProfilesContext);
|
|
@@ -366,7 +376,7 @@ function useProfiles() {
|
|
|
366
376
|
}
|
|
367
377
|
|
|
368
378
|
// src/RootLayout.tsx
|
|
369
|
-
import { Fragment as
|
|
379
|
+
import { Fragment as Fragment4, jsx as jsx10, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
370
380
|
var PLAY_OPTIONS = { statusBarHidden: true };
|
|
371
381
|
var KEEP_STATUS_BAR_OPTIONS = {};
|
|
372
382
|
var TRANSPARENT_CONTENT = { backgroundColor: "transparent" };
|
|
@@ -379,7 +389,7 @@ function AppStack() {
|
|
|
379
389
|
const rootBackground = useThemedRootBackground(darkRoot, false);
|
|
380
390
|
const statusBarStyle = darkRoot ? "light" : "dark";
|
|
381
391
|
const packOptions = (pack.useScreenOptions ?? noScreenOptions)();
|
|
382
|
-
const backdropOptions = Backdrop ? { contentStyle: TRANSPARENT_CONTENT, animation:
|
|
392
|
+
const backdropOptions = Backdrop ? { contentStyle: TRANSPARENT_CONTENT, animation: Platform3.select({ android: "fade" }) } : void 0;
|
|
383
393
|
const playOptions = useCallback5(
|
|
384
394
|
({ route }) => {
|
|
385
395
|
const id = route.params?.game;
|
|
@@ -392,54 +402,54 @@ function AppStack() {
|
|
|
392
402
|
const base = darkRoot ? DarkTheme : DefaultTheme;
|
|
393
403
|
return { ...base, colors: { ...base.colors, background: navigationBackground } };
|
|
394
404
|
}, [darkRoot, navigationBackground]);
|
|
395
|
-
const stack = /* @__PURE__ */
|
|
396
|
-
/* @__PURE__ */
|
|
397
|
-
/* @__PURE__ */
|
|
405
|
+
const stack = /* @__PURE__ */ jsx10(NavigationThemeProvider, { value: navigationTheme, children: /* @__PURE__ */ jsxs2(Stack, { screenOptions: { ...rootBackground, statusBarStyle, ...backdropOptions, ...packOptions }, children: [
|
|
406
|
+
/* @__PURE__ */ jsx10(Stack.Screen, { name: "index" }),
|
|
407
|
+
/* @__PURE__ */ jsx10(Stack.Screen, { name: "play/[game]", options: playOptions })
|
|
398
408
|
] }) });
|
|
399
409
|
if (!Backdrop) return stack;
|
|
400
410
|
return /* @__PURE__ */ jsxs2(View, { style: styles.root, children: [
|
|
401
|
-
/* @__PURE__ */
|
|
411
|
+
/* @__PURE__ */ jsx10(Backdrop, {}),
|
|
402
412
|
stack
|
|
403
413
|
] });
|
|
404
414
|
}
|
|
405
415
|
function GatedApp({ children }) {
|
|
406
416
|
const { loaded } = useProfiles();
|
|
407
|
-
return /* @__PURE__ */
|
|
417
|
+
return /* @__PURE__ */ jsx10(SplashGate, { gate: "profiles", ready: loaded, children });
|
|
408
418
|
}
|
|
409
419
|
function HapticGatedToastProvider({ children }) {
|
|
410
420
|
const { settings } = useHapticSettings();
|
|
411
421
|
const { Toaster: PackToasterComponent } = usePack();
|
|
412
|
-
return /* @__PURE__ */
|
|
422
|
+
return /* @__PURE__ */ jsx10(ToastProvider, { haptics: settings.vibrate ? Haptics : void 0, paper: PackToasterComponent ? void 0 : RNPaper2, children });
|
|
413
423
|
}
|
|
414
424
|
function RotatingToaster() {
|
|
415
425
|
const renderFrame = useCallback5(
|
|
416
|
-
(toasts) => /* @__PURE__ */
|
|
426
|
+
(toasts) => /* @__PURE__ */ jsx10(RotatedFrame, { rotatedSafeArea: true, passThrough: true, children: toasts }),
|
|
417
427
|
[]
|
|
418
428
|
);
|
|
419
|
-
return /* @__PURE__ */
|
|
429
|
+
return /* @__PURE__ */ jsx10(Toaster, { historyButton: null, clearButton: null, limit: 3, renderFrame });
|
|
420
430
|
}
|
|
421
431
|
function PackToaster({ Toaster: PackToasterComponent }) {
|
|
422
|
-
return /* @__PURE__ */
|
|
432
|
+
return /* @__PURE__ */ jsx10(View, { style: StyleSheet.absoluteFill, pointerEvents: "box-none", children: /* @__PURE__ */ jsx10(RotatedFrame, { rotatedSafeArea: true, passThrough: true, children: /* @__PURE__ */ jsx10(PackToasterComponent, {}) }) });
|
|
423
433
|
}
|
|
424
434
|
function GameProviders({ games, children }) {
|
|
425
|
-
return games.reduceRight((inner, game) => game.Provider ? /* @__PURE__ */
|
|
435
|
+
return games.reduceRight((inner, game) => game.Provider ? /* @__PURE__ */ jsx10(game.Provider, { children: inner }, game.id) : inner, children);
|
|
426
436
|
}
|
|
427
437
|
function PreviewColors({ previewColor, children }) {
|
|
428
438
|
const { dark } = useAutoPaperTheme();
|
|
429
439
|
const preview = useCallback5((hex) => previewColor(hex, dark), [previewColor, dark]);
|
|
430
|
-
return /* @__PURE__ */
|
|
440
|
+
return /* @__PURE__ */ jsx10(ProfileColorProvider, { preview, children });
|
|
431
441
|
}
|
|
432
442
|
function PackRoot({ pack, children }) {
|
|
433
443
|
const { Provider, previewColor } = pack;
|
|
434
|
-
const inner = Provider ? /* @__PURE__ */
|
|
435
|
-
return previewColor ? /* @__PURE__ */
|
|
444
|
+
const inner = Provider ? /* @__PURE__ */ jsx10(Provider, { children }) : children;
|
|
445
|
+
return previewColor ? /* @__PURE__ */ jsx10(PreviewColors, { previewColor, children: inner }) : /* @__PURE__ */ jsx10(Fragment4, { children: inner });
|
|
436
446
|
}
|
|
437
447
|
function RootLayout({ pack, store, persistor }) {
|
|
438
|
-
return /* @__PURE__ */
|
|
439
|
-
/* @__PURE__ */
|
|
440
|
-
pack.Toaster ? /* @__PURE__ */
|
|
441
|
-
/* @__PURE__ */
|
|
442
|
-
] }) }) }) }) }) }) }) }) }) }) }) });
|
|
448
|
+
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: [
|
|
449
|
+
/* @__PURE__ */ jsx10(GuideHost, { children: /* @__PURE__ */ jsx10(AppStack, {}) }),
|
|
450
|
+
pack.Toaster ? /* @__PURE__ */ jsx10(PackToaster, { Toaster: pack.Toaster }) : /* @__PURE__ */ jsx10(RotatingToaster, {}),
|
|
451
|
+
/* @__PURE__ */ jsx10(UpdateDialog, {})
|
|
452
|
+
] }) }) }) }) }) }) }) }) }) }) }) }) });
|
|
443
453
|
}
|
|
444
454
|
var styles = StyleSheet.create({
|
|
445
455
|
root: { flex: 1 }
|
|
@@ -466,7 +476,7 @@ import { router as router2, useFocusEffect as useFocusEffect2 } from "expo-route
|
|
|
466
476
|
import { useCallback as useCallback9, useEffect as useEffect4, useMemo as useMemo5, useRef as useRef4, useState as useState4 } from "react";
|
|
467
477
|
import { StyleSheet as StyleSheet3, View as View3 } from "react-native";
|
|
468
478
|
import Animated from "react-native-reanimated";
|
|
469
|
-
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
479
|
+
import { useSafeAreaInsets as useSafeAreaInsets2 } from "react-native-safe-area-context";
|
|
470
480
|
import { useDispatch as useDispatch9 } from "react-redux";
|
|
471
481
|
|
|
472
482
|
// src/components/OpponentPicker.tsx
|
|
@@ -474,7 +484,7 @@ import { useZoneClampedAlign } from "@tastic/hud/lobby";
|
|
|
474
484
|
import { getOptionPickerContentSize, OptionPicker } from "@tastic/profile";
|
|
475
485
|
import { useMemo as useMemo4 } from "react";
|
|
476
486
|
import { StyleSheet as StyleSheet2, View as View2 } from "react-native";
|
|
477
|
-
import { jsx as
|
|
487
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
478
488
|
var CPU_PREFIX = "cpu:";
|
|
479
489
|
var NOBODY = "nobody";
|
|
480
490
|
var PERSON = "person";
|
|
@@ -509,7 +519,7 @@ function OpponentPicker({ idPrefix, host, choices, seatTwo, onSeatTwoChange, cpu
|
|
|
509
519
|
const size = getOptionPickerContentSize(options, colorSection);
|
|
510
520
|
const useAlign = usePickerAlign ?? useZoneClampedAlign;
|
|
511
521
|
const align = useAlign(host.openId === pickerId, size.width, size.height);
|
|
512
|
-
return /* @__PURE__ */
|
|
522
|
+
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
523
|
}
|
|
514
524
|
var styles2 = StyleSheet2.create({
|
|
515
525
|
// Its own column, so a row of seat buttons doesn't stretch the pill to the tallest of them.
|
|
@@ -557,7 +567,7 @@ function useAppSettings() {
|
|
|
557
567
|
}
|
|
558
568
|
|
|
559
569
|
// src/components/SettingsDialog.tsx
|
|
560
|
-
import { jsx as
|
|
570
|
+
import { jsx as jsx12, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
561
571
|
var noSettingsRules = () => null;
|
|
562
572
|
function SettingsDialog({ visible, onDismiss, onShowHowToPlay, children }) {
|
|
563
573
|
const onUpdateError = useUpdateErrorToast2();
|
|
@@ -567,16 +577,16 @@ function SettingsDialog({ visible, onDismiss, onShowHowToPlay, children }) {
|
|
|
567
577
|
const edgeGuardProps = edgeGuard ? { deferBottomEdgeGestures: settings.deferBottomEdgeGestures, onDeferBottomEdgeGestures: (value) => setSettings({ deferBottomEdgeGestures: value }) } : {};
|
|
568
578
|
return /* @__PURE__ */ jsxs3(BaseSettingsDialog, { visible, onDismiss, version: otaVersion, ...edgeGuardProps, onUpdateError, onShowHowToPlay, leading: rules, children: [
|
|
569
579
|
children,
|
|
570
|
-
SettingsSections && /* @__PURE__ */
|
|
580
|
+
SettingsSections && /* @__PURE__ */ jsx12(SettingsSections, {})
|
|
571
581
|
] });
|
|
572
582
|
}
|
|
573
583
|
|
|
574
584
|
// src/hooks/useAtComputer.ts
|
|
575
585
|
import { useIsTouchPrimaryDevice as useIsTouchPrimaryDevice2 } from "@tastic/core";
|
|
576
|
-
import { Platform as
|
|
586
|
+
import { Platform as Platform4 } from "react-native";
|
|
577
587
|
function useAtComputer() {
|
|
578
588
|
const touchPrimary = useIsTouchPrimaryDevice2();
|
|
579
|
-
return
|
|
589
|
+
return Platform4.OS === "web" && !touchPrimary;
|
|
580
590
|
}
|
|
581
591
|
|
|
582
592
|
// src/hooks/useOpponent.ts
|
|
@@ -732,7 +742,7 @@ var liveplayActions = actions5;
|
|
|
732
742
|
var liveplaySlice_default = reducer5;
|
|
733
743
|
|
|
734
744
|
// src/screens/LoadoutScreen.tsx
|
|
735
|
-
import { jsx as
|
|
745
|
+
import { jsx as jsx13, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
736
746
|
var PANEL_SWAP_FADE_MS = 180;
|
|
737
747
|
var P1_CONTROL_ID = "p1-control";
|
|
738
748
|
var P2_CONTROL_ID = "p2-control";
|
|
@@ -754,7 +764,7 @@ function LoadoutScreen({ game }) {
|
|
|
754
764
|
const { panelLayout, panelFadeStyle } = useDualZoneLayout(panelMode, false, true, false, PANEL_SWAP_FADE_MS);
|
|
755
765
|
const playersRowFade = panelFadeStyle;
|
|
756
766
|
const [settingsOpen, setSettingsOpen] = useState4(false);
|
|
757
|
-
const insets =
|
|
767
|
+
const insets = useSafeAreaInsets2();
|
|
758
768
|
const { colors: themeColors, dark } = useAutoPaperTheme3();
|
|
759
769
|
const { p1Color, p2Color, handleP1ColorChange, handleP2ColorChange } = useSeatColors(p2IsHuman);
|
|
760
770
|
const dispatch = useDispatch9();
|
|
@@ -811,11 +821,11 @@ function LoadoutScreen({ game }) {
|
|
|
811
821
|
onReset: showMetaInSharedBand ? void 0 : loadout.reset
|
|
812
822
|
});
|
|
813
823
|
const optionsPopoverOpen = controlsHost.openId !== null && loadout.optionIds.includes(controlsHost.openId);
|
|
814
|
-
const sharedControls = showMetaInSharedBand ? /* @__PURE__ */
|
|
824
|
+
const sharedControls = showMetaInSharedBand ? /* @__PURE__ */ jsx13(SharedActionBand, { onBack: safeBack, onSettings: () => setSettingsOpen(true), onRandomize: loadout.randomize, onReset: loadout.reset, fg, popoverOpen: optionsPopoverOpen, children: optionsRow }) : optionsRow;
|
|
815
825
|
const controlLook = { accentColor: themeColors.tertiary, mutedColor: fgMuted, dark };
|
|
816
826
|
const p1Control = loadout.seatControl(1, controlsHost, { ...controlLook, seatColor: p1Drawn });
|
|
817
|
-
const p1Panel = /* @__PURE__ */
|
|
818
|
-
const opponentPicker = game.seatTwo && /* @__PURE__ */
|
|
827
|
+
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}`);
|
|
828
|
+
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
829
|
const toggleP1Ready = () => setReady((r) => ({ ...r, 1: !r[1] }));
|
|
820
830
|
const seatOne = /* @__PURE__ */ jsxs4(View3, { style: [styles3.seatOne, !p2IsHuman && styles3.seatOneAlone, p1PickerOpen && styles3.raised], children: [
|
|
821
831
|
/* @__PURE__ */ jsxs4(View3, { style: [styles3.seatOneButtons, p1PickerOpen && styles3.raised], children: [
|
|
@@ -823,18 +833,18 @@ function LoadoutScreen({ game }) {
|
|
|
823
833
|
p1Panel,
|
|
824
834
|
opponentPicker
|
|
825
835
|
] }),
|
|
826
|
-
p1Control && /* @__PURE__ */
|
|
836
|
+
p1Control && /* @__PURE__ */ jsx13(View3, { style: [styles3.controlRow, p1ControlOpen && styles3.raised], children: p1Control })
|
|
827
837
|
] }),
|
|
828
|
-
/* @__PURE__ */
|
|
838
|
+
/* @__PURE__ */ jsx13(ReadyButton, { color: p1Drawn, ready: ready[1], onToggleReady: toggleP1Ready, surfaceColor: readySurface, dark, style: !p2IsHuman && p1PickerOpen && styles3.readyButtonHidden })
|
|
829
839
|
] });
|
|
830
840
|
const p2Control = p2IsHuman ? loadout.seatControl(2, p2Host, { ...controlLook, seatColor: p2Drawn }) : void 0;
|
|
831
|
-
const p2Panel = p2IsHuman && /* @__PURE__ */
|
|
841
|
+
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
842
|
return /* @__PURE__ */ jsxs4(View3, { style: [styles3.container, { backgroundColor: bg }], children: [
|
|
833
843
|
/* @__PURE__ */ jsxs4(View3, { style: styles3.frame, children: [
|
|
834
|
-
/* @__PURE__ */
|
|
835
|
-
p2ZoneStyle && /* @__PURE__ */
|
|
836
|
-
!showMetaInSharedBand && /* @__PURE__ */
|
|
837
|
-
p2IsHuman ? /* @__PURE__ */
|
|
844
|
+
/* @__PURE__ */ jsx13(PressAwayOverlay, { active: controlsHost.openId !== null, onPress: controlsHost.close }),
|
|
845
|
+
p2ZoneStyle && /* @__PURE__ */ jsx13(PressAwayOverlay, { active: controlsHost.openId !== null || p2Host.openId !== null, onPress: p2Host.close, style: p2ZoneStyle }),
|
|
846
|
+
!showMetaInSharedBand && /* @__PURE__ */ jsx13(CornerActionButtons, { onBack: safeBack, onSettings: () => setSettingsOpen(true), fg, insets }),
|
|
847
|
+
p2IsHuman ? /* @__PURE__ */ jsx13(
|
|
838
848
|
DualZoneLayout,
|
|
839
849
|
{
|
|
840
850
|
panelLayout,
|
|
@@ -851,7 +861,7 @@ function LoadoutScreen({ game }) {
|
|
|
851
861
|
seatOne
|
|
852
862
|
] })
|
|
853
863
|
] }),
|
|
854
|
-
/* @__PURE__ */
|
|
864
|
+
/* @__PURE__ */ jsx13(SettingsDialog, { visible: settingsOpen, onDismiss: () => setSettingsOpen(false), onShowHowToPlay: () => openFor(game.id) })
|
|
855
865
|
] });
|
|
856
866
|
}
|
|
857
867
|
function halfOf(color) {
|
|
@@ -932,13 +942,13 @@ var styles3 = StyleSheet3.create({
|
|
|
932
942
|
});
|
|
933
943
|
|
|
934
944
|
// src/screens/GameRoute.tsx
|
|
935
|
-
import { jsx as
|
|
945
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
936
946
|
function LoadoutRoute() {
|
|
937
947
|
const { game: id } = useLocalSearchParams();
|
|
938
948
|
const game = usePackGame(id);
|
|
939
|
-
if (!game) return /* @__PURE__ */
|
|
940
|
-
if (!hasLoadout(game)) return /* @__PURE__ */
|
|
941
|
-
return /* @__PURE__ */
|
|
949
|
+
if (!game) return /* @__PURE__ */ jsx14(Redirect, { href: "/" });
|
|
950
|
+
if (!hasLoadout(game)) return /* @__PURE__ */ jsx14(Redirect, { href: playHref(game.id) });
|
|
951
|
+
return /* @__PURE__ */ jsx14(LoadoutScreen, { game }, game.id);
|
|
942
952
|
}
|
|
943
953
|
function hasLoadout(game) {
|
|
944
954
|
return !!game.useLoadout;
|
|
@@ -947,9 +957,9 @@ function PlayRoute() {
|
|
|
947
957
|
const { game: id } = useLocalSearchParams();
|
|
948
958
|
const game = usePackGame(id);
|
|
949
959
|
useResumePoint(game?.resumable ? game.id : null);
|
|
950
|
-
if (!game) return /* @__PURE__ */
|
|
960
|
+
if (!game) return /* @__PURE__ */ jsx14(Redirect, { href: "/" });
|
|
951
961
|
const { PlayScreen } = game;
|
|
952
|
-
return /* @__PURE__ */
|
|
962
|
+
return /* @__PURE__ */ jsx14(PlayScreen, {}, game.id);
|
|
953
963
|
}
|
|
954
964
|
function useResumePoint(gameId) {
|
|
955
965
|
const { setLastActiveGame, clearLastActiveGame } = useLastActiveGame();
|
|
@@ -972,6 +982,10 @@ import { useCallback as useCallback10, useEffect as useEffect6, useMemo as useMe
|
|
|
972
982
|
import { AppState as AppState2, StyleSheet as StyleSheet4, View as View4 } from "react-native";
|
|
973
983
|
import { Icon, Portal, SegmentedButtons, Text } from "react-native-paper";
|
|
974
984
|
|
|
985
|
+
// src/components/segmentTheme.ts
|
|
986
|
+
var SEGMENT_THEME = { roundness: 3.8 };
|
|
987
|
+
var SEGMENT_RADIUS = 5 * SEGMENT_THEME.roundness;
|
|
988
|
+
|
|
975
989
|
// src/hooks/useFrozenWhileHidden.ts
|
|
976
990
|
import { useState as useState5 } from "react";
|
|
977
991
|
function useFrozenWhileHidden(value, hidden) {
|
|
@@ -991,7 +1005,7 @@ function useFrozenWhileHidden(value, hidden) {
|
|
|
991
1005
|
// src/screens/homeLayout.ts
|
|
992
1006
|
import { clamp } from "@tastic/core";
|
|
993
1007
|
import { useWindowDimensions } from "react-native";
|
|
994
|
-
import { useSafeAreaInsets as
|
|
1008
|
+
import { useSafeAreaInsets as useSafeAreaInsets3 } from "react-native-safe-area-context";
|
|
995
1009
|
var PREVIEW_ASPECT = 360 / 200;
|
|
996
1010
|
var ROW_PREVIEW_WIDTH = 92;
|
|
997
1011
|
var HOME_WIDE_EDGE_PADDING = 16;
|
|
@@ -1045,12 +1059,12 @@ function computeHomeLayout(windowWidth, windowHeight, insets) {
|
|
|
1045
1059
|
}
|
|
1046
1060
|
function useHomeLayout() {
|
|
1047
1061
|
const { width, height } = useWindowDimensions();
|
|
1048
|
-
const insets =
|
|
1062
|
+
const insets = useSafeAreaInsets3();
|
|
1049
1063
|
return computeHomeLayout(width, height, insets);
|
|
1050
1064
|
}
|
|
1051
1065
|
|
|
1052
1066
|
// src/screens/HomeScreen.tsx
|
|
1053
|
-
import { Fragment as
|
|
1067
|
+
import { Fragment as Fragment5, jsx as jsx15, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1054
1068
|
function HomeScreen() {
|
|
1055
1069
|
const pack = usePack();
|
|
1056
1070
|
const { consumeResumeGame } = useLastActiveGame();
|
|
@@ -1062,8 +1076,8 @@ function HomeScreen() {
|
|
|
1062
1076
|
useEffect6(() => {
|
|
1063
1077
|
if (!resumeGame) autoShowPack();
|
|
1064
1078
|
}, [resumeGame, autoShowPack]);
|
|
1065
|
-
if (resumeGame) return /* @__PURE__ */
|
|
1066
|
-
return /* @__PURE__ */
|
|
1079
|
+
if (resumeGame) return /* @__PURE__ */ jsx15(Redirect2, { href: playHref(resumeGame.id) });
|
|
1080
|
+
return /* @__PURE__ */ jsx15(HomeMenu, {});
|
|
1067
1081
|
}
|
|
1068
1082
|
function HomeMenu() {
|
|
1069
1083
|
const pack = usePack();
|
|
@@ -1106,7 +1120,7 @@ function HomeMenu() {
|
|
|
1106
1120
|
const [tabLabel, setTabLabel] = useState6(() => tabs?.[0].label ?? null);
|
|
1107
1121
|
const tab = tabs ? tabs.find((t) => t.label === tabLabel) ?? tabs[0] : null;
|
|
1108
1122
|
const tabButtons = useMemo6(() => tabs?.map(({ label }) => ({ value: label, label })) ?? [], [tabs]);
|
|
1109
|
-
const tabBar = tab && /* @__PURE__ */
|
|
1123
|
+
const tabBar = tab && /* @__PURE__ */ jsx15(SegmentedButtons, { value: tab.label, onValueChange: setTabLabel, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles4.tabs, pack.Backdrop && { backgroundColor: colors.surface }] });
|
|
1110
1124
|
const columnClamp = useClampOnShrink();
|
|
1111
1125
|
const gridClamp = useClampOnShrink();
|
|
1112
1126
|
const openGame = useCallback10((game) => openFirstTime(game.id, () => router3.push(game.useLoadout ? loadoutHref(game.id) : playHref(game.id))), [openFirstTime]);
|
|
@@ -1115,33 +1129,33 @@ function HomeMenu() {
|
|
|
1115
1129
|
const usePickerAlign = pack.usePickerAlign ?? noPickerAlign;
|
|
1116
1130
|
const pickerSize = getProfilePickerContentSize(profiles.length, true, colorSection);
|
|
1117
1131
|
const pickerAlign = usePickerAlign(pickerHost.openId === `${SEAT_ONE_PICKER}-profile`, pickerSize.width, pickerSize.height);
|
|
1118
|
-
const picker = /* @__PURE__ */
|
|
1119
|
-
const pressAway = /* @__PURE__ */
|
|
1132
|
+
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 });
|
|
1133
|
+
const pressAway = /* @__PURE__ */ jsx15(PressAwayOverlay2, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles4.pressAway });
|
|
1120
1134
|
const RulesSheet = rulesGame?.Rules;
|
|
1121
1135
|
return /* @__PURE__ */ jsxs5(View4, { style: [styles4.container, { backgroundColor: bg }], children: [
|
|
1122
|
-
/* @__PURE__ */
|
|
1123
|
-
isWide ? /* @__PURE__ */ jsxs5(
|
|
1136
|
+
/* @__PURE__ */ jsx15(View4, { style: styles4.frame, children: /* @__PURE__ */ jsxs5(RulesHost, { enabled: pack.games.some((game) => game.Rules), children: [
|
|
1137
|
+
isWide ? /* @__PURE__ */ jsxs5(Fragment5, { children: [
|
|
1124
1138
|
pressAway,
|
|
1125
1139
|
/* @__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: [
|
|
1126
|
-
tabBar && /* @__PURE__ */
|
|
1127
|
-
/* @__PURE__ */
|
|
1140
|
+
tabBar && /* @__PURE__ */ jsx15(View4, { style: [styles4.wideTabs, { width: layout.rightPaneWidth }], children: tabBar }),
|
|
1141
|
+
/* @__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)) })
|
|
1128
1142
|
] }),
|
|
1129
1143
|
/* @__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: [
|
|
1130
|
-
/* @__PURE__ */
|
|
1131
|
-
/* @__PURE__ */
|
|
1144
|
+
/* @__PURE__ */ jsx15(pack.HeroTitle, { words: pack.wordmark, color: fg, p1Color, p2Color, active: heroActive, fit: layout.heroFit }),
|
|
1145
|
+
/* @__PURE__ */ jsx15(View4, { style: styles4.widePicker, children: picker })
|
|
1132
1146
|
] })
|
|
1133
1147
|
] }) : /* @__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: [
|
|
1134
1148
|
pressAway,
|
|
1135
|
-
/* @__PURE__ */
|
|
1136
|
-
/* @__PURE__ */
|
|
1137
|
-
tabBar && /* @__PURE__ */
|
|
1138
|
-
/* @__PURE__ */
|
|
1149
|
+
/* @__PURE__ */ jsx15(pack.HeroTitle, { words: pack.wordmark, color: fg, p1Color, p2Color, active: heroActive }),
|
|
1150
|
+
/* @__PURE__ */ jsx15(View4, { style: [styles4.picker, pickerHost.openId !== null && styles4.pickerOpen], children: picker }),
|
|
1151
|
+
tabBar && /* @__PURE__ */ jsx15(View4, { style: styles4.listWidth, children: tabBar }),
|
|
1152
|
+
/* @__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)) })
|
|
1139
1153
|
] }),
|
|
1140
|
-
/* @__PURE__ */
|
|
1141
|
-
/* @__PURE__ */
|
|
1142
|
-
RulesSheet && /* @__PURE__ */
|
|
1154
|
+
/* @__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" }),
|
|
1155
|
+
/* @__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" }),
|
|
1156
|
+
RulesSheet && /* @__PURE__ */ jsx15(RulesSheet, { visible: true, onDismiss: () => setRulesGame(null) })
|
|
1143
1157
|
] }) }),
|
|
1144
|
-
/* @__PURE__ */
|
|
1158
|
+
/* @__PURE__ */ jsx15(SettingsDialog, { visible: settingsOpen, onDismiss: () => setSettingsOpen(false), onShowHowToPlay: pack.guide ? openPack : void 0 })
|
|
1145
1159
|
] });
|
|
1146
1160
|
}
|
|
1147
1161
|
var SEAT_ONE_PICKER = "home-p1";
|
|
@@ -1178,7 +1192,7 @@ function hasRules(game) {
|
|
|
1178
1192
|
return !!(game.Rules || game.guide);
|
|
1179
1193
|
}
|
|
1180
1194
|
function RulesHost({ enabled, children }) {
|
|
1181
|
-
return enabled ? /* @__PURE__ */
|
|
1195
|
+
return enabled ? /* @__PURE__ */ jsx15(Portal.Host, { children }) : /* @__PURE__ */ jsx15(Fragment5, { children });
|
|
1182
1196
|
}
|
|
1183
1197
|
var ROW_BLURB_LINES = 3;
|
|
1184
1198
|
function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPress, onRules }) {
|
|
@@ -1189,13 +1203,13 @@ function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPres
|
|
|
1189
1203
|
// inside a button is invalid on the web.
|
|
1190
1204
|
/* @__PURE__ */ jsxs5(View4, { style: hidden ? styles4.hidden : void 0, children: [
|
|
1191
1205
|
/* @__PURE__ */ jsxs5(Pressable, { onPress, style: [styles4.row, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
|
|
1192
|
-
game.Preview ? /* @__PURE__ */
|
|
1206
|
+
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 }) }),
|
|
1193
1207
|
/* @__PURE__ */ jsxs5(View4, { style: styles4.rowText, children: [
|
|
1194
|
-
/* @__PURE__ */
|
|
1195
|
-
/* @__PURE__ */
|
|
1208
|
+
/* @__PURE__ */ jsx15(Text, { variant: "titleLarge", style: [styles4.rowTitle, { color: well.fg }], numberOfLines: 1, children: game.title }),
|
|
1209
|
+
/* @__PURE__ */ jsx15(Text, { variant: "bodyMedium", style: { color: well.fgMuted }, numberOfLines: ROW_BLURB_LINES, children: game.blurb })
|
|
1196
1210
|
] })
|
|
1197
1211
|
] }),
|
|
1198
|
-
onRules && /* @__PURE__ */
|
|
1212
|
+
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 }) })
|
|
1199
1213
|
] })
|
|
1200
1214
|
);
|
|
1201
1215
|
}
|
|
@@ -1203,18 +1217,18 @@ function GameTile({ game, hidden, width, previewWidth, dark, p1Color, p2Color, p
|
|
|
1203
1217
|
const well = useWellColors();
|
|
1204
1218
|
return /* @__PURE__ */ jsxs5(View4, { style: [{ width }, hidden && styles4.hidden], children: [
|
|
1205
1219
|
/* @__PURE__ */ jsxs5(Pressable, { onPress, style: [styles4.tile, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
|
|
1206
|
-
/* @__PURE__ */
|
|
1207
|
-
/* @__PURE__ */
|
|
1208
|
-
/* @__PURE__ */
|
|
1220
|
+
/* @__PURE__ */ jsx15(PreviewBox, { game, width: previewWidth, revealed: previewRevealed, dark, p1Color, p2Color }),
|
|
1221
|
+
/* @__PURE__ */ jsx15(Text, { variant: "titleMedium", style: [styles4.rowTitle, { color: well.fg }], numberOfLines: 1, children: game.title }),
|
|
1222
|
+
/* @__PURE__ */ jsx15(Text, { variant: "bodySmall", style: { color: well.fgMuted }, numberOfLines: 3, children: game.blurb })
|
|
1209
1223
|
] }),
|
|
1210
|
-
onRules && /* @__PURE__ */
|
|
1224
|
+
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" }) })
|
|
1211
1225
|
] });
|
|
1212
1226
|
}
|
|
1213
1227
|
function PreviewBox({ game, width, revealed, dark, p1Color, p2Color }) {
|
|
1214
1228
|
const height = Math.round(width / PREVIEW_ASPECT);
|
|
1215
1229
|
const { Preview, icon: GameIcon } = game;
|
|
1216
1230
|
const iconSize = Math.min(height, ROW_ICON_SIZE);
|
|
1217
|
-
return /* @__PURE__ */
|
|
1231
|
+
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 }) }) });
|
|
1218
1232
|
}
|
|
1219
1233
|
var ROW_ICON_SIZE = 56;
|
|
1220
1234
|
var ICON_LIGHT_BG = "#FAFAFA";
|
|
@@ -1314,9 +1328,9 @@ var styles4 = StyleSheet4.create({
|
|
|
1314
1328
|
scroll: {
|
|
1315
1329
|
flex: 1
|
|
1316
1330
|
},
|
|
1317
|
-
// SegmentedButtons' own rounding, so a surface behind it is the same pill (the stats screen's tabs).
|
|
1331
|
+
// SegmentedButtons' own rounding (SEGMENT_THEME's), so a surface behind it is the same pill (the stats screen's tabs).
|
|
1318
1332
|
tabs: {
|
|
1319
|
-
borderRadius:
|
|
1333
|
+
borderRadius: SEGMENT_RADIUS
|
|
1320
1334
|
},
|
|
1321
1335
|
// The same well as a row, turned on its side.
|
|
1322
1336
|
tile: {
|
|
@@ -1367,7 +1381,7 @@ var styles4 = StyleSheet4.create({
|
|
|
1367
1381
|
import { defaultColors as defaultColors3 } from "@rific/auto-paper";
|
|
1368
1382
|
import { RotatedFrame as RotatedFrame2 } from "@tastic/hud/chrome";
|
|
1369
1383
|
import { ProfilesScreen } from "@tastic/profile";
|
|
1370
|
-
import { jsx as
|
|
1384
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1371
1385
|
var ROSTER_MAX_WIDTH = 640;
|
|
1372
1386
|
function useRosterAlign(open, contentWidth, contentHeight) {
|
|
1373
1387
|
const { usePickerAlign } = usePack();
|
|
@@ -1376,7 +1390,7 @@ function useRosterAlign(open, contentWidth, contentHeight) {
|
|
|
1376
1390
|
function ProfilesRoute() {
|
|
1377
1391
|
const { profiles, createProfile, updateProfile, deleteProfile } = useProfiles();
|
|
1378
1392
|
const { Backdrop, foreground, newProfileColor, usePickerAlign } = usePack();
|
|
1379
|
-
return /* @__PURE__ */
|
|
1393
|
+
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 }) });
|
|
1380
1394
|
}
|
|
1381
1395
|
|
|
1382
1396
|
// src/screens/StatsScreen.tsx
|
|
@@ -1386,16 +1400,16 @@ import { getOptionPickerContentSize as getOptionPickerContentSize2, OptionPicker
|
|
|
1386
1400
|
import { useMemo as useMemo7, useState as useState7 } from "react";
|
|
1387
1401
|
import { StyleSheet as StyleSheet5, View as View5 } from "react-native";
|
|
1388
1402
|
import { SegmentedButtons as SegmentedButtons2, Text as Text2 } from "react-native-paper";
|
|
1389
|
-
import { useSafeAreaInsets as
|
|
1403
|
+
import { useSafeAreaInsets as useSafeAreaInsets4 } from "react-native-safe-area-context";
|
|
1390
1404
|
import { useDispatch as useDispatch10 } from "react-redux";
|
|
1391
|
-
import { jsx as
|
|
1405
|
+
import { jsx as jsx17, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1392
1406
|
var STATS = "stats";
|
|
1393
1407
|
var ACHIEVEMENTS = "achievements";
|
|
1394
1408
|
var TABS = [
|
|
1395
1409
|
{ value: STATS, label: "Stats", icon: "chart-box-outline" },
|
|
1396
1410
|
{ value: ACHIEVEMENTS, label: "Achievements", icon: "trophy-outline" }
|
|
1397
1411
|
];
|
|
1398
|
-
var LABEL_WIDE_TAB = { flexBasis: "auto", flexGrow: 1, flexShrink: 1 };
|
|
1412
|
+
var LABEL_WIDE_TAB = { flex: 0, flexBasis: "auto", flexGrow: 1, flexShrink: 1 };
|
|
1399
1413
|
var NO_PACK_TABS = [];
|
|
1400
1414
|
var EVERYONE = "__everyone__";
|
|
1401
1415
|
var ALL_GAMES = "__all__";
|
|
@@ -1404,17 +1418,17 @@ var GAME_PICKER_ID = "stats-game";
|
|
|
1404
1418
|
var STATS_MAX_WIDTH = 640;
|
|
1405
1419
|
function StatsScreen() {
|
|
1406
1420
|
const pickerHost = usePopoverHost3();
|
|
1407
|
-
return /* @__PURE__ */
|
|
1421
|
+
return /* @__PURE__ */ jsx17(StatsPressAway, { host: pickerHost, children: /* @__PURE__ */ jsx17(RotatedFrame3, { rotatedSafeArea: true, portalHost: true, maxContentWidth: STATS_MAX_WIDTH, children: /* @__PURE__ */ jsx17(StatsContent, { pickerHost }) }) });
|
|
1408
1422
|
}
|
|
1409
1423
|
function StatsPressAway({ host, children }) {
|
|
1410
|
-
return /* @__PURE__ */
|
|
1424
|
+
return /* @__PURE__ */ jsx17(View5, { testID: "stats-press-away", style: styles5.screen, onStartShouldSetResponder: () => host.openId !== null, onResponderRelease: host.close, children });
|
|
1411
1425
|
}
|
|
1412
1426
|
var useNoPackReset = () => null;
|
|
1413
1427
|
var noPickerAlign2 = () => void 0;
|
|
1414
1428
|
function StatsContent({ pickerHost }) {
|
|
1415
1429
|
const pack = usePack();
|
|
1416
1430
|
const { dark, colors } = useAutoPaperTheme5();
|
|
1417
|
-
const insets =
|
|
1431
|
+
const insets = useSafeAreaInsets4();
|
|
1418
1432
|
const { profiles, lastSelected } = useProfiles();
|
|
1419
1433
|
const dispatch = useDispatch10();
|
|
1420
1434
|
const fg = pack.foreground ?? colors.onBackground;
|
|
@@ -1442,15 +1456,15 @@ function StatsContent({ pickerHost }) {
|
|
|
1442
1456
|
const triggerStyle = pack.Backdrop ? [styles5.pill, surface] : void 0;
|
|
1443
1457
|
const PackTabContent = packTab?.Content;
|
|
1444
1458
|
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: [
|
|
1445
|
-
/* @__PURE__ */
|
|
1446
|
-
/* @__PURE__ */
|
|
1459
|
+
/* @__PURE__ */ jsx17(PressAwayOverlay3, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles5.pressAway }),
|
|
1460
|
+
/* @__PURE__ */ jsx17(SegmentedButtons2, { value: tab, onValueChange: setTab, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles5.tabs, surface] }),
|
|
1447
1461
|
/* @__PURE__ */ jsxs6(View5, { style: [styles5.filters, pickerHost.openId !== null && styles5.filtersOpen], onStartShouldSetResponder: () => pickerHost.openId !== null, children: [
|
|
1448
|
-
profiles.length > 0 && /* @__PURE__ */
|
|
1449
|
-
showGamePicker && /* @__PURE__ */
|
|
1462
|
+
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 }),
|
|
1463
|
+
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 })
|
|
1450
1464
|
] }),
|
|
1451
|
-
tab === STATS && pack.StatsSections && /* @__PURE__ */
|
|
1452
|
-
PackTabContent && /* @__PURE__ */
|
|
1453
|
-
tab === ACHIEVEMENTS && pack.AchievementList ? /* @__PURE__ */
|
|
1465
|
+
tab === STATS && pack.StatsSections && /* @__PURE__ */ jsx17(pack.StatsSections, { profileId, gameId: gameId === ALL_GAMES ? null : gameId }),
|
|
1466
|
+
PackTabContent && /* @__PURE__ */ jsx17(PackTabContent, { profileId, gameId: gameId === ALL_GAMES ? null : gameId }),
|
|
1467
|
+
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))
|
|
1454
1468
|
] });
|
|
1455
1469
|
}
|
|
1456
1470
|
function resetFor(pack, packReset, profileId, profiles, games, resetGames) {
|
|
@@ -1466,8 +1480,8 @@ function GameStats({ game, tab, profileId, showTitle, titleColor }) {
|
|
|
1466
1480
|
const Sections = tab === STATS ? StatsSections : AchievementList;
|
|
1467
1481
|
if (!Sections) return null;
|
|
1468
1482
|
return /* @__PURE__ */ jsxs6(View5, { style: styles5.game, children: [
|
|
1469
|
-
showTitle && /* @__PURE__ */
|
|
1470
|
-
/* @__PURE__ */
|
|
1483
|
+
showTitle && /* @__PURE__ */ jsx17(Text2, { variant: "titleLarge", style: [styles5.gameTitle, { color: titleColor }], children: game.title }),
|
|
1484
|
+
/* @__PURE__ */ jsx17(Sections, { profileId })
|
|
1471
1485
|
] });
|
|
1472
1486
|
}
|
|
1473
1487
|
var styles5 = StyleSheet5.create({
|
|
@@ -1497,18 +1511,18 @@ var styles5 = StyleSheet5.create({
|
|
|
1497
1511
|
screen: {
|
|
1498
1512
|
flex: 1
|
|
1499
1513
|
},
|
|
1500
|
-
// SegmentedButtons' own rounding, so a surface behind it is the same pill.
|
|
1514
|
+
// SegmentedButtons' own rounding (SEGMENT_THEME's), so a surface behind it is the same pill.
|
|
1501
1515
|
tabs: {
|
|
1502
|
-
borderRadius:
|
|
1516
|
+
borderRadius: SEGMENT_RADIUS
|
|
1503
1517
|
}
|
|
1504
1518
|
});
|
|
1505
1519
|
|
|
1506
1520
|
// src/components/imageGameIcon.tsx
|
|
1507
1521
|
import { Image } from "react-native";
|
|
1508
|
-
import { jsx as
|
|
1522
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
1509
1523
|
function imageGameIcon(images) {
|
|
1510
1524
|
return function ImageGameIcon({ size, dark }) {
|
|
1511
|
-
return /* @__PURE__ */
|
|
1525
|
+
return /* @__PURE__ */ jsx18(Image, { source: dark ? images.dark : images.light, style: { height: size, width: size }, accessibilityIgnoresInvertColors: true });
|
|
1512
1526
|
};
|
|
1513
1527
|
}
|
|
1514
1528
|
|
|
@@ -1518,14 +1532,14 @@ import { IconButton as IconButton2 } from "@rific/feedback-press";
|
|
|
1518
1532
|
import { useEffect as useEffect7 } from "react";
|
|
1519
1533
|
import { StyleSheet as StyleSheet6, useWindowDimensions as useWindowDimensions2 } from "react-native";
|
|
1520
1534
|
import Animated2, { useAnimatedStyle, useSharedValue, withTiming } from "react-native-reanimated";
|
|
1521
|
-
import { useSafeAreaInsets as
|
|
1522
|
-
import { Fragment as
|
|
1535
|
+
import { useSafeAreaInsets as useSafeAreaInsets5 } from "react-native-safe-area-context";
|
|
1536
|
+
import { Fragment as Fragment6, jsx as jsx19, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1523
1537
|
var MATCH_CHIPS_FADE_MS = 150;
|
|
1524
1538
|
var CHIP_SIZE = 48;
|
|
1525
1539
|
var EDGE_PAD = 8;
|
|
1526
1540
|
function MatchChips({ playing, faceToFace, centerLineY, onBack, onSettings }) {
|
|
1527
1541
|
const { height } = useWindowDimensions2();
|
|
1528
|
-
const insets =
|
|
1542
|
+
const insets = useSafeAreaInsets5();
|
|
1529
1543
|
const { dark } = useAutoPaperTheme6();
|
|
1530
1544
|
const atComputer = useAtComputer();
|
|
1531
1545
|
const visible = atComputer || !playing;
|
|
@@ -1541,9 +1555,9 @@ function MatchChips({ playing, faceToFace, centerLineY, onBack, onSettings }) {
|
|
|
1541
1555
|
const backSlot = { top, left: EDGE_PAD + insets.left };
|
|
1542
1556
|
const settingsSlot = { top, right: EDGE_PAD + insets.right };
|
|
1543
1557
|
const pointerEvents = visible ? "box-none" : "none";
|
|
1544
|
-
return /* @__PURE__ */ jsxs7(
|
|
1545
|
-
/* @__PURE__ */
|
|
1546
|
-
/* @__PURE__ */
|
|
1558
|
+
return /* @__PURE__ */ jsxs7(Fragment6, { children: [
|
|
1559
|
+
/* @__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" }) }),
|
|
1560
|
+
/* @__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" }) })
|
|
1547
1561
|
] });
|
|
1548
1562
|
}
|
|
1549
1563
|
var styles6 = StyleSheet6.create({
|
|
@@ -1695,7 +1709,7 @@ function forgetProfileAchievements(dropStats) {
|
|
|
1695
1709
|
// src/gameStats.tsx
|
|
1696
1710
|
import { createAchievementsSlice, mapUnlocksBySeat, useAchievements } from "@tastic/achievements";
|
|
1697
1711
|
import { createContext as createContext5, useCallback as useCallback11, useContext as useContext5, useMemo as useMemo8 } from "react";
|
|
1698
|
-
import { jsx as
|
|
1712
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
1699
1713
|
var SEATS = [1, 2];
|
|
1700
1714
|
function createGameStats({ key, defaultStats, isValidStats, catalog, getProfileStatsView }) {
|
|
1701
1715
|
const { actions: actions6, reducer: sliceReducer } = createAchievementsSlice({
|
|
@@ -1728,7 +1742,7 @@ function createGameStats({ key, defaultStats, isValidStats, catalog, getProfileS
|
|
|
1728
1742
|
[recordOutcome]
|
|
1729
1743
|
);
|
|
1730
1744
|
const value = useMemo8(() => ({ stats, unlockedAchievements, record, resetAll }), [stats, unlockedAchievements, record, resetAll]);
|
|
1731
|
-
return /* @__PURE__ */
|
|
1745
|
+
return /* @__PURE__ */ jsx20(Context.Provider, { value, children });
|
|
1732
1746
|
}
|
|
1733
1747
|
function useStats() {
|
|
1734
1748
|
const ctx = useContext5(Context);
|