@harshil1712/slidev-addon-protected-presenter 0.0.1
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 +11 -0
- package/components/Auth.vue +62 -0
- package/global.vue +3 -0
- package/package.json +28 -0
- package/pages/imported-slides.md +27 -0
- package/slides.md +640 -0
- package/snippets/external.ts +12 -0
package/README.md
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# Welcome to [Slidev](https://github.com/slidevjs/slidev)!
|
2
|
+
|
3
|
+
To start the slide show:
|
4
|
+
|
5
|
+
- `pnpm install`
|
6
|
+
- `pnpm dev`
|
7
|
+
- visit <http://localhost:3030>
|
8
|
+
|
9
|
+
Edit the [slides.md](./slides.md) to see the changes.
|
10
|
+
|
11
|
+
Learn more about Slidev at the [documentation](https://sli.dev/).
|
@@ -0,0 +1,62 @@
|
|
1
|
+
<script setup lang="ts">
|
2
|
+
import { onMounted } from "vue";
|
3
|
+
|
4
|
+
import { useNav, configs } from "@slidev/client";
|
5
|
+
|
6
|
+
const { isPresenter, router, currentPath, currentSlideNo } = useNav();
|
7
|
+
|
8
|
+
const props = defineProps({
|
9
|
+
passwordUrl: {
|
10
|
+
type: String,
|
11
|
+
default: "/auth" || configs.auth.passwordUrl,
|
12
|
+
},
|
13
|
+
staticPassword: {
|
14
|
+
type: String,
|
15
|
+
default: configs.auth.password || "your-super-strong-static-password",
|
16
|
+
},
|
17
|
+
// Message to show when prompting for password
|
18
|
+
promptMessage: {
|
19
|
+
type: String,
|
20
|
+
default: "Enter presenter password:",
|
21
|
+
},
|
22
|
+
});
|
23
|
+
|
24
|
+
let password = props.staticPassword;
|
25
|
+
|
26
|
+
onMounted(async () => {
|
27
|
+
// If a password URL is provided, fetch the password
|
28
|
+
if (props.passwordUrl) {
|
29
|
+
try {
|
30
|
+
const response = await fetch(props.passwordUrl);
|
31
|
+
if (response.ok) {
|
32
|
+
password = (await response.text()).trim();
|
33
|
+
console.log("Remote password loaded");
|
34
|
+
}
|
35
|
+
} catch (error) {
|
36
|
+
console.error("Failed to load remote password, using fallback", error);
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
const isAuthenticated = localStorage.getItem("slidev-presenter-auth");
|
41
|
+
|
42
|
+
if (isPresenter.value) {
|
43
|
+
if (isAuthenticated !== "true") {
|
44
|
+
const inputPassword = prompt(props.promptMessage);
|
45
|
+
|
46
|
+
if (!inputPassword) {
|
47
|
+
router.push("/" + currentSlideNo.value);
|
48
|
+
return;
|
49
|
+
}
|
50
|
+
|
51
|
+
if (inputPassword === password) {
|
52
|
+
localStorage.setItem("slidev-presenter-auth", "true");
|
53
|
+
} else {
|
54
|
+
alert("Incorrect password");
|
55
|
+
router.push("/" + currentSlideNo.value);
|
56
|
+
}
|
57
|
+
}
|
58
|
+
}
|
59
|
+
});
|
60
|
+
</script>
|
61
|
+
|
62
|
+
<template></template>
|
package/global.vue
ADDED
package/package.json
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
{
|
2
|
+
"name": "@harshil1712/slidev-addon-protected-presenter",
|
3
|
+
"description": "A simple Slidev addon to protect your slides from being advanced by the audience",
|
4
|
+
"version": "0.0.1",
|
5
|
+
"scripts": {
|
6
|
+
"build": "slidev build",
|
7
|
+
"dev": "slidev --open",
|
8
|
+
"export": "slidev export"
|
9
|
+
},
|
10
|
+
"keywords": [
|
11
|
+
"slidev",
|
12
|
+
"slidev-addon",
|
13
|
+
"presenter",
|
14
|
+
"protected"
|
15
|
+
],
|
16
|
+
"author": "Harshil Agrawal (harshil.dev)",
|
17
|
+
"license": "MIT",
|
18
|
+
"engines": {
|
19
|
+
"slidev": "^51.4.0"
|
20
|
+
},
|
21
|
+
"dependencies": {
|
22
|
+
"@slidev/theme-default": "latest",
|
23
|
+
"@slidev/theme-seriph": "latest"
|
24
|
+
},
|
25
|
+
"devDependencies": {
|
26
|
+
"@slidev/cli": "latest"
|
27
|
+
}
|
28
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# Imported Slides
|
2
|
+
|
3
|
+
You can split your slides.md into multiple files and organize them as you want using the `src` attribute.
|
4
|
+
|
5
|
+
#### `slides.md`
|
6
|
+
|
7
|
+
```markdown
|
8
|
+
# Page 1
|
9
|
+
|
10
|
+
Page 2 from main entry.
|
11
|
+
|
12
|
+
---
|
13
|
+
|
14
|
+
## src: ./subpage.md
|
15
|
+
```
|
16
|
+
|
17
|
+
<br>
|
18
|
+
|
19
|
+
#### `subpage.md`
|
20
|
+
|
21
|
+
```markdown
|
22
|
+
# Page 2
|
23
|
+
|
24
|
+
Page 2 from another file.
|
25
|
+
```
|
26
|
+
|
27
|
+
[Learn more](https://sli.dev/guide/syntax.html#importing-slides)
|
package/slides.md
ADDED
@@ -0,0 +1,640 @@
|
|
1
|
+
---
|
2
|
+
# You can also start simply with 'default'
|
3
|
+
theme: seriph
|
4
|
+
# random image from a curated Unsplash collection by Anthony
|
5
|
+
# like them? see https://unsplash.com/collections/94734566/slidev
|
6
|
+
background: https://cover.sli.dev
|
7
|
+
# some information about your slides (markdown enabled)
|
8
|
+
title: Welcome to Slidev
|
9
|
+
info: |
|
10
|
+
## Slidev Starter Template
|
11
|
+
Presentation slides for developers.
|
12
|
+
|
13
|
+
Learn more at [Sli.dev](https://sli.dev)
|
14
|
+
# apply unocss classes to the current slide
|
15
|
+
class: text-center
|
16
|
+
# https://sli.dev/features/drawing
|
17
|
+
drawings:
|
18
|
+
persist: false
|
19
|
+
# slide transition: https://sli.dev/guide/animations.html#slide-transitions
|
20
|
+
transition: slide-left
|
21
|
+
# enable MDC Syntax: https://sli.dev/features/mdc
|
22
|
+
mdc: true
|
23
|
+
# addons:
|
24
|
+
# - '@harshil1712/slidev-addon-protected-presenter'
|
25
|
+
# auth:
|
26
|
+
# password: 'your-super-strong-static-password'
|
27
|
+
---
|
28
|
+
|
29
|
+
# Welcome to Slidev
|
30
|
+
|
31
|
+
Presentation slides for developers
|
32
|
+
|
33
|
+
<div @click="$slidev.nav.next" class="mt-12 py-1" hover:bg="white op-10">
|
34
|
+
Press Space for next page <carbon:arrow-right />
|
35
|
+
</div>
|
36
|
+
|
37
|
+
<div class="abs-br m-6 text-xl">
|
38
|
+
<button @click="$slidev.nav.openInEditor" title="Open in Editor" class="slidev-icon-btn">
|
39
|
+
<carbon:edit />
|
40
|
+
</button>
|
41
|
+
<a href="https://github.com/slidevjs/slidev" target="_blank" class="slidev-icon-btn">
|
42
|
+
<carbon:logo-github />
|
43
|
+
</a>
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<!--
|
47
|
+
The last comment block of each slide will be treated as slide notes. It will be visible and editable in Presenter Mode along with the slide. [Read more in the docs](https://sli.dev/guide/syntax.html#notes)
|
48
|
+
-->
|
49
|
+
|
50
|
+
---
|
51
|
+
transition: fade-out
|
52
|
+
---
|
53
|
+
|
54
|
+
# What is Slidev?
|
55
|
+
|
56
|
+
Slidev is a slides maker and presenter designed for developers, consist of the following features
|
57
|
+
|
58
|
+
- 📝 **Text-based** - focus on the content with Markdown, and then style them later
|
59
|
+
- 🎨 **Themable** - themes can be shared and re-used as npm packages
|
60
|
+
- 🧑💻 **Developer Friendly** - code highlighting, live coding with autocompletion
|
61
|
+
- 🤹 **Interactive** - embed Vue components to enhance your expressions
|
62
|
+
- 🎥 **Recording** - built-in recording and camera view
|
63
|
+
- 📤 **Portable** - export to PDF, PPTX, PNGs, or even a hostable SPA
|
64
|
+
- 🛠 **Hackable** - virtually anything that's possible on a webpage is possible in Slidev
|
65
|
+
<br>
|
66
|
+
<br>
|
67
|
+
|
68
|
+
Read more about [Why Slidev?](https://sli.dev/guide/why)
|
69
|
+
|
70
|
+
<!--
|
71
|
+
You can have `style` tag in markdown to override the style for the current page.
|
72
|
+
Learn more: https://sli.dev/features/slide-scope-style
|
73
|
+
-->
|
74
|
+
|
75
|
+
<style>
|
76
|
+
h1 {
|
77
|
+
background-color: #2B90B6;
|
78
|
+
background-image: linear-gradient(45deg, #4EC5D4 10%, #146b8c 20%);
|
79
|
+
background-size: 100%;
|
80
|
+
-webkit-background-clip: text;
|
81
|
+
-moz-background-clip: text;
|
82
|
+
-webkit-text-fill-color: transparent;
|
83
|
+
-moz-text-fill-color: transparent;
|
84
|
+
}
|
85
|
+
</style>
|
86
|
+
|
87
|
+
<!--
|
88
|
+
Here is another comment.
|
89
|
+
-->
|
90
|
+
|
91
|
+
---
|
92
|
+
transition: slide-up
|
93
|
+
level: 2
|
94
|
+
---
|
95
|
+
|
96
|
+
# Navigation
|
97
|
+
|
98
|
+
Hover on the bottom-left corner to see the navigation's controls panel, [learn more](https://sli.dev/guide/ui#navigation-bar)
|
99
|
+
|
100
|
+
## Keyboard Shortcuts
|
101
|
+
|
102
|
+
| | |
|
103
|
+
| --------------------------------------------------- | --------------------------- |
|
104
|
+
| <kbd>right</kbd> / <kbd>space</kbd> | next animation or slide |
|
105
|
+
| <kbd>left</kbd> / <kbd>shift</kbd><kbd>space</kbd> | previous animation or slide |
|
106
|
+
| <kbd>up</kbd> | previous slide |
|
107
|
+
| <kbd>down</kbd> | next slide |
|
108
|
+
|
109
|
+
<!-- https://sli.dev/guide/animations.html#click-animation -->
|
110
|
+
<img
|
111
|
+
v-click
|
112
|
+
class="absolute -bottom-9 -left-7 w-80 opacity-50"
|
113
|
+
src="https://sli.dev/assets/arrow-bottom-left.svg"
|
114
|
+
alt=""
|
115
|
+
/>
|
116
|
+
<p v-after class="absolute bottom-23 left-45 opacity-30 transform -rotate-10">Here!</p>
|
117
|
+
|
118
|
+
---
|
119
|
+
layout: two-cols
|
120
|
+
layoutClass: gap-16
|
121
|
+
---
|
122
|
+
|
123
|
+
# Table of contents
|
124
|
+
|
125
|
+
You can use the `Toc` component to generate a table of contents for your slides:
|
126
|
+
|
127
|
+
```html
|
128
|
+
<Toc minDepth="1" maxDepth="1" />
|
129
|
+
```
|
130
|
+
|
131
|
+
The title will be inferred from your slide content, or you can override it with `title` and `level` in your frontmatter.
|
132
|
+
|
133
|
+
::right::
|
134
|
+
|
135
|
+
<Toc text-sm minDepth="1" maxDepth="2" />
|
136
|
+
|
137
|
+
---
|
138
|
+
layout: image-right
|
139
|
+
image: https://cover.sli.dev
|
140
|
+
---
|
141
|
+
|
142
|
+
# Code
|
143
|
+
|
144
|
+
Use code snippets and get the highlighting directly, and even types hover!
|
145
|
+
|
146
|
+
```ts {all|5|7|7-8|10|all} twoslash
|
147
|
+
// TwoSlash enables TypeScript hover information
|
148
|
+
// and errors in markdown code blocks
|
149
|
+
// More at https://shiki.style/packages/twoslash
|
150
|
+
|
151
|
+
import { computed, ref } from 'vue'
|
152
|
+
|
153
|
+
const count = ref(0)
|
154
|
+
const doubled = computed(() => count.value * 2)
|
155
|
+
|
156
|
+
doubled.value = 2
|
157
|
+
```
|
158
|
+
|
159
|
+
<arrow v-click="[4, 5]" x1="350" y1="310" x2="195" y2="334" color="#953" width="2" arrowSize="1" />
|
160
|
+
|
161
|
+
<!-- This allow you to embed external code blocks -->
|
162
|
+
<<< @/snippets/external.ts#snippet
|
163
|
+
|
164
|
+
<!-- Footer -->
|
165
|
+
|
166
|
+
[Learn more](https://sli.dev/features/line-highlighting)
|
167
|
+
|
168
|
+
<!-- Inline style -->
|
169
|
+
<style>
|
170
|
+
.footnotes-sep {
|
171
|
+
@apply mt-5 opacity-10;
|
172
|
+
}
|
173
|
+
.footnotes {
|
174
|
+
@apply text-sm opacity-75;
|
175
|
+
}
|
176
|
+
.footnote-backref {
|
177
|
+
display: none;
|
178
|
+
}
|
179
|
+
</style>
|
180
|
+
|
181
|
+
<!--
|
182
|
+
Notes can also sync with clicks
|
183
|
+
|
184
|
+
[click] This will be highlighted after the first click
|
185
|
+
|
186
|
+
[click] Highlighted with `count = ref(0)`
|
187
|
+
|
188
|
+
[click:3] Last click (skip two clicks)
|
189
|
+
-->
|
190
|
+
|
191
|
+
---
|
192
|
+
level: 2
|
193
|
+
---
|
194
|
+
|
195
|
+
# Shiki Magic Move
|
196
|
+
|
197
|
+
Powered by [shiki-magic-move](https://shiki-magic-move.netlify.app/), Slidev supports animations across multiple code snippets.
|
198
|
+
|
199
|
+
Add multiple code blocks and wrap them with <code>````md magic-move</code> (four backticks) to enable the magic move. For example:
|
200
|
+
|
201
|
+
````md magic-move {lines: true}
|
202
|
+
```ts {*|2|*}
|
203
|
+
// step 1
|
204
|
+
const author = reactive({
|
205
|
+
name: 'John Doe',
|
206
|
+
books: [
|
207
|
+
'Vue 2 - Advanced Guide',
|
208
|
+
'Vue 3 - Basic Guide',
|
209
|
+
'Vue 4 - The Mystery'
|
210
|
+
]
|
211
|
+
})
|
212
|
+
```
|
213
|
+
|
214
|
+
```ts {*|1-2|3-4|3-4,8}
|
215
|
+
// step 2
|
216
|
+
export default {
|
217
|
+
data() {
|
218
|
+
return {
|
219
|
+
author: {
|
220
|
+
name: 'John Doe',
|
221
|
+
books: [
|
222
|
+
'Vue 2 - Advanced Guide',
|
223
|
+
'Vue 3 - Basic Guide',
|
224
|
+
'Vue 4 - The Mystery'
|
225
|
+
]
|
226
|
+
}
|
227
|
+
}
|
228
|
+
}
|
229
|
+
}
|
230
|
+
```
|
231
|
+
|
232
|
+
```ts
|
233
|
+
// step 3
|
234
|
+
export default {
|
235
|
+
data: () => ({
|
236
|
+
author: {
|
237
|
+
name: 'John Doe',
|
238
|
+
books: [
|
239
|
+
'Vue 2 - Advanced Guide',
|
240
|
+
'Vue 3 - Basic Guide',
|
241
|
+
'Vue 4 - The Mystery'
|
242
|
+
]
|
243
|
+
}
|
244
|
+
})
|
245
|
+
}
|
246
|
+
```
|
247
|
+
|
248
|
+
Non-code blocks are ignored.
|
249
|
+
|
250
|
+
```vue
|
251
|
+
<!-- step 4 -->
|
252
|
+
<script setup>
|
253
|
+
const author = {
|
254
|
+
name: 'John Doe',
|
255
|
+
books: [
|
256
|
+
'Vue 2 - Advanced Guide',
|
257
|
+
'Vue 3 - Basic Guide',
|
258
|
+
'Vue 4 - The Mystery'
|
259
|
+
]
|
260
|
+
}
|
261
|
+
</script>
|
262
|
+
```
|
263
|
+
````
|
264
|
+
|
265
|
+
---
|
266
|
+
|
267
|
+
# Components
|
268
|
+
|
269
|
+
<div grid="~ cols-2 gap-4">
|
270
|
+
<div>
|
271
|
+
|
272
|
+
You can use Vue components directly inside your slides.
|
273
|
+
|
274
|
+
We have provided a few built-in components like `<Tweet/>` and `<Youtube/>` that you can use directly. And adding your custom components is also super easy.
|
275
|
+
|
276
|
+
```html
|
277
|
+
<Counter :count="10" />
|
278
|
+
```
|
279
|
+
|
280
|
+
<!-- ./components/Counter.vue -->
|
281
|
+
<Counter :count="10" m="t-4" />
|
282
|
+
|
283
|
+
Check out [the guides](https://sli.dev/builtin/components.html) for more.
|
284
|
+
|
285
|
+
</div>
|
286
|
+
<div>
|
287
|
+
|
288
|
+
```html
|
289
|
+
<Tweet id="1390115482657726468" />
|
290
|
+
```
|
291
|
+
|
292
|
+
<Tweet id="1390115482657726468" scale="0.65" />
|
293
|
+
|
294
|
+
</div>
|
295
|
+
</div>
|
296
|
+
|
297
|
+
<!--
|
298
|
+
Presenter note with **bold**, *italic*, and ~~striked~~ text.
|
299
|
+
|
300
|
+
Also, HTML elements are valid:
|
301
|
+
<div class="flex w-full">
|
302
|
+
<span style="flex-grow: 1;">Left content</span>
|
303
|
+
<span>Right content</span>
|
304
|
+
</div>
|
305
|
+
-->
|
306
|
+
|
307
|
+
---
|
308
|
+
class: px-20
|
309
|
+
---
|
310
|
+
|
311
|
+
# Themes
|
312
|
+
|
313
|
+
Slidev comes with powerful theming support. Themes can provide styles, layouts, components, or even configurations for tools. Switching between themes by just **one edit** in your frontmatter:
|
314
|
+
|
315
|
+
<div grid="~ cols-2 gap-2" m="t-2">
|
316
|
+
|
317
|
+
```yaml
|
318
|
+
---
|
319
|
+
theme: default
|
320
|
+
---
|
321
|
+
```
|
322
|
+
|
323
|
+
```yaml
|
324
|
+
---
|
325
|
+
theme: seriph
|
326
|
+
---
|
327
|
+
```
|
328
|
+
|
329
|
+
<img border="rounded" src="https://github.com/slidevjs/themes/blob/main/screenshots/theme-default/01.png?raw=true" alt="">
|
330
|
+
|
331
|
+
<img border="rounded" src="https://github.com/slidevjs/themes/blob/main/screenshots/theme-seriph/01.png?raw=true" alt="">
|
332
|
+
|
333
|
+
</div>
|
334
|
+
|
335
|
+
Read more about [How to use a theme](https://sli.dev/guide/theme-addon#use-theme) and
|
336
|
+
check out the [Awesome Themes Gallery](https://sli.dev/resources/theme-gallery).
|
337
|
+
|
338
|
+
---
|
339
|
+
|
340
|
+
# Clicks Animations
|
341
|
+
|
342
|
+
You can add `v-click` to elements to add a click animation.
|
343
|
+
|
344
|
+
<div v-click>
|
345
|
+
|
346
|
+
This shows up when you click the slide:
|
347
|
+
|
348
|
+
```html
|
349
|
+
<div v-click>This shows up when you click the slide.</div>
|
350
|
+
```
|
351
|
+
|
352
|
+
</div>
|
353
|
+
|
354
|
+
<br>
|
355
|
+
|
356
|
+
<v-click>
|
357
|
+
|
358
|
+
The <span v-mark.red="3"><code>v-mark</code> directive</span>
|
359
|
+
also allows you to add
|
360
|
+
<span v-mark.circle.orange="4">inline marks</span>
|
361
|
+
, powered by [Rough Notation](https://roughnotation.com/):
|
362
|
+
|
363
|
+
```html
|
364
|
+
<span v-mark.underline.orange>inline markers</span>
|
365
|
+
```
|
366
|
+
|
367
|
+
</v-click>
|
368
|
+
|
369
|
+
<div mt-20 v-click>
|
370
|
+
|
371
|
+
[Learn more](https://sli.dev/guide/animations#click-animation)
|
372
|
+
|
373
|
+
</div>
|
374
|
+
|
375
|
+
---
|
376
|
+
|
377
|
+
# Motions
|
378
|
+
|
379
|
+
Motion animations are powered by [@vueuse/motion](https://motion.vueuse.org/), triggered by `v-motion` directive.
|
380
|
+
|
381
|
+
```html
|
382
|
+
<div
|
383
|
+
v-motion
|
384
|
+
:initial="{ x: -80 }"
|
385
|
+
:enter="{ x: 0 }"
|
386
|
+
:click-3="{ x: 80 }"
|
387
|
+
:leave="{ x: 1000 }"
|
388
|
+
>
|
389
|
+
Slidev
|
390
|
+
</div>
|
391
|
+
```
|
392
|
+
|
393
|
+
<div class="w-60 relative">
|
394
|
+
<div class="relative w-40 h-40">
|
395
|
+
<img
|
396
|
+
v-motion
|
397
|
+
:initial="{ x: 800, y: -100, scale: 1.5, rotate: -50 }"
|
398
|
+
:enter="final"
|
399
|
+
class="absolute inset-0"
|
400
|
+
src="https://sli.dev/logo-square.png"
|
401
|
+
alt=""
|
402
|
+
/>
|
403
|
+
<img
|
404
|
+
v-motion
|
405
|
+
:initial="{ y: 500, x: -100, scale: 2 }"
|
406
|
+
:enter="final"
|
407
|
+
class="absolute inset-0"
|
408
|
+
src="https://sli.dev/logo-circle.png"
|
409
|
+
alt=""
|
410
|
+
/>
|
411
|
+
<img
|
412
|
+
v-motion
|
413
|
+
:initial="{ x: 600, y: 400, scale: 2, rotate: 100 }"
|
414
|
+
:enter="final"
|
415
|
+
class="absolute inset-0"
|
416
|
+
src="https://sli.dev/logo-triangle.png"
|
417
|
+
alt=""
|
418
|
+
/>
|
419
|
+
</div>
|
420
|
+
|
421
|
+
<div
|
422
|
+
class="text-5xl absolute top-14 left-40 text-[#2B90B6] -z-1"
|
423
|
+
v-motion
|
424
|
+
:initial="{ x: -80, opacity: 0}"
|
425
|
+
:enter="{ x: 0, opacity: 1, transition: { delay: 2000, duration: 1000 } }">
|
426
|
+
Slidev
|
427
|
+
</div>
|
428
|
+
</div>
|
429
|
+
|
430
|
+
<!-- vue script setup scripts can be directly used in markdown, and will only affects current page -->
|
431
|
+
<script setup lang="ts">
|
432
|
+
const final = {
|
433
|
+
x: 0,
|
434
|
+
y: 0,
|
435
|
+
rotate: 0,
|
436
|
+
scale: 1,
|
437
|
+
transition: {
|
438
|
+
type: 'spring',
|
439
|
+
damping: 10,
|
440
|
+
stiffness: 20,
|
441
|
+
mass: 2
|
442
|
+
}
|
443
|
+
}
|
444
|
+
</script>
|
445
|
+
|
446
|
+
<div
|
447
|
+
v-motion
|
448
|
+
:initial="{ x:35, y: 30, opacity: 0}"
|
449
|
+
:enter="{ y: 0, opacity: 1, transition: { delay: 3500 } }">
|
450
|
+
|
451
|
+
[Learn more](https://sli.dev/guide/animations.html#motion)
|
452
|
+
|
453
|
+
</div>
|
454
|
+
|
455
|
+
---
|
456
|
+
|
457
|
+
# LaTeX
|
458
|
+
|
459
|
+
LaTeX is supported out-of-box. Powered by [KaTeX](https://katex.org/).
|
460
|
+
|
461
|
+
<div h-3 />
|
462
|
+
|
463
|
+
Inline $\sqrt{3x-1}+(1+x)^2$
|
464
|
+
|
465
|
+
Block
|
466
|
+
$$ {1|3|all}
|
467
|
+
\begin{aligned}
|
468
|
+
\nabla \cdot \vec{E} &= \frac{\rho}{\varepsilon_0} \\
|
469
|
+
\nabla \cdot \vec{B} &= 0 \\
|
470
|
+
\nabla \times \vec{E} &= -\frac{\partial\vec{B}}{\partial t} \\
|
471
|
+
\nabla \times \vec{B} &= \mu_0\vec{J} + \mu_0\varepsilon_0\frac{\partial\vec{E}}{\partial t}
|
472
|
+
\end{aligned}
|
473
|
+
$$
|
474
|
+
|
475
|
+
[Learn more](https://sli.dev/features/latex)
|
476
|
+
|
477
|
+
---
|
478
|
+
|
479
|
+
# Diagrams
|
480
|
+
|
481
|
+
You can create diagrams / graphs from textual descriptions, directly in your Markdown.
|
482
|
+
|
483
|
+
<div class="grid grid-cols-4 gap-5 pt-4 -mb-6">
|
484
|
+
|
485
|
+
```mermaid {scale: 0.5, alt: 'A simple sequence diagram'}
|
486
|
+
sequenceDiagram
|
487
|
+
Alice->John: Hello John, how are you?
|
488
|
+
Note over Alice,John: A typical interaction
|
489
|
+
```
|
490
|
+
|
491
|
+
```mermaid {theme: 'neutral', scale: 0.8}
|
492
|
+
graph TD
|
493
|
+
B[Text] --> C{Decision}
|
494
|
+
C -->|One| D[Result 1]
|
495
|
+
C -->|Two| E[Result 2]
|
496
|
+
```
|
497
|
+
|
498
|
+
```mermaid
|
499
|
+
mindmap
|
500
|
+
root((mindmap))
|
501
|
+
Origins
|
502
|
+
Long history
|
503
|
+
::icon(fa fa-book)
|
504
|
+
Popularisation
|
505
|
+
British popular psychology author Tony Buzan
|
506
|
+
Research
|
507
|
+
On effectiveness<br/>and features
|
508
|
+
On Automatic creation
|
509
|
+
Uses
|
510
|
+
Creative techniques
|
511
|
+
Strategic planning
|
512
|
+
Argument mapping
|
513
|
+
Tools
|
514
|
+
Pen and paper
|
515
|
+
Mermaid
|
516
|
+
```
|
517
|
+
|
518
|
+
```plantuml {scale: 0.7}
|
519
|
+
@startuml
|
520
|
+
|
521
|
+
package "Some Group" {
|
522
|
+
HTTP - [First Component]
|
523
|
+
[Another Component]
|
524
|
+
}
|
525
|
+
|
526
|
+
node "Other Groups" {
|
527
|
+
FTP - [Second Component]
|
528
|
+
[First Component] --> FTP
|
529
|
+
}
|
530
|
+
|
531
|
+
cloud {
|
532
|
+
[Example 1]
|
533
|
+
}
|
534
|
+
|
535
|
+
database "MySql" {
|
536
|
+
folder "This is my folder" {
|
537
|
+
[Folder 3]
|
538
|
+
}
|
539
|
+
frame "Foo" {
|
540
|
+
[Frame 4]
|
541
|
+
}
|
542
|
+
}
|
543
|
+
|
544
|
+
[Another Component] --> [Example 1]
|
545
|
+
[Example 1] --> [Folder 3]
|
546
|
+
[Folder 3] --> [Frame 4]
|
547
|
+
|
548
|
+
@enduml
|
549
|
+
```
|
550
|
+
|
551
|
+
</div>
|
552
|
+
|
553
|
+
Learn more: [Mermaid Diagrams](https://sli.dev/features/mermaid) and [PlantUML Diagrams](https://sli.dev/features/plantuml)
|
554
|
+
|
555
|
+
---
|
556
|
+
foo: bar
|
557
|
+
dragPos:
|
558
|
+
square: 691,32,167,_,-16
|
559
|
+
---
|
560
|
+
|
561
|
+
# Draggable Elements
|
562
|
+
|
563
|
+
Double-click on the draggable elements to edit their positions.
|
564
|
+
|
565
|
+
<br>
|
566
|
+
|
567
|
+
###### Directive Usage
|
568
|
+
|
569
|
+
```md
|
570
|
+
<img v-drag="'square'" src="https://sli.dev/logo.png">
|
571
|
+
```
|
572
|
+
|
573
|
+
<br>
|
574
|
+
|
575
|
+
###### Component Usage
|
576
|
+
|
577
|
+
```md
|
578
|
+
<v-drag text-3xl>
|
579
|
+
<div class="i-carbon:arrow-up" />
|
580
|
+
Use the `v-drag` component to have a draggable container!
|
581
|
+
</v-drag>
|
582
|
+
```
|
583
|
+
|
584
|
+
<v-drag pos="663,206,261,_,-15">
|
585
|
+
<div text-center text-3xl border border-main rounded>
|
586
|
+
Double-click me!
|
587
|
+
</div>
|
588
|
+
</v-drag>
|
589
|
+
|
590
|
+
<img v-drag="'square'" src="https://sli.dev/logo.png">
|
591
|
+
|
592
|
+
###### Draggable Arrow
|
593
|
+
|
594
|
+
```md
|
595
|
+
<v-drag-arrow two-way />
|
596
|
+
```
|
597
|
+
|
598
|
+
<v-drag-arrow pos="67,452,253,46" two-way op70 />
|
599
|
+
|
600
|
+
---
|
601
|
+
src: ./pages/imported-slides.md
|
602
|
+
hide: false
|
603
|
+
---
|
604
|
+
|
605
|
+
---
|
606
|
+
|
607
|
+
# Monaco Editor
|
608
|
+
|
609
|
+
Slidev provides built-in Monaco Editor support.
|
610
|
+
|
611
|
+
Add `{monaco}` to the code block to turn it into an editor:
|
612
|
+
|
613
|
+
```ts {monaco}
|
614
|
+
import { ref } from 'vue'
|
615
|
+
import { emptyArray } from './external'
|
616
|
+
|
617
|
+
const arr = ref(emptyArray(10))
|
618
|
+
```
|
619
|
+
|
620
|
+
Use `{monaco-run}` to create an editor that can execute the code directly in the slide:
|
621
|
+
|
622
|
+
```ts {monaco-run}
|
623
|
+
import { version } from 'vue'
|
624
|
+
import { emptyArray, sayHello } from './external'
|
625
|
+
|
626
|
+
sayHello()
|
627
|
+
console.log(`vue ${version}`)
|
628
|
+
console.log(emptyArray<number>(10).reduce(fib => [...fib, fib.at(-1)! + fib.at(-2)!], [1, 1]))
|
629
|
+
```
|
630
|
+
|
631
|
+
---
|
632
|
+
layout: center
|
633
|
+
class: text-center
|
634
|
+
---
|
635
|
+
|
636
|
+
# Learn More
|
637
|
+
|
638
|
+
[Documentation](https://sli.dev) · [GitHub](https://github.com/slidevjs/slidev) · [Showcases](https://sli.dev/resources/showcases)
|
639
|
+
|
640
|
+
<PoweredBySlidev mt-10 />
|
@@ -0,0 +1,12 @@
|
|
1
|
+
/* eslint-disable no-console */
|
2
|
+
|
3
|
+
// #region snippet
|
4
|
+
// Inside ./snippets/external.ts
|
5
|
+
export function emptyArray<T>(length: number) {
|
6
|
+
return Array.from<T>({ length })
|
7
|
+
}
|
8
|
+
// #endregion snippet
|
9
|
+
|
10
|
+
export function sayHello() {
|
11
|
+
console.log('Hello from snippets/external.ts')
|
12
|
+
}
|