@stainless-api/docs 0.1.0-beta.35 → 0.1.0-beta.37
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 +17 -0
- package/components/variables.css +1 -0
- package/package.json +13 -13
- package/plugin/buildAlgoliaIndex.ts +2 -2
- package/plugin/cms/server.ts +1 -1
- package/plugin/cms/sidebar-builder.ts +1 -1
- package/plugin/cms/worker.ts +1 -1
- package/plugin/components/SDKSelect.astro +2 -2
- package/plugin/components/SnippetCode.tsx +4 -3
- package/plugin/components/search/SearchIsland.tsx +6 -6
- package/plugin/generateAPIReferenceLink.ts +1 -1
- package/plugin/globalJs/navigation.ts +1 -1
- package/plugin/index.ts +4 -3
- package/plugin/languages.ts +1 -1
- package/plugin/loadPluginConfig.ts +11 -11
- package/plugin/middlewareBuilder/stainlessMiddleware.d.ts +1 -1
- package/plugin/react/Routing.tsx +7 -7
- package/plugin/replaceSidebarPlaceholderMiddleware.ts +1 -1
- package/plugin/routes/Docs.astro +1 -1
- package/plugin/routes/Overview.astro +1 -1
- package/plugin/routes/markdown.ts +4 -4
- package/scripts/vendor_deps.ts +1 -1
- package/stl-docs/components/ContentBreadcrumbs.tsx +2 -2
- package/stl-docs/components/PageTitle.astro +19 -1
- package/stl-docs/index.ts +3 -1
- package/stl-docs/loadStlDocsConfig.ts +13 -5
- package/theme.css +5 -5
- package/virtual-module.d.ts +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @stainless-api/docs
|
|
2
2
|
|
|
3
|
+
## 0.1.0-beta.37
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5f14e53: Render page descriptions as part of page header by default
|
|
8
|
+
- Updated dependencies [49e1b93]
|
|
9
|
+
- @stainless-api/docs-ui@0.1.0-beta.30
|
|
10
|
+
- @stainless-api/ui-primitives@0.1.0-beta.23
|
|
11
|
+
|
|
12
|
+
## 0.1.0-beta.36
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [7897575]
|
|
17
|
+
- @stainless-api/ui-primitives@0.1.0-beta.22
|
|
18
|
+
- @stainless-api/docs-ui@0.1.0-beta.29
|
|
19
|
+
|
|
3
20
|
## 0.1.0-beta.35
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/components/variables.css
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
--stldocs-color-gray-6: var(--sl-color-gray-6);
|
|
12
12
|
--stldocs-color-gray-7: var(--sl-color-gray-7);
|
|
13
13
|
--stldocs-color-gray-8: var(--sl-color-gray-8);
|
|
14
|
+
--stldocs-color-gray-9: var(--sl-color-gray-9);
|
|
14
15
|
|
|
15
16
|
--stldocs-color-accent-low: var(--sl-color-accent-low);
|
|
16
17
|
--stldocs-color-accent-high: var(--sl-color-accent-high);
|
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.37",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -32,40 +32,40 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@astrojs/markdown-remark": "^6.3.2",
|
|
35
|
-
"@astrojs/react": "^4.4.
|
|
35
|
+
"@astrojs/react": "^4.4.2",
|
|
36
36
|
"@stainless-api/sdk": "0.1.0-alpha.12",
|
|
37
37
|
"cheerio": "^1.1.2",
|
|
38
38
|
"clsx": "^2.1.1",
|
|
39
39
|
"dotenv": "17.2.3",
|
|
40
40
|
"get-port": "^7.1.0",
|
|
41
41
|
"highlight.js": "^11.11.1",
|
|
42
|
-
"lucide-react": "^0.
|
|
42
|
+
"lucide-react": "^0.553.0",
|
|
43
43
|
"marked": "^16.0.0",
|
|
44
|
-
"remark-github-alerts": "^0.1.1",
|
|
45
|
-
"shiki": "^3.9.2",
|
|
46
|
-
"web-worker": "^1.5.0",
|
|
47
|
-
"yaml": "^2.8.0",
|
|
48
44
|
"node-html-parser": "^7.0.1",
|
|
49
45
|
"rehype-parse": "^9.0.1",
|
|
50
46
|
"rehype-remark": "^10.0.1",
|
|
51
47
|
"remark-gfm": "^4.0.1",
|
|
48
|
+
"remark-github-alerts": "^0.1.1",
|
|
52
49
|
"remark-stringify": "^11.0.0",
|
|
50
|
+
"shiki": "^3.9.2",
|
|
53
51
|
"unified": "^11.0.5",
|
|
54
|
-
"
|
|
55
|
-
"
|
|
52
|
+
"web-worker": "^1.5.0",
|
|
53
|
+
"yaml": "^2.8.0",
|
|
54
|
+
"@stainless-api/ui-primitives": "0.1.0-beta.23",
|
|
55
|
+
"@stainless-api/docs-ui": "0.1.0-beta.30"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@astrojs/check": "^0.9.5",
|
|
59
59
|
"@markdoc/markdoc": "^0.5.2",
|
|
60
|
-
"@types/node": "
|
|
61
|
-
"@types/react": "^19.2.
|
|
62
|
-
"@types/react-dom": "^19.2.
|
|
60
|
+
"@types/node": "24.5.1",
|
|
61
|
+
"@types/react": "^19.2.4",
|
|
62
|
+
"@types/react-dom": "^19.2.3",
|
|
63
63
|
"react": "^19.2.0",
|
|
64
64
|
"react-dom": "^19.2.0",
|
|
65
65
|
"tsx": "^4.20.3",
|
|
66
66
|
"typescript": "5.9.3",
|
|
67
67
|
"vite": "^6.3.6",
|
|
68
|
-
"zod": "^4.
|
|
68
|
+
"zod": "^4.1.12",
|
|
69
69
|
"@stainless/sdk-json": "^0.1.0-beta.0",
|
|
70
70
|
"@stainless/eslint-config": "0.1.0-beta.0"
|
|
71
71
|
},
|
|
@@ -2,8 +2,8 @@ import Markdoc from '@markdoc/markdoc';
|
|
|
2
2
|
import Stainless from '@stainless-api/sdk';
|
|
3
3
|
import { createSDKJSON, parseInputs, transformOAS } from './cms/worker';
|
|
4
4
|
import type * as SDKJSON from '@stainless/sdk-json';
|
|
5
|
-
import { Languages } from '@stainless-api/docs-ui/
|
|
6
|
-
import { buildIndex } from '@stainless-api/docs-ui/
|
|
5
|
+
import { Languages } from '@stainless-api/docs-ui/routing';
|
|
6
|
+
import { buildIndex } from '@stainless-api/docs-ui/search/providers/algolia';
|
|
7
7
|
import type { VersionUserConfig } from './loadPluginConfig';
|
|
8
8
|
import type { AstroIntegrationLogger } from 'astro';
|
|
9
9
|
|
package/plugin/cms/server.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { readFile } from 'fs/promises';
|
|
|
4
4
|
|
|
5
5
|
import type * as SDKJSON from '@stainless/sdk-json';
|
|
6
6
|
import { createSDKJSON, parseInputs, transformOAS } from './worker';
|
|
7
|
-
import { Languages, parseRoute, type DocsLanguage } from '@stainless-api/docs-ui/
|
|
7
|
+
import { Languages, parseRoute, type DocsLanguage } from '@stainless-api/docs-ui/routing';
|
|
8
8
|
import Stainless, { APIError } from '@stainless-api/sdk';
|
|
9
9
|
|
|
10
10
|
import {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type * as SDKJSON from '@stainless/sdk-json';
|
|
2
|
-
import { generateRoute, walkTree, type DocsLanguage } from '@stainless-api/docs-ui/
|
|
2
|
+
import { generateRoute, walkTree, type DocsLanguage } from '@stainless-api/docs-ui/routing';
|
|
3
3
|
import type { StarlightRouteData } from '@astrojs/starlight/route-data';
|
|
4
4
|
|
|
5
5
|
function isResourceNonEmpty(resource: SDKJSON.Resource) {
|
package/plugin/cms/worker.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Worker from 'web-worker';
|
|
2
|
-
import { Languages, type DocsLanguage } from '@stainless-api/docs-ui/
|
|
2
|
+
import { Languages, type DocsLanguage } from '@stainless-api/docs-ui/routing';
|
|
3
3
|
import type * as SDKJSON from '@stainless/sdk-json';
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
5
|
import { dirname, resolve } from 'node:path';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
import type { DocsLanguage } from '@stainless-api/docs-ui/
|
|
3
|
-
import { parseRoute } from '@stainless-api/docs-ui/
|
|
2
|
+
import type { DocsLanguage } from '@stainless-api/docs-ui/routing';
|
|
3
|
+
import { parseRoute } from '@stainless-api/docs-ui/routing';
|
|
4
4
|
import { cmsClient } from '../cms/client';
|
|
5
5
|
import { BASE_PATH, DEFAULT_LANGUAGE, EXCLUDE_LANGUAGES } from 'virtual:stl-starlight-virtual-module';
|
|
6
6
|
import { Languages } from '../languages';
|
|
@@ -2,13 +2,14 @@ import type {
|
|
|
2
2
|
SnippetCodeProps,
|
|
3
3
|
SnippetContainerProps,
|
|
4
4
|
SnippetRequestContainerProps,
|
|
5
|
-
} from '@stainless-api/docs-ui/
|
|
6
|
-
import { useHighlight, useLanguage } from '@stainless-api/docs-ui/
|
|
7
|
-
import style from '@stainless-api/docs-ui/
|
|
5
|
+
} from '@stainless-api/docs-ui/components';
|
|
6
|
+
import { useHighlight, useLanguage } from '@stainless-api/docs-ui/contexts';
|
|
7
|
+
import style from '@stainless-api/docs-ui/style';
|
|
8
8
|
import * as cheerio from 'cheerio/slim';
|
|
9
9
|
import { EXPERIMENTAL_COLLAPSIBLE_SNIPPETS } from 'virtual:stl-starlight-virtual-module';
|
|
10
10
|
import clsx from 'clsx';
|
|
11
11
|
import { Button } from '@stainless-api/ui-primitives';
|
|
12
|
+
|
|
12
13
|
/*
|
|
13
14
|
* This may be replaced by additional data from the sdk.
|
|
14
15
|
* Without information from the sdk, we use simple heuristics per language.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { BASE_PATH, HIGHLIGHT_THEMES, SEARCH } from 'virtual:stl-starlight-virtual-module';
|
|
3
|
-
import { parseRoute, generateRoute } from '@stainless-api/docs-ui/
|
|
4
|
-
import { SearchModal } from '@stainless-api/docs-ui/
|
|
5
|
-
import { ChatModal } from '@stainless-api/docs-ui/
|
|
3
|
+
import { parseRoute, generateRoute } from '@stainless-api/docs-ui/routing';
|
|
4
|
+
import { SearchModal } from '@stainless-api/docs-ui/search';
|
|
5
|
+
import { ChatModal } from '@stainless-api/docs-ui/components/chat';
|
|
6
6
|
import * as Markdoc from '@markdoc/markdoc';
|
|
7
7
|
import { createHighlighter } from 'shiki';
|
|
8
8
|
import type { BundledLanguage, BundledTheme, HighlighterGeneric } from 'shiki';
|
|
@@ -13,9 +13,9 @@ import {
|
|
|
13
13
|
MarkdownProvider,
|
|
14
14
|
NavigationProvider,
|
|
15
15
|
SearchProvider,
|
|
16
|
-
} from '@stainless-api/docs-ui/
|
|
17
|
-
import { ComponentProvider } from '@stainless-api/docs-ui/
|
|
18
|
-
import type { SearchSettings } from '@stainless-api/docs-ui/
|
|
16
|
+
} from '@stainless-api/docs-ui/contexts';
|
|
17
|
+
import { ComponentProvider } from '@stainless-api/docs-ui/contexts/component';
|
|
18
|
+
import type { SearchSettings } from '@stainless-api/docs-ui/search/types';
|
|
19
19
|
|
|
20
20
|
let $$highlighter: HighlighterGeneric<BundledLanguage, BundledTheme> | null = null;
|
|
21
21
|
async function getHighlighter() {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import type { StarlightRouteData } from '@astrojs/starlight/route-data';
|
|
4
4
|
import type * as SDKJSON from '@stainless/sdk-json';
|
|
5
|
-
import { walkTree } from '@stainless-api/docs-ui/
|
|
5
|
+
import { walkTree } from '@stainless-api/docs-ui/routing';
|
|
6
6
|
|
|
7
7
|
const INTERNAL_REFERENCE_ENTRY_MARKER = 'STL_STARLIGHT_API_REFERENCE_METHOD_LINK_PLACEHOLDER';
|
|
8
8
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { parseRoute, scrollToPath } from '@stainless-api/docs-ui/
|
|
1
|
+
import { parseRoute, scrollToPath } from '@stainless-api/docs-ui/routing';
|
|
2
2
|
import { BASE_PATH } from 'virtual:stl-starlight-virtual-module';
|
|
3
3
|
import { updateSelectedLanguage } from '../languages';
|
|
4
4
|
import { navigate } from 'astro:transitions/client';
|
package/plugin/index.ts
CHANGED
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
type SpecRetrieverConfig,
|
|
22
22
|
} from './loadPluginConfig';
|
|
23
23
|
import { buildVirtualModuleString } from '../shared/virtualModule';
|
|
24
|
+
import type * as StlStarlightVirtualModule from 'virtual:stl-starlight-virtual-module';
|
|
24
25
|
import path from 'path';
|
|
25
26
|
import fs from 'fs';
|
|
26
27
|
import { getSharedLogger } from '../shared/getSharedLogger';
|
|
@@ -225,7 +226,7 @@ async function stlStarlightAstroIntegration(
|
|
|
225
226
|
PROPERTY_SETTINGS: pluginConfig.propertySettings,
|
|
226
227
|
SEARCH: pluginConfig.search,
|
|
227
228
|
ENABLE_CONTEXT_MENU: pluginConfig.contextMenu,
|
|
228
|
-
}),
|
|
229
|
+
} satisfies Omit<typeof StlStarlightVirtualModule, 'MIDDLEWARE'>),
|
|
229
230
|
vmMiddlewareExport,
|
|
230
231
|
].join('\n');
|
|
231
232
|
}
|
|
@@ -334,5 +335,5 @@ export function stainlessStarlight(someUserConfig: SomeStainlessStarlightUserCon
|
|
|
334
335
|
}
|
|
335
336
|
|
|
336
337
|
// Additional exports we want for Stainless <-> docs integration.
|
|
337
|
-
export { parseStainlessPath } from '@stainless-api/docs-ui/
|
|
338
|
-
export { renderMarkdown } from '@stainless-api/docs-ui/
|
|
338
|
+
export { parseStainlessPath } from '@stainless-api/docs-ui/routing';
|
|
339
|
+
export { renderMarkdown } from '@stainless-api/docs-ui/markdown';
|
package/plugin/languages.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DocsLanguage } from '@stainless-api/docs-ui/
|
|
1
|
+
import type { DocsLanguage } from '@stainless-api/docs-ui/routing';
|
|
2
2
|
import KotlinIcon from './assets/languages/kotlin.svg';
|
|
3
3
|
import RubyIcon from './assets/languages/ruby.svg';
|
|
4
4
|
import TerraformIcon from './assets/languages/terraform.svg';
|
|
@@ -3,8 +3,8 @@ import { homedir } from 'os';
|
|
|
3
3
|
import { existsSync, readFileSync } from 'fs';
|
|
4
4
|
|
|
5
5
|
import type { CreateShikiHighlighterOptions } from '@astrojs/markdown-remark';
|
|
6
|
-
import type { DocsLanguage } from '@stainless-api/docs-ui/
|
|
7
|
-
import type { PropertySettingsType } from '@stainless-api/docs-ui/
|
|
6
|
+
import type { DocsLanguage } from '@stainless-api/docs-ui/routing';
|
|
7
|
+
import type { PropertySettingsType } from '@stainless-api/docs-ui/contexts';
|
|
8
8
|
import type { InputFilePaths } from '../plugin/cms/server';
|
|
9
9
|
import { bold } from '../shared/terminalUtils';
|
|
10
10
|
|
|
@@ -50,8 +50,8 @@ export type StainlessStarlightUserConfig = {
|
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* Optional mount point for API reference docs.
|
|
53
|
-
* Default: `/api`
|
|
54
53
|
* Example: `/my-api` → docs available at `/my-api/…`.
|
|
54
|
+
* @default `/api`
|
|
55
55
|
*/
|
|
56
56
|
basePath?: string;
|
|
57
57
|
|
|
@@ -63,8 +63,8 @@ export type StainlessStarlightUserConfig = {
|
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
65
|
* Optional language to treat as the default when the user hasn't selected one.
|
|
66
|
-
*
|
|
67
|
-
*
|
|
66
|
+
* Example: `'python'`
|
|
67
|
+
* @default 'http'
|
|
68
68
|
*/
|
|
69
69
|
defaultLanguage?: DocsLanguage;
|
|
70
70
|
|
|
@@ -98,7 +98,7 @@ export type StainlessStarlightUserConfig = {
|
|
|
98
98
|
contentPanel?: {
|
|
99
99
|
/**
|
|
100
100
|
* Optional layout for the content panel.
|
|
101
|
-
*
|
|
101
|
+
* @default 'double-pane'
|
|
102
102
|
*/
|
|
103
103
|
layout?: ContentLayout;
|
|
104
104
|
};
|
|
@@ -116,7 +116,7 @@ export type StainlessStarlightUserConfig = {
|
|
|
116
116
|
* When set to `true`, the enableAISearch` setting turns on support for
|
|
117
117
|
* LLM-based conversations with the API documentation
|
|
118
118
|
*
|
|
119
|
-
*
|
|
119
|
+
* @default false
|
|
120
120
|
*/
|
|
121
121
|
enableAISearch?: boolean;
|
|
122
122
|
};
|
|
@@ -125,14 +125,14 @@ export type StainlessStarlightUserConfig = {
|
|
|
125
125
|
* Enable experimental collapsible code snippets. Snippets will be collapsed by default for
|
|
126
126
|
* single-pane and mobile layouts.
|
|
127
127
|
*
|
|
128
|
-
*
|
|
128
|
+
* @default false
|
|
129
129
|
*/
|
|
130
130
|
experimentalCollapsibleSnippets?: boolean;
|
|
131
131
|
|
|
132
132
|
/**
|
|
133
133
|
* Whether to show the context menu with options like "Copy as Markdown" and "Open in ChatGPT".
|
|
134
134
|
*
|
|
135
|
-
*
|
|
135
|
+
* @default true
|
|
136
136
|
*/
|
|
137
137
|
contextMenu?: boolean;
|
|
138
138
|
};
|
|
@@ -336,11 +336,11 @@ function normalizeConfig(partial: SomeStainlessStarlightUserConfig, command: Ast
|
|
|
336
336
|
export type NormalizedStainlessStarlightConfig = ReturnType<typeof normalizeConfig>;
|
|
337
337
|
|
|
338
338
|
/*
|
|
339
|
-
The goal of the code in this file is to take a user's config and normalize it.
|
|
339
|
+
The goal of the code in this file is to take a user's config and normalize it.
|
|
340
340
|
Specifically: we want a single complete config format used throughout the internals of the plugin.
|
|
341
341
|
|
|
342
342
|
We've tried to avoid any config values being optional/undefined. To accomplish this:
|
|
343
|
-
- Any optional config values should have their defaults set here: eg. basePath defaults to /api
|
|
343
|
+
- Any optional config values should have their defaults set here: eg. basePath defaults to /api
|
|
344
344
|
- If a field is only used in certain contexts, we make each context a discriminated union (see SpecRetrieverConfig)
|
|
345
345
|
- We prefer empty arrays over undefined/null
|
|
346
346
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TransformRequestSnippetFn } from '@stainless-api/docs-ui/
|
|
1
|
+
import type { TransformRequestSnippetFn } from '@stainless-api/docs-ui/components/sdk';
|
|
2
2
|
|
|
3
3
|
export type StlStarlightMiddleware = {
|
|
4
4
|
transformRequestSnippet?: TransformRequestSnippetFn;
|
package/plugin/react/Routing.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import remarkGfmAlerts from 'remark-github-alerts';
|
|
|
7
7
|
import type { MarkdownHeading } from 'astro';
|
|
8
8
|
import type { StarlightRouteData } from '@astrojs/starlight/route-data';
|
|
9
9
|
import type * as SDKJSON from '@stainless/sdk-json';
|
|
10
|
-
import { LanguageNames, type DocsLanguage } from '@stainless-api/docs-ui/
|
|
10
|
+
import { LanguageNames, type DocsLanguage } from '@stainless-api/docs-ui/routing';
|
|
11
11
|
|
|
12
12
|
import {
|
|
13
13
|
generateRouteList,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
walkTree,
|
|
17
17
|
SupportedLanguageSyntaxes,
|
|
18
18
|
getLanguageSnippet,
|
|
19
|
-
} from '@stainless-api/docs-ui/
|
|
19
|
+
} from '@stainless-api/docs-ui/routing';
|
|
20
20
|
|
|
21
21
|
import {
|
|
22
22
|
DocsProvider,
|
|
@@ -24,9 +24,9 @@ import {
|
|
|
24
24
|
NavigationProvider,
|
|
25
25
|
useSpec,
|
|
26
26
|
type ContentPanelLayout,
|
|
27
|
-
} from '@stainless-api/docs-ui/
|
|
27
|
+
} from '@stainless-api/docs-ui/contexts';
|
|
28
28
|
|
|
29
|
-
import { flatResources, getResourceFromSpec } from '@stainless-api/docs-ui/
|
|
29
|
+
import { flatResources, getResourceFromSpec } from '@stainless-api/docs-ui/utils';
|
|
30
30
|
|
|
31
31
|
import {
|
|
32
32
|
SDKMethod,
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
SDKIcon,
|
|
37
37
|
SDKOverview,
|
|
38
38
|
SDKLanguageBlock,
|
|
39
|
-
} from '@stainless-api/docs-ui/
|
|
39
|
+
} from '@stainless-api/docs-ui/components';
|
|
40
40
|
|
|
41
41
|
import { Dropdown } from '@stainless-api/docs/components';
|
|
42
42
|
|
|
@@ -49,11 +49,11 @@ import {
|
|
|
49
49
|
PROPERTY_SETTINGS,
|
|
50
50
|
ENABLE_CONTEXT_MENU,
|
|
51
51
|
} from 'virtual:stl-starlight-virtual-module';
|
|
52
|
-
import style from '@stainless-api/docs-ui/
|
|
52
|
+
import style from '@stainless-api/docs-ui/style';
|
|
53
53
|
import { createHighlighter, type BundledLanguage, type BundledTheme, type HighlighterGeneric } from 'shiki';
|
|
54
54
|
import { SnippetCode, SnippetContainer, SnippetRequestContainer } from '../components/SnippetCode';
|
|
55
55
|
import type { StlStarlightMiddleware } from '../middlewareBuilder/stainlessMiddleware';
|
|
56
|
-
import { ComponentProvider } from '@stainless-api/docs-ui/
|
|
56
|
+
import { ComponentProvider } from '@stainless-api/docs-ui/contexts/component';
|
|
57
57
|
import { AIDropdown } from '../../stl-docs/components/AIDropdown';
|
|
58
58
|
import { ChevronsUpDownIcon } from 'lucide-react';
|
|
59
59
|
|
|
@@ -5,7 +5,7 @@ import { BASE_PATH } from 'virtual:stl-starlight-virtual-module';
|
|
|
5
5
|
import { getAPIReferencePlaceholderItems } from './referencePlaceholderUtils';
|
|
6
6
|
import { getMethodFromSDKJSON, recursiveReplacePlaceholderItems } from './generateAPIReferenceLink';
|
|
7
7
|
import { forceGenerateRoute } from './cms/sidebar-builder';
|
|
8
|
-
import { parseRoute } from '@stainless-api/docs-ui/
|
|
8
|
+
import { parseRoute } from '@stainless-api/docs-ui/routing';
|
|
9
9
|
|
|
10
10
|
// this fn is loaded in the plugin via addRouteMiddleware
|
|
11
11
|
|
package/plugin/routes/Docs.astro
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
RenderSpec,
|
|
9
9
|
astroMarkdownRender,
|
|
10
10
|
} from '../react/Routing';
|
|
11
|
-
import { getResourceFromSpec } from '@stainless-api/docs-ui/
|
|
11
|
+
import { getResourceFromSpec } from '@stainless-api/docs-ui/utils';
|
|
12
12
|
import { BASE_PATH, CONTENT_PANEL_LAYOUT, MIDDLEWARE } from 'virtual:stl-starlight-virtual-module';
|
|
13
13
|
|
|
14
14
|
const spec = await cmsClient.getSpec();
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import StarlightPage from '@astrojs/starlight/components/StarlightPage.astro';
|
|
3
3
|
import { EXCLUDE_LANGUAGES } from 'virtual:stl-starlight-virtual-module';
|
|
4
4
|
import { cmsClient } from '../cms/client';
|
|
5
|
-
import type { DocsLanguage } from '@stainless-api/docs-ui/
|
|
5
|
+
import type { DocsLanguage } from '@stainless-api/docs-ui/routing';
|
|
6
6
|
import { RenderLibraries, RenderSpecOverview, type SpecMetadata } from '../react/Routing';
|
|
7
7
|
|
|
8
8
|
const spec = await cmsClient.getSpec();
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { APIRoute, GetStaticPaths } from 'astro';
|
|
2
2
|
import { cmsClient } from '../cms/client';
|
|
3
3
|
import { generateDocsRoutes, getReadmeContent } from '../react/Routing';
|
|
4
|
-
import { getResourceFromSpec } from '@stainless-api/docs-ui/
|
|
4
|
+
import { getResourceFromSpec } from '@stainless-api/docs-ui/utils';
|
|
5
5
|
|
|
6
|
-
import { renderMarkdown } from '@stainless-api/docs-ui/
|
|
6
|
+
import { renderMarkdown } from '@stainless-api/docs-ui/markdown';
|
|
7
7
|
|
|
8
|
-
import { parseStainlessPath, type DocsLanguage } from '@stainless-api/docs-ui/
|
|
9
|
-
import type { EnvironmentType } from '@stainless-api/docs-ui/
|
|
8
|
+
import { parseStainlessPath, type DocsLanguage } from '@stainless-api/docs-ui/routing';
|
|
9
|
+
import type { EnvironmentType } from '@stainless-api/docs-ui/markdown/utils';
|
|
10
10
|
import { PROPERTY_SETTINGS, MIDDLEWARE } from 'virtual:stl-starlight-virtual-module';
|
|
11
11
|
|
|
12
12
|
type RouteProps = {
|
package/scripts/vendor_deps.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChevronRight } from 'lucide-react';
|
|
2
|
-
import { Join } from '@stainless-api/docs-ui/
|
|
3
|
-
import style from '@stainless-api/docs-ui/
|
|
2
|
+
import { Join } from '@stainless-api/docs-ui/components';
|
|
3
|
+
import style from '@stainless-api/docs-ui/style';
|
|
4
4
|
import type { StarlightRouteData } from '@astrojs/starlight/route-data';
|
|
5
5
|
|
|
6
6
|
type Breadcrumb = { title: string; href: string };
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
---
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
ENABLE_PROSE_MARKDOWN_RENDERING,
|
|
4
|
+
ENABLE_CONTEXT_MENU,
|
|
5
|
+
RENDER_PAGE_DESCRIPTIONS,
|
|
6
|
+
} from 'virtual:stl-docs-virtual-module';
|
|
3
7
|
import type { StarlightRouteData } from '@astrojs/starlight/route-data';
|
|
4
8
|
import Default from '@astrojs/starlight/components/PageTitle.astro';
|
|
5
9
|
import { ContentBreadcrumbs } from './ContentBreadcrumbs';
|
|
@@ -49,6 +53,9 @@ function shouldShowAIDropdown() {
|
|
|
49
53
|
}
|
|
50
54
|
|
|
51
55
|
const showAIDropdown = shouldShowAIDropdown();
|
|
56
|
+
|
|
57
|
+
const description = Astro.locals.starlightRoute.entry.data.description;
|
|
58
|
+
const shouldRenderDescription = RENDER_PAGE_DESCRIPTIONS;
|
|
52
59
|
---
|
|
53
60
|
|
|
54
61
|
{
|
|
@@ -59,6 +66,17 @@ const showAIDropdown = shouldShowAIDropdown();
|
|
|
59
66
|
{showAIDropdown && <AIDropdown />}
|
|
60
67
|
</div>
|
|
61
68
|
<Default />
|
|
69
|
+
{!!description && shouldRenderDescription && <p class="description">{description}</p>}
|
|
62
70
|
</>
|
|
63
71
|
)
|
|
64
72
|
}
|
|
73
|
+
|
|
74
|
+
<style>
|
|
75
|
+
p.description {
|
|
76
|
+
font-size: var(--stl-ui-type-scale-text-xl);
|
|
77
|
+
font-weight: 400;
|
|
78
|
+
line-height: 1.4;
|
|
79
|
+
letter-spacing: -0.02em;
|
|
80
|
+
margin-top: 0.4em;
|
|
81
|
+
}
|
|
82
|
+
</style>
|
package/stl-docs/index.ts
CHANGED
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
type StarlightSidebarConfig,
|
|
19
19
|
} from './loadStlDocsConfig';
|
|
20
20
|
import { buildVirtualModuleString } from '../shared/virtualModule';
|
|
21
|
+
import type * as StlDocsVirtualModule from 'virtual:stl-docs-virtual-module';
|
|
21
22
|
import { resolveSrcFile } from '../resolveSrcFile';
|
|
22
23
|
import { stainlessDocsMarkdownRenderer } from './proseMarkdown/proseMarkdownIntegration';
|
|
23
24
|
import { setSharedLogger } from '../shared/getSharedLogger';
|
|
@@ -159,7 +160,8 @@ function stainlessDocsIntegration(
|
|
|
159
160
|
ENABLE_PROSE_MARKDOWN_RENDERING: config.enableProseMarkdownRendering,
|
|
160
161
|
// TODO: do not duplicate this between both virtual modules
|
|
161
162
|
ENABLE_CONTEXT_MENU: config.contextMenu,
|
|
162
|
-
|
|
163
|
+
RENDER_PAGE_DESCRIPTIONS: config.renderPageDescriptions,
|
|
164
|
+
} satisfies typeof StlDocsVirtualModule);
|
|
163
165
|
}
|
|
164
166
|
},
|
|
165
167
|
},
|
|
@@ -46,7 +46,7 @@ type Tabs = {
|
|
|
46
46
|
/**
|
|
47
47
|
* Whether to hide the tab in the tab bar.
|
|
48
48
|
*
|
|
49
|
-
*
|
|
49
|
+
* @default false
|
|
50
50
|
*/
|
|
51
51
|
hidden?: boolean;
|
|
52
52
|
}[];
|
|
@@ -71,16 +71,23 @@ export type StainlessDocsUserConfig = {
|
|
|
71
71
|
/**
|
|
72
72
|
* Disable markdown rendering for prose content. Only disable this if it is causing issues.
|
|
73
73
|
*
|
|
74
|
-
*
|
|
74
|
+
* @default false
|
|
75
75
|
*/
|
|
76
76
|
disableProseMarkdownRendering?: boolean;
|
|
77
77
|
};
|
|
78
78
|
/**
|
|
79
79
|
* Whether to show the context menu with options like "Copy as Markdown" and "Open in ChatGPT".
|
|
80
80
|
*
|
|
81
|
-
*
|
|
81
|
+
* @default true
|
|
82
82
|
*/
|
|
83
83
|
contextMenu?: boolean;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Whether to render page descriptions in prose page headers
|
|
87
|
+
*
|
|
88
|
+
* @default true
|
|
89
|
+
*/
|
|
90
|
+
renderPageDescriptions?: boolean;
|
|
84
91
|
} & PassThroughStarlightConfigOptions;
|
|
85
92
|
|
|
86
93
|
type HeaderLayout = 'default' | 'stacked';
|
|
@@ -150,6 +157,7 @@ function normalizeConfig(userConfig: StainlessDocsUserConfig) {
|
|
|
150
157
|
enableProseMarkdownRendering:
|
|
151
158
|
userConfig.experimental?.disableProseMarkdownRendering === true ? false : true,
|
|
152
159
|
contextMenu: userConfig.contextMenu ?? true,
|
|
160
|
+
renderPageDescriptions: userConfig.renderPageDescriptions ?? true,
|
|
153
161
|
};
|
|
154
162
|
|
|
155
163
|
return configWithDefaults;
|
|
@@ -158,11 +166,11 @@ function normalizeConfig(userConfig: StainlessDocsUserConfig) {
|
|
|
158
166
|
export type NormalizedStainlessDocsConfig = ReturnType<typeof normalizeConfig>;
|
|
159
167
|
|
|
160
168
|
/*
|
|
161
|
-
The goal of the code in this file is to take a user's config and normalize it.
|
|
169
|
+
The goal of the code in this file is to take a user's config and normalize it.
|
|
162
170
|
Specifically: we want a single complete config format used throughout the internals of the plugin.
|
|
163
171
|
|
|
164
172
|
We've tried to avoid any config values being optional/undefined. To accomplish this:
|
|
165
|
-
- Any optional config values should have their defaults set here: eg. basePath defaults to /api
|
|
173
|
+
- Any optional config values should have their defaults set here: eg. basePath defaults to /api
|
|
166
174
|
- If a field is only used in certain contexts, we make each context a discriminated union (see SpecRetrieverConfig)
|
|
167
175
|
- We prefer empty arrays over undefined/null
|
|
168
176
|
*/
|
package/theme.css
CHANGED
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
@import '@stainless-api/ui-primitives/styles.css';
|
|
15
15
|
@import './styles/mintlify-compat.css';
|
|
16
16
|
|
|
17
|
-
@import '@stainless-api/docs-ui/
|
|
18
|
-
@import '@stainless-api/docs-ui/
|
|
19
|
-
@import '@stainless-api/docs-ui/
|
|
20
|
-
@import '@stainless-api/docs-ui/
|
|
21
|
-
@import '@stainless-api/docs-ui/
|
|
17
|
+
@import '@stainless-api/docs-ui/styles/resets.css';
|
|
18
|
+
@import '@stainless-api/docs-ui/styles/primitives.css';
|
|
19
|
+
@import '@stainless-api/docs-ui/styles/main.css';
|
|
20
|
+
@import '@stainless-api/docs-ui/styles/snippets.css';
|
|
21
|
+
@import '@stainless-api/docs-ui/styles/search.css';
|
|
22
22
|
|
|
23
23
|
@import './components/variables.css';
|
package/virtual-module.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare module 'virtual:stl-starlight-virtual-module' {
|
|
2
2
|
import type { CreateShikiHighlighterOptions } from '@astrojs/markdown-remark';
|
|
3
|
-
import type { PropertySettingsType } from '@stainless-api/docs-ui/
|
|
3
|
+
import type { PropertySettingsType } from '@stainless-api/docs-ui/contexts';
|
|
4
4
|
import type { StlStarlightMiddleware } from '@stainless-api/docs/plugin/MiddlewareTypes';
|
|
5
5
|
import type { StainlessStarlightUserConfig } from './plugin/loadPluginConfig';
|
|
6
6
|
|
|
@@ -44,4 +44,5 @@ declare module 'virtual:stl-docs-virtual-module' {
|
|
|
44
44
|
export const API_REFERENCE_BASE_PATH: string | null;
|
|
45
45
|
export const ENABLE_PROSE_MARKDOWN_RENDERING: boolean;
|
|
46
46
|
export const ENABLE_CONTEXT_MENU: boolean;
|
|
47
|
+
export const RENDER_PAGE_DESCRIPTIONS: boolean;
|
|
47
48
|
}
|