configuration/constants/ontology.constants.ts

configuration/constants/ontology.constants.ts is a file in Bane's Lab Site. 20 lines of code and 8 definitions.

import type { ContentGraph, GraphSection } from "#types/methodology.types";
import { ONTOLOGY_PAGE } from "#core/ids/page.ids";
import { ONTOLOGY_TABS } from "#configuration/strings/ontology.fragment.strings";

export const SEARCH_ATTRIBUTE = "data-search";

export const RECORD_CLASS = "record";

export const WIDE_FIELD_LENGTH = 160;

const NARRATIVE: GraphSection = { narrative: true, requires: [], teaches: [], traces: [] };

let held: Readonly<Record<string, GraphSection>> | null = null;

const sectionsOf = function sectionsOf(): Readonly<Record<string, GraphSection>> {
    held ??= Object.fromEntries(
        ONTOLOGY_TABS.flatMap((tab) => tab.sections.map((section) => [section.id, NARRATIVE] as const)),
    );
    return held;
};

export const ONTOLOGY_GRAPH: ContentGraph = {
    page: ONTOLOGY_PAGE,
    get sections(): Readonly<Record<string, GraphSection>> {
        return sectionsOf();
    },
};