@stainless-api/docs 0.1.0-beta.75 → 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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stainless-api/docs",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
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.
|
|
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.
|
|
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
|
-
|
|
250
|
-
|
|
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
|
|
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(
|
|
95
|
-
const url =
|
|
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/routes/Docs.astro
CHANGED
|
@@ -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
|
-
|
|
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;
|