mirror of
https://github.com/rommapp/romm.git
synced 2026-11-30 18:42:34 +01:00
fix(v2): draw region flags on Chromium/Windows and center them in card chips (#5101)
This commit is contained in:
7
frontend/package-lock.json
generated
7
frontend/package-lock.json
generated
@@ -17,6 +17,7 @@
|
||||
"@zxing/library": "^0.23.0",
|
||||
"axios": "^1.18.1",
|
||||
"bowser": "^2.14.1",
|
||||
"country-flag-emoji-polyfill": "^0.1.10",
|
||||
"cronstrue": "^3.0.0",
|
||||
"date-fns": "^4.1.0",
|
||||
"js-cookie": "^3.0.7",
|
||||
@@ -7410,6 +7411,12 @@
|
||||
"url": "https://opencollective.com/core-js"
|
||||
}
|
||||
},
|
||||
"node_modules/country-flag-emoji-polyfill": {
|
||||
"version": "0.1.10",
|
||||
"resolved": "https://registry.npmjs.org/country-flag-emoji-polyfill/-/country-flag-emoji-polyfill-0.1.10.tgz",
|
||||
"integrity": "sha512-5O50p2mq/d8+4AfHz3monRQaBA4TIQ0XcKqJUhCYR6SMsLqlO4m8f87og6R1D68Z1sNXGkjLkcEccuzC6T9i5g==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/crelt": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/crelt/-/crelt-1.0.6.tgz",
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
"@zxing/library": "^0.23.0",
|
||||
"axios": "^1.18.1",
|
||||
"bowser": "^2.14.1",
|
||||
"country-flag-emoji-polyfill": "^0.1.10",
|
||||
"cronstrue": "^3.0.0",
|
||||
"date-fns": "^4.1.0",
|
||||
"js-cookie": "^3.0.7",
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { polyfillCountryFlagEmojis } from "country-flag-emoji-polyfill";
|
||||
import flagFontUrl from "country-flag-emoji-polyfill/dist/TwemojiCountryFlags.woff2?url";
|
||||
import { createApp } from "vue";
|
||||
import App from "@/RomM.vue";
|
||||
import "@/console/index.css";
|
||||
@@ -41,6 +43,12 @@ function isChunkLoadError(error: unknown): boolean {
|
||||
);
|
||||
}
|
||||
|
||||
// Chromium on Windows has no flag emoji; load a self-hosted flag font there
|
||||
// (first in the v2 font tokens) and mark <html> so CardFlags can align it.
|
||||
if (polyfillCountryFlagEmojis("Twemoji Country Flags", flagFontUrl)) {
|
||||
document.documentElement.dataset.flagPolyfill = "";
|
||||
}
|
||||
|
||||
window.addEventListener("vite:preloadError", (event) => {
|
||||
if (reloadOnceForStaleChunk()) event.preventDefault();
|
||||
});
|
||||
|
||||
@@ -74,4 +74,21 @@ const languages = computed(() =>
|
||||
line-height: 1.1;
|
||||
backdrop-filter: blur(6px);
|
||||
}
|
||||
|
||||
/* Emoji ink spans baseline to cap height, so trimming to that box centers it;
|
||||
the larger padding makes up the trimmed height. */
|
||||
@supports (text-box: trim-both cap alphabetic) {
|
||||
.card-flags__chip {
|
||||
padding-block: 4.5px;
|
||||
}
|
||||
|
||||
.card-flags__chip > span {
|
||||
text-box: trim-both cap alphabetic;
|
||||
}
|
||||
|
||||
/* Twemoji flags center 0.375em up, Segoe UI's trimmed box at 0.35em. */
|
||||
html[data-flag-polyfill] .card-flags__chip > span {
|
||||
translate: 0 0.025em;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -62,11 +62,11 @@
|
||||
--r-color-crt-ghost-warm: #ff3b5c;
|
||||
--r-color-crt-ghost-cool: #3bd9ff;
|
||||
--r-font-family-sans:
|
||||
"Segoe UI", -apple-system, BlinkMacSystemFont, system-ui, "Inter", Roboto,
|
||||
sans-serif;
|
||||
"Twemoji Country Flags", "Segoe UI", -apple-system, BlinkMacSystemFont,
|
||||
system-ui, "Inter", Roboto, sans-serif;
|
||||
--r-font-family-display:
|
||||
"Segoe UI", -apple-system, BlinkMacSystemFont, system-ui, "Inter", Roboto,
|
||||
sans-serif;
|
||||
"Twemoji Country Flags", "Segoe UI", -apple-system, BlinkMacSystemFont,
|
||||
system-ui, "Inter", Roboto, sans-serif;
|
||||
--r-font-family-mono:
|
||||
ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
|
||||
--r-font-size-xs: 10.5px;
|
||||
|
||||
@@ -272,10 +272,12 @@ export const colorCoverArt = {
|
||||
icon: "#F9F9F9", // foreground icon
|
||||
} as const;
|
||||
|
||||
// 'Twemoji Country Flags' only exists where main.ts polyfills flag emoji and
|
||||
// only covers flag code points, so all other text falls through to the rest.
|
||||
export const fontFamily = {
|
||||
sans: "'Segoe UI', -apple-system, BlinkMacSystemFont, system-ui, 'Inter', Roboto, sans-serif",
|
||||
sans: "'Twemoji Country Flags', 'Segoe UI', -apple-system, BlinkMacSystemFont, system-ui, 'Inter', Roboto, sans-serif",
|
||||
display:
|
||||
"'Segoe UI', -apple-system, BlinkMacSystemFont, system-ui, 'Inter', Roboto, sans-serif",
|
||||
"'Twemoji Country Flags', 'Segoe UI', -apple-system, BlinkMacSystemFont, system-ui, 'Inter', Roboto, sans-serif",
|
||||
mono: "ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace",
|
||||
} as const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user