@gamepark/react-game 6.23.4 → 6.24.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Header/MaterialHeader.js +2 -1
- package/dist/components/Header/MaterialHeader.js.map +1 -1
- package/dist/components/PlayerPanel/Counters.d.ts +13 -0
- package/dist/components/PlayerPanel/Counters.js +44 -0
- package/dist/components/PlayerPanel/Counters.js.map +1 -0
- package/dist/components/PlayerPanel/StyledPlayerPanel.d.ts +4 -2
- package/dist/components/PlayerPanel/StyledPlayerPanel.js +30 -25
- package/dist/components/PlayerPanel/StyledPlayerPanel.js.map +1 -1
- package/dist/components/PlayerPanel/index.d.ts +1 -0
- package/dist/components/PlayerPanel/index.js +1 -0
- package/dist/components/PlayerPanel/index.js.map +1 -1
- package/dist/components/dialogs/RulesDialog/LocationRulesDialogContent.d.ts +1 -1
- package/dist/components/dialogs/RulesDialog/LocationRulesDialogContent.js +6 -6
- package/dist/components/dialogs/RulesDialog/LocationRulesDialogContent.js.map +1 -1
- package/dist/components/dialogs/RulesDialog/MaterialRulesDialogContent.js +13 -6
- package/dist/components/dialogs/RulesDialog/MaterialRulesDialogContent.js.map +1 -1
- package/dist/components/material/ComponentDescription.d.ts +14 -0
- package/dist/components/material/ComponentDescription.js +27 -0
- package/dist/components/material/ComponentDescription.js.map +1 -0
- package/dist/components/material/Dices/CubicDiceDescription.d.ts +1 -0
- package/dist/components/material/Dices/CubicDiceDescription.js +13 -0
- package/dist/components/material/Dices/CubicDiceDescription.js.map +1 -1
- package/dist/components/material/DraggableMaterial.d.ts +1 -13
- package/dist/components/material/DraggableMaterial.js +37 -91
- package/dist/components/material/DraggableMaterial.js.map +1 -1
- package/dist/components/material/FlatMaterial/CardDescription.d.ts +2 -2
- package/dist/components/material/FlatMaterial/CardDescription.js +1 -1
- package/dist/components/material/FlatMaterial/CardDescription.js.map +1 -1
- package/dist/components/material/FlatMaterial/FlatMaterial.d.ts +4 -2
- package/dist/components/material/FlatMaterial/FlatMaterial.js +17 -11
- package/dist/components/material/FlatMaterial/FlatMaterial.js.map +1 -1
- package/dist/components/material/FlatMaterial/TokenDescription.d.ts +1 -1
- package/dist/components/material/FlatMaterial/TokenDescription.js.map +1 -1
- package/dist/components/material/GameTable/GameMaterialDisplay.js +1 -1
- package/dist/components/material/GameTable/GameMaterialDisplay.js.map +1 -1
- package/dist/components/material/GameTable/GameTable.js +9 -7
- package/dist/components/material/GameTable/GameTable.js.map +1 -1
- package/dist/components/material/GameTable/ItemDisplay.d.ts +4 -2
- package/dist/components/material/GameTable/ItemDisplay.js +104 -15
- package/dist/components/material/GameTable/ItemDisplay.js.map +1 -1
- package/dist/components/material/GameTable/StaticItemsDisplay.js +2 -2
- package/dist/components/material/GameTable/StaticItemsDisplay.js.map +1 -1
- package/dist/components/material/GameTable/StaticLocationsDisplay.js +12 -12
- package/dist/components/material/GameTable/StaticLocationsDisplay.js.map +1 -1
- package/dist/components/material/GameTable/focus/FocusProvider.d.ts +6 -6
- package/dist/components/material/GameTable/focus/FocusProvider.js +2 -2
- package/dist/components/material/GameTable/focus/FocusProvider.js.map +1 -1
- package/dist/components/material/GameTable/focus/index.d.ts +0 -1
- package/dist/components/material/GameTable/focus/index.js +0 -1
- package/dist/components/material/GameTable/focus/index.js.map +1 -1
- package/dist/components/material/ImageLoader/MaterialImageLoader.js +17 -11
- package/dist/components/material/ImageLoader/MaterialImageLoader.js.map +1 -1
- package/dist/components/material/MaterialComponent.d.ts +0 -4
- package/dist/components/material/MaterialComponent.js +5 -18
- package/dist/components/material/MaterialComponent.js.map +1 -1
- package/dist/components/material/MaterialDescription.d.ts +5 -13
- package/dist/components/material/MaterialDescription.js +48 -22
- package/dist/components/material/MaterialDescription.js.map +1 -1
- package/dist/components/material/Writing/WritingDescription.d.ts +0 -4
- package/dist/components/material/Writing/WritingDescription.js +0 -10
- package/dist/components/material/Writing/WritingDescription.js.map +1 -1
- package/dist/components/material/animations/CreateItemAnimations.js +5 -3
- package/dist/components/material/animations/CreateItemAnimations.js.map +1 -1
- package/dist/components/material/animations/DeleteItemAnimations.js +7 -5
- package/dist/components/material/animations/DeleteItemAnimations.js.map +1 -1
- package/dist/components/material/animations/ItemAnimations.d.ts +2 -1
- package/dist/components/material/animations/ItemAnimations.js +9 -0
- package/dist/components/material/animations/ItemAnimations.js.map +1 -1
- package/dist/components/material/animations/MaterialAnimations.d.ts +2 -2
- package/dist/components/material/animations/MoveItemAnimations.d.ts +1 -2
- package/dist/components/material/animations/MoveItemAnimations.js +18 -31
- package/dist/components/material/animations/MoveItemAnimations.js.map +1 -1
- package/dist/components/material/animations/MoveItemAtOnceAnimations.d.ts +1 -2
- package/dist/components/material/animations/MoveItemAtOnceAnimations.js +14 -28
- package/dist/components/material/animations/MoveItemAtOnceAnimations.js.map +1 -1
- package/dist/components/material/animations/RollItemAnimations.d.ts +1 -2
- package/dist/components/material/animations/RollItemAnimations.js +4 -15
- package/dist/components/material/animations/RollItemAnimations.js.map +1 -1
- package/dist/components/material/animations/adjustRotation.d.ts +1 -1
- package/dist/components/material/animations/adjustRotation.js +60 -19
- package/dist/components/material/animations/adjustRotation.js.map +1 -1
- package/dist/components/material/animations/getFirstStockItemTransforms.util.js +3 -6
- package/dist/components/material/animations/getFirstStockItemTransforms.util.js.map +1 -1
- package/dist/components/material/animations/rotations.utils.d.ts +2 -0
- package/dist/components/material/animations/rotations.utils.js +99 -0
- package/dist/components/material/animations/rotations.utils.js.map +1 -0
- package/dist/components/material/animations/transformItem.util.js +3 -5
- package/dist/components/material/animations/transformItem.util.js.map +1 -1
- package/dist/components/material/index.d.ts +1 -0
- package/dist/components/material/index.js +1 -0
- package/dist/components/material/index.js.map +1 -1
- package/dist/components/material/locations/DropAreaDescription.d.ts +9 -0
- package/dist/components/material/locations/DropAreaDescription.js +46 -0
- package/dist/components/material/locations/DropAreaDescription.js.map +1 -0
- package/dist/components/material/locations/LocationComponent.d.ts +16 -0
- package/dist/components/material/locations/LocationComponent.js +89 -0
- package/dist/components/material/locations/LocationComponent.js.map +1 -0
- package/dist/components/material/locations/LocationDescription.d.ts +14 -25
- package/dist/components/material/locations/LocationDescription.js +43 -50
- package/dist/components/material/locations/LocationDescription.js.map +1 -1
- package/dist/components/material/locations/LocationDisplay.d.ts +4 -1
- package/dist/components/material/locations/LocationDisplay.js +4 -9
- package/dist/components/material/locations/LocationDisplay.js.map +1 -1
- package/dist/components/material/locations/LocationsMask.d.ts +2 -1
- package/dist/components/material/locations/LocationsMask.js +6 -6
- package/dist/components/material/locations/LocationsMask.js.map +1 -1
- package/dist/components/material/locations/SimpleDropArea.d.ts +4 -7
- package/dist/components/material/locations/SimpleDropArea.js +18 -88
- package/dist/components/material/locations/SimpleDropArea.js.map +1 -1
- package/dist/components/material/locations/index.d.ts +1 -0
- package/dist/components/material/locations/index.js +1 -0
- package/dist/components/material/locations/index.js.map +1 -1
- package/dist/components/material/utils/isDroppedItem.js +12 -1
- package/dist/components/material/utils/isDroppedItem.js.map +1 -1
- package/dist/components/material/utils/isPlacedOnItem.d.ts +3 -3
- package/dist/components/material/utils/isPlacedOnItem.js +5 -5
- package/dist/components/material/utils/isPlacedOnItem.js.map +1 -1
- package/dist/components/tutorial/MaterialTutorial.js +4 -4
- package/dist/components/tutorial/MaterialTutorial.js.map +1 -1
- package/dist/components/tutorial/MaterialTutorialDisplay.js +7 -6
- package/dist/components/tutorial/MaterialTutorialDisplay.js.map +1 -1
- package/dist/components/tutorial/TutorialRulesWrapper.js +26 -26
- package/dist/components/tutorial/TutorialRulesWrapper.js.map +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/useDraggedItem.d.ts +2 -0
- package/dist/hooks/useDraggedItem.js +19 -0
- package/dist/hooks/useDraggedItem.js.map +1 -0
- package/dist/hooks/useItemLocations.d.ts +8 -0
- package/dist/hooks/useItemLocations.js +83 -0
- package/dist/hooks/useItemLocations.js.map +1 -0
- package/dist/hooks/useItemLocator.d.ts +2 -2
- package/dist/hooks/useItemLocator.js.map +1 -1
- package/dist/hooks/useLegalMoves.js +4 -18
- package/dist/hooks/useLegalMoves.js.map +1 -1
- package/dist/hooks/usePlayers.js +14 -1
- package/dist/hooks/usePlayers.js.map +1 -1
- package/dist/hooks/useStaticLocations.d.ts +2 -0
- package/dist/hooks/useStaticLocations.js +53 -0
- package/dist/hooks/useStaticLocations.js.map +1 -0
- package/dist/hooks/useTutorialStep.js +2 -2
- package/dist/hooks/useTutorialStep.js.map +1 -1
- package/dist/hooks/useZoomToElements.d.ts +1 -1
- package/dist/hooks/useZoomToElements.js +8 -8
- package/dist/hooks/useZoomToElements.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/locators/DeckLocator.d.ts +5 -4
- package/dist/locators/DeckLocator.js +6 -8
- package/dist/locators/DeckLocator.js.map +1 -1
- package/dist/locators/FlexLocator.d.ts +18 -0
- package/dist/locators/FlexLocator.js +88 -0
- package/dist/locators/FlexLocator.js.map +1 -0
- package/dist/locators/HandLocator.d.ts +22 -13
- package/dist/locators/HandLocator.js +71 -39
- package/dist/locators/HandLocator.js.map +1 -1
- package/dist/locators/ListLocator.d.ts +18 -0
- package/dist/locators/ListLocator.js +97 -0
- package/dist/locators/ListLocator.js.map +1 -0
- package/dist/locators/Locator.d.ts +50 -0
- package/dist/locators/Locator.js +153 -0
- package/dist/locators/Locator.js.map +1 -0
- package/dist/locators/PileLocator.d.ts +12 -11
- package/dist/locators/PileLocator.js +44 -29
- package/dist/locators/PileLocator.js.map +1 -1
- package/dist/locators/index.d.ts +3 -3
- package/dist/locators/index.js +3 -3
- package/dist/locators/index.js.map +1 -1
- package/dist/utilities/combineEventListeners.js.map +1 -1
- package/dist/utilities/findIfUnique.util.js.map +1 -1
- package/dist/utilities/index.d.ts +1 -0
- package/dist/utilities/index.js +1 -0
- package/dist/utilities/index.js.map +1 -1
- package/dist/utilities/translation.util.d.ts +5 -0
- package/dist/utilities/translation.util.js +33 -0
- package/dist/utilities/translation.util.js.map +1 -0
- package/dist/utilities/zoom-pan-pinch/animations.constants.d.ts +16 -0
- package/dist/utilities/zoom-pan-pinch/animations.constants.js +62 -0
- package/dist/utilities/zoom-pan-pinch/animations.constants.js.map +1 -0
- package/dist/utilities/zoom-pan-pinch/animations.util.d.ts +4 -0
- package/dist/utilities/zoom-pan-pinch/animations.util.js +71 -0
- package/dist/utilities/zoom-pan-pinch/animations.util.js.map +1 -0
- package/dist/utilities/zoom-pan-pinch/bounds.util.d.ts +7 -0
- package/dist/utilities/zoom-pan-pinch/bounds.util.js +77 -0
- package/dist/utilities/zoom-pan-pinch/bounds.util.js.map +1 -0
- package/dist/utilities/zoom-pan-pinch/calculation.util.d.ts +2 -0
- package/dist/utilities/zoom-pan-pinch/calculation.util.js +12 -0
- package/dist/utilities/zoom-pan-pinch/calculation.util.js.map +1 -0
- package/dist/utilities/zoom-pan-pinch/index.d.ts +5 -0
- package/dist/utilities/zoom-pan-pinch/index.js +22 -0
- package/dist/utilities/zoom-pan-pinch/index.js.map +1 -0
- package/dist/utilities/zoom-pan-pinch/zoom.util.d.ts +1 -0
- package/dist/utilities/zoom-pan-pinch/zoom.util.js +14 -0
- package/dist/utilities/zoom-pan-pinch/zoom.util.js.map +1 -0
- package/package.json +3 -3
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
2
17
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
18
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
19
|
};
|
|
@@ -6,25 +21,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
21
|
exports.LocationDescription = void 0;
|
|
7
22
|
var rules_api_1 = require("@gamepark/rules-api");
|
|
8
23
|
var isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
24
|
+
var ComponentDescription_1 = require("../ComponentDescription");
|
|
9
25
|
var utils_1 = require("../utils");
|
|
10
26
|
var Writing_1 = require("../Writing");
|
|
11
|
-
var
|
|
27
|
+
var LocationComponent_1 = require("./LocationComponent");
|
|
28
|
+
var displayLocationHelp = rules_api_1.MaterialMoveBuilder.displayLocationHelp;
|
|
29
|
+
var LocationDescription = (function (_super) {
|
|
30
|
+
__extends(LocationDescription, _super);
|
|
12
31
|
function LocationDescription() {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
32
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
33
|
+
_this.Component = LocationComponent_1.LocationComponent;
|
|
34
|
+
return _this;
|
|
16
35
|
}
|
|
17
|
-
LocationDescription.prototype.
|
|
18
|
-
return this.location
|
|
19
|
-
};
|
|
20
|
-
LocationDescription.prototype.getSize = function (_location, _context) {
|
|
21
|
-
if (this.width && this.height)
|
|
22
|
-
return { width: this.width, height: this.height };
|
|
23
|
-
if (this.ratio && this.width)
|
|
24
|
-
return { width: this.width, height: this.width / this.ratio };
|
|
25
|
-
if (this.ratio && this.height)
|
|
26
|
-
return { width: this.height * this.ratio, height: this.height };
|
|
27
|
-
throw new Error('You must implement 2 of "width", "height" & "ratio" in any Location description');
|
|
36
|
+
LocationDescription.prototype.getLocationSize = function (location, _context) {
|
|
37
|
+
return this.getSize(location.id);
|
|
28
38
|
};
|
|
29
39
|
LocationDescription.prototype.getImage = function (location, _context) {
|
|
30
40
|
var _a, _b;
|
|
@@ -34,46 +44,26 @@ var LocationDescription = (function () {
|
|
|
34
44
|
var _a;
|
|
35
45
|
return (_a = this.helpImage) !== null && _a !== void 0 ? _a : this.getImage(location, context);
|
|
36
46
|
};
|
|
37
|
-
LocationDescription.prototype.
|
|
38
|
-
|
|
47
|
+
LocationDescription.prototype.getImages = function () {
|
|
48
|
+
var images = [];
|
|
49
|
+
if (this.image)
|
|
50
|
+
images.push(this.image);
|
|
51
|
+
if (this.images)
|
|
52
|
+
images.push.apply(images, Object.values(this.images));
|
|
53
|
+
if (this.helpImage)
|
|
54
|
+
images.push(this.helpImage);
|
|
55
|
+
return images;
|
|
39
56
|
};
|
|
40
57
|
LocationDescription.prototype.getExtraCss = function (_location, _context) {
|
|
41
58
|
return this.extraCss;
|
|
42
59
|
};
|
|
43
|
-
LocationDescription.prototype.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
var coordinates = this.getCoordinates(location, context);
|
|
49
|
-
if (coordinates) {
|
|
50
|
-
transform.push("translate3d(".concat(coordinates.x, "em, ").concat(coordinates.y, "em, ").concat(coordinates.z, "em)"));
|
|
51
|
-
}
|
|
52
|
-
var rotateZ = this.getRotateZ(location, context);
|
|
53
|
-
if (rotateZ) {
|
|
54
|
-
transform.push("rotateZ(".concat(rotateZ).concat(this.rotationUnit, ")"));
|
|
55
|
-
}
|
|
60
|
+
LocationDescription.prototype.getLocationTransform = function (location, context) {
|
|
61
|
+
var transform = ['translate(-50%, -50%)'];
|
|
62
|
+
var locator = context.locators[location.type];
|
|
63
|
+
if (locator)
|
|
64
|
+
transform.push.apply(transform, locator.placeLocation(location, context));
|
|
56
65
|
return transform;
|
|
57
66
|
};
|
|
58
|
-
LocationDescription.prototype.getCoordinates = function (_location, _context) {
|
|
59
|
-
return this.coordinates;
|
|
60
|
-
};
|
|
61
|
-
LocationDescription.prototype.getRotateZ = function (_location, _context) {
|
|
62
|
-
return this.rotateZ;
|
|
63
|
-
};
|
|
64
|
-
LocationDescription.prototype.isAlwaysVisible = function (location, context) {
|
|
65
|
-
var _a;
|
|
66
|
-
if (this.alwaysVisible !== undefined)
|
|
67
|
-
return this.alwaysVisible;
|
|
68
|
-
return ((_a = context.locators[location.type]) === null || _a === void 0 ? void 0 : _a.parentItemType) !== undefined;
|
|
69
|
-
};
|
|
70
|
-
LocationDescription.prototype.canDrop = function (move, location, context) {
|
|
71
|
-
return this.isMoveToLocation(move, location, context);
|
|
72
|
-
};
|
|
73
|
-
LocationDescription.prototype.getBestDropMove = function (moves, _location, context) {
|
|
74
|
-
var moveWithSameRotation = moves.find(function (move) { var _a; return (0, rules_api_1.isMoveItem)(move) && move.location.rotation === ((_a = context.rules.material(move.itemType).getItem(move.itemIndex)) === null || _a === void 0 ? void 0 : _a.location.rotation); });
|
|
75
|
-
return moveWithSameRotation !== null && moveWithSameRotation !== void 0 ? moveWithSameRotation : moves[0];
|
|
76
|
-
};
|
|
77
67
|
LocationDescription.prototype.canLongClick = function (move, location, context) {
|
|
78
68
|
return this.isMoveToLocation(move, location, context);
|
|
79
69
|
};
|
|
@@ -93,7 +83,10 @@ var LocationDescription = (function () {
|
|
|
93
83
|
LocationDescription.prototype.getShortClickLocalMove = function (_location, _context) {
|
|
94
84
|
return undefined;
|
|
95
85
|
};
|
|
86
|
+
LocationDescription.prototype.displayHelp = function (location, _context) {
|
|
87
|
+
return this.help && displayLocationHelp(location);
|
|
88
|
+
};
|
|
96
89
|
return LocationDescription;
|
|
97
|
-
}());
|
|
90
|
+
}(ComponentDescription_1.ComponentDescription));
|
|
98
91
|
exports.LocationDescription = LocationDescription;
|
|
99
92
|
//# sourceMappingURL=LocationDescription.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocationDescription.js","sourceRoot":"","sources":["../../../../src/components/material/locations/LocationDescription.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LocationDescription.js","sourceRoot":"","sources":["../../../../src/components/material/locations/LocationDescription.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA,iDAAyH;AACzH,2DAAoC;AAGpC,gEAA6E;AAC7E,kCAA2C;AAC3C,sCAAiD;AACjD,yDAAuD;AACvD,IAAO,mBAAmB,GAAG,+BAAmB,CAAC,mBAAmB,CAAA;AAEpE;IACU,uCAAwB;IADlC;QAAA,qEAyFC;QAtFC,eAAS,GAAgB,qCAAiB,CAAA;;IAsF5C,CAAC;IAlFC,6CAAe,GAAf,UAAgB,QAAwB,EAAE,QAAkC;QAC1E,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;IAClC,CAAC;IAKD,sCAAQ,GAAR,UAAS,QAAwB,EAAE,QAAkC;;QACnE,OAAO,MAAA,MAAA,IAAI,CAAC,MAAM,0CAAG,QAAQ,CAAC,EAAE,CAAC,mCAAI,IAAI,CAAC,KAAK,CAAA;IACjD,CAAC;IAID,0CAAY,GAAZ,UAAa,QAAwB,EAAE,OAAiC;;QACtE,OAAO,MAAA,IAAI,CAAC,SAAS,mCAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IAC3D,CAAC;IAED,uCAAS,GAAT;QACE,IAAM,MAAM,GAAa,EAAE,CAAA;QAC3B,IAAI,IAAI,CAAC,KAAK;YAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACvC,IAAI,IAAI,CAAC,MAAM;YAAE,MAAM,CAAC,IAAI,OAAX,MAAM,EAAS,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAa,EAAC;QACvE,IAAI,IAAI,CAAC,SAAS;YAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,C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AAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CACxG,IAAI,CACH,IAAA,wBAAY,EAAC,IAAI,CAAC,IAAI,IAAA,iBAAO,EAAC,QAAQ,EAAE,MAAA,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,0CAAE,gBAAgB,CACvF,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAE,EAAE,OAAO,CAAC,CACzE,CACF,CAAA;IACH,CAAC;IAED,+CAAiB,GAAjB,UAAkB,SAAyB,EAAE,QAAkC;QAC7E,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,oDAAsB,GAAtB,UAAuB,SAAyB,EAAE,QAAkC;QAClF,OAAO,SAAS,CAAA;IAClB,CAAC;IAWD,yCAAW,GAAX,UAAY,QAAwB,EAAE,QAAkC;QACtE,OAAO,IAAI,CAAC,IAAI,IAAI,mBAAmB,CAAC,QAAQ,CAAC,CAAA;IACnD,CAAC;IACH,0BAAC;AAAD,CAAC,AAzFD,CACU,2CAAoB,GAwF7B;AAzFY,kDAAmB"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { Location } from '@gamepark/rules-api';
|
|
2
2
|
import { HTMLAttributes } from 'react';
|
|
3
|
-
|
|
3
|
+
import { LocationDescription } from './LocationDescription';
|
|
4
|
+
export type LocationDisplayProps<P extends number = number, M extends number = number, L extends number = number> = {
|
|
4
5
|
location: Location<P, L>;
|
|
6
|
+
description: LocationDescription<P, M, L>;
|
|
5
7
|
canDrop?: boolean;
|
|
6
8
|
} & HTMLAttributes<HTMLDivElement>;
|
|
7
9
|
export declare const LocationDisplay: import("react").ForwardRefExoticComponent<{
|
|
8
10
|
location: Location<number, number, any, any>;
|
|
11
|
+
description: LocationDescription<number, number, number, any>;
|
|
9
12
|
canDrop?: boolean | undefined;
|
|
10
13
|
} & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -33,23 +33,18 @@ var react_2 = require("react");
|
|
|
33
33
|
var css_1 = require("../../../css");
|
|
34
34
|
var hooks_1 = require("../../../hooks");
|
|
35
35
|
exports.LocationDisplay = (0, react_2.forwardRef)(function (_a, ref) {
|
|
36
|
-
var location = _a.location, _b = _a.canDrop, canDrop = _b === void 0 ? false : _b, props = __rest(_a, ["location", "canDrop"]);
|
|
36
|
+
var location = _a.location, description = _a.description, _b = _a.canDrop, canDrop = _b === void 0 ? false : _b, props = __rest(_a, ["location", "description", "canDrop"]);
|
|
37
37
|
var context = (0, hooks_1.useMaterialContext)();
|
|
38
38
|
var locator = context.locators[location.type];
|
|
39
|
-
var description = locator === null || locator === void 0 ? void 0 : locator.getLocationDescription(context);
|
|
40
39
|
var locationContext = (0, react_2.useMemo)(function () { return (__assign(__assign({}, context), { canDrop: canDrop })); }, [context, canDrop]);
|
|
41
|
-
|
|
42
|
-
console.warn('You must provide a LocationDescription to create drop locations with an ItemLocator');
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
var _c = description.getSize(location, context), width = _c.width, height = _c.height;
|
|
40
|
+
var _c = description.getLocationSize(location, context), width = _c.width, height = _c.height;
|
|
46
41
|
var image = description.getImage(location, context);
|
|
47
|
-
var borderRadius = description.getBorderRadius(location
|
|
42
|
+
var borderRadius = description.getBorderRadius(location.id);
|
|
48
43
|
var positionOnParent = (0, react_2.useMemo)(function () { return (locator === null || locator === void 0 ? void 0 : locator.parentItemType) !== undefined ? locator.getPositionOnParent(location, context) : undefined; }, [location, context, location]);
|
|
49
44
|
return ((0, jsx_runtime_1.jsx)("div", __assign({ ref: ref, css: [
|
|
50
45
|
absolute,
|
|
51
46
|
positionOnParent && positionOnParentCss(positionOnParent),
|
|
52
|
-
css_1.transformCss.apply(void 0, description.
|
|
47
|
+
css_1.transformCss.apply(void 0, description.getLocationTransform(location, locationContext)),
|
|
53
48
|
(0, css_1.sizeCss)(width, height), image && (0, css_1.backgroundCss)(image), borderRadius && (0, css_1.borderRadiusCss)(borderRadius),
|
|
54
49
|
description.getExtraCss(location, locationContext)
|
|
55
50
|
] }, props, { children: description.content && (0, jsx_runtime_1.jsx)(description.content, { location: location }) })));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocationDisplay.js","sourceRoot":"","sources":["../../../../src/components/material/locations/LocationDisplay.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,wCAAoC;AAEpC,+BAA2D;AAC3D,oCAAoF;AACpF,wCAAmD;
|
|
1
|
+
{"version":3,"file":"LocationDisplay.js","sourceRoot":"","sources":["../../../../src/components/material/locations/LocationDisplay.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,wCAAoC;AAEpC,+BAA2D;AAC3D,oCAAoF;AACpF,wCAAmD;AAStC,QAAA,eAAe,GAAG,IAAA,kBAAU,EAAuC,UAC9E,EAAoD,EAAE,GAAG;IAAvD,IAAA,QAAQ,cAAA,EAAE,WAAW,iBAAA,EAAE,eAAe,EAAf,OAAO,mBAAG,KAAK,KAAA,EAAK,KAAK,cAAlD,sCAAoD,CAAF;IAElD,IAAM,OAAO,GAAG,IAAA,0BAAkB,GAAE,CAAA;IACpC,IAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;IAC/C,IAAM,eAAe,GAAG,IAAA,eAAO,EAAC,cAAM,OAAA,uBAAM,OAAO,KAAE,OAAO,SAAA,IAAG,EAAzB,CAAyB,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAA;IAE9E,IAAA,KAAoB,WAAW,CAAC,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAhE,KAAK,WAAA,EAAE,MAAM,YAAmD,CAAA;IACxE,IAAM,KAAK,GAAG,WAAW,CAAC,QAAQ,CAAC,QAAQ,EAA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
|
|
|
1
1
|
import { Location } from '@gamepark/rules-api';
|
|
2
2
|
export type LocationsMaskProps = {
|
|
3
3
|
locations: Location[];
|
|
4
|
+
borderRadius: number;
|
|
4
5
|
};
|
|
5
|
-
export declare const LocationsMask: ({ locations }: LocationsMaskProps) => JSX.Element;
|
|
6
|
+
export declare const LocationsMask: ({ borderRadius, locations }: LocationsMaskProps) => JSX.Element;
|
|
@@ -20,9 +20,9 @@ var uniqueId_1 = __importDefault(require("lodash/uniqueId"));
|
|
|
20
20
|
var react_1 = require("react");
|
|
21
21
|
var hooks_1 = require("../../../hooks");
|
|
22
22
|
var LocationsMask = function (_a) {
|
|
23
|
-
var locations = _a.locations;
|
|
23
|
+
var borderRadius = _a.borderRadius, locations = _a.locations;
|
|
24
24
|
var id = (0, react_1.useMemo)(function () { return (0, uniqueId_1.default)('mask'); }, []);
|
|
25
|
-
return ((0, jsx_runtime_1.jsxs)("svg", __assign({ width: "100%", height: "100%", style: { position: 'absolute' } }, { children: [(0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsxs)("mask", __assign({ id: id }, { children: [(0, jsx_runtime_1.jsx)("rect", { width: "100%", height: "100%", fill: "white" }), locations.map(function (location) { return (0, jsx_runtime_1.jsx)(LocationRect, { location: location }, JSON.stringify(location)); })] })) }), (0, jsx_runtime_1.jsx)("rect", { width: "100%", height: "100%", fill: "black", fillOpacity: 0.5, mask: "url(#".concat(id, ")") })] })));
|
|
25
|
+
return ((0, jsx_runtime_1.jsxs)("svg", __assign({ width: "100%", height: "100%", style: { position: 'absolute', borderRadius: borderRadius + 'em' } }, { children: [(0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsxs)("mask", __assign({ id: id }, { children: [(0, jsx_runtime_1.jsx)("rect", { width: "100%", height: "100%", fill: "white" }), locations.map(function (location) { return (0, jsx_runtime_1.jsx)(LocationRect, { location: location }, JSON.stringify(location)); })] })) }), (0, jsx_runtime_1.jsx)("rect", { width: "100%", height: "100%", fill: "black", fillOpacity: 0.5, mask: "url(#".concat(id, ")") })] })));
|
|
26
26
|
};
|
|
27
27
|
exports.LocationsMask = LocationsMask;
|
|
28
28
|
var LocationRect = function (_a) {
|
|
@@ -30,11 +30,11 @@ var LocationRect = function (_a) {
|
|
|
30
30
|
var location = _a.location;
|
|
31
31
|
var locator = (0, hooks_1.useItemLocator)(location.type);
|
|
32
32
|
var context = (0, hooks_1.useMaterialContext)();
|
|
33
|
-
var description = locator.getLocationDescription(context);
|
|
33
|
+
var description = locator.getLocationDescription(location, context);
|
|
34
34
|
var position = locator.getPositionOnParent(location, context);
|
|
35
|
-
var _c = description.
|
|
36
|
-
var radius = (_b = description.getBorderRadius(location
|
|
37
|
-
var transforms = description.
|
|
35
|
+
var _c = description.getLocationSize(location, context), width = _c.width, height = _c.height;
|
|
36
|
+
var radius = (_b = description.getBorderRadius(location.id)) !== null && _b !== void 0 ? _b : 0;
|
|
37
|
+
var transforms = description.getLocationTransform(location, context);
|
|
38
38
|
return ((0, jsx_runtime_1.jsx)("rect", { fill: "black", x: "".concat(position.x, "%"), y: "".concat(position.y, "%"), width: "".concat(width, "em"), height: "".concat(height, "em"), rx: "".concat(radius, "em"), ry: "".concat(radius, "em"), style: { transformBox: 'fill-box', transformOrigin: 'center', transform: transforms.join(' ') } }));
|
|
39
39
|
};
|
|
40
40
|
//# sourceMappingURL=LocationsMask.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocationsMask.js","sourceRoot":"","sources":["../../../../src/components/material/locations/LocationsMask.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,6DAAsC;AACtC,+BAA+B;AAC/B,wCAAmE;
|
|
1
|
+
{"version":3,"file":"LocationsMask.js","sourceRoot":"","sources":["../../../../src/components/material/locations/LocationsMask.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,6DAAsC;AACtC,+BAA+B;AAC/B,wCAAmE;AAO5D,IAAM,aAAa,GAAG,UAAC,EAA+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AE,OAAO,CAAC,EAAhE,KAAK,WAAA,EAAE,MAAM,YAAmD,CAAA;IACxE,IAAM,MAAM,GAAG,MAAA,WAAW,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,CAAC,mCAAI,CAAC,CAAA;IAC5D,IAAM,UAAU,GAAa,WAAW,CAAC,oBAAoB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IAChF,OAAO,CACL,iCAAM,IAAI,EAAC,OAAO,EAAC,CAAC,EAAE,UAAG,QAAQ,CAAC,CAAC,MAAG,EAAE,CAAC,EAAE,UAAG,QAAQ,CAAC,CAAC,MAAG,EAAE,KAAK,EAAE,UAAG,KAAK,OAAI,EAAE,MAAM,EAAE,UAAG,MAAM,OAAI,EAAE,EAAE,EAAE,UAAG,MAAM,OAAI,EAAE,EAAE,EAAE,UAAG,MAAM,OAAI,EACvI,KAAK,EAAE,EAAE,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,CACzG,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { Location } from '@gamepark/rules-api';
|
|
2
2
|
import { HTMLAttributes } from 'react';
|
|
3
|
-
|
|
3
|
+
import { DropAreaDescription } from './DropAreaDescription';
|
|
4
|
+
export type SimpleDropAreaProps<P extends number = number, M extends number = number, L extends number = number> = {
|
|
4
5
|
location: Location<P, L>;
|
|
5
|
-
|
|
6
|
-
onLongClick?: () => void;
|
|
7
|
-
alwaysVisible?: boolean;
|
|
6
|
+
description: DropAreaDescription<P, M, L>;
|
|
8
7
|
} & HTMLAttributes<HTMLDivElement>;
|
|
9
8
|
export declare const SimpleDropArea: import("react").ForwardRefExoticComponent<{
|
|
10
9
|
location: Location<number, number, any, any>;
|
|
11
|
-
|
|
12
|
-
onLongClick?: (() => void) | undefined;
|
|
13
|
-
alwaysVisible?: boolean | undefined;
|
|
10
|
+
description: DropAreaDescription<number, number, number, any>;
|
|
14
11
|
} & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -30,64 +30,37 @@ exports.SimpleDropArea = void 0;
|
|
|
30
30
|
var jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
31
31
|
var core_1 = require("@dnd-kit/core");
|
|
32
32
|
var react_1 = require("@emotion/react");
|
|
33
|
-
var rules_api_1 = require("@gamepark/rules-api");
|
|
34
33
|
var react_2 = require("react");
|
|
35
34
|
var react_merge_refs_1 = require("react-merge-refs");
|
|
36
35
|
var react_redux_1 = require("react-redux");
|
|
37
|
-
var use_long_press_1 = require("use-long-press");
|
|
38
|
-
var css_1 = require("../../../css");
|
|
39
36
|
var hooks_1 = require("../../../hooks");
|
|
40
37
|
var utilities_1 = require("../../../utilities");
|
|
41
38
|
var DraggableMaterial_1 = require("../DraggableMaterial");
|
|
42
|
-
var
|
|
39
|
+
var LocationComponent_1 = require("./LocationComponent");
|
|
43
40
|
exports.SimpleDropArea = (0, react_2.forwardRef)(function (_a, ref) {
|
|
44
|
-
var
|
|
45
|
-
var location = _a.location, shortClick = _a.onShortClick, longClick = _a.onLongClick, alwaysVisible = _a.alwaysVisible, props = __rest(_a, ["location", "onShortClick", "onLongClick", "alwaysVisible"]);
|
|
41
|
+
var location = _a.location, description = _a.description, props = __rest(_a, ["location", "description"]);
|
|
46
42
|
var context = (0, hooks_1.useMaterialContext)();
|
|
47
43
|
var material = context.material;
|
|
48
|
-
var locator = context.locators[location.type];
|
|
49
|
-
var description = locator === null || locator === void 0 ? void 0 : locator.getLocationDescription(context);
|
|
50
|
-
var rules = context.rules;
|
|
51
44
|
var play = (0, hooks_1.usePlay)();
|
|
52
45
|
var legalMoves = (0, hooks_1.useLegalMoves)();
|
|
53
46
|
var dropMoves = (0, react_2.useMemo)(function () { return legalMoves.filter(function (move) { return description === null || description === void 0 ? void 0 : description.isMoveToLocation(move, location, context); }); }, [legalMoves, context]);
|
|
54
|
-
var
|
|
55
|
-
var
|
|
56
|
-
if (rules && (((_a = locator === null || locator === void 0 ? void 0 : locator.locationDescription) === null || _a === void 0 ? void 0 : _a.help) || (locator === null || locator === void 0 ? void 0 : locator.parentItemType) !== undefined)) {
|
|
57
|
-
if ((_b = locator === null || locator === void 0 ? void 0 : locator.locationDescription) === null || _b === void 0 ? void 0 : _b.help) {
|
|
58
|
-
return play((0, rules_api_1.displayLocationHelp)(location), { local: true });
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
var itemType = locator.parentItemType;
|
|
62
|
-
var item = rules.material(itemType).getItem(location.parent);
|
|
63
|
-
return play(material[itemType].displayHelp(item, __assign(__assign({}, context), { type: itemType, index: location.parent, displayIndex: 0 })), { local: true });
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}, [locator]);
|
|
67
|
-
var onShortClick = (0, react_2.useCallback)(function () {
|
|
68
|
-
var move = description ? (0, utilities_1.findIfUnique)(legalMoves, function (move) { return description.canShortClick(move, location, context); }) : undefined;
|
|
47
|
+
var onShortClick = (0, react_2.useMemo)(function () {
|
|
48
|
+
var move = (0, utilities_1.findIfUnique)(legalMoves, function (move) { return description.canShortClick(move, location, context); });
|
|
69
49
|
if (move !== undefined)
|
|
70
|
-
return play(move);
|
|
50
|
+
return function () { return play(move); };
|
|
71
51
|
var shortClickMove = description === null || description === void 0 ? void 0 : description.getShortClickMove(location, context);
|
|
72
52
|
if (shortClickMove)
|
|
73
|
-
return play(shortClickMove);
|
|
53
|
+
return function () { return play(shortClickMove); };
|
|
74
54
|
var shortClickLocalMove = description === null || description === void 0 ? void 0 : description.getShortClickLocalMove(location, context);
|
|
75
55
|
if (shortClickLocalMove)
|
|
76
|
-
return play(shortClickLocalMove, { local: true });
|
|
77
|
-
return openRules();
|
|
56
|
+
return function () { return play(shortClickLocalMove, { local: true }); };
|
|
78
57
|
}, [legalMoves, context]);
|
|
79
|
-
var onLongClick = (0, react_2.
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
var move = description ? (0, utilities_1.findIfUnique)(legalMoves, function (move) { return description.canLongClick(move, location, context); }) : undefined;
|
|
86
|
-
if (move !== undefined)
|
|
87
|
-
play(move);
|
|
88
|
-
else
|
|
89
|
-
openRules();
|
|
90
|
-
}
|
|
58
|
+
var onLongClick = (0, react_2.useMemo)(function () {
|
|
59
|
+
if (onShortClick)
|
|
60
|
+
return;
|
|
61
|
+
var move = (0, utilities_1.findIfUnique)(legalMoves, function (move) { return description.canLongClick(move, location, context); });
|
|
62
|
+
if (move !== undefined)
|
|
63
|
+
return function () { return play(move); };
|
|
91
64
|
}, [legalMoves, context]);
|
|
92
65
|
var canClickToMove = (0, react_2.useMemo)(function () {
|
|
93
66
|
var short = 0, long = 0;
|
|
@@ -102,64 +75,21 @@ exports.SimpleDropArea = (0, react_2.forwardRef)(function (_a, ref) {
|
|
|
102
75
|
}
|
|
103
76
|
return short === 1 || long === 1;
|
|
104
77
|
}, [legalMoves, context]);
|
|
105
|
-
var
|
|
78
|
+
var _b = (0, core_1.useDroppable)({
|
|
106
79
|
id: JSON.stringify(location),
|
|
107
80
|
disabled: !dropMoves.length,
|
|
108
81
|
data: location
|
|
109
|
-
}), isOver =
|
|
82
|
+
}), isOver = _b.isOver, active = _b.active, setNodeRef = _b.setNodeRef;
|
|
110
83
|
var draggedItem = (0, DraggableMaterial_1.dataIsDisplayedItem)(active === null || active === void 0 ? void 0 : active.data.current) ? active === null || active === void 0 ? void 0 : active.data.current : undefined;
|
|
111
84
|
var draggedItemContext = (0, react_2.useMemo)(function () { return draggedItem ? __assign(__assign({}, context), draggedItem) : undefined; }, [draggedItem, context]);
|
|
112
85
|
var canDrop = (0, react_2.useMemo)(function () { return !!draggedItemContext && !!description && !!material && dropMoves.some(function (move) { var _a; return ((_a = material[draggedItemContext.type]) === null || _a === void 0 ? void 0 : _a.canDrag(move, draggedItemContext)) && description.canDrop(move, location, draggedItemContext); }); }, [draggedItemContext, dropMoves]);
|
|
113
86
|
var isAnimatingPlayerAction = (0, react_redux_1.useSelector)(function (state) { var _a; return (_a = state.actions) === null || _a === void 0 ? void 0 : _a.some(function (action) { return action.playerId === state.playerId && action.animation !== undefined; }); });
|
|
114
|
-
|
|
115
|
-
var listeners = (0, use_long_press_1.useLongPress)(function () {
|
|
116
|
-
if (onLongClick)
|
|
117
|
-
onLongClick();
|
|
118
|
-
else if (onShortClick)
|
|
119
|
-
onShortClick();
|
|
120
|
-
}, {
|
|
121
|
-
detect: use_long_press_1.LongPressEventType.Pointer,
|
|
122
|
-
cancelOnMovement: 5,
|
|
123
|
-
threshold: 600,
|
|
124
|
-
onStart: function (event) {
|
|
125
|
-
setClicking(true);
|
|
126
|
-
event.stopPropagation();
|
|
127
|
-
},
|
|
128
|
-
onFinish: function () { return setClicking(false); },
|
|
129
|
-
onCancel: function (_, _a) {
|
|
130
|
-
var reason = _a.reason;
|
|
131
|
-
setClicking(false);
|
|
132
|
-
if (onShortClick && reason === use_long_press_1.LongPressCallbackReason.CancelledByRelease) {
|
|
133
|
-
setTimeout(function () { return onShortClick && onShortClick(); });
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
filterEvents: function (event) { return !event.button; }
|
|
137
|
-
})();
|
|
138
|
-
if (!description) {
|
|
139
|
-
console.warn('You must provide a LocationDescription to create drop locations with an ItemLocator');
|
|
140
|
-
return null;
|
|
141
|
-
}
|
|
142
|
-
if (!alwaysVisible && !description.isAlwaysVisible(location, context) && !canDrop)
|
|
143
|
-
return null;
|
|
144
|
-
var highlight = (_b = description.highlight) === null || _b === void 0 ? void 0 : _b.call(description, location, context);
|
|
145
|
-
return ((0, jsx_runtime_1.jsx)(LocationDisplay_1.LocationDisplay, __assign({ ref: (0, react_merge_refs_1.mergeRefs)([ref, setNodeRef]), location: location, canDrop: canDrop, css: [
|
|
146
|
-
(onShortClick || onLongClick) && css_1.pointerCursorCss,
|
|
147
|
-
!draggedItem && (onShortClick || onLongClick) && hoverHighlight, clicking && clickingAnimation,
|
|
148
|
-
(highlight || (canDrop && !isOver) || (!draggedItem && canClickToMove && !isAnimatingPlayerAction)) && css_1.shineEffect,
|
|
149
|
-
canDrop && isOver && dropHighlight
|
|
150
|
-
] }, props, (0, utilities_1.combineEventListeners)(listeners, props))));
|
|
87
|
+
return ((0, jsx_runtime_1.jsx)(LocationComponent_1.LocationComponent, __assign({ ref: (0, react_merge_refs_1.mergeRefs)([ref, setNodeRef]), location: location, description: description, canDrop: canDrop, onShortClick: onShortClick, onLongClick: onLongClick, highlight: (canDrop && !isOver) || (!draggedItem && canClickToMove && !isAnimatingPlayerAction), css: canDrop && isOver && dropHighlight }, props)));
|
|
151
88
|
});
|
|
152
89
|
exports.SimpleDropArea.displayName = 'SimpleDropArea';
|
|
153
|
-
var hoverHighlight = (0, react_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n &:hover {\n background-color: rgba(255, 255, 255, 0.2);\n }\n"], ["\n &:hover {\n background-color: rgba(255, 255, 255, 0.2);\n }\n"])));
|
|
154
|
-
var clickingKeyframes = function (theme) {
|
|
155
|
-
var _a;
|
|
156
|
-
return (0, react_1.keyframes)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n from {\n background-color: rgba(255, 255, 255, 0.2);\n }\n to {\n background-color: ", ";\n }\n"], ["\n from {\n background-color: rgba(255, 255, 255, 0.2);\n }\n to {\n background-color: ", ";\n }\n"])), (_a = theme.dropArea) === null || _a === void 0 ? void 0 : _a.backgroundColor);
|
|
157
|
-
};
|
|
158
|
-
var longClickThreshold = 600;
|
|
159
|
-
var clickingAnimation = function (theme) { return (0, react_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n animation: ", " ", "ms ease-in-out;\n"], ["\n animation: ", " ", "ms ease-in-out;\n"])), clickingKeyframes(theme), longClickThreshold); };
|
|
160
90
|
var dropHighlight = function (theme) {
|
|
161
91
|
var _a;
|
|
162
|
-
return (0, react_1.css)(
|
|
92
|
+
return (0, react_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background-color: ", ";\n"], ["\n background-color: ", ";\n"])), (_a = theme.dropArea) === null || _a === void 0 ? void 0 : _a.backgroundColor);
|
|
163
93
|
};
|
|
164
|
-
var templateObject_1
|
|
94
|
+
var templateObject_1;
|
|
165
95
|
//# sourceMappingURL=SimpleDropArea.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SimpleDropArea.js","sourceRoot":"","sources":["../../../../src/components/material/locations/SimpleDropArea.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,sCAA4C;AAC5C,
|
|
1
|
+
{"version":3,"file":"SimpleDropArea.js","sourceRoot":"","sources":["../../../../src/components/material/locations/SimpleDropArea.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,sCAA4C;AAC5C,wCAA2C;AAG3C,+BAA2D;AAC3D,qDAA4C;AAC5C,2CAAyC;AACzC,wCAA2E;AAC3E,gDAAiD;AACjD,0DAA0D;AAE1D,yDAAuD;AAO1C,QAAA,cAAc,GAAG,IAAA,kBAAU,EAAsC,UAC5E,EAAmC,EAAE,GAAG;IAAtC,IAAA,QAAQ,cAAA,EAAE,WAAW,iBAAA,EAAK,KAAK,cAAjC,2BAAmC,CAAF;IAEjC,IAAM,OAAO,GAAG,IAAA,0BAAkB,GAAE,CAAA;IACpC,IAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;IACjC,IAAM,IAAI,GAAG,IAAA,eAAO,GAAgB,CAAA;IACpC,IAAM,UAAU,GAAG,IAAA,qBAAa,GAAE,CAAA;IAClC,IAAM,SAAS,GAAG,IAAA,eAAO,EAAC,cAAM,OAAA,UAAU,CAAC,MAAM,CAAC,UAAA,IAAI,IAAI,OAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,gBAAgB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAtD,CA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F,sBAAc,CAAC,WAAW,GAAG,gBAAgB,CAAA;AAE7C,IAAM,aAAa,GAAG,UAAC,KAAY;;IAAK,WAAA,WAAG,mGAAA,wBACrB,EAA+B,KACpD,KADqB,MAAA,KAAK,CAAC,QAAQ,0CAAE,eAAe,EACpD;CAAA,CAAA"}
|
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./DropAreaDescription"), exports);
|
|
17
18
|
__exportStar(require("./LocationDescription"), exports);
|
|
18
19
|
__exportStar(require("./LocationsMask"), exports);
|
|
19
20
|
__exportStar(require("./SimpleDropArea"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/material/locations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAqC;AACrC,kDAA+B;AAC/B,mDAAgC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/material/locations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAqC;AACrC,wDAAqC;AACrC,kDAA+B;AAC/B,mDAAgC"}
|
|
@@ -1,4 +1,15 @@
|
|
|
1
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
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.isDroppedItem = void 0;
|
|
4
15
|
var isPlacedOnItem_1 = require("./isPlacedOnItem");
|
|
@@ -9,7 +20,7 @@ var isDroppedItem = function (context) {
|
|
|
9
20
|
return false;
|
|
10
21
|
if (droppedItem.type === type && droppedItem.index === index && droppedItem.displayIndex === displayIndex)
|
|
11
22
|
return true;
|
|
12
|
-
return (0, isPlacedOnItem_1.isPlacedOnItem)(rules.material(type).getItem(index),
|
|
23
|
+
return (0, isPlacedOnItem_1.isPlacedOnItem)(rules.material(type).getItem(index), __assign(__assign({}, context), droppedItem));
|
|
13
24
|
};
|
|
14
25
|
exports.isDroppedItem = isDroppedItem;
|
|
15
26
|
//# sourceMappingURL=isDroppedItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isDroppedItem.js","sourceRoot":"","sources":["../../../../src/components/material/utils/isDroppedItem.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"isDroppedItem.js","sourceRoot":"","sources":["../../../../src/components/material/utils/isDroppedItem.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,mDAAiD;AAE1C,IAAM,aAAa,GAAG,UAC3B,OAA6B;IAErB,IAAA,IAAI,GAAiC,OAAO,KAAxC,EAAE,KAAK,GAA0B,OAAO,MAAjC,EAAE,YAAY,GAAY,OAAO,aAAnB,EAAE,KAAK,GAAK,OAAO,MAAZ,CAAY;IACpD,IAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAA;IAC1C,IAAI,CAAC,WAAW;QAAE,OAAO,KAAK,CAAA;IAC9B,IAAI,WAAW,CAAC,IAAI,KAAK,IAAI,IAAI,WAAW,CAAC,KAAK,KAAK,KAAK,IAAI,WAAW,CAAC,YAAY,KAAK,YAAY;QAAE,OAAO,IAAI,CAAA;IACtH,OAAO,IAAA,+BAAc,EAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,CAAE,wBAAO,OAAO,GAAK,WAAW,EAAG,CAAA;AAC7F,CAAC,CAAA;AARY,QAAA,aAAa,iBAQzB"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export declare const isPlacedOnItem: <P extends number = number, M extends number = number, L extends number = number>(childItem: MaterialItem<P, L, any>,
|
|
1
|
+
import { MaterialItem } from '@gamepark/rules-api';
|
|
2
|
+
import { ItemContext } from '../../../locators';
|
|
3
|
+
export declare const isPlacedOnItem: <P extends number = number, M extends number = number, L extends number = number>(childItem: MaterialItem<P, L, any>, itemContext: Omit<ItemContext<P, M, L>, "displayIndex">) => boolean;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isPlacedOnItem = void 0;
|
|
4
|
-
var isPlacedOnItem = function (childItem,
|
|
4
|
+
var isPlacedOnItem = function (childItem, itemContext) {
|
|
5
5
|
if (childItem.location.parent === undefined)
|
|
6
6
|
return false;
|
|
7
|
-
var locator =
|
|
8
|
-
if ((locator === null || locator === void 0 ? void 0 : locator.parentItemType) ===
|
|
7
|
+
var locator = itemContext.locators[childItem.location.type];
|
|
8
|
+
if ((locator === null || locator === void 0 ? void 0 : locator.parentItemType) === itemContext.type && childItem.location.parent === itemContext.index)
|
|
9
9
|
return true;
|
|
10
|
-
var parentItem =
|
|
11
|
-
return parentItem !== undefined && (0, exports.isPlacedOnItem)(parentItem,
|
|
10
|
+
var parentItem = itemContext.rules.material(locator.parentItemType).getItem(childItem.location.parent);
|
|
11
|
+
return parentItem !== undefined && (0, exports.isPlacedOnItem)(parentItem, itemContext);
|
|
12
12
|
};
|
|
13
13
|
exports.isPlacedOnItem = isPlacedOnItem;
|
|
14
14
|
//# sourceMappingURL=isPlacedOnItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isPlacedOnItem.js","sourceRoot":"","sources":["../../../../src/components/material/utils/isPlacedOnItem.ts"],"names":[],"mappings":";;;AAGO,IAAM,cAAc,GAAG,UAC5B,SAA6B,EAAE,
|
|
1
|
+
{"version":3,"file":"isPlacedOnItem.js","sourceRoot":"","sources":["../../../../src/components/material/utils/isPlacedOnItem.ts"],"names":[],"mappings":";;;AAGO,IAAM,cAAc,GAAG,UAC5B,SAA6B,EAAE,WAAuD;IAEtF,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,KAAK,SAAS;QAAE,OAAO,KAAK,CAAA;IACzD,IAAM,OAAO,GAAG,WAAW,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;IAC7D,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,cAAc,MAAK,WAAW,CAAC,IAAI,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,KAAK,WAAW,CAAC,KAAK;QAAE,OAAO,IAAI,CAAA;IAChH,IAAM,UAAU,GAAG,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAQ,CAAC,cAAe,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IAC1G,OAAO,UAAU,KAAK,SAAS,IAAI,IAAA,sBAAc,EAAC,UAAU,EAAE,WAAW,CAAC,CAAA;AAC5E,CAAC,CAAA;AARY,QAAA,cAAc,kBAQ1B"}
|
|
@@ -13,13 +13,13 @@ var MaterialTutorial = (function () {
|
|
|
13
13
|
return new rules_api_1.LocationBuilder({ type: type });
|
|
14
14
|
};
|
|
15
15
|
MaterialTutorial.prototype.setupTutorial = function () {
|
|
16
|
-
var
|
|
17
|
-
game
|
|
16
|
+
var tutorial = { step: 0, stepComplete: false, popupClosed: false };
|
|
17
|
+
var game = this.setup.setup(this.options, tutorial);
|
|
18
18
|
return [game, this.players];
|
|
19
19
|
};
|
|
20
20
|
MaterialTutorial.prototype.getNextMove = function (rules) {
|
|
21
|
-
if (rules.game.
|
|
22
|
-
var step = this.steps[rules.game.
|
|
21
|
+
if (rules.game.tutorial && rules.game.tutorial.step < this.steps.length) {
|
|
22
|
+
var step = this.steps[rules.game.tutorial.step];
|
|
23
23
|
if (!step.move || step.move.player === undefined || step.move.player === rules.game.players[0])
|
|
24
24
|
return;
|
|
25
25
|
var moves = rules.getLegalMoves(step.move.player);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MaterialTutorial.js","sourceRoot":"","sources":["../../../src/components/tutorial/MaterialTutorial.ts"],"names":[],"mappings":";;;AACA,iDAS4B;AAK5B;IAAA;IA8BA,CAAC;IAvBC,mCAAQ,GAAR,UAAS,IAA2B,EAAE,IAAO;;QAC3C,OAAO,IAAI,oBAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,CAAC,IAAI,CAAC,mCAAI,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,UAAA,KAAK,IAAI,OAAA,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,KAAK,CAAC,EAAvB,CAAuB,CAAC,CAAC,CAAA;IACrH,CAAC;IAED,mCAAQ,GAAR,UAAS,IAAO;QACd,OAAO,IAAI,2BAAe,CAAC,EAAE,IAAI,MAAA,EAAE,CAAC,CAAA;IACtC,CAAC;IAED,wCAAa,GAAb;QACE,IAAM,
|
|
1
|
+
{"version":3,"file":"MaterialTutorial.js","sourceRoot":"","sources":["../../../src/components/tutorial/MaterialTutorial.ts"],"names":[],"mappings":";;;AACA,iDAS4B;AAK5B;IAAA;IA8BA,CAAC;IAvBC,mCAAQ,GAAR,UAAS,IAA2B,EAAE,IAAO;;QAC3C,OAAO,IAAI,oBAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,CAAC,IAAI,CAAC,mC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