diff --git a/src/components/navigation/Search.astro b/src/components/navigation/Search.astro index 8c04fdd..c5bdb45 100644 --- a/src/components/navigation/Search.astro +++ b/src/components/navigation/Search.astro @@ -133,7 +133,10 @@ import magnifierIcon from "@icons/magnifier.svg?raw"; //@ts-expect-error "@pagefind/default-ui" ); - new PagefindUI({ + const versionMatch = window.location.pathname.match(/^\/docs\/([^/]+)/); + const activeVersion = versionMatch?.[1]; + + const search = new PagefindUI({ element: "#qs_search", // resetStyles: false, sort: { version: "desc" }, @@ -170,6 +173,10 @@ import magnifierIcon from "@icons/magnifier.svg?raw"; }); }, }); + + if (activeVersion) { + search.triggerFilters({ version: activeVersion }); + } }); }); } diff --git a/src/config/styling/marquee.ts b/src/config/styling/marquee.ts index 39ab972..61d5df6 100644 --- a/src/config/styling/marquee.ts +++ b/src/config/styling/marquee.ts @@ -176,12 +176,13 @@ document.addEventListener("DOMContentLoaded", () => { // video handling const videos = scroller.querySelectorAll("video"); - const observerOptions = { + + const playObserverOptions = { root: container, threshold: 0.5, }; - const videoObserver = new IntersectionObserver(entries => { + const playObserver = new IntersectionObserver(entries => { entries.forEach(entry => { const video = entry.target as HTMLVideoElement; if (entry.isIntersecting) { @@ -190,12 +191,28 @@ document.addEventListener("DOMContentLoaded", () => { video.pause(); } }); - }, observerOptions); + }, playObserverOptions); + + const resetObserverOptions = { + root: container, + threshold: 0.01, + }; + + const resetObserver = new IntersectionObserver(entries => { + entries.forEach(entry => { + const video = entry.target as HTMLVideoElement; + if (!entry.isIntersecting) { + video.currentTime = 0; + video.pause(); + } + }); + }, resetObserverOptions); const startObserving = () => { const allVideos = scroller.querySelectorAll("video"); allVideos.forEach(v => { - videoObserver.observe(v); + playObserver.observe(v); + resetObserver.observe(v); v.addEventListener("ended", () => { targetScrollX += itemWidth; startAnimation(); diff --git a/src/pages/docs/[version]/types/[module]/[type].astro b/src/pages/docs/[version]/types/[module]/[type].astro index fee5249..741d33f 100644 --- a/src/pages/docs/[version]/types/[module]/[type].astro +++ b/src/pages/docs/[version]/types/[module]/[type].astro @@ -43,8 +43,14 @@ const details = type.details ? await processMarkdown(version.name, type.details) : null; + +const description = type.description + ? await processMarkdown(version.name, type.description) + : null; + const searchWeight = version.name != "master" ? getSearchWeight(version.name) : 999.0; + --- import {module.name}
- {details ? : ({type.description})} + {details ? : } {Object.keys(type.properties ?? {}).length != 0 && (

Properties [?]

diff --git a/src/pages/docs/[version]/types/[module]/index.astro b/src/pages/docs/[version]/types/[module]/index.astro index 3b7efe4..374019a 100644 --- a/src/pages/docs/[version]/types/[module]/index.astro +++ b/src/pages/docs/[version]/types/[module]/index.astro @@ -2,7 +2,6 @@ import DocsLayout from "@layouts/DocsLayout.astro"; import { getVersionsData } from "@config/io/generateTypeData"; import { processMarkdown } from "@src/config/io/markdown"; -import type { TypeData } from "@_types"; export async function getStaticPaths() { return (await getVersionsData()).versions.flatMap(version => { @@ -17,6 +16,11 @@ const { version, module } = Astro.props; const details = module.details ? await processMarkdown(version.name, module.details) : null; + +const types = await Promise.all(module.types.map(async type => ({ + description2: type.description ? await processMarkdown(version.name, type.description) : null, + ...type +}))); --- {module.description}
- {module.types.map((type: TypeData) => + {types.map(type => (
{type.name} - {type.description} + {type.description2 && }
) )} diff --git a/src/styles/docs/docs-types.css b/src/styles/docs/docs-types.css index d547b05..451ab1b 100644 --- a/src/styles/docs/docs-types.css +++ b/src/styles/docs/docs-types.css @@ -363,6 +363,9 @@ html:has(input#theme-manual-toggle:checked) .typevariants { & .root-nav-desc { padding-left: 1rem; border-left: 1px solid hsl(var(--blue) 10% 15% / 0.6); + + /* for processMarkdown in desc strs*/ + & > p { margin: 0 } } } }