undocs 0.2.9 → 0.2.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.
@@ -1,4 +1,3 @@
1
- import { join } from 'node:path'
2
1
  import { defineNuxtConfig } from 'nuxt/config'
3
2
 
4
3
  // Flag enabled when developing docs theme
@@ -99,12 +98,6 @@ export default defineNuxtConfig({
99
98
  tailwindcss: {
100
99
  viewer: dev,
101
100
  quiet: !dev,
102
- config: {
103
- content: {
104
- // eslint-disable-next-line unicorn/prefer-module
105
- files: [join(__dirname, '{components,pages,layouts}/**/*.vue')],
106
- },
107
- },
108
101
  },
109
102
  typescript: {
110
103
  strict: false,
@@ -53,6 +53,10 @@ const tocLinks = computed(() =>
53
53
  href: `#${link.id}`,
54
54
  })),
55
55
  )
56
+
57
+ const scrollToTop = () => {
58
+ window.scrollTo({ top: 0, left: 0, behavior: 'smooth' })
59
+ }
56
60
  </script>
57
61
 
58
62
  <template>
@@ -60,18 +64,21 @@ const tocLinks = computed(() =>
60
64
  <UPageHeader :title="page.title" :description="page.description" :links="page.links" :headline="headline">
61
65
  </UPageHeader>
62
66
 
63
- <UDropdown
64
- v-if="tocLinks.length > 2"
65
- :items="[/*[{ label: 'Return to top', href: '#' }] TODO: once sticky */ tocLinks]"
66
- v-model:open="tocOpen"
67
- class="mt-4"
68
- >
69
- <UButton
70
- color="white"
71
- label="On this page"
72
- :trailing-icon="`i-heroicons-chevron-${tocOpen ? 'down' : 'right'}-20-solid`"
73
- />
74
- </UDropdown>
67
+ <div class="mt-4 top-[calc(var(--header-height)_+_0.5rem)] z-10 flex justify-end lg:sticky">
68
+ <UDropdown
69
+ v-if="tocLinks.length > 2"
70
+ :items="[[{ label: 'Return to top', click: scrollToTop }], tocLinks]"
71
+ :popper="{ placement: 'bottom-end' }"
72
+ v-model:open="tocOpen"
73
+ >
74
+ <UButton
75
+ color="white"
76
+ label="On this page"
77
+ :trailing="false"
78
+ :icon="`i-heroicons-chevron-${tocOpen ? 'down' : 'left'}-20-solid`"
79
+ />
80
+ </UDropdown>
81
+ </div>
75
82
 
76
83
  <UPageBody prose>
77
84
  <ContentRenderer v-if="page.body" :value="page" />
@@ -1,7 +1,28 @@
1
+ import { resolve, join } from 'node:path'
1
2
  import type { Config } from 'tailwindcss'
2
3
  import defaultTheme from 'tailwindcss/defaultTheme'
3
4
 
5
+ // eslint-disable-next-line unicorn/prefer-module
6
+ const uiDir = resolve(require.resolve('@nuxt/ui'), '..')
7
+
8
+ // eslint-disable-next-line unicorn/prefer-module
9
+ const uiProDir = resolve(require.resolve('@nuxt/ui-pro'), '..')
10
+
11
+ // eslint-disable-next-line unicorn/prefer-module
12
+ const appDir = __dirname
13
+
14
+ const contentFiles = [
15
+ join(appDir, '{components,pages,layouts}/**/*.{vue,mjs,js,cjs,ts}'),
16
+ join(appDir, '.unjs/{components,pages,layouts}/**/*.{vue,mjs,js,cjs,ts}'),
17
+ join(uiDir, 'runtime/**/*.{vue,mjs,js,cjs,ts}'),
18
+ join(uiProDir, 'components/**/*.{vue,mjs,js,cjs,ts}'),
19
+ join(uiProDir, 'modules/pro/runtime/**/*.{vue,mjs,js,cjs,ts}'),
20
+ ]
21
+
4
22
  export default <Partial<Config>>{
23
+ content: {
24
+ files: contentFiles,
25
+ },
5
26
  theme: {
6
27
  extend: {
7
28
  fontFamily: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "undocs",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
4
4
  "repository": "unjs/undocs",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -30,6 +30,7 @@
30
30
  "undocs": "./cli/main.mjs"
31
31
  },
32
32
  "dependencies": {
33
+ "@headlessui/vue": "^1.7.19",
33
34
  "@nuxt/content": "^2.12.0",
34
35
  "@nuxt/ui": "^2.14.0",
35
36
  "@nuxt/ui-pro": "^1.0.0",