@tastic/shell 0.8.1 → 0.8.2

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/dist/index.js CHANGED
@@ -1049,6 +1049,10 @@ var import_react16 = require("react");
1049
1049
  var import_react_native8 = require("react-native");
1050
1050
  var import_react_native_paper = require("react-native-paper");
1051
1051
 
1052
+ // src/components/segmentTheme.ts
1053
+ var SEGMENT_THEME = { roundness: 3.8 };
1054
+ var SEGMENT_RADIUS = 5 * SEGMENT_THEME.roundness;
1055
+
1052
1056
  // src/hooks/useFrozenWhileHidden.ts
1053
1057
  var import_react15 = require("react");
1054
1058
  function useFrozenWhileHidden(value, hidden) {
@@ -1183,7 +1187,7 @@ function HomeMenu() {
1183
1187
  const [tabLabel, setTabLabel] = (0, import_react16.useState)(() => tabs?.[0].label ?? null);
1184
1188
  const tab = tabs ? tabs.find((t) => t.label === tabLabel) ?? tabs[0] : null;
1185
1189
  const tabButtons = (0, import_react16.useMemo)(() => tabs?.map(({ label }) => ({ value: label, label })) ?? [], [tabs]);
1186
- const tabBar = tab && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native_paper.SegmentedButtons, { value: tab.label, onValueChange: setTabLabel, buttons: tabButtons, style: [styles4.tabs, pack.Backdrop && { backgroundColor: colors.surface }] });
1190
+ const tabBar = tab && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native_paper.SegmentedButtons, { value: tab.label, onValueChange: setTabLabel, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles4.tabs, pack.Backdrop && { backgroundColor: colors.surface }] });
1187
1191
  const columnClamp = useClampOnShrink();
1188
1192
  const gridClamp = useClampOnShrink();
1189
1193
  const openGame = (0, import_react16.useCallback)((game) => openFirstTime(game.id, () => import_expo_router6.router.push(game.useLoadout ? loadoutHref(game.id) : playHref(game.id))), [openFirstTime]);
