1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-21 14:21:16 -04:00

clean up and add type checks to the modern-normalize.css -> JS translation

This commit is contained in:
2022-03-04 10:52:04 -05:00
parent f8b6378faf
commit 760607fddd
3 changed files with 171 additions and 152 deletions

View File

@@ -1,16 +1,26 @@
// @sindresorhus's modern-normalize.css converted to a JS object, with a bit of cruft removed: // @sindresorhus's modern-normalize.css converted to a JS object, as of this commit:
// https://github.com/sindresorhus/modern-normalize/blob/b59ec0d3d8654cbb6843bc9ea45aef5f1d680108/modern-normalize.css // https://github.com/sindresorhus/modern-normalize/blob/b59ec0d3d8654cbb6843bc9ea45aef5f1d680108/modern-normalize.css
// note: re-defining any of these selector(s) anywhere else will override *every* property for them defined here.
const normalizeCss = { /*! modern-normalize v1.1.0 | MIT License | https://github.com/sindresorhus/modern-normalize */
import type * as Stitches from "@stitches/react";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const normalizeCss: Record<string, Stitches.CSSProperties>[] = [
{
"*, ::before, ::after": { "*, ::before, ::after": {
boxSizing: "border-box", boxSizing: "border-box",
}, },
html: { html: {
lineHeight: 1.15, lineHeight: 1.15,
tabSize: 4, tabSize: 4,
// @ts-ignore
WebkitTextSizeAdjust: "100%", WebkitTextSizeAdjust: "100%",
}, },
body: {
margin: 0,
// fontFamily: "system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'",
},
hr: { hr: {
height: 0, height: 0,
color: "inherit", color: "inherit",
@@ -21,6 +31,10 @@ const normalizeCss = {
"b, strong": { "b, strong": {
fontWeight: "bolder", fontWeight: "bolder",
}, },
"code, kbd, samp, pre": {
// fontFamily: "ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace",
fontSize: "1em",
},
small: { small: {
fontSize: "80%", fontSize: "80%",
}, },
@@ -50,6 +64,7 @@ const normalizeCss = {
textTransform: "none", textTransform: "none",
}, },
"button, [type='button'], [type='reset'], [type='submit']": { "button, [type='button'], [type='reset'], [type='submit']": {
// @ts-ignore
WebkitAppearance: "button", WebkitAppearance: "button",
}, },
"::-moz-focus-inner": { "::-moz-focus-inner": {
@@ -68,23 +83,27 @@ const normalizeCss = {
progress: { progress: {
verticalAlign: "baseline", verticalAlign: "baseline",
}, },
"::-webkit-inner-spin-button, ::-webkit-outer-spin-button": {
height: "auto",
},
"[type='search']": {
WebkitAppearance: "textfield",
outlineOffset: "-2px",
},
"::-webkit-search-decoration": {
WebkitAppearance: "none",
},
"::-webkit-file-upload-button": {
WebkitAppearance: "button",
font: "inherit",
},
summary: { summary: {
display: "list-item", display: "list-item",
}, },
}; "[type='search']": {
outlineOffset: -2,
// @ts-ignore
WebkitAppearance: "textfield",
},
"::-webkit-search-decoration": {
// @ts-ignore
WebkitAppearance: "none",
},
"::-webkit-inner-spin-button, ::-webkit-outer-spin-button": {
height: "auto",
},
"::-webkit-file-upload-button": {
font: "inherit",
// @ts-ignore
WebkitAppearance: "button",
},
},
];
export default normalizeCss; export default normalizeCss;

View File

@@ -113,15 +113,13 @@ export const darkTheme = createTheme({
}, },
}); });
export const globalStyles = globalCss({ export const globalStyles = globalCss(
// https://github.com/sindresorhus/modern-normalize
...normalizeCss,
// @ts-ignore // @ts-ignore
...normalizeCss,
{
"@font-face": [...Inter.family, ...RobotoMono.family, ...ComicNeue.family], "@font-face": [...Inter.family, ...RobotoMono.family, ...ComicNeue.family],
body: { body: {
margin: 0,
backgroundColor: "$backgroundInner", backgroundColor: "$backgroundInner",
fontFamily: "$sans", fontFamily: "$sans",
@@ -133,7 +131,8 @@ export const globalStyles = globalCss({
fontFamily: "$mono", fontFamily: "$mono",
}, },
// variable font support // variable font support?
// @ts-ignore
"@supports (font-variation-settings: normal)": { "@supports (font-variation-settings: normal)": {
body: { body: {
fontFamily: "$sansVar", fontFamily: "$sansVar",
@@ -171,7 +170,8 @@ export const globalStyles = globalCss({
transitionDelay: "0s !important", transitionDelay: "0s !important",
}, },
}, },
}); }
);
// re-export hashed URLs of the most important variable fonts so we can preload them in ../../pages/_document.tsx // re-export hashed URLs of the most important variable fonts so we can preload them in ../../pages/_document.tsx
export const preloadUrls = { export const preloadUrls = {

View File

@@ -2067,9 +2067,9 @@ camelcase@^6.2.0:
integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==
caniuse-lite@^1.0.30001283, caniuse-lite@^1.0.30001312: caniuse-lite@^1.0.30001283, caniuse-lite@^1.0.30001312:
version "1.0.30001312" version "1.0.30001313"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001312.tgz#e11eba4b87e24d22697dae05455d5aea28550d5f" resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001313.tgz#a380b079db91621e1b7120895874e2fd62ed2e2f"
integrity sha512-Wiz1Psk2MEK0pX3rUzWaunLTZzqS2JYZFzNKqAiJGiuxIjRPLgV6+VDPOg6lQOUxmDwhTlh198JsTTi8Hzw6aQ== integrity sha512-rI1UN0koZUiKINjysQDuRi2VeSCce3bYJNmDcj3PIKREiAmjakugBul1QSkg/fPrlULYl6oWfGg3PbgOSY9X4Q==
ccount@^1.0.0: ccount@^1.0.0:
version "1.1.0" version "1.1.0"
@@ -2343,9 +2343,9 @@ csso@^4.2.0:
css-tree "^1.1.2" css-tree "^1.1.2"
csstype@^3.0.2: csstype@^3.0.2:
version "3.0.10" version "3.0.11"
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.0.10.tgz#2ad3a7bed70f35b965707c092e5f30b327c290e5" resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.0.11.tgz#d66700c5eacfac1940deb4e3ee5642792d85cd33"
integrity sha512-2u44ZG2OcNUO9HDp/Jl8C07x6pU/eTR3ncV91SiK3dhG9TWvRVsCoJw14Ckx5DgWkzGA3waZWO3d7pgqpUI/XA== integrity sha512-sa6P2wJ+CAbgyy4KFssIb/JNMLxFvKF1pCYCSXS8ZMuqZnMsrxqI2E5sPyoTpxoPU/gVZMzr2zjOfg8GIZOMsw==
damerau-levenshtein@^1.0.7: damerau-levenshtein@^1.0.7:
version "1.0.8" version "1.0.8"
@@ -2514,9 +2514,9 @@ emoji-regex@^9.2.2:
integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg== integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==
enhanced-resolve@^5.7.0: enhanced-resolve@^5.7.0:
version "5.9.1" version "5.9.2"
resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.9.1.tgz#e898cea44d9199fd92137496cff5691b910fb43e" resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.9.2.tgz#0224dcd6a43389ebfb2d55efee517e5466772dd9"
integrity sha512-jdyZMwCQ5Oj4c5+BTnkxPgDZO/BJzh/ADDmKebayyzNwjVX1AFCeGkOfxNx0mHi2+8BKC5VxUYiw3TIvoT7vhw== integrity sha512-GIm3fQfwLJ8YZx2smuHpBKkXC1yOk+OBEmKckVyL0i/ea8mqDEykK3ld5dgH1QYPNyT/lIllxV2LULnxCHaHkA==
dependencies: dependencies:
graceful-fs "^4.2.4" graceful-fs "^4.2.4"
tapable "^2.2.0" tapable "^2.2.0"
@@ -5759,9 +5759,9 @@ trough@^2.0.0:
integrity sha512-AqTiAOLcj85xS7vQ8QkAV41hPDIJ71XJB4RCUrzo/1GM2CQwhkJGaf9Hgr7BOugMRpgGUrqRg/DrBDl4H40+8g== integrity sha512-AqTiAOLcj85xS7vQ8QkAV41hPDIJ71XJB4RCUrzo/1GM2CQwhkJGaf9Hgr7BOugMRpgGUrqRg/DrBDl4H40+8g==
tsconfig-paths@^3.11.0, tsconfig-paths@^3.9.0: tsconfig-paths@^3.11.0, tsconfig-paths@^3.9.0:
version "3.12.0" version "3.13.0"
resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.12.0.tgz#19769aca6ee8f6a1a341e38c8fa45dd9fb18899b" resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.13.0.tgz#f3e9b8f6876698581d94470c03c95b3a48c0e3d7"
integrity sha512-e5adrnOYT6zqVnWqZu7i/BQ3BnhzvGbjEjejFXO20lKIKpwTaupkCPgEfv4GZK1IBciJUEhYs3J3p75FdaTFVg== integrity sha512-nWuffZppoaYK0vQ1SQmkSsQzJoHA4s6uzdb2waRpD806x9yfq153AdVsWz4je2qZcW+pENrMQXbGQ3sMCkXuhw==
dependencies: dependencies:
"@types/json5" "^0.0.29" "@types/json5" "^0.0.29"
json5 "^1.0.1" json5 "^1.0.1"
@@ -5965,9 +5965,9 @@ unist-util-stringify-position@^2.0.0:
"@types/unist" "^2.0.2" "@types/unist" "^2.0.2"
unist-util-stringify-position@^3.0.0: unist-util-stringify-position@^3.0.0:
version "3.0.1" version "3.0.2"
resolved "https://registry.yarnpkg.com/unist-util-stringify-position/-/unist-util-stringify-position-3.0.1.tgz#9dd6d1817aed14ea35c39227c47eb9bd192b7165" resolved "https://registry.yarnpkg.com/unist-util-stringify-position/-/unist-util-stringify-position-3.0.2.tgz#5c6aa07c90b1deffd9153be170dce628a869a447"
integrity sha512-HDVOJ704Uj5QWqoB6KV4CDP62OW9wam9BEuwGE4fvunhVraZcO/fFNBCpvmDDSlkFBG/GAYdHfKvKvDAJxzcWA== integrity sha512-7A6eiDCs9UtjcwZOcCpM4aPII3bAAGv13E96IkawkOAW0OhH+yRxtY0lzo8KiHpzEMfH7Q+FizUmwp8Iqy5EWg==
dependencies: dependencies:
"@types/unist" "^2.0.0" "@types/unist" "^2.0.0"
@@ -6119,9 +6119,9 @@ vfile-message@^2.0.0:
unist-util-stringify-position "^2.0.0" unist-util-stringify-position "^2.0.0"
vfile-message@^3.0.0: vfile-message@^3.0.0:
version "3.1.1" version "3.1.2"
resolved "https://registry.yarnpkg.com/vfile-message/-/vfile-message-3.1.1.tgz#b45c17a074ba4fec4319b32ffddf71ed1c52b97e" resolved "https://registry.yarnpkg.com/vfile-message/-/vfile-message-3.1.2.tgz#a2908f64d9e557315ec9d7ea3a910f658ac05f7d"
integrity sha512-pz5xA88aupQPuXmY46xnGAv8MzAcU1Xi2Do3UftjTdvQHreXCWvJT/BbzYixPNYRek+EAioI0kP3crJu37xa6Q== integrity sha512-QjSNP6Yxzyycd4SVOtmKKyTsSvClqBPJcd00Z0zuPj3hOIjg0rUPG6DbFGPvUKRgYyaIWLPKpuEclcuvb3H8qA==
dependencies: dependencies:
"@types/unist" "^2.0.0" "@types/unist" "^2.0.0"
unist-util-stringify-position "^3.0.0" unist-util-stringify-position "^3.0.0"
@@ -6137,9 +6137,9 @@ vfile@^4.0.0, vfile@^4.2.1:
vfile-message "^2.0.0" vfile-message "^2.0.0"
vfile@^5.0.0, vfile@^5.3.0: vfile@^5.0.0, vfile@^5.3.0:
version "5.3.1" version "5.3.2"
resolved "https://registry.yarnpkg.com/vfile/-/vfile-5.3.1.tgz#5e8ae0aa1d3359e6123d5051451e03f355768ca0" resolved "https://registry.yarnpkg.com/vfile/-/vfile-5.3.2.tgz#b499fbc50197ea50ad3749e9b60beb16ca5b7c54"
integrity sha512-EWkoULWVDBV3ozmE21TA0qekXreWJXV1jKcF8rgnvmmH0L9Vm8eTSnuuSSpH2XpLXZLJ0uMMIHUqDLHjK5lh4w== integrity sha512-w0PLIugRY3Crkgw89TeMvHCzqCs/zpreR31hl4D92y6SOE07+bfJe+dK5Q2akwS+i/c801kzjoOr9gMcTe6IAA==
dependencies: dependencies:
"@types/unist" "^2.0.0" "@types/unist" "^2.0.0"
is-buffer "^2.0.0" is-buffer "^2.0.0"