@gamepark/react-game 6.23.3 → 6.24.1

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 (175) 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/dialogs/RulesDialog/LocationRulesDialogContent.d.ts +1 -1
  4. package/dist/components/dialogs/RulesDialog/LocationRulesDialogContent.js +6 -6
  5. package/dist/components/dialogs/RulesDialog/LocationRulesDialogContent.js.map +1 -1
  6. package/dist/components/dialogs/RulesDialog/MaterialRulesDialogContent.js +13 -6
  7. package/dist/components/dialogs/RulesDialog/MaterialRulesDialogContent.js.map +1 -1
  8. package/dist/components/material/ComponentDescription.d.ts +14 -0
  9. package/dist/components/material/ComponentDescription.js +27 -0
  10. package/dist/components/material/ComponentDescription.js.map +1 -0
  11. package/dist/components/material/Dices/CubicDiceDescription.d.ts +1 -0
  12. package/dist/components/material/Dices/CubicDiceDescription.js +13 -0
  13. package/dist/components/material/Dices/CubicDiceDescription.js.map +1 -1
  14. package/dist/components/material/DraggableMaterial.d.ts +1 -13
  15. package/dist/components/material/DraggableMaterial.js +37 -91
  16. package/dist/components/material/DraggableMaterial.js.map +1 -1
  17. package/dist/components/material/FlatMaterial/CardDescription.d.ts +2 -2
  18. package/dist/components/material/FlatMaterial/CardDescription.js +1 -1
  19. package/dist/components/material/FlatMaterial/CardDescription.js.map +1 -1
  20. package/dist/components/material/FlatMaterial/FlatMaterial.d.ts +4 -2
  21. package/dist/components/material/FlatMaterial/FlatMaterial.js +17 -11
  22. package/dist/components/material/FlatMaterial/FlatMaterial.js.map +1 -1
  23. package/dist/components/material/FlatMaterial/TokenDescription.d.ts +1 -1
  24. package/dist/components/material/FlatMaterial/TokenDescription.js.map +1 -1
  25. package/dist/components/material/GameTable/GameMaterialDisplay.js +1 -1
  26. package/dist/components/material/GameTable/GameMaterialDisplay.js.map +1 -1
  27. package/dist/components/material/GameTable/GameTable.js +9 -7
  28. package/dist/components/material/GameTable/GameTable.js.map +1 -1
  29. package/dist/components/material/GameTable/ItemDisplay.d.ts +4 -2
  30. package/dist/components/material/GameTable/ItemDisplay.js +104 -15
  31. package/dist/components/material/GameTable/ItemDisplay.js.map +1 -1
  32. package/dist/components/material/GameTable/StaticItemsDisplay.js +2 -2
  33. package/dist/components/material/GameTable/StaticItemsDisplay.js.map +1 -1
  34. package/dist/components/material/GameTable/StaticLocationsDisplay.js +12 -12
  35. package/dist/components/material/GameTable/StaticLocationsDisplay.js.map +1 -1
  36. package/dist/components/material/GameTable/focus/FocusProvider.d.ts +6 -6
  37. package/dist/components/material/GameTable/focus/FocusProvider.js +2 -2
  38. package/dist/components/material/GameTable/focus/FocusProvider.js.map +1 -1
  39. package/dist/components/material/GameTable/focus/LocationsWithFocus.d.ts +2 -3
  40. package/dist/components/material/GameTable/focus/LocationsWithFocus.js +3 -10
  41. package/dist/components/material/GameTable/focus/LocationsWithFocus.js.map +1 -1
  42. package/dist/components/material/GameTable/focus/index.d.ts +0 -1
  43. package/dist/components/material/GameTable/focus/index.js +0 -1
  44. package/dist/components/material/GameTable/focus/index.js.map +1 -1
  45. package/dist/components/material/ImageLoader/MaterialImageLoader.js +17 -11
  46. package/dist/components/material/ImageLoader/MaterialImageLoader.js.map +1 -1
  47. package/dist/components/material/MaterialComponent.d.ts +0 -4
  48. package/dist/components/material/MaterialComponent.js +5 -18
  49. package/dist/components/material/MaterialComponent.js.map +1 -1
  50. package/dist/components/material/MaterialDescription.d.ts +5 -13
  51. package/dist/components/material/MaterialDescription.js +48 -22
  52. package/dist/components/material/MaterialDescription.js.map +1 -1
  53. package/dist/components/material/Writing/WritingDescription.d.ts +0 -4
  54. package/dist/components/material/Writing/WritingDescription.js +0 -10
  55. package/dist/components/material/Writing/WritingDescription.js.map +1 -1
  56. package/dist/components/material/animations/MaterialAnimations.d.ts +2 -2
  57. package/dist/components/material/animations/MoveItemAnimations.js +11 -13
  58. package/dist/components/material/animations/MoveItemAnimations.js.map +1 -1
  59. package/dist/components/material/animations/MoveItemAtOnceAnimations.js +7 -10
  60. package/dist/components/material/animations/MoveItemAtOnceAnimations.js.map +1 -1
  61. package/dist/components/material/animations/RollItemAnimations.js +3 -5
  62. package/dist/components/material/animations/RollItemAnimations.js.map +1 -1
  63. package/dist/components/material/animations/getFirstStockItemTransforms.util.js +3 -6
  64. package/dist/components/material/animations/getFirstStockItemTransforms.util.js.map +1 -1
  65. package/dist/components/material/animations/transformItem.util.js +3 -5
  66. package/dist/components/material/animations/transformItem.util.js.map +1 -1
  67. package/dist/components/material/index.d.ts +1 -0
  68. package/dist/components/material/index.js +1 -0
  69. package/dist/components/material/index.js.map +1 -1
  70. package/dist/components/material/locations/DropAreaDescription.d.ts +9 -0
  71. package/dist/components/material/locations/DropAreaDescription.js +39 -0
  72. package/dist/components/material/locations/DropAreaDescription.js.map +1 -0
  73. package/dist/components/material/locations/LocationComponent.d.ts +16 -0
  74. package/dist/components/material/locations/LocationComponent.js +89 -0
  75. package/dist/components/material/locations/LocationComponent.js.map +1 -0
  76. package/dist/components/material/locations/LocationDescription.d.ts +14 -25
  77. package/dist/components/material/locations/LocationDescription.js +43 -50
  78. package/dist/components/material/locations/LocationDescription.js.map +1 -1
  79. package/dist/components/material/locations/LocationDisplay.d.ts +4 -1
  80. package/dist/components/material/locations/LocationDisplay.js +4 -9
  81. package/dist/components/material/locations/LocationDisplay.js.map +1 -1
  82. package/dist/components/material/locations/LocationsMask.js +4 -4
  83. package/dist/components/material/locations/LocationsMask.js.map +1 -1
  84. package/dist/components/material/locations/SimpleDropArea.d.ts +4 -7
  85. package/dist/components/material/locations/SimpleDropArea.js +18 -88
  86. package/dist/components/material/locations/SimpleDropArea.js.map +1 -1
  87. package/dist/components/material/locations/index.d.ts +1 -0
  88. package/dist/components/material/locations/index.js +1 -0
  89. package/dist/components/material/locations/index.js.map +1 -1
  90. package/dist/components/material/utils/isDroppedItem.js +12 -1
  91. package/dist/components/material/utils/isDroppedItem.js.map +1 -1
  92. package/dist/components/material/utils/isPlacedOnItem.d.ts +3 -3
  93. package/dist/components/material/utils/isPlacedOnItem.js +5 -5
  94. package/dist/components/material/utils/isPlacedOnItem.js.map +1 -1
  95. package/dist/components/tutorial/MaterialTutorial.js +4 -4
  96. package/dist/components/tutorial/MaterialTutorial.js.map +1 -1
  97. package/dist/components/tutorial/MaterialTutorialDisplay.js +7 -6
  98. package/dist/components/tutorial/MaterialTutorialDisplay.js.map +1 -1
  99. package/dist/components/tutorial/TutorialRulesWrapper.js +26 -26
  100. package/dist/components/tutorial/TutorialRulesWrapper.js.map +1 -1
  101. package/dist/hooks/index.d.ts +1 -1
  102. package/dist/hooks/index.js +1 -1
  103. package/dist/hooks/index.js.map +1 -1
  104. package/dist/hooks/useDraggedItem.d.ts +2 -0
  105. package/dist/hooks/useDraggedItem.js +19 -0
  106. package/dist/hooks/useDraggedItem.js.map +1 -0
  107. package/dist/hooks/useItemLocations.d.ts +8 -0
  108. package/dist/hooks/useItemLocations.js +83 -0
  109. package/dist/hooks/useItemLocations.js.map +1 -0
  110. package/dist/hooks/useItemLocator.d.ts +2 -2
  111. package/dist/hooks/useItemLocator.js.map +1 -1
  112. package/dist/hooks/useLegalMoves.js +4 -18
  113. package/dist/hooks/useLegalMoves.js.map +1 -1
  114. package/dist/hooks/useStaticLocations.d.ts +2 -0
  115. package/dist/hooks/useStaticLocations.js +53 -0
  116. package/dist/hooks/useStaticLocations.js.map +1 -0
  117. package/dist/hooks/useTutorialStep.js +2 -2
  118. package/dist/hooks/useTutorialStep.js.map +1 -1
  119. package/dist/hooks/useZoomToElements.d.ts +1 -1
  120. package/dist/hooks/useZoomToElements.js +8 -8
  121. package/dist/hooks/useZoomToElements.js.map +1 -1
  122. package/dist/index.d.ts +1 -1
  123. package/dist/index.js +3 -1
  124. package/dist/index.js.map +1 -1
  125. package/dist/locators/DeckLocator.d.ts +5 -4
  126. package/dist/locators/DeckLocator.js +6 -8
  127. package/dist/locators/DeckLocator.js.map +1 -1
  128. package/dist/locators/FlexLocator.d.ts +18 -0
  129. package/dist/locators/FlexLocator.js +88 -0
  130. package/dist/locators/FlexLocator.js.map +1 -0
  131. package/dist/locators/HandLocator.d.ts +22 -13
  132. package/dist/locators/HandLocator.js +71 -39
  133. package/dist/locators/HandLocator.js.map +1 -1
  134. package/dist/locators/LineLocator.d.ts +8 -8
  135. package/dist/locators/LineLocator.js +22 -30
  136. package/dist/locators/LineLocator.js.map +1 -1
  137. package/dist/locators/ListLocator.d.ts +18 -0
  138. package/dist/locators/ListLocator.js +97 -0
  139. package/dist/locators/ListLocator.js.map +1 -0
  140. package/dist/locators/Locator.d.ts +50 -0
  141. package/dist/locators/Locator.js +152 -0
  142. package/dist/locators/Locator.js.map +1 -0
  143. package/dist/locators/PileLocator.d.ts +13 -11
  144. package/dist/locators/PileLocator.js +45 -31
  145. package/dist/locators/PileLocator.js.map +1 -1
  146. package/dist/locators/index.d.ts +3 -3
  147. package/dist/locators/index.js +3 -3
  148. package/dist/locators/index.js.map +1 -1
  149. package/dist/utilities/combineEventListeners.js.map +1 -1
  150. package/dist/utilities/findIfUnique.util.js.map +1 -1
  151. package/dist/utilities/index.d.ts +1 -0
  152. package/dist/utilities/index.js +1 -0
  153. package/dist/utilities/index.js.map +1 -1
  154. package/dist/utilities/translation.util.d.ts +5 -0
  155. package/dist/utilities/translation.util.js +33 -0
  156. package/dist/utilities/translation.util.js.map +1 -0
  157. package/dist/utilities/zoom-pan-pinch/animations.constants.d.ts +16 -0
  158. package/dist/utilities/zoom-pan-pinch/animations.constants.js +62 -0
  159. package/dist/utilities/zoom-pan-pinch/animations.constants.js.map +1 -0
  160. package/dist/utilities/zoom-pan-pinch/animations.util.d.ts +4 -0
  161. package/dist/utilities/zoom-pan-pinch/animations.util.js +71 -0
  162. package/dist/utilities/zoom-pan-pinch/animations.util.js.map +1 -0
  163. package/dist/utilities/zoom-pan-pinch/bounds.util.d.ts +7 -0
  164. package/dist/utilities/zoom-pan-pinch/bounds.util.js +77 -0
  165. package/dist/utilities/zoom-pan-pinch/bounds.util.js.map +1 -0
  166. package/dist/utilities/zoom-pan-pinch/calculation.util.d.ts +2 -0
  167. package/dist/utilities/zoom-pan-pinch/calculation.util.js +12 -0
  168. package/dist/utilities/zoom-pan-pinch/calculation.util.js.map +1 -0
  169. package/dist/utilities/zoom-pan-pinch/index.d.ts +5 -0
  170. package/dist/utilities/zoom-pan-pinch/index.js +22 -0
  171. package/dist/utilities/zoom-pan-pinch/index.js.map +1 -0
  172. package/dist/utilities/zoom-pan-pinch/zoom.util.d.ts +1 -0
  173. package/dist/utilities/zoom-pan-pinch/zoom.util.js +14 -0
  174. package/dist/utilities/zoom-pan-pinch/zoom.util.js.map +1 -0
  175. package/package.json +3 -3
