@astrojs/starlight 0.1.0 → 0.1.2
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/404.astro +2 -2
- package/CHANGELOG.md +20 -0
- package/components/HeadSEO.astro +3 -3
- package/components/Search.astro +2 -0
- package/components/Sidebar.astro +4 -0
- package/components/SiteTitle.astro +2 -2
- package/package.json +1 -1
- package/translations/fr.json +20 -0
- package/translations/index.ts +2 -1
- package/user-components/Tabs.astro +1 -0
- package/utils/base.ts +7 -1
- package/utils/navigation.ts +2 -2
package/404.astro
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
import config from 'virtual:starlight/user-config';
|
|
3
|
-
import {
|
|
3
|
+
import { pathWithBase } from './utils/base';
|
|
4
4
|
|
|
5
5
|
// Built-in CSS styles.
|
|
6
6
|
import './style/props.css';
|
|
@@ -40,7 +40,7 @@ const { lang = 'en', dir = 'ltr', locale } = config.defaultLocale || {};
|
|
|
40
40
|
<p>Houston, we have a problem.</p>
|
|
41
41
|
<p>
|
|
42
42
|
We couldn’t find that link. Check the address or
|
|
43
|
-
<a href={
|
|
43
|
+
<a href={pathWithBase('/')}>head back home</a>.
|
|
44
44
|
</p>
|
|
45
45
|
</MarkdownContent>
|
|
46
46
|
</main>
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @astrojs/starlight
|
|
2
2
|
|
|
3
|
+
## 0.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#174](https://github.com/withastro/starlight/pull/174) [`6ab31b4`](https://github.com/withastro/starlight/commit/6ab31b4900166f952c1ca5ec4e4a1ef66f31be97) Thanks [@rviscomi](https://github.com/rviscomi)! - Split `withBase` URL helper to fix use with files.
|
|
8
|
+
|
|
9
|
+
- [#168](https://github.com/withastro/starlight/pull/168) [`cb18eef`](https://github.com/withastro/starlight/commit/cb18eef4fda8227a6c5ec73589526dd7fbb8f4a6) Thanks [@BryceRussell](https://github.com/BryceRussell)! - Fix bottom padding on left sidebar
|
|
10
|
+
|
|
11
|
+
- [#167](https://github.com/withastro/starlight/pull/167) [`990ec53`](https://github.com/withastro/starlight/commit/990ec53dee099fdb6d113a3be5ef375c73e6945a) Thanks [@BryceRussell](https://github.com/BryceRussell)! - Add `bundlePath` option to Pagefind configuration
|
|
12
|
+
|
|
13
|
+
- [`4f666ba`](https://github.com/withastro/starlight/commit/4f666ba4fad7118a31bae819eb6be068da9e4d94) Thanks [@delucis](https://github.com/delucis)! - Fix focus outline positioning in tabs
|
|
14
|
+
|
|
15
|
+
## 0.1.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#155](https://github.com/withastro/starlight/pull/155) Thanks [@thomasbnt](https://github.com/thomasbnt)! - Add French language support
|
|
20
|
+
|
|
21
|
+
- [#158](https://github.com/withastro/starlight/pull/158) [`92d82f5`](https://github.com/withastro/starlight/commit/92d82f534c6ff8513b01f9f26748d9980a6d4c79) Thanks [@kevinzunigacuellar](https://github.com/kevinzunigacuellar)! - Fix word wrapping in search modal on narrow screens
|
|
22
|
+
|
|
3
23
|
## 0.1.0
|
|
4
24
|
|
|
5
25
|
### Minor Changes
|
package/components/HeadSEO.astro
CHANGED
|
@@ -4,7 +4,7 @@ import config from 'virtual:starlight/user-config';
|
|
|
4
4
|
import type { HeadConfigSchema } from '../schemas/head';
|
|
5
5
|
import { createHead } from '../utils/head';
|
|
6
6
|
import { localizedUrl } from '../utils/localizedUrl';
|
|
7
|
-
import {
|
|
7
|
+
import { fileWithBase } from '../utils/base';
|
|
8
8
|
|
|
9
9
|
interface Props {
|
|
10
10
|
data: CollectionEntry<'docs'>['data'];
|
|
@@ -33,7 +33,7 @@ const headDefaults: z.input<ReturnType<typeof HeadConfigSchema>> = [
|
|
|
33
33
|
tag: 'link',
|
|
34
34
|
attrs: {
|
|
35
35
|
rel: 'shortcut icon',
|
|
36
|
-
href:
|
|
36
|
+
href: fileWithBase('/favicon.svg'),
|
|
37
37
|
type: 'image/svg+xml',
|
|
38
38
|
},
|
|
39
39
|
},
|
|
@@ -81,7 +81,7 @@ if (Astro.site) {
|
|
|
81
81
|
tag: 'link',
|
|
82
82
|
attrs: {
|
|
83
83
|
rel: 'sitemap',
|
|
84
|
-
href:
|
|
84
|
+
href: fileWithBase('/sitemap-index.xml'),
|
|
85
85
|
},
|
|
86
86
|
});
|
|
87
87
|
}
|
package/components/Search.astro
CHANGED
|
@@ -108,6 +108,7 @@ const t = useTranslations(Astro.props.locale);
|
|
|
108
108
|
new PagefindUI({
|
|
109
109
|
element: '#starlight__search',
|
|
110
110
|
baseUrl: import.meta.env.BASE_URL,
|
|
111
|
+
bundlePath: import.meta.env.BASE_URL.replace(/\/$/, '') + '/_pagefind/',
|
|
111
112
|
showImages: false,
|
|
112
113
|
});
|
|
113
114
|
});
|
|
@@ -294,6 +295,7 @@ const t = useTranslations(Astro.props.locale);
|
|
|
294
295
|
|
|
295
296
|
#starlight__search .pagefind-ui__result-excerpt {
|
|
296
297
|
font-size: var(--sl-text-body-sm);
|
|
298
|
+
word-break: break-word;
|
|
297
299
|
}
|
|
298
300
|
|
|
299
301
|
#starlight__search mark {
|
package/components/Sidebar.astro
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
import { logos } from 'virtual:starlight/user-images';
|
|
3
3
|
import config from 'virtual:starlight/user-config';
|
|
4
|
-
import {
|
|
4
|
+
import { pathWithBase } from '../utils/base';
|
|
5
5
|
|
|
6
6
|
interface Props {
|
|
7
7
|
locale: string | undefined;
|
|
@@ -23,7 +23,7 @@ if (config.logo) {
|
|
|
23
23
|
if (err) throw new Error(err);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
const href =
|
|
26
|
+
const href = pathWithBase(Astro.props.locale || '/');
|
|
27
27
|
---
|
|
28
28
|
|
|
29
29
|
<a {href} class="site-title flex">
|
package/package.json
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"skipLink.label": "Aller au contenu",
|
|
3
|
+
"search.label": "Rechercher",
|
|
4
|
+
"search.shortcutLabel": "(Presser / pour rechercher)",
|
|
5
|
+
"search.cancelLabel": "Annuler",
|
|
6
|
+
"themeSelect.accessibleLabel": "Selectionner le thème",
|
|
7
|
+
"themeSelect.dark": "Dark",
|
|
8
|
+
"themeSelect.light": "Light",
|
|
9
|
+
"themeSelect.auto": "Auto",
|
|
10
|
+
"languageSelect.accessibleLabel": "Selectionner la langue",
|
|
11
|
+
"menuButton.accessibleLabel": "Menu",
|
|
12
|
+
"sidebarNav.accessibleLabel": "principale",
|
|
13
|
+
"tableOfContents.onThisPage": "Sur cette page",
|
|
14
|
+
"tableOfContents.overview": "Vue d'ensemble",
|
|
15
|
+
"i18n.untranslatedContent": "Ce contenu n'est pas encore disponible dans votre langue.",
|
|
16
|
+
"page.editLink": "Editer la page",
|
|
17
|
+
"page.lastUpdated": "Dernière mise à jour :",
|
|
18
|
+
"page.previousLink": "Précédent",
|
|
19
|
+
"page.nextLink": "Suivant"
|
|
20
|
+
}
|
package/translations/index.ts
CHANGED
|
@@ -4,9 +4,10 @@ import es from './es.json';
|
|
|
4
4
|
import de from './de.json';
|
|
5
5
|
import ja from './ja.json';
|
|
6
6
|
import pt from './pt.json';
|
|
7
|
+
import fr from './fr.json';
|
|
7
8
|
|
|
8
9
|
const parse = i18nSchema().required().strict().parse;
|
|
9
10
|
|
|
10
11
|
export default Object.fromEntries(
|
|
11
|
-
Object.entries({ en, es, de, ja, pt }).map(([key, dict]) => [key, parse(dict)])
|
|
12
|
+
Object.entries({ en, es, de, ja, pt, fr }).map(([key, dict]) => [key, parse(dict)])
|
|
12
13
|
);
|
|
@@ -58,6 +58,7 @@ const { html, panels } = processPanels(panelHtml);
|
|
|
58
58
|
text-decoration: none;
|
|
59
59
|
border-bottom: 2px solid var(--sl-color-gray-5);
|
|
60
60
|
color: var(--sl-color-gray-3);
|
|
61
|
+
outline-offset: var(--sl-outline-offset-inside);
|
|
61
62
|
}
|
|
62
63
|
.tab [role='tab'][aria-selected] {
|
|
63
64
|
color: var(--sl-color-white);
|
package/utils/base.ts
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
const base = stripTrailingSlash(import.meta.env.BASE_URL);
|
|
2
2
|
|
|
3
3
|
/** Get the a root-relative URL path with the site’s `base` prefixed. */
|
|
4
|
-
export function
|
|
4
|
+
export function pathWithBase(path: string) {
|
|
5
5
|
path = stripLeadingSlash(stripTrailingSlash(path));
|
|
6
6
|
return path ? base + '/' + path + '/' : base + '/';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
/** Get the a root-relative file URL path with the site’s `base` prefixed. */
|
|
10
|
+
export function fileWithBase(path: string) {
|
|
11
|
+
path = stripLeadingSlash(stripTrailingSlash(path));
|
|
12
|
+
return path ? base + '/' + path : base;
|
|
13
|
+
}
|
|
14
|
+
|
|
9
15
|
function stripLeadingSlash(path: string) {
|
|
10
16
|
return path.replace(/^\//, '');
|
|
11
17
|
}
|
package/utils/navigation.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { basename, dirname } from 'node:path';
|
|
2
2
|
import config from 'virtual:starlight/user-config';
|
|
3
|
-
import {
|
|
3
|
+
import { pathWithBase } from './base';
|
|
4
4
|
import { pickLang } from './i18n';
|
|
5
5
|
import { Route, getLocaleRoutes, routes } from './routing';
|
|
6
6
|
import { localeToLang, slugToPathname } from './slugs';
|
|
@@ -109,7 +109,7 @@ function linkFromConfig(
|
|
|
109
109
|
|
|
110
110
|
/** Create a link entry. */
|
|
111
111
|
function makeLink(href: string, label: string, currentPathname: string): Link {
|
|
112
|
-
if (!isAbsolute(href)) href =
|
|
112
|
+
if (!isAbsolute(href)) href = pathWithBase(href);
|
|
113
113
|
const isCurrent = href === currentPathname;
|
|
114
114
|
return { type: 'link', label, href, isCurrent };
|
|
115
115
|
}
|