@gamepark/react-game 6.23.4 → 6.24.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (197) hide show
  1. package/dist/components/Header/MaterialHeader.js +2 -1
  2. package/dist/components/Header/MaterialHeader.js.map +1 -1
  3. package/dist/components/PlayerPanel/Counters.d.ts +13 -0
  4. package/dist/components/PlayerPanel/Counters.js +44 -0
  5. package/dist/components/PlayerPanel/Counters.js.map +1 -0
  6. package/dist/components/PlayerPanel/StyledPlayerPanel.d.ts +4 -2
  7. package/dist/components/PlayerPanel/StyledPlayerPanel.js +30 -25
  8. package/dist/components/PlayerPanel/StyledPlayerPanel.js.map +1 -1
  9. package/dist/components/PlayerPanel/index.d.ts +1 -0
  10. package/dist/components/PlayerPanel/index.js +1 -0
  11. package/dist/components/PlayerPanel/index.js.map +1 -1
  12. package/dist/components/dialogs/RulesDialog/LocationRulesDialogContent.d.ts +1 -1
  13. package/dist/components/dialogs/RulesDialog/LocationRulesDialogContent.js +6 -6
  14. package/dist/components/dialogs/RulesDialog/LocationRulesDialogContent.js.map +1 -1
  15. package/dist/components/dialogs/RulesDialog/MaterialRulesDialogContent.js +13 -6
  16. package/dist/components/dialogs/RulesDialog/MaterialRulesDialogContent.js.map +1 -1
  17. package/dist/components/material/ComponentDescription.d.ts +14 -0
  18. package/dist/components/material/ComponentDescription.js +27 -0
  19. package/dist/components/material/ComponentDescription.js.map +1 -0
  20. package/dist/components/material/Dices/CubicDiceDescription.d.ts +1 -0
  21. package/dist/components/material/Dices/CubicDiceDescription.js +13 -0
  22. package/dist/components/material/Dices/CubicDiceDescription.js.map +1 -1
  23. package/dist/components/material/DraggableMaterial.d.ts +1 -13
  24. package/dist/components/material/DraggableMaterial.js +37 -91
  25. package/dist/components/material/DraggableMaterial.js.map +1 -1
  26. package/dist/components/material/FlatMaterial/CardDescription.d.ts +2 -2
  27. package/dist/components/material/FlatMaterial/CardDescription.js +1 -1
  28. package/dist/components/material/FlatMaterial/CardDescription.js.map +1 -1
  29. package/dist/components/material/FlatMaterial/FlatMaterial.d.ts +4 -2
  30. package/dist/components/material/FlatMaterial/FlatMaterial.js +17 -11
  31. package/dist/components/material/FlatMaterial/FlatMaterial.js.map +1 -1
  32. package/dist/components/material/FlatMaterial/TokenDescription.d.ts +1 -1
  33. package/dist/components/material/FlatMaterial/TokenDescription.js.map +1 -1
  34. package/dist/components/material/GameTable/GameMaterialDisplay.js +1 -1
  35. package/dist/components/material/GameTable/GameMaterialDisplay.js.map +1 -1
  36. package/dist/components/material/GameTable/GameTable.js +9 -7
  37. package/dist/components/material/GameTable/GameTable.js.map +1 -1
  38. package/dist/components/material/GameTable/ItemDisplay.d.ts +4 -2
  39. package/dist/components/material/GameTable/ItemDisplay.js +104 -15
  40. package/dist/components/material/GameTable/ItemDisplay.js.map +1 -1
  41. package/dist/components/material/GameTable/StaticItemsDisplay.js +2 -2
  42. package/dist/components/material/GameTable/StaticItemsDisplay.js.map +1 -1
  43. package/dist/components/material/GameTable/StaticLocationsDisplay.js +12 -12
  44. package/dist/components/material/GameTable/StaticLocationsDisplay.js.map +1 -1
  45. package/dist/components/material/GameTable/focus/FocusProvider.d.ts +6 -6
  46. package/dist/components/material/GameTable/focus/FocusProvider.js +2 -2
  47. package/dist/components/material/GameTable/focus/FocusProvider.js.map +1 -1
  48. package/dist/components/material/GameTable/focus/index.d.ts +0 -1
  49. package/dist/components/material/GameTable/focus/index.js +0 -1
  50. package/dist/components/material/GameTable/focus/index.js.map +1 -1
  51. package/dist/components/material/ImageLoader/MaterialImageLoader.js +17 -11
  52. package/dist/components/material/ImageLoader/MaterialImageLoader.js.map +1 -1
  53. package/dist/components/material/MaterialComponent.d.ts +0 -4
  54. package/dist/components/material/MaterialComponent.js +5 -18
  55. package/dist/components/material/MaterialComponent.js.map +1 -1
  56. package/dist/components/material/MaterialDescription.d.ts +5 -13
  57. package/dist/components/material/MaterialDescription.js +48 -22
  58. package/dist/components/material/MaterialDescription.js.map +1 -1
  59. package/dist/components/material/Writing/WritingDescription.d.ts +0 -4
  60. package/dist/components/material/Writing/WritingDescription.js +0 -10
  61. package/dist/components/material/Writing/WritingDescription.js.map +1 -1
  62. package/dist/components/material/animations/CreateItemAnimations.js +5 -3
  63. package/dist/components/material/animations/CreateItemAnimations.js.map +1 -1
  64. package/dist/components/material/animations/DeleteItemAnimations.js +7 -5
  65. package/dist/components/material/animations/DeleteItemAnimations.js.map +1 -1
  66. package/dist/components/material/animations/ItemAnimations.d.ts +2 -1
  67. package/dist/components/material/animations/ItemAnimations.js +9 -0
  68. package/dist/components/material/animations/ItemAnimations.js.map +1 -1
  69. package/dist/components/material/animations/MaterialAnimations.d.ts +2 -2
  70. package/dist/components/material/animations/MoveItemAnimations.d.ts +1 -2
  71. package/dist/components/material/animations/MoveItemAnimations.js +18 -31
  72. package/dist/components/material/animations/MoveItemAnimations.js.map +1 -1
  73. package/dist/components/material/animations/MoveItemAtOnceAnimations.d.ts +1 -2
  74. package/dist/components/material/animations/MoveItemAtOnceAnimations.js +14 -28
  75. package/dist/components/material/animations/MoveItemAtOnceAnimations.js.map +1 -1
  76. package/dist/components/material/animations/RollItemAnimations.d.ts +1 -2
  77. package/dist/components/material/animations/RollItemAnimations.js +4 -15
  78. package/dist/components/material/animations/RollItemAnimations.js.map +1 -1
  79. package/dist/components/material/animations/adjustRotation.d.ts +1 -1
  80. package/dist/components/material/animations/adjustRotation.js +60 -19
  81. package/dist/components/material/animations/adjustRotation.js.map +1 -1
  82. package/dist/components/material/animations/getFirstStockItemTransforms.util.js +3 -6
  83. package/dist/components/material/animations/getFirstStockItemTransforms.util.js.map +1 -1
  84. package/dist/components/material/animations/rotations.utils.d.ts +2 -0
  85. package/dist/components/material/animations/rotations.utils.js +99 -0
  86. package/dist/components/material/animations/rotations.utils.js.map +1 -0
  87. package/dist/components/material/animations/transformItem.util.js +3 -5
  88. package/dist/components/material/animations/transformItem.util.js.map +1 -1
  89. package/dist/components/material/index.d.ts +1 -0
  90. package/dist/components/material/index.js +1 -0
  91. package/dist/components/material/index.js.map +1 -1
  92. package/dist/components/material/locations/DropAreaDescription.d.ts +9 -0
  93. package/dist/components/material/locations/DropAreaDescription.js +46 -0
  94. package/dist/components/material/locations/DropAreaDescription.js.map +1 -0
  95. package/dist/components/material/locations/LocationComponent.d.ts +16 -0
  96. package/dist/components/material/locations/LocationComponent.js +89 -0
  97. package/dist/components/material/locations/LocationComponent.js.map +1 -0
  98. package/dist/components/material/locations/LocationDescription.d.ts +14 -25
  99. package/dist/components/material/locations/LocationDescription.js +43 -50
  100. package/dist/components/material/locations/LocationDescription.js.map +1 -1
  101. package/dist/components/material/locations/LocationDisplay.d.ts +4 -1
  102. package/dist/components/material/locations/LocationDisplay.js +4 -9
  103. package/dist/components/material/locations/LocationDisplay.js.map +1 -1
  104. package/dist/components/material/locations/LocationsMask.d.ts +2 -1
  105. package/dist/components/material/locations/LocationsMask.js +6 -6
  106. package/dist/components/material/locations/LocationsMask.js.map +1 -1
  107. package/dist/components/material/locations/SimpleDropArea.d.ts +4 -7
  108. package/dist/components/material/locations/SimpleDropArea.js +18 -88
  109. package/dist/components/material/locations/SimpleDropArea.js.map +1 -1
  110. package/dist/components/material/locations/index.d.ts +1 -0
  111. package/dist/components/material/locations/index.js +1 -0
  112. package/dist/components/material/locations/index.js.map +1 -1
  113. package/dist/components/material/utils/isDroppedItem.js +12 -1
  114. package/dist/components/material/utils/isDroppedItem.js.map +1 -1
  115. package/dist/components/material/utils/isPlacedOnItem.d.ts +3 -3
  116. package/dist/components/material/utils/isPlacedOnItem.js +5 -5
  117. package/dist/components/material/utils/isPlacedOnItem.js.map +1 -1
  118. package/dist/components/tutorial/MaterialTutorial.js +4 -4
  119. package/dist/components/tutorial/MaterialTutorial.js.map +1 -1
  120. package/dist/components/tutorial/MaterialTutorialDisplay.js +7 -6
  121. package/dist/components/tutorial/MaterialTutorialDisplay.js.map +1 -1
  122. package/dist/components/tutorial/TutorialRulesWrapper.js +26 -26
  123. package/dist/components/tutorial/TutorialRulesWrapper.js.map +1 -1
  124. package/dist/hooks/index.d.ts +1 -1
  125. package/dist/hooks/index.js +1 -1
  126. package/dist/hooks/index.js.map +1 -1
  127. package/dist/hooks/useDraggedItem.d.ts +2 -0
  128. package/dist/hooks/useDraggedItem.js +19 -0
  129. package/dist/hooks/useDraggedItem.js.map +1 -0
  130. package/dist/hooks/useItemLocations.d.ts +8 -0
  131. package/dist/hooks/useItemLocations.js +83 -0
  132. package/dist/hooks/useItemLocations.js.map +1 -0
  133. package/dist/hooks/useItemLocator.d.ts +2 -2
  134. package/dist/hooks/useItemLocator.js.map +1 -1
  135. package/dist/hooks/useLegalMoves.js +4 -18
  136. package/dist/hooks/useLegalMoves.js.map +1 -1
  137. package/dist/hooks/usePlayers.js +14 -1
  138. package/dist/hooks/usePlayers.js.map +1 -1
  139. package/dist/hooks/useStaticLocations.d.ts +2 -0
  140. package/dist/hooks/useStaticLocations.js +53 -0
  141. package/dist/hooks/useStaticLocations.js.map +1 -0
  142. package/dist/hooks/useTutorialStep.js +2 -2
  143. package/dist/hooks/useTutorialStep.js.map +1 -1
  144. package/dist/hooks/useZoomToElements.d.ts +1 -1
  145. package/dist/hooks/useZoomToElements.js +8 -8
  146. package/dist/hooks/useZoomToElements.js.map +1 -1
  147. package/dist/index.d.ts +1 -1
  148. package/dist/index.js +3 -1
  149. package/dist/index.js.map +1 -1
  150. package/dist/locators/DeckLocator.d.ts +5 -4
  151. package/dist/locators/DeckLocator.js +6 -8
  152. package/dist/locators/DeckLocator.js.map +1 -1
  153. package/dist/locators/FlexLocator.d.ts +18 -0
  154. package/dist/locators/FlexLocator.js +88 -0
  155. package/dist/locators/FlexLocator.js.map +1 -0
  156. package/dist/locators/HandLocator.d.ts +22 -13
  157. package/dist/locators/HandLocator.js +71 -39
  158. package/dist/locators/HandLocator.js.map +1 -1
  159. package/dist/locators/ListLocator.d.ts +18 -0
  160. package/dist/locators/ListLocator.js +97 -0
  161. package/dist/locators/ListLocator.js.map +1 -0
  162. package/dist/locators/Locator.d.ts +50 -0
  163. package/dist/locators/Locator.js +153 -0
  164. package/dist/locators/Locator.js.map +1 -0
  165. package/dist/locators/PileLocator.d.ts +12 -11
  166. package/dist/locators/PileLocator.js +44 -29
  167. package/dist/locators/PileLocator.js.map +1 -1
  168. package/dist/locators/index.d.ts +3 -3
  169. package/dist/locators/index.js +3 -3
  170. package/dist/locators/index.js.map +1 -1
  171. package/dist/utilities/combineEventListeners.js.map +1 -1
  172. package/dist/utilities/findIfUnique.util.js.map +1 -1
  173. package/dist/utilities/index.d.ts +1 -0
  174. package/dist/utilities/index.js +1 -0
  175. package/dist/utilities/index.js.map +1 -1
  176. package/dist/utilities/translation.util.d.ts +5 -0
  177. package/dist/utilities/translation.util.js +33 -0
  178. package/dist/utilities/translation.util.js.map +1 -0
  179. package/dist/utilities/zoom-pan-pinch/animations.constants.d.ts +16 -0
  180. package/dist/utilities/zoom-pan-pinch/animations.constants.js +62 -0
  181. package/dist/utilities/zoom-pan-pinch/animations.constants.js.map +1 -0
  182. package/dist/utilities/zoom-pan-pinch/animations.util.d.ts +4 -0
  183. package/dist/utilities/zoom-pan-pinch/animations.util.js +71 -0
  184. package/dist/utilities/zoom-pan-pinch/animations.util.js.map +1 -0
  185. package/dist/utilities/zoom-pan-pinch/bounds.util.d.ts +7 -0
  186. package/dist/utilities/zoom-pan-pinch/bounds.util.js +77 -0
  187. package/dist/utilities/zoom-pan-pinch/bounds.util.js.map +1 -0
  188. package/dist/utilities/zoom-pan-pinch/calculation.util.d.ts +2 -0
  189. package/dist/utilities/zoom-pan-pinch/calculation.util.js +12 -0
  190. package/dist/utilities/zoom-pan-pinch/calculation.util.js.map +1 -0
  191. package/dist/utilities/zoom-pan-pinch/index.d.ts +5 -0
  192. package/dist/utilities/zoom-pan-pinch/index.js +22 -0
  193. package/dist/utilities/zoom-pan-pinch/index.js.map +1 -0
  194. package/dist/utilities/zoom-pan-pinch/zoom.util.d.ts +1 -0
  195. package/dist/utilities/zoom-pan-pinch/zoom.util.js +14 -0
  196. package/dist/utilities/zoom-pan-pinch/zoom.util.js.map +1 -0
  197. package/package.json +3 -3
