@stainless-api/docs 0.1.0-beta.99 → 1.0.0-beta.141

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.
Files changed (136) hide show
  1. package/CHANGELOG.md +401 -0
  2. package/ambient.d.ts +6 -0
  3. package/eslint-suppressions.json +22 -6
  4. package/{eslint.config.js → eslint.config.ts} +1 -7
  5. package/package.json +62 -40
  6. package/plugin/buildAlgoliaIndex.ts +6 -12
  7. package/plugin/components/SDKSelect.astro +0 -6
  8. package/plugin/components/SnippetCode.tsx +6 -37
  9. package/plugin/components/search/SearchAlgolia.astro +1 -1
  10. package/plugin/components/search/SearchIsland.tsx +19 -13
  11. package/plugin/generateAPIReferenceLink.ts +0 -40
  12. package/plugin/globalJs/ai-dropdown-options.ts +22 -9
  13. package/plugin/globalJs/code-snippets.ts +5 -5
  14. package/plugin/globalJs/copy.ts +20 -91
  15. package/plugin/globalJs/navigation.ts +13 -13
  16. package/plugin/globalJs/summary-selection-tweak.ts +29 -0
  17. package/plugin/index.ts +107 -163
  18. package/plugin/loadPluginConfig.ts +49 -151
  19. package/plugin/markdown/highlighter.ts +100 -0
  20. package/plugin/markdown/index.ts +39 -0
  21. package/plugin/middlewareBuilder/stainlessMiddleware.d.ts +2 -0
  22. package/plugin/react/Routing.tsx +10 -244
  23. package/plugin/referencePlaceholderUtils.ts +1 -1
  24. package/plugin/replaceSidebarPlaceholderMiddleware.ts +1 -1
  25. package/plugin/routes/Docs.astro +3 -1
  26. package/plugin/routes/Overview.astro +14 -7
  27. package/plugin/routes/llms.ts +186 -0
  28. package/plugin/routes/markdown.ts +62 -13
  29. package/plugin/sidebar-utils/sidebar-builder.ts +38 -12
  30. package/plugin/specs/defaultSpecLoader.ts +192 -0
  31. package/plugin/specs/fetchSpecSSR.ts +1 -1
  32. package/plugin/specs/utils.ts +86 -0
  33. package/shared/conditionalIntegration.ts +28 -0
  34. package/shared/getProsePages.ts +6 -7
  35. package/shared/virtualModule.ts +1 -26
  36. package/stl-docs/aiChatExamples.ts +31 -0
  37. package/stl-docs/chat/docs-chat-handler.ts +17 -0
  38. package/stl-docs/chat/hook.ts +225 -0
  39. package/stl-docs/chat/schemas.ts +27 -0
  40. package/stl-docs/chat/ui/AiChat.module.css +591 -0
  41. package/stl-docs/chat/ui/AiChat.tsx +175 -0
  42. package/stl-docs/chat/ui/Trigger.tsx +154 -0
  43. package/stl-docs/chat/ui/components/ChatControls.tsx +51 -0
  44. package/stl-docs/chat/ui/components/ChatEmpty.tsx +42 -0
  45. package/stl-docs/chat/ui/components/ChatLog.tsx +93 -0
  46. package/stl-docs/chat/ui/components/ChatMessage.tsx +47 -0
  47. package/stl-docs/chat/ui/components/CodeBlock.tsx +33 -0
  48. package/stl-docs/chat/ui/components/MessageFeedback.tsx +106 -0
  49. package/stl-docs/chat/ui/components/Table.tsx +15 -0
  50. package/stl-docs/chat/ui/components/ToolCall.tsx +34 -0
  51. package/stl-docs/chat/ui/components/hljs-github.css +81 -0
  52. package/stl-docs/chat/ui/scroll-manager.ts +86 -0
  53. package/stl-docs/chat/ui/types.ts +45 -0
  54. package/stl-docs/components/AiChatIsland.tsx +10 -12
  55. package/stl-docs/components/ContentPanel.astro +9 -0
  56. package/stl-docs/components/Footer.astro +89 -0
  57. package/stl-docs/components/Header.astro +0 -5
  58. package/stl-docs/components/PageFrame.astro +23 -8
  59. package/stl-docs/components/PageSidebar.astro +11 -0
  60. package/stl-docs/components/StainlessLogo.svg +4 -0
  61. package/stl-docs/components/TwoColumnContent.astro +2 -0
  62. package/stl-docs/components/headers/DefaultHeader.astro +6 -8
  63. package/stl-docs/components/headers/StackedHeader.astro +5 -53
  64. package/stl-docs/components/mintlify-compat/Accordion.astro +2 -2
  65. package/stl-docs/components/mintlify-compat/AccordionGroup.astro +0 -4
  66. package/stl-docs/components/mintlify-compat/Columns.astro +2 -2
  67. package/stl-docs/components/mintlify-compat/Frame.astro +2 -2
  68. package/stl-docs/components/mintlify-compat/Tab.astro +2 -2
  69. package/stl-docs/components/mintlify-compat/callouts/Callout.astro +2 -2
  70. package/stl-docs/components/mintlify-compat/callouts/Check.astro +0 -4
  71. package/stl-docs/components/mintlify-compat/callouts/Danger.astro +0 -4
  72. package/stl-docs/components/mintlify-compat/callouts/Info.astro +0 -4
  73. package/stl-docs/components/mintlify-compat/callouts/Note.astro +0 -4
  74. package/stl-docs/components/mintlify-compat/callouts/Tip.astro +0 -4
  75. package/stl-docs/components/mintlify-compat/callouts/Warning.astro +0 -4
  76. package/stl-docs/components/nav-tabs/NavDropdown.astro +12 -7
  77. package/stl-docs/components/nav-tabs/NavTabs.astro +5 -3
  78. package/stl-docs/components/nav-tabs/buildNavLinks.ts +2 -0
  79. package/stl-docs/components/pagination/Pagination.astro +4 -2
  80. package/stl-docs/components/pagination/PaginationLinkEmphasized.astro +2 -2
  81. package/stl-docs/components/pagination/PaginationLinkQuiet.astro +2 -2
  82. package/stl-docs/components/pagination/util.ts +3 -3
  83. package/stl-docs/components/sidebars/BaseSidebar.astro +72 -1
  84. package/stl-docs/disableCalloutSyntax.ts +1 -1
  85. package/stl-docs/fonts.ts +5 -5
  86. package/stl-docs/index.ts +76 -53
  87. package/stl-docs/loadStlDocsConfig.ts +38 -8
  88. package/stl-docs/og-image/components/OpenGraphFunctionSignature.tsx +64 -0
  89. package/stl-docs/og-image/components/OpenGraphImage.tsx +126 -0
  90. package/stl-docs/og-image/config.ts +56 -0
  91. package/stl-docs/og-image/image-gen/generate-api-reference-og-image.tsx +188 -0
  92. package/stl-docs/og-image/image-gen/generate-og-image.tsx +119 -0
  93. package/stl-docs/og-image/image-gen/get-logo-url.ts +47 -0
  94. package/stl-docs/og-image/index.ts +135 -0
  95. package/stl-docs/og-image/routes/add-og-image.ts +45 -0
  96. package/stl-docs/og-image/routes/get-api-reference-og-image.ts +36 -0
  97. package/stl-docs/og-image/routes/get-og-image.ts +28 -0
  98. package/stl-docs/og-image/theme.ts +43 -0
  99. package/stl-docs/og-image/utils.ts +14 -0
  100. package/stl-docs/proseDocSync.test.ts +74 -0
  101. package/stl-docs/proseDocSync.ts +344 -0
  102. package/stl-docs/proseMarkdown/proseMarkdownIntegration.ts +4 -12
  103. package/stl-docs/schema-extension.ts +12 -0
  104. package/stl-docs/tabsMiddleware.ts +1 -1
  105. package/styles/overrides.css +2 -14
  106. package/styles/page.css +210 -71
  107. package/styles/sidebar.css +30 -17
  108. package/styles/sl-variables.css +3 -8
  109. package/styles/stldocs-variables.css +2 -2
  110. package/styles/toc.css +8 -0
  111. package/tsconfig.json +1 -1
  112. package/virtual-module.d.ts +35 -11
  113. package/playground-virtual-modules.d.ts +0 -96
  114. package/plugin/globalJs/create-playground.shim.ts +0 -3
  115. package/plugin/globalJs/playground-data.shim.ts +0 -1
  116. package/plugin/globalJs/playground-data.ts +0 -14
  117. package/plugin/specs/FileCache.ts +0 -99
  118. package/plugin/specs/generateSpec.ts +0 -112
  119. package/plugin/specs/index.ts +0 -132
  120. package/plugin/specs/inputResolver.ts +0 -146
  121. package/plugin/specs/worker.ts +0 -199
  122. package/plugin/vendor/preview.worker.docs.js +0 -26108
  123. package/plugin/vendor/templates/cli.md +0 -1
  124. package/plugin/vendor/templates/go.md +0 -316
  125. package/plugin/vendor/templates/java.md +0 -89
  126. package/plugin/vendor/templates/kotlin.md +0 -89
  127. package/plugin/vendor/templates/node.md +0 -235
  128. package/plugin/vendor/templates/python.md +0 -251
  129. package/plugin/vendor/templates/ruby.md +0 -147
  130. package/plugin/vendor/templates/terraform.md +0 -60
  131. package/plugin/vendor/templates/typescript.md +0 -319
  132. package/scripts/vendor_deps.ts +0 -50
  133. package/stl-docs/components/ClientRouterHead.astro +0 -41
  134. package/stl-docs/components/content-panel/ContentPanel.astro +0 -42
  135. package/stl-docs/components/headers/SplashMobileMenuToggle.astro +0 -65
  136. package/stl-docs/proseSearchIndexing.ts +0 -606
