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
|
//@ts-expect-error
|
||||||
"@pagefind/default-ui"
|
"@pagefind/default-ui"
|
||||||
);
|
);
|
||||||
const versionMatch = window.location.pathname.match(/^\/docs\/([^/]+)/);
|
new PagefindUI({
|
||||||
const activeVersion = versionMatch?.[1];
|
|
||||||
|
|
||||||
const search = new PagefindUI({
|
|
||||||
element: "#qs_search",
|
element: "#qs_search",
|
||||||
// resetStyles: false,
|
// resetStyles: false,
|
||||||
sort: { version: "desc" },
|
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
|
// video handling
|
||||||
const videos = scroller.querySelectorAll("video");
|
const videos = scroller.querySelectorAll("video");
|
||||||
|
const observerOptions = {
|
||||||
const playObserverOptions = {
|
|
||||||
root: container,
|
root: container,
|
||||||
threshold: 0.5,
|
threshold: 0.5,
|
||||||
};
|
};
|
||||||
|
|
||||||
const playObserver = new IntersectionObserver(entries => {
|
const videoObserver = new IntersectionObserver(entries => {
|
||||||
entries.forEach(entry => {
|
entries.forEach(entry => {
|
||||||
const video = entry.target as HTMLVideoElement;
|
const video = entry.target as HTMLVideoElement;
|
||||||
if (entry.isIntersecting) {
|
if (entry.isIntersecting) {
|
||||||
|
|
@ -191,28 +190,12 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||||
video.pause();
|
video.pause();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, playObserverOptions);
|
}, observerOptions);
|
||||||
|
|
||||||
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 startObserving = () => {
|
||||||
const allVideos = scroller.querySelectorAll("video");
|
const allVideos = scroller.querySelectorAll("video");
|
||||||
allVideos.forEach(v => {
|
allVideos.forEach(v => {
|
||||||
playObserver.observe(v);
|
videoObserver.observe(v);
|
||||||
resetObserver.observe(v);
|
|
||||||
v.addEventListener("ended", () => {
|
v.addEventListener("ended", () => {
|
||||||
targetScrollX += itemWidth;
|
targetScrollX += itemWidth;
|
||||||
startAnimation();
|
startAnimation();
|
||||||
|
|
|
||||||
|
|
@ -43,14 +43,8 @@ const details = type.details
|
||||||
? await processMarkdown(version.name, type.details)
|
? await processMarkdown(version.name, type.details)
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
|
|
||||||
const description = type.description
|
|
||||||
? await processMarkdown(version.name, type.description)
|
|
||||||
: null;
|
|
||||||
|
|
||||||
const searchWeight =
|
const searchWeight =
|
||||||
version.name != "master" ? getSearchWeight(version.name) : 999.0;
|
version.name != "master" ? getSearchWeight(version.name) : 999.0;
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<DocsLayout
|
<DocsLayout
|
||||||
|
|
@ -84,7 +78,7 @@ const searchWeight =
|
||||||
<code class="type-module" data-pagefind-ignore>import {module.name}</code>
|
<code class="type-module" data-pagefind-ignore>import {module.name}</code>
|
||||||
<section class="typedocs-data typedata">
|
<section class="typedocs-data typedata">
|
||||||
<subheading class="typedocs-subheading">
|
<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>
|
</subheading>
|
||||||
{Object.keys(type.properties ?? {}).length != 0 && (
|
{Object.keys(type.properties ?? {}).length != 0 && (
|
||||||
<h2>Properties <a href={`/docs/${version.name}/guide/qml-language#properties`}>[?]</a></h2>
|
<h2>Properties <a href={`/docs/${version.name}/guide/qml-language#properties`}>[?]</a></h2>
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
import DocsLayout from "@layouts/DocsLayout.astro";
|
import DocsLayout from "@layouts/DocsLayout.astro";
|
||||||
import { getVersionsData } from "@config/io/generateTypeData";
|
import { getVersionsData } from "@config/io/generateTypeData";
|
||||||
import { processMarkdown } from "@src/config/io/markdown";
|
import { processMarkdown } from "@src/config/io/markdown";
|
||||||
|
import type { TypeData } from "@_types";
|
||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function getStaticPaths() {
|
||||||
return (await getVersionsData()).versions.flatMap(version => {
|
return (await getVersionsData()).versions.flatMap(version => {
|
||||||
|
|
@ -16,11 +17,6 @@ const { version, module } = Astro.props;
|
||||||
const details = module.details
|
const details = module.details
|
||||||
? await processMarkdown(version.name, module.details)
|
? await processMarkdown(version.name, module.details)
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
const types = await Promise.all(module.types.map(async type => ({
|
|
||||||
description2: type.description ? await processMarkdown(version.name, type.description) : null,
|
|
||||||
...type
|
|
||||||
})));
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<DocsLayout
|
<DocsLayout
|
||||||
|
|
@ -33,13 +29,13 @@ const types = await Promise.all(module.types.map(async type => ({
|
||||||
<section>
|
<section>
|
||||||
<span>{module.description}</span>
|
<span>{module.description}</span>
|
||||||
<div class="root-nav" data-pagefind-ignore>
|
<div class="root-nav" data-pagefind-ignore>
|
||||||
{types.map(type =>
|
{module.types.map((type: TypeData) =>
|
||||||
(
|
(
|
||||||
<div class="root-nav-entry">
|
<div class="root-nav-entry">
|
||||||
<a class="root-nav-link" href={`/docs/${version.name}/types/${module.name}/${type.name}`}>
|
<a class="root-nav-link" href={`/docs/${version.name}/types/${module.name}/${type.name}`}>
|
||||||
{type.name}
|
{type.name}
|
||||||
</a>
|
</a>
|
||||||
{type.description2 && <span class="root-nav-desc" set:html={type.description2}/>}
|
<span class="root-nav-desc">{type.description}</span>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -363,9 +363,6 @@ html:has(input#theme-manual-toggle:checked) .typevariants {
|
||||||
& .root-nav-desc {
|
& .root-nav-desc {
|
||||||
padding-left: 1rem;
|
padding-left: 1rem;
|
||||||
border-left: 1px solid hsl(var(--blue) 10% 15% / 0.6);
|
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