@astrojs/starlight 0.24.0 → 0.24.1
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 +12 -0
- package/components/Icons.ts +2 -0
- package/package.json +1 -1
- package/schemas/social.ts +2 -0
- package/translations/ko.json +2 -2
- package/translations/vi.json +1 -1
- package/utils/i18n.ts +27 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @astrojs/starlight
|
|
2
2
|
|
|
3
|
+
## 0.24.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1978](https://github.com/withastro/starlight/pull/1978) [`a5ab8cd6`](https://github.com/withastro/starlight/commit/a5ab8cd6a0095cb48b65b9784054714f87bd7e4d) Thanks [@kylewlacy](https://github.com/kylewlacy)! - Add new social icon for Zulip
|
|
8
|
+
|
|
9
|
+
- [#1962](https://github.com/withastro/starlight/pull/1962) [`2ef19a94`](https://github.com/withastro/starlight/commit/2ef19a947c54c7d2c085bf8820c862737e2ab08b) Thanks [@torn4dom4n](https://github.com/torn4dom4n)! - Updates Vietnamese UI translations
|
|
10
|
+
|
|
11
|
+
- [#1976](https://github.com/withastro/starlight/pull/1976) [`5a61f73c`](https://github.com/withastro/starlight/commit/5a61f73c198a33b27342c9b0371dd5fd22da2190) Thanks [@jsparkdev](https://github.com/jsparkdev)! - Updates Korean UI translations
|
|
12
|
+
|
|
13
|
+
- [#1987](https://github.com/withastro/starlight/pull/1987) [`0b8a8439`](https://github.com/withastro/starlight/commit/0b8a843936bd8506ac228608b07c54a76a7add19) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Fixes issues with the locale text direction detection mechanism in some environments like WebContainers or Bun.
|
|
14
|
+
|
|
3
15
|
## 0.24.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/components/Icons.ts
CHANGED
|
@@ -123,6 +123,8 @@ export const BuiltInIcons = {
|
|
|
123
123
|
'<path d="M12 10.8c-1-2.1-4-6-6.8-8C2.6 1 1.6 1.3.9 1.6.1 1.9 0 3 0 3.8c0 .7.4 5.6.6 6.4C1.4 13 4.3 14 7 13.6h.4H7c-4 .6-7.4 2-2.8 7 5 5.3 6.8-1 7.8-4.2 1 3.2 2 9.3 7.7 4.3 4.3-4.3 1.2-6.5-2.7-7a9 9 0 0 1-.4-.1h.4c2.7.3 5.6-.6 6.4-3.4.2-.8.6-5.7.6-6.4 0-.7-.1-1.9-.9-2.2-.7-.3-1.7-.7-4.3 1.2-2.8 2-5.7 5.9-6.8 8"/>',
|
|
124
124
|
discourse:
|
|
125
125
|
'<path d="M12.102 0h-.081C5.462 0 .13 5.252.001 11.779v.012L.007 24l12.097-.01c6.582-.055 11.897-5.404 11.897-11.995S18.686.056 12.109 0h-.005zM12 18.857h-.015a6.778 6.778 0 0 1-2.94-.666l.041.018-4.345 1.077 1.227-4.018a6.78 6.78 0 0 1-.83-3.27A6.86 6.86 0 1 1 12 18.857z"/>',
|
|
126
|
+
zulip:
|
|
127
|
+
'<path d="M21 19c0 1.7-1.2 3-2.7 3H5.7C4.2 22 3 20.7 3 19a3 3 0 0 1 1.2-2.4l6.7-6c0-.1.3 0 .2.2l-2.5 5s0 .2.2.2h9.5c1.5 0 2.7 1.4 2.7 3Zm0-14a3 3 0 0 1-1.2 2.4l-6.7 6c0 .1-.2 0-.2-.2l2.5-5s0-.2-.2-.2H5.7C4.2 8 3 6.6 3 5c0-1.7 1.2-3 2.7-3h12.6C19.8 2 21 3.3 21 5Z"/>',
|
|
126
128
|
astro:
|
|
127
129
|
'<path d="M7.233 15.856c-.456 1.5-.132 3.586.948 4.57v-.036l.036-.096c.132-.636.648-1.032 1.309-1.008.612.012.96.336 1.044 1.044.036.264.036.528.048.803v.084c0 .6.168 1.176.504 1.68.3.48.72.851 1.284 1.103l-.024-.048-.024-.096c-.42-1.26-.12-2.135.984-2.879l.336-.227.745-.492a3.647 3.647 0 0 0 1.536-2.603c.06-.456 0-.9-.132-1.331l-.18.12c-1.668.887-3.577 1.2-5.425.84-1.117-.169-2.197-.48-3-1.416l.011-.012ZM2 15.592s3.205-1.559 6.421-1.559l2.437-7.508c.084-.36.348-.6.648-.6.3 0 .552.24.648.612l2.425 7.496c3.816 0 6.421 1.56 6.421 1.56L15.539.72c-.144-.444-.42-.72-.768-.72H8.24c-.348 0-.6.276-.768.72L2 15.592Z"/>',
|
|
128
130
|
alpine: '<path d="m18.7 6 5.3 5.3-5.3 5.3-5.4-5.3L18.7 6zM5.3 6l11 11H5.8L0 11.2 5.3 6z"/>',
|
package/package.json
CHANGED
package/schemas/social.ts
CHANGED
|
@@ -31,6 +31,7 @@ export const socialLinks = [
|
|
|
31
31
|
'hackerOne',
|
|
32
32
|
'blueSky',
|
|
33
33
|
'discourse',
|
|
34
|
+
'zulip',
|
|
34
35
|
] as const;
|
|
35
36
|
|
|
36
37
|
export const SocialLinksSchema = () =>
|
|
@@ -77,6 +78,7 @@ export const SocialLinksSchema = () =>
|
|
|
77
78
|
hackerOne: 'Hacker One',
|
|
78
79
|
blueSky: 'BlueSky',
|
|
79
80
|
discourse: 'Discourse',
|
|
81
|
+
zulip: 'Zulip',
|
|
80
82
|
}[key];
|
|
81
83
|
labelledLinks[key] = { label, url };
|
|
82
84
|
}
|
package/translations/ko.json
CHANGED
package/translations/vi.json
CHANGED
package/utils/i18n.ts
CHANGED
|
@@ -5,6 +5,15 @@ import type { StarlightConfig } from './user-config';
|
|
|
5
5
|
/** Informations about the built-in default locale used as a fallback when no locales are defined. */
|
|
6
6
|
export const BuiltInDefaultLocale = { ...getLocaleInfo('en'), lang: 'en' };
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* A list of well-known right-to-left languages used as a fallback when determining the text
|
|
10
|
+
* direction of a locale is not supported by the `Intl.Locale` API in the current environment.
|
|
11
|
+
*
|
|
12
|
+
* @see getLocaleDir()
|
|
13
|
+
* @see https://en.wikipedia.org/wiki/IETF_language_tag#List_of_common_primary_language_subtags
|
|
14
|
+
*/
|
|
15
|
+
const wellKnownRTL = ['ar', 'fa', 'he', 'prs', 'ps', 'syc', 'ug', 'ur'];
|
|
16
|
+
|
|
8
17
|
/**
|
|
9
18
|
* Processes the Astro and Starlight i18n configurations to generate/update them accordingly:
|
|
10
19
|
*
|
|
@@ -150,8 +159,7 @@ function getLocaleInfo(lang: string) {
|
|
|
150
159
|
if (!label || lang === label) throw new Error('Label not found.');
|
|
151
160
|
return {
|
|
152
161
|
label: label[0]?.toLocaleUpperCase(locale) + label.slice(1),
|
|
153
|
-
|
|
154
|
-
dir: locale.textInfo.direction as 'ltr' | 'rtl',
|
|
162
|
+
dir: getLocaleDir(locale),
|
|
155
163
|
};
|
|
156
164
|
} catch (error) {
|
|
157
165
|
throw new AstroError(
|
|
@@ -161,6 +169,23 @@ function getLocaleInfo(lang: string) {
|
|
|
161
169
|
}
|
|
162
170
|
}
|
|
163
171
|
|
|
172
|
+
/**
|
|
173
|
+
* Returns the direction of the passed locale.
|
|
174
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTextInfo
|
|
175
|
+
*/
|
|
176
|
+
function getLocaleDir(locale: Intl.Locale): 'ltr' | 'rtl' {
|
|
177
|
+
if ('textInfo' in locale) {
|
|
178
|
+
// @ts-expect-error - `textInfo` is not typed but is available in v8 based environments.
|
|
179
|
+
return locale.textInfo.direction;
|
|
180
|
+
} else if ('getTextInfo' in locale) {
|
|
181
|
+
// @ts-expect-error - `getTextInfo` is not typed but is available in some non-v8 based environments.
|
|
182
|
+
return locale.getTextInfo().direction;
|
|
183
|
+
}
|
|
184
|
+
// Firefox does not support `textInfo` or `getTextInfo` yet so we fallback to a well-known list
|
|
185
|
+
// of right-to-left languages.
|
|
186
|
+
return wellKnownRTL.includes(locale.language) ? 'rtl' : 'ltr';
|
|
187
|
+
}
|
|
188
|
+
|
|
164
189
|
/**
|
|
165
190
|
* Get the string for the passed language from a dictionary object.
|
|
166
191
|
*
|