All files / web/src/lib/arcade/game-sdk index.ts

0% Statements 0/95
0% Branches 0/1
0% Functions 0/1
0% Lines 0/95

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96                                                                                                                                                                                               
/**
 * Arcade Game SDK - Stable API Surface
 *
 * This is the ONLY module that games are allowed to import from.
 * All game code must use this SDK - no direct imports from /src/
 *
 * @example
 * ```typescript
 * import {
 *   defineGame,
 *   useArcadeSession,
 *   useRoomData,
 *   type GameDefinition
 * } from '@/lib/arcade/game-sdk'
 * ```
 */

// ============================================================================
// Core Types
// ============================================================================
export type {
  GameDefinition,
  GameProviderComponent,
  GameComponent,
  GameValidator,
  GameConfig,
  GameState,
  GameMove,
  PracticeBreakOptions,
  ValidationContext,
  ValidationResult,
  TeamMoveSentinel,
} from './types'

export { TEAM_MOVE } from './types'

export type { GameManifest, PracticeBreakConfig } from '../manifest-schema'

// ============================================================================
// React Hooks (Controlled API)
// ============================================================================

/**
 * Arcade session management hook
 * Handles state synchronization, move validation, and multiplayer sync
 */
export { useArcadeSession } from '@/hooks/useArcadeSession'

/**
 * Room data hook - access current room information
 */
export { useRoomData, useUpdateGameConfig } from '@/hooks/useRoomData'

/**
 * Game mode context - access players and game mode
 */
export { useGameMode } from '@/contexts/GameModeContext'

/**
 * User ID hook - get current user's stable database user.id
 */
export { useUserId } from '@/hooks/useUserId'

// ============================================================================
// Utilities
// ============================================================================

/**
 * Player ownership and metadata utilities
 */
export {
  buildPlayerMetadata,
  buildPlayerOwnershipFromRoomData,
} from '@/lib/arcade/player-ownership.client'

/**
 * Game definition helper
 */
export { defineGame } from './define-game'

/**
 * Standard color themes for game cards
 * Use these to ensure consistent appearance across all games
 */
export { getGameTheme, GAME_THEMES } from '../game-themes'
export type { GameTheme, GameThemeName } from '../game-themes'

// ============================================================================
// Re-exports for convenience
// ============================================================================

/**
 * Common types from contexts
 */
export type { Player } from '@/contexts/GameModeContext'