@sendbird/uikit-utils 3.7.5 → 3.8.0
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/lib/commonjs/hooks/index.js +2 -5
- package/lib/commonjs/hooks/index.js.map +1 -1
- package/lib/commonjs/hooks/react-native.js +23 -7
- package/lib/commonjs/hooks/react-native.js.map +1 -1
- package/lib/commonjs/index.js +16 -6
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/sendbird/attrs.js +2 -4
- package/lib/commonjs/sendbird/attrs.js.map +1 -1
- package/lib/commonjs/sendbird/channel.js.map +1 -1
- package/lib/commonjs/sendbird/message.js +6 -11
- package/lib/commonjs/sendbird/message.js.map +1 -1
- package/lib/commonjs/sendbird/user.js.map +1 -1
- package/lib/commonjs/shared/arrayToMap.js.map +1 -1
- package/lib/commonjs/shared/bufferedRequest.js +8 -8
- package/lib/commonjs/shared/bufferedRequest.js.map +1 -1
- package/lib/commonjs/shared/file.js +5 -10
- package/lib/commonjs/shared/file.js.map +1 -1
- package/lib/commonjs/shared/index.js.map +1 -1
- package/lib/commonjs/shared/logger.js +7 -24
- package/lib/commonjs/shared/logger.js.map +1 -1
- package/lib/commonjs/shared/regex.js +17 -24
- package/lib/commonjs/shared/regex.js.map +1 -1
- package/lib/commonjs/shared/rtl.js +52 -0
- package/lib/commonjs/shared/rtl.js.map +1 -0
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/ui-format/common.js +4 -9
- package/lib/commonjs/ui-format/common.js.map +1 -1
- package/lib/commonjs/ui-format/groupChannel.js +7 -17
- package/lib/commonjs/ui-format/groupChannel.js.map +1 -1
- package/lib/commonjs/ui-format/openChannel.js +1 -2
- package/lib/commonjs/ui-format/openChannel.js.map +1 -1
- package/lib/module/hooks/index.js +2 -5
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/react-native.js +24 -8
- package/lib/module/hooks/react-native.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/sendbird/attrs.js.map +1 -1
- package/lib/module/sendbird/channel.js.map +1 -1
- package/lib/module/sendbird/message.js +6 -11
- package/lib/module/sendbird/message.js.map +1 -1
- package/lib/module/sendbird/user.js.map +1 -1
- package/lib/module/shared/arrayToMap.js.map +1 -1
- package/lib/module/shared/bufferedRequest.js +8 -8
- package/lib/module/shared/bufferedRequest.js.map +1 -1
- package/lib/module/shared/file.js +2 -4
- package/lib/module/shared/file.js.map +1 -1
- package/lib/module/shared/index.js.map +1 -1
- package/lib/module/shared/logger.js +6 -22
- package/lib/module/shared/logger.js.map +1 -1
- package/lib/module/shared/regex.js +12 -14
- package/lib/module/shared/regex.js.map +1 -1
- package/lib/module/shared/rtl.js +44 -0
- package/lib/module/shared/rtl.js.map +1 -0
- package/lib/module/types.js.map +1 -1
- package/lib/module/ui-format/common.js +4 -9
- package/lib/module/ui-format/common.js.map +1 -1
- package/lib/module/ui-format/groupChannel.js +7 -17
- package/lib/module/ui-format/groupChannel.js.map +1 -1
- package/lib/module/ui-format/openChannel.js +1 -2
- package/lib/module/ui-format/openChannel.js.map +1 -1
- package/lib/typescript/src/hooks/react-native.d.ts +3 -3
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/shared/rtl.d.ts +2 -0
- package/lib/typescript/src/types.d.ts +2 -1
- package/package.json +3 -3
- package/src/hooks/react-native.ts +28 -9
- package/src/index.ts +1 -0
- package/src/sendbird/message.ts +1 -1
- package/src/shared/rtl.ts +45 -0
- package/src/types.ts +2 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const isRTLString = (dir: 'start' | 'end', str?: string) => {
|
|
2
|
+
if (!str || str.length === 0) {
|
|
3
|
+
return false;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
const trimmedStr = str.trimStart();
|
|
7
|
+
if (trimmedStr.length === 0) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const char = dir === 'start' ? Array.from(trimmedStr)[0] : Array.from(trimmedStr).pop();
|
|
12
|
+
const point = char?.codePointAt(0);
|
|
13
|
+
if (point === undefined) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return isRTLCodePoint(point);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const isStartsWithRTL = (str?: string): boolean => {
|
|
21
|
+
return isRTLString('start', str);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const isEndsWithRTL = (str?: string): boolean => {
|
|
25
|
+
return isRTLString('end', str);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const isRTLCodePoint = (codePoint: number) => {
|
|
29
|
+
for (const [start, end] of rtlCodePointRanges) {
|
|
30
|
+
if (codePoint >= start && codePoint <= end) {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const rtlCodePointRanges = [
|
|
38
|
+
[0x0590, 0x05ff], // Hebrew
|
|
39
|
+
[0x0600, 0x06ff], // Arabic
|
|
40
|
+
[0x0750, 0x077f], // Arabic Supplement
|
|
41
|
+
[0x08a0, 0x08ff], // Hebrew Supplement
|
|
42
|
+
[0xfb1d, 0xfb4f], // Hebrew Presentation Forms
|
|
43
|
+
[0xfe70, 0xfeff], // Arabic Presentation Forms-B
|
|
44
|
+
[0x1ee00, 0x1eeff], // Arabic Mathematical Alphabetic Symbols
|
|
45
|
+
];
|
package/src/types.ts
CHANGED
|
@@ -39,6 +39,7 @@ import type {
|
|
|
39
39
|
MessageSearchQuery,
|
|
40
40
|
MultipleFilesMessage,
|
|
41
41
|
PreviousMessageListQuery,
|
|
42
|
+
ReactedUserInfo,
|
|
42
43
|
Reaction,
|
|
43
44
|
UserMessage,
|
|
44
45
|
UserMessageCreateParams,
|
|
@@ -112,6 +113,7 @@ export type SendbirdOpenChannel = OpenChannel;
|
|
|
112
113
|
export type SendbirdFeedChannel = FeedChannel;
|
|
113
114
|
|
|
114
115
|
export type SendbirdReaction = Reaction;
|
|
116
|
+
export type SendbirdReactedUserInfo = ReactedUserInfo;
|
|
115
117
|
export type SendbirdEmoji = Emoji;
|
|
116
118
|
export type SendbirdEmojiCategory = EmojiCategory;
|
|
117
119
|
export type SendbirdEmojiContainer = EmojiContainer;
|