@astrojs/starlight 0.7.0 → 0.7.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 +8 -0
- package/package.json +2 -2
- package/user-components/LinkCard.astro +21 -10
- package/utils/navigation.ts +18 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @astrojs/starlight
|
|
2
2
|
|
|
3
|
+
## 0.7.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#488](https://github.com/withastro/starlight/pull/488) [`da35556`](https://github.com/withastro/starlight/commit/da35556eb95f2d397dfce03cc4acfacb0dcf1e89) Thanks [@mayank99](https://github.com/mayank99)! - Improved accessibility of LinkCard by only including the title as part of the link text, and using a pseudo-element to keep the card clickable.
|
|
8
|
+
|
|
9
|
+
- [#489](https://github.com/withastro/starlight/pull/489) [`35cd82e`](https://github.com/withastro/starlight/commit/35cd82e7f8622772a5155add99ad8baf61ae08a1) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Respect `hidden` sidebar frontmatter property when no sidebar configuration is provided
|
|
10
|
+
|
|
3
11
|
## 0.7.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/starlight",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Build beautiful, high-performance documentation websites with Astro",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/node": "^18.16.19",
|
|
35
35
|
"@vitest/coverage-v8": "^0.33.0",
|
|
36
|
-
"astro": "^2.10.
|
|
36
|
+
"astro": "^2.10.5",
|
|
37
37
|
"vitest": "^0.33.0"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
@@ -11,25 +11,36 @@ const { title, description, ...attributes } = Astro.props;
|
|
|
11
11
|
---
|
|
12
12
|
|
|
13
13
|
<div>
|
|
14
|
-
<
|
|
15
|
-
<
|
|
14
|
+
<span class="flex stack">
|
|
15
|
+
<a {...attributes}>
|
|
16
16
|
<span class="title" set:html={title} />
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
</a>
|
|
18
|
+
{description && <span class="description" set:html={description} />}
|
|
19
|
+
</span>
|
|
20
|
+
<Icon name="right-arrow" size="1.333em" class="icon rtl:flip" />
|
|
21
21
|
</div>
|
|
22
22
|
|
|
23
23
|
<style>
|
|
24
|
-
|
|
24
|
+
div {
|
|
25
25
|
display: grid;
|
|
26
26
|
grid-template-columns: 1fr auto;
|
|
27
27
|
gap: 0.5rem;
|
|
28
28
|
border: 1px solid var(--sl-color-gray-5);
|
|
29
29
|
border-radius: 0.5rem;
|
|
30
30
|
padding: 1rem;
|
|
31
|
-
text-decoration: none;
|
|
32
31
|
box-shadow: var(--sl-shadow-sm);
|
|
32
|
+
position: relative;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
a {
|
|
36
|
+
text-decoration: none;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* a11y fix for https://github.com/withastro/starlight/issues/487 */
|
|
40
|
+
a::before {
|
|
41
|
+
content: '';
|
|
42
|
+
position: absolute;
|
|
43
|
+
inset: 0;
|
|
33
44
|
}
|
|
34
45
|
|
|
35
46
|
.stack {
|
|
@@ -54,12 +65,12 @@ const { title, description, ...attributes } = Astro.props;
|
|
|
54
65
|
}
|
|
55
66
|
|
|
56
67
|
/* Hover state */
|
|
57
|
-
|
|
68
|
+
div:hover {
|
|
58
69
|
background: var(--sl-color-gray-7, var(--sl-color-gray-6));
|
|
59
70
|
border-color: var(--sl-color-gray-2);
|
|
60
71
|
}
|
|
61
72
|
|
|
62
|
-
|
|
73
|
+
div:hover .icon {
|
|
63
74
|
color: var(--sl-color-white);
|
|
64
75
|
}
|
|
65
76
|
</style>
|
package/utils/navigation.ts
CHANGED
|
@@ -83,11 +83,9 @@ function groupFromAutogenerateConfig(
|
|
|
83
83
|
const dirDocs = routes.filter(
|
|
84
84
|
(doc) =>
|
|
85
85
|
// Match against `foo.md` or `foo/index.md`.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
// Remove any entries that should be hidden
|
|
90
|
-
!doc.entry.data.sidebar.hidden
|
|
86
|
+
stripExtension(doc.id) === localeDir ||
|
|
87
|
+
// Match against `foo/anything/else.md`.
|
|
88
|
+
doc.id.startsWith(localeDir + '/')
|
|
91
89
|
);
|
|
92
90
|
const tree = treeify(dirDocs, localeDir);
|
|
93
91
|
return {
|
|
@@ -145,20 +143,23 @@ function getBreadcrumbs(path: string, baseDir: string): string[] {
|
|
|
145
143
|
/** Turn a flat array of routes into a tree structure. */
|
|
146
144
|
function treeify(routes: Route[], baseDir: string): Dir {
|
|
147
145
|
const treeRoot: Dir = makeDir();
|
|
148
|
-
routes
|
|
149
|
-
|
|
146
|
+
routes
|
|
147
|
+
// Remove any entries that should be hidden
|
|
148
|
+
.filter((doc) => !doc.entry.data.sidebar.hidden)
|
|
149
|
+
.forEach((doc) => {
|
|
150
|
+
const breadcrumbs = getBreadcrumbs(doc.id, baseDir);
|
|
150
151
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
152
|
+
// Walk down the route’s path to generate the tree.
|
|
153
|
+
let currentDir = treeRoot;
|
|
154
|
+
breadcrumbs.forEach((dir) => {
|
|
155
|
+
// Create new folder if needed.
|
|
156
|
+
if (typeof currentDir[dir] === 'undefined') currentDir[dir] = makeDir();
|
|
157
|
+
// Go into the subdirectory.
|
|
158
|
+
currentDir = currentDir[dir] as Dir;
|
|
159
|
+
});
|
|
160
|
+
// We’ve walked through the path. Register the route in this directory.
|
|
161
|
+
currentDir[basename(doc.slug)] = doc;
|
|
158
162
|
});
|
|
159
|
-
// We’ve walked through the path. Register the route in this directory.
|
|
160
|
-
currentDir[basename(doc.slug)] = doc;
|
|
161
|
-
});
|
|
162
163
|
return treeRoot;
|
|
163
164
|
}
|
|
164
165
|
|