import type { RevealConfig, TransitionStyle, TransitionSpeed, FragmentAnimation, KatexConfig, Mathjax2Config, Mathjax3Config, Mathjax4Config, HighlightConfig, MarkdownConfig, } from './config'; export type { RevealConfig, TransitionStyle, TransitionSpeed, FragmentAnimation, KatexConfig, Mathjax2Config, Mathjax3Config, Mathjax4Config, HighlightConfig, MarkdownConfig, } from './config'; export default Reveal; // The type definitions in this file are adapted from those // originally created by the community on DefinitelyTyped: // https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/reveal.js /** * reveal.js - MIT licensed * * Copyright (C) 2011-2026 Hakim El Hattab, https://hakim.se * * @see {@link https://revealjs.com} * @see {@link https://github.com/hakimel/reveal.js/blob/master/js/reveal.js} * @see {@link https://revealjs.com/api/} */ declare const Reveal: { new (options?: RevealConfig): RevealApi; new (revealElement: HTMLElement, options?: RevealConfig): RevealApi; } & RevealApi; /** * The public reveal.js API * * @see {@link https://github.com/hakimel/reveal.js/blob/master/js/reveal.js} */ export interface RevealApi { /** * The reveal.js version * * @returns reveal.js version */ VERSION: string; /** * Starts up the presentation. * * @param options - RevealOption see {@link Options} * @returns a promise */ initialize(options?: RevealConfig): Promise; /** * Applies the configuration settings from the config * object. May be called multiple times. * * @param options - RevealOption see {@link RevealConfig} */ configure(options?: RevealConfig): void; /** * Uninitializes reveal.js by undoing changes made to the * DOM and removing all event listeners. */ destroy(): void; /** * Syncs the presentation with the current DOM. Useful * when new slides or control elements are added or when * the configuration has changed. */ sync(): void; /** * Updates reveal.js to keep in sync with new slide attributes. For * example, if you add a new `data-background-image` you can call * this to have reveal.js render the new background image. * * Similar to #sync() but more efficient when you only need to * refresh a specific slide. Dispatches a `slidesync` event * when syncing has completed. * * @param slide * @see {@link sync} */ syncSlide(slide: HTMLElement): void; /** * Formats the fragments on the given slide so that they have * valid indices. Call this if fragments are changed in the DOM * after reveal.js has already initialized. * * @param slide * @returns a list of the HTML fragments that were synced */ syncFragments(slide: HTMLElement): HTMLElement[]; /** * Removes hidden slides (data-visibility="hidden") from the DOM. * This happens automatically when reveal.js initialized, so only * call this to remove hidden slides before initialization. */ removeHiddenSlides(): void; /** * Steps from the current point in the presentation to the * slide which matches the specified horizontal and vertical * indices. * * @param horizontalIndex - Horizontal index of the target slide * @param verticalIndex - Vertical index of the target slide * @param fragmentIndex - Index of a fragment within the target slide to activate * @param origin - Origin for use in multimaster environments */ slide( horizontalIndex?: number, verticalIndex?: number, fragmentIndex?: number, origin?: number ): void; /** * Navigate one step to the left * * @param params see {@link NavigateParams} */ left: NavigationFunction; /** * Navigate one step to the right * * @param params see {@link NavigateParams} */ right: NavigationFunction; /** * Navigate one step up * * @param params see {@link NavigateParams} */ up: NavigationFunction; /** * Navigate one step down * * @param params see {@link NavigateParams} */ down: NavigationFunction; /** * Navigates backwards, prioritized in the following order: * 1) Previous fragment * 2) Previous vertical slide * 3) Previous horizontal slide * * @param params see {@link NavigateParams} */ prev: NavigationFunction; /** * Navigates forwards, prioritized in the following order: * 1) Next fragment * 2) Next vertical slide * 3) Next horizontal slide * * @param params see {@link NavigateParams} */ next: NavigationFunction; // Navigation aliases /** * Alias for `left` see {@link left} */ navigateLeft: NavigationFunction; /** * Alias for `right` see {@link right} */ navigateRight: NavigationFunction; /** * Alias for `up` see {@link up} */ navigateUp: NavigationFunction; /** * Alias for `down` see {@link down} */ navigateDown: NavigationFunction; /** * Alias for `prev` see {@link prev} */ navigatePrev: NavigationFunction; /** * Alias for `next` see {@link next} */ navigateNext: NavigationFunction; /** * Navigate to the specified slide fragment. * * @param index - The index of the fragment that * should be shown, -1 means all are invisible * @param offset - Integer offset to apply to the * fragment index * * @returns true if a change was made in any * fragments visibility as part of this call */ navigateFragment(index?: number, offset?: number): boolean; /** * Navigate to the previous slide fragment. * * @returns true if there was a previous fragment, * false otherwise */ prevFragment(): boolean; /** * Navigate to the next slide fragment. * * @returns true if there was a next fragment, * false otherwise */ nextFragment(): boolean; /** * Adds a listener to one of our custom reveal.js events, * like slidechanged and slidesync. * * @param type * @param listener * @param useCapture */ on: HTMLElement['addEventListener']; /** * Unsubscribes from a reveal.js event. * * @param type * @param listener * @param useCapture */ off: HTMLElement['removeEventListener']; /** * Legacy event binding methods left in for backwards compatibility * Adds a listener to one of our custom reveal.js events, * like slidechanged and slidesync. * See: {@link on} * * @param type * @param listener * @param useCapture */ addEventListener: HTMLElement['addEventListener']; /** * Legacy event binding methods left in for backwards compatibility * Unsubscribes from a reveal.js event. * See: {@link off} * * @param type * @param listener * @param useCapture */ removeEventListener: HTMLElement['removeEventListener']; /** * Applies JavaScript-controlled layout rules to the * presentation. */ layout(): void; /** * Randomly shuffles all slides in the deck. */ shuffle(slides?: HTMLElement[]): void; /** * Determine what available routes there are for navigation. * * @param params - If includeFragments is set, a route will be considered * available if either a slide OR a fragment is available in the given direction * * @returns Available route {left, right, up, down} */ availableRoutes(params?: { includeFragments?: boolean }): { down: boolean; left: boolean; right: boolean; up: boolean; }; /** * Returns an object describing the available fragment * directions. * * @returns Available fragments {prev, next} */ availableFragments(): { prev: boolean; next: boolean }; /** * Open or close help overlay window. * * @param override - Flag which overrides the * toggle logic and forcibly sets the desired state. True means * help is open, false means it's closed. */ toggleHelp(override?: boolean): void; /** * Toggles the slide overview mode on and off. * * @param override - Flag which overrides the * toggle logic and forcibly sets the desired state. True means * overview is open, false means it's closed. */ toggleOverview(override?: boolean): void; /** * Toggles the paused mode on and off. * * @param override - Flag which overrides the * toggle logic and forcibly sets the desired state. */ togglePause(override?: boolean): void; /** * Toggles the auto slide mode on and off. * * @param override - Flag which sets the desired state. * True means autoplay starts, false means it stops. */ toggleAutoSlide(override?: boolean): void; /** * @returns true if we're currently on the first slide in * the presentation. */ isFirstSlide(): boolean; /** * @returns Returns true if we're currently on the last slide in * the presentation. If the last slide is a stack, we only * consider this the last slide if it's at the end of the * stack. */ isLastSlide(): boolean; /** * @returns true if we're on the last slide in the current * vertical stack. */ isLastVerticalSlide(): boolean; /** * Checks if the current or specified slide is vertical * (nested within another slide). * * @param slide - the slide to check orientation of. Defaults to the current slide. * @return true if the current or specified slide is vertical */ isVerticalSlide(slide?: HTMLElement): boolean; /** * @returns true if we are currently in the paused mode. */ isPaused(): boolean; /** * @returns true if the auto slide mode is currently on. */ isAutoSliding(): boolean; /** * @returns true if this presentation is running inside of * the speaker notes window. */ isSpeakerNotes(): boolean; /** * @returns true if the overview is active, false otherwise */ isOverview(): boolean; /** * Checks if the presentation is focused * * @returns true if the it is focused, false otherwise */ isFocused(): boolean; /** * Checks if this reveal.js instance is being used to print a PDF. * * @returns true if being used to print a PDF, false otherwise */ isPrintingPDF(): boolean; /** * Checks if reveal.js has been loaded and is ready for use * * @returns true if reveal.js is ready for use, false otherwise */ isReady(): boolean; /** * Called when the given slide is within the configured view * distance. Shows the slide element and loads any content * that is set to load lazily (data-src). * * @param slide - Slide to show */ loadSlide(slide: HTMLElement, options?: { excludeIframes?: boolean }): void; /** * Unloads and hides the given slide. This is called when the * slide is moved outside of the configured view distance. * * @param slide */ unloadSlide(slide: HTMLElement): void; /** * Opens a preview window for the target URL. * * @param url - url for preview iframe src */ showPreview(url: string): void; /** * Closes any currently open overlay. */ hidePreview(): void; /** * Binds all internal event listeners. */ addEventListeners(): void; /** * Unbinds all internal event listeners. */ removeEventListeners(): void; /** * Dispatches an event of the specified type from the * reveal DOM element. */ dispatchEvent({ target, type, data, bubbles, }: { /** `revealElement` by default */ target?: HTMLElement; type: string; data?: unknown; bubbles?: boolean; }): Event; /** * Retrieves the current state of the presentation as * an object. This state can then be restored at any * time. * * @returns The current state - {indexh, indexv, indexf, paused, overview} */ getState(): RevealState; /** * Restores the presentation to the given state. * * @param object - state as generated by getState() * @see {@link getState} generates the parameter `state` */ setState(object: RevealState): void; /** * Returns a value ranging from 0-1 that represents * how far into the presentation we have navigated. * * @returns a value ranging from 0-1 that represents * how far into the presentation we have navigated. */ getProgress(): number; /** * Retrieves the h/v location and fragment of the current, * or specified, slide. * * @param slide - if specified, the returned index will * be for this slide rather than the currently active one * * @return h/v location and fragment of the current, * or specified, slide. {h, v, f} */ getIndices(slide?: HTMLElement): { h: number; v: number; f: number }; /** * Returns an array of objects where each object represents the * attributes on its respective slide. * * @returns an array of objects where each object represents the * attributes on its respective slide. */ getSlidesAttributes(): Record[]; /** * Returns the number of past slides. This can be used as a global * flattened index for slides. * * @param [slide] - The slide we're counting before, defaults to current slide * * @returns Past slide count */ getSlidePastCount(slide?: HTMLElement): number; /** * Retrieves the total number of slides in this presentation. * * @returns the total number of slides in this presentation. */ getTotalSlides(): number; /** * Returns the slide element matching the specified index. * * @param x - slide index * @param [y] - slide index * * @returns the slide element matching the specified index */ getSlide(x: number, y?: number): HTMLElement | undefined; /** * Returns the previous slide element, may be null * * @returns the previous slide element, may be null */ getPreviousSlide(): HTMLElement | null; /** * Returns the current slide element * * @returns the current slide element */ getCurrentSlide(): HTMLElement; /** * Returns the background element for the given slide. * All slides, even the ones with no background properties * defined, have a background element so as long as the * index is valid an element will be returned. * * @param element A slide * @returns the background element for the given slide */ getSlideBackground(element: HTMLElement): HTMLElement | undefined; /** * Returns the background element for the given slide. * All slides, even the ones with no background properties * defined, have a background element so as long as the * index is valid an element will be returned. * * @param x - Horizontal background index OR a slide * HTML element * @param [y] - Vertical background index * @returns the background element for the given slide */ getSlideBackground(x: number, y?: number): HTMLElement | undefined; /** * Retrieves the speaker notes from a slide. Notes can be * defined in two ways: * 1. As a data-notes attribute on the slide
* 2. As an