@astrojs/starlight 0.20.1 → 0.21.0

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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @astrojs/starlight
2
2
 
3
+ ## 0.21.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1568](https://github.com/withastro/starlight/pull/1568) [`5f99a71d`](https://github.com/withastro/starlight/commit/5f99a71ddfe92568b1cd3c0bfe5ebfd139797c1a) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Adds support for optionally setting an icon on a `<TabItem>` component to make it easier to visually distinguish between tabs.
8
+
9
+ - [#1308](https://github.com/withastro/starlight/pull/1308) [`9a918a5b`](https://github.com/withastro/starlight/commit/9a918a5b4902f43729f4d023257772710af3a12b) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Adds `<FileTree>` component to display the structure of a directory.
10
+
11
+ - [#1308](https://github.com/withastro/starlight/pull/1308) [`9a918a5b`](https://github.com/withastro/starlight/commit/9a918a5b4902f43729f4d023257772710af3a12b) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Adds 144 new file-type icons from the [Seti UI icon set](https://github.com/jesseweed/seti-ui#current-icons), available with the `seti:` prefix, e.g. `seti:javascript`.
12
+
13
+ - [#1564](https://github.com/withastro/starlight/pull/1564) [`d880065e`](https://github.com/withastro/starlight/commit/d880065e29a632823a08adcb6158a59fd9557270) Thanks [@delucis](https://github.com/delucis)! - Adds a `<Steps>` component for styling more complex guided tasks.
14
+
15
+ - [#1308](https://github.com/withastro/starlight/pull/1308) [`9a918a5b`](https://github.com/withastro/starlight/commit/9a918a5b4902f43729f4d023257772710af3a12b) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Adds 5 new icons: `astro`, `biome`, `bun`, `mdx`, and `pnpm`.
16
+
3
17
  ## 0.20.1
4
18
 
5
19
  ### Patch Changes
@@ -1,4 +1,6 @@
1
- export const Icons = {
1
+ import { FileIcons } from '../user-components/file-tree-icons';
2
+
3
+ export const BuiltInIcons = {
2
4
  'up-caret':
3
5
  '<path d="m17 13.41-4.29-4.24a.999.999 0 0 0-1.42 0l-4.24 4.24a1 1 0 1 0 1.41 1.42L12 11.29l3.54 3.54a1 1 0 0 0 1.41 0 1 1 0 0 0 .05-1.42Z"/>',
4
6
  'down-caret':
@@ -105,4 +107,16 @@ export const Icons = {
105
107
  '<path d="M22.5 1.5v21h-2.25V24H24V0h-3.75v1.5h2.25ZM7.46 7.95V9.1h.04a3.02 3.02 0 0 1 2.61-1.39c.54 0 1.03.1 1.48.32.44.2.78.58 1.01 1.1.26-.37.6-.7 1.03-.99.44-.28.95-.43 1.55-.43.45 0 .87.06 1.26.17.38.11.71.29.99.53.27.24.49.56.64.95.15.4.23.86.23 1.42v5.72h-2.34v-4.85c0-.29-.01-.56-.04-.8a1.73 1.73 0 0 0-.18-.67 1.1 1.1 0 0 0-.44-.45 1.6 1.6 0 0 0-.78-.16c-.33 0-.6.06-.8.19-.2.12-.37.29-.48.5a2 2 0 0 0-.23.69c-.04.26-.06.52-.06.78v4.77H10.6v-4.8l-.01-.75a2.29 2.29 0 0 0-.14-.69c-.08-.2-.23-.38-.42-.5a1.5 1.5 0 0 0-.85-.2c-.15.01-.3.04-.44.08-.19.06-.37.15-.52.28-.18.14-.32.34-.44.6-.12.26-.18.6-.18 1.02v4.96H5.25V7.94h2.21ZM1.5 1.5v21h2.25V24H0V0h3.75v1.5H1.5Z"/>',
106
108
  openCollective:
107
109
  '<path d="M21.86 5.17a11.94 11.94 0 0 1 0 13.66l-3.1-3.1a7.68 7.68 0 0 0 0-7.46l3.1-3.1Zm-3.03-3.03-3.1 3.1a7.71 7.71 0 1 0 0 13.51l3.1 3.11a12 12 0 1 1 0-19.73Z"/><path d="M21.86 5.17a11.94 11.94 0 0 1 0 13.66l-3.1-3.1a7.68 7.68 0 0 0 0-7.46l3.1-3.1Z"/>',
110
+ astro:
111
+ '<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"/>',
112
+ pnpm: '<path d="M0 0v7.5h7.5V0H0Zm8.25 0v7.5h7.498V0H8.25Zm8.25 0v7.5H24V0h-7.5ZM8.25 8.25v7.5h7.498v-7.5H8.25Zm8.25 0v7.5H24v-7.5h-7.5ZM0 16.5V24h7.5v-7.5H0Zm8.25 0V24h7.498v-7.5H8.25Zm8.25 0V24H24v-7.5h-7.5Z"/>',
113
+ biome:
114
+ '<path d="m12 2-5.346 9.259a12.065 12.065 0 0 1 6.326-.22l1.807.427-1.7 7.208-1.81-.427c-2.223-.524-4.36.644-5.263 2.507l-1.672-.809c1.276-2.636 4.284-4.232 7.363-3.505l.848-3.593A10.213 10.213 0 0 0 0 22.785h24L12 2Z"/>',
115
+ bun: '<path d="M11.966 22.132c6.609 0 11.966-4.326 11.966-9.661 0-3.308-2.051-6.23-5.204-7.963-1.283-.713-2.291-1.353-3.13-1.885C14.018 1.619 13.043 1 11.966 1c-1.094 0-2.327.783-3.955 1.816a49.78 49.78 0 0 1-2.808 1.692C2.051 6.241 0 9.163 0 12.471c0 5.335 5.357 9.661 11.966 9.661Zm-1.397-17.83a5.885 5.885 0 0 0 .497-2.403c0-.144.201-.186.229-.028.656 2.775-.9 4.15-2.051 4.61-.124.048-.199-.12-.103-.208a5.747 5.747 0 0 0 1.428-1.971Zm2.052-.102a5.795 5.795 0 0 0-.78-2.3v-.015c-.068-.123.086-.263.185-.172 1.956 2.105 1.303 4.055.554 5.037-.082.102-.229-.003-.188-.126a5.837 5.837 0 0 0 .229-2.424Zm1.771-.559a5.709 5.709 0 0 0-1.607-1.801v-.014c-.112-.085-.024-.274.113-.218 2.588 1.084 2.766 3.171 2.452 4.395a.116.116 0 0 1-.13.09.11.11 0 0 1-.071-.045.118.118 0 0 1-.022-.083 5.863 5.863 0 0 0-.735-2.324ZM9.32 4.2c-.616.544-1.279.758-2.058.997-.116 0-.194-.078-.155-.18 1.747-.907 2.369-1.645 2.99-2.771 0 0 .155-.117.188.085 0 .303-.348 1.325-.965 1.869Zm4.931 11.205a2.95 2.95 0 0 1-.935 1.549 2.16 2.16 0 0 1-1.282.618 2.167 2.167 0 0 1-1.323-.618 2.95 2.95 0 0 1-.923-1.549.243.243 0 0 1 .064-.197.23.23 0 0 1 .192-.069h3.954a.227.227 0 0 1 .244.16c.01.035.014.07.009.106Zm-5.443-2.17a1.85 1.85 0 0 1-2.377-.244 1.969 1.969 0 0 1-.233-2.44c.207-.318.502-.565.846-.711a1.84 1.84 0 0 1 2.053.42c.264.27.443.616.515.99a1.98 1.98 0 0 1-.108 1.118c-.142.35-.384.653-.696.867Zm8.471.005a1.85 1.85 0 0 1-2.374-.252 1.956 1.956 0 0 1-.546-1.362c0-.383.11-.758.319-1.076.207-.318.502-.566.847-.711a1.84 1.84 0 0 1 1.09-.108c.366.076.702.261.965.533s.44.617.512.993a1.98 1.98 0 0 1-.113 1.118 1.922 1.922 0 0 1-.7.865Z"/>',
116
+ mdx: '<path d="m15.494 12.406-3.169 3.169-3.25-3.169.894-.894 1.706 1.707V8.588h1.219V13.3l1.706-1.706.894.812Zm-13.65-.65 2.193 2.194 2.276-2.194v3.575H7.53v-6.58l-3.494 3.493L.625 8.75v6.581h1.219v-3.575ZM22.4 15.25l-2.519-2.519-2.518 2.519-.813-.894 2.519-2.518-2.6-2.6.893-.813 2.52 2.6 2.6-2.6.893.813-2.6 2.6 2.519 2.518-.894.894Z"/>',
117
+ };
118
+
119
+ export const Icons = {
120
+ ...BuiltInIcons,
121
+ ...FileIcons,
108
122
  };
package/components.ts CHANGED
@@ -5,4 +5,6 @@ export { default as Icon } from './user-components/Icon.astro';
5
5
  export { default as Tabs } from './user-components/Tabs.astro';
6
6
  export { default as TabItem } from './user-components/TabItem.astro';
7
7
  export { default as LinkCard } from './user-components/LinkCard.astro';
8
+ export { default as Steps } from './user-components/Steps.astro';
9
+ export { default as FileTree } from './user-components/FileTree.astro';
8
10
  export { Code } from 'astro-expressive-code/components';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrojs/starlight",
3
- "version": "0.20.1",
3
+ "version": "0.21.0",
4
4
  "description": "Build beautiful, high-performance documentation websites with Astro",
5
5
  "keywords": [
6
6
  "docs",
@@ -184,7 +184,9 @@
184
184
  "@types/mdast": "^4.0.3",
185
185
  "astro-expressive-code": "^0.33.4",
186
186
  "bcp-47": "^2.1.0",
187
+ "hast-util-from-html": "^2.0.1",
187
188
  "hast-util-select": "^6.0.2",
189
+ "hast-util-to-string": "^3.0.0",
188
190
  "hastscript": "^8.0.0",
189
191
  "mdast-util-directive": "^3.0.0",
190
192
  "mdast-util-to-markdown": "^2.1.0",
package/schemas/i18n.ts CHANGED
@@ -121,6 +121,10 @@ function starlightI18nSchema() {
121
121
  'aside.note': z.string().describe('Text shown on the note aside variant'),
122
122
  'aside.caution': z.string().describe('Text shown on the warning aside variant'),
123
123
  'aside.danger': z.string().describe('Text shown on the danger aside variant'),
124
+
125
+ 'fileTree.directory': z
126
+ .string()
127
+ .describe('Label for the directory icon in the file tree component.'),
124
128
  })
125
129
  .partial();
126
130
  }
@@ -22,5 +22,6 @@
22
22
  "aside.note": "ملحوظة",
23
23
  "aside.tip": "نصيحة",
24
24
  "aside.caution": "تنبيه",
25
- "aside.danger": "تحذير"
25
+ "aside.danger": "تحذير",
26
+ "fileTree.directory": "Directory"
26
27
  }
@@ -22,5 +22,6 @@
22
22
  "aside.note": "Note",
23
23
  "aside.tip": "Tip",
24
24
  "aside.caution": "Caution",
25
- "aside.danger": "Danger"
25
+ "aside.danger": "Danger",
26
+ "fileTree.directory": "Directory"
26
27
  }
@@ -22,5 +22,6 @@
22
22
  "aside.note": "Note",
23
23
  "aside.tip": "Tip",
24
24
  "aside.caution": "Caution",
25
- "aside.danger": "Danger"
25
+ "aside.danger": "Danger",
26
+ "fileTree.directory": "Directory"
26
27
  }
@@ -22,5 +22,6 @@
22
22
  "aside.note": "Hinweis",
23
23
  "aside.tip": "Tipp",
24
24
  "aside.caution": "Achtung",
25
- "aside.danger": "Gefahr"
25
+ "aside.danger": "Gefahr",
26
+ "fileTree.directory": "Directory"
26
27
  }
@@ -22,5 +22,6 @@
22
22
  "aside.note": "Note",
23
23
  "aside.tip": "Tip",
24
24
  "aside.caution": "Caution",
25
- "aside.danger": "Danger"
25
+ "aside.danger": "Danger",
26
+ "fileTree.directory": "Directory"
26
27
  }
