reveal.js-appearance 1.3.4 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md DELETED
@@ -1,125 +0,0 @@
1
- # Changelog
2
-
3
-
4
- ## [1.3.4] - 2023-07-31
5
- ### Changed
6
- - Fixed a typo (was srcipt but should be script)
7
- - Fixed visible appearance items in print view (#13)
8
- - Dependency fixes
9
-
10
- ### Added
11
- - Added `cssautoload` option to automatically load the CSS file. Can be switched off if you want to load the CSS file yourself with `import` when using bundlers like Webpack or Parcel.
12
- - Added `baseline` effect for use with words and letters, to make them appear from the baseline of the text.
13
-
14
-
15
-
16
-
17
- ## [1.3.3] - 2023-11-18
18
- ### Added
19
- - Added embedded example to the demo’s
20
-
21
- ### Changed
22
- - Fixed a bug where the plugin would not work if in an embedded presentation
23
-
24
-
25
- ## [1.3.1] - 2023-11-05
26
- ### Added
27
- - Added Terser to minimize files
28
-
29
- ### Changed
30
- - Fixed invisible elements in auto-animate slides
31
- - Changed demo to align normal and MarkDown slides
32
- - Changed loadStyle function
33
- - Updated gulp file and dev dependencies
34
-
35
- ## [1.3.0] - 2023-10-25
36
- ### Added
37
- - Added word and character appearances
38
-
39
- ### Changed
40
- - The plugin is totally refactored and uses a promise.
41
- - Fix for fragments as Appearance items
42
- - Another fix for hidden items in speaker view
43
-
44
-
45
- ## [1.2.1] - 2023-07-22
46
- ### Added
47
- - Fix for hidden items in print and speaker view
48
-
49
-
50
- ## [1.2.0] - 2023-05-05
51
- ### Added
52
- - Added local, specified, auto-appear
53
- - Added Markdown example
54
- - Added fix for Quarto list items
55
-
56
- ### Changed
57
- - Reordered documentation
58
- - Fragments can now be Appearance items
59
-
60
-
61
- ## [1.1.3] - 2022-06-26
62
- ### Changed
63
- - Fixed a bug if there was no previous slide
64
-
65
-
66
- ## [1.1.2] - 2022-06-26
67
- ### Added
68
- - Added auto-loading of styles.
69
-
70
- ### Changed
71
- - Changed the internal delay mechanism to use CSS animation delay in combination to adding the trigger on the parent, not each animated element. This will improve the performance.
72
- - ***Breaking change***: Moved to Animate.css version 4, but added a compatibility mode
73
-
74
- ## [1.1.1] - 2021-11-27
75
- ### Added
76
- - Added a new `autoappear` mode, for use in cases where adding animation classes is too much of a hassle, like inside Markdown.
77
- - Started keeping the changelog.
78
-
79
-
80
-
81
- ## [1.1.0] - 2021-09-03
82
- ### Added
83
- - Added Github corner badge
84
-
85
- ### Changed
86
- - Changed readme
87
-
88
-
89
-
90
- ## [1.0.9] - 2021-06-30
91
- ### Changed
92
- - Fixed a bug where '=' was '=='.
93
-
94
-
95
-
96
- ## [1.0.8] - 2021-06-27
97
- ### Added
98
- - Choose an event at which Appearance launches its animations
99
-
100
- ### Changed
101
- - Appearance now shows the complete slides from the overview
102
-
103
-
104
-
105
- ## [1.0.7] - 2020-06-28
106
- ### Changed
107
- - Clearing timeouts that are in past slides. This solves 'hanging' Appearance items if you slide back and forth.
108
-
109
-
110
-
111
- ## [1.0.6] - 2020-06-28
112
- ### Changed
113
- - Fix bug that hid Appearance items in PDF exports.
114
-
115
-
116
-
117
- ## [1.0.5] - 2020-05-20
118
- ### Added
119
- - Added compatibility with the new Reveal.js 4 that changes the way plugins work.
120
-
121
-
122
-
123
- ## [1.0.4] - 2020-05-20
124
- ### Added
125
- - The 1.0.4 release is compatible with Reveal.js 3. Reveal versions lower than 4 have no "slidetransitionend" event, so this release also has the Transit.js plugin included (see https://github.com/Martinomagnifico/reveal.js-transit for more information).
@@ -1,15 +0,0 @@
1
- /*****************************************************************
2
- *
3
- * Appearance for Reveal.js
4
- * Version 1.3.4
5
- *
6
- * @author: Martijn De Jongh (Martino), martijn.de.jongh@gmail.com
7
- * https://github.com/martinomagnifico
8
- *
9
- * @license
10
- * MIT licensed
11
- *
12
- * Copyright (C) 2023 Martijn De Jongh (Martino)
13
- *
14
- ******************************************************************/
15
- const e=e=>e&&"object"==typeof e&&!Array.isArray(e),t=(a,...s)=>{if(!s.length)return a;const n=s.shift();if(e(a)&&e(n))for(const s in n)e(n[s])?(a[s]||Object.assign(a,{[s]:{}}),t(a[s],n[s])):Object.assign(a,{[s]:n[s]});return t(a,...s)},a=e=>{let t="";return"string"==typeof e&&(e=e.replace(/[“”]/g,'"').replace(/[‘’]/g,"'")),t=(e=>{try{return JSON.parse(e)&&!!e}catch(e){return!1}})(e)?e:"object"==typeof e?JSON.stringify(e,null,2):"{"===e.trim().replace(/'/g,'"').charAt(0)?e.trim().replace(/'/g,'"'):`{${e.trim().replace(/'/g,'"')}}`,t},s=(e,t,a)=>{let s,n=document.querySelector("head"),r=!1;if("script"===t?document.querySelector(`script[src="${e}"]`)?r=!0:(s=document.createElement("script"),s.type="text/javascript",s.src=e):"stylesheet"===t&&(document.querySelector(`link[href="${e}"]`)?r=!0:(s=document.createElement("link"),s.rel="stylesheet",s.href=e)),!r){const e=()=>{"function"==typeof a&&(a.call(),a=null)};s.onload=e,s.onreadystatechange=function(){"loaded"===this.readyState&&e()},n.appendChild(s)}},n=(e,t)=>{e.debug&&console.log(t)},r=(e,t)=>{let a=(e=>{let t,a=document.querySelector(`script[src$="${e}"]`);return t=a?a.getAttribute("src").slice(0,-1*e.length):import.meta.url.slice(0,import.meta.url.lastIndexOf("/")+1),t})(t),n=t.replace(/\.[^/.]+$/,"");if(e.cssautoload){let t=e.csspath.appearance?e.csspath.appearance:`${a}${n}.css`||`plugin/${n}/${n}.css`,r=e.compatibility?e.animatecsspath.compat:e.animatecsspath.link;e.debug&&(console.log("Paths:"),console.log(` - Plugin path = ${a}`),console.log(` - Appearance CSS path = ${t}`),console.log(` - AnimateCSS CSS path = ${r}`)),s(r,"stylesheet",(function(){s(t,"stylesheet")}))}},i=(e,t)=>{let a=e.parentNode;if(a){for(const t of a.children)if(t!==e&&t.dataset.appearParent)return;a.classList=e.classList,(({attributes:e},t,a)=>{[...e].filter((({nodeName:e})=>e.includes("data"))).forEach((({nodeName:e,nodeValue:s})=>{(a&&e!==a||!a)&&t.setAttribute(e,s)}))})(e,a,"data-appear-parent"),a.innerHTML=e.innerHTML,a.classList.add(t)}},l=(e,t,a)=>Array.from(a.querySelectorAll(`.${e}`)).filter((e=>!e.closest(`.${t}`))),o=(e,t,a)=>{const s=[l(t,a,e),...Array.from(e.querySelectorAll(`.${a}`)).map((e=>((e,t,a)=>Array.from(a.querySelectorAll(`.${e}`)).filter((e=>e.closest(`.${t}`)===a)))(t,a,e)))];return!!s.some((e=>e.length>0))&&s},c=(e,t)=>{t.hideagain&&e.from&&e.from.dataset.appearanceCanStart&&e.from.removeAttribute("data-appearance-can-start")},d=(e,t,a)=>{if(t.hideagain&&e&&e.from){let t=e.from.querySelectorAll(a.animatecss);t&&t.forEach((e=>{e.classList.remove("animationended")}));let s=e.from.querySelectorAll(".fragment.visible");s&&s.forEach((e=>{e.classList.remove("visible")}))}},p=()=>{const e={names:{}};let s={};const l=(e,t,s)=>{n(e,"------------- Preloading -------------");let l=t.names;r(e,l.es5Filename),e.compatibility&&(l.animatecss=".backInDown, .backInLeft, .backInRight, .backInUp, .bounceIn, .bounceInDown, .bounceInLeft, .bounceInRight, .bounceInUp, .fadeIn, .fadeInDown, .fadeInDownBig, .fadeInLeft, .fadeInLeftBig, .fadeInRight, .fadeInRightBig, .fadeInUp, .fadeInUpBig, .fadeInTopLeft, .fadeInTopRight, .fadeInBottomLeft, .fadeInBottomRight, .flipInX, .flipInY, .lightSpeedInRight, .lightSpeedInLeft, .rotateIn, .rotateInDownLeft, .rotateInDownRight, .rotateInUpLeft, .rotateInUpRight, .jackInTheBox, .rollIn, .zoomIn, .zoomInDown, .zoomInLeft, .zoomInRight, .zoomInUp, .slideInDown, .slideInLeft, .slideInRight, .slideInUp, .skidLeft, .skidLeftBig, .skidRight, .skidRightBig, .shrinkIn, .shrinkInBlur",l.baseclass=e.compatibilitybaseclass),t.appearances=Array.from(t.slides.querySelectorAll(l.animatecss)),t.regularSections.forEach((s=>((e,t,s)=>{let n=null;if(e.hasAttribute("data-autoappear")){let a=e.dataset.autoappear;n="auto"==a||""==a||a.length<1||"true"==a?t.autoelements?t.autoelements:null:a}else t.autoappear&&t.autoelements&&(n=t.autoelements);if(n){let t=JSON.parse(a(n));Object.entries(t).forEach((([t,a])=>{let n=Array.from(e.querySelectorAll(t)).filter((e=>!s.appearances.includes(e)));n.length&&n.forEach((e=>{s.appearances.push(e);let t=[],n=null,r=!1,i=null,l=null;Array.isArray(a)?(t=a[0].split(/[ ,]+/),n=a[1]):"string"==typeof a?t=a.split(/[ ,]+/):a.constructor===Object&&((a.class||a.animation)&&(t=(a.animation?a.animation:a.class).split(/[ ,]+/)),a.speed&&(r=String(a.speed),r.includes("animate__")||(r=`animate__${r}`)),a.delay&&(n=String(a.delay)),a.split&&(i=String(a.split)),a["container-delay"]&&(l=String(a["container-delay"]))),e.classList.add(...t),r&&e.classList.add(r),n&&(e.dataset.delay||(e.dataset.delay=n)),i&&(e.dataset.split=i),l&&(e.dataset.containerDelay=l)}))}))}})(s,e,t))),t.appearances.forEach(((t,a)=>{((e,t,a)=>{let s=a.baseclass;e.hasAttribute("data-appear-parent")&&i(e,s),t.appearparents&&e.parentNode&&e.parentNode.tagName&&"SPAN"==e.tagName&&"LI"==e.parentNode.tagName&&String(e.outerHTML).length==String(e.parentNode.innerHTML).length&&i(e)})(t,e,l),((e,t)=>{e.classList.contains(t.baseclass)||e.classList.add(t.baseclass),e.classList.contains(t.fragmentClass)&&e.classList.add("custom")})(t,l),t.hasAttribute("data-split")&&((e,t)=>{let a=!1,s=" ";if("words"==t?a=e.textContent.trim().split(/\s+/):"letters"==t&&(a=e.textContent.trim().split(""),s=""),a){const t=Array.from(e.classList).filter((e=>e.startsWith("animate__"))),n=a.map(((t,a)=>{const s=document.createElement("span");return s.textContent=t," "==t&&(s.textContent=" "),e.dataset.delay&&0!==a&&(s.dataset.delay=e.dataset.delay),e.dataset.containerDelay&&0===a&&(s.dataset.delay=e.dataset.containerDelay),e.classList.add("wordchargroup"),e.classList.forEach((e=>e.startsWith("animate__")&&s.classList.add(e))),s.outerHTML})).join(s);t.forEach((t=>e.classList.remove(t))),e.removeAttribute("data-delay"),e.removeAttribute("data-split"),e.removeAttribute("data-container-delay"),e.innerHTML=n}})(t,t.dataset.split)})),t.regularSections.forEach(((t,a)=>{let s=o(t,l.baseclass,l.fragmentClass);s&&s.forEach((t=>{((e,t,a)=>{let s=0;e.forEach(((e,a)=>{if(0==a&&e.dataset.delay||0!=a){let a=t.delay;e.dataset&&e.dataset.delay&&(a=parseInt(e.dataset.delay)),s+=a,e.style.setProperty("animation-delay",s+"ms"),e.removeAttribute("data-delay")}}))})(t,e)}))})),(e=>{setTimeout(e,0)})(s)},p=(t,a,s)=>{let r=e.names;return r.baseclass=a.baseclass,r.compatibilitybaseclass=a.compatibilitybaseclass,r.fragmentSelector=".fragment",r.fragmentClass="fragment",r.speedClasses=["slower","slow","fast","faster"],r.speedClasses.push(...r.speedClasses.map((e=>`animate__${e}`))),r.animatecss='[class^="animate__"],[class*=" animate__"]',r.es5Filename=s,r.eventnames=["ready","slidechanged","slidetransitionend","autoanimate","overviewhidden"],e.deck=t,e.dom=t.getRevealElement(),e.viewport=t.getViewportElement(),e.slides=t.getSlidesElement(),e.sections=e.slides.querySelectorAll("section"),e.fragments=e.slides.querySelectorAll(r.fragmentSelector),e.regularSections=Array.from(e.sections).filter((e=>!(({childNodes:e})=>{let t=!1;for(let a=0;a<e.length;a++)if("SECTION"==e[a].tagName){t=!0;break}return t})(e))),/receiver/i.test(window.location.search)&&e.viewport.classList.add("sv"),r.eventnames.forEach((s=>t.on(s,(t=>{((e,t,a,s)=>{s.deck.getConfig().view;let n=s.viewport.classList.contains("reveal-scroll"),r=e.type,i=(e=>{let t={};return t.from=e.fromSlide||e.previousSlide||null,t.to=e.toSlide||e.currentSlide||null,t})(e);if(i.to){"ready"==r&&(i.to.dataset.appearanceCanStart=!0);let s=((e,t)=>(e.dataset.appearevent&&"auto"===e.dataset.appearevent&&(e.dataset.appearevent="autoanimate"),"auto"==t.appearevent&&(t.appearevent="autoanimate"),e.dataset.appearevent?e.dataset.appearevent:t.appearevent))(i.to,t);(r==s||"slidetransitionend"==r&&"autoanimate"==s)&&(i.to.dataset.appearanceCanStart=!0),n&&"slidechanged"==r&&(c(i,t),d(i,t,a),setTimeout((()=>{i.to.dataset.appearanceCanStart=!0}),t.delay)),"slidetransitionend"==r&&(c(i,t),d(i,t,a)),"slidechanged"==r&&document.body.dataset.exitoverview?(c(i,t),i.to.dataset.appearanceCanStart=!0):"overviewhidden"==r&&(document.body.dataset.exitoverview=!0,setTimeout((()=>{document.body.removeAttribute("data-exitoverview")}),500),e.currentSlide&&(c(i,t),i.to.dataset.appearanceCanStart=!0))}})(t,a,r,e)})))),e.viewport.addEventListener("animationend",(e=>{e.target.classList.add("animationended")})),e.viewport.addEventListener("fragmenthidden",(e=>{e.fragment.classList.remove("animationended"),e.fragment.querySelectorAll(".animationended").forEach((e=>{e.classList.remove("animationended")}))})),new Promise((t=>{l(a,e,t),n(a,"---------- Done preloading ----------")}))};return{id:"appearance",init:e=>(s=t({baseclass:"animate__animated",hideagain:!0,delay:300,debug:!1,appearevent:"slidetransitionend",autoappear:!1,autoelements:!1,appearparents:!1,cssautoload:!0,csspath:"",animatecsspath:{link:"https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css",compat:"https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.compat.css"},compatibility:!1,compatibilitybaseclass:"animated"},e.getConfig().appearance||{}),p(e,s,"appearance.js"))}};export{p as default};