@tastic/shell 0.10.0 → 0.12.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 +143 -19
- package/dist/index.d.mts +6 -7
- package/dist/index.d.ts +6 -7
- package/dist/index.js +39 -43
- package/dist/index.mjs +43 -47
- package/package.json +9 -8
- package/src/RootLayout.tsx +9 -17
- package/src/hooks/useAppSettings.ts +1 -1
- package/src/redux/createPackStore.ts +1 -8
- package/src/redux/shellState.ts +4 -10
- package/src/screens/HomeScreen.tsx +6 -4
- package/src/screens/LoadoutScreen.tsx +30 -22
- package/src/screens/ProfilesRoute.tsx +6 -7
- package/src/screens/StatsScreen.tsx +6 -7
- package/src/screens/homeLayout.ts +5 -5
- package/src/types.ts +16 -2
package/README.md
CHANGED
|
@@ -28,12 +28,15 @@ package ecosystem, on [`@tastic/hud`](https://github.com/jayrdeaton/react-native
|
|
|
28
28
|
middleware })` builds one persisted store from the shell's keys (theme, haptics, sound, Keep Awake,
|
|
29
29
|
profiles, seat selection, seat colors, app settings, seat 2, the never-saved `liveplay`, and
|
|
30
30
|
`lastActiveGame` in a pack with a resumable game), the pack's own `reducers` and every game's own
|
|
31
|
-
`reducers`.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
`reducers`. Each of the shell's keys exports its reducer, actions and defaults, and
|
|
32
|
+
`createShellReducers` builds them all (see [The store's keys](#the-stores-keys)).
|
|
33
|
+
- **What a game builds on**: `createPlayerSettings` and `seatPlayerKey` (its settings and controls,
|
|
34
|
+
kept per player), `createGameStats` (its stats and achievements), `createGameGuideSlice` (which
|
|
35
|
+
version of its How to Play a player has seen), `onProfileRemoved` (forget a deleted profile),
|
|
36
|
+
`usePack` and `usePackGame`, `useActiveRound`, `useProfiles`, `useSeatColors`, `useOpponent`,
|
|
37
|
+
`useAppSettings`, `useGameGuide`, `useAtComputer`, `roundModeFor`, `humanSeatsFor`, `seatTwoFor`,
|
|
38
|
+
`MatchChips`, `SettingsDialog`, `safeBack`, `useBackBlock` (Android's and the browser's back
|
|
39
|
+
mid-match open Quit Match?) and `imageGameIcon` (see [Hooks and helpers](#hooks-and-helpers)).
|
|
37
40
|
|
|
38
41
|
## Install
|
|
39
42
|
|
|
@@ -123,7 +126,7 @@ PuckTastic and DuelTastic draw what they always did:
|
|
|
123
126
|
| `seatTheme?` | `(colors, dark) => ({ color, harmony })`: the theme the seats' colors make (a muted seed from seat 1's color), applied whenever they or dark mode change and as a fresh install's theme, in place of a triad of the raw colors. With it, `useSeatColors` reads each seat's color from where it's remembered (`seatColors`) rather than from the theme. |
|
|
124
127
|
| `previewColor?` | `(hex, dark) => string`: how every profile color is drawn (the seat buttons and their swatches on Home and in the loadouts, a loadout's Ready button and seat controls, each `ProfileChip`), mounted as `@tastic/profile`'s `ProfileColorProvider`. Saved colors stay as picked. |
|
|
125
128
|
| `guide?` | The pack's own How to Play (`PackGuide`: `version`, `selectVersionSeen`, `markSeen`, `getSteps({ touch })`), for cards that teach every game at once: shown on Home's first launch (never while a cold launch resumes a game), replayed from Home's Settings, never in a play screen. Its seen version is a key of the pack's own. |
|
|
126
|
-
| `guestLabel?`, `nullLabel?` | Seat 1's button on Home and in every loadout: the chip's label for a guest (default `'P1'`) and the guest row's in its menu. |
|
|
129
|
+
| `guestLabel?`, `nullLabel?` | Seat 1's button on Home and in every loadout: the chip's label for a guest (default `'P1'`) and the guest row's in its menu. A 2 Player loadout's seat 2 button takes the same two (its guest default `'P2'`). |
|
|
127
130
|
| `guestStats?` | The stats screen keeps a guest's stats under `GUEST_PLAYER_ID` (`'guest'`): a Guest entry between Everyone and the profiles once a profile exists, and the screen opens on seat 1's player. Without it the screen opens on Everyone, where guests count. |
|
|
128
131
|
| `AchievementList?` | One achievement list across the pack's games, on the Achievements tab, with the game picker hidden there. |
|
|
129
132
|
| `statsTabs?` | Tabs of the pack's own between Stats and Achievements (`PackStatsTab`: `value`, `label`, `Content`, handed both filters). With them every tab is as wide as its label, with no icons, so three fit a phone. |
|
|
@@ -131,13 +134,16 @@ PuckTastic and DuelTastic draw what they always did:
|
|
|
131
134
|
| `statsGameTitles?` | `false` leaves each game's name off its sections on All Games, where the sections name it. |
|
|
132
135
|
| `newProfileColor?` | A new profile's starting color on Profiles. Unset is auto-paper's first swatch. |
|
|
133
136
|
| `usePickerAlign?` | `(open, contentWidth, contentHeight, options?) => AlignResult` (`PickerAlign`), a hook: where seat 1's menu on Home, both seat buttons' menus in a loadout's one-human row (2 Player keeps each menu in its own player's half), the stats screen's two pickers and a profile's color swatch open. It was added because hud's own placement measured a button in a frame turned by `@tastic/core`'s drawn rotation against the upright window (Solitaire's `useFrameAutoAlign`); nothing turns since core 0.15, so a pack may no longer need one. Profiles passes `{ maxContentWidth: 640 }`, its roster's column. Unset is hud's placement. |
|
|
137
|
+
| `resumeHref?` | `(gameId) => Href \| null`: where a cold launch goes back into a resumable game, for a pack with more than one way to be playing it. Null, or unset, is the game's play screen. |
|
|
138
|
+
| `homePlayerPicker?` | `false` leaves seat 1's button off Home, for a pack whose every game opens a loadout, where the player is picked anyway. |
|
|
134
139
|
| `homeTabs?` | Tabs splitting Home's games (`HomeTab`: a `label`, and `includes(game)`, which of the pack's games it shows, in the pack's order): a switch under seat 1's button, or over the grid on a wide screen, on the theme's surface over a `Backdrop`, showing one tab's games at a time. It opens on the first tab and keeps the one picked while Home is covered or the window changes. The other tabs' games stay mounted, hidden, so a switch draws nothing new. A game no tab includes isn't on Home. Unset, or a single tab, shows every game with no switch. Solitaire's: Solitaire (no `seatTwo`) and Two Player. |
|
|
135
140
|
|
|
136
141
|
### `GameDefinition`
|
|
137
142
|
|
|
138
143
|
Each game is one object: its `id`, `title`, `blurb` and `icon` (a component drawn in the seats'
|
|
139
|
-
colors,
|
|
140
|
-
|
|
144
|
+
colors, handed `GameIconProps`: `size`, `p1Color`, `p2Color` and `dark`; or `imageGameIcon({ light,
|
|
145
|
+
dark })` for a light and dark pair of pictures), its seat 2 choices (`seatTwo`, each a `SeatTwo`: `'cpu'`,
|
|
146
|
+
`'person'`, `'nobody'`), whether 2 Player seats its players side by side
|
|
141
147
|
at a computer (`sideBySideAtComputer`) and in a wide window (`sideBySideWhenWide`), the store `reducers` it mounts, its root `Provider`, its `useLoadout(mode)`, its
|
|
142
148
|
`PlayScreen`, its `StatsSections` and `AchievementList`, `resetStats`, and its How to Play `guide`.
|
|
143
149
|
See `src/types.ts` for every field.
|
|
@@ -162,9 +168,30 @@ What a game can leave out or add, each optional, so a two-seat game sets none of
|
|
|
162
168
|
A game never imports another game, and the shell never imports a game: games reach the shell only
|
|
163
169
|
through the pack (`usePack()`).
|
|
164
170
|
|
|
171
|
+
`useLoadout(mode)` returns the game's part of the loadout (`GameLoadout`), built from its own saved
|
|
172
|
+
settings for the round `mode` seat 2 makes:
|
|
173
|
+
|
|
174
|
+
| Field | |
|
|
175
|
+
| --- | --- |
|
|
176
|
+
| `roundSettings` | The settings the round plays with, committed (liveplay's `activeRound.settings`) once every human seat is Ready. The play screen reads them back with `useActiveRound`. |
|
|
177
|
+
| `options` | `(props: LoadoutOptionsProps) => ReactNode`: the match-options row (board, rules, puck), drawn under the loadout's popover `host` in its colors (`accentColor`, `mutedColor`, `onAccentColor`, `dark`). `onRandomize` and `onReset` are undefined while the loadout folds them into its shared action band. |
|
|
178
|
+
| `placesSeats?` | With one person the seat buttons sit under `options`, over Ready. `true` passes them to `options` as `seats` instead, so a game can put them where it likes (CardTastic: under the game's name, above its rules). 2 Player's seats stay in each person's half. |
|
|
179
|
+
| `optionIds` | The popover ids the options row opens, so the loadout lifts the row while one is open. |
|
|
180
|
+
| `randomize`, `reset` | The loadout's randomize and reset buttons. |
|
|
181
|
+
| `seatControl` | `(seat, host, look) => ReactNode \| undefined`: a human seat's controls picker (shot style, keys) in `look`'s colors (`SeatControlLook`: `accentColor`, `seatColor`, `mutedColor`, `dark`), or undefined where the game has none. |
|
|
182
|
+
| `cpuDifficulty?` | The CPU's levels (`{ value, options, onChange }`, the options hud's `MenuOption`s), saved per game, in player 1's opponent menu. Left out by a game with no seat 2, or whose CPU has no levels. |
|
|
183
|
+
|
|
184
|
+
A game's `guide` (`GameGuide`) builds its How to Play cards from the live settings: `version`,
|
|
185
|
+
`selectVersionSeen(state)` and `markSeen(version)` (from `createGameGuideSlice`), `selectInput(state)`
|
|
186
|
+
(the settings the cards read, as a flat object, compared shallowly) and `getSteps(input, { touch,
|
|
187
|
+
mode })`, hud's `GuideStep`s for a touch-first device or not and the round (`RoundMode`) seat 2's
|
|
188
|
+
saved choice makes in this game (`seatTwoFor`).
|
|
189
|
+
|
|
165
190
|
### `createPackStore`
|
|
166
191
|
|
|
167
|
-
`createPackStore(pack, config)
|
|
192
|
+
`createPackStore(pack, config)` returns `{ store, persistor }` (`PackStore` is the store's type). It
|
|
193
|
+
reads only the pack's `seatColors`, `appearance`, `seatTheme`, `reducers` and its games' `reducers` and
|
|
194
|
+
`resumable` (`PackStoreSource`). `config` is `PackStoreConfig`:
|
|
168
195
|
|
|
169
196
|
| Field | |
|
|
170
197
|
| --- | --- |
|
|
@@ -174,6 +201,97 @@ through the pack (`usePack()`).
|
|
|
174
201
|
| `serializableIgnoredPaths?` | State paths the dev serializability check skips (keys too big to walk on every action). |
|
|
175
202
|
| `middleware?` | The pack's own middleware, after the shell's (Solitaire's settings that follow the player). |
|
|
176
203
|
|
|
204
|
+
### The store's keys
|
|
205
|
+
|
|
206
|
+
`createPackStore` mounts these beside the pack's and the games' own keys.
|
|
207
|
+
`createShellReducers({ seatColors, appearance, seatTheme })` builds the same set (all but
|
|
208
|
+
`lastActiveGame`), and `ShellState` is their state, what a game's selectors read. Each key's reducer,
|
|
209
|
+
actions and defaults are exported for a pack's own code and its tests.
|
|
210
|
+
|
|
211
|
+
| Key | |
|
|
212
|
+
| --- | --- |
|
|
213
|
+
| `theme` | auto-paper's theme, starting from the pack's `appearance` and a triad of its `seatColors` (or what `seatTheme` makes of them). |
|
|
214
|
+
| `haptic`, `sound` | feedback-press's settings. Sound starts off in a development build. |
|
|
215
|
+
| `keepAwake` | `@rific/core`'s Keep Awake setting. |
|
|
216
|
+
| `profiles` | `@tastic/profile`'s roster, kept in step with the shared one (see `useProfiles`). |
|
|
217
|
+
| `profileSelection` | Which profile each seat last picked, null for a guest: `profileSelectionReducer`, starting from `defaultProfileSelectionState` (`{ 1: null, 2: null }`). `profileSelectionActions`: `select({ seat, profileId })` (a profile already in the other seat swaps the two), `clearProfile(profileId)` and `pruneToRoster(profileIds)`. Never shared with a sibling app. |
|
|
218
|
+
| `seatColors` | Each seat's remembered color: `createSeatColorsReducer(seatColors)`, starting from `defaultSeatColorsState(seatColors)` (each guest seat on its own seat color, the CPU on seat 2's, no profile picks). `seatColorsActions`: `setLastGuestColor({ seat, color })`, `setLastCpuColor(color)` and `setProfileColor({ profile, color })`, a profile's pick in this pack (null, or the profile's own color, drops it). |
|
|
219
|
+
| `appSettings` | Settings for the whole pack (`AppSettings`): `deferBottomEdgeGestures`, Edge Guard's opt-in, false in `DEFAULT_APP_SETTINGS`. `appSettingsReducer`, and `appSettingsActions.initialize(patch)`, which merges. Read and written with `useAppSettings`. |
|
|
220
|
+
| `opponent` | Who sits in seat 2 for the whole pack (`OpponentState`: `seatTwo`), the CPU in `DEFAULT_OPPONENT`. `opponentReducer`, and `opponentActions`: `setSeatTwo(seatTwo)` and `initialize(state)`. Read and written with `useOpponent`. |
|
|
221
|
+
| `liveplay` | This round, never saved (`LiveplaySliceState`): `activelyPlaying` (false) and `activeRound` (null until a loadout commits one; `ActiveRound`: `game`, `mode`, `settings`). `liveplayReducer`, and `liveplayActions`: `setActivelyPlaying(on)`, `setActiveRound(round)` and `initialize(state)`. A play screen sets `activelyPlaying` while a round is live and unpaused, and back to false as it unmounts: Edge Guard, when the player has turned it on, only guards while it's true. |
|
|
222
|
+
| `lastActiveGame` | Only in a pack with a `resumable` game: the play screen a cold launch resumes. Not exported. |
|
|
223
|
+
|
|
224
|
+
### Building a game's keys
|
|
225
|
+
|
|
226
|
+
- `createPlayerSettings({ id, defaults, distinctControls })`: a game's loadout settings, kept per
|
|
227
|
+
player. `defaults` holds every setting, with `controlScheme` (`{ 1, 2 }`) for each seat's controls.
|
|
228
|
+
The match settings follow seat 1's player (only what they changed is saved, so a setting added later
|
|
229
|
+
starts at its default), and each seat's controls follow the player in it (seat 2's only for a
|
|
230
|
+
person). `distinctControls`, optional, lists every control in menu order where the two seats can't
|
|
231
|
+
share one (a desktop key cluster): when both would get the same, seat 2 shows and plays the first
|
|
232
|
+
one seat 1 isn't using, never saved. It returns `reducers` (`<id>Settings` and `<id>Controls`, for
|
|
233
|
+
the game's own `reducers`), `settingsReducer`, `controlsReducer`, `actions` (`patch(player,
|
|
234
|
+
changes)`, `setControl(player, control)`), `compose(saved, controls, selection, seatTwoIsPerson)`,
|
|
235
|
+
`select(state)` (the same settings read straight from the store, as How to Play reads them) and
|
|
236
|
+
`useSettings()` (`{ settings, setSettings(patch) }`, the loadout's one write path). A deleted
|
|
237
|
+
profile's settings and controls go with it.
|
|
238
|
+
- `seatPlayerKey(selection, seat)`: who a seat's saved settings belong to: the profile picked for it,
|
|
239
|
+
or that seat's guest (`'guest:1'`, `'guest:2'`).
|
|
240
|
+
- `createGameStats({ key, defaultStats, isValidStats, catalog, getProfileStatsView })`: one game's
|
|
241
|
+
stats and achievements, on `@tastic/achievements`' `createAchievementsSlice` under the store key
|
|
242
|
+
`key`. The stats keep a `profiles` bucket per profile beside the device-wide totals, and
|
|
243
|
+
`getProfileStatsView(bucket)` shows a bucket in the same shape, so every achievement in `catalog`
|
|
244
|
+
reads either. `isValidStats` is optional. It returns `reducer` (a deleted profile takes its bucket
|
|
245
|
+
and unlocks with it), `actions`, `Provider` (the game's `Provider`) and `useStats()`: `stats`,
|
|
246
|
+
`unlockedAchievements`, `record(update, profileIds)`, which applies a result and returns what it
|
|
247
|
+
unlocked (`RecordResult`: `device`, and `profiles` by seat for each seat the optional `profileIds`
|
|
248
|
+
maps to a profile), and
|
|
249
|
+
`resetAll()`.
|
|
250
|
+
- `createGameGuideSlice(mountKey)`: which version of a game's How to Play a player has finished or
|
|
251
|
+
skipped, under the game's own key: `{ actions: { markSeen }, reducer, selectVersionSeen }`, for its
|
|
252
|
+
`GameGuide`. Unlike hud's `createGuideSlice`, a saved store without the key reads as not seen, so a
|
|
253
|
+
game added to a pack in an update shows its cards to everyone.
|
|
254
|
+
- `onProfileRemoved(reducer, forget)`: wraps a game's reducer so it runs `forget(state, profileId)`
|
|
255
|
+
when the Profiles screen deletes a profile (not when a sibling app's roster sync drops one).
|
|
256
|
+
`forgetProfileAchievements(dropStats)` is a `forget` for a `createAchievementsSlice` state: it drops
|
|
257
|
+
the profile's unlocks, and its stats through `dropStats(stats, profileId)`.
|
|
258
|
+
|
|
259
|
+
### Hooks and helpers
|
|
260
|
+
|
|
261
|
+
`RootLayout` mounts every provider these read.
|
|
262
|
+
|
|
263
|
+
- `usePack()`: the `PackDefinition`. `usePackGame(id)`: one of its games, or undefined for an id the
|
|
264
|
+
pack doesn't have. `PackProvider` (`pack`, `children`) provides them.
|
|
265
|
+
- `useProfiles()`: `profiles`, `lastSelected` (each seat's profile id, or null), `loaded`,
|
|
266
|
+
`createProfile(input)`, `updateProfile(id, patch)`, `deleteProfile(id)` (which also clears it from
|
|
267
|
+
any seat) and `selectProfile(seat, profileId)`. Its `ProfilesProvider` reconciles the saved roster
|
|
268
|
+
with `@tastic/profile`'s shared one in the App Group `group.com.infinitetoken.tastic` once at launch
|
|
269
|
+
(`loaded` turns true then, and the splash screen waits for it) and keeps the two in step.
|
|
270
|
+
- `useSeatColors(p2IsHuman)`: both seats' live colors and their pickers' handlers (`p1Color`,
|
|
271
|
+
`p2Color`, `handleP1ColorChange`, `handleP2ColorChange`), with the theme following them (see
|
|
272
|
+
`seatTheme`). A pick of the other seat's current color swaps the two.
|
|
273
|
+
- `useActiveRound(game, defaults)`: the round a play screen plays, `{ mode, settings }`: the one its
|
|
274
|
+
loadout committed, with its settings over `defaults`, or with none (a direct link, a web reload, a
|
|
275
|
+
game with no loadout) `defaults` and the mode a fresh install's seat 2 makes in this game.
|
|
276
|
+
- `useOpponent()`: `{ seatTwo, setSeatTwo }`, seat 2's saved choice for the whole pack.
|
|
277
|
+
- `useAppSettings()`: `{ settings, setSettings(patch) }`, the pack-wide settings (`AppSettings`). A
|
|
278
|
+
patch changes only the fields it names.
|
|
279
|
+
- `useGameGuide()`: How to Play. `openFirstTime(gameId, next)` shows a game's cards if this player
|
|
280
|
+
hasn't finished or skipped this version, then runs `next` once they close (at once otherwise);
|
|
281
|
+
`openFor(gameId)` shows them now; `openPack()` shows the pack's own `guide`; `autoShowPack()` shows
|
|
282
|
+
it once per session while unseen (Home's first launch). A game with no cards of its own opens
|
|
283
|
+
nothing.
|
|
284
|
+
- `useAtComputer()`: true on the web without a touch-first screen (`@tastic/core`'s
|
|
285
|
+
`useIsTouchPrimaryDevice`), where `sideBySideAtComputer` and `MatchChips` see a computer.
|
|
286
|
+
- `roundModeFor(seatTwo)`: `'cpu'` is `'vsCpu'`, `'person'` `'twoPlayer'` and `'nobody'` `'solo'`.
|
|
287
|
+
`humanSeatsFor(mode)`: the seats that press Ready, `[1, 2]` in 2 Player and `[1]` otherwise.
|
|
288
|
+
`seatTwoFor(saved, choices)`: seat 2's saved choice as one game reads it (see `GameDefinition`).
|
|
289
|
+
- `SettingsDialog` (`SettingsDialogProps`): `visible`, `onDismiss`, `onShowHowToPlay` (optional: shows
|
|
290
|
+
the How to Play row, as a loadout does; left out on Home and in a match) and `children` (a play
|
|
291
|
+
screen's own rows). The pack's `useSettingsRules` goes above the shell's rows, and `children` and
|
|
292
|
+
then the pack's `SettingsSections` under them.
|
|
293
|
+
- `safeBack()`: back, or Home (`/`) where there's nothing to go back to.
|
|
294
|
+
|
|
177
295
|
### On every pack (0.2.0)
|
|
178
296
|
|
|
179
297
|
Six fixes CardTastic's move brought to every pack's screens: Home's press-away overlay sits in the
|
|
@@ -182,7 +300,7 @@ scroller, so a press on a row played the game), seat 1's menu closes on every ch
|
|
|
182
300
|
Home's scrollers fade out at an edge with more past it (auto-paper's `FadingScrollView`), a press
|
|
183
301
|
anywhere on the stats screen (its header and margins too) closes a picker's menu, the stats screen's
|
|
184
302
|
column is capped at 640pt in the wide layout, and Profiles' roster is capped at 640pt in the wide
|
|
185
|
-
layout (hud's `
|
|
303
|
+
layout (hud's `ScreenFrame`, `RotatedFrame` before hud 0.34). Every hud import goes through `@tastic/hud/chrome`,
|
|
186
304
|
`/guide` or `/lobby`, so an app with no Skia can install the shell; a pack's own imports don't change.
|
|
187
305
|
The shell's routes are handed to expo-router as plain `Href`s, so an app with typed routes type-checks
|
|
188
306
|
the shell before its own routes match.
|
|
@@ -202,7 +320,7 @@ longer reads the accelerometer, draws a turn or offers Lock Orientation. A pack
|
|
|
202
320
|
### The chips over a match (0.6.0)
|
|
203
321
|
|
|
204
322
|
`MatchChips` is every game's back and settings chips during a match, so they sit and show the same
|
|
205
|
-
way in every game of every pack. A play screen renders it with `playing` (true while play is on: a
|
|
323
|
+
way in every game of every pack. A play screen renders it (`MatchChipsProps`) with `playing` (true while play is on: a
|
|
206
324
|
live puck, a shot in flight, a round being ridden), `faceToFace` (two players at opposite ends of the
|
|
207
325
|
screen right now) and `onBack`/`onSettings`, plus `centerLineY` when the line between the players isn't
|
|
208
326
|
the window's middle.
|
|
@@ -249,8 +367,9 @@ const quit = useBackBlock(hasProgress, requestBack)
|
|
|
249
367
|
|
|
250
368
|
## Peer dependencies
|
|
251
369
|
|
|
252
|
-
None are bundled. The floors
|
|
253
|
-
became a package (the lower of the two where they differ)
|
|
370
|
+
None are bundled. The floors started as the versions PuckTastic and DuelTastic ran the shell on when
|
|
371
|
+
it became a package (the lower of the two where they differ), and some have been raised since for
|
|
372
|
+
what the shell started using (noted in the table).
|
|
254
373
|
|
|
255
374
|
| Peer | Floor | Used for |
|
|
256
375
|
| --- | --- | --- |
|
|
@@ -261,19 +380,24 @@ became a package (the lower of the two where they differ).
|
|
|
261
380
|
| `expo-constants` | >=58.0.12 | the web tab title |
|
|
262
381
|
| `expo-blur`, `@react-native-masked-view/masked-view` | >=58.0.4, >=0.3.2 | auto-paper's blur and its scroll fade, Home's fading scrollers |
|
|
263
382
|
| `expo-haptics`, `expo-keep-awake` | >=58.0.7, >=58.0.3 | the toaster's haptics, Keep Awake |
|
|
383
|
+
| `expo-audio` | >=58.0.11 | the UI sounds, through `@rific/feedback-press/audio` |
|
|
264
384
|
| `react-native-gesture-handler`, `react-native-reanimated`, `react-native-safe-area-context` | >=3.3.0, >=4.7.1, >=5.11.0 | the gesture root, auto-paper's dialogs and the loadout's fades, insets (with room for iPadOS's window controls) |
|
|
265
385
|
| `react-native-paper` | >=5.15.3 | text, icons, the toaster and feedback-press |
|
|
266
386
|
| `@reduxjs/toolkit`, `redux`, `react-redux`, `redux-persist`, `@react-native-async-storage/async-storage` | >=2.13.0, >=5.0.1, >=9.3.0, >=6.0.0, >=2.2.0 | the store and where it's saved |
|
|
267
387
|
| `@rific/auto-paper` | >=0.13.4 | the theme |
|
|
268
388
|
| `@rific/core` | >=0.5.0 | settings slices, Keep Awake, `safeBack` |
|
|
269
389
|
| `@rific/feedback-press` | >=0.13.1 | haptic and sound settings, the UI sounds |
|
|
270
|
-
| `@rific/toaster` | >=0.10.1 | toasts
|
|
271
|
-
| `@tastic/core` | >=0.
|
|
272
|
-
| `@tastic/hud` | >=0.
|
|
273
|
-
| `@tastic/profile` | >=0.
|
|
390
|
+
| `@rific/toaster` | >=0.10.1 | toasts |
|
|
391
|
+
| `@tastic/core` | >=0.16.0 | the seat mode from the window's shape, the root background, the test for a computer behind `useAtComputer` (0.16.0's `useIsTouchPrimaryDevice`) |
|
|
392
|
+
| `@tastic/hud` | >=0.34.0 | Settings, the stats screen, the loadout's panels (its Skia-free `/lobby` entry, new in 0.26.0; 0.27.1's options for a pack drawn on its own backdrop; 0.28.0's Ready pill; 0.29.0's leading Settings sections), How to Play, and `ScreenFrame` around the stats screen, Profiles and the toaster (0.34.0, where `RotatedFrame` became `ScreenFrame`) |
|
|
393
|
+
| `@tastic/profile` | >=0.18.0 | profiles and the shared roster, the seat buttons, seat colors, the dividers in player 1's opponent menu (0.18.0's `dividerBefore`) |
|
|
274
394
|
| `@tastic/achievements` | >=0.6.0 | `createGameStats`, `forgetProfileAchievements` |
|
|
275
395
|
| `@tastic/split-screen` | >=0.5.5 | the 2 Player loadout's two halves |
|
|
276
396
|
| `@tastic/edge-guard` | >=0.2.0 | Edge Guard during play (`useEdgeGestureGuard` on iOS, `edgeGuardScreenOptions` on Android) |
|
|
277
397
|
|
|
278
398
|
The two UI sounds every button plays (`assets/sounds/select.wav` and `notification.wav`) ship with the
|
|
279
|
-
package.
|
|
399
|
+
package. They play through `@rific/feedback-press/audio`'s `useAudioPool`, which imports `expo-audio`.
|
|
400
|
+
|
|
401
|
+
---
|
|
402
|
+
|
|
403
|
+
Made by [Infinite Token](https://www.infinitetoken.com), the team behind [Lumber](https://lumber.infinitetoken.com): end-to-end encrypted logging.
|
package/dist/index.d.mts
CHANGED
|
@@ -6,7 +6,7 @@ import { PopoverHost, AlignResult } from '@tastic/hud/chrome';
|
|
|
6
6
|
import { GuideStep } from '@tastic/hud/guide';
|
|
7
7
|
import { MenuOption } from '@tastic/hud/lobby';
|
|
8
8
|
import { FontSource } from 'expo-font';
|
|
9
|
-
import { Stack } from 'expo-router';
|
|
9
|
+
import { Href, Stack } from 'expo-router';
|
|
10
10
|
import * as redux from 'redux';
|
|
11
11
|
import { Reducer, Action } from 'redux';
|
|
12
12
|
import * as _rific_core from '@rific/core';
|
|
@@ -14,7 +14,6 @@ export { safeBack } from '@rific/core';
|
|
|
14
14
|
import * as _tastic_profile from '@tastic/profile';
|
|
15
15
|
import { profilesReducer, Profile, CreateProfileInput, SeatColorsState as SeatColorsState$1 } from '@tastic/profile';
|
|
16
16
|
import * as _rific_feedback_press from '@rific/feedback-press';
|
|
17
|
-
import { SoundSettings } from '@rific/feedback-press';
|
|
18
17
|
import * as redux_persist from 'redux-persist';
|
|
19
18
|
import { PersistedState, Persistor } from 'redux-persist';
|
|
20
19
|
import * as _reduxjs_toolkit from '@reduxjs/toolkit';
|
|
@@ -105,9 +104,7 @@ type LastActiveGameState = {
|
|
|
105
104
|
declare function createShellReducers({ seatColors, appearance, seatTheme }: Pick<PackDefinition, 'seatColors' | 'appearance' | 'seatTheme'>): {
|
|
106
105
|
theme: _rific_core.SettingsReducer<_rific_auto_paper.ThemeState>;
|
|
107
106
|
haptic: _rific_core.SettingsReducer<_rific_feedback_press.HapticSettings>;
|
|
108
|
-
sound:
|
|
109
|
-
type: string;
|
|
110
|
-
}) => SoundSettings;
|
|
107
|
+
sound: _rific_core.SettingsReducer<_rific_feedback_press.SoundSettings>;
|
|
111
108
|
keepAwake: _rific_core.SettingsReducer<_rific_core.KeepAwakeSettings>;
|
|
112
109
|
profiles: typeof profilesReducer;
|
|
113
110
|
profileSelection: (state: _tastic_profile.ProfileSelectionState<Seat> | undefined, action: {
|
|
@@ -143,6 +140,7 @@ interface LoadoutOptionsProps {
|
|
|
143
140
|
dark: boolean;
|
|
144
141
|
onRandomize?: () => void;
|
|
145
142
|
onReset?: () => void;
|
|
143
|
+
seats?: ReactNode;
|
|
146
144
|
}
|
|
147
145
|
interface SeatControlLook {
|
|
148
146
|
accentColor: string;
|
|
@@ -153,6 +151,7 @@ interface SeatControlLook {
|
|
|
153
151
|
interface GameLoadout {
|
|
154
152
|
roundSettings: object;
|
|
155
153
|
options: (props: LoadoutOptionsProps) => ReactNode;
|
|
154
|
+
placesSeats?: boolean;
|
|
156
155
|
optionIds: readonly string[];
|
|
157
156
|
randomize: () => void;
|
|
158
157
|
reset: () => void;
|
|
@@ -273,6 +272,8 @@ interface PackDefinition {
|
|
|
273
272
|
colorCaption: string;
|
|
274
273
|
games: readonly PackGameDefinition[];
|
|
275
274
|
homeTabs?: readonly HomeTab[];
|
|
275
|
+
homePlayerPicker?: boolean;
|
|
276
|
+
resumeHref?: (gameId: string) => Href | null;
|
|
276
277
|
seatColors: Record<Seat, string>;
|
|
277
278
|
appearance?: ThemeAppearance;
|
|
278
279
|
HeroTitle: ComponentType<HeroTitleProps>;
|
|
@@ -342,8 +343,6 @@ declare function createPackStore(pack: PackStoreSource, { keyPrefix, migrate, bl
|
|
|
342
343
|
liveplay: LiveplaySliceState;
|
|
343
344
|
} & redux_persist_es_persistReducer.PersistPartial, {
|
|
344
345
|
type: string;
|
|
345
|
-
} | {
|
|
346
|
-
type: string;
|
|
347
346
|
payload?: unknown;
|
|
348
347
|
} | {
|
|
349
348
|
type: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { PopoverHost, AlignResult } from '@tastic/hud/chrome';
|
|
|
6
6
|
import { GuideStep } from '@tastic/hud/guide';
|
|
7
7
|
import { MenuOption } from '@tastic/hud/lobby';
|
|
8
8
|
import { FontSource } from 'expo-font';
|
|
9
|
-
import { Stack } from 'expo-router';
|
|
9
|
+
import { Href, Stack } from 'expo-router';
|
|
10
10
|
import * as redux from 'redux';
|
|
11
11
|
import { Reducer, Action } from 'redux';
|
|
12
12
|
import * as _rific_core from '@rific/core';
|
|
@@ -14,7 +14,6 @@ export { safeBack } from '@rific/core';
|
|
|
14
14
|
import * as _tastic_profile from '@tastic/profile';
|
|
15
15
|
import { profilesReducer, Profile, CreateProfileInput, SeatColorsState as SeatColorsState$1 } from '@tastic/profile';
|
|
16
16
|
import * as _rific_feedback_press from '@rific/feedback-press';
|
|
17
|
-
import { SoundSettings } from '@rific/feedback-press';
|
|
18
17
|
import * as redux_persist from 'redux-persist';
|
|
19
18
|
import { PersistedState, Persistor } from 'redux-persist';
|
|
20
19
|
import * as _reduxjs_toolkit from '@reduxjs/toolkit';
|
|
@@ -105,9 +104,7 @@ type LastActiveGameState = {
|
|
|
105
104
|
declare function createShellReducers({ seatColors, appearance, seatTheme }: Pick<PackDefinition, 'seatColors' | 'appearance' | 'seatTheme'>): {
|
|
106
105
|
theme: _rific_core.SettingsReducer<_rific_auto_paper.ThemeState>;
|
|
107
106
|
haptic: _rific_core.SettingsReducer<_rific_feedback_press.HapticSettings>;
|
|
108
|
-
sound:
|
|
109
|
-
type: string;
|
|
110
|
-
}) => SoundSettings;
|
|
107
|
+
sound: _rific_core.SettingsReducer<_rific_feedback_press.SoundSettings>;
|
|
111
108
|
keepAwake: _rific_core.SettingsReducer<_rific_core.KeepAwakeSettings>;
|
|
112
109
|
profiles: typeof profilesReducer;
|
|
113
110
|
profileSelection: (state: _tastic_profile.ProfileSelectionState<Seat> | undefined, action: {
|
|
@@ -143,6 +140,7 @@ interface LoadoutOptionsProps {
|
|
|
143
140
|
dark: boolean;
|
|
144
141
|
onRandomize?: () => void;
|
|
145
142
|
onReset?: () => void;
|
|
143
|
+
seats?: ReactNode;
|
|
146
144
|
}
|
|
147
145
|
interface SeatControlLook {
|
|
148
146
|
accentColor: string;
|
|
@@ -153,6 +151,7 @@ interface SeatControlLook {
|
|
|
153
151
|
interface GameLoadout {
|
|
154
152
|
roundSettings: object;
|
|
155
153
|
options: (props: LoadoutOptionsProps) => ReactNode;
|
|
154
|
+
placesSeats?: boolean;
|
|
156
155
|
optionIds: readonly string[];
|
|
157
156
|
randomize: () => void;
|
|
158
157
|
reset: () => void;
|
|
@@ -273,6 +272,8 @@ interface PackDefinition {
|
|
|
273
272
|
colorCaption: string;
|
|
274
273
|
games: readonly PackGameDefinition[];
|
|
275
274
|
homeTabs?: readonly HomeTab[];
|
|
275
|
+
homePlayerPicker?: boolean;
|
|
276
|
+
resumeHref?: (gameId: string) => Href | null;
|
|
276
277
|
seatColors: Record<Seat, string>;
|
|
277
278
|
appearance?: ThemeAppearance;
|
|
278
279
|
HeroTitle: ComponentType<HeroTitleProps>;
|
|
@@ -342,8 +343,6 @@ declare function createPackStore(pack: PackStoreSource, { keyPrefix, migrate, bl
|
|
|
342
343
|
liveplay: LiveplaySliceState;
|
|
343
344
|
} & redux_persist_es_persistReducer.PersistPartial, {
|
|
344
345
|
type: string;
|
|
345
|
-
} | {
|
|
346
|
-
type: string;
|
|
347
346
|
payload?: unknown;
|
|
348
347
|
} | {
|
|
349
348
|
type: string;
|
package/dist/index.js
CHANGED
|
@@ -535,15 +535,12 @@ function HapticGatedToastProvider({ children }) {
|
|
|
535
535
|
const { Toaster: PackToasterComponent } = usePack();
|
|
536
536
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_toaster2.ToastProvider, { haptics: settings.vibrate ? Haptics : void 0, paper: PackToasterComponent ? void 0 : RNPaper2, children });
|
|
537
537
|
}
|
|
538
|
-
function
|
|
539
|
-
const renderFrame = (0, import_react9.useCallback)(
|
|
540
|
-
(toasts) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_chrome2.RotatedFrame, { rotatedSafeArea: true, passThrough: true, children: toasts }),
|
|
541
|
-
[]
|
|
542
|
-
);
|
|
538
|
+
function FramedToaster() {
|
|
539
|
+
const renderFrame = (0, import_react9.useCallback)((toasts) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_chrome2.ScreenFrame, { passThrough: true, children: toasts }), []);
|
|
543
540
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_toaster2.Toaster, { historyButton: null, clearButton: null, limit: 3, renderFrame });
|
|
544
541
|
}
|
|
545
542
|
function PackToaster({ Toaster: PackToasterComponent }) {
|
|
546
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native3.View, { style: import_react_native3.StyleSheet.absoluteFill, pointerEvents: "box-none", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_chrome2.
|
|
543
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native3.View, { style: import_react_native3.StyleSheet.absoluteFill, pointerEvents: "box-none", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_chrome2.ScreenFrame, { passThrough: true, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PackToasterComponent, {}) }) });
|
|
547
544
|
}
|
|
548
545
|
function GameProviders({ games, children }) {
|
|
549
546
|
return games.reduceRight((inner, game) => game.Provider ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(game.Provider, { children: inner }, game.id) : inner, children);
|
|
@@ -561,7 +558,7 @@ function PackRoot({ pack, children }) {
|
|
|
561
558
|
function RootLayout({ pack, store, persistor }) {
|
|
562
559
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native_gesture_handler.GestureHandlerRootView, { style: styles.root, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native_safe_area_context2.SafeAreaProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(WindowControlsInsets, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PackProvider, { pack, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Fonts, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Providers, { store, persistor, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Theme, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ProfilesProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(LastActiveGameProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(GameProviders, { games: pack.games, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PackRoot, { pack, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(GatedApp, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(HapticGatedToastProvider, { children: [
|
|
563
560
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(GuideHost, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(AppStack, {}) }),
|
|
564
|
-
pack.Toaster ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PackToaster, { Toaster: pack.Toaster }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
561
|
+
pack.Toaster ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PackToaster, { Toaster: pack.Toaster }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FramedToaster, {}),
|
|
565
562
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(UpdateDialog, {})
|
|
566
563
|
] }) }) }) }) }) }) }) }) }) }) }) }) });
|
|
567
564
|
}
|
|
@@ -892,33 +889,36 @@ function LoadoutScreen({ game }) {
|
|
|
892
889
|
const p2Host = (0, import_chrome4.usePopoverHost)();
|
|
893
890
|
const p1PickerOpen = controlsHost.openId?.startsWith("p1-") ?? false;
|
|
894
891
|
const p1ControlOpen = controlsHost.openId === P1_CONTROL_ID;
|
|
892
|
+
const controlLook = { accentColor: themeColors.tertiary, mutedColor: fgMuted, dark };
|
|
893
|
+
const p1Control = loadout.seatControl(1, controlsHost, { ...controlLook, seatColor: p1Drawn });
|
|
894
|
+
const p1Panel = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lobby2.PlayerSetupPanel, { idPrefix: "p1", host: controlsHost, color: p1Color, onColorChange: handleP1ColorChange, swatches: import_auto_paper4.defaultColors, takenColor: p2Exists ? p2Color : void 0, allowSwapTaken: mode === "vsCpu", colorCaption: pack.colorCaption, isHuman: true, dark, showReadyButton: false, profiles, selectedProfileId: lastSelected[1], takenProfileId: p2IsHuman ? lastSelected[2] : null, guestLabel: pack.guestLabel ?? "P1", nullLabel: pack.nullLabel, onProfileSelect: handleP1ProfileSelect, onManageProfiles: () => import_expo_router4.router.push(PROFILES_HREF), previewValue: seatPreview, triggerStyle, useSeatPickerAlign: seatPickerAlign }, `p1-${layoutKey}`);
|
|
895
|
+
const opponentPicker = game.seatTwo && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(OpponentPicker, { idPrefix: "p1", host: controlsHost, choices: game.seatTwo, seatTwo, onSeatTwoChange: changeSeatTwo, cpuDifficulty: loadout.cpuDifficulty, color: p2Color, onColorChange: handleP2ColorChange, swatches: import_auto_paper4.defaultColors, takenColor: p1Color, allowSwapTaken: mode === "vsCpu", dark, previewValue: seatPreview, triggerStyle, usePickerAlign: seatPickerAlign }, `opponent-${layoutKey}`);
|
|
896
|
+
const toggleP1Ready = () => setReady((r) => ({ ...r, 1: !r[1] }));
|
|
897
|
+
const seatButtons = /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native6.View, { style: [styles3.seatOneButtons, p1PickerOpen && styles3.raised], children: [
|
|
898
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native_reanimated2.default.View, { style: [styles3.playersRow, p1PickerOpen && styles3.raised, !p2IsHuman && playersRowFade], children: [
|
|
899
|
+
p1Panel,
|
|
900
|
+
opponentPicker
|
|
901
|
+
] }),
|
|
902
|
+
p1Control && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native6.View, { style: [styles3.controlRow, p1ControlOpen && styles3.raised], children: p1Control })
|
|
903
|
+
] });
|
|
904
|
+
const seatsInOptions = !p2IsHuman && !!loadout.placesSeats;
|
|
905
|
+
const seatOne = /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native6.View, { style: [styles3.seatOne, !p2IsHuman && styles3.seatOneAlone, p1PickerOpen && !seatsInOptions && styles3.raised], children: [
|
|
906
|
+
!seatsInOptions && seatButtons,
|
|
907
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lobby2.ReadyButton, { color: p1Drawn, ready: ready[1], onToggleReady: toggleP1Ready, surfaceColor: readySurface, dark, style: !p2IsHuman && p1PickerOpen && styles3.readyButtonHidden })
|
|
908
|
+
] });
|
|
895
909
|
const optionsRow = loadout.options({
|
|
896
910
|
host: controlsHost,
|
|
897
911
|
accentColor: themeColors.tertiary,
|
|
898
912
|
mutedColor: fgMuted,
|
|
899
913
|
onAccentColor: themeColors.onTertiary,
|
|
900
914
|
dark,
|
|
915
|
+
seats: seatsInOptions ? seatButtons : void 0,
|
|
901
916
|
// Left out (the row's own actions unrendered) whenever the shared band below carries them.
|
|
902
917
|
onRandomize: showMetaInSharedBand ? void 0 : loadout.randomize,
|
|
903
918
|
onReset: showMetaInSharedBand ? void 0 : loadout.reset
|
|
904
919
|
});
|
|
905
920
|
const optionsPopoverOpen = controlsHost.openId !== null && loadout.optionIds.includes(controlsHost.openId);
|
|
906
921
|
const sharedControls = showMetaInSharedBand ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lobby2.SharedActionBand, { onBack: import_core8.safeBack, onSettings: () => setSettingsOpen(true), onRandomize: loadout.randomize, onReset: loadout.reset, fg, popoverOpen: optionsPopoverOpen, children: optionsRow }) : optionsRow;
|
|
907
|
-
const controlLook = { accentColor: themeColors.tertiary, mutedColor: fgMuted, dark };
|
|
908
|
-
const p1Control = loadout.seatControl(1, controlsHost, { ...controlLook, seatColor: p1Drawn });
|
|
909
|
-
const p1Panel = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lobby2.PlayerSetupPanel, { idPrefix: "p1", host: controlsHost, color: p1Color, onColorChange: handleP1ColorChange, swatches: import_auto_paper4.defaultColors, takenColor: p2Exists ? p2Color : void 0, allowSwapTaken: mode === "vsCpu", colorCaption: pack.colorCaption, isHuman: true, dark, showReadyButton: false, profiles, selectedProfileId: lastSelected[1], takenProfileId: p2IsHuman ? lastSelected[2] : null, guestLabel: pack.guestLabel ?? "P1", nullLabel: pack.nullLabel, onProfileSelect: handleP1ProfileSelect, onManageProfiles: () => import_expo_router4.router.push(PROFILES_HREF), previewValue: seatPreview, triggerStyle, useSeatPickerAlign: seatPickerAlign }, `p1-${layoutKey}`);
|
|
910
|
-
const opponentPicker = game.seatTwo && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(OpponentPicker, { idPrefix: "p1", host: controlsHost, choices: game.seatTwo, seatTwo, onSeatTwoChange: changeSeatTwo, cpuDifficulty: loadout.cpuDifficulty, color: p2Color, onColorChange: handleP2ColorChange, swatches: import_auto_paper4.defaultColors, takenColor: p1Color, allowSwapTaken: mode === "vsCpu", dark, previewValue: seatPreview, triggerStyle, usePickerAlign: seatPickerAlign }, `opponent-${layoutKey}`);
|
|
911
|
-
const toggleP1Ready = () => setReady((r) => ({ ...r, 1: !r[1] }));
|
|
912
|
-
const seatOne = /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native6.View, { style: [styles3.seatOne, !p2IsHuman && styles3.seatOneAlone, p1PickerOpen && styles3.raised], children: [
|
|
913
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native6.View, { style: [styles3.seatOneButtons, p1PickerOpen && styles3.raised], children: [
|
|
914
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native_reanimated2.default.View, { style: [styles3.playersRow, p1PickerOpen && styles3.raised, !p2IsHuman && playersRowFade], children: [
|
|
915
|
-
p1Panel,
|
|
916
|
-
opponentPicker
|
|
917
|
-
] }),
|
|
918
|
-
p1Control && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native6.View, { style: [styles3.controlRow, p1ControlOpen && styles3.raised], children: p1Control })
|
|
919
|
-
] }),
|
|
920
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lobby2.ReadyButton, { color: p1Drawn, ready: ready[1], onToggleReady: toggleP1Ready, surfaceColor: readySurface, dark, style: !p2IsHuman && p1PickerOpen && styles3.readyButtonHidden })
|
|
921
|
-
] });
|
|
922
922
|
const p2Control = p2IsHuman ? loadout.seatControl(2, p2Host, { ...controlLook, seatColor: p2Drawn }) : void 0;
|
|
923
923
|
const p2Panel = p2IsHuman && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lobby2.PlayerSetupPanel, { idPrefix: "p2", host: p2Host, color: p2Color, onColorChange: handleP2ColorChange, swatches: import_auto_paper4.defaultColors, takenColor: p1Color, colorCaption: pack.colorCaption, isHuman: true, ready: ready[2], onToggleReady: () => setReady((r) => ({ ...r, 2: !r[2] })), dark, secondPicker: p2Control, secondPickerId: p2Control ? P2_CONTROL_ID : void 0, profiles, selectedProfileId: lastSelected[2], takenProfileId: lastSelected[1], guestLabel: pack.guestLabel ?? "P2", nullLabel: pack.nullLabel, onProfileSelect: handleP2ProfileSelect, previewValue: seatPreview, triggerStyle, readySurfaceColor: readySurface }, "p2-zones");
|
|
924
924
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native6.View, { style: [styles3.container, { backgroundColor: bg }], children: [
|
|
@@ -939,7 +939,7 @@ function LoadoutScreen({ game }) {
|
|
|
939
939
|
sharedElevated: optionsPopoverOpen
|
|
940
940
|
}
|
|
941
941
|
) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_native6.View, { style: styles3.stackedZone, children: [
|
|
942
|
-
sharedControls,
|
|
942
|
+
seatsInOptions ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native6.View, { style: p1PickerOpen && styles3.raised, children: sharedControls }) : sharedControls,
|
|
943
943
|
seatOne
|
|
944
944
|
] })
|
|
945
945
|
] }),
|
|
@@ -1106,7 +1106,7 @@ var HOME_LEFT_PANE_PICKER_HEIGHT = 44;
|
|
|
1106
1106
|
var HOME_LEFT_PANE_PICKER_GAP = 12;
|
|
1107
1107
|
var HOME_LEFT_PANE_BOTTOM_PADDING = 16;
|
|
1108
1108
|
var HOME_HERO_SIDE_ROOM = 16;
|
|
1109
|
-
function computeHomeLayout(windowWidth, windowHeight, insets) {
|
|
1109
|
+
function computeHomeLayout(windowWidth, windowHeight, insets, withPicker = true) {
|
|
1110
1110
|
const isWide = windowWidth > windowHeight;
|
|
1111
1111
|
if (!isWide) {
|
|
1112
1112
|
return { isWide, windowWidth, windowHeight, insets, paddingLeft: 0, paddingRight: 0, leftPaneWidth: 0, rightPaneWidth: 0, columns: 1, tileWidth: 0, previewWidth: 0, heroFit: void 0 };
|
|
@@ -1122,7 +1122,7 @@ function computeHomeLayout(windowWidth, windowHeight, insets) {
|
|
|
1122
1122
|
const previewWidth = Math.max(0, tileWidth - 2 * HOME_TILE_PADDING);
|
|
1123
1123
|
const heroFit = {
|
|
1124
1124
|
width: Math.max(0, leftPaneWidth - HOME_HERO_SIDE_ROOM),
|
|
1125
|
-
height: Math.max(0, windowHeight - insets.top - insets.bottom - HOME_TOP_BAND - HOME_LEFT_PANE_PICKER_GAP
|
|
1125
|
+
height: Math.max(0, windowHeight - insets.top - insets.bottom - HOME_TOP_BAND - (withPicker ? HOME_LEFT_PANE_PICKER_GAP + HOME_LEFT_PANE_PICKER_HEIGHT : 0) - HOME_LEFT_PANE_BOTTOM_PADDING)
|
|
1126
1126
|
};
|
|
1127
1127
|
return {
|
|
1128
1128
|
isWide,
|
|
@@ -1139,10 +1139,10 @@ function computeHomeLayout(windowWidth, windowHeight, insets) {
|
|
|
1139
1139
|
heroFit
|
|
1140
1140
|
};
|
|
1141
1141
|
}
|
|
1142
|
-
function useHomeLayout() {
|
|
1142
|
+
function useHomeLayout(withPicker = true) {
|
|
1143
1143
|
const { width, height } = (0, import_react_native8.useWindowDimensions)();
|
|
1144
1144
|
const insets = (0, import_react_native_safe_area_context4.useSafeAreaInsets)();
|
|
1145
|
-
return computeHomeLayout(width, height, insets);
|
|
1145
|
+
return computeHomeLayout(width, height, insets, withPicker);
|
|
1146
1146
|
}
|
|
1147
1147
|
|
|
1148
1148
|
// src/screens/HomeScreen.tsx
|
|
@@ -1158,12 +1158,13 @@ function HomeScreen() {
|
|
|
1158
1158
|
(0, import_react16.useEffect)(() => {
|
|
1159
1159
|
if (!resumeGame) autoShowPack();
|
|
1160
1160
|
}, [resumeGame, autoShowPack]);
|
|
1161
|
-
if (resumeGame) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_expo_router6.Redirect, { href: playHref(resumeGame.id) });
|
|
1161
|
+
if (resumeGame) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_expo_router6.Redirect, { href: pack.resumeHref?.(resumeGame.id) ?? playHref(resumeGame.id) });
|
|
1162
1162
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(HomeMenu, {});
|
|
1163
1163
|
}
|
|
1164
1164
|
function HomeMenu() {
|
|
1165
1165
|
const pack = usePack();
|
|
1166
|
-
const
|
|
1166
|
+
const showPicker = pack.homePlayerPicker !== false;
|
|
1167
|
+
const layout = useHomeLayout(showPicker);
|
|
1167
1168
|
const { insets } = layout;
|
|
1168
1169
|
const { dark, colors } = (0, import_auto_paper5.useAutoPaperTheme)();
|
|
1169
1170
|
const { openFirstTime, openFor, openPack } = useGameGuide();
|
|
@@ -1224,12 +1225,12 @@ function HomeMenu() {
|
|
|
1224
1225
|
] }),
|
|
1225
1226
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native9.View, { style: [styles4.wideLeftPane, { left: layout.paddingLeft, width: layout.leftPaneWidth, paddingTop: HOME_TOP_BAND + insets.top, paddingBottom: 16 + insets.bottom }, pickerHost.openId !== null && styles4.pickerOpen], children: [
|
|
1226
1227
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(pack.HeroTitle, { words: pack.wordmark, color: fg, p1Color, p2Color, active: heroActive, fit: layout.heroFit }),
|
|
1227
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native9.View, { style: styles4.widePicker, children: picker })
|
|
1228
|
+
showPicker && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native9.View, { style: styles4.widePicker, children: picker })
|
|
1228
1229
|
] })
|
|
1229
1230
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_auto_paper5.FadingScrollView, { ...tab && columnClamp, style: styles4.scroll, contentContainerStyle: [styles4.content, { paddingTop: 56 + insets.top, paddingBottom: 24 + insets.bottom, paddingLeft: 16 + insets.left, paddingRight: 16 + insets.right }], children: [
|
|
1230
1231
|
pressAway,
|
|
1231
1232
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(pack.HeroTitle, { words: pack.wordmark, color: fg, p1Color, p2Color, active: heroActive }),
|
|
1232
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native9.View, { style: [styles4.picker, pickerHost.openId !== null && styles4.pickerOpen], children: picker }),
|
|
1233
|
+
showPicker && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native9.View, { style: [styles4.picker, pickerHost.openId !== null && styles4.pickerOpen], children: picker }),
|
|
1233
1234
|
tabBar && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native9.View, { style: styles4.listWidth, children: tabBar }),
|
|
1234
1235
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native9.View, { style: styles4.list, children: pack.games.map((game) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(GameRow, { game, hidden: isHidden(tab, game), dark, p1Color, p2Color, previewRevealed: previewsRevealed, onPress: () => openGame(game), onRules: hasRules(game) ? () => openRules(game) : void 0 }, game.id)) })
|
|
1235
1236
|
] }),
|
|
@@ -1472,7 +1473,7 @@ function useRosterAlign(open, contentWidth, contentHeight) {
|
|
|
1472
1473
|
function ProfilesRoute() {
|
|
1473
1474
|
const { profiles, createProfile, updateProfile, deleteProfile } = useProfiles();
|
|
1474
1475
|
const { Backdrop, foreground, newProfileColor, usePickerAlign } = usePack();
|
|
1475
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_chrome6.
|
|
1476
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_chrome6.ScreenFrame, { portalHost: true, maxContentWidth: ROSTER_MAX_WIDTH, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_profile8.ProfilesScreen, { profiles, defaultColor: newProfileColor ?? import_auto_paper6.defaultColors[0].value, onCreate: (patch) => createProfile(patch), onSave: (id, patch) => updateProfile(id, patch), onDelete: deleteProfile, onBack: import_core8.safeBack, fg: foreground, bg: Backdrop ? "transparent" : void 0, useColorPickerAlign: usePickerAlign ? useRosterAlign : void 0 }) });
|
|
1476
1477
|
}
|
|
1477
1478
|
|
|
1478
1479
|
// src/screens/StatsScreen.tsx
|
|
@@ -1500,7 +1501,7 @@ var GAME_PICKER_ID = "stats-game";
|
|
|
1500
1501
|
var STATS_MAX_WIDTH = 640;
|
|
1501
1502
|
function StatsScreen() {
|
|
1502
1503
|
const pickerHost = (0, import_chrome7.usePopoverHost)();
|
|
1503
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(StatsPressAway, { host: pickerHost, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_chrome7.
|
|
1504
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(StatsPressAway, { host: pickerHost, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_chrome7.ScreenFrame, { portalHost: true, maxContentWidth: STATS_MAX_WIDTH, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(StatsContent, { pickerHost }) }) });
|
|
1504
1505
|
}
|
|
1505
1506
|
function StatsPressAway({ host, children }) {
|
|
1506
1507
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native10.View, { testID: "stats-press-away", style: styles5.screen, onStartShouldSetResponder: () => host.openId !== null, onResponderRelease: host.close, children });
|
|
@@ -1537,7 +1538,7 @@ function StatsContent({ pickerHost }) {
|
|
|
1537
1538
|
const surface = pack.Backdrop ? { backgroundColor: colors.surface } : void 0;
|
|
1538
1539
|
const triggerStyle = pack.Backdrop ? [styles5.pill, surface] : void 0;
|
|
1539
1540
|
const PackTabContent = packTab?.Content;
|
|
1540
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_chrome7.BaseStatsScreen, { title, onBack: import_core8.safeBack, insets, onReset: reset.onReset, resetLabel: reset.label, resetConfirmTitle: reset.title, resetConfirmBody: reset.body, fg: pack.foreground, bg: pack.Backdrop ? "transparent" : void 0,
|
|
1541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_chrome7.BaseStatsScreen, { title, onBack: import_core8.safeBack, insets, onReset: reset.onReset, resetLabel: reset.label, resetConfirmTitle: reset.title, resetConfirmBody: reset.body, fg: pack.foreground, bg: pack.Backdrop ? "transparent" : void 0, children: [
|
|
1541
1542
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_chrome7.PressAwayOverlay, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles5.pressAway }),
|
|
1542
1543
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_paper2.SegmentedButtons, { value: tab, onValueChange: setTab, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles5.tabs, surface] }),
|
|
1543
1544
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native10.View, { style: [styles5.filters, pickerHost.openId !== null && styles5.filtersOpen], onStartShouldSetResponder: () => pickerHost.openId !== null, children: [
|
|
@@ -1688,8 +1689,6 @@ var import_auto_paper9 = require("@rific/auto-paper");
|
|
|
1688
1689
|
var import_core12 = require("@rific/core");
|
|
1689
1690
|
var import_feedback_press5 = require("@rific/feedback-press");
|
|
1690
1691
|
var import_profile10 = require("@tastic/profile");
|
|
1691
|
-
var initialSoundSettings = { ...import_feedback_press5.defaultSoundSettings, enabled: !__DEV__ };
|
|
1692
|
-
var appSoundReducer = (state = initialSoundSettings, action) => (0, import_feedback_press5.soundReducer)(state, action);
|
|
1693
1692
|
function createShellReducers({ seatColors, appearance = "system", seatTheme }) {
|
|
1694
1693
|
return {
|
|
1695
1694
|
// Explicit primary/secondary triad (rather than a single seed expanded via harmony) so the pack's
|
|
@@ -1703,7 +1702,9 @@ function createShellReducers({ seatColors, appearance = "system", seatTheme }) {
|
|
|
1703
1702
|
// only when the pack's appearance is; hooks/useSeatColors.ts re-applies it with the live mode).
|
|
1704
1703
|
theme: (0, import_auto_paper9.createThemeReducer)(seatTheme ? { appearance, ...seatTheme(seatColors, appearance === "dark") } : { appearance, color: { primary: seatColors[1], secondary: seatColors[2], tertiary: (0, import_auto_paper9.getThirdColor)(seatColors[1], seatColors[2]) } }),
|
|
1705
1704
|
haptic: import_feedback_press5.hapticReducer,
|
|
1706
|
-
|
|
1705
|
+
// Starts off in a development build (feedback-press's defaultSoundSettings is `!__DEV__`), so local
|
|
1706
|
+
// testing on a simulator is silent; a production build starts with sound on.
|
|
1707
|
+
sound: import_feedback_press5.soundReducer,
|
|
1707
1708
|
// @rific/core's Keep Awake setting (see Providers.tsx's KeepAwakeBridge), under the namespace its
|
|
1708
1709
|
// REHYDRATE handling expects.
|
|
1709
1710
|
keepAwake: import_core12.keepAwakeReducer,
|
|
@@ -1724,11 +1725,6 @@ function createShellReducers({ seatColors, appearance = "system", seatTheme }) {
|
|
|
1724
1725
|
}
|
|
1725
1726
|
|
|
1726
1727
|
// src/redux/createPackStore.ts
|
|
1727
|
-
var hasError = (action) => typeof action === "object" && action !== null && "error" in action && Boolean(action.error);
|
|
1728
|
-
var errorMiddleware = () => (next) => (action) => {
|
|
1729
|
-
if (!hasError(action)) return next(action);
|
|
1730
|
-
return action;
|
|
1731
|
-
};
|
|
1732
1728
|
function createPackStore(pack, { keyPrefix, migrate, blacklist = [], serializableIgnoredPaths = [], middleware = [] }) {
|
|
1733
1729
|
const gameReducers = Object.assign({}, ...pack.games.map((game) => game.reducers));
|
|
1734
1730
|
const resumeReducers = pack.games.some((game) => game.resumable) ? { lastActiveGame: lastActiveGameSlice_default } : {};
|
|
@@ -1761,7 +1757,7 @@ function createPackStore(pack, { keyPrefix, migrate, blacklist = [], serializabl
|
|
|
1761
1757
|
ignoredPaths: [...serializableIgnoredPaths]
|
|
1762
1758
|
}
|
|
1763
1759
|
});
|
|
1764
|
-
return defaultMiddleware.concat(
|
|
1760
|
+
return defaultMiddleware.concat(...middleware);
|
|
1765
1761
|
},
|
|
1766
1762
|
reducer: persistedReducer
|
|
1767
1763
|
});
|