@rpg-engine/long-bow 0.7.19 → 0.7.21
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/Chat/Chat.d.ts +1 -0
- package/dist/components/ChatRevamp/ChatRevamp.d.ts +1 -0
- package/dist/long-bow.cjs.development.js +95 -40
- 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 +95 -40
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Chat/Chat.tsx +44 -38
- package/src/components/ChatRevamp/ChatRevamp.tsx +96 -14
package/dist/long-bow.esm.js
CHANGED
|
@@ -6,6 +6,7 @@ import { GRID_WIDTH, GRID_HEIGHT, ShortcutType, getItemTextureKeyPath, ItemRarit
|
|
|
6
6
|
import dayjs from 'dayjs';
|
|
7
7
|
import { ErrorBoundary as ErrorBoundary$1 } from 'react-error-boundary';
|
|
8
8
|
import { FaTimes } from 'react-icons/fa';
|
|
9
|
+
import { IoMdContract, IoMdExpand } from 'react-icons/io';
|
|
9
10
|
import { RxMagnifyingGlass, RxCross2 } from 'react-icons/rx';
|
|
10
11
|
import Draggable from 'react-draggable';
|
|
11
12
|
import ReactDOM from 'react-dom';
|
|
@@ -26110,17 +26111,19 @@ var Chat = function Chat(_ref) {
|
|
|
26110
26111
|
buttonBackgroundColor: '#333',
|
|
26111
26112
|
width: '100%',
|
|
26112
26113
|
height: '100%'
|
|
26113
|
-
} : _ref$styles
|
|
26114
|
+
} : _ref$styles,
|
|
26115
|
+
isExpanded = _ref.isExpanded;
|
|
26114
26116
|
var _useState = useState(''),
|
|
26115
26117
|
message = _useState[0],
|
|
26116
26118
|
setMessage = _useState[1];
|
|
26117
26119
|
var inputRef = useRef(null);
|
|
26118
26120
|
useEffect(function () {
|
|
26119
26121
|
var _inputRef$current;
|
|
26120
|
-
|
|
26121
|
-
|
|
26122
|
+
if (isExpanded) {
|
|
26123
|
+
scrollChatToBottom();
|
|
26124
|
+
}
|
|
26122
26125
|
(_inputRef$current = inputRef.current) == null ? void 0 : _inputRef$current.focus();
|
|
26123
|
-
}, [chatMessages]);
|
|
26126
|
+
}, [chatMessages, isExpanded]);
|
|
26124
26127
|
var scrollChatToBottom = function scrollChatToBottom() {
|
|
26125
26128
|
var scrollingElement = document.querySelector('.chat-body');
|
|
26126
26129
|
if (scrollingElement) {
|
|
@@ -26146,20 +26149,22 @@ var Chat = function Chat(_ref) {
|
|
|
26146
26149
|
};
|
|
26147
26150
|
return React.createElement(ChatContainer, {
|
|
26148
26151
|
width: styles.width || 'auto',
|
|
26149
|
-
height: styles.height || 'auto'
|
|
26152
|
+
height: styles.height || 'auto',
|
|
26153
|
+
isExpanded: isExpanded
|
|
26154
|
+
}, isExpanded && React.createElement(ErrorBoundary$1, {
|
|
26155
|
+
fallback: React.createElement("p", null, "Oops! Your chat has crashed.")
|
|
26150
26156
|
}, React.createElement(CloseButton, {
|
|
26151
26157
|
onClick: onCloseButton
|
|
26152
|
-
}, React.createElement(FaTimes, null)), React.createElement(
|
|
26153
|
-
fallback: React.createElement("p", null, "Oops! Your chat has crashed.")
|
|
26154
|
-
}, React.createElement(MessagesContainer, {
|
|
26158
|
+
}, React.createElement(FaTimes, null)), React.createElement(MessagesContainer, {
|
|
26155
26159
|
className: "chat-body"
|
|
26156
26160
|
}, chatMessages.map(function (chatMessage, index) {
|
|
26157
26161
|
return React.createElement(Message, {
|
|
26158
26162
|
color: styles.textColor || uiColors.yellow,
|
|
26159
26163
|
key: chatMessage._id + "_" + index
|
|
26160
26164
|
}, formatMessage(chatMessage));
|
|
26161
|
-
})), React.createElement(Form, {
|
|
26162
|
-
onSubmit: handleSubmit
|
|
26165
|
+
}))), React.createElement(Form, {
|
|
26166
|
+
onSubmit: handleSubmit,
|
|
26167
|
+
isExpanded: isExpanded
|
|
26163
26168
|
}, React.createElement(TextField, {
|
|
26164
26169
|
ref: inputRef,
|
|
26165
26170
|
value: message,
|
|
@@ -26175,7 +26180,7 @@ var Chat = function Chat(_ref) {
|
|
|
26175
26180
|
}), React.createElement(SendButton, {
|
|
26176
26181
|
type: "submit",
|
|
26177
26182
|
disabled: !message.trim()
|
|
26178
|
-
}, "\u25B6")))
|
|
26183
|
+
}, "\u25B6")));
|
|
26179
26184
|
};
|
|
26180
26185
|
var ChatContainer = /*#__PURE__*/styled.div.withConfig({
|
|
26181
26186
|
displayName: "Chat__ChatContainer",
|
|
@@ -26183,7 +26188,7 @@ var ChatContainer = /*#__PURE__*/styled.div.withConfig({
|
|
|
26183
26188
|
})(["width:", ";height:", ";background-color:rgba(30,30,30,0.3);display:flex;flex-direction:column;position:relative;border-radius:8px;border:1px solid rgba(0,0,0,0.1);overflow:hidden;"], function (props) {
|
|
26184
26189
|
return props.width;
|
|
26185
26190
|
}, function (props) {
|
|
26186
|
-
return props.height;
|
|
26191
|
+
return props.isExpanded ? props.height : 'auto';
|
|
26187
26192
|
});
|
|
26188
26193
|
var CloseButton = /*#__PURE__*/styled.button.withConfig({
|
|
26189
26194
|
displayName: "Chat__CloseButton",
|
|
@@ -26203,7 +26208,9 @@ var Message = /*#__PURE__*/styled.div.withConfig({
|
|
|
26203
26208
|
var Form = /*#__PURE__*/styled.form.withConfig({
|
|
26204
26209
|
displayName: "Chat__Form",
|
|
26205
26210
|
componentId: "sc-1bk05n6-4"
|
|
26206
|
-
})(["display:flex;padding:8px;background-color:rgba(42,42,42,0.4);"])
|
|
26211
|
+
})(["display:flex;padding:8px;background-color:rgba(42,42,42,0.4);border-radius:", ";"], function (props) {
|
|
26212
|
+
return props.isExpanded ? '0' : '8px';
|
|
26213
|
+
});
|
|
26207
26214
|
var TextField = /*#__PURE__*/styled.input.withConfig({
|
|
26208
26215
|
displayName: "Chat__TextField",
|
|
26209
26216
|
componentId: "sc-1bk05n6-5"
|
|
@@ -26518,17 +26525,38 @@ var ChatRevamp = function ChatRevamp(_ref) {
|
|
|
26518
26525
|
onSendTradeMessage = _ref.onSendTradeMessage,
|
|
26519
26526
|
searchCharacterUI = _ref.searchCharacterUI,
|
|
26520
26527
|
hideSearchCharacterUI = _ref.hideSearchCharacterUI,
|
|
26521
|
-
showSearchCharacterUI = _ref.showSearchCharacterUI
|
|
26528
|
+
showSearchCharacterUI = _ref.showSearchCharacterUI,
|
|
26529
|
+
_ref$minimizedByDefau = _ref.minimizedByDefault,
|
|
26530
|
+
minimizedByDefault = _ref$minimizedByDefau === void 0 ? false : _ref$minimizedByDefau;
|
|
26522
26531
|
var _useState = useState(false),
|
|
26523
26532
|
showRecentChats = _useState[0],
|
|
26524
26533
|
setShowRecentChats = _useState[1];
|
|
26534
|
+
var _useState2 = useState(!minimizedByDefault),
|
|
26535
|
+
isExpanded = _useState2[0],
|
|
26536
|
+
setIsExpanded = _useState2[1];
|
|
26525
26537
|
var isPrivate = activeTab === 'private';
|
|
26526
26538
|
var isTrade = activeTab === 'trade';
|
|
26539
|
+
useEffect(function () {
|
|
26540
|
+
if (isPrivate) {
|
|
26541
|
+
setIsExpanded(true);
|
|
26542
|
+
}
|
|
26543
|
+
}, [isPrivate]);
|
|
26544
|
+
var toggleExpand = function toggleExpand() {
|
|
26545
|
+
return setIsExpanded(function (prev) {
|
|
26546
|
+
return !prev;
|
|
26547
|
+
});
|
|
26548
|
+
};
|
|
26527
26549
|
var toggleRecentChats = function toggleRecentChats() {
|
|
26528
26550
|
return setShowRecentChats(function (prev) {
|
|
26529
26551
|
return !prev;
|
|
26530
26552
|
});
|
|
26531
26553
|
};
|
|
26554
|
+
var handleTabChange = function handleTabChange(tabId) {
|
|
26555
|
+
if (tabId === 'private') {
|
|
26556
|
+
setIsExpanded(true);
|
|
26557
|
+
}
|
|
26558
|
+
onChangeTab(tabId);
|
|
26559
|
+
};
|
|
26532
26560
|
var handlePreviousChatCharacterClick = function handlePreviousChatCharacterClick(character) {
|
|
26533
26561
|
onPreviousChatCharacterClick == null ? void 0 : onPreviousChatCharacterClick(character);
|
|
26534
26562
|
hideSearchCharacterUI();
|
|
@@ -26539,7 +26567,7 @@ var ChatRevamp = function ChatRevamp(_ref) {
|
|
|
26539
26567
|
key: tab.label + "_" + index,
|
|
26540
26568
|
active: tab.id === activeTab,
|
|
26541
26569
|
onPointerDown: function onPointerDown() {
|
|
26542
|
-
return
|
|
26570
|
+
return handleTabChange(tab.id);
|
|
26543
26571
|
}
|
|
26544
26572
|
}, tab.label);
|
|
26545
26573
|
}));
|
|
@@ -26600,24 +26628,46 @@ var ChatRevamp = function ChatRevamp(_ref) {
|
|
|
26600
26628
|
onCloseButton: onCloseButton,
|
|
26601
26629
|
styles: styles,
|
|
26602
26630
|
onFocus: onFocus,
|
|
26603
|
-
onBlur: onBlur
|
|
26631
|
+
onBlur: onBlur,
|
|
26632
|
+
isExpanded: isExpanded
|
|
26604
26633
|
});
|
|
26605
26634
|
};
|
|
26606
|
-
return React.createElement(
|
|
26635
|
+
return React.createElement(ChatRevampContainer, null, React.createElement(TopBar, {
|
|
26636
|
+
isExpanded: isExpanded
|
|
26637
|
+
}, isExpanded && renderTabs(), React.createElement(ExpandButton, {
|
|
26638
|
+
onClick: toggleExpand,
|
|
26639
|
+
isExpanded: isExpanded
|
|
26640
|
+
}, isExpanded ? React.createElement(IoMdContract, {
|
|
26641
|
+
size: 20
|
|
26642
|
+
}) : React.createElement(IoMdExpand, {
|
|
26643
|
+
size: 20
|
|
26644
|
+
}))), React.createElement(PrivateChatContainer, {
|
|
26607
26645
|
width: (styles == null ? void 0 : styles.width) || '80%',
|
|
26608
|
-
height: (styles == null ? void 0 : styles.height) || 'auto'
|
|
26609
|
-
|
|
26646
|
+
height: (styles == null ? void 0 : styles.height) || 'auto',
|
|
26647
|
+
isExpanded: isExpanded
|
|
26648
|
+
}, isExpanded && React.createElement(RecentChatTabContainer, {
|
|
26610
26649
|
isPrivate: isPrivate,
|
|
26611
26650
|
isOpen: showRecentChats
|
|
26612
26651
|
}, renderRecentChatTopBar(), renderRecentChatList()), React.createElement(ChatWrapper, null, renderChatContent())));
|
|
26613
26652
|
};
|
|
26653
|
+
var ChatRevampContainer = /*#__PURE__*/styled.div.withConfig({
|
|
26654
|
+
displayName: "ChatRevamp__ChatRevampContainer",
|
|
26655
|
+
componentId: "sc-1sdiknw-0"
|
|
26656
|
+
})(["display:flex;flex-direction:column;width:100%;position:relative;"]);
|
|
26657
|
+
var TopBar = /*#__PURE__*/styled.div.withConfig({
|
|
26658
|
+
displayName: "ChatRevamp__TopBar",
|
|
26659
|
+
componentId: "sc-1sdiknw-1"
|
|
26660
|
+
})(["display:flex;align-items:center;justify-content:flex-start;", ""], function (_ref2) {
|
|
26661
|
+
var isExpanded = _ref2.isExpanded;
|
|
26662
|
+
return !isExpanded && css(["min-height:32px;"]);
|
|
26663
|
+
});
|
|
26614
26664
|
var TabContainer = /*#__PURE__*/styled.div.withConfig({
|
|
26615
26665
|
displayName: "ChatRevamp__TabContainer",
|
|
26616
|
-
componentId: "sc-1sdiknw-
|
|
26617
|
-
})(["
|
|
26666
|
+
componentId: "sc-1sdiknw-2"
|
|
26667
|
+
})(["display:flex;gap:10px;align-items:center;flex-grow:1;"]);
|
|
26618
26668
|
var Tab = /*#__PURE__*/styled.button.withConfig({
|
|
26619
26669
|
displayName: "ChatRevamp__Tab",
|
|
26620
|
-
componentId: "sc-1sdiknw-
|
|
26670
|
+
componentId: "sc-1sdiknw-3"
|
|
26621
26671
|
})(["width:120px;color:white;font-size:0.8rem;all:unset;padding:0.6rem;font-size:0.8rem;border-radius:5px 5px 0 0;border-width:0.25rem 0.25rem 0 0.25rem;border-style:solid;border-color:", ";background-color:", ";color:", ";"], function (props) {
|
|
26622
26672
|
return props.active ? 'rgba(198, 81, 2, 0.5)' : 'rgba(128, 128, 128, 0.5)';
|
|
26623
26673
|
}, function (props) {
|
|
@@ -26625,19 +26675,24 @@ var Tab = /*#__PURE__*/styled.button.withConfig({
|
|
|
26625
26675
|
}, function (props) {
|
|
26626
26676
|
return props.active ? 'white' : uiColors.darkGray;
|
|
26627
26677
|
});
|
|
26678
|
+
var ExpandButton = /*#__PURE__*/styled.button.withConfig({
|
|
26679
|
+
displayName: "ChatRevamp__ExpandButton",
|
|
26680
|
+
componentId: "sc-1sdiknw-4"
|
|
26681
|
+
})(["position:absolute;top:0;right:0;width:30px;height:30px;background-color:", ";color:white;border:none;border-radius:50%;display:flex;justify-content:center;align-items:center;cursor:pointer;transition:all 0.3s ease;z-index:10;&:hover{background-color:", ";}"], uiColors.orange, uiColors.orange);
|
|
26628
26682
|
var PrivateChatContainer = /*#__PURE__*/styled.div.withConfig({
|
|
26629
26683
|
displayName: "ChatRevamp__PrivateChatContainer",
|
|
26630
|
-
componentId: "sc-1sdiknw-
|
|
26631
|
-
})(["width:", ";height:", ";padding:10px;background-color:rgba(0,0,0,0.2);display:flex;gap:10px;"], function (
|
|
26632
|
-
var width =
|
|
26684
|
+
componentId: "sc-1sdiknw-5"
|
|
26685
|
+
})(["width:", ";height:", ";padding:10px;background-color:rgba(0,0,0,0.2);display:flex;gap:10px;flex-direction:column;"], function (_ref3) {
|
|
26686
|
+
var width = _ref3.width;
|
|
26633
26687
|
return width;
|
|
26634
|
-
}, function (
|
|
26635
|
-
var height =
|
|
26636
|
-
|
|
26688
|
+
}, function (_ref4) {
|
|
26689
|
+
var height = _ref4.height,
|
|
26690
|
+
isExpanded = _ref4.isExpanded;
|
|
26691
|
+
return isExpanded ? height : 'auto';
|
|
26637
26692
|
});
|
|
26638
26693
|
var RecentChatTabContainer = /*#__PURE__*/styled.div.withConfig({
|
|
26639
26694
|
displayName: "ChatRevamp__RecentChatTabContainer",
|
|
26640
|
-
componentId: "sc-1sdiknw-
|
|
26695
|
+
componentId: "sc-1sdiknw-6"
|
|
26641
26696
|
})(["display:", ";flex-direction:column;border-right:1px solid ", ";outline:none;width:", ";max-width:200px;min-width:", ";transition:all 0.3s ease-in-out;overflow:hidden;height:100%;@media (max-width:768px){width:", ";min-width:", ";}"], function (props) {
|
|
26642
26697
|
return props.isPrivate ? 'flex' : 'none';
|
|
26643
26698
|
}, uiColors.gray, function (props) {
|
|
@@ -26651,25 +26706,25 @@ var RecentChatTabContainer = /*#__PURE__*/styled.div.withConfig({
|
|
|
26651
26706
|
});
|
|
26652
26707
|
var RecentChatTopBar = /*#__PURE__*/styled.div.withConfig({
|
|
26653
26708
|
displayName: "ChatRevamp__RecentChatTopBar",
|
|
26654
|
-
componentId: "sc-1sdiknw-
|
|
26709
|
+
componentId: "sc-1sdiknw-7"
|
|
26655
26710
|
})(["display:flex;align-items:center;justify-content:space-between;height:30px;flex-shrink:0;"]);
|
|
26656
26711
|
var SearchButton$1 = /*#__PURE__*/styled.button.withConfig({
|
|
26657
26712
|
displayName: "ChatRevamp__SearchButton",
|
|
26658
|
-
componentId: "sc-1sdiknw-
|
|
26713
|
+
componentId: "sc-1sdiknw-8"
|
|
26659
26714
|
})(["border:none;background-color:transparent;display:flex;flex-direction:column;align-items:flex-end;gap:2px;padding:4px;position:relative;"]);
|
|
26660
26715
|
var BurgerIconContainer = /*#__PURE__*/styled.button.withConfig({
|
|
26661
26716
|
displayName: "ChatRevamp__BurgerIconContainer",
|
|
26662
|
-
componentId: "sc-1sdiknw-
|
|
26717
|
+
componentId: "sc-1sdiknw-9"
|
|
26663
26718
|
})(["border:none;background-color:transparent;display:flex;flex-direction:column;align-items:flex-end;padding:4px;gap:2px;position:relative;&:after{content:'';width:6px;height:6px;position:absolute;top:0;right:2px;border-radius:50%;background-color:", ";display:", ";}"], uiColors.lightGreen, function (props) {
|
|
26664
26719
|
return props.hasUnseenMessages ? 'block' : 'none';
|
|
26665
26720
|
});
|
|
26666
26721
|
var BurgerLineIcon = /*#__PURE__*/styled.span.withConfig({
|
|
26667
26722
|
displayName: "ChatRevamp__BurgerLineIcon",
|
|
26668
|
-
componentId: "sc-1sdiknw-
|
|
26723
|
+
componentId: "sc-1sdiknw-10"
|
|
26669
26724
|
})(["width:1rem;height:2px;background-color:#ffffff;"]);
|
|
26670
26725
|
var RecentChatLogContainer = /*#__PURE__*/styled.div.withConfig({
|
|
26671
26726
|
displayName: "ChatRevamp__RecentChatLogContainer",
|
|
26672
|
-
componentId: "sc-1sdiknw-
|
|
26727
|
+
componentId: "sc-1sdiknw-11"
|
|
26673
26728
|
})(["display:", ";opacity:", ";flex-direction:column;gap:0.25rem;transition:opacity 0.3s ease-in-out;padding:0;margin:0;overflow-y:auto;flex-grow:1;height:0;scrollbar-width:thin;scrollbar-color:rgba(51,51,51,0.4) rgba(30,30,30,0.4);&::-webkit-scrollbar{width:8px;height:8px;}&::-webkit-scrollbar-track{background:rgba(30,30,30,0.2);border-radius:4px;}&::-webkit-scrollbar-thumb{background-color:rgba(255,102,0,0.5);border-radius:4px;border:2px solid rgba(30,30,30,0.2);}&::-webkit-scrollbar-thumb:hover{background-color:rgba(255,102,0,0.7);}"], function (props) {
|
|
26674
26729
|
return props.isOpen ? 'flex' : 'none';
|
|
26675
26730
|
}, function (props) {
|
|
@@ -26677,28 +26732,28 @@ var RecentChatLogContainer = /*#__PURE__*/styled.div.withConfig({
|
|
|
26677
26732
|
});
|
|
26678
26733
|
var ListElementContainer = /*#__PURE__*/styled.div.withConfig({
|
|
26679
26734
|
displayName: "ChatRevamp__ListElementContainer",
|
|
26680
|
-
componentId: "sc-1sdiknw-
|
|
26735
|
+
componentId: "sc-1sdiknw-12"
|
|
26681
26736
|
})(["display:flex;justify-content:space-between;align-items:center;padding:2px 0;"]);
|
|
26682
26737
|
var ListElement$1 = /*#__PURE__*/styled.button.withConfig({
|
|
26683
26738
|
displayName: "ChatRevamp__ListElement",
|
|
26684
|
-
componentId: "sc-1sdiknw-
|
|
26739
|
+
componentId: "sc-1sdiknw-13"
|
|
26685
26740
|
})(["margin:0 !important;font-size:", " !important;padding:2px;all:unset;color:", ";width:100%;position:relative;display:flex;align-items:center;gap:4px;&:hover{color:#ff0;}max-width:calc(100% - 24px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"], uiFonts.size.small, function (props) {
|
|
26686
26741
|
return props.active ? uiColors.yellow : uiColors.white;
|
|
26687
26742
|
});
|
|
26688
26743
|
var StatusDot = /*#__PURE__*/styled.span.withConfig({
|
|
26689
26744
|
displayName: "ChatRevamp__StatusDot",
|
|
26690
|
-
componentId: "sc-1sdiknw-
|
|
26745
|
+
componentId: "sc-1sdiknw-14"
|
|
26691
26746
|
})(["width:6px;height:6px;border-radius:50%;background-color:", ";display:inline-block;margin-right:6px;"], function (props) {
|
|
26692
26747
|
return props.isUnseen ? uiColors.lightGreen : uiColors.gray;
|
|
26693
26748
|
});
|
|
26694
26749
|
var CloseButton$2 = /*#__PURE__*/styled.button.withConfig({
|
|
26695
26750
|
displayName: "ChatRevamp__CloseButton",
|
|
26696
|
-
componentId: "sc-1sdiknw-
|
|
26751
|
+
componentId: "sc-1sdiknw-15"
|
|
26697
26752
|
})(["all:unset;font-size:", ";margin:0 0.5rem;transition:all 0.2s ease-in-out;background-color:", ";color:", ";width:16px;height:16px;border-radius:50%;display:flex;justify-content:center;align-items:center;&:hover{background-color:", ";color:", ";}"], uiFonts.size.xxsmall, uiColors.red, uiColors.white, uiColors.white, uiColors.red);
|
|
26698
26753
|
var ChatWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
26699
26754
|
displayName: "ChatRevamp__ChatWrapper",
|
|
26700
|
-
componentId: "sc-1sdiknw-
|
|
26701
|
-
})(["flex-grow:1;overflow:hidden;display:flex;flex-direction:column;"]);
|
|
26755
|
+
componentId: "sc-1sdiknw-16"
|
|
26756
|
+
})(["flex-grow:1;overflow:hidden;display:flex;flex-direction:column;position:relative;"]);
|
|
26702
26757
|
|
|
26703
26758
|
var CheckButton = function CheckButton(_ref) {
|
|
26704
26759
|
var items = _ref.items,
|