starlight-theme-nova 0.9.0 → 0.9.2

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "starlight-theme-nova",
3
3
  "type": "module",
4
- "version": "0.9.0",
4
+ "version": "0.9.2",
5
5
  "description": "",
6
6
  "author": "ocavue <ocavue@gmail.com>",
7
7
  "license": "MIT",
@@ -28,9 +28,9 @@
28
28
  "dependencies": {
29
29
  "@aria-ui/core": "^0.0.21",
30
30
  "@pagefind/default-ui": "^1.3.0",
31
- "@shikijs/transformers": "^3.6.0",
32
- "@shikijs/twoslash": "^3.6.0",
33
- "@shikijs/types": "^3.6.0",
31
+ "@shikijs/transformers": "^3.9.1",
32
+ "@shikijs/twoslash": "^3.9.1",
33
+ "@shikijs/types": "^3.9.1",
34
34
  "@types/hast": "^3.0.4",
35
35
  "astro-theme-toggle": "^0.6.1",
36
36
  "hast-util-is-element": "^3.0.0",
@@ -47,17 +47,17 @@
47
47
  }
48
48
  },
49
49
  "devDependencies": {
50
- "@astrojs/starlight": "^0.34.4",
50
+ "@astrojs/starlight": "^0.35.2",
51
51
  "@iconify-json/bxl": "^1.2.2",
52
- "@iconify-json/logos": "^1.2.4",
53
- "@iconify-json/lucide": "^1.2.49",
54
- "@iconify-json/tabler": "^1.2.19",
52
+ "@iconify-json/logos": "^1.2.5",
53
+ "@iconify-json/lucide": "^1.2.59",
54
+ "@iconify-json/tabler": "^1.2.20",
55
55
  "@ocavue/tsconfig": "^0.3.7",
56
56
  "@types/node": "^20.17.30",
57
- "@unocss/cli": "^66.1.2",
58
- "astro": "^5.9.3",
57
+ "@unocss/cli": "^66.3.2",
58
+ "astro": "^5.12.7",
59
59
  "typescript": "^5.8.3",
60
- "unocss": "^66.1.2",
60
+ "unocss": "^66.3.2",
61
61
  "unocss-preset-animations": "^1.2.1"
62
62
  },
63
63
  "scripts": {
@@ -11,6 +11,28 @@ import options from 'virtual:starlight-theme-nova/user-config'
11
11
  import MobileMenuToggle from './MobileMenuToggle.astro'
12
12
 
13
13
  const nav = options.nav ?? []
14
+
15
+ const { locale } = Astro.locals.starlightRoute
16
+
17
+ const getLocalizedValue = (
18
+ value: string | { [local: string]: string },
19
+ ): string => {
20
+ if (typeof value === 'string') {
21
+ return value
22
+ }
23
+
24
+ if (typeof locale === 'string' && value[locale]) {
25
+ return value[locale]
26
+ }
27
+
28
+ // Use the same "root" convention as the Starlight docs to get the default value.
29
+ // https://github.com/withastro/starlight/blob/9d3ba179c5d524c1c61d771ceb1a7b4e754bee16/docs/src/content/docs/guides/i18n.mdx?plain=1#L72-L75
30
+ if (value['root']) {
31
+ return value['root']
32
+ }
33
+
34
+ return Object.values(value)[0] ?? ''
35
+ }
14
36
  ---
15
37
 
16
38
  <div class="nova-header">
@@ -20,8 +42,8 @@ const nav = options.nav ?? []
20
42
  <nav class="nova-header-nav">
21
43
  {
22
44
  nav.map((item) => (
23
- <a class="nova-header-nav-link" href={item.href}>
24
- {item.label}
45
+ <a class="nova-header-nav-link" href={getLocalizedValue(item.href)}>
46
+ {getLocalizedValue(item.label)}
25
47
  </a>
26
48
  ))
27
49
  }
@@ -41,7 +41,7 @@ const { hasSidebar } = Astro.locals.starlightRoute
41
41
  .sidebar-content {
42
42
  height: 100%;
43
43
  min-height: max-content;
44
- padding: 1rem var(--sl-sidebar-pad-x) 0;
44
+ padding: 1rem var(--sl-sidebar-pad-x) 1rem;
45
45
  flex-direction: column;
46
46
  gap: 1rem;
47
47
  }
@@ -1,6 +1,6 @@
1
1
  export interface NavItem {
2
- label: string
3
- href: string
2
+ label: string | Record<string, string>
3
+ href: string | Record<string, string>
4
4
  }
5
5
 
6
6
  export interface ThemeNovaOptions {