interface BlockBodyScrollOptions { className?: string; variableName?: string; } /** * Blocks page scrolling by adding an overflow-hiding class to `document.body`. Pair with * `unblockBodyScroll` using the same class name. * * The class itself is supplied by the consuming stylesheet; this only applies it. Nested calls are * not reference-counted, so the first `unblockBodyScroll` restores scrolling for all callers. * * @param option Class name as a string, or `{ className, variableName }` where `variableName` is a custom property set on the body to the current scrollbar width — used to pad away the layout shift. * * @example * ```ts * blockBodyScroll({ className: 'p-overflow-hidden', variableName: '--scrollbar-width' }); * ``` */ declare function blockBodyScroll(option?: string | BlockBodyScrollOptions): void; /** * Downloads `csv` as a UTF-8 `.csv` file via a temporary object URL, revoked after 40 seconds. Falls * back to the legacy `msSaveOrOpenBlob` API where present, and to opening a `data:` URL in a new * window when the anchor `download` attribute is unsupported — that last path is subject to popup * blocking and URL length limits. * * Emits the string as given: no BOM is prepended, and no escaping or injection guarding is applied to * the cell contents. * * @param csv CSV text. * @param filename File name without the `.csv` extension, which is appended. */ declare function exportCSV(csv: string, filename: string): void; /** * Triggers a file download by clicking a temporary anchor, which is appended to `document.body` and * removed again before returning. Must be called from a user gesture, or the browser will block the * download. * * @param file Download descriptor. `src` is any URL the anchor accepts — an object URL, a `data:` URL, or a remote address; `name` is the suggested filename. * @returns True when the download was triggered; false when no file is given or the browser does not support the `download` attribute. Cross-origin `src` values ignore `name` and may open rather than download. * * @example * ```ts * const url = URL.createObjectURL(blob); * * saveAs({ name: 'export.csv', src: url }); * URL.revokeObjectURL(url); * ``` */ declare function saveAs(file: { name: string; src: string; }): boolean; interface UnblockBodyScrollOptions { className?: string; variableName?: string; } /** * Reverts `blockBodyScroll` by removing the scroll-lock class from `document.body`, and the scrollbar * width custom property when one was set. * * Removal is unconditional rather than reference-counted, so with overlapping overlays the first call * unlocks scrolling for all of them. * * @param option Class name as a string, or an options object. Defaults to the `p-overflow-hidden` class. Pass the same `variableName` given to `blockBodyScroll` to clear it. */ declare function unblockBodyScroll(option?: string | UnblockBodyScrollOptions): void; /** * Positions `element` against `target` in document coordinates, flipping above the target when there * is not enough room below and clamping horizontally to the viewport. Writes `top`, the inline-start * (or inline-end under RTL) offset and `transform-origin` as inline styles; the element must already * be absolutely positioned in a document-level stacking context. * * @param element Element to position. Hidden elements are measured via a temporary reflow. * @param target Element to anchor against. * @param gutter Apply the `--*-anchor-gutter` CSS variable as a margin between the two, negated when flipped. Defaults to `true`. */ declare function absolutePosition(element: HTMLElement, target: HTMLElement | SVGElement, gutter?: boolean): void; /** * Adds one or more classes to `element`. Accepts a space-separated string or an array; nullish * entries are skipped. No-ops when either argument is falsy. * * @param element Target element. * @param className Class name, space-separated list, or array of either. * * @example * ```ts * addClass(el, 'p-button p-button-sm'); * addClass(el, ['p-button', isText && 'p-button-text']); * ``` */ declare function addClass(element: Element, className: string | undefined | null | (string | undefined | null)[]): void; /** * Applies inline styles to `element` through the CSP-safe path in `applyStyle`, which drops * declarations with unsafe values (e.g. `url()` payloads) instead of writing them. * * A string replaces any existing `cssText`; an object is merged onto the current inline styles. * Object keys may be camelCase or custom properties (`--x`), and a trailing `!important` in either * form is honored. * * @param element Target element. No-ops when falsy. * @param style CSS text (`'color:red;width:2rem'`) or a property map. */ declare function addStyle(element: HTMLElement, style: string | object): void; /** * Positions an overlay against its target, choosing the strategy that matches where the overlay was * mounted: `relativePosition` when it stays inside the target's parent, `absolutePosition` otherwise. * * @param overlay Overlay element to position. * @param target Element the overlay is anchored to. * @param appendTo Mount location the overlay was rendered into; `'self'` selects relative positioning. * @param calculateMinWidth Match the overlay's `min-width` to the target's outer width. Ignored when `appendTo` is `'self'`. Defaults to `true`. */ declare function alignOverlay(overlay: HTMLElement, target: HTMLElement, appendTo: string, calculateMinWidth?: boolean): void; /** * Appends `child` to a target resolved by `getTargetElement`, so `element` may be a node, a CSS * selector, a keyword such as `'body'` or `'@parent'`, or a function returning one. * * @param element Target descriptor, resolved relative to `child` for the `@`-prefixed keywords. * @param child Node to append. * @throws When the descriptor resolves to nothing appendable. */ declare function appendChild(element: unknown, child: Node | Element): void; /** * Binds `listener` as the sole handler for `eventName` on `element`, removing any previously applied * handler for that event. Re-applying the same function reference is a no-op, so this is safe to call * on every render. * * Bookkeeping is stored on the element under `_pListeners`; listeners attached with * `addEventListener` directly are not tracked and therefore not removed. * * @param element Target element. * @param eventName Event type, without the `on` prefix. * @param listener Handler function or `EventListenerObject`. Other values are ignored. */ declare function applyEventListener(element: HTMLElement, eventName: string, listener: unknown): void; type StyleApplyOptions = { clear?: boolean; }; /** * Writes pre-split CSS declarations to `element` via `setProperty`, skipping any whose value fails * the `hasUnsafeCssValue` check. Avoids assigning to `cssText` so a hostile value cannot inject * additional declarations. * * Malformed entries (no `:`, empty property) are silently dropped; a trailing `!important` is lifted * into the priority argument. * * @param element Target element. * @param declarations Declaration strings, each `property: value`, without separating semicolons. * @param options `clear` empties existing inline styles before applying. */ declare function applyStyleDeclarationsSafely(element: HTMLElement, declarations: string[], options?: StyleApplyOptions): void; /** * Applies inline styles from CSS text or a property map, filtering unsafe values as * `applyStyleDeclarationsSafely` does. * * String input is split on top-level semicolons only — semicolons inside quotes or parentheses (e.g. * a `data:` URI in `url()`) do not terminate a declaration. Object keys are converted from camelCase * to kebab-case, except custom properties, which are passed through as-is; `null`/`undefined` values * are skipped. * * @param element Target element. * @param style CSS text or a property map. * @param options `clear` empties existing inline styles before applying. */ declare function applyInlineStyleSafely(element: HTMLElement, style: string | Record, options?: StyleApplyOptions): void; declare const _default$1: { applyInlineStyleSafely: typeof applyInlineStyleSafely; applyStyleDeclarationsSafely: typeof applyStyleDeclarationsSafely; }; /** * Returns the width in pixels currently occupied by the document's vertical scrollbar, as the * difference between the window's inner width and the document element's offset width. Returns `0` * on overlay-scrollbar platforms and when the page does not scroll. * * Used to compensate for the layout shift when body scrolling is blocked. */ declare function calculateBodyScrollbarWidth(): number; /** * Returns the horizontal scrollbar height in pixels. * * With `element`, measures that element's own scrollbar from its box metrics. Without one, measures * the platform default by mounting a probe on `document.body` and caches the result for the lifetime * of the module — a later change in scrollbar styling is not picked up. * * @param element Element to measure. Omit for the platform-wide default. */ declare function calculateScrollbarHeight(element?: HTMLElement): number; /** * Returns the vertical scrollbar width in pixels. * * With `element`, measures that element's own scrollbar from its box metrics. Without one, measures * the platform default by mounting a probe on `document.body` and caches the result for the lifetime * of the module — a later change in scrollbar styling is not picked up. * * @param element Element to measure. Omit for the platform-wide default. */ declare function calculateScrollbarWidth(element?: HTMLElement): number; /** * Clears the current text selection, preferring the legacy `Selection.empty()` where available and * falling back to `removeAllRanges()`. The fallback runs only when the first range has client rects, * leaving collapsed or non-rendered selections untouched. */ declare function clearSelection(): void; /** * Creates a detached element, applies `attributes` through `setAttributes`, and appends `children`. * String children are appended as text nodes, never parsed as markup. * * @param type Tag name. Returns `undefined` when empty. * @param attributes Attribute map. Supports the `setAttributes` conventions: `on*` keys bind listeners, `style` and `class` accept objects and arrays, and unsafe URL/HTML attribute values are rejected. * @param children Text or nodes to append. * @returns The new element, or `undefined` when `type` is falsy. * * @example * ```ts * const el = createElement('div', { class: ['p-panel', { 'p-panel-toggleable': true }] }, 'Title'); * ``` */ declare function createElement(type: string, attributes?: Record, ...children: (string | Node)[]): HTMLElement | undefined; /** * Builds a `` sequence inside it * closes the tag early. * * @param css Stylesheet text. Returns an empty string when falsy. * @param attributes Attributes to serialize onto the tag. * @returns The markup, or `''`. */ declare function createStyleMarkup(css?: string, attributes?: Record): string; /** * Creates an empty `