import * as TinyCollision from '../../basics/collision.mjs'; import TinyElementObserver from './TinyElementObserver.mjs'; export type TinyHtmlAny = TinyHtml; export type AppendCheckerTemplate = TinyNode | TinyNode[] | string | false | null | undefined; export type AppendCheckerValues = AppendCheckerTemplate | AppendCheckerTemplate[]; export type HoverEventCallback = (ev: MouseEvent) => void; export type StyleFxResult = Map; export type AnimationSfxData = Record; export type StyleEffectsRdFn = (effects: AnimationSfxData) => boolean; export type StyleEffectsFn = (el: HTMLElement, keyframes: AnimationSfxData, prop: string, style: CSSStyleDeclaration) => void; export type StyleEffectsProps = Record; export type OnScrollAnimation = (progress: { x: number; y: number; isComplete: boolean; time: number; }) => void; export type Easings = 'linear' | 'easeInQuad' | 'easeOutQuad' | 'easeInOutQuad' | 'easeInCubic' | 'easeOutCubic' | 'easeInOutCubic'; export type TinyNode = Node | TinyHtmlAny | null; export type TinyElement = Element | TinyHtmlAny; export type TinyHtmlElement = HTMLElement | TinyHtmlAny; export type TinyEventTarget = EventTarget | TinyHtmlAny; export type TinyInputElement = InputElement | TinyHtmlAny; export type TinyElementAndWindow = ElementAndWindow | TinyHtmlAny; export type ElementAndWindow = Element | Window; export type TinyElementAndWinAndDoc = ElementAndWinAndDoc | TinyHtmlAny; export type ElementAndWinAndDoc = Element | Window | Document; export type TinyElementWithDoc = ElementWithDoc | TinyHtmlAny; export type ElementWithDoc = Element | Document; export type WinnowRequest = string | Element | Element[] | ((index: number, el: Element) => boolean); export type ConstructorElValues = Window | Element | Document | Text; export type EventRegistryOptions = boolean | AddEventListenerOptions; export type EventRegistryItem = { /** * - The function to be executed when the event is triggered. */ handler: EventListenerOrEventListenerObject | null; /** * - Optional configuration passed to the listener. */ options?: EventRegistryOptions; }; export type EventRegistryList = Record; export type ElementDataStore = Record; export type StyleEffects = Record; export type ObjRect = import('../../basics/collision.mjs').ObjRect; export type CollisionDirLock = 'top' | 'bottom' | 'left' | 'right'; export type HtmlElBoxSides = { /** * - Total horizontal size (left + right) */ x: number; /** * - Total vertical size (top + bottom) */ y: number; left: number; right: number; top: number; bottom: number; }; export type SetValueBase = string | number | Date | boolean | null; export type GetValueTypes = 'string' | 'date' | 'number'; export type SetValueList = SetValueBase | SetValueBase[]; export type InputElement = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | HTMLOptionElement; export type HtmlParsed = [ tagName: string, attributes: Record, ...children: (string | HtmlParsed)[] ]; export type TinyHtmlConstructor = (ConstructorElValues | ConstructorElValues[] | NodeListOf | HTMLCollectionOf | NodeListOf | string); /** * Possible directions from which a collision was detected and locked. * * @typedef {'top'|'bottom'|'left'|'right'} CollisionDirLock */ /** * @typedef {Object} HtmlElBoxSides * @property {number} x - Total horizontal size (left + right) * @property {number} y - Total vertical size (top + bottom) * @property {number} left * @property {number} right * @property {number} top * @property {number} bottom */ /** * @typedef {string | number | Date | boolean | null} SetValueBase - Primitive types accepted as input values. */ /** * @typedef {'string' | 'date' | 'number'} GetValueTypes * Types of value extractors supported by TinyHtml._valTypes. */ /** * @typedef {SetValueBase|SetValueBase[]} SetValueList - A single value or an array of values to be assigned to the input element. */ /** * A list of HTML form elements that can have a `.value` property used by TinyHtml. * Includes common input types used in forms. * * @typedef {HTMLInputElement|HTMLSelectElement|HTMLTextAreaElement|HTMLOptionElement} InputElement */ /** * Represents a parsed HTML element in JSON-like array form. * * @typedef {[ * tagName: string, // The tag name of the element (e.g., 'div', 'img') * attributes: Record, // All element attributes as key-value pairs * ...children: (string | HtmlParsed)[] // Text or nested elements * ]} HtmlParsed */ /** * Represents all possible inputs accepted by the TinyHtml constructor. * Can be a single element, an array of elements, array-like DOM collections, * or a CSS selector string. * * @typedef {( * ConstructorElValues | * ConstructorElValues[] | * NodeListOf | * HTMLCollectionOf | * NodeListOf | * string * )} TinyHtmlConstructor */ /** * TinyHtml is a utility class that provides static and instance-level methods * for precise dimension and position computations on HTML elements. * It mimics some jQuery functionalities while using native browser APIs. * * Inspired by the jQuery project's open source implementations of element dimension * and offset utilities. This class serves as a lightweight alternative using modern DOM APIs. * * @template {TinyHtmlConstructor} TinyHtmlT * @class */ declare class TinyHtml { #private; /** @typedef {import('../../basics/collision.mjs').ObjRect} ObjRect */ static Utils: { areElsCollTop: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => boolean; areElsCollBottom: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => boolean; areElsCollLeft: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => boolean; areElsCollRight: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => boolean; areElsCollPerfTop: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => boolean; areElsCollPerfBottom: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => boolean; areElsCollPerfLeft: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => boolean; areElsCollPerfRight: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => boolean; areElsColliding: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => boolean; areElsPerfColliding: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => boolean; getElsColliding: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => string | null; getElsPerfColliding: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => 'top' | 'bottom' | 'left' | 'right' | null; getElsCollOverlap: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => { overlapLeft: number; overlapRight: number; overlapTop: number; overlapBottom: number; }; getElsCollOverlapPos: ({ overlapLeft, overlapRight, overlapTop, overlapBottom, }?: { overlapLeft?: number; overlapRight?: number; overlapTop?: number; overlapBottom?: number; }) => { dirX: TinyCollision.Dirs; dirY: TinyCollision.Dirs; }; getRectCenter: (rect: TinyCollision.ObjRect) => { x: number; y: number; }; getElsRelativeCenterOffset(rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect): { x: number; y: number; }; getElsCollDirDepth(rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect): { inDir: TinyCollision.Dirs | null; dirX: TinyCollision.Dirs | null; dirY: TinyCollision.Dirs | null; depthX: number; depthY: number; }; getElsCollDetails(rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect): { depth: TinyCollision.CollData; dirs: TinyCollision.CollDirs; isNeg: TinyCollision.NegCollDirs; }; }; /** @returns {number} */ static get version(): number; /** * Gets whether debug output is enabled. * @returns {boolean} True if debug output is enabled; otherwise, false. */ static get elemDebug(): boolean; /** * Enables or disables debug output. * @param {boolean} value True to enable debug output; false to disable. * @throws {TypeError} Thrown if the provided value is not a boolean. */ static set elemDebug(value: boolean); /** * Logs a standardized debug error for element validation, including a console.table * with the involved elements. Use this when an element argument is invalid, unexpected, * or fails a guard/validation. * * The output includes: * - A concise error header * - A stack trace (when supported) * - A table of elements (index, typeof, constructor, summary, value) * - The specific problematic element, if provided * * @param {(ConstructorElValues | EventTarget | TinyElement | null)[]} elems * A list of elements participating in the operation (may include nulls). * @param {ConstructorElValues | EventTarget | TinyElement | null} [elem] * The specific element that triggered the error, if available. * @returns {void} */ static _debugElemError(elems: (ConstructorElValues | EventTarget | TinyElement | null)[], elem?: ConstructorElValues | EventTarget | TinyElement | null): void; /** * Parse inline styles into an object. * @param {string} styleText * @returns {Record} */ static parseStyle(styleText: string): Record; static get tinyObserver(): TinyElementObserver | undefined; /** * Fetches an HTML file from the given URL, parses it to JSON. * * @param {string | URL | globalThis.Request} url - The URL of the HTML file. * @param {RequestInit} [ops] - Optional fetch configuration (e.g., method, headers, cache, etc). * @returns {Promise} A promise that resolves with the parsed JSON representation of the HTML structure. */ static fetchHtmlFile(url: string | URL | globalThis.Request, ops?: RequestInit): Promise; /** * Fetches an HTML file from the given URL, parses it to JSON, then converts it to DOM nodes. * * @param {string} url - The URL of the HTML file. * @param {RequestInit} [ops] - Optional fetch configuration (e.g., method, headers, cache, etc). * @returns {Promise<(HTMLElement|Text)[]>} A promise that resolves with the DOM nodes. */ static fetchHtmlNodes(url: string, ops?: RequestInit): Promise<(HTMLElement | Text)[]>; /** * Fetches an HTML file from the given URL, parses it to JSON, then converts it to TinyHtml instances. * * @param {string} url - The URL of the HTML file. * @param {RequestInit} [ops] - Optional fetch configuration (e.g., method, headers, cache, etc). * Returns the promise that resolves with the TinyHtml instances. */ static fetchHtmlTinyElems(url: string, ops?: RequestInit): Promise[]>; /** * Converts the content of a