2023-06-13 20:28:31 +03:00
|
|
|
import type { BaseEmoji, EmojiData, NimbleEmojiIndex } from 'emoji-mart';
|
|
|
|
import type { Category, Data, Emoji } from 'emoji-mart/dist-es/utils/data';
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The 'search' property, although not defined in the [`Emoji`]{@link node_modules/@types/emoji-mart/dist-es/utils/data.d.ts#Emoji} type,
|
|
|
|
* is used in the application.
|
|
|
|
* This could be due to an oversight by the library maintainer.
|
|
|
|
* The `search` property is defined and used [here]{@link node_modules/emoji-mart/dist/utils/data.js#uncompress}.
|
|
|
|
*/
|
|
|
|
export type Search = string;
|
|
|
|
/*
|
|
|
|
* The 'skins' property does not exist in the application data.
|
|
|
|
* This could be a potential area of refactoring or error handling.
|
|
|
|
* The non-existence of 'skins' property is evident at [this location]{@link app/javascript/flavours/glitch/features/emoji/emoji_compressed.js:121}.
|
|
|
|
*/
|
2023-10-24 11:06:14 +03:00
|
|
|
type Skins = null;
|
2023-06-13 20:28:31 +03:00
|
|
|
|
2023-10-24 11:06:14 +03:00
|
|
|
type Filename = string;
|
|
|
|
type UnicodeFilename = string;
|
|
|
|
export type FilenameData = [
|
|
|
|
filename: Filename,
|
|
|
|
unicodeFilename?: UnicodeFilename,
|
|
|
|
][];
|
2023-06-13 20:28:31 +03:00
|
|
|
export type ShortCodesToEmojiDataKey =
|
|
|
|
| EmojiData['id']
|
|
|
|
| BaseEmoji['native']
|
|
|
|
| keyof NimbleEmojiIndex['emojis'];
|
|
|
|
|
2023-10-24 11:06:14 +03:00
|
|
|
type SearchData = [
|
2023-06-13 20:28:31 +03:00
|
|
|
BaseEmoji['native'],
|
|
|
|
Emoji['short_names'],
|
|
|
|
Search,
|
2023-07-13 14:58:47 +03:00
|
|
|
Emoji['unified'],
|
2023-06-13 20:28:31 +03:00
|
|
|
];
|
|
|
|
|
2023-07-13 12:49:16 +03:00
|
|
|
export type ShortCodesToEmojiData = Record<
|
|
|
|
ShortCodesToEmojiDataKey,
|
|
|
|
[FilenameData, SearchData]
|
|
|
|
>;
|
2023-10-24 11:06:14 +03:00
|
|
|
type EmojisWithoutShortCodes = FilenameData;
|
2023-06-13 20:28:31 +03:00
|
|
|
|
2023-10-24 11:06:14 +03:00
|
|
|
type EmojiCompressed = [
|
2023-06-13 20:28:31 +03:00
|
|
|
ShortCodesToEmojiData,
|
|
|
|
Skins,
|
|
|
|
Category[],
|
|
|
|
Data['aliases'],
|
2023-07-13 14:58:47 +03:00
|
|
|
EmojisWithoutShortCodes,
|
2023-06-13 20:28:31 +03:00
|
|
|
];
|
|
|
|
|
|
|
|
/*
|
|
|
|
* `emoji_compressed.js` uses `babel-plugin-preval`, which makes it difficult to convert to TypeScript.
|
|
|
|
* As a temporary solution, we are allowing a default export here to apply the TypeScript type `EmojiCompressed` to the JS file export.
|
|
|
|
* - {@link app/javascript/flavours/glitch/features/emoji/emoji_compressed.js}
|
|
|
|
*/
|
|
|
|
declare const emojiCompressed: EmojiCompressed;
|
|
|
|
|
|
|
|
export default emojiCompressed; // eslint-disable-line import/no-default-export
|