@gamepark/react-client 6.38.5 → 7.0.0-beta.2

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.
Files changed (317) hide show
  1. package/dist/Actions/ActionFailed.d.ts +6 -6
  2. package/dist/Actions/ActionFailed.js +4 -8
  3. package/dist/Actions/ActionFailed.js.map +1 -1
  4. package/dist/Actions/AnimationComplete.d.ts +6 -6
  5. package/dist/Actions/AnimationComplete.js +4 -8
  6. package/dist/Actions/AnimationComplete.js.map +1 -1
  7. package/dist/Actions/AnimationPaused.d.ts +6 -6
  8. package/dist/Actions/AnimationPaused.js +4 -8
  9. package/dist/Actions/AnimationPaused.js.map +1 -1
  10. package/dist/Actions/AnimationStart.d.ts +5 -5
  11. package/dist/Actions/AnimationStart.js +1 -4
  12. package/dist/Actions/AnimationStart.js.map +1 -1
  13. package/dist/Actions/ClearFailures.d.ts +1 -5
  14. package/dist/Actions/ClearFailures.js +3 -9
  15. package/dist/Actions/ClearFailures.js.map +1 -1
  16. package/dist/Actions/GameNotificationsReceived.d.ts +8 -10
  17. package/dist/Actions/GameNotificationsReceived.js +2 -9
  18. package/dist/Actions/GameNotificationsReceived.js.map +1 -1
  19. package/dist/Actions/GameOver.d.ts +16 -16
  20. package/dist/Actions/GameOver.js +4 -8
  21. package/dist/Actions/GameOver.js.map +1 -1
  22. package/dist/Actions/GameStateLoaded.d.ts +16 -16
  23. package/dist/Actions/GameStateLoaded.js +7 -20
  24. package/dist/Actions/GameStateLoaded.js.map +1 -1
  25. package/dist/Actions/MovePlayed.d.ts +11 -11
  26. package/dist/Actions/MovePlayed.js +3 -2
  27. package/dist/Actions/MovePlayed.js.map +1 -1
  28. package/dist/Actions/MoveUndone.d.ts +7 -7
  29. package/dist/Actions/MoveUndone.js +4 -9
  30. package/dist/Actions/MoveUndone.js.map +1 -1
  31. package/dist/Actions/PlayerQuit.d.ts +5 -11
  32. package/dist/Actions/PlayerQuit.js +2 -19
  33. package/dist/Actions/PlayerQuit.js.map +1 -1
  34. package/dist/Actions/SetAnimationsSpeed.d.ts +1 -6
  35. package/dist/Actions/SetAnimationsSpeed.js +3 -9
  36. package/dist/Actions/SetAnimationsSpeed.js.map +1 -1
  37. package/dist/Actions/giveUp.d.ts +1 -0
  38. package/dist/Actions/giveUp.js +3 -0
  39. package/dist/Actions/giveUp.js.map +1 -0
  40. package/dist/Actions/index.d.ts +7 -12
  41. package/dist/Actions/index.js +7 -28
  42. package/dist/Actions/index.js.map +1 -1
  43. package/dist/Actions/loadGameState.d.ts +14 -0
  44. package/dist/Actions/loadGameState.js +3 -0
  45. package/dist/Actions/loadGameState.js.map +1 -0
  46. package/dist/Actions/playMove.d.ts +10 -0
  47. package/dist/Actions/playMove.js +3 -0
  48. package/dist/Actions/playMove.js.map +1 -0
  49. package/dist/Actions/receiveNotifications.d.ts +8 -0
  50. package/dist/Actions/receiveNotifications.js +3 -0
  51. package/dist/Actions/receiveNotifications.js.map +1 -0
  52. package/dist/Actions/removePlayer.d.ts +5 -0
  53. package/dist/Actions/removePlayer.js +3 -0
  54. package/dist/Actions/removePlayer.js.map +1 -0
  55. package/dist/Actions/reportFailure.d.ts +1 -0
  56. package/dist/Actions/reportFailure.js +3 -0
  57. package/dist/Actions/reportFailure.js.map +1 -0
  58. package/dist/Actions/setGameOver.d.ts +2 -0
  59. package/dist/Actions/setGameOver.js +3 -0
  60. package/dist/Actions/setGameOver.js.map +1 -0
  61. package/dist/Actions/startAnimation.d.ts +1 -0
  62. package/dist/Actions/startAnimation.js +3 -0
  63. package/dist/Actions/startAnimation.js.map +1 -0
  64. package/dist/Actions/undoMove.d.ts +5 -0
  65. package/dist/Actions/undoMove.js +4 -0
  66. package/dist/Actions/undoMove.js.map +1 -0
  67. package/dist/Chat/ChatChannel.d.ts +5 -5
  68. package/dist/Chat/ChatChannel.js +1 -2
  69. package/dist/Chat/Message.d.ts +6 -6
  70. package/dist/Chat/Message.js +1 -2
  71. package/dist/Chat/index.d.ts +2 -2
  72. package/dist/Chat/index.js +2 -18
  73. package/dist/Chat/index.js.map +1 -1
  74. package/dist/Deckbuilding/Deck.d.ts +5 -5
  75. package/dist/Deckbuilding/Deck.js +1 -2
  76. package/dist/Deckbuilding/index.d.ts +4 -4
  77. package/dist/Deckbuilding/index.js +4 -24
  78. package/dist/Deckbuilding/index.js.map +1 -1
  79. package/dist/Deckbuilding/useDeleteDeck.d.ts +5 -2
  80. package/dist/Deckbuilding/useDeleteDeck.js +9 -15
  81. package/dist/Deckbuilding/useDeleteDeck.js.map +1 -1
  82. package/dist/Deckbuilding/useMyDecks.d.ts +3 -2
  83. package/dist/Deckbuilding/useMyDecks.js +8 -14
  84. package/dist/Deckbuilding/useMyDecks.js.map +1 -1
  85. package/dist/Deckbuilding/useSaveDeck.d.ts +5 -2
  86. package/dist/Deckbuilding/useSaveDeck.js +9 -15
  87. package/dist/Deckbuilding/useSaveDeck.js.map +1 -1
  88. package/dist/EjectPlayer/EjectPlayer.d.ts +1 -6
  89. package/dist/EjectPlayer/EjectPlayer.js +2 -8
  90. package/dist/EjectPlayer/EjectPlayer.js.map +1 -1
  91. package/dist/EjectPlayer/index.d.ts +1 -1
  92. package/dist/EjectPlayer/index.js +1 -17
  93. package/dist/EjectPlayer/index.js.map +1 -1
  94. package/dist/Failure/Failure.d.ts +6 -6
  95. package/dist/Failure/Failure.js +6 -9
  96. package/dist/Failure/Failure.js.map +1 -1
  97. package/dist/Failure/index.d.ts +1 -1
  98. package/dist/Failure/index.js +1 -17
  99. package/dist/Failure/index.js.map +1 -1
  100. package/dist/GiveUp/GiveUp.d.ts +7 -7
  101. package/dist/GiveUp/GiveUp.js +2 -5
  102. package/dist/GiveUp/GiveUp.js.map +1 -1
  103. package/dist/GiveUp/index.d.ts +1 -1
  104. package/dist/GiveUp/index.js +1 -17
  105. package/dist/GiveUp/index.js.map +1 -1
  106. package/dist/Hooks/index.d.ts +5 -5
  107. package/dist/Hooks/index.js +5 -21
  108. package/dist/Hooks/index.js.map +1 -1
  109. package/dist/Hooks/useChatMessages.d.ts +7 -12
  110. package/dist/Hooks/useChatMessages.js +44 -51
  111. package/dist/Hooks/useChatMessages.js.map +1 -1
  112. package/dist/Hooks/useMessageAuthor.d.ts +4 -4
  113. package/dist/Hooks/useMessageAuthor.js +13 -18
  114. package/dist/Hooks/useMessageAuthor.js.map +1 -1
  115. package/dist/Hooks/useOptions.d.ts +2 -2
  116. package/dist/Hooks/useOptions.js +4 -8
  117. package/dist/Hooks/useOptions.js.map +1 -1
  118. package/dist/Hooks/useRematch.d.ts +7 -7
  119. package/dist/Hooks/useRematch.js +18 -19
  120. package/dist/Hooks/useRematch.js.map +1 -1
  121. package/dist/Hooks/useSendMessage.d.ts +4 -1
  122. package/dist/Hooks/useSendMessage.js +6 -14
  123. package/dist/Hooks/useSendMessage.js.map +1 -1
  124. package/dist/Log/StartLiveLog.d.ts +1 -4
  125. package/dist/Log/StartLiveLog.js +3 -5
  126. package/dist/Log/StartLiveLog.js.map +1 -1
  127. package/dist/Log/StopLiveLog.d.ts +2 -5
  128. package/dist/Log/StopLiveLog.js +6 -9
  129. package/dist/Log/StopLiveLog.js.map +1 -1
  130. package/dist/Log/index.d.ts +4 -4
  131. package/dist/Log/index.js +4 -20
  132. package/dist/Log/index.js.map +1 -1
  133. package/dist/Log/useLogControls.d.ts +7 -7
  134. package/dist/Log/useLogControls.js +18 -22
  135. package/dist/Log/useLogControls.js.map +1 -1
  136. package/dist/PlayerTime/PlayerTime.d.ts +11 -11
  137. package/dist/PlayerTime/PlayerTime.js +1 -2
  138. package/dist/PlayerTime/index.d.ts +1 -1
  139. package/dist/PlayerTime/index.js +1 -17
  140. package/dist/PlayerTime/index.js.map +1 -1
  141. package/dist/Rematch/RematchQueries.d.ts +19 -19
  142. package/dist/Rematch/RematchQueries.js +23 -13
  143. package/dist/Rematch/RematchQueries.js.map +1 -1
  144. package/dist/Rematch/index.d.ts +1 -1
  145. package/dist/Rematch/index.js +1 -17
  146. package/dist/Rematch/index.js.map +1 -1
  147. package/dist/Sound/MuteSounds.d.ts +2 -5
  148. package/dist/Sound/MuteSounds.js +7 -10
  149. package/dist/Sound/MuteSounds.js.map +1 -1
  150. package/dist/Sound/UnmuteSounds.d.ts +1 -4
  151. package/dist/Sound/UnmuteSounds.js +3 -5
  152. package/dist/Sound/UnmuteSounds.js.map +1 -1
  153. package/dist/Sound/index.d.ts +3 -3
  154. package/dist/Sound/index.js +3 -19
  155. package/dist/Sound/index.js.map +1 -1
  156. package/dist/Sound/useSoundControls.d.ts +7 -7
  157. package/dist/Sound/useSoundControls.js +18 -22
  158. package/dist/Sound/useSoundControls.js.map +1 -1
  159. package/dist/Store/DisplayedAction.d.ts +15 -15
  160. package/dist/Store/DisplayedAction.js +12 -19
  161. package/dist/Store/DisplayedAction.js.map +1 -1
  162. package/dist/Store/GamePageState.d.ts +27 -28
  163. package/dist/Store/GamePageState.js +1 -2
  164. package/dist/Store/PlayedMove.d.ts +5 -5
  165. package/dist/Store/PlayedMove.js +1 -2
  166. package/dist/Store/endAnimation.d.ts +1 -0
  167. package/dist/Store/endAnimation.js +3 -0
  168. package/dist/Store/endAnimation.js.map +1 -0
  169. package/dist/Store/gameMiddleware.d.ts +4 -4
  170. package/dist/Store/gameMiddleware.js +34 -41
  171. package/dist/Store/gameMiddleware.js.map +1 -1
  172. package/dist/Store/gameReducer.d.ts +14 -20
  173. package/dist/Store/gameReducer.js +462 -525
  174. package/dist/Store/gameReducer.js.map +1 -1
  175. package/dist/Store/index.d.ts +4 -3
  176. package/dist/Store/index.js +4 -19
  177. package/dist/Store/index.js.map +1 -1
  178. package/dist/Store/localMovePreviewMiddleware.d.ts +4 -4
  179. package/dist/Store/localMovePreviewMiddleware.js +19 -18
  180. package/dist/Store/localMovePreviewMiddleware.js.map +1 -1
  181. package/dist/Store/store.d.ts +13 -0
  182. package/dist/Store/store.js +27 -0
  183. package/dist/Store/store.js.map +1 -0
  184. package/dist/Tutorial/PlayTutorialMoves.d.ts +1 -9
  185. package/dist/Tutorial/PlayTutorialMoves.js +2 -6
  186. package/dist/Tutorial/PlayTutorialMoves.js.map +1 -1
  187. package/dist/Tutorial/Tutorial.d.ts +5 -5
  188. package/dist/Tutorial/Tutorial.js +1 -2
  189. package/dist/Tutorial/TutorialDescription.d.ts +7 -7
  190. package/dist/Tutorial/TutorialDescription.js +1 -2
  191. package/dist/Tutorial/index.d.ts +4 -4
  192. package/dist/Tutorial/index.js +4 -20
  193. package/dist/Tutorial/index.js.map +1 -1
  194. package/dist/Tutorial/useTutorial.d.ts +2 -2
  195. package/dist/Tutorial/useTutorial.js +12 -22
  196. package/dist/Tutorial/useTutorial.js.map +1 -1
  197. package/dist/Types/GameAI.d.ts +1 -1
  198. package/dist/Types/GameAI.js +1 -2
  199. package/dist/Types/GameData.d.ts +18 -18
  200. package/dist/Types/GameData.js +1 -2
  201. package/dist/Types/GameMessage.d.ts +8 -8
  202. package/dist/Types/GameMessage.js +1 -2
  203. package/dist/Types/GameMode.d.ts +6 -6
  204. package/dist/Types/GameMode.js +7 -10
  205. package/dist/Types/GameMode.js.map +1 -1
  206. package/dist/Types/GameNotification.d.ts +6 -6
  207. package/dist/Types/GameNotification.js +1 -2
  208. package/dist/Types/GameOptions.d.ts +9 -9
  209. package/dist/Types/GameOptions.js +5 -8
  210. package/dist/Types/GameOptions.js.map +1 -1
  211. package/dist/Types/MovePlayedNotification.d.ts +9 -9
  212. package/dist/Types/MovePlayedNotification.js +6 -12
  213. package/dist/Types/MovePlayedNotification.js.map +1 -1
  214. package/dist/Types/MoveUndoneNotification.d.ts +8 -8
  215. package/dist/Types/MoveUndoneNotification.js +6 -12
  216. package/dist/Types/MoveUndoneNotification.js.map +1 -1
  217. package/dist/Types/Player.d.ts +13 -13
  218. package/dist/Types/Player.js +1 -2
  219. package/dist/Types/PlayerQuitReason.d.ts +4 -4
  220. package/dist/Types/PlayerQuitReason.js +5 -8
  221. package/dist/Types/PlayerQuitReason.js.map +1 -1
  222. package/dist/Types/ProxyGameData.d.ts +13 -13
  223. package/dist/Types/ProxyGameData.js +1 -2
  224. package/dist/Types/Tournament.d.ts +4 -4
  225. package/dist/Types/Tournament.js +1 -2
  226. package/dist/Types/index.d.ts +12 -12
  227. package/dist/Types/index.js +12 -28
  228. package/dist/Types/index.js.map +1 -1
  229. package/dist/User/User.d.ts +6 -6
  230. package/dist/User/User.js +1 -2
  231. package/dist/User/index.d.ts +2 -2
  232. package/dist/User/index.js +2 -18
  233. package/dist/User/index.js.map +1 -1
  234. package/dist/User/useMe.d.ts +4 -4
  235. package/dist/User/useMe.js +10 -21
  236. package/dist/User/useMe.js.map +1 -1
  237. package/dist/animations/Animation.d.ts +6 -6
  238. package/dist/animations/Animation.js +1 -2
  239. package/dist/animations/AnimationContext.d.ts +8 -8
  240. package/dist/animations/AnimationContext.js +1 -2
  241. package/dist/animations/AnimationState.d.ts +6 -6
  242. package/dist/animations/AnimationState.js +1 -2
  243. package/dist/animations/AnimationStep.d.ts +6 -6
  244. package/dist/animations/AnimationStep.js +7 -10
  245. package/dist/animations/AnimationStep.js.map +1 -1
  246. package/dist/animations/Animations.d.ts +8 -8
  247. package/dist/animations/Animations.js +15 -22
  248. package/dist/animations/Animations.js.map +1 -1
  249. package/dist/animations/AnimationsListener.d.ts +6 -0
  250. package/dist/animations/AnimationsListener.js +54 -0
  251. package/dist/animations/AnimationsListener.js.map +1 -0
  252. package/dist/animations/AnimationsListenerCreator.d.ts +2 -4
  253. package/dist/animations/AnimationsListenerCreator.js +40 -50
  254. package/dist/animations/AnimationsListenerCreator.js.map +1 -1
  255. package/dist/animations/animationMiddleware.d.ts +4 -0
  256. package/dist/animations/animationMiddleware.js +50 -0
  257. package/dist/animations/animationMiddleware.js.map +1 -0
  258. package/dist/animations/index.d.ts +5 -6
  259. package/dist/animations/index.js +5 -22
  260. package/dist/animations/index.js.map +1 -1
  261. package/dist/api/Client/GameClientAPI.d.ts +24 -24
  262. package/dist/api/Client/GameClientAPI.js +116 -165
  263. package/dist/api/Client/GameClientAPI.js.map +1 -1
  264. package/dist/api/Client/GameNotificationsListener.d.ts +5 -5
  265. package/dist/api/Client/GameNotificationsListener.js +62 -113
  266. package/dist/api/Client/GameNotificationsListener.js.map +1 -1
  267. package/dist/api/Client/RemoteGameLoader.d.ts +4 -5
  268. package/dist/api/Client/RemoteGameLoader.js +66 -62
  269. package/dist/api/Client/RemoteGameLoader.js.map +1 -1
  270. package/dist/api/Client/RemoteGameProvider.d.ts +7 -7
  271. package/dist/api/Client/RemoteGameProvider.js +19 -70
  272. package/dist/api/Client/RemoteGameProvider.js.map +1 -1
  273. package/dist/api/Client/apollo-client.d.ts +2 -2
  274. package/dist/api/Client/apollo-client.js +40 -58
  275. package/dist/api/Client/apollo-client.js.map +1 -1
  276. package/dist/api/Client/index.d.ts +4 -3
  277. package/dist/api/Client/index.js +4 -19
  278. package/dist/api/Client/index.js.map +1 -1
  279. package/dist/api/Client/pusher.d.ts +2 -0
  280. package/dist/api/Client/pusher.js +9 -0
  281. package/dist/api/Client/pusher.js.map +1 -0
  282. package/dist/api/GameAPI.d.ts +10 -10
  283. package/dist/api/GameAPI.js +1 -2
  284. package/dist/api/Local/ConsoleTools.d.ts +25 -25
  285. package/dist/api/Local/ConsoleTools.js +78 -86
  286. package/dist/api/Local/ConsoleTools.js.map +1 -1
  287. package/dist/api/Local/GameLocalAPI.d.ts +44 -44
  288. package/dist/api/Local/GameLocalAPI.js +442 -540
  289. package/dist/api/Local/GameLocalAPI.js.map +1 -1
  290. package/dist/api/Local/LocalGameProvider.d.ts +15 -15
  291. package/dist/api/Local/LocalGameProvider.js +18 -58
  292. package/dist/api/Local/LocalGameProvider.js.map +1 -1
  293. package/dist/api/Local/index.d.ts +1 -1
  294. package/dist/api/Local/index.js +1 -17
  295. package/dist/api/Local/index.js.map +1 -1
  296. package/dist/api/index.d.ts +2 -2
  297. package/dist/api/index.js +2 -18
  298. package/dist/api/index.js.map +1 -1
  299. package/dist/index.d.ts +16 -18
  300. package/dist/index.js +16 -36
  301. package/dist/index.js.map +1 -1
  302. package/dist/util/ArrayUtil.d.ts +2 -2
  303. package/dist/util/ArrayUtil.js +16 -21
  304. package/dist/util/ArrayUtil.js.map +1 -1
  305. package/package.json +66 -65
  306. package/dist/Actions/ActionType.d.ts +0 -3
  307. package/dist/Actions/ActionType.js +0 -8
  308. package/dist/Actions/ActionType.js.map +0 -1
  309. package/dist/Scoring/ScoringDescription.d.ts +0 -8
  310. package/dist/Scoring/ScoringDescription.js +0 -3
  311. package/dist/Scoring/ScoringDescription.js.map +0 -1
  312. package/dist/Scoring/index.d.ts +0 -1
  313. package/dist/Scoring/index.js +0 -18
  314. package/dist/Scoring/index.js.map +0 -1
  315. package/dist/util/TimeUtil.d.ts +0 -2
  316. package/dist/util/TimeUtil.js +0 -27
  317. package/dist/util/TimeUtil.js.map +0 -1
