@gamepark/react-game 6.0.0-alpha.0 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Avatar/Avatar.js +7 -5
- package/dist/components/Avatar/Avatar.js.map +1 -1
- package/dist/components/GameProvider/GameContext.d.ts +1 -0
- package/dist/components/GameProvider/GameContext.js.map +1 -1
- package/dist/components/GameProvider/GameProvider.d.ts +1 -1
- package/dist/components/GameProvider/GameProvider.js +13 -4
- package/dist/components/GameProvider/GameProvider.js.map +1 -1
- package/dist/components/ImagesLoader/ImagesLoader.d.ts +2 -3
- package/dist/components/ImagesLoader/ImagesLoader.js.map +1 -1
- package/dist/components/buttons/PlayMoveButton/PlayMoveButton.js +25 -10
- package/dist/components/buttons/PlayMoveButton/PlayMoveButton.js.map +1 -1
- package/dist/components/dialogs/ResultDialog/ResultDialog.js +22 -17
- package/dist/components/dialogs/ResultDialog/ResultDialog.js.map +1 -1
- package/dist/components/dialogs/RulesDialog/LocationRulesDialogContent.d.ts +4 -9
- package/dist/components/dialogs/RulesDialog/LocationRulesDialogContent.js +7 -7
- package/dist/components/dialogs/RulesDialog/LocationRulesDialogContent.js.map +1 -1
- package/dist/components/dialogs/RulesDialog/MaterialRulesDialog.js +5 -17
- package/dist/components/dialogs/RulesDialog/MaterialRulesDialog.js.map +1 -1
- package/dist/components/dialogs/RulesDialog/MaterialRulesDialogContent.d.ts +3 -6
- package/dist/components/dialogs/RulesDialog/MaterialRulesDialogContent.js +8 -8
- package/dist/components/dialogs/RulesDialog/MaterialRulesDialogContent.js.map +1 -1
- package/dist/components/dialogs/RulesDialog/RulesDialog.d.ts +1 -0
- package/dist/components/dialogs/RulesDialog/RulesDialog.js +3 -3
- package/dist/components/dialogs/RulesDialog/RulesDialog.js.map +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +2 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/material/DraggableMaterial.d.ts +14 -11
- package/dist/components/material/DraggableMaterial.js +102 -48
- package/dist/components/material/DraggableMaterial.js.map +1 -1
- package/dist/components/material/FlatMaterial/BoardDescription.d.ts +3 -0
- package/dist/components/material/FlatMaterial/BoardDescription.js +28 -0
- package/dist/components/material/FlatMaterial/BoardDescription.js.map +1 -0
- package/dist/components/material/FlatMaterial/CardDescription.d.ts +6 -0
- package/dist/components/material/FlatMaterial/CardDescription.js +32 -0
- package/dist/components/material/FlatMaterial/CardDescription.js.map +1 -0
- package/dist/components/material/FlatMaterial/FlatMaterial.d.ts +35 -0
- package/dist/components/material/FlatMaterial/FlatMaterial.js +128 -0
- package/dist/components/material/FlatMaterial/FlatMaterial.js.map +1 -0
- package/dist/components/material/FlatMaterial/TokenDescription.d.ts +10 -0
- package/dist/components/material/FlatMaterial/TokenDescription.js +44 -0
- package/dist/components/material/FlatMaterial/TokenDescription.js.map +1 -0
- package/dist/components/material/FlatMaterial/index.d.ts +4 -0
- package/dist/components/material/{Card → FlatMaterial}/index.js +4 -1
- package/dist/components/material/FlatMaterial/index.js.map +1 -0
- package/dist/components/material/GameTable/GameMaterialDisplay.js +64 -45
- package/dist/components/material/GameTable/GameMaterialDisplay.js.map +1 -1
- package/dist/components/material/GameTable/GameTable.d.ts +2 -2
- package/dist/components/material/GameTable/GameTable.js +64 -16
- package/dist/components/material/GameTable/GameTable.js.map +1 -1
- package/dist/components/material/GameTable/GameTableContent.js +22 -7
- package/dist/components/material/GameTable/GameTableContent.js.map +1 -1
- package/dist/components/material/ImageLoader/MaterialImageLoader.d.ts +5 -0
- package/dist/components/material/ImageLoader/MaterialImageLoader.js +33 -0
- package/dist/components/material/ImageLoader/MaterialImageLoader.js.map +1 -0
- package/dist/components/material/ImageLoader/index.d.ts +1 -0
- package/dist/components/material/{Token → ImageLoader}/index.js +1 -1
- package/dist/components/material/ImageLoader/index.js.map +1 -0
- package/dist/components/material/MaterialAnimations.d.ts +11 -14
- package/dist/components/material/MaterialAnimations.js +129 -82
- package/dist/components/material/MaterialAnimations.js.map +1 -1
- package/dist/components/material/MaterialComponent.d.ts +5 -10
- package/dist/components/material/MaterialComponent.js +8 -53
- package/dist/components/material/MaterialComponent.js.map +1 -1
- package/dist/components/material/MaterialDescription.d.ts +31 -18
- package/dist/components/material/MaterialDescription.js +36 -0
- package/dist/components/material/MaterialDescription.js.map +1 -1
- package/dist/components/material/animations/CreateItemAnimations.d.ts +14 -0
- package/dist/components/material/animations/CreateItemAnimations.js +72 -0
- package/dist/components/material/animations/CreateItemAnimations.js.map +1 -0
- package/dist/components/material/animations/DeleteItemAnimations.d.ts +14 -0
- package/dist/components/material/animations/DeleteItemAnimations.js +80 -0
- package/dist/components/material/animations/DeleteItemAnimations.js.map +1 -0
- package/dist/components/material/animations/ItemAnimations.d.ts +7 -0
- package/dist/components/material/animations/ItemAnimations.js +31 -0
- package/dist/components/material/animations/ItemAnimations.js.map +1 -0
- package/dist/components/material/animations/MaterialAnimations.d.ts +19 -0
- package/dist/components/material/animations/MaterialAnimations.js +51 -0
- package/dist/components/material/animations/MaterialAnimations.js.map +1 -0
- package/dist/components/material/animations/MaterialGameAnimations.d.ts +11 -0
- package/dist/components/material/animations/MaterialGameAnimations.js +42 -0
- package/dist/components/material/animations/MaterialGameAnimations.js.map +1 -0
- package/dist/components/material/animations/MoveItemAnimations.d.ts +16 -0
- package/dist/components/material/animations/MoveItemAnimations.js +105 -0
- package/dist/components/material/animations/MoveItemAnimations.js.map +1 -0
- package/dist/components/material/animations/ShuffleAnimations.d.ts +8 -0
- package/dist/components/material/animations/ShuffleAnimations.js +34 -0
- package/dist/components/material/animations/ShuffleAnimations.js.map +1 -0
- package/dist/components/material/animations/adjustRotation.d.ts +1 -0
- package/dist/components/material/animations/adjustRotation.js +37 -0
- package/dist/components/material/animations/adjustRotation.js.map +1 -0
- package/dist/components/material/animations/getFirstStockItemTransforms.util.d.ts +2 -0
- package/dist/components/material/animations/getFirstStockItemTransforms.util.js +32 -0
- package/dist/components/material/animations/getFirstStockItemTransforms.util.js.map +1 -0
- package/dist/components/material/animations/index.d.ts +9 -0
- package/dist/components/material/animations/index.js +29 -0
- package/dist/components/material/animations/index.js.map +1 -0
- package/dist/components/material/animations/isMovedOrDeletedItem.util.d.ts +3 -0
- package/dist/components/material/animations/isMovedOrDeletedItem.util.js +28 -0
- package/dist/components/material/animations/isMovedOrDeletedItem.util.js.map +1 -0
- package/dist/components/material/animations/itemMovementCss.util.d.ts +2 -0
- package/dist/components/material/animations/itemMovementCss.util.js +13 -0
- package/dist/components/material/animations/itemMovementCss.util.js.map +1 -0
- package/dist/components/material/animations/transformItem.util.d.ts +2 -0
- package/dist/components/material/animations/transformItem.util.js +11 -0
- package/dist/components/material/animations/transformItem.util.js.map +1 -0
- package/dist/components/material/index.d.ts +4 -7
- package/dist/components/material/index.js +4 -7
- package/dist/components/material/index.js.map +1 -1
- package/dist/components/material/locations/LocationDescription.d.ts +28 -0
- package/dist/components/material/locations/LocationDescription.js +54 -0
- package/dist/components/material/locations/LocationDescription.js.map +1 -0
- package/dist/components/material/locations/LocationsMask.d.ts +5 -0
- package/dist/components/material/locations/LocationsMask.js +48 -0
- package/dist/components/material/locations/LocationsMask.js.map +1 -0
- package/dist/components/material/locations/SimpleDropArea.d.ts +13 -0
- package/dist/components/material/{DropAreas → locations}/SimpleDropArea.js +44 -30
- package/dist/components/material/locations/SimpleDropArea.js.map +1 -0
- package/dist/components/material/locations/index.d.ts +3 -0
- package/dist/components/material/{Board → locations}/index.js +3 -1
- package/dist/components/material/locations/index.js.map +1 -0
- package/dist/components/material/utils/getItemFromContext.d.ts +3 -0
- package/dist/components/material/utils/getItemFromContext.js +10 -0
- package/dist/components/material/utils/getItemFromContext.js.map +1 -0
- package/dist/components/material/utils/index.d.ts +0 -3
- package/dist/components/material/utils/index.js +0 -3
- package/dist/components/material/utils/index.js.map +1 -1
- package/dist/components/material/utils/isDroppedItem.d.ts +2 -0
- package/dist/components/material/utils/isDroppedItem.js +15 -0
- package/dist/components/material/utils/isDroppedItem.js.map +1 -0
- package/dist/components/material/utils/isPlacedOnItem.d.ts +3 -0
- package/dist/components/material/utils/isPlacedOnItem.js +15 -0
- package/dist/components/material/utils/isPlacedOnItem.js.map +1 -0
- package/dist/components/material/utils/useIsAnimatingPlayerAction.d.ts +1 -0
- package/dist/components/material/utils/useIsAnimatingPlayerAction.js +10 -0
- package/dist/components/material/utils/useIsAnimatingPlayerAction.js.map +1 -0
- package/dist/components/menus/Menu/Menu.js +3 -3
- package/dist/components/menus/Menu/Menu.js.map +1 -1
- package/dist/components/menus/Result/ResultPopButton.js +1 -1
- package/dist/components/menus/Result/ResultPopButton.js.map +1 -1
- package/dist/components/tutorial/MaterialTutorial.d.ts +47 -0
- package/dist/components/tutorial/MaterialTutorial.js +95 -0
- package/dist/components/tutorial/MaterialTutorial.js.map +1 -0
- package/dist/components/tutorial/MaterialTutorialDisplay.d.ts +1 -0
- package/dist/components/tutorial/MaterialTutorialDisplay.js +73 -0
- package/dist/components/tutorial/MaterialTutorialDisplay.js.map +1 -0
- package/dist/components/tutorial/TutorialRulesWrapper.d.ts +3 -0
- package/dist/components/tutorial/TutorialRulesWrapper.js +60 -0
- package/dist/components/tutorial/TutorialRulesWrapper.js.map +1 -0
- package/dist/components/tutorial/index.d.ts +1 -0
- package/dist/components/{material/DropAreas → tutorial}/index.js +1 -1
- package/dist/components/tutorial/index.js.map +1 -0
- package/dist/css/componentSizeCss.d.ts +1 -5
- package/dist/css/componentSizeCss.js +1 -1
- package/dist/css/componentSizeCss.js.map +1 -1
- package/dist/css/fadeIn.d.ts +1 -0
- package/dist/css/fadeIn.js +13 -0
- package/dist/css/fadeIn.js.map +1 -0
- package/dist/css/index.d.ts +2 -0
- package/dist/css/index.js +2 -0
- package/dist/css/index.js.map +1 -1
- package/dist/css/shadowEffect.d.ts +1 -0
- package/dist/css/shadowEffect.js +11 -0
- package/dist/css/shadowEffect.js.map +1 -0
- package/dist/css/transformCss.d.ts +1 -0
- package/dist/css/transformCss.js +3 -2
- package/dist/css/transformCss.js.map +1 -1
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.js +3 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/useItemLocator.js +2 -3
- package/dist/hooks/useItemLocator.js.map +1 -1
- package/dist/hooks/useLegalMoves.js +11 -6
- package/dist/hooks/useLegalMoves.js.map +1 -1
- package/dist/hooks/useLocators.d.ts +1 -0
- package/dist/hooks/useLocators.js +8 -0
- package/dist/hooks/useLocators.js.map +1 -0
- package/dist/hooks/useMaterialContext.d.ts +2 -0
- package/dist/hooks/useMaterialContext.js +18 -0
- package/dist/hooks/useMaterialContext.js.map +1 -0
- package/dist/hooks/useMaterials.d.ts +2 -0
- package/dist/hooks/useMaterials.js +10 -0
- package/dist/hooks/useMaterials.js.map +1 -0
- package/dist/hooks/usePlayerName.js +12 -1
- package/dist/hooks/usePlayerName.js.map +1 -1
- package/dist/hooks/usePlayers.js +1 -1
- package/dist/hooks/usePlayers.js.map +1 -1
- package/dist/hooks/useRulesStep.d.ts +2 -0
- package/dist/hooks/useRulesStep.js +10 -0
- package/dist/hooks/useRulesStep.js.map +1 -0
- package/dist/hooks/useTutorialStep.d.ts +2 -0
- package/dist/hooks/useTutorialStep.js +15 -0
- package/dist/hooks/useTutorialStep.js.map +1 -0
- package/dist/hooks/useZoomToElements.d.ts +5 -0
- package/dist/hooks/useZoomToElements.js +65 -0
- package/dist/hooks/useZoomToElements.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/locators/DeckLocator.d.ts +4 -4
- package/dist/locators/DeckLocator.js +3 -2
- package/dist/locators/DeckLocator.js.map +1 -1
- package/dist/locators/HandLocator.d.ts +11 -11
- package/dist/locators/HandLocator.js.map +1 -1
- package/dist/locators/ItemLocator.d.ts +31 -41
- package/dist/locators/ItemLocator.js +33 -90
- package/dist/locators/ItemLocator.js.map +1 -1
- package/dist/locators/LineLocator.d.ts +7 -5
- package/dist/locators/LineLocator.js +10 -1
- package/dist/locators/LineLocator.js.map +1 -1
- package/dist/locators/PileLocator.d.ts +8 -6
- package/dist/locators/PileLocator.js +13 -1
- package/dist/locators/PileLocator.js.map +1 -1
- package/dist/utilities/animations.constants.d.ts +16 -0
- package/dist/utilities/animations.constants.js +82 -0
- package/dist/utilities/animations.constants.js.map +1 -0
- package/dist/utilities/animations.util.d.ts +4 -0
- package/dist/utilities/animations.util.js +78 -0
- package/dist/utilities/animations.util.js.map +1 -0
- package/dist/utilities/bounds.util.d.ts +18 -0
- package/dist/utilities/bounds.util.js +85 -0
- package/dist/utilities/bounds.util.js.map +1 -0
- package/dist/utilities/calculation.util.d.ts +14 -0
- package/dist/utilities/calculation.util.js +24 -0
- package/dist/utilities/calculation.util.js.map +1 -0
- package/dist/utilities/zoom.util.d.ts +4 -0
- package/dist/utilities/zoom.util.js +17 -0
- package/dist/utilities/zoom.util.js.map +1 -0
- package/package.json +7 -5
- package/dist/components/material/Board/Board.d.ts +0 -17
- package/dist/components/material/Board/Board.js +0 -34
- package/dist/components/material/Board/Board.js.map +0 -1
- package/dist/components/material/Board/index.d.ts +0 -1
- package/dist/components/material/Board/index.js.map +0 -1
- package/dist/components/material/Card/Card.d.ts +0 -23
- package/dist/components/material/Card/Card.js +0 -49
- package/dist/components/material/Card/Card.js.map +0 -1
- package/dist/components/material/Card/index.d.ts +0 -1
- package/dist/components/material/Card/index.js.map +0 -1
- package/dist/components/material/DropAreas/SimpleDropArea.d.ts +0 -12
- package/dist/components/material/DropAreas/SimpleDropArea.js.map +0 -1
- package/dist/components/material/DropAreas/index.d.ts +0 -1
- package/dist/components/material/DropAreas/index.js.map +0 -1
- package/dist/components/material/Items.d.ts +0 -4
- package/dist/components/material/Items.js +0 -3
- package/dist/components/material/Items.js.map +0 -1
- package/dist/components/material/Token/Token.d.ts +0 -18
- package/dist/components/material/Token/Token.js +0 -34
- package/dist/components/material/Token/Token.js.map +0 -1
- package/dist/components/material/Token/index.d.ts +0 -1
- package/dist/components/material/Token/index.js.map +0 -1
- package/dist/components/material/utils/IsMoveThisItem.d.ts +0 -2
- package/dist/components/material/utils/IsMoveThisItem.js +0 -12
- package/dist/components/material/utils/IsMoveThisItem.js.map +0 -1
- package/dist/components/material/utils/IsMoveThisItemToLocation.d.ts +0 -3
- package/dist/components/material/utils/IsMoveThisItemToLocation.js +0 -11
- package/dist/components/material/utils/IsMoveThisItemToLocation.js.map +0 -1
- package/dist/components/material/utils/IsMoveToLocation.d.ts +0 -2
- package/dist/components/material/utils/IsMoveToLocation.js +0 -13
- package/dist/components/material/utils/IsMoveToLocation.js.map +0 -1
- package/dist/components/material/utils/IsMoveToStock.d.ts +0 -4
- package/dist/components/material/utils/IsMoveToStock.js +0 -18
- package/dist/components/material/utils/IsMoveToStock.js.map +0 -1
- package/dist/hooks/useStocks.d.ts +0 -2
- package/dist/hooks/useStocks.js +0 -12
- package/dist/hooks/useStocks.js.map +0 -1
|
@@ -29,22 +29,15 @@ var __assign = (this && this.__assign) || function () {
|
|
|
29
29
|
};
|
|
30
30
|
return __assign.apply(this, arguments);
|
|
31
31
|
};
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
35
|
-
t[p] = s[p];
|
|
36
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
37
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
38
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
39
|
-
t[p[i]] = s[p[i]];
|
|
40
|
-
}
|
|
41
|
-
return t;
|
|
32
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
33
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
42
34
|
};
|
|
43
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
36
|
exports.MaterialAnimations = void 0;
|
|
45
37
|
var react_client_1 = require("@gamepark/react-client");
|
|
46
38
|
var rules_api_1 = require("@gamepark/rules-api");
|
|
47
39
|
var react_1 = require("@emotion/react");
|
|
40
|
+
var fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
|
|
48
41
|
var MaterialAnimations = /** @class */ (function (_super) {
|
|
49
42
|
__extends(MaterialAnimations, _super);
|
|
50
43
|
function MaterialAnimations() {
|
|
@@ -74,99 +67,153 @@ var MaterialAnimations = /** @class */ (function (_super) {
|
|
|
74
67
|
MaterialAnimations.prototype.moveDuration = function (_move, _context) {
|
|
75
68
|
return 1;
|
|
76
69
|
};
|
|
77
|
-
MaterialAnimations.prototype.
|
|
70
|
+
MaterialAnimations.prototype.isItemToAnimate = function (_a, animation) {
|
|
71
|
+
var _b, _c, _d, _e, _f;
|
|
72
|
+
var game = _a.game, type = _a.type, index = _a.index, displayIndex = _a.displayIndex, locators = _a.locators;
|
|
73
|
+
var item = game.items[type][index];
|
|
74
|
+
if ((0, rules_api_1.isMoveItem)(animation.move, type, index) || (0, rules_api_1.isDeleteItem)(animation.move, type, index)) {
|
|
75
|
+
var quantity = (_b = item.quantity) !== null && _b !== void 0 ? _b : 1;
|
|
76
|
+
if (quantity === 1)
|
|
77
|
+
return true;
|
|
78
|
+
var itemLocator = locators[item.location.type];
|
|
79
|
+
if (itemLocator.limit)
|
|
80
|
+
quantity = Math.min(quantity, itemLocator.limit);
|
|
81
|
+
var movedQuantity = (_c = animation.move.quantity) !== null && _c !== void 0 ? _c : 1;
|
|
82
|
+
if (((_d = game.droppedItem) === null || _d === void 0 ? void 0 : _d.type) === type && game.droppedItem.index === index) {
|
|
83
|
+
var droppedIndex = game.droppedItem.displayIndex;
|
|
84
|
+
if (displayIndex === droppedIndex)
|
|
85
|
+
return true;
|
|
86
|
+
if (droppedIndex < quantity - movedQuantity) {
|
|
87
|
+
return displayIndex > quantity - movedQuantity;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return displayIndex >= quantity - movedQuantity;
|
|
91
|
+
}
|
|
92
|
+
else if ((0, rules_api_1.isCreateItem)(animation.move, type) && (0, rules_api_1.itemsCanMerge)(item, animation.move.item)) {
|
|
93
|
+
var quantity = (_e = item.quantity) !== null && _e !== void 0 ? _e : 1;
|
|
94
|
+
var createdQuantity = (_f = animation.move.item.quantity) !== null && _f !== void 0 ? _f : 1;
|
|
95
|
+
return displayIndex >= quantity - createdQuantity;
|
|
96
|
+
}
|
|
97
|
+
return false;
|
|
98
|
+
};
|
|
99
|
+
MaterialAnimations.prototype.getItemAnimation = function (context, animation) {
|
|
100
|
+
if (!this.isItemToAnimate(context, animation))
|
|
101
|
+
return;
|
|
102
|
+
if (animation.move.kind !== rules_api_1.MoveKind.ItemMove)
|
|
103
|
+
return;
|
|
78
104
|
switch (animation.move.type) {
|
|
79
105
|
case rules_api_1.ItemMoveType.Create:
|
|
80
|
-
return this.getCreateItemAnimation(
|
|
106
|
+
return this.getCreateItemAnimation(context, animation);
|
|
81
107
|
case rules_api_1.ItemMoveType.Move:
|
|
82
|
-
return this.getMoveItemAnimation(
|
|
108
|
+
return this.getMoveItemAnimation(context, animation);
|
|
83
109
|
case rules_api_1.ItemMoveType.Delete:
|
|
84
|
-
return this.getDeleteItemAnimation(
|
|
110
|
+
return this.getDeleteItemAnimation(context, animation);
|
|
85
111
|
}
|
|
86
112
|
};
|
|
87
|
-
MaterialAnimations.prototype.getCreateItemAnimation = function (
|
|
88
|
-
var
|
|
89
|
-
if (
|
|
90
|
-
var
|
|
91
|
-
var animationKeyframes = this.getKeyframesFromOrigin(
|
|
92
|
-
return (
|
|
113
|
+
MaterialAnimations.prototype.getCreateItemAnimation = function (context, animation) {
|
|
114
|
+
var stockTransforms = this.getFirstStockItemTransforms(context);
|
|
115
|
+
if (stockTransforms) {
|
|
116
|
+
var targetTransform = adjustRotation(stockTransforms, transformItem(context)).join(' ');
|
|
117
|
+
var animationKeyframes = this.getKeyframesFromOrigin(targetTransform, animation, context);
|
|
118
|
+
return movementAnimationCss(animationKeyframes, animation.duration);
|
|
93
119
|
}
|
|
94
120
|
else {
|
|
95
121
|
return this.fadein(animation.duration);
|
|
96
122
|
}
|
|
97
123
|
};
|
|
98
124
|
MaterialAnimations.prototype.fadein = function (duration) {
|
|
99
|
-
var fadein = (0, react_1.keyframes)(
|
|
100
|
-
return (0, react_1.css)(
|
|
101
|
-
};
|
|
102
|
-
MaterialAnimations.prototype.
|
|
103
|
-
var
|
|
104
|
-
var
|
|
105
|
-
var
|
|
106
|
-
var
|
|
107
|
-
if (!
|
|
108
|
-
return;
|
|
109
|
-
var stockItem =
|
|
110
|
-
var
|
|
111
|
-
var stockLocator =
|
|
112
|
-
return stockLocator.transformItem(stockItem !== null && stockItem !== void 0 ? stockItem :
|
|
113
|
-
};
|
|
114
|
-
MaterialAnimations.prototype.getKeyframesFromOrigin = function (origin,
|
|
115
|
-
return (0, react_1.keyframes)(
|
|
116
|
-
};
|
|
117
|
-
MaterialAnimations.prototype.getMoveItemAnimation = function (
|
|
118
|
-
var _a, _b
|
|
119
|
-
var
|
|
120
|
-
var
|
|
121
|
-
var
|
|
122
|
-
var mutator =
|
|
125
|
+
var fadein = (0, react_1.keyframes)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n from {\n opacity: 0;\n }\n "], ["\n from {\n opacity: 0;\n }\n "])));
|
|
126
|
+
return (0, react_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["animation: ", " ", "s ease-in-out forwards"], ["animation: ", " ", "s ease-in-out forwards"])), fadein, duration);
|
|
127
|
+
};
|
|
128
|
+
MaterialAnimations.prototype.getFirstStockItemTransforms = function (context) {
|
|
129
|
+
var game = context.game, type = context.type, index = context.index, locators = context.locators, material = context.material;
|
|
130
|
+
var item = game.items[type][index];
|
|
131
|
+
var description = material[type];
|
|
132
|
+
var stockLocation = description.getStockLocation(item, context);
|
|
133
|
+
if (!stockLocation)
|
|
134
|
+
return [];
|
|
135
|
+
var stockItem = description.getStaticItems(context).find(function (item) { return (0, fast_deep_equal_1.default)(item.location, stockLocation); });
|
|
136
|
+
var displayIndex = (stockItem === null || stockItem === void 0 ? void 0 : stockItem.quantity) ? stockItem.quantity - 1 : 0;
|
|
137
|
+
var stockLocator = locators[stockLocation.type];
|
|
138
|
+
return stockLocator.transformItem(stockItem !== null && stockItem !== void 0 ? stockItem : { location: stockLocation }, __assign(__assign({}, context), { index: 0, displayIndex: displayIndex }));
|
|
139
|
+
};
|
|
140
|
+
MaterialAnimations.prototype.getKeyframesFromOrigin = function (origin, _animation, _context) {
|
|
141
|
+
return (0, react_1.keyframes)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n from {\n transform: ", ";\n }\n "], ["\n from {\n transform: ", ";\n }\n "])), origin);
|
|
142
|
+
};
|
|
143
|
+
MaterialAnimations.prototype.getMoveItemAnimation = function (context, animation) {
|
|
144
|
+
var _a, _b;
|
|
145
|
+
var type = context.type, game = context.game, Rules = context.Rules, locators = context.locators;
|
|
146
|
+
var futureGame = JSON.parse(JSON.stringify(game));
|
|
147
|
+
var rules = new Rules(futureGame);
|
|
148
|
+
var mutator = rules.mutator(type);
|
|
123
149
|
var futureIndex = mutator.move(animation.move);
|
|
124
150
|
var futureItem = mutator.items[futureIndex];
|
|
125
151
|
// TODO: if animation.move.quantity > 1, we will have to give a different target to each moving item. Formula bellow works only if 1 item moves
|
|
126
|
-
var
|
|
127
|
-
var targetLocator =
|
|
128
|
-
var
|
|
129
|
-
var
|
|
130
|
-
var
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
var
|
|
139
|
-
var currentItem = game.items[type][item.index];
|
|
140
|
-
var sourceLocator = context.locators[currentItem.location.type];
|
|
141
|
-
return sourceLocator.transformItem(currentItem, __assign(__assign({}, context), { game: game, type: type, index: item.displayIndex })).join(' ');
|
|
142
|
-
};
|
|
143
|
-
MaterialAnimations.prototype.closestRotation = function (targetTransform, sourceTransform) {
|
|
144
|
-
var sourceRotation = this.getRotation(sourceTransform);
|
|
145
|
-
var targetRotation = this.getRotation(targetTransform);
|
|
146
|
-
var rotationAdjustment = Math.round((sourceRotation - targetRotation) / 360) * 360;
|
|
147
|
-
return rotationAdjustment ? targetTransform + " rotateZ(".concat(rotationAdjustment, "deg)") : targetTransform;
|
|
148
|
-
};
|
|
149
|
-
MaterialAnimations.prototype.getRotation = function (transform) {
|
|
150
|
-
return Array.from(transform.matchAll(/rotateZ\((\d+.?\d*)deg\)/gi)).reduce(function (sum, match) { return sum + parseFloat(match[1]); }, 0)
|
|
151
|
-
+ Array.from(transform.matchAll(/rotateZ\((\d+.?\d*)rad\)/gi)).reduce(function (sum, match) { return sum + parseFloat(match[1]) * 180 / Math.PI; }, 0);
|
|
152
|
-
};
|
|
153
|
-
MaterialAnimations.prototype.getKeyframesToDestination = function (destination, _item, _animation, _context) {
|
|
154
|
-
return (0, react_1.keyframes)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n to {\n transform: ", ";\n }\n "], ["\n to {\n transform: ", ";\n }\n "])), destination);
|
|
155
|
-
};
|
|
156
|
-
MaterialAnimations.prototype.getDeleteItemAnimation = function (item, animation, context) {
|
|
157
|
-
var stockLocation = this.getStockLocation(animation.move.itemType, context);
|
|
152
|
+
var futureDisplayIndex = ((_a = futureItem.quantity) !== null && _a !== void 0 ? _a : 1) - ((_b = animation.move.quantity) !== null && _b !== void 0 ? _b : 1);
|
|
153
|
+
var targetLocator = locators[futureItem.location.type];
|
|
154
|
+
var futureContext = __assign(__assign({}, context), { game: futureGame, type: type, index: futureIndex, displayIndex: futureDisplayIndex });
|
|
155
|
+
var targetTransforms = targetLocator.transformItem(futureItem, futureContext);
|
|
156
|
+
var targetTransform = adjustRotation(targetTransforms, transformItem(context)).join(' ');
|
|
157
|
+
var animationKeyframes = this.getKeyframesToDestination(targetTransform, animation, context);
|
|
158
|
+
return movementAnimationCss(animationKeyframes, animation.duration);
|
|
159
|
+
};
|
|
160
|
+
MaterialAnimations.prototype.getKeyframesToDestination = function (destination, _animation, _context) {
|
|
161
|
+
return (0, react_1.keyframes)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n to {\n transform: ", ";\n }\n "], ["\n to {\n transform: ", ";\n }\n "])), destination);
|
|
162
|
+
};
|
|
163
|
+
MaterialAnimations.prototype.getDeleteItemAnimation = function (context, animation) {
|
|
164
|
+
var stockLocation = this.getFirstStockItemTransforms(context);
|
|
158
165
|
if (stockLocation) {
|
|
159
|
-
var
|
|
160
|
-
var animationKeyframes = this.getKeyframesToDestination(
|
|
161
|
-
return (
|
|
166
|
+
var targetTransform = adjustRotation(stockLocation, transformItem(context)).join(' ');
|
|
167
|
+
var animationKeyframes = this.getKeyframesToDestination(targetTransform, animation, context);
|
|
168
|
+
return movementAnimationCss(animationKeyframes, animation.duration);
|
|
162
169
|
}
|
|
163
170
|
else {
|
|
164
|
-
var fadeout = (0, react_1.keyframes)(
|
|
165
|
-
return (0, react_1.css)(
|
|
171
|
+
var fadeout = (0, react_1.keyframes)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n to {\n opacity: 0;\n }\n "], ["\n to {\n opacity: 0;\n }\n "])));
|
|
172
|
+
return (0, react_1.css)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["animation: ", " ", "s ease-in-out forwards"], ["animation: ", " ", "s ease-in-out forwards"])), fadeout, animation.duration);
|
|
166
173
|
}
|
|
167
174
|
};
|
|
168
175
|
return MaterialAnimations;
|
|
169
176
|
}(react_client_1.Animations));
|
|
170
177
|
exports.MaterialAnimations = MaterialAnimations;
|
|
171
|
-
var
|
|
178
|
+
var movementAnimationCss = function (keyframes, duration) { return (0, react_1.css)(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n animation: ", " ", "s linear infinite;\n\n > * {\n animation: ", " ", "s ease-in-out forwards;\n }\n"], ["\n animation: ", " ", "s linear infinite;\n\n > * {\n animation: ", " ", "s ease-in-out forwards;\n }\n"])), upAndDown, duration, keyframes, duration); };
|
|
179
|
+
var upAndDown = (0, react_1.keyframes)(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n from, to {\n transform: none;\n }\n 50% {\n transform: translateZ(10em);\n }\n"], ["\n from, to {\n transform: none;\n }\n 50% {\n transform: translateZ(10em);\n }\n"])));
|
|
180
|
+
function adjustRotation(targetTransforms, sourceTransforms) {
|
|
181
|
+
var result = [];
|
|
182
|
+
var sourceRotation = sumRotationsDegrees(sourceTransforms);
|
|
183
|
+
var targetRotation = sumRotationsDegrees(targetTransforms);
|
|
184
|
+
for (var axis in sourceRotation) {
|
|
185
|
+
var delta = Math.round((sourceRotation[axis] - targetRotation[axis]) / 360);
|
|
186
|
+
if (delta)
|
|
187
|
+
result.push("rotate".concat(axis.toUpperCase(), "(").concat(delta * 360, "deg)"));
|
|
188
|
+
}
|
|
189
|
+
return targetTransforms.concat(result);
|
|
190
|
+
}
|
|
191
|
+
function sumRotationsDegrees(transforms) {
|
|
192
|
+
var rotations = { x: 0, y: 0, z: 0 };
|
|
193
|
+
for (var _i = 0, transforms_1 = transforms; _i < transforms_1.length; _i++) {
|
|
194
|
+
var transform = transforms_1[_i];
|
|
195
|
+
var rotateMatch = transform.match(/rotate([^(]*)\((-?\d+.?\d*)([^)]*)\)/);
|
|
196
|
+
if (rotateMatch) {
|
|
197
|
+
var axis = rotateMatch[1].toLowerCase(), value = parseFloat(rotateMatch[2]), unit = rotateMatch[3];
|
|
198
|
+
if (axis in rotations) {
|
|
199
|
+
switch (unit) {
|
|
200
|
+
case 'deg':
|
|
201
|
+
rotations[axis] += value;
|
|
202
|
+
break;
|
|
203
|
+
case 'rad':
|
|
204
|
+
rotations[axis] += value * 180 / Math.PI;
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return rotations;
|
|
211
|
+
}
|
|
212
|
+
function transformItem(context) {
|
|
213
|
+
var game = context.game, type = context.type, index = context.index, locators = context.locators;
|
|
214
|
+
var currentItem = game.items[type][index];
|
|
215
|
+
var sourceLocator = locators[currentItem.location.type];
|
|
216
|
+
return sourceLocator.transformItem(currentItem, context);
|
|
217
|
+
}
|
|
218
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8;
|
|
172
219
|
//# sourceMappingURL=MaterialAnimations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MaterialAnimations.js","sourceRoot":"","sources":["../../../src/components/material/MaterialAnimations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MaterialAnimations.js","sourceRoot":"","sources":["../../../src/components/material/MaterialAnimations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAgF;AAChF,iDAgB4B;AAC5B,wCAAgF;AAGhF,oEAAmC;AAEnC;IACU,sCAAuD;IADjE;;IAoJA,CAAC;IAjJU,2CAAc,GAAvB,UAAwB,IAAuB,EAAE,OAA0E;;QACzH,QAAQ,IAAI,CAAC,IAAI,EAAE;YACjB,KAAK,wBAAY,CAAC,IAAI,CAAC;YACvB,KAAK,wBAAY,CAAC,MAAM;gBACtB,IAAI,CAAA,MAAA,OAAO,CAAC,KAAK,CAAC,WAAW,0CAAE,IAAI,MAAK,IAAI,CAAC,QAAQ,IAAI,CAAA,MAAA,OAAO,CAAC,KAAK,CAAC,WAAW,0CAAE,KAAK,MAAK,IAAI,CAAC,SAAS,EAAE;oBAC5G,OAAO,GAAG,CAAA;iBACX;gBACD,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;YACzC;gBACE,OAAO,CAAC,CAAA;SACX;IACH,CAAC;IAED,4CAAe,GAAf,UAAgB,IAAuB,EAAE,OAA0E;QACjH,QAAQ,IAAI,CAAC,IAAI,EAAE;YACjB,KAAK,wBAAY,CAAC,MAAM;gBACtB,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;YACzC;gBACE,OAAO,CAAC,CAAA;SACX;I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U,EAAE;QAA/B,IAAM,SAAS,mBAAA;QAClB,IAAM,WAAW,GAAG,SAAS,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAA;QAC3E,IAAI,WAAW,EAAE;YACf,IAAM,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,KAAK,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;YACpG,IAAI,IAAI,IAAI,SAAS,EAAE;gBACrB,QAAQ,IAAI,EAAE;oBACZ,KAAK,KAAK;wBACR,SAAS,CAAC,IAAI,CAAC,IAAI,KAAK,CAAA;wBACxB,MAAK;oBACP,KAAK,KAAK;wBACR,SAAS,CAAC,IAAI,CAAC,IAAI,KAAK,GAAG,GAAG,GAAG,IAAI,CAAC,EAAE,CAAA;wBACxC,MAAK;iBACR;aACF;SACF;KACF;IACD,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,SAAS,aAAa,CAAkF,OAA6B;IAC3H,IAAA,IAAI,GAA4B,OAAO,KAAnC,EAAE,IAAI,GAAsB,OAAO,KAA7B,EAAE,KAAK,GAAe,OAAO,MAAtB,EAAE,QAAQ,GAAK,OAAO,SAAZ,CAAY;IAC/C,IAAM,WAAW,GAAuB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAE,CAAC,KAAK,CAAC,CAAA;IAChE,IAAM,aAAa,GAAG,QAAQ,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;IACzD,OAAO,aAAa,CAAC,aAAa,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;AAC1D,CAAC"}
|
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
/** @jsxImportSource @emotion/react */
|
|
2
2
|
import { HTMLAttributes } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
export type MaterialComponentProps<
|
|
3
|
+
import { ComponentCommonProps } from './MaterialDescription';
|
|
4
|
+
export type MaterialComponentProps<M extends number = number, ItemId = any> = {
|
|
5
5
|
type: M;
|
|
6
6
|
itemId?: ItemId;
|
|
7
|
-
withLocations?: boolean;
|
|
8
|
-
legalMovesTo?: MaterialMove<P, M, L>[];
|
|
9
7
|
onShortClick?: () => void;
|
|
10
8
|
onLongClick?: () => void;
|
|
11
|
-
} & HTMLAttributes<HTMLElement>;
|
|
9
|
+
} & ComponentCommonProps & HTMLAttributes<HTMLElement>;
|
|
12
10
|
export declare const MaterialComponent: import("react").ForwardRefExoticComponent<{
|
|
13
11
|
type: number;
|
|
14
|
-
itemId?:
|
|
15
|
-
withLocations?: boolean;
|
|
16
|
-
legalMovesTo?: MaterialMove<number, number, number>[];
|
|
12
|
+
itemId?: any;
|
|
17
13
|
onShortClick?: () => void;
|
|
18
14
|
onLongClick?: () => void;
|
|
19
|
-
} & HTMLAttributes<HTMLElement> & import("react").RefAttributes<HTMLDivElement>>;
|
|
20
|
-
export declare const getPropForItem: <Id extends number = number>(prop: any, itemId?: Id) => any;
|
|
15
|
+
} & ComponentCommonProps & HTMLAttributes<HTMLElement> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -21,30 +21,19 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
}
|
|
22
22
|
return t;
|
|
23
23
|
};
|
|
24
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
|
-
};
|
|
27
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.
|
|
25
|
+
exports.MaterialComponent = void 0;
|
|
29
26
|
var jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
30
27
|
/** @jsxImportSource @emotion/react */
|
|
31
28
|
var react_1 = require("react");
|
|
32
|
-
var MaterialComponentType_1 = require("./MaterialComponentType");
|
|
33
|
-
var Board_1 = require("./Board");
|
|
34
|
-
var Card_1 = require("./Card");
|
|
35
|
-
var Token_1 = require("./Token");
|
|
36
|
-
var mapValues_1 = __importDefault(require("lodash/mapValues"));
|
|
37
29
|
var use_long_press_1 = require("use-long-press");
|
|
38
30
|
var utilities_1 = require("../../utilities");
|
|
39
|
-
var pickBy_1 = __importDefault(require("lodash/pickBy"));
|
|
40
31
|
var hooks_1 = require("../../hooks");
|
|
41
|
-
var
|
|
32
|
+
var FlatMaterial_1 = require("./FlatMaterial");
|
|
42
33
|
exports.MaterialComponent = (0, react_1.forwardRef)(function (_a, ref) {
|
|
43
|
-
var type = _a.type, itemId = _a.itemId,
|
|
34
|
+
var type = _a.type, itemId = _a.itemId, onShortClick = _a.onShortClick, _b = _a.onLongClick, onLongClick = _b === void 0 ? onShortClick : _b, props = __rest(_a, ["type", "itemId", "onShortClick", "onLongClick"]);
|
|
35
|
+
var game = (0, hooks_1.useGame)();
|
|
44
36
|
var description = (0, hooks_1.useMaterialDescription)(type);
|
|
45
|
-
var locators = (0, react_1.useContext)(GameProvider_1.gameContext).locators;
|
|
46
|
-
var rules = (0, hooks_1.useRules)();
|
|
47
|
-
var innerLocators = (0, pickBy_1.default)(locators, function (locator) { return (locator === null || locator === void 0 ? void 0 : locator.parentItemType) === type; });
|
|
48
37
|
var listeners = (0, use_long_press_1.useLongPress)(function () { return onLongClick && onLongClick(); }, {
|
|
49
38
|
detect: use_long_press_1.LongPressEventType.Pointer,
|
|
50
39
|
cancelOnMovement: 5,
|
|
@@ -57,45 +46,11 @@ exports.MaterialComponent = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
57
46
|
},
|
|
58
47
|
filterEvents: function (event) { return !event.button; } // Ignore clicks on mouse buttons > 0
|
|
59
48
|
})();
|
|
60
|
-
if (!description || !
|
|
49
|
+
if (!description || !game)
|
|
61
50
|
return null;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
case MaterialComponentType_1.MaterialComponentType.Board:
|
|
65
|
-
return (0, jsx_runtime_1.jsx)(Board_1.Board, __assign({ ref: ref }, itemProps, props, (0, utilities_1.combineEventListeners)(listeners, props), { children: withLocations && (description.getLocations ? description.getLocations(itemId, legalMovesTo) : createLocations(rules, innerLocators, itemId, legalMovesTo)) }));
|
|
66
|
-
case MaterialComponentType_1.MaterialComponentType.Card:
|
|
67
|
-
return (0, jsx_runtime_1.jsx)(Card_1.Card, __assign({ ref: ref }, itemProps, props, (0, utilities_1.combineEventListeners)(listeners, props)));
|
|
68
|
-
case MaterialComponentType_1.MaterialComponentType.Token:
|
|
69
|
-
return (0, jsx_runtime_1.jsx)(Token_1.Token, __assign({ ref: ref }, itemProps, props, (0, utilities_1.combineEventListeners)(listeners, props)));
|
|
70
|
-
default:
|
|
71
|
-
return null;
|
|
51
|
+
if ((0, FlatMaterial_1.isFlatMaterialDescription)(description)) {
|
|
52
|
+
return ((0, jsx_runtime_1.jsx)(FlatMaterial_1.FlatMaterial, __assign({ ref: ref }, description.getFlatMaterialProps(itemId), props, (0, utilities_1.combineEventListeners)(listeners, props))));
|
|
72
53
|
}
|
|
54
|
+
return null;
|
|
73
55
|
});
|
|
74
|
-
var getPropForItem = function (prop, itemId) {
|
|
75
|
-
if (typeof prop === 'object') {
|
|
76
|
-
if (isIdRecord(prop)) {
|
|
77
|
-
return itemId !== undefined ? prop[itemId] : undefined;
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
return (0, mapValues_1.default)(prop, function (p) { return (0, exports.getPropForItem)(p, itemId); });
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
else if (typeof prop === 'function') {
|
|
84
|
-
return prop(itemId);
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
return prop;
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
exports.getPropForItem = getPropForItem;
|
|
91
|
-
var isIdRecord = function (prop) {
|
|
92
|
-
return !isNaN(parseInt(Object.keys(prop)[0]));
|
|
93
|
-
};
|
|
94
|
-
var createLocations = function (rules, locators, itemId, moves) {
|
|
95
|
-
if (moves === void 0) { moves = []; }
|
|
96
|
-
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: Object.entries(locators).map(function (_a) {
|
|
97
|
-
var locator = _a[1];
|
|
98
|
-
return locator && locator.createLocationsOnItem(itemId, moves, rules);
|
|
99
|
-
}) });
|
|
100
|
-
};
|
|
101
56
|
//# sourceMappingURL=MaterialComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MaterialComponent.js","sourceRoot":"","sources":["../../../src/components/material/MaterialComponent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MaterialComponent.js","sourceRoot":"","sources":["../../../src/components/material/MaterialComponent.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAsC;AACtC,+BAA8D;AAE9D,iDAA0F;AAC1F,6CAAuD;AACvD,qCAA6D;AAC7D,+CAAwE;AAU3D,QAAA,iBAAiB,GAAG,IAAA,kBAAU,EAAyC,UAClF,EAAoE,EAAE,GAAG;IAAvE,IAAA,IAAI,UAAA,EAAE,MAAM,YAAA,EAAE,YAAY,kBAAA,EAAE,mBAA0B,EAA1B,WAAW,mBAAG,YAAY,KAAA,EAAK,KAAK,cAAlE,iDAAoE,CAAF;IAElE,IAAM,IAAI,GAAG,IAAA,eAAO,GAAgB,CAAA;IACpC,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,IAAI,MAAM,KAAK,wCAAuB,CAAC,kBAAkB,EAAE;gBACzD,UAAU,CAAC,cAAM,OAAA,YAAY,IAAI,YAAY,EAAE,EAA9B,CAA8B,CAAC,CAAA;aACjD;QACH,CAAC;QACD,YAAY,EAAE,UAAA,KAAK,IAAI,OAAA,CAAE,KAAoB,CAAC,MAAM,EAA7B,CAA6B,CAAC,qCAAqC;KAC3F,CAAC,EAAE,CAAA;IAEJ,IAAI,CAAC,WAAW,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAA;IAEtC,IAAI,IAAA,wCAAyB,EAAC,WAAW,CAAC,EAAE;QAC1C,OAAO,CACL,uBAAC,2BAAY,aAAC,GAAG,EAAE,GAAG,IAAM,WAAW,CAAC,oBAAoB,CAAC,MAAM,CAAC,EAAM,KAAK,EAAM,IAAA,iCAAqB,EAAC,SAAS,EAAE,KAAK,CAAC,EAAG,CAChI,CAAA;KACF;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CAAC,CAAA"}
|
|
@@ -1,20 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { ItemMove, Location, MaterialGame, MaterialItem, MaterialMove } from '@gamepark/rules-api';
|
|
5
|
-
import { TokenMaterialDescription } from './Token';
|
|
6
|
-
export type MaterialDescription<P extends number = number, M extends number = number, L extends number = number> = BoardMaterialDescription<P, M, L> | CardMaterialDescription<P, M, L> | TokenMaterialDescription<P, M, L>;
|
|
7
|
-
export type StockDescription<P extends number = number, L extends number = number> = {
|
|
8
|
-
location: Location<P, L>;
|
|
9
|
-
};
|
|
10
|
-
export type CommonMaterialDescription<P extends number = number, M extends number = number, L extends number = number> = {
|
|
11
|
-
rules: (props: MaterialRulesProps<P, M, L>) => ReactNode;
|
|
12
|
-
items?: (game: MaterialGame<P, M, L>, player?: P) => MaterialItem<P, L>[];
|
|
13
|
-
stock?: StockDescription<P, L>;
|
|
14
|
-
};
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { Location, MaterialItem, MaterialMove, MaterialRulesDisplay } from '@gamepark/rules-api';
|
|
3
|
+
import { ItemContext, MaterialContext } from '../../locators';
|
|
15
4
|
export type MaterialRulesProps<P extends number = number, M extends number = number, L extends number = number> = {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
5
|
+
closeDialog: () => void;
|
|
6
|
+
} & Omit<MaterialRulesDisplay<P, M, L>, 'type'>;
|
|
7
|
+
export type ComponentSize = {
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
};
|
|
11
|
+
export type ComponentCommonProps = {
|
|
12
|
+
highlight?: boolean;
|
|
13
|
+
playDown?: boolean;
|
|
19
14
|
};
|
|
20
|
-
export
|
|
15
|
+
export declare abstract class MaterialDescription<P extends number = number, M extends number = number, L extends number = number, ItemId = any> {
|
|
16
|
+
abstract rules: FC<MaterialRulesProps<P, M, L>>;
|
|
17
|
+
staticItem?: MaterialItem<P, L>;
|
|
18
|
+
staticItems: MaterialItem<P, L>[];
|
|
19
|
+
getStaticItems(_context: MaterialContext<P, M, L>): MaterialItem<P, L>[];
|
|
20
|
+
stockLocation?: Location<P, L>;
|
|
21
|
+
getStockLocation(_item: MaterialItem<P, L>, _context: MaterialContext<P, M, L>): Location<P, L> | undefined;
|
|
22
|
+
location?: Location<P, L>;
|
|
23
|
+
locations: Location<P, L>[];
|
|
24
|
+
getLocations(_item: MaterialItem<P, L>, _context: ItemContext<P, M, L>): Location<P, L>[];
|
|
25
|
+
canDrag(move: MaterialMove<P, M, L>, { type, index }: ItemContext<P, M, L>): boolean;
|
|
26
|
+
height?: number;
|
|
27
|
+
width?: number;
|
|
28
|
+
ratio?: number;
|
|
29
|
+
getSize(_itemId: ItemId): ComponentSize;
|
|
30
|
+
abstract getImages(): string[];
|
|
31
|
+
thickness: number;
|
|
32
|
+
getThickness(_item: MaterialItem<P, L>, _context: ItemContext<P, M, L>): number;
|
|
33
|
+
}
|
|
@@ -1,3 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MaterialDescription = void 0;
|
|
4
|
+
var rules_api_1 = require("@gamepark/rules-api");
|
|
5
|
+
var MaterialDescription = /** @class */ (function () {
|
|
6
|
+
function MaterialDescription() {
|
|
7
|
+
this.staticItems = [];
|
|
8
|
+
this.locations = [];
|
|
9
|
+
this.thickness = 0.05;
|
|
10
|
+
}
|
|
11
|
+
MaterialDescription.prototype.getStaticItems = function (_context) {
|
|
12
|
+
return this.staticItem ? [this.staticItem] : this.staticItems;
|
|
13
|
+
};
|
|
14
|
+
MaterialDescription.prototype.getStockLocation = function (_item, _context) {
|
|
15
|
+
return this.stockLocation;
|
|
16
|
+
};
|
|
17
|
+
MaterialDescription.prototype.getLocations = function (_item, _context) {
|
|
18
|
+
return this.location ? [this.location] : this.locations;
|
|
19
|
+
};
|
|
20
|
+
MaterialDescription.prototype.canDrag = function (move, _a) {
|
|
21
|
+
var type = _a.type, index = _a.index;
|
|
22
|
+
return ((0, rules_api_1.isMoveItem)(move) || (0, rules_api_1.isDeleteItem)(move)) && move.itemType === type && move.itemIndex === index;
|
|
23
|
+
};
|
|
24
|
+
MaterialDescription.prototype.getSize = function (_itemId) {
|
|
25
|
+
if (this.width && this.height)
|
|
26
|
+
return { width: this.width, height: this.height };
|
|
27
|
+
if (this.ratio && this.width)
|
|
28
|
+
return { width: this.width, height: this.width / this.ratio };
|
|
29
|
+
if (this.ratio && this.height)
|
|
30
|
+
return { width: this.height * this.ratio, height: this.height };
|
|
31
|
+
throw new Error('You must implement 2 of "width", "height" & "ratio" in any Material description');
|
|
32
|
+
};
|
|
33
|
+
MaterialDescription.prototype.getThickness = function (_item, _context) {
|
|
34
|
+
return this.thickness;
|
|
35
|
+
};
|
|
36
|
+
return MaterialDescription;
|
|
37
|
+
}());
|
|
38
|
+
exports.MaterialDescription = MaterialDescription;
|
|
3
39
|
//# sourceMappingURL=MaterialDescription.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MaterialDescription.js","sourceRoot":"","sources":["../../../src/components/material/MaterialDescription.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"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I,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE,CAAA;QAC3F,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM;YAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAA;QAC9F,MAAM,IAAI,KAAK,CAAC,iFAAiF,CAAC,CAAA;IACpG,CAAC;IAMD,0CAAY,GAAZ,UAAa,KAAyB,EAAE,QAA8B;QACpE,OAAO,IAAI,CAAC,SAAS,CAAA;IACvB,CAAC;IACH,0BAAC;AAAD,CAAC,AA7CD,IA6CC;AA7CqB,kDAAmB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ItemAnimations } from './ItemAnimations';
|
|
2
|
+
import { CreateItem, ItemMove } from '@gamepark/rules-api';
|
|
3
|
+
import { Animation } from '@gamepark/react-client';
|
|
4
|
+
import { ItemContext } from '../../../locators';
|
|
5
|
+
import { Interpolation, Theme } from '@emotion/react';
|
|
6
|
+
import { MaterialAnimationContext } from './MaterialGameAnimations';
|
|
7
|
+
export declare class CreateItemAnimations<P extends number = number, M extends number = number, L extends number = number> extends ItemAnimations<P, M, L> {
|
|
8
|
+
protected duration: number;
|
|
9
|
+
constructor(duration?: number);
|
|
10
|
+
getPostDuration(_move: CreateItem<P, M, L>, _context: MaterialAnimationContext<P, M, L>): number;
|
|
11
|
+
getItemAnimation(context: ItemContext<P, M, L>, animation: Animation<CreateItem<P, M, L>>): Interpolation<Theme>;
|
|
12
|
+
isItemToAnimate({ game, type, index, displayIndex }: ItemContext<P, M, L>, animation: Animation<CreateItem<P, M, L>>): boolean;
|
|
13
|
+
protected getKeyframesFromOrigin(origin: string, _animation: Animation<ItemMove<P, M, L>>, _context: ItemContext<P, M, L>): import("@emotion/serialize").Keyframes;
|
|
14
|
+
}
|