@gamepark/react-game 6.24.2 → 6.24.3
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 +4 -6
- package/dist/components/Avatar/Avatar.js +5 -4
- package/dist/components/Avatar/Avatar.js.map +1 -1
- package/dist/components/Avatar/ChatSpeechBubble.js +3 -2
- package/dist/components/Avatar/ChatSpeechBubble.js.map +1 -1
- package/dist/components/Avatar/SpeechBubble.d.ts +1 -0
- package/dist/components/Avatar/SpeechBubble.js +2 -1
- package/dist/components/Avatar/SpeechBubble.js.map +1 -1
- package/dist/components/GamePoints/GamePointIcon.js +1 -0
- package/dist/components/GamePoints/GamePointIcon.js.map +1 -1
- package/dist/components/GamePoints/GamePoints.js +1 -0
- package/dist/components/GamePoints/GamePoints.js.map +1 -1
- package/dist/components/GameProvider/GameContext.js +2 -1
- package/dist/components/GameProvider/GameContext.js.map +1 -1
- package/dist/components/GameProvider/GameProvider.js +3 -0
- package/dist/components/GameProvider/GameProvider.js.map +1 -1
- package/dist/components/Header/Header.d.ts +1 -0
- package/dist/components/Header/Header.js +3 -2
- package/dist/components/Header/Header.js.map +1 -1
- package/dist/components/Header/MaterialHeader.js +1 -0
- package/dist/components/Header/MaterialHeader.js.map +1 -1
- package/dist/components/ImagesLoader/ImagesLoader.js +1 -0
- package/dist/components/ImagesLoader/ImagesLoader.js.map +1 -1
- package/dist/components/JournalTabs/Chat/Chat.d.ts +1 -0
- package/dist/components/JournalTabs/Chat/ChatMessage.js +1 -0
- package/dist/components/JournalTabs/Chat/ChatMessage.js.map +1 -1
- package/dist/components/JournalTabs/Chat/ChatMessageAuthor.js +1 -0
- package/dist/components/JournalTabs/Chat/ChatMessageAuthor.js.map +1 -1
- package/dist/components/JournalTabs/Chat/ChatTextInput.js +1 -0
- package/dist/components/JournalTabs/Chat/ChatTextInput.js.map +1 -1
- package/dist/components/JournalTabs/Chat/CommonChat.js +1 -0
- package/dist/components/JournalTabs/Chat/CommonChat.js.map +1 -1
- package/dist/components/JournalTabs/Chat/SignInToChat.js +1 -0
- package/dist/components/JournalTabs/Chat/SignInToChat.js.map +1 -1
- package/dist/components/JournalTabs/History/GameOverHistory.js +1 -0
- package/dist/components/JournalTabs/History/GameOverHistory.js.map +1 -1
- package/dist/components/JournalTabs/History/History.js +2 -0
- package/dist/components/JournalTabs/History/History.js.map +1 -1
- package/dist/components/JournalTabs/History/HistoryEntry.js +1 -0
- package/dist/components/JournalTabs/History/HistoryEntry.js.map +1 -1
- package/dist/components/JournalTabs/History/StartGameHistory.js +1 -0
- package/dist/components/JournalTabs/History/StartGameHistory.js.map +1 -1
- package/dist/components/JournalTabs/JournalTabs.d.ts +1 -0
- package/dist/components/JournalTabs/JournalTabs.js +5 -1
- package/dist/components/JournalTabs/JournalTabs.js.map +1 -1
- package/dist/components/Letterbox/Letterbox.js +1 -0
- package/dist/components/Letterbox/Letterbox.js.map +1 -1
- package/dist/components/LoadingScreen/LoadingScreen.js +1 -0
- package/dist/components/LoadingScreen/LoadingScreen.js.map +1 -1
- package/dist/components/Picture/Picture.d.ts +1 -0
- package/dist/components/Picture/Picture.js +1 -0
- package/dist/components/Picture/Picture.js.map +1 -1
- package/dist/components/PlayerPanel/Counters.d.ts +1 -0
- package/dist/components/PlayerPanel/Counters.js +1 -0
- package/dist/components/PlayerPanel/Counters.js.map +1 -1
- package/dist/components/PlayerPanel/PlayerPanel.js +1 -0
- package/dist/components/PlayerPanel/PlayerPanel.js.map +1 -1
- package/dist/components/PlayerPanel/StyledPlayerPanel.d.ts +1 -0
- package/dist/components/PlayerPanel/StyledPlayerPanel.js +44 -16
- package/dist/components/PlayerPanel/StyledPlayerPanel.js.map +1 -1
- package/dist/components/PlayerTimer/PlayerTimer.d.ts +1 -0
- package/dist/components/PlayerTimer/PlayerTimer.js +1 -0
- package/dist/components/PlayerTimer/PlayerTimer.js.map +1 -1
- package/dist/components/buttons/PlayMoveButton/PlayMoveButton.js +1 -0
- package/dist/components/buttons/PlayMoveButton/PlayMoveButton.js.map +1 -1
- package/dist/components/buttons/ThemeButton/ThemeButton.d.ts +1 -0
- package/dist/components/buttons/UndoMovesButton/UndoMovesButton.d.ts +1 -0
- package/dist/components/dialogs/Dialog.d.ts +1 -0
- package/dist/components/dialogs/Dialog.js +3 -0
- package/dist/components/dialogs/Dialog.js.map +1 -1
- package/dist/components/dialogs/FailuresDialog.js +1 -0
- package/dist/components/dialogs/FailuresDialog.js.map +1 -1
- package/dist/components/dialogs/ResultDialog/RematchDisplay.js +1 -0
- package/dist/components/dialogs/ResultDialog/RematchDisplay.js.map +1 -1
- package/dist/components/dialogs/ResultDialog/RematchSection.js +1 -0
- package/dist/components/dialogs/ResultDialog/RematchSection.js.map +1 -1
- package/dist/components/dialogs/ResultDialog/ResultDialog.js +1 -0
- package/dist/components/dialogs/ResultDialog/ResultDialog.js.map +1 -1
- package/dist/components/dialogs/RulesDialog/LocationRulesDialogContent.js +1 -0
- package/dist/components/dialogs/RulesDialog/LocationRulesDialogContent.js.map +1 -1
- package/dist/components/dialogs/RulesDialog/MaterialRulesDialog.js +1 -0
- package/dist/components/dialogs/RulesDialog/MaterialRulesDialog.js.map +1 -1
- package/dist/components/dialogs/RulesDialog/MaterialRulesDialogContent.js +1 -0
- package/dist/components/dialogs/RulesDialog/MaterialRulesDialogContent.js.map +1 -1
- package/dist/components/dialogs/RulesDialog/RulesDialog.js +1 -0
- package/dist/components/dialogs/RulesDialog/RulesDialog.js.map +1 -1
- package/dist/components/dialogs/RulesDialog/RulesHelpDialogContent.js +1 -0
- package/dist/components/dialogs/RulesDialog/RulesHelpDialogContent.js.map +1 -1
- package/dist/components/material/ComponentDescription.d.ts +32 -0
- package/dist/components/material/ComponentDescription.js +15 -1
- package/dist/components/material/ComponentDescription.js.map +1 -1
- package/dist/components/material/Dices/CubicDiceDescription.d.ts +4 -4
- package/dist/components/material/Dices/CubicDiceDescription.js +6 -7
- package/dist/components/material/Dices/CubicDiceDescription.js.map +1 -1
- package/dist/components/material/DraggableMaterial.js +4 -0
- package/dist/components/material/DraggableMaterial.js.map +1 -1
- package/dist/components/material/FlatMaterial/BoardDescription.js +1 -1
- package/dist/components/material/FlatMaterial/CardDescription.js +3 -3
- package/dist/components/material/FlatMaterial/CardDescription.js.map +1 -1
- package/dist/components/material/FlatMaterial/FlatMaterial.d.ts +1 -0
- package/dist/components/material/FlatMaterial/FlatMaterial.js +2 -1
- package/dist/components/material/FlatMaterial/FlatMaterial.js.map +1 -1
- package/dist/components/material/FlatMaterial/MoneyDescription.d.ts +7 -0
- package/dist/components/material/FlatMaterial/MoneyDescription.js +39 -0
- package/dist/components/material/FlatMaterial/MoneyDescription.js.map +1 -0
- package/dist/components/material/FlatMaterial/TokenDescription.js +2 -2
- package/dist/components/material/FlatMaterial/index.d.ts +1 -0
- package/dist/components/material/FlatMaterial/index.js +1 -0
- package/dist/components/material/FlatMaterial/index.js.map +1 -1
- package/dist/components/material/GameTable/DynamicItemsDisplay.js +2 -1
- package/dist/components/material/GameTable/DynamicItemsDisplay.js.map +1 -1
- package/dist/components/material/GameTable/GameMaterialDisplay.js +1 -0
- 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 +1 -0
- package/dist/components/material/GameTable/GameTable.js.map +1 -1
- package/dist/components/material/GameTable/GameTableNavigation.js +1 -0
- package/dist/components/material/GameTable/GameTableNavigation.js.map +1 -1
- package/dist/components/material/GameTable/ItemDisplay.js +2 -1
- package/dist/components/material/GameTable/ItemDisplay.js.map +1 -1
- package/dist/components/material/GameTable/StaticItemsDisplay.d.ts +1 -0
- package/dist/components/material/GameTable/StaticLocationsDisplay.d.ts +1 -0
- package/dist/components/material/GameTable/focus/FocusProvider.js +1 -0
- package/dist/components/material/GameTable/focus/FocusProvider.js.map +1 -1
- package/dist/components/material/MaterialComponent.js +1 -0
- package/dist/components/material/MaterialComponent.js.map +1 -1
- package/dist/components/material/MaterialDescription.d.ts +119 -0
- package/dist/components/material/MaterialDescription.js +107 -1
- package/dist/components/material/MaterialDescription.js.map +1 -1
- package/dist/components/material/MobileMaterialDescription.d.ts +1 -0
- package/dist/components/material/MobileMaterialDescription.js +2 -1
- package/dist/components/material/MobileMaterialDescription.js.map +1 -1
- package/dist/components/material/Writing/WritingDescription.js +2 -1
- package/dist/components/material/Writing/WritingDescription.js.map +1 -1
- package/dist/components/material/animations/CreateItemAnimations.js +1 -1
- package/dist/components/material/animations/DeleteItemAnimations.js +5 -3
- package/dist/components/material/animations/DeleteItemAnimations.js.map +1 -1
- package/dist/components/material/animations/ItemAnimations.js +1 -1
- package/dist/components/material/animations/MaterialAnimations.js +1 -1
- package/dist/components/material/animations/MaterialGameAnimations.js +2 -2
- package/dist/components/material/animations/MoveItemAnimations.js +7 -5
- package/dist/components/material/animations/MoveItemAnimations.js.map +1 -1
- package/dist/components/material/animations/MoveItemAtOnceAnimations.js +2 -1
- package/dist/components/material/animations/MoveItemAtOnceAnimations.js.map +1 -1
- package/dist/components/material/animations/RollItemAnimations.js +4 -1
- package/dist/components/material/animations/RollItemAnimations.js.map +1 -1
- package/dist/components/material/animations/ShuffleAnimations.js +1 -1
- package/dist/components/material/animations/isMovedOrDeletedItem.util.d.ts +1 -1
- package/dist/components/material/animations/isMovedOrDeletedItem.util.js +1 -4
- package/dist/components/material/animations/isMovedOrDeletedItem.util.js.map +1 -1
- package/dist/components/material/animations/rotations.utils.js +23 -12
- package/dist/components/material/animations/rotations.utils.js.map +1 -1
- package/dist/components/material/locations/DropAreaDescription.js +1 -1
- package/dist/components/material/locations/LocationComponent.js +2 -1
- package/dist/components/material/locations/LocationComponent.js.map +1 -1
- package/dist/components/material/locations/LocationDescription.d.ts +7 -0
- package/dist/components/material/locations/LocationDescription.js +8 -1
- package/dist/components/material/locations/LocationDescription.js.map +1 -1
- package/dist/components/material/locations/LocationDisplay.js +1 -0
- package/dist/components/material/locations/LocationDisplay.js.map +1 -1
- package/dist/components/material/locations/SimpleDropArea.js +1 -0
- package/dist/components/material/locations/SimpleDropArea.js.map +1 -1
- package/dist/components/menus/EjectPlayer/EjectPlayerButton.js +1 -0
- package/dist/components/menus/EjectPlayer/EjectPlayerButton.js.map +1 -1
- package/dist/components/menus/EjectPlayer/EjectPlayerDialog.js +1 -0
- package/dist/components/menus/EjectPlayer/EjectPlayerDialog.js.map +1 -1
- package/dist/components/menus/EjectPlayer/EjectPlayerPopButton.js +1 -0
- package/dist/components/menus/EjectPlayer/EjectPlayerPopButton.js.map +1 -1
- package/dist/components/menus/Fullscreen/FullscreenButton.js +1 -0
- package/dist/components/menus/Fullscreen/FullscreenButton.js.map +1 -1
- package/dist/components/menus/Fullscreen/FullscreenDialog.js +1 -0
- package/dist/components/menus/Fullscreen/FullscreenDialog.js.map +1 -1
- package/dist/components/menus/Fullscreen/FullscreenPopButton.js +1 -0
- package/dist/components/menus/Fullscreen/FullscreenPopButton.js.map +1 -1
- package/dist/components/menus/GiveUpButton/GiveUpButton.js +1 -0
- package/dist/components/menus/GiveUpButton/GiveUpButton.js.map +1 -1
- package/dist/components/menus/Menu/Menu.js +1 -0
- package/dist/components/menus/Menu/Menu.js.map +1 -1
- package/dist/components/menus/Menu/MenuPopButton.js +1 -0
- package/dist/components/menus/Menu/MenuPopButton.js.map +1 -1
- package/dist/components/menus/Menu/NavButton.d.ts +1 -0
- package/dist/components/menus/PlayerQuit/TrackPlayersQuit.js +1 -0
- package/dist/components/menus/PlayerQuit/TrackPlayersQuit.js.map +1 -1
- package/dist/components/menus/RestartTutorialButton/RestartTutorialButton.js +1 -0
- package/dist/components/menus/RestartTutorialButton/RestartTutorialButton.js.map +1 -1
- package/dist/components/menus/Result/ResultButton.js +1 -0
- package/dist/components/menus/Result/ResultButton.js.map +1 -1
- package/dist/components/menus/Result/ResultPopButton.js +1 -0
- package/dist/components/menus/Result/ResultPopButton.js.map +1 -1
- package/dist/components/menus/SoundButton/SoundButton.js +1 -0
- package/dist/components/menus/SoundButton/SoundButton.js.map +1 -1
- package/dist/components/menus/TimeStatsButton/TimeStatsButton.js +1 -0
- package/dist/components/menus/TimeStatsButton/TimeStatsButton.js.map +1 -1
- package/dist/components/menus/UndoButton/UndoButton.js +1 -0
- package/dist/components/menus/UndoButton/UndoButton.js.map +1 -1
- package/dist/components/menus/UndoButton/UndoPopButton.js +1 -0
- package/dist/components/menus/UndoButton/UndoPopButton.js.map +1 -1
- package/dist/components/tutorial/MaterialTutorial.js +1 -1
- package/dist/components/tutorial/MaterialTutorialDisplay.js +1 -0
- package/dist/components/tutorial/MaterialTutorialDisplay.js.map +1 -1
- package/dist/components/tutorial/TutorialRulesWrapper.js +1 -0
- package/dist/components/tutorial/TutorialRulesWrapper.js.map +1 -1
- package/dist/hooks/useFullscreen.js +1 -0
- package/dist/hooks/useFullscreen.js.map +1 -1
- package/dist/hooks/useOpponentWithMaxTime.d.ts +3 -0
- package/dist/hooks/useOpponentWithMaxTime.js +3 -0
- package/dist/hooks/useOpponentWithMaxTime.js.map +1 -1
- package/dist/hooks/usePlayerTime.js +1 -1
- package/dist/hooks/usePlayerTime.js.map +1 -1
- package/dist/hooks/useResultText.js +1 -0
- package/dist/hooks/useResultText.js.map +1 -1
- package/dist/hooks/useSound.js +1 -0
- package/dist/hooks/useSound.js.map +1 -1
- package/dist/hooks/useWebP.js +2 -2
- package/dist/hooks/useWebP.js.map +1 -1
- package/dist/hooks/useZoomToElements.d.ts +3 -0
- package/dist/hooks/useZoomToElements.js +3 -0
- package/dist/hooks/useZoomToElements.js.map +1 -1
- package/dist/locators/DeckLocator.d.ts +3 -0
- package/dist/locators/DeckLocator.js +4 -1
- package/dist/locators/DeckLocator.js.map +1 -1
- package/dist/locators/FlexLocator.d.ts +39 -0
- package/dist/locators/FlexLocator.js +31 -1
- package/dist/locators/FlexLocator.js.map +1 -1
- package/dist/locators/HandLocator.d.ts +72 -0
- package/dist/locators/HandLocator.js +73 -1
- package/dist/locators/HandLocator.js.map +1 -1
- package/dist/locators/ListLocator.d.ts +36 -0
- package/dist/locators/ListLocator.js +28 -1
- package/dist/locators/ListLocator.js.map +1 -1
- package/dist/locators/Locator.d.ts +199 -1
- package/dist/locators/Locator.js +189 -1
- package/dist/locators/Locator.js.map +1 -1
- package/dist/locators/PileLocator.d.ts +30 -0
- package/dist/locators/PileLocator.js +31 -1
- package/dist/locators/PileLocator.js.map +1 -1
- package/dist/utilities/DeepPartial.d.ts +3 -0
- package/dist/utilities/combineEventListeners.d.ts +6 -0
- package/dist/utilities/combineEventListeners.js +6 -0
- package/dist/utilities/combineEventListeners.js.map +1 -1
- package/dist/utilities/findIfUnique.util.d.ts +6 -0
- package/dist/utilities/findIfUnique.util.js +6 -0
- package/dist/utilities/findIfUnique.util.js.map +1 -1
- package/dist/utilities/translation.util.d.ts +5 -0
- package/dist/utilities/translation.util.js +5 -0
- package/dist/utilities/translation.util.js.map +1 -1
- package/dist/utilities/zoom-pan-pinch/animations.constants.js +20 -0
- package/dist/utilities/zoom-pan-pinch/animations.constants.js.map +1 -1
- package/dist/utilities/zoom-pan-pinch/animations.util.js +7 -0
- package/dist/utilities/zoom-pan-pinch/animations.util.js.map +1 -1
- package/dist/utilities/zoom-pan-pinch/bounds.util.d.ts +10 -0
- package/dist/utilities/zoom-pan-pinch/bounds.util.js +8 -0
- package/dist/utilities/zoom-pan-pinch/bounds.util.js.map +1 -1
- package/dist/utilities/zoom-pan-pinch/calculation.util.d.ts +12 -0
- package/dist/utilities/zoom-pan-pinch/calculation.util.js +12 -0
- package/dist/utilities/zoom-pan-pinch/calculation.util.js.map +1 -1
- package/dist/utilities/zoom-pan-pinch/index.d.ts +4 -0
- package/dist/utilities/zoom-pan-pinch/index.js +4 -0
- package/dist/utilities/zoom-pan-pinch/index.js.map +1 -1
- package/dist/utilities/zoom-pan-pinch/zoom.util.d.ts +3 -0
- package/dist/utilities/zoom-pan-pinch/zoom.util.js +3 -0
- package/dist/utilities/zoom-pan-pinch/zoom.util.js.map +1 -1
- package/package.json +3 -3
package/dist/locators/Locator.js
CHANGED
|
@@ -15,23 +15,66 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.isItemContext = exports.Locator = void 0;
|
|
18
|
+
/** @jsxImportSource @emotion/react */
|
|
18
19
|
var rules_api_1 = require("@gamepark/rules-api");
|
|
19
20
|
var sumBy_1 = __importDefault(require("lodash/sumBy"));
|
|
20
21
|
var components_1 = require("../components");
|
|
21
|
-
|
|
22
|
+
/**
|
|
23
|
+
* A Locator is responsible for placing item and locations (such as drop areas) on the Game Table.
|
|
24
|
+
*/
|
|
25
|
+
var Locator = /** @class */ (function () {
|
|
26
|
+
/**
|
|
27
|
+
* With the constructor, you can create new locators in one line.
|
|
28
|
+
* @example `new Locator({ coordinates: { x: -10, y: -5 } })`
|
|
29
|
+
* @param clone Object to clone into the class
|
|
30
|
+
*/
|
|
22
31
|
function Locator(clone) {
|
|
32
|
+
/**
|
|
33
|
+
* Types of items placed by the locator since it was created
|
|
34
|
+
* @internal
|
|
35
|
+
* @protected
|
|
36
|
+
*/
|
|
23
37
|
this.itemTypes = [];
|
|
38
|
+
/**
|
|
39
|
+
* The rotation unit to use. See {@link getRotateZ}
|
|
40
|
+
*/
|
|
24
41
|
this.rotationUnit = 'deg';
|
|
42
|
+
/**
|
|
43
|
+
* Declare this field if you always need to display some locations that does not depend on the context. See {@link getLocations}.
|
|
44
|
+
*/
|
|
25
45
|
this.locations = [];
|
|
46
|
+
/**
|
|
47
|
+
* Position of the location on the parent item, in percentage. Use {@link getPositionOnParent} to provide a dynamic position.
|
|
48
|
+
*/
|
|
26
49
|
this.positionOnParent = { x: 50, y: 50 };
|
|
50
|
+
/**
|
|
51
|
+
* Coordinates of the location on the Game Table. Use {@link getCoordinates} to provide dynamic coordinates.
|
|
52
|
+
*/
|
|
27
53
|
this.coordinates = { x: 0, y: 0, z: 0 };
|
|
54
|
+
/**
|
|
55
|
+
* The default Z-axis rotation of the items or locations to place if {@link getRotateZ} is not overridden.
|
|
56
|
+
*/
|
|
28
57
|
this.rotateZ = 0;
|
|
58
|
+
/**
|
|
59
|
+
* How items in the same location area are sorted for the help dialog navigation arrows.
|
|
60
|
+
*/
|
|
29
61
|
this.navigationSorts = [function (item) { var _a; return (_a = item.location.x) !== null && _a !== void 0 ? _a : 0; }, function (item) { var _a; return (_a = item.location.y) !== null && _a !== void 0 ? _a : 0; }, function (item) { var _a; return (_a = item.location.z) !== null && _a !== void 0 ? _a : 0; }];
|
|
30
62
|
Object.assign(this, clone);
|
|
31
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Override this if you need to display some locations on the Game Table that depends on the context.
|
|
66
|
+
* By default, return any {@link location} or {@link locations}.
|
|
67
|
+
*/
|
|
32
68
|
Locator.prototype.getLocations = function (_context) {
|
|
33
69
|
return this.location ? [this.location] : this.locations;
|
|
34
70
|
};
|
|
71
|
+
/**
|
|
72
|
+
* @internal
|
|
73
|
+
* This function automatically create some drop location descriptions based on the context (dragged item, parent item).
|
|
74
|
+
*
|
|
75
|
+
* Do not override it but use {@link locationDescription},
|
|
76
|
+
* otherwise the images of the location descriptions will not be preloaded by the {@link MaterialImageLoader}.
|
|
77
|
+
*/
|
|
35
78
|
Locator.prototype.getLocationDescription = function (location, context) {
|
|
36
79
|
if (!this.locationDescription) {
|
|
37
80
|
if (this.parentItemType !== undefined && location.x === undefined && location.y === undefined && location.z === undefined) {
|
|
@@ -46,12 +89,27 @@ var Locator = (function () {
|
|
|
46
89
|
}
|
|
47
90
|
return this.locationDescription;
|
|
48
91
|
};
|
|
92
|
+
/**
|
|
93
|
+
* @internal This function provides a custom location description for the current dragged item.
|
|
94
|
+
*/
|
|
49
95
|
Locator.prototype.generateLocationDescriptionFromDraggedItem = function (_location, context) {
|
|
50
96
|
return new components_1.DropAreaDescription(context.material[context.type]);
|
|
51
97
|
};
|
|
98
|
+
/**
|
|
99
|
+
* This function can hide some items on the game table depending on the context.
|
|
100
|
+
* @param item The item
|
|
101
|
+
* @param context The context of the item
|
|
102
|
+
* @returns true if the item must be hidden
|
|
103
|
+
*/
|
|
52
104
|
Locator.prototype.hide = function (item, context) {
|
|
53
105
|
return this.limit ? this.getItemIndex(item, context) >= this.limit : false;
|
|
54
106
|
};
|
|
107
|
+
/**
|
|
108
|
+
* Provide a list of css transform operations to place a location on the game table.
|
|
109
|
+
* @param location Location to place
|
|
110
|
+
* @param context Context of the location in the game
|
|
111
|
+
* @returns the css transform that will be applied to the location
|
|
112
|
+
*/
|
|
55
113
|
Locator.prototype.placeLocation = function (location, context) {
|
|
56
114
|
var transform = [];
|
|
57
115
|
var _a = this.getLocationCoordinates(location, context), _b = _a.x, x = _b === void 0 ? 0 : _b, _c = _a.y, y = _c === void 0 ? 0 : _c, _d = _a.z, z = _d === void 0 ? 0 : _d;
|
|
@@ -66,6 +124,12 @@ var Locator = (function () {
|
|
|
66
124
|
transform.push('translateZ(5em)');
|
|
67
125
|
return transform;
|
|
68
126
|
};
|
|
127
|
+
/**
|
|
128
|
+
* Provide a list of css transform operations to place an item on the game table.
|
|
129
|
+
* @param item Item to place
|
|
130
|
+
* @param context Context of the item in the game
|
|
131
|
+
* @returns the css transform that will be applied to the item
|
|
132
|
+
*/
|
|
69
133
|
Locator.prototype.placeItem = function (item, context) {
|
|
70
134
|
if (!this.itemTypes.includes(context.type)) {
|
|
71
135
|
this.itemTypes.push(context.type);
|
|
@@ -81,6 +145,12 @@ var Locator = (function () {
|
|
|
81
145
|
}
|
|
82
146
|
return transform;
|
|
83
147
|
};
|
|
148
|
+
/**
|
|
149
|
+
* Provide a list of css transform operations to place an item on a parent item.
|
|
150
|
+
* @param item Item to place
|
|
151
|
+
* @param context Context of the item in the game
|
|
152
|
+
* @returns the css transform that will be applied to the item
|
|
153
|
+
*/
|
|
84
154
|
Locator.prototype.placeItemOnParent = function (item, context) {
|
|
85
155
|
var _a;
|
|
86
156
|
var parentItem = this.getParentItem(item.location, context);
|
|
@@ -97,6 +167,12 @@ var Locator = (function () {
|
|
|
97
167
|
}
|
|
98
168
|
return transform;
|
|
99
169
|
};
|
|
170
|
+
/**
|
|
171
|
+
* If a location belongs to an item, returns the item
|
|
172
|
+
* @param location A location
|
|
173
|
+
* @param context Context of the game
|
|
174
|
+
* @returns the parent item of the location if any
|
|
175
|
+
*/
|
|
100
176
|
Locator.prototype.getParentItem = function (location, _a) {
|
|
101
177
|
var _b;
|
|
102
178
|
var rules = _a.rules, material = _a.material;
|
|
@@ -106,45 +182,157 @@ var Locator = (function () {
|
|
|
106
182
|
return (_b = material[this.parentItemType]) === null || _b === void 0 ? void 0 : _b.staticItem;
|
|
107
183
|
return rules.material(this.parentItemType).getItem(location.parent);
|
|
108
184
|
};
|
|
185
|
+
/**
|
|
186
|
+
* Place the center of the item in the plan of their parent item. This is ignored if "parentItemType" is undefined.
|
|
187
|
+
* Examples: {x: 0, y: 0} places the center of the item in the top-left corner of the parent item
|
|
188
|
+
* {x: 50, y: 50} centers the item in the parent item.
|
|
189
|
+
*
|
|
190
|
+
* @param _location Location of the item or area inside the parent item
|
|
191
|
+
* @param _context THe material game context
|
|
192
|
+
* @return {x, y} with "x" as a percentage from the parent's width, "y" a percentage of the height
|
|
193
|
+
*/
|
|
109
194
|
Locator.prototype.getPositionOnParent = function (_location, _context) {
|
|
110
195
|
return this.positionOnParent;
|
|
111
196
|
};
|
|
197
|
+
/**
|
|
198
|
+
* Provide the coordinates of a location on the Game Table.
|
|
199
|
+
*
|
|
200
|
+
* Called by {@link getLocationCoordinates} but can be used as the Hand, List or Pile "initial" position in subclasses.
|
|
201
|
+
*
|
|
202
|
+
* @param _location Location to position
|
|
203
|
+
* @param _context Context of the game
|
|
204
|
+
* @returns the x, y, z coordinates (in cm) of the location
|
|
205
|
+
*/
|
|
112
206
|
Locator.prototype.getCoordinates = function (_location, _context) {
|
|
113
207
|
return this.coordinates;
|
|
114
208
|
};
|
|
209
|
+
/**
|
|
210
|
+
* Provide the coordinates of a location on the Game Table.
|
|
211
|
+
*
|
|
212
|
+
* Fallback to {@link getCoordinates} but the differences appear in subclasses {@link ListLocator}, {@link PileLocator}, {@link HandLocator}.
|
|
213
|
+
*
|
|
214
|
+
* @param location Location to position
|
|
215
|
+
* @param context Context of the game
|
|
216
|
+
* @returns the x, y, z coordinates (in cm) of the location
|
|
217
|
+
*/
|
|
115
218
|
Locator.prototype.getLocationCoordinates = function (location, context) {
|
|
116
219
|
return this.getCoordinates(location, context);
|
|
117
220
|
};
|
|
221
|
+
/**
|
|
222
|
+
* Provide the coordinates of the center of an item on the Game Table.
|
|
223
|
+
*
|
|
224
|
+
* @param item Item being placed
|
|
225
|
+
* @param context Context of the item in the game
|
|
226
|
+
* @return The x, y, z coordinates in cm of the center of the item on the table
|
|
227
|
+
*/
|
|
118
228
|
Locator.prototype.getItemCoordinates = function (item, context) {
|
|
119
229
|
return this.getLocationCoordinates(item.location, context);
|
|
120
230
|
};
|
|
231
|
+
/**
|
|
232
|
+
* Get the Z-axis rotation of a location.
|
|
233
|
+
* @param _location Location to place
|
|
234
|
+
* @param _context Context of the location
|
|
235
|
+
* @returns the rotation (unit in {@link rotationUnit})
|
|
236
|
+
*/
|
|
121
237
|
Locator.prototype.getRotateZ = function (_location, _context) {
|
|
122
238
|
return this.rotateZ;
|
|
123
239
|
};
|
|
240
|
+
/**
|
|
241
|
+
* Get the Z-axis rotation of an item. Defaults to {@link getRotateZ}.
|
|
242
|
+
* @param item item to place
|
|
243
|
+
* @param context Context of the item
|
|
244
|
+
* @returns the rotation (unit in {@link rotationUnit})
|
|
245
|
+
*/
|
|
124
246
|
Locator.prototype.getItemRotateZ = function (item, context) {
|
|
125
247
|
return this.getRotateZ(item.location, context);
|
|
126
248
|
};
|
|
249
|
+
/**
|
|
250
|
+
* The index of a location to place, if it matters in the locator's context (see {@link HandLocator}, {@link ListLocator} or {@link PileLocator}).
|
|
251
|
+
*
|
|
252
|
+
* Defaults to location.x first, y otherwise, z last.
|
|
253
|
+
*
|
|
254
|
+
* @param location Location to index in the location area (see {@link isSameLocationArea})
|
|
255
|
+
* @param _context Context of the game
|
|
256
|
+
* @returns the index of the location in the location area
|
|
257
|
+
*/
|
|
127
258
|
Locator.prototype.getLocationIndex = function (location, _context) {
|
|
128
259
|
var _a, _b;
|
|
129
260
|
return (_b = (_a = location.x) !== null && _a !== void 0 ? _a : location.y) !== null && _b !== void 0 ? _b : location.z;
|
|
130
261
|
};
|
|
262
|
+
/**
|
|
263
|
+
* Index of an item to place (fallback to {@link getLocationIndex} or item's displayIndex).
|
|
264
|
+
* @param item Item to place
|
|
265
|
+
* @param context Context of the item
|
|
266
|
+
* @returns the index of the item in the location area
|
|
267
|
+
*/
|
|
131
268
|
Locator.prototype.getItemIndex = function (item, context) {
|
|
132
269
|
var _a;
|
|
133
270
|
return (_a = this.getLocationIndex(item.location, context)) !== null && _a !== void 0 ? _a : context.displayIndex;
|
|
134
271
|
};
|
|
272
|
+
/**
|
|
273
|
+
* The total number of items in the same location area (see {@link isSameLocationArea}).
|
|
274
|
+
*
|
|
275
|
+
* @param location the location area
|
|
276
|
+
* @param context Context of the game
|
|
277
|
+
* @returns the total number of items in the location area
|
|
278
|
+
*/
|
|
135
279
|
Locator.prototype.countItems = function (location, _a) {
|
|
136
280
|
var rules = _a.rules;
|
|
137
281
|
return (0, sumBy_1.default)(this.itemTypes, function (type) { return rules.material(type).location(function (itemLocation) { return (0, rules_api_1.isSameLocationArea)(itemLocation, location); }).getQuantity(); });
|
|
138
282
|
};
|
|
283
|
+
/**
|
|
284
|
+
* Any css transform to apply to the item when it is hovered by the pointer. See {@link HandLocator} override for example.
|
|
285
|
+
* @param _item The item
|
|
286
|
+
* @param _context Context of the item
|
|
287
|
+
* @returns the list of css transforms
|
|
288
|
+
*/
|
|
139
289
|
Locator.prototype.getHoverTransform = function (_item, _context) {
|
|
140
290
|
return [];
|
|
141
291
|
};
|
|
292
|
+
/**
|
|
293
|
+
* How items in the same location area are sorted for the help dialog navigation arrows.
|
|
294
|
+
* @param _context Context of the game
|
|
295
|
+
* @returns The list of sort functions to sort the items.
|
|
296
|
+
*/
|
|
142
297
|
Locator.prototype.getNavigationSorts = function (_context) {
|
|
143
298
|
return this.navigationSorts;
|
|
144
299
|
};
|
|
300
|
+
/**
|
|
301
|
+
* Utility function for animation to know if the item is one that should be animated.
|
|
302
|
+
* @param item Item to consider
|
|
303
|
+
* @param context Context of the Item
|
|
304
|
+
* @param move Move to animate
|
|
305
|
+
* @returns true if the items must be animated
|
|
306
|
+
*/
|
|
307
|
+
Locator.prototype.isItemToAnimate = function (item, context, move) {
|
|
308
|
+
var _a, _b;
|
|
309
|
+
var rules = context.rules, type = context.type, index = context.index, displayIndex = context.displayIndex;
|
|
310
|
+
if (move.itemType !== type || move.itemIndex !== index)
|
|
311
|
+
return false;
|
|
312
|
+
var quantity = (_a = item.quantity) !== null && _a !== void 0 ? _a : 1;
|
|
313
|
+
var movedQuantity = (_b = move.quantity) !== null && _b !== void 0 ? _b : 1;
|
|
314
|
+
if (quantity === movedQuantity)
|
|
315
|
+
return true;
|
|
316
|
+
// If we move only a part of the quantity, we need to find which displayed items should move
|
|
317
|
+
var droppedItem = rules.game.droppedItem;
|
|
318
|
+
var itemsNotMoving = this.limit ? Math.min(quantity, this.limit) - movedQuantity : quantity - movedQuantity;
|
|
319
|
+
if ((droppedItem === null || droppedItem === void 0 ? void 0 : droppedItem.type) === type && droppedItem.index === index) {
|
|
320
|
+
var droppedIndex = droppedItem.displayIndex;
|
|
321
|
+
if (displayIndex === droppedIndex)
|
|
322
|
+
return true;
|
|
323
|
+
if (droppedIndex < itemsNotMoving)
|
|
324
|
+
itemsNotMoving++;
|
|
325
|
+
}
|
|
326
|
+
return this.getItemIndex(item, context) >= itemsNotMoving;
|
|
327
|
+
};
|
|
145
328
|
return Locator;
|
|
146
329
|
}());
|
|
147
330
|
exports.Locator = Locator;
|
|
331
|
+
/**
|
|
332
|
+
* Type guard to test if some MaterialContext is also an item context.
|
|
333
|
+
* @param context Context of the game
|
|
334
|
+
* @returns true if the context also hold information about a specific item in the game.
|
|
335
|
+
*/
|
|
148
336
|
function isItemContext(context) {
|
|
149
337
|
var itemContext = context;
|
|
150
338
|
return itemContext.type !== undefined && itemContext.index !== undefined && itemContext.displayIndex !== undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Locator.js","sourceRoot":"","sources":["../../src/locators/Locator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"Locator.js","sourceRoot":"","sources":["../../src/locators/Locator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,sCAAsC;AACtC,iDAAgK;AAChK,uDAAgC;AAChC,4CAAmG;AAInG;;GAEG;AACH;IAEE;;;;OAIG;IACH,iBAAY,KAAwB;QAIpC;;;;WAIG;QACO,cAAS,GAAQ,EAAE,CAAA;QAY7B;;WAEG;QACH,iBAAY,GAAW,KAAK,CAAA;QAO5B;;WAEG;QACH,cAAS,GAAqB,EAAE,CAAA;QAgIhC;;WAEG;QACH,qBAAgB,GAAkB,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAA;QAelD;;WAEG;QACH,gBAAW,GAAyB,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAA;QAuCxD;;WAEG;QACH,YAAO,GAAW,CAAC,CAAA;QAkEnB;;WAEG;QACH,oBAAe,GAAmB,CAAC,UAAC,IAAI,YAAK,OAAA,MAAA,IAAI,CAAC,QAAQ,CAAC,CAAC,mCAAI,CAAC,CAAA,EAAA,EAAE,UAAC,IAAI,YAAK,OAAA,MAAA,IAAI,CAAC,QAAQ,CAAC,CAAC,mCAAI,CAAC,CAAA,EAAA,EAAE,UAAC,IAAI,YAAK,OAAA,MAAA,IAAI,CAAC,QAAQ,CAAC,CAAC,mCAAI,CAAC,CAAA,EAAA,CAAC,CAAA;QArSh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AY,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,cAAc,CAAA;IAC3D,CAAC;IACH,cAAC;AAAD,CAAC,AA/UD,IA+UC;AA/UY,0BAAO;AA4WpB;;;;GAIG;AACH,SAAgB,aAAa,CAC3B,OAAiC;IAEjC,IAAM,WAAW,GAAG,OAA+B,CAAA;IACnD,OAAO,WAAW,CAAC,IAAI,KAAK,SAAS,IAAI,WAAW,CAAC,KAAK,KAAK,SAAS,IAAI,WAAW,CAAC,YAAY,KAAK,SAAS,CAAA;AACpH,CAAC;AALD,sCAKC"}
|
|
@@ -1,15 +1,45 @@
|
|
|
1
1
|
import { Coordinates, Location, MaterialItem, XYCoordinates } from '@gamepark/rules-api';
|
|
2
2
|
import { LocationDescription } from '../components';
|
|
3
3
|
import { ItemContext, Locator, MaterialContext } from './Locator';
|
|
4
|
+
/**
|
|
5
|
+
* This Locator places items in a disorganised pile.
|
|
6
|
+
*/
|
|
4
7
|
export declare class PileLocator<P extends number = number, M extends number = number, L extends number = number> extends Locator<P, M, L> {
|
|
5
8
|
constructor(clone?: Partial<PileLocator>);
|
|
6
9
|
private positions;
|
|
7
10
|
private rotations;
|
|
11
|
+
/**
|
|
12
|
+
* By default, a maximum of 20 items are displayed
|
|
13
|
+
*/
|
|
8
14
|
limit: number;
|
|
15
|
+
/**
|
|
16
|
+
* Maximum dispersion radius of the items.
|
|
17
|
+
*/
|
|
9
18
|
radius: number | XYCoordinates;
|
|
19
|
+
/**
|
|
20
|
+
* Function to override to provide a {@link radius} that depends on the context
|
|
21
|
+
* @param _location Location to position
|
|
22
|
+
* @param _context Context of the game
|
|
23
|
+
* @returns the maximum dispersion radius of the items.
|
|
24
|
+
*/
|
|
10
25
|
getRadius(_location: Location<P, L>, _context: MaterialContext<P, M, L>): number | XYCoordinates;
|
|
26
|
+
/**
|
|
27
|
+
* Maximum angle of rotation of the items. Defaults to 180, bidirectional so items can have any rotation.
|
|
28
|
+
*/
|
|
11
29
|
maxAngle: number;
|
|
30
|
+
/**
|
|
31
|
+
* Function to override to provide a {@link maxAngle} that depends on the context
|
|
32
|
+
* @param _location Location to position
|
|
33
|
+
* @param _context Context of the game
|
|
34
|
+
* @returns the maximum angle of rotation of the items
|
|
35
|
+
*/
|
|
12
36
|
getMaxAngle(_location: Location<P, L>, _context: MaterialContext<P, M, L>): number;
|
|
37
|
+
/**
|
|
38
|
+
* Identifier of the pile. By default, distinct location areas (different player, id or parent) forms distinct piles.
|
|
39
|
+
* @param item Item to position
|
|
40
|
+
* @param _context Context of the item
|
|
41
|
+
* @returns a unique identifier for the pile of items this location goes to
|
|
42
|
+
*/
|
|
13
43
|
getPileId(item: MaterialItem<P, L>, _context: ItemContext<P, M, L>): string;
|
|
14
44
|
getItemCoordinates(item: MaterialItem<P, L>, context: ItemContext<P, M, L>): Partial<Coordinates>;
|
|
15
45
|
getItemRotateZ(item: MaterialItem<P, L>, context: ItemContext<P, M, L>): number;
|
|
@@ -18,24 +18,54 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
18
|
exports.PileLocator = void 0;
|
|
19
19
|
var components_1 = require("../components");
|
|
20
20
|
var Locator_1 = require("./Locator");
|
|
21
|
-
|
|
21
|
+
/**
|
|
22
|
+
* This Locator places items in a disorganised pile.
|
|
23
|
+
*/
|
|
24
|
+
var PileLocator = /** @class */ (function (_super) {
|
|
22
25
|
__extends(PileLocator, _super);
|
|
23
26
|
function PileLocator(clone) {
|
|
24
27
|
var _this = _super.call(this) || this;
|
|
25
28
|
_this.positions = new Map();
|
|
26
29
|
_this.rotations = new Map();
|
|
30
|
+
/**
|
|
31
|
+
* By default, a maximum of 20 items are displayed
|
|
32
|
+
*/
|
|
27
33
|
_this.limit = 20;
|
|
34
|
+
/**
|
|
35
|
+
* Maximum dispersion radius of the items.
|
|
36
|
+
*/
|
|
28
37
|
_this.radius = 0;
|
|
38
|
+
/**
|
|
39
|
+
* Maximum angle of rotation of the items. Defaults to 180, bidirectional so items can have any rotation.
|
|
40
|
+
*/
|
|
29
41
|
_this.maxAngle = 180;
|
|
30
42
|
Object.assign(_this, clone);
|
|
31
43
|
return _this;
|
|
32
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Function to override to provide a {@link radius} that depends on the context
|
|
47
|
+
* @param _location Location to position
|
|
48
|
+
* @param _context Context of the game
|
|
49
|
+
* @returns the maximum dispersion radius of the items.
|
|
50
|
+
*/
|
|
33
51
|
PileLocator.prototype.getRadius = function (_location, _context) {
|
|
34
52
|
return this.radius;
|
|
35
53
|
};
|
|
54
|
+
/**
|
|
55
|
+
* Function to override to provide a {@link maxAngle} that depends on the context
|
|
56
|
+
* @param _location Location to position
|
|
57
|
+
* @param _context Context of the game
|
|
58
|
+
* @returns the maximum angle of rotation of the items
|
|
59
|
+
*/
|
|
36
60
|
PileLocator.prototype.getMaxAngle = function (_location, _context) {
|
|
37
61
|
return this.maxAngle;
|
|
38
62
|
};
|
|
63
|
+
/**
|
|
64
|
+
* Identifier of the pile. By default, distinct location areas (different player, id or parent) forms distinct piles.
|
|
65
|
+
* @param item Item to position
|
|
66
|
+
* @param _context Context of the item
|
|
67
|
+
* @returns a unique identifier for the pile of items this location goes to
|
|
68
|
+
*/
|
|
39
69
|
PileLocator.prototype.getPileId = function (item, _context) {
|
|
40
70
|
return [item.location.player, item.location.id, item.location.parent].filter(function (part) { return part !== undefined; }).join('_');
|
|
41
71
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PileLocator.js","sourceRoot":"","sources":["../../src/locators/PileLocator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,4CAAyF;AACzF,qCAAiE;
|
|
1
|
+
{"version":3,"file":"PileLocator.js","sourceRoot":"","sources":["../../src/locators/PileLocator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,4CAAyF;AACzF,qCAAiE;AAEjE;;GAEG;AACH;IAAkH,+BAAgB;IAEhI,qBAAY,KAA4B;QAAxC,YACE,iBAAO,SAER;QAEO,eAAS,GAA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,OAAO,IAAI,gCAAmB,CAAC,eAAe,CAAC,CAAA;SAChD;aAAM;YACL,IAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;YACnC,IAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;YAChD,OAAO,IAAI,gCAAmB,CAAC;gBAC7B,KAAK,EAAE,GAAG,GAAG,CAAC,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;gBACrE,MAAM,EAAE,GAAG,GAAG,CAAC,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;gBACtE,YAAY,EAAE,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;aAC7F,CAAC,CAAA;SACH;IACH,CAAC;IACH,kBAAC;AAAD,CAAC,AAvGD,CAAkH,iBAAO,GAuGxH;AAvGY,kCAAW"}
|
|
@@ -1 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Combines listeners returned by useLongPress hook (onClick, onMouseDown...) with existing properties in order for both functions to be called.
|
|
3
|
+
* @param listeners Listener functions
|
|
4
|
+
* @param props React component properties
|
|
5
|
+
* @returns the properties but if listeners and props contains the same function, both will be called (listener first, then props once which returns the value)
|
|
6
|
+
*/
|
|
1
7
|
export declare function combineEventListeners<T extends Object>(listeners: T, props: Record<string, any>): T;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.combineEventListeners = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Combines listeners returned by useLongPress hook (onClick, onMouseDown...) with existing properties in order for both functions to be called.
|
|
6
|
+
* @param listeners Listener functions
|
|
7
|
+
* @param props React component properties
|
|
8
|
+
* @returns the properties but if listeners and props contains the same function, both will be called (listener first, then props once which returns the value)
|
|
9
|
+
*/
|
|
4
10
|
function combineEventListeners(listeners, props) {
|
|
5
11
|
return Object.entries(listeners).reduce(function (result, _a) {
|
|
6
12
|
var key = _a[0], value = _a[1];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combineEventListeners.js","sourceRoot":"","sources":["../../src/utilities/combineEventListeners.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"combineEventListeners.js","sourceRoot":"","sources":["../../src/utilities/combineEventListeners.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,SAAgB,qBAAqB,CAAmB,SAAY,EAAE,KAA0B;IAC9F,OAAO,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,UAAC,MAAM,EAAE,EAAY;YAAX,GAAG,QAAA,EAAE,KAAK,QAAA;QAC1D,MAAM,CAAC,GAAG,CAAC,GAAG,OAAO,KAAK,CAAC,GAAG,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC;YAAC,cAAY;iBAAZ,UAAY,EAAZ,qBAAY,EAAZ,IAAY;gBAAZ,yBAAY;;YAC5D,KAAK,eAAI,IAAI,EAAC;YACd,OAAO,KAAK,CAAC,GAAG,CAAC,OAAV,KAAK,EAAS,IAAI,EAAC;QAC5B,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;QACT,OAAO,MAAM,CAAA;IACf,CAAC,EAAE,EAAE,CAAM,CAAA;AACb,CAAC;AARD,sDAQC"}
|
|
@@ -1 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Search for a value that match a predicate in a collection, but only return the match if it is the only match in the collection
|
|
3
|
+
* @param collection Array of values
|
|
4
|
+
* @param predicate Predicate function to test the value
|
|
5
|
+
* @returns Matching item if and only if it is the only matching item
|
|
6
|
+
*/
|
|
1
7
|
export declare function findIfUnique<T>(collection: ArrayLike<T>, predicate: (value: T, index: number, collection: ArrayLike<T>) => boolean): T | undefined;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.findIfUnique = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Search for a value that match a predicate in a collection, but only return the match if it is the only match in the collection
|
|
6
|
+
* @param collection Array of values
|
|
7
|
+
* @param predicate Predicate function to test the value
|
|
8
|
+
* @returns Matching item if and only if it is the only matching item
|
|
9
|
+
*/
|
|
4
10
|
function findIfUnique(collection, predicate) {
|
|
5
11
|
var result = undefined;
|
|
6
12
|
for (var i = 0; i < collection.length; i++) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findIfUnique.util.js","sourceRoot":"","sources":["../../src/utilities/findIfUnique.util.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"findIfUnique.util.js","sourceRoot":"","sources":["../../src/utilities/findIfUnique.util.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,SAAgB,YAAY,CAAI,UAAwB,EAAE,SAAyE;IACjI,IAAI,MAAM,GAAG,SAAS,CAAA;IACtB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC1C,IAAM,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAA;QACvB,IAAI,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,EAAE;YAC/B,IAAI,MAAM,KAAK,SAAS;gBAAE,OAAO,SAAS,CAAA;YAC1C,MAAM,GAAG,CAAC,CAAA;SACX;KACF;IACD,OAAO,MAAM,CAAA;AACf,CAAC;AAVD,oCAUC"}
|
|
@@ -2,4 +2,9 @@ import { InitOptions, Resource } from 'i18next';
|
|
|
2
2
|
import 'dayjs/locale/de';
|
|
3
3
|
import 'dayjs/locale/fr';
|
|
4
4
|
import 'dayjs/locale/ru';
|
|
5
|
+
/**
|
|
6
|
+
* Setup i18next global instance.
|
|
7
|
+
* @param translations The translation mapping
|
|
8
|
+
* @param options i18next options
|
|
9
|
+
*/
|
|
5
10
|
export declare const setupTranslation: (translations: Resource, options?: InitOptions) => void;
|
|
@@ -22,6 +22,11 @@ require("dayjs/locale/de");
|
|
|
22
22
|
require("dayjs/locale/fr");
|
|
23
23
|
require("dayjs/locale/ru");
|
|
24
24
|
var react_i18next_1 = require("react-i18next");
|
|
25
|
+
/**
|
|
26
|
+
* Setup i18next global instance.
|
|
27
|
+
* @param translations The translation mapping
|
|
28
|
+
* @param options i18next options
|
|
29
|
+
*/
|
|
25
30
|
var setupTranslation = function (translations, options) {
|
|
26
31
|
i18next_1.default.use(react_i18next_1.initReactI18next).use(i18next_icu_1.default);
|
|
27
32
|
var query = new URLSearchParams(window.location.search);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translation.util.js","sourceRoot":"","sources":["../../src/utilities/translation.util.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oDAAsD;AACtD,4DAA6B;AAC7B,gDAAyB;AACzB,2BAAwB;AACxB,2BAAwB;AACxB,2BAAwB;AACxB,+CAA8C;
|
|
1
|
+
{"version":3,"file":"translation.util.js","sourceRoot":"","sources":["../../src/utilities/translation.util.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oDAAsD;AACtD,4DAA6B;AAC7B,gDAAyB;AACzB,2BAAwB;AACxB,2BAAwB;AACxB,2BAAwB;AACxB,+CAA8C;AAE9C;;;;GAIG;AACI,IAAM,gBAAgB,GAAG,UAAC,YAAsB,EAAE,OAAqB;IAC5E,iBAAO,CAAC,GAAG,CAAC,gCAAgB,CAAC,CAAC,GAAG,CAAC,qBAAG,CAAC,CAAA;IAEtC,IAAM,KAAK,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IACzD,IAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAA;IAE1C,iBAAO,CAAC,IAAI,YACV,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAC7C,WAAW,EAAE,IAAI,EACjB,YAAY,EAAE,KAAK,EACnB,WAAW,EAAE,KAAK,EAClB,SAAS,EAAE,YAAY,IACpB,OAAO,EACV,CAAC,KAAK,CAAC,UAAA,KAAK,IAAI,OAAA,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,EAApB,CAAoB,CAAC,CAAA;IAEvC,eAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;AACtB,CAAC,CAAA;AAjBY,QAAA,gBAAgB,oBAiB5B"}
|
|
@@ -1,45 +1,65 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.animations = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Comes from https://github.com/prc5/react-zoom-pan-pinch/blob/master/src/core/animations/animations.constants.ts
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Functions should return denominator of the target value, which is the next animation step.
|
|
9
|
+
* t is a value from 0 to 1, reflecting the percentage of animation status.
|
|
10
|
+
*/
|
|
4
11
|
var easeOut = function (t) {
|
|
5
12
|
return -Math.cos(t * Math.PI) / 2 + 0.5;
|
|
6
13
|
};
|
|
14
|
+
// linear
|
|
7
15
|
var linear = function (t) {
|
|
8
16
|
return t;
|
|
9
17
|
};
|
|
18
|
+
// accelerating from zero velocity
|
|
10
19
|
var easeInQuad = function (t) {
|
|
11
20
|
return t * t;
|
|
12
21
|
};
|
|
22
|
+
// decelerating to zero velocity
|
|
13
23
|
var easeOutQuad = function (t) {
|
|
14
24
|
return t * (2 - t);
|
|
15
25
|
};
|
|
26
|
+
// acceleration until halfway, then deceleration
|
|
16
27
|
var easeInOutQuad = function (t) {
|
|
17
28
|
return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
|
|
18
29
|
};
|
|
30
|
+
// accelerating from zero velocity
|
|
19
31
|
var easeInCubic = function (t) {
|
|
20
32
|
return t * t * t;
|
|
21
33
|
};
|
|
34
|
+
// decelerating to zero velocity
|
|
22
35
|
var easeOutCubic = function (t) {
|
|
23
36
|
return --t * t * t + 1;
|
|
24
37
|
};
|
|
38
|
+
// acceleration until halfway, then deceleration
|
|
25
39
|
var easeInOutCubic = function (t) {
|
|
26
40
|
return t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
|
|
27
41
|
};
|
|
42
|
+
// accelerating from zero velocity
|
|
28
43
|
var easeInQuart = function (t) {
|
|
29
44
|
return t * t * t * t;
|
|
30
45
|
};
|
|
46
|
+
// decelerating to zero velocity
|
|
31
47
|
var easeOutQuart = function (t) {
|
|
32
48
|
return 1 - --t * t * t * t;
|
|
33
49
|
};
|
|
50
|
+
// acceleration until halfway, then deceleration
|
|
34
51
|
var easeInOutQuart = function (t) {
|
|
35
52
|
return t < 0.5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t;
|
|
36
53
|
};
|
|
54
|
+
// accelerating from zero velocity
|
|
37
55
|
var easeInQuint = function (t) {
|
|
38
56
|
return t * t * t * t * t;
|
|
39
57
|
};
|
|
58
|
+
// decelerating to zero velocity
|
|
40
59
|
var easeOutQuint = function (t) {
|
|
41
60
|
return 1 + --t * t * t * t * t;
|
|
42
61
|
};
|
|
62
|
+
// acceleration until halfway, then deceleration
|
|
43
63
|
var easeInOutQuint = function (t) {
|
|
44
64
|
return t < 0.5 ? 16 * t * t * t * t * t : 1 + 16 * --t * t * t * t * t;
|
|
45
65
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animations.constants.js","sourceRoot":"","sources":["../../../src/utilities/zoom-pan-pinch/animations.constants.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"animations.constants.js","sourceRoot":"","sources":["../../../src/utilities/zoom-pan-pinch/animations.constants.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH;;;GAGG;AACH,IAAM,OAAO,GAAG,UAAC,CAAS;IACxB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,GAAG,CAAA;AACzC,CAAC,CAAA;AACD,SAAS;AACT,IAAM,MAAM,GAAG,UAAC,CAAS;IACvB,OAAO,CAAC,CAAA;AACV,CAAC,CAAA;AACD,kCAAkC;AAClC,IAAM,UAAU,GAAG,UAAC,CAAS;IAC3B,OAAO,CAAC,GAAG,CAAC,CAAA;AACd,CAAC,CAAA;AACD,gCAAgC;AAChC,IAAM,WAAW,GAAG,UAAC,CAAS;IAC5B,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;AACpB,CAAC,CAAA;AACD,gDAAgD;AAChD,IAAM,aAAa,GAAG,UAAC,CAAS;IAC9B,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAA;AACnD,CAAC,CAAA;AACD,kCAAkC;AAClC,IAAM,WAAW,GAAG,UAAC,CAAS;IAC5B,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AAClB,CAAC,CAAA;AACD,gCAAgC;AAChC,IAAM,YAAY,GAAG,UAAC,CAAS;IAC7B,OAAO,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AACxB,CAAC,CAAA;AACD,gDAAgD;AAChD,IAAM,cAAc,GAAG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