@gamepark/react-game 6.0.0-alpha.0 → 6.2.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 (264) hide show
  1. package/dist/components/Avatar/Avatar.js +7 -5
  2. package/dist/components/Avatar/Avatar.js.map +1 -1
  3. package/dist/components/GameProvider/GameContext.d.ts +1 -0
  4. package/dist/components/GameProvider/GameContext.js.map +1 -1
  5. package/dist/components/GameProvider/GameProvider.d.ts +1 -1
  6. package/dist/components/GameProvider/GameProvider.js +13 -4
  7. package/dist/components/GameProvider/GameProvider.js.map +1 -1
  8. package/dist/components/ImagesLoader/ImagesLoader.d.ts +2 -3
  9. package/dist/components/ImagesLoader/ImagesLoader.js.map +1 -1
  10. package/dist/components/buttons/PlayMoveButton/PlayMoveButton.js +25 -10
  11. package/dist/components/buttons/PlayMoveButton/PlayMoveButton.js.map +1 -1
  12. package/dist/components/dialogs/ResultDialog/ResultDialog.js +22 -17
  13. package/dist/components/dialogs/ResultDialog/ResultDialog.js.map +1 -1
  14. package/dist/components/dialogs/RulesDialog/LocationRulesDialogContent.d.ts +4 -9
  15. package/dist/components/dialogs/RulesDialog/LocationRulesDialogContent.js +7 -7
  16. package/dist/components/dialogs/RulesDialog/LocationRulesDialogContent.js.map +1 -1
  17. package/dist/components/dialogs/RulesDialog/MaterialRulesDialog.js +5 -17
  18. package/dist/components/dialogs/RulesDialog/MaterialRulesDialog.js.map +1 -1
  19. package/dist/components/dialogs/RulesDialog/MaterialRulesDialogContent.d.ts +3 -6
  20. package/dist/components/dialogs/RulesDialog/MaterialRulesDialogContent.js +8 -8
  21. package/dist/components/dialogs/RulesDialog/MaterialRulesDialogContent.js.map +1 -1
  22. package/dist/components/dialogs/RulesDialog/RulesDialog.d.ts +1 -0
  23. package/dist/components/dialogs/RulesDialog/RulesDialog.js +3 -3
  24. package/dist/components/dialogs/RulesDialog/RulesDialog.js.map +1 -1
  25. package/dist/components/index.d.ts +2 -0
  26. package/dist/components/index.js +2 -0
  27. package/dist/components/index.js.map +1 -1
  28. package/dist/components/material/DraggableMaterial.d.ts +14 -11
  29. package/dist/components/material/DraggableMaterial.js +102 -48
  30. package/dist/components/material/DraggableMaterial.js.map +1 -1
  31. package/dist/components/material/FlatMaterial/BoardDescription.d.ts +3 -0
  32. package/dist/components/material/FlatMaterial/BoardDescription.js +28 -0
  33. package/dist/components/material/FlatMaterial/BoardDescription.js.map +1 -0
  34. package/dist/components/material/FlatMaterial/CardDescription.d.ts +6 -0
  35. package/dist/components/material/FlatMaterial/CardDescription.js +32 -0
  36. package/dist/components/material/FlatMaterial/CardDescription.js.map +1 -0
  37. package/dist/components/material/FlatMaterial/FlatMaterial.d.ts +35 -0
  38. package/dist/components/material/FlatMaterial/FlatMaterial.js +128 -0
  39. package/dist/components/material/FlatMaterial/FlatMaterial.js.map +1 -0
  40. package/dist/components/material/FlatMaterial/TokenDescription.d.ts +10 -0
  41. package/dist/components/material/FlatMaterial/TokenDescription.js +44 -0
  42. package/dist/components/material/FlatMaterial/TokenDescription.js.map +1 -0
  43. package/dist/components/material/FlatMaterial/index.d.ts +4 -0
  44. package/dist/components/material/{Card → FlatMaterial}/index.js +4 -1
  45. package/dist/components/material/FlatMaterial/index.js.map +1 -0
  46. package/dist/components/material/GameTable/GameMaterialDisplay.js +64 -45
  47. package/dist/components/material/GameTable/GameMaterialDisplay.js.map +1 -1
  48. package/dist/components/material/GameTable/GameTable.d.ts +2 -2
  49. package/dist/components/material/GameTable/GameTable.js +64 -16
  50. package/dist/components/material/GameTable/GameTable.js.map +1 -1
  51. package/dist/components/material/GameTable/GameTableContent.js +22 -7
  52. package/dist/components/material/GameTable/GameTableContent.js.map +1 -1
  53. package/dist/components/material/ImageLoader/MaterialImageLoader.d.ts +5 -0
  54. package/dist/components/material/ImageLoader/MaterialImageLoader.js +33 -0
  55. package/dist/components/material/ImageLoader/MaterialImageLoader.js.map +1 -0
  56. package/dist/components/material/ImageLoader/index.d.ts +1 -0
  57. package/dist/components/material/{Token → ImageLoader}/index.js +1 -1
  58. package/dist/components/material/ImageLoader/index.js.map +1 -0
  59. package/dist/components/material/MaterialAnimations.d.ts +11 -14
  60. package/dist/components/material/MaterialAnimations.js +129 -82
  61. package/dist/components/material/MaterialAnimations.js.map +1 -1
  62. package/dist/components/material/MaterialComponent.d.ts +5 -10
  63. package/dist/components/material/MaterialComponent.js +8 -53
  64. package/dist/components/material/MaterialComponent.js.map +1 -1
  65. package/dist/components/material/MaterialDescription.d.ts +31 -18
  66. package/dist/components/material/MaterialDescription.js +36 -0
  67. package/dist/components/material/MaterialDescription.js.map +1 -1
  68. package/dist/components/material/animations/CreateItemAnimations.d.ts +14 -0
  69. package/dist/components/material/animations/CreateItemAnimations.js +72 -0
  70. package/dist/components/material/animations/CreateItemAnimations.js.map +1 -0
  71. package/dist/components/material/animations/DeleteItemAnimations.d.ts +14 -0
  72. package/dist/components/material/animations/DeleteItemAnimations.js +80 -0
  73. package/dist/components/material/animations/DeleteItemAnimations.js.map +1 -0
  74. package/dist/components/material/animations/ItemAnimations.d.ts +7 -0
  75. package/dist/components/material/animations/ItemAnimations.js +31 -0
  76. package/dist/components/material/animations/ItemAnimations.js.map +1 -0
  77. package/dist/components/material/animations/MaterialAnimations.d.ts +19 -0
  78. package/dist/components/material/animations/MaterialAnimations.js +51 -0
  79. package/dist/components/material/animations/MaterialAnimations.js.map +1 -0
  80. package/dist/components/material/animations/MaterialGameAnimations.d.ts +11 -0
  81. package/dist/components/material/animations/MaterialGameAnimations.js +42 -0
  82. package/dist/components/material/animations/MaterialGameAnimations.js.map +1 -0
  83. package/dist/components/material/animations/MoveItemAnimations.d.ts +16 -0
  84. package/dist/components/material/animations/MoveItemAnimations.js +105 -0
  85. package/dist/components/material/animations/MoveItemAnimations.js.map +1 -0
  86. package/dist/components/material/animations/ShuffleAnimations.d.ts +8 -0
  87. package/dist/components/material/animations/ShuffleAnimations.js +34 -0
  88. package/dist/components/material/animations/ShuffleAnimations.js.map +1 -0
  89. package/dist/components/material/animations/adjustRotation.d.ts +1 -0
  90. package/dist/components/material/animations/adjustRotation.js +37 -0
  91. package/dist/components/material/animations/adjustRotation.js.map +1 -0
  92. package/dist/components/material/animations/getFirstStockItemTransforms.util.d.ts +2 -0
  93. package/dist/components/material/animations/getFirstStockItemTransforms.util.js +32 -0
  94. package/dist/components/material/animations/getFirstStockItemTransforms.util.js.map +1 -0
  95. package/dist/components/material/animations/index.d.ts +9 -0
  96. package/dist/components/material/animations/index.js +29 -0
  97. package/dist/components/material/animations/index.js.map +1 -0
  98. package/dist/components/material/animations/isMovedOrDeletedItem.util.d.ts +3 -0
  99. package/dist/components/material/animations/isMovedOrDeletedItem.util.js +28 -0
  100. package/dist/components/material/animations/isMovedOrDeletedItem.util.js.map +1 -0
  101. package/dist/components/material/animations/itemMovementCss.util.d.ts +2 -0
  102. package/dist/components/material/animations/itemMovementCss.util.js +13 -0
  103. package/dist/components/material/animations/itemMovementCss.util.js.map +1 -0
  104. package/dist/components/material/animations/transformItem.util.d.ts +2 -0
  105. package/dist/components/material/animations/transformItem.util.js +11 -0
  106. package/dist/components/material/animations/transformItem.util.js.map +1 -0
  107. package/dist/components/material/index.d.ts +4 -7
  108. package/dist/components/material/index.js +4 -7
  109. package/dist/components/material/index.js.map +1 -1
  110. package/dist/components/material/locations/LocationDescription.d.ts +28 -0
  111. package/dist/components/material/locations/LocationDescription.js +54 -0
  112. package/dist/components/material/locations/LocationDescription.js.map +1 -0
  113. package/dist/components/material/locations/LocationsMask.d.ts +5 -0
  114. package/dist/components/material/locations/LocationsMask.js +48 -0
  115. package/dist/components/material/locations/LocationsMask.js.map +1 -0
  116. package/dist/components/material/locations/SimpleDropArea.d.ts +13 -0
  117. package/dist/components/material/{DropAreas → locations}/SimpleDropArea.js +44 -30
  118. package/dist/components/material/locations/SimpleDropArea.js.map +1 -0
  119. package/dist/components/material/locations/index.d.ts +3 -0
  120. package/dist/components/material/{Board → locations}/index.js +3 -1
  121. package/dist/components/material/locations/index.js.map +1 -0
  122. package/dist/components/material/utils/getItemFromContext.d.ts +3 -0
  123. package/dist/components/material/utils/getItemFromContext.js +10 -0
  124. package/dist/components/material/utils/getItemFromContext.js.map +1 -0
  125. package/dist/components/material/utils/index.d.ts +0 -3
  126. package/dist/components/material/utils/index.js +0 -3
  127. package/dist/components/material/utils/index.js.map +1 -1
  128. package/dist/components/material/utils/isDroppedItem.d.ts +2 -0
  129. package/dist/components/material/utils/isDroppedItem.js +15 -0
  130. package/dist/components/material/utils/isDroppedItem.js.map +1 -0
  131. package/dist/components/material/utils/isPlacedOnItem.d.ts +3 -0
  132. package/dist/components/material/utils/isPlacedOnItem.js +15 -0
  133. package/dist/components/material/utils/isPlacedOnItem.js.map +1 -0
  134. package/dist/components/material/utils/useIsAnimatingPlayerAction.d.ts +1 -0
  135. package/dist/components/material/utils/useIsAnimatingPlayerAction.js +10 -0
  136. package/dist/components/material/utils/useIsAnimatingPlayerAction.js.map +1 -0
  137. package/dist/components/menus/Menu/Menu.js +3 -3
  138. package/dist/components/menus/Menu/Menu.js.map +1 -1
  139. package/dist/components/menus/Result/ResultPopButton.js +1 -1
  140. package/dist/components/menus/Result/ResultPopButton.js.map +1 -1
  141. package/dist/components/tutorial/MaterialTutorial.d.ts +47 -0
  142. package/dist/components/tutorial/MaterialTutorial.js +95 -0
  143. package/dist/components/tutorial/MaterialTutorial.js.map +1 -0
  144. package/dist/components/tutorial/MaterialTutorialDisplay.d.ts +1 -0
  145. package/dist/components/tutorial/MaterialTutorialDisplay.js +73 -0
  146. package/dist/components/tutorial/MaterialTutorialDisplay.js.map +1 -0
  147. package/dist/components/tutorial/TutorialRulesWrapper.d.ts +3 -0
  148. package/dist/components/tutorial/TutorialRulesWrapper.js +60 -0
  149. package/dist/components/tutorial/TutorialRulesWrapper.js.map +1 -0
  150. package/dist/components/tutorial/index.d.ts +1 -0
  151. package/dist/components/{material/DropAreas → tutorial}/index.js +1 -1
  152. package/dist/components/tutorial/index.js.map +1 -0
  153. package/dist/css/componentSizeCss.d.ts +1 -5
  154. package/dist/css/componentSizeCss.js +1 -1
  155. package/dist/css/componentSizeCss.js.map +1 -1
  156. package/dist/css/fadeIn.d.ts +1 -0
  157. package/dist/css/fadeIn.js +13 -0
  158. package/dist/css/fadeIn.js.map +1 -0
  159. package/dist/css/index.d.ts +2 -0
  160. package/dist/css/index.js +2 -0
  161. package/dist/css/index.js.map +1 -1
  162. package/dist/css/shadowEffect.d.ts +1 -0
  163. package/dist/css/shadowEffect.js +11 -0
  164. package/dist/css/shadowEffect.js.map +1 -0
  165. package/dist/css/transformCss.d.ts +1 -0
  166. package/dist/css/transformCss.js +3 -2
  167. package/dist/css/transformCss.js.map +1 -1
  168. package/dist/hooks/index.d.ts +3 -0
  169. package/dist/hooks/index.js +3 -0
  170. package/dist/hooks/index.js.map +1 -1
  171. package/dist/hooks/useItemLocator.js +2 -3
  172. package/dist/hooks/useItemLocator.js.map +1 -1
  173. package/dist/hooks/useLegalMoves.js +11 -6
  174. package/dist/hooks/useLegalMoves.js.map +1 -1
  175. package/dist/hooks/useLocators.d.ts +1 -0
  176. package/dist/hooks/useLocators.js +8 -0
  177. package/dist/hooks/useLocators.js.map +1 -0
  178. package/dist/hooks/useMaterialContext.d.ts +2 -0
  179. package/dist/hooks/useMaterialContext.js +18 -0
  180. package/dist/hooks/useMaterialContext.js.map +1 -0
  181. package/dist/hooks/useMaterials.d.ts +2 -0
  182. package/dist/hooks/useMaterials.js +10 -0
  183. package/dist/hooks/useMaterials.js.map +1 -0
  184. package/dist/hooks/usePlayerName.js +12 -1
  185. package/dist/hooks/usePlayerName.js.map +1 -1
  186. package/dist/hooks/usePlayers.js +1 -1
  187. package/dist/hooks/usePlayers.js.map +1 -1
  188. package/dist/hooks/useRulesStep.d.ts +2 -0
  189. package/dist/hooks/useRulesStep.js +10 -0
  190. package/dist/hooks/useRulesStep.js.map +1 -0
  191. package/dist/hooks/useTutorialStep.d.ts +2 -0
  192. package/dist/hooks/useTutorialStep.js +15 -0
  193. package/dist/hooks/useTutorialStep.js.map +1 -0
  194. package/dist/hooks/useZoomToElements.d.ts +5 -0
  195. package/dist/hooks/useZoomToElements.js +65 -0
  196. package/dist/hooks/useZoomToElements.js.map +1 -0
  197. package/dist/index.d.ts +1 -0
  198. package/dist/locators/DeckLocator.d.ts +4 -4
  199. package/dist/locators/DeckLocator.js +3 -2
  200. package/dist/locators/DeckLocator.js.map +1 -1
  201. package/dist/locators/HandLocator.d.ts +11 -11
  202. package/dist/locators/HandLocator.js.map +1 -1
  203. package/dist/locators/ItemLocator.d.ts +31 -41
  204. package/dist/locators/ItemLocator.js +33 -90
  205. package/dist/locators/ItemLocator.js.map +1 -1
  206. package/dist/locators/LineLocator.d.ts +7 -5
  207. package/dist/locators/LineLocator.js +10 -1
  208. package/dist/locators/LineLocator.js.map +1 -1
  209. package/dist/locators/PileLocator.d.ts +8 -6
  210. package/dist/locators/PileLocator.js +13 -1
  211. package/dist/locators/PileLocator.js.map +1 -1
  212. package/dist/utilities/animations.constants.d.ts +16 -0
  213. package/dist/utilities/animations.constants.js +82 -0
  214. package/dist/utilities/animations.constants.js.map +1 -0
  215. package/dist/utilities/animations.util.d.ts +4 -0
  216. package/dist/utilities/animations.util.js +78 -0
  217. package/dist/utilities/animations.util.js.map +1 -0
  218. package/dist/utilities/bounds.util.d.ts +18 -0
  219. package/dist/utilities/bounds.util.js +85 -0
  220. package/dist/utilities/bounds.util.js.map +1 -0
  221. package/dist/utilities/calculation.util.d.ts +14 -0
  222. package/dist/utilities/calculation.util.js +24 -0
  223. package/dist/utilities/calculation.util.js.map +1 -0
  224. package/dist/utilities/zoom.util.d.ts +4 -0
  225. package/dist/utilities/zoom.util.js +17 -0
  226. package/dist/utilities/zoom.util.js.map +1 -0
  227. package/package.json +7 -5
  228. package/dist/components/material/Board/Board.d.ts +0 -17
  229. package/dist/components/material/Board/Board.js +0 -34
  230. package/dist/components/material/Board/Board.js.map +0 -1
  231. package/dist/components/material/Board/index.d.ts +0 -1
  232. package/dist/components/material/Board/index.js.map +0 -1
  233. package/dist/components/material/Card/Card.d.ts +0 -23
  234. package/dist/components/material/Card/Card.js +0 -49
  235. package/dist/components/material/Card/Card.js.map +0 -1
  236. package/dist/components/material/Card/index.d.ts +0 -1
  237. package/dist/components/material/Card/index.js.map +0 -1
  238. package/dist/components/material/DropAreas/SimpleDropArea.d.ts +0 -12
  239. package/dist/components/material/DropAreas/SimpleDropArea.js.map +0 -1
  240. package/dist/components/material/DropAreas/index.d.ts +0 -1
  241. package/dist/components/material/DropAreas/index.js.map +0 -1
  242. package/dist/components/material/Items.d.ts +0 -4
  243. package/dist/components/material/Items.js +0 -3
  244. package/dist/components/material/Items.js.map +0 -1
  245. package/dist/components/material/Token/Token.d.ts +0 -18
  246. package/dist/components/material/Token/Token.js +0 -34
  247. package/dist/components/material/Token/Token.js.map +0 -1
  248. package/dist/components/material/Token/index.d.ts +0 -1
  249. package/dist/components/material/Token/index.js.map +0 -1
  250. package/dist/components/material/utils/IsMoveThisItem.d.ts +0 -2
  251. package/dist/components/material/utils/IsMoveThisItem.js +0 -12
  252. package/dist/components/material/utils/IsMoveThisItem.js.map +0 -1
  253. package/dist/components/material/utils/IsMoveThisItemToLocation.d.ts +0 -3
  254. package/dist/components/material/utils/IsMoveThisItemToLocation.js +0 -11
  255. package/dist/components/material/utils/IsMoveThisItemToLocation.js.map +0 -1
  256. package/dist/components/material/utils/IsMoveToLocation.d.ts +0 -2
  257. package/dist/components/material/utils/IsMoveToLocation.js +0 -13
  258. package/dist/components/material/utils/IsMoveToLocation.js.map +0 -1
  259. package/dist/components/material/utils/IsMoveToStock.d.ts +0 -4
  260. package/dist/components/material/utils/IsMoveToStock.js +0 -18
  261. package/dist/components/material/utils/IsMoveToStock.js.map +0 -1
  262. package/dist/hooks/useStocks.d.ts +0 -2
  263. package/dist/hooks/useStocks.js +0 -12
  264. package/dist/hooks/useStocks.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getFirstStockItemTransforms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 @@
