@astrojs/starlight 0.0.12 → 0.0.13
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 +18 -0
- package/components/PrevNextLinks.astro +1 -1
- package/components/Search.astro +6 -2
- package/components/ThemeProvider.astro +0 -8
- package/global.d.ts +5 -0
- package/package.json +3 -3
- package/utils/navigation.ts +9 -1
- package/utils/routing.ts +4 -1
- package/utils/slugs.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @astrojs/starlight
|
|
2
2
|
|
|
3
|
+
## 0.0.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`8688778`](https://github.com/withastro/starlight/commit/86887786d158e4cdb9e4bd021b2232eb6dba284c) Thanks [@delucis](https://github.com/delucis)! - Fix small CSS compatibility issue
|
|
8
|
+
|
|
9
|
+
- [#93](https://github.com/withastro/starlight/pull/93) [`c6d7960`](https://github.com/withastro/starlight/commit/c6d7960c8673886eb2b17843e78a897133c05fe2) Thanks [@delucis](https://github.com/delucis)! - Fix default locale routing bug when not using root locale
|
|
10
|
+
|
|
11
|
+
- [`d8a171b`](https://github.com/withastro/starlight/commit/d8a171b6b45c73151485fe8f08630fb6a1cc12a6) Thanks [@delucis](https://github.com/delucis)! - Fix autogenerated sidebar bug with index routes in subdirectories
|
|
12
|
+
|
|
13
|
+
- [`d8b9f32`](https://github.com/withastro/starlight/commit/d8b9f3260daaceed8a31eedcc44bd00733f96254) Thanks [@delucis](https://github.com/delucis)! - Fix false positive in sidebar autogeneration logic
|
|
14
|
+
|
|
15
|
+
- [#92](https://github.com/withastro/starlight/pull/92) [`02821d2`](https://github.com/withastro/starlight/commit/02821d2c8a58c485697cb8f0770c6ba63e709b2a) Thanks [@delucis](https://github.com/delucis)! - Update Pagefind to latest v1 alpha
|
|
16
|
+
|
|
17
|
+
- [`51fe914`](https://github.com/withastro/starlight/commit/51fe91468fea125ec33cb6d6b1b66f147302fdc0) Thanks [@delucis](https://github.com/delucis)! - Guarantee route and autogenerated sidebar sort order
|
|
18
|
+
|
|
19
|
+
- [`116c4f5`](https://github.com/withastro/starlight/commit/116c4f5eb0ddf4dddbd10005bc72a7e6cb880a67) Thanks [@delucis](https://github.com/delucis)! - Fix minor dev layout bug in Search modal for RTL languages
|
|
20
|
+
|
|
3
21
|
## 0.0.12
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/components/Search.astro
CHANGED
|
@@ -34,7 +34,7 @@ const t = useTranslations(Astro.props.locale);
|
|
|
34
34
|
</button>
|
|
35
35
|
{
|
|
36
36
|
import.meta.env.DEV ? (
|
|
37
|
-
<div style="margin: auto; text-align: center;">
|
|
37
|
+
<div style="margin: auto; text-align: center;" dir="ltr">
|
|
38
38
|
<p>Search is only available in production builds.</p>
|
|
39
39
|
<p>Try building and previewing the site to test it out locally.</p>
|
|
40
40
|
</div>
|
|
@@ -63,7 +63,11 @@ const t = useTranslations(Astro.props.locale);
|
|
|
63
63
|
|
|
64
64
|
/** Close the modal if a user clicks outside of the modal. */
|
|
65
65
|
const onWindowClick = (event: MouseEvent) => {
|
|
66
|
-
if (
|
|
66
|
+
if (
|
|
67
|
+
document.body.contains(event.target as Node) &&
|
|
68
|
+
!dialogFrame.contains(event.target as Node)
|
|
69
|
+
)
|
|
70
|
+
closeModal();
|
|
67
71
|
};
|
|
68
72
|
|
|
69
73
|
const openModal = (event?: MouseEvent) => {
|
|
@@ -2,14 +2,6 @@
|
|
|
2
2
|
import Icon from './Icon.astro';
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
<script>
|
|
6
|
-
declare global {
|
|
7
|
-
var StarlightThemeProvider: {
|
|
8
|
-
updatePickers(theme?: string): void;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
5
|
{/* This is intentionally inlined to avoid FOUC. */}
|
|
14
6
|
<script is:inline>
|
|
15
7
|
window.StarlightThemeProvider = (() => {
|
package/global.d.ts
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/starlight",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"description": "Build beautiful, high-performance documentation websites with Astro",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -36,12 +36,12 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@astrojs/mdx": "^0.19.1",
|
|
38
38
|
"@astrojs/sitemap": "^1.3.1",
|
|
39
|
-
"@pagefind/default-ui": "^0.
|
|
39
|
+
"@pagefind/default-ui": "^1.0.0-alpha.5",
|
|
40
40
|
"@types/mdast": "^3.0.11",
|
|
41
41
|
"bcp-47": "^2.1.0",
|
|
42
42
|
"execa": "^7.1.1",
|
|
43
43
|
"hastscript": "^7.2.0",
|
|
44
|
-
"pagefind": "^0.
|
|
44
|
+
"pagefind": "^1.0.0-alpha.5",
|
|
45
45
|
"rehype": "^12.0.1",
|
|
46
46
|
"remark-directive": "^2.0.1",
|
|
47
47
|
"unified": "^10.1.2",
|
package/utils/navigation.ts
CHANGED
|
@@ -65,7 +65,13 @@ function groupFromAutogenerateConfig(
|
|
|
65
65
|
): Group {
|
|
66
66
|
const { directory } = item.autogenerate;
|
|
67
67
|
const localeDir = locale ? locale + '/' + directory : directory;
|
|
68
|
-
const dirDocs = routes.filter(
|
|
68
|
+
const dirDocs = routes.filter(
|
|
69
|
+
(doc) =>
|
|
70
|
+
// Match against `foo.md` or `foo/index.md`.
|
|
71
|
+
doc.slug === localeDir ||
|
|
72
|
+
// Match against `foo/anything/else.md`.
|
|
73
|
+
doc.slug.startsWith(localeDir + '/')
|
|
74
|
+
);
|
|
69
75
|
const tree = treeify(dirDocs, localeDir);
|
|
70
76
|
return {
|
|
71
77
|
type: 'group',
|
|
@@ -108,6 +114,8 @@ function makeLink(href: string, label: string, currentPathname: string): Link {
|
|
|
108
114
|
|
|
109
115
|
/** Get the segments leading to a page. */
|
|
110
116
|
function getBreadcrumbs(slug: string, baseDir: string): string[] {
|
|
117
|
+
// Index slugs will match `baseDir` and don’t include breadcrumbs.
|
|
118
|
+
if (slug === baseDir) return [];
|
|
111
119
|
// Ensure base directory ends in a trailing slash.
|
|
112
120
|
if (!baseDir.endsWith('/')) baseDir += '/';
|
|
113
121
|
// Strip base directory from slug if present.
|
package/utils/routing.ts
CHANGED
|
@@ -76,7 +76,10 @@ function getRoutes(): Route[] {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
// Sort alphabetically by page slug to guarantee order regardless of platform.
|
|
80
|
+
return routes.sort((a, b) =>
|
|
81
|
+
a.slug < b.slug ? -1 : a.slug > b.slug ? 1 : 0
|
|
82
|
+
);
|
|
80
83
|
}
|
|
81
84
|
export const routes = getRoutes();
|
|
82
85
|
|
package/utils/slugs.ts
CHANGED
|
@@ -82,6 +82,7 @@ export function localizedSlug(
|
|
|
82
82
|
const slugLocale = slugToLocale(slug);
|
|
83
83
|
if (slugLocale === locale) return slug;
|
|
84
84
|
locale = locale || '';
|
|
85
|
+
if (slugLocale === slug) return locale;
|
|
85
86
|
if (slugLocale) {
|
|
86
87
|
return slug
|
|
87
88
|
.replace(slugLocale + '/', locale ? locale + '/' : '')
|