Skip to content
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
19 changes: 6 additions & 13 deletions .vitepress/theme/components/Helpers/CardLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ export default {
min-width: 100px;
height: 64px;
&:not(.has-bg)::before {
-webkit-mask-size: 32px;
mask-size: 32px;
mask-size: 32px;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removing the -webkit-mask prefixes because:

  • the unprefixed version finally shipped in Chrome 120 (current is 123);
  • also we have some autoprefixing going on that will add those prefixes at build time anyway (unless we go out of our way to add a .browserslistrc to narrow down our target browsers to Chrome 120+, Safari 15.4+ and Firefox 53+).

}
}

Expand All @@ -120,14 +119,10 @@ export default {
height: 100%;
transition: background-color 0.14s ease;
background-color: var(--vp-c-text-3);
-webkit-mask-image: var(--icon-img);
mask-image: var(--icon-img);
-webkit-mask-position: center;
mask-position: center;
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
-webkit-mask-size: var(--icon-mask-size);
mask-size: var(--icon-mask-size);
mask-image: var(--icon-img);
mask-position: center;
mask-repeat: no-repeat;
mask-size: var(--icon-mask-size);
.card-body:hover & {
background-color: var(--vp-c-text-2);
}
Expand All @@ -149,8 +144,7 @@ export default {
min-width: 84px;
height: 48px;
&::before {
-webkit-mask-size: 28px;
mask-size: 28px;
mask-size: 28px;
}
}
&.is-podcast.small,
Expand All @@ -159,7 +153,6 @@ export default {
min-width: 64px;
height: 48px;
&::before {
-webkit-mask-size: 24px;
mask-size: 24px;
}
}
Expand Down
5 changes: 1 addition & 4 deletions .vitepress/theme/components/HomeIntro.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,11 @@ header {
}
}

$icon-mask: linear-gradient(to bottom, #fff9 10%, #fffa 30%, #fff0 74%);

header .icon {
width: 160px;
height: 160px;
color: var(--sb-foreground-highlight);
-webkit-mask-image: $icon-mask;
mask-image: $icon-mask;
mask-image: linear-gradient(to bottom, #fff9 10%, #fffa 30%, #fff0 74%);

@media (prefers-contrast: more) {
display: none;
Expand Down
18 changes: 12 additions & 6 deletions .vitepress/theme/components/Icons/SvgIcon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ const props = defineProps<{

const styleObj = computed(() => {
const style: Record<string, string> = {};

const url = iconsUrls[props.icon];

if (url) {
style['--icon'] = `url('${url}')`;
// Vite may transform SVG assets to data URLs, using single quotes for XML
// attribute values for some reason. This means we can't always quote URLs
// with single quotes, or the CSS value might be invalid.
const quote = url.includes(`"`) ? `'` : `"`;
style['--icon'] = `url(${quote}${url}${quote})`;
Comment on lines -16 to +20
Copy link
Contributor Author

Choose a reason for hiding this comment

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

🌟 This is the fix.

} else {
style['visibility'] = 'hidden';
style['--error'] = `'${props.icon} not found'`;
Expand All @@ -39,10 +43,12 @@ const styleObj = computed(() => {
flex: none;
width: var(--size, 1em);
height: var(--size, 1em);
color: inherit;
// Use SVG icon as mask for background
-webkit-mask: var(--icon) center/contain no-repeat;
mask: var(--icon) center/contain no-repeat;
// Use inherited text color to paint a square
background-color: currentColor;
// Then use the SVG icon as mask
mask-image: var(--icon);
mask-position: center;
mask-repeat: no-repeat;
mask-size: contain;
}
</style>
4 changes: 0 additions & 4 deletions .vitepress/theme/styles/custom-block.scss
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,9 @@
width: 24px;
height: 24px;
background-color: var(--block-icon-color);
-webkit-mask-image: var(--block-icon-url);
mask-image: var(--block-icon-url);
-webkit-mask-position: center;
mask-position: center;
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
-webkit-mask-size: contain;
mask-size: contain;
@media (max-width: 500px) {
left: -40px;
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"markdown-it-footnote": "^3.0.3",
"prettier": "^3.2.5",
"sass": "^1.72.0",
"vitepress": "~1.0.1"
"vitepress": "~1.0.2"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tiny VitePress update, picks up a fix for the mobile nav that doesn't affect us but is safe to have.

},
"prettier": {
"printWidth": 100,
Expand Down