diff --git a/index.js b/index.js index aff0a2b..1b80cca 100644 --- a/index.js +++ b/index.js @@ -89,7 +89,8 @@ export const emoticon = [ "='|", "='-(", "='-[", - "='-|" + "='-|", + 'T-T' ] }, { @@ -260,7 +261,7 @@ export const emoticon = [ name: 'rage', emoji: '😡', tags: ['angry'], - description: 'pouting face', + description: 'enraged face', emoticons: [':@', ':-@', '=@', '=-@'] }, { diff --git a/schema.json b/schema.json index e79981b..dcdcc2d 100644 --- a/schema.json +++ b/schema.json @@ -1,63 +1,68 @@ { - "angry": [">", "eyesNormal", "noseOptional", "mouthNegative"], - "anguished": [], - "astonished": [], - "blush": ["eyesNormal", "noseOptional", "blush", "mouthPositive"], - "broken_heart": [["<"], ["\\", "/"], ["3"]], - "cold_sweat": [], - "confounded": [], - "confused": ["eyesNormal", "noseOptional", "mouthConfused"], - "cry": ["eyesNormal", "drop", "noseOptional", "mouthNotPositive"], - "disappointed": [], - "disappointed_relieved": [], - "dizzy_face": [], - "expressionless": [], - "fearful": [], - "flushed": [], - "frowning": ["eyesNormal", "noseOptional", "mouthNegative"], - "grimacing": [], - "grin": [], - "grinning": [], - "heart": [["<"], ["3"]], - "heart_eyes": [], - "hushed": [], - "imp": ["horns", "eyesNormal", "noseOptional", "mouthNegative"], - "innocent": ["halo", "eyesNormal", "noseOptional", "mouthPositive"], - "joy": ["eyesNormal", "drop", "noseOptional", "mouthPositive"], - "kissing": ["eyesNormal", "noseOptional", "mouthKissing"], - "kissing_closed_eyes": [], - "kissing_heart": [], - "kissing_smiling_eyes": [], - "laughing": ["eyesClosed", "noseOptional", "mouthPositive"], - "man": ["eyes", "noseOptional", "moustache"], - "mask": [], - "neutral_face": ["eyesNormal", "noseOptional", "mouthNeutral"], - "no_mouth": ["eyesNormal", "nose"], - "open_mouth": ["eyesNormal", "noseOptional", "mouthOpen"], - "pensive": [], - "persevere": [], - "rage": ["eyesNormal", "noseOptional", "mouthAngry"], - "relaxed": [], - "relieved": [], - "scream": [], - "sleeping": [], - "sleepy": [], - "smile": ["eyesNormal", "noseOptional", "mouthPositiveVery"], - "smiley": ["eyesNormal", "noseOptional", "mouthPositiveNormal"], - "smiling_imp": ["horns", "eyesNormal", "noseOptional", "mouthPositive"], - "smirk": [], - "sob": ["eyesNormal", "drop", "drop", "noseOptional", "mouthNegative"], - "stuck_out_tongue": ["eyesNormal", "noseOptional", "mouthTongue"], - "stuck_out_tongue_closed_eyes": ["eyesClosed", "noseOptional", "mouthTongue"], - "stuck_out_tongue_winking_eye": ["eyesWink", "noseOptional", "mouthTongue"], - "sunglasses": ["eyesGlasses", "noseOptional", "mouthPositive"], - "sweat": ["drop", "eyesNormal", "noseOptional", "mouthNegative"], - "sweat_smile": ["drop", "eyesNormal", "noseOptional", "mouthPositive"], - "tired_face": [], - "triumph": [], - "unamused": ["eyesNormal", "noseOptional", "mouthSquiggly"], - "weary": [], - "wink": ["eyesWink", "noseOptional", "mouthPositive"], - "worried": [], - "yum": [] + "angry": [[">", "eyesNormal", "noseOptional", "mouthNegative"]], + "anguished": [[]], + "astonished": [[]], + "blush": [["eyesNormal", "noseOptional", "blush", "mouthPositive"]], + "broken_heart": [[["<"], ["\\", "/"], ["3"]]], + "cold_sweat": [[]], + "confounded": [[]], + "confused": [["eyesNormal", "noseOptional", "mouthConfused"]], + "cry": [ + ["eyesNormal", "drop", "noseOptional", "mouthNotPositive"], + [["T"], ["-"], ["T"]] + ], + "disappointed": [[]], + "disappointed_relieved": [[]], + "dizzy_face": [[]], + "expressionless": [[]], + "fearful": [[]], + "flushed": [[]], + "frowning": [["eyesNormal", "noseOptional", "mouthNegative"]], + "grimacing": [[]], + "grin": [[]], + "grinning": [[]], + "heart": [[["<"], ["3"]]], + "heart_eyes": [[]], + "hushed": [[]], + "imp": [["horns", "eyesNormal", "noseOptional", "mouthNegative"]], + "innocent": [["halo", "eyesNormal", "noseOptional", "mouthPositive"]], + "joy": [["eyesNormal", "drop", "noseOptional", "mouthPositive"]], + "kissing": [["eyesNormal", "noseOptional", "mouthKissing"]], + "kissing_closed_eyes": [[]], + "kissing_heart": [[]], + "kissing_smiling_eyes": [[]], + "laughing": [["eyesClosed", "noseOptional", "mouthPositive"]], + "man": [["eyes", "noseOptional", "moustache"]], + "mask": [[]], + "neutral_face": [["eyesNormal", "noseOptional", "mouthNeutral"]], + "no_mouth": [["eyesNormal", "nose"]], + "open_mouth": [["eyesNormal", "noseOptional", "mouthOpen"]], + "pensive": [[]], + "persevere": [[]], + "rage": [["eyesNormal", "noseOptional", "mouthAngry"]], + "relaxed": [[]], + "relieved": [[]], + "scream": [[]], + "sleeping": [[]], + "sleepy": [[]], + "smile": [["eyesNormal", "noseOptional", "mouthPositiveVery"]], + "smiley": [["eyesNormal", "noseOptional", "mouthPositiveNormal"]], + "smiling_imp": [["horns", "eyesNormal", "noseOptional", "mouthPositive"]], + "smirk": [[]], + "sob": [["eyesNormal", "drop", "drop", "noseOptional", "mouthNegative"]], + "stuck_out_tongue": [["eyesNormal", "noseOptional", "mouthTongue"]], + "stuck_out_tongue_closed_eyes": [ + ["eyesClosed", "noseOptional", "mouthTongue"] + ], + "stuck_out_tongue_winking_eye": [["eyesWink", "noseOptional", "mouthTongue"]], + "sunglasses": [["eyesGlasses", "noseOptional", "mouthPositive"]], + "sweat": [["drop", "eyesNormal", "noseOptional", "mouthNegative"]], + "sweat_smile": [["drop", "eyesNormal", "noseOptional", "mouthPositive"]], + "tired_face": [[]], + "triumph": [[]], + "unamused": [["eyesNormal", "noseOptional", "mouthSquiggly"]], + "weary": [[]], + "wink": [["eyesWink", "noseOptional", "mouthPositive"]], + "worried": [[]], + "yum": [[]] } diff --git a/script/build-data.js b/script/build-data.js index 4c304d1..524c2bb 100644 --- a/script/build-data.js +++ b/script/build-data.js @@ -1,3 +1,5 @@ +// @ts-check + /** * @typedef Emoticon * @property {string} name @@ -11,7 +13,7 @@ import assert from 'node:assert/strict' import fs from 'node:fs/promises' import {gemoji} from 'gemoji' -/** @type {Record>} */ +/** @type {Record>>} */ const schema = JSON.parse(String(await fs.readFile('schema.json'))) /** @type {Record>} */ const alias = JSON.parse(String(await fs.readFile('alias.json'))) @@ -29,31 +31,36 @@ const data = Object.keys(schema) .map((ctx) => { assert(ctx.info, 'expected matching gemoji for `' + ctx.name + '`') const structure = ctx.structure - const flatStructure = structure.map((key) => flatten([key])) - /** @type {Array|undefined} */ - let result - - while (flatStructure[1]) { - result = unpack(flatStructure) - flatStructure.shift() - flatStructure[0] = result - } - // Remove some dangerous emoticons. - result = (result || []).filter((emoticon) => { - if ( - (/^[a-zA-Z]+$/.test(emoticon) && - (emoticon.toUpperCase() === emoticon || - emoticon.toLowerCase() === emoticon)) || - /([\s\S])\1+/g.test(emoticon) || - emoticon === '=-' - ) { - console.log('Removing dangerous/unused emoticon:', emoticon) - return false - } - - return true - }) + let result = structure + .flatMap((faceStructure) => { + const flatStructure = faceStructure.map((key) => flatten([key])) + /** @type {Array|undefined} */ + let result + + while (flatStructure[1]) { + result = unpack(flatStructure) + flatStructure.shift() + flatStructure[0] = result + } + + return result ?? [] + }) + .filter((emoticon) => { + // Remove some dangerous emoticons. + if ( + (/^[a-zA-Z]+$/.test(emoticon) && + (emoticon.toUpperCase() === emoticon || + emoticon.toLowerCase() === emoticon)) || + /([\s\S])\1+/g.test(emoticon) || + emoticon === '=-' + ) { + console.log('Removing dangerous/unused emoticon:', emoticon) + return false + } + + return true + }) return { name: ctx.name, diff --git a/support.md b/support.md index e030a24..26752df 100644 --- a/support.md +++ b/support.md @@ -7,9 +7,9 @@ the first column! | :-: | :-: | :-: | :-: | | 😠 | angry | mad; annoyed | `>:(`; `>:[`; `>:-(`; `>:-[`; `>=(`; `>=[`; `>=-(`; `>=-[` | | 😊 | blush | proud | `:")`; `:"]`; `:"D`; `:-")`; `:-"]`; `:-"D`; `=")`; `="]`; `="D`; `=-")`; `=-"]`; `=-"D` | -| 💔 | broken\_heart | | `<\3`; `