import './index.css'; /** * Custom HTML element (``) that provides a full-featured PDF viewer. * * Extends `HTMLElement` and registers itself as a Web Component via `customElements.define()`. * The viewer includes a toolbar with zoom controls, page navigation, print/download buttons, * a dark/light theme toggle, a thumbnail side panel, and optional password protection. * * @example * ```html * * ``` * * @fires pageChange - Emitted when the visible page changes. Listener receives the 1-based page number. * @fires documentLoaded - Emitted when the PDF document has finished loading and rendering. * @fires passwordEnter - Emitted when the user submits a password (only for password-protected documents). */ declare class PDFLiveElement extends HTMLElement { /** Full-screen loading spinner overlay. */ private readonly loading; /** Error modal for displaying critical error messages. */ private readonly errorModal; /** Password entry modal for protected documents. */ private readonly passwordModal; /** Locale resource for the current language. */ private readonly language; /** Whether the PDF document has finished loading and rendering. */ private loaded; /** Whether the `documentLoaded` listener has already been invoked (prevents double invocation). */ private calledLoadListener; /** Page navigation controller (initialized after pages are rendered). */ private pageNav; /** Title element in the header toolbar. */ private readonly documentTitle; /** Print button in the header toolbar. */ private readonly printButton; /** Download button in the header toolbar. */ private readonly downloadButton; /** Theme toggle button in the header toolbar. */ private readonly themeChangeButton; /** Registered event listeners keyed by event type. */ private readonly listeners; /** URL of the currently loaded PDF document. */ private documentUrl; /** The pdf.js document proxy for the loaded PDF. */ private pdfDocument; /** * Constructs the PDF viewer element. * * Restores the saved theme (unless the `restoretheme="false"` attribute is set), * loads the locale resource, renders the viewer HTML skeleton, and initializes * references to key DOM elements. */ constructor(); /** * Custom element lifecycle callback invoked when the element is inserted into the DOM. * * Loads the PDF document, handles password protection if required, * renders all pages, initializes zoom/page/thumbnail navigation, * and binds toolbar button event handlers. */ protected connectedCallback(): Promise; /** * Registers the `` custom element with the browser if not already registered. * * @returns The `PDFLiveElement` class itself for chaining. */ static define(): typeof PDFLiveElement; /** * Convenience factory that registers the custom element (if needed) and creates a new instance. * * @returns A new `PDFLiveElement` instance. */ static createElement(): PDFLiveElement; /** * Registers an event listener for the specified event type. * * Supported events: * - `"pageChange"` — Fired when the visible page changes. Listener receives the 1-based page number. * - `"documentLoaded"` — Fired when the PDF has finished loading. If already loaded, invoked immediately. * - `"passwordEnter"` — Fired when the user submits a password. Listener receives the password string. * * @param type - The event type to listen for. * @param listener - The callback function. * @returns This instance for chaining. * @throws Error if the event type is not one of the supported types. */ on(type: 'pageChange' | 'documentLoaded' | 'passwordEnter', listener: Function): PDFLiveElement; /** * Returns the page number currently displayed in the viewer. * * @returns The current 1-based page number. */ getCurrentPageNumber(): number; /** * Renders the viewer HTML skeleton using Handlebars templates. * * On mobile viewports (width <= {@link constants.MINIMUM_MOBILE_WIDTH}), * the thumbnail panel starts in the closed state. */ private render; /** * Prints the currently loaded PDF document. * * Opens the browser's print dialog with the PDF loaded in a hidden iframe. */ print(): Promise; /** * Downloads the currently loaded PDF document. * * Uses the `title` attribute as the filename if set; otherwise extracts * the filename from the document URL. Appends a `.pdf` extension if missing. */ download(): Promise; } export default PDFLiveElement;