@rpg-engine/long-bow 0.3.81 → 0.3.83
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 +117 -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 +118 -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/Chat/Chat.tsx +1 -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 +17 -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, getSPForLevel, PeriodOfDay, isMobileOrTablet } from '@rpg-engine/shared';
|
|
3
|
+
import { GRID_WIDTH, GRID_HEIGHT, ShortcutType, getItemTextureKeyPath, ItemContainerType, ItemType, DepotSocketEvents, ItemSocketEventsDisplayLabels, ActionsForInventory, ActionsForEquipmentSet, ActionsForLoot, ActionsForMapContainer, ItemRarities, ItemSubType, ItemSlotType, getSPForLevel, PeriodOfDay, isMobileOrTablet } 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';
|
|
@@ -32739,6 +32739,7 @@ var Chat = function Chat(_ref) {
|
|
|
32739
32739
|
};
|
|
32740
32740
|
var handleSubmit = function handleSubmit(event) {
|
|
32741
32741
|
event.preventDefault();
|
|
32742
|
+
if (!message || message.trim() === '') return;
|
|
32742
32743
|
onSendChatMessage(message);
|
|
32743
32744
|
setMessage('');
|
|
32744
32745
|
};
|
|
@@ -33214,6 +33215,8 @@ var DraggableContainer = function DraggableContainer(_ref) {
|
|
|
33214
33215
|
imgWidth = _ref$imgWidth === void 0 ? '20px' : _ref$imgWidth,
|
|
33215
33216
|
cancelDrag = _ref.cancelDrag,
|
|
33216
33217
|
onPositionChange = _ref.onPositionChange,
|
|
33218
|
+
onPositionChangeEnd = _ref.onPositionChangeEnd,
|
|
33219
|
+
onPositionChangeStart = _ref.onPositionChangeStart,
|
|
33217
33220
|
onOutsideClick = _ref.onOutsideClick,
|
|
33218
33221
|
_ref$initialPosition = _ref.initialPosition,
|
|
33219
33222
|
initialPosition = _ref$initialPosition === void 0 ? {
|
|
@@ -33246,6 +33249,22 @@ var DraggableContainer = function DraggableContainer(_ref) {
|
|
|
33246
33249
|
});
|
|
33247
33250
|
}
|
|
33248
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
|
+
},
|
|
33249
33268
|
defaultPosition: initialPosition,
|
|
33250
33269
|
scale: scale
|
|
33251
33270
|
}, React.createElement(Container$6, {
|
|
@@ -33378,7 +33397,8 @@ var RelativeListMenu = function RelativeListMenu(_ref) {
|
|
|
33378
33397
|
onSelected = _ref.onSelected,
|
|
33379
33398
|
onOutsideClick = _ref.onOutsideClick,
|
|
33380
33399
|
_ref$fontSize = _ref.fontSize,
|
|
33381
|
-
fontSize = _ref$fontSize === void 0 ? 0.8 : _ref$fontSize
|
|
33400
|
+
fontSize = _ref$fontSize === void 0 ? 0.8 : _ref$fontSize,
|
|
33401
|
+
pos = _ref.pos;
|
|
33382
33402
|
var ref = useRef(null);
|
|
33383
33403
|
useOutsideClick(ref, 'relative-context-menu');
|
|
33384
33404
|
useEffect(function () {
|
|
@@ -33394,10 +33414,10 @@ var RelativeListMenu = function RelativeListMenu(_ref) {
|
|
|
33394
33414
|
document.removeEventListener('clickOutside', function (_e) {});
|
|
33395
33415
|
};
|
|
33396
33416
|
}, []);
|
|
33397
|
-
return React.createElement(Container$9, {
|
|
33417
|
+
return React.createElement(ModalPortal, null, React.createElement(Container$9, Object.assign({
|
|
33398
33418
|
fontSize: fontSize,
|
|
33399
33419
|
ref: ref
|
|
33400
|
-
}, React.createElement("ul", {
|
|
33420
|
+
}, pos), React.createElement("ul", {
|
|
33401
33421
|
className: "rpgui-list-imp",
|
|
33402
33422
|
style: {
|
|
33403
33423
|
overflow: 'hidden'
|
|
@@ -33409,12 +33429,16 @@ var RelativeListMenu = function RelativeListMenu(_ref) {
|
|
|
33409
33429
|
onSelected(params == null ? void 0 : params.id);
|
|
33410
33430
|
}
|
|
33411
33431
|
}, (params == null ? void 0 : params.text) || 'No text');
|
|
33412
|
-
})));
|
|
33432
|
+
}))));
|
|
33413
33433
|
};
|
|
33414
33434
|
var Container$9 = /*#__PURE__*/styled.div.withConfig({
|
|
33415
33435
|
displayName: "RelativeListMenu__Container",
|
|
33416
33436
|
componentId: "sc-7hohf-0"
|
|
33417
|
-
})(["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) {
|
|
33418
33442
|
return props.fontSize;
|
|
33419
33443
|
});
|
|
33420
33444
|
var ListElement = /*#__PURE__*/styled.li.withConfig({
|
|
@@ -33487,7 +33511,7 @@ var generateContextMenuListOptions = function generateContextMenuListOptions(act
|
|
|
33487
33511
|
});
|
|
33488
33512
|
return contextMenu;
|
|
33489
33513
|
};
|
|
33490
|
-
var generateContextMenu = function generateContextMenu(item, itemContainerType) {
|
|
33514
|
+
var generateContextMenu = function generateContextMenu(item, itemContainerType, isDepotSystem) {
|
|
33491
33515
|
var contextActionMenu = [];
|
|
33492
33516
|
if (itemContainerType === ItemContainerType.Inventory) {
|
|
33493
33517
|
switch (item.type) {
|
|
@@ -33513,6 +33537,12 @@ var generateContextMenu = function generateContextMenu(item, itemContainerType)
|
|
|
33513
33537
|
contextActionMenu = generateContextMenuListOptions(ActionsForInventory.Other);
|
|
33514
33538
|
break;
|
|
33515
33539
|
}
|
|
33540
|
+
if (isDepotSystem) {
|
|
33541
|
+
contextActionMenu.push({
|
|
33542
|
+
id: DepotSocketEvents.Deposit,
|
|
33543
|
+
text: 'Deposit'
|
|
33544
|
+
});
|
|
33545
|
+
}
|
|
33516
33546
|
}
|
|
33517
33547
|
if (itemContainerType === ItemContainerType.Equipment) {
|
|
33518
33548
|
switch (item.type) {
|
|
@@ -33575,6 +33605,12 @@ var generateContextMenu = function generateContextMenu(item, itemContainerType)
|
|
|
33575
33605
|
text: 'Use with...'
|
|
33576
33606
|
});
|
|
33577
33607
|
}
|
|
33608
|
+
if (isDepotSystem) {
|
|
33609
|
+
contextActionMenu.push({
|
|
33610
|
+
id: DepotSocketEvents.Withdraw,
|
|
33611
|
+
text: 'Withdraw'
|
|
33612
|
+
});
|
|
33613
|
+
}
|
|
33578
33614
|
}
|
|
33579
33615
|
return contextActionMenu;
|
|
33580
33616
|
};
|
|
@@ -33613,7 +33649,8 @@ var ItemSlot = /*#__PURE__*/observer(function (_ref) {
|
|
|
33613
33649
|
checkIfItemShouldDragEnd = _ref.checkIfItemShouldDragEnd,
|
|
33614
33650
|
dragScale = _ref.dragScale,
|
|
33615
33651
|
isSelectingShortcut = _ref.isSelectingShortcut,
|
|
33616
|
-
equipmentSet = _ref.equipmentSet
|
|
33652
|
+
equipmentSet = _ref.equipmentSet,
|
|
33653
|
+
isDepotSystem = _ref.isDepotSystem;
|
|
33617
33654
|
var _useState = useState(false),
|
|
33618
33655
|
isTooltipVisible = _useState[0],
|
|
33619
33656
|
setTooltipVisible = _useState[1];
|
|
@@ -33623,25 +33660,31 @@ var ItemSlot = /*#__PURE__*/observer(function (_ref) {
|
|
|
33623
33660
|
var _useState3 = useState(false),
|
|
33624
33661
|
isContextMenuVisible = _useState3[0],
|
|
33625
33662
|
setIsContextMenuVisible = _useState3[1];
|
|
33626
|
-
var _useState4 = useState(
|
|
33627
|
-
|
|
33628
|
-
|
|
33663
|
+
var _useState4 = useState({
|
|
33664
|
+
x: 0,
|
|
33665
|
+
y: 0
|
|
33666
|
+
}),
|
|
33667
|
+
contextMenuPosition = _useState4[0],
|
|
33668
|
+
setContextMenuPosition = _useState4[1];
|
|
33629
33669
|
var _useState5 = useState(false),
|
|
33630
|
-
|
|
33631
|
-
|
|
33632
|
-
var _useState6 = useState(
|
|
33670
|
+
isFocused = _useState5[0],
|
|
33671
|
+
setIsFocused = _useState5[1];
|
|
33672
|
+
var _useState6 = useState(false),
|
|
33673
|
+
wasDragged = _useState6[0],
|
|
33674
|
+
setWasDragged = _useState6[1];
|
|
33675
|
+
var _useState7 = useState({
|
|
33633
33676
|
x: 0,
|
|
33634
33677
|
y: 0
|
|
33635
33678
|
}),
|
|
33636
|
-
dragPosition =
|
|
33637
|
-
setDragPosition =
|
|
33638
|
-
var
|
|
33639
|
-
dropPosition =
|
|
33640
|
-
setDropPosition =
|
|
33679
|
+
dragPosition = _useState7[0],
|
|
33680
|
+
setDragPosition = _useState7[1];
|
|
33681
|
+
var _useState8 = useState(null),
|
|
33682
|
+
dropPosition = _useState8[0],
|
|
33683
|
+
setDropPosition = _useState8[1];
|
|
33641
33684
|
var dragContainer = useRef(null);
|
|
33642
|
-
var
|
|
33643
|
-
contextActions =
|
|
33644
|
-
setContextActions =
|
|
33685
|
+
var _useState9 = useState([]),
|
|
33686
|
+
contextActions = _useState9[0],
|
|
33687
|
+
setContextActions = _useState9[1];
|
|
33645
33688
|
useEffect(function () {
|
|
33646
33689
|
setDragPosition({
|
|
33647
33690
|
x: 0,
|
|
@@ -33649,9 +33692,9 @@ var ItemSlot = /*#__PURE__*/observer(function (_ref) {
|
|
|
33649
33692
|
});
|
|
33650
33693
|
setIsFocused(false);
|
|
33651
33694
|
if (item) {
|
|
33652
|
-
setContextActions(generateContextMenu(item, containerType));
|
|
33695
|
+
setContextActions(generateContextMenu(item, containerType, isDepotSystem));
|
|
33653
33696
|
}
|
|
33654
|
-
}, [item]);
|
|
33697
|
+
}, [item, isDepotSystem]);
|
|
33655
33698
|
useEffect(function () {
|
|
33656
33699
|
if (onDrop && item && dropPosition) {
|
|
33657
33700
|
onDrop(item, dropPosition);
|
|
@@ -33833,7 +33876,16 @@ var ItemSlot = /*#__PURE__*/observer(function (_ref) {
|
|
|
33833
33876
|
isTouch = true;
|
|
33834
33877
|
setIsTooltipMobileVisible(true);
|
|
33835
33878
|
}
|
|
33836
|
-
if (!isContextMenuDisabled && !isSelectingShortcut && !isTouch)
|
|
33879
|
+
if (!isContextMenuDisabled && !isSelectingShortcut && !isTouch) {
|
|
33880
|
+
setIsContextMenuVisible(!isContextMenuVisible);
|
|
33881
|
+
var event = e;
|
|
33882
|
+
if (event.clientX && event.clientY) {
|
|
33883
|
+
setContextMenuPosition({
|
|
33884
|
+
x: event.clientX - 10,
|
|
33885
|
+
y: event.clientY - 5
|
|
33886
|
+
});
|
|
33887
|
+
}
|
|
33888
|
+
}
|
|
33837
33889
|
onPointerDown(item.type, containerType, item);
|
|
33838
33890
|
}
|
|
33839
33891
|
},
|
|
@@ -33899,7 +33951,8 @@ var ItemSlot = /*#__PURE__*/observer(function (_ref) {
|
|
|
33899
33951
|
},
|
|
33900
33952
|
onOutsideClick: function onOutsideClick() {
|
|
33901
33953
|
setIsContextMenuVisible(false);
|
|
33902
|
-
}
|
|
33954
|
+
},
|
|
33955
|
+
pos: contextMenuPosition
|
|
33903
33956
|
}));
|
|
33904
33957
|
});
|
|
33905
33958
|
var rarityColor = function rarityColor(item) {
|
|
@@ -34441,7 +34494,10 @@ var EquipmentSet = function EquipmentSet(_ref) {
|
|
|
34441
34494
|
onItemOutsideDrop = _ref.onItemOutsideDrop,
|
|
34442
34495
|
checkIfItemCanBeMoved = _ref.checkIfItemCanBeMoved,
|
|
34443
34496
|
checkIfItemShouldDragEnd = _ref.checkIfItemShouldDragEnd,
|
|
34444
|
-
scale = _ref.scale
|
|
34497
|
+
scale = _ref.scale,
|
|
34498
|
+
initialPosition = _ref.initialPosition,
|
|
34499
|
+
onPositionChangeEnd = _ref.onPositionChangeEnd,
|
|
34500
|
+
onPositionChangeStart = _ref.onPositionChangeStart;
|
|
34445
34501
|
var neck = equipmentSet.neck,
|
|
34446
34502
|
leftHand = equipmentSet.leftHand,
|
|
34447
34503
|
ring = equipmentSet.ring,
|
|
@@ -34508,7 +34564,10 @@ var EquipmentSet = function EquipmentSet(_ref) {
|
|
|
34508
34564
|
},
|
|
34509
34565
|
width: "330px",
|
|
34510
34566
|
cancelDrag: ".equipment-container-body",
|
|
34511
|
-
scale: scale
|
|
34567
|
+
scale: scale,
|
|
34568
|
+
initialPosition: initialPosition,
|
|
34569
|
+
onPositionChangeEnd: onPositionChangeEnd,
|
|
34570
|
+
onPositionChangeStart: onPositionChangeStart
|
|
34512
34571
|
}, React.createElement(EquipmentSetContainer, {
|
|
34513
34572
|
className: "equipment-container-body"
|
|
34514
34573
|
}, React.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(0, 3)), React.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(3, 7)), React.createElement(EquipmentColumn, null, onRenderEquipmentSlotRange(7, 10))));
|
|
@@ -34527,6 +34586,8 @@ var SlotsContainer = function SlotsContainer(_ref) {
|
|
|
34527
34586
|
title = _ref.title,
|
|
34528
34587
|
onClose = _ref.onClose,
|
|
34529
34588
|
_onPositionChange = _ref.onPositionChange,
|
|
34589
|
+
_onPositionChangeEnd = _ref.onPositionChangeEnd,
|
|
34590
|
+
_onPositionChangeStart = _ref.onPositionChangeStart,
|
|
34530
34591
|
onOutsideClick = _ref.onOutsideClick,
|
|
34531
34592
|
initialPosition = _ref.initialPosition,
|
|
34532
34593
|
scale = _ref.scale;
|
|
@@ -34550,6 +34611,26 @@ var SlotsContainer = function SlotsContainer(_ref) {
|
|
|
34550
34611
|
});
|
|
34551
34612
|
}
|
|
34552
34613
|
},
|
|
34614
|
+
onPositionChangeEnd: function onPositionChangeEnd(_ref3) {
|
|
34615
|
+
var x = _ref3.x,
|
|
34616
|
+
y = _ref3.y;
|
|
34617
|
+
if (_onPositionChangeEnd) {
|
|
34618
|
+
_onPositionChangeEnd({
|
|
34619
|
+
x: x,
|
|
34620
|
+
y: y
|
|
34621
|
+
});
|
|
34622
|
+
}
|
|
34623
|
+
},
|
|
34624
|
+
onPositionChangeStart: function onPositionChangeStart(_ref4) {
|
|
34625
|
+
var x = _ref4.x,
|
|
34626
|
+
y = _ref4.y;
|
|
34627
|
+
if (_onPositionChangeStart) {
|
|
34628
|
+
_onPositionChangeStart({
|
|
34629
|
+
x: x,
|
|
34630
|
+
y: y
|
|
34631
|
+
});
|
|
34632
|
+
}
|
|
34633
|
+
},
|
|
34553
34634
|
onOutsideClick: onOutsideClick,
|
|
34554
34635
|
initialPosition: initialPosition,
|
|
34555
34636
|
scale: scale
|
|
@@ -34799,7 +34880,10 @@ var ItemContainer$1 = function ItemContainer(_ref) {
|
|
|
34799
34880
|
shortcuts = _ref.shortcuts,
|
|
34800
34881
|
setItemShortcut = _ref.setItemShortcut,
|
|
34801
34882
|
removeShortcut = _ref.removeShortcut,
|
|
34802
|
-
equipmentSet = _ref.equipmentSet
|
|
34883
|
+
equipmentSet = _ref.equipmentSet,
|
|
34884
|
+
isDepotSystem = _ref.isDepotSystem,
|
|
34885
|
+
onPositionChangeEnd = _ref.onPositionChangeEnd,
|
|
34886
|
+
onPositionChangeStart = _ref.onPositionChangeStart;
|
|
34803
34887
|
var _useState = useState({
|
|
34804
34888
|
isOpen: false,
|
|
34805
34889
|
maxQuantity: 1,
|
|
@@ -34859,7 +34943,8 @@ var ItemContainer$1 = function ItemContainer(_ref) {
|
|
|
34859
34943
|
atlasIMG: atlasIMG,
|
|
34860
34944
|
atlasJSON: atlasJSON,
|
|
34861
34945
|
isSelectingShortcut: settingShortcutIndex !== -1,
|
|
34862
|
-
equipmentSet: equipmentSet
|
|
34946
|
+
equipmentSet: equipmentSet,
|
|
34947
|
+
isDepotSystem: isDepotSystem
|
|
34863
34948
|
}));
|
|
34864
34949
|
}
|
|
34865
34950
|
return slots;
|
|
@@ -34868,7 +34953,9 @@ var ItemContainer$1 = function ItemContainer(_ref) {
|
|
|
34868
34953
|
title: itemContainer.name || 'Container',
|
|
34869
34954
|
onClose: onClose,
|
|
34870
34955
|
initialPosition: initialPosition,
|
|
34871
|
-
scale: scale
|
|
34956
|
+
scale: scale,
|
|
34957
|
+
onPositionChangeEnd: onPositionChangeEnd,
|
|
34958
|
+
onPositionChangeStart: onPositionChangeStart
|
|
34872
34959
|
}, type === ItemContainerType.Inventory && shortcuts && removeShortcut && React.createElement(ShortcutsSetter, {
|
|
34873
34960
|
setSettingShortcutIndex: setSettingShortcutIndex,
|
|
34874
34961
|
settingShortcutIndex: settingShortcutIndex,
|