-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
40 changed files
with
877 additions
and
171 deletions.
There are no files selected for viewing
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
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,28 @@ | ||
import { useStyleTag } from '@vueuse/core' | ||
import { computed } from 'vue' | ||
import { slideHeight, slideWidth } from '../env' | ||
import { useNav } from './useNav' | ||
|
||
export function usePrintStyles() { | ||
const { isPrintMode } = useNav() | ||
|
||
useStyleTag(computed(() => isPrintMode.value | ||
? ` | ||
@page { | ||
size: ${slideWidth.value}px ${slideHeight.value}px; | ||
margin: 0px; | ||
} | ||
* { | ||
transition: none !important; | ||
transition-duration: 0s !important; | ||
}` | ||
: '')) | ||
} | ||
|
||
// Monaco uses `<style media="screen" class="monaco-colors">` to apply colors, which will be ignored in print mode. | ||
export function patchMonacoColors() { | ||
document.querySelectorAll<HTMLStyleElement>('style.monaco-colors').forEach((el) => { | ||
el.media = '' | ||
}) | ||
} |
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,90 @@ | ||
<script setup lang="ts"> | ||
import { useVModel } from '@vueuse/core' | ||
import { skipExportPdfTip } from '../state' | ||
import Modal from './Modal.vue' | ||
const props = defineProps({ | ||
modelValue: { | ||
default: false, | ||
}, | ||
}) | ||
const emit = defineEmits(['update:modelValue', 'print']) | ||
const value = useVModel(props, 'modelValue', emit) | ||
function print() { | ||
value.value = false | ||
emit('print') | ||
} | ||
</script> | ||
|
||
<template> | ||
<Modal v-model="value" class="px-6 py-4 flex flex-col gap-2"> | ||
<div class="flex gap-2 text-xl"> | ||
<div class="i-carbon:information my-auto" /> Tips | ||
</div> | ||
<div> | ||
Slidev will open your browser's built-in print dialog to export the slides as PDF. <br> | ||
In the print dialog, please: | ||
<ul class="list-disc my-4 pl-4"> | ||
<li> | ||
Choose "Save as PDF" as the Destination. | ||
<span class="op-70 text-xs"> (Not "Microsoft Print to PDF") </span> | ||
</li> | ||
<li> Choose "Default" as the Margin. </li> | ||
<li> Toggle on "Print backgrounds". </li> | ||
</ul> | ||
<div class="mb-2 op-70 text-sm"> | ||
If you're encountering problems, please try | ||
<a href="https://sli.dev/builtin/cli#export"> the CLI </a> | ||
or | ||
<a href="https://github.com/slidevjs/slidev/issues/new"> open an issue</a>. | ||
</div> | ||
<div class="form-check op-70"> | ||
<input | ||
v-model="skipExportPdfTip" | ||
name="record-camera" | ||
type="checkbox" | ||
> | ||
<label for="record-camera" @click="skipExportPdfTip = !skipExportPdfTip">Don't show this dialog next time.</label> | ||
</div> | ||
</div> | ||
<div class="flex my-1"> | ||
<button class="cancel" @click="value = false"> | ||
Cancel | ||
</button> | ||
<div class="flex-auto" /> | ||
<button @click="print"> | ||
Start | ||
</button> | ||
</div> | ||
</Modal> | ||
</template> | ||
|
||
<style scoped> | ||
button { | ||
@apply bg-blue-400 text-white px-4 py-1 rounded border-b-2 border-blue-600; | ||
@apply hover:(bg-blue-500 border-blue-700); | ||
} | ||
button.cancel { | ||
@apply bg-gray-400 bg-opacity-50 text-white px-4 py-1 rounded border-b-2 border-main; | ||
@apply hover:(bg-opacity-75 border-opacity-75); | ||
} | ||
a { | ||
@apply border-current border-b border-dashed hover:text-primary hover:border-solid; | ||
} | ||
.form-check { | ||
@apply leading-5; | ||
* { | ||
@apply my-auto align-middle; | ||
} | ||
label { | ||
@apply ml-1 text-sm select-none; | ||
} | ||
} | ||
</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,16 @@ | ||
<script setup lang="ts"> | ||
defineProps<{ | ||
disabled?: boolean | ||
}>() | ||
const value = defineModel<boolean>('modelValue', { | ||
type: Boolean, | ||
}) | ||
</script> | ||
|
||
<template> | ||
<div border="~ main rounded" flex="~ gap-2 items-center" relative h-5 w-5 p0.5 hover:bg-active p1> | ||
<div i-ri-check-line :class="value ? '' : 'op0'" /> | ||
<input v-model="value" type="checkbox" absolute inset-0 z-10 opacity-0.1 :disabled="disabled"> | ||
</div> | ||
</template> |
Oops, something went wrong.