Compare commits
7 commits
940e9e3f2c
...
c8253f1172
| Author | SHA1 | Date | |
|---|---|---|---|
| c8253f1172 | |||
| e7aee4f394 | |||
| 7cc57b770d | |||
| 2e505f7606 | |||
| 0727eccb71 | |||
| 10edd8f19d | |||
| f26e76c114 |
5 changed files with 9 additions and 46 deletions
|
|
@ -133,10 +133,7 @@ import magnifierIcon from "@icons/magnifier.svg?raw";
|
|||
//@ts-expect-error
|
||||
"@pagefind/default-ui"
|
||||
);
|
||||
const versionMatch = window.location.pathname.match(/^\/docs\/([^/]+)/);
|
||||
const activeVersion = versionMatch?.[1];
|
||||
|
||||
const search = new PagefindUI({
|
||||
new PagefindUI({
|
||||
element: "#qs_search",
|
||||
// resetStyles: false,
|
||||
sort: { version: "desc" },
|
||||
|
|
@ -173,10 +170,6 @@ import magnifierIcon from "@icons/magnifier.svg?raw";
|
|||
});
|
||||
},
|
||||
});
|
||||
|
||||
if (activeVersion) {
|
||||
search.triggerFilters({ version: activeVersion });
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -176,13 +176,12 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||
|
||||
// video handling
|
||||
const videos = scroller.querySelectorAll("video");
|
||||
|
||||
const playObserverOptions = {
|
||||
const observerOptions = {
|
||||
root: container,
|
||||
threshold: 0.5,
|
||||
};
|
||||
|
||||
const playObserver = new IntersectionObserver(entries => {
|
||||
const videoObserver = new IntersectionObserver(entries => {
|
||||
entries.forEach(entry => {
|
||||
const video = entry.target as HTMLVideoElement;
|
||||
if (entry.isIntersecting) {
|
||||
|
|
@ -191,28 +190,12 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||
video.pause();
|
||||
}
|
||||
});
|
||||
}, 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);
|
||||
}, observerOptions);
|
||||
|
||||
const startObserving = () => {
|
||||
const allVideos = scroller.querySelectorAll("video");
|
||||
allVideos.forEach(v => {
|
||||
playObserver.observe(v);
|
||||
resetObserver.observe(v);
|
||||
videoObserver.observe(v);
|
||||
v.addEventListener("ended", () => {
|
||||
targetScrollX += itemWidth;
|
||||
startAnimation();
|
||||
|
|
|
|||
|
|
@ -43,14 +43,8 @@ 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;
|
||||
|
||||
---
|
||||
|
||||
<DocsLayout
|
||||
|
|
@ -84,7 +78,7 @@ const searchWeight =
|
|||
<code class="type-module" data-pagefind-ignore>import {module.name}</code>
|
||||
<section class="typedocs-data typedata">
|
||||
<subheading class="typedocs-subheading">
|
||||
{details ? <span class="parsedMD" set:html={details}/> : <span class="parsedMD" set:html={description}/>}
|
||||
{details ? <span class="parsedMD" set:html={details}/> : (<span class="toparse">{type.description}</span>)}
|
||||
</subheading>
|
||||
{Object.keys(type.properties ?? {}).length != 0 && (
|
||||
<h2>Properties <a href={`/docs/${version.name}/guide/qml-language#properties`}>[?]</a></h2>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
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 => {
|
||||
|
|
@ -16,11 +17,6 @@ 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
|
||||
})));
|
||||
---
|
||||
|
||||
<DocsLayout
|
||||
|
|
@ -33,13 +29,13 @@ const types = await Promise.all(module.types.map(async type => ({
|
|||
<section>
|
||||
<span>{module.description}</span>
|
||||
<div class="root-nav" data-pagefind-ignore>
|
||||
{types.map(type =>
|
||||
{module.types.map((type: TypeData) =>
|
||||
(
|
||||
<div class="root-nav-entry">
|
||||
<a class="root-nav-link" href={`/docs/${version.name}/types/${module.name}/${type.name}`}>
|
||||
{type.name}
|
||||
</a>
|
||||
{type.description2 && <span class="root-nav-desc" set:html={type.description2}/>}
|
||||
<span class="root-nav-desc">{type.description}</span>
|
||||
</div>
|
||||
)
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -363,9 +363,6 @@ 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 }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue