import type { ReactElement, ReactNode } from 'react'; import TagStatus from './tag-status.js'; export declare const booleanAttributes: Set; export interface IMetaManagerTags { html: Map; order: number; }>; body: Map; order: number; }>; meta: Map; containers: Set; } export interface IMetaManagerTagsDefinitions { [type: string]: { key?: string; order: number; }; } /** * Meta tags manager */ declare class Manager { /** * Root container id */ static rootContainerId: string; /** * Detect server side */ isServer: boolean; /** * Meta tags state */ protected tags: IMetaManagerTags; /** * Tags definitions */ protected tagsDefinitions: IMetaManagerTagsDefinitions; /** * System tag attributes */ protected reservedAttributes: { order: string; }; /** * Scheduled synchronization */ protected syncTimerId: null | NodeJS.Timeout; /** DOM ownership is private client state, separate from the public tag snapshot. */ private rootAttributes; /** Live head nodes have been adopted, see analyzeClientHead. */ private isHeadAnalyzed; /** * @constructor */ constructor(tags?: Partial); /** * Set tags definitions */ setTagsDefinitions(definitions: IMetaManagerTagsDefinitions): void; /** * Remove children, dangerouslySetInnerHTML etc. */ static cleanupElementProps(props: Record): Record; /** * Sort elements or props */ protected sortTags>(elements: T): T; /** * Get meta tags */ getTags(): IMetaManagerTags; /** * Replace react attribute to valid DOM attribute */ protected replaceAttribute(tagName: string, attribute: string): string; /** * Create DOM element from React element */ protected createDomElement(element: Pick): HTMLElement | undefined; /** * Make element key by element props */ protected buildKeyByProps(type: string, props?: Record, isSkipProps?: boolean): string | undefined; /** * Get default tag key for not unique elements */ protected getDefaultKey(type: string, containerId: string, index: number): string; /** * Check if tag is not unique */ protected isNotUniqueTag(key: string): boolean; /** * Clone react element * * @param isRender the element itself is only built when the server renders it */ protected cloneElement(element: Pick, isRender?: boolean): { element?: ReactElement; elementProps: Record; }; /** * Get element order */ protected getElementOrder(elementProps: Record, type: string, key?: string): number; /** * Push react elements to meta state * * @returns true when a pushed tag still has to reach the DOM */ protected pushElements(elements: ReactNode, containerId: string, isReplace?: boolean, status?: TagStatus, sources?: (string | undefined)[]): boolean; /** * Register a React element or a snapshot of a live DOM element. * * @returns true when the tag still has to reach the DOM */ protected pushElement(child: { type: string; props: Record; }, index: number, containerId: string, isReplace: boolean, status: TagStatus, domElement?: HTMLElement, source?: string): boolean; /** * Adopt the live not unique tag with the same type and content, still owned by the root container. */ private takeRootElement; /** * Get html or body props */ getRootTagProps(props: Manager['tags']['html']): Record; /** * DOM attributes, inline style, text and markup the props of a tag stand for */ private getDomAttributes; /** * Whether a live element already carries the attributes and text of the props */ private isSameDomElement; /** * Apply props to dom element: only what differs is touched, attributes not in the props are removed. */ protected applyDomElementAttributes(element: Element, props?: Record): void; /** Merge root style objects while retaining ownership of each contributed property. */ private syncRootAttributes; /** * Synchronize local meta tags with head meta tags */ protected syncMeta(containerId?: string): void; /** * Push new meta tags * * @param sources original markup per child index; a tag stored with one is served verbatim */ pushTags(elements: ReactNode, containerId: string, isReplace?: boolean, sources?: (string | undefined)[]): void; /** * Remove meta tags */ removeTags(containerId: string): void; /** * Read attributes and text from the live DOM without serializing markup. */ protected getDomElementProps(element: HTMLElement): Record; /** * Initial analyze client head meta tags */ analyzeClientHead(): void; } export default Manager;