@@ -25,5 +25,6 @@
25
25
  "aside.danger": "Peligro",
26
26
  "expressiveCode.copyButtonCopied": "¡Copiado!",
27
27
  "expressiveCode.copyButtonTooltip": "Copiar al portapapeles",
28
- "expressiveCode.terminalWindowFallbackTitle": "Ventana de terminal"
28
+ "expressiveCode.terminalWindowFallbackTitle": "Ventana de terminal",
29
+ "fileTree.directory": "Directory"
29
30
  }
@@ -22,5 +22,6 @@
22
22
  "aside.note": "Note",
23
23
  "aside.tip": "Tip",
24
24
  "aside.caution": "Caution",
25
- "aside.danger": "Danger"
25
+ "aside.danger": "Danger",
26
+ "fileTree.directory": "Directory"
26
27
  }
@@ -25,5 +25,6 @@
25
25
  "aside.danger": "Danger",
26
26
  "expressiveCode.copyButtonCopied": "Copié !",
27
27
  "expressiveCode.copyButtonTooltip": "Copier dans le presse-papiers",
28
- "expressiveCode.terminalWindowFallbackTitle": "Fenêtre de terminal"
28
+ "expressiveCode.terminalWindowFallbackTitle": "Fenêtre de terminal",
29
+ "fileTree.directory": "Directory"
29
30
  }
