@tastic/shell 0.8.1 → 0.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tastic/shell",
3
- "version": "0.8.1",
3
+ "version": "0.8.3",
4
4
  "description": "The app around a pack of React Native games, two-seat or for one player: Home, the loadout, the stats screen, Profiles and Settings, the pack's Redux store and its root providers, driven by one PackDefinition",
5
5
  "keywords": [
6
6
  "react-native",
@@ -152,7 +152,7 @@
152
152
  "react-native-gesture-handler": ">=3.3.0",
153
153
  "react-native-paper": ">=5.15.3",
154
154
  "react-native-reanimated": ">=4.7.1",
155
- "react-native-safe-area-context": ">=5.10.1",
155
+ "react-native-safe-area-context": ">=5.11.0",
156
156
  "react-redux": ">=9.3.0",
157
157
  "redux": ">=5.0.1",
158
158
  "redux-persist": ">=6.0.0"
@@ -18,6 +18,7 @@ import { GuideHost } from './components/GuideHost'
18
18
  import { Providers } from './components/Providers'
19
19
  import { Theme } from './components/Theme'
20
20
  import { UpdateDialog } from './components/UpdateDialog'
21
+ import { WindowControlsInsets } from './components/WindowControlsInsets'
21
22
  import { LastActiveGameProvider } from './hooks/useLastActiveGame'
22
23
  import { ProfilesProvider, useProfiles } from './hooks/useProfiles'
23
24
  import { PackProvider, usePack } from './PackContext'
@@ -196,41 +197,43 @@ export function RootLayout({ pack, store, persistor }: RootLayoutProps) {
196
197
  return (
197
198
  <GestureHandlerRootView style={styles.root}>
198
199
  <SafeAreaProvider>
199
- <PackProvider pack={pack}>
200
- <Fonts>
201
- <Providers store={store} persistor={persistor}>
202
- <Theme>
203
- <ProfilesProvider>
204
- {/* Inside Providers' PersistGate, so the game a cold launch resumes (read once, as
205
- it mounts) is the saved one. */}
206
- <LastActiveGameProvider>
207
- <GameProviders games={pack.games}>
208
- <PackRoot pack={pack}>
209
- <GatedApp>
210
- <HapticGatedToastProvider>
211
- {/* Wraps the stack (rather than sitting beside it like UpdateDialog)
212
- because Home's tiles and the loadout's How to Play row reach it through
213
- context (see GuideHost). Inside the toast provider because the card renders
214
- through a Portal, and inside the gate so it mounts together with Home rather
215
- than before it. */}
216
- <GuideHost>
217
- <AppStack />
218
- </GuideHost>
219
- {/* historyButton/clearButton off: there's no toast history to open, and a
220
- control row for it above the toast stack would go nowhere. limit pins the
221
- package's current default (3) so a future toaster release can't change it. */}
222
- {pack.Toaster ? <PackToaster Toaster={pack.Toaster} /> : <RotatingToaster />}
223
- <UpdateDialog />
224
- </HapticGatedToastProvider>
225
- </GatedApp>
226
- </PackRoot>
227
- </GameProviders>
228
- </LastActiveGameProvider>
229
- </ProfilesProvider>
230
- </Theme>
231
- </Providers>
232
- </Fonts>
233
- </PackProvider>
200
+ <WindowControlsInsets>
201
+ <PackProvider pack={pack}>
202
+ <Fonts>
203
+ <Providers store={store} persistor={persistor}>
204
+ <Theme>
205
+ <ProfilesProvider>
206
+ {/* Inside Providers' PersistGate, so the game a cold launch resumes (read once, as
207
+ it mounts) is the saved one. */}
208
+ <LastActiveGameProvider>
209
+ <GameProviders games={pack.games}>
210
+ <PackRoot pack={pack}>
211
+ <GatedApp>
212
+ <HapticGatedToastProvider>
213
+ {/* Wraps the stack (rather than sitting beside it like UpdateDialog)
214
+ because Home's tiles and the loadout's How to Play row reach it through
215
+ context (see GuideHost). Inside the toast provider because the card renders
216
+ through a Portal, and inside the gate so it mounts together with Home rather
217
+ than before it. */}
218
+ <GuideHost>
219
+ <AppStack />
220
+ </GuideHost>
221
+ {/* historyButton/clearButton off: there's no toast history to open, and a
222
+ control row for it above the toast stack would go nowhere. limit pins the
223
+ package's current default (3) so a future toaster release can't change it. */}
224
+ {pack.Toaster ? <PackToaster Toaster={pack.Toaster} /> : <RotatingToaster />}
225
+ <UpdateDialog />
226
+ </HapticGatedToastProvider>
227
+ </GatedApp>
228
+ </PackRoot>
229
+ </GameProviders>
230
+ </LastActiveGameProvider>
231
+ </ProfilesProvider>
232
+ </Theme>
233
+ </Providers>
234
+ </Fonts>
235
+ </PackProvider>
236
+ </WindowControlsInsets>
234
237
  </SafeAreaProvider>
235
238
  </GestureHandlerRootView>
236
239
  )
@@ -0,0 +1,19 @@
1
+ import type { ReactNode } from 'react'
2
+ import { Platform } from 'react-native'
3
+ import { SafeAreaInsetsContext, useSafeAreaInsets } from 'react-native-safe-area-context'
4
+
5
+ // iPadOS 26 draws a window's controls (close, minimize, tile) over the app's top-left corner whenever the app runs
6
+ // in a window (resized, tiled beside another app, Slide Over), and the regular safe area makes no room for them, so
7
+ // every screen's top-left button (a game's Home, Home's trophy, a Back) sat under them and a tap opened the controls
8
+ // instead. UIKit's corner-adapted safe area does make room: the vertical one is the regular insets with the top
9
+ // lowered below the controls in a window, and the same as the regular ones in full screen. Measured on the iPad 13"
10
+ // simulator: top 32 both ways full screen, in portrait and landscape; in a 375x667 window, top 10 regular and 53
11
+ // vertical. So on iPad every screen below gets the vertical insets, and in a window the whole app sits below the
12
+ // controls, like under a title bar. Not on iPhone: it has no window controls, and its vertical inset grows by 18pt in
13
+ // landscape for the rounded corners, which would push every landscape screen down.
14
+ /** Inside the SafeAreaProvider: on iPad, hands every screen the safe area with room for the window controls. */
15
+ export function WindowControlsInsets({ children }: { children: ReactNode }) {
16
+ const vertical = useSafeAreaInsets({ cornerAdaptation: 'vertical' })
17
+ if (Platform.OS !== 'ios' || !Platform.isPad) return <>{children}</>
18
+ return <SafeAreaInsetsContext.Provider value={vertical}>{children}</SafeAreaInsetsContext.Provider>
19
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Paper's SegmentedButtons, drawn clean on iOS (Home's tabs, the stats screen's tabs). Paper rounds a switch's ends
3
+ * at 5 x the theme's roundness (20pt) and lets the label set a segment's height, which on iOS comes out a third of a
4
+ * point over a whole number (40.33pt). React Native draws the border of a segment with uneven corners (an end segment)
5
+ * as a small image stretched to fit, and with a 20pt corner that image needs 41pt: at a fractional height short of
6
+ * that, the last segment's left border is smeared across it, a thin line at mid-height ("Two Player" on Home,
7
+ * "Achievements" on the stats screen, in CardTastic's App Store screenshots, 2026-11-11). A 19pt corner needs 39pt,
8
+ * so it fits whatever the label's height, and the ends still look fully round. CardTastic found and fixed the same in
9
+ * its own switches (2026-11-08); the web never shows it.
10
+ */
11
+ export const SEGMENT_THEME = { roundness: 3.8 }
12
+
13
+ /** The ends' corner radius that `SEGMENT_THEME` gives (Paper's V3 segments round at 5 x roundness), for a surface drawn behind a switch. */
14
+ export const SEGMENT_RADIUS = 5 * SEGMENT_THEME.roundness
@@ -8,6 +8,7 @@ import { AppState, type AppStateStatus, type LayoutChangeEvent, type NativeScrol
8
8
  import { Icon, Portal, SegmentedButtons, Text } from 'react-native-paper'
9
9
 
10
10
  import { useGameGuide } from '../components/GuideHost'
11
+ import { SEGMENT_RADIUS, SEGMENT_THEME } from '../components/segmentTheme'
11
12
  import { SettingsDialog } from '../components/SettingsDialog'
12
13
  import { useFrozenWhileHidden } from '../hooks/useFrozenWhileHidden'
13
14
  import { useLastActiveGame } from '../hooks/useLastActiveGame'
@@ -118,7 +119,7 @@ function HomeMenu() {
118
119
  const [tabLabel, setTabLabel] = useState(() => tabs?.[0].label ?? null)
119
120
  const tab = tabs ? (tabs.find((t) => t.label === tabLabel) ?? tabs[0]) : null
120
121
  const tabButtons = useMemo(() => tabs?.map(({ label }) => ({ value: label, label })) ?? [], [tabs])
121
- const tabBar = tab && <SegmentedButtons value={tab.label} onValueChange={setTabLabel} buttons={tabButtons} style={[styles.tabs, pack.Backdrop && { backgroundColor: colors.surface }]} />
122
+ const tabBar = tab && <SegmentedButtons value={tab.label} onValueChange={setTabLabel} buttons={tabButtons} theme={SEGMENT_THEME} style={[styles.tabs, pack.Backdrop && { backgroundColor: colors.surface }]} />
122
123
  const columnClamp = useClampOnShrink()
123
124
  const gridClamp = useClampOnShrink()
124
125
 
@@ -470,9 +471,9 @@ const styles = StyleSheet.create({
470
471
  scroll: {
471
472
  flex: 1
472
473
  },
473
- // SegmentedButtons' own rounding, so a surface behind it is the same pill (the stats screen's tabs).
474
+ // SegmentedButtons' own rounding (SEGMENT_THEME's), so a surface behind it is the same pill (the stats screen's tabs).
474
475
  tabs: {
475
- borderRadius: 20
476
+ borderRadius: SEGMENT_RADIUS
476
477
  },
477
478
  // The same well as a row, turned on its side.
478
479
  tile: {
@@ -7,6 +7,7 @@ import { SegmentedButtons, Text } from 'react-native-paper'
7
7
  import { useSafeAreaInsets } from 'react-native-safe-area-context'
8
8
  import { useDispatch } from 'react-redux'
9
9
 
10
+ import { SEGMENT_RADIUS, SEGMENT_THEME } from '../components/segmentTheme'
10
11
  import { useProfiles } from '../hooks/useProfiles'
11
12
  import { safeBack } from '../navigation'
12
13
  import { usePack } from '../PackContext'
@@ -23,8 +24,12 @@ const TABS = [
23
24
  ]
24
25
  // With a pack's own tabs, three or more don't fit a phone as equal segments with icons (Paper pads each
25
26
  // label 16pt a side, and "Achievements" alone is ~109pt in Solitaire's font), so each segment is as wide
26
- // as its label and the icons go: Solitaire's three take 309pt of a 375pt phone's 335pt row.
27
- const LABEL_WIDE_TAB = { flexBasis: 'auto', flexGrow: 1, flexShrink: 1 } as const
27
+ // as its label and the icons go: Solitaire's three take 309pt of a 375pt phone's 335pt row. `flex: 0`
28
+ // takes back the `flex: 1` Paper gives every segment: on iOS and Android, Yoga treats a `flexBasis` of
29
+ // 'auto' as unset and a positive `flex` then makes the basis 0, so all three came out equal and cut
30
+ // "Achievements" short on every phone (CardTastic's App Store screenshots, 2026-11-11). The web's CSS lets
31
+ // the longhands win, which is the only place this had been checked.
32
+ const LABEL_WIDE_TAB = { flex: 0, flexBasis: 'auto', flexGrow: 1, flexShrink: 1 } as const
28
33
  const NO_PACK_TABS: readonly PackStatsTab[] = []
29
34
 
30
35
  // The pickers' values for Everyone and All Games (neither is ever a profile or game id).
@@ -131,7 +136,7 @@ function StatsContent({ pickerHost }: { pickerHost: PopoverHost }) {
131
136
  filters (pressAway's zIndex sits below filtersOpen's), so a tap anywhere on the page but a
132
137
  menu closes it. Off the page (the header, the margins) StatsPressAway closes it. */}
133
138
  <PressAwayOverlay active={pickerHost.openId !== null} onPress={pickerHost.close} style={styles.pressAway} />
134
- <SegmentedButtons value={tab} onValueChange={setTab} buttons={tabButtons} style={[styles.tabs, surface]} />
139
+ <SegmentedButtons value={tab} onValueChange={setTab} buttons={tabButtons} theme={SEGMENT_THEME} style={[styles.tabs, surface]} />
135
140
 
136
141
  {/* Takes a press on its own blank parts (the gap, an open menu's padding) while a menu is open, so
137
142
  it never reaches StatsPressAway. */}
@@ -207,8 +212,8 @@ const styles = StyleSheet.create({
207
212
  screen: {
208
213
  flex: 1
209
214
  },
210
- // SegmentedButtons' own rounding, so a surface behind it is the same pill.
215
+ // SegmentedButtons' own rounding (SEGMENT_THEME's), so a surface behind it is the same pill.
211
216
  tabs: {
212
- borderRadius: 20
217
+ borderRadius: SEGMENT_RADIUS
213
218
  }
214
219
  })