Skip to content

Commit df0628d

Browse files
authored
Merge branch 'main' into jobayer1091/patch-82598
2 parents 755ce58 + e45067e commit df0628d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1503
-2449
lines changed

.vitepress/config.ts

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -129,38 +129,14 @@ export default defineConfigWithTheme<ThemeConfig>({
129129
},
130130
});
131131

132-
function getAnalyticsTags({
133-
VITE_GTM_ID = '',
134-
VITE_GTAG_ID = '',
135-
}: NodeJS.ProcessEnv): HeadConfig[] {
136-
// Fail the build if we have a defined but malformed analytics id
137-
const idPattern = /^(G|GTM)-[A-Z\d]+$/;
138-
for (const [name, value] of Object.entries({ VITE_GTM_ID, VITE_GTAG_ID })) {
139-
if (value && !idPattern.test(value)) {
140-
throw new Error(`Invalid ${name} value: '${value}'`);
141-
}
142-
}
143-
132+
function getAnalyticsTags({ VITE_GTM_ID = '' }: NodeJS.ProcessEnv): HeadConfig[] {
133+
const idPattern = /^GTM-[A-Z\d]+$/;
144134
const tags: HeadConfig[] = [];
145135

146-
if (VITE_GTAG_ID) {
147-
const source = `
148-
window.dataLayer = window.dataLayer || [];
149-
function gtag(){ dataLayer.push(arguments) }
150-
gtag('js', new Date);
151-
gtag('config', '${VITE_GTAG_ID}', { anonymize_ip: true });
152-
`;
153-
tags.push(['script', {}, source]);
154-
if (!VITE_GTM_ID) {
155-
const url = `https://www.googletagmanager.com/gtag/js?id=${VITE_GTAG_ID}`;
156-
tags.push(['script', { async: '', src: url }]);
157-
}
158-
}
159-
160-
// We're migrating from gtag.js to gtm.js, but using both as we verify this change.
161-
// According to https://support.google.com/tagmanager/answer/6103696 this should be
162-
// inserted after any script declaring a dataLayer.
163136
if (VITE_GTM_ID) {
137+
if (!idPattern.test(VITE_GTM_ID)) {
138+
throw new Error(`Invalid VITE_GTM_ID value: '${VITE_GTM_ID}'`);
139+
}
164140
const source = `
165141
(function(w, d, s, l, i){
166142
w[l] = w[l] || [];

.vitepress/config.ts.timestamp-1700579699301-7af714195b443.mjs

Lines changed: 0 additions & 252 deletions
This file was deleted.
Lines changed: 42 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,47 @@
1-
21
.link {
3-
--outline-color-hsl: 0, 0%, 100%;
4-
--outline-opacity: 0.08;
5-
--text-strong-color: #fff;
6-
display: flex;
7-
align-items: center;
8-
height: 36px;
9-
padding: 0 20px;
10-
border-radius: 8px;
11-
color: var(--text-strong-color);
12-
font-size: 13px;
13-
font-weight: 500;
14-
text-decoration: none;
15-
box-shadow: inset 0 0 0 1px hsla(var(--outline-color-hsl), var(--outline-opacity));
16-
background-color: hsla(224, 32%, 28%, 0.24);
17-
backdrop-filter: blur(8px);
18-
transition: 0.1s ease;
19-
transition-property: background-color, box-shadow, color;
20-
}
21-
22-
.light {
23-
&:hover {
24-
--outline-opacity: 0.14;
25-
color: var(--text-strong-color);
26-
background-color: hsla(224, 32%, 28%, 0.54);
27-
}
28-
:root:not(.dark) & {
29-
--outline-color-hsl: 224, 32%, 28%;
30-
--outline-opacity: 0.1;
31-
color: hsl(240, 6%, 23%);
32-
background-color: hsla(224, 32%, 28%, 0.1);
33-
&:hover {
34-
--outline-opacity: 0.2;
35-
background-color: transparent;
36-
}
37-
}
38-
}
39-
40-
.accent {
2+
--outline-color-hsl: 0, 0%, 100%;
3+
--outline-opacity: 0.08;
4+
--text-strong-color: #fff;
5+
display: flex;
6+
align-items: center;
7+
height: 36px;
8+
padding: 0 20px;
9+
border-radius: 8px;
10+
color: var(--text-strong-color);
11+
font-size: 13px;
12+
font-weight: 500;
13+
text-decoration: none;
14+
box-shadow: inset 0 0 0 1px hsla(var(--outline-color-hsl), var(--outline-opacity));
15+
background-color: hsla(224, 32%, 28%, 0.24);
16+
backdrop-filter: blur(8px);
17+
transition: 0.1s ease;
18+
transition-property: background-color, box-shadow, color;
19+
}
20+
21+
.light {
22+
&:hover {
4123
--outline-opacity: 0.14;
4224
color: var(--text-strong-color);
43-
background-color: hsl(214, 87%, 51%);
25+
background-color: hsla(224, 32%, 28%, 0.54);
26+
}
27+
:root:not(.dark) & {
28+
--outline-color-hsl: 224, 32%, 28%;
29+
--outline-opacity: 0.1;
30+
color: hsl(240, 6%, 23%);
31+
background-color: hsla(224, 32%, 28%, 0.1);
4432
&:hover {
45-
--outline-opacity: 0.24;
46-
background-color: hsl(208, 100%, 53%);
33+
--outline-opacity: 0.2;
34+
background-color: transparent;
4735
}
48-
}
36+
}
37+
}
38+
39+
.accent {
40+
--outline-opacity: 0.14;
41+
color: var(--text-strong-color);
42+
background-color: hsl(214, 87%, 51%);
43+
&:hover {
44+
--outline-opacity: 0.24;
45+
background-color: hsl(208, 100%, 53%);
46+
}
47+
}

.vitepress/theme/components/Helpers/CardLink.vue

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ export default {
102102
min-width: 100px;
103103
height: 64px;
104104
&:not(.has-bg)::before {
105-
-webkit-mask-size: 32px;
106-
mask-size: 32px;
105+
mask-size: 32px;
107106
}
108107
}
109108
@@ -120,14 +119,10 @@ export default {
120119
height: 100%;
121120
transition: background-color 0.14s ease;
122121
background-color: var(--vp-c-text-3);
123-
-webkit-mask-image: var(--icon-img);
124-
mask-image: var(--icon-img);
125-
-webkit-mask-position: center;
126-
mask-position: center;
127-
-webkit-mask-repeat: no-repeat;
128-
mask-repeat: no-repeat;
129-
-webkit-mask-size: var(--icon-mask-size);
130-
mask-size: var(--icon-mask-size);
122+
mask-image: var(--icon-img);
123+
mask-position: center;
124+
mask-repeat: no-repeat;
125+
mask-size: var(--icon-mask-size);
131126
.card-body:hover & {
132127
background-color: var(--vp-c-text-2);
133128
}
@@ -149,8 +144,7 @@ export default {
149144
min-width: 84px;
150145
height: 48px;
151146
&::before {
152-
-webkit-mask-size: 28px;
153-
mask-size: 28px;
147+
mask-size: 28px;
154148
}
155149
}
156150
&.is-podcast.small,
@@ -159,7 +153,6 @@ export default {
159153
min-width: 64px;
160154
height: 48px;
161155
&::before {
162-
-webkit-mask-size: 24px;
163156
mask-size: 24px;
164157
}
165158
}

.vitepress/theme/components/HomeIntro.vue

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,11 @@ header {
3131
}
3232
}
3333
34-
$icon-mask: linear-gradient(to bottom, #fff9 10%, #fffa 30%, #fff0 74%);
35-
3634
header .icon {
3735
width: 160px;
3836
height: 160px;
3937
color: var(--sb-foreground-highlight);
40-
-webkit-mask-image: $icon-mask;
41-
mask-image: $icon-mask;
38+
mask-image: linear-gradient(to bottom, #fff9 10%, #fffa 30%, #fff0 74%);
4239
4340
@media (prefers-contrast: more) {
4441
display: none;

.vitepress/theme/components/Icons/SvgIcon.vue

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@ const props = defineProps<{
1010
1111
const styleObj = computed(() => {
1212
const style: Record<string, string> = {};
13-
1413
const url = iconsUrls[props.icon];
14+
1515
if (url) {
16-
style['--icon'] = `url('${url}')`;
16+
// Vite may transform SVG assets to data URLs, using single quotes for XML
17+
// attribute values for some reason. This means we can't always quote URLs
18+
// with single quotes, or the CSS value might be invalid.
19+
const quote = url.includes(`"`) ? `'` : `"`;
20+
style['--icon'] = `url(${quote}${url}${quote})`;
1721
} else {
1822
style['visibility'] = 'hidden';
1923
style['--error'] = `'${props.icon} not found'`;
@@ -39,10 +43,12 @@ const styleObj = computed(() => {
3943
flex: none;
4044
width: var(--size, 1em);
4145
height: var(--size, 1em);
42-
color: inherit;
43-
// Use SVG icon as mask for background
44-
-webkit-mask: var(--icon) center/contain no-repeat;
45-
mask: var(--icon) center/contain no-repeat;
46+
// Use inherited text color to paint a square
4647
background-color: currentColor;
48+
// Then use the SVG icon as mask
49+
mask-image: var(--icon);
50+
mask-position: center;
51+
mask-repeat: no-repeat;
52+
mask-size: contain;
4753
}
4854
</style>

.vitepress/theme/icons/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Tell Vite to load all SVG icons in the icons folder as part of the build.
22
const importedIconsUrls = import.meta.glob('./*.svg', {
3-
as: 'url',
3+
query: '?url',
4+
import: 'default',
45
eager: true,
56
});
67

@@ -9,6 +10,6 @@ const iconNamePattern = /([0-9a-zA-Z-]+)\.svg$/;
910
export const iconsUrls: Record<string, string> = Object.fromEntries(
1011
Object.entries(importedIconsUrls).map(([path, url]) => {
1112
const nameMatches = path.match(iconNamePattern);
12-
return [nameMatches ? nameMatches[1] : path, url];
13-
})
13+
return [nameMatches ? nameMatches[1] : path, url as string];
14+
}),
1415
);
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// --------------------------------
2+
// -- Aside / Table of Contents
3+
4+
// Widen aside
5+
.VPDoc .aside {
6+
max-width: 300px !important;
7+
position: relative;
8+
padding-left: 0;
9+
@media (min-width: 1380px) {
10+
max-width: 248px;
11+
}
12+
@media (min-width: 1500px) {
13+
max-width: 300px;
14+
}
15+
@media (min-width: 1600px) {
16+
max-width: 328px;
17+
}
18+
}
19+
.aside-container {
20+
width: 300px !important;
21+
max-width: 300px;
22+
}
23+
.aside-content {
24+
padding-top: 56px;
25+
}
26+
27+
// Add gap between title and list, but account for hardcoded `outline-marker` `top`
28+
.VPDocAside .outline-title {
29+
margin-block-end: -1px;
30+
transform: translateY(-6px);
31+
}
32+
33+
// Space out links without affecting `outline-marker` too much
34+
.VPDocAside .outline-link {
35+
padding: 6px 0;
36+
font-size: 12.5px;
37+
transition-duration: 0.1s;
38+
}
39+
40+
// Don't clip text in the outline
41+
.VPDocAsideOutline .outline-link {
42+
white-space: normal;
43+
text-overflow: initial;
44+
padding: 5px 0;
45+
font-size: 13px;
46+
line-height: 18px;
47+
}

0 commit comments

Comments
 (0)