@@ -1391,9 +1395,9 @@ var styles4 = import_react_native8.StyleSheet.create({
1391
1395
  scroll: {
1392
1396
  flex: 1
1393
1397
  },
1394
- // SegmentedButtons' own rounding, so a surface behind it is the same pill (the stats screen's tabs).
1398
+ // SegmentedButtons' own rounding (SEGMENT_THEME's), so a surface behind it is the same pill (the stats screen's tabs).
1395
1399
  tabs: {
1396
- borderRadius: 20
1400
+ borderRadius: SEGMENT_RADIUS
1397
1401
  },
1398
1402
  // The same well as a row, turned on its side.
1399
1403
  tile: {
@@ -1472,7 +1476,7 @@ var TABS = [
1472
1476
  { value: STATS, label: "Stats", icon: "chart-box-outline" },
1473
1477
  { value: ACHIEVEMENTS, label: "Achievements", icon: "trophy-outline" }
1474
1478
  ];
1475
- var LABEL_WIDE_TAB = { flexBasis: "auto", flexGrow: 1, flexShrink: 1 };
1479
+ var LABEL_WIDE_TAB = { flex: 0, flexBasis: "auto", flexGrow: 1, flexShrink: 1 };
1476
1480
  var NO_PACK_TABS = [];
1477
1481
  var EVERYONE = "__everyone__";
1478
1482
  var ALL_GAMES = "__all__";
@@ -1520,7 +1524,7 @@ function StatsContent({ pickerHost }) {
1520
1524
  const PackTabContent = packTab?.Content;
1521
1525
  return /* @__PURE__ */ (0, import_jsx_runtime16.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, rotation: 0, children: [
1522
1526
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_chrome7.PressAwayOverlay, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles5.pressAway }),
1523
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_native_paper2.SegmentedButtons, { value: tab, onValueChange: setTab, buttons: tabButtons, style: [styles5.tabs, surface] }),
1527
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_native_paper2.SegmentedButtons, { value: tab, onValueChange: setTab, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles5.tabs, surface] }),
1524
1528
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_react_native9.View, { style: [styles5.filters, pickerHost.openId !== null && styles5.filtersOpen], onStartShouldSetResponder: () => pickerHost.openId !== null, children: [
1525
1529
  profiles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_profile9.OptionPicker, { id: PLAYER_PICKER_ID, host: pickerHost, options: playerOptions, value: profileId ?? EVERYONE, onChange: (value) => setSelectedProfileId(value === EVERYONE ? null : value), color: colors.primary, dark, icon: profileId ? "account" : "account-group", alignOverride: playerAlign, triggerStyle }),
1526
1530
  showGamePicker && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_profile9.OptionPicker, { id: GAME_PICKER_ID, host: pickerHost, options: gameOptions, value: gameId, onChange: setGameId, color: colors.primary, dark, icon: "view-grid-outline", alignOverride: gameAlign, triggerStyle })
@@ -1574,9 +1578,9 @@ var styles5 = import_react_native9.StyleSheet.create({
1574
1578
  screen: {
1575
1579
  flex: 1
1576
1580
  },
1577
- // SegmentedButtons' own rounding, so a surface behind it is the same pill.
1581
+ // SegmentedButtons' own rounding (SEGMENT_THEME's), so a surface behind it is the same pill.
1578
1582
  tabs: {
1579
- borderRadius: 20
1583
+ borderRadius: SEGMENT_RADIUS
1580
1584
  }
1581
1585
  });
1582
1586
 
package/dist/index.mjs CHANGED
@@ -972,6 +972,10 @@ import { useCallback as useCallback10, useEffect as useEffect6, useMemo as useMe
972
972
  import { AppState as AppState2, StyleSheet as StyleSheet4, View as View4 } from "react-native";
973
973
  import { Icon, Portal, SegmentedButtons, Text } from "react-native-paper";
974
974
 
975
+ // src/components/segmentTheme.ts
976
+ var SEGMENT_THEME = { roundness: 3.8 };
977
+ var SEGMENT_RADIUS = 5 * SEGMENT_THEME.roundness;
978
+
975
979
  // src/hooks/useFrozenWhileHidden.ts
976
980
  import { useState as useState5 } from "react";
977
981
  function useFrozenWhileHidden(value, hidden) {
@@ -1106,7 +1110,7 @@ function HomeMenu() {
1106
1110
  const [tabLabel, setTabLabel] = useState6(() => tabs?.[0].label ?? null);
1107
1111
  const tab = tabs ? tabs.find((t) => t.label === tabLabel) ?? tabs[0] : null;
1108
1112
  const tabButtons = useMemo6(() => tabs?.map(({ label }) => ({ value: label, label })) ?? [], [tabs]);
1109
- const tabBar = tab && /* @__PURE__ */ jsx14(SegmentedButtons, { value: tab.label, onValueChange: setTabLabel, buttons: tabButtons, style: [styles4.tabs, pack.Backdrop && { backgroundColor: colors.surface }] });
1113
+ const tabBar = tab && /* @__PURE__ */ jsx14(SegmentedButtons, { value: tab.label, onValueChange: setTabLabel, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles4.tabs, pack.Backdrop && { backgroundColor: colors.surface }] });
1110
1114
  const columnClamp = useClampOnShrink();
1111
1115
  const gridClamp = useClampOnShrink();
1112
1116
  const openGame = useCallback10((game) => openFirstTime(game.id, () => router3.push(game.useLoadout ? loadoutHref(game.id) : playHref(game.id))), [openFirstTime]);
@@ -1314,9 +1318,9 @@ var styles4 = StyleSheet4.create({
1314
1318
  scroll: {
1315
1319
  flex: 1
1316
1320
  },
1317
- // SegmentedButtons' own rounding, so a surface behind it is the same pill (the stats screen's tabs).
1321
+ // SegmentedButtons' own rounding (SEGMENT_THEME's), so a surface behind it is the same pill (the stats screen's tabs).
1318
1322
  tabs: {
1319
- borderRadius: 20
1323
+ borderRadius: SEGMENT_RADIUS
1320
1324
  },
1321
1325
  // The same well as a row, turned on its side.
1322
1326
  tile: {
@@ -1395,7 +1399,7 @@ var TABS = [
1395
1399
  { value: STATS, label: "Stats", icon: "chart-box-outline" },
1396
1400
  { value: ACHIEVEMENTS, label: "Achievements", icon: "trophy-outline" }
1397
1401
  ];
1398
- var LABEL_WIDE_TAB = { flexBasis: "auto", flexGrow: 1, flexShrink: 1 };
1402
+ var LABEL_WIDE_TAB = { flex: 0, flexBasis: "auto", flexGrow: 1, flexShrink: 1 };
1399
1403
  var NO_PACK_TABS = [];
1400
1404
  var EVERYONE = "__everyone__";
1401
1405
  var ALL_GAMES = "__all__";
@@ -1443,7 +1447,7 @@ function StatsContent({ pickerHost }) {
1443
1447
  const PackTabContent = packTab?.Content;
1444
1448
  return /* @__PURE__ */ jsxs6(BaseStatsScreen, { title, onBack: safeBack, insets, onReset: reset.onReset, resetLabel: reset.label, resetConfirmTitle: reset.title, resetConfirmBody: reset.body, fg: pack.foreground, bg: pack.Backdrop ? "transparent" : void 0, rotation: 0, children: [
1445
1449
  /* @__PURE__ */ jsx16(PressAwayOverlay3, { active: pickerHost.openId !== null, onPress: pickerHost.close, style: styles5.pressAway }),
1446
- /* @__PURE__ */ jsx16(SegmentedButtons2, { value: tab, onValueChange: setTab, buttons: tabButtons, style: [styles5.tabs, surface] }),
1450
+ /* @__PURE__ */ jsx16(SegmentedButtons2, { value: tab, onValueChange: setTab, buttons: tabButtons, theme: SEGMENT_THEME, style: [styles5.tabs, surface] }),
1447
1451
  /* @__PURE__ */ jsxs6(View5, { style: [styles5.filters, pickerHost.openId !== null && styles5.filtersOpen], onStartShouldSetResponder: () => pickerHost.openId !== null, children: [
1448
1452
  profiles.length > 0 && /* @__PURE__ */ jsx16(OptionPicker2, { id: PLAYER_PICKER_ID, host: pickerHost, options: playerOptions, value: profileId ?? EVERYONE, onChange: (value) => setSelectedProfileId(value === EVERYONE ? null : value), color: colors.primary, dark, icon: profileId ? "account" : "account-group", alignOverride: playerAlign, triggerStyle }),
1449
1453
  showGamePicker && /* @__PURE__ */ jsx16(OptionPicker2, { id: GAME_PICKER_ID, host: pickerHost, options: gameOptions, value: gameId, onChange: setGameId, color: colors.primary, dark, icon: "view-grid-outline", alignOverride: gameAlign, triggerStyle })
@@ -1497,9 +1501,9 @@ var styles5 = StyleSheet5.create({
1497
1501
  screen: {
1498
1502
  flex: 1
1499
1503
  },
1500
- // SegmentedButtons' own rounding, so a surface behind it is the same pill.
1504
+ // SegmentedButtons' own rounding (SEGMENT_THEME's), so a surface behind it is the same pill.
1501
1505
  tabs: {
1502
- borderRadius: 20
1506
+ borderRadius: SEGMENT_RADIUS
1503
1507
  }
1504
1508
  });
1505
1509
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tastic/shell",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
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",
@@ -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
  })