import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
/**
* The intrinsic size a nodeView reserves while off-screen (`contain-intrinsic-width`/`-height`).
* `width` is optional: for block-level wrappers (expand, layout) the inline size comes from the
* containing block regardless of size containment, so only `height` is meaningful; for
* content-sized boxes (the `
` element, the mediaSingle wrapper) the width matters and must
* be supplied or the box collapses to 0 wide while contained.
*/
export type IntrinsicSize = {
height: number;
width?: number;
};
/**
* Estimate the rendered height of a table from its row count. Cell padding and cell borders are
* already folded into `TABLE_ROW_HEIGHT`; the table's block margins are added as a small buffer.
*/
export declare function estimateTableIntrinsicHeight(node: PMNode): number;
/**
* Estimate the rendered height of an expand. A collapsed expand reserves only its header row; an
* expanded one additionally reserves space for its child blocks. `expanded` is passed in by the
* caller because the two expand implementations track expanded state differently (a WeakMap in
* single-player vs the `__expanded` attribute in legacy).
*/
export declare function estimateExpandIntrinsicHeight(node: PMNode, expanded: boolean): number;
/**
* Estimate the rendered width AND height of a mediaSingle. Unlike the structural estimates above,
* media carries its real dimensions in the ADF: the child `media` node's `width`/`height` attrs
* give the intrinsic aspect ratio, and the rendered pixel width is computed with the exact same
* `calcMediaSinglePixelWidth` helper the renderer uses (honouring `width`/`widthType`/`layout` and
* the editor's content/container width). Height then follows from width × aspect ratio — plus a
* caption row when present and the mediaSingle's block margins — so this is the most accurate
* estimate of any node type. The pixel width is returned as the intrinsic width because the
* mediaSingle wrapper is content-sized. `lineLength` and `containerWidth` come from the width
* plugin's shared state.
*/
export declare function estimateMediaSingleIntrinsicSize(node: PMNode, lineLength: number, containerWidth: number): IntrinsicSize;
/**
* Produce a single-axis `contain-intrinsic-width`/`-height` value using the `auto` keyword so the
* browser remembers the element's real size after its first render and only uses the estimate
* beforehand.
*/
export declare function formatIntrinsicSize(px: number): string;
/**
* The `content-visibility` / `contain-intrinsic-*` styles applied to an eligible node. Width and
* height are kept as separate `contain-intrinsic-width`/`-height` axes rather than the
* `contain-intrinsic-size` shorthand: the shorthand's single value is applied to BOTH axes, which
* forces a wrong width on content-sized boxes (e.g. a 500px-tall `` would reserve 500px
* wide). `containIntrinsicWidth` is omitted for block-level wrappers whose width comes from layout.
*/
type ContentVisibilityStyle = {
containIntrinsicHeight: string;
containIntrinsicWidth?: string;
contentVisibility: 'auto';
};
/**
* Resolve the `content-visibility` styles for a node, or `undefined` when the optimisation should
* not apply.
*
* Gating is delegated to limited mode: `limitedModeEnabled` should come from the limited-mode
* plugin's shared state, so this feature shares a single "large document" definition with limited
* mode rather than a bespoke threshold. The optimisation applies only when the feature gate is on
* AND limited mode is active.
*
* The intrinsic size is supplied lazily via `getIntrinsicSize` so callers can compute a
* per-instance estimate from the node's structure, and is only evaluated when actually applied.
*/
export declare function getContentVisibilityStyle(limitedModeEnabled: boolean, getIntrinsicSize: () => IntrinsicSize): ContentVisibilityStyle | undefined;
/**
* Imperatively apply the `content-visibility: auto` rendering optimisation to a node's top-level
* DOM element (for use in raw-DOM nodeViews), but only when both the feature gate is on and limited
* mode is active (see `getContentVisibilityStyle`).
*
* The intrinsic size uses the `auto` keyword so any initial inaccuracy self-corrects once the
* element has been rendered once. Safe to call repeatedly (e.g. on expand/collapse toggle) — it
* simply re-applies or, when ineligible, leaves the element untouched.
*/
export declare function applyContentVisibility(dom: HTMLElement, limitedModeEnabled: boolean, getIntrinsicSize: () => IntrinsicSize): boolean;
export {};