@atlaskit/emoji 72.5.19 → 73.0.1

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.
Files changed (80) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/cjs/api/EmojiResource.js +0 -28
  3. package/dist/cjs/api/EmojiUtils.js +1 -8
  4. package/dist/cjs/api/denormaliseEmojiServiceResponse.js +2 -2
  5. package/dist/cjs/api/denormaliseSkinEmoji.js +2 -2
  6. package/dist/cjs/api/media/SiteEmojiResource.js +3 -3
  7. package/dist/cjs/components/common/CachingMediaEmoji.js +1 -2
  8. package/dist/cjs/components/common/Emoji.js +4 -17
  9. package/dist/cjs/components/common/EmojiPreviewComponent.js +1 -4
  10. package/dist/cjs/components/common/EmojiRadioButton.js +1 -4
  11. package/dist/cjs/components/common/EmojiUploadPicker.js +5 -4
  12. package/dist/cjs/components/common/ResourcedEmojiComponent.js +4 -39
  13. package/dist/cjs/components/common/TonePreviewButton.js +2 -6
  14. package/dist/cjs/components/picker/CategorySelector.js +3 -3
  15. package/dist/cjs/components/picker/EmojiPickerEmojiRow.js +0 -3
  16. package/dist/cjs/util/analytics/createEvent.js +1 -1
  17. package/dist/cjs/util/type-helpers.js +0 -7
  18. package/dist/es2019/api/EmojiResource.js +0 -28
  19. package/dist/es2019/api/EmojiUtils.js +1 -5
  20. package/dist/es2019/api/denormaliseEmojiServiceResponse.js +2 -2
  21. package/dist/es2019/api/denormaliseSkinEmoji.js +2 -2
  22. package/dist/es2019/api/media/SiteEmojiResource.js +1 -1
  23. package/dist/es2019/components/common/CachingMediaEmoji.js +1 -2
  24. package/dist/es2019/components/common/Emoji.js +3 -16
  25. package/dist/es2019/components/common/EmojiPreviewComponent.js +1 -4
  26. package/dist/es2019/components/common/EmojiRadioButton.js +1 -4
  27. package/dist/es2019/components/common/EmojiUploadPicker.js +2 -2
  28. package/dist/es2019/components/common/ResourcedEmojiComponent.js +4 -38
  29. package/dist/es2019/components/common/TonePreviewButton.js +2 -6
  30. package/dist/es2019/components/picker/CategorySelector.js +1 -1
  31. package/dist/es2019/components/picker/EmojiPickerEmojiRow.js +0 -3
  32. package/dist/es2019/util/analytics/createEvent.js +1 -1
  33. package/dist/es2019/util/type-helpers.js +0 -4
  34. package/dist/esm/api/EmojiResource.js +0 -28
  35. package/dist/esm/api/EmojiUtils.js +1 -5
  36. package/dist/esm/api/denormaliseEmojiServiceResponse.js +2 -2
  37. package/dist/esm/api/denormaliseSkinEmoji.js +2 -2
  38. package/dist/esm/api/media/SiteEmojiResource.js +1 -1
  39. package/dist/esm/components/common/CachingMediaEmoji.js +1 -2
  40. package/dist/esm/components/common/Emoji.js +4 -17
  41. package/dist/esm/components/common/EmojiPreviewComponent.js +1 -4
  42. package/dist/esm/components/common/EmojiRadioButton.js +1 -4
  43. package/dist/esm/components/common/EmojiUploadPicker.js +2 -2
  44. package/dist/esm/components/common/ResourcedEmojiComponent.js +5 -40
  45. package/dist/esm/components/common/TonePreviewButton.js +2 -6
  46. package/dist/esm/components/picker/CategorySelector.js +1 -1
  47. package/dist/esm/components/picker/EmojiPickerEmojiRow.js +0 -3
  48. package/dist/esm/util/analytics/createEvent.js +1 -1
  49. package/dist/esm/util/type-helpers.js +0 -4
  50. package/dist/types/api/EmojiResource.d.ts +0 -6
  51. package/dist/types/api/EmojiUtils.d.ts +0 -4
  52. package/dist/types/api/calculateScale.d.ts +1 -1
  53. package/dist/types/api/media/SiteEmojiResource.d.ts +1 -1
  54. package/dist/types/components/common/Emoji.d.ts +1 -7
  55. package/dist/types/components/common/ResourcedEmojiComponent.d.ts +1 -6
  56. package/dist/types/types.d.ts +1 -15
  57. package/dist/types/util/type-helpers.d.ts +0 -4
  58. package/package.json +4 -4
  59. package/dist/cjs/api/denormaliseStandardRepresentation.js +0 -17
  60. package/dist/cjs/components/common/UnicodeEmoji.js +0 -137
  61. package/dist/cjs/util/emojiIdToEmoji.js +0 -119
  62. package/dist/cjs/util/is-unicode-representation.js +0 -9
  63. package/dist/cjs/util/renderUnicodeEmojiToImagePath.js +0 -56
  64. package/dist/es2019/api/denormaliseStandardRepresentation.js +0 -11
  65. package/dist/es2019/components/common/UnicodeEmoji.js +0 -125
  66. package/dist/es2019/util/emojiIdToEmoji.js +0 -93
  67. package/dist/es2019/util/is-unicode-representation.js +0 -1
  68. package/dist/es2019/util/renderUnicodeEmojiToImagePath.js +0 -24
  69. package/dist/esm/api/denormaliseStandardRepresentation.js +0 -11
  70. package/dist/esm/components/common/UnicodeEmoji.js +0 -128
  71. package/dist/esm/util/emojiIdToEmoji.js +0 -113
  72. package/dist/esm/util/is-unicode-representation.js +0 -3
  73. package/dist/esm/util/renderUnicodeEmojiToImagePath.js +0 -49
  74. package/dist/types/api/denormaliseStandardRepresentation.d.ts +0 -2
  75. package/dist/types/components/common/UnicodeEmoji.d.ts +0 -6
  76. package/dist/types/util/emojiIdToEmoji.d.ts +0 -16
  77. package/dist/types/util/is-unicode-representation.d.ts +0 -2
  78. package/dist/types/util/renderUnicodeEmojiToImagePath.d.ts +0 -1
  79. package/emoji-id-to-emoji/package.json +0 -10
  80. package/unicode-emoji-image/package.json +0 -10