@@ -22,5 +22,6 @@
22
22
  "aside.note": "Note",
23
23
  "aside.tip": "Tip",
24
24
  "aside.caution": "Caution",
25
- "aside.danger": "Danger"
25
+ "aside.danger": "Danger",
26
+ "fileTree.directory": "Directory"
26
27
  }
@@ -22,5 +22,6 @@
22
22
  "aside.note": "Note",
23
23
  "aside.tip": "Tip",
24
24
  "aside.caution": "Caution",
25
- "aside.danger": "Danger"
25
+ "aside.danger": "Danger",
26
+ "fileTree.directory": "Directory"
26
27
  }
@@ -22,5 +22,6 @@
22
22
  "aside.note": "टिप्पणी",
23
23
  "aside.tip": "संकेत",
24
24
  "aside.caution": "सावधानी",
25
- "aside.danger": "खतरा"
25
+ "aside.danger": "खतरा",
26
+ "fileTree.directory": "Directory"
26
27
  }
@@ -22,5 +22,6 @@
22
22
  "aside.note": "Catatan",
23
23
  "aside.tip": "Tips",
24
24
  "aside.caution": "Perhatian",
25
- "aside.danger": "Bahaya"
25
+ "aside.danger": "Bahaya",
26
+ "fileTree.directory": "Directory"
26
27
  }
