types/page.types.ts

types/page.types.ts is a file in Bane's Lab Site. 164 lines of code and 24 definitions.

import type { Closing, License } from "#types/site.types";
import type { DocumentMeta, Section, Tab, TabLayout, TabbedMeta } from "#types/document.types";
import type { HomeRowCopy, HomeStat } from "#types/home.types";
import type { PageShare, ShareImage } from "#types/card.types";
import type { SchemaEntity, SchemaGraph } from "#types/schema.types";

export type PageRender = () => Element;

export interface ClosingCell {
    readonly closing: Closing;
    readonly tail: readonly HTMLElement[];
}

export interface HomeContent {
    readonly heading: string;
    readonly kind: "home";
    readonly lead: string;
    readonly rows: readonly HomeRowCopy[];
    readonly stats: readonly HomeStat[];
    readonly thesis: string;
}

export interface TabbedContent {
    readonly kind: "tabbed";
    readonly layout: TabLayout;
    readonly meta: TabbedMeta;
    readonly tabs: readonly Tab[];
    readonly tone: string;
}

export interface DocumentContent {
    readonly kind: "document";
    readonly meta: DocumentMeta;
    readonly sections: readonly Section[];
}

export type PageContent = DocumentContent | HomeContent | TabbedContent;

export interface PageDefinition {
    readonly article?: boolean;
    readonly complete?: () => Promise<PageDefinition>;
    readonly content: PageContent;
    readonly description: string;
    readonly entities?: readonly SchemaEntity[];
    readonly id: string;
    readonly license?: License;
    readonly profile?: boolean;
    readonly render: PageRender;
    readonly title: string;
}

export type PageLoader = () => Promise<PageDefinition>;

export interface PageEntry {
    readonly accent: string;
    readonly description: string;
    readonly icon: string;
    readonly id: string;
    readonly listed: boolean;
    readonly load: PageLoader;
    readonly mark: string;
    readonly order: number;
    readonly share: PageShare;
    readonly title: string;
}

export interface HeadAlternates {
    readonly json: string;
    readonly markdown: string;
}

export interface ServedSubject {
    readonly alternates: HeadAlternates;
    readonly description: string;
    readonly name: string;
    readonly path: string;
    readonly title: string;
}

export interface SectionSeed {
    readonly intro: string | null;
    readonly kind: string | null;
    readonly name: string;
    readonly page: string;
    readonly part: number;
    readonly parts: number;
    readonly records: number;
    readonly rows: readonly [number, number];
    readonly section: string;
    readonly tab: string;
    readonly tabPath: string;
    readonly tabTitle: string;
}

export interface SectionSubject extends ServedSubject {
    readonly parts: readonly RecordLink[];
    readonly seed: SectionSeed;
}

export interface SourceSubject {
    readonly alternates: HeadAlternates;
    readonly description: string;
    readonly language: string | null;
    readonly license: string | null;
    readonly name: string;
    readonly path: string;
    readonly repository: string | null;
    readonly tabPath: string;
    readonly tabTitle: string;
    readonly title: string;
    readonly trail: readonly SourceNodeLink[];
}

export interface SourceNodeLink {
    readonly label: string;
    readonly path: string;
}

export interface SourceBody {
    readonly children: readonly SourceNodeLink[];
    readonly parent: SourceNodeLink;
    readonly subject: SourceSubject;
}

export interface RecordLink {
    readonly label: string;
    readonly path: string | null;
}

export interface RecordGroup {
    readonly links: readonly RecordLink[];
    readonly relation: string;
}

export interface RecordFact {
    readonly label: string;
    readonly value: RecordLink;
}

export interface RecordPlacement {
    readonly next: RecordLink | null;
    readonly previous: RecordLink | null;
    readonly up: RecordLink;
}

export interface RecordSubject {
    readonly aliases: readonly string[];
    readonly alternates: HeadAlternates;
    readonly code: string | null;
    readonly collection: SourceNodeLink;
    readonly description: string;
    readonly facts: readonly RecordFact[];
    readonly kind: string;
    readonly layer: RecordLink | null;
    readonly name: string;
    readonly path: string;
    readonly placement: RecordPlacement | null;
    readonly relations: readonly RecordGroup[];
    readonly section: string | null;
    readonly summary: string | null;
    readonly title: string;
}

export interface PageHead {
    readonly alternates?: HeadAlternates;
    readonly banner: ShareImage;
    readonly description: string;
    readonly kind: string;
    readonly path: string;
    readonly robots: string;
    readonly schema: SchemaGraph;
    readonly title: string;
}

export interface PageDates {
    readonly modified: string;
    readonly published: string;
}

export interface SchemaSubject {
    readonly banner?: ShareImage;
    readonly dates?: PageDates;
    readonly definition?: PageDefinition;
    readonly description: string;
    readonly path: string;
    readonly tab?: Tab;
    readonly title: string;
}