@@ -3,32 +3,26 @@ import LanguageSelect from 'virtual:starlight/components/LanguageSelect';
3
3
  import Search from 'virtual:starlight/components/Search';
4
4
  import SiteTitle from 'virtual:starlight/components/SiteTitle';
5
5
  import HeaderLinks from './HeaderLinks.astro';
6
- import { TABS } from 'virtual:stl-docs-virtual-module';
7
6
  import ThemeSelect from 'virtual:starlight/components/ThemeSelect';
8
7
  import SecondaryNavTabs from '../nav-tabs/SecondaryNavTabs.astro';
9
- import SplashMobileMenuToggle from './SplashMobileMenuToggle.astro';
10
8
 
11
- interface Props {
9
+ type Props = {
12
10
  shouldRenderSearch?: boolean;
13
- }
11
+ };
14
12
 
15
13
  const { shouldRenderSearch } = Astro.props;
16
- const { hasSidebar } = Astro.locals.starlightRoute;
17
14
  ---
18
15
 
19
- <div class="header my-header">
16
+ <div class="header">
20
17
  <div class="left-group">
21
18
  <div class="title-wrapper sl-flex">
22
19
  <SiteTitle />
23
20
  </div>
24
21
  </div>
25
22
 
26
- <div class="stl-top-container">
27
- {shouldRenderSearch && <Search />}
28
- {!hasSidebar && <SplashMobileMenuToggle />}
29
- </div>
23
+ {shouldRenderSearch && <Search />}
30
24
 
