@stainless-api/docs 0.1.0-beta.4 → 0.1.0-beta.40
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 +289 -0
- package/components/variables.css +2 -32
- package/eslint-suppressions.json +47 -0
- package/locals.d.ts +14 -0
- package/package.json +34 -30
- package/plugin/buildAlgoliaIndex.ts +31 -6
- package/plugin/cms/server.ts +98 -55
- package/plugin/cms/sidebar-builder.ts +7 -26
- package/plugin/cms/worker.ts +3 -3
- package/plugin/components/SDKSelect.astro +7 -5
- package/plugin/components/SnippetCode.tsx +11 -7
- package/plugin/components/search/SearchAlgolia.astro +5 -11
- package/plugin/components/search/SearchIsland.tsx +35 -22
- package/plugin/generateAPIReferenceLink.ts +2 -2
- package/plugin/globalJs/ai-dropdown-options.ts +235 -0
- package/plugin/globalJs/navigation.ts +7 -27
- package/plugin/helpers/getPageLoadEvent.ts +1 -1
- package/plugin/index.ts +52 -24
- package/plugin/languages.ts +2 -2
- package/plugin/loadPluginConfig.ts +105 -18
- package/plugin/middlewareBuilder/stainlessMiddleware.d.ts +1 -1
- package/plugin/react/Routing.tsx +60 -57
- package/plugin/referencePlaceholderUtils.ts +1 -1
- package/plugin/replaceSidebarPlaceholderMiddleware.ts +5 -1
- package/plugin/routes/Docs.astro +59 -85
- package/plugin/routes/Overview.astro +10 -16
- package/plugin/routes/markdown.ts +7 -7
- package/plugin/vendor/preview.worker.docs.js +7566 -6784
- package/resolveSrcFile.ts +10 -0
- package/scripts/vendor_deps.ts +1 -1
- package/shared/getSharedLogger.ts +15 -0
- package/shared/terminalUtils.ts +3 -0
- package/src/content.config.ts +9 -0
- package/stl-docs/components/AIDropdown.tsx +63 -0
- package/stl-docs/components/{content-panel/ContentBreadcrumbs.tsx → ContentBreadcrumbs.tsx} +2 -2
- package/stl-docs/components/Head.astro +16 -0
- package/stl-docs/components/Header.astro +3 -2
- package/stl-docs/components/PageTitle.astro +82 -0
- package/stl-docs/components/TableOfContents.astro +34 -0
- package/stl-docs/components/ThemeSelect.astro +80 -112
- package/stl-docs/components/content-panel/ContentPanel.astro +9 -39
- package/stl-docs/components/headers/DefaultHeader.astro +1 -1
- package/stl-docs/components/headers/HeaderLinks.astro +1 -1
- package/stl-docs/components/headers/SplashMobileMenuToggle.astro +19 -0
- package/stl-docs/components/headers/StackedHeader.astro +29 -24
- package/stl-docs/components/icons/chat-gpt.tsx +17 -0
- package/stl-docs/components/icons/claude.tsx +10 -0
- package/stl-docs/components/icons/cursor.tsx +10 -0
- package/stl-docs/components/icons/gemini.tsx +19 -0
- package/stl-docs/components/icons/markdown.tsx +10 -0
- package/stl-docs/components/index.ts +1 -0
- package/stl-docs/components/mintlify-compat/Accordion.astro +7 -38
- package/stl-docs/components/mintlify-compat/AccordionGroup.astro +9 -23
- package/stl-docs/components/mintlify-compat/Columns.astro +40 -42
- package/stl-docs/components/mintlify-compat/Frame.astro +16 -18
- package/stl-docs/components/mintlify-compat/Step.astro +30 -32
- package/stl-docs/components/mintlify-compat/Steps.astro +8 -10
- package/stl-docs/components/mintlify-compat/callouts/Callout.astro +10 -3
- package/stl-docs/components/mintlify-compat/callouts/Check.astro +7 -3
- package/stl-docs/components/mintlify-compat/callouts/Danger.astro +7 -3
- package/stl-docs/components/mintlify-compat/callouts/Info.astro +7 -3
- package/stl-docs/components/mintlify-compat/callouts/Note.astro +7 -3
- package/stl-docs/components/mintlify-compat/callouts/Tip.astro +7 -3
- package/stl-docs/components/mintlify-compat/callouts/Warning.astro +7 -3
- package/stl-docs/components/mintlify-compat/card.css +33 -35
- package/stl-docs/components/nav-tabs/NavDropdown.astro +29 -63
- package/stl-docs/components/nav-tabs/NavTabs.astro +79 -65
- package/stl-docs/components/nav-tabs/SecondaryNavTabs.astro +15 -7
- package/stl-docs/components/nav-tabs/buildNavLinks.ts +4 -3
- package/stl-docs/components/pagination/HomeLink.astro +10 -0
- package/stl-docs/components/pagination/Pagination.astro +173 -0
- package/stl-docs/components/pagination/PaginationLinkEmphasized.astro +22 -0
- package/stl-docs/components/pagination/PaginationLinkQuiet.astro +13 -0
- package/stl-docs/components/pagination/util.ts +71 -0
- package/stl-docs/components/scripts.ts +1 -0
- package/stl-docs/components/{Sidebar.astro → sidebars/BaseSidebar.astro} +2 -3
- package/stl-docs/components/sidebars/SDKSelectSidebar.astro +8 -0
- package/stl-docs/disableCalloutSyntax.ts +36 -0
- package/stl-docs/index.ts +76 -27
- package/stl-docs/loadStlDocsConfig.ts +35 -5
- package/stl-docs/proseMarkdown/proseMarkdownIntegration.ts +64 -0
- package/stl-docs/proseMarkdown/proseMarkdownMiddleware.ts +34 -0
- package/stl-docs/proseMarkdown/toMarkdown.ts +158 -0
- package/stl-docs/tabsMiddleware.ts +12 -4
- package/styles/code.css +115 -127
- package/styles/fonts.css +32 -17
- package/styles/links.css +10 -49
- package/styles/overrides.css +53 -57
- package/styles/page.css +90 -59
- package/styles/sdk_select.css +9 -7
- package/styles/search.css +59 -69
- package/styles/sidebar.css +190 -127
- package/styles/toc.css +37 -33
- package/theme.css +9 -1
- package/tsconfig.json +2 -5
- package/virtual-module.d.ts +7 -2
- package/plugin/globalJs/ai-dropdown.ts +0 -57
- package/stl-docs/components/APIReferenceAIDropdown.tsx +0 -86
- package/stl-docs/components/content-panel/ProseAIDropdown.tsx +0 -64
- /package/{plugin/assets → assets}/fonts/geist/OFL.txt +0 -0
- /package/{plugin/assets → assets}/fonts/geist/geist-italic-latin-ext.woff2 +0 -0
- /package/{plugin/assets → assets}/fonts/geist/geist-italic-latin.woff2 +0 -0
- /package/{plugin/assets → assets}/fonts/geist/geist-latin-ext.woff2 +0 -0
- /package/{plugin/assets → assets}/fonts/geist/geist-latin.woff2 +0 -0
- /package/{plugin/assets → assets}/fonts/geist/geist-mono-italic-latin-ext.woff2 +0 -0
- /package/{plugin/assets → assets}/fonts/geist/geist-mono-italic-latin.woff2 +0 -0
- /package/{plugin/assets → assets}/fonts/geist/geist-mono-latin-ext.woff2 +0 -0
- /package/{plugin/assets → assets}/fonts/geist/geist-mono-latin.woff2 +0 -0
|
@@ -1,44 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
flex-direction: column;
|
|
10
|
-
|
|
11
|
-
.stl-ui-mintlify-compat-card-icon svg {
|
|
12
|
-
color: var(--sl-color-accent);
|
|
13
|
-
}
|
|
1
|
+
.stl-ui-mintlify-compat-card {
|
|
2
|
+
border-radius: 12px;
|
|
3
|
+
padding: 16px;
|
|
4
|
+
font-size: var(--sl-text-body);
|
|
5
|
+
display: flex;
|
|
6
|
+
gap: 8px;
|
|
7
|
+
border: 1px solid var(--sl-color-hairline);
|
|
8
|
+
flex-direction: column;
|
|
14
9
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
display: flex;
|
|
19
|
-
align-items: center;
|
|
20
|
-
gap: 8px;
|
|
21
|
-
margin-top: 8px;
|
|
22
|
-
}
|
|
10
|
+
.stl-ui-mintlify-compat-card-icon svg {
|
|
11
|
+
color: var(--sl-color-accent);
|
|
12
|
+
}
|
|
23
13
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
14
|
+
.stl-ui-mintlify-compat-card-title {
|
|
15
|
+
font-weight: 600;
|
|
16
|
+
font-size: 1.125rem;
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
gap: 8px;
|
|
20
|
+
margin-top: 8px;
|
|
28
21
|
}
|
|
29
22
|
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
.stl-ui-mintlify-compat-card-content {
|
|
24
|
+
margin-top: 0;
|
|
32
25
|
color: var(--sl-color-text-secondary);
|
|
33
|
-
|
|
34
|
-
&:hover {
|
|
35
|
-
border-color: var(--sl-color-accent);
|
|
36
|
-
}
|
|
37
26
|
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
a.stl-ui-mintlify-compat-card {
|
|
30
|
+
text-decoration: none;
|
|
31
|
+
color: var(--sl-color-text-secondary);
|
|
38
32
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
gap: 1rem;
|
|
42
|
-
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
33
|
+
&:hover {
|
|
34
|
+
border-color: var(--sl-color-accent);
|
|
43
35
|
}
|
|
44
36
|
}
|
|
37
|
+
|
|
38
|
+
.stl-ui-mintlify-compat-card-group {
|
|
39
|
+
display: grid;
|
|
40
|
+
gap: 1rem;
|
|
41
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
42
|
+
}
|
|
@@ -1,77 +1,48 @@
|
|
|
1
1
|
---
|
|
2
|
-
import {
|
|
3
|
-
Dropdown,
|
|
4
|
-
DropdownTrigger,
|
|
5
|
-
DropdownMenu,
|
|
6
|
-
DropdownItem,
|
|
7
|
-
} from '@stainless-api/docs-ui/src/components/dropdown';
|
|
8
|
-
import { Icon } from '@astrojs/starlight/components';
|
|
2
|
+
import { Dropdown } from '@stainless-api/docs/components';
|
|
9
3
|
import { buildNavLinks } from './buildNavLinks';
|
|
10
|
-
|
|
11
|
-
export interface Props {
|
|
12
|
-
useHamburgerIcon?: boolean;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const { useHamburgerIcon = false } = Astro.props as Props;
|
|
16
|
-
const BUTTON_ID = 'nav-dropdown-button';
|
|
4
|
+
import { ChevronsUpDownIcon } from 'lucide-react';
|
|
17
5
|
|
|
18
6
|
const navLinks = buildNavLinks(Astro.locals.starlightRoute);
|
|
19
7
|
|
|
20
|
-
const buttonText = (navLinks.find((item) => item.active) ?? navLinks[0]).label;
|
|
8
|
+
const buttonText = (navLinks.find((item) => item.active) ?? navLinks[0]!).label;
|
|
21
9
|
---
|
|
22
10
|
|
|
23
|
-
<
|
|
24
|
-
<Dropdown
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
</
|
|
11
|
+
<Dropdown id="nav-dropdown" className="nav-dropdown-root">
|
|
12
|
+
<Dropdown.Trigger>
|
|
13
|
+
<Dropdown.TriggerSelectedItem>{buttonText}</Dropdown.TriggerSelectedItem>
|
|
14
|
+
<Dropdown.TriggerIcon>
|
|
15
|
+
<ChevronsUpDownIcon size={16} />
|
|
16
|
+
</Dropdown.TriggerIcon>
|
|
17
|
+
</Dropdown.Trigger>
|
|
18
|
+
<Dropdown.Menu className="dropdown-menu">
|
|
19
|
+
{
|
|
20
|
+
navLinks.map((item) => (
|
|
21
|
+
<Dropdown.MenuItem
|
|
22
|
+
key={item.link}
|
|
23
|
+
href={item.link}
|
|
24
|
+
className="dropdown-item"
|
|
25
|
+
value={item.label}
|
|
26
|
+
isSelected={item.label === buttonText}
|
|
27
|
+
>
|
|
28
|
+
{item.label}
|
|
29
|
+
<Dropdown.MenuItemTemplate>{item.label}</Dropdown.MenuItemTemplate>
|
|
30
|
+
</Dropdown.MenuItem>
|
|
31
|
+
))
|
|
32
|
+
}
|
|
33
|
+
</Dropdown.Menu>
|
|
34
|
+
</Dropdown>
|
|
46
35
|
|
|
47
36
|
<script>
|
|
48
|
-
import { initDropdown } from '@stainless-api/docs
|
|
37
|
+
import { initDropdown } from '@stainless-api/docs/components/scripts';
|
|
49
38
|
import { getPageLoadEvent } from '../../../plugin/helpers/getPageLoadEvent';
|
|
50
39
|
|
|
51
40
|
document.addEventListener(getPageLoadEvent(), () => {
|
|
52
41
|
initDropdown({
|
|
53
|
-
|
|
54
|
-
isFixed: true,
|
|
42
|
+
root: document.getElementById('nav-dropdown'),
|
|
55
43
|
});
|
|
56
44
|
});
|
|
57
45
|
</script>
|
|
58
|
-
<style is:global>
|
|
59
|
-
.nav-dropdown-root .dropdown-menu.stldocs-dropdown-menu {
|
|
60
|
-
display: none;
|
|
61
|
-
position: fixed;
|
|
62
|
-
z-index: 1000;
|
|
63
|
-
width: 200px;
|
|
64
|
-
margin: 0.125rem 0 0;
|
|
65
|
-
font-size: 1rem;
|
|
66
|
-
text-align: left;
|
|
67
|
-
list-style: none;
|
|
68
|
-
background-clip: padding-box;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.nav-dropdown-root .dropdown-menu.open {
|
|
72
|
-
display: block;
|
|
73
|
-
}
|
|
74
|
-
</style>
|
|
75
46
|
|
|
76
47
|
<style>
|
|
77
48
|
:root {
|
|
@@ -98,9 +69,4 @@ const buttonText = (navLinks.find((item) => item.active) ?? navLinks[0]).label;
|
|
|
98
69
|
.nav-dropdown-root {
|
|
99
70
|
background-color: var(--sl-color-bg-nav);
|
|
100
71
|
}
|
|
101
|
-
|
|
102
|
-
.nav-dropdown-button {
|
|
103
|
-
color: var(--sl-color-text);
|
|
104
|
-
font-weight: 500;
|
|
105
|
-
}
|
|
106
72
|
</style>
|
|
@@ -7,80 +7,98 @@ import clsx from 'clsx';
|
|
|
7
7
|
const navLinks = buildNavLinks(Astro.locals.starlightRoute);
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
<div id="nav-links-container">
|
|
11
|
-
<
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
<ul class="nav-links" id="nav-links-test-container">
|
|
32
|
-
{
|
|
33
|
-
navLinks.map((item) => (
|
|
34
|
-
<li>
|
|
35
|
-
<Button href={item.link} className={clsx('nav-link')} variant={item.active ? 'accent' : 'ghost'}>
|
|
36
|
-
<span>{item.label}</span>
|
|
37
|
-
</Button>
|
|
38
|
-
</li>
|
|
39
|
-
))
|
|
40
|
-
}
|
|
41
|
-
</ul>
|
|
10
|
+
<div id="nav-links-container" class="nav-links-container">
|
|
11
|
+
<div class="desktop-nav-links-container">
|
|
12
|
+
<ul class="nav-links" id="nav-links-list">
|
|
13
|
+
{
|
|
14
|
+
navLinks.map((item) => (
|
|
15
|
+
<li data-desktop-only>
|
|
16
|
+
<Button
|
|
17
|
+
href={item.link}
|
|
18
|
+
className={clsx('nav-link')}
|
|
19
|
+
variant={item.active ? 'accent-muted' : 'ghost'}
|
|
20
|
+
>
|
|
21
|
+
<span>{item.label}</span>
|
|
22
|
+
</Button>
|
|
23
|
+
</li>
|
|
24
|
+
))
|
|
25
|
+
}
|
|
26
|
+
</ul>
|
|
27
|
+
</div>
|
|
28
|
+
<div class="mobile-nav-dropdown" data-mobile-only>
|
|
29
|
+
<NavDropdown />
|
|
30
|
+
</div>
|
|
42
31
|
</div>
|
|
43
32
|
|
|
44
33
|
<script>
|
|
45
34
|
import { getPageLoadEvent } from '../../../plugin/helpers/getPageLoadEvent';
|
|
46
35
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
36
|
+
// We need to measure the nav links to see if they fit. We create an offscreen hidden clone for measurement.
|
|
37
|
+
function createOffscreenClone(element: HTMLElement): HTMLElement {
|
|
38
|
+
const clone = element.cloneNode(true) as HTMLElement;
|
|
39
|
+
clone.removeAttribute('id');
|
|
40
|
+
clone.id = 'cloned-nav-links-measurement';
|
|
41
|
+
clone.style.position = 'absolute';
|
|
42
|
+
clone.style.visibility = 'hidden';
|
|
43
|
+
clone.style.top = '0';
|
|
44
|
+
clone.style.left = '0';
|
|
45
|
+
clone.style.width = 'auto';
|
|
46
|
+
clone.style.whiteSpace = 'nowrap';
|
|
47
|
+
clone.style.pointerEvents = 'none';
|
|
48
|
+
clone.style.zIndex = '-9999';
|
|
49
|
+
|
|
50
|
+
clone.querySelectorAll('[data-desktop-only], [data-mobile-only]').forEach((el) => {
|
|
51
|
+
el.removeAttribute('data-desktop-only');
|
|
52
|
+
});
|
|
50
53
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return rw;
|
|
54
|
+
document.body.appendChild(clone);
|
|
55
|
+
return clone;
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
function initNavbar() {
|
|
57
|
-
const
|
|
58
|
-
if (!
|
|
59
|
+
const navLinksContainer = document.getElementById('nav-links-container');
|
|
60
|
+
if (!navLinksContainer) {
|
|
61
|
+
console.error(`NavTabs: #nav-links-container not found`);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const navLinksList = document.getElementById('nav-links-list');
|
|
66
|
+
if (!navLinksList) {
|
|
67
|
+
console.error(`NavTabs: #nav-links-list not found`);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
59
70
|
|
|
60
|
-
const
|
|
61
|
-
|
|
71
|
+
const measurementClone = createOffscreenClone(navLinksList);
|
|
72
|
+
const requiredWidth = measurementClone.clientWidth;
|
|
62
73
|
|
|
63
|
-
|
|
74
|
+
let currentMode: 'desktop' | 'mobile' | null = null;
|
|
64
75
|
|
|
65
76
|
function checkIfFits() {
|
|
66
|
-
if (!masterContainer) return;
|
|
67
77
|
if (!navLinksContainer) return;
|
|
68
|
-
|
|
69
|
-
|
|
78
|
+
|
|
79
|
+
// 16px buffer helps it feel less crowded before switching modes
|
|
80
|
+
const bufferSpace = 16;
|
|
81
|
+
const availableWidth = navLinksContainer.clientWidth;
|
|
82
|
+
const canFit = availableWidth - bufferSpace >= requiredWidth;
|
|
70
83
|
|
|
71
84
|
const mode = canFit ? 'desktop' : 'mobile';
|
|
72
85
|
|
|
73
|
-
|
|
86
|
+
// Only update if mode actually changed
|
|
87
|
+
if (mode === currentMode) return;
|
|
74
88
|
|
|
75
|
-
|
|
76
|
-
document.documentElement.classList.remove('stl-nav-links-mode-mobile');
|
|
89
|
+
currentMode = mode;
|
|
77
90
|
|
|
91
|
+
localStorage.setItem('stl-nav-links-mode', mode);
|
|
92
|
+
|
|
93
|
+
document.documentElement.classList.remove('stl-nav-links-mode-desktop', 'stl-nav-links-mode-mobile');
|
|
78
94
|
document.documentElement.classList.add('stl-nav-links-mode-' + mode);
|
|
79
95
|
}
|
|
80
96
|
|
|
81
|
-
|
|
97
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
82
98
|
checkIfFits();
|
|
83
99
|
});
|
|
100
|
+
|
|
101
|
+
resizeObserver.observe(navLinksContainer);
|
|
84
102
|
checkIfFits();
|
|
85
103
|
}
|
|
86
104
|
|
|
@@ -109,18 +127,17 @@ const navLinks = buildNavLinks(Astro.locals.starlightRoute);
|
|
|
109
127
|
</style>
|
|
110
128
|
|
|
111
129
|
<style>
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
130
|
+
.nav-links-container {
|
|
131
|
+
flex-grow: 1;
|
|
132
|
+
margin-left: 1rem;
|
|
133
|
+
margin-right: 1rem;
|
|
134
|
+
}
|
|
115
135
|
|
|
116
|
-
|
|
117
|
-
visibility: hidden;
|
|
136
|
+
.desktop-nav-links-container {
|
|
118
137
|
display: flex;
|
|
119
138
|
flex-grow: 1;
|
|
120
139
|
justify-content: flex-start;
|
|
121
140
|
overflow: hidden;
|
|
122
|
-
margin-left: 1rem;
|
|
123
|
-
margin-right: 1rem;
|
|
124
141
|
}
|
|
125
142
|
|
|
126
143
|
.nav-links {
|
|
@@ -133,13 +150,6 @@ const navLinks = buildNavLinks(Astro.locals.starlightRoute);
|
|
|
133
150
|
overflow: hidden;
|
|
134
151
|
}
|
|
135
152
|
|
|
136
|
-
#nav-links-test-container {
|
|
137
|
-
position: absolute;
|
|
138
|
-
top: 0;
|
|
139
|
-
left: 0;
|
|
140
|
-
visibility: hidden;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
153
|
.nav-links li {
|
|
144
154
|
display: flex;
|
|
145
155
|
align-items: center;
|
|
@@ -156,8 +166,12 @@ const navLinks = buildNavLinks(Astro.locals.starlightRoute);
|
|
|
156
166
|
}
|
|
157
167
|
}
|
|
158
168
|
|
|
169
|
+
.mobile-nav-dropdown {
|
|
170
|
+
flex-grow: 1;
|
|
171
|
+
}
|
|
172
|
+
|
|
159
173
|
@media (min-width: 50rem) {
|
|
160
|
-
|
|
174
|
+
.desktop-nav-links-container {
|
|
161
175
|
display: flex;
|
|
162
176
|
visibility: visible;
|
|
163
177
|
}
|
|
@@ -34,13 +34,8 @@ const navLinks = buildNavLinks(Astro.locals.starlightRoute);
|
|
|
34
34
|
align-items: center;
|
|
35
35
|
padding: 0;
|
|
36
36
|
list-style: none;
|
|
37
|
-
overflow-x: auto;
|
|
38
37
|
margin-bottom: -1px;
|
|
39
|
-
gap:
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.stl-active-secondary-link:hover {
|
|
43
|
-
background-color: transparent;
|
|
38
|
+
gap: 4px;
|
|
44
39
|
}
|
|
45
40
|
|
|
46
41
|
li {
|
|
@@ -50,13 +45,26 @@ const navLinks = buildNavLinks(Astro.locals.starlightRoute);
|
|
|
50
45
|
&.active {
|
|
51
46
|
border-color: var(--sl-color-text-accent);
|
|
52
47
|
}
|
|
48
|
+
|
|
49
|
+
.stl-ui-button {
|
|
50
|
+
/* match sidebar. TODO: hoist sidebar variables to use those instead of hardcoding? */
|
|
51
|
+
border-width: 0;
|
|
52
|
+
padding: 8px 12px;
|
|
53
|
+
margin-inline: -12px;
|
|
54
|
+
}
|
|
55
|
+
/* cover for button’s negative margin */
|
|
56
|
+
&:not(:first-child) {
|
|
57
|
+
margin-inline-start: 12px;
|
|
58
|
+
}
|
|
59
|
+
&:not(:last-child) {
|
|
60
|
+
margin-inline-end: 12px;
|
|
61
|
+
}
|
|
53
62
|
}
|
|
54
63
|
}
|
|
55
64
|
|
|
56
65
|
@media (min-width: 50rem) {
|
|
57
66
|
.stl-secondary-nav-tabs {
|
|
58
67
|
display: block;
|
|
59
|
-
padding-left: 0.55rem;
|
|
60
68
|
}
|
|
61
69
|
}
|
|
62
70
|
</style>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { StarlightRouteData } from '@astrojs/starlight/route-data';
|
|
2
|
-
import { TABS } from 'virtual:stl-
|
|
2
|
+
import { TABS } from 'virtual:stl-docs-virtual-module';
|
|
3
|
+
import type { StarlightRouteWithStlDocs } from '../../tabsMiddleware';
|
|
3
4
|
|
|
4
5
|
export function buildNavLinks(starlightRoute: StarlightRouteData) {
|
|
5
|
-
|
|
6
|
-
const activeTabIndex =
|
|
6
|
+
const routeData: StarlightRouteWithStlDocs = starlightRoute;
|
|
7
|
+
const activeTabIndex = routeData?._stlDocs?.activeTabIndex;
|
|
7
8
|
|
|
8
9
|
const navLinks = TABS.map((item, index) => ({
|
|
9
10
|
...item,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { base } from 'astro:config/client';
|
|
3
|
+
import { HomeIcon } from 'lucide-react';
|
|
4
|
+
import PaginationLinkQuiet from './PaginationLinkQuiet.astro';
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<PaginationLinkQuiet href={base}>
|
|
8
|
+
<HomeIcon slot="icon" />
|
|
9
|
+
Home
|
|
10
|
+
</PaginationLinkQuiet>
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
---
|
|
2
|
+
import HomeLink from './HomeLink.astro';
|
|
3
|
+
import PaginationLinkEmphasized from './PaginationLinkEmphasized.astro';
|
|
4
|
+
|
|
5
|
+
import { getPrevNextPage } from './util';
|
|
6
|
+
import config from 'virtual:starlight/user-config';
|
|
7
|
+
const { prev, next } = (await getPrevNextPage(Astro.locals.starlightRoute, config.pagination)) ?? {};
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
{
|
|
11
|
+
next || prev ? (
|
|
12
|
+
<div class="pagination-links print:hidden stl-ui-not-prose">
|
|
13
|
+
{/* Previous */}
|
|
14
|
+
{!prev && <HomeLink />}
|
|
15
|
+
{/* TODO: intelligently decide whether or not to emphasize the previous page - including user config option (page level?) */}
|
|
16
|
+
{/* {prev && next && (
|
|
17
|
+
<PaginationLinkQuiet href={prev.href}>
|
|
18
|
+
<ChevronLeftIcon slot="icon" />
|
|
19
|
+
Previous
|
|
20
|
+
</PaginationLinkQuiet>
|
|
21
|
+
)} */}
|
|
22
|
+
{prev && (
|
|
23
|
+
<PaginationLinkEmphasized href={prev.href} direction="prev">
|
|
24
|
+
<h2 slot="page-title">{prev.label}</h2>
|
|
25
|
+
{prev.description && <p slot="page-description">{prev.description}</p>}
|
|
26
|
+
</PaginationLinkEmphasized>
|
|
27
|
+
)}
|
|
28
|
+
|
|
29
|
+
{/* Next */}
|
|
30
|
+
{!next && <HomeLink />}
|
|
31
|
+
{next && (
|
|
32
|
+
<PaginationLinkEmphasized href={next.href} direction="next">
|
|
33
|
+
<h2 slot="page-title">{next.label}</h2>
|
|
34
|
+
{next.description && <p slot="page-description">{next.description}</p>}
|
|
35
|
+
</PaginationLinkEmphasized>
|
|
36
|
+
)}
|
|
37
|
+
</div>
|
|
38
|
+
) : null
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
<style is:global>
|
|
42
|
+
@layer starlight.core {
|
|
43
|
+
.pagination-links,
|
|
44
|
+
.pagination-links a,
|
|
45
|
+
.pagination-links a:hover,
|
|
46
|
+
.pagination-links a[rel='next'],
|
|
47
|
+
.link-title {
|
|
48
|
+
all: revert-layer;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.pagination-links {
|
|
53
|
+
--stl-ui-pagination-padding: 8px;
|
|
54
|
+
--stl-ui-pagination-border-radius-inner: var(--stl-ui-layout-border-radius-sml);
|
|
55
|
+
|
|
56
|
+
padding: var(--stl-ui-pagination-padding);
|
|
57
|
+
background-color: var(--stl-ui-muted-background);
|
|
58
|
+
border: 1px solid var(--stl-ui-border);
|
|
59
|
+
border-radius: calc(var(--stl-ui-pagination-border-radius-inner) + var(--stl-ui-pagination-padding));
|
|
60
|
+
|
|
61
|
+
font-size: var(--stl-ui-type-scale-text-sm);
|
|
62
|
+
letter-spacing: normal;
|
|
63
|
+
|
|
64
|
+
display: flex;
|
|
65
|
+
gap: 8px;
|
|
66
|
+
|
|
67
|
+
margin-bottom: 2rem;
|
|
68
|
+
|
|
69
|
+
a {
|
|
70
|
+
border-radius: var(--stl-ui-pagination-border-radius-inner);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.pagination-links__link {
|
|
75
|
+
display: flex;
|
|
76
|
+
border-radius: var(--stl-ui-pagination-border-radius-inner);
|
|
77
|
+
padding: 8px 12px;
|
|
78
|
+
display: flex;
|
|
79
|
+
text-decoration: none;
|
|
80
|
+
align-items: center;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.pagination-links__link--emphasized {
|
|
84
|
+
background-color: var(--stl-ui-background);
|
|
85
|
+
border: 1px solid var(--stl-ui-border);
|
|
86
|
+
flex: 1 1 50%;
|
|
87
|
+
gap: 12px;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.pagination-links__link--quiet {
|
|
91
|
+
flex: 0 1 auto;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.pagination-links__button {
|
|
95
|
+
display: flex;
|
|
96
|
+
align-items: center;
|
|
97
|
+
padding: 8px 14px;
|
|
98
|
+
font-weight: 500;
|
|
99
|
+
line-height: 1;
|
|
100
|
+
|
|
101
|
+
svg {
|
|
102
|
+
width: 16px;
|
|
103
|
+
height: 16px;
|
|
104
|
+
margin-block: -4px;
|
|
105
|
+
margin-inline-start: -6px;
|
|
106
|
+
margin-inline-end: 6px;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
&.pagination-links__link--quiet {
|
|
110
|
+
padding-inline: 22px;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.pagination-links__link__divider {
|
|
115
|
+
border: 0;
|
|
116
|
+
border-inline-start: 1px solid var(--stl-ui-border);
|
|
117
|
+
align-self: stretch;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.pagination-links__page-description {
|
|
121
|
+
padding-block: 4px;
|
|
122
|
+
padding-inline-start: 8px;
|
|
123
|
+
padding-inline-end: 2px;
|
|
124
|
+
line-height: 1.5;
|
|
125
|
+
flex: 1 1 50%;
|
|
126
|
+
width: 0;
|
|
127
|
+
|
|
128
|
+
h2,
|
|
129
|
+
p {
|
|
130
|
+
white-space: nowrap;
|
|
131
|
+
overflow: hidden;
|
|
132
|
+
text-overflow: ellipsis;
|
|
133
|
+
}
|
|
134
|
+
h2 {
|
|
135
|
+
font-size: inherit;
|
|
136
|
+
font-weight: 500;
|
|
137
|
+
}
|
|
138
|
+
p {
|
|
139
|
+
font-size: var(--stl-ui-type-scale-text-xs);
|
|
140
|
+
color: var(--stl-ui-foreground-muted);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.pagination-links__link--quiet:hover {
|
|
145
|
+
background-color: rgb(from var(--stl-ui-foreground) r g b / 0.05);
|
|
146
|
+
}
|
|
147
|
+
.pagination-links__link--emphasized:hover {
|
|
148
|
+
border-color: var(--stl-ui-border-emphasis);
|
|
149
|
+
.pagination-links__page-description h2 {
|
|
150
|
+
text-decoration: underline;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/* “next” link runs the opposite direction of the “previous” link */
|
|
155
|
+
.pagination-links__link:last-child {
|
|
156
|
+
flex-direction: row-reverse;
|
|
157
|
+
|
|
158
|
+
&.pagination-links__button,
|
|
159
|
+
.pagination-links__button {
|
|
160
|
+
flex-direction: row-reverse;
|
|
161
|
+
svg {
|
|
162
|
+
margin-inline-start: 6px;
|
|
163
|
+
margin-inline-end: -6px;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.pagination-links__page-description {
|
|
168
|
+
padding-inline-start: 2px;
|
|
169
|
+
padding-inline-end: 8px;
|
|
170
|
+
text-align: right;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
</style>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';
|
|
3
|
+
const { href, direction } = Astro.props;
|
|
4
|
+
export interface Props {
|
|
5
|
+
href: string;
|
|
6
|
+
direction: 'prev' | 'next';
|
|
7
|
+
}
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
<a href={href} class="pagination-links__link pagination-links__link--emphasized">
|
|
11
|
+
<div class="pagination-links__button">
|
|
12
|
+
{{ prev: <ChevronLeftIcon />, next: <ChevronRightIcon /> }[direction]}
|
|
13
|
+
<span>{{ prev: 'Previous', next: 'Next' }[direction]}</span>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<hr class="pagination-links__link__divider" />
|
|
17
|
+
|
|
18
|
+
<article class="pagination-links__page-description">
|
|
19
|
+
<slot name="page-title" />
|
|
20
|
+
<slot name="page-description" />
|
|
21
|
+
</article>
|
|
22
|
+
</a>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
const { href } = Astro.props;
|
|
3
|
+
export interface Props {
|
|
4
|
+
href: string;
|
|
5
|
+
}
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<a href={href} class="pagination-links__link pagination-links__button pagination-links__link--quiet">
|
|
9
|
+
<slot name="icon" />
|
|
10
|
+
<span>
|
|
11
|
+
<slot />
|
|
12
|
+
</span>
|
|
13
|
+
</a>
|