@atlaskit/emoji 71.9.3 → 71.9.5

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 CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/emoji
2
2
 
3
+ ## 71.9.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [`0660101e568e0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0660101e568e0) -
8
+ [ux] Use Twemoji for regional indicators.
9
+
10
+ ## 71.9.4
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+
3
16
  ## 71.9.3
4
17
 
5
18
  ### Patch Changes
@@ -20,7 +20,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
20
20
  actionSubjectId: actionSubjectId,
21
21
  attributes: _objectSpread({
22
22
  packageName: "@atlaskit/emoji",
23
- packageVersion: "71.9.2"
23
+ packageVersion: "71.9.4"
24
24
  }, attributes)
25
25
  };
26
26
  };
@@ -29,6 +29,9 @@ var shouldAddEmojiPresentationSelector = function shouldAddEmojiPresentationSele
29
29
  var isRegionalIndicator = function isRegionalIndicator(codePoint) {
30
30
  return codePoint >= REGIONAL_INDICATOR_START && codePoint <= REGIONAL_INDICATOR_END;
31
31
  };
32
+ var isStandaloneRegionalIndicator = function isStandaloneRegionalIndicator(codePoints) {
33
+ return codePoints.length === 1 && isRegionalIndicator(codePoints[0]);
34
+ };
32
35
  var parseEmojiIdCodePoints = function parseEmojiIdCodePoints(id) {
33
36
  var segments = id.split('-');
34
37
  var codePoints = [];
@@ -70,7 +73,8 @@ var isFlagEmoji = function isFlagEmoji(codePoints) {
70
73
  * - Keycap sequences: U+20E3 (COMBINING ENCLOSING KEYCAP) must be preceded by
71
74
  * U+FE0F (VARIATION SELECTOR-16) to form a well-defined keycap emoji.
72
75
  * - Emoji variation bases are followed by U+FE0F to force emoji presentation.
73
- * - Flags return `undefined` so callers use Twemoji instead of native emoji.
76
+ * - Flags and standalone regional indicators return `undefined` so callers use
77
+ * Twemoji instead of native emoji.
74
78
  *
75
79
  * @returns The Unicode string for the emoji, or `undefined` if the input is
76
80
  * invalid (empty string, non-hex segments, or out-of-range code points).
@@ -86,7 +90,7 @@ function emojiIdToEmoji(id) {
86
90
  if (!codePoints) {
87
91
  return undefined;
88
92
  }
89
- if (isFlagEmoji(codePoints)) {
93
+ if (isStandaloneRegionalIndicator(codePoints) || isFlagEmoji(codePoints)) {
90
94
  return undefined;
91
95
  }
92
96
  var processedCodePoints = [];
@@ -9,7 +9,7 @@ const createEvent = (eventType, action, actionSubject, actionSubjectId, attribut
9
9
  actionSubjectId,
10
10
  attributes: {
11
11
  packageName: "@atlaskit/emoji",
12
- packageVersion: "71.9.2",
12
+ packageVersion: "71.9.4",
13
13
  ...attributes
14
14
  }
15
15
  });
@@ -14,6 +14,7 @@ const EMOJI_VARIATION_BASES = new Set([0x0023, 0x002a, 0x0030, 0x0031, 0x0032, 0
14
14
  const isEmojiModifier = codePoint => typeof codePoint === 'number' && codePoint >= EMOJI_MODIFIER_START && codePoint <= EMOJI_MODIFIER_END;
15
15
  const shouldAddEmojiPresentationSelector = (codePoint, nextCodePoint) => EMOJI_VARIATION_BASES.has(codePoint) && nextCodePoint !== VARIATION_SELECTOR_16 && nextCodePoint !== VARIATION_SELECTOR_15 && nextCodePoint !== KEYCAP_COMBINING && !isEmojiModifier(nextCodePoint);
16
16
  const isRegionalIndicator = codePoint => codePoint >= REGIONAL_INDICATOR_START && codePoint <= REGIONAL_INDICATOR_END;
17
+ const isStandaloneRegionalIndicator = codePoints => codePoints.length === 1 && isRegionalIndicator(codePoints[0]);
17
18
  const parseEmojiIdCodePoints = id => {
18
19
  const segments = id.split('-');
19
20
  const codePoints = [];
@@ -46,7 +47,8 @@ const isFlagEmoji = codePoints => {
46
47
  * - Keycap sequences: U+20E3 (COMBINING ENCLOSING KEYCAP) must be preceded by
47
48
  * U+FE0F (VARIATION SELECTOR-16) to form a well-defined keycap emoji.
48
49
  * - Emoji variation bases are followed by U+FE0F to force emoji presentation.
49
- * - Flags return `undefined` so callers use Twemoji instead of native emoji.
50
+ * - Flags and standalone regional indicators return `undefined` so callers use
51
+ * Twemoji instead of native emoji.
50
52
  *
51
53
  * @returns The Unicode string for the emoji, or `undefined` if the input is
52
54
  * invalid (empty string, non-hex segments, or out-of-range code points).
@@ -62,7 +64,7 @@ export function emojiIdToEmoji(id) {
62
64
  if (!codePoints) {
63
65
  return undefined;
64
66
  }
65
- if (isFlagEmoji(codePoints)) {
67
+ if (isStandaloneRegionalIndicator(codePoints) || isFlagEmoji(codePoints)) {
66
68
  return undefined;
67
69
  }
68
70
  const processedCodePoints = [];
@@ -14,7 +14,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
14
14
  actionSubjectId: actionSubjectId,
15
15
  attributes: _objectSpread({
16
16
  packageName: "@atlaskit/emoji",
17
- packageVersion: "71.9.2"
17
+ packageVersion: "71.9.4"
18
18
  }, attributes)
19
19
  };
20
20
  };
@@ -23,6 +23,9 @@ var shouldAddEmojiPresentationSelector = function shouldAddEmojiPresentationSele
23
23
  var isRegionalIndicator = function isRegionalIndicator(codePoint) {
24
24
  return codePoint >= REGIONAL_INDICATOR_START && codePoint <= REGIONAL_INDICATOR_END;
25
25
  };
26
+ var isStandaloneRegionalIndicator = function isStandaloneRegionalIndicator(codePoints) {
27
+ return codePoints.length === 1 && isRegionalIndicator(codePoints[0]);
28
+ };
26
29
  var parseEmojiIdCodePoints = function parseEmojiIdCodePoints(id) {
27
30
  var segments = id.split('-');
28
31
  var codePoints = [];
@@ -64,7 +67,8 @@ var isFlagEmoji = function isFlagEmoji(codePoints) {
64
67
  * - Keycap sequences: U+20E3 (COMBINING ENCLOSING KEYCAP) must be preceded by
65
68
  * U+FE0F (VARIATION SELECTOR-16) to form a well-defined keycap emoji.
66
69
  * - Emoji variation bases are followed by U+FE0F to force emoji presentation.
67
- * - Flags return `undefined` so callers use Twemoji instead of native emoji.
70
+ * - Flags and standalone regional indicators return `undefined` so callers use
71
+ * Twemoji instead of native emoji.
68
72
  *
69
73
  * @returns The Unicode string for the emoji, or `undefined` if the input is
70
74
  * invalid (empty string, non-hex segments, or out-of-range code points).
@@ -80,7 +84,7 @@ export function emojiIdToEmoji(id) {
80
84
  if (!codePoints) {
81
85
  return undefined;
82
86
  }
83
- if (isFlagEmoji(codePoints)) {
87
+ if (isStandaloneRegionalIndicator(codePoints) || isFlagEmoji(codePoints)) {
84
88
  return undefined;
85
89
  }
86
90
  var processedCodePoints = [];
@@ -7,7 +7,8 @@
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
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.
10
+ * - Flags and standalone regional indicators return `undefined` so callers use
11
+ * Twemoji instead of native emoji.
11
12
  *
12
13
  * @returns The Unicode string for the emoji, or `undefined` if the input is
13
14
  * 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.9.3",
3
+ "version": "71.9.5",
4
4
  "description": "Fabric emoji React components",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -50,7 +50,7 @@
50
50
  "@atlaskit/spinner": "^20.1.0",
51
51
  "@atlaskit/textfield": "^9.1.0",
52
52
  "@atlaskit/theme": "^26.1.0",
53
- "@atlaskit/tmp-editor-statsig": "^125.2.0",
53
+ "@atlaskit/tmp-editor-statsig": "^126.1.0",
54
54
  "@atlaskit/tokens": "^15.8.0",
55
55
  "@atlaskit/tooltip": "^23.1.0",
56
56
  "@atlaskit/ufo": "^1.0.0",