31
- <div class={`sl-hidden md:sl-flex print:hidden right-group`}>
25
+ <div class="right-group">
32
26
  <ThemeSelect />
33
27
  <HeaderLinks />
34
28
  <LanguageSelect />
@@ -36,45 +30,3 @@ const { hasSidebar } = Astro.locals.starlightRoute;
36
30
  </div>
37
31
 
38
32
  <SecondaryNavTabs />
39
-
40
- <style is:inline>
41
- .stl-top-container {
42
- display: flex;
43
- flex-direction: row;
44
- align-items: center;
45
- justify-content: end;
46
- gap: 0.5rem;
47
- width: 100%;
48
- }
49
- @media (min-width: 50rem) {
50
- :root {
51
- --sl-nav-height: 88px;
52
- }
53
-
54
- header.header {
55
- display: flex;
56
- flex-direction: column;
57
- gap: 0.29rem;
58
- padding-bottom: 0;
59
- }
60
-
61
- .stl-top-container {
62
- justify-content: center;
63
- }
64
- }
65
- </style>
66
-
67
- {
68
- TABS.length === 0 && (
69
- <style
70
- is:inline
71
- set:text={`
72
- @media (min-width: 50rem) {
73
- :root {
74
- --sl-nav-height: 56px;
75
- }
76
- }
77
- `}
78
- />
79
- )
80
- }
@@ -1,8 +1,8 @@
1
1
  ---
