@chayns-components/emoji-input 5.0.0-beta.132 → 5.0.0-beta.1320
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/README.md +4 -15
- package/lib/{api → cjs/api}/item-storage/get.js +4 -5
- package/lib/cjs/api/item-storage/get.js.map +1 -0
- package/lib/{api → cjs/api}/item-storage/put.js +5 -6
- package/lib/cjs/api/item-storage/put.js.map +1 -0
- package/lib/cjs/components/emoji-input/EmojiInput.js +561 -0
- package/lib/cjs/components/emoji-input/EmojiInput.js.map +1 -0
- package/lib/cjs/components/emoji-input/EmojiInput.styles.js +131 -0
- package/lib/cjs/components/emoji-input/EmojiInput.styles.js.map +1 -0
- package/lib/cjs/components/emoji-input/prefix-element/PrefixElement.js +44 -0
- package/lib/cjs/components/emoji-input/prefix-element/PrefixElement.js.map +1 -0
- package/lib/cjs/components/emoji-input/prefix-element/PrefixElement.styles.js +64 -0
- package/lib/cjs/components/emoji-input/prefix-element/PrefixElement.styles.js.map +1 -0
- package/lib/cjs/components/emoji-picker/EmojiPicker.js +47 -0
- package/lib/cjs/components/emoji-picker/EmojiPicker.js.map +1 -0
- package/lib/{components → cjs/components}/emoji-picker/EmojiPicker.styles.js +3 -5
- package/lib/cjs/components/emoji-picker/EmojiPicker.styles.js.map +1 -0
- package/lib/cjs/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js +99 -0
- package/lib/cjs/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js.map +1 -0
- package/lib/{components → cjs/components}/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js +4 -6
- package/lib/cjs/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js.map +1 -0
- package/lib/cjs/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js +260 -0
- package/lib/cjs/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js.map +1 -0
- package/lib/cjs/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js +66 -0
- package/lib/cjs/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js.map +1 -0
- package/lib/{components → cjs/components}/emoji-picker/emoji-picker-emojis/emoji/Emoji.js +63 -34
- package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.js.map +1 -0
- package/lib/{components → cjs/components}/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js +6 -3
- package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js.map +1 -0
- package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js +130 -0
- package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js.map +1 -0
- package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js +98 -0
- package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js.map +1 -0
- package/lib/cjs/components/emoji-picker-popup/EmojiPickerPopup.js +51 -0
- package/lib/cjs/components/emoji-picker-popup/EmojiPickerPopup.js.map +1 -0
- package/lib/cjs/components/emoji-picker-popup/EmojiPickerPopup.styles.js +15 -0
- package/lib/cjs/components/emoji-picker-popup/EmojiPickerPopup.styles.js.map +1 -0
- package/lib/{constants → cjs/constants}/alignment.js +2 -4
- package/lib/cjs/constants/alignment.js.map +1 -0
- package/lib/{constants → cjs/constants}/categories.js +1 -2
- package/lib/cjs/constants/categories.js.map +1 -0
- package/lib/cjs/constants/emoji.js +126 -0
- package/lib/cjs/constants/emoji.js.map +1 -0
- package/lib/cjs/constants/externalServerUrl.js +8 -0
- package/lib/cjs/constants/externalServerUrl.js.map +1 -0
- package/lib/cjs/constants/regex.js +15 -0
- package/lib/cjs/constants/regex.js.map +1 -0
- package/lib/cjs/hooks/cursor.js +110 -0
- package/lib/cjs/hooks/cursor.js.map +1 -0
- package/lib/{hooks → cjs/hooks}/emojiHistory.js +13 -15
- package/lib/cjs/hooks/emojiHistory.js.map +1 -0
- package/lib/{index.js → cjs/index.js} +28 -3
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/types/api.js.map +1 -0
- package/lib/cjs/types/category.js.map +1 -0
- package/lib/cjs/utils/asyncEmojiData.js +10 -0
- package/lib/cjs/utils/asyncEmojiData.js.map +1 -0
- package/lib/cjs/utils/convertEmojisToUnicodeAsync.js +29 -0
- package/lib/cjs/utils/convertEmojisToUnicodeAsync.js.map +1 -0
- package/lib/{utils → cjs/utils}/emoji.js +17 -13
- package/lib/cjs/utils/emoji.js.map +1 -0
- package/lib/{constants/emoji.js → cjs/utils/emojiShortList.js} +4 -127
- package/lib/cjs/utils/emojiShortList.js.map +1 -0
- package/lib/cjs/utils/environment.js.map +1 -0
- package/lib/cjs/utils/font.js.map +1 -0
- package/lib/{utils → cjs/utils}/insert.js +47 -9
- package/lib/cjs/utils/insert.js.map +1 -0
- package/lib/cjs/utils/number.js +17 -0
- package/lib/cjs/utils/number.js.map +1 -0
- package/lib/cjs/utils/scroll.js +65 -0
- package/lib/cjs/utils/scroll.js.map +1 -0
- package/lib/cjs/utils/selection.js +351 -0
- package/lib/cjs/utils/selection.js.map +1 -0
- package/lib/cjs/utils/text.js +63 -0
- package/lib/cjs/utils/text.js.map +1 -0
- package/lib/esm/api/item-storage/get.js +29 -0
- package/lib/esm/api/item-storage/get.js.map +1 -0
- package/lib/esm/api/item-storage/put.js +34 -0
- package/lib/esm/api/item-storage/put.js.map +1 -0
- package/lib/esm/components/emoji-input/EmojiInput.js +542 -0
- package/lib/esm/components/emoji-input/EmojiInput.js.map +1 -0
- package/lib/esm/components/emoji-input/EmojiInput.styles.js +124 -0
- package/lib/esm/components/emoji-input/EmojiInput.styles.js.map +1 -0
- package/lib/esm/components/emoji-input/prefix-element/PrefixElement.js +37 -0
- package/lib/esm/components/emoji-input/prefix-element/PrefixElement.js.map +1 -0
- package/lib/esm/components/emoji-input/prefix-element/PrefixElement.styles.js +57 -0
- package/lib/esm/components/emoji-input/prefix-element/PrefixElement.styles.js.map +1 -0
- package/lib/esm/components/emoji-picker/EmojiPicker.js +39 -0
- package/lib/esm/components/emoji-picker/EmojiPicker.js.map +1 -0
- package/lib/esm/components/emoji-picker/EmojiPicker.styles.js +16 -0
- package/lib/esm/components/emoji-picker/EmojiPicker.styles.js.map +1 -0
- package/lib/esm/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js +91 -0
- package/lib/esm/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js.map +1 -0
- package/lib/esm/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js +18 -0
- package/lib/esm/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js.map +1 -0
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js +251 -0
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js.map +1 -0
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js +59 -0
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js.map +1 -0
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.js +137 -0
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.js.map +1 -0
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js +17 -0
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js.map +1 -0
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js +120 -0
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js.map +1 -0
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js +91 -0
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js.map +1 -0
- package/lib/esm/components/emoji-picker-popup/EmojiPickerPopup.js +42 -0
- package/lib/esm/components/emoji-picker-popup/EmojiPickerPopup.js.map +1 -0
- package/lib/esm/components/emoji-picker-popup/EmojiPickerPopup.styles.js +8 -0
- package/lib/esm/components/emoji-picker-popup/EmojiPickerPopup.styles.js.map +1 -0
- package/lib/esm/constants/alignment.js +13 -0
- package/lib/esm/constants/alignment.js.map +1 -0
- package/lib/esm/constants/categories.js +13 -0
- package/lib/esm/constants/categories.js.map +1 -0
- package/lib/esm/constants/emoji-de-DE.json +3827 -0
- package/lib/esm/constants/emoji.js +120 -0
- package/lib/esm/constants/emoji.js.map +1 -0
- package/lib/esm/constants/externalServerUrl.js +2 -0
- package/lib/esm/constants/externalServerUrl.js.map +1 -0
- package/lib/esm/constants/regex.js +9 -0
- package/lib/esm/constants/regex.js.map +1 -0
- package/lib/esm/hooks/cursor.js +103 -0
- package/lib/esm/hooks/cursor.js.map +1 -0
- package/lib/esm/hooks/emojiHistory.js +81 -0
- package/lib/esm/hooks/emojiHistory.js.map +1 -0
- package/lib/{index.d.ts → esm/index.js} +3 -1
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/types/api.js +2 -0
- package/lib/esm/types/api.js.map +1 -0
- package/lib/esm/types/category.js +2 -0
- package/lib/esm/types/category.js.map +1 -0
- package/lib/esm/utils/asyncEmojiData.js +2 -0
- package/lib/esm/utils/asyncEmojiData.js.map +1 -0
- package/lib/esm/utils/convertEmojisToUnicodeAsync.js +20 -0
- package/lib/esm/utils/convertEmojisToUnicodeAsync.js.map +1 -0
- package/lib/esm/utils/emoji.js +90 -0
- package/lib/esm/utils/emoji.js.map +1 -0
- package/lib/esm/utils/emojiShortList.js +3679 -0
- package/lib/esm/utils/emojiShortList.js.map +1 -0
- package/lib/esm/utils/environment.js +24 -0
- package/lib/esm/utils/environment.js.map +1 -0
- package/lib/esm/utils/font.js +10 -0
- package/lib/esm/utils/font.js.map +1 -0
- package/lib/esm/utils/insert.js +104 -0
- package/lib/esm/utils/insert.js.map +1 -0
- package/lib/esm/utils/number.js +10 -0
- package/lib/esm/utils/number.js.map +1 -0
- package/lib/esm/utils/scroll.js +58 -0
- package/lib/esm/utils/scroll.js.map +1 -0
- package/lib/esm/utils/selection.js +324 -0
- package/lib/esm/utils/selection.js.map +1 -0
- package/lib/esm/utils/text.js +54 -0
- package/lib/esm/utils/text.js.map +1 -0
- package/lib/types/components/emoji-input/EmojiInput.d.ts +101 -0
- package/lib/types/components/emoji-input/EmojiInput.styles.d.ts +26 -0
- package/lib/types/components/emoji-input/prefix-element/PrefixElement.d.ts +8 -0
- package/lib/types/components/emoji-input/prefix-element/PrefixElement.styles.d.ts +12 -0
- package/lib/types/components/emoji-picker/EmojiPicker.styles.d.ts +5 -0
- package/lib/types/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.d.ts +4 -0
- package/lib/types/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.d.ts +9 -0
- package/lib/{components → types/components}/emoji-picker/emoji-picker-emojis/emoji/Emoji.d.ts +10 -0
- package/lib/types/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.d.ts +6 -0
- package/lib/{components → types/components}/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.d.ts +5 -0
- package/lib/types/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.d.ts +20 -0
- package/lib/{components → types/components}/emoji-picker-popup/EmojiPickerPopup.d.ts +0 -13
- package/lib/types/components/emoji-picker-popup/EmojiPickerPopup.styles.d.ts +1 -0
- package/lib/types/constants/emoji.d.ts +4 -0
- package/lib/types/constants/regex.d.ts +8 -0
- package/lib/types/hooks/cursor.d.ts +11 -0
- package/lib/types/index.d.ts +7 -0
- package/lib/types/utils/asyncEmojiData.d.ts +1 -0
- package/lib/types/utils/convertEmojisToUnicodeAsync.d.ts +3 -0
- package/lib/types/utils/emoji.d.ts +10 -0
- package/lib/{constants/emoji.d.ts → types/utils/emojiShortList.d.ts} +0 -4
- package/lib/{utils → types/utils}/insert.d.ts +10 -1
- package/lib/types/utils/number.d.ts +1 -0
- package/lib/types/utils/scroll.d.ts +1 -0
- package/lib/types/utils/selection.d.ts +30 -0
- package/lib/types/utils/text.d.ts +5 -0
- package/package.json +50 -31
- package/lib/api/item-storage/get.js.map +0 -1
- package/lib/api/item-storage/put.js.map +0 -1
- package/lib/components/emoji-input/EmojiInput.d.ts +0 -55
- package/lib/components/emoji-input/EmojiInput.js +0 -163
- package/lib/components/emoji-input/EmojiInput.js.map +0 -1
- package/lib/components/emoji-input/EmojiInput.styles.d.ts +0 -13
- package/lib/components/emoji-input/EmojiInput.styles.js +0 -154
- package/lib/components/emoji-input/EmojiInput.styles.js.map +0 -1
- package/lib/components/emoji-picker/EmojiPicker.js +0 -51
- package/lib/components/emoji-picker/EmojiPicker.js.map +0 -1
- package/lib/components/emoji-picker/EmojiPicker.styles.d.ts +0 -5
- package/lib/components/emoji-picker/EmojiPicker.styles.js.map +0 -1
- package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js +0 -51
- package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js.map +0 -1
- package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.d.ts +0 -2
- package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js.map +0 -1
- package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js +0 -131
- package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js.map +0 -1
- package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.d.ts +0 -7
- package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js +0 -99
- package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js.map +0 -1
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.js.map +0 -1
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.d.ts +0 -1
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js.map +0 -1
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js +0 -74
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js.map +0 -1
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.d.ts +0 -11
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js +0 -104
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js.map +0 -1
- package/lib/components/emoji-picker-popup/EmojiPickerPopup.js +0 -150
- package/lib/components/emoji-picker-popup/EmojiPickerPopup.js.map +0 -1
- package/lib/components/emoji-picker-popup/EmojiPickerPopup.styles.d.ts +0 -7
- package/lib/components/emoji-picker-popup/EmojiPickerPopup.styles.js +0 -97
- package/lib/components/emoji-picker-popup/EmojiPickerPopup.styles.js.map +0 -1
- package/lib/constants/alignment.js.map +0 -1
- package/lib/constants/categories.js.map +0 -1
- package/lib/constants/emoji.js.map +0 -1
- package/lib/constants/externalServerUrl.js +0 -9
- package/lib/constants/externalServerUrl.js.map +0 -1
- package/lib/constants/regex.d.ts +0 -2
- package/lib/constants/regex.js +0 -11
- package/lib/constants/regex.js.map +0 -1
- package/lib/hooks/emojiHistory.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/types/api.js.map +0 -1
- package/lib/types/category.js.map +0 -1
- package/lib/utils/emoji.d.ts +0 -3
- package/lib/utils/emoji.js.map +0 -1
- package/lib/utils/environment.js.map +0 -1
- package/lib/utils/font.js.map +0 -1
- package/lib/utils/insert.js.map +0 -1
- package/lib/utils/selection.d.ts +0 -8
- package/lib/utils/selection.js +0 -98
- package/lib/utils/selection.js.map +0 -1
- package/lib/utils/text.d.ts +0 -2
- package/lib/utils/text.js +0 -22
- package/lib/utils/text.js.map +0 -1
- /package/lib/{constants → cjs/constants}/emoji-de-DE.json +0 -0
- /package/lib/{types → cjs/types}/api.js +0 -0
- /package/lib/{types → cjs/types}/category.js +0 -0
- /package/lib/{utils → cjs/utils}/environment.js +0 -0
- /package/lib/{utils → cjs/utils}/font.js +0 -0
- /package/lib/{api → types/api}/item-storage/get.d.ts +0 -0
- /package/lib/{api → types/api}/item-storage/put.d.ts +0 -0
- /package/lib/{components → types/components}/emoji-picker/EmojiPicker.d.ts +0 -0
- /package/lib/{components → types/components}/emoji-picker/emoji-picker-categories/EmojiPickerCategories.d.ts +0 -0
- /package/lib/{components → types/components}/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.d.ts +0 -0
- /package/lib/{constants → types/constants}/alignment.d.ts +0 -0
- /package/lib/{constants → types/constants}/categories.d.ts +0 -0
- /package/lib/{constants → types/constants}/externalServerUrl.d.ts +0 -0
- /package/lib/{hooks → types/hooks}/emojiHistory.d.ts +0 -0
- /package/lib/types/{api.d.ts → types/api.d.ts} +0 -0
- /package/lib/types/{category.d.ts → types/category.d.ts} +0 -0
- /package/lib/{utils → types/utils}/environment.d.ts +0 -0
- /package/lib/{utils → types/utils}/font.d.ts +0 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useCursorPosition = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _selection = require("../utils/selection");
|
|
9
|
+
const useCursorPosition = (editorRef, onChange, options) => {
|
|
10
|
+
const {
|
|
11
|
+
isDisabled
|
|
12
|
+
} = options || {};
|
|
13
|
+
const [position, setPosition] = (0, _react.useState)(null);
|
|
14
|
+
const rafIdRef = (0, _react.useRef)(null);
|
|
15
|
+
const lastPositionRef = (0, _react.useRef)(null);
|
|
16
|
+
const emit = (0, _react.useCallback)(() => {
|
|
17
|
+
const el = editorRef.current;
|
|
18
|
+
if (!el || isDisabled) return;
|
|
19
|
+
const pos = (0, _selection.getCurrentCursorPosition)(el);
|
|
20
|
+
if (pos !== null && pos !== lastPositionRef.current) {
|
|
21
|
+
lastPositionRef.current = pos;
|
|
22
|
+
setPosition(pos);
|
|
23
|
+
if (typeof onChange === 'function') onChange(pos);
|
|
24
|
+
}
|
|
25
|
+
}, [editorRef, onChange, isDisabled]);
|
|
26
|
+
const scheduleEmit = (0, _react.useCallback)(() => {
|
|
27
|
+
if (rafIdRef.current != null) cancelAnimationFrame(rafIdRef.current);
|
|
28
|
+
rafIdRef.current = requestAnimationFrame(() => {
|
|
29
|
+
rafIdRef.current = null;
|
|
30
|
+
emit();
|
|
31
|
+
});
|
|
32
|
+
}, [emit]);
|
|
33
|
+
const trigger = (0, _react.useCallback)(() => {
|
|
34
|
+
scheduleEmit();
|
|
35
|
+
}, [scheduleEmit]);
|
|
36
|
+
(0, _react.useEffect)(() => {
|
|
37
|
+
const el = editorRef.current;
|
|
38
|
+
if (!el) return () => {};
|
|
39
|
+
const onKeyUp = e => {
|
|
40
|
+
const navKeys = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Home', 'End', 'PageUp', 'PageDown', 'Backspace', 'Delete'];
|
|
41
|
+
if (navKeys.includes(e.key)) scheduleEmit();
|
|
42
|
+
};
|
|
43
|
+
el.addEventListener('keyup', onKeyUp, {
|
|
44
|
+
passive: true
|
|
45
|
+
});
|
|
46
|
+
return () => el.removeEventListener('keyup', onKeyUp);
|
|
47
|
+
}, [editorRef, scheduleEmit]);
|
|
48
|
+
(0, _react.useEffect)(() => {
|
|
49
|
+
const el = editorRef.current;
|
|
50
|
+
if (!el) return () => {};
|
|
51
|
+
const onMouseUp = () => scheduleEmit();
|
|
52
|
+
const onTouchEnd = () => scheduleEmit();
|
|
53
|
+
el.addEventListener('mouseup', onMouseUp, {
|
|
54
|
+
passive: true
|
|
55
|
+
});
|
|
56
|
+
el.addEventListener('touchend', onTouchEnd, {
|
|
57
|
+
passive: true
|
|
58
|
+
});
|
|
59
|
+
return () => {
|
|
60
|
+
el.removeEventListener('mouseup', onMouseUp);
|
|
61
|
+
el.removeEventListener('touchend', onTouchEnd);
|
|
62
|
+
};
|
|
63
|
+
}, [editorRef, scheduleEmit]);
|
|
64
|
+
(0, _react.useEffect)(() => {
|
|
65
|
+
const onSelectionChange = () => {
|
|
66
|
+
const el = editorRef.current;
|
|
67
|
+
const sel = document.getSelection();
|
|
68
|
+
if (!el || !sel) return;
|
|
69
|
+
const {
|
|
70
|
+
anchorNode
|
|
71
|
+
} = sel;
|
|
72
|
+
if (anchorNode && el.contains(anchorNode) && document.activeElement === el) {
|
|
73
|
+
scheduleEmit();
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
document.addEventListener('selectionchange', onSelectionChange, {
|
|
77
|
+
passive: true
|
|
78
|
+
});
|
|
79
|
+
return () => document.removeEventListener('selectionchange', onSelectionChange);
|
|
80
|
+
}, [editorRef, scheduleEmit]);
|
|
81
|
+
(0, _react.useEffect)(() => {
|
|
82
|
+
const el = editorRef.current;
|
|
83
|
+
if (!el) return () => {};
|
|
84
|
+
const onFocus = () => scheduleEmit();
|
|
85
|
+
const onBlur = () => {
|
|
86
|
+
lastPositionRef.current = null;
|
|
87
|
+
setPosition(null);
|
|
88
|
+
};
|
|
89
|
+
el.addEventListener('focus', onFocus, {
|
|
90
|
+
passive: true
|
|
91
|
+
});
|
|
92
|
+
el.addEventListener('blur', onBlur, {
|
|
93
|
+
passive: true
|
|
94
|
+
});
|
|
95
|
+
return () => {
|
|
96
|
+
el.removeEventListener('focus', onFocus);
|
|
97
|
+
el.removeEventListener('blur', onBlur);
|
|
98
|
+
};
|
|
99
|
+
}, [editorRef, scheduleEmit]);
|
|
100
|
+
(0, _react.useEffect)(() => () => {
|
|
101
|
+
if (rafIdRef.current != null) cancelAnimationFrame(rafIdRef.current);
|
|
102
|
+
}, []);
|
|
103
|
+
return {
|
|
104
|
+
position,
|
|
105
|
+
trigger,
|
|
106
|
+
lastPositionRef
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
exports.useCursorPosition = useCursorPosition;
|
|
110
|
+
//# sourceMappingURL=cursor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor.js","names":["_react","require","_selection","useCursorPosition","editorRef","onChange","options","isDisabled","position","setPosition","useState","rafIdRef","useRef","lastPositionRef","emit","useCallback","el","current","pos","getCurrentCursorPosition","scheduleEmit","cancelAnimationFrame","requestAnimationFrame","trigger","useEffect","onKeyUp","e","navKeys","includes","key","addEventListener","passive","removeEventListener","onMouseUp","onTouchEnd","onSelectionChange","sel","document","getSelection","anchorNode","contains","activeElement","onFocus","onBlur","exports"],"sources":["../../../src/hooks/cursor.ts"],"sourcesContent":["import { MutableRefObject, RefObject, useCallback, useEffect, useRef, useState } from 'react';\nimport { getCurrentCursorPosition } from '../utils/selection';\n\ntype UseCursorPositionOptions = {\n isDisabled?: boolean;\n};\n\ntype UseCursorPositionReturn = {\n position: number | null;\n trigger: () => void;\n lastPositionRef: MutableRefObject<number | null>;\n};\n\nexport const useCursorPosition = (\n editorRef: RefObject<HTMLDivElement>,\n onChange?: (position: number) => void,\n options?: UseCursorPositionOptions,\n): UseCursorPositionReturn => {\n const { isDisabled } = options || {};\n const [position, setPosition] = useState<number | null>(null);\n\n const rafIdRef = useRef<number | null>(null);\n const lastPositionRef = useRef<number | null>(null);\n\n const emit = useCallback(() => {\n const el = editorRef.current;\n\n if (!el || isDisabled) return;\n\n const pos = getCurrentCursorPosition(el);\n\n if (pos !== null && pos !== lastPositionRef.current) {\n lastPositionRef.current = pos;\n setPosition(pos);\n\n if (typeof onChange === 'function') onChange(pos);\n }\n }, [editorRef, onChange, isDisabled]);\n\n const scheduleEmit = useCallback(() => {\n if (rafIdRef.current != null) cancelAnimationFrame(rafIdRef.current);\n\n rafIdRef.current = requestAnimationFrame(() => {\n rafIdRef.current = null;\n emit();\n });\n }, [emit]);\n\n const trigger = useCallback(() => {\n scheduleEmit();\n }, [scheduleEmit]);\n\n useEffect(() => {\n const el = editorRef.current;\n\n if (!el) return () => {};\n\n const onKeyUp = (e: KeyboardEvent) => {\n const navKeys = [\n 'ArrowLeft',\n 'ArrowRight',\n 'ArrowUp',\n 'ArrowDown',\n 'Home',\n 'End',\n 'PageUp',\n 'PageDown',\n 'Backspace',\n 'Delete',\n ];\n\n if (navKeys.includes(e.key)) scheduleEmit();\n };\n\n el.addEventListener('keyup', onKeyUp, { passive: true });\n\n return () => el.removeEventListener('keyup', onKeyUp);\n }, [editorRef, scheduleEmit]);\n\n useEffect(() => {\n const el = editorRef.current;\n\n if (!el) return () => {};\n\n const onMouseUp = () => scheduleEmit();\n const onTouchEnd = () => scheduleEmit();\n\n el.addEventListener('mouseup', onMouseUp, { passive: true });\n el.addEventListener('touchend', onTouchEnd, { passive: true });\n\n return () => {\n el.removeEventListener('mouseup', onMouseUp);\n el.removeEventListener('touchend', onTouchEnd);\n };\n }, [editorRef, scheduleEmit]);\n\n useEffect(() => {\n const onSelectionChange = () => {\n const el = editorRef.current;\n const sel = document.getSelection();\n\n if (!el || !sel) return;\n\n const { anchorNode } = sel;\n\n if (anchorNode && el.contains(anchorNode) && document.activeElement === el) {\n scheduleEmit();\n }\n };\n\n document.addEventListener('selectionchange', onSelectionChange, { passive: true });\n\n return () => document.removeEventListener('selectionchange', onSelectionChange);\n }, [editorRef, scheduleEmit]);\n\n useEffect(() => {\n const el = editorRef.current;\n\n if (!el) return () => {};\n\n const onFocus = () => scheduleEmit();\n const onBlur = () => {\n lastPositionRef.current = null;\n setPosition(null);\n };\n\n el.addEventListener('focus', onFocus, { passive: true });\n el.addEventListener('blur', onBlur, { passive: true });\n\n return () => {\n el.removeEventListener('focus', onFocus);\n el.removeEventListener('blur', onBlur);\n };\n }, [editorRef, scheduleEmit]);\n\n useEffect(\n () => () => {\n if (rafIdRef.current != null) cancelAnimationFrame(rafIdRef.current);\n },\n [],\n );\n\n return {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E,CAACc,gBAAgB,CAAC,OAAO,EAAEY,OAAO,EAAE;MAAEX,OAAO,EAAE;IAAK,CAAC,CAAC;IACxDf,EAAE,CAACc,gBAAgB,CAAC,MAAM,EAAEa,MAAM,EAAE;MAAEZ,OAAO,EAAE;IAAK,CAAC,CAAC;IAEtD,OAAO,MAAM;MACTf,EAAE,CAACgB,mBAAmB,CAAC,OAAO,EAAEU,OAAO,CAAC;MACxC1B,EAAE,CAACgB,mBAAmB,CAAC,MAAM,EAAEW,MAAM,CAAC;IAC1C,CAAC;EACL,CAAC,EAAE,CAACvC,SAAS,EAAEgB,YAAY,CAAC,CAAC;EAE7B,IAAAI,gBAAS,EACL,MAAM,MAAM;IACR,IAAIb,QAAQ,CAACM,OAAO,IAAI,IAAI,EAAEI,oBAAoB,CAACV,QAAQ,CAACM,OAAO,CAAC;EACxE,CAAC,EACD,EACJ,CAAC;EAED,OAAO;IAAET,QAAQ;IAAEe,OAAO;IAAEV;EAAgB,CAAC;AACjD,CAAC;AAAC+B,OAAA,CAAAzC,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
@@ -7,32 +7,30 @@ exports.useEmojiHistory = void 0;
|
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _get = require("../api/item-storage/get");
|
|
9
9
|
var _put = require("../api/item-storage/put");
|
|
10
|
-
const useEmojiHistory =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
} = _ref;
|
|
10
|
+
const useEmojiHistory = ({
|
|
11
|
+
accessToken,
|
|
12
|
+
personId,
|
|
13
|
+
selectedCategory
|
|
14
|
+
}) => {
|
|
16
15
|
const [historyEmojis, setHistoryEmojis] = (0, _react.useState)([]);
|
|
17
16
|
const tempHistoryEmojis = (0, _react.useRef)(null);
|
|
18
|
-
const addOrUpdateEmojiInHistory = (0, _react.useCallback)(async
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
} = _ref2;
|
|
17
|
+
const addOrUpdateEmojiInHistory = (0, _react.useCallback)(async ({
|
|
18
|
+
emoji,
|
|
19
|
+
name,
|
|
20
|
+
skin_tone_support
|
|
21
|
+
}) => {
|
|
22
|
+
var _historyItem;
|
|
25
23
|
if (typeof accessToken !== 'string' || typeof personId !== 'string') {
|
|
26
24
|
return;
|
|
27
25
|
}
|
|
28
|
-
const newHistoryEmojis = Array.from(
|
|
26
|
+
const newHistoryEmojis = Array.from(tempHistoryEmojis.current ?? historyEmojis);
|
|
29
27
|
const historyItemIndex = newHistoryEmojis.findIndex(item => item.emoji === emoji);
|
|
30
28
|
let historyItem;
|
|
31
29
|
if (historyItemIndex > -1) {
|
|
32
30
|
[historyItem] = newHistoryEmojis.splice(historyItemIndex, 1);
|
|
33
31
|
}
|
|
34
32
|
newHistoryEmojis.push({
|
|
35
|
-
count: ((
|
|
33
|
+
count: (((_historyItem = historyItem) === null || _historyItem === void 0 ? void 0 : _historyItem.count) ?? 0) + 1,
|
|
36
34
|
emoji,
|
|
37
35
|
modifiedTime: new Date().toISOString(),
|
|
38
36
|
name,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emojiHistory.js","names":["_react","require","_get","_put","useEmojiHistory","accessToken","personId","selectedCategory","historyEmojis","setHistoryEmojis","useState","tempHistoryEmojis","useRef","addOrUpdateEmojiInHistory","useCallback","emoji","name","skin_tone_support","_historyItem","newHistoryEmojis","Array","from","current","historyItemIndex","findIndex","item","historyItem","splice","push","count","modifiedTime","Date","toISOString","sort","a","b","getTime","data","putEmojiHistory","value","slice","loadHistoryEmojis","getEmojiHistory","useEffect","exports"],"sources":["../../../src/hooks/emojiHistory.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\nimport { getEmojiHistory } from '../api/item-storage/get';\nimport { putEmojiHistory } from '../api/item-storage/put';\nimport type { Category } from '../types/category';\n\nexport interface HistoryItem {\n count: number;\n emoji: string;\n modifiedTime: string;\n name: string;\n skin_tone_support: boolean;\n}\n\ninterface UseEmojiHistoryOptions {\n accessToken?: string;\n personId?: string;\n selectedCategory: Category;\n}\n\nexport const useEmojiHistory = ({\n accessToken,\n personId,\n selectedCategory,\n}: UseEmojiHistoryOptions) => {\n const [historyEmojis, setHistoryEmojis] = useState<HistoryItem[]>([]);\n\n const tempHistoryEmojis = useRef<HistoryItem[] | null>(null);\n\n const addOrUpdateEmojiInHistory = useCallback(\n async ({\n emoji,\n name,\n skin_tone_support,\n }: {\n emoji: string;\n name: string;\n skin_tone_support: boolean;\n }) => {\n if (typeof accessToken !== 'string' || typeof personId !== 'string') {\n return;\n }\n\n const newHistoryEmojis = Array.from(tempHistoryEmojis.current ?? historyEmojis);\n\n const historyItemIndex = newHistoryEmojis.findIndex((item) => item.emoji === emoji);\n\n let historyItem;\n\n if (historyItemIndex > -1) {\n [historyItem] = newHistoryEmojis.splice(historyItemIndex, 1);\n }\n\n newHistoryEmojis.push({\n count: (historyItem?.count ?? 0) + 1,\n emoji,\n modifiedTime: new Date().toISOString(),\n name,\n skin_tone_support,\n });\n\n newHistoryEmojis.sort((a, b) => {\n if (a.count === b.count) {\n return new Date(b.modifiedTime).getTime() - new Date(a.modifiedTime).getTime();\n }\n\n return b.count - a.count;\n });\n\n const { data } = await putEmojiHistory({\n accessToken,\n personId,\n value: newHistoryEmojis.slice(0, 50),\n });\n\n if (data) {\n if (selectedCategory === 'history') {\n tempHistoryEmojis.current = data;\n } else {\n tempHistoryEmojis.current = null;\n\n setHistoryEmojis(data);\n }\n }\n },\n [accessToken, historyEmojis, personId, selectedCategory],\n );\n\n const loadHistoryEmojis = useCallback(async () => {\n if (typeof accessToken !== 'string' || typeof personId !== 'string') {\n return;\n }\n\n const { data } = await getEmojiHistory({ accessToken, personId });\n\n if (data) {\n setHistoryEmojis(data);\n }\n }, [accessToken, personId]);\n\n useEffect(() => {\n void loadHistoryEmojis();\n }, [loadHistoryEmojis]);\n\n useEffect(() => {\n if (selectedCategory !== 'history' && tempHistoryEmojis.current) {\n setHistoryEmojis(tempHistoryEmojis.current);\n }\n }, [selectedCategory]);\n\n return { addOrUpdateEmojiInHistory, historyEmojis: historyEmojis.slice(0, 25) };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AAiBO,MAAMG,eAAe,GAAGA,CAAC;EAC5BC,WAAW;EACXC,QAAQ;EACRC;AACoB,CAAC,KAAK;EAC1B,MAAM,CAACC,aAAa,EAAEC,gBAAgB,CAAC,GAAG,IAAAC,eAAQ,EAAgB,EAAE,CAAC;EAErE,MAAMC,iBAAiB,GAAG,IAAAC,aAAM,EAAuB,IAAI,CAAC;EAE5D,MAAMC,yBAAyB,GAAG,IAAAC,kBAAW,EACzC,OAAO;IACHC,KAAK;IACLC,IAAI;IACJC;EAKJ,CAAC,KAAK;IAAA,IAAAC,YAAA;IACF,IAAI,OAAOb,WAAW,KAAK,QAAQ,IAAI,OAAOC,QAAQ,KAAK,QAAQ,EAAE;MACjE;IACJ;IAEA,MAAMa,gBAAgB,GAAGC,KAAK,CAACC,IAAI,CAACV,iBAAiB,CAACW,OAAO,IAAId,aAAa,CAAC;IAE/E,MAAMe,gBAAgB,GAAGJ,gBAAgB,CAACK,SAAS,CAAEC,IAAI,IAAKA,IAAI,CAACV,KAAK,KAAKA,KAAK,CAAC;IAEnF,IAAIW,WAAW;IAEf,IAAIH,gBAAgB,GAAG,CAAC,CAAC,EAAE;MACvB,CAACG,WAAW,CAAC,GAAGP,gBAAgB,CAACQ,MAAM,CAACJ,gBAAgB,EAAE,CAAC,CAAC;IAChE;IAEAJ,gBAAgB,CAACS,IAAI,CAAC;MAClBC,KAAK,EAAE,CAAC,EAAAX,YAAA,GAAAQ,WAAW,cAAAR,YAAA,uBAAXA,YAAA,CAAaW,KAAK,KAAI,CAAC,IAAI,CAAC;MACpCd,KAAK;MACLe,YAAY,EAAE,IAAIC,IAAI,CAAC,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ACJ,CAAC,EAAE,CAAChC,WAAW,EAAEC,QAAQ,CAAC,CAAC;EAE3B,IAAAqC,gBAAS,EAAC,MAAM;IACZ,KAAKF,iBAAiB,CAAC,CAAC;EAC5B,CAAC,EAAE,CAACA,iBAAiB,CAAC,CAAC;EAEvB,IAAAE,gBAAS,EAAC,MAAM;IACZ,IAAIpC,gBAAgB,KAAK,SAAS,IAAII,iBAAiB,CAACW,OAAO,EAAE;MAC7Db,gBAAgB,CAACE,iBAAiB,CAACW,OAAO,CAAC;IAC/C;EACJ,CAAC,EAAE,CAACf,gBAAgB,CAAC,CAAC;EAEtB,OAAO;IAAEM,yBAAyB;IAAEL,aAAa,EAAEA,aAAa,CAACgC,KAAK,CAAC,CAAC,EAAE,EAAE;EAAE,CAAC;AACnF,CAAC;AAACI,OAAA,CAAAxC,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -27,10 +27,34 @@ Object.defineProperty(exports, "PopupAlignment", {
|
|
|
27
27
|
return _alignment.PopupAlignment;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
-
Object.defineProperty(exports, "
|
|
30
|
+
Object.defineProperty(exports, "convertEmojiToUnicodeSync", {
|
|
31
31
|
enumerable: true,
|
|
32
32
|
get: function () {
|
|
33
|
-
return
|
|
33
|
+
return _convertEmojisToUnicodeAsync.convertEmojiToUnicodeSync;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "convertEmojisToUnicodeAsync", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _convertEmojisToUnicodeAsync.convertEmojisToUnicodeAsync;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "escapeHTML", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _emoji.escapeHTML;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "loadEmojiShortList", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _convertEmojisToUnicodeAsync.loadEmojiShortList;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "unescapeHTML", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _emoji.unescapeHTML;
|
|
34
58
|
}
|
|
35
59
|
});
|
|
36
60
|
var _EmojiInput = _interopRequireDefault(require("./components/emoji-input/EmojiInput"));
|
|
@@ -38,5 +62,6 @@ var _EmojiPickerPopup = _interopRequireDefault(require("./components/emoji-picke
|
|
|
38
62
|
var _EmojiPicker = _interopRequireDefault(require("./components/emoji-picker/EmojiPicker"));
|
|
39
63
|
var _alignment = require("./constants/alignment");
|
|
40
64
|
var _emoji = require("./utils/emoji");
|
|
41
|
-
|
|
65
|
+
var _convertEmojisToUnicodeAsync = require("./utils/convertEmojisToUnicodeAsync");
|
|
66
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
42
67
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_EmojiInput","_interopRequireDefault","require","_EmojiPickerPopup","_EmojiPicker","_alignment","_emoji","_convertEmojisToUnicodeAsync","e","__esModule","default"],"sources":["../../src/index.ts"],"sourcesContent":["export { default as EmojiInput } from './components/emoji-input/EmojiInput';\nexport type { EmojiInputRef } from './components/emoji-input/EmojiInput';\nexport { default as EmojiPickerPopup } from './components/emoji-picker-popup/EmojiPickerPopup';\nexport { default as EmojiPicker } from './components/emoji-picker/EmojiPicker';\nexport { PopupAlignment } from './constants/alignment';\nexport { escapeHTML, unescapeHTML } from './utils/emoji';\nexport {\n loadEmojiShortList,\n convertEmojisToUnicodeAsync,\n convertEmojiToUnicodeSync,\n} from './utils/convertEmojisToUnicodeAsync';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,YAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,4BAAA,GAAAL,OAAA;AAI6C,SAAAD,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","names":[],"sources":["../../../src/types/api.ts"],"sourcesContent":["export interface ApiFunctionResult<T = null> {\n data?: T;\n status?: number;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"category.js","names":[],"sources":["../../../src/types/category.ts"],"sourcesContent":["export type Category =\n | 'history'\n | 'smileys_emotion'\n | 'people_body'\n | 'animals_nature'\n | 'food_drink'\n | 'travel_places'\n | 'activities'\n | 'objects'\n | 'symbols'\n | 'flags';\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.loadEmojiShortList = void 0;
|
|
7
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
8
|
+
const loadEmojiShortList = () => Promise.resolve().then(() => _interopRequireWildcard(require('./emojiShortList')));
|
|
9
|
+
exports.loadEmojiShortList = loadEmojiShortList;
|
|
10
|
+
//# sourceMappingURL=asyncEmojiData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asyncEmojiData.js","names":["loadEmojiShortList","Promise","resolve","then","_interopRequireWildcard","require","exports"],"sources":["../../../src/utils/asyncEmojiData.ts"],"sourcesContent":["export const loadEmojiShortList = () => import('./emojiShortList');\n"],"mappings":";;;;;;;AAAO,MAAMA,kBAAkB,GAAGA,CAAA,KAAAC,OAAA,CAAAC,OAAA,GAAAC,IAAA,OAAAC,uBAAA,CAAAC,OAAA,CAAa,kBAAkB,GAAC;AAACC,OAAA,CAAAN,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.loadEmojiShortList = exports.convertEmojisToUnicodeAsync = exports.convertEmojiToUnicodeSync = void 0;
|
|
7
|
+
var _emoji = require("./emoji");
|
|
8
|
+
var _asyncEmojiData = require("./asyncEmojiData");
|
|
9
|
+
let regShortnames;
|
|
10
|
+
let shortNameList;
|
|
11
|
+
const loadEmojiShortList = async () => {
|
|
12
|
+
if (regShortnames && shortNameList) return;
|
|
13
|
+
({
|
|
14
|
+
regShortnames,
|
|
15
|
+
shortNameList
|
|
16
|
+
} = await (0, _asyncEmojiData.loadEmojiShortList)());
|
|
17
|
+
};
|
|
18
|
+
exports.loadEmojiShortList = loadEmojiShortList;
|
|
19
|
+
const convertEmojisToUnicodeAsync = async text => {
|
|
20
|
+
await loadEmojiShortList();
|
|
21
|
+
return convertEmojiToUnicodeSync(text);
|
|
22
|
+
};
|
|
23
|
+
exports.convertEmojisToUnicodeAsync = convertEmojisToUnicodeAsync;
|
|
24
|
+
const convertEmojiToUnicodeSync = text => {
|
|
25
|
+
if (!regShortnames || !shortNameList) throw new Error("convertEmojisToUnicodeSync requires to call loadEmojiShortList before being called");
|
|
26
|
+
return (0, _emoji.convertEmojisToUnicode)(text, regShortnames, shortNameList);
|
|
27
|
+
};
|
|
28
|
+
exports.convertEmojiToUnicodeSync = convertEmojiToUnicodeSync;
|
|
29
|
+
//# sourceMappingURL=convertEmojisToUnicodeAsync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertEmojisToUnicodeAsync.js","names":["_emoji","require","_asyncEmojiData","regShortnames","shortNameList","loadEmojiShortList","loadList","exports","convertEmojisToUnicodeAsync","text","convertEmojiToUnicodeSync","Error","convertEmojisToUnicode"],"sources":["../../../src/utils/convertEmojisToUnicodeAsync.ts"],"sourcesContent":["import { convertEmojisToUnicode } from './emoji';\nimport { loadEmojiShortList as loadList } from './asyncEmojiData';\n\nlet regShortnames: RegExp | undefined;\nlet shortNameList: Record<string, string> | undefined;\n\nexport const loadEmojiShortList = async () => {\n if (regShortnames && shortNameList) return;\n ({ regShortnames, shortNameList } = await loadList());\n}\n\nexport const convertEmojisToUnicodeAsync = async (text: string) => {\n await loadEmojiShortList();\n return convertEmojiToUnicodeSync(text);\n}\n\nexport const convertEmojiToUnicodeSync = (text: string) => {\n if (!regShortnames || !shortNameList) throw new Error(\"convertEmojisToUnicodeSync requires to call loadEmojiShortList before being called\");\n return convertEmojisToUnicode(text, regShortnames, shortNameList);\n}\n"],"mappings":";;;;;;AAAC,IAAAA,MAAA,GAAAC,OAAA;AACD,IAAAC,eAAA,GAAAD,OAAA;AAEA,IAAIE,aAAiC;AACrC,IAAIC,aAAiD;AAE9C,MAAMC,kBAAkB,GAAG,MAAAA,CAAA,KAAY;EAC1C,IAAIF,aAAa,IAAIC,aAAa,EAAE;EACpC,CAAC;IAAED,aAAa;IAAEC;EAAc,CAAC,GAAG,MAAM,IAAAE,kCAAQ,EAAC,CAAC;AACxD,CAAC;AAAAC,OAAA,CAAAF,kBAAA,GAAAA,kBAAA;AAEM,MAAMG,2BAA2B,GAAG,MAAOC,IAAY,IAAK;EAC/D,MAAMJ,kBAAkB,CAAC,CAAC;EAC1B,OAAOK,yBAAyB,CAACD,IAAI,CAAC;AAC1C,CAAC;AAAAF,OAAA,CAAAC,2BAAA,GAAAA,2BAAA;AAEM,MAAME,yBAAyB,GAAID,IAAY,IAAK;EACvD,IAAI,CAACN,aAAa,IAAI,CAACC,aAAa,EAAE,MAAM,IAAIO,KAAK,CAAC,oFAAoF,CAAC;EAC3I,OAAO,IAAAC,6BAAsB,EAACH,IAAI,EAAEN,aAAa,EAAEC,aAAa,CAAC;AACrE,CAAC;AAAAG,OAAA,CAAAG,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.unescapeHTML = exports.convertEmojisToUnicode = exports.addSkinToneToEmoji = void 0;
|
|
7
|
-
var _dataByEmoji = _interopRequireDefault(require("unicode-emoji-json/data-by-emoji.json"));
|
|
6
|
+
exports.unescapeHTML = exports.escapeHTML = exports.convertEmojisToUnicode = exports.addSkinToneToEmoji = void 0;
|
|
8
7
|
var _emoji = require("../constants/emoji");
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
8
|
const convert = unicode => {
|
|
11
9
|
if (unicode.indexOf('-') > -1) {
|
|
12
10
|
const parts = [];
|
|
@@ -51,18 +49,25 @@ const unescapeHTML = text => {
|
|
|
51
49
|
''': "'",
|
|
52
50
|
''': "'"
|
|
53
51
|
};
|
|
54
|
-
return text.replace(/&(?:amp|#38|#x26|lt|#60|#x3C|gt|#62|#x3E|apos|#39|#x27|quot|#34|#x22);/gi, match =>
|
|
55
|
-
var _unescaped$match;
|
|
56
|
-
return (_unescaped$match = unescaped[match]) !== null && _unescaped$match !== void 0 ? _unescaped$match : match;
|
|
57
|
-
});
|
|
52
|
+
return text.replace(/&(?:amp|#38|#x26|lt|#60|#x3C|gt|#62|#x3E|apos|#39|#x27|quot|#34|#x22);/gi, match => unescaped[match] ?? match);
|
|
58
53
|
};
|
|
59
54
|
exports.unescapeHTML = unescapeHTML;
|
|
60
|
-
const
|
|
55
|
+
const escapeHTML = text => {
|
|
56
|
+
const escaped = {
|
|
57
|
+
'<': '<',
|
|
58
|
+
'>': '>',
|
|
59
|
+
'"': '"',
|
|
60
|
+
"'": '''
|
|
61
|
+
};
|
|
62
|
+
return text.replace(/[&<>"']/g, match => escaped[match] ?? match);
|
|
63
|
+
};
|
|
64
|
+
exports.escapeHTML = escapeHTML;
|
|
65
|
+
const convertEmojisToUnicode = (text, regShortnames, shortNameList) => {
|
|
61
66
|
let result = text;
|
|
62
67
|
result = result.replace(/https?:\/\/.*?(?=$|\s)/gi, fullMatch => fullMatch.replace(/:/g, '%3A'));
|
|
63
|
-
result = result.replace(
|
|
68
|
+
result = result.replace(regShortnames, shortname => {
|
|
64
69
|
if (shortname) {
|
|
65
|
-
const unicode =
|
|
70
|
+
const unicode = shortNameList[shortname];
|
|
66
71
|
if (unicode) {
|
|
67
72
|
return convert(unicode.toUpperCase());
|
|
68
73
|
}
|
|
@@ -82,13 +87,12 @@ const convertEmojisToUnicode = text => {
|
|
|
82
87
|
return result;
|
|
83
88
|
};
|
|
84
89
|
exports.convertEmojisToUnicode = convertEmojisToUnicode;
|
|
85
|
-
const addSkinToneToEmoji = (emoji, skinTone) => emoji.split('\u{200D}').map(rawEmoji => {
|
|
90
|
+
const addSkinToneToEmoji = (emojiList, emoji, skinTone) => emoji.split('\u{200D}').map(rawEmoji => {
|
|
86
91
|
var _emojiList$rawEmoji;
|
|
87
92
|
const parts = [rawEmoji.replace(/\ufe0f/, '')];
|
|
88
93
|
|
|
89
|
-
// @ts-expect-error: Difficult to type external json file
|
|
90
94
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
91
|
-
if ((_emojiList$rawEmoji =
|
|
95
|
+
if ((_emojiList$rawEmoji = emojiList[rawEmoji]) !== null && _emojiList$rawEmoji !== void 0 && _emojiList$rawEmoji.skin_tone_support) {
|
|
92
96
|
parts.push(skinTone);
|
|
93
97
|
}
|
|
94
98
|
return parts.join('');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emoji.js","names":["_emoji","require","convert","unicode","indexOf","parts","s","split","i","length","part","parseInt","hi","Math","floor","lo","String","fromCharCode","push","join","unescapeHTML","text","unescaped","replace","match","exports","escapeHTML","escaped","convertEmojisToUnicode","regShortnames","shortNameList","result","fullMatch","shortname","toUpperCase","regAscii","m1","m2","m3","asciiList","addSkinToneToEmoji","emojiList","emoji","skinTone","map","rawEmoji","_emojiList$rawEmoji","skin_tone_support"],"sources":["../../../src/utils/emoji.ts"],"sourcesContent":["import { asciiList, regAscii } from '../constants/emoji';\n\nconst convert = (unicode: string) => {\n if (unicode.indexOf('-') > -1) {\n const parts = [];\n\n const s = unicode.split('-');\n\n for (let i = 0; i < s.length; i++) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n let part: number | string = parseInt(s[i]!, 16);\n\n if (part >= 0x10000 && part <= 0x10ffff) {\n const hi = Math.floor((part - 0x10000) / 0x400) + 0xd800;\n const lo = ((part - 0x10000) % 0x400) + 0xdc00;\n\n part = String.fromCharCode(hi) + String.fromCharCode(lo);\n } else {\n part = String.fromCharCode(part);\n }\n\n parts.push(part);\n }\n\n return parts.join('');\n }\n\n const s = parseInt(unicode, 16);\n\n if (s >= 0x10000 && s <= 0x10ffff) {\n const hi = Math.floor((s - 0x10000) / 0x400) + 0xd800;\n const lo = ((s - 0x10000) % 0x400) + 0xdc00;\n\n return String.fromCharCode(hi) + String.fromCharCode(lo);\n }\n\n return String.fromCharCode(s);\n};\n\nexport const unescapeHTML = (text: string) => {\n const unescaped: { [key: string]: string } = {\n '&': '&',\n '&': '&',\n '&': '&',\n '<': '<',\n '<': '<',\n '<': '<',\n '>': '>',\n '>': '>',\n '>': '>',\n '"': '\"',\n '"': '\"',\n '"': '\"',\n ''': \"'\",\n ''': \"'\",\n ''': \"'\",\n };\n\n return text.replace(\n /&(?:amp|#38|#x26|lt|#60|#x3C|gt|#62|#x3E|apos|#39|#x27|quot|#34|#x22);/gi,\n (match) => unescaped[match] ?? match,\n );\n};\n\nexport const escapeHTML = (text: string) => {\n const escaped: { [key: string]: string } = {\n '<': '<',\n '>': '>',\n '\"': '"',\n \"'\": ''',\n };\n\n return text.replace(/[&<>\"']/g, (match) => escaped[match] ?? match);\n};\n\nexport const convertEmojisToUnicode = (text: string, regShortnames: RegExp, shortNameList: { [p: string]: string }): string => {\n let result = text;\n\n result = result.replace(/https?:\\/\\/.*?(?=$|\\s)/gi, (fullMatch) =>\n fullMatch.replace(/:/g, '%3A'),\n );\n\n result = result.replace(regShortnames, (shortname) => {\n if (shortname) {\n const unicode = shortNameList[shortname];\n\n if (unicode) {\n return convert(unicode.toUpperCase());\n }\n }\n\n return shortname;\n });\n\n result = result.replace(/https?%3A\\/\\/.*?(?=$|\\s)/gi, (fullMatch) =>\n fullMatch.replace(/%3A/g, ':'),\n );\n\n result = result.replace(regAscii, (fullMatch, m1, m2, m3) => {\n if (typeof m3 === 'string' && m3 !== '') {\n const unicode = asciiList[unescapeHTML(m3)];\n\n if (unicode) {\n return (m2 as string) + convert(unicode.toUpperCase());\n }\n }\n\n return fullMatch;\n });\n\n return result;\n};\n\nexport const addSkinToneToEmoji = (\n emojiList: { [x: string]: { skin_tone_support: any } },\n emoji: string,\n skinTone: string,\n): string =>\n emoji\n .split('\\u{200D}')\n .map((rawEmoji) => {\n const parts = [rawEmoji.replace(/\\ufe0f/, '')];\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (emojiList[rawEmoji]?.skin_tone_support) {\n parts.push(skinTone);\n }\n\n return parts.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,MAAMzC,KAAK,GAAG,CAACwC,QAAQ,CAACtB,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;;EAE9C;EACA,KAAAuB,mBAAA,GAAIL,SAAS,CAACI,QAAQ,CAAC,cAAAC,mBAAA,eAAnBA,mBAAA,CAAqBC,iBAAiB,EAAE;IACxC1C,KAAK,CAACa,IAAI,CAACyB,QAAQ,CAAC;EACxB;EAEA,OAAOtC,KAAK,CAACc,IAAI,CAAC,EAAE,CAAC;AACzB,CAAC,CAAC,CACDA,IAAI,CAAC,UAAU,CAAC;AAACM,OAAA,CAAAe,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
@@ -3,129 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.shortNameList = exports.regShortnames =
|
|
7
|
-
const
|
|
8
|
-
'*\\0/*': '1f646',
|
|
9
|
-
'*\\O/*': '1f646',
|
|
10
|
-
'-___-': '1f611',
|
|
11
|
-
":'-)": '1f602',
|
|
12
|
-
"':-)": '1f605',
|
|
13
|
-
"':-D": '1f605',
|
|
14
|
-
'>:-)': '1f606',
|
|
15
|
-
"':-(": '1f613',
|
|
16
|
-
'>:-(': '1f620',
|
|
17
|
-
":'-(": '1f622',
|
|
18
|
-
'O:-)': '1f607',
|
|
19
|
-
'0:-3': '1f607',
|
|
20
|
-
'0:-)': '1f607',
|
|
21
|
-
'0;^)': '1f607',
|
|
22
|
-
'O;-)': '1f607',
|
|
23
|
-
'0;-)': '1f607',
|
|
24
|
-
'O:-3': '1f607',
|
|
25
|
-
'-__-': '1f611',
|
|
26
|
-
':-Þ': '1f61b',
|
|
27
|
-
'</3': '1f494',
|
|
28
|
-
":')": '1f602',
|
|
29
|
-
':-D': '1f603',
|
|
30
|
-
"':)": '1f605',
|
|
31
|
-
"'=)": '1f605',
|
|
32
|
-
"':D": '1f605',
|
|
33
|
-
"'=D": '1f605',
|
|
34
|
-
'>:)': '1f606',
|
|
35
|
-
'>;)': '1f606',
|
|
36
|
-
'>=)': '1f606',
|
|
37
|
-
';-)': '1f609',
|
|
38
|
-
'*-)': '1f609',
|
|
39
|
-
';-]': '1f609',
|
|
40
|
-
';^)': '1f609',
|
|
41
|
-
"':(": '1f613',
|
|
42
|
-
"'=(": '1f613',
|
|
43
|
-
':-*': '1f618',
|
|
44
|
-
':^*': '1f618',
|
|
45
|
-
'>:P': '1f61c',
|
|
46
|
-
'X-P': '1f61c',
|
|
47
|
-
'>:[': '1f61e',
|
|
48
|
-
':-(': '1f61e',
|
|
49
|
-
':-[': '1f61e',
|
|
50
|
-
'>:(': '1f620',
|
|
51
|
-
":'(": '1f622',
|
|
52
|
-
';-(': '1f622',
|
|
53
|
-
'>.<': '1f623',
|
|
54
|
-
'#-)': '1f635',
|
|
55
|
-
'%-)': '1f635',
|
|
56
|
-
'X-)': '1f635',
|
|
57
|
-
'\\0/': '1f646',
|
|
58
|
-
'\\O/': '1f646',
|
|
59
|
-
'0:3': '1f607',
|
|
60
|
-
'0:)': '1f607',
|
|
61
|
-
'O:)': '1f607',
|
|
62
|
-
'O=)': '1f607',
|
|
63
|
-
'O:3': '1f607',
|
|
64
|
-
'B-)': '1f60e',
|
|
65
|
-
'8-)': '1f60e',
|
|
66
|
-
'B-D': '1f60e',
|
|
67
|
-
'8-D': '1f60e',
|
|
68
|
-
'-_-': '1f611',
|
|
69
|
-
'>:\\': '1f615',
|
|
70
|
-
'>:/': '1f615',
|
|
71
|
-
':-/': '1f615',
|
|
72
|
-
':-.': '1f615',
|
|
73
|
-
':-P': '1f61b',
|
|
74
|
-
':Þ': '1f61b',
|
|
75
|
-
':-b': '1f61b',
|
|
76
|
-
':-O': '1f62e',
|
|
77
|
-
O_O: '1f62e',
|
|
78
|
-
'>:O': '1f62e',
|
|
79
|
-
':-X': '1f636',
|
|
80
|
-
':-#': '1f636',
|
|
81
|
-
':-)': '1f642',
|
|
82
|
-
'(y)': '1f44d',
|
|
83
|
-
'<3': '2764-fe0f',
|
|
84
|
-
'=D': '1f603',
|
|
85
|
-
';)': '1f609',
|
|
86
|
-
'*)': '1f609',
|
|
87
|
-
';]': '1f609',
|
|
88
|
-
';D': '1f609',
|
|
89
|
-
':*': '1f618',
|
|
90
|
-
'=*': '1f618',
|
|
91
|
-
':(': '1f61e',
|
|
92
|
-
':[': '1f61e',
|
|
93
|
-
'=(': '1f61e',
|
|
94
|
-
':@': '1f620',
|
|
95
|
-
';(': '1f622',
|
|
96
|
-
'D:': '1f628',
|
|
97
|
-
':$': '1f633',
|
|
98
|
-
'=$': '1f633',
|
|
99
|
-
'#)': '1f635',
|
|
100
|
-
'%)': '1f635',
|
|
101
|
-
'X)': '1f635',
|
|
102
|
-
'B)': '1f60e',
|
|
103
|
-
'8)': '1f60e',
|
|
104
|
-
':/': '1f615',
|
|
105
|
-
':\\': '1f615',
|
|
106
|
-
'=/': '1f615',
|
|
107
|
-
'=\\': '1f615',
|
|
108
|
-
':L': '1f615',
|
|
109
|
-
'=L': '1f615',
|
|
110
|
-
':P': '1f61b',
|
|
111
|
-
'=P': '1f61b',
|
|
112
|
-
':b': '1f61b',
|
|
113
|
-
':O': '1f62e',
|
|
114
|
-
':X': '1f636',
|
|
115
|
-
':#': '1f636',
|
|
116
|
-
'=X': '1f636',
|
|
117
|
-
'=#': '1f636',
|
|
118
|
-
':)': '1f642',
|
|
119
|
-
'=]': '1f642',
|
|
120
|
-
'=)': '1f642',
|
|
121
|
-
':]': '1f642',
|
|
122
|
-
':D': '1f604'
|
|
123
|
-
};
|
|
124
|
-
exports.asciiList = asciiList;
|
|
125
|
-
const asciiRegexp = "(\\*\\\\0\\/\\*|\\*\\\\O\\/\\*|\\-___\\-|\\:'\\-\\)|'\\:\\-\\)|'\\:\\-D|\\>\\:\\-\\)|>\\:\\-\\)|'\\:\\-\\(|\\>\\:\\-\\(|>\\:\\-\\(|\\:'\\-\\(|O\\:\\-\\)|0\\:\\-3|0\\:\\-\\)|0;\\^\\)|O;\\-\\)|0;\\-\\)|O\\:\\-3|\\-__\\-|\\:\\-Þ|\\:\\-Þ|\\<\\/3|<\\/3|\\:'\\)|\\:\\-D|'\\:\\)|'\\=\\)|'\\:D|'\\=D|\\>\\:\\)|>\\:\\)|\\>;\\)|>;\\)|\\>\\=\\)|>\\=\\)|;\\-\\)|\\*\\-\\)|;\\-\\]|;\\^\\)|'\\:\\(|'\\=\\(|\\:\\-\\*|\\:\\^\\*|\\>\\:P|>\\:P|X\\-P|\\>\\:\\[|>\\:\\[|\\:\\-\\(|\\:\\-\\[|\\>\\:\\(|>\\:\\(|\\:'\\(|;\\-\\(|\\>\\.\\<|>\\.<|#\\-\\)|%\\-\\)|X\\-\\)|\\\\0\\/|\\\\O\\/|0\\:3|0\\:\\)|O\\:\\)|O\\=\\)|O\\:3|B\\-\\)|8\\-\\)|B\\-D|8\\-D|\\-_\\-|\\>\\:\\\\|>\\:\\\\|\\>\\:\\/|>\\:\\/|\\:\\-\\/|\\:\\-\\.|\\:\\-P|\\:Þ|\\:Þ|\\:\\-b|\\:\\-O|O_O|\\>\\:O|>\\:O|\\:\\-X|\\:\\-#|\\:\\-\\)|\\(y\\)|\\<3|<3|\\=D|;\\)|\\*\\)|;\\]|;D|\\:\\*|\\=\\*|\\:\\(|\\:\\[|\\=\\(|\\:@|;\\(|D\\:|\\:\\$|\\=\\$|#\\)|%\\)|X\\)|B\\)|8\\)|\\:\\/|\\:\\\\|\\=\\/|\\=\\\\|\\:L|\\=L|\\:P|\\=P|\\:b|\\:O|\\:X|\\:#|\\=X|\\=#|\\:\\)|\\=\\]|\\=\\)|\\:\\]|\\:D)";
|
|
126
|
-
const regAscii = new RegExp(`<object[^>]*>.*?</object>|<span[^>]*>.*?</span>|<(?:object|embed|svg|img|div|span|p|a)[^>]*>|((\\s|^)${asciiRegexp}(?=\\s|$|[!,.?]))`, 'gi');
|
|
127
|
-
exports.regAscii = regAscii;
|
|
128
|
-
const shortNameList = {
|
|
6
|
+
exports.shortNameList = exports.regShortnames = void 0;
|
|
7
|
+
const shortNameList = exports.shortNameList = {
|
|
129
8
|
':england:': '1f3f4-e0067-e0062-e0065-e006e-e0067-e007f',
|
|
130
9
|
':scotland:': '1f3f4-e0067-e0062-e0073-e0063-e0074-e007f',
|
|
131
10
|
':wales:': '1f3f4-e0067-e0062-e0077-e006c-e0073-e007f',
|
|
@@ -3798,11 +3677,9 @@ const shortNameList = {
|
|
|
3798
3677
|
':yin_yang:': '262f-fe0f',
|
|
3799
3678
|
':zap:': '26a1'
|
|
3800
3679
|
};
|
|
3801
|
-
exports.shortNameList = shortNameList;
|
|
3802
3680
|
let shortnameRegexp = '';
|
|
3803
3681
|
Object.keys(shortNameList).forEach((shortname, index) => {
|
|
3804
3682
|
shortnameRegexp += `${index !== 0 ? '|' : ''}${shortname}`;
|
|
3805
3683
|
});
|
|
3806
|
-
const regShortnames = new RegExp(`<object[^>]*>.*?</object>|<span[^>]*>.*?</span>|<(?:object|embed|svg|img|div|span|p|a)[^>]*>|(${shortnameRegexp})`, 'gi');
|
|
3807
|
-
|
|
3808
|
-
//# sourceMappingURL=emoji.js.map
|
|
3684
|
+
const regShortnames = exports.regShortnames = new RegExp(`<object[^>]*>.*?</object>|<span[^>]*>.*?</span>|<(?:object|embed|svg|img|div|span|p|a)[^>]*>|(${shortnameRegexp})`, 'gi');
|
|
3685
|
+
//# sourceMappingURL=emojiShortList.js.map
|