@astrojs/starlight 0.1.1 → 0.1.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/404.astro +2 -2
- package/CHANGELOG.md +22 -0
- package/components/HeadSEO.astro +3 -3
- package/components/Hero.astro +13 -7
- package/components/MarkdownContent.astro +2 -1
- package/components/Search.astro +1 -0
- package/components/Sidebar.astro +4 -0
- package/components/SidebarSublist.astro +1 -1
- package/components/SiteTitle.astro +2 -2
- package/package.json +1 -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,27 @@
|
|
|
1
1
|
# @astrojs/starlight
|
|
2
2
|
|
|
3
|
+
## 0.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#183](https://github.com/withastro/starlight/pull/183) [`89e0a04`](https://github.com/withastro/starlight/commit/89e0a04c26639246f550957acda2285e50417729) Thanks [@delucis](https://github.com/delucis)! - Fix disclosure caret rotation in sidebar sub-groups
|
|
8
|
+
|
|
9
|
+
- [#177](https://github.com/withastro/starlight/pull/177) [`bdafdb0`](https://github.com/withastro/starlight/commit/bdafdb050d9d4e2501485dff37b71a3175a3b0c8) Thanks [@rviscomi](https://github.com/rviscomi)! - Fix Markdown table overflow
|
|
10
|
+
|
|
11
|
+
- [#185](https://github.com/withastro/starlight/pull/185) [`4844915`](https://github.com/withastro/starlight/commit/4844915c25c9cdfb852e41584d93abfd85b82d08) Thanks [@delucis](https://github.com/delucis)! - Support setting an SVG as the hero image file
|
|
12
|
+
|
|
13
|
+
## 0.1.2
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#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.
|
|
18
|
+
|
|
19
|
+
- [#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
|
|
20
|
+
|
|
21
|
+
- [#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
|
|
22
|
+
|
|
23
|
+
- [`4f666ba`](https://github.com/withastro/starlight/commit/4f666ba4fad7118a31bae819eb6be068da9e4d94) Thanks [@delucis](https://github.com/delucis)! - Fix focus outline positioning in tabs
|
|
24
|
+
|
|
3
25
|
## 0.1.1
|
|
4
26
|
|
|
5
27
|
### Patch 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/Hero.astro
CHANGED
|
@@ -14,18 +14,24 @@ const {
|
|
|
14
14
|
image,
|
|
15
15
|
actions,
|
|
16
16
|
} = Astro.props.hero;
|
|
17
|
+
|
|
18
|
+
const imageAttrs = {
|
|
19
|
+
loading: 'eager' as const,
|
|
20
|
+
decoding: 'async' as const,
|
|
21
|
+
width: 400,
|
|
22
|
+
height: 400,
|
|
23
|
+
alt: image?.alt,
|
|
24
|
+
};
|
|
17
25
|
---
|
|
18
26
|
|
|
19
27
|
<div class="hero">
|
|
20
28
|
{
|
|
21
29
|
image?.file ? (
|
|
22
|
-
|
|
23
|
-
src={image.file}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
alt={image.alt}
|
|
28
|
-
/>
|
|
30
|
+
image.file.format === 'svg' ? (
|
|
31
|
+
<img src={image.file.src} {...imageAttrs} />
|
|
32
|
+
) : (
|
|
33
|
+
<Image src={image.file} {...imageAttrs} />
|
|
34
|
+
)
|
|
29
35
|
) : (
|
|
30
36
|
image?.html && <div class="hero-html flex" set:html={image.html} />
|
|
31
37
|
)
|
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
|
});
|
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
|
@@ -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
|
}
|