@@ -4,18 +4,16 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
4
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
5
5
  import "./ResourcedEmojiComponent.compiled.css";
6
6
  import { ax, ix } from "@compiled/react/runtime";
7
- import _regeneratorRuntime from "@babel/runtime/regenerator";
8
7
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
9
8
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
9
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
10
10
  import React, { useCallback, useEffect, useLayoutEffect, useMemo, useState } from 'react';
11
11
  import { fg } from '@atlaskit/platform-feature-flags/fg';
12
- import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
13
12
  import { EmojiCommonProvider } from '../../context/EmojiCommonProvider';
14
13
  import { UfoEmojiTimings } from '../../types';
15
14
  import { hasUfoMarked } from '../../util/analytics/hasUfoMarked';
16
15
  import { sampledUfoRenderedEmoji } from '../../util/analytics/sampledUfoRenderedEmoji';
17
16
  import { defaultEmojiHeight } from '../../util/constants';
18
- import { emojiIdToEmoji } from '../../util/emojiIdToEmoji';
19
17
  import { isImageRepresentation } from '../../util/is-image-representation';
20
18
  import { isMediaRepresentation } from '../../util/is-media-representation';
21
19
  import { isPromise } from '../../util/is-promise';
@@ -45,8 +43,6 @@ export var ResourcedEmojiComponent = function ResourcedEmojiComponent(_ref) {
45
43
  _ref$optimisticImageU = _ref.optimisticImageURL,
46
44
  optimisticImageURL = _ref$optimisticImageU === void 0 ? undefined : _ref$optimisticImageU,
47
45
  editorEmoji = _ref.editorEmoji,
48
- _ref$renderUnicodeEmo = _ref.renderUnicodeEmojiAsImage,
49
- renderUnicodeEmojiAsImage = _ref$renderUnicodeEmo === void 0 ? true : _ref$renderUnicodeEmo,
50
46
  _ref$pageTitleEmoji = _ref.pageTitleEmoji,
51
47
  pageTitleEmoji = _ref$pageTitleEmoji === void 0 ? false : _ref$pageTitleEmoji,
52
48
  placeholderXcss = _ref.placeholderXcss,
@@ -75,9 +71,6 @@ export var ResourcedEmojiComponent = function ResourcedEmojiComponent(_ref) {
75
71
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_emojiProvider, emojiId) {
76
72
  var optimisticFetch,
77
73
  reason,
78
- useUnicodeEmojis,
79
- normalizedEmojiId,
80
- shouldFetchOptimistically,
81
74
  foundEmoji,
82
75
  _args = arguments;
83
76
  return _regeneratorRuntime.wrap(function (_context) {
@@ -95,13 +88,7 @@ export var ResourcedEmojiComponent = function ResourcedEmojiComponent(_ref) {
95
88
  }
96
89
  });
97
90
  }
98
- useUnicodeEmojis = expValEqualsNoExposure('platform_use_unicode_emojis', 'isEnabled', true);
99
- normalizedEmojiId = useUnicodeEmojis ? _objectSpread(_objectSpread({}, emojiId), {}, {
100
- id: emojiId.id || undefined
101
- }) : emojiId; // A shortName-only optimistic request can resolve without an emoji before the catalogue loads.
102
- // Use the non-optimistic path so it waits for the catalogue and tokenizes custom emoji media.
103
- shouldFetchOptimistically = useUnicodeEmojis ? optimisticFetch && Boolean(emojiId.id) : optimisticFetch;
104
- foundEmoji = _emojiProvider.fetchByEmojiId(normalizedEmojiId, shouldFetchOptimistically, fg('platform_bitbucket_fix_shortname_and_ordering') ? emojiProviderLookupOrder : undefined);
91
+ foundEmoji = _emojiProvider.fetchByEmojiId(emojiId, optimisticFetch, fg('platform_bitbucket_fix_shortname_and_ordering') ? emojiProviderLookupOrder : undefined);
105
92
  sampledUfoRenderedEmoji(emojiId).mark(UfoEmojiTimings.METADATA_START);
106
93
  if (isPromise(foundEmoji)) {
107
94
  setLoaded(false);
@@ -188,35 +175,14 @@ export var ResourcedEmojiComponent = function ResourcedEmojiComponent(_ref) {
188
175
  });
189
176
  }, [emojiProvider]);