2
- export interface Props {
2
+ type Props = {
3
3
  title: string;
4
4
  children: astroHTML.JSX.Children;
5
- }
5
+ };
6
6
 
7
7
  const { title } = Astro.props;
8
8
 
@@ -1,9 +1,5 @@
1
1
  ---
2
2
  import { Accordion as StainlessAccordion } from '@stainless-api/ui-primitives';
3
-
4
- export interface Props {
5
- children: astroHTML.JSX.Children;
6
- }
7
3
  ---
8
4
 
9
5
  <StainlessAccordion.Group>
@@ -1,9 +1,9 @@
1
1
  ---
2
2
  import clsx from 'clsx';
3
3
 
4
- export interface Props {
4
+ type Props = {
5
5
  cols: number;
6
- }
6
+ };
7
7
 
8
8
  const { cols } = Astro.props;
9
9
  ---
@@ -1,7 +1,7 @@
1
1
  ---
2
- export interface Props {
2
+ type Props = {
3
3
  caption?: string;
4
- }
4
+ };
5
5
 
6
6
  const { caption } = Astro.props;
7
7
  ---
@@ -1,9 +1,9 @@
1
1
  ---
2
2
  import { TabItem } from '@astrojs/starlight/components';
3
3
 
4
- export interface Props {
4
+ type Props = {
5
5
  title: string;
6
- }
6
+ };
7
7
 
8
8
  const { title } = Astro.props;
9
9
  ---
@@ -1,10 +1,10 @@
1
1
  ---
2
2
  import { Callout as StainlessCallout, type CalloutVariant } from '@stainless-api/ui-primitives';
3
3
 
4
- export interface Props {
4
+ type Props = {
5
5
  variant?: CalloutVariant;
6
6
  children: astroHTML.JSX.Children;
7
- }
7
+ };
8
8
 
9
9
  const { variant } = Astro.props;
10
10
  ---
@@ -1,9 +1,5 @@
1
1
  ---
2
2
  import { Callout } from '@stainless-api/ui-primitives';
3
-
4
- export interface Props {
5
- children: astroHTML.JSX.Children;
6
- }
7
3
  ---
8
4
 
9
5
  <Callout variant="success">
@@ -1,9 +1,5 @@
1
1
  ---
2
2
  import { Callout } from '@stainless-api/ui-primitives';
3
-
4
- export interface Props {
5
- children: astroHTML.JSX.Children;
6
- }
7
3
  ---
8
4
 
9
5
  <Callout variant="danger">
@@ -1,9 +1,5 @@
1
1
  ---
2
2
  import { Callout } from '@stainless-api/ui-primitives';
3
-
4
- export interface Props {
5
- children: astroHTML.JSX.Children;
6
- }
7
3
  ---
8
4
 
9
5
  <Callout variant="info">
@@ -1,9 +1,5 @@
1
1
  ---
2
2
  import { Callout } from '@stainless-api/ui-primitives';
3
-
4
- export interface Props {
5
- children: astroHTML.JSX.Children;
6
- }
7
3
  ---
8
4
 
9
5
  <Callout variant="note">
@@ -1,9 +1,5 @@
1
1
  ---
2
2
  import { Callout } from '@stainless-api/ui-primitives';
3
-
4
- export interface Props {
5
- children: astroHTML.JSX.Children;
6
- }
7
3
  ---
8
4
 
9
5
  <Callout variant="tip">
@@ -1,9 +1,5 @@
1
1
  ---
2
2
  import { Callout } from '@stainless-api/ui-primitives';
3
-
4
- export interface Props {
5
- children: astroHTML.JSX.Children;
6
- }
7
3
  ---
8
4
 
9
5
  <Callout variant="warning">
@@ -1,29 +1,33 @@
1
1
  ---
2
- import { Dropdown } from '@stainless-api/docs/components';
3
- import { buildNavLinks } from './buildNavLinks';
4
2
  import { ChevronsUpDownIcon } from 'lucide-react';
3
+ import { Dropdown } from '@stainless-api/docs/components';
5
4
 
6
- const navLinks = buildNavLinks(Astro.locals.starlightRoute);
5
+ import type { NavLink } from './buildNavLinks';
7
6
 
