boardgame-core/src/index.ts

214 lines
4.5 KiB
TypeScript
Raw Normal View History

/**
* boardgame-core
* Preact Signals
*/
// Rules engine
export type {
Rule,
RuleContext,
RuleResult,
ValidationRule,
EffectRule,
TriggerRule,
RuleLogEntry,
} from './rules/Rule';
export {
isValidationRule,
isEffectRule,
isTriggerRule,
createValidationRule,
createEffectRule,
createTriggerRule,
} from './rules/Rule';
export { RuleEngine, createRuleEngine } from './rules/RuleEngine';
export type { RuleEngineOptions, RuleEngineExecutionResult } from './rules/RuleEngine';
export { RuleRegistry, createRuleRegistry } from './rules/RuleRegistry';
export type { RuleGroup } from './rules/RuleRegistry';
// Tic Tac Toe game
export type {
Player,
CellState,
TicTacToeMetadata,
MoveRecord,
WinningLine,
TicTacToeBoardConfig,
} from './games/tictactoe/TicTacToeState';
export {
DEFAULT_BOARD_CONFIG,
getCellId,
parseCellId,
isValidCellId,
getAllCellIds,
getWinningCombinations,
} from './games/tictactoe/TicTacToeState';
export {
validateTurnRule,
validateCellEmptyRule,
validateGameNotEndedRule,
switchTurnRule,
recordMoveHistoryRule,
checkWinConditionRule,
checkDrawConditionRule,
ticTacToeRules,
getTicTacToeValidationRules,
getTicTacToeEffectRules,
getTicTacToeTriggerRules,
createTicTacToeGame,
} from './games/tictactoe';
export {
startGameCommand,
markCellCommand,
resetGameCommand,
setPlayersCommand,
getCellCommand,
ticTacToeCommands,
createMarkCellCommand,
createSetPlayersCommand,
} from './games/tictactoe';
// Core types
export { PartType } from './core/Part';
export type {
Part,
PartBase,
MeeplePart,
CardPart,
TilePart,
PartSignal,
} from './core/Part';
export { RegionType } from './core/Region';
export type { Region, RegionProperties, Slot } from './core/Region';
export type { Placement, PlacementProperties, Position, PlacementSignal } from './core/Placement';
export type { GameStateData } from './core/GameState';
// Core classes and functions
export {
createPart,
createMeeple,
createCard,
createTile,
} from './core/Part';
export { createRegion, createRegion as createRegionCore } from './core/Region';
export type { Region as RegionClass } from './core/Region';
export { createPlacement } from './core/Placement';
export { GameState, createGameState } from './core/GameState';
// Part actions
export {
createPartAction,
createMeepleAction,
createCardAction,
createTileAction,
updatePartAction,
removePartAction,
getPartAction,
} from './actions/part.actions';
// Region actions
export {
createRegionAction,
getRegionAction,
removeRegionAction,
addPlacementToRegionAction,
removePlacementFromRegionAction,
setSlotAction,
getSlotAction,
clearRegionAction,
getRegionPlacementCountAction,
isRegionEmptyAction,
isRegionFullAction,
} from './actions/region.actions';
// Placement actions
export {
createPlacementAction,
getPlacementAction,
removePlacementAction,
movePlacementAction,
updatePlacementPositionAction,
updatePlacementRotationAction,
flipPlacementAction,
updatePlacementPartAction,
swapPlacementsAction,
setPlacementFaceAction,
getPlacementsInRegionAction,
getPlacementsOfPartAction,
} from './actions/placement.actions';
// Commands
export {
CommandActionType,
type Command,
type CommandStep,
type CommandExecutionResult,
type CommandLogEntry,
type StepResult,
type CommandStatus,
type QueuedCommand,
} from './commands/Command';
export { CommandExecutor } from './commands/CommandExecutor';
export { CommandLog, createCommandLog } from './commands/CommandLog';
export {
setupGameCommand,
placeMeepleCommand,
moveMeepleCommand,
drawCardCommand,
playCardCommand,
placeTileCommand,
flipTileCommand,
swapPlacementsCommand,
setPhaseCommand,
clearRegionCommand,
defaultCommands,
getDefaultCommand,
} from './commands/default.commands';
// CLI Commands
export {
type CliCommand,
type CliCommandArgs,
type CliCommandResult,
type CliCommandStep,
type ParsedCliCommand,
} from './commands/CliCommand';
export { CommandParser, createCommandParser, CommandParseError } from './commands/CommandParser';
export { CommandRegistry, createCommandRegistry } from './commands/CommandRegistry';
export {
moveCommand,
placeCommand,
flipCommand,
createCommand,
regionCommand,
drawCommand,
shuffleCommand,
discardCommand,
swapCommand,
rotateCommand,
positionCommand,
phaseCommand,
clearCommand,
removeCommand,
helpCommand,
cliCommands,
} from './commands/cli.commands';