@tastic/shell 0.14.0 → 0.16.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 +13 -9
- package/dist/index.d.mts +11 -7
- package/dist/index.d.ts +11 -7
- package/dist/index.js +197 -177
- package/dist/index.mjs +129 -110
- package/package.json +5 -5
- package/src/RootLayout.tsx +1 -1
- package/src/components/SettingsDialog.tsx +13 -2
- package/src/index.ts +1 -0
- package/src/routes.ts +3 -1
- package/src/screens/EditProfileRoute.tsx +31 -0
- package/src/screens/HomeScreen.tsx +1 -1
- package/src/screens/LoadoutScreen.tsx +1 -1
- package/src/screens/ProfilesRoute.tsx +16 -24
- package/src/types.ts +13 -8
package/dist/index.mjs
CHANGED
|
@@ -459,7 +459,7 @@ function HapticGatedToastProvider({ children }) {
|
|
|
459
459
|
}
|
|
460
460
|
function FramedToaster() {
|
|
461
461
|
const renderFrame = useCallback6((toasts) => /* @__PURE__ */ jsx10(ScreenFrame, { passThrough: true, children: toasts }), []);
|
|
462
|
-
return /* @__PURE__ */ jsx10(Toaster, { historyButton: null, clearButton: null, limit:
|
|
462
|
+
return /* @__PURE__ */ jsx10(Toaster, { historyButton: null, clearButton: null, limit: 1, renderFrame });
|
|
463
463
|
}
|
|
464
464
|
function PackToaster({ Toaster: PackToasterComponent }) {
|
|
465
465
|
return /* @__PURE__ */ jsx10(View, { style: StyleSheet.absoluteFill, pointerEvents: "box-none", children: /* @__PURE__ */ jsx10(ScreenFrame, { passThrough: true, children: /* @__PURE__ */ jsx10(PackToasterComponent, {}) }) });
|
|
@@ -494,24 +494,59 @@ var styles = StyleSheet.create({
|
|
|
494
494
|
root: { flex: 1 }
|
|
495
495
|
});
|
|
496
496
|
|
|
497
|
-
// src/screens/
|
|
498
|
-
import {
|
|
499
|
-
import {
|
|
500
|
-
import {
|
|
497
|
+
// src/screens/EditProfileRoute.tsx
|
|
498
|
+
import { defaultColors } from "@rific/auto-paper";
|
|
499
|
+
import { ScreenFrame as ScreenFrame3 } from "@tastic/hud/chrome";
|
|
500
|
+
import { EditProfileScreen } from "@tastic/profile";
|
|
501
|
+
import { useLocalSearchParams } from "expo-router";
|
|
502
|
+
|
|
503
|
+
// src/navigation.ts
|
|
504
|
+
import { configureNavigation, safeBack } from "@rific/core";
|
|
505
|
+
import { router } from "expo-router";
|
|
506
|
+
configureNavigation({ router });
|
|
507
|
+
|
|
508
|
+
// src/screens/ProfilesRoute.tsx
|
|
509
|
+
import { ScreenFrame as ScreenFrame2 } from "@tastic/hud/chrome";
|
|
510
|
+
import { ProfilesScreen } from "@tastic/profile";
|
|
511
|
+
import { router as router2 } from "expo-router";
|
|
501
512
|
|
|
502
513
|
// src/routes.ts
|
|
503
514
|
var playHref = (game) => ({ pathname: "/play/[game]", params: { game } });
|
|
504
515
|
var loadoutHref = (game) => ({ pathname: "/loadout/[game]", params: { game } });
|
|
505
516
|
var STATS_HREF = "/stats";
|
|
506
517
|
var PROFILES_HREF = "/profiles";
|
|
518
|
+
var profileHref = (id) => ({ pathname: "/profile/[id]", params: { id } });
|
|
519
|
+
|
|
520
|
+
// src/screens/ProfilesRoute.tsx
|
|
521
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
522
|
+
var ROSTER_MAX_WIDTH = 640;
|
|
523
|
+
function ProfilesRoute() {
|
|
524
|
+
const { profiles } = useProfiles();
|
|
525
|
+
const { Backdrop, foreground } = usePack();
|
|
526
|
+
return /* @__PURE__ */ jsx11(ScreenFrame2, { maxContentWidth: ROSTER_MAX_WIDTH, children: /* @__PURE__ */ jsx11(ProfilesScreen, { profiles, onEdit: (id) => router2.push(profileHref(id)), onBack: safeBack, fg: foreground, bg: Backdrop ? "transparent" : void 0 }) });
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
// src/screens/EditProfileRoute.tsx
|
|
530
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
531
|
+
function EditProfileRoute() {
|
|
532
|
+
const { id } = useLocalSearchParams();
|
|
533
|
+
const { profiles, createProfile, updateProfile, deleteProfile } = useProfiles();
|
|
534
|
+
const { Backdrop, foreground, newProfileColor, ProfileSections } = usePack();
|
|
535
|
+
return /* @__PURE__ */ jsx12(ScreenFrame3, { portalHost: true, maxContentWidth: ROSTER_MAX_WIDTH, children: /* @__PURE__ */ jsx12(EditProfileScreen, { profileId: id, profiles, defaultColor: newProfileColor ?? defaultColors[0].value, onCreate: (patch) => createProfile(patch), onSave: (profileId, patch) => updateProfile(profileId, patch), onDelete: deleteProfile, onBack: safeBack, fg: foreground, bg: Backdrop ? "transparent" : void 0, sections: ProfileSections ? (profile) => /* @__PURE__ */ jsx12(ProfileSections, { profile }) : void 0 }) });
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
// src/screens/GameRoute.tsx
|
|
539
|
+
import { Redirect, useLocalSearchParams as useLocalSearchParams2 } from "expo-router";
|
|
540
|
+
import { useEffect as useEffect5 } from "react";
|
|
541
|
+
import { AppState } from "react-native";
|
|
507
542
|
|
|
508
543
|
// src/screens/LoadoutScreen.tsx
|
|
509
|
-
import { defaultColors, getRgb, useAutoPaperTheme as useAutoPaperTheme3 } from "@rific/auto-paper";
|
|
544
|
+
import { defaultColors as defaultColors2, getRgb, useAutoPaperTheme as useAutoPaperTheme3 } from "@rific/auto-paper";
|
|
510
545
|
import { useOrientationState } from "@tastic/core";
|
|
511
546
|
import { CornerActionButtons, PressAwayOverlay, usePopoverHost } from "@tastic/hud/chrome";
|
|
512
547
|
import { PlayerSetupPanel, ReadyButton, SharedActionBand } from "@tastic/hud/lobby";
|
|
513
548
|
import { DualZoneLayout, needsSharedNeutralZone, useDualZoneLayout } from "@tastic/split-screen";
|
|
514
|
-
import { router as
|
|
549
|
+
import { router as router4, useFocusEffect as useFocusEffect2 } from "expo-router";
|
|
515
550
|
import { useCallback as useCallback9, useEffect as useEffect4, useMemo as useMemo5, useRef as useRef4, useState as useState4 } from "react";
|
|
516
551
|
import { StyleSheet as StyleSheet3, View as View3 } from "react-native";
|
|
517
552
|
import Animated from "react-native-reanimated";
|
|
@@ -523,7 +558,7 @@ import { useZoneClampedAlign } from "@tastic/hud/lobby";
|
|
|
523
558
|
import { getOptionPickerContentSize, OptionPicker } from "@tastic/profile";
|
|
524
559
|
import { useMemo as useMemo4 } from "react";
|
|
525
560
|
import { StyleSheet as StyleSheet2, View as View2 } from "react-native";
|
|
526
|
-
import { jsx as
|
|
561
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
527
562
|
var CPU_PREFIX = "cpu:";
|
|
528
563
|
var NOBODY = "nobody";
|
|
529
564
|
var PERSON = "person";
|
|
@@ -558,7 +593,7 @@ function OpponentPicker({ idPrefix, host, choices, seatTwo, onSeatTwoChange, cpu
|
|
|
558
593
|
const size = getOptionPickerContentSize(options, colorSection);
|
|
559
594
|
const useAlign = usePickerAlign ?? useZoneClampedAlign;
|
|
560
595
|
const align = useAlign(host.openId === pickerId, size.width, size.height);
|
|
561
|
-
return /* @__PURE__ */
|
|
596
|
+
return /* @__PURE__ */ jsx13(View2, { style: [styles2.button, host.openId === pickerId && styles2.buttonOpen], children: /* @__PURE__ */ jsx13(OptionPicker, { id: pickerId, host, options, value, onChange: handleChange, color: drawn, dark, icon, colorSection, alignOverride: align, triggerStyle }) });
|
|
562
597
|
}
|
|
563
598
|
var styles2 = StyleSheet2.create({
|
|
564
599
|
// Its own column, so a row of seat buttons doesn't stretch the pill to the tallest of them.
|
|
@@ -574,17 +609,21 @@ var styles2 = StyleSheet2.create({
|
|
|
574
609
|
// src/components/SettingsDialog.tsx
|
|
575
610
|
import { useUpdateErrorToast as useUpdateErrorToast2 } from "@rific/toaster";
|
|
576
611
|
import { BaseSettingsDialog } from "@tastic/hud/chrome";
|
|
577
|
-
import {
|
|
612
|
+
import { router as router3 } from "expo-router";
|
|
613
|
+
import { jsx as jsx14, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
578
614
|
var noSettingsRules = () => null;
|
|
579
|
-
function SettingsDialog({ visible, onDismiss, onShowHowToPlay, children }) {
|
|
615
|
+
function SettingsDialog({ visible, onDismiss, onShowHowToPlay, showProfile = false, children }) {
|
|
580
616
|
const onUpdateError = useUpdateErrorToast2();
|
|
581
617
|
const { settings, setSettings } = useAppSettings();
|
|
582
618
|
const { otaVersion, SettingsSections, edgeGuard = true, useSettingsRules = noSettingsRules } = usePack();
|
|
583
619
|
const rules = useSettingsRules();
|
|
620
|
+
const { profiles, lastSelected } = useProfiles();
|
|
621
|
+
const seatOne = profiles.find((profile) => profile.id === lastSelected[1]) ?? null;
|
|
622
|
+
const profileRow = showProfile ? seatOne ? { onShowProfiles: () => router3.push(profileHref(seatOne.id)), profilesRow: { label: "Profile", caption: seatOne.name, icon: "account-outline" } } : { onShowProfiles: () => router3.push(PROFILES_HREF) } : {};
|
|
584
623
|
const edgeGuardProps = edgeGuard ? { deferBottomEdgeGestures: settings.deferBottomEdgeGestures, onDeferBottomEdgeGestures: (value) => setSettings({ deferBottomEdgeGestures: value }) } : {};
|
|
585
|
-
return /* @__PURE__ */ jsxs3(BaseSettingsDialog, { visible, onDismiss, version: otaVersion, ...edgeGuardProps, onUpdateError, onShowHowToPlay, leading: rules, children: [
|
|
624
|
+
return /* @__PURE__ */ jsxs3(BaseSettingsDialog, { visible, onDismiss, version: otaVersion, ...edgeGuardProps, onUpdateError, onShowHowToPlay, ...profileRow, leading: rules, children: [
|
|
586
625
|
children,
|
|
587
|
-
SettingsSections && /* @__PURE__ */
|
|
626
|
+
SettingsSections && /* @__PURE__ */ jsx14(SettingsSections, {})
|
|
588
627
|
] });
|
|
589
628
|
}
|
|
590
629
|
|
|
@@ -735,11 +774,6 @@ function useSeatColors(p2IsHuman) {
|
|
|
735
774
|
return { p1Color, p2Color, handleP1ColorChange, handleP2ColorChange };
|
|
736
775
|
}
|
|
737
776
|
|
|
738
|
-
// src/navigation.ts
|
|
739
|
-
import { configureNavigation, safeBack } from "@rific/core";
|
|
740
|
-
import { router } from "expo-router";
|
|
741
|
-
configureNavigation({ router });
|
|
742
|
-
|
|
743
777
|
// src/redux/liveplaySlice.ts
|
|
744
778
|
import { createSettingsSlice as createSettingsSlice4 } from "@rific/core";
|
|
745
779
|
var { actions: actions5, reducer: reducer5 } = createSettingsSlice4("liveplay", {
|
|
@@ -749,7 +783,7 @@ var liveplayActions = actions5;
|
|
|
749
783
|
var liveplaySlice_default = reducer5;
|
|
750
784
|
|
|
751
785
|
// src/screens/LoadoutScreen.tsx
|
|
752
|
-
import { jsx as
|
|
786
|
+
import { jsx as jsx15, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
753
787
|
var PANEL_SWAP_FADE_MS = 180;
|
|
754
788
|
var P1_CONTROL_ID = "p1-control";
|
|
755
789
|
var P2_CONTROL_ID = "p2-control";
|
|
@@ -797,7 +831,7 @@ function LoadoutScreen({ game }) {
|
|
|
797
831
|
useEffect4(() => {
|
|
798
832
|
if (!humanSeats.every((s) => ready[s])) return;
|
|
799
833
|
dispatch(liveplayActions.setActiveRound({ game: game.id, mode, settings: roundSettingsRef.current }));
|
|
800
|
-
|
|
834
|
+
router4.push(playHref(game.id));
|
|
801
835
|
}, [ready, humanSeats, game.id, mode, dispatch]);
|
|
802
836
|
const bg = pack.Backdrop ? "transparent" : dark ? "#000000" : "#FFFFFF";
|
|
803
837
|
const fg = pack.foreground ?? (dark ? "#FFFFFF" : "#000000");
|
|
@@ -819,20 +853,20 @@ function LoadoutScreen({ game }) {
|
|
|
819
853
|
const p1ControlOpen = controlsHost.openId === P1_CONTROL_ID;
|
|
820
854
|
const controlLook = { accentColor: themeColors.tertiary, mutedColor: fgMuted, dark };
|
|
821
855
|
const p1Control = loadout.seatControl(1, controlsHost, { ...controlLook, seatColor: p1Drawn });
|
|
822
|
-
const p1Panel = /* @__PURE__ */
|
|
823
|
-
const opponentPicker = game.seatTwo && /* @__PURE__ */
|
|
856
|
+
const p1Panel = /* @__PURE__ */ jsx15(PlayerSetupPanel, { idPrefix: "p1", host: controlsHost, color: p1Color, onColorChange: handleP1ColorChange, swatches: defaultColors2, 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: () => router4.push(PROFILES_HREF), previewValue: seatPreview, triggerStyle, useSeatPickerAlign: seatPickerAlign }, `p1-${layoutKey}`);
|
|
857
|
+
const opponentPicker = game.seatTwo && /* @__PURE__ */ jsx15(OpponentPicker, { idPrefix: "p1", host: controlsHost, choices: game.seatTwo, seatTwo, onSeatTwoChange: changeSeatTwo, cpuDifficulty: loadout.cpuDifficulty, color: p2Color, onColorChange: handleP2ColorChange, swatches: defaultColors2, takenColor: p1Color, allowSwapTaken: mode === "vsCpu", dark, previewValue: seatPreview, triggerStyle, usePickerAlign: seatPickerAlign }, `opponent-${layoutKey}`);
|
|
824
858
|
const toggleP1Ready = () => setReady((r) => ({ ...r, 1: !r[1] }));
|
|
825
859
|
const seatButtons = /* @__PURE__ */ jsxs4(View3, { style: [styles3.seatOneButtons, p1PickerOpen && styles3.raised], children: [
|
|
826
860
|
/* @__PURE__ */ jsxs4(Animated.View, { style: [styles3.playersRow, p1PickerOpen && styles3.raised, !p2IsHuman && playersRowFade], children: [
|
|
827
861
|
p1Panel,
|
|
828
862
|
opponentPicker
|
|
829
863
|
] }),
|
|
830
|
-
p1Control && /* @__PURE__ */
|
|
864
|
+
p1Control && /* @__PURE__ */ jsx15(View3, { style: [styles3.controlRow, p1ControlOpen && styles3.raised], children: p1Control })
|
|
831
865
|
] });
|
|
832
866
|
const seatsInOptions = !p2IsHuman && !!loadout.placesSeats;
|
|
833
867
|
const seatOne = /* @__PURE__ */ jsxs4(View3, { style: [styles3.seatOne, !p2IsHuman && styles3.seatOneAlone, p1PickerOpen && !seatsInOptions && styles3.raised], children: [
|
|
834
868
|
!seatsInOptions && seatButtons,
|
|
835
|
-
/* @__PURE__ */
|
|
869
|
+
/* @__PURE__ */ jsx15(ReadyButton, { color: p1Drawn, ready: ready[1], onToggleReady: toggleP1Ready, surfaceColor: readySurface, dark, style: !p2IsHuman && p1PickerOpen && styles3.readyButtonHidden })
|
|
836
870
|
] });
|
|
837
871
|
const optionsRow = loadout.options({
|
|
838
872
|
host: controlsHost,
|
|
@@ -846,15 +880,15 @@ function LoadoutScreen({ game }) {
|
|
|
846
880
|
onReset: showMetaInSharedBand ? void 0 : loadout.reset
|
|
847
881
|
});
|
|
848
882
|
const optionsPopoverOpen = controlsHost.openId !== null && loadout.optionIds.includes(controlsHost.openId);
|
|
849
|
-
const sharedControls = showMetaInSharedBand ? /* @__PURE__ */
|
|
883
|
+
const sharedControls = showMetaInSharedBand ? /* @__PURE__ */ jsx15(SharedActionBand, { onBack: safeBack, onSettings: () => setSettingsOpen(true), onRandomize: loadout.randomize, onReset: loadout.reset, fg, popoverOpen: optionsPopoverOpen, children: optionsRow }) : optionsRow;
|
|
850
884
|
const p2Control = p2IsHuman ? loadout.seatControl(2, p2Host, { ...controlLook, seatColor: p2Drawn }) : void 0;
|
|
851
|
-
const p2Panel = p2IsHuman && /* @__PURE__ */
|
|
885
|
+
const p2Panel = p2IsHuman && /* @__PURE__ */ jsx15(PlayerSetupPanel, { idPrefix: "p2", host: p2Host, color: p2Color, onColorChange: handleP2ColorChange, swatches: defaultColors2, 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");
|
|
852
886
|
return /* @__PURE__ */ jsxs4(View3, { style: [styles3.container, { backgroundColor: bg }], children: [
|
|
853
887
|
/* @__PURE__ */ jsxs4(View3, { style: styles3.frame, children: [
|
|
854
|
-
/* @__PURE__ */
|
|
855
|
-
p2ZoneStyle && /* @__PURE__ */
|
|
856
|
-
!showMetaInSharedBand && /* @__PURE__ */
|
|
857
|
-
p2IsHuman ? /* @__PURE__ */
|
|
888
|
+
/* @__PURE__ */ jsx15(PressAwayOverlay, { active: controlsHost.openId !== null, onPress: controlsHost.close }),
|
|
889
|
+
p2ZoneStyle && /* @__PURE__ */ jsx15(PressAwayOverlay, { active: controlsHost.openId !== null || p2Host.openId !== null, onPress: p2Host.close, style: p2ZoneStyle }),
|
|
890
|
+
!showMetaInSharedBand && /* @__PURE__ */ jsx15(CornerActionButtons, { onBack: safeBack, onSettings: () => setSettingsOpen(true), fg, insets }),
|
|
891
|
+
p2IsHuman ? /* @__PURE__ */ jsx15(
|
|
858
892
|
DualZoneLayout,
|
|
859
893
|
{
|
|
860
894
|
panelLayout,
|
|
@@ -867,11 +901,11 @@ function LoadoutScreen({ game }) {
|
|
|
867
901
|
sharedElevated: optionsPopoverOpen
|
|
868
902
|
}
|
|
869
903
|
) : /* @__PURE__ */ jsxs4(View3, { style: styles3.stackedZone, children: [
|
|
870
|
-
seatsInOptions ? /* @__PURE__ */
|
|
904
|
+
seatsInOptions ? /* @__PURE__ */ jsx15(View3, { style: p1PickerOpen && styles3.raised, children: sharedControls }) : sharedControls,
|
|
871
905
|
seatOne
|
|
872
906
|
] })
|
|
873
907
|
] }),
|
|
874
|
-
/* @__PURE__ */
|
|
908
|
+
/* @__PURE__ */ jsx15(SettingsDialog, { visible: settingsOpen, onDismiss: () => setSettingsOpen(false), onShowHowToPlay: () => openFor(game.id), showProfile: true })
|
|
875
909
|
] });
|
|
876
910
|
}
|
|
877
911
|
function halfOf(color) {
|
|
@@ -952,24 +986,24 @@ var styles3 = StyleSheet3.create({
|
|
|
952
986
|
});
|
|
953
987
|
|
|
954
988
|
// src/screens/GameRoute.tsx
|
|
955
|
-
import { jsx as
|
|
989
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
956
990
|
function LoadoutRoute() {
|
|
957
|
-
const { game: id } =
|
|
991
|
+
const { game: id } = useLocalSearchParams2();
|
|
958
992
|
const game = usePackGame(id);
|
|
959
|
-
if (!game) return /* @__PURE__ */
|
|
960
|
-
if (!hasLoadout(game)) return /* @__PURE__ */
|
|
961
|
-
return /* @__PURE__ */
|
|
993
|
+
if (!game) return /* @__PURE__ */ jsx16(Redirect, { href: "/" });
|
|
994
|
+
if (!hasLoadout(game)) return /* @__PURE__ */ jsx16(Redirect, { href: playHref(game.id) });
|
|
995
|
+
return /* @__PURE__ */ jsx16(LoadoutScreen, { game }, game.id);
|
|
962
996
|
}
|
|
963
997
|
function hasLoadout(game) {
|
|
964
998
|
return !!game.useLoadout;
|
|
965
999
|
}
|
|
966
1000
|
function PlayRoute() {
|
|
967
|
-
const { game: id } =
|
|
1001
|
+
const { game: id } = useLocalSearchParams2();
|
|
968
1002
|
const game = usePackGame(id);
|
|
969
1003
|
useResumePoint(game?.resumable ? game.id : null);
|
|
970
|
-
if (!game) return /* @__PURE__ */
|
|
1004
|
+
if (!game) return /* @__PURE__ */ jsx16(Redirect, { href: "/" });
|
|
971
1005
|
const { PlayScreen } = game;
|
|
972
|
-
return /* @__PURE__ */
|
|
1006
|
+
return /* @__PURE__ */ jsx16(PlayScreen, {}, game.id);
|
|
973
1007
|
}
|
|
974
1008
|
function useResumePoint(gameId) {
|
|
975
1009
|
const { setLastActiveGame, clearLastActiveGame } = useLastActiveGame();
|
|
@@ -983,11 +1017,11 @@ function useResumePoint(gameId) {
|
|
|
983
1017
|
}
|
|
984
1018
|
|
|
985
1019
|
// src/screens/HomeScreen.tsx
|
|
986
|
-
import { defaultColors as
|
|
1020
|
+
import { defaultColors as defaultColors3, FadingScrollView, useAutoPaperTheme as useAutoPaperTheme4 } from "@rific/auto-paper";
|
|
987
1021
|
import { IconButton, Pressable } from "@rific/feedback-press";
|
|
988
1022
|
import { PressAwayOverlay as PressAwayOverlay2, usePopoverHost as usePopoverHost2, useWellColors, WELL_SHADOW } from "@tastic/hud/chrome";
|
|
989
1023
|
import { getProfilePickerContentSize, ProfilePicker } from "@tastic/profile";
|
|
990
|
-
import { Redirect as Redirect2, router as
|
|
1024
|
+
import { Redirect as Redirect2, router as router5, useIsFocused } from "expo-router";
|
|
991
1025
|
import { useCallback as useCallback10, useEffect as useEffect6, useMemo as useMemo6, useRef as useRef5, useState as useState6 } from "react";
|
|
992
1026
|
import { AppState as AppState2, StyleSheet as StyleSheet4, View as View4 } from "react-native";
|
|
993
1027
|
import { Icon, Portal, SegmentedButtons, Text } from "react-native-paper";
|
|
@@ -1074,7 +1108,7 @@ function useHomeLayout(withPicker = true) {
|
|
|
1074
1108
|
}
|
|
1075
1109
|
|
|
1076
1110
|
// src/screens/HomeScreen.tsx
|
|
1077
|
-
import { Fragment as Fragment5, jsx as
|
|
1111
|
+
import { Fragment as Fragment5, jsx as jsx17, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1078
1112
|
function HomeScreen() {
|
|
1079
1113
|
const pack = usePack();
|
|
1080
1114
|
const { consumeResumeGame } = useLastActiveGame();
|
|
@@ -1086,8 +1120,8 @@ function HomeScreen() {
|
|
|
1086
1120
|
useEffect6(() => {
|
|
1087
1121
|
if (!resumeGame) autoShowPack();
|
|
1088
1122
|
}, [resumeGame, autoShowPack]);
|
|
1089
|
-
if (resumeGame) return /* @__PURE__ */
|
|
1090
|
-
return /* @__PURE__ */
|
|
1123
|
+
if (resumeGame) return /* @__PURE__ */ jsx17(Redirect2, { href: pack.resumeHref?.(resumeGame.id) ?? playHref(resumeGame.id) });
|
|
1124
|
+
return /* @__PURE__ */ jsx17(HomeMenu, {});
|
|
1091
1125
|
}
|
|
1092
1126
|
function HomeMenu() {
|
|
1093
1127
|
const pack = usePack();
|
|
@@ -1131,42 +1165,42 @@ function HomeMenu() {
|
|
|
1131
1165
|
const [tabLabel, setTabLabel] = useState6(() => tabs?.[0].label ?? null);
|
|
1132
1166
|
const tab = tabs ? tabs.find((t) => t.label === tabLabel) ?? tabs[0] : null;
|
|
1133
1167
|
const tabButtons = useMemo6(() => tabs?.map(({ label }) => ({ value: label, label, labelStyle: pack.labelStyle })) ?? [], [tabs, pack.labelStyle]);
|
|
1134
|
-
const tabBar = tab && /* @__PURE__ */
|
|
1168
|
+
const tabBar = tab && /* @__PURE__ */ jsx17(SegmentedButtons, { value: tab.label, onValueChange: setTabLabel, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles4.tabs, pack.Backdrop && { backgroundColor: colors.surface }] });
|
|
1135
1169
|
const columnClamp = useClampOnShrink();
|
|
1136
1170
|
const gridClamp = useClampOnShrink();
|
|
1137
|
-
const openGame = useCallback10((game) => openFirstTime(game.id, () =>
|
|
1171
|
+
const openGame = useCallback10((game) => openFirstTime(game.id, () => router5.push(game.useLoadout ? loadoutHref(game.id) : playHref(game.id))), [openFirstTime]);
|
|
1138
1172
|
const openRules = useCallback10((game) => game.Rules ? setRulesGame(game) : openFor(game.id), [openFor]);
|
|
1139
|
-
const colorSection = { value: p1Color, onChange: handleP1ColorChange, swatches:
|
|
1173
|
+
const colorSection = { value: p1Color, onChange: handleP1ColorChange, swatches: defaultColors3, caption: selectedProfile ? pack.colorCaption : void 0, previewValue: previewColor ? (hex) => previewColor(hex, dark) : void 0 };
|
|
1140
1174
|
const usePickerAlign = pack.usePickerAlign ?? noPickerAlign;
|
|
1141
1175
|
const pickerSize = getProfilePickerContentSize(profiles.length, true, colorSection);
|
|
1142
1176
|
const pickerAlign = usePickerAlign(pickerHost.openId === `${SEAT_ONE_PICKER}-profile`, pickerSize.width, pickerSize.height);
|
|
1143
|
-
const picker = /* @__PURE__ */
|
|
1144
|
-
const pressAway = /* @__PURE__ */
|
|
1177
|
+
const picker = /* @__PURE__ */ jsx17(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: () => router5.push(PROFILES_HREF), colorSection, alignOverride: pickerAlign, triggerStyle });
|
|
1178
|
+
const pressAway = /* @__PURE__ */ jsx17(PressAwayOverlay2, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles4.pressAway });
|
|
1145
1179
|
const RulesSheet = rulesGame?.Rules;
|
|
1146
1180
|
return /* @__PURE__ */ jsxs5(View4, { style: [styles4.container, { backgroundColor: bg }], children: [
|
|
1147
|
-
/* @__PURE__ */
|
|
1181
|
+
/* @__PURE__ */ jsx17(View4, { style: styles4.frame, children: /* @__PURE__ */ jsxs5(RulesHost, { enabled: pack.games.some((game) => game.Rules), children: [
|
|
1148
1182
|
isWide ? /* @__PURE__ */ jsxs5(Fragment5, { children: [
|
|
1149
1183
|
pressAway,
|
|
1150
1184
|
/* @__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: [
|
|
1151
|
-
tabBar && /* @__PURE__ */
|
|
1152
|
-
/* @__PURE__ */
|
|
1185
|
+
tabBar && /* @__PURE__ */ jsx17(View4, { style: [styles4.wideTabs, { width: layout.rightPaneWidth }], children: tabBar }),
|
|
1186
|
+
/* @__PURE__ */ jsx17(View4, { style: [styles4.grid, { width: layout.rightPaneWidth }], children: pack.games.map((game) => /* @__PURE__ */ jsx17(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)) })
|
|
1153
1187
|
] }),
|
|
1154
1188
|
/* @__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: [
|
|
1155
|
-
/* @__PURE__ */
|
|
1156
|
-
showPicker && /* @__PURE__ */
|
|
1189
|
+
/* @__PURE__ */ jsx17(pack.HeroTitle, { words: pack.wordmark, color: fg, p1Color, p2Color, active: heroActive, fit: layout.heroFit }),
|
|
1190
|
+
showPicker && /* @__PURE__ */ jsx17(View4, { style: styles4.widePicker, children: picker })
|
|
1157
1191
|
] })
|
|
1158
1192
|
] }) : /* @__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: [
|
|
1159
1193
|
pressAway,
|
|
1160
|
-
/* @__PURE__ */
|
|
1161
|
-
showPicker && /* @__PURE__ */
|
|
1162
|
-
tabBar && /* @__PURE__ */
|
|
1163
|
-
/* @__PURE__ */
|
|
1194
|
+
/* @__PURE__ */ jsx17(pack.HeroTitle, { words: pack.wordmark, color: fg, p1Color, p2Color, active: heroActive }),
|
|
1195
|
+
showPicker && /* @__PURE__ */ jsx17(View4, { style: [styles4.picker, pickerHost.openId !== null && styles4.pickerOpen], children: picker }),
|
|
1196
|
+
tabBar && /* @__PURE__ */ jsx17(View4, { style: styles4.listWidth, children: tabBar }),
|
|
1197
|
+
/* @__PURE__ */ jsx17(View4, { style: styles4.list, children: pack.games.map((game) => /* @__PURE__ */ jsx17(GameRow, { game, hidden: isHidden(tab, game), dark, p1Color, p2Color, previewRevealed: previewsRevealed, onPress: () => openGame(game), onRules: hasRules(game) ? () => openRules(game) : void 0 }, game.id)) })
|
|
1164
1198
|
] }),
|
|
1165
|
-
/* @__PURE__ */
|
|
1166
|
-
/* @__PURE__ */
|
|
1167
|
-
RulesSheet && /* @__PURE__ */
|
|
1199
|
+
/* @__PURE__ */ jsx17(IconButton, { icon: "trophy", iconColor: fg, size: 24, style: [styles4.corner, { top: 8 + insets.top, left: 8 + insets.left }], onPress: () => router5.push(STATS_HREF), accessibilityLabel: "Stats & Achievements" }),
|
|
1200
|
+
/* @__PURE__ */ jsx17(IconButton, { icon: "cog", iconColor: fg, size: 24, style: [styles4.corner, { top: 8 + insets.top, right: 8 + insets.right }], onPress: () => setSettingsOpen(true), accessibilityLabel: "Settings" }),
|
|
1201
|
+
RulesSheet && /* @__PURE__ */ jsx17(RulesSheet, { visible: true, onDismiss: () => setRulesGame(null) })
|
|
1168
1202
|
] }) }),
|
|
1169
|
-
/* @__PURE__ */
|
|
1203
|
+
/* @__PURE__ */ jsx17(SettingsDialog, { visible: settingsOpen, onDismiss: () => setSettingsOpen(false), onShowHowToPlay: pack.guide ? openPack : void 0, showProfile: true })
|
|
1170
1204
|
] });
|
|
1171
1205
|
}
|
|
1172
1206
|
var SEAT_ONE_PICKER = "home-p1";
|
|
@@ -1203,7 +1237,7 @@ function hasRules(game) {
|
|
|
1203
1237
|
return !!(game.Rules || game.guide);
|
|
1204
1238
|
}
|
|
1205
1239
|
function RulesHost({ enabled, children }) {
|
|
1206
|
-
return enabled ? /* @__PURE__ */
|
|
1240
|
+
return enabled ? /* @__PURE__ */ jsx17(Portal.Host, { children }) : /* @__PURE__ */ jsx17(Fragment5, { children });
|
|
1207
1241
|
}
|
|
1208
1242
|
var ROW_BLURB_LINES = 3;
|
|
1209
1243
|
function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPress, onRules }) {
|
|
@@ -1215,13 +1249,13 @@ function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPres
|
|
|
1215
1249
|
// inside a button is invalid on the web.
|
|
1216
1250
|
/* @__PURE__ */ jsxs5(View4, { style: hidden ? styles4.hidden : void 0, children: [
|
|
1217
1251
|
/* @__PURE__ */ jsxs5(Pressable, { onPress, style: [styles4.row, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
|
|
1218
|
-
game.Preview ? /* @__PURE__ */
|
|
1252
|
+
game.Preview ? /* @__PURE__ */ jsx17(PreviewBox, { game, width: ROW_PREVIEW_WIDTH, revealed: previewRevealed, dark, p1Color, p2Color }) : /* @__PURE__ */ jsx17(View4, { style: [styles4.rowIcon, { backgroundColor: dark ? ICON_DARK_BG : ICON_LIGHT_BG }], children: GameIcon && /* @__PURE__ */ jsx17(GameIcon, { size: ROW_ICON_SIZE, p1Color, p2Color, dark }) }),
|
|
1219
1253
|
/* @__PURE__ */ jsxs5(View4, { style: styles4.rowText, children: [
|
|
1220
|
-
/* @__PURE__ */
|
|
1221
|
-
/* @__PURE__ */
|
|
1254
|
+
/* @__PURE__ */ jsx17(Text, { variant: "titleLarge", style: [styles4.rowTitle, { color: well.fg }, titleStyle], numberOfLines: 1, children: game.title }),
|
|
1255
|
+
/* @__PURE__ */ jsx17(Text, { variant: "bodyMedium", style: { color: well.fgMuted }, numberOfLines: ROW_BLURB_LINES, children: game.blurb })
|
|
1222
1256
|
] })
|
|
1223
1257
|
] }),
|
|
1224
|
-
onRules && /* @__PURE__ */
|
|
1258
|
+
onRules && /* @__PURE__ */ jsx17(Pressable, { onPress: onRules, style: styles4.rulesButton, hitSlop: 12, accessibilityRole: "button", accessibilityLabel: `${game.title} rules`, children: /* @__PURE__ */ jsx17(Icon, { source: "information-outline", size: 22, color: well.fgMuted }) })
|
|
1225
1259
|
] })
|
|
1226
1260
|
);
|
|
1227
1261
|
}
|
|
@@ -1230,18 +1264,18 @@ function GameTile({ game, hidden, width, previewWidth, dark, p1Color, p2Color, p
|
|
|
1230
1264
|
const well = useWellColors();
|
|
1231
1265
|
return /* @__PURE__ */ jsxs5(View4, { style: [{ width }, hidden && styles4.hidden], children: [
|
|
1232
1266
|
/* @__PURE__ */ jsxs5(Pressable, { onPress, style: [styles4.tile, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
|
|
1233
|
-
/* @__PURE__ */
|
|
1234
|
-
/* @__PURE__ */
|
|
1235
|
-
/* @__PURE__ */
|
|
1267
|
+
/* @__PURE__ */ jsx17(PreviewBox, { game, width: previewWidth, revealed: previewRevealed, dark, p1Color, p2Color }),
|
|
1268
|
+
/* @__PURE__ */ jsx17(Text, { variant: "titleMedium", style: [styles4.rowTitle, { color: well.fg }, titleStyle], numberOfLines: 1, children: game.title }),
|
|
1269
|
+
/* @__PURE__ */ jsx17(Text, { variant: "bodySmall", style: { color: well.fgMuted }, numberOfLines: 3, children: game.blurb })
|
|
1236
1270
|
] }),
|
|
1237
|
-
onRules && /* @__PURE__ */
|
|
1271
|
+
onRules && /* @__PURE__ */ jsx17(Pressable, { onPress: onRules, style: styles4.tileRulesButton, hitSlop: 12, accessibilityRole: "button", accessibilityLabel: `${game.title} rules`, children: /* @__PURE__ */ jsx17(Icon, { source: "information-outline", size: 20, color: "#FFFFFF" }) })
|
|
1238
1272
|
] });
|
|
1239
1273
|
}
|
|
1240
1274
|
function PreviewBox({ game, width, revealed, dark, p1Color, p2Color }) {
|
|
1241
1275
|
const height = Math.round(width / PREVIEW_ASPECT);
|
|
1242
1276
|
const { Preview, icon: GameIcon } = game;
|
|
1243
1277
|
const iconSize = Math.min(height, ROW_ICON_SIZE);
|
|
1244
|
-
return /* @__PURE__ */
|
|
1278
|
+
return /* @__PURE__ */ jsx17(View4, { style: [styles4.preview, { width, height, backgroundColor: dark ? ICON_DARK_BG : ICON_LIGHT_BG }], children: Preview ? revealed && /* @__PURE__ */ jsx17(Preview, { width, height, p1Color, p2Color, dark }) : GameIcon && /* @__PURE__ */ jsx17(View4, { style: [styles4.previewIcon, { width: iconSize, height: iconSize, borderRadius: iconSize * 0.22 }], children: /* @__PURE__ */ jsx17(GameIcon, { size: iconSize, p1Color, p2Color, dark }) }) });
|
|
1245
1279
|
}
|
|
1246
1280
|
var ROW_ICON_SIZE = 56;
|
|
1247
1281
|
var ICON_LIGHT_BG = "#FAFAFA";
|
|
@@ -1390,33 +1424,17 @@ var styles4 = StyleSheet4.create({
|
|
|
1390
1424
|
}
|
|
1391
1425
|
});
|
|
1392
1426
|
|
|
1393
|
-
// src/screens/ProfilesRoute.tsx
|
|
1394
|
-
import { defaultColors as defaultColors3 } from "@rific/auto-paper";
|
|
1395
|
-
import { ScreenFrame as ScreenFrame2 } from "@tastic/hud/chrome";
|
|
1396
|
-
import { ProfilesScreen } from "@tastic/profile";
|
|
1397
|
-
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1398
|
-
var ROSTER_MAX_WIDTH = 640;
|
|
1399
|
-
function useRosterAlign(open, contentWidth, contentHeight) {
|
|
1400
|
-
const { usePickerAlign } = usePack();
|
|
1401
|
-
return usePickerAlign(open, contentWidth, contentHeight, { maxContentWidth: ROSTER_MAX_WIDTH });
|
|
1402
|
-
}
|
|
1403
|
-
function ProfilesRoute() {
|
|
1404
|
-
const { profiles, createProfile, updateProfile, deleteProfile } = useProfiles();
|
|
1405
|
-
const { Backdrop, foreground, newProfileColor, usePickerAlign } = usePack();
|
|
1406
|
-
return /* @__PURE__ */ jsx16(ScreenFrame2, { 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 }) });
|
|
1407
|
-
}
|
|
1408
|
-
|
|
1409
1427
|
// src/screens/StatsScreen.tsx
|
|
1410
1428
|
import { useAutoPaperTheme as useAutoPaperTheme5 } from "@rific/auto-paper";
|
|
1411
|
-
import { BaseStatsScreen, PressAwayOverlay as PressAwayOverlay3, ScreenFrame as
|
|
1429
|
+
import { BaseStatsScreen, PressAwayOverlay as PressAwayOverlay3, ScreenFrame as ScreenFrame4, usePopoverHost as usePopoverHost3 } from "@tastic/hud/chrome";
|
|
1412
1430
|
import { getOptionPickerContentSize as getOptionPickerContentSize2, OptionPicker as OptionPicker2 } from "@tastic/profile";
|
|
1413
|
-
import { router as
|
|
1431
|
+
import { router as router6 } from "expo-router";
|
|
1414
1432
|
import { useMemo as useMemo7, useState as useState7 } from "react";
|
|
1415
1433
|
import { StyleSheet as StyleSheet5, View as View5 } from "react-native";
|
|
1416
1434
|
import { SegmentedButtons as SegmentedButtons2, Text as Text2 } from "react-native-paper";
|
|
1417
1435
|
import { useSafeAreaInsets as useSafeAreaInsets4 } from "react-native-safe-area-context";
|
|
1418
1436
|
import { useDispatch as useDispatch10 } from "react-redux";
|
|
1419
|
-
import { jsx as
|
|
1437
|
+
import { jsx as jsx18, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1420
1438
|
var STATS = "stats";
|
|
1421
1439
|
var ACHIEVEMENTS = "achievements";
|
|
1422
1440
|
var TABS = [
|
|
@@ -1434,10 +1452,10 @@ var MANAGE_OPTION = { value: MANAGE, label: "Manage", icon: "account-cog-outline
|
|
|
1434
1452
|
var STATS_MAX_WIDTH = 640;
|
|
1435
1453
|
function StatsScreen() {
|
|
1436
1454
|
const pickerHost = usePopoverHost3();
|
|
1437
|
-
return /* @__PURE__ */
|
|
1455
|
+
return /* @__PURE__ */ jsx18(StatsPressAway, { host: pickerHost, children: /* @__PURE__ */ jsx18(ScreenFrame4, { portalHost: true, maxContentWidth: STATS_MAX_WIDTH, children: /* @__PURE__ */ jsx18(StatsContent, { pickerHost }) }) });
|
|
1438
1456
|
}
|
|
1439
1457
|
function StatsPressAway({ host, children }) {
|
|
1440
|
-
return /* @__PURE__ */
|
|
1458
|
+
return /* @__PURE__ */ jsx18(View5, { testID: "stats-press-away", style: styles5.screen, onStartShouldSetResponder: () => host.openId !== null, onResponderRelease: host.close, children });
|
|
1441
1459
|
}
|
|
1442
1460
|
var useNoPackReset = () => null;
|
|
1443
1461
|
var noPickerAlign2 = () => void 0;
|
|
@@ -1478,15 +1496,15 @@ function StatsContent({ pickerHost }) {
|
|
|
1478
1496
|
const triggerStyle = pack.Backdrop ? [styles5.pill, surface] : void 0;
|
|
1479
1497
|
const PackTabContent = packTab?.Content;
|
|
1480
1498
|
return /* @__PURE__ */ jsxs6(BaseStatsScreen, { title, titleStyle: pack.titleStyle, onBack: safeBack, insets, onReset: reset.onReset, resetLabel: reset.label, resetConfirmTitle: reset.title, resetConfirmBody: reset.body, fg: pack.foreground, bg: pack.Backdrop ? "transparent" : void 0, children: [
|
|
1481
|
-
/* @__PURE__ */
|
|
1482
|
-
/* @__PURE__ */
|
|
1499
|
+
/* @__PURE__ */ jsx18(PressAwayOverlay3, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles5.pressAway }),
|
|
1500
|
+
/* @__PURE__ */ jsx18(SegmentedButtons2, { value: tab, onValueChange: setTab, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles5.tabs, surface] }),
|
|
1483
1501
|
/* @__PURE__ */ jsxs6(View5, { style: [styles5.filters, pickerHost.openId !== null && styles5.filtersOpen], onStartShouldSetResponder: () => pickerHost.openId !== null, children: [
|
|
1484
|
-
/* @__PURE__ */
|
|
1485
|
-
showGamePicker && /* @__PURE__ */
|
|
1502
|
+
/* @__PURE__ */ jsx18(OptionPicker2, { id: PLAYER_PICKER_ID, host: pickerHost, options: playerOptions, value: profileId ?? EVERYONE, onChange: (value) => value === MANAGE ? router6.push(PROFILES_HREF) : setSelectedProfileId(value === EVERYONE ? null : value), color: colors.primary, dark, icon: profileId ? "account" : "account-group", alignOverride: playerAlign, triggerStyle }),
|
|
1503
|
+
showGamePicker && /* @__PURE__ */ jsx18(OptionPicker2, { id: GAME_PICKER_ID, host: pickerHost, options: gameOptions, value: gameId, onChange: setGameId, color: colors.primary, dark, icon: "view-grid-outline", alignOverride: gameAlign, triggerStyle })
|
|
1486
1504
|
] }),
|
|
1487
|
-
tab === STATS && pack.StatsSections && /* @__PURE__ */
|
|
1488
|
-
PackTabContent && /* @__PURE__ */
|
|
1489
|
-
tab === ACHIEVEMENTS && pack.AchievementList ? /* @__PURE__ */
|
|
1505
|
+
tab === STATS && pack.StatsSections && /* @__PURE__ */ jsx18(pack.StatsSections, { profileId, gameId: gameId === ALL_GAMES ? null : gameId }),
|
|
1506
|
+
PackTabContent && /* @__PURE__ */ jsx18(PackTabContent, { profileId, gameId: gameId === ALL_GAMES ? null : gameId }),
|
|
1507
|
+
tab === ACHIEVEMENTS && pack.AchievementList ? /* @__PURE__ */ jsx18(pack.AchievementList, { profileId }) : (tab === STATS || tab === ACHIEVEMENTS) && games.map((game) => /* @__PURE__ */ jsx18(GameStats, { game, tab, profileId, showTitle: games.length > 1 && pack.statsGameTitles !== false, titleColor: fg }, game.id))
|
|
1490
1508
|
] });
|
|
1491
1509
|
}
|
|
1492
1510
|
function resetFor(pack, packReset, profileId, profiles, games, resetGames) {
|
|
@@ -1503,8 +1521,8 @@ function GameStats({ game, tab, profileId, showTitle, titleColor }) {
|
|
|
1503
1521
|
const Sections = tab === STATS ? StatsSections : AchievementList;
|
|
1504
1522
|
if (!Sections) return null;
|
|
1505
1523
|
return /* @__PURE__ */ jsxs6(View5, { style: styles5.game, children: [
|
|
1506
|
-
showTitle && /* @__PURE__ */
|
|
1507
|
-
/* @__PURE__ */
|
|
1524
|
+
showTitle && /* @__PURE__ */ jsx18(Text2, { variant: "titleLarge", style: [styles5.gameTitle, { color: titleColor }, titleStyle], children: game.title }),
|
|
1525
|
+
/* @__PURE__ */ jsx18(Sections, { profileId })
|
|
1508
1526
|
] });
|
|
1509
1527
|
}
|
|
1510
1528
|
var styles5 = StyleSheet5.create({
|
|
@@ -1542,10 +1560,10 @@ var styles5 = StyleSheet5.create({
|
|
|
1542
1560
|
|
|
1543
1561
|
// src/components/imageGameIcon.tsx
|
|
1544
1562
|
import { Image } from "react-native";
|
|
1545
|
-
import { jsx as
|
|
1563
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
1546
1564
|
function imageGameIcon(images) {
|
|
1547
1565
|
return function ImageGameIcon({ size, dark }) {
|
|
1548
|
-
return /* @__PURE__ */
|
|
1566
|
+
return /* @__PURE__ */ jsx19(Image, { source: dark ? images.dark : images.light, style: { height: size, width: size }, accessibilityIgnoresInvertColors: true });
|
|
1549
1567
|
};
|
|
1550
1568
|
}
|
|
1551
1569
|
|
|
@@ -1556,7 +1574,7 @@ import { useEffect as useEffect7 } from "react";
|
|
|
1556
1574
|
import { StyleSheet as StyleSheet6, useWindowDimensions as useWindowDimensions2 } from "react-native";
|
|
1557
1575
|
import Animated2, { useAnimatedStyle, useSharedValue, withTiming } from "react-native-reanimated";
|
|
1558
1576
|
import { useSafeAreaInsets as useSafeAreaInsets5 } from "react-native-safe-area-context";
|
|
1559
|
-
import { Fragment as Fragment6, jsx as
|
|
1577
|
+
import { Fragment as Fragment6, jsx as jsx20, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1560
1578
|
var MATCH_CHIPS_FADE_MS = 150;
|
|
1561
1579
|
var CHIP_SIZE = 48;
|
|
1562
1580
|
var EDGE_PAD = 8;
|
|
@@ -1579,8 +1597,8 @@ function MatchChips({ playing, faceToFace, centerLineY, onBack, onSettings }) {
|
|
|
1579
1597
|
const settingsSlot = { top, right: EDGE_PAD + insets.right };
|
|
1580
1598
|
const pointerEvents = visible ? "box-none" : "none";
|
|
1581
1599
|
return /* @__PURE__ */ jsxs7(Fragment6, { children: [
|
|
1582
|
-
/* @__PURE__ */
|
|
1583
|
-
/* @__PURE__ */
|
|
1600
|
+
/* @__PURE__ */ jsx20(Animated2.View, { pointerEvents, style: [styles6.slot, backSlot, fadeStyle], testID: "match-chips-back", children: /* @__PURE__ */ jsx20(IconButton2, { icon: "arrow-left", iconColor, containerColor, style: styles6.chip, size: 24, onPress: onBack, accessibilityLabel: "Back" }) }),
|
|
1601
|
+
/* @__PURE__ */ jsx20(Animated2.View, { pointerEvents, style: [styles6.slot, settingsSlot, fadeStyle], testID: "match-chips-settings", children: /* @__PURE__ */ jsx20(IconButton2, { icon: "cog", iconColor, containerColor, style: styles6.chip, size: 24, onPress: onSettings, accessibilityLabel: "Settings" }) })
|
|
1584
1602
|
] });
|
|
1585
1603
|
}
|
|
1586
1604
|
var styles6 = StyleSheet6.create({
|
|
@@ -1749,7 +1767,7 @@ function forgetProfileAchievements(dropStats) {
|
|
|
1749
1767
|
// src/gameStats.tsx
|
|
1750
1768
|
import { createAchievementsSlice, mapUnlocksBySeat, useAchievements } from "@tastic/achievements";
|
|
1751
1769
|
import { createContext as createContext5, useCallback as useCallback12, useContext as useContext5, useMemo as useMemo8 } from "react";
|
|
1752
|
-
import { jsx as
|
|
1770
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
1753
1771
|
var SEATS = [1, 2];
|
|
1754
1772
|
function createGameStats({ key, defaultStats, isValidStats, catalog, getProfileStatsView }) {
|
|
1755
1773
|
const { actions: actions6, reducer: sliceReducer } = createAchievementsSlice({
|
|
@@ -1782,7 +1800,7 @@ function createGameStats({ key, defaultStats, isValidStats, catalog, getProfileS
|
|
|
1782
1800
|
[recordOutcome]
|
|
1783
1801
|
);
|
|
1784
1802
|
const value = useMemo8(() => ({ stats, unlockedAchievements, record, resetAll }), [stats, unlockedAchievements, record, resetAll]);
|
|
1785
|
-
return /* @__PURE__ */
|
|
1803
|
+
return /* @__PURE__ */ jsx21(Context.Provider, { value, children });
|
|
1786
1804
|
}
|
|
1787
1805
|
function useStats() {
|
|
1788
1806
|
const ctx = useContext5(Context);
|
|
@@ -1857,6 +1875,7 @@ function createPlayerSettings({ id, defaults, distinctControls }) {
|
|
|
1857
1875
|
export {
|
|
1858
1876
|
DEFAULT_APP_SETTINGS,
|
|
1859
1877
|
DEFAULT_OPPONENT,
|
|
1878
|
+
EditProfileRoute,
|
|
1860
1879
|
GUEST_PLAYER_ID,
|
|
1861
1880
|
HomeScreen,
|
|
1862
1881
|
LoadoutRoute,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tastic/shell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "The app around a pack of React Native games, two-seat or for one player: Home, the loadout, the stats screen, Profiles and Settings, the pack's Redux store and its root providers, driven by one PackDefinition",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -86,8 +86,8 @@
|
|
|
86
86
|
"@tastic/achievements": "^0.6.1",
|
|
87
87
|
"@tastic/core": "^0.17.0",
|
|
88
88
|
"@tastic/edge-guard": "^0.2.1",
|
|
89
|
-
"@tastic/hud": "^0.
|
|
90
|
-
"@tastic/profile": "^0.
|
|
89
|
+
"@tastic/hud": "^0.37.0",
|
|
90
|
+
"@tastic/profile": "^0.25.0",
|
|
91
91
|
"@tastic/split-screen": "^0.6.0",
|
|
92
92
|
"@testing-library/react-native": "^14.1.0",
|
|
93
93
|
"@types/jest": "30.0.0",
|
|
@@ -138,8 +138,8 @@
|
|
|
138
138
|
"@tastic/achievements": ">=0.6.0",
|
|
139
139
|
"@tastic/core": ">=0.16.0",
|
|
140
140
|
"@tastic/edge-guard": ">=0.2.0",
|
|
141
|
-
"@tastic/hud": ">=0.
|
|
142
|
-
"@tastic/profile": ">=0.
|
|
141
|
+
"@tastic/hud": ">=0.37.0",
|
|
142
|
+
"@tastic/profile": ">=0.25.0",
|
|
143
143
|
"@tastic/split-screen": ">=0.5.5",
|
|
144
144
|
"expo-audio": ">=58.0.11",
|
|
145
145
|
"expo-blur": ">=58.0.4",
|
package/src/RootLayout.tsx
CHANGED
|
@@ -154,7 +154,7 @@ function HapticGatedToastProvider({ children }: { children: ReactNode }) {
|
|
|
154
154
|
|
|
155
155
|
function FramedToaster() {
|
|
156
156
|
const renderFrame = useCallback((toasts: ReactNode) => <ScreenFrame passThrough>{toasts}</ScreenFrame>, [])
|
|
157
|
-
return <Toaster historyButton={null} clearButton={null} limit={
|
|
157
|
+
return <Toaster historyButton={null} clearButton={null} limit={1} renderFrame={renderFrame} />
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
// The pack's own toaster (PackDefinition.Toaster), laid over the whole app in hud's ScreenFrame:
|