@rpg-engine/long-bow 0.3.88 → 0.3.90
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/Item/Inventory/ItemSlot.d.ts +1 -0
- package/dist/long-bow.cjs.development.js +41 -15
- 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 +41 -15
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/CraftBook/CraftBook.tsx +3 -0
- package/src/components/DraggableContainer.tsx +4 -0
- package/src/components/Dropdown.tsx +21 -7
- package/src/components/Item/Inventory/ItemContainer.tsx +10 -6
- package/src/components/Item/Inventory/ItemSlot.tsx +14 -0
- package/src/components/Shortcuts/ShortcutsSetter.tsx +7 -1
- package/src/components/TradingMenu/TradingMenu.tsx +3 -0
- package/src/stories/Dropdown.stories.tsx +1 -1
package/dist/long-bow.esm.js
CHANGED
|
@@ -33295,7 +33295,7 @@ var Container$6 = /*#__PURE__*/styled.div.withConfig({
|
|
|
33295
33295
|
var CloseButton$1 = /*#__PURE__*/styled.div.withConfig({
|
|
33296
33296
|
displayName: "DraggableContainer__CloseButton",
|
|
33297
33297
|
componentId: "sc-184mpyl-1"
|
|
33298
|
-
})(["position:absolute;top:3px;right:0px;color:white;z-index:22;font-size:1.1rem;"]);
|
|
33298
|
+
})(["position:absolute;top:3px;right:0px;color:white;z-index:22;font-size:1.1rem;@media (max-width:768px){font-size:1.3rem;padding:3px;}"]);
|
|
33299
33299
|
var TitleContainer = /*#__PURE__*/styled.div.withConfig({
|
|
33300
33300
|
displayName: "DraggableContainer__TitleContainer",
|
|
33301
33301
|
componentId: "sc-184mpyl-2"
|
|
@@ -33327,9 +33327,21 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
33327
33327
|
setOpened = _useState3[1];
|
|
33328
33328
|
useEffect(function () {
|
|
33329
33329
|
var firstOption = options[0];
|
|
33330
|
-
if (firstOption
|
|
33331
|
-
|
|
33332
|
-
|
|
33330
|
+
if (firstOption) {
|
|
33331
|
+
var change = !selectedValue;
|
|
33332
|
+
if (!change) {
|
|
33333
|
+
change = options.filter(function (o) {
|
|
33334
|
+
return o.value === selectedValue;
|
|
33335
|
+
}).length < 1;
|
|
33336
|
+
}
|
|
33337
|
+
/**
|
|
33338
|
+
* make a selection if there is no selected value already present
|
|
33339
|
+
* or if there is a selected value but its not in new options
|
|
33340
|
+
*/
|
|
33341
|
+
if (change) {
|
|
33342
|
+
setSelectedValue(firstOption.value);
|
|
33343
|
+
setSelectedOption(firstOption.option);
|
|
33344
|
+
}
|
|
33333
33345
|
}
|
|
33334
33346
|
}, [options]);
|
|
33335
33347
|
useEffect(function () {
|
|
@@ -33377,7 +33389,7 @@ var DropdownSelect = /*#__PURE__*/styled.p.withConfig({
|
|
|
33377
33389
|
var DropdownOptions = /*#__PURE__*/styled.ul.withConfig({
|
|
33378
33390
|
displayName: "Dropdown__DropdownOptions",
|
|
33379
33391
|
componentId: "sc-8arn65-2"
|
|
33380
|
-
})(["position:absolute;width:100%;display:", ";box-sizing:border-box;"], function (props) {
|
|
33392
|
+
})(["position:absolute;width:100%;display:", ";box-sizing:border-box;@media (max-width:768px){padding:8px 0;}"], function (props) {
|
|
33381
33393
|
return props.opened ? 'block' : 'none';
|
|
33382
33394
|
});
|
|
33383
33395
|
|
|
@@ -33654,6 +33666,7 @@ var ItemSlot = /*#__PURE__*/observer(function (_ref) {
|
|
|
33654
33666
|
dragScale = _ref.dragScale,
|
|
33655
33667
|
isSelectingShortcut = _ref.isSelectingShortcut,
|
|
33656
33668
|
equipmentSet = _ref.equipmentSet,
|
|
33669
|
+
setItemShortcut = _ref.setItemShortcut,
|
|
33657
33670
|
isDepotSystem = _ref.isDepotSystem;
|
|
33658
33671
|
var _useState = useState(false),
|
|
33659
33672
|
isTooltipVisible = _useState[0],
|
|
@@ -33839,6 +33852,13 @@ var ItemSlot = /*#__PURE__*/observer(function (_ref) {
|
|
|
33839
33852
|
defaultClassName: item ? 'draggable' : 'empty-slot',
|
|
33840
33853
|
scale: dragScale,
|
|
33841
33854
|
onStop: function onStop(e, data) {
|
|
33855
|
+
var target = e.target;
|
|
33856
|
+
if (target != null && target.id.includes('shortcutSetter') && setItemShortcut && item) {
|
|
33857
|
+
var index = parseInt(target.id.split('_')[1]);
|
|
33858
|
+
if (!isNaN(index)) {
|
|
33859
|
+
setItemShortcut(item, index);
|
|
33860
|
+
}
|
|
33861
|
+
}
|
|
33842
33862
|
if (wasDragged && item && !isSelectingShortcut) {
|
|
33843
33863
|
var _e$target;
|
|
33844
33864
|
//@ts-ignore
|
|
@@ -33853,9 +33873,9 @@ var ItemSlot = /*#__PURE__*/observer(function (_ref) {
|
|
|
33853
33873
|
});
|
|
33854
33874
|
}
|
|
33855
33875
|
setWasDragged(false);
|
|
33856
|
-
var
|
|
33857
|
-
if (!
|
|
33858
|
-
var style = window.getComputedStyle(
|
|
33876
|
+
var _target = dragContainer.current;
|
|
33877
|
+
if (!_target || !wasDragged) return;
|
|
33878
|
+
var style = window.getComputedStyle(_target);
|
|
33859
33879
|
var matrix = new DOMMatrixReadOnly(style.transform);
|
|
33860
33880
|
var x = matrix.m41;
|
|
33861
33881
|
var y = matrix.m42;
|
|
@@ -34463,7 +34483,7 @@ var RadioOptionsWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
|
34463
34483
|
var ButtonWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
34464
34484
|
displayName: "CraftBook__ButtonWrapper",
|
|
34465
34485
|
componentId: "sc-19q95ue-7"
|
|
34466
|
-
})(["display:flex;justify-content:space-around;padding-top:20px;width:100%;"]);
|
|
34486
|
+
})(["display:flex;justify-content:space-around;padding-top:20px;width:100%;button{padding:0px 50px;}"]);
|
|
34467
34487
|
|
|
34468
34488
|
var DropdownSelectorContainer = function DropdownSelectorContainer(_ref) {
|
|
34469
34489
|
var title = _ref.title,
|
|
@@ -35381,11 +35401,13 @@ var ShortcutsSetter = function ShortcutsSetter(_ref) {
|
|
|
35381
35401
|
return React.createElement(Shortcut, {
|
|
35382
35402
|
key: i,
|
|
35383
35403
|
onPointerDown: function onPointerDown() {
|
|
35404
|
+
if (settingShortcutIndex !== -1) setSettingShortcutIndex(-1);
|
|
35384
35405
|
removeShortcut(i);
|
|
35385
|
-
if (!shortcuts[i] || shortcuts[i].type === ShortcutType.None) setSettingShortcutIndex(i);
|
|
35406
|
+
if (settingShortcutIndex === -1 && (!shortcuts[i] || shortcuts[i].type === ShortcutType.None)) setSettingShortcutIndex(i);
|
|
35386
35407
|
},
|
|
35387
35408
|
disabled: settingShortcutIndex !== -1 && settingShortcutIndex !== i,
|
|
35388
|
-
isBeingSet: settingShortcutIndex === i
|
|
35409
|
+
isBeingSet: settingShortcutIndex === i,
|
|
35410
|
+
id: "shortcutSetter_" + i
|
|
35389
35411
|
}, getContent(i));
|
|
35390
35412
|
})));
|
|
35391
35413
|
};
|
|
@@ -35441,6 +35463,11 @@ var ItemContainer$1 = function ItemContainer(_ref) {
|
|
|
35441
35463
|
var _useState2 = useState(-1),
|
|
35442
35464
|
settingShortcutIndex = _useState2[0],
|
|
35443
35465
|
setSettingShortcutIndex = _useState2[1];
|
|
35466
|
+
var handleSetShortcut = function handleSetShortcut(item, index) {
|
|
35467
|
+
if (item.type === ItemType.Consumable || item.type === ItemType.Tool) {
|
|
35468
|
+
setItemShortcut == null ? void 0 : setItemShortcut(item.key, index);
|
|
35469
|
+
}
|
|
35470
|
+
};
|
|
35444
35471
|
var onRenderSlots = function onRenderSlots() {
|
|
35445
35472
|
var slots = [];
|
|
35446
35473
|
for (var i = 0; i < itemContainer.slotQty; i++) {
|
|
@@ -35457,9 +35484,7 @@ var ItemContainer$1 = function ItemContainer(_ref) {
|
|
|
35457
35484
|
onPointerDown: function onPointerDown(itemType, containerType, item) {
|
|
35458
35485
|
if (settingShortcutIndex !== -1) {
|
|
35459
35486
|
setSettingShortcutIndex(-1);
|
|
35460
|
-
|
|
35461
|
-
setItemShortcut == null ? void 0 : setItemShortcut(item.key, settingShortcutIndex);
|
|
35462
|
-
}
|
|
35487
|
+
handleSetShortcut(item, settingShortcutIndex);
|
|
35463
35488
|
} else if (onItemClick) onItemClick(item, itemType, containerType);
|
|
35464
35489
|
},
|
|
35465
35490
|
onSelected: function onSelected(optionId, item) {
|
|
@@ -35491,6 +35516,7 @@ var ItemContainer$1 = function ItemContainer(_ref) {
|
|
|
35491
35516
|
atlasJSON: atlasJSON,
|
|
35492
35517
|
isSelectingShortcut: settingShortcutIndex !== -1,
|
|
35493
35518
|
equipmentSet: equipmentSet,
|
|
35519
|
+
setItemShortcut: type === ItemContainerType.Inventory ? handleSetShortcut : undefined,
|
|
35494
35520
|
isDepotSystem: isDepotSystem
|
|
35495
35521
|
}));
|
|
35496
35522
|
}
|
|
@@ -36700,7 +36726,7 @@ var AlertWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
|
36700
36726
|
var ButtonWrapper$2 = /*#__PURE__*/styled.div.withConfig({
|
|
36701
36727
|
displayName: "TradingMenu__ButtonWrapper",
|
|
36702
36728
|
componentId: "sc-1wjsz1l-6"
|
|
36703
|
-
})(["display:flex;justify-content:space-around;padding-top:20px;width:100%;margin-top:1rem;"]);
|
|
36729
|
+
})(["display:flex;justify-content:space-around;padding-top:20px;width:100%;margin-top:1rem;button{padding:0px 50px;}"]);
|
|
36704
36730
|
|
|
36705
36731
|
/* eslint-disable react/require-default-props */
|
|
36706
36732
|
var Truncate = function Truncate(_ref) {
|