@@ -0,0 +1,8 @@
1
+ import { Location, MaterialItem } from '@gamepark/rules-api';
2
+ import { ItemContext } from '../locators';
3
+ export type LocationFocusRef<P extends number = number, L extends number = number> = {
4
+ location: Location<P, L>;
5
+ focusRef?: (ref: HTMLElement | null) => void;
6
+ };
7
+ export declare function useItemLocations<P extends number = number, M extends number = number, L extends number = number>(item: MaterialItem<P, L>, context: ItemContext<P, M, L>): LocationFocusRef<P, L>[];
8
+ export declare const useExpectedDropLocations: <P extends number = number, M extends number = number, L extends number = number>() => Location<P, L, any, any>[];
@@ -0,0 +1,83 @@
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.useExpectedDropLocations = exports.useItemLocations = void 0;
18
+ var isEqual_1 = __importDefault(require("lodash/isEqual"));
19
+ var react_1 = require("react");
20
+ var components_1 = require("../components");
21
+ var useDraggedItem_1 = require("./useDraggedItem");
22
+ var useLegalMoves_1 = require("./useLegalMoves");
23
+ var useMaterialContext_1 = require("./useMaterialContext");
24
+ function useItemLocations(item, context) {
25
+ var _a, _b, _c, _d;
26
+ var index = context.index, type = context.type, locators = context.locators, material = context.material;
27
+ var _e = (0, components_1.useFocusContext)(), focus = _e.focus, focusRef = _e.focusRef;
28
+ if (!item)
29
+ return [];
30
+ var locations = (_b = (_a = material[type]) === null || _a === void 0 ? void 0 : _a.getLocations(item, context)) !== null && _b !== void 0 ? _b : [];
31
+ var result = locations.map(function (location) { return ({ location: location }); });
32
+ var locationsFocus = (_d = (_c = focus === null || focus === void 0 ? void 0 : focus.locations) === null || _c === void 0 ? void 0 : _c.filter(function (location) { var _a, _b; return ((_a = locators[location.type]) === null || _a === void 0 ? void 0 : _a.parentItemType) === type && ((_b = location.parent) !== null && _b !== void 0 ? _b : 0) === index; })) !== null && _d !== void 0 ? _d : [];
33
+ var _loop_1 = function (location_1) {
34
+ var index_1 = result.findIndex(function (r) { return (0, isEqual_1.default)(r.location, location_1); });
35
+ if (index_1 !== -1) {
36
+ result[index_1].focusRef = focusRef;
37
+ }
38
+ else {
39
+ result.push({ location: location_1, focusRef: focusRef });
40
+ }
41
+ };
42
+ for (var _i = 0, locationsFocus_1 = locationsFocus; _i < locationsFocus_1.length; _i++) {
43
+ var location_1 = locationsFocus_1[_i];
44
+ _loop_1(location_1);
45
+ }
46
+ return result;
47
+ }
48
+ exports.useItemLocations = useItemLocations;
49
+ var useExpectedDropLocations = function () {
50
+ var context = (0, useMaterialContext_1.useMaterialContext)();
51
+ var draggedItem = (0, useDraggedItem_1.useDraggedItem)();
52
+ var legalMoves = (0, useLegalMoves_1.useLegalMoves)();
53
+ return (0, react_1.useMemo)(function () {
54
+ var _a;
55
+ if (!draggedItem) {
56
+ delete context.expectedDropLocations;
57
+ }
58
+ else if (!context.expectedDropLocations) {
59
+ var description = context.material[draggedItem.type];
60
+ var item = context.rules.material(draggedItem.type).getItem(draggedItem.index);
61
+ var itemContext = __assign(__assign({}, context), draggedItem);
62
+ var locations = [];
63
+ for (var _i = 0, legalMoves_1 = legalMoves; _i < legalMoves_1.length; _i++) {
64
+ var move = legalMoves_1[_i];
65
+ if (description === null || description === void 0 ? void 0 : description.canDrag(move, itemContext)) {
66
+ var _loop_2 = function (dropLocation) {
67
+ if (!locations.some(function (location) { return (0, isEqual_1.default)(location, dropLocation); })) {
68
+ locations.push(dropLocation);
69
+ }
70
+ };
71
+ for (var _b = 0, _c = description.getDropLocations(item, move, itemContext); _b < _c.length; _b++) {
72
+ var dropLocation = _c[_b];
73
+ _loop_2(dropLocation);
74
+ }
75
+ }
76
+ }
77
+ context.expectedDropLocations = locations;
78
+ }
79
+ return (_a = context.expectedDropLocations) !== null && _a !== void 0 ? _a : [];
80
+ }, [draggedItem]);
81
+ };
82
+ exports.useExpectedDropLocations = useExpectedDropLocations;
83
+ //# sourceMappingURL=useItemLocations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useItemLocations.js","sourceRoot":"","sources":["../../src/hooks/useItemLocations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,2DAAoC;AACpC,+BAA+B;AAC/B,4CAA+C;AAE/C,mDAAiD;AACjD,iDAA+C;AAC/C,2DAAyD;AAOzD,SAAgB,gBAAgB,CAC9B,IAAwB,EAAE,OAA6B;;IAE/C,IAAA,KAAK,GAA+B,OAAO,MAAtC,EAAE,IAAI,GAAyB,OAAO,KAAhC,EAAE,QAAQ,GAAe,OAAO,SAAtB,EAAE,QAAQ,GAAK,OAAO,SAAZ,CAAY;IAC7C,IAAA,KAAsB,IAAA,4BAAe,GAAW,EAA9C,KAAK,WAAA,EAAE,QAAQ,cAA+B,CAAA;IACtD,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAA;IAEpB,IAAM,SAAS,GAAG,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BY,QAAA,wBAAwB,4BAyBpC"}
@@ -1,2 +1,2 @@
1
- import { ItemLocator } from '../locators';
2
- export declare function useItemLocator<P extends number = number, M extends number = number, L extends number = number>(type: L): ItemLocator<P, M, L> | undefined;
1
+ import { Locator } from '../locators';
2
+ export declare function useItemLocator<P extends number = number, M extends number = number, L extends number = number>(type: L): Locator<P, M, L> | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"useItemLocator.js","sourceRoot":"","sources":["../../src/hooks/useItemLocator.ts"],"names":[],"mappings":";;;AACA,6CAA2C;AAE3C,SAAgB,cAAc,CAC5B,IAAO;;IAEP,OAAO,MAAA,IAAA,yBAAW,GAAE,0CAAG,IAAI,CAAqC,CAAA;AAClE,CAAC;AAJD,wCAIC"}
1
+ {"version":3,"file":"useItemLocator.js","sourceRoot":"","sources":["../../src/hooks/useItemLocator.ts"],"names":[],"mappings":";;;AACA,6CAA2C;AAE3C,SAAgB,cAAc,CAC5B,IAAO;;IAEP,OAAO,MAAA,IAAA,yBAAW,GAAE,0CAAG,IAAI,CAAiC,CAAA;AAC9D,CAAC;AAJD,wCAIC"}
@@ -1,29 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useLegalMove = exports.useLegalMoves = void 0;
4
- var react_1 = require("react");
5
4
  var react_redux_1 = require("react-redux");
