UNPKG

@lifeart/gxt

Version:

<img align="right" width="95" height="95" alt="Philosopher’s stone, logo of PostCSS" src="./public/logo.png">

94 lines (92 loc) • 2.57 kB
import { PdfBaseElement, PdfDocument, PdfTextNode, PdfComment, PdfFragment } from './elements'; type Props = [any[], [string, any][], any[]]; /** * PDF Browser DOM API class * Manages PDF element creation, insertion, and property updates */ export declare class PdfBrowserDOMApi { private _document; private _onUpdate; toString(): string; /** * Set the document root */ setDocument(doc: PdfDocument): void; /** * Get the document root */ getDocument(): PdfDocument | null; /** * Set callback for document updates */ setOnUpdate(callback: () => void): void; /** * Notify that the document structure has changed */ private notifyUpdate; /** * Check if a value is a PDF node */ isNode(node: unknown): node is PdfBaseElement; /** * Get parent of a node */ parent(node: PdfBaseElement | null): PdfBaseElement | null; /** * Clear all children from a node */ clearChildren(node: PdfBaseElement | null): void; /** * Add event listener (no-op for PDF, but required by interface) */ addEventListener(_node: PdfBaseElement, _eventName: string, _fn: EventListener): undefined; /** * Create a new element by tag name */ element(tag: string, _isSVG?: boolean, _anchor?: boolean, _props?: Props): PdfBaseElement | null; /** * Insert a child into a parent */ insert(parent: PdfBaseElement | null, child: PdfBaseElement | null, _anchor?: PdfBaseElement | null): void; /** * Destroy/remove a node from the tree */ destroy(node: PdfBaseElement | null): void; /** * Set an attribute on a node (delegates to prop) */ attr(node: PdfBaseElement | null, name: string, value: any): void; /** * Set a property on a node */ prop(node: PdfBaseElement | null, name: string, value: any): void; /** * Apply style object to a node */ private applyStyle; /** * Create a comment node */ comment(text?: string): PdfComment; /** * Create a text node */ text(text: string | number): PdfTextNode; /** * Update text content of a text node */ textContent(node: PdfTextNode | null, text: string): void; /** * Create a fragment node */ fragment(): PdfFragment; /** * Serialize the document to JSON */ toJSON(): Record<string, any> | null; } /** * Create a new PDF API instance */ export declare function createPdfApi(): PdfBrowserDOMApi; export {};