@stainless-api/docs 0.1.0-beta.13 → 0.1.0-beta.15

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,23 @@
1
1
  # @stainless-api/docs
2
2
 
3
+ ## 0.1.0-beta.15
4
+
5
+ ### Patch Changes
6
+
7
+ - e35360f: include ui-primitive packages
8
+ - Updated dependencies [e35360f]
9
+ - @stainless-api/docs-ui@0.1.0-beta.12
10
+ - @stainless-api/ui-primitives@0.1.0-beta.13
11
+
12
+ ## 0.1.0-beta.14
13
+
14
+ ### Patch Changes
15
+
16
+ - a529fd4: fix: site title height
17
+ - Updated dependencies [a529fd4]
18
+ - @stainless-api/docs-ui@0.1.0-beta.11
19
+ - @stainless-api/ui-primitives@0.1.0-beta.12
20
+
3
21
  ## 0.1.0-beta.13
4
22
 
5
23
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stainless-api/docs",
3
- "version": "0.1.0-beta.13",
3
+ "version": "0.1.0-beta.15",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -27,7 +27,8 @@
27
27
  "./stainless-docs/mintlify-compat": "./stl-docs/components/mintlify-compat/index.ts",
28
28
  "./theme": "./theme.css",
29
29
  "./mintlify-compat.css": "./styles/mintlify-compat.css",
30
- "./font-imports": "./styles/fonts.css"
30
+ "./font-imports": "./styles/fonts.css",
31
+ "./components": "./stl-docs/components/index.ts"
31
32
  },
32
33
  "keywords": [],
33
34
  "author": "",
@@ -56,8 +57,8 @@
56
57
  "shiki": "^3.9.2",
57
58
  "web-worker": "^1.5.0",
58
59
  "yaml": "^2.8.0",
59
- "@stainless-api/docs-ui": "0.1.0-beta.10",
60
- "@stainless-api/ui-primitives": "0.1.0-beta.11"
60
+ "@stainless-api/ui-primitives": "0.1.0-beta.13",
61
+ "@stainless-api/docs-ui": "0.1.0-beta.12"
61
62
  },
