-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
13 changed files
with
97 additions
and
688 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,47 @@ | ||
<script setup lang="ts"> | ||
import { useElementSize } from '@vueuse/core' | ||
import { computed, ref } from 'vue' | ||
const slideAspect = 16 / 9 | ||
const slideWidth = 980 | ||
const slideHeight = 980 * 9 / 16 | ||
const root = ref<HTMLDivElement>() | ||
const element = useElementSize(root) | ||
const width = computed(() => element.width.value) | ||
const height = computed(() => element.height.value) | ||
const screenAspect = computed(() => width.value / height.value) | ||
const scale = computed(() => { | ||
if (screenAspect.value < slideAspect) | ||
return width.value / slideWidth | ||
return height.value * slideAspect / slideWidth | ||
}) | ||
const style = computed(() => ({ | ||
height: `${slideHeight}px`, | ||
width: `${slideWidth}px`, | ||
transform: `translate(-50%, -50%) scale(${scale.value})`, | ||
})) | ||
</script> | ||
|
||
<template> | ||
<div ref="root" class="slide-container"> | ||
<div class="slide-content" :style="style"> | ||
<slot /> | ||
</div> | ||
<slot name="controls" /> | ||
</div> | ||
</template> | ||
|
||
<style lang="postcss"> | ||
.slide-container { | ||
@apply relative overflow-hidden; | ||
} | ||
.slide-content { | ||
@apply relative overflow-hidden bg-main absolute left-1/2 top-1/2; | ||
} | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,7 @@ | |
"packageManager": "[email protected]", | ||
"scripts": { | ||
"dev": "vitepress", | ||
"build": "vitepress build", | ||
"postinstall": "node .vitepress/scripts/prepare.js" | ||
"build": "vitepress build" | ||
}, | ||
"dependencies": { | ||
"@antfu/utils": "^0.7.10", | ||
|
@@ -17,10 +16,6 @@ | |
"devDependencies": { | ||
"@iconify/json": "^2.2.237", | ||
"@shikijs/vitepress-twoslash": "^1.13.0", | ||
"@slidev-old/client": "npm:@slidev/[email protected]", | ||
"@slidev-old/parser": "npm:@slidev/[email protected]", | ||
"@slidev-old/theme-default": "npm:@slidev/[email protected]", | ||
"@slidev-old/types": "npm:@slidev/[email protected]", | ||
"@slidev/client": "workspace:*", | ||
"@slidev/parser": "workspace:*", | ||
"@slidev/types": "workspace:*", | ||
|
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.