@stainless-api/docs 0.1.0-beta.74 → 0.1.0-beta.76

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @stainless-api/docs
2
2
 
3
+ ## 0.1.0-beta.76
4
+
5
+ ### Patch Changes
6
+
7
+ - 5a6d886: fix searchbar styles
8
+ - d79718a: should use base url when resolving pagefind
9
+
10
+ ## 0.1.0-beta.75
11
+
12
+ ### Patch Changes
13
+
14
+ - b1ff7b3: write manifest file after build
15
+
3
16
  ## 0.1.0-beta.74
4
17
 
5
18
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stainless-api/docs",
3
- "version": "0.1.0-beta.74",
3
+ "version": "0.1.0-beta.76",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -40,7 +40,7 @@
40
40
  "@astrojs/markdown-remark": "^6.3.10",
41
41
  "@astrojs/react": "^4.4.2",
42
42
  "@stainless-api/sdk": "0.1.0-alpha.19",
43
- "astro-expressive-code": "^0.41.3",
43
+ "astro-expressive-code": "^0.41.5",
44
44
  "cheerio": "^1.1.2",
45
45
  "clsx": "^2.1.1",
46
46
  "dotenv": "17.2.3",
@@ -65,7 +65,7 @@
65
65
  "devDependencies": {
66
66
  "@astrojs/check": "^0.9.6",
67
67
  "@markdoc/markdoc": "^0.5.4",
68
- "@types/node": "24.10.4",
68
+ "@types/node": "24.10.8",
69
69
  "@types/react": "19.2.7",
70
70
  "@types/react-dom": "^19.2.3",
71
71
  "react": "^19.2.3",
@@ -184,31 +184,6 @@ export function SnippetContainer({ children, signature }: SnippetContainerProps)
184
184
  );
185
185
  }
186
186
 
187
- export function CondensibleSnippetCode({
188
- content,
189
- language,
190
- signature,
191
- highlighted,
192
- }: SnippetCodeProps & { signature: string; highlighted: string; language: string }) {
193
- const ranges = getCollapsedRanges(content, language, signature);
194
- const html = condensedShikiHtmlFull(highlighted, language, ranges);
195
- const offset = getCounterOffset(ranges);
196
-
197
- return (
198
- <div
199
- className={clsx(style.SnippetCode, 'stl-snippet-code-is-collapsed')}
200
- data-snippet-expanded-offset={offset}
201
- >
202
- <pre className={style.SnippetCodeContent} data-stldocs-copy-content>
203
- <code
204
- className={language === 'json' ? 'snippet-json' : 'snippet'}
205
- dangerouslySetInnerHTML={{ __html: html }}
206
- />
207
- </pre>
208
- </div>
209
- );
210
- }
211
-
212
187
  export function SnippetButtons({ content }: { content: string }) {
213
188
  void content;
214
189
  const language = useLanguage();
@@ -226,6 +201,7 @@ export function SnippetButtons({ content }: { content: string }) {
226
201
  </>
227
202
  );
228
203
  }
204
+
229
205
  export function SnippetCode({ content, signature, language: forcedLanguage }: SnippetCodeProps) {
230
206
  const lang = useLanguage();
231
207
  const language = forcedLanguage || lang;
@@ -245,13 +221,8 @@ export function SnippetCode({ content, signature, language: forcedLanguage }: Sn
245
221
  <div
246
222
  className={clsx(style.SnippetCode, isCollapsible && 'stl-snippet-code-is-collapsed')}
247
223
  data-snippet-expanded-offset={offset}
248
- >
249
- <pre className={style.SnippetCodeContent} data-stldocs-copy-content>
250
- <code
251
- className={(language as string) === 'json' ? 'snippet-json' : 'snippet'}
252
- dangerouslySetInnerHTML={{ __html: highlighted }}
253
- />
254
- </pre>
255
- </div>
224
+ data-stldocs-copy-content
225
+ dangerouslySetInnerHTML={{ __html: highlighted }}
226
+ />
256
227
  );
257
228
  }
