| 1 | import type { |
| 2 | RevealConfig, |
| 3 | TransitionStyle, |
| 4 | TransitionSpeed, |
| 5 | FragmentAnimation, |
| 6 | KatexConfig, |
| 7 | Mathjax2Config, |
| 8 | Mathjax3Config, |
| 9 | Mathjax4Config, |
| 10 | HighlightConfig, |
| 11 | MarkdownConfig, |
| 12 | } from './config'; |
| 13 | |
| 14 | export type { |
| 15 | RevealConfig, |
| 16 | TransitionStyle, |
| 17 | TransitionSpeed, |
| 18 | FragmentAnimation, |
| 19 | KatexConfig, |
| 20 | Mathjax2Config, |
| 21 | Mathjax3Config, |
| 22 | Mathjax4Config, |
| 23 | HighlightConfig, |
| 24 | MarkdownConfig, |
| 25 | } from './config'; |
| 26 | |
| 27 | export default Reveal; |
| 28 | |
| 29 | // The type definitions in this file are adapted from those |
| 30 | // originally created by the community on DefinitelyTyped: |
| 31 | // https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/reveal.js |
| 32 | |
| 33 | /** |
| 34 | * reveal.js - MIT licensed |
| 35 | * |
| 36 | * Copyright (C) 2011-2026 Hakim El Hattab, https://hakim.se |
| 37 | * |
| 38 | * @see {@link https://revealjs.com} |
| 39 | * @see {@link https://github.com/hakimel/reveal.js/blob/master/js/reveal.js} |
| 40 | * @see {@link https://revealjs.com/api/} |
| 41 | */ |
| 42 | declare const Reveal: { |
| 43 | new (options?: RevealConfig): RevealApi; |
| 44 | new (revealElement: HTMLElement, options?: RevealConfig): RevealApi; |
| 45 | } & RevealApi; |
| 46 | |
| 47 | /** |
| 48 | * The public reveal.js API |
| 49 | * |
| 50 | * @see {@link https://github.com/hakimel/reveal.js/blob/master/js/reveal.js} |
| 51 | */ |
| 52 | export interface RevealApi { |
| 53 | /** |
| 54 | * The reveal.js version |
| 55 | * |
| 56 | * @returns reveal.js version |
| 57 | */ |
| 58 | VERSION: string; |
| 59 | |
| 60 | /** |
| 61 | * Starts up the presentation. |
| 62 | * |
| 63 | * @param options - RevealOption see {@link Options} |
| 64 | * @returns a promise |
| 65 | */ |
| 66 | initialize(options?: RevealConfig): Promise<RevealApi>; |
| 67 | |
| 68 | /** |
| 69 | * Applies the configuration settings from the config |
| 70 | * object. May be called multiple times. |
| 71 | * |
| 72 | * @param options - RevealOption see {@link RevealConfig} |
| 73 | */ |
| 74 | configure(options?: RevealConfig): void; |
| 75 | |
| 76 | /** |
| 77 | * Uninitializes reveal.js by undoing changes made to the |
| 78 | * DOM and removing all event listeners. |
| 79 | */ |
| 80 | destroy(): void; |
| 81 | |
| 82 | /** |
| 83 | * Syncs the presentation with the current DOM. Useful |
| 84 | * when new slides or control elements are added or when |
| 85 | * the configuration has changed. |
| 86 | */ |
| 87 | sync(): void; |
| 88 | |
| 89 | /** |
| 90 | * Updates reveal.js to keep in sync with new slide attributes. For |
| 91 | * example, if you add a new `data-background-image` you can call |
| 92 | * this to have reveal.js render the new background image. |
| 93 | * |
| 94 | * Similar to #sync() but more efficient when you only need to |
| 95 | * refresh a specific slide. Dispatches a `slidesync` event |
| 96 | * when syncing has completed. |
| 97 | * |
| 98 | * @param slide |
| 99 | * @see {@link sync} |
| 100 | */ |
| 101 | syncSlide(slide: HTMLElement): void; |
| 102 | |
| 103 | /** |
| 104 | * Formats the fragments on the given slide so that they have |
| 105 | * valid indices. Call this if fragments are changed in the DOM |
| 106 | * after reveal.js has already initialized. |
| 107 | * |
| 108 | * @param slide |
| 109 | * @returns a list of the HTML fragments that were synced |
| 110 | */ |
| 111 | syncFragments(slide: HTMLElement): HTMLElement[]; |
| 112 | |
| 113 | /** |
| 114 | * Removes hidden slides (data-visibility="hidden") from the DOM. |
| 115 | * This happens automatically when reveal.js initialized, so only |
| 116 | * call this to remove hidden slides before initialization. |
| 117 | */ |
| 118 | removeHiddenSlides(): void; |
| 119 | |
| 120 | /** |
| 121 | * Steps from the current point in the presentation to the |
| 122 | * slide which matches the specified horizontal and vertical |
| 123 | * indices. |
| 124 | * |
| 125 | * @param horizontalIndex - Horizontal index of the target slide |
| 126 | * @param verticalIndex - Vertical index of the target slide |
| 127 | * @param fragmentIndex - Index of a fragment within the target slide to activate |
| 128 | * @param origin - Origin for use in multimaster environments |
| 129 | */ |
| 130 | slide( |
| 131 | horizontalIndex?: number, |
| 132 | verticalIndex?: number, |
| 133 | fragmentIndex?: number, |
| 134 | origin?: number |
| 135 | ): void; |
| 136 | |
| 137 | /** |
| 138 | * Navigate one step to the left |
| 139 | * |
| 140 | * @param params see {@link NavigateParams} |
| 141 | */ |
| 142 | left: NavigationFunction; |
| 143 | |
| 144 | /** |
| 145 | * Navigate one step to the right |
| 146 | * |
| 147 | * @param params see {@link NavigateParams} |
| 148 | */ |
| 149 | right: NavigationFunction; |
| 150 | |
| 151 | /** |
| 152 | * Navigate one step up |
| 153 | * |
| 154 | * @param params see {@link NavigateParams} |
| 155 | */ |
| 156 | up: NavigationFunction; |
| 157 | |
| 158 | /** |
| 159 | * Navigate one step down |
| 160 | * |
| 161 | * @param params see {@link NavigateParams} |
| 162 | */ |
| 163 | down: NavigationFunction; |
| 164 | |
| 165 | /** |
| 166 | * Navigates backwards, prioritized in the following order: |
| 167 | * 1) Previous fragment |
| 168 | * 2) Previous vertical slide |
| 169 | * 3) Previous horizontal slide |
| 170 | * |
| 171 | * @param params see {@link NavigateParams} |
| 172 | */ |
| 173 | prev: NavigationFunction; |
| 174 | |
| 175 | /** |
| 176 | * Navigates forwards, prioritized in the following order: |
| 177 | * 1) Next fragment |
| 178 | * 2) Next vertical slide |
| 179 | * 3) Next horizontal slide |
| 180 | * |
| 181 | * @param params see {@link NavigateParams} |
| 182 | */ |
| 183 | next: NavigationFunction; |
| 184 | |
| 185 | // Navigation aliases |
| 186 | |
| 187 | /** |
| 188 | * Alias for `left` see {@link left} |
| 189 | */ |
| 190 | navigateLeft: NavigationFunction; |
| 191 | |
| 192 | /** |
| 193 | * Alias for `right` see {@link right} |
| 194 | */ |
| 195 | navigateRight: NavigationFunction; |
| 196 | |
| 197 | /** |
| 198 | * Alias for `up` see {@link up} |
| 199 | */ |
| 200 | navigateUp: NavigationFunction; |
| 201 | |
| 202 | /** |
| 203 | * Alias for `down` see {@link down} |
| 204 | */ |
| 205 | navigateDown: NavigationFunction; |
| 206 | |
| 207 | /** |
| 208 | * Alias for `prev` see {@link prev} |
| 209 | */ |
| 210 | navigatePrev: NavigationFunction; |
| 211 | |
| 212 | /** |
| 213 | * Alias for `next` see {@link next} |
| 214 | */ |
| 215 | navigateNext: NavigationFunction; |
| 216 | |
| 217 | /** |
| 218 | * Navigate to the specified slide fragment. |
| 219 | * |
| 220 | * @param index - The index of the fragment that |
| 221 | * should be shown, -1 means all are invisible |
| 222 | * @param offset - Integer offset to apply to the |
| 223 | * fragment index |
| 224 | * |
| 225 | * @returns true if a change was made in any |
| 226 | * fragments visibility as part of this call |
| 227 | */ |
| 228 | navigateFragment(index?: number, offset?: number): boolean; |
| 229 | |
| 230 | /** |
| 231 | * Navigate to the previous slide fragment. |
| 232 | * |
| 233 | * @returns true if there was a previous fragment, |
| 234 | * false otherwise |
| 235 | */ |
| 236 | prevFragment(): boolean; |
| 237 | |
| 238 | /** |
| 239 | * Navigate to the next slide fragment. |
| 240 | * |
| 241 | * @returns true if there was a next fragment, |
| 242 | * false otherwise |
| 243 | */ |
| 244 | nextFragment(): boolean; |
| 245 | |
| 246 | /** |
| 247 | * Adds a listener to one of our custom reveal.js events, |
| 248 | * like slidechanged and slidesync. |
| 249 | * |
| 250 | * @param type |
| 251 | * @param listener |
| 252 | * @param useCapture |
| 253 | */ |
| 254 | on: HTMLElement['addEventListener']; |
| 255 | |
| 256 | /** |
| 257 | * Unsubscribes from a reveal.js event. |
| 258 | * |
| 259 | * @param type |
| 260 | * @param listener |
| 261 | * @param useCapture |
| 262 | */ |
| 263 | off: HTMLElement['removeEventListener']; |
| 264 | |
| 265 | /** |
| 266 | * Legacy event binding methods left in for backwards compatibility |
| 267 | * Adds a listener to one of our custom reveal.js events, |
| 268 | * like slidechanged and slidesync. |
| 269 | * See: {@link on} |
| 270 | * |
| 271 | * @param type |
| 272 | * @param listener |
| 273 | * @param useCapture |
| 274 | */ |
| 275 | addEventListener: HTMLElement['addEventListener']; |
| 276 | |
| 277 | /** |
| 278 | * Legacy event binding methods left in for backwards compatibility |
| 279 | * Unsubscribes from a reveal.js event. |
| 280 | * See: {@link off} |
| 281 | * |
| 282 | * @param type |
| 283 | * @param listener |
| 284 | * @param useCapture |
| 285 | */ |
| 286 | removeEventListener: HTMLElement['removeEventListener']; |
| 287 | |
| 288 | /** |
| 289 | * Applies JavaScript-controlled layout rules to the |
| 290 | * presentation. |
| 291 | */ |
| 292 | layout(): void; |
| 293 | |
| 294 | /** |
| 295 | * Randomly shuffles all slides in the deck. |
| 296 | */ |
| 297 | shuffle(slides?: HTMLElement[]): void; |
| 298 | |
| 299 | /** |
| 300 | * Determine what available routes there are for navigation. |
| 301 | * |
| 302 | * @param params - If includeFragments is set, a route will be considered |
| 303 | * available if either a slide OR a fragment is available in the given direction |
| 304 | * |
| 305 | * @returns Available route {left, right, up, down} |
| 306 | */ |
| 307 | availableRoutes(params?: { includeFragments?: boolean }): { |
| 308 | down: boolean; |
| 309 | left: boolean; |
| 310 | right: boolean; |
| 311 | up: boolean; |
| 312 | }; |
| 313 | |
| 314 | /** |
| 315 | * Returns an object describing the available fragment |
| 316 | * directions. |
| 317 | * |
| 318 | * @returns Available fragments {prev, next} |
| 319 | */ |
| 320 | availableFragments(): { prev: boolean; next: boolean }; |
| 321 | |
| 322 | /** |
| 323 | * Open or close help overlay window. |
| 324 | * |
| 325 | * @param override - Flag which overrides the |
| 326 | * toggle logic and forcibly sets the desired state. True means |
| 327 | * help is open, false means it's closed. |
| 328 | */ |
| 329 | toggleHelp(override?: boolean): void; |
| 330 | |
| 331 | /** |
| 332 | * Toggles the slide overview mode on and off. |
| 333 | * |
| 334 | * @param override - Flag which overrides the |
| 335 | * toggle logic and forcibly sets the desired state. True means |
| 336 | * overview is open, false means it's closed. |
| 337 | */ |
| 338 | toggleOverview(override?: boolean): void; |
| 339 | |
| 340 | /** |
| 341 | * Toggles the paused mode on and off. |
| 342 | * |
| 343 | * @param override - Flag which overrides the |
| 344 | * toggle logic and forcibly sets the desired state. |
| 345 | */ |
| 346 | togglePause(override?: boolean): void; |
| 347 | |
| 348 | /** |
| 349 | * Toggles the auto slide mode on and off. |
| 350 | * |
| 351 | * @param override - Flag which sets the desired state. |
| 352 | * True means autoplay starts, false means it stops. |
| 353 | */ |
| 354 | toggleAutoSlide(override?: boolean): void; |
| 355 | |
| 356 | /** |
| 357 | * @returns true if we're currently on the first slide in |
| 358 | * the presentation. |
| 359 | */ |
| 360 | isFirstSlide(): boolean; |
| 361 | |
| 362 | /** |
| 363 | * @returns Returns true if we're currently on the last slide in |
| 364 | * the presentation. If the last slide is a stack, we only |
| 365 | * consider this the last slide if it's at the end of the |
| 366 | * stack. |
| 367 | */ |
| 368 | isLastSlide(): boolean; |
| 369 | |
| 370 | /** |
| 371 | * @returns true if we're on the last slide in the current |
| 372 | * vertical stack. |
| 373 | */ |
| 374 | isLastVerticalSlide(): boolean; |
| 375 | |
| 376 | /** |
| 377 | * Checks if the current or specified slide is vertical |
| 378 | * (nested within another slide). |
| 379 | * |
| 380 | * @param slide - the slide to check orientation of. Defaults to the current slide. |
| 381 | * @return true if the current or specified slide is vertical |
| 382 | */ |
| 383 | isVerticalSlide(slide?: HTMLElement): boolean; |
| 384 | |
| 385 | /** |
| 386 | * @returns true if we are currently in the paused mode. |
| 387 | */ |
| 388 | isPaused(): boolean; |
| 389 | |
| 390 | /** |
| 391 | * @returns true if the auto slide mode is currently on. |
| 392 | */ |
| 393 | isAutoSliding(): boolean; |
| 394 | |
| 395 | /** |
| 396 | * @returns true if this presentation is running inside of |
| 397 | * the speaker notes window. |
| 398 | */ |
| 399 | isSpeakerNotes(): boolean; |
| 400 | |
| 401 | /** |
| 402 | * @returns true if the overview is active, false otherwise |
| 403 | */ |
| 404 | isOverview(): boolean; |
| 405 | |
| 406 | /** |
| 407 | * Checks if the presentation is focused |
| 408 | * |
| 409 | * @returns true if the it is focused, false otherwise |
| 410 | */ |
| 411 | isFocused(): boolean; |
| 412 | |
| 413 | /** |
| 414 | * Checks if this reveal.js instance is being used to print a PDF. |
| 415 | * |
| 416 | * @returns true if being used to print a PDF, false otherwise |
| 417 | */ |
| 418 | isPrintingPDF(): boolean; |
| 419 | |
| 420 | /** |
| 421 | * Checks if reveal.js has been loaded and is ready for use |
| 422 | * |
| 423 | * @returns true if reveal.js is ready for use, false otherwise |
| 424 | */ |
| 425 | isReady(): boolean; |
| 426 | |
| 427 | /** |
| 428 | * Called when the given slide is within the configured view |
| 429 | * distance. Shows the slide element and loads any content |
| 430 | * that is set to load lazily (data-src). |
| 431 | * |
| 432 | * @param slide - Slide to show |
| 433 | */ |
| 434 | loadSlide(slide: HTMLElement, options?: { excludeIframes?: boolean }): void; |
| 435 | |
| 436 | /** |
| 437 | * Unloads and hides the given slide. This is called when the |
| 438 | * slide is moved outside of the configured view distance. |
| 439 | * |
| 440 | * @param slide |
| 441 | */ |
| 442 | unloadSlide(slide: HTMLElement): void; |
| 443 | |
| 444 | /** |
| 445 | * Opens a preview window for the target URL. |
| 446 | * |
| 447 | * @param url - url for preview iframe src |
| 448 | */ |
| 449 | showPreview(url: string): void; |
| 450 | |
| 451 | /** |
| 452 | * Closes any currently open overlay. |
| 453 | */ |
| 454 | hidePreview(): void; |
| 455 | |
| 456 | /** |
| 457 | * Binds all internal event listeners. |
| 458 | */ |
| 459 | addEventListeners(): void; |
| 460 | |
| 461 | /** |
| 462 | * Unbinds all internal event listeners. |
| 463 | */ |
| 464 | removeEventListeners(): void; |
| 465 | |
| 466 | /** |
| 467 | * Dispatches an event of the specified type from the |
| 468 | * reveal DOM element. |
| 469 | */ |
| 470 | dispatchEvent({ |
| 471 | target, |
| 472 | type, |
| 473 | data, |
| 474 | bubbles, |
| 475 | }: { |
| 476 | /** `revealElement` by default */ |
| 477 | target?: HTMLElement; |
| 478 | type: string; |
| 479 | data?: unknown; |
| 480 | bubbles?: boolean; |
| 481 | }): Event; |
| 482 | |
| 483 | /** |
| 484 | * Retrieves the current state of the presentation as |
| 485 | * an object. This state can then be restored at any |
| 486 | * time. |
| 487 | * |
| 488 | * @returns The current state - {indexh, indexv, indexf, paused, overview} |
| 489 | */ |
| 490 | getState(): RevealState; |
| 491 | |
| 492 | /** |
| 493 | * Restores the presentation to the given state. |
| 494 | * |
| 495 | * @param object - state as generated by getState() |
| 496 | * @see {@link getState} generates the parameter `state` |
| 497 | */ |
| 498 | setState(object: RevealState): void; |
| 499 | |
| 500 | /** |
| 501 | * Returns a value ranging from 0-1 that represents |
| 502 | * how far into the presentation we have navigated. |
| 503 | * |
| 504 | * @returns a value ranging from 0-1 that represents |
| 505 | * how far into the presentation we have navigated. |
| 506 | */ |
| 507 | getProgress(): number; |
| 508 | |
| 509 | /** |
| 510 | * Retrieves the h/v location and fragment of the current, |
| 511 | * or specified, slide. |
| 512 | * |
| 513 | * @param slide - if specified, the returned index will |
| 514 | * be for this slide rather than the currently active one |
| 515 | * |
| 516 | * @return h/v location and fragment of the current, |
| 517 | * or specified, slide. {h, v, f} |
| 518 | */ |
| 519 | getIndices(slide?: HTMLElement): { h: number; v: number; f: number }; |
| 520 | |
| 521 | /** |
| 522 | * Returns an array of objects where each object represents the |
| 523 | * attributes on its respective slide. |
| 524 | * |
| 525 | * @returns an array of objects where each object represents the |
| 526 | * attributes on its respective slide. |
| 527 | */ |
| 528 | getSlidesAttributes(): Record<string, string>[]; |
| 529 | |
| 530 | /** |
| 531 | * Returns the number of past slides. This can be used as a global |
| 532 | * flattened index for slides. |
| 533 | * |
| 534 | * @param [slide] - The slide we're counting before, defaults to current slide |
| 535 | * |
| 536 | * @returns Past slide count |
| 537 | */ |
| 538 | getSlidePastCount(slide?: HTMLElement): number; |
| 539 | |
| 540 | /** |
| 541 | * Retrieves the total number of slides in this presentation. |
| 542 | * |
| 543 | * @returns the total number of slides in this presentation. |
| 544 | */ |
| 545 | getTotalSlides(): number; |
| 546 | |
| 547 | /** |
| 548 | * Returns the slide element matching the specified index. |
| 549 | * |
| 550 | * @param x - slide index |
| 551 | * @param [y] - slide index |
| 552 | * |
| 553 | * @returns the slide element matching the specified index |
| 554 | */ |
| 555 | getSlide(x: number, y?: number): HTMLElement | undefined; |
| 556 | |
| 557 | /** |
| 558 | * Returns the previous slide element, may be null |
| 559 | * |
| 560 | * @returns the previous slide element, may be null |
| 561 | */ |
| 562 | getPreviousSlide(): HTMLElement | null; |
| 563 | |
| 564 | /** |
| 565 | * Returns the current slide element |
| 566 | * |
| 567 | * @returns the current slide element |
| 568 | */ |
| 569 | getCurrentSlide(): HTMLElement; |
| 570 | |
| 571 | /** |
| 572 | * Returns the background element for the given slide. |
| 573 | * All slides, even the ones with no background properties |
| 574 | * defined, have a background element so as long as the |
| 575 | * index is valid an element will be returned. |
| 576 | * |
| 577 | * @param element A slide |
| 578 | * @returns the background element for the given slide |
| 579 | */ |
| 580 | getSlideBackground(element: HTMLElement): HTMLElement | undefined; |
| 581 | |
| 582 | /** |
| 583 | * Returns the background element for the given slide. |
| 584 | * All slides, even the ones with no background properties |
| 585 | * defined, have a background element so as long as the |
| 586 | * index is valid an element will be returned. |
| 587 | * |
| 588 | * @param x - Horizontal background index OR a slide |
| 589 | * HTML element |
| 590 | * @param [y] - Vertical background index |
| 591 | * @returns the background element for the given slide |
| 592 | */ |
| 593 | getSlideBackground(x: number, y?: number): HTMLElement | undefined; |
| 594 | |
| 595 | /** |
| 596 | * Retrieves the speaker notes from a slide. Notes can be |
| 597 | * defined in two ways: |
| 598 | * 1. As a data-notes attribute on the slide <section> |
| 599 | * 2. As an <aside class="notes"> inside of the slide |
| 600 | * |
| 601 | * @param [slide] - defaults to current slide |
| 602 | * @returns the speaker notes from a slide |
| 603 | */ |
| 604 | getSlideNotes(slide?: HTMLElement): string | null; |
| 605 | |
| 606 | /** |
| 607 | * Retrieves all slides in this presentation. |
| 608 | * |
| 609 | * @returns all slides in this presentation |
| 610 | */ |
| 611 | getSlides(): HTMLElement[]; |
| 612 | |
| 613 | /** |
| 614 | * Returns a list of all horizontal slides in the deck. Each |
| 615 | * vertical stack is included as one horizontal slide in the |
| 616 | * resulting array. |
| 617 | * |
| 618 | * @returns a list of all horizontal slides in the deck |
| 619 | */ |
| 620 | getHorizontalSlides(): HTMLElement[]; |
| 621 | |
| 622 | /** |
| 623 | * Returns all vertical slides that exist within this deck. |
| 624 | * |
| 625 | * @returns all vertical slides that exist within this deck |
| 626 | */ |
| 627 | getVerticalSlides(): HTMLElement[]; |
| 628 | |
| 629 | /** |
| 630 | * Returns true if there are at least two horizontal slides. |
| 631 | * |
| 632 | * @returns true if there are at least two horizontal slides |
| 633 | */ |
| 634 | hasHorizontalSlides(): boolean; |
| 635 | |
| 636 | /** |
| 637 | * Returns true if there are at least two vertical slides. |
| 638 | * |
| 639 | * @returns true if there are at least two vertical slides |
| 640 | */ |
| 641 | hasVerticalSlides(): boolean; |
| 642 | |
| 643 | /** |
| 644 | * Checks if the deck has navigated on either axis at least once |
| 645 | * |
| 646 | * @returns true if the deck has navigated on either horizontal axis |
| 647 | * at least once |
| 648 | */ |
| 649 | hasNavigatedHorizontally(): boolean; |
| 650 | |
| 651 | /** |
| 652 | * Checks if the deck has navigated on either axis at least once |
| 653 | * |
| 654 | * @returns true if the deck has navigated on either vertically axis |
| 655 | * at least once |
| 656 | */ |
| 657 | hasNavigatedVertically(): boolean; |
| 658 | |
| 659 | /** |
| 660 | * Add a custom key binding with optional description to |
| 661 | * be added to the help screen. |
| 662 | * |
| 663 | * @param binding |
| 664 | * @param callback |
| 665 | */ |
| 666 | addKeyBinding( |
| 667 | keyCode: number | { keyCode: number; key: string; description: string }, |
| 668 | callback: string | ((event: KeyboardEvent) => void) |
| 669 | ): void; |
| 670 | |
| 671 | /** |
| 672 | * Removes the specified custom key binding. |
| 673 | * |
| 674 | * @param keyCode |
| 675 | */ |
| 676 | removeKeyBinding(keyCode: number): void; |
| 677 | |
| 678 | /** |
| 679 | * Programmatically triggers a keyboard event |
| 680 | * |
| 681 | * @param keyCode |
| 682 | */ |
| 683 | triggerKey(keyCode: number): void; |
| 684 | |
| 685 | /** |
| 686 | * Registers a new shortcut to include in the help overlay |
| 687 | * |
| 688 | * @param key |
| 689 | * @param value |
| 690 | */ |
| 691 | registerKeyboardShortcut(key: string, value: string): void; |
| 692 | |
| 693 | /** |
| 694 | * Calculates the computed pixel size of our slides. These |
| 695 | * values are based on the width and height configuration |
| 696 | * options. |
| 697 | * |
| 698 | * @param [presentationWidth=dom.wrapper.offsetWidth] |
| 699 | * @param [presentationHeight=dom.wrapper.offsetHeight] |
| 700 | * @returns the computed pixel size of the slides |
| 701 | */ |
| 702 | getComputedSlideSize( |
| 703 | presentationWidth?: number, |
| 704 | presentationHeight?: number |
| 705 | ): ComputedSlideSize; |
| 706 | |
| 707 | /** |
| 708 | * Returns the current scale of the presentation content |
| 709 | * |
| 710 | * @returns the current scale of the presentation content |
| 711 | */ |
| 712 | getScale(): number; |
| 713 | |
| 714 | /** |
| 715 | * Returns the current configuration object |
| 716 | * |
| 717 | * @returns the current configuration object |
| 718 | */ |
| 719 | getConfig(): RevealConfig; |
| 720 | |
| 721 | /** |
| 722 | * Returns a key:value hash of all query params. |
| 723 | * |
| 724 | * @returns a key:value hash of all query params |
| 725 | */ |
| 726 | getQueryHash(): Record<string, string>; |
| 727 | |
| 728 | /** |
| 729 | * Return a hash URL that will resolve to the given slide location. |
| 730 | * |
| 731 | * @param slide - the slide to link to |
| 732 | * @returns a hash URL that will resolve to the given slide location |
| 733 | */ |
| 734 | getSlidePath(slide?: HTMLElement): string; |
| 735 | |
| 736 | /** |
| 737 | * @returns reveal.js DOM element |
| 738 | */ |
| 739 | getRevealElement(): HTMLElement | null; |
| 740 | |
| 741 | /** |
| 742 | * @returns reveal.js DOM element |
| 743 | */ |
| 744 | getSlidesElement(): HTMLElement | null; |
| 745 | |
| 746 | /** |
| 747 | * @returns reveal.js DOM element |
| 748 | */ |
| 749 | getViewportElement(): HTMLElement | null; |
| 750 | |
| 751 | /** |
| 752 | * @returns reveal.js DOM element |
| 753 | */ |
| 754 | getBackgroundsElement(): HTMLDivElement | undefined; |
| 755 | |
| 756 | /** |
| 757 | * Registers a new plugin with this reveal.js instance. |
| 758 | * |
| 759 | * reveal.js waits for all registered plugins to initialize |
| 760 | * before considering itself ready, as long as the plugin |
| 761 | * is registered before calling `Reveal.initialize()`. |
| 762 | * |
| 763 | * @param plugin |
| 764 | */ |
| 765 | registerPlugin(plugin: RevealPlugin): void; |
| 766 | |
| 767 | /** |
| 768 | * Checks if a specific plugin has been registered. |
| 769 | * |
| 770 | * @param id - unique plugin identifier |
| 771 | * @returns true if a specific plugin has been registered. |
| 772 | */ |
| 773 | hasPlugin(id: string): boolean; |
| 774 | |
| 775 | /** |
| 776 | * Returns the specific plugin instance, if a plugin |
| 777 | * with the given ID has been registered. |
| 778 | * |
| 779 | * @param id - unique plugin identifier |
| 780 | * @returns plugin instance |
| 781 | */ |
| 782 | getPlugin(id: string): RevealPlugin | undefined; |
| 783 | |
| 784 | /** |
| 785 | * @returns id:plugin hash of all plugins |
| 786 | */ |
| 787 | getPlugins(): Record<string, RevealPlugin>; |
| 788 | } |
| 789 | |
| 790 | /** |
| 791 | * Options for navigation |
| 792 | */ |
| 793 | export interface NavigateParams { |
| 794 | skipFragments?: boolean; |
| 795 | } |
| 796 | |
| 797 | export type NavigationFunction = (params?: NavigateParams) => void; |
| 798 | |
| 799 | /** |
| 800 | * Multiplex configuration |
| 801 | * |
| 802 | * @see {@link https://github.com/reveal/multiplex} |
| 803 | */ |
| 804 | export interface MultiplexConfig { |
| 805 | // Obtained from the socket.io server. Gives this (the master) control of the presentation |
| 806 | secret: string | null; |
| 807 | // Obtained from the socket.io server |
| 808 | id: string; |
| 809 | // Location of socket.io server |
| 810 | url: string; |
| 811 | } |
| 812 | |
| 813 | /** |
| 814 | * Reveal Dependency |
| 815 | * |
| 816 | * @see {@link https://revealjs.com/plugins/#dependencies} |
| 817 | */ |
| 818 | export interface RevealDependency { |
| 819 | src: string; |
| 820 | async?: boolean; |
| 821 | callback?: () => void; |
| 822 | condition?: () => boolean; |
| 823 | } |
| 824 | |
| 825 | export interface ComputedSlideSize { |
| 826 | width: number; |
| 827 | height: number; |
| 828 | presentationWidth: number; |
| 829 | presentationHeight: number; |
| 830 | } |
| 831 | |
| 832 | export interface RevealState { |
| 833 | indexh: number; |
| 834 | indexv: number; |
| 835 | indexf: number; |
| 836 | paused: boolean; |
| 837 | overview: boolean; |
| 838 | |
| 839 | /** |
| 840 | * URL of an iframe being previewed |
| 841 | */ |
| 842 | previewIframe?: string; |
| 843 | |
| 844 | /** |
| 845 | * URL of an image being previewed |
| 846 | */ |
| 847 | previewImage?: string; |
| 848 | |
| 849 | /** |
| 850 | * URL of a video being previewed |
| 851 | */ |
| 852 | previewVideo?: string; |
| 853 | |
| 854 | /** |
| 855 | * Fit mode of the previewed media |
| 856 | */ |
| 857 | previewFit?: 'none' | 'scale-down' | 'contain' | 'cover'; |
| 858 | } |
| 859 | |
| 860 | export interface SlideSyncEvent extends Event { |
| 861 | slide: HTMLElement; |
| 862 | } |
| 863 | |
| 864 | // NOTE: it is possible to extend type definitions depend on the plugin |
| 865 | /** |
| 866 | * Reveal Plugin |
| 867 | * |
| 868 | * @see {@link https://revealjs.com/creating-plugins/} |
| 869 | */ |
| 870 | export interface RevealPlugin { |
| 871 | id: string; |
| 872 | init?(reveal: RevealApi): void | Promise<void>; |
| 873 | destroy?(): void; |
| 874 | } |
| 875 | |
| 876 | export type RevealPluginFactory = () => RevealPlugin; |
| 877 |