From 942304d8628bcb226a93ac4d931c3db6e2df07bc Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Mon, 1 Jun 2020 16:00:54 +0200 Subject: [PATCH 01/26] add --slide-width/height css variables --- js/reveal.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/js/reveal.js b/js/reveal.js index 4693c003de6..36ea3dca46b 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -421,6 +421,10 @@ export default function( revealElement, options ) { dom.wrapper.setAttribute( 'data-transition-speed', config.transitionSpeed ); dom.wrapper.setAttribute( 'data-background-transition', config.backgroundTransition ); + // Expose our configured slide dimensions as custom props + dom.viewport.style.setProperty( '--size-width', config.width + 'px' ); + dom.viewport.style.setProperty( '--size-height', config.height + 'px' ); + if( config.shuffle ) { shuffle(); } From cd5c9c5b9d6480403fb6023b54bd5b18a6009da2 Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Mon, 1 Jun 2020 16:02:55 +0200 Subject: [PATCH 02/26] build js --- dist/reveal.esm.js | 2 +- dist/reveal.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/reveal.esm.js b/dist/reveal.esm.js index 810a6c8e21d..ecc8a5661ec 100644 --- a/dist/reveal.esm.js +++ b/dist/reveal.esm.js @@ -5,5 +5,5 @@ * * Copyright (C) 2020 Hakim El Hattab, https://hakim.se */ -var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e,t,i){return e(i={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&i.path)}},i.exports),i.exports}var i,n=function(e){return e&&e.Math==Math&&e},a=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof e&&e)||Function("return this")(),s={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},r=function(e){try{return!!e()}catch(e){return!0}},o={}.toString,l=function(e){return o.call(e).slice(8,-1)},d="".split,c=r((function(){return!Object("z").propertyIsEnumerable(0)}))?function(e){return"String"==l(e)?d.call(e,""):Object(e)}:Object,u=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e},h=function(e){return c(u(e))},g=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),v=function(e){return"object"==typeof e?null!==e:"function"==typeof e},p=a.document,f=v(p)&&v(p.createElement),m=function(e){return f?p.createElement(e):{}},b=!g&&!r((function(){return 7!=Object.defineProperty(m("div"),"a",{get:function(){return 7}}).a})),y=function(e){if(!v(e))throw TypeError(String(e)+" is not an object");return e},w=function(e,t){if(!v(e))return e;var i,n;if(t&&"function"==typeof(i=e.toString)&&!v(n=i.call(e)))return n;if("function"==typeof(i=e.valueOf)&&!v(n=i.call(e)))return n;if(!t&&"function"==typeof(i=e.toString)&&!v(n=i.call(e)))return n;throw TypeError("Can't convert object to primitive value")},R=Object.defineProperty,E={f:g?R:function(e,t,i){if(y(e),t=w(t,!0),y(i),b)try{return R(e,t,i)}catch(e){}if("get"in i||"set"in i)throw TypeError("Accessors not supported");return"value"in i&&(e[t]=i.value),e}},S=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},A=g?function(e,t,i){return E.f(e,t,S(1,i))}:function(e,t,i){return e[t]=i,e},k=function(e,t){try{A(a,e,t)}catch(i){a[e]=t}return t},L=a["__core-js_shared__"]||k("__core-js_shared__",{}),x=t((function(e){(e.exports=function(e,t){return L[e]||(L[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.6.5",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})})),C={}.hasOwnProperty,P=function(e,t){return C.call(e,t)},N=0,M=Math.random(),I=function(e){return"Symbol("+String(void 0===e?"":e)+")_"+(++N+M).toString(36)},T=!!Object.getOwnPropertySymbols&&!r((function(){return!String(Symbol())})),D=T&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,O=x("wks"),H=a.Symbol,B=D?H:H&&H.withoutSetter||I,U=function(e){return P(O,e)||(T&&P(H,e)?O[e]=H[e]:O[e]=B("Symbol."+e)),O[e]},j=Math.ceil,z=Math.floor,q=function(e){return isNaN(e=+e)?0:(e>0?z:j)(e)},F=Math.min,_=function(e){return e>0?F(q(e),9007199254740991):0},W=Math.max,V=Math.min,K=function(e){return function(t,i,n){var a,s=h(t),r=_(s.length),o=function(e,t){var i=q(e);return i<0?W(i+t,0):V(i,t)}(n,r);if(e&&i!=i){for(;r>o;)if((a=s[o++])!=a)return!0}else for(;r>o;o++)if((e||o in s)&&s[o]===i)return e||o||0;return!e&&-1}},X={includes:K(!0),indexOf:K(!1)},$={},Y=X.indexOf,G=function(e,t){var i,n=h(e),a=0,s=[];for(i in n)!P($,i)&&P(n,i)&&s.push(i);for(;t.length>a;)P(n,i=t[a++])&&(~Y(s,i)||s.push(i));return s},J=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Q=Object.keys||function(e){return G(e,J)},Z=g?Object.defineProperties:function(e,t){y(e);for(var i,n=Q(t),a=n.length,s=0;a>s;)E.f(e,i=n[s++],t[i]);return e},ee=a,te=function(e){return"function"==typeof e?e:void 0},ie=function(e,t){return arguments.length<2?te(ee[e])||te(a[e]):ee[e]&&ee[e][t]||a[e]&&a[e][t]},ne=ie("document","documentElement"),ae=x("keys"),se=function(e){return ae[e]||(ae[e]=I(e))},re=se("IE_PROTO"),oe=function(){},le=function(e){return"
diff --git a/plugin/highlight/highlight.esm.js b/plugin/highlight/highlight.esm.js index 0cfe05296ec..9f9397f4b65 100644 --- a/plugin/highlight/highlight.esm.js +++ b/plugin/highlight/highlight.esm.js @@ -2,4 +2,4 @@ var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?windo /*! * reveal.js plugin that adds syntax highlight support. */ -var bl={id:"highlight",HIGHLIGHT_STEP_DELIMITER:"|",HIGHLIGHT_LINE_DELIMITER:",",HIGHLIGHT_LINE_RANGE_DELIMITER:"-",hljs:Tl,init:function(e){var t=e.getConfig().highlight||{};t.highlightOnLoad="boolean"!=typeof t.highlightOnLoad||t.highlightOnLoad,t.escapeHTML="boolean"!=typeof t.escapeHTML||t.escapeHTML,[].slice.call(e.getRevealElement().querySelectorAll("pre code")).forEach((function(e){e.hasAttribute("data-trim")&&"function"==typeof e.innerHTML.trim&&(e.innerHTML=function(e){function t(e){return e.replace(/^[\s\uFEFF\xA0]+/g,"")}return function(e){var a=function(e){for(var t=e.split("\n"),a=0;a=0&&""===t[a].trim();a--)t.splice(a,1);return t.join("\n")}(e.innerHTML).split("\n"),n=a.reduce((function(e,a){return a.length>0&&t(a).length>0&&e>a.length-t(a).length?a.length-t(a).length:e}),Number.POSITIVE_INFINITY);return a.map((function(e,t){return e.slice(n)})).join("\n")}(e)}(e)),t.escapeHTML&&!e.hasAttribute("data-noescape")&&(e.innerHTML=e.innerHTML.replace(//g,">")),e.addEventListener("focusout",(function(e){Tl.highlightBlock(e.currentTarget)}),!1),t.highlightOnLoad&&bl.highlightBlock(e)})),e.on("pdf-ready",(function(){[].slice.call(e.getRevealElement().querySelectorAll("pre code[data-line-numbers].current-fragment")).forEach((function(e){bl.scrollHighlightedLineIntoView(e,{},!0)}))}))},highlightBlock:function(e){if(Tl.highlightBlock(e),0!==e.innerHTML.trim().length&&e.hasAttribute("data-line-numbers")){Tl.lineNumbersBlock(e,{singleLine:!0});var t={currentBlock:e},a=bl.deserializeHighlightSteps(e.getAttribute("data-line-numbers"));if(a.length>1){var n=parseInt(e.getAttribute("data-fragment-index"),10);("number"!=typeof n||isNaN(n))&&(n=null),a.slice(1).forEach((function(a){var r=e.cloneNode(!0);r.setAttribute("data-line-numbers",bl.serializeHighlightSteps([a])),r.classList.add("fragment"),e.parentNode.appendChild(r),bl.highlightLines(r),"number"==typeof n?(r.setAttribute("data-fragment-index",n),n+=1):r.removeAttribute("data-fragment-index"),r.addEventListener("visible",bl.scrollHighlightedLineIntoView.bind(bl,r,t)),r.addEventListener("hidden",bl.scrollHighlightedLineIntoView.bind(bl,r.previousSibling,t))})),e.removeAttribute("data-fragment-index"),e.setAttribute("data-line-numbers",bl.serializeHighlightSteps([a[0]]))}var r="function"==typeof e.closest?e.closest("section:not(.stack)"):null;if(r){r.addEventListener("visible",(function a(){bl.scrollHighlightedLineIntoView(e,t,!0),r.removeEventListener("visible",a)}))}bl.highlightLines(e)}},scrollHighlightedLineIntoView:function(e,t,a){cancelAnimationFrame(t.animationFrameID),t.currentBlock&&(e.scrollTop=t.currentBlock.scrollTop),t.currentBlock=e;var n=this.getHighlightedLineBounds(e),r=e.offsetHeight,i=getComputedStyle(e);r-=parseInt(i.paddingTop)+parseInt(i.paddingBottom);var o=e.scrollTop,s=n.top+(Math.min(n.bottom-n.top,r)-r)/2,l=e.querySelector(".hljs-ln");if(l&&(s+=l.offsetTop-parseInt(i.paddingTop)),s=Math.max(Math.min(s,e.scrollHeight-r),0),!0===a||o===s)e.scrollTop=s;else{if(e.scrollHeight<=r)return;var _=0;!function a(){_=Math.min(_+.02,1),e.scrollTop=o+(s-o)*bl.easeInOutQuart(_),_<1&&(t.animationFrameID=requestAnimationFrame(a))}()}},easeInOutQuart:function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},getHighlightedLineBounds:function(e){var t=e.querySelectorAll(".highlight-line");if(0===t.length)return{top:0,bottom:0};var a=t[0],n=t[t.length-1];return{top:a.offsetTop,bottom:n.offsetTop+n.offsetHeight}},highlightLines:function(e,t){var a=bl.deserializeHighlightSteps(t||e.getAttribute("data-line-numbers"));a.length&&a[0].forEach((function(t){var a=[];"number"==typeof t.end?a=[].slice.call(e.querySelectorAll("table tr:nth-child(n+"+t.start+"):nth-child(-n+"+t.end+")")):"number"==typeof t.start&&(a=[].slice.call(e.querySelectorAll("table tr:nth-child("+t.start+")"))),a.length&&(a.forEach((function(e){e.classList.add("highlight-line")})),e.classList.add("has-highlights"))}))},deserializeHighlightSteps:function(e){return(e=(e=e.replace(/\s/g,"")).split(bl.HIGHLIGHT_STEP_DELIMITER)).map((function(e){return e.split(bl.HIGHLIGHT_LINE_DELIMITER).map((function(e){if(/^[\d-]+$/.test(e)){e=e.split(bl.HIGHLIGHT_LINE_RANGE_DELIMITER);var t=parseInt(e[0],10),a=parseInt(e[1],10);return isNaN(a)?{start:t}:{start:t,end:a}}return{}}))}))},serializeHighlightSteps:function(e){return e.map((function(e){return e.map((function(e){return"number"==typeof e.end?e.start+bl.HIGHLIGHT_LINE_RANGE_DELIMITER+e.end:"number"==typeof e.start?e.start:""})).join(bl.HIGHLIGHT_LINE_DELIMITER)})).join(bl.HIGHLIGHT_STEP_DELIMITER)}};export default function(){return bl} +var bl={id:"highlight",HIGHLIGHT_STEP_DELIMITER:"|",HIGHLIGHT_LINE_DELIMITER:",",HIGHLIGHT_LINE_RANGE_DELIMITER:"-",hljs:Tl,init:function(e){var t=e.getConfig().highlight||{};t.highlightOnLoad="boolean"!=typeof t.highlightOnLoad||t.highlightOnLoad,t.escapeHTML="boolean"!=typeof t.escapeHTML||t.escapeHTML,[].slice.call(e.getRevealElement().querySelectorAll("pre code")).forEach((function(e){var a=e.querySelector('script[type="text/template"]');a&&(e.textContent=a.innerHTML),e.hasAttribute("data-trim")&&"function"==typeof e.innerHTML.trim&&(e.innerHTML=function(e){function t(e){return e.replace(/^[\s\uFEFF\xA0]+/g,"")}return function(e){var a=function(e){for(var t=e.split("\n"),a=0;a=0&&""===t[a].trim();a--)t.splice(a,1);return t.join("\n")}(e.innerHTML).split("\n"),n=a.reduce((function(e,a){return a.length>0&&t(a).length>0&&e>a.length-t(a).length?a.length-t(a).length:e}),Number.POSITIVE_INFINITY);return a.map((function(e,t){return e.slice(n)})).join("\n")}(e)}(e)),t.escapeHTML&&!e.hasAttribute("data-noescape")&&(e.innerHTML=e.innerHTML.replace(//g,">")),e.addEventListener("focusout",(function(e){Tl.highlightBlock(e.currentTarget)}),!1),t.highlightOnLoad&&bl.highlightBlock(e)})),e.on("pdf-ready",(function(){[].slice.call(e.getRevealElement().querySelectorAll("pre code[data-line-numbers].current-fragment")).forEach((function(e){bl.scrollHighlightedLineIntoView(e,{},!0)}))}))},highlightBlock:function(e){if(Tl.highlightBlock(e),0!==e.innerHTML.trim().length&&e.hasAttribute("data-line-numbers")){Tl.lineNumbersBlock(e,{singleLine:!0});var t={currentBlock:e},a=bl.deserializeHighlightSteps(e.getAttribute("data-line-numbers"));if(a.length>1){var n=parseInt(e.getAttribute("data-fragment-index"),10);("number"!=typeof n||isNaN(n))&&(n=null),a.slice(1).forEach((function(a){var r=e.cloneNode(!0);r.setAttribute("data-line-numbers",bl.serializeHighlightSteps([a])),r.classList.add("fragment"),e.parentNode.appendChild(r),bl.highlightLines(r),"number"==typeof n?(r.setAttribute("data-fragment-index",n),n+=1):r.removeAttribute("data-fragment-index"),r.addEventListener("visible",bl.scrollHighlightedLineIntoView.bind(bl,r,t)),r.addEventListener("hidden",bl.scrollHighlightedLineIntoView.bind(bl,r.previousSibling,t))})),e.removeAttribute("data-fragment-index"),e.setAttribute("data-line-numbers",bl.serializeHighlightSteps([a[0]]))}var r="function"==typeof e.closest?e.closest("section:not(.stack)"):null;if(r){r.addEventListener("visible",(function a(){bl.scrollHighlightedLineIntoView(e,t,!0),r.removeEventListener("visible",a)}))}bl.highlightLines(e)}},scrollHighlightedLineIntoView:function(e,t,a){cancelAnimationFrame(t.animationFrameID),t.currentBlock&&(e.scrollTop=t.currentBlock.scrollTop),t.currentBlock=e;var n=this.getHighlightedLineBounds(e),r=e.offsetHeight,i=getComputedStyle(e);r-=parseInt(i.paddingTop)+parseInt(i.paddingBottom);var o=e.scrollTop,s=n.top+(Math.min(n.bottom-n.top,r)-r)/2,l=e.querySelector(".hljs-ln");if(l&&(s+=l.offsetTop-parseInt(i.paddingTop)),s=Math.max(Math.min(s,e.scrollHeight-r),0),!0===a||o===s)e.scrollTop=s;else{if(e.scrollHeight<=r)return;var _=0;!function a(){_=Math.min(_+.02,1),e.scrollTop=o+(s-o)*bl.easeInOutQuart(_),_<1&&(t.animationFrameID=requestAnimationFrame(a))}()}},easeInOutQuart:function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},getHighlightedLineBounds:function(e){var t=e.querySelectorAll(".highlight-line");if(0===t.length)return{top:0,bottom:0};var a=t[0],n=t[t.length-1];return{top:a.offsetTop,bottom:n.offsetTop+n.offsetHeight}},highlightLines:function(e,t){var a=bl.deserializeHighlightSteps(t||e.getAttribute("data-line-numbers"));a.length&&a[0].forEach((function(t){var a=[];"number"==typeof t.end?a=[].slice.call(e.querySelectorAll("table tr:nth-child(n+"+t.start+"):nth-child(-n+"+t.end+")")):"number"==typeof t.start&&(a=[].slice.call(e.querySelectorAll("table tr:nth-child("+t.start+")"))),a.length&&(a.forEach((function(e){e.classList.add("highlight-line")})),e.classList.add("has-highlights"))}))},deserializeHighlightSteps:function(e){return(e=(e=e.replace(/\s/g,"")).split(bl.HIGHLIGHT_STEP_DELIMITER)).map((function(e){return e.split(bl.HIGHLIGHT_LINE_DELIMITER).map((function(e){if(/^[\d-]+$/.test(e)){e=e.split(bl.HIGHLIGHT_LINE_RANGE_DELIMITER);var t=parseInt(e[0],10),a=parseInt(e[1],10);return isNaN(a)?{start:t}:{start:t,end:a}}return{}}))}))},serializeHighlightSteps:function(e){return e.map((function(e){return e.map((function(e){return"number"==typeof e.end?e.start+bl.HIGHLIGHT_LINE_RANGE_DELIMITER+e.end:"number"==typeof e.start?e.start:""})).join(bl.HIGHLIGHT_LINE_DELIMITER)})).join(bl.HIGHLIGHT_STEP_DELIMITER)}};export default function(){return bl} diff --git a/plugin/highlight/highlight.js b/plugin/highlight/highlight.js index b5d18007954..525cc78442a 100644 --- a/plugin/highlight/highlight.js +++ b/plugin/highlight/highlight.js @@ -2,4 +2,4 @@ /*! * reveal.js plugin that adds syntax highlight support. */ -var Tl={id:"highlight",HIGHLIGHT_STEP_DELIMITER:"|",HIGHLIGHT_LINE_DELIMITER:",",HIGHLIGHT_LINE_RANGE_DELIMITER:"-",hljs:Sl,init:function(e){var t=e.getConfig().highlight||{};t.highlightOnLoad="boolean"!=typeof t.highlightOnLoad||t.highlightOnLoad,t.escapeHTML="boolean"!=typeof t.escapeHTML||t.escapeHTML,[].slice.call(e.getRevealElement().querySelectorAll("pre code")).forEach((function(e){e.hasAttribute("data-trim")&&"function"==typeof e.innerHTML.trim&&(e.innerHTML=function(e){function t(e){return e.replace(/^[\s\uFEFF\xA0]+/g,"")}return function(e){var a=function(e){for(var t=e.split("\n"),a=0;a=0&&""===t[a].trim();a--)t.splice(a,1);return t.join("\n")}(e.innerHTML).split("\n"),n=a.reduce((function(e,a){return a.length>0&&t(a).length>0&&e>a.length-t(a).length?a.length-t(a).length:e}),Number.POSITIVE_INFINITY);return a.map((function(e,t){return e.slice(n)})).join("\n")}(e)}(e)),t.escapeHTML&&!e.hasAttribute("data-noescape")&&(e.innerHTML=e.innerHTML.replace(//g,">")),e.addEventListener("focusout",(function(e){Sl.highlightBlock(e.currentTarget)}),!1),t.highlightOnLoad&&Tl.highlightBlock(e)})),e.on("pdf-ready",(function(){[].slice.call(e.getRevealElement().querySelectorAll("pre code[data-line-numbers].current-fragment")).forEach((function(e){Tl.scrollHighlightedLineIntoView(e,{},!0)}))}))},highlightBlock:function(e){if(Sl.highlightBlock(e),0!==e.innerHTML.trim().length&&e.hasAttribute("data-line-numbers")){Sl.lineNumbersBlock(e,{singleLine:!0});var t={currentBlock:e},a=Tl.deserializeHighlightSteps(e.getAttribute("data-line-numbers"));if(a.length>1){var n=parseInt(e.getAttribute("data-fragment-index"),10);("number"!=typeof n||isNaN(n))&&(n=null),a.slice(1).forEach((function(a){var r=e.cloneNode(!0);r.setAttribute("data-line-numbers",Tl.serializeHighlightSteps([a])),r.classList.add("fragment"),e.parentNode.appendChild(r),Tl.highlightLines(r),"number"==typeof n?(r.setAttribute("data-fragment-index",n),n+=1):r.removeAttribute("data-fragment-index"),r.addEventListener("visible",Tl.scrollHighlightedLineIntoView.bind(Tl,r,t)),r.addEventListener("hidden",Tl.scrollHighlightedLineIntoView.bind(Tl,r.previousSibling,t))})),e.removeAttribute("data-fragment-index"),e.setAttribute("data-line-numbers",Tl.serializeHighlightSteps([a[0]]))}var r="function"==typeof e.closest?e.closest("section:not(.stack)"):null;if(r){r.addEventListener("visible",(function a(){Tl.scrollHighlightedLineIntoView(e,t,!0),r.removeEventListener("visible",a)}))}Tl.highlightLines(e)}},scrollHighlightedLineIntoView:function(e,t,a){cancelAnimationFrame(t.animationFrameID),t.currentBlock&&(e.scrollTop=t.currentBlock.scrollTop),t.currentBlock=e;var n=this.getHighlightedLineBounds(e),r=e.offsetHeight,i=getComputedStyle(e);r-=parseInt(i.paddingTop)+parseInt(i.paddingBottom);var o=e.scrollTop,s=n.top+(Math.min(n.bottom-n.top,r)-r)/2,l=e.querySelector(".hljs-ln");if(l&&(s+=l.offsetTop-parseInt(i.paddingTop)),s=Math.max(Math.min(s,e.scrollHeight-r),0),!0===a||o===s)e.scrollTop=s;else{if(e.scrollHeight<=r)return;var _=0;!function a(){_=Math.min(_+.02,1),e.scrollTop=o+(s-o)*Tl.easeInOutQuart(_),_<1&&(t.animationFrameID=requestAnimationFrame(a))}()}},easeInOutQuart:function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},getHighlightedLineBounds:function(e){var t=e.querySelectorAll(".highlight-line");if(0===t.length)return{top:0,bottom:0};var a=t[0],n=t[t.length-1];return{top:a.offsetTop,bottom:n.offsetTop+n.offsetHeight}},highlightLines:function(e,t){var a=Tl.deserializeHighlightSteps(t||e.getAttribute("data-line-numbers"));a.length&&a[0].forEach((function(t){var a=[];"number"==typeof t.end?a=[].slice.call(e.querySelectorAll("table tr:nth-child(n+"+t.start+"):nth-child(-n+"+t.end+")")):"number"==typeof t.start&&(a=[].slice.call(e.querySelectorAll("table tr:nth-child("+t.start+")"))),a.length&&(a.forEach((function(e){e.classList.add("highlight-line")})),e.classList.add("has-highlights"))}))},deserializeHighlightSteps:function(e){return(e=(e=e.replace(/\s/g,"")).split(Tl.HIGHLIGHT_STEP_DELIMITER)).map((function(e){return e.split(Tl.HIGHLIGHT_LINE_DELIMITER).map((function(e){if(/^[\d-]+$/.test(e)){e=e.split(Tl.HIGHLIGHT_LINE_RANGE_DELIMITER);var t=parseInt(e[0],10),a=parseInt(e[1],10);return isNaN(a)?{start:t}:{start:t,end:a}}return{}}))}))},serializeHighlightSteps:function(e){return e.map((function(e){return e.map((function(e){return"number"==typeof e.end?e.start+Tl.HIGHLIGHT_LINE_RANGE_DELIMITER+e.end:"number"==typeof e.start?e.start:""})).join(Tl.HIGHLIGHT_LINE_DELIMITER)})).join(Tl.HIGHLIGHT_STEP_DELIMITER)}};return function(){return Tl}})); +var Tl={id:"highlight",HIGHLIGHT_STEP_DELIMITER:"|",HIGHLIGHT_LINE_DELIMITER:",",HIGHLIGHT_LINE_RANGE_DELIMITER:"-",hljs:Sl,init:function(e){var t=e.getConfig().highlight||{};t.highlightOnLoad="boolean"!=typeof t.highlightOnLoad||t.highlightOnLoad,t.escapeHTML="boolean"!=typeof t.escapeHTML||t.escapeHTML,[].slice.call(e.getRevealElement().querySelectorAll("pre code")).forEach((function(e){var a=e.querySelector('script[type="text/template"]');a&&(e.textContent=a.innerHTML),e.hasAttribute("data-trim")&&"function"==typeof e.innerHTML.trim&&(e.innerHTML=function(e){function t(e){return e.replace(/^[\s\uFEFF\xA0]+/g,"")}return function(e){var a=function(e){for(var t=e.split("\n"),a=0;a=0&&""===t[a].trim();a--)t.splice(a,1);return t.join("\n")}(e.innerHTML).split("\n"),n=a.reduce((function(e,a){return a.length>0&&t(a).length>0&&e>a.length-t(a).length?a.length-t(a).length:e}),Number.POSITIVE_INFINITY);return a.map((function(e,t){return e.slice(n)})).join("\n")}(e)}(e)),t.escapeHTML&&!e.hasAttribute("data-noescape")&&(e.innerHTML=e.innerHTML.replace(//g,">")),e.addEventListener("focusout",(function(e){Sl.highlightBlock(e.currentTarget)}),!1),t.highlightOnLoad&&Tl.highlightBlock(e)})),e.on("pdf-ready",(function(){[].slice.call(e.getRevealElement().querySelectorAll("pre code[data-line-numbers].current-fragment")).forEach((function(e){Tl.scrollHighlightedLineIntoView(e,{},!0)}))}))},highlightBlock:function(e){if(Sl.highlightBlock(e),0!==e.innerHTML.trim().length&&e.hasAttribute("data-line-numbers")){Sl.lineNumbersBlock(e,{singleLine:!0});var t={currentBlock:e},a=Tl.deserializeHighlightSteps(e.getAttribute("data-line-numbers"));if(a.length>1){var n=parseInt(e.getAttribute("data-fragment-index"),10);("number"!=typeof n||isNaN(n))&&(n=null),a.slice(1).forEach((function(a){var r=e.cloneNode(!0);r.setAttribute("data-line-numbers",Tl.serializeHighlightSteps([a])),r.classList.add("fragment"),e.parentNode.appendChild(r),Tl.highlightLines(r),"number"==typeof n?(r.setAttribute("data-fragment-index",n),n+=1):r.removeAttribute("data-fragment-index"),r.addEventListener("visible",Tl.scrollHighlightedLineIntoView.bind(Tl,r,t)),r.addEventListener("hidden",Tl.scrollHighlightedLineIntoView.bind(Tl,r.previousSibling,t))})),e.removeAttribute("data-fragment-index"),e.setAttribute("data-line-numbers",Tl.serializeHighlightSteps([a[0]]))}var r="function"==typeof e.closest?e.closest("section:not(.stack)"):null;if(r){r.addEventListener("visible",(function a(){Tl.scrollHighlightedLineIntoView(e,t,!0),r.removeEventListener("visible",a)}))}Tl.highlightLines(e)}},scrollHighlightedLineIntoView:function(e,t,a){cancelAnimationFrame(t.animationFrameID),t.currentBlock&&(e.scrollTop=t.currentBlock.scrollTop),t.currentBlock=e;var n=this.getHighlightedLineBounds(e),r=e.offsetHeight,i=getComputedStyle(e);r-=parseInt(i.paddingTop)+parseInt(i.paddingBottom);var o=e.scrollTop,s=n.top+(Math.min(n.bottom-n.top,r)-r)/2,l=e.querySelector(".hljs-ln");if(l&&(s+=l.offsetTop-parseInt(i.paddingTop)),s=Math.max(Math.min(s,e.scrollHeight-r),0),!0===a||o===s)e.scrollTop=s;else{if(e.scrollHeight<=r)return;var _=0;!function a(){_=Math.min(_+.02,1),e.scrollTop=o+(s-o)*Tl.easeInOutQuart(_),_<1&&(t.animationFrameID=requestAnimationFrame(a))}()}},easeInOutQuart:function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},getHighlightedLineBounds:function(e){var t=e.querySelectorAll(".highlight-line");if(0===t.length)return{top:0,bottom:0};var a=t[0],n=t[t.length-1];return{top:a.offsetTop,bottom:n.offsetTop+n.offsetHeight}},highlightLines:function(e,t){var a=Tl.deserializeHighlightSteps(t||e.getAttribute("data-line-numbers"));a.length&&a[0].forEach((function(t){var a=[];"number"==typeof t.end?a=[].slice.call(e.querySelectorAll("table tr:nth-child(n+"+t.start+"):nth-child(-n+"+t.end+")")):"number"==typeof t.start&&(a=[].slice.call(e.querySelectorAll("table tr:nth-child("+t.start+")"))),a.length&&(a.forEach((function(e){e.classList.add("highlight-line")})),e.classList.add("has-highlights"))}))},deserializeHighlightSteps:function(e){return(e=(e=e.replace(/\s/g,"")).split(Tl.HIGHLIGHT_STEP_DELIMITER)).map((function(e){return e.split(Tl.HIGHLIGHT_LINE_DELIMITER).map((function(e){if(/^[\d-]+$/.test(e)){e=e.split(Tl.HIGHLIGHT_LINE_RANGE_DELIMITER);var t=parseInt(e[0],10),a=parseInt(e[1],10);return isNaN(a)?{start:t}:{start:t,end:a}}return{}}))}))},serializeHighlightSteps:function(e){return e.map((function(e){return e.map((function(e){return"number"==typeof e.end?e.start+Tl.HIGHLIGHT_LINE_RANGE_DELIMITER+e.end:"number"==typeof e.start?e.start:""})).join(Tl.HIGHLIGHT_LINE_DELIMITER)})).join(Tl.HIGHLIGHT_STEP_DELIMITER)}};return function(){return Tl}})); diff --git a/plugin/highlight/plugin.js b/plugin/highlight/plugin.js index f6cc62454d9..00a731b36eb 100644 --- a/plugin/highlight/plugin.js +++ b/plugin/highlight/plugin.js @@ -35,6 +35,15 @@ const Plugin = { [].slice.call( reveal.getRevealElement().querySelectorAll( 'pre code' ) ).forEach( function( block ) { + // Code can optionally be wrapped in script template to avoid + // HTML being parsed by the browser (i.e. when you need to + // include <, > or & in your code). + let substitute = block.querySelector( 'script[type="text/template"]' ); + if( substitute ) { + // textContent handles the HTML entity escapes for us + block.textContent = substitute.innerHTML; + } + // Trim whitespace if the "data-trim" attribute is present if( block.hasAttribute( 'data-trim' ) && typeof block.innerHTML.trim === 'function' ) { block.innerHTML = betterTrim( block ); From 66cbd66fb6ae6a31e1478d47722805f7bedad7ee Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Fri, 5 Jun 2020 11:47:29 +0200 Subject: [PATCH 10/26] fix slide numbering issue with uncounted horizontal slides (fixes #2675) --- dist/reveal.esm.js | 2 +- dist/reveal.js | 2 +- js/controllers/slidenumber.js | 9 ++++++--- js/reveal.js | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/dist/reveal.esm.js b/dist/reveal.esm.js index 296b0f7f183..15956c31e95 100644 --- a/dist/reveal.esm.js +++ b/dist/reveal.esm.js @@ -5,5 +5,5 @@ * * Copyright (C) 2020 Hakim El Hattab, https://hakim.se */ -var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e,t,i){return e(i={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&i.path)}},i.exports),i.exports}var i,n=function(e){return e&&e.Math==Math&&e},a=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof e&&e)||Function("return this")(),s={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},r=function(e){try{return!!e()}catch(e){return!0}},o={}.toString,l=function(e){return o.call(e).slice(8,-1)},d="".split,c=r((function(){return!Object("z").propertyIsEnumerable(0)}))?function(e){return"String"==l(e)?d.call(e,""):Object(e)}:Object,u=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e},h=function(e){return c(u(e))},g=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),v=function(e){return"object"==typeof e?null!==e:"function"==typeof e},p=a.document,f=v(p)&&v(p.createElement),m=function(e){return f?p.createElement(e):{}},b=!g&&!r((function(){return 7!=Object.defineProperty(m("div"),"a",{get:function(){return 7}}).a})),y=function(e){if(!v(e))throw TypeError(String(e)+" is not an object");return e},w=function(e,t){if(!v(e))return e;var i,n;if(t&&"function"==typeof(i=e.toString)&&!v(n=i.call(e)))return n;if("function"==typeof(i=e.valueOf)&&!v(n=i.call(e)))return n;if(!t&&"function"==typeof(i=e.toString)&&!v(n=i.call(e)))return n;throw TypeError("Can't convert object to primitive value")},R=Object.defineProperty,E={f:g?R:function(e,t,i){if(y(e),t=w(t,!0),y(i),b)try{return R(e,t,i)}catch(e){}if("get"in i||"set"in i)throw TypeError("Accessors not supported");return"value"in i&&(e[t]=i.value),e}},S=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},A=g?function(e,t,i){return E.f(e,t,S(1,i))}:function(e,t,i){return e[t]=i,e},k=function(e,t){try{A(a,e,t)}catch(i){a[e]=t}return t},L=a["__core-js_shared__"]||k("__core-js_shared__",{}),x=t((function(e){(e.exports=function(e,t){return L[e]||(L[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.6.5",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})})),C={}.hasOwnProperty,P=function(e,t){return C.call(e,t)},N=0,M=Math.random(),I=function(e){return"Symbol("+String(void 0===e?"":e)+")_"+(++N+M).toString(36)},T=!!Object.getOwnPropertySymbols&&!r((function(){return!String(Symbol())})),D=T&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,O=x("wks"),H=a.Symbol,B=D?H:H&&H.withoutSetter||I,U=function(e){return P(O,e)||(T&&P(H,e)?O[e]=H[e]:O[e]=B("Symbol."+e)),O[e]},j=Math.ceil,z=Math.floor,q=function(e){return isNaN(e=+e)?0:(e>0?z:j)(e)},F=Math.min,_=function(e){return e>0?F(q(e),9007199254740991):0},W=Math.max,V=Math.min,K=function(e){return function(t,i,n){var a,s=h(t),r=_(s.length),o=function(e,t){var i=q(e);return i<0?W(i+t,0):V(i,t)}(n,r);if(e&&i!=i){for(;r>o;)if((a=s[o++])!=a)return!0}else for(;r>o;o++)if((e||o in s)&&s[o]===i)return e||o||0;return!e&&-1}},X={includes:K(!0),indexOf:K(!1)},$={},Y=X.indexOf,G=function(e,t){var i,n=h(e),a=0,s=[];for(i in n)!P($,i)&&P(n,i)&&s.push(i);for(;t.length>a;)P(n,i=t[a++])&&(~Y(s,i)||s.push(i));return s},J=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Q=Object.keys||function(e){return G(e,J)},Z=g?Object.defineProperties:function(e,t){y(e);for(var i,n=Q(t),a=n.length,s=0;a>s;)E.f(e,i=n[s++],t[i]);return e},ee=a,te=function(e){return"function"==typeof e?e:void 0},ie=function(e,t){return arguments.length<2?te(ee[e])||te(a[e]):ee[e]&&ee[e][t]||a[e]&&a[e][t]},ne=ie("document","documentElement"),ae=x("keys"),se=function(e){return ae[e]||(ae[e]=I(e))},re=se("IE_PROTO"),oe=function(){},le=function(e){return" diff --git a/js/controllers/slidecontent.js b/js/controllers/slidecontent.js index d71b3ddd8a5..e6d316486aa 100644 --- a/js/controllers/slidecontent.js +++ b/js/controllers/slidecontent.js @@ -117,7 +117,12 @@ export default class SlideContent { } // Enable inline playback in mobile Safari + // + // Mute is required for video to play when using + // swipe gestures to navigate since they don't + // count as direct user actions :'( if( isMobile ) { + video.muted = true; video.setAttribute( 'playsinline', '' ); } From 2bfe705e6ac8307c22d78a80bf237461658866ed Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Tue, 30 Jun 2020 21:10:09 +0200 Subject: [PATCH 17/26] include /css and /js in npm package #2712 --- .npmignore | 2 -- 1 file changed, 2 deletions(-) diff --git a/.npmignore b/.npmignore index b46c65d556e..50c12b9debd 100644 --- a/.npmignore +++ b/.npmignore @@ -1,7 +1,5 @@ /test /examples -/css -/js .github .gulpfile .sass-cache From b05e530f2153666a3009bd3f2db1761abe2909fd Mon Sep 17 00:00:00 2001 From: Eric Briand <1011902+ebriand@users.noreply.github.com> Date: Tue, 4 Aug 2020 10:06:20 +0200 Subject: [PATCH 18/26] Fix URL to pdf-export documentation --- css/print/pdf.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/css/print/pdf.scss b/css/print/pdf.scss index ea0d417a66b..f9678456b81 100644 --- a/css/print/pdf.scss +++ b/css/print/pdf.scss @@ -2,7 +2,7 @@ * This stylesheet is used to print reveal.js * presentations to PDF. * - * https://revealjs.revealjs.com/pdf-export/ + * https://revealjs.com/pdf-export/ */ html.print-pdf { From 3a99a7b70aa7e74012c7049655da09959ca8c584 Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Mon, 17 Aug 2020 14:42:27 +0200 Subject: [PATCH 19/26] shuffle now applies to vertical slides as well --- dist/reveal.esm.js | 2 +- dist/reveal.js | 2 +- index.html | 3 ++- js/reveal.js | 20 +++++++++++++++----- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/dist/reveal.esm.js b/dist/reveal.esm.js index ec0d88d9330..08b56bc39a4 100644 --- a/dist/reveal.esm.js +++ b/dist/reveal.esm.js @@ -5,5 +5,5 @@ * * Copyright (C) 2020 Hakim El Hattab, https://hakim.se */ -var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e,t,i){return e(i={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&i.path)}},i.exports),i.exports}var i,n=function(e){return e&&e.Math==Math&&e},a=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof e&&e)||Function("return this")(),s={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},r=function(e){try{return!!e()}catch(e){return!0}},o={}.toString,l=function(e){return o.call(e).slice(8,-1)},d="".split,c=r((function(){return!Object("z").propertyIsEnumerable(0)}))?function(e){return"String"==l(e)?d.call(e,""):Object(e)}:Object,u=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e},h=function(e){return c(u(e))},g=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),v=function(e){return"object"==typeof e?null!==e:"function"==typeof e},p=a.document,f=v(p)&&v(p.createElement),m=function(e){return f?p.createElement(e):{}},b=!g&&!r((function(){return 7!=Object.defineProperty(m("div"),"a",{get:function(){return 7}}).a})),y=function(e){if(!v(e))throw TypeError(String(e)+" is not an object");return e},w=function(e,t){if(!v(e))return e;var i,n;if(t&&"function"==typeof(i=e.toString)&&!v(n=i.call(e)))return n;if("function"==typeof(i=e.valueOf)&&!v(n=i.call(e)))return n;if(!t&&"function"==typeof(i=e.toString)&&!v(n=i.call(e)))return n;throw TypeError("Can't convert object to primitive value")},S=Object.defineProperty,E={f:g?S:function(e,t,i){if(y(e),t=w(t,!0),y(i),b)try{return S(e,t,i)}catch(e){}if("get"in i||"set"in i)throw TypeError("Accessors not supported");return"value"in i&&(e[t]=i.value),e}},R=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},A=g?function(e,t,i){return E.f(e,t,R(1,i))}:function(e,t,i){return e[t]=i,e},k=function(e,t){try{A(a,e,t)}catch(i){a[e]=t}return t},L=a["__core-js_shared__"]||k("__core-js_shared__",{}),x=t((function(e){(e.exports=function(e,t){return L[e]||(L[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.6.5",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})})),C={}.hasOwnProperty,P=function(e,t){return C.call(e,t)},N=0,M=Math.random(),I=function(e){return"Symbol("+String(void 0===e?"":e)+")_"+(++N+M).toString(36)},T=!!Object.getOwnPropertySymbols&&!r((function(){return!String(Symbol())})),D=T&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,O=x("wks"),z=a.Symbol,H=D?z:z&&z.withoutSetter||I,B=function(e){return P(O,e)||(T&&P(z,e)?O[e]=z[e]:O[e]=H("Symbol."+e)),O[e]},U=Math.ceil,j=Math.floor,F=function(e){return isNaN(e=+e)?0:(e>0?j:U)(e)},q=Math.min,W=function(e){return e>0?q(F(e),9007199254740991):0},_=Math.max,V=Math.min,K=function(e){return function(t,i,n){var a,s=h(t),r=W(s.length),o=function(e,t){var i=F(e);return i<0?_(i+t,0):V(i,t)}(n,r);if(e&&i!=i){for(;r>o;)if((a=s[o++])!=a)return!0}else for(;r>o;o++)if((e||o in s)&&s[o]===i)return e||o||0;return!e&&-1}},X={includes:K(!0),indexOf:K(!1)},$={},Y=X.indexOf,G=function(e,t){var i,n=h(e),a=0,s=[];for(i in n)!P($,i)&&P(n,i)&&s.push(i);for(;t.length>a;)P(n,i=t[a++])&&(~Y(s,i)||s.push(i));return s},J=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Q=Object.keys||function(e){return G(e,J)},Z=g?Object.defineProperties:function(e,t){y(e);for(var i,n=Q(t),a=n.length,s=0;a>s;)E.f(e,i=n[s++],t[i]);return e},ee=a,te=function(e){return"function"==typeof e?e:void 0},ie=function(e,t){return arguments.length<2?te(ee[e])||te(a[e]):ee[e]&&ee[e][t]||a[e]&&a[e][t]},ne=ie("document","documentElement"),ae=x("keys"),se=function(e){return ae[e]||(ae[e]=I(e))},re=se("IE_PROTO"),oe=function(){},le=function(e){return"