@@ -15,6 +15,7 @@ import {
15
15
  import { ComponentProvider } from '@stainless-api/docs-ui/contexts/component';
16
16
  import { SearchProvider } from '@stainless-api/docs-search/context';
17
17
  import type { SearchSettings } from '@stainless-api/docs-search/types';
18
+ import path from 'path';
18
19
 
19
20
  let $$highlighter: HighlighterGeneric<BundledLanguage, BundledTheme> | null = null;
20
21
  async function getHighlighter() {
@@ -89,10 +90,14 @@ export function DocsSearch({ settings, currentPath }: { settings: SearchSettings
89
90
  const markdownRenderer = React.use(createMarkdownRenderer());
90
91
  const { stainlessPath, language } = parseRoute(BASE_PATH, currentPath);
91
92
  // eslint-disable-next-line turbo/no-undeclared-env-vars
92
- const pageFind = import.meta.env.DEV ? undefined : '/pagefind/pagefind.js';
93
+ const pageFind = import.meta.env.DEV
94
+ ? undefined
95
+ : path.posix.join(import.meta.env.BASE_URL, '/pagefind/pagefind.js');
93
96
 
94
- function handleSelect(path: string) {
95
- const url = path.startsWith('/') ? path : generateRoute(BASE_PATH, language, path);
97
+ function handleSelect(selectedPath: string) {
98
+ const url = selectedPath.startsWith('/')
99
+ ? selectedPath
100
+ : generateRoute(BASE_PATH, language, selectedPath);
96
101
  if (url) window.location.href = url;
97
102
  }
98
103
 
package/plugin/index.ts CHANGED
@@ -27,7 +27,7 @@ import path from 'path';
27
27
  import fs from 'fs';
28
28
  import { getSharedLogger } from '../shared/getSharedLogger';
29
29
  import { resolveSrcFile } from '../resolveSrcFile';
30
- import { mkdir } from 'fs/promises';
30
+ import { mkdir, writeFile } from 'fs/promises';
31
31
  import { fileURLToPath } from 'url';
32
32
  import prebundleWorkers from 'vite-plugin-prebundle-workers';
33
33
 
@@ -124,6 +124,7 @@ async function stlStarlightAstroIntegration(
124
124
  const resolvedId = `\0${virtualId}`;
125
125
  let playgroundsBase: string | undefined;
126
126
  let buildPlaygrounds;
127
+ let astroBase = '/';
127
128
 
128
129
  const CMS_PORT = await getPort();
129
130
 
@@ -188,6 +189,7 @@ async function stlStarlightAstroIntegration(
188
189
  }) => {
189
190
  const logger = getSharedLogger({ fallback: localLogger });
190
191
  const projectDir = astroConfig.root.pathname;
192
+ astroBase = astroConfig.base;
191
193
 
192
194
  reportError = (message: string) => logger.error(message);
193
195
 
@@ -357,6 +359,11 @@ async function stlStarlightAstroIntegration(
357
359
  }
358
360
  collectedErrors = null;
359
361
  }
362
+
363
+ const manifest = {
364
+ astroBase,
365
+ };
366
+ await writeFile(path.join(stainlessDir, 'stl-manifest.json'), JSON.stringify(manifest, null, 2));
360
367
  },
361
368
  },
362
369
  };
@@ -73,21 +73,10 @@ if (readme) {
73
73
  transformRequestSnippet={MIDDLEWARE.transformRequestSnippet}
74
74
  />
75
75
 
76
+ {/* TODO: we should not set inline styles here? */}
76
77
  <style
77
78
  is:inline
78
79
  set:text={`
79
- #stldocs-snippet-title {
80
- display: flex;
81
- gap: 5px;
82
- }
83
-
84
- .stldocs-snippet-code:not(.stldocs-snippet-response .stldocs-snippet-code) {
85
- padding: 0 !important;
86
-
87
- .astro-code {
88
- padding: 1rem;
89
- }
90
- }
91
80
 
92
81
  [data-has-sidebar]:not([data-has-toc]) .sl-container {
93
82
  max-width: 1428px;
@@ -110,21 +99,6 @@ if (readme) {
110
99
  vertical-align: text-bottom;
111
100
  }
112
101
 
113
- .sl-markdown-content .octicon {
114
- margin-right: 0.2rem;
115
- overflow: visible !important;
116
- -webkit-mask: var(--oct-icon) no-repeat;
117
- mask: var(--oct-icon) no-repeat;
118
- -webkit-mask-size: 100% 100%;
119
- mask-size: 100% 100%;
120
- background-color: currentColor;
121
- color: inherit;
122
- display: inline-block;
123
- vertical-align: text-bottom;
124
- width: 1em;
125
- height: 1em;
126
- }
127
-
128
102
  .sl-markdown-content code {
129
103
  white-space: pre-wrap;
130
104
  }
package/styles/code.css CHANGED
@@ -52,14 +52,16 @@
52
52
  }
53
53
 
54
54
  .stl-snippet-expand-button {
55
- display: none;
56
-
57
- position: relative;
55
+ position: absolute;
58
56
  left: 50%;
59
- transform: translateX(-50%);
60
- bottom: 12px;
57
+ transform: translateX(-50%) translateY(-50%);
61
58
  cursor: pointer;
62
59
  height: auto;
60
+ z-index: 100;
61
+
62
+ &:not(.stl-snippet-collapsible .stl-snippet-expand-button) {
63
+ display: none;
64
+ }
63
65
 
64
66
  &.stl-ui-button {
65
67
  background-color: var(--stl-color-background);
@@ -87,13 +89,6 @@
87
89
  }
88
90
 
89
91
  .stl-snippet-collapsible {
90
- .stl-snippet-expand-button {
91
- display: block;
92
- margin-bottom: -23px;
93
- /* Prevent clipping of the button with the container below */
94
- z-index: 100;
95
- }
96
-
97
92
  .stl-snippet-code-is-collapsed {
98
93
  .hidden {
99
94
  display: none;
package/styles/search.css CHANGED
@@ -60,6 +60,7 @@ site-search {
60
60
  width: 100%;
61
61
  max-width: 30rem;
62
62
  justify-content: start;
63
+ padding: var(--sl-button-padding-y) var(--sl-button-padding-x);
63
64
 
64
65
  > :last-child {
65
66
  margin-inline-start: auto;