diff --git a/.gitignore b/.gitignore index 4f6aa0fc6..646feb5ea 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,9 @@ KaTeX_**.ttf KaTeX_**.woff KaTeX_**.woff2 +# Twemoji Assets +public/twemoji/*.svg + # Integration Tests cypress/screenshots diff --git a/package-lock.json b/package-lock.json index 3ca687bed..2ebf246ce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,6 +27,7 @@ "siwe": "^2.0.5", "svelte": "^3.52.0", "svelte-preprocess": "^4.10.7", + "twemoji": "^14.0.2", "util": "^0.12.5" }, "devDependencies": { @@ -6772,6 +6773,62 @@ "integrity": "sha512-RKJBIj8lySrShN4w6i/BonWp2Z/uxwC3h4y7xsRrpP59ZboCd0GpEVsOnMDYLMmKBpYhb5TgHzZXy7wTfYFBRw==", "dev": true }, + "node_modules/twemoji": { + "version": "14.0.2", + "resolved": "https://registry.npmjs.org/twemoji/-/twemoji-14.0.2.tgz", + "integrity": "sha512-BzOoXIe1QVdmsUmZ54xbEH+8AgtOKUiG53zO5vVP2iUu6h5u9lN15NcuS6te4OY96qx0H7JK9vjjl9WQbkTRuA==", + "dependencies": { + "fs-extra": "^8.0.1", + "jsonfile": "^5.0.0", + "twemoji-parser": "14.0.0", + "universalify": "^0.1.2" + } + }, + "node_modules/twemoji-parser": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/twemoji-parser/-/twemoji-parser-14.0.0.tgz", + "integrity": "sha512-9DUOTGLOWs0pFWnh1p6NF+C3CkQ96PWmEFwhOVmT3WbecRC+68AIqpsnJXygfkFcp4aXbOp8Dwbhh/HQgvoRxA==" + }, + "node_modules/twemoji/node_modules/fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, + "node_modules/twemoji/node_modules/fs-extra/node_modules/jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/twemoji/node_modules/jsonfile": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-5.0.0.tgz", + "integrity": "sha512-NQRZ5CRo74MhMMC3/3r5g2k4fjodJ/wh8MxjFbCViWKFjxrnudWSY5vomh+23ZaXzAS7J3fBZIR2dV6WbmfM0w==", + "dependencies": { + "universalify": "^0.1.2" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/twemoji/node_modules/universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "engines": { + "node": ">= 4.0.0" + } + }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -12013,6 +12070,58 @@ "integrity": "sha512-RKJBIj8lySrShN4w6i/BonWp2Z/uxwC3h4y7xsRrpP59ZboCd0GpEVsOnMDYLMmKBpYhb5TgHzZXy7wTfYFBRw==", "dev": true }, + "twemoji": { + "version": "14.0.2", + "resolved": "https://registry.npmjs.org/twemoji/-/twemoji-14.0.2.tgz", + "integrity": "sha512-BzOoXIe1QVdmsUmZ54xbEH+8AgtOKUiG53zO5vVP2iUu6h5u9lN15NcuS6te4OY96qx0H7JK9vjjl9WQbkTRuA==", + "requires": { + "fs-extra": "^8.0.1", + "jsonfile": "^5.0.0", + "twemoji-parser": "14.0.0", + "universalify": "^0.1.2" + }, + "dependencies": { + "fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "dependencies": { + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "requires": { + "graceful-fs": "^4.1.6" + } + } + } + }, + "jsonfile": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-5.0.0.tgz", + "integrity": "sha512-NQRZ5CRo74MhMMC3/3r5g2k4fjodJ/wh8MxjFbCViWKFjxrnudWSY5vomh+23ZaXzAS7J3fBZIR2dV6WbmfM0w==", + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^0.1.2" + } + }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" + } + } + }, + "twemoji-parser": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/twemoji-parser/-/twemoji-parser-14.0.0.tgz", + "integrity": "sha512-9DUOTGLOWs0pFWnh1p6NF+C3CkQ96PWmEFwhOVmT3WbecRC+68AIqpsnJXygfkFcp4aXbOp8Dwbhh/HQgvoRxA==" + }, "type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", diff --git a/package.json b/package.json index 9cca467d0..9d57c1185 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "start": "vite", "serve": "vite preview", "build": "scripts/build", - "postinstall": "scripts/copy-katex-assets", + "postinstall": "scripts/copy-katex-assets && scripts/install-twemoji-assets", "check": "scripts/check", "format": "npx prettier '**/*.@(ts|js|svelte|json|css|html)' --ignore-path .gitignore --write", "test:unit": "TZ='UTC' vitest run", @@ -55,6 +55,7 @@ "siwe": "^2.0.5", "svelte": "^3.52.0", "svelte-preprocess": "^4.10.7", + "twemoji": "^14.0.2", "util": "^0.12.5" } } diff --git a/public/twemoji/.gitkeep b/public/twemoji/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/public/typography.css b/public/typography.css index 460b16aa0..4089c3c2a 100644 --- a/public/typography.css +++ b/public/typography.css @@ -103,3 +103,9 @@ p { color: var(--color-foreground); border-bottom-color: var(--color-foreground); } +.txt-emoji { + height: 1em; + width: 1em; + margin: 0 0.05em 0 0.1em; + vertical-align: -0.1em; +} diff --git a/scripts/install-twemoji-assets b/scripts/install-twemoji-assets new file mode 100755 index 000000000..741a02e4d --- /dev/null +++ b/scripts/install-twemoji-assets @@ -0,0 +1,9 @@ +#!/bin/bash +set -Eeou pipefail + +version="$(node -e 'console.log(require("twemoji/package.json").version)')" + +echo "Installing Twemoji SVG assets v${version}" + +curl -sSL "https://github.com/twitter/twemoji/archive/refs/tags/v${version}.tar.gz" \ + | tar -x -z -C public/twemoji/ --strip-components=3 "twemoji-${version}/assets/svg" diff --git a/src/App.svelte b/src/App.svelte index 7dad7ac99..dc60c106c 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -2,7 +2,7 @@ import { Connection, state, session } from "@app/session"; import { getWallet } from "@app/wallet"; import { initialize, activeRouteStore } from "@app/router"; - import { unreachable } from "@app/utils"; + import { twemoji, unreachable } from "@app/utils"; import ColorPalette from "@app/ColorPalette.svelte"; import Faucet from "@app/base/faucet/Routes.svelte"; @@ -118,7 +118,7 @@
{title} diff --git a/src/Placeholder.svelte b/src/Placeholder.svelte index 6943acc81..bacbbcaf2 100644 --- a/src/Placeholder.svelte +++ b/src/Placeholder.svelte @@ -1,5 +1,7 @@