Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emoji Mart: Update to Emoji 15 #24

Merged
merged 8 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

15 changes: 1 addition & 14 deletions packages/emoji-mart-data/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import emojiData from 'emoji-datasource'

const DRY_RUN = process.argv.indexOf('--dry') != -1

const VERSIONS = [1, 2, 3, 4, 5, 11, 12, 12.1, 13, 13.1, 14]
const VERSIONS = [1, 2, 3, 4, 5, 11, 12, 12.1, 13, 13.1, 14, 15]
const SKINS = ['1F3FB', '1F3FC', '1F3FD', '1F3FE', '1F3FF']
const SETS = ['native', 'apple', 'facebook', 'google', 'twitter']
const CATEGORIES = [
Expand All @@ -27,15 +27,6 @@ const CATEGORIES = [
// we will remove female_sign and male_sign from this list so that they are no longer selectable
const MISSING_EMOJIS = ['medical_symbol', 'female_sign', 'male_sign']

const MISSING_ALIAS = {
// Figma's beetle emoji renders as a ladybug, which is complicated because
// beetle was introduced as a new emoji in v13 with a different image
// For now, we continue to honor our old, now incorrect shortcode. We will
// want to revisit this when we upgrade what emoji version we support
beetle: 'ladybug',
man_in_tuxedo: 'person_in_tuxedo',
}
Comment on lines -30 to -37

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have the time, can you elaborate why this is safe to remove? I can't quite infer what the original issue was (and why updating emoji sets fixes it) looking at the comment getting ripped out.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the before times (6+ years ago), we special-cased these 2 emoji. As part of the emoji 14 upgrade, we got the product go-ahead to stop special-casing them. I think it was before the ladybug emoji was introduced. I had stripped out all of those use cases from our code except for this one (see the last subtask here: https://app.asana.com/0/1204728196943613/1205011813641107/f). I had deprioritized it, but since I was in here anyways figured I may as well remove it.

So this is a (small) change in user experience, but an intentional green-lit one.


// const KEYWORD_SUBSTITUTES = {
// highfive: 'highfive high-five',
// }
Expand Down Expand Up @@ -180,10 +171,6 @@ function buildData({ set, version } = {}) {
data.categories.unshift(smileysAndPeople)
data.categories.splice(1, 2)

for (const oldName of Object.keys(MISSING_ALIAS)) {
data.aliases[oldName] = MISSING_ALIAS[oldName]
}

if (!DRY_RUN) {
let folder = 'sets'
if (version) folder += `/${version}`
Expand Down
1 change: 1 addition & 0 deletions packages/emoji-mart-data/sets/15/apple.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions packages/emoji-mart-data/sets/15/facebook.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions packages/emoji-mart-data/sets/15/google.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions packages/emoji-mart-data/sets/15/native.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions packages/emoji-mart-data/sets/15/twitter.json

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions packages/emoji-mart/src/__tests__/config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('Data', () => {

test('emojis', () => {
expect(Data).toHaveProperty('emojis')
expect(Object.keys(Data.emojis).length).toBe(1849)
expect(Object.keys(Data.emojis).length).toBe(1870)
Copy link

@oliw-figma oliw-figma Jan 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting I thought the new emoji count would be higher!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, small update: https://emojipedia.org/emoji-15.0

for (const emojiId of Object.keys(Data.emojis)) {
const emoji = Data.emojis[emojiId]
expect(emoji).toHaveProperty('id')
Expand All @@ -34,7 +34,5 @@ describe('Data', () => {
test('alias', () => {
expect(Data).toHaveProperty('aliases')
expect(Data.aliases['satisfied']).toBe('laughing')
expect(Data.aliases['beetle']).toBe('ladybug')
expect(Data.aliases['man_in_tuxedo']).toBe('person_in_tuxedo')
})
})
3 changes: 3 additions & 0 deletions packages/emoji-mart/src/components/Emoji/Emoji.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ export default function Emoji(props) {
)
}

// TODO: Before enabling `emoji_15_upgrade`, we will need to update this to respect the new
// URL format for emoji images in Figma Design and Figjam (which will likely be using Noto).

const src = Images.getUrl(emojiSkin)
return (
<img
Expand Down
4 changes: 2 additions & 2 deletions packages/emoji-mart/src/components/Emoji/EmojiElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ export default class EmojiElement extends HTMLElement {
}
}

if ('customElements' in window && !customElements.get('em-emoji')) {
customElements.define('em-emoji', EmojiElement)
if ('customElements' in window && !customElements.get('em-emoji-15')) {
customElements.define('em-emoji-15', EmojiElement)
}
4 changes: 2 additions & 2 deletions packages/emoji-mart/src/components/Picker/PickerElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ export default class PickerElement extends ShadowElement {
}
}

if ('customElements' in window && !customElements.get('em-emoji-picker')) {
customElements.define('em-emoji-picker', PickerElement)
if ('customElements' in window && !customElements.get('em-emoji-picker-15')) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a wonky quirk. Basically, this customElements is globally spaced, but we'll be importing the old and new version of emoji-mart while it's under FF. To avoid a react error, we can just register this under a slightly modified name.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will you have two entries in Figma's package.json pointing to two different shas?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

customElements.define('em-emoji-picker-15', PickerElement)
}
6 changes: 3 additions & 3 deletions packages/emoji-mart/src/config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import i18n_en from '../../emoji-mart-data/i18n/en.json'
import data_default from '../../emoji-mart-data/sets/14/native.json'
import data_default from '../../emoji-mart-data/sets/15/native.json'
import { FrequentlyUsed, NativeSupport } from './helpers'

function getReverseAliasMap(data) {
Expand Down Expand Up @@ -74,8 +74,8 @@ const DEFAULT_PROPS = {
value: 22,
},
emojiVersion: {
value: 14,
choices: [1, 2, 3, 4, 5, 11, 12, 12.1, 13, 13.1, 14],
value: 15,
choices: [1, 2, 3, 4, 5, 11, 12, 12.1, 13, 13.1, 14, 15],
},
locale: {
value: 'en',
Expand Down
Loading