190
177
  var emojiRenderState = useMemo(function () {
191
- if (!emoji && !loaded && !optimisticImageURL || optimisticImageURL && !emoji && !id && expValEqualsNoExposure('platform_use_unicode_emojis', 'isEnabled', true)) {
178
+ if (!emoji && !loaded && !optimisticImageURL) {
192
179
  return ResourcedEmojiComponentRenderStatesEnum.INITIAL;
193
180
  } else if (!emoji && loaded || imageLoadError) {
194
181
  return ResourcedEmojiComponentRenderStatesEnum.FALLBACK;
195
182
  }
196
183
  return ResourcedEmojiComponentRenderStatesEnum.EMOJI;
197
- }, [emoji, loaded, optimisticImageURL, imageLoadError, id]);
184
+ }, [emoji, loaded, optimisticImageURL, imageLoadError]);
198
185
  var optimisticEmojiDescription = useMemo(function () {
199
- // For STANDARD emojis, use native unicode character instead of optimistic image.
200
- if (expValEqualsNoExposure('platform_use_unicode_emojis', 'isEnabled', true)) {
201
- var resolvedId = id || (emoji === null || emoji === void 0 ? void 0 : emoji.id);
202
- if (!resolvedId) return undefined;
203
- var unicodeEmoji = emojiIdToEmoji(resolvedId);
204
- if (unicodeEmoji) {
205
- return _objectSpread(_objectSpread({}, emoji !== null && emoji !== void 0 ? emoji : {
206
- id: id,
207
- shortName: shortName,
208
- fallback: fallback,
209
- type: 'STANDARD',
210
- category: '',
211
- searchable: true
212
- }), {}, {
213
- representation: {
214
- unicodeEmoji: unicodeEmoji
215
- }
216
- });
217
- }
218
- }
219
-
220
186
  // reduce blast radius by targeting page title
221
187
  if (pageTitleEmoji && optimisticImageURL && fg('platform_emoji_prevent_img_src_changing')) {
222
188
  return {
@@ -319,8 +285,7 @@ export var ResourcedEmojiComponent = function ResourcedEmojiComponent(_ref) {
319
285
  showTooltip: showTooltip,
320
286
  fitToHeight: fitToHeight,
321
287
  autoWidth: autoWidth,
322
- editorEmoji: editorEmoji,
323
- renderUnicodeEmojiAsImage: renderUnicodeEmojiAsImage
288
+ editorEmoji: editorEmoji
324
289
  })));
325
290
  };
326
291
  export default ResourcedEmojiComponent;
@@ -3,7 +3,6 @@ import "./TonePreviewButton.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
5
5
  import { forwardRef, memo } from 'react';
6
- import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
7
6
  import { isTeamoji26RefreshEmojiPickerEnabledNoExposure } from '../../util/teamoji26RefreshEmojiPicker';
8
7
  import Emoji from './Emoji';
9
8
  export var tonePreviewTestId = 'tone-preview';