@@ -22,5 +22,6 @@
22
22
  "aside.note": "Nota",
23
23
  "aside.tip": "Consiglio",
24
24
  "aside.caution": "Attenzione",
25
- "aside.danger": "Pericolo"
25
+ "aside.danger": "Pericolo",
26
+ "fileTree.directory": "Directory"
26
27
  }
@@ -22,5 +22,6 @@
22
22
  "aside.note": "ノート",
23
23
  "aside.tip": "ヒント",
24
24
  "aside.caution": "注意",
25
- "aside.danger": "危険"
25
+ "aside.danger": "危険",
26
+ "fileTree.directory": "Directory"
26
27
  }
@@ -22,5 +22,6 @@
22
22
  "aside.note": "노트",
23
23
  "aside.tip": "팁",
24
24
  "aside.caution": "주의",
25
- "aside.danger": "위험"
25
+ "aside.danger": "위험",
26
+ "fileTree.directory": "Directory"
26
27
  }
@@ -22,5 +22,6 @@
22
22
  "aside.note": "Note",
23
23
  "aside.tip": "Tip",
24
24
  "aside.caution": "Caution",
25
- "aside.danger": "Danger"
25
+ "aside.danger": "Danger",
26
+ "fileTree.directory": "Directory"
26
27
  }
@@ -22,5 +22,6 @@
22
22
  "aside.note": "Opmerking",
23
23
  "aside.tip": "Tip",
24
24
  "aside.caution": "Opgepast",
25
- "aside.danger": "Gevaar"
25
+ "aside.danger": "Gevaar",
26
+ "fileTree.directory": "Directory"
26
27
  }
@@ -22,5 +22,6 @@
22
22
  "aside.note": "Nota",
23
23
  "aside.tip": "Dica",
24
24
  "aside.caution": "Cuidado",
25
- "aside.danger": "Perigo"
25
+ "aside.danger": "Perigo",
26
+ "fileTree.directory": "Directory"
26
27
  }
@@ -22,5 +22,6 @@
22
22
  "aside.note": "Mențiune",
23
23
  "aside.tip": "Sfat",
24
24
  "aside.caution": "Atenție",
25
- "aside.danger": "Pericol"
25
+ "aside.danger": "Pericol",
26
+ "fileTree.directory": "Directory"
26
27
  }
@@ -22,5 +22,6 @@
22
22
  "aside.note": "Заметка",
23
23
  "aside.tip": "Знали ли вы?",
24
24
  "aside.caution": "Осторожно",
25
- "aside.danger": "Опасно"
25
+ "aside.danger": "Опасно",
26
+ "fileTree.directory": "Directory"
26
27
  }
@@ -22,5 +22,6 @@
22
22
  "aside.note": "Note",
23
23
  "aside.tip": "Tip",
24
24
  "aside.caution": "Caution",
25
- "aside.danger": "Danger"
25
+ "aside.danger": "Danger",
26
+ "fileTree.directory": "Directory"
26
27
  }
@@ -22,5 +22,6 @@
22
22
  "aside.note": "Note",
23
23
  "aside.tip": "Tip",
24
24
  "aside.caution": "Caution",
25
- "aside.danger": "Danger"
25
+ "aside.danger": "Danger",
26
+ "fileTree.directory": "Directory"
26
27
  }
@@ -22,5 +22,6 @@
22
22
  "aside.note": "Заувага",
23
23
  "aside.tip": "Порада",
24
24
  "aside.caution": "Обережно",
25
- "aside.danger": "Небезпечно"
25
+ "aside.danger": "Небезпечно",
26
+ "fileTree.directory": "Directory"
26
27
  }
@@ -22,5 +22,6 @@
22
22
  "aside.note": "Ghi chú",
23
23
  "aside.tip": "Mẹo",
24
24
  "aside.caution": "Thận trọng",
25
- "aside.danger": "Nguy hiểm"
25
+ "aside.danger": "Nguy hiểm",
26
+ "fileTree.directory": "Directory"
26
27
  }
@@ -22,5 +22,6 @@
22
22
  "aside.note": "注意",
23
23
  "aside.tip": "提示",
24
24
  "aside.caution": "警告",
25
- "aside.danger": "危险"
25
+ "aside.danger": "危险",
26
+ "fileTree.directory": "Directory"
26
27
  }
@@ -22,5 +22,6 @@
22
22
  "aside.note": "注意",
23
23
  "aside.tip": "提示",
24
24
  "aside.caution": "警告",
25
- "aside.danger": "危險"
25
+ "aside.danger": "危險",
26
+ "fileTree.directory": "Directory"
26
27
  }
