@gamepark/react-game 6.24.1 → 6.24.3

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 (289) 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 +14 -0
  54. package/dist/components/PlayerPanel/Counters.js +45 -0
  55. package/dist/components/PlayerPanel/Counters.js.map +1 -0
  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 +5 -2
  59. package/dist/components/PlayerPanel/StyledPlayerPanel.js +48 -15
  60. package/dist/components/PlayerPanel/StyledPlayerPanel.js.map +1 -1
  61. package/dist/components/PlayerPanel/index.d.ts +1 -0
  62. package/dist/components/PlayerPanel/index.js +1 -0
  63. package/dist/components/PlayerPanel/index.js.map +1 -1
  64. package/dist/components/PlayerTimer/PlayerTimer.d.ts +1 -0
  65. package/dist/components/PlayerTimer/PlayerTimer.js +1 -0
  66. package/dist/components/PlayerTimer/PlayerTimer.js.map +1 -1
  67. package/dist/components/buttons/PlayMoveButton/PlayMoveButton.js +1 -0
  68. package/dist/components/buttons/PlayMoveButton/PlayMoveButton.js.map +1 -1
  69. package/dist/components/buttons/ThemeButton/ThemeButton.d.ts +1 -0
  70. package/dist/components/buttons/UndoMovesButton/UndoMovesButton.d.ts +1 -0
  71. package/dist/components/dialogs/Dialog.d.ts +1 -0
  72. package/dist/components/dialogs/Dialog.js +3 -0
  73. package/dist/components/dialogs/Dialog.js.map +1 -1
  74. package/dist/components/dialogs/FailuresDialog.js +1 -0
  75. package/dist/components/dialogs/FailuresDialog.js.map +1 -1
  76. package/dist/components/dialogs/ResultDialog/RematchDisplay.js +1 -0
  77. package/dist/components/dialogs/ResultDialog/RematchDisplay.js.map +1 -1
  78. package/dist/components/dialogs/ResultDialog/RematchSection.js +1 -0
  79. package/dist/components/dialogs/ResultDialog/RematchSection.js.map +1 -1
  80. package/dist/components/dialogs/ResultDialog/ResultDialog.js +1 -0
  81. package/dist/components/dialogs/ResultDialog/ResultDialog.js.map +1 -1
  82. package/dist/components/dialogs/RulesDialog/LocationRulesDialogContent.js +1 -0
  83. package/dist/components/dialogs/RulesDialog/LocationRulesDialogContent.js.map +1 -1
  84. package/dist/components/dialogs/RulesDialog/MaterialRulesDialog.js +1 -0
  85. package/dist/components/dialogs/RulesDialog/MaterialRulesDialog.js.map +1 -1
  86. package/dist/components/dialogs/RulesDialog/MaterialRulesDialogContent.js +1 -0
  87. package/dist/components/dialogs/RulesDialog/MaterialRulesDialogContent.js.map +1 -1
  88. package/dist/components/dialogs/RulesDialog/RulesDialog.js +1 -0
  89. package/dist/components/dialogs/RulesDialog/RulesDialog.js.map +1 -1
  90. package/dist/components/dialogs/RulesDialog/RulesHelpDialogContent.js +1 -0
  91. package/dist/components/dialogs/RulesDialog/RulesHelpDialogContent.js.map +1 -1
  92. package/dist/components/material/ComponentDescription.d.ts +32 -0
  93. package/dist/components/material/ComponentDescription.js +15 -1
  94. package/dist/components/material/ComponentDescription.js.map +1 -1
  95. package/dist/components/material/Dices/CubicDiceDescription.d.ts +4 -4
  96. package/dist/components/material/Dices/CubicDiceDescription.js +6 -7
  97. package/dist/components/material/Dices/CubicDiceDescription.js.map +1 -1
  98. package/dist/components/material/DraggableMaterial.js +4 -0
  99. package/dist/components/material/DraggableMaterial.js.map +1 -1
  100. package/dist/components/material/FlatMaterial/BoardDescription.js +1 -1
  101. package/dist/components/material/FlatMaterial/CardDescription.js +3 -3
  102. package/dist/components/material/FlatMaterial/CardDescription.js.map +1 -1
  103. package/dist/components/material/FlatMaterial/FlatMaterial.d.ts +1 -0
  104. package/dist/components/material/FlatMaterial/FlatMaterial.js +2 -1
  105. package/dist/components/material/FlatMaterial/FlatMaterial.js.map +1 -1
  106. package/dist/components/material/FlatMaterial/MoneyDescription.d.ts +7 -0
  107. package/dist/components/material/FlatMaterial/MoneyDescription.js +39 -0
  108. package/dist/components/material/FlatMaterial/MoneyDescription.js.map +1 -0
  109. package/dist/components/material/FlatMaterial/TokenDescription.js +2 -2
  110. package/dist/components/material/FlatMaterial/index.d.ts +1 -0
  111. package/dist/components/material/FlatMaterial/index.js +1 -0
  112. package/dist/components/material/FlatMaterial/index.js.map +1 -1
  113. package/dist/components/material/GameTable/DynamicItemsDisplay.js +2 -1
  114. package/dist/components/material/GameTable/DynamicItemsDisplay.js.map +1 -1
  115. package/dist/components/material/GameTable/GameMaterialDisplay.js +1 -0
  116. package/dist/components/material/GameTable/GameMaterialDisplay.js.map +1 -1
  117. package/dist/components/material/GameTable/GameTable.d.ts +1 -0
  118. package/dist/components/material/GameTable/GameTable.js +1 -0
  119. package/dist/components/material/GameTable/GameTable.js.map +1 -1
  120. package/dist/components/material/GameTable/GameTableNavigation.js +1 -0
  121. package/dist/components/material/GameTable/GameTableNavigation.js.map +1 -1
  122. package/dist/components/material/GameTable/ItemDisplay.js +4 -3
  123. package/dist/components/material/GameTable/ItemDisplay.js.map +1 -1
  124. package/dist/components/material/GameTable/StaticItemsDisplay.d.ts +1 -0
  125. package/dist/components/material/GameTable/StaticLocationsDisplay.d.ts +1 -0
  126. package/dist/components/material/GameTable/focus/FocusProvider.js +1 -0
  127. package/dist/components/material/GameTable/focus/FocusProvider.js.map +1 -1
  128. package/dist/components/material/GameTable/focus/LocationsWithFocus.d.ts +3 -2
  129. package/dist/components/material/GameTable/focus/LocationsWithFocus.js +10 -3
  130. package/dist/components/material/GameTable/focus/LocationsWithFocus.js.map +1 -1
  131. package/dist/components/material/MaterialComponent.js +1 -0
  132. package/dist/components/material/MaterialComponent.js.map +1 -1
  133. package/dist/components/material/MaterialDescription.d.ts +119 -0
  134. package/dist/components/material/MaterialDescription.js +107 -1
  135. package/dist/components/material/MaterialDescription.js.map +1 -1
  136. package/dist/components/material/MobileMaterialDescription.d.ts +1 -0
  137. package/dist/components/material/MobileMaterialDescription.js +2 -1
  138. package/dist/components/material/MobileMaterialDescription.js.map +1 -1
  139. package/dist/components/material/Writing/WritingDescription.js +2 -1
  140. package/dist/components/material/Writing/WritingDescription.js.map +1 -1
  141. package/dist/components/material/animations/CreateItemAnimations.js +6 -4
  142. package/dist/components/material/animations/CreateItemAnimations.js.map +1 -1
  143. package/dist/components/material/animations/DeleteItemAnimations.js +12 -8
  144. package/dist/components/material/animations/DeleteItemAnimations.js.map +1 -1
  145. package/dist/components/material/animations/ItemAnimations.d.ts +2 -1
  146. package/dist/components/material/animations/ItemAnimations.js +10 -1
  147. package/dist/components/material/animations/ItemAnimations.js.map +1 -1
  148. package/dist/components/material/animations/MaterialAnimations.js +1 -1
  149. package/dist/components/material/animations/MaterialGameAnimations.js +2 -2
  150. package/dist/components/material/animations/MoveItemAnimations.d.ts +1 -2
  151. package/dist/components/material/animations/MoveItemAnimations.js +15 -24
  152. package/dist/components/material/animations/MoveItemAnimations.js.map +1 -1
  153. package/dist/components/material/animations/MoveItemAtOnceAnimations.d.ts +1 -2
  154. package/dist/components/material/animations/MoveItemAtOnceAnimations.js +10 -20
  155. package/dist/components/material/animations/MoveItemAtOnceAnimations.js.map +1 -1
  156. package/dist/components/material/animations/RollItemAnimations.d.ts +1 -2
  157. package/dist/components/material/animations/RollItemAnimations.js +5 -11
  158. package/dist/components/material/animations/RollItemAnimations.js.map +1 -1
  159. package/dist/components/material/animations/ShuffleAnimations.js +1 -1
  160. package/dist/components/material/animations/adjustRotation.d.ts +1 -1
  161. package/dist/components/material/animations/adjustRotation.js +60 -19
  162. package/dist/components/material/animations/adjustRotation.js.map +1 -1
  163. package/dist/components/material/animations/isMovedOrDeletedItem.util.d.ts +1 -1
  164. package/dist/components/material/animations/isMovedOrDeletedItem.util.js +1 -4
  165. package/dist/components/material/animations/isMovedOrDeletedItem.util.js.map +1 -1
  166. package/dist/components/material/animations/rotations.utils.d.ts +2 -0
  167. package/dist/components/material/animations/rotations.utils.js +110 -0
  168. package/dist/components/material/animations/rotations.utils.js.map +1 -0
  169. package/dist/components/material/locations/DropAreaDescription.d.ts +1 -1
  170. package/dist/components/material/locations/DropAreaDescription.js +9 -2
  171. package/dist/components/material/locations/DropAreaDescription.js.map +1 -1
  172. package/dist/components/material/locations/LocationComponent.js +2 -1
  173. package/dist/components/material/locations/LocationComponent.js.map +1 -1
  174. package/dist/components/material/locations/LocationDescription.d.ts +7 -0
  175. package/dist/components/material/locations/LocationDescription.js +8 -1
  176. package/dist/components/material/locations/LocationDescription.js.map +1 -1
  177. package/dist/components/material/locations/LocationDisplay.js +1 -0
  178. package/dist/components/material/locations/LocationDisplay.js.map +1 -1
  179. package/dist/components/material/locations/LocationsMask.d.ts +2 -1
  180. package/dist/components/material/locations/LocationsMask.js +2 -2
  181. package/dist/components/material/locations/LocationsMask.js.map +1 -1
  182. package/dist/components/material/locations/SimpleDropArea.js +1 -0
  183. package/dist/components/material/locations/SimpleDropArea.js.map +1 -1
  184. package/dist/components/menus/EjectPlayer/EjectPlayerButton.js +1 -0
  185. package/dist/components/menus/EjectPlayer/EjectPlayerButton.js.map +1 -1
  186. package/dist/components/menus/EjectPlayer/EjectPlayerDialog.js +1 -0
  187. package/dist/components/menus/EjectPlayer/EjectPlayerDialog.js.map +1 -1
  188. package/dist/components/menus/EjectPlayer/EjectPlayerPopButton.js +1 -0
  189. package/dist/components/menus/EjectPlayer/EjectPlayerPopButton.js.map +1 -1
  190. package/dist/components/menus/Fullscreen/FullscreenButton.js +1 -0
  191. package/dist/components/menus/Fullscreen/FullscreenButton.js.map +1 -1
  192. package/dist/components/menus/Fullscreen/FullscreenDialog.js +1 -0
  193. package/dist/components/menus/Fullscreen/FullscreenDialog.js.map +1 -1
  194. package/dist/components/menus/Fullscreen/FullscreenPopButton.js +1 -0
  195. package/dist/components/menus/Fullscreen/FullscreenPopButton.js.map +1 -1
  196. package/dist/components/menus/GiveUpButton/GiveUpButton.js +1 -0
  197. package/dist/components/menus/GiveUpButton/GiveUpButton.js.map +1 -1
  198. package/dist/components/menus/Menu/Menu.js +1 -0
  199. package/dist/components/menus/Menu/Menu.js.map +1 -1
  200. package/dist/components/menus/Menu/MenuPopButton.js +1 -0
  201. package/dist/components/menus/Menu/MenuPopButton.js.map +1 -1
  202. package/dist/components/menus/Menu/NavButton.d.ts +1 -0
  203. package/dist/components/menus/PlayerQuit/TrackPlayersQuit.js +1 -0
  204. package/dist/components/menus/PlayerQuit/TrackPlayersQuit.js.map +1 -1
  205. package/dist/components/menus/RestartTutorialButton/RestartTutorialButton.js +1 -0
  206. package/dist/components/menus/RestartTutorialButton/RestartTutorialButton.js.map +1 -1
  207. package/dist/components/menus/Result/ResultButton.js +1 -0
  208. package/dist/components/menus/Result/ResultButton.js.map +1 -1
  209. package/dist/components/menus/Result/ResultPopButton.js +1 -0
  210. package/dist/components/menus/Result/ResultPopButton.js.map +1 -1
  211. package/dist/components/menus/SoundButton/SoundButton.js +1 -0
  212. package/dist/components/menus/SoundButton/SoundButton.js.map +1 -1
  213. package/dist/components/menus/TimeStatsButton/TimeStatsButton.js +1 -0
  214. package/dist/components/menus/TimeStatsButton/TimeStatsButton.js.map +1 -1
  215. package/dist/components/menus/UndoButton/UndoButton.js +1 -0
  216. package/dist/components/menus/UndoButton/UndoButton.js.map +1 -1
  217. package/dist/components/menus/UndoButton/UndoPopButton.js +1 -0
  218. package/dist/components/menus/UndoButton/UndoPopButton.js.map +1 -1
  219. package/dist/components/tutorial/MaterialTutorial.js +1 -1
  220. package/dist/components/tutorial/MaterialTutorialDisplay.js +1 -0
  221. package/dist/components/tutorial/MaterialTutorialDisplay.js.map +1 -1
  222. package/dist/components/tutorial/TutorialRulesWrapper.js +1 -0
  223. package/dist/components/tutorial/TutorialRulesWrapper.js.map +1 -1
  224. package/dist/hooks/useFullscreen.js +1 -0
  225. package/dist/hooks/useFullscreen.js.map +1 -1
  226. package/dist/hooks/useOpponentWithMaxTime.d.ts +3 -0
  227. package/dist/hooks/useOpponentWithMaxTime.js +3 -0
  228. package/dist/hooks/useOpponentWithMaxTime.js.map +1 -1
  229. package/dist/hooks/usePlayerTime.js +1 -1
  230. package/dist/hooks/usePlayerTime.js.map +1 -1
  231. package/dist/hooks/usePlayers.js +14 -1
  232. package/dist/hooks/usePlayers.js.map +1 -1
  233. package/dist/hooks/useResultText.js +1 -0
  234. package/dist/hooks/useResultText.js.map +1 -1
  235. package/dist/hooks/useSound.js +1 -0
  236. package/dist/hooks/useSound.js.map +1 -1
  237. package/dist/hooks/useWebP.js +2 -2
  238. package/dist/hooks/useWebP.js.map +1 -1
  239. package/dist/hooks/useZoomToElements.d.ts +3 -0
  240. package/dist/hooks/useZoomToElements.js +3 -0
  241. package/dist/hooks/useZoomToElements.js.map +1 -1
  242. package/dist/locators/DeckLocator.d.ts +3 -0
  243. package/dist/locators/DeckLocator.js +4 -1
  244. package/dist/locators/DeckLocator.js.map +1 -1
  245. package/dist/locators/FlexLocator.d.ts +39 -0
  246. package/dist/locators/FlexLocator.js +31 -1
  247. package/dist/locators/FlexLocator.js.map +1 -1
  248. package/dist/locators/HandLocator.d.ts +72 -0
  249. package/dist/locators/HandLocator.js +73 -1
  250. package/dist/locators/HandLocator.js.map +1 -1
  251. package/dist/locators/LineLocator.d.ts +8 -8
  252. package/dist/locators/LineLocator.js +30 -22
  253. package/dist/locators/LineLocator.js.map +1 -1
  254. package/dist/locators/ListLocator.d.ts +36 -0
  255. package/dist/locators/ListLocator.js +28 -1
  256. package/dist/locators/ListLocator.js.map +1 -1
  257. package/dist/locators/Locator.d.ts +199 -1
  258. package/dist/locators/Locator.js +192 -3
  259. package/dist/locators/Locator.js.map +1 -1
  260. package/dist/locators/PileLocator.d.ts +31 -2
  261. package/dist/locators/PileLocator.js +50 -19
  262. package/dist/locators/PileLocator.js.map +1 -1
  263. package/dist/utilities/DeepPartial.d.ts +3 -0
  264. package/dist/utilities/combineEventListeners.d.ts +6 -0
  265. package/dist/utilities/combineEventListeners.js +6 -0
  266. package/dist/utilities/combineEventListeners.js.map +1 -1
  267. package/dist/utilities/findIfUnique.util.d.ts +6 -0
  268. package/dist/utilities/findIfUnique.util.js +6 -0
  269. package/dist/utilities/findIfUnique.util.js.map +1 -1
  270. package/dist/utilities/translation.util.d.ts +5 -0
  271. package/dist/utilities/translation.util.js +5 -0
  272. package/dist/utilities/translation.util.js.map +1 -1
  273. package/dist/utilities/zoom-pan-pinch/animations.constants.js +20 -0
  274. package/dist/utilities/zoom-pan-pinch/animations.constants.js.map +1 -1
  275. package/dist/utilities/zoom-pan-pinch/animations.util.js +7 -0
  276. package/dist/utilities/zoom-pan-pinch/animations.util.js.map +1 -1
  277. package/dist/utilities/zoom-pan-pinch/bounds.util.d.ts +10 -0
  278. package/dist/utilities/zoom-pan-pinch/bounds.util.js +8 -0
  279. package/dist/utilities/zoom-pan-pinch/bounds.util.js.map +1 -1
  280. package/dist/utilities/zoom-pan-pinch/calculation.util.d.ts +12 -0
  281. package/dist/utilities/zoom-pan-pinch/calculation.util.js +12 -0
  282. package/dist/utilities/zoom-pan-pinch/calculation.util.js.map +1 -1
  283. package/dist/utilities/zoom-pan-pinch/index.d.ts +4 -0
  284. package/dist/utilities/zoom-pan-pinch/index.js +4 -0
  285. package/dist/utilities/zoom-pan-pinch/index.js.map +1 -1
  286. package/dist/utilities/zoom-pan-pinch/zoom.util.d.ts +3 -0
  287. package/dist/utilities/zoom-pan-pinch/zoom.util.js +3 -0
  288. package/dist/utilities/zoom-pan-pinch/zoom.util.js.map +1 -1
  289. package/package.json +3 -3
