2017-10-06 10:42:34 +09: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 10:08:47 +09:00
|
|
|
import emojiCompressed from './emoji_compressed';
|
|
|
|
|
|
|
|
import { unicodeToFilename } from './unicode_to_filename';
|
|
|
|
|
2017-10-06 10:42:34 +09:00
|
|
|
const [
|
|
|
|
shortCodesToEmojiData,
|
2023-05-09 10:08:47 +09:00
|
|
|
_skins,
|
|
|
|
_categories,
|
|
|
|
_short_names,
|
2017-10-06 10:42:34 +09:00
|
|
|
emojisWithoutShortCodes,
|
2023-05-09 10:08:47 +09:00
|
|
|
] = emojiCompressed;
|
2017-10-06 10:42:34 +09: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 10:08:47 +09:00
|
|
|
export default unicodeMapping;
|