docus 2.1.0 → 3.0.0-beta.3
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 +25 -0
- package/components/app/Footer.vue +40 -0
- package/components/app/Navbar.vue +26 -0
- package/components/app/NavbarLogo.vue +33 -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 +45 -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 +135 -0
- package/components/content/CopyButton.vue +49 -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 +25 -0
- package/components/content/Sandbox.vue +102 -0
- package/components/content/TabsHeader.vue +44 -0
- package/components/content/Terminal.vue +64 -0
- package/components/content/VideoPlayer.vue +115 -0
- package/components/docs/DocsAside.vue +21 -0
- package/components/docs/DocsAsideTree.vue +102 -0
- package/components/docs/DocsHero.vue +39 -0
- package/components/docs/DocsPage.vue +22 -0
- package/components/docs/DocsPageContent.vue +31 -0
- package/components/docs/DocsToc.vue +74 -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 +45 -0
- package/components/globals/SocialIcons.vue +45 -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 +30 -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 +156 -0
- package/composables/useMenu.ts +22 -0
- package/composables/useScrollToHeading.ts +35 -0
- package/composables/useScrollspy.ts +46 -0
- package/composables/useTheme.ts +12 -0
- package/layouts/default.vue +29 -0
- package/layouts/page.vue +11 -0
- package/nuxt.config.ts +151 -0
- package/package.json +46 -83
- package/pages/[...slug].vue +26 -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,10 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<path
|
|
4
|
+
d="M0.877075 7.49988C0.877075 3.84219 3.84222 0.877045 7.49991 0.877045C11.1576 0.877045 14.1227 3.84219 14.1227 7.49988C14.1227 11.1575 11.1576 14.1227 7.49991 14.1227C3.84222 14.1227 0.877075 11.1575 0.877075 7.49988ZM7.49991 1.82704C4.36689 1.82704 1.82708 4.36686 1.82708 7.49988C1.82708 10.6329 4.36689 13.1727 7.49991 13.1727C10.6329 13.1727 13.1727 10.6329 13.1727 7.49988C13.1727 4.36686 10.6329 1.82704 7.49991 1.82704ZM9.85358 5.14644C10.0488 5.3417 10.0488 5.65829 9.85358 5.85355L8.20713 7.49999L9.85358 9.14644C10.0488 9.3417 10.0488 9.65829 9.85358 9.85355C9.65832 10.0488 9.34173 10.0488 9.14647 9.85355L7.50002 8.2071L5.85358 9.85355C5.65832 10.0488 5.34173 10.0488 5.14647 9.85355C4.95121 9.65829 4.95121 9.3417 5.14647 9.14644L6.79292 7.49999L5.14647 5.85355C4.95121 5.65829 4.95121 5.3417 5.14647 5.14644C5.34173 4.95118 5.65832 4.95118 5.85358 5.14644L7.50002 6.79289L9.14647 5.14644C9.34173 4.95118 9.65832 4.95118 9.85358 5.14644Z"
|
|
5
|
+
fill="currentColor"
|
|
6
|
+
fill-rule="evenodd"
|
|
7
|
+
clip-rule="evenodd"
|
|
8
|
+
/>
|
|
9
|
+
</svg>
|
|
10
|
+
</template>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 48 48" width="64" height="64">
|
|
3
|
+
<polygon
|
|
4
|
+
fill="#ffae0b"
|
|
5
|
+
points="16.828,5.828 29.966,5.828 25.172,19.414 33.966,19.414 18.621,43.138 21.034,26.379 12.828,26.379"
|
|
6
|
+
/>
|
|
7
|
+
</svg>
|
|
8
|
+
</template>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineProps({
|
|
3
|
+
href: {
|
|
4
|
+
type: String,
|
|
5
|
+
default: '',
|
|
6
|
+
},
|
|
7
|
+
blank: {
|
|
8
|
+
type: Boolean,
|
|
9
|
+
default: false,
|
|
10
|
+
},
|
|
11
|
+
/**
|
|
12
|
+
* `true` if `href` points to a static file
|
|
13
|
+
*/
|
|
14
|
+
static: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: false,
|
|
17
|
+
},
|
|
18
|
+
})
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<template>
|
|
22
|
+
<NuxtLink :to="href" :blank="blank" :static="static">
|
|
23
|
+
<slot />
|
|
24
|
+
</NuxtLink>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<style lang="postcss" scoped>
|
|
28
|
+
:not(h1, h2, h3, h4) > a {
|
|
29
|
+
@apply font-medium no-underline d-prose-a-text d-prose-a-border hover:d-prose-a-border-hover;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
h1 a,
|
|
33
|
+
h2 a,
|
|
34
|
+
h3 a,
|
|
35
|
+
h4 a {
|
|
36
|
+
@apply relative;
|
|
37
|
+
&::after {
|
|
38
|
+
@apply absolute pl-2 w-5 h-5 opacity-0;
|
|
39
|
+
content: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="%23111827"%3E%3Cpath stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1" /%3E%3C/svg%3E');
|
|
40
|
+
}
|
|
41
|
+
&:hover {
|
|
42
|
+
&::after {
|
|
43
|
+
@apply opacity-100;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* Hover underline */
|
|
48
|
+
&:before {
|
|
49
|
+
@apply absolute top-0 left-0 w-full;
|
|
50
|
+
content: '';
|
|
51
|
+
height: calc(100% + 4px);
|
|
52
|
+
}
|
|
53
|
+
&:hover:before {
|
|
54
|
+
@apply d-prose-a-headline-border;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.dark h1 a,
|
|
59
|
+
.dark h2 a,
|
|
60
|
+
.dark h3 a,
|
|
61
|
+
.dark h4 a {
|
|
62
|
+
&::after {
|
|
63
|
+
content: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="white"%3E%3Cpath stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1" /%3E%3C/svg%3E');
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
</style>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<blockquote>
|
|
3
|
+
<slot />
|
|
4
|
+
</blockquote>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<style lang="postcss" scoped>
|
|
8
|
+
blockquote {
|
|
9
|
+
@apply text-base mt-[1.5em] mb-[1.5em] font-medium pl-4 d-prose-blockquote-text d-prose-blockquote-border;
|
|
10
|
+
|
|
11
|
+
quotes: '201C' '201D' '2018' '2019';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
blockquote p:first-of-type::before {
|
|
15
|
+
content: '';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
blockquote p:last-of-type::after {
|
|
19
|
+
content: '';
|
|
20
|
+
}
|
|
21
|
+
</style>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { PropType } from 'vue'
|
|
3
|
+
import type { Lang } from 'shiki-es'
|
|
4
|
+
|
|
5
|
+
defineProps({
|
|
6
|
+
code: {
|
|
7
|
+
type: String,
|
|
8
|
+
default: '',
|
|
9
|
+
},
|
|
10
|
+
language: {
|
|
11
|
+
type: String as PropType<Lang>,
|
|
12
|
+
default: null,
|
|
13
|
+
},
|
|
14
|
+
filename: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: null,
|
|
17
|
+
},
|
|
18
|
+
highlights: {
|
|
19
|
+
type: Array as () => number[],
|
|
20
|
+
default: () => [],
|
|
21
|
+
},
|
|
22
|
+
})
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<template>
|
|
26
|
+
<div class="prose-code w-full group">
|
|
27
|
+
<span v-if="filename" class="filename transition-base top-1 right-1 opacity-100 absolute right-0 z-0 m-1 py-1.5 px-2 text-gray-400 bg-gray-900 rounded-md font-mono text-xs leading-none tracking-tight">
|
|
28
|
+
{{ filename }}
|
|
29
|
+
</span>
|
|
30
|
+
|
|
31
|
+
<slot />
|
|
32
|
+
|
|
33
|
+
<CopyButton class="copy-button opacity-0 transition-base" />
|
|
34
|
+
</div>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<style lang="postcss" scoped>
|
|
38
|
+
div {
|
|
39
|
+
@apply relative rounded-lg overflow-hidden my-4;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
:deep(pre) {
|
|
43
|
+
@apply flex flex-1 p-4 my-0 overflow-x-auto leading-normal;
|
|
44
|
+
background-color: #282c34;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
:deep(code) {
|
|
48
|
+
@apply flex flex-col;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
:deep(.line) {
|
|
52
|
+
@apply inline-table min-h-[1rem];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
:deep(.line.highlight) {
|
|
56
|
+
background-color: #3f3f46;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.group:hover {
|
|
60
|
+
.filename {
|
|
61
|
+
@apply opacity-0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.copy-button {
|
|
65
|
+
@apply opacity-100;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
</style>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<code>
|
|
3
|
+
<slot />
|
|
4
|
+
</code>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<style lang="postcss" scoped>
|
|
8
|
+
code {
|
|
9
|
+
@apply font-normal text-sm py-[3px] px-[6px] rounded-md bg-gray-100 text-gray-800 dark:text-gray-100 dark:bg-gray-800;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
a code {
|
|
13
|
+
&:hover {
|
|
14
|
+
@apply border-primary-500;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
tbody code {
|
|
19
|
+
@apply text-[12px];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
h1 a,
|
|
23
|
+
h2 a,
|
|
24
|
+
h3 a,
|
|
25
|
+
h4 a {
|
|
26
|
+
code {
|
|
27
|
+
@apply relative;
|
|
28
|
+
font-size: inherit;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
& code:before {
|
|
32
|
+
@apply absolute top-[-2px] left-[-2px] -z-[1] d-prose-code-inline-bg rounded-md pointer-events-none;
|
|
33
|
+
content: '';
|
|
34
|
+
width: calc(100% + 4px);
|
|
35
|
+
height: calc(100% + 4px);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
</style>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineProps<{ id: string }>()
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<template>
|
|
6
|
+
<h1 :id="id">
|
|
7
|
+
<NuxtLink :href="`#${id}`">
|
|
8
|
+
<slot />
|
|
9
|
+
</NuxtLink>
|
|
10
|
+
</h1>
|
|
11
|
+
</template>>
|
|
12
|
+
|
|
13
|
+
<style lang="postcss" scoped>
|
|
14
|
+
h1 {
|
|
15
|
+
font-size: 2rem;
|
|
16
|
+
@apply tracking-tight leading-snug font-semibold mt-[1em] mb-[0.5em];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
h1 + * {
|
|
20
|
+
@apply mt-0;
|
|
21
|
+
}
|
|
22
|
+
</style>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineProps<{ id: string }>()
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<template>
|
|
6
|
+
<h2 :id="id">
|
|
7
|
+
<NuxtLink :href="`#${id}`">
|
|
8
|
+
<slot />
|
|
9
|
+
</NuxtLink>
|
|
10
|
+
</h2>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<style lang="postcss" scoped>
|
|
14
|
+
h2 {
|
|
15
|
+
font-size: 1.5rem;
|
|
16
|
+
@apply tracking-tight leading-snug font-semibold mt-[1.25em] mb-[0.5em];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
h2 + * {
|
|
20
|
+
@apply mt-0;
|
|
21
|
+
}
|
|
22
|
+
</style>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineProps<{ id: string }>()
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<template>
|
|
6
|
+
<h3 :id="id">
|
|
7
|
+
<NuxtLink :href="`#${id}`">
|
|
8
|
+
<slot />
|
|
9
|
+
</NuxtLink>
|
|
10
|
+
</h3>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<style lang="postcss" scoped>
|
|
14
|
+
h3 {
|
|
15
|
+
/* TODO */
|
|
16
|
+
/* extend.fontSize do not work in Windi */
|
|
17
|
+
font-size: 1.25rem;
|
|
18
|
+
@apply tracking-tight leading-snug font-semibold mt-[1.25em] mb-[0.5em];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
h3 + * {
|
|
22
|
+
@apply mt-0;
|
|
23
|
+
}
|
|
24
|
+
</style>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineProps<{ id: string }>()
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<template>
|
|
6
|
+
<h4 :id="id">
|
|
7
|
+
<NuxtLink :href="`#${id}`">
|
|
8
|
+
<slot />
|
|
9
|
+
</NuxtLink>
|
|
10
|
+
</h4>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<style lang="postcss" scoped>
|
|
14
|
+
h4 {
|
|
15
|
+
/* TODO */
|
|
16
|
+
/* extend.fontSize do not work in Windi */
|
|
17
|
+
font-size: 1.125rem;
|
|
18
|
+
@apply tracking-tight leading-snug font-semibold mt-[1.25em] mb-[0.5em];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
h4 + * {
|
|
22
|
+
@apply mt-0;
|
|
23
|
+
}
|
|
24
|
+
</style>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineProps({
|
|
3
|
+
src: {
|
|
4
|
+
type: String,
|
|
5
|
+
default: '',
|
|
6
|
+
},
|
|
7
|
+
alt: {
|
|
8
|
+
type: String,
|
|
9
|
+
default: '',
|
|
10
|
+
},
|
|
11
|
+
width: {
|
|
12
|
+
type: [String, Number],
|
|
13
|
+
default: undefined,
|
|
14
|
+
},
|
|
15
|
+
height: {
|
|
16
|
+
type: [String, Number],
|
|
17
|
+
default: undefined,
|
|
18
|
+
},
|
|
19
|
+
})
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<template>
|
|
23
|
+
<NuxtImg :src="src" :alt="alt" :width="width" :height="height" />
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<style lang="postcss" scoped>
|
|
27
|
+
:deep(img) {
|
|
28
|
+
@apply my-[1em];
|
|
29
|
+
}
|
|
30
|
+
</style>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<li><slot /></li>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<style lang="postcss" scoped>
|
|
6
|
+
li {
|
|
7
|
+
@apply relative my-[0.25em] pl-4;
|
|
8
|
+
p {
|
|
9
|
+
@apply my-[0.75em];
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
ul > li {
|
|
14
|
+
&::before {
|
|
15
|
+
@apply absolute left-0 top-[0.5em] d-prose-ul-li-bullet rounded-full w-1.5 h-1.5;
|
|
16
|
+
content: '';
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
ol > li {
|
|
21
|
+
&::before {
|
|
22
|
+
@apply absolute left-0 top-0 d-secondary-text;
|
|
23
|
+
content: counter(list-item, decimal) '.';
|
|
24
|
+
content: counter(list-item, var(--list-counter-style, decimal)) '.';
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
:deep(.nuxt-content-highlight) {
|
|
29
|
+
@apply m-0;
|
|
30
|
+
}
|
|
31
|
+
</style>
|
|
File without changes
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { withoutTrailingSlash } from 'ufo'
|
|
2
|
+
import type { NavItem, ParsedContent } from '@nuxt/content/dist/runtime/types'
|
|
3
|
+
import { computed, fetchContentNavigation, onBeforeUnmount, onMounted, queryContent, useNuxtApp, useRoute, useState } from '#imports'
|
|
4
|
+
|
|
5
|
+
let closeHook
|
|
6
|
+
|
|
7
|
+
export const useContent = () => {
|
|
8
|
+
const route = useRoute()
|
|
9
|
+
|
|
10
|
+
const path = computed(() => withoutTrailingSlash(route.path))
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Navigation tree from root of app.
|
|
14
|
+
*/
|
|
15
|
+
const navigation = useState<NavItem[]>('navigation', () => null)
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Current page complete data.
|
|
19
|
+
*/
|
|
20
|
+
const page = useState<ParsedContent>(`content-page-${path.value}`, () => null)
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Previous and next page data.
|
|
24
|
+
* Format: [prev, next]
|
|
25
|
+
*/
|
|
26
|
+
const surround = useState<ParsedContent[]>(`content-surround-${path.value}`, () => null)
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Table of contents from parsed page.
|
|
30
|
+
*/
|
|
31
|
+
const toc = computed(() => page?.value?.body?.toc?.links || [])
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Content type from parsed page.
|
|
35
|
+
*/
|
|
36
|
+
const type = computed(() => page.value?.meta?.type)
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Next page from `surround`.
|
|
40
|
+
*/
|
|
41
|
+
const next = computed(() => surround.value?.[1] || null)
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Previous page from `surround`.
|
|
45
|
+
*/
|
|
46
|
+
const prev = computed(() => surround.value?.[0] || null)
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Page list fetching helper.
|
|
50
|
+
*/
|
|
51
|
+
const fetchDir = async(path: string) => await queryContent(path).find()
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Find first child link from a navigation node.
|
|
55
|
+
*/
|
|
56
|
+
const findBottomLink = (link: NavItem) => {
|
|
57
|
+
let slug = link.slug
|
|
58
|
+
|
|
59
|
+
if (link.children && link.children.length)
|
|
60
|
+
slug = findBottomLink(link.children[0])
|
|
61
|
+
|
|
62
|
+
return slug
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Find current navigation node from a path.
|
|
67
|
+
*/
|
|
68
|
+
const navFromPath = (path: string, tree: NavItem[] = navigation.value) => {
|
|
69
|
+
for (const file of tree) {
|
|
70
|
+
if (file.children) {
|
|
71
|
+
const result = navFromPath(path, file.children)
|
|
72
|
+
if (result)
|
|
73
|
+
return result
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (file.slug === path)
|
|
77
|
+
return file
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Navigation fetching helper.
|
|
83
|
+
*/
|
|
84
|
+
const fetchNavigation = async(force = false) => {
|
|
85
|
+
if (navigation.value !== null && !force)
|
|
86
|
+
return
|
|
87
|
+
|
|
88
|
+
navigation.value = await fetchContentNavigation()
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Local page fetching helper.
|
|
93
|
+
*/
|
|
94
|
+
const fetchPage = async(force = false) => {
|
|
95
|
+
if (page.value !== null && !force)
|
|
96
|
+
return
|
|
97
|
+
|
|
98
|
+
const splitted = path.value.split('/')
|
|
99
|
+
const directory = splitted.slice(0, splitted.length - 1).join('/')
|
|
100
|
+
|
|
101
|
+
// Get navigation node from current path
|
|
102
|
+
const file = navFromPath(path.value, navigation.value)
|
|
103
|
+
|
|
104
|
+
if (file && !file.children) {
|
|
105
|
+
// Path queried has a page (and is not a directory)
|
|
106
|
+
await Promise.all([
|
|
107
|
+
queryContent().where({ id: file.id }).findOne() as Promise<ParsedContent>,
|
|
108
|
+
queryContent(directory).findSurround(path.value) as Promise<ParsedContent[]>,
|
|
109
|
+
]).then(([_page, _surround]) => {
|
|
110
|
+
page.value = _page
|
|
111
|
+
surround.value = _surround
|
|
112
|
+
})
|
|
113
|
+
}
|
|
114
|
+
else if (file) {
|
|
115
|
+
navigateTo(findBottomLink(file))
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Re-fetch page on change (development only)
|
|
120
|
+
if (process.dev) {
|
|
121
|
+
onMounted(
|
|
122
|
+
() => {
|
|
123
|
+
// Cleanup previous hook before registering new one.
|
|
124
|
+
if (closeHook)
|
|
125
|
+
closeHook()
|
|
126
|
+
|
|
127
|
+
const { hook } = useNuxtApp()
|
|
128
|
+
|
|
129
|
+
closeHook = hook('app:data:refresh', async() => {
|
|
130
|
+
await fetchNavigation(true)
|
|
131
|
+
await fetchPage(true)
|
|
132
|
+
})
|
|
133
|
+
},
|
|
134
|
+
)
|
|
135
|
+
onBeforeUnmount(() => closeHook && closeHook())
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return {
|
|
139
|
+
// useState references
|
|
140
|
+
navigation,
|
|
141
|
+
page,
|
|
142
|
+
surround,
|
|
143
|
+
// Fetching helpers
|
|
144
|
+
fetchDir,
|
|
145
|
+
fetchPage,
|
|
146
|
+
fetchNavigation,
|
|
147
|
+
// Computed values
|
|
148
|
+
next,
|
|
149
|
+
prev,
|
|
150
|
+
type,
|
|
151
|
+
toc,
|
|
152
|
+
// Methods
|
|
153
|
+
navFromPath,
|
|
154
|
+
findBottomLink,
|
|
155
|
+
}
|
|
156
|
+
}
|