import type { LiteralUnion } from 'type-fest'; import { OrArray } from '@jsmanifest/typefest'; import type { ComponentObject, EcosDocument, NameField } from 'noodl-types'; import type { ComponentPage } from './factory/componentFactory'; import type NDOM from './noodl-ui-dom'; import type NDOMPage from './Page'; import type NUIPage from '../Page'; import * as t from '../types'; export declare const _DEV_: boolean; export declare const _TEST_: boolean; export declare function addClassName(className: string, node: HTMLElement): void; type CreateDocIdentifierArg = t.NuiComponent.Instance | ComponentObject | EcosDocument | null | undefined; export declare function _getOrCreateComponentPage(componentOrNUIPage: t.NuiComponent.Instance | NUIPage, createPage: NDOM['createPage'], findPage: NDOM['findPage'], node?: any): ComponentPage; export declare function _isNUIPage(value: unknown): value is NUIPage; export declare function _isPluginComponent(component: t.NuiComponent.Instance): boolean; export declare const isImageDoc: (obj: CreateDocIdentifierArg) => boolean; export declare const isMarkdownDoc: (obj: CreateDocIdentifierArg) => boolean; export declare const isNoteDoc: (obj: CreateDocIdentifierArg) => boolean; export declare const isPdfDoc: (obj: CreateDocIdentifierArg) => boolean; export declare const isTextDoc: (obj: Record) => boolean; export declare const isWordDoc: (obj: CreateDocIdentifierArg) => boolean; export declare function _isElemFactory(arg: string | ((node: HTMLElement) => node is N)): (node: HTMLElement) => node is N; export declare const _isButtonEl: (node: HTMLElement) => node is HTMLButtonElement; export declare const _isDivEl: (node: HTMLElement) => node is HTMLDivElement; export declare const _isImageEl: (node: HTMLElement) => node is HTMLImageElement; export declare const _isInputEl: (node: HTMLElement) => node is HTMLInputElement; export declare const _isIframeEl: (node: HTMLElement) => node is HTMLIFrameElement; export declare const _isLinkEl: (node: HTMLElement) => node is HTMLLinkElement; export declare const _isListEl: (node: HTMLElement) => node is HTMLUListElement; export declare const _isScriptEl: (node: HTMLElement) => node is HTMLScriptElement; export declare const _isStyleEl: (node: HTMLElement) => node is HTMLStyleElement; export declare const xKeys: string[]; export declare const yKeys: string[]; export declare const posKeys: string[]; export declare const resourceTypes: readonly ["css", "js"]; export declare function handleDrawGlobalComponent(this: NDOM, node: HTMLElement, component: t.NuiComponent.Instance, page: NDOMPage): void; export declare const _resetActions: (...args: Args) => void; export declare const _resetComponentCache: (page?: string) => import("..").ComponentCache; export declare const _resetRegisters: () => import("..").RegisterCache; export declare const _resetTransactions: () => import("..").TransactionsCache; export declare const _syncPages: { (this: NDOM): void; _pageState: Map; }; /** * Normalizes the queried nodes to an HTMLElement or an array of HTMLElement * @param { NodeList | HTMLCollection | HTMLElement } nodes */ export declare function asHtmlElement(nodes: t.DOMNodeInput): HTMLElement | HTMLElement[] | null; /** * Returns the DOM element tag name for the NOODL component * @param { t.NuiComponent.Instance | NuiComponentType } component */ export declare function getElementTag(component: t.NuiComponent.Instance | t.NuiComponentType | undefined): keyof HTMLElementTagNameMap; /** * Creates a function that queries for a DOM node. * This method searches through several window/document objects and is most * useful for page consumer components * @param { string } attr */ export declare function makeFindByAttr(attr: LiteralUnion): (component?: t.NuiComponent.Instance | LiteralUnion) => OrArray | null; export declare function findBySelector(selector: LiteralUnion): OrArray | HTMLElement> | null; export declare function findByDataAttrib(dataAttrib: LiteralUnion | undefined, value?: string): OrArray | null; export declare const findByDataKey: (component?: t.NuiComponent.Instance | LiteralUnion) => OrArray | null; export declare const findByGlobalId: (component?: t.NuiComponent.Instance | LiteralUnion) => OrArray | null; export declare const findByPlaceholder: (component?: t.NuiComponent.Instance | LiteralUnion) => OrArray | null; export declare const findBySrc: (component?: t.NuiComponent.Instance | LiteralUnion) => OrArray | null; export declare const findByViewTag: (component?: t.NuiComponent.Instance | LiteralUnion) => OrArray | null; export declare const findByUX: (component?: t.NuiComponent.Instance | LiteralUnion) => OrArray | null; export declare const findByDataOption: (component?: t.NuiComponent.Instance | LiteralUnion) => OrArray | null; export declare const findByTimeSlot: (component?: t.NuiComponent.Instance | LiteralUnion) => OrArray | null; export declare const findByProviderId: (component?: t.NuiComponent.Instance | LiteralUnion) => OrArray | null; export declare const findByFacilityId: (component?: t.NuiComponent.Instance | LiteralUnion) => OrArray | null; export declare const findByLocationId: (component?: t.NuiComponent.Instance | LiteralUnion) => OrArray | null; export declare const findByDefaultDate: (component?: t.NuiComponent.Instance | LiteralUnion) => OrArray | null; export declare function findByClassName(className: string | undefined): HTMLElement | HTMLElement[] | null; export declare function findByElementId(c: t.NuiComponent.Instance | string | undefined): HTMLElement | HTMLElement[] | null; export interface FindFunc { (document: Document, arg: Arg): HTMLElement | null; } export declare function makeFindFirstBy(fn: FindFunc): (arg: Arg) => HTMLElement; export declare const findFirstBySelector: (arg: string) => HTMLElement; export declare const findFirstByDataKey: (arg: string) => HTMLElement; export declare const findFirstByGlobalId: (arg: string) => HTMLElement; export declare const findFirstByViewTag: (arg: string) => HTMLElement; export declare const findFirstByDataOption: (arg: string) => HTMLElement; export declare const findFirstByDataTimeSlot: (arg: string) => HTMLElement; export declare const findFirstByDataProviderId: (arg: string) => HTMLElement; export declare const findFirstByDataFacilityId: (arg: string) => HTMLElement; export declare const findFirstByDataLocationId: (arg: string) => HTMLElement; export declare const findFirstByDefaultDate: (arg: string) => HTMLElement; export declare const findFirstByVideoOption: (arg: string) => HTMLElement; export declare const findFirstByElementId: (arg: string | t.NuiComponent.Instance) => HTMLElement; export declare const findFirstByClassName: (arg: string) => HTMLElement; /** * Returns the component instance of type: page if it exists in the parent ancestry tree * @param { t.NuiComponent.Instance } component */ export declare function getPageAncestor(component: t.NuiComponent.Instance | null | undefined): t.NuiComponent.Instance | null; /** * Returns the index from the parent's children. * Returns -1 if it the node is not a child of the parent * @param node * @returns { number } */ export declare function getNodeIndex(node: N | null | undefined): number; export declare function makeElemFn(fn: (node: HTMLElement) => void): (nodes: t.DOMNodeInput, cb?: typeof fn) => number | false; /** * Returns true if the value can be displayed in the UI as normal. * A displayable value is any value that is a string or number * @param { any } value */ export declare function isDisplayable(value: unknown): value is string | number; /** * Returns true if the component is a descendant of a component of type: "page" * @param { t.NuiComponent.Instance } component */ export declare function isPageConsumer(component: any): boolean; export declare function normalizeEventName(eventName: string): string; /** * Simulates a user-click and opens the link in a new tab. * @param { string } url - An outside link */ export declare function openOutboundURL(url: string): void; export declare function isTextFieldLike(node: unknown): node is HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement; export declare function toSelectOption(value: any): t.SelectOption; export declare function addListener(node: t.NDOMElement, event: string, callback: any): { event: string; callback: () => void; }; export declare function removeAllNode(node: t.NDOMElement): void; export {};