@stainless-api/docs-ui 0.1.0-beta.47 → 0.1.0-beta.49

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.
Files changed (159) hide show
  1. package/dist/breadcrumbs-nSFZO5Gf.js +63 -0
  2. package/dist/component-DRO8kQSp.js +23 -0
  3. package/dist/{component-generics-F0_Dx7UT.js → component-generics-B6Fn47Mz.js} +1 -1
  4. package/dist/{component-generics-DrrwsjTH.d.ts → component-generics-COP53CRn.d.ts} +2 -2
  5. package/dist/component-generics-fyFHB6qA.d.ts +30 -0
  6. package/dist/components/MaskedInput.d.ts +1 -1
  7. package/dist/components/MaskedInput.js +1 -1
  8. package/dist/components/breadcrumbs.d.ts +1 -1
  9. package/dist/components/breadcrumbs.js +7 -13
  10. package/dist/components/icons.js +1 -1
  11. package/dist/components/index.d.ts +9 -10
  12. package/dist/components/index.js +16 -13
  13. package/dist/components/method.d.ts +1 -1
  14. package/dist/components/method.js +8 -13
  15. package/dist/components/overview.d.ts +1 -1
  16. package/dist/components/overview.js +9 -13
  17. package/dist/components/primitives.d.ts +1 -1
  18. package/dist/components/primitives.js +6 -13
  19. package/dist/components/properties.d.ts +1 -1
  20. package/dist/components/properties.js +7 -13
  21. package/dist/components/sdk.d.ts +1 -2
  22. package/dist/components/sdk.js +8 -13
  23. package/dist/components/sidebar.d.ts +1 -1
  24. package/dist/components/sidebar.js +9 -13
  25. package/dist/components/snippets.d.ts +2 -3
  26. package/dist/components/snippets.js +7 -13
  27. package/dist/components-D7M-BwNI.js +71 -0
  28. package/dist/contexts/component-generics.d.ts +1 -1
  29. package/dist/contexts/component-generics.js +1 -1
  30. package/dist/contexts/component-types.d.ts +10 -11
  31. package/dist/contexts/component.d.ts +13 -14
  32. package/dist/contexts/component.js +25 -13
  33. package/dist/contexts/docs.d.ts +1 -1
  34. package/dist/contexts/docs.js +1 -1
  35. package/dist/contexts/index.d.ts +16 -19
  36. package/dist/contexts/index.js +6 -14
  37. package/dist/contexts/markdown.d.ts +1 -1
  38. package/dist/contexts/markdown.js +2 -2
  39. package/dist/contexts/navigation.d.ts +1 -2
  40. package/dist/contexts/navigation.js +1 -1
  41. package/dist/contexts/use-components.d.ts +9 -10
  42. package/dist/contexts/use-components.js +2 -2
  43. package/dist/contexts-p3rRZDlM.js +39 -0
  44. package/dist/csharp-CDSxfCZE.js +283 -0
  45. package/dist/docs-yYrp-uzs.d.ts +47 -0
  46. package/dist/go-1c3S5ETL.js +303 -0
  47. package/dist/http-2QNWXH9t.js +330 -0
  48. package/dist/{index-CeFeLPGr.d.ts → index-BQpRynot.d.ts} +8 -8
  49. package/dist/index-CnilsjrJ.d.ts +274 -0
  50. package/dist/{index-CTSOZqei.d.ts → index-Ct0NcQUK.d.ts} +1 -1
  51. package/dist/{index-Bt01VI67.d.ts → index-D6NhcxHd.d.ts} +6 -7
  52. package/dist/index-LboM0f0c.d.ts +15 -0
  53. package/dist/index-avtZIGmX.d.ts +13 -0
  54. package/dist/index.d.ts +18 -20
  55. package/dist/index.js +27 -13
  56. package/dist/java-BbjF_oUI.js +403 -0
  57. package/dist/languages/csharp.d.ts +10 -11
  58. package/dist/languages/csharp.js +7 -13
  59. package/dist/languages/go.d.ts +10 -11
  60. package/dist/languages/go.js +7 -13
  61. package/dist/languages/http.d.ts +10 -11
  62. package/dist/languages/http.js +17 -13
  63. package/dist/languages/index.d.ts +10 -11
  64. package/dist/languages/index.js +24 -13
  65. package/dist/languages/java.d.ts +10 -11
  66. package/dist/languages/java.js +7 -13
  67. package/dist/languages/python.d.ts +10 -11
  68. package/dist/languages/python.js +7 -13
  69. package/dist/languages/ruby.d.ts +10 -11
  70. package/dist/languages/ruby.js +7 -13
  71. package/dist/languages/typescript.d.ts +10 -11
  72. package/dist/languages/typescript.js +7 -13
  73. package/dist/languages-BCYZjzuS.js +26 -0
  74. package/dist/markdown/index.d.ts +4 -4
  75. package/dist/markdown/index.js +103 -14
  76. package/dist/markdown/md.js +1 -1
  77. package/dist/markdown/printer.d.ts +2 -0
  78. package/dist/markdown/printer.js +28 -0
  79. package/dist/markdown/utils.d.ts +2 -3
  80. package/dist/markdown/utils.js +1 -1
  81. package/dist/{markdown-Bx-mQFEj.js → markdown-CxdeWgjV.js} +1 -1
  82. package/dist/markdown-DA2cRtlr.d.ts +22 -0
  83. package/dist/method-CE08mUME.js +115 -0
  84. package/dist/{navigation-Cg69h_9U.d.ts → navigation-BfAVGPgw.d.ts} +3 -3
  85. package/dist/navigation-CjBnMcop.d.ts +29 -0
  86. package/dist/overview-DeZSiqFa.d.ts +39 -0
  87. package/dist/overview-S2hUqPXA.js +139 -0
  88. package/dist/primitives-BIWfwN5L.js +258 -0
  89. package/dist/primitives-CbqXZ-5f.d.ts +97 -0
  90. package/dist/printer-DBw4S_Jn.d.ts +13 -0
  91. package/dist/printer-DVZVkqAr.d.ts +13 -0
  92. package/dist/printer-bNxiG6UB.js +74 -0
  93. package/dist/properties-jlGW3USi.js +131 -0
  94. package/dist/python-USOwFDv_.js +279 -0
  95. package/dist/routing-CMqh1cTZ.d.ts +54 -0
  96. package/dist/{routing-BGBmkDBL.js → routing-Wbb7YECB.js} +1 -1
  97. package/dist/routing.d.ts +1 -1
  98. package/dist/routing.js +1 -1
  99. package/dist/ruby-CSvGbSLe.js +387 -0
  100. package/dist/{sdk-Ck0IERc7.d.ts → sdk-BOwYR0k6.d.ts} +1 -1
  101. package/dist/sdk-CSCbbn3O.js +336 -0
  102. package/dist/sdk-CdhDsvo3.d.ts +118 -0
  103. package/dist/sidebar-CWyvCrJ0.js +81 -0
  104. package/dist/snippets-BQLXEIf6.js +161 -0
  105. package/dist/snippets-CbVFNmfq.d.ts +51 -0
  106. package/dist/{snippets-XTXit9Ya.d.ts → snippets-Wjo2dJNw.d.ts} +1 -1
  107. package/dist/spec.d.ts +3 -3
  108. package/dist/spec.js +2 -2
  109. package/dist/style.d.ts +1 -1
  110. package/dist/style.js +1 -1
  111. package/dist/styles/resets.css +2 -1
  112. package/dist/styles.css +1099 -1
  113. package/dist/typescript-DXG9psK3.js +449 -0
  114. package/dist/{use-components-BAHidYIO.js → use-components-RWQbviGq.js} +1 -1
  115. package/dist/{utils-CJElSUwc.d.ts → utils-CTGH5e8c.d.ts} +2 -2
  116. package/dist/utils-DNKOwa7D.d.ts +21 -0
  117. package/dist/{utils-0z34vxY4.js → utils-D_1AWSRX.js} +2 -2
  118. package/dist/utils.d.ts +1 -1
  119. package/dist/utils.js +1 -2
  120. package/package.json +6 -20
  121. package/dist/contexts/search.d.ts +0 -4
  122. package/dist/contexts/search.js +0 -15
  123. package/dist/contexts-D3ClFTt3.js +0 -4117
  124. package/dist/pagefind-BHm6c3fb.js +0 -15
  125. package/dist/search/index.d.ts +0 -26
  126. package/dist/search/index.js +0 -334
  127. package/dist/search/mcp.d.ts +0 -13
  128. package/dist/search/mcp.js +0 -45
  129. package/dist/search/providers/algolia.d.ts +0 -25
  130. package/dist/search/providers/algolia.js +0 -15
  131. package/dist/search/providers/fuse.d.ts +0 -18
  132. package/dist/search/providers/fuse.js +0 -30
  133. package/dist/search/providers/pagefind.d.ts +0 -7
  134. package/dist/search/providers/pagefind.js +0 -3
  135. package/dist/search/providers/walker.d.ts +0 -9
  136. package/dist/search/providers/walker.js +0 -34
  137. package/dist/search/types.d.ts +0 -3
  138. package/dist/search/types.js +0 -3
  139. package/dist/search-B9SJyFXg.d.ts +0 -21
  140. package/dist/types-D7Ipu1J2.d.ts +0 -91
  141. package/dist/types-mRzd9aqe.js +0 -35
  142. /package/dist/{breadcrumbs-Bg3nNgu9.d.ts → breadcrumbs-DEyC9k79.d.ts} +0 -0
  143. /package/dist/{chunk-BWfJHHBp.js → chunk-DRcLgZ1e.js} +0 -0
  144. /package/dist/{docs-DGpIHBGY.d.ts → docs-B8-nCRaa.d.ts} +0 -0
  145. /package/dist/{docs-CNvEp0VL.js → docs-CXqi26jB.js} +0 -0
  146. /package/dist/{icons-DzBceOQw.js → icons-Ckod9aod.js} +0 -0
  147. /package/dist/{markdown-COcowhve.d.ts → markdown-C8o8WrwG.d.ts} +0 -0
  148. /package/dist/{md-D5AxFoS4.js → md-oM2tUaCA.js} +0 -0
  149. /package/dist/{method-DI8ARQ3m.d.ts → method-B6eAtYl2.d.ts} +0 -0
  150. /package/dist/{navigation-bydkHNUW.js → navigation-C5TN0SgC.js} +0 -0
  151. /package/dist/{overview-Bv43Hf_w.d.ts → overview-CswoJHww.d.ts} +0 -0
  152. /package/dist/{primitives-Br-H_CYo.d.ts → primitives-Caj5rKBc.d.ts} +0 -0
  153. /package/dist/{properties-RPXKwEeY.d.ts → properties-BkUlpvU4.d.ts} +0 -0
  154. /package/dist/{routing-nN1nc0jx.d.ts → routing-Dhmv52Fd.d.ts} +0 -0
  155. /package/dist/{sidebar-b3y7VIbU.d.ts → sidebar-BXz93vSy.d.ts} +0 -0
  156. /package/dist/{style-D8hwSwrv.d.ts → style-D7RO5ymE.d.ts} +0 -0
  157. /package/dist/{style-0miv2y38.js → style-gnVEeXFj.js} +0 -0
  158. /package/dist/{utils-CiZXDoFR.js → utils-CqnL9Fc3.js} +0 -0
  159. /package/dist/{utils-BcWczffA.d.ts → utils-d8paVwKN.d.ts} +0 -0
@@ -1,15 +0,0 @@
1
- //#region src/search/providers/pagefind.ts
2
- async function loadPagefind(path) {
3
- return await import(new URL(path, import.meta.url).href);
4
- }
5
- async function guideSearch(loadPath, query, limit) {
6
- const response = await (await loadPagefind(loadPath)).search(query);
7
- const items = limit ? response.results.slice(0, limit) : response.results;
8
- return Promise.all(items.map((result) => result.data().then((data) => ({
9
- ...result,
10
- data
11
- }))));
12
- }
13
-
14
- //#endregion
15
- export { guideSearch as t };
@@ -1,26 +0,0 @@
1
- import "../routing-nN1nc0jx.js";
2
- import { l as QueryKindsType, u as ResultData } from "../types-D7Ipu1J2.js";
3
- import * as react_jsx_runtime90 from "react/jsx-runtime";
4
-
5
- //#region src/search/form.d.ts
6
- declare function SearchForm(): react_jsx_runtime90.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_runtime90.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_runtime90.JSX.Element;
25
- //#endregion
26
- export { SearchFilter, SearchFilterProps, SearchForm, SearchModal, SearchModalProps };
@@ -1,334 +0,0 @@
1
- import { a as useLanguage } from "../docs-CNvEp0VL.js";
2
- import "../component-generics-F0_Dx7UT.js";
3
- import "../navigation-bydkHNUW.js";
4
- import "../markdown-Bx-mQFEj.js";
5
- import "../routing-BGBmkDBL.js";
6
- import { t as style_default } from "../style-0miv2y38.js";
7
- import { t as useComponents } from "../use-components-BAHidYIO.js";
8
- import { a as useSearchContext, i as useSearch } from "../contexts-D3ClFTt3.js";
9
- import "../icons-DzBceOQw.js";
10
- import "../utils-0z34vxY4.js";
11
- import "../md-D5AxFoS4.js";
12
- import "../utils-CiZXDoFR.js";
13
- import { t as QueryKinds } from "../types-mRzd9aqe.js";
14
- import { t as guideSearch } from "../pagefind-BHm6c3fb.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 : filterKind === "all" ? [...guideResults.slice(0, 5), ...apiResults?.hits ?? []] : 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 };
@@ -1,13 +0,0 @@
1
- import { t as DocsLanguage } from "../routing-nN1nc0jx.js";
2
- import { n as IndexEntry, r as IndexMethod } from "../types-D7Ipu1J2.js";
3
- import * as SDKJSON from "@stainless/sdk-json";
4
-
5
- //#region src/search/indexer.d.ts
6
-
7
- declare function generateIndex(spec: SDKJSON.Spec, renderMarkdownFn?: (_: string) => string | null, includeTypes?: boolean): Generator<IndexEntry>;
8
- //#endregion
9
- //#region src/search/mcp.d.ts
10
- type Item = IndexEntry & IndexMethod;
11
- declare function render(spec: SDKJSON.Spec, language: DocsLanguage, items: Item[], includeModelProperties: boolean): any;
12
- //#endregion
13
- export { generateIndex, render };
@@ -1,45 +0,0 @@
1
- import "../docs-CNvEp0VL.js";
2
- import "../component-generics-F0_Dx7UT.js";
3
- import "../navigation-bydkHNUW.js";
4
- import "../markdown-Bx-mQFEj.js";
5
- import { f as parseStainlessPath } from "../routing-BGBmkDBL.js";
6
- import "../style-0miv2y38.js";
7
- import "../use-components-BAHidYIO.js";
8
- import { p as renderMarkdown, u as generateIndex } from "../contexts-D3ClFTt3.js";
9
- import "../icons-DzBceOQw.js";
10
- import { n as getResourceFromSpec } from "../utils-0z34vxY4.js";
11
- import "../md-D5AxFoS4.js";
12
- import "../utils-CiZXDoFR.js";
13
- import "../types-mRzd9aqe.js";
14
-
15
- //#region src/search/mcp.ts
16
- function consolidate(results) {
17
- const resources = /* @__PURE__ */ new Set();
18
- const methods = /* @__PURE__ */ new Set();
19
- for (const entry of results) {
20
- const parsed = parseStainlessPath(entry.stainlessPath);
21
- if (parsed.method) methods.add(parsed.routable);
22
- else resources.add(parsed.routable);
23
- }
24
- const filtered = Array.from(methods).filter((path) => !resources.has(path.split(" >").at(0)));
25
- return [...resources, ...filtered];
26
- }
27
- function render(spec, language, items, includeModelProperties) {
28
- const env = {
29
- spec,
30
- language,
31
- options: {
32
- renderNestedResources: false,
33
- includeModelProperties
34
- }
35
- };
36
- const output = consolidate(items).map((entry) => {
37
- const parsed = parseStainlessPath(entry);
38
- const resource = getResourceFromSpec(parsed.resource, spec);
39
- return [entry, renderMarkdown(env, parsed.method ? resource.methods[parsed.method] : resource)];
40
- });
41
- return Object.fromEntries(output);
42
- }
43
-
44
- //#endregion
45
- export { generateIndex, render };
@@ -1,25 +0,0 @@
1
- import "../../routing-nN1nc0jx.js";
2
- import { f as ResultType, g as SearchSettings, h as SearchParams, s as ProseIndexEntry } from "../../types-D7Ipu1J2.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 buildProseIndex(appId: string, indexName: string, writeKey: string, objects: ProseIndexEntry[]): Promise<void>;
9
- declare function search({
10
- settings: {
11
- appId,
12
- indexName,
13
- searchKey
14
- },
15
- params: {
16
- query,
17
- language,
18
- kind
19
- }
20
- }: {
21
- params: SearchParams;
22
- settings: SearchSettings;
23
- }): Promise<ResultType | undefined>;
24
- //#endregion
25
- export { buildChatIndex, buildIndex, buildProseIndex, search };
@@ -1,15 +0,0 @@
1
- import "../../docs-CNvEp0VL.js";
2
- import "../../component-generics-F0_Dx7UT.js";
3
- import "../../navigation-bydkHNUW.js";
4
- import "../../markdown-Bx-mQFEj.js";
5
- import "../../routing-BGBmkDBL.js";
6
- import "../../style-0miv2y38.js";
7
- import "../../use-components-BAHidYIO.js";
8
- import { c as buildProseIndex, l as search, o as buildChatIndex, s as buildIndex } from "../../contexts-D3ClFTt3.js";
9
- import "../../icons-DzBceOQw.js";
10
- import "../../utils-0z34vxY4.js";
11
- import "../../md-D5AxFoS4.js";
12
- import "../../utils-CiZXDoFR.js";
13
- import "../../types-mRzd9aqe.js";
14
-
15
- export { buildChatIndex, buildIndex, buildProseIndex, search };
@@ -1,18 +0,0 @@
1
- import { t as DocsLanguage } from "../../routing-nN1nc0jx.js";
2
- import { n as IndexEntry } from "../../types-D7Ipu1J2.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 };
@@ -1,30 +0,0 @@
1
- import "../../docs-CNvEp0VL.js";
2
- import "../../component-generics-F0_Dx7UT.js";
3
- import "../../navigation-bydkHNUW.js";
4
- import "../../markdown-Bx-mQFEj.js";
5
- import "../../routing-BGBmkDBL.js";
6
- import "../../style-0miv2y38.js";
7
- import "../../use-components-BAHidYIO.js";
8
- import { u as generateIndex } from "../../contexts-D3ClFTt3.js";
9
- import "../../icons-DzBceOQw.js";
10
- import "../../utils-0z34vxY4.js";
11
- import "../../md-D5AxFoS4.js";
12
- import "../../utils-CiZXDoFR.js";
13
- import { n as SearchableAttributes } from "../../types-mRzd9aqe.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 };
@@ -1,7 +0,0 @@
1
- import "../../routing-nN1nc0jx.js";
2
- import { t as GuideResultType } from "../../types-D7Ipu1J2.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 };
@@ -1,3 +0,0 @@
1
- import { t as guideSearch } from "../../pagefind-BHm6c3fb.js";
2
-
3
- export { guideSearch };
@@ -1,9 +0,0 @@
1
- import { t as DocsLanguage } from "../../routing-nN1nc0jx.js";
2
- import { n as IndexEntry } from "../../types-D7Ipu1J2.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 };
@@ -1,34 +0,0 @@
1
- import "../../docs-CNvEp0VL.js";
2
- import "../../component-generics-F0_Dx7UT.js";
3
- import "../../navigation-bydkHNUW.js";
4
- import "../../markdown-Bx-mQFEj.js";
5
- import "../../routing-BGBmkDBL.js";
6
- import "../../style-0miv2y38.js";
7
- import "../../use-components-BAHidYIO.js";
8
- import { u as generateIndex } from "../../contexts-D3ClFTt3.js";
9
- import "../../icons-DzBceOQw.js";
10
- import "../../utils-0z34vxY4.js";
11
- import "../../md-D5AxFoS4.js";
12
- import "../../utils-CiZXDoFR.js";
13
- import { n as SearchableAttributes } from "../../types-mRzd9aqe.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 };
@@ -1,3 +0,0 @@
1
- import "../routing-nN1nc0jx.js";
2
- import { _ as SearchableAttributes, a as IndexProperty, c as QueryKinds, d as ResultRecordType, f as ResultType, g as SearchSettings, h as SearchParams, i as IndexModel, l as QueryKindsType, m as SearchAttributeNames, n as IndexEntry, o as IndexResource, p as RoutableJsonNode, r as IndexMethod, s as ProseIndexEntry, t as GuideResultType, u as ResultData, v as SearchableAttributesChat, y as SearchableAttributesProse } from "../types-D7Ipu1J2.js";
3
- export { GuideResultType, IndexEntry, IndexMethod, IndexModel, IndexProperty, IndexResource, ProseIndexEntry, QueryKinds, QueryKindsType, ResultData, ResultRecordType, ResultType, RoutableJsonNode, SearchAttributeNames, SearchParams, SearchSettings, SearchableAttributes, SearchableAttributesChat, SearchableAttributesProse };
@@ -1,3 +0,0 @@
1
- import { i as SearchableAttributesProse, n as SearchableAttributes, r as SearchableAttributesChat, t as QueryKinds } from "../types-mRzd9aqe.js";
2
-
3
- export { QueryKinds, SearchableAttributes, SearchableAttributesChat, SearchableAttributesProse };
@@ -1,21 +0,0 @@
1
- import { f as ResultType, g as SearchSettings, h as SearchParams } from "./types-D7Ipu1J2.js";
2
- import * as React$1 from "react";
3
- import * as react_jsx_runtime64 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_runtime64.JSX.Element;
20
- //#endregion
21
- export { useSearchContext as a, useSearch as i, SearchProvider as n, SearchProviderProps as r, SearchContextType as t };