@stainless-api/docs 0.1.0-beta.120 → 0.1.0-beta.122

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.122
4
+
5
+ ### Minor Changes
6
+
7
+ - f22893c: Add interactive examples to ai chat
8
+
9
+ ### Patch Changes
10
+
11
+ - 3fbf5d8: Updates preview worker
12
+
13
+ ## 0.1.0-beta.121
14
+
15
+ ### Minor Changes
16
+
17
+ - 9cb2166: Join base path with HEADER_LINKS and TABS
18
+
19
+ ### Patch Changes
20
+
21
+ - 7701d8f: Clean up console warnings loading DocsSearch markdown renderer
22
+ - Updated dependencies [7701d8f]
23
+ - Updated dependencies [5460e81]
24
+ - @stainless-api/docs-ui@0.1.0-beta.87
25
+ - @stainless-api/docs-search@0.1.0-beta.40
26
+
3
27
  ## 0.1.0-beta.120
4
28
 
5
29
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stainless-api/docs",
3
- "version": "0.1.0-beta.120",
3
+ "version": "0.1.0-beta.122",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -48,9 +48,9 @@
48
48
  "cheerio": "^1.2.0",
49
49
  "clsx": "^2.1.1",
50
50
  "dotenv": "17.3.1",
51
- "lucide-react": "^0.574.0",
51
+ "lucide-react": "^0.577.0",
52
52
  "marked": "^17.0.4",
53
- "node-html-parser": "^7.0.2",
53
+ "node-html-parser": "^7.1.0",
54
54
  "rehype-parse": "^9.0.1",
55
55
  "rehype-remark": "^10.0.1",
56
56
  "remark-gfm": "^4.0.1",
@@ -61,8 +61,8 @@
61
61
  "vite-plugin-prebundle-workers": "^0.2.0",
62
62
  "web-worker": "^1.5.0",
63
63
  "yaml": "^2.8.2",
64
- "@stainless-api/docs-search": "0.1.0-beta.39",
65
- "@stainless-api/docs-ui": "0.1.0-beta.86",
64
+ "@stainless-api/docs-search": "0.1.0-beta.40",
65
+ "@stainless-api/docs-ui": "0.1.0-beta.87",
66
66
  "@stainless-api/ui-primitives": "0.1.0-beta.50"
67
67
  },
68
68
  "devDependencies": {
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import { useMemo } from 'react';
2
2
  import { RESOLVED_API_REFERENCE_PATH, HIGHLIGHT_THEMES } from 'virtual:stl-starlight-virtual-module';
3
3
  import { parseRoute, generateRoute } from '@stainless-api/docs-ui/routing';
4
4
  import { SearchModal } from '@stainless-api/docs-search';
@@ -8,27 +8,28 @@ import type { BundledLanguage, BundledTheme, HighlighterGeneric } from 'shiki';
8
8
 
9
9
  import {
10
10
  DocsProvider,
11
- type MarkdownContext,
12
- MarkdownProvider,
11
+ type MarkdownContextValue,
13
12
  NavigationProvider,
13
+ SuspensefulMarkdownProvider,
14
14
  } from '@stainless-api/docs-ui/contexts';
15
15
  import { ComponentProvider } from '@stainless-api/docs-ui/contexts/component';
16
16
  import { SearchProvider } from '@stainless-api/docs-search/context';
17
17
  import type { SearchSettings } from '@stainless-api/docs-search/types';
18
18
 
19
- let $$highlighter: HighlighterGeneric<BundledLanguage, BundledTheme> | null = null;
20
- async function getHighlighter() {
21
- if ($$highlighter === null) {
22
- $$highlighter = await createHighlighter({
19
+ declare global {
20
+ var __docsSearchShikiSingleton: Promise<HighlighterGeneric<BundledLanguage, BundledTheme>> | undefined;
21
+ }
22
+ function getHighlighter() {
23
+ if (!globalThis.__docsSearchShikiSingleton) {
24
+ globalThis.__docsSearchShikiSingleton = createHighlighter({
23
25
  themes: ['github-dark'],
24
26
  langs: ['typescript', 'python', 'go', 'java', 'kotlin', 'ruby'],
25
27
  });
26
28
  }
27
-
28
- return $$highlighter;
29
+ return globalThis.__docsSearchShikiSingleton;
29
30
  }
30
31
 
31
- async function createMarkdownRenderer(): Promise<MarkdownContext> {
32
+ async function createMarkdownRenderer(): Promise<MarkdownContextValue> {
32
33
  const highlighter = await getHighlighter();
33
34
  const markdocConfig: Markdoc.Config = {
34
35
  nodes: {
@@ -91,7 +92,7 @@ async function createMarkdownRenderer(): Promise<MarkdownContext> {
91
92
  }
92
93
 
93
94
  export function DocsSearch({ settings, currentPath }: { settings: SearchSettings; currentPath: string }) {
94
- const markdownRenderer = React.use(createMarkdownRenderer());
95
+ const rendererPromise = useMemo(() => createMarkdownRenderer(), []);
95
96
  const { stainlessPath, language } = parseRoute(RESOLVED_API_REFERENCE_PATH, currentPath);
96
97
  // eslint-disable-next-line turbo/no-undeclared-env-vars
97
98
  const pageFind = import.meta.env.DEV
@@ -109,13 +110,13 @@ export function DocsSearch({ settings, currentPath }: { settings: SearchSettings
109
110
  <DocsProvider spec={null} language={language}>
110
111
  <ComponentProvider>
111
112
  <NavigationProvider basePath="/" selectedPath={stainlessPath}>
112
- <MarkdownProvider {...markdownRenderer}>
113
+ <SuspensefulMarkdownProvider value={rendererPromise}>
113
114
  <SearchProvider onSelect={handleSelect} pageFind={pageFind} settings={settings}>
114
115
  <div className="stldocs-root">
115
116
  <SearchModal id="stldocs-search" />
116
117
  </div>
117
118
  </SearchProvider>
118
- </MarkdownProvider>
119
+ </SuspensefulMarkdownProvider>
119
120
  </NavigationProvider>
120
121
  </ComponentProvider>
121
122
  </DocsProvider>