@atlaskit/emoji 71.4.2 → 71.4.4
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/CHANGELOG.md +19 -0
- package/dist/cjs/components/common/DeleteButton.js +2 -2
- package/dist/cjs/components/common/Emoji.js +15 -7
- package/dist/cjs/components/common/EmojiActions.js +6 -14
- package/dist/cjs/components/common/EmojiDeletePreview.js +2 -2
- package/dist/cjs/components/common/EmojiErrorMessage.js +2 -2
- package/dist/cjs/components/common/EmojiRadioButton.js +2 -3
- package/dist/cjs/components/common/EmojiUploadPicker.js +9 -9
- package/dist/cjs/components/common/FileChooser.js +3 -3
- package/dist/cjs/components/common/TonePreviewButton.js +1 -2
- package/dist/cjs/components/common/ToneSelector.js +2 -2
- package/dist/cjs/components/picker/CategorySelector.js +7 -7
- package/dist/cjs/components/picker/EmojiPicker.js +2 -2
- package/dist/cjs/components/picker/EmojiPickerComponent.js +15 -15
- package/dist/cjs/components/picker/EmojiPickerEmojiRow.js +1 -3
- package/dist/cjs/components/picker/EmojiPickerFooter.js +2 -3
- package/dist/cjs/components/picker/EmojiPickerList.js +2 -2
- package/dist/cjs/components/picker/EmojiPickerListSearch.js +2 -2
- package/dist/cjs/components/picker/VirtualList.js +3 -3
- package/dist/cjs/util/analytics/analytics.js +1 -1
- package/dist/cjs/util/emojiIdToEmoji.js +61 -49
- package/dist/es2019/components/common/DeleteButton.js +2 -2
- package/dist/es2019/components/common/Emoji.js +14 -6
- package/dist/es2019/components/common/EmojiActions.js +6 -14
- package/dist/es2019/components/common/EmojiDeletePreview.js +2 -2
- package/dist/es2019/components/common/EmojiErrorMessage.js +2 -2
- package/dist/es2019/components/common/EmojiRadioButton.js +2 -3
- package/dist/es2019/components/common/EmojiUploadPicker.js +9 -9
- package/dist/es2019/components/common/FileChooser.js +3 -3
- package/dist/es2019/components/common/TonePreviewButton.js +1 -2
- package/dist/es2019/components/common/ToneSelector.js +2 -2
- package/dist/es2019/components/picker/CategorySelector.js +6 -6
- package/dist/es2019/components/picker/EmojiPicker.js +2 -2
- package/dist/es2019/components/picker/EmojiPickerComponent.js +15 -15
- package/dist/es2019/components/picker/EmojiPickerEmojiRow.js +1 -3
- package/dist/es2019/components/picker/EmojiPickerFooter.js +2 -2
- package/dist/es2019/components/picker/EmojiPickerList.js +2 -2
- package/dist/es2019/components/picker/EmojiPickerListSearch.js +2 -2
- package/dist/es2019/components/picker/VirtualList.js +3 -3
- package/dist/es2019/util/analytics/analytics.js +1 -1
- package/dist/es2019/util/emojiIdToEmoji.js +46 -40
- package/dist/esm/components/common/DeleteButton.js +2 -2
- package/dist/esm/components/common/Emoji.js +15 -7
- package/dist/esm/components/common/EmojiActions.js +6 -14
- package/dist/esm/components/common/EmojiDeletePreview.js +2 -2
- package/dist/esm/components/common/EmojiErrorMessage.js +2 -2
- package/dist/esm/components/common/EmojiRadioButton.js +2 -3
- package/dist/esm/components/common/EmojiUploadPicker.js +9 -9
- package/dist/esm/components/common/FileChooser.js +3 -3
- package/dist/esm/components/common/TonePreviewButton.js +1 -2
- package/dist/esm/components/common/ToneSelector.js +2 -2
- package/dist/esm/components/picker/CategorySelector.js +7 -7
- package/dist/esm/components/picker/EmojiPicker.js +2 -2
- package/dist/esm/components/picker/EmojiPickerComponent.js +15 -15
- package/dist/esm/components/picker/EmojiPickerEmojiRow.js +1 -3
- package/dist/esm/components/picker/EmojiPickerFooter.js +2 -2
- package/dist/esm/components/picker/EmojiPickerList.js +2 -2
- package/dist/esm/components/picker/EmojiPickerListSearch.js +2 -2
- package/dist/esm/components/picker/VirtualList.js +3 -3
- package/dist/esm/util/analytics/analytics.js +1 -1
- package/dist/esm/util/emojiIdToEmoji.js +61 -49
- package/dist/types/components/picker/EmojiPickerComponent.d.ts +0 -4
- package/dist/types/util/emojiIdToEmoji.d.ts +2 -2
- package/package.json +6 -6
|
@@ -5,36 +5,25 @@ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equ
|
|
|
5
5
|
var KEYCAP_COMBINING = 0x20e3;
|
|
6
6
|
var VARIATION_SELECTOR_16 = 0xfe0f;
|
|
7
7
|
var VARIATION_SELECTOR_15 = 0xfe0e;
|
|
8
|
+
var EMOJI_MODIFIER_START = 0x1f3fb;
|
|
9
|
+
var EMOJI_MODIFIER_END = 0x1f3ff;
|
|
10
|
+
var REGIONAL_INDICATOR_START = 0x1f1e6;
|
|
11
|
+
var REGIONAL_INDICATOR_END = 0x1f1ff;
|
|
12
|
+
var FLAG_BASES = new Set([0x1f38c, 0x1f3c1, 0x1f3f3, 0x1f3f4, 0x1f6a9]);
|
|
8
13
|
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
* e.g. `"1f44d"`, `"1f44d-1f3fb"`, `"1f468-200d-1f469-200d-1f467"`) into its
|
|
23
|
-
* corresponding Unicode string.
|
|
24
|
-
*
|
|
25
|
-
* Special handling:
|
|
26
|
-
* - Keycap sequences: U+20E3 (COMBINING ENCLOSING KEYCAP) must be preceded by
|
|
27
|
-
* U+FE0F (VARIATION SELECTOR-16) to form a well-defined keycap emoji.
|
|
28
|
-
* - Text-default emoji (characters whose default presentation is text) must be
|
|
29
|
-
* followed by U+FE0F to force emoji presentation.
|
|
30
|
-
*
|
|
31
|
-
* @returns The Unicode string for the emoji, or `undefined` if the input is
|
|
32
|
-
* invalid (empty string, non-hex segments, or out-of-range code points).
|
|
33
|
-
*/
|
|
34
|
-
export function emojiIdToEmoji(id) {
|
|
35
|
-
if (!id) {
|
|
36
|
-
return undefined;
|
|
37
|
-
}
|
|
14
|
+
// Emoji variation bases from Unicode 14.0 emoji-variation-sequences.txt.
|
|
15
|
+
// These are the code points with a defined U+FE0F emoji-style variant.
|
|
16
|
+
var EMOJI_VARIATION_BASES = new Set([0x0023, 0x002a, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x00a9, 0x00ae, 0x203c, 0x2049, 0x2122, 0x2139, 0x2194, 0x2195, 0x2196, 0x2197, 0x2198, 0x2199, 0x21a9, 0x21aa, 0x2328, 0x23cf, 0x23ed, 0x23ee, 0x23ef, 0x23f1, 0x23f2, 0x23f8, 0x23f9, 0x23fa, 0x24c2, 0x25aa, 0x25ab, 0x25b6, 0x25c0, 0x25fb, 0x25fc, 0x2600, 0x2601, 0x2602, 0x2603, 0x2604, 0x260e, 0x2611, 0x2618, 0x261d, 0x2620, 0x2622, 0x2623, 0x2626, 0x262a, 0x262e, 0x262f, 0x2638, 0x2639, 0x263a, 0x2640, 0x2642, 0x265f, 0x2660, 0x2663, 0x2665, 0x2666, 0x2668, 0x267b, 0x267e, 0x2692, 0x2694, 0x2695, 0x2696, 0x2697, 0x2699, 0x269b, 0x269c, 0x26a0, 0x26a7, 0x26b0, 0x26b1, 0x26c8, 0x26cf, 0x26d1, 0x26d3, 0x26e9, 0x26f0, 0x26f1, 0x26f4, 0x26f7, 0x26f8, 0x26f9, 0x2702, 0x2708, 0x2709, 0x270c, 0x270d, 0x270f, 0x2712, 0x2714, 0x2716, 0x271d, 0x2721, 0x2733, 0x2734, 0x2744, 0x2747, 0x2763, 0x2764, 0x27a1, 0x2934, 0x2935, 0x2b05, 0x2b06, 0x2b07, 0x3030, 0x303d, 0x3297, 0x3299, 0x1f170, 0x1f171, 0x1f17e, 0x1f17f, 0x1f202, 0x1f237, 0x1f321, 0x1f324, 0x1f325, 0x1f326, 0x1f327, 0x1f328, 0x1f329, 0x1f32a, 0x1f32b, 0x1f32c, 0x1f336, 0x1f37d, 0x1f396, 0x1f397, 0x1f399, 0x1f39a, 0x1f39b, 0x1f39e, 0x1f39f, 0x1f3cb, 0x1f3cc, 0x1f3cd, 0x1f3ce, 0x1f3d4, 0x1f3d5, 0x1f3d6, 0x1f3d7, 0x1f3d8, 0x1f3d9, 0x1f3da, 0x1f3db, 0x1f3dc, 0x1f3dd, 0x1f3de, 0x1f3df, 0x1f3f3, 0x1f3f5, 0x1f3f7, 0x1f43f, 0x1f441, 0x1f4fd, 0x1f549, 0x1f54a, 0x1f56f, 0x1f570, 0x1f573, 0x1f574, 0x1f575, 0x1f576, 0x1f577, 0x1f578, 0x1f579, 0x1f587, 0x1f58a, 0x1f58b, 0x1f58c, 0x1f58d, 0x1f590, 0x1f5a5, 0x1f5a8, 0x1f5b1, 0x1f5b2, 0x1f5bc, 0x1f5c2, 0x1f5c3, 0x1f5c4, 0x1f5d1, 0x1f5d2, 0x1f5d3, 0x1f5dc, 0x1f5dd, 0x1f5de, 0x1f5e1, 0x1f5e3, 0x1f5e8, 0x1f5ef, 0x1f5f3, 0x1f5fa, 0x1f6cb, 0x1f6cd, 0x1f6ce, 0x1f6cf, 0x1f6e0, 0x1f6e1, 0x1f6e2, 0x1f6e3, 0x1f6e4, 0x1f6e5, 0x1f6e9, 0x1f6f0, 0x1f6f3, 0x231a, 0x231b, 0x23e9, 0x23ea, 0x23f3, 0x25fd, 0x25fe, 0x2614, 0x2615, 0x2648, 0x2649, 0x264a, 0x264b, 0x264c, 0x264d, 0x264e, 0x264f, 0x2650, 0x2651, 0x2652, 0x2653, 0x267f, 0x2693, 0x26a1, 0x26aa, 0x26ab, 0x26bd, 0x26be, 0x26c4, 0x26c5, 0x26d4, 0x26ea, 0x26f2, 0x26f3, 0x26f5, 0x26fa, 0x26fd, 0x2753, 0x2757, 0x2b1b, 0x2b1c, 0x2b50, 0x2b55, 0x1f004, 0x1f21a, 0x1f22f, 0x1f30d, 0x1f30e, 0x1f30f, 0x1f315, 0x1f31c, 0x1f378, 0x1f393, 0x1f3a7, 0x1f3ac, 0x1f3ad, 0x1f3ae, 0x1f3c2, 0x1f3c4, 0x1f3c6, 0x1f3ca, 0x1f3e0, 0x1f3ed, 0x1f408, 0x1f415, 0x1f41f, 0x1f426, 0x1f442, 0x1f446, 0x1f447, 0x1f448, 0x1f449, 0x1f44d, 0x1f44e, 0x1f453, 0x1f46a, 0x1f47d, 0x1f4a3, 0x1f4b0, 0x1f4b3, 0x1f4bb, 0x1f4bf, 0x1f4cb, 0x1f4da, 0x1f4df, 0x1f4e4, 0x1f4e5, 0x1f4e6, 0x1f4ea, 0x1f4eb, 0x1f4ec, 0x1f4ed, 0x1f4f7, 0x1f4f9, 0x1f4fa, 0x1f4fb, 0x1f508, 0x1f50d, 0x1f512, 0x1f513, 0x1f550, 0x1f551, 0x1f552, 0x1f553, 0x1f554, 0x1f555, 0x1f556, 0x1f557, 0x1f558, 0x1f559, 0x1f55a, 0x1f55b, 0x1f55c, 0x1f55d, 0x1f55e, 0x1f55f, 0x1f560, 0x1f561, 0x1f562, 0x1f563, 0x1f564, 0x1f565, 0x1f566, 0x1f567, 0x1f610, 0x1f687, 0x1f68d, 0x1f691, 0x1f694, 0x1f698, 0x1f6ad, 0x1f6b2, 0x1f6b9, 0x1f6ba, 0x1f6bc]);
|
|
17
|
+
var isEmojiModifier = function isEmojiModifier(codePoint) {
|
|
18
|
+
return typeof codePoint === 'number' && codePoint >= EMOJI_MODIFIER_START && codePoint <= EMOJI_MODIFIER_END;
|
|
19
|
+
};
|
|
20
|
+
var shouldAddEmojiPresentationSelector = function shouldAddEmojiPresentationSelector(codePoint, nextCodePoint) {
|
|
21
|
+
return EMOJI_VARIATION_BASES.has(codePoint) && nextCodePoint !== VARIATION_SELECTOR_16 && nextCodePoint !== VARIATION_SELECTOR_15 && nextCodePoint !== KEYCAP_COMBINING && !isEmojiModifier(nextCodePoint);
|
|
22
|
+
};
|
|
23
|
+
var isRegionalIndicator = function isRegionalIndicator(codePoint) {
|
|
24
|
+
return codePoint >= REGIONAL_INDICATOR_START && codePoint <= REGIONAL_INDICATOR_END;
|
|
25
|
+
};
|
|
26
|
+
var parseEmojiIdCodePoints = function parseEmojiIdCodePoints(id) {
|
|
38
27
|
var segments = id.split('-');
|
|
39
28
|
var codePoints = [];
|
|
40
29
|
var _iterator = _createForOfIteratorHelper(segments),
|
|
@@ -45,19 +34,53 @@ export function emojiIdToEmoji(id) {
|
|
|
45
34
|
if (!/^[0-9a-fA-F]+$/.test(segment)) {
|
|
46
35
|
return undefined;
|
|
47
36
|
}
|
|
48
|
-
var
|
|
49
|
-
// Valid Unicode scalar values:
|
|
50
|
-
if (isNaN(
|
|
37
|
+
var cp = parseInt(segment, 16);
|
|
38
|
+
// Valid Unicode scalar values: U+0000–U+10FFFF, excluding surrogates.
|
|
39
|
+
if (isNaN(cp) || cp < 0 || cp > 0x10ffff || cp >= 0xd800 && cp <= 0xdfff) {
|
|
51
40
|
return undefined;
|
|
52
41
|
}
|
|
53
|
-
codePoints.push(
|
|
42
|
+
codePoints.push(cp);
|
|
54
43
|
}
|
|
55
44
|
} catch (err) {
|
|
56
45
|
_iterator.e(err);
|
|
57
46
|
} finally {
|
|
58
47
|
_iterator.f();
|
|
59
48
|
}
|
|
60
|
-
|
|
49
|
+
return codePoints.length ? codePoints : undefined;
|
|
50
|
+
};
|
|
51
|
+
var isFlagEmoji = function isFlagEmoji(codePoints) {
|
|
52
|
+
if (codePoints.length === 2 && codePoints.every(isRegionalIndicator)) {
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
return FLAG_BASES.has(codePoints[0]);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Converts an emoji ID (a hyphen-separated string of hex Unicode code points,
|
|
60
|
+
* e.g. `"1f44d"`, `"1f44d-1f3fb"`, `"1f468-200d-1f469-200d-1f467"`) into its
|
|
61
|
+
* corresponding Unicode string.
|
|
62
|
+
*
|
|
63
|
+
* Special handling:
|
|
64
|
+
* - Keycap sequences: U+20E3 (COMBINING ENCLOSING KEYCAP) must be preceded by
|
|
65
|
+
* U+FE0F (VARIATION SELECTOR-16) to form a well-defined keycap emoji.
|
|
66
|
+
* - Emoji variation bases are followed by U+FE0F to force emoji presentation.
|
|
67
|
+
* - Flags return `undefined` so callers use Twemoji instead of native emoji.
|
|
68
|
+
*
|
|
69
|
+
* @returns The Unicode string for the emoji, or `undefined` if the input is
|
|
70
|
+
* invalid (empty string, non-hex segments, or out-of-range code points).
|
|
71
|
+
*/
|
|
72
|
+
export function emojiIdToEmoji(id) {
|
|
73
|
+
if (!expValEqualsNoExposure('platform_use_unicode_emojis', 'isEnabled', true)) {
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
if (!id) {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
var codePoints = parseEmojiIdCodePoints(id);
|
|
80
|
+
if (!codePoints) {
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
if (isFlagEmoji(codePoints)) {
|
|
61
84
|
return undefined;
|
|
62
85
|
}
|
|
63
86
|
var processedCodePoints = [];
|
|
@@ -71,22 +94,11 @@ export function emojiIdToEmoji(id) {
|
|
|
71
94
|
if (next === KEYCAP_COMBINING && cp !== VARIATION_SELECTOR_16) {
|
|
72
95
|
processedCodePoints.push(VARIATION_SELECTOR_16);
|
|
73
96
|
}
|
|
74
|
-
}
|
|
75
97
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
var lastCodePoint = processedCodePoints[processedCodePoints.length - 1];
|
|
81
|
-
var alreadyHasVariationSelector = lastCodePoint === VARIATION_SELECTOR_16 || lastCodePoint === VARIATION_SELECTOR_15 ||
|
|
82
|
-
// Keycap sequences end with U+20E3 — they already have U+FE0F inserted inline
|
|
83
|
-
// and must not have another variation selector appended at the end.
|
|
84
|
-
lastCodePoint === KEYCAP_COMBINING;
|
|
85
|
-
if (!alreadyHasVariationSelector) {
|
|
86
|
-
var baseCodePoint = codePoints[0];
|
|
87
|
-
if (codePoints.length === 1 && baseCodePoint <= 0xffff && TEXT_DEFAULT_EMOJI.has(baseCodePoint)) {
|
|
88
|
-
processedCodePoints.push(VARIATION_SELECTOR_16);
|
|
89
|
-
}
|
|
98
|
+
// Emoji variation bases need U+FE0F immediately after the base code point,
|
|
99
|
+
// including when the base appears inside a ZWJ sequence.
|
|
100
|
+
if (shouldAddEmojiPresentationSelector(cp, next)) {
|
|
101
|
+
processedCodePoints.push(VARIATION_SELECTOR_16);
|
|
90
102
|
}
|
|
91
103
|
}
|
|
92
104
|
try {
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* Special handling:
|
|
7
7
|
* - Keycap sequences: U+20E3 (COMBINING ENCLOSING KEYCAP) must be preceded by
|
|
8
8
|
* U+FE0F (VARIATION SELECTOR-16) to form a well-defined keycap emoji.
|
|
9
|
-
* -
|
|
10
|
-
*
|
|
9
|
+
* - Emoji variation bases are followed by U+FE0F to force emoji presentation.
|
|
10
|
+
* - Flags return `undefined` so callers use Twemoji instead of native emoji.
|
|
11
11
|
*
|
|
12
12
|
* @returns The Unicode string for the emoji, or `undefined` if the input is
|
|
13
13
|
* invalid (empty string, non-hex segments, or out-of-range code points).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/emoji",
|
|
3
|
-
"version": "71.4.
|
|
3
|
+
"version": "71.4.4",
|
|
4
4
|
"description": "Fabric emoji React components",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"@atlaskit/form": "^16.0.0",
|
|
39
39
|
"@atlaskit/heading": "^6.0.0",
|
|
40
40
|
"@atlaskit/icon": "^36.0.0",
|
|
41
|
-
"@atlaskit/icon-lab": "^7.
|
|
41
|
+
"@atlaskit/icon-lab": "^7.1.0",
|
|
42
42
|
"@atlaskit/image": "^4.0.0",
|
|
43
|
-
"@atlaskit/media-client": "^37.
|
|
43
|
+
"@atlaskit/media-client": "^37.1.0",
|
|
44
44
|
"@atlaskit/media-client-react": "^6.0.0",
|
|
45
45
|
"@atlaskit/platform-feature-flags": "^2.0.0",
|
|
46
46
|
"@atlaskit/pragmatic-drag-and-drop": "^2.0.0",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"@atlaskit/spinner": "^20.0.0",
|
|
50
50
|
"@atlaskit/textfield": "^9.0.0",
|
|
51
51
|
"@atlaskit/theme": "^26.0.0",
|
|
52
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
53
|
-
"@atlaskit/tokens": "^
|
|
52
|
+
"@atlaskit/tmp-editor-statsig": "^110.0.0",
|
|
53
|
+
"@atlaskit/tokens": "^15.0.0",
|
|
54
54
|
"@atlaskit/tooltip": "^23.0.0",
|
|
55
55
|
"@atlaskit/ufo": "^1.0.0",
|
|
56
56
|
"@atlaskit/util-service-support": "^7.0.0",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"js-search": "^2.0.0",
|
|
62
62
|
"lru_map": "^0.4.1",
|
|
63
63
|
"react-focus-lock": "^2.9.5",
|
|
64
|
-
"react-intersection-observer": "^
|
|
64
|
+
"react-intersection-observer": "^9.16.0",
|
|
65
65
|
"react-loadable": "^5.1.0",
|
|
66
66
|
"use-debounce": "^3.4.0",
|
|
67
67
|
"uuid": "^3.1.0"
|