@tastic/shell 0.21.1 → 0.23.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 +67 -10
- package/dist/index.d.mts +16 -4
- package/dist/index.d.ts +16 -4
- package/dist/index.js +445 -394
- package/dist/index.mjs +368 -319
- package/package.json +1 -1
- package/src/components/GuideCards.tsx +63 -0
- package/src/components/GuideHost.tsx +36 -97
- package/src/components/Staged.tsx +46 -0
- package/src/components/StartGuide.tsx +46 -0
- package/src/index.ts +2 -0
- package/src/screens/GameRoute.tsx +10 -2
- package/src/screens/HomeScreen.tsx +4 -9
- package/src/screens/StatsScreen.tsx +15 -1
- package/src/types.ts +20 -11
package/dist/index.js
CHANGED
|
@@ -45,6 +45,7 @@ __export(index_exports, {
|
|
|
45
45
|
ProfilesRoute: () => ProfilesRoute,
|
|
46
46
|
RootLayout: () => RootLayout,
|
|
47
47
|
SettingsDialog: () => SettingsDialog,
|
|
48
|
+
Staged: () => Staged,
|
|
48
49
|
StatsScreen: () => StatsScreen,
|
|
49
50
|
appSettingsActions: () => appSettingsActions,
|
|
50
51
|
appSettingsReducer: () => appSettingsSlice_default,
|
|
@@ -76,6 +77,7 @@ __export(index_exports, {
|
|
|
76
77
|
useAtComputer: () => useAtComputer,
|
|
77
78
|
useBackBlock: () => useBackBlock,
|
|
78
79
|
useGameGuide: () => useGameGuide,
|
|
80
|
+
useGuideCovering: () => useGuideCovering,
|
|
79
81
|
useOpponent: () => useOpponent,
|
|
80
82
|
usePack: () => usePack,
|
|
81
83
|
usePackGame: () => usePackGame,
|
|
@@ -110,7 +112,7 @@ var import_chrome2 = require("@tastic/hud/chrome");
|
|
|
110
112
|
var import_profile3 = require("@tastic/profile");
|
|
111
113
|
var Haptics = __toESM(require("expo-haptics"));
|
|
112
114
|
var import_expo_router = require("expo-router");
|
|
113
|
-
var
|
|
115
|
+
var import_react10 = require("react");
|
|
114
116
|
var import_react_native3 = require("react-native");
|
|
115
117
|
var import_react_native_gesture_handler = require("react-native-gesture-handler");
|
|
116
118
|
var RNPaper2 = __toESM(require("react-native-paper"));
|
|
@@ -139,6 +141,10 @@ function Fonts({ children }) {
|
|
|
139
141
|
}
|
|
140
142
|
|
|
141
143
|
// src/components/GuideHost.tsx
|
|
144
|
+
var import_react3 = require("react");
|
|
145
|
+
var import_react_redux2 = require("react-redux");
|
|
146
|
+
|
|
147
|
+
// src/components/GuideCards.tsx
|
|
142
148
|
var import_core = require("@tastic/core");
|
|
143
149
|
var import_guide = require("@tastic/hud/guide");
|
|
144
150
|
var import_react2 = require("react");
|
|
@@ -158,84 +164,74 @@ function humanSeatsFor(mode) {
|
|
|
158
164
|
}
|
|
159
165
|
var GUEST_PLAYER_ID = "guest";
|
|
160
166
|
|
|
161
|
-
// src/components/
|
|
167
|
+
// src/components/GuideCards.tsx
|
|
162
168
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
163
169
|
var PACK_GUIDE = "__pack__";
|
|
170
|
+
function startSubject(pack, game) {
|
|
171
|
+
if (game.guide) return game.guide.atStart ? game.id : null;
|
|
172
|
+
return pack.guide ? PACK_GUIDE : null;
|
|
173
|
+
}
|
|
174
|
+
function guideFor(pack, subject) {
|
|
175
|
+
return subject === PACK_GUIDE ? pack.guide : pack.games.find((g) => g.id === subject)?.guide;
|
|
176
|
+
}
|
|
164
177
|
var NO_INPUT = {};
|
|
165
|
-
|
|
166
|
-
function GuideHost({ children }) {
|
|
178
|
+
function GuideCards({ subject, visible, onClose }) {
|
|
167
179
|
const pack = usePack();
|
|
168
|
-
const [subject, setSubject] = (0, import_react2.useState)(() => pack.guide ? PACK_GUIDE : pack.games.find((g) => g.guide)?.id ?? null);
|
|
169
180
|
const packGuide = subject === PACK_GUIDE ? pack.guide : void 0;
|
|
170
181
|
const game = subject === PACK_GUIDE ? void 0 : pack.games.find((g) => g.id === subject);
|
|
171
182
|
const gameGuide = game?.guide;
|
|
183
|
+
const guide = packGuide ?? gameGuide;
|
|
172
184
|
const touch = (0, import_core.useIsTouchPrimaryDevice)();
|
|
173
185
|
const seatTwo = (0, import_react_redux.useSelector)((state) => state.opponent.seatTwo);
|
|
174
186
|
const input = (0, import_react_redux.useSelector)((state) => gameGuide ? gameGuide.selectInput(state) : NO_INPUT, import_react_redux.shallowEqual);
|
|
175
|
-
const
|
|
187
|
+
const seen = (0, import_react_redux.useSelector)((state) => !guide || guide.selectVersionSeen(state) >= guide.version);
|
|
176
188
|
const dispatch = (0, import_react_redux.useDispatch)();
|
|
177
189
|
const mode = roundModeFor(seatTwoFor(seatTwo, game?.seatTwo));
|
|
178
190
|
const steps = (0, import_react2.useMemo)(() => packGuide ? packGuide.getSteps({ touch }) : gameGuide ? gameGuide.getSteps(input, { touch, mode }) : [], [packGuide, gameGuide, input, touch, mode]);
|
|
179
|
-
const
|
|
180
|
-
(version)
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
);
|
|
186
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_guide.GuideProvider, { steps, currentVersion: (packGuide ?? gameGuide)?.version ?? 0, seenVersion, onSeen, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(GameGuideBridge, { onPick: setSubject, children }) });
|
|
191
|
+
const close = (0, import_react2.useCallback)(() => {
|
|
192
|
+
if (guide && !seen) dispatch(guide.markSeen(guide.version));
|
|
193
|
+
onClose?.();
|
|
194
|
+
}, [guide, seen, dispatch, onClose]);
|
|
195
|
+
const Dialog = pack.HowToPlay ?? import_guide.HowToPlayDialog;
|
|
196
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Dialog, { visible, steps, onFinish: close, onSkip: close });
|
|
187
197
|
}
|
|
188
|
-
|
|
198
|
+
|
|
199
|
+
// src/components/GuideHost.tsx
|
|
200
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
201
|
+
var GameGuideContext = (0, import_react3.createContext)(null);
|
|
202
|
+
function GuideHost({ children }) {
|
|
189
203
|
const pack = usePack();
|
|
190
|
-
const store = (0,
|
|
191
|
-
const
|
|
192
|
-
const
|
|
193
|
-
const wasOpen = (0, import_react2.useRef)(false);
|
|
194
|
-
const packAutoShown = (0, import_react2.useRef)(false);
|
|
195
|
-
(0, import_react2.useEffect)(() => {
|
|
196
|
-
if (wasOpen.current && !isOpen && pendingNext.current) {
|
|
197
|
-
const next = pendingNext.current;
|
|
198
|
-
pendingNext.current = null;
|
|
199
|
-
next();
|
|
200
|
-
}
|
|
201
|
-
wasOpen.current = isOpen;
|
|
202
|
-
}, [isOpen]);
|
|
203
|
-
const openFor = (0, import_react2.useCallback)(
|
|
204
|
+
const store = (0, import_react_redux2.useStore)();
|
|
205
|
+
const [shown, setShown] = (0, import_react3.useState)(null);
|
|
206
|
+
const openFor = (0, import_react3.useCallback)(
|
|
204
207
|
(gameId) => {
|
|
205
|
-
if (
|
|
206
|
-
onPick(gameId);
|
|
207
|
-
open();
|
|
208
|
+
if (guideFor(pack, gameId)) setShown({ subject: gameId });
|
|
208
209
|
},
|
|
209
|
-
[pack
|
|
210
|
+
[pack]
|
|
210
211
|
);
|
|
211
|
-
const openFirstTime = (0,
|
|
212
|
+
const openFirstTime = (0, import_react3.useCallback)(
|
|
212
213
|
(gameId, next) => {
|
|
213
214
|
const guide = pack.games.find((g) => g.id === gameId)?.guide;
|
|
214
|
-
if (!guide || guide.selectVersionSeen(store.getState()) >= guide.version)
|
|
215
|
-
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
pendingNext.current = next;
|
|
219
|
-
openFor(gameId);
|
|
215
|
+
if (!guide || guide.atStart || guide.selectVersionSeen(store.getState()) >= guide.version) next();
|
|
216
|
+
else setShown({ subject: gameId, next });
|
|
220
217
|
},
|
|
221
|
-
[pack, store
|
|
218
|
+
[pack, store]
|
|
222
219
|
);
|
|
223
|
-
const openPack = (0,
|
|
224
|
-
if (
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(GameGuideContext.Provider, { value, children });
|
|
220
|
+
const openPack = (0, import_react3.useCallback)(() => {
|
|
221
|
+
if (pack.guide) setShown({ subject: PACK_GUIDE });
|
|
222
|
+
}, [pack]);
|
|
223
|
+
const handleClose = (0, import_react3.useCallback)(() => {
|
|
224
|
+
setShown(null);
|
|
225
|
+
shown?.next?.();
|
|
226
|
+
}, [shown]);
|
|
227
|
+
const value = (0, import_react3.useMemo)(() => ({ openFirstTime, openFor, openPack }), [openFirstTime, openFor, openPack]);
|
|
228
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(GameGuideContext.Provider, { value, children: [
|
|
229
|
+
children,
|
|
230
|
+
shown && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(GuideCards, { subject: shown.subject, visible: true, onClose: handleClose })
|
|
231
|
+
] });
|
|
236
232
|
}
|
|
237
233
|
function useGameGuide() {
|
|
238
|
-
const ctx = (0,
|
|
234
|
+
const ctx = (0, import_react3.useContext)(GameGuideContext);
|
|
239
235
|
if (!ctx) throw new Error("useGameGuide must be used within a GuideHost");
|
|
240
236
|
return ctx;
|
|
241
237
|
}
|
|
@@ -246,42 +242,42 @@ var import_feedback_press = require("@rific/feedback-press");
|
|
|
246
242
|
var import_audio = require("@rific/feedback-press/audio");
|
|
247
243
|
var import_edge_guard = require("@tastic/edge-guard");
|
|
248
244
|
var ExpoKeepAwake = __toESM(require("expo-keep-awake"));
|
|
249
|
-
var
|
|
245
|
+
var import_react4 = require("react");
|
|
250
246
|
var RNPaper = __toESM(require("react-native-paper"));
|
|
251
|
-
var
|
|
252
|
-
var
|
|
253
|
-
var
|
|
247
|
+
var import_react_redux3 = require("react-redux");
|
|
248
|
+
var import_react5 = require("redux-persist/integration/react");
|
|
249
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
254
250
|
function useShellFeedbackSounds() {
|
|
255
|
-
const enabled = (0,
|
|
251
|
+
const enabled = (0, import_react_redux3.useSelector)((state) => state.sound.enabled);
|
|
256
252
|
const selection = (0, import_audio.useAudioPool)(require("./select-MLBNNA4N.wav"), { enabled });
|
|
257
253
|
const notification = (0, import_audio.useAudioPool)(require("./notification-CGGFPYK7.wav"), { enabled });
|
|
258
254
|
return { selection, notification };
|
|
259
255
|
}
|
|
260
256
|
var FeedbackBridge = ({ children }) => {
|
|
261
|
-
const haptic = (0,
|
|
262
|
-
const sound = (0,
|
|
263
|
-
const dispatch = (0,
|
|
264
|
-
const onChange = (0,
|
|
265
|
-
const onSoundChange = (0,
|
|
257
|
+
const haptic = (0, import_react_redux3.useSelector)((state) => state.haptic);
|
|
258
|
+
const sound = (0, import_react_redux3.useSelector)((state) => state.sound);
|
|
259
|
+
const dispatch = (0, import_react_redux3.useDispatch)();
|
|
260
|
+
const onChange = (0, import_react4.useCallback)((next) => dispatch(import_feedback_press.hapticActions.initialize(next)), [dispatch]);
|
|
261
|
+
const onSoundChange = (0, import_react4.useCallback)((next) => dispatch(import_feedback_press.soundActions.initialize(next)), [dispatch]);
|
|
266
262
|
const { useFeedbackSounds = useShellFeedbackSounds } = usePack();
|
|
267
263
|
const sounds = useFeedbackSounds();
|
|
268
264
|
const bridgeProps = (0, import_feedback_press.useFeedbackBridgeProps)({ initialValue: haptic, onChange, soundInitialValue: sound, onSoundChange, sound: sounds });
|
|
269
|
-
return /* @__PURE__ */ (0,
|
|
265
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_feedback_press.FeedbackPressProvider, { ...bridgeProps, paper: RNPaper, children });
|
|
270
266
|
};
|
|
271
267
|
var EdgeGuardBridge = ({ children }) => {
|
|
272
|
-
const deferBottomEdgeGestures = (0,
|
|
273
|
-
const activelyPlaying = (0,
|
|
268
|
+
const deferBottomEdgeGestures = (0, import_react_redux3.useSelector)((state) => state.appSettings.deferBottomEdgeGestures);
|
|
269
|
+
const activelyPlaying = (0, import_react_redux3.useSelector)((state) => state.liveplay.activelyPlaying);
|
|
274
270
|
(0, import_edge_guard.useEdgeGestureGuard)(deferBottomEdgeGestures && activelyPlaying);
|
|
275
|
-
return /* @__PURE__ */ (0,
|
|
271
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children });
|
|
276
272
|
};
|
|
277
273
|
var KeepAwakeBridge = ({ children }) => {
|
|
278
|
-
const keepAwake = (0,
|
|
279
|
-
const dispatch = (0,
|
|
280
|
-
const onChange = (0,
|
|
281
|
-
return /* @__PURE__ */ (0,
|
|
274
|
+
const keepAwake = (0, import_react_redux3.useSelector)((state) => state.keepAwake);
|
|
275
|
+
const dispatch = (0, import_react_redux3.useDispatch)();
|
|
276
|
+
const onChange = (0, import_react4.useCallback)((settings) => dispatch(import_core2.keepAwakeActions.initialize(settings)), [dispatch]);
|
|
277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_core2.KeepAwakeProvider, { expoKeepAwake: ExpoKeepAwake, initialValue: keepAwake, onChange, children });
|
|
282
278
|
};
|
|
283
279
|
function Providers({ store, persistor, children }) {
|
|
284
|
-
return /* @__PURE__ */ (0,
|
|
280
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_redux3.Provider, { store, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react5.PersistGate, { persistor, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(EdgeGuardBridge, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FeedbackBridge, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(KeepAwakeBridge, { children }) }) }) }) });
|
|
285
281
|
}
|
|
286
282
|
|
|
287
283
|
// src/components/Theme.tsx
|
|
@@ -289,44 +285,44 @@ var import_masked_view = __toESM(require("@react-native-masked-view/masked-view"
|
|
|
289
285
|
var import_auto_paper = require("@rific/auto-paper");
|
|
290
286
|
var ExpoBlur = __toESM(require("expo-blur"));
|
|
291
287
|
var SplashScreen = __toESM(require("expo-splash-screen"));
|
|
292
|
-
var
|
|
288
|
+
var import_react6 = require("react");
|
|
293
289
|
var import_react_native_reanimated = __toESM(require("react-native-reanimated"));
|
|
294
|
-
var
|
|
295
|
-
var
|
|
290
|
+
var import_react_redux4 = require("react-redux");
|
|
291
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
296
292
|
SplashScreen.preventAutoHideAsync();
|
|
297
293
|
SplashScreen.setOptions({ fade: true, duration: 400 });
|
|
298
294
|
function Theme({ children }) {
|
|
299
295
|
const { fontFamily } = usePack();
|
|
300
|
-
const settings = (0,
|
|
301
|
-
const dispatch = (0,
|
|
302
|
-
const onReady = (0,
|
|
303
|
-
const onChange = (0,
|
|
296
|
+
const settings = (0, import_react_redux4.useSelector)((state) => state.theme, import_react_redux4.shallowEqual);
|
|
297
|
+
const dispatch = (0, import_react_redux4.useDispatch)();
|
|
298
|
+
const onReady = (0, import_react6.useCallback)(() => markSplashReady("theme"), []);
|
|
299
|
+
const onChange = (0, import_react6.useCallback)((next) => dispatch(import_auto_paper.themeActions.initialize(next)), [dispatch]);
|
|
304
300
|
const bridgeProps = (0, import_auto_paper.useThemeBridgeProps)({ initialValue: settings, onChange, onReady });
|
|
305
|
-
return /* @__PURE__ */ (0,
|
|
301
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_auto_paper.Provider, { ...bridgeProps, expoBlur: ExpoBlur, maskedView: import_masked_view.default, statusBar: false, reanimated: import_react_native_reanimated.default, fontFamily, children });
|
|
306
302
|
}
|
|
307
303
|
|
|
308
304
|
// src/components/UpdateDialog.tsx
|
|
309
305
|
var import_toaster = require("@rific/toaster");
|
|
310
306
|
var import_chrome = require("@tastic/hud/chrome");
|
|
311
|
-
var
|
|
307
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
312
308
|
function UpdateDialog() {
|
|
313
309
|
const onError = (0, import_toaster.useUpdateErrorToast)();
|
|
314
|
-
return /* @__PURE__ */ (0,
|
|
310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_chrome.UpdateDialog, { onError });
|
|
315
311
|
}
|
|
316
312
|
|
|
317
313
|
// src/components/WindowControlsInsets.tsx
|
|
318
314
|
var import_react_native2 = require("react-native");
|
|
319
315
|
var import_react_native_safe_area_context = require("react-native-safe-area-context");
|
|
320
|
-
var
|
|
316
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
321
317
|
function WindowControlsInsets({ children }) {
|
|
322
318
|
const vertical = (0, import_react_native_safe_area_context.useSafeAreaInsets)({ cornerAdaptation: "vertical" });
|
|
323
|
-
if (import_react_native2.Platform.OS !== "ios" || !import_react_native2.Platform.isPad) return /* @__PURE__ */ (0,
|
|
324
|
-
return /* @__PURE__ */ (0,
|
|
319
|
+
if (import_react_native2.Platform.OS !== "ios" || !import_react_native2.Platform.isPad) return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children });
|
|
320
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_native_safe_area_context.SafeAreaInsetsContext.Provider, { value: vertical, children });
|
|
325
321
|
}
|
|
326
322
|
|
|
327
323
|
// src/hooks/useAppSettings.ts
|
|
328
|
-
var
|
|
329
|
-
var
|
|
324
|
+
var import_react7 = require("react");
|
|
325
|
+
var import_react_redux5 = require("react-redux");
|
|
330
326
|
|
|
331
327
|
// src/redux/appSettingsSlice.ts
|
|
332
328
|
var import_core3 = require("@rific/core");
|
|
@@ -343,9 +339,9 @@ var appSettingsSlice_default = reducer;
|
|
|
343
339
|
|
|
344
340
|
// src/hooks/useAppSettings.ts
|
|
345
341
|
function useAppSettings() {
|
|
346
|
-
const settings = (0,
|
|
347
|
-
const dispatch = (0,
|
|
348
|
-
const setSettings = (0,
|
|
342
|
+
const settings = (0, import_react_redux5.useSelector)((state) => state.appSettings);
|
|
343
|
+
const dispatch = (0, import_react_redux5.useDispatch)();
|
|
344
|
+
const setSettings = (0, import_react7.useCallback)(
|
|
349
345
|
(patch) => {
|
|
350
346
|
dispatch(appSettingsActions.initialize(patch));
|
|
351
347
|
},
|
|
@@ -355,8 +351,8 @@ function useAppSettings() {
|
|
|
355
351
|
}
|
|
356
352
|
|
|
357
353
|
// src/hooks/useLastActiveGame.tsx
|
|
358
|
-
var
|
|
359
|
-
var
|
|
354
|
+
var import_react8 = require("react");
|
|
355
|
+
var import_react_redux6 = require("react-redux");
|
|
360
356
|
|
|
361
357
|
// src/redux/lastActiveGameSlice.ts
|
|
362
358
|
var import_core4 = require("@rific/core");
|
|
@@ -365,17 +361,17 @@ var lastActiveGameActions = actions2;
|
|
|
365
361
|
var lastActiveGameSlice_default = reducer2;
|
|
366
362
|
|
|
367
363
|
// src/hooks/useLastActiveGame.tsx
|
|
368
|
-
var
|
|
369
|
-
var LastActiveGameContext = (0,
|
|
364
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
365
|
+
var LastActiveGameContext = (0, import_react8.createContext)(null);
|
|
370
366
|
function LastActiveGameProvider({ children }) {
|
|
371
|
-
const store = (0,
|
|
372
|
-
const dispatch = (0,
|
|
373
|
-
const [initial] = (0,
|
|
374
|
-
const pendingResume = (0,
|
|
375
|
-
const persisted = (0,
|
|
376
|
-
const resume = (0,
|
|
377
|
-
const resumeListeners = (0,
|
|
378
|
-
const value = (0,
|
|
367
|
+
const store = (0, import_react_redux6.useStore)();
|
|
368
|
+
const dispatch = (0, import_react_redux6.useDispatch)();
|
|
369
|
+
const [initial] = (0, import_react8.useState)(() => store.getState().lastActiveGame?.gameId ?? null);
|
|
370
|
+
const pendingResume = (0, import_react8.useRef)(initial);
|
|
371
|
+
const persisted = (0, import_react8.useRef)(initial);
|
|
372
|
+
const resume = (0, import_react8.useRef)("idle");
|
|
373
|
+
const resumeListeners = (0, import_react8.useRef)(/* @__PURE__ */ new Set());
|
|
374
|
+
const value = (0, import_react8.useMemo)(() => {
|
|
379
375
|
const setResume = (next) => {
|
|
380
376
|
if (resume.current === next) return;
|
|
381
377
|
resume.current = next;
|
|
@@ -415,18 +411,18 @@ function LastActiveGameProvider({ children }) {
|
|
|
415
411
|
}
|
|
416
412
|
};
|
|
417
413
|
}, [dispatch]);
|
|
418
|
-
return /* @__PURE__ */ (0,
|
|
414
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(LastActiveGameContext.Provider, { value, children });
|
|
419
415
|
}
|
|
420
416
|
function useLastActiveGame() {
|
|
421
|
-
const ctx = (0,
|
|
417
|
+
const ctx = (0, import_react8.useContext)(LastActiveGameContext);
|
|
422
418
|
if (!ctx) throw new Error("useLastActiveGame must be used within a LastActiveGameProvider");
|
|
423
419
|
return ctx;
|
|
424
420
|
}
|
|
425
421
|
|
|
426
422
|
// src/hooks/useProfiles.tsx
|
|
427
423
|
var import_profile2 = require("@tastic/profile");
|
|
428
|
-
var
|
|
429
|
-
var
|
|
424
|
+
var import_react9 = require("react");
|
|
425
|
+
var import_react_redux7 = require("react-redux");
|
|
430
426
|
|
|
431
427
|
// src/redux/profileSelectionSlice.ts
|
|
432
428
|
var import_profile = require("@tastic/profile");
|
|
@@ -436,15 +432,15 @@ var profileSelectionActions = actions3;
|
|
|
436
432
|
var profileSelectionSlice_default = reducer3;
|
|
437
433
|
|
|
438
434
|
// src/hooks/useProfiles.tsx
|
|
439
|
-
var
|
|
435
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
440
436
|
var SHARED_GROUP_ID = "group.com.infinitetoken.tastic";
|
|
441
|
-
var ProfilesContext = (0,
|
|
437
|
+
var ProfilesContext = (0, import_react9.createContext)(null);
|
|
442
438
|
function ProfilesProvider({ children }) {
|
|
443
|
-
const profiles = (0,
|
|
444
|
-
const lastSelected = (0,
|
|
445
|
-
const dispatch = (0,
|
|
446
|
-
const [loaded, setLoaded] = (0,
|
|
447
|
-
(0,
|
|
439
|
+
const profiles = (0, import_react_redux7.useSelector)((state) => state.profiles);
|
|
440
|
+
const lastSelected = (0, import_react_redux7.useSelector)((state) => state.profileSelection);
|
|
441
|
+
const dispatch = (0, import_react_redux7.useDispatch)();
|
|
442
|
+
const [loaded, setLoaded] = (0, import_react9.useState)(false);
|
|
443
|
+
(0, import_react9.useEffect)(() => {
|
|
448
444
|
let cancelled = false;
|
|
449
445
|
(0, import_profile2.resolveInitialProfiles)(SHARED_GROUP_ID, profiles).then((resolved) => {
|
|
450
446
|
if (cancelled) return;
|
|
@@ -458,7 +454,7 @@ function ProfilesProvider({ children }) {
|
|
|
458
454
|
}, []);
|
|
459
455
|
const { syncToShared } = (0, import_profile2.useSharedProfilesSync)({
|
|
460
456
|
groupId: SHARED_GROUP_ID,
|
|
461
|
-
onRemoteChange: (0,
|
|
457
|
+
onRemoteChange: (0, import_react9.useCallback)(
|
|
462
458
|
(remote) => {
|
|
463
459
|
dispatch(import_profile2.profilesActions.setAll(remote));
|
|
464
460
|
dispatch(profileSelectionActions.pruneToRoster(remote.map((p) => p.id)));
|
|
@@ -466,7 +462,7 @@ function ProfilesProvider({ children }) {
|
|
|
466
462
|
[dispatch]
|
|
467
463
|
)
|
|
468
464
|
});
|
|
469
|
-
const createProfile = (0,
|
|
465
|
+
const createProfile = (0, import_react9.useCallback)(
|
|
470
466
|
(input) => {
|
|
471
467
|
const record = (0, import_profile2.createProfileRecord)(input);
|
|
472
468
|
dispatch(import_profile2.profilesActions.add(record));
|
|
@@ -475,14 +471,14 @@ function ProfilesProvider({ children }) {
|
|
|
475
471
|
},
|
|
476
472
|
[profiles, dispatch, syncToShared]
|
|
477
473
|
);
|
|
478
|
-
const updateProfile = (0,
|
|
474
|
+
const updateProfile = (0, import_react9.useCallback)(
|
|
479
475
|
(id, patch) => {
|
|
480
476
|
dispatch(import_profile2.profilesActions.update({ id, patch }));
|
|
481
477
|
syncToShared(profiles.map((p) => p.id === id ? { ...p, ...patch, updatedAt: Date.now() } : p));
|
|
482
478
|
},
|
|
483
479
|
[profiles, dispatch, syncToShared]
|
|
484
480
|
);
|
|
485
|
-
const deleteProfile = (0,
|
|
481
|
+
const deleteProfile = (0, import_react9.useCallback)(
|
|
486
482
|
(id) => {
|
|
487
483
|
dispatch(import_profile2.profilesActions.remove(id));
|
|
488
484
|
syncToShared(profiles.filter((p) => p.id !== id));
|
|
@@ -490,22 +486,22 @@ function ProfilesProvider({ children }) {
|
|
|
490
486
|
},
|
|
491
487
|
[profiles, dispatch, syncToShared]
|
|
492
488
|
);
|
|
493
|
-
const selectProfile = (0,
|
|
489
|
+
const selectProfile = (0, import_react9.useCallback)(
|
|
494
490
|
(seat, profileId) => {
|
|
495
491
|
dispatch(profileSelectionActions.select({ profileId, seat }));
|
|
496
492
|
},
|
|
497
493
|
[dispatch]
|
|
498
494
|
);
|
|
499
|
-
return /* @__PURE__ */ (0,
|
|
495
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ProfilesContext.Provider, { value: { profiles, lastSelected, loaded, createProfile, updateProfile, deleteProfile, selectProfile }, children });
|
|
500
496
|
}
|
|
501
497
|
function useProfiles() {
|
|
502
|
-
const ctx = (0,
|
|
498
|
+
const ctx = (0, import_react9.useContext)(ProfilesContext);
|
|
503
499
|
if (!ctx) throw new Error("useProfiles must be used within a ProfilesProvider");
|
|
504
500
|
return ctx;
|
|
505
501
|
}
|
|
506
502
|
|
|
507
503
|
// src/RootLayout.tsx
|
|
508
|
-
var
|
|
504
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
509
505
|
var PLAY_OPTIONS = { statusBarHidden: true };
|
|
510
506
|
var KEEP_STATUS_BAR_OPTIONS = {};
|
|
511
507
|
var REPLACE_AS_BACK = { animationTypeForReplace: "pop" };
|
|
@@ -514,8 +510,8 @@ var TRANSPARENT_CONTENT = { backgroundColor: "transparent" };
|
|
|
514
510
|
var noScreenOptions = () => ({});
|
|
515
511
|
function useFirstScreenGate() {
|
|
516
512
|
const { resumeState, subscribeResume } = useLastActiveGame();
|
|
517
|
-
const marked = (0,
|
|
518
|
-
return (0,
|
|
513
|
+
const marked = (0, import_react10.useRef)(false);
|
|
514
|
+
return (0, import_react10.useCallback)(() => {
|
|
519
515
|
if (marked.current) return;
|
|
520
516
|
marked.current = true;
|
|
521
517
|
const mark = () => requestAnimationFrame(() => requestAnimationFrame(() => markSplashReady("screen")));
|
|
@@ -536,7 +532,7 @@ function useFirstScreenGate() {
|
|
|
536
532
|
}
|
|
537
533
|
function useResumeShown() {
|
|
538
534
|
const { endResume } = useLastActiveGame();
|
|
539
|
-
return (0,
|
|
535
|
+
return (0, import_react10.useCallback)(
|
|
540
536
|
({ route }) => ({
|
|
541
537
|
transitionEnd: (event) => {
|
|
542
538
|
if (route.name === PLAY_ROUTE && !event.data?.closing) endResume();
|
|
@@ -559,8 +555,8 @@ function AppStack() {
|
|
|
559
555
|
const backdropOptions = Backdrop ? { contentStyle: TRANSPARENT_CONTENT, animation: import_react_native3.Platform.select({ android: "fade" }) } : void 0;
|
|
560
556
|
const { edgeGuard = true } = pack;
|
|
561
557
|
const { deferBottomEdgeGestures } = useAppSettings().settings;
|
|
562
|
-
const edgeGuardOptions = (0,
|
|
563
|
-
const playOptions = (0,
|
|
558
|
+
const edgeGuardOptions = (0, import_react10.useMemo)(() => (0, import_edge_guard2.edgeGuardScreenOptions)(edgeGuard && deferBottomEdgeGestures), [edgeGuard, deferBottomEdgeGestures]);
|
|
559
|
+
const playOptions = (0, import_react10.useCallback)(
|
|
564
560
|
({ route }) => {
|
|
565
561
|
const id = route.params?.game;
|
|
566
562
|
const statusBarOptions = pack.games.some((g) => g.id === id && g.keepStatusBar) ? KEEP_STATUS_BAR_OPTIONS : PLAY_OPTIONS;
|
|
@@ -569,58 +565,58 @@ function AppStack() {
|
|
|
569
565
|
[pack.games, edgeGuardOptions]
|
|
570
566
|
);
|
|
571
567
|
const navigationBackground = Backdrop ? TRANSPARENT_CONTENT.backgroundColor : rootBackground.contentStyle.backgroundColor;
|
|
572
|
-
const navigationTheme = (0,
|
|
568
|
+
const navigationTheme = (0, import_react10.useMemo)(() => {
|
|
573
569
|
const base = darkRoot ? import_expo_router.DarkTheme : import_expo_router.DefaultTheme;
|
|
574
570
|
return { ...base, colors: { ...base.colors, background: navigationBackground } };
|
|
575
571
|
}, [darkRoot, navigationBackground]);
|
|
576
|
-
return /* @__PURE__ */ (0,
|
|
577
|
-
Backdrop && /* @__PURE__ */ (0,
|
|
578
|
-
/* @__PURE__ */ (0,
|
|
579
|
-
/* @__PURE__ */ (0,
|
|
580
|
-
/* @__PURE__ */ (0,
|
|
572
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react_native3.View, { style: styles.root, onLayout: onFirstLayout, children: [
|
|
573
|
+
Backdrop && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Backdrop, {}),
|
|
574
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_expo_router.ThemeProvider, { value: navigationTheme, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_expo_router.Stack, { screenListeners, screenOptions: { ...rootBackground, statusBarStyle, ...REPLACE_AS_BACK, ...backdropOptions, ...packOptions }, children: [
|
|
575
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_expo_router.Stack.Screen, { name: "index" }),
|
|
576
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_expo_router.Stack.Screen, { name: PLAY_ROUTE, options: playOptions })
|
|
581
577
|
] }) })
|
|
582
578
|
] });
|
|
583
579
|
}
|
|
584
580
|
function GatedApp({ children }) {
|
|
585
581
|
const { loaded } = useProfiles();
|
|
586
|
-
return /* @__PURE__ */ (0,
|
|
582
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SplashGate, { gate: "profiles", ready: loaded, children });
|
|
587
583
|
}
|
|
588
584
|
function HapticGatedToastProvider({ children }) {
|
|
589
585
|
const { settings } = (0, import_feedback_press2.useHapticSettings)();
|
|
590
586
|
const { Toaster: PackToasterComponent } = usePack();
|
|
591
|
-
return /* @__PURE__ */ (0,
|
|
587
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_toaster2.ToastProvider, { haptics: settings.vibrate ? Haptics : void 0, paper: PackToasterComponent ? void 0 : RNPaper2, children });
|
|
592
588
|
}
|
|
593
589
|
function FramedToaster() {
|
|
594
|
-
const renderFrame = (0,
|
|
595
|
-
return /* @__PURE__ */ (0,
|
|
590
|
+
const renderFrame = (0, import_react10.useCallback)((toasts) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_chrome2.ScreenFrame, { passThrough: true, children: toasts }), []);
|
|
591
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_toaster2.Toaster, { historyButton: null, clearButton: null, limit: 1, renderFrame });
|
|
596
592
|
}
|
|
597
593
|
function PackToaster({ Toaster: PackToasterComponent }) {
|
|
598
|
-
return /* @__PURE__ */ (0,
|
|
594
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native3.View, { style: import_react_native3.StyleSheet.absoluteFill, pointerEvents: "box-none", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_chrome2.ScreenFrame, { passThrough: true, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PackToasterComponent, {}) }) });
|
|
599
595
|
}
|
|
600
596
|
function GameProviders({ games, children }) {
|
|
601
|
-
return games.reduceRight((inner, game) => game.Provider ? /* @__PURE__ */ (0,
|
|
597
|
+
return games.reduceRight((inner, game) => game.Provider ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(game.Provider, { children: inner }, game.id) : inner, children);
|
|
602
598
|
}
|
|
603
599
|
function PreviewColors({ previewColor, children }) {
|
|
604
600
|
const { dark } = (0, import_auto_paper2.useAutoPaperTheme)();
|
|
605
|
-
const preview = (0,
|
|
606
|
-
return /* @__PURE__ */ (0,
|
|
601
|
+
const preview = (0, import_react10.useCallback)((hex) => previewColor(hex, dark), [previewColor, dark]);
|
|
602
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_profile3.ProfileColorProvider, { preview, children });
|
|
607
603
|
}
|
|
608
604
|
function PackRoot({ pack, children }) {
|
|
609
605
|
const { Provider, previewColor } = pack;
|
|
610
|
-
const inner = Provider ? /* @__PURE__ */ (0,
|
|
611
|
-
return previewColor ? /* @__PURE__ */ (0,
|
|
606
|
+
const inner = Provider ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Provider, { children }) : children;
|
|
607
|
+
return previewColor ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PreviewColors, { previewColor, children: inner }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_jsx_runtime11.Fragment, { children: inner });
|
|
612
608
|
}
|
|
613
609
|
function DialogTitles({ children }) {
|
|
614
610
|
const { titleStyle, labelStyle } = usePack();
|
|
615
|
-
const lettered = /* @__PURE__ */ (0,
|
|
611
|
+
const lettered = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_chrome2.LetteringProvider, { title: titleStyle, label: labelStyle, children });
|
|
616
612
|
if (!titleStyle) return lettered;
|
|
617
|
-
return /* @__PURE__ */ (0,
|
|
613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_chrome2.DialogHeaderStyleProvider, { tone: "standard", titleStyle, children: lettered });
|
|
618
614
|
}
|
|
619
615
|
function RootLayout({ pack, store, persistor }) {
|
|
620
|
-
return /* @__PURE__ */ (0,
|
|
621
|
-
/* @__PURE__ */ (0,
|
|
622
|
-
pack.Toaster ? /* @__PURE__ */ (0,
|
|
623
|
-
/* @__PURE__ */ (0,
|
|
616
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native_gesture_handler.GestureHandlerRootView, { style: styles.root, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native_safe_area_context2.SafeAreaProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(WindowControlsInsets, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PackProvider, { pack, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Fonts, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Providers, { store, persistor, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DialogTitles, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Theme, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ProfilesProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(LastActiveGameProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(GameProviders, { games: pack.games, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PackRoot, { pack, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(GatedApp, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(HapticGatedToastProvider, { children: [
|
|
617
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(GuideHost, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AppStack, {}) }),
|
|
618
|
+
pack.Toaster ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PackToaster, { Toaster: pack.Toaster }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FramedToaster, {}),
|
|
619
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(UpdateDialog, {})
|
|
624
620
|
] }) }) }) }) }) }) }) }) }) }) }) }) }) });
|
|
625
621
|
}
|
|
626
622
|
var styles = import_react_native3.StyleSheet.create({
|
|
@@ -651,24 +647,24 @@ var seatParam = (value) => value === "1" ? 1 : value === "2" ? 2 : null;
|
|
|
651
647
|
var import_chrome3 = require("@tastic/hud/chrome");
|
|
652
648
|
var import_profile4 = require("@tastic/profile");
|
|
653
649
|
var import_expo_router3 = require("expo-router");
|
|
654
|
-
var
|
|
650
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
655
651
|
var ROSTER_MAX_WIDTH = 640;
|
|
656
652
|
function ProfilesRoute() {
|
|
657
653
|
const { seat } = (0, import_expo_router3.useLocalSearchParams)();
|
|
658
654
|
const opener = seatParam(seat);
|
|
659
655
|
const { profiles } = useProfiles();
|
|
660
656
|
const { Backdrop, foreground } = usePack();
|
|
661
|
-
return /* @__PURE__ */ (0,
|
|
657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_chrome3.ScreenFrame, { maxContentWidth: ROSTER_MAX_WIDTH, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_profile4.ProfilesScreen, { profiles, onEdit: (id) => import_expo_router3.router.push(profileHref(id, id === import_profile4.NEW_PROFILE_ID ? opener : null)), onBack: import_core6.safeBack, fg: foreground, bg: Backdrop ? "transparent" : void 0 }) });
|
|
662
658
|
}
|
|
663
659
|
|
|
664
660
|
// src/screens/EditProfileRoute.tsx
|
|
665
|
-
var
|
|
661
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
666
662
|
function EditProfileRoute() {
|
|
667
663
|
const { id, seat } = (0, import_expo_router4.useLocalSearchParams)();
|
|
668
664
|
const opener = seatParam(seat);
|
|
669
665
|
const { profiles, createProfile, updateProfile, deleteProfile, selectProfile } = useProfiles();
|
|
670
666
|
const { Backdrop, foreground, newProfileColor, ProfileSections } = usePack();
|
|
671
|
-
return /* @__PURE__ */ (0,
|
|
667
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_chrome4.ScreenFrame, { portalHost: true, maxContentWidth: ROSTER_MAX_WIDTH, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
672
668
|
import_profile5.EditProfileScreen,
|
|
673
669
|
{
|
|
674
670
|
profileId: id,
|
|
@@ -683,36 +679,65 @@ function EditProfileRoute() {
|
|
|
683
679
|
onBack: import_core6.safeBack,
|
|
684
680
|
fg: foreground,
|
|
685
681
|
bg: Backdrop ? "transparent" : void 0,
|
|
686
|
-
sections: ProfileSections ? (profile) => /* @__PURE__ */ (0,
|
|
682
|
+
sections: ProfileSections ? (profile) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ProfileSections, { profile }) : void 0
|
|
687
683
|
}
|
|
688
684
|
) });
|
|
689
685
|
}
|
|
690
686
|
|
|
691
687
|
// src/screens/GameRoute.tsx
|
|
692
|
-
var
|
|
693
|
-
var
|
|
688
|
+
var import_expo_router9 = require("expo-router");
|
|
689
|
+
var import_react16 = require("react");
|
|
694
690
|
var import_react_native7 = require("react-native");
|
|
695
691
|
|
|
692
|
+
// src/components/StartGuide.tsx
|
|
693
|
+
var import_expo_router5 = require("expo-router");
|
|
694
|
+
var import_react11 = require("react");
|
|
695
|
+
var import_react_redux8 = require("react-redux");
|
|
696
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
697
|
+
var GUIDE_DELAY_MS = 700;
|
|
698
|
+
var GuideCoveringContext = (0, import_react11.createContext)(false);
|
|
699
|
+
function useGuideCovering() {
|
|
700
|
+
return (0, import_react11.useContext)(GuideCoveringContext);
|
|
701
|
+
}
|
|
702
|
+
function StartGuide({ game, enabled, children }) {
|
|
703
|
+
const pack = usePack();
|
|
704
|
+
const focused = (0, import_expo_router5.useIsFocused)();
|
|
705
|
+
const subject = enabled ? startSubject(pack, game) : null;
|
|
706
|
+
const guide = guideFor(pack, subject);
|
|
707
|
+
const covering = (0, import_react_redux8.useSelector)((state) => !!guide && guide.selectVersionSeen(state) < guide.version);
|
|
708
|
+
const [due, setDue] = (0, import_react11.useState)(false);
|
|
709
|
+
const waiting = covering && focused && !due;
|
|
710
|
+
(0, import_react11.useEffect)(() => {
|
|
711
|
+
if (!waiting) return;
|
|
712
|
+
const timeout = setTimeout(() => setDue(true), GUIDE_DELAY_MS);
|
|
713
|
+
return () => clearTimeout(timeout);
|
|
714
|
+
}, [waiting]);
|
|
715
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(GuideCoveringContext.Provider, { value: covering, children: [
|
|
716
|
+
children,
|
|
717
|
+
subject !== null && covering && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(GuideCards, { subject, visible: due && focused })
|
|
718
|
+
] });
|
|
719
|
+
}
|
|
720
|
+
|
|
696
721
|
// src/screens/LoadoutScreen.tsx
|
|
697
722
|
var import_auto_paper5 = require("@rific/auto-paper");
|
|
698
723
|
var import_core10 = require("@tastic/core");
|
|
699
724
|
var import_chrome6 = require("@tastic/hud/chrome");
|
|
700
725
|
var import_lobby2 = require("@tastic/hud/lobby");
|
|
701
726
|
var import_split_screen = require("@tastic/split-screen");
|
|
702
|
-
var
|
|
703
|
-
var
|
|
727
|
+
var import_expo_router8 = require("expo-router");
|
|
728
|
+
var import_react15 = require("react");
|
|
704
729
|
var import_react_native6 = require("react-native");
|
|
705
730
|
var import_react_native_paper = require("react-native-paper");
|
|
706
731
|
var import_react_native_reanimated2 = __toESM(require("react-native-reanimated"));
|
|
707
732
|
var import_react_native_safe_area_context3 = require("react-native-safe-area-context");
|
|
708
|
-
var
|
|
733
|
+
var import_react_redux11 = require("react-redux");
|
|
709
734
|
|
|
710
735
|
// src/components/OpponentPicker.tsx
|
|
711
736
|
var import_lobby = require("@tastic/hud/lobby");
|
|
712
737
|
var import_profile6 = require("@tastic/profile");
|
|
713
|
-
var
|
|
738
|
+
var import_react12 = require("react");
|
|
714
739
|
var import_react_native4 = require("react-native");
|
|
715
|
-
var
|
|
740
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
716
741
|
var CPU_PREFIX = "cpu:";
|
|
717
742
|
var NOBODY = "nobody";
|
|
718
743
|
var PERSON = "person";
|
|
@@ -725,7 +750,7 @@ function getOpponentPopoverId(idPrefix) {
|
|
|
725
750
|
function OpponentPicker({ idPrefix, host, choices, seatTwo, onSeatTwoChange, cpuDifficulty, color, onColorChange, swatches, takenColor, allowSwapTaken, dark, previewValue, triggerStyle, usePickerAlign }) {
|
|
726
751
|
const drawn = previewValue ? previewValue(color) : color;
|
|
727
752
|
const cpuOptions = cpuDifficulty?.options;
|
|
728
|
-
const options = (0,
|
|
753
|
+
const options = (0, import_react12.useMemo)(() => {
|
|
729
754
|
const list = [];
|
|
730
755
|
if (choices.includes("cpu")) list.push(...cpuOptions ? cpuOptions.map((o) => ({ value: `${CPU_PREFIX}${o.value}`, label: o.label, icon: o.icon })) : [{ value: CPU_PREFIX, label: "CPU", icon: CPU_ICON }]);
|
|
731
756
|
if (choices.includes("nobody")) list.push({ value: NOBODY, label: "Solo", icon: NOBODY_ICON, dividerBefore: true });
|
|
@@ -747,7 +772,7 @@ function OpponentPicker({ idPrefix, host, choices, seatTwo, onSeatTwoChange, cpu
|
|
|
747
772
|
const size = (0, import_profile6.getOptionPickerContentSize)(options, colorSection);
|
|
748
773
|
const useAlign = usePickerAlign ?? import_lobby.useZoneClampedAlign;
|
|
749
774
|
const align = useAlign(host.openId === pickerId, size.width, size.height);
|
|
750
|
-
return /* @__PURE__ */ (0,
|
|
775
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native4.View, { style: [styles2.button, host.openId === pickerId && styles2.buttonOpen], children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_profile6.OptionPicker, { id: pickerId, host, caption: "Opponent", options, value, onChange: handleChange, color: drawn, dark, icon, colorSection, alignOverride: align, triggerStyle }) });
|
|
751
776
|
}
|
|
752
777
|
var styles2 = import_react_native4.StyleSheet.create({
|
|
753
778
|
// Its own column, so a row of seat buttons doesn't stretch the pill to the tallest of them.
|
|
@@ -763,8 +788,8 @@ var styles2 = import_react_native4.StyleSheet.create({
|
|
|
763
788
|
// src/components/SettingsDialog.tsx
|
|
764
789
|
var import_toaster3 = require("@rific/toaster");
|
|
765
790
|
var import_chrome5 = require("@tastic/hud/chrome");
|
|
766
|
-
var
|
|
767
|
-
var
|
|
791
|
+
var import_expo_router6 = require("expo-router");
|
|
792
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
768
793
|
var noSettingsRules = () => null;
|
|
769
794
|
function SettingsDialog({ visible, onDismiss, onShowHowToPlay, showProfile = false, children }) {
|
|
770
795
|
const onUpdateError = (0, import_toaster3.useUpdateErrorToast)();
|
|
@@ -773,11 +798,11 @@ function SettingsDialog({ visible, onDismiss, onShowHowToPlay, showProfile = fal
|
|
|
773
798
|
const rules = useSettingsRules();
|
|
774
799
|
const { profiles, lastSelected } = useProfiles();
|
|
775
800
|
const seatOne = profiles.find((profile) => profile.id === lastSelected[1]) ?? null;
|
|
776
|
-
const profileRow = showProfile ? seatOne ? { onShowProfiles: () =>
|
|
801
|
+
const profileRow = showProfile ? seatOne ? { onShowProfiles: () => import_expo_router6.router.push(profileHref(seatOne.id)), profilesRow: { label: "Profile", caption: seatOne.name, icon: "account-outline" } } : { onShowProfiles: () => import_expo_router6.router.push(profilesHref(1)) } : {};
|
|
777
802
|
const edgeGuardProps = edgeGuard ? { deferBottomEdgeGestures: settings.deferBottomEdgeGestures, onDeferBottomEdgeGestures: (value) => setSettings({ deferBottomEdgeGestures: value }) } : {};
|
|
778
|
-
return /* @__PURE__ */ (0,
|
|
803
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_chrome5.BaseSettingsDialog, { visible, onDismiss, version: otaVersion, ...edgeGuardProps, onUpdateError, onShowHowToPlay, ...profileRow, leading: rules, children: [
|
|
779
804
|
children,
|
|
780
|
-
SettingsSections && /* @__PURE__ */ (0,
|
|
805
|
+
SettingsSections && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SettingsSections, {})
|
|
781
806
|
] });
|
|
782
807
|
}
|
|
783
808
|
|
|
@@ -790,8 +815,8 @@ function useAtComputer() {
|
|
|
790
815
|
}
|
|
791
816
|
|
|
792
817
|
// src/hooks/useOpponent.ts
|
|
793
|
-
var
|
|
794
|
-
var
|
|
818
|
+
var import_react13 = require("react");
|
|
819
|
+
var import_react_redux9 = require("react-redux");
|
|
795
820
|
|
|
796
821
|
// src/redux/opponentSlice.ts
|
|
797
822
|
var import_core8 = require("@rific/core");
|
|
@@ -804,18 +829,18 @@ var opponentSlice_default = reducer4;
|
|
|
804
829
|
|
|
805
830
|
// src/hooks/useOpponent.ts
|
|
806
831
|
function useOpponent() {
|
|
807
|
-
const seatTwo = (0,
|
|
808
|
-
const dispatch = (0,
|
|
809
|
-
const setSeatTwo = (0,
|
|
832
|
+
const seatTwo = (0, import_react_redux9.useSelector)((state) => state.opponent.seatTwo);
|
|
833
|
+
const dispatch = (0, import_react_redux9.useDispatch)();
|
|
834
|
+
const setSeatTwo = (0, import_react13.useCallback)((next) => dispatch(opponentActions.setSeatTwo(next)), [dispatch]);
|
|
810
835
|
return { seatTwo, setSeatTwo };
|
|
811
836
|
}
|
|
812
837
|
|
|
813
838
|
// src/hooks/useSeatColors.ts
|
|
814
839
|
var import_auto_paper4 = require("@rific/auto-paper");
|
|
815
840
|
var import_profile8 = require("@tastic/profile");
|
|
816
|
-
var
|
|
817
|
-
var
|
|
818
|
-
var
|
|
841
|
+
var import_expo_router7 = require("expo-router");
|
|
842
|
+
var import_react14 = require("react");
|
|
843
|
+
var import_react_redux10 = require("react-redux");
|
|
819
844
|
|
|
820
845
|
// src/redux/seatColorsSlice.ts
|
|
821
846
|
var import_profile7 = require("@tastic/profile");
|
|
@@ -840,10 +865,10 @@ function useSeatColors(p2IsHuman) {
|
|
|
840
865
|
const { profiles, lastSelected } = useProfiles();
|
|
841
866
|
const { seatColors, seatTheme } = usePack();
|
|
842
867
|
const seatDefaultColors = [seatColors[1], seatColors[2]];
|
|
843
|
-
const dispatch = (0,
|
|
844
|
-
const guestColors = (0,
|
|
845
|
-
const cpuColor = (0,
|
|
846
|
-
const profileColors = (0,
|
|
868
|
+
const dispatch = (0, import_react_redux10.useDispatch)();
|
|
869
|
+
const guestColors = (0, import_react_redux10.useSelector)((state) => state.seatColors.lastGuestColor);
|
|
870
|
+
const cpuColor = (0, import_react_redux10.useSelector)((state) => state.seatColors.lastCpuColor);
|
|
871
|
+
const profileColors = (0, import_react_redux10.useSelector)((state) => state.seatColors.profileColors);
|
|
847
872
|
const p1Profile = profiles.find((p) => p.id === lastSelected[1]) ?? null;
|
|
848
873
|
const p2Profile = p2IsHuman ? profiles.find((p) => p.id === lastSelected[2]) ?? null : null;
|
|
849
874
|
const rememberedColors = (p1Prof, p2Prof, picks, guest, cpu) => {
|
|
@@ -854,43 +879,43 @@ function useSeatColors(p2IsHuman) {
|
|
|
854
879
|
const remembered = rememberedColors(p1Profile, p2Profile, profileColors, guestColors, cpuColor);
|
|
855
880
|
const p1Color = seatTheme ? remembered.p1 : themeColors.primary;
|
|
856
881
|
const p2Color = seatTheme ? remembered.p2 : themeColors.secondary;
|
|
857
|
-
const themeFor = (0,
|
|
858
|
-
const p1ProfileRef = (0,
|
|
859
|
-
const p2ProfileRef = (0,
|
|
860
|
-
const guestColorsRef = (0,
|
|
861
|
-
const cpuColorRef = (0,
|
|
862
|
-
const profileColorsRef = (0,
|
|
863
|
-
const themeForRef = (0,
|
|
864
|
-
(0,
|
|
882
|
+
const themeFor = (0, import_react14.useCallback)((p1, p2) => seatTheme ? seatTheme({ 1: p1, 2: p2 }, dark) : { color: { primary: p1, secondary: p2, tertiary: (0, import_auto_paper4.getThirdColor)(p1, p2) } }, [seatTheme, dark]);
|
|
883
|
+
const p1ProfileRef = (0, import_react14.useRef)(p1Profile);
|
|
884
|
+
const p2ProfileRef = (0, import_react14.useRef)(p2Profile);
|
|
885
|
+
const guestColorsRef = (0, import_react14.useRef)(guestColors);
|
|
886
|
+
const cpuColorRef = (0, import_react14.useRef)(cpuColor);
|
|
887
|
+
const profileColorsRef = (0, import_react14.useRef)(profileColors);
|
|
888
|
+
const themeForRef = (0, import_react14.useRef)(themeFor);
|
|
889
|
+
(0, import_react14.useEffect)(() => {
|
|
865
890
|
p1ProfileRef.current = p1Profile;
|
|
866
891
|
}, [p1Profile]);
|
|
867
|
-
(0,
|
|
892
|
+
(0, import_react14.useEffect)(() => {
|
|
868
893
|
p2ProfileRef.current = p2Profile;
|
|
869
894
|
}, [p2Profile]);
|
|
870
|
-
(0,
|
|
895
|
+
(0, import_react14.useEffect)(() => {
|
|
871
896
|
guestColorsRef.current = guestColors;
|
|
872
897
|
}, [guestColors]);
|
|
873
|
-
(0,
|
|
898
|
+
(0, import_react14.useEffect)(() => {
|
|
874
899
|
cpuColorRef.current = cpuColor;
|
|
875
900
|
}, [cpuColor]);
|
|
876
|
-
(0,
|
|
901
|
+
(0, import_react14.useEffect)(() => {
|
|
877
902
|
profileColorsRef.current = profileColors;
|
|
878
903
|
}, [profileColors]);
|
|
879
|
-
(0,
|
|
904
|
+
(0, import_react14.useEffect)(() => {
|
|
880
905
|
themeForRef.current = themeFor;
|
|
881
906
|
}, [themeFor]);
|
|
882
|
-
(0,
|
|
907
|
+
(0, import_react14.useEffect)(() => {
|
|
883
908
|
const next = themeFor(remembered.p1, remembered.p2);
|
|
884
909
|
if (sameTheme(themeSettings, next)) return;
|
|
885
910
|
setThemeColor(next);
|
|
886
911
|
}, [lastSelected[1], lastSelected[2], p2IsHuman, guestColors, cpuColor, profileColors, profiles.length, dark]);
|
|
887
|
-
(0,
|
|
888
|
-
(0,
|
|
912
|
+
(0, import_expo_router7.useFocusEffect)(
|
|
913
|
+
(0, import_react14.useCallback)(() => {
|
|
889
914
|
const next = rememberedColors(p1ProfileRef.current, p2ProfileRef.current, profileColorsRef.current, guestColorsRef.current, cpuColorRef.current);
|
|
890
915
|
setThemeColor(themeForRef.current(next.p1, next.p2));
|
|
891
916
|
}, [lastSelected[1], lastSelected[2], p2IsHuman, setThemeColor])
|
|
892
917
|
);
|
|
893
|
-
const persistSeatColor = (0,
|
|
918
|
+
const persistSeatColor = (0, import_react14.useCallback)(
|
|
894
919
|
(seat, hex) => {
|
|
895
920
|
const profile = seat === 1 ? p1Profile : p2Profile;
|
|
896
921
|
if (profile) {
|
|
@@ -905,7 +930,7 @@ function useSeatColors(p2IsHuman) {
|
|
|
905
930
|
},
|
|
906
931
|
[p1Profile, p2Profile, p2IsHuman, dispatch]
|
|
907
932
|
);
|
|
908
|
-
const handleP1ColorChange = (0,
|
|
933
|
+
const handleP1ColorChange = (0, import_react14.useCallback)(
|
|
909
934
|
(hex) => {
|
|
910
935
|
const swapped = hex.toLowerCase() === p2Color.toLowerCase();
|
|
911
936
|
const nextP2 = swapped ? p1Color : p2Color;
|
|
@@ -915,7 +940,7 @@ function useSeatColors(p2IsHuman) {
|
|
|
915
940
|
},
|
|
916
941
|
[setThemeColor, themeFor, p1Color, p2Color, persistSeatColor]
|
|
917
942
|
);
|
|
918
|
-
const handleP2ColorChange = (0,
|
|
943
|
+
const handleP2ColorChange = (0, import_react14.useCallback)(
|
|
919
944
|
(hex) => {
|
|
920
945
|
const swapped = hex.toLowerCase() === p1Color.toLowerCase();
|
|
921
946
|
const nextP1 = swapped ? p2Color : p1Color;
|
|
@@ -937,7 +962,7 @@ var liveplayActions = actions5;
|
|
|
937
962
|
var liveplaySlice_default = reducer5;
|
|
938
963
|
|
|
939
964
|
// src/screens/LoadoutScreen.tsx
|
|
940
|
-
var
|
|
965
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
941
966
|
var PANEL_SWAP_FADE_MS = 180;
|
|
942
967
|
var P1_CONTROL_ID = "p1-control";
|
|
943
968
|
var P2_CONTROL_ID = "p2-control";
|
|
@@ -950,7 +975,7 @@ function LoadoutScreen({ game }) {
|
|
|
950
975
|
const { seatTwo: savedSeatTwo, setSeatTwo } = useOpponent();
|
|
951
976
|
const seatTwo = seatTwoFor(savedSeatTwo, game.seatTwo);
|
|
952
977
|
const mode = roundModeFor(seatTwo);
|
|
953
|
-
const humanSeats = (0,
|
|
978
|
+
const humanSeats = (0, import_react15.useMemo)(() => humanSeatsFor(mode), [mode]);
|
|
954
979
|
const p2IsHuman = mode === "twoPlayer";
|
|
955
980
|
const p2Exists = mode !== "solo";
|
|
956
981
|
const loadout = game.useLoadout(mode);
|
|
@@ -962,44 +987,44 @@ function LoadoutScreen({ game }) {
|
|
|
962
987
|
const panelMode = p2IsHuman ? twoPlayerMode : orientationMode;
|
|
963
988
|
const { panelLayout, panelFadeStyle } = (0, import_split_screen.useDualZoneLayout)(panelMode, false, true, false, PANEL_SWAP_FADE_MS);
|
|
964
989
|
const playersRowFade = panelFadeStyle;
|
|
965
|
-
const [settingsOpen, setSettingsOpen] = (0,
|
|
990
|
+
const [settingsOpen, setSettingsOpen] = (0, import_react15.useState)(false);
|
|
966
991
|
const insets = (0, import_react_native_safe_area_context3.useSafeAreaInsets)();
|
|
967
992
|
const { title: lettering } = (0, import_chrome6.useLettering)();
|
|
968
993
|
const { colors: themeColors, dark } = (0, import_auto_paper5.useAutoPaperTheme)();
|
|
969
994
|
const { p1Color, p2Color, handleP1ColorChange, handleP2ColorChange } = useSeatColors(p2IsHuman);
|
|
970
|
-
const dispatch = (0,
|
|
971
|
-
const handleP1ProfileSelect = (0,
|
|
972
|
-
const handleP2ProfileSelect = (0,
|
|
973
|
-
const [ready, setReady] = (0,
|
|
974
|
-
(0,
|
|
975
|
-
(0,
|
|
995
|
+
const dispatch = (0, import_react_redux11.useDispatch)();
|
|
996
|
+
const handleP1ProfileSelect = (0, import_react15.useCallback)((profile) => selectProfile(1, profile?.id ?? null), [selectProfile]);
|
|
997
|
+
const handleP2ProfileSelect = (0, import_react15.useCallback)((profile) => selectProfile(2, profile?.id ?? null), [selectProfile]);
|
|
998
|
+
const [ready, setReady] = (0, import_react15.useState)({ 1: false, 2: false });
|
|
999
|
+
(0, import_expo_router8.useFocusEffect)(
|
|
1000
|
+
(0, import_react15.useCallback)(() => {
|
|
976
1001
|
setReady({ 1: false, 2: false });
|
|
977
1002
|
}, [setReady])
|
|
978
1003
|
);
|
|
979
|
-
const changeSeatTwo = (0,
|
|
1004
|
+
const changeSeatTwo = (0, import_react15.useCallback)(
|
|
980
1005
|
(next) => {
|
|
981
1006
|
setReady({ 1: false, 2: false });
|
|
982
1007
|
setSeatTwo(next);
|
|
983
1008
|
},
|
|
984
1009
|
[setSeatTwo, setReady]
|
|
985
1010
|
);
|
|
986
|
-
const roundSettingsRef = (0,
|
|
987
|
-
(0,
|
|
1011
|
+
const roundSettingsRef = (0, import_react15.useRef)(loadout.roundSettings);
|
|
1012
|
+
(0, import_react15.useEffect)(() => {
|
|
988
1013
|
roundSettingsRef.current = loadout.roundSettings;
|
|
989
1014
|
}, [loadout.roundSettings]);
|
|
990
|
-
(0,
|
|
1015
|
+
(0, import_react15.useEffect)(() => {
|
|
991
1016
|
if (!humanSeats.every((s) => ready[s])) return;
|
|
992
1017
|
dispatch(liveplayActions.setActiveRound({ game: game.id, mode, settings: roundSettingsRef.current }));
|
|
993
|
-
|
|
1018
|
+
import_expo_router8.router.push(playHref(game.id));
|
|
994
1019
|
}, [ready, humanSeats, game.id, mode, dispatch]);
|
|
995
1020
|
const bg = pack.Backdrop ? "transparent" : dark ? "#000000" : "#FFFFFF";
|
|
996
1021
|
const fg = pack.foreground ?? (dark ? "#FFFFFF" : "#000000");
|
|
997
1022
|
const fgMuted = (pack.foreground && halfOf(pack.foreground)) ?? (dark ? "rgba(255,255,255,0.5)" : "rgba(0,0,0,0.5)");
|
|
998
1023
|
const { previewColor } = pack;
|
|
999
|
-
const seatPreview = (0,
|
|
1024
|
+
const seatPreview = (0, import_react15.useMemo)(() => previewColor ? (hex) => previewColor(hex, dark) : void 0, [previewColor, dark]);
|
|
1000
1025
|
const p1Drawn = seatPreview ? seatPreview(p1Color) : p1Color;
|
|
1001
1026
|
const p2Drawn = seatPreview ? seatPreview(p2Color) : p2Color;
|
|
1002
|
-
const triggerStyle = (0,
|
|
1027
|
+
const triggerStyle = (0, import_react15.useMemo)(() => pack.Backdrop ? [styles3.pill, { backgroundColor: themeColors.surface }] : void 0, [pack.Backdrop, themeColors.surface]);
|
|
1003
1028
|
const readySurface = pack.Backdrop ? themeColors.surface : void 0;
|
|
1004
1029
|
const isPortrait = panelLayout.orientationMode === "faceToFace";
|
|
1005
1030
|
const showMetaInSharedBand = (0, import_split_screen.needsSharedNeutralZone)(panelLayout.orientationMode, humanSeats.length);
|
|
@@ -1013,21 +1038,21 @@ function LoadoutScreen({ game }) {
|
|
|
1013
1038
|
const controlLook = { accentColor: themeColors.tertiary, mutedColor: fgMuted, dark };
|
|
1014
1039
|
const p1Control = loadout.seatControl(1, controlsHost, { ...controlLook, seatColor: p1Drawn });
|
|
1015
1040
|
const p1Caption = p2IsHuman ? "Player 1" : "Player";
|
|
1016
|
-
const p1Panel = /* @__PURE__ */ (0,
|
|
1017
|
-
const opponentPicker = game.seatTwo && /* @__PURE__ */ (0,
|
|
1041
|
+
const p1Panel = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lobby2.PlayerSetupPanel, { idPrefix: "p1", caption: p1Caption, host: controlsHost, color: p1Color, onColorChange: handleP1ColorChange, swatches: import_auto_paper5.defaultColors, takenColor: p2Exists ? p2Color : void 0, allowSwapTaken: mode === "vsCpu", colorCaption: pack.colorCaption, isHuman: true, dark, showReadyButton: false, profiles, selectedProfileId: lastSelected[1], takenProfileId: p2IsHuman ? lastSelected[2] : null, guestLabel: pack.guestLabel ?? "P1", nullLabel: pack.nullLabel, onProfileSelect: handleP1ProfileSelect, onManageProfiles: () => import_expo_router8.router.push(profilesHref(1)), previewValue: seatPreview, triggerStyle, useSeatPickerAlign: seatPickerAlign }, `p1-${layoutKey}`);
|
|
1042
|
+
const opponentPicker = game.seatTwo && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(OpponentPicker, { idPrefix: "p1", host: controlsHost, choices: game.seatTwo, seatTwo, onSeatTwoChange: changeSeatTwo, cpuDifficulty: loadout.cpuDifficulty, color: p2Color, onColorChange: handleP2ColorChange, swatches: import_auto_paper5.defaultColors, takenColor: p1Color, allowSwapTaken: mode === "vsCpu", dark, previewValue: seatPreview, triggerStyle, usePickerAlign: seatPickerAlign }, `opponent-${layoutKey}`);
|
|
1018
1043
|
const toggleP1Ready = () => setReady((r) => ({ ...r, 1: !r[1] }));
|
|
1019
1044
|
const readyInOptions = !p2IsHuman && !!loadout.drawsReady;
|
|
1020
|
-
const seatButtons = /* @__PURE__ */ (0,
|
|
1021
|
-
/* @__PURE__ */ (0,
|
|
1045
|
+
const seatButtons = /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native6.View, { style: [styles3.seatOneButtons, p1PickerOpen && styles3.raised], children: [
|
|
1046
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native_reanimated2.default.View, { style: [styles3.playersRow, p1PickerOpen && styles3.raised, !p2IsHuman && playersRowFade], children: [
|
|
1022
1047
|
p1Panel,
|
|
1023
1048
|
opponentPicker
|
|
1024
1049
|
] }),
|
|
1025
|
-
p1Control && /* @__PURE__ */ (0,
|
|
1050
|
+
p1Control && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native6.View, { style: [styles3.controlRow, p1ControlOpen && styles3.raised], children: p1Control })
|
|
1026
1051
|
] });
|
|
1027
1052
|
const seatsInOptions = !p2IsHuman && !!loadout.placesSeats;
|
|
1028
|
-
const seatOne = /* @__PURE__ */ (0,
|
|
1053
|
+
const seatOne = /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native6.View, { style: [styles3.seatOne, !p2IsHuman && styles3.seatOneAlone, p1PickerOpen && !seatsInOptions && styles3.raised], children: [
|
|
1029
1054
|
!seatsInOptions && seatButtons,
|
|
1030
|
-
!readyInOptions && /* @__PURE__ */ (0,
|
|
1055
|
+
!readyInOptions && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lobby2.ReadyButton, { color: p1Drawn, ready: ready[1], onToggleReady: toggleP1Ready, surfaceColor: readySurface, dark, style: !p2IsHuman && p1PickerOpen && styles3.readyButtonHidden })
|
|
1031
1056
|
] });
|
|
1032
1057
|
const optionsRow = loadout.options({
|
|
1033
1058
|
host: controlsHost,
|
|
@@ -1043,16 +1068,16 @@ function LoadoutScreen({ game }) {
|
|
|
1043
1068
|
onReset: showMetaInSharedBand ? void 0 : loadout.reset
|
|
1044
1069
|
});
|
|
1045
1070
|
const optionsPopoverOpen = controlsHost.openId !== null && loadout.optionIds.includes(controlsHost.openId);
|
|
1046
|
-
const sharedControls = showMetaInSharedBand ? /* @__PURE__ */ (0,
|
|
1071
|
+
const sharedControls = showMetaInSharedBand ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lobby2.SharedActionBand, { onBack: import_core6.safeBack, onSettings: () => setSettingsOpen(true), onRandomize: loadout.randomize, onReset: loadout.reset, fg, popoverOpen: optionsPopoverOpen, children: optionsRow }) : optionsRow;
|
|
1047
1072
|
const p2Control = p2IsHuman ? loadout.seatControl(2, p2Host, { ...controlLook, seatColor: p2Drawn }) : void 0;
|
|
1048
|
-
const p2Panel = p2IsHuman && /* @__PURE__ */ (0,
|
|
1049
|
-
return /* @__PURE__ */ (0,
|
|
1050
|
-
/* @__PURE__ */ (0,
|
|
1051
|
-
/* @__PURE__ */ (0,
|
|
1052
|
-
p2ZoneStyle && /* @__PURE__ */ (0,
|
|
1053
|
-
!showMetaInSharedBand && /* @__PURE__ */ (0,
|
|
1054
|
-
!showMetaInSharedBand && /* @__PURE__ */ (0,
|
|
1055
|
-
p2IsHuman ? /* @__PURE__ */ (0,
|
|
1073
|
+
const p2Panel = p2IsHuman && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lobby2.PlayerSetupPanel, { idPrefix: "p2", caption: "Player 2", host: p2Host, color: p2Color, onColorChange: handleP2ColorChange, swatches: import_auto_paper5.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");
|
|
1074
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native6.View, { style: [styles3.container, { backgroundColor: bg }], children: [
|
|
1075
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native6.View, { style: [styles3.frame, !showMetaInSharedBand && { paddingTop: HEADER_TOP + HEADER_ROW_HEIGHT + insets.top }], children: [
|
|
1076
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_chrome6.PressAwayOverlay, { active: controlsHost.openId !== null, onPress: controlsHost.close }),
|
|
1077
|
+
p2ZoneStyle && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_chrome6.PressAwayOverlay, { active: controlsHost.openId !== null || p2Host.openId !== null, onPress: p2Host.close, style: p2ZoneStyle }),
|
|
1078
|
+
!showMetaInSharedBand && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_chrome6.CornerActionButtons, { onBack: import_core6.safeBack, onSettings: () => setSettingsOpen(true), fg, insets }),
|
|
1079
|
+
!showMetaInSharedBand && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native6.View, { style: [styles3.headerTitle, { top: HEADER_TOP + insets.top, left: HEADER_TITLE_LEFT + insets.left, right: HEADER_TITLE_RIGHT + insets.right }], pointerEvents: "none", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper.Text, { variant: "headlineSmall", numberOfLines: 1, accessibilityRole: "header", style: [styles3.title, { color: fg }, lettering], children: game.title }) }),
|
|
1080
|
+
p2IsHuman ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1056
1081
|
import_split_screen.DualZoneLayout,
|
|
1057
1082
|
{
|
|
1058
1083
|
panelLayout,
|
|
@@ -1064,12 +1089,12 @@ function LoadoutScreen({ game }) {
|
|
|
1064
1089
|
p2Elevated: p2Host.openId !== null,
|
|
1065
1090
|
sharedElevated: optionsPopoverOpen
|
|
1066
1091
|
}
|
|
1067
|
-
) : /* @__PURE__ */ (0,
|
|
1068
|
-
seatsInOptions ? /* @__PURE__ */ (0,
|
|
1092
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native6.View, { style: styles3.stackedZone, children: [
|
|
1093
|
+
seatsInOptions ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native6.View, { style: p1PickerOpen && styles3.raised, children: sharedControls }) : sharedControls,
|
|
1069
1094
|
!(seatsInOptions && readyInOptions) && seatOne
|
|
1070
1095
|
] })
|
|
1071
1096
|
] }),
|
|
1072
|
-
/* @__PURE__ */ (0,
|
|
1097
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SettingsDialog, { visible: settingsOpen, onDismiss: () => setSettingsOpen(false), onShowHowToPlay: () => openFor(game.id), showProfile: true })
|
|
1073
1098
|
] });
|
|
1074
1099
|
}
|
|
1075
1100
|
function halfOf(color) {
|
|
@@ -1159,29 +1184,29 @@ var styles3 = import_react_native6.StyleSheet.create({
|
|
|
1159
1184
|
});
|
|
1160
1185
|
|
|
1161
1186
|
// src/screens/GameRoute.tsx
|
|
1162
|
-
var
|
|
1187
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1163
1188
|
function LoadoutRoute() {
|
|
1164
|
-
const { game: id } = (0,
|
|
1189
|
+
const { game: id } = (0, import_expo_router9.useLocalSearchParams)();
|
|
1165
1190
|
const game = usePackGame(id);
|
|
1166
|
-
if (!game) return /* @__PURE__ */ (0,
|
|
1167
|
-
if (!hasLoadout(game)) return /* @__PURE__ */ (0,
|
|
1168
|
-
return /* @__PURE__ */ (0,
|
|
1191
|
+
if (!game) return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_expo_router9.Redirect, { href: "/" });
|
|
1192
|
+
if (!hasLoadout(game)) return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_expo_router9.Redirect, { href: playHref(game.id) });
|
|
1193
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(LoadoutScreen, { game }, game.id);
|
|
1169
1194
|
}
|
|
1170
1195
|
function hasLoadout(game) {
|
|
1171
1196
|
return !!game.useLoadout;
|
|
1172
1197
|
}
|
|
1173
|
-
function PlayRoute() {
|
|
1174
|
-
const { game: id } = (0,
|
|
1198
|
+
function PlayRoute({ guide = true } = {}) {
|
|
1199
|
+
const { game: id } = (0, import_expo_router9.useLocalSearchParams)();
|
|
1175
1200
|
const game = usePackGame(id);
|
|
1176
1201
|
useResumePoint(game?.resumable ? game.id : null);
|
|
1177
1202
|
useResumeUp();
|
|
1178
|
-
if (!game) return /* @__PURE__ */ (0,
|
|
1203
|
+
if (!game) return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_expo_router9.Redirect, { href: "/" });
|
|
1179
1204
|
const { PlayScreen } = game;
|
|
1180
|
-
return /* @__PURE__ */ (0,
|
|
1205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(StartGuide, { game, enabled: guide, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PlayScreen, {}) }, game.id);
|
|
1181
1206
|
}
|
|
1182
1207
|
function useResumeUp() {
|
|
1183
1208
|
const { playScreenUp } = useLastActiveGame();
|
|
1184
|
-
(0,
|
|
1209
|
+
(0, import_react16.useEffect)(() => {
|
|
1185
1210
|
let frame = requestAnimationFrame(() => {
|
|
1186
1211
|
frame = requestAnimationFrame(playScreenUp);
|
|
1187
1212
|
});
|
|
@@ -1191,7 +1216,7 @@ function useResumeUp() {
|
|
|
1191
1216
|
var playScreensUp = 0;
|
|
1192
1217
|
function useResumePoint(gameId) {
|
|
1193
1218
|
const { setLastActiveGame, clearLastActiveGame } = useLastActiveGame();
|
|
1194
|
-
(0,
|
|
1219
|
+
(0, import_react16.useEffect)(() => {
|
|
1195
1220
|
if (!gameId) return;
|
|
1196
1221
|
playScreensUp += 1;
|
|
1197
1222
|
setLastActiveGame(gameId);
|
|
@@ -1207,8 +1232,8 @@ var import_auto_paper6 = require("@rific/auto-paper");
|
|
|
1207
1232
|
var import_feedback_press3 = require("@rific/feedback-press");
|
|
1208
1233
|
var import_chrome7 = require("@tastic/hud/chrome");
|
|
1209
1234
|
var import_profile9 = require("@tastic/profile");
|
|
1210
|
-
var
|
|
1211
|
-
var
|
|
1235
|
+
var import_expo_router10 = require("expo-router");
|
|
1236
|
+
var import_react18 = require("react");
|
|
1212
1237
|
var import_react_native9 = require("react-native");
|
|
1213
1238
|
var import_react_native_paper2 = require("react-native-paper");
|
|
1214
1239
|
|
|
@@ -1217,11 +1242,11 @@ var SEGMENT_THEME = { roundness: 3.8 };
|
|
|
1217
1242
|
var SEGMENT_RADIUS = 5 * SEGMENT_THEME.roundness;
|
|
1218
1243
|
|
|
1219
1244
|
// src/hooks/useFrozenWhileHidden.ts
|
|
1220
|
-
var
|
|
1245
|
+
var import_react17 = require("react");
|
|
1221
1246
|
function useFrozenWhileHidden(value, hidden) {
|
|
1222
|
-
const [prevHidden, setPrevHidden] = (0,
|
|
1223
|
-
const [prevValue, setPrevValue] = (0,
|
|
1224
|
-
const [frozen, setFrozen] = (0,
|
|
1247
|
+
const [prevHidden, setPrevHidden] = (0, import_react17.useState)(hidden);
|
|
1248
|
+
const [prevValue, setPrevValue] = (0, import_react17.useState)(value);
|
|
1249
|
+
const [frozen, setFrozen] = (0, import_react17.useState)(value);
|
|
1225
1250
|
if (hidden !== prevHidden) {
|
|
1226
1251
|
setPrevHidden(hidden);
|
|
1227
1252
|
if (hidden) setFrozen(prevValue);
|
|
@@ -1294,39 +1319,35 @@ function useHomeLayout(withPicker = true) {
|
|
|
1294
1319
|
}
|
|
1295
1320
|
|
|
1296
1321
|
// src/screens/HomeScreen.tsx
|
|
1297
|
-
var
|
|
1322
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1298
1323
|
function HomeScreen() {
|
|
1299
1324
|
const pack = usePack();
|
|
1300
1325
|
const { consumeResumeGame } = useLastActiveGame();
|
|
1301
|
-
const
|
|
1302
|
-
const [resumeGame] = (0, import_react16.useState)(() => {
|
|
1326
|
+
const [resumeGame] = (0, import_react18.useState)(() => {
|
|
1303
1327
|
const id = consumeResumeGame();
|
|
1304
1328
|
return pack.games.find((g) => g.id === id && g.resumable) ?? null;
|
|
1305
1329
|
});
|
|
1306
|
-
(0, import_react16.useEffect)(() => {
|
|
1307
|
-
if (!resumeGame) autoShowPack();
|
|
1308
|
-
}, [resumeGame, autoShowPack]);
|
|
1309
1330
|
useResume(resumeGame);
|
|
1310
|
-
return useMenuShown(!!resumeGame) ? /* @__PURE__ */ (0,
|
|
1331
|
+
return useMenuShown(!!resumeGame) ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(HomeMenu, {}) : null;
|
|
1311
1332
|
}
|
|
1312
1333
|
function useResume(game) {
|
|
1313
1334
|
const pack = usePack();
|
|
1314
|
-
const done = (0,
|
|
1315
|
-
(0,
|
|
1316
|
-
(0,
|
|
1335
|
+
const done = (0, import_react18.useRef)(false);
|
|
1336
|
+
(0, import_expo_router10.useFocusEffect)(
|
|
1337
|
+
(0, import_react18.useCallback)(() => {
|
|
1317
1338
|
if (!game || done.current) return;
|
|
1318
1339
|
done.current = true;
|
|
1319
|
-
if (game.useLoadout)
|
|
1320
|
-
|
|
1340
|
+
if (game.useLoadout) import_expo_router10.router.push(loadoutHref(game.id));
|
|
1341
|
+
import_expo_router10.router.push(pack.resumeHref?.(game.id) ?? playHref(game.id));
|
|
1321
1342
|
}, [game, pack])
|
|
1322
1343
|
);
|
|
1323
1344
|
}
|
|
1324
1345
|
function useMenuShown(resuming) {
|
|
1325
1346
|
const { beginResume, endResume, resumeState, subscribeResume } = useLastActiveGame();
|
|
1326
|
-
const isFocused = (0,
|
|
1327
|
-
const [covered, setCovered] = (0,
|
|
1347
|
+
const isFocused = (0, import_expo_router10.useIsFocused)();
|
|
1348
|
+
const [covered, setCovered] = (0, import_react18.useState)(false);
|
|
1328
1349
|
if (resuming && !covered && !isFocused) setCovered(true);
|
|
1329
|
-
(0,
|
|
1350
|
+
(0, import_react18.useLayoutEffect)(() => {
|
|
1330
1351
|
if (!resuming) return;
|
|
1331
1352
|
beginResume();
|
|
1332
1353
|
const id = setTimeout(endResume, RESUME_SHOWN_MAX_MS);
|
|
@@ -1335,9 +1356,9 @@ function useMenuShown(resuming) {
|
|
|
1335
1356
|
endResume();
|
|
1336
1357
|
};
|
|
1337
1358
|
}, [resuming, beginResume, endResume]);
|
|
1338
|
-
const onItsWay = (0,
|
|
1359
|
+
const onItsWay = (0, import_react18.useSyncExternalStore)(subscribeResume, resumeState, resumeState) !== "idle";
|
|
1339
1360
|
const gameShown = covered && !onItsWay;
|
|
1340
|
-
return (0,
|
|
1361
|
+
return (0, import_react18.useDeferredValue)(!resuming || gameShown || covered && isFocused);
|
|
1341
1362
|
}
|
|
1342
1363
|
var RESUME_SHOWN_MAX_MS = 4e3;
|
|
1343
1364
|
function HomeMenu() {
|
|
@@ -1347,11 +1368,11 @@ function HomeMenu() {
|
|
|
1347
1368
|
const { insets } = layout;
|
|
1348
1369
|
const { dark, colors } = (0, import_auto_paper6.useAutoPaperTheme)();
|
|
1349
1370
|
const { openFirstTime, openFor, openPack } = useGameGuide();
|
|
1350
|
-
const [settingsOpen, setSettingsOpen] = (0,
|
|
1351
|
-
const [rulesGame, setRulesGame] = (0,
|
|
1352
|
-
const isFocused = (0,
|
|
1353
|
-
const [appState, setAppState] = (0,
|
|
1354
|
-
(0,
|
|
1371
|
+
const [settingsOpen, setSettingsOpen] = (0, import_react18.useState)(false);
|
|
1372
|
+
const [rulesGame, setRulesGame] = (0, import_react18.useState)(null);
|
|
1373
|
+
const isFocused = (0, import_expo_router10.useIsFocused)();
|
|
1374
|
+
const [appState, setAppState] = (0, import_react18.useState)(import_react_native9.AppState.currentState);
|
|
1375
|
+
(0, import_react18.useEffect)(() => {
|
|
1355
1376
|
const subscription = import_react_native9.AppState.addEventListener("change", setAppState);
|
|
1356
1377
|
return () => subscription.remove();
|
|
1357
1378
|
}, []);
|
|
@@ -1363,65 +1384,65 @@ function HomeMenu() {
|
|
|
1363
1384
|
const selectedProfile = profiles.find((p) => p.id === lastSelected[1]) ?? null;
|
|
1364
1385
|
const tiled = pack.games.some((game) => game.Preview);
|
|
1365
1386
|
const isWide = useFrozenWhileHidden(tiled && layout.isWide, !isFocused);
|
|
1366
|
-
const [previewsRevealed, setPreviewsRevealed] = (0,
|
|
1367
|
-
(0,
|
|
1387
|
+
const [previewsRevealed, setPreviewsRevealed] = (0, import_react18.useState)(false);
|
|
1388
|
+
(0, import_react18.useEffect)(() => {
|
|
1368
1389
|
if (!tiled) return;
|
|
1369
1390
|
const id = requestAnimationFrame(() => setPreviewsRevealed(true));
|
|
1370
1391
|
return () => cancelAnimationFrame(id);
|
|
1371
1392
|
}, [tiled]);
|
|
1372
1393
|
const closePicker = pickerHost.close;
|
|
1373
|
-
(0,
|
|
1394
|
+
(0, import_react18.useEffect)(() => {
|
|
1374
1395
|
closePicker();
|
|
1375
1396
|
}, [isWide, layout.windowWidth, layout.windowHeight, closePicker]);
|
|
1376
1397
|
const bg = pack.Backdrop ? "transparent" : dark ? "#000000" : "#FFFFFF";
|
|
1377
1398
|
const fg = pack.foreground ?? (dark ? "#FFFFFF" : "#000000");
|
|
1378
1399
|
const { previewColor } = pack;
|
|
1379
1400
|
const p1Drawn = previewColor ? previewColor(p1Color, dark) : p1Color;
|
|
1380
|
-
const triggerStyle = (0,
|
|
1401
|
+
const triggerStyle = (0, import_react18.useMemo)(() => pack.Backdrop ? [styles4.pill, { backgroundColor: colors.surface }] : void 0, [pack.Backdrop, colors.surface]);
|
|
1381
1402
|
const tabs = pack.homeTabs && pack.homeTabs.length > 1 ? pack.homeTabs : null;
|
|
1382
|
-
const [tabLabel, setTabLabel] = (0,
|
|
1403
|
+
const [tabLabel, setTabLabel] = (0, import_react18.useState)(() => tabs?.[0].label ?? null);
|
|
1383
1404
|
const tab = tabs ? tabs.find((t) => t.label === tabLabel) ?? tabs[0] : null;
|
|
1384
|
-
const tabButtons = (0,
|
|
1385
|
-
const tabBar = tab && /* @__PURE__ */ (0,
|
|
1386
|
-
const panes = (0,
|
|
1405
|
+
const tabButtons = (0, import_react18.useMemo)(() => tabs?.map(({ label }) => ({ value: label, label, labelStyle: pack.labelStyle })) ?? [], [tabs, pack.labelStyle]);
|
|
1406
|
+
const tabBar = tab && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native_paper2.SegmentedButtons, { value: tab.label, onValueChange: setTabLabel, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles4.tabs, pack.Backdrop && { backgroundColor: colors.surface }] });
|
|
1407
|
+
const panes = (0, import_react18.useMemo)(() => tabs ? tabs.map((t) => ({ key: t.label, games: pack.games.filter(t.includes) })) : [{ key: ALL_GAMES, games: pack.games }], [tabs, pack.games]);
|
|
1387
1408
|
const shownPane = tab?.label ?? ALL_GAMES;
|
|
1388
1409
|
const { width: fitWidth, height: fitHeight } = layout.heroFit ?? NO_FIT;
|
|
1389
|
-
const hero = (0,
|
|
1410
|
+
const hero = (0, import_react18.useMemo)(() => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(pack.HeroTitle, { words: pack.wordmark, color: fg, p1Color, p2Color, active: heroActive, fit: isWide && fitWidth !== void 0 ? { width: fitWidth, height: fitHeight } : void 0 }), [pack, fg, p1Color, p2Color, heroActive, isWide, fitWidth, fitHeight]);
|
|
1390
1411
|
const columnClamp = useClampOnShrink();
|
|
1391
1412
|
const gridClamp = useClampOnShrink();
|
|
1392
|
-
const openGame = (0,
|
|
1393
|
-
const openRules = (0,
|
|
1413
|
+
const openGame = (0, import_react18.useCallback)((game) => openFirstTime(game.id, () => import_expo_router10.router.push(game.useLoadout ? loadoutHref(game.id) : playHref(game.id))), [openFirstTime]);
|
|
1414
|
+
const openRules = (0, import_react18.useCallback)((game) => game.Rules ? setRulesGame(game) : openFor(game.id), [openFor]);
|
|
1394
1415
|
const colorSection = { value: p1Color, onChange: handleP1ColorChange, swatches: import_auto_paper6.defaultColors, caption: selectedProfile ? pack.colorCaption : void 0, previewValue: previewColor ? (hex) => previewColor(hex, dark) : void 0 };
|
|
1395
1416
|
const usePickerAlign = pack.usePickerAlign ?? noPickerAlign;
|
|
1396
1417
|
const pickerSize = (0, import_profile9.getProfilePickerContentSize)(profiles.length, true, colorSection);
|
|
1397
1418
|
const pickerAlign = usePickerAlign(pickerHost.openId === `${SEAT_ONE_PICKER}-profile`, pickerSize.width, pickerSize.height);
|
|
1398
|
-
const picker = /* @__PURE__ */ (0,
|
|
1399
|
-
const pressAway = /* @__PURE__ */ (0,
|
|
1419
|
+
const picker = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_profile9.ProfilePicker, { idPrefix: SEAT_ONE_PICKER, host: pickerHost, caption: "Player", profiles, selectedId: lastSelected[1], color: p1Drawn, dark, guestLabel: pack.guestLabel ?? "P1", nullLabel: pack.nullLabel, onSelect: (profile) => selectProfile(1, profile?.id ?? null), onManage: () => import_expo_router10.router.push(profilesHref(1)), colorSection, alignOverride: pickerAlign, triggerStyle });
|
|
1420
|
+
const pressAway = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_chrome7.PressAwayOverlay, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles4.pressAway });
|
|
1400
1421
|
const RulesSheet = rulesGame?.Rules;
|
|
1401
|
-
return /* @__PURE__ */ (0,
|
|
1402
|
-
/* @__PURE__ */ (0,
|
|
1403
|
-
/* @__PURE__ */ (0,
|
|
1422
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_react_native9.View, { style: [styles4.container, { backgroundColor: bg }], children: [
|
|
1423
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native9.View, { style: styles4.frame, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(RulesHost, { enabled: pack.games.some((game) => game.Rules), children: [
|
|
1424
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PreviewsRevealed, { value: previewsRevealed, children: isWide ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
1404
1425
|
pressAway,
|
|
1405
|
-
/* @__PURE__ */ (0,
|
|
1406
|
-
tabBar && /* @__PURE__ */ (0,
|
|
1407
|
-
/* @__PURE__ */ (0,
|
|
1426
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_auto_paper6.FadingScrollView, { ...tab && gridClamp, style: [styles4.wideRightPane, { left: layout.paddingLeft + layout.leftPaneWidth + HOME_WIDE_PANE_GAP }], contentContainerStyle: { paddingTop: 16 + insets.top, paddingBottom: 16 + insets.bottom, paddingRight: layout.paddingRight }, children: [
|
|
1427
|
+
tabBar && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native9.View, { style: [styles4.wideTabs, { width: layout.rightPaneWidth }], children: tabBar }),
|
|
1428
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native9.View, { style: { width: layout.rightPaneWidth }, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TabPanes, { panes, shown: shownPane, buildOthers: isFocused, style: styles4.grid, children: (games, built) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(GameGrid, { games, built, width: layout.tileWidth, previewWidth: layout.previewWidth, dark, p1Color, p2Color, onOpen: openGame, onRules: openRules }) }) })
|
|
1408
1429
|
] }),
|
|
1409
|
-
/* @__PURE__ */ (0,
|
|
1430
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_react_native9.View, { style: [styles4.wideLeftPane, { left: layout.paddingLeft, width: layout.leftPaneWidth, paddingTop: HOME_TOP_BAND + insets.top, paddingBottom: 16 + insets.bottom }, pickerHost.openId !== null && styles4.pickerOpen], children: [
|
|
1410
1431
|
hero,
|
|
1411
|
-
showPicker && /* @__PURE__ */ (0,
|
|
1432
|
+
showPicker && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native9.View, { style: styles4.widePicker, children: picker })
|
|
1412
1433
|
] })
|
|
1413
|
-
] }) : /* @__PURE__ */ (0,
|
|
1434
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_auto_paper6.FadingScrollView, { ...tab && columnClamp, style: styles4.scroll, contentContainerStyle: [styles4.content, { paddingTop: 56 + insets.top, paddingBottom: 24 + insets.bottom, paddingLeft: 16 + insets.left, paddingRight: 16 + insets.right }], children: [
|
|
1414
1435
|
pressAway,
|
|
1415
1436
|
hero,
|
|
1416
|
-
showPicker && /* @__PURE__ */ (0,
|
|
1417
|
-
tabBar && /* @__PURE__ */ (0,
|
|
1418
|
-
/* @__PURE__ */ (0,
|
|
1437
|
+
showPicker && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native9.View, { style: [styles4.picker, pickerHost.openId !== null && styles4.pickerOpen], children: picker }),
|
|
1438
|
+
tabBar && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native9.View, { style: styles4.listWidth, children: tabBar }),
|
|
1439
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native9.View, { style: styles4.listWidth, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TabPanes, { panes, shown: shownPane, buildOthers: isFocused, style: styles4.list, children: (games, built) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(GameList, { games, built, dark, p1Color, p2Color, onOpen: openGame, onRules: openRules }) }) })
|
|
1419
1440
|
] }) }),
|
|
1420
|
-
/* @__PURE__ */ (0,
|
|
1421
|
-
/* @__PURE__ */ (0,
|
|
1422
|
-
RulesSheet && /* @__PURE__ */ (0,
|
|
1441
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_feedback_press3.IconButton, { icon: "trophy", iconColor: fg, size: 24, style: [styles4.corner, { top: 8 + insets.top, left: 8 + insets.left }], onPress: () => import_expo_router10.router.push(STATS_HREF), accessibilityLabel: "Stats & Achievements" }),
|
|
1442
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_feedback_press3.IconButton, { icon: "cog", iconColor: fg, size: 24, style: [styles4.corner, { top: 8 + insets.top, right: 8 + insets.right }], onPress: () => setSettingsOpen(true), accessibilityLabel: "Settings" }),
|
|
1443
|
+
RulesSheet && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(RulesSheet, { visible: true, onDismiss: () => setRulesGame(null) })
|
|
1423
1444
|
] }) }),
|
|
1424
|
-
/* @__PURE__ */ (0,
|
|
1445
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SettingsDialog, { visible: settingsOpen, onDismiss: () => setSettingsOpen(false), onShowHowToPlay: pack.guide ? openPack : void 0, showProfile: true })
|
|
1425
1446
|
] });
|
|
1426
1447
|
}
|
|
1427
1448
|
var SEAT_ONE_PICKER = "home-p1";
|
|
@@ -1434,17 +1455,17 @@ function TabPanes({ panes, shown, buildOthers, style, children }) {
|
|
|
1434
1455
|
return panes.map(({ key, games }) => {
|
|
1435
1456
|
const built = builtGames(key);
|
|
1436
1457
|
if (built === 0) return null;
|
|
1437
|
-
return /* @__PURE__ */ (0,
|
|
1458
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TabPane, { shown: key === shown, style, children: children(games, built) }, key);
|
|
1438
1459
|
});
|
|
1439
1460
|
}
|
|
1440
1461
|
function useBuiltGames(shown, total, buildOthers) {
|
|
1441
|
-
const [picked, setPicked] = (0,
|
|
1462
|
+
const [picked, setPicked] = (0, import_react18.useState)([shown]);
|
|
1442
1463
|
if (!picked.includes(shown)) setPicked([...picked, shown]);
|
|
1443
|
-
const [others, setOthers] = (0,
|
|
1464
|
+
const [others, setOthers] = (0, import_react18.useState)(import_react_native9.Platform.OS === "web" ? total : 0);
|
|
1444
1465
|
const building = buildOthers && others < total;
|
|
1445
|
-
(0,
|
|
1466
|
+
(0, import_react18.useEffect)(() => {
|
|
1446
1467
|
if (!building) return;
|
|
1447
|
-
const id = setTimeout(() => (0,
|
|
1468
|
+
const id = setTimeout(() => (0, import_react18.startTransition)(() => setOthers(others + 1)), others === 0 ? OTHER_PANES_DELAY_MS : OTHER_PANES_STEP_MS);
|
|
1448
1469
|
return () => clearTimeout(id);
|
|
1449
1470
|
}, [building, others]);
|
|
1450
1471
|
return (pane) => pane === shown || picked.includes(pane) ? total : others;
|
|
@@ -1452,14 +1473,14 @@ function useBuiltGames(shown, total, buildOthers) {
|
|
|
1452
1473
|
var OTHER_PANES_DELAY_MS = 1200;
|
|
1453
1474
|
var OTHER_PANES_STEP_MS = 150;
|
|
1454
1475
|
function TabPane({ shown, style, children }) {
|
|
1455
|
-
return /* @__PURE__ */ (0,
|
|
1476
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native9.View, { collapsable: false, "aria-hidden": !shown, style: [style, !shown && styles4.paneHidden], children });
|
|
1456
1477
|
}
|
|
1457
|
-
var PreviewsRevealedContext = (0,
|
|
1478
|
+
var PreviewsRevealedContext = (0, import_react18.createContext)(false);
|
|
1458
1479
|
var PreviewsRevealed = PreviewsRevealedContext.Provider;
|
|
1459
1480
|
function useClampOnShrink() {
|
|
1460
|
-
const view = (0,
|
|
1461
|
-
const sizes = (0,
|
|
1462
|
-
return (0,
|
|
1481
|
+
const view = (0, import_react18.useRef)(null);
|
|
1482
|
+
const sizes = (0, import_react18.useRef)({ viewport: 0, offset: 0 });
|
|
1483
|
+
return (0, import_react18.useMemo)(
|
|
1463
1484
|
() => ({
|
|
1464
1485
|
ref: (instance) => {
|
|
1465
1486
|
view.current = instance;
|
|
@@ -1485,52 +1506,52 @@ function hasRules(game) {
|
|
|
1485
1506
|
return !!(game.Rules || game.guide);
|
|
1486
1507
|
}
|
|
1487
1508
|
function RulesHost({ enabled, children }) {
|
|
1488
|
-
return enabled ? /* @__PURE__ */ (0,
|
|
1509
|
+
return enabled ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native_paper2.Portal.Host, { children }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_jsx_runtime19.Fragment, { children });
|
|
1489
1510
|
}
|
|
1490
|
-
var GameList = (0,
|
|
1491
|
-
return games.slice(0, built).map((game) => /* @__PURE__ */ (0,
|
|
1511
|
+
var GameList = (0, import_react18.memo)(function GameList2({ games, built, ...rest }) {
|
|
1512
|
+
return games.slice(0, built).map((game) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(GameRow, { game, ...rest }, game.id));
|
|
1492
1513
|
});
|
|
1493
|
-
var GameGrid = (0,
|
|
1494
|
-
return games.slice(0, built).map((game) => /* @__PURE__ */ (0,
|
|
1514
|
+
var GameGrid = (0, import_react18.memo)(function GameGrid2({ games, built, ...rest }) {
|
|
1515
|
+
return games.slice(0, built).map((game) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(GameTile, { game, ...rest }, game.id));
|
|
1495
1516
|
});
|
|
1496
1517
|
var ROW_BLURB_LINES = 3;
|
|
1497
|
-
var GameRow = (0,
|
|
1518
|
+
var GameRow = (0, import_react18.memo)(function GameRow2({ game, dark, p1Color, p2Color, onOpen, onRules }) {
|
|
1498
1519
|
const { titleStyle } = usePack();
|
|
1499
1520
|
const well = (0, import_chrome7.useWellColors)();
|
|
1500
1521
|
const GameIcon = game.icon;
|
|
1501
1522
|
return (
|
|
1502
1523
|
// The rules button sits beside the row's own button, laid over its end, not inside it: a button
|
|
1503
1524
|
// inside a button is invalid on the web.
|
|
1504
|
-
/* @__PURE__ */ (0,
|
|
1505
|
-
/* @__PURE__ */ (0,
|
|
1506
|
-
game.Preview ? /* @__PURE__ */ (0,
|
|
1507
|
-
/* @__PURE__ */ (0,
|
|
1508
|
-
/* @__PURE__ */ (0,
|
|
1509
|
-
/* @__PURE__ */ (0,
|
|
1525
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_react_native9.View, { children: [
|
|
1526
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_feedback_press3.Pressable, { onPress: () => onOpen(game), style: [styles4.row, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
|
|
1527
|
+
game.Preview ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PreviewBox, { game, width: ROW_PREVIEW_WIDTH, dark, p1Color, p2Color }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native9.View, { style: [styles4.rowIcon, { backgroundColor: dark ? ICON_DARK_BG : ICON_LIGHT_BG }], children: GameIcon && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(GameIcon, { size: ROW_ICON_SIZE, p1Color, p2Color, dark }) }),
|
|
1528
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_react_native9.View, { style: styles4.rowText, children: [
|
|
1529
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native_paper2.Text, { variant: "titleLarge", style: [styles4.rowTitle, { color: well.fg }, titleStyle], numberOfLines: 1, children: game.title }),
|
|
1530
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native_paper2.Text, { variant: "bodyMedium", style: { color: well.fgMuted }, numberOfLines: ROW_BLURB_LINES, children: game.blurb })
|
|
1510
1531
|
] })
|
|
1511
1532
|
] }),
|
|
1512
|
-
hasRules(game) && /* @__PURE__ */ (0,
|
|
1533
|
+
hasRules(game) && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_feedback_press3.Pressable, { onPress: () => onRules(game), style: styles4.rulesButton, hitSlop: 12, accessibilityRole: "button", accessibilityLabel: `${game.title} rules`, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native_paper2.Icon, { source: "information-outline", size: 22, color: well.fgMuted }) })
|
|
1513
1534
|
] })
|
|
1514
1535
|
);
|
|
1515
1536
|
});
|
|
1516
|
-
var GameTile = (0,
|
|
1537
|
+
var GameTile = (0, import_react18.memo)(function GameTile2({ game, width, previewWidth, dark, p1Color, p2Color, onOpen, onRules }) {
|
|
1517
1538
|
const { titleStyle } = usePack();
|
|
1518
1539
|
const well = (0, import_chrome7.useWellColors)();
|
|
1519
|
-
return /* @__PURE__ */ (0,
|
|
1520
|
-
/* @__PURE__ */ (0,
|
|
1521
|
-
/* @__PURE__ */ (0,
|
|
1522
|
-
/* @__PURE__ */ (0,
|
|
1523
|
-
/* @__PURE__ */ (0,
|
|
1540
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_react_native9.View, { style: { width }, children: [
|
|
1541
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_feedback_press3.Pressable, { onPress: () => onOpen(game), style: [styles4.tile, { backgroundColor: well.bg }], accessibilityRole: "button", accessibilityLabel: game.title, children: [
|
|
1542
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PreviewBox, { game, width: previewWidth, dark, p1Color, p2Color }),
|
|
1543
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native_paper2.Text, { variant: "titleMedium", style: [styles4.rowTitle, { color: well.fg }, titleStyle], numberOfLines: 1, children: game.title }),
|
|
1544
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native_paper2.Text, { variant: "bodySmall", style: { color: well.fgMuted }, numberOfLines: 3, children: game.blurb })
|
|
1524
1545
|
] }),
|
|
1525
|
-
hasRules(game) && /* @__PURE__ */ (0,
|
|
1546
|
+
hasRules(game) && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_feedback_press3.Pressable, { onPress: () => onRules(game), style: styles4.tileRulesButton, hitSlop: 12, accessibilityRole: "button", accessibilityLabel: `${game.title} rules`, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native_paper2.Icon, { source: "information-outline", size: 20, color: "#FFFFFF" }) })
|
|
1526
1547
|
] });
|
|
1527
1548
|
});
|
|
1528
1549
|
function PreviewBox({ game, width, dark, p1Color, p2Color }) {
|
|
1529
|
-
const revealed = (0,
|
|
1550
|
+
const revealed = (0, import_react18.useContext)(PreviewsRevealedContext);
|
|
1530
1551
|
const height = Math.round(width / PREVIEW_ASPECT);
|
|
1531
1552
|
const { Preview, icon: GameIcon } = game;
|
|
1532
1553
|
const iconSize = Math.min(height, ROW_ICON_SIZE);
|
|
1533
|
-
return /* @__PURE__ */ (0,
|
|
1554
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native9.View, { style: [styles4.preview, { width, height, backgroundColor: dark ? ICON_DARK_BG : ICON_LIGHT_BG }], children: Preview ? revealed && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Preview, { width, height, p1Color, p2Color, dark }) : GameIcon && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native9.View, { style: [styles4.previewIcon, { width: iconSize, height: iconSize, borderRadius: iconSize * 0.22 }], children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(GameIcon, { size: iconSize, p1Color, p2Color, dark }) }) });
|
|
1534
1555
|
}
|
|
1535
1556
|
var ROW_ICON_SIZE = 56;
|
|
1536
1557
|
var ICON_LIGHT_BG = "#FAFAFA";
|
|
@@ -1683,13 +1704,41 @@ var styles4 = import_react_native9.StyleSheet.create({
|
|
|
1683
1704
|
var import_auto_paper7 = require("@rific/auto-paper");
|
|
1684
1705
|
var import_chrome8 = require("@tastic/hud/chrome");
|
|
1685
1706
|
var import_profile10 = require("@tastic/profile");
|
|
1686
|
-
var
|
|
1687
|
-
var
|
|
1707
|
+
var import_expo_router11 = require("expo-router");
|
|
1708
|
+
var import_react20 = require("react");
|
|
1688
1709
|
var import_react_native10 = require("react-native");
|
|
1689
1710
|
var import_react_native_paper3 = require("react-native-paper");
|
|
1690
1711
|
var import_react_native_safe_area_context5 = require("react-native-safe-area-context");
|
|
1691
|
-
var
|
|
1692
|
-
|
|
1712
|
+
var import_react_redux12 = require("react-redux");
|
|
1713
|
+
|
|
1714
|
+
// src/components/Staged.tsx
|
|
1715
|
+
var import_react19 = require("react");
|
|
1716
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1717
|
+
function onShown(run) {
|
|
1718
|
+
let idle;
|
|
1719
|
+
let frame = requestAnimationFrame(() => {
|
|
1720
|
+
frame = requestAnimationFrame(() => {
|
|
1721
|
+
if (typeof requestIdleCallback === "function") idle = requestIdleCallback(run);
|
|
1722
|
+
else run();
|
|
1723
|
+
});
|
|
1724
|
+
});
|
|
1725
|
+
return () => {
|
|
1726
|
+
cancelAnimationFrame(frame);
|
|
1727
|
+
if (idle !== void 0) cancelIdleCallback(idle);
|
|
1728
|
+
};
|
|
1729
|
+
}
|
|
1730
|
+
function Staged({ first = 1, step = 1, children }) {
|
|
1731
|
+
const parts = (0, import_react19.useMemo)(() => import_react19.Children.toArray(children), [children]);
|
|
1732
|
+
const [drawn, setDrawn] = (0, import_react19.useState)(first);
|
|
1733
|
+
(0, import_react19.useEffect)(() => {
|
|
1734
|
+
if (drawn >= parts.length) return;
|
|
1735
|
+
return onShown(() => setDrawn(drawn + step));
|
|
1736
|
+
}, [drawn, parts.length, step]);
|
|
1737
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children: parts.slice(0, drawn) });
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
// src/screens/StatsScreen.tsx
|
|
1741
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1693
1742
|
var STATS = "stats";
|
|
1694
1743
|
var ACHIEVEMENTS = "achievements";
|
|
1695
1744
|
var TABS = [
|
|
@@ -1709,10 +1758,10 @@ var MANAGE_OPTION = { value: MANAGE, label: "Manage", icon: "account-cog-outline
|
|
|
1709
1758
|
var STATS_MAX_WIDTH = 640;
|
|
1710
1759
|
function StatsScreen() {
|
|
1711
1760
|
const pickerHost = (0, import_chrome8.usePopoverHost)();
|
|
1712
|
-
return /* @__PURE__ */ (0,
|
|
1761
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StatsPressAway, { host: pickerHost, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_chrome8.ScreenFrame, { portalHost: true, maxContentWidth: STATS_MAX_WIDTH, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StatsContent, { pickerHost }) }) });
|
|
1713
1762
|
}
|
|
1714
1763
|
function StatsPressAway({ host, children }) {
|
|
1715
|
-
return /* @__PURE__ */ (0,
|
|
1764
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native10.View, { testID: "stats-press-away", style: styles5.screen, onStartShouldSetResponder: () => host.openId !== null, onResponderRelease: host.close, children });
|
|
1716
1765
|
}
|
|
1717
1766
|
var useNoPackReset = () => null;
|
|
1718
1767
|
var noPickerAlign2 = () => void 0;
|
|
@@ -1722,13 +1771,13 @@ function StatsContent({ pickerHost }) {
|
|
|
1722
1771
|
const { dark, colors } = (0, import_auto_paper7.useAutoPaperTheme)();
|
|
1723
1772
|
const insets = (0, import_react_native_safe_area_context5.useSafeAreaInsets)();
|
|
1724
1773
|
const { profiles, lastSelected } = useProfiles();
|
|
1725
|
-
const dispatch = (0,
|
|
1774
|
+
const dispatch = (0, import_react_redux12.useDispatch)();
|
|
1726
1775
|
const fg = pack.foreground ?? colors.onBackground;
|
|
1727
|
-
const [tab, setTab] = (0,
|
|
1728
|
-
const [gameId, setGameId] = (0,
|
|
1776
|
+
const [tab, setTab] = (0, import_react20.useState)(STATS);
|
|
1777
|
+
const [gameId, setGameId] = (0, import_react20.useState)(ALL_GAMES2);
|
|
1729
1778
|
const useStatsPlayer = pack.useStatsPlayer ?? useNoStatsPlayer;
|
|
1730
1779
|
const statsPlayer = useStatsPlayer();
|
|
1731
|
-
const [selectedProfileId, setSelectedProfileId] = (0,
|
|
1780
|
+
const [selectedProfileId, setSelectedProfileId] = (0, import_react20.useState)(() => pack.useStatsPlayer ? statsPlayer : pack.guestStats ? lastSelected[1] ?? GUEST_PLAYER_ID : null);
|
|
1732
1781
|
const profileId = selectedProfileId && profiles.length > 0 && (pack.guestStats && selectedProfileId === GUEST_PLAYER_ID || profiles.some((p) => p.id === selectedProfileId)) ? selectedProfileId : null;
|
|
1733
1782
|
const homeTabs = pack.homeTabs && pack.homeTabs.length > 1 ? pack.homeTabs : null;
|
|
1734
1783
|
const pickedTab = homeTabs?.findIndex((_, index) => gameId === tabGames(index)) ?? -1;
|
|
@@ -1738,14 +1787,14 @@ function StatsContent({ pickerHost }) {
|
|
|
1738
1787
|
const packTabs = pack.statsTabs ?? NO_PACK_TABS;
|
|
1739
1788
|
const packTab = packTabs.find((t) => t.value === tab);
|
|
1740
1789
|
const showGamePicker = !(tab === ACHIEVEMENTS && pack.AchievementList);
|
|
1741
|
-
const playerOptions = (0,
|
|
1742
|
-
const gameOptions = (0,
|
|
1790
|
+
const playerOptions = (0, import_react20.useMemo)(() => [{ value: EVERYONE, label: "Everyone", icon: "account-group" }, ...pack.guestStats && profiles.length > 0 ? [{ value: GUEST_PLAYER_ID, label: "Guest", icon: "account-outline" }] : [], ...profiles.map((p) => ({ value: p.id, label: p.name, icon: "account", color: pack.previewColor ? pack.previewColor(p.color, dark) : p.color })), MANAGE_OPTION], [profiles, pack, dark]);
|
|
1791
|
+
const gameOptions = (0, import_react20.useMemo)(() => {
|
|
1743
1792
|
const all = { value: ALL_GAMES2, label: "All Games", icon: "view-grid-outline" };
|
|
1744
1793
|
const option = (g) => ({ value: g.id, label: g.title, icon: "cards-playing-outline" });
|
|
1745
1794
|
if (!homeTabs) return [all, ...pack.games.map(option)];
|
|
1746
1795
|
return [all, ...homeTabs.map((tab2, index) => ({ value: tabGroup(index), label: tab2.label, icon: "folder-outline", options: [{ value: tabGames(index), label: "All", triggerLabel: tab2.label, icon: "view-grid-outline" }, ...pack.games.filter((g) => tab2.includes(g)).map(option)] }))];
|
|
1747
1796
|
}, [pack.games, homeTabs]);
|
|
1748
|
-
const tabButtons = (0,
|
|
1797
|
+
const tabButtons = (0, import_react20.useMemo)(() => {
|
|
1749
1798
|
const buttons = packTabs.length > 0 ? [{ value: STATS, label: "Stats" }, ...packTabs.map(({ value, label }) => ({ value, label })), { value: ACHIEVEMENTS, label: "Achievements" }].map((button) => ({ ...button, style: LABEL_WIDE_TAB })) : TABS;
|
|
1750
1799
|
return pack.labelStyle ? buttons.map((button) => ({ ...button, labelStyle: pack.labelStyle })) : buttons;
|
|
1751
1800
|
}, [packTabs, pack.labelStyle]);
|
|
@@ -1761,16 +1810,16 @@ function StatsContent({ pickerHost }) {
|
|
|
1761
1810
|
const surface = pack.Backdrop ? { backgroundColor: colors.surface } : void 0;
|
|
1762
1811
|
const triggerStyle = pack.Backdrop ? [styles5.pill, surface] : void 0;
|
|
1763
1812
|
const PackTabContent = packTab?.Content;
|
|
1764
|
-
return /* @__PURE__ */ (0,
|
|
1765
|
-
/* @__PURE__ */ (0,
|
|
1766
|
-
/* @__PURE__ */ (0,
|
|
1767
|
-
/* @__PURE__ */ (0,
|
|
1768
|
-
/* @__PURE__ */ (0,
|
|
1769
|
-
showGamePicker && /* @__PURE__ */ (0,
|
|
1813
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_chrome8.BaseStatsScreen, { title, titleStyle: pack.titleStyle, onBack: import_core6.safeBack, insets, onReset: reset.onReset, resetLabel: reset.label, resetConfirmTitle: reset.title, resetConfirmBody: reset.body, fg: pack.foreground, bg: pack.Backdrop ? "transparent" : void 0, children: [
|
|
1814
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_chrome8.PressAwayOverlay, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles5.pressAway }),
|
|
1815
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native_paper3.SegmentedButtons, { value: tab, onValueChange: setTab, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles5.tabs, surface] }),
|
|
1816
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react_native10.View, { style: [styles5.filters, pickerHost.openId !== null && styles5.filtersOpen], onStartShouldSetResponder: () => pickerHost.openId !== null, children: [
|
|
1817
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_profile10.OptionPicker, { id: PLAYER_PICKER_ID, host: pickerHost, options: playerOptions, value: profileId ?? EVERYONE, onChange: (value) => value === MANAGE ? import_expo_router11.router.push(PROFILES_HREF) : setSelectedProfileId(value === EVERYONE ? null : value), color: colors.primary, dark, icon: profileId ? "account" : "account-group", caption: "Player", alignOverride: playerAlign, triggerStyle }),
|
|
1818
|
+
showGamePicker && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_profile10.OptionPicker, { id: GAME_PICKER_ID, host: pickerHost, options: gameOptions, value: gameId, onChange: setGameId, color: colors.primary, dark, icon: "view-grid-outline", caption: "Game", alignOverride: gameAlign, triggerStyle })
|
|
1770
1819
|
] }),
|
|
1771
|
-
tab === STATS && pack.StatsSections && /* @__PURE__ */ (0,
|
|
1772
|
-
PackTabContent && /* @__PURE__ */ (0,
|
|
1773
|
-
tab === ACHIEVEMENTS && pack.AchievementList ? /* @__PURE__ */ (0,
|
|
1820
|
+
tab === STATS && pack.StatsSections && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(pack.StatsSections, { profileId, gameId: oneGameId, gameIds }),
|
|
1821
|
+
PackTabContent && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(PackTabContent, { profileId, gameId: oneGameId, gameIds }),
|
|
1822
|
+
tab === ACHIEVEMENTS && pack.AchievementList ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(pack.AchievementList, { profileId }) : (tab === STATS || tab === ACHIEVEMENTS) && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Staged, { first: tab === STATS && pack.StatsSections ? 0 : 1, children: games.map((game) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(GameStats, { game, tab, profileId, showTitle: games.length > 1 && pack.statsGameTitles !== false, titleColor: fg }, game.id)) }, `${tab} ${gameId}`)
|
|
1774
1823
|
] });
|
|
1775
1824
|
}
|
|
1776
1825
|
function resetFor(pack, packReset, profileId, profiles, games, resetGames) {
|
|
@@ -1786,9 +1835,9 @@ function GameStats({ game, tab, profileId, showTitle, titleColor }) {
|
|
|
1786
1835
|
const { StatsSections, AchievementList } = game;
|
|
1787
1836
|
const Sections = tab === STATS ? StatsSections : AchievementList;
|
|
1788
1837
|
if (!Sections) return null;
|
|
1789
|
-
return /* @__PURE__ */ (0,
|
|
1790
|
-
showTitle && /* @__PURE__ */ (0,
|
|
1791
|
-
/* @__PURE__ */ (0,
|
|
1838
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react_native10.View, { style: styles5.game, children: [
|
|
1839
|
+
showTitle && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native_paper3.Text, { variant: "titleLarge", style: [styles5.gameTitle, { color: titleColor }, titleStyle], children: game.title }),
|
|
1840
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Sections, { profileId })
|
|
1792
1841
|
] });
|
|
1793
1842
|
}
|
|
1794
1843
|
var styles5 = import_react_native10.StyleSheet.create({
|
|
@@ -1826,21 +1875,21 @@ var styles5 = import_react_native10.StyleSheet.create({
|
|
|
1826
1875
|
|
|
1827
1876
|
// src/components/imageGameIcon.tsx
|
|
1828
1877
|
var import_react_native11 = require("react-native");
|
|
1829
|
-
var
|
|
1878
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1830
1879
|
function imageGameIcon(images) {
|
|
1831
1880
|
return function ImageGameIcon({ size, dark }) {
|
|
1832
|
-
return /* @__PURE__ */ (0,
|
|
1881
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_native11.Image, { source: dark ? images.dark : images.light, style: { height: size, width: size }, accessibilityIgnoresInvertColors: true });
|
|
1833
1882
|
};
|
|
1834
1883
|
}
|
|
1835
1884
|
|
|
1836
1885
|
// src/components/MatchChips.tsx
|
|
1837
1886
|
var import_auto_paper8 = require("@rific/auto-paper");
|
|
1838
1887
|
var import_feedback_press4 = require("@rific/feedback-press");
|
|
1839
|
-
var
|
|
1888
|
+
var import_react21 = require("react");
|
|
1840
1889
|
var import_react_native12 = require("react-native");
|
|
1841
1890
|
var import_react_native_reanimated3 = __toESM(require("react-native-reanimated"));
|
|
1842
1891
|
var import_react_native_safe_area_context6 = require("react-native-safe-area-context");
|
|
1843
|
-
var
|
|
1892
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1844
1893
|
var MATCH_CHIPS_FADE_MS = 150;
|
|
1845
1894
|
var CHIP_SIZE = 48;
|
|
1846
1895
|
var EDGE_PAD = 8;
|
|
@@ -1851,7 +1900,7 @@ function MatchChips({ playing, faceToFace, centerLineY, onBack, onSettings }) {
|
|
|
1851
1900
|
const atComputer = useAtComputer();
|
|
1852
1901
|
const visible = atComputer || !playing;
|
|
1853
1902
|
const opacity = (0, import_react_native_reanimated3.useSharedValue)(visible ? 1 : 0);
|
|
1854
|
-
(0,
|
|
1903
|
+
(0, import_react21.useEffect)(() => {
|
|
1855
1904
|
opacity.value = (0, import_react_native_reanimated3.withTiming)(visible ? 1 : 0, { duration: MATCH_CHIPS_FADE_MS });
|
|
1856
1905
|
}, [visible]);
|
|
1857
1906
|
const fadeStyle = (0, import_react_native_reanimated3.useAnimatedStyle)(() => ({ opacity: opacity.value }));
|
|
@@ -1862,9 +1911,9 @@ function MatchChips({ playing, faceToFace, centerLineY, onBack, onSettings }) {
|
|
|
1862
1911
|
const backSlot = { top, left: EDGE_PAD + insets.left };
|
|
1863
1912
|
const settingsSlot = { top, right: EDGE_PAD + insets.right };
|
|
1864
1913
|
const pointerEvents = visible ? "box-none" : "none";
|
|
1865
|
-
return /* @__PURE__ */ (0,
|
|
1866
|
-
/* @__PURE__ */ (0,
|
|
1867
|
-
/* @__PURE__ */ (0,
|
|
1914
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
1915
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native_reanimated3.default.View, { pointerEvents, style: [styles6.slot, backSlot, fadeStyle], testID: "match-chips-back", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_feedback_press4.IconButton, { icon: "arrow-left", iconColor, containerColor, style: styles6.chip, size: 24, onPress: onBack, accessibilityLabel: "Back" }) }),
|
|
1916
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native_reanimated3.default.View, { pointerEvents, style: [styles6.slot, settingsSlot, fadeStyle], testID: "match-chips-settings", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_feedback_press4.IconButton, { icon: "cog", iconColor, containerColor, style: styles6.chip, size: 24, onPress: onSettings, accessibilityLabel: "Settings" }) })
|
|
1868
1917
|
] });
|
|
1869
1918
|
}
|
|
1870
1919
|
var styles6 = import_react_native12.StyleSheet.create({
|
|
@@ -1873,31 +1922,31 @@ var styles6 = import_react_native12.StyleSheet.create({
|
|
|
1873
1922
|
});
|
|
1874
1923
|
|
|
1875
1924
|
// src/hooks/useActiveRound.ts
|
|
1876
|
-
var
|
|
1925
|
+
var import_react_redux13 = require("react-redux");
|
|
1877
1926
|
function useActiveRound(game, defaults) {
|
|
1878
|
-
const round = (0,
|
|
1927
|
+
const round = (0, import_react_redux13.useSelector)((state) => state.liveplay.activeRound);
|
|
1879
1928
|
const choices = usePackGame(game)?.seatTwo;
|
|
1880
1929
|
if (!round || round.game !== game) return { mode: roundModeFor(seatTwoFor(DEFAULT_OPPONENT.seatTwo, choices)), settings: defaults };
|
|
1881
1930
|
return { mode: round.mode, settings: { ...defaults, ...round.settings } };
|
|
1882
1931
|
}
|
|
1883
1932
|
|
|
1884
1933
|
// src/hooks/useBackBlock.ts
|
|
1885
|
-
var
|
|
1886
|
-
var
|
|
1934
|
+
var import_expo_router12 = require("expo-router");
|
|
1935
|
+
var import_react22 = require("react");
|
|
1887
1936
|
function useBackBlock(held, onHeld, leave = import_core6.safeBack) {
|
|
1888
|
-
const leavingRef = (0,
|
|
1889
|
-
const [leaving, setLeaving] = (0,
|
|
1890
|
-
const leaveRef = (0,
|
|
1891
|
-
(0,
|
|
1937
|
+
const leavingRef = (0, import_react22.useRef)(false);
|
|
1938
|
+
const [leaving, setLeaving] = (0, import_react22.useState)(false);
|
|
1939
|
+
const leaveRef = (0, import_react22.useRef)(leave);
|
|
1940
|
+
(0, import_react22.useEffect)(() => {
|
|
1892
1941
|
leaveRef.current = leave;
|
|
1893
1942
|
});
|
|
1894
|
-
(0,
|
|
1943
|
+
(0, import_expo_router12.usePreventRemove)(held && !leaving, ({ repeat }) => {
|
|
1895
1944
|
if (leavingRef.current) {
|
|
1896
1945
|
setLeaving(true);
|
|
1897
1946
|
repeat();
|
|
1898
1947
|
} else onHeld();
|
|
1899
1948
|
});
|
|
1900
|
-
return (0,
|
|
1949
|
+
return (0, import_react22.useCallback)(() => {
|
|
1901
1950
|
leavingRef.current = true;
|
|
1902
1951
|
leaveRef.current();
|
|
1903
1952
|
}, []);
|
|
@@ -2032,8 +2081,8 @@ function forgetProfileAchievements(dropStats) {
|
|
|
2032
2081
|
|
|
2033
2082
|
// src/gameStats.tsx
|
|
2034
2083
|
var import_achievements2 = require("@tastic/achievements");
|
|
2035
|
-
var
|
|
2036
|
-
var
|
|
2084
|
+
var import_react23 = require("react");
|
|
2085
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2037
2086
|
var SEATS = [1, 2];
|
|
2038
2087
|
function createGameStats({ key, defaultStats, isValidStats, catalog, getProfileStatsView }) {
|
|
2039
2088
|
const { actions: actions6, reducer: sliceReducer } = (0, import_achievements2.createAchievementsSlice)({
|
|
@@ -2050,7 +2099,7 @@ function createGameStats({ key, defaultStats, isValidStats, catalog, getProfileS
|
|
|
2050
2099
|
};
|
|
2051
2100
|
const reducer6 = onProfileRemoved(sliceReducer, forgetProfileAchievements(dropProfileStats));
|
|
2052
2101
|
const profileViews = (stats) => Object.fromEntries(Object.entries(stats.profiles).map(([profileId, bucket]) => [profileId, getProfileStatsView(bucket)]));
|
|
2053
|
-
const Context = (0,
|
|
2102
|
+
const Context = (0, import_react23.createContext)(null);
|
|
2054
2103
|
function Provider({ children }) {
|
|
2055
2104
|
const { stats, unlockedAchievements, recordOutcome, resetAll } = (0, import_achievements2.useAchievements)({
|
|
2056
2105
|
catalog,
|
|
@@ -2058,18 +2107,18 @@ function createGameStats({ key, defaultStats, isValidStats, catalog, getProfileS
|
|
|
2058
2107
|
actions: actions6,
|
|
2059
2108
|
profileViews
|
|
2060
2109
|
});
|
|
2061
|
-
const record = (0,
|
|
2110
|
+
const record = (0, import_react23.useCallback)(
|
|
2062
2111
|
(update, profileIds) => {
|
|
2063
2112
|
const result = recordOutcome(update);
|
|
2064
2113
|
return { device: result.device, profiles: (0, import_achievements2.mapUnlocksBySeat)(SEATS, profileIds, result.profiles) };
|
|
2065
2114
|
},
|
|
2066
2115
|
[recordOutcome]
|
|
2067
2116
|
);
|
|
2068
|
-
const value = (0,
|
|
2069
|
-
return /* @__PURE__ */ (0,
|
|
2117
|
+
const value = (0, import_react23.useMemo)(() => ({ stats, unlockedAchievements, record, resetAll }), [stats, unlockedAchievements, record, resetAll]);
|
|
2118
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Context.Provider, { value, children });
|
|
2070
2119
|
}
|
|
2071
2120
|
function useStats() {
|
|
2072
|
-
const ctx = (0,
|
|
2121
|
+
const ctx = (0, import_react23.useContext)(Context);
|
|
2073
2122
|
if (!ctx) throw new Error(`The ${key} stats are read within their game's Provider`);
|
|
2074
2123
|
return ctx;
|
|
2075
2124
|
}
|
|
@@ -2077,8 +2126,8 @@ function createGameStats({ key, defaultStats, isValidStats, catalog, getProfileS
|
|
|
2077
2126
|
}
|
|
2078
2127
|
|
|
2079
2128
|
// src/playerSettings.ts
|
|
2080
|
-
var
|
|
2081
|
-
var
|
|
2129
|
+
var import_react24 = require("react");
|
|
2130
|
+
var import_react_redux14 = require("react-redux");
|
|
2082
2131
|
var SEATS2 = [1, 2];
|
|
2083
2132
|
function seatPlayerKey(selection, seat) {
|
|
2084
2133
|
return selection[seat] ?? `guest:${seat}`;
|
|
@@ -2116,13 +2165,13 @@ function createPlayerSettings({ id, defaults, distinctControls }) {
|
|
|
2116
2165
|
return compose(root[settingsKey], root[controlsKey], state.profileSelection, state.opponent.seatTwo === "person");
|
|
2117
2166
|
}
|
|
2118
2167
|
function useSettings() {
|
|
2119
|
-
const selection = (0,
|
|
2120
|
-
const seatTwoIsPerson = (0,
|
|
2121
|
-
const saved = (0,
|
|
2122
|
-
const controls = (0,
|
|
2123
|
-
const dispatch = (0,
|
|
2124
|
-
const settings = (0,
|
|
2125
|
-
const setSettings = (0,
|
|
2168
|
+
const selection = (0, import_react_redux14.useSelector)((state) => state.profileSelection);
|
|
2169
|
+
const seatTwoIsPerson = (0, import_react_redux14.useSelector)((state) => state.opponent.seatTwo === "person");
|
|
2170
|
+
const saved = (0, import_react_redux14.useSelector)((state) => state[settingsKey]);
|
|
2171
|
+
const controls = (0, import_react_redux14.useSelector)((state) => state[controlsKey]);
|
|
2172
|
+
const dispatch = (0, import_react_redux14.useDispatch)();
|
|
2173
|
+
const settings = (0, import_react24.useMemo)(() => compose(saved, controls, selection, seatTwoIsPerson), [saved, controls, selection, seatTwoIsPerson]);
|
|
2174
|
+
const setSettings = (0, import_react24.useCallback)(
|
|
2126
2175
|
(next) => {
|
|
2127
2176
|
const { controlScheme, ...changes } = next;
|
|
2128
2177
|
if (Object.keys(changes).length > 0) dispatch(patch(seatPlayerKey(selection, 1), changes));
|
|
@@ -2155,6 +2204,7 @@ function createPlayerSettings({ id, defaults, distinctControls }) {
|
|
|
2155
2204
|
ProfilesRoute,
|
|
2156
2205
|
RootLayout,
|
|
2157
2206
|
SettingsDialog,
|
|
2207
|
+
Staged,
|
|
2158
2208
|
StatsScreen,
|
|
2159
2209
|
appSettingsActions,
|
|
2160
2210
|
appSettingsReducer,
|
|
@@ -2186,6 +2236,7 @@ function createPlayerSettings({ id, defaults, distinctControls }) {
|
|
|
2186
2236
|
useAtComputer,
|
|
2187
2237
|
useBackBlock,
|
|
2188
2238
|
useGameGuide,
|
|
2239
|
+
useGuideCovering,
|
|
2189
2240
|
useOpponent,
|
|
2190
2241
|
usePack,
|
|
2191
2242
|
usePackGame,
|