import { ALGORITHMS_LABEL, LEXICON_LABEL, PRINCIPLES_LABEL, REASONING_LABEL, RESOLVES_TEXT, SCHEMA_LABEL, UNRESOLVED_TEXT, } from "#configuration/strings/ontology.strings"; import { ALGORITHMS_TAB, LEXICON_TAB, PRINCIPLES_TAB, REASONING_TAB, SCHEMA_TAB } from "#core/ids/ontology.ids"; import { ONTOLOGY_ALGORITHMS_ICON, ONTOLOGY_LEXICON_ICON, ONTOLOGY_PRINCIPLES_ICON, ONTOLOGY_REASONING_ICON, ONTOLOGY_SCHEMA_ICON, } from "#configuration/icons/ontology.icons"; import type { Section, Tab } from "#types/document.types"; import { ONTOLOGY } from "#core/assets/ontology.generated"; import { catalogSections } from "#domain/converters/catalog.converter"; import { contractSections } from "#domain/converters/contract.converter"; import { kindSections } from "#domain/converters/kind.converter"; import { lexiconSections } from "#domain/converters/lexicon.converter"; import { principleSections } from "#domain/converters/principle.converter"; import { spineSections } from "#domain/converters/reason.converter"; import { tensionSections } from "#domain/converters/tension.converter"; const RESOLUTION_NOTE = ONTOLOGY.resolves ? RESOLVES_TEXT : UNRESOLVED_TEXT; const lazyTab = function lazyTab(icon: string, id: string, label: string, build: () => readonly Section[]): Tab { let held: readonly Section[] | null = null; return { icon, id, label, layout: "ontology", get sections(): readonly Section[] { held ??= build(); return held; }, }; }; export const ONTOLOGY_TABS: readonly Tab[] = [ lazyTab(ONTOLOGY_PRINCIPLES_ICON, PRINCIPLES_TAB, PRINCIPLES_LABEL, () => principleSections(ONTOLOGY.principles)), lazyTab(ONTOLOGY_LEXICON_ICON, LEXICON_TAB, LEXICON_LABEL, () => lexiconSections(ONTOLOGY.terms)), lazyTab(ONTOLOGY_ALGORITHMS_ICON, ALGORITHMS_TAB, ALGORITHMS_LABEL, () => contractSections(ONTOLOGY.contracts)), lazyTab(ONTOLOGY_REASONING_ICON, REASONING_TAB, REASONING_LABEL, () => [ ...spineSections(ONTOLOGY.reason), ...catalogSections(ONTOLOGY.reason), ]), lazyTab(ONTOLOGY_SCHEMA_ICON, SCHEMA_TAB, SCHEMA_LABEL, () => [ ...kindSections(ONTOLOGY.kinds, ONTOLOGY.ranges, ONTOLOGY.forces, RESOLUTION_NOTE), ...tensionSections(ONTOLOGY.layers), ]), ];