@stainless-api/docs 0.1.0-beta.56 → 0.1.0-beta.58

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,29 @@
1
1
  # @stainless-api/docs
2
2
 
3
+ ## 0.1.0-beta.58
4
+
5
+ ### Minor Changes
6
+
7
+ - af090c3: refactor: extract search to @stainless-api/docs-search package
8
+
9
+ ### Patch Changes
10
+
11
+ - e79d6c3: fix an issue where the search bar would overflow over nav elements
12
+ - 2d372fb: feat: support for stainless docs plugins
13
+ - Updated dependencies [af090c3]
14
+ - Updated dependencies [4cf4aa5]
15
+ - Updated dependencies [8886c7c]
16
+ - @stainless-api/docs-search@0.1.0-beta.1
17
+ - @stainless-api/docs-ui@0.1.0-beta.49
18
+ - @stainless-api/ui-primitives@0.1.0-beta.36
19
+
20
+ ## 0.1.0-beta.57
21
+
22
+ ### Patch Changes
23
+
24
+ - Updated dependencies [ada37ee]
25
+ - @stainless-api/docs-ui@0.1.0-beta.48
26
+
3
27
  ## 0.1.0-beta.56
4
28
 
5
29
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stainless-api/docs",
3
- "version": "0.1.0-beta.56",
3
+ "version": "0.1.0-beta.58",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -32,14 +32,14 @@
32
32
  "vite": ">=6.2.1"
33
33
  },
34
34
  "dependencies": {
35
- "@astrojs/markdown-remark": "^6.3.9",
35
+ "@astrojs/markdown-remark": "^6.3.10",
36
36
  "@astrojs/react": "^4.4.2",
37
- "@stainless-api/sdk": "0.1.0-alpha.16",
37
+ "@stainless-api/sdk": "0.1.0-alpha.19",
38
38
  "cheerio": "^1.1.2",
39
39
  "clsx": "^2.1.1",
40
40
  "dotenv": "17.2.3",
41
41
  "get-port": "^7.1.0",
42
- "lucide-react": "^0.555.0",
42
+ "lucide-react": "^0.561.0",
43
43
  "marked": "^17.0.1",
44
44
  "node-html-parser": "^7.0.1",
45
45
  "rehype-parse": "^9.0.1",
@@ -52,8 +52,9 @@
52
52
  "vite-plugin-prebundle-workers": "^0.2.0",
53
53
  "web-worker": "^1.5.0",
54
54
  "yaml": "^2.8.2",
55
- "@stainless-api/ui-primitives": "0.1.0-beta.35",
56
- "@stainless-api/docs-ui": "0.1.0-beta.47"
55
+ "@stainless-api/docs-ui": "0.1.0-beta.49",
56
+ "@stainless-api/docs-search": "0.1.0-beta.1",
57
+ "@stainless-api/ui-primitives": "0.1.0-beta.36"
57
58
  },
58
59
  "devDependencies": {
59
60
  "@astrojs/check": "^0.9.6",
@@ -61,8 +62,8 @@
61
62
  "@types/node": "24.10.1",
62
63
  "@types/react": "19.2.7",
63
64
  "@types/react-dom": "^19.2.3",
64
- "react": "^19.2.1",
65
- "react-dom": "^19.2.1",
65
+ "react": "^19.2.3",
66
+ "react-dom": "^19.2.3",
66
67
  "tsx": "^4.21.0",
67
68
  "typescript": "5.9.3",
68
69
  "vite": "^6.4.1",
@@ -3,7 +3,7 @@ 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
5
  import { Languages } from '@stainless-api/docs-ui/routing';
6
- import { buildIndex } from '@stainless-api/docs-ui/search/providers/algolia';
6
+ import { buildIndex } from '@stainless-api/docs-search/providers/algolia';
7
7
  import type { VersionUserConfig } from './loadPluginConfig';
8
8
  import type { AstroIntegrationLogger } from 'astro';
9
9
 
@@ -11,6 +11,7 @@ import { Button } from '@stainless-api/ui-primitives';
11
11
  aria-label={Astro.locals.t('search.label')}
12
12
  aria-keyshortcuts="Control+K"
13
13
  variant="outline"
14
+ className="stl-algolia-search"
14
15
  >
15
16
  <Icon name="magnifier" />
16
17
  <span class="sl-hidden md:sl-block" aria-hidden="true">{Astro.locals.t('search.label')}</span>
@@ -57,3 +58,11 @@ import { Button } from '@stainless-api/ui-primitives';
57
58
  }
58
59
  });
59
60
  </script>
61
+
62
+ <style>
63
+ .stl-algolia-search {
64
+ max-width: unset;
65
+ width: unset;
66
+ flex-grow: 1;
67
+ }
68
+ </style>
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { BASE_PATH, HIGHLIGHT_THEMES } from 'virtual:stl-starlight-virtual-module';
3
3
  import { parseRoute, generateRoute } from '@stainless-api/docs-ui/routing';
