@stainless-api/docs 0.1.0-beta.94 → 0.1.0-beta.96
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 +21 -0
- package/package.json +4 -4
- package/plugin/buildAlgoliaIndex.ts +10 -5
- package/plugin/globalJs/code-snippets.ts +25 -3
- package/plugin/globalJs/copy.ts +2 -1
- package/plugin/globalJs/navigation.ts +8 -9
- package/plugin/index.ts +0 -2
- package/plugin/react/Routing.tsx +4 -5
- package/plugin/routes/Overview.astro +1 -1
- package/plugin/specs/index.ts +1 -0
- package/plugin/vendor/preview.worker.docs.js +5445 -5238
- package/plugin/vendor/templates/cli.md +1 -0
- package/plugin/vendor/templates/go.md +3 -1
- package/plugin/vendor/templates/java.md +3 -1
- package/plugin/vendor/templates/kotlin.md +3 -1
- package/plugin/vendor/templates/node.md +4 -2
- package/plugin/vendor/templates/python.md +3 -1
- package/plugin/vendor/templates/ruby.md +4 -2
- package/plugin/vendor/templates/terraform.md +1 -1
- package/plugin/vendor/templates/typescript.md +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @stainless-api/docs
|
|
2
2
|
|
|
3
|
+
## 0.1.0-beta.96
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5c36876: type updates
|
|
8
|
+
- Updated dependencies [5c36876]
|
|
9
|
+
- @stainless-api/docs-ui@0.1.0-beta.73
|
|
10
|
+
- @stainless-api/docs-search@0.1.0-beta.26
|
|
11
|
+
|
|
12
|
+
## 0.1.0-beta.95
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- 6b86a8b: Support multiple snippet examples
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [6b86a8b]
|
|
21
|
+
- @stainless-api/docs-ui@0.1.0-beta.72
|
|
22
|
+
- @stainless-api/docs-search@0.1.0-beta.25
|
|
23
|
+
|
|
3
24
|
## 0.1.0-beta.94
|
|
4
25
|
|
|
5
26
|
### Minor Changes
|
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.96",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"vite-plugin-prebundle-workers": "^0.2.0",
|
|
57
57
|
"web-worker": "^1.5.0",
|
|
58
58
|
"yaml": "^2.8.2",
|
|
59
|
-
"@stainless-api/docs-search": "0.1.0-beta.
|
|
60
|
-
"@stainless-api/docs-ui": "0.1.0-beta.
|
|
59
|
+
"@stainless-api/docs-search": "0.1.0-beta.26",
|
|
60
|
+
"@stainless-api/docs-ui": "0.1.0-beta.73",
|
|
61
61
|
"@stainless-api/ui-primitives": "0.1.0-beta.47"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"vite": "^6.4.1",
|
|
74
74
|
"zod": "^4.3.5",
|
|
75
75
|
"@stainless/eslint-config": "0.1.0-beta.1",
|
|
76
|
-
"@stainless/sdk-json": "^0.1.0-beta.
|
|
76
|
+
"@stainless/sdk-json": "^0.1.0-beta.6"
|
|
77
77
|
},
|
|
78
78
|
"scripts": {
|
|
79
79
|
"vendor-deps": "tsx scripts/vendor_deps.ts",
|
|
@@ -57,11 +57,16 @@ export async function buildAlgoliaIndex({
|
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
const indexEntries = specComposite
|
|
61
|
-
.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
const indexEntries = specComposite.listUniqueSpecs().flatMap((spec) =>
|
|
61
|
+
Array.from(
|
|
62
|
+
generateIndex(
|
|
63
|
+
spec.data.sdkJson,
|
|
64
|
+
renderMarkdown,
|
|
65
|
+
true,
|
|
66
|
+
spec.data.languages.filter((l) => l !== 'sql' && l !== 'openapi'),
|
|
67
|
+
),
|
|
68
|
+
),
|
|
69
|
+
);
|
|
65
70
|
|
|
66
71
|
await buildIndex(appId, indexName, algoliaWriteKey, indexEntries, renderMarkdown);
|
|
67
72
|
infoLog('Indexing complete.');
|
|
@@ -19,9 +19,10 @@ document.addEventListener(getPageLoadEvent(), () => {
|
|
|
19
19
|
document
|
|
20
20
|
.querySelectorAll(`[data-snippet-response-pane-id="${panelId}"]`)
|
|
21
21
|
.forEach((p) => p.classList.add('stldocs-snippet-response-pane-active'));
|
|
22
|
-
document
|
|
23
|
-
.
|
|
24
|
-
.
|
|
22
|
+
document.querySelectorAll(`[data-snippet-response-tab-id="${panelId}"]`).forEach((p) => {
|
|
23
|
+
p.classList.add('stldocs-snippet-response-tab-item-active');
|
|
24
|
+
p.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'center' });
|
|
25
|
+
});
|
|
25
26
|
});
|
|
26
27
|
});
|
|
27
28
|
|
|
@@ -91,4 +92,25 @@ document.addEventListener(getPageLoadEvent(), () => {
|
|
|
91
92
|
btn.textContent = 'Show more';
|
|
92
93
|
}
|
|
93
94
|
});
|
|
95
|
+
|
|
96
|
+
document.querySelectorAll('[data-stldocs-multi-snippet-container]').forEach((container) => {
|
|
97
|
+
const radios = container.querySelectorAll<HTMLInputElement>('input[type="radio"]');
|
|
98
|
+
const panes = container.querySelectorAll<HTMLDivElement>('[data-stldocs-multi-snippet-id]');
|
|
99
|
+
|
|
100
|
+
radios.forEach((radio) => {
|
|
101
|
+
radio.addEventListener('change', (e) => {
|
|
102
|
+
if (!(e.target instanceof HTMLInputElement)) return;
|
|
103
|
+
if (e.target.checked) {
|
|
104
|
+
const selectedIndex = e.target.value;
|
|
105
|
+
panes.forEach((pane) => {
|
|
106
|
+
pane.classList.toggle(
|
|
107
|
+
'stldocs-snippet-multi-pane-active',
|
|
108
|
+
pane.dataset.stldocsMultiSnippetId === selectedIndex,
|
|
109
|
+
);
|
|
110
|
+
});
|
|
111
|
+
e.target.parentElement?.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'center' });
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
});
|
|
94
116
|
});
|
package/plugin/globalJs/copy.ts
CHANGED
|
@@ -92,7 +92,8 @@ function loadPlayground(playButton: HTMLElement) {
|
|
|
92
92
|
doc: (language === 'python' ? 'from rich import print\n' : '') + code.trimEnd(),
|
|
93
93
|
container,
|
|
94
94
|
onLanguageSelect: (value) => {
|
|
95
|
-
const originalLanguage =
|
|
95
|
+
const originalLanguage = container.querySelector<HTMLElement>('[data-stldocs-snippet-select]')
|
|
96
|
+
?.dataset.currentValue;
|
|
96
97
|
const path: string = updateSelectedLanguage(RESOLVED_API_REFERENCE_PATH, originalLanguage, value);
|
|
97
98
|
navigate(path.replace(/(\?.+)?($|#)/, (_, str, end) => (str ? str + '&play' : '?play') + end));
|
|
98
99
|
},
|
|
@@ -22,15 +22,14 @@ window.addEventListener('popstate', (ev: PopStateEvent) => {
|
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
document.addEventListener(getPageLoadEvent(), () => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
},
|
|
25
|
+
document.querySelectorAll<HTMLElement>('[data-stldocs-snippet-select]').forEach((rootElement) => {
|
|
26
|
+
initDropdown({
|
|
27
|
+
root: rootElement,
|
|
28
|
+
onSelect: (value) => {
|
|
29
|
+
const originalLanguage = rootElement.dataset.currentValue;
|
|
30
|
+
navigate(updateSelectedLanguage(RESOLVED_API_REFERENCE_PATH, originalLanguage, value));
|
|
31
|
+
},
|
|
32
|
+
});
|
|
34
33
|
});
|
|
35
34
|
|
|
36
35
|
const path = getStainlessPathForLocation();
|
package/plugin/index.ts
CHANGED
|
@@ -154,8 +154,6 @@ async function stlStarlightAstroIntegration(
|
|
|
154
154
|
const projectDir = astroConfig.root.pathname;
|
|
155
155
|
astroBase = astroConfig.base;
|
|
156
156
|
|
|
157
|
-
logger.warn('Starting spec loader!!!');
|
|
158
|
-
|
|
159
157
|
specLoader = await startSpecLoader(pluginConfig, logger, createCodegenDir());
|
|
160
158
|
|
|
161
159
|
reportError = (message: string) => logger.error(message);
|
package/plugin/react/Routing.tsx
CHANGED
|
@@ -192,16 +192,15 @@ async function highlight(content: string, language?: string) {
|
|
|
192
192
|
export function SDKSelectReactComponent({
|
|
193
193
|
selected,
|
|
194
194
|
languages,
|
|
195
|
-
id,
|
|
196
195
|
className,
|
|
196
|
+
...rest
|
|
197
197
|
}: {
|
|
198
198
|
selected: DocsLanguage;
|
|
199
199
|
languages: DocsLanguage[];
|
|
200
|
-
id: string;
|
|
201
200
|
className?: string;
|
|
202
|
-
}) {
|
|
201
|
+
} & Omit<React.ComponentProps<'div'>, 'children'>) {
|
|
203
202
|
return (
|
|
204
|
-
<Dropdown
|
|
203
|
+
<Dropdown data-current-value={selected} className={className} {...rest}>
|
|
205
204
|
<Dropdown.Trigger>
|
|
206
205
|
<Dropdown.TriggerSelectedItem>
|
|
207
206
|
<Dropdown.Icon>
|
|
@@ -244,7 +243,7 @@ function SDKRequestTitle({ snippetLanguage }: SDKRequestTitleProps) {
|
|
|
244
243
|
<SDKSelectReactComponent
|
|
245
244
|
selected={selected || 'http'}
|
|
246
245
|
languages={languages}
|
|
247
|
-
|
|
246
|
+
data-stldocs-snippet-select
|
|
248
247
|
className="stl-sdk-select stl-ui-not-prose"
|
|
249
248
|
/>
|
|
250
249
|
);
|
|
@@ -10,7 +10,7 @@ const spec = await getSDKJSONInSSR('http');
|
|
|
10
10
|
const langTargets = api.languages
|
|
11
11
|
.map((l) => l.language)
|
|
12
12
|
.filter((l) => !EXCLUDE_LANGUAGES.includes(l))
|
|
13
|
-
.filter((l) => l !== 'http'
|
|
13
|
+
.filter((l) => l !== 'http');
|
|
14
14
|
|
|
15
15
|
const langsWithSpecs = await Promise.all(
|
|
16
16
|
langTargets.map(async (language) => {
|
package/plugin/specs/index.ts
CHANGED
|
@@ -67,6 +67,7 @@ export class SpecComposite {
|
|
|
67
67
|
if (this.languages.has(lang)) {
|
|
68
68
|
throw new Error(`Language appears multiple times in the same API: ${lang}`);
|
|
69
69
|
}
|
|
70
|
+
if (lang === 'openapi' || lang === 'sql') continue;
|
|
70
71
|
this.languages.add(lang);
|
|
71
72
|
this.specs[lang] = spec;
|
|
72
73
|
}
|