@@ -1,4 +1,8 @@
1
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
+ };
2
6
  var __assign = (this && this.__assign) || function () {
3
7
  __assign = Object.assign || function(t) {
4
8
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -21,31 +25,116 @@ var __rest = (this && this.__rest) || function (s, e) {
21
25
  }
22
26
  return t;
23
27
  };
28
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
29
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
30
+ if (ar || !(i in from)) {
31
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
32
+ ar[i] = from[i];
33
+ }
34
+ }
35
+ return to.concat(ar || Array.prototype.slice.call(from));
36
+ };
37
+ var __importDefault = (this && this.__importDefault) || function (mod) {
38
+ return (mod && mod.__esModule) ? mod : { "default": mod };
39
+ };
24
40
  Object.defineProperty(exports, "__esModule", { value: true });
25
41
  exports.ItemDisplay = void 0;
26
42
  var jsx_runtime_1 = require("@emotion/react/jsx-runtime");
27
- var react_1 = require("react");
43
+ var react_1 = require("@emotion/react");
44
+ var isEqual_1 = __importDefault(require("lodash/isEqual"));
45
+ var partition_1 = __importDefault(require("lodash/partition"));
46
+ var react_2 = require("react");
28
47
  var react_merge_refs_1 = require("react-merge-refs");
