docus 2.1.0 → 3.0.0-beta.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 +6 -4
- package/app/router.options.ts +18 -0
- package/assets/css/fonts.css +84 -0
- package/assets/css/main.css +11 -0
- package/assets/css/tailwind.css +282 -0
- package/components/app/Container.vue +23 -0
- package/components/app/Footer.vue +38 -0
- package/components/app/Navbar.vue +26 -0
- package/components/app/NavbarLogo.vue +31 -0
- package/components/app/Page.vue +7 -0
- package/components/app/PoweredByDocus.vue +11 -0
- package/components/content/Alert.vue +124 -0
- package/components/content/BlockHero.vue +54 -0
- package/components/content/ButtonLink.vue +44 -0
- package/components/content/Card.vue +46 -0
- package/components/content/CardGrid.vue +23 -0
- package/components/content/CodeBlock.vue +47 -0
- package/components/content/CodeGroup.vue +134 -0
- package/components/content/CopyButton.vue +48 -0
- package/{dist/runtime/app/components/prose/ProseOl.vue → components/content/List.vue} +2 -2
- package/components/content/NeedContribution.vue +23 -0
- package/components/content/ReadMore.vue +24 -0
- package/components/content/Sandbox.vue +100 -0
- package/components/content/TabsHeader.vue +44 -0
- package/components/content/Terminal.vue +70 -0
- package/components/content/VideoPlayer.vue +113 -0
- package/components/docs/DocsAside.vue +19 -0
- package/components/docs/DocsAsideTree.vue +101 -0
- package/components/docs/DocsHero.vue +39 -0
- package/components/docs/DocsPage.vue +22 -0
- package/components/docs/DocsPageContent.vue +29 -0
- package/components/docs/DocsToc.vue +72 -0
- package/components/globals/Icon.vue +24 -0
- package/{dist/runtime/app/components/prose/ProseHr.vue → components/globals/Logo.vue} +1 -1
- package/components/globals/NuxtImg.vue +43 -0
- package/components/globals/SocialIcons.vue +43 -0
- package/components/globals/ThemeSelect.vue +35 -0
- package/components/icons/IconAlgolia.vue +8 -0
- package/components/icons/IconArrowLeft.vue +10 -0
- package/components/icons/IconArrowRight.vue +10 -0
- package/components/icons/IconBadgeCheck.vue +14 -0
- package/components/icons/IconCheck.vue +10 -0
- package/components/icons/IconCheckCircle.vue +10 -0
- package/components/icons/IconChevronRight.vue +12 -0
- package/components/icons/IconClipboardCheck.vue +14 -0
- package/components/icons/IconClipboardCopy.vue +14 -0
- package/components/icons/IconCodeSandbox.vue +8 -0
- package/components/icons/IconCopy.vue +17 -0
- package/components/icons/IconDots.vue +10 -0
- package/components/icons/IconEdit.vue +18 -0
- package/components/icons/IconExclamationCircle.vue +12 -0
- package/components/icons/IconExclamationTriangle.vue +10 -0
- package/components/icons/IconExternalLink.vue +12 -0
- package/components/icons/IconGit.vue +7 -0
- package/components/icons/IconGitHub.vue +10 -0
- package/components/icons/IconHeart.vue +9 -0
- package/components/icons/IconInformationCircle.vue +10 -0
- package/components/icons/IconLighthouse.vue +83 -0
- package/components/icons/IconLine.vue +10 -0
- package/components/icons/IconMarkdown.vue +13 -0
- package/components/icons/IconMenu.vue +12 -0
- package/components/icons/IconMenuAlt.vue +10 -0
- package/components/icons/IconMinus.vue +10 -0
- package/components/icons/IconMoon.vue +10 -0
- package/components/icons/IconNuxt.vue +14 -0
- package/components/icons/IconNuxtContent.vue +20 -0
- package/components/icons/IconNuxtLabs.vue +21 -0
- package/components/icons/IconPlus.vue +10 -0
- package/components/icons/IconPuzzle.vue +8 -0
- package/components/icons/IconSSG.vue +7 -0
- package/components/icons/IconSearch.vue +12 -0
- package/components/icons/IconSun.vue +10 -0
- package/components/icons/IconTocBack.vue +21 -0
- package/components/icons/IconTocCurrent.vue +21 -0
- package/components/icons/IconTocNext.vue +8 -0
- package/components/icons/IconTranslate.vue +14 -0
- package/components/icons/IconTwitter.vue +8 -0
- package/components/icons/IconVite.vue +30 -0
- package/components/icons/IconVue.vue +6 -0
- package/components/icons/IconVueTelescope.vue +11 -0
- package/components/icons/IconWindi.vue +17 -0
- package/components/icons/IconX.vue +12 -0
- package/components/icons/IconXCircle.vue +10 -0
- package/components/icons/IconZap.vue +8 -0
- package/components/prose/ProseA.vue +66 -0
- package/components/prose/ProseBlockquote.vue +21 -0
- package/components/prose/ProseCode.vue +68 -0
- package/components/prose/ProseCodeInline.vue +38 -0
- package/components/prose/ProseEm.vue +11 -0
- package/components/prose/ProseH1.vue +22 -0
- package/components/prose/ProseH2.vue +22 -0
- package/components/prose/ProseH3.vue +24 -0
- package/components/prose/ProseH4.vue +24 -0
- package/components/prose/ProseHr.vue +13 -0
- package/components/prose/ProseImg.vue +32 -0
- package/components/prose/ProseLi.vue +31 -0
- package/components/prose/ProseOl.vue +16 -0
- package/components/prose/ProseP.vue +14 -0
- package/components/prose/ProseStrong.vue +14 -0
- package/components/prose/ProseTable.vue +13 -0
- package/{dist/runtime/app/components → components}/prose/ProseTbody.vue +0 -0
- package/components/prose/ProseTd.vue +11 -0
- package/components/prose/ProseTh.vue +11 -0
- package/components/prose/ProseThead.vue +11 -0
- package/components/prose/ProseTr.vue +11 -0
- package/components/prose/ProseUl.vue +15 -0
- package/composables/useContent.ts +155 -0
- package/composables/useMenu.ts +20 -0
- package/composables/useScrollToHeading.ts +35 -0
- package/composables/useScrollspy.ts +45 -0
- package/composables/useTheme.ts +10 -0
- package/layouts/default.vue +27 -0
- package/layouts/page.vue +11 -0
- package/nuxt.config.ts +151 -0
- package/package.json +46 -83
- package/pages/[...slug].vue +24 -0
- package/public/android-chrome-192x192.png +0 -0
- package/public/android-chrome-512x512.png +0 -0
- package/public/apple-touch-icon.png +0 -0
- package/public/favicon-16x16.png +0 -0
- package/public/favicon-32x32.png +0 -0
- package/public/favicon.ico +0 -0
- package/public/site.webmanifest +1 -0
- package/LICENSE +0 -21
- package/dist/index.cjs +0 -549
- package/dist/index.d.ts +0 -25
- package/dist/index.mjs +0 -523
- package/dist/runtime/app/components/DocusContent.vue +0 -215
- package/dist/runtime/app/components/DocusContent.vue.d.ts +0 -25
- package/dist/runtime/app/components/Error.vue +0 -19
- package/dist/runtime/app/components/Error.vue.d.ts +0 -9
- package/dist/runtime/app/components/Markdown.vue +0 -56
- package/dist/runtime/app/components/Markdown.vue.d.ts +0 -25
- package/dist/runtime/app/components/Page.vue +0 -29
- package/dist/runtime/app/components/Page.vue.d.ts +0 -2
- package/dist/runtime/app/components/Props.vue +0 -130
- package/dist/runtime/app/components/Props.vue.d.ts +0 -80
- package/dist/runtime/app/components/prose/ProseA.vue +0 -41
- package/dist/runtime/app/components/prose/ProseA.vue.d.ts +0 -23
- package/dist/runtime/app/components/prose/ProseBlockquote.vue +0 -5
- package/dist/runtime/app/components/prose/ProseCode.vue +0 -5
- package/dist/runtime/app/components/prose/ProseCodeInline.vue +0 -5
- package/dist/runtime/app/components/prose/ProseEm.vue +0 -5
- package/dist/runtime/app/components/prose/ProseH1.vue +0 -3
- package/dist/runtime/app/components/prose/ProseH2.vue +0 -3
- package/dist/runtime/app/components/prose/ProseH3.vue +0 -3
- package/dist/runtime/app/components/prose/ProseH4.vue +0 -3
- package/dist/runtime/app/components/prose/ProseH5.vue +0 -3
- package/dist/runtime/app/components/prose/ProseH6.vue +0 -3
- package/dist/runtime/app/components/prose/ProseImg.vue +0 -32
- package/dist/runtime/app/components/prose/ProseImg.vue.d.ts +0 -21
- package/dist/runtime/app/components/prose/ProseLi.vue +0 -3
- package/dist/runtime/app/components/prose/ProseParagraph.vue +0 -3
- package/dist/runtime/app/components/prose/ProseStrong.vue +0 -5
- package/dist/runtime/app/components/prose/ProseTable.vue +0 -5
- package/dist/runtime/app/components/prose/ProseTd.vue +0 -5
- package/dist/runtime/app/components/prose/ProseTh.vue +0 -5
- package/dist/runtime/app/components/prose/ProseThead.vue +0 -5
- package/dist/runtime/app/components/prose/ProseTr.vue +0 -5
- package/dist/runtime/app/components/prose/ProseUl.vue +0 -5
- package/dist/runtime/app/composables/helpers.d.ts +0 -4
- package/dist/runtime/app/composables/helpers.js +0 -66
- package/dist/runtime/app/composables/helpers.mjs +0 -40
- package/dist/runtime/app/composables/index.d.ts +0 -90
- package/dist/runtime/app/composables/index.js +0 -108
- package/dist/runtime/app/composables/index.mjs +0 -63
- package/dist/runtime/app/composables/navigation.d.ts +0 -37
- package/dist/runtime/app/composables/navigation.js +0 -227
- package/dist/runtime/app/composables/navigation.mjs +0 -148
- package/dist/runtime/app/composables/store.d.ts +0 -7
- package/dist/runtime/app/composables/store.js +0 -52
- package/dist/runtime/app/composables/store.mjs +0 -35
- package/dist/runtime/app/composables/style.d.ts +0 -11
- package/dist/runtime/app/composables/style.js +0 -117
- package/dist/runtime/app/composables/style.mjs +0 -71
- package/dist/runtime/app/composables/theme-colors.d.ts +0 -30
- package/dist/runtime/app/composables/theme-colors.js +0 -80
- package/dist/runtime/app/composables/theme-colors.mjs +0 -48
- package/dist/runtime/app/composables/websocket.d.ts +0 -3
- package/dist/runtime/app/composables/websocket.js +0 -79
- package/dist/runtime/app/composables/websocket.mjs +0 -63
- package/dist/runtime/app/layouts/default.vue +0 -5
- package/dist/runtime/app/layouts/error.vue +0 -33
- package/dist/runtime/app/layouts/error.vue.d.ts +0 -21
- package/dist/runtime/app/pages/_.vue +0 -222
- package/dist/runtime/app/pages/_.vue.d.ts +0 -2
- package/dist/runtime/context.d.ts +0 -1
- package/dist/runtime/context.js +0 -17
- package/dist/runtime/context.mjs +0 -5
- package/dist/runtime/database/Query.d.ts +0 -18
- package/dist/runtime/database/Query.js +0 -68
- package/dist/runtime/database/Query.mjs +0 -49
- package/dist/runtime/database/index.d.ts +0 -4
- package/dist/runtime/database/index.js +0 -45
- package/dist/runtime/database/index.mjs +0 -25
- package/dist/runtime/database/providers/local/Query.d.ts +0 -14
- package/dist/runtime/database/providers/local/Query.js +0 -85
- package/dist/runtime/database/providers/local/Query.mjs +0 -60
- package/dist/runtime/database/providers/local/index.d.ts +0 -3
- package/dist/runtime/database/providers/local/index.js +0 -63
- package/dist/runtime/database/providers/local/index.mjs +0 -39
- package/dist/runtime/database/providers/local/operations.d.ts +0 -2
- package/dist/runtime/database/providers/local/operations.js +0 -83
- package/dist/runtime/database/providers/local/operations.mjs +0 -53
- package/dist/runtime/database/providers/local/utils.d.ts +0 -8
- package/dist/runtime/database/providers/local/utils.js +0 -28
- package/dist/runtime/database/providers/local/utils.mjs +0 -17
- package/dist/runtime/index.d.ts +0 -3
- package/dist/runtime/index.js +0 -44
- package/dist/runtime/index.mjs +0 -3
- package/dist/runtime/navigation.d.ts +0 -4
- package/dist/runtime/navigation.js +0 -176
- package/dist/runtime/navigation.mjs +0 -137
- package/dist/runtime/server/api/get.d.ts +0 -10
- package/dist/runtime/server/api/get.js +0 -24
- package/dist/runtime/server/api/get.mjs +0 -13
- package/dist/runtime/server/api/list.d.ts +0 -9
- package/dist/runtime/server/api/list.js +0 -34
- package/dist/runtime/server/api/list.mjs +0 -18
- package/dist/runtime/server/api/navigation.d.ts +0 -7
- package/dist/runtime/server/api/navigation.js +0 -20
- package/dist/runtime/server/api/navigation.mjs +0 -10
- package/dist/runtime/server/api/preview.d.ts +0 -3
- package/dist/runtime/server/api/preview.js +0 -54
- package/dist/runtime/server/api/preview.mjs +0 -31
- package/dist/runtime/server/api/reload.d.ts +0 -6
- package/dist/runtime/server/api/reload.js +0 -27
- package/dist/runtime/server/api/reload.mjs +0 -11
- package/dist/runtime/server/api/search.d.ts +0 -6
- package/dist/runtime/server/api/search.js +0 -27
- package/dist/runtime/server/api/search.mjs +0 -13
- package/dist/runtime/server/content.d.ts +0 -46
- package/dist/runtime/server/content.js +0 -175
- package/dist/runtime/server/content.mjs +0 -114
- package/dist/runtime/server/socket.d.ts +0 -9
- package/dist/runtime/server/socket.js +0 -33
- package/dist/runtime/server/socket.mjs +0 -20
- package/dist/runtime/server/utils/cache.d.ts +0 -19
- package/dist/runtime/server/utils/cache.js +0 -110
- package/dist/runtime/server/utils/cache.mjs +0 -75
- package/dist/runtime/server/utils/index.d.ts +0 -4
- package/dist/runtime/server/utils/index.js +0 -18
- package/dist/runtime/server/utils/index.mjs +0 -8
- package/dist/runtime/transformers/index.d.ts +0 -1
- package/dist/runtime/transformers/index.js +0 -26
- package/dist/runtime/transformers/index.mjs +0 -11
- package/dist/runtime/transformers/json.d.ts +0 -3
- package/dist/runtime/transformers/json.js +0 -15
- package/dist/runtime/transformers/json.mjs +0 -5
- package/dist/runtime/transformers/markdown/index.d.ts +0 -8
- package/dist/runtime/transformers/markdown/index.js +0 -25
- package/dist/runtime/transformers/markdown/index.mjs +0 -16
- package/dist/runtime/transformers/utils/index.d.ts +0 -1
- package/dist/runtime/transformers/utils/index.js +0 -18
- package/dist/runtime/transformers/utils/index.mjs +0 -1
- package/dist/runtime/transformers/utils/path.d.ts +0 -26
- package/dist/runtime/transformers/utils/path.js +0 -88
- package/dist/runtime/transformers/utils/path.mjs +0 -56
- package/dist/runtime/utils/index.d.ts +0 -1
- package/dist/runtime/utils/index.js +0 -18
- package/dist/runtime/utils/index.mjs +0 -1
- package/dist/runtime/utils/log.d.ts +0 -1
- package/dist/runtime/utils/log.js +0 -14
- package/dist/runtime/utils/log.mjs +0 -2
- package/dist/runtime/utils/object.d.ts +0 -9
- package/dist/runtime/utils/object.js +0 -22
- package/dist/runtime/utils/object.mjs +0 -4
- package/dist/templates/content.mjs +0 -50
- package/dist/templates/docus.mjs +0 -13
- package/dist/templates/hot.mjs +0 -16
- package/dist/templates/i18n.mjs +0 -23
- package/dist/templates/options.mjs +0 -46
- package/shims.d.ts +0 -24
- package/types.d.ts +0 -397
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineProps({
|
|
3
|
+
cta: {
|
|
4
|
+
type: Array,
|
|
5
|
+
default: () => ['Get started', '/get-started'],
|
|
6
|
+
},
|
|
7
|
+
secondary: {
|
|
8
|
+
type: Array,
|
|
9
|
+
default: () => ['Open on GitHub', 'https://github.com'],
|
|
10
|
+
},
|
|
11
|
+
snippet: {
|
|
12
|
+
type: [String, Boolean],
|
|
13
|
+
default: () => false,
|
|
14
|
+
},
|
|
15
|
+
})
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<section class="py-12 lg:py-24">
|
|
20
|
+
<Container class="flex flex-col lg:flex-row my-8 md:my-16">
|
|
21
|
+
<div class="flex flex-col items-center pr-0 lg:items-start lg:pr-8 lg:w-2/3">
|
|
22
|
+
<h2
|
|
23
|
+
class="mb-4 text-4xl xs:text-5xl font-semibold sm:leading-none tracking-tighter text-center text-gray-900 lg:text-left dark:text-gray-100 sm:text-6xl lg:text-7xl sm:mb-8"
|
|
24
|
+
>
|
|
25
|
+
<Markdown use="title" unwrap="p" />
|
|
26
|
+
</h2>
|
|
27
|
+
<p
|
|
28
|
+
class="mb-8 text-lg text-center text-gray-700 font-medium tracking-tight lg:text-left sm:text-xl xl:text-xl leading-base sm:mb-12 dark:text-gray-300"
|
|
29
|
+
>
|
|
30
|
+
<Markdown use="description" unwrap="p" />
|
|
31
|
+
</p>
|
|
32
|
+
|
|
33
|
+
<div class="flex flex-col sm:flex-row items-center space-y-4 sm:space-y-0 sm:space-x-4 lg:space-x-6 mb-8">
|
|
34
|
+
<ButtonLink v-if="cta" class="mx-auto md:mx-0" bold size="large" :href="cta[1]">
|
|
35
|
+
{{ cta[0] }}
|
|
36
|
+
</ButtonLink>
|
|
37
|
+
|
|
38
|
+
<a
|
|
39
|
+
v-if="secondary"
|
|
40
|
+
:href="secondary[1]"
|
|
41
|
+
class="py-px mt-px font-medium text-primary-500 border-b-1 border-transparent dark:text-primary-400 hover:border-primary-500 dark:hover:border-primary-400"
|
|
42
|
+
>
|
|
43
|
+
{{ secondary[0] }}
|
|
44
|
+
</a>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
<div v-if="snippet" class="w-full mx-auto lg:w-1/3 sm:w-580px">
|
|
48
|
+
<div class="md:pl-2 md:mx">
|
|
49
|
+
<Terminal :snippet="snippet" />
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
</Container>
|
|
53
|
+
</section>
|
|
54
|
+
</template>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { hasProtocol } from 'ufo'
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
href: {
|
|
6
|
+
type: String,
|
|
7
|
+
default: '',
|
|
8
|
+
},
|
|
9
|
+
size: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: 'medium',
|
|
12
|
+
},
|
|
13
|
+
bold: {
|
|
14
|
+
type: Boolean,
|
|
15
|
+
default: false,
|
|
16
|
+
},
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
const isExternal = computed(
|
|
20
|
+
() => hasProtocol(props.href, true),
|
|
21
|
+
)
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<template>
|
|
25
|
+
<NuxtLink class="button-link" :class="[size, bold ? 'font-semibold' : 'font-medium']" :to="href">
|
|
26
|
+
<Markdown :use="$slots.default" unwrap="p ul li" />
|
|
27
|
+
|
|
28
|
+
<IconExternalLink v-if="isExternal" class="w-4 h-4 ml-2" />
|
|
29
|
+
</NuxtLink>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<style lang="postcss" scoped>
|
|
33
|
+
a.button-link {
|
|
34
|
+
@apply inline-flex items-center flex-none rounded-md px-3 py-1.5 text-sm leading-4 text-white transition-colors duration-200 border border-transparent bg-primary-500 hover:bg-primary-600 focus:ring-2 focus:ring-offset-2 focus:ring-offset-white dark:focus:ring-offset-gray-900 focus:ring-primary-600 focus:outline-none;
|
|
35
|
+
|
|
36
|
+
&.medium {
|
|
37
|
+
@apply px-4 py-2 text-base leading-4;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&.large {
|
|
41
|
+
@apply px-6 py-2.5 text-lg leading-6;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
</style>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineProps({
|
|
3
|
+
title: {
|
|
4
|
+
type: String,
|
|
5
|
+
required: true,
|
|
6
|
+
},
|
|
7
|
+
description: {
|
|
8
|
+
type: String,
|
|
9
|
+
default: '',
|
|
10
|
+
},
|
|
11
|
+
icon: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: '',
|
|
14
|
+
},
|
|
15
|
+
iconClass: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: '',
|
|
18
|
+
},
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
const isImage = (icon: string) => String(icon).includes('.')
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<template>
|
|
25
|
+
<div class="flex">
|
|
26
|
+
<div class="relative w-full p-6 bg-gray-200 rounded-lg dark:bg-gray-800 dark:bg-opacity-50">
|
|
27
|
+
<img v-if="isImage(icon)" :src="icon" class="inline-block w-16 h-16 mb-3">
|
|
28
|
+
<component :is="icon" v-else class="inline-block w-16 h-16 mb-3 text-6xl" />
|
|
29
|
+
|
|
30
|
+
<slot />
|
|
31
|
+
|
|
32
|
+
<div class="text-lg">
|
|
33
|
+
<h3 class="mb-2 font-semibold tracking-tight inline mr-1">
|
|
34
|
+
{{ title }}
|
|
35
|
+
</h3>
|
|
36
|
+
<div class="inline font-medium text-primary">
|
|
37
|
+
<slot name="description">
|
|
38
|
+
<p v-if="description" class="inline font-medium tracking-tight">
|
|
39
|
+
{{ description }}
|
|
40
|
+
</p>
|
|
41
|
+
</slot>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineProps({
|
|
3
|
+
title: {
|
|
4
|
+
type: String,
|
|
5
|
+
default: 'Features',
|
|
6
|
+
},
|
|
7
|
+
})
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<section class="py-12 lg:py-24 bg-gray-50 dark:bg-gray-800 dark:bg-opacity-25">
|
|
12
|
+
<Container>
|
|
13
|
+
<h2 class="mb-8 text-3xl font-semibold tracking-tight text-gray-900 sm:text-4xl dark:text-gray-100">
|
|
14
|
+
<slot name="title" />
|
|
15
|
+
</h2>
|
|
16
|
+
<div
|
|
17
|
+
class="grid gap-4 font-semibold text-left text-gray-900 dark:text-gray-100 sm:grid-cols-2 lg:grid-cols-3 2xl:gap-8"
|
|
18
|
+
>
|
|
19
|
+
<slot />
|
|
20
|
+
</div>
|
|
21
|
+
</Container>
|
|
22
|
+
</section>
|
|
23
|
+
</template>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineProps({
|
|
3
|
+
/**
|
|
4
|
+
* Label to display for the tab
|
|
5
|
+
*/
|
|
6
|
+
label: {
|
|
7
|
+
type: String,
|
|
8
|
+
required: true,
|
|
9
|
+
},
|
|
10
|
+
/**
|
|
11
|
+
* Select which tab should be active
|
|
12
|
+
*/
|
|
13
|
+
active: {
|
|
14
|
+
type: Boolean,
|
|
15
|
+
default: false,
|
|
16
|
+
},
|
|
17
|
+
/**
|
|
18
|
+
* Preiew block are bordered and have small padding.
|
|
19
|
+
*/
|
|
20
|
+
preview: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: false,
|
|
23
|
+
},
|
|
24
|
+
})
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<template>
|
|
28
|
+
<div
|
|
29
|
+
class="code-block"
|
|
30
|
+
:class="{
|
|
31
|
+
active: active,
|
|
32
|
+
'p-4 border-2 border-t-0 border-gray-100 dark:border-gray-800 rounded-b-lg': preview
|
|
33
|
+
}"
|
|
34
|
+
>
|
|
35
|
+
<slot />
|
|
36
|
+
</div>
|
|
37
|
+
</template>
|
|
38
|
+
|
|
39
|
+
<style scoped>
|
|
40
|
+
.code-block {
|
|
41
|
+
display: none;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.code-block.active {
|
|
45
|
+
display: block;
|
|
46
|
+
}
|
|
47
|
+
</style>
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import TabsHeader from './TabsHeader.vue'
|
|
3
|
+
|
|
4
|
+
const isTag = (slot: any, tag: string) => {
|
|
5
|
+
return slot.type && slot.type.tag && slot.type.tag === tag
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export default defineComponent({
|
|
9
|
+
data() {
|
|
10
|
+
return {
|
|
11
|
+
activeTabIndex: 0,
|
|
12
|
+
/**
|
|
13
|
+
* A simple number that increases on every changes
|
|
14
|
+
*/
|
|
15
|
+
counter: 0,
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
render() {
|
|
19
|
+
const slots = this.$slots.default()
|
|
20
|
+
const tabs = slots
|
|
21
|
+
.filter(
|
|
22
|
+
slot =>
|
|
23
|
+
isTag(slot, 'code-block')
|
|
24
|
+
|| isTag(slot, 'code'),
|
|
25
|
+
)
|
|
26
|
+
.map((slot, index) => {
|
|
27
|
+
return {
|
|
28
|
+
label: slot?.props?.filename || slot?.props?.label || `${index}`,
|
|
29
|
+
active: slot?.props?.active || false,
|
|
30
|
+
component: slot,
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
return h(
|
|
35
|
+
'div',
|
|
36
|
+
{
|
|
37
|
+
class: {
|
|
38
|
+
'code-group': true,
|
|
39
|
+
'first-tab': this.activeTabIndex === 0,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
[
|
|
43
|
+
h(
|
|
44
|
+
TabsHeader,
|
|
45
|
+
{
|
|
46
|
+
'ref': 'tabs-header',
|
|
47
|
+
'activeTabIndex': this.activeTabIndex,
|
|
48
|
+
tabs,
|
|
49
|
+
'onUpdate:activeTabIndex': $event => (this.activeTabIndex = $event),
|
|
50
|
+
},
|
|
51
|
+
),
|
|
52
|
+
h(
|
|
53
|
+
'div',
|
|
54
|
+
{
|
|
55
|
+
class: 'code-group-content',
|
|
56
|
+
text: this.activeTabIndex,
|
|
57
|
+
},
|
|
58
|
+
// Map slots to content children
|
|
59
|
+
slots.map(
|
|
60
|
+
(slot, index) => h(
|
|
61
|
+
'div',
|
|
62
|
+
{
|
|
63
|
+
// Current slot is displayed, others are hidden
|
|
64
|
+
style: { display: index === this.activeTabIndex ? 'block' : 'none' },
|
|
65
|
+
class: {
|
|
66
|
+
'': !isTag(slot, 'code'),
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
// Display direct children if not a ```code``` block
|
|
70
|
+
[
|
|
71
|
+
isTag(slot, 'code')
|
|
72
|
+
? slot
|
|
73
|
+
: h(
|
|
74
|
+
'div',
|
|
75
|
+
{
|
|
76
|
+
class: {
|
|
77
|
+
'preview-canvas': true,
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
[slot.children.default()],
|
|
81
|
+
),
|
|
82
|
+
],
|
|
83
|
+
),
|
|
84
|
+
),
|
|
85
|
+
),
|
|
86
|
+
],
|
|
87
|
+
)
|
|
88
|
+
},
|
|
89
|
+
})
|
|
90
|
+
</script>
|
|
91
|
+
|
|
92
|
+
<style lang="postcss">
|
|
93
|
+
.prose {
|
|
94
|
+
li {
|
|
95
|
+
.code-group {
|
|
96
|
+
@apply my-4;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
html.dark {
|
|
102
|
+
.code-group-content {
|
|
103
|
+
.preview-canvas {
|
|
104
|
+
@apply p-4 my-0 overflow-x-auto leading-normal bg-gray-900 rounded-lg rounded-tl-none rounded-tr-none z-0;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
</style>
|
|
109
|
+
|
|
110
|
+
<style scoped lang="postcss">
|
|
111
|
+
.code-group {
|
|
112
|
+
:deep(.prose-code) {
|
|
113
|
+
@apply mt-0 rounded-tl-none rounded-tr-none !important;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
:deep(pre) {
|
|
117
|
+
@apply mt-0 !important;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
:deep(.filename) {
|
|
121
|
+
@apply hidden;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.code-group-content {
|
|
126
|
+
.preview-canvas {
|
|
127
|
+
@apply p-4 my-0 overflow-x-auto leading-normal bg-gray-100 dark:bg-gray-800 rounded-bl-lg rounded-br-lg z-0;
|
|
128
|
+
|
|
129
|
+
& > * {
|
|
130
|
+
@apply my-0;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
</style>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import Clipboard from 'clipboard'
|
|
3
|
+
|
|
4
|
+
const copy = ref()
|
|
5
|
+
const state = ref('init')
|
|
6
|
+
|
|
7
|
+
onMounted(() => {
|
|
8
|
+
const copyCode = new Clipboard(copy.value, {
|
|
9
|
+
target(trigger) {
|
|
10
|
+
return trigger.previousElementSibling
|
|
11
|
+
},
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
copyCode.on('success', (event) => {
|
|
15
|
+
event.clearSelection()
|
|
16
|
+
state.value = 'copied'
|
|
17
|
+
window.setTimeout(() => {
|
|
18
|
+
state.value = 'init'
|
|
19
|
+
}, 1000)
|
|
20
|
+
})
|
|
21
|
+
})
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<template>
|
|
25
|
+
<button
|
|
26
|
+
ref="copy"
|
|
27
|
+
class="
|
|
28
|
+
copy
|
|
29
|
+
focus:outline-none
|
|
30
|
+
absolute
|
|
31
|
+
right-1
|
|
32
|
+
bottom-1
|
|
33
|
+
px-2
|
|
34
|
+
py-2
|
|
35
|
+
m-1
|
|
36
|
+
text-gray-400
|
|
37
|
+
bg-gray-900
|
|
38
|
+
text-xs
|
|
39
|
+
leading-none
|
|
40
|
+
rounded-lg
|
|
41
|
+
font-mono
|
|
42
|
+
font-semibold
|
|
43
|
+
"
|
|
44
|
+
>
|
|
45
|
+
<Icon v-if="state === 'copied'" name="fa-check" class="w-4 h-4" />
|
|
46
|
+
<Icon v-else name="fa-copy" class="w-4 h-4" />
|
|
47
|
+
</button>
|
|
48
|
+
</template>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineProps({
|
|
3
|
+
to: {
|
|
4
|
+
type: String,
|
|
5
|
+
required: true,
|
|
6
|
+
default: '/community/contribution#documentation-guide',
|
|
7
|
+
},
|
|
8
|
+
icon: {
|
|
9
|
+
type: String,
|
|
10
|
+
required: true,
|
|
11
|
+
default: '🚧',
|
|
12
|
+
},
|
|
13
|
+
})
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<Alert type="warning" :icon="icon">
|
|
18
|
+
Documentation for this section is not yet complete. You can
|
|
19
|
+
<NuxtLink :to="to">
|
|
20
|
+
contribute to the documentation.
|
|
21
|
+
</NuxtLink>
|
|
22
|
+
</Alert>
|
|
23
|
+
</template>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { splitByCase, upperFirst } from 'scule'
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
link: {
|
|
6
|
+
type: String,
|
|
7
|
+
required: true,
|
|
8
|
+
},
|
|
9
|
+
title: {
|
|
10
|
+
type: String,
|
|
11
|
+
required: false,
|
|
12
|
+
default: '',
|
|
13
|
+
},
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
// Guess title from link!
|
|
17
|
+
const computedTitle = computed(() => (props.title || props.link).split('/').filter(Boolean).map(part => splitByCase(part).map(p => upperFirst(p)).join(' ')).join(' > '))
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<Alert icon="👉">
|
|
22
|
+
Read more in <NuxtLink :to="link" v-html="computedTitle" />.
|
|
23
|
+
</Alert>
|
|
24
|
+
</template>
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const props = defineProps({
|
|
3
|
+
src: {
|
|
4
|
+
type: String,
|
|
5
|
+
default: '',
|
|
6
|
+
},
|
|
7
|
+
repo: {
|
|
8
|
+
type: String,
|
|
9
|
+
default: '',
|
|
10
|
+
},
|
|
11
|
+
branch: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: '',
|
|
14
|
+
},
|
|
15
|
+
dir: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: '',
|
|
18
|
+
},
|
|
19
|
+
file: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: 'app.vue',
|
|
22
|
+
},
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
const colorMode = useColorMode()
|
|
26
|
+
|
|
27
|
+
const providers = {
|
|
28
|
+
CodeSandBox: () => `https://codesandbox.io/embed/github/${props.repo}/tree/${props.branch}/${props.dir}?hidenavigation=1&theme=${colorMode.value}`,
|
|
29
|
+
StackBlitz: () => `https://stackblitz.com/github/${props.repo}/tree/${props.branch}/${props.dir}?embed=1&file=${props.file}&theme=${colorMode.value}`,
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const providersTabs = Object.keys(providers).map(p => ({ label: p }))
|
|
33
|
+
const activeTabIndex = ref(-1)
|
|
34
|
+
const tabs = ref()
|
|
35
|
+
const url = ref('')
|
|
36
|
+
const provider = ref('')
|
|
37
|
+
|
|
38
|
+
const changeProvider = (value) => {
|
|
39
|
+
provider.value = value
|
|
40
|
+
url.value = props.src || providers[provider.value]()
|
|
41
|
+
localStorage.setItem('docus_sandbox', value)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const sandBoxUrl = computed(() => url.value?.replace('?embed=1&', '?').replace('/embed/', '/s/'))
|
|
45
|
+
|
|
46
|
+
const updateTab = (i: number) => {
|
|
47
|
+
activeTabIndex.value = i
|
|
48
|
+
changeProvider(providersTabs[i].label)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
onMounted(() => {
|
|
52
|
+
// TODO: if Safari, use CodeSandBox by default: const defaultSandbox = ...
|
|
53
|
+
provider.value = window.localStorage.getItem('docus_sandbox') || 'CodeSandBox'
|
|
54
|
+
|
|
55
|
+
url.value = props.src || providers[provider.value]()
|
|
56
|
+
|
|
57
|
+
// Set active tab
|
|
58
|
+
activeTabIndex.value = Object.keys(providers).indexOf(provider.value)
|
|
59
|
+
|
|
60
|
+
setTimeout(() => tabs.value.updateTabs(activeTabIndex.value), 100)
|
|
61
|
+
})
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<template>
|
|
65
|
+
<div class="w-full min-h-[500px] mx-auto mb-6 overflow-hidden text-3xl rounded-md sandbox mt-4">
|
|
66
|
+
<TabsHeader
|
|
67
|
+
v-if="!src"
|
|
68
|
+
ref="tabs"
|
|
69
|
+
:active-tab-index="activeTabIndex"
|
|
70
|
+
:tabs="providersTabs"
|
|
71
|
+
@update:active-tab-index="updateTab"
|
|
72
|
+
>
|
|
73
|
+
<template #footer>
|
|
74
|
+
<div class="absolute top-1/2 transform -translate-y-1/2 right-0 px-2">
|
|
75
|
+
<Link class="flex items-center text-gray-500 dark:text-gray-400" :to="sandBoxUrl" blank>
|
|
76
|
+
<IconExternalLink class="h-5 w-5" />
|
|
77
|
+
</Link>
|
|
78
|
+
</div>
|
|
79
|
+
</template>
|
|
80
|
+
</TabsHeader>
|
|
81
|
+
|
|
82
|
+
<iframe
|
|
83
|
+
v-if="url"
|
|
84
|
+
:src="url"
|
|
85
|
+
title="Sandbox editor"
|
|
86
|
+
sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"
|
|
87
|
+
class="w-full h-full min-h-[700px] overflow-hidden bg-gray-100 dark:bg-gray-800"
|
|
88
|
+
/>
|
|
89
|
+
|
|
90
|
+
<span v-else class="text-white flex-1">Loading Sandbox...</span>
|
|
91
|
+
</div>
|
|
92
|
+
</template>
|
|
93
|
+
|
|
94
|
+
<style lang="postcss" scoped>
|
|
95
|
+
.sandbox,
|
|
96
|
+
.sandbox iframe {
|
|
97
|
+
@apply w-full rounded-md rounded-tl-none rounded-tr-none overflow-hidden h-64;
|
|
98
|
+
height: 700px;
|
|
99
|
+
}
|
|
100
|
+
</style>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { PropType } from 'vue'
|
|
3
|
+
|
|
4
|
+
defineProps({
|
|
5
|
+
tabs: {
|
|
6
|
+
type: Array as PropType<{ label: string }[]>,
|
|
7
|
+
required: true,
|
|
8
|
+
},
|
|
9
|
+
activeTabIndex: {
|
|
10
|
+
type: Number,
|
|
11
|
+
required: true,
|
|
12
|
+
},
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
defineEmits(['update:activeTabIndex'])
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<div class="relative text-white rounded-t-lg bg-gray-200 dark:bg-gray-700">
|
|
20
|
+
<div v-if="tabs" class="relative z-0 px-2">
|
|
21
|
+
<button
|
|
22
|
+
v-for="({ label }, i) in tabs"
|
|
23
|
+
ref="tabs"
|
|
24
|
+
:key="`${i}${label}`"
|
|
25
|
+
class="relative px-3 py-1.5 xs:py-3 my-1.5 xs:my-0 text-sm font-mono font-medium tracking-tight focus:outline-none font-bold"
|
|
26
|
+
:class="[activeTabIndex === i ? 'active text-gray-800 dark:text-white' : 'text-gray-600 dark:text-gray-400']"
|
|
27
|
+
@click="$emit('update:activeTabIndex', i)"
|
|
28
|
+
>
|
|
29
|
+
{{ label }}
|
|
30
|
+
</button>
|
|
31
|
+
<span ref="highlight-underline" class="absolute -z-[1] highlight-underline h-full xs:py-1.5">
|
|
32
|
+
<span class="flex w-full h-full bg-gray-300 dark:bg-gray-600 rounded-md" />
|
|
33
|
+
</span>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<style scoped>
|
|
39
|
+
.highlight-underline {
|
|
40
|
+
/* bottom: -2px; */
|
|
41
|
+
/* height: 2px; */
|
|
42
|
+
transition: left 150ms, top 150ms, width 150ms, height 150ms;
|
|
43
|
+
}
|
|
44
|
+
</style>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Clipboard from 'clipboard'
|
|
3
|
+
|
|
4
|
+
export default defineComponent({
|
|
5
|
+
props: {
|
|
6
|
+
snippet: {
|
|
7
|
+
type: String,
|
|
8
|
+
required: true,
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
setup() {
|
|
12
|
+
const copyInstall = ref()
|
|
13
|
+
const copied = ref(false)
|
|
14
|
+
|
|
15
|
+
const setupCopyInstall = () => {
|
|
16
|
+
if (!copyInstall.value)
|
|
17
|
+
return nextTick(setupCopyInstall)
|
|
18
|
+
|
|
19
|
+
const instance = new Clipboard(copyInstall.value)
|
|
20
|
+
|
|
21
|
+
instance.on('success', () => {
|
|
22
|
+
copied.value = true
|
|
23
|
+
|
|
24
|
+
setTimeout(() => {
|
|
25
|
+
copied.value = false
|
|
26
|
+
}, 1000)
|
|
27
|
+
})
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
onMounted(() => setupCopyInstall())
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
copyInstall,
|
|
34
|
+
copied,
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
})
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<template>
|
|
41
|
+
<div
|
|
42
|
+
ref="copyInstall"
|
|
43
|
+
:data-clipboard-text="snippet"
|
|
44
|
+
class="relative flex flex-col w-full h-64 overflow-hidden text-gray-600 bg-gray-800 rounded-lg cursor-pointer group"
|
|
45
|
+
>
|
|
46
|
+
<div v-if="copied" class="absolute top-0 left-0 z-10 flex items-center justify-center w-full h-full">
|
|
47
|
+
<div class="absolute top-0 left-0 w-full h-full bg-gray-900 opacity-75" />
|
|
48
|
+
<div class="z-10 text-lg font-medium text-gray-100">
|
|
49
|
+
Copied!
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
<div class="relative flex items-center w-full h-12 border-b border-gray-700">
|
|
53
|
+
<div class="flex ml-4">
|
|
54
|
+
<div class="w-3 h-3 bg-red-400 rounded-full" />
|
|
55
|
+
<div class="w-3 h-3 ml-2 bg-yellow-400 rounded-full" />
|
|
56
|
+
<div class="w-3 h-3 ml-2 bg-green-400 rounded-full" />
|
|
57
|
+
</div>
|
|
58
|
+
<div class="absolute top-0 left-0 flex items-center justify-center w-full h-full">
|
|
59
|
+
Bash
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
<div class="flex flex-1 p-4 font-mono">
|
|
63
|
+
<span class="inline-block mr-2 font-bold select-none">$</span>
|
|
64
|
+
<span class="inline-block text-gray-200">{{ snippet }}</span>
|
|
65
|
+
</div>
|
|
66
|
+
<div class="py-2 text-center transition-opacity opacity-0 group-hover:opacity-100">
|
|
67
|
+
Click to copy
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
</template>
|