@@ -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
  };
@@ -15,23 +15,66 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.isItemContext = exports.Locator = void 0;
18
+ /** @jsxImportSource @emotion/react */
18
19
  var rules_api_1 = require("@gamepark/rules-api");
19
20
  var sumBy_1 = __importDefault(require("lodash/sumBy"));
20
21
  var components_1 = require("../components");
21
- var Locator = (function () {
22
+ /**
23
+ * A Locator is responsible for placing item and locations (such as drop areas) on the Game Table.
24
+ */
25
+ var Locator = /** @class */ (function () {
26
+ /**
27
+ * With the constructor, you can create new locators in one line.
28
+ * @example `new Locator({ coordinates: { x: -10, y: -5 } })`
29
+ * @param clone Object to clone into the class
30
+ */
22
31
  function Locator(clone) {
32
+ /**
33
+ * Types of items placed by the locator since it was created
34
+ * @internal
35
+ * @protected
36
+ */
23
37
  this.itemTypes = [];
38
+ /**
39
+ * The rotation unit to use. See {@link getRotateZ}
40
+ */
24
41
  this.rotationUnit = 'deg';
42
+ /**
43
+ * Declare this field if you always need to display some locations that does not depend on the context. See {@link getLocations}.
44
+ */
25
45
  this.locations = [];
46
+ /**
47
+ * Position of the location on the parent item, in percentage. Use {@link getPositionOnParent} to provide a dynamic position.
48
+ */
26
49
  this.positionOnParent = { x: 50, y: 50 };
50
+ /**
51
+ * Coordinates of the location on the Game Table. Use {@link getCoordinates} to provide dynamic coordinates.
52
+ */
27
53
  this.coordinates = { x: 0, y: 0, z: 0 };
54
+ /**
55
+ * The default Z-axis rotation of the items or locations to place if {@link getRotateZ} is not overridden.
56
+ */
28
57
  this.rotateZ = 0;
58
+ /**
59
+ * How items in the same location area are sorted for the help dialog navigation arrows.
60
+ */
29
61
  this.navigationSorts = [function (item) { var _a; return (_a = item.location.x) !== null && _a !== void 0 ? _a : 0; }, function (item) { var _a; return (_a = item.location.y) !== null && _a !== void 0 ? _a : 0; }, function (item) { var _a; return (_a = item.location.z) !== null && _a !== void 0 ? _a : 0; }];
30
62
  Object.assign(this, clone);
31
63
  }
64
+ /**
65
+ * Override this if you need to display some locations on the Game Table that depends on the context.
66
+ * By default, return any {@link location} or {@link locations}.
67
+ */
32
68
  Locator.prototype.getLocations = function (_context) {
33
69
  return this.location ? [this.location] : this.locations;
34
70
  };
71
+ /**
72
+ * @internal
73
+ * This function automatically create some drop location descriptions based on the context (dragged item, parent item).
74
+ *
75
+ * Do not override it but use {@link locationDescription},
76
+ * otherwise the images of the location descriptions will not be preloaded by the {@link MaterialImageLoader}.
77
+ */
35
78
  Locator.prototype.getLocationDescription = function (location, context) {
36
79
  if (!this.locationDescription) {
37
80
  if (this.parentItemType !== undefined && location.x === undefined && location.y === undefined && location.z === undefined) {
@@ -46,12 +89,27 @@ var Locator = (function () {
46
89
  }
47
90
  return this.locationDescription;
48
91
  };
92
+ /**
93
+ * @internal This function provides a custom location description for the current dragged item.
94
+ */
49
95
  Locator.prototype.generateLocationDescriptionFromDraggedItem = function (_location, context) {
50
96
  return new components_1.DropAreaDescription(context.material[context.type]);
51
97
  };
98
+ /**
99
+ * This function can hide some items on the game table depending on the context.
100
+ * @param item The item
101
+ * @param context The context of the item
102
+ * @returns true if the item must be hidden
103
+ */
52
104
  Locator.prototype.hide = function (item, context) {
53
105
  return this.limit ? this.getItemIndex(item, context) >= this.limit : false;
54
106
  };
107
+ /**
108
+ * Provide a list of css transform operations to place a location on the game table.
109
+ * @param location Location to place
110
+ * @param context Context of the location in the game
111
+ * @returns the css transform that will be applied to the location
112
+ */
55
113
  Locator.prototype.placeLocation = function (location, context) {
56
114
  var transform = [];
57
115
  var _a = this.getLocationCoordinates(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;
@@ -66,6 +124,12 @@ var Locator = (function () {
66
124
  transform.push('translateZ(5em)');
67
125
  return transform;
68
126
  };
127
+ /**
128
+ * Provide a list of css transform operations to place an item on the game table.
129
+ * @param item Item to place
130
+ * @param context Context of the item in the game
131
+ * @returns the css transform that will be applied to the item
132
+ */
69
133
  Locator.prototype.placeItem = function (item, context) {
70
134
  if (!this.itemTypes.includes(context.type)) {
71
135
  this.itemTypes.push(context.type);
@@ -81,21 +145,34 @@ var Locator = (function () {
81
145
  }
82
146
  return transform;
83
147
  };
148
+ /**
149
+ * Provide a list of css transform operations to place an item on a parent item.
150
+ * @param item Item to place
151
+ * @param context Context of the item in the game
152
+ * @returns the css transform that will be applied to the item
153
+ */
84
154
  Locator.prototype.placeItemOnParent = function (item, context) {
85
155
  var _a;
86
156
  var parentItem = this.getParentItem(item.location, context);
87
157
  if (this.parentItemType === undefined || !parentItem)
88
158
  return [];
89
159
  var locator = context.locators[parentItem.location.type];
90
- var transform = (_a = locator === null || locator === void 0 ? void 0 : locator.placeItem(parentItem, __assign(__assign({}, context), { type: this.parentItemType, displayIndex: 0 }))) !== null && _a !== void 0 ? _a : [];
160
+ var parentContext = __assign(__assign({}, context), { type: this.parentItemType, displayIndex: 0 });
161
+ var transform = (_a = locator === null || locator === void 0 ? void 0 : locator.placeItem(parentItem, parentContext)) !== null && _a !== void 0 ? _a : [];
91
162
  var parentMaterial = context.material[this.parentItemType];
92
163
  var _b = this.getPositionOnParent(item.location, context), x = _b.x, y = _b.y;
93
164
  if (parentMaterial && (x !== 0 || y !== 0)) {
94
165
  var _c = parentMaterial.getSize(parentItem.id), width = _c.width, height = _c.height;
95
- transform.push("translate(".concat(width * (x - 50) / 100, "em, ").concat(height * (y - 50) / 100, "em)"));
166
+ transform.push("translate3d(".concat(width * (x - 50) / 100, "em, ").concat(height * (y - 50) / 100, "em, ").concat(parentMaterial.getThickness(parentItem, parentContext), "em)"));
96
167
  }
97
168
  return transform;
98
169
  };
170
+ /**
171
+ * If a location belongs to an item, returns the item
172
+ * @param location A location
173
+ * @param context Context of the game
174
+ * @returns the parent item of the location if any
175
+ */
99
176
  Locator.prototype.getParentItem = function (location, _a) {
100
177
  var _b;
101
178
  var rules = _a.rules, material = _a.material;
@@ -105,45 +182,157 @@ var Locator = (function () {
105
182
  return (_b = material[this.parentItemType]) === null || _b === void 0 ? void 0 : _b.staticItem;
106
183
  return rules.material(this.parentItemType).getItem(location.parent);
107
184
  };
185
+ /**
186
+ * Place the center of the item in the plan of their parent item. This is ignored if "parentItemType" is undefined.
187
+ * Examples: {x: 0, y: 0} places the center of the item in the top-left corner of the parent item
188
+ * {x: 50, y: 50} centers the item in the parent item.
189
+ *
190
+ * @param _location Location of the item or area inside the parent item
191
+ * @param _context THe material game context
192
+ * @return {x, y} with "x" as a percentage from the parent's width, "y" a percentage of the height
193
+ */
108
194
  Locator.prototype.getPositionOnParent = function (_location, _context) {
109
195
  return this.positionOnParent;
110
196
  };
197
+ /**
198
+ * Provide the coordinates of a location on the Game Table.
199
+ *
200
+ * Called by {@link getLocationCoordinates} but can be used as the Hand, List or Pile "initial" position in subclasses.
201
+ *
202
+ * @param _location Location to position
203
+ * @param _context Context of the game
204
+ * @returns the x, y, z coordinates (in cm) of the location
205
+ */
111
206
  Locator.prototype.getCoordinates = function (_location, _context) {
112
207
  return this.coordinates;
113
208
  };
209
+ /**
210
+ * Provide the coordinates of a location on the Game Table.
211
+ *
212
+ * Fallback to {@link getCoordinates} but the differences appear in subclasses {@link ListLocator}, {@link PileLocator}, {@link HandLocator}.
213
+ *
214
+ * @param location Location to position
215
+ * @param context Context of the game
216
+ * @returns the x, y, z coordinates (in cm) of the location
217
+ */
114
218
  Locator.prototype.getLocationCoordinates = function (location, context) {
115
219
  return this.getCoordinates(location, context);
116
220
  };
221
+ /**
222
+ * Provide the coordinates of the center of an item on the Game Table.
223
+ *
224
+ * @param item Item being placed
225
+ * @param context Context of the item in the game
226
+ * @return The x, y, z coordinates in cm of the center of the item on the table
227
+ */
117
228
  Locator.prototype.getItemCoordinates = function (item, context) {
118
229
  return this.getLocationCoordinates(item.location, context);
119
230
  };
231
+ /**
232
+ * Get the Z-axis rotation of a location.
233
+ * @param _location Location to place
234
+ * @param _context Context of the location
235
+ * @returns the rotation (unit in {@link rotationUnit})
236
+ */
120
237
  Locator.prototype.getRotateZ = function (_location, _context) {
121
238
  return this.rotateZ;
122
239
  };
240
+ /**
241
+ * Get the Z-axis rotation of an item. Defaults to {@link getRotateZ}.
242
+ * @param item item to place
243
+ * @param context Context of the item
244
+ * @returns the rotation (unit in {@link rotationUnit})
245
+ */
123
246
  Locator.prototype.getItemRotateZ = function (item, context) {
124
247
  return this.getRotateZ(item.location, context);
125
248
  };
249
+ /**
250
+ * The index of a location to place, if it matters in the locator's context (see {@link HandLocator}, {@link ListLocator} or {@link PileLocator}).
251
+ *
252
+ * Defaults to location.x first, y otherwise, z last.
253
+ *
254
+ * @param location Location to index in the location area (see {@link isSameLocationArea})
255
+ * @param _context Context of the game
256
+ * @returns the index of the location in the location area
257
+ */
126
258
  Locator.prototype.getLocationIndex = function (location, _context) {
127
259
  var _a, _b;
128
260
  return (_b = (_a = location.x) !== null && _a !== void 0 ? _a : location.y) !== null && _b !== void 0 ? _b : location.z;
129
261
  };
262
+ /**
263
+ * Index of an item to place (fallback to {@link getLocationIndex} or item's displayIndex).
264
+ * @param item Item to place
265
+ * @param context Context of the item
266
+ * @returns the index of the item in the location area
267
+ */
130
268
  Locator.prototype.getItemIndex = function (item, context) {
131
269
  var _a;
132
270
  return (_a = this.getLocationIndex(item.location, context)) !== null && _a !== void 0 ? _a : context.displayIndex;
133
271
  };
272
+ /**
273
+ * The total number of items in the same location area (see {@link isSameLocationArea}).
274
+ *
275
+ * @param location the location area
276
+ * @param context Context of the game
277
+ * @returns the total number of items in the location area
278
+ */
134
279
  Locator.prototype.countItems = function (location, _a) {
135
280
  var rules = _a.rules;
136
281
  return (0, sumBy_1.default)(this.itemTypes, function (type) { return rules.material(type).location(function (itemLocation) { return (0, rules_api_1.isSameLocationArea)(itemLocation, location); }).getQuantity(); });
137
282
  };
283
+ /**
284
+ * Any css transform to apply to the item when it is hovered by the pointer. See {@link HandLocator} override for example.
285
+ * @param _item The item
286
+ * @param _context Context of the item
287
+ * @returns the list of css transforms
288
+ */
138
289
  Locator.prototype.getHoverTransform = function (_item, _context) {
139
290
  return [];
140
291
  };
292
+ /**
293
+ * How items in the same location area are sorted for the help dialog navigation arrows.
294
+ * @param _context Context of the game
295
+ * @returns The list of sort functions to sort the items.
296
+ */
141
297
  Locator.prototype.getNavigationSorts = function (_context) {
142
298
  return this.navigationSorts;
143
299
  };
300
+ /**
301
+ * Utility function for animation to know if the item is one that should be animated.
302
+ * @param item Item to consider
303
+ * @param context Context of the Item
304
+ * @param move Move to animate
305
+ * @returns true if the items must be animated
306
+ */
307
+ Locator.prototype.isItemToAnimate = function (item, context, move) {
308
+ var _a, _b;
309
+ var rules = context.rules, type = context.type, index = context.index, displayIndex = context.displayIndex;
310
+ if (move.itemType !== type || move.itemIndex !== index)
311
+ return false;
312
+ var quantity = (_a = item.quantity) !== null && _a !== void 0 ? _a : 1;
313
+ var movedQuantity = (_b = move.quantity) !== null && _b !== void 0 ? _b : 1;
314
+ if (quantity === movedQuantity)
315
+ return true;
316
+ // If we move only a part of the quantity, we need to find which displayed items should move
317
+ var droppedItem = rules.game.droppedItem;
318
+ var itemsNotMoving = this.limit ? Math.min(quantity, this.limit) - movedQuantity : quantity - movedQuantity;
319
+ if ((droppedItem === null || droppedItem === void 0 ? void 0 : droppedItem.type) === type && droppedItem.index === index) {
320
+ var droppedIndex = droppedItem.displayIndex;
321
+ if (displayIndex === droppedIndex)
322
+ return true;
323
+ if (droppedIndex < itemsNotMoving)
324
+ itemsNotMoving++;
325
+ }
326
+ return this.getItemIndex(item, context) >= itemsNotMoving;
327
+ };
144
328
  return Locator;
145
329
  }());
146
330
  exports.Locator = Locator;
331
+ /**
332
+ * Type guard to test if some MaterialContext is also an item context.
333
+ * @param context Context of the game
334
+ * @returns true if the context also hold information about a specific item in the game.
335
+ */
147
336
  function isItemContext(context) {
148
337
  var itemContext = context;
149
338
  return itemContext.type !== undefined && itemContext.index !== undefined && itemContext.displayIndex !== undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"Locator.js","sourceRoot":"","sources":["../../src/locators/Locator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,iDAA0I;AAC1I,uDAAgC;AAChC,4CAAmG;AAOnG;IAOE,iBAAY,KAAwB;QAS1B,cAAS,GAAQ,EAAE,CAAA;QAe7B,iBAAY,GAAW,KAAK,CAAA;QAU5B,cAAS,GAAqB,EAAE,CAAA;QAkIhC,qBAAgB,GAAkB,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAA;QAkBlD,gBAAW,GAAyB,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAA;QA0CxD,YAAO,GAAW,CAAC,CAAA;QAqEnB,oBAAe,GAAmB,CAAC,UAAC,IAAI,YAAK,OAAA,MAAA,IAAI,CAAC,QAAQ,CAAC,CAAC,mCAAI,CAAC,CAAA,EAAA,EAAE,UAAC,IAAI,YAAK,OAAA,MAAA,IAAI,CAAC,QAAQ,CAAC,CAAC,mCAAI,CAAC,CAAA,EAAA,EAAE,UAAC,IAAI,YAAK,OAAA,MAAA,IAAI,CAAC,QAAQ,CAAC,CAAC,mCAAI,CAAC,CAAA,EAAA,CAAC,CAAA;QApShI,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;IAC5B,CAAC;IAsC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
@@ -1,17 +1,46 @@
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 in a disorganised pile.
6
+ */
4
7
  export declare class PileLocator<P extends number = number, M extends number = number, L extends number = number> extends Locator<P, M, L> {
5
8
  constructor(clone?: Partial<PileLocator>);
6
9
  private positions;
7
10
  private rotations;
11
+ /**
12
+ * By default, a maximum of 20 items are displayed
13
+ */
8
14
  limit: number;
15
+ /**
16
+ * Maximum dispersion radius of the items.
17
+ */
9
18
  radius: number | XYCoordinates;
19
+ /**
20
+ * Function to override to provide a {@link radius} that depends on the context
21
+ * @param _location Location to position
22
+ * @param _context Context of the game
23
+ * @returns the maximum dispersion radius of the items.
24
+ */
10
25
  getRadius(_location: Location<P, L>, _context: MaterialContext<P, M, L>): number | XYCoordinates;
26
+ /**
27
+ * Maximum angle of rotation of the items. Defaults to 180, bidirectional so items can have any rotation.
28
+ */
11
29
  maxAngle: number;
30
+ /**
31
+ * Function to override to provide a {@link maxAngle} that depends on the context
32
+ * @param _location Location to position
33
+ * @param _context Context of the game
34
+ * @returns the maximum angle of rotation of the items
35
+ */
12
36
  getMaxAngle(_location: Location<P, L>, _context: MaterialContext<P, M, L>): number;
13
- getPileId(location: Location<P, L>, _context: MaterialContext<P, M, L>): string;
14
- getLocationCoordinates(location: Location<P, L>, context: MaterialContext<P, M, L>, index?: number | undefined): Partial<Coordinates>;
37
+ /**
38
+ * Identifier of the pile. By default, distinct location areas (different player, id or parent) forms distinct piles.
39
+ * @param item Item to position
40
+ * @param _context Context of the item
41
+ * @returns a unique identifier for the pile of items this location goes to
42
+ */
43
+ getPileId(item: MaterialItem<P, L>, _context: ItemContext<P, M, L>): string;
15
44
  getItemCoordinates(item: MaterialItem<P, L>, context: ItemContext<P, M, L>): Partial<Coordinates>;
16
45
  getItemRotateZ(item: MaterialItem<P, L>, context: ItemContext<P, M, L>): number;
17
46
  protected generateLocationDescriptionFromDraggedItem(location: Location<P, L>, context: ItemContext<P, M, L>): LocationDescription<P, M, L>;