@astrojs/starlight 0.5.6 → 0.6.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 +17 -17
- package/CHANGELOG.md +40 -2
- package/components/CallToAction.astro +32 -35
- package/components/ContentPanel.astro +18 -18
- package/components/EditLink.astro +23 -23
- package/components/FallbackContentNotice.astro +16 -18
- package/components/Footer.astro +28 -34
- package/components/HeadSEO.astro +69 -75
- package/components/Header.astro +47 -51
- package/components/Hero.astro +108 -121
- package/components/Icons.ts +73 -71
- package/components/LanguageSelect.astro +31 -31
- package/components/LastUpdated.astro +16 -18
- package/components/MarkdownContent.astro +105 -117
- package/components/MobileMenuToggle.astro +80 -80
- package/components/PrevNextLinks.astro +60 -60
- package/components/RightSidebar.astro +17 -17
- package/components/RightSidebarPanel.astro +41 -41
- package/components/Search.astro +293 -306
- package/components/Select.astro +64 -65
- package/components/Sidebar.astro +23 -23
- package/components/SidebarSublist.astro +96 -95
- package/components/SiteTitle.astro +65 -63
- package/components/SkipLink.astro +17 -17
- package/components/SocialIcons.astro +36 -34
- package/components/TableOfContents/MobileTableOfContents.astro +124 -124
- package/components/TableOfContents/TableOfContentsList.astro +64 -69
- package/components/TableOfContents/generateToC.ts +41 -43
- package/components/TableOfContents/starlight-toc.ts +84 -90
- package/components/TableOfContents.astro +8 -8
- package/components/ThemeProvider.astro +28 -32
- package/components/ThemeSelect.astro +66 -71
- package/global.d.ts +3 -3
- package/index.astro +1 -1
- package/index.ts +52 -59
- package/integrations/asides.ts +109 -111
- package/integrations/sitemap.ts +10 -13
- package/integrations/virtual-user-config.ts +37 -37
- package/layout/Page.astro +84 -72
- package/layout/PageFrame.astro +67 -69
- package/layout/TwoColumnContent.astro +40 -42
- package/package.json +2 -2
- package/schema.ts +126 -113
- package/schemas/favicon.ts +40 -0
- package/schemas/head.ts +12 -23
- package/schemas/i18n.ts +146 -160
- package/schemas/logo.ts +22 -22
- package/schemas/prevNextLink.ts +14 -14
- package/schemas/tableOfContents.ts +14 -18
- package/style/asides.css +27 -27
- package/style/props.css +168 -172
- package/style/reset.css +13 -13
- package/style/shiki.css +11 -11
- package/style/util.css +30 -30
- package/translations/fr.json +21 -21
- package/translations/index.ts +4 -4
- package/translations/it.json +20 -20
- package/translations/tr.json +1 -1
- package/translations/zh.json +0 -1
- package/user-components/Card.astro +50 -54
- package/user-components/CardGrid.astro +21 -21
- package/user-components/Icon.astro +19 -21
- package/user-components/TabItem.astro +3 -3
- package/user-components/Tabs.astro +113 -117
- package/user-components/rehype-tabs.ts +72 -72
- package/utils/base.ts +6 -6
- package/utils/git.ts +55 -55
- package/utils/head.ts +56 -54
- package/utils/i18n.ts +3 -3
- package/utils/localizedUrl.ts +25 -25
- package/utils/navigation.ts +225 -203
- package/utils/routing.ts +74 -85
- package/utils/slugs.ts +41 -51
- package/utils/translations.ts +26 -32
- package/utils/user-config.ts +278 -278
- package/virtual.d.ts +8 -8
package/components/Header.astro
CHANGED
|
@@ -6,67 +6,63 @@ import SocialIcons from './SocialIcons.astro';
|
|
|
6
6
|
import ThemeSelect from './ThemeSelect.astro';
|
|
7
7
|
|
|
8
8
|
interface Props {
|
|
9
|
-
|
|
9
|
+
locale: string | undefined;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
const { locale } = Astro.props;
|
|
13
13
|
---
|
|
14
14
|
|
|
15
15
|
<div class="header flex">
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
<SiteTitle {locale} />
|
|
17
|
+
<Search {locale} />
|
|
18
|
+
<div class="hidden md:flex right-group">
|
|
19
|
+
<SocialIcons />
|
|
20
|
+
<ThemeSelect {locale} />
|
|
21
|
+
<LanguageSelect {locale} />
|
|
22
|
+
</div>
|
|
23
23
|
</div>
|
|
24
24
|
|
|
25
25
|
<style>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
.header {
|
|
27
|
+
gap: var(--sl-nav-gap);
|
|
28
|
+
justify-content: space-between;
|
|
29
|
+
align-items: center;
|
|
30
|
+
height: 100%;
|
|
31
|
+
}
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
.right-group {
|
|
34
|
+
gap: 1rem;
|
|
35
|
+
align-items: center;
|
|
36
|
+
}
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
) / 2
|
|
57
|
-
);
|
|
58
|
-
display: grid;
|
|
59
|
-
grid-template-columns:
|
|
38
|
+
@media (min-width: 50rem) {
|
|
39
|
+
:global(:root[data-has-sidebar]) {
|
|
40
|
+
--__sidebar-pad: calc(2 * var(--sl-nav-pad-x));
|
|
41
|
+
}
|
|
42
|
+
:global(:root:not([data-has-toc])) {
|
|
43
|
+
--__toc-width: 0rem;
|
|
44
|
+
}
|
|
45
|
+
.header {
|
|
46
|
+
--__sidebar-width: max(0rem, var(--sl-content-inline-start, 0rem) - var(--sl-nav-pad-x));
|
|
47
|
+
--__main-column-fr: calc(
|
|
48
|
+
(
|
|
49
|
+
100% + var(--__sidebar-pad, 0rem) - var(--__toc-width, var(--sl-sidebar-width)) -
|
|
50
|
+
(2 * var(--__toc-width, var(--sl-nav-pad-x))) - var(--sl-content-inline-start, 0rem) -
|
|
51
|
+
var(--sl-content-width)
|
|
52
|
+
) / 2
|
|
53
|
+
);
|
|
54
|
+
display: grid;
|
|
55
|
+
grid-template-columns:
|
|
60
56
|
/* 1 (site title): runs up until the main content column’s left edge or the width of the title, whichever is the largest */
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
57
|
+
minmax(
|
|
58
|
+
calc(var(--__sidebar-width) + max(0rem, var(--__main-column-fr) - var(--sl-nav-gap))),
|
|
59
|
+
auto
|
|
60
|
+
)
|
|
61
|
+
/* 2 (search box): all free space that is available. */
|
|
62
|
+
1fr
|
|
63
|
+
/* 3 (right items): use the space that these need. */
|
|
64
|
+
auto;
|
|
65
|
+
align-content: center;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
72
68
|
</style>
|
package/components/Hero.astro
CHANGED
|
@@ -4,136 +4,123 @@ import { Image } from 'astro:assets';
|
|
|
4
4
|
import CallToAction from './CallToAction.astro';
|
|
5
5
|
|
|
6
6
|
interface Props {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
fallbackTitle: string;
|
|
8
|
+
hero: NonNullable<CollectionEntry<'docs'>['data']['hero']>;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
const {
|
|
12
|
-
title = Astro.props.fallbackTitle,
|
|
13
|
-
tagline,
|
|
14
|
-
image,
|
|
15
|
-
actions,
|
|
16
|
-
} = Astro.props.hero;
|
|
11
|
+
const { title = Astro.props.fallbackTitle, tagline, image, actions } = Astro.props.hero;
|
|
17
12
|
|
|
18
13
|
const imageAttrs = {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
loading: 'eager' as const,
|
|
15
|
+
decoding: 'async' as const,
|
|
16
|
+
width: 400,
|
|
17
|
+
height: 400,
|
|
18
|
+
alt: image?.alt,
|
|
24
19
|
};
|
|
25
20
|
---
|
|
26
21
|
|
|
27
22
|
<div class="hero">
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
23
|
+
{
|
|
24
|
+
image?.file ? (
|
|
25
|
+
image.file.format === 'svg' ? (
|
|
26
|
+
<img src={image.file.src} {...imageAttrs} />
|
|
27
|
+
) : (
|
|
28
|
+
<Image src={image.file} {...imageAttrs} />
|
|
29
|
+
)
|
|
30
|
+
) : (
|
|
31
|
+
image?.html && <div class="hero-html flex" set:html={image.html} />
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
<div class="flex stack">
|
|
35
|
+
<div class="flex copy">
|
|
36
|
+
<h1 id="_top" data-page-title set:html={title} />
|
|
37
|
+
{tagline && <div class="tagline" set:html={tagline} />}
|
|
38
|
+
</div>
|
|
39
|
+
{
|
|
40
|
+
actions.length > 0 && (
|
|
41
|
+
<div class="flex actions">
|
|
42
|
+
{actions.map(({ text, ...attrs }) => (
|
|
43
|
+
<CallToAction {...attrs} set:html={text} />
|
|
44
|
+
))}
|
|
45
|
+
</div>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
</div>
|
|
54
49
|
</div>
|
|
55
50
|
|
|
56
51
|
<style>
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
.copy {
|
|
132
|
-
align-items: flex-start;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
.actions {
|
|
136
|
-
justify-content: flex-start;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
52
|
+
.hero {
|
|
53
|
+
display: grid;
|
|
54
|
+
align-items: center;
|
|
55
|
+
gap: 1rem;
|
|
56
|
+
padding-bottom: 1rem;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.hero > img,
|
|
60
|
+
.hero > .hero-html {
|
|
61
|
+
object-fit: contain;
|
|
62
|
+
width: min(70%, 20rem);
|
|
63
|
+
height: auto;
|
|
64
|
+
margin-inline: auto;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.stack {
|
|
68
|
+
flex-direction: column;
|
|
69
|
+
gap: clamp(1.5rem, calc(1.5rem + 1vw), 2rem);
|
|
70
|
+
text-align: center;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.copy {
|
|
74
|
+
flex-direction: column;
|
|
75
|
+
gap: 1rem;
|
|
76
|
+
align-items: center;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.copy > * {
|
|
80
|
+
max-width: 50ch;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
h1 {
|
|
84
|
+
font-size: clamp(var(--sl-text-3xl), calc(0.25rem + 5vw), var(--sl-text-6xl));
|
|
85
|
+
line-height: var(--sl-line-height-headings);
|
|
86
|
+
font-weight: 600;
|
|
87
|
+
color: var(--sl-color-white);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.tagline {
|
|
91
|
+
font-size: clamp(var(--sl-text-base), calc(0.0625rem + 2vw), var(--sl-text-xl));
|
|
92
|
+
color: var(--sl-color-gray-2);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.actions {
|
|
96
|
+
gap: 1rem 2rem;
|
|
97
|
+
flex-wrap: wrap;
|
|
98
|
+
justify-content: center;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@media (min-width: 50rem) {
|
|
102
|
+
.hero {
|
|
103
|
+
grid-template-columns: 7fr 4fr;
|
|
104
|
+
gap: 3%;
|
|
105
|
+
padding-block: clamp(2.5rem, calc(1rem + 10vmin), 10rem);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.hero > img,
|
|
109
|
+
.hero > .hero-html {
|
|
110
|
+
order: 2;
|
|
111
|
+
width: min(100%, 25rem);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.stack {
|
|
115
|
+
text-align: start;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.copy {
|
|
119
|
+
align-items: flex-start;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.actions {
|
|
123
|
+
justify-content: flex-start;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
139
126
|
</style>
|