@@ -22,7 +21,6 @@ export var TonePreviewButton = /*#__PURE__*/forwardRef(function (props, ref) {
22
21
  onSelected = props.onSelected,
23
22
  _props$isVisible = props.isVisible,
24
23
  isVisible = _props$isVisible === void 0 ? true : _props$isVisible;
25
- var fitToHeight = expValEqualsNoExposure('platform_use_unicode_emojis', 'isEnabled', true) ? 24 : undefined;
26
24
  return isTeamoji26RefreshEmojiPickerEnabledNoExposure() ? /*#__PURE__*/React.createElement("button", {
27
25
  ref: ref,
28
26
  onClick: onSelected,
@@ -42,8 +40,7 @@ export var TonePreviewButton = /*#__PURE__*/forwardRef(function (props, ref) {
42
40
  emoji: emoji,
43
41
  selectOnHover: selectOnHover,
44
42
  shouldBeInteractive: false,
45
- "aria-hidden": true,
46
- fitToHeight: fitToHeight
43
+ "aria-hidden": true
47
44
  })) : /*#__PURE__*/React.createElement("button", {
48
45
  ref: ref,
49
46
  onClick: onSelected,
@@ -63,8 +60,7 @@ export var TonePreviewButton = /*#__PURE__*/forwardRef(function (props, ref) {
63
60
  emoji: emoji,
64
61
  selectOnHover: selectOnHover,
65
62
  shouldBeInteractive: false,
66
- "aria-hidden": true,
67
- fitToHeight: fitToHeight
63
+ "aria-hidden": true
68
64
  }));
69
65
  });
70
66
  var _default_1 = /*#__PURE__*/memo(TonePreviewButton);
@@ -6,7 +6,7 @@ import { ax, ix } from "@compiled/react/runtime";
6
6
  import { useCallback, useEffect, useRef, useState } from 'react';
7
7
  import { useIntl } from 'react-intl';
8
8
  import { cx } from '@atlaskit/css';
9
- import { Pressable } from '@atlaskit/primitives/compiled';
9
+ import { Pressable } from '@atlaskit/primitives/compiled/pressable';
10
10
  import Tooltip from '@atlaskit/tooltip/Tooltip';
11
11
  import { usePrevious } from '../../hooks/usePrevious';
12
12
  import { CATEGORYSELECTOR_KEYBOARD_KEYS_SUPPORTED, defaultCategories, KeyboardKeys } from '../../util/constants';
@@ -4,7 +4,6 @@ import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
5
5
  import { memo } from 'react';
6
6
  import { useIntl } from 'react-intl';
7
- import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
8
7
  import { useEmojiPickerListContext } from '../../hooks/useEmojiPickerListContext';
9
8
  import { isTeamoji26RefreshEmojiPickerEnabledNoExposure } from '../../util/teamoji26RefreshEmojiPicker';
10
9
  import CachingEmoji from '../common/CachingEmoji';
@@ -27,7 +26,6 @@ var EmojiPickerEmojiRow = function EmojiPickerEmojiRow(_ref) {
27
26
  var rowIndex = (virtualItemContext === null || virtualItemContext === void 0 ? void 0 : virtualItemContext.index) || 0;
28
27
  var _useIntl = useIntl(),
29
28
  formatMessage = _useIntl.formatMessage;
30
- var fitToHeight = expValEqualsNoExposure('platform_use_unicode_emojis', 'isEnabled', true) ? 24 : undefined;
31
29
  var preventFocusOnMouseDown = isTeamoji26RefreshEmojiPickerEnabledNoExposure();
32
30
  var handleFocus = function handleFocus(index) {
33
31
  return function (emojiId, emoji, event) {
@@ -63,7 +61,6 @@ var EmojiPickerEmojiRow = function EmojiPickerEmojiRow(_ref) {
63
61
  tabIndex: focus ? 0 : -1,
64
62
  "aria-roledescription": formatMessage(messages.emojiButtonRoleDescription),
65
63
  shouldBeInteractive: true,
66
- fitToHeight: fitToHeight,
67
64
  preventFocusOnMouseDown: preventFocusOnMouseDown
68
65
  }));
69
66
  }));
@@ -12,7 +12,7 @@ export var createEvent = function createEvent(eventType, action, actionSubject,
12
12
  actionSubjectId: actionSubjectId,
13
13
  attributes: _objectSpread({
14
14
  packageName: "@atlaskit/emoji",
15
- packageVersion: "72.5.18"
15
+ packageVersion: "73.0.0"
16
16
  }, attributes)
17
17
  };
18
18
  };
@@ -16,10 +16,6 @@ export { isImageRepresentation } from './is-image-representation';
16
16
  * @deprecated Use `import { isMediaRepresentation } from '@atlaskit/emoji/type-helpers'` instead.
17
17
  */
18
18
  export { isMediaRepresentation } from './is-media-representation';
19
- /**
20
- * @deprecated Use `import { isUnicodeRepresentation } from '@atlaskit/emoji/type-helpers'` instead.
21
- */
22
- export { isUnicodeRepresentation } from './is-unicode-representation';
23
19
  /**
24
20
  * @deprecated Use `import { isPromise } from '@atlaskit/emoji/type-helpers'` instead.
25
21
  */
@@ -120,12 +120,6 @@ export declare class EmojiResource extends AbstractResource<string, EmojiSearchR
120
120
  findByShortName(shortName: string, emojiProviderLookupOrder?: EmojiProviderLookupOrder): OptionalEmojiDescription | Promise<OptionalEmojiDescription>;
121
121
  findByEmojiId(emojiId: EmojiId, emojiProviderLookupOrder?: EmojiProviderLookupOrder): OptionalEmojiDescription | Promise<OptionalEmojiDescription>;
122
122
  findById(id: string): OptionalEmojiDescription | Promise<OptionalEmojiDescription>;
123
- /**
124
- * Synchronously reads the emoji type from the local cache for the given emojiId.
125
- * Returns `undefined` when the emoji is not in the cache or no repository is initialised.
126
- * This is a pure cache read — no network requests are made.
127
- */
128
- getCachedEmojiType(emojiId: EmojiId): string | undefined;
129
123
  findInCategory(categoryId: CategoryId): Promise<EmojiDescription[]>;
130
124
  getAsciiMap(): Promise<Map<string, EmojiDescription>>;
131
125
  getFrequentlyUsed(options?: SearchOptions): Promise<EmojiDescription[]>;
@@ -54,7 +54,3 @@ export { shouldUseAltRepresentation } from './shouldUseAltRepresentation';
54
54
  * @deprecated Use `import { calculateScale } from '@atlaskit/emoji/emoji-utils'` instead.
55
55
  */
56
56
  export { calculateScale } from './calculateScale';
57
- /**
58
- * @deprecated Use `import { denormaliseStandardRepresentation } from '@atlaskit/emoji/emoji-utils'` instead.
59
- */
60
- export { denormaliseStandardRepresentation } from './denormaliseStandardRepresentation';
@@ -1,2 +1,2 @@
1
- import { type KeyValues } from '@atlaskit/util-service-support';
1
+ import type { KeyValues } from '@atlaskit/util-service-support/types';
2
2
  export declare const calculateScale: (getRatio: () => number) => KeyValues;
@@ -1,4 +1,4 @@
1
- import { type ServiceConfig } from '@atlaskit/util-service-support';
1
+ import type { ServiceConfig } from '@atlaskit/util-service-support/types';
2
2
  import type { EmojiDescription, EmojiId, EmojiRepresentation, EmojiServiceDescription, EmojiUpload, MediaApiToken, OptionalEmojiDescription } from '../../types';
3
3
  import TokenManager from './TokenManager';
4
4
  export interface EmojiUploadResponse {
@@ -69,11 +69,6 @@ export interface Props extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'onMo
69
69
  * Keyboard selection still keeps focus on the emoji for grid navigation.
70
70
  */
71
71
  preventFocusOnMouseDown?: boolean;
72
- /**
73
- * Renders unicode emoji through an image representation when a fixed height is supplied.
74
- * Defaults to `true`.
75
- */
76
- renderUnicodeEmojiAsImage?: boolean;
77
72
  /**
78
73
  * Show the emoji as selected
79
74
  */
@@ -98,9 +93,8 @@ export interface Props extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'onMo
98
93
  */
99
94
  showTooltip?: boolean;
100
95
  }
101
- export declare const unicodeEmojiCanvasSize: any;
102
96
  interface EmojiNodeWrapperProps extends Props {
103
- type: 'sprite' | 'image' | 'unicode';
97
+ type: 'sprite' | 'image';
104
98
  }
