@series-inc/rundot-game-sdk 5.0.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.
@@ -0,0 +1,19 @@
1
+ /* raw-loader:/home/cooper/venus-sdk/packages/api/src/vite/sandboxToolbarStyle.css */
2
+ input[style*="background: rgba(0, 0, 0, 0.2)"],
3
+ select[style*="background: rgba(0, 0, 0, 0.2)"] {
4
+ box-sizing: border-box;
5
+ }
6
+ input[style*="background: rgba(0, 0, 0, 0.2)"]:focus,
7
+ select[style*="background: rgba(0, 0, 0, 0.2)"]:focus {
8
+ outline: none;
9
+ border-color: rgba(59, 130, 246, 0.5) !important;
10
+ box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
11
+ }
12
+ button[style*="background: #3B82F6"]:hover {
13
+ background: #2563EB !important;
14
+ }
15
+ button[style*="background: #3B82F6"]:disabled {
16
+ opacity: 0.5;
17
+ cursor: not-allowed;
18
+ }
19
+ /*# sourceMappingURL=index.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["raw-loader:/home/cooper/venus-sdk/packages/api/src/vite/sandboxToolbarStyle.css"],"sourcesContent":["/* Minimal CSS - FAB uses inline styles only for guaranteed floating behavior */\n\n/* Optional: Override input styling for modal if needed */\ninput[style*=\"background: rgba(0, 0, 0, 0.2)\"],\nselect[style*=\"background: rgba(0, 0, 0, 0.2)\"] {\n box-sizing: border-box;\n}\n\ninput[style*=\"background: rgba(0, 0, 0, 0.2)\"]:focus,\nselect[style*=\"background: rgba(0, 0, 0, 0.2)\"]:focus {\n outline: none;\n border-color: rgba(59, 130, 246, 0.5) !important;\n box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);\n}\n\nbutton[style*=\"background: #3B82F6\"]:hover {\n background: #2563EB !important;\n}\n\nbutton[style*=\"background: #3B82F6\"]:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n"],"mappings":";AAGA,KAAK,CAAC;AACN,MAAM,CAAC;AACL,cAAY;AACd;AAEA,KAAK,CAAC,wCAAwC;AAC9C,MAAM,CAAC,wCAAwC;AAC7C,WAAS;AACT,gBAAc,KAAK,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE;AACjC,cAAY,EAAE,EAAE,EAAE,IAAI,KAAK,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE;AAC3C;AAEA,MAAM,CAAC,6BAA6B;AAClC,cAAY;AACd;AAEA,MAAM,CAAC,6BAA6B;AAClC,WAAS;AACT,UAAQ;AACV;","names":[]}
@@ -0,0 +1,159 @@
1
+ import { Plugin, ResolvedConfig } from 'vite';
2
+
3
+ interface RundotGameLibrariesPluginOptions {
4
+ /**
5
+ * Your app name (used for CDN asset serving in dev mode)
6
+ * Optional - only needed if you have game assets in cdn/ folder
7
+ * Example: 'block-breakers', 'fortunes-22'
8
+ */
9
+ appName?: string;
10
+ /**
11
+ * Path to local cdn/ folder (relative to vite.config.ts)
12
+ * Defaults to './cdn'
13
+ */
14
+ cdnDir?: string;
15
+ /**
16
+ * Enable debug logging
17
+ * Defaults to false
18
+ */
19
+ debug?: boolean;
20
+ }
21
+ /**
22
+ * Vite plugin for RUN.game embedded libraries system.
23
+ *
24
+ * This plugin externalizes supported libraries (Phaser, React, Three.js, etc.)
25
+ * and loads them from the RUN.game host on mobile or CDN on web.
26
+ *
27
+ * By default, libraries are embedded for optimal bundle size.
28
+ * Set RUN.game_DISABLE_EMBEDDED_LIBS=true to bundle libraries for standalone export.
29
+ *
30
+ * @example
31
+ * ```typescript
32
+ * // vite.config.ts
33
+ * import { rundotGameLibrariesPlugin } from '@series-inc/rundot-game-sdk/vite';
34
+ *
35
+ * export default defineConfig({
36
+ * plugins: [
37
+ * rundotGameLibrariesPlugin({
38
+ * appName: 'my-game',
39
+ * cdnDir: './cdn',
40
+ * }),
41
+ * ],
42
+ * });
43
+ * ```
44
+ *
45
+ * Default build: npm run build (embedded libraries)
46
+ * Standalone export: RUN.game_DISABLE_EMBEDDED_LIBS=true npm run build
47
+ */
48
+ declare function rundotGameLibrariesPlugin(options?: RundotGameLibrariesPluginOptions): Plugin;
49
+
50
+ declare function cdnPlugin(): {
51
+ name: string;
52
+ apply: string;
53
+ configResolved(resolvedConfig: ResolvedConfig): void;
54
+ closeBundle(): void;
55
+ };
56
+
57
+ /**
58
+ * Sandbox configuration helpers.
59
+ *
60
+ * Sandbox mode enables H5 apps to run in browser (via Vite) while communicating
61
+ * with the real Firebase backend.
62
+ *
63
+ * Authentication flow:
64
+ * 1. Vite plugin reads game.config.json and CLI config for environment
65
+ * 2. Firebase config is injected into page via window.__RUNDOT_GAME_SANDBOX__
66
+ * 3. User signs in with Google once (persisted in IndexedDB)
67
+ * 4. All API calls use Firebase Auth session automatically
68
+ */
69
+ type SandboxTarget = 'local' | 'dev' | 'staging';
70
+ /**
71
+ * Firebase configuration for a specific environment.
72
+ */
73
+ interface SandboxFirebaseConfig {
74
+ apiKey: string;
75
+ authDomain: string;
76
+ projectId: string;
77
+ appId?: string;
78
+ storageBucket?: string;
79
+ messagingSenderId?: string;
80
+ measurementId?: string;
81
+ }
82
+ /**
83
+ * Configuration injected by the Vite dev server for sandbox mode.
84
+ */
85
+ interface SandboxConfig {
86
+ /** Whether sandbox mode is enabled */
87
+ enabled: boolean;
88
+ /** Target environment: local (emulator), dev, or staging */
89
+ target: SandboxTarget;
90
+ /** Game/App ID from game.config.json */
91
+ gameId: string;
92
+ /** Firebase configuration for the target environment */
93
+ firebaseConfig?: SandboxFirebaseConfig;
94
+ /** Cloud Functions region */
95
+ functionsRegion?: string;
96
+ /**
97
+ * Base URL for backend RPC calls.
98
+ * For local: http://localhost:5001/{projectId}/{region}
99
+ * For dev/staging: Cloud Run proxy URL from CLI config
100
+ */
101
+ backendUrl?: string;
102
+ /** Emulator hosts for local development */
103
+ functionsEmulatorHost?: string;
104
+ firestoreEmulatorHost?: string;
105
+ authEmulatorHost?: string;
106
+ /** RPC configuration */
107
+ pollingInterval?: number;
108
+ rpcMaxRetries?: number;
109
+ rpcRetryDelayMs?: number;
110
+ }
111
+ /**
112
+ * Global interface for sandbox config injected by Vite
113
+ */
114
+ declare global {
115
+ interface Window {
116
+ __RUNDOT_GAME_SANDBOX__?: SandboxConfig;
117
+ __RUNDOT_GAME_SANDBOX_SIGN_IN__?: () => Promise<void>;
118
+ __RUNDOT_GAME_SANDBOX_SIGN_OUT__?: () => Promise<void>;
119
+ __RUNDOT_GAME_SANDBOX_SIGN_IN_AS__?: (playerId: string) => Promise<void>;
120
+ }
121
+ }
122
+
123
+ /**
124
+ * Vite plugin for RUN.game sandbox mode.
125
+ *
126
+ * This plugin enables H5 apps to communicate with the real Firebase backend
127
+ * during local development. It:
128
+ * 1. Reads game.config.json for gameId
129
+ * 2. Reads ~/.rundot-game/config.json for target environment
130
+ * 3. Injects Firebase config and toolbar into the page
131
+ *
132
+ * Authentication is handled by the browser via Google sign-in (one-time,
133
+ * persisted in IndexedDB).
134
+ *
135
+ * Usage:
136
+ * ```typescript
137
+ * // vite.config.ts
138
+ * import { defineConfig } from 'vite'
139
+ * import { rundotGameSandboxPlugin } from '@series-inc/rundot-game-sdk/vite'
140
+ *
141
+ * export default defineConfig({
142
+ * plugins: [
143
+ * rundotGameSandboxPlugin(),
144
+ * ],
145
+ * })
146
+ * ```
147
+ */
148
+
149
+ interface RundotGameSandboxPluginOptions {
150
+ /** Override the target environment (default: 'staging', or reads from ~/.rundot-game/config.json) */
151
+ target?: SandboxTarget;
152
+ /** Game/App ID - required if game.config.json doesn't exist */
153
+ gameId?: string;
154
+ /** Disable sandbox even if configured */
155
+ disabled?: boolean;
156
+ }
157
+ declare function rundotGameSandboxPlugin(options?: RundotGameSandboxPluginOptions): Plugin;
158
+
159
+ export { type RundotGameLibrariesPluginOptions, type RundotGameSandboxPluginOptions, cdnPlugin, rundotGameLibrariesPlugin, rundotGameSandboxPlugin };