@stainless-api/docs-ui 0.1.0-beta.4 → 0.1.0-beta.40
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-CZg0Fk4V.d.ts +20 -0
- package/dist/chunk-Bf_Gc_jT.js +18 -0
- package/dist/component-generics-BLXXX1dz.d.ts +30 -0
- package/dist/component-generics-D3ybuN5r.js +45 -0
- package/dist/components/breadcrumbs.d.ts +2 -0
- package/dist/components/breadcrumbs.js +15 -0
- package/dist/components/icons.d.ts +50 -0
- package/dist/components/icons.js +3 -0
- package/dist/components/index.d.ts +11 -0
- package/dist/components/index.js +15 -0
- package/dist/components/method.d.ts +2 -0
- package/dist/components/method.js +15 -0
- package/dist/components/overview.d.ts +2 -0
- package/dist/components/overview.js +15 -0
- package/dist/components/primitives.d.ts +2 -0
- package/dist/components/primitives.js +15 -0
- package/dist/components/properties.d.ts +2 -0
- package/dist/components/properties.js +15 -0
- package/dist/components/sdk.d.ts +3 -0
- package/dist/components/sdk.js +15 -0
- package/dist/components/sidebar.d.ts +2 -0
- package/dist/components/sidebar.js +15 -0
- package/dist/components/snippets.d.ts +4 -0
- package/dist/components/snippets.js +15 -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 +17 -0
- package/dist/contexts/component-types.js +0 -0
- package/dist/contexts/component.d.ts +30 -0
- package/dist/contexts/component.js +15 -0
- package/dist/contexts/docs.d.ts +2 -0
- package/dist/contexts/docs.js +3 -0
- package/dist/contexts/index.d.ts +19 -0
- package/dist/contexts/index.js +15 -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 +15 -0
- package/dist/contexts/use-components.d.ts +15 -0
- package/dist/contexts/use-components.js +4 -0
- package/dist/contexts-B-OYzYpz.js +3837 -0
- package/dist/docs-BeJaKOCE.d.ts +46 -0
- package/dist/docs-CopwX9a7.js +54 -0
- package/dist/icons-yb-Jhkmg.js +753 -0
- package/dist/index-CBi59jcw.d.ts +240 -0
- package/dist/index-DT1wzg21.d.ts +15 -0
- package/dist/index-DteYqCJO.d.ts +14 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +15 -7542
- package/dist/languages/go.d.ts +12 -0
- package/dist/languages/go.js +15 -0
- package/dist/languages/http.d.ts +12 -0
- package/dist/languages/http.js +15 -0
- package/dist/languages/index.d.ts +12 -0
- package/dist/languages/index.js +15 -0
- package/dist/languages/java.d.ts +12 -0
- package/dist/languages/java.js +15 -0
- package/dist/languages/python.d.ts +12 -0
- package/dist/languages/python.js +15 -0
- package/dist/languages/ruby.d.ts +12 -0
- package/dist/languages/ruby.js +15 -0
- package/dist/languages/typescript.d.ts +12 -0
- package/dist/languages/typescript.js +15 -0
- package/dist/markdown/index.d.ts +12 -0
- package/dist/markdown/index.js +15 -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-DTVxnxGP.d.ts +22 -0
- package/dist/markdown-Diyg-eof.js +48 -0
- package/dist/md-DxiV1_vy.js +41 -0
- package/dist/method-DHjDGGA_.d.ts +71 -0
- package/dist/navigation-CGr5_w6z.js +24 -0
- package/dist/navigation-rt_B_1lt.d.ts +29 -0
- package/dist/overview-CKJV2xUO.d.ts +39 -0
- package/dist/pagefind-BaK1krMe.js +15 -0
- package/dist/primitives-CiVFjnRA.d.ts +99 -0
- package/dist/properties-Z45x-uLZ.d.ts +46 -0
- package/dist/routing-DNN8R6bZ.d.ts +54 -0
- package/dist/routing-qs2YNG9o.js +189 -0
- package/dist/routing.d.ts +2 -0
- package/dist/routing.js +3 -180
- package/dist/sdk-DDWWoPPD.d.ts +119 -0
- package/dist/search/index.d.ts +26 -0
- package/dist/search/index.js +334 -0
- package/dist/search/providers/algolia.d.ts +24 -0
- package/dist/search/providers/algolia.js +15 -0
- package/dist/search/providers/fuse.d.ts +18 -0
- package/dist/search/providers/fuse.js +30 -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 +34 -0
- package/dist/search/types.d.ts +3 -0
- package/dist/search/types.js +3 -0
- package/dist/search-CCDWCiAd.d.ts +21 -0
- package/dist/sidebar-DrtsF85U.d.ts +36 -0
- package/dist/snippets-B2EEG7AK.d.ts +46 -0
- package/dist/spec.d.ts +65 -0
- package/dist/spec.js +167 -0
- package/dist/style-BhhgPVF6.js +165 -0
- package/dist/style-p4qTfnmO.d.ts +164 -0
- package/dist/style.d.ts +2 -0
- package/dist/style.js +3 -0
- package/dist/styles/main.css +724 -754
- package/dist/styles/main.js +0 -0
- package/dist/styles/primitives.css +287 -466
- package/dist/styles/primitives.js +0 -0
- package/dist/styles/resets.css +31 -41
- package/dist/styles/resets.js +0 -0
- package/dist/styles/search.css +175 -274
- package/dist/styles/search.js +0 -0
- package/dist/styles/sidebar.css +59 -60
- package/dist/styles/sidebar.js +0 -0
- package/dist/styles/variables.css +26 -89
- package/dist/styles/variables.js +0 -0
- package/dist/styles.css +1753 -0
- package/dist/styles.mjs +1 -0
- package/dist/types-DNSz4kuM.d.ts +83 -0
- package/dist/types-__XoFvJ_.js +34 -0
- package/dist/use-components-BHEwm0mE.js +7 -0
- package/dist/utils-CA3mYNaX.d.ts +21 -0
- package/dist/utils-D43p_yTd.d.ts +14 -0
- package/dist/utils-FnJ4tyuN.js +32 -0
- package/dist/utils-Jo_o4DX9.js +31 -0
- package/dist/utils.d.ts +2 -0
- package/dist/utils.js +4 -0
- package/package.json +84 -19
- package/dist/mcp.js +0 -16003
- package/dist/styles/snippets.css +0 -132
- package/src/components/breadcrumbs.tsx +0 -94
- package/src/components/chat.tsx +0 -154
- package/src/components/dropdown.tsx +0 -91
- package/src/components/icons.tsx +0 -584
- package/src/components/index.ts +0 -9
- package/src/components/method.tsx +0 -144
- package/src/components/overview.tsx +0 -159
- package/src/components/primitives.tsx +0 -284
- package/src/components/properties.tsx +0 -130
- package/src/components/scripts/dropdown.ts +0 -78
- package/src/components/sdk.tsx +0 -402
- package/src/components/sidebar.tsx +0 -99
- package/src/components/snippets.tsx +0 -179
- package/src/contexts/component-generics.tsx +0 -48
- package/src/contexts/component-types.tsx +0 -5
- package/src/contexts/component.tsx +0 -32
- package/src/contexts/docs.tsx +0 -75
- package/src/contexts/index.tsx +0 -17
- package/src/contexts/markdown.tsx +0 -43
- package/src/contexts/navigation.tsx +0 -44
- package/src/contexts/search.tsx +0 -28
- package/src/contexts/use-components.tsx +0 -4
- package/src/index.ts +0 -6
- package/src/languages/go.tsx +0 -281
- package/src/languages/http.tsx +0 -321
- package/src/languages/index.ts +0 -26
- package/src/languages/java.tsx +0 -358
- package/src/languages/python.tsx +0 -255
- package/src/languages/ruby.tsx +0 -320
- package/src/languages/typescript.tsx +0 -393
- package/src/markdown/index.ts +0 -107
- package/src/markdown/md.ts +0 -45
- package/src/markdown/utils.ts +0 -49
- package/src/routing.ts +0 -238
- package/src/search/form.tsx +0 -127
- package/src/search/index.tsx +0 -1
- package/src/search/indexer.ts +0 -246
- package/src/search/mcp.ts +0 -61
- package/src/search/printer.tsx +0 -86
- package/src/search/providers/algolia.ts +0 -88
- package/src/search/providers/fuse.ts +0 -19
- package/src/search/providers/pagefind.ts +0 -17
- package/src/search/providers/walker.ts +0 -30
- package/src/search/results.tsx +0 -181
- package/src/search/state.ts +0 -64
- package/src/search/types.ts +0 -116
- package/src/style.ts +0 -197
- package/src/styles/main.css +0 -993
- package/src/styles/primitives.css +0 -572
- package/src/styles/resets.css +0 -47
- package/src/styles/search.css +0 -342
- package/src/styles/sidebar.css +0 -87
- package/src/styles/snippets.css +0 -132
- package/src/styles/variables.css +0 -90
- package/src/utils.ts +0 -41
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import "../routing-DNN8R6bZ.js";
|
|
2
|
+
import { c as QueryKindsType, l as ResultData } from "../types-DNSz4kuM.js";
|
|
3
|
+
import * as react_jsx_runtime82 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/search/form.d.ts
|
|
6
|
+
declare function SearchForm(): react_jsx_runtime82.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_jsx_runtime82.JSX.Element;
|
|
17
|
+
type SearchModalProps = {
|
|
18
|
+
id?: string;
|
|
19
|
+
open?: boolean;
|
|
20
|
+
};
|
|
21
|
+
declare function SearchModal({
|
|
22
|
+
id,
|
|
23
|
+
open: isOpen
|
|
24
|
+
}: SearchModalProps): react_jsx_runtime82.JSX.Element;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { SearchFilter, SearchFilterProps, SearchForm, SearchModal, SearchModalProps };
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
import { a as useLanguage } from "../docs-CopwX9a7.js";
|
|
2
|
+
import "../component-generics-D3ybuN5r.js";
|
|
3
|
+
import "../navigation-CGr5_w6z.js";
|
|
4
|
+
import "../markdown-Diyg-eof.js";
|
|
5
|
+
import "../routing-qs2YNG9o.js";
|
|
6
|
+
import { t as style_default } from "../style-BhhgPVF6.js";
|
|
7
|
+
import { t as useComponents } from "../use-components-BHEwm0mE.js";
|
|
8
|
+
import { a as useSearchContext, i as useSearch } from "../contexts-B-OYzYpz.js";
|
|
9
|
+
import "../icons-yb-Jhkmg.js";
|
|
10
|
+
import "../utils-FnJ4tyuN.js";
|
|
11
|
+
import "../md-DxiV1_vy.js";
|
|
12
|
+
import "../utils-Jo_o4DX9.js";
|
|
13
|
+
import { t as QueryKinds } from "../types-__XoFvJ_.js";
|
|
14
|
+
import { t as guideSearch } from "../pagefind-BaK1krMe.js";
|
|
15
|
+
import * as React$1 from "react";
|
|
16
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
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 /* @__PURE__ */ jsx("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) => /* @__PURE__ */ jsx("span", {
|
|
54
|
+
className: style_default.SearchBreadcrumbItem,
|
|
55
|
+
children: crumb
|
|
56
|
+
}, crumb));
|
|
57
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
58
|
+
className: style_default.SearchBreadcrumb,
|
|
59
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
60
|
+
className: style_default.Icon,
|
|
61
|
+
size: 14
|
|
62
|
+
}), Array.isArray(result.crumbs) && /* @__PURE__ */ jsx(Docs.Join, {
|
|
63
|
+
items,
|
|
64
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
65
|
+
className: style_default.SearchBreadcrumbDivider,
|
|
66
|
+
children: "›"
|
|
67
|
+
})
|
|
68
|
+
})]
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function SearchResult({ result }) {
|
|
72
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
73
|
+
className: style_default.SearchResult,
|
|
74
|
+
"data-stldocs-search-result": result.kind,
|
|
75
|
+
children: [/* @__PURE__ */ jsx(SearchResultBreadcrumb, { result }), /* @__PURE__ */ jsx(SearchResultContent, { result })]
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function GuideResult({ result }) {
|
|
79
|
+
const Docs = useComponents();
|
|
80
|
+
const Icon = QueryKindDisplay["guide"].icon;
|
|
81
|
+
const path = result.data.url.slice(1, -1).split("/").map((crumb) => /* @__PURE__ */ jsx("span", {
|
|
82
|
+
className: style_default.SearchBreadcrumbItem,
|
|
83
|
+
children: crumb
|
|
84
|
+
}, crumb));
|
|
85
|
+
const crumbs = path.length > 1 ? path : [/* @__PURE__ */ jsx("span", {
|
|
86
|
+
className: style_default.SearchBreadcrumbItem,
|
|
87
|
+
children: "Overview"
|
|
88
|
+
}, "overview")];
|
|
89
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
90
|
+
className: style_default.SearchResult,
|
|
91
|
+
"data-stldocs-search-result": "guide",
|
|
92
|
+
children: [
|
|
93
|
+
/* @__PURE__ */ jsxs("div", {
|
|
94
|
+
className: style_default.SearchBreadcrumb,
|
|
95
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
96
|
+
className: style_default.Icon,
|
|
97
|
+
size: 14
|
|
98
|
+
}), /* @__PURE__ */ jsx(Docs.Join, {
|
|
99
|
+
items: crumbs,
|
|
100
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
101
|
+
className: style_default.SearchBreadcrumbDivider,
|
|
102
|
+
children: "›"
|
|
103
|
+
})
|
|
104
|
+
})]
|
|
105
|
+
}),
|
|
106
|
+
/* @__PURE__ */ jsx("h3", {
|
|
107
|
+
className: style_default.SearchResultGuideTitle,
|
|
108
|
+
children: result.data.meta.title
|
|
109
|
+
}),
|
|
110
|
+
/* @__PURE__ */ jsx("div", {
|
|
111
|
+
className: style_default.SearchResultGuideExcerpt,
|
|
112
|
+
dangerouslySetInnerHTML: { __html: result.data.excerpt }
|
|
113
|
+
})
|
|
114
|
+
]
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
function SearchResultContent({ result }) {
|
|
118
|
+
const Docs = useComponents();
|
|
119
|
+
const language = useLanguage();
|
|
120
|
+
switch (result.kind) {
|
|
121
|
+
case "http_method": return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Docs.MethodHeader, {
|
|
122
|
+
level: "h5",
|
|
123
|
+
title: /* @__PURE__ */ jsx(Highlight, {
|
|
124
|
+
result,
|
|
125
|
+
name: result.summary ? "summary" : "title"
|
|
126
|
+
}),
|
|
127
|
+
signature: result["qualified"] && /* @__PURE__ */ jsx(Highlight, {
|
|
128
|
+
result,
|
|
129
|
+
name: "qualified"
|
|
130
|
+
}),
|
|
131
|
+
children: /* @__PURE__ */ jsx(Docs.MethodRoute, {
|
|
132
|
+
httpMethod: result.httpMethod,
|
|
133
|
+
endpoint: /* @__PURE__ */ jsx(Highlight, {
|
|
134
|
+
result,
|
|
135
|
+
name: "endpoint"
|
|
136
|
+
})
|
|
137
|
+
})
|
|
138
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
139
|
+
className: `${style_default.MethodDescription} ${style_default.Content}`,
|
|
140
|
+
children: /* @__PURE__ */ jsx(Highlight, {
|
|
141
|
+
result,
|
|
142
|
+
name: "description"
|
|
143
|
+
})
|
|
144
|
+
})] });
|
|
145
|
+
case "model": {
|
|
146
|
+
const properties = result.children?.map((child, index) => /* @__PURE__ */ jsx("span", {
|
|
147
|
+
className: style_default.TextIdentifier,
|
|
148
|
+
children: child
|
|
149
|
+
}, index)) ?? [];
|
|
150
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
151
|
+
className: style_default.Property,
|
|
152
|
+
"data-stldocs-language": language,
|
|
153
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
154
|
+
className: style_default.PropertyHeader,
|
|
155
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
156
|
+
className: style_default.PropertyName,
|
|
157
|
+
children: /* @__PURE__ */ jsx(Highlight, {
|
|
158
|
+
result,
|
|
159
|
+
name: result.title ? "title" : "name"
|
|
160
|
+
})
|
|
161
|
+
})
|
|
162
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
163
|
+
className: style_default.PropertyDeclaration,
|
|
164
|
+
children: [
|
|
165
|
+
/* @__PURE__ */ jsx(Highlight, {
|
|
166
|
+
result,
|
|
167
|
+
name: "ident"
|
|
168
|
+
}),
|
|
169
|
+
":",
|
|
170
|
+
" ",
|
|
171
|
+
/* @__PURE__ */ jsx(Docs.Join, {
|
|
172
|
+
items: properties,
|
|
173
|
+
limit: 3,
|
|
174
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
175
|
+
className: style_default.TextPunctuation,
|
|
176
|
+
children: ", "
|
|
177
|
+
})
|
|
178
|
+
})
|
|
179
|
+
]
|
|
180
|
+
})]
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
case "resource": return /* @__PURE__ */ jsxs("div", {
|
|
184
|
+
className: style_default.SearchResultResourceInfo,
|
|
185
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
186
|
+
className: style_default.SearchResultResourceTitle,
|
|
187
|
+
children: /* @__PURE__ */ jsx(Highlight, {
|
|
188
|
+
result,
|
|
189
|
+
name: "title"
|
|
190
|
+
})
|
|
191
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
192
|
+
className: style_default.SearchResultResourcePath,
|
|
193
|
+
children: /* @__PURE__ */ jsx(Highlight, {
|
|
194
|
+
result,
|
|
195
|
+
name: "QualifiedName"
|
|
196
|
+
})
|
|
197
|
+
})]
|
|
198
|
+
});
|
|
199
|
+
case "property": return /* @__PURE__ */ jsxs("div", {
|
|
200
|
+
className: style_default.Property,
|
|
201
|
+
"data-stldocs-language": language,
|
|
202
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
203
|
+
className: style_default.PropertyHeader,
|
|
204
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
205
|
+
className: style_default.PropertyName,
|
|
206
|
+
children: /* @__PURE__ */ jsx(Highlight, {
|
|
207
|
+
result,
|
|
208
|
+
name: "name"
|
|
209
|
+
})
|
|
210
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
211
|
+
className: style_default.PropertyTypeName,
|
|
212
|
+
children: /* @__PURE__ */ jsx("span", { dangerouslySetInnerHTML: { __html: result.type ?? "" } })
|
|
213
|
+
})]
|
|
214
|
+
}), result.docstring && /* @__PURE__ */ jsx("span", {
|
|
215
|
+
className: style_default.PropertyDescription,
|
|
216
|
+
children: /* @__PURE__ */ jsx(Highlight, {
|
|
217
|
+
result,
|
|
218
|
+
name: "docstring"
|
|
219
|
+
})
|
|
220
|
+
})]
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
//#endregion
|
|
226
|
+
//#region src/search/form.tsx
|
|
227
|
+
function SearchForm() {
|
|
228
|
+
const Docs = useComponents();
|
|
229
|
+
const search = useSearch();
|
|
230
|
+
const language = useLanguage();
|
|
231
|
+
const { onSelect, pageFind } = useSearchContext();
|
|
232
|
+
const [results, setResults] = React$1.useState(null);
|
|
233
|
+
const [filterKind, setFilterKind] = React$1.useState("all");
|
|
234
|
+
const [searchQuery, setSearchQuery] = React$1.useState("");
|
|
235
|
+
const inputRef = React$1.useRef(null);
|
|
236
|
+
async function performSearch() {
|
|
237
|
+
const guideLimit = filterKind === "guide" ? 25 : 5;
|
|
238
|
+
const kind = ["all", "guide"].includes(filterKind) ? void 0 : filterKind;
|
|
239
|
+
const [guideResults, apiResults] = await Promise.all([pageFind ? guideSearch(pageFind, searchQuery, guideLimit) : [], search({
|
|
240
|
+
query: searchQuery,
|
|
241
|
+
kind,
|
|
242
|
+
language
|
|
243
|
+
})]);
|
|
244
|
+
setResults({
|
|
245
|
+
items: filterKind === "guide" ? guideResults : [...guideResults, ...apiResults?.hits ?? []],
|
|
246
|
+
counts: {
|
|
247
|
+
...apiResults?.facets?.["kind"],
|
|
248
|
+
guide: guideResults.length,
|
|
249
|
+
all: apiResults?.nbHits
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
function clearInput() {
|
|
254
|
+
setSearchQuery("");
|
|
255
|
+
inputRef?.current?.focus();
|
|
256
|
+
}
|
|
257
|
+
React$1.useEffect(() => void performSearch(), [
|
|
258
|
+
searchQuery,
|
|
259
|
+
filterKind,
|
|
260
|
+
language
|
|
261
|
+
]);
|
|
262
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
263
|
+
className: style_default.SearchForm,
|
|
264
|
+
children: [
|
|
265
|
+
/* @__PURE__ */ jsx(Docs.Input, {
|
|
266
|
+
ref: inputRef,
|
|
267
|
+
autoFocus: true,
|
|
268
|
+
onChange: (ev) => setSearchQuery(ev.target.value),
|
|
269
|
+
left: /* @__PURE__ */ jsx(Search, {
|
|
270
|
+
size: 16,
|
|
271
|
+
className: style_default.Icon
|
|
272
|
+
}),
|
|
273
|
+
right: searchQuery && /* @__PURE__ */ jsx(X, {
|
|
274
|
+
cursor: "pointer",
|
|
275
|
+
onClick: () => clearInput(),
|
|
276
|
+
size: 16,
|
|
277
|
+
className: style_default.Icon
|
|
278
|
+
}),
|
|
279
|
+
value: searchQuery,
|
|
280
|
+
placeholder: "Search"
|
|
281
|
+
}),
|
|
282
|
+
/* @__PURE__ */ jsx(SearchFilter, {
|
|
283
|
+
results,
|
|
284
|
+
filterKind,
|
|
285
|
+
onChange: (filterKind$1) => setFilterKind(filterKind$1)
|
|
286
|
+
}),
|
|
287
|
+
/* @__PURE__ */ jsx(Docs.ListView, {
|
|
288
|
+
items: results?.items ?? [],
|
|
289
|
+
itemDelegate: (item) => "kind" in item ? /* @__PURE__ */ jsx(SearchResult, { result: item }) : /* @__PURE__ */ jsx(GuideResult, { result: item }),
|
|
290
|
+
onSelectListItem: (item) => onSelect?.(item["data"]?.["url"] ?? item["stainlessPath"])
|
|
291
|
+
})
|
|
292
|
+
]
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
function SearchFilter({ results, filterKind, onChange }) {
|
|
296
|
+
const Docs = useComponents();
|
|
297
|
+
const { pageFind } = useSearchContext();
|
|
298
|
+
const toggles = pageFind ? QueryKinds : QueryKinds.slice(0, -1);
|
|
299
|
+
return /* @__PURE__ */ jsx("div", {
|
|
300
|
+
className: style_default.SearchFilter,
|
|
301
|
+
children: toggles.map((kind, index) => /* @__PURE__ */ jsxs(Docs.ToggleButton, {
|
|
302
|
+
selected: filterKind === kind,
|
|
303
|
+
onClick: () => onChange?.(kind),
|
|
304
|
+
children: [
|
|
305
|
+
React$1.createElement(QueryKindDisplay[kind].icon, {
|
|
306
|
+
size: 16,
|
|
307
|
+
className: style_default.Icon
|
|
308
|
+
}),
|
|
309
|
+
/* @__PURE__ */ jsx("span", {
|
|
310
|
+
className: style_default.SearchFilterLabel,
|
|
311
|
+
children: QueryKindDisplay[kind].name
|
|
312
|
+
}),
|
|
313
|
+
/* @__PURE__ */ jsx("span", {
|
|
314
|
+
className: style_default.SearchFilterCount,
|
|
315
|
+
children: results?.counts?.[kind] ?? 0
|
|
316
|
+
})
|
|
317
|
+
]
|
|
318
|
+
}, index))
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
function SearchModal({ id, open: isOpen }) {
|
|
322
|
+
const [open, setOpen] = React$1.useState(isOpen ?? false);
|
|
323
|
+
return /* @__PURE__ */ jsx("div", {
|
|
324
|
+
id,
|
|
325
|
+
onToggle: (ev) => setOpen(ev.newState === "open"),
|
|
326
|
+
className: style_default.SearchModal,
|
|
327
|
+
popover: "auto",
|
|
328
|
+
"data-stldocs-modal-open": open,
|
|
329
|
+
children: open && /* @__PURE__ */ jsx(SearchForm, {})
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
//#endregion
|
|
334
|
+
export { SearchFilter, SearchForm, SearchModal };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import "../../routing-DNN8R6bZ.js";
|
|
2
|
+
import { d as ResultType, h as SearchSettings, m as SearchParams } from "../../types-DNSz4kuM.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,15 @@
|
|
|
1
|
+
import "../../docs-CopwX9a7.js";
|
|
2
|
+
import "../../component-generics-D3ybuN5r.js";
|
|
3
|
+
import "../../navigation-CGr5_w6z.js";
|
|
4
|
+
import "../../markdown-Diyg-eof.js";
|
|
5
|
+
import "../../routing-qs2YNG9o.js";
|
|
6
|
+
import "../../style-BhhgPVF6.js";
|
|
7
|
+
import "../../use-components-BHEwm0mE.js";
|
|
8
|
+
import { c as search, o as buildChatIndex, s as buildIndex } from "../../contexts-B-OYzYpz.js";
|
|
9
|
+
import "../../icons-yb-Jhkmg.js";
|
|
10
|
+
import "../../utils-FnJ4tyuN.js";
|
|
11
|
+
import "../../md-DxiV1_vy.js";
|
|
12
|
+
import "../../utils-Jo_o4DX9.js";
|
|
13
|
+
import "../../types-__XoFvJ_.js";
|
|
14
|
+
|
|
15
|
+
export { buildChatIndex, buildIndex, search };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { t as DocsLanguage } from "../../routing-DNN8R6bZ.js";
|
|
2
|
+
import { n as IndexEntry } from "../../types-DNSz4kuM.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,30 @@
|
|
|
1
|
+
import "../../docs-CopwX9a7.js";
|
|
2
|
+
import "../../component-generics-D3ybuN5r.js";
|
|
3
|
+
import "../../navigation-CGr5_w6z.js";
|
|
4
|
+
import "../../markdown-Diyg-eof.js";
|
|
5
|
+
import "../../routing-qs2YNG9o.js";
|
|
6
|
+
import "../../style-BhhgPVF6.js";
|
|
7
|
+
import "../../use-components-BHEwm0mE.js";
|
|
8
|
+
import { l as generateIndex } from "../../contexts-B-OYzYpz.js";
|
|
9
|
+
import "../../icons-yb-Jhkmg.js";
|
|
10
|
+
import "../../utils-FnJ4tyuN.js";
|
|
11
|
+
import "../../md-DxiV1_vy.js";
|
|
12
|
+
import "../../utils-Jo_o4DX9.js";
|
|
13
|
+
import { n as SearchableAttributes } from "../../types-__XoFvJ_.js";
|
|
14
|
+
import Fuse from "fuse.js";
|
|
15
|
+
|
|
16
|
+
//#region src/search/providers/fuse.ts
|
|
17
|
+
function buildIndex(spec, language) {
|
|
18
|
+
const idx = Array.from(generateIndex(spec, void 0, false));
|
|
19
|
+
const content = language ? idx.filter((entry) => entry.language === language) : idx;
|
|
20
|
+
return {
|
|
21
|
+
content,
|
|
22
|
+
index: Fuse.createIndex([...SearchableAttributes], content)
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function search({ content, index }, query, limit = 100) {
|
|
26
|
+
return new Fuse(content, { keys: [...SearchableAttributes] }, index).search(query).slice(0, limit);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
export { buildIndex, search };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import "../../routing-DNN8R6bZ.js";
|
|
2
|
+
import { t as GuideResultType } from "../../types-DNSz4kuM.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-DNN8R6bZ.js";
|
|
2
|
+
import { n as IndexEntry } from "../../types-DNSz4kuM.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,34 @@
|
|
|
1
|
+
import "../../docs-CopwX9a7.js";
|
|
2
|
+
import "../../component-generics-D3ybuN5r.js";
|
|
3
|
+
import "../../navigation-CGr5_w6z.js";
|
|
4
|
+
import "../../markdown-Diyg-eof.js";
|
|
5
|
+
import "../../routing-qs2YNG9o.js";
|
|
6
|
+
import "../../style-BhhgPVF6.js";
|
|
7
|
+
import "../../use-components-BHEwm0mE.js";
|
|
8
|
+
import { l as generateIndex } from "../../contexts-B-OYzYpz.js";
|
|
9
|
+
import "../../icons-yb-Jhkmg.js";
|
|
10
|
+
import "../../utils-FnJ4tyuN.js";
|
|
11
|
+
import "../../md-DxiV1_vy.js";
|
|
12
|
+
import "../../utils-Jo_o4DX9.js";
|
|
13
|
+
import { n as SearchableAttributes } from "../../types-__XoFvJ_.js";
|
|
14
|
+
|
|
15
|
+
//#region src/search/providers/walker.ts
|
|
16
|
+
function buildIndex(spec) {
|
|
17
|
+
return generateIndex(spec, void 0, false);
|
|
18
|
+
}
|
|
19
|
+
function* findEntryInIndex(index, language, query) {
|
|
20
|
+
for (const entry of index) {
|
|
21
|
+
if (entry.language !== language) continue;
|
|
22
|
+
for (const attr of SearchableAttributes) {
|
|
23
|
+
const attr_ = attr in entry ? attr : null;
|
|
24
|
+
if (attr_ && entry[attr_] && typeof entry[attr_] === "string" && entry[attr_].includes(query)) yield entry;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function search(index, language, query, limit = 100) {
|
|
29
|
+
const results = findEntryInIndex(index, language, query);
|
|
30
|
+
return Array.from(results).sort((a, b) => a.priority - b.priority).slice(0, limit);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
export { buildIndex, search };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import "../routing-DNN8R6bZ.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-DNSz4kuM.js";
|
|
3
|
+
export { GuideResultType, IndexEntry, IndexMethod, IndexModel, IndexProperty, IndexResource, QueryKinds, QueryKindsType, ResultData, ResultRecordType, ResultType, RoutableJsonNode, SearchAttributeNames, SearchParams, SearchSettings, SearchableAttributes, SearchableAttributesChat };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { d as ResultType, h as SearchSettings, m as SearchParams } from "./types-DNSz4kuM.js";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import * as react_jsx_runtime53 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/contexts/search.d.ts
|
|
6
|
+
type SearchContextType = {
|
|
7
|
+
settings: SearchSettings;
|
|
8
|
+
onSelect?: (stainlessPath: string) => void;
|
|
9
|
+
pageFind?: string;
|
|
10
|
+
};
|
|
11
|
+
declare const useSearchContext: () => SearchContextType;
|
|
12
|
+
declare function useSearch(): (params: SearchParams) => Promise<ResultType | undefined>;
|
|
13
|
+
type SearchProviderProps = SearchContextType & {
|
|
14
|
+
children: React$1.ReactNode;
|
|
15
|
+
};
|
|
16
|
+
declare function SearchProvider({
|
|
17
|
+
children,
|
|
18
|
+
...props
|
|
19
|
+
}: SearchProviderProps): react_jsx_runtime53.JSX.Element;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { useSearchContext as a, useSearch as i, SearchProvider as n, SearchProviderProps as r, SearchContextType as t };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
import * as react_jsx_runtime58 from "react/jsx-runtime";
|
|
3
|
+
import * as SDKJSON from "@stainless/sdk-json";
|
|
4
|
+
|
|
5
|
+
//#region src/components/sidebar.d.ts
|
|
6
|
+
type SidebarExpanderProps = {
|
|
7
|
+
open?: boolean;
|
|
8
|
+
summary: React$1.ReactNode;
|
|
9
|
+
children?: React$1.ReactNode;
|
|
10
|
+
};
|
|
11
|
+
declare function SidebarExpander({
|
|
12
|
+
open,
|
|
13
|
+
summary,
|
|
14
|
+
children
|
|
15
|
+
}: SidebarExpanderProps): react_jsx_runtime58.JSX.Element;
|
|
16
|
+
type SidebarMethodProps = {
|
|
17
|
+
method: SDKJSON.Method;
|
|
18
|
+
};
|
|
19
|
+
declare function SidebarMethod({
|
|
20
|
+
method
|
|
21
|
+
}: SidebarMethodProps): react_jsx_runtime58.JSX.Element;
|
|
22
|
+
type SidebarResourceProps = {
|
|
23
|
+
resource: SDKJSON.Resource;
|
|
24
|
+
};
|
|
25
|
+
declare function SidebarResource({
|
|
26
|
+
resource
|
|
27
|
+
}: SidebarResourceProps): react_jsx_runtime58.JSX.Element;
|
|
28
|
+
type SidebarProps = {
|
|
29
|
+
resources: SDKJSON.Resource[];
|
|
30
|
+
selectedPath?: string;
|
|
31
|
+
};
|
|
32
|
+
declare function Sidebar({
|
|
33
|
+
resources
|
|
34
|
+
}: SidebarProps): react_jsx_runtime58.JSX.Element;
|
|
35
|
+
//#endregion
|
|
36
|
+
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,46 @@
|
|
|
1
|
+
import { C as TransformRequestSnippetFn } from "./sdk-DDWWoPPD.js";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import * as react_jsx_runtime20 from "react/jsx-runtime";
|
|
4
|
+
import * as SDKJSON from "@stainless/sdk-json";
|
|
5
|
+
|
|
6
|
+
//#region src/components/snippets.d.ts
|
|
7
|
+
type SnippetCodeProps = {
|
|
8
|
+
content: string;
|
|
9
|
+
signature?: string;
|
|
10
|
+
language?: string;
|
|
11
|
+
};
|
|
12
|
+
declare function SnippetCode({
|
|
13
|
+
content,
|
|
14
|
+
language
|
|
15
|
+
}: SnippetCodeProps): react_jsx_runtime20.JSX.Element;
|
|
16
|
+
type SnippetProps = {
|
|
17
|
+
method: SDKJSON.Method;
|
|
18
|
+
requestTitle?: React$1.ReactNode;
|
|
19
|
+
transformRequestSnippet?: TransformRequestSnippetFn;
|
|
20
|
+
};
|
|
21
|
+
type SnippetContainerProps = {
|
|
22
|
+
children: React$1.ReactNode;
|
|
23
|
+
signature?: string;
|
|
24
|
+
};
|
|
25
|
+
declare function SnippetContainer({
|
|
26
|
+
children
|
|
27
|
+
}: SnippetContainerProps): react_jsx_runtime20.JSX.Element;
|
|
28
|
+
type SnippetRequestContainerProps = {
|
|
29
|
+
children?: React$1.ReactNode;
|
|
30
|
+
signature?: string;
|
|
31
|
+
};
|
|
32
|
+
declare function SnippetRequestContainer({
|
|
33
|
+
children
|
|
34
|
+
}: SnippetRequestContainerProps): react_jsx_runtime20.JSX.Element;
|
|
35
|
+
declare function Snippet({
|
|
36
|
+
requestTitle,
|
|
37
|
+
method,
|
|
38
|
+
transformRequestSnippet
|
|
39
|
+
}: SnippetProps): react_jsx_runtime20.JSX.Element | null;
|
|
40
|
+
declare function SnippetResponse({
|
|
41
|
+
responses
|
|
42
|
+
}: {
|
|
43
|
+
responses: SDKJSON.Method['exampleResponses'];
|
|
44
|
+
}): react_jsx_runtime20.JSX.Element | null;
|
|
45
|
+
//#endregion
|
|
46
|
+
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 };
|