@rpg-engine/long-bow 0.8.107 → 0.8.109
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/ChatRevamp/ChatContent.d.ts +2 -2
- package/dist/components/ChatRevamp/SearchCharacter.d.ts +2 -2
- package/dist/long-bow.cjs.development.js +51 -29
- 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 +52 -30
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ChatRevamp/ChatContent.tsx +83 -66
- package/src/components/ChatRevamp/RecentChats.tsx +35 -25
- package/src/components/ChatRevamp/SearchCharacter.tsx +109 -95
- package/src/components/Item/Inventory/itemContainerHelper.ts +16 -0
- package/src/hooks/useChat.ts +32 -21
package/dist/long-bow.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, useEffect, Component, useRef, useCallback,
|
|
1
|
+
import React, { useState, useEffect, Component, useRef, useCallback, useMemo, memo, useContext, createContext, Fragment } from 'react';
|
|
2
2
|
import styled, { css, keyframes, createGlobalStyle } from 'styled-components';
|
|
3
3
|
import { BeatLoader } from 'react-spinners';
|
|
4
4
|
import { v4 } from 'uuid';
|
|
@@ -26571,30 +26571,33 @@ var useChat = function useChat(_ref) {
|
|
|
26571
26571
|
setIsExpanded(true);
|
|
26572
26572
|
}
|
|
26573
26573
|
}, [isPrivate]);
|
|
26574
|
-
var toggleExpand = function
|
|
26574
|
+
var toggleExpand = useCallback(function () {
|
|
26575
26575
|
return setIsExpanded(function (prev) {
|
|
26576
26576
|
return !prev;
|
|
26577
26577
|
});
|
|
26578
|
-
};
|
|
26579
|
-
var toggleRecentChats = function
|
|
26578
|
+
}, []);
|
|
26579
|
+
var toggleRecentChats = useCallback(function () {
|
|
26580
26580
|
return setShowRecentChats(function (prev) {
|
|
26581
26581
|
return !prev;
|
|
26582
26582
|
});
|
|
26583
|
-
};
|
|
26584
|
-
var handleTabChange = function
|
|
26583
|
+
}, []);
|
|
26584
|
+
var handleTabChange = useCallback(function (tabId) {
|
|
26585
26585
|
if (tabId === 'private') {
|
|
26586
26586
|
setIsExpanded(true);
|
|
26587
26587
|
}
|
|
26588
26588
|
onChangeTab(tabId);
|
|
26589
|
-
};
|
|
26590
|
-
var handlePreviousChatCharacterClick = function
|
|
26589
|
+
}, [onChangeTab]);
|
|
26590
|
+
var handlePreviousChatCharacterClick = useCallback(function (character) {
|
|
26591
26591
|
if (onPreviousChatCharacterClick) {
|
|
26592
26592
|
onPreviousChatCharacterClick(character);
|
|
26593
26593
|
}
|
|
26594
26594
|
if (hideSearchCharacterUI) {
|
|
26595
26595
|
hideSearchCharacterUI();
|
|
26596
26596
|
}
|
|
26597
|
-
};
|
|
26597
|
+
}, [onPreviousChatCharacterClick, hideSearchCharacterUI]);
|
|
26598
|
+
var hasUnseenMessages = useMemo(function () {
|
|
26599
|
+
return unseenMessageCharacterIds && unseenMessageCharacterIds.length > 0;
|
|
26600
|
+
}, [unseenMessageCharacterIds]);
|
|
26598
26601
|
return {
|
|
26599
26602
|
showRecentChats: showRecentChats,
|
|
26600
26603
|
isExpanded: isExpanded,
|
|
@@ -26602,11 +26605,11 @@ var useChat = function useChat(_ref) {
|
|
|
26602
26605
|
toggleRecentChats: toggleRecentChats,
|
|
26603
26606
|
handleTabChange: handleTabChange,
|
|
26604
26607
|
handlePreviousChatCharacterClick: handlePreviousChatCharacterClick,
|
|
26605
|
-
hasUnseenMessages:
|
|
26608
|
+
hasUnseenMessages: hasUnseenMessages
|
|
26606
26609
|
};
|
|
26607
26610
|
};
|
|
26608
26611
|
|
|
26609
|
-
var SearchCharacter = function
|
|
26612
|
+
var SearchCharacter = /*#__PURE__*/memo(function (_ref) {
|
|
26610
26613
|
var onChangeCharacterName = _ref.onChangeCharacterName,
|
|
26611
26614
|
onBlur = _ref.onBlur,
|
|
26612
26615
|
onFocus = _ref.onFocus,
|
|
@@ -26635,17 +26638,22 @@ var SearchCharacter = function SearchCharacter(_ref) {
|
|
|
26635
26638
|
return clearTimeout(timer);
|
|
26636
26639
|
};
|
|
26637
26640
|
}, []);
|
|
26638
|
-
var handleSubmit = function
|
|
26641
|
+
var handleSubmit = useCallback(function (event) {
|
|
26639
26642
|
event.preventDefault();
|
|
26640
26643
|
if (!characterName || characterName.trim() === '') return;
|
|
26641
26644
|
onChangeCharacterName(characterName);
|
|
26642
|
-
};
|
|
26643
|
-
var handleCharacterClick = function
|
|
26645
|
+
}, [characterName, onChangeCharacterName]);
|
|
26646
|
+
var handleCharacterClick = useCallback(function (character) {
|
|
26644
26647
|
if (!onCharacterClick) return;
|
|
26645
26648
|
setCharacterName('');
|
|
26646
26649
|
onCharacterClick(character);
|
|
26647
26650
|
hideSearchCharacterUI();
|
|
26648
|
-
};
|
|
26651
|
+
}, [onCharacterClick, hideSearchCharacterUI]);
|
|
26652
|
+
var handleInputChange = useCallback(function (e) {
|
|
26653
|
+
var value = e.target.value;
|
|
26654
|
+
setCharacterName(value);
|
|
26655
|
+
onChangeCharacterName(value);
|
|
26656
|
+
}, [onChangeCharacterName]);
|
|
26649
26657
|
return React.createElement(SearchContainer, null, React.createElement(Form$2, {
|
|
26650
26658
|
onSubmit: handleSubmit
|
|
26651
26659
|
}, React.createElement(Column, {
|
|
@@ -26655,10 +26663,7 @@ var SearchCharacter = function SearchCharacter(_ref) {
|
|
|
26655
26663
|
ref: searchCharacterRef,
|
|
26656
26664
|
id: "characterName",
|
|
26657
26665
|
name: "characterName",
|
|
26658
|
-
onChange:
|
|
26659
|
-
setCharacterName(e.target.value);
|
|
26660
|
-
onChangeCharacterName(e.target.value);
|
|
26661
|
-
},
|
|
26666
|
+
onChange: handleInputChange,
|
|
26662
26667
|
placeholder: "Search for a character...",
|
|
26663
26668
|
height: 20,
|
|
26664
26669
|
type: "text",
|
|
@@ -26689,7 +26694,7 @@ var SearchCharacter = function SearchCharacter(_ref) {
|
|
|
26689
26694
|
maxLines: 1
|
|
26690
26695
|
}, character.name));
|
|
26691
26696
|
})));
|
|
26692
|
-
};
|
|
26697
|
+
});
|
|
26693
26698
|
var SearchContainer = /*#__PURE__*/styled.div.withConfig({
|
|
26694
26699
|
displayName: "SearchCharacter__SearchContainer",
|
|
26695
26700
|
componentId: "sc-172lyfr-0"
|
|
@@ -26721,7 +26726,7 @@ var ListElement = /*#__PURE__*/styled.li.withConfig({
|
|
|
26721
26726
|
componentId: "sc-172lyfr-5"
|
|
26722
26727
|
})(["margin:0.5rem 0 !important;font-size:", ";padding:0.5rem 2px;&:hover{color:#ff0;background-color:", ";}button{all:unset;}"], uiFonts.size.small, uiColors.darkGray);
|
|
26723
26728
|
|
|
26724
|
-
var ChatContent = function
|
|
26729
|
+
var ChatContent = /*#__PURE__*/memo(function (_ref) {
|
|
26725
26730
|
var isPrivate = _ref.isPrivate,
|
|
26726
26731
|
isTrade = _ref.isTrade,
|
|
26727
26732
|
isGlobal = _ref.isGlobal,
|
|
@@ -26743,7 +26748,7 @@ var ChatContent = function ChatContent(_ref) {
|
|
|
26743
26748
|
onCharacterClick = _ref.onCharacterClick,
|
|
26744
26749
|
isGuild = _ref.isGuild,
|
|
26745
26750
|
onSendGuildChatMessage = _ref.onSendGuildChatMessage;
|
|
26746
|
-
var handleSendMessage = function
|
|
26751
|
+
var handleSendMessage = useCallback(function (message) {
|
|
26747
26752
|
if (autoCloseOnSend) {
|
|
26748
26753
|
onCloseButton();
|
|
26749
26754
|
}
|
|
@@ -26758,7 +26763,7 @@ var ChatContent = function ChatContent(_ref) {
|
|
|
26758
26763
|
} else {
|
|
26759
26764
|
onSendLocalChatMessage(message);
|
|
26760
26765
|
}
|
|
26761
|
-
};
|
|
26766
|
+
}, [autoCloseOnSend, isPrivate, isTrade, isGuild, isGlobal, onCloseButton, onSendPrivateChatMessage, onSendTradeMessage, onSendGuildChatMessage, onSendGlobalChatMessage, onSendLocalChatMessage]);
|
|
26762
26767
|
if (isPrivate && searchCharacterUI) {
|
|
26763
26768
|
return React.createElement(SearchCharacter, {
|
|
26764
26769
|
onFocus: onFocus,
|
|
@@ -26780,7 +26785,7 @@ var ChatContent = function ChatContent(_ref) {
|
|
|
26780
26785
|
onBlur: onBlur,
|
|
26781
26786
|
isExpanded: isExpanded
|
|
26782
26787
|
}));
|
|
26783
|
-
};
|
|
26788
|
+
});
|
|
26784
26789
|
var ChatWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
26785
26790
|
displayName: "ChatContent__ChatWrapper",
|
|
26786
26791
|
componentId: "sc-1380qen-0"
|
|
@@ -26835,7 +26840,7 @@ var StyledExpandButton = /*#__PURE__*/styled.button.withConfig({
|
|
|
26835
26840
|
return isExpanded ? 'right: 0' : 'left: 0.5rem';
|
|
26836
26841
|
}, uiColors.orange, uiColors.orange);
|
|
26837
26842
|
|
|
26838
|
-
var RecentChats = function
|
|
26843
|
+
var RecentChats = /*#__PURE__*/memo(function (_ref) {
|
|
26839
26844
|
var showRecentChats = _ref.showRecentChats,
|
|
26840
26845
|
toggleRecentChats = _ref.toggleRecentChats,
|
|
26841
26846
|
hasUnseenMessages = _ref.hasUnseenMessages,
|
|
@@ -26847,10 +26852,13 @@ var RecentChats = function RecentChats(_ref) {
|
|
|
26847
26852
|
onRemoveRecentChatCharacter = _ref.onRemoveRecentChatCharacter,
|
|
26848
26853
|
isPrivate = _ref.isPrivate,
|
|
26849
26854
|
hideSearchCharacterUI = _ref.hideSearchCharacterUI;
|
|
26850
|
-
var handlePreviousChatCharacterClick = function
|
|
26855
|
+
var handlePreviousChatCharacterClick = useCallback(function (character) {
|
|
26851
26856
|
onPreviousChatCharacterClick(character);
|
|
26852
|
-
hideSearchCharacterUI();
|
|
26853
|
-
};
|
|
26857
|
+
hideSearchCharacterUI();
|
|
26858
|
+
}, [onPreviousChatCharacterClick, hideSearchCharacterUI]);
|
|
26859
|
+
var handleRemoveCharacter = useCallback(function (character) {
|
|
26860
|
+
onRemoveRecentChatCharacter == null ? void 0 : onRemoveRecentChatCharacter(character);
|
|
26861
|
+
}, [onRemoveRecentChatCharacter]);
|
|
26854
26862
|
return React.createElement(RecentChatTabContainer, {
|
|
26855
26863
|
isOpen: showRecentChats,
|
|
26856
26864
|
isPrivate: isPrivate
|
|
@@ -26881,13 +26889,13 @@ var RecentChats = function RecentChats(_ref) {
|
|
|
26881
26889
|
}, character.name)), React.createElement(CloseButton$2, {
|
|
26882
26890
|
className: "close-button",
|
|
26883
26891
|
onPointerDown: function onPointerDown() {
|
|
26884
|
-
return
|
|
26892
|
+
return handleRemoveCharacter(character);
|
|
26885
26893
|
}
|
|
26886
26894
|
}, React.createElement(RxCross2, {
|
|
26887
26895
|
size: 16
|
|
26888
26896
|
})));
|
|
26889
26897
|
})));
|
|
26890
|
-
};
|
|
26898
|
+
});
|
|
26891
26899
|
var RecentChatTabContainer = /*#__PURE__*/styled.div.withConfig({
|
|
26892
26900
|
displayName: "RecentChats__RecentChatTabContainer",
|
|
26893
26901
|
componentId: "sc-uzad2m-0"
|
|
@@ -27764,6 +27772,20 @@ var generateContextMenu = function generateContextMenu(item, itemContainerType,
|
|
|
27764
27772
|
contextActionMenu = generateContextMenuListOptions(ActionsForLoot.Other);
|
|
27765
27773
|
break;
|
|
27766
27774
|
}
|
|
27775
|
+
// Add "Use" for consumable items in nested containers (same as Inventory)
|
|
27776
|
+
if (item.type === ItemType.Consumable) {
|
|
27777
|
+
contextActionMenu.unshift({
|
|
27778
|
+
id: ItemSocketEvents.Use,
|
|
27779
|
+
text: ItemSocketEventsDisplayLabels[ItemSocketEvents.Use]
|
|
27780
|
+
});
|
|
27781
|
+
}
|
|
27782
|
+
// Add "Use with..." for items that have hasUseWith property
|
|
27783
|
+
if (item.hasUseWith) {
|
|
27784
|
+
contextActionMenu.push({
|
|
27785
|
+
id: ItemSocketEvents.UseWith,
|
|
27786
|
+
text: ItemSocketEvents.UseWith
|
|
27787
|
+
});
|
|
27788
|
+
}
|
|
27767
27789
|
}
|
|
27768
27790
|
if (itemContainerType === ItemContainerType.MapContainer) {
|
|
27769
27791
|
switch (item.type) {
|