@stainless-api/docs 0.1.0-beta.5 → 0.1.0-beta.51

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 (115) hide show
  1. package/CHANGELOG.md +390 -0
  2. package/eslint-suppressions.json +47 -0
  3. package/locals.d.ts +14 -0
  4. package/package.json +43 -39
  5. package/plugin/buildAlgoliaIndex.ts +31 -6
  6. package/plugin/cms/server.ts +98 -56
  7. package/plugin/cms/sidebar-builder.ts +7 -26
  8. package/plugin/cms/worker.ts +3 -3
  9. package/plugin/components/MethodDescription.tsx +54 -0
  10. package/plugin/components/SDKSelect.astro +7 -87
  11. package/plugin/components/SnippetCode.tsx +11 -7
  12. package/plugin/components/search/SearchAlgolia.astro +5 -33
  13. package/plugin/components/search/SearchIsland.tsx +37 -23
  14. package/plugin/generateAPIReferenceLink.ts +2 -2
  15. package/plugin/globalJs/ai-dropdown-options.ts +235 -0
  16. package/plugin/globalJs/method-descriptions.ts +33 -0
  17. package/plugin/globalJs/navigation.ts +7 -27
  18. package/plugin/helpers/getPageLoadEvent.ts +1 -1
  19. package/plugin/index.ts +54 -34
  20. package/plugin/languages.ts +2 -2
  21. package/plugin/loadPluginConfig.ts +112 -32
  22. package/plugin/middlewareBuilder/stainlessMiddleware.d.ts +1 -1
  23. package/plugin/react/Routing.tsx +176 -80
  24. package/plugin/referencePlaceholderUtils.ts +1 -1
  25. package/plugin/replaceSidebarPlaceholderMiddleware.ts +5 -1
  26. package/plugin/routes/Docs.astro +60 -85
  27. package/plugin/routes/Overview.astro +10 -16
  28. package/plugin/routes/markdown.ts +7 -7
  29. package/plugin/vendor/preview.worker.docs.js +17973 -16561
  30. package/plugin/vendor/templates/go.md +1 -1
  31. package/plugin/vendor/templates/python.md +1 -1
  32. package/resolveSrcFile.ts +10 -0
  33. package/scripts/vendor_deps.ts +1 -1
  34. package/shared/getSharedLogger.ts +15 -0
  35. package/shared/terminalUtils.ts +3 -0
  36. package/src/content.config.ts +9 -0
  37. package/stl-docs/components/AIDropdown.tsx +63 -0
  38. package/stl-docs/components/{content-panel/ContentBreadcrumbs.tsx → ContentBreadcrumbs.tsx} +2 -2
  39. package/stl-docs/components/Head.astro +16 -0
  40. package/stl-docs/components/Header.astro +6 -8
  41. package/stl-docs/components/PageTitle.astro +82 -0
  42. package/stl-docs/components/TableOfContents.astro +34 -0
  43. package/stl-docs/components/ThemeSelect.astro +118 -141
  44. package/stl-docs/components/content-panel/ContentPanel.astro +16 -46
  45. package/stl-docs/components/headers/DefaultHeader.astro +1 -1
  46. package/stl-docs/components/headers/HeaderLinks.astro +1 -1
  47. package/stl-docs/components/headers/SplashMobileMenuToggle.astro +17 -1
  48. package/stl-docs/components/headers/StackedHeader.astro +29 -24
  49. package/stl-docs/components/icons/chat-gpt.tsx +17 -0
  50. package/stl-docs/components/icons/claude.tsx +10 -0
  51. package/stl-docs/components/icons/cursor.tsx +10 -0
  52. package/stl-docs/components/icons/gemini.tsx +19 -0
  53. package/stl-docs/components/icons/markdown.tsx +10 -0
  54. package/stl-docs/components/index.ts +1 -0
  55. package/stl-docs/components/mintlify-compat/Accordion.astro +7 -38
  56. package/stl-docs/components/mintlify-compat/AccordionGroup.astro +9 -23
  57. package/stl-docs/components/mintlify-compat/Columns.astro +40 -42
  58. package/stl-docs/components/mintlify-compat/Frame.astro +16 -18
  59. package/stl-docs/components/mintlify-compat/Step.astro +30 -32
  60. package/stl-docs/components/mintlify-compat/Steps.astro +8 -10
  61. package/stl-docs/components/mintlify-compat/callouts/Callout.astro +10 -3
  62. package/stl-docs/components/mintlify-compat/callouts/Check.astro +7 -3
  63. package/stl-docs/components/mintlify-compat/callouts/Danger.astro +7 -3
  64. package/stl-docs/components/mintlify-compat/callouts/Info.astro +7 -3
  65. package/stl-docs/components/mintlify-compat/callouts/Note.astro +7 -3
  66. package/stl-docs/components/mintlify-compat/callouts/Tip.astro +7 -3
  67. package/stl-docs/components/mintlify-compat/callouts/Warning.astro +7 -3
  68. package/stl-docs/components/mintlify-compat/card.css +33 -35
  69. package/stl-docs/components/nav-tabs/NavDropdown.astro +31 -75
  70. package/stl-docs/components/nav-tabs/NavTabs.astro +78 -80
  71. package/stl-docs/components/nav-tabs/SecondaryNavTabs.astro +15 -8
  72. package/stl-docs/components/nav-tabs/buildNavLinks.ts +4 -3
  73. package/stl-docs/components/pagination/HomeLink.astro +10 -0
  74. package/stl-docs/components/pagination/Pagination.astro +174 -0
  75. package/stl-docs/components/pagination/PaginationLinkEmphasized.astro +22 -0
  76. package/stl-docs/components/pagination/PaginationLinkQuiet.astro +13 -0
  77. package/stl-docs/components/pagination/util.ts +71 -0
  78. package/stl-docs/components/scripts.ts +1 -0
  79. package/stl-docs/components/{Sidebar.astro → sidebars/BaseSidebar.astro} +2 -3
  80. package/stl-docs/components/sidebars/SDKSelectSidebar.astro +8 -0
  81. package/stl-docs/disableCalloutSyntax.ts +36 -0
  82. package/stl-docs/index.ts +98 -26
  83. package/stl-docs/loadStlDocsConfig.ts +37 -5
  84. package/stl-docs/proseMarkdown/proseMarkdownIntegration.ts +64 -0
  85. package/stl-docs/proseMarkdown/proseMarkdownMiddleware.ts +34 -0
  86. package/stl-docs/proseMarkdown/toMarkdown.ts +158 -0
  87. package/stl-docs/tabsMiddleware.ts +12 -4
  88. package/styles/code.css +104 -141
  89. package/styles/fonts.css +32 -17
  90. package/styles/links.css +11 -48
  91. package/styles/method-descriptions.css +36 -0
  92. package/styles/overrides.css +49 -57
  93. package/styles/page.css +90 -59
  94. package/styles/sdk_select.css +9 -7
  95. package/styles/search.css +58 -69
  96. package/styles/sidebar.css +211 -131
  97. package/styles/{variables.css → sl-variables.css} +3 -2
  98. package/styles/stldocs-variables.css +6 -0
  99. package/styles/toc.css +41 -34
  100. package/theme.css +12 -2
  101. package/tsconfig.json +2 -5
  102. package/virtual-module.d.ts +8 -4
  103. package/components/variables.css +0 -139
  104. package/plugin/globalJs/ai-dropdown.ts +0 -57
  105. package/stl-docs/components/APIReferenceAIDropdown.tsx +0 -86
  106. package/stl-docs/components/content-panel/ProseAIDropdown.tsx +0 -64
  107. /package/{plugin/assets → assets}/fonts/geist/OFL.txt +0 -0
  108. /package/{plugin/assets → assets}/fonts/geist/geist-italic-latin-ext.woff2 +0 -0
  109. /package/{plugin/assets → assets}/fonts/geist/geist-italic-latin.woff2 +0 -0
  110. /package/{plugin/assets → assets}/fonts/geist/geist-latin-ext.woff2 +0 -0
  111. /package/{plugin/assets → assets}/fonts/geist/geist-latin.woff2 +0 -0
  112. /package/{plugin/assets → assets}/fonts/geist/geist-mono-italic-latin-ext.woff2 +0 -0
  113. /package/{plugin/assets → assets}/fonts/geist/geist-mono-italic-latin.woff2 +0 -0
  114. /package/{plugin/assets → assets}/fonts/geist/geist-mono-latin-ext.woff2 +0 -0
  115. /package/{plugin/assets → assets}/fonts/geist/geist-mono-latin.woff2 +0 -0
