@astrojs/starlight 0.22.0 → 0.22.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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @astrojs/starlight
2
2
 
3
+ ## 0.22.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1811](https://github.com/withastro/starlight/pull/1811) [`fe06aa13`](https://github.com/withastro/starlight/commit/fe06aa1307208ef9f5b249181ec29837f96940c2) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Fixes a `<Tabs>` sync issue when inconsistently using the `icon` prop or not on `<TabItem>` components.
8
+
9
+ - [#1826](https://github.com/withastro/starlight/pull/1826) [`52ea7381`](https://github.com/withastro/starlight/commit/52ea7381e131338a03cffb3499ba1699951cea1e) Thanks [@dragomano](https://github.com/dragomano)! - Updates Russian UI translations
10
+
11
+ ## 0.22.1
12
+
13
+ ### Patch Changes
14
+
15
+ - [`1c0fc384`](https://github.com/withastro/starlight/commit/1c0fc3849771713d5a3e7a572bdbf1483ae5551b) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Fixes an issue where the `siteTitle` property would not be set when using the `<StarlightPage />` component.
16
+
3
17
  ## 0.22.0
4
18
 
5
19
  ### Minor Changes
@@ -6,9 +6,9 @@ case `uname` in
6
6
  esac
7
7
 
8
8
  if [ -z "$NODE_PATH" ]; then
9
- export NODE_PATH="/home/runner/work/starlight/starlight/node_modules/.pnpm/astro@4.3.5_@types+node@18.16.19/node_modules/astro/node_modules:/home/runner/work/starlight/starlight/node_modules/.pnpm/astro@4.3.5_@types+node@18.16.19/node_modules:/home/runner/work/starlight/starlight/node_modules/.pnpm/node_modules"
9
+ export NODE_PATH="/home/runner/work/starlight/starlight/node_modules/.pnpm/astro@4.3.5_@types+node@18.16.19_typescript@5.4.5/node_modules/astro/node_modules:/home/runner/work/starlight/starlight/node_modules/.pnpm/astro@4.3.5_@types+node@18.16.19_typescript@5.4.5/node_modules:/home/runner/work/starlight/starlight/node_modules/.pnpm/node_modules"
10
10
  else
11
- export NODE_PATH="/home/runner/work/starlight/starlight/node_modules/.pnpm/astro@4.3.5_@types+node@18.16.19/node_modules/astro/node_modules:/home/runner/work/starlight/starlight/node_modules/.pnpm/astro@4.3.5_@types+node@18.16.19/node_modules:/home/runner/work/starlight/starlight/node_modules/.pnpm/node_modules:$NODE_PATH"
11
+ export NODE_PATH="/home/runner/work/starlight/starlight/node_modules/.pnpm/astro@4.3.5_@types+node@18.16.19_typescript@5.4.5/node_modules/astro/node_modules:/home/runner/work/starlight/starlight/node_modules/.pnpm/astro@4.3.5_@types+node@18.16.19_typescript@5.4.5/node_modules:/home/runner/work/starlight/starlight/node_modules/.pnpm/node_modules:$NODE_PATH"
12
12
  fi
13
13
  if [ -x "$basedir/node" ]; then
14
14
  exec "$basedir/node" "$basedir/../astro/astro.js" "$@"
@@ -35,3 +35,20 @@ A set of tabs using the `style` sync key.
35
35
  <TabItem label="css">css code</TabItem>
36
36
  <TabItem label="tailwind">tailwind code</TabItem>
37
37
  </Tabs>
38
+
39
+ Another set of tabs using the `pkg` sync key and using icons.
40
+
41
+ <Tabs syncKey="pkg">
42
+ <TabItem label="npm" icon="seti:npm">
43
+ another npm command
44
+ </TabItem>
45
+ <TabItem label="pnpm" icon="pnpm">
46
+ another pnpm command
47
+ </TabItem>
48
+ <TabItem label="bun" icon="bun">
49
+ another bun command
50
+ </TabItem>
51
+ <TabItem label="yarn" icon="seti:yarn">
52
+ another yarn command
53
+ </TabItem>
54
+ </Tabs>
@@ -116,6 +116,29 @@ test('preserves tabs position when alternating between tabs with different conte
116
116
  expect((await tabs.boundingBox())?.y).toBe(initialBoundingBox?.y);
117
117
  });
118
118
 
119
+ test('syncs tabs with the same sync key if they do not consistenly use icons', async ({
120
+ page,
121
+ starlight,
122
+ }) => {
123
+ await starlight.goto('/tabs');
124
+
125
+ const tabs = page.locator('starlight-tabs');
126
+ const pkgTabsA = tabs.nth(0); // This set does not use icons for tab items.
127
+ const pkgTabsB = tabs.nth(4); // This set uses icons for tab items.
128
+
129
+ // Select the pnpm tab in the first set of synced tabs.
130
+ await pkgTabsA.getByRole('tab').filter({ hasText: 'pnpm' }).click();
131
+
132
+ await expectSelectedTab(pkgTabsA, 'pnpm', 'pnpm command');
133
+ await expectSelectedTab(pkgTabsB, 'pnpm', 'another pnpm command');
134
+
135
+ // Select the yarn tab in the second set of synced tabs.
136
+ await pkgTabsB.getByRole('tab').filter({ hasText: 'yarn' }).click();
137
+
138
+ await expectSelectedTab(pkgTabsB, 'yarn', 'another yarn command');
139
+ await expectSelectedTab(pkgTabsA, 'yarn', 'yarn command');
140
+ });
141
+
119
142
  async function expectSelectedTab(tabs: Locator, label: string, panel: string) {
120
143
  expect((await tabs.getByRole('tab', { selected: true }).textContent())?.trim()).toBe(label);
121
144
  expect((await tabs.getByRole('tabpanel').textContent())?.trim()).toBe(panel);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrojs/starlight",
3
- "version": "0.22.0",
3
+ "version": "0.22.2",
4
4
  "description": "Build beautiful, high-performance documentation websites with Astro",
5
5
  "keywords": [
6
6
  "docs",
@@ -18,10 +18,10 @@
18
18
  "page.lastUpdated": "Последнее обновление:",
19
19
  "page.previousLink": "Предыдущая",
20
20
  "page.nextLink": "Следующая",
21
- "page.draft": "This content is a draft and will not be included in production builds.",
21
+ "page.draft": "Этот контент является черновиком и не будет добавлен в производственные сборки.",
22
22
  "404.text": "Страница не найдена. Проверьте URL или используйте поиск по сайту.",
23
23
  "aside.note": "Заметка",
24
- "aside.tip": "Знали ли вы?",
24
+ "aside.tip": "Совет",
25
25
  "aside.caution": "Осторожно",
26
26
  "aside.danger": "Опасно",
27
27
  "fileTree.directory": "Директория",
@@ -158,7 +158,7 @@ const { html, panels } = processPanels(panelHtml);
158
158
  newTab.setAttribute('aria-selected', 'true');
159
159
  if (shouldSync) {
160
160
  newTab.focus();
161
- StarlightTabs.#syncTabs(this, newTab.textContent);
161
+ StarlightTabs.#syncTabs(this, newTab.innerText);
162
162
  window.scrollTo({
163
163
  top: window.scrollY + (this.getBoundingClientRect().top - previousTabsOffset),
164
164
  });
@@ -173,7 +173,7 @@ const { html, panels } = processPanels(panelHtml);
173
173
 
174
174
  for (const receiver of syncedTabs) {
175
175
  if (receiver === emitter) continue;
176
- const labelIndex = receiver.tabs.findIndex((tab) => tab.textContent === label);
176
+ const labelIndex = receiver.tabs.findIndex((tab) => tab.innerText === label);
177
177
  if (labelIndex === -1) continue;
178
178
  receiver.switchTab(receiver.tabs[labelIndex], labelIndex, false);
179
179
  }
@@ -34,6 +34,7 @@ function formatPath(
34
34
  href: string,
35
35
  { format = 'directory', trailingSlash = 'ignore' }: FormatPathOptions
36
36
  ) {
37
+ // @ts-expect-error — TODO: add support for `preserve` (https://github.com/withastro/starlight/issues/1781)
37
38
  const formatStrategy = formatStrategies[format];
38
39
  const trailingSlashStrategy = trailingSlashStrategies[trailingSlash];
39
40
 
@@ -111,7 +111,7 @@ function getEditUrl({ entry, id, isFallback }: PageProps): URL | undefined {
111
111
  }
112
112
 
113
113
  /** Get the site title for a given language. **/
114
- function getSiteTitle(lang: string): string {
114
+ export function getSiteTitle(lang: string): string {
115
115
  const defaultLang = config.defaultLocale.lang as string;
116
116
  if (lang && config.title[lang]) {
117
117
  return config.title[lang] as string;
@@ -3,7 +3,7 @@ import { type ContentConfig, type SchemaContext } from 'astro:content';
3
3
  import config from 'virtual:starlight/user-config';
4
4
  import { parseWithFriendlyErrors } from './error-map';
5
5
  import { stripLeadingAndTrailingSlashes } from './path';
6
- import { getToC, type PageProps, type StarlightRouteData } from './route-data';
6
+ import { getSiteTitle, getToC, type PageProps, type StarlightRouteData } from './route-data';
7
7
  import type { StarlightDocsEntry } from './routing';
8
8
  import { slugToLocaleData, urlToSlug } from './slugs';
9
9
  import { getPrevNextLinks, getSidebar } from './navigation';
@@ -223,6 +223,7 @@ export async function generateStarlightPageRouteData({
223
223
  lastUpdated,
224
224
  pagination: getPrevNextLinks(sidebar, config.pagination, entry.data),
225
225
  sidebar,
226
+ siteTitle: getSiteTitle(localeData.lang),
226
227
  slug,
227
228
  toc: getToC({
228
229
  ...routeProps,
@@ -256,7 +256,7 @@ export const StarlightConfigSchema = UserConfigSchema.strict().transform(
256
256
  const defaultLocaleConfig = {
257
257
  label: 'English',
258
258
  lang: 'en',
259
- dir: 'ltr',
259
+ dir: 'ltr' as const,
260
260
  locale: undefined,
261
261
  ...locales?.root,
262
262
  };