@stainless-api/docs 0.1.0-beta.1 → 0.1.0-beta.11
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 +80 -0
- package/components/variables.css +0 -27
- package/package.json +6 -5
- package/plugin/components/SnippetCode.tsx +6 -3
- package/plugin/components/search/SearchAlgolia.astro +0 -7
- package/plugin/globalJs/navigation.ts +0 -1
- package/plugin/helpers/getPageLoadEvent.ts +1 -1
- package/plugin/index.ts +19 -0
- package/plugin/loadPluginConfig.ts +8 -0
- package/plugin/react/Routing.tsx +4 -3
- package/plugin/replaceSidebarPlaceholderMiddleware.ts +4 -0
- package/plugin/routes/Docs.astro +0 -8
- package/plugin/routes/Overview.astro +1 -8
- package/stl-docs/components/APIReferenceAIDropdown.tsx +40 -68
- package/stl-docs/components/Header.astro +1 -1
- package/stl-docs/components/ThemeSelect.astro +2 -0
- package/stl-docs/components/content-panel/ContentPanel.astro +11 -14
- package/stl-docs/components/content-panel/ProseAIDropdown.tsx +8 -17
- package/stl-docs/components/headers/DefaultHeader.astro +1 -1
- package/stl-docs/components/headers/HeaderLinks.astro +1 -1
- package/stl-docs/components/headers/StackedHeader.astro +2 -2
- package/stl-docs/components/icons/chat-gpt.tsx +17 -0
- package/stl-docs/components/icons/claude.tsx +10 -0
- package/stl-docs/components/icons/markdown.tsx +10 -0
- package/stl-docs/components/mintlify-compat/Accordion.astro +7 -38
- package/stl-docs/components/mintlify-compat/AccordionGroup.astro +9 -23
- package/stl-docs/components/mintlify-compat/Columns.astro +40 -42
- package/stl-docs/components/mintlify-compat/Frame.astro +16 -18
- package/stl-docs/components/mintlify-compat/Step.astro +30 -32
- package/stl-docs/components/mintlify-compat/Steps.astro +8 -10
- package/stl-docs/components/mintlify-compat/callouts/Callout.astro +10 -3
- package/stl-docs/components/mintlify-compat/callouts/Check.astro +7 -3
- package/stl-docs/components/mintlify-compat/callouts/Danger.astro +7 -3
- package/stl-docs/components/mintlify-compat/callouts/Info.astro +7 -3
- package/stl-docs/components/mintlify-compat/callouts/Note.astro +7 -3
- package/stl-docs/components/mintlify-compat/callouts/Tip.astro +7 -3
- package/stl-docs/components/mintlify-compat/callouts/Warning.astro +7 -3
- package/stl-docs/components/mintlify-compat/card.css +33 -35
- package/stl-docs/components/nav-tabs/SecondaryNavTabs.astro +0 -1
- package/stl-docs/components/nav-tabs/buildNavLinks.ts +3 -3
- package/stl-docs/components/{Sidebar.astro → sidebars/BaseSidebar.astro} +2 -3
- package/stl-docs/components/sidebars/SDKSelectSidebar.astro +8 -0
- package/stl-docs/index.ts +17 -4
- package/stl-docs/loadStlDocsConfig.ts +3 -2
- package/stl-docs/tabsMiddleware.ts +2 -2
- package/styles/code.css +119 -126
- package/styles/links.css +37 -39
- package/styles/overrides.css +55 -57
- package/styles/page.css +53 -51
- package/styles/sdk_select.css +6 -7
- package/styles/search.css +65 -67
- package/styles/sidebar.css +194 -128
- package/styles/toc.css +37 -33
- package/theme.css +9 -1
- package/tsconfig.json +1 -1
- package/virtual-module.d.ts +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,85 @@
|
|
|
1
1
|
# @stainless-api/docs
|
|
2
2
|
|
|
3
|
+
## 0.1.0-beta.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c96f895: Remove css layers, update sidebar styles, add new prose elements
|
|
8
|
+
- Updated dependencies [c96f895]
|
|
9
|
+
- @stainless-api/docs-ui@0.1.0-beta.8
|
|
10
|
+
- @stainless-api/ui-primitives@0.1.0-beta.9
|
|
11
|
+
|
|
12
|
+
## 0.1.0-beta.10
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- dc059d2: should include option in stl-docs virtual module
|
|
17
|
+
|
|
18
|
+
## 0.1.0-beta.9
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- d15a520: fix initialization of dropdown buttons
|
|
23
|
+
- Updated dependencies [d15a520]
|
|
24
|
+
- @stainless-api/ui-primitives@0.1.0-beta.8
|
|
25
|
+
- @stainless-api/docs-ui@0.1.0-beta.7
|
|
26
|
+
|
|
27
|
+
## 0.1.0-beta.8
|
|
28
|
+
|
|
29
|
+
### Minor Changes
|
|
30
|
+
|
|
31
|
+
- 917493d: move stainlessDocs into default export
|
|
32
|
+
|
|
33
|
+
## 0.1.0-beta.7
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- Updated dependencies [34e7c61]
|
|
38
|
+
- @stainless-api/ui-primitives@0.1.0-beta.7
|
|
39
|
+
- @stainless-api/docs-ui@0.1.0-beta.6
|
|
40
|
+
|
|
41
|
+
## 0.1.0-beta.6
|
|
42
|
+
|
|
43
|
+
### Patch Changes
|
|
44
|
+
|
|
45
|
+
- 34cbd12: verify publishing
|
|
46
|
+
- Updated dependencies [f664b4d]
|
|
47
|
+
- Updated dependencies [34cbd12]
|
|
48
|
+
- @stainless-api/ui-primitives@0.1.0-beta.6
|
|
49
|
+
- @stainless-api/docs-ui@0.1.0-beta.5
|
|
50
|
+
|
|
51
|
+
## 0.1.0-beta.5
|
|
52
|
+
|
|
53
|
+
### Patch Changes
|
|
54
|
+
|
|
55
|
+
- Updated dependencies [e7a2a96]
|
|
56
|
+
- @stainless-api/ui-primitives@0.1.0-beta.5
|
|
57
|
+
- @stainless-api/docs-ui@0.1.0-beta.4
|
|
58
|
+
|
|
59
|
+
## 0.1.0-beta.4
|
|
60
|
+
|
|
61
|
+
### Patch Changes
|
|
62
|
+
|
|
63
|
+
- Updated dependencies [2853ae8]
|
|
64
|
+
- @stainless-api/ui-primitives@0.1.0-beta.4
|
|
65
|
+
- @stainless-api/docs-ui@0.1.0-beta.3
|
|
66
|
+
|
|
67
|
+
## 0.1.0-beta.3
|
|
68
|
+
|
|
69
|
+
### Patch Changes
|
|
70
|
+
|
|
71
|
+
- Updated dependencies [870af8d]
|
|
72
|
+
- @stainless-api/ui-primitives@0.1.0-beta.3
|
|
73
|
+
- @stainless-api/docs-ui@0.1.0-beta.2
|
|
74
|
+
|
|
75
|
+
## 0.1.0-beta.2
|
|
76
|
+
|
|
77
|
+
### Patch Changes
|
|
78
|
+
|
|
79
|
+
- Updated dependencies [7a5c841]
|
|
80
|
+
- @stainless-api/docs-ui@0.1.0-beta.2
|
|
81
|
+
- @stainless-api/ui-primitives@0.1.0-beta.2
|
|
82
|
+
|
|
3
83
|
## 0.1.0-beta.1
|
|
4
84
|
|
|
5
85
|
### Patch Changes
|
package/components/variables.css
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
:root {
|
|
2
|
-
--sl-font: 'Geist', system-ui, sans-serif;
|
|
3
|
-
--sl-font-mono: 'Geist Mono', ui-monospace, monospace;
|
|
4
|
-
|
|
5
2
|
--stldocs-font: var(--sl-font, system-ui, sans-serif);
|
|
6
3
|
--stldocs-font-mono: var(--sl-font-mono, ui-monospace, monospace);
|
|
7
4
|
|
|
@@ -74,30 +71,6 @@
|
|
|
74
71
|
--stldocs-expander-right-margin: 8px;
|
|
75
72
|
--stldocs-font-size-body: 14px;
|
|
76
73
|
--stldocs-font-size-body-xs: 12px;
|
|
77
|
-
|
|
78
|
-
/* UI Overrides */
|
|
79
|
-
--stl-ui-button-border-radius: var(--sl-button-border-radius);
|
|
80
|
-
--stl-ui-text-body: var(--sl-text-sm);
|
|
81
|
-
--stl-ui-font-family: var(--sl-font);
|
|
82
|
-
--stl-ui-button-size: var(--sl-button-size);
|
|
83
|
-
|
|
84
|
-
--stl-ui-color-accent-low: var(--sl-color-accent-low);
|
|
85
|
-
--stl-ui-color-accent: var(--sl-color-accent);
|
|
86
|
-
--stl-ui-color-accent-high: var(--sl-color-accent-high);
|
|
87
|
-
|
|
88
|
-
--stl-ui-color-text: var(--sl-color-text);
|
|
89
|
-
--stl-ui-color-text-secondary: var(--sl-color-text-secondary);
|
|
90
|
-
--stl-ui-color-text-tertiary: var(--sl-color-text-tertiary);
|
|
91
|
-
--stl-ui-color-text-invert: var(--sl-color-text-invert);
|
|
92
|
-
--stl-ui-color-text-accent: var(--sl-color-text-accent);
|
|
93
|
-
|
|
94
|
-
--stl-ui-color-bg: var(--sl-color-bg);
|
|
95
|
-
--stl-ui-color-bg-ui: var(--sl-color-bg-ui);
|
|
96
|
-
--stl-ui-color-bg-inline-code: var(--sl-color-bg-inline-code);
|
|
97
|
-
|
|
98
|
-
--stl-ui-color-hairline-light: var(--sl-color-hairline-light);
|
|
99
|
-
--stl-ui-color-hairline: var(--sl-color-hairline);
|
|
100
|
-
--stl-ui-color-hairline-shade: var(--sl-color-hairline-shade);
|
|
101
74
|
}
|
|
102
75
|
|
|
103
76
|
/* These are the theme overrides - we need to come up with a good way to do this in starlight */
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stainless-api/docs",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.11",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
7
|
"description": "",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"exports": {
|
|
10
|
+
".": "./stl-docs/index.ts",
|
|
10
11
|
"./plugin": "./plugin/index.ts",
|
|
11
12
|
"./OverviewRoute": "./plugin/routes/Overview.astro",
|
|
12
13
|
"./DocsRoute": "./plugin/routes/Docs.astro",
|
|
@@ -16,10 +17,10 @@
|
|
|
16
17
|
"./replaceSidebarPlaceholderMiddleware": "./plugin/replaceSidebarPlaceholderMiddleware.ts",
|
|
17
18
|
"./plugin/middleware": "./plugin/middlewareBuilder/stlStarlightMiddleware.ts",
|
|
18
19
|
"./plugin/MiddlewareTypes": "./plugin/middlewareBuilder/stainlessMiddleware.d.ts",
|
|
19
|
-
"./stainless-docs": "./stl-docs/index.ts",
|
|
20
20
|
"./Header": "./stl-docs/components/Header.astro",
|
|
21
21
|
"./ThemeSelect": "./stl-docs/components/ThemeSelect.astro",
|
|
22
|
-
"./
|
|
22
|
+
"./BaseSidebar": "./stl-docs/components/sidebars/BaseSidebar.astro",
|
|
23
|
+
"./SDKSelectSidebar": "./stl-docs/components/sidebars/SDKSelectSidebar.astro",
|
|
23
24
|
"./ContentPanel": "./stl-docs/components/content-panel/ContentPanel.astro",
|
|
24
25
|
"./tabsMiddleware": "./stl-docs/tabsMiddleware.ts",
|
|
25
26
|
"./stainless-docs/mintlify-compat": "./stl-docs/components/mintlify-compat/index.ts",
|
|
@@ -54,8 +55,8 @@
|
|
|
54
55
|
"shiki": "^3.9.2",
|
|
55
56
|
"web-worker": "^1.5.0",
|
|
56
57
|
"yaml": "^2.8.0",
|
|
57
|
-
"@stainless-api/docs-ui": "0.1.0-beta.
|
|
58
|
-
"@stainless-api/ui-primitives": "0.1.0-beta.
|
|
58
|
+
"@stainless-api/docs-ui": "0.1.0-beta.8",
|
|
59
|
+
"@stainless-api/ui-primitives": "0.1.0-beta.9"
|
|
59
60
|
},
|
|
60
61
|
"devDependencies": {
|
|
61
62
|
"@markdoc/markdoc": "^0.5.2",
|
|
@@ -8,6 +8,7 @@ import style from '@stainless-api/docs-ui/src/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
|
+
import { Button } from '@stainless-api/ui-primitives';
|
|
11
12
|
/*
|
|
12
13
|
* This may be replaced by additional data from the sdk.
|
|
13
14
|
* Without information from the sdk, we use simple heuristics per language.
|
|
@@ -130,12 +131,14 @@ export function SnippetRequestContainer({ children, signature }: SnippetRequestC
|
|
|
130
131
|
<div className="stl-snippet-request-container">
|
|
131
132
|
{children}
|
|
132
133
|
{signature && isCollapsible && (
|
|
133
|
-
<
|
|
134
|
-
className={
|
|
134
|
+
<Button
|
|
135
|
+
className={'stl-snippet-expand-button'}
|
|
135
136
|
id="stl-snippet-expand-button"
|
|
137
|
+
size="sm"
|
|
138
|
+
variant="outline"
|
|
136
139
|
>
|
|
137
140
|
Show more
|
|
138
|
-
</
|
|
141
|
+
</Button>
|
|
139
142
|
)}
|
|
140
143
|
</div>
|
|
141
144
|
);
|
|
@@ -2,13 +2,6 @@
|
|
|
2
2
|
import { Icon } from '@astrojs/starlight/components';
|
|
3
3
|
import { DocsSearch } from './SearchIsland';
|
|
4
4
|
import { SEARCH } from 'virtual:stl-starlight-virtual-module';
|
|
5
|
-
|
|
6
|
-
import '@stainless-api/docs-ui/src/styles/resets.css';
|
|
7
|
-
import '@stainless-api/docs-ui/src/styles/primitives.css';
|
|
8
|
-
import '@stainless-api/docs-ui/src/styles/main.css';
|
|
9
|
-
import '@stainless-api/docs-ui/src/styles/snippets.css';
|
|
10
|
-
import '@stainless-api/docs-ui/src/styles/search.css';
|
|
11
|
-
import '../../../components/variables.css';
|
|
12
5
|
---
|
|
13
6
|
|
|
14
7
|
<site-search>
|
package/plugin/index.ts
CHANGED
|
@@ -165,6 +165,24 @@ async function stlStarlightAstroIntegration(
|
|
|
165
165
|
prerender: command === 'build',
|
|
166
166
|
});
|
|
167
167
|
|
|
168
|
+
// Remove starlight callout syntax in favor of our own callout component
|
|
169
|
+
// updateConfig always deeply merges arrays so we need to mutate remarkPlugins directly
|
|
170
|
+
// in order to remove plugins that starlight added
|
|
171
|
+
astroConfig.markdown.remarkPlugins = astroConfig.markdown.remarkPlugins.filter((plugin, i, arr) => {
|
|
172
|
+
if (typeof plugin !== 'function') return true;
|
|
173
|
+
// remove:
|
|
174
|
+
// 1. remarkDirective plugin
|
|
175
|
+
if (plugin.name === 'remarkDirective') return false;
|
|
176
|
+
// 2. directly followed by remarkAsides plugin (inner function named 'attacher')
|
|
177
|
+
if (plugin.name === 'attacher') {
|
|
178
|
+
const prev = arr[i - 1];
|
|
179
|
+
if (typeof prev === 'function' && prev.name === 'remarkDirective') return false;
|
|
180
|
+
}
|
|
181
|
+
// 3. remarkDirectivesRestoration plugin
|
|
182
|
+
if (plugin.name === 'remarkDirectivesRestoration') return false;
|
|
183
|
+
return true;
|
|
184
|
+
});
|
|
185
|
+
|
|
168
186
|
updateConfig({
|
|
169
187
|
vite: {
|
|
170
188
|
ssr: {
|
|
@@ -213,6 +231,7 @@ async function stlStarlightAstroIntegration(
|
|
|
213
231
|
EXPERIMENTAL_COLLAPSIBLE_SNIPPETS: pluginConfig.experimentalCollapsibleSnippets,
|
|
214
232
|
PROPERTY_SETTINGS: pluginConfig.propertySettings,
|
|
215
233
|
SEARCH: pluginConfig.search,
|
|
234
|
+
INCLUDE_AI_DROPDOWN_OPTIONS: pluginConfig.includeAIDropdownOptions,
|
|
216
235
|
}),
|
|
217
236
|
vmMiddlewareExport,
|
|
218
237
|
].join('\n');
|
|
@@ -117,6 +117,13 @@ export type StainlessStarlightUserConfig = {
|
|
|
117
117
|
* Defaults to `false`.
|
|
118
118
|
*/
|
|
119
119
|
experimentalCollapsibleSnippets?: boolean;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* When set to `true`, a dropdown button will be included on all pages to allow users to
|
|
123
|
+
* view or send markdown to an LLM.
|
|
124
|
+
* Defaults to `false`.
|
|
125
|
+
*/
|
|
126
|
+
includeAIDropdownOptions?: boolean;
|
|
120
127
|
};
|
|
121
128
|
|
|
122
129
|
export type ExternalSpecServerUserConfig = Omit<StainlessStarlightUserConfig, 'stainlessProject'> & {
|
|
@@ -190,6 +197,7 @@ function normalizeConfig(partial: SomeStainlessStarlightUserConfig, command: Ast
|
|
|
190
197
|
search: {
|
|
191
198
|
enableAISearch: partial.search?.enableAISearch ?? false,
|
|
192
199
|
},
|
|
200
|
+
includeAIDropdownOptions: partial.includeAIDropdownOptions ?? false,
|
|
193
201
|
};
|
|
194
202
|
|
|
195
203
|
function getSpecRetrieverConfig(): SpecRetrieverConfig {
|
package/plugin/react/Routing.tsx
CHANGED
|
@@ -48,6 +48,7 @@ import {
|
|
|
48
48
|
HIGHLIGHT_THEMES,
|
|
49
49
|
BREADCRUMB_CONFIG,
|
|
50
50
|
PROPERTY_SETTINGS,
|
|
51
|
+
INCLUDE_AI_DROPDOWN_OPTIONS,
|
|
51
52
|
} from 'virtual:stl-starlight-virtual-module';
|
|
52
53
|
import style from '@stainless-api/docs-ui/src/style';
|
|
53
54
|
import { createHighlighter, type BundledLanguage, type BundledTheme, type HighlighterGeneric } from 'shiki';
|
|
@@ -179,7 +180,7 @@ export function SDKSelectReactComponent({
|
|
|
179
180
|
return (
|
|
180
181
|
<Dropdown id={id} data-current-value={selected} className={className}>
|
|
181
182
|
<DropdownTrigger
|
|
182
|
-
className="dropdown-toggle
|
|
183
|
+
className="dropdown-toggle"
|
|
183
184
|
type="button"
|
|
184
185
|
id="stldocs-snippet-title-button"
|
|
185
186
|
aria-expanded="false"
|
|
@@ -332,7 +333,7 @@ export function RenderSpec({
|
|
|
332
333
|
basePath={BASE_PATH}
|
|
333
334
|
config={BREADCRUMB_CONFIG}
|
|
334
335
|
/>
|
|
335
|
-
<APIReferenceAIDropdown />
|
|
336
|
+
{INCLUDE_AI_DROPDOWN_OPTIONS && <APIReferenceAIDropdown />}
|
|
336
337
|
</div>
|
|
337
338
|
<SDKMethod
|
|
338
339
|
method={resource.methods[parsed.method]}
|
|
@@ -348,7 +349,7 @@ export function RenderSpec({
|
|
|
348
349
|
basePath={BASE_PATH}
|
|
349
350
|
config={BREADCRUMB_CONFIG}
|
|
350
351
|
/>
|
|
351
|
-
<APIReferenceAIDropdown />
|
|
352
|
+
{INCLUDE_AI_DROPDOWN_OPTIONS && <APIReferenceAIDropdown />}
|
|
352
353
|
</div>
|
|
353
354
|
<SDKOverview resource={resource} />
|
|
354
355
|
</div>
|
|
@@ -15,6 +15,10 @@ export const onRequest = defineRouteMiddleware(async (context) => {
|
|
|
15
15
|
|
|
16
16
|
const slug = `/${context.locals.starlightRoute.id}`; // same as .slug but not deprecated
|
|
17
17
|
|
|
18
|
+
context.locals.starlightRoute._stlStarlight = {
|
|
19
|
+
basePath: BASE_PATH,
|
|
20
|
+
};
|
|
21
|
+
|
|
18
22
|
const apiReferencePlaceholderItems = getAPIReferencePlaceholderItems(context.locals.starlightRoute.sidebar);
|
|
19
23
|
|
|
20
24
|
const spec = await cmsClient.getSpec();
|
package/plugin/routes/Docs.astro
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
import StarlightPage from "@astrojs/starlight/components/StarlightPage.astro";
|
|
3
3
|
import { cmsClient } from "../cms/client";
|
|
4
|
-
|
|
5
|
-
import "@stainless-api/docs-ui/src/styles/resets.css";
|
|
6
|
-
import "@stainless-api/docs-ui/src/styles/primitives.css";
|
|
7
|
-
import "@stainless-api/docs-ui/src/styles/main.css";
|
|
8
|
-
import "@stainless-api/docs-ui/src/styles/snippets.css";
|
|
9
|
-
// TODO: fix variables.css import
|
|
10
|
-
// import "./variables.css";
|
|
11
|
-
|
|
12
4
|
import {
|
|
13
5
|
getReadmeContent,
|
|
14
6
|
generateDocsRoutes,
|
|
@@ -3,13 +3,6 @@ import StarlightPage from '@astrojs/starlight/components/StarlightPage.astro';
|
|
|
3
3
|
import { BASE_PATH, EXCLUDE_LANGUAGES } from 'virtual:stl-starlight-virtual-module';
|
|
4
4
|
import { cmsClient } from '../cms/client';
|
|
5
5
|
import type { DocsLanguage } from '@stainless-api/docs-ui/src/routing';
|
|
6
|
-
|
|
7
|
-
import '@stainless-api/docs-ui/src/styles/resets.css';
|
|
8
|
-
import '@stainless-api/docs-ui/src/styles/primitives.css';
|
|
9
|
-
import '@stainless-api/docs-ui/src/styles/main.css';
|
|
10
|
-
import '@stainless-api/docs-ui/src/styles/snippets.css';
|
|
11
|
-
// TODO: fix variables.css import
|
|
12
|
-
// import '../components/variables.css';
|
|
13
6
|
import { RenderLibraries, RenderSpecOverview, type SpecMetadata } from '../react/Routing';
|
|
14
7
|
|
|
15
8
|
const spec = await cmsClient.getSpec();
|
|
@@ -34,7 +27,7 @@ const metadata = languages
|
|
|
34
27
|
>
|
|
35
28
|
<h3>Libraries</h3>
|
|
36
29
|
|
|
37
|
-
<div class="stldocs-root language-blocks stl-ui-not-prose">
|
|
30
|
+
<div class="stldocs-root language-blocks stl-ui-not-prose not-content">
|
|
38
31
|
<RenderLibraries metadata={metadata} />
|
|
39
32
|
</div>
|
|
40
33
|
|
|
@@ -1,53 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DropdownButton,
|
|
3
|
-
DropdownButtonDivider,
|
|
4
|
-
DropdownButtonItem,
|
|
5
|
-
DropdownButtonItemIcon,
|
|
6
|
-
DropdownButtonItemText,
|
|
7
|
-
DropdownButtonItemTextSubtle,
|
|
8
|
-
DropdownButtonMenu,
|
|
9
|
-
DropdownButtonPrimaryAction,
|
|
10
|
-
DropdownButtonPrimaryActionText,
|
|
11
|
-
DropdownButtonTrigger,
|
|
12
|
-
} from '@stainless-api/ui-primitives';
|
|
1
|
+
import { DropdownButton } from '@stainless-api/ui-primitives';
|
|
13
2
|
import { CopyIcon } from 'lucide-react';
|
|
3
|
+
import { ChatGPTIcon } from './icons/chat-gpt';
|
|
4
|
+
import { ClaudeIcon } from './icons/claude';
|
|
5
|
+
import { MarkdownIcon } from './icons/markdown';
|
|
14
6
|
|
|
15
7
|
export function AIDropdownOptions() {
|
|
16
8
|
return (
|
|
17
9
|
<>
|
|
18
|
-
<
|
|
19
|
-
<
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
d="M14.853 6.54857C15.216 5.45907 15.091 4.26557 14.5105 3.27457C13.6375 1.75457 11.8825 0.972574 10.1685 1.34057C9.40596 0.481574 8.31046 -0.00692579 7.16196 7.42116e-05C5.40996 -0.00392579 3.85546 1.12407 3.31646 2.79107C2.19096 3.02157 1.21946 3.72607 0.650955 4.72457C-0.228545 6.24057 -0.0280446 8.15157 1.14696 9.45157C0.783955 10.5411 0.908955 11.7346 1.48946 12.7256C2.36246 14.2456 4.11746 15.0276 5.83146 14.6596C6.59346 15.5186 7.68946 16.0071 8.83796 15.9996C10.591 16.0041 12.146 14.8751 12.685 13.2066C13.8105 12.9761 14.782 12.2716 15.3505 11.2731C16.229 9.75707 16.028 7.84757 14.8535 6.54757L14.853 6.54857ZM8.83896 14.9541C8.13746 14.9551 7.45796 14.7096 6.91946 14.2601C6.94396 14.2471 6.98646 14.2236 7.01396 14.2066L10.2 12.3666C10.363 12.2741 10.463 12.1006 10.462 11.9131V7.42157L11.8085 8.19907C11.823 8.20607 11.8325 8.22007 11.8345 8.23607V11.9556C11.8325 13.6096 10.493 14.9506 8.83896 14.9541ZM2.39696 12.2026C2.04546 11.5956 1.91896 10.8841 2.03946 10.1936C2.06296 10.2076 2.10446 10.2331 2.13396 10.2501L5.31996 12.0901C5.48146 12.1846 5.68146 12.1846 5.84346 12.0901L9.73296 9.84407V11.3991C9.73396 11.4151 9.72646 11.4306 9.71396 11.4406L6.49346 13.3001C5.05896 14.1261 3.22696 13.6351 2.39746 12.2026H2.39696ZM1.55846 5.24807C1.90846 4.64007 2.46096 4.17507 3.11896 3.93357C3.11896 3.96107 3.11746 4.00957 3.11746 4.04357V7.72407C3.11646 7.91107 3.21646 8.08457 3.37896 8.17707L7.26846 10.4226L5.92196 11.2001C5.90846 11.2091 5.89146 11.2106 5.87646 11.2041L2.65546 9.34307C1.22396 8.51407 0.732955 6.68257 1.55796 5.24857L1.55846 5.24807ZM12.6215 7.82257L8.73196 5.57657L10.0785 4.79957C10.092 4.79057 10.109 4.78907 10.124 4.79557L13.345 6.65507C14.779 7.48357 15.2705 9.31807 14.442 10.7521C14.0915 11.3591 13.5395 11.8241 12.882 12.0661V8.27557C12.8835 8.08857 12.784 7.91557 12.622 7.82257H12.6215ZM13.9615 5.80557C13.938 5.79107 13.8965 5.76607 13.867 5.74907L10.681 3.90907C10.5195 3.81457 10.3195 3.81457 10.1575 3.90907L6.26796 6.15507V4.60007C6.26696 4.58407 6.27446 4.56857 6.28696 4.55857L9.50746 2.70057C10.942 1.87307 12.776 2.36557 13.603 3.80057C13.9525 4.40657 14.079 5.11607 13.9605 5.80557H13.9615ZM5.53596 8.57707L4.18896 7.79957C4.17446 7.79257 4.16496 7.77857 4.16296 7.76257V4.04307C4.16396 2.38707 5.50746 1.04507 7.16346 1.04607C7.86396 1.04607 8.54196 1.29207 9.08046 1.74007C9.05596 1.75307 9.01396 1.77657 8.98596 1.79357L5.79996 3.63357C5.63696 3.72607 5.53696 3.89907 5.53796 4.08657L5.53596 8.57607V8.57707ZM6.26746 7.00007L7.99996 5.99957L9.73246 6.99957V9.00007L7.99996 10.0001L6.26746 9.00007V7.00007Z"
|
|
37
|
-
fill="#262626"
|
|
38
|
-
/>
|
|
39
|
-
</g>
|
|
40
|
-
<defs>
|
|
41
|
-
<clipPath id="clip0_2771_126147">
|
|
42
|
-
<rect width="16" height="16" fill="white" />
|
|
43
|
-
</clipPath>
|
|
44
|
-
</defs>
|
|
45
|
-
</svg>
|
|
46
|
-
</DropdownButtonItemIcon>
|
|
47
|
-
<DropdownButtonItemText>
|
|
48
|
-
<DropdownButtonItemTextSubtle>Open in</DropdownButtonItemTextSubtle> ChatGPT
|
|
49
|
-
</DropdownButtonItemText>
|
|
50
|
-
</DropdownButtonItem>
|
|
10
|
+
<DropdownButton.MenuItem value="claude" isExternalLink>
|
|
11
|
+
<DropdownButton.MenuItemIcon>
|
|
12
|
+
<ClaudeIcon />
|
|
13
|
+
</DropdownButton.MenuItemIcon>
|
|
14
|
+
<DropdownButton.MenuItemText subtle>
|
|
15
|
+
Open in
|
|
16
|
+
<strong> Claude</strong>
|
|
17
|
+
</DropdownButton.MenuItemText>
|
|
18
|
+
</DropdownButton.MenuItem>
|
|
19
|
+
<DropdownButton.MenuItem value="chat-gpt" isExternalLink>
|
|
20
|
+
<DropdownButton.MenuItemIcon>
|
|
21
|
+
<ChatGPTIcon />
|
|
22
|
+
</DropdownButton.MenuItemIcon>
|
|
23
|
+
<DropdownButton.MenuItemText subtle>
|
|
24
|
+
Open in
|
|
25
|
+
<strong> ChatGPT</strong>
|
|
26
|
+
</DropdownButton.MenuItemText>
|
|
27
|
+
</DropdownButton.MenuItem>
|
|
51
28
|
</>
|
|
52
29
|
);
|
|
53
30
|
}
|
|
@@ -55,32 +32,27 @@ export function AIDropdownOptions() {
|
|
|
55
32
|
export function APIReferenceAIDropdown() {
|
|
56
33
|
return (
|
|
57
34
|
<DropdownButton id="ai-dropdown-button">
|
|
58
|
-
<
|
|
35
|
+
<DropdownButton.PrimaryAction>
|
|
59
36
|
<CopyIcon size={16} />
|
|
60
|
-
<
|
|
61
|
-
</
|
|
62
|
-
<
|
|
63
|
-
<
|
|
37
|
+
<DropdownButton.PrimaryActionText>Copy Markdown</DropdownButton.PrimaryActionText>
|
|
38
|
+
</DropdownButton.PrimaryAction>
|
|
39
|
+
<DropdownButton.Trigger />
|
|
40
|
+
<DropdownButton.Menu>
|
|
64
41
|
<AIDropdownOptions />
|
|
65
|
-
<
|
|
66
|
-
<
|
|
67
|
-
<
|
|
42
|
+
<hr />
|
|
43
|
+
<DropdownButton.MenuItem value="copy-as-markdown" isExternalLink>
|
|
44
|
+
<DropdownButton.MenuItemIcon>
|
|
68
45
|
<CopyIcon size={16} />
|
|
69
|
-
</
|
|
70
|
-
<
|
|
71
|
-
</
|
|
72
|
-
<
|
|
73
|
-
<
|
|
74
|
-
<
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
</svg>
|
|
80
|
-
</DropdownButtonItemIcon>
|
|
81
|
-
<DropdownButtonItemText>View as Markdown</DropdownButtonItemText>
|
|
82
|
-
</DropdownButtonItem>
|
|
83
|
-
</DropdownButtonMenu>
|
|
46
|
+
</DropdownButton.MenuItemIcon>
|
|
47
|
+
<DropdownButton.MenuItemText>Copy Markdown</DropdownButton.MenuItemText>
|
|
48
|
+
</DropdownButton.MenuItem>
|
|
49
|
+
<DropdownButton.MenuItem value="view-as-markdown" isExternalLink>
|
|
50
|
+
<DropdownButton.MenuItemIcon>
|
|
51
|
+
<MarkdownIcon />
|
|
52
|
+
</DropdownButton.MenuItemIcon>
|
|
53
|
+
<DropdownButton.MenuItemText>View as Markdown</DropdownButton.MenuItemText>
|
|
54
|
+
</DropdownButton.MenuItem>
|
|
55
|
+
</DropdownButton.Menu>
|
|
84
56
|
</DropdownButton>
|
|
85
57
|
);
|
|
86
58
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
import config from 'virtual:starlight/user-config';
|
|
3
3
|
|
|
4
|
-
import { HEADER_LAYOUT } from 'virtual:stl-
|
|
4
|
+
import { HEADER_LAYOUT } from 'virtual:stl-docs-virtual-module';
|
|
5
5
|
import DefaultHeader from './headers/DefaultHeader.astro';
|
|
6
6
|
import StackedHeader from './headers/StackedHeader.astro';
|
|
7
7
|
|
|
@@ -209,6 +209,7 @@ const options = [
|
|
|
209
209
|
display: flex;
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
|
+
.stldocs-root .stl-dropdown-icon,
|
|
212
213
|
.stl-dropdown-icon {
|
|
213
214
|
display: flex;
|
|
214
215
|
align-items: center;
|
|
@@ -217,6 +218,7 @@ const options = [
|
|
|
217
218
|
height: 16px;
|
|
218
219
|
}
|
|
219
220
|
|
|
221
|
+
.stldocs-root span.stl-dropdown-icon,
|
|
220
222
|
span.stl-dropdown-icon,
|
|
221
223
|
span.stl-dropdown-chevron {
|
|
222
224
|
padding-left: 0;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
import { ContentBreadcrumbs } from './ContentBreadcrumbs';
|
|
3
3
|
import { ProseAIDropdown } from './ProseAIDropdown';
|
|
4
|
+
import { INCLUDE_AI_DROPDOWN_OPTIONS } from 'virtual:stl-docs-virtual-module';
|
|
4
5
|
const currentPath = Astro.url.pathname;
|
|
5
6
|
---
|
|
6
7
|
|
|
@@ -8,7 +9,11 @@ const currentPath = Astro.url.pathname;
|
|
|
8
9
|
<div class="sl-container stl-ui-prose">
|
|
9
10
|
<div class="stl-ui-not-prose stl-page-nav-container stl-prose-page-nav-container">
|
|
10
11
|
<ContentBreadcrumbs currentPath={currentPath} sidebarEntry={Astro.locals.starlightRoute.sidebar} />
|
|
11
|
-
|
|
12
|
+
{
|
|
13
|
+
INCLUDE_AI_DROPDOWN_OPTIONS && (
|
|
14
|
+
<ProseAIDropdown currentPath={currentPath} sidebarEntry={Astro.locals.starlightRoute.sidebar} />
|
|
15
|
+
)
|
|
16
|
+
}
|
|
12
17
|
</div>
|
|
13
18
|
<slot />
|
|
14
19
|
</div>
|
|
@@ -26,25 +31,18 @@ const currentPath = Astro.url.pathname;
|
|
|
26
31
|
max-width: var(--sl-content-width);
|
|
27
32
|
}
|
|
28
33
|
|
|
29
|
-
.sl-container > :global(* + *) {
|
|
30
|
-
margin-top: 1.5rem;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
34
|
@media (min-width: 72rem) {
|
|
34
35
|
.sl-container {
|
|
35
36
|
margin-inline: var(--sl-content-margin-inline, auto);
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
padding: 0 var(--sl-content-pad-x);
|
|
43
|
-
}
|
|
40
|
+
.content-panel {
|
|
41
|
+
padding: 0 0.5rem 0 var(--sl-content-pad-x);
|
|
42
|
+
}
|
|
44
43
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
44
|
+
.stl-prose-page-nav-container {
|
|
45
|
+
padding: 1rem 0 0;
|
|
48
46
|
}
|
|
49
47
|
</style>
|
|
50
48
|
|
|
@@ -60,7 +58,6 @@ const currentPath = Astro.url.pathname;
|
|
|
60
58
|
import { onSelectAIOption } from '../../../plugin/globalJs/ai-dropdown.ts';
|
|
61
59
|
|
|
62
60
|
document.addEventListener(getPageLoadEvent(), () => {
|
|
63
|
-
console.log('Initializing AI Dropdown');
|
|
64
61
|
initDropdownButton({
|
|
65
62
|
dropdownId: 'prose-ai-dropdown-button',
|
|
66
63
|
onSelect: (option: string) => onSelectAIOption(option, false),
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DropdownButton,
|
|
3
|
-
DropdownButtonMenu,
|
|
4
|
-
DropdownButtonPrimaryAction,
|
|
5
|
-
DropdownButtonTrigger,
|
|
6
|
-
} from '@stainless-api/ui-primitives';
|
|
1
|
+
import { DropdownButton } from '@stainless-api/ui-primitives';
|
|
7
2
|
import { AIDropdownOptions } from '../APIReferenceAIDropdown';
|
|
8
3
|
import type { StarlightRouteData } from '@astrojs/starlight/route-data';
|
|
4
|
+
import { ClaudeIcon } from '../icons/claude';
|
|
9
5
|
|
|
10
6
|
const sidebarHasEntry = (sidebarEntry: StarlightRouteData['sidebar'], currentPath?: string) => {
|
|
11
7
|
if (!currentPath) return false;
|
|
@@ -46,19 +42,14 @@ export function ProseAIDropdown({
|
|
|
46
42
|
|
|
47
43
|
return (
|
|
48
44
|
<DropdownButton id="prose-ai-dropdown-button">
|
|
49
|
-
<
|
|
50
|
-
<
|
|
51
|
-
<path
|
|
52
|
-
d="M3.13924 10.6036L6.28658 8.84444L6.33924 8.69111L6.28658 8.60638H6.13266L5.60608 8.5741L3.8076 8.52568L2.2481 8.46113L0.737215 8.38043L0.356456 8.29973L0 7.83169L0.0364557 7.59766L0.356456 7.38382L0.814177 7.42416L1.82684 7.49276L3.34582 7.59766L4.4476 7.66222L6.08 7.83169H6.33924L6.3757 7.72678L6.28658 7.66222L6.21772 7.59766L4.64608 6.53649L2.94481 5.4148L2.05367 4.76922L1.57165 4.44239L1.32861 4.13574L1.22329 3.46595L1.66076 2.98581L2.2481 3.02615L2.39797 3.0665L2.99342 3.52244L4.26532 4.50292L5.92608 5.72145L6.16911 5.92319L6.26633 5.8546L6.27848 5.80618L6.16911 5.62461L5.26582 3.99856L4.30177 2.34426L3.87241 1.65833L3.75899 1.24678C3.71848 1.07731 3.69013 0.93609 3.69013 0.762591L4.18835 0.0887672L4.4638 0L5.1281 0.0887672L5.4076 0.330859L5.82076 1.27098L6.48911 2.75178L7.52608 4.76518L7.82987 5.36234L7.9919 5.91512L8.05266 6.08459H8.15797V5.98775L8.24304 4.85395L8.40101 3.46192L8.55494 1.67044L8.60759 1.16608L8.85873 0.560847L9.35696 0.234023L9.74582 0.419627L10.0658 0.875567L10.0213 1.17011L9.83089 2.40075L9.45823 4.32942L9.21519 5.62058H9.35696L9.51899 5.45918L10.1752 4.59168L11.277 3.21983L11.763 2.67512L12.3301 2.07392L12.6947 1.78745H13.3833L13.8896 2.53793L13.6628 3.31263L12.9539 4.20837L12.3666 4.96693L11.5241 6.09669L10.9975 7.0005L11.0461 7.07313L11.1716 7.06103L13.0754 6.65754L14.1043 6.47193L15.3316 6.26212L15.8866 6.52035L15.9473 6.78262L15.7286 7.31926L14.4162 7.64205L12.877 7.9487L10.5843 8.48937L10.5559 8.50954L10.5884 8.54989L11.6213 8.64673L12.0628 8.67094H13.1443L15.1575 8.82023L15.6841 9.16723L16 9.59089L15.9473 9.91368L15.1372 10.3252L14.0435 10.067L11.4916 9.46177L10.6167 9.24389H10.4952V9.31652L11.2243 10.0267L12.561 11.229L14.2339 12.7784L14.319 13.1618L14.1043 13.4644L13.8775 13.4321L12.4071 12.3306L11.84 11.8343L10.5559 10.757H10.4709V10.8699L10.7666 11.3017L12.3301 13.6419L12.4111 14.3601L12.2977 14.5941L11.8927 14.7354L11.4471 14.6547L10.5316 13.3756L9.58785 11.9352L8.82633 10.644L8.73316 10.6964L8.28354 15.5181L8.07291 15.7642L7.58684 15.9498L7.18177 15.6432L6.96709 15.1469L7.18177 14.1664L7.44101 12.8874L7.65165 11.8706L7.84203 10.6077L7.95544 10.1881L7.94734 10.1598L7.85418 10.1719L6.89823 11.4792L5.44405 13.4361L4.29367 14.6627L4.01823 14.7717L3.54025 14.5255L3.58481 14.0857L3.85215 13.6944L5.44405 11.6769L6.40405 10.4261L7.0238 9.70387L7.01975 9.59896H6.98329L2.75443 12.3346L2.00101 12.4314L1.67696 12.1288L1.71747 11.6325L1.87139 11.4711L3.14329 10.5996L3.13924 10.6036Z"
|
|
53
|
-
fill="#D97757"
|
|
54
|
-
/>
|
|
55
|
-
</svg>{' '}
|
|
45
|
+
<DropdownButton.PrimaryAction>
|
|
46
|
+
<ClaudeIcon />
|
|
56
47
|
Open in Claude
|
|
57
|
-
</
|
|
58
|
-
<
|
|
59
|
-
<
|
|
48
|
+
</DropdownButton.PrimaryAction>
|
|
49
|
+
<DropdownButton.Trigger />
|
|
50
|
+
<DropdownButton.Menu>
|
|
60
51
|
<AIDropdownOptions />
|
|
61
|
-
</
|
|
52
|
+
</DropdownButton.Menu>
|
|
62
53
|
</DropdownButton>
|
|
63
54
|
);
|
|
64
55
|
}
|
|
@@ -4,7 +4,7 @@ import Search from 'virtual:starlight/components/Search';
|
|
|
4
4
|
import SiteTitle from 'virtual:starlight/components/SiteTitle';
|
|
5
5
|
import HeaderLinks from './HeaderLinks.astro';
|
|
6
6
|
import NavLinks from '../nav-tabs/NavTabs.astro';
|
|
7
|
-
import { TABS } from 'virtual:stl-
|
|
7
|
+
import { TABS } from 'virtual:stl-docs-virtual-module';
|
|
8
8
|
import ThemeSelect from 'virtual:starlight/components/ThemeSelect';
|
|
9
9
|
import SplashMobileMenuToggle from './SplashMobileMenuToggle.astro';
|
|
10
10
|
|