@astrojs/starlight 0.1.1 → 0.1.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/404.astro CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  import config from 'virtual:starlight/user-config';
3
- import { withBase } from './utils/base';
3
+ import { pathWithBase } from './utils/base';
4
4
 
5
5
  // Built-in CSS styles.
6
6
  import './style/props.css';
@@ -40,7 +40,7 @@ const { lang = 'en', dir = 'ltr', locale } = config.defaultLocale || {};
40
40
  <p>Houston, we have a problem.</p>
41
41
  <p>
42
42
  We couldn’t find that link. Check the address or
43
- <a href={withBase('/')}>head back home</a>.
43
+ <a href={pathWithBase('/')}>head back home</a>.
44
44
  </p>
45
45
  </MarkdownContent>
46
46
  </main>
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @astrojs/starlight
2
2
 
3
+ ## 0.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#174](https://github.com/withastro/starlight/pull/174) [`6ab31b4`](https://github.com/withastro/starlight/commit/6ab31b4900166f952c1ca5ec4e4a1ef66f31be97) Thanks [@rviscomi](https://github.com/rviscomi)! - Split `withBase` URL helper to fix use with files.
8
+
9
+ - [#168](https://github.com/withastro/starlight/pull/168) [`cb18eef`](https://github.com/withastro/starlight/commit/cb18eef4fda8227a6c5ec73589526dd7fbb8f4a6) Thanks [@BryceRussell](https://github.com/BryceRussell)! - Fix bottom padding on left sidebar
10
+
11
+ - [#167](https://github.com/withastro/starlight/pull/167) [`990ec53`](https://github.com/withastro/starlight/commit/990ec53dee099fdb6d113a3be5ef375c73e6945a) Thanks [@BryceRussell](https://github.com/BryceRussell)! - Add `bundlePath` option to Pagefind configuration
12
+
13
+ - [`4f666ba`](https://github.com/withastro/starlight/commit/4f666ba4fad7118a31bae819eb6be068da9e4d94) Thanks [@delucis](https://github.com/delucis)! - Fix focus outline positioning in tabs
14
+
3
15
  ## 0.1.1
4
16
 
5
17
  ### Patch Changes
@@ -4,7 +4,7 @@ import config from 'virtual:starlight/user-config';
4
4
  import type { HeadConfigSchema } from '../schemas/head';
5
5
  import { createHead } from '../utils/head';
6
6
  import { localizedUrl } from '../utils/localizedUrl';
7
- import { withBase } from '../utils/base';
7
+ import { fileWithBase } from '../utils/base';
8
8
 
9
9
  interface Props {
10
10
  data: CollectionEntry<'docs'>['data'];
@@ -33,7 +33,7 @@ const headDefaults: z.input<ReturnType<typeof HeadConfigSchema>> = [
33
33
  tag: 'link',
34
34
  attrs: {
35
35
  rel: 'shortcut icon',
36
- href: withBase('/favicon.svg'),
36
+ href: fileWithBase('/favicon.svg'),
37
37
  type: 'image/svg+xml',
38
38
  },
39
39
  },
@@ -81,7 +81,7 @@ if (Astro.site) {
81
81
  tag: 'link',
82
82
  attrs: {
83
83
  rel: 'sitemap',
84
- href: withBase('/sitemap-index.xml'),
84
+ href: fileWithBase('/sitemap-index.xml'),
85
85
  },
86
86
  });
87
87
  }
@@ -108,6 +108,7 @@ const t = useTranslations(Astro.props.locale);
108
108
  new PagefindUI({
109
109
  element: '#starlight__search',
110
110
  baseUrl: import.meta.env.BASE_URL,
111
+ bundlePath: import.meta.env.BASE_URL.replace(/\/$/, '') + '/_pagefind/',
111
112
  showImages: false,
112
113
  });
113
114
  });
@@ -28,6 +28,10 @@ const { sidebar, locale } = Astro.props;
28
28
  gap: 1rem;
29
29
  }
30
30
 
31
+ .sidebar > :global(:last-child) {
32
+ padding-bottom: 1rem;
33
+ }
34
+
31
35
  .mobile-preferences {
32
36
  justify-content: space-between;
33
37
  border-top: 1px solid var(--sl-color-gray-6);
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  import { logos } from 'virtual:starlight/user-images';
3
3
  import config from 'virtual:starlight/user-config';
4
- import { withBase } from '../utils/base';
4
+ import { pathWithBase } from '../utils/base';
5
5
 
6
6
  interface Props {
7
7
  locale: string | undefined;
@@ -23,7 +23,7 @@ if (config.logo) {
23
23
  if (err) throw new Error(err);
24
24
  }
25
25
 
26
- const href = withBase(Astro.props.locale || '/');
26
+ const href = pathWithBase(Astro.props.locale || '/');
27
27
  ---
28
28
 
29
29
  <a {href} class="site-title flex">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrojs/starlight",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Build beautiful, high-performance documentation websites with Astro",
5
5
  "keywords": [
6
6
  "docs",
@@ -58,6 +58,7 @@ const { html, panels } = processPanels(panelHtml);
58
58
  text-decoration: none;
59
59
  border-bottom: 2px solid var(--sl-color-gray-5);
60
60
  color: var(--sl-color-gray-3);
61
+ outline-offset: var(--sl-outline-offset-inside);
61
62
  }
62
63
  .tab [role='tab'][aria-selected] {
63
64
  color: var(--sl-color-white);
package/utils/base.ts CHANGED
@@ -1,11 +1,17 @@
1
1
  const base = stripTrailingSlash(import.meta.env.BASE_URL);
2
2
 
3
3
  /** Get the a root-relative URL path with the site’s `base` prefixed. */
4
- export function withBase(path: string) {
4
+ export function pathWithBase(path: string) {
5
5
  path = stripLeadingSlash(stripTrailingSlash(path));
6
6
  return path ? base + '/' + path + '/' : base + '/';
7
7
  }
8
8
 
9
+ /** Get the a root-relative file URL path with the site’s `base` prefixed. */
10
+ export function fileWithBase(path: string) {
11
+ path = stripLeadingSlash(stripTrailingSlash(path));
12
+ return path ? base + '/' + path : base;
13
+ }
14
+
9
15
  function stripLeadingSlash(path: string) {
10
16
  return path.replace(/^\//, '');
11
17
  }
@@ -1,6 +1,6 @@
1
1
  import { basename, dirname } from 'node:path';
2
2
  import config from 'virtual:starlight/user-config';
3
- import { withBase } from './base';
3
+ import { pathWithBase } from './base';
4
4
  import { pickLang } from './i18n';
5
5
  import { Route, getLocaleRoutes, routes } from './routing';
6
6
  import { localeToLang, slugToPathname } from './slugs';
@@ -109,7 +109,7 @@ function linkFromConfig(
109
109
 
110
110
  /** Create a link entry. */
111
111
  function makeLink(href: string, label: string, currentPathname: string): Link {
112
- if (!isAbsolute(href)) href = withBase(href);
112
+ if (!isAbsolute(href)) href = pathWithBase(href);
113
113
  const isCurrent = href === currentPathname;
114
114
  return { type: 'link', label, href, isCurrent };
115
115
  }