diff --git a/.vitepress/components/FeaturedSponsors.vue b/.vitepress/components/FeaturedSponsors.vue
index e99868b..1a9a9b5 100644
--- a/.vitepress/components/FeaturedSponsors.vue
+++ b/.vitepress/components/FeaturedSponsors.vue
@@ -152,7 +152,7 @@ const markLogoFailed = (section: SponsorSection): void => {
.featured-logo {
width: auto;
height: 80px;
- max-width: 244px;
+ max-width: min(244px, 100%);
flex: none;
padding: 8px 12px;
object-fit: contain;
diff --git a/.vitepress/components/SponsorList.vue b/.vitepress/components/SponsorList.vue
index ee2ec63..fb71ded 100644
--- a/.vitepress/components/SponsorList.vue
+++ b/.vitepress/components/SponsorList.vue
@@ -108,13 +108,15 @@ const markAvatarFailed = (sponsor: Sponsor): void => {
@error="markAvatarFailed(sponsor)"
/>
{{ avatarFallback(sponsor) }}
-
- {{ displayName(sponsor) }}
-
- Anonymous
- {{ providerLabel(sponsor) }}
- monthly
- former monthly
+
+
+ {{ displayName(sponsor) }}
+
+ Anonymous
+ {{ providerLabel(sponsor) }}
+ monthly
+ former monthly
+
{{ formatUsd(sponsor.lifetimeCents) }}
@@ -243,12 +245,26 @@ const markAvatarFailed = (sponsor: Sponsor): void => {
margin: 0;
}
+.row-name {
+ display: flex;
+ flex: 1;
+ flex-wrap: wrap;
+ gap: 4px 10px;
+ align-items: center;
+ min-width: 0;
+}
+
+.row-name > :first-child {
+ min-width: 0;
+}
+
.rows img {
border-radius: 50%;
flex: none;
}
.row-meta {
+ flex: none;
margin-left: auto;
font-size: 13px;
color: var(--vp-c-text-2);
diff --git a/.vitepress/theme/benchmarks.css b/.vitepress/theme/benchmarks.css
index 22d7e64..2108f63 100644
--- a/.vitepress/theme/benchmarks.css
+++ b/.vitepress/theme/benchmarks.css
@@ -27,6 +27,7 @@
}
.filter-chip {
+ max-width: 100%;
transition: opacity 0.2s;
}
@@ -94,6 +95,12 @@
}
}
+@media (max-width: 440px) {
+ .filter-chips {
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ }
+}
+
.panel-strip {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
diff --git a/.vitepress/theme/components.css b/.vitepress/theme/components.css
index 68c1abc..14b0e0c 100644
--- a/.vitepress/theme/components.css
+++ b/.vitepress/theme/components.css
@@ -156,7 +156,8 @@
}
@media (prefers-reduced-motion: reduce) {
- .vp-doc .custom-block.details > summary {
+ .vp-doc .custom-block.details > summary,
+ .vp-doc .custom-block.details > summary::after {
transition: none;
}
}
@@ -459,13 +460,14 @@
z-index: 1;
right: auto;
bottom: 0;
- left: var(--indicator-left);
- width: var(--indicator-width);
+ left: 0;
+ width: 1px;
height: 2px;
background-color: var(--mantine-primary-color-filled);
- transition:
- left 200ms ease,
- width 200ms ease;
+ /* Transform so it stays smooth while the page is busy. */
+ transform: translate(var(--indicator-left), var(--indicator-bottom)) scaleX(var(--indicator-width));
+ transform-origin: left;
+ transition: transform 200ms ease;
}
.vp-doc .plugin-tabs .plugin-tabs--tab-list[data-indicator] .plugin-tabs--tab[aria-selected='true']::after,
@@ -480,11 +482,35 @@
}
}
+@media print {
+ .vp-doc .plugin-tabs .plugin-tabs--tab-list[data-indicator]::after {
+ display: none;
+ }
+}
+
+.vp-doc .plugin-tabs .plugin-tabs--tab-list[data-wrap] {
+ flex-wrap: wrap;
+}
+
+.vp-doc .plugin-tabs .plugin-tabs--tab-list[data-wrap] .plugin-tabs--tab {
+ flex-grow: 1;
+}
+
.vp-doc .vp-code-group .tabs {
padding: 0;
box-shadow: inset 0 -2px var(--tab-border-color);
}
+.vp-doc .plugin-tabs--content .vp-code-group .tabs {
+ margin-inline: 0;
+ border-radius: 8px 8px 0 0;
+}
+
+.vp-doc .plugin-tabs--content .vp-code-group div[class*='language-'] {
+ margin-inline: 0;
+ border-radius: 8px;
+}
+
.vp-doc .vp-code-group .tabs label {
color: var(--vp-code-tab-text-color);
}
@@ -527,6 +553,7 @@
flex-wrap: wrap;
align-items: center;
column-gap: var(--mantine-spacing-xs);
+ overflow-wrap: anywhere;
}
.vp-doc :is(h1, h2, h3, h4, h5, h6) > .VPBadge {
diff --git a/.vitepress/theme/details-toggle.ts b/.vitepress/theme/details-toggle.ts
index 8ff3b8d..1935d4b 100644
--- a/.vitepress/theme/details-toggle.ts
+++ b/.vitepress/theme/details-toggle.ts
@@ -12,39 +12,45 @@ const groupDetails = (group: string) => [
const labelFor = (group: string) => (groupDetails(group).every(isOpen) ? 'Collapse all' : 'Expand all');
-function animateTo(details: HTMLDetailsElement, open: boolean): void {
- if (isOpen(details) === open && !animations.has(details)) return;
+function animateTo(blocks: HTMLDetailsElement[], open: boolean): void {
+ blocks = blocks.filter((details) => isOpen(details) !== open);
- // Measure first so reversing mid-animation doesn't jump.
- const from = details.getBoundingClientRect().height;
- animations.get(details)?.cancel();
- animations.delete(details);
- details.classList.remove('details-closing');
+ const from = blocks.map((details) => details.getBoundingClientRect().height);
+ for (const details of blocks) {
+ animations.get(details)?.cancel();
+ animations.delete(details);
+ details.classList.remove('details-closing');
+ }
if (matchMedia('(prefers-reduced-motion: reduce)').matches) {
- details.open = open;
+ for (const details of blocks) details.open = open;
return;
}
- let to: number;
- if (open) {
- details.open = true;
- to = details.getBoundingClientRect().height;
- } else {
- details.classList.add('details-closing');
- const summary = details.querySelector(':scope > summary');
- to = (summary?.offsetHeight ?? 0) + details.offsetHeight - details.clientHeight;
+ for (const details of blocks) {
+ if (open) details.open = true;
+ else details.classList.add('details-closing');
}
+ const to = blocks.map((details) => {
+ if (open) return details.getBoundingClientRect().height;
+ const summary = details.querySelector(':scope > summary');
+ return (summary?.offsetHeight ?? 0) + details.offsetHeight - details.clientHeight;
+ });
- const animation = details.animate({ height: [`${from}px`, `${to}px`] }, { duration: DURATION, easing: 'ease' });
- animations.set(details, animation);
- animation.onfinish = () => {
- animations.delete(details);
- if (!open) {
- details.classList.remove('details-closing');
- details.open = false;
- }
- };
+ blocks.forEach((details, i) => {
+ const animation = details.animate(
+ { height: [`${from[i]}px`, `${to[i]}px`] },
+ { duration: DURATION, easing: 'ease' },
+ );
+ animations.set(details, animation);
+ animation.onfinish = () => {
+ animations.delete(details);
+ if (!open) {
+ details.classList.remove('details-closing');
+ details.open = false;
+ }
+ };
+ });
}
export function setupDetailsToggle(): void {
@@ -55,7 +61,7 @@ export function setupDetailsToggle(): void {
const group = button?.dataset.detailsToggle;
if (button && group !== undefined) {
const open = !groupDetails(group).every(isOpen);
- for (const details of groupDetails(group)) animateTo(details, open);
+ animateTo(groupDetails(group), open);
button.textContent = open ? 'Collapse all' : 'Expand all';
return;
}
@@ -64,9 +70,10 @@ export function setupDetailsToggle(): void {
const details = summary?.parentElement;
if (!(details instanceof HTMLDetailsElement) || !details.matches(BLOCKS)) return;
if (summary !== details.querySelector(':scope > summary')) return;
+ if (target?.closest('a, button, input, select, textarea')?.closest('summary') === summary) return;
event.preventDefault();
- animateTo(details, !isOpen(details));
+ animateTo([details], !isOpen(details));
});
// `toggle` doesn't bubble.
diff --git a/.vitepress/theme/index.ts b/.vitepress/theme/index.ts
index 3c97afa..f568bb8 100644
--- a/.vitepress/theme/index.ts
+++ b/.vitepress/theme/index.ts
@@ -13,7 +13,7 @@ import ImageViewer from '../components/ImageViewer.vue';
import { AnchorHandler } from './anchors.ts';
import { createAppearanceToggle } from './appearance.ts';
import { setupDetailsToggle } from './details-toggle.ts';
-import { setupPageTransition } from './page-transition.ts';
+import { setupPageTransition, useFirstLoadFade } from './page-transition.ts';
import { setupSearchClose } from './search.ts';
import { setupTabIndicator } from './tabs.ts';
import { registerWebMcpTools } from './webmcp.ts';
@@ -31,6 +31,9 @@ export default {
'sidebar-nav-after': () => h(CompareSidebarLinks),
});
},
+ setup() {
+ useFirstLoadFade();
+ },
enhanceApp({ app, router }) {
enhanceAppWithTabs(app);
app.use(createHead());
diff --git a/.vitepress/theme/page-transition.ts b/.vitepress/theme/page-transition.ts
index d3fd6c6..8b6456e 100644
--- a/.vitepress/theme/page-transition.ts
+++ b/.vitepress/theme/page-transition.ts
@@ -1,25 +1,61 @@
import type { Router } from 'vitepress';
+import { nextTick, onMounted } from 'vue';
const clean = (path: string) => path.replace(/(\/index)?\.html$/, '').replace(/\/$/, '');
+const reduced = () => matchMedia('(prefers-reduced-motion: reduce)').matches;
+const root = () => document.documentElement.classList;
-// Fades content in on page changes. The hook also fires for same-page #links.
+// Opacity only, a transform on something this tall stutters.
+const fadeIn = () =>
+ document.querySelector('.VPContent')?.animate({ opacity: [0, 1] }, { duration: 200, easing: 'ease' });
+
+const onScreen = (element: Element) => {
+ const rect = element.getBoundingClientRect();
+ return rect.width > 0 && rect.bottom > 0 && rect.top < innerHeight;
+};
+
+const smoothFrame = () =>
+ new Promise((resolve) => {
+ let start = 0;
+ let last = 0;
+ const tick = (now: number) => {
+ start ||= now;
+ if ((last && now - last < 50) || now - start > 300) return resolve();
+ last = now;
+ requestAnimationFrame(tick);
+ };
+ requestAnimationFrame(tick);
+ });
+
+export function useFirstLoadFade(): void {
+ onMounted(async () => {
+ const content = document.querySelector('.VPContent');
+ const images = [...(content?.querySelectorAll('img') ?? [])].filter(onScreen);
+ await Promise.race([
+ Promise.allSettled(images.map((image) => image.decode())),
+ new Promise((resolve) => setTimeout(resolve, 500)),
+ ]);
+ await smoothFrame();
+ if (root().contains('content-ready')) return;
+
+ const hidden = content && getComputedStyle(content).opacity === '0';
+ root().add('content-ready');
+ if (hidden && !reduced()) fadeIn();
+ });
+}
+
+// The hook also fires for same-page #links.
export function setupPageTransition(router: Router): void {
let current = clean(location.pathname);
- router.onAfterRouteChange = (to) => {
+ router.onAfterRouteChange = async (to) => {
const path = clean(new URL(to, location.origin).pathname);
if (path === current) return;
current = path;
- if (matchMedia('(prefers-reduced-motion: reduce)').matches) return;
-
- requestAnimationFrame(() => {
- document.querySelector('.VPContent .vp-doc')?.animate(
- [
- { opacity: 0, transform: 'translateY(6px)' },
- { opacity: 1, transform: 'none' },
- ],
- { duration: 200, easing: 'ease' },
- );
- });
+ root().add('content-ready');
+ if (reduced()) return;
+
+ await nextTick();
+ fadeIn();
};
}
diff --git a/.vitepress/theme/search.ts b/.vitepress/theme/search.ts
index dc27bfa..cf14c7e 100644
--- a/.vitepress/theme/search.ts
+++ b/.vitepress/theme/search.ts
@@ -14,9 +14,9 @@ export function setupSearchClose(): void {
node.inert = true;
node.classList.add('closing');
document.body.append(node);
- void Promise.allSettled(node.getAnimations({ subtree: true }).map((animation) => animation.finished)).then(() =>
- node.remove(),
- );
+ // Not the whole subtree, the loading spinner never finishes.
+ const fades = [...node.children].flatMap((child) => child.getAnimations());
+ void Promise.allSettled(fades.map((animation) => animation.finished)).then(() => node.remove());
}
}
}).observe(document.body, { childList: true });
diff --git a/.vitepress/theme/style.css b/.vitepress/theme/style.css
index d36e8f7..f662a5e 100644
--- a/.vitepress/theme/style.css
+++ b/.vitepress/theme/style.css
@@ -145,8 +145,15 @@ body * {
border-color: var(--mantine-primary-color-filled);
}
+/* Hidden until theme/page-transition.ts fades it in. */
+@media (scripting: enabled) and (prefers-reduced-motion: no-preference) {
+ html:not(.content-ready) .VPContent {
+ animation: fade-in 200ms ease 2s both;
+ }
+}
+
.VPLocalSearchBox > .backdrop {
- animation: search-fade-in 200ms ease;
+ animation: fade-in 200ms ease;
}
.VPLocalSearchBox > .shell {
@@ -158,20 +165,20 @@ body * {
}
.VPLocalSearchBox.closing > .backdrop {
- animation: search-fade-out 200ms ease forwards;
+ animation: fade-out 200ms ease forwards;
}
.VPLocalSearchBox.closing > .shell {
animation: search-out 200ms ease forwards;
}
-@keyframes search-fade-in {
+@keyframes fade-in {
from {
opacity: 0;
}
}
-@keyframes search-fade-out {
+@keyframes fade-out {
to {
opacity: 0;
}
@@ -200,6 +207,10 @@ body * {
}
}
+.vp-doc {
+ overflow-wrap: break-word;
+}
+
.label .nodeLabel {
color: #37373b !important;
}
diff --git a/.vitepress/theme/tabs.ts b/.vitepress/theme/tabs.ts
index 24024fd..c095d3a 100644
--- a/.vitepress/theme/tabs.ts
+++ b/.vitepress/theme/tabs.ts
@@ -4,15 +4,28 @@ const LISTS = '.vp-doc .plugin-tabs--tab-list, .vp-doc .vp-code-group .tabs';
const observed = new Set();
let frame = 0;
-function place(list: HTMLElement): void {
+type Spot = [list: HTMLElement, left: number, bottom: number, width: number];
+
+function measure(list: HTMLElement): Spot | undefined {
const tab = list.querySelector(':scope > [aria-selected="true"], :scope > input:checked + label');
if (!tab || list.offsetParent === null) return;
+ return [list, tab.offsetLeft, tab.offsetTop + tab.offsetHeight - list.clientHeight, tab.offsetWidth];
+}
- list.style.setProperty('--indicator-left', `${tab.offsetLeft}px`);
- list.style.setProperty('--indicator-width', `${tab.offsetWidth}px`);
+function place([list, left, bottom, width]: Spot): void {
+ list.style.setProperty('--indicator-left', `${left}px`);
+ list.style.setProperty('--indicator-bottom', `${bottom}px`);
+ list.style.setProperty('--indicator-width', `${width}`);
list.setAttribute('data-indicator', '');
}
+function fitRows(lists: HTMLElement[]): void {
+ const rows = lists.filter((list) => list.matches('.plugin-tabs--tab-list'));
+ for (const row of rows) row.removeAttribute('data-wrap');
+ const tooWide = rows.filter((row) => row.scrollWidth > row.clientWidth + 1);
+ for (const row of tooWide) row.setAttribute('data-wrap', '');
+}
+
function update(resize: ResizeObserver): void {
cancelAnimationFrame(frame);
frame = requestAnimationFrame(() => {
@@ -22,14 +35,16 @@ function update(resize: ResizeObserver): void {
for (const element of [list, ...list.children]) resize.unobserve(element);
}
- for (const list of document.querySelectorAll(LISTS)) {
- if (!observed.has(list)) {
- observed.add(list);
- // Full-width rows don't resize when fonts load, their tabs do.
- for (const element of [list, ...list.children]) resize.observe(element);
- }
- place(list);
+ const lists = [...document.querySelectorAll(LISTS)];
+ for (const list of lists) {
+ if (observed.has(list)) continue;
+ observed.add(list);
+ // Full-width rows don't resize when fonts load, their tabs do.
+ for (const element of [list, ...list.children]) resize.observe(element);
}
+
+ fitRows(lists);
+ for (const spot of lists.map(measure)) if (spot) place(spot);
});
}
diff --git a/web/docs/about/benchmarks.md b/web/docs/about/benchmarks.md
index af9112b..29fd1e5 100644
--- a/web/docs/about/benchmarks.md
+++ b/web/docs/about/benchmarks.md
@@ -633,5 +633,19 @@ Raw numbers are only part of the picture. For feature-by-feature breakdowns agai
.env-spec {
grid-column: 1 / -1;
}
+ .env-detail {
+ display: grid;
+ grid-template-columns: 10px minmax(0, 1fr) auto auto;
+ column-gap: 0.5rem;
+ }
+ .env-stat-row {
+ grid-column: 1 / -1;
+ grid-template-columns: subgrid;
+ }
+ .env-stat-name {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
}