@astrojs/starlight 0.25.3 → 0.25.4
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 +10 -0
- package/components/TableOfContents/starlight-toc.ts +10 -5
- package/package.json +6 -6
- package/utils/i18n.ts +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @astrojs/starlight
|
|
2
2
|
|
|
3
|
+
## 0.25.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#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
|
|
8
|
+
|
|
9
|
+
- [#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
|
|
10
|
+
|
|
11
|
+
- [#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
|
|
12
|
+
|
|
3
13
|
## 0.25.3
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PAGE_TITLE_ID } from '../../constants';
|
|
2
2
|
|
|
3
3
|
export class StarlightTOC extends HTMLElement {
|
|
4
|
-
private _current = this.querySelector('a[aria-current="true"]')
|
|
4
|
+
private _current = this.querySelector<HTMLAnchorElement>('a[aria-current="true"]');
|
|
5
5
|
private minH = parseInt(this.dataset.minH || '2', 10);
|
|
6
6
|
private maxH = parseInt(this.dataset.maxH || '3', 10);
|
|
7
7
|
|
|
@@ -12,9 +12,15 @@ export class StarlightTOC extends HTMLElement {
|
|
|
12
12
|
this._current = link;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
private onIdle = (cb: IdleRequestCallback) =>
|
|
16
|
+
(window.requestIdleCallback || ((cb) => setTimeout(cb, 1)))(cb);
|
|
17
|
+
|
|
15
18
|
constructor() {
|
|
16
19
|
super();
|
|
20
|
+
this.onIdle(() => this.init());
|
|
21
|
+
}
|
|
17
22
|
|
|
23
|
+
private init = (): void => {
|
|
18
24
|
/** All the links in the table of contents. */
|
|
19
25
|
const links = [...this.querySelectorAll('a')];
|
|
20
26
|
|
|
@@ -73,21 +79,20 @@ export class StarlightTOC extends HTMLElement {
|
|
|
73
79
|
|
|
74
80
|
let observer: IntersectionObserver | undefined;
|
|
75
81
|
const observe = () => {
|
|
76
|
-
if (observer)
|
|
82
|
+
if (observer) return;
|
|
77
83
|
observer = new IntersectionObserver(setCurrent, { rootMargin: this.getRootMargin() });
|
|
78
84
|
toObserve.forEach((h) => observer!.observe(h));
|
|
79
85
|
};
|
|
80
86
|
observe();
|
|
81
87
|
|
|
82
|
-
const onIdle = window.requestIdleCallback || ((cb) => setTimeout(cb, 1));
|
|
83
88
|
let timeout: NodeJS.Timeout;
|
|
84
89
|
window.addEventListener('resize', () => {
|
|
85
90
|
// Disable intersection observer while window is resizing.
|
|
86
91
|
if (observer) observer.disconnect();
|
|
87
92
|
clearTimeout(timeout);
|
|
88
|
-
timeout = setTimeout(() => onIdle(observe), 200);
|
|
93
|
+
timeout = setTimeout(() => this.onIdle(observe), 200);
|
|
89
94
|
});
|
|
90
|
-
}
|
|
95
|
+
};
|
|
91
96
|
|
|
92
97
|
private getRootMargin(): `-${number}px 0% ${number}px` {
|
|
93
98
|
const navBarHeight = document.querySelector('header')?.getBoundingClientRect().height || 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/starlight",
|
|
3
|
-
"version": "0.25.
|
|
3
|
+
"version": "0.25.4",
|
|
4
4
|
"description": "Build beautiful, high-performance documentation websites with Astro",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -182,12 +182,12 @@
|
|
|
182
182
|
"vitest": "^1.6.0"
|
|
183
183
|
},
|
|
184
184
|
"dependencies": {
|
|
185
|
-
"@astrojs/mdx": "^3.1.
|
|
186
|
-
"@astrojs/sitemap": "^3.1.
|
|
185
|
+
"@astrojs/mdx": "^3.1.3",
|
|
186
|
+
"@astrojs/sitemap": "^3.1.6",
|
|
187
187
|
"@pagefind/default-ui": "^1.0.3",
|
|
188
188
|
"@types/hast": "^3.0.4",
|
|
189
189
|
"@types/mdast": "^4.0.4",
|
|
190
|
-
"astro-expressive-code": "^0.35.
|
|
190
|
+
"astro-expressive-code": "^0.35.6",
|
|
191
191
|
"bcp-47": "^2.1.0",
|
|
192
192
|
"hast-util-from-html": "^2.0.1",
|
|
193
193
|
"hast-util-select": "^6.0.2",
|
|
@@ -200,9 +200,9 @@
|
|
|
200
200
|
"rehype": "^13.0.1",
|
|
201
201
|
"rehype-format": "^5.0.0",
|
|
202
202
|
"remark-directive": "^3.0.0",
|
|
203
|
-
"unified": "^11.0.
|
|
203
|
+
"unified": "^11.0.5",
|
|
204
204
|
"unist-util-visit": "^5.0.0",
|
|
205
|
-
"vfile": "^6.0.
|
|
205
|
+
"vfile": "^6.0.2"
|
|
206
206
|
},
|
|
207
207
|
"scripts": {
|
|
208
208
|
"test": "vitest",
|
package/utils/i18n.ts
CHANGED
|
@@ -2,9 +2,6 @@ import type { AstroConfig } from 'astro';
|
|
|
2
2
|
import { AstroError } from 'astro/errors';
|
|
3
3
|
import type { StarlightConfig } from './user-config';
|
|
4
4
|
|
|
5
|
-
/** Informations about the built-in default locale used as a fallback when no locales are defined. */
|
|
6
|
-
export const BuiltInDefaultLocale = { ...getLocaleInfo('en'), lang: 'en' };
|
|
7
|
-
|
|
8
5
|
/**
|
|
9
6
|
* A list of well-known right-to-left languages used as a fallback when determining the text
|
|
10
7
|
* 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' };
|
|
|
14
11
|
*/
|
|
15
12
|
const wellKnownRTL = ['ar', 'fa', 'he', 'prs', 'ps', 'syc', 'ug', 'ur'];
|
|
16
13
|
|
|
14
|
+
/** Informations about the built-in default locale used as a fallback when no locales are defined. */
|
|
15
|
+
export const BuiltInDefaultLocale = { ...getLocaleInfo('en'), lang: 'en' };
|
|
16
|
+
|
|
17
17
|
/**
|
|
18
18
|
* Processes the Astro and Starlight i18n configurations to generate/update them accordingly:
|
|
19
19
|
*
|