@gamepark/react-game 6.24.2 → 6.25.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.
Files changed (281) hide show
  1. package/dist/components/Avatar/Avatar.d.ts +4 -6
  2. package/dist/components/Avatar/Avatar.js +5 -4
  3. package/dist/components/Avatar/Avatar.js.map +1 -1
  4. package/dist/components/Avatar/ChatSpeechBubble.js +3 -2
  5. package/dist/components/Avatar/ChatSpeechBubble.js.map +1 -1
  6. package/dist/components/Avatar/SpeechBubble.d.ts +1 -0
  7. package/dist/components/Avatar/SpeechBubble.js +2 -1
  8. package/dist/components/Avatar/SpeechBubble.js.map +1 -1
  9. package/dist/components/GamePoints/GamePointIcon.js +1 -0
  10. package/dist/components/GamePoints/GamePointIcon.js.map +1 -1
  11. package/dist/components/GamePoints/GamePoints.js +1 -0
  12. package/dist/components/GamePoints/GamePoints.js.map +1 -1
  13. package/dist/components/GameProvider/GameContext.js +2 -1
  14. package/dist/components/GameProvider/GameContext.js.map +1 -1
  15. package/dist/components/GameProvider/GameProvider.js +3 -0
  16. package/dist/components/GameProvider/GameProvider.js.map +1 -1
  17. package/dist/components/Header/Header.d.ts +1 -0
  18. package/dist/components/Header/Header.js +3 -2
  19. package/dist/components/Header/Header.js.map +1 -1
  20. package/dist/components/Header/MaterialHeader.js +1 -0
  21. package/dist/components/Header/MaterialHeader.js.map +1 -1
  22. package/dist/components/ImagesLoader/ImagesLoader.js +1 -0
  23. package/dist/components/ImagesLoader/ImagesLoader.js.map +1 -1
  24. package/dist/components/JournalTabs/Chat/Chat.d.ts +1 -0
  25. package/dist/components/JournalTabs/Chat/ChatMessage.js +1 -0
  26. package/dist/components/JournalTabs/Chat/ChatMessage.js.map +1 -1
  27. package/dist/components/JournalTabs/Chat/ChatMessageAuthor.js +1 -0
  28. package/dist/components/JournalTabs/Chat/ChatMessageAuthor.js.map +1 -1
  29. package/dist/components/JournalTabs/Chat/ChatTextInput.js +1 -0
  30. package/dist/components/JournalTabs/Chat/ChatTextInput.js.map +1 -1
  31. package/dist/components/JournalTabs/Chat/CommonChat.js +1 -0
  32. package/dist/components/JournalTabs/Chat/CommonChat.js.map +1 -1
  33. package/dist/components/JournalTabs/Chat/SignInToChat.js +1 -0
  34. package/dist/components/JournalTabs/Chat/SignInToChat.js.map +1 -1
  35. package/dist/components/JournalTabs/History/GameOverHistory.js +1 -0
  36. package/dist/components/JournalTabs/History/GameOverHistory.js.map +1 -1
  37. package/dist/components/JournalTabs/History/History.js +2 -0
  38. package/dist/components/JournalTabs/History/History.js.map +1 -1
  39. package/dist/components/JournalTabs/History/HistoryEntry.js +1 -0
  40. package/dist/components/JournalTabs/History/HistoryEntry.js.map +1 -1
  41. package/dist/components/JournalTabs/History/StartGameHistory.js +1 -0
  42. package/dist/components/JournalTabs/History/StartGameHistory.js.map +1 -1
  43. package/dist/components/JournalTabs/JournalTabs.d.ts +1 -0
  44. package/dist/components/JournalTabs/JournalTabs.js +5 -1
  45. package/dist/components/JournalTabs/JournalTabs.js.map +1 -1
  46. package/dist/components/Letterbox/Letterbox.js +1 -0
  47. package/dist/components/Letterbox/Letterbox.js.map +1 -1
  48. package/dist/components/LoadingScreen/LoadingScreen.js +1 -0
  49. package/dist/components/LoadingScreen/LoadingScreen.js.map +1 -1
  50. package/dist/components/Picture/Picture.d.ts +1 -0
  51. package/dist/components/Picture/Picture.js +1 -0
  52. package/dist/components/Picture/Picture.js.map +1 -1
  53. package/dist/components/PlayerPanel/Counters.d.ts +1 -0
  54. package/dist/components/PlayerPanel/Counters.js +1 -0
  55. package/dist/components/PlayerPanel/Counters.js.map +1 -1
  56. package/dist/components/PlayerPanel/PlayerPanel.js +1 -0
  57. package/dist/components/PlayerPanel/PlayerPanel.js.map +1 -1
  58. package/dist/components/PlayerPanel/StyledPlayerPanel.d.ts +1 -0
  59. package/dist/components/PlayerPanel/StyledPlayerPanel.js +44 -16
  60. package/dist/components/PlayerPanel/StyledPlayerPanel.js.map +1 -1
  61. package/dist/components/PlayerTimer/PlayerTimer.d.ts +1 -0
  62. package/dist/components/PlayerTimer/PlayerTimer.js +1 -0
  63. package/dist/components/PlayerTimer/PlayerTimer.js.map +1 -1
  64. package/dist/components/buttons/PlayMoveButton/PlayMoveButton.js +1 -0
  65. package/dist/components/buttons/PlayMoveButton/PlayMoveButton.js.map +1 -1
  66. package/dist/components/buttons/ThemeButton/ThemeButton.d.ts +1 -0
  67. package/dist/components/buttons/UndoMovesButton/UndoMovesButton.d.ts +1 -0
  68. package/dist/components/dialogs/Dialog.d.ts +1 -0
  69. package/dist/components/dialogs/Dialog.js +3 -0
  70. package/dist/components/dialogs/Dialog.js.map +1 -1
  71. package/dist/components/dialogs/FailuresDialog.js +1 -0
  72. package/dist/components/dialogs/FailuresDialog.js.map +1 -1
  73. package/dist/components/dialogs/ResultDialog/RematchDisplay.js +1 -0
  74. package/dist/components/dialogs/ResultDialog/RematchDisplay.js.map +1 -1
  75. package/dist/components/dialogs/ResultDialog/RematchSection.js +1 -0
  76. package/dist/components/dialogs/ResultDialog/RematchSection.js.map +1 -1
  77. package/dist/components/dialogs/ResultDialog/ResultDialog.js +20 -18
  78. package/dist/components/dialogs/ResultDialog/ResultDialog.js.map +1 -1
  79. package/dist/components/dialogs/RulesDialog/LocationRulesDialogContent.js +1 -0
  80. package/dist/components/dialogs/RulesDialog/LocationRulesDialogContent.js.map +1 -1
  81. package/dist/components/dialogs/RulesDialog/MaterialRulesDialog.js +1 -0
  82. package/dist/components/dialogs/RulesDialog/MaterialRulesDialog.js.map +1 -1
  83. package/dist/components/dialogs/RulesDialog/MaterialRulesDialogContent.js +2 -1
  84. package/dist/components/dialogs/RulesDialog/MaterialRulesDialogContent.js.map +1 -1
  85. package/dist/components/dialogs/RulesDialog/RulesDialog.js +1 -0
  86. package/dist/components/dialogs/RulesDialog/RulesDialog.js.map +1 -1
  87. package/dist/components/dialogs/RulesDialog/RulesHelpDialogContent.js +1 -0
  88. package/dist/components/dialogs/RulesDialog/RulesHelpDialogContent.js.map +1 -1
  89. package/dist/components/material/ComponentDescription.d.ts +32 -0
  90. package/dist/components/material/ComponentDescription.js +15 -1
  91. package/dist/components/material/ComponentDescription.js.map +1 -1
  92. package/dist/components/material/Dices/CubicDiceDescription.d.ts +4 -4
  93. package/dist/components/material/Dices/CubicDiceDescription.js +6 -7
  94. package/dist/components/material/Dices/CubicDiceDescription.js.map +1 -1
  95. package/dist/components/material/DraggableMaterial.js +14 -3
  96. package/dist/components/material/DraggableMaterial.js.map +1 -1
  97. package/dist/components/material/FlatMaterial/BoardDescription.js +1 -1
  98. package/dist/components/material/FlatMaterial/CardDescription.js +3 -3
  99. package/dist/components/material/FlatMaterial/CardDescription.js.map +1 -1
  100. package/dist/components/material/FlatMaterial/FlatMaterial.d.ts +1 -0
  101. package/dist/components/material/FlatMaterial/FlatMaterial.js +2 -1
  102. package/dist/components/material/FlatMaterial/FlatMaterial.js.map +1 -1
  103. package/dist/components/material/FlatMaterial/MoneyDescription.d.ts +7 -0
  104. package/dist/components/material/FlatMaterial/MoneyDescription.js +39 -0
  105. package/dist/components/material/FlatMaterial/MoneyDescription.js.map +1 -0
  106. package/dist/components/material/FlatMaterial/TokenDescription.js +2 -2
  107. package/dist/components/material/FlatMaterial/index.d.ts +1 -0
  108. package/dist/components/material/FlatMaterial/index.js +1 -0
  109. package/dist/components/material/FlatMaterial/index.js.map +1 -1
  110. package/dist/components/material/GameTable/DynamicItemsDisplay.js +2 -1
  111. package/dist/components/material/GameTable/DynamicItemsDisplay.js.map +1 -1
  112. package/dist/components/material/GameTable/GameMaterialDisplay.js +1 -0
  113. package/dist/components/material/GameTable/GameMaterialDisplay.js.map +1 -1
  114. package/dist/components/material/GameTable/GameTable.d.ts +1 -0
  115. package/dist/components/material/GameTable/GameTable.js +1 -0
  116. package/dist/components/material/GameTable/GameTable.js.map +1 -1
  117. package/dist/components/material/GameTable/GameTableNavigation.js +1 -0
  118. package/dist/components/material/GameTable/GameTableNavigation.js.map +1 -1
  119. package/dist/components/material/GameTable/ItemDisplay.d.ts +1 -0
  120. package/dist/components/material/GameTable/ItemDisplay.js +3 -2
  121. package/dist/components/material/GameTable/ItemDisplay.js.map +1 -1
  122. package/dist/components/material/GameTable/StaticItemsDisplay.d.ts +1 -0
  123. package/dist/components/material/GameTable/StaticLocationsDisplay.d.ts +1 -0
  124. package/dist/components/material/GameTable/focus/FocusProvider.js +1 -0
  125. package/dist/components/material/GameTable/focus/FocusProvider.js.map +1 -1
  126. package/dist/components/material/MaterialComponent.d.ts +2 -0
  127. package/dist/components/material/MaterialComponent.js +3 -2
  128. package/dist/components/material/MaterialComponent.js.map +1 -1
  129. package/dist/components/material/MaterialDescription.d.ts +124 -3
  130. package/dist/components/material/MaterialDescription.js +113 -9
  131. package/dist/components/material/MaterialDescription.js.map +1 -1
  132. package/dist/components/material/MobileMaterialDescription.d.ts +1 -0
  133. package/dist/components/material/MobileMaterialDescription.js +2 -1
  134. package/dist/components/material/MobileMaterialDescription.js.map +1 -1
  135. package/dist/components/material/Wheel/WheelContent.d.ts +14 -0
  136. package/dist/components/material/Wheel/WheelContent.js +52 -0
  137. package/dist/components/material/Wheel/WheelContent.js.map +1 -0
  138. package/dist/components/material/Wheel/WheelDescription.d.ts +19 -0
  139. package/dist/components/material/Wheel/WheelDescription.js +91 -0
  140. package/dist/components/material/Wheel/WheelDescription.js.map +1 -0
  141. package/dist/components/material/Wheel/WheelItem.d.ts +15 -0
  142. package/dist/components/material/Wheel/WheelItem.js +54 -0
  143. package/dist/components/material/Wheel/WheelItem.js.map +1 -0
  144. package/dist/components/material/Wheel/index.d.ts +1 -0
  145. package/dist/components/material/Wheel/index.js +18 -0
  146. package/dist/components/material/Wheel/index.js.map +1 -0
  147. package/dist/components/material/Writing/WritingDescription.js +2 -1
  148. package/dist/components/material/Writing/WritingDescription.js.map +1 -1
  149. package/dist/components/material/animations/CreateItemAnimations.js +1 -1
  150. package/dist/components/material/animations/DeleteItemAnimations.js +5 -3
  151. package/dist/components/material/animations/DeleteItemAnimations.js.map +1 -1
  152. package/dist/components/material/animations/ItemAnimations.js +1 -1
  153. package/dist/components/material/animations/MaterialAnimations.js +1 -1
  154. package/dist/components/material/animations/MaterialGameAnimations.js +2 -2
  155. package/dist/components/material/animations/MoveItemAnimations.js +7 -5
  156. package/dist/components/material/animations/MoveItemAnimations.js.map +1 -1
  157. package/dist/components/material/animations/MoveItemAtOnceAnimations.js +2 -1
  158. package/dist/components/material/animations/MoveItemAtOnceAnimations.js.map +1 -1
  159. package/dist/components/material/animations/RollItemAnimations.js +4 -1
  160. package/dist/components/material/animations/RollItemAnimations.js.map +1 -1
  161. package/dist/components/material/animations/ShuffleAnimations.js +1 -1
  162. package/dist/components/material/animations/isMovedOrDeletedItem.util.d.ts +1 -1
  163. package/dist/components/material/animations/isMovedOrDeletedItem.util.js +1 -4
  164. package/dist/components/material/animations/isMovedOrDeletedItem.util.js.map +1 -1
  165. package/dist/components/material/animations/rotations.utils.js +23 -12
  166. package/dist/components/material/animations/rotations.utils.js.map +1 -1
  167. package/dist/components/material/index.d.ts +1 -0
  168. package/dist/components/material/index.js +1 -0
  169. package/dist/components/material/index.js.map +1 -1
  170. package/dist/components/material/locations/DropAreaDescription.js +1 -1
  171. package/dist/components/material/locations/LocationComponent.js +2 -1
  172. package/dist/components/material/locations/LocationComponent.js.map +1 -1
  173. package/dist/components/material/locations/LocationDescription.d.ts +7 -0
  174. package/dist/components/material/locations/LocationDescription.js +8 -1
  175. package/dist/components/material/locations/LocationDescription.js.map +1 -1
  176. package/dist/components/material/locations/LocationDisplay.js +1 -0
  177. package/dist/components/material/locations/LocationDisplay.js.map +1 -1
  178. package/dist/components/material/locations/SimpleDropArea.js +1 -0
  179. package/dist/components/material/locations/SimpleDropArea.js.map +1 -1
  180. package/dist/components/menus/EjectPlayer/EjectPlayerButton.js +1 -0
  181. package/dist/components/menus/EjectPlayer/EjectPlayerButton.js.map +1 -1
  182. package/dist/components/menus/EjectPlayer/EjectPlayerDialog.js +1 -0
  183. package/dist/components/menus/EjectPlayer/EjectPlayerDialog.js.map +1 -1
  184. package/dist/components/menus/EjectPlayer/EjectPlayerPopButton.js +1 -0
  185. package/dist/components/menus/EjectPlayer/EjectPlayerPopButton.js.map +1 -1
  186. package/dist/components/menus/Fullscreen/FullscreenButton.js +1 -0
  187. package/dist/components/menus/Fullscreen/FullscreenButton.js.map +1 -1
  188. package/dist/components/menus/Fullscreen/FullscreenDialog.js +1 -0
  189. package/dist/components/menus/Fullscreen/FullscreenDialog.js.map +1 -1
  190. package/dist/components/menus/Fullscreen/FullscreenPopButton.js +1 -0
  191. package/dist/components/menus/Fullscreen/FullscreenPopButton.js.map +1 -1
  192. package/dist/components/menus/GiveUpButton/GiveUpButton.js +1 -0
  193. package/dist/components/menus/GiveUpButton/GiveUpButton.js.map +1 -1
  194. package/dist/components/menus/Menu/Menu.js +1 -0
  195. package/dist/components/menus/Menu/Menu.js.map +1 -1
  196. package/dist/components/menus/Menu/MenuPopButton.js +1 -0
  197. package/dist/components/menus/Menu/MenuPopButton.js.map +1 -1
  198. package/dist/components/menus/Menu/NavButton.d.ts +1 -0
  199. package/dist/components/menus/PlayerQuit/TrackPlayersQuit.js +1 -0
  200. package/dist/components/menus/PlayerQuit/TrackPlayersQuit.js.map +1 -1
  201. package/dist/components/menus/RestartTutorialButton/RestartTutorialButton.js +1 -0
  202. package/dist/components/menus/RestartTutorialButton/RestartTutorialButton.js.map +1 -1
  203. package/dist/components/menus/Result/ResultButton.js +1 -0
  204. package/dist/components/menus/Result/ResultButton.js.map +1 -1
  205. package/dist/components/menus/Result/ResultPopButton.js +1 -0
  206. package/dist/components/menus/Result/ResultPopButton.js.map +1 -1
  207. package/dist/components/menus/SoundButton/SoundButton.js +1 -0
  208. package/dist/components/menus/SoundButton/SoundButton.js.map +1 -1
  209. package/dist/components/menus/TimeStatsButton/TimeStatsButton.js +1 -0
  210. package/dist/components/menus/TimeStatsButton/TimeStatsButton.js.map +1 -1
  211. package/dist/components/menus/UndoButton/UndoButton.js +1 -0
  212. package/dist/components/menus/UndoButton/UndoButton.js.map +1 -1
  213. package/dist/components/menus/UndoButton/UndoPopButton.js +1 -0
  214. package/dist/components/menus/UndoButton/UndoPopButton.js.map +1 -1
  215. package/dist/components/tutorial/MaterialTutorial.js +2 -3
  216. package/dist/components/tutorial/MaterialTutorial.js.map +1 -1
  217. package/dist/components/tutorial/MaterialTutorialDisplay.js +1 -0
  218. package/dist/components/tutorial/MaterialTutorialDisplay.js.map +1 -1
  219. package/dist/components/tutorial/TutorialRulesWrapper.js +1 -0
  220. package/dist/components/tutorial/TutorialRulesWrapper.js.map +1 -1
  221. package/dist/hooks/useFullscreen.js +1 -0
  222. package/dist/hooks/useFullscreen.js.map +1 -1
  223. package/dist/hooks/useOpponentWithMaxTime.d.ts +3 -0
  224. package/dist/hooks/useOpponentWithMaxTime.js +3 -0
  225. package/dist/hooks/useOpponentWithMaxTime.js.map +1 -1
  226. package/dist/hooks/usePlayerTime.js +1 -1
  227. package/dist/hooks/usePlayerTime.js.map +1 -1
  228. package/dist/hooks/useResultText.js +1 -0
  229. package/dist/hooks/useResultText.js.map +1 -1
  230. package/dist/hooks/useSound.js +1 -0
  231. package/dist/hooks/useSound.js.map +1 -1
  232. package/dist/hooks/useWebP.js +2 -2
  233. package/dist/hooks/useWebP.js.map +1 -1
  234. package/dist/hooks/useZoomToElements.d.ts +3 -0
  235. package/dist/hooks/useZoomToElements.js +3 -0
  236. package/dist/hooks/useZoomToElements.js.map +1 -1
  237. package/dist/locators/DeckLocator.d.ts +3 -0
  238. package/dist/locators/DeckLocator.js +4 -1
  239. package/dist/locators/DeckLocator.js.map +1 -1
  240. package/dist/locators/FlexLocator.d.ts +39 -0
  241. package/dist/locators/FlexLocator.js +31 -1
  242. package/dist/locators/FlexLocator.js.map +1 -1
  243. package/dist/locators/HandLocator.d.ts +72 -0
  244. package/dist/locators/HandLocator.js +73 -1
  245. package/dist/locators/HandLocator.js.map +1 -1
  246. package/dist/locators/ListLocator.d.ts +36 -0
  247. package/dist/locators/ListLocator.js +31 -2
  248. package/dist/locators/ListLocator.js.map +1 -1
  249. package/dist/locators/Locator.d.ts +199 -1
  250. package/dist/locators/Locator.js +189 -1
  251. package/dist/locators/Locator.js.map +1 -1
  252. package/dist/locators/PileLocator.d.ts +30 -0
  253. package/dist/locators/PileLocator.js +32 -3
  254. package/dist/locators/PileLocator.js.map +1 -1
  255. package/dist/utilities/DeepPartial.d.ts +3 -0
  256. package/dist/utilities/combineEventListeners.d.ts +6 -0
  257. package/dist/utilities/combineEventListeners.js +6 -0
  258. package/dist/utilities/combineEventListeners.js.map +1 -1
  259. package/dist/utilities/findIfUnique.util.d.ts +6 -0
  260. package/dist/utilities/findIfUnique.util.js +6 -0
  261. package/dist/utilities/findIfUnique.util.js.map +1 -1
  262. package/dist/utilities/translation.util.d.ts +5 -0
  263. package/dist/utilities/translation.util.js +5 -0
  264. package/dist/utilities/translation.util.js.map +1 -1
  265. package/dist/utilities/zoom-pan-pinch/animations.constants.js +20 -0
  266. package/dist/utilities/zoom-pan-pinch/animations.constants.js.map +1 -1
  267. package/dist/utilities/zoom-pan-pinch/animations.util.js +7 -0
  268. package/dist/utilities/zoom-pan-pinch/animations.util.js.map +1 -1
  269. package/dist/utilities/zoom-pan-pinch/bounds.util.d.ts +10 -0
  270. package/dist/utilities/zoom-pan-pinch/bounds.util.js +8 -0
  271. package/dist/utilities/zoom-pan-pinch/bounds.util.js.map +1 -1
  272. package/dist/utilities/zoom-pan-pinch/calculation.util.d.ts +12 -0
  273. package/dist/utilities/zoom-pan-pinch/calculation.util.js +12 -0
  274. package/dist/utilities/zoom-pan-pinch/calculation.util.js.map +1 -1
  275. package/dist/utilities/zoom-pan-pinch/index.d.ts +4 -0
  276. package/dist/utilities/zoom-pan-pinch/index.js +4 -0
  277. package/dist/utilities/zoom-pan-pinch/index.js.map +1 -1
  278. package/dist/utilities/zoom-pan-pinch/zoom.util.d.ts +3 -0
  279. package/dist/utilities/zoom-pan-pinch/zoom.util.js +3 -0
  280. package/dist/utilities/zoom-pan-pinch/zoom.util.js.map +1 -1
  281. package/package.json +3 -3