@@ -1,14 +1,24 @@
1
- "use strict";
2
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
- return cooked;
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.REFUSE_REMATCH = exports.ACCEPT_REMATCH = exports.REMATCH = exports.CAN_REMATCH = void 0;
8
- var client_1 = require("@apollo/client");
9
- exports.CAN_REMATCH = (0, client_1.gql)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n query Game($id: String!) {\n game(id: $id) {\n id canRematch rematch { id startDate players { name userId ready } }\n }\n }\n"], ["\n query Game($id: String!) {\n game(id: $id) {\n id canRematch rematch { id startDate players { name userId ready } }\n }\n }\n"])));
10
- exports.REMATCH = (0, client_1.gql)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n mutation Rematch($gameId: String!) {\n rematch(gameId: $gameId) { id canRematch rematch { id startDate myPlayerId players { id name userId ready } } }\n }\n"], ["\n mutation Rematch($gameId: String!) {\n rematch(gameId: $gameId) { id canRematch rematch { id startDate myPlayerId players { id name userId ready } } }\n }\n"])));
11
- exports.ACCEPT_REMATCH = (0, client_1.gql)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n mutation AcceptRematch($gameId: String!) {\n joinGame(gameId: $gameId) { id myPlayerId players { id ready } }\n }\n"], ["\n mutation AcceptRematch($gameId: String!) {\n joinGame(gameId: $gameId) { id myPlayerId players { id ready } }\n }\n"])));
12
- exports.REFUSE_REMATCH = (0, client_1.gql)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n mutation RefuseRematch($gameId: String!) {\n leaveGameSetup(gameId: $gameId) { id myPlayerId players { id ready } }\n }\n"], ["\n mutation RefuseRematch($gameId: String!) {\n leaveGameSetup(gameId: $gameId) { id myPlayerId players { id ready } }\n }\n"])));
13
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
1
+ import { gql } from '@apollo/client';
2
+ export const CAN_REMATCH = gql `
3
+ query Game($id: String!) {
4
+ game(id: $id) {
5
+ id canRematch rematch { id startDate players { name userId ready } }
6
+ }
7
+ }
8
+ `;
9
+ export const REMATCH = gql `
10
+ mutation Rematch($gameId: String!) {
11
+ rematch(gameId: $gameId) { id canRematch rematch { id startDate myPlayerId players { id name userId ready } } }
12
+ }
13
+ `;
14
+ export const ACCEPT_REMATCH = gql `
15
+ mutation AcceptRematch($gameId: String!) {
16
+ joinGame(gameId: $gameId) { id myPlayerId players { id ready } }
17
+ }
18
+ `;
19
+ export const REFUSE_REMATCH = gql `
20
+ mutation RefuseRematch($gameId: String!) {
21
+ leaveGameSetup(gameId: $gameId) { id myPlayerId players { id ready } }
22
+ }
23
+ `;
14
24
  //# sourceMappingURL=RematchQueries.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RematchQueries.js","sourceRoot":"","sources":["../../src/Rematch/RematchQueries.ts"],"names":[],"mappings":";;;;;;;AAAA,yCAAkC;AAErB,QAAA,WAAW,OAAG,YAAG,mNAAA,+IAM7B,KAAA;AAoBY,QAAA,OAAO,OAAG,YAAG,0OAAA,sKAIzB,KAAA;AAEY,QAAA,cAAc,OAAG,YAAG,iMAAA,6HAIhC,KAAA;AAEY,QAAA,cAAc,OAAG,YAAG,uMAAA,mIAIhC,KAAA"}
