import { ReadiumWindow } from "./dom.ts"; export declare function isRTL(wnd: Window): boolean; /** Whether the element's computed direction is right-to-left, from its `dir` attribute or CSS. */ export declare function hasRTLDirection(wnd: Window, el: Element): boolean; export declare function isVerticalLR(wnd: Window): boolean; export declare function isVerticalWriting(wnd: Window): boolean; export declare const OVERLAY_Z_INDEX = 2147483646; /** * Axis-normalizing context for decoration layout. * * Translates CSS physical properties into logical inline/block terms so that * callers can position elements identically regardless of writing mode: * * horizontal writing → inline = horizontal, block = vertical * vertical writing → inline = vertical, block = horizontal */ export interface WritingContext { isVertical: boolean; isVertLR: boolean; /** Viewport size along the inline axis (innerWidth / innerHeight). */ viewportInlineSize: number; /** Viewport size along the block axis (innerHeight / innerWidth). */ viewportBlockSize: number; /** * Size of a single page along the inline axis. * Horizontal: viewportWidth / columnCount. * Vertical: viewportHeight (no columns). */ pageInlineSize: number; /** * Physical x offset to add to a client-space x coordinate to get document space. * Horizontal: scrollLeft (non-negative). * Vertical-rl: scrollWidth − viewportWidth + scrollLeft (scrollLeft is negative, * so this normalises it to the viewport's left edge in document coordinates). * Vertical-lr: scrollLeft (non-negative, same as horizontal). */ xDocOffset: number; /** Physical y offset to add to a client-space y coordinate to get document space (scrollTop). */ yDocOffset: number; /** Scroll offset along the inline axis, derived from xDocOffset / yDocOffset. */ inlineScrollOffset: number; /** Scroll offset along the block axis, derived from xDocOffset / yDocOffset. */ blockScrollOffset: number; /** Logical inline start of a rect (left / top). */ inlineStart(r: DOMRect | { top: number; left: number; }): number; /** Logical block start of a rect (top / left). */ blockStart(r: DOMRect | { top: number; left: number; }): number; /** Logical inline size of a rect (width / height). */ inlineSize(r: DOMRect | { width: number; height: number; }): number; /** Logical block size of a rect (height / width). */ blockSize(r: DOMRect | { width: number; height: number; }): number; /** * Set absolute position on an element using logical coordinates. * `iz` is the inverse zoom factor (1 in non-Blink, 1/zoom in Blink). */ applyPosition(el: HTMLElement, inlineStart: number, blockStart: number, inlineSize: number, blockSize: number, iz: number): void; /** Convert logical coordinates back to a physical DOMRect. */ toRect(inlineStart: number, blockStart: number, inlineSize: number, blockSize: number): DOMRect; } /** * With `origin`, the document offsets convert client coordinates into that element's own, * measured wherever the page's CSS positions it, instead of being derived from scrolling. */ export declare function makeWritingContext(wnd: Window, origin?: Element): WritingContext; export declare function getColumnCountPerScreen(wnd: Window): number; /** * Returns the "content height" of an element, which is its clientHeight * minus any vertical padding. * * @param el - The element to measure. */ export declare function getContentHeight(el: Element): number; /** * We have to make sure that the total number of columns is a multiple * of the number of columns per screen. * Otherwise it causes snapping and page turning issues. * To fix this, we insert and remove blank virtual columns at the end of the resource. */ export declare function appendVirtualColumnIfNeeded(wnd: ReadiumWindow): boolean; /** * This forces a recalculation in WebKit browsers. * It is needed in scroll mode to ensure that the content is scrollable. * Webkit seems to find itself in some kind of limbo if we do not do that. * It has everything correct but the scroll listener is non-functional, * unless you force a recalc or reflow. * It is not needed in paginated mode. */ export declare function forceWebkitRecalc(wnd: Window): void;