62
63
  "devDependencies": {
63
64
  "@markdoc/markdoc": "^0.5.2",
package/plugin/index.ts CHANGED
@@ -165,24 +165,6 @@ 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
-
186
168
  updateConfig({
187
169
  vite: {
188
170
  ssr: {
@@ -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 '~/lib/json-spec-v2/types';
10
- import type { DocsLanguage } from '@stainless-api/docs-ui/src/routing';
10
+ import { LanguageNames, type DocsLanguage } from '@stainless-api/docs-ui/src/routing';
11
11
 
12
12
  import {
13
13
  generateRouteList,
@@ -182,23 +182,23 @@ export function SDKSelectReactComponent({
182
182
  <DropdownTrigger
183
183
  className="dropdown-toggle"
184
184
  type="button"
185
- id="stldocs-snippet-title-button"
185
+ id="stl-docs-snippet-title-button"
186
186
  aria-expanded="false"
187
187
  withChevron
188
188
  >
189
189
  <SDKIcon language={getLanguageSnippet(selected)} size={16} />
190
- <span className={clsx('stl-snippet-dropdown-button-text', selected)}>{selected}</span>
190
+ <span className="stl-snippet-dropdown-button-text">{LanguageNames[selected]}</span>
191
191
  </DropdownTrigger>
192
192
  <DropdownMenu
193
193
  className="dropdown-menu stl-sdk-select-dropdown-menu"
194
194
  position="below"
195
- aria-labelledby="stldocs-snippet-title-button"
195
+ aria-labelledby="stl-docs-snippet-title-button"
196
196
  >
197
197
  {languages.map((item) => (
198
198
  <DropdownItem key={item} value={item} selected={item === selected}>
199
199
  <div>
200
200
  <SDKIcon language={getLanguageSnippet(item)} size={16} />
201
- <span className={clsx('stl-snippet-dropdown-button-text', item)}>{item}</span>
201
+ <span className="stl-snippet-dropdown-button-text">{LanguageNames[item]}</span>
202
202
  </div>
203
203
  </DropdownItem>
204
204
  ))}
@@ -46,6 +46,8 @@ const shouldRenderSearch = !!(
46
46
  padding: 0.25rem;
47
47
  margin: -0.25rem;
48
48
  min-width: 0;
49
+ /* Max height should match button height */
50
+ max-height: 32px;
49
51
  }
50
52
 
51
53
  .default-tabs-container {
@@ -0,0 +1,2 @@
1
+ export * from '@stainless-api/ui-primitives';
2
+ export * from '@stainless-api/ui-primitives/scripts';
@@ -0,0 +1,36 @@
1
+ import type { AstroIntegration } from 'astro';
2
+ import type { StarlightPlugin } from '@astrojs/starlight/types';
3
+
4
+ export const disableCalloutSyntaxAstroIntegration = {
5
+ name: 'stl-starlight-remove-callout-syntax',
6
+ hooks: {
7
+ 'astro:config:setup': ({ config: astroConfig }) => {
8
+ // Remove starlight callout syntax in favor of our own callout component
9
+ // updateConfig always deeply merges arrays so we need to mutate remarkPlugins directly
10
+ // in order to remove plugins that starlight added
11
+ astroConfig.markdown.remarkPlugins = astroConfig.markdown.remarkPlugins.filter((plugin, i, arr) => {
12
+ if (typeof plugin !== 'function') return true;
13
+ // remove:
14
+ // 1. remarkDirective plugin
15
+ if (plugin.name === 'remarkDirective') return false;
16
+ // 2. directly followed by remarkAsides plugin (inner function named 'attacher')
17
+ if (plugin.name === 'attacher') {
18
+ const prev = arr[i - 1];
19
+ if (typeof prev === 'function' && prev.name === 'remarkDirective') return false;
20
+ }
21
+ // 3. remarkDirectivesRestoration plugin
22
+ if (plugin.name === 'remarkDirectivesRestoration') return false;
23
+ return true;
24
+ });
25
+ },
26
+ },
27
+ } satisfies AstroIntegration;
28
+
29
+ export const disableCalloutSyntaxStarlightPlugin = {
30
+ name: 'stl-starlight-remove-callout-syntax',
31
+ hooks: {
32
+ 'config:setup': ({ addIntegration }) => {
33
+ addIntegration(disableCalloutSyntaxAstroIntegration);
34
+ },
35
+ },
36
+ } satisfies StarlightPlugin;
package/stl-docs/index.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import starlight from '@astrojs/starlight';
2
2
  import react from '@astrojs/react';
3
+ import type { StarlightPlugin } from '@astrojs/starlight/types';
3
4
  import { stainlessStarlight } from '../plugin';
5
+ import { disableCalloutSyntaxStarlightPlugin } from './disableCalloutSyntax';
4
6
 
5
7
  import type { AstroIntegration } from 'astro';
6
8
 
@@ -40,21 +42,27 @@ function stainlessDocsStarlightIntegration(config: NormalizedStainlessDocsConfig
40
42
  }
41
43
 
42
44
  type ComponentOverrides = StarlightConfigDefined['components'];
43
- const plugins = [...config.starlightCompat.plugins];
44
-
45
45
  const componentOverrides: ComponentOverrides = {
46
46
  Sidebar: '@stainless-api/docs/BaseSidebar',
47
47
  Header: '@stainless-api/docs/Header',
48
48
  ThemeSelect: '@stainless-api/docs/ThemeSelect',
49
49
  ContentPanel: '@stainless-api/docs/ContentPanel',
50
50
  TableOfContents: '@stainless-api/docs/TableOfContents',
51
+
52
+ ...(config.apiReference !== null && {
53
+ Sidebar: '@stainless-api/docs/SDKSelectSidebar',
54
+ Search: '@stainless-api/docs/Search',
55
+ }),
51
56
  };
52
57
 
53
- if (config.apiReference !== null) {
54
- componentOverrides.Sidebar = '@stainless-api/docs/SDKSelectSidebar';
55
- componentOverrides.Search = '@stainless-api/docs/Search';
56
- plugins.unshift(stainlessStarlight(config.apiReference));
57
- }
58
+ const plugins: StarlightPlugin[] = [
59
+ // Disable starlight callout syntax in favor of our own component
60
+ disableCalloutSyntaxStarlightPlugin,
61
+ // API reference
62
+ config.apiReference !== null && stainlessStarlight(config.apiReference),
63
+ // pass through plugins from user
64
+ ...config.starlightCompat.plugins,
65
+ ].filter(Boolean);
58
66
 
59
67
  // TODO: re-add once we figure out what to do with the client router
60
68
  // if (config.enableClientRouter) {
package/styles/code.css CHANGED
@@ -125,11 +125,6 @@
125
125
  line-height: 100%;
126
126
  font-size: var(--sl-text-body-sm);
127
127
  color: var(--sl-color-text);
128
- text-transform: capitalize;
129
-
130
- &.http {
131
- text-transform: uppercase;
132
- }
133
128
  }
134
129
 
135
130
  :root[data-theme='light'] {