@tastic/shell 0.7.0 → 0.8.1
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 +2 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6 -3
- package/dist/index.mjs +6 -3
- package/package.json +4 -4
- package/src/components/SettingsDialog.tsx +8 -3
- package/src/screens/HomeScreen.tsx +7 -2
- package/src/types.ts +7 -1
package/README.md
CHANGED
|
@@ -102,6 +102,7 @@ the front of an in-app link, so a route starting with a game id equal to the bas
|
|
|
102
102
|
| `fonts?` | Fonts the pack's own art needs, loaded behind the splash screen beside the icon font. |
|
|
103
103
|
| `fontFamily?` | The typeface on every Paper text variant. Unset is Paper's own. |
|
|
104
104
|
| `otaVersion` | The version label in Settings. |
|
|
105
|
+
| `useSettingsRules?` | A hook returning what goes first in every Settings dialog, above the shell's rows: the rules of the game it's opened in. Null where there's nothing (Home). |
|
|
105
106
|
| `SettingsSections?` | The pack's own Settings sections, in every Settings dialog, under the shell's rows and any a play screen adds. |
|
|
106
107
|
| `reducers?` | The pack's own store keys (what `SettingsSections` saves), beside the shell's and the games'. Never a key either already mounts. |
|
|
107
108
|
| `StatsSections?` | A section across the pack's games (a calendar of play), first on the stats screen's Stats tab, handed its two filters (`PackStatsSectionsProps`: `profileId`, null for Everyone, and `gameId`, null for All Games). |
|
|
@@ -233,7 +234,7 @@ became a package (the lower of the two where they differ).
|
|
|
233
234
|
| `@rific/feedback-press` | >=0.13.1 | haptic and sound settings, the UI sounds |
|
|
234
235
|
| `@rific/toaster` | >=0.10.1 | toasts (DuelTastic runs 0.12, PuckTastic 0.10) |
|
|
235
236
|
| `@tastic/core` | >=0.15.0 | the seat mode from the window's shape, the root background |
|
|
236
|
-
| `@tastic/hud` | >=0.
|
|
237
|
+
| `@tastic/hud` | >=0.29.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 |
|
|
237
238
|
| `@tastic/profile` | >=0.16.2 | profiles, the seat buttons, seat colors |
|
|
238
239
|
| `@tastic/achievements` | >=0.6.0 | `createGameStats`, `forgetProfileAchievements` |
|
|
239
240
|
| `@tastic/split-screen` | >=0.5.5 | the 2 Player loadout's two halves |
|
package/dist/index.d.mts
CHANGED
|
@@ -280,6 +280,7 @@ interface PackDefinition {
|
|
|
280
280
|
fontFamily?: string;
|
|
281
281
|
otaVersion: number;
|
|
282
282
|
SettingsSections?: ComponentType;
|
|
283
|
+
useSettingsRules?: () => ReactNode;
|
|
283
284
|
reducers?: Record<string, Reducer>;
|
|
284
285
|
StatsSections?: ComponentType<PackStatsSectionsProps>;
|
|
285
286
|
Backdrop?: ComponentType;
|
package/dist/index.d.ts
CHANGED
|
@@ -280,6 +280,7 @@ interface PackDefinition {
|
|
|
280
280
|
fontFamily?: string;
|
|
281
281
|
otaVersion: number;
|
|
282
282
|
SettingsSections?: ComponentType;
|
|
283
|
+
useSettingsRules?: () => ReactNode;
|
|
283
284
|
reducers?: Record<string, Reducer>;
|
|
284
285
|
StatsSections?: ComponentType<PackStatsSectionsProps>;
|
|
285
286
|
Backdrop?: ComponentType;
|
package/dist/index.js
CHANGED
|
@@ -635,12 +635,14 @@ function useAppSettings() {
|
|
|
635
635
|
|
|
636
636
|
// src/components/SettingsDialog.tsx
|
|
637
637
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
638
|
+
var noSettingsRules = () => null;
|
|
638
639
|
function SettingsDialog({ visible, onDismiss, onShowHowToPlay, children }) {
|
|
639
640
|
const onUpdateError = (0, import_toaster3.useUpdateErrorToast)();
|
|
640
641
|
const { settings, setSettings } = useAppSettings();
|
|
641
|
-
const { otaVersion, SettingsSections, edgeGuard = true } = usePack();
|
|
642
|
+
const { otaVersion, SettingsSections, edgeGuard = true, useSettingsRules = noSettingsRules } = usePack();
|
|
643
|
+
const rules = useSettingsRules();
|
|
642
644
|
const edgeGuardProps = edgeGuard ? { deferBottomEdgeGestures: settings.deferBottomEdgeGestures, onDeferBottomEdgeGestures: (value) => setSettings({ deferBottomEdgeGestures: value }) } : {};
|
|
643
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_chrome3.BaseSettingsDialog, { visible, onDismiss, version: otaVersion, ...edgeGuardProps, onUpdateError, onShowHowToPlay, children: [
|
|
645
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_chrome3.BaseSettingsDialog, { visible, onDismiss, version: otaVersion, ...edgeGuardProps, onUpdateError, onShowHowToPlay, leading: rules, children: [
|
|
644
646
|
children,
|
|
645
647
|
SettingsSections && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SettingsSections, {})
|
|
646
648
|
] });
|
|
@@ -1255,6 +1257,7 @@ function hasRules(game) {
|
|
|
1255
1257
|
function RulesHost({ enabled, children }) {
|
|
1256
1258
|
return enabled ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native_paper.Portal.Host, { children }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children });
|
|
1257
1259
|
}
|
|
1260
|
+
var ROW_BLURB_LINES = 3;
|
|
1258
1261
|
function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPress, onRules }) {
|
|
1259
1262
|
const well = (0, import_chrome5.useWellColors)();
|
|
1260
1263
|
const GameIcon = game.icon;
|
|
@@ -1266,7 +1269,7 @@ function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPres
|
|
|
1266
1269
|
game.Preview ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PreviewBox, { game, width: ROW_PREVIEW_WIDTH, revealed: previewRevealed, dark, p1Color, p2Color }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native8.View, { style: [styles4.rowIcon, { backgroundColor: dark ? ICON_DARK_BG : ICON_LIGHT_BG }], children: GameIcon && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(GameIcon, { size: ROW_ICON_SIZE, p1Color, p2Color, dark }) }),
|
|
1267
1270
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native8.View, { style: styles4.rowText, children: [
|
|
1268
1271
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native_paper.Text, { variant: "titleLarge", style: [styles4.rowTitle, { color: well.fg }], numberOfLines: 1, children: game.title }),
|
|
1269
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native_paper.Text, { variant: "bodyMedium", style: { color: well.fgMuted }, numberOfLines:
|
|
1272
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native_paper.Text, { variant: "bodyMedium", style: { color: well.fgMuted }, numberOfLines: ROW_BLURB_LINES, children: game.blurb })
|
|
1270
1273
|
] })
|
|
1271
1274
|
] }),
|
|
1272
1275
|
onRules && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_feedback_press3.Pressable, { onPress: onRules, style: styles4.rulesButton, hitSlop: 12, accessibilityRole: "button", accessibilityLabel: `${game.title} rules`, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native_paper.Icon, { source: "information-outline", size: 22, color: well.fgMuted }) })
|
package/dist/index.mjs
CHANGED
|
@@ -558,12 +558,14 @@ function useAppSettings() {
|
|
|
558
558
|
|
|
559
559
|
// src/components/SettingsDialog.tsx
|
|
560
560
|
import { jsx as jsx11, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
561
|
+
var noSettingsRules = () => null;
|
|
561
562
|
function SettingsDialog({ visible, onDismiss, onShowHowToPlay, children }) {
|
|
562
563
|
const onUpdateError = useUpdateErrorToast2();
|
|
563
564
|
const { settings, setSettings } = useAppSettings();
|
|
564
|
-
const { otaVersion, SettingsSections, edgeGuard = true } = usePack();
|
|
565
|
+
const { otaVersion, SettingsSections, edgeGuard = true, useSettingsRules = noSettingsRules } = usePack();
|
|
566
|
+
const rules = useSettingsRules();
|
|
565
567
|
const edgeGuardProps = edgeGuard ? { deferBottomEdgeGestures: settings.deferBottomEdgeGestures, onDeferBottomEdgeGestures: (value) => setSettings({ deferBottomEdgeGestures: value }) } : {};
|
|
566
|
-
return /* @__PURE__ */ jsxs3(BaseSettingsDialog, { visible, onDismiss, version: otaVersion, ...edgeGuardProps, onUpdateError, onShowHowToPlay, children: [
|
|
568
|
+
return /* @__PURE__ */ jsxs3(BaseSettingsDialog, { visible, onDismiss, version: otaVersion, ...edgeGuardProps, onUpdateError, onShowHowToPlay, leading: rules, children: [
|
|
567
569
|
children,
|
|
568
570
|
SettingsSections && /* @__PURE__ */ jsx11(SettingsSections, {})
|
|
569
571
|
] });
|
|
@@ -1178,6 +1180,7 @@ function hasRules(game) {
|
|
|
1178
1180
|
function RulesHost({ enabled, children }) {
|
|
1179
1181
|
return enabled ? /* @__PURE__ */ jsx14(Portal.Host, { children }) : /* @__PURE__ */ jsx14(Fragment4, { children });
|
|
1180
1182
|
}
|
|
1183
|
+
var ROW_BLURB_LINES = 3;
|
|
1181
1184
|
function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPress, onRules }) {
|
|
1182
1185
|
const well = useWellColors();
|
|
1183
1186
|
const GameIcon = game.icon;
|
|
@@ -1189,7 +1192,7 @@ function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPres
|
|
|
1189
1192
|
game.Preview ? /* @__PURE__ */ jsx14(PreviewBox, { game, width: ROW_PREVIEW_WIDTH, revealed: previewRevealed, dark, p1Color, p2Color }) : /* @__PURE__ */ jsx14(View4, { style: [styles4.rowIcon, { backgroundColor: dark ? ICON_DARK_BG : ICON_LIGHT_BG }], children: GameIcon && /* @__PURE__ */ jsx14(GameIcon, { size: ROW_ICON_SIZE, p1Color, p2Color, dark }) }),
|
|
1190
1193
|
/* @__PURE__ */ jsxs5(View4, { style: styles4.rowText, children: [
|
|
1191
1194
|
/* @__PURE__ */ jsx14(Text, { variant: "titleLarge", style: [styles4.rowTitle, { color: well.fg }], numberOfLines: 1, children: game.title }),
|
|
1192
|
-
/* @__PURE__ */ jsx14(Text, { variant: "bodyMedium", style: { color: well.fgMuted }, numberOfLines:
|
|
1195
|
+
/* @__PURE__ */ jsx14(Text, { variant: "bodyMedium", style: { color: well.fgMuted }, numberOfLines: ROW_BLURB_LINES, children: game.blurb })
|
|
1193
1196
|
] })
|
|
1194
1197
|
] }),
|
|
1195
1198
|
onRules && /* @__PURE__ */ jsx14(Pressable, { onPress: onRules, style: styles4.rulesButton, hitSlop: 12, accessibilityRole: "button", accessibilityLabel: `${game.title} rules`, children: /* @__PURE__ */ jsx14(Icon, { source: "information-outline", size: 22, color: well.fgMuted }) })
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tastic/shell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
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",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"@expo/vector-icons": "^15.1.1",
|
|
71
71
|
"@infinitetoken/eslint-config": "^0.2.1",
|
|
72
72
|
"@infinitetoken/jest-config": "^0.5.2",
|
|
73
|
-
"@infinitetoken/tsconfig": "^0.
|
|
73
|
+
"@infinitetoken/tsconfig": "^0.7.0",
|
|
74
74
|
"@react-native-async-storage/async-storage": "2.2.0",
|
|
75
75
|
"@react-native-masked-view/masked-view": "0.3.2",
|
|
76
76
|
"@react-native/jest-preset": "^0.88.0",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"@tastic/achievements": "^0.6.0",
|
|
87
87
|
"@tastic/core": "^0.16.0",
|
|
88
88
|
"@tastic/edge-guard": "^0.1.5",
|
|
89
|
-
"@tastic/hud": "^0.
|
|
89
|
+
"@tastic/hud": "^0.29.0",
|
|
90
90
|
"@tastic/profile": "^0.18.0",
|
|
91
91
|
"@tastic/split-screen": "^0.5.5",
|
|
92
92
|
"@testing-library/react-native": "^14.1.0",
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
"@tastic/achievements": ">=0.6.0",
|
|
138
138
|
"@tastic/core": ">=0.16.0",
|
|
139
139
|
"@tastic/edge-guard": ">=0.1.5",
|
|
140
|
-
"@tastic/hud": ">=0.
|
|
140
|
+
"@tastic/hud": ">=0.29.0",
|
|
141
141
|
"@tastic/profile": ">=0.18.0",
|
|
142
142
|
"@tastic/split-screen": ">=0.5.5",
|
|
143
143
|
"expo-blur": ">=58.0.4",
|
|
@@ -17,20 +17,25 @@ export interface SettingsDialogProps {
|
|
|
17
17
|
children?: ReactNode
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
// A pack without rules to put first (PackDefinition.useSettingsRules).
|
|
21
|
+
const noSettingsRules = () => null
|
|
22
|
+
|
|
20
23
|
// The pack-wide Settings dialog: everything the shell puts in it applies to every game (Edge Guard,
|
|
21
24
|
// theme, sound, haptics, Keep Awake), so it reads and writes the app
|
|
22
|
-
// settings itself.
|
|
25
|
+
// settings itself. Above those, the rules of the game it's opened in (PackDefinition.useSettingsRules);
|
|
26
|
+
// under them, a play screen's own rows and then the pack's own sections
|
|
23
27
|
// (PackDefinition.SettingsSections), in every Settings dialog the pack opens. A pack with edgeGuard
|
|
24
28
|
// false gets no Edge Guard row: hud draws it on iOS whenever its props are passed.
|
|
25
29
|
export function SettingsDialog({ visible, onDismiss, onShowHowToPlay, children }: SettingsDialogProps) {
|
|
26
30
|
const onUpdateError = useUpdateErrorToast()
|
|
27
31
|
const { settings, setSettings } = useAppSettings()
|
|
28
32
|
// The pack's otaVersion (src/constants/release.ts, which the OTA tooling bumps).
|
|
29
|
-
const { otaVersion, SettingsSections, edgeGuard = true } = usePack()
|
|
33
|
+
const { otaVersion, SettingsSections, edgeGuard = true, useSettingsRules = noSettingsRules } = usePack()
|
|
34
|
+
const rules = useSettingsRules()
|
|
30
35
|
const edgeGuardProps = edgeGuard ? { deferBottomEdgeGestures: settings.deferBottomEdgeGestures, onDeferBottomEdgeGestures: (value: boolean) => setSettings({ deferBottomEdgeGestures: value }) } : {}
|
|
31
36
|
|
|
32
37
|
return (
|
|
33
|
-
<BaseSettingsDialog visible={visible} onDismiss={onDismiss} version={otaVersion} {...edgeGuardProps} onUpdateError={onUpdateError} onShowHowToPlay={onShowHowToPlay}>
|
|
38
|
+
<BaseSettingsDialog visible={visible} onDismiss={onDismiss} version={otaVersion} {...edgeGuardProps} onUpdateError={onUpdateError} onShowHowToPlay={onShowHowToPlay} leading={rules}>
|
|
34
39
|
{children}
|
|
35
40
|
{SettingsSections && <SettingsSections />}
|
|
36
41
|
</BaseSettingsDialog>
|
|
@@ -276,8 +276,11 @@ interface GameRowProps {
|
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
// One game on its own well: its icon at app-icon size (the art was drawn as an app icon), or its
|
|
279
|
-
// preview where it has one, its name and
|
|
279
|
+
// preview where it has one, its name and short blurb (up to ROW_BLURB_LINES lines), and a rules button at the end that shows its
|
|
280
280
|
// How to Play cards without opening the game.
|
|
281
|
+
// How many lines a row's blurb may wrap to before it's cut off.
|
|
282
|
+
export const ROW_BLURB_LINES = 3
|
|
283
|
+
|
|
281
284
|
function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPress, onRules }: GameRowProps) {
|
|
282
285
|
const well = useWellColors()
|
|
283
286
|
const GameIcon = game.icon
|
|
@@ -291,7 +294,9 @@ function GameRow({ game, hidden, dark, p1Color, p2Color, previewRevealed, onPres
|
|
|
291
294
|
<Text variant='titleLarge' style={[styles.rowTitle, { color: well.fg }]} numberOfLines={1}>
|
|
292
295
|
{game.title}
|
|
293
296
|
</Text>
|
|
294
|
-
|
|
297
|
+
{/* Three lines, as a tile allows: a narrow phone (an iPhone SE, a 411dp Android phone) wraps a
|
|
298
|
+
55-character blurb onto a third line in the monospace, and two lines cut it off with an ellipsis */}
|
|
299
|
+
<Text variant='bodyMedium' style={{ color: well.fgMuted }} numberOfLines={ROW_BLURB_LINES}>
|
|
295
300
|
{game.blurb}
|
|
296
301
|
</Text>
|
|
297
302
|
</View>
|
package/src/types.ts
CHANGED
|
@@ -137,7 +137,8 @@ export interface GameRulesProps {
|
|
|
137
137
|
export interface GameDefinition {
|
|
138
138
|
id: string
|
|
139
139
|
title: string
|
|
140
|
-
//
|
|
140
|
+
// A sentence or two under the game's name on Home: a row shows up to three lines (ROW_BLURB_LINES)
|
|
141
|
+
// on the narrowest phones, a tile three.
|
|
141
142
|
blurb: string
|
|
142
143
|
// Left out only by a game with a Preview, which Home draws in its place.
|
|
143
144
|
icon?: ComponentType<GameIconProps>
|
|
@@ -292,6 +293,11 @@ export interface PackDefinition {
|
|
|
292
293
|
// The pack's own Settings sections (how cards look, how play is helped along), in every Settings
|
|
293
294
|
// dialog under the shell's own rows and any a play screen adds. Their values live in `reducers`.
|
|
294
295
|
SettingsSections?: ComponentType
|
|
296
|
+
// What goes FIRST in every Settings dialog the pack opens, above the shell's own rows: the rules of
|
|
297
|
+
// the game the dialog is opened in (Solitaire finds it from the route), which someone opening
|
|
298
|
+
// Settings from a game is most likely there for. Null where there is nothing to put first (Home), and
|
|
299
|
+
// the dialog is then as it was. A hook, called on every render of the dialog.
|
|
300
|
+
useSettingsRules?: () => ReactNode
|
|
295
301
|
// Store keys of the pack's own, beside the shell's and each game's (GameDefinition.reducers): what
|
|
296
302
|
// SettingsSections saves, or anything else that belongs to every game. Never a key the shell or a
|
|
297
303
|
// game already mounts.
|