config.ts 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745
  1. interface Config {
  2. /**
  3. * The "normal" size of the presentation, aspect ratio will be preserved
  4. * when the presentation is scaled to fit different resolutions
  5. *
  6. * @defaultValue 960
  7. */
  8. width?: number | string;
  9. /**
  10. * The "normal" size of the presentation, aspect ratio will be preserved
  11. * when the presentation is scaled to fit different resolutions
  12. *
  13. * @defaultValue 700
  14. */
  15. height?: number | string;
  16. /**
  17. * Factor of the display size that should remain empty around the content
  18. *
  19. * @defaultValue 0.04
  20. */
  21. margin?: number;
  22. /**
  23. * Bounds for smallest/largest possible scale to apply to content
  24. *
  25. * @defaultValue 0.2
  26. */
  27. minScale?: number;
  28. /**
  29. *
  30. * @defaultValue 2.0
  31. */
  32. maxScale?: number;
  33. /**
  34. * Display presentation control arrows
  35. * - true: Display controls in all views
  36. * - false: Hide controls in all views
  37. * - 'speaker-only': Display controls only in the speaker view
  38. *
  39. * @defaultValue true
  40. */
  41. controls?: boolean | 'speaker-only';
  42. /**
  43. * Help the user learn the controls by providing hints, for example by
  44. * bouncing the down arrow when they first encounter a vertical slide
  45. *
  46. * @defaultValue true
  47. */
  48. controlsTutorial?: boolean;
  49. /**
  50. * Determines where controls appear, "edges" or "bottom-right"
  51. *
  52. * @defaultValue 'bottom-right'
  53. */
  54. controlsLayout?: 'edges' | 'bottom-right';
  55. /**
  56. * Visibility rule for backwards navigation arrows; "faded", "hidden"
  57. * or "visible"
  58. *
  59. * @defaultValue 'faded'
  60. */
  61. controlsBackArrows?: 'faded' | 'hidden' | 'visible';
  62. /**
  63. * Display a presentation progress bar
  64. *
  65. * @defaultValue true
  66. */
  67. progress?: boolean;
  68. /**
  69. * Display the page number of the current slide
  70. * - true: Show slide number
  71. * - false: Hide slide number
  72. *
  73. * Can optionally be set as a string that specifies the number formatting:
  74. * - "h.v": Horizontal . vertical slide number (default)
  75. * - "h/v": Horizontal / vertical slide number
  76. * - "c": Flattened slide number
  77. * - "c/t": Flattened slide number / total slides
  78. *
  79. * Alternatively, you can provide a function that returns the slide
  80. * number for the current slide. The function should take in a slide
  81. * object and return an array with one string [slideNumber] or
  82. * three strings [n1,delimiter,n2]. See #formatSlideNumber().
  83. *
  84. * @defaultValue false
  85. */
  86. slideNumber?:
  87. | boolean
  88. | 'h.v'
  89. | 'h/v'
  90. | 'c'
  91. | 'c/t'
  92. | ((slide: any) => string | [string, string, string]);
  93. /**
  94. * Can be used to limit the contexts in which the slide number appears
  95. * - "all": Always show the slide number
  96. * - "print": Only when printing to PDF
  97. * - "speaker": Only in the speaker view
  98. *
  99. * @defaultValue 'all'
  100. */
  101. showSlideNumber?: 'all' | 'print' | 'speaker';
  102. /**
  103. * Use 1 based indexing for # links to match slide number (default is zero
  104. * based)
  105. *
  106. * @defaultValue false
  107. */
  108. hashOneBasedIndex?: boolean;
  109. /**
  110. * Add the current slide number to the URL hash so that reloading the
  111. * page/copying the URL will return you to the same slide
  112. *
  113. * @defaultValue false
  114. */
  115. hash?: boolean;
  116. /**
  117. * Flags if we should monitor the hash and change slides accordingly
  118. *
  119. * @defaultValue true
  120. */
  121. respondToHashChanges?: boolean;
  122. /**
  123. * Enable support for jump-to-slide navigation shortcuts
  124. *
  125. * @defaultValue true
  126. */
  127. jumpToSlide?: boolean;
  128. /**
  129. * Push each slide change to the browser history. Implies `hash: true`
  130. *
  131. * @defaultValue false
  132. */
  133. history?: boolean;
  134. /**
  135. * Enable keyboard shortcuts for navigation
  136. *
  137. * @defaultValue true
  138. */
  139. keyboard?: boolean;
  140. /**
  141. * Optional function that blocks keyboard events when returning false
  142. *
  143. * If you set this to 'focused', we will only capture keyboard events
  144. * for embedded decks when they are in focus
  145. *
  146. * @defaultValue null
  147. */
  148. keyboardCondition?: null | 'focused' | ((event: KeyboardEvent) => boolean);
  149. /**
  150. * Disables the default reveal.js slide layout (scaling and centering)
  151. * so that you can use custom CSS layout
  152. *
  153. * @defaultValue false
  154. */
  155. disableLayout?: boolean;
  156. /**
  157. * Enable the slide overview mode
  158. *
  159. * @defaultValue true
  160. */
  161. overview?: boolean;
  162. /**
  163. * Vertical centering of slides
  164. *
  165. * @defaultValue true
  166. */
  167. center?: boolean;
  168. /**
  169. * Enables touch navigation on devices with touch input
  170. *
  171. * @defaultValue true
  172. */
  173. touch?: boolean;
  174. /**
  175. * Loop the presentation
  176. *
  177. * @defaultValue false
  178. */
  179. loop?: boolean;
  180. /**
  181. * Change the presentation direction to be RTL
  182. *
  183. * @defaultValue false
  184. */
  185. rtl?: boolean;
  186. /**
  187. * Changes the behavior of our navigation directions.
  188. *
  189. * "default"
  190. * Left/right arrow keys step between horizontal slides, up/down
  191. * arrow keys step between vertical slides. Space key steps through
  192. * all slides (both horizontal and vertical).
  193. *
  194. * "linear"
  195. * Removes the up/down arrows. Left/right arrows step through all
  196. * slides (both horizontal and vertical).
  197. *
  198. * "grid"
  199. * When this is enabled, stepping left/right from a vertical stack
  200. * to an adjacent vertical stack will land you at the same vertical
  201. * index.
  202. *
  203. * Consider a deck with six slides ordered in two vertical stacks:
  204. * 1.1 2.1
  205. * 1.2 2.2
  206. * 1.3 2.3
  207. *
  208. * If you're on slide 1.3 and navigate right, you will normally move
  209. * from 1.3 -> 2.1. If "grid" is used, the same navigation takes you
  210. * from 1.3 -> 2.3.
  211. *
  212. * @defaultValue 'default'
  213. */
  214. navigationMode?: 'default' | 'linear' | 'grid';
  215. /**
  216. * Randomizes the order of slides each time the presentation loads
  217. *
  218. * @defaultValue false
  219. */
  220. shuffle?: boolean;
  221. /**
  222. * Turns fragments on and off globally
  223. *
  224. * @defaultValue true
  225. */
  226. fragments?: boolean;
  227. /**
  228. * Flags whether to include the current fragment in the URL,
  229. * so that reloading brings you to the same fragment position
  230. *
  231. * @defaultValue true
  232. */
  233. fragmentInURL?: boolean;
  234. /**
  235. * Flags if the presentation is running in an embedded mode,
  236. * i.e. contained within a limited portion of the screen
  237. *
  238. * @defaultValue false
  239. */
  240. embedded?: boolean;
  241. /**
  242. * Flags if we should show a help overlay when the question-mark
  243. * key is pressed
  244. *
  245. * @defaultValue true
  246. */
  247. help?: boolean;
  248. /**
  249. * Flags if it should be possible to pause the presentation (blackout)
  250. *
  251. * @defaultValue true
  252. */
  253. pause?: boolean;
  254. /**
  255. * Flags if speaker notes should be visible to all viewers
  256. *
  257. * @defaultValue false
  258. */
  259. showNotes?: boolean;
  260. /**
  261. * Flags if slides with data-visibility="hidden" should be kept visible
  262. *
  263. * @defaultValue false
  264. */
  265. showHiddenSlides?: boolean;
  266. /**
  267. * Global override for autoplaying embedded media (video/audio/iframe)
  268. * - null: Media will only autoplay if data-autoplay is present
  269. * - true: All media will autoplay, regardless of individual setting
  270. * - false: No media will autoplay, regardless of individual setting
  271. *
  272. * @defaultValue null
  273. */
  274. autoPlayMedia?: null | boolean;
  275. /**
  276. * Global override for preloading lazy-loaded iframes
  277. * - null: Iframes with data-src AND data-preload will be loaded when within
  278. * the viewDistance, iframes with only data-src will be loaded when visible
  279. * - true: All iframes with data-src will be loaded when within the viewDistance
  280. * - false: All iframes with data-src will be loaded only when visible
  281. *
  282. * @defaultValue null
  283. */
  284. preloadIframes?: null | boolean;
  285. /**
  286. * Can be used to globally disable auto-animation
  287. *
  288. * @defaultValue true
  289. */
  290. autoAnimate?: boolean;
  291. /**
  292. * Optionally provide a custom element matcher that will be
  293. * used to dictate which elements we can animate between.
  294. *
  295. * @defaultValue null
  296. */
  297. autoAnimateMatcher?: null | Function;
  298. /**
  299. * Default settings for our auto-animate transitions, can be
  300. * overridden per-slide or per-element via data arguments
  301. *
  302. * @defaultValue 'ease'
  303. */
  304. autoAnimateEasing?: 'ease' | string;
  305. /**
  306. * Number of seconds to animate each element.
  307. *
  308. * @defaultValue 1.0
  309. */
  310. autoAnimateDuration?: number;
  311. /**
  312. * Should unmatched elements be faded in?
  313. *
  314. * @defaultValue true
  315. */
  316. autoAnimateUnmatched?: boolean;
  317. /**
  318. * CSS properties that can be auto-animated. Position & scale
  319. * is matched separately so there's no need to include styles
  320. * like top/right/bottom/left, width/height or margin.
  321. *
  322. * @defaultValue ['opacity', 'color', 'background-color', 'padding', 'font-size', 'line-height', 'letter-spacing', 'border-width', 'border-color', 'border-radius', 'outline', 'outline-offset']
  323. */
  324. autoAnimateStyles?: string[];
  325. /**
  326. * Controls automatic progression to the next slide
  327. * - 0: Auto-sliding only happens if the data-autoslide HTML attribute
  328. * is present on the current slide or fragment
  329. * - 1+: All slides will progress automatically at the given interval
  330. * - false: No auto-sliding, even if data-autoslide is present
  331. *
  332. * @defaultValue 0
  333. */
  334. autoSlide?: number | false;
  335. /**
  336. * Stop auto-sliding after user input
  337. *
  338. * @defaultValue true
  339. */
  340. autoSlideStoppable?: boolean;
  341. /**
  342. * Use this method for navigation when auto-sliding (defaults to navigateNext)
  343. *
  344. * @defaultValue null
  345. */
  346. autoSlideMethod?: null | Function;
  347. /**
  348. * Specify the average time in seconds that you think you will spend
  349. * presenting each slide. This is used to show a pacing timer in the
  350. * speaker view
  351. *
  352. * @defaultValue null
  353. */
  354. defaultTiming?: null;
  355. /**
  356. * Enable slide navigation via mouse wheel
  357. *
  358. * @defaultValue false
  359. */
  360. mouseWheel?: boolean;
  361. /**
  362. * Opens links in an iframe preview overlay
  363. * Add `data-preview-link` and `data-preview-link="false"` to customize each link
  364. * individually
  365. *
  366. * @defaultValue false
  367. */
  368. previewLinks?: boolean;
  369. /**
  370. * Exposes the reveal.js API through window.postMessage
  371. *
  372. * @defaultValue true
  373. */
  374. postMessage?: boolean;
  375. /**
  376. * Dispatches all reveal.js events to the parent window through postMessage
  377. *
  378. * @defaultValue false
  379. */
  380. postMessageEvents?: boolean;
  381. /**
  382. * Focuses body when page changes visibility to ensure keyboard shortcuts work
  383. *
  384. * @defaultValue true
  385. */
  386. focusBodyOnPageVisibilityChange?: boolean;
  387. /**
  388. * Transition style
  389. *
  390. * @defaultValue 'slide'
  391. */
  392. transition?: 'none' | 'fade' | 'slide' | 'convex' | 'concave' | 'zoom';
  393. /**
  394. * Transition speed
  395. *
  396. * @defaultValue 'default'
  397. */
  398. transitionSpeed?: 'default' | 'fast' | 'slow';
  399. /**
  400. * Transition style for full page slide backgrounds
  401. *
  402. * @defaultValue 'fade'
  403. */
  404. backgroundTransition?: 'fade' | 'none' | 'slide' | 'convex' | 'concave' | 'zoom';
  405. /**
  406. * Parallax background image
  407. *
  408. * @defaultValue ''
  409. */
  410. parallaxBackgroundImage?: null | string; // CSS syntax, e.g. "a.jpg"
  411. /**
  412. * Parallax background size
  413. *
  414. * @defaultValue ''
  415. */
  416. parallaxBackgroundSize?: null | string; // CSS syntax, e.g. "3000px 2000px"
  417. /**
  418. * Parallax background repeat
  419. *
  420. * @defaultValue ''
  421. */
  422. parallaxBackgroundRepeat?: null | string; // repeat/repeat-x/repeat-y/no-repeat/initial/inherit
  423. /**
  424. * Parallax background position
  425. *
  426. * @defaultValue ''
  427. */
  428. parallaxBackgroundPosition?: null | string; // CSS syntax, e.g. "top left"
  429. /**
  430. * Amount of pixels to move the parallax background per slide step
  431. *
  432. * @defaultValue null
  433. */
  434. parallaxBackgroundHorizontal?: null | number;
  435. /**
  436. *
  437. * @defaultValue null
  438. */
  439. parallaxBackgroundVertical?: null | number;
  440. /**
  441. * Can be used to initialize reveal.js in one of the following views:
  442. * - print: Render the presentation so that it can be printed to PDF
  443. * - scroll: Show the presentation as a tall scrollable page with scroll
  444. * triggered animations
  445. *
  446. * @defaultValue null
  447. */
  448. view?: null | 'print' | 'scroll';
  449. /**
  450. * Adjusts the height of each slide in the scroll view.
  451. * - full: Each slide is as tall as the viewport
  452. * - compact: Slides are as small as possible, allowing multiple slides
  453. * to be visible in parallel on tall devices
  454. *
  455. * @defaultValue 'full'
  456. */
  457. scrollLayout?: 'full' | 'compact';
  458. /**
  459. * Control how scroll snapping works in the scroll view.
  460. * - false: No snapping, scrolling is continuous
  461. * - proximity: Snap when close to a slide
  462. * - mandatory: Always snap to the closest slide
  463. *
  464. * Only applies to presentations in scroll view.
  465. *
  466. * @defaultValue 'mandatory'
  467. */
  468. scrollSnap?: false | 'proximity' | 'mandatory';
  469. /**
  470. * Enables and configures the scroll view progress bar.
  471. * - 'auto': Show the scrollbar while scrolling, hide while idle
  472. * - true: Always show the scrollbar
  473. * - false: Never show the scrollbar
  474. *
  475. * @defaultValue 'auto'
  476. */
  477. scrollProgress?: 'auto' | boolean;
  478. /**
  479. * Automatically activate the scroll view when we the viewport falls
  480. * below the given width.
  481. *
  482. * @defaultValue 435
  483. */
  484. scrollActivationWidth?: number;
  485. /**
  486. * The maximum number of pages a single slide can expand onto when printing
  487. * to PDF, unlimited by default
  488. *
  489. * @defaultValue Number.POSITIVE_INFINITY
  490. */
  491. pdfMaxPagesPerSlide?: number;
  492. /**
  493. * Prints each fragment on a separate slide
  494. *
  495. * @defaultValue true
  496. */
  497. pdfSeparateFragments?: boolean;
  498. /**
  499. * Offset used to reduce the height of content within exported PDF pages.
  500. * This exists to account for environment differences based on how you
  501. * print to PDF. CLI printing options, like phantomjs and wkpdf, can end
  502. * on precisely the total height of the document whereas in-browser
  503. * printing has to end one pixel before.
  504. *
  505. * @defaultValue -1
  506. */
  507. pdfPageHeightOffset?: number;
  508. /**
  509. * Number of slides away from the current that are visible
  510. *
  511. * @defaultValue 3
  512. */
  513. viewDistance?: number;
  514. /**
  515. * Number of slides away from the current that are visible on mobile
  516. * devices. It is advisable to set this to a lower number than
  517. * viewDistance in order to save resources.
  518. *
  519. * @defaultValue 2
  520. */
  521. mobileViewDistance?: number;
  522. /**
  523. * The display mode that will be used to show slides
  524. *
  525. * @defaultValue 'block'
  526. */
  527. display?: string;
  528. /**
  529. * Hide cursor if inactive
  530. *
  531. * @defaultValue true
  532. */
  533. hideInactiveCursor?: boolean;
  534. /**
  535. * Time before the cursor is hidden (in ms)
  536. *
  537. * @defaultValue 5000
  538. */
  539. hideCursorTime?: number;
  540. /**
  541. * Should we automatically sort and set indices for fragments
  542. * at each sync? (See Reveal.sync)
  543. *
  544. * @defaultValue true
  545. */
  546. sortFragmentsOnSync?: boolean;
  547. /**
  548. * Script dependencies to load
  549. *
  550. * @defaultValue []
  551. */
  552. dependencies?: any[];
  553. /**
  554. * Plugin objects to register and use for this presentation
  555. *
  556. * @defaultValue []
  557. */
  558. plugins?: any[];
  559. }
  560. /**
  561. * The default reveal.js config object.
  562. */
  563. const defaultConfig: Config = {
  564. width: 960,
  565. height: 700,
  566. margin: 0.04,
  567. minScale: 0.2,
  568. maxScale: 2.0,
  569. controls: true,
  570. controlsTutorial: true,
  571. controlsLayout: 'bottom-right',
  572. controlsBackArrows: 'faded',
  573. progress: true,
  574. slideNumber: false,
  575. showSlideNumber: 'all',
  576. hashOneBasedIndex: false,
  577. hash: false,
  578. respondToHashChanges: true,
  579. jumpToSlide: true,
  580. history: false,
  581. keyboard: true,
  582. keyboardCondition: null,
  583. disableLayout: false,
  584. overview: true,
  585. center: true,
  586. touch: true,
  587. loop: false,
  588. rtl: false,
  589. navigationMode: 'default',
  590. shuffle: false,
  591. fragments: true,
  592. fragmentInURL: true,
  593. embedded: false,
  594. help: true,
  595. pause: true,
  596. showNotes: false,
  597. showHiddenSlides: false,
  598. autoPlayMedia: null,
  599. preloadIframes: null,
  600. mouseWheel: false,
  601. previewLinks: false,
  602. viewDistance: 3,
  603. mobileViewDistance: 2,
  604. display: 'block',
  605. hideInactiveCursor: true,
  606. hideCursorTime: 5000,
  607. sortFragmentsOnSync: true,
  608. autoAnimate: true,
  609. autoAnimateMatcher: null,
  610. autoAnimateEasing: 'ease',
  611. autoAnimateDuration: 1.0,
  612. autoAnimateUnmatched: true,
  613. autoAnimateStyles: [
  614. 'opacity',
  615. 'color',
  616. 'background-color',
  617. 'padding',
  618. 'font-size',
  619. 'line-height',
  620. 'letter-spacing',
  621. 'border-width',
  622. 'border-color',
  623. 'border-radius',
  624. 'outline',
  625. 'outline-offset',
  626. ],
  627. autoSlide: 0,
  628. autoSlideStoppable: true,
  629. autoSlideMethod: null,
  630. defaultTiming: null,
  631. postMessage: true,
  632. postMessageEvents: false,
  633. focusBodyOnPageVisibilityChange: true,
  634. transition: 'slide',
  635. transitionSpeed: 'default',
  636. backgroundTransition: 'fade',
  637. parallaxBackgroundImage: '',
  638. parallaxBackgroundSize: '',
  639. parallaxBackgroundRepeat: '',
  640. parallaxBackgroundPosition: '',
  641. parallaxBackgroundHorizontal: null,
  642. parallaxBackgroundVertical: null,
  643. view: null,
  644. scrollLayout: 'full',
  645. scrollSnap: 'mandatory',
  646. scrollProgress: 'auto',
  647. scrollActivationWidth: 435,
  648. pdfMaxPagesPerSlide: Number.POSITIVE_INFINITY,
  649. pdfSeparateFragments: true,
  650. pdfPageHeightOffset: -1,
  651. dependencies: [],
  652. plugins: [],
  653. };
  654. export type { Config };
  655. export { defaultConfig };