@@ -0,0 +1,64 @@
1
+ import type { AstroIntegration } from 'astro';
2
+ import { readFile, writeFile } from 'fs/promises';
3
+ import { toMarkdown } from './toMarkdown';
4
+ import { resolveSrcFile } from '../../resolveSrcFile';
5
+ import { getSharedLogger } from '../../shared/getSharedLogger';
6
+ import { bold } from '../../shared/terminalUtils';
7
+
8
+ export function stainlessDocsMarkdownRenderer({ enabled }: { enabled: boolean }): AstroIntegration {
9
+ return {
10
+ name: 'stl-docs-md',
11
+ hooks: {
12
+ 'astro:config:setup': ({ addMiddleware }) => {
13
+ if (enabled) {
14
+ addMiddleware({
15
+ entrypoint: resolveSrcFile('/stl-docs/proseMarkdown/proseMarkdownMiddleware.ts'),
16
+ order: 'post',
17
+ });
18
+ }
19
+ },
20
+ 'astro:build:done': async ({ assets, logger: localLogger, dir }) => {
21
+ const logger = getSharedLogger({ fallback: localLogger });
22
+ if (!enabled) {
23
+ logger.info('Stainless Docs prose Markdown rendering is disabled, skipping...');
24
+ return;
25
+ }
26
+ const starlightPagePatterns = ['/[...slug]'];
27
+ const pagesToRender = Array.from(assets.entries())
28
+ .filter(([k]) => {
29
+ if (starlightPagePatterns.includes(k)) {
30
+ return true;
31
+ }
32
+ return false;
33
+ })
34
+ .map(([, v]) => v)
35
+ .flat()
36
+ .map((v) => v.pathname);
37
+
38
+ logger.info(bold(`Building ${pagesToRender.length} Markdown pages for prose content`));
39
+
40
+ const outputBasePath = dir.pathname;
41
+
42
+ let completedCount = 0;
43
+ for (const absHtmlPath of pagesToRender) {
44
+ const txt = await readFile(absHtmlPath, 'utf-8');
45
+ const md = await toMarkdown(txt);
46
+ if (md) {
47
+ const absMdPath = absHtmlPath.replace('.html', '.md');
48
+ await writeFile(absMdPath, md, 'utf-8');
49
+
50
+ completedCount++;
51
+
52
+ const relHtmlPath = absHtmlPath.replace(outputBasePath, '');
53
+ const relMdPath = absMdPath.replace(outputBasePath, '');
54
+
55
+ logger.info(`(${completedCount}/${pagesToRender.length}) ${relHtmlPath} -> ${relMdPath}`);
56
+ } else {
57
+ logger.error(`Failed to render ${absHtmlPath} as Markdown`);
58
+ process.exit(1);
59
+ }
60
+ }
61
+ },
62
+ },
63
+ };
64
+ }
@@ -0,0 +1,34 @@
1
+ import { defineMiddleware } from 'astro:middleware';
2
+ import { toMarkdown } from './toMarkdown';
3
+ import { API_REFERENCE_BASE_PATH } from 'virtual:stl-docs-virtual-module';
4
+
5
+ // this is only run in `astro dev` for rendering prose content as Markdown on the fly.
6
+ export const onRequest = defineMiddleware(async (context, next) => {
7
+ // eslint-disable-next-line turbo/no-undeclared-env-vars
8
+ if (!import.meta.env.DEV) {
9
+ return next();
10
+ }
11
+
12
+ if (API_REFERENCE_BASE_PATH && context.url.pathname.startsWith(API_REFERENCE_BASE_PATH)) {
13
+ // handled by the API reference API route in stl-starlight plugin
14
+ return next();
15
+ }
16
+
17
+ if (!context.url.pathname.endsWith('/index.md')) {
18
+ return next();
19
+ }
20
+
21
+ const htmlUrl = new URL(context.url.pathname.replace('index.md', ''), context.url);
22
+ const resp = await fetch(htmlUrl);
23
+ if (!resp.ok) {
24
+ return new Response('Failed to fetch HTML', { status: 400 });
25
+ }
26
+ const html = await resp.text();
27
+ const md = await toMarkdown(html);
28
+
29
+ if (!md) {
30
+ return new Response('Failed to render Markdown', { status: 400 });
31
+ }
32
+
33
+ return new Response(md, { status: 200 });
34
+ });
@@ -0,0 +1,158 @@
1
+ import { unified } from 'unified';
2
+ import rehypeParse from 'rehype-parse';
3
+ import rehypeRemark from 'rehype-remark';
4
+ import remarkGfm from 'remark-gfm';
5
+ import remarkStringify from 'remark-stringify';
6
+ import { HTMLElement, parse } from 'node-html-parser';
7
+
8
+ type PaginationLink = {
9
+ href: string;
10
+ label: string;
11
+ };
12
+
13
+ type PaginationItems = {
14
+ prev: PaginationLink | null;
15
+ next: PaginationLink | null;
16
+ };
17
+
18
+ function parsePaginationLink(footer: HTMLElement, rel: 'next' | 'prev'): PaginationLink | null {
19
+ const link = footer.querySelector(`.pagination-links a[rel="${rel}"]`);
20
+ if (!link) {
21
+ return null;
22
+ }
23
+
24
+ const title = link.querySelector('.link-title');
25
+ if (!title) {
26
+ return null;
27
+ }
28
+
29
+ const href = link.getAttribute('href');
30
+ if (!href) {
31
+ return null;
32
+ }
33
+
34
+ return {
35
+ href,
36
+ label: title.text,
37
+ };
38
+ }
39
+
40
+ function isRelativeLink(href: string) {
41
+ return href.startsWith('/');
42
+ }
43
+
44
+ function hasExtension(href: string) {
45
+ return href.includes('.');
46
+ }
47
+
48
+ function removeTrailingSlash(href: string) {
49
+ return href.replace(/\/$/, '');
50
+ }
51
+
52
+ function makeMarkdownLinks(el: HTMLElement) {
53
+ el.querySelectorAll('a').forEach((a) => {
54
+ const href = a.getAttribute('href');
55
+ if (!href) {
56
+ return a;
57
+ }
58
+
59
+ if (isRelativeLink(href) && !hasExtension(href)) {
60
+ if (href === '/') {
61
+ a.setAttribute('href', '/index.md');
62
+ } else {
63
+ a.setAttribute('href', `${removeTrailingSlash(href)}/index.md`);
64
+ }
65
+ }
66
+ return a;
67
+ });
68
+ }
69
+
70
+ function removeHiddenElements(el: HTMLElement) {
71
+ const hiddenSelectors = ['.sl-anchor-link'];
72
+ for (const selector of hiddenSelectors) {
73
+ const hiddenElements = el.querySelectorAll(selector);
74
+ for (const hiddenElement of hiddenElements) {
75
+ hiddenElement.remove();
76
+ }
77
+ }
78
+ }
79
+
80
+ export async function toMarkdown(html: string) {
81
+ const root = parse(html);
82
+
83
+ const mainEl = root.querySelector('main');
84
+
85
+ if (!mainEl) {
86
+ return null;
87
+ }
88
+
89
+ makeMarkdownLinks(mainEl);
90
+
91
+ const footer = mainEl.querySelector('footer');
92
+
93
+ const markdownContentEl = mainEl.querySelector('.sl-markdown-content');
94
+ if (!markdownContentEl) {
95
+ return null;
96
+ }
97
+
98
+ removeHiddenElements(markdownContentEl);
99
+
100
+ const articleContent = markdownContentEl.innerHTML;
101
+
102
+ const paginationLinks: PaginationItems = {
103
+ prev: null,
104
+ next: null,
105
+ };
106
+
107
+ if (footer) {
108
+ paginationLinks.prev = parsePaginationLink(footer, 'prev');
109
+ paginationLinks.next = parsePaginationLink(footer, 'next');
110
+ }
111
+
112
+ let md = (
113
+ await unified()
114
+ .use(rehypeParse, { fragment: true }) // parse HTML
115
+ .use(rehypeRemark) // rehype (HTML) -> remark (MD AST)
116
+ .use(remarkGfm) // tables, strikethrough, autolinks, etc.
117
+ .use(remarkStringify, {
118
+ fences: true,
119
+ bullet: '-',
120
+ listItemIndent: 'one',
121
+ rule: '-',
122
+ })
123
+ .process(articleContent)
124
+ ).toString();
125
+
126
+ const title = root.querySelector('title')?.textContent;
127
+ const description = root.querySelector('meta[name="description"]')?.attributes.content;
128
+ const lastUpdated = root.querySelector('.meta time')?.attributes.datetime;
129
+
130
+ // let htmlUrl = url.toString().replace('.md', '');
131
+ // if (htmlUrl.endsWith('/index')) {
132
+ // htmlUrl = htmlUrl.replace('/index', '');
133
+ // }
134
+
135
+ md = [
136
+ '---',
137
+ `title: ${title}`,
138
+ description ? `description: ${description}` : [],
139
+ lastUpdated ? `lastUpdated: ${lastUpdated}` : [],
140
+ // `source_url:`,
141
+ // ` html: ${htmlUrl}`,
142
+ // ` md: ${url.toString()}`,
143
+ '---\n',
144
+ md,
145
+ ]
146
+ .flat()
147
+ .join('\n');
148
+
149
+ if (paginationLinks.prev) {
150
+ md += `\n\n[Previous](${paginationLinks.prev.href})`;
151
+ }
152
+
153
+ if (paginationLinks.next) {
154
+ md += `\n\n[Next](${paginationLinks.next.href})`;
155
+ }
156
+
157
+ return md;
158
+ }
@@ -1,7 +1,7 @@
1
1
  import type { StarlightRouteData } from '@astrojs/starlight/route-data';
