config.ts 22 KB

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