added index to the docs/types route, minor fixes to styling
This commit is contained in:
		
							parent
							
								
									ea5b56acc8
								
							
						
					
					
						commit
						349c87a205
					
				
					 9 changed files with 109 additions and 32 deletions
				
			
		| 
						 | 
					@ -11,7 +11,7 @@ export interface Props {
 | 
				
			||||||
const { headings, types, mobile } = Astro.props;
 | 
					const { headings, types, mobile } = Astro.props;
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<div class=`toc-wrapper${mobile ? "-mobile":""}`>
 | 
					<div id="toc" aria-mobile={mobile} class=`toc-wrapper${mobile ? "-mobile":""}`>
 | 
				
			||||||
  <TableOfContents
 | 
					  <TableOfContents
 | 
				
			||||||
    config={headings}
 | 
					    config={headings}
 | 
				
			||||||
    type={types}
 | 
					    type={types}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -126,7 +126,14 @@ export const Tree: Component<TreeProps> = props => {
 | 
				
			||||||
            <Accordion.ItemIndicator>
 | 
					            <Accordion.ItemIndicator>
 | 
				
			||||||
              <LinkSimple />
 | 
					              <LinkSimple />
 | 
				
			||||||
            </Accordion.ItemIndicator>
 | 
					            </Accordion.ItemIndicator>
 | 
				
			||||||
            <span>
 | 
					            <span
 | 
				
			||||||
 | 
					              class="link-outside"
 | 
				
			||||||
 | 
					              onMouseDown={() =>
 | 
				
			||||||
 | 
					                window.open(
 | 
				
			||||||
 | 
					                  "https://doc.qt.io/qt-6/qtquick-qmlmodule.html"
 | 
				
			||||||
 | 
					                )
 | 
				
			||||||
 | 
					              }
 | 
				
			||||||
 | 
					            >
 | 
				
			||||||
              <a
 | 
					              <a
 | 
				
			||||||
                href="https://doc.qt.io/qt-6/qtquick-qmlmodule.html"
 | 
					                href="https://doc.qt.io/qt-6/qtquick-qmlmodule.html"
 | 
				
			||||||
                target="_blank"
 | 
					                target="_blank"
 | 
				
			||||||
| 
						 | 
					@ -145,7 +152,14 @@ export const Tree: Component<TreeProps> = props => {
 | 
				
			||||||
            <Accordion.ItemIndicator>
 | 
					            <Accordion.ItemIndicator>
 | 
				
			||||||
              <LinkSimple />
 | 
					              <LinkSimple />
 | 
				
			||||||
            </Accordion.ItemIndicator>
 | 
					            </Accordion.ItemIndicator>
 | 
				
			||||||
            <span>
 | 
					            <span
 | 
				
			||||||
 | 
					              class="link-outside"
 | 
				
			||||||
 | 
					              onMouseDown={() =>
 | 
				
			||||||
 | 
					                window.open(
 | 
				
			||||||
 | 
					                  "https://git.outfoxxed.me/outfoxxed/quickshell-examples"
 | 
				
			||||||
 | 
					                )
 | 
				
			||||||
 | 
					              }
 | 
				
			||||||
 | 
					            >
 | 
				
			||||||
              <a
 | 
					              <a
 | 
				
			||||||
                href="https://git.outfoxxed.me/outfoxxed/quickshell-examples"
 | 
					                href="https://git.outfoxxed.me/outfoxxed/quickshell-examples"
 | 
				
			||||||
                target="_blank"
 | 
					                target="_blank"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,10 @@
 | 
				
			||||||
import { createSignal, onMount, type Component } from "solid-js";
 | 
					import {
 | 
				
			||||||
 | 
					  createSignal,
 | 
				
			||||||
 | 
					  createEffect,
 | 
				
			||||||
 | 
					  onMount,
 | 
				
			||||||
 | 
					  onCleanup,
 | 
				
			||||||
 | 
					  type Component,
 | 
				
			||||||
 | 
					} from "solid-js";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { LoadingSpinner, MenuToX, XToMenu } from "@icons";
 | 
					import { LoadingSpinner, MenuToX, XToMenu } from "@icons";
 | 
				
			||||||
import { Tree } from "./Tree";
 | 
					import { Tree } from "./Tree";
 | 
				
			||||||
| 
						 | 
					@ -41,10 +47,21 @@ const NavComponent: Component<NavProps> = props => {
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  onMount(() => {
 | 
					  onMount(() => {
 | 
				
			||||||
    window.addEventListener("click", handleClickOutside);
 | 
					    onCleanup(() => {
 | 
				
			||||||
    return () => {
 | 
					 | 
				
			||||||
      window.removeEventListener("click", handleClickOutside);
 | 
					      window.removeEventListener("click", handleClickOutside);
 | 
				
			||||||
    };
 | 
					    });
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  createEffect(() => {
 | 
				
			||||||
 | 
					    if (open()) {
 | 
				
			||||||
 | 
					      window.addEventListener("click", handleClickOutside);
 | 
				
			||||||
 | 
					      document.body.style.overflow = "hidden";
 | 
				
			||||||
 | 
					      document.body.classList.add("dim-content");
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					      window.removeEventListener("click", handleClickOutside);
 | 
				
			||||||
 | 
					      document.body.style.overflow = "auto";
 | 
				
			||||||
 | 
					      document.body.classList.remove("dim-content");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,10 @@
 | 
				
			||||||
import { createSignal, onMount, type Component } from "solid-js";
 | 
					import {
 | 
				
			||||||
 | 
					  createEffect,
 | 
				
			||||||
 | 
					  createSignal,
 | 
				
			||||||
 | 
					  onMount,
 | 
				
			||||||
 | 
					  onCleanup,
 | 
				
			||||||
 | 
					  type Component,
 | 
				
			||||||
 | 
					} from "solid-js";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { Article } from "@icons";
 | 
					import { Article } from "@icons";
 | 
				
			||||||
import { Table } from "./Table";
 | 
					import { Table } from "./Table";
 | 
				
			||||||
| 
						 | 
					@ -24,20 +30,33 @@ const TableOfContents: Component<TOCProps> = props => {
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  const handleClickOutside = (event: MouseEvent) => {
 | 
					  const handleClickOutside = (event: MouseEvent) => {
 | 
				
			||||||
    const isLink = "href" in (event.target || {});
 | 
					    const isLink = "href" in (event.target || {});
 | 
				
			||||||
 | 
					    const isInBody = document.body.contains(event.target as Node);
 | 
				
			||||||
    if (
 | 
					    if (
 | 
				
			||||||
      isLink ||
 | 
					      isLink ||
 | 
				
			||||||
      (document.body.contains(event.target as Node) &&
 | 
					      !isInBody ||
 | 
				
			||||||
        !tocRef.contains(event.target as Node))
 | 
					      (isInBody && !tocRef.contains(event.target as Node))
 | 
				
			||||||
    ) {
 | 
					    ) {
 | 
				
			||||||
      setOpen(false);
 | 
					      setOpen(false);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  onMount(() => {
 | 
					  onMount(() => {
 | 
				
			||||||
    window.addEventListener("click", handleClickOutside);
 | 
					    onCleanup(() => {
 | 
				
			||||||
    return () => {
 | 
					 | 
				
			||||||
      window.removeEventListener("click", handleClickOutside);
 | 
					      window.removeEventListener("click", handleClickOutside);
 | 
				
			||||||
    };
 | 
					    });
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  createEffect(() => {
 | 
				
			||||||
 | 
					    const tocRoot = document.getElementById("toc")!;
 | 
				
			||||||
 | 
					    if (open()) {
 | 
				
			||||||
 | 
					      window.addEventListener("click", handleClickOutside);
 | 
				
			||||||
 | 
					      document.body.style.overflow = "hidden";
 | 
				
			||||||
 | 
					      document.body.classList.add("dim-content");
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					      window.removeEventListener("click", handleClickOutside);
 | 
				
			||||||
 | 
					      document.body.style.overflow = "auto";
 | 
				
			||||||
 | 
					      document.body.classList.remove("dim-content");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,8 +1,25 @@
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
import DocsLayout from "@layouts/DocsLayout.astro";
 | 
					import DocsLayout from "@layouts/DocsLayout.astro";
 | 
				
			||||||
 | 
					import { generateTypeData } from "@config/io/generateTypeData";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const routes = await generateTypeData();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const modules = [...new Set(routes.map(route => route.type))];
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
<DocsLayout title="Quickshell Type Definitions" description="Quickshell Type Documentation">
 | 
					<DocsLayout title="Quickshell Type Definitions" description="Quickshell Type Documentation">
 | 
				
			||||||
  <h2>Type Definitions</h2>
 | 
					  <h2>Type Definitions</h2>
 | 
				
			||||||
  <div class="root-nav">
 | 
					  <div class="root-nav">
 | 
				
			||||||
 | 
					    {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 (
 | 
				
			||||||
 | 
					      <div class="root-nav-entry">
 | 
				
			||||||
 | 
					        <a class="root-nav-link" href={`/docs/types/${moduleEntry}`}>
 | 
				
			||||||
 | 
					          {moduleEntry}
 | 
				
			||||||
 | 
					        </a>
 | 
				
			||||||
 | 
					        <span class="root-nav-desc">{description}</span>
 | 
				
			||||||
 | 
					      </div>)
 | 
				
			||||||
 | 
					    })}
 | 
				
			||||||
  </div>
 | 
					  </div>
 | 
				
			||||||
</DocsLayout>
 | 
					</DocsLayout>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,6 +8,7 @@
 | 
				
			||||||
  justify-content: center;
 | 
					  justify-content: center;
 | 
				
			||||||
  flex-direction: row;
 | 
					  flex-direction: row;
 | 
				
			||||||
  flex-grow: 1;
 | 
					  flex-grow: 1;
 | 
				
			||||||
 | 
					  transition: filter 0.3s;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.docslayout-inner {
 | 
					.docslayout-inner {
 | 
				
			||||||
| 
						 | 
					@ -19,6 +20,10 @@
 | 
				
			||||||
  flex-direction: row;
 | 
					  flex-direction: row;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.dim-content .docslayout-root {
 | 
				
			||||||
 | 
					  filter: brightness(50%);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.docs-content {
 | 
					.docs-content {
 | 
				
			||||||
  flex-grow: 1;
 | 
					  flex-grow: 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -39,7 +39,8 @@
 | 
				
			||||||
      display: none;
 | 
					      display: none;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    transition: left 0.3s ease, padding 0.3s ease;
 | 
					    transition: left 0.3s ease,
 | 
				
			||||||
 | 
					    padding 0.3s ease;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    &.shown {
 | 
					    &.shown {
 | 
				
			||||||
      display: flex;
 | 
					      display: flex;
 | 
				
			||||||
| 
						 | 
					@ -94,6 +95,12 @@
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.link-outside {
 | 
				
			||||||
 | 
					  width: 100%;
 | 
				
			||||||
 | 
					  height: 100%;
 | 
				
			||||||
 | 
					  text-align: start;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@media (min-width: 40rem) {
 | 
					@media (min-width: 40rem) {
 | 
				
			||||||
  .nav-toggle {
 | 
					  .nav-toggle {
 | 
				
			||||||
    .nav-items {
 | 
					    .nav-items {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -13,17 +13,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.toc-wrapper-mobile {
 | 
					.toc-wrapper-mobile {
 | 
				
			||||||
  display: block;
 | 
					  display: block;
 | 
				
			||||||
  scrollbar-width: none;
 | 
					 | 
				
			||||||
  -ms-overflow-style: none;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  &::-webkit-scrollbar {
 | 
					 | 
				
			||||||
    display: none;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  background-color: transparent;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.toc-content {
 | 
					 | 
				
			||||||
  background-color: transparent;
 | 
					  background-color: transparent;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -60,14 +50,20 @@
 | 
				
			||||||
    -ms-overflow-style: none;
 | 
					    -ms-overflow-style: none;
 | 
				
			||||||
    background-color: hsl(var(--overlay-bkg));
 | 
					    background-color: hsl(var(--overlay-bkg));
 | 
				
			||||||
    border-left: 1px solid hsl(var(--overlay-bkg-border));
 | 
					    border-left: 1px solid hsl(var(--overlay-bkg-border));
 | 
				
			||||||
 | 
					    cursor: default;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    &::-webkit-scrollbar {
 | 
					    &::-webkit-scrollbar {
 | 
				
			||||||
      display: none;
 | 
					      display: none;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    transition: width 0.3s ease, padding 0.3s ease;
 | 
					    transition: width 0.3s ease,
 | 
				
			||||||
 | 
					    padding 0.3s ease;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    &.shown {
 | 
					    &.shown {
 | 
				
			||||||
 | 
					      & .toc-content {
 | 
				
			||||||
 | 
					        background-color: transparent;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      overflow-y: scroll;
 | 
					      overflow-y: scroll;
 | 
				
			||||||
      width: var(--width);
 | 
					      width: var(--width);
 | 
				
			||||||
      display: flex;
 | 
					      display: flex;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -63,6 +63,8 @@
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    &:hover {
 | 
					    &:hover {
 | 
				
			||||||
 | 
					      cursor: pointer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      & svg {
 | 
					      & svg {
 | 
				
			||||||
        opacity: 1;
 | 
					        opacity: 1;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue