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 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"; import type {
TypeData,
QuickshellFunction,
// QuickshellSignal,
// QuickshellVariant,
// QuickshellProps,
} from "@config/_types";
export interface Props { export interface Props {
title?: string; title?: string;
@ -15,7 +21,7 @@ const { title, headings, type, mobile } = Astro.props;
const types: TypeTOC | null = type const types: TypeTOC | null = type
? { ? {
properties: Object.keys(type.properties ?? {}), 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 ?? {}), signals: Object.keys(type.signals ?? {}),
variants: Object.keys(type.variants ?? {}), variants: Object.keys(type.variants ?? {}),
} }

View file

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

View file

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

View file

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

View file

@ -1,6 +1,6 @@
--- ---
import { getQMLTypeLink } from "@config/io/helpers"; import { getQMLTypeLink } from "@config/io/helpers";
import type { QuickshellSignal } from "@config/io/types"; import type { QuickshellSignal } from "@config/_types";
import { Tag } 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";

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 TypeDetails from "./TypeDetails.astro";
import TypeTitle from "./TypeTitle.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 // FIXME: need to make this work properly, or fold into the markdown processor
let headings = document.getElementsByClassName("heading") let headings = document.getElementsByClassName("heading")
if (headings.length > 0) { if (headings.length > 0) {
//@ts-expect-error
for (const heading of headings) { for (const heading of headings) {
let button = heading.querySelector("h2") let button = heading.querySelector("h2")
if (button) { if (button) {

View file

@ -2,7 +2,6 @@
import GuideLayout from "@layouts/GuideLayout.astro"; import GuideLayout from "@layouts/GuideLayout.astro";
import { getVersionsData } from "@config/io/generateTypeData"; import { getVersionsData } from "@config/io/generateTypeData";
import { getGuideCollection } from "@config/io/guides"; import { getGuideCollection } from "@config/io/guides";
import { processMarkdown } from "@config/io/markdown";
import { render } from "astro:content"; import { render } from "astro:content";
@ -26,11 +25,14 @@ export async function getStaticPaths() {
return pages.flat(); return pages.flat();
} }
const { version, page } = Astro.props; const { page } = Astro.props;
const { headings, Content } = await render(page); 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 // 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}> <GuideLayout title={page.data.title} description="" headings={headings}>
<Content/> <Content/>

View file

@ -1,7 +1,9 @@
{ {
"extends": "astro/tsconfigs/strict", "extends": "astro/tsconfigs/strict",
"compilerOptions": { "compilerOptions": {
"lib": ["es2016"], "lib": [
"es2023"
],
"plugins": [ "plugins": [
{ {
"name": "@astrojs/ts-plugin" "name": "@astrojs/ts-plugin"
@ -12,16 +14,36 @@
"verbatimModuleSyntax": true, "verbatimModuleSyntax": true,
"baseUrl": ".", "baseUrl": ".",
"paths": { "paths": {
"@*": ["./*"], "@*": [
"@/*": ["./src/*"], "./*"
"@config/*": ["./src/config/*"], ],
"@icons": ["./src/components/icons.tsx"], "@/*": [
"@icons/*": ["./src/icons/*"], "./src/*"
"@components/*": ["./src/components/*"], ],
"@layouts/*": ["./src/layouts/*"], "@config/*": [
"@styles/*": ["./src/styles/*"], "./src/config/*"
"@_types": ["./src/config/_types/index.ts"], ],
"@_types/*": ["./src/config/_types/*"] "@icons": [
"./src/components/icons.tsx"
],
"@icons/*": [
"./src/icons/*"
],
"@components/*": [
"./src/components/*"
],
"@layouts/*": [
"./src/layouts/*"
],
"@styles/*": [
"./src/styles/*"
],
"@_types": [
"./src/config/_types/index.ts"
],
"@_types/*": [
"./src/config/_types/*"
]
} }
} }
} }