2017-10-06 04:42:34 +03:00
|
|
|
// A mapping of unicode strings to an object containing the filename
|
|
|
|
// (i.e. the svg filename) and a shortCode intended to be shown
|
|
|
|
// as a "title" attribute in an HTML element (aka tooltip).
|
|
|
|
|
2023-05-09 04:08:47 +03:00
|
|
|
import emojiCompressed from './emoji_compressed';
|
|
|
|
import { unicodeToFilename } from './unicode_to_filename';
|
|
|
|
|
2017-10-06 04:42:34 +03:00
|
|
|
const [
|
|
|
|
shortCodesToEmojiData,
|
2023-05-09 04:08:47 +03:00
|
|
|
_skins,
|
|
|
|
_categories,
|
|
|
|
_short_names,
|
2017-10-06 04:42:34 +03:00
|
|
|
emojisWithoutShortCodes,
|
2023-05-09 04:08:47 +03:00
|
|
|
] = emojiCompressed;
|
2017-10-06 04:42:34 +03:00
|
|
|
|
|
|
|
// decompress
|
|
|
|
const unicodeMapping = {};
|
|
|
|
|
|
|
|
function processEmojiMapData(emojiMapData, shortCode) {
|
|
|
|
let [ native, filename ] = emojiMapData;
|
|
|
|
if (!filename) {
|
|
|
|
// filename name can be derived from unicodeToFilename
|
|
|
|
filename = unicodeToFilename(native);
|
|
|
|
}
|
|
|
|
unicodeMapping[native] = {
|
|
|
|
shortCode: shortCode,
|
|
|
|
filename: filename,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
Object.keys(shortCodesToEmojiData).forEach((shortCode) => {
|
|
|
|
let [ filenameData ] = shortCodesToEmojiData[shortCode];
|
|
|
|
filenameData.forEach(emojiMapData => processEmojiMapData(emojiMapData, shortCode));
|
|
|
|
});
|
|
|
|
emojisWithoutShortCodes.forEach(emojiMapData => processEmojiMapData(emojiMapData));
|
|
|
|
|
2023-05-09 04:08:47 +03:00
|
|
|
export default unicodeMapping;
|