the great typeinfo unfuckening
This commit is contained in:
		
							parent
							
								
									db63f5639f
								
							
						
					
					
						commit
						49fed51ced
					
				
					 15 changed files with 233 additions and 365 deletions
				
			
		| 
						 | 
					@ -1,48 +1,18 @@
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
import { ThemeSelect } from "@components/hooks/ThemeSwitch";
 | 
					import { ThemeSelect } from "@components/hooks/ThemeSwitch";
 | 
				
			||||||
import { getTypeData } from "@config/io/generateTypeData";
 | 
					import type { TypeData } from "@config/io/types";
 | 
				
			||||||
import Nav from "@components/navigation/sidebars/nav/index.astro";
 | 
					import Nav from "@components/navigation/sidebars/nav/index.astro";
 | 
				
			||||||
import TOC from "@components/navigation/sidebars/TOC.astro";
 | 
					import TOC from "@components/navigation/sidebars/TOC.astro";
 | 
				
			||||||
import type { TypeTOC } from "./navigation/sidebars/types";
 | 
					import type { ConfigHeading } from "@components/navigation/sidebars/types";
 | 
				
			||||||
import Search from "./navigation/Search.astro";
 | 
					import Search from "./navigation/Search.astro";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const routes = await getTypeData();
 | 
					interface Props {
 | 
				
			||||||
 | 
					  title?: string;
 | 
				
			||||||
const url = Astro.url.pathname.split("/");
 | 
					  headings?: ConfigHeading[];
 | 
				
			||||||
const currentClass = url[4];
 | 
					  type?: TypeData;
 | 
				
			||||||
const currentData = routes.find(
 | 
					 | 
				
			||||||
  item => item.name === currentClass
 | 
					 | 
				
			||||||
);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const data = currentData?.data;
 | 
					 | 
				
			||||||
const tocFunctions =
 | 
					 | 
				
			||||||
  data?.functions?.map(item => item.name) || null;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const propsKeys = data?.properties
 | 
					 | 
				
			||||||
  ? Object.keys(data.properties)
 | 
					 | 
				
			||||||
  : null;
 | 
					 | 
				
			||||||
const signalKeys = data?.signals
 | 
					 | 
				
			||||||
  ? Object.keys(data.signals)
 | 
					 | 
				
			||||||
  : null;
 | 
					 | 
				
			||||||
const variantKeys = data?.variants
 | 
					 | 
				
			||||||
  ? Object.keys(data.variants)
 | 
					 | 
				
			||||||
  : null;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
let sidebarData: TypeTOC | undefined = {
 | 
					 | 
				
			||||||
  properties: propsKeys,
 | 
					 | 
				
			||||||
  functions: tocFunctions,
 | 
					 | 
				
			||||||
  signals: signalKeys,
 | 
					 | 
				
			||||||
  variants: variantKeys,
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if (!data) {
 | 
					 | 
				
			||||||
  sidebarData = undefined;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const {
 | 
					const { title, headings, type } = Astro.props;
 | 
				
			||||||
  title = null,
 | 
					 | 
				
			||||||
  headings = [],
 | 
					 | 
				
			||||||
} = Astro.props;
 | 
					 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
<div class="header">
 | 
					<div class="header">
 | 
				
			||||||
  <div class="header-item header-left">
 | 
					  <div class="header-item header-left">
 | 
				
			||||||
| 
						 | 
					@ -54,6 +24,6 @@ const {
 | 
				
			||||||
  <div class="header-item header-right">
 | 
					  <div class="header-item header-right">
 | 
				
			||||||
    <Search/>
 | 
					    <Search/>
 | 
				
			||||||
    <ThemeSelect client:load />
 | 
					    <ThemeSelect client:load />
 | 
				
			||||||
    <TOC title={title} headings={headings} types={sidebarData} mobile={true}/>
 | 
					    <TOC title={title} headings={headings} type={type} mobile={true}/>
 | 
				
			||||||
  </div>
 | 
					  </div>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,15 +1,23 @@
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
import TableOfContents from "./toc";
 | 
					import TableOfContents from "./toc";
 | 
				
			||||||
import type { ConfigHeading, TypeTOC } from "./types.d.ts";
 | 
					import type { ConfigHeading, TypeTOC } from "./types.d.ts";
 | 
				
			||||||
 | 
					import type { TypeData } from "@config/io/types";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface Props {
 | 
					export interface Props {
 | 
				
			||||||
  title?: string;
 | 
					  title?: string;
 | 
				
			||||||
  headings?: ConfigHeading[];
 | 
					  headings?: ConfigHeading[];
 | 
				
			||||||
  types?: TypeTOC;
 | 
					  type?: TypeData;
 | 
				
			||||||
  mobile: boolean;
 | 
					  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) &&
 | 
					{((headings?.length ?? 0) != 0 || types) &&
 | 
				
			||||||
  <div id="toc" aria-mobile={mobile} class=`toc-wrapper${mobile ? "-mobile":""}`>
 | 
					  <div id="toc" aria-mobile={mobile} class=`toc-wrapper${mobile ? "-mobile":""}`>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,15 +7,13 @@ export interface Props {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const { currentRoute, currentModule, currentClass } = Astro.props;
 | 
					const { currentRoute, currentModule, currentClass } = Astro.props;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { getTypeData } from "@config/io/generateTypeData";
 | 
					import { getModulesData } from "@config/io/generateTypeData";
 | 
				
			||||||
import { groupRoutes } from "@config/io/helpers";
 | 
					 | 
				
			||||||
import type { TreeEntry } from "./Tree.astro";
 | 
					import type { TreeEntry } from "./Tree.astro";
 | 
				
			||||||
import Tree from "./Tree.astro";
 | 
					import Tree from "./Tree.astro";
 | 
				
			||||||
import Link from "./Link.astro";
 | 
					import Link from "./Link.astro";
 | 
				
			||||||
import VersionSelector from "./VersionSelector.astro"
 | 
					import VersionSelector from "./VersionSelector.astro"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const routes = await getTypeData();
 | 
					const modules = await getModulesData();
 | 
				
			||||||
const groupedRoutes = groupRoutes(routes);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { getCollection } from "astro:content";
 | 
					import { getCollection } from "astro:content";
 | 
				
			||||||
const guidePages = await getCollection("guide");
 | 
					const guidePages = await getCollection("guide");
 | 
				
			||||||
| 
						 | 
					@ -45,18 +43,16 @@ const types = {
 | 
				
			||||||
  title: "Quickshell Types",
 | 
					  title: "Quickshell Types",
 | 
				
			||||||
  link: "/docs/types",
 | 
					  link: "/docs/types",
 | 
				
			||||||
  current: currentRoute?.startsWith("types") ?? false,
 | 
					  current: currentRoute?.startsWith("types") ?? false,
 | 
				
			||||||
  entries: Object.entries(groupedRoutes.types).map(
 | 
					  entries: modules.map(module => ({
 | 
				
			||||||
    ([module, items]) => ({
 | 
					    title: module.name,
 | 
				
			||||||
      title: module,
 | 
					    link: `/docs/types/${module.name}`,
 | 
				
			||||||
      link: `/docs/types/${module}`,
 | 
					    current: currentModule === module.name,
 | 
				
			||||||
      current: currentModule === module,
 | 
					    entries: module.types.map(type => ({
 | 
				
			||||||
      entries: items.map(type => ({
 | 
					      title: type.name,
 | 
				
			||||||
        title: type.name,
 | 
					      link: `/docs/types/${module.name}/${type.name}`,
 | 
				
			||||||
        link: `/docs/types/${module}/${type.name}`,
 | 
					      current: currentClass === type.name,
 | 
				
			||||||
        current: currentClass === type.name,
 | 
					    }))
 | 
				
			||||||
      })),
 | 
					  }))
 | 
				
			||||||
    })
 | 
					 | 
				
			||||||
  ),
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,22 +4,20 @@ import type {
 | 
				
			||||||
  QMLTypeLinkObject,
 | 
					  QMLTypeLinkObject,
 | 
				
			||||||
  QuickshellProps,
 | 
					  QuickshellProps,
 | 
				
			||||||
} from "@config/io/types";
 | 
					} from "@config/io/types";
 | 
				
			||||||
import { Tag, Flag } from "@icons";
 | 
					import { Tag } from "@icons";
 | 
				
			||||||
import TypeTitle from "./TypeTitle.astro";
 | 
					import TypeTitle from "./TypeTitle.astro";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import TypeDetails from "./TypeDetails.astro";
 | 
					import TypeDetails from "./TypeDetails.astro";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface Props {
 | 
					export interface Props {
 | 
				
			||||||
  propsKeys: string[];
 | 
					  props: QuickshellProps;
 | 
				
			||||||
  propsData: QuickshellProps;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const { propsKeys, propsData } = Astro.props;
 | 
					const { props } = Astro.props;
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
<ul class="typedata typeprops">
 | 
					<ul class="typedata typeprops">
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    propsKeys.map(item => {
 | 
					    Object.entries(props).map(([name, propData]) => {
 | 
				
			||||||
      const propData = propsData[item]
 | 
					 | 
				
			||||||
      let typeLink:string;
 | 
					      let typeLink:string;
 | 
				
			||||||
      let linkText:string;
 | 
					      let linkText:string;
 | 
				
			||||||
      let genericType:string|undefined;
 | 
					      let genericType:string|undefined;
 | 
				
			||||||
| 
						 | 
					@ -37,10 +35,10 @@ const { propsKeys, propsData } = Astro.props;
 | 
				
			||||||
        genericTypeLink = getQMLTypeLink(propData.type.of)
 | 
					        genericTypeLink = getQMLTypeLink(propData.type.of)
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      return (
 | 
					      return (
 | 
				
			||||||
        <li id={ item } class="typedata-root typeprop-root">
 | 
					        <li id={ name } class="typedata-root typeprop-root">
 | 
				
			||||||
          <TypeTitle
 | 
					          <TypeTitle
 | 
				
			||||||
            typekind="prop"
 | 
					            typekind="prop"
 | 
				
			||||||
            typename={item}
 | 
					            typename={name}
 | 
				
			||||||
            typelink={typeLink}
 | 
					            typelink={typeLink}
 | 
				
			||||||
            typelink_text={linkText}
 | 
					            typelink_text={linkText}
 | 
				
			||||||
            typename_generic={genericType}
 | 
					            typename_generic={genericType}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,30 +1,28 @@
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
import type { QuickshellSignal } from "@config/io/types";
 | 
					import type { QuickshellSignal } from "@config/io/types";
 | 
				
			||||||
import { Tag, PowerCord } from "@icons";
 | 
					import { Tag } from "@icons";
 | 
				
			||||||
import TypeDetails from "./TypeDetails.astro";
 | 
					import TypeDetails from "./TypeDetails.astro";
 | 
				
			||||||
import TypeTitle from "./TypeTitle.astro";
 | 
					import TypeTitle from "./TypeTitle.astro";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface Props {
 | 
					export interface Props {
 | 
				
			||||||
  signalKeys: string[];
 | 
					  signals: QuickshellSignal;
 | 
				
			||||||
  signalsData: QuickshellSignal;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const { signalKeys, signalsData } = Astro.props;
 | 
					const { signals } = Astro.props;
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
<ul class="typedata typesignals">
 | 
					<ul class="typedata typesignals">
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    signalKeys.map(item => {
 | 
					    Object.entries(signals).map(([name, signalData]) => {
 | 
				
			||||||
      const signalData = signalsData[item];
 | 
					 | 
				
			||||||
      const paramKeys = signalData.params.length > 0 ? signalData.params.map((param,index) => `${param.name}${index !== signalData.params.length -1 ? ", ":""}`) : []
 | 
					      const paramKeys = signalData.params.length > 0 ? signalData.params.map((param,index) => `${param.name}${index !== signalData.params.length -1 ? ", ":""}`) : []
 | 
				
			||||||
      let genericType:string|undefined;
 | 
					      let genericType:string|undefined;
 | 
				
			||||||
      let genericTypeLink:string|undefined;
 | 
					      let genericTypeLink:string|undefined;
 | 
				
			||||||
      return (
 | 
					      return (
 | 
				
			||||||
        <li id={ item } class="typedata-root typesignal-root">
 | 
					        <li id={ name } class="typedata-root typesignal-root">
 | 
				
			||||||
          <TypeTitle
 | 
					          <TypeTitle
 | 
				
			||||||
            typekind="signal"
 | 
					            typekind="signal"
 | 
				
			||||||
            typename={item}
 | 
					            typename={name}
 | 
				
			||||||
            typelink="/docs/configuration/qml-overview#-signals"
 | 
					            typelink="/docs/configuration/qml-overview#-signals"
 | 
				
			||||||
            typelink_text={"?"}
 | 
					            typelink_text=""
 | 
				
			||||||
            typename_generic={genericType}
 | 
					            typename_generic={genericType}
 | 
				
			||||||
            typelink_generic={genericTypeLink}
 | 
					            typelink_generic={genericTypeLink}
 | 
				
			||||||
            typedata_params={paramKeys}
 | 
					            typedata_params={paramKeys}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,28 +1,25 @@
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
import type { QuickshellVariant } from "@config/io/types";
 | 
					import type { QuickshellVariant } from "@config/io/types";
 | 
				
			||||||
import { FourDiamonds } from "../icons";
 | 
					 | 
				
			||||||
import TypeDetails from "./TypeDetails.astro";
 | 
					import TypeDetails from "./TypeDetails.astro";
 | 
				
			||||||
import TypeTitle from "./TypeTitle.astro";
 | 
					import TypeTitle from "./TypeTitle.astro";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface Props {
 | 
					export interface Props {
 | 
				
			||||||
  variantKeys: string[];
 | 
					  variants: QuickshellVariant;
 | 
				
			||||||
  variantsData: QuickshellVariant;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const { variantKeys, variantsData } = Astro.props;
 | 
					const { variants } = Astro.props;
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
<ul class="typedata typevariants">
 | 
					<ul class="typedata typevariants">
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    variantKeys.map(item => {
 | 
					    Object.entries(variants).map(([name, variantData]) => {
 | 
				
			||||||
      const variantData = variantsData[item];
 | 
					 | 
				
			||||||
      const paramKeys = variantData.params && variantData.params.length > 0
 | 
					      const paramKeys = variantData.params && variantData.params.length > 0
 | 
				
			||||||
        ? variantData.params.map(param => param.name)
 | 
					        ? variantData.params.map(param => param.name)
 | 
				
			||||||
        : [];
 | 
					        : [];
 | 
				
			||||||
      return (
 | 
					      return (
 | 
				
			||||||
        <li id={ item } class="typedata-root typevariant-root">
 | 
					        <li id={ name } class="typedata-root typevariant-root">
 | 
				
			||||||
          <TypeTitle 
 | 
					          <TypeTitle 
 | 
				
			||||||
            typekind="variant"
 | 
					            typekind="variant"
 | 
				
			||||||
            typename={item}
 | 
					            typename={name}
 | 
				
			||||||
            typelink=""
 | 
					            typelink=""
 | 
				
			||||||
            typelink_text=""
 | 
					            typelink_text=""
 | 
				
			||||||
          />
 | 
					          />
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,57 +1,41 @@
 | 
				
			||||||
import { promises as fs } from "node:fs";
 | 
					import { promises as fs } from "node:fs";
 | 
				
			||||||
import path from "node:path";
 | 
					import path from "node:path";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import type { RouteData, dirData } from "./types";
 | 
					import type { VersionsData, ModuleData } from "./types";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function readSubdir(basePath: string, subdir: string): Promise<dirData[]> {
 | 
					async function readModulesData(basePath: string): Promise<ModuleData[]> {
 | 
				
			||||||
  const fullpath = path.join(basePath, subdir);
 | 
					  const moduleDirs = await fs.readdir(basePath);
 | 
				
			||||||
  const filenames = await fs.readdir(fullpath);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const data = await Promise.all(
 | 
					  const modules = await Promise.all(moduleDirs.map(async moduleDir => {
 | 
				
			||||||
    filenames.map(async filename => {
 | 
					    const modulePath = path.join(basePath, moduleDir);
 | 
				
			||||||
      const filepath = path.join(fullpath, filename);
 | 
					 | 
				
			||||||
      const content = await fs.readFile(filepath, "utf8");
 | 
					 | 
				
			||||||
      const data = JSON.parse(content);
 | 
					 | 
				
			||||||
      if (typeof data.module === "undefined") {
 | 
					 | 
				
			||||||
        data.module = "index";
 | 
					 | 
				
			||||||
        data.contains = filenames
 | 
					 | 
				
			||||||
          .filter(filename => filename !== "index.json")
 | 
					 | 
				
			||||||
          .map(filename => filename.replace(".json", ""));
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      const returnValue = {
 | 
					 | 
				
			||||||
        fullpath: path.join(fullpath, filename),
 | 
					 | 
				
			||||||
        filename: filename.replace(".json", ""),
 | 
					 | 
				
			||||||
        category: subdir,
 | 
					 | 
				
			||||||
        data: data,
 | 
					 | 
				
			||||||
      };
 | 
					 | 
				
			||||||
      return returnValue;
 | 
					 | 
				
			||||||
    })
 | 
					 | 
				
			||||||
  );
 | 
					 | 
				
			||||||
  return data;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function generateTypeData(basePath: string): Promise<RouteData[]> {
 | 
					    const indexPromise = async () => {
 | 
				
			||||||
  const subdirs = await fs.readdir(basePath, {
 | 
					      const indexPath = path.join(modulePath, "index.json");
 | 
				
			||||||
    withFileTypes: true,
 | 
					      const indexContent = await fs.readFile(indexPath, "utf8");
 | 
				
			||||||
  });
 | 
					      return JSON.parse(indexContent);
 | 
				
			||||||
  const routes: RouteData[] = [];
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  for (const subdir of subdirs) {
 | 
					    const typeNames = (await fs.readdir(modulePath)).filter(name => name !== "index.json");
 | 
				
			||||||
    const data = await readSubdir(basePath, subdir.name);
 | 
					    const typePromises = typeNames.map(async fileName => {
 | 
				
			||||||
    const returnValue = data.map(entry => {
 | 
					      const typePath = path.join(modulePath, fileName);
 | 
				
			||||||
      return {
 | 
					      const fileContent = await fs.readFile(typePath, "utf8");
 | 
				
			||||||
        type: entry.category,
 | 
					      return JSON.parse(fileContent);
 | 
				
			||||||
        name: entry.filename,
 | 
					 | 
				
			||||||
        path: entry.fullpath,
 | 
					 | 
				
			||||||
        data: entry.data,
 | 
					 | 
				
			||||||
      };
 | 
					 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    routes.push(...returnValue);
 | 
					
 | 
				
			||||||
  }
 | 
					    const [index, ...types] = await Promise.all([indexPromise(), ...typePromises]);
 | 
				
			||||||
  return routes;
 | 
					
 | 
				
			||||||
 | 
					    return {
 | 
				
			||||||
 | 
					      name: index.name,
 | 
				
			||||||
 | 
					      description: index.description,
 | 
				
			||||||
 | 
					      details: index.details,
 | 
				
			||||||
 | 
					      types,
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return modules;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function generateVersionsData(): Promise<VersionsData> {
 | 
					async function readVersionsData(): Promise<VersionsData> {
 | 
				
			||||||
  const versionsPath = import.meta.env.VERSION_FILE_PATH;
 | 
					  const versionsPath = import.meta.env.VERSION_FILE_PATH;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!versionsPath || versionsPath === "") {
 | 
					  if (!versionsPath || versionsPath === "") {
 | 
				
			||||||
| 
						 | 
					@ -63,9 +47,9 @@ async function generateVersionsData(): Promise<VersionsData> {
 | 
				
			||||||
  const content = await fs.readFile(versionsPath, "utf8");
 | 
					  const content = await fs.readFile(versionsPath, "utf8");
 | 
				
			||||||
  const data = JSON.parse(content);
 | 
					  const data = JSON.parse(content);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const versions = await Promise.all(data.versions.map(async d => ({
 | 
					  const versions = await Promise.all(data.versions.map(async (d: { name: string, types: any }) => ({
 | 
				
			||||||
    name: d.name,
 | 
					    name: d.name,
 | 
				
			||||||
    modules: await generateTypeData(d.types),
 | 
					    modules: await readModulesData(d.types),
 | 
				
			||||||
  })))
 | 
					  })))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return {
 | 
					  return {
 | 
				
			||||||
| 
						 | 
					@ -78,13 +62,13 @@ let globalVersionsData: Promise<VersionsData>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export function getVersionsData(): Promise<VersionsData> {
 | 
					export function getVersionsData(): Promise<VersionsData> {
 | 
				
			||||||
  if (!globalVersionsData) {
 | 
					  if (!globalVersionsData) {
 | 
				
			||||||
    globalVersionsData = generateVersionsData();
 | 
					    globalVersionsData = readVersionsData();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return globalVersionsData;
 | 
					  return globalVersionsData;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export async function getTypeData(): RouteData[] {
 | 
					export async function getModulesData(): Promise<ModuleData[]> {
 | 
				
			||||||
  const versions = await getVersionsData();
 | 
					  const versions = await getVersionsData();
 | 
				
			||||||
  return versions.versions.find(v => v.name == versions.default).modules;
 | 
					  return versions.versions.find(v => v.name == versions.default)!.modules;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,9 +9,8 @@ import {
 | 
				
			||||||
import type {
 | 
					import type {
 | 
				
			||||||
  ConfigHeading,
 | 
					  ConfigHeading,
 | 
				
			||||||
  ConfigTOC,
 | 
					  ConfigTOC,
 | 
				
			||||||
  GroupedRoutes,
 | 
					 | 
				
			||||||
} from "@components/navigation/sidebars/types";
 | 
					} from "@components/navigation/sidebars/types";
 | 
				
			||||||
import type { QMLTypeLinkObject, RouteData } from "./types";
 | 
					import type { QMLTypeLinkObject } from "./types";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export function buildHierarchy(headings: ConfigHeading[]) {
 | 
					export function buildHierarchy(headings: ConfigHeading[]) {
 | 
				
			||||||
  const toc: ConfigTOC[] = [];
 | 
					  const toc: ConfigTOC[] = [];
 | 
				
			||||||
| 
						 | 
					@ -43,23 +42,6 @@ export function buildHierarchy(headings: ConfigHeading[]) {
 | 
				
			||||||
  return toc;
 | 
					  return toc;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export function groupRoutes(routes: RouteData[]): GroupedRoutes {
 | 
					 | 
				
			||||||
  const froutes = routes.filter(route => route.name !== "index");
 | 
					 | 
				
			||||||
  return froutes.reduce<GroupedRoutes>((acc, route) => {
 | 
					 | 
				
			||||||
    if (!acc.types) acc.types = {};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (!acc.types[route.type]) {
 | 
					 | 
				
			||||||
      acc.types[route.type] = [];
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    acc.types[route.type].push({
 | 
					 | 
				
			||||||
      name: route.name,
 | 
					 | 
				
			||||||
      type: route.type,
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
    return acc;
 | 
					 | 
				
			||||||
  }, { types: {} });
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export function getQMLTypeLinkObject(unparsed: string) {
 | 
					export function getQMLTypeLinkObject(unparsed: string) {
 | 
				
			||||||
  const isLocal = unparsed.startsWith("MQS_") ? "local" : false;
 | 
					  const isLocal = unparsed.startsWith("MQS_") ? "local" : false;
 | 
				
			||||||
  const isQT = unparsed.startsWith("MQT_") ? "qt" : false;
 | 
					  const isQT = unparsed.startsWith("MQT_") ? "qt" : false;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										32
									
								
								src/config/io/types.d.ts
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										32
									
								
								src/config/io/types.d.ts
									
										
									
									
										vendored
									
									
								
							| 
						 | 
					@ -61,9 +61,7 @@ export interface QuickshellVariant {
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface QuickshellData {
 | 
					export interface TypeData {
 | 
				
			||||||
  type: string;
 | 
					 | 
				
			||||||
  module: string;
 | 
					 | 
				
			||||||
  name: string;
 | 
					  name: string;
 | 
				
			||||||
  description: string;
 | 
					  description: string;
 | 
				
			||||||
  details: string;
 | 
					  details: string;
 | 
				
			||||||
| 
						 | 
					@ -77,33 +75,22 @@ export interface QuickshellData {
 | 
				
			||||||
  subtypes?: QuickshellData[];
 | 
					  subtypes?: QuickshellData[];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface RouteData {
 | 
					export interface ModuleData {
 | 
				
			||||||
  // priority 1: Quickshell, Quickshell.Io, etc.
 | 
					 | 
				
			||||||
  type: string;
 | 
					 | 
				
			||||||
  // priority 1.1: entry name (e.g. DataStreamParser)
 | 
					 | 
				
			||||||
  name: string;
 | 
					  name: string;
 | 
				
			||||||
  // path to json
 | 
					  description: string;
 | 
				
			||||||
  path: string;
 | 
					  details: string;
 | 
				
			||||||
  // data content of the route
 | 
					  types: TypeData[];
 | 
				
			||||||
  data: QuickshellData;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface VersionData {
 | 
					export interface VersionData {
 | 
				
			||||||
  name: string;
 | 
					  name: string;
 | 
				
			||||||
  modules: RouteData[];
 | 
					  modules: ModuleData[];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface VersionsData {
 | 
					export interface VersionsData {
 | 
				
			||||||
  default: string;
 | 
					  default: string;
 | 
				
			||||||
  versions: VersionData[];
 | 
					  versions: VersionData[];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
export interface dirData {
 | 
					 | 
				
			||||||
  fullpath: string;
 | 
					 | 
				
			||||||
  filename: string;
 | 
					 | 
				
			||||||
  category: string;
 | 
					 | 
				
			||||||
  data: QuickshellData;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
// --
 | 
					// --
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// helpers.ts
 | 
					// helpers.ts
 | 
				
			||||||
| 
						 | 
					@ -124,8 +111,9 @@ export type {
 | 
				
			||||||
  QuickshellFunction,
 | 
					  QuickshellFunction,
 | 
				
			||||||
  QuickshellSignal,
 | 
					  QuickshellSignal,
 | 
				
			||||||
  QuickshellVariant,
 | 
					  QuickshellVariant,
 | 
				
			||||||
  QuickshellData,
 | 
					  TypeData,
 | 
				
			||||||
  RouteData,
 | 
					  ModuleData,
 | 
				
			||||||
  dirData,
 | 
					  VersionData,
 | 
				
			||||||
 | 
					  VersionsData,
 | 
				
			||||||
  QMLTypeLinkObject,
 | 
					  QMLTypeLinkObject,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,14 +9,16 @@ import Head from "@config/Head.astro";
 | 
				
			||||||
import Nav from "@components/navigation/sidebars/nav/index.astro";
 | 
					import Nav from "@components/navigation/sidebars/nav/index.astro";
 | 
				
			||||||
import type { ConfigHeading } from "@src/components/navigation/sidebars/types";
 | 
					import type { ConfigHeading } from "@src/components/navigation/sidebars/types";
 | 
				
			||||||
import Footer from "@src/components/Footer.astro";
 | 
					import Footer from "@src/components/Footer.astro";
 | 
				
			||||||
 | 
					import type { TypeData } from "@config/io/types";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
interface Props {
 | 
					interface Props {
 | 
				
			||||||
  title: string;
 | 
					  title: string;
 | 
				
			||||||
  description: string;
 | 
					  description: string;
 | 
				
			||||||
  headings?: ConfigHeading[];
 | 
					  headings?: ConfigHeading[];
 | 
				
			||||||
 | 
					  type?: TypeData
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const { title, description, headings } = Astro.props;
 | 
					const { title, description, headings, type } = Astro.props;
 | 
				
			||||||
const url = Astro.url.pathname.split("/");
 | 
					const url = Astro.url.pathname.split("/");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const customBreadcrumbs = [
 | 
					const customBreadcrumbs = [
 | 
				
			||||||
| 
						 | 
					@ -59,7 +61,7 @@ if (url[2]) {
 | 
				
			||||||
    <CreateCopyButtons />
 | 
					    <CreateCopyButtons />
 | 
				
			||||||
  </head>
 | 
					  </head>
 | 
				
			||||||
  <body class="docslayout">
 | 
					  <body class="docslayout">
 | 
				
			||||||
    <Header title={title} headings={headings}/>
 | 
					    <Header title={title} headings={headings} type={type}/>
 | 
				
			||||||
    <div class="docslayout-root">
 | 
					    <div class="docslayout-root">
 | 
				
			||||||
      <Nav mobile={false}/>
 | 
					      <Nav mobile={false}/>
 | 
				
			||||||
      <div class="docslayout-inner" data-pagefind-body>
 | 
					      <div class="docslayout-inner" data-pagefind-body>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										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>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										44
									
								
								src/pages/docs/types/[module]/index.astro
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								src/pages/docs/types/[module]/index.astro
									
										
									
									
									
										Normal 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>
 | 
				
			||||||
| 
						 | 
					@ -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>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
| 
						 | 
					@ -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>
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,10 +1,8 @@
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
import DocsLayout from "@layouts/DocsLayout.astro";
 | 
					import DocsLayout from "@layouts/DocsLayout.astro";
 | 
				
			||||||
import { getTypeData } from "@config/io/generateTypeData";
 | 
					import { getModulesData } from "@config/io/generateTypeData";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const routes = await getTypeData();
 | 
					const modules = await getModulesData();
 | 
				
			||||||
 | 
					 | 
				
			||||||
const modules = [...new Set(routes.map(route => route.type))];
 | 
					 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
<DocsLayout title="Quickshell Module Listing" description="Quickshell Type Documentation">
 | 
					<DocsLayout title="Quickshell Module Listing" description="Quickshell Type Documentation">
 | 
				
			||||||
  <div class="docs-content">
 | 
					  <div class="docs-content">
 | 
				
			||||||
| 
						 | 
					@ -13,18 +11,14 @@ const modules = [...new Set(routes.map(route => route.type))];
 | 
				
			||||||
    <section>
 | 
					    <section>
 | 
				
			||||||
      <span>All modules included with Quickshell</span>
 | 
					      <span>All modules included with Quickshell</span>
 | 
				
			||||||
      <div class="root-nav" data-pagefind-ignore>
 | 
					      <div class="root-nav" data-pagefind-ignore>
 | 
				
			||||||
        {modules.map(moduleEntry => {
 | 
					        {modules.map(module => (
 | 
				
			||||||
          const indexData = routes.filter(route => route.name === "index")
 | 
					 | 
				
			||||||
          const indexSingled = indexData.filter(indexEntry => indexEntry.type === moduleEntry)[0]
 | 
					 | 
				
			||||||
          const description = indexSingled.data.description
 | 
					 | 
				
			||||||
          return (
 | 
					 | 
				
			||||||
          <div class="root-nav-entry">
 | 
					          <div class="root-nav-entry">
 | 
				
			||||||
            <a class="root-nav-link" href={`/docs/types/${moduleEntry}`}>
 | 
					            <a class="root-nav-link" href={`/docs/types/${module.name}`}>
 | 
				
			||||||
              {moduleEntry}
 | 
					              {module.name}
 | 
				
			||||||
            </a>
 | 
					            </a>
 | 
				
			||||||
            <span class="root-nav-desc">{description}</span>
 | 
					            <span class="root-nav-desc">{module.description}</span>
 | 
				
			||||||
          </div>)
 | 
					          </div>)
 | 
				
			||||||
        })}
 | 
					        )}
 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
    </section>
 | 
					    </section>
 | 
				
			||||||
  </div>
 | 
					  </div>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue