@astrojs/starlight 0.10.3 → 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.
Files changed (58) hide show
  1. package/404.astro +9 -4
  2. package/CHANGELOG.md +73 -0
  3. package/components/Badge.astro +1 -0
  4. package/components/Banner.astro +4 -4
  5. package/components/ContentPanel.astro +4 -0
  6. package/components/EditLink.astro +5 -24
  7. package/components/FallbackContentNotice.astro +2 -5
  8. package/components/Footer.astro +5 -32
  9. package/components/{HeadSEO.astro → Head.astro} +10 -14
  10. package/components/Header.astro +26 -16
  11. package/components/Hero.astro +6 -9
  12. package/components/Icons.ts +9 -0
  13. package/components/LanguageSelect.astro +1 -4
  14. package/components/LastUpdated.astro +5 -24
  15. package/components/MarkdownContent.astro +4 -0
  16. package/components/MobileMenuFooter.astro +17 -0
  17. package/components/MobileMenuToggle.astro +2 -4
  18. package/components/{TableOfContents/MobileTableOfContents.astro → MobileTableOfContents.astro} +26 -29
  19. package/components/Page.astro +120 -0
  20. package/{layout → components}/PageFrame.astro +16 -8
  21. package/components/{RightSidebarPanel.astro → PageSidebar.astro} +21 -9
  22. package/components/PageTitle.astro +16 -0
  23. package/components/{PrevNextLinks.astro → Pagination.astro} +3 -9
  24. package/components/Search.astro +5 -5
  25. package/components/Sidebar.astro +7 -36
  26. package/components/SidebarSublist.astro +8 -2
  27. package/components/SiteTitle.astro +1 -20
  28. package/components/SkipLink.astro +3 -5
  29. package/components/SocialIcons.astro +5 -31
  30. package/components/TableOfContents/TableOfContentsList.astro +1 -1
  31. package/components/TableOfContents/starlight-toc.ts +3 -1
  32. package/components/TableOfContents.astro +12 -15
  33. package/components/ThemeProvider.astro +1 -0
  34. package/components/ThemeSelect.astro +1 -4
  35. package/{layout → components}/TwoColumnContent.astro +2 -4
  36. package/constants.ts +4 -0
  37. package/index.astro +4 -2
  38. package/index.ts +10 -15
  39. package/integrations/virtual-user-config.ts +3 -0
  40. package/package.json +133 -4
  41. package/props.ts +1 -0
  42. package/schema.ts +3 -0
  43. package/schemas/components.ts +256 -0
  44. package/schemas/sidebar.ts +89 -0
  45. package/schemas/social.ts +65 -0
  46. package/style/reset.css +1 -1
  47. package/translations/ar.json +8 -8
  48. package/translations/index.ts +2 -0
  49. package/translations/vi.json +22 -0
  50. package/{components/TableOfContents → utils}/generateToC.ts +2 -1
  51. package/utils/navigation.ts +22 -5
  52. package/utils/route-data.ts +97 -0
  53. package/utils/routing.ts +10 -0
  54. package/utils/user-config.ts +15 -99
  55. package/utils/validateLogoImports.ts +21 -0
  56. package/virtual.d.ts +37 -0
  57. package/components/RightSidebar.astro +0 -36
  58. 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 './layout/Page.astro';
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 {headings} entry={entry} id={entry.id} slug={entry.slug} {...entryMeta} {entryMeta}>
41
- <Content />
42
- </Page>
47
+ <Page {...route}><Content /></Page>
package/CHANGELOG.md CHANGED
@@ -1,5 +1,78 @@
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
+
62
+ ## 0.10.4
63
+
64
+ ### Patch Changes
65
+
66
+ - [#752](https://github.com/withastro/starlight/pull/752) [`6833ee1`](https://github.com/withastro/starlight/commit/6833ee12159ea5be23885c41da80569a89aafa33) Thanks [@apinet](https://github.com/apinet)! - Add X social link logo
67
+
68
+ - [#789](https://github.com/withastro/starlight/pull/789) [`2528fb0`](https://github.com/withastro/starlight/commit/2528fb011a388f3920af9994012bd7db2b1654c3) Thanks [@delucis](https://github.com/delucis)! - Update bundled version of `@astrojs/mdx` to v1.1.0
69
+
70
+ - [#794](https://github.com/withastro/starlight/pull/794) [`a0de12d`](https://github.com/withastro/starlight/commit/a0de12d596ab2b1c0d79d6d63d2d6cb9fe6d2644) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Add Telegram icon
71
+
72
+ - [#792](https://github.com/withastro/starlight/pull/792) [`a8358df`](https://github.com/withastro/starlight/commit/a8358df7849b342de342a4a2e88e019c39d5bbe8) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Add RSS icon
73
+
74
+ - [#778](https://github.com/withastro/starlight/pull/778) [`957d2c3`](https://github.com/withastro/starlight/commit/957d2c32123ab0c223fcef03f91ce3ad7be7aa21) Thanks [@jermanuts](https://github.com/jermanuts)! - Improve Arabic UI translations
75
+
3
76
  ## 0.10.3
4
77
 
5
78
  ### Patch Changes
@@ -22,6 +22,7 @@ const { variant = 'default', text } = Astro.props;
22
22
  line-height: 1;
23
23
  color: #fff;
24
24
  background-color: var(--sl-color-bg-badge);
25
+ overflow-wrap: anywhere;
25
26
  }
26
27
 
27
28
  .outline {
@@ -1,10 +1,10 @@
1
1
  ---
2
- interface Props {
3
- content: string;
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={Astro.props.content} />
7
+ {banner && <div class="sl-banner" set:html={banner.content} />}
8
8
 
9
9
  <style>
10
10
  .sl-banner {
@@ -1,3 +1,7 @@
1
+ ---
2
+ import type { Props } from '../props';
3
+ ---
4
+
1
5
  <div class="content-panel">
2
6
  <div class="sl-container"><slot /></div>
3
7
  </div>
@@ -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
- interface Props {
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.data;
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 !== false && url && (
31
- <a href={url} class="sl-flex">
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
- interface Props {
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
  ---
@@ -1,42 +1,15 @@
1
1
  ---
2
- import config from 'virtual:starlight/user-config';
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 '../components/LastUpdated.astro';
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
- {config.editLink.baseUrl && <EditLink data={entry.data} id={entry.id} {locale} />}
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
- <PrevNextLinks {...prevNextLinks} {dir} {locale} />
12
+ <Pagination {...Astro.props} />
40
13
  </footer>
41
14
 
42
15
  <style>
@@ -1,21 +1,17 @@
1
1
  ---
2
- import type { CollectionEntry, z } from 'astro:content';
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 { fileWithBase } from '../utils/base';
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 { data, lang } = Astro.props;
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
  }
@@ -1,24 +1,28 @@
1
1
  ---
2
- import LanguageSelect from './LanguageSelect.astro';
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
- interface Props {
9
- locale: string | undefined;
10
- }
11
-
12
- const { locale } = Astro.props;
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
- <SiteTitle {locale} />
17
- <Search {locale} />
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
- <SocialIcons />
20
- <ThemeSelect {locale} />
21
- <LanguageSelect {locale} />
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]) {
@@ -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
- interface Props {
7
- fallbackTitle: string;
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="_top" data-page-title set:html={title} />
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
  {
@@ -68,6 +68,8 @@ export const Icons = {
68
68
  '<path d="M6.11 15.12H3.75V0h2.36v15.12zm4.71-11.55H8.46V24h2.36V3.57zm4.72 0h-2.36V24h2.36V3.57zm4.71 0h-2.36v11.57h2.36V3.56z"/>',
69
69
  twitter:
70
70
  '<path d="M24 4.4a10 10 0 0 1-2.83.78 5.05 5.05 0 0 0 2.17-2.79 9.7 9.7 0 0 1-3.13 1.23 4.89 4.89 0 0 0-5.94-1.03 5 5 0 0 0-2.17 2.38 5.15 5.15 0 0 0-.3 3.25c-1.95-.1-3.86-.63-5.61-1.53a14.04 14.04 0 0 1-4.52-3.74 5.2 5.2 0 0 0-.09 4.91c.39.74.94 1.35 1.61 1.82a4.77 4.77 0 0 1-2.23-.63v.06c0 1.16.4 2.29 1.12 3.18a4.9 4.9 0 0 0 2.84 1.74c-.73.22-1.5.26-2.24.12a4.89 4.89 0 0 0 4.59 3.49A9.78 9.78 0 0 1 0 19.73 13.65 13.65 0 0 0 7.55 22a13.63 13.63 0 0 0 9.96-4.16A14.26 14.26 0 0 0 21.6 7.65V7c.94-.72 1.75-1.6 2.4-2.6Z"/>',
71
+ 'x.com':
72
+ '<path d="M 18.242188 2.25 L 21.554688 2.25 L 14.324219 10.507812 L 22.828125 21.75 L 16.171875 21.75 L 10.953125 14.933594 L 4.992188 21.75 L 1.679688 21.75 L 9.40625 12.914062 L 1.257812 2.25 L 8.082031 2.25 L 12.792969 8.480469 Z M 17.082031 19.773438 L 18.914062 19.773438 L 7.082031 4.125 L 5.113281 4.125 Z M 17.082031 19.773438 "/>',
71
73
  mastodon:
72
74
  '<path d="M16.45 17.77c2.77-.33 5.18-2.03 5.49-3.58.47-2.45.44-5.97.44-5.97 0-4.77-3.15-6.17-3.15-6.17-1.58-.72-4.3-1.03-7.13-1.05h-.07c-2.83.02-5.55.33-7.13 1.05 0 0-3.14 1.4-3.14 6.17v.91c-.01.88-.02 1.86 0 2.88.12 4.67.87 9.27 5.2 10.4 2 .53 3.72.64 5.1.57 2.51-.14 3.92-.9 3.92-.9l-.08-1.8s-1.8.56-3.8.5c-2-.08-4.1-.22-4.43-2.66a4.97 4.97 0 0 1-.04-.68s1.96.48 4.44.59c1.51.07 2.94-.09 4.38-.26Zm2.22-3.4h-2.3v-5.6c0-1.19-.5-1.79-1.5-1.79-1.1 0-1.66.71-1.66 2.12v3.07h-2.3V9.1c0-1.4-.55-2.12-1.65-2.12-1 0-1.5.6-1.5 1.78v5.61h-2.3V8.6c0-1.18.3-2.12.9-2.81a3.17 3.17 0 0 1 2.47-1.05c1.18 0 2.07.45 2.66 1.35l.57.96.58-.96a2.97 2.97 0 0 1 2.66-1.35c1.01 0 1.83.36 2.46 1.05.6.7.9 1.63.9 2.81v5.78Z"/>',
73
75
  codeberg:
@@ -86,4 +88,11 @@ export const Icons = {
86
88
  '<path d="M17.3 5.5a1.2 1.2 0 1 0 1.2 1.2 1.2 1.2 0 0 0-1.2-1.2ZM22 7.9a7.6 7.6 0 0 0-.4-2.5 5 5 0 0 0-1.2-1.7 4.7 4.7 0 0 0-1.8-1.2 7.3 7.3 0 0 0-2.4-.4L12 2H7.9a7.3 7.3 0 0 0-2.5.5 4.8 4.8 0 0 0-1.7 1.2 4.7 4.7 0 0 0-1.2 1.8 7.3 7.3 0 0 0-.4 2.4L2 12v4.1a7.3 7.3 0 0 0 .5 2.4 4.7 4.7 0 0 0 1.2 1.8 4.8 4.8 0 0 0 1.8 1.2 7.3 7.3 0 0 0 2.4.4l4.1.1h4.1a7.3 7.3 0 0 0 2.4-.5 4.7 4.7 0 0 0 1.8-1.2 4.8 4.8 0 0 0 1.2-1.7 7.6 7.6 0 0 0 .4-2.5L22 12V7.9ZM20.1 16a5.6 5.6 0 0 1-.3 1.9A3 3 0 0 1 19 19a3.2 3.2 0 0 1-1.1.8 5.6 5.6 0 0 1-1.9.3H8a5.7 5.7 0 0 1-1.9-.3A3.3 3.3 0 0 1 5 19a3 3 0 0 1-.7-1.1 5.5 5.5 0 0 1-.4-1.9l-.1-4V8a5.5 5.5 0 0 1 .4-1.9A3 3 0 0 1 5 5a3.1 3.1 0 0 1 1.1-.8A5.7 5.7 0 0 1 8 3.9l4-.1h4a5.6 5.6 0 0 1 1.9.4A3 3 0 0 1 19 5a3 3 0 0 1 .7 1.1A5.6 5.6 0 0 1 20 8l.1 4v4ZM12 6.9a5.1 5.1 0 1 0 5.1 5.1A5.1 5.1 0 0 0 12 6.9Zm0 8.4a3.3 3.3 0 1 1 3.3-3.3 3.3 3.3 0 0 1-3.3 3.3Z"/>',
87
89
  stackOverflow:
88
90
  '<path d="M15.72 0 14 1.28l6.4 8.58 1.7-1.26L15.73 0zm-3.94 3.42-1.36 1.64 8.22 6.85 1.37-1.64-8.23-6.85zM8.64 7.88l-.91 1.94 9.7 4.52.9-1.94-9.7-4.52zm-1.86 4.86-.44 2.1 10.48 2.2.44-2.1-10.47-2.2zM1.9 15.47V24h19.19v-8.53h-2.13v6.4H4.02v-6.4H1.9zm4.26 2.13v2.13h10.66V17.6H6.15Z"/>',
91
+ telegram:
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
+ 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"/>',
89
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 { CollectionEntry } from 'astro:content';
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
- interface Props {
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
- date && (
10
+ lastUpdated && (
30
11
  <p>
31
12
  {t('page.lastUpdated')}{' '}
32
- <time datetime={date.toISOString()}>
33
- {date.toLocaleDateString(lang, { dateStyle: 'medium' })}
13
+ <time datetime={lastUpdated.toISOString()}>
14
+ {lastUpdated.toLocaleDateString(lang, { dateStyle: 'medium' })}
34
15
  </time>
35
16
  </p>
36
17
  )
@@ -1,3 +1,7 @@
1
+ ---
2
+ import type { Props } from '../props';
3
+ ---
4
+
1
5
  <div class="content"><slot /></div>
2
6
 
3
7
  <style>
@@ -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 Icon from '../user-components/Icon.astro';
2
+ import type { Props } from '../props';
3
3
  import { useTranslations } from '../utils/translations';
4
4
 
5
- interface Props {
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
  ---
@@ -1,36 +1,33 @@
1
1
  ---
2
- import { useTranslations } from '../../utils/translations';
3
- import Icon from '../../user-components/Icon.astro';
4
- import TableOfContentsList from './TableOfContentsList.astro';
5
- import type { TocItem } from './generateToC';
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
- interface Props {
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
- <mobile-starlight-toc data-min-h={minHeadingLevel} data-max-h={maxHeadingLevel}>
19
- <nav aria-labelledby="starlight__on-this-page--mobile" class="lg:sl-hidden">
20
- <details id="starlight__mobile-toc">
21
- <summary id="starlight__on-this-page--mobile" class="sl-flex">
22
- <div class="toggle sl-flex">
23
- {t('tableOfContents.onThisPage')}
24
- <Icon name={'right-caret'} class="caret" size="1rem" />
25
- </div>
26
- <span class="display-current">{toc[0]?.text}</span>
27
- </summary>
28
- <div class="dropdown">
29
- <TableOfContentsList toc={toc} isMobile />
30
- </div>
31
- </details>
32
- </nav>
33
- </mobile-starlight-toc>
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) {