@gamepark/react-game 6.15.5 → 6.17.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.d.ts +3 -3
- package/dist/components/Avatar/Avatar.js +13 -8
- package/dist/components/Avatar/Avatar.js.map +1 -1
- package/dist/components/GameProvider/GameContext.d.ts +2 -0
- package/dist/components/GameProvider/GameContext.js.map +1 -1
- package/dist/components/GameProvider/GameProvider.js +6 -4
- package/dist/components/GameProvider/GameProvider.js.map +1 -1
- package/dist/components/JournalTabs/Chat/Chat.d.ts +7 -0
- package/dist/components/JournalTabs/Chat/Chat.js +37 -0
- package/dist/components/JournalTabs/Chat/Chat.js.map +1 -0
- package/dist/components/JournalTabs/Chat/ChatMessage.d.ts +7 -0
- package/dist/components/JournalTabs/Chat/ChatMessage.js +29 -0
- package/dist/components/JournalTabs/Chat/ChatMessage.js.map +1 -0
- package/dist/components/JournalTabs/Chat/ChatMessageAuthor.d.ts +3 -0
- package/dist/components/JournalTabs/Chat/ChatMessageAuthor.js +37 -0
- package/dist/components/JournalTabs/Chat/ChatMessageAuthor.js.map +1 -0
- package/dist/components/JournalTabs/Chat/ChatTextInput.d.ts +19 -0
- package/dist/components/JournalTabs/Chat/ChatTextInput.js +71 -0
- package/dist/components/JournalTabs/Chat/ChatTextInput.js.map +1 -0
- package/dist/components/JournalTabs/Chat/CommonChat.d.ts +12 -0
- package/dist/components/JournalTabs/Chat/CommonChat.js +58 -0
- package/dist/components/JournalTabs/Chat/CommonChat.js.map +1 -0
- package/dist/components/JournalTabs/Chat/LocalChat.d.ts +6 -0
- package/dist/components/JournalTabs/Chat/LocalChat.js +49 -0
- package/dist/components/JournalTabs/Chat/LocalChat.js.map +1 -0
- package/dist/components/JournalTabs/Chat/RemoteChat.d.ts +7 -0
- package/dist/components/JournalTabs/Chat/RemoteChat.js +46 -0
- package/dist/components/JournalTabs/Chat/RemoteChat.js.map +1 -0
- package/dist/components/JournalTabs/Chat/SignInToChat.d.ts +1 -0
- package/dist/components/JournalTabs/Chat/SignInToChat.js +35 -0
- package/dist/components/JournalTabs/Chat/SignInToChat.js.map +1 -0
- package/dist/components/JournalTabs/Chat/index.d.ts +5 -0
- package/dist/components/JournalTabs/Chat/index.js +22 -0
- package/dist/components/JournalTabs/Chat/index.js.map +1 -0
- package/dist/components/JournalTabs/History/ActionHistoryEntry.d.ts +11 -0
- package/dist/components/JournalTabs/History/ActionHistoryEntry.js +41 -0
- package/dist/components/JournalTabs/History/ActionHistoryEntry.js.map +1 -0
- package/dist/components/JournalTabs/History/History.d.ts +6 -0
- package/dist/components/JournalTabs/History/History.js +54 -0
- package/dist/components/JournalTabs/History/History.js.map +1 -0
- package/dist/components/JournalTabs/History/HistoryEntry.d.ts +7 -0
- package/dist/components/JournalTabs/History/HistoryEntry.js +40 -0
- package/dist/components/JournalTabs/History/HistoryEntry.js.map +1 -0
- package/dist/components/JournalTabs/History/MaterialHistory.d.ts +11 -0
- package/dist/components/JournalTabs/History/MaterialHistory.js +3 -0
- package/dist/components/JournalTabs/History/MaterialHistory.js.map +1 -0
- package/dist/components/JournalTabs/History/PlayerActionHistory.d.ts +8 -0
- package/dist/components/JournalTabs/History/PlayerActionHistory.js +42 -0
- package/dist/components/JournalTabs/History/PlayerActionHistory.js.map +1 -0
- package/dist/components/JournalTabs/History/PlayerHistoryEntry.d.ts +9 -0
- package/dist/components/JournalTabs/History/PlayerHistoryEntry.js +44 -0
- package/dist/components/JournalTabs/History/PlayerHistoryEntry.js.map +1 -0
- package/dist/components/JournalTabs/History/StartHistory.d.ts +2 -0
- package/dist/components/JournalTabs/History/StartHistory.js +30 -0
- package/dist/components/JournalTabs/History/StartHistory.js.map +1 -0
- package/dist/components/JournalTabs/History/index.d.ts +5 -0
- package/dist/components/JournalTabs/History/index.js +22 -0
- package/dist/components/JournalTabs/History/index.js.map +1 -0
- package/dist/components/JournalTabs/JournalTabs.d.ts +5 -0
- package/dist/components/JournalTabs/JournalTabs.js +74 -0
- package/dist/components/JournalTabs/JournalTabs.js.map +1 -0
- package/dist/components/JournalTabs/index.d.ts +1 -0
- package/dist/components/JournalTabs/index.js +18 -0
- package/dist/components/JournalTabs/index.js.map +1 -0
- package/dist/components/LoadingScreen/LoadingScreen.js +1 -1
- package/dist/components/LoadingScreen/LoadingScreen.js.map +1 -1
- package/dist/components/Picture/Picture.js +1 -0
- package/dist/components/Picture/Picture.js.map +1 -1
- package/dist/components/PlayerPanel/PlayerPanel.d.ts +4 -3
- package/dist/components/PlayerPanel/PlayerPanel.js +16 -10
- package/dist/components/PlayerPanel/PlayerPanel.js.map +1 -1
- package/dist/components/buttons/PlayMoveButton/PlayMoveButton.js +21 -23
- package/dist/components/buttons/PlayMoveButton/PlayMoveButton.js.map +1 -1
- package/dist/components/dialogs/Dialog.js +1 -1
- package/dist/components/dialogs/Dialog.js.map +1 -1
- package/dist/components/dialogs/FailuresDialog.js +3 -3
- package/dist/components/dialogs/FailuresDialog.js.map +1 -1
- package/dist/components/dialogs/ResultDialog/ResultDialog.js +21 -46
- package/dist/components/dialogs/ResultDialog/ResultDialog.js.map +1 -1
- package/dist/components/dialogs/RulesDialog/MaterialRulesDialogContent.js +9 -4
- package/dist/components/dialogs/RulesDialog/MaterialRulesDialogContent.js.map +1 -1
- package/dist/components/dialogs/RulesDialog/RulesDialog.d.ts +1 -1
- package/dist/components/dialogs/RulesDialog/RulesDialog.js +1 -1
- package/dist/components/dialogs/RulesDialog/RulesDialog.js.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/material/Dices/CubicDiceDescription.d.ts +5 -4
- package/dist/components/material/Dices/CubicDiceDescription.js +5 -5
- package/dist/components/material/Dices/CubicDiceDescription.js.map +1 -1
- package/dist/components/material/DraggableMaterial.d.ts +2 -0
- package/dist/components/material/DraggableMaterial.js +71 -36
- package/dist/components/material/DraggableMaterial.js.map +1 -1
- package/dist/components/material/FlatMaterial/FlatMaterial.d.ts +10 -10
- package/dist/components/material/FlatMaterial/FlatMaterial.js +19 -19
- package/dist/components/material/FlatMaterial/FlatMaterial.js.map +1 -1
- package/dist/components/material/GameTable/DraggableStockItem.d.ts +4 -0
- package/dist/components/material/GameTable/DraggableStockItem.js +82 -0
- package/dist/components/material/GameTable/DraggableStockItem.js.map +1 -0
- package/dist/components/material/GameTable/DynamicItemsDisplay.d.ts +4 -0
- package/dist/components/material/GameTable/DynamicItemsDisplay.js +72 -0
- package/dist/components/material/GameTable/DynamicItemsDisplay.js.map +1 -0
- package/dist/components/material/GameTable/FocusableElement.d.ts +13 -0
- package/dist/components/material/GameTable/FocusableElement.js +63 -0
- package/dist/components/material/GameTable/FocusableElement.js.map +1 -0
- package/dist/components/material/GameTable/FocusableLocation.d.ts +8 -0
- package/dist/components/material/GameTable/FocusableLocation.js +37 -0
- package/dist/components/material/GameTable/FocusableLocation.js.map +1 -0
- package/dist/components/material/GameTable/FocusableLocations.d.ts +0 -0
- package/dist/components/material/GameTable/FocusableLocations.js +2 -0
- package/dist/components/material/GameTable/FocusableLocations.js.map +1 -0
- package/dist/components/material/GameTable/GameMaterialDisplay.d.ts +6 -1
- package/dist/components/material/GameTable/GameMaterialDisplay.js +16 -133
- package/dist/components/material/GameTable/GameMaterialDisplay.js.map +1 -1
- package/dist/components/material/GameTable/GameTable.d.ts +1 -0
- package/dist/components/material/GameTable/GameTable.js +6 -4
- package/dist/components/material/GameTable/GameTable.js.map +1 -1
- package/dist/components/material/GameTable/GameTableNavigation.d.ts +6 -0
- package/dist/components/material/GameTable/GameTableNavigation.js +56 -0
- package/dist/components/material/GameTable/GameTableNavigation.js.map +1 -0
- package/dist/components/material/GameTable/ItemDisplay.d.ts +15 -0
- package/dist/components/material/GameTable/ItemDisplay.js +51 -0
- package/dist/components/material/GameTable/ItemDisplay.js.map +1 -0
- package/dist/components/material/GameTable/StaticItemsDisplay.d.ts +4 -0
- package/dist/components/material/GameTable/StaticItemsDisplay.js +67 -0
- package/dist/components/material/GameTable/StaticItemsDisplay.js.map +1 -0
- package/dist/components/material/GameTable/StaticLocationsDisplay.d.ts +4 -0
- package/dist/components/material/GameTable/StaticLocationsDisplay.js +35 -0
- package/dist/components/material/GameTable/StaticLocationsDisplay.js.map +1 -0
- package/dist/components/material/GameTable/focus/FocusProvider.d.ts +10 -0
- package/dist/components/material/GameTable/focus/FocusProvider.js +70 -0
- package/dist/components/material/GameTable/focus/FocusProvider.js.map +1 -0
- package/dist/components/material/GameTable/focus/FocusableElement.d.ts +13 -0
- package/dist/components/material/GameTable/focus/FocusableElement.js +63 -0
- package/dist/components/material/GameTable/focus/FocusableElement.js.map +1 -0
- package/dist/components/material/GameTable/focus/FocusableLocation.d.ts +8 -0
- package/dist/components/material/GameTable/focus/FocusableLocation.js +38 -0
- package/dist/components/material/GameTable/focus/FocusableLocation.js.map +1 -0
- package/dist/components/material/GameTable/focus/LocationsWithFocus.d.ts +8 -0
- package/dist/components/material/GameTable/focus/LocationsWithFocus.js +30 -0
- package/dist/components/material/GameTable/focus/LocationsWithFocus.js.map +1 -0
- package/dist/components/material/GameTable/focus/MaterialFocus.d.ts +18 -0
- package/dist/components/material/GameTable/focus/MaterialFocus.js +3 -0
- package/dist/components/material/GameTable/focus/MaterialFocus.js.map +1 -0
- package/dist/components/material/GameTable/focus/index.d.ts +3 -0
- package/dist/components/material/GameTable/focus/index.js +20 -0
- package/dist/components/material/GameTable/focus/index.js.map +1 -0
- package/dist/components/material/GameTable/index.d.ts +2 -0
- package/dist/components/material/GameTable/index.js +2 -0
- package/dist/components/material/GameTable/index.js.map +1 -1
- package/dist/components/material/GameTable/locations.utils.d.ts +0 -0
- package/dist/components/material/GameTable/locations.utils.js +2 -0
- package/dist/components/material/GameTable/locations.utils.js.map +1 -0
- package/dist/components/material/MaterialComponent.d.ts +2 -2
- package/dist/components/material/MaterialComponent.js +8 -8
- package/dist/components/material/MaterialComponent.js.map +1 -1
- package/dist/components/material/MaterialDescription.d.ts +10 -9
- package/dist/components/material/MaterialDescription.js +11 -37
- package/dist/components/material/MaterialDescription.js.map +1 -1
- package/dist/components/material/MobileMaterialDescription.d.ts +9 -0
- package/dist/components/material/MobileMaterialDescription.js +68 -0
- package/dist/components/material/MobileMaterialDescription.js.map +1 -0
- package/dist/components/material/Writing/WritingDescription.d.ts +6 -5
- package/dist/components/material/Writing/WritingDescription.js +20 -16
- package/dist/components/material/Writing/WritingDescription.js.map +1 -1
- package/dist/components/material/animations/CreateItemAnimations.d.ts +5 -5
- package/dist/components/material/animations/CreateItemAnimations.js +4 -4
- package/dist/components/material/animations/CreateItemAnimations.js.map +1 -1
- package/dist/components/material/animations/DeleteItemAnimations.d.ts +4 -4
- package/dist/components/material/animations/DeleteItemAnimations.js +4 -4
- package/dist/components/material/animations/DeleteItemAnimations.js.map +1 -1
- package/dist/components/material/animations/ItemAnimations.d.ts +4 -4
- 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/MaterialAnimations.js.map +1 -1
- package/dist/components/material/animations/MaterialGameAnimations.d.ts +25 -7
- package/dist/components/material/animations/MaterialGameAnimations.js +63 -10
- package/dist/components/material/animations/MaterialGameAnimations.js.map +1 -1
- package/dist/components/material/animations/MoveItemAnimations.d.ts +2 -2
- package/dist/components/material/animations/MoveItemAnimations.js.map +1 -1
- package/dist/components/material/animations/RollItemAnimations.d.ts +3 -3
- package/dist/components/material/animations/RollItemAnimations.js.map +1 -1
- package/dist/components/material/animations/ShuffleAnimations.d.ts +3 -3
- package/dist/components/material/animations/ShuffleAnimations.js.map +1 -1
- package/dist/components/material/locations/LocationDescription.d.ts +2 -2
- package/dist/components/material/locations/LocationDescription.js +7 -4
- package/dist/components/material/locations/LocationDescription.js.map +1 -1
- package/dist/components/material/locations/LocationsMask.d.ts +1 -1
- package/dist/components/material/locations/LocationsMask.js +1 -3
- package/dist/components/material/locations/LocationsMask.js.map +1 -1
- package/dist/components/material/locations/SimpleDropArea.js +69 -35
- package/dist/components/material/locations/SimpleDropArea.js.map +1 -1
- package/dist/components/material/utils/useIsAnimatingPlayerAction.js +8 -3
- package/dist/components/material/utils/useIsAnimatingPlayerAction.js.map +1 -1
- package/dist/components/menus/EjectPlayer/EjectPlayerButton.js +2 -2
- package/dist/components/menus/EjectPlayer/EjectPlayerButton.js.map +1 -1
- package/dist/components/menus/EjectPlayer/EjectPlayerDialog.js +2 -2
- package/dist/components/menus/EjectPlayer/EjectPlayerDialog.js.map +1 -1
- package/dist/components/menus/EjectPlayer/EjectPlayerPopButton.js +2 -2
- package/dist/components/menus/EjectPlayer/EjectPlayerPopButton.js.map +1 -1
- package/dist/components/menus/Fullscreen/FullscreenButton.js +3 -2
- package/dist/components/menus/Fullscreen/FullscreenButton.js.map +1 -1
- package/dist/components/menus/Fullscreen/FullscreenDialog.js +2 -2
- package/dist/components/menus/Fullscreen/FullscreenDialog.js.map +1 -1
- package/dist/components/menus/Fullscreen/FullscreenPopButton.js +3 -2
- package/dist/components/menus/Fullscreen/FullscreenPopButton.js.map +1 -1
- package/dist/components/menus/GiveUpButton/GiveUpButton.js +2 -1
- package/dist/components/menus/GiveUpButton/GiveUpButton.js.map +1 -1
- package/dist/components/menus/Menu/Menu.js +19 -19
- package/dist/components/menus/Menu/Menu.js.map +1 -1
- package/dist/components/menus/Menu/MenuPopButton.d.ts +1 -1
- package/dist/components/menus/Menu/MenuPopButton.js +7 -6
- package/dist/components/menus/Menu/MenuPopButton.js.map +1 -1
- package/dist/components/menus/RestartTutorialButton/RestartTutorialButton.js +2 -2
- package/dist/components/menus/RestartTutorialButton/RestartTutorialButton.js.map +1 -1
- package/dist/components/menus/SoundButton/SoundButton.js +3 -2
- package/dist/components/menus/SoundButton/SoundButton.js.map +1 -1
- package/dist/components/menus/TimeStatsButton/TimeStatsButton.js +2 -2
- package/dist/components/menus/TimeStatsButton/TimeStatsButton.js.map +1 -1
- package/dist/components/menus/UndoButton/UndoButton.js +2 -2
- package/dist/components/menus/UndoButton/UndoButton.js.map +1 -1
- package/dist/components/menus/UndoButton/UndoPopButton.js +2 -2
- package/dist/components/menus/UndoButton/UndoPopButton.js.map +1 -1
- package/dist/components/tutorial/FocusableElement.d.ts +0 -0
- package/dist/components/tutorial/FocusableElement.js +2 -0
- package/dist/components/tutorial/FocusableElement.js.map +1 -0
- package/dist/components/tutorial/MaterialTutorial.d.ts +4 -14
- package/dist/components/tutorial/MaterialTutorial.js +1 -60
- package/dist/components/tutorial/MaterialTutorial.js.map +1 -1
- package/dist/components/tutorial/MaterialTutorialDisplay.js +39 -24
- package/dist/components/tutorial/MaterialTutorialDisplay.js.map +1 -1
- package/dist/components/tutorial/TutorialRulesWrapper.js +25 -5
- package/dist/components/tutorial/TutorialRulesWrapper.js.map +1 -1
- package/dist/css/GameTheme.d.ts +4 -0
- package/dist/css/GameTheme.js +3 -0
- package/dist/css/GameTheme.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/useHistory.d.ts +6 -0
- package/dist/hooks/useHistory.js +73 -0
- package/dist/hooks/useHistory.js.map +1 -0
- package/dist/hooks/useLegalMoves.js +5 -3
- package/dist/hooks/useLegalMoves.js.map +1 -1
- package/dist/hooks/useRankedPlayers.d.ts +5 -0
- package/dist/hooks/useRankedPlayers.js +38 -0
- package/dist/hooks/useRankedPlayers.js.map +1 -0
- package/dist/hooks/useUndo.js +12 -7
- package/dist/hooks/useUndo.js.map +1 -1
- package/dist/hooks/useZoomToElements.d.ts +9 -1
- package/dist/hooks/useZoomToElements.js +20 -17
- package/dist/hooks/useZoomToElements.js.map +1 -1
- package/dist/locators/HandLocator.d.ts +1 -0
- package/dist/locators/HandLocator.js +4 -1
- package/dist/locators/HandLocator.js.map +1 -1
- package/dist/locators/ItemLocator.d.ts +1 -1
- package/dist/locators/ItemLocator.js +3 -3
- package/dist/locators/ItemLocator.js.map +1 -1
- package/dist/locators/LineLocator.js +3 -3
- package/dist/locators/LineLocator.js.map +1 -1
- package/dist/utilities/findIfUnique.util.d.ts +1 -0
- package/dist/utilities/findIfUnique.util.js +17 -0
- package/dist/utilities/findIfUnique.util.js.map +1 -0
- package/dist/utilities/index.d.ts +1 -0
- package/dist/utilities/index.js +1 -0
- package/dist/utilities/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
25
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
26
|
+
if (ar || !(i in from)) {
|
|
27
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
28
|
+
ar[i] = from[i];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
32
|
+
};
|
|
33
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
+
exports.DynamicItemsDisplay = void 0;
|
|
35
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
36
|
+
var react_i18next_1 = require("react-i18next");
|
|
37
|
+
var hooks_1 = require("../../../hooks");
|
|
38
|
+
var DraggableMaterial_1 = require("../DraggableMaterial");
|
|
39
|
+
var focus_1 = require("./focus");
|
|
40
|
+
var DynamicItemsDisplay = function (props) {
|
|
41
|
+
var context = (0, hooks_1.useMaterialContext)();
|
|
42
|
+
var items = context.rules.game.items;
|
|
43
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: Object.entries(items).map(function (_a) {
|
|
44
|
+
var stringType = _a[0], items = _a[1];
|
|
45
|
+
return items && (0, jsx_runtime_1.jsx)(DynamicItemsTypeDisplay, __assign({ type: parseInt(stringType), items: items }, props), stringType);
|
|
46
|
+
}) });
|
|
47
|
+
};
|
|
48
|
+
exports.DynamicItemsDisplay = DynamicItemsDisplay;
|
|
49
|
+
var DynamicItemsTypeDisplay = function (_a) {
|
|
50
|
+
var type = _a.type, items = _a.items, props = __rest(_a, ["type", "items"]);
|
|
51
|
+
var context = (0, hooks_1.useMaterialContext)();
|
|
52
|
+
var focus = (0, focus_1.useFocusContext)().focus;
|
|
53
|
+
var locators = context.locators;
|
|
54
|
+
var t = (0, react_i18next_1.useTranslation)().t;
|
|
55
|
+
var description = context.material[type];
|
|
56
|
+
if (!description)
|
|
57
|
+
return null;
|
|
58
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: items.map(function (item, index) {
|
|
59
|
+
var _a;
|
|
60
|
+
var locator = locators[item.location.type];
|
|
61
|
+
return __spreadArray([], Array((_a = item.quantity) !== null && _a !== void 0 ? _a : 1), true).map(function (_, displayIndex) {
|
|
62
|
+
var itemContext = __assign(__assign({}, context), { type: type, index: index, displayIndex: displayIndex });
|
|
63
|
+
if (locator === null || locator === void 0 ? void 0 : locator.hide(item, itemContext))
|
|
64
|
+
return null;
|
|
65
|
+
var isFocused = focus === null || focus === void 0 ? void 0 : focus.materials.some(function (material) {
|
|
66
|
+
return material.type === type && material.getIndexes().includes(index);
|
|
67
|
+
});
|
|
68
|
+
return (0, jsx_runtime_1.jsx)(DraggableMaterial_1.DraggableMaterial, __assign({ highlight: description.highlight(item, itemContext), type: type, index: index, displayIndex: displayIndex, isFocused: isFocused, title: item.quantity !== undefined ? t('quantity.tooltip', { n: item.quantity }) : undefined }, props), "".concat(type, "_").concat(index, "_").concat(displayIndex));
|
|
69
|
+
});
|
|
70
|
+
}) });
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=DynamicItemsDisplay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DynamicItemsDisplay.js","sourceRoot":"","sources":["../../../../src/components/material/GameTable/DynamicItemsDisplay.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,+CAA8C;AAC9C,wCAAmD;AAEnD,0DAAwD;AACxD,iCAAyC;AAElC,IAAM,mBAAmB,GAAG,UAAC,KAAqC;IACvE,IAAM,OAAO,GAAG,IAAA,0BAAkB,GAAE,CAAA;IACpC,IAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAA;IACtC,OAAO,2DACJ,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,UAAC,EAAmB;gBAAlB,UAAU,QAAA,EAAE,KAAK,QAAA;YAC5C,OAAA,KAAK,IAAI,uBAAC,uBAAuB,aAAkB,IAAI,EAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,KAAK,IAAM,KAAK,GAA/D,UAAU,CAAwD;QAAzG,CAAyG,CAC1G,GACA,CAAA;AACL,CAAC,CAAA;AARY,QAAA,mBAAmB,uBAQ/B;AAQD,IA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IAAI,EAAE,WAAW,CAAC,EAC5F,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAC1E,KAAK,EAAE,IAAI,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,kBAAkB,EAAE,EAAE,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAE,CAAC,CAAC,CAAC,SAAS,IACzF,KAAK,GAHJ,UAAG,IAAI,cAAI,KAAK,cAAI,YAAY,CAAE,CAG3B,CAAA;YACxC,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,GAAI,CAAA;AACR,CAAC,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Location, LocationBuilder, Material, MaterialItem } from '@gamepark/rules-api';
|
|
2
|
+
export type FocusableElement<P extends number = number, M extends number = number, L extends number = number> = Material<P, M, L> | StaticItem<P, M, L> | LocationBuilder<P, L>;
|
|
3
|
+
export type StaticItem<P extends number = number, M extends number = number, L extends number = number> = {
|
|
4
|
+
type: M;
|
|
5
|
+
item: MaterialItem<P, L>;
|
|
6
|
+
};
|
|
7
|
+
export declare function isItemFocus(itemType: number, itemIndex: number, focus?: FocusableElement | FocusableElement[]): boolean;
|
|
8
|
+
export declare function isMaterialFocus(focus?: FocusableElement): focus is Material;
|
|
9
|
+
export declare function countTutorialFocusRefs(focus?: FocusableElement | FocusableElement[]): number;
|
|
10
|
+
export declare function isStaticItem(focus?: FocusableElement): focus is StaticItem;
|
|
11
|
+
export declare function isStaticItemFocus(itemType: number, item: MaterialItem, focus?: FocusableElement | FocusableElement[]): boolean;
|
|
12
|
+
export declare function isLocationBuilder(focus?: FocusableElement): focus is LocationBuilder;
|
|
13
|
+
export declare function isLocationFocus(location: Location, focus?: FocusableElement | FocusableElement[]): boolean;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isLocationFocus = exports.isLocationBuilder = exports.isStaticItemFocus = exports.isStaticItem = exports.countTutorialFocusRefs = exports.isMaterialFocus = exports.isItemFocus = void 0;
|
|
7
|
+
var fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
|
|
8
|
+
var sumBy_1 = __importDefault(require("lodash/sumBy"));
|
|
9
|
+
function isItemFocus(itemType, itemIndex, focus) {
|
|
10
|
+
if (Array.isArray(focus)) {
|
|
11
|
+
return focus.some(function (focus) { return isItemFocus(itemType, itemIndex, focus); });
|
|
12
|
+
}
|
|
13
|
+
return isMaterialFocus(focus) && focus.type === itemType && focus.getIndexes().includes(itemIndex);
|
|
14
|
+
}
|
|
15
|
+
exports.isItemFocus = isItemFocus;
|
|
16
|
+
function isMaterialFocus(focus) {
|
|
17
|
+
return typeof focus === 'object' && focus.entries !== undefined;
|
|
18
|
+
}
|
|
19
|
+
exports.isMaterialFocus = isMaterialFocus;
|
|
20
|
+
function countTutorialFocusRefs(focus) {
|
|
21
|
+
var _a;
|
|
22
|
+
if (!focus)
|
|
23
|
+
return 0;
|
|
24
|
+
if (Array.isArray(focus)) {
|
|
25
|
+
return (0, sumBy_1.default)(focus, function (focus) { return countTutorialFocusRefs(focus); });
|
|
26
|
+
}
|
|
27
|
+
if (isMaterialFocus(focus)) {
|
|
28
|
+
return (0, sumBy_1.default)(focus.getItems(), function (item) { var _a; return (_a = item.quantity) !== null && _a !== void 0 ? _a : 1; });
|
|
29
|
+
}
|
|
30
|
+
else if (isStaticItem(focus)) {
|
|
31
|
+
return (_a = focus.item.quantity) !== null && _a !== void 0 ? _a : 1;
|
|
32
|
+
}
|
|
33
|
+
else if (isLocationBuilder(focus)) {
|
|
34
|
+
return 1;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
return 0;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.countTutorialFocusRefs = countTutorialFocusRefs;
|
|
41
|
+
function isStaticItem(focus) {
|
|
42
|
+
return typeof focus === 'object' && typeof focus.type === 'number' && typeof focus.item === 'object';
|
|
43
|
+
}
|
|
44
|
+
exports.isStaticItem = isStaticItem;
|
|
45
|
+
function isStaticItemFocus(itemType, item, focus) {
|
|
46
|
+
if (Array.isArray(focus)) {
|
|
47
|
+
return focus.some(function (focus) { return isStaticItemFocus(itemType, item, focus); });
|
|
48
|
+
}
|
|
49
|
+
return isStaticItem(focus) && focus.type === itemType && (0, fast_deep_equal_1.default)(focus.item, item);
|
|
50
|
+
}
|
|
51
|
+
exports.isStaticItemFocus = isStaticItemFocus;
|
|
52
|
+
function isLocationBuilder(focus) {
|
|
53
|
+
return typeof focus === 'object' && typeof focus.location === 'object';
|
|
54
|
+
}
|
|
55
|
+
exports.isLocationBuilder = isLocationBuilder;
|
|
56
|
+
function isLocationFocus(location, focus) {
|
|
57
|
+
if (Array.isArray(focus)) {
|
|
58
|
+
return focus.some(function (focus) { return isLocationFocus(location, focus); });
|
|
59
|
+
}
|
|
60
|
+
return isLocationBuilder(focus) && (0, fast_deep_equal_1.default)(focus.location, location);
|
|
61
|
+
}
|
|
62
|
+
exports.isLocationFocus = isLocationFocus;
|
|
63
|
+
//# sourceMappingURL=FocusableElement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FocusableElement.js","sourceRoot":"","sources":["../../../../src/components/material/GameTable/FocusableElement.ts"],"names":[],"mappings":";;;;;;AACA,oEAAmC;AACnC,uDAAgC;AAShC,SAAgB,WAAW,CAAC,QAAgB,EAAE,SAAiB,EAAE,KAA6C;IAC5G,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACxB,OAAO,KAAK,CAAC,IAAI,CAAC,UAAA,KAAK,IAAI,OAAA,WAAW,CAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,CAA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EC;AAED,SAAgB,iBAAiB,CAAC,QAAgB,EAAE,IAAkB,EAAE,KAA6C;IACnH,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACxB,OAAO,KAAK,CAAC,IAAI,CAAC,UAAA,KAAK,IAAI,OAAA,iBAAiB,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,CAAC,EAAxC,CAAwC,CAAC,CAAA;KACrE;IACD,OAAO,YAAY,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAA,yBAAK,EAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;AAClF,CAAC;AALD,8CAKC;AAED,SAAgB,iBAAiB,CAAC,KAAwB;IACxD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAQ,KAAyB,CAAC,QAAQ,KAAK,QAAQ,CAAA;AAC7F,CAAC;AAFD,8CAEC;AAED,SAAgB,eAAe,CAAC,QAAkB,EAAE,KAA6C;IAC/F,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACxB,OAAO,KAAK,CAAC,IAAI,CAAC,UAAA,KAAK,IAAI,OAAA,eAAe,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAhC,CAAgC,CAAC,CAAA;KAC7D;IACD,OAAO,iBAAiB,CAAC,KAAK,CAAC,IAAI,IAAA,yBAAK,EAAC,KAAK,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;AACpE,CAAC;AALD,0CAKC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Location, MaterialItem } from '@gamepark/rules-api';
|
|
2
|
+
import { ItemContext } from '../../../locators';
|
|
3
|
+
import { FocusableElement } from './FocusableElement';
|
|
4
|
+
export type FocusableLocation = {
|
|
5
|
+
location: Location;
|
|
6
|
+
focus?: true;
|
|
7
|
+
};
|
|
8
|
+
export declare const getInnerLocations: (item: MaterialItem, context: ItemContext, focus?: FocusableElement | FocusableElement[]) => FocusableLocation[];
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getInnerLocations = void 0;
|
|
7
|
+
var fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
|
|
8
|
+
var FocusableElement_1 = require("./FocusableElement");
|
|
9
|
+
var getInnerLocations = function (item, context, focus) {
|
|
10
|
+
var _a, _b;
|
|
11
|
+
var locationsFocus = getLocationsFocus(focus).filter(function (location) { var _a, _b; return ((_a = context.locators[location.type]) === null || _a === void 0 ? void 0 : _a.parentItemType) === context.type && ((_b = location.parent) !== null && _b !== void 0 ? _b : 0) === context.index; });
|
|
12
|
+
var result = (_b = (_a = context.material[context.type]) === null || _a === void 0 ? void 0 : _a.getLocations(item, context).map(function (location) { return ({ location: location }); })) !== null && _b !== void 0 ? _b : [];
|
|
13
|
+
var _loop_1 = function (locationFocus) {
|
|
14
|
+
var focusableLocation = result.find(function (focusableLocation) { return (0, fast_deep_equal_1.default)(focusableLocation.location, locationFocus); });
|
|
15
|
+
if (focusableLocation) {
|
|
16
|
+
focusableLocation.focus = true;
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
result.push({ location: locationFocus, focus: true });
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
for (var _i = 0, locationsFocus_1 = locationsFocus; _i < locationsFocus_1.length; _i++) {
|
|
23
|
+
var locationFocus = locationsFocus_1[_i];
|
|
24
|
+
_loop_1(locationFocus);
|
|
25
|
+
}
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
exports.getInnerLocations = getInnerLocations;
|
|
29
|
+
var getLocationsFocus = function (focus) {
|
|
30
|
+
if (!focus)
|
|
31
|
+
return [];
|
|
32
|
+
if (Array.isArray(focus)) {
|
|
33
|
+
return focus.filter(FocusableElement_1.isLocationBuilder).map(function (builder) { return builder.location; });
|
|
34
|
+
}
|
|
35
|
+
return (0, FocusableElement_1.isLocationBuilder)(focus) ? [focus.location] : [];
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=FocusableLocation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FocusableLocation.js","sourceRoot":"","sources":["../../../../src/components/material/GameTable/FocusableLocation.ts"],"names":[],"mappings":";;;;;;AACA,oEAAmC;AAEnC,uDAAwE;AAOjE,IAAM,iBAAiB,GAAG,UAC/B,IAAkB,EAAE,OAAoB,EAAE,KAA6C;;IAEvF,IAAM,cAAc,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,UAAA,QAAQ,gBAC7D,OAAA,CAAA,MAAA,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,0CAAE,cAAc,MAAK,OAAO,CAAC,IAAI,IAAI,CAAC,MAAA,QAAQ,CAAC,MAAM,mCAAI,CAAC,CAAC,KAAK,OAAO,CAAC,KAAK,CAAA,EAAA,CAC7G,CAAA;IACD,IAAM,MAAM,GAAwB,MAAA,MAAA,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,0CAAE,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,UAAA,QAAQ,IAAI,OAAA,CAAC,EAAE,QAAQ,UAAA,EAAE,CAAC,EAAd,CAAc,CAAC,mCAAI,EAAE,CAAA;4BAC1H,aAAa;QACtB,IAAM,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC,UAAA,iBAAiB,IAAI,OAAA,IAAA,yBAAK,EAAC,iBAAiB,CAAC,QAAQ,EAAE,aAAa,CAAC,EAAhD,CAAgD,CAAC,CAAA;QAC5G,IAAI,iBAAiB,EAAE;YACrB,iBAAiB,CAAC,KAAK,GAAG,IAAI,CAAA;SAC/B;aAAM;YACL,MAAM,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;SACtD;;IANH,KAA4B,UAAc,EAAd,iCAAc,EAAd,4BAAc,EAAd,IAAc;QAArC,IAAM,aAAa,uBAAA;gBAAb,aAAa;KAOvB;IACD,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAhBY,QAAA,iBAAiB,qBAgB7B;AAED,IAAM,iBAAiB,GAAG,UAAC,KAA6C;IACtE,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAA;IACrB,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACxB,OAAO,KAAK,CAAC,MAAM,CAAC,oCAAiB,CAAC,CAAC,GAAG,CAAC,UAAA,OAAO,IAAI,OAAA,OAAO,CAAC,QAAQ,EAAhB,CAAgB,CAAC,CAAA;KACxE;IACD,OAAO,IAAA,oCAAiB,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;AACzD,CAAC,CAAA"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FocusableLocations.js","sourceRoot":"","sources":["../../../../src/components/material/GameTable/FocusableLocations.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
type GameMaterialDisplayProps = {
|
|
2
|
+
left: number;
|
|
3
|
+
top: number;
|
|
4
|
+
};
|
|
5
|
+
export declare const GameMaterialDisplay: ({ left, top }: GameMaterialDisplayProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -1,148 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
15
|
-
if (ar || !(i in from)) {
|
|
16
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
17
|
-
ar[i] = from[i];
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
|
-
};
|
|
22
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
2
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
+
return cooked;
|
|
24
5
|
};
|
|
25
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
7
|
exports.GameMaterialDisplay = void 0;
|
|
27
8
|
var jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
9
|
+
var react_1 = require("@emotion/react");
|
|
28
10
|
var rules_api_1 = require("@gamepark/rules-api");
|
|
29
|
-
var fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
|
|
30
|
-
var react_1 = require("react");
|
|
31
|
-
var react_i18next_1 = require("react-i18next");
|
|
32
|
-
var react_zoom_pan_pinch_1 = require("react-zoom-pan-pinch");
|
|
33
|
-
var css_1 = require("../../../css");
|
|
34
11
|
var hooks_1 = require("../../../hooks");
|
|
35
|
-
var useTutorialStep_1 = require("../../../hooks/useTutorialStep");
|
|
36
|
-
var locators_1 = require("../../../locators");
|
|
37
12
|
var dialogs_1 = require("../../dialogs");
|
|
38
|
-
var tutorial_1 = require("../../tutorial");
|
|
39
13
|
var MaterialTutorialDisplay_1 = require("../../tutorial/MaterialTutorialDisplay");
|
|
40
|
-
var
|
|
41
|
-
var
|
|
42
|
-
var
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
var
|
|
46
|
-
var locators = context.locators;
|
|
14
|
+
var DynamicItemsDisplay_1 = require("./DynamicItemsDisplay");
|
|
15
|
+
var focus_1 = require("./focus");
|
|
16
|
+
var StaticItemsDisplay_1 = require("./StaticItemsDisplay");
|
|
17
|
+
var StaticLocationsDisplay_1 = require("./StaticLocationsDisplay");
|
|
18
|
+
var GameMaterialDisplay = function (_a) {
|
|
19
|
+
var left = _a.left, top = _a.top;
|
|
47
20
|
var rules = (0, hooks_1.useRules)();
|
|
48
21
|
var play = (0, hooks_1.usePlay)();
|
|
49
|
-
|
|
50
|
-
var zoomToElements = (0, hooks_1.useZoomToElements)();
|
|
51
|
-
var resetTransform = (0, react_zoom_pan_pinch_1.useControls)().resetTransform;
|
|
52
|
-
var focusRefs = (0, react_1.useRef)(new Set());
|
|
53
|
-
var tutorialStep = (0, useTutorialStep_1.useTutorialStep)();
|
|
54
|
-
var tutorialPopup = !(rules === null || rules === void 0 ? void 0 : rules.game.tutorialPopupClosed) && (tutorialStep === null || tutorialStep === void 0 ? void 0 : tutorialStep.popup);
|
|
55
|
-
var tutorialFocus = (0, react_1.useMemo)(function () {
|
|
56
|
-
var _a;
|
|
57
|
-
focusRefs.current = new Set();
|
|
58
|
-
var tutorialFocus = (rules === null || rules === void 0 ? void 0 : rules.game) ? (_a = tutorialStep === null || tutorialStep === void 0 ? void 0 : tutorialStep.focus) === null || _a === void 0 ? void 0 : _a.call(tutorialStep, rules.game) : undefined;
|
|
59
|
-
if (!tutorialFocus) {
|
|
60
|
-
resetTransform(1000);
|
|
61
|
-
}
|
|
62
|
-
return tutorialFocus;
|
|
63
|
-
}, [tutorialStep]);
|
|
64
|
-
var addFocusRef = (0, react_1.useCallback)(function (ref) {
|
|
65
|
-
if (!ref || focusRefs.current.has(ref))
|
|
66
|
-
return;
|
|
67
|
-
focusRefs.current.add(ref);
|
|
68
|
-
if ((0, tutorial_1.countTutorialFocusRefs)(tutorialFocus) === focusRefs.current.size) {
|
|
69
|
-
var elements_1 = Array.from(focusRefs.current);
|
|
70
|
-
setTimeout(function () { return zoomToElements(elements_1, undefined, 1000); }, 50);
|
|
71
|
-
}
|
|
72
|
-
}, [tutorialFocus]);
|
|
73
|
-
if (!rules)
|
|
22
|
+
if (!rules || !rules.game)
|
|
74
23
|
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
|
|
75
|
-
var game = rules
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
var type = parseInt(stringType);
|
|
79
|
-
return description === null || description === void 0 ? void 0 : description.getStaticItems(context).map(function (item, index) {
|
|
80
|
-
var _a, _b;
|
|
81
|
-
var locator = (_a = locators[item.location.type]) !== null && _a !== void 0 ? _a : locators_1.centerLocator;
|
|
82
|
-
return __spreadArray([], Array((_b = item.quantity) !== null && _b !== void 0 ? _b : 1), true).map(function (_, displayIndex) {
|
|
83
|
-
var itemContext = __assign(__assign({}, context), { type: type, index: index, displayIndex: displayIndex });
|
|
84
|
-
var innerLocations = getInnerLocations(item, itemContext, tutorialPopup, tutorialFocus);
|
|
85
|
-
var focus = (0, tutorial_1.isStaticItemFocus)(type, item, tutorialFocus);
|
|
86
|
-
return (0, jsx_runtime_1.jsxs)(MaterialComponent_1.MaterialComponent, __assign({ type: type, itemId: item.id, playDown: tutorialPopup && !focus && !innerLocations.some(function (location) { return location.focus; }), ref: focus ? addFocusRef : undefined, css: [css_1.pointerCursorCss, css_1.transformCss.apply(void 0, locator.transformItem(item, itemContext))], onShortClick: function () { return play((0, rules_api_1.displayMaterialHelp)(type, item, index, displayIndex), { local: true }); } }, { children: [(0, jsx_runtime_1.jsx)(locations_1.LocationsMask, { locations: innerLocations.filter(function (l) { return l.focus; }).map(function (l) { return l.location; }) }), innerLocations.map(function (_a) {
|
|
87
|
-
var focus = _a.focus, location = _a.location;
|
|
88
|
-
return (0, jsx_runtime_1.jsx)(locations_1.SimpleDropArea, { location: location, alwaysVisible: focus, ref: focus ? addFocusRef : undefined }, JSON.stringify(location));
|
|
89
|
-
})] }), "".concat(type, "_").concat(index, "_").concat(displayIndex));
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
}), rules && game && Object.entries(game.items).map(function (_a) {
|
|
93
|
-
var stringType = _a[0], items = _a[1];
|
|
94
|
-
if (!items)
|
|
95
|
-
return null;
|
|
96
|
-
var type = parseInt(stringType);
|
|
97
|
-
return items.map(function (item, index) {
|
|
98
|
-
var _a;
|
|
99
|
-
var locator = locators[item.location.type];
|
|
100
|
-
return __spreadArray([], Array((_a = item.quantity) !== null && _a !== void 0 ? _a : 1), true).map(function (_, displayIndex) {
|
|
101
|
-
var itemContext = __assign(__assign({}, context), { type: type, index: index, displayIndex: displayIndex });
|
|
102
|
-
if (locator === null || locator === void 0 ? void 0 : locator.hide(item, itemContext))
|
|
103
|
-
return null;
|
|
104
|
-
var innerLocations = getInnerLocations(item, itemContext, tutorialPopup, tutorialFocus);
|
|
105
|
-
var focus = (0, tutorial_1.isItemFocus)(type, index, tutorialFocus);
|
|
106
|
-
return (0, jsx_runtime_1.jsxs)(DraggableMaterial_1.DraggableMaterial, __assign({ type: type, index: index, displayIndex: displayIndex, playDown: tutorialPopup && !focus && !innerLocations.some(function (location) { return location.focus; }), ref: focus ? addFocusRef : undefined, title: item.quantity !== undefined ? t('quantity.tooltip', { n: item.quantity }) : undefined }, { children: [(0, jsx_runtime_1.jsx)(locations_1.LocationsMask, { locations: innerLocations.filter(function (l) { return l.focus; }).map(function (l) { return l.location; }) }), innerLocations.map(function (_a) {
|
|
107
|
-
var focus = _a.focus, location = _a.location;
|
|
108
|
-
return (0, jsx_runtime_1.jsx)(locations_1.SimpleDropArea, { location: location, alwaysVisible: focus, ref: focus ? addFocusRef : undefined }, JSON.stringify(location));
|
|
109
|
-
})] }), "".concat(type, "_").concat(index, "_").concat(displayIndex));
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
}), Object.values(locators).map(function (locator) {
|
|
113
|
-
var _a;
|
|
114
|
-
return (_a = locator === null || locator === void 0 ? void 0 : locator.getLocationDescription(context)) === null || _a === void 0 ? void 0 : _a.getLocations(context).map(function (location) {
|
|
115
|
-
var isFocus = (0, tutorial_1.isLocationFocus)(location, tutorialFocus);
|
|
116
|
-
return (0, jsx_runtime_1.jsx)(locations_1.SimpleDropArea, { location: location, alwaysVisible: isFocus, ref: isFocus ? addFocusRef : undefined }, JSON.stringify(location));
|
|
117
|
-
});
|
|
118
|
-
}), (0, jsx_runtime_1.jsx)(dialogs_1.MaterialRulesDialog, { open: !!(game === null || game === void 0 ? void 0 : game.helpDisplay), close: function () { return play(rules_api_1.closeHelpDisplay, { local: true }); } }), (game === null || game === void 0 ? void 0 : game.tutorialStep) !== undefined && (0, jsx_runtime_1.jsx)(MaterialTutorialDisplay_1.MaterialTutorialDisplay, {})] });
|
|
24
|
+
var game = rules.game;
|
|
25
|
+
var position = defaultPosition(left, top);
|
|
26
|
+
return (0, jsx_runtime_1.jsxs)(focus_1.FocusProvider, { children: [(0, jsx_runtime_1.jsx)(StaticItemsDisplay_1.StaticItemsDisplay, { css: position }), (0, jsx_runtime_1.jsx)(DynamicItemsDisplay_1.DynamicItemsDisplay, { css: position }), (0, jsx_runtime_1.jsx)(StaticLocationsDisplay_1.StaticLocationsDisplay, { css: position }), (0, jsx_runtime_1.jsx)(dialogs_1.MaterialRulesDialog, { open: !!(game === null || game === void 0 ? void 0 : game.helpDisplay), close: function () { return play(rules_api_1.closeHelpDisplay, { local: true }); } }), (game === null || game === void 0 ? void 0 : game.tutorialStep) !== undefined && (0, jsx_runtime_1.jsx)(MaterialTutorialDisplay_1.MaterialTutorialDisplay, {})] });
|
|
119
27
|
};
|
|
120
28
|
exports.GameMaterialDisplay = GameMaterialDisplay;
|
|
121
|
-
var
|
|
122
|
-
|
|
123
|
-
var locationsFocus = tutorialPopup ? getLocationsFocus(tutorialFocus).filter(function (location) { var _a, _b; return ((_a = context.locators[location.type]) === null || _a === void 0 ? void 0 : _a.parentItemType) === context.type && ((_b = location.parent) !== null && _b !== void 0 ? _b : 0) === context.index; }) : [];
|
|
124
|
-
var result = (_b = (_a = context.material[context.type]) === null || _a === void 0 ? void 0 : _a.getLocations(item, context).map(function (location) { return ({ location: location }); })) !== null && _b !== void 0 ? _b : [];
|
|
125
|
-
var _loop_1 = function (locationFocus) {
|
|
126
|
-
var focusableLocation = result.find(function (focusableLocation) { return (0, fast_deep_equal_1.default)(focusableLocation.location, locationFocus); });
|
|
127
|
-
if (focusableLocation) {
|
|
128
|
-
focusableLocation.focus = true;
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
result.push({ location: locationFocus, focus: true });
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
for (var _i = 0, locationsFocus_1 = locationsFocus; _i < locationsFocus_1.length; _i++) {
|
|
135
|
-
var locationFocus = locationsFocus_1[_i];
|
|
136
|
-
_loop_1(locationFocus);
|
|
137
|
-
}
|
|
138
|
-
return result;
|
|
139
|
-
};
|
|
140
|
-
var getLocationsFocus = function (focus) {
|
|
141
|
-
if (!focus)
|
|
142
|
-
return [];
|
|
143
|
-
if (Array.isArray(focus)) {
|
|
144
|
-
return focus.filter(tutorial_1.isLocationBuilder).map(function (builder) { return builder.location; });
|
|
145
|
-
}
|
|
146
|
-
return (0, tutorial_1.isLocationBuilder)(focus) ? [focus.location] : [];
|
|
147
|
-
};
|
|
29
|
+
var defaultPosition = function (left, top) { return (0, react_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: absolute;\n left: ", "em;\n top: ", "em;\n transform-style: preserve-3d;\n"], ["\n position: absolute;\n left: ", "em;\n top: ", "em;\n transform-style: preserve-3d;\n"])), left, top); };
|
|
30
|
+
var templateObject_1;
|
|
148
31
|
//# sourceMappingURL=GameMaterialDisplay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GameMaterialDisplay.js","sourceRoot":"","sources":["../../../../src/components/material/GameTable/GameMaterialDisplay.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GameMaterialDisplay.js","sourceRoot":"","sources":["../../../../src/components/material/GameTable/GameMaterialDisplay.tsx"],"names":[],"mappings":";;;;;;;;AACA,wCAAoC;AACpC,iDAAqE;AACrE,wCAAkD;AAClD,yCAAmD;AACnD,kFAAgF;AAChF,6DAA2D;AAC3D,iCAAuC;AACvC,2DAAyD;AACzD,mEAAiE;AAO1D,IAAM,mBAAmB,GAAG,UAAC,EAAuC;QAArC,IAAI,UAAA,EAAE,GAAG,SAAA;IAC7C,IAAM,KAAK,GAAG,IAAA,gBAAQ,GAAiB,CAAA;IACvC,IAAM,IAAI,GAAG,IAAA,eAAO,GAAE,CAAA;IAEtB,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI;QAAE,OAAO,kDAAK,CAAA;IACvC,IAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAA;IAEvB,IAAM,QAAQ,GAAG,eAAe,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IAC3C,OAAO,wBAAC,qBAAa,eACnB,uBAAC,uCAAkB,IAAC,GAAG,EAAE,QAAQ,GAAG,EACpC,uBAAC,yCAAmB,IAAC,GAAG,EAAE,QAAQ,GAAG,EACrC,uBAAC,+CAAsB,IAAC,GAAG,EAAE,QAAQ,GAAG,EACxC,uBAAC,6BAAmB,IAAC,IAAI,EAAE,CAAC,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,CAAA,EAAE,KAAK,EAAE,cAAM,OAAA,IAAI,CAAC,4BAAgB,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,EAAvC,CAAuC,GAAG,EACtG,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,YAAY,MAAK,SAAS,IAAI,uBAAC,iDAAuB,KAAE,IACjD,CAAA;AAClB,CAAC,CAAA;AAfY,QAAA,mBAAmB,uBAe/B;AAED,IAAM,eAAe,GAAG,UAAC,IAAY,EAAE,GAAW,IAAK,WAAA,WAAG,iKAAA,mCAEhD,EAAI,cACL,EAAG,wCAEX,KAHS,IAAI,EACL,GAAG,GAH2C,CAKtD,CAAA"}
|
|
@@ -43,8 +43,8 @@ var wheel = { step: 0.05 };
|
|
|
43
43
|
var doubleClick = { disabled: true };
|
|
44
44
|
var pointerSensorOptions = { activationConstraint: { distance: 2 } };
|
|
45
45
|
var GameTable = function (_a) {
|
|
46
|
-
var collisionAlgorithm = _a.collisionAlgorithm, perspective = _a.perspective, xMin = _a.xMin, xMax = _a.xMax, yMin = _a.yMin, yMax = _a.yMax,
|
|
47
|
-
var
|
|
46
|
+
var collisionAlgorithm = _a.collisionAlgorithm, _b = _a.snapToCenter, snapToCenter = _b === void 0 ? true : _b, perspective = _a.perspective, xMin = _a.xMin, xMax = _a.xMax, yMin = _a.yMin, yMax = _a.yMax, _c = _a.margin, margin = _c === void 0 ? { left: 0, right: 0, top: 7, bottom: 0 } : _c, children = _a.children, props = __rest(_a, ["collisionAlgorithm", "snapToCenter", "perspective", "xMin", "xMax", "yMin", "yMax", "margin", "children"]);
|
|
47
|
+
var _d = (0, react_2.useState)(false), dragging = _d[0], setDragging = _d[1];
|
|
48
48
|
var sensors = (0, core_1.useSensors)((0, core_1.useSensor)(core_1.PointerSensor, pointerSensorOptions));
|
|
49
49
|
var context = (0, hooks_1.useMaterialContext)();
|
|
50
50
|
var play = (0, hooks_1.usePlay)();
|
|
@@ -86,6 +86,7 @@ var GameTable = function (_a) {
|
|
|
86
86
|
var vm = margin.top + margin.bottom;
|
|
87
87
|
var tableFontSize = 5;
|
|
88
88
|
var minScale = (100 - vm) / tableFontSize / (yMax - yMin);
|
|
89
|
+
var maxScale = minScale > 0.9 ? minScale : 1;
|
|
89
90
|
var ratio = (xMax - xMin) / (yMax - yMin);
|
|
90
91
|
var ratioWithMargins = ((100 - vm) * ratio + hm) / 100;
|
|
91
92
|
var panning = (0, react_2.useMemo)(function () { return ({ disabled: dragging }); }, [dragging]);
|
|
@@ -97,13 +98,14 @@ var GameTable = function (_a) {
|
|
|
97
98
|
width: "calc(100dvw - ".concat(hm, "em)"),
|
|
98
99
|
overflow: 'visible'
|
|
99
100
|
}); }, [margin, vm, hm, ratio]);
|
|
100
|
-
|
|
101
|
+
var modifiers = (0, react_2.useMemo)(function () { return snapToCenter ? [modifiers_1.snapCenterToCursor] : undefined; }, [snapToCenter]);
|
|
102
|
+
return ((0, jsx_runtime_1.jsxs)(core_1.DndContext, __assign({ collisionDetection: collisionAlgorithm, measuring: { draggable: { measure: core_1.getClientRect }, droppable: { measure: core_1.getClientRect } }, modifiers: modifiers, sensors: sensors, onDragStart: function () { return setDragging(true); }, onDragEnd: onDragEnd, onDragCancel: function () { return setDragging(false); } }, { children: [(0, jsx_runtime_1.jsx)(react_1.Global, { styles: ratioFontSize(ratioWithMargins) }), (0, jsx_runtime_1.jsx)(react_zoom_pan_pinch_1.TransformWrapper, __assign({ ref: ref, minScale: minScale, maxScale: maxScale, initialScale: minScale, centerOnInit: true, wheel: wheel, smooth: false, panning: panning, disablePadding: true, doubleClick: doubleClick }, { children: (0, jsx_runtime_1.jsx)(react_zoom_pan_pinch_1.TransformComponent, __assign({ wrapperStyle: wrapperStyle }, { children: (0, jsx_runtime_1.jsxs)("div", __assign({ css: [tableCss(xMin, xMax, yMin, yMax), (0, css_1.fontSizeCss)(tableFontSize), perspective && (0, css_1.perspectiveCss)(perspective)] }, props, { children: [(0, jsx_runtime_1.jsx)(GameMaterialDisplay_1.GameMaterialDisplay, { left: -xMin, top: -yMin }), children] })) })) }))] })));
|
|
101
103
|
};
|
|
102
104
|
exports.GameTable = GameTable;
|
|
103
105
|
function dataIsLocation(data) {
|
|
104
106
|
return typeof (data === null || data === void 0 ? void 0 : data.type) === 'number';
|
|
105
107
|
}
|
|
106
108
|
var ratioFontSize = function (ratio) { return (0, react_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n .react-transform-wrapper {\n font-size: 1dvh;\n @media (max-aspect-ratio: ", "/1) {\n font-size: calc(1dvw / ", ");\n }\n }\n"], ["\n .react-transform-wrapper {\n font-size: 1dvh;\n @media (max-aspect-ratio: ", "/1) {\n font-size: calc(1dvw / ", ");\n }\n }\n"])), ratio, ratio); };
|
|
107
|
-
var tableCss = function (xMin, xMax, yMin, yMax) { return (0, react_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n transform-style: preserve-3d;\n width: ", "em;\n height: ", "em;\n
|
|
109
|
+
var tableCss = function (xMin, xMax, yMin, yMax) { return (0, react_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n transform-style: preserve-3d;\n width: ", "em;\n height: ", "em;\n"], ["\n transform-style: preserve-3d;\n width: ", "em;\n height: ", "em;\n"])), xMax - xMin, yMax - yMin); };
|
|
108
110
|
var templateObject_1, templateObject_2;
|
|
109
111
|
//# sourceMappingURL=GameTable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GameTable.js","sourceRoot":"","sources":["../../../../src/components/material/GameTable/GameTable.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,sCAAiI;AACjI,gDAAuD;AACvD,wCAA4C;AAC5C,iDAA4D;AAC5D,+BAAoG;AACpG,6DAAwG;AACxG,oCAA0D;AAC1D,wCAA2E;AAC3E,8DAAyF;AACzF,0DAA0D;AAC1D,6DAA2D;
|
|
1
|
+
{"version":3,"file":"GameTable.js","sourceRoot":"","sources":["../../../../src/components/material/GameTable/GameTable.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,sCAAiI;AACjI,gDAAuD;AACvD,wCAA4C;AAC5C,iDAA4D;AAC5D,+BAAoG;AACpG,6DAAwG;AACxG,oCAA0D;AAC1D,wCAA2E;AAC3E,8DAAyF;AACzF,0DAA0D;AAC1D,6DAA2D;AAa3D,IAAM,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,IAAI,GAAG,IAAI,EACV,IAAI,GAAG,IAAI,GAHsD,CAI5E,CAAA"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
+
return cooked;
|
|
5
|
+
};
|
|
6
|
+
var __assign = (this && this.__assign) || function () {
|
|
7
|
+
__assign = Object.assign || function(t) {
|
|
8
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
9
|
+
s = arguments[i];
|
|
10
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
11
|
+
t[p] = s[p];
|
|
12
|
+
}
|
|
13
|
+
return t;
|
|
14
|
+
};
|
|
15
|
+
return __assign.apply(this, arguments);
|
|
16
|
+
};
|
|
17
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
18
|
+
var t = {};
|
|
19
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
20
|
+
t[p] = s[p];
|
|
21
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
22
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
23
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
24
|
+
t[p[i]] = s[p[i]];
|
|
25
|
+
}
|
|
26
|
+
return t;
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.GameTableNavigation = void 0;
|
|
30
|
+
var jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
31
|
+
var react_1 = require("@emotion/react");
|
|
32
|
+
var faSearchMinus_1 = require("@fortawesome/free-solid-svg-icons/faSearchMinus");
|
|
33
|
+
var faSearchPlus_1 = require("@fortawesome/free-solid-svg-icons/faSearchPlus");
|
|
34
|
+
var react_fontawesome_1 = require("@fortawesome/react-fontawesome");
|
|
35
|
+
var react_2 = require("react");
|
|
36
|
+
var react_dom_1 = require("react-dom");
|
|
37
|
+
var react_zoom_pan_pinch_1 = require("react-zoom-pan-pinch");
|
|
38
|
+
var css_1 = require("../../../css");
|
|
39
|
+
var GameTableNavigation = function (props) {
|
|
40
|
+
var _a = props.scaleStep, scaleStep = _a === void 0 ? 0.1 : _a, rest = __rest(props, ["scaleStep"]);
|
|
41
|
+
var _b = (0, react_zoom_pan_pinch_1.useControls)(), zoomIn = _b.zoomIn, zoomOut = _b.zoomOut;
|
|
42
|
+
var _c = (0, react_2.useState)(false), isMin = _c[0], setIsMin = _c[1];
|
|
43
|
+
var _d = (0, react_2.useState)(false), isMax = _d[0], setIsMax = _d[1];
|
|
44
|
+
(0, react_zoom_pan_pinch_1.useTransformEffect)(function (_a) {
|
|
45
|
+
var state = _a.state, instance = _a.instance;
|
|
46
|
+
setIsMin(state.scale === instance.props.minScale);
|
|
47
|
+
setIsMax(state.scale === instance.props.maxScale);
|
|
48
|
+
});
|
|
49
|
+
return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsxs)("div", __assign({ css: navigationContainer }, rest, { children: [(0, jsx_runtime_1.jsx)("button", __assign({ css: button, onClick: function () { return zoomIn(scaleStep); }, disabled: isMax }, { children: (0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { icon: faSearchPlus_1.faSearchPlus, css: iconCss }) })), (0, jsx_runtime_1.jsx)("button", __assign({ css: button, onClick: function () { return zoomOut(scaleStep); }, disabled: isMin }, { children: (0, jsx_runtime_1.jsx)(react_fontawesome_1.FontAwesomeIcon, { icon: faSearchMinus_1.faSearchMinus, css: iconCss }) }))] })), document.getElementById('root'));
|
|
50
|
+
};
|
|
51
|
+
exports.GameTableNavigation = GameTableNavigation;
|
|
52
|
+
var navigationContainer = (0, react_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: fixed;\n z-index: 1;\n display: flex;\n gap: 1em;\n top: 8em;\n left: 1em;\n color: white;\n transform: translateZ(100em);\n"], ["\n position: fixed;\n z-index: 1;\n display: flex;\n gap: 1em;\n top: 8em;\n left: 1em;\n color: white;\n transform: translateZ(100em);\n"])));
|
|
53
|
+
var button = [css_1.buttonResetCss, (0, react_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font-size: 3em;\n height: 2em;\n width: 2em;\n border-radius: 2em;\n transition: transform 0.1s ease-in-out;\n border: 0.1em solid white;\n color: inherit;\n background: transparent;\n padding: 0;\n filter: drop-shadow(0.1em 0.1em 0.05em black);\n\n &:disabled {\n color: #a0a0a0;\n border-color: #a0a0a0;\n }\n\n &:not(:disabled) {\n &:focus, &:hover {\n transform: scale(1.05);\n }\n\n &:active {\n transform: scale(1.05);\n background-color: rgba(0, 0, 0, 0.5);\n }\n }\n\n"], ["\n font-size: 3em;\n height: 2em;\n width: 2em;\n border-radius: 2em;\n transition: transform 0.1s ease-in-out;\n border: 0.1em solid white;\n color: inherit;\n background: transparent;\n padding: 0;\n filter: drop-shadow(0.1em 0.1em 0.05em black);\n\n &:disabled {\n color: #a0a0a0;\n border-color: #a0a0a0;\n }\n\n &:not(:disabled) {\n &:focus, &:hover {\n transform: scale(1.05);\n }\n\n &:active {\n transform: scale(1.05);\n background-color: rgba(0, 0, 0, 0.5);\n }\n }\n\n"])))];
|
|
54
|
+
var iconCss = (0, react_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n color: inherit;\n"], ["\n color: inherit;\n"])));
|
|
55
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
|
56
|
+
//# sourceMappingURL=GameTableNavigation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GameTableNavigation.js","sourceRoot":"","sources":["../../../../src/components/material/GameTable/GameTableNavigation.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,wCAAoC;AAC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mCAAe,IAAC,IAAI,EAAE,6BAAa,EAAE,GAAG,EAAE,OAAO,GAAG,IAC9C,KACL,EACN,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAE,CACjC,CAAA;AACH,CAAC,CAAA;AApBY,QAAA,mBAAmB,uBAoB/B;AAED,IAAM,mBAAmB,OAAG,WAAG,uNAAA,mJAS9B,IAAA,CAAA;AAED,IAAM,MAAM,GAAG,CAAC,oBAAc,MAAE,WAAG,olBAAA,ghBA4BlC,KAAC,CAAA;AAEF,IAAM,OAAO,OAAG,WAAG,2FAAA,uBAElB,IAAA,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { MaterialItem } from '@gamepark/rules-api';
|
|
3
|
+
export declare const ItemDisplay: import("react").ForwardRefExoticComponent<{
|
|
4
|
+
type: number;
|
|
5
|
+
itemId?: any;
|
|
6
|
+
onShortClick?: (() => void) | undefined;
|
|
7
|
+
onLongClick?: (() => void) | undefined;
|
|
8
|
+
highlight?: boolean | undefined;
|
|
9
|
+
playDown?: boolean | undefined;
|
|
10
|
+
} & import("react").HTMLAttributes<HTMLElement> & {
|
|
11
|
+
index: number;
|
|
12
|
+
displayIndex: number;
|
|
13
|
+
item: MaterialItem;
|
|
14
|
+
isFocused?: boolean | undefined;
|
|
15
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|