forked from slidevjs/slidev
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
428 additions
and
225 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
<script setup lang="ts"> | ||
import { ref, onMounted, watch, shallowRef } from 'vue' | ||
// @ts-ignore | ||
import TypeIt from 'typeit' | ||
import Markdown from 'markdown-it' | ||
import type { SlidevMarkdown } from '@slidev/types' | ||
import { parse } from '../../../../../packages/parser/src/core' | ||
import Default from '../../../../../packages/client/layouts/default.vue' | ||
import Center from '../../../../../packages/client/layouts/center.vue' | ||
import SlideContainer from '../../../../../packages/client/internals/SlideContainer.vue' | ||
import Cover from '../../../../../packages/theme-default/layouts/cover.vue' | ||
import '../../../../../packages/theme-default/styles/layout.css' | ||
const paused = ref(false) | ||
const code = ref('') | ||
const html = ref('') | ||
let info: SlidevMarkdown | ||
const block = ref<HTMLPreElement>() | ||
const layout = shallowRef<any>(Default) | ||
const markdown = new Markdown() | ||
watch([code, paused], () => { | ||
if (paused.value) | ||
return | ||
try { | ||
info = parse(code.value) | ||
html.value = markdown.render(info.slides[0].content) | ||
const name = info?.slides?.[0]?.frontmatter?.layout || 'default' | ||
layout.value = name === 'cover' | ||
? Cover | ||
: name === 'center' | ||
? Center | ||
: Default | ||
} | ||
catch (e) { | ||
} | ||
}) | ||
onMounted(() => { | ||
new TypeIt(block.value, { | ||
speed: 50, | ||
startDelay: 900, | ||
afterStep: () => { | ||
code.value = JSON.parse(JSON.stringify(block.value!.innerText.replace('|', ''))) | ||
}, | ||
}) | ||
.type('<br><span class="token title"># Welcome to Slidev!</span><br><br>', { delay: 400 }) | ||
.type('Presentation Slides for Developers', { delay: 400 }) | ||
.move('START', { speed: 0 }) | ||
.type('<br>') | ||
.move('START') | ||
.exec(() => paused.value = true) | ||
.type('<span class="token punctuation">---<br><br>---</span>') | ||
.move(-4) | ||
.type('<span class="token tag">layout:</span> center') | ||
.exec(() => paused.value = false) | ||
.pause(1000) | ||
.exec(() => paused.value = true) | ||
.delete(6, { delay: 100, speed: 50 }) | ||
.type('cover') | ||
.exec(() => paused.value = false) | ||
.pause(1000) | ||
.type('<br>') | ||
.type('<span class="token tag">background:</span> ', { delay: 500 }) | ||
.type('https://slidev.antfu.me/demo-cover.png', { speed: 0, delay: 1000 }) | ||
.move('END', { speed: 0 }) | ||
.type('<br><br><span class="token punctuation">---</span><br><br>', { delay: 400 }) | ||
.type('<span class="token title"># Page 2</span><br><br>', { delay: 400 }) | ||
.type('- 📄 Write sldies in a simple Markdown file<br>', { delay: 800 }) | ||
.type('- 🌈 Themes, code blocks, interactive components<br>', { delay: 800 }) | ||
.type('- 😎 Read the docs to learn more!', { delay: 800 }) | ||
.go() | ||
}) | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<DemoEditor> | ||
<div class="text-sm opacity-50"> | ||
./slides.md | ||
</div> | ||
|
||
<div class="language-md !bg-transparent"> | ||
<pre | ||
ref="block" | ||
class="text-left whitespace-normal font-mono bg-transparent" | ||
></pre> | ||
</div> | ||
</DemoEditor> | ||
|
||
<DemoSlide class="text-left"> | ||
<SlideContainer class="w-full h-full"> | ||
<component :is="layout" v-bind="info?.slides?.[0]?.frontmatter"> | ||
<div v-html="html"></div> | ||
</component> | ||
</SlideContainer> | ||
</DemoSlide> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<template> | ||
<div class="terminal"> | ||
<slot/> | ||
</div> | ||
</template> | ||
|
||
<style lang="postcss" scoped> | ||
.terminal { | ||
font-size: 1em; | ||
line-height: 1.2em; | ||
min-height: 450px; | ||
margin-top: 25px; | ||
padding: 10px; | ||
border-radius: 7px; | ||
position: relative; | ||
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05), 0 0 30px 1px rgba(0, 0, 0, 0.15); | ||
@apply dark:(bg-gray-400 bg-opacity-5); | ||
} | ||
.terminal::after { | ||
content: ""; | ||
position: absolute; | ||
top: 12px; | ||
left: 10px; | ||
width: 12px; | ||
height: 12px; | ||
background: #f95c5b; | ||
border-radius: 100%; | ||
box-shadow: 0 0 0 1px #da3d42, 22px 0 0 0 #fabe3b, 22px 0 0 1px #ecb03e, 44px 0 0 0 #38cd46, 44px 0 0 1px #2eae32; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<template> | ||
<div class="slide"> | ||
<div class="aspect-9/16"></div> | ||
<div class="absolute top-0 left-0 right-0 bottom-0"> | ||
<slot /> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<style lang="postcss" scoped> | ||
.slide { | ||
background: var(--c-bg); | ||
font-size: 1em; | ||
line-height: 1.2em; | ||
border-radius: 7px; | ||
position: relative; | ||
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05), 0 0 30px 1px rgba(0, 0, 0, 0.15); | ||
@apply mt-4 transform translate-x-20 -translate-y-20; | ||
@apply dark:(bg-gray-400 bg-opacity-5); | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.