fix: the disrespect for the ts compiler

This commit is contained in:
Oleksandr 2026-02-13 17:18:00 +02:00
parent 8c961c729b
commit af899b4ce5
Signed by: Xanazf
GPG key ID: 821EEC32761AC17C
11 changed files with 53 additions and 72 deletions

View file

@ -1,7 +1,13 @@
---
import TableOfContents from "./toc";
import type { ConfigHeading, TypeTOC } from "./types.d.ts";
import type { TypeData } from "@config/io/types";
import type {
TypeData,
QuickshellFunction,
// QuickshellSignal,
// QuickshellVariant,
// QuickshellProps,
} from "@config/_types";
export interface Props {
title?: string;
@ -15,7 +21,7 @@ const { title, headings, type, mobile } = Astro.props;
const types: TypeTOC | null = type
? {
properties: Object.keys(type.properties ?? {}),
functions: (type.functions ?? []).map(f => f.name),
functions: (type.functions ?? []).map((f:QuickshellFunction) => f.name),
signals: Object.keys(type.signals ?? {}),
variants: Object.keys(type.variants ?? {}),
}

View file

@ -32,6 +32,7 @@ const NavComponent: Component<SidebarContent> = props => {
if (
isLink ||
!isInBody ||
//@ts-expect-error
(isInBody && !navRef.contains(event.target as Node))
) {
setOpen(false);

View file

@ -1,52 +0,0 @@
import { createSignal, type Component } from "solid-js";
import { Article } from "@icons";
import { Table } from "./Table";
import type {
TOCProps,
TypeTOC,
ConfigHeading,
} from "../types";
import { buildHierarchy } from "@config/io/helpers";
const TableOfContents: Component<TOCProps> = props => {
const [open, setOpen] = createSignal<boolean>(false);
const [typeProps] = createSignal<TypeTOC | undefined>(
props.type
);
const [configProps] = createSignal<
ConfigHeading[] | undefined
>(props.config);
function toggle(e: MouseEvent) {
e.preventDefault();
setOpen(!open());
}
if (!props.mobile) {
return typeProps() ? (
<Table typeTOC={typeProps()} />
) : (
<Table configTOC={buildHierarchy(configProps()!)} />
);
}
return (
<div class="menu-toggle">
<div onclick={e => toggle(e)}>
<Article />
</div>
<div class={`menu-items ${open() ? "shown" : ""}`}>
{typeProps() ? (
<Table typeTOC={typeProps()} />
) : (
<Table
configTOC={buildHierarchy(configProps()!)}
/>
)}
</div>
</div>
);
};
export default TableOfContents;

View file

@ -40,6 +40,7 @@ const TableOfContents: Component<TOCProps> = props => {
if (
isLink ||
!isInBody ||
//@ts-expect-error
(isInBody && !tocRef.contains(event.target as Node))
) {
setOpen(false);

View file

@ -2,7 +2,7 @@
import type {
QMLTypeLinkObject,
QuickshellFunction,
} from "@config/io/types";
} from "@config/_types";
import { getQMLTypeLink } from "@config/io/helpers";
import { Tag } from "@icons";
import TypeDetails from "./TypeDetails.astro";

View file

@ -3,7 +3,7 @@ import { getQMLTypeLink } from "@config/io/helpers";
import type {
QMLTypeLinkObject,
QuickshellProps,
} from "@config/io/types";
} from "@config/_types";
import { Tag } from "@icons";
import TypeTitle from "./TypeTitle.astro";

View file

@ -1,6 +1,6 @@
---
import { getQMLTypeLink } from "@config/io/helpers";
import type { QuickshellSignal } from "@config/io/types";
import type { QuickshellSignal } from "@config/_types";
import { Tag } from "@icons";
import TypeDetails from "./TypeDetails.astro";
import TypeTitle from "./TypeTitle.astro";

View file

@ -1,5 +1,5 @@
---
import type { QuickshellVariant } from "@config/io/types";
import type { QuickshellVariant } from "@config/_types";
import TypeDetails from "./TypeDetails.astro";
import TypeTitle from "./TypeTitle.astro";

View file

@ -103,6 +103,7 @@ for (const segment of url) {
// FIXME: need to make this work properly, or fold into the markdown processor
let headings = document.getElementsByClassName("heading")
if (headings.length > 0) {
//@ts-expect-error
for (const heading of headings) {
let button = heading.querySelector("h2")
if (button) {

View file

@ -2,7 +2,6 @@
import GuideLayout from "@layouts/GuideLayout.astro";
import { getVersionsData } from "@config/io/generateTypeData";
import { getGuideCollection } from "@config/io/guides";
import { processMarkdown } from "@config/io/markdown";
import { render } from "astro:content";
@ -26,11 +25,14 @@ export async function getStaticPaths() {
return pages.flat();
}
const { version, page } = Astro.props;
const { page } = Astro.props;
const { headings, Content } = await render(page);
// xnzf: version is decided before these pages get processed
// V
// we can't use 'Content' because there isn't a way to pass in a version
const html = await processMarkdown(version.name, page.body!);
// const html = await processMarkdown(version.name, page.body!);
---
<GuideLayout title={page.data.title} description="" headings={headings}>
<Content/>