6
5
  var useIsAnimatingPlayerAction_1 = require("../components/material/utils/useIsAnimatingPlayerAction");
7
- var usePlayerId_1 = require("./usePlayerId");
8
- var useRules_1 = require("./useRules");
9
- var cache = {
10
- game: undefined,
11
- moves: []
12
- };
13
6
  function useLegalMoves(predicate) {
14
- var rules = (0, useRules_1.useRules)();
15
- var playerId = (0, usePlayerId_1.usePlayerId)();
7
+ var legalMoves = (0, react_redux_1.useSelector)(function (state) { return state.legalMoves; });
16
8
  var gameOver = (0, react_redux_1.useSelector)(function (state) { return state.gameOver; });
17
9
  var isAnimatingPlayerAction = (0, useIsAnimatingPlayerAction_1.useIsAnimatingPlayerAction)();
18
- if (rules && playerId !== undefined && cache.game !== rules.game && !isAnimatingPlayerAction) {
19
- cache.game = rules.game;
20
- cache.moves = rules.getLegalMoves(playerId);
21
- }
22
- return (0, react_1.useMemo)(function () {
23
- if (gameOver || isAnimatingPlayerAction)
24
- return [];
25
- return predicate ? cache.moves.filter(predicate) : cache.moves;
26
- }, [cache.moves, predicate, gameOver, isAnimatingPlayerAction]);
10
+ if (gameOver || isAnimatingPlayerAction)
11
+ return [];
12
+ return predicate ? legalMoves.filter(predicate) : legalMoves;
27
13
  }
28
14
  exports.useLegalMoves = useLegalMoves;
29
15
  function useLegalMove(predicate) {
@@ -1 +1 @@
1
- {"version":3,"file":"useLegalMoves.js","sourceRoot":"","sources":["../../src/hooks/useLegalMoves.ts"],"names":[],"mappings":";;;AACA,+BAA+B;AAC/B,2CAAyC;AACzC,sGAAoG;AACpG,6CAA2C;AAC3C,uCAAqC;AAOrC,IAAM,KAAK,GAAU;IACnB,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,EAAE;CACV,CAAA;AAED,SAAgB,aAAa,CAAa,SAAmC;IAC3E,IAAM,KAAK,GAAG,IAAA,mBAAQ,GAAE,CAAA;IACxB,IAAM,QAAQ,GAAG,IAAA,yBAAW,GAAE,CAAA;IAC9B,IAAM,QAAQ,GAAG,IAAA,yBAAW,EAAC,UAAC,KAAoB,IAAK,OAAA,KAAK,CAAC,QAAQ,EAAd,CAAc,CAAC,CAAA;IACtE,IAAM,uBAAuB,GAAG,IAAA,uDAA0B,GAAE,CAAA;IAC5D,IAAI,KAAK,IAAI,QAAQ,KAAK,SAAS,IAAI,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,IAAI,CAAC,uBAAuB,EAAE;QAC5F,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAA;QACvB,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAA;KAC5C;IACD,OAAO,IAAA,eAAO,E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,CAAA;IACtC,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AAChD,CAAC;AAHD,oCAGC"}
@@ -0,0 +1,2 @@
1
+ import { LocationFocusRef } from './useItemLocations';
2
+ export declare function useStaticLocations<P extends number = number, M extends number = number, L extends number = number>(): LocationFocusRef<P, L>[];
@@ -0,0 +1,53 @@
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.useStaticLocations = void 0;
7
+ var isEqual_1 = __importDefault(require("lodash/isEqual"));
8
+ var components_1 = require("../components");
9
+ var useItemLocations_1 = require("./useItemLocations");
10
+ var useMaterialContext_1 = require("./useMaterialContext");
11
+ function useStaticLocations() {
12
+ var _a, _b, _c;
13
+ var context = (0, useMaterialContext_1.useMaterialContext)();
14
+ var locators = context.locators;
15
+ var result = [];
16
+ for (var _i = 0, _d = Object.values(locators); _i < _d.length; _i++) {
17
+ var locator = _d[_i];
18
+ if (locator.parentItemType === undefined) {
19
+ for (var _e = 0, _f = locator.getLocations(context); _e < _f.length; _e++) {
20
+ var location_1 = _f[_e];
21
+ result.push({ location: location_1 });
22
+ }
23
+ }
24
+ }
25
+ var _g = (0, components_1.useFocusContext)(), focus = _g.focus, focusRef = _g.focusRef;
26
+ var locationsFocus = (_b = (_a = focus === null || focus === void 0 ? void 0 : focus.locations) === null || _a === void 0 ? void 0 : _a.filter(function (location) { var _a; return ((_a = locators[location.type]) === null || _a === void 0 ? void 0 : _a.parentItemType) === undefined; })) !== null && _b !== void 0 ? _b : [];
27
+ var _loop_1 = function (location_2) {
28
+ var index = result.findIndex(function (r) { return (0, isEqual_1.default)(r.location, location_2); });
29
+ if (index !== -1) {
30
+ result[index].focusRef = focusRef;
31
+ }
32
+ else {
33
+ result.push({ location: location_2, focusRef: focusRef });
34
+ }
35
+ };
36
+ for (var _h = 0, locationsFocus_1 = locationsFocus; _h < locationsFocus_1.length; _h++) {
37
+ var location_2 = locationsFocus_1[_h];
38
+ _loop_1(location_2);
39
+ }
40
+ var expectedDropLocations = (0, useItemLocations_1.useExpectedDropLocations)();
41
+ var _loop_2 = function (location_3) {
42
+ if (location_3.parent === undefined && ((_c = locators[location_3.type]) === null || _c === void 0 ? void 0 : _c.parentItemType) === undefined && !result.some(function (r) { return (0, components_1.isLocationSubset)(location_3, r.location); })) {
43
+ result.push({ location: location_3 });
44
+ }
45
+ };
46
+ for (var _j = 0, expectedDropLocations_1 = expectedDropLocations; _j < expectedDropLocations_1.length; _j++) {
47
+ var location_3 = expectedDropLocations_1[_j];
48
+ _loop_2(location_3);
49
+ }
50
+ return result;
51
+ }
52
+ exports.useStaticLocations = useStaticLocations;
53
+ //# sourceMappingURL=useStaticLocations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useStaticLocations.js","sourceRoot":"","sources":["../../src/hooks/useStaticLocations.ts"],"names":[],"mappings":";;;;;;AAAA,2DAAoC;AACpC,4CAAiE;AAEjE,uDAA+E;AAC/E,2DAAyD;AAEzD,SAAgB,kBAAkB;;IAChC,IAAM,OAAO,GAAG,IAAA,uCAAkB,GAAW,CAAA;IAC7C,IAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;IACjC,IAAM,MAAM,GAA6B,EAAE,CAAA;IAC3C,KAAsB,UAA6C,EAA7C,KAAA,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAuB,EAA7C,cAA6C,EAA7C,IAA6C,EAAE;QAAhE,IAAM,OAAO,SAAA;QAChB,IAAI,OAAO,CAAC,cAAc,KAAK,SAAS,EAAE;YACxC,KAAuB,UAA6B,EAA7B,KAAA,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,EAA7B,cAA6B,EAA7B,IAA6B,EAAE;gBAAjD,IAAM,UAAQ,SAAA;gBACjB,MAAM,CA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C,IAAI,CAAC,EAAE,QAAQ,YAAA,EAAE,CAAC,CAAA;SAC1B;;IAHH,KAAuB,UAAqB,EAArB,+CAAqB,EAArB,mCAAqB,EAArB,IAAqB;QAAvC,IAAM,UAAQ,8BAAA;gBAAR,UAAQ;KAIlB;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AAhCD,gDAgCC"}
@@ -7,9 +7,9 @@ var useGame_1 = require("./useGame");
7
7
  function useTutorialStep() {
8
8
  var game = (0, useGame_1.useGame)();
9
9
  var tutorial = (0, react_1.useContext)(components_1.gameContext).tutorial;
10
- if (!game || game.tutorialStep === undefined || !(0, components_1.isMaterialTutorial)(tutorial))
10
+ if (!game || !game.tutorial || !(0, components_1.isMaterialTutorial)(tutorial))
11
11
  return;
12
- return tutorial.steps[game.tutorialStep];
12
+ return tutorial.steps[game.tutorial.step];
13
13
  }
14
14
  exports.useTutorialStep = useTutorialStep;
15
15
  //# sourceMappingURL=useTutorialStep.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useTutorialStep.js","sourceRoot":"","sources":["../../src/hooks/useTutorialStep.ts"],"names":[],"mappings":";;;AAAA,4CAA6E;AAC7E,+BAAkC;AAClC,qCAAmC;AAGnC,SAAgB,eAAe;IAC7B,IAAM,IAAI,GAAG,IAAA,iBAAO,GAAgB,CAAA;IACpC,IAAM,QAAQ,GAAG,IAAA,kBAAU,EAAC,wBAAW,CAAC,CAAC,QAAQ,CAAA;IACjD,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS,IAAI,CAAC,IAAA,+BAAkB,EAAU,QAAQ,CAAC;QAAE,OAAM;IAC9F,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;AAC1C,CAAC;AALD,0CAKC"}
1
+ {"version":3,"file":"useTutorialStep.js","sourceRoot":"","sources":["../../src/hooks/useTutorialStep.ts"],"names":[],"mappings":";;;AAAA,4CAA6E;AAC7E,+BAAkC;AAClC,qCAAmC;AAGnC,SAAgB,eAAe;IAC7B,IAAM,IAAI,GAAG,IAAA,iBAAO,GAAgB,CAAA;IACpC,IAAM,QAAQ,GAAG,IAAA,kBAAU,EAAC,wBAAW,CAAC,CAAC,QAAQ,CAAA;IACjD,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAA,+BAAkB,EAAU,QAAQ,CAAC;QAAE,OAAM;IAC7E,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;AAC3C,CAAC;AALD,0CAKC"}
@@ -1,5 +1,5 @@
1
1
  import { Margin } from '../components';
2
- import { animations } from '../utilities/animations.constants';
2
+ import { animations } from '../utilities/zoom-pan-pinch';
3
3
  export declare function useZoomToElements(): (elements: HTMLElement[], options?: ZoomToElementsOptions) => void;
4
4
  type ZoomToElementsOptions = {
5
5
  scale?: number;
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useZoomToElements = void 0;
4
4
  var react_zoom_pan_pinch_1 = require("react-zoom-pan-pinch");
5
- var animations_util_1 = require("../utilities/animations.util");
6
- var bounds_util_1 = require("../utilities/bounds.util");
7
- var zoom_util_1 = require("../utilities/zoom.util");
5
+ var zoom_pan_pinch_1 = require("../utilities/zoom-pan-pinch");
6
+ var zoom_pan_pinch_2 = require("../utilities/zoom-pan-pinch");
7
+ var zoom_pan_pinch_3 = require("../utilities/zoom-pan-pinch");
8
8
  function useZoomToElements() {
9
9
  var libraryContext = (0, react_zoom_pan_pinch_1.useTransformContext)();
10
10
  return zoomToElements(libraryContext);
@@ -12,7 +12,7 @@ function useZoomToElements() {
12
12
  exports.useZoomToElements = useZoomToElements;
13
13
  var zoomToElements = function (contextInstance) { return function (nodes, options) {
14
14
  if (options === void 0) { options = {}; }
15
- (0, animations_util_1.handleCancelAnimation)(contextInstance);
15
+ (0, zoom_pan_pinch_1.handleCancelAnimation)(contextInstance);
16
16
  var wrapperComponent = contextInstance.wrapperComponent;
17
17
  var scale = options.scale, _a = options.animationTime, animationTime = _a === void 0 ? 600 : _a, _b = options.animationType, animationType = _b === void 0 ? 'easeOut' : _b, margin = options.margin;
18
18
  var targets = nodes.map(function (node) {
@@ -20,7 +20,7 @@ var zoomToElements = function (contextInstance) { return function (nodes, option
20
20
  });
21
21
  if (wrapperComponent && targets.length && targets.every(function (target) { return wrapperComponent.contains(target); })) {
22
22
  var targetState = calculateZoomToNodes(contextInstance, targets, { customZoom: scale, margin: margin });
23
- (0, animations_util_1.animate)(contextInstance, targetState, animationTime, animationType);
23
+ (0, zoom_pan_pinch_1.animate)(contextInstance, targetState, animationTime, animationType);
24
24
  }
25
25
  }; };
26
26
  function calculateZoomToNodes(contextInstance, nodes, options) {
@@ -42,13 +42,13 @@ function calculateZoomToNodes(contextInstance, nodes, options) {
42
42
  var focusHeight = nodesHeight / transformState.scale + (top + bottom) * fontSize;
43
43
  var scaleX = wrapperComponent.offsetWidth / focusWidth;
44
44
  var scaleY = wrapperComponent.offsetHeight / focusHeight;
45
- var newScale = (0, zoom_util_1.checkZoomBounds)(customZoom || Math.min(scaleX, scaleY), minScale, maxScale, 0, false);
45
+ var newScale = (0, zoom_pan_pinch_3.checkZoomBounds)(customZoom || Math.min(scaleX, scaleY), minScale, maxScale, 0, false);
46
46
  var offsetX = (wrapperRect.width - focusWidth * newScale) / 2;
47
47
  var offsetY = (wrapperRect.height - focusHeight * newScale) / 2;
48
48
  var newPositionX = (wrapperRect.left - focusLeft) * newScale + offsetX;
49
49
  var newPositionY = (wrapperRect.top - focusTop) * newScale + offsetY;
50
- var bounds = (0, bounds_util_1.calculateBounds)(contextInstance, newScale);
51
- var _h = (0, bounds_util_1.getMouseBoundedPosition)(newPositionX, newPositionY, bounds, limitToBounds, 0, 0, wrapperComponent), x = _h.x, y = _h.y;
50
+ var bounds = (0, zoom_pan_pinch_2.calculateBounds)(contextInstance, newScale);
51
+ var _h = (0, zoom_pan_pinch_2.getMouseBoundedPosition)(newPositionX, newPositionY, bounds, limitToBounds, 0, 0, wrapperComponent), x = _h.x, y = _h.y;
52
52
  return { positionX: x, positionY: y, scale: newScale };
53
53
  }
54
54
  function getOffset(element, wrapper, content, state) {
@@ -1 +1 @@
1
- {"version":3,"file":"useZoomToElements.js","sourceRoot":"","sources":["../../src/hooks/useZoomToElements.ts"],"names":[],"mappings":";;;AAAA,6DAA4G;AAG5G,gEAA6E;AAC7E,wDAAmF;AACnF,oDAAwD;AAKxD,SAAgB,iBAAiB;IAC/B,IAAM,cAAc,GAAG,IAAA,0CAAmB,GAAE,CAAA;IAC5C,OAAO,cAAc,CAAC,cAAc,CAAC,CAAA;AACvC,CAAC;AAHD,8CAGC;AAID,IAAM,cAAc,GAAG,UAAC,eAAyC,IAAK,OAAA,UACpE,KAA+B,EAC/B,OAAmC;IAAnC,wBAAA,EAAA,YAAmC;IAEnC,IAAA,uCAAqB,EAAC,eAAe,CAAC,CAAA;IAE9B,IAAA,gBAAgB,GAAK,eAAe,iBAApB,CAAoB;IACpC,IAAA,KAAK,GAA6D,OAAO,MAApE,EAAE,KAA2D,OAAO,cAA/C,EAAnB,aAAa,mBAAG,GAAG,KAAA,EAAE,KAAsC,OAAO,cAApB,EAAzB,aAAa,mBAAG,SAAS,KAAA,EAAE,MAAM,GAAK,OAAO,OAAZ,CAAY;IAEjF,IAAM,OAAO,GAAkB,KAAK,CAAC,GAAG,CAAC,UAAA,IAAI;QAC3C,OAAA,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAE,CAAC,CAAC,CAAC,IAAI;IAAhE,CAAgE,CACjE,CAAA;IAED,IAAI,gBAAgB,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,KAAK,CAAC,UAAA,MAAM,IAAI,OAAA,gBAAgB,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAjC,CAAiC,CAAC,EAAE;QACpG,IAAM,WAAW,GAAG,o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AEnD,IAAA,KAAW,IAAA,wCAAuB,EACtC,YAAY,EACZ,YAAY,EACZ,MAAM,EACN,aAAa,EACb,CAAC,EACD,CAAC,EACD,gBAAgB,CACjB,EARO,CAAC,OAAA,EAAE,CAAC,OAQX,CAAA;IAED,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAA;AACxD,CAAC;AAED,SAAS,SAAS,CAChB,OAAoB,EACpB,OAAoB,EACpB,OAAoB,EACpB,KAA6B;IAE7B,IAAM,MAAM,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAA;IAC9C,IAAM,aAAa,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAA;IACrD,IAAM,aAAa,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAA;IAErD,IAAM,IAAI,GAAG,aAAa,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAA;IAC1C,IAAM,IAAI,GAAG,aAAa,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAA;IAE1C,OAAO;QACL,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC,KAAK;QACpD,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC,KAAK;KACrD,CAAA;AACH,CAAC"}
package/dist/index.d.ts CHANGED
@@ -2,5 +2,5 @@ export * from './components';
2
2
  export * from './css';
3
3
  export * from './hooks';
4
4
  export * from './locators';
5
- export * from './translation';
5
+ export { setupTranslation } from './utilities';
6
6
  export { GameAI, Animation, AnimationContext, DisplayedAction } from '@gamepark/react-client';
package/dist/index.js CHANGED
@@ -14,9 +14,11 @@ 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
+ exports.setupTranslation = void 0;
17
18
  __exportStar(require("./components"), exports);
18
19
  __exportStar(require("./css"), exports);
19
20
  __exportStar(require("./hooks"), exports);
20
21
  __exportStar(require("./locators"), exports);
21
- __exportStar(require("./translation"), exports);
22
+ var utilities_1 = require("./utilities");
23
+ Object.defineProperty(exports, "setupTranslation", { enumerable: true, get: function () { return utilities_1.setupTranslation; } });
22
24
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA4B;AAC5B,wCAAqB;AACrB,0CAAuB;AACvB,6CAA0B;AAC1B,gDAA6B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+CAA4B;AAC5B,wCAAqB;AACrB,0CAAuB;AACvB,6CAA0B;AAC1B,yCAA8C;AAArC,6GAAA,gBAAgB,OAAA"}
@@ -1,9 +1,10 @@
1
1
  import { Coordinates, MaterialItem } from '@gamepark/rules-api';
2
- import { ItemContext } from './ItemLocator';
3
- import { LineLocator } from './LineLocator';
4
- export declare abstract class DeckLocator<P extends number = number, M extends number = number, L extends number = number> extends LineLocator<P, M, L> {
2
+ import { ListLocator } from './ListLocator';
3
+ import { ItemContext } from './Locator';
4
+ export declare class DeckLocator<P extends number = number, M extends number = number, L extends number = number> extends ListLocator<P, M, L> {
5
+ constructor(clone?: Partial<DeckLocator>);
5
6
  limit: number;
7
+ gap: Partial<Coordinates>;
6
8
  hide(item: MaterialItem<P, L>, context: ItemContext<P, M, L>): boolean;
7
9
  getItemIndex(item: MaterialItem<P, L>, context: ItemContext<P, M, L>): number;
8
- getDelta(_item: MaterialItem<P, L>, context: ItemContext<P, M, L>): Partial<Coordinates>;
9
10
  }
@@ -16,12 +16,14 @@ var __extends = (this && this.__extends) || (function () {
16
16
  })();
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.DeckLocator = void 0;
19
- var LineLocator_1 = require("./LineLocator");
19
+ var ListLocator_1 = require("./ListLocator");
20
20
  var DeckLocator = (function (_super) {
21
21
  __extends(DeckLocator, _super);
22
- function DeckLocator() {
23
- var _this = _super !== null && _super.apply(this, arguments) || this;
22
+ function DeckLocator(clone) {
23
+ var _this = _super.call(this) || this;
24
24
  _this.limit = 20;
25
+ _this.gap = { x: -0.05, y: -0.05 };
26
+ Object.assign(_this, clone);
25
27
  return _this;
26
28
  }
27
29
  DeckLocator.prototype.hide = function (item, context) {
@@ -40,11 +42,7 @@ var DeckLocator = (function (_super) {
40
42
  return index;
41
43
  return Math.max(0, index - count + this.limit);
42
44
  };
43
- DeckLocator.prototype.getDelta = function (_item, context) {
44
- var _a, _b, _c;
45
- return (_a = this.delta) !== null && _a !== void 0 ? _a : { z: (_c = (_b = context.material[context.type]) === null || _b === void 0 ? void 0 : _b.thickness) !== null && _c !== void 0 ? _c : 0.05 };
46
- };
47
45
  return DeckLocator;
48
- }(LineLocator_1.LineLocator));
46
+ }(ListLocator_1.ListLocator));
49
47
  exports.DeckLocator = DeckLocator;
50
48
  //# sourceMappingURL=DeckLocator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DeckLocator.js","sourceRoot":"","sources":["../../src/locators/DeckLocator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAEA,6CAA2C;AAE3C;IAA2H,+BAAoB;IAA/I;QAAA,qEAqBC;QApBC,WAAK,GAAG,EAAE,CAAA;;IAoBZ,CAAC;IAlBC,0BAAI,GAAJ,UAAK,IAAwB,EAAE,OAA6B;QAC1D,IAAI,CAAC,IAAI,CAAC,KAAK;YAAE,OAAO,KAAK,CAAA;QAC7B,IAAM,KAAK,GAAG,iBAAM,YAAY,YAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QAC/C,IAAM,KAAK,GAAG,IA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CAAC,CAAA;;IAC5B,CAAC;IAKD,0BAAI,GAAJ,UAAK,IAAwB,EAAE,OAA6B;QAC1D,IAAI,CAAC,IAAI,CAAC,KAAK;YAAE,OAAO,KAAK,CAAA;QAC7B,IAAM,KAAK,GAAG,iBAAM,YAAY,YAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QAC/C,IAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;QACrD,OAAO,KAAK,GAAG,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;IACnC,CAAC;IAED,kCAAY,GAAZ,UAAa,IAAwB,EAAE,OAA6B;QAClE,IAAM,KAAK,GAAG,iBAAM,YAAY,YAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QAC/C,IAAI,CAAC,IAAI,CAAC,KAAK;YAAE,OAAO,KAAK,CAAA;QAC7B,IAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;QACrD,IAAI,KAAK,IAAI,IAAI,CAAC,KAAK;YAAE,OAAO,KAAK,CAAA;QACrC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAA;IAChD,CAAC;IACH,kBAAC;AAAD,CAAC,AAxBD,CAAkH,yBAAW,GAwB5H;AAxBY,kCAAW"}
@@ -0,0 +1,18 @@
1
+ import { Coordinates, Location, XYCoordinates } from '@gamepark/rules-api';
2
+ import { ListLocator } from './ListLocator';
3
+ import { MaterialContext } from './Locator';
4
+ export declare class FlexLocator<P extends number = number, M extends number = number, L extends number = number> extends ListLocator<P, M, L> {
5
+ constructor(clone?: Partial<FlexLocator>);
6
+ lineSize: number;
7
+ getLineSize(_location: Location<P, L>, _context: MaterialContext<P, M, L>): number;
8
+ getMaxCount(location: Location<P, L>, context: MaterialContext<P, M, L>): number | undefined;
9
+ lineGap?: Partial<Coordinates>;
10
+ getLineGap(_location: Location<P, L>, _context: MaterialContext<P, M, L>): Partial<Coordinates>;
11
+ maxLines?: number;
12
+ getMaxLines(_location: Location<P, L>, _context: MaterialContext<P, M, L>): number | undefined;
13
+ maxLineGap?: Partial<Coordinates>;
14
+ getMaxLineGap(location: Location<P, L>, context: MaterialContext<P, M, L>): Partial<Coordinates>;
15
+ countListItems(location: Location<P, L>, context: MaterialContext<P, M, L>): number;
16
+ protected getCurrentMaxGap(location: Location<P, L>, context: MaterialContext<P, M, L>): XYCoordinates;
17
+ getLocationCoordinates(location: Location<P, L>, context: MaterialContext<P, M, L>, index?: number | undefined): Partial<Coordinates>;
18
+ }
@@ -0,0 +1,88 @@
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
+ })();
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.FlexLocator = void 0;
19
+ var ListLocator_1 = require("./ListLocator");
20
+ var FlexLocator = (function (_super) {
21
+ __extends(FlexLocator, _super);
22
+ function FlexLocator(clone) {
23
+ var _this = _super.call(this) || this;
24
+ _this.lineSize = 2;
25
+ Object.assign(_this, clone);
26
+ return _this;
27
+ }
28
+ FlexLocator.prototype.getLineSize = function (_location, _context) {
29
+ return this.lineSize;
30
+ };
31
+ FlexLocator.prototype.getMaxCount = function (location, context) {
32
+ return this.getLineSize(location, context);
33
+ };
34
+ FlexLocator.prototype.getLineGap = function (_location, _context) {
35
+ var _a;
36
+ return (_a = this.lineGap) !== null && _a !== void 0 ? _a : {};
37
+ };
38
+ FlexLocator.prototype.getMaxLines = function (_location, _context) {
39
+ return this.maxLines;
40
+ };
41
+ FlexLocator.prototype.getMaxLineGap = function (location, context) {
42
+ if (this.maxLineGap)
43
+ return this.maxLineGap;
44
+ var maxLines = this.getMaxLines(location, context);
45
+ if (maxLines === undefined)
46
+ return {};
47
+ var _a = this.getLineGap(location, context), x = _a.x, y = _a.y, z = _a.z;
48
+ return {
49
+ x: x ? x * (maxLines - 1) : x,
50
+ y: y ? y * (maxLines - 1) : y,
51
+ z: z ? z * (maxLines - 1) : z
52
+ };
53
+ };
54
+ FlexLocator.prototype.countListItems = function (location, context) {
55
+ return Math.min(_super.prototype.countListItems.call(this, location, context), this.getLineSize(location, context));
56
+ };
57
+ FlexLocator.prototype.getCurrentMaxGap = function (location, context) {
58
+ var _a;
59
+ var _b = _super.prototype.getCurrentMaxGap.call(this, location, context), x = _b.x, y = _b.y;
60
+ var _c = this.getLineGap(location, context), _d = _c.x, gx = _d === void 0 ? 0 : _d, _e = _c.y, gy = _e === void 0 ? 0 : _e;
61
+ var _f = this.getMaxLineGap(location, context), mgx = _f.x, mgy = _f.y;
62
+ var count = Math.min((_a = this.limit) !== null && _a !== void 0 ? _a : Infinity, _super.prototype.countItems.call(this, location, context));
63
+ var lineSize = this.getLineSize(location, context);
64
+ var lines = Math.floor(count / lineSize);
65
+ return { x: x + (mgx !== null && mgx !== void 0 ? mgx : gx * lines), y: y + (mgy !== null && mgy !== void 0 ? mgy : gy * lines) };
66
+ };
67
+ FlexLocator.prototype.getLocationCoordinates = function (location, context, index) {
68
+ if (index === void 0) { index = this.getLocationIndex(location, context); }
69
+ if (index === undefined)
70
+ return this.getAreaCoordinates(location, context);
71
+ var lineSize = this.getLineSize(location, context);
72
+ var itemIndex = index % lineSize;
73
+ var lineIndex = Math.floor(index / lineSize);
74
+ var count = this.countItems(location, context);
75
+ var lines = Math.floor(count / lineSize);
76
+ var _a = _super.prototype.getLocationCoordinates.call(this, location, context, itemIndex), _b = _a.x, x = _b === void 0 ? 0 : _b, _c = _a.y, y = _c === void 0 ? 0 : _c, _d = _a.z, z = _d === void 0 ? 0 : _d;
77
+ var _e = this.getLineGap(location, context), _f = _e.x, gx = _f === void 0 ? 0 : _f, _g = _e.y, gy = _g === void 0 ? 0 : _g, _h = _e.z, gz = _h === void 0 ? 0.05 * lineSize : _h;
78
+ var _j = this.getMaxLineGap(location, context), mgx = _j.x, mgy = _j.y, mgz = _j.z;
79
+ return {
80
+ x: x + lineIndex * (mgx && lines > 1 ? mgx * Math.min(gx / mgx, 1 / (lines - 1)) : gx),
81
+ y: y + lineIndex * (mgy && lines > 1 ? mgy * Math.min(gy / mgy, 1 / (lines - 1)) : gy),
82
+ z: z + lineIndex * (mgz && lines > 1 ? mgz * Math.min(gz / mgz, 1 / (lines - 1)) : gz)
83
+ };
84
+ };
85
+ return FlexLocator;
86
+ }(ListLocator_1.ListLocator));
87
+ exports.FlexLocator = FlexLocator;
88
+ //# sourceMappingURL=FlexLocator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FlexLocator.js","sourceRoot":"","sources":["../../src/locators/FlexLocator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,6CAA2C;AAM3C;IAAkH,+BAAoB;IAEpI,qBAAY,KAA4B;QAAxC,YACE,iBAAO,SAER;QAKD,cAAQ,GAAW,CAAC,CAAA;QANlB,MAAM,CAAC,MAAM,CAAC,KAAI,EAAE,KAAK,CAAC,CAAA;;IAC5B,CAAC;IAaD,iCAAW,GAAX,UAAY,SAAyB,EAAE,QAAkC;QACvE,OAAO,IAAI,CAAC,QAAQ,CAAA;IACtB,CAAC;IAED,iCAAW,GAAX,UAAY,QAAwB,EAAE,OAAiC;QACrE,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IAC5C,CAAC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,EAAE,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACtF,CAAC,EAAE,CAAC,GAAG,SAAS,GAAG,CAAC,GAAG,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SACvF,CAAA;IACH,CAAC;IACH,kBAAC;AAAD,CAAC,AA9GD,CAAkH,yBAAW,GA8G5H;AA9GY,kCAAW"}
@@ -1,15 +1,24 @@
1
1
  import { Coordinates, Location, MaterialItem } from '@gamepark/rules-api';
2
- import { ItemContext, ItemLocator } from './ItemLocator';
3
- export declare abstract class HandLocator<P extends number = number, M extends number = number, L extends number = number> extends ItemLocator<P, M, L> {
4
- getPosition(item: MaterialItem<P, L>, context: ItemContext<P, M, L>): Coordinates;
5
- getRotateZ(item: MaterialItem<P, L>, context: ItemContext<P, M, L>): number;
6
- getItemAngle(item: MaterialItem<P, L>, context: ItemContext<P, M, L>): number;
7
- abstract getCoordinates(location: Location<P, L>, context: ItemContext<P, M, L>): Coordinates;
8
- getItemIndex(item: MaterialItem<P, L>, _context: ItemContext<P, M, L>): number;
9
- getRadius(_item: MaterialItem<P, L>, _context: ItemContext<P, M, L>): number;
10
- getBaseAngle(_item: MaterialItem<P, L>, _context: ItemContext<P, M, L>): number;
11
- getMaxAngle(_item: MaterialItem<P, L>, _context: ItemContext<P, M, L>): number;
12
- getGapMaxAngle(_item: MaterialItem<P, L>, _context: ItemContext<P, M, L>): number;
13
- isClockwise(_item: MaterialItem<P, L>, _context: ItemContext<P, M, L>): boolean;
14
- getDeltaZ(_item: MaterialItem<P, L>, _context: ItemContext<P, M, L>): number;
2
+ import { LocationDescription } from '../components';
3
+ import { ItemContext, Locator, MaterialContext } from './Locator';
4
+ export declare class HandLocator<P extends number = number, M extends number = number, L extends number = number> extends Locator<P, M, L> {
5
+ constructor(clone?: Partial<HandLocator>);
6
+ radius: number;
7
+ getRadius(_location: Location<P, L>, _context: MaterialContext<P, M, L>): number;
8
+ baseAngle: number;
9
+ getBaseAngle(_location: Location<P, L>, _context: MaterialContext<P, M, L>): number;
10
+ maxAngle: number;
11
+ getMaxAngle(_location: Location<P, L>, _context: MaterialContext<P, M, L>): number;
12
+ gapMaxAngle: number;
13
+ getGapMaxAngle(_location: Location<P, L>, _context: MaterialContext<P, M, L>): number;
14
+ clockwise: boolean;
15
+ isClockwise(_location: Location<P, L>, _context: MaterialContext<P, M, L>): boolean;
16
+ deltaZ: number;
17
+ getDeltaZ(_location: Location<P, L>, _context: MaterialContext<P, M, L>): number;
18
+ getLocationCoordinates(location: Location<P, L>, context: MaterialContext<P, M, L>, index?: number | undefined): Coordinates;
19
+ getItemCoordinates(item: MaterialItem<P, L>, context: ItemContext<P, M, L>): Coordinates;
20
+ getRotateZ(location: Location<P, L>, context: MaterialContext<P, M, L>, index?: number | undefined): number;
21
+ getItemRotateZ(item: MaterialItem<P, L>, context: ItemContext<P, M, L>): number;
22
+ protected generateLocationDescriptionFromDraggedItem(_location: Location<P, L>, context: ItemContext<P, M, L>): LocationDescription<P, M, L>;
23
+ getHoverTransform(item: MaterialItem<P, L>, context: ItemContext<P, M, L>): string[];
15
24
  }