@sewadah/selaras-docs 1.2.4 → 1.3.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/CHANGELOG.md +48 -0
- package/README.md +46 -1
- package/app/app.config.ts +1 -0
- package/app/assets/style.css +52 -5
- package/app/components/DocsEditLink.vue +4 -16
- package/app/components/DocsEmptyState.vue +72 -0
- package/app/components/DocsFooter.vue +5 -0
- package/app/components/DocsPageActions.vue +25 -0
- package/app/components/DocsTableOfContents.vue +1 -0
- package/app/components/DocsThemePicker.vue +3 -0
- package/app/pages/[...slug].vue +17 -4
- package/app/utils/repository-links.ts +29 -0
- package/content.config.ts +1 -0
- package/package.json +2 -2
- package/types.d.ts +10 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,53 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v1.3.1
|
|
4
|
+
|
|
5
|
+
[compare changes](https://github.com/sewadahapp/selaras/compare/selaras-docs-v1.3.0...selaras-docs-v1.3.1)
|
|
6
|
+
|
|
7
|
+
### 🚀 Enhancements
|
|
8
|
+
|
|
9
|
+
- **feat(docs):** prepare Cloudflare Markdown negotiation rules ([7beb431](https://github.com/sewadahapp/selaras/commit/7beb431ac798eb24fc4021d01b93cd477cca34ee))
|
|
10
|
+
- **feat(docs):** declare AI content usage preferences ([2434ffe](https://github.com/sewadahapp/selaras/commit/2434ffe475b63c862ca1575afb90a497b4742699))
|
|
11
|
+
- **feat(docs):** declare explicit AI crawler access rules ([a2a624c](https://github.com/sewadahapp/selaras/commit/a2a624cbfdaa56cc9fa77d63bdcf08578e22e421))
|
|
12
|
+
- **feat(docs):** generate robots.txt with sitemap discovery ([a8e4ed6](https://github.com/sewadahapp/selaras/commit/a8e4ed6fc7c97beccb3dfab7796ce085d9befa8f))
|
|
13
|
+
- **feat(toolbar):** add shared controls and editor blocks ([dc56fd8](https://github.com/sewadahapp/selaras/commit/dc56fd8d92e19cefe37bd7b261c08937bafaa02c))
|
|
14
|
+
- **feat(docs):** redesign homepage with interactive previews ([878a542](https://github.com/sewadahapp/selaras/commit/878a542f10b0c8310eed4be8759bd80f5017e800))
|
|
15
|
+
- **feat(editable):** add inline text editing with draft controls ([078649e](https://github.com/sewadahapp/selaras/commit/078649e219dfcf4553a02e3f3a6ae0a8914d7bf0))
|
|
16
|
+
|
|
17
|
+
### 🩹 Fixes
|
|
18
|
+
|
|
19
|
+
- **fix(docs):** make editor read-only labels clickable ([8c521f2](https://github.com/sewadahapp/selaras/commit/8c521f2c84610f1df9b4e5953bed990d0b0ec9aa))
|
|
20
|
+
- **fix(forms):** unify clear button styling and behavior ([c669eb3](https://github.com/sewadahapp/selaras/commit/c669eb39f7c6f7246a892804447e95a533c327c8))
|
|
21
|
+
- **fix(forms):** align field and button heights across sizes ([818c325](https://github.com/sewadahapp/selaras/commit/818c325b24525927be85a21a7c46a875484fc6f0))
|
|
22
|
+
- **fix(listbox):** reuse checkbox component for selection indicators ([1abf48b](https://github.com/sewadahapp/selaras/commit/1abf48b75004754de1ea38a796015ae978047c76))
|
|
23
|
+
|
|
24
|
+
### 📖 Documentation
|
|
25
|
+
|
|
26
|
+
- **docs(agent):** request optional source attribution ([e279f40](https://github.com/sewadahapp/selaras/commit/e279f4050edae50be0b1e85f085eaa8ea82a9781))
|
|
27
|
+
|
|
28
|
+
### 🤖 Other changes
|
|
29
|
+
|
|
30
|
+
- **ci:** enforce conventional commits and pre-commit checks ([1b5922f](https://github.com/sewadahapp/selaras/commit/1b5922f5b8534920f9c054d1611ebc2eb7dc377d))
|
|
31
|
+
|
|
32
|
+
Published against `@sewadah/selaras` ^0.10.0.
|
|
33
|
+
|
|
34
|
+
## v1.3.0
|
|
35
|
+
|
|
36
|
+
[compare changes](https://github.com/sewadahapp/selaras/compare/selaras-docs-v1.2.4...selaras-docs-v1.3.0)
|
|
37
|
+
|
|
38
|
+
### 🚀 Enhancements
|
|
39
|
+
|
|
40
|
+
- **feat(docs):** add logo to footer attribution ([1af91a6](https://github.com/sewadahapp/selaras/commit/1af91a6b66ac279255a0a6ca421dda89ee6c966e))
|
|
41
|
+
- **feat(docs):** add contextual page contribution actions ([4e21d84](https://github.com/sewadahapp/selaras/commit/4e21d843dc514d6f6f50f0922371fe0cbf94a9c7))
|
|
42
|
+
|
|
43
|
+
### 🩹 Fixes
|
|
44
|
+
|
|
45
|
+
- **fix(docs):** render an empty state for blank Markdown pages ([bf4cb17](https://github.com/sewadahapp/selaras/commit/bf4cb1746311c10ff389e997aaec867b60fd9a83))
|
|
46
|
+
- **fix(docs):** provide an optional theme picker fallback ([3ba8c5d](https://github.com/sewadahapp/selaras/commit/3ba8c5d2d24d45bab98fdae8163de0338ed11d7c))
|
|
47
|
+
- **fix(docs):** align and refine footer layout ([029956a](https://github.com/sewadahapp/selaras/commit/029956a79b11b6d13610348a3f1bec516036dacb))
|
|
48
|
+
|
|
49
|
+
Published against `@sewadah/selaras` ^0.9.0.
|
|
50
|
+
|
|
3
51
|
## v1.2.4
|
|
4
52
|
|
|
5
53
|
[compare changes](https://github.com/sewadahapp/selaras/compare/selaras-docs-v1.2.3...selaras-docs-v1.2.4)
|
package/README.md
CHANGED
|
@@ -57,6 +57,7 @@ export default defineAppConfig({
|
|
|
57
57
|
repository: {
|
|
58
58
|
url: 'https://github.com/example/project',
|
|
59
59
|
editLinks: true,
|
|
60
|
+
issueLinks: true,
|
|
60
61
|
},
|
|
61
62
|
header: {
|
|
62
63
|
search: true,
|
|
@@ -100,12 +101,35 @@ navBadges:
|
|
|
100
101
|
Use `navigation: false` in a page's frontmatter to omit it from navigation, or
|
|
101
102
|
set `navigation` to an object to override its navigation `title`, `icon`,
|
|
102
103
|
`order`, and `navBadges`. Page frontmatter can also set `toc: false`,
|
|
103
|
-
`aside: false`, `editLink: false`, or `prevNext: false` to hide those parts of
|
|
104
|
+
`aside: false`, `editLink: false`, `issueLink: false`, or `prevNext: false` to hide those parts of
|
|
104
105
|
the page shell. The sidebar also accepts an app-wide `collapsed` default; a
|
|
105
106
|
folder's `collapse` value takes precedence. `main.fluid` expands the
|
|
106
107
|
content width, `main.padded: false` removes its outer inset, and `header.fluid`
|
|
107
108
|
and `footer.fluid` allow those regions to span the viewport.
|
|
108
109
|
|
|
110
|
+
### Page actions
|
|
111
|
+
|
|
112
|
+
With `repository.url` configured, **Edit this page** and **Report an issue**
|
|
113
|
+
appear below the table of contents on desktop. On smaller screens, or when
|
|
114
|
+
the page has no table of contents, they appear after the article and before
|
|
115
|
+
Previous/Next navigation. Pages without an aside use the available content width.
|
|
116
|
+
|
|
117
|
+
Set `repository.branch` and `repository.contentDirectory` to the branch and
|
|
118
|
+
Markdown directory in your repository; their defaults are `main` and `content`.
|
|
119
|
+
Generated issue links include the page title and route in a new issue draft.
|
|
120
|
+
The links open the repository in a new tab; they do not submit changes or issues.
|
|
121
|
+
|
|
122
|
+
Use `repository.editLinks: false` or `repository.issueLinks: false` to hide an
|
|
123
|
+
action site-wide. Set `editLink: false` or `issueLink: false` in frontmatter to
|
|
124
|
+
hide it on one page. GitHub and GitLab URLs are recognized automatically;
|
|
125
|
+
set `repository.issueUrl` to use a different issue tracker or an issue-template
|
|
126
|
+
chooser. Custom issue URLs are used unchanged. With no supported repository or
|
|
127
|
+
custom issue URL, unavailable actions are omitted.
|
|
128
|
+
|
|
129
|
+
Override `components/DocsPageActions.vue` to replace the group, or
|
|
130
|
+
`components/DocsEditLink.vue` to customize the edit link. The
|
|
131
|
+
`DocsTableOfContents` default slot renders content below its heading links.
|
|
132
|
+
|
|
109
133
|
Create an application component with the same name as a layer component, such
|
|
110
134
|
as `components/DocsHeader.vue`, to replace that part of the shell. Smaller
|
|
111
135
|
pieces can be replaced on their own:
|
|
@@ -114,13 +138,34 @@ pieces can be replaced on their own:
|
|
|
114
138
|
| --- | --- | --- |
|
|
115
139
|
| `DocsHeaderBrand` | The header's home link content | `site.logo` and the site name |
|
|
116
140
|
| `DocsFooterBrand` | The start of the footer | `footer.text` |
|
|
141
|
+
| `DocsThemePicker` | Optional header theme control | Empty; provide your own component and set `header.themePicker: true` |
|
|
117
142
|
| `DocsLogo` | The logo image, used by `DocsHeaderBrand` | `site.logo`, switching light/dark; size it with `--selaras-docs-logo-height` |
|
|
118
143
|
|
|
119
144
|
For example, a `components/DocsFooterBrand.vue` containing `<DocsLogo />` adds
|
|
120
145
|
the logo to the footer while leaving the header as configured.
|
|
121
146
|
|
|
147
|
+
The layer does not include the Selaras site's theme presets. To offer your own
|
|
148
|
+
themes, create `components/DocsThemePicker.vue` and enable
|
|
149
|
+
`selarasDocs.header.themePicker` in `app.config.ts`. The layer's empty default
|
|
150
|
+
keeps the header valid when the consuming site does not supply a picker.
|
|
151
|
+
|
|
122
152
|
## Error recovery
|
|
123
153
|
|
|
154
|
+
An existing Markdown file with no body content renders a **No content yet**
|
|
155
|
+
view inside the documentation shell, with a themed vector illustration and a
|
|
156
|
+
link back to the documentation. Zero-byte, whitespace-only and frontmatter-only
|
|
157
|
+
pages remain valid pages rather than 404s. Header, navigation, configured page
|
|
158
|
+
actions and Previous/Next remain available. Adding body content replaces the
|
|
159
|
+
empty view automatically.
|
|
160
|
+
|
|
161
|
+
Set `selarasDocs.empty.title` and `selarasDocs.empty.description` in
|
|
162
|
+
`app.config.ts` to change its copy. Its home action uses `errors.homeTo` and
|
|
163
|
+
`errors.homeLabel`, matching the recovery screens. Override
|
|
164
|
+
`components/DocsEmptyState.vue` for a different empty-page design; its
|
|
165
|
+
`illustration` slot defaults to the existing `DocsErrorIllustration` component.
|
|
166
|
+
|
|
167
|
+
### Errors
|
|
168
|
+
|
|
124
169
|
The layer provides a default `error.vue` for missing pages and fatal errors.
|
|
125
170
|
It preserves the HTTP status code, keeps error pages out of search indexes and
|
|
126
171
|
offers a home link or reload action. The standalone screen avoids loading
|
package/app/app.config.ts
CHANGED
package/app/assets/style.css
CHANGED
|
@@ -117,6 +117,10 @@
|
|
|
117
117
|
gap: 3rem;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
+
.selaras-docs-page-grid.selaras-docs-page-grid--wide {
|
|
121
|
+
grid-template-columns: minmax(0, 1fr);
|
|
122
|
+
}
|
|
123
|
+
|
|
120
124
|
.selaras-docs-article {
|
|
121
125
|
min-width: 0;
|
|
122
126
|
}
|
|
@@ -133,21 +137,53 @@
|
|
|
133
137
|
width: 14rem;
|
|
134
138
|
}
|
|
135
139
|
|
|
136
|
-
.selaras-docs-
|
|
140
|
+
.selaras-docs-page-actions {
|
|
141
|
+
display: flex;
|
|
142
|
+
flex-direction: column;
|
|
143
|
+
gap: 0.25rem;
|
|
144
|
+
margin-top: 1.5rem;
|
|
145
|
+
padding-top: 1rem;
|
|
146
|
+
border-top: 1px solid var(--selaras-resolved-border-default);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.selaras-docs-article > .selaras-docs-page-actions {
|
|
150
|
+
margin-top: 2.5rem;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.selaras-docs-edit-link,
|
|
154
|
+
.selaras-docs-issue-link {
|
|
137
155
|
display: inline-flex;
|
|
156
|
+
width: fit-content;
|
|
157
|
+
min-height: 2rem;
|
|
138
158
|
align-items: center;
|
|
139
|
-
gap: 0.
|
|
140
|
-
margin-top: 2.5rem;
|
|
159
|
+
gap: 0.5rem;
|
|
141
160
|
color: var(--selaras-resolved-text-muted);
|
|
142
|
-
font-size: 0.
|
|
161
|
+
font-size: 0.8125rem;
|
|
162
|
+
line-height: 1.5;
|
|
143
163
|
text-decoration: none;
|
|
164
|
+
text-underline-offset: 0.25em;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.selaras-docs-edit-link .iconify,
|
|
168
|
+
.selaras-docs-issue-link .iconify {
|
|
169
|
+
width: 1rem;
|
|
170
|
+
height: 1rem;
|
|
171
|
+
flex-shrink: 0;
|
|
144
172
|
}
|
|
145
173
|
|
|
146
|
-
.selaras-docs-edit-link:hover
|
|
174
|
+
.selaras-docs-edit-link:hover,
|
|
175
|
+
.selaras-docs-issue-link:hover {
|
|
147
176
|
color: var(--selaras-resolved-text-default);
|
|
148
177
|
text-decoration: underline;
|
|
149
178
|
}
|
|
150
179
|
|
|
180
|
+
.selaras-docs-edit-link:focus-visible,
|
|
181
|
+
.selaras-docs-issue-link:focus-visible {
|
|
182
|
+
outline: 2px solid var(--selaras-resolved-color-primary-focus);
|
|
183
|
+
outline-offset: 3px;
|
|
184
|
+
border-radius: var(--selaras-resolved-radius-sm);
|
|
185
|
+
}
|
|
186
|
+
|
|
151
187
|
.selaras-docs-surround {
|
|
152
188
|
margin-top: 2rem;
|
|
153
189
|
}
|
|
@@ -219,6 +255,13 @@
|
|
|
219
255
|
background: var(--selaras-resolved-surface-elevated);
|
|
220
256
|
}
|
|
221
257
|
|
|
258
|
+
.selaras-docs-footer-attribution-logo {
|
|
259
|
+
width: 1rem;
|
|
260
|
+
height: 1rem;
|
|
261
|
+
flex-shrink: 0;
|
|
262
|
+
color: var(--selaras-resolved-color-primary-fill);
|
|
263
|
+
}
|
|
264
|
+
|
|
222
265
|
.selaras-docs-footer-links a:focus-visible {
|
|
223
266
|
outline: 2px solid var(--selaras-resolved-color-primary-fill);
|
|
224
267
|
outline-offset: 2px;
|
|
@@ -231,6 +274,10 @@
|
|
|
231
274
|
}
|
|
232
275
|
|
|
233
276
|
@media (min-width: 64rem) {
|
|
277
|
+
.selaras-docs-page-actions--mobile {
|
|
278
|
+
display: none;
|
|
279
|
+
}
|
|
280
|
+
|
|
234
281
|
.selaras-docs-nav-toggle {
|
|
235
282
|
display: none;
|
|
236
283
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import { getDocsRepositoryLinks } from '../utils/repository-links'
|
|
3
|
+
|
|
2
4
|
const props = defineProps<{
|
|
3
5
|
path: string
|
|
4
6
|
}>()
|
|
@@ -6,26 +8,12 @@ const props = defineProps<{
|
|
|
6
8
|
const appConfig = useAppConfig()
|
|
7
9
|
const docsConfig = computed(() => appConfig.selarasDocs ?? {})
|
|
8
10
|
|
|
9
|
-
const editUrl = computed(() =>
|
|
10
|
-
const repository = docsConfig.value.repository
|
|
11
|
-
if (!repository?.url || repository.editLinks === false)
|
|
12
|
-
return undefined
|
|
13
|
-
|
|
14
|
-
const base = repository.url.replace(/\/$/, '')
|
|
15
|
-
const relativePath = props.path === '/' ? 'index.md' : `${props.path.replace(/^\//, '')}.md`
|
|
16
|
-
const contentPath = [repository.contentDirectory ?? 'content', relativePath].join('/')
|
|
17
|
-
const branch = repository.branch ?? 'main'
|
|
18
|
-
|
|
19
|
-
if (base.startsWith('https://github.com/'))
|
|
20
|
-
return `${base}/edit/${branch}/${contentPath}`
|
|
21
|
-
if (base.startsWith('https://gitlab.com/'))
|
|
22
|
-
return `${base}/-/edit/${branch}/${contentPath}`
|
|
23
|
-
return undefined
|
|
24
|
-
})
|
|
11
|
+
const editUrl = computed(() => getDocsRepositoryLinks(docsConfig.value.repository, props.path).edit)
|
|
25
12
|
</script>
|
|
26
13
|
|
|
27
14
|
<template>
|
|
28
15
|
<a v-if="editUrl" :href="editUrl" class="selaras-docs-edit-link" target="_blank" rel="noreferrer">
|
|
16
|
+
<SIcon name="hugeicons:pencil-edit-01" aria-hidden="true" />
|
|
29
17
|
Edit this page
|
|
30
18
|
</a>
|
|
31
19
|
</template>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
withDefaults(defineProps<{ heading?: 'h1' | 'h2' }>(), { heading: 'h1' })
|
|
3
|
+
|
|
4
|
+
const appConfig = useAppConfig()
|
|
5
|
+
const config = useRuntimeConfig()
|
|
6
|
+
const headingId = useId()
|
|
7
|
+
const copy = computed(() => appConfig.selarasDocs?.empty ?? {})
|
|
8
|
+
const homeHref = computed(() => {
|
|
9
|
+
const path = appConfig.selarasDocs?.errors?.homeTo ?? '/'
|
|
10
|
+
return `${config.app.baseURL.replace(/\/$/, '')}/${path.replace(/^\//, '')}`
|
|
11
|
+
})
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<section class="selaras-docs-empty-state not-prose" data-docs-empty-state :aria-labelledby="headingId">
|
|
16
|
+
<div class="selaras-docs-empty-artwork">
|
|
17
|
+
<slot name="illustration">
|
|
18
|
+
<DocsErrorIllustration missing />
|
|
19
|
+
</slot>
|
|
20
|
+
</div>
|
|
21
|
+
<component :is="heading" :id="headingId" class="selaras-docs-empty-title">
|
|
22
|
+
{{ copy.title ?? 'No content yet' }}
|
|
23
|
+
</component>
|
|
24
|
+
<p class="selaras-docs-empty-description">
|
|
25
|
+
{{ copy.description ?? 'There’s no content on this page yet. You can explore the rest of the documentation using the navigation.' }}
|
|
26
|
+
</p>
|
|
27
|
+
<SButton as="a" :href="homeHref" variant="outline" color="neutral" class="selaras-docs-empty-action">
|
|
28
|
+
{{ appConfig.selarasDocs?.errors?.homeLabel ?? 'Back to documentation' }}
|
|
29
|
+
</SButton>
|
|
30
|
+
</section>
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
<style scoped>
|
|
34
|
+
.selaras-docs-empty-state {
|
|
35
|
+
max-width: 32rem;
|
|
36
|
+
margin: 3rem auto;
|
|
37
|
+
color: var(--selaras-resolved-text-default);
|
|
38
|
+
text-align: center;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.selaras-docs-empty-artwork {
|
|
42
|
+
width: min(100%, 18rem);
|
|
43
|
+
margin: 0 auto 1.5rem;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.selaras-docs-empty-artwork :deep(svg) {
|
|
47
|
+
display: block;
|
|
48
|
+
width: 100%;
|
|
49
|
+
height: auto;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.selaras-docs-empty-title {
|
|
53
|
+
margin: 0;
|
|
54
|
+
font-size: clamp(1.5rem, 1.25rem + 1vw, 2rem);
|
|
55
|
+
font-weight: 600;
|
|
56
|
+
line-height: 1.25;
|
|
57
|
+
letter-spacing: -0.025em;
|
|
58
|
+
text-wrap: balance;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.selaras-docs-empty-description {
|
|
62
|
+
max-width: 42ch;
|
|
63
|
+
margin: 0.875rem auto 0;
|
|
64
|
+
color: var(--selaras-resolved-text-muted);
|
|
65
|
+
line-height: 1.7;
|
|
66
|
+
text-wrap: pretty;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.selaras-docs-empty-action {
|
|
70
|
+
margin-top: 1.5rem;
|
|
71
|
+
}
|
|
72
|
+
</style>
|
|
@@ -18,6 +18,11 @@ const footer = computed(() => docsConfig.value.footer)
|
|
|
18
18
|
:aria-label="link.ariaLabel ?? link.label"
|
|
19
19
|
>
|
|
20
20
|
<SIcon v-if="link.icon" :name="link.icon" />
|
|
21
|
+
<svg v-else-if="link.to === 'https://selarasui.my.id'" class="selaras-docs-footer-attribution-logo" viewBox="0 0 256 256" fill="currentColor" aria-hidden="true" focusable="false">
|
|
22
|
+
<path d="M28 80 H68 C94 80 118 36 144 36 H228 V62 H144 C118 62 94 106 68 106 H28 Z" />
|
|
23
|
+
<path d="M28 134 H68 C94 134 118 90 144 90 H228 V116 H144 C118 116 94 160 68 160 H28 Z" />
|
|
24
|
+
<path d="M28 188 H68 C94 188 118 144 144 144 H228 V170 H144 C118 170 94 214 68 214 H28 Z" />
|
|
25
|
+
</svg>
|
|
21
26
|
<span v-if="link.label">{{ link.label }}</span>
|
|
22
27
|
</NuxtLink>
|
|
23
28
|
</nav>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { getDocsRepositoryLinks } from '../utils/repository-links'
|
|
3
|
+
|
|
4
|
+
const props = withDefaults(defineProps<{
|
|
5
|
+
path: string
|
|
6
|
+
title?: string
|
|
7
|
+
editLink?: boolean
|
|
8
|
+
issueLink?: boolean
|
|
9
|
+
}>(), { editLink: true, issueLink: true })
|
|
10
|
+
|
|
11
|
+
const appConfig = useAppConfig()
|
|
12
|
+
const links = computed(() => getDocsRepositoryLinks(appConfig.selarasDocs?.repository, props.path, props.title))
|
|
13
|
+
const hasEditLink = computed(() => props.editLink && !!links.value.edit)
|
|
14
|
+
const hasIssueLink = computed(() => props.issueLink && !!links.value.issue)
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<nav v-if="hasEditLink || hasIssueLink" class="selaras-docs-page-actions" aria-label="Page actions">
|
|
19
|
+
<DocsEditLink v-if="hasEditLink" :path="path" />
|
|
20
|
+
<a v-if="hasIssueLink" :href="links.issue" target="_blank" rel="noreferrer" class="selaras-docs-issue-link">
|
|
21
|
+
<SIcon name="hugeicons:bug-01" aria-hidden="true" />
|
|
22
|
+
Report an issue
|
|
23
|
+
</a>
|
|
24
|
+
</nav>
|
|
25
|
+
</template>
|
package/app/pages/[...slug].vue
CHANGED
|
@@ -52,19 +52,30 @@ const proseComponents = {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
const tocLinks = computed(() => (page.value?.body?.toc?.links ?? []) as unknown as TocLink[])
|
|
55
|
+
const hasToc = computed(() => page.value?.toc !== false && page.value?.aside !== false && appConfig.selarasDocs?.toc?.enabled !== false && tocLinks.value.length > 0)
|
|
55
56
|
const surround = useDocsSurround()
|
|
56
57
|
</script>
|
|
57
58
|
|
|
58
59
|
<template>
|
|
59
60
|
<DocsErrorState v-if="error || !page" kind="page" :pending="status === 'pending'" @retry="retryPage" />
|
|
60
61
|
<SContainer v-else size="full" class="selaras-docs-page" :class="{ 'selaras-docs-page--fluid': appConfig.selarasDocs?.main?.fluid }">
|
|
61
|
-
<div class="selaras-docs-page-grid">
|
|
62
|
+
<div class="selaras-docs-page-grid" :class="{ 'selaras-docs-page-grid--wide': !hasToc }">
|
|
62
63
|
<article class="selaras-docs-article">
|
|
63
64
|
<p v-if="page!.description" class="selaras-docs-description">
|
|
64
65
|
{{ page!.description }}
|
|
65
66
|
</p>
|
|
66
|
-
<ContentRenderer :value="page!" :components="proseComponents" class="selaras-docs-content selaras-prose"
|
|
67
|
-
|
|
67
|
+
<ContentRenderer :value="page!" :components="proseComponents" class="selaras-docs-content selaras-prose">
|
|
68
|
+
<template #empty>
|
|
69
|
+
<DocsEmptyState />
|
|
70
|
+
</template>
|
|
71
|
+
</ContentRenderer>
|
|
72
|
+
<DocsPageActions
|
|
73
|
+
:path="route.path"
|
|
74
|
+
:title="page!.title"
|
|
75
|
+
:edit-link="page!.editLink !== false"
|
|
76
|
+
:issue-link="page!.issueLink !== false"
|
|
77
|
+
:class="{ 'selaras-docs-page-actions--mobile': hasToc }"
|
|
78
|
+
/>
|
|
68
79
|
<SContentSurround
|
|
69
80
|
v-if="page!.prevNext !== false"
|
|
70
81
|
:prev="surround.prev"
|
|
@@ -72,7 +83,9 @@ const surround = useDocsSurround()
|
|
|
72
83
|
class="selaras-docs-surround"
|
|
73
84
|
/>
|
|
74
85
|
</article>
|
|
75
|
-
<DocsTableOfContents v-if="
|
|
86
|
+
<DocsTableOfContents v-if="hasToc" :links="tocLinks">
|
|
87
|
+
<DocsPageActions :path="route.path" :title="page!.title" :edit-link="page!.editLink !== false" :issue-link="page!.issueLink !== false" />
|
|
88
|
+
</DocsTableOfContents>
|
|
76
89
|
</div>
|
|
77
90
|
</SContainer>
|
|
78
91
|
</template>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { SelarasDocsAppConfig } from '../../types'
|
|
2
|
+
|
|
3
|
+
export function getDocsRepositoryLinks(repository: SelarasDocsAppConfig['repository'], path: string, title?: string) {
|
|
4
|
+
const links: { edit?: string, issue?: string } = {}
|
|
5
|
+
const base = repository?.url?.replace(/\/$/, '')
|
|
6
|
+
const github = base?.startsWith('https://github.com/')
|
|
7
|
+
const gitlab = base?.startsWith('https://gitlab.com/')
|
|
8
|
+
|
|
9
|
+
if (base && (github || gitlab) && repository?.editLinks !== false) {
|
|
10
|
+
const relativePath = path === '/' ? 'index.md' : `${path.replace(/^\//, '')}.md`
|
|
11
|
+
const contentPath = [repository?.contentDirectory ?? 'content', relativePath].join('/')
|
|
12
|
+
const branch = repository?.branch ?? 'main'
|
|
13
|
+
links.edit = `${base}/${gitlab ? '-/edit' : 'edit'}/${branch}/${contentPath}`
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (repository?.issueLinks !== false) {
|
|
17
|
+
if (repository?.issueUrl) {
|
|
18
|
+
links.issue = repository.issueUrl
|
|
19
|
+
}
|
|
20
|
+
else if (base && (github || gitlab)) {
|
|
21
|
+
const url = new URL(`${base}/${gitlab ? '-/issues/new' : 'issues/new'}`)
|
|
22
|
+
url.searchParams.set(gitlab ? 'issue[title]' : 'title', `Documentation: ${title ?? path}`)
|
|
23
|
+
url.searchParams.set(gitlab ? 'issue[description]' : 'body', `Documentation page: ${path}\n\n`)
|
|
24
|
+
links.issue = url.href
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return links
|
|
29
|
+
}
|
package/content.config.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sewadah/selaras-docs",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.3.1",
|
|
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": "^0.
|
|
36
|
+
"@sewadah/selaras": "^0.10.0",
|
|
37
37
|
"tailwindcss": "^4.3.0"
|
|
38
38
|
}
|
|
39
39
|
}
|
package/types.d.ts
CHANGED
|
@@ -45,6 +45,11 @@ export interface SelarasDocsErrorCopy {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
export interface SelarasDocsAppConfig {
|
|
48
|
+
/** Copy shown for an existing Markdown page with no body content. */
|
|
49
|
+
empty?: {
|
|
50
|
+
title?: string
|
|
51
|
+
description?: string
|
|
52
|
+
}
|
|
48
53
|
/** Recovery messages and the destination of error-screen home links. */
|
|
49
54
|
errors?: Partial<Record<SelarasDocsErrorKind, SelarasDocsErrorCopy>> & {
|
|
50
55
|
/** An internal route, resolved under the application's base URL. @default '/' */
|
|
@@ -70,13 +75,17 @@ export interface SelarasDocsAppConfig {
|
|
|
70
75
|
branch?: string
|
|
71
76
|
contentDirectory?: string
|
|
72
77
|
editLinks?: boolean
|
|
78
|
+
/** Show a page-context issue link. @default true */
|
|
79
|
+
issueLinks?: boolean
|
|
80
|
+
/** Override the new-issue destination, e.g. for a separate issue tracker. */
|
|
81
|
+
issueUrl?: string
|
|
73
82
|
}
|
|
74
83
|
header?: {
|
|
75
84
|
title?: string
|
|
76
85
|
showTitle?: boolean
|
|
77
86
|
search?: boolean
|
|
78
87
|
colorMode?: boolean
|
|
79
|
-
/** Show the consuming site's
|
|
88
|
+
/** Show the consuming site's DocsThemePicker component; the layer default is empty. @default false */
|
|
80
89
|
themePicker?: boolean
|
|
81
90
|
/** Let the header span the viewport instead of the docs shell width. */
|
|
82
91
|
fluid?: boolean
|