1
+ {"version":3,"file":"RematchQueries.js","sourceRoot":"","sources":["../../src/Rematch/RematchQueries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,gBAAgB,CAAA;AAElC,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAA;;;;;;CAM7B,CAAA;AAoBD,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,CAAA;;;;CAIzB,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAA;;;;CAIhC,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAA;;;;CAIhC,CAAA"}
@@ -1 +1 @@
1
- export * from './RematchQueries';
1
+ export * from './RematchQueries';
@@ -1,18 +1,2 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./RematchQueries"), exports);
1
+ export * from './RematchQueries';
18
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Rematch/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAgC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Rematch/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA"}
@@ -1,5 +1,2 @@
1
- export declare const MUTE_SOUNDS = "MUTE_SOUNDS";
2
- export interface MuteSounds {
3
- type: typeof MUTE_SOUNDS;
4
- }
5
- export declare function soundsMuted(): boolean;
1
+ export declare function soundsMuted(): boolean;
2
+ export declare const muteSounds: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"muteSounds">;
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.soundsMuted = exports.MUTE_SOUNDS = void 0;
4
- exports.MUTE_SOUNDS = 'MUTE_SOUNDS';
5
- function soundsMuted() {
6
- var query = new URLSearchParams(window.location.search);
7
- return !!query.get('mute') || !!localStorage.getItem('soundsMuted');
8
- }
9
- exports.soundsMuted = soundsMuted;
10
- //# sourceMappingURL=MuteSounds.js.map
1
+ import { createAction } from '@reduxjs/toolkit';
2
+ export function soundsMuted() {
3
+ const query = new URLSearchParams(window.location.search);
4
+ return !!query.get('mute') || !!localStorage.getItem('soundsMuted');
5
+ }
6
+ export const muteSounds = createAction('muteSounds');
7
+ //# sourceMappingURL=muteSounds.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MuteSounds.js","sourceRoot":"","sources":["../../src/Sound/MuteSounds.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG,aAAa,CAAA;AAMxC,SAAgB,WAAW;IACzB,IAAM,KAAK,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IACzD,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC,CAAA;AACrE,CAAC;AAHD,kCAGC"}
1
+ {"version":3,"file":"muteSounds.js","sourceRoot":"","sources":["../../src/Sound/muteSounds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAE/C,MAAM,UAAU,WAAW;IACzB,MAAM,KAAK,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IACzD,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC,CAAA;AACrE,CAAC;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,YAAY,CAAC,YAAY,CAAC,CAAA"}
@@ -1,4 +1 @@
1
- export declare const UNMUTE_SOUNDS = "UNMUTE_SOUNDS";
2
- export interface UnmuteSounds {
3
- type: typeof UNMUTE_SOUNDS;
4
- }
1
+ export declare const unmuteSounds: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"unmuteSounds">;
@@ -1,5 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UNMUTE_SOUNDS = void 0;
4
- exports.UNMUTE_SOUNDS = 'UNMUTE_SOUNDS';
5
- //# sourceMappingURL=UnmuteSounds.js.map
1
+ import { createAction } from '@reduxjs/toolkit';
2
+ export const unmuteSounds = createAction('unmuteSounds');
3
+ //# sourceMappingURL=unmuteSounds.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UnmuteSounds.js","sourceRoot":"","sources":["../../src/Sound/UnmuteSounds.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG,eAAe,CAAA"}
1
+ {"version":3,"file":"unmuteSounds.js","sourceRoot":"","sources":["../../src/Sound/unmuteSounds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAE/C,MAAM,CAAC,MAAM,YAAY,GAAG,YAAY,CAAC,cAAc,CAAC,CAAA"}
@@ -1,3 +1,3 @@
1
- export * from './MuteSounds';
2
- export * from './UnmuteSounds';
3
- export * from './useSoundControls';
1
+ export * from './muteSounds';
2
+ export * from './unmuteSounds';
3
+ export * from './useSoundControls';
@@ -1,20 +1,4 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./MuteSounds"), exports);
18
- __exportStar(require("./UnmuteSounds"), exports);
19
- __exportStar(require("./useSoundControls"), exports);
1
+ export * from './muteSounds';
2
+ export * from './unmuteSounds';
3
+ export * from './useSoundControls';
20
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Sound/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA4B;AAC5B,iDAA8B;AAC9B,qDAAkC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Sound/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA"}
@@ -1,7 +1,7 @@
1
- type SoundControls = {
2
- mute: () => void;
3
- unmute: () => void;
4
- muted: boolean;
5
- };
6
- export declare function useSoundControls(): SoundControls;
7
- export {};
1
+ type SoundControls = {
2
+ mute: () => void;
3
+ unmute: () => void;
4
+ muted: boolean;
5
+ };
6
+ export declare function useSoundControls(): SoundControls;
7
+ export {};
@@ -1,23 +1,19 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useSoundControls = void 0;
4
- var react_redux_1 = require("react-redux");
5
- var MuteSounds_1 = require("./MuteSounds");
6
- var UnmuteSounds_1 = require("./UnmuteSounds");
7
- function useSoundControls() {
8
- var muted = (0, react_redux_1.useSelector)(function (state) { return state.soundsMuted; });
9
- var dispatch = (0, react_redux_1.useDispatch)();
10
- return {
11
- mute: function () {
12
- dispatch({ type: MuteSounds_1.MUTE_SOUNDS });
13
- localStorage.setItem('soundsMuted', 'true');
14
- },
15
- unmute: function () {
16
- dispatch({ type: UnmuteSounds_1.UNMUTE_SOUNDS });
17
- localStorage.removeItem('soundsMuted');
18
- },
19
- muted: muted
20
- };
21
- }
22
- exports.useSoundControls = useSoundControls;
1
+ import { useGameDispatch, useGameSelector } from '../Store';
2
+ import { muteSounds } from './muteSounds';
3
+ import { unmuteSounds } from './unmuteSounds';
4
+ export function useSoundControls() {
5
+ const muted = useGameSelector(state => state.soundsMuted);
6
+ const dispatch = useGameDispatch();
7
+ return {
8
+ mute: () => {
9
+ dispatch(muteSounds());
10
+ localStorage.setItem('soundsMuted', 'true');
11
+ },
12
+ unmute: () => {
13
+ dispatch(unmuteSounds());
14
+ localStorage.removeItem('soundsMuted');
15
+ },
16
+ muted
17
+ };
18
+ }
23
19
  //# sourceMappingURL=useSoundControls.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSoundControls.js","sourceRoot":"","sources":["../../src/Sound/useSoundControls.ts"],"names":[],"mappings":";;;AAAA,2CAAsD;AAEtD,2CAA0C;AAC1C,+CAA8C;AAQ9C,SAAgB,gBAAgB;IAC9B,IAAM,KAAK,GAAG,IAAA,yBAAW,EAAC,UAAC,KAAoB,IAAK,OAAA,KAAK,CAAC,WAAW,EAAjB,CAAiB,CAAC,CAAA;IACtE,IAAM,QAAQ,GAAG,IAAA,yBAAW,GAAE,CAAA;IAC9B,OAAO;QACL,IAAI,EAAE;YACJ,QAAQ,CAAC,EAAE,IAAI,EAAE,wBAAW,EAAE,CAAC,CAAA;YAC/B,YAAY,CAAC,OAAO,CAAC,aAAa,EAAE,MAAM,CAAC,CAAA;QAC7C,CAAC;QACD,MAAM,EAAE;YACN,QAAQ,CAAC,EAAE,IAAI,EAAE,4BAAa,EAAE,CAAC,CAAA;YACjC,YAAY,CAAC,UAAU,CAAC,aAAa,CAAC,CAAA;QACxC,CAAC;QACD,KAAK,OAAA;KACN,CAAA;AACH,CAAC;AAdD,4CAcC"}
1
+ {"version":3,"file":"useSoundControls.js","sourceRoot":"","sources":["../../src/Sound/useSoundControls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAQ7C,MAAM,UAAU,gBAAgB;IAC9B,MAAM,KAAK,GAAG,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;IACzD,MAAM,QAAQ,GAAG,eAAe,EAAE,CAAA;IAClC,OAAO;QACL,IAAI,EAAE,GAAG,EAAE;YACT,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAA;YACtB,YAAY,CAAC,OAAO,CAAC,aAAa,EAAE,MAAM,CAAC,CAAA;QAC7C,CAAC;QACD,MAAM,EAAE,GAAG,EAAE;YACX,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAA;YACxB,YAAY,CAAC,UAAU,CAAC,aAAa,CAAC,CAAA;QACxC,CAAC;QACD,KAAK;KACN,CAAA;AACH,CAAC"}
@@ -1,15 +1,15 @@
1
- import { Action } from '@gamepark/rules-api';
2
- import { AnimationState, AnimationStep } from '../animations';
3
- export type DisplayedAction<Move = any, PlayerId = any> = Action<Move, PlayerId> & {
4
- played: number;
5
- pending?: boolean;
6
- delayed?: boolean;
7
- animation?: AnimationState;
8
- cancelled?: boolean;
9
- cancelPending?: boolean;
10
- local?: boolean;
11
- activePlayers?: PlayerId[];
12
- transient?: boolean;
13
- };
14
- export declare function isActionToAnimate(action: DisplayedAction): boolean;
15
- export declare function getAnimatedMove<Move>(action: DisplayedAction<Move>, step?: AnimationStep | undefined): Move;
1
+ import { Action } from '@gamepark/rules-api';
2
+ import { AnimationState, AnimationStep } from '../animations';
3
+ export type DisplayedAction<Move = any, PlayerId = any> = Action<Move, PlayerId> & {
4
+ played: number;
5
+ pending?: boolean;
6
+ delayed?: boolean;
7
+ animation?: AnimationState;
8
+ cancelled?: boolean;
9
+ cancelPending?: boolean;
10
+ local?: boolean;
11
+ activePlayers?: PlayerId[];
12
+ transient?: boolean;
13
+ };
14
+ export declare function isActionToAnimate(action: DisplayedAction): boolean;
15
+ export declare function getAnimatedMove<Move>(action: DisplayedAction<Move>, step?: AnimationStep | undefined): Move;
@@ -1,20 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAnimatedMove = exports.isActionToAnimate = void 0;
4
- var animations_1 = require("../animations");
5
- function isActionToAnimate(action) {
6
- if (action.delayed)
7
- return false;
8
- if (action.cancelled)
9
- return action.played > 0;
10
- return action.played <= action.consequences.length;
11
- }
12
- exports.isActionToAnimate = isActionToAnimate;
13
- function getAnimatedMove(action, step) {
14
- var _a;
15
- if (step === void 0) { step = (_a = action.animation) === null || _a === void 0 ? void 0 : _a.step; }
16
- var consequenceIndex = (step === animations_1.AnimationStep.BEFORE_MOVE || step === animations_1.AnimationStep.AFTER_UNDO) ? action.played - 1 : action.played - 2;
17
- return consequenceIndex < 0 ? action.move : action.consequences[consequenceIndex];
18
- }
19
- exports.getAnimatedMove = getAnimatedMove;
1
+ import { AnimationStep } from '../animations';
2
+ export function isActionToAnimate(action) {
3
+ if (action.delayed)
4
+ return false;
5
+ if (action.cancelled)
6
+ return action.played > 0;
7
+ return action.played <= action.consequences.length;
8
+ }
9
+ export function getAnimatedMove(action, step = action.animation?.step) {
10
+ const consequenceIndex = (step === AnimationStep.BEFORE_MOVE || step === AnimationStep.AFTER_UNDO) ? action.played - 1 : action.played - 2;
11
+ return consequenceIndex < 0 ? action.move : action.consequences[consequenceIndex];
12
+ }
20
13
  //# sourceMappingURL=DisplayedAction.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DisplayedAction.js","sourceRoot":"","sources":["../../src/Store/DisplayedAction.ts"],"names":[],"mappings":";;;AACA,4CAA6D;AAc7D,SAAgB,iBAAiB,CAAC,MAAuB;IACvD,IAAI,MAAM,CAAC,OAAO;QAAE,OAAO,KAAK,CAAA;IAChC,IAAI,MAAM,CAAC,SAAS;QAAE,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,CAAA;IAC9C,OAAO,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,MAAM,CAAA;AACpD,CAAC;AAJD,8CAIC;AAED,SAAgB,eAAe,CAAO,MAA6B,EAAE,IAA6B;;IAA7B,qBAAA,EAAA,aAAO,MAAM,CAAC,SAAS,0CAAE,IAAI;IAChG,IAAM,gBAAgB,GAAG,CAAC,IAAI,KAAK,0BAAa,CAAC,WAAW,IAAI,IAAI,KAAK,0BAAa,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAA;IAC1I,OAAO,gBAAgB,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAA;AACnF,CAAC;AAHD,0CAGC"}
1
+ {"version":3,"file":"DisplayedAction.js","sourceRoot":"","sources":["../../src/Store/DisplayedAction.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,aAAa,EAAE,MAAM,eAAe,CAAA;AAc7D,MAAM,UAAU,iBAAiB,CAAC,MAAuB;IACvD,IAAI,MAAM,CAAC,OAAO;QAAE,OAAO,KAAK,CAAA;IAChC,IAAI,MAAM,CAAC,SAAS;QAAE,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,CAAA;IAC9C,OAAO,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,MAAM,CAAA;AACpD,CAAC;AAED,MAAM,UAAU,eAAe,CAAO,MAA6B,EAAE,IAAI,GAAG,MAAM,CAAC,SAAS,EAAE,IAAI;IAChG,MAAM,gBAAgB,GAAG,CAAC,IAAI,KAAK,aAAa,CAAC,WAAW,IAAI,IAAI,KAAK,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAA;IAC1I,OAAO,gBAAgB,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAA;AACnF,CAAC"}
@@ -1,28 +1,27 @@
1
- import { GameMode, GameOptions, IndexedGameNotification, Player, Tournament } from '../Types';
2
- import { PlayedMove } from './PlayedMove';
3
- import { DisplayedAction } from './DisplayedAction';
4
- export type GamePageState<Game = any, Move = any, PlayerId = any> = {
5
- players: Player<PlayerId>[];
6
- playerId?: PlayerId;
7
- options?: GameOptions;
8
- gameMode?: GameMode;
9
- setup?: Game;
10
- state?: Game;
11
- actions?: DisplayedAction<Move, PlayerId>[];
12
- pendingNotifications: IndexedGameNotification<PlayerId>[];
13
- nextNotificationIndex: number;
14
- legalMoves: Move[];
15
- failures: string[];
16
- animationIncrement: number;
17
- animationsSpeed: number;
18
- animationPaused: boolean;
19
- soundsMuted: boolean;
20
- liveLogStopped: boolean;
21
- clientTimeDelta: number;
22
- gameOver?: boolean;
23
- tournament?: Tournament;
24
- client?: {
25
- player?: PlayerId;
26
- };
27
- playedMoves?: PlayedMove<Move>[];
28
- };
1
+ import { GameMode, GameOptions, IndexedGameNotification, Player, Tournament } from '../Types';
2
+ import { PlayedMove } from './PlayedMove';
3
+ import { DisplayedAction } from './DisplayedAction';
4
+ export type GamePageState<Game = any, Move = any, PlayerId = any> = {
5
+ players: Player<PlayerId>[];
6
+ playerId?: PlayerId;
7
+ options?: GameOptions;
8
+ gameMode?: GameMode;
9
+ setup?: Game;
10
+ state?: Game;
11
+ actions?: DisplayedAction<Move, PlayerId>[];
12
+ pendingNotifications: IndexedGameNotification<PlayerId>[];
13
+ nextNotificationIndex: number;
14
+ legalMoves: Move[];
15
+ failures: string[];
16
+ animationIncrement: number;
17
+ animationsSpeed: number;
18
+ soundsMuted: boolean;
19
+ liveLogStopped: boolean;
20
+ clientTimeDelta: number;
21
+ gameOver?: boolean;
22
+ tournament?: Tournament;
23
+ client?: {
24
+ player?: PlayerId;
25
+ };
26
+ playedMoves?: PlayedMove<Move>[];
27
+ };
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=GamePageState.js.map
@@ -1,5 +1,5 @@
1
- export type PlayedMove<Move = any> = {
2
- move: Move;
3
- actionId: string;
4
- consequenceIndex?: number;
5
- };
1
+ export type PlayedMove<Move = any> = {
2
+ move: Move;
3
+ actionId: string;
4
+ consequenceIndex?: number;
5
+ };
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=PlayedMove.js.map
@@ -0,0 +1 @@
1
+ export declare const endAnimation: import("@reduxjs/toolkit").ActionCreatorWithPayload<number, string>;
@@ -0,0 +1,3 @@
1
+ import { createAction } from '@reduxjs/toolkit';
2
+ export const endAnimation = createAction('endAnimation');
3
+ //# sourceMappingURL=endAnimation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endAnimation.js","sourceRoot":"","sources":["../../src/Store/endAnimation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAE/C,MAAM,CAAC,MAAM,YAAY,GAAG,YAAY,CAAS,cAAc,CAAC,CAAA"}
@@ -1,4 +1,4 @@
1
- import { Middleware } from 'redux';
2
- import { GameAPI } from '../api/GameAPI';
3
- import { GamePageState } from './GamePageState';
4
- export declare function gameMiddleware<Game, Move, PlayerId>(api: GameAPI<Move, PlayerId>): Middleware<{}, GamePageState<Game, Move, PlayerId>>;
1
+ import { Middleware } from 'redux';
2
+ import { GameAPI } from '../api/GameAPI';
3
+ import { GamePageState } from './GamePageState';
4
+ export declare function gameMiddleware<Game, Move, PlayerId>(api: GameAPI<Move, PlayerId>): Middleware<{}, GamePageState<Game, Move, PlayerId>>;
@@ -1,42 +1,35 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.gameMiddleware = void 0;
4
- var Actions_1 = require("../Actions");
5
- var EjectPlayer_1 = require("../EjectPlayer");
6
- var GiveUp_1 = require("../GiveUp");
7
- var Tutorial_1 = require("../Tutorial");
8
- var ArrayUtil_1 = require("../util/ArrayUtil");
9
- function gameMiddleware(api) {
10
- return function (store) { return function (next) { return function (event) {
11
- switch (event.type) {
12
- case Actions_1.ActionType.MOVE_PLAYED:
13
- if (!event.local && !event.transient) {
14
- api.play(event.move);
15
- }
16
- break;
17
- case Actions_1.MOVE_UNDONE:
18
- var actions = store.getState().actions;
19
- if (!actions)
20
- return console.error('gameMiddleware - MOVE_UNDONE: Actions is missing');
21
- var action = (0, ArrayUtil_1.findLastItem)(actions, function (action) { return action.id === event.actionId; });
22
- if (!action)
23
- return console.error('gameMiddleware - MOVE_UNDONE: Action not found');
24
- if (!action.local) {
25
- api.undo(event.actionId);
26
- }
27
- break;
28
- case EjectPlayer_1.EJECT_PLAYER:
29
- api.eject(event.playerId);
30
- break;
31
- case GiveUp_1.GIVE_UP:
32
- api.giveUp();
33
- break;
34
- case Tutorial_1.PLAY_TUTORIAL_MOVES:
35
- api.playTutorialMoves(event.quantity);
36
- break;
37
- }
38
- return next(event);
39
- }; }; };
40
- }
41
- exports.gameMiddleware = gameMiddleware;
1
+ import { giveUp, playMove, undoMove } from '../Actions';
2
+ import { ejectPlayer } from '../EjectPlayer';
3
+ import { playTutorialMoves } from '../Tutorial';
4
+ import { findLastItem } from '../util/ArrayUtil';
5
+ export function gameMiddleware(api) {
6
+ return store => next => action => {
7
+ if (playMove.match(action)) {
8
+ if (!action.payload.options?.local && !action.payload.options?.transient) {
9
+ api.play(action.payload.move);
10
+ }
11
+ }
12
+ else if (undoMove.match(action)) {
13
+ const actions = store.getState().actions;
14
+ if (!actions)
15
+ return console.error('gameMiddleware - undoMove: Actions is missing');
16
+ const gameAction = findLastItem(actions, gameAction => gameAction.id === action.payload.actionId);
17
+ if (!gameAction)
18
+ return console.error('gameMiddleware - undoMove: Action not found');
19
+ if (!gameAction.local) {
20
+ api.undo(action.payload.actionId);
21
+ }
22
+ }
23
+ else if (ejectPlayer.match(action)) {
24
+ api.eject(action.payload);
25
+ }
26
+ else if (giveUp.match(action)) {
27
+ api.giveUp();
28
+ }
29
+ else if (playTutorialMoves.match(action)) {
30
+ api.playTutorialMoves(action.payload);
31
+ }
32
+ return next(action);
33
+ };
34
+ }
42
35
  //# sourceMappingURL=gameMiddleware.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"gameMiddleware.js","sourceRoot":"","sources":["../../src/Store/gameMiddleware.ts"],"names":[],"mappings":";;;AACA,sCAAoD;AAEpD,8CAA0D;AAC1D,oCAAmC;AACnC,wCAAoE;AACpE,+CAAgD;AAIhD,SAAgB,cAAc,CAAuB,GAA4B;IAE/E,OAAO,UAAA,KAAK,IAAI,OAAA,UAAA,IAAI,IAAI,OAAA,UAAC,KAAoD;QAC3E,QAAQ,KAAK,CAAC,IAAI,EAAE;YAClB,KAAK,oBAAU,CAAC,WAAW;gBACzB,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE;oBACpC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;iBACrB;gBACD,MAAK;YACP,KAAK,qBAAW;gBACd,IAAM,OAAO,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAA;gBACxC,IAAI,CAAC,OAAO;oBAAE,OAAO,OAAO,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAAA;gBACtF,IAAM,MAAM,GAAG,IAAA,wBAAY,EAAC,OAAO,EAAE,UAAA,MAAM,IAAI,OAAA,MAAM,CAAC,EAAE,KAAK,KAAK,CAAC,QAAQ,EAA5B,CAA4B,CAAC,CAAA;gBAC5E,IAAI,CAAC,MAAM;oBAAE,OAAO,OAAO,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAA;gBACnF,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE;oBACjB,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;iBACzB;gBACD,MAAK;YACP,KAAK,0BAAY;gBACf,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;gBACzB,MAAK;YACP,KAAK,gBAAO;gBACV,GAAG,CAAC,MAAM,EAAE,CAAA;gBACZ,MAAK;YACP,KAAK,8BAAmB;gBACtB,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;gBACrC,MAAK;SACR;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,CAAA;IACpB,CAAC,EA3BuB,CA2BvB,EA3Be,CA2Bf,CAAA;AACH,CAAC;AA9BD,wCA8BC"}
1
+ {"version":3,"file":"gameMiddleware.js","sourceRoot":"","sources":["../../src/Store/gameMiddleware.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAEvD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAGhD,MAAM,UAAU,cAAc,CAAuB,GAA4B;IAE/E,OAAO,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE;QAC/B,IAAI,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;YAC3B,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,EAAE,CAAC;gBACzE,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;YAC/B,CAAC;QACH,CAAC;aAAM,IAAI,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;YAClC,MAAM,OAAO,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAA;YACxC,IAAI,CAAC,OAAO;gBAAE,OAAO,OAAO,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAA;YACnF,MAAM,UAAU,GAAG,YAAY,CAAC,OAAO,EAAE,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,KAAK,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;YACjG,IAAI,CAAC,UAAU;gBAAE,OAAO,OAAO,CAAC,KAAK,CAAC,6CAA6C,CAAC,CAAA;YACpF,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;gBACtB,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;YACnC,CAAC;QACH,CAAC;aAAM,IAAI,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;YACrC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,OAAmB,CAAC,CAAA;QACvC,CAAC;aAAM,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;YAChC,GAAG,CAAC,MAAM,EAAE,CAAA;QACd,CAAC;aAAM,IAAI,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;YAC3C,GAAG,CAAC,iBAAiB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;QACvC,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,CAAA;IACrB,CAAC,CAAA;AACH,CAAC"}
@@ -1,20 +1,14 @@
1
- import { Rules, RulesCreator } from '@gamepark/rules-api';
2
- import { Reducer } from 'redux';
3
- import { ActionFailed, AnimationComplete, AnimationPaused, AnimationStart, ClearFailures, GameNotificationsReceived, GameOver, GameStateLoaded, MovePlayed, MoveUndone, SetAnimationsSpeed } from '../Actions';
4
- import { PlayerQuit } from '../Actions/PlayerQuit';
5
- import { Animations } from '../animations';
6
- import { GiveUp } from '../GiveUp';
7
- import { StartLiveLog, StopLiveLog } from '../Log';
8
- import { MuteSounds, UnmuteSounds } from '../Sound';
9
- import { DisplayedAction } from './DisplayedAction';
10
- import { GamePageState } from './GamePageState';
11
- export type GameReducerContext<Game = any, Move = any, PlayerId = any> = {
12
- Rules: RulesCreator<Game, Move, PlayerId>;
13
- animations?: Animations<Game, Move, PlayerId>;
14
- version?: number;
15
- };
16
- export type GameActions<Game = any, Move = any, PlayerId = any> = GameStateLoaded<Game, PlayerId> | GameNotificationsReceived<PlayerId> | MovePlayed<Move> | MoveUndone | AnimationStart | AnimationComplete | AnimationPaused | ActionFailed | ClearFailures | SetAnimationsSpeed | GiveUp | PlayerQuit | MuteSounds | UnmuteSounds | GameOver<PlayerId> | StopLiveLog | StartLiveLog;
17
- export declare function gameReducer<Game, Move, PlayerId>(context: GameReducerContext<Game, Move, PlayerId>): Reducer<GamePageState<Game, Move, PlayerId>, GameActions<Game, Move, PlayerId>>;
18
- export declare function getGameAfterAnimations<Game, Move, PlayerId>(state: GamePageState<Game, Move, PlayerId>, Rules: RulesCreator<Game, Move, PlayerId>): Rules<Game, Move, PlayerId>;
19
- export declare function replayActions<Game, Move, PlayerId>(rules: Rules<Game, Move, PlayerId>, actions: DisplayedAction<Move, PlayerId>[], previousState: Game): void;
20
- export declare function replayAction<Game, Move, PlayerId>(rules: Rules<Game, Move, PlayerId>, action: DisplayedAction<Move, PlayerId>): void;
1
+ import { Rules, RulesCreator } from '@gamepark/rules-api';
2
+ import { Reducer } from '@reduxjs/toolkit';
3
+ import { Animations } from '../animations';
4
+ import { DisplayedAction } from './DisplayedAction';
5
+ import { GamePageState } from './GamePageState';
6
+ export type GameReducerContext<Game = any, Move = any, PlayerId = any> = {
7
+ Rules: RulesCreator<Game, Move, PlayerId>;
8
+ animations?: Animations<Game, Move, PlayerId>;
9
+ version?: number;
10
+ };
11
+ export declare function gameReducer(context?: GameReducerContext): Reducer<GamePageState>;
12
+ export declare function getGameAfterAnimations<Game, Move, PlayerId>(state: GamePageState<Game, Move, PlayerId>, Rules: RulesCreator<Game, Move, PlayerId>): Rules<Game, Move, PlayerId>;
13
+ export declare function replayActions<Game, Move, PlayerId>(rules: Rules<Game, Move, PlayerId>, actions: DisplayedAction<Move, PlayerId>[], previousState: Game): void;
14
+ export declare function replayAction<Game, Move, PlayerId>(rules: Rules<Game, Move, PlayerId>, action: DisplayedAction<Move, PlayerId>): void;