@sewadah/selaras-docs 1.3.2 → 1.3.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/CHANGELOG.md +26 -0
- package/README.md +11 -0
- package/app/app.config.ts +5 -2
- package/app/components/DocsErrorBoundary.vue +2 -5
- package/app/components/DocsErrorPage.vue +2 -1
- package/app/composables/useDocsSurround.ts +2 -1
- package/app/pages/[...slug].vue +5 -3
- package/app/plugins/content-fetch.client.ts +11 -0
- package/app/utils/content-path.ts +4 -0
- package/app/utils/error-status.ts +7 -0
- package/nuxt.config.mjs +2 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v1.3.3
|
|
4
|
+
|
|
5
|
+
[compare changes](https://github.com/sewadahapp/selaras/compare/selaras-docs-v1.3.2...selaras-docs-v1.3.3)
|
|
6
|
+
|
|
7
|
+
### 🚀 Enhancements
|
|
8
|
+
|
|
9
|
+
- **feat(empty-state):** add reusable empty states and examples ([b915695](https://github.com/sewadahapp/selaras/commit/b915695478d98509ff776a042e9ad676654167bd))
|
|
10
|
+
|
|
11
|
+
### 🩹 Fixes
|
|
12
|
+
|
|
13
|
+
- **fix(docs):** restore future and nightly Nuxt compatibility ([272260e](https://github.com/sewadahapp/selaras/commit/272260e00416c5780ea32ed8ae54a8ce478d436b))
|
|
14
|
+
- **fix(docs):** preserve content at trailing-slash URLs ([24f55a6](https://github.com/sewadahapp/selaras/commit/24f55a6b8e531e785080f0f54923539672d1da52))
|
|
15
|
+
- **fix(a11y):** correct selection semantics and add browser checks ([3416404](https://github.com/sewadahapp/selaras/commit/34164047bb106bafb676d7cef27d48c02d50ea73))
|
|
16
|
+
- **fix(docs):** restore dot grid pointer interaction ([3f8df1e](https://github.com/sewadahapp/selaras/commit/3f8df1edf911b279308f67f57eadca29dae38556))
|
|
17
|
+
- **fix(release):** add explicit all-package release selection ([8ac0d9b](https://github.com/sewadahapp/selaras/commit/8ac0d9bae9f5692148b0b00657c043625ce77823))
|
|
18
|
+
|
|
19
|
+
### 📖 Documentation
|
|
20
|
+
|
|
21
|
+
- **docs:** refresh v1 setup guide and package homepage ([f4ad42c](https://github.com/sewadahapp/selaras/commit/f4ad42c91bd3ad294618d35cf89e8c2ec77dc2ab))
|
|
22
|
+
|
|
23
|
+
### 🤖 Other changes
|
|
24
|
+
|
|
25
|
+
- **test(compat):** add Nuxt 5 checks and docs compatibility fixes ([9f6ca01](https://github.com/sewadahapp/selaras/commit/9f6ca0125786cfa20ba8b3235636a9b588b4e997))
|
|
26
|
+
|
|
27
|
+
Published against `@sewadah/selaras` ^1.1.0.
|
|
28
|
+
|
|
3
29
|
## v1.3.2
|
|
4
30
|
|
|
5
31
|
[compare changes](https://github.com/sewadahapp/selaras/compare/selaras-docs-v1.3.1...selaras-docs-v1.3.2)
|
package/README.md
CHANGED
|
@@ -37,6 +37,17 @@ need an app root, Content config, or stylesheet for the default setup.
|
|
|
37
37
|
`nuxt` remains a peer because the documentation site is a Nuxt application;
|
|
38
38
|
the layer is normally a development dependency, just like Nuxt itself.
|
|
39
39
|
|
|
40
|
+
## Framework compatibility
|
|
41
|
+
|
|
42
|
+
The supported Nuxt range is declared in the package's peer dependencies.
|
|
43
|
+
CI also tests Nuxt 4 with `future.compatibilityVersion: 5` and Nuxt 5 nightly.
|
|
44
|
+
The nightly checks are informational until Nuxt 5 is released.
|
|
45
|
+
|
|
46
|
+
The layer enables server auto-imports required by Nuxt Content 3. On the
|
|
47
|
+
client, it supplies Content's global `$fetch` from Nuxt's configured fetch
|
|
48
|
+
client when that global is missing, preserving an existing implementation.
|
|
49
|
+
Consumers do not need to configure either compatibility setting themselves.
|
|
50
|
+
|
|
40
51
|
## Updates after deployment
|
|
41
52
|
|
|
42
53
|
In production, the layer checks Nuxt's latest build manifest before navigation
|
package/app/app.config.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import type { SelarasDocsAppConfig } from '../types'
|
|
2
|
+
|
|
3
|
+
// Server-side content tooling also evaluates this config without app auto-imports.
|
|
4
|
+
export default {
|
|
2
5
|
selarasDocs: {
|
|
3
6
|
site: {
|
|
4
7
|
name: 'Documentation',
|
|
@@ -39,4 +42,4 @@ export default defineAppConfig({
|
|
|
39
42
|
],
|
|
40
43
|
},
|
|
41
44
|
},
|
|
42
|
-
}
|
|
45
|
+
} satisfies { selarasDocs: SelarasDocsAppConfig }
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import type { SelarasDocsErrorKind } from '../../types'
|
|
3
3
|
import { useTemplateRef, watch } from 'vue'
|
|
4
4
|
import { useRouter } from '#app'
|
|
5
|
+
import { isDocsNotFound } from '../utils/error-status'
|
|
5
6
|
|
|
6
7
|
const props = withDefaults(defineProps<{
|
|
7
8
|
kind?: Extract<SelarasDocsErrorKind, 'page' | 'example'>
|
|
@@ -11,17 +12,13 @@ const props = withDefaults(defineProps<{
|
|
|
11
12
|
const boundary = useTemplateRef('boundary')
|
|
12
13
|
const router = useRouter()
|
|
13
14
|
watch([() => router.currentRoute.value.fullPath, () => props.resetKey], () => boundary.value?.clearError())
|
|
14
|
-
|
|
15
|
-
function isMissing(error: Error) {
|
|
16
|
-
return 'statusCode' in error && error.statusCode === 404
|
|
17
|
-
}
|
|
18
15
|
</script>
|
|
19
16
|
|
|
20
17
|
<template>
|
|
21
18
|
<NuxtErrorBoundary ref="boundary">
|
|
22
19
|
<slot />
|
|
23
20
|
<template #error="{ error, clearError }">
|
|
24
|
-
<DocsErrorState :kind="kind === 'page' &&
|
|
21
|
+
<DocsErrorState :kind="kind === 'page' && isDocsNotFound(error) ? 'notFound' : kind" @retry="clearError" />
|
|
25
22
|
</template>
|
|
26
23
|
</NuxtErrorBoundary>
|
|
27
24
|
</template>
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { NuxtError } from '#app'
|
|
3
|
+
import { isDocsNotFound } from '../utils/error-status'
|
|
3
4
|
|
|
4
5
|
const props = defineProps<{ error: NuxtError }>()
|
|
5
6
|
const config = useRuntimeConfig()
|
|
6
7
|
const appConfig = useAppConfig()
|
|
7
8
|
const siteName = computed(() => appConfig.selarasDocs?.site?.name ?? 'Documentation')
|
|
8
|
-
const missing = computed(() => props.error
|
|
9
|
+
const missing = computed(() => isDocsNotFound(props.error))
|
|
9
10
|
const pending = ref(false)
|
|
10
11
|
|
|
11
12
|
useSeoMeta({
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ContentNavigationLink } from '@sewadah/selaras/components/ContentNavigation.vue'
|
|
2
|
+
import { docsContentPath } from '../utils/content-path'
|
|
2
3
|
|
|
3
4
|
function flattenNavigation(links: ContentNavigationLink[]): ContentNavigationLink[] {
|
|
4
5
|
return links.flatMap(link => link.children?.length ? flattenNavigation(link.children) : [link])
|
|
@@ -11,7 +12,7 @@ export function useDocsSurround() {
|
|
|
11
12
|
|
|
12
13
|
return computed(() => {
|
|
13
14
|
const links = flattenNavigation(navigation.value ?? [])
|
|
14
|
-
const index = links.findIndex(link => link.path === route.path)
|
|
15
|
+
const index = links.findIndex(link => docsContentPath(link.path) === docsContentPath(route.path))
|
|
15
16
|
|
|
16
17
|
return index === -1
|
|
17
18
|
? { prev: undefined, next: undefined }
|
package/app/pages/[...slug].vue
CHANGED
|
@@ -7,11 +7,13 @@ import ProseH4 from '@sewadah/selaras/components/ProseH4.vue'
|
|
|
7
7
|
import ProseH5 from '@sewadah/selaras/components/ProseH5.vue'
|
|
8
8
|
import ProseH6 from '@sewadah/selaras/components/ProseH6.vue'
|
|
9
9
|
import ProsePre from '@sewadah/selaras/components/ProsePre.vue'
|
|
10
|
+
import { docsContentPath } from '../utils/content-path'
|
|
10
11
|
|
|
11
12
|
const route = useRoute()
|
|
12
13
|
const appConfig = useAppConfig()
|
|
13
14
|
const nuxtApp = useNuxtApp()
|
|
14
|
-
const
|
|
15
|
+
const contentPath = docsContentPath(route.path)
|
|
16
|
+
const { data: page, error, status, refresh } = await useAsyncData(`selaras-docs:${contentPath}`, () => queryCollection('docs').path(contentPath).first())
|
|
15
17
|
|
|
16
18
|
const recoveringBuild = import.meta.client && (!page.value || error.value)
|
|
17
19
|
&& await nuxtApp.$docsCheckBuild(route.fullPath, true)
|
|
@@ -73,7 +75,7 @@ const surround = useDocsSurround()
|
|
|
73
75
|
</template>
|
|
74
76
|
</ContentRenderer>
|
|
75
77
|
<DocsPageActions
|
|
76
|
-
:path="
|
|
78
|
+
:path="contentPath"
|
|
77
79
|
:title="page!.title"
|
|
78
80
|
:edit-link="page!.editLink !== false"
|
|
79
81
|
:issue-link="page!.issueLink !== false"
|
|
@@ -87,7 +89,7 @@ const surround = useDocsSurround()
|
|
|
87
89
|
/>
|
|
88
90
|
</article>
|
|
89
91
|
<DocsTableOfContents v-if="hasToc" :links="tocLinks">
|
|
90
|
-
<DocsPageActions :path="
|
|
92
|
+
<DocsPageActions :path="contentPath" :title="page!.title" :edit-link="page!.editLink !== false" :issue-link="page!.issueLink !== false" />
|
|
91
93
|
</DocsTableOfContents>
|
|
92
94
|
</div>
|
|
93
95
|
</SContainer>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { $fetch } from '#imports'
|
|
2
|
+
|
|
3
|
+
export default defineNuxtPlugin({
|
|
4
|
+
name: 'selaras-docs-content-fetch',
|
|
5
|
+
enforce: 'pre',
|
|
6
|
+
setup() {
|
|
7
|
+
// Content 3 uses a global fetch client; newer Nuxt releases scope it to imports.
|
|
8
|
+
const globals = globalThis as typeof globalThis & { $fetch?: typeof $fetch }
|
|
9
|
+
globals.$fetch ??= $fetch
|
|
10
|
+
},
|
|
11
|
+
})
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export function isDocsNotFound(error: unknown) {
|
|
2
|
+
if (!error || typeof error !== 'object')
|
|
3
|
+
return false
|
|
4
|
+
const status = 'status' in error ? error.status : undefined
|
|
5
|
+
const statusCode = 'statusCode' in error ? error.statusCode : undefined
|
|
6
|
+
return (status ?? statusCode) === 404
|
|
7
|
+
}
|
package/nuxt.config.mjs
CHANGED
|
@@ -7,6 +7,8 @@ export default defineNuxtConfig({
|
|
|
7
7
|
modules: ['@sewadah/selaras', '@nuxt/content', resolve('./modules/docs.mjs')],
|
|
8
8
|
experimental: {
|
|
9
9
|
emitRouteChunkError: 'automatic-immediate',
|
|
10
|
+
// Content 3 still imports server utilities from Nitro's generated imports.
|
|
11
|
+
nitroAutoImports: true,
|
|
10
12
|
},
|
|
11
13
|
// Selaras supports Node versions with node:sqlite. Keeping Content on its
|
|
12
14
|
// native connector lets an installed docs layer avoid a native addon.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sewadah/selaras-docs",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.3",
|
|
5
5
|
"description": "Nuxt Content documentation layer for Selaras",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@nuxt/content": "^3.16.0",
|
|
35
35
|
"@nuxt/kit": "^4.5.2",
|
|
36
|
-
"@sewadah/selaras": "^1.
|
|
36
|
+
"@sewadah/selaras": "^1.1.0",
|
|
37
37
|
"tailwindcss": "^4.3.0"
|
|
38
38
|
}
|
|
39
39
|
}
|