Skip to content

Commit

Permalink
Emoji Mart: Update to Emoji 15 (#24)
Browse files Browse the repository at this point in the history
* Emoji Mart: Update to Emoji 15
  • Loading branch information
ngainsboro-figma authored Jan 11, 2024
1 parent 1f42f9f commit 3f99397
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 26 deletions.
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',
}

// 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)
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')) {
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

0 comments on commit 3f99397

Please sign in to comment.