@stainless-api/docs-ui 0.1.0-beta.24 → 0.1.0-beta.26
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/dist/breadcrumbs-D5viAm7a.d.ts +20 -0
- package/dist/chunk-Bp6m_JJh.js +13 -0
- package/dist/component-generics-BnrVqdQj.d.ts +29 -0
- package/dist/component-generics-Df4EDvxk.js +41 -0
- package/dist/components/breadcrumbs.d.ts +2 -0
- package/dist/components/breadcrumbs.js +16 -0
- package/dist/components/chat.d.ts +14 -0
- package/dist/components/chat.js +128 -0
- package/dist/components/dropdown.d.ts +2 -0
- package/dist/components/dropdown.js +4 -0
- package/dist/components/icons.d.ts +50 -0
- package/dist/components/icons.js +3 -0
- package/dist/components/index.d.ts +12 -0
- package/dist/components/index.js +16 -0
- package/dist/components/method.d.ts +2 -0
- package/dist/components/method.js +16 -0
- package/dist/components/overview.d.ts +2 -0
- package/dist/components/overview.js +16 -0
- package/dist/components/primitives.d.ts +2 -0
- package/dist/components/primitives.js +16 -0
- package/dist/components/properties.d.ts +2 -0
- package/dist/components/properties.js +16 -0
- package/dist/components/scripts/dropdown.d.ts +12 -0
- package/dist/components/scripts/dropdown.js +50 -0
- package/dist/components/sdk.d.ts +3 -0
- package/dist/components/sdk.js +16 -0
- package/dist/components/sidebar.d.ts +2 -0
- package/dist/components/sidebar.js +16 -0
- package/dist/components/snippets.d.ts +4 -0
- package/dist/components/snippets.js +16 -0
- package/dist/contexts/component-generics.d.ts +2 -0
- package/dist/contexts/component-generics.js +3 -0
- package/dist/contexts/component-types.d.ts +18 -0
- package/dist/contexts/component-types.js +1 -0
- package/dist/contexts/component.d.ts +30 -0
- package/dist/contexts/component.js +16 -0
- package/dist/contexts/docs.d.ts +2 -0
- package/dist/contexts/docs.js +3 -0
- package/dist/contexts/index.d.ts +20 -0
- package/dist/contexts/index.js +16 -0
- package/dist/contexts/markdown.d.ts +2 -0
- package/dist/contexts/markdown.js +4 -0
- package/dist/contexts/navigation.d.ts +3 -0
- package/dist/contexts/navigation.js +3 -0
- package/dist/contexts/search.d.ts +4 -0
- package/dist/contexts/search.js +16 -0
- package/dist/contexts/use-components.d.ts +16 -0
- package/dist/contexts/use-components.js +4 -0
- package/dist/contexts-DO0sMzym.js +2581 -0
- package/dist/docs-Cj25B-Sh.js +50 -0
- package/dist/docs-DhNaW0DE.d.ts +45 -0
- package/dist/dropdown-Dv9VAYCW.d.ts +42 -0
- package/dist/dropdown-kUhwBigR.js +38 -0
- package/dist/icons--8QR-PrL.js +222 -0
- package/dist/index-BW6OPqAo.d.ts +16 -0
- package/dist/index-BXO3gZup.d.ts +239 -0
- package/dist/index-d8_VR8Z5.d.ts +14 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +5030 -4830
- package/dist/languages/go.d.ts +13 -0
- package/dist/languages/go.js +16 -0
- package/dist/languages/http.d.ts +13 -0
- package/dist/languages/http.js +16 -0
- package/dist/languages/index.d.ts +13 -0
- package/dist/languages/index.js +16 -0
- package/dist/languages/java.d.ts +13 -0
- package/dist/languages/java.js +16 -0
- package/dist/languages/python.d.ts +13 -0
- package/dist/languages/python.js +16 -0
- package/dist/languages/ruby.d.ts +13 -0
- package/dist/languages/ruby.js +16 -0
- package/dist/languages/typescript.d.ts +13 -0
- package/dist/languages/typescript.js +16 -0
- package/dist/markdown/index.d.ts +12 -0
- package/dist/markdown/index.js +16 -0
- package/dist/markdown/md.d.ts +15 -0
- package/dist/markdown/md.js +3 -0
- package/dist/markdown/utils.d.ts +4 -0
- package/dist/markdown/utils.js +3 -0
- package/dist/markdown-DN8KaRR2.d.ts +21 -0
- package/dist/markdown-DunIdqFE.js +39 -0
- package/dist/mcp.cjs +983443 -0
- package/dist/md-Dg8aOyMA.js +41 -0
- package/dist/method-c3XDArUn.d.ts +70 -0
- package/dist/navigation-BSn6PX-7.d.ts +28 -0
- package/dist/navigation-CuCg3le8.js +20 -0
- package/dist/overview-D21weqVJ.d.ts +39 -0
- package/dist/pagefind-ChrPfuVv.js +15 -0
- package/dist/primitives-iB9fIrMF.d.ts +98 -0
- package/dist/properties-Ba6F_GGj.d.ts +46 -0
- package/dist/routing-BE6Vrs-z.d.ts +54 -0
- package/dist/routing-C8oZYLsf.js +189 -0
- package/dist/routing.d.ts +2 -0
- package/dist/routing.js +4 -4
- package/dist/sdk-D2x2l6JH.d.ts +118 -0
- package/dist/search/index.d.ts +26 -0
- package/dist/search/index.js +211 -0
- package/dist/search/providers/algolia.d.ts +24 -0
- package/dist/search/providers/algolia.js +16 -0
- package/dist/search/providers/fuse.d.ts +18 -0
- package/dist/search/providers/fuse.js +31 -0
- package/dist/search/providers/pagefind.d.ts +7 -0
- package/dist/search/providers/pagefind.js +3 -0
- package/dist/search/providers/walker.d.ts +9 -0
- package/dist/search/providers/walker.js +35 -0
- package/dist/search/types.d.ts +3 -0
- package/dist/search/types.js +3 -0
- package/dist/search-KMqOU2tz.d.ts +20 -0
- package/dist/sidebar-B1X4gmY2.d.ts +35 -0
- package/dist/snippets-BApdMOXp.d.ts +45 -0
- package/dist/style-BWu-Pqcm.d.ts +182 -0
- package/dist/style-CkbsakoF.js +183 -0
- package/dist/style.d.ts +2 -0
- package/dist/style.js +3 -0
- package/dist/styles/main.css +743 -748
- package/dist/styles/primitives.css +444 -427
- package/dist/styles/resets.css +33 -41
- package/dist/styles/search.css +265 -248
- package/dist/styles/sidebar.css +58 -60
- package/dist/styles/snippets.css +86 -88
- package/dist/styles/variables.css +86 -90
- package/dist/types-BLgvxY4i.d.ts +83 -0
- package/dist/types-DFN4M1Sp.js +34 -0
- package/dist/use-components-DI-AbT-D.js +7 -0
- package/dist/utils-B9JL_XWH.d.ts +21 -0
- package/dist/utils-BhYTrLot.js +32 -0
- package/dist/utils-ByZH9QWT.js +30 -0
- package/dist/utils-DlayebL1.d.ts +14 -0
- package/dist/utils.d.ts +2 -0
- package/dist/utils.js +4 -0
- package/package.json +4 -4
- package/src/search/mcp.ts +8 -8
- package/dist/mcp.js +0 -15967
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { t as DocsLanguage } from "./routing-BE6Vrs-z.js";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import * as SDKJSON from "@stainless/sdk-json";
|
|
4
|
+
|
|
5
|
+
//#region src/components/sdk.d.ts
|
|
6
|
+
type PropertyModelContextType = {
|
|
7
|
+
modelPath?: string;
|
|
8
|
+
propertyPath?: string;
|
|
9
|
+
};
|
|
10
|
+
declare const PropertyModelContext: React$1.Context<PropertyModelContextType>;
|
|
11
|
+
declare function usePropertyModel(): PropertyModelContextType;
|
|
12
|
+
type ReferenceNestingContextType = string[];
|
|
13
|
+
declare const ReferenceNestingContext: React$1.Context<ReferenceNestingContextType>;
|
|
14
|
+
declare function useReferenceNesting(): ReferenceNestingContextType;
|
|
15
|
+
type SDKSnippetLanguagesType = Record<SDKJSON.SnippetLanguage, {
|
|
16
|
+
name: string;
|
|
17
|
+
icon: string;
|
|
18
|
+
}>;
|
|
19
|
+
declare const SDKSnippetLanguages: SDKSnippetLanguagesType;
|
|
20
|
+
type TransformRequestSnippetFn = ({
|
|
21
|
+
snippet,
|
|
22
|
+
language
|
|
23
|
+
}: {
|
|
24
|
+
snippet: string;
|
|
25
|
+
language: DocsLanguage;
|
|
26
|
+
}) => string;
|
|
27
|
+
type SDKChildrenProps = {
|
|
28
|
+
paths: SDKJSON.ID[];
|
|
29
|
+
expand?: boolean;
|
|
30
|
+
depth?: number;
|
|
31
|
+
};
|
|
32
|
+
declare function SDKChildren({
|
|
33
|
+
paths,
|
|
34
|
+
expand,
|
|
35
|
+
depth
|
|
36
|
+
}: SDKChildrenProps): React$1.JSX.Element;
|
|
37
|
+
type SDKDeclarationProps = {
|
|
38
|
+
path: string;
|
|
39
|
+
expand?: boolean;
|
|
40
|
+
depth?: number;
|
|
41
|
+
};
|
|
42
|
+
declare function SDKDeclaration({
|
|
43
|
+
path,
|
|
44
|
+
expand,
|
|
45
|
+
depth
|
|
46
|
+
}: SDKDeclarationProps): React$1.JSX.Element;
|
|
47
|
+
type SDKConstraintsProps = {
|
|
48
|
+
constraints?: Record<string, any>;
|
|
49
|
+
};
|
|
50
|
+
declare function SDKConstraints({
|
|
51
|
+
constraints
|
|
52
|
+
}: SDKConstraintsProps): React$1.JSX.Element | undefined;
|
|
53
|
+
type SDKIconProps = {
|
|
54
|
+
language: SDKJSON.SnippetLanguage;
|
|
55
|
+
size?: number;
|
|
56
|
+
};
|
|
57
|
+
declare function SDKIcon({
|
|
58
|
+
language
|
|
59
|
+
}: SDKIconProps): React$1.JSX.Element | null;
|
|
60
|
+
type SDKRequestTitleProps = {
|
|
61
|
+
snippetLanguage: SDKJSON.SnippetLanguage;
|
|
62
|
+
};
|
|
63
|
+
declare function SDKRequestTitle({
|
|
64
|
+
snippetLanguage
|
|
65
|
+
}: SDKRequestTitleProps): React$1.JSX.Element;
|
|
66
|
+
type SDKExampleProps = {
|
|
67
|
+
method: SDKJSON.Method;
|
|
68
|
+
transformRequestSnippet?: TransformRequestSnippetFn;
|
|
69
|
+
};
|
|
70
|
+
declare function SDKExample({
|
|
71
|
+
method,
|
|
72
|
+
transformRequestSnippet
|
|
73
|
+
}: SDKExampleProps): React$1.JSX.Element;
|
|
74
|
+
type SDKMethodProps = {
|
|
75
|
+
method: SDKJSON.Method;
|
|
76
|
+
transformRequestSnippet?: TransformRequestSnippetFn;
|
|
77
|
+
};
|
|
78
|
+
declare function SDKMethodHeader({
|
|
79
|
+
method
|
|
80
|
+
}: SDKMethodProps): React$1.JSX.Element;
|
|
81
|
+
declare function SDKMethodInfo({
|
|
82
|
+
method
|
|
83
|
+
}: SDKMethodProps): React$1.JSX.Element;
|
|
84
|
+
declare function SDKMethod({
|
|
85
|
+
method,
|
|
86
|
+
transformRequestSnippet
|
|
87
|
+
}: SDKMethodProps): React$1.JSX.Element | undefined;
|
|
88
|
+
type SDKModelProps = {
|
|
89
|
+
model: SDKJSON.Model;
|
|
90
|
+
};
|
|
91
|
+
declare function SDKModel({
|
|
92
|
+
model
|
|
93
|
+
}: SDKModelProps): React$1.JSX.Element | null;
|
|
94
|
+
type SDKReferenceProps = {
|
|
95
|
+
stainlessPath: string;
|
|
96
|
+
children?: React$1.ReactNode;
|
|
97
|
+
};
|
|
98
|
+
declare function SDKReference({
|
|
99
|
+
stainlessPath,
|
|
100
|
+
children
|
|
101
|
+
}: SDKReferenceProps): string | number | bigint | boolean | Iterable<React$1.ReactNode> | Promise<string | number | bigint | boolean | React$1.ReactPortal | React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>> | Iterable<React$1.ReactNode> | null | undefined> | React$1.JSX.Element | null | undefined;
|
|
102
|
+
type SDKLanguageBlockProps = {
|
|
103
|
+
language: DocsLanguage;
|
|
104
|
+
version: string;
|
|
105
|
+
install: string;
|
|
106
|
+
links: {
|
|
107
|
+
repo: string;
|
|
108
|
+
docs: string;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
declare function SDKLanguageBlock({
|
|
112
|
+
language,
|
|
113
|
+
version,
|
|
114
|
+
install,
|
|
115
|
+
links
|
|
116
|
+
}: SDKLanguageBlockProps): React$1.JSX.Element;
|
|
117
|
+
//#endregion
|
|
118
|
+
export { TransformRequestSnippetFn as C, SDKSnippetLanguagesType as S, useReferenceNesting as T, SDKModelProps as _, SDKChildren as a, SDKRequestTitleProps as b, SDKDeclaration as c, SDKLanguageBlock as d, SDKMethod as f, SDKModel as g, SDKMethodProps as h, ReferenceNestingContextType as i, SDKExample as l, SDKMethodInfo as m, PropertyModelContextType as n, SDKConstraints as o, SDKMethodHeader as p, ReferenceNestingContext as r, SDKConstraintsProps as s, PropertyModelContext as t, SDKIcon as u, SDKReference as v, usePropertyModel as w, SDKSnippetLanguages as x, SDKRequestTitle as y };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import "../routing-BE6Vrs-z.js";
|
|
2
|
+
import { c as QueryKindsType, l as ResultData } from "../types-BLgvxY4i.js";
|
|
3
|
+
import * as React$1 from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/search/form.d.ts
|
|
6
|
+
declare function SearchForm(): React$1.JSX.Element;
|
|
7
|
+
type SearchFilterProps = {
|
|
8
|
+
results: ResultData;
|
|
9
|
+
filterKind: QueryKindsType;
|
|
10
|
+
onChange: (filterKind: QueryKindsType) => void;
|
|
11
|
+
};
|
|
12
|
+
declare function SearchFilter({
|
|
13
|
+
results,
|
|
14
|
+
filterKind,
|
|
15
|
+
onChange
|
|
16
|
+
}: SearchFilterProps): React$1.JSX.Element;
|
|
17
|
+
type SearchModalProps = {
|
|
18
|
+
id?: string;
|
|
19
|
+
open?: boolean;
|
|
20
|
+
};
|
|
21
|
+
declare function SearchModal({
|
|
22
|
+
id,
|
|
23
|
+
open: isOpen
|
|
24
|
+
}: SearchModalProps): React$1.JSX.Element;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { SearchFilter, SearchFilterProps, SearchForm, SearchModal, SearchModalProps };
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { a as useLanguage } from "../docs-Cj25B-Sh.js";
|
|
2
|
+
import "../component-generics-Df4EDvxk.js";
|
|
3
|
+
import "../navigation-CuCg3le8.js";
|
|
4
|
+
import "../markdown-DunIdqFE.js";
|
|
5
|
+
import "../routing-C8oZYLsf.js";
|
|
6
|
+
import { t as style_default } from "../style-CkbsakoF.js";
|
|
7
|
+
import { t as useComponents } from "../use-components-DI-AbT-D.js";
|
|
8
|
+
import { a as useSearchContext, i as useSearch } from "../contexts-DO0sMzym.js";
|
|
9
|
+
import "../icons--8QR-PrL.js";
|
|
10
|
+
import "../utils-BhYTrLot.js";
|
|
11
|
+
import "../dropdown-kUhwBigR.js";
|
|
12
|
+
import "../md-Dg8aOyMA.js";
|
|
13
|
+
import "../utils-ByZH9QWT.js";
|
|
14
|
+
import { t as QueryKinds } from "../types-DFN4M1Sp.js";
|
|
15
|
+
import { t as guideSearch } from "../pagefind-ChrPfuVv.js";
|
|
16
|
+
import * as React$1 from "react";
|
|
17
|
+
import { BookOpenText, Box, Code, Folder, Search, Wrench, X } from "lucide-react";
|
|
18
|
+
|
|
19
|
+
//#region src/search/results.tsx
|
|
20
|
+
const QueryKindDisplay = {
|
|
21
|
+
all: {
|
|
22
|
+
name: "Results",
|
|
23
|
+
icon: Search
|
|
24
|
+
},
|
|
25
|
+
resource: {
|
|
26
|
+
name: "Resources",
|
|
27
|
+
icon: Folder
|
|
28
|
+
},
|
|
29
|
+
http_method: {
|
|
30
|
+
name: "Methods",
|
|
31
|
+
icon: Box
|
|
32
|
+
},
|
|
33
|
+
model: {
|
|
34
|
+
name: "Types",
|
|
35
|
+
icon: Code
|
|
36
|
+
},
|
|
37
|
+
property: {
|
|
38
|
+
name: "Properties",
|
|
39
|
+
icon: Wrench
|
|
40
|
+
},
|
|
41
|
+
guide: {
|
|
42
|
+
name: "Guide",
|
|
43
|
+
icon: BookOpenText
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
function Highlight({ result, name }) {
|
|
47
|
+
const value = result._highlightResult[name]?.value;
|
|
48
|
+
if (value) return <span dangerouslySetInnerHTML={{ __html: value }} />;
|
|
49
|
+
}
|
|
50
|
+
function SearchResultBreadcrumb({ result }) {
|
|
51
|
+
const Docs = useComponents();
|
|
52
|
+
const Icon = QueryKindDisplay[result.kind].icon;
|
|
53
|
+
const items = result.crumbs?.map((crumb) => <span key={crumb} className={style_default.SearchBreadcrumbItem}>
|
|
54
|
+
{crumb}
|
|
55
|
+
</span>);
|
|
56
|
+
return <div className={style_default.SearchBreadcrumb}>
|
|
57
|
+
<Icon className={style_default.Icon} size={14} />
|
|
58
|
+
{Array.isArray(result.crumbs) && <Docs.Join items={items}>
|
|
59
|
+
<span className={style_default.SearchBreadcrumbDivider}>{"›"}</span>
|
|
60
|
+
</Docs.Join>}
|
|
61
|
+
</div>;
|
|
62
|
+
}
|
|
63
|
+
function SearchResult({ result }) {
|
|
64
|
+
return <div className={style_default.SearchResult} data-stldocs-search-result={result.kind}>
|
|
65
|
+
<SearchResultBreadcrumb result={result} />
|
|
66
|
+
<SearchResultContent result={result} />
|
|
67
|
+
</div>;
|
|
68
|
+
}
|
|
69
|
+
function GuideResult({ result }) {
|
|
70
|
+
const Docs = useComponents();
|
|
71
|
+
const Icon = QueryKindDisplay["guide"].icon;
|
|
72
|
+
const path = result.data.url.slice(1, -1).split("/").map((crumb) => <span className={style_default.SearchBreadcrumbItem} key={crumb}>
|
|
73
|
+
{crumb}
|
|
74
|
+
</span>);
|
|
75
|
+
const crumbs = path.length > 1 ? path : [<span className={style_default.SearchBreadcrumbItem} key="overview">
|
|
76
|
+
Overview
|
|
77
|
+
</span>];
|
|
78
|
+
return <div className={style_default.SearchResult} data-stldocs-search-result="guide">
|
|
79
|
+
<div className={style_default.SearchBreadcrumb}>
|
|
80
|
+
<Icon className={style_default.Icon} size={14} />
|
|
81
|
+
<Docs.Join items={crumbs}>
|
|
82
|
+
<span className={style_default.SearchBreadcrumbDivider}>{"›"}</span>
|
|
83
|
+
</Docs.Join>
|
|
84
|
+
</div>
|
|
85
|
+
<h3 className={style_default.SearchResultGuideTitle}>{result.data.meta.title}</h3>
|
|
86
|
+
<div className={style_default.SearchResultGuideExcerpt} dangerouslySetInnerHTML={{ __html: result.data.excerpt }} />
|
|
87
|
+
</div>;
|
|
88
|
+
}
|
|
89
|
+
function SearchResultContent({ result }) {
|
|
90
|
+
const Docs = useComponents();
|
|
91
|
+
const language = useLanguage();
|
|
92
|
+
switch (result.kind) {
|
|
93
|
+
case "http_method": return <>
|
|
94
|
+
<Docs.MethodHeader level="h5" title={<Highlight result={result} name={result.summary ? "summary" : "title"} />} signature={result["qualified"] && <Highlight result={result} name={"qualified"} />}>
|
|
95
|
+
<Docs.MethodRoute httpMethod={result.httpMethod} endpoint={<Highlight result={result} name="endpoint" />} />
|
|
96
|
+
</Docs.MethodHeader>
|
|
97
|
+
<div className={`${style_default.MethodDescription} ${style_default.Content}`}>
|
|
98
|
+
<Highlight result={result} name="description" />
|
|
99
|
+
</div>
|
|
100
|
+
</>;
|
|
101
|
+
case "model": {
|
|
102
|
+
const properties = result.children?.map((child, index) => <span key={index} className={style_default.TextIdentifier}>
|
|
103
|
+
{child}
|
|
104
|
+
</span>) ?? [];
|
|
105
|
+
return <div className={style_default.Property} data-stldocs-language={language}>
|
|
106
|
+
<div className={style_default.PropertyHeader}>
|
|
107
|
+
<span className={style_default.PropertyName}>
|
|
108
|
+
<Highlight result={result} name={result.title ? "title" : "name"} />
|
|
109
|
+
</span>
|
|
110
|
+
</div>
|
|
111
|
+
<span className={style_default.PropertyDeclaration}>
|
|
112
|
+
<Highlight result={result} name="ident" />:{" "}
|
|
113
|
+
<Docs.Join items={properties} limit={3}>
|
|
114
|
+
<span className={style_default.TextPunctuation}>, </span>
|
|
115
|
+
</Docs.Join>
|
|
116
|
+
</span>
|
|
117
|
+
</div>;
|
|
118
|
+
}
|
|
119
|
+
case "resource": return <div className={style_default.SearchResultResourceInfo}>
|
|
120
|
+
<span className={style_default.SearchResultResourceTitle}>
|
|
121
|
+
<Highlight result={result} name="title" />
|
|
122
|
+
</span>
|
|
123
|
+
<span className={style_default.SearchResultResourcePath}>
|
|
124
|
+
<Highlight result={result} name="QualifiedName" />
|
|
125
|
+
</span>
|
|
126
|
+
</div>;
|
|
127
|
+
case "property": return <div className={style_default.Property} data-stldocs-language={language}>
|
|
128
|
+
<div className={style_default.PropertyHeader}>
|
|
129
|
+
<span className={style_default.PropertyName}>
|
|
130
|
+
<Highlight result={result} name="name" />
|
|
131
|
+
</span>
|
|
132
|
+
<span className={style_default.PropertyTypeName}>
|
|
133
|
+
<span dangerouslySetInnerHTML={{ __html: result.type ?? "" }} />
|
|
134
|
+
</span>
|
|
135
|
+
</div>
|
|
136
|
+
{result.docstring && <span className={style_default.PropertyDescription}>
|
|
137
|
+
<Highlight result={result} name="docstring" />
|
|
138
|
+
</span>}
|
|
139
|
+
</div>;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
//#endregion
|
|
144
|
+
//#region src/search/form.tsx
|
|
145
|
+
function SearchForm() {
|
|
146
|
+
const Docs = useComponents();
|
|
147
|
+
const search = useSearch();
|
|
148
|
+
const language = useLanguage();
|
|
149
|
+
const { onSelect, pageFind } = useSearchContext();
|
|
150
|
+
const [results, setResults] = React$1.useState(null);
|
|
151
|
+
const [filterKind, setFilterKind] = React$1.useState("all");
|
|
152
|
+
const [searchQuery, setSearchQuery] = React$1.useState("");
|
|
153
|
+
const inputRef = React$1.useRef(null);
|
|
154
|
+
async function performSearch() {
|
|
155
|
+
const guideLimit = filterKind === "guide" ? 25 : 5;
|
|
156
|
+
const kind = ["all", "guide"].includes(filterKind) ? void 0 : filterKind;
|
|
157
|
+
const [guideResults, apiResults] = await Promise.all([pageFind ? guideSearch(pageFind, searchQuery, guideLimit) : [], search({
|
|
158
|
+
query: searchQuery,
|
|
159
|
+
kind,
|
|
160
|
+
language
|
|
161
|
+
})]);
|
|
162
|
+
setResults({
|
|
163
|
+
items: filterKind === "guide" ? guideResults : [...guideResults, ...apiResults?.hits ?? []],
|
|
164
|
+
counts: {
|
|
165
|
+
...apiResults?.facets?.["kind"],
|
|
166
|
+
guide: guideResults.length,
|
|
167
|
+
all: apiResults?.nbHits
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
function clearInput() {
|
|
172
|
+
setSearchQuery("");
|
|
173
|
+
inputRef?.current?.focus();
|
|
174
|
+
}
|
|
175
|
+
React$1.useEffect(() => void performSearch(), [
|
|
176
|
+
searchQuery,
|
|
177
|
+
filterKind,
|
|
178
|
+
language
|
|
179
|
+
]);
|
|
180
|
+
return <div className={style_default.SearchForm}>
|
|
181
|
+
<Docs.Input ref={inputRef} autoFocus onChange={(ev) => setSearchQuery(ev.target.value)} left={<Search size={16} className={style_default.Icon} />} right={searchQuery && <X cursor="pointer" onClick={() => clearInput()} size={16} className={style_default.Icon} />} value={searchQuery} placeholder="Search" />
|
|
182
|
+
|
|
183
|
+
<SearchFilter results={results} filterKind={filterKind} onChange={(filterKind$1) => setFilterKind(filterKind$1)} />
|
|
184
|
+
|
|
185
|
+
<Docs.ListView items={results?.items ?? []} itemDelegate={(item) => "kind" in item ? <SearchResult result={item} /> : <GuideResult result={item} />} onSelectListItem={(item) => onSelect?.(item["data"]?.["url"] ?? item["stainlessPath"])} />
|
|
186
|
+
</div>;
|
|
187
|
+
}
|
|
188
|
+
function SearchFilter({ results, filterKind, onChange }) {
|
|
189
|
+
const Docs = useComponents();
|
|
190
|
+
const { pageFind } = useSearchContext();
|
|
191
|
+
const toggles = pageFind ? QueryKinds : QueryKinds.slice(0, -1);
|
|
192
|
+
return <div className={style_default.SearchFilter}>
|
|
193
|
+
{toggles.map((kind, index) => <Docs.ToggleButton key={index} selected={filterKind === kind} onClick={() => onChange?.(kind)}>
|
|
194
|
+
{React$1.createElement(QueryKindDisplay[kind].icon, {
|
|
195
|
+
size: 16,
|
|
196
|
+
className: style_default.Icon
|
|
197
|
+
})}
|
|
198
|
+
<span className={style_default.SearchFilterLabel}>{QueryKindDisplay[kind].name}</span>
|
|
199
|
+
<span className={style_default.SearchFilterCount}>{results?.counts?.[kind] ?? 0}</span>
|
|
200
|
+
</Docs.ToggleButton>)}
|
|
201
|
+
</div>;
|
|
202
|
+
}
|
|
203
|
+
function SearchModal({ id, open: isOpen }) {
|
|
204
|
+
const [open, setOpen] = React$1.useState(isOpen ?? false);
|
|
205
|
+
return <div id={id} onToggle={(ev) => setOpen(ev.newState === "open")} className={style_default.SearchModal} popover="auto" data-stldocs-modal-open={open}>
|
|
206
|
+
{open && <SearchForm />}
|
|
207
|
+
</div>;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
//#endregion
|
|
211
|
+
export { SearchFilter, SearchForm, SearchModal };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import "../../routing-BE6Vrs-z.js";
|
|
2
|
+
import { d as ResultType, h as SearchSettings, m as SearchParams } from "../../types-BLgvxY4i.js";
|
|
3
|
+
import * as SDKJSON from "@stainless/sdk-json";
|
|
4
|
+
|
|
5
|
+
//#region src/search/providers/algolia.d.ts
|
|
6
|
+
declare function buildIndex(appId: string, indexName: string, writeKey: string, spec: SDKJSON.Spec, renderMarkdown: (_: string) => string | null): Promise<void>;
|
|
7
|
+
declare function buildChatIndex(appId: string, indexName: string, writeKey: string, spec: SDKJSON.Spec): Promise<void>;
|
|
8
|
+
declare function search({
|
|
9
|
+
settings: {
|
|
10
|
+
appId,
|
|
11
|
+
indexName,
|
|
12
|
+
searchKey
|
|
13
|
+
},
|
|
14
|
+
params: {
|
|
15
|
+
query,
|
|
16
|
+
language,
|
|
17
|
+
kind
|
|
18
|
+
}
|
|
19
|
+
}: {
|
|
20
|
+
params: SearchParams;
|
|
21
|
+
settings: SearchSettings;
|
|
22
|
+
}): Promise<ResultType | undefined>;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { buildChatIndex, buildIndex, search };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import "../../docs-Cj25B-Sh.js";
|
|
2
|
+
import "../../component-generics-Df4EDvxk.js";
|
|
3
|
+
import "../../navigation-CuCg3le8.js";
|
|
4
|
+
import "../../markdown-DunIdqFE.js";
|
|
5
|
+
import "../../routing-C8oZYLsf.js";
|
|
6
|
+
import "../../style-CkbsakoF.js";
|
|
7
|
+
import "../../use-components-DI-AbT-D.js";
|
|
8
|
+
import { c as search, o as buildChatIndex, s as buildIndex } from "../../contexts-DO0sMzym.js";
|
|
9
|
+
import "../../icons--8QR-PrL.js";
|
|
10
|
+
import "../../utils-BhYTrLot.js";
|
|
11
|
+
import "../../dropdown-kUhwBigR.js";
|
|
12
|
+
import "../../md-Dg8aOyMA.js";
|
|
13
|
+
import "../../utils-ByZH9QWT.js";
|
|
14
|
+
import "../../types-DFN4M1Sp.js";
|
|
15
|
+
|
|
16
|
+
export { buildChatIndex, buildIndex, search };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { t as DocsLanguage } from "../../routing-BE6Vrs-z.js";
|
|
2
|
+
import { n as IndexEntry } from "../../types-BLgvxY4i.js";
|
|
3
|
+
import * as fuse_js0 from "fuse.js";
|
|
4
|
+
import { FuseIndex } from "fuse.js";
|
|
5
|
+
import * as SDKJSON from "@stainless/sdk-json";
|
|
6
|
+
|
|
7
|
+
//#region src/search/providers/fuse.d.ts
|
|
8
|
+
type FuseIndexData = {
|
|
9
|
+
content: IndexEntry[];
|
|
10
|
+
index: FuseIndex<IndexEntry>;
|
|
11
|
+
};
|
|
12
|
+
declare function buildIndex(spec: SDKJSON.Spec, language?: DocsLanguage): FuseIndexData;
|
|
13
|
+
declare function search({
|
|
14
|
+
content,
|
|
15
|
+
index
|
|
16
|
+
}: FuseIndexData, query: string, limit?: number): fuse_js0.FuseResult<IndexEntry>[];
|
|
17
|
+
//#endregion
|
|
18
|
+
export { FuseIndexData, buildIndex, search };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import "../../docs-Cj25B-Sh.js";
|
|
2
|
+
import "../../component-generics-Df4EDvxk.js";
|
|
3
|
+
import "../../navigation-CuCg3le8.js";
|
|
4
|
+
import "../../markdown-DunIdqFE.js";
|
|
5
|
+
import "../../routing-C8oZYLsf.js";
|
|
6
|
+
import "../../style-CkbsakoF.js";
|
|
7
|
+
import "../../use-components-DI-AbT-D.js";
|
|
8
|
+
import { l as generateIndex } from "../../contexts-DO0sMzym.js";
|
|
9
|
+
import "../../icons--8QR-PrL.js";
|
|
10
|
+
import "../../utils-BhYTrLot.js";
|
|
11
|
+
import "../../dropdown-kUhwBigR.js";
|
|
12
|
+
import "../../md-Dg8aOyMA.js";
|
|
13
|
+
import "../../utils-ByZH9QWT.js";
|
|
14
|
+
import { n as SearchableAttributes } from "../../types-DFN4M1Sp.js";
|
|
15
|
+
import Fuse from "fuse.js";
|
|
16
|
+
|
|
17
|
+
//#region src/search/providers/fuse.ts
|
|
18
|
+
function buildIndex(spec, language) {
|
|
19
|
+
const idx = Array.from(generateIndex(spec, void 0, false));
|
|
20
|
+
const content = language ? idx.filter((entry) => entry.language === language) : idx;
|
|
21
|
+
return {
|
|
22
|
+
content,
|
|
23
|
+
index: Fuse.createIndex([...SearchableAttributes], content)
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function search({ content, index }, query, limit = 100) {
|
|
27
|
+
return new Fuse(content, { keys: [...SearchableAttributes] }, index).search(query).slice(0, limit);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
export { buildIndex, search };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import "../../routing-BE6Vrs-z.js";
|
|
2
|
+
import { t as GuideResultType } from "../../types-BLgvxY4i.js";
|
|
3
|
+
|
|
4
|
+
//#region src/search/providers/pagefind.d.ts
|
|
5
|
+
declare function guideSearch(loadPath: string, query: string, limit?: number): Promise<GuideResultType[]>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { guideSearch };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { t as DocsLanguage } from "../../routing-BE6Vrs-z.js";
|
|
2
|
+
import { n as IndexEntry } from "../../types-BLgvxY4i.js";
|
|
3
|
+
import * as SDKJSON from "@stainless/sdk-json";
|
|
4
|
+
|
|
5
|
+
//#region src/search/providers/walker.d.ts
|
|
6
|
+
declare function buildIndex(spec: SDKJSON.Spec): Generator<IndexEntry, any, any>;
|
|
7
|
+
declare function search(index: Generator<IndexEntry>, language: DocsLanguage, query: string, limit?: number): IndexEntry[];
|
|
8
|
+
//#endregion
|
|
9
|
+
export { buildIndex, search };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import "../../docs-Cj25B-Sh.js";
|
|
2
|
+
import "../../component-generics-Df4EDvxk.js";
|
|
3
|
+
import "../../navigation-CuCg3le8.js";
|
|
4
|
+
import "../../markdown-DunIdqFE.js";
|
|
5
|
+
import "../../routing-C8oZYLsf.js";
|
|
6
|
+
import "../../style-CkbsakoF.js";
|
|
7
|
+
import "../../use-components-DI-AbT-D.js";
|
|
8
|
+
import { l as generateIndex } from "../../contexts-DO0sMzym.js";
|
|
9
|
+
import "../../icons--8QR-PrL.js";
|
|
10
|
+
import "../../utils-BhYTrLot.js";
|
|
11
|
+
import "../../dropdown-kUhwBigR.js";
|
|
12
|
+
import "../../md-Dg8aOyMA.js";
|
|
13
|
+
import "../../utils-ByZH9QWT.js";
|
|
14
|
+
import { n as SearchableAttributes } from "../../types-DFN4M1Sp.js";
|
|
15
|
+
|
|
16
|
+
//#region src/search/providers/walker.ts
|
|
17
|
+
function buildIndex(spec) {
|
|
18
|
+
return generateIndex(spec, void 0, false);
|
|
19
|
+
}
|
|
20
|
+
function* findEntryInIndex(index, language, query) {
|
|
21
|
+
for (const entry of index) {
|
|
22
|
+
if (entry.language !== language) continue;
|
|
23
|
+
for (const attr of SearchableAttributes) {
|
|
24
|
+
const attr_ = attr in entry ? attr : null;
|
|
25
|
+
if (attr_ && entry[attr_] && typeof entry[attr_] === "string" && entry[attr_].includes(query)) yield entry;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function search(index, language, query, limit = 100) {
|
|
30
|
+
const results = findEntryInIndex(index, language, query);
|
|
31
|
+
return Array.from(results).sort((a, b) => a.priority - b.priority).slice(0, limit);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
export { buildIndex, search };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import "../routing-BE6Vrs-z.js";
|
|
2
|
+
import { _ as SearchableAttributesChat, a as IndexProperty, c as QueryKindsType, d as ResultType, f as RoutableJsonNode, g as SearchableAttributes, h as SearchSettings, i as IndexModel, l as ResultData, m as SearchParams, n as IndexEntry, o as IndexResource, p as SearchAttributeNames, r as IndexMethod, s as QueryKinds, t as GuideResultType, u as ResultRecordType } from "../types-BLgvxY4i.js";
|
|
3
|
+
export { GuideResultType, IndexEntry, IndexMethod, IndexModel, IndexProperty, IndexResource, QueryKinds, QueryKindsType, ResultData, ResultRecordType, ResultType, RoutableJsonNode, SearchAttributeNames, SearchParams, SearchSettings, SearchableAttributes, SearchableAttributesChat };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { d as ResultType, h as SearchSettings, m as SearchParams } from "./types-BLgvxY4i.js";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/contexts/search.d.ts
|
|
5
|
+
type SearchContextType = {
|
|
6
|
+
settings: SearchSettings;
|
|
7
|
+
onSelect?: (stainlessPath: string) => void;
|
|
8
|
+
pageFind?: string;
|
|
9
|
+
};
|
|
10
|
+
declare const useSearchContext: () => SearchContextType;
|
|
11
|
+
declare function useSearch(): (params: SearchParams) => Promise<ResultType | undefined>;
|
|
12
|
+
type SearchProviderProps = SearchContextType & {
|
|
13
|
+
children: React$1.ReactNode;
|
|
14
|
+
};
|
|
15
|
+
declare function SearchProvider({
|
|
16
|
+
children,
|
|
17
|
+
...props
|
|
18
|
+
}: SearchProviderProps): React$1.JSX.Element;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { useSearchContext as a, useSearch as i, SearchProvider as n, SearchProviderProps as r, SearchContextType as t };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
import * as SDKJSON from "@stainless/sdk-json";
|
|
3
|
+
|
|
4
|
+
//#region src/components/sidebar.d.ts
|
|
5
|
+
type SidebarExpanderProps = {
|
|
6
|
+
open?: boolean;
|
|
7
|
+
summary: React$1.ReactNode;
|
|
8
|
+
children?: React$1.ReactNode;
|
|
9
|
+
};
|
|
10
|
+
declare function SidebarExpander({
|
|
11
|
+
open,
|
|
12
|
+
summary,
|
|
13
|
+
children
|
|
14
|
+
}: SidebarExpanderProps): React$1.JSX.Element;
|
|
15
|
+
type SidebarMethodProps = {
|
|
16
|
+
method: SDKJSON.Method;
|
|
17
|
+
};
|
|
18
|
+
declare function SidebarMethod({
|
|
19
|
+
method
|
|
20
|
+
}: SidebarMethodProps): React$1.JSX.Element;
|
|
21
|
+
type SidebarResourceProps = {
|
|
22
|
+
resource: SDKJSON.Resource;
|
|
23
|
+
};
|
|
24
|
+
declare function SidebarResource({
|
|
25
|
+
resource
|
|
26
|
+
}: SidebarResourceProps): React$1.JSX.Element;
|
|
27
|
+
type SidebarProps = {
|
|
28
|
+
resources: SDKJSON.Resource[];
|
|
29
|
+
selectedPath?: string;
|
|
30
|
+
};
|
|
31
|
+
declare function Sidebar({
|
|
32
|
+
resources
|
|
33
|
+
}: SidebarProps): React$1.JSX.Element;
|
|
34
|
+
//#endregion
|
|
35
|
+
export { SidebarProps as a, SidebarMethodProps as i, SidebarExpander as n, SidebarResource as o, SidebarMethod as r, SidebarResourceProps as s, Sidebar as t };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { C as TransformRequestSnippetFn } from "./sdk-D2x2l6JH.js";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import * as SDKJSON from "@stainless/sdk-json";
|
|
4
|
+
|
|
5
|
+
//#region src/components/snippets.d.ts
|
|
6
|
+
type SnippetCodeProps = {
|
|
7
|
+
content: string;
|
|
8
|
+
signature?: string;
|
|
9
|
+
language?: string;
|
|
10
|
+
};
|
|
11
|
+
declare function SnippetCode({
|
|
12
|
+
content,
|
|
13
|
+
language
|
|
14
|
+
}: SnippetCodeProps): React$1.JSX.Element;
|
|
15
|
+
type SnippetProps = {
|
|
16
|
+
method: SDKJSON.Method;
|
|
17
|
+
requestTitle?: React$1.ReactNode;
|
|
18
|
+
transformRequestSnippet?: TransformRequestSnippetFn;
|
|
19
|
+
};
|
|
20
|
+
type SnippetContainerProps = {
|
|
21
|
+
children: React$1.ReactNode;
|
|
22
|
+
signature?: string;
|
|
23
|
+
};
|
|
24
|
+
declare function SnippetContainer({
|
|
25
|
+
children
|
|
26
|
+
}: SnippetContainerProps): React$1.JSX.Element;
|
|
27
|
+
type SnippetRequestContainerProps = {
|
|
28
|
+
children?: React$1.ReactNode;
|
|
29
|
+
signature?: string;
|
|
30
|
+
};
|
|
31
|
+
declare function SnippetRequestContainer({
|
|
32
|
+
children
|
|
33
|
+
}: SnippetRequestContainerProps): React$1.JSX.Element;
|
|
34
|
+
declare function Snippet({
|
|
35
|
+
requestTitle,
|
|
36
|
+
method,
|
|
37
|
+
transformRequestSnippet
|
|
38
|
+
}: SnippetProps): React$1.JSX.Element | null;
|
|
39
|
+
declare function SnippetResponse({
|
|
40
|
+
responses
|
|
41
|
+
}: {
|
|
42
|
+
responses: SDKJSON.Method['exampleResponses'];
|
|
43
|
+
}): React$1.JSX.Element | null;
|
|
44
|
+
//#endregion
|
|
45
|
+
export { SnippetContainerProps as a, SnippetRequestContainerProps as c, SnippetContainer as i, SnippetResponse as l, SnippetCode as n, SnippetProps as o, SnippetCodeProps as r, SnippetRequestContainer as s, Snippet as t };
|