105
99
  export declare const EmojiNodeWrapper: React.ForwardRefExoticComponent<EmojiNodeWrapperProps & {
106
100
  children?: React.ReactNode | undefined;
@@ -65,11 +65,6 @@ export interface BaseResourcedEmojiProps {
65
65
  * allows custom styling to the placeholder component while the emoji is loading.
66
66
  */
67
67
  placeholderXcss?: StrictXCSSProp<'backgroundColor', never>;
68
- /**
69
- * Renders unicode emoji through an image representation when a fixed height is supplied.
70
- * Defaults to `true`.
71
- */
72
- renderUnicodeEmojiAsImage?: boolean;
73
68
  /**
74
69
  * Allows to show the tooltip.
75
70
  * Defaults to `false`.
@@ -90,5 +85,5 @@ export interface Props extends BaseResourcedEmojiProps {
90
85
  */
91
86
  onEmojiLoadSuccess?: EmojiLoadSuccessCallback;
92
87
  }
93
- export declare const ResourcedEmojiComponent: ({ emojiProvider, emojiId, emojiProviderLookupOrder, showTooltip, customFallback, fitToHeight, ignoreWrapper, optimistic, optimisticImageURL, editorEmoji, renderUnicodeEmojiAsImage, pageTitleEmoji, placeholderXcss, onEmojiLoadSuccess, onEmojiLoadFail, }: Props) => React.JSX.Element;
88
+ export declare const ResourcedEmojiComponent: ({ emojiProvider, emojiId, emojiProviderLookupOrder, showTooltip, customFallback, fitToHeight, ignoreWrapper, optimistic, optimisticImageURL, editorEmoji, pageTitleEmoji, placeholderXcss, onEmojiLoadSuccess, onEmojiLoadFail, }: Props) => React.JSX.Element;
94
89
  export default ResourcedEmojiComponent;
@@ -65,17 +65,6 @@ export interface EmojiProvider extends Provider<string, EmojiSearchResult, any,
65
65
  * Returns a map matching ascii representations to their corresponding EmojiDescription.
66
66
  */
67
67
  getAsciiMap(): Promise<Map<string, EmojiDescription>>;
68
- /**
69
- * Synchronously reads the emoji type (e.g. 'STANDARD', 'SITE', 'ATLASSIAN') from the
70
- * local cache for the given emojiId, without making any network requests.
71
- *
72
- * Returns `undefined` when the emoji is not yet in the cache or no repository has been
73
- * initialised. This is an optional method — callers must fall back gracefully when it is
74
- * absent (e.g. in mock or legacy providers).
75
- *
76
- * Optional.
77
- */
78
- getCachedEmojiType?(emojiId: EmojiId): string | undefined;
79
68
  /**
80
69
  * Returns the logged user passed by the Product
81
70
  */
@@ -218,10 +207,7 @@ export interface ImageRepresentation extends EmojiImageRepresentation {
218
207
  export interface MediaApiRepresentation extends EmojiImageRepresentation {
219
208
  mediaPath: string;
220
209
  }
221
- export interface UnicodeRepresentation {
222
- unicodeEmoji: string;
223
- }
224
- export type EmojiRepresentation = SpriteRepresentation | ImageRepresentation | MediaApiRepresentation | UnicodeRepresentation | undefined;
210
+ export type EmojiRepresentation = SpriteRepresentation | ImageRepresentation | MediaApiRepresentation | undefined;
225
211
  export interface EmojiDescription extends EmojiId {
226
212
  altRepresentation?: EmojiRepresentation;
227
213
  ascii?: string[];
@@ -14,10 +14,6 @@ export { isImageRepresentation } from './is-image-representation';
14
14
  * @deprecated Use `import { isMediaRepresentation } from '@atlaskit/emoji/type-helpers'` instead.
15
15
  */
16
16
  export { isMediaRepresentation } from './is-media-representation';
17
- /**
18
- * @deprecated Use `import { isUnicodeRepresentation } from '@atlaskit/emoji/type-helpers'` instead.
19
- */
20
- export { isUnicodeRepresentation } from './is-unicode-representation';
21
17
  /**
22
18
  * @deprecated Use `import { isPromise } from '@atlaskit/emoji/type-helpers'` instead.
23
19
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/emoji",
3
- "version": "72.5.19",
3
+ "version": "73.0.1",
4
4
  "description": "Fabric emoji React components",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -44,17 +44,17 @@
44
44
  "@atlaskit/icon-lab": "^7.11.0",
45
45
  "@atlaskit/image": "^5.2.0",
46
46
  "@atlaskit/logo": "^23.3.0",
47
- "@atlaskit/media-client": "^39.1.0",
47
+ "@atlaskit/media-client": "^39.2.0",
48
48
  "@atlaskit/media-client-react": "^7.0.0",
49
49
  "@atlaskit/platform-feature-experiments": "^0.3.0",
50
50
  "@atlaskit/platform-feature-flags": "^2.2.0",
51
51
  "@atlaskit/pragmatic-drag-and-drop": "^4.0.0",
52
- "@atlaskit/primitives": "^22.5.0",
52
+ "@atlaskit/primitives": "^22.6.0",
53
53
  "@atlaskit/radio": "^10.2.0",
54
54
  "@atlaskit/spinner": "^20.4.0",
55
55
  "@atlaskit/textfield": "^10.2.0",
56
56
  "@atlaskit/theme": "^28.2.0",
57
- "@atlaskit/tmp-editor-statsig": "^240.0.0",
57
+ "@atlaskit/tmp-editor-statsig": "^241.0.0",
58
58
  "@atlaskit/tokens": "^20.6.0",
59
59
  "@atlaskit/tooltip": "^24.4.0",
60
60
  "@atlaskit/ufo": "^2.0.0",
@@ -1,17 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.denormaliseStandardRepresentation = void 0;
7
- var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
8
- var _types = require("../types");
9
- var _emojiIdToEmoji = require("../util/emojiIdToEmoji");
10
- var _denormaliseServiceRepresentation = require("./denormaliseServiceRepresentation");
11
- var denormaliseStandardRepresentation = exports.denormaliseStandardRepresentation = function denormaliseStandardRepresentation(emoji, meta) {
12
- var unicodeEmoji = (0, _emojiIdToEmoji.emojiIdToEmoji)(emoji.id);
13
- var useUnicodeRepresentation = !!(emoji.id && emoji.type === _types.ProviderTypes.STANDARD && unicodeEmoji && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_use_unicode_emojis', 'isEnabled', true));
14
- return useUnicodeRepresentation ? {
15
- unicodeEmoji: unicodeEmoji
16
- } : (0, _denormaliseServiceRepresentation.denormaliseServiceRepresentation)(emoji.representation, meta);
17
- };
@@ -1,137 +0,0 @@
1
- /* UnicodeEmoji.tsx generated by @compiled/babel-plugin v3.0.2 */
2
- "use strict";
3
-
4
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
- var _typeof = require("@babel/runtime/helpers/typeof");
6
- Object.defineProperty(exports, "__esModule", {
7
- value: true
8
- });
9
- exports.UnicodeEmoji = void 0;
10
- var _runtime = require("@compiled/react/runtime");
11
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
12
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
14
- var _react = _interopRequireWildcard(require("react"));
15
- var _constants = require("../../util/constants");
16
- var _isSsr = require("../../util/is-ssr");
17
- var _renderUnicodeEmojiToImagePath = require("../../util/renderUnicodeEmojiToImagePath");
18
- var _Emoji = require("./Emoji");
19
- var _EmojiPlaceholder = _interopRequireDefault(require("./EmojiPlaceholder"));
20
- var _ImageEmoji = require("./ImageEmoji");
21
- var _styles = require("./styles");
22
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(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 (var _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); }
23
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
24
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
25
- var useUnicodeEmojiImage = function useUnicodeEmojiImage(unicodeEmoji) {
26
- var _useState = (0, _react.useState)({
27
- status: 'loading'
28
- }),
29
- _useState2 = (0, _slicedToArray2.default)(_useState, 2),
30
- state = _useState2[0],
31
- setState = _useState2[1];
32
- (0, _react.useEffect)(function () {
33
- var cancelled = false;
34
- var imagePathToRevoke;
35
- setState({
36
- status: 'loading',
37
- unicodeEmoji: unicodeEmoji
38
- });
39
- void (0, _renderUnicodeEmojiToImagePath.renderUnicodeEmojiToImagePath)(unicodeEmoji).then(function (imagePath) {
40
- if (cancelled) {
41
- if (imagePath) {
42
- URL.revokeObjectURL(imagePath);
43
- }
44
- return;
45
- }
46
- imagePathToRevoke = imagePath;
47
- setState(imagePath ? {
48
- status: 'ready',
49
- unicodeEmoji: unicodeEmoji,
50
- imagePath: imagePath
51
- } : {
52
- status: 'failed',
53
- unicodeEmoji: unicodeEmoji
54
- });
55
- }).catch(function () {
56
- if (!cancelled) {
57
- setState({
58
- status: 'failed',
59
- unicodeEmoji: unicodeEmoji
60
- });
61
- }
62
- });
63
- return function () {
64
- cancelled = true;
65
- if (imagePathToRevoke) {
66
- URL.revokeObjectURL(imagePathToRevoke);
67
- }
68
- };
69
- }, [unicodeEmoji]);
70
- return state;
71
- };
72
- var UnicodeEmojiImage = function UnicodeEmojiImage(props) {
73
- var emoji = props.emoji,
74
- fitToHeight = props.fitToHeight,
75
- showTooltip = props.showTooltip;
76
- var emojiText = emoji.representation.unicodeEmoji;
77
- var unicodeEmojiImage = useUnicodeEmojiImage(emojiText);
78
- var hasCurrentEmojiImage = unicodeEmojiImage.unicodeEmoji === emojiText;
79
- if ((0, _isSsr.isSSR)() || !hasCurrentEmojiImage || unicodeEmojiImage.status === 'loading') {
80
- return /*#__PURE__*/_react.default.createElement(_EmojiPlaceholder.default, {
81
- shortName: emoji.shortName,
82
- showTooltip: showTooltip,
83
- size: fitToHeight,
84
- loading: true
85
- });
86
- }
87
- if (unicodeEmojiImage.status === 'ready') {
88
- return /*#__PURE__*/_react.default.createElement(_ImageEmoji.ImageEmoji, (0, _extends2.default)({}, props, {
89
- emoji: _objectSpread(_objectSpread({}, emoji), {}, {
90
- altRepresentation: undefined,
91
- representation: {
92
- imagePath: unicodeEmojiImage.imagePath,
93
- width: _Emoji.unicodeEmojiCanvasSize,
94
- height: _Emoji.unicodeEmojiCanvasSize
95
- }
96
- })
97
- }));
98
- }
99
- return /*#__PURE__*/_react.default.createElement(_EmojiPlaceholder.default, {
100
- shortName: emoji.shortName,
101
- showTooltip: showTooltip,
102
- size: fitToHeight
103
- });
104
- };
105
- var UnicodeEmoji = exports.UnicodeEmoji = function UnicodeEmoji(props) {
106
- var emoji = props.emoji,
107
- selected = props.selected,
108
- selectOnHover = props.selectOnHover,
109
- className = props.className,
110
- fitToHeight = props.fitToHeight,
111
- _props$renderUnicodeE = props.renderUnicodeEmojiAsImage,
112
- renderUnicodeEmojiAsImage = _props$renderUnicodeE === void 0 ? true : _props$renderUnicodeE;
113
- if (renderUnicodeEmojiAsImage) {
114
- return /*#__PURE__*/_react.default.createElement(UnicodeEmojiImage, props);
115
- }
116
- var classes = "".concat(_styles.emojiNodeStyles, " ").concat(selected ? _styles.commonSelectedStyles : '', " ").concat(selectOnHover ? _styles.selectOnHoverStyles : '', " ").concat(className ? className : '');
117
- var emojiText = emoji.representation.unicodeEmoji;
118
- var defaultSize = "".concat(fitToHeight !== null && fitToHeight !== void 0 ? fitToHeight : _constants.defaultEmojiHeight, "px");
119
- var emojiSize = "var(--emoji-common-unicode-size, ".concat(defaultSize, ")");
120
- var style = {
121
- display: 'inline-flex',
122
- // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
123
- fontSize: emojiSize,
124
- alignItems: 'center',
125
- aspectRatio: '1/1'
126
- };
127
- return (
128
- /*#__PURE__*/
129
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
130
- _react.default.createElement(_Emoji.EmojiNodeWrapper, (0, _extends2.default)({}, props, {
131
- type: "unicode",
132
- className: classes
133
- }), /*#__PURE__*/_react.default.createElement("span", {
134
- style: style
135
- }, emojiText))
136
- );
137
- };
@@ -1,119 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.emojiIdToEmoji = emojiIdToEmoji;
7
- var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
8
- function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
9
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
10
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
11
- var KEYCAP_COMBINING = 0x20e3;
12
- var VARIATION_SELECTOR_16 = 0xfe0f;
13
- var VARIATION_SELECTOR_15 = 0xfe0e;
14
- var EMOJI_MODIFIER_START = 0x1f3fb;
15
- var EMOJI_MODIFIER_END = 0x1f3ff;
16
- var REGIONAL_INDICATOR_START = 0x1f1e6;
17
- var REGIONAL_INDICATOR_END = 0x1f1ff;
18
- var FLAG_BASES = new Set([0x1f38c, 0x1f3c1, 0x1f3f3, 0x1f3f4, 0x1f6a9]);
19
-
20
- // Emoji variation bases from Unicode 14.0 emoji-variation-sequences.txt.
21
- // These are the code points with a defined U+FE0F emoji-style variant.
22
- 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]);
23
- var isEmojiModifier = function isEmojiModifier(codePoint) {
24
- return typeof codePoint === 'number' && codePoint >= EMOJI_MODIFIER_START && codePoint <= EMOJI_MODIFIER_END;
25
- };
26
- var shouldAddEmojiPresentationSelector = function shouldAddEmojiPresentationSelector(codePoint, nextCodePoint) {
27
- return EMOJI_VARIATION_BASES.has(codePoint) && nextCodePoint !== VARIATION_SELECTOR_16 && nextCodePoint !== VARIATION_SELECTOR_15 && nextCodePoint !== KEYCAP_COMBINING && !isEmojiModifier(nextCodePoint);
28
- };
29
- var isRegionalIndicator = function isRegionalIndicator(codePoint) {
30
- return codePoint >= REGIONAL_INDICATOR_START && codePoint <= REGIONAL_INDICATOR_END;
31
- };
32
- var isStandaloneRegionalIndicator = function isStandaloneRegionalIndicator(codePoints) {
33
- return codePoints.length === 1 && isRegionalIndicator(codePoints[0]);
34
- };
35
- var parseEmojiIdCodePoints = function parseEmojiIdCodePoints(id) {
36
- var segments = id.split('-');
37
- var codePoints = [];
38
- var _iterator = _createForOfIteratorHelper(segments),
39
- _step;
40
- try {
41
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
42
- var segment = _step.value;
43
- if (!/^[0-9a-fA-F]+$/.test(segment)) {
44
- return undefined;
45
- }
46
- var cp = parseInt(segment, 16);
47
- // Valid Unicode scalar values: U+0000–U+10FFFF, excluding surrogates.
48
- if (isNaN(cp) || cp < 0 || cp > 0x10ffff || cp >= 0xd800 && cp <= 0xdfff) {
49
- return undefined;
50
- }
51
- codePoints.push(cp);
52
- }
53
- } catch (err) {
54
- _iterator.e(err);
55
- } finally {
56
- _iterator.f();
57
- }
58
- return codePoints.length ? codePoints : undefined;
59
- };
60
- var isFlagEmoji = function isFlagEmoji(codePoints) {
61
- if (codePoints.length === 2 && codePoints.every(isRegionalIndicator)) {
62
- return true;
63
- }
64
- return FLAG_BASES.has(codePoints[0]);
65
- };
66
-
67
- /**
68
- * Converts an emoji ID (a hyphen-separated string of hex Unicode code points,
69
- * e.g. `"1f44d"`, `"1f44d-1f3fb"`, `"1f468-200d-1f469-200d-1f467"`) into its
70
- * corresponding Unicode string.
71
- *
72
- * Special handling:
73
- * - Keycap sequences: U+20E3 (COMBINING ENCLOSING KEYCAP) must be preceded by
74
- * U+FE0F (VARIATION SELECTOR-16) to form a well-defined keycap emoji.
75
- * - Emoji variation bases are followed by U+FE0F to force emoji presentation.
76
- * - Flags and standalone regional indicators return `undefined` so callers use
77
- * Twemoji instead of native emoji.
78
- *
79
- * @returns The Unicode string for the emoji, or `undefined` if the input is
80
- * invalid (empty string, non-hex segments, or out-of-range code points).
81
- */
82
- function emojiIdToEmoji(id) {
83
- if (!(0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_use_unicode_emojis', 'isEnabled', true)) {
84
- return undefined;
85
- }
86
- if (!id) {
87
- return undefined;
88
- }
89
- var codePoints = parseEmojiIdCodePoints(id);
90
- if (!codePoints) {
91
- return undefined;
92
- }
93
- if (isStandaloneRegionalIndicator(codePoints) || isFlagEmoji(codePoints)) {
94
- return undefined;
95
- }
96
- var processedCodePoints = [];
97
- for (var i = 0; i < codePoints.length; i++) {
98
- var cp = codePoints[i];
99
- var next = codePoints[i + 1];
100
- processedCodePoints.push(cp);
101
-
102
- // Insert U+FE0F before U+20E3 if not already present.
103
- // Keycap sequences: digit/# /* followed by U+20E3 need U+FE0F between them.
104
- if (next === KEYCAP_COMBINING && cp !== VARIATION_SELECTOR_16) {
105
- processedCodePoints.push(VARIATION_SELECTOR_16);
106
- }
107
-
108
- // Emoji variation bases need U+FE0F immediately after the base code point,
109
- // including when the base appears inside a ZWJ sequence.
110
- if (shouldAddEmojiPresentationSelector(cp, next)) {
111
- processedCodePoints.push(VARIATION_SELECTOR_16);
112
- }
113
- }
114
- try {
115
- return String.fromCodePoint.apply(String, processedCodePoints);
116
- } catch (_unused) {
117
- return undefined;
118
- }
119
- }
@@ -1,9 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.isUnicodeRepresentation = void 0;
7
- var isUnicodeRepresentation = exports.isUnicodeRepresentation = function isUnicodeRepresentation(rep) {
8
- return !!(rep && rep.unicodeEmoji);
9
- };