@astrojs/starlight 0.10.4 → 0.11.0
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 +9 -4
- package/CHANGELOG.md +59 -0
- package/components/Badge.astro +1 -0
- package/components/Banner.astro +4 -4
- package/components/ContentPanel.astro +4 -0
- package/components/EditLink.astro +5 -24
- package/components/FallbackContentNotice.astro +2 -5
- package/components/Footer.astro +5 -32
- package/components/{HeadSEO.astro → Head.astro} +10 -14
- package/components/Header.astro +26 -16
- package/components/Hero.astro +6 -9
- package/components/Icons.ts +4 -0
- package/components/LanguageSelect.astro +1 -4
- package/components/LastUpdated.astro +5 -24
- package/components/MarkdownContent.astro +4 -0
- package/components/MobileMenuFooter.astro +17 -0
- package/components/MobileMenuToggle.astro +2 -4
- package/components/{TableOfContents/MobileTableOfContents.astro → MobileTableOfContents.astro} +26 -29
- package/components/Page.astro +120 -0
- package/{layout → components}/PageFrame.astro +16 -8
- package/components/{RightSidebarPanel.astro → PageSidebar.astro} +21 -9
- package/components/PageTitle.astro +16 -0
- package/components/{PrevNextLinks.astro → Pagination.astro} +3 -9
- package/components/Search.astro +5 -5
- package/components/Sidebar.astro +7 -36
- package/components/SidebarSublist.astro +8 -2
- package/components/SiteTitle.astro +1 -20
- package/components/SkipLink.astro +3 -5
- package/components/SocialIcons.astro +5 -34
- package/components/TableOfContents/TableOfContentsList.astro +1 -1
- package/components/TableOfContents/starlight-toc.ts +3 -1
- package/components/TableOfContents.astro +12 -15
- package/components/ThemeProvider.astro +1 -0
- package/components/ThemeSelect.astro +1 -4
- package/{layout → components}/TwoColumnContent.astro +2 -4
- package/constants.ts +4 -0
- package/index.astro +4 -2
- package/index.ts +10 -15
- package/integrations/virtual-user-config.ts +3 -0
- package/package.json +132 -3
- package/props.ts +1 -0
- package/schema.ts +3 -0
- package/schemas/components.ts +256 -0
- package/schemas/sidebar.ts +89 -0
- package/schemas/social.ts +65 -0
- package/style/reset.css +1 -1
- package/translations/index.ts +2 -0
- package/translations/vi.json +22 -0
- package/{components/TableOfContents → utils}/generateToC.ts +2 -1
- package/utils/navigation.ts +22 -5
- package/utils/route-data.ts +97 -0
- package/utils/routing.ts +10 -0
- package/utils/user-config.ts +15 -102
- package/utils/validateLogoImports.ts +21 -0
- package/virtual.d.ts +37 -0
- package/components/RightSidebar.astro +0 -36
- package/layout/Page.astro +0 -132
package/404.astro
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
import { getEntry } from 'astro:content';
|
|
3
3
|
import config from 'virtual:starlight/user-config';
|
|
4
4
|
import EmptyContent from './components/EmptyMarkdown.md';
|
|
5
|
-
import Page from './
|
|
5
|
+
import Page from './components/Page.astro';
|
|
6
|
+
import { generateRouteData } from './utils/route-data';
|
|
6
7
|
import type { StarlightDocsEntry } from './utils/routing';
|
|
7
8
|
import { useTranslations } from './utils/translations';
|
|
8
9
|
|
|
@@ -24,6 +25,8 @@ const fallbackEntry: StarlightDocsEntry = {
|
|
|
24
25
|
editUrl: false,
|
|
25
26
|
head: [],
|
|
26
27
|
hero: { tagline: t('404.text'), actions: [] },
|
|
28
|
+
pagefind: false,
|
|
29
|
+
sidebar: { hidden: false },
|
|
27
30
|
},
|
|
28
31
|
render: async () => ({
|
|
29
32
|
Content: EmptyContent,
|
|
@@ -35,8 +38,10 @@ const fallbackEntry: StarlightDocsEntry = {
|
|
|
35
38
|
const userEntry = await getEntry('docs', '404');
|
|
36
39
|
const entry = userEntry || fallbackEntry;
|
|
37
40
|
const { Content, headings } = await entry.render();
|
|
41
|
+
const route = generateRouteData({
|
|
42
|
+
props: { ...entryMeta, entryMeta, headings, entry, id: entry.id, slug: entry.slug },
|
|
43
|
+
url: Astro.url,
|
|
44
|
+
});
|
|
38
45
|
---
|
|
39
46
|
|
|
40
|
-
<Page {
|
|
41
|
-
<Content />
|
|
42
|
-
</Page>
|
|
47
|
+
<Page {...route}><Content /></Page>
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,64 @@
|
|
|
1
1
|
# @astrojs/starlight
|
|
2
2
|
|
|
3
|
+
## 0.11.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#774](https://github.com/withastro/starlight/pull/774) [`903a579`](https://github.com/withastro/starlight/commit/903a57942ceb99b68672c3fa54622b39cc5d76f8) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Support adding HTML attributes to sidebar links from config and frontmatter
|
|
8
|
+
|
|
9
|
+
- [#796](https://github.com/withastro/starlight/pull/796) [`372ec96`](https://github.com/withastro/starlight/commit/372ec96d31d0c1a9aa8bc1605de2b424bf9bd5af) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Add the `@astrojs/sitemap` and `@astrojs/mdx` integrations only if they are not detected in the Astro configuration.
|
|
10
|
+
|
|
11
|
+
⚠️ **BREAKING CHANGE** The minimum supported version of Astro is now v3.2.0. Make sure you update Astro at the same time as updating Starlight:
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
npm install astro@latest
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
- [#447](https://github.com/withastro/starlight/pull/447) [`b45719b`](https://github.com/withastro/starlight/commit/b45719b581353f8d8f0ce0a9b5c89132e902377b) Thanks [@andremralves](https://github.com/andremralves)! - Add `titleDelimiter` configuration option and include site title in page `<title>` tags
|
|
18
|
+
|
|
19
|
+
⚠️ **BREAKING CHANGE** — Previously, every page’s `<title>` only included its individual frontmatter title.
|
|
20
|
+
Now, `<title>` tags include the page title, a delimiter character (`|` by default), and the site title.
|
|
21
|
+
For example, in the Startlight docs, `<title>Configuration Reference</title>` is now `<title>Configuration Reference | Starlight</title>`.
|
|
22
|
+
|
|
23
|
+
If you have a page where you need to override this new behaviour, set a custom title using the `head` frontmatter property:
|
|
24
|
+
|
|
25
|
+
```md
|
|
26
|
+
---
|
|
27
|
+
title: My Page
|
|
28
|
+
head:
|
|
29
|
+
- tag: title
|
|
30
|
+
content: Custom Title
|
|
31
|
+
---
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
- [#709](https://github.com/withastro/starlight/pull/709) [`140e729`](https://github.com/withastro/starlight/commit/140e729a8bf12f805ae0b7e2b5ad959cf68d8e22) Thanks [@delucis](https://github.com/delucis)! - Add support for overriding Starlight’s built-in components
|
|
35
|
+
|
|
36
|
+
⚠️ **BREAKING CHANGE** — The page footer is now included on pages with `template: splash` in their frontmatter. Previously, this was not the case. If you are using `template: splash` and want to continue to hide footer elements, disable them in your frontmatter:
|
|
37
|
+
|
|
38
|
+
```md
|
|
39
|
+
---
|
|
40
|
+
title: Landing page
|
|
41
|
+
template: splash
|
|
42
|
+
# Disable unwanted footer elements as needed
|
|
43
|
+
editUrl: false
|
|
44
|
+
lastUpdated: false
|
|
45
|
+
prev: false
|
|
46
|
+
next: false
|
|
47
|
+
---
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
⚠️ **BREAKING CHANGE** — This change involved refactoring the structure of some of Starlight’s built-in components slightly. If you were previously overriding these using other techniques, you may need to adjust your code.
|
|
51
|
+
|
|
52
|
+
### Patch Changes
|
|
53
|
+
|
|
54
|
+
- [#815](https://github.com/withastro/starlight/pull/815) [`b7b23a2`](https://github.com/withastro/starlight/commit/b7b23a2c90a25fe8ea08338379b83d19c74d9037) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Add Facebook and email icons
|
|
55
|
+
|
|
56
|
+
- [#810](https://github.com/withastro/starlight/pull/810) [`dbe977b`](https://github.com/withastro/starlight/commit/dbe977b6ce3efcffefab850eca08bef316b41e53) Thanks [@hasham-qaiser](https://github.com/hasham-qaiser)! - Use `<span>` instead of `<h2>` in sidebar group headings
|
|
57
|
+
|
|
58
|
+
- [#807](https://github.com/withastro/starlight/pull/807) [`7c73dd1`](https://github.com/withastro/starlight/commit/7c73dd146ee294f9092346a0b0041990cc648a13) Thanks [@torn4dom4n](https://github.com/torn4dom4n)! - Add Vietnamese translations for Starlight UI
|
|
59
|
+
|
|
60
|
+
- [#756](https://github.com/withastro/starlight/pull/756) [`f55a8f0`](https://github.com/withastro/starlight/commit/f55a8f014a7addc46e971dd6b7148f4545acd16c) Thanks [@julien-deramond](https://github.com/julien-deramond)! - Prevent text from overflowing in several cases
|
|
61
|
+
|
|
3
62
|
## 0.10.4
|
|
4
63
|
|
|
5
64
|
### Patch Changes
|
package/components/Badge.astro
CHANGED
package/components/Banner.astro
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
2
|
+
import type { Props } from '../props';
|
|
3
|
+
|
|
4
|
+
const { banner } = Astro.props.entry.data;
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
<div class="sl-banner" set:html={
|
|
7
|
+
{banner && <div class="sl-banner" set:html={banner.content} />}
|
|
8
8
|
|
|
9
9
|
<style>
|
|
10
10
|
.sl-banner {
|
|
@@ -1,34 +1,15 @@
|
|
|
1
1
|
---
|
|
2
|
-
import type { CollectionEntry } from 'astro:content';
|
|
3
|
-
import config from 'virtual:starlight/user-config';
|
|
4
|
-
import project from 'virtual:starlight/project-context';
|
|
5
|
-
import { useTranslations } from '../utils/translations';
|
|
6
2
|
import Icon from '../user-components/Icon.astro';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
data: CollectionEntry<'docs'>['data'];
|
|
10
|
-
id: CollectionEntry<'docs'>['id'];
|
|
11
|
-
locale: string | undefined;
|
|
12
|
-
}
|
|
3
|
+
import type { Props } from '../props';
|
|
4
|
+
import { useTranslations } from '../utils/translations';
|
|
13
5
|
|
|
14
6
|
const t = useTranslations(Astro.props.locale);
|
|
15
|
-
const { editUrl } = Astro.props
|
|
16
|
-
const srcPath = project.srcDir.replace(project.root, '');
|
|
17
|
-
|
|
18
|
-
let { baseUrl } = config.editLink;
|
|
19
|
-
if (baseUrl && baseUrl.at(-1) !== '/') baseUrl += '/';
|
|
20
|
-
|
|
21
|
-
const url =
|
|
22
|
-
typeof editUrl === 'string'
|
|
23
|
-
? editUrl
|
|
24
|
-
: baseUrl
|
|
25
|
-
? baseUrl + srcPath + 'content/docs/' + Astro.props.id
|
|
26
|
-
: undefined;
|
|
7
|
+
const { editUrl } = Astro.props;
|
|
27
8
|
---
|
|
28
9
|
|
|
29
10
|
{
|
|
30
|
-
editUrl
|
|
31
|
-
<a href={
|
|
11
|
+
editUrl && (
|
|
12
|
+
<a href={editUrl} class="sl-flex">
|
|
32
13
|
<Icon name="pencil" size="1.2em" />
|
|
33
14
|
{t('page.editLink')}
|
|
34
15
|
</a>
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
import { useTranslations } from '../utils/translations';
|
|
3
2
|
import Icon from '../user-components/Icon.astro';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
locale: string | undefined;
|
|
7
|
-
}
|
|
3
|
+
import type { Props } from '../props';
|
|
4
|
+
import { useTranslations } from '../utils/translations';
|
|
8
5
|
|
|
9
6
|
const t = useTranslations(Astro.props.locale);
|
|
10
7
|
---
|
package/components/Footer.astro
CHANGED
|
@@ -1,42 +1,15 @@
|
|
|
1
1
|
---
|
|
2
|
-
import
|
|
3
|
-
import { type SidebarEntry, getPrevNextLinks } from '../utils/navigation';
|
|
4
|
-
import type { StarlightDocsEntry } from '../utils/routing';
|
|
5
|
-
import type { LocaleData } from '../utils/slugs';
|
|
2
|
+
import type { Props } from '../props';
|
|
6
3
|
|
|
7
|
-
import LastUpdated from '
|
|
8
|
-
import PrevNextLinks from '../components/PrevNextLinks.astro';
|
|
9
|
-
import EditLink from './EditLink.astro';
|
|
10
|
-
|
|
11
|
-
interface Props extends LocaleData {
|
|
12
|
-
entry: StarlightDocsEntry;
|
|
13
|
-
sidebar: SidebarEntry[];
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const { entry, dir, lang, locale, sidebar } = Astro.props;
|
|
17
|
-
const prevNextLinks = getPrevNextLinks(sidebar, config.pagination, {
|
|
18
|
-
prev: entry.data.prev,
|
|
19
|
-
next: entry.data.next,
|
|
20
|
-
});
|
|
4
|
+
import { EditLink, LastUpdated, Pagination } from 'virtual:starlight/components';
|
|
21
5
|
---
|
|
22
6
|
|
|
23
7
|
<footer>
|
|
24
8
|
<div class="meta sl-flex">
|
|
25
|
-
|
|
26
|
-
{
|
|
27
|
-
(entry.data.lastUpdated ?? config.lastUpdated) && (
|
|
28
|
-
<LastUpdated
|
|
29
|
-
id={entry.id}
|
|
30
|
-
{lang}
|
|
31
|
-
lastUpdated={
|
|
32
|
-
typeof entry.data.lastUpdated !== 'boolean' ? entry.data.lastUpdated : undefined
|
|
33
|
-
}
|
|
34
|
-
{locale}
|
|
35
|
-
/>
|
|
36
|
-
)
|
|
37
|
-
}
|
|
9
|
+
<EditLink {...Astro.props} />
|
|
10
|
+
<LastUpdated {...Astro.props} />
|
|
38
11
|
</div>
|
|
39
|
-
<
|
|
12
|
+
<Pagination {...Astro.props} />
|
|
40
13
|
</footer>
|
|
41
14
|
|
|
42
15
|
<style>
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
---
|
|
2
|
-
import type {
|
|
2
|
+
import type { z } from 'astro/zod';
|
|
3
3
|
import config from 'virtual:starlight/user-config';
|
|
4
|
+
import { version } from '../package.json';
|
|
4
5
|
import type { HeadConfigSchema } from '../schemas/head';
|
|
6
|
+
import { fileWithBase } from '../utils/base';
|
|
5
7
|
import { createHead } from '../utils/head';
|
|
6
8
|
import { localizedUrl } from '../utils/localizedUrl';
|
|
7
|
-
import {
|
|
8
|
-
import { version } from '../package.json';
|
|
9
|
-
|
|
10
|
-
interface Props {
|
|
11
|
-
data: CollectionEntry<'docs'>['data'];
|
|
12
|
-
lang: string;
|
|
13
|
-
}
|
|
9
|
+
import type { Props } from '../props';
|
|
14
10
|
|
|
15
|
-
const {
|
|
11
|
+
const { entry, lang } = Astro.props;
|
|
12
|
+
const { data } = entry;
|
|
16
13
|
|
|
17
14
|
const canonical = Astro.site ? new URL(Astro.url.pathname, Astro.site) : undefined;
|
|
18
|
-
const title = data.title || config.title;
|
|
19
15
|
const description = data.description || config.description;
|
|
20
16
|
|
|
21
17
|
const headDefaults: z.input<ReturnType<typeof HeadConfigSchema>> = [
|
|
@@ -24,7 +20,7 @@ const headDefaults: z.input<ReturnType<typeof HeadConfigSchema>> = [
|
|
|
24
20
|
tag: 'meta',
|
|
25
21
|
attrs: { name: 'viewport', content: 'width=device-width, initial-scale=1' },
|
|
26
22
|
},
|
|
27
|
-
{ tag: 'title', content: title },
|
|
23
|
+
{ tag: 'title', content: `${data.title} ${config.titleDelimiter} ${config.title}` },
|
|
28
24
|
{ tag: 'link', attrs: { rel: 'canonical', href: canonical?.href } },
|
|
29
25
|
{ tag: 'meta', attrs: { name: 'generator', content: Astro.generator } },
|
|
30
26
|
{
|
|
@@ -41,7 +37,7 @@ const headDefaults: z.input<ReturnType<typeof HeadConfigSchema>> = [
|
|
|
41
37
|
},
|
|
42
38
|
},
|
|
43
39
|
// OpenGraph Tags
|
|
44
|
-
{ tag: 'meta', attrs: { property: 'og:title', content: title } },
|
|
40
|
+
{ tag: 'meta', attrs: { property: 'og:title', content: data.title } },
|
|
45
41
|
{ tag: 'meta', attrs: { property: 'og:type', content: 'article' } },
|
|
46
42
|
{ tag: 'meta', attrs: { property: 'og:url', content: canonical?.href } },
|
|
47
43
|
{ tag: 'meta', attrs: { property: 'og:locale', content: lang } },
|
|
@@ -52,7 +48,7 @@ const headDefaults: z.input<ReturnType<typeof HeadConfigSchema>> = [
|
|
|
52
48
|
tag: 'meta',
|
|
53
49
|
attrs: { name: 'twitter:card', content: 'summary_large_image' },
|
|
54
50
|
},
|
|
55
|
-
{ tag: 'meta', attrs: { name: 'twitter:title', content: title } },
|
|
51
|
+
{ tag: 'meta', attrs: { name: 'twitter:title', content: data.title } },
|
|
56
52
|
{ tag: 'meta', attrs: { name: 'twitter:description', content: description } },
|
|
57
53
|
];
|
|
58
54
|
|
|
@@ -95,7 +91,7 @@ if (config.social?.twitter) {
|
|
|
95
91
|
tag: 'meta',
|
|
96
92
|
attrs: {
|
|
97
93
|
name: 'twitter:site',
|
|
98
|
-
content: new URL(config.social.twitter).pathname,
|
|
94
|
+
content: new URL(config.social.twitter.url).pathname,
|
|
99
95
|
},
|
|
100
96
|
});
|
|
101
97
|
}
|
package/components/Header.astro
CHANGED
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
---
|
|
2
|
-
import
|
|
3
|
-
import Search from './Search.astro';
|
|
4
|
-
import SiteTitle from './SiteTitle.astro';
|
|
5
|
-
import SocialIcons from './SocialIcons.astro';
|
|
6
|
-
import ThemeSelect from './ThemeSelect.astro';
|
|
2
|
+
import type { Props } from '../props';
|
|
7
3
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
import {
|
|
5
|
+
LanguageSelect,
|
|
6
|
+
Search,
|
|
7
|
+
SiteTitle,
|
|
8
|
+
SocialIcons,
|
|
9
|
+
ThemeSelect,
|
|
10
|
+
} from 'virtual:starlight/components';
|
|
13
11
|
---
|
|
14
12
|
|
|
15
13
|
<div class="header sl-flex">
|
|
16
|
-
<
|
|
17
|
-
|
|
14
|
+
<div class="sl-flex">
|
|
15
|
+
<SiteTitle {...Astro.props} />
|
|
16
|
+
</div>
|
|
17
|
+
<div class="sl-flex">
|
|
18
|
+
<Search {...Astro.props} />
|
|
19
|
+
</div>
|
|
18
20
|
<div class="sl-hidden md:sl-flex right-group">
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
<div class="sl-flex social-icons">
|
|
22
|
+
<SocialIcons {...Astro.props} />
|
|
23
|
+
</div>
|
|
24
|
+
<ThemeSelect {...Astro.props} />
|
|
25
|
+
<LanguageSelect {...Astro.props} />
|
|
22
26
|
</div>
|
|
23
27
|
</div>
|
|
24
28
|
|
|
@@ -30,10 +34,16 @@ const { locale } = Astro.props;
|
|
|
30
34
|
height: 100%;
|
|
31
35
|
}
|
|
32
36
|
|
|
33
|
-
.right-group
|
|
37
|
+
.right-group,
|
|
38
|
+
.social-icons {
|
|
34
39
|
gap: 1rem;
|
|
35
40
|
align-items: center;
|
|
36
41
|
}
|
|
42
|
+
.social-icons::after {
|
|
43
|
+
content: '';
|
|
44
|
+
height: 2rem;
|
|
45
|
+
border-inline-end: 1px solid var(--sl-color-gray-5);
|
|
46
|
+
}
|
|
37
47
|
|
|
38
48
|
@media (min-width: 50rem) {
|
|
39
49
|
:global(:root[data-has-sidebar]) {
|
package/components/Hero.astro
CHANGED
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
---
|
|
2
|
-
import type { CollectionEntry } from 'astro:content';
|
|
3
2
|
import { Image } from 'astro:assets';
|
|
3
|
+
import { PAGE_TITLE_ID } from '../constants';
|
|
4
|
+
import type { Props } from '../props';
|
|
4
5
|
import CallToAction from './CallToAction.astro';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
hero: NonNullable<CollectionEntry<'docs'>['data']['hero']>;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const { title = Astro.props.fallbackTitle, tagline, image, actions } = Astro.props.hero;
|
|
7
|
+
const { data } = Astro.props.entry;
|
|
8
|
+
const { title = data.title, tagline, image, actions = [] } = data.hero || {};
|
|
12
9
|
|
|
13
10
|
const imageAttrs = {
|
|
14
11
|
loading: 'eager' as const,
|
|
15
12
|
decoding: 'async' as const,
|
|
16
13
|
width: 400,
|
|
17
14
|
height: 400,
|
|
18
|
-
alt: image?.alt,
|
|
15
|
+
alt: image?.alt || '',
|
|
19
16
|
};
|
|
20
17
|
---
|
|
21
18
|
|
|
@@ -33,7 +30,7 @@ const imageAttrs = {
|
|
|
33
30
|
}
|
|
34
31
|
<div class="sl-flex stack">
|
|
35
32
|
<div class="sl-flex copy">
|
|
36
|
-
<h1 id=
|
|
33
|
+
<h1 id={PAGE_TITLE_ID} data-page-title set:html={title} />
|
|
37
34
|
{tagline && <div class="tagline" set:html={tagline} />}
|
|
38
35
|
</div>
|
|
39
36
|
{
|
package/components/Icons.ts
CHANGED
|
@@ -91,4 +91,8 @@ export const Icons = {
|
|
|
91
91
|
telegram:
|
|
92
92
|
'<path d="M22.26465,2.42773a2.04837,2.04837,0,0,0-2.07813-.32421L2.26562,9.33887a2.043,2.043,0,0,0,.1045,3.81836l3.625,1.26074,2.0205,6.68164A.998.998,0,0,0,8.134,21.352c.00775.012.01868.02093.02692.03259a.98844.98844,0,0,0,.21143.21576c.02307.01758.04516.03406.06982.04968a.98592.98592,0,0,0,.31073.13611l.01184.001.00671.00287a1.02183,1.02183,0,0,0,.20215.02051c.00653,0,.01233-.00312.0188-.00324a.99255.99255,0,0,0,.30109-.05231c.02258-.00769.04193-.02056.06384-.02984a.9931.9931,0,0,0,.20429-.11456,250.75993,250.75993,0,0,1,.15222-.12818L12.416,18.499l4.03027,3.12207a2.02322,2.02322,0,0,0,1.24121.42676A2.05413,2.05413,0,0,0,19.69531,20.415L22.958,4.39844A2.02966,2.02966,0,0,0,22.26465,2.42773ZM9.37012,14.73633a.99357.99357,0,0,0-.27246.50586l-.30951,1.504-.78406-2.59307,4.06525-2.11695ZM17.67188,20.04l-4.7627-3.68945a1.00134,1.00134,0,0,0-1.35352.11914l-.86541.9552.30584-1.48645,7.083-7.083a.99975.99975,0,0,0-1.16894-1.59375L6.74487,12.55432,3.02051,11.19141,20.999,3.999Z"/>',
|
|
93
93
|
rss: '<path d="M2.88,16.88a3,3,0,0,0,0,4.24,3,3,0,0,0,4.24,0,3,3,0,0,0-4.24-4.24Zm2.83,2.83a1,1,0,0,1-1.42-1.42,1,1,0,0,1,1.42,0A1,1,0,0,1,5.71,19.71ZM5,12a1,1,0,0,0,0,2,5,5,0,0,1,5,5,1,1,0,0,0,2,0,7,7,0,0,0-7-7ZM5,8a1,1,0,0,0,0,2,9,9,0,0,1,9,9,1,1,0,0,0,2,0,11.08,11.08,0,0,0-3.22-7.78A11.08,11.08,0,0,0,5,8Zm10.61.39A15.11,15.11,0,0,0,5,4,1,1,0,0,0,5,6,13,13,0,0,1,18,19a1,1,0,0,0,2,0A15.11,15.11,0,0,0,15.61,8.39Z"/>',
|
|
94
|
+
facebook:
|
|
95
|
+
'<path d="M20.9,2H3.1A1.1,1.1,0,0,0,2,3.1V20.9A1.1,1.1,0,0,0,3.1,22h9.58V14.25h-2.6v-3h2.6V9a3.64,3.64,0,0,1,3.88-4,20.26,20.26,0,0,1,2.33.12v2.7H17.3c-1.26,0-1.5.6-1.5,1.47v1.93h3l-.39,3H15.8V22h5.1A1.1,1.1,0,0,0,22,20.9V3.1A1.1,1.1,0,0,0,20.9,2Z"/>',
|
|
96
|
+
email:
|
|
97
|
+
'<path d="M19,4H5A3,3,0,0,0,2,7V17a3,3,0,0,0,3,3H19a3,3,0,0,0,3-3V7A3,3,0,0,0,19,4Zm-.41,2-5.88,5.88a1,1,0,0,1-1.42,0L5.41,6ZM20,17a1,1,0,0,1-1,1H5a1,1,0,0,1-1-1V7.41l5.88,5.88a3,3,0,0,0,4.24,0L20,7.41Z"/>',
|
|
94
98
|
};
|
|
@@ -3,10 +3,7 @@ import config from 'virtual:starlight/user-config';
|
|
|
3
3
|
import { localizedUrl } from '../utils/localizedUrl';
|
|
4
4
|
import { useTranslations } from '../utils/translations';
|
|
5
5
|
import Select from './Select.astro';
|
|
6
|
-
|
|
7
|
-
interface Props {
|
|
8
|
-
locale: string | undefined;
|
|
9
|
-
}
|
|
6
|
+
import type { Props } from '../props';
|
|
10
7
|
|
|
11
8
|
/**
|
|
12
9
|
* Get the equivalent of the current page path for the passed locale.
|
|
@@ -1,36 +1,17 @@
|
|
|
1
1
|
---
|
|
2
|
-
import type {
|
|
3
|
-
import { fileURLToPath } from 'node:url';
|
|
4
|
-
import project from 'virtual:starlight/project-context';
|
|
5
|
-
import { getFileCommitDate } from '../utils/git';
|
|
2
|
+
import type { Props } from '../props';
|
|
6
3
|
import { useTranslations } from '../utils/translations';
|
|
7
4
|
|
|
8
|
-
|
|
9
|
-
id: CollectionEntry<'docs'>['id'];
|
|
10
|
-
lang: string;
|
|
11
|
-
lastUpdated: Date | undefined;
|
|
12
|
-
locale: string | undefined;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const { id, lang, lastUpdated, locale } = Astro.props;
|
|
5
|
+
const { lang, lastUpdated, locale } = Astro.props;
|
|
16
6
|
const t = useTranslations(locale);
|
|
17
|
-
|
|
18
|
-
const currentFilePath = fileURLToPath(new URL('src/content/docs/' + id, project.root));
|
|
19
|
-
|
|
20
|
-
let date = lastUpdated;
|
|
21
|
-
try {
|
|
22
|
-
if (!date) {
|
|
23
|
-
({ date } = getFileCommitDate(currentFilePath, 'newest'));
|
|
24
|
-
}
|
|
25
|
-
} catch {}
|
|
26
7
|
---
|
|
27
8
|
|
|
28
9
|
{
|
|
29
|
-
|
|
10
|
+
lastUpdated && (
|
|
30
11
|
<p>
|
|
31
12
|
{t('page.lastUpdated')}{' '}
|
|
32
|
-
<time datetime={
|
|
33
|
-
{
|
|
13
|
+
<time datetime={lastUpdated.toISOString()}>
|
|
14
|
+
{lastUpdated.toLocaleDateString(lang, { dateStyle: 'medium' })}
|
|
34
15
|
</time>
|
|
35
16
|
</p>
|
|
36
17
|
)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { LanguageSelect, ThemeSelect } from 'virtual:starlight/components';
|
|
3
|
+
import type { Props } from '../props';
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<div class="mobile-preferences sl-flex">
|
|
7
|
+
<ThemeSelect {...Astro.props} />
|
|
8
|
+
<LanguageSelect {...Astro.props} />
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
<style>
|
|
12
|
+
.mobile-preferences {
|
|
13
|
+
justify-content: space-between;
|
|
14
|
+
border-top: 1px solid var(--sl-color-gray-6);
|
|
15
|
+
padding: 0.5rem 0;
|
|
16
|
+
}
|
|
17
|
+
</style>
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
---
|
|
2
|
-
import
|
|
2
|
+
import type { Props } from '../props';
|
|
3
3
|
import { useTranslations } from '../utils/translations';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
locale: string | undefined;
|
|
7
|
-
}
|
|
5
|
+
import Icon from '../user-components/Icon.astro';
|
|
8
6
|
|
|
9
7
|
const t = useTranslations(Astro.props.locale);
|
|
10
8
|
---
|
package/components/{TableOfContents/MobileTableOfContents.astro → MobileTableOfContents.astro}
RENAMED
|
@@ -1,36 +1,33 @@
|
|
|
1
1
|
---
|
|
2
|
-
import { useTranslations } from '
|
|
3
|
-
import Icon from '
|
|
4
|
-
import TableOfContentsList from './TableOfContentsList.astro';
|
|
5
|
-
import type {
|
|
2
|
+
import { useTranslations } from '../utils/translations';
|
|
3
|
+
import Icon from '../user-components/Icon.astro';
|
|
4
|
+
import TableOfContentsList from './TableOfContents/TableOfContentsList.astro';
|
|
5
|
+
import type { Props } from '../props';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
toc: TocItem[];
|
|
9
|
-
locale: string | undefined;
|
|
10
|
-
maxHeadingLevel: number;
|
|
11
|
-
minHeadingLevel: number;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const { locale, toc, maxHeadingLevel, minHeadingLevel } = Astro.props;
|
|
7
|
+
const { locale, toc } = Astro.props;
|
|
15
8
|
const t = useTranslations(locale);
|
|
16
9
|
---
|
|
17
10
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
<
|
|
21
|
-
<
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
</
|
|
11
|
+
{
|
|
12
|
+
toc && (
|
|
13
|
+
<mobile-starlight-toc data-min-h={toc.minHeadingLevel} data-max-h={toc.maxHeadingLevel}>
|
|
14
|
+
<nav aria-labelledby="starlight__on-this-page--mobile">
|
|
15
|
+
<details id="starlight__mobile-toc">
|
|
16
|
+
<summary id="starlight__on-this-page--mobile" class="sl-flex">
|
|
17
|
+
<div class="toggle sl-flex">
|
|
18
|
+
{t('tableOfContents.onThisPage')}
|
|
19
|
+
<Icon name={'right-caret'} class="caret" size="1rem" />
|
|
20
|
+
</div>
|
|
21
|
+
<span class="display-current" />
|
|
22
|
+
</summary>
|
|
23
|
+
<div class="dropdown">
|
|
24
|
+
<TableOfContentsList toc={toc.items} isMobile />
|
|
25
|
+
</div>
|
|
26
|
+
</details>
|
|
27
|
+
</nav>
|
|
28
|
+
</mobile-starlight-toc>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
34
31
|
|
|
35
32
|
<style>
|
|
36
33
|
nav {
|
|
@@ -112,7 +109,7 @@ const t = useTranslations(locale);
|
|
|
112
109
|
</style>
|
|
113
110
|
|
|
114
111
|
<script>
|
|
115
|
-
import { StarlightTOC } from './starlight-toc';
|
|
112
|
+
import { StarlightTOC } from './TableOfContents/starlight-toc';
|
|
116
113
|
|
|
117
114
|
class MobileStarlightTOC extends StarlightTOC {
|
|
118
115
|
override set current(link: HTMLAnchorElement) {
|