@rpg-engine/long-bow 0.8.106 → 0.8.108
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 +64 -32
- 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 +65 -33
- 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 +23 -0
- package/src/components/ProgressBar.tsx +1 -1
- package/src/hooks/useChat.ts +32 -21
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IStyles } from '../Chat/Chat';
|
|
3
3
|
import { ChatMessage, PrivateChatCharacter } from './types';
|
|
4
|
-
interface
|
|
4
|
+
interface IChatContentProps {
|
|
5
5
|
isPrivate: boolean;
|
|
6
6
|
isTrade: boolean;
|
|
7
7
|
isGlobal: boolean;
|
|
@@ -24,5 +24,5 @@ interface ChatContentProps {
|
|
|
24
24
|
isGuild: boolean;
|
|
25
25
|
onSendGuildChatMessage: (message: string) => void;
|
|
26
26
|
}
|
|
27
|
-
export declare const ChatContent: React.FC<
|
|
27
|
+
export declare const ChatContent: React.FC<IChatContentProps>;
|
|
28
28
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { IStyles } from '../Chat/Chat';
|
|
3
3
|
import { PrivateChatCharacter } from './types';
|
|
4
4
|
interface ISearchCharacterProps {
|
|
@@ -10,5 +10,5 @@ interface ISearchCharacterProps {
|
|
|
10
10
|
onCharacterClick?: (character: PrivateChatCharacter) => void;
|
|
11
11
|
hideSearchCharacterUI: () => void;
|
|
12
12
|
}
|
|
13
|
-
export declare const SearchCharacter:
|
|
13
|
+
export declare const SearchCharacter: React.FC<ISearchCharacterProps>;
|
|
14
14
|
export {};
|
|
@@ -26578,30 +26578,33 @@ var useChat = function useChat(_ref) {
|
|
|
26578
26578
|
setIsExpanded(true);
|
|
26579
26579
|
}
|
|
26580
26580
|
}, [isPrivate]);
|
|
26581
|
-
var toggleExpand = function
|
|
26581
|
+
var toggleExpand = React.useCallback(function () {
|
|
26582
26582
|
return setIsExpanded(function (prev) {
|
|
26583
26583
|
return !prev;
|
|
26584
26584
|
});
|
|
26585
|
-
};
|
|
26586
|
-
var toggleRecentChats = function
|
|
26585
|
+
}, []);
|
|
26586
|
+
var toggleRecentChats = React.useCallback(function () {
|
|
26587
26587
|
return setShowRecentChats(function (prev) {
|
|
26588
26588
|
return !prev;
|
|
26589
26589
|
});
|
|
26590
|
-
};
|
|
26591
|
-
var handleTabChange = function
|
|
26590
|
+
}, []);
|
|
26591
|
+
var handleTabChange = React.useCallback(function (tabId) {
|
|
26592
26592
|
if (tabId === 'private') {
|
|
26593
26593
|
setIsExpanded(true);
|
|
26594
26594
|
}
|
|
26595
26595
|
onChangeTab(tabId);
|
|
26596
|
-
};
|
|
26597
|
-
var handlePreviousChatCharacterClick = function
|
|
26596
|
+
}, [onChangeTab]);
|
|
26597
|
+
var handlePreviousChatCharacterClick = React.useCallback(function (character) {
|
|
26598
26598
|
if (onPreviousChatCharacterClick) {
|
|
26599
26599
|
onPreviousChatCharacterClick(character);
|
|
26600
26600
|
}
|
|
26601
26601
|
if (hideSearchCharacterUI) {
|
|
26602
26602
|
hideSearchCharacterUI();
|
|
26603
26603
|
}
|
|
26604
|
-
};
|
|
26604
|
+
}, [onPreviousChatCharacterClick, hideSearchCharacterUI]);
|
|
26605
|
+
var hasUnseenMessages = React.useMemo(function () {
|
|
26606
|
+
return unseenMessageCharacterIds && unseenMessageCharacterIds.length > 0;
|
|
26607
|
+
}, [unseenMessageCharacterIds]);
|
|
26605
26608
|
return {
|
|
26606
26609
|
showRecentChats: showRecentChats,
|
|
26607
26610
|
isExpanded: isExpanded,
|
|
@@ -26609,11 +26612,11 @@ var useChat = function useChat(_ref) {
|
|
|
26609
26612
|
toggleRecentChats: toggleRecentChats,
|
|
26610
26613
|
handleTabChange: handleTabChange,
|
|
26611
26614
|
handlePreviousChatCharacterClick: handlePreviousChatCharacterClick,
|
|
26612
|
-
hasUnseenMessages:
|
|
26615
|
+
hasUnseenMessages: hasUnseenMessages
|
|
26613
26616
|
};
|
|
26614
26617
|
};
|
|
26615
26618
|
|
|
26616
|
-
var SearchCharacter = function
|
|
26619
|
+
var SearchCharacter = /*#__PURE__*/React.memo(function (_ref) {
|
|
26617
26620
|
var onChangeCharacterName = _ref.onChangeCharacterName,
|
|
26618
26621
|
onBlur = _ref.onBlur,
|
|
26619
26622
|
onFocus = _ref.onFocus,
|
|
@@ -26642,17 +26645,22 @@ var SearchCharacter = function SearchCharacter(_ref) {
|
|
|
26642
26645
|
return clearTimeout(timer);
|
|
26643
26646
|
};
|
|
26644
26647
|
}, []);
|
|
26645
|
-
var handleSubmit = function
|
|
26648
|
+
var handleSubmit = React.useCallback(function (event) {
|
|
26646
26649
|
event.preventDefault();
|
|
26647
26650
|
if (!characterName || characterName.trim() === '') return;
|
|
26648
26651
|
onChangeCharacterName(characterName);
|
|
26649
|
-
};
|
|
26650
|
-
var handleCharacterClick = function
|
|
26652
|
+
}, [characterName, onChangeCharacterName]);
|
|
26653
|
+
var handleCharacterClick = React.useCallback(function (character) {
|
|
26651
26654
|
if (!onCharacterClick) return;
|
|
26652
26655
|
setCharacterName('');
|
|
26653
26656
|
onCharacterClick(character);
|
|
26654
26657
|
hideSearchCharacterUI();
|
|
26655
|
-
};
|
|
26658
|
+
}, [onCharacterClick, hideSearchCharacterUI]);
|
|
26659
|
+
var handleInputChange = React.useCallback(function (e) {
|
|
26660
|
+
var value = e.target.value;
|
|
26661
|
+
setCharacterName(value);
|
|
26662
|
+
onChangeCharacterName(value);
|
|
26663
|
+
}, [onChangeCharacterName]);
|
|
26656
26664
|
return React__default.createElement(SearchContainer, null, React__default.createElement(Form$2, {
|
|
26657
26665
|
onSubmit: handleSubmit
|
|
26658
26666
|
}, React__default.createElement(Column, {
|
|
@@ -26662,10 +26670,7 @@ var SearchCharacter = function SearchCharacter(_ref) {
|
|
|
26662
26670
|
ref: searchCharacterRef,
|
|
26663
26671
|
id: "characterName",
|
|
26664
26672
|
name: "characterName",
|
|
26665
|
-
onChange:
|
|
26666
|
-
setCharacterName(e.target.value);
|
|
26667
|
-
onChangeCharacterName(e.target.value);
|
|
26668
|
-
},
|
|
26673
|
+
onChange: handleInputChange,
|
|
26669
26674
|
placeholder: "Search for a character...",
|
|
26670
26675
|
height: 20,
|
|
26671
26676
|
type: "text",
|
|
@@ -26696,7 +26701,7 @@ var SearchCharacter = function SearchCharacter(_ref) {
|
|
|
26696
26701
|
maxLines: 1
|
|
26697
26702
|
}, character.name));
|
|
26698
26703
|
})));
|
|
26699
|
-
};
|
|
26704
|
+
});
|
|
26700
26705
|
var SearchContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
26701
26706
|
displayName: "SearchCharacter__SearchContainer",
|
|
26702
26707
|
componentId: "sc-172lyfr-0"
|
|
@@ -26728,7 +26733,7 @@ var ListElement = /*#__PURE__*/styled__default.li.withConfig({
|
|
|
26728
26733
|
componentId: "sc-172lyfr-5"
|
|
26729
26734
|
})(["margin:0.5rem 0 !important;font-size:", ";padding:0.5rem 2px;&:hover{color:#ff0;background-color:", ";}button{all:unset;}"], uiFonts.size.small, uiColors.darkGray);
|
|
26730
26735
|
|
|
26731
|
-
var ChatContent = function
|
|
26736
|
+
var ChatContent = /*#__PURE__*/React.memo(function (_ref) {
|
|
26732
26737
|
var isPrivate = _ref.isPrivate,
|
|
26733
26738
|
isTrade = _ref.isTrade,
|
|
26734
26739
|
isGlobal = _ref.isGlobal,
|
|
@@ -26750,7 +26755,7 @@ var ChatContent = function ChatContent(_ref) {
|
|
|
26750
26755
|
onCharacterClick = _ref.onCharacterClick,
|
|
26751
26756
|
isGuild = _ref.isGuild,
|
|
26752
26757
|
onSendGuildChatMessage = _ref.onSendGuildChatMessage;
|
|
26753
|
-
var handleSendMessage = function
|
|
26758
|
+
var handleSendMessage = React.useCallback(function (message) {
|
|
26754
26759
|
if (autoCloseOnSend) {
|
|
26755
26760
|
onCloseButton();
|
|
26756
26761
|
}
|
|
@@ -26765,7 +26770,7 @@ var ChatContent = function ChatContent(_ref) {
|
|
|
26765
26770
|
} else {
|
|
26766
26771
|
onSendLocalChatMessage(message);
|
|
26767
26772
|
}
|
|
26768
|
-
};
|
|
26773
|
+
}, [autoCloseOnSend, isPrivate, isTrade, isGuild, isGlobal, onCloseButton, onSendPrivateChatMessage, onSendTradeMessage, onSendGuildChatMessage, onSendGlobalChatMessage, onSendLocalChatMessage]);
|
|
26769
26774
|
if (isPrivate && searchCharacterUI) {
|
|
26770
26775
|
return React__default.createElement(SearchCharacter, {
|
|
26771
26776
|
onFocus: onFocus,
|
|
@@ -26787,7 +26792,7 @@ var ChatContent = function ChatContent(_ref) {
|
|
|
26787
26792
|
onBlur: onBlur,
|
|
26788
26793
|
isExpanded: isExpanded
|
|
26789
26794
|
}));
|
|
26790
|
-
};
|
|
26795
|
+
});
|
|
26791
26796
|
var ChatWrapper = /*#__PURE__*/styled__default.div.withConfig({
|
|
26792
26797
|
displayName: "ChatContent__ChatWrapper",
|
|
26793
26798
|
componentId: "sc-1380qen-0"
|
|
@@ -26842,7 +26847,7 @@ var StyledExpandButton = /*#__PURE__*/styled__default.button.withConfig({
|
|
|
26842
26847
|
return isExpanded ? 'right: 0' : 'left: 0.5rem';
|
|
26843
26848
|
}, uiColors.orange, uiColors.orange);
|
|
26844
26849
|
|
|
26845
|
-
var RecentChats = function
|
|
26850
|
+
var RecentChats = /*#__PURE__*/React.memo(function (_ref) {
|
|
26846
26851
|
var showRecentChats = _ref.showRecentChats,
|
|
26847
26852
|
toggleRecentChats = _ref.toggleRecentChats,
|
|
26848
26853
|
hasUnseenMessages = _ref.hasUnseenMessages,
|
|
@@ -26854,10 +26859,13 @@ var RecentChats = function RecentChats(_ref) {
|
|
|
26854
26859
|
onRemoveRecentChatCharacter = _ref.onRemoveRecentChatCharacter,
|
|
26855
26860
|
isPrivate = _ref.isPrivate,
|
|
26856
26861
|
hideSearchCharacterUI = _ref.hideSearchCharacterUI;
|
|
26857
|
-
var handlePreviousChatCharacterClick = function
|
|
26862
|
+
var handlePreviousChatCharacterClick = React.useCallback(function (character) {
|
|
26858
26863
|
onPreviousChatCharacterClick(character);
|
|
26859
|
-
hideSearchCharacterUI();
|
|
26860
|
-
};
|
|
26864
|
+
hideSearchCharacterUI();
|
|
26865
|
+
}, [onPreviousChatCharacterClick, hideSearchCharacterUI]);
|
|
26866
|
+
var handleRemoveCharacter = React.useCallback(function (character) {
|
|
26867
|
+
onRemoveRecentChatCharacter == null ? void 0 : onRemoveRecentChatCharacter(character);
|
|
26868
|
+
}, [onRemoveRecentChatCharacter]);
|
|
26861
26869
|
return React__default.createElement(RecentChatTabContainer, {
|
|
26862
26870
|
isOpen: showRecentChats,
|
|
26863
26871
|
isPrivate: isPrivate
|
|
@@ -26888,13 +26896,13 @@ var RecentChats = function RecentChats(_ref) {
|
|
|
26888
26896
|
}, character.name)), React__default.createElement(CloseButton$2, {
|
|
26889
26897
|
className: "close-button",
|
|
26890
26898
|
onPointerDown: function onPointerDown() {
|
|
26891
|
-
return
|
|
26899
|
+
return handleRemoveCharacter(character);
|
|
26892
26900
|
}
|
|
26893
26901
|
}, React__default.createElement(rx.RxCross2, {
|
|
26894
26902
|
size: 16
|
|
26895
26903
|
})));
|
|
26896
26904
|
})));
|
|
26897
|
-
};
|
|
26905
|
+
});
|
|
26898
26906
|
var RecentChatTabContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
26899
26907
|
displayName: "RecentChats__RecentChatTabContainer",
|
|
26900
26908
|
componentId: "sc-uzad2m-0"
|
|
@@ -27771,6 +27779,28 @@ var generateContextMenu = function generateContextMenu(item, itemContainerType,
|
|
|
27771
27779
|
contextActionMenu = generateContextMenuListOptions(shared.ActionsForLoot.Other);
|
|
27772
27780
|
break;
|
|
27773
27781
|
}
|
|
27782
|
+
// Add "Use" for consumable items in nested containers
|
|
27783
|
+
if (item.type === shared.ItemType.Consumable && item.isUsable) {
|
|
27784
|
+
var hasUseAction = contextActionMenu.some(function (action) {
|
|
27785
|
+
return action.id === shared.ItemSocketEvents.Use;
|
|
27786
|
+
});
|
|
27787
|
+
if (!hasUseAction) {
|
|
27788
|
+
contextActionMenu.unshift({
|
|
27789
|
+
id: shared.ItemSocketEvents.Use,
|
|
27790
|
+
text: shared.ItemSocketEventsDisplayLabels[shared.ItemSocketEvents.Use]
|
|
27791
|
+
});
|
|
27792
|
+
}
|
|
27793
|
+
}
|
|
27794
|
+
// Add "Use with..." for items that have hasUseWith property
|
|
27795
|
+
var _contextActionMenuDontHaveUseWith = !contextActionMenu.find(function (action) {
|
|
27796
|
+
return action.text.toLowerCase().includes('use with');
|
|
27797
|
+
});
|
|
27798
|
+
if (item.hasUseWith && _contextActionMenuDontHaveUseWith) {
|
|
27799
|
+
contextActionMenu.push({
|
|
27800
|
+
id: shared.ItemSocketEvents.UseWith,
|
|
27801
|
+
text: shared.ItemSocketEvents.UseWith
|
|
27802
|
+
});
|
|
27803
|
+
}
|
|
27774
27804
|
}
|
|
27775
27805
|
if (itemContainerType === shared.ItemContainerType.MapContainer) {
|
|
27776
27806
|
switch (item.type) {
|
|
@@ -27793,10 +27823,10 @@ var generateContextMenu = function generateContextMenu(item, itemContainerType,
|
|
|
27793
27823
|
contextActionMenu = generateContextMenuListOptions(shared.ActionsForMapContainer.Other);
|
|
27794
27824
|
break;
|
|
27795
27825
|
}
|
|
27796
|
-
var
|
|
27826
|
+
var _contextActionMenuDontHaveUseWith2 = !contextActionMenu.find(function (action) {
|
|
27797
27827
|
return action.text.toLowerCase().includes('use with');
|
|
27798
27828
|
});
|
|
27799
|
-
if (item.hasUseWith &&
|
|
27829
|
+
if (item.hasUseWith && _contextActionMenuDontHaveUseWith2) {
|
|
27800
27830
|
contextActionMenu.push({
|
|
27801
27831
|
id: 'use-with',
|
|
27802
27832
|
text: 'Use with...'
|
|
@@ -36068,7 +36098,9 @@ var ProgressBar$1 = function ProgressBar(_ref) {
|
|
|
36068
36098
|
minWidth: minWidth,
|
|
36069
36099
|
style: style,
|
|
36070
36100
|
mobileScale: mobileScale
|
|
36071
|
-
}, displayText && React__default.createElement(TextOverlay$1, null, React__default.createElement(ProgressBarText,
|
|
36101
|
+
}, displayText && React__default.createElement(TextOverlay$1, null, React__default.createElement(ProgressBarText, {
|
|
36102
|
+
translate: "no"
|
|
36103
|
+
}, displayValue, "/", displayMax)), React__default.createElement("div", {
|
|
36072
36104
|
className: " rpgui-progress-track"
|
|
36073
36105
|
}, React__default.createElement("div", {
|
|
36074
36106
|
className: "rpgui-progress-fill " + color + " ",
|