2
2
  import { defineRouteMiddleware } from '@astrojs/starlight/route-data';
3
3
 
4
- import { SPLIT_TABS_ENABLED, TABS } from 'virtual:stl-stl-starlight-virtual-module';
4
+ import { SPLIT_TABS_ENABLED, TABS } from 'virtual:stl-docs-virtual-module';
5
5
  import clsx from 'clsx';
6
6
 
7
7
  // this fn is loaded in the plugin via addRouteMiddleware
@@ -58,7 +58,7 @@ function getTabIndexForSlug(
58
58
  match: 'exact' | 'prefix';
59
59
  } | null {
60
60
  // ↓ exact match eg. slug = "/blog" and there is a link containing "/blog"
61
- let tab = linksByTab.get(slug);
61
+ const tab = linksByTab.get(slug)!;
62
62
  if (typeof tab === 'string') {
63
63
  return {
64
64
  match: 'exact',
@@ -88,13 +88,19 @@ function getNonSplitLinksByTab() {
88
88
  const linksByTab = new Map<string, string>();
89
89
 
90
90
  for (let i = 0; i < TABS.length; i++) {
91
- const tab = TABS[i];
91
+ const tab = TABS[i]!;
92
92
  linksByTab.set(tab.link, String(i));
93
93
  }
94
94
 
95
95
  return linksByTab;
96
96
  }
97
97
 
98
+ export interface StarlightRouteWithStlDocs extends StarlightRouteData {
99
+ _stlDocs?: {
100
+ activeTabIndex: number;
101
+ };
102
+ }
103
+
98
104
  export const onRequest = defineRouteMiddleware(async (context) => {
99
105
  // if using content collection schema, use: context.locals.starlightRoute.entry.data.stainlessStarlight
100
106
  // this worked without collections but relied on hijacking starlightRoute: context.props.frontmatter.stainlessStarlight
@@ -143,7 +149,8 @@ export const onRequest = defineRouteMiddleware(async (context) => {
143
149
  }
144
150
 
145
151
  // We store the active tab index so we can use it in our nav tabs component
146
- context.locals.starlightRoute._stlStarlight = {
152
+ const routeData: StarlightRouteWithStlDocs = context.locals.starlightRoute;
153
+ routeData._stlDocs = {
147
154
  activeTabIndex: activeTabIndex.index,
148
155
  };
149
156
 
@@ -179,5 +186,6 @@ export const onRequest = defineRouteMiddleware(async (context) => {
179
186
 
180
187
  matchingGroup?.entries.unshift(...mobileLinks);
181
188
 
189
+ (context.locals._stlStarlightPage ??= {}).fullSidebar = context.locals.starlightRoute.sidebar;
182
190
  context.locals.starlightRoute.sidebar = matchingGroup.entries;
183
191
  });
package/styles/code.css CHANGED
@@ -1,72 +1,90 @@
1
- @layer stainless {
2
- .expressive-code {
3
- .frame {
4
- --code-background: var(--sl-color-bg-inline-code);
5
- }
1
+ .expressive-code {
2
+ .frame {
3
+ --code-background: var(--stl-color-faint-background);
4
+ }
5
+
6
+ figure.frame {
7
+ box-shadow: none;
8
+ }
6
9
 
7
- figure.frame {
8
- box-shadow: none;
10
+ figure,
11
+ pre {
12
+ border-radius: var(--sl-button-border-radius);
13
+ border-color: var(--stl-color-border);
14
+ }
15
+
16
+ .frame.has-title:not(.is-terminal),
17
+ .frame.is-terminal {
18
+ figcaption {
19
+ border-radius: var(--sl-button-border-radius) var(--sl-button-border-radius) 0 0;
20
+ border-color: var(--stl-color-border);
9
21
  }
10
22
 
11
- figure,
12
23
  pre {
13
- border-radius: var(--sl-button-border-radius);
14
- border-color: var(--sl-color-hairline);
24
+ border-radius: 0 0 var(--sl-button-border-radius) var(--sl-button-border-radius);
25
+ border-color: var(--stl-color-border);
15
26
  }
27
+ }
16
28
 
17
- .frame.has-title:not(.is-terminal),
18
- .frame.is-terminal {
19
- figcaption {
20
- border-radius: var(--sl-button-border-radius) var(--sl-button-border-radius) 0 0;
21
- border-color: var(--sl-color-hairline);
22
- }
23
-
24
- pre {
25
- border-radius: 0 0 var(--sl-button-border-radius) var(--sl-button-border-radius);
26
- border-color: var(--sl-color-hairline);
27
- }
29
+ .frame.has-title:not(.is-terminal) {
30
+ figcaption span:first-child {
31
+ border-top-left-radius: var(--sl-button-border-radius);
28
32
  }
29
33
 
30
- .frame.has-title:not(.is-terminal) {
31
- figcaption span:first-child {
32
- border-top-left-radius: var(--sl-button-border-radius);
33
- }
34
-
35
- .header::before {
36
- border-color: var(--sl-color-hairline);
37
- }
34
+ .header::before {
35
+ border-color: var(--stl-color-border);
36
+ }
38
37
 
39
- .title::after {
40
- bottom: -1px;
41
- top: unset;
42
- }
38
+ .title::after {
39
+ bottom: -1px;
40
+ top: unset;
43
41
  }
44
42
  }
43
+ }
45
44
 
46
- .astro-code {
47
- border-radius: var(--sl-button-border-radius);
48
- border-color: var(--sl-color-hairline);
49
- }
45
+ .astro-code {
46
+ border-radius: var(--sl-button-border-radius);
47
+ border-color: var(--stl-color-border);
48
+ }
50
49
 
51
- .stl-snippet-request-container {
52
- position: relative;
50
+ .stl-snippet-request-container {
51
+ position: relative;
52
+ }
53
+
54
+ .stl-snippet-expand-button {
55
+ display: none;
56
+
57
+ position: relative;
58
+ left: 50%;
59
+ transform: translateX(-50%);
60
+ bottom: 12px;
61
+ cursor: pointer;
62
+ height: auto;
63
+ }
64
+
65
+ .stl-snippet-code-is-expanded {
66
+ .ellipsis {
67
+ display: none;
53
68
  }
69
+ }
54
70
 
71
+ .stl-snippet-collapsible {
55
72
  .stl-snippet-expand-button {
56
- display: none;
73
+ display: block;
74
+ margin-bottom: -23px;
75
+ /* Prevent clipping of the button with the container below */
76
+ z-index: 100;
77
+ }
78
+
79
+ .stl-snippet-code-is-collapsed {
80
+ .hidden {
81
+ display: none;
82
+ opacity: 0;
83
+ }
57
84
 
58
- position: relative;
59
- left: 50%;
60
- transform: translateX(-50%);
61
- bottom: 12px;
62
- background-color: var(--stldocs-color-bg-inline-code);
63
- cursor: pointer;
64
- font-weight: 500;
65
- line-height: 100%;
66
- font-size: var(--stldocs-font-size-body-sm);
67
- font-family: var(--stldocs-font);
68
- padding: 4px 7px 4px 7px;
69
- height: auto;
85
+ .leading-ws {
86
+ display: none;
87
+ }
70
88
  }
71
89
 
72
90
  .stl-snippet-code-is-expanded {
@@ -74,116 +92,61 @@
74
92
  display: none;
75
93
  }
76
94
  }
95
+ }
77
96
 
78
- .stl-snippet-collapsible {
79
- .stl-snippet-expand-button {
80
- display: block;
81
- margin-bottom: -23px;
82
- /* Prevent clipping of the button with the container below */
83
- z-index: 100;
97
+ .stldocs-root {
98
+ .stl-snippets-non-collapsible {
99
+ .shiki {
100
+ counter-reset: codeblock-line 0 !important;
84
101
  }
85
102
 
86
- .stl-snippet-code-is-collapsed {
103
+ .stldocs-snippet {
87
104
  .hidden {
88
- display: none;
89
- opacity: 0;
105
+ display: inline;
106
+ opacity: 1;
90
107
  }
91
108
 
92
109
  .leading-ws {
93
- display: none;
110
+ display: inline;
94
111
  }
95
- }
96
112
 
97
- .stl-snippet-code-is-expanded {
98
113
  .ellipsis {
99
114
  display: none;
100
115
  }
101
116
  }
102
117
  }
118
+ }
103
119
 
104
- .stldocs-root {
105
- .stl-snippets-non-collapsible {
106
- .shiki {
107
- counter-reset: codeblock-line 0 !important;
108
- }
109
-
110
- .stldocs-snippet {
111
- .hidden {
112
- display: inline;
113
- opacity: 1;
114
- }
115
-
116
- .leading-ws {
117
- display: inline;
118
- }
119
-
120
- .ellipsis {
121
- display: none;
122
- }
123
- }
124
- }
125
- }
126
-
127
- .stl-snippet-dropdown-button-text {
128
- font-weight: 500;
129
- font-style: normal;
130
- font-family: var(--stldocs-font);
131
- line-height: 100%;
132
- font-size: var(--sl-text-body-sm);
133
- color: var(--sl-color-text);
134
- text-transform: capitalize;
135
-
136
- &.http {
137
- text-transform: uppercase;
138
- }
139
- }
140
-
141
- :root[data-theme='light'] {
142
- .astro-code,
143
- .astro-code span {
144
- background-color: var(--sl-color-bg-inline-code) !important;
145
- }
120
+ .stldocs-root .stl-snippet-dropdown-button-text,
121
+ .stl-snippet-dropdown-button-text {
122
+ font-weight: 500;
123
+ font-style: normal;
124
+ font-family: var(--stl-typography-font);
125
+ line-height: 100%;
126
+ font-size: var(--stl-typography-scale-sm);
127
+ color: var(--stl-color-foreground);
128
+ }
146
129
 
147
- .stldocs-snippet-response-pane {
148
- .shiki,
149
- .shiki span,
150
- .astro-code,
151
- .astro-code span {
152
- background-color: var(--sl-color-bg-inline-code) !important;
153
- }
154
- }
155
- }
130
+ .shiki,
131
+ .astro-code,
132
+ .stldocs-snippet-response-pane {
133
+ background-color: var(--shiki-background, var(--stl-color-faint-background)) !important;
134
+ }
156
135
 
157
- :root[data-theme='dark'] {
158
- /*
136
+ :root[data-theme='dark'] {
137
+ /*
159
138
  Need to use important to override inline variables. This is the
160
139
  recommended pattern in the shiki docs.
161
140
 
162
141
  https://shiki.style/guide/dual-themes#query-based-dark-mode
163
142
  */
164
- .shiki,
165
- .shiki span,
166
- .astro-code,
167
- .astro-code span {
168
- color: var(--shiki-dark) !important;
169
- background-color: var(--sl-color-bg) !important;
170
- font-style: var(--shiki-dark-font-style) !important;
171
- font-weight: var(--shiki-dark-font-weight) !important;
172
- text-decoration: var(--shiki-dark-text-decoration) !important;
173
- }
174
-
175
- .astro-code,
176
- .astro-code span {
177
- background-color: var(--sl-color-bg-inline-code) !important;
178
- }
179
-
180
- .stldocs-snippet-response-pane {
181
- .shiki,
182
- .shiki span,
183
- .astro-code,
184
- .astro-code span {
185
- background-color: var(--sl-color-bg-inline-code) !important;
186
- }
187
- }
143
+ .shiki,
144
+ .shiki span,
145
+ .astro-code,
146
+ .astro-code span {
147
+ color: var(--shiki-dark) !important;
148
+ font-style: var(--shiki-dark-font-style) !important;
149
+ font-weight: var(--shiki-dark-font-weight) !important;
150
+ text-decoration: var(--shiki-dark-text-decoration) !important;
188
151
  }
189
152
  }