29
- var css_1 = require("../../../css");
48
+ var use_long_press_1 = require("use-long-press");
30
49
  var hooks_1 = require("../../../hooks");
31
- var locators_1 = require("../../../locators");
50
+ var useItemLocations_1 = require("../../../hooks/useItemLocations");
51
+ var utilities_1 = require("../../../utilities");
32
52
  var locations_1 = require("../locations");
33
53
  var MaterialComponent_1 = require("../MaterialComponent");
54
+ var utils_1 = require("../utils");
34
55
  var focus_1 = require("./focus");
35
- exports.ItemDisplay = (0, react_1.forwardRef)(function (_a, ref) {
36
- var _b;
37
- var type = _a.type, index = _a.index, displayIndex = _a.displayIndex, item = _a.item, isFocused = _a.isFocused, props = __rest(_a, ["type", "index", "displayIndex", "item", "isFocused"]);
56
+ exports.ItemDisplay = (0, react_2.forwardRef)(function (_a, ref) {
57
+ var type = _a.type, index = _a.index, displayIndex = _a.displayIndex, item = _a.item, dragTransform = _a.dragTransform, animating = _a.animating, isFocused = _a.isFocused, onShortClick = _a.onShortClick, onLongClick = _a.onLongClick, highlight = _a.highlight, playDown = _a.playDown, props = __rest(_a, ["type", "index", "displayIndex", "item", "dragTransform", "animating", "isFocused", "onShortClick", "onLongClick", "highlight", "playDown"]);
38
58
  var context = (0, hooks_1.useMaterialContext)();
39
- var _c = (0, focus_1.useFocusContext)(), focus = _c.focus, addFocusRef = _c.addFocusRef;
40
- var itemContext = __assign(__assign({}, context), { type: type, index: index, displayIndex: displayIndex });
41
- var _d = (0, focus_1.getLocationsWithFocus)(item, itemContext, focus), locations = _d.locations, focusedIndexes = _d.focusedIndexes;
42
- var focusedLocations = (0, react_1.useMemo)(function () { return focusedIndexes.map(function (index) { return locations[index]; }); }, [locations, focusedIndexes]);
43
- var locator = (_b = context.locators[item.location.type]) !== null && _b !== void 0 ? _b : locators_1.centerLocator;
59
+ var _b = (0, focus_1.useFocusContext)(), focus = _b.focus, focusRef = _b.focusRef;
60
+ var itemContext = (0, react_2.useMemo)(function () { return (__assign(__assign({}, context), { type: type, index: index, displayIndex: displayIndex, dragTransform: dragTransform })); }, [context, type, index, displayIndex, dragTransform]);
61
+ var locations = (0, useItemLocations_1.useItemLocations)(item, itemContext);
62
+ var _c = (0, react_2.useMemo)(function () { return (0, partition_1.default)(locations, function (l) { return l.focusRef; }); }, [locations]), focusedLocations = _c[0], otherLocations = _c[1];
44
63
  var description = context.material[type];
45
- return (0, jsx_runtime_1.jsx)(MaterialComponent_1.MaterialComponent, __assign({ ref: isFocused ? (0, react_merge_refs_1.mergeRefs)([ref, addFocusRef]) : ref, type: type, itemId: item.id, playDown: (focus === null || focus === void 0 ? void 0 : focus.highlight) && !isFocused && !focusedIndexes.length, css: [css_1.pointerCursorCss, css_1.transformCss.apply(void 0, locator.transformItem(item, itemContext)), description === null || description === void 0 ? void 0 : description.getItemExtraCss(item, itemContext)] }, props, { children: locations.length > 0 && (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [focusedLocations.length > 0 && (0, jsx_runtime_1.jsx)(locations_1.LocationsMask, { locations: focusedLocations }), locations.map(function (location, index) {
46
- var hasFocus = focusedIndexes.includes(index);
47
- return (0, jsx_runtime_1.jsx)(locations_1.SimpleDropArea, { location: location, alwaysVisible: hasFocus, ref: hasFocus ? addFocusRef : undefined }, JSON.stringify(location));
48
- })] }) }));
64
+ var itemTransform = (0, react_2.useMemo)(function () { return description.getItemTransform(item, itemContext); }, [description, item, itemContext]);
65
+ var transformStyle = (dragTransform ? __spreadArray([dragTransform], itemTransform, true) : itemTransform).join(' ');
66
+ var hoverTransform = (0, react_2.useMemo)(function () { return description.getHoverTransform(item, itemContext).join(' '); }, [description, item, itemContext]);
67
+ var play = (0, hooks_1.usePlay)();
68
+ var displayHelp = (0, react_2.useMemo)(function () { return function () { return play(description.displayHelp(item, itemContext), { local: true }); }; }, [description, item, itemContext]);
69
+ onLongClick = onLongClick !== null && onLongClick !== void 0 ? onLongClick : (onShortClick ? displayHelp : undefined);
70
+ var lastShortClick = (0, react_2.useRef)(new Date().getTime());
71
+ var listeners = (0, use_long_press_1.useLongPress)(function () { return onLongClick && onLongClick(); }, {
72
+ detect: use_long_press_1.LongPressEventType.Pointer,
73
+ cancelOnMovement: 5,
74
+ threshold: 600,
75
+ onCancel: function (_, _a) {
76
+ var reason = _a.reason;
77
+ if (reason === use_long_press_1.LongPressCallbackReason.CancelledByRelease) {
78
+ var time = new Date().getTime();
79
+ if (time - lastShortClick.current < 300)
80
+ return;
81
+ lastShortClick.current = time;
82
+ setTimeout(onShortClick !== null && onShortClick !== void 0 ? onShortClick : displayHelp);
83
+ }
84
+ },
85
+ filterEvents: function (event) { return !event.button; }
86
+ })();
87
+ var canHaveChildren = (0, react_2.useMemo)(function () { return Object.values(context.locators).some(function (locator) { return (locator === null || locator === void 0 ? void 0 : locator.parentItemType) === type; }); }, [context, type]);
88
+ return (0, jsx_runtime_1.jsx)("div", __assign({ css: [
89
+ itemCss,
90
+ hoverTransform && hoverCss(itemTransform.join(' '), description.getSize(item.id), hoverTransform, animating || !!dragTransform)
91
+ ] }, props, (0, utilities_1.combineEventListeners)(listeners, props), { children: (0, jsx_runtime_1.jsxs)(MaterialComponent_1.MaterialComponent, __assign({ ref: isFocused ? (0, react_merge_refs_1.mergeRefs)([ref, focusRef]) : ref, type: type, itemId: item.id, highlight: highlight, playDown: playDown !== null && playDown !== void 0 ? playDown : ((focus === null || focus === void 0 ? void 0 : focus.highlight) && !isFocused && !focusedLocations.length), style: { transform: transformStyle }, css: description.getItemExtraCss(item, itemContext) }, { children: [canHaveChildren ? (0, jsx_runtime_1.jsx)(ItemDropLocations, { locations: otherLocations, item: item, type: type }) : (0, jsx_runtime_1.jsx)(ItemLocations, { locations: otherLocations }), focusedLocations.length > 0 && (0, jsx_runtime_1.jsx)(locations_1.LocationsMask, { locations: focusedLocations.map(function (l) { return l.location; }), borderRadius: description.getBorderRadius(item.id) }), (0, jsx_runtime_1.jsx)(ItemLocations, { locations: focusedLocations })] })) }));
49
92
  });
93
+ var itemCss = (0, react_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n > * {\n position: absolute;\n }\n"], ["\n > * {\n position: absolute;\n }\n"])));
94
+ var hoverCss = function (itemTransform, itemSize, hoverTransform, disable) { return (0, react_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n @media (hover) {\n &:hover > * > * {\n transition: transform 50ms ease-in-out;\n transform: ", ";\n } \n }\n \n > * {\n pointer-events: ", ";\n }\n\n &:before {\n content: \" \";\n position: absolute;\n width: ", "em;\n height: ", "em;\n transform: ", ";\n }\n"], ["\n @media (hover) {\n &:hover > * > * {\n transition: transform 50ms ease-in-out;\n transform: ", ";\n } \n }\n \n > * {\n pointer-events: ", ";\n }\n\n &:before {\n content: \" \";\n position: absolute;\n width: ", "em;\n height: ", "em;\n transform: ", ";\n }\n"])), disable ? '' : hoverTransform, disable ? 'auto' : 'none', itemSize.width, itemSize.height, itemTransform); };
50
95
  exports.ItemDisplay.displayName = 'ItemDisplay';
96
+ var ItemLocations = function (_a) {
97
+ var locations = _a.locations;
98
+ var context = (0, hooks_1.useMaterialContext)();
99
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: locations.map(function (_a) {
100
+ var _b;
101
+ var location = _a.location, focusRef = _a.focusRef;
102
+ var description = (_b = context.locators[location.type]) === null || _b === void 0 ? void 0 : _b.getLocationDescription(location, context);
103
+ var LocationComponent = description === null || description === void 0 ? void 0 : description.Component;
104
+ if (!LocationComponent)
105
+ return null;
106
+ return (0, jsx_runtime_1.jsx)(LocationComponent, { location: location, description: description, ref: focusRef }, JSON.stringify(location));
107
+ }) });
108
+ };
109
+ var ItemDropLocations = function (_a) {
110
+ var locations = _a.locations, item = _a.item, type = _a.type;
111
+ var context = (0, hooks_1.useMaterialContext)();
112
+ var draggedItem = (0, hooks_1.useDraggedItem)();
113
+ var draggedItemContext = __assign(__assign({}, context), draggedItem);
114
+ var expectedDropLocations = (0, useItemLocations_1.useExpectedDropLocations)();
115
+ var allLocations = (0, react_2.useMemo)(function () {
116
+ var result = __spreadArray([], locations, true);
117
+ var _loop_1 = function (location_1) {
118
+ var locator = context.locators[location_1.type];
119
+ if ((locator === null || locator === void 0 ? void 0 : locator.parentItemType) === type && (0, isEqual_1.default)(locator.getParentItem(location_1, context), item) && !result.some(function (r) { return (0, utils_1.isLocationSubset)(location_1, r.location); })) {
120
+ result.push({ location: location_1 });
121
+ }
122
+ };
123
+ for (var _i = 0, expectedDropLocations_1 = expectedDropLocations; _i < expectedDropLocations_1.length; _i++) {
124
+ var location_1 = expectedDropLocations_1[_i];
125
+ _loop_1(location_1);
126
+ }
127
+ return result;
128
+ }, [locations, expectedDropLocations]);
129
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: allLocations.map(function (_a) {
130
+ var _b;
131
+ var location = _a.location, focusRef = _a.focusRef;
132
+ var description = (_b = context.locators[location.type]) === null || _b === void 0 ? void 0 : _b.getLocationDescription(location, draggedItemContext);
133
+ var LocationComponent = description === null || description === void 0 ? void 0 : description.Component;
134
+ if (!LocationComponent)
135
+ return null;
136
+ return (0, jsx_runtime_1.jsx)(LocationComponent, { location: location, description: description, ref: focusRef }, JSON.stringify(location));
137
+ }) });
138
+ };
139
+ var templateObject_1, templateObject_2;
51
140
  //# sourceMappingURL=ItemDisplay.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ItemDisplay.js","sourceRoot":"","sources":["../../../../src/components/material/GameTable/ItemDisplay.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,+BAA2C;AAC3C,qDAA4C;AAC5C,oCAA6D;AAC7D,wCAAmD;AACnD,8CAA8D;AAC9D,0CAA4D;AAC5D,0DAAgF;AAChF,iCAAgE;AASnD,QAAA,WAAW,GAAG,IAAA,kBAAU,EAAmC,UACtE,EAA0E,EAAE,GAAG;;IAA7E,IAAA,IAAI,UAAA,EAAE,KAAK,WAAA,EAAE,YAAY,kBAAA,EAAE,IAAI,UAAA,EAAE,SAAS,eAAA,EAAK,KAAK,cAAtD,sDAAwD,CAAF;IAEtD,IAAM,OAAO,GAAG,IAAA,0BAAkB,GAAE,CAAA;IAC9B,IAAA,KAAyB,IAAA,uBAAe,GAAE,EAAxC,KAAK,WAAA,EAAE,WAAW,iBAAsB,CAAA;IAChD,IAAM,WAAW,yBAAqB,OAAO,KAAE,IAAI,MAAA,EAAE,KAAK,OAAA,EAAE,YAAY,cAAA,GA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AAA;IAGtC,OAAO,2DACJ,YAAY,CAAC,GAAG,CAAC,UAAC,EAAsB;;gBAApB,QAAQ,cAAA,EAAE,QAAQ,cAAA;YACrC,IAAM,WAAW,GAAG,MAAA,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,0CAAE,sBAAsB,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAA;YACzG,IAAM,iBAAiB,GAAG,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,SAAS,CAAA;YAChD,IAAI,CAAC,iBAAiB;gBAAE,OAAO,IAAI,CAAA;YACnC,OAAO,uBAAC,iBAAiB,IAAgC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,EAAE,QAAQ,IAArF,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAgE,CAAA;QACzH,CAAC,CAAC,GACD,CAAA;AACL,CAAC,CAAA"}
@@ -37,6 +37,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
37
37
  exports.StaticItemsDisplay = void 0;
38
38
  var jsx_runtime_1 = require("@emotion/react/jsx-runtime");
39
39
  var isEqual_1 = __importDefault(require("lodash/isEqual"));
40
+ var css_1 = require("../../../css");
40
41
  var hooks_1 = require("../../../hooks");
41
42
  var focus_1 = require("./focus");
42
43
  var ItemDisplay_1 = require("./ItemDisplay");
@@ -52,14 +53,13 @@ var StaticItemsTypeDisplay = function (_a) {
52
53
  var type = _a.type, description = _a.description, props = __rest(_a, ["type", "description"]);
53
54
  var context = (0, hooks_1.useMaterialContext)();
54
55
  var focus = (0, focus_1.useFocusContext)().focus;
55
- var play = (0, hooks_1.usePlay)();
56
56
  return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: description.getStaticItems(context).map(function (item, index) {
57
57
  var _a;
58
58
  return __spreadArray([], Array((_a = item.quantity) !== null && _a !== void 0 ? _a : 1), true).map(function (_, displayIndex) {
59
59
  var isFocused = focus === null || focus === void 0 ? void 0 : focus.staticItems.some(function (focusedItem) {
60
60
  return focusedItem.type === type && (0, isEqual_1.default)(focusedItem.item, item);
61
61
  });
62
- return (0, jsx_runtime_1.jsx)(ItemDisplay_1.ItemDisplay, __assign({ type: type, index: index, displayIndex: displayIndex, item: item, isFocused: isFocused, highlight: description.highlight(item, __assign(__assign({}, context), { type: type, index: index, displayIndex: displayIndex })), onShortClick: function () { return play(description.displayHelp(item, __assign(__assign({}, context), { type: type, index: index, displayIndex: displayIndex })), { local: true }); } }, props), "".concat(type, "_").concat(index, "_").concat(displayIndex));
62
+ return (0, jsx_runtime_1.jsx)(ItemDisplay_1.ItemDisplay, __assign({ type: type, index: index, displayIndex: displayIndex, item: item, isFocused: isFocused, highlight: description.highlight(item, __assign(__assign({}, context), { type: type, index: index, displayIndex: displayIndex })), css: css_1.pointerCursorCss }, props), "".concat(type, "_").concat(index, "_").concat(displayIndex));
63
63
  });
64
64
  }) });
