@rpg-engine/long-bow 0.3.82 → 0.3.84
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/Abstractions/SlotsContainer.d.ts +2 -0
- package/dist/components/DraggableContainer.d.ts +2 -0
- package/dist/components/Equipment/EquipmentSet.d.ts +2 -0
- package/dist/components/Item/Inventory/ItemContainer.d.ts +3 -0
- package/dist/components/Item/Inventory/ItemSlot.d.ts +1 -0
- package/dist/components/Item/Inventory/itemContainerHelper.d.ts +1 -1
- package/dist/components/RelativeListMenu.d.ts +4 -0
- package/dist/long-bow.cjs.development.js +119 -30
- package/dist/long-bow.cjs.development.js.map +1 -1
- package/dist/long-bow.cjs.production.min.js +1 -1
- package/dist/long-bow.cjs.production.min.js.map +1 -1
- package/dist/long-bow.esm.js +120 -31
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Abstractions/SlotsContainer.tsx +14 -0
- package/src/components/DraggableContainer.tsx +22 -2
- package/src/components/Equipment/EquipmentSet.tsx +8 -0
- package/src/components/Item/Inventory/ItemContainer.tsx +9 -0
- package/src/components/Item/Inventory/ItemSlot.tsx +21 -3
- package/src/components/Item/Inventory/itemContainerHelper.ts +20 -1
- package/src/components/RelativeListMenu.tsx +23 -16
- package/src/stories/ItemContainer.stories.tsx +1 -0
package/dist/long-bow.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { Component, useState, useEffect, useRef, useMemo, Fragment } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
-
import { GRID_WIDTH, GRID_HEIGHT, ShortcutType, getItemTextureKeyPath, ItemContainerType, ItemType, ItemSocketEventsDisplayLabels, ActionsForInventory, ActionsForEquipmentSet, ActionsForLoot, ActionsForMapContainer, ItemRarities, ItemSubType, ItemSlotType, isMobileOrTablet, getSPForLevel, PeriodOfDay } from '@rpg-engine/shared';
|
|
3
|
+
import { GRID_WIDTH, GRID_HEIGHT, ShortcutType, getItemTextureKeyPath, ItemContainerType, ItemType, DepotSocketEvents, ItemSocketEvents, ItemSocketEventsDisplayLabels, ActionsForInventory, ActionsForEquipmentSet, ActionsForLoot, ActionsForMapContainer, ItemRarities, ItemSubType, ItemSlotType, isMobileOrTablet, getSPForLevel, PeriodOfDay } from '@rpg-engine/shared';
|
|
4
4
|
import dayjs from 'dayjs';
|
|
5
5
|
import { ErrorBoundary as ErrorBoundary$1 } from 'react-error-boundary';
|
|
6
6
|
import { RxPaperPlane } from 'react-icons/rx';
|
|
@@ -33215,6 +33215,8 @@ var DraggableContainer = function DraggableContainer(_ref) {
|
|
|
33215
33215
|
imgWidth = _ref$imgWidth === void 0 ? '20px' : _ref$imgWidth,
|
|
33216
33216
|
cancelDrag = _ref.cancelDrag,
|
|
33217
33217
|
onPositionChange = _ref.onPositionChange,
|
|
33218
|
+
onPositionChangeEnd = _ref.onPositionChangeEnd,
|
|
33219
|
+
onPositionChangeStart = _ref.onPositionChangeStart,
|
|
33218
33220
|
onOutsideClick = _ref.onOutsideClick,
|
|
33219
33221
|
_ref$initialPosition = _ref.initialPosition,
|
|
33220
33222
|
initialPosition = _ref$initialPosition === void 0 ? {
|
|
@@ -33247,6 +33249,22 @@ var DraggableContainer = function DraggableContainer(_ref) {
|
|
|
33247
33249
|
});
|
|
33248
33250
|
}
|
|
33249
33251
|
},
|
|
33252
|
+
onStop: function onStop(_e, data) {
|
|
33253
|
+
if (onPositionChangeEnd) {
|
|
33254
|
+
onPositionChangeEnd({
|
|
33255
|
+
x: data.x,
|
|
33256
|
+
y: data.y
|
|
33257
|
+
});
|
|
33258
|
+
}
|
|
33259
|
+
},
|
|
33260
|
+
onStart: function onStart(_e, data) {
|
|
33261
|
+
if (onPositionChangeStart) {
|
|
33262
|
+
onPositionChangeStart({
|
|
33263
|
+
x: data.x,
|
|
33264
|
+
y: data.y
|
|
33265
|
+
});
|
|
33266
|
+
}
|
|
33267
|
+
},
|
|
33250
33268
|
defaultPosition: initialPosition,
|
|
33251
33269
|
scale: scale
|
|
33252
33270
|
}, React.createElement(Container$6, {
|
|
@@ -33379,7 +33397,8 @@ var RelativeListMenu = function RelativeListMenu(_ref) {
|
|
|
33379
33397
|
onSelected = _ref.onSelected,
|
|
33380
33398
|
onOutsideClick = _ref.onOutsideClick,
|
|
33381
33399
|
_ref$fontSize = _ref.fontSize,
|
|
33382
|
-
fontSize = _ref$fontSize === void 0 ? 0.8 : _ref$fontSize
|
|
33400
|
+
fontSize = _ref$fontSize === void 0 ? 0.8 : _ref$fontSize,
|
|
33401
|
+
pos = _ref.pos;
|
|
33383
33402
|
var ref = useRef(null);
|
|
33384
33403
|
useOutsideClick(ref, 'relative-context-menu');
|
|
33385
33404
|
useEffect(function () {
|
|
@@ -33395,10 +33414,10 @@ var RelativeListMenu = function RelativeListMenu(_ref) {
|
|
|
33395
33414
|
document.removeEventListener('clickOutside', function (_e) {});
|
|
33396
33415
|
};
|
|
33397
33416
|
}, []);
|
|
33398
|
-
return React.createElement(Container$9, {
|
|
33417
|
+
return React.createElement(ModalPortal, null, React.createElement(Container$9, Object.assign({
|
|
33399
33418
|
fontSize: fontSize,
|
|
33400
33419
|
ref: ref
|
|
33401
|
-
}, React.createElement("ul", {
|
|
33420
|
+
}, pos), React.createElement("ul", {
|
|
33402
33421
|
className: "rpgui-list-imp",
|
|
33403
33422
|
style: {
|
|
33404
33423
|
overflow: 'hidden'
|
|
@@ -33410,12 +33429,16 @@ var RelativeListMenu = function RelativeListMenu(_ref) {
|
|
|
33410
33429
|
onSelected(params == null ? void 0 : params.id);
|
|
33411
33430
|
}
|
|
33412
33431
|
}, (params == null ? void 0 : params.text) || 'No text');
|
|
33413
|
-
})));
|
|
33432
|
+
}))));
|
|
33414
33433
|
};
|
|
33415
33434
|
var Container$9 = /*#__PURE__*/styled.div.withConfig({
|
|
33416
33435
|
displayName: "RelativeListMenu__Container",
|
|
33417
33436
|
componentId: "sc-7hohf-0"
|
|
33418
|
-
})(["position:absolute;top:
|
|
33437
|
+
})(["position:absolute;top:", "px;left:", "px;display:flex;flex-direction:column;width:max-content;justify-content:start;align-items:flex-start;li{font-size:", "em;}"], function (props) {
|
|
33438
|
+
return props.y;
|
|
33439
|
+
}, function (props) {
|
|
33440
|
+
return props.x;
|
|
33441
|
+
}, function (props) {
|
|
33419
33442
|
return props.fontSize;
|
|
33420
33443
|
});
|
|
33421
33444
|
var ListElement = /*#__PURE__*/styled.li.withConfig({
|
|
@@ -33488,7 +33511,7 @@ var generateContextMenuListOptions = function generateContextMenuListOptions(act
|
|
|
33488
33511
|
});
|
|
33489
33512
|
return contextMenu;
|
|
33490
33513
|
};
|
|
33491
|
-
var generateContextMenu = function generateContextMenu(item, itemContainerType) {
|
|
33514
|
+
var generateContextMenu = function generateContextMenu(item, itemContainerType, isDepotSystem) {
|
|
33492
33515
|
var contextActionMenu = [];
|
|
33493
33516
|
if (itemContainerType === ItemContainerType.Inventory) {
|
|
33494
33517
|
switch (item.type) {
|
|
@@ -33514,6 +33537,12 @@ var generateContextMenu = function generateContextMenu(item, itemContainerType)
|
|
|
33514
33537
|
contextActionMenu = generateContextMenuListOptions(ActionsForInventory.Other);
|
|
33515
33538
|
break;
|
|
33516
33539
|
}
|
|
33540
|
+
if (isDepotSystem) {
|
|
33541
|
+
contextActionMenu.push({
|
|
33542
|
+
id: DepotSocketEvents.Deposit,
|
|
33543
|
+
text: 'Deposit'
|
|
33544
|
+
});
|
|
33545
|
+
}
|
|
33517
33546
|
}
|
|
33518
33547
|
if (itemContainerType === ItemContainerType.Equipment) {
|
|
33519
33548
|
switch (item.type) {
|
|
@@ -33577,6 +33606,15 @@ var generateContextMenu = function generateContextMenu(item, itemContainerType)
|
|
|
33577
33606
|
});
|
|
33578
33607
|
}
|
|
33579
33608
|
}
|
|
33609
|
+
if (itemContainerType === ItemContainerType.Depot) {
|
|
33610
|
+
contextActionMenu = [{
|
|
33611
|
+
id: ItemSocketEvents.GetItemInfo,
|
|
33612
|
+
text: ItemSocketEventsDisplayLabels.GetItemInfo
|
|
33613
|
+
}, {
|
|
33614
|
+
id: DepotSocketEvents.Withdraw,
|
|
33615
|
+
text: 'Withdraw'
|
|
33616
|
+
}];
|
|
33617
|
+
}
|
|
33580
33618
|
return contextActionMenu;
|
|
33581
33619
|
};
|
|
33582
33620
|
|
|
@@ -33614,7 +33652,8 @@ var ItemSlot = /*#__PURE__*/observer(function (_ref) {
|
|
|
33614
33652
|
checkIfItemShouldDragEnd = _ref.checkIfItemShouldDragEnd,
|
|
33615
33653
|
dragScale = _ref.dragScale,
|
|
33616
33654
|
isSelectingShortcut = _ref.isSelectingShortcut,
|
|
33617
|
-
equipmentSet = _ref.equipmentSet
|
|
33655
|
+
equipmentSet = _ref.equipmentSet,
|
|
33656
|
+
isDepotSystem = _ref.isDepotSystem;
|
|
33618
33657
|
var _useState = useState(false),
|
|
33619
33658
|
isTooltipVisible = _useState[0],
|
|
33620
33659
|
setTooltipVisible = _useState[1];
|
|
@@ -33624,25 +33663,31 @@ var ItemSlot = /*#__PURE__*/observer(function (_ref) {
|
|
|
33624
33663
|
var _useState3 = useState(false),
|
|
33625
33664
|
isContextMenuVisible = _useState3[0],
|
|
33626
33665
|
setIsContextMenuVisible = _useState3[1];
|
|
33627
|
-
var _useState4 = useState(
|
|
33628
|
-
|
|
33629
|
-
|
|
33666
|
+
var _useState4 = useState({
|
|
33667
|
+
x: 0,
|
|
33668
|
+
y: 0
|
|
33669
|
+
}),
|
|
33670
|
+
contextMenuPosition = _useState4[0],
|
|
33671
|
+
setContextMenuPosition = _useState4[1];
|
|
33630
33672
|
var _useState5 = useState(false),
|
|
33631
|
-
|
|
33632
|
-
|
|
33633
|
-
var _useState6 = useState(
|
|
33673
|
+
isFocused = _useState5[0],
|
|
33674
|
+
setIsFocused = _useState5[1];
|
|
33675
|
+
var _useState6 = useState(false),
|
|
33676
|
+
wasDragged = _useState6[0],
|
|
33677
|
+
setWasDragged = _useState6[1];
|
|
33678
|
+
var _useState7 = useState({
|
|
33634
33679
|
x: 0,
|
|
33635
33680
|
y: 0
|
|
33636
33681
|
}),
|
|
33637
|
-
dragPosition =
|
|
33638
|
-
setDragPosition =
|
|
33639
|
-
var
|
|
33640
|
-
dropPosition =
|
|
33641
|
-
setDropPosition =
|
|
33682
|
+
dragPosition = _useState7[0],
|
|
33683
|
+
setDragPosition = _useState7[1];
|
|
33684
|
+
var _useState8 = useState(null),
|
|
33685
|
+
dropPosition = _useState8[0],
|
|
33686
|
+
setDropPosition = _useState8[1];
|
|
33642
33687
|
var dragContainer = useRef(null);
|
|
33643
|
-
var
|
|
33644
|
-
contextActions =
|
|
33645
|
-
setContextActions =
|
|
33688
|
+
var _useState9 = useState([]),
|
|
33689
|
+
contextActions = _useState9[0],
|
|
33690
|
+
setContextActions = _useState9[1];
|
|
33646
33691
|
useEffect(function () {
|
|
33647
33692
|
setDragPosition({
|
|
33648
33693
|
x: 0,
|
|
@@ -33650,9 +33695,9 @@ var ItemSlot = /*#__PURE__*/observer(function (_ref) {
|
|
|
33650
33695
|
});
|
|
33651
33696
|
setIsFocused(false);
|
|
33652
33697
|
if (item) {
|
|
33653
|
-
setContextActions(generateContextMenu(item, containerType));
|
|
33698
|
+
setContextActions(generateContextMenu(item, containerType, isDepotSystem));
|
|
33654
33699
|
}
|
|
33655
|
-
}, [item]);
|
|
33700
|
+
}, [item, isDepotSystem]);
|
|
33656
33701
|
useEffect(function () {
|
|
33657
33702
|
if (onDrop && item && dropPosition) {
|
|
33658
33703
|
onDrop(item, dropPosition);
|
|
@@ -33834,7 +33879,16 @@ var ItemSlot = /*#__PURE__*/observer(function (_ref) {
|
|
|
33834
33879
|
isTouch = true;
|
|
33835
33880
|
setIsTooltipMobileVisible(true);
|
|
33836
33881
|
}
|
|
33837
|
-
if (!isContextMenuDisabled && !isSelectingShortcut && !isTouch)
|
|
33882
|
+
if (!isContextMenuDisabled && !isSelectingShortcut && !isTouch) {
|
|
33883
|
+
setIsContextMenuVisible(!isContextMenuVisible);
|
|
33884
|
+
var event = e;
|
|
33885
|
+
if (event.clientX && event.clientY) {
|
|
33886
|
+
setContextMenuPosition({
|
|
33887
|
+
x: event.clientX - 10,
|
|
33888
|
+
y: event.clientY - 5
|
|
33889
|
+
});
|
|
33890
|
+
}
|
|
33891
|
+
}
|
|
33838
33892
|
onPointerDown(item.type, containerType, item);
|
|
33839
33893
|
}
|
|
33840
33894
|
},
|
|
@@ -33900,7 +33954,8 @@ var ItemSlot = /*#__PURE__*/observer(function (_ref) {
|
|
|
33900
33954
|
},
|
|
33901
33955
|
onOutsideClick: function onOutsideClick() {
|
|
33902
33956
|
setIsContextMenuVisible(false);
|
|
33903
|
-
}
|
|
33957
|
+
},
|
|
33958
|
+
pos: contextMenuPosition
|
|
33904
33959
|
}));
|
|
33905
33960
|
});
|
|
33906
33961
|
var rarityColor = function rarityColor(item) {
|
|
@@ -34442,7 +34497,10 @@ var EquipmentSet = function EquipmentSet(_ref) {
|
|
|
34442
34497
|
onItemOutsideDrop = _ref.onItemOutsideDrop,
|
|
34443
34498
|
checkIfItemCanBeMoved = _ref.checkIfItemCanBeMoved,
|
|
34444
34499
|
checkIfItemShouldDragEnd = _ref.checkIfItemShouldDragEnd,
|
|
34445
|
-
scale = _ref.scale
|
|
34500
|
+
scale = _ref.scale,
|
|
34501
|
+
initialPosition = _ref.initialPosition,
|
|
34502
|
+
onPositionChangeEnd = _ref.onPositionChangeEnd,
|
|
34503
|
+
onPositionChangeStart = _ref.onPositionChangeStart;
|
|
34446
34504
|
var neck = equipmentSet.neck,
|
|
34447
34505
|
leftHand = equipmentSet.leftHand,
|
|
34448
34506
|
ring = equipmentSet.ring,
|
|
@@ -34509,7 +34567,10 @@ var EquipmentSet = function EquipmentSet(_ref) {
|
|
|
34509
34567
|
},
|
|
34510
34568
|
width: "330px",
|
|
34511
34569
|
cancelDrag: ".equipment-container-body",
|
|
34512
|
-
scale: scale
|
|
34570
|
+
scale: scale,
|
|
34571
|
+
initialPosition: initialPosition,
|
|
34572
|
+
onPositionChangeEnd: onPositionChangeEnd,
|
|
34573
|
+
onPositionChangeStart: onPositionChangeStart
|
|
34513
34574
|
}, React.createElement(EquipmentSetContainer, {
|
|
34514
34575
|
className: "equipment-container-body"
|
|
34515
34576
|
}, React.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(0, 3)), React.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(3, 7)), React.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(7, 10))));
|
|
@@ -35068,6 +35129,8 @@ var SlotsContainer = function SlotsContainer(_ref) {
|
|
|
35068
35129
|
title = _ref.title,
|
|
35069
35130
|
onClose = _ref.onClose,
|
|
35070
35131
|
_onPositionChange = _ref.onPositionChange,
|
|
35132
|
+
_onPositionChangeEnd = _ref.onPositionChangeEnd,
|
|
35133
|
+
_onPositionChangeStart = _ref.onPositionChangeStart,
|
|
35071
35134
|
onOutsideClick = _ref.onOutsideClick,
|
|
35072
35135
|
initialPosition = _ref.initialPosition,
|
|
35073
35136
|
scale = _ref.scale;
|
|
@@ -35091,6 +35154,26 @@ var SlotsContainer = function SlotsContainer(_ref) {
|
|
|
35091
35154
|
});
|
|
35092
35155
|
}
|
|
35093
35156
|
},
|
|
35157
|
+
onPositionChangeEnd: function onPositionChangeEnd(_ref3) {
|
|
35158
|
+
var x = _ref3.x,
|
|
35159
|
+
y = _ref3.y;
|
|
35160
|
+
if (_onPositionChangeEnd) {
|
|
35161
|
+
_onPositionChangeEnd({
|
|
35162
|
+
x: x,
|
|
35163
|
+
y: y
|
|
35164
|
+
});
|
|
35165
|
+
}
|
|
35166
|
+
},
|
|
35167
|
+
onPositionChangeStart: function onPositionChangeStart(_ref4) {
|
|
35168
|
+
var x = _ref4.x,
|
|
35169
|
+
y = _ref4.y;
|
|
35170
|
+
if (_onPositionChangeStart) {
|
|
35171
|
+
_onPositionChangeStart({
|
|
35172
|
+
x: x,
|
|
35173
|
+
y: y
|
|
35174
|
+
});
|
|
35175
|
+
}
|
|
35176
|
+
},
|
|
35094
35177
|
onOutsideClick: onOutsideClick,
|
|
35095
35178
|
initialPosition: initialPosition,
|
|
35096
35179
|
scale: scale
|
|
@@ -35340,7 +35423,10 @@ var ItemContainer$1 = function ItemContainer(_ref) {
|
|
|
35340
35423
|
shortcuts = _ref.shortcuts,
|
|
35341
35424
|
setItemShortcut = _ref.setItemShortcut,
|
|
35342
35425
|
removeShortcut = _ref.removeShortcut,
|
|
35343
|
-
equipmentSet = _ref.equipmentSet
|
|
35426
|
+
equipmentSet = _ref.equipmentSet,
|
|
35427
|
+
isDepotSystem = _ref.isDepotSystem,
|
|
35428
|
+
onPositionChangeEnd = _ref.onPositionChangeEnd,
|
|
35429
|
+
onPositionChangeStart = _ref.onPositionChangeStart;
|
|
35344
35430
|
var _useState = useState({
|
|
35345
35431
|
isOpen: false,
|
|
35346
35432
|
maxQuantity: 1,
|
|
@@ -35400,7 +35486,8 @@ var ItemContainer$1 = function ItemContainer(_ref) {
|
|
|
35400
35486
|
atlasIMG: atlasIMG,
|
|
35401
35487
|
atlasJSON: atlasJSON,
|
|
35402
35488
|
isSelectingShortcut: settingShortcutIndex !== -1,
|
|
35403
|
-
equipmentSet: equipmentSet
|
|
35489
|
+
equipmentSet: equipmentSet,
|
|
35490
|
+
isDepotSystem: isDepotSystem
|
|
35404
35491
|
}));
|
|
35405
35492
|
}
|
|
35406
35493
|
return slots;
|
|
@@ -35409,7 +35496,9 @@ var ItemContainer$1 = function ItemContainer(_ref) {
|
|
|
35409
35496
|
title: itemContainer.name || 'Container',
|
|
35410
35497
|
onClose: onClose,
|
|
35411
35498
|
initialPosition: initialPosition,
|
|
35412
|
-
scale: scale
|
|
35499
|
+
scale: scale,
|
|
35500
|
+
onPositionChangeEnd: onPositionChangeEnd,
|
|
35501
|
+
onPositionChangeStart: onPositionChangeStart
|
|
35413
35502
|
}, type === ItemContainerType.Inventory && shortcuts && removeShortcut && React.createElement(ShortcutsSetter, {
|
|
35414
35503
|
setSettingShortcutIndex: setSettingShortcutIndex,
|
|
35415
35504
|
settingShortcutIndex: settingShortcutIndex,
|