@astrojs/starlight 0.5.5 → 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 +52 -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 +48 -55
- 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 -303
- 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 +55 -111
- package/integrations/asides.ts +109 -111
- package/integrations/sitemap.ts +10 -13
- package/integrations/virtual-user-config.ts +52 -0
- package/layout/Page.astro +84 -72
- package/layout/PageFrame.astro +67 -69
- package/layout/TwoColumnContent.astro +40 -42
- package/package.json +8 -3
- 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 -173
- 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/types.ts +1 -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/schemas/i18n.ts
CHANGED
|
@@ -1,173 +1,159 @@
|
|
|
1
1
|
import { z } from 'astro/zod';
|
|
2
2
|
|
|
3
3
|
export function i18nSchema() {
|
|
4
|
-
|
|
4
|
+
return starlightI18nSchema().merge(pagefindI18nSchema());
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
export function builtinI18nSchema() {
|
|
8
|
-
|
|
8
|
+
return starlightI18nSchema().required().strict().merge(pagefindI18nSchema());
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
function starlightI18nSchema() {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
-
'Label shown on the “previous page” pagination arrow in the page footer.'
|
|
94
|
-
),
|
|
95
|
-
|
|
96
|
-
'page.nextLink': z
|
|
97
|
-
.string()
|
|
98
|
-
.describe(
|
|
99
|
-
'Label shown on the “next page” pagination arrow in the page footer.'
|
|
100
|
-
),
|
|
101
|
-
|
|
102
|
-
'404.text': z
|
|
103
|
-
.string()
|
|
104
|
-
.describe('Text shown on Starlight’s default 404 page'),
|
|
105
|
-
})
|
|
106
|
-
.partial();
|
|
12
|
+
return z
|
|
13
|
+
.object({
|
|
14
|
+
'skipLink.label': z
|
|
15
|
+
.string()
|
|
16
|
+
.describe(
|
|
17
|
+
'Text displayed in the accessible “Skip link” when a keyboard user first tabs into a page.'
|
|
18
|
+
),
|
|
19
|
+
|
|
20
|
+
'search.label': z.string().describe('Text displayed in the search bar.'),
|
|
21
|
+
|
|
22
|
+
'search.shortcutLabel': z
|
|
23
|
+
.string()
|
|
24
|
+
.describe('Accessible label for the shortcut key to open the search modal.'),
|
|
25
|
+
|
|
26
|
+
'search.cancelLabel': z
|
|
27
|
+
.string()
|
|
28
|
+
.describe('Text for the “Cancel” button that closes the search modal.'),
|
|
29
|
+
|
|
30
|
+
'search.devWarning': z
|
|
31
|
+
.string()
|
|
32
|
+
.describe('Warning displayed when opening the Search in a dev environment.'),
|
|
33
|
+
|
|
34
|
+
'themeSelect.accessibleLabel': z
|
|
35
|
+
.string()
|
|
36
|
+
.describe('Accessible label for the theme selection dropdown.'),
|
|
37
|
+
|
|
38
|
+
'themeSelect.dark': z.string().describe('Name of the dark color theme.'),
|
|
39
|
+
|
|
40
|
+
'themeSelect.light': z.string().describe('Name of the light color theme.'),
|
|
41
|
+
|
|
42
|
+
'themeSelect.auto': z
|
|
43
|
+
.string()
|
|
44
|
+
.describe('Name of the automatic color theme that syncs with system preferences.'),
|
|
45
|
+
|
|
46
|
+
'languageSelect.accessibleLabel': z
|
|
47
|
+
.string()
|
|
48
|
+
.describe('Accessible label for the language selection dropdown.'),
|
|
49
|
+
|
|
50
|
+
'menuButton.accessibleLabel': z
|
|
51
|
+
.string()
|
|
52
|
+
.describe('Accessible label for he mobile menu button.'),
|
|
53
|
+
|
|
54
|
+
'sidebarNav.accessibleLabel': z
|
|
55
|
+
.string()
|
|
56
|
+
.describe(
|
|
57
|
+
'Accessible label for the main sidebar `<nav>` element to distinguish it fom other `<nav>` landmarks on the page.'
|
|
58
|
+
),
|
|
59
|
+
|
|
60
|
+
'tableOfContents.onThisPage': z
|
|
61
|
+
.string()
|
|
62
|
+
.describe('Title for the table of contents component.'),
|
|
63
|
+
|
|
64
|
+
'tableOfContents.overview': z
|
|
65
|
+
.string()
|
|
66
|
+
.describe(
|
|
67
|
+
'Label used for the first link in the table of contents, linking to the page title.'
|
|
68
|
+
),
|
|
69
|
+
|
|
70
|
+
'i18n.untranslatedContent': z
|
|
71
|
+
.string()
|
|
72
|
+
.describe(
|
|
73
|
+
'Notice informing users they are on a page that is not yet translated to their language.'
|
|
74
|
+
),
|
|
75
|
+
|
|
76
|
+
'page.editLink': z.string().describe('Text for the link to edit a page.'),
|
|
77
|
+
|
|
78
|
+
'page.lastUpdated': z
|
|
79
|
+
.string()
|
|
80
|
+
.describe('Text displayed in front of the last updated date in the page footer.'),
|
|
81
|
+
|
|
82
|
+
'page.previousLink': z
|
|
83
|
+
.string()
|
|
84
|
+
.describe('Label shown on the “previous page” pagination arrow in the page footer.'),
|
|
85
|
+
|
|
86
|
+
'page.nextLink': z
|
|
87
|
+
.string()
|
|
88
|
+
.describe('Label shown on the “next page” pagination arrow in the page footer.'),
|
|
89
|
+
|
|
90
|
+
'404.text': z.string().describe('Text shown on Starlight’s default 404 page'),
|
|
91
|
+
})
|
|
92
|
+
.partial();
|
|
107
93
|
}
|
|
108
94
|
|
|
109
95
|
function pagefindI18nSchema() {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
96
|
+
return z
|
|
97
|
+
.object({
|
|
98
|
+
'pagefind.clear_search': z
|
|
99
|
+
.string()
|
|
100
|
+
.describe(
|
|
101
|
+
'Pagefind UI translation. English default value: `"Clear"`. See https://pagefind.app/docs/ui/#translations'
|
|
102
|
+
),
|
|
103
|
+
|
|
104
|
+
'pagefind.load_more': z
|
|
105
|
+
.string()
|
|
106
|
+
.describe(
|
|
107
|
+
'Pagefind UI translation. English default value: `"Load more results"`. See https://pagefind.app/docs/ui/#translations'
|
|
108
|
+
),
|
|
109
|
+
|
|
110
|
+
'pagefind.search_label': z
|
|
111
|
+
.string()
|
|
112
|
+
.describe(
|
|
113
|
+
'Pagefind UI translation. English default value: `"Search this site"`. See https://pagefind.app/docs/ui/#translations'
|
|
114
|
+
),
|
|
115
|
+
|
|
116
|
+
'pagefind.filters_label': z
|
|
117
|
+
.string()
|
|
118
|
+
.describe(
|
|
119
|
+
'Pagefind UI translation. English default value: `"Filters"`. See https://pagefind.app/docs/ui/#translations'
|
|
120
|
+
),
|
|
121
|
+
|
|
122
|
+
'pagefind.zero_results': z
|
|
123
|
+
.string()
|
|
124
|
+
.describe(
|
|
125
|
+
'Pagefind UI translation. English default value: `"No results for [SEARCH_TERM]"`. See https://pagefind.app/docs/ui/#translations'
|
|
126
|
+
),
|
|
127
|
+
|
|
128
|
+
'pagefind.many_results': z
|
|
129
|
+
.string()
|
|
130
|
+
.describe(
|
|
131
|
+
'Pagefind UI translation. English default value: `"[COUNT] results for [SEARCH_TERM]"`. See https://pagefind.app/docs/ui/#translations'
|
|
132
|
+
),
|
|
133
|
+
|
|
134
|
+
'pagefind.one_result': z
|
|
135
|
+
.string()
|
|
136
|
+
.describe(
|
|
137
|
+
'Pagefind UI translation. English default value: `"[COUNT] result for [SEARCH_TERM]"`. See https://pagefind.app/docs/ui/#translations'
|
|
138
|
+
),
|
|
139
|
+
|
|
140
|
+
'pagefind.alt_search': z
|
|
141
|
+
.string()
|
|
142
|
+
.describe(
|
|
143
|
+
'Pagefind UI translation. English default value: `"No results for [SEARCH_TERM]. Showing results for [DIFFERENT_TERM] instead"`. See https://pagefind.app/docs/ui/#translations'
|
|
144
|
+
),
|
|
145
|
+
|
|
146
|
+
'pagefind.search_suggestion': z
|
|
147
|
+
.string()
|
|
148
|
+
.describe(
|
|
149
|
+
'Pagefind UI translation. English default value: `"No results for [SEARCH_TERM]. Try one of the following searches:"`. See https://pagefind.app/docs/ui/#translations'
|
|
150
|
+
),
|
|
151
|
+
|
|
152
|
+
'pagefind.searching': z
|
|
153
|
+
.string()
|
|
154
|
+
.describe(
|
|
155
|
+
'Pagefind UI translation. English default value: `"Searching for [SEARCH_TERM]..."`. See https://pagefind.app/docs/ui/#translations'
|
|
156
|
+
),
|
|
157
|
+
})
|
|
158
|
+
.partial();
|
|
173
159
|
}
|
package/schemas/logo.ts
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { z } from 'astro/zod';
|
|
2
2
|
|
|
3
3
|
export const LogoConfigSchema = () =>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
4
|
+
z
|
|
5
|
+
.union([
|
|
6
|
+
z.object({
|
|
7
|
+
/** Source of the image file to use. */
|
|
8
|
+
src: z.string(),
|
|
9
|
+
/** Alternative text description of the logo. */
|
|
10
|
+
alt: z.string().default(''),
|
|
11
|
+
/** Set to `true` to hide the site title text and only show the logo. */
|
|
12
|
+
replacesTitle: z.boolean().default(false),
|
|
13
|
+
}),
|
|
14
|
+
z.object({
|
|
15
|
+
/** Source of the image file to use in dark mode. */
|
|
16
|
+
dark: z.string(),
|
|
17
|
+
/** Source of the image file to use in light mode. */
|
|
18
|
+
light: z.string(),
|
|
19
|
+
/** Alternative text description of the logo. */
|
|
20
|
+
alt: z.string().default(''),
|
|
21
|
+
/** Set to `true` to hide the site title text and only show the logo. */
|
|
22
|
+
replacesTitle: z.boolean().default(false),
|
|
23
|
+
}),
|
|
24
|
+
])
|
|
25
|
+
.optional();
|
|
26
26
|
|
|
27
27
|
export type LogoUserConfig = z.input<ReturnType<typeof LogoConfigSchema>>;
|
|
28
28
|
export type LogoConfig = z.output<ReturnType<typeof LogoConfigSchema>>;
|
package/schemas/prevNextLink.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { z } from 'astro/zod';
|
|
2
2
|
|
|
3
3
|
export const PrevNextLinkConfigSchema = () =>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
4
|
+
z
|
|
5
|
+
.union([
|
|
6
|
+
z.boolean(),
|
|
7
|
+
z.string(),
|
|
8
|
+
z
|
|
9
|
+
.object({
|
|
10
|
+
/** The navigation link URL. */
|
|
11
|
+
link: z.string().optional(),
|
|
12
|
+
/** The navigation link text. */
|
|
13
|
+
label: z.string().optional(),
|
|
14
|
+
})
|
|
15
|
+
.strict(),
|
|
16
|
+
])
|
|
17
|
+
.optional();
|
|
18
18
|
|
|
19
19
|
export type PrevNextLinkUserConfig = z.input<ReturnType<typeof PrevNextLinkConfigSchema>>;
|
|
20
20
|
export type PrevNextLinkConfig = z.output<ReturnType<typeof PrevNextLinkConfigSchema>>;
|
|
@@ -3,21 +3,17 @@ import { z } from 'astro/zod';
|
|
|
3
3
|
const defaults = { minHeadingLevel: 2, maxHeadingLevel: 3 };
|
|
4
4
|
|
|
5
5
|
export const TableOfContentsSchema = () =>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
message:
|
|
21
|
-
'minHeadingLevel must be less than or equal to maxHeadingLevel',
|
|
22
|
-
}
|
|
23
|
-
);
|
|
6
|
+
z
|
|
7
|
+
.union([
|
|
8
|
+
z.object({
|
|
9
|
+
/** The level to start including headings at in the table of contents. Default: 2. */
|
|
10
|
+
minHeadingLevel: z.number().int().min(1).max(6).optional().default(2),
|
|
11
|
+
/** The level to stop including headings at in the table of contents. Default: 3. */
|
|
12
|
+
maxHeadingLevel: z.number().int().min(1).max(6).optional().default(3),
|
|
13
|
+
}),
|
|
14
|
+
z.boolean().transform((enabled) => (enabled ? defaults : false)),
|
|
15
|
+
])
|
|
16
|
+
.default(defaults)
|
|
17
|
+
.refine((toc) => (toc ? toc.minHeadingLevel <= toc.maxHeadingLevel : true), {
|
|
18
|
+
message: 'minHeadingLevel must be less than or equal to maxHeadingLevel',
|
|
19
|
+
});
|
package/style/asides.css
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
1
|
.starlight-aside {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
padding: 1rem;
|
|
3
|
+
border-inline-start: 0.25rem solid;
|
|
4
|
+
color: var(--sl-color-white);
|
|
5
5
|
}
|
|
6
6
|
.starlight-aside--note {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
--sl-color-asides-text-accent: var(--sl-color-blue-high);
|
|
8
|
+
border-color: var(--sl-color-blue);
|
|
9
|
+
background-color: var(--sl-color-blue-low);
|
|
10
10
|
}
|
|
11
11
|
.starlight-aside--tip {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
--sl-color-asides-text-accent: var(--sl-color-purple-high);
|
|
13
|
+
border-color: var(--sl-color-purple);
|
|
14
|
+
background-color: var(--sl-color-purple-low);
|
|
15
15
|
}
|
|
16
16
|
.starlight-aside--caution {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
--sl-color-asides-text-accent: var(--sl-color-orange-high);
|
|
18
|
+
border-color: var(--sl-color-orange);
|
|
19
|
+
background-color: var(--sl-color-orange-low);
|
|
20
20
|
}
|
|
21
21
|
.starlight-aside--danger {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
--sl-color-asides-text-accent: var(--sl-color-red-high);
|
|
23
|
+
border-color: var(--sl-color-red);
|
|
24
|
+
background-color: var(--sl-color-red-low);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
.starlight-aside__title {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
display: flex;
|
|
29
|
+
gap: 0.5rem;
|
|
30
|
+
align-items: center;
|
|
31
|
+
font-size: var(--sl-text-h5);
|
|
32
|
+
font-weight: 600;
|
|
33
|
+
line-height: var(--sl-line-height-headings);
|
|
34
|
+
color: var(--sl-color-asides-text-accent);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
.starlight-aside__icon {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
font-size: 1.333em;
|
|
39
|
+
width: 1em;
|
|
40
|
+
height: 1em;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
.starlight-aside__title + .starlight-aside__content {
|
|
44
|
-
|
|
44
|
+
margin-top: 0.5rem;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
.starlight-aside__content a {
|
|
48
|
-
|
|
48
|
+
color: var(--sl-color-asides-text-accent);
|
|
49
49
|
}
|