Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: withastro/starlight
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: @astrojs/starlight@0.25.3
Choose a base ref
...
head repository: withastro/starlight
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: @astrojs/starlight@0.25.4
Choose a head ref
  • 5 commits
  • 9 files changed
  • 4 contributors

Commits on Jul 31, 2024

  1. docs: Add CodeSweetly to showcase (#2160)

    oluwatobiss authored Jul 31, 2024
    Copy the full SHA
    91d4809 View commit details

Commits on Aug 5, 2024

  1. Improve page load performance (#2155)

    delucis authored Aug 5, 2024
    Copy the full SHA
    8bed886 View commit details
  2. Update dependencies (#2166)

    delucis authored Aug 5, 2024
    Copy the full SHA
    4f12049 View commit details

Commits on Aug 6, 2024

  1. Define well-known RTL locales before calling getLocaleInfo() for de…

    …fault locale (#2167)
    delucis authored Aug 6, 2024
    Copy the full SHA
    9ac7725 View commit details
  2. [ci] release (#2165)

    Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
    astrobot-houston and github-actions[bot] authored Aug 6, 2024
    Copy the full SHA
    41506e5 View commit details
Binary file added docs/src/assets/showcase/codesweetly.com.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/src/components/showcase-sites.astro
Original file line number Diff line number Diff line change
@@ -156,4 +156,5 @@ import FluidGrid from './fluid-grid.astro';
href="https://styledictionary.com/"
thumbnail="styledictionary.com.png"
/>
<Card title="CodeSweetly" href="https://codesweetly.com/" thumbnail="codesweetly.com.png" />
</FluidGrid>
2 changes: 1 addition & 1 deletion examples/basics/package.json
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/starlight": "^0.25.3",
"@astrojs/starlight": "^0.25.4",
"astro": "^4.10.2",
"sharp": "^0.32.5"
}
2 changes: 1 addition & 1 deletion examples/tailwind/package.json
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/starlight": "^0.25.3",
"@astrojs/starlight": "^0.25.4",
"@astrojs/starlight-tailwind": "^2.0.3",
"@astrojs/tailwind": "^5.1.0",
"astro": "^4.10.2",
10 changes: 10 additions & 0 deletions packages/starlight/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# @astrojs/starlight

## 0.25.4

### Patch Changes

- [#2155](https://github.com/withastro/starlight/pull/2155) [`8bed886`](https://github.com/withastro/starlight/commit/8bed88674c732040cf66d392372386a8917a2eeb) Thanks [@delucis](https://github.com/delucis)! - Improves page load performance on slower devices

- [#2167](https://github.com/withastro/starlight/pull/2167) [`9ac7725`](https://github.com/withastro/starlight/commit/9ac7725dbe84f3fab9b191452471d8eaffd55048) Thanks [@delucis](https://github.com/delucis)! - Fixes an issue detecting the built-in locale when running Starlight in a web container environment on Firefox

- [#2166](https://github.com/withastro/starlight/pull/2166) [`4f12049`](https://github.com/withastro/starlight/commit/4f120490e914fb308e909b97890a11bb95ae964c) Thanks [@delucis](https://github.com/delucis)! - Updates `@astrojs/mdx`, `@astrojs/sitemap`, `astro-expressive-code`, `unified`, and `vfile` dependencies to the latest version

## 0.25.3

### Patch Changes
15 changes: 10 additions & 5 deletions packages/starlight/components/TableOfContents/starlight-toc.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PAGE_TITLE_ID } from '../../constants';

export class StarlightTOC extends HTMLElement {
private _current = this.querySelector('a[aria-current="true"]') as HTMLAnchorElement | null;
private _current = this.querySelector<HTMLAnchorElement>('a[aria-current="true"]');
private minH = parseInt(this.dataset.minH || '2', 10);
private maxH = parseInt(this.dataset.maxH || '3', 10);

@@ -12,9 +12,15 @@ export class StarlightTOC extends HTMLElement {
this._current = link;
}

private onIdle = (cb: IdleRequestCallback) =>
(window.requestIdleCallback || ((cb) => setTimeout(cb, 1)))(cb);

constructor() {
super();
this.onIdle(() => this.init());
}

private init = (): void => {
/** All the links in the table of contents. */
const links = [...this.querySelectorAll('a')];

@@ -73,21 +79,20 @@ export class StarlightTOC extends HTMLElement {

let observer: IntersectionObserver | undefined;
const observe = () => {
if (observer) observer.disconnect();
if (observer) return;
observer = new IntersectionObserver(setCurrent, { rootMargin: this.getRootMargin() });
toObserve.forEach((h) => observer!.observe(h));
};
observe();

const onIdle = window.requestIdleCallback || ((cb) => setTimeout(cb, 1));
let timeout: NodeJS.Timeout;
window.addEventListener('resize', () => {
// Disable intersection observer while window is resizing.
if (observer) observer.disconnect();
clearTimeout(timeout);
timeout = setTimeout(() => onIdle(observe), 200);
timeout = setTimeout(() => this.onIdle(observe), 200);
});
}
};

private getRootMargin(): `-${number}px 0% ${number}px` {
const navBarHeight = document.querySelector('header')?.getBoundingClientRect().height || 0;
12 changes: 6 additions & 6 deletions packages/starlight/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@astrojs/starlight",
"version": "0.25.3",
"version": "0.25.4",
"description": "Build beautiful, high-performance documentation websites with Astro",
"scripts": {
"test": "vitest",
@@ -187,12 +187,12 @@
"vitest": "^1.6.0"
},
"dependencies": {
"@astrojs/mdx": "^3.1.0",
"@astrojs/sitemap": "^3.1.5",
"@astrojs/mdx": "^3.1.3",
"@astrojs/sitemap": "^3.1.6",
"@pagefind/default-ui": "^1.0.3",
"@types/hast": "^3.0.4",
"@types/mdast": "^4.0.4",
"astro-expressive-code": "^0.35.3",
"astro-expressive-code": "^0.35.6",
"bcp-47": "^2.1.0",
"hast-util-from-html": "^2.0.1",
"hast-util-select": "^6.0.2",
@@ -205,8 +205,8 @@
"rehype": "^13.0.1",
"rehype-format": "^5.0.0",
"remark-directive": "^3.0.0",
"unified": "^11.0.4",
"unified": "^11.0.5",
"unist-util-visit": "^5.0.0",
"vfile": "^6.0.1"
"vfile": "^6.0.2"
}
}
6 changes: 3 additions & 3 deletions packages/starlight/utils/i18n.ts
Original file line number Diff line number Diff line change
@@ -2,9 +2,6 @@ import type { AstroConfig } from 'astro';
import { AstroError } from 'astro/errors';
import type { StarlightConfig } from './user-config';

/** Informations about the built-in default locale used as a fallback when no locales are defined. */
export const BuiltInDefaultLocale = { ...getLocaleInfo('en'), lang: 'en' };

/**
* A list of well-known right-to-left languages used as a fallback when determining the text
* direction of a locale is not supported by the `Intl.Locale` API in the current environment.
@@ -14,6 +11,9 @@ export const BuiltInDefaultLocale = { ...getLocaleInfo('en'), lang: 'en' };
*/
const wellKnownRTL = ['ar', 'fa', 'he', 'prs', 'ps', 'syc', 'ug', 'ur'];

/** Informations about the built-in default locale used as a fallback when no locales are defined. */
export const BuiltInDefaultLocale = { ...getLocaleInfo('en'), lang: 'en' };

/**
* Processes the Astro and Starlight i18n configurations to generate/update them accordingly:
*
Loading