-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: ZTL-UwU <[email protected]>
- Loading branch information
Showing
63 changed files
with
1,132 additions
and
38 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,5 +44,6 @@ | |
"gql", | ||
"graphql", | ||
"astro" | ||
] | ||
], | ||
"editor.tabSize": 2 | ||
} |
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,27 @@ | ||
<template> | ||
<UiAlert class="[&:not(:first-child)]:mt-4"> | ||
<Icon v-if="icon && title" :name="icon" /> | ||
<UiAlertTitle v-if="title"> | ||
{{ title }} | ||
</UiAlertTitle> | ||
<UiAlertDescription> | ||
<div class="flex flex-row space-x-2"> | ||
<Icon v-if="icon && !title" :name="icon" class="self-center mb-[2px]" /> | ||
<span> | ||
<slot /> | ||
</span> | ||
</div> | ||
</UiAlertDescription> | ||
</UiAlert> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
defineProps({ | ||
title: { | ||
type: String, | ||
}, | ||
icon: { | ||
type: String, | ||
}, | ||
}); | ||
</script> |
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,25 @@ | ||
<template> | ||
<NuxtLink | ||
:href="href" | ||
:target="target" | ||
class="underline-offset-4 underline font-semibold" | ||
> | ||
<slot /> | ||
</NuxtLink> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import type { PropType } from 'vue'; | ||
defineProps({ | ||
href: { | ||
type: String, | ||
default: '', | ||
}, | ||
target: { | ||
type: String as PropType<'_blank' | '_parent' | '_self' | '_top' | (string & object) | null | undefined>, | ||
default: undefined, | ||
required: false, | ||
}, | ||
}); | ||
</script> |
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,5 @@ | ||
<template> | ||
<blockquote class="mt-6 border-l-2 pl-6 italic"> | ||
<slot /> | ||
</blockquote> | ||
</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,97 @@ | ||
<template> | ||
<UiCard class="[&:not(:first-child)]:mt-5 mb-5 overflow-hidden"> | ||
<div v-if="filename" class="p-3 border-b flex"> | ||
{{ filename }} | ||
<span class="ml-auto mr-1"> | ||
<Transition name="fade" mode="out-in"> | ||
<Icon | ||
v-if="copied === false" | ||
name="lucide:copy" | ||
class="self-center cursor-pointer text-muted-foreground hover:text-primary" | ||
@click="copyCode" | ||
/> | ||
<Icon | ||
v-else | ||
ref="checkIconRef" | ||
name="lucide:check" | ||
class="self-center cursor-pointer text-muted-foreground hover:text-primary" | ||
/> | ||
</Transition> | ||
</span> | ||
</div> | ||
<div | ||
class="p-3 bg-zinc-50 dark:bg-zinc-900 text-sm relative" | ||
:class="[`highlight-${language}`]" | ||
@mouseenter="hovered = true" | ||
@mouseleave="hovered = false" | ||
> | ||
<span v-if="!filename" class="absolute right-4"> | ||
<Transition name="fade" mode="out-in"> | ||
<Icon | ||
v-if="copied === false" | ||
name="lucide:copy" | ||
class="self-center cursor-pointer text-muted-foreground hover:text-primary" | ||
@click="copyCode" | ||
/> | ||
<Icon | ||
v-else | ||
ref="checkIconRef" | ||
name="lucide:check" | ||
class="self-center cursor-pointer text-muted-foreground hover:text-primary" | ||
/> | ||
</Transition> | ||
</span> | ||
<slot /> | ||
</div> | ||
</UiCard> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import type { PropType } from 'vue'; | ||
import { ref } from 'vue'; | ||
import type { BuiltinLanguage } from 'shiki'; | ||
const props = defineProps({ | ||
code: { | ||
type: String, | ||
default: '', | ||
}, | ||
language: { | ||
type: String as PropType<BuiltinLanguage>, | ||
default: null, | ||
}, | ||
filename: { | ||
type: String, | ||
default: null, | ||
}, | ||
highlights: { | ||
type: Array as () => number[], | ||
default: () => [], | ||
}, | ||
}); | ||
const hovered = ref(false); | ||
const { copy } = useClipboard({ source: props.code }); | ||
const copied = ref(false); | ||
function copyCode() { | ||
copy(props.code) | ||
.then( | ||
() => { copied.value = true; }, | ||
); | ||
} | ||
const checkIconRef = ref<HTMLElement>(); | ||
onClickOutside(checkIconRef, () => { | ||
copied.value = false; | ||
}); | ||
</script> | ||
|
||
<style> | ||
.fade-enter-active { | ||
transition: opacity 0.5s ease; | ||
} | ||
.fade-enter-from, | ||
.fade-leave-to { | ||
opacity: 0; | ||
} | ||
</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,13 @@ | ||
<template> | ||
<code class="relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono font-semibold inline-code"> | ||
<slot /> | ||
</code> | ||
</template> | ||
|
||
<style scoped> | ||
.inline-code:not(h1>a>code, h2>a>code, h3>a>code, h4>a>code, h5>a>code, strong>a>code) { | ||
/* text-sm */ | ||
font-size: 0.875rem; | ||
line-height: 1.25rem; | ||
} | ||
</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,5 @@ | ||
<template> | ||
<em> | ||
<slot /> | ||
</em> | ||
</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,18 @@ | ||
<template> | ||
<h1 :id="id" class="scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl"> | ||
<NuxtLink | ||
v-if="generate" | ||
:href="`#${id}`" | ||
> | ||
<slot /> | ||
</NuxtLink> | ||
<slot v-else /> | ||
</h1> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
const props = defineProps<{ id?: string }>(); | ||
const { headings } = useRuntimeConfig().public.mdc; | ||
const generate = computed(() => props.id && headings?.anchorLinks?.h1); | ||
</script> |
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,18 @@ | ||
<template> | ||
<h2 :id="id" class="scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight transition-colors [&:not(:first-child)]:mt-10"> | ||
<NuxtLink | ||
v-if="id && generate" | ||
:href="`#${id}`" | ||
> | ||
<slot /> | ||
</NuxtLink> | ||
<slot v-else /> | ||
</h2> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
const props = defineProps<{ id?: string }>(); | ||
const { headings } = useRuntimeConfig().public.mdc; | ||
const generate = computed(() => props.id && headings?.anchorLinks?.h2); | ||
</script> |
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,18 @@ | ||
<template> | ||
<h3 :id="id" class="scroll-m-20 text-2xl font-semibold tracking-tight [&:not(:first-child)]:mt-8"> | ||
<NuxtLink | ||
v-if="id && generate" | ||
:href="`#${id}`" | ||
> | ||
<slot /> | ||
</NuxtLink> | ||
<slot v-else /> | ||
</h3> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
const props = defineProps<{ id?: string }>(); | ||
const { headings } = useRuntimeConfig().public.mdc; | ||
const generate = computed(() => props.id && headings?.anchorLinks?.h3); | ||
</script> |
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,18 @@ | ||
<template> | ||
<h4 :id="id" class="scroll-m-20 text-xl font-semibold tracking-tight [&:not(:first-child)]:mt-6"> | ||
<NuxtLink | ||
v-if="id && generate" | ||
:href="`#${id}`" | ||
> | ||
<slot /> | ||
</NuxtLink> | ||
<slot v-else /> | ||
</h4> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
const props = defineProps<{ id?: string }>(); | ||
const { headings } = useRuntimeConfig().public.mdc; | ||
const generate = computed(() => props.id && headings?.anchorLinks?.h4); | ||
</script> |
Oops, something went wrong.