@astrojs/starlight 0.10.1 → 0.10.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,31 @@
1
1
  # @astrojs/starlight
2
2
 
3
+ ## 0.10.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#783](https://github.com/withastro/starlight/pull/783) [`f94727e`](https://github.com/withastro/starlight/commit/f94727e7d286a6910f913a572b27eb17c42f1729) Thanks [@kevinzunigacuellar](https://github.com/kevinzunigacuellar)! - Fix GitHub edit link to include src path from project config
8
+
9
+ - [#781](https://github.com/withastro/starlight/pull/781) [`a293ef9`](https://github.com/withastro/starlight/commit/a293ef9ebb10a07db456156d8bdacc4ff6a2ca38) Thanks [@dreyfus92](https://github.com/dreyfus92)! - Removed role from Banner component to avoid duplication in header.
10
+
11
+ - [#745](https://github.com/withastro/starlight/pull/745) [`006d606`](https://github.com/withastro/starlight/commit/006d60695761ec10e5c4e715ed2212cd1fbedda0) Thanks [@TheOtterlord](https://github.com/TheOtterlord)! - Prevent Starlight crashing when the content folder doesn't exist, or is empty
12
+
13
+ - [#775](https://github.com/withastro/starlight/pull/775) [`2ef3036`](https://github.com/withastro/starlight/commit/2ef303649a0b66a6ec6a216815e05d41bf22b594) Thanks [@delucis](https://github.com/delucis)! - Fix content collection schema compatibility with Astro 3.1 and higher
14
+
15
+ - [#773](https://github.com/withastro/starlight/pull/773) [`423d575`](https://github.com/withastro/starlight/commit/423d575cc8227e4db86a85c70c45c0f3f7a184d2) Thanks [@tlandmangh](https://github.com/tlandmangh)! - Fix Dutch UI translation for “Previous page” links
16
+
17
+ ## 0.10.2
18
+
19
+ ### Patch Changes
20
+
21
+ - [#735](https://github.com/withastro/starlight/pull/735) [`2da8692`](https://github.com/withastro/starlight/commit/2da86929c8041f6585790c3baf1cba42220650cc) Thanks [@delucis](https://github.com/delucis)! - Use Starlight font custom property in Pagefind modal
22
+
23
+ - [#735](https://github.com/withastro/starlight/pull/735) [`2da8692`](https://github.com/withastro/starlight/commit/2da86929c8041f6585790c3baf1cba42220650cc) Thanks [@delucis](https://github.com/delucis)! - Fix RTL styling in Pagefind modal
24
+
25
+ - [#739](https://github.com/withastro/starlight/pull/739) [`a9de4a7`](https://github.com/withastro/starlight/commit/a9de4a7dcf9ec8c5c801e8a6cbb0d7faf2c34db7) Thanks [@radenpioneer](https://github.com/radenpioneer)! - Add Indonesian UI translation
26
+
27
+ - [#747](https://github.com/withastro/starlight/pull/747) [`7589515`](https://github.com/withastro/starlight/commit/75895154b11cf9368d4d6b45647b156ce32a88f0) Thanks [@nirtamir2](https://github.com/nirtamir2)! - Add Hebrew UI translations
28
+
3
29
  ## 0.10.1
4
30
 
5
31
  ### Patch Changes
@@ -4,7 +4,7 @@ interface Props {
4
4
  }
5
5
  ---
6
6
 
7
- <div class="sl-banner" role="banner" set:html={Astro.props.content} />
7
+ <div class="sl-banner" set:html={Astro.props.content} />
8
8
 
9
9
  <style>
10
10
  .sl-banner {
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  import type { CollectionEntry } from 'astro:content';
3
3
  import config from 'virtual:starlight/user-config';
4
+ import project from 'virtual:starlight/project-context';
4
5
  import { useTranslations } from '../utils/translations';
5
6
  import Icon from '../user-components/Icon.astro';
6
7
 
@@ -12,6 +13,7 @@ interface Props {
12
13
 
13
14
  const t = useTranslations(Astro.props.locale);
14
15
  const { editUrl } = Astro.props.data;
16
+ const srcPath = project.srcDir.replace(project.root, '');
15
17
 
16
18
  let { baseUrl } = config.editLink;
17
19
  if (baseUrl && baseUrl.at(-1) !== '/') baseUrl += '/';
@@ -20,7 +22,7 @@ const url =
20
22
  typeof editUrl === 'string'
21
23
  ? editUrl
22
24
  : baseUrl
23
- ? baseUrl + 'src/content/docs/' + Astro.props.id
25
+ ? baseUrl + srcPath + 'content/docs/' + Astro.props.id
24
26
  : undefined;
25
27
  ---
26
28
 
@@ -205,6 +205,7 @@ const pagefindTranslations = {
205
205
  #starlight__search {
206
206
  --pagefind-ui-primary: var(--sl-color-accent-light);
207
207
  --pagefind-ui-text: var(--sl-color-gray-2);
208
+ --pagefind-ui-font: var(--__sl-font);
208
209
  --pagefind-ui-background: var(--sl-color-black);
209
210
  --pagefind-ui-border: var(--sl-color-gray-5);
210
211
  --pagefind-ui-border-width: 1px;
@@ -390,6 +391,12 @@ const pagefindTranslations = {
390
391
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 16 16'%3E%3Cpath d='M8 0v12m6 0H8'/%3E%3C/svg%3E");
391
392
  }
392
393
 
394
+ /* Flip page and tree icons around the vertical axis when in an RTL layout. */
395
+ [dir='rtl'] .pagefind-ui__result-title::before,
396
+ [dir='rtl'] .pagefind-ui__result-nested::before {
397
+ transform: matrix(-1, 0, 0, 1, 0, 0);
398
+ }
399
+
393
400
  #starlight__search .pagefind-ui__result-link::after {
394
401
  content: '';
395
402
  position: absolute;
@@ -10,7 +10,7 @@ function resolveVirtualModuleId<T extends string>(id: T): `\0${T}` {
10
10
  /** Vite plugin that exposes Starlight user config and project context via virtual modules. */
11
11
  export function vitePluginStarlightUserConfig(
12
12
  opts: StarlightConfig,
13
- { root }: Pick<AstroConfig, 'root'>
13
+ { root, srcDir }: Pick<AstroConfig, 'root' | 'srcDir'>
14
14
  ): NonNullable<ViteUserConfig['plugins']>[number] {
15
15
  const resolveId = (id: string) =>
16
16
  JSON.stringify(id.startsWith('.') ? resolve(fileURLToPath(root), id) : id);
@@ -18,7 +18,7 @@ export function vitePluginStarlightUserConfig(
18
18
  /** Map of virtual module names to their code contents as strings. */
19
19
  const modules = {
20
20
  'virtual:starlight/user-config': `export default ${JSON.stringify(opts)}`,
21
- 'virtual:starlight/project-context': `export default ${JSON.stringify({ root })}`,
21
+ 'virtual:starlight/project-context': `export default ${JSON.stringify({ root, srcDir })}`,
22
22
  'virtual:starlight/user-css': opts.customCss.map((id) => `import ${resolveId(id)};`).join(''),
23
23
  'virtual:starlight/user-images': opts.logo
24
24
  ? 'src' in opts.logo
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrojs/starlight",
3
- "version": "0.10.1",
3
+ "version": "0.10.3",
4
4
  "description": "Build beautiful, high-performance documentation websites with Astro",
5
5
  "keywords": [
6
6
  "docs",
package/schema.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { z } from 'astro/zod';
2
+ import type { SchemaContext } from 'astro:content';
2
3
  import { HeadConfigSchema } from './schemas/head';
3
4
  import { PrevNextLinkConfigSchema } from './schemas/prevNextLink';
4
5
  import { TableOfContentsSchema } from './schemas/tableOfContents';
@@ -9,25 +10,8 @@ export { i18nSchema } from './schemas/i18n';
9
10
  type IconName = keyof typeof Icons;
10
11
  const iconNames = Object.keys(Icons) as [IconName, ...IconName[]];
11
12
 
12
- type ImageFunction = () => z.ZodObject<{
13
- src: z.ZodString;
14
- width: z.ZodNumber;
15
- height: z.ZodNumber;
16
- format: z.ZodUnion<
17
- [
18
- z.ZodLiteral<'png'>,
19
- z.ZodLiteral<'jpg'>,
20
- z.ZodLiteral<'jpeg'>,
21
- z.ZodLiteral<'tiff'>,
22
- z.ZodLiteral<'webp'>,
23
- z.ZodLiteral<'gif'>,
24
- z.ZodLiteral<'svg'>,
25
- ]
26
- >;
27
- }>;
28
-
29
13
  export function docsSchema() {
30
- return ({ image }: { image: ImageFunction }) =>
14
+ return ({ image }: SchemaContext) =>
31
15
  z.object({
32
16
  /** The title of the current page. Required. */
33
17
  title: z.string(),
@@ -0,0 +1,22 @@
1
+ {
2
+ "skipLink.label": "דלגו לתוכן",
3
+ "search.label": "חיפוש",
4
+ "search.shortcutLabel": "(לחצו / כדי לחפש)",
5
+ "search.cancelLabel": "ביטול",
6
+ "search.devWarning": "החיפוש זמין רק בסביבת ייצור. \nנסו לבנות ולהציג תצוגה מקדימה של האתר כדי לבדוק אותו באופן מקומי.",
7
+ "themeSelect.accessibleLabel": "בחרו פרופיל צבע",
8
+ "themeSelect.dark": "כהה",
9
+ "themeSelect.light": "בהיר",
10
+ "themeSelect.auto": "מערכת",
11
+ "languageSelect.accessibleLabel": "בחרו שפה",
12
+ "menuButton.accessibleLabel": "תפריט",
13
+ "sidebarNav.accessibleLabel": "ראשי",
14
+ "tableOfContents.onThisPage": "בדף זה",
15
+ "tableOfContents.overview": "סקירה כללית",
16
+ "i18n.untranslatedContent": "תוכן זה אינו זמין עדיין בשפה שלך.",
17
+ "page.editLink": "ערכו דף",
18
+ "page.lastUpdated": "עדכון אחרון:",
19
+ "page.previousLink": "הקודם",
20
+ "page.nextLink": "הבא",
21
+ "404.text": "הדף לא נמצא. אנא בדקו את כתובת האתר או נסו להשתמש בסרגל החיפוש."
22
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "skipLink.label": "Lewati ke konten",
3
+ "search.label": "Pencarian",
4
+ "search.shortcutLabel": "(Tekan / untuk mencari)",
5
+ "search.cancelLabel": "Batal",
6
+ "search.devWarning": "Pencarian hanya tersedia pada build produksi. \nLakukan proses build dan pratinjau situs Anda sebelum mencoba di lingkungan lokal.",
7
+ "themeSelect.accessibleLabel": "Pilih tema",
8
+ "themeSelect.dark": "Gelap",
9
+ "themeSelect.light": "Terang",
10
+ "themeSelect.auto": "Otomatis",
11
+ "languageSelect.accessibleLabel": "Pilih Bahasa",
12
+ "menuButton.accessibleLabel": "Menu",
13
+ "sidebarNav.accessibleLabel": "Utama",
14
+ "tableOfContents.onThisPage": "Di halaman ini",
15
+ "tableOfContents.overview": "Selayang Pandang",
16
+ "i18n.untranslatedContent": "Konten ini belum tersedia dalam bahasa Anda.",
17
+ "page.editLink": "Edit halaman",
18
+ "page.lastUpdated": "Terakhir diperbaharui:",
19
+ "page.previousLink": "Sebelumnya",
20
+ "page.nextLink": "Selanjutnya",
21
+ "404.text": "Halaman tidak ditemukan. Cek kembali kolom URL atau gunakan fitur pencarian."
22
+ }
@@ -7,6 +7,8 @@ import ja from './ja.json';
7
7
  import pt from './pt.json';
8
8
  import fa from './fa.json';
9
9
  import fr from './fr.json';
10
+ import he from './he.json';
11
+ import id from './id.json';
10
12
  import it from './it.json';
11
13
  import nl from './nl.json';
12
14
  import da from './da.json';
@@ -21,7 +23,26 @@ import ru from './ru.json';
21
23
  const { parse } = builtinI18nSchema();
22
24
 
23
25
  export default Object.fromEntries(
24
- Object.entries({ cs, en, es, de, ja, pt, fa, fr, it, nl, da, tr, ar, nb, zh, ko, sv, ru }).map(
25
- ([key, dict]) => [key, parse(dict)]
26
- )
26
+ Object.entries({
27
+ cs,
28
+ en,
29
+ es,
30
+ de,
31
+ ja,
32
+ pt,
33
+ fa,
34
+ fr,
35
+ he,
36
+ id,
37
+ it,
38
+ nl,
39
+ da,
40
+ tr,
41
+ ar,
42
+ nb,
43
+ zh,
44
+ ko,
45
+ sv,
46
+ ru,
47
+ }).map(([key, dict]) => [key, parse(dict)])
27
48
  );
@@ -16,7 +16,7 @@
16
16
  "i18n.untranslatedContent": "Deze inhoud is nog niet vertaald.",
17
17
  "page.editLink": "Bewerk pagina",
18
18
  "page.lastUpdated": "Laatst bewerkt:",
19
- "page.previousLink": "Laatste",
19
+ "page.previousLink": "Vorige",
20
20
  "page.nextLink": "Volgende",
21
21
  "404.text": "Pagina niet gevonden. Controleer de URL of probeer de zoekbalk."
22
22
  }
package/utils/routing.ts CHANGED
@@ -35,10 +35,12 @@ interface Path extends GetStaticPathsItem {
35
35
  const normalizeIndexSlug = (slug: string) => (slug === 'index' ? '' : slug);
36
36
 
37
37
  /** All entries in the docs content collection. */
38
- const docs: StarlightDocsEntry[] = (await getCollection('docs')).map(({ slug, ...entry }) => ({
39
- ...entry,
40
- slug: normalizeIndexSlug(slug),
41
- }));
38
+ const docs: StarlightDocsEntry[] = ((await getCollection('docs')) ?? []).map(
39
+ ({ slug, ...entry }) => ({
40
+ ...entry,
41
+ slug: normalizeIndexSlug(slug),
42
+ })
43
+ );
42
44
 
43
45
  function getRoutes(): Route[] {
44
46
  const routes: Route[] = docs.map((entry) => ({
package/virtual.d.ts CHANGED
@@ -3,7 +3,7 @@ declare module 'virtual:starlight/user-config' {
3
3
  export default Config;
4
4
  }
5
5
  declare module 'virtual:starlight/project-context' {
6
- export default { root: string };
6
+ export default { root: string, srcDir: string };
7
7
  }
8
8
 
9
9
  declare module 'virtual:starlight/user-css' {}