chore(docs|site): Vitepress 2 upgrade (#5164)

* chore(docs): upgrade to VitePress 2

- Bump vitepress to 2.0.0-alpha.21
- Drop direct @docsearch/js and @docsearch/css deps; VitePress 2 ships
  DocSearch v4 and imports its styles itself
- VPNavBarSearch override: use the new VPAlgoliaSearchBox props
  (algoliaOptions + openRequest) instead of dispatching synthetic
  keydown events
- VPCarbonAds override: replace removed useAside composable with a
  media query, matching upstream
- VPFooter override: use useLayout from vitepress/theme instead of the
  removed useSidebar().hasSidebar

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G9u8FhZukDbCKe1ZFByn43

* Fix types and imports

* Fix ts imports

* fix styling

* Update mediaqueries

* chore(docs): remove unused theme overrides

VitePress 2 has no VPIconAlignLeft.vue for the alias to replace (the
local nav uses the vpi-text-align-start icon class), and the Hero and
HeroMatrix overrides aren't imported anywhere.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(docs): use rem media queries in MCP and waitlist styles

Matches the rest of the theme and VitePress 2, which switched its
breakpoints to rem.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(docs): don't fail the build when GitHub's release API drops

The home hero's data loader let a network error from the GitHub
releases API escape, which failed the whole docs build in CI
("fetch failed: other side closed"). Retry once, then fall back to
null and hide the version badge instead of rendering "vundefined".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Add sentry

---------

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Eric Fennis
2026-11-24 18:00:43 +01:00
committed by GitHub
co-authored by Claude Opus 5.5
parent f6358a4161
commit 7981a0798a
63 changed files with 481 additions and 1358 deletions
+7 -13
View File
@@ -1,15 +1,15 @@
import { fileURLToPath, URL } from 'node:url';
import { defineConfig, UserConfig } from 'vitepress';
import { groupIconMdPlugin, groupIconVitePlugin } from 'vitepress-plugin-group-icons';
import sidebar from './sidebar';
import snackPlayer from './markdown/snackPlayer';
import sandpackPlugin from './markdown/sandpack';
import examplePlugin from './markdown/example';
import sidebar from './sidebar/index.ts';
import snackPlayer from './markdown/snackPlayer.ts';
import sandpackPlugin from './markdown/sandpack.ts';
import examplePlugin from './markdown/example.ts';
import { readFile } from 'node:fs/promises';
import { resourcesSidebar } from './sidebar/resources';
import { resourcesSidebar } from './sidebar/resources.ts';
import llmstxt from 'vitepress-plugin-llms';
import { transformPageData } from './transformPageData';
import getHeadConfig from './getHeadConfig';
import { transformPageData } from './transformPageData.ts';
import getHeadConfig from './getHeadConfig.ts';
const defaultSandpackCSS = await readFile(
fileURLToPath(new URL('./theme/sandpack-default.css', import.meta.url)),
@@ -56,12 +56,6 @@ export default defineConfig({
},
resolve: {
alias: [
{
find: /^.*\/VPIconAlignLeft\.vue$/,
replacement: fileURLToPath(
new URL('./theme/components/overrides/VPIconAlignLeft.vue', import.meta.url),
),
},
{
find: /^.*\/VPFooter\.vue$/,
replacement: fileURLToPath(
+1 -1
View File
@@ -1,6 +1,6 @@
import fs from 'fs';
import path from 'path';
import { Category, IconEntity } from '../theme/types';
import type { Category, IconEntity } from '../theme/types.ts';
const directory = path.join(process.cwd(), '../categories');
@@ -1,4 +1,4 @@
import { highLightCode } from './createCodeExamples';
import { highLightCode } from './createCodeExamples.ts';
type CodeExampleType = {
title: string;
+1 -1
View File
@@ -1,6 +1,6 @@
import { promises as fs, constants } from 'fs';
import path from 'path';
import { PackageItem } from '../theme/types';
import { type PackageItem } from '../theme/types.ts';
const fileExist = (filePath) =>
fs
+1 -1
View File
@@ -1,6 +1,6 @@
import { readFileSync } from 'node:fs';
import { dirname, isAbsolute, resolve } from 'node:path';
import type { MarkdownIt, RenderRule } from './types';
import type { MarkdownIt, RenderRule } from './types.ts';
import container from 'markdown-it-container';
type ContainerArgs = [typeof container, string, { render: RenderRule }];
+2 -2
View File
@@ -1,6 +1,6 @@
import type { MarkdownIt, RenderRule, Token } from './types';
import type { MarkdownIt, RenderRule, Token } from './types.ts';
import container from 'markdown-it-container';
import sandpackTheme from '../theme/sandpackTheme.json';
import sandpackTheme from '../theme/sandpackTheme.json' with { type: 'json' };
type SnackParams = {
defaultFiles?: Record<
+1 -1
View File
@@ -16,7 +16,7 @@
* />
*/
import type { MarkdownIt } from './types';
import type { MarkdownIt } from './types.ts';
type SnackParams = Record<string, string>;
+11 -11
View File
@@ -1,15 +1,15 @@
import { DefaultTheme, UserConfig } from 'vitepress';
import { reactSidebar } from './react';
import { vueSidebar } from './vue';
import { svelteSidebar } from './svelte';
import { lucideSidebar } from './lucide';
import { solidSidebar } from './solid';
import { preactSidebar } from './preact';
import { reactNativeSidebar } from './react-native';
import { astroSidebar } from './astro';
import { resourcesSidebar } from './resources';
import { angularSidebar } from './angular';
import { lucideStaticSidebar } from './static';
import { reactSidebar } from './react.ts';
import { vueSidebar } from './vue.ts';
import { svelteSidebar } from './svelte.ts';
import { lucideSidebar } from './lucide.ts';
import { solidSidebar } from './solid.ts';
import { preactSidebar } from './preact.ts';
import { reactNativeSidebar } from './react-native.ts';
import { astroSidebar } from './astro.ts';
import { resourcesSidebar } from './resources.ts';
import { angularSidebar } from './angular.ts';
import { lucideStaticSidebar } from './static.ts';
type Sidebar = UserConfig<DefaultTheme.Config>['themeConfig']['sidebar'];
@@ -161,7 +161,10 @@ ul.menu-items {
.arrow-up-button::before {
content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%0A%3E%3Cpolyline points='18 15 12 9 6 15' /%3E%3C/svg%3E%0A");
width: 20px;
height: 28px;
height: 20px;
/* line-height 0 keeps the chevron image at the top of this box, so the button's flex centering
centers it; it used to rely on VitePress 1's 38px button line-height instead */
line-height: 0;
margin: auto;
display: block;
}
@@ -21,13 +21,13 @@
padding: 8px;
}
@media (min-width: 960px) {
@media (min-width: 60rem) {
.card-grid-flex > * {
flex-basis: 50%;
}
}
@media (min-width: 1280px) {
@media (min-width: 80rem) {
.card-grid-flex > * {
flex-basis: 33.33%;
}
@@ -75,6 +75,7 @@ const model = computed({
appearance: none;
width: 16px;
height: 16px;
margin: 3px 3px 3px 4px;
cursor: pointer;
border: 1px solid var(--vp-input-border-color);
background-color: var(--vp-input-switch-bg-color);
@@ -29,7 +29,7 @@ import RocketDuotoneIcon from '../home/RocketDuotoneIcon.ts';
</template>
<style>
@media (min-width: 960px) {
@media (min-width: 60rem) {
:root {
--vp-layout-top-height: 32px;
}
@@ -16,13 +16,13 @@
padding: 8px;
}
@media (min-width: 960px) {
@media (min-width: 60rem) {
.overview-link-grid {
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
}
@media (min-width: 1280px) {
@media (min-width: 80rem) {
.overview-link-grid {
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
@@ -52,7 +52,7 @@
border-bottom: 2px solid var(--vp-c-brand);
}
@media (min-width: 860px) {
@media (min-width: 53.75rem) {
.tab-list {
justify-content: flex-start;
}
@@ -62,12 +62,12 @@
}
}
@media (min-width: 960px) {
@media (min-width: 60rem) {
.tab {
}
}
@media (min-width: 1152px) {
@media (min-width: 72rem) {
.tab {
}
}
@@ -246,7 +246,7 @@ const selected = defineModel<{ name: string; value: string; icon?: string; iconD
width: 1.25rem;
}
@media (min-width: 640px) {
@media (min-width: 40rem) {
.select-button,
.select-options {
font-size: 0.875rem;
@@ -11,21 +11,21 @@
margin-block: 24px;
}
@media (min-width: 640px) {
@media (min-width: 40rem) {
.home-container {
padding-inline: 48px;
margin-block: 48px;
}
}
@media (min-width: 960px) {
@media (min-width: 60rem) {
.home-container {
padding-inline: 64px;
margin-block: 64px;
}
}
@media (min-width: 1280px) {
@media (min-width: 80rem) {
.home-container {
margin: 64px auto;
max-width: 1152px;
@@ -443,7 +443,7 @@ const initial = <T,>(value: T) => (reducedMotion.value ? false : value);
margin-left: calc(((396px - 100vw) / 2) * -1);
}
@media (min-width: 396px) {
@media (min-width: 24.75rem) {
.home-hero-animation {
margin-left: auto;
}
@@ -461,7 +461,7 @@ const initial = <T,>(value: T) => (reducedMotion.value ? false : value);
pointer-events: none;
}
@media (min-width: 640px) {
@media (min-width: 40rem) {
.hero-background {
width: 680px;
height: 680px;
@@ -476,7 +476,7 @@ const initial = <T,>(value: T) => (reducedMotion.value ? false : value);
}
}
@media (min-width: 768px) {
@media (min-width: 48rem) {
.hero-background {
width: 760px;
height: 760px;
@@ -495,7 +495,7 @@ const initial = <T,>(value: T) => (reducedMotion.value ? false : value);
}
}
@media (min-width: 960px) {
@media (min-width: 60rem) {
.hero-background {
top: -20vw;
right: 20vw;
@@ -513,7 +513,7 @@ const initial = <T,>(value: T) => (reducedMotion.value ? false : value);
}
}
@media (min-width: 1160px) {
@media (min-width: 72.5rem) {
.home-hero-animation-container {
margin-right: -64px;
margin-bottom: -180px;
@@ -530,7 +530,7 @@ const initial = <T,>(value: T) => (reducedMotion.value ? false : value);
}
}
@media (min-width: 1280px) {
@media (min-width: 80rem) {
.home-hero-animation-container {
margin-right: -420px;
margin-top: -64px;
@@ -1,4 +1,4 @@
import iconNodes from '../../../data/iconNodes';
import iconNodes from '../../../data/iconNodes/index.ts';
const pickIcons = [
'bot',
@@ -1,18 +1,32 @@
const LATEST_RELEASE_API = 'https://api.github.com/repos/lucide-icons/lucide/releases/latest';
/**
* Tag of the latest GitHub release, or `null` when GitHub can't be reached, so a dropped
* connection hides the version badge instead of failing the whole docs build.
*/
async function fetchLatestVersion(attempts = 2): Promise<string | null> {
for (let attempt = 1; attempt <= attempts; attempt++) {
try {
const response = await fetch(LATEST_RELEASE_API);
if (!response.ok) return null;
const { tag_name } = (await response.json()) as { tag_name: string };
return tag_name ?? null;
} catch (error) {
if (attempt === attempts) {
console.warn(`Could not fetch the latest Lucide release. ${error}`);
}
}
}
return null;
}
const loader = {
async load() {
const version = await fetch('https://api.github.com/repos/lucide-icons/lucide/releases/latest')
.then((res) => {
if (res.ok) {
const releaseData = res.json() as Promise<{ tag_name: string }>;
return releaseData;
}
return null;
})
.then((res) => res?.tag_name);
return {
version,
version: await fetchLatestVersion(),
};
},
};
@@ -7,7 +7,10 @@ import RocketDuotoneIcon from './RocketDuotoneIcon.ts';
</script>
<template>
<div class="info">
<div
v-if="data.version"
class="info"
>
<Badge :href="`https://github.com/lucide-icons/lucide/releases/tag/${data.version}`">
v{{ data.version }}
</Badge>
@@ -22,7 +25,7 @@ import RocketDuotoneIcon from './RocketDuotoneIcon.ts';
justify-content: center;
}
@media (min-width: 960px) {
@media (min-width: 60rem) {
.info {
justify-content: flex-start;
}
@@ -155,14 +155,14 @@ const iconStyle = computed(() => ({
background: none;
}
@media (min-width: 640px) {
@media (min-width: 40rem) {
.card {
display: grid;
grid-template-columns: 8fr 10fr;
}
}
@media (min-width: 960px) {
@media (min-width: 60rem) {
.card {
grid-template-columns: 1fr 2fr;
}
@@ -62,7 +62,7 @@ const onIntersectionObserver: IntersectionObserverCallback = ([{ isIntersecting
background: var(--vp-c-bg);
}
@media (min-width: 640px) {
@media (min-width: 40rem) {
.icon-grid {
top: 0;
right: -48px;
@@ -50,7 +50,7 @@ html:not(.dark) .logo.light {
display: none;
}
@media (min-width: 640px) {
@media (min-width: 40rem) {
.sponsor-card {
flex-direction: row;
justify-content: space-between;
@@ -39,13 +39,13 @@ const { theme } = useData()
margin-bottom: 48px;
}
@media (min-width: 640px) {
@media (min-width: 40rem) {
.team-members :deep(.card-grid > *) {
flex-basis: 50%;
}
}
@media (min-width: 768px) {
@media (min-width: 48rem) {
.team-members :deep(.card-grid > *) {
flex-basis: 33.33%;
}
@@ -61,7 +61,7 @@ const { theme } = useData()
display: none;
}
@media (min-width: 960px) {
@media (min-width: 60rem) {
.ad-card {
display: block;
}
@@ -88,13 +88,13 @@ onMounted(() => {
transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}
@media (min-width: 1280px) {
@media (min-width: 80rem) {
.floating-ad {
display: block;
}
}
@media (min-width: 1440px) {
@media (min-width: 90rem) {
.floating-ad {
right: calc(((100% - (var(--vp-layout-max-width) - var(--vp-sidebar-width))) - 272px) / 2);
}
@@ -1,5 +1,5 @@
import { getAllCategoryFiles, mapCategoryIconCount } from '../../../lib/categories';
import iconsMetaData from '../../../data/iconMetaData';
import { getAllCategoryFiles, mapCategoryIconCount } from '../../../lib/categories.ts';
import iconsMetaData from '../../../data/iconMetaData.ts';
const loader = {
async load() {
@@ -17,11 +17,11 @@ function onCategoriesClick() {
}
const categoriesIsActive = computed(() => {
return isActive(page.value.relativePath, '/icons/categories');
return isActive(page.value.relativePath, '', '/icons/categories');
});
const overviewIsActive = computed(() => {
return isActive(page.value.relativePath, '/icons/');
return isActive(page.value.relativePath, '', '/icons/');
});
const headers = computed(() => {
@@ -77,6 +77,7 @@ const props = defineProps<{
transform: translateX(-50%) scale(1);
}
.avatar-image {
margin: 0;
width: 48px;
height: 48px;
border-radius: 50%;
@@ -135,13 +135,13 @@ const Expand = createLucideIcon('Expand', expand);
width: auto;
}
@media (min-width: 960px) {
@media (min-width: 60rem) {
.overlay-container {
--left: var(--vp-sidebar-width);
}
}
@media (min-width: 1440px) {
@media (min-width: 90rem) {
.overlay-container {
--left: calc((100% - (var(--vp-layout-max-width) - 64px)) / 2 + var(--vp-sidebar-width) - 32px);
--right: calc(((100% - (var(--vp-layout-max-width) - var(--vp-sidebar-width))) - 272px) / 2);
@@ -28,7 +28,7 @@ const props = defineProps<{
const emit = defineEmits(['setActiveIcon']);
const { go } = useRouter();
const showOverlay = useMediaQuery('(min-width: 860px)');
const showOverlay = useMediaQuery('(min-width: 53.75rem)');
const { animate, confetti, confettiText } = useConfetti();
const icon = computed(() => {
@@ -156,6 +156,7 @@ const gridLines = computed(() => Array.from({ length: size.value - 1 }));
.size-button {
color: var(--vp-code-tab-text-color);
padding: 2px 8px;
font-size: 13px;
}
.size-button.active {
@@ -263,6 +263,7 @@ const prettyName = props.name
display: flex;
flex-direction: row;
gap: 12px;
font-size: 13px;
font-weight: 500;
transition:
color 0.25s,
@@ -334,6 +335,7 @@ const prettyName = props.name
input {
padding: 12px 20px;
padding-inline-start: 48px;
font-size: 13px;
border-radius: 8px;
background-color: var(--vp-c-bg-soft);
color: var(--vp-c-text-1);
@@ -177,6 +177,8 @@ onBeforeUnmount(() => {
}
.shortcuts-dialog {
/* VitePress 2's reset zeroes the margin that centres a modal dialog */
margin: auto;
width: min(480px, calc(100vw - 32px));
padding: 20px 24px 24px;
color: var(--vp-c-text-1);
@@ -51,7 +51,7 @@
display: none;
}
@media (min-width: 640px) {
@media (min-width: 40rem) {
.search-bar :deep(.select-button) {
padding: 11px 16px 11px 16px;
}
@@ -94,7 +94,7 @@
display: none;
}
@media (min-width: 640px) {
@media (min-width: 40rem) {
.search-bar :deep(.select-button) {
padding: 11px 16px 11px 16px;
}
@@ -105,7 +105,7 @@
}
@media (min-width: 960px) {
@media (min-width: 60rem) {
.search-bar {
padding-top: 32px;
margin-top: calc((var(--vp-layout-top-height, 0px) + 33px) * -1);
@@ -1,379 +0,0 @@
<script setup lang="ts">
import VPHero from 'vitepress/dist/client/theme-default/components/VPHero.vue'
import { useData } from 'vitepress/dist/client/theme-default/composables/data.js'
import FakeInput from '../base/FakeInput.vue';
import { useRouter } from 'vitepress';
import { data } from '../home/HomeHeroIconsCard.data'
import { useScroll } from '@vueuse/core';
import { computed } from 'vue';
const { go } = useRouter()
const { frontmatter: fm } = useData()
const { x, y, isScrolling, arrivedState, directions } = useScroll(window)
const opacity = computed(() => {
if (y.value < 0) return 1
if (y.value > 300) return 0
return 1 - (y.value / 300)
})
</script>
<template>
<VPHero v-if="fm.hero" class="VPHomeHero" :name="fm.hero.name" :text="fm.hero.text" :tagline="fm.hero.tagline"
:image="undefined" :actions="fm.hero.actions">
<template #home-hero-image></template>
<template #home-hero-actions-after>
<FakeInput @click="go('/icons/?focus')" class="search-box">
Search {{ data.iconsCount }} icons...
</FakeInput>
</template>
</VPHero>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-12 -12 48 48" fill="none" overflow="auto"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="hero-background" :style="{ opacity: opacity }">
<g class="svg-preview-grid-group" stroke-linecap="butt" stroke-width="0.1" stroke="#777"
stroke-opacity="0.3">
<!-- <rect class="svg-preview-grid-rect" width="23.9" height="23.9" x="0.05" y="0.05" rx="1"></rect> -->
<path
stroke-dasharray="0 0.1 0.1 0.15 0.1 0.15 0.1 0.15 0.1 0.15 0.1 0.15 0.1 0.15 0.1 0.15 0.1 0.15 0.1 0.15 0.1 0.15 0.1 0.15 0 0.15"
stroke-width="0.1"
d="M1 0.1v23.8M2 0.1v23.8M4 0.1v23.8M5 0.1v23.8M7 0.1v23.8M8 0.1v23.8M10 0.1v23.8M11 0.1v23.8M13 0.1v23.8M14 0.1v23.8M16 0.1v23.8M17 0.1v23.8M19 0.1v23.8M20 0.1v23.8M22 0.1v23.8M23 0.1v23.8M0.1 1h23.8M0.1 2h23.8M0.1 4h23.8M0.1 5h23.8M0.1 7h23.8M0.1 8h23.8M0.1 10h23.8M0.1 11h23.8M0.1 13h23.8M0.1 14h23.8M0.1 16h23.8M0.1 17h23.8M0.1 19h23.8M0.1 20h23.8M0.1 22h23.8M0.1 23h23.8">
</path>
<path
d="M3 0.1v23.8M6 0.1v23.8M9 0.1v23.8M12 0.1v23.8M15 0.1v23.8M18 0.1v23.8M21 0.1v23.8M0.1 3h23.8M0.1 6h23.8M0.1 9h23.8M0.1 12h23.8M0.1 15h23.8M0.1 18h23.8M0.1 21h23.8">
</path>
</g>
<g class="svg-preview-shadow-mask-group" stroke-width="4" stroke="#777" stroke-opacity="0.15">
<mask id="svg-preview-shadow-mask-0" maskUnits="userSpaceOnUse" stroke-opacity="1" stroke-width="4" stroke="#000">
<rect x="0" y="0" width="100%" height="100%" fill="#fff" stroke="none" rx="1"></rect>
<path d="M4.9 16.1h.01M4.9 1.9h.01"></path>
</mask>
<mask id="svg-preview-shadow-mask-1" maskUnits="userSpaceOnUse" stroke-opacity="1" stroke-width="4" stroke="#000">
<rect x="0" y="0" width="100%" height="100%" fill="#fff" stroke="none" rx="1"></rect>
<path d="M7.8 4.7h.01M7 12.2h.01"></path>
</mask>
<mask id="svg-preview-shadow-mask-2" maskUnits="userSpaceOnUse" stroke-opacity="1" stroke-width="4" stroke="#000">
<rect x="0" y="0" width="100%" height="100%" fill="#fff" stroke="none" rx="1"></rect>
<path d="M12 7h.01M14 9h.01M12 11h.01M10 9h.01"></path>
</mask>
<mask id="svg-preview-shadow-mask-3" maskUnits="userSpaceOnUse" stroke-opacity="1" stroke-width="4" stroke="#000">
<rect x="0" y="0" width="100%" height="100%" fill="#fff" stroke="none" rx="1"></rect>
<path d="M16.2 4.8h.01M17 12.27h.01"></path>
</mask>
<mask id="svg-preview-shadow-mask-4" maskUnits="userSpaceOnUse" stroke-opacity="1" stroke-width="4" stroke="#000">
<rect x="0" y="0" width="100%" height="100%" fill="#fff" stroke="none" rx="1"></rect>
<path d="M19.1 1.9h.01M19.1 16h.01"></path>
</mask>
<mask id="svg-preview-shadow-mask-5" maskUnits="userSpaceOnUse" stroke-opacity="1" stroke-width="4" stroke="#000">
<rect x="0" y="0" width="100%" height="100%" fill="#fff" stroke="none" rx="1"></rect>
<path d="M9.5 18h.01M14.5 18h.01"></path>
</mask>
<mask id="svg-preview-shadow-mask-6" maskUnits="userSpaceOnUse" stroke-opacity="1" stroke-width="4" stroke="#000">
<rect x="0" y="0" width="100%" height="100%" fill="#fff" stroke="none" rx="1"></rect>
<path d="M8 22h.01M12 11h.01M16 22h.01"></path>
</mask>
</g>
<!-- <g class="svg-preview-shadow-group" stroke-width="4" stroke="#777" stroke-opacity="0.15">
<path mask="url(#svg-preview-shadow-mask-0)" d="M 4.9 16.1 C1 12.2 1 5.8 4.9 1.9"></path>
<path mask="url(#svg-preview-shadow-mask-1)" d="M 7.8 4.7 A6.14 6.14 0 0 0 7 12.2"></path>
<path mask="url(#svg-preview-shadow-mask-2)" d="M 12 7 A2 2 0 0 1 14 9"></path>
<path mask="url(#svg-preview-shadow-mask-2)" d="M 14 9 A2 2 0 0 1 12 11"></path>
<path mask="url(#svg-preview-shadow-mask-2)" d="M 12 11 A2 2 0 0 1 10 9"></path>
<path mask="url(#svg-preview-shadow-mask-2)" d="M 10 9 A2 2 0 0 1 12 7"></path>
<path mask="url(#svg-preview-shadow-mask-3)" d="M 16.2 4.8 C18.2 6.8 18.46 9.91 17 12.27"></path>
<path mask="url(#svg-preview-shadow-mask-4)" d="M 19.1 1.9 A9.96 9.96 0 0 1 19.1 16"></path>
<path mask="url(#svg-preview-shadow-mask-5)" d="M 9.5 18 L 14.5 18"></path>
<path mask="url(#svg-preview-shadow-mask-6)" d="M 8 22 L 12 11"></path>
<path mask="url(#svg-preview-shadow-mask-6)" d="M 12 11 L 16 22"></path>
<path
d="M4.9 16.1h.01M4.9 1.9h.01M7.8 4.7h.01M7 12.2h.01M12 7h.01M14 9h.01M12 11h.01M10 9h.01M16.2 4.8h.01M17 12.27h.01M19.1 1.9h.01M19.1 16h.01M9.5 18h.01M14.5 18h.01M8 22h.01M16 22h.01">
</path>
</g> -->
<g>
<defs xmlns="http://www.w3.org/2000/svg">
<pattern id="backdrop-pattern-:R4:" width=".1" height=".1" patternUnits="userSpaceOnUse"
patternTransform="rotate(45 50 50)">
<line stroke="red" stroke-width="0.1" y2="1"></line>
<line stroke="red" stroke-width="0.1" y2="1"></line>
</pattern>
</defs>
<g stroke-width="4">
<mask id="svg-preview-backdrop-mask-:R4:-0" maskUnits="userSpaceOnUse">
<path stroke="white" d="M 4.9 16.1 C1 12.2 1 5.8 4.9 1.9"></path>
</mask>
<path d="M 7.8 4.7 A6.14 6.14 0 0 0 7 12.2" stroke="url(#backdrop-pattern-:R4:)" stroke-width="4"
stroke-opacity="0.75" mask="url(#svg-preview-backdrop-mask-:R4:-0)"></path>
</g>
<g stroke-width="4">
<mask id="svg-preview-backdrop-mask-:R4:-0" maskUnits="userSpaceOnUse">
<path stroke="white" d="M 4.9 16.1 C1 12.2 1 5.8 4.9 1.9"></path>
</mask>
<path
d="M 12 7 A2 2 0 0 1 14 9 M 14 9 A2 2 0 0 1 12 11 M 12 11 A2 2 0 0 1 10 9 M 10 9 A2 2 0 0 1 12 7 M 8 22 L 12 11 M 12 11 L 16 22 M 9.5 18 L 14.5 18"
stroke="url(#backdrop-pattern-:R4:)" stroke-width="4" stroke-opacity="0.75"
mask="url(#svg-preview-backdrop-mask-:R4:-0)"></path>
</g>
<g stroke-width="4">
<mask id="svg-preview-backdrop-mask-:R4:-1" maskUnits="userSpaceOnUse">
<path stroke="white" d="M 7.8 4.7 A6.14 6.14 0 0 0 7 12.2"></path>
</mask>
<path
d="M 12 7 A2 2 0 0 1 14 9 M 14 9 A2 2 0 0 1 12 11 M 12 11 A2 2 0 0 1 10 9 M 10 9 A2 2 0 0 1 12 7 M 8 22 L 12 11 M 12 11 L 16 22 M 9.5 18 L 14.5 18"
stroke="url(#backdrop-pattern-:R4:)" stroke-width="4" stroke-opacity="0.75"
mask="url(#svg-preview-backdrop-mask-:R4:-1)"></path>
</g>
<g stroke-width="4">
<mask id="svg-preview-backdrop-mask-:R4:-0" maskUnits="userSpaceOnUse">
<path stroke="white" d="M 4.9 16.1 C1 12.2 1 5.8 4.9 1.9"></path>
</mask>
<path d="M 16.2 4.8 C18.2 6.8 18.46 9.91 17 12.27" stroke="url(#backdrop-pattern-:R4:)" stroke-width="4"
stroke-opacity="0.75" mask="url(#svg-preview-backdrop-mask-:R4:-0)"></path>
</g>
<g stroke-width="4">
<mask id="svg-preview-backdrop-mask-:R4:-1" maskUnits="userSpaceOnUse">
<path stroke="white" d="M 7.8 4.7 A6.14 6.14 0 0 0 7 12.2"></path>
</mask>
<path d="M 16.2 4.8 C18.2 6.8 18.46 9.91 17 12.27" stroke="url(#backdrop-pattern-:R4:)" stroke-width="4"
stroke-opacity="0.75" mask="url(#svg-preview-backdrop-mask-:R4:-1)"></path>
</g>
<g stroke-width="4">
<mask id="svg-preview-backdrop-mask-:R4:-2" maskUnits="userSpaceOnUse">
<path stroke="white"
d="M 12 7 A2 2 0 0 1 14 9 M 14 9 A2 2 0 0 1 12 11 M 12 11 A2 2 0 0 1 10 9 M 10 9 A2 2 0 0 1 12 7 M 8 22 L 12 11 M 12 11 L 16 22 M 9.5 18 L 14.5 18">
</path>
</mask>
<path d="M 16.2 4.8 C18.2 6.8 18.46 9.91 17 12.27" stroke="url(#backdrop-pattern-:R4:)" stroke-width="4"
stroke-opacity="0.75" mask="url(#svg-preview-backdrop-mask-:R4:-2)"></path>
</g>
<g stroke-width="4">
<mask id="svg-preview-backdrop-mask-:R4:-0" maskUnits="userSpaceOnUse">
<path stroke="white" d="M 4.9 16.1 C1 12.2 1 5.8 4.9 1.9"></path>
</mask>
<path d="M 19.1 1.9 A9.96 9.96 0 0 1 19.1 16" stroke="url(#backdrop-pattern-:R4:)" stroke-width="4"
stroke-opacity="0.75" mask="url(#svg-preview-backdrop-mask-:R4:-0)"></path>
</g>
<g stroke-width="4">
<mask id="svg-preview-backdrop-mask-:R4:-1" maskUnits="userSpaceOnUse">
<path stroke="white" d="M 7.8 4.7 A6.14 6.14 0 0 0 7 12.2"></path>
</mask>
<path d="M 19.1 1.9 A9.96 9.96 0 0 1 19.1 16" stroke="url(#backdrop-pattern-:R4:)" stroke-width="4"
stroke-opacity="0.75" mask="url(#svg-preview-backdrop-mask-:R4:-1)"></path>
</g>
<g stroke-width="4">
<mask id="svg-preview-backdrop-mask-:R4:-2" maskUnits="userSpaceOnUse">
<path stroke="white"
d="M 12 7 A2 2 0 0 1 14 9 M 14 9 A2 2 0 0 1 12 11 M 12 11 A2 2 0 0 1 10 9 M 10 9 A2 2 0 0 1 12 7 M 8 22 L 12 11 M 12 11 L 16 22 M 9.5 18 L 14.5 18">
</path>
</mask>
<path d="M 19.1 1.9 A9.96 9.96 0 0 1 19.1 16" stroke="url(#backdrop-pattern-:R4:)" stroke-width="4"
stroke-opacity="0.75" mask="url(#svg-preview-backdrop-mask-:R4:-2)"></path>
</g>
<g stroke-width="4">
<mask id="svg-preview-backdrop-mask-:R4:-3" maskUnits="userSpaceOnUse">
<path stroke="white" d="M 16.2 4.8 C18.2 6.8 18.46 9.91 17 12.27"></path>
</mask>
<path d="M 19.1 1.9 A9.96 9.96 0 0 1 19.1 16" stroke="url(#backdrop-pattern-:R4:)" stroke-width="4"
stroke-opacity="0.75" mask="url(#svg-preview-backdrop-mask-:R4:-3)"></path>
</g>
</g>
<g class="svg-preview-handles-group" stroke-width="0.12" stroke="#777" stroke-opacity="0.6">
<path d="M4.9 16.1 1 12.2"></path>
<circle cy="12.2" cx="1" r="0.25"></circle>
<path d="M4.9 1.9 1 5.8"></path>
<circle cy="5.8" cx="1" r="0.25"></circle>
<path d="M16.2 4.8 18.2 6.8"></path>
<circle cy="6.8" cx="18.2" r="0.25"></circle>
<path d="M17 12.27 18.46 9.91"></path>
<circle cy="9.91" cx="18.46" r="0.25"></circle>
</g>
<g class="svg-preview-colored-path-group">
<path d="M 4.9 16.1 C1 12.2 1 5.8 4.9 1.9" stroke="##dfdfd6"></path>
<path d="M 7.8 4.7 A6.14 6.14 0 0 0 7 12.2" stroke="##dfdfd6"></path>
<path d="M 12 7 A2 2 0 0 1 14 9" stroke="##dfdfd6"></path>
<path d="M 14 9 A2 2 0 0 1 12 11" stroke="##dfdfd6"></path>
<path d="M 12 11 A2 2 0 0 1 10 9" stroke="##dfdfd6"></path>
<path d="M 10 9 A2 2 0 0 1 12 7" stroke="##dfdfd6"></path>
<path d="M 16.2 4.8 C18.2 6.8 18.46 9.91 17 12.27" stroke="##dfdfd6"></path>
<path d="M 19.1 1.9 A9.96 9.96 0 0 1 19.1 16" stroke="##dfdfd6"></path>
<path d="M 9.5 18 L 14.5 18" stroke="##dfdfd6"></path>
<path d="M 8 22 L 12 11" stroke="##dfdfd6"></path>
<path d="M 12 11 L 16 22" stroke="##dfdfd6"></path>
</g>
<g class="svg-preview-radii-group" stroke-width="0.12" stroke-dasharray="0 0.25 0.25" stroke="#777"
stroke-opacity="0.3">
<circle cx="9.518750780437157" cy="16.261333416579962" r="0.25"></circle>
<circle cx="11.118750780437157" cy="1.261333416579964" r="0.25"></circle>
<path
d="M9.518750780437157 16.261333416579962L4.481249219562843 8.138666583420036L11.118750780437157 1.261333416579964">
</path>
<circle cx="4.481249219562843" cy="8.138666583420036" r="0.25"></circle>
<path d="M7 12.2L12.217985863765243 8.963918492134958L7.8 4.7"></path>
<circle cy="8.963918492134958" cx="12.217985863765243" r="0.25" stroke-dasharray="0" stroke="red"></circle>
<circle cy="8.963918492134958" cx="12.217985863765243" r="6.14" stroke="red"></circle>
<circle cy="9" cx="12" r="0.25" stroke-dasharray="0"></circle>
<circle cy="9" cx="12" r="2"></circle>
<circle cy="9" cx="12" r="0.25" stroke-dasharray="0"></circle>
<circle cy="9" cx="12" r="2"></circle>
<circle cy="9" cx="12" r="0.25" stroke-dasharray="0"></circle>
<circle cy="9" cx="12" r="2"></circle>
<circle cy="9" cx="12" r="0.25" stroke-dasharray="0"></circle>
<circle cy="9" cx="12" r="2"></circle>
<circle cx="12.035530040810755" cy="23.05" r="0.25"></circle>
<circle cx="12.035530040810755" cy="-5.1499999999999995" r="0.25"></circle>
<path d="M12.035530040810755 23.05L26.164469959189248 8.95L12.035530040810755 -5.1499999999999995"></path>
<circle cx="26.164469959189248" cy="8.95" r="0.25"></circle>
<path d="M19.1 16L12.064440320770494 8.95L19.1 1.9"></path>
<circle cy="8.95" cx="12.064440320770494" r="0.25" stroke-dasharray="0" stroke="red"></circle>
<circle cy="8.95" cx="12.064440320770494" r="9.96" stroke="red"></circle>
</g>
<g class="svg-preview-control-path-marker-mask-group" stroke-width="1" stroke="#000">
<mask id="svg-preview-control-path-marker-mask-0" maskUnits="userSpaceOnUse">
<rect x="0" y="0" width="100%" height="100%" fill="#ccc" stroke="none" rx="1"></rect>
<path d="M4.9 16.1h.01"></path>
<path d="M4.9 1.9h.01"></path>
</mask>
<mask id="svg-preview-control-path-marker-mask-1" maskUnits="userSpaceOnUse">
<rect x="0" y="0" width="100%" height="100%" fill="#ccc" stroke="none" rx="1"></rect>
<path d="M7.8 4.7h.01"></path>
<path d="M7 12.2h.01"></path>
</mask>
<mask id="svg-preview-control-path-marker-mask-6" maskUnits="userSpaceOnUse">
<rect x="0" y="0" width="100%" height="100%" fill="#ccc" stroke="none" rx="1"></rect>
<path d="M16.2 4.8h.01"></path>
<path d="M17 12.27h.01"></path>
</mask>
<mask id="svg-preview-control-path-marker-mask-7" maskUnits="userSpaceOnUse">
<rect x="0" y="0" width="100%" height="100%" fill="#ccc" stroke="none" rx="1"></rect>
<path d="M19.1 1.9h.01"></path>
<path d="M19.1 16h.01"></path>
</mask>
<mask id="svg-preview-control-path-marker-mask-8" maskUnits="userSpaceOnUse">
<rect x="0" y="0" width="100%" height="100%" fill="#ccc" stroke="none" rx="1"></rect>
<path d="M9.5 18h.01"></path>
<path d="M14.5 18h.01"></path>
</mask>
<mask id="svg-preview-control-path-marker-mask-9" maskUnits="userSpaceOnUse">
<rect x="0" y="0" width="100%" height="100%" fill="#ccc" stroke="none" rx="1"></rect>
<path d="M8 22h.01"></path>
<path d="M12 11h.01"></path>
</mask>
<mask id="svg-preview-control-path-marker-mask-10" maskUnits="userSpaceOnUse">
<rect x="0" y="0" width="100%" height="100%" fill="#ccc" stroke="none" rx="1"></rect>
<path d="M12 11h.01"></path>
<path d="M16 22h.01"></path>
</mask>
</g>
<g class="svg-preview-control-path-group" stroke="#fff" stroke-width="0.125">
<path mask="url(#svg-preview-control-path-marker-mask-0)" d="M 4.9 16.1 C1 12.2 1 5.8 4.9 1.9"></path>
<path mask="url(#svg-preview-control-path-marker-mask-1)" d="M 7.8 4.7 A6.14 6.14 0 0 0 7 12.2"></path>
<path d="M 12 7 A2 2 0 0 1 14 9"></path>
<path d="M 14 9 A2 2 0 0 1 12 11"></path>
<path d="M 12 11 A2 2 0 0 1 10 9"></path>
<path d="M 10 9 A2 2 0 0 1 12 7"></path>
<path mask="url(#svg-preview-control-path-marker-mask-6)" d="M 16.2 4.8 C18.2 6.8 18.46 9.91 17 12.27"></path>
<path mask="url(#svg-preview-control-path-marker-mask-7)" d="M 19.1 1.9 A9.96 9.96 0 0 1 19.1 16"></path>
<path mask="url(#svg-preview-control-path-marker-mask-8)" d="M 9.5 18 L 14.5 18"></path>
<path mask="url(#svg-preview-control-path-marker-mask-9)" d="M 8 22 L 12 11"></path>
<path mask="url(#svg-preview-control-path-marker-mask-10)" d="M 12 11 L 16 22"></path>
</g>
<g class="svg-preview-control-path-marker-group" stroke="#fff" stroke-width="0.125">
<path
d="M4.9 16.1h.01M4.9 1.9h.01M7.8 4.7h.01M7 12.2h.01M16.2 4.8h.01M17 12.27h.01M19.1 1.9h.01M19.1 16h.01M9.5 18h.01M14.5 18h.01M8 22h.01M12 11h.01M12 11h.01M16 22h.01">
</path>
<circle cx="4.9" cy="16.1" r="0.5"></circle>
<circle cx="4.9" cy="1.9" r="0.5"></circle>
<circle cx="7.8" cy="4.7" r="0.5"></circle>
<circle cx="7" cy="12.2" r="0.5"></circle>
<circle cx="16.2" cy="4.8" r="0.5"></circle>
<circle cx="17" cy="12.27" r="0.5"></circle>
<circle cx="19.1" cy="1.9" r="0.5"></circle>
<circle cx="19.1" cy="16" r="0.5"></circle>
<circle cx="9.5" cy="18" r="0.5"></circle>
<circle cx="14.5" cy="18" r="0.5"></circle>
<circle cx="8" cy="22" r="0.5"></circle>
<circle cx="16" cy="22" r="0.5"></circle>
</g>
<g class="svg-preview-handles-group" stroke-width="0.12" style="stroke: var(--vp-c-brand)" stroke-opacity="0.3">
<path d="M4.9 16.1 1 12.2"></path>
<circle cy="12.2" cx="1" r="0.25"></circle>
<path d="M4.9 1.9 1 5.8"></path>
<circle cy="5.8" cx="1" r="0.25"></circle>
<path d="M16.2 4.8 18.2 6.8"></path>
<circle cy="6.8" cx="18.2" r="0.25"></circle>
<path d="M17 12.27 18.46 9.91"></path>
<circle cy="9.91" cx="18.46" r="0.25"></circle>
</g>
</svg>
</template>
<style>
.hero {
overflow: hidden;
height: 60vh;
display: flex;
position: relative;
/* align-items: center;
justify-content: center; */
}
.hero-background {
transform: rotateX(-51deg) rotateZ(-43deg);
transform-style: preserve-3d;
position: fixed;
top: -240px;
right: -320px;
width: 112vw;
height: 112vh;
}
.hero-title {
font-size: 3.2rem;
line-height: 1.2;
font-weight: 700;
text-align: center;
max-width: 800px;
}
/* .VPHomeHero .image {
display: none;
}
.VPHomeHero .container {
justify-content: center;
text-align: center;
}
.VPHomeHero .main {
text-align: center;
} */
/* .VPHomeHero .container .actions {
justify-content: center;
} */
/*
@media (min-width: 960px) {
.VPHomeHero :deep(.actions) {
justify-content: center;
}
} */
@media screen and (prefers-color-scheme: light) {
.svg-preview-grid-rect { fill: none }
}
@media screen and (prefers-color-scheme: dark) {
.svg-preview-grid-rect { fill: none }
.svg
.svg-preview-grid-group,
.svg-preview-radii-group,
.svg-preview-shadow-mask-group,
.svg-preview-shadow-group {
stroke: #fff;
}
}
.search-box {
/* width: calc(100vw - 272px); */
width: 100%;
margin-top: 24px;
}
</style>
@@ -1,248 +0,0 @@
<script setup lang="ts">
import { ref, onMounted, onBeforeUnmount, type Component } from 'vue';
import {
heart,
star,
zap,
code,
feather,
cloud,
sun,
moon,
camera,
sixteenthNotes,
video,
globe,
layers,
package as packageIcon,
compass,
command,
terminal,
database,
server,
cpu,
lock,
key,
shield,
wifi,
download,
upload,
search,
settings,
users,
mail,
bell,
calendar,
clock,
gitBranch,
funnel,
bookmark,
tag,
sparkles,
} from '../../../data/iconNodes';
import createElement from 'lucide/src/createElement';
import { IconNode } from 'lucide/src/types';
const icons: Component[] = [
heart, star, zap, code, feather, cloud, sun, moon, camera, sixteenthNotes,
video, globe, layers, packageIcon, compass, command, terminal, database,
server, cpu, lock, key, shield, wifi, download, upload, search,
settings, users, mail, bell, calendar, clock, gitBranch, funnel,
bookmark, tag, sparkles,
];
const svgs = icons.map(icon => {
const element = createElement(icon as IconNode, {
stroke: 'white',
opacity: '0.2',
})
return element.outerHTML;
});
const highlightedSvgs = icons.map(icon => {
const element = createElement(icon as IconNode, {
stroke: 'white',
})
return element.outerHTML;
});
const images = svgs.map(svg => {
const img = new Image();
img.src = `data:image/svg+xml;base64,${btoa(svg)}`;
return img;
});
const highlightedImages = highlightedSvgs.map(svg => {
const img = new Image();
img.src = `data:image/svg+xml;base64,${btoa(svg)}`;
return img;
});
const canvas = ref<HTMLCanvasElement | null>(null);
// Setting up the columns
const fontSize = 16;
const gap = 40;
const gapY = 8;
const intervalTime = ref<number | null>(null);
// Store individual drops with their positions
let individualDrops: Array<{x: number, y: number, active: boolean}> = [];
// Random integer between min and max
function randInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
onMounted(() => {
if (!canvas.value) return;
const ctx = canvas.value.getContext('2d');
if (!ctx) return;
const width = window.innerWidth;
const height = window.innerHeight * 0.6;
canvas.value.width = width;
canvas.value.height = height;
let columns = Math.floor(width / 120);
var rows = Math.floor(canvas.value.height / fontSize);
var midStart = Math.floor(rows * 0.25);
var midEnd = Math.floor(rows * 0.85);
let drops = Array.from({ length: columns }, () => randInt(midStart, midEnd));
let fps, fpsInterval, startTime, now, then, elapsed;
// Add click event listener
function handleCanvasClick(event: MouseEvent) {
const rect = canvas.value?.getBoundingClientRect();
if (!rect) return;
const x = event.clientX - rect.left;
const y = event.clientY - rect.top;
individualDrops.push({
x: x,
y: y,
active: true
});
}
canvas.value.addEventListener('click', handleCanvasClick);
function draw() {
if (!ctx) return;
ctx.fillStyle = 'rgba(27, 27, 31, 0.50)';
ctx.fillRect(0, 0, width, height);
ctx.fillStyle = 'rgba(255, 255, 255, 1)';
// Draw regular drops
for (var i = drops.length; i > 0; i--) {
var img = images[Math.floor(Math.random() * images.length)];
ctx.drawImage(img, i * fontSize * 2 + gap, drops[i] * fontSize, (fontSize / 2) + gapY, (fontSize / 2) + gapY);
drops[i]++;
if (Math.random() > .98) {
drops[i] = randInt(midStart, midEnd);
}
}
// Draw and update individual drops
individualDrops = individualDrops.filter(drop => {
if (!drop.active) return false;
var img = highlightedImages[Math.floor(Math.random() * images.length)];
ctx.drawImage(img, drop.x - fontSize/2, drop.y, fontSize, fontSize);
drop.y += fontSize
// Remove if off screen
if (drop.y > height) {
drop.active = false;
return false;
}
return true;
});
}
function startAnimating(fps) {
fpsInterval = 1000 / fps;
then = Date.now();
startTime = then;
animate();
}
function animate() {
// request another frame
requestAnimationFrame(animate);
// calc elapsed time since last loop
now = Date.now();
elapsed = now - then;
// if enough time has elapsed, draw the next frame
if (elapsed > fpsInterval) {
// Get ready for next frame by setting then=now, but also adjust for your
// specified fpsInterval not being a multiple of RAF's interval (16.7ms)
then = now - (elapsed % fpsInterval);
// Put your drawing code here
draw();
}
}
startAnimating(12);
window.addEventListener('resize', function() {
canvas.value.width = window.innerWidth;
canvas.value.height = window.innerHeight;
rows = Math.floor(canvas.value.height / fontSize);
columns = Math.floor(canvas.value.width / fontSize);
var oldDrops = drops.slice();
drops = [];
for (var i = 0; i < columns; i++) {
drops[i] = oldDrops[i % oldDrops.length] ?? randInt(midStart, midEnd);
}
});
// Cleanup event listener
onBeforeUnmount(() => {
canvas.value?.removeEventListener('click', handleCanvasClick);
});
});
</script>
<template>
<div class="hero">
<canvas ref="canvas" class="hero-canvas" />
</div>
</template>
<style scoped>
.hero {
overflow: hidden;
height: 60vh;
}
.hero-canvas {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 60vh;
filter: blur(0px);
}
</style>
@@ -1,7 +1,7 @@
<script setup lang="ts">
import type { DefaultTheme } from 'vitepress/theme'
import { ref, watch, onMounted } from 'vue'
import { useAside } from 'vitepress/dist/client/theme-default/composables/aside.js'
import { useMediaQuery } from '@vueuse/core'
import { useData } from 'vitepress/dist/client/theme-default/composables/data.js'
const { page } = useData()
@@ -12,7 +12,7 @@ const props = defineProps<{
const carbonOptions = props.carbonAds
const { isAsideEnabled } = useAside()
const isAsideEnabled = useMediaQuery('(min-width: 80rem)')
const container = ref()
let isInitialized = false
@@ -1,12 +1,12 @@
<script setup lang="ts">
import { useData } from 'vitepress';
import { useSidebar } from 'vitepress/dist/client/theme-default/composables/sidebar.js';
import { useLayout } from 'vitepress/theme';
import VPLink from 'vitepress/dist/client/theme-default/components/VPLink.vue';
import { computed } from 'vue';
import SurveyAskOverlay from '../SurveyAskOverlay.vue';
const { theme } = useData();
const { hasSidebar } = useSidebar();
const { hasSidebar } = useLayout();
const githubLink = computed(
() => theme.value.socialLinks.find(({ icon }) => icon === 'github').link,
@@ -131,7 +131,7 @@ const links = computed(() => [
justify-content: center;
}
@media (min-width: 1152px) {
@media (min-width: 72rem) {
.VPFooter {
padding: 32px;
}
@@ -1,10 +0,0 @@
<script setup lang="ts">
import { menu } from '../../../data/iconNodes';
import createLucideIcon from '@lucide/vue/src/createLucideIcon';
const Menu = createLucideIcon('menu', menu);
</script>
<template>
<Menu />
</template>
@@ -2,31 +2,33 @@
import { ref } from 'vue'
// This component can be rendered more than once on a page (e.g. a hidden
// copy inside `.content-body`). DocSearch mounts into the first `#docsearch`
// in the document, so only a single instance may ever render the search box.
// copy inside `.content-body`). DocSearch mounts into `#vp-docsearch`, so only
// a single instance may ever render the search box.
const loaded = ref(false)
// Shared so that any instance (e.g. the visible input) can open the modal
// rendered by the owning instance.
const openRequest = ref<{ target: 'search'; nonce: number } | null>(null)
let openNonce = 0
// Every instance registers the hotkeys; only handle each event once.
let lastHandledEvent: KeyboardEvent | null = null
</script>
<script lang="ts" setup>
import '@docsearch/css/dist/style.css'
import {
computed,
defineAsyncComponent,
onMounted,
onUnmounted,
} from 'vue'
import { computed, defineAsyncComponent, onMounted } from 'vue'
import { onKeyStroke } from '@vueuse/core'
import type { DefaultTheme } from 'vitepress/theme'
import { useData } from 'vitepress'
import FakeInput from '../base/FakeInput.vue'
const VPAlgoliaSearchBox = defineAsyncComponent(() => import('vitepress/dist/client/theme-default/components/VPAlgoliaSearchBox.vue'));
const VPAlgoliaSearchBox = defineAsyncComponent(
() => import('vitepress/dist/client/theme-default/components/VPAlgoliaSearchBox.vue'),
)
const { theme } = useData<DefaultTheme.Config>()
const algolia = computed(
() =>
(theme.value.search?.options ?? theme.value.algolia) as DefaultTheme.AlgoliaSearchOptions,
const algoliaOptions = computed(
() => (theme.value.search?.options ?? {}) as DefaultTheme.AlgoliaSearchOptions,
)
// whether this instance is the one rendering the (hidden) search box
@@ -36,47 +38,39 @@ const shortcutText = ref('')
// to avoid loading the docsearch js upfront (which is more than 1/3 of the
// payload), we delay initializing it until the user has actually clicked or
// hit the hotkey to invoke it.
const preconnect = () => {
onMounted(() => {
shortcutText.value = /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform) ? '⌘K' : 'Ctrl+K'
const id = 'VPAlgoliaPreconnect'
if (document.getElementById(id)) return
if (document.getElementById(id) || !algoliaOptions.value.appId) return
const rIC = window.requestIdleCallback || setTimeout
rIC(() => {
const preconnect = document.createElement('link')
preconnect.id = id
preconnect.rel = 'preconnect'
preconnect.href = `https://${algolia.value.appId}-dsn.algolia.net`
preconnect.href = `https://${algoliaOptions.value.appId}-dsn.algolia.net`
preconnect.crossOrigin = ''
document.head.appendChild(preconnect)
})
}
})
onMounted(() => {
preconnect()
shortcutText.value = /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform) ? '⌘K' : 'Ctrl+K'
// once docsearch is initialized it handles the hotkey itself
const handleSearchHotKey = (event: KeyboardEvent) => {
if (loaded.value) return remove()
if (
(event.key.toLowerCase() === 'k' && (event.metaKey || event.ctrlKey)) ||
(!isEditingContent(event) && event.key === '/')
) {
event.preventDefault()
open()
remove()
}
onKeyStroke('k', (event) => {
if (event === lastHandledEvent) return
if (event.ctrlKey || event.metaKey) {
lastHandledEvent = event
event.preventDefault()
open()
}
})
const remove = () => {
window.removeEventListener('keydown', handleSearchHotKey)
onKeyStroke('/', (event) => {
if (event === lastHandledEvent) return
if (!isEditingContent(event)) {
lastHandledEvent = event
event.preventDefault()
open()
}
window.addEventListener('keydown', handleSearchHotKey)
onUnmounted(remove)
})
function open() {
@@ -84,23 +78,8 @@ function open() {
loaded.value = true
isOwner.value = true
}
setTimeout(poll, 16)
}
function poll() {
// programmatically open the search box after initialize
const e = new Event('keydown') as any
e.key = 'k'
e.metaKey = true
window.dispatchEvent(e)
setTimeout(() => {
if (!document.querySelector('.DocSearch-Modal')) {
poll()
}
}, 16)
// The search box queues the request until DocSearch is ready.
openRequest.value = { target: 'search', nonce: ++openNonce }
}
function isEditingContent(event: KeyboardEvent): boolean {
@@ -129,21 +108,21 @@ function isEditingContent(event: KeyboardEvent): boolean {
<!-- docsearch renders its own button here; we only need its modal -->
<div v-if="isOwner" class="docsearch-host">
<VPAlgoliaSearchBox :algolia="algolia" />
<VPAlgoliaSearchBox :algolia-options="algoliaOptions" :open-request="openRequest" />
</div>
</div>
</template>
<style>
@media (min-width: 768px) {
@media (min-width: 48rem) {
.VPNavBarSearch {
flex-grow: 1;
padding-left: 0px;
}
}
@media (min-width: 960px) {
@media (min-width: 60rem) {
.VPNavBarSearch {
padding-left: 0px;
}
@@ -166,6 +145,9 @@ function isEditingContent(event: KeyboardEvent): boolean {
[class*='DocSearch'] {
--docsearch-primary-color: var(--vp-c-brand-1);
--docsearch-highlight-color: var(--docsearch-primary-color);
/* DocSearch 4 fills the selected hit with this; VitePress points it at the (indigo) brand-soft */
--docsearch-hit-highlight-color: color-mix(in srgb, var(--vp-c-brand) 10%, transparent);
--docsearch-soft-primary-color: color-mix(in srgb, var(--vp-c-brand) 10%, transparent);
--docsearch-text-color: var(--vp-c-text-1);
--docsearch-muted-color: var(--vp-c-text-2);
--docsearch-searchbox-shadow: none;
@@ -191,8 +173,15 @@ function isEditingContent(event: KeyboardEvent): boolean {
border-top: 1px solid var(--vp-c-divider);
}
.DocSearch-Form {
/* DocSearch 4 turned the search field into a full-width header; inset it again like before.
Its CSS is loaded lazily after ours, hence the extra .DocSearch-Modal for specificity. */
.DocSearch-Modal .DocSearch-SearchBar {
padding: var(--docsearch-spacing);
}
.DocSearch-Modal .DocSearch-Form {
border: 1px solid var(--vp-c-brand-1);
border-radius: 4px;
background-color: var(--vp-c-white);
}
@@ -1,6 +1,6 @@
import packageDataList from '../../../data/packageData.json';
import thirdPartyPackages from '../../../data/packageData.thirdParty.json';
import fetchPackages from '../../../lib/fetchPackages';
import packageDataList from '../../../data/packageData.json' with { type: 'json' };
import thirdPartyPackages from '../../../data/packageData.thirdParty.json' with { type: 'json' };
import fetchPackages from '../../../lib/fetchPackages.ts';
const loader = {
async load() {
@@ -57,7 +57,7 @@ const props = defineProps<{
align-items: flex-start;
gap: 24px;
}
@media screen and (min-width: 480px) {
@media screen and (min-width: 30rem) {
.package-header {
flex-direction: row;
}
@@ -167,13 +167,13 @@ const stats = [
margin: 0 -24px;
}
@media (min-width: 640px) {
@media (min-width: 40rem) {
.stats {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
}
@media (min-width: 768px) {
@media (min-width: 48rem) {
.hero {
padding-top: 96px;
}
@@ -188,7 +188,7 @@ const stats = [
}
}
@media (min-width: 960px) {
@media (min-width: 60rem) {
.hero-content {
flex-direction: row;
}
@@ -240,7 +240,7 @@ const initial = <T,>(value: T) => (reducedMotion.value ? false : value);
overflow: hidden;
}
@media (min-width: 960px) {
@media (min-width: 60rem) {
.sponsor-hero-animation {
max-width: 860px;
}
@@ -1,5 +1,5 @@
import iconNodes from '../../../data/iconNodes';
import fetchPackages from '../../../lib/fetchPackages';
import iconNodes from '../../../data/iconNodes/index.ts';
import fetchPackages from '../../../lib/fetchPackages.ts';
const NPM_DOWNLOADS_API = 'https://api.npmjs.org/downloads/point/last-week';
@@ -167,8 +167,9 @@ const links = computed(() => getTierLinks(props.tier));
gap: 8px;
}
/* flex (not block) keeps VitePress 2's VPButton centring its label vertically */
.primary-action {
display: block;
display: flex;
}
.secondary-action {
@@ -216,7 +216,7 @@ function scrollTrack(direction: 1 | -1) {
background: linear-gradient(to right, transparent, var(--vp-c-bg) 85%);
}
@media (min-width: 640px) {
@media (min-width: 40rem) {
.fade-left {
width: 96px;
}
@@ -360,7 +360,7 @@ watch(inView, (isInView) => {
white-space: pre;
}
@media (max-width: 959px) {
@media (max-width: 59.9375rem) {
.connector {
height: 180px;
}
@@ -96,7 +96,7 @@ const config = computed(() => waitlistProducts[props.product]);
padding-block: 48px;
}
@media (min-width: 640px) {
@media (min-width: 40rem) {
.title {
max-width: 576px;
line-height: 56px;
@@ -104,13 +104,13 @@ const config = computed(() => waitlistProducts[props.product]);
}
}
@media (min-width: 768px) {
@media (min-width: 48rem) {
.tag {
display: inline-block;
}
}
@media (min-width: 960px) {
@media (min-width: 60rem) {
.title {
line-height: 64px;
font-size: 56px;
+2
View File
@@ -15,6 +15,7 @@ import NavBarSponsorButton from './layouts/NavBarSponsorButton.vue';
import SnackPlayer from './components/editors/SnackPlayer.vue';
import Toaster from './components/base/Toaster.vue';
import { setupTracking } from './utils/openpanel';
import { setupSentry } from './utils/sentry';
import trackUnderlineDirection from './utils/underlineDirection';
const theme: Partial<Theme> = {
@@ -39,6 +40,7 @@ const theme: Partial<Theme> = {
app.component('SnackPlayer', SnackPlayer);
setupTracking(router);
setupSentry(app);
if (!import.meta.env.SSR) {
trackUnderlineDirection();
@@ -68,14 +68,14 @@ const isActive = computed(() => page.value.relativePath === 'sponsor.md');
transform: scale(1.1);
}
@media (min-width: 768px) {
@media (min-width: 48rem) {
.sponsor-button {
margin-left: 16px;
}
}
/* The nav menu leaves no room for the label between tablet and desktop widths. */
@media (min-width: 768px) and (max-width: 959px) {
@media (min-width: 48rem) and (max-width: 59.9375rem) {
.sponsor-button {
justify-content: center;
width: 32px;
+59 -8
View File
@@ -1,3 +1,35 @@
/* VitePress 2 replaced its base styles with Tailwind's preflight. Our custom components were built
on VitePress 1's base (fixed 24px line-height, 16px/400 headings), so restore those parts.
This layer sits right after VitePress's base layer, so every component and page style still wins. */
@layer __vitepress_base, vp1-base;
@layer vp1-base {
body {
line-height: 24px;
}
h1,
h2,
h3,
h4,
h5,
h6 {
line-height: 24px;
font-size: 16px;
font-weight: 400;
}
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
input[type='number'] {
-moz-appearance: textfield;
}
}
:root {
--vp-c-brand: #f56565;
--vp-c-brand-light: #f67373;
@@ -123,8 +155,10 @@ html::-webkit-scrollbar-thumb:active {
}
}
/* VitePress 2 clips horizontal overflow itself (overflow-x: clip), but unlike the old overflow-x: hidden
that doesn't contain the last section's bottom margin, so keep a formatting context for the spacing. */
.VPHome {
overflow-x: hidden;
display: flow-root;
}
.VPNavBarTitle .logo {
@@ -189,7 +223,7 @@ html::-webkit-scrollbar-thumb:active {
display: none;
}
@media (min-width: 960px) {
@media (min-width: 60rem) {
.VPHomeHero .container .image {
order: 1;
margin-bottom: auto;
@@ -261,14 +295,14 @@ html::-webkit-scrollbar-thumb:active {
}
/* No room for the label next to the logo at these widths. */
@media (min-width: 768px) and (max-width: 879.98px) {
@media (min-width: 48rem) and (max-width: 54.9988rem) {
.VPNavBarMenu .nav-badge {
display: none;
}
}
/* The menu only just fits next to the logo at these widths. */
@media (min-width: 768px) and (max-width: 829.98px) {
@media (min-width: 48rem) and (max-width: 51.8738rem) {
.VPNav .VPNavBarMenu .VPNavBarMenuLink,
.VPNav .VPNavBarMenuGroup .button {
padding: 0 9px;
@@ -308,13 +342,23 @@ html::-webkit-scrollbar-thumb:active {
transform: rotate(-90deg);
}
/* VitePress 2 only transitions opacity and visibility here (and closes faster than it opens),
so add transform to both, or the slide would jump */
.VPNav .VPNavBarMenuGroup .button[aria-expanded='false'] + .menu {
transform: translateY(-8px);
transition:
opacity 0.1s,
visibility 0.1s,
transform 0.1s;
}
.VPNav .VPNavBarMenuGroup:hover .button + .menu,
.VPNav .VPNavBarMenuGroup .button[aria-expanded='true'] + .menu {
transform: translateY(0);
transition:
opacity 0.25s,
visibility 0.25s,
transform 0.25s;
}
/* Appearance switch: the thumb sits 2px inside the track and slides over with a small bounce,
@@ -420,7 +464,7 @@ html.dark .VPNav .VPSwitchAppearance .icon .moon {
transition: transform 0.3s cubic-bezier(0.34, 1.4, 0.64, 1);
}
@media (min-width: 960px) {
@media (min-width: 60rem) {
.VPSidebar {
padding-right: 24px !important;
}
@@ -547,8 +591,10 @@ html.dark .VPNav .VPSwitchAppearance .icon .moon {
/* "On this page" outline: each heading is a soft pill on hover and slides in a little,
the current heading takes the brand colour and the marker glides to it */
/* No negative right margin: it would overflow the aside container, and VitePress's
scrollIntoView on the active link would then scroll the whole outline sideways. */
.VPDoc .VPDocAsideOutline .outline-link {
margin: 0 -8px;
margin: 0 0 0 -8px;
padding: 0 8px;
border-radius: 6px;
transition:
@@ -651,6 +697,11 @@ html.dark .VPNav .VPSwitchAppearance .icon .moon {
overflow: hidden;
}
/* VitePress 2 gives `.vp-doc img` a 1rem block margin */
.vp-doc .example-guidance__image {
margin: 0;
}
.example-guidance__image--raw svg {
display: block;
width: 100%;
@@ -714,7 +765,7 @@ html.dark .VPNav .VPSwitchAppearance .icon .moon {
--example-guidance-label-bg: var(--vp-c-warning-1);
}
@media (min-width: 640px) {
@media (min-width: 40rem) {
.example-block {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
@@ -730,7 +781,7 @@ html.dark .VPNav .VPSwitchAppearance .icon .moon {
}
}
@media (min-width: 960px) {
@media (min-width: 60rem) {
.example-block {
grid-template-columns: minmax(0, 0.9fr) repeat(2, minmax(0, 1fr));
}
+19
View File
@@ -0,0 +1,19 @@
import type { App } from 'vue';
const dsn = import.meta.env.VITE_SENTRY_DSN;
/**
* Initializes Sentry error tracking. Only runs in the browser and when a DSN is configured,
* and loads the SDK lazily so it doesn't block the initial render.
*/
export function setupSentry(app: App) {
if (import.meta.env.SSR || !dsn) return;
import('@sentry/vue').then((Sentry) => {
Sentry.init({
app,
dsn,
environment: import.meta.env.MODE,
});
});
}
+2 -2
View File
@@ -1,6 +1,6 @@
import { type PageData } from 'vitepress';
import getStructuredData, { getFaqStructuredData } from './getStructuredData';
import { createGeneralOGImage, createIconOGImage } from './createOGImage';
import getStructuredData, { getFaqStructuredData } from './getStructuredData.ts';
import { createGeneralOGImage, createIconOGImage } from './createOGImage.ts';
export async function transformPageData(pageData: PageData) {
pageData.frontmatter.head ??= [];
+2 -2
View File
@@ -205,7 +205,7 @@ function releaseTagLink(version) {
align-items: flex-start;
}
@media (min-width: 640px) {
@media (min-width: 40rem) {
.layout {
align-items: flex-start;
display: grid;
@@ -247,7 +247,7 @@ function releaseTagLink(version) {
margin: 24px -24px 24px;
}
@media (min-width: 640px) {
@media (min-width: 40rem) {
.tab-list {
margin: 24px 0 24px;
}
+2 -2
View File
@@ -1,5 +1,5 @@
import { getAllCategoryFiles } from '../.vitepress/lib/categories';
import iconMetaData from '../.vitepress/data/iconMetaData';
import { getAllCategoryFiles } from '../.vitepress/lib/categories.ts';
import iconMetaData from '../.vitepress/data/iconMetaData.ts';
export default {
async load() {
+1 -1
View File
@@ -1,4 +1,4 @@
import createCodeExamples from '../.vitepress/lib/codeExamples/createCodeExamples';
import createCodeExamples from '../.vitepress/lib/codeExamples/createCodeExamples.ts';
export default {
async load() {
+1 -1
View File
@@ -1,4 +1,4 @@
import * as iconDetails from '../.vitepress/data/iconDetails';
import * as iconDetails from '../.vitepress/data/iconDetails/index.ts';
export default {
async load() {
+1 -1
View File
@@ -1,4 +1,4 @@
import createCodeExamples from '../../.vitepress/lib/codeExamples/createLabCodeExamples';
import createCodeExamples from '../../.vitepress/lib/codeExamples/createLabCodeExamples.ts';
export default {
async load() {
+2 -3
View File
@@ -31,7 +31,6 @@
"author": "Eric Fennis",
"license": "ISC",
"devDependencies": {
"@docsearch/js": "3.8.2",
"@lucide/build-icons": "workspace:*",
"@lucide/helpers": "workspace:*",
"@lucide/shared": "workspace:*",
@@ -53,18 +52,18 @@
"svg-pathdata": "^9.0.0",
"svgson": "^5.3.1",
"typescript": "^6.0.3",
"vitepress": "^1.6.4",
"vitepress": "2.0.0-alpha.21",
"vitepress-plugin-group-icons": "^1.7.6",
"vitepress-plugin-llms": "^1.13.5",
"vue-tsc": "^3.3.11"
},
"dependencies": {
"@docsearch/css": "3.8.2",
"@floating-ui/vue": "^2.0.1",
"@headlessui/vue": "^1.7.23",
"@lucide/vue": "workspace:*",
"@openpanel/web": "^1.4.2",
"@react-email/components": "1.0.12",
"@sentry/vue": "^11.16.0",
"@vueuse/components": "^14.4.0",
"@vueuse/core": "^14.4.0",
"@vueuse/integrations": "^14.4.0",
+2 -2
View File
@@ -35,7 +35,7 @@ const writeIconFiles = Object.entries(iconMetaData).map(async ([iconName, metaDa
import iconNode from '../iconNodes/${iconName}.node.json' with { type: 'json' };
import releaseData from '../releaseMetadata/${iconName}.json' with { type: 'json' };
import popularity from '../iconPopularity/${iconName}.json' with { type: 'json' };
import { IconMetaData, IconNode } from '~/.vitepress/theme/types';
import type { IconMetaData, IconNode } from '~/.vitepress/theme/types.ts';
const metaData: IconMetaData = ${JSON.stringify({ tags, categories, contributors, aliases, deprecated, deprecationReason, toBeRemovedInVersion })};
@@ -61,7 +61,7 @@ export default iconDetails;
await fs.promises.writeFile(location, contents, 'utf-8');
await fs.promises.appendFile(
indexFile,
`export { default as ${toCamelCase(iconName)} } from './${iconName}';\n`,
`export { default as ${toCamelCase(iconName)} } from './${iconName}.ts';\n`,
'utf-8',
);
});
+1 -1
View File
@@ -47,7 +47,7 @@ try {
await fs.promises.writeFile(
iconIndexFile,
`\
import type { IconNode } from '../../theme/types';
import type { IconNode } from '../../theme/types.ts';
${iconIndexFileImports.join('\n')}
${iconIndexFileNodes.join('\n')}
+208 -530
View File
File diff suppressed because it is too large Load Diff