8
- const buttonText = (navLinks.find((item) => item.active) ?? navLinks[0]!).label;
7
+ type Props = {
8
+ links: NavLink[];
9
+ currentItem: NavLink | null;
10
+ };
9
11
  ---
10
12
 
11
13
  <Dropdown id="nav-dropdown" className="nav-dropdown-root">
12
14
  <Dropdown.Trigger>
13
- <Dropdown.TriggerSelectedItem>{buttonText}</Dropdown.TriggerSelectedItem>
15
+ <Dropdown.TriggerSelectedItem>
16
+ {Astro.props.currentItem ? Astro.props.currentItem.label : 'Navigation'}
17
+ </Dropdown.TriggerSelectedItem>
14
18
  <Dropdown.TriggerIcon>
15
19
  <ChevronsUpDownIcon size={16} />
16
20
  </Dropdown.TriggerIcon>
17
21
  </Dropdown.Trigger>
18
22
  <Dropdown.Menu className="dropdown-menu">
19
23
  {
20
- navLinks.map((item) => (
24
+ Astro.props.links.map((item) => (
21
25
  <Dropdown.MenuItem
22
26
  key={item.link}
23
27
  href={item.link}
24
28
  className="dropdown-item"
25
29
  value={item.label}
26
- isSelected={item.label === buttonText}
30
+ isSelected={item.active}
27
31
  >
28
32
  {item.label}
29
33
  <Dropdown.MenuItemTemplate>{item.label}</Dropdown.MenuItemTemplate>
@@ -39,6 +43,7 @@ const buttonText = (navLinks.find((item) => item.active) ?? navLinks[0]!).label;
39
43
 
40
44
  document.addEventListener(getPageLoadEvent(), () => {
41
45
  initDropdown({
46
+ initialValue: null,
42
47
  root: document.getElementById('nav-dropdown'),
43
48
  });
44
49
  });
@@ -5,6 +5,8 @@ import NavDropdown from './NavDropdown.astro';
5
5
  import clsx from 'clsx';
6
6
 
7
7
  const navLinks = buildNavLinks(Astro.locals.starlightRoute);
8
+
9
+ const currentItem = navLinks.find((item) => item.active) ?? null;
8
10
  ---
9
11
 
10
12
  <div id="nav-links-container" class="nav-links-container">
@@ -26,7 +28,7 @@ const navLinks = buildNavLinks(Astro.locals.starlightRoute);
26
28
  </ul>
27
29
  </div>
28
30
  <div class="mobile-nav-dropdown" data-mobile-only>
29
- <NavDropdown />
31
+ {navLinks.length > 0 && <NavDropdown links={navLinks} currentItem={currentItem} />}
30
32
  </div>
31
33
  </div>
32
34
 
@@ -90,8 +92,8 @@ const navLinks = buildNavLinks(Astro.locals.starlightRoute);
90
92
 
91
93
  localStorage.setItem('stl-nav-links-mode', mode);
92
94
 
93
- document.documentElement.classList.remove('stl-nav-links-mode-desktop', 'stl-nav-links-mode-mobile');
94
- document.documentElement.classList.add('stl-nav-links-mode-' + mode);
95
+ document.documentElement.classList.toggle('stl-nav-links-mode-desktop', mode === 'desktop');
96
+ document.documentElement.classList.toggle('stl-nav-links-mode-mobile', mode === 'mobile');
95
97
  }
96
98
 
97
99
  const resizeObserver = new ResizeObserver(() => {
@@ -13,3 +13,5 @@ export function buildNavLinks(starlightRoute: StarlightRouteData) {
13
13
 
14
14
  return navLinks;
15
15
  }
16
+
17
+ export type NavLink = ReturnType<typeof buildNavLinks>[number];
@@ -52,11 +52,14 @@ const { prev, next } = (await getPrevNextPage(Astro.locals.starlightRoute, confi
52
52
  .pagination-links {
53
53
  --stl-ui-pagination-padding: 8px;
54
54
  --stl-ui-pagination-border-radius-inner: var(--stl-ui-layout-border-radius-sml);
55
+ --stl-ui-pagination-border-radius-outer: calc(
56
+ var(--stl-ui-pagination-border-radius-inner) + var(--stl-ui-pagination-padding)
57
+ );
55
58
 
56
59
  padding: var(--stl-ui-pagination-padding);
57
60
  background-color: var(--stl-color-faint-background);
58
61
  border: 1px solid var(--stl-color-border);
59
- border-radius: calc(var(--stl-ui-pagination-border-radius-inner) + var(--stl-ui-pagination-padding));
62
+ border-radius: var(--stl-ui-pagination-border-radius-outer);
60
63
 
61
64
  font-size: var(--stl-typography-scale-sm);
62
65
  letter-spacing: normal;
@@ -64,7 +67,6 @@ const { prev, next } = (await getPrevNextPage(Astro.locals.starlightRoute, confi
64
67
  display: flex;
65
68
  gap: 8px;
66
69
 
67
- margin-bottom: 2rem;
68
70
  color: inherit; /* stl-ui-not-prose sets color: initial */
69
71
 
70
72
  a {
@@ -1,10 +1,10 @@
1
1
  ---
2
2
  import { ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';
3
3
  const { href, direction } = Astro.props;
4
- export interface Props {
4
+ type Props = {
5
5
  href: string;
6
6
  direction: 'prev' | 'next';
7
- }
7
+ };
8
8
  ---
9
9
 
10
10
  <a href={href} class="pagination-links__link pagination-links__link--emphasized">
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  const { href } = Astro.props;
3
- export interface Props {
3
+ type Props = {
4
4
  href: string;
5
- }
5
+ };
6
6
  ---
7
7
 
8
8
  <a href={href} class="pagination-links__link pagination-links__button pagination-links__link--quiet">
@@ -2,10 +2,10 @@ import type { StarlightRouteData } from '@astrojs/starlight/route-data';
2
2
  import { getCollection } from 'astro:content';
3
3
 
4
4
  export type SidebarEntry = StarlightRouteData['sidebar'][number];
5
- export type SidebarLink = Extract<SidebarEntry, { type: 'link' }>;
6
- export type SidebarGroup = Extract<SidebarEntry, { type: 'group' }>;
5
+ type SidebarLink = Extract<SidebarEntry, { type: 'link' }>;
6
+ type SidebarGroup = Extract<SidebarEntry, { type: 'group' }>;
7
7
 
8
- export const flattenSidebar = (sidebar: SidebarEntry[]): SidebarLink[] =>
8
+ const flattenSidebar = (sidebar: SidebarEntry[]): SidebarLink[] =>
9
9
  sidebar.flatMap((e) => (e.type === 'group' ? flattenSidebar(e.entries) : e));
10
10
 
11
11
  function findParentOfSidebarEntry(sidebar: SidebarEntry[], targetEntry: SidebarEntry): SidebarGroup | null {
@@ -3,9 +3,80 @@ import HeaderLinks from '../headers/HeaderLinks.astro';
3
3
  import { SidebarWithComponents } from './SidebarWithComponents';
4
4
  import SidebarPersister from '@astrojs/starlight/components/SidebarPersister.astro';
5
5
  import { convertAstroSidebarToStl } from './convertAstroSidebarToStl';
6
+ import { StlSidebarEntry, StlSidebarGroup, StlSidebarLink } from '@stainless-api/docs-ui/components';
7
+ import { LINK_GROUP_TITLES_TO_OVERVIEW_PAGES } from 'virtual:stl-docs-virtual-module';
6
8
 
7
9
  const { sidebar } = Astro.locals.starlightRoute;
8
- const stlSidebar = convertAstroSidebarToStl(sidebar);
10
+
11
+ let stlSidebar = convertAstroSidebarToStl(sidebar);
12
+
13
+ function extractOverviewPage(entry: StlSidebarGroup): {
14
+ overviewLink: StlSidebarLink | null;
15
+ remainingEntries: StlSidebarEntry[];
16
+ } {
17
+ let overviewLink: StlSidebarLink | null = null;
18
+
19
+ const withoutOverview = entry.entries.filter((e) => {
20
+ if (e.type !== 'link') {
21
+ return true;
22
+ }
23
+ const overviewAttr = e.attrs?.['data-stldocs-overview'];
24
+ if (!overviewAttr) {
25
+ return true;
26
+ }
27
+ overviewLink = e;
28
+ return false;
29
+ });
30
+
31
+ return {
32
+ overviewLink,
33
+ remainingEntries: withoutOverview,
34
+ };
35
+ }
36
+
37
+ function linkGroupTitleToOverviewPages(sidebar: StlSidebarEntry[]): StlSidebarEntry[] {
38
+ return sidebar.map((entry) => {
39
+ if (entry.type === 'group') {
40
+ const { overviewLink, remainingEntries } = extractOverviewPage(entry);
41
+
42
+ // group only contained an overview link
43
+ if (overviewLink && remainingEntries.length === 0) {
44
+ return {
45
+ ...overviewLink,
46
+ label: entry.label, // keep the group label
47
+ };
48
+ }
49
+
50
+ // set the group target to the overview link target
51
+
52
+ let target = entry.target;
53
+ let isCurrent = entry.isCurrent;
54
+ let collapsed = entry.collapsed;
55
+ if (overviewLink) {
56
+ target = overviewLink.target;
57
+ isCurrent = overviewLink.isCurrent;
58
+ if (isCurrent) {
59
+ collapsed = false;
60
+ }
61
+ }
62
+
63
+ return {
64
+ ...entry,
65
+ entries: linkGroupTitleToOverviewPages(remainingEntries),
66
+ target,
67
+ isCurrent,
68
+ collapsed,
69
+ };
70
+ } else {
71
+ return entry;
72
+ }
73
+ });
74
+ }
75
+
76
+ // Since Terraform only renders the top level resource, we don't need to link group titles to overview pages.
77
+ if (LINK_GROUP_TITLES_TO_OVERVIEW_PAGES === true && Astro.locals.language !== 'terraform') {
78
+ stlSidebar = linkGroupTitleToOverviewPages(stlSidebar);
79
+ }
9
80
  ---
10
81
 
11
82
  <div class="stl-sidebar-header-links">
@@ -1,7 +1,7 @@
1
1
  import type { AstroIntegration } from 'astro';
2
2
  import type { StarlightPlugin } from '@astrojs/starlight/types';
3
3
 
4
- export const disableCalloutSyntaxAstroIntegration = {
4
+ const disableCalloutSyntaxAstroIntegration = {
5
5
  name: 'stl-starlight-remove-callout-syntax',
6
6
  hooks: {
7
7
  'astro:config:setup': ({ config: astroConfig }) => {
package/stl-docs/fonts.ts CHANGED
@@ -3,11 +3,11 @@ import type { Defined } from './loadStlDocsConfig';
3
3
  import { fontProviders } from 'astro/config';
4
4
  import type { FontPreloadFilter } from 'astro:assets';
5
5
 
6
- type AstroFontConfigEntry = Defined<AstroConfig['experimental']['fonts']>[number];
6
+ type AstroFontConfigEntry = Defined<AstroConfig['fonts']>[number];
7
7
 
8
8
  // Apply Omit to each member of the union while preserving union structure
9
9
  type PreloadFilter = { preload?: FontPreloadFilter };
10
- export type StlDocsFontConfigEntry = (AstroFontConfigEntry extends infer T
10
+ type StlDocsFontConfigEntry = (AstroFontConfigEntry extends infer T
11
11
  ? T extends unknown
12
12
  ? Omit<T, 'cssVariable'>
13
13
  : never
@@ -165,19 +165,19 @@ export function flattenFonts(fonts: StlDocsFontConfig | undefined): AstroFontCon
165
165
  fontConfigs.push({
166
166
  ...fonts.primary,
167
167
  cssVariable: '--stl-typography-font' as const,
168
- } as AstroFontConfigEntry);
168
+ });
169
169
  }
170
170
  if (fonts.heading) {
171
171
  fontConfigs.push({
172
172
  ...fonts.heading,
173
173
  cssVariable: '--stl-typography-font-heading' as const,
174
- } as AstroFontConfigEntry);
174
+ });
175
175
  }
176
176
  if (fonts.mono) {
177
177
  fontConfigs.push({
178
178
  ...fonts.mono,
179
179
  cssVariable: '--stl-typography-font-mono' as const,
180
- } as AstroFontConfigEntry);
180
+ });
181
181
  }
182
182
  if (fonts.additional) {
183
183
  fontConfigs.push(...fonts.additional.map((font) => font as AstroFontConfigEntry));