@astrojs/starlight 0.7.0 → 0.7.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 +22 -0
- package/components/Footer.astro +3 -0
- package/components/Icons.ts +2 -0
- package/components/SocialIcons.astro +1 -0
- package/components/TableOfContents/MobileTableOfContents.astro +1 -0
- package/components/TableOfContents/TableOfContentsList.astro +1 -1
- package/components/TableOfContents/generateToC.ts +1 -2
- package/layout/TwoColumnContent.astro +4 -0
- package/package.json +2 -2
- package/style/props.css +1 -0
- package/translations/fa.json +22 -0
- package/translations/index.ts +4 -4
- package/user-components/LinkCard.astro +21 -10
- package/utils/navigation.ts +18 -17
- package/utils/user-config.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @astrojs/starlight
|
|
2
2
|
|
|
3
|
+
## 0.7.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#506](https://github.com/withastro/starlight/pull/506) [`5e3133c`](https://github.com/withastro/starlight/commit/5e3133c42232b201b981cf4b3bc1c3dd56b09fa5) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Improve table of content current item highlight behavior
|
|
8
|
+
|
|
9
|
+
- [#499](https://github.com/withastro/starlight/pull/499) [`fcff49e`](https://github.com/withastro/starlight/commit/fcff49ee4260ad68e80833712e161cbb978a2562) Thanks [@D3vil0p3r](https://github.com/D3vil0p3r)! - Add icons for Instagram
|
|
10
|
+
|
|
11
|
+
- [#502](https://github.com/withastro/starlight/pull/502) [`3c87a16`](https://github.com/withastro/starlight/commit/3c87a16de3c867ad89294a0ea84d63eca2e74d7a) Thanks [@Mrahmani71](https://github.com/Mrahmani71)! - Add Farsi UI translations
|
|
12
|
+
|
|
13
|
+
- [#496](https://github.com/withastro/starlight/pull/496) [`cd28392`](https://github.com/withastro/starlight/commit/cd28392ac73ac0ba1a441328fcd1d65d7d441366) Thanks [@lorenzolewis](https://github.com/lorenzolewis)! - Fix `lastUpdated` date position to be consistent
|
|
14
|
+
|
|
15
|
+
- [#402](https://github.com/withastro/starlight/pull/402) [`d8669b8`](https://github.com/withastro/starlight/commit/d8669b869761ac15d1d611eda7dd94a62ce0fd7a) Thanks [@chopfitzroy](https://github.com/chopfitzroy)! - Fix content sometimes appearing above the mobile table of contents.
|
|
16
|
+
|
|
17
|
+
## 0.7.1
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [#488](https://github.com/withastro/starlight/pull/488) [`da35556`](https://github.com/withastro/starlight/commit/da35556eb95f2d397dfce03cc4acfacb0dcf1e89) Thanks [@mayank99](https://github.com/mayank99)! - Improved accessibility of LinkCard by only including the title as part of the link text, and using a pseudo-element to keep the card clickable.
|
|
22
|
+
|
|
23
|
+
- [#489](https://github.com/withastro/starlight/pull/489) [`35cd82e`](https://github.com/withastro/starlight/commit/35cd82e7f8622772a5155add99ad8baf61ae08a1) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Respect `hidden` sidebar frontmatter property when no sidebar configuration is provided
|
|
24
|
+
|
|
3
25
|
## 0.7.0
|
|
4
26
|
|
|
5
27
|
### Minor Changes
|
package/components/Footer.astro
CHANGED
package/components/Icons.ts
CHANGED
|
@@ -82,4 +82,6 @@ export const Icons = {
|
|
|
82
82
|
'<path d="M2.5 1 1 4.8v15.4h5.5V23h3.1l3-2.8H17l6-5.7V1H2.6ZM21 13.5l-3.4 3.3H12l-3 2.8v-2.8H4.5V3H21v10.5Zm-3.4-6.8v5.8h-2V6.7h2Zm-5.5 0v5.8h-2V6.7h2Z"/>',
|
|
83
83
|
microsoftTeams:
|
|
84
84
|
'<path d="M13.78 7.2a3.63 3.63 0 1 0-4.3-3.68h1.78a2.52 2.52 0 0 1 2.52 2.53V7.2zM7.34 18.8h3.92a2.52 2.52 0 0 0 2.52-2.52V8.37h4.17c.58.01 1.04.5 1.03 1.07v6.45a6.3 6.3 0 0 1-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 1.1-.8A5.7 5.7 0 0 1 8 3.9l4-.1h4a5.6 5.6 0 0 1 1.9.4A3 3 0 0 1 19 5a3 3 0 0 1 .7 1.1A5.6 5.6 0 0 1 20 8l.1 4v4ZM12 6.9a5.1 5.1 0 1 0 5.1 5.1A5.1 5.1 0 0 0 12 6.9Zm0 8.4a3.3 3.3 0 1 1 3.3-3.3 3.3 3.3 0 0 1-3.3 3.3Z"/>',
|
|
85
87
|
};
|
|
@@ -14,7 +14,7 @@ const { toc, isMobile = false, depth = 0 } = Astro.props;
|
|
|
14
14
|
{
|
|
15
15
|
toc.map((heading) => (
|
|
16
16
|
<li>
|
|
17
|
-
<a href={'#' + heading.slug}
|
|
17
|
+
<a href={'#' + heading.slug}>
|
|
18
18
|
<span>{heading.text}</span>
|
|
19
19
|
</a>
|
|
20
20
|
{heading.children.length > 0 && (
|
|
@@ -2,7 +2,6 @@ import type { MarkdownHeading } from 'astro';
|
|
|
2
2
|
|
|
3
3
|
export interface TocItem extends MarkdownHeading {
|
|
4
4
|
children: TocItem[];
|
|
5
|
-
current?: boolean;
|
|
6
5
|
}
|
|
7
6
|
|
|
8
7
|
function diveChildren(item: TocItem, depth: number): TocItem[] {
|
|
@@ -34,7 +33,7 @@ export function generateToC(
|
|
|
34
33
|
|
|
35
34
|
for (const heading of headings) {
|
|
36
35
|
if (toc.length === 0) {
|
|
37
|
-
toc.push({ ...heading, children: []
|
|
36
|
+
toc.push({ ...heading, children: [] });
|
|
38
37
|
} else {
|
|
39
38
|
const lastItemInToc = toc.at(-1)!;
|
|
40
39
|
if (heading.depth < lastItemInToc.depth) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/starlight",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "Build beautiful, high-performance documentation websites with Astro",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/node": "^18.16.19",
|
|
35
35
|
"@vitest/coverage-v8": "^0.33.0",
|
|
36
|
-
"astro": "^2.10.
|
|
36
|
+
"astro": "^2.10.5",
|
|
37
37
|
"vitest": "^0.33.0"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
package/style/props.css
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"skipLink.label": "رفتن به محتوا",
|
|
3
|
+
"search.label": "جستجو",
|
|
4
|
+
"search.shortcutLabel": "(برای جستجو / را فشار دهید)",
|
|
5
|
+
"search.cancelLabel": "لغو",
|
|
6
|
+
"search.devWarning": "جستجو تنها در نسخههای تولیدی در دسترس است. \nسعی کنید سایت را بسازید و پیشنمایش آن را به صورت محلی آزمایش کنید.",
|
|
7
|
+
"themeSelect.accessibleLabel": "انتخاب پوسته",
|
|
8
|
+
"themeSelect.dark": "تیره",
|
|
9
|
+
"themeSelect.light": "روشن",
|
|
10
|
+
"themeSelect.auto": "خودکار",
|
|
11
|
+
"languageSelect.accessibleLabel": "انتخاب زبان",
|
|
12
|
+
"menuButton.accessibleLabel": "منو",
|
|
13
|
+
"sidebarNav.accessibleLabel": "اصلی",
|
|
14
|
+
"tableOfContents.onThisPage": "در این صفحه",
|
|
15
|
+
"tableOfContents.overview": "بررسی اجمالی",
|
|
16
|
+
"i18n.untranslatedContent": "این محتوا هنوز به زبان شما در دسترس نیست.",
|
|
17
|
+
"page.editLink": "ویرایش صفحه",
|
|
18
|
+
"page.lastUpdated": "آخرین به روز رسانی:",
|
|
19
|
+
"page.previousLink": "قبلی",
|
|
20
|
+
"page.nextLink": "بعدی",
|
|
21
|
+
"404.text": "صفحه یافت نشد. لطفاً URL را بررسی کنید یا از جستجو استفاده نمایید."
|
|
22
|
+
}
|
package/translations/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ import es from './es.json';
|
|
|
5
5
|
import de from './de.json';
|
|
6
6
|
import ja from './ja.json';
|
|
7
7
|
import pt from './pt.json';
|
|
8
|
+
import fa from './fa.json';
|
|
8
9
|
import fr from './fr.json';
|
|
9
10
|
import it from './it.json';
|
|
10
11
|
import nl from './nl.json';
|
|
@@ -17,8 +18,7 @@ import zh from './zh.json';
|
|
|
17
18
|
const { parse } = builtinI18nSchema();
|
|
18
19
|
|
|
19
20
|
export default Object.fromEntries(
|
|
20
|
-
Object.entries({ cs, en, es, de, ja, pt, fr, it, nl, da, tr, ar, nb, zh }).map(
|
|
21
|
-
key,
|
|
22
|
-
|
|
23
|
-
])
|
|
21
|
+
Object.entries({ cs, en, es, de, ja, pt, fa, fr, it, nl, da, tr, ar, nb, zh }).map(
|
|
22
|
+
([key, dict]) => [key, parse(dict)]
|
|
23
|
+
)
|
|
24
24
|
);
|
|
@@ -11,25 +11,36 @@ const { title, description, ...attributes } = Astro.props;
|
|
|
11
11
|
---
|
|
12
12
|
|
|
13
13
|
<div>
|
|
14
|
-
<
|
|
15
|
-
<
|
|
14
|
+
<span class="flex stack">
|
|
15
|
+
<a {...attributes}>
|
|
16
16
|
<span class="title" set:html={title} />
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
</a>
|
|
18
|
+
{description && <span class="description" set:html={description} />}
|
|
19
|
+
</span>
|
|
20
|
+
<Icon name="right-arrow" size="1.333em" class="icon rtl:flip" />
|
|
21
21
|
</div>
|
|
22
22
|
|
|
23
23
|
<style>
|
|
24
|
-
|
|
24
|
+
div {
|
|
25
25
|
display: grid;
|
|
26
26
|
grid-template-columns: 1fr auto;
|
|
27
27
|
gap: 0.5rem;
|
|
28
28
|
border: 1px solid var(--sl-color-gray-5);
|
|
29
29
|
border-radius: 0.5rem;
|
|
30
30
|
padding: 1rem;
|
|
31
|
-
text-decoration: none;
|
|
32
31
|
box-shadow: var(--sl-shadow-sm);
|
|
32
|
+
position: relative;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
a {
|
|
36
|
+
text-decoration: none;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* a11y fix for https://github.com/withastro/starlight/issues/487 */
|
|
40
|
+
a::before {
|
|
41
|
+
content: '';
|
|
42
|
+
position: absolute;
|
|
43
|
+
inset: 0;
|
|
33
44
|
}
|
|
34
45
|
|
|
35
46
|
.stack {
|
|
@@ -54,12 +65,12 @@ const { title, description, ...attributes } = Astro.props;
|
|
|
54
65
|
}
|
|
55
66
|
|
|
56
67
|
/* Hover state */
|
|
57
|
-
|
|
68
|
+
div:hover {
|
|
58
69
|
background: var(--sl-color-gray-7, var(--sl-color-gray-6));
|
|
59
70
|
border-color: var(--sl-color-gray-2);
|
|
60
71
|
}
|
|
61
72
|
|
|
62
|
-
|
|
73
|
+
div:hover .icon {
|
|
63
74
|
color: var(--sl-color-white);
|
|
64
75
|
}
|
|
65
76
|
</style>
|
package/utils/navigation.ts
CHANGED
|
@@ -83,11 +83,9 @@ function groupFromAutogenerateConfig(
|
|
|
83
83
|
const dirDocs = routes.filter(
|
|
84
84
|
(doc) =>
|
|
85
85
|
// Match against `foo.md` or `foo/index.md`.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
// Remove any entries that should be hidden
|
|
90
|
-
!doc.entry.data.sidebar.hidden
|
|
86
|
+
stripExtension(doc.id) === localeDir ||
|
|
87
|
+
// Match against `foo/anything/else.md`.
|
|
88
|
+
doc.id.startsWith(localeDir + '/')
|
|
91
89
|
);
|
|
92
90
|
const tree = treeify(dirDocs, localeDir);
|
|
93
91
|
return {
|
|
@@ -145,20 +143,23 @@ function getBreadcrumbs(path: string, baseDir: string): string[] {
|
|
|
145
143
|
/** Turn a flat array of routes into a tree structure. */
|
|
146
144
|
function treeify(routes: Route[], baseDir: string): Dir {
|
|
147
145
|
const treeRoot: Dir = makeDir();
|
|
148
|
-
routes
|
|
149
|
-
|
|
146
|
+
routes
|
|
147
|
+
// Remove any entries that should be hidden
|
|
148
|
+
.filter((doc) => !doc.entry.data.sidebar.hidden)
|
|
149
|
+
.forEach((doc) => {
|
|
150
|
+
const breadcrumbs = getBreadcrumbs(doc.id, baseDir);
|
|
150
151
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
152
|
+
// Walk down the route’s path to generate the tree.
|
|
153
|
+
let currentDir = treeRoot;
|
|
154
|
+
breadcrumbs.forEach((dir) => {
|
|
155
|
+
// Create new folder if needed.
|
|
156
|
+
if (typeof currentDir[dir] === 'undefined') currentDir[dir] = makeDir();
|
|
157
|
+
// Go into the subdirectory.
|
|
158
|
+
currentDir = currentDir[dir] as Dir;
|
|
159
|
+
});
|
|
160
|
+
// We’ve walked through the path. Register the route in this directory.
|
|
161
|
+
currentDir[basename(doc.slug)] = doc;
|
|
158
162
|
});
|
|
159
|
-
// We’ve walked through the path. Register the route in this directory.
|
|
160
|
-
currentDir[basename(doc.slug)] = doc;
|
|
161
|
-
});
|
|
162
163
|
return treeRoot;
|
|
163
164
|
}
|
|
164
165
|
|