the great typeinfo unfuckening

This commit is contained in:
outfoxxed 2025-07-21 17:15:39 -07:00
parent db63f5639f
commit 49fed51ced
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
15 changed files with 233 additions and 365 deletions

View 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>

View file

@ -0,0 +1,44 @@
---
import DocsLayout from "@layouts/DocsLayout.astro";
import { getModulesData } from "@config/io/generateTypeData";
import { processMarkdown } from "@src/config/io/markdown";
export async function getStaticPaths() {
const modules = await getModulesData();
return modules.map(module => ({
params: { module: module.name },
props: { module },
}));
}
const { module } = Astro.props;
const details = module.details
? await processMarkdown(module.details)
: null;
---
<DocsLayout
title={module.name + " Module Types"}
description="Quickshell Type Documentation"
>
<div class="docs-content">
<hr />
<h2 class="typedocs-title">{module.name} Definitions</h2>
<section>
<span>{module.description}</span>
<div class="root-nav" data-pagefind-ignore>
{module.types.map(type =>
(
<div class="root-nav-entry">
<a class="root-nav-link" href={`/docs/types/${module.name}/${type.name}`}>
{type.name}
</a>
<span class="root-nav-desc">{type.description}</span>
</div>
)
)}
</div>
{details && <span class="parsedMD" set:html={details}/>}
</section>
</div>
</DocsLayout>

View file

@ -1,120 +0,0 @@
---
import { getQMLTypeLink } from "@config/io/helpers";
import { processMarkdown } from "@config/io/markdown";
import { getTypeData } 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 routes = await getTypeData();
return routes
.filter(route => route.name !== "index")
.map(route => ({
params: { type: route.type, name: route.name },
props: { route },
}));
}
const { route } = Astro.props;
const data = route.data;
const sidebarFunctions =
data.functions?.map(item => item.name) || null;
const propsKeys = data.properties
? Object.keys(data.properties).toSorted()
: null;
const signalKeys = data.signals
? Object.keys(data.signals).toSorted()
: null;
const variantKeys = data.variants
? Object.keys(data.variants).toSorted()
: null;
const sidebarData = {
properties: propsKeys,
functions: sidebarFunctions,
signals: signalKeys,
variants: variantKeys,
};
const superLink = data.super ? getQMLTypeLink(data.super) : null;
const details = data.details
? await processMarkdown(data.details)
: null;
---
<DocsLayout title={`${route.name} - ${route.type}`} description={data?.description ?? ""}>
<div class="docs">
<div class="docs-content typedocs-content">
<hr />
<section class="typedocs-title">
<h2 class="typedocs-title-text" data-pagefind-weight="10">
{route.name}:
{data.super?.name ? (
<a
href={superLink!}
data-pagefind-ignore
>
{data.super.name}
</a>
):(
<span class="type-datatype" data-pagefind-ignore>{data.type}</span>
)
}
</h2>
{data && data.flags ? (
<div class="type-flags" data-pagefind-ignore>{data.flags.map(flag => (
<Badge badgeText={flag}/>
))}</div>
):null}
</section>
<code class="type-module" data-pagefind-ignore>import {data.module}</code>
{
route && data ? (
<section class="typedocs-data typedata">
<subheading class="typedocs-subheading">
{details ? <span class="parsedMD" set:html={details}/> : (<span class="toparse">{data.description}</span>)}
</subheading>
{ data.properties && propsKeys && propsKeys.length > 0 && (
<h2>Properties <a href="/docs/guide/qml-language#properties">[?]</a></h2>
<Properties
propsData={data.properties}
propsKeys={propsKeys!}
/>
)}
{ data.functions && data.functions.length > 0 && (
<h2>Functions <a href="/docs/guide/qml-language#functions">[?]</a></h2>
<Functions
funcData={data.functions}
/>
)}
{ data.signals && signalKeys && signalKeys.length > 0 && (
<h2>Signals <a href="/docs/guide/qml-language#signals">[?]</a></h2>
<Signals
signalsData={data.signals}
signalKeys={signalKeys}
/>
)}
{ data.variants && variantKeys && variantKeys.length > 0 && (
<h2>Variants</h2>
<Variants
variantsData={data.variants}
variantKeys={variantKeys}
/>
)}
</section>
) : null
}
</div>
<TOC mobile={false} types={sidebarData} data-pagefind-ignore/>
</div>
</DocsLayout>

View file

@ -1,59 +0,0 @@
---
import DocsLayout from "@layouts/DocsLayout.astro";
import { getTypeData } from "@config/io/generateTypeData";
import { processMarkdown } from "@src/config/io/markdown";
export async function getStaticPaths() {
const routes = await getTypeData();
return routes
.filter(route => route.name === "index")
.map(route => {
const children: { [key: string]: string } = {};
route.data.contains?.map(childName =>
routes
.filter(route => route.name !== "index")
.filter(childData => childData.name === childName)
.map(childData => {
children[childName] = childData.data.description;
})
);
return {
params: { type: route.type, name: route.type },
props: { route, children },
};
});
}
const { route, children } = Astro.props;
const details = route.data.details
? await processMarkdown(route.data.details)
: null;
---
<DocsLayout
title={route.type + " Module Types"}
description="Quickshell Type Documentation"
>
<div class="docs-content">
<hr />
<h2 class="typedocs-title">{route.type[0].toUpperCase() + route.type.slice(1)} Definitions</h2>
<section>
<span>{route.data.description}</span>
<div class="root-nav" data-pagefind-ignore>
{route.data.contains!.map((childName:string) =>
(
<div class="root-nav-entry">
<a class="root-nav-link" href={`/docs/types/${route.data.module === "index"
? route.data.name
: route.data.module}/${childName}`}>
{childName}
</a>
<span class="root-nav-desc">{children[childName] || "See Configuration"}</span>
</div>
)
)}
</div>
{details && <span class="parsedMD" set:html={details}/>}
</section>
</div>
</DocsLayout>

View file

@ -1,10 +1,8 @@
---
import DocsLayout from "@layouts/DocsLayout.astro";
import { getTypeData } from "@config/io/generateTypeData";
import { getModulesData } from "@config/io/generateTypeData";
const routes = await getTypeData();
const modules = [...new Set(routes.map(route => route.type))];
const modules = await getModulesData();
---
<DocsLayout title="Quickshell Module Listing" description="Quickshell Type Documentation">
<div class="docs-content">
@ -13,18 +11,14 @@ const modules = [...new Set(routes.map(route => route.type))];
<section>
<span>All modules included with Quickshell</span>
<div class="root-nav" data-pagefind-ignore>
{modules.map(moduleEntry => {
const indexData = routes.filter(route => route.name === "index")
const indexSingled = indexData.filter(indexEntry => indexEntry.type === moduleEntry)[0]
const description = indexSingled.data.description
return (
{modules.map(module => (
<div class="root-nav-entry">
<a class="root-nav-link" href={`/docs/types/${moduleEntry}`}>
{moduleEntry}
<a class="root-nav-link" href={`/docs/types/${module.name}`}>
{module.name}
</a>
<span class="root-nav-desc">{description}</span>
<span class="root-nav-desc">{module.description}</span>
</div>)
})}
)}
</div>
</section>
</div>