@beta-gamer/react-native 0.1.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/dist/index.d.ts +118 -0
- package/dist/index.js +279 -0
- package/package.json +31 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import * as socket_io_client from 'socket.io-client';
|
|
4
|
+
import { Socket } from 'socket.io-client';
|
|
5
|
+
import * as _socket_io_component_emitter from '@socket.io/component-emitter';
|
|
6
|
+
import { ViewStyle, TextStyle } from 'react-native';
|
|
7
|
+
|
|
8
|
+
type GameType = 'chess' | 'checkers' | 'connect4' | 'tictactoe' | 'subway-runner';
|
|
9
|
+
type MatchType = 'matchmaking' | 'private' | 'bot';
|
|
10
|
+
type SessionMode = 'live' | 'test' | 'training';
|
|
11
|
+
type SessionStatus = 'pending' | 'active' | 'ended';
|
|
12
|
+
interface SessionPlayer {
|
|
13
|
+
id: string;
|
|
14
|
+
displayName: string;
|
|
15
|
+
}
|
|
16
|
+
interface SessionTheme {
|
|
17
|
+
primaryColor?: string;
|
|
18
|
+
backgroundColor?: string;
|
|
19
|
+
boardLight?: string;
|
|
20
|
+
boardDark?: string;
|
|
21
|
+
fontFamily?: string;
|
|
22
|
+
[key: string]: string | undefined;
|
|
23
|
+
}
|
|
24
|
+
interface SessionTokenPayload {
|
|
25
|
+
sessionId: string;
|
|
26
|
+
game: GameType;
|
|
27
|
+
mode: SessionMode;
|
|
28
|
+
matchType: MatchType;
|
|
29
|
+
tenantId: string;
|
|
30
|
+
players: SessionPlayer[];
|
|
31
|
+
roomCode: string | null;
|
|
32
|
+
theme: SessionTheme;
|
|
33
|
+
exp: number;
|
|
34
|
+
}
|
|
35
|
+
interface GameState {
|
|
36
|
+
status: SessionStatus;
|
|
37
|
+
players: SessionPlayer[];
|
|
38
|
+
currentTurn?: string;
|
|
39
|
+
winner?: string | null;
|
|
40
|
+
reason?: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface BetaGamerContextValue {
|
|
44
|
+
token: string;
|
|
45
|
+
session: SessionTokenPayload;
|
|
46
|
+
socket: Socket | null;
|
|
47
|
+
gameState: GameState;
|
|
48
|
+
theme: SessionTheme;
|
|
49
|
+
}
|
|
50
|
+
interface BetaGamerProviderProps {
|
|
51
|
+
token: string;
|
|
52
|
+
serverUrl?: string;
|
|
53
|
+
children: React.ReactNode;
|
|
54
|
+
}
|
|
55
|
+
declare function BetaGamerProvider({ token, serverUrl, children }: BetaGamerProviderProps): react_jsx_runtime.JSX.Element;
|
|
56
|
+
declare function useBetaGamer(): BetaGamerContextValue;
|
|
57
|
+
|
|
58
|
+
/** Returns the current game state (status, players, winner, etc.) */
|
|
59
|
+
declare function useGameState(): GameState;
|
|
60
|
+
/** Returns the decoded session payload (game, mode, matchType, players, theme) */
|
|
61
|
+
declare function useSession(): SessionTokenPayload;
|
|
62
|
+
/** Returns the raw Socket.IO socket — for advanced custom event handling */
|
|
63
|
+
declare function useSocket(): socket_io_client.Socket<_socket_io_component_emitter.DefaultEventsMap, _socket_io_component_emitter.DefaultEventsMap> | null;
|
|
64
|
+
/** Returns the active theme tokens */
|
|
65
|
+
declare function useTheme(): SessionTheme;
|
|
66
|
+
|
|
67
|
+
interface PlayerCardProps {
|
|
68
|
+
player: 'self' | 'opponent';
|
|
69
|
+
style?: ViewStyle;
|
|
70
|
+
nameStyle?: TextStyle;
|
|
71
|
+
indicatorStyle?: ViewStyle;
|
|
72
|
+
}
|
|
73
|
+
declare function PlayerCard({ player, style, nameStyle, indicatorStyle }: PlayerCardProps): react_jsx_runtime.JSX.Element | null;
|
|
74
|
+
|
|
75
|
+
interface TimerProps {
|
|
76
|
+
player: 'self' | 'opponent';
|
|
77
|
+
initialSeconds?: number;
|
|
78
|
+
style?: ViewStyle;
|
|
79
|
+
textStyle?: TextStyle;
|
|
80
|
+
}
|
|
81
|
+
declare function Timer({ player, initialSeconds, style, textStyle }: TimerProps): react_jsx_runtime.JSX.Element;
|
|
82
|
+
|
|
83
|
+
declare function ChessBoard({ style }: {
|
|
84
|
+
style?: ViewStyle;
|
|
85
|
+
}): react_jsx_runtime.JSX.Element;
|
|
86
|
+
|
|
87
|
+
interface ChessMoveHistoryProps {
|
|
88
|
+
style?: ViewStyle;
|
|
89
|
+
rowStyle?: ViewStyle;
|
|
90
|
+
textStyle?: TextStyle;
|
|
91
|
+
}
|
|
92
|
+
declare function ChessMoveHistory({ style, rowStyle, textStyle }: ChessMoveHistoryProps): react_jsx_runtime.JSX.Element;
|
|
93
|
+
|
|
94
|
+
declare function CheckersBoard({ style }: {
|
|
95
|
+
style?: ViewStyle;
|
|
96
|
+
}): react_jsx_runtime.JSX.Element;
|
|
97
|
+
|
|
98
|
+
declare function Connect4Board({ style }: {
|
|
99
|
+
style?: ViewStyle;
|
|
100
|
+
}): react_jsx_runtime.JSX.Element;
|
|
101
|
+
|
|
102
|
+
declare function TictactoeBoard({ style }: {
|
|
103
|
+
style?: ViewStyle;
|
|
104
|
+
}): react_jsx_runtime.JSX.Element;
|
|
105
|
+
|
|
106
|
+
declare function SubwayRunnerGame({ style }: {
|
|
107
|
+
style?: ViewStyle;
|
|
108
|
+
}): react_jsx_runtime.JSX.Element;
|
|
109
|
+
declare function SubwayRunnerScore({ style, textStyle }: {
|
|
110
|
+
style?: ViewStyle;
|
|
111
|
+
textStyle?: TextStyle;
|
|
112
|
+
}): react_jsx_runtime.JSX.Element;
|
|
113
|
+
declare function SubwayRunnerLives({ style, lifeStyle }: {
|
|
114
|
+
style?: ViewStyle;
|
|
115
|
+
lifeStyle?: ViewStyle;
|
|
116
|
+
}): react_jsx_runtime.JSX.Element;
|
|
117
|
+
|
|
118
|
+
export { BetaGamerProvider, CheckersBoard, ChessBoard, ChessMoveHistory, Connect4Board, type GameState, type GameType, type MatchType, PlayerCard, type SessionMode, type SessionPlayer, type SessionStatus, type SessionTheme, type SessionTokenPayload, SubwayRunnerGame, SubwayRunnerLives, SubwayRunnerScore, TictactoeBoard, Timer, useBetaGamer, useGameState, useSession, useSocket, useTheme };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
BetaGamerProvider: () => BetaGamerProvider,
|
|
24
|
+
CheckersBoard: () => CheckersBoard,
|
|
25
|
+
ChessBoard: () => ChessBoard,
|
|
26
|
+
ChessMoveHistory: () => ChessMoveHistory,
|
|
27
|
+
Connect4Board: () => Connect4Board,
|
|
28
|
+
PlayerCard: () => PlayerCard,
|
|
29
|
+
SubwayRunnerGame: () => SubwayRunnerGame,
|
|
30
|
+
SubwayRunnerLives: () => SubwayRunnerLives,
|
|
31
|
+
SubwayRunnerScore: () => SubwayRunnerScore,
|
|
32
|
+
TictactoeBoard: () => TictactoeBoard,
|
|
33
|
+
Timer: () => Timer,
|
|
34
|
+
useBetaGamer: () => useBetaGamer,
|
|
35
|
+
useGameState: () => useGameState,
|
|
36
|
+
useSession: () => useSession,
|
|
37
|
+
useSocket: () => useSocket,
|
|
38
|
+
useTheme: () => useTheme
|
|
39
|
+
});
|
|
40
|
+
module.exports = __toCommonJS(index_exports);
|
|
41
|
+
|
|
42
|
+
// src/context/BetaGamerProvider.tsx
|
|
43
|
+
var import_react = require("react");
|
|
44
|
+
var import_socket = require("socket.io-client");
|
|
45
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
46
|
+
function decodeToken(token) {
|
|
47
|
+
const payload = token.split(".")[1];
|
|
48
|
+
return JSON.parse(atob(payload.replace(/-/g, "+").replace(/_/g, "/")));
|
|
49
|
+
}
|
|
50
|
+
var BetaGamerContext = (0, import_react.createContext)(null);
|
|
51
|
+
function BetaGamerProvider({ token, serverUrl = "https://api.beta-gamer.com", children }) {
|
|
52
|
+
const session = decodeToken(token);
|
|
53
|
+
const socketRef = (0, import_react.useRef)(null);
|
|
54
|
+
const [gameState, setGameState] = (0, import_react.useState)({
|
|
55
|
+
status: "pending",
|
|
56
|
+
players: session.players
|
|
57
|
+
});
|
|
58
|
+
(0, import_react.useEffect)(() => {
|
|
59
|
+
const socket = (0, import_socket.io)(`${serverUrl}/${session.game}`, {
|
|
60
|
+
auth: { token },
|
|
61
|
+
transports: ["websocket"]
|
|
62
|
+
});
|
|
63
|
+
socketRef.current = socket;
|
|
64
|
+
socket.on("game:state", (state) => {
|
|
65
|
+
setGameState((prev) => ({ ...prev, ...state }));
|
|
66
|
+
});
|
|
67
|
+
socket.on("game:ended", ({ winner, reason }) => {
|
|
68
|
+
setGameState((prev) => ({ ...prev, status: "ended", winner, reason }));
|
|
69
|
+
});
|
|
70
|
+
return () => {
|
|
71
|
+
socket.disconnect();
|
|
72
|
+
};
|
|
73
|
+
}, [token, serverUrl, session.game]);
|
|
74
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BetaGamerContext.Provider, { value: { token, session, socket: socketRef.current, gameState, theme: session.theme ?? {} }, children });
|
|
75
|
+
}
|
|
76
|
+
function useBetaGamer() {
|
|
77
|
+
const ctx = (0, import_react.useContext)(BetaGamerContext);
|
|
78
|
+
if (!ctx) throw new Error("useBetaGamer must be used inside <BetaGamerProvider>");
|
|
79
|
+
return ctx;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// src/hooks/index.ts
|
|
83
|
+
function useGameState() {
|
|
84
|
+
return useBetaGamer().gameState;
|
|
85
|
+
}
|
|
86
|
+
function useSession() {
|
|
87
|
+
return useBetaGamer().session;
|
|
88
|
+
}
|
|
89
|
+
function useSocket() {
|
|
90
|
+
return useBetaGamer().socket;
|
|
91
|
+
}
|
|
92
|
+
function useTheme() {
|
|
93
|
+
return useBetaGamer().theme;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// src/components/PlayerCard.tsx
|
|
97
|
+
var import_react_native = require("react-native");
|
|
98
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
99
|
+
function PlayerCard({ player, style, nameStyle, indicatorStyle }) {
|
|
100
|
+
const { players } = useSession();
|
|
101
|
+
const { currentTurn } = useGameState();
|
|
102
|
+
const p = player === "self" ? players[0] : players[1];
|
|
103
|
+
if (!p) return null;
|
|
104
|
+
const isActive = currentTurn === p.id;
|
|
105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_native.View, { style, accessibilityRole: "text", children: [
|
|
106
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native.Text, { style: nameStyle, children: p.displayName }),
|
|
107
|
+
isActive && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native.View, { style: indicatorStyle, accessibilityLabel: "Active turn" })
|
|
108
|
+
] });
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// src/components/Timer.tsx
|
|
112
|
+
var import_react2 = require("react");
|
|
113
|
+
var import_react_native2 = require("react-native");
|
|
114
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
115
|
+
function Timer({ player, initialSeconds = 600, style, textStyle }) {
|
|
116
|
+
const socket = useSocket();
|
|
117
|
+
const { status } = useGameState();
|
|
118
|
+
const [seconds, setSeconds] = (0, import_react2.useState)(initialSeconds);
|
|
119
|
+
(0, import_react2.useEffect)(() => {
|
|
120
|
+
if (!socket) return;
|
|
121
|
+
const handler = (clocks) => {
|
|
122
|
+
if (clocks[player] !== void 0) setSeconds(clocks[player]);
|
|
123
|
+
};
|
|
124
|
+
socket.on("game:clock", handler);
|
|
125
|
+
return () => {
|
|
126
|
+
socket.off("game:clock", handler);
|
|
127
|
+
};
|
|
128
|
+
}, [socket, player]);
|
|
129
|
+
(0, import_react2.useEffect)(() => {
|
|
130
|
+
if (status !== "active") return;
|
|
131
|
+
const id = setInterval(() => setSeconds((s2) => Math.max(0, s2 - 1)), 1e3);
|
|
132
|
+
return () => clearInterval(id);
|
|
133
|
+
}, [status]);
|
|
134
|
+
const m = Math.floor(seconds / 60).toString().padStart(2, "0");
|
|
135
|
+
const s = (seconds % 60).toString().padStart(2, "0");
|
|
136
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native2.View, { style, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native2.Text, { style: textStyle, children: [
|
|
137
|
+
m,
|
|
138
|
+
":",
|
|
139
|
+
s
|
|
140
|
+
] }) });
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// src/components/GameWebView.tsx
|
|
144
|
+
var import_react3 = require("react");
|
|
145
|
+
var import_react_native_webview = require("react-native-webview");
|
|
146
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
147
|
+
var BASE_URL = "https://api.beta-gamer.com";
|
|
148
|
+
function GameWebView({ game, style }) {
|
|
149
|
+
const { token, session } = useBetaGamer();
|
|
150
|
+
const webViewRef = (0, import_react3.useRef)(null);
|
|
151
|
+
if (session.game !== game) return null;
|
|
152
|
+
const initScript = `
|
|
153
|
+
window.__BG_TOKEN__ = ${JSON.stringify(token)};
|
|
154
|
+
window.dispatchEvent(new Event('bg:ready'));
|
|
155
|
+
true;
|
|
156
|
+
`;
|
|
157
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
158
|
+
import_react_native_webview.WebView,
|
|
159
|
+
{
|
|
160
|
+
ref: webViewRef,
|
|
161
|
+
source: { uri: `${BASE_URL}/embed/${game}` },
|
|
162
|
+
injectedJavaScriptBeforeContentLoaded: initScript,
|
|
163
|
+
style: [{ flex: 1 }, style],
|
|
164
|
+
allowsInlineMediaPlayback: true,
|
|
165
|
+
mediaPlaybackRequiresUserAction: false
|
|
166
|
+
}
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// src/components/chess/ChessBoard.tsx
|
|
171
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
172
|
+
function ChessBoard({ style }) {
|
|
173
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(GameWebView, { game: "chess", style });
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// src/components/chess/ChessMoveHistory.tsx
|
|
177
|
+
var import_react4 = require("react");
|
|
178
|
+
var import_react_native3 = require("react-native");
|
|
179
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
180
|
+
function ChessMoveHistory({ style, rowStyle, textStyle }) {
|
|
181
|
+
const socket = useSocket();
|
|
182
|
+
const [moves, setMoves] = (0, import_react4.useState)([]);
|
|
183
|
+
(0, import_react4.useEffect)(() => {
|
|
184
|
+
if (!socket) return;
|
|
185
|
+
const handler = ({ san, moveIndex }) => {
|
|
186
|
+
const moveNumber = Math.floor(moveIndex / 2) + 1;
|
|
187
|
+
const isWhite = moveIndex % 2 === 0;
|
|
188
|
+
setMoves((prev) => {
|
|
189
|
+
const next = [...prev];
|
|
190
|
+
if (isWhite) {
|
|
191
|
+
next.push({ moveNumber, white: san });
|
|
192
|
+
} else {
|
|
193
|
+
const last = next[next.length - 1];
|
|
194
|
+
if (last?.moveNumber === moveNumber) last.black = san;
|
|
195
|
+
}
|
|
196
|
+
return next;
|
|
197
|
+
});
|
|
198
|
+
};
|
|
199
|
+
socket.on("chess:move", handler);
|
|
200
|
+
return () => {
|
|
201
|
+
socket.off("chess:move", handler);
|
|
202
|
+
};
|
|
203
|
+
}, [socket]);
|
|
204
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native3.ScrollView, { style, children: moves.map(({ moveNumber, white, black }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native3.View, { style: rowStyle, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react_native3.Text, { style: textStyle, children: [
|
|
205
|
+
moveNumber,
|
|
206
|
+
". ",
|
|
207
|
+
white,
|
|
208
|
+
black ? ` ${black}` : ""
|
|
209
|
+
] }) }, moveNumber)) });
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// src/components/checkers/index.tsx
|
|
213
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
214
|
+
function CheckersBoard({ style }) {
|
|
215
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(GameWebView, { game: "checkers", style });
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// src/components/connect4/index.tsx
|
|
219
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
220
|
+
function Connect4Board({ style }) {
|
|
221
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(GameWebView, { game: "connect4", style });
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// src/components/tictactoe/index.tsx
|
|
225
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
226
|
+
function TictactoeBoard({ style }) {
|
|
227
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(GameWebView, { game: "tictactoe", style });
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// src/components/subway-runner/index.tsx
|
|
231
|
+
var import_react5 = require("react");
|
|
232
|
+
var import_react_native4 = require("react-native");
|
|
233
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
234
|
+
function SubwayRunnerGame({ style }) {
|
|
235
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(GameWebView, { game: "subway-runner", style });
|
|
236
|
+
}
|
|
237
|
+
function SubwayRunnerScore({ style, textStyle }) {
|
|
238
|
+
const socket = useSocket();
|
|
239
|
+
const [score, setScore] = (0, import_react5.useState)(0);
|
|
240
|
+
(0, import_react5.useEffect)(() => {
|
|
241
|
+
if (!socket) return;
|
|
242
|
+
socket.on("runner:score", (s) => setScore(s));
|
|
243
|
+
return () => {
|
|
244
|
+
socket.off("runner:score");
|
|
245
|
+
};
|
|
246
|
+
}, [socket]);
|
|
247
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native4.View, { style, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native4.Text, { style: textStyle, children: score }) });
|
|
248
|
+
}
|
|
249
|
+
function SubwayRunnerLives({ style, lifeStyle }) {
|
|
250
|
+
const socket = useSocket();
|
|
251
|
+
const [lives, setLives] = (0, import_react5.useState)(3);
|
|
252
|
+
(0, import_react5.useEffect)(() => {
|
|
253
|
+
if (!socket) return;
|
|
254
|
+
socket.on("runner:lives", (l) => setLives(l));
|
|
255
|
+
return () => {
|
|
256
|
+
socket.off("runner:lives");
|
|
257
|
+
};
|
|
258
|
+
}, [socket]);
|
|
259
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native4.View, { style: [{ flexDirection: "row" }, style], children: Array.from({ length: lives }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native4.View, { style: lifeStyle, accessibilityLabel: "life" }, i)) });
|
|
260
|
+
}
|
|
261
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
262
|
+
0 && (module.exports = {
|
|
263
|
+
BetaGamerProvider,
|
|
264
|
+
CheckersBoard,
|
|
265
|
+
ChessBoard,
|
|
266
|
+
ChessMoveHistory,
|
|
267
|
+
Connect4Board,
|
|
268
|
+
PlayerCard,
|
|
269
|
+
SubwayRunnerGame,
|
|
270
|
+
SubwayRunnerLives,
|
|
271
|
+
SubwayRunnerScore,
|
|
272
|
+
TictactoeBoard,
|
|
273
|
+
Timer,
|
|
274
|
+
useBetaGamer,
|
|
275
|
+
useGameState,
|
|
276
|
+
useSession,
|
|
277
|
+
useSocket,
|
|
278
|
+
useTheme
|
|
279
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@beta-gamer/react-native",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "React Native SDK for Beta Gamer GaaS — composable game components",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"files": ["dist"],
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsup src/index.ts --format cjs --dts --external react --external react-native --external react-native-webview",
|
|
10
|
+
"dev": "tsup src/index.ts --format cjs --dts --external react --external react-native --external react-native-webview --watch"
|
|
11
|
+
},
|
|
12
|
+
"peerDependencies": {
|
|
13
|
+
"react": ">=18",
|
|
14
|
+
"react-native": ">=0.73",
|
|
15
|
+
"react-native-webview": ">=13"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"socket.io-client": "^4.8.1"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@types/react": "^19",
|
|
22
|
+
"@types/react-native": "^0.73.0",
|
|
23
|
+
"tsup": "^8.0.0",
|
|
24
|
+
"typescript": "^5"
|
|
25
|
+
},
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "https://github.com/acetennyson/beta-gamer"
|
|
29
|
+
},
|
|
30
|
+
"license": "MIT"
|
|
31
|
+
}
|