docus 1.0.7 → 3.0.0-beta.10

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.
Files changed (135) hide show
  1. package/README.md +9 -22
  2. package/package.json +38 -63
  3. package/theme/app/router.options.ts +18 -0
  4. package/theme/assets/css/fonts.css +84 -0
  5. package/theme/assets/css/main.css +104 -0
  6. package/theme/components/app/Container.vue +25 -0
  7. package/theme/components/app/Footer.vue +40 -0
  8. package/theme/components/app/MobileNav.vue +85 -0
  9. package/theme/components/app/Navbar.vue +37 -0
  10. package/theme/components/app/NavbarLogo.vue +33 -0
  11. package/theme/components/app/Page.vue +7 -0
  12. package/theme/components/app/PoweredByDocus.vue +11 -0
  13. package/theme/components/content/Alert.vue +124 -0
  14. package/theme/components/content/BlockHero.vue +54 -0
  15. package/theme/components/content/ButtonLink.vue +45 -0
  16. package/theme/components/content/Card.vue +46 -0
  17. package/theme/components/content/CardGrid.vue +23 -0
  18. package/theme/components/content/CodeBlock.vue +47 -0
  19. package/theme/components/content/CodeGroup.vue +135 -0
  20. package/theme/components/content/CopyButton.vue +49 -0
  21. package/theme/components/content/List.vue +5 -0
  22. package/theme/components/content/NeedContribution.vue +23 -0
  23. package/theme/components/content/ReadMore.vue +25 -0
  24. package/theme/components/content/Sandbox.vue +102 -0
  25. package/theme/components/content/TabsHeader.vue +44 -0
  26. package/theme/components/content/Terminal.vue +64 -0
  27. package/theme/components/content/VideoPlayer.vue +115 -0
  28. package/theme/components/dev/Debug.vue +65 -0
  29. package/theme/components/docs/DocsAside.vue +21 -0
  30. package/theme/components/docs/DocsAsideTree.vue +104 -0
  31. package/theme/components/docs/DocsHero.vue +39 -0
  32. package/theme/components/docs/DocsPage.vue +21 -0
  33. package/theme/components/docs/DocsPageContent.vue +32 -0
  34. package/theme/components/docs/DocsToc.vue +77 -0
  35. package/theme/components/globals/Icon.vue +24 -0
  36. package/theme/components/globals/Logo.vue +3 -0
  37. package/theme/components/globals/NuxtImg.vue +45 -0
  38. package/theme/components/globals/SocialIcons.vue +45 -0
  39. package/theme/components/globals/ThemeSelect.vue +35 -0
  40. package/theme/components/icons/IconAlgolia.vue +8 -0
  41. package/theme/components/icons/IconArrowLeft.vue +10 -0
  42. package/theme/components/icons/IconArrowRight.vue +10 -0
  43. package/theme/components/icons/IconBadgeCheck.vue +14 -0
  44. package/theme/components/icons/IconCheck.vue +10 -0
  45. package/theme/components/icons/IconCheckCircle.vue +10 -0
  46. package/theme/components/icons/IconChevronRight.vue +12 -0
  47. package/theme/components/icons/IconClipboardCheck.vue +14 -0
  48. package/theme/components/icons/IconClipboardCopy.vue +14 -0
  49. package/theme/components/icons/IconCodeSandbox.vue +8 -0
  50. package/theme/components/icons/IconCopy.vue +17 -0
  51. package/theme/components/icons/IconDots.vue +10 -0
  52. package/theme/components/icons/IconEdit.vue +18 -0
  53. package/theme/components/icons/IconExclamationCircle.vue +12 -0
  54. package/theme/components/icons/IconExclamationTriangle.vue +10 -0
  55. package/theme/components/icons/IconExternalLink.vue +12 -0
  56. package/theme/components/icons/IconGit.vue +7 -0
  57. package/theme/components/icons/IconGitHub.vue +10 -0
  58. package/theme/components/icons/IconHeart.vue +9 -0
  59. package/theme/components/icons/IconInformationCircle.vue +10 -0
  60. package/theme/components/icons/IconLighthouse.vue +83 -0
  61. package/theme/components/icons/IconLine.vue +10 -0
  62. package/theme/components/icons/IconMarkdown.vue +13 -0
  63. package/theme/components/icons/IconMenu.vue +12 -0
  64. package/theme/components/icons/IconMenuAlt.vue +10 -0
  65. package/theme/components/icons/IconMinus.vue +10 -0
  66. package/theme/components/icons/IconMoon.vue +10 -0
  67. package/theme/components/icons/IconNuxt.vue +14 -0
  68. package/theme/components/icons/IconNuxtContent.vue +20 -0
  69. package/theme/components/icons/IconNuxtLabs.vue +21 -0
  70. package/theme/components/icons/IconPlus.vue +10 -0
  71. package/theme/components/icons/IconPuzzle.vue +8 -0
  72. package/theme/components/icons/IconSSG.vue +7 -0
  73. package/theme/components/icons/IconSearch.vue +12 -0
  74. package/theme/components/icons/IconSun.vue +10 -0
  75. package/theme/components/icons/IconTailwind.vue +3 -0
  76. package/theme/components/icons/IconTocBack.vue +21 -0
  77. package/theme/components/icons/IconTocCurrent.vue +21 -0
  78. package/theme/components/icons/IconTocNext.vue +8 -0
  79. package/theme/components/icons/IconTranslate.vue +14 -0
  80. package/theme/components/icons/IconTwitter.vue +8 -0
  81. package/theme/components/icons/IconVite.vue +30 -0
  82. package/theme/components/icons/IconVue.vue +6 -0
  83. package/theme/components/icons/IconVueTelescope.vue +11 -0
  84. package/theme/components/icons/IconWindi.vue +17 -0
  85. package/theme/components/icons/IconX.vue +12 -0
  86. package/theme/components/icons/IconXCircle.vue +10 -0
  87. package/theme/components/icons/IconZap.vue +8 -0
  88. package/theme/components/prose/ProseA.vue +66 -0
  89. package/theme/components/prose/ProseBlockquote.vue +21 -0
  90. package/theme/components/prose/ProseCode.vue +67 -0
  91. package/theme/components/prose/ProseCodeInline.vue +38 -0
  92. package/theme/components/prose/ProseEm.vue +11 -0
  93. package/theme/components/prose/ProseH1.vue +22 -0
  94. package/theme/components/prose/ProseH2.vue +22 -0
  95. package/theme/components/prose/ProseH3.vue +24 -0
  96. package/theme/components/prose/ProseH4.vue +24 -0
  97. package/theme/components/prose/ProseHr.vue +13 -0
  98. package/theme/components/prose/ProseImg.vue +30 -0
  99. package/theme/components/prose/ProseLi.vue +31 -0
  100. package/theme/components/prose/ProseOl.vue +16 -0
  101. package/theme/components/prose/ProseP.vue +14 -0
  102. package/theme/components/prose/ProseStrong.vue +14 -0
  103. package/theme/components/prose/ProseTable.vue +13 -0
  104. package/theme/components/prose/ProseTbody.vue +5 -0
  105. package/theme/components/prose/ProseTd.vue +11 -0
  106. package/theme/components/prose/ProseTh.vue +11 -0
  107. package/theme/components/prose/ProseThead.vue +11 -0
  108. package/theme/components/prose/ProseTr.vue +11 -0
  109. package/theme/components/prose/ProseUl.vue +15 -0
  110. package/theme/composables/useDocus.ts +43 -0
  111. package/theme/composables/useMenu.ts +7 -0
  112. package/theme/composables/useScrollToHeading.ts +35 -0
  113. package/theme/composables/useScrollspy.ts +46 -0
  114. package/theme/composables/useUserAgent.ts +7 -0
  115. package/theme/composables/utils.ts +4 -0
  116. package/theme/layouts/default.vue +29 -0
  117. package/theme/layouts/page.vue +19 -0
  118. package/theme/middleware/components.ts +26 -0
  119. package/theme/middleware/navigation.global.ts +12 -0
  120. package/theme/middleware/page.ts +8 -0
  121. package/theme/middleware/theme.global.ts +12 -0
  122. package/theme/nuxt.config.ts +171 -0
  123. package/theme/pages/[...slug].vue +64 -0
  124. package/theme/plugins/menu.ts +67 -0
  125. package/theme/plugins/user-agent.ts +27 -0
  126. package/theme/utils/components.ts +25 -0
  127. package/theme/utils/navigation.ts +49 -0
  128. package/theme/utils/plugin.ts +21 -0
  129. package/theme/utils/queries.ts +68 -0
  130. package/theme/utils/state.ts +33 -0
  131. package/theme/utils/theme.ts +66 -0
  132. package/dist/create-docus/create-docus.js +0 -7
  133. package/dist/create-docus/helpers.js +0 -244
  134. package/dist/create-docus/index.js +0 -87
  135. package/dist/index.js +0 -10
