@korbiniankuhn/markdown-slides 0.0.11 → 1.0.0-alpha.2

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/README.md CHANGED
@@ -0,0 +1,143 @@
1
+ # MarkdownSlides
2
+
3
+ ## Requirements for local builds
4
+
5
+ If you want to build the slides locally, Node or Docker is required.
6
+
7
+ ### How to use it
8
+
9
+ Create one (README.md) or more markdown files in the root of your directory (e.g. a git repository) and start typing.
10
+
11
+ To start a new slide use a comment `<!-- slide -->`.
12
+
13
+ Example:
14
+
15
+ ```markdown
16
+ # Lecture Title
17
+
18
+ @module[123456]
19
+ @semester[Summer 2022]
20
+
21
+ Korbinian Kuhn [kuhnko@](mailto:kuhnko@hdm-stuttgart.de)
22
+
23
+ <!-- slide -->
24
+
25
+ ## Content
26
+
27
+ - What we will do
28
+ - What you will learn
29
+ ```
30
+
31
+ Build the slides with:
32
+
33
+ ```bash
34
+ sh master/build.sh
35
+ ```
36
+
37
+ <!-- slide -->
38
+
39
+ ## Example
40
+
41
+ <!-- slide -->
42
+
43
+ ## Features
44
+
45
+ - First slide will be styled differently to provide a pretty title slide
46
+ - Slide numbers will be generated automatically
47
+ - You get a fancy mobile menu as a table of contents and to jump to specific slides
48
+ - Every code snippet will be highlighted automatically with highlight.js (during build time)
49
+ - Use space and arrow keys to navigate
50
+ - Slides are fully response for mobile devices and small screens
51
+ - You can even choose the dark mode in the side-nav
52
+ - Slides have a modified CSS-Stylesheet for print to generate a PDF with the browser
53
+ - Supports multiple markdown files to split your presentation in subslides (README.md will always be the entrypoint)
54
+ - Date of the build will be included as a versioning on the first slide and the table of contents
55
+ - Automatically create equations with MathJax and diagrams with Mermaid
56
+
57
+ <!-- slide -->
58
+
59
+ ## Markdown extensions
60
+
61
+ <!-- slide -->
62
+
63
+ ### Slides
64
+
65
+ | Identifier | Description |
66
+ | ---------------- | ------------------ |
67
+ | `<!-- slide -->` | Starts a new slide |
68
+
69
+ ### Spacer
70
+
71
+ | Identifier | Description |
72
+ | ------------------ | --------------------------- |
73
+ | `:spacer` | Medium vertical spacer |
74
+ | `:spacer{size=sm}` | Small vertical spacer |
75
+ | `:spacer{size=md}` | Medium vertical spacer |
76
+ | `:spacer{size=lg}` | Large vertical spacer |
77
+ | `:spacer{size=xl}` | Extra-Large vertical spacer |
78
+
79
+ <!-- slide -->
80
+
81
+ ### Layout
82
+
83
+ | Identifier | Description |
84
+ | ------------------ | ---------------------- |
85
+ | `<!-- row -->` | Starts a row container |
86
+ | `<!-- row:end -->` | Ends a row container |
87
+ | `<!-- col -->` | Starts a col container |
88
+ | `<!-- col:end -->` | Ends a col container |
89
+
90
+ #### Example
91
+
92
+ ```markdown
93
+ <!-- row -->
94
+ <!-- col -->
95
+
96
+ Left
97
+
98
+ <!-- col:end -->
99
+ <!-- col -->
100
+
101
+ Right
102
+
103
+ <!-- col:end -->
104
+ <!-- row:end -->
105
+ ```
106
+
107
+ <!-- slide -->
108
+
109
+ ### MathJax
110
+
111
+ MathJax is supported.
112
+
113
+ Centered Math:
114
+
115
+ \\[ x = {-b \pm \sqrt{b^2-4ac} \over 2a} \\]
116
+
117
+ Inline Math:
118
+
119
+ \\( x = {-b \pm \sqrt{b^2-4ac} \over 2a} \\)
120
+
121
+ <!-- slide -->
122
+
123
+ ### PlantUML
124
+
125
+ PlantUML is supported. SVGs will be generated for light and dark mode during build time through the plantuml.com server.
126
+
127
+ <!-- :::plantuml
128
+ @startuml
129
+ Alice -> Bob: Hello
130
+ Bob -> Alice: Hi
131
+ @enduml
132
+ ::: -->
133
+
134
+ <!-- slide -->
135
+
136
+ ### MermaidJS
137
+
138
+ ```mermaid
139
+ sequenceDiagram
140
+ Alice->>John: Hello John, how are you?
141
+ John-->>Alice: Great!
142
+ Alice-)John: See you later!
143
+ ```
@@ -1 +1 @@
1
- :root{--color-bg: #f6f8fa;--color-bg-slide: #fff;--color-bg-code: #f6f8fa;--color-bg-backdrop: rgba(0, 0, 0, .3);--color-bg-presentation: #eee;--color-text: #222;--color-border: #eaedef;--color-primary: #e51433;--color-success: #14e564;--color-white: #fff;--color-black: #222;--color-grey: #888}body.dark{--color-bg: #000000;--color-bg-slide: #181818;--color-bg-code: #1f1f1f;--color-bg-backdrop: rgba(0, 0, 0, .3);--color-text: #f6f8fa;--color-border: #2b2b2b}body.dark{--color-bg: #000000;--color-bg-slide: #0e1117;--color-bg-code: #171b22;--color-bg-backdrop: rgba(0, 0, 0, .3);--color-text: #e6edf3;--color-border: #31363d}.text-primary{color:var(--color-primary)}.bg-primary{background-color:var(--color-primary)}.dark-only{display:none}body.dark .dark-only{display:block}body.dark .light-only{display:none}:fullscreen .nofullscreen{display:none}html{font-size:16px;box-sizing:border-box}body{font-family:HdM Frutiger Next Pro,sans-serif;font-size:1.5rem;line-height:1.5;font-weight:400;margin:0;padding:0;background-color:var(--color-bg);color:var(--color-text)}h1,h2,h3,h4,h5,h6{margin:1rem 0 .5rem}h1{font-size:3rem;font-weight:600;text-align:center}h2{color:var(--color-primary);font-size:3rem;font-weight:500}h3{color:var(--color-primary);font-size:2rem;font-weight:500}h4{font-size:1.75rem;font-weight:500}h5{font-size:1.5rem;font-weight:600}h6{font-size:1.5rem;font-weight:500}blockquote{border-left:5px solid var(--color-primary);margin:.5rem 0;padding:.25rem 1rem}a{color:var(--color-primary)}button{font-size:1rem;padding:.2rem .5rem;cursor:pointer;border-radius:3px;border:1px solid var(--color-border);background:var(--color-bg-code);color:var(--color-text)}button:hover{background:var(--color-border)}button.active{border-color:var(--color-primary)}ul{font-size:1.5rem;padding:0;margin:.5rem 2rem}p{font-size:1.5rem;margin:.5rem 0}b,strong{font-weight:500}.noscroll{overflow:hidden}.spacer{display:block}.spacer.sm{height:.75rem}.spacer.md{height:1.5rem}.spacer.lg{height:3rem}.spacer.xl{height:6rem}.main{position:absolute;inset:0;display:flex}.left{flex:1 1 auto}.right,.separator{display:none}.inner{position:relative;width:100%;height:100%;box-sizing:border-box}.presentation-parent .left{margin:1rem;margin-right:0}.presentation-parent .left .inner{border:1px solid var(--color-border);width:unset;height:unset;max-width:100%;max-height:100%}.presentation-parent .right{display:block;width:20%;min-width:200px;max-width:400px;margin:1rem;margin-left:0;border:1px solid var(--color-border)}.presentation-parent .separator{display:block;width:1rem;cursor:col-resize}.slides-container{top:var(--header-height);left:0;right:0;bottom:0;position:absolute;overflow-y:scroll;background:var(--color-bg)}.backdrop{position:absolute;inset:0;background:var(--color-bg-backdrop);backdrop-filter:blur(10px);z-index:-1;opacity:0;transition:opacity .5s;overflow:hidden;display:flex;flex-direction:column;align-items:flex-start}.backdrop.active{z-index:5;opacity:1}.menu{height:100vh;transform:translate(-100vw);box-sizing:border-box;transition:.5s;position:relative;background:var(--color-bg-slide);width:auto;min-width:250px;padding:0;display:flex;flex-direction:column;border-right:1px solid var(--color-border)}.backdrop.active .menu{transform:translate(0)}.menu-header{padding:1rem;padding-bottom:0;display:flex;flex-direction:column;font-weight:700;border-bottom:1px solid var(--color-border)}.menu-header a{text-decoration:none;font-size:1.25rem;margin-bottom:1rem;color:var(--color-text)}.menu-header a:hover{color:var(--color-primary)}.menu-footer{padding:1rem;display:flex;flex-direction:column;font-size:1rem;border-top:1px solid var(--color-border)}.menu-footer div{display:flex;margin-top:.5rem}.menu-footer div :first-child{flex:1}.menu-footer div button{margin-left:.5rem}.menu-content{overflow-y:scroll;flex:1;padding:1rem;padding-top:0}.menu ul{margin:.5rem 0;padding:0;list-style:none;font-size:1.25rem;font-weight:600}.menu ul li{margin:.25rem 0}.menu ul a{color:var(--color-text);text-decoration:none;cursor:pointer;display:flex;justify-content:space-between;align-items:center}.menu ul a span.slide-number{font-weight:400;color:var(--color-grey);font-size:1rem;margin-left:5px}.menu ul a:hover,.menu ul a:hover span.slide-number{color:var(--color-primary)}.menu ul ul{margin:0;font-size:1rem;font-weight:400}.menu ul ul li{margin:0}.menu ul ul ul{font-size:1rem;margin-left:1rem}section.slide{position:relative;box-sizing:border-box;background-color:var(--color-bg-slide);min-height:100%;display:flex;flex-direction:column;margin-bottom:2rem;padding-top:2rem;font-size:1.5rem}section.slide .content{box-sizing:border-box;padding:0 2rem;flex:1;width:100%;overflow-x:auto;display:flex;flex-direction:column;justify-content:center}section.slide:last-child{margin-bottom:0}section.slide:first-child .content{align-items:center}section.slide:first-child h1{margin:0}section.slide:first-child a.lecture-title{margin-bottom:1rem}section.slide:first-child img.logo{height:6rem}section.slide:first-child .university{text-transform:uppercase}img.default,video.default{display:block;max-width:100%;max-height:80vh;position:relative;margin-left:auto;margin-right:auto}img.default.broken,video.default.broken{border:1px solid var(--color-border);background:var(--color-code);color:var(--color-primary);padding:1rem}video.default{border:1px solid var(--color-border)}.video-print-placeholder{display:none}.row{display:flex;flex-direction:row;justify-content:space-between;margin-bottom:1rem}.column{width:100%;padding-right:1rem}.column:last-child{padding-right:0}.notes{display:none}.semester{display:inline-block;margin:1rem 0;font-size:2.5rem;line-height:2.5rem;padding:.7rem 1.25rem .2rem;background:var(--color-primary);color:var(--color-white);font-weight:500}.table-container{width:100%;overflow-x:auto}table{min-width:100%;border-collapse:collapse;font-size:1.25rem;margin:1rem 0}table code{font-size:1.25rem}table th{text-align:left;font-weight:600;background-color:var(--color-bg-code)}table td,table th{padding:.5rem;border:1px solid var(--color-border)}.toast-wrapper{position:fixed;bottom:2rem;width:100vw;display:flex;justify-content:center;z-index:10}.toast{padding:.5rem 1rem .25rem;background:var(--color-black);color:var(--color-white);max-width:90vw;box-sizing:border-box;border-radius:.2rem;font-size:1.25rem;box-shadow:0 3px 5px -1px #0003,0 6px 10px #00000024,0 1px 18px #0000001f;animation:toast-animation .5s}@keyframes toast-animation{0%{opacity:0;transform:scale(.75)}to{opacity:1;transform:scale(1)}}:root{--hljs-red: #d73a49;--hljs-purple: #6f42c1;--hljs-blue: #005cc5;--hljs-dark-blue: #032f62;--hljs-orange: #e36209;--hljs-grey: #6a737d;--hljs-green: #22863a;--hljs-dark: #24292e;--hljs-yellow: #735c0f;--hljs-red-2: #b31d28}body.dark{--hljs-red: #ff7b72;--hljs-purple: #d2a8ff;--hljs-blue: #79c0ff;--hljs-dark-blue: #a5d6ff;--hljs-orange: #ffa657;--hljs-grey: #8b949e;--hljs-green: #7ee787;--hljs-dark: #c9d1d9;--hljs-yellow: #aff5b4;--hljs-red-2: #ffdcd7}.code-wrapper{position:relative;margin:.75em 0}.code-wrapper button.copy{position:absolute;top:.5rem;right:.5rem;cursor:pointer;opacity:0;transition:opacity .2s}.code-wrapper:hover button.copy{opacity:1}code{font-family:Inconsolata,monospace;font-size:1.5rem;color:var(--color-text);background:var(--color-bg-code);padding:0 5px}pre{margin:0}pre code{font-size:1.25rem}pre code{display:block;overflow-x:auto;padding:1rem}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:var(--hljs-red)}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:var(--hljs-purple)}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable{color:var(--hljs-blue)}.hljs-meta .hljs-string,.hljs-regexp,.hljs-string{color:var(--hljs-dark-blue)}.hljs-built_in,.hljs-symbol{color:var(--hljs-orange)}.hljs-code,.hljs-comment,.hljs-formula{color:var(--hljs-grey)}.hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag{color:var(--hljs-green)}.hljs-subst{color:var(--hljs-dark)}.hljs-section{color:var(--hljs-blue);font-weight:700}.hljs-bullet{color:var(--hljs-gold)}.hljs-emphasis{color:var(--hljs-dark);font-style:italic}.hljs-strong{color:var(--hljs-dark);font-weight:700}.hljs-addition{color:var(--hljs-green);background-color:#f0fff4}.hljs-deletion{color:var(--hljs-red-2);background-color:#ffeef0}body{--header-height:calc(51px + 2rem)}.header{position:absolute;top:0;background:var(--color-bg-slide);box-sizing:border-box;width:100%;padding:1rem 2rem;display:flex;justify-content:space-between;font-size:1rem;z-index:3;border-bottom:1px solid var(--color-border)}.header img.logo{height:50px}.header-left{display:flex;align-items:center}.header-left a{cursor:pointer;color:var(--color-grey);display:flex;align-items:center}.header-left a span{margin-left:.5rem;transform:translateY(2px)}.footer{box-sizing:border-box;padding:1rem;display:flex;justify-content:space-between;color:var(--color-grey);font-size:1rem;position:sticky;bottom:0}@media (max-width:576px){html{font-size:14px}body{--header-height:calc(41px + 1rem);font-size:1rem}h1,h2{font-size:2rem}h3{font-size:1.5rem}h4{font-size:1.25rem}h5,h6,a,p,code,pre code,li,table,td,th,table code{font-size:1rem}.semester{font-size:1.5rem}.header{padding:.5rem 1rem}.header img.logo{height:40px}}.presentation-parent{background:var(--color-bg)}.presentation-parent .left{overflow:hidden}.presentation-parent .left .inner{transform-origin:top left;max-width:unset;max-height:unset}.presentation-parent .right .inner{background:var(--color-bg-slide);display:flex;flex-direction:column}.presentation-parent .right .controls{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap-reverse;border-bottom:1px solid var(--color-border);padding:0 1rem;height:var(--header-height);box-sizing:border-box}.presentation-parent .right .controls span.duration{font-weight:700;font-size:2rem;transform:translateY(.1rem)}.presentation-parent .right .controls button:first-child{margin-right:1rem}.presentation-parent .right .label{font-weight:700;font-size:1rem}.presentation-parent .right .preview{padding:1rem}.presentation-parent .right .preview .preview-container{cursor:pointer;border:1px solid var(--color-border)}.presentation-parent .right .preview .preview-container:hover{border-color:var(--color-primary)}.presentation-parent .right .preview .preview-content{font-size:.3rem;aspect-ratio:16/9;width:100%;overflow:hidden;pointer-events:none}.presentation-parent .right .preview .preview-content .nopreview{display:none}.presentation-parent .right .preview .preview-content .content{align-items:unset}.presentation-parent .right .preview-notes{flex:1 1 auto;margin:1rem}.presentation-parent .right .preview-notes .notes-content{overflow-y:scroll;font-size:.7rem}.presentation-parent .nopresentation,.presentation-child .nopresentation{display:none}@media print{@page{margin:1cm}.noprint{display:none!important}html{font-size:8pt}body{background-color:transparent}h1,h2{font-size:1.5rem;page-break-after:avoid}h2{page-break-before:always;page-break-after:avoid}h3{font-size:1.4rem;page-break-after:avoid}h4,h5,h6{font-size:1.1rem;page-break-after:avoid}code{font-size:1rem;page-break-inside:avoid}a[href^=http]:after{color:var(--color-text);font-size:1rem;text-decoration:none;content:" (" attr(href) ")"}table,table tr,table td,table th{page-break-inside:avoid}table tr td,table tr th{padding:.5rem}p:has(img){page-break-inside:avoid}img{page-break-inside:avoid}video{display:none!important}.video-print-placeholder{display:block;background:var(--color-bg);padding:2rem;box-sizing:border-box;text-align:center;border:1px solid var(--color-border)}.video-print-placeholder img{opacity:.5}.main{display:block}.right{display:none!important}.left{margin:0!important}.slides-container{position:relative;top:0;background:unset}.header{display:none}section.slide{min-height:unset;float:none!important;display:block;padding:0}section.slide.title-slide{min-height:100vh;page-break-after:always;display:flex}section.slide .footer{display:none}}
1
+ :root{--color-bg: #f6f8fa;--color-bg-slide: #fff;--color-bg-code: #f6f8fa;--color-bg-backdrop: rgba(0, 0, 0, .3);--color-text: #222;--color-border: #eaedef;--color-primary: #e31134;--color-white: #fff;--color-black: #222;--color-grey: #888}@media not print{body.dark{--color-bg: #000000;--color-bg-slide: #0e1117;--color-bg-code: #171b22;--color-text: #e6edf3;--color-border: #31363d}}@font-face{font-family:Roboto Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url("./roboto-latin-wght-normal-RPED2M7J.woff2") format("woff2-variations");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:Roboto Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url("./roboto-latin-ext-wght-normal-TTDZXF47.woff2") format("woff2-variations");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Inconsolata Variable;font-style:normal;font-display:swap;font-weight:200 900;src:url("./inconsolata-latin-wght-normal-CB2BBQHJ.woff2") format("woff2-variations");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:Inconsolata Variable;font-style:normal;font-display:swap;font-weight:200 900;src:url("./inconsolata-latin-ext-wght-normal-GEXWDHMS.woff2") format("woff2-variations");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}.text-primary{color:var(--color-primary)}.bg-primary{background-color:var(--color-primary)}.dark-only{display:none}body.dark .dark-only{display:block}body.dark .light-only{display:none}:fullscreen .nofullscreen{display:none}html{font-size:15px;box-sizing:border-box}body{font-family:Roboto Variable,sans-serif;font-size:1.5rem;line-height:1.75;font-weight:300;letter-spacing:.01rem;margin:0;padding:0;background-color:var(--color-bg);color:var(--color-text)}h1,h2,h3,h4,h5,h6{margin:1rem 0 .5rem}h1{font-size:3rem;font-weight:600;text-align:center}h2{color:var(--color-primary);font-size:3rem;font-weight:500}h3{color:var(--color-primary);font-size:2rem;font-weight:500}h4{font-size:1.75rem;font-weight:500}h5{font-size:1.5rem;font-weight:600}h6{font-size:1.5rem;font-weight:500}blockquote{border-left:5px solid var(--color-primary);margin:.5rem 0;padding:.25rem 1rem}a{color:var(--color-primary)}img{cursor:pointer}button{font-size:1rem;padding:.2rem .5rem;cursor:pointer;border-radius:3px;border:1px solid var(--color-border);background:var(--color-bg-code);color:var(--color-text)}button:hover{background:var(--color-border)}button.active{border-color:var(--color-primary)}ul{font-size:1.5rem;padding:0;margin:.5rem 2rem}p{font-size:1.5rem;margin:.5rem 0}b,strong{font-weight:500}.noscroll{overflow:hidden}.spacer{display:block}.spacer.sm{height:.75rem}.spacer.md{height:1.5rem}.spacer.lg{height:3rem}.spacer.xl{height:6rem}.slides-container{top:var(--header-height);left:0;right:0;bottom:0;position:absolute;overflow-y:scroll;background:var(--color-bg)}dialog{margin:0;padding:0;height:100vh;max-height:100vh;min-width:250px;max-width:100vw;box-sizing:border-box;z-index:5;pointer-events:auto;background:var(--color-bg-slide);color:var(--color-text);border:none;border-right:1px solid var(--color-border);box-shadow:-10px 0 20px #000;position:fixed;opacity:0;display:flex;flex-direction:column;font-size:1rem;overflow:hidden;transform:translate(-100%);transition:opacity .3s ease-in-out}dialog[open]{transform:translate(0);opacity:1}dialog:not([open]){pointer-events:none}dialog::backdrop{backdrop-filter:blur(5px);-webkit-backdrop-filter:blur(10px);background:var(--color-bg-backdrop)}dialog header{position:relative;padding:1rem;border-bottom:1px solid var(--color-border)}dialog header button{position:absolute;right:.25rem;top:.25rem;cursor:pointer;padding:.25rem;display:flex}dialog header a{text-decoration:none;font-size:1.25rem;margin-bottom:1rem;color:var(--color-text);font-weight:700}dialog header a:hover{color:var(--color-primary)}dialog article{flex:1;overflow-y:auto;padding:0 1rem}dialog article ul{margin:.5rem 0;padding:0;list-style:none;font-size:1.25rem;font-weight:600}dialog article ul li{margin:.25rem 0}dialog article ul a{color:var(--color-text);text-decoration:none;cursor:pointer;display:flex;justify-content:space-between;align-items:center}dialog article ul a span.slide-number{font-weight:400;color:var(--color-grey);font-size:1rem;margin-left:1rem}dialog article ul a:hover{color:var(--color-primary)}dialog article ul a:hover span.slide-number{color:var(--color-primary)}dialog article ul ul{margin:.25rem 0;font-size:1rem;font-weight:300}dialog article ul ul li{margin:0}dialog article ul ul ul{font-size:1rem;margin-left:1rem}dialog footer{border-top:1px solid var(--color-border);padding:1rem;display:flex;flex-direction:column;font-weight:300}dialog footer div{display:flex;margin-top:.5rem}dialog footer div :first-child{flex:1}dialog footer div button{margin-left:.5rem}@media (prefers-reduced-motion:no-preference){dialog{transition:opacity .3s ease-in-out,transform .3s ease-in-out}}section.slide{position:relative;box-sizing:border-box;background-color:var(--color-bg-slide);min-height:100%;display:flex;flex-direction:column;margin-bottom:2rem;padding-top:2rem;font-size:1.5rem}section.slide .content{box-sizing:border-box;padding:0 2rem;flex:1;width:100%;overflow-x:auto;display:flex;flex-direction:column;justify-content:center}section.slide:last-child{margin-bottom:0}section.slide:first-child .content{align-items:center}section.slide:first-child h1{margin:0}section.slide:first-child a.lecture-title{margin-bottom:1rem}section.slide:first-child img.logo{height:6rem}section.slide:first-child .university{text-transform:uppercase}img.default,video.default{display:block;max-width:100%;max-height:80vh;position:relative;margin-left:auto;margin-right:auto}img.default.broken,video.default.broken{border:1px solid var(--color-border);background:var(--color-code);color:var(--color-primary);padding:1rem}video.default{border:1px solid var(--color-border)}.video-print-placeholder{display:none}.row{display:flex;flex-direction:row;justify-content:space-between;margin-bottom:1rem}.column{width:100%;padding-right:1rem}.column:last-child{padding-right:0}.semester{display:inline-block;margin:1rem 0;font-size:2.5rem;line-height:2.5rem;padding:.5rem 1.25rem .3rem;background:var(--color-primary);color:var(--color-white);font-weight:500}.table-container{width:100%;overflow-x:auto}table{min-width:100%;border-collapse:collapse;font-size:1.25rem;margin:1rem 0}table code{font-size:1.25rem}table th{text-align:left;font-weight:600;background-color:var(--color-bg-code)}table td,table th{padding:.5rem;border:1px solid var(--color-border)}.toast-wrapper{position:fixed;bottom:2rem;width:100vw;display:flex;justify-content:center;z-index:10}.toast{padding:.5rem 1rem .25rem;background:var(--color-black);color:var(--color-white);max-width:90vw;box-sizing:border-box;border-radius:.2rem;font-size:1.25rem;box-shadow:0 3px 5px -1px #0003,0 6px 10px #00000024,0 1px 18px #0000001f;animation:toast-animation .5s}@keyframes toast-animation{0%{opacity:0;transform:scale(.75)}to{opacity:1;transform:scale(1)}}:root{--hljs-red: #d73a49;--hljs-purple: #6f42c1;--hljs-blue: #005cc5;--hljs-dark-blue: #032f62;--hljs-orange: #e36209;--hljs-grey: #6a737d;--hljs-green: #22863a;--hljs-dark: #24292e;--hljs-yellow: #735c0f;--hljs-red-2: #b31d28}body.dark{--hljs-red: #ff7b72;--hljs-purple: #d2a8ff;--hljs-blue: #79c0ff;--hljs-dark-blue: #a5d6ff;--hljs-orange: #ffa657;--hljs-grey: #8b949e;--hljs-green: #7ee787;--hljs-dark: #c9d1d9;--hljs-yellow: #aff5b4;--hljs-red-2: #ffdcd7}.code-wrapper{position:relative;margin:.75em 0}.code-wrapper button.copy{position:absolute;top:.5rem;right:.5rem;cursor:pointer;opacity:0;transition:opacity .2s}.code-wrapper:hover button.copy{opacity:1}code{font-family:Inconsolata Variable,monospace;font-size:1.25rem;font-weight:400;line-height:2rem;color:var(--color-text);background:var(--color-bg-code);padding:0 5px}pre{margin:0}pre code{display:block;overflow-x:auto;padding:1rem}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:var(--hljs-red)}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:var(--hljs-purple)}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable{color:var(--hljs-blue)}.hljs-meta .hljs-string,.hljs-regexp,.hljs-string{color:var(--hljs-dark-blue)}.hljs-built_in,.hljs-symbol{color:var(--hljs-orange)}.hljs-code,.hljs-comment,.hljs-formula{color:var(--hljs-grey)}.hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag{color:var(--hljs-green)}.hljs-subst{color:var(--hljs-dark)}.hljs-section{color:var(--hljs-blue);font-weight:700}.hljs-bullet{color:var(--hljs-gold)}.hljs-emphasis{color:var(--hljs-dark);font-style:italic}.hljs-strong{color:var(--hljs-dark);font-weight:700}.hljs-addition{color:var(--hljs-green);background-color:#f0fff4}.hljs-deletion{color:var(--hljs-red-2);background-color:#ffeef0}body{--header-height: calc(51px + 2rem) }.header{position:absolute;top:0;background:var(--color-bg-slide);box-sizing:border-box;width:100%;padding:1rem 2rem;display:flex;justify-content:space-between;font-size:1rem;z-index:3;border-bottom:1px solid var(--color-border)}.header img.logo{height:50px}.header-left{display:flex;align-items:center}.header-left button{cursor:pointer;color:var(--color-text);display:flex;align-items:center;background:none;border:none;font-size:1rem;padding:0;margin:0}.header-left button span{margin-left:.5rem}.footer{box-sizing:border-box;padding:1rem;display:flex;justify-content:space-between;color:var(--color-grey);font-size:1rem;position:sticky;bottom:0}@media (max-width:576px){html{font-size:14px}body{--header-height: calc(41px + 1rem) ;font-size:1rem}h1,h2{font-size:2rem}h3{font-size:1.5rem}h4{font-size:1.25rem}h5,h6,a,p,code,pre code,li,table,td,th,table code{font-size:1rem}.header{padding:.5rem 1rem}.header img.logo{height:40px}}@media print{@page{margin:1cm}.noprint{display:none!important}html{font-size:8pt}body{background-color:transparent}h1,h2{font-size:1.5rem;page-break-after:avoid}h2{page-break-before:always;page-break-after:avoid}h3{font-size:1.4rem;page-break-after:avoid}h4,h5,h6{font-size:1.1rem;page-break-after:avoid}code{font-size:1rem;page-break-inside:avoid}a[href^=http]:after{color:var(--color-text);font-size:1rem;text-decoration:none;content:" (" attr(href) ")"}table,table tr,table td,table th{page-break-inside:avoid}table tr td,table tr th{padding:.5rem}dialog{display:none}p:has(img){page-break-inside:avoid}img{page-break-inside:avoid}video{display:none!important}.video-print-placeholder{display:block;background:var(--color-bg);padding:2rem;box-sizing:border-box;text-align:center;border:1px solid var(--color-border)}.video-print-placeholder img{opacity:.5}.slides-container{position:relative;top:0;background:unset}.header{display:none}section.slide{min-height:unset;float:none!important;display:block;padding:0}section.slide.title-slide{min-height:100vh;page-break-after:always;display:flex}section.slide .footer{display:none}}
@@ -37,12 +37,8 @@
37
37
  break;
38
38
  }
39
39
  });
