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

Switch twemoji provider and add new Unicode 15 emojis #153

Merged
merged 2 commits into from
Dec 6, 2023
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
20 changes: 17 additions & 3 deletions public/emojis.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const emojis = {
BAGS: "🛍️",
BALD: "👨‍🦲",
BALL: "⚾️",
BALLET: "🩰",
BANANA: "🍌",
BANG: "❗",
BANJO: "🪕",
Expand Down Expand Up @@ -83,6 +84,7 @@ const emojis = {
BROOM: "🧹",
BROWN: "🟤",
BRUSH: "🖌️",
BUBBLE: "🫧",
BUCKET: "🪣",
BUGS: "🪲",
BUILD: "👷",
Expand Down Expand Up @@ -190,6 +192,7 @@ const emojis = {
DOGS: "🐩",
DOLL: "🎎",
DOLLAR: "💲",
DONKEY: "🫏",
DONUT: "🍩",
DOOR: "🚪",
DOVE: "🕊",
Expand All @@ -212,6 +215,7 @@ const emojis = {
FACE: "😐",
FAIRY: "🧚‍♀️",
FAMILY: "👨‍👩‍👧",
FANS: "🪭",
FARM: "👨‍🌾",
FARMER: "👩‍🌾",
FART: "💨",
Expand All @@ -236,6 +240,7 @@ const emojis = {
FLIGHT: "🛩️",
FLOPPY: "💾",
FLOWER: "🌻",
FLUTE: "🪈",
FOGGY: "🌫️",
FONDUE: "🫕",
FOOD: "🍛",
Expand All @@ -261,6 +266,7 @@ const emojis = {
GERM: "🦠",
GHOST: "👻",
GIFT: "🎁",
GINGER: "🫚",
GIRL: "👧",
GLOBE: "🌍",
GLOVE: "🧤",
Expand All @@ -270,6 +276,7 @@ const emojis = {
GOGGLE: "🥽",
GOLD: "🥇",
GOLF: "⛳️",
GOOSE: "🪿",
GRAPE: "🍇",
GRAPH: "📊",
GREEN: "🟢",
Expand Down Expand Up @@ -314,6 +321,7 @@ const emojis = {
HURT: "🤕",
HUSH: "🤐",
JEANS: "👖",
JELLY: "🪼",
JEWEL: "💎",
JOKER: "🃏",
JUDGE: "👩‍⚖️",
Expand Down Expand Up @@ -377,6 +385,7 @@ const emojis = {
MONEY: "💰",
MONKEY: "🐒",
MOON: "🌛",
MOOSE: "🫎",
MOSQUE: "🕌",
MOTOR: "🏍",
MOUSE: "🐭",
Expand Down Expand Up @@ -427,6 +436,7 @@ const emojis = {
PEAK: "🏔",
PEANUT: "🥜",
PEAR: "🍐",
PEAS: "🫛",
PENCIL: "✏️",
PENS: "🖊",
PEPPER: "🌶️",
Expand Down Expand Up @@ -472,6 +482,7 @@ const emojis = {
PUNT: "🏈",
PURPLE: "🟣",
PURSE: "👛",
PUSH: "🫷",
PUZZLE: "🧩",
QUIET: "🤫",
RABBIT: "🐇",
Expand Down Expand Up @@ -523,13 +534,15 @@ const emojis = {
SEEDS: "🍉",
SELF: "🤳",
SEVEN: "7️⃣",
SHAKER: "🪇",
SHARK: "🦈",
SHEEP: "🐑",
SHELL: "🐚",
SHIELD: "🛡️",
SHINY: "✨",
SHIP: "🚢",
SHIRT: "👚",
SHOCK: "🫨",
SHOE: "👟",
SHORTS: "🩳",
SHOWER: "🚿",
Expand Down Expand Up @@ -684,7 +697,8 @@ const emojis = {
WIFI: "📶",
WINDOW: "🪟",
WINDY: "🌬",
WING: "🦋",
WING: "🪽",
WINGS: "🦋",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Breaking change alert! Just kidding

Copy link
Owner Author

Choose a reason for hiding this comment

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

I tested it out. If you had unlocked WING before it stays unlocked, just with a different emoji.

WINK: "😉",
WISH: "🧞‍♀️",
WIZARD: "🧙‍♂️",
Expand Down Expand Up @@ -737,8 +751,8 @@ function getUnicodeCodePoint(emoji) {
*/
function getEmojiImage(emoji) {
const codePoint = getUnicodeCodePoint(emoji);
// or png: https://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/72x72/1f004.png
return `https://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/svg/${codePoint}.svg`;
// or png: https://cdn.jsdelivr.net/gh/jdecked/twemoji@15.0.2/assets/72x72/1f004.png
return `https://cdn.jsdelivr.net/gh/jdecked/twemoji@15.0.2/assets/svg/${codePoint}.svg`;
}

if (typeof module !== "undefined") {
Expand Down
2 changes: 1 addition & 1 deletion scripts/emojicheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async function main() {
const takenEmojis = Object.values(emojis);
const takenKeys = Object.keys(emojis).map((key) => key.toLowerCase());

const versionBlockList = ["15.0"];
const versionBlockList = ["15.1", "16.0"];

const categoryBlockList = ["Flags", "Symbols"];

Expand Down
6 changes: 3 additions & 3 deletions test/emojis.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,16 @@ describe("emojis", () => {
describe("getEmojiImage", () => {
it("unicode 13 character", () => {
const src = getEmojiImage("🪰");
expect(src).toBe(`https://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/svg/1fab0.svg`);
expect(src).toBe(`https://cdn.jsdelivr.net/gh/jdecked/twemoji@15.0.2/assets/svg/1fab0.svg`);
});
it("variants", () => {
const src = getEmojiImage("👩‍⚕️");
expect(src).toBe(`https://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/svg/1f469-200d-2695-fe0f.svg`);
expect(src).toBe(`https://cdn.jsdelivr.net/gh/jdecked/twemoji@15.0.2/assets/svg/1f469-200d-2695-fe0f.svg`);
});
it("trailing zero width joiner", () => {
const src1 = getEmojiImage("⭐️");
const src2 = getEmojiImage("\u2B50\uFE0F");
expect(src1).toBe(`https://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/svg/2b50.svg`);
expect(src1).toBe(`https://cdn.jsdelivr.net/gh/jdecked/twemoji@15.0.2/assets/svg/2b50.svg`);
expect(src2).toEqual(src1);
});
});
35 changes: 33 additions & 2 deletions test/twemoji.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// from curl "https://api.github.com/repos/twitter/twemoji/git/trees/v14.0.2?recursive=1" | jq -c '.tree[] | select(.path | contains("assets/svg")) | .path'
// as of v14.0.2
// from curl "https://api.github.com/repos/jdecked/twemoji/git/trees/v15.0.2?recursive=1" | jq -c '.tree[] | select(.path | contains("assets/svg")) | .path'
// as of v15.0.2
const twemoji = new Set([
"1f004",
"1f0cf",
Expand Down Expand Up @@ -709,6 +709,7 @@ const twemoji = new Set([
"1f423",
"1f424",
"1f425",
"1f426-200d-2b1b",
"1f426",
"1f427",
"1f428",
Expand Down Expand Up @@ -2323,6 +2324,7 @@ const twemoji = new Set([
"1f6d5",
"1f6d6",
"1f6d7",
"1f6dc",
"1f6dd",
"1f6de",
"1f6df",
Expand Down Expand Up @@ -3305,6 +3307,9 @@ const twemoji = new Set([
"1fa72",
"1fa73",
"1fa74",
"1fa75",
"1fa76",
"1fa77",
"1fa78",
"1fa79",
"1fa7a",
Expand All @@ -3317,6 +3322,8 @@ const twemoji = new Set([
"1fa84",
"1fa85",
"1fa86",
"1fa87",
"1fa88",
"1fa90",
"1fa91",
"1fa92",
Expand Down Expand Up @@ -3346,6 +3353,9 @@ const twemoji = new Set([
"1faaa",
"1faab",
"1faac",
"1faad",
"1faae",
"1faaf",
"1fab0",
"1fab1",
"1fab2",
Expand All @@ -3357,6 +3367,10 @@ const twemoji = new Set([
"1fab8",
"1fab9",
"1faba",
"1fabb",
"1fabc",
"1fabd",
"1fabf",
"1fac0",
"1fac1",
"1fac2",
Expand All @@ -3378,6 +3392,8 @@ const twemoji = new Set([
"1fac5-1f3fe",
"1fac5-1f3ff",
"1fac5",
"1face",
"1facf",
"1fad0",
"1fad1",
"1fad2",
Expand All @@ -3388,6 +3404,8 @@ const twemoji = new Set([
"1fad7",
"1fad8",
"1fad9",
"1fada",
"1fadb",
"1fae0",
"1fae1",
"1fae2",
Expand All @@ -3396,6 +3414,7 @@ const twemoji = new Set([
"1fae5",
"1fae6",
"1fae7",
"1fae8",
"1faf0-1f3fb",
"1faf0-1f3fc",
"1faf0-1f3fd",
Expand Down Expand Up @@ -3458,6 +3477,18 @@ const twemoji = new Set([
"1faf6-1f3fe",
"1faf6-1f3ff",
"1faf6",
"1faf7-1f3fb",
"1faf7-1f3fc",
"1faf7-1f3fd",
"1faf7-1f3fe",
"1faf7-1f3ff",
"1faf7",
"1faf8-1f3fb",
"1faf8-1f3fc",
"1faf8-1f3fd",
"1faf8-1f3fe",
"1faf8-1f3ff",
"1faf8",
"203c",
"2049",
"2122",
Expand Down