65
65
  };
@@ -1 +1 @@
1
- {"version":3,"file":"StaticItemsDisplay.js","sourceRoot":"","sources":["../../../../src/components/material/GameTable/StaticItemsDisplay.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,2DAAoC;AACpC,wCAA4D;AAE5D,iCAAyC;AACzC,6CAA2C;AAEpC,IAAM,kBAAkB,GAAG,UAAC,KAAqC;IACtE,IAAM,QAAQ,GAAG,IAAA,0BAAkB,GAAE,CAAC,QAAQ,CAAA;IAC9C,OAAO,2DACJ,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,UAAC,EAAyB;gBAAxB,UAAU,QAAA,EAAE,WAAW,QAAA;YACrD,OAAA,WAAW,IAAI,uBAAC,sBAAsB,aAAkB,IAAI,EAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,WAAW,EAAE,WAAW,IAAM,KAAK,GAA3E,UAAU,CAAoE;QAA1H,CAA0H,CAC3H,GACA,CAAA;AACL,CAAC,CAAA;AAPY,QAAA,kBAAk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E,YAAY;gBACxD,IAAM,SAAS,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,WAAW,CAAC,IAAI,CAAC,UAAA,WAAW;oBACnD,OAAA,WAAW,CAAC,IAAI,KAAK,IAAI,IAAI,IAAA,iBAAO,EAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC;gBAA5D,CAA4D,CAC7D,CAAA;gBACD,OAAO,uBAAC,yBAAW,aACC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAChE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,CAAC,SAAS,CAAC,IAAI,wBAAO,OAAO,KAAE,IAAI,MAAA,EAAE,KAAK,OAAA,EAAE,YAAY,cAAA,IAAG,EACvG,GAAG,EAAE,sBAAgB,IACjB,KAAK,GAJJ,UAAG,IAAI,cAAI,KAAK,cAAI,YAAY,CAAE,CAI3B,CAAA;YAClC,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,GAAI,CAAA;AACR,CAAC,CAAA"}
@@ -10,24 +10,24 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
13
  Object.defineProperty(exports, "__esModule", { value: true });
17
14
  exports.StaticLocationsDisplay = void 0;
18
15
  var jsx_runtime_1 = require("@emotion/react/jsx-runtime");
19
- var isEqual_1 = __importDefault(require("lodash/isEqual"));
20
16
  var hooks_1 = require("../../../hooks");
21
- var locations_1 = require("../locations");
22
- var focus_1 = require("./focus");
17
+ var useStaticLocations_1 = require("../../../hooks/useStaticLocations");
23
18
  var StaticLocationsDisplay = function (props) {
24
19
  var context = (0, hooks_1.useMaterialContext)();
25
- var _a = (0, focus_1.useFocusContext)(), focus = _a.focus, addFocusRef = _a.addFocusRef;
26
- var locations = (0, focus_1.getStaticLocationsWithFocus)(context, focus);
27
- return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: locations.map(function (location) {
28
- var isFocused = focus === null || focus === void 0 ? void 0 : focus.locations.some(function (focusedLocation) { return (0, isEqual_1.default)(focusedLocation, location); });
29
- return ((0, jsx_runtime_1.jsx)(locations_1.SimpleDropArea, __assign({ location: location, alwaysVisible: isFocused, ref: isFocused ? addFocusRef : undefined }, props), JSON.stringify(location)));
30
- }) }));
20
+ var locations = (0, useStaticLocations_1.useStaticLocations)();
21
+ var draggedItem = (0, hooks_1.useDraggedItem)();
22
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: locations.map(function (_a) {
23
+ var _b;
24
+ var location = _a.location, focusRef = _a.focusRef;
25
+ var description = (_b = context.locators[location.type]) === null || _b === void 0 ? void 0 : _b.getLocationDescription(location, __assign(__assign({}, context), draggedItem));
26
+ var LocationComponent = description === null || description === void 0 ? void 0 : description.Component;
27
+ if (!LocationComponent)
28
+ return null;
29
+ return (0, jsx_runtime_1.jsx)(LocationComponent, __assign({ location: location, description: description, ref: focusRef }, props), JSON.stringify(location));
30
+ }) });
31
31
  };
32
32
  exports.StaticLocationsDisplay = StaticLocationsDisplay;
33
33
  //# sourceMappingURL=StaticLocationsDisplay.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StaticLocationsDisplay.js","sourceRoot":"","sources":["../../../../src/components/material/GameTable/StaticLocationsDisplay.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAEA,2DAAoC;AACpC,wCAAmD;AACnD,0CAA6C;AAC7C,iCAAsE;AAE/D,IAAM,sBAAsB,GAAG,UAAC,KAAqC;IAC1E,IAAM,OAAO,GAAG,IAAA,0BAAkB,GAAE,CAAA;IAC9B,IAAA,KAAyB,IAAA,uBAAe,GAAE,EAAxC,KAAK,WAAA,EAAE,WAAW,iBAAsB,CAAA;IAChD,IAAM,SAAS,GAAG,IAAA,mCAA2B,EAAC,OAAO,EA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AAA;YAChD,IAAI,CAAC,iBAAiB;gBAAE,OAAO,IAAI,CAAA;YACnC,OAAO,uBAAC,iBAAiB,aAAgC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,EAAE,QAAQ,IAAM,KAAK,GAAhG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAA2E,CAAA;QACpI,CAAC,CAAC,GACA,CAAA;AACN,CAAC,CAAA;AAZY,QAAA,sBAAsB,0BAYlC"}
@@ -1,10 +1,10 @@
1
1
  import { FC } from 'react';
2
2
  import { MaterialFocus } from './MaterialFocus';
3
- export type FocusContextType = {
4
- focus?: MaterialFocus;
5
- setFocus: (focus?: MaterialFocus, reset?: boolean) => void;
6
- addFocusRef: (ref: HTMLElement | null) => void;
3
+ export type FocusContextType<P extends number = number, M extends number = number, L extends number = number> = {
4
+ focus?: MaterialFocus<P, M, L>;
5
+ setFocus: (focus?: MaterialFocus<P, M, L>, reset?: boolean) => void;
6
+ focusRef: (ref: HTMLElement | null) => void;
7
7
  };
8
- export declare const FocusContext: import("react").Context<FocusContextType | null>;
9
- export declare const useFocusContext: () => FocusContextType;
8
+ export declare const FocusContext: import("react").Context<FocusContextType<number, number, number> | null>;
9
+ export declare const useFocusContext: <P extends number = number, M extends number = number, L extends number = number>() => FocusContextType<P, M, L>;
10
10
  export declare const FocusProvider: FC;
@@ -51,7 +51,7 @@ var FocusProvider = function (_a) {
51
51
  var elements = Array.from(focusRefs.current);
52
52
  setTimeout(function () { var _a; return zoomToElements(elements, { animationTime: (_a = focus === null || focus === void 0 ? void 0 : focus.animationTime) !== null && _a !== void 0 ? _a : 1000, margin: focus === null || focus === void 0 ? void 0 : focus.margin, scale: focus === null || focus === void 0 ? void 0 : focus.scale }); }, 50);
53
53
  }, [zoomToElements]);