1
+ export * from './CreateItemAnimations';
2
+ export * from './DeleteItemAnimations';
3
+ export * from './ItemAnimations';
4
+ export * from './MaterialAnimations';
5
+ export * from './MaterialGameAnimations';
6
+ export * from './MoveItemAnimations';
7
+ export * from './ShuffleAnimations';
8
+ export { transformItem } from './transformItem.util';
9
+ export { movementAnimationCss } from './itemMovementCss.util';
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.movementAnimationCss = exports.transformItem = void 0;
18
+ __exportStar(require("./CreateItemAnimations"), exports);
19
+ __exportStar(require("./DeleteItemAnimations"), exports);
20
+ __exportStar(require("./ItemAnimations"), exports);
21
+ __exportStar(require("./MaterialAnimations"), exports);
22
+ __exportStar(require("./MaterialGameAnimations"), exports);
23
+ __exportStar(require("./MoveItemAnimations"), exports);
24
+ __exportStar(require("./ShuffleAnimations"), exports);
25
+ var transformItem_util_1 = require("./transformItem.util");
26
+ Object.defineProperty(exports, "transformItem", { enumerable: true, get: function () { return transformItem_util_1.transformItem; } });
27
+ var itemMovementCss_util_1 = require("./itemMovementCss.util");
28
+ Object.defineProperty(exports, "movementAnimationCss", { enumerable: true, get: function () { return itemMovementCss_util_1.movementAnimationCss; } });
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/material/animations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yDAAsC;AACtC,yDAAsC;AACtC,mDAAgC;AAChC,uDAAoC;AACpC,2DAAwC;AACxC,uDAAoC;AACpC,sDAAmC;AACnC,2DAAoD;AAA3C,mHAAA,aAAa,OAAA;AACtB,+DAA6D;AAApD,4HAAA,oBAAoB,OAAA"}
@@ -0,0 +1,3 @@
1
+ import { DeleteItem, MoveItem } from '@gamepark/rules-api';
2
+ import { ItemContext } from '../../../locators';
3
+ export declare const isMovedOrDeletedItem: <P extends number = number, M extends number = number, L extends number = number>({ game, type, index, displayIndex, locators }: ItemContext<P, M, L>, move: MoveItem<P, M, L> | DeleteItem<M>) => boolean;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isMovedOrDeletedItem = void 0;
4
+ var isMovedOrDeletedItem = function (_a, move) {
5
+ var _b, _c, _d;
6
+ var game = _a.game, type = _a.type, index = _a.index, displayIndex = _a.displayIndex, locators = _a.locators;
7
+ if (move.itemType !== type || move.itemIndex !== index)
8
+ return false;
9
+ var item = game.items[type][index];
10
+ var quantity = (_b = item.quantity) !== null && _b !== void 0 ? _b : 1;
11
+ if (quantity === 1)
12
+ return true;
13
+ var itemLocator = locators[item.location.type];
14
+ if (itemLocator.limit)
15
+ quantity = Math.min(quantity, itemLocator.limit);
16
+ var movedQuantity = (_c = move.quantity) !== null && _c !== void 0 ? _c : 1;
17
+ if (((_d = game.droppedItem) === null || _d === void 0 ? void 0 : _d.type) === type && game.droppedItem.index === index) {
18
+ var droppedIndex = game.droppedItem.displayIndex;
19
+ if (displayIndex === droppedIndex)
20
+ return true;
21
+ if (droppedIndex < quantity - movedQuantity) {
22
+ return displayIndex > quantity - movedQuantity;
23
+ }
24
+ }
25
+ return displayIndex >= quantity - movedQuantity;
26
+ };
27
+ exports.isMovedOrDeletedItem = isMovedOrDeletedItem;
28
+ //# sourceMappingURL=isMovedOrDeletedItem.util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isMovedOrDeletedItem.util.js","sourceRoot":"","sources":["../../../../src/components/material/animations/isMovedOrDeletedItem.util.ts"],"names":[],"mappings":";;;AAGO,IAAM,oBAAoB,GAAG,UAClC,EAAmE,EAAE,IAAuC;;QAA1G,IAAI,UAAA,EAAE,IAAI,UAAA,EAAE,KAAK,WAAA,EAAE,YAAY,kBAAA,EAAE,QAAQ,cAAA;IAE3C,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK;QAAE,OAAO,KAAK,CAAA;IACpE,IAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAE,CAAC,KAAK,CAAC,CAAA;IACrC,IAAI,QAAQ,GAAG,MAAA,IAAI,CAAC,QAAQ,mCAAI,CAAC,CAAA;IACjC,IAAI,QAAQ,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IAC/B,IAAM,WAAW,GAAG,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;IAChD,IAAI,WAAW,CAAC,KAAK;QAAE,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,WAAW,CAAC,KAAK,CAAC,CAAA;IACvE,IAAM,aAAa,GAAG,MAAA,IAAI,CAAC,QAAQ,mCAAI,CAAC,CAAA;IACxC,IAAI,CAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,IAAI,MAAK,IAAI,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,KAAK,KAAK,EAAE;QACvE,IAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,YAAY,CAAA;QAClD,IAAI,YAAY,KAAK,YAAY;YAAE,OAAO,IAAI,CAAA;QAC9C,IAAI,YAAY,GAAG,QAAQ,GAAG,aAAa,EAAE;YAC3C,OAAO,YAAY,GAAG,QAAQ,GAAG,aAAa,CAAA;SAC/C;KACF;IACD,OAAO,YAAY,IAAI,QAAQ,GAAG,aAAa,CAAA;AACjD,CAAC,CAAA;AAlBY,QAAA,oBAAoB,wBAkBhC"}
@@ -0,0 +1,2 @@
1
+ import { Keyframes } from '@emotion/react';
2
+ export declare const movementAnimationCss: (keyframes: Keyframes, duration: number) => import("@emotion/utils").SerializedStyles;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
+ return cooked;
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.movementAnimationCss = void 0;
8
+ var react_1 = require("@emotion/react");
9
+ var movementAnimationCss = function (keyframes, duration) { return (0, react_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n animation: ", " ", "s linear infinite;\n\n > * {\n animation: ", " ", "s ease-in-out forwards;\n }\n"], ["\n animation: ", " ", "s linear infinite;\n\n > * {\n animation: ", " ", "s ease-in-out forwards;\n }\n"])), upAndDown, duration, keyframes, duration); };
10
+ exports.movementAnimationCss = movementAnimationCss;
11
+ var upAndDown = (0, react_1.keyframes)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n from, to {\n transform: none;\n }\n 50% {\n transform: translateZ(10em);\n }\n"], ["\n from, to {\n transform: none;\n }\n 50% {\n transform: translateZ(10em);\n }\n"])));
12
+ var templateObject_1, templateObject_2;
13
+ //# sourceMappingURL=itemMovementCss.util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"itemMovementCss.util.js","sourceRoot":"","sources":["../../../../src/components/material/animations/itemMovementCss.util.ts"],"names":[],"mappings":";;;;;;;AAAA,wCAA0D;AAEnD,IAAM,oBAAoB,GAAG,UAAC,SAAoB,EAAE,QAAgB,IAAK,WAAA,WAAG,mLAAA,iBACpE,EAAS,GAAI,EAAQ,gDAGnB,EAAS,GAAI,EAAQ,gCAErC,KALc,SAAS,EAAI,QAAQ,EAGnB,SAAS,EAAI,QAAQ,GAJ0C,CAM/E,CAAA;AANY,QAAA,oBAAoB,wBAMhC;AAED,IAAM,SAAS,OAAG,iBAAS,iKAAA,6FAO1B,IAAA,CAAA"}
@@ -0,0 +1,2 @@
1
+ import { ItemContext } from '../../../locators';
2
+ export declare function transformItem<P extends number = number, M extends number = number, L extends number = number>(context: ItemContext<P, M, L>): string[];
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.transformItem = void 0;
4
+ function transformItem(context) {
5
+ var game = context.game, type = context.type, index = context.index, locators = context.locators;
6
+ var currentItem = game.items[type][index];
7
+ var sourceLocator = locators[currentItem.location.type];
8
+ return sourceLocator.transformItem(currentItem, context);
9
+ }
10
+ exports.transformItem = transformItem;
11
+ //# sourceMappingURL=transformItem.util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transformItem.util.js","sourceRoot":"","sources":["../../../../src/components/material/animations/transformItem.util.ts"],"names":[],"mappings":";;;AAGA,SAAgB,aAAa,CAAkF,OAA6B;IAClI,IAAA,IAAI,GAA4B,OAAO,KAAnC,EAAE,IAAI,GAAsB,OAAO,KAA7B,EAAE,KAAK,GAAe,OAAO,MAAtB,EAAE,QAAQ,GAAK,OAAO,SAAZ,CAAY;IAC/C,IAAM,WAAW,GAAuB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAE,CAAC,KAAK,CAAC,CAAA;IAChE,IAAM,aAAa,GAAG,QAAQ,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;IACzD,OAAO,aAAa,CAAC,aAAa,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;AAC1D,CAAC;AALD,sCAKC"}
@@ -1,11 +1,8 @@
1
- export * from './Board';
2
- export * from './Card';
3
- export * from './DropAreas';
1
+ export * from './animations';
2
+ export * from './locations';
3
+ export * from './FlatMaterial';
4
4
  export * from './GameTable';
5
- export * from './Token';
6
- export * from './Items';
7
- export * from './MaterialAnimations';
8
5
  export * from './MaterialComponent';
9
6
  export * from './MaterialComponentType';
10
7
  export * from './MaterialDescription';
11
- export * from './MaterialGameAnimations';
8
+ export * from './ImageLoader';
@@ -14,15 +14,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./Board"), exports);
18
- __exportStar(require("./Card"), exports);
19
- __exportStar(require("./DropAreas"), exports);
17
+ __exportStar(require("./animations"), exports);
18
+ __exportStar(require("./locations"), exports);
19
+ __exportStar(require("./FlatMaterial"), exports);
20
20
  __exportStar(require("./GameTable"), exports);
21
- __exportStar(require("./Token"), exports);
22
- __exportStar(require("./Items"), exports);
23
- __exportStar(require("./MaterialAnimations"), exports);
24
21
  __exportStar(require("./MaterialComponent"), exports);
25
22
  __exportStar(require("./MaterialComponentType"), exports);
26
23
  __exportStar(require("./MaterialDescription"), exports);
27
- __exportStar(require("./MaterialGameAnimations"), exports);
24
+ __exportStar(require("./ImageLoader"), exports);
28
25
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/material/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAuB;AACvB,yCAAsB;AACtB,8CAA2B;AAC3B,8CAA2B;AAC3B,0CAAuB;AACvB,0CAAuB;AACvB,uDAAoC;AACpC,sDAAmC;AACnC,0DAAuC;AACvC,wDAAqC;AACrC,2DAAwC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/material/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA4B;AAC5B,8CAA2B;AAC3B,iDAA8B;AAC9B,8CAA2B;AAC3B,sDAAmC;AACnC,0DAAuC;AACvC,wDAAqC;AACrC,gDAA6B"}
@@ -0,0 +1,28 @@
1
+ import { FC } from 'react';
2
+ import { LocationRulesProps, MaterialContext } from '../../../locators';
3
+ import { ComponentSize } from '../MaterialDescription';
4
+ import { Coordinates, Location, MaterialMove } from '@gamepark/rules-api';
5
+ import { Interpolation, Theme } from '@emotion/react';
6
+ export declare abstract class LocationDescription<P extends number = number, M extends number = number, L extends number = number> {
7
+ rules?: FC<LocationRulesProps<P, L>>;
8
+ height?: number;
9
+ width?: number;
10
+ ratio?: number;
11
+ rotationUnit: string;
12
+ location?: Location<P, L>;
13
+ locations: Location<P, L>[];
14
+ getLocations(_context: MaterialContext<P, M, L>): Location<P, L>[];
15
+ getSize(_location: Location<P, L>, _context: MaterialContext<P, M, L>): ComponentSize;
16
+ borderRadius?: number;
17
+ getBorderRadius(_location: Location<P, L>, _context: MaterialContext<P, M, L>): number | undefined;
18
+ extraCss?: Interpolation<Theme>;
19
+ getExtraCss(_location: Location<P, L>, _context: MaterialContext<P, M, L>): Interpolation<Theme>;
20
+ coordinates?: Coordinates;
21
+ getCoordinates(_location: Location<P, L>, _context: MaterialContext<P, M, L>): Coordinates | undefined;
22
+ getRotation?(location: Location<P, L>, context: MaterialContext<P, M, L>): number;
23
+ alwaysVisible?: boolean;
24
+ isAlwaysVisible(location: Location<P, L>, context: MaterialContext<P, M, L>): boolean;
25
+ canDrop(move: MaterialMove<P, M, L>, location: Location<P, L>, context: MaterialContext<P, M, L>): boolean;
26
+ canDropToMove(move: MaterialMove<P, M, L>, location: Location<P, L>, _context: MaterialContext<P, M, L>): boolean;
27
+ canDropToDelete(move: MaterialMove<P, M, L>, location: Location<P, L>, context: MaterialContext<P, M, L>): boolean;
28
+ }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.LocationDescription = void 0;
7
+ var rules_api_1 = require("@gamepark/rules-api");
8
+ var utils_1 = require("../utils");
9
+ var fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
10
+ var getItemFromContext_1 = require("../utils/getItemFromContext");
11
+ var LocationDescription = /** @class */ (function () {
12
+ function LocationDescription() {
13
+ this.rotationUnit = 'deg';
14
+ this.locations = [];
15
+ }
16
+ LocationDescription.prototype.getLocations = function (_context) {
17
+ return this.location ? [this.location] : this.locations;
18
+ };
19
+ LocationDescription.prototype.getSize = function (_location, _context) {
20
+ if (this.width && this.height)
21
+ return { width: this.width, height: this.height };
22
+ if (this.ratio && this.width)
23
+ return { width: this.width, height: this.width / this.ratio };
24
+ if (this.ratio && this.height)
25
+ return { width: this.height * this.ratio, height: this.height };
26
+ throw new Error('You must implement 2 of "width", "height" & "ratio" in any Location description');
27
+ };
28
+ LocationDescription.prototype.getBorderRadius = function (_location, _context) {
29
+ return this.borderRadius;
30
+ };
31
+ LocationDescription.prototype.getExtraCss = function (_location, _context) {
32
+ return this.extraCss;
33
+ };
34
+ LocationDescription.prototype.getCoordinates = function (_location, _context) {
35
+ return this.coordinates;
36
+ };
37
+ LocationDescription.prototype.isAlwaysVisible = function (location, context) {
38
+ if (this.alwaysVisible !== undefined)
39
+ return this.alwaysVisible;
40
+ return context.locators[location.type].parentItemType !== undefined;
41
+ };
42
+ LocationDescription.prototype.canDrop = function (move, location, context) {
43
+ return this.canDropToMove(move, location, context) || this.canDropToDelete(move, location, context);
44
+ };
45
+ LocationDescription.prototype.canDropToMove = function (move, location, _context) {
46
+ return (0, rules_api_1.isMoveItem)(move) && move.position.location !== undefined && (0, utils_1.isLocationSubset)(move.position.location, location);
47
+ };
48
+ LocationDescription.prototype.canDropToDelete = function (move, location, context) {
49
+ return (0, rules_api_1.isDeleteItem)(move) && (0, fast_deep_equal_1.default)(location, context.material[move.itemType].getStockLocation((0, getItemFromContext_1.getItemFromContext)(context, move.itemType, move.itemIndex), context));
50
+ };
51
+ return LocationDescription;
52
+ }());
53
+ exports.LocationDescription = LocationDescription;
54
+ //# sourceMappingURL=LocationDescription.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LocationDescription.js","sourceRoot":"","sources":["../../../../src/components/material/locations/LocationDescription.ts"],"names":[],"mappings":";;;;;;AAGA,iDAAmG;AAEnG,kCAA2C;AAC3C,oEAAmC;AACnC,kEAAgE;AAEhE;IAAA;QAKE,iBAAY,GAAG,KAAK,CAAA;QAGpB,cAAS,GAAqB,EAAE,CAAA;IAqDlC,CAAC;IAnDC,0CAAY,GAAZ,UAAa,QAAkC;QAC7C,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAA;IACzD,CAAC;IAED,qCAAO,GAAP,UAAQ,SAAyB,EAAE,QAAkC;QACnE,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM;YAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAA;QAChF,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK;YAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE,CAAA;QAC3F,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM;YAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAA;QAC9F,MAAM,IAAI,KAAK,CAAC,iFAAiF,CAAC,CAAA;IACpG,CAAC;IAID,6CAAe,GAAf,UAAgB,SAAyB,EAAE,QAAkC;QAC3E,OAAO,IAAI,CAAC,YAAY,CAAA;IAC1B,CAAC;IAID,yCAAW,GAAX,UAAY,SAAyB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7DqB,kDAAmB"}
@@ -0,0 +1,5 @@
1
+ import { Location } from '@gamepark/rules-api';
2
+ export type LocationsMaskProps = {
3
+ locations: Location[];
4
+ };
5
+ export declare const LocationsMask: ({ locations }: LocationsMaskProps) => JSX.Element;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.LocationsMask = void 0;
18
+ var jsx_runtime_1 = require("react/jsx-runtime");
19
+ var hooks_1 = require("../../../hooks");
20
+ var uniqueId_1 = __importDefault(require("lodash/uniqueId"));
21
+ var react_1 = require("react");
22
+ var LocationsMask = function (_a) {
23
+ var locations = _a.locations;
24
+ var id = (0, react_1.useMemo)(function () { return (0, uniqueId_1.default)('mask'); }, []);
25
+ if (!locations.length)
26
+ return null;
27
+ return ((0, jsx_runtime_1.jsxs)("svg", __assign({ width: "100%", height: "100%" }, { children: [(0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsxs)("mask", __assign({ id: id }, { children: [(0, jsx_runtime_1.jsx)("rect", { width: "100%", height: "100%", fill: "white" }), locations.map(function (location) { return (0, jsx_runtime_1.jsx)(LocationRect, { location: location }, JSON.stringify(location)); })] })) }), (0, jsx_runtime_1.jsx)("rect", { width: "100%", height: "100%", fill: "black", fillOpacity: 0.5, mask: "url(#".concat(id, ")") })] })));
28
+ };
29
+ exports.LocationsMask = LocationsMask;
30
+ var LocationRect = function (_a) {
31
+ var location = _a.location;
32
+ var locator = (0, hooks_1.useItemLocator)(location.type);
33
+ var description = locator.locationDescription;
34
+ var context = (0, hooks_1.useMaterialContext)();
35
+ var position = locator.getPositionOnParent(location, context);
36
+ var _b = description.getSize(location, context), width = _b.width, height = _b.height;
37
+ var radius = description.getBorderRadius(location, context);
38
+ var coordinates = description.getCoordinates(location, context);
39
+ var transforms = ['translate(-50%, -50%)'];
40
+ if (coordinates) {
41
+ transforms.push("translate3d(".concat(coordinates.x, "em, ").concat(coordinates.y, "em, ").concat(coordinates.z, "em)"));
42
+ }
43
+ if (description.getRotation) {
44
+ transforms.push("rotate(".concat(description.getRotation(location, context)).concat(description.rotationUnit, ")"));
45
+ }
46
+ return ((0, jsx_runtime_1.jsx)("rect", { fill: "black", x: "".concat(position.x, "%"), y: "".concat(position.y, "%"), width: "".concat(width, "em"), height: "".concat(height, "em"), rx: "".concat(radius, "em"), ry: "".concat(radius, "em"), style: { transformBox: 'fill-box', transformOrigin: 'center', transform: transforms.join(' ') } }));
47
+ };
48
+ //# sourceMappingURL=LocationsMask.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LocationsMask.js","sourceRoot":"","sources":["../../../../src/components/material/locations/LocationsMask.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,wCAAmE;AACnE,6DAAsC;AACtC,+BAA+B;AAMxB,IAAM,aAAa,GAAG,UAAC,EAAiC;QAA/B,SAAS,eAAA;IACvC,IAAM,EAAE,GAAG,IAAA,eAAO,EAAC,cAAM,OAAA,IAAA,kBAAQ,EAAC,MAAM,CAAC,EAAhB,CAAgB,EAAE,EAAE,CAAC,CAAA;IAC9C,IAAI,CAAC,SAAS,CAAC,MAAM;QAAE,OAAO,IAAI,CAAA;IAClC,OAAO,CACL,0CAAK,KAAK,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,iBAC7B,2CACE,2CAAM,EAAE,EAAE,EAAE,iBACV,iCAAM,KAAK,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,GAAE,EAC9C,S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,CAAC,iBAAU,WAAW,CAAC,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,SAAG,WAAW,CAAC,YAAY,MAAG,CAAC,CAAA;KACpG;IACD,OAAO,CACL,iCAAM,IAAI,EAAC,OAAO,EAAC,CAAC,EAAE,UAAG,QAAQ,CAAC,CAAC,MAAG,EAAE,CAAC,EAAE,UAAG,QAAQ,CAAC,CAAC,MAAG,EAAE,KAAK,EAAE,UAAG,KAAK,OAAI,EAAE,MAAM,EAAE,UAAG,MAAM,OAAI,EAAE,EAAE,EAAE,UAAG,MAAM,OAAI,EAAE,EAAE,EAAE,UAAG,MAAM,OAAI,EACvI,KAAK,EAAE,EAAE,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,CACzG,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,13 @@
1
+ /** @jsxImportSource @emotion/react */
2
+ import { HTMLAttributes } from 'react';
3
+ import { Location } from '@gamepark/rules-api';
4
+ export type SimpleDropAreaProps<P extends number = number, L extends number = number> = {
5
+ location: Location<P, L>;
6
+ onShortClick?: () => void;
7
+ onLongClick?: () => void;
8
+ } & HTMLAttributes<HTMLDivElement>;
9
+ export declare const SimpleDropArea: import("react").ForwardRefExoticComponent<{
10
+ location: Location<number, number, any>;
11
+ onShortClick?: () => void;
12
+ onLongClick?: () => void;
13
+ } & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
@@ -26,7 +26,7 @@ var __rest = (this && this.__rest) || function (s, e) {
26
26
  return t;
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.isDropLocation = exports.SimpleDropArea = void 0;
29
+ exports.SimpleDropArea = void 0;
30
30
  var jsx_runtime_1 = require("@emotion/react/jsx-runtime");
31
31
  /** @jsxImportSource @emotion/react */
32
32
  var react_1 = require("react");
@@ -36,39 +36,41 @@ var use_long_press_1 = require("use-long-press");
36
36
  var hooks_1 = require("../../../hooks");
37
37
  var css_1 = require("../../../css");
38
38
  var core_1 = require("@dnd-kit/core");
39
- var utils_1 = require("../utils");
40
39
  var DraggableMaterial_1 = require("../DraggableMaterial");
41
40
  var utilities_1 = require("../../../utilities");
42
- var useStocks_1 = require("../../../hooks/useStocks");
43
- var SimpleDropArea = function (_a) {
44
- var location = _a.location, legalMoves = _a.legalMoves, onShortClick = _a.onShortClick, onLongClick = _a.onLongClick, dragOnly = _a.dragOnly, props = __rest(_a, ["location", "legalMoves", "onShortClick", "onLongClick", "dragOnly"]);
45
- var locator = (0, hooks_1.useItemLocator)(location.type);
46
- var stocks = (0, useStocks_1.useStocks)();
41
+ var react_merge_refs_1 = require("react-merge-refs");
42
+ exports.SimpleDropArea = (0, react_1.forwardRef)(function (_a, ref) {
43
+ var _b;
44
+ var location = _a.location, onShortClick = _a.onShortClick, onLongClick = _a.onLongClick, props = __rest(_a, ["location", "onShortClick", "onLongClick"]);
45
+ var context = (0, hooks_1.useMaterialContext)();
46
+ var material = context.material;
47
+ var locator = context.locators[location.type];
48
+ var description = locator === null || locator === void 0 ? void 0 : locator.locationDescription;
47
49
  var rules = (0, hooks_1.useRules)();
48
50
  var play = (0, hooks_1.usePlay)();
49
51
  var player = (0, hooks_1.usePlayerId)();
52
+ var predicate = (0, react_1.useCallback)(function (move) { return !!rules && !!description && description.canDrop(move, location, context); }, [rules, locator, context, location]);
53
+ var legalMoves = (0, hooks_1.useLegalMoves)(predicate);
50
54
  if (!onLongClick && legalMoves.length === 1) {
51
55
  onLongClick = function () { return play(legalMoves[0], { delayed: rules === null || rules === void 0 ? void 0 : rules.isUnpredictableMove(legalMoves[0], player) }); };
52
56
  }
53
- if (!onShortClick && (locator === null || locator === void 0 ? void 0 : locator.getLocationRules)) {
57
+ if (!onShortClick && ((_b = locator === null || locator === void 0 ? void 0 : locator.locationDescription) === null || _b === void 0 ? void 0 : _b.rules)) {
54
58
  onShortClick = function () { return play((0, rules_api_1.displayLocationRules)(location), { local: true }); };
55
59
  if (!onLongClick) {
56
60
  onLongClick = function () { return play((0, rules_api_1.displayLocationRules)(location), { local: true }); };
57
61
  }
58
62
  }
59
- var _b = (0, core_1.useDroppable)({
63
+ var _c = (0, core_1.useDroppable)({
60
64
  id: JSON.stringify(location),
61
65
  disabled: !legalMoves.length,
62
66
  data: location
63
- }), isOver = _b.isOver, active = _b.active, setNodeRef = _b.setNodeRef;
64
- var draggedItem = (0, DraggableMaterial_1.isDraggedItem)(active === null || active === void 0 ? void 0 : active.data.current) ? active === null || active === void 0 ? void 0 : active.data.current : undefined;
65
- var canDrop = draggedItem !== undefined && legalMoves.filter(function (move) {
66
- return rules === null || rules === void 0 ? void 0 : rules.isMoveTrigger(move, function (move) {
67
- return (0, utils_1.isMoveThisItemToLocation)(move, draggedItem.type, draggedItem.index, location, stocks);
68
- });
69
- }).length === 1;
67
+ }), isOver = _c.isOver, active = _c.active, setNodeRef = _c.setNodeRef;
68
+ var draggedItem = (0, DraggableMaterial_1.dataIsDisplayedItem)(active === null || active === void 0 ? void 0 : active.data.current) ? active === null || active === void 0 ? void 0 : active.data.current : undefined;
69
+ var canDrop = (0, react_1.useMemo)(function () { return !!draggedItem && !!description && !!material && legalMoves.filter(function (move) {
70
+ return material[draggedItem.type].canDrag(move, __assign(__assign({}, context), draggedItem)) && description.canDrop(move, location, context);
71
+ }).length === 1; }, [draggedItem, legalMoves, rules]);
70
72
  var animations = (0, hooks_1.useAnimations)(function (animation) { return animation.action.playerId === player; });
71
- var _c = (0, react_1.useState)(false), clicking = _c[0], setClicking = _c[1];
73
+ var _d = (0, react_1.useState)(false), clicking = _d[0], setClicking = _d[1];
72
74
  var listeners = (0, use_long_press_1.useLongPress)(function () { return onLongClick && onLongClick(); }, {
73
75
  detect: use_long_press_1.LongPressEventType.Pointer,
74
76
  cancelOnMovement: 5,
@@ -89,20 +91,36 @@ var SimpleDropArea = function (_a) {
89
91
  },
90
92
  filterEvents: function (event) { return !event.button; } // Ignore clicks on mouse buttons > 0
91
93
  })();
92
- if (!canDrop && dragOnly)
94
+ if (!description) {
95
+ console.warn('You must provide a LocationDescription to create drop locations with an ItemLocator');
93
96
  return null;
94
- return (0, jsx_runtime_1.jsx)("div", __assign({ ref: setNodeRef, css: [
97
+ }
98
+ if (!description.isAlwaysVisible(location, context) && !canDrop)
99
+ return null;
100
+ var _e = description.getSize(location, context), width = _e.width, height = _e.height;
101
+ var borderRadius = description.getBorderRadius(location, context);
102
+ var coordinates = description.getCoordinates(location, context);
103
+ return (0, jsx_runtime_1.jsx)("div", __assign({ ref: (0, react_merge_refs_1.mergeRefs)([ref, setNodeRef]), css: [
104
+ absolute,
105
+ locator.parentItemType !== undefined && positionOnParentCss(locator.getPositionOnParent(location, context)),
106
+ (0, css_1.transformCss)('translate(-50%, -50%)', coordinates && "translate3d(".concat(coordinates.x, "em, ").concat(coordinates.y, "em, ").concat(coordinates.z, "em)"), description.getRotation && "rotate(".concat(description.getRotation(location, context)).concat(description.rotationUnit, ")")),
107
+ (0, css_1.sizeCss)(width, height), borderRadius && (0, css_1.borderRadiusCss)(borderRadius),
108
+ description.getExtraCss(location, context),
95
109
  !draggedItem && (onShortClick || onLongClick) && hoverHighlight, clicking && clickingAnimation,
96
- (canDrop || (!draggedItem && legalMoves.length > 0 && !animations.length)) && css_1.shineEffect,
110
+ ((canDrop && !isOver) || (!draggedItem && legalMoves.length > 0 && !animations.length)) && css_1.shineEffect,
97
111
  canDrop && isOver && dropHighlight
98
112
  ] }, props, (0, utilities_1.combineEventListeners)(listeners, props)));
113
+ });
114
+ var absolute = (0, react_2.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: absolute;\n"], ["\n position: absolute;\n"])));
115
+ var positionOnParentCss = function (_a) {
116
+ var x = _a.x, y = _a.y;
117
+ return (0, react_2.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n left: ", "%;\n top: ", "%;\n"], ["\n left: ", "%;\n top: ", "%;\n"])), x, y);
99
118
  };
100
- exports.SimpleDropArea = SimpleDropArea;
101
- var hoverHighlight = (0, react_2.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n &:hover {\n background-color: rgba(255, 255, 255, 0.2);\n }\n"], ["\n &:hover {\n background-color: rgba(255, 255, 255, 0.2);\n }\n"])));
102
- var clickingKeyframes = (0, react_2.keyframes)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n from {\n background-color: rgba(255, 255, 255, 0.2);\n }\n to {\n background-color: rgba(0, 255, 0, 0.5);\n }\n"], ["\n from {\n background-color: rgba(255, 255, 255, 0.2);\n }\n to {\n background-color: rgba(0, 255, 0, 0.5);\n }\n"])));
119
+ var hoverHighlight = (0, react_2.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n &:hover {\n background-color: rgba(255, 255, 255, 0.2);\n }\n"], ["\n &:hover {\n background-color: rgba(255, 255, 255, 0.2);\n }\n"])));
120
+ var clickingKeyframes = (0, react_2.keyframes)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n from {\n background-color: rgba(255, 255, 255, 0.2);\n }\n to {\n background-color: rgba(0, 255, 0, 0.5);\n }\n"], ["\n from {\n background-color: rgba(255, 255, 255, 0.2);\n }\n to {\n background-color: rgba(0, 255, 0, 0.5);\n }\n"])));
103
121
  var longClickThreshold = 600;
104
- var clickingAnimation = (0, react_2.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n animation: ", " ", "ms ease-in-out;\n"], ["\n animation: ", " ", "ms ease-in-out;\n"])), clickingKeyframes, longClickThreshold);
105
- var dropHighlight = (0, react_2.css)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n background-color: rgba(0, 255, 0, 0.5);\n"], ["\n background-color: rgba(0, 255, 0, 0.5);\n"])));
122
+ var clickingAnimation = (0, react_2.css)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n animation: ", " ", "ms ease-in-out;\n"], ["\n animation: ", " ", "ms ease-in-out;\n"])), clickingKeyframes, longClickThreshold);
123
+ var dropHighlight = (0, react_2.css)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n background-color: rgba(0, 255, 0, 0.5);\n"], ["\n background-color: rgba(0, 255, 0, 0.5);\n"])));
106
124
  var getMoveItemTypes = function (move, rules) {
107
125
  switch (move.kind) {
108
126
  case rules_api_1.MoveKind.ItemMove:
@@ -113,9 +131,5 @@ var getMoveItemTypes = function (move, rules) {
113
131
  return [];
114
132
  }
115
133
  };
116
- function isDropLocation(data) {
117
- return typeof (data === null || data === void 0 ? void 0 : data.type) === 'number';
118
- }
119
- exports.isDropLocation = isDropLocation;
120
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
134
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
121
135
  //# sourceMappingURL=SimpleDropArea.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SimpleDropArea.js","sourceRoot":"","sources":["../../../../src/components/material/locations/SimpleDropArea.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAsC;AACtC,+BAA8F;AAC9F,iDAAkJ;AAClJ,wCAA+C;AAC/C,iDAA0F;AAC1F,wCAAiH;AACjH,oCAAkF;AAClF,sCAA4C;AAC5C,0DAA0D;AAC1D,gDAA0D;AAC1D,qDAA4C;AAQ/B,QAAA,cAAc,GAAG,IAAA,kBAAU,EAAsC,UAC5E,EAAiD,EAAE,GAAG;;IAApD,IAAA,QAAQ,cAAA,EAAE,YAAY,kBAAA,EAAE,WAAW,iBAAA,EAAK,KAAK,cAA/C,2CAAiD,CAAF;IAE/C,IAAM,OAAO,GAAG,IAAA,0BAAkB,GAAE,CAAA;IACpC,IAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;IACjC,IAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;IAC/C,IAAM,WAAW,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAA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,WAAG,2IAAA,uEAIzB,IAAA,CAAA;AAED,IAAM,iBAAiB,OAAG,iBAAS,kMAAA,8HAOlC,IAAA,CAAA;AAED,IAAM,kBAAkB,GAAG,GAAG,CAAA;AAE9B,IAAM,iBAAiB,OAAG,WAAG,+GAAA,iBACd,EAAiB,GAAI,EAAkB,mBACrD,KADc,iBAAiB,EAAI,kBAAkB,CACrD,CAAA;AAED,IAAM,aAAa,OAAG,WAAG,mHAAA,+CAExB,IAAA,CAAA;AAED,IAAM,gBAAgB,GAAG,UACvB,IAA2B,EAAE,KAA6B;IAE1D,QAAQ,IAAI,CAAC,IAAI,EAAE;QACjB,KAAK,oBAAQ,CAAC,QAAQ;YACpB,OAAO,IAAI,CAAC,IAAI,KAAK,wBAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;QAC/D,KAAK,oBAAQ,CAAC,UAAU;YACtB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,UAAA,IAAI,IAAI,OAAA,gBAAgB,CAAC,IAAI,EAAE,KAAK,CAAC,EAA7B,CAA6B,CAAC,CAAA;QACxE;YACE,OAAO,EAAE,CAAA;KACZ;AACH,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ export * from './LocationDescription';
2
+ export * from './LocationsMask';
3
+ export * from './SimpleDropArea';
@@ -14,5 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./Board"), exports);
17
+ __exportStar(require("./LocationDescription"), exports);
18
+ __exportStar(require("./LocationsMask"), exports);
19
+ __exportStar(require("./SimpleDropArea"), exports);
18
20
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/material/locations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAqC;AACrC,kDAA+B;AAC/B,mDAAgC"}
@@ -0,0 +1,3 @@
1
+ import { MaterialItem } from '@gamepark/rules-api';
2
+ import { MaterialContext } from '../../../locators';
3
+ export declare const getItemFromContext: <P extends number = number, M extends number = number, L extends number = number>(context: MaterialContext<P, M, L>, type?: M, index?: number) => MaterialItem<P, L, any>;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getItemFromContext = void 0;
4
+ var getItemFromContext = function (context, type, index) {
5
+ if (type === void 0) { type = context.type; }
6
+ if (index === void 0) { index = context.index; }
7
+ return context.game.items[type][index];
8
+ };
9
+ exports.getItemFromContext = getItemFromContext;
10
+ //# sourceMappingURL=getItemFromContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getItemFromContext.js","sourceRoot":"","sources":["../../../../src/components/material/utils/getItemFromContext.ts"],"names":[],"mappings":";;;AAGO,IAAM,kBAAkB,GAAG,UAChC,OAAiC,EAAE,IAA6C,EAAE,KAA+C;IAA9F,qBAAA,EAAA,OAAQ,OAAgC,CAAC,IAAI;IAAE,sBAAA,EAAA,QAAS,OAAgC,CAAC,KAAK;IAEjI,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAE,CAAC,KAAK,CAAuB,CAAA;AAC/D,CAAC,CAAA;AAJY,QAAA,kBAAkB,sBAI9B"}
@@ -1,5 +1,2 @@
1
1
  export * from './IsLocationSubset';
2
2
  export * from './IsMoveOnItem';
3
- export * from './IsMoveThisItem';
4
- export * from './IsMoveThisItemToLocation';
5
- export * from './IsMoveToLocation';
@@ -16,7 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./IsLocationSubset"), exports);
18
18
  __exportStar(require("./IsMoveOnItem"), exports);
19
- __exportStar(require("./IsMoveThisItem"), exports);
20
- __exportStar(require("./IsMoveThisItemToLocation"), exports);
21
- __exportStar(require("./IsMoveToLocation"), exports);
22
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/material/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAkC;AAClC,iDAA8B;AAC9B,mDAAgC;AAChC,6DAA0C;AAC1C,qDAAkC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/material/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAkC;AAClC,iDAA8B"}
@@ -0,0 +1,2 @@
1
+ import { ItemContext } from '../../../locators';
2
+ export declare const isDroppedItem: <P extends number = number, M extends number = number, L extends number = number>(context: ItemContext<P, M, L>) => boolean;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isDroppedItem = void 0;
4
+ var getItemFromContext_1 = require("./getItemFromContext");
5
+ var isPlacedOnItem_1 = require("./isPlacedOnItem");
6
+ var isDroppedItem = function (context) {
7
+ var droppedItem = context.game.droppedItem;
8
+ if (!droppedItem)
9
+ return false;
10
+ if (droppedItem.type === context.type && droppedItem.index === context.index && droppedItem.displayIndex === context.displayIndex)
11
+ return true;
12
+ return (0, isPlacedOnItem_1.isPlacedOnItem)((0, getItemFromContext_1.getItemFromContext)(context), droppedItem, context);
13
+ };
14
+ exports.isDroppedItem = isDroppedItem;
15
+ //# sourceMappingURL=isDroppedItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isDroppedItem.js","sourceRoot":"","sources":["../../../../src/components/material/utils/isDroppedItem.ts"],"names":[],"mappings":";;;AACA,2DAAyD;AACzD,mDAAiD;AAE1C,IAAM,aAAa,GAAG,UAC3B,OAA6B;IAE7B,IAAM,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAA;IAC5C,IAAI,CAAC,WAAW;QAAE,OAAO,KAAK,CAAA;IAC9B,IAAI,WAAW,CAAC,IAAI,KAAK,OAAO,CAAC,IAAI,IAAI,WAAW,CAAC,KAAK,KAAK,OAAO,CAAC,KAAK,IAAI,WAAW,CAAC,YAAY,KAAK,OAAO,CAAC,YAAY;QAAE,OAAO,IAAI,CAAA;IAC9I,OAAO,IAAA,+BAAc,EAAC,IAAA,uCAAkB,EAAC,OAAO,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,CAAA;AAC1E,CAAC,CAAA;AAPY,QAAA,aAAa,iBAOzB"}
@@ -0,0 +1,3 @@
1
+ import { DisplayedItem, MaterialItem } from '@gamepark/rules-api';
2
+ import { MaterialContext } from '../../../locators';
3
+ export declare const isPlacedOnItem: <P extends number = number, M extends number = number, L extends number = number>(childItem: MaterialItem<P, L, any>, item: Omit<DisplayedItem<M>, "displayIndex">, context: MaterialContext<P, M, L>) => boolean;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isPlacedOnItem = void 0;
4
+ var getItemFromContext_1 = require("./getItemFromContext");
5
+ var isPlacedOnItem = function (childItem, item, context) {
6
+ if (childItem.location.parent === undefined)
7
+ return false;
8
+ var locator = context.locators[childItem.location.type];
9
+ if (locator.parentItemType === item.type && childItem.location.parent === item.index)
10
+ return true;
11
+ var parentItem = (0, getItemFromContext_1.getItemFromContext)(context, locator.parentItemType, childItem.location.parent);
12
+ return (0, exports.isPlacedOnItem)(parentItem, item, context);
13
+ };
14
+ exports.isPlacedOnItem = isPlacedOnItem;
15
+ //# sourceMappingURL=isPlacedOnItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isPlacedOnItem.js","sourceRoot":"","sources":["../../../../src/components/material/utils/isPlacedOnItem.ts"],"names":[],"mappings":";;;AAEA,2DAAyD;AAElD,IAAM,cAAc,GAAG,UAC5B,SAA6B,EAAE,IAA4C,EAAE,OAAiC;IAE9G,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,KAAK,SAAS;QAAE,OAAO,KAAK,CAAA;IACzD,IAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;IACzD,IAAI,OAAO,CAAC,cAAc,KAAK,IAAI,CAAC,IAAI,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,KAAK,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAA;IACjG,IAAM,UAAU,GAAG,IAAA,uCAAkB,EAAC,OAAO,EAAE,OAAO,CAAC,cAAc,EAAE,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IACjG,OAAO,IAAA,sBAAc,EAAC,UAAU,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;AAClD,CAAC,CAAA;AARY,QAAA,cAAc,kBAQ1B"}