import type { IconRenderer } from '../../icons/icon-renderer'; import type { BuiltInRenderContext } from '../../types/built-in-renderer.types'; /** * Helpers shared by the built-in renderers. * * Everything here is deliberately allocation-light: these run once per rendered * cell, and a viewport can hold a few thousand of them during a fast scroll. * * @packageDocumentation */ /** Class on the element every renderer's output hangs off. */ export declare const VALUE_CLASS = "pg-cell__value"; /** * Builds the `.pg-cell__value` wrapper. * * Every renderer emits one, and for `textOnly` renderers it must be the *first* * child of `.pg-cell__inner` — that is what `findValueEl` looks for when the * Virtual DOM decides whether a cell can be patched with a single `textContent` * write. * * @param modifier - Optional BEM modifier suffix, e.g. `'bool'` → `pg-cell__value--bool`. * @param extra - Extra class from the renderer's `cssClass` option. */ export declare function valueSpan(modifier?: string, extra?: string): HTMLElement; /** * Writes a plain-text cell. * * `title` mirrors the text so the browser's truncation tooltip never disagrees * with what is shown — the same thing `CellPatcher` does when it patches. */ export declare function renderText(ctx: BuiltInRenderContext, text: string, modifier?: string): void; /** `true` when a value has nothing to show — `null`, `undefined`, or an empty/blank string. */ export declare function isEmptyValue(value: unknown): boolean; /** * Renders the empty state and reports whether it did. * * Every renderer calls this first. Returning a boolean rather than throwing or * writing nothing keeps the "no value" decision in one place instead of each * renderer inventing its own. * * @returns `true` when the value was empty and the cell has been filled. */ export declare function renderIfEmpty(ctx: BuiltInRenderContext): boolean; /** * Resolves an option that may be a literal or a function of the cell value. * * Lets `{ color: '#f00' }` and `{ color: (v) => v > 90 ? 'red' : 'green' }` be * the same option rather than two. */ export declare function resolveOption(option: T | ((value: unknown) => T | undefined) | undefined, value: unknown): T | undefined; /** The context's icon renderer, or `null` when the caller supplied none. */ export declare function icons(ctx: BuiltInRenderContext): IconRenderer | null; /** * Appends an icon by registry name. * * Goes through `IconRenderer` rather than inlining SVG so every icon stays * replaceable through the icon registry. * * @returns The mounted element, or `null` when no icon renderer is available. */ export declare function appendIcon(ctx: BuiltInRenderContext, parent: HTMLElement, name: string, size?: number, color?: string): HTMLElement | null; /** * Builds a pill element, the shape `badge`, `chip`, `tag` and `list` share. * * A colour is applied as a translucent fill plus solid text, matching the * convention the grid already used for `dropdownOptions[].color`. */ export declare function pill(label: string, color?: string, modifier?: string): HTMLElement; /** * A stable colour for an arbitrary string. * * Used by the `tag` renderer so repeated values are consistently coloured * without the author enumerating every one. HSL with fixed saturation and * lightness keeps every generated colour legible against the cell background * and in the same visual family, which a raw hash-to-RGB would not. */ export declare function colorForText(text: string): string; /** Coerces to a finite number, or `null` when the value is not numeric. */ export declare function toNumber(value: unknown): number | null; /** `true` when the value looks like something an `` can load. */ export declare function isImageSource(value: string): boolean; /** * Derives display initials from a name. * * First and last word rather than the first two, so "Maria del Carmen Sanchez" * reads as "MS" — the pair a reader actually uses to identify someone. */ export declare function initialsOf(name: string): string; //# sourceMappingURL=shared.d.ts.map