@@ -18,37 +18,100 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.HandLocator = void 0;
19
19
  var components_1 = require("../components");
20
20
  var Locator_1 = require("./Locator");
21
- var HandLocator = (function (_super) {
21
+ /**
22
+ * This Locator places items fan-shaped to mimic the ways we hold cards in our hands.
23
+ */
24
+ var HandLocator = /** @class */ (function (_super) {
22
25
  __extends(HandLocator, _super);
23
26
  function HandLocator(clone) {
24
27
  var _this = _super.call(this) || this;
28
+ /**
29
+ * Items are place around the circle of an arc. This is the radius of the arc. Override {@link getRadius} to provide a dynamic radius.
30
+ */
25
31
  _this.radius = 100;
32
+ /**
33
+ * The default angle of the hand items. For instance, 180 will display the hand oriented towards the bottom of the screen.
34
+ */
26
35
  _this.baseAngle = 0;
36
+ /**
37
+ * The maximum angle that is allowed between the first and the last items displayed.
38
+ */
27
39
  _this.maxAngle = 15;
40
+ /**
41
+ * The maximum angle between two consecutive items in the hand
42
+ */
28
43
  _this.gapMaxAngle = 3;
44
+ /**
45
+ * The direction of the items displayed, for the first to the last index. Default is true.
46
+ */
29
47
  _this.clockwise = true;
48
+ /**
49
+ * The Z-axis position difference between 2 consecutive items in the hand. Default is 0.05cm.
50
+ */
30
51
  _this.deltaZ = 0.05;
31
52
  Object.assign(_this, clone);
32
53
  return _this;
33
54
  }
55
+ /**
56
+ * Provide the radius of the circle. Defaults to {@link radius} property.
57
+ * @param _location Location to position
58
+ * @param _context Context of the game
59
+ * @returns the radius of the circle in cm
60
+ */
34
61
  HandLocator.prototype.getRadius = function (_location, _context) {
35
62
  return this.radius;
36
63
  };
64
+ /**
65
+ * Function to override to provide a {@link baseAngle} that depends on the context
66
+ * @param _location Location to position
67
+ * @param _context Context of the game
68
+ * @returns the default angle of the items
69
+ */
37
70
  HandLocator.prototype.getBaseAngle = function (_location, _context) {
38
71
  return this.baseAngle;
39
72
  };
73
+ /**
74
+ * Function to override to provide a {@link maxAngle} that depends on the context
75
+ * @param _location Location to position
76
+ * @param _context Context of the game
77
+ * @returns the maximum angle between the first and the last items
78
+ */
40
79
  HandLocator.prototype.getMaxAngle = function (_location, _context) {
41
80
  return this.maxAngle;
42
81
  };
82
+ /**
83
+ * Function to override to provide a {@link gapMaxAngle} that depends on the context
84
+ * @param _location Location to position
85
+ * @param _context Context of the game
86
+ * @returns The maximum angle between two consecutive items in the hand
87
+ */
43
88
  HandLocator.prototype.getGapMaxAngle = function (_location, _context) {
44
89
  return this.gapMaxAngle;
45
90
  };
91
+ /**
92
+ * Function to override to provide a {@link clockwise} info that depends on the context
93
+ * @param _location Location to position
94
+ * @param _context Context of the game
95
+ * @returns true if items should be displayed clockwise around the arc of circle. Default is true.
96
+ */
46
97
  HandLocator.prototype.isClockwise = function (_location, _context) {
47
98
  return this.clockwise;
48
99
  };
100
+ /**
101
+ * Function to override to provide a {@link deltaZ} that depends on the context
102
+ * @param _location Location to position
103
+ * @param _context Context of the game
104
+ * @returns The Z-axis position difference between 2 consecutive items in the hand. Default is 0.05cm.
105
+ */
49
106
  HandLocator.prototype.getDeltaZ = function (_location, _context) {
50
107
  return this.deltaZ;
51
108
  };
109
+ /**
110
+ * See {@link Locator.getLocationCoordinates}.
111
+ * @param location Location to position
112
+ * @param context Context of the game
113
+ * @param index Index of the item (or location) to place
114
+ */
52
115
  HandLocator.prototype.getLocationCoordinates = function (location, context, index) {
53
116
  if (index === void 0) { index = this.getLocationIndex(location, context); }
54
117
  var _a = this.getCoordinates(location, context), _b = _a.x, x = _b === void 0 ? 0 : _b, _c = _a.y, y = _c === void 0 ? 0 : _c, _d = _a.z, z = _d === void 0 ? 0 : _d;
@@ -67,6 +130,12 @@ var HandLocator = (function (_super) {
67
130
  HandLocator.prototype.getItemCoordinates = function (item, context) {
68
131
  return this.getLocationCoordinates(item.location, context, this.getItemIndex(item, context));
69
132
  };
133
+ /**
134
+ * See {@link Locator.getRotateZ}.
135
+ * @param location Location to position
136
+ * @param context Context of the game
137
+ * @param index Index of the item (or location) to place
138
+ */
70
139
  HandLocator.prototype.getRotateZ = function (location, context, index) {
71
140
  if (index === void 0) { index = this.getLocationIndex(location, context); }
72
141
  var baseAngle = this.getBaseAngle(location, context);
@@ -96,6 +165,9 @@ var HandLocator = (function (_super) {
96
165
  borderRadius: borderRadius
97
166
  });
98
167
  };
168
+ /**
169
+ * See {@link Locator.getHoverTransform}. By default, display the item on top of others, straight, and twice as big.
170
+ */
99
171
  HandLocator.prototype.getHoverTransform = function (item, context) {
100
172
  return ['translateZ(10em)', "rotateZ(".concat(-this.getItemRotateZ(item, context)).concat(this.rotationUnit, ")"), 'scale(2)'];
101
173
  };
@@ -1 +1 @@
1
- {"version":3,"file":"HandLocator.js","sourceRoot":"","sources":["../../src/locators/HandLocator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,4CAAyF;AACzF,qCAAiE;AAKjE;IAAkH,+BAAgB;IAEhI,qBAAY,KAA4B;QAAxC,YACE,iBAAO,SAER;QAKD,YAAM,GAAW,GAAG,CAAA;QAepB,eAAS,GAAW,CAAC,CAAA;QAerB,cAAQ,GAAW,EAAE,CAAA;QAerB,iBAAW,GAAW,CAAC,CAAA;QAevB,eAAS,GAAY,IAAI,CAAA;QAezB,YAAM,GAAW,IAAI,CAAA;QAjFnB,MAAM,CAAC,MAAM,CAAC,KAAI,EAAE,KAAK,CAAC,CAAA;;IAC5B,CAAC;IAaD,+BAAS,GAAT,UAAU,SAAyB,EAAE,QAAkC;QACrE,OAAO,IAAI,CAAC,MAAM,CAAA;IACpB,CAAC;IAaD,kCAAY,GAAZ,UAAa,SAAyB,EAAE,QAAkC;QACxE,OAAO,IAAI,CAAC,SAAS,CAAA;IACvB,CAAC;IAaD,iCAAW,GAAX,UAAY,SAAyB,EAAE,QAAkC;QACvE,OAAO,IAAI,CAAC,QAAQ,CAAA;IACtB,CAAC;IAaD,oCAAc,GAAd,UAAe,SAAyB,EAAE,QAAkC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cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,SAAG,IAAI,CAAC,YAAY,MAAG,EAAE,UAAU,CAAC,CAAA;IAChH,CAAC;IACH,kBAAC;AAAD,CAAC,AAnKD,CAAkH,iBAAO,GAmKxH;AAnKY,kCAAW"}
@@ -1,14 +1,50 @@
1
1
  import { Coordinates, Location, MaterialItem, XYCoordinates } from '@gamepark/rules-api';
2
2
  import { LocationDescription } from '../components';
3
3
  import { ItemContext, Locator, MaterialContext } from './Locator';
4
+ /**
5
+ * This Locator places items at regular intervals.
6
+ */
4
7
  export declare class ListLocator<P extends number = number, M extends number = number, L extends number = number> extends Locator<P, M, L> {
5
8
  constructor(clone?: Partial<ListLocator>);
9
+ /**
10
+ * The default gap between 2 consecutive items
11
+ */
6
12
  gap?: Partial<Coordinates>;
13
+ /**
14
+ * Function to override to provide a {@link gap} that depends on the context
15
+ * @param _location Location to position
16
+ * @param _context Context of the game
17
+ * @returns The default gap between 2 consecutive items
18
+ */
7
19
  getGap(_location: Location<P, L>, _context: MaterialContext<P, M, L>): Partial<Coordinates>;
20
+ /**
21
+ * The maximum number of items that can be displayed in the list before the gap between items is reduced to fill in the same space.
22
+ */
8
23
  maxCount?: number;
24
+ /**
25
+ * Function to override to provide a {@link maxCount that depends on the context
26
+ * @param _location Location to position
27
+ * @param _context Context of the game
28
+ * @returns The maximum number of items that can be displayed in the list before the gap between items is reduced to fill in the same space.
29
+ */
9
30
  getMaxCount(_location: Location<P, L>, _context: MaterialContext<P, M, L>): number | undefined;
31
+ /**
32
+ * The maximum gap between the first and the last items. See {@link maxCount} to get a maxGap based on a max number of items.
33
+ */
10
34
  maxGap?: Partial<Coordinates>;
35
+ /**
36
+ * Function to override to provide a {@link maxGap} that depends on the context
37
+ * @param location Location to position
38
+ * @param context Context of the game
39
+ * @returns The maximum gap between the first and the last items
40
+ */
11
41
  getMaxGap(location: Location<P, L>, context: MaterialContext<P, M, L>): Partial<Coordinates>;
42
+ /**
43
+ * The number of items displayed in the list
44
+ * @param location Location area of the items
45
+ * @param context Context of the game
46
+ * @returns number of items in the location area
47
+ */
12
48
  countListItems(location: Location<P, L>, context: MaterialContext<P, M, L>): number;
13
49
  protected getAreaCoordinates(location: Location<P, L>, context: MaterialContext<P, M, L>): Partial<Coordinates>;
14
50
  protected getCurrentMaxGap(location: Location<P, L>, context: MaterialContext<P, M, L>): XYCoordinates;
@@ -18,20 +18,41 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.ListLocator = void 0;
19
19
  var components_1 = require("../components");
20
20
  var Locator_1 = require("./Locator");
21
- var ListLocator = (function (_super) {
21
+ /**
22
+ * This Locator places items at regular intervals.
23
+ */
24
+ var ListLocator = /** @class */ (function (_super) {
22
25
  __extends(ListLocator, _super);
23
26
  function ListLocator(clone) {
24
27
  var _this = _super.call(this) || this;
25
28
  Object.assign(_this, clone);
26
29
  return _this;
27
30
  }
31
+ /**
32
+ * Function to override to provide a {@link gap} that depends on the context
33
+ * @param _location Location to position
34
+ * @param _context Context of the game
35
+ * @returns The default gap between 2 consecutive items
36
+ */
28
37
  ListLocator.prototype.getGap = function (_location, _context) {
29
38
  var _a;
30
39
  return (_a = this.gap) !== null && _a !== void 0 ? _a : {};
31
40
  };
41
+ /**
42
+ * Function to override to provide a {@link maxCount that depends on the context
43
+ * @param _location Location to position
44
+ * @param _context Context of the game
45
+ * @returns The maximum number of items that can be displayed in the list before the gap between items is reduced to fill in the same space.
46
+ */
32
47
  ListLocator.prototype.getMaxCount = function (_location, _context) {
33
48
  return this.maxCount;
34
49
  };
50
+ /**
51
+ * Function to override to provide a {@link maxGap} that depends on the context
52
+ * @param location Location to position
53
+ * @param context Context of the game
54
+ * @returns The maximum gap between the first and the last items
55
+ */
35
56
  ListLocator.prototype.getMaxGap = function (location, context) {
36
57
  if (this.maxGap)
37
58
  return this.maxGap;
@@ -45,6 +66,12 @@ var ListLocator = (function (_super) {
45
66
  z: z ? z * (maxCount - 1) : z
46
67
  };
47
68
  };
69
+ /**
70
+ * The number of items displayed in the list
71
+ * @param location Location area of the items
72
+ * @param context Context of the game
73
+ * @returns number of items in the location area
74
+ */
48
75
  ListLocator.prototype.countListItems = function (location, context) {
49
76
  var _a;
50
77
  return Math.min((_a = this.limit) !== null && _a !== void 0 ? _a : Infinity, this.countItems(location, context));
@@ -83,8 +110,10 @@ var ListLocator = (function (_super) {
83
110
  if (!item)
84
111
  return;
85
112
  var _e = (_b = (_a = context.material[context.type]) === null || _a === void 0 ? void 0 : _a.getSize(item.id)) !== null && _b !== void 0 ? _b : {}, _f = _e.width, width = _f === void 0 ? 0 : _f, _g = _e.height, height = _g === void 0 ? 0 : _g;
86
- var _h = this.getCurrentMaxGap(location, context), x = _h.x, y = _h.y;
87
113
  var borderRadius = (_d = (_c = context.material[context.type]) === null || _c === void 0 ? void 0 : _c.getBorderRadius(item.id)) !== null && _d !== void 0 ? _d : 0;
114
+ if (this.getLocationIndex(location, context) !== undefined)
115
+ return new components_1.DropAreaDescription({ width: width, height: height, borderRadius: borderRadius });
116
+ var _h = this.getCurrentMaxGap(location, context), x = _h.x, y = _h.y;
88
117
  return new components_1.DropAreaDescription({
89
118
  width: width + Math.abs(x),
90
119
  height: height + Math.abs(y),
@@ -1 +1 @@
1
- {"version":3,"file":"ListLocator.js","sourceRoot":"","sources":["../../src/locators/ListLocator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,4CAAwE;AACxE,qCAAiE;AAKjE;IAAkH,+BAAgB;IAEhI,qBAAY,KAA4B;QAAxC,YACE,iBAAO,SAER;QADC,MAAM,CAAC,MAAM,CAAC,KAAI,EAAE,KAAK,CAAC,CAAA;;IAC5B,CAAC;IAaD,4BAAM,GAAN,UAAO,SAAyB,EAAE,QAAkC;;QAClE,OAAO,MAAA,IAAI,CAAC,GAAG,mCAAI,EAAE,CAAA;IACvB,CAAC;IAaD,iCAAW,GAAX,UAAY,SAAyB,EAAE,QAAkC;QACvE,OAAO,IAAI,CAAC,QAAQ,CAAA;IACtB,CAA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QACxF,IAAM,YAAY,GAAG,MAAA,MAAA,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,0CAAE,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC,mCAAI,CAAC,CAAA;QAClF,IAAI,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,KAAK,SAAS;YAAE,OAAO,IAAI,gCAAmB,CAAC,EAAE,KAAK,OAAA,EAAE,MAAM,QAAA,EAAE,YAAY,cAAA,EAAE,CAAC,CAAA;QACrH,IAAA,KAAW,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAjD,CAAC,OAAA,EAAE,CAAC,OAA6C,CAAA;QACzD,OAAO,IAAI,gCAAmB,CAAC;YAC7B,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YAC1B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YAC5B,YAAY,cAAA;SACb,CAAC,CAAA;IACJ,CAAC;IACH,kBAAC;AAAD,CAAC,AAlHD,CAAkH,iBAAO,GAkHxH;AAlHY,kCAAW"}
@@ -1,50 +1,248 @@
1
- import { Coordinates, DisplayedItem, Location, MaterialItem, MaterialRules, XYCoordinates } from '@gamepark/rules-api';
1
+ /** @jsxImportSource @emotion/react */
2
+ import { Coordinates, DeleteItem, DisplayedItem, Location, MaterialItem, MaterialRules, MoveItem, XYCoordinates } from '@gamepark/rules-api';
2
3
  import { LocationDescription, MaterialDescriptionRecord } from '../components';
3
4
  export type SortFunction = ((item: MaterialItem) => number);
5
+ /**
6
+ * A Locator is responsible for placing item and locations (such as drop areas) on the Game Table.
7
+ */
4
8
  export declare class Locator<P extends number = number, M extends number = number, L extends number = number> {
9
+ /**
10
+ * With the constructor, you can create new locators in one line.
11
+ * @example `new Locator({ coordinates: { x: -10, y: -5 } })`
12
+ * @param clone Object to clone into the class
13
+ */
5
14
  constructor(clone?: Partial<Locator>);
15
+ /**
16
+ * Types of items placed by the locator since it was created
17
+ * @internal
18
+ * @protected
19
+ */
6
20
  protected itemTypes: M[];
21
+ /**
22
+ * If the locator places items on top of another item (a game board for instance), the type of the parent item must be provided here.
23
+ */
7
24
  parentItemType?: M;
25
+ /**
26
+ * The maximum number of items do display.
27
+ */
8
28
  limit?: number;
29
+ /**
30
+ * The rotation unit to use. See {@link getRotateZ}
31
+ */
9
32
  rotationUnit: string;
33
+ /**
34
+ * Declare this field if you always need to display one location that does not depend on the context. See {@link getLocations}.
35
+ */
10
36
  location?: Location<P, L>;
37
+ /**
38
+ * Declare this field if you always need to display some locations that does not depend on the context. See {@link getLocations}.
39
+ */
11
40
  locations: Location<P, L>[];
41
+ /**
42
+ * Override this if you need to display some locations on the Game Table that depends on the context.
43
+ * By default, return any {@link location} or {@link locations}.
44
+ */
12
45
  getLocations(_context: MaterialContext<P, M, L>): Location<P, L>[];
46
+ /**
47
+ * If you need do display custom locations in the game, provide their description here.
48
+ */
13
49
  locationDescription?: LocationDescription<P, M, L>;
50
+ /**
51
+ * @internal
52
+ * This function automatically create some drop location descriptions based on the context (dragged item, parent item).
53
+ *
54
+ * Do not override it but use {@link locationDescription},
55
+ * otherwise the images of the location descriptions will not be preloaded by the {@link MaterialImageLoader}.
56
+ */
14
57
  getLocationDescription(location: Location<P, L>, context: MaterialContext<P, M, L> | ItemContext<P, M, L>): LocationDescription<P, M, L> | undefined;
58
+ /**
59
+ * @internal This function provides a custom location description for the current dragged item.
60
+ */
15
61
  protected generateLocationDescriptionFromDraggedItem(_location: Location<P, L>, context: ItemContext<P, M, L>): LocationDescription<P, M, L> | undefined;
62
+ /**
63
+ * This function can hide some items on the game table depending on the context.
64
+ * @param item The item
65
+ * @param context The context of the item
66
+ * @returns true if the item must be hidden
67
+ */
16
68
  hide(item: MaterialItem<P, L>, context: ItemContext<P, M, L>): boolean;
69
+ /**
70
+ * Provide a list of css transform operations to place a location on the game table.
71
+ * @param location Location to place
72
+ * @param context Context of the location in the game
73
+ * @returns the css transform that will be applied to the location
74
+ */
17
75
  placeLocation(location: Location<P, L>, context: LocationContext<P, M, L>): string[];
76
+ /**
77
+ * Provide a list of css transform operations to place an item on the game table.
78
+ * @param item Item to place
79
+ * @param context Context of the item in the game
80
+ * @returns the css transform that will be applied to the item
81
+ */
18
82
  placeItem(item: MaterialItem<P, L>, context: ItemContext<P, M, L>): string[];
83
+ /**
84
+ * Provide a list of css transform operations to place an item on a parent item.
85
+ * @param item Item to place
86
+ * @param context Context of the item in the game
87
+ * @returns the css transform that will be applied to the item
88
+ */
19
89
  protected placeItemOnParent(item: MaterialItem<P, L>, context: ItemContext<P, M, L>): string[];
90
+ /**
91
+ * If a location belongs to an item, returns the item
92
+ * @param location A location
93
+ * @param context Context of the game
94
+ * @returns the parent item of the location if any
95
+ */
20
96
  getParentItem(location: Location<P, L>, { rules, material }: MaterialContext<P, M, L>): MaterialItem<P, L> | undefined;
97
+ /**
98
+ * Position of the location on the parent item, in percentage. Use {@link getPositionOnParent} to provide a dynamic position.
99
+ */
21
100
  positionOnParent: XYCoordinates;
101
+ /**
102
+ * Place the center of the item in the plan of their parent item. This is ignored if "parentItemType" is undefined.
103
+ * Examples: {x: 0, y: 0} places the center of the item in the top-left corner of the parent item
104
+ * {x: 50, y: 50} centers the item in the parent item.
105
+ *
106
+ * @param _location Location of the item or area inside the parent item
107
+ * @param _context THe material game context
108
+ * @return {x, y} with "x" as a percentage from the parent's width, "y" a percentage of the height
109
+ */
22
110
  getPositionOnParent(_location: Location<P, L>, _context: MaterialContext<P, M, L>): XYCoordinates;
111
+ /**
112
+ * Coordinates of the location on the Game Table. Use {@link getCoordinates} to provide dynamic coordinates.
113
+ */
23
114
  coordinates: Partial<Coordinates>;
115
+ /**
116
+ * Provide the coordinates of a location on the Game Table.
117
+ *
118
+ * Called by {@link getLocationCoordinates} but can be used as the Hand, List or Pile "initial" position in subclasses.
119
+ *
120
+ * @param _location Location to position
121
+ * @param _context Context of the game
122
+ * @returns the x, y, z coordinates (in cm) of the location
123
+ */
24
124
  getCoordinates(_location: Location<P, L>, _context: MaterialContext<P, M, L>): Partial<Coordinates>;
125
+ /**
126
+ * Provide the coordinates of a location on the Game Table.
127
+ *
128
+ * Fallback to {@link getCoordinates} but the differences appear in subclasses {@link ListLocator}, {@link PileLocator}, {@link HandLocator}.
129
+ *
130
+ * @param location Location to position
131
+ * @param context Context of the game
132
+ * @returns the x, y, z coordinates (in cm) of the location
133
+ */
25
134
  getLocationCoordinates(location: Location<P, L>, context: MaterialContext<P, M, L>): Partial<Coordinates>;
135
+ /**
136
+ * Provide the coordinates of the center of an item on the Game Table.
137
+ *
138
+ * @param item Item being placed
139
+ * @param context Context of the item in the game
140
+ * @return The x, y, z coordinates in cm of the center of the item on the table
141
+ */
26
142
  getItemCoordinates(item: MaterialItem<P, L>, context: ItemContext<P, M, L>): Partial<Coordinates>;
143
+ /**
144
+ * The default Z-axis rotation of the items or locations to place if {@link getRotateZ} is not overridden.
145
+ */
27
146
  rotateZ: number;
147
+ /**
148
+ * Get the Z-axis rotation of a location.
149
+ * @param _location Location to place
150
+ * @param _context Context of the location
151
+ * @returns the rotation (unit in {@link rotationUnit})
152
+ */
28
153
  getRotateZ(_location: Location<P, L>, _context: MaterialContext<P, M, L>): number;
154
+ /**
155
+ * Get the Z-axis rotation of an item. Defaults to {@link getRotateZ}.
156
+ * @param item item to place
157
+ * @param context Context of the item
158
+ * @returns the rotation (unit in {@link rotationUnit})
159
+ */
29
160
  getItemRotateZ(item: MaterialItem<P, L>, context: ItemContext<P, M, L>): number;
161
+ /**
162
+ * The index of a location to place, if it matters in the locator's context (see {@link HandLocator}, {@link ListLocator} or {@link PileLocator}).
163
+ *
164
+ * Defaults to location.x first, y otherwise, z last.
165
+ *
166
+ * @param location Location to index in the location area (see {@link isSameLocationArea})
167
+ * @param _context Context of the game
168
+ * @returns the index of the location in the location area
169
+ */
30
170
  getLocationIndex(location: Location<P, L>, _context: MaterialContext<P, M, L>): number | undefined;
171
+ /**
172
+ * Index of an item to place (fallback to {@link getLocationIndex} or item's displayIndex).
173
+ * @param item Item to place
174
+ * @param context Context of the item
175
+ * @returns the index of the item in the location area
176
+ */
31
177
  getItemIndex(item: MaterialItem<P, L>, context: ItemContext<P, M, L>): number;
178
+ /**
179
+ * The total number of items in the same location area (see {@link isSameLocationArea}).
180
+ *
181
+ * @param location the location area
182
+ * @param context Context of the game
183
+ * @returns the total number of items in the location area
184
+ */
32
185
  countItems(location: Location<P, L>, { rules }: MaterialContext<P, M, L>): number;
186
+ /**
187
+ * Any css transform to apply to the item when it is hovered by the pointer. See {@link HandLocator} override for example.
188
+ * @param _item The item
189
+ * @param _context Context of the item
190
+ * @returns the list of css transforms
191
+ */
33
192
  getHoverTransform(_item: MaterialItem<P, L>, _context: ItemContext<P, M, L>): string[];
193
+ /**
194
+ * How items in the same location area are sorted for the help dialog navigation arrows.
195
+ */
34
196
  navigationSorts: SortFunction[];
197
+ /**
198
+ * How items in the same location area are sorted for the help dialog navigation arrows.
199
+ * @param _context Context of the game
200
+ * @returns The list of sort functions to sort the items.
201
+ */
35
202
  getNavigationSorts(_context: ItemContext<P, M, L>): SortFunction[];
203
+ /**
204
+ * Utility function for animation to know if the item is one that should be animated.
205
+ * @param item Item to consider
206
+ * @param context Context of the Item
207
+ * @param move Move to animate
208
+ * @returns true if the items must be animated
209
+ */
210
+ isItemToAnimate(item: MaterialItem<P, L>, context: ItemContext<P, M, L>, move: MoveItem<P, M, L> | DeleteItem<M>): boolean;
36
211
  }
212
+ /**
213
+ * A record of item locators, to provide to the game context.
214
+ */
37
215
  export type ItemLocatorRecord<P extends number = number, M extends number = number, L extends number = number> = Record<L, Locator<P, M, L>>;
216
+ /**
217
+ * Data structure for the context of a game displayed.
218
+ * @property rules The rules of the game with current game state.
219
+ * @property material The record of the material descriptions to display the items.
220
+ * @property locators The record of the locators to place the items.
221
+ * @property player The player currently displaying the game. Undefined for spectators.
222
+ */
38
223
  export type MaterialContext<P extends number = number, M extends number = number, L extends number = number> = {
39
224
  rules: MaterialRules<P, M, L>;
40
225
  material: Partial<MaterialDescriptionRecord<P, M, L>>;
41
226
  locators: Partial<ItemLocatorRecord<P, M, L>>;
42
227
  player?: P;
43
228
  };
229
+ /**
230
+ * Data structure for the context of an item in a game displayed.
231
+ * @property dragTransform The CSS translate operation applied to the item, if any.
232
+ */
44
233
  export type ItemContext<P extends number = number, M extends number = number, L extends number = number> = MaterialContext<P, M, L> & DisplayedItem<M> & {
45
234
  dragTransform?: string;
46
235
  };
236
+ /**
237
+ * Type guard to test if some MaterialContext is also an item context.
238
+ * @param context Context of the game
239
+ * @returns true if the context also hold information about a specific item in the game.
240
+ */
47
241
  export declare function isItemContext<P extends number = number, M extends number = number, L extends number = number>(context: MaterialContext<P, M, L>): context is ItemContext<P, M, L>;
242
+ /**
243
+ * Context of a location in a displayed game.
244
+ * @property canDrop Whether some item is currently being dragged, and can be dropped in the location.
245
+ */
48
246
  export type LocationContext<P extends number = number, M extends number = number, L extends number = number> = MaterialContext<P, M, L> & {
49
247
  canDrop?: boolean;
50
248
  };