@grove-dev/starlight 0.1.9
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/LICENSE +21 -0
- package/README.md +200 -0
- package/components/custom/ContainerSection.astro +58 -0
- package/components/custom/LinkButton.astro +141 -0
- package/components/custom/dropdown/Dropdown.astro +616 -0
- package/components/custom/dropdown/DropdownContent.astro +179 -0
- package/components/custom/dropdown/DropdownItem.astro +72 -0
- package/components/custom/dropdown/DropdownLabel.astro +31 -0
- package/components/custom/dropdown/DropdownSeparator.astro +18 -0
- package/components/custom/dropdown/DropdownShortcut.astro +24 -0
- package/components/custom/dropdown/DropdownTrigger.astro +54 -0
- package/components/custom/dropdown/index.ts +29 -0
- package/components/overrides/ContentPanel.astro +1 -0
- package/components/overrides/Footer.astro +54 -0
- package/components/overrides/Header.astro +93 -0
- package/components/overrides/Hero.astro +260 -0
- package/components/overrides/MarkdownContent.astro +17 -0
- package/components/overrides/PageFrame.astro +121 -0
- package/components/overrides/PageSidebar.astro +20 -0
- package/components/overrides/PageTitle.astro +130 -0
- package/components/overrides/Pagination.astro +101 -0
- package/components/overrides/Search.astro +549 -0
- package/components/overrides/Sidebar.astro +111 -0
- package/components/overrides/SiteTitle.astro +65 -0
- package/components/overrides/SocialIcons.astro +47 -0
- package/components/overrides/TableOfContents.astro +36 -0
- package/components/overrides/ThemeSelect.astro +156 -0
- package/components/overrides/TwoColumnContent.astro +75 -0
- package/components/overrides/parts/Drawer.astro +232 -0
- package/components/overrides/parts/MobileMenuToggle.astro +42 -0
- package/components/overrides/parts/NavBar.astro +110 -0
- package/components/overrides/parts/SidebarSublist.astro +115 -0
- package/components/overrides/parts/toc/TableOfContentsList.astro +71 -0
- package/components/overrides/parts/toc/starlight-toc.ts +119 -0
- package/core/config/constants.ts +1 -0
- package/core/config/expresive-code.ts +63 -0
- package/core/config/override.ts +48 -0
- package/core/config/schemas.ts +57 -0
- package/core/config/vite.ts +20 -0
- package/core/plugin.ts +56 -0
- package/global.d.ts +5 -0
- package/index.ts +3 -0
- package/package.json +54 -0
- package/schema.ts +24 -0
- package/styles/base.css +897 -0
- package/styles/layers.css +1 -0
- package/styles/theme.css +67 -0
- package/user-components.ts +3 -0
- package/virtual.d.ts +51 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Turtuvshin Byambaa
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# @grove-dev/starlight
|
|
2
|
+
|
|
3
|
+
Grove Starlight is a theme plugin for Astro Starlight
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Starlight plugin API integration.
|
|
8
|
+
- Custom overrides for header, sidebar, page frame, hero, footer, search, table of contents, pagination, and Markdown content.
|
|
9
|
+
- Token-based, layered CSS theme with light and dark mode values.
|
|
10
|
+
- Styled built-in Starlight components including hero splashes, cards, link cards, asides, badges, tabs, steps, file trees, and link buttons.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @grove-dev/starlight
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
With Bun:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
bun add @grove-dev/starlight
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
Add the plugin inside the Starlight integration:
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
// astro.config.mjs
|
|
30
|
+
import { defineConfig } from 'astro/config';
|
|
31
|
+
import starlight from '@astrojs/starlight';
|
|
32
|
+
import lucode from '@grove-dev/starlight';
|
|
33
|
+
|
|
34
|
+
export default defineConfig({
|
|
35
|
+
integrations: [
|
|
36
|
+
starlight({
|
|
37
|
+
title: 'My Docs',
|
|
38
|
+
plugins: [lucode()],
|
|
39
|
+
}),
|
|
40
|
+
],
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The plugin automatically registers Lucode component overrides, appends the theme CSS files, and configures Expressive Code.
|
|
45
|
+
|
|
46
|
+
## Attribution
|
|
47
|
+
|
|
48
|
+
This theme recreates the design of the documentation site for [shadcn/ui](https://ui.shadcn.com/).
|
|
49
|
+
|
|
50
|
+
I used [adrian-ub/starlight-theme-black](https://github.com/adrian-ub/starlight-theme-black) as a base, which brought an earlier shadcn/ui-inspired design to Astro Starlight.
|
|
51
|
+
|
|
52
|
+
## Docs Schema
|
|
53
|
+
|
|
54
|
+
To use Lucode's splash-page frontmatter fields with type checking, extend the Starlight docs schema:
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
// src/content.config.ts
|
|
58
|
+
import { defineCollection } from 'astro:content';
|
|
59
|
+
import { docsLoader } from '@astrojs/starlight/loaders';
|
|
60
|
+
import { docsSchema } from '@astrojs/starlight/schema';
|
|
61
|
+
import { ExtendDocsSchema } from '@grove-dev/starlight/schema';
|
|
62
|
+
|
|
63
|
+
export const collections = {
|
|
64
|
+
docs: defineCollection({
|
|
65
|
+
loader: docsLoader(),
|
|
66
|
+
schema: docsSchema({ extend: ExtendDocsSchema }),
|
|
67
|
+
}),
|
|
68
|
+
};
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Plugin Options
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
type LucodeStarlightUserConfig = {
|
|
75
|
+
navLinks?: Link[];
|
|
76
|
+
footerText?: string;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
type Link = {
|
|
80
|
+
label: string | Record<string, string>;
|
|
81
|
+
link: string;
|
|
82
|
+
badge?: string;
|
|
83
|
+
attrs?: Record<string, string | number | boolean | undefined>;
|
|
84
|
+
};
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Example:
|
|
88
|
+
|
|
89
|
+
```js
|
|
90
|
+
lucode({
|
|
91
|
+
navLinks: [
|
|
92
|
+
{ label: 'Docs', link: '/guides/getting-started/' },
|
|
93
|
+
{ label: 'GitHub', link: 'https://github.com/lucas-labs/@grove-dev/starlight-theme' },
|
|
94
|
+
],
|
|
95
|
+
footerText:
|
|
96
|
+
'Built with [Lucode Starlight](https://github.com/lucas-labs/@grove-dev/starlight-theme).',
|
|
97
|
+
});
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Splash Pages
|
|
101
|
+
|
|
102
|
+
Use Starlight's `template: splash` and set `hero.layout`:
|
|
103
|
+
|
|
104
|
+
```md
|
|
105
|
+
---
|
|
106
|
+
title: Developer Portal
|
|
107
|
+
description: API docs, examples, and integration guides.
|
|
108
|
+
template: splash
|
|
109
|
+
hero:
|
|
110
|
+
layout: split-left
|
|
111
|
+
announcement:
|
|
112
|
+
text: Version 2.0 is ready
|
|
113
|
+
link: /guides/getting-started/
|
|
114
|
+
actions:
|
|
115
|
+
- text: Get started
|
|
116
|
+
link: /guides/getting-started/
|
|
117
|
+
icon: right-arrow
|
|
118
|
+
---
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Available layouts:
|
|
122
|
+
|
|
123
|
+
- `centered`
|
|
124
|
+
- `centered-top`
|
|
125
|
+
- `split-left`
|
|
126
|
+
- `split-right`
|
|
127
|
+
- `banner`
|
|
128
|
+
|
|
129
|
+
## Components
|
|
130
|
+
|
|
131
|
+
Import user-facing components from `@grove-dev/starlight/components`:
|
|
132
|
+
|
|
133
|
+
```astro
|
|
134
|
+
---
|
|
135
|
+
import { ContainerSection, Dropdown, LinkButton } from '@grove-dev/starlight/components';
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
<ContainerSection width="lg">
|
|
139
|
+
<h2>Build better docs</h2>
|
|
140
|
+
<p>Use Lucode sections on splash pages and custom MDX content.</p>
|
|
141
|
+
<LinkButton href="/@grove-dev/starlight-theme/guides/getting-started/">Get started</LinkButton>
|
|
142
|
+
</ContainerSection>
|
|
143
|
+
|
|
144
|
+
<Dropdown.Root>
|
|
145
|
+
<Dropdown.Trigger variant="secondary">Theme actions</Dropdown.Trigger>
|
|
146
|
+
<Dropdown.Content align="start">
|
|
147
|
+
<Dropdown.Label>Documentation</Dropdown.Label>
|
|
148
|
+
<Dropdown.Item as="a" href="/guides/getting-started/">
|
|
149
|
+
Getting Started
|
|
150
|
+
</Dropdown.Item>
|
|
151
|
+
<Dropdown.Item as="a" href="/guides/theming/">
|
|
152
|
+
Customize Theme
|
|
153
|
+
<Dropdown.Shortcut>CSS</Dropdown.Shortcut>
|
|
154
|
+
</Dropdown.Item>
|
|
155
|
+
</Dropdown.Content>
|
|
156
|
+
</Dropdown.Root>
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### `LinkButton`
|
|
160
|
+
|
|
161
|
+
Props:
|
|
162
|
+
|
|
163
|
+
- `href`: anchor destination.
|
|
164
|
+
- `variant`: `primary`, `secondary`, or `minimal`.
|
|
165
|
+
- `size`: `2xs`, `xs`, `sm`, `md`, or `lg`.
|
|
166
|
+
- Other anchor attributes are forwarded.
|
|
167
|
+
|
|
168
|
+
### `ContainerSection`
|
|
169
|
+
|
|
170
|
+
Props:
|
|
171
|
+
|
|
172
|
+
- `width`: `sm`, `md`, `lg`, or `xl`.
|
|
173
|
+
|
|
174
|
+
### `Dropdown`
|
|
175
|
+
|
|
176
|
+
Compound menu component exported as `Dropdown.Root`, `Dropdown.Trigger`, `Dropdown.Content`, `Dropdown.Item`, `Dropdown.Label`, `Dropdown.Separator`, and `Dropdown.Shortcut`.
|
|
177
|
+
|
|
178
|
+
Useful props:
|
|
179
|
+
|
|
180
|
+
- `Dropdown.Root`: `openOnHover`, `closeDelay`.
|
|
181
|
+
- `Dropdown.Trigger`: `asChild`, `variant`, `size`.
|
|
182
|
+
- `Dropdown.Content`: `side`, `align`, `sideOffset`, `animationDuration`.
|
|
183
|
+
- `Dropdown.Item`: `as`, `inset`, `disabled`.
|
|
184
|
+
- `Dropdown.Label`: `inset`.
|
|
185
|
+
|
|
186
|
+
## Styling
|
|
187
|
+
|
|
188
|
+
Override theme tokens from your app CSS:
|
|
189
|
+
|
|
190
|
+
```css
|
|
191
|
+
:root {
|
|
192
|
+
--radius: 0.5rem;
|
|
193
|
+
--sidebar-width: 17rem;
|
|
194
|
+
--container-max-width: 1440px;
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## License
|
|
199
|
+
|
|
200
|
+
MIT
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
type Props = {
|
|
3
|
+
width?: 'sm' | 'md' | 'lg' | 'xl';
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
const { width = 'lg' } = Astro.props;
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
<div class="container-section" data-width={width}>
|
|
10
|
+
<div class="container-wrapper">
|
|
11
|
+
<div class="container">
|
|
12
|
+
<slot />
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<style>
|
|
18
|
+
.container-section {
|
|
19
|
+
padding-inline: calc(var(--spacing) * 2);
|
|
20
|
+
|
|
21
|
+
/* higher padding on larger screens */
|
|
22
|
+
@media (min-width: 640px) {
|
|
23
|
+
padding-inline: calc(var(--spacing) * 4);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@media (min-width: 1024px) {
|
|
27
|
+
padding-inline: calc(var(--spacing) * 12);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.container-wrapper {
|
|
31
|
+
max-width: var(--section-max-width);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&:last-of-type {
|
|
35
|
+
padding-bottom: 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
+ .container-section {
|
|
39
|
+
margin-top: calc(var(--spacing) * 12);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&[data-width='sm'] {
|
|
43
|
+
--section-max-width: 640px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&[data-width='md'] {
|
|
47
|
+
--section-max-width: 768px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&[data-width='lg'] {
|
|
51
|
+
--section-max-width: 1024px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&[data-width='xl'] {
|
|
55
|
+
--section-max-width: 1280px;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
</style>
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types';
|
|
3
|
+
|
|
4
|
+
type Props = (Omit<HTMLAttributes<'a'>, 'href'> | HTMLAttributes<'button'>) & {
|
|
5
|
+
href?: string | URL | null | undefined;
|
|
6
|
+
variant?: 'primary' | 'secondary' | 'minimal';
|
|
7
|
+
size?: '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'icon-sm' | 'icon-md' | 'icon-lg';
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const { class: className, variant = 'primary', size = 'md', ...attrs } = Astro.props;
|
|
11
|
+
|
|
12
|
+
const Tag = attrs.href ? 'a' : 'button';
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
<Tag
|
|
16
|
+
data-slot="button"
|
|
17
|
+
class:list={['link-button', variant, className]}
|
|
18
|
+
data-size={size}
|
|
19
|
+
{...attrs as any}
|
|
20
|
+
>
|
|
21
|
+
<slot />
|
|
22
|
+
</Tag>
|
|
23
|
+
|
|
24
|
+
<style>
|
|
25
|
+
[data-slot='button'],
|
|
26
|
+
.link-button {
|
|
27
|
+
transition-property:
|
|
28
|
+
color, background-color, border-color, text-decoration-color, fill, stroke;
|
|
29
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
30
|
+
transition-duration: 0.15s;
|
|
31
|
+
color: var(--primary-foreground);
|
|
32
|
+
white-space: nowrap;
|
|
33
|
+
gap: 0.5rem;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
align-items: center;
|
|
36
|
+
display: inline-flex;
|
|
37
|
+
text-decoration: inherit;
|
|
38
|
+
border: none;
|
|
39
|
+
|
|
40
|
+
height: var(--button-height, calc(var(--spacing) * 8));
|
|
41
|
+
width: var(--button-width, auto);
|
|
42
|
+
font-weight: var(--button-font-weight, 500);
|
|
43
|
+
font-size: var(--button-font-size, 0.875rem);
|
|
44
|
+
line-height: var(--button-line-height, 1rem);
|
|
45
|
+
padding-left: var(--button-padding-l, var(--button-padding-x, calc(var(--spacing) * 2.5)));
|
|
46
|
+
padding-right: var(--button-padding-r, var(--button-padding-x, calc(var(--spacing) * 2.5)));
|
|
47
|
+
border-radius: var(--button-radius, var(--radius));
|
|
48
|
+
|
|
49
|
+
&[data-size='2xs'] {
|
|
50
|
+
--button-height: calc(var(--spacing) * 5.5);
|
|
51
|
+
--button-padding-l: calc(var(--spacing) * 2);
|
|
52
|
+
--button-padding-r: var(--spacing);
|
|
53
|
+
--button-font-size: 0.75rem;
|
|
54
|
+
--border-radius: 100%;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&[data-size='xs'] {
|
|
58
|
+
--button-radius: calc(var(--radius) - 2px);
|
|
59
|
+
--button-height: calc(var(--spacing) * 6);
|
|
60
|
+
--button-padding-x: calc(var(--spacing) * 2);
|
|
61
|
+
--button-font-size: 0.75rem;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&[data-size='sm'] {
|
|
65
|
+
--button-height: calc(var(--spacing) * 7);
|
|
66
|
+
--button-padding-x: calc(var(--spacing) * 2.5);
|
|
67
|
+
--button-font-size: 0.8rem;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
&[data-size='lg'] {
|
|
71
|
+
--button-height: calc(var(--spacing) * 8.5);
|
|
72
|
+
--button-padding-x: calc(var(--spacing) * 2.5);
|
|
73
|
+
--button-font-size: 0.875rem;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&[data-size='icon-sm'] {
|
|
77
|
+
--button-height: calc(var(--spacing) * 6);
|
|
78
|
+
--button-width: calc(var(--spacing) * 6);
|
|
79
|
+
--button-padding-x: 0;
|
|
80
|
+
--button-font-size: 0;
|
|
81
|
+
--button-radius: calc(var(--radius) - 3px);
|
|
82
|
+
|
|
83
|
+
svg {
|
|
84
|
+
width: 1rem;
|
|
85
|
+
height: 1rem;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&[data-size='icon-md'] {
|
|
90
|
+
--button-height: calc(var(--spacing) * 7);
|
|
91
|
+
--button-width: calc(var(--spacing) * 7);
|
|
92
|
+
--button-padding-x: 0;
|
|
93
|
+
--button-font-size: 0;
|
|
94
|
+
--button-radius: calc(var(--radius) - 2px);
|
|
95
|
+
|
|
96
|
+
svg {
|
|
97
|
+
width: 1.25rem;
|
|
98
|
+
height: 1.25rem;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
&[data-size='icon-lg'] {
|
|
103
|
+
--button-height: calc(var(--spacing) * 8);
|
|
104
|
+
--button-width: calc(var(--spacing) * 8);
|
|
105
|
+
--button-padding-x: 0;
|
|
106
|
+
--button-font-size: 0;
|
|
107
|
+
--button-radius: calc(var(--radius) - 1px);
|
|
108
|
+
|
|
109
|
+
svg {
|
|
110
|
+
width: 1.5rem;
|
|
111
|
+
height: 1.5rem;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.primary {
|
|
117
|
+
background-color: var(--primary);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.primary:hover {
|
|
121
|
+
background-color: color-mix(in oklab, var(--primary) 90%, transparent);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.secondary {
|
|
125
|
+
background-color: var(--secondary);
|
|
126
|
+
color: var(--secondary-foreground);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.secondary:hover {
|
|
130
|
+
background-color: color-mix(in oklab, var(--secondary) 80%, transparent);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.minimal {
|
|
134
|
+
color: var(--accent-foreground);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.minimal:hover {
|
|
138
|
+
color: var(--accent-foreground);
|
|
139
|
+
background-color: var(--accent);
|
|
140
|
+
}
|
|
141
|
+
</style>
|