@astrojs/starlight 0.31.0 → 0.31.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 +6 -0
- package/components/ContentNotice.astro +2 -2
- package/components/Icons.ts +2 -0
- package/package.json +3 -3
- package/schemas/hero.ts +2 -3
- package/types.ts +1 -0
- package/user-components/Card.astro +2 -2
- package/user-components/Icon.astro +2 -2
- package/user-components/LinkButton.astro +2 -2
- package/user-components/TabItem.astro +2 -2
- package/user-components/rehype-file-tree.ts +2 -2
- package/user-components/rehype-tabs.ts +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @astrojs/starlight
|
|
2
2
|
|
|
3
|
+
## 0.31.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#2805](https://github.com/withastro/starlight/pull/2805) [`ed6f9fd`](https://github.com/withastro/starlight/commit/ed6f9fd77334c02a75240087d0800ef32f159583) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Exposes the [`StarlightIcon`](https://starlight.astro.build/reference/icons/#starlighticon-type) TypeScript type referencing the names of Starlight’s built-in icons.
|
|
8
|
+
|
|
3
9
|
## 0.31.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/components/Icons.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/starlight",
|
|
3
|
-
"version": "0.31.
|
|
3
|
+
"version": "0.31.1",
|
|
4
4
|
"description": "Build beautiful, high-performance documentation websites with Astro",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -178,10 +178,10 @@
|
|
|
178
178
|
"@astrojs/markdown-remark": "^6.0.1",
|
|
179
179
|
"@playwright/test": "^1.45.0",
|
|
180
180
|
"@types/node": "^18.16.19",
|
|
181
|
-
"@vitest/coverage-v8": "
|
|
181
|
+
"@vitest/coverage-v8": "^3.0.1",
|
|
182
182
|
"astro": "^5.1.5",
|
|
183
183
|
"linkedom": "^0.18.4",
|
|
184
|
-
"vitest": "
|
|
184
|
+
"vitest": "^3.0.1"
|
|
185
185
|
},
|
|
186
186
|
"dependencies": {
|
|
187
187
|
"@astrojs/mdx": "^4.0.5",
|
package/schemas/hero.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { z } from 'astro/zod';
|
|
2
2
|
import type { SchemaContext } from 'astro:content';
|
|
3
|
-
import { Icons } from '../components/Icons';
|
|
3
|
+
import { Icons, type StarlightIcon } from '../components/Icons';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
const iconNames = Object.keys(Icons) as [IconName, ...IconName[]];
|
|
5
|
+
const iconNames = Object.keys(Icons) as [StarlightIcon, ...StarlightIcon[]];
|
|
7
6
|
|
|
8
7
|
export const HeroSchema = ({ image }: SchemaContext) =>
|
|
9
8
|
z.object({
|
package/types.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { HTMLAttributes } from 'astro/types';
|
|
3
|
-
import {
|
|
3
|
+
import type { StarlightIcon } from '../components/Icons';
|
|
4
4
|
import Icon from './Icon.astro';
|
|
5
5
|
|
|
6
6
|
interface Props extends Omit<HTMLAttributes<'a'>, 'href'> {
|
|
7
7
|
href: string | URL;
|
|
8
|
-
icon?:
|
|
8
|
+
icon?: StarlightIcon | undefined;
|
|
9
9
|
iconPlacement?: 'start' | 'end' | undefined;
|
|
10
10
|
variant?: 'primary' | 'secondary' | 'minimal';
|
|
11
11
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
import { TabItemTagname } from './rehype-tabs';
|
|
3
|
-
import type {
|
|
3
|
+
import type { StarlightIcon } from '../components/Icons';
|
|
4
4
|
|
|
5
5
|
interface Props {
|
|
6
|
-
icon?:
|
|
6
|
+
icon?: StarlightIcon;
|
|
7
7
|
label: string;
|
|
8
8
|
}
|
|
9
9
|
|
|
@@ -6,7 +6,7 @@ import { fromHtml } from 'hast-util-from-html';
|
|
|
6
6
|
import { toString } from 'hast-util-to-string';
|
|
7
7
|
import { rehype } from 'rehype';
|
|
8
8
|
import { CONTINUE, SKIP, visit } from 'unist-util-visit';
|
|
9
|
-
import { Icons } from '../components/Icons';
|
|
9
|
+
import { Icons, type StarlightIcon } from '../components/Icons';
|
|
10
10
|
import { definitions } from './file-tree-icons';
|
|
11
11
|
|
|
12
12
|
declare module 'vfile' {
|
|
@@ -160,7 +160,7 @@ function getFileIcon(fileName: string) {
|
|
|
160
160
|
const name = getFileIconName(fileName);
|
|
161
161
|
if (!name) return defaultFileIcon;
|
|
162
162
|
if (name in Icons) {
|
|
163
|
-
const path = Icons[name as
|
|
163
|
+
const path = Icons[name as StarlightIcon];
|
|
164
164
|
return makeSVGIcon(path);
|
|
165
165
|
}
|
|
166
166
|
return defaultFileIcon;
|
|
@@ -2,13 +2,13 @@ import type { Element } from 'hast';
|
|
|
2
2
|
import { select } from 'hast-util-select';
|
|
3
3
|
import { rehype } from 'rehype';
|
|
4
4
|
import { CONTINUE, SKIP, visit } from 'unist-util-visit';
|
|
5
|
-
import {
|
|
5
|
+
import type { StarlightIcon } from '../components/Icons';
|
|
6
6
|
|
|
7
7
|
interface Panel {
|
|
8
8
|
panelId: string;
|
|
9
9
|
tabId: string;
|
|
10
10
|
label: string;
|
|
11
|
-
icon?:
|
|
11
|
+
icon?: StarlightIcon;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
declare module 'vfile' {
|
|
@@ -67,7 +67,7 @@ const tabsProcessor = rehype()
|
|
|
67
67
|
...ids,
|
|
68
68
|
label: String(dataLabel),
|
|
69
69
|
};
|
|
70
|
-
if (dataIcon) panel.icon = String(dataIcon) as
|
|
70
|
+
if (dataIcon) panel.icon = String(dataIcon) as StarlightIcon;
|
|
71
71
|
file.data.panels?.push(panel);
|
|
72
72
|
|
|
73
73
|
// Remove `<TabItem>` props
|