40
- this.container.addEventListener("scroll", (event) => this._onscroll(event));
41
- window.addEventListener("resize", (event) => this.resize());
42
40
  }
43
41
  container = document.querySelector(".slides-container");
44
- ignoreScrollEvent = false;
45
- timeout;
46
42
  goToSlide(index) {
47
43
  const slide = this.slides.getSlide(index);
48
44
  this.container.scrollTo(0, slide.offsetTop);
@@ -51,38 +47,19 @@
51
47
  const index = this.slides.getPreviousSlideIndex();
52
48
  if (index !== null) {
53
49
  this.goToSlide(index);
54
- this.app.relative?.goToSlide(index);
55
50
  }
56
51
  }
57
52
  nextSlide() {
58
53
  const index = this.slides.getNextSlideIndex();
59
54
  if (index !== null) {
60
55
  this.goToSlide(index);
61
- this.app.relative?.goToSlide(index);
62
56
  }
63
57
  }
64
- _onscroll(event) {
65
- if (this.ignoreScrollEvent) {
66
- return;
67
- }
68
- const scrollPosition = this.slides.getRelativeScrollPosition();
69
- this.app.relative?.scroll(scrollPosition);
70
- this.app.relative?.updatePreview();
71
- this.app.updatePreview();
72
- }
73
58
  scrollTo(position) {
74
- this.ignoreScrollEvent = true;
75
59
  this.container.scrollTo({
76
60
  top: this.container.scrollHeight * position,
77
61
  behavior: "instant"
78
62
  });
79
- if (this.timeout) {
80
- clearTimeout(this.timeout);
81
- delete this.timeout;
82
- }
83
- this.timeout = setTimeout(() => {
84
- this.ignoreScrollEvent = false;
85
- }, 100);
86
63
  }
