update packages and add valign
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
56
scripts/reveal.js/plugin/highlight/index.ts
Normal file
56
scripts/reveal.js/plugin/highlight/index.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
import type { HLJSApi } from 'highlight.js';
|
||||
import type { RevealPlugin } from 'reveal.js';
|
||||
|
||||
// @ts-expect-error The runtime implementation remains in JS during the migration.
|
||||
import HighlightImplementation from './plugin.js';
|
||||
|
||||
export interface HighlightLine {
|
||||
start?: number;
|
||||
end?: number;
|
||||
}
|
||||
|
||||
export interface HighlightLineNumbersOptions {
|
||||
singleLine?: boolean;
|
||||
startFrom?: number;
|
||||
}
|
||||
|
||||
export interface HighlightJsApi extends HLJSApi {
|
||||
initLineNumbersOnLoad(options?: HighlightLineNumbersOptions): void;
|
||||
lineNumbersBlock(element: HTMLElement, options?: HighlightLineNumbersOptions): void;
|
||||
lineNumbersValue(code: string, options?: HighlightLineNumbersOptions): string | undefined;
|
||||
}
|
||||
|
||||
export interface HighlightScrollState {
|
||||
currentBlock?: HTMLElement;
|
||||
animationFrameID?: number;
|
||||
}
|
||||
|
||||
export interface HighlightLineBounds {
|
||||
top: number;
|
||||
bottom: number;
|
||||
}
|
||||
|
||||
export type HighlightLineStep = HighlightLine[];
|
||||
|
||||
export interface HighlightPlugin extends RevealPlugin {
|
||||
id: 'highlight';
|
||||
HIGHLIGHT_STEP_DELIMITER: '|';
|
||||
HIGHLIGHT_LINE_DELIMITER: ',';
|
||||
HIGHLIGHT_LINE_RANGE_DELIMITER: '-';
|
||||
hljs: HighlightJsApi;
|
||||
highlightBlock(block: HTMLElement): void;
|
||||
scrollHighlightedLineIntoView(
|
||||
block: HTMLElement,
|
||||
scrollState: HighlightScrollState,
|
||||
skipAnimation?: boolean
|
||||
): void;
|
||||
easeInOutQuart(t: number): number;
|
||||
getHighlightedLineBounds(block: HTMLElement): HighlightLineBounds;
|
||||
highlightLines(block: HTMLElement, linesToHighlight?: string): void;
|
||||
deserializeHighlightSteps(highlightSteps: string): HighlightLineStep[];
|
||||
serializeHighlightSteps(highlightSteps: HighlightLineStep[]): string;
|
||||
}
|
||||
|
||||
const Highlight = HighlightImplementation as () => HighlightPlugin;
|
||||
|
||||
export default Highlight;
|
||||
@@ -1,71 +0,0 @@
|
||||
/*
|
||||
Monokai style - ported by Luigi Maselli - http://grigio.org
|
||||
*/
|
||||
|
||||
.hljs {
|
||||
display: block;
|
||||
overflow-x: auto;
|
||||
padding: 0.5em;
|
||||
background: #272822;
|
||||
color: #ddd;
|
||||
}
|
||||
|
||||
.hljs-tag,
|
||||
.hljs-keyword,
|
||||
.hljs-selector-tag,
|
||||
.hljs-literal,
|
||||
.hljs-strong,
|
||||
.hljs-name {
|
||||
color: #f92672;
|
||||
}
|
||||
|
||||
.hljs-code {
|
||||
color: #66d9ef;
|
||||
}
|
||||
|
||||
.hljs-class .hljs-title {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.hljs-attribute,
|
||||
.hljs-symbol,
|
||||
.hljs-regexp,
|
||||
.hljs-link {
|
||||
color: #bf79db;
|
||||
}
|
||||
|
||||
.hljs-string,
|
||||
.hljs-bullet,
|
||||
.hljs-subst,
|
||||
.hljs-title,
|
||||
.hljs-section,
|
||||
.hljs-emphasis,
|
||||
.hljs-type,
|
||||
.hljs-built_in,
|
||||
.hljs-builtin-name,
|
||||
.hljs-selector-attr,
|
||||
.hljs-selector-pseudo,
|
||||
.hljs-addition,
|
||||
.hljs-variable,
|
||||
.hljs-template-tag,
|
||||
.hljs-template-variable {
|
||||
color: #a6e22e;
|
||||
}
|
||||
|
||||
.hljs-comment,
|
||||
.hljs-quote,
|
||||
.hljs-deletion,
|
||||
.hljs-meta {
|
||||
color: #75715e;
|
||||
}
|
||||
|
||||
.hljs-keyword,
|
||||
.hljs-selector-tag,
|
||||
.hljs-literal,
|
||||
.hljs-doctag,
|
||||
.hljs-title,
|
||||
.hljs-section,
|
||||
.hljs-type,
|
||||
.hljs-selector-id {
|
||||
font-weight: bold;
|
||||
}
|
||||
23
scripts/reveal.js/plugin/highlight/vite.config.ts
Normal file
23
scripts/reveal.js/plugin/highlight/vite.config.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { resolve } from 'path';
|
||||
import { defineConfig } from 'vite'
|
||||
import { appendExtension } from '../../vite.config.ts';
|
||||
import { createPluginDts } from '../vite-plugin-dts.ts';
|
||||
|
||||
// Once Vite supports multiple entries for plugins, this build can
|
||||
// be merged into the main vite.config.ts.
|
||||
// See https://github.com/vitejs/vite/pull/10609
|
||||
|
||||
export default defineConfig({
|
||||
build: {
|
||||
emptyOutDir: false,
|
||||
lib: {
|
||||
formats: ['es', 'umd'],
|
||||
entry: {
|
||||
'plugin/highlight': resolve(__dirname, 'index.ts'),
|
||||
},
|
||||
name: 'RevealHighlight',
|
||||
fileName: appendExtension
|
||||
}
|
||||
},
|
||||
plugins: [createPluginDts('highlight')],
|
||||
})
|
||||
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
|
||||
Zenburn style from voldmar.ru (c) Vladimir Epifanov <voldmar@voldmar.ru>
|
||||
based on dark.css by Ivan Sagalaev
|
||||
|
||||
*/
|
||||
|
||||
.hljs {
|
||||
display: block;
|
||||
overflow-x: auto;
|
||||
padding: 0.5em;
|
||||
background: #3f3f3f;
|
||||
color: #dcdcdc;
|
||||
}
|
||||
|
||||
.hljs-keyword,
|
||||
.hljs-selector-tag,
|
||||
.hljs-tag {
|
||||
color: #e3ceab;
|
||||
}
|
||||
|
||||
.hljs-template-tag {
|
||||
color: #dcdcdc;
|
||||
}
|
||||
|
||||
.hljs-number {
|
||||
color: #8cd0d3;
|
||||
}
|
||||
|
||||
.hljs-variable,
|
||||
.hljs-template-variable,
|
||||
.hljs-attribute {
|
||||
color: #efdcbc;
|
||||
}
|
||||
|
||||
.hljs-literal {
|
||||
color: #efefaf;
|
||||
}
|
||||
|
||||
.hljs-subst {
|
||||
color: #8f8f8f;
|
||||
}
|
||||
|
||||
.hljs-title,
|
||||
.hljs-name,
|
||||
.hljs-selector-id,
|
||||
.hljs-selector-class,
|
||||
.hljs-section,
|
||||
.hljs-type {
|
||||
color: #efef8f;
|
||||
}
|
||||
|
||||
.hljs-symbol,
|
||||
.hljs-bullet,
|
||||
.hljs-link {
|
||||
color: #dca3a3;
|
||||
}
|
||||
|
||||
.hljs-deletion,
|
||||
.hljs-string,
|
||||
.hljs-built_in,
|
||||
.hljs-builtin-name {
|
||||
color: #cc9393;
|
||||
}
|
||||
|
||||
.hljs-addition,
|
||||
.hljs-comment,
|
||||
.hljs-quote,
|
||||
.hljs-meta {
|
||||
color: #7f9f7f;
|
||||
}
|
||||
|
||||
|
||||
.hljs-emphasis {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.hljs-strong {
|
||||
font-weight: bold;
|
||||
}
|
||||
29
scripts/reveal.js/plugin/markdown/index.ts
Normal file
29
scripts/reveal.js/plugin/markdown/index.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import type { MarkdownConfig, RevealPlugin } from 'reveal.js';
|
||||
import type { Marked } from 'marked';
|
||||
|
||||
// @ts-expect-error The runtime implementation remains in JS during the migration.
|
||||
import MarkdownImplementation from './plugin.js';
|
||||
|
||||
export interface MarkdownSlidifyOptions {
|
||||
separator?: string | null;
|
||||
verticalSeparator?: string | null;
|
||||
notesSeparator?: string;
|
||||
attributes?: string;
|
||||
}
|
||||
|
||||
export interface MarkdownOptions extends MarkdownConfig {
|
||||
animateLists?: boolean;
|
||||
}
|
||||
|
||||
export interface MarkdownPlugin extends RevealPlugin {
|
||||
id: 'markdown';
|
||||
processSlides(scope: ParentNode): Promise<void[]>;
|
||||
convertSlides(): Promise<void>;
|
||||
slidify(markdown: string, options?: MarkdownSlidifyOptions): string;
|
||||
readonly marked: Marked | null;
|
||||
readonly markdownOptions: MarkdownOptions;
|
||||
}
|
||||
|
||||
const Markdown = MarkdownImplementation as () => MarkdownPlugin;
|
||||
|
||||
export default Markdown;
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -4,7 +4,8 @@
|
||||
* of external markdown documents.
|
||||
*/
|
||||
|
||||
import { marked } from 'marked';
|
||||
import { Marked } from 'marked';
|
||||
import { markedSmartypants } from 'marked-smartypants';
|
||||
|
||||
const DEFAULT_SLIDE_SEPARATOR = '\r?\n---\r?\n',
|
||||
DEFAULT_VERTICAL_SEPARATOR = null,
|
||||
@@ -30,6 +31,7 @@ const Plugin = () => {
|
||||
|
||||
// The reveal.js instance this plugin is attached to
|
||||
let deck;
|
||||
let markedInstance = null;
|
||||
|
||||
/**
|
||||
* Retrieves the markdown contents of a slide section
|
||||
@@ -116,8 +118,8 @@ const Plugin = () => {
|
||||
|
||||
const notesMatch = content.split( new RegExp( options.notesSeparator, 'mgi' ) );
|
||||
|
||||
if( notesMatch.length === 2 ) {
|
||||
content = notesMatch[0] + '<aside class="notes">' + marked(notesMatch[1].trim()) + '</aside>';
|
||||
if( notesMatch.length === 2 && markedInstance ) {
|
||||
content = notesMatch[0] + '<aside class="notes">' + markedInstance.parse(notesMatch[1].trim()) + '</aside>';
|
||||
}
|
||||
|
||||
// prevent script end tags in the content from interfering
|
||||
@@ -368,7 +370,12 @@ const Plugin = () => {
|
||||
}
|
||||
|
||||
if ( element.nodeType === Node.COMMENT_NODE ) {
|
||||
if ( addAttributeInElement( element, previousElement, separatorElementAttributes ) === false ) {
|
||||
let targetElement = previousElement;
|
||||
if( targetElement && ( targetElement.tagName === 'UL' || targetElement.tagName === 'OL' ) ) {
|
||||
targetElement = targetElement.lastElementChild || targetElement;
|
||||
}
|
||||
|
||||
if ( addAttributeInElement( element, targetElement, separatorElementAttributes ) === false ) {
|
||||
addAttributeInElement( element, section, separatorSectionAttributes );
|
||||
}
|
||||
}
|
||||
@@ -389,7 +396,7 @@ const Plugin = () => {
|
||||
const notes = section.querySelector( 'aside.notes' );
|
||||
const markdown = getMarkdownFromSlide( section );
|
||||
|
||||
section.innerHTML = marked( markdown );
|
||||
section.innerHTML = markedInstance ? markedInstance.parse( markdown ) : markdown;
|
||||
addAttributes( section, section, null, section.getAttribute( 'data-element-attributes' ) ||
|
||||
section.parentNode.getAttribute( 'data-element-attributes' ) ||
|
||||
DEFAULT_ELEMENT_ATTRIBUTES_SEPARATOR,
|
||||
@@ -426,24 +433,14 @@ const Plugin = () => {
|
||||
|
||||
deck = reveal;
|
||||
|
||||
let { renderer, animateLists, ...markedOptions } = deck.getConfig().markdown || {};
|
||||
let { renderer: customRenderer, animateLists, smartypants, ...markedOptions } = deck.getConfig().markdown || {};
|
||||
|
||||
if( !renderer ) {
|
||||
renderer = new marked.Renderer();
|
||||
|
||||
renderer.code = ( code, language ) => {
|
||||
|
||||
// Off by default
|
||||
const renderer = customRenderer || {
|
||||
code( { text, lang } ) {
|
||||
let language = lang || '';
|
||||
let lineNumberOffset = '';
|
||||
let lineNumbers = '';
|
||||
|
||||
// Users can opt in to show line numbers and highlight
|
||||
// specific lines.
|
||||
// ```javascript [] show line numbers
|
||||
// ```javascript [1,4-8] highlights lines 1 and 4-8
|
||||
// optional line number offset:
|
||||
// ```javascript [25: 1,4-8] start line numbering at 25,
|
||||
// highlights lines 1 (numbered as 25) and 4-8 (numbered as 28-32)
|
||||
if( CODE_LINE_NUMBER_REGEX.test( language ) ) {
|
||||
let lineNumberOffsetMatch = language.match( CODE_LINE_NUMBER_REGEX )[2];
|
||||
if (lineNumberOffsetMatch){
|
||||
@@ -455,26 +452,24 @@ const Plugin = () => {
|
||||
language = language.replace( CODE_LINE_NUMBER_REGEX, '' ).trim();
|
||||
}
|
||||
|
||||
// Escape before this gets injected into the DOM to
|
||||
// avoid having the HTML parser alter our code before
|
||||
// highlight.js is able to read it
|
||||
code = escapeForHTML( code );
|
||||
text = escapeForHTML( text );
|
||||
|
||||
// return `<pre><code ${lineNumbers} class="${language}">${code}</code></pre>`;
|
||||
|
||||
return `<pre><code ${lineNumbers} ${lineNumberOffset} class="${language}">${code}</code></pre>`;
|
||||
return `<pre><code ${lineNumbers} ${lineNumberOffset} class="${language}">${text}</code></pre>`;
|
||||
},
|
||||
};
|
||||
if( animateLists === true && !customRenderer ) {
|
||||
renderer.listitem = function( token ) {
|
||||
const text = token.tokens ? this.parser.parseInline( token.tokens ) : ( token.text || '' );
|
||||
return `<li class="fragment">${text}</li>`;
|
||||
};
|
||||
}
|
||||
|
||||
if( animateLists === true ) {
|
||||
renderer.listitem = text => `<li class="fragment">${text}</li>`;
|
||||
markedInstance = new Marked();
|
||||
markedInstance.use( { renderer, ...markedOptions } );
|
||||
if( smartypants ) {
|
||||
markedInstance.use( markedSmartypants() );
|
||||
}
|
||||
|
||||
marked.setOptions( {
|
||||
renderer,
|
||||
...markedOptions
|
||||
} );
|
||||
|
||||
return processSlides( deck.getRevealElement() ).then( convertSlides );
|
||||
|
||||
},
|
||||
@@ -483,7 +478,8 @@ const Plugin = () => {
|
||||
processSlides: processSlides,
|
||||
convertSlides: convertSlides,
|
||||
slidify: slidify,
|
||||
marked: marked
|
||||
get marked() { return markedInstance; },
|
||||
get markdownOptions() { return deck ? deck.getConfig().markdown || {} : {}; }
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
23
scripts/reveal.js/plugin/markdown/vite.config.ts
Normal file
23
scripts/reveal.js/plugin/markdown/vite.config.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { resolve } from 'path';
|
||||
import { defineConfig } from 'vite';
|
||||
import { appendExtension } from '../../vite.config.ts';
|
||||
import { createPluginDts } from '../vite-plugin-dts.ts';
|
||||
|
||||
// Once Vite supports multiple entries for plugins, this build can
|
||||
// be merged into the main vite.config.ts.
|
||||
// See https://github.com/vitejs/vite/pull/10609
|
||||
|
||||
export default defineConfig({
|
||||
build: {
|
||||
emptyOutDir: false,
|
||||
lib: {
|
||||
formats: ['es', 'umd'],
|
||||
entry: {
|
||||
'plugin/markdown': resolve(__dirname, 'index.ts'),
|
||||
},
|
||||
name: 'RevealMarkdown',
|
||||
fileName: appendExtension,
|
||||
},
|
||||
},
|
||||
plugins: [createPluginDts('markdown')],
|
||||
});
|
||||
31
scripts/reveal.js/plugin/math/index.ts
Normal file
31
scripts/reveal.js/plugin/math/index.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import type { RevealPlugin } from 'reveal.js';
|
||||
|
||||
// @ts-expect-error The runtime implementation remains in JS during the migration.
|
||||
import MathImplementation from './plugin.js';
|
||||
|
||||
export interface KaTeXPlugin extends RevealPlugin {
|
||||
id: 'katex';
|
||||
}
|
||||
|
||||
export interface MathJax2Plugin extends RevealPlugin {
|
||||
id: 'mathjax2';
|
||||
}
|
||||
|
||||
export interface MathJax3Plugin extends RevealPlugin {
|
||||
id: 'mathjax3';
|
||||
}
|
||||
|
||||
export interface MathJax4Plugin extends RevealPlugin {
|
||||
id: 'mathjax4';
|
||||
}
|
||||
|
||||
export interface MathPlugin extends MathJax2Plugin {
|
||||
KaTeX: () => KaTeXPlugin;
|
||||
MathJax2: () => MathJax2Plugin;
|
||||
MathJax3: () => MathJax3Plugin;
|
||||
MathJax4: () => MathJax4Plugin;
|
||||
}
|
||||
|
||||
const Math = MathImplementation as MathPlugin;
|
||||
|
||||
export default Math;
|
||||
@@ -1,6 +0,0 @@
|
||||
const t=()=>{let t,e={messageStyle:"none",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]],skipTags:["script","noscript","style","textarea","pre","code"]},skipStartupTypeset:!0};return{id:"mathjax2",init:function(a){t=a;let n=t.getConfig().mathjax2||t.getConfig().math||{},i={...e,...n},s=(i.mathjax||"https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js")+"?config="+(i.config||"TeX-AMS_HTML-full");i.tex2jax={...e.tex2jax,...n.tex2jax},i.mathjax=i.config=null,function(t,e){let a=document.querySelector("head"),n=document.createElement("script");n.type="text/javascript",n.src=t;let i=()=>{"function"==typeof e&&(e.call(),e=null)};n.onload=i,n.onreadystatechange=()=>{"loaded"===this.readyState&&i()},a.appendChild(n)}(s,(function(){MathJax.Hub.Config(i),MathJax.Hub.Queue(["Typeset",MathJax.Hub,t.getRevealElement()]),MathJax.Hub.Queue(t.layout),t.on("slidechanged",(function(t){MathJax.Hub.Queue(["Typeset",MathJax.Hub,t.currentSlide])}))}))}}},e=t;
|
||||
/*!
|
||||
* This plugin is a wrapper for the MathJax2,
|
||||
* MathJax3 and KaTeX typesetter plugins.
|
||||
*/
|
||||
var a=Plugin=Object.assign(e(),{KaTeX:()=>{let t,e={version:"latest",delimiters:[{left:"$$",right:"$$",display:!0},{left:"$",right:"$",display:!1},{left:"\\(",right:"\\)",display:!1},{left:"\\[",right:"\\]",display:!0}],ignoredTags:["script","noscript","style","textarea","pre","code"]};const a=t=>new Promise(((e,a)=>{const n=document.createElement("script");n.type="text/javascript",n.onload=e,n.onerror=a,n.src=t,document.head.append(n)}));return{id:"katex",init:function(n){t=n;let i=t.getConfig().katex||{},s={...e,...i};const{local:o,version:l,extensions:r,...c}=s;let d=s.local||"https://cdn.jsdelivr.net/npm/katex",p=s.local?"":"@"+s.version,u=d+p+"/dist/katex.min.css",h=d+p+"/dist/contrib/mhchem.min.js",x=d+p+"/dist/contrib/auto-render.min.js",m=[d+p+"/dist/katex.min.js"];s.extensions&&s.extensions.includes("mhchem")&&m.push(h),m.push(x);const f=()=>{renderMathInElement(n.getSlidesElement(),c),t.layout()};(t=>{let e=document.createElement("link");e.rel="stylesheet",e.href=t,document.head.appendChild(e)})(u),async function(t){for(const e of t)await a(e)}(m).then((()=>{t.isReady()?f():t.on("ready",f.bind(this))}))}}},MathJax2:t,MathJax3:()=>{let t,e={tex:{inlineMath:[["$","$"],["\\(","\\)"]]},options:{skipHtmlTags:["script","noscript","style","textarea","pre","code"]},startup:{ready:()=>{MathJax.startup.defaultReady(),MathJax.startup.promise.then((()=>{t.layout()}))}}};return{id:"mathjax3",init:function(a){t=a;let n=t.getConfig().mathjax3||{},i={...e,...n};i.tex={...e.tex,...n.tex},i.options={...e.options,...n.options},i.startup={...e.startup,...n.startup};let s=i.mathjax||"https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js";i.mathjax=null,window.MathJax=i,function(t,e){let a=document.createElement("script");a.type="text/javascript",a.id="MathJax-script",a.src=t,a.async=!0,a.onload=()=>{"function"==typeof e&&(e.call(),e=null)},document.head.appendChild(a)}(s,(function(){t.addEventListener("slidechanged",(function(t){MathJax.typeset()}))}))}}}});export{a as default};
|
||||
@@ -1 +0,0 @@
|
||||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).RevealMath=e()}(this,(function(){"use strict";const t=()=>{let t,e={messageStyle:"none",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]],skipTags:["script","noscript","style","textarea","pre","code"]},skipStartupTypeset:!0};return{id:"mathjax2",init:function(n){t=n;let a=t.getConfig().mathjax2||t.getConfig().math||{},i={...e,...a},s=(i.mathjax||"https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js")+"?config="+(i.config||"TeX-AMS_HTML-full");i.tex2jax={...e.tex2jax,...a.tex2jax},i.mathjax=i.config=null,function(t,e){let n=document.querySelector("head"),a=document.createElement("script");a.type="text/javascript",a.src=t;let i=()=>{"function"==typeof e&&(e.call(),e=null)};a.onload=i,a.onreadystatechange=()=>{"loaded"===this.readyState&&i()},n.appendChild(a)}(s,(function(){MathJax.Hub.Config(i),MathJax.Hub.Queue(["Typeset",MathJax.Hub,t.getRevealElement()]),MathJax.Hub.Queue(t.layout),t.on("slidechanged",(function(t){MathJax.Hub.Queue(["Typeset",MathJax.Hub,t.currentSlide])}))}))}}},e=t;return Plugin=Object.assign(e(),{KaTeX:()=>{let t,e={version:"latest",delimiters:[{left:"$$",right:"$$",display:!0},{left:"$",right:"$",display:!1},{left:"\\(",right:"\\)",display:!1},{left:"\\[",right:"\\]",display:!0}],ignoredTags:["script","noscript","style","textarea","pre","code"]};const n=t=>new Promise(((e,n)=>{const a=document.createElement("script");a.type="text/javascript",a.onload=e,a.onerror=n,a.src=t,document.head.append(a)}));return{id:"katex",init:function(a){t=a;let i=t.getConfig().katex||{},s={...e,...i};const{local:o,version:l,extensions:c,...r}=s;let d=s.local||"https://cdn.jsdelivr.net/npm/katex",u=s.local?"":"@"+s.version,p=d+u+"/dist/katex.min.css",h=d+u+"/dist/contrib/mhchem.min.js",x=d+u+"/dist/contrib/auto-render.min.js",m=[d+u+"/dist/katex.min.js"];s.extensions&&s.extensions.includes("mhchem")&&m.push(h),m.push(x);const f=()=>{renderMathInElement(a.getSlidesElement(),r),t.layout()};(t=>{let e=document.createElement("link");e.rel="stylesheet",e.href=t,document.head.appendChild(e)})(p),async function(t){for(const e of t)await n(e)}(m).then((()=>{t.isReady()?f():t.on("ready",f.bind(this))}))}}},MathJax2:t,MathJax3:()=>{let t,e={tex:{inlineMath:[["$","$"],["\\(","\\)"]]},options:{skipHtmlTags:["script","noscript","style","textarea","pre","code"]},startup:{ready:()=>{MathJax.startup.defaultReady(),MathJax.startup.promise.then((()=>{t.layout()}))}}};return{id:"mathjax3",init:function(n){t=n;let a=t.getConfig().mathjax3||{},i={...e,...a};i.tex={...e.tex,...a.tex},i.options={...e.options,...a.options},i.startup={...e.startup,...a.startup};let s=i.mathjax||"https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js";i.mathjax=null,window.MathJax=i,function(t,e){let n=document.createElement("script");n.type="text/javascript",n.id="MathJax-script",n.src=t,n.async=!0,n.onload=()=>{"function"==typeof e&&(e.call(),e=null)},document.head.appendChild(n)}(s,(function(){t.addEventListener("slidechanged",(function(t){MathJax.typeset()}))}))}}}})}));
|
||||
81
scripts/reveal.js/plugin/math/mathjax4.js
Normal file
81
scripts/reveal.js/plugin/math/mathjax4.js
Normal file
@@ -0,0 +1,81 @@
|
||||
/**
|
||||
* A plugin which enables rendering of math equations inside
|
||||
* of reveal.js slides. Essentially a thin wrapper for MathJax 4
|
||||
*
|
||||
* @author Hakim El Hattab
|
||||
* @author Gerhard Burger
|
||||
* @author Khris Griffis, Ph.D.
|
||||
*/
|
||||
export const MathJax4 = () => {
|
||||
|
||||
// The reveal.js instance this plugin is attached to
|
||||
let deck;
|
||||
|
||||
let defaultOptions = {
|
||||
tex: {
|
||||
inlineMath: [ [ '$', '$' ], [ '\\(', '\\)' ] ]
|
||||
},
|
||||
options: {
|
||||
skipHtmlTags: [ 'script', 'noscript', 'style', 'textarea', 'pre', 'code' ]
|
||||
},
|
||||
startup: {
|
||||
ready: () => {
|
||||
MathJax.startup.defaultReady();
|
||||
MathJax.startup.promise.then(() => {
|
||||
deck.layout();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function loadScript( url, callback ) {
|
||||
|
||||
let script = document.createElement( 'script' );
|
||||
script.type = 'text/javascript';
|
||||
script.id = 'MathJax-script';
|
||||
script.src = url;
|
||||
script.async = true;
|
||||
|
||||
// Wrapper for callback to make sure it only fires once
|
||||
script.onload = () => {
|
||||
if (typeof callback === 'function') {
|
||||
callback.call();
|
||||
callback = null;
|
||||
}
|
||||
};
|
||||
|
||||
document.head.appendChild( script );
|
||||
}
|
||||
|
||||
return {
|
||||
id: 'mathjax4',
|
||||
init: function(reveal) {
|
||||
|
||||
deck = reveal;
|
||||
|
||||
let revealOptions = deck.getConfig().mathjax4 || {};
|
||||
let options = { ...defaultOptions, ...revealOptions };
|
||||
options.tex = { ...defaultOptions.tex, ...revealOptions.tex };
|
||||
options.options = { ...defaultOptions.options, ...revealOptions.options };
|
||||
options.startup = { ...defaultOptions.startup, ...revealOptions.startup };
|
||||
|
||||
let url = options.mathjax || 'https://cdn.jsdelivr.net/npm/mathjax@4/tex-mml-chtml.js';
|
||||
options.mathjax = null;
|
||||
|
||||
window.MathJax = options;
|
||||
|
||||
loadScript(url, function() {
|
||||
// MathJax 4.0.0 uses async startup, so we need to wait for it to be ready
|
||||
MathJax.startup.promise.then(() => {
|
||||
// Initial typeset after startup
|
||||
MathJax.typeset();
|
||||
|
||||
// Reprocess equations in slides when they turn visible
|
||||
deck.addEventListener('slidechanged', function(event) {
|
||||
MathJax.typeset();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -1,15 +1,17 @@
|
||||
import {KaTeX} from "./katex";
|
||||
import {MathJax2} from "./mathjax2";
|
||||
import {MathJax3} from "./mathjax3";
|
||||
import {MathJax4} from "./mathjax4";
|
||||
|
||||
const defaultTypesetter = MathJax2;
|
||||
|
||||
/*!
|
||||
* This plugin is a wrapper for the MathJax2,
|
||||
* MathJax3 and KaTeX typesetter plugins.
|
||||
* MathJax3, MathJax4 and KaTeX typesetter plugins.
|
||||
*/
|
||||
export default Plugin = Object.assign( defaultTypesetter(), {
|
||||
KaTeX,
|
||||
MathJax2,
|
||||
MathJax3
|
||||
MathJax3,
|
||||
MathJax4
|
||||
} );
|
||||
23
scripts/reveal.js/plugin/math/vite.config.ts
Normal file
23
scripts/reveal.js/plugin/math/vite.config.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { resolve } from 'path';
|
||||
import { defineConfig } from 'vite';
|
||||
import { appendExtension } from '../../vite.config.ts';
|
||||
import { createPluginDts } from '../vite-plugin-dts.ts';
|
||||
|
||||
// Once Vite supports multiple entries for plugins, this build can
|
||||
// be merged into the main vite.config.ts.
|
||||
// See https://github.com/vitejs/vite/pull/10609
|
||||
|
||||
export default defineConfig({
|
||||
build: {
|
||||
emptyOutDir: false,
|
||||
lib: {
|
||||
formats: ['es', 'umd'],
|
||||
entry: {
|
||||
'plugin/math': resolve(__dirname, 'index.ts'),
|
||||
},
|
||||
name: 'RevealMath',
|
||||
fileName: appendExtension,
|
||||
},
|
||||
},
|
||||
plugins: [createPluginDts('math')],
|
||||
});
|
||||
13
scripts/reveal.js/plugin/notes/index.ts
Normal file
13
scripts/reveal.js/plugin/notes/index.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import type { RevealPlugin } from 'reveal.js';
|
||||
|
||||
// @ts-expect-error The runtime implementation remains in JS during the migration.
|
||||
import NotesImplementation from './plugin.js';
|
||||
|
||||
export interface NotesPlugin extends RevealPlugin {
|
||||
id: 'notes';
|
||||
open(): void;
|
||||
}
|
||||
|
||||
const Notes = NotesImplementation as () => NotesPlugin;
|
||||
|
||||
export default Notes;
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
|
||||
import speakerViewHTML from './speaker-view.html'
|
||||
import speakerViewHTML from './speaker-view.html?raw'
|
||||
|
||||
import { marked } from 'marked';
|
||||
|
||||
|
||||
@@ -494,7 +494,7 @@
|
||||
notes.classList.remove( 'hidden' );
|
||||
notesValue.style.whiteSpace = data.whitespace;
|
||||
if( data.markdown ) {
|
||||
notesValue.innerHTML = marked( data.notes );
|
||||
notesValue.innerHTML = marked.parse( data.notes );
|
||||
}
|
||||
else {
|
||||
notesValue.innerHTML = data.notes;
|
||||
|
||||
23
scripts/reveal.js/plugin/notes/vite.config.ts
Normal file
23
scripts/reveal.js/plugin/notes/vite.config.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { resolve } from 'path';
|
||||
import { defineConfig } from 'vite'
|
||||
import { appendExtension } from '../../vite.config.ts';
|
||||
import { createPluginDts } from '../vite-plugin-dts.ts';
|
||||
|
||||
// Once Vite supports multiple entries for plugins, this build can
|
||||
// be merged into the main vite.config.ts.
|
||||
// See https://github.com/vitejs/vite/pull/10609
|
||||
|
||||
export default defineConfig({
|
||||
build: {
|
||||
emptyOutDir: false,
|
||||
lib: {
|
||||
formats: ['es', 'umd'],
|
||||
entry: {
|
||||
'plugin/notes': resolve(__dirname, 'index.ts'),
|
||||
},
|
||||
name: 'RevealNotes',
|
||||
fileName: appendExtension
|
||||
}
|
||||
},
|
||||
plugins: [createPluginDts('notes')],
|
||||
})
|
||||
15
scripts/reveal.js/plugin/search/index.ts
Normal file
15
scripts/reveal.js/plugin/search/index.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import type { RevealPlugin } from 'reveal.js';
|
||||
|
||||
// @ts-expect-error The runtime implementation remains in JS during the migration.
|
||||
import SearchImplementation from './plugin.js';
|
||||
|
||||
export interface SearchPlugin extends RevealPlugin {
|
||||
id: 'search';
|
||||
open(): void;
|
||||
close(): void;
|
||||
toggle(): void;
|
||||
}
|
||||
|
||||
const Search = SearchImplementation as () => SearchPlugin;
|
||||
|
||||
export default Search;
|
||||
@@ -1,7 +0,0 @@
|
||||
/*!
|
||||
* Handles finding a text string anywhere in the slides and showing the next occurrence to the user
|
||||
* by navigatating to that slide and highlighting it.
|
||||
*
|
||||
* @author Jon Snyder <snyder.jon@gmail.com>, February 2013
|
||||
*/
|
||||
const e=()=>{let e,t,n,l,o,i,r;function s(){t=document.createElement("div"),t.classList.add("searchbox"),t.style.position="absolute",t.style.top="10px",t.style.right="10px",t.style.zIndex=10,t.innerHTML='<input type="search" class="searchinput" placeholder="Search..." style="vertical-align: top;"/>\n\t\t</span>',n=t.querySelector(".searchinput"),n.style.width="240px",n.style.fontSize="14px",n.style.padding="4px 6px",n.style.color="#000",n.style.background="#fff",n.style.borderRadius="2px",n.style.border="0",n.style.outline="0",n.style.boxShadow="0 2px 18px rgba(0, 0, 0, 0.2)",n.style["-webkit-appearance"]="none",e.getRevealElement().appendChild(t),n.addEventListener("keyup",(function(t){if(13===t.keyCode)t.preventDefault(),function(){if(i){var t=n.value;""===t?(r&&r.remove(),l=null):(r=new p("slidecontent"),l=r.apply(t),o=0)}l&&(l.length&&l.length<=o&&(o=0),l.length>o&&(e.slide(l[o].h,l[o].v),o++))}(),i=!1;else i=!0}),!1),d()}function a(){t||s(),t.style.display="inline",n.focus(),n.select()}function d(){t||s(),t.style.display="none",r&&r.remove()}function c(){t||s(),"inline"!==t.style.display?a():d()}function p(t,n){var l=document.getElementById(t)||document.body,o=n||"EM",i=new RegExp("^(?:"+o+"|SCRIPT|FORM)$"),r=["#ff6","#a0ffff","#9f9","#f99","#f6f"],s=[],a=0,d="",c=[];this.setRegex=function(e){e=e.trim(),d=new RegExp("("+e+")","i")},this.getRegex=function(){return d.toString().replace(/^\/\\b\(|\)\\b\/i$/g,"").replace(/\|/g," ")},this.hiliteWords=function(t){if(null!=t&&t&&d&&!i.test(t.nodeName)){if(t.hasChildNodes())for(var n=0;n<t.childNodes.length;n++)this.hiliteWords(t.childNodes[n]);var l,p;if(3==t.nodeType)if((l=t.nodeValue)&&(p=d.exec(l))){for(var u=t;null!=u&&"SECTION"!=u.nodeName;)u=u.parentNode;var f=e.getIndices(u),h=c.length,y=!1;for(n=0;n<h;n++)c[n].h===f.h&&c[n].v===f.v&&(y=!0);y||c.push(f),s[p[0].toLowerCase()]||(s[p[0].toLowerCase()]=r[a++%r.length]);var g=document.createElement(o);g.appendChild(document.createTextNode(p[0])),g.style.backgroundColor=s[p[0].toLowerCase()],g.style.fontStyle="inherit",g.style.color="#000";var v=t.splitText(p.index);v.nodeValue=v.nodeValue.substring(p[0].length),t.parentNode.insertBefore(g,v)}}},this.remove=function(){for(var e,t=document.getElementsByTagName(o);t.length&&(e=t[0]);)e.parentNode.replaceChild(e.firstChild,e)},this.apply=function(e){if(null!=e&&e)return this.remove(),this.setRegex(e),this.hiliteWords(l),c}}return{id:"search",init:t=>{e=t,e.registerKeyboardShortcut("CTRL + Shift + F","Search"),document.addEventListener("keydown",(function(e){"F"==e.key&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),c())}),!1)},open:a,close:d,toggle:c}};export{e as default};
|
||||
@@ -1,7 +0,0 @@
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).RevealSearch=t()}(this,(function(){"use strict";
|
||||
/*!
|
||||
* Handles finding a text string anywhere in the slides and showing the next occurrence to the user
|
||||
* by navigatating to that slide and highlighting it.
|
||||
*
|
||||
* @author Jon Snyder <snyder.jon@gmail.com>, February 2013
|
||||
*/return()=>{let e,t,n,o,i,l,s;function r(){t=document.createElement("div"),t.classList.add("searchbox"),t.style.position="absolute",t.style.top="10px",t.style.right="10px",t.style.zIndex=10,t.innerHTML='<input type="search" class="searchinput" placeholder="Search..." style="vertical-align: top;"/>\n\t\t</span>',n=t.querySelector(".searchinput"),n.style.width="240px",n.style.fontSize="14px",n.style.padding="4px 6px",n.style.color="#000",n.style.background="#fff",n.style.borderRadius="2px",n.style.border="0",n.style.outline="0",n.style.boxShadow="0 2px 18px rgba(0, 0, 0, 0.2)",n.style["-webkit-appearance"]="none",e.getRevealElement().appendChild(t),n.addEventListener("keyup",(function(t){if(13===t.keyCode)t.preventDefault(),function(){if(l){var t=n.value;""===t?(s&&s.remove(),o=null):(s=new f("slidecontent"),o=s.apply(t),i=0)}o&&(o.length&&o.length<=i&&(i=0),o.length>i&&(e.slide(o[i].h,o[i].v),i++))}(),l=!1;else l=!0}),!1),d()}function a(){t||r(),t.style.display="inline",n.focus(),n.select()}function d(){t||r(),t.style.display="none",s&&s.remove()}function c(){t||r(),"inline"!==t.style.display?a():d()}function f(t,n){var o=document.getElementById(t)||document.body,i=n||"EM",l=new RegExp("^(?:"+i+"|SCRIPT|FORM)$"),s=["#ff6","#a0ffff","#9f9","#f99","#f6f"],r=[],a=0,d="",c=[];this.setRegex=function(e){e=e.trim(),d=new RegExp("("+e+")","i")},this.getRegex=function(){return d.toString().replace(/^\/\\b\(|\)\\b\/i$/g,"").replace(/\|/g," ")},this.hiliteWords=function(t){if(null!=t&&t&&d&&!l.test(t.nodeName)){if(t.hasChildNodes())for(var n=0;n<t.childNodes.length;n++)this.hiliteWords(t.childNodes[n]);var o,f;if(3==t.nodeType)if((o=t.nodeValue)&&(f=d.exec(o))){for(var u=t;null!=u&&"SECTION"!=u.nodeName;)u=u.parentNode;var p=e.getIndices(u),h=c.length,y=!1;for(n=0;n<h;n++)c[n].h===p.h&&c[n].v===p.v&&(y=!0);y||c.push(p),r[f[0].toLowerCase()]||(r[f[0].toLowerCase()]=s[a++%s.length]);var g=document.createElement(i);g.appendChild(document.createTextNode(f[0])),g.style.backgroundColor=r[f[0].toLowerCase()],g.style.fontStyle="inherit",g.style.color="#000";var v=t.splitText(f.index);v.nodeValue=v.nodeValue.substring(f[0].length),t.parentNode.insertBefore(g,v)}}},this.remove=function(){for(var e,t=document.getElementsByTagName(i);t.length&&(e=t[0]);)e.parentNode.replaceChild(e.firstChild,e)},this.apply=function(e){if(null!=e&&e)return this.remove(),this.setRegex(e),this.hiliteWords(o),c}}return{id:"search",init:t=>{e=t,e.registerKeyboardShortcut("CTRL + Shift + F","Search"),document.addEventListener("keydown",(function(e){"F"==e.key&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),c())}),!1)},open:a,close:d,toggle:c}}}));
|
||||
23
scripts/reveal.js/plugin/search/vite.config.ts
Normal file
23
scripts/reveal.js/plugin/search/vite.config.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { resolve } from 'path';
|
||||
import { defineConfig } from 'vite'
|
||||
import { appendExtension } from '../../vite.config.ts';
|
||||
import { createPluginDts } from '../vite-plugin-dts.ts';
|
||||
|
||||
// Once Vite supports multiple entries for plugins, this build can
|
||||
// be merged into the main vite.config.ts.
|
||||
// See https://github.com/vitejs/vite/pull/10609
|
||||
|
||||
export default defineConfig({
|
||||
build: {
|
||||
emptyOutDir: false,
|
||||
lib: {
|
||||
formats: ['es', 'umd'],
|
||||
entry: {
|
||||
'plugin/search': resolve(__dirname, 'index.ts'),
|
||||
},
|
||||
name: 'RevealSearch',
|
||||
fileName: appendExtension
|
||||
}
|
||||
},
|
||||
plugins: [createPluginDts('search')],
|
||||
})
|
||||
23
scripts/reveal.js/plugin/vite-plugin-dts.ts
Normal file
23
scripts/reveal.js/plugin/vite-plugin-dts.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { resolve } from 'node:path';
|
||||
import dts from 'vite-plugin-dts';
|
||||
|
||||
export function createPluginDts(pluginName: string) {
|
||||
return dts({
|
||||
include: [`plugin/${pluginName}/index.ts`],
|
||||
entryRoot: 'plugin',
|
||||
outDir: 'dist/plugin',
|
||||
beforeWriteFile(filePath, content) {
|
||||
const normalizedPath = filePath.replace(/\\/g, '/');
|
||||
const generatedPathSuffix = `/dist/plugin/${pluginName}/index.d.ts`;
|
||||
|
||||
if (!normalizedPath.endsWith(generatedPathSuffix)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return {
|
||||
filePath: resolve(process.cwd(), 'dist/plugin', `${pluginName}.d.ts`),
|
||||
content,
|
||||
};
|
||||
},
|
||||
});
|
||||
}
|
||||
12
scripts/reveal.js/plugin/zoom/index.ts
Normal file
12
scripts/reveal.js/plugin/zoom/index.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import type { RevealPlugin } from 'reveal.js';
|
||||
|
||||
// @ts-expect-error The runtime implementation remains in JS during the migration.
|
||||
import ZoomImplementation from './plugin.js';
|
||||
|
||||
export interface ZoomPlugin extends RevealPlugin {
|
||||
id: 'zoom';
|
||||
}
|
||||
|
||||
const Zoom = ZoomImplementation as () => ZoomPlugin;
|
||||
|
||||
export default Zoom;
|
||||
23
scripts/reveal.js/plugin/zoom/vite.config.ts
Normal file
23
scripts/reveal.js/plugin/zoom/vite.config.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { resolve } from 'path';
|
||||
import { defineConfig } from 'vite'
|
||||
import { appendExtension } from '../../vite.config.ts';
|
||||
import { createPluginDts } from '../vite-plugin-dts.ts';
|
||||
|
||||
// Once Vite supports multiple entries for plugins, this build can
|
||||
// be merged into the main vite.config.ts.
|
||||
// See https://github.com/vitejs/vite/pull/10609
|
||||
|
||||
export default defineConfig({
|
||||
build: {
|
||||
emptyOutDir: false,
|
||||
lib: {
|
||||
formats: ['es', 'umd'],
|
||||
entry: {
|
||||
'plugin/zoom': resolve(__dirname, 'index.ts'),
|
||||
},
|
||||
name: 'RevealZoom',
|
||||
fileName: appendExtension
|
||||
}
|
||||
},
|
||||
plugins: [createPluginDts('zoom')],
|
||||
})
|
||||
@@ -1,11 +0,0 @@
|
||||
/*!
|
||||
* reveal.js Zoom plugin
|
||||
*/
|
||||
const e={id:"zoom",init:function(e){e.getRevealElement().addEventListener("mousedown",(function(t){var n=/Linux/.test(window.navigator.platform)?"ctrl":"alt",i=(e.getConfig().zoomKey?e.getConfig().zoomKey:n)+"Key",d=e.getConfig().zoomLevel?e.getConfig().zoomLevel:2;t[i]&&!e.isOverview()&&(t.preventDefault(),o.to({x:t.clientX,y:t.clientY,scale:d,pan:!1}))}))},destroy:()=>{o.reset()}};var t=()=>e,o=function(){var e=1,t=0,n=0,i=-1,d=-1,l="transform"in document.body.style;function s(t,o){var n=r();if(t.width=t.width||1,t.height=t.height||1,t.x-=(window.innerWidth-t.width*o)/2,t.y-=(window.innerHeight-t.height*o)/2,l)if(1===o)document.body.style.transform="";else{var i=n.x+"px "+n.y+"px",d="translate("+-t.x+"px,"+-t.y+"px) scale("+o+")";document.body.style.transformOrigin=i,document.body.style.transform=d}else 1===o?(document.body.style.position="",document.body.style.left="",document.body.style.top="",document.body.style.width="",document.body.style.height="",document.body.style.zoom=""):(document.body.style.position="relative",document.body.style.left=-(n.x+t.x)/o+"px",document.body.style.top=-(n.y+t.y)/o+"px",document.body.style.width=100*o+"%",document.body.style.height=100*o+"%",document.body.style.zoom=o);e=o,document.documentElement.classList&&(1!==e?document.documentElement.classList.add("zoomed"):document.documentElement.classList.remove("zoomed"))}function c(){var o=.12*window.innerWidth,i=.12*window.innerHeight,d=r();n<i?window.scroll(d.x,d.y-14/e*(1-n/i)):n>window.innerHeight-i&&window.scroll(d.x,d.y+(1-(window.innerHeight-n)/i)*(14/e)),t<o?window.scroll(d.x-14/e*(1-t/o),d.y):t>window.innerWidth-o&&window.scroll(d.x+(1-(window.innerWidth-t)/o)*(14/e),d.y)}function r(){return{x:void 0!==window.scrollX?window.scrollX:window.pageXOffset,y:void 0!==window.scrollY?window.scrollY:window.pageYOffset}}return l&&(document.body.style.transition="transform 0.8s ease"),document.addEventListener("keyup",(function(t){1!==e&&27===t.keyCode&&o.out()})),document.addEventListener("mousemove",(function(o){1!==e&&(t=o.clientX,n=o.clientY)})),{to:function(t){if(1!==e)o.out();else{if(t.x=t.x||0,t.y=t.y||0,t.element){var n=t.element.getBoundingClientRect();t.x=n.left-20,t.y=n.top-20,t.width=n.width+40,t.height=n.height+40}void 0!==t.width&&void 0!==t.height&&(t.scale=Math.max(Math.min(window.innerWidth/t.width,window.innerHeight/t.height),1)),t.scale>1&&(t.x*=t.scale,t.y*=t.scale,s(t,t.scale),!1!==t.pan&&(i=setTimeout((function(){d=setInterval(c,1e3/60)}),800)))}},out:function(){clearTimeout(i),clearInterval(d),s({x:0,y:0},1),e=1},magnify:function(e){this.to(e)},reset:function(){this.out()},zoomLevel:function(){return e}}}();
|
||||
/*!
|
||||
* zoom.js 0.3 (modified for use with reveal.js)
|
||||
* http://lab.hakim.se/zoom-js
|
||||
* MIT licensed
|
||||
*
|
||||
* Copyright (C) 2011-2014 Hakim El Hattab, http://hakim.se
|
||||
*/export{t as default};
|
||||
@@ -1,11 +0,0 @@
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).RevealZoom=t()}(this,(function(){"use strict";
|
||||
/*!
|
||||
* reveal.js Zoom plugin
|
||||
*/const e={id:"zoom",init:function(e){e.getRevealElement().addEventListener("mousedown",(function(o){var n=/Linux/.test(window.navigator.platform)?"ctrl":"alt",i=(e.getConfig().zoomKey?e.getConfig().zoomKey:n)+"Key",d=e.getConfig().zoomLevel?e.getConfig().zoomLevel:2;o[i]&&!e.isOverview()&&(o.preventDefault(),t.to({x:o.clientX,y:o.clientY,scale:d,pan:!1}))}))},destroy:()=>{t.reset()}};var t=function(){var e=1,o=0,n=0,i=-1,d=-1,l="transform"in document.body.style;function s(t,o){var n=r();if(t.width=t.width||1,t.height=t.height||1,t.x-=(window.innerWidth-t.width*o)/2,t.y-=(window.innerHeight-t.height*o)/2,l)if(1===o)document.body.style.transform="";else{var i=n.x+"px "+n.y+"px",d="translate("+-t.x+"px,"+-t.y+"px) scale("+o+")";document.body.style.transformOrigin=i,document.body.style.transform=d}else 1===o?(document.body.style.position="",document.body.style.left="",document.body.style.top="",document.body.style.width="",document.body.style.height="",document.body.style.zoom=""):(document.body.style.position="relative",document.body.style.left=-(n.x+t.x)/o+"px",document.body.style.top=-(n.y+t.y)/o+"px",document.body.style.width=100*o+"%",document.body.style.height=100*o+"%",document.body.style.zoom=o);e=o,document.documentElement.classList&&(1!==e?document.documentElement.classList.add("zoomed"):document.documentElement.classList.remove("zoomed"))}function c(){var t=.12*window.innerWidth,i=.12*window.innerHeight,d=r();n<i?window.scroll(d.x,d.y-14/e*(1-n/i)):n>window.innerHeight-i&&window.scroll(d.x,d.y+(1-(window.innerHeight-n)/i)*(14/e)),o<t?window.scroll(d.x-14/e*(1-o/t),d.y):o>window.innerWidth-t&&window.scroll(d.x+(1-(window.innerWidth-o)/t)*(14/e),d.y)}function r(){return{x:void 0!==window.scrollX?window.scrollX:window.pageXOffset,y:void 0!==window.scrollY?window.scrollY:window.pageYOffset}}return l&&(document.body.style.transition="transform 0.8s ease"),document.addEventListener("keyup",(function(o){1!==e&&27===o.keyCode&&t.out()})),document.addEventListener("mousemove",(function(t){1!==e&&(o=t.clientX,n=t.clientY)})),{to:function(o){if(1!==e)t.out();else{if(o.x=o.x||0,o.y=o.y||0,o.element){var n=o.element.getBoundingClientRect();o.x=n.left-20,o.y=n.top-20,o.width=n.width+40,o.height=n.height+40}void 0!==o.width&&void 0!==o.height&&(o.scale=Math.max(Math.min(window.innerWidth/o.width,window.innerHeight/o.height),1)),o.scale>1&&(o.x*=o.scale,o.y*=o.scale,s(o,o.scale),!1!==o.pan&&(i=setTimeout((function(){d=setInterval(c,1e3/60)}),800)))}},out:function(){clearTimeout(i),clearInterval(d),s({x:0,y:0},1),e=1},magnify:function(e){this.to(e)},reset:function(){this.out()},zoomLevel:function(){return e}}}();
|
||||
/*!
|
||||
* zoom.js 0.3 (modified for use with reveal.js)
|
||||
* http://lab.hakim.se/zoom-js
|
||||
* MIT licensed
|
||||
*
|
||||
* Copyright (C) 2011-2014 Hakim El Hattab, http://hakim.se
|
||||
*/return()=>e}));
|
||||
Reference in New Issue
Block a user