Skip to content

Commit abd7b46

Browse files
authored
Add assets from Twemoji 13.1.0 (#16345)
* Add assets from Twemoji 13.1.0 * Update emoji-mart
1 parent aafac8d commit abd7b46

File tree

430 files changed

+543
-110
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

430 files changed

+543
-110
lines changed

app/javascript/mastodon/features/compose/components/emoji_picker_dropdown.js

+21-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
3-
import { defineMessages, injectIntl } from 'react-intl';
3+
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
44
import { EmojiPicker as EmojiPickerAsync } from '../../ui/util/async-components';
55
import Overlay from 'react-overlays/lib/Overlay';
66
import classNames from 'classnames';
@@ -12,7 +12,6 @@ import { assetHost } from 'mastodon/utils/config';
1212
const messages = defineMessages({
1313
emoji: { id: 'emoji_button.label', defaultMessage: 'Insert emoji' },
1414
emoji_search: { id: 'emoji_button.search', defaultMessage: 'Search...' },
15-
emoji_not_found: { id: 'emoji_button.not_found', defaultMessage: 'No emojos!! (╯°□°)╯︵ ┻━┻' },
1615
custom: { id: 'emoji_button.custom', defaultMessage: 'Custom' },
1716
recent: { id: 'emoji_button.recent', defaultMessage: 'Frequently used' },
1817
search_results: { id: 'emoji_button.search_results', defaultMessage: 'Search results' },
@@ -28,9 +27,26 @@ const messages = defineMessages({
2827

2928
let EmojiPicker, Emoji; // load asynchronously
3029

31-
const backgroundImageFn = () => `${assetHost}/emoji/sheet_10.png`;
3230
const listenerOptions = supportsPassiveEvents ? { passive: true } : false;
3331

32+
const backgroundImageFn = () => `${assetHost}/emoji/sheet_13.png`;
33+
34+
const notFoundFn = () => (
35+
<div className='emoji-mart-no-results'>
36+
<Emoji
37+
emoji='sleuth_or_spy'
38+
set='twitter'
39+
size={32}
40+
sheetSize={32}
41+
backgroundImageFn={backgroundImageFn}
42+
/>
43+
44+
<div className='emoji-mart-no-results-label'>
45+
<FormattedMessage id='emoji_button.not_found' defaultMessage='No matching emojis found' />
46+
</div>
47+
</div>
48+
);
49+
3450
class ModifierPickerMenu extends React.PureComponent {
3551

3652
static propTypes = {
@@ -182,7 +198,6 @@ class EmojiPickerMenu extends React.PureComponent {
182198

183199
return {
184200
search: intl.formatMessage(messages.emoji_search),
185-
notfound: intl.formatMessage(messages.emoji_not_found),
186201
categories: {
187202
search: intl.formatMessage(messages.search_results),
188203
recent: intl.formatMessage(messages.recent),
@@ -263,7 +278,9 @@ class EmojiPickerMenu extends React.PureComponent {
263278
recent={frequentlyUsedEmojis}
264279
skin={skinTone}
265280
showPreview={false}
281+
showSkinTones={false}
266282
backgroundImageFn={backgroundImageFn}
283+
notFound={notFoundFn}
267284
autoFocus
268285
emojiTooltip
269286
/>

app/javascript/mastodon/features/emoji/emoji_compressed.js

+28-5
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,38 @@
77

88
const { unicodeToFilename } = require('./unicode_to_filename');
99
const { unicodeToUnifiedName } = require('./unicode_to_unified_name');
10-
const emojiMap = require('./emoji_map.json');
10+
const emojiMap = require('./emoji_map.json');
1111
const { emojiIndex } = require('emoji-mart');
1212
const { uncompress: emojiMartUncompress } = require('emoji-mart/dist/utils/data');
13+
1314
let data = require('emoji-mart/data/all.json');
1415

1516
if(data.compressed) {
1617
data = emojiMartUncompress(data);
1718
}
19+
1820
const emojiMartData = data;
1921

2022
const excluded = ['®', '©', '™'];
21-
const skins = ['🏻', '🏼', '🏽', '🏾', '🏿'];
23+
const skinTones = ['🏻', '🏼', '🏽', '🏾', '🏿'];
2224
const shortcodeMap = {};
2325

2426
const shortCodesToEmojiData = {};
2527
const emojisWithoutShortCodes = [];
2628

2729
Object.keys(emojiIndex.emojis).forEach(key => {
28-
shortcodeMap[emojiIndex.emojis[key].native] = emojiIndex.emojis[key].id;
30+
let emoji = emojiIndex.emojis[key];
31+
32+
// Emojis with skin tone modifiers are stored like this
33+
if (Object.prototype.hasOwnProperty.call(emoji, '1')) {
34+
emoji = emoji['1'];
35+
}
36+
37+
shortcodeMap[emoji.native] = emoji.id;
2938
});
3039

3140
const stripModifiers = unicode => {
32-
skins.forEach(tone => {
41+
skinTones.forEach(tone => {
3342
unicode = unicode.replace(tone, '');
3443
});
3544

@@ -64,13 +73,22 @@ Object.keys(emojiMap).forEach(key => {
6473
if (!Array.isArray(shortCodesToEmojiData[shortcode])) {
6574
shortCodesToEmojiData[shortcode] = [[]];
6675
}
76+
6777
shortCodesToEmojiData[shortcode][0].push(filenameData);
6878
}
6979
});
7080

7181
Object.keys(emojiIndex.emojis).forEach(key => {
72-
const { native } = emojiIndex.emojis[key];
82+
let emoji = emojiIndex.emojis[key];
83+
84+
// Emojis with skin tone modifiers are stored like this
85+
if (Object.prototype.hasOwnProperty.call(emoji, '1')) {
86+
emoji = emoji['1'];
87+
}
88+
89+
const { native } = emoji;
7390
let { short_names, search, unified } = emojiMartData.emojis[key];
91+
7492
if (short_names[0] !== key) {
7593
throw new Error('The compresser expects the first short_code to be the ' +
7694
'key. It may need to be rewritten if the emoji change such that this ' +
@@ -80,11 +98,16 @@ Object.keys(emojiIndex.emojis).forEach(key => {
8098
short_names = short_names.slice(1); // first short name can be inferred from the key
8199

82100
const searchData = [native, short_names, search];
101+
83102
if (unicodeToUnifiedName(native) !== unified) {
84103
// unified name can't be derived from unicodeToUnifiedName
85104
searchData.push(unified);
86105
}
87106

107+
if (!Array.isArray(shortCodesToEmojiData[key])) {
108+
shortCodesToEmojiData[key] = [[]];
109+
}
110+
88111
shortCodesToEmojiData[key].push(searchData);
89112
});
90113

app/javascript/mastodon/features/emoji/unicode_to_unified_name.js

+4
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,20 @@ function padLeft(str, num) {
22
while (str.length < num) {
33
str = '0' + str;
44
}
5+
56
return str;
67
}
78

89
exports.unicodeToUnifiedName = (str) => {
910
let output = '';
11+
1012
for (let i = 0; i < str.length; i += 2) {
1113
if (i > 0) {
1214
output += '-';
1315
}
16+
1417
output += padLeft(str.codePointAt(i).toString(16).toUpperCase(), 4);
1518
}
19+
1620
return output;
1721
};

app/javascript/mastodon/locales/en.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
"emoji_button.food": "Food & Drink",
143143
"emoji_button.label": "Insert emoji",
144144
"emoji_button.nature": "Nature",
145-
"emoji_button.not_found": "No emojos!! (╯°□°)╯︵ ┻━┻",
145+
"emoji_button.not_found": "No matching emojis found",
146146
"emoji_button.objects": "Objects",
147147
"emoji_button.people": "People",
148148
"emoji_button.recent": "Frequently used",

app/javascript/styles/mastodon/emoji_picker.scss

+59-6
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
overflow: hidden;
4949
transition: color .1s ease-out;
5050
cursor: pointer;
51+
background: transparent;
52+
border: 0;
5153

5254
&:hover {
5355
color: darken($lighter-text-color, 4%);
@@ -106,11 +108,13 @@
106108
padding: 10px;
107109
padding-right: 45px;
108110
background: $simple-background-color;
111+
position: relative;
109112

110113
input {
111114
font-size: 14px;
112115
font-weight: 400;
113116
padding: 7px 9px;
117+
padding-right: 25px;
114118
font-family: inherit;
115119
display: block;
116120
width: 100%;
@@ -131,6 +135,30 @@
131135
}
132136
}
133137

138+
.emoji-mart-search-icon {
139+
position: absolute;
140+
top: 18px;
141+
right: 45px + 5px;
142+
z-index: 2;
143+
padding: 2px 5px 1px;
144+
border: 0;
145+
background: none;
146+
transition: all 100ms linear;
147+
transition-property: opacity;
148+
pointer-events: auto;
149+
opacity: 0.7;
150+
151+
&:disabled {
152+
cursor: default;
153+
pointer-events: none;
154+
opacity: 0.3;
155+
}
156+
157+
svg {
158+
fill: $action-button-color;
159+
}
160+
}
161+
134162
.emoji-mart-category .emoji-mart-emoji {
135163
cursor: pointer;
136164

@@ -169,9 +197,36 @@
169197
}
170198
}
171199

200+
/* For screenreaders only, via https://stackoverflow.com/a/19758620 */
201+
.emoji-mart-sr-only {
202+
position: absolute;
203+
width: 1px;
204+
height: 1px;
205+
padding: 0;
206+
margin: -1px;
207+
overflow: hidden;
208+
clip: rect(0, 0, 0, 0);
209+
border: 0;
210+
}
211+
212+
.emoji-mart-category-list {
213+
margin: 0;
214+
padding: 0;
215+
}
216+
217+
.emoji-mart-category-list li {
218+
list-style: none;
219+
margin: 0;
220+
padding: 0;
221+
display: inline-block;
222+
}
223+
172224
.emoji-mart-emoji {
173225
position: relative;
174226
display: inline-block;
227+
background: transparent;
228+
border: 0;
229+
padding: 0;
175230
font-size: 0;
176231

177232
span {
@@ -182,19 +237,17 @@
182237

183238
.emoji-mart-no-results {
184239
font-size: 14px;
240+
color: $light-text-color;
185241
text-align: center;
242+
padding: 5px 6px;
186243
padding-top: 70px;
187-
color: $light-text-color;
188-
189-
.emoji-mart-category-label {
190-
display: none;
191-
}
192244

193-
.emoji-mart-no-results-label {
245+
.emoji-mart-no-results-label {
194246
margin-top: .2em;
195247
}
196248

197249
.emoji-mart-emoji:hover::before {
250+
cursor: default;
198251
content: none;
199252
}
200253
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
"cssnano": "^4.1.11",
8989
"detect-passive-events": "^2.0.3",
9090
"dotenv": "^9.0.2",
91-
"emoji-mart": "Gargron/emoji-mart#build",
91+
"emoji-mart": "^3.0.1",
9292
"es6-symbol": "^3.1.3",
9393
"escape-html": "^1.0.3",
9494
"exif-js": "^2.3.0",

public/emoji/1f1f5-1f1f9.svg

+1-1
Loading

public/emoji/1f1f9-1f1ed.svg

+1-1
Loading

public/emoji/1f36a.svg

+1-1
Loading

0 commit comments

Comments
 (0)