87
64
  getScreenDimensions() {
88
65
  return {
@@ -90,86 +67,6 @@
90
67
  height: window.innerHeight
91
68
  };
92
69
  }
93
- resize() {
94
- this.app.resize();
95
- }
96
- };
97
-
98
- // packages/app/src/presentation.ts
99
- var Presentation = class {
100
- constructor(slides) {
101
- this.slides = slides;
102
- document.body.classList.add("presentation-parent");
103
- this.timerStopResume();
104
- this.updatePreview();
105
- }
106
- milliseconds = 0;
107
- intervalId;
108
- lastUpdatedAt = 0;
109
- buttonStopResume = document.querySelector(
110
- "#button-stop-resume"
111
- );
112
- durationRef = document.querySelector("#duration");
113
- timerStopResume() {
114
- if (this.intervalId) {
115
- clearInterval(this.intervalId);
116
- delete this.intervalId;
117
- this.buttonStopResume.innerHTML = "Resume";
118
- } else {
119
- this.lastUpdatedAt = Date.now();
120
- this.intervalId = setInterval(() => {
121
- const now = Date.now();
122
- const diff = now - this.lastUpdatedAt;
123
- this.lastUpdatedAt = now;
124
- this.milliseconds += diff;
125
- this._updateClock();
126
- }, 1e3);
127
- this.buttonStopResume.innerText = "Pause";
128
- }
129
- }
130
- timerReset() {
131
- this.lastUpdatedAt = 0;
132
- clearInterval(this.intervalId);
133
- delete this.intervalId;
134
- this.milliseconds = 0;
135
- this._updateClock();
136
- this.buttonStopResume.innerText = "Start";
137
- }
138
- stop() {
139
- document.body.classList.remove("presentation-parent");
140
- this.timerReset();
141
- }
142
- updatePreviewDimensions(dimensions) {
143
- const parentWidth = dimensions.width;
144
- const parentHeight = dimensions.height;
145
- const parentRatio = parentWidth / parentHeight;
146
- const selfWidth = document.querySelector(".left").clientWidth;
147
- const selfHeight = document.querySelector(".left").clientHeight;
148
- const selfRatio = selfWidth / selfHeight;
149
- let scaleFactor;
150
- if (selfRatio > parentRatio) {
151
- scaleFactor = selfHeight / parentHeight;
152
- } else {
153
- scaleFactor = selfWidth / parentWidth;
154
- }
155
- document.querySelector(".preview-content").style["aspect-ratio"] = parentRatio;
156
- const inner = document.querySelector(".left .inner");
157
- inner.style["width"] = `${parentWidth}px`;
158
- inner.style["height"] = `${parentHeight}px`;
159
- inner.style["transform"] = `scale(${scaleFactor})`;
160
- }
161
- _updateClock() {
162
- this.durationRef.innerText = new Date(this.milliseconds).toISOString().slice(11, 19);
163
- }
164
- updatePreview() {
165
- const nextSlideIndex = this.slides.getNextSlideIndex();
166
- if (nextSlideIndex !== null) {
167
- const slide = this.slides.getSlide(nextSlideIndex);
168
- document.querySelector("#next").innerHTML = slide.outerHTML;
169
- } else {
170
- document.querySelector("#next").innerHTML = "";
171
- }
172
- }
173
70
  };