package/README.md CHANGED
@@ -1,24 +1,11 @@
1
- # Docus CLI
1
+ <h1>
2
+ <img src="https://user-images.githubusercontent.com/904724/105075054-872fac80-5a89-11eb-8aab-46dd254ad986.png">
3
+ </h1>
2
4
 
3
- The Docus CLI.
5
+ <p>
6
+ <a href="https://www.npmjs.com/package/docus"><img src="https://badgen.net/npm/dm/docus" alt="Downloads"></a>
7
+ <a href="https://www.npmjs.com/package/docus"><img src="https://badgen.net/npm/v/docus" alt="Version"></a>
8
+ <a href="https://www.npmjs.com/package/docus"><img src="https://badgen.net/npm/license/docus" alt="License"></a>
9
+ </p>
4
10
 
5
- ## Quick Setup
6
-
7
- Add `docus` package globally:
8
-
9
- ```bash
10
- # Using Yarn
11
- yarn install --global docus
12
- # Using NPM
13
- npm install --global docus
14
- ```
15
-
16
- ## Commands
17
-
18
- TODO
19
-
20
- ## Development
21
-
22
- 1. Clone this repository
23
- 2. Install dependencies using `yarn install`
24
- 3. Start dev server using `yarn dev`
11
+ Docus is the fastest way to create documentations websites with [**Nuxt3**](https://v3.nuxtjs.org).
package/package.json CHANGED
@@ -1,72 +1,47 @@
1
1
  {
2
+ "version": "3.0.0-beta.10",
2
3
  "name": "docus",
3
- "version": "1.0.7",
4
- "description": "The Docus CLI.",
5
- "repository": "https://github.com/docusgen/cli",
6
- "bugs": {
7
- "url": "https://github.com/docusgen/cli/issues"
8
- },
9
- "homepage": "https://github.com/docusgen/cli#readme",
10
- "author": "Yaël GUILLOUX <yael.guilloux@gmail.com>",
11
- "license": "MIT",
12
- "keywords": [
13
- "typescript",
14
- "starter"
15
- ],
16
- "main": "dist/index.js",
17
- "module": "dist/index.mjs",
18
- "types": "dist/src/index.d.ts",
19
4
  "scripts": {
20
- "dev": "jiti scripts/watch.ts --cache",
21
- "build": "unbuild",
22
- "lint": "prettier -c --parser typescript \"{src,tests}/**/*.[jt]s?(x)\"",
23
- "lint:fix": "yarn run lint --write",
24
- "test:types": "tsc --build tsconfig.json",
25
- "test:unit": "jest",
26
- "test": "yarn run test:types && yarn run test:unit"
27
- },
28
- "engines": {
29
- "node": ">=14.0.0"
5
+ "build": "nuxi build",
6
+ "dev": "nuxi dev",
7
+ "preview": "nuxi preview",
8
+ "lint": "eslint --ext .ts,.js,.vue,.css ."
30
9
  },
31
- "bin": {
32
- "create-docus": "dist/create-docus/create-docus.js"
10
+ "devDependencies": {
11
+ "@antfu/eslint-config": "^0.21.1",
12
+ "@nuxtjs/eslint-config-typescript": "^9.0.0",
13
+ "eslint": "^8.14.0",
14
+ "jiti": "^1.13.0",
15
+ "nuxt": "npm:nuxt3@latest",
16
+ "parse-entities": "^4.0.0",
17
+ "typescript": "^4.6.4"
33
18
  },
34
- "files": [
35
- "dist/**/*",
36
- "LICENSE",
37
- "README.md"
38
- ],
39
19
  "dependencies": {
40
- "degit": "^2.8.4",
41
- "execa": "^5.1.1",
42
- "kolorist": "^1.5.0",
43
- "minimist": "^1.2.5",
44
- "prompts": "^2.4.1"
20
+ "@iconify/vue": "^3.2.1",
21
+ "@nuxt/content": "npm:@nuxt/content-edge@latest",
22
+ "@nuxthq/admin": "npm:@nuxthq/admin-edge@latest",
23
+ "@nuxtjs/color-mode": "^3.0.2",
24
+ "@nuxtjs/tailwindcss": "^5.0.3",
25
+ "@tailwindcss/aspect-ratio": "^0.4.0",
26
+ "@tailwindcss/forms": "^0.5.0",
27
+ "@tailwindcss/line-clamp": "^0.4.0",
28
+ "@tailwindcss/typography": "^0.5.2",
29
+ "@vueuse/core": "^8.3.1",
30
+ "@vueuse/motion": "2.0.0-beta.12",
31
+ "@vueuse/nuxt": "^8.3.1",
32
+ "clipboard": "^2.0.10",
33
+ "defu": "^6.0.0",
34
+ "lodash-es": "^4.17.21",
35
+ "tailwindcss": "^3.0.24",
36
+ "vue-plausible": "^1.3.1"
45
37
  },
46
- "devDependencies": {
47
- "@types/degit": "^2.8.3",
48
- "@types/jest": "^27.0.1",
49
- "@types/minimist": "^1.2.2",
50
- "@types/prompts": "^2.0.14",
51
- "chokidar": "^3.5.2",
52
- "jest": "^27.0.6",
53
- "jiti": "^1.11.0",
54
- "lint-staged": "^11.1.2",
55
- "pascalcase": "^1.0.0",
56
- "prettier": "^2.3.2",
57
- "ts-jest": "^27.0.5",
58
- "typescript": "^4.3.5",
59
- "unbuild": "^0.4.2"
60
- },
61
- "gitHooks": {
62
- "pre-commit": "lint-staged"
38
+ "main": "./nuxt.config.ts",
39
+ "exports": {
40
+ "./theme": "./theme/nuxt.config.ts",
41
+ "./theme/*": "./theme/*/*.*"
63
42
  },
64
- "lint-staged": {
65
- "*.js": [
66
- "prettier --write"
67
- ],
68
- "*.ts?(x)": [
69
- "prettier --parser=typescript --write"
70
- ]
71
- }
43
+ "files": [
44
+ "README.md",
45
+ "theme"
46
+ ]
72
47
  }
@@ -0,0 +1,18 @@
1
+ import type { RouterConfig } from '@nuxt/schema'
2
+
3
+ // https://router.vuejs.org/api/#routeroptions
4
+ export default <RouterConfig>{
5
+ scrollBehavior: (to) => {
6
+ if (to.params?.smooth) {
7
+ return {
8
+ el: to.params?.smooth,
9
+ behavior: 'smooth',
10
+ }
11
+ }
12
+
13
+ // Scroll to top of window
14
+ window.scrollTo({
15
+ top: 0,
16
+ })
17
+ },
18
+ }
@@ -0,0 +1,84 @@
1
+ /* `font-light` */
2
+ @font-face {
3
+ font-family: "RoobertPRO";
4
+ src: url("/fonts/RoobertPRO-Light.woff2") format("woff2"),
5
+ url("/fonts/RoobertPRO-Light.woff") format("woff");
6
+ font-weight: 300;
7
+ }
8
+ @font-face {
9
+ font-family: "RoobertPRO";
10
+ src: url("/fonts/RoobertPRO-LightItalic.woff2") format("woff2"),
11
+ url("/fonts/RoobertPRO-LightItalic.woff") format("woff");
12
+ font-weight: 300;
13
+ font-style: italic;
14
+ }
15
+ /* `font-normal` */
16
+ @font-face {
17
+ font-family: "RoobertPRO";
18
+ src: url("/fonts/RoobertPRO-Regular.woff2") format("woff2"),
19
+ url("/fonts/RoobertPRO-Regular.woff") format("woff");
20
+ font-weight: 400;
21
+ }
22
+ @font-face {
23
+ font-family: "RoobertPRO";
24
+ src: url("/fonts/RoobertPRO-RegularItalic.woff2") format("woff2"),
25
+ url("/fonts/RoobertPRO-RegularItalic.woff") format("woff");
26
+ font-weight: 400;
27
+ font-style: italic;
28
+ }
29
+ /* `font-medium */
30
+ @font-face {
31
+ font-family: "RoobertPRO";
32
+ src: url("/fonts/RoobertPRO-Medium.woff2") format("woff2"),
33
+ url("/fonts/RoobertPRO-Medium.woff") format("woff");
34
+ font-weight: 500;
35
+ }
36
+ @font-face {
37
+ font-family: "RoobertPRO";
38
+ src: url("/fonts/RoobertPRO-MediumItalic.woff2") format("woff2"),
39
+ url("/fonts/RoobertPRO-MediumItalic.woff") format("woff");
40
+ font-weight: 500;
41
+ font-style: italic;
42
+ }
43
+ /* `font-semibold` */
44
+ @font-face {
45
+ font-family: "RoobertPRO";
46
+ src: url("/fonts/RoobertPRO-SemiBold.woff2") format("woff2"),
47
+ url("/fonts/RoobertPRO-SemiBold.woff") format("woff");
48
+ font-weight: 600;
49
+ }
50
+ @font-face {
51
+ font-family: "RoobertPRO";
52
+ src: url("/fonts/RoobertPRO-SemiBoldItalic.woff2") format("woff2"),
53
+ url("/fonts/RoobertPRO-SemiBoldItalic.woff") format("woff");
54
+ font-weight: 600;
55
+ font-style: italic;
56
+ }
57
+ /* `font-bold` */
58
+ @font-face {
59
+ font-family: "RoobertPRO";
60
+ src: url("/fonts/RoobertPRO-Bold.woff2") format("woff2"),
61
+ url("/fonts/RoobertPRO-Bold.woff") format("woff");
62
+ font-weight: 700;
63
+ }
64
+ @font-face {
65
+ font-family: "RoobertPRO";
66
+ src: url("/fonts/RoobertPRO-BoldItalic.woff2") format("woff2"),
67
+ url("/fonts/RoobertPRO-BoldItalic.woff") format("woff");
68
+ font-weight: 700;
69
+ font-style: italic;
70
+ }
71
+ /* `font-extrabold` */
72
+ @font-face {
73
+ font-family: "RoobertPRO";
74
+ src: url("/fonts/RoobertPRO-Heavy.woff2") format("woff2"),
75
+ url("/fonts/RoobertPRO-Heavy.woff") format("woff");
76
+ font-weight: 800;
77
+ }
78
+ @font-face {
79
+ font-family: "RoobertPRO";
80
+ src: url("/fonts/RoobertPRO-HeavyItalic.woff2") format("woff2"),
81
+ url("/fonts/RoobertPRO-HeavyItalic.woff") format("woff");
82
+ font-weight: 800;
83
+ font-style: italic;
84
+ }
@@ -0,0 +1,104 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
4
+
5
+ /* Variables */
6
+ :root {
7
+ --header-height: 4rem;
8
+ --codeblocks-background: theme('colors.gray.900');
9
+ }
10
+
11
+ @layer components {
12
+ /* Text primary */
13
+
14
+ .text-primary {
15
+ @apply text-gray-900 dark:text-gray-50;
16
+ }
17
+
18
+ /* Text secondary */
19
+
20
+ .text-secondary {
21
+ @apply text-gray-500 dark:text-gray-400;
22
+ }
23
+
24
+ .text-secondary-active {
25
+ @apply text-primary-500 dark:text-primary-400;
26
+ }
27
+
28
+ .text-secondary-hover {
29
+ @apply hover:text-primary-500 hover:dark:text-primary-400;
30
+ }
31
+
32
+ .text-secondary-group-hover {
33
+ @apply group-hover:dark:text-primary-400 group-hover:text-primary-500;
34
+ }
35
+
36
+ /* Transitions */
37
+
38
+ .transition-base {
39
+ @apply transition-colors transition-opacity duration-100 ease-in-out;
40
+ }
41
+
42
+ /* Surface */
43
+
44
+ .surface {
45
+ @apply dark:bg-gray-900 bg-white;
46
+ }
47
+
48
+ .surface-secondary {
49
+ @apply bg-gray-500 dark:bg-gray-400;
50
+ }
51
+
52
+ .blurry-surface {
53
+ @apply backdrop-blur bg-white/95 dark:bg-gray-900/95;
54
+ }
55
+
56
+ /* Borders */
57
+
58
+ .surface-border {
59
+ @apply border-gray-200 dark:border-gray-800;
60
+ }
61
+
62
+ .surface-border-hover {
63
+ @apply border-primary-200 dark:border-gray-700;
64
+ }
65
+
66
+ .surface-border-header {
67
+ @apply border-b border-gray-200 dark:border-gray-800 border-opacity-50;
68
+ }
69
+
70
+ /* Icons */
71
+
72
+ .icon-base {
73
+ @apply transition-base text-secondary text-secondary-hover;
74
+ }
75
+
76
+ /* Code blocks */
77
+
78
+ .code-background {
79
+ /* background-color: var(--codeblocks-background); */
80
+ @apply bg-gray-800;
81
+ }
82
+
83
+ /* Images */
84
+
85
+ .light-img {
86
+ @apply dark:hidden;
87
+ }
88
+
89
+ .dark-img {
90
+ @apply hidden;
91
+ }
92
+ }
93
+
94
+ html {
95
+ @apply text-primary bg-white overflow-y-scroll;
96
+
97
+ &.dark {
98
+ @apply bg-gray-900;
99
+ }
100
+ }
101
+
102
+ body {
103
+ @apply antialiased font-sans text-gray-700 dark:text-gray-200;
104
+ }
@@ -0,0 +1,25 @@
1
+ <script setup lang="ts">
2
+ import { classNames, computed } from '#imports'
3
+
4
+ const props = defineProps({
5
+ padded: {
6
+ type: Boolean,
7
+ default: false,
8
+ },
9
+ constrained: {
10
+ type: Boolean,
11
+ default: true,
12
+ },
13
+ })
14
+
15
+ const containerClass = computed(() => classNames(
16
+ 'mx-auto max-w-7xl px-4 sm:px-6',
17
+ props.padded && 'px-4',
18
+ ))
19
+ </script>
20
+
21
+ <template>
22
+ <div :class="containerClass">
23
+ <slot />
24
+ </div>
25
+ </template>
@@ -0,0 +1,40 @@
1
+ <script setup lang="ts">
2
+ import { computed, useDocus } from '#imports'
3
+
4
+ const { theme } = useDocus()
5
+
6
+ const icons = computed(() => theme.value?.footer?.icons || [])
7
+ </script>
8
+
9
+ <template>
10
+ <footer class="py-6 sm:py-0 bg-gray-50 dark:bg-gray-800 dark:bg-opacity-25 h-[8rem] sm:h-[4rem]">
11
+ <Container class="flex h-full flex-col gap-y-4 sm:flex-row justify-between items-center">
12
+ <a
13
+ v-if="theme.footer.credits"
14
+ href="https://nuxtlabs.com"
15
+ rel="noopener"
16
+ target="_blank"
17
+ class="flex items-end text-secondary transition-base dark:hover:text-gray-100 hover:text-gray-600 mb-3 sm:mb-0"
18
+ >
19
+ <IconNuxtLabs class="mr-2" />
20
+ <p class="font-semibold text-sm">Made by Nuxt Labs</p>
21
+ </a>
22
+
23
+ <div class="flex">
24
+ <a
25
+ v-for="icon in icons"
26
+ :key="icon.label"
27
+ rel="noopener"
28
+ :aria-label="icon.label"
29
+ :href="icon.href"
30
+ target="_blank"
31
+ class="text-sm flex items-center font-medium p-1 icon-base"
32
+ >
33
+ <Component :is="icon.component" class="w-8 h-8" />
34
+ </a>
35
+
36
+ <SocialIcons size="w-8 h-8" padding="p-1" />
37
+ </div>
38
+ </Container>
39
+ </footer>
40
+ </template>
@@ -0,0 +1,85 @@
1
+ <script setup lang="ts">
2
+ import { computed, useDocus, useMenu, useUserAgent, watch } from '#imports'
3
+
4
+ const { navigation } = useDocus()
5
+
6
+ const tree = computed(() => {
7
+ return navigation.value.filter(
8
+ (item) => {
9
+ if (item.slug === '/' || item.slug === '/templates')
10
+ return false
11
+ return true
12
+ },
13
+ )
14
+ })
15
+
16
+ const { scrollBarGap, visible, open, close, toggle } = useMenu()
17
+
18
+ const { isDesktopSafari, isDesktopFirefox } = useUserAgent()
19
+
20
+ const buttonStyles = 'w-12 h-8 focus:outline-none bg-warmgray-50 hover:bg-warmgray-100 dark:bg-warmgray-800 rounded-xl'
21
+
22
+ watch(visible, v => (v ? open() : close()))
23
+
24
+ // Necessary because of body lock layout shift
25
+ const buttonBodyLockHack = computed(
26
+ () => `top: 1rem; right: calc(1.5rem + ${isDesktopSafari.value || isDesktopFirefox.value ? scrollBarGap.value : 0}px);`,
27
+ )
28
+
29
+ const surfaceBodyLockHack = computed(
30
+ () => `top: 0.5rem; right: calc(1rem + ${isDesktopSafari.value || isDesktopFirefox.value ? scrollBarGap.value : 0}px); bottom: 0.5rem; max-height: calc(100vh- 2rem); min-width: calc(320px - 2rem);`,
31
+ )
32
+ </script>
33
+
34
+ <template>
35
+ <div class="relative">
36
+ <button :class="[buttonStyles]" class="z-10 relative" @click="toggle">
37
+ <IconDots class="w-6 h-6 icon-base h-full mx-auto" />
38
+ </button>
39
+
40
+ <ClientOnly>
41
+ <teleport to="body">
42
+ <!-- Scrim overlay -->
43
+ <div
44
+ :class="[visible ? 'opacity-100 pointer-events-auto' : 'opacity-0 pointer-events-none']"
45
+ class="xl:hidden fixed top-0 left-0 z-10 w-full h-full bg-warmgray-100 bg-opacity-50 dark:bg-warmgray-800 dark:bg-opacity-50 backdrop-blur transition"
46
+ @click="toggle"
47
+ />
48
+
49
+ <!-- clone AppHeader button, due to stacking context limitations -->
50
+ <button
51
+ :style="buttonBodyLockHack"
52
+ :class="[
53
+ buttonStyles,
54
+ visible
55
+ ? 'opacity-100 pointer-events-auto'
56
+ : `opacity-0 transition ${
57
+ isDesktopSafari || isDesktopFirefox ? 'duration-0' : 'duration-400'
58
+ } pointer-events-none`
59
+ ]"
60
+ class="xl:hidden z-30 fixed"
61
+ @click="toggle"
62
+ >
63
+ <IconLine class="w-6 h-6 icon-base h-full mx-auto" />
64
+ </button>
65
+
66
+ <!-- Nav menu surface -->
67
+ <div
68
+ :style="surfaceBodyLockHack"
69
+ :class="[visible ? 'opacity-100 scale-100 pointer-events-auto' : 'opacity-0 scale-95 pointer-events-none']"
70
+ class="fixed z-20 w-[calc(100%-3rem)] md:w-auto min-w-full md:min-w-[calc(320px-2rem)] transform origin-top-right transition-transform ease-out"
71
+ >
72
+ <div
73
+ class="lg:hidden pl-8 pr-0 overflow-y-auto mb-2 surface pb-6 pt-12 rounded-2xl shadow-xl border-2 surface-border max-h-full"
74
+ >
75
+ <DocsAsideTree :tree="tree" />
76
+
77
+ <div class="flex items-center justify-end px-6">
78
+ <ThemeSelect class="block" />
79
+ </div>
80
+ </div>
81
+ </div>
82
+ </teleport>
83
+ </ClientOnly>
84
+ </div>
85
+ </template>
@@ -0,0 +1,37 @@
1
+ <script setup lang="ts">
2
+ import { onMounted, onUnmounted, ref } from '#imports'
3
+
4
+ const onTop = ref(true)
5
+
6
+ function setOnTop(): void {
7
+ if (window.pageYOffset <= 0)
8
+ onTop.value = true
9
+ else onTop.value = false
10
+ }
11
+
12
+ onMounted(() => {
13
+ setOnTop()
14
+ document.addEventListener('scroll', setOnTop)
15
+ })
16
+
17
+ onUnmounted(() => document.removeEventListener('scroll', setOnTop))
18
+ </script>
19
+
20
+ <template>
21
+ <header class="sticky w-full top-0 surface surface-blurry border-b border-gray-200 dark:border-gray-800 border-opacity-50 h-header surface surface-blurry z-10">
22
+ <Container class="grid grid-cols-12 items-center h-full">
23
+ <div class="col-span-6 lg:col-span-3">
24
+ <NavbarLogo />
25
+ </div>
26
+
27
+ <div class="hidden lg:block lg:col-span-6">
28
+ <!-- <HeaderNavigation /> -->
29
+ </div>
30
+
31
+ <div class="col-span-6 lg:col-span-3 flex justify-end">
32
+ <MobileNav class="flex lg:hidden" />
33
+ <ThemeSelect class="hidden lg:block" />
34
+ </div>
35
+ </Container>
36
+ </header>
37
+ </template>
@@ -0,0 +1,33 @@
1
+ <script setup lang="ts">
2
+ import { computed, useDocus } from '#imports'
3
+
4
+ const { theme } = useDocus()
5
+ const hasLogo = computed(() => theme.value?.header?.logo)
6
+ const hasTitle = computed(() => theme.value?.header?.title)
7
+ </script>
8
+
9
+ <template>
10
+ <NuxtLink to="/" :aria-label="theme.header.title">
11
+ <!-- Only title -->
12
+ <span v-if="!hasLogo && hasTitle">
13
+ {{ theme.header.title }}
14
+ </span>
15
+
16
+ <!-- Title and Logo -->
17
+ <template v-else-if="hasLogo && hasTitle">
18
+ <Logo />
19
+
20
+ <span>
21
+ {{ theme.header.title }}
22
+ </span>
23
+ </template>
24
+
25
+ <!-- Only Logo -->
26
+ <Logo v-else-if="hasLogo" class="w-12 h-12" />
27
+
28
+ <!-- Placeholder -->
29
+ <template v-else>
30
+ <IconDots class="w-12 h-12" />
31
+ </template>
32
+ </NuxtLink>
33
+ </template>
@@ -0,0 +1,7 @@
1
+ <template>
2
+ <main class="relative flex-1 pb-4 sm:pb-6 lg:py-8">
3
+ <Container padded>
4
+ <slot />
5
+ </Container>
6
+ </main>
7
+ </template>
@@ -0,0 +1,11 @@
1
+ <template>
2
+ <div class="p-3 text-center border-t border-gray-200 border-dashed dark:border-gray-800 dark:bg-gray-900">
3
+ <a
4
+ href="https://docus.dev"
5
+ target="_blank"
6
+ class="text-xs text-gray-400 hover:text-gray-600 dark:text-gray-600 group dark:hover:text-gray-400"
7
+ >
8
+ Powered by <strong class="font-bold">Docus</strong>
9
+ </a>
10
+ </div>
11
+ </template>