// 五子棋外部入口控制,负责从工具栏或邀请消息打开棋盘。 /** * 读取五子棋面板 Alpine 状态。 * * @returns {Record|null} */ function getGomokuPanelState() { const panel = document.getElementById("gomoku-panel"); if (!panel || typeof window.Alpine?.$data !== "function") { return null; } return window.Alpine.$data(panel); } /** * 从外部打开五子棋面板。 * * @returns {void} */ export function openGomokuPanel() { getGomokuPanelState()?.open(); } /** * 接受 PvP 邀请并打开棋盘。 * * @param {number|string} gameId 对局 ID * @returns {void} */ export function acceptGomokuInvite(gameId) { getGomokuPanelState()?.openAndJoin(gameId); } /** * 挂载五子棋全局入口,兼容广播监听和存量 Blade 调用。 * * @returns {void} */ export function bindGomokuControls() { if (typeof window === "undefined") { return; } window.openGomokuPanel = openGomokuPanel; window.acceptGomokuInvite = acceptGomokuInvite; }