174
71
 
175
72
  // packages/app/src/slides.ts
@@ -249,41 +146,18 @@
249
146
  // packages/app/src/app.ts
250
147
  var App = class {
251
148
  type = "slides";
252
- parent;
253
- child;
254
149
  slides = new Slides();
255
150
  theme = new Theme();
256
151
  clipboard = new Clipboard();
257
152
  interaction = new Interaction(this, this.slides);
258
- presentation;
259
- get relative() {
260
- return this.parent?.window.app || this.child?.window.app;
261
- }
153
+ menu = document.querySelector("#menu");
262
154
  constructor() {
263
- if (window.opener?.app?.type === "slides") {
264
- this.parent = window.opener;
265
- }
266
- if (this.parent) {
267
- this.presentation = new Presentation(this.slides);
268
- this.presentation.updatePreviewDimensions(
269
- this.relative.getScreenDimensions()
270
- );
271
- window.addEventListener(
272
- "beforeunload",
273
- () => this.relative?.stopPresentation()
274
- );
275
- }
276
- }
277
- startPresentation() {
278
- document.body.classList.add("presentation-child");
279
- this.child = window.open(location.href, "_blank", {
280
- opener: window
155
+ this.menu.addEventListener("click", (event) => {
156
+ if (event.target === this.menu) {
157
+ this.closeMenu();
158
+ }
281
159
  });
282
160
  }
283
- stopPresentation() {
284
- document.body.classList.remove("presentation-child");
285
- this.child = null;
286
- }
287
161
  print() {
288
162
  window.print();
289
163
  }
@@ -294,14 +168,19 @@
294
168
  this.theme.updateSetting(value);
295
169
  }
296
170
  openMenu() {
297
- document.querySelector(".backdrop")?.classList.add("active");
298
- document.body.classList.add("noscroll");
171
+ if (!this.menu.open) {
172
+ console.log("open menu");
173
+ this.menu.showModal();
174
+ }
299
175
  }
300
176
  closeMenu() {
301
- document.querySelector(".backdrop")?.classList.remove("active");
302
- document.body.classList.remove("noscroll");
177
+ if (this.menu.open) {
178
+ console.log("close menu");
179
+ this.menu.close();
180
+ }
303
181
  }
304
182
  fullscreen() {
183
+ this.closeMenu();
305
184
  document.body.requestFullscreen();
306
185
  }
307
186
  previousSlide() {
@@ -316,34 +195,8 @@
316
195
  scroll(position) {
317
196
  this.interaction.scrollTo(position);
318
197
  }
319
- timerStopResume() {
320
- this.presentation?.timerStopResume();
321
- }
322
- timerReset() {
323
- this.presentation?.timerReset();
324
- }
325
- dragSeparator(event) {
326
- console.log(event);
327
- }
328
- updatePreview() {
329
- this.presentation?.updatePreview();
330
- }
331
- updatePreviewDimensions(dimensions) {
332
- this.presentation?.updatePreviewDimensions(dimensions);
333
- }
334
- getScreenDimensions() {
335
- return this.interaction.getScreenDimensions();
336
- }
337
- resize() {
338
- if (this.presentation) {
339
- this.presentation.updatePreviewDimensions(
340
- this.relative.interaction.getScreenDimensions()
341
- );
342
- } else if (this.child) {
343
- this.child.app.updatePreviewDimensions(
344
- this.interaction.getScreenDimensions()
345
- );
346
- }
198
+ onClickImage(image) {
199
+ console.log(image);
347
200
  }
348
201
  };
349
202
 
@@ -355,12 +208,9 @@
355
208
  window.onClickSetTheme = (theme) => window.app.setTheme(theme);
356
209
  window.onClickNextSlide = () => window.app.nextSlide();
357
210
  window.onClickPreviousSlide = () => window.app.previousSlide();
358
- window.onClickStartPresentation = () => window.app.startPresentation();
359
211
  window.onClickFullscreen = () => window.app.fullscreen();
360
212
  window.onClickCopyToClipboard = (id) => window.app.copyToClipboard(id);
361
213
  window.onClickPrint = () => window.app.print();
362
- window.onClickTimerStopResume = () => window.app.timerStopResume();
363
- window.onClickTimerReset = () => window.app.timerReset();
364
- window.onDragSeparator = (event) => window.app.dragSeparator(event);
214
+ window.onClickImage = (image) => window.app.onClickImage(image);
365
215
  });
366
216
  })();