4
- import { SearchModal } from '@stainless-api/docs-ui/search';
4
+ import { SearchModal } from '@stainless-api/docs-search';
5
5
  import * as Markdoc from '@markdoc/markdoc';
6
6
  import { createHighlighter } from 'shiki';
7
7
  import type { BundledLanguage, BundledTheme, HighlighterGeneric } from 'shiki';
@@ -11,10 +11,10 @@ import {
11
11
  type MarkdownContext,
12
12
  MarkdownProvider,
13
13
  NavigationProvider,
14
- SearchProvider,
15
14
  } from '@stainless-api/docs-ui/contexts';
16
15
  import { ComponentProvider } from '@stainless-api/docs-ui/contexts/component';
17
- import type { SearchSettings } from '@stainless-api/docs-ui/search/types';
16
+ import { SearchProvider } from '@stainless-api/docs-search/context';
17
+ import type { SearchSettings } from '@stainless-api/docs-search/types';
18
18
 
19
19
  let $$highlighter: HighlighterGeneric<BundledLanguage, BundledTheme> | null = null;
20
20
  async function getHighlighter() {
@@ -82,7 +82,7 @@ const shouldRenderSearch = !!(
82
82
 
83
83
  @media (min-width: 50rem) {
84
84
  .default-tabs-container {
85
- min-width: 440px;
85
+ min-width: 540px;
86
86
  }
87
87
  }
88
88
  }
@@ -65,6 +65,7 @@ const { prev, next } = (await getPrevNextPage(Astro.locals.starlightRoute, confi
65
65
  gap: 8px;
66
66
 
67
67
  margin-bottom: 2rem;
68
+ color: inherit; /* stl-ui-not-prose sets color: initial */
68
69
 
69
70
  a {
70
71
  border-radius: var(--stl-ui-pagination-border-radius-inner);
package/stl-docs/index.ts CHANGED
@@ -74,7 +74,7 @@ function stainlessDocsStarlightIntegration(config: NormalizedStainlessDocsConfig
74
74
  componentOverrides.Search = resolveSrcFile('/plugin/components/search/Search.astro');
75
75
  }
76
76
 
77
- plugins.push(...config.starlightCompat.plugins);
77
+ plugins.push(...config.starlightCompat.plugins, ...config.plugins.map((p) => p(config)));
78
78
 
79
79
  // TODO: re-add once we figure out what to do with the client router
80
80
  // if (config.enableClientRouter) {
@@ -1,5 +1,5 @@
1
1
  import type { StainlessStarlightUserConfig } from '../plugin/loadPluginConfig';
2
- import type { StarlightUserConfig } from '@astrojs/starlight/types';
2
+ import type { StarlightPlugin, StarlightUserConfig } from '@astrojs/starlight/types';
3
3
  import type { ButtonVariant } from '@stainless-api/ui-primitives';
4
4
  import type { AnchorHTMLAttributes } from 'react';
5
5
  import type starlight from '@astrojs/starlight';
@@ -89,6 +89,11 @@ export type StainlessDocsUserConfig = {
89
89
  * @default true
90
90
  */
91
91
  renderPageDescriptions?: boolean;
92
+ /**
93
+ * Stainless Docs plugins.
94
+ * Each plugin is a function that receives the normalized config and returns a Starlight plugin.
95
+ */
96
+ plugins?: ((config: Exclude<NormalizedStainlessDocsConfig, 'plugins'>) => StarlightPlugin)[];
92
97
  } & PassThroughStarlightConfigOptions;
93
98
 
94
99
  type HeaderLayout = 'default' | 'stacked';
@@ -160,6 +165,7 @@ function normalizeConfig(userConfig: StainlessDocsUserConfig) {
160
165
  contextMenu: userConfig.contextMenu ?? true,
161
166
  expressiveCode: userConfig.expressiveCode,
162
167
  renderPageDescriptions: userConfig.renderPageDescriptions ?? true,
168
+ plugins: userConfig.plugins ?? [],
163
169
  };
164
170
 
165
171
  return configWithDefaults;
@@ -2,7 +2,7 @@ import type { AstroIntegration } from 'astro';
2
2
  import { readFile } from 'fs/promises';
3
3
  import { getSharedLogger } from '../shared/getSharedLogger';
4
4
  import { bold } from '../shared/terminalUtils';
5
- import { buildProseIndex } from '@stainless-api/docs-ui/search/providers/algolia';
5
+ import { buildProseIndex } from '@stainless-api/docs-search/providers/algolia';
6
6
  import * as cheerio from 'cheerio';
7
7
 
8
8
  function chunkByWords(content: string, chunkSize: number = 30000, chunkOverlap: number = 10) {