// Type definitions for nimbiCMS_pre // Generated by scripts/gen-dts.js; run `npm run gen-dts` to refresh export type NavTreeItem = { path: string, name: string, isIndex?: boolean, children?: NavTreeItem[] } export type NavBuildResult = { navbar: HTMLElement, linkEls: NodeListOf } export function createSiteNav(homePage: string): NavTreeItem[] export function buildNav(navbarWrap: HTMLElement, container: HTMLElement, navHtml: string, contentBase: string, homePage: string, t: (key:string, vars?:Record)=>string, renderByQuery: ()=>void, effectiveSearchEnabled: boolean, searchIndexMode: 'eager'|'lazy'): Promise export type NavItem = { path: string, name: string, children?: NavItem[] } export type TocEntry = { level:number, text:string, id?:string } export type ParsedPage = { html: string, meta: object, toc: TocEntry[] } export type ArticleResult = { article: HTMLElement, parsed: ParsedPage, toc: HTMLElement, topH1: HTMLElement | null, h1Text: string | null, slugKey: string | null } export function createNavTree(t: (key:string, vars?:Record)=>string, tree: NavItem[]): HTMLElement export function buildTocElement(t: (key:string)=>string, toc: TocEntry[], pagePath?: string): HTMLElement export function prepareArticle(t: (key:string)=>string, data: {raw:string,isHtml?:boolean}, pagePath: string, anchor: string|null, contentBase: string): Promise export function initAnchorWorker(): Worker|null export function rewriteAnchorsWorker(article: HTMLElement, contentBase: string, pagePath?: string): Promise export function attachTocClickHandler(toc: HTMLElement): void export function scrollToAnchorOrTop(anchor: string|null): void export function ensureScrollTopButton(article: HTMLElement, topH1: HTMLElement|null, opts?: { mountOverlay?: HTMLElement|null, container?: HTMLElement|null, mountEl?: HTMLElement|null, navWrap?: HTMLElement|null, t?: Function }): void export type MarkdownPlugin = { tokenizer?: Function, renderer?: object, walkTokens?: Function, transform?: Function } export const markdownPlugins: MarkdownPlugin[] export function addMarkdownExtension(plugin: MarkdownPlugin): void export function setMarkdownExtensions(plugins: MarkdownPlugin[]): void export function initRendererWorker(): Worker|null export function parseMarkdownToHtml(md: string): Promise export function detectFenceLanguages(md: string, supportedMap?: Map): Set export const currentLang: string export function t(key: string, replacements?: Record): string export function setTag(name: string, content: string): void export function setMetaTags(data: Record, titleOverride?: string, imageOverride?: string, descOverride?: string, initialDocumentTitle?: string): void export function setStructuredData(data: Record, pagePath: string, titleOverride?: string, imageOverride?: string, descOverride?: string, initialDocumentTitle?: string): void export function applyPageMeta(t: (key:string, vars?:Record)=>string, initialDocumentTitle: string, parsed: ParsedPage, toc: TocEntry[], article: HTMLElement, pagePath: string, anchor: string|null, topH1: HTMLElement|null, h1Text: string|null, slugKey: string|null, data: Record): void export function setLazyload(img: HTMLImageElement): void export function joinPaths(...parts: string[]): string export function _clearIndexCache(): void export function refreshIndexPaths(): void export function _purgeExpiredEntries(): void export function buildPageCandidates(resolved: string): string[] export function fetchPageData(raw: string, contentBase: string): Promise<{data: Record, pagePath: string, anchor: string | null}> export function initSlugWorker(): Worker|null export function addSlugResolver(fn: (slug:string,contentBase?:string)=>Promise|string|null): void export const notFoundPage: string export function setContentBase(contentBase: string): void export function slugify(s: string): string export function resolveSlugPath(slug: string): string|null export const crawlCache: Map|string|null> export function buildSearchIndex(contentBase: string): Promise> export function setDefaultCrawlMaxQueue(n: number): void export const crawlForSlug: (decoded: string, contentBase: string, maxQueue?: number) => Promise export function crawlAllMarkdown(contentBase: string, maxQueue: number): Promise export function ensureSlug(decoded: string, contentBase: string, maxQueue: any): Promise export type ThemeStyle = 'light' | 'dark' export interface InitOptions { el: string | Element contentPath?: string crawlMaxQueue?: number searchIndex?: boolean cacheTtlMinutes?: number defaultStyle?: ThemeStyle bulmaCustomize?: string lang?: string l10nFile?: string | null /** optional array of markdown paths provided by the host (example plugin) * used by slug resolution and search index */ markdownPaths?: string[] } export interface PageContext { data: Record pagePath: string anchor: string | null } export interface HookContext { // common fields provided to all hooks pagePath?: string anchor?: string | null article?: HTMLElement toc?: HTMLElement topH1?: HTMLElement | null h1Text?: string | null slugKey?: string | null data?: Record contentWrap?: HTMLElement | null navWrap?: HTMLElement | null // nav-build specific navbar?: HTMLElement linkEls?: NodeListOf contentBase?: string } // UI helper option and return shapes (mirrors src/ui.js typedefs) export type UIOptions = { contentWrap: HTMLElement, navWrap: HTMLElement, container: HTMLElement, mountOverlay?: HTMLElement | null, t: (key: string, vars?: Object)=>string, contentBase: string, homePage: string, initialDocumentTitle: string, runHooks: (name: string, ctx?: Object)=>void|Promise } export type UIReturn = { renderByQuery: () => Promise, siteNav: object, getCurrentPagePath: () => string | null } // Router resolution cache types export type ResolutionRecord = { value: { resolved: string, anchor: string | null }, ts: number } export const RESOLUTION_CACHE_MAX: number export const RESOLUTION_CACHE_TTL: number export function setResolutionCacheMax(n: number): void export function setResolutionCacheTtl(ms: number): void export const resolutionCache: Map // Fetch result and localization entry shapes (from slugManager and l10n defaults) export type FetchResult = { raw: string, isHtml?: boolean, status?: number } export type L10nEntry = { navigation: string, onThisPage: string, home: string, scrollToTop: string, readingTime: string, searchPlaceholder: string } // primary entrypoint – options object is strongly typed above export function initCMS(options: InitOptions): Promise export default initCMS // hook / plugin API definitions export function addHook(name: string, fn: (ctx:HookContext)=>void|Promise): void export function onPageLoad(fn: (ctx:HookContext)=>void|Promise): void export function onNavBuild(fn: (ctx:HookContext)=>void|Promise): void export function transformHtml(fn: (ctx:HookContext)=>void|Promise): void export function _clearHooks(): void export type WorkerManager = { get: () => Worker | null send: (msg: any, timeout?: number) => Promise terminate: () => void } // Worker manager helpers export function makeWorkerManager(createWorker: () => Worker|null, name?: string): WorkerManager export function createWorkerFromRaw(code: string): Worker|null // UI helper (opaque options for now) export function createUI(opts: UIOptions): UIReturn // Slug manager shared maps export const slugToMd: Map}> export const mdToSlug: Map export const availableLanguages: string[] export const listPathsFetched: Set export const listSlugCache: Map export const searchIndex: Array<{slug:string,title:string,excerpt:string,path:string}> // Codeblocks export const SUPPORTED_HLJS_MAP: Map // Additional explicit declarations to reduce remaining any entries export function setLanguages(list: string[]): void export function buildSearchIndexWorker(contentBase: string): Promise> export function crawlForSlugWorker(slug: string, base: string, maxQueue: number): Promise export function removeSlugResolver(fn: (slug:string)=>unknown): void export function setNotFoundPage(p: string): void export function _setAllMd(obj: Record): void export function clearListCaches(): void export function clearFetchCache(): void export function fetchMarkdown(path: string, base?: string): Promise // --- from src/worker-manager.js export function makeWorkerPool(createWorker: any, name: any, size: any): any export function makeWorkerManagerFromRaw(code: string, handleFn: {function(object):Promise}, name: string): ReturnType export function makeWorkerPoolFromRaw(code: string, handleFn: {function(object):Promise}, name: string, size: number): ReturnType // --- from src/version.js export function getVersion(): Promise // --- from src/ui.js // --- from src/slugManager.js export function watchForColdHashRoute(parsed: {type:string,page:string,anchor?:string,params?:string}): any export function setSkipRootReadme(v: any): any export const skipRootReadme: boolean export function getLanguages(): string[] export function _storeSlugMapping(slug: string, rel: string): void export const slugResolvers: Set export const allMarkdownPaths: string[] export const allMarkdownPathsSet: Set export const homePage: string export const HOME_SLUG: string export function setHomePage(p: string): void export function _setSearchIndex(arr: any): any export function uniqueSlug(base: string, existing: Set): string export function isExternalLink(href: string): boolean export function isExternalLinkWithBase(href: string, contentBase: string): boolean export function unescapeMarkdown(s: string): string export const negativeFetchCache: any export function setFetchNegativeCacheTTL(ms: any): any export function setFetchCacheMaxSize(n: number): any export function setFetchCacheTTL(ms: number): any export function setNegativeFetchCacheMaxSize(n: number): any export function setFetchConcurrency(n: number): void export function getFetchConcurrency(): number export function setFetchMarkdown(fn: (path:string, base?:string)=>Promise): void export function getSearchIndex(): any export function whenSearchIndexReady(opts: {timeoutMs?:number,contentBase?:string,indexDepth?:number,noIndexing?:string[],seedPaths?:string[],startBuild?:boolean}): Promise export function awaitSearchIndex(opts: {contentBase?:string,indexDepth?:number,noIndexing?:string[],seedPaths?:string[],startBuild?:boolean,timeoutMs?:number}): Promise export const CRAWL_MAX_QUEUE: number export const defaultCrawlMaxQueue: number // --- from src/seoManager.js export function getSiteNameFromMeta(): string export function setSeoMap(map: object): any export function injectSeoForPage(page: string, initialDocumentTitle: string): any export function markNotFound(opts: any): any // --- from src/runtimeSitemap.js export function generateSitemapJson(opts: object): Promise export function generateSitemapXml(json: {generatedAt:string,entries:any[]}|any[]): string export function generateRssXml(json: {generatedAt:string,entries:any[]}|any[]): string export function generateAtomXml(json: {generatedAt:string,entries:any[]}|any[]): string export function handleSitemapRequest(opts: any): any export function exposeSitemapGlobals(opts: any): any // --- from src/router.js export function augmentIndexWithAllMarkdownPaths(arrOrMap: any): any // --- from src/nimbi-cms.js // --- from src/nav.js // --- from src/markdown.js export const _sendToRenderer: any export function streamParseMarkdown(opts: {chunkSize?:number}): Promise export function detectFenceLanguagesAsync(mdText: string, supportedMap: Map): Promise> // --- from src/l10nManager.js export function loadL10nFile(path: string, pageDir: string): Promise export function setLang(lang: string): void // --- from src/jsdoc-typedefs.js // --- from src/init.js export function parseInitOptionsFromQuery(queryString: string): any export const currentHighlightTheme: string export const initialDocumentTitle: string // --- from src/indexManager.js export const indexSet: any // --- from src/imagePreview.js export function attachImagePreview(opts: any): void // --- from src/htmlBuilder.js export function preScanHtmlSlugs(linkEls: NodeListOf, base: string): Promise export function preMapMdSlugs(linkEls: NodeListOf|HTMLAnchorElement[], contentBase: string): Promise export function executeEmbeddedScripts(article: any): void export function renderNotFound(contentWrap: HTMLElement|null, t: Function|null, e: Error|null): void // --- from src/hookManager.js export function runHooks(name: any, ctx: any): Promise // --- from src/gen-dts-sample.js export function complexExample(opts: {a:number,b:string}): Promise> export function simpleUnion(): string|number export function recordExample(): Record export function sum(opts: any): {sum:number} export function callIt(cb: (...args:any[])=>any): void // --- from src/codeblocksManager.js export const HLJS_ALIAS_MAP: Record export const BAD_LANGUAGES: Set export const languageImporter: any export function setLanguageImporter(fn: any): any export function clearLanguageImportCache(): void export function setLanguageImportNegativeCacheTTL(ms: number): void export function loadSupportedLanguages(url: string): Promise export function registerLanguage(name: string, modulePath: string): Promise export function observeCodeBlocks(root: any): any export function setHighlightTheme(opts: {useCdn?:boolean}): void // --- from src/bulmaManager.js export function ensureBulma(bulmaCustomize: string, pageDir: string): Promise export function setStyle(style: 'light'|'dark'|'system'): void export function setThemeVars(vars: Record): void export function registerThemedElement(el: any): () => void // --- from src/worker/slugWorker.js export function handleSlugWorkerMessage(msg: object): Promise // --- from src/worker/renderer.js export function clearRendererImportCache(): any export function setRendererImportNegativeCacheTTL(ms: any): any export function handleWorkerMessage(msg: object): Promise export function handleWorkerMessageStream(msg: object, onChunk: {function(object):void}): any // --- from src/worker/anchorWorker.js export function handleAnchorWorkerMessage(msg: object): Promise // --- from src/utils/urlHelper.js export function buildCosmeticUrl(page: string, anchor: any, baseSearch: any): string export function parseHrefToRoute(href: string): any export function toCanonicalHref(href: string): string // --- from src/utils/textMetrics.js export function getReadingTime(text: string): any export function getTextMetrics(text: string): any export function clearTextMetricsCache(): void // --- from src/utils/sharedDomParser.js export function getSharedParser(): DOMParser|null export function setSharedParser(parser: DOMParser|null): void export function resetSharedParser(): void // --- from src/utils/renderer-manager.js // --- from src/utils/memoize.js // --- from src/utils/l10n-defaults.js export const DEFAULT_L10N: Record // --- from src/utils/importCache.js export function clearImportCache(): any export function setImportNegativeCacheTTL(ms: any): any export function runImportWithCache(key: string, loader: () => Promise): Promise export function importUrlWithCache(url: string): Promise // --- from src/utils/idle.js export function yieldToEventLoop(): Promise export function yieldIfNeeded(iteration: number, threshold: number): Promise // --- from src/utils/helpers.js export const normalizePath: any export const trimTrailingSlash: any export const ensureTrailingSlash: any export function setEagerForAboveFoldImages(container: any, marginPx: number, debug: boolean): void export function buildPageUrl(page: string, hash: string|null, baseSearch: string): string export const encodeURL: any export function safe(fn: () => any|Promise): any|Promise|undefined export const decodeHtmlEntities: any // --- from src/utils/frontmatter.js export function parseFrontmatter(md: string): {content:string, data: Record} // --- from src/utils/events.js // --- from src/utils/emojiMap.js // --- from src/utils/debug.js export function setDebugLevel(level: any): any export function getDebugLevel(): number export function isDebugLevel(level: number): boolean export function isDebug(): boolean export function debugError(...args: any): void export function debugWarn(...args: any): void export function debugInfo(...args: any): void export function debugLog(...args: any): void export function incrementCounter(name: string): void export function syncLegacyCounter(name: string): void export function hasLegacyDebug(): boolean export function getDebugCounters(): Record export function resetDebugCounters(): void // --- from src/utils/concurrency.js export function runWithConcurrency(items: T[], worker: (item:T, index:number)=>Promise, concurrency: number): Promise> // --- from src/utils/cache.js export function createLRUCache(opts: any): any // --- from src/lib/index.js