54
- var addFocusRef = (0, react_1.useCallback)(function (ref) {
54
+ var focusRef = (0, react_1.useCallback)(function (ref) {
55
55
  if (!ref || focusRefs.current.has(ref))
56
56
  return;
57
57
  focusRefs.current.add(ref);
@@ -59,7 +59,7 @@ var FocusProvider = function (_a) {
59
59
  doFocus();
60
60
  }
61
61
  }, [doFocus]);
62
- return ((0, jsx_runtime_1.jsx)(exports.FocusContext.Provider, __assign({ value: { focus: focus, setFocus: setFocus, addFocusRef: addFocusRef } }, { children: children })));
62
+ return ((0, jsx_runtime_1.jsx)(exports.FocusContext.Provider, __assign({ value: { focus: focus, setFocus: setFocus, focusRef: focusRef } }, { children: children })));
63
63
  };
64
64
  exports.FocusProvider = FocusProvider;
65
65
  function countFocusRefs(focus, locators) {
@@ -1 +1 @@
1
- {"version":3,"file":"FocusProvider.js","sourceRoot":"","sources":["../../../../../src/components/material/GameTable/focus/FocusProvider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,uDAAgC;AAChC,+BAAoF;AACpF,6DAAkD;AAClD,2CAAqD;AACrD,6DAA2D;AAU9C,QAAA,YAAY,GAAG,IAAA,qBAAa,EAA0B,IAAI,CAAC,CAAA;AAEjE,IAAM,eAAe,GAAG;IAC7B,IAAM,YAAY,GAAG,IAAA,kBAAU,EAAC,oBAAY,CAAC,CAAA;IAC7C,IAAI,YAAY,KAAK,IAAI,EAAE;QACzB,MAAM,IAAI,KAAK,CAAC,iEAAiE,CAAC,CAAA;KACnF;IACD,OAAO,YAAY,CAAA;AACrB,CAAC,CAAA;AANY,QAAA,eAAe,mBAM3B;AAEM,IAAM,aAAa,GAAO,UAAC,EAAY;QAAV,QAAQ,cAAA;IAC1C,IAAM,cAAc,GAAG,IAAA,yBAAiB,GAAE,CAAA;IAClC,IAAA,cAAc,GAAK,IAAA,kCAAW,GAAE,eAAlB,CAAkB;IACxC,IAAM,QAAQ,GAAG,IAAA,yBAAW,GAAE,CAAA;IAExB,IAAA,KAAsB,IAAA,gBAAQ,GAAiB,EAA9C,KAAK,QAAA,EAAE,UAAU,QAA6B,CAAA;IACrD,IAAM,SAAS,GAAG,IAAA,cAAM,EAAmB,IAAI,GAAG,EAAE,CA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CAAC,SAAS,EAAE,UAAA,QAAQ;QAClC,OAAA,IAAA,eAAK,EAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE,UAAA,IAAI,oBAC7B,OAAA,IAAI,CAAC,GAAG,CAAC,MAAA,IAAI,CAAC,QAAQ,mCAAI,CAAC,EAAE,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,0CAAE,KAAK,mCAAI,QAAQ,CAAC,CAAA,EAAA,CAChF;IAFD,CAEC,CACF;UACC,IAAA,eAAK,EAAC,KAAK,CAAC,WAAW,EAAE,UAAC,EAAQ;;gBAAN,IAAI,UAAA;YAChC,OAAA,IAAI,CAAC,GAAG,CAAC,MAAA,IAAI,CAAC,QAAQ,mCAAI,CAAC,EAAE,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,0CAAE,KAAK,mCAAI,QAAQ,CAAC,CAAA;SAAA,CAChF;UACC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAA;AAC5B,CAAC"}
@@ -1,3 +1,2 @@
1
- export * from './LocationsWithFocus';
2
1
  export * from './FocusProvider';
3
2
  export * from './MaterialFocus';
@@ -14,7 +14,6 @@ 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("./LocationsWithFocus"), exports);
18
17
  __exportStar(require("./FocusProvider"), exports);
19
18
  __exportStar(require("./MaterialFocus"), exports);
20
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/material/GameTable/focus/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAoC;AACpC,kDAA+B;AAC/B,kDAA+B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/material/GameTable/focus/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAA+B;AAC/B,kDAA+B"}
@@ -14,19 +14,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.MaterialImageLoader = void 0;
15
15
  var jsx_runtime_1 = require("react/jsx-runtime");
16
16
  var react_1 = require("react");
17
+ var GameProvider_1 = require("../../GameProvider");
17
18
  var ImagesLoader_1 = require("../../ImagesLoader");
18
- var useMaterials_1 = require("../../../hooks/useMaterials");
19
- var useMaterialImages = function () {
20
- var descriptions = (0, useMaterials_1.useMaterials)();
21
- return (0, react_1.useMemo)(function () {
22
- if (!descriptions) {
23
- return [];
24
- }
25
- return Object.values(descriptions).flatMap(function (description) { return description.getImages(); });
26
- }, [descriptions]);
27
- };
28
19
  var MaterialImageLoader = function (props) {
29
- var images = useMaterialImages();
20
+ var context = (0, react_1.useContext)(GameProvider_1.gameContext);
21
+ var images = (0, react_1.useMemo)(function () {
22
+ var _a, _b;
23
+ var images = [];
24
+ for (var _i = 0, _c = Object.values((_a = context.material) !== null && _a !== void 0 ? _a : {}); _i < _c.length; _i++) {
25
+ var description = _c[_i];
26
+ if (description)
27
+ images.push.apply(images, description.getImages());
28
+ }
29
+ for (var _d = 0, _e = Object.values((_b = context.locators) !== null && _b !== void 0 ? _b : {}); _d < _e.length; _d++) {
30
+ var locator = _e[_d];
31
+ if (locator === null || locator === void 0 ? void 0 : locator.locationDescription)
32
+ images.push.apply(images, locator.locationDescription.getImages());
33
+ }
34
+ return images;
35
+ }, [context.material, context.locators]);
30
36
  return (0, jsx_runtime_1.jsx)(ImagesLoader_1.ImagesLoader, __assign({ images: images }, props));
31
37
  };
32
38
  exports.MaterialImageLoader = MaterialImageLoader;
@@ -1 +1 @@
1
- {"version":3,"file":"MaterialImageLoader.js","sourceRoot":"","sources":["../../../../src/components/material/ImageLoader/MaterialImageLoader.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAAmC;AACnC,mDAAoE;AACpE,4DAA0D;AAI1D,IAAM,iBAAiB,GAAG;IACxB,IAAM,YAAY,GAAG,IAAA,2BAAY,GAAE,CAAA;IACnC,OAAO,IAAA,eAAO,EAAC;QACb,IAAI,CAAC,YAAY,EAAE;YACjB,OAAO,EAAE,CAAA;SACV;QACD,OAAO,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,UAAC,WAAW,IAAK,OAAA,WAAW,CAAC,SAAS,EAAE,EAAvB,CAAuB,CAAC,CAAA;IACtF,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAA;AACpB,CAAC,CAAA;AAED,IAAM,mBAAmB,GAAiC,UAAC,KAAK;IAC9D,IAAM,MAAM,GAAG,iBAAiB,EAAE,CAAA;IAElC,OAAO,uBAAC,2BAAY,aAAC,MAAM,EAAE,MAAM,IAAM,KAAK,EAAI,CAAA;AACpD,CAAC,CAAA;AAGC,kDAAmB"}
1
+ {"version":3,"file":"MaterialImageLoader.js","sourceRoot":"","sources":["../../../../src/components/material/ImageLoader/MaterialImageLoader.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAA+C;AAC/C,mDAAgD;AAChD,mDAAoE;AAIpE,IAAM,mBAAmB,GAAiC,UAAC,KAAK;IAC9D,IAAM,OAAO,GAAG,IAAA,kBAAU,EAAC,0BAAW,CAAC,CAAA;IACvC,IAAM,MAAM,GAAG,IAAA,eAAO,EAAC;;QACrB,IAAM,MAAM,GAAa,EAAE,CAAA;QAC3B,KAA0B,UAAqC,EAArC,KAAA,MAAM,CAAC,MAAM,CAAC,MAAA,OAAO,CAAC,QAAQ,mCAAI,EAAE,CAAC,EAArC,cAAqC,EAArC,IAAqC,EAAE;YAA5D,IAAM,WAAW,SAAA;YACpB,IAAI,WAAW;gBAAE,MAAM,CAAC,IAAI,OAAX,MAAM,EAAS,WAAW,CAAC,SAAS,EAAE,EAAC;SACzD;QACD,KAAsB,UAAqC,EAArC,KAAA,MAAM,CAAC,MAAM,CAAC,MAAA,OAAO,CAAC,QAAQ,mCAAI,EAAE,CAAC,EAArC,cAAqC,EAArC,IAAqC,EAAE;YAAxD,IAAM,OAAO,SAAA;YAChB,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,mBAAmB;gBAAE,MAAM,CAAC,IAAI,OAAX,MAAM,EAAS,OAAO,CAAC,mBAAmB,CAAC,SAAS,EAAE,EAAC;SAC1F;QACD,OAAO,MAAM,CAAA;IACf,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAA;IAExC,OAAO,uBAAC,2BAAY,aAAC,MAAM,EAAE,MAAM,IAAM,KAAK,EAAI,CAAA;AACpD,CAAC,CAAA;AAGC,kDAAmB"}
@@ -2,16 +2,12 @@ import { HTMLAttributes } from 'react';
2
2
  export type MaterialComponentProps<M extends number = number, ItemId = any> = {
3
3
  type: M;
4
4
  itemId?: ItemId;
5
- onShortClick?: () => void;
6
- onLongClick?: () => void;
7
5
  highlight?: boolean;
8
6
  playDown?: boolean;
9
7
  } & HTMLAttributes<HTMLElement>;
10
8
  export declare const MaterialComponent: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<{
11
9
  type: number;
12
10
  itemId?: any;
13
- onShortClick?: (() => void) | undefined;
14
- onLongClick?: (() => void) | undefined;
15
11
  highlight?: boolean | undefined;
16
12
  playDown?: boolean | undefined;
17
13
  } & HTMLAttributes<HTMLElement> & import("react").RefAttributes<HTMLDivElement>>>;
@@ -30,32 +30,19 @@ exports.MaterialComponent = void 0;
30
30
  var jsx_runtime_1 = require("@emotion/react/jsx-runtime");
31
31
  var react_1 = require("@emotion/react");
32
32
  var react_2 = require("react");
33
- var use_long_press_1 = require("use-long-press");
34
33
  var css_1 = require("../../css");
35
34
  var hooks_1 = require("../../hooks");
36
- var utilities_1 = require("../../utilities");
37
35
  exports.MaterialComponent = (0, react_2.memo)((0, react_2.forwardRef)(function (_a, ref) {
38
- var type = _a.type, itemId = _a.itemId, onShortClick = _a.onShortClick, onLongClick = _a.onLongClick, highlight = _a.highlight, playDown = _a.playDown, props = __rest(_a, ["type", "itemId", "onShortClick", "onLongClick", "highlight", "playDown"]);
36
+ var type = _a.type, itemId = _a.itemId, highlight = _a.highlight, playDown = _a.playDown, props = __rest(_a, ["type", "itemId", "highlight", "playDown"]);
39
37
  var description = (0, hooks_1.useMaterialDescription)(type);
40
- var listeners = (0, use_long_press_1.useLongPress)(function () { return onLongClick && onLongClick(); }, {
41
- detect: use_long_press_1.LongPressEventType.Pointer,
42
- cancelOnMovement: 5,
43
- threshold: 600,
44
- onCancel: function (_, _a) {
45
- var reason = _a.reason;
46
- if (reason === use_long_press_1.LongPressCallbackReason.CancelledByRelease) {
47
- setTimeout(function () { return onShortClick && onShortClick(); });
48
- }
49
- },
50
- filterEvents: function (event) { return !event.button; }
51
- })();
52
38
  if (!description)
53
39
  return null;
54
40
  var _b = description.getSize(itemId), width = _b.width, height = _b.height;
55
41
  var componentCss = (0, react_2.useMemo)(function () { return [materialCss, (0, css_1.sizeCss)(width, height)]; }, [width, height]);
56
- return ((0, jsx_runtime_1.jsx)("div", __assign({ ref: ref, css: componentCss }, props, (0, utilities_1.combineEventListeners)(listeners, props), { children: description.content(__assign({ itemId: itemId, highlight: highlight, playDown: playDown }, props)) })));
42
+ return ((0, jsx_runtime_1.jsx)("div", __assign({ ref: ref, css: componentCss }, props, { children: (0, jsx_runtime_1.jsx)("div", __assign({ css: hoverWrapper }, { children: description.content(__assign({ itemId: itemId, highlight: highlight, playDown: playDown }, props)) })) })));
57
43
  }));
44
+ var hoverWrapper = (0, react_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n transform-style: preserve-3d;\n -webkit-tap-highlight-color: transparent;\n transform-origin: center;\n width: 100%;\n height: 100%;\n"], ["\n transform-style: preserve-3d;\n -webkit-tap-highlight-color: transparent;\n transform-origin: center;\n width: 100%;\n height: 100%;\n"])));
58
45
  exports.MaterialComponent.displayName = 'MaterialComponent';
59
- var materialCss = (0, react_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n transform-style: preserve-3d;\n -webkit-tap-highlight-color: transparent;\n"], ["\n transform-style: preserve-3d;\n -webkit-tap-highlight-color: transparent;\n"])));
60
- var templateObject_1;
46
+ var materialCss = (0, react_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n transform-style: preserve-3d;\n -webkit-tap-highlight-color: transparent;\n"], ["\n transform-style: preserve-3d;\n -webkit-tap-highlight-color: transparent;\n"])));
47
+ var templateObject_1, templateObject_2;
61
48
  //# sourceMappingURL=MaterialComponent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MaterialComponent.js","sourceRoot":"","sources":["../../../src/components/material/MaterialComponent.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,wCAAoC;AACpC,+BAA6E;AAC7E,iDAA0F;AAC1F,iCAAmC;AACnC,qCAAoD;AACpD,6CAAuD;AAW1C,QAAA,iBAAiB,GAAG,IAAA,YAAI,EAAC,IAAA,kBAAU,EAAyC,UACvF,EAA0E,EAAE,GAAG;IAA7E,IAAA,IAAI,UAAA,EAAE,MAAM,YAAA,EAAE,YAAY,kBAAA,EAAE,WAAW,iBAAA,EAAE,SAAS,eAAA,EAAE,QAAQ,cAAA,EAAK,KAAK,cAAxE,0EAA0E,CAAF;IAExE,IAAM,WAAW,GAAG,IAAA,8BAAsB,EAAC,IAAI,CAAC,CAAA;IAEhD,IAAM,SAAS,GAAG,IAAA,6BAAY,EAAC,cAAM,OAAA,WAAW,IAAI,WAAW,EAAE,EAA5B,CAA4B,EAAE;QACjE,MAAM,EAAE,mCAAkB,CAAC,OAAO;QAClC,gBAAgB,EAAE,CAAC;QACnB,SAAS,EAAE,GAAG;QACd,QAAQ,EAAE,UAAC,CAAC,EAAE,EAAU;gBAAR,MAAM,YAAA;YACpB,I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AlD,IAAA,IAAI,UAAA,EAAE,MAAM,YAAA,EAAE,SAAS,eAAA,EAAE,QAAQ,cAAA,EAAK,KAAK,cAA7C,2CAA+C,CAAF;IAE7C,IAAM,WAAW,GAAG,IAAA,8BAAsB,EAAC,IAAI,CAAC,CAAA;IAEhD,IAAI,CAAC,WAAW;QAAE,OAAO,IAAI,CAAA;IAEvB,IAAA,KAAoB,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,EAA7C,KAAK,WAAA,EAAE,MAAM,YAAgC,CAAA;IAErD,IAAM,YAAY,GAAG,IAAA,eAAO,EAAC,cAAM,OAAA,CAAC,WAAW,EAAE,IAAA,aAAO,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC,EAArC,CAAqC,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAA;IAE1F,OAAO,CACL,yCAAK,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,YAAY,IAAM,KAAK,cACzC,yCAAK,GAAG,EAAE,YAAY,gBACnB,WAAW,CAAC,OAAO,YAAG,MAAM,QAAA,EAAE,SAAS,WAAA,EAAE,QAAQ,UAAA,IAAK,KAAK,EAAG,IAC3D,IACF,CACP,CAAA;AACH,CAAC,CAAC,CAAC,CAAA;AAEH,IAAM,YAAY,OAAG,WAAG,oNAAA,gJAMvB,IAAA,CAAA;AAED,yBAAiB,CAAC,WAAW,GAAG,mBAAmB,CAAA;AAEnD,IAAM,WAAW,OAAG,WAAG,sJAAA,kFAGtB,IAAA,CAAA"}
@@ -2,19 +2,16 @@ import { Interpolation, Theme } from '@emotion/react';
2
2
  import { Location, MaterialHelpDisplay, MaterialItem, MaterialMove } from '@gamepark/rules-api';
3
3
  import { ComponentType, FC, HTMLAttributes } from 'react';
4
4
  import { ItemContext, MaterialContext } from '../../locators';
5
+ import { ComponentDescription } from './ComponentDescription';
5
6
  export type MaterialHelpProps<P extends number = number, M extends number = number, L extends number = number> = {
6
7
  closeDialog: () => void;
7
8
  } & Omit<MaterialHelpDisplay<P, M, L>, 'type'>;
8
- export type ComponentSize = {
9
- width: number;
10
- height: number;
11
- };
12
9
  export type MaterialContentProps<ItemId = any> = {
13
10
  itemId: ItemId;
14
11
  highlight?: boolean;
15
12
  playDown?: boolean;
16
13
  } & HTMLAttributes<HTMLElement>;
17
- export declare abstract class MaterialDescription<P extends number = number, M extends number = number, L extends number = number, ItemId = any> {
14
+ export declare abstract class MaterialDescription<P extends number = number, M extends number = number, L extends number = number, ItemId = any> extends ComponentDescription<ItemId> {
18
15
  help?: ComponentType<MaterialHelpProps<P, M, L>>;
19
16
  abstract content: FC<MaterialContentProps<ItemId>>;
20
17
  isMobile: boolean;
@@ -31,18 +28,13 @@ export declare abstract class MaterialDescription<P extends number = number, M e
31
28
  canShortClick(move: MaterialMove<P, M, L>, { type, index }: ItemContext<P, M, L>): boolean;
32
29
  getShortClickMove(_context: ItemContext<P, M, L>): MaterialMove<P, M, L> | undefined;
33
30
  getShortClickLocalMove(_context: ItemContext<P, M, L>): MaterialMove<P, M, L> | undefined;
34
- height?: number;
35
- width?: number;
36
- ratio?: number;
37
- borderRadius?: number;
38
- getSize(_itemId: ItemId): ComponentSize;
39
- getBorderRadius(_itemId: ItemId): number | undefined;
40
- abstract getImages(): string[];
41
31
  thickness: number;
42
32
  getThickness(_item: MaterialItem<P, L>, _context: ItemContext<P, M, L>): number;
43
- getRotations(_item: MaterialItem<P, L>, _context: ItemContext<P, M, L>): string[];
44
33
  getItemExtraCss(_item: MaterialItem<P, L>, _context: ItemContext<P, M, L>): Interpolation<Theme>;
45
34
  highlight(_item: MaterialItem<P, L>, _context: ItemContext<P, M, L>): boolean | undefined;
46
35
  displayHelp(item: MaterialItem<P, L>, { type, index, displayIndex }: ItemContext<P, M, L>): import("@gamepark/rules-api").DisplayHelp<P, M, L>;
36
+ getItemTransform(item: MaterialItem<P, L>, context: ItemContext<P, M, L>): string[];
37
+ getHoverTransform(_item: MaterialItem<P, L>, _context: ItemContext<P, M, L>): string[];
38
+ getDropLocations(item: MaterialItem<P, L>, move: MaterialMove<P, M, L>, context: ItemContext<P, M, L>): Location<P, L>[];
47
39
  }
48
40
  export type MaterialDescriptionRecord<P extends number = number, M extends number = number, L extends number = number> = Record<M, MaterialDescription<P, M, L>>;
@@ -1,13 +1,33 @@
1
1
  "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
2
17
  Object.defineProperty(exports, "__esModule", { value: true });
3
18
  exports.MaterialDescription = void 0;
4
19
  var rules_api_1 = require("@gamepark/rules-api");
5
- var MaterialDescription = (function () {
20
+ var ComponentDescription_1 = require("./ComponentDescription");
21
+ var displayMaterialHelp = rules_api_1.MaterialMoveBuilder.displayMaterialHelp;
22
+ var MaterialDescription = (function (_super) {
23
+ __extends(MaterialDescription, _super);
6
24
  function MaterialDescription() {
7
- this.isMobile = false;
8
- this.staticItems = [];
9
- this.locations = [];
10
- this.thickness = 0.05;
25
+ var _this = _super !== null && _super.apply(this, arguments) || this;
26
+ _this.isMobile = false;
27
+ _this.staticItems = [];
28
+ _this.locations = [];
29
+ _this.thickness = 0.05;
30
+ return _this;
11
31
  }
12
32
  MaterialDescription.prototype.getStaticItems = function (_context) {
13
33
  return this.staticItem ? [this.staticItem] : this.staticItems;
@@ -35,24 +55,9 @@ var MaterialDescription = (function () {
35
55
  MaterialDescription.prototype.getShortClickLocalMove = function (_context) {
36
56
  return undefined;
37
57
  };
38
- MaterialDescription.prototype.getSize = function (_itemId) {
39
- if (this.width && this.height)
40
- return { width: this.width, height: this.height };
41
- if (this.ratio && this.width)
42
- return { width: this.width, height: this.width / this.ratio };
43
- if (this.ratio && this.height)
44
- return { width: this.height * this.ratio, height: this.height };
45
- throw new Error('You must implement 2 of "width", "height" & "ratio" in any Material description');
46
- };
47
- MaterialDescription.prototype.getBorderRadius = function (_itemId) {
48
- return this.borderRadius;
49
- };
50
58
  MaterialDescription.prototype.getThickness = function (_item, _context) {
51
59
  return this.thickness;
52
60
  };
53
- MaterialDescription.prototype.getRotations = function (_item, _context) {
54
- return [];
55
- };
56
61
  MaterialDescription.prototype.getItemExtraCss = function (_item, _context) {
57
62
  return;
58
63
  };
@@ -61,9 +66,30 @@ var MaterialDescription = (function () {
61
66
  };
62
67
  MaterialDescription.prototype.displayHelp = function (item, _a) {
63
68
  var type = _a.type, index = _a.index, displayIndex = _a.displayIndex;
64
- return (0, rules_api_1.displayMaterialHelp)(type, item, index, displayIndex);
69
+ return displayMaterialHelp(type, item, index, displayIndex);
70
+ };
71
+ MaterialDescription.prototype.getItemTransform = function (item, context) {
72
+ var transform = ['translate(-50%, -50%)'];
73
+ var locator = context.locators[item.location.type];
74
+ if (locator)
75
+ transform.push.apply(transform, locator.placeItem(item, context));
76
+ return transform;
77
+ };
78
+ MaterialDescription.prototype.getHoverTransform = function (_item, _context) {
79
+ return [];
80
+ };
81
+ MaterialDescription.prototype.getDropLocations = function (item, move, context) {
82
+ var _a;
83
+ if ((0, rules_api_1.isMoveItem)(move) && move.location.type !== undefined) {
84
+ return [move.location];
85
+ }
86
+ else if ((0, rules_api_1.isDeleteItem)(move)) {
87
+ var stockLocation = (_a = context.material[context.type]) === null || _a === void 0 ? void 0 : _a.getStockLocation(item, context);
88
+ return stockLocation ? [stockLocation] : [];
89
+ }
90
+ return [];
65
91
  };
66
92
  return MaterialDescription;
67
- }());
93
+ }(ComponentDescription_1.ComponentDescription));
68
94
  exports.MaterialDescription = MaterialDescription;
69
95
  //# sourceMappingURL=MaterialDescription.js.map