the great typeinfo unfuckening
This commit is contained in:
parent
db63f5639f
commit
49fed51ced
15 changed files with 233 additions and 365 deletions
|
|
@ -1,15 +1,23 @@
|
|||
---
|
||||
import TableOfContents from "./toc";
|
||||
import type { ConfigHeading, TypeTOC } from "./types.d.ts";
|
||||
import type { TypeData } from "@config/io/types";
|
||||
|
||||
export interface Props {
|
||||
title?: string;
|
||||
headings?: ConfigHeading[];
|
||||
types?: TypeTOC;
|
||||
type?: TypeData;
|
||||
mobile: boolean;
|
||||
}
|
||||
|
||||
const { title, headings, types, mobile } = Astro.props;
|
||||
const { title, headings, type, mobile } = Astro.props;
|
||||
|
||||
const types: TypeTOC | null = type ? {
|
||||
properties: Object.keys(type.properties ?? {}),
|
||||
functions: (type.functions ?? []).map(f => f.name),
|
||||
signals: Object.keys(type.signals ?? {}),
|
||||
variants: Object.keys(type.variants ?? {}),
|
||||
} : null;
|
||||
---
|
||||
{((headings?.length ?? 0) != 0 || types) &&
|
||||
<div id="toc" aria-mobile={mobile} class=`toc-wrapper${mobile ? "-mobile":""}`>
|
||||
|
|
|
|||
|
|
@ -7,15 +7,13 @@ export interface Props {
|
|||
|
||||
const { currentRoute, currentModule, currentClass } = Astro.props;
|
||||
|
||||
import { getTypeData } from "@config/io/generateTypeData";
|
||||
import { groupRoutes } from "@config/io/helpers";
|
||||
import { getModulesData } from "@config/io/generateTypeData";
|
||||
import type { TreeEntry } from "./Tree.astro";
|
||||
import Tree from "./Tree.astro";
|
||||
import Link from "./Link.astro";
|
||||
import VersionSelector from "./VersionSelector.astro"
|
||||
|
||||
const routes = await getTypeData();
|
||||
const groupedRoutes = groupRoutes(routes);
|
||||
const modules = await getModulesData();
|
||||
|
||||
import { getCollection } from "astro:content";
|
||||
const guidePages = await getCollection("guide");
|
||||
|
|
@ -45,18 +43,16 @@ const types = {
|
|||
title: "Quickshell Types",
|
||||
link: "/docs/types",
|
||||
current: currentRoute?.startsWith("types") ?? false,
|
||||
entries: Object.entries(groupedRoutes.types).map(
|
||||
([module, items]) => ({
|
||||
title: module,
|
||||
link: `/docs/types/${module}`,
|
||||
current: currentModule === module,
|
||||
entries: items.map(type => ({
|
||||
title: type.name,
|
||||
link: `/docs/types/${module}/${type.name}`,
|
||||
current: currentClass === type.name,
|
||||
})),
|
||||
})
|
||||
),
|
||||
entries: modules.map(module => ({
|
||||
title: module.name,
|
||||
link: `/docs/types/${module.name}`,
|
||||
current: currentModule === module.name,
|
||||
entries: module.types.map(type => ({
|
||||
title: type.name,
|
||||
link: `/docs/types/${module.name}/${type.name}`,
|
||||
current: currentClass === type.name,
|
||||
}))
|
||||
}))
|
||||
};
|
||||
|
||||
---
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue