@stainless-api/docs-ui 0.1.0-beta.10 → 0.1.0-beta.11
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-Z-hEqjcp.d.ts +19 -0
- package/dist/chunk-Bp6m_JJh.js +13 -0
- package/dist/component-generics-DzI21jRn.js +35 -0
- package/dist/component-generics-q5Dqiu2D.d.ts +30 -0
- package/dist/components/breadcrumbs.d.ts +2 -11
- package/dist/components/breadcrumbs.js +16 -52
- package/dist/components/chat.d.ts +13 -5
- package/dist/components/chat.js +138 -74
- package/dist/components/dropdown.d.ts +2 -17
- package/dist/components/dropdown.js +4 -18
- package/dist/components/icons.d.ts +50 -27
- package/dist/components/icons.js +3 -34
- package/dist/components/index.d.ts +12 -9
- package/dist/components/index.js +16 -10
- package/dist/components/method.d.ts +2 -41
- package/dist/components/method.js +16 -44
- package/dist/components/overview.d.ts +2 -21
- package/dist/components/overview.js +16 -49
- package/dist/components/primitives.d.ts +2 -60
- package/dist/components/primitives.js +16 -117
- package/dist/components/properties.d.ts +2 -24
- package/dist/components/properties.js +16 -24
- package/dist/components/scripts/dropdown.d.ts +11 -4
- package/dist/components/scripts/dropdown.js +49 -63
- package/dist/components/sdk.d.ts +3 -78
- package/dist/components/sdk.js +16 -153
- package/dist/components/sidebar.d.ts +2 -22
- package/dist/components/sidebar.js +16 -30
- package/dist/components/snippets.d.ts +4 -28
- package/dist/components/snippets.js +16 -76
- package/dist/contexts/component-generics.d.ts +2 -25
- package/dist/contexts/component-generics.js +3 -24
- package/dist/contexts/component-types.d.ts +18 -4
- package/dist/contexts/component-types.js +1 -2
- package/dist/contexts/component.d.ts +31 -14
- package/dist/contexts/component.js +16 -14
- package/dist/contexts/docs.d.ts +2 -34
- package/dist/contexts/docs.js +3 -43
- package/dist/contexts/index.d.ts +20 -7
- package/dist/contexts/index.js +16 -15
- package/dist/contexts/markdown.d.ts +2 -13
- package/dist/contexts/markdown.js +4 -29
- package/dist/contexts/navigation.d.ts +3 -19
- package/dist/contexts/navigation.js +3 -14
- package/dist/contexts/search.d.ts +4 -13
- package/dist/contexts/search.js +16 -15
- package/dist/contexts/use-components.d.ts +16 -1
- package/dist/contexts/use-components.js +4 -3
- package/dist/contexts-DRxRO-xO.js +3747 -0
- package/dist/docs-Dh8kE1va.js +50 -0
- package/dist/docs-EUy-wfbA.d.ts +43 -0
- package/dist/dropdown-B7VyGMOw.d.ts +43 -0
- package/dist/dropdown-DtgAi6lb.js +62 -0
- package/dist/icons-DdKM-01E.js +753 -0
- package/dist/index-AicgPYKB.d.ts +239 -0
- package/dist/index-BhwLhiWk.d.ts +14 -0
- package/dist/index-YnpUtXLB.d.ts +16 -0
- package/dist/index.d.ts +22 -6
- package/dist/index.js +16 -7
- package/dist/languages/go.d.ts +13 -21
- package/dist/languages/go.js +16 -116
- package/dist/languages/http.d.ts +13 -25
- package/dist/languages/http.js +16 -130
- package/dist/languages/index.d.ts +13 -37
- package/dist/languages/index.js +16 -10
- package/dist/languages/java.d.ts +13 -23
- package/dist/languages/java.js +16 -120
- package/dist/languages/python.d.ts +13 -22
- package/dist/languages/python.js +16 -104
- package/dist/languages/ruby.d.ts +13 -22
- package/dist/languages/ruby.js +16 -125
- package/dist/languages/typescript.d.ts +13 -22
- package/dist/languages/typescript.js +16 -134
- package/dist/markdown/index.d.ts +11 -6
- package/dist/markdown/index.js +16 -80
- package/dist/markdown/md.d.ts +15 -11
- package/dist/markdown/md.js +3 -34
- package/dist/markdown/utils.d.ts +4 -17
- package/dist/markdown/utils.js +3 -30
- package/dist/markdown-BXfX1D7C.js +42 -0
- package/dist/markdown-nFyAEX_K.d.ts +22 -0
- package/dist/md-Dg8aOyMA.js +41 -0
- package/dist/method-DpsVuzZW.d.ts +71 -0
- package/dist/navigation-aoYZ_tl4.js +24 -0
- package/dist/navigation-nyXBY-75.d.ts +29 -0
- package/dist/overview-C8e-6jGr.d.ts +38 -0
- package/dist/pagefind-ChrPfuVv.js +15 -0
- package/dist/primitives-DWz23_Ub.d.ts +99 -0
- package/dist/properties-CF71V58d.d.ts +46 -0
- package/dist/routing-DQjbRxdJ.js +189 -0
- package/dist/routing-qc0V00-j.d.ts +51 -0
- package/dist/routing.d.ts +2 -44
- package/dist/routing.js +3 -169
- package/dist/sdk-Zg3Rggk3.d.ts +118 -0
- package/dist/search/index.d.ts +26 -1
- package/dist/search/index.js +332 -2
- package/dist/search/providers/algolia.d.ts +22 -7
- package/dist/search/providers/algolia.js +16 -64
- package/dist/search/providers/fuse.d.ts +16 -9
- package/dist/search/providers/fuse.js +29 -12
- package/dist/search/providers/pagefind.d.ts +7 -2
- package/dist/search/providers/pagefind.js +3 -19
- package/dist/search/providers/walker.d.ts +8 -5
- package/dist/search/providers/walker.js +28 -19
- package/dist/search/types.d.ts +3 -79
- package/dist/search/types.js +3 -24
- package/dist/search-B6loAGmB.d.ts +21 -0
- package/dist/sidebar-C8KirYjg.d.ts +35 -0
- package/dist/snippets-EUzM4fRO.d.ts +45 -0
- package/dist/style-pN9hCoec.d.ts +181 -0
- package/dist/style-rYbbxIR_.js +182 -0
- package/dist/style.d.ts +2 -179
- package/dist/style.js +3 -179
- package/dist/styles/main.css +740 -746
- package/dist/styles/main.js +1 -0
- package/dist/styles/primitives.css +436 -428
- package/dist/styles/primitives.js +1 -0
- package/dist/styles/resets.css +34 -41
- package/dist/styles/resets.js +1 -0
- package/dist/styles/search.css +248 -248
- package/dist/styles/search.js +1 -0
- package/dist/styles/sidebar.css +59 -60
- package/dist/styles/sidebar.js +1 -0
- package/dist/styles/snippets.css +87 -88
- package/dist/styles/snippets.js +1 -0
- package/dist/styles/variables.css +86 -89
- package/dist/styles/variables.js +1 -0
- package/dist/types-CTBDtD34.d.ts +82 -0
- package/dist/types-DFN4M1Sp.js +34 -0
- package/dist/use-components-D9E85p5x.js +7 -0
- package/dist/utils-BHwvUDKn.js +30 -0
- package/dist/utils-CJfFBNgT.js +32 -0
- package/dist/utils-DQhEbvUC.d.ts +20 -0
- package/dist/utils-nDazhti8.d.ts +11 -0
- package/dist/utils.d.ts +2 -7
- package/dist/utils.js +4 -27
- package/package.json +2 -2
- package/dist/components/breadcrumbs.js.map +0 -1
- package/dist/components/chat.js.map +0 -1
- package/dist/components/dropdown.js.map +0 -1
- package/dist/components/icons.js.map +0 -1
- package/dist/components/index.js.map +0 -1
- package/dist/components/method.js.map +0 -1
- package/dist/components/overview.js.map +0 -1
- package/dist/components/primitives.js.map +0 -1
- package/dist/components/properties.js.map +0 -1
- package/dist/components/scripts/dropdown.js.map +0 -1
- package/dist/components/sdk.js.map +0 -1
- package/dist/components/sidebar.js.map +0 -1
- package/dist/components/snippets.js.map +0 -1
- package/dist/contexts/component-generics.js.map +0 -1
- package/dist/contexts/component-types.js.map +0 -1
- package/dist/contexts/component.js.map +0 -1
- package/dist/contexts/docs.js.map +0 -1
- package/dist/contexts/index.js.map +0 -1
- package/dist/contexts/markdown.js.map +0 -1
- package/dist/contexts/navigation.js.map +0 -1
- package/dist/contexts/search.js.map +0 -1
- package/dist/contexts/use-components.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/languages/go.js.map +0 -1
- package/dist/languages/http.js.map +0 -1
- package/dist/languages/index.js.map +0 -1
- package/dist/languages/java.js.map +0 -1
- package/dist/languages/python.js.map +0 -1
- package/dist/languages/ruby.js.map +0 -1
- package/dist/languages/typescript.js.map +0 -1
- package/dist/markdown/index.js.map +0 -1
- package/dist/markdown/md.js.map +0 -1
- package/dist/markdown/utils.js.map +0 -1
- package/dist/mcp.js +0 -16105
- package/dist/routing.js.map +0 -1
- package/dist/search/form.d.ts +0 -13
- package/dist/search/form.js +0 -55
- package/dist/search/form.js.map +0 -1
- package/dist/search/index.js.map +0 -1
- package/dist/search/indexer.d.ts +0 -31
- package/dist/search/indexer.js +0 -212
- package/dist/search/indexer.js.map +0 -1
- package/dist/search/mcp.d.ts +0 -8
- package/dist/search/mcp.js +0 -43
- package/dist/search/mcp.js.map +0 -1
- package/dist/search/printer.d.ts +0 -6
- package/dist/search/printer.js +0 -43
- package/dist/search/printer.js.map +0 -1
- package/dist/search/providers/algolia.js.map +0 -1
- package/dist/search/providers/fuse.js.map +0 -1
- package/dist/search/providers/pagefind.js.map +0 -1
- package/dist/search/providers/walker.js.map +0 -1
- package/dist/search/results.d.ts +0 -21
- package/dist/search/results.js +0 -58
- package/dist/search/results.js.map +0 -1
- package/dist/search/state.d.ts +0 -29
- package/dist/search/state.js +0 -38
- package/dist/search/state.js.map +0 -1
- package/dist/search/types.js.map +0 -1
- package/dist/style.js.map +0 -1
- package/dist/types/sdkjson.d.ts +0 -1
- package/dist/types/sdkjson.js +0 -2
- package/dist/types/sdkjson.js.map +0 -1
- package/dist/types/stainless-alias/lib/json-spec-v2/GoAST.d.ts +0 -120
- package/dist/types/stainless-alias/lib/json-spec-v2/GoAST.js +0 -2
- package/dist/types/stainless-alias/lib/json-spec-v2/GoAST.js.map +0 -1
- package/dist/types/stainless-alias/lib/json-spec-v2/HttpAST.d.ts +0 -100
- package/dist/types/stainless-alias/lib/json-spec-v2/HttpAST.js +0 -3
- package/dist/types/stainless-alias/lib/json-spec-v2/HttpAST.js.map +0 -1
- package/dist/types/stainless-alias/lib/json-spec-v2/JavaAST.d.ts +0 -87
- package/dist/types/stainless-alias/lib/json-spec-v2/JavaAST.js +0 -2
- package/dist/types/stainless-alias/lib/json-spec-v2/JavaAST.js.map +0 -1
- package/dist/types/stainless-alias/lib/json-spec-v2/PythonAST.d.ts +0 -110
- package/dist/types/stainless-alias/lib/json-spec-v2/PythonAST.js +0 -3
- package/dist/types/stainless-alias/lib/json-spec-v2/PythonAST.js.map +0 -1
- package/dist/types/stainless-alias/lib/json-spec-v2/RubyAST.d.ts +0 -122
- package/dist/types/stainless-alias/lib/json-spec-v2/RubyAST.js +0 -2
- package/dist/types/stainless-alias/lib/json-spec-v2/RubyAST.js.map +0 -1
- package/dist/types/stainless-alias/lib/json-spec-v2/TSAST.d.ts +0 -146
- package/dist/types/stainless-alias/lib/json-spec-v2/TSAST.js +0 -3
- package/dist/types/stainless-alias/lib/json-spec-v2/TSAST.js.map +0 -1
- package/dist/types/stainless-alias/lib/json-spec-v2/TerraformAST.d.ts +0 -89
- package/dist/types/stainless-alias/lib/json-spec-v2/TerraformAST.js +0 -3
- package/dist/types/stainless-alias/lib/json-spec-v2/TerraformAST.js.map +0 -1
- package/dist/types/stainless-alias/lib/json-spec-v2/types.d.ts +0 -190
- package/dist/types/stainless-alias/lib/json-spec-v2/types.js +0 -105
- package/dist/types/stainless-alias/lib/json-spec-v2/types.js.map +0 -1
- package/dist/utils.js.map +0 -1
package/dist/routing.js
CHANGED
|
@@ -1,169 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
'python',
|
|
5
|
-
'go',
|
|
6
|
-
'typescript',
|
|
7
|
-
'terraform',
|
|
8
|
-
'ruby',
|
|
9
|
-
'java',
|
|
10
|
-
'kotlin',
|
|
11
|
-
];
|
|
12
|
-
export const SupportedLanguageSyntaxes = [
|
|
13
|
-
'http',
|
|
14
|
-
'javascript',
|
|
15
|
-
'python',
|
|
16
|
-
'go',
|
|
17
|
-
'typescript',
|
|
18
|
-
'terraform',
|
|
19
|
-
'ruby',
|
|
20
|
-
'java',
|
|
21
|
-
'kotlin',
|
|
22
|
-
];
|
|
23
|
-
export const LanguageNames = {
|
|
24
|
-
http: 'HTTP',
|
|
25
|
-
node: 'TypeScript',
|
|
26
|
-
typescript: 'TypeScript',
|
|
27
|
-
python: 'Python',
|
|
28
|
-
go: 'Go',
|
|
29
|
-
ruby: 'Ruby',
|
|
30
|
-
java: 'Java',
|
|
31
|
-
kotlin: 'Kotlin',
|
|
32
|
-
terraform: 'Terraform',
|
|
33
|
-
};
|
|
34
|
-
export function getLanguageSnippet(language) {
|
|
35
|
-
return language === 'http' ? 'http.curl' : `${language}.default`;
|
|
36
|
-
}
|
|
37
|
-
export function isSupportedLanguage(language) {
|
|
38
|
-
return Languages.includes(language);
|
|
39
|
-
}
|
|
40
|
-
const DefaultLanguage = 'http';
|
|
41
|
-
const StainlessPathPattern = /(\(resource\) (?<resource>[^\s]+))( > (\(method\) (?<method>[^\s]+)|\(model\) (?<model>[^\s]+))?)?/;
|
|
42
|
-
export function parseStainlessPath(stainlessPath) {
|
|
43
|
-
const match = stainlessPath.match(StainlessPathPattern);
|
|
44
|
-
if (!match)
|
|
45
|
-
return null;
|
|
46
|
-
return {
|
|
47
|
-
resource: match.groups.resource.split('.'),
|
|
48
|
-
method: match.groups.method ?? null,
|
|
49
|
-
model: match.groups.model ?? null,
|
|
50
|
-
routable: match.groups.model ? match[1] : match[0],
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
export function trimStainlessPath(stainlessPath) {
|
|
54
|
-
return stainlessPath.replace(/ > \([^\s]+\)$/, '');
|
|
55
|
-
}
|
|
56
|
-
export function getResource(stainlessPath) {
|
|
57
|
-
const parsed = parseStainlessPath(stainlessPath);
|
|
58
|
-
return parsed?.resource[0];
|
|
59
|
-
}
|
|
60
|
-
export function parseRoute(basePath, route) {
|
|
61
|
-
if (!route.startsWith(basePath))
|
|
62
|
-
return { stainlessPath: '', language: DefaultLanguage };
|
|
63
|
-
if (basePath && route.startsWith(basePath))
|
|
64
|
-
route = route.slice(basePath.length);
|
|
65
|
-
let stainlessPath = '';
|
|
66
|
-
let elements = route.slice(1).split('/');
|
|
67
|
-
let language = DefaultLanguage;
|
|
68
|
-
if (elements[0] && Languages.includes(elements[0])) {
|
|
69
|
-
language = elements[0];
|
|
70
|
-
elements = elements.slice(1);
|
|
71
|
-
}
|
|
72
|
-
while (elements.length > 0) {
|
|
73
|
-
const element = elements.shift();
|
|
74
|
-
switch (element) {
|
|
75
|
-
case 'resources':
|
|
76
|
-
stainlessPath += `(resource) ${elements.shift()}`;
|
|
77
|
-
break;
|
|
78
|
-
case 'subresources':
|
|
79
|
-
stainlessPath += `.${elements.shift()}`;
|
|
80
|
-
break;
|
|
81
|
-
case 'methods':
|
|
82
|
-
stainlessPath += ` > (method) ${elements.shift()}`;
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return { stainlessPath, language };
|
|
87
|
-
}
|
|
88
|
-
export function generateRoute(basePath, language, stainlessPath) {
|
|
89
|
-
const parsedPath = parseStainlessPath(stainlessPath);
|
|
90
|
-
if (!parsedPath)
|
|
91
|
-
return null;
|
|
92
|
-
const path = [basePath.endsWith('/') ? basePath.slice(0, -1) : basePath];
|
|
93
|
-
if (language && language !== DefaultLanguage)
|
|
94
|
-
path.push(language);
|
|
95
|
-
const resources = parsedPath.resource.flatMap((name, index) => [
|
|
96
|
-
index > 0 ? 'subresources' : 'resources',
|
|
97
|
-
name,
|
|
98
|
-
]);
|
|
99
|
-
// Ensure model links always go to top-level resource page
|
|
100
|
-
const resourcePath = parsedPath.model ? resources.slice(0, 2) : resources;
|
|
101
|
-
path.push(...resourcePath);
|
|
102
|
-
if (parsedPath.method)
|
|
103
|
-
path.push('methods', parsedPath.method);
|
|
104
|
-
return stainlessPath.length > parsedPath.routable.length
|
|
105
|
-
? `${path.join('/')}#${encodeURIComponent(stainlessPath)}`
|
|
106
|
-
: path.join('/');
|
|
107
|
-
}
|
|
108
|
-
function* walkResource(resource, path, includeModels) {
|
|
109
|
-
yield { data: resource, path };
|
|
110
|
-
for (const data of Object.values(resource.methods)) {
|
|
111
|
-
yield { data, path: [...path, 'methods', data.name] };
|
|
112
|
-
}
|
|
113
|
-
if (includeModels)
|
|
114
|
-
for (const data of Object.values(resource.models)) {
|
|
115
|
-
yield { data, path: [...path, 'models', data.name] };
|
|
116
|
-
}
|
|
117
|
-
for (const data of Object.values(resource.subresources ?? {})) {
|
|
118
|
-
yield* walkResource(data, [...path, 'subresources', data.name]);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
export function* walkTree(spec, includeModels) {
|
|
122
|
-
for (const data of Object.values(spec.resources)) {
|
|
123
|
-
yield* walkResource(data, ['resources', data.name], includeModels);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
export function generateRouteList({ spec, languages, excludeLanguages = [], }) {
|
|
127
|
-
const entries = Array.from(walkTree(spec));
|
|
128
|
-
const langs = languages ?? spec.docs?.languages ?? ['http'];
|
|
129
|
-
return langs
|
|
130
|
-
.filter((lang) => Languages.includes(lang) && lang !== 'terraform')
|
|
131
|
-
.filter((lang) => !excludeLanguages?.includes(lang))
|
|
132
|
-
.flatMap((language) => entries.map(({ path, data: { title, kind, stainlessPath } }) => ({
|
|
133
|
-
title,
|
|
134
|
-
kind,
|
|
135
|
-
language,
|
|
136
|
-
stainlessPath,
|
|
137
|
-
slug: (language === 'http' ? path : [language, ...path]).join('/'),
|
|
138
|
-
})));
|
|
139
|
-
}
|
|
140
|
-
export function findNavigationPath(items, target) {
|
|
141
|
-
for (const item of Object.values(items)) {
|
|
142
|
-
if (item.stainlessPath === target)
|
|
143
|
-
return [item.stainlessPath];
|
|
144
|
-
if (item.kind === 'http_method')
|
|
145
|
-
continue;
|
|
146
|
-
const path = findNavigationPath([...Object.values(item.methods ?? {}), ...Object.values(item.subresources ?? {})], target);
|
|
147
|
-
if (path)
|
|
148
|
-
return [item.stainlessPath, ...path];
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
export function expandToElement(el) {
|
|
152
|
-
while (el) {
|
|
153
|
-
if (el.tagName === 'DETAILS')
|
|
154
|
-
el['open'] = true;
|
|
155
|
-
el = el.parentElement;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
export function scrollToPath(stainlessPath) {
|
|
159
|
-
const el = document.getElementById(stainlessPath);
|
|
160
|
-
if (el) {
|
|
161
|
-
expandToElement(el);
|
|
162
|
-
el.scrollIntoView({ behavior: 'smooth' });
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
export function updateHistory(basePath, language, stainlessPath) {
|
|
166
|
-
const path = generateRoute(basePath, language, stainlessPath);
|
|
167
|
-
window.history.pushState({ stainlessPath, language }, '', path);
|
|
168
|
-
}
|
|
169
|
-
//# sourceMappingURL=routing.js.map
|
|
1
|
+
import { _ as walkTree, a as findNavigationPath, c as getLanguageSnippet, d as parseRoute, f as parseStainlessPath, g as updateHistory, h as trimStainlessPath, i as expandToElement, l as getResource, m as scrollToPath, n as Languages, o as generateRoute, r as SupportedLanguageSyntaxes, s as generateRouteList, t as LanguageNames, u as isSupportedLanguage } from "./routing-DQjbRxdJ.js";
|
|
2
|
+
|
|
3
|
+
export { LanguageNames, Languages, SupportedLanguageSyntaxes, expandToElement, findNavigationPath, generateRoute, generateRouteList, getLanguageSnippet, getResource, isSupportedLanguage, parseRoute, parseStainlessPath, scrollToPath, trimStainlessPath, updateHistory, walkTree };
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { t as DocsLanguage } from "./routing-qc0V00-j.js";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
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_jsx_runtime0.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_jsx_runtime0.JSX.Element | null;
|
|
47
|
+
type SDKConstraintsProps = {
|
|
48
|
+
constraints?: Record<string, any>;
|
|
49
|
+
};
|
|
50
|
+
declare function SDKConstraints({
|
|
51
|
+
constraints
|
|
52
|
+
}: SDKConstraintsProps): react_jsx_runtime0.JSX.Element | undefined;
|
|
53
|
+
type SDKIconProps = {
|
|
54
|
+
language: SDKJSON.SnippetLanguage;
|
|
55
|
+
size?: number;
|
|
56
|
+
};
|
|
57
|
+
declare function SDKIcon({
|
|
58
|
+
language
|
|
59
|
+
}: SDKIconProps): react_jsx_runtime0.JSX.Element | null;
|
|
60
|
+
type SDKRequestTitleProps = {
|
|
61
|
+
snippetLanguage: SDKJSON.SnippetLanguage;
|
|
62
|
+
};
|
|
63
|
+
declare function SDKRequestTitle({
|
|
64
|
+
snippetLanguage
|
|
65
|
+
}: SDKRequestTitleProps): react_jsx_runtime0.JSX.Element;
|
|
66
|
+
type SDKExampleProps = {
|
|
67
|
+
method: SDKJSON.Method;
|
|
68
|
+
transformRequestSnippet?: TransformRequestSnippetFn;
|
|
69
|
+
};
|
|
70
|
+
declare function SDKExample({
|
|
71
|
+
method,
|
|
72
|
+
transformRequestSnippet
|
|
73
|
+
}: SDKExampleProps): react_jsx_runtime0.JSX.Element;
|
|
74
|
+
type SDKMethodProps = {
|
|
75
|
+
method: SDKJSON.Method;
|
|
76
|
+
transformRequestSnippet?: TransformRequestSnippetFn;
|
|
77
|
+
};
|
|
78
|
+
declare function SDKMethodHeader({
|
|
79
|
+
method
|
|
80
|
+
}: SDKMethodProps): react_jsx_runtime0.JSX.Element;
|
|
81
|
+
declare function SDKMethodInfo({
|
|
82
|
+
method
|
|
83
|
+
}: SDKMethodProps): react_jsx_runtime0.JSX.Element;
|
|
84
|
+
declare function SDKMethod({
|
|
85
|
+
method,
|
|
86
|
+
transformRequestSnippet
|
|
87
|
+
}: SDKMethodProps): react_jsx_runtime0.JSX.Element | undefined;
|
|
88
|
+
type SDKModelProps = {
|
|
89
|
+
model: SDKJSON.Model;
|
|
90
|
+
};
|
|
91
|
+
declare function SDKModel({
|
|
92
|
+
model
|
|
93
|
+
}: SDKModelProps): react_jsx_runtime0.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_jsx_runtime0.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_jsx_runtime0.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 };
|
package/dist/search/index.d.ts
CHANGED
|
@@ -1 +1,26 @@
|
|
|
1
|
-
|
|
1
|
+
import "../routing-qc0V00-j.js";
|
|
2
|
+
import { c as QueryKindsType, l as ResultData } from "../types-CTBDtD34.js";
|
|
3
|
+
import * as react_jsx_runtime88 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/search/form.d.ts
|
|
6
|
+
declare function SearchForm(): react_jsx_runtime88.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_runtime88.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_runtime88.JSX.Element;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { SearchFilter, SearchFilterProps, SearchForm, SearchModal, SearchModalProps };
|
package/dist/search/index.js
CHANGED
|
@@ -1,2 +1,332 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import "../component-generics-DzI21jRn.js";
|
|
2
|
+
import { a as useLanguage } from "../docs-Dh8kE1va.js";
|
|
3
|
+
import "../navigation-aoYZ_tl4.js";
|
|
4
|
+
import "../markdown-BXfX1D7C.js";
|
|
5
|
+
import "../routing-DQjbRxdJ.js";
|
|
6
|
+
import { t as style_default } from "../style-rYbbxIR_.js";
|
|
7
|
+
import { t as useComponents } from "../use-components-D9E85p5x.js";
|
|
8
|
+
import { a as useSearchContext, i as useSearch } from "../contexts-DRxRO-xO.js";
|
|
9
|
+
import "../icons-DdKM-01E.js";
|
|
10
|
+
import "../utils-CJfFBNgT.js";
|
|
11
|
+
import "../dropdown-DtgAi6lb.js";
|
|
12
|
+
import "../md-Dg8aOyMA.js";
|
|
13
|
+
import "../utils-BHwvUDKn.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 { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
18
|
+
import { BookOpenText, Box, Code, Folder, Search, Wrench, X } from "lucide-react";
|
|
19
|
+
|
|
20
|
+
//#region src/search/results.tsx
|
|
21
|
+
const QueryKindDisplay = {
|
|
22
|
+
all: {
|
|
23
|
+
name: "Results",
|
|
24
|
+
icon: Search
|
|
25
|
+
},
|
|
26
|
+
resource: {
|
|
27
|
+
name: "Resources",
|
|
28
|
+
icon: Folder
|
|
29
|
+
},
|
|
30
|
+
http_method: {
|
|
31
|
+
name: "Methods",
|
|
32
|
+
icon: Box
|
|
33
|
+
},
|
|
34
|
+
model: {
|
|
35
|
+
name: "Types",
|
|
36
|
+
icon: Code
|
|
37
|
+
},
|
|
38
|
+
property: {
|
|
39
|
+
name: "Properties",
|
|
40
|
+
icon: Wrench
|
|
41
|
+
},
|
|
42
|
+
guide: {
|
|
43
|
+
name: "Guide",
|
|
44
|
+
icon: BookOpenText
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
function Highlight({ result, name }) {
|
|
48
|
+
const value = result._highlightResult[name]?.value;
|
|
49
|
+
if (value) return /* @__PURE__ */ jsx("span", { dangerouslySetInnerHTML: { __html: value } });
|
|
50
|
+
}
|
|
51
|
+
function SearchResultBreadcrumb({ result }) {
|
|
52
|
+
const Docs = useComponents();
|
|
53
|
+
const Icon = QueryKindDisplay[result.kind].icon;
|
|
54
|
+
const items = result.crumbs?.map((crumb) => /* @__PURE__ */ jsx("span", {
|
|
55
|
+
className: style_default.SearchBreadcrumbItem,
|
|
56
|
+
children: crumb
|
|
57
|
+
}, crumb));
|
|
58
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
59
|
+
className: style_default.SearchBreadcrumb,
|
|
60
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
61
|
+
className: style_default.Icon,
|
|
62
|
+
size: 14
|
|
63
|
+
}), Array.isArray(result.crumbs) && /* @__PURE__ */ jsx(Docs.Join, {
|
|
64
|
+
items,
|
|
65
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
66
|
+
className: style_default.SearchBreadcrumbDivider,
|
|
67
|
+
children: "›"
|
|
68
|
+
})
|
|
69
|
+
})]
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function SearchResult({ result }) {
|
|
73
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
74
|
+
className: style_default.SearchResult,
|
|
75
|
+
"data-stldocs-search-result": result.kind,
|
|
76
|
+
children: [/* @__PURE__ */ jsx(SearchResultBreadcrumb, { result }), /* @__PURE__ */ jsx(SearchResultContent, { result })]
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function GuideResult({ result }) {
|
|
80
|
+
const Docs = useComponents();
|
|
81
|
+
const Icon = QueryKindDisplay["guide"].icon;
|
|
82
|
+
const path = result.data.url.slice(1, -1).split("/").map((crumb) => /* @__PURE__ */ jsx("span", {
|
|
83
|
+
className: style_default.SearchBreadcrumbItem,
|
|
84
|
+
children: crumb
|
|
85
|
+
}, crumb));
|
|
86
|
+
const crumbs = path.length > 1 ? path : [/* @__PURE__ */ jsx("span", {
|
|
87
|
+
className: style_default.SearchBreadcrumbItem,
|
|
88
|
+
children: "Overview"
|
|
89
|
+
}, "overview")];
|
|
90
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
91
|
+
className: style_default.SearchResult,
|
|
92
|
+
"data-stldocs-search-result": "guide",
|
|
93
|
+
children: [
|
|
94
|
+
/* @__PURE__ */ jsxs("div", {
|
|
95
|
+
className: style_default.SearchBreadcrumb,
|
|
96
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
97
|
+
className: style_default.Icon,
|
|
98
|
+
size: 14
|
|
99
|
+
}), /* @__PURE__ */ jsx(Docs.Join, {
|
|
100
|
+
items: crumbs,
|
|
101
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
102
|
+
className: style_default.SearchBreadcrumbDivider,
|
|
103
|
+
children: "›"
|
|
104
|
+
})
|
|
105
|
+
})]
|
|
106
|
+
}),
|
|
107
|
+
/* @__PURE__ */ jsx("h3", {
|
|
108
|
+
className: style_default.SearchResultGuideTitle,
|
|
109
|
+
children: result.data.meta.title
|
|
110
|
+
}),
|
|
111
|
+
/* @__PURE__ */ jsx("div", {
|
|
112
|
+
className: style_default.SearchResultGuideExcerpt,
|
|
113
|
+
dangerouslySetInnerHTML: { __html: result.data.excerpt }
|
|
114
|
+
})
|
|
115
|
+
]
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
function SearchResultContent({ result }) {
|
|
119
|
+
const Docs = useComponents();
|
|
120
|
+
const language = useLanguage();
|
|
121
|
+
switch (result.kind) {
|
|
122
|
+
case "http_method": return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Docs.MethodHeader, {
|
|
123
|
+
level: "h5",
|
|
124
|
+
title: /* @__PURE__ */ jsx(Highlight, {
|
|
125
|
+
result,
|
|
126
|
+
name: result.summary ? "summary" : "title"
|
|
127
|
+
}),
|
|
128
|
+
signature: result["qualified"] && /* @__PURE__ */ jsx(Highlight, {
|
|
129
|
+
result,
|
|
130
|
+
name: "qualified"
|
|
131
|
+
}),
|
|
132
|
+
children: /* @__PURE__ */ jsx(Docs.MethodRoute, {
|
|
133
|
+
httpMethod: result.httpMethod,
|
|
134
|
+
endpoint: /* @__PURE__ */ jsx(Highlight, {
|
|
135
|
+
result,
|
|
136
|
+
name: "endpoint"
|
|
137
|
+
})
|
|
138
|
+
})
|
|
139
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
140
|
+
className: style_default.MethodDescription,
|
|
141
|
+
children: /* @__PURE__ */ jsx(Highlight, {
|
|
142
|
+
result,
|
|
143
|
+
name: "description"
|
|
144
|
+
})
|
|
145
|
+
})] });
|
|
146
|
+
case "model": {
|
|
147
|
+
const properties = result.children.map((child, index) => /* @__PURE__ */ jsx("span", {
|
|
148
|
+
className: style_default.TextIdentifier,
|
|
149
|
+
children: child
|
|
150
|
+
}, index));
|
|
151
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
152
|
+
className: style_default.Property,
|
|
153
|
+
"data-stldocs-language": language,
|
|
154
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
155
|
+
className: style_default.PropertyHeader,
|
|
156
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
157
|
+
className: style_default.PropertyName,
|
|
158
|
+
children: /* @__PURE__ */ jsx(Highlight, {
|
|
159
|
+
result,
|
|
160
|
+
name: result.title ? "title" : "name"
|
|
161
|
+
})
|
|
162
|
+
})
|
|
163
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
164
|
+
className: style_default.PropertyDeclaration,
|
|
165
|
+
children: [
|
|
166
|
+
/* @__PURE__ */ jsx(Highlight, {
|
|
167
|
+
result,
|
|
168
|
+
name: "ident"
|
|
169
|
+
}),
|
|
170
|
+
":",
|
|
171
|
+
" ",
|
|
172
|
+
/* @__PURE__ */ jsx(Docs.Join, {
|
|
173
|
+
items: properties,
|
|
174
|
+
limit: 3,
|
|
175
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
176
|
+
className: style_default.TextPunctuation,
|
|
177
|
+
children: ", "
|
|
178
|
+
})
|
|
179
|
+
})
|
|
180
|
+
]
|
|
181
|
+
})]
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
case "resource": return /* @__PURE__ */ jsxs("div", {
|
|
185
|
+
className: style_default.SearchResultResourceInfo,
|
|
186
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
187
|
+
className: style_default.SearchResultResourceTitle,
|
|
188
|
+
children: /* @__PURE__ */ jsx(Highlight, {
|
|
189
|
+
result,
|
|
190
|
+
name: "title"
|
|
191
|
+
})
|
|
192
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
193
|
+
className: style_default.SearchResultResourcePath,
|
|
194
|
+
children: /* @__PURE__ */ jsx(Highlight, {
|
|
195
|
+
result,
|
|
196
|
+
name: "QualifiedName"
|
|
197
|
+
})
|
|
198
|
+
})]
|
|
199
|
+
});
|
|
200
|
+
case "property": return /* @__PURE__ */ jsxs("div", {
|
|
201
|
+
className: style_default.Property,
|
|
202
|
+
"data-stldocs-language": language,
|
|
203
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
204
|
+
className: style_default.PropertyHeader,
|
|
205
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
206
|
+
className: style_default.PropertyName,
|
|
207
|
+
children: /* @__PURE__ */ jsx(Highlight, {
|
|
208
|
+
result,
|
|
209
|
+
name: "name"
|
|
210
|
+
})
|
|
211
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
212
|
+
className: style_default.PropertyTypeName,
|
|
213
|
+
children: /* @__PURE__ */ jsx("span", { dangerouslySetInnerHTML: { __html: result.type } })
|
|
214
|
+
})]
|
|
215
|
+
}), result.docstring && /* @__PURE__ */ jsx("span", {
|
|
216
|
+
className: style_default.PropertyDescription,
|
|
217
|
+
children: /* @__PURE__ */ jsx(Highlight, {
|
|
218
|
+
result,
|
|
219
|
+
name: "docstring"
|
|
220
|
+
})
|
|
221
|
+
})]
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
//#endregion
|
|
227
|
+
//#region src/search/form.tsx
|
|
228
|
+
function SearchForm() {
|
|
229
|
+
const Docs = useComponents();
|
|
230
|
+
const search = useSearch();
|
|
231
|
+
const language = useLanguage();
|
|
232
|
+
const { onSelect, pageFind } = useSearchContext();
|
|
233
|
+
const [results, setResults] = React$1.useState(null);
|
|
234
|
+
const [filterKind, setFilterKind] = React$1.useState("all");
|
|
235
|
+
const [searchQuery, setSearchQuery] = React$1.useState("");
|
|
236
|
+
const inputRef = React$1.useRef(null);
|
|
237
|
+
async function performSearch() {
|
|
238
|
+
const guideLimit = filterKind === "guide" ? 25 : 5;
|
|
239
|
+
const kind = ["all", "guide"].includes(filterKind) ? void 0 : filterKind;
|
|
240
|
+
const [guideResults, apiResults] = await Promise.all([pageFind ? guideSearch(pageFind, searchQuery, guideLimit) : [], search({
|
|
241
|
+
query: searchQuery,
|
|
242
|
+
kind,
|
|
243
|
+
language
|
|
244
|
+
})]);
|
|
245
|
+
setResults({
|
|
246
|
+
items: filterKind === "guide" ? guideResults : [...guideResults, ...apiResults.hits],
|
|
247
|
+
counts: {
|
|
248
|
+
...apiResults.facets?.["kind"],
|
|
249
|
+
guide: guideResults.length,
|
|
250
|
+
all: apiResults.nbHits
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
function clearInput() {
|
|
255
|
+
setSearchQuery("");
|
|
256
|
+
inputRef?.current?.focus();
|
|
257
|
+
}
|
|
258
|
+
React$1.useEffect(() => void performSearch(), [
|
|
259
|
+
searchQuery,
|
|
260
|
+
filterKind,
|
|
261
|
+
language
|
|
262
|
+
]);
|
|
263
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
264
|
+
className: style_default.SearchForm,
|
|
265
|
+
children: [
|
|
266
|
+
/* @__PURE__ */ jsx(Docs.Input, {
|
|
267
|
+
ref: inputRef,
|
|
268
|
+
autoFocus: true,
|
|
269
|
+
onChange: (ev) => setSearchQuery(ev.target.value),
|
|
270
|
+
left: /* @__PURE__ */ jsx(Search, {
|
|
271
|
+
size: 16,
|
|
272
|
+
className: style_default.Icon
|
|
273
|
+
}),
|
|
274
|
+
right: searchQuery && /* @__PURE__ */ jsx(X, {
|
|
275
|
+
cursor: "pointer",
|
|
276
|
+
onClick: () => clearInput(),
|
|
277
|
+
size: 16,
|
|
278
|
+
className: style_default.Icon
|
|
279
|
+
}),
|
|
280
|
+
value: searchQuery,
|
|
281
|
+
placeholder: "Search"
|
|
282
|
+
}),
|
|
283
|
+
/* @__PURE__ */ jsx(SearchFilter, {
|
|
284
|
+
results,
|
|
285
|
+
filterKind,
|
|
286
|
+
onChange: (filterKind$1) => setFilterKind(filterKind$1)
|
|
287
|
+
}),
|
|
288
|
+
/* @__PURE__ */ jsx(Docs.ListView, {
|
|
289
|
+
items: results?.items ?? [],
|
|
290
|
+
itemDelegate: (item) => "kind" in item ? /* @__PURE__ */ jsx(SearchResult, { result: item }) : /* @__PURE__ */ jsx(GuideResult, { result: item }),
|
|
291
|
+
onSelectListItem: (item) => onSelect?.(item["data"]?.["url"] ?? item["stainlessPath"])
|
|
292
|
+
})
|
|
293
|
+
]
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
function SearchFilter({ results, filterKind, onChange }) {
|
|
297
|
+
const Docs = useComponents();
|
|
298
|
+
const { pageFind } = useSearchContext();
|
|
299
|
+
const toggles = pageFind ? QueryKinds : QueryKinds.slice(0, -1);
|
|
300
|
+
return /* @__PURE__ */ jsx("div", {
|
|
301
|
+
className: style_default.SearchFilter,
|
|
302
|
+
children: toggles.map((kind, index) => /* @__PURE__ */ jsxs(Docs.ToggleButton, {
|
|
303
|
+
selected: filterKind === kind,
|
|
304
|
+
onClick: () => onChange?.(kind),
|
|
305
|
+
children: [
|
|
306
|
+
React$1.createElement(QueryKindDisplay[kind].icon, {
|
|
307
|
+
size: 16,
|
|
308
|
+
className: style_default.Icon
|
|
309
|
+
}),
|
|
310
|
+
QueryKindDisplay[kind].name,
|
|
311
|
+
/* @__PURE__ */ jsx("span", {
|
|
312
|
+
className: style_default.SearchFilterCount,
|
|
313
|
+
children: results?.counts?.[kind] ?? 0
|
|
314
|
+
})
|
|
315
|
+
]
|
|
316
|
+
}, index))
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
function SearchModal({ id, open: isOpen }) {
|
|
320
|
+
const [open, setOpen] = React$1.useState(isOpen);
|
|
321
|
+
return /* @__PURE__ */ jsx("div", {
|
|
322
|
+
id,
|
|
323
|
+
onToggle: (ev) => setOpen(ev.newState === "open"),
|
|
324
|
+
className: style_default.SearchModal,
|
|
325
|
+
popover: "auto",
|
|
326
|
+
"data-stldocs-modal-open": open,
|
|
327
|
+
children: open && /* @__PURE__ */ jsx(SearchForm, {})
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
//#endregion
|
|
332
|
+
export { SearchFilter, SearchForm, SearchModal };
|
|
@@ -1,8 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import "../../routing-qc0V00-j.js";
|
|
2
|
+
import { d as ResultType, h as SearchSettings, m as SearchParams } from "../../types-CTBDtD34.js";
|
|
3
|
+
|
|
4
|
+
//#region src/search/providers/algolia.d.ts
|
|
5
|
+
declare function buildIndex(appId: string, indexName: string, writeKey: string, spec: SDKJSON.Spec, renderMarkdown: (string?: any) => string | null): Promise<void>;
|
|
6
|
+
declare function buildChatIndex(appId: string, indexName: string, writeKey: string, spec: SDKJSON.Spec): Promise<void>;
|
|
7
|
+
declare function search({
|
|
8
|
+
settings: {
|
|
9
|
+
appId,
|
|
10
|
+
indexName,
|
|
11
|
+
searchKey
|
|
12
|
+
},
|
|
13
|
+
params: {
|
|
14
|
+
query,
|
|
15
|
+
language,
|
|
16
|
+
kind
|
|
17
|
+
}
|
|
18
|
+
}: {
|
|
19
|
+
params: SearchParams;
|
|
20
|
+
settings: SearchSettings;
|
|
8
21
|
}): Promise<ResultType | undefined>;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { buildChatIndex, buildIndex, search };
|