@@ -0,0 +1,139 @@
1
+ ---
2
+ import { slugToLocaleData } from '../utils/slugs';
3
+ import { useTranslations } from '../utils/translations';
4
+ import { processFileTree } from './rehype-file-tree';
5
+
6
+ const slug = Astro.url.pathname.replace(/^\//, '').replace(/\/$/, '');
7
+ const t = useTranslations(slugToLocaleData(slug).locale);
8
+
9
+ const fileTreeHtml = await Astro.slots.render('default');
10
+ const html = processFileTree(fileTreeHtml, t('fileTree.directory'));
11
+ ---
12
+
13
+ <starlight-file-tree set:html={html} class="not-content" data-pagefind-ignore />
14
+
15
+ <style>
16
+ starlight-file-tree {
17
+ --x-space: 1.5rem;
18
+ --y-space: 0.125rem;
19
+ --y-pad: 0;
20
+
21
+ display: block;
22
+ border: 1px solid var(--sl-color-gray-5);
23
+ padding: 1rem;
24
+ background-color: var(--sl-color-gray-6);
25
+ font-size: var(--sl-text-xs);
26
+ font-family: var(--__sl-font-mono);
27
+ overflow-x: auto;
28
+ }
29
+
30
+ starlight-file-tree :global(.directory > details) {
31
+ border: 0;
32
+ padding: 0;
33
+ padding-inline-start: var(--x-space);
34
+ background: transparent;
35
+ }
36
+
37
+ starlight-file-tree :global(.directory > details > summary) {
38
+ margin-inline-start: calc(-1 * var(--x-space));
39
+ border: 0;
40
+ padding: var(--y-pad) 0.625rem;
41
+ font-weight: normal;
42
+ color: var(--sl-color-white);
43
+ max-width: 100%;
44
+
45
+ &::marker,
46
+ &::-webkit-details-marker {
47
+ color: var(--sl-color-gray-3);
48
+ }
49
+
50
+ &:hover,
51
+ &:hover :global(.tree-icon) {
52
+ cursor: pointer;
53
+ color: var(--sl-color-text-accent);
54
+ fill: var(--sl-color-text-accent);
55
+
56
+ & ~ :global(ul) {
57
+ border-color: var(--sl-color-gray-4);
58
+ }
59
+ }
60
+
61
+ &:hover :global(.highlight .tree-icon) {
62
+ fill: var(--sl-color-text-invert);
63
+ }
64
+ }
65
+
66
+ starlight-file-tree :global(ul) {
67
+ margin-inline-start: 0.5rem;
68
+ border-inline-start: 1px solid var(--sl-color-gray-5);
69
+ padding: 0;
70
+ padding-inline-start: 0.125rem;
71
+ list-style: none;
72
+ }
73
+
74
+ starlight-file-tree > :global(ul) {
75
+ margin: 0;
76
+ border: 0;
77
+ padding: 0;
78
+ }
79
+
80
+ starlight-file-tree :global(li) {
81
+ margin: var(--y-space) 0;
82
+ padding: var(--y-pad) 0;
83
+ }
84
+
85
+ starlight-file-tree :global(.file) {
86
+ margin-inline-start: calc(var(--x-space) - 0.125rem);
87
+ color: var(--sl-color-white);
88
+ }
89
+
90
+ starlight-file-tree :global(.tree-entry) {
91
+ display: inline-flex;
92
+ align-items: flex-start;
93
+ flex-wrap: wrap;
94
+ max-width: calc(100% - 1rem);
95
+
96
+ @media (min-width: 30em) {
97
+ & {
98
+ flex-wrap: nowrap;
99
+ }
100
+ }
101
+
102
+ & > :global(:first-child) {
103
+ flex-shrink: 0;
104
+ }
105
+ }
106
+
107
+ starlight-file-tree :global(.empty) {
108
+ color: var(--sl-color-gray-3);
109
+ padding-inline-start: 0.375rem;
110
+ }
111
+
112
+ starlight-file-tree :global(.comment) {
113
+ color: var(--sl-color-gray-3);
114
+ padding-inline-start: 1.625rem;
115
+ max-width: 24rem;
116
+ min-width: 12rem;
117
+ }
118
+
119
+ starlight-file-tree :global(.highlight) {
120
+ display: inline-block;
121
+ border-radius: 0.25rem;
122
+ padding-inline-end: 0.5rem;
123
+ color: var(--sl-color-text-invert);
124
+ background-color: var(--sl-color-text-accent);
125
+ }
126
+
127
+ starlight-file-tree :global(svg) {
128
+ display: inline;
129
+ fill: var(--sl-color-gray-3);
130
+ vertical-align: middle;
131
+ margin-inline: 0.25rem 0.375rem;
132
+ width: 0.875rem;
133
+ height: 0.875rem;
134
+ }
135
+
136
+ starlight-file-tree :global(.highlight svg.tree-icon) {
137
+ fill: var(--sl-color-text-invert);
138
+ }
139
+ </style>
@@ -0,0 +1,84 @@
1
+ ---
2
+ import { processSteps } from './rehype-steps';
3
+
4
+ const content = await Astro.slots.render('default');
5
+ const { html } = processSteps(content);
6
+ ---
7
+
8
+ <Fragment set:html={html} />
9
+
10
+ <style is:global>
11
+ .sl-steps {
12
+ --bullet-size: calc(var(--sl-line-height) * 1rem);
13
+ --bullet-margin: 0.375rem;
14
+
15
+ list-style: none;
16
+ padding-inline-start: 0;
17
+ }
18
+
19
+ .sl-steps > li {
20
+ position: relative;
21
+ padding-inline-start: calc(var(--bullet-size) + 1rem);
22
+ /* HACK: Keeps any `margin-bottom` inside the `<li>`’s padding box to avoid gaps in the hairline border. */
23
+ padding-bottom: 1px;
24
+ /* Prevent bullets from touching in short list items. */
25
+ min-height: calc(var(--bullet-size) + var(--bullet-margin));
26
+ }
27
+ .sl-steps > li + li {
28
+ /* Remove margin between steps. */
29
+ margin-top: 0;
30
+ }
31
+
32
+ /* Custom list marker element. */
33
+ .sl-steps > li::before {
34
+ content: counter(list-item);
35
+ position: absolute;
36
+ top: 0;
37
+ inset-inline-start: 0;
38
+ width: var(--bullet-size);
39
+ height: var(--bullet-size);
40
+ line-height: var(--bullet-size);
41
+
42
+ font-size: var(--sl-text-xs);
43
+ font-weight: 600;
44
+ text-align: center;
45
+ color: var(--sl-color-white);
46
+ background-color: var(--sl-color-gray-6);
47
+ border-radius: 99rem;
48
+ box-shadow: inset 0 0 0 1px var(--sl-color-gray-5);
49
+ }
50
+
51
+ /* Vertical guideline linking list numbers. */
52
+ .sl-steps > li:not(:last-of-type)::after {
53
+ --guide-width: 1px;
54
+ content: '';
55
+ position: absolute;
56
+ top: calc(var(--bullet-size) + var(--bullet-margin));
57
+ bottom: var(--bullet-margin);
58
+ inset-inline-start: calc((var(--bullet-size) - var(--guide-width)) / 2);
59
+ width: var(--guide-width);
60
+ background-color: var(--sl-color-hairline-light);
61
+ }
62
+
63
+ /* Adjust first item inside a step so that it aligns vertically with the number
64
+ even if using a larger font size (e.g. a heading) */
65
+ .sl-steps > li > :first-child {
66
+ /*
67
+ The `lh` unit is not yet supported by all browsers in our support matrix
68
+ — see https://caniuse.com/mdn-css_types_length_lh
69
+ In unsupported browsers we approximate this using our known line-heights.
70
+ */
71
+ --lh: calc(1em * var(--sl-line-height));
72
+ --shift-y: calc(0.5 * (var(--bullet-size) - var(--lh)));
73
+ transform: translateY(var(--shift-y));
74
+ margin-bottom: var(--shift-y);
75
+ }
76
+ .sl-steps > li > :first-child:where(h1, h2, h3, h4, h5, h6) {
77
+ --lh: calc(1em * var(--sl-line-height-headings));
78
+ }
79
+ @supports (--prop: 1lh) {
80
+ .sl-steps > li > :first-child {
81
+ --lh: 1lh;
82
+ }
83
+ }
84
+ </style>
@@ -1,17 +1,19 @@
1
1
  ---
2
2
  import { TabItemTagname } from './rehype-tabs';
3
+ import type { Icons } from '../components/Icons';
3
4
 
4
5
  interface Props {
6
+ icon?: keyof typeof Icons;
5
7
  label: string;
6
8
  }
7
9
 
8
- const { label } = Astro.props;
10
+ const { icon, label } = Astro.props;
9
11
 
10
12
  if (!label) {
11
13
  throw new Error('Missing prop `label` on `<TabItem>` component.');
12
14
  }
13
15
  ---
14
16
 
15
- <TabItemTagname data-label={label}>
17
+ <TabItemTagname data-label={label} data-icon={icon}>
16
18
  <slot />
17
19
  </TabItemTagname>
@@ -1,4 +1,5 @@
1
1
  ---
2
+ import Icon from './Icon.astro';
2
3
  import { processPanels } from './rehype-tabs';
3
4
 
4
5
  const panelHtml = await Astro.slots.render('default');
@@ -10,7 +11,7 @@ const { html, panels } = processPanels(panelHtml);
10
11
  panels && (
11
12
  <div class="tablist-wrapper not-content">
12
13
  <ul role="tablist">
13
- {panels.map(({ label, panelId, tabId }, idx) => (
14
+ {panels.map(({ icon, label, panelId, tabId }, idx) => (
14
15
  <li role="presentation" class="tab">
15
16
  <a
16
17
  role="tab"
@@ -19,6 +20,7 @@ const { html, panels } = processPanels(panelHtml);
19
20
  aria-selected={idx === 0 && 'true'}
20
21
  tabindex={idx !== 0 ? -1 : 0}
21
22
  >
23
+ {icon && <Icon name={icon} />}
22
24
  {label}
23
25
  </a>
24
26
  </li>
@@ -50,7 +52,9 @@ const { html, panels } = processPanels(panelHtml);
50
52
  margin-bottom: -2px;
51
53
  }
52
54
  .tab > [role='tab'] {
53
- display: block;
55
+ display: flex;
56
+ align-items: center;
57
+ gap: 0.5rem;
54
58
  padding: 0 1.25rem;
55
59
  text-decoration: none;
56
60
  border-bottom: 2px solid var(--sl-color-gray-5);