the great typeinfo unfuckening
This commit is contained in:
parent
db63f5639f
commit
49fed51ced
15 changed files with 233 additions and 365 deletions
86
src/pages/docs/types/[module]/[type].astro
Normal file
86
src/pages/docs/types/[module]/[type].astro
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
---
|
||||
import { getQMLTypeLink } from "@config/io/helpers";
|
||||
import { processMarkdown } from "@config/io/markdown";
|
||||
import { getModulesData } from "@config/io/generateTypeData";
|
||||
import DocsLayout from "@layouts/DocsLayout.astro";
|
||||
import TOC from "@components/navigation/sidebars/TOC.astro";
|
||||
import Properties from "@components/type/Properties.astro";
|
||||
import Functions from "@components/type/Functions.astro";
|
||||
import Signals from "@components/type/Signals.astro";
|
||||
import Variants from "@components/type/Variants.astro";
|
||||
import Badge from "@components/Badge.astro";
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const modules = await getModulesData();
|
||||
return modules.flatMap(module => module.types.map(type => ({
|
||||
params: { module: module.name, type: type.name },
|
||||
props: { module, type }
|
||||
})));
|
||||
}
|
||||
|
||||
const { module, type } = Astro.props;
|
||||
|
||||
const superLink = type.super ? getQMLTypeLink(type.super) : null;
|
||||
|
||||
const details = type.details
|
||||
? await processMarkdown(type.details)
|
||||
: null;
|
||||
---
|
||||
<DocsLayout title={`${module.name} - ${type.name}`} description={type.description ?? ""} type={type}>
|
||||
<div class="docs">
|
||||
<div class="docs-content typedocs-content">
|
||||
<hr />
|
||||
<section class="typedocs-title">
|
||||
<h2 class="typedocs-title-text" data-pagefind-weight="10">
|
||||
{type.name}:
|
||||
{type.super?.name ? (
|
||||
<a
|
||||
href={superLink!}
|
||||
data-pagefind-ignore
|
||||
>
|
||||
{type.super.name}
|
||||
</a>
|
||||
):(
|
||||
<span class="type-datatype" data-pagefind-ignore>{type.name}</span>
|
||||
)
|
||||
}
|
||||
</h2>
|
||||
{type.flags && (
|
||||
<div class="type-flags" data-pagefind-ignore>{type.flags.map(flag => (
|
||||
<Badge badgeText={flag}/>
|
||||
))}</div>
|
||||
)}
|
||||
</section>
|
||||
<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="toparse">{type.description}</span>)}
|
||||
</subheading>
|
||||
{ Object.keys(type.properties ?? {}).length != 0 && (
|
||||
<h2>Properties <a href="/docs/guide/qml-language#properties">[?]</a></h2>
|
||||
<Properties props={type.properties!}/>
|
||||
)}
|
||||
{ (type.functions?.length ?? 0) != 0 && (
|
||||
<h2>Functions <a href="/docs/guide/qml-language#functions">[?]</a></h2>
|
||||
<Functions
|
||||
funcData={type.functions!}
|
||||
/>
|
||||
)}
|
||||
{ Object.keys(type.signals ?? {}).length != 0 && (
|
||||
<h2>Signals <a href="/docs/guide/qml-language#signals">[?]</a></h2>
|
||||
<Signals
|
||||
signals={type.signals!}
|
||||
/>
|
||||
)}
|
||||
{ Object.keys(type.variants ?? {}).length != 0 && (
|
||||
<h2>Variants</h2>
|
||||
<Variants
|
||||
variants={type.variants!}
|
||||
/>
|
||||
)}
|
||||
</section>
|
||||
</div>
|
||||
<TOC mobile={false} type={type} data-pagefind-ignore/>
|
||||
</div>
|
||||
</DocsLayout>
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue