@astrojs/starlight 0.0.1 → 0.0.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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @astrojs/starlight
2
2
 
3
+ ## 0.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`1f62c75`](https://github.com/withastro/starlight/commit/1f62c75297ed44da721350840744823876a64bc5) Thanks [@delucis](https://github.com/delucis)! - Add repo, issues & homepage links to package.json
8
+
9
+ - [#36](https://github.com/withastro/starlight/pull/36) [`62265e4`](https://github.com/withastro/starlight/commit/62265e4a653d161483e3844b568ab150334e9238) Thanks [@delucis](https://github.com/delucis)! - Collapse table of contents in dropdown on narrower viewports
10
+
11
+ ## 0.0.2
12
+
13
+ ### Patch Changes
14
+
15
+ - [#35](https://github.com/withastro/starlight/pull/35) [`ea999c4`](https://github.com/withastro/starlight/commit/ea999c4afa0e72da5a5510d30a7bc13380e10a4a) Thanks [@delucis](https://github.com/delucis)! - Add support for social media links in the site header.
16
+
17
+ - [#33](https://github.com/withastro/starlight/pull/33) [`833393a`](https://github.com/withastro/starlight/commit/833393a1cd8fc83a3b9c6055cfb8d160ab40a40c) Thanks [@MoustaphaDev](https://github.com/MoustaphaDev)! - Import zod from `astro/zod` to fix an issue related to importing the `astro:content` virtual module
18
+
3
19
  ## 0.0.1
4
20
 
5
21
  ### Patch Changes
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Starlight
1
+ # <img src="https://github.com/withastro/starlight/assets/357379/494fcd83-42aa-4891-87e0-87402fa0b6f3" alt="" align="left" width="40" height="40"> Starlight
2
2
 
3
3
  > **Warning**
4
4
  > This tool is an early release and very much still work in progress!
@@ -3,6 +3,7 @@ import config from 'virtual:starlight/user-config';
3
3
  import LanguageSelect from './LanguageSelect.astro';
4
4
  import Search from './Search.astro';
5
5
  import ThemeSelect from './ThemeSelect.astro';
6
+ import SocialIcons from './SocialIcons.astro';
6
7
 
7
8
  interface Props {
8
9
  locale: string | undefined;
@@ -13,6 +14,7 @@ interface Props {
13
14
  <a href={import.meta.env.BASE_URL} class="site-title">{config.title}</a>
14
15
  <Search />
15
16
  <div class="hidden md:flex right-group">
17
+ <SocialIcons />
16
18
  <ThemeSelect />
17
19
  <LanguageSelect locale={Astro.props.locale} />
18
20
  </div>
@@ -28,7 +30,7 @@ interface Props {
28
30
  }
29
31
 
30
32
  .site-title {
31
- font-size: var(--sl-text-2xl);
33
+ font-size: var(--sl-text-h4);
32
34
  font-weight: 600;
33
35
  color: var(--sl-color-text-accent);
34
36
  text-decoration: none;
@@ -37,6 +39,7 @@ interface Props {
37
39
 
38
40
  .right-group {
39
41
  gap: 1rem;
42
+ align-items: center;
40
43
  }
41
44
 
42
45
  @media (min-width: 50rem) {
@@ -39,5 +39,11 @@ export const Icons = {
39
39
  'list-format':
40
40
  '<path d="M3.71 16.29C3.6149 16.199 3.50276 16.1276 3.38 16.08C3.13654 15.98 2.86346 15.98 2.62 16.08C2.49725 16.1276 2.38511 16.199 2.29 16.29C2.19896 16.3851 2.1276 16.4972 2.08 16.62C2.00342 16.8021 1.9825 17.0028 2.01988 17.1968C2.05725 17.3908 2.15125 17.5694 2.29 17.71C2.3872 17.7983 2.49882 17.8694 2.62 17.92C2.7397 17.9729 2.86913 18.0002 3 18.0002C3.13087 18.0002 3.2603 17.9729 3.38 17.92C3.50119 17.8694 3.6128 17.7983 3.71 17.71C3.84876 17.5694 3.94276 17.3908 3.98013 17.1968C4.01751 17.0028 3.99658 16.8021 3.92 16.62C3.87241 16.4972 3.80104 16.3851 3.71 16.29ZM7 8H21C21.2652 8 21.5196 7.89464 21.7071 7.70711C21.8946 7.51957 22 7.26522 22 7C22 6.73478 21.8946 6.48043 21.7071 6.29289C21.5196 6.10536 21.2652 6 21 6H7C6.73479 6 6.48043 6.10536 6.2929 6.29289C6.10536 6.48043 6 6.73478 6 7C6 7.26522 6.10536 7.51957 6.2929 7.70711C6.48043 7.89464 6.73479 8 7 8ZM3.71 11.29C3.56938 11.1512 3.39081 11.0572 3.19682 11.0199C3.00283 10.9825 2.80211 11.0034 2.62 11.08C2.49882 11.1306 2.3872 11.2017 2.29 11.29C2.19896 11.3851 2.1276 11.4972 2.08 11.62C2.0271 11.7397 1.99977 11.8691 1.99977 12C1.99977 12.1309 2.0271 12.2603 2.08 12.38C2.13065 12.5012 2.20167 12.6128 2.29 12.71C2.3872 12.7983 2.49882 12.8694 2.62 12.92C2.7397 12.9729 2.86913 13.0002 3 13.0002C3.13087 13.0002 3.2603 12.9729 3.38 12.92C3.50119 12.8694 3.6128 12.7983 3.71 12.71C3.79833 12.6128 3.86936 12.5012 3.92 12.38C3.97291 12.2603 4.00024 12.1309 4.00024 12C4.00024 11.8691 3.97291 11.7397 3.92 11.62C3.87241 11.4972 3.80104 11.3851 3.71 11.29ZM21 11H7C6.73479 11 6.48043 11.1054 6.2929 11.2929C6.10536 11.4804 6 11.7348 6 12C6 12.2652 6.10536 12.5196 6.2929 12.7071C6.48043 12.8946 6.73479 13 7 13H21C21.2652 13 21.5196 12.8946 21.7071 12.7071C21.8946 12.5196 22 12.2652 22 12C22 11.7348 21.8946 11.4804 21.7071 11.2929C21.5196 11.1054 21.2652 11 21 11ZM3.71 6.29C3.6149 6.19896 3.50276 6.12759 3.38 6.08C3.19789 6.00342 2.99718 5.9825 2.80319 6.01987C2.6092 6.05725 2.43063 6.15124 2.29 6.29C2.20167 6.3872 2.13065 6.49882 2.08 6.62C2.0271 6.7397 1.99977 6.86913 1.99977 7C1.99977 7.13087 2.0271 7.2603 2.08 7.38C2.13065 7.50119 2.20167 7.6128 2.29 7.71C2.3872 7.79833 2.49882 7.86936 2.62 7.92C2.80211 7.99658 3.00283 8.0175 3.19682 7.98013C3.39081 7.94275 3.56938 7.84876 3.71 7.71C3.79833 7.6128 3.86936 7.50119 3.92 7.38C3.97291 7.2603 4.00024 7.13087 4.00024 7C4.00024 6.86913 3.97291 6.7397 3.92 6.62C3.86936 6.49882 3.79833 6.3872 3.71 6.29ZM21 16H7C6.73479 16 6.48043 16.1054 6.2929 16.2929C6.10536 16.4804 6 16.7348 6 17C6 17.2652 6.10536 17.5196 6.2929 17.7071C6.48043 17.8946 6.73479 18 7 18H21C21.2652 18 21.5196 17.8946 21.7071 17.7071C21.8946 17.5196 22 17.2652 22 17C22 16.7348 21.8946 16.4804 21.7071 16.2929C21.5196 16.1054 21.2652 16 21 16Z"></path>',
41
41
  github:
42
- '<path d="M12 2.2467C9.6255 2.2468 7.32849 3.09182 5.51999 4.63055C3.71149 6.16929 2.50953 8.30133 2.12916 10.6452C1.74879 12.989 2.21485 15.3918 3.44393 17.4235C4.67301 19.4551 6.58491 20.9832 8.83755 21.7342C9.33755 21.8217 9.52505 21.5217 9.52505 21.2592C9.52505 21.0217 9.51254 20.2342 9.51254 19.3967C7.00003 19.8592 6.35003 18.7842 6.15003 18.2217C5.9281 17.6747 5.5763 17.1899 5.12503 16.8092C4.77503 16.6217 4.27503 16.1592 5.11252 16.1467C5.4323 16.1814 5.73901 16.2927 6.00666 16.4711C6.2743 16.6495 6.49499 16.8899 6.65003 17.1717C6.7868 17.4174 6.97071 17.6337 7.19122 17.8082C7.41173 17.9827 7.6645 18.112 7.93506 18.1886C8.20562 18.2652 8.48864 18.2877 8.76791 18.2548C9.04717 18.2219 9.3172 18.1342 9.56251 17.9967C9.6058 17.4883 9.83237 17.013 10.2 16.6592C7.97503 16.4092 5.65003 15.5467 5.65003 11.7217C5.63597 10.7279 6.00271 9.76631 6.67503 9.03423C6.36931 8.17045 6.40508 7.22252 6.77503 6.38423C6.77503 6.38423 7.6125 6.12172 9.52503 7.40923C11.1613 6.95921 12.8887 6.95921 14.525 7.40923C16.4375 6.10923 17.275 6.38423 17.275 6.38423C17.645 7.22251 17.6808 8.17046 17.375 9.03423C18.0494 9.76506 18.4164 10.7275 18.4 11.7217C18.4 15.5592 16.0625 16.4092 13.8375 16.6592C14.0762 16.9011 14.26 17.1915 14.3764 17.5107C14.4929 17.83 14.5393 18.1705 14.5125 18.5092C14.5125 19.8468 14.5 20.9217 14.5 21.2592C14.5 21.5217 14.6875 21.8342 15.1875 21.7342C17.4362 20.9771 19.3426 19.4455 20.5664 17.4128C21.7903 15.38 22.2519 12.9785 21.8689 10.6369C21.4859 8.29535 20.2832 6.16608 18.4755 4.62922C16.6678 3.09235 14.3727 2.24794 12 2.2467Z"></path>',
42
+ '<path d="M12 .3a12 12 0 0 0-3.8 23.38c.6.12.83-.26.83-.57L9 21.07c-3.34.72-4.04-1.61-4.04-1.61-.55-1.39-1.34-1.76-1.34-1.76-1.08-.74.09-.73.09-.73 1.2.09 1.83 1.24 1.83 1.24 1.08 1.83 2.81 1.3 3.5 1 .1-.78.42-1.31.76-1.61-2.67-.3-5.47-1.33-5.47-5.93 0-1.31.47-2.38 1.24-3.22-.14-.3-.54-1.52.1-3.18 0 0 1-.32 3.3 1.23a11.5 11.5 0 0 1 6 0c2.28-1.55 3.29-1.23 3.29-1.23.64 1.66.24 2.88.12 3.18a4.65 4.65 0 0 1 1.23 3.22c0 4.61-2.8 5.63-5.48 5.92.42.36.81 1.1.81 2.22l-.01 3.29c0 .31.2.69.82.57A12 12 0 0 0 12 .3Z"/>',
43
+ discord:
44
+ '<path d="M20.32 4.37a19.8 19.8 0 0 0-4.93-1.51 13.78 13.78 0 0 0-.64 1.28 18.27 18.27 0 0 0-5.5 0 12.64 12.64 0 0 0-.64-1.28h-.05A19.74 19.74 0 0 0 3.64 4.4 20.26 20.26 0 0 0 .11 18.09l.02.02a19.9 19.9 0 0 0 6.04 3.03l.04-.02a14.24 14.24 0 0 0 1.23-2.03.08.08 0 0 0-.05-.07 13.1 13.1 0 0 1-1.9-.92.08.08 0 0 1 .02-.1 10.2 10.2 0 0 0 .41-.31h.04a14.2 14.2 0 0 0 12.1 0l.04.01a9.63 9.63 0 0 0 .4.32.08.08 0 0 1-.03.1 12.29 12.29 0 0 1-1.9.91.08.08 0 0 0-.02.1 15.97 15.97 0 0 0 1.27 2.01h.04a19.84 19.84 0 0 0 6.03-3.05v-.03a20.12 20.12 0 0 0-3.57-13.69ZM8.02 15.33c-1.18 0-2.16-1.08-2.16-2.42 0-1.33.96-2.42 2.16-2.42 1.21 0 2.18 1.1 2.16 2.42 0 1.34-.96 2.42-2.16 2.42Zm7.97 0c-1.18 0-2.15-1.08-2.15-2.42 0-1.33.95-2.42 2.15-2.42 1.22 0 2.18 1.1 2.16 2.42 0 1.34-.94 2.42-2.16 2.42Z"/>',
45
+ twitter:
46
+ '<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"/>',
47
+ mastodon:
48
+ '<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"/>',
43
49
  };
@@ -0,0 +1,29 @@
1
+ ---
2
+ import type { MarkdownHeading } from 'astro';
3
+ import type { CollectionEntry } from 'astro:content';
4
+ import config from 'virtual:starlight/user-config';
5
+ import EditLink from './EditLink.astro';
6
+ import RightSidebarPanel from './RightSidebarPanel.astro';
7
+ import TableOfContents from './TableOfContents.astro';
8
+
9
+ interface Props {
10
+ entry: CollectionEntry<'docs'>;
11
+ headings: MarkdownHeading[];
12
+ }
13
+
14
+ const { entry, headings } = Astro.props;
15
+ ---
16
+
17
+ <RightSidebarPanel>
18
+ <TableOfContents headings={headings} />
19
+ </RightSidebarPanel>
20
+ <RightSidebarPanel>
21
+ {
22
+ config.editLink.baseUrl && (
23
+ <>
24
+ <h2>Contribute</h2>
25
+ <EditLink data={entry.data} id={entry.id} />
26
+ </>
27
+ )
28
+ }
29
+ </RightSidebarPanel>
@@ -0,0 +1,44 @@
1
+ ---
2
+ import config from 'virtual:starlight/user-config';
3
+ import Icon from './Icon.astro';
4
+
5
+ type Platform = keyof NonNullable<typeof config.social>;
6
+
7
+ const labels: Record<Platform, string> = {
8
+ github: 'GitHub',
9
+ discord: 'Discord',
10
+ twitter: 'Twitter',
11
+ mastodon: 'Mastodon',
12
+ };
13
+
14
+ const links = Object.entries(config.social || {}).filter(([, url]) =>
15
+ Boolean(url)
16
+ ) as [platform: Platform, url: string][];
17
+ ---
18
+
19
+ {
20
+ links.length > 0 && (
21
+ <>
22
+ {links.map(([platform, url]) => (
23
+ <a href={url} rel="me">
24
+ <span class="sr-only">{labels[platform]}</span>
25
+ <Icon name={platform} />
26
+ </a>
27
+ ))}
28
+ <div class="divider" />
29
+ </>
30
+ )
31
+ }
32
+
33
+ <style>
34
+ a {
35
+ color: var(--sl-color-text-accent);
36
+ }
37
+ a:hover {
38
+ opacity: 0.66;
39
+ }
40
+ .divider {
41
+ height: 2rem;
42
+ border-inline-end: 1px solid var(--sl-color-gray-5);
43
+ }
44
+ </style>
@@ -0,0 +1,125 @@
1
+ ---
2
+ import type { MarkdownHeading } from 'astro';
3
+ import config from 'virtual:starlight/user-config';
4
+ import { generateToC } from './generateToC';
5
+ import TableOfContentsList from './TableOfContentsList.astro';
6
+ import Icon from '../Icon.astro';
7
+
8
+ interface Props {
9
+ headings: MarkdownHeading[];
10
+ }
11
+
12
+ const toc = generateToC(Astro.props.headings, config.tableOfContents);
13
+ ---
14
+
15
+ <nav aria-labelledby="starlight__on-this-page--mobile" class="lg:hidden">
16
+ <details id="starlight__mobile-toc">
17
+ <summary id="starlight__on-this-page--mobile" class="flex">
18
+ <div class="toggle flex">
19
+ On this page
20
+ <Icon name={'right-caret'} class="caret" size="1rem" />
21
+ </div>
22
+ </summary>
23
+ <div class="dropdown">
24
+ <TableOfContentsList toc={toc} isMobile />
25
+ </div>
26
+ </details>
27
+ </nav>
28
+
29
+ <style>
30
+ nav {
31
+ position: fixed;
32
+ top: calc(var(--sl-nav-height) - 1px);
33
+ inset-inline: 0;
34
+ border-top: 1px solid var(--sl-color-gray-5);
35
+ background-color: var(--sl-color-bg-nav);
36
+ }
37
+ @media (min-width: 50rem) {
38
+ nav {
39
+ inset-inline-start: var(--sl-sidebar-width);
40
+ }
41
+ }
42
+
43
+ summary {
44
+ height: var(--sl-mobile-toc-height);
45
+ border-bottom: 1px solid var(--sl-color-hairline-shade);
46
+ padding: 0.5rem 1rem;
47
+ outline-offset: var(--sl-outline-offset-inside);
48
+ }
49
+ summary::marker,
50
+ summary::-webkit-details-marker {
51
+ display: none;
52
+ }
53
+
54
+ .toggle {
55
+ gap: 1rem;
56
+ align-items: center;
57
+ justify-content: space-between;
58
+ border: 1px solid var(--sl-color-gray-5);
59
+ border-radius: 0.5rem;
60
+ padding-block: 0.5rem;
61
+ padding-inline-start: 0.75rem;
62
+ padding-inline-end: 0.5rem;
63
+ font-size: var(--sl-text-xs);
64
+ line-height: 1;
65
+ background-color: var(--sl-color-black);
66
+ user-select: none;
67
+ cursor: pointer;
68
+ }
69
+ details[open] .toggle {
70
+ color: var(--sl-color-white);
71
+ border-color: var(--sl-color-accent);
72
+ }
73
+ details .toggle:hover {
74
+ color: var(--sl-color-white);
75
+ border-color: var(--sl-color-gray-2);
76
+ }
77
+
78
+ :global([dir='rtl']) .caret {
79
+ transform: rotateZ(180deg);
80
+ }
81
+ details[open] .caret {
82
+ transform: rotateZ(90deg);
83
+ }
84
+
85
+ .dropdown {
86
+ --border-top: 1px;
87
+ margin-top: calc(-1 * var(--border-top));
88
+ border: var(--border-top) solid var(--sl-color-gray-6);
89
+ border-top-color: var(--sl-color-hairline-shade);
90
+ max-height: calc(85vh - var(--sl-nav-height) - var(--sl-mobile-toc-height));
91
+ overflow-y: auto;
92
+ background-color: var(--sl-color-black);
93
+ box-shadow: var(--sl-shadow-md);
94
+ }
95
+ </style>
96
+
97
+ <script>
98
+ const details = document.querySelector<HTMLDetailsElement>(
99
+ '#starlight__mobile-toc'
100
+ );
101
+ if (details) {
102
+ const closeToC = () => {
103
+ details.open = false;
104
+ };
105
+ // Close the table of contents whenever a link is clicked.
106
+ details.querySelectorAll('a').forEach((a) => {
107
+ a.addEventListener('click', closeToC);
108
+ });
109
+ // Close the table of contents when a user clicks outside of it.
110
+ window.addEventListener('click', (e) => {
111
+ if (!details.contains(e.target as Node)) closeToC();
112
+ });
113
+ // Or when they press the escape key.
114
+ window.addEventListener('keydown', (e) => {
115
+ if (e.key === 'Escape' && details.open) {
116
+ const hasFocus = details.contains(document.activeElement);
117
+ closeToC();
118
+ if (hasFocus) {
119
+ const summary = details.querySelector('summary');
120
+ if (summary) summary.focus();
121
+ }
122
+ }
123
+ });
124
+ }
125
+ </script>
@@ -3,33 +3,54 @@ import type { generateToC } from './generateToC';
3
3
 
4
4
  interface Props {
5
5
  toc: ReturnType<typeof generateToC>;
6
- nested?: boolean;
6
+ depth?: number;
7
+ isMobile?: boolean;
7
8
  }
8
9
 
9
- const { toc, nested } = Astro.props;
10
+ const { toc, isMobile = false, depth = 0 } = Astro.props;
10
11
  ---
11
12
 
12
- <ul class:list={{ nested }}>
13
+ <ul class:list={{ isMobile }}>
13
14
  {
14
15
  toc.map((heading) => (
15
16
  <li>
16
17
  <a href={'#' + heading.slug}>{heading.text}</a>
17
18
  {heading.children.length > 0 && (
18
- <Astro.self toc={heading.children} nested />
19
+ <Astro.self
20
+ toc={heading.children}
21
+ depth={depth + 1}
22
+ isMobile={isMobile}
23
+ />
19
24
  )}
20
25
  </li>
21
26
  ))
22
27
  }
23
28
  </ul>
24
29
 
25
- <style>
30
+ <style define:vars={{ depth }}>
26
31
  ul {
27
32
  padding: 0;
28
33
  }
29
- .nested {
30
- padding-inline-start: 1rem;
31
- }
32
34
  ul :global(::marker) {
33
35
  color: transparent;
34
36
  }
37
+ a {
38
+ --pad-inline: 0rem;
39
+ display: block;
40
+ padding-inline: calc(1rem * var(--depth) + var(--pad-inline))
41
+ var(--pad-inline);
42
+ }
43
+ .isMobile a {
44
+ --pad-inline: 1rem;
45
+ border-top: 1px solid var(--sl-color-gray-6);
46
+ padding-block: 0.5rem;
47
+ color: var(--sl-color-text);
48
+ font-size: var(--sl-text-sm);
49
+ line-height: 1.25;
50
+ text-decoration: none;
51
+ outline-offset: var(--sl-outline-offset-inside);
52
+ }
53
+ .isMobile:first-child > li:first-child > a {
54
+ border-top: 0;
55
+ }
35
56
  </style>
package/index.astro CHANGED
@@ -1,6 +1,5 @@
1
1
  ---
2
2
  import type { InferGetStaticPropsType } from 'astro';
3
- import config from 'virtual:starlight/user-config';
4
3
 
5
4
  import { getPrevNextLinks, getSidebar } from './utils/navigation';
6
5
  import { paths } from './utils/routing';
@@ -13,17 +12,16 @@ import './style/util.css';
13
12
 
14
13
  // Components — can override built-in CSS, but not user CSS.
15
14
  import ContentPanel from './components/ContentPanel.astro';
16
- import EditLink from './components/EditLink.astro';
17
15
  import FallbackContentNotice from './components/FallbackContentNotice.astro';
18
16
  import HeadSEO from './components/HeadSEO.astro';
19
17
  import Header from './components/Header.astro';
20
18
  import LastUpdated from './components/LastUpdated.astro';
21
19
  import MarkdownContent from './components/MarkdownContent.astro';
22
20
  import PrevNextLinks from './components/PrevNextLinks.astro';
23
- import RightSidebarPanel from './components/RightSidebarPanel.astro';
21
+ import RightSidebar from './components/RightSidebar.astro';
24
22
  import Sidebar from './components/Sidebar.astro';
25
23
  import SkipLink from './components/SkipLink.astro';
26
- import TableOfContents from './components/TableOfContents.astro';
24
+ import MobileTableOfContents from './components/TableOfContents/MobileTableOfContents.astro';
27
25
  import ThemeProvider from './components/ThemeProvider.astro';
28
26
  import PageFrame from './layout/PageFrame.astro';
29
27
  import TwoColumnContent from './layout/TwoColumnContent.astro';
@@ -58,22 +56,9 @@ const prevNextLinks = getPrevNextLinks(sidebar);
58
56
  <PageFrame>
59
57
  <Header slot="header" locale={locale} />
60
58
  <Sidebar slot="sidebar" sidebar={sidebar} locale={locale} />
59
+ <MobileTableOfContents headings={headings} />
61
60
  <TwoColumnContent>
62
- <Fragment slot="right-sidebar">
63
- <RightSidebarPanel>
64
- <TableOfContents headings={headings} />
65
- </RightSidebarPanel>
66
- <RightSidebarPanel>
67
- {
68
- config.editLink.baseUrl && (
69
- <>
70
- <h2>Contribute</h2>
71
- <EditLink data={entry.data} id={entry.id} />
72
- </>
73
- )
74
- }
75
- </RightSidebarPanel>
76
- </Fragment>
61
+ <RightSidebar slot="right-sidebar" entry={entry} headings={headings} />
77
62
  <main
78
63
  id="starlight__overview"
79
64
  data-pagefind-body
@@ -50,6 +50,7 @@ const hasSidebar = Astro.slots.has('sidebar');
50
50
  .sidebar-pane {
51
51
  visibility: var(--sl-sidebar-visibility, hidden);
52
52
  position: fixed;
53
+ z-index: var(--sl-z-index-menu);
53
54
  inset-block: 0;
54
55
  inset-inline-start: 0;
55
56
  padding-top: var(--sl-nav-height);
@@ -67,7 +68,7 @@ const hasSidebar = Astro.slots.has('sidebar');
67
68
  }
68
69
 
69
70
  .main-frame {
70
- padding-top: var(--sl-nav-height);
71
+ padding-top: calc(var(--sl-nav-height) + var(--sl-mobile-toc-height));
71
72
  }
72
73
 
73
74
  @media (min-width: 50rem) {
@@ -1,5 +1,5 @@
1
1
  <div class="container">
2
- <aside class="right-sidebar-container">
2
+ <aside class="right-sidebar-container hidden lg:block">
3
3
  <div class="right-sidebar"><slot name="right-sidebar" /></div>
4
4
  </aside>
5
5
  <div class="main-pane"><slot /></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrojs/starlight",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "Build beautiful, high-performance documentation websites with Astro",
5
5
  "keywords": [
6
6
  "docs",
@@ -10,6 +10,13 @@
10
10
  ],
11
11
  "author": "Chris Swithinbank <swithinbank@gmail.com>",
12
12
  "license": "MIT",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/withastro/starlight",
16
+ "directory": "packages/starlight"
17
+ },
18
+ "bugs": "https://github.com/withastro/starlight/issues",
19
+ "homepage": "https://starlight.astro.build",
13
20
  "type": "module",
14
21
  "exports": {
15
22
  ".": "./index.ts",
package/schema.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { z } from 'astro:content';
1
+ import { z } from 'astro/zod';
2
2
 
3
3
  export function docsSchema() {
4
4
  return z.object({
package/style/props.css CHANGED
@@ -113,17 +113,21 @@
113
113
  --__sb-font-mono: var(--sl-font-mono, ''), var(--sl-font-system-mono);
114
114
 
115
115
  /** Key layout values */
116
- --sl-nav-height: 4rem;
116
+ --sl-nav-height: 3.5rem;
117
117
  --sl-nav-pad-x: 1.5rem;
118
118
  --sl-nav-pad-y: 0.75rem;
119
+ --sl-mobile-toc-height: 3rem;
119
120
  --sl-sidebar-width: 18.75rem;
120
121
  --sl-sidebar-pad-x: 1rem;
121
122
  --sl-content-width: 45rem;
122
123
  --sl-content-pad-x: 1rem;
123
124
  --sl-menu-button-size: 2rem;
124
125
  --sl-nav-gap: var(--sl-content-pad-x);
126
+ /* Offset required to show outline inside an element instead of round the outside */
127
+ --sl-outline-offset-inside: -0.1875rem;
125
128
 
126
129
  /* Global z-index values */
130
+ --sl-z-index-menu: 5;
127
131
  --sl-z-index-navbar: 10;
128
132
  --sl-z-index-skiplink: 20;
129
133
  }
@@ -183,6 +187,7 @@
183
187
 
184
188
  @media (min-width: 50em) {
185
189
  :root {
190
+ --sl-nav-height: 4rem;
186
191
  --sl-text-h1: var(--sl-text-5xl);
187
192
  --sl-text-h2: var(--sl-text-4xl);
188
193
  --sl-text-h3: var(--sl-text-3xl);
@@ -193,5 +198,6 @@
193
198
  @media (min-width: 72rem) {
194
199
  :root {
195
200
  --sl-content-pad-x: 1.5rem;
201
+ --sl-mobile-toc-height: 0rem;
196
202
  }
197
203
  }
package/style/util.css CHANGED
@@ -30,3 +30,14 @@
30
30
  display: block;
31
31
  }
32
32
  }
33
+ @media (min-width: 72rem) {
34
+ .lg\:hidden {
35
+ display: none;
36
+ }
37
+ .lg\:flex {
38
+ display: flex;
39
+ }
40
+ .lg\:block {
41
+ display: block;
42
+ }
43
+ }
@@ -84,7 +84,7 @@ const SidebarGroupSchema: z.ZodType<
84
84
  ManualSidebarGroup | z.infer<typeof AutoSidebarGroupSchema>
85
85
  > = z.union([ManualSidebarGroupSchema, AutoSidebarGroupSchema]);
86
86
 
87
- const StarlightUserConfigSchema = z.object({
87
+ const UserConfigSchema = z.object({
88
88
  /** Title for your website. Will be used in metadata and as browser tab title. */
89
89
  title: z
90
90
  .string()
@@ -103,8 +103,14 @@ const StarlightUserConfigSchema = z.object({
103
103
  /** Optional details about the social media accounts for this site. */
104
104
  social: z
105
105
  .object({
106
- /** Main Twitter handle for this site, e.g. `'astrodotbuild'`. */
107
- twitter: z.string().optional(),
106
+ /** Link to the main Twitter profile for this site, e.g. `'https://twitter.com/astrodotbuild'`. */
107
+ twitter: z.string().url().optional(),
108
+ /** Link to the main Mastodon profile for this site, e.g. `'https://m.webtoo.ls/@astro'`. */
109
+ mastodon: z.string().url().optional(),
110
+ /** Link to the main GitHub org or repo for this site, e.g. `'https://github.com/withastro/starlight'`. */
111
+ github: z.string().url().optional(),
112
+ /** Link to the Discord server for this site, e.g. `'https://astro.build/chat'`. */
113
+ discord: z.string().url().optional(),
108
114
  })
109
115
  .optional(),
110
116
 
@@ -202,7 +208,7 @@ const StarlightUserConfigSchema = z.object({
202
208
  customCss: z.string().array().optional().default([]),
203
209
  });
204
210
 
205
- export const StarlightConfigSchema = StarlightUserConfigSchema.strict().transform(
211
+ export const StarlightConfigSchema = UserConfigSchema.strict().transform(
206
212
  ({ locales, defaultLocale, ...config }, ctx) => {
207
213
  if (locales !== undefined && Object.keys(locales).length > 1) {
208
214
  // This is a multilingual site (more than one locale configured).