@stainless-api/docs-ui 0.1.0-beta.48 → 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 (160) hide show
  1. package/dist/{breadcrumbs-TNRag6Vy.d.ts → breadcrumbs-DEyC9k79.d.ts} +2 -2
  2. package/dist/breadcrumbs-nSFZO5Gf.js +63 -0
  3. package/dist/component-DRO8kQSp.js +23 -0
  4. package/dist/{component-generics-F0_Dx7UT.js → component-generics-B6Fn47Mz.js} +1 -1
  5. package/dist/{component-generics-Cs7jFHLq.d.ts → component-generics-COP53CRn.d.ts} +2 -2
  6. package/dist/component-generics-fyFHB6qA.d.ts +30 -0
  7. package/dist/components/MaskedInput.d.ts +1 -1
  8. package/dist/components/MaskedInput.js +1 -1
  9. package/dist/components/breadcrumbs.d.ts +1 -1
  10. package/dist/components/breadcrumbs.js +7 -9
  11. package/dist/components/icons.d.ts +11 -11
  12. package/dist/components/icons.js +1 -1
  13. package/dist/components/index.d.ts +9 -9
  14. package/dist/components/index.js +16 -9
  15. package/dist/components/method.d.ts +1 -1
  16. package/dist/components/method.js +8 -9
  17. package/dist/components/overview.d.ts +1 -1
  18. package/dist/components/overview.js +9 -9
  19. package/dist/components/primitives.d.ts +1 -1
  20. package/dist/components/primitives.js +6 -9
  21. package/dist/components/properties.d.ts +1 -1
  22. package/dist/components/properties.js +7 -9
  23. package/dist/components/sdk.d.ts +1 -1
  24. package/dist/components/sdk.js +8 -9
  25. package/dist/components/sidebar.d.ts +1 -1
  26. package/dist/components/sidebar.js +9 -9
  27. package/dist/components/snippets.d.ts +2 -2
  28. package/dist/components/snippets.js +7 -9
  29. package/dist/components-D7M-BwNI.js +71 -0
  30. package/dist/contexts/component-generics.d.ts +1 -1
  31. package/dist/contexts/component-generics.js +1 -1
  32. package/dist/contexts/component-types.d.ts +10 -10
  33. package/dist/contexts/component.d.ts +13 -13
  34. package/dist/contexts/component.js +25 -9
  35. package/dist/contexts/docs.d.ts +1 -1
  36. package/dist/contexts/docs.js +1 -1
  37. package/dist/contexts/index.d.ts +16 -17
  38. package/dist/contexts/index.js +6 -10
  39. package/dist/contexts/markdown.d.ts +1 -1
  40. package/dist/contexts/markdown.js +2 -2
  41. package/dist/contexts/navigation.d.ts +1 -1
  42. package/dist/contexts/navigation.js +1 -1
  43. package/dist/contexts/use-components.d.ts +9 -9
  44. package/dist/contexts/use-components.js +2 -2
  45. package/dist/contexts-p3rRZDlM.js +39 -0
  46. package/dist/csharp-CDSxfCZE.js +283 -0
  47. package/dist/docs-yYrp-uzs.d.ts +47 -0
  48. package/dist/go-1c3S5ETL.js +303 -0
  49. package/dist/http-2QNWXH9t.js +330 -0
  50. package/dist/{index-Dt1TxDPe.d.ts → index-BQpRynot.d.ts} +8 -8
  51. package/dist/{index-BPQVqZ6-.d.ts → index-CnilsjrJ.d.ts} +30 -30
  52. package/dist/index-Ct0NcQUK.d.ts +274 -0
  53. package/dist/{index-D_zoydBM.d.ts → index-D6NhcxHd.d.ts} +6 -7
  54. package/dist/index-LboM0f0c.d.ts +15 -0
  55. package/dist/index-avtZIGmX.d.ts +13 -0
  56. package/dist/index.d.ts +18 -19
  57. package/dist/index.js +27 -12
  58. package/dist/java-BbjF_oUI.js +403 -0
  59. package/dist/languages/csharp.d.ts +10 -10
  60. package/dist/languages/csharp.js +7 -9
  61. package/dist/languages/go.d.ts +10 -10
  62. package/dist/languages/go.js +7 -9
  63. package/dist/languages/http.d.ts +10 -10
  64. package/dist/languages/http.js +17 -9
  65. package/dist/languages/index.d.ts +10 -10
  66. package/dist/languages/index.js +24 -9
  67. package/dist/languages/java.d.ts +10 -10
  68. package/dist/languages/java.js +7 -9
  69. package/dist/languages/python.d.ts +10 -10
  70. package/dist/languages/python.js +7 -9
  71. package/dist/languages/ruby.d.ts +10 -10
  72. package/dist/languages/ruby.js +7 -9
  73. package/dist/languages/typescript.d.ts +10 -10
  74. package/dist/languages/typescript.js +7 -9
  75. package/dist/languages-BCYZjzuS.js +26 -0
  76. package/dist/markdown/index.d.ts +4 -3
  77. package/dist/markdown/index.js +103 -10
  78. package/dist/markdown/md.js +1 -1
  79. package/dist/markdown/printer.d.ts +2 -0
  80. package/dist/markdown/printer.js +28 -0
  81. package/dist/markdown/utils.d.ts +2 -2
  82. package/dist/markdown/utils.js +1 -1
  83. package/dist/{markdown-J4fsbXbi.d.ts → markdown-C8o8WrwG.d.ts} +2 -2
  84. package/dist/{markdown-Bx-mQFEj.js → markdown-CxdeWgjV.js} +1 -1
  85. package/dist/markdown-DA2cRtlr.d.ts +22 -0
  86. package/dist/{method-uqti5jIi.d.ts → method-B6eAtYl2.d.ts} +7 -7
  87. package/dist/method-CE08mUME.js +115 -0
  88. package/dist/{navigation-DztmhdsO.d.ts → navigation-BfAVGPgw.d.ts} +3 -3
  89. package/dist/navigation-CjBnMcop.d.ts +29 -0
  90. package/dist/{overview-CXiAiRu3.d.ts → overview-CswoJHww.d.ts} +6 -6
  91. package/dist/overview-DeZSiqFa.d.ts +39 -0
  92. package/dist/overview-S2hUqPXA.js +139 -0
  93. package/dist/primitives-BIWfwN5L.js +258 -0
  94. package/dist/{primitives-CS8fdjfv.d.ts → primitives-Caj5rKBc.d.ts} +9 -9
  95. package/dist/primitives-CbqXZ-5f.d.ts +97 -0
  96. package/dist/printer-DBw4S_Jn.d.ts +13 -0
  97. package/dist/printer-DVZVkqAr.d.ts +13 -0
  98. package/dist/printer-bNxiG6UB.js +74 -0
  99. package/dist/{properties-Bf600pp5.d.ts → properties-BkUlpvU4.d.ts} +5 -5
  100. package/dist/properties-jlGW3USi.js +131 -0
  101. package/dist/python-USOwFDv_.js +279 -0
  102. package/dist/{routing-BcGPNh2R.d.ts → routing-CMqh1cTZ.d.ts} +1 -1
  103. package/dist/routing-Dhmv52Fd.d.ts +54 -0
  104. package/dist/{routing-BGBmkDBL.js → routing-Wbb7YECB.js} +1 -1
  105. package/dist/routing.d.ts +1 -1
  106. package/dist/routing.js +1 -1
  107. package/dist/ruby-CSvGbSLe.js +387 -0
  108. package/dist/{sdk-CuOpWo9I.d.ts → sdk-BOwYR0k6.d.ts} +14 -14
  109. package/dist/sdk-CSCbbn3O.js +336 -0
  110. package/dist/sdk-CdhDsvo3.d.ts +118 -0
  111. package/dist/{sidebar-CqfIoVcr.d.ts → sidebar-BXz93vSy.d.ts} +5 -5
  112. package/dist/sidebar-CWyvCrJ0.js +81 -0
  113. package/dist/snippets-BQLXEIf6.js +161 -0
  114. package/dist/{snippets-BwifQYD4.d.ts → snippets-CbVFNmfq.d.ts} +8 -8
  115. package/dist/snippets-Wjo2dJNw.d.ts +51 -0
  116. package/dist/spec.d.ts +3 -3
  117. package/dist/spec.js +2 -2
  118. package/dist/style.d.ts +1 -1
  119. package/dist/style.js +1 -1
  120. package/dist/styles/resets.css +2 -1
  121. package/dist/styles.css +7 -3
  122. package/dist/typescript-DXG9psK3.js +449 -0
  123. package/dist/{use-components-BAHidYIO.js → use-components-RWQbviGq.js} +1 -1
  124. package/dist/{utils-DAOeBdRL.d.ts → utils-CTGH5e8c.d.ts} +2 -2
  125. package/dist/utils-DNKOwa7D.d.ts +21 -0
  126. package/dist/{utils-0z34vxY4.js → utils-D_1AWSRX.js} +2 -2
  127. package/dist/utils.d.ts +1 -1
  128. package/dist/utils.js +1 -1
  129. package/package.json +6 -20
  130. package/dist/contexts/search.d.ts +0 -2
  131. package/dist/contexts/search.js +0 -11
  132. package/dist/contexts-D3ClFTt3.js +0 -4117
  133. package/dist/pagefind-BHm6c3fb.js +0 -15
  134. package/dist/search/index.d.ts +0 -25
  135. package/dist/search/index.js +0 -332
  136. package/dist/search/mcp.d.ts +0 -13
  137. package/dist/search/mcp.js +0 -43
  138. package/dist/search/providers/algolia.d.ts +0 -24
  139. package/dist/search/providers/algolia.js +0 -11
  140. package/dist/search/providers/fuse.d.ts +0 -18
  141. package/dist/search/providers/fuse.js +0 -27
  142. package/dist/search/providers/pagefind.d.ts +0 -6
  143. package/dist/search/providers/pagefind.js +0 -3
  144. package/dist/search/providers/walker.d.ts +0 -9
  145. package/dist/search/providers/walker.js +0 -31
  146. package/dist/search/types.d.ts +0 -2
  147. package/dist/search/types.js +0 -3
  148. package/dist/search-DvzBAFUW.d.ts +0 -21
  149. package/dist/types-9YHj_ZeX.d.ts +0 -91
  150. package/dist/types-mRzd9aqe.js +0 -35
  151. /package/dist/{chunk-BWfJHHBp.js → chunk-DRcLgZ1e.js} +0 -0
  152. /package/dist/{docs-DGpIHBGY.d.ts → docs-B8-nCRaa.d.ts} +0 -0
  153. /package/dist/{docs-CNvEp0VL.js → docs-CXqi26jB.js} +0 -0
  154. /package/dist/{icons-DzBceOQw.js → icons-Ckod9aod.js} +0 -0
  155. /package/dist/{md-D5AxFoS4.js → md-oM2tUaCA.js} +0 -0
  156. /package/dist/{navigation-bydkHNUW.js → navigation-C5TN0SgC.js} +0 -0
  157. /package/dist/{style-D8hwSwrv.d.ts → style-D7RO5ymE.d.ts} +0 -0
  158. /package/dist/{style-0miv2y38.js → style-gnVEeXFj.js} +0 -0
  159. /package/dist/{utils-CiZXDoFR.js → utils-CqnL9Fc3.js} +0 -0
  160. /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,25 +0,0 @@
1
- import { l as QueryKindsType, u as ResultData } from "../types-9YHj_ZeX.js";
2
- import * as react_jsx_runtime90 from "react/jsx-runtime";
3
-
4
- //#region src/search/form.d.ts
5
- declare function SearchForm(): react_jsx_runtime90.JSX.Element;
6
- type SearchFilterProps = {
7
- results: ResultData;
8
- filterKind: QueryKindsType;
9
- onChange: (filterKind: QueryKindsType) => void;
10
- };
11
- declare function SearchFilter({
12
- results,
13
- filterKind,
14
- onChange
15
- }: SearchFilterProps): react_jsx_runtime90.JSX.Element;
16
- type SearchModalProps = {
17
- id?: string;
18
- open?: boolean;
19
- };
20
- declare function SearchModal({
21
- id,
22
- open: isOpen
23
- }: SearchModalProps): react_jsx_runtime90.JSX.Element;
24
- //#endregion
25
- export { SearchFilter, SearchFilterProps, SearchForm, SearchModal, SearchModalProps };
@@ -1,332 +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 { t as style_default } from "../style-0miv2y38.js";
6
- import { t as useComponents } from "../use-components-BAHidYIO.js";
7
- import { a as useSearchContext, i as useSearch } from "../contexts-D3ClFTt3.js";
8
- import "../icons-DzBceOQw.js";
9
- import "../md-D5AxFoS4.js";
10
- import "../utils-CiZXDoFR.js";
11
- import { t as QueryKinds } from "../types-mRzd9aqe.js";
12
- import { t as guideSearch } from "../pagefind-BHm6c3fb.js";
13
- import * as React$1 from "react";
14
- import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
15
- import { BookOpenText, Box, Code, Folder, Search, Wrench, X } from "lucide-react";
16
-
17
- //#region src/search/results.tsx
18
- const QueryKindDisplay = {
19
- all: {
20
- name: "Results",
21
- icon: Search
22
- },
23
- resource: {
24
- name: "Resources",
25
- icon: Folder
26
- },
27
- http_method: {
28
- name: "Methods",
29
- icon: Box
30
- },
31
- model: {
32
- name: "Types",
33
- icon: Code
34
- },
35
- property: {
36
- name: "Properties",
37
- icon: Wrench
38
- },
39
- guide: {
40
- name: "Guide",
41
- icon: BookOpenText
42
- }
43
- };
44
- function Highlight({ result, name }) {
45
- const value = result._highlightResult[name]?.value;
46
- if (value) return /* @__PURE__ */ jsx("span", { dangerouslySetInnerHTML: { __html: value } });
47
- }
48
- function SearchResultBreadcrumb({ result }) {
49
- const Docs = useComponents();
50
- const Icon = QueryKindDisplay[result.kind].icon;
51
- const items = result.crumbs?.map((crumb) => /* @__PURE__ */ jsx("span", {
52
- className: style_default.SearchBreadcrumbItem,
53
- children: crumb
54
- }, crumb));
55
- return /* @__PURE__ */ jsxs("div", {
56
- className: style_default.SearchBreadcrumb,
57
- children: [/* @__PURE__ */ jsx(Icon, {
58
- className: style_default.Icon,
59
- size: 14
60
- }), Array.isArray(result.crumbs) && /* @__PURE__ */ jsx(Docs.Join, {
61
- items,
62
- children: /* @__PURE__ */ jsx("span", {
63
- className: style_default.SearchBreadcrumbDivider,
64
- children: "›"
65
- })
66
- })]
67
- });
68
- }
69
- function SearchResult({ result }) {
70
- return /* @__PURE__ */ jsxs("div", {
71
- className: style_default.SearchResult,
72
- "data-stldocs-search-result": result.kind,
73
- children: [/* @__PURE__ */ jsx(SearchResultBreadcrumb, { result }), /* @__PURE__ */ jsx(SearchResultContent, { result })]
74
- });
75
- }
76
- function GuideResult({ result }) {
77
- const Docs = useComponents();
78
- const Icon = QueryKindDisplay["guide"].icon;
79
- const path = result.data.url.slice(1, -1).split("/").map((crumb) => /* @__PURE__ */ jsx("span", {
80
- className: style_default.SearchBreadcrumbItem,
81
- children: crumb
82
- }, crumb));
83
- const crumbs = path.length > 1 ? path : [/* @__PURE__ */ jsx("span", {
84
- className: style_default.SearchBreadcrumbItem,
85
- children: "Overview"
86
- }, "overview")];
87
- return /* @__PURE__ */ jsxs("div", {
88
- className: style_default.SearchResult,
89
- "data-stldocs-search-result": "guide",
90
- children: [
91
- /* @__PURE__ */ jsxs("div", {
92
- className: style_default.SearchBreadcrumb,
93
- children: [/* @__PURE__ */ jsx(Icon, {
94
- className: style_default.Icon,
95
- size: 14
96
- }), /* @__PURE__ */ jsx(Docs.Join, {
97
- items: crumbs,
98
- children: /* @__PURE__ */ jsx("span", {
99
- className: style_default.SearchBreadcrumbDivider,
100
- children: "›"
101
- })
102
- })]
103
- }),
104
- /* @__PURE__ */ jsx("h3", {
105
- className: style_default.SearchResultGuideTitle,
106
- children: result.data.meta.title
107
- }),
108
- /* @__PURE__ */ jsx("div", {
109
- className: style_default.SearchResultGuideExcerpt,
110
- dangerouslySetInnerHTML: { __html: result.data.excerpt }
111
- })
112
- ]
113
- });
114
- }
115
- function SearchResultContent({ result }) {
116
- const Docs = useComponents();
117
- const language = useLanguage();
118
- switch (result.kind) {
119
- case "http_method": return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Docs.MethodHeader, {
120
- level: "h5",
121
- title: /* @__PURE__ */ jsx(Highlight, {
122
- result,
123
- name: result.summary ? "summary" : "title"
124
- }),
125
- signature: result["qualified"] && /* @__PURE__ */ jsx(Highlight, {
126
- result,
127
- name: "qualified"
128
- }),
129
- children: /* @__PURE__ */ jsx(Docs.MethodRoute, {
130
- httpMethod: result.httpMethod,
131
- endpoint: /* @__PURE__ */ jsx(Highlight, {
132
- result,
133
- name: "endpoint"
134
- })
135
- })
136
- }), /* @__PURE__ */ jsx("div", {
137
- className: `${style_default.MethodDescription} ${style_default.Content}`,
138
- children: /* @__PURE__ */ jsx(Highlight, {
139
- result,
140
- name: "description"
141
- })
142
- })] });
143
- case "model": {
144
- const properties = result.children?.map((child, index) => /* @__PURE__ */ jsx("span", {
145
- className: style_default.TextIdentifier,
146
- children: child
147
- }, index)) ?? [];
148
- return /* @__PURE__ */ jsxs("div", {
149
- className: style_default.Property,
150
- "data-stldocs-language": language,
151
- children: [/* @__PURE__ */ jsx("div", {
152
- className: style_default.PropertyHeader,
153
- children: /* @__PURE__ */ jsx("span", {
154
- className: style_default.PropertyName,
155
- children: /* @__PURE__ */ jsx(Highlight, {
156
- result,
157
- name: result.title ? "title" : "name"
158
- })
159
- })
160
- }), /* @__PURE__ */ jsxs("span", {
161
- className: style_default.PropertyDeclaration,
162
- children: [
163
- /* @__PURE__ */ jsx(Highlight, {
164
- result,
165
- name: "ident"
166
- }),
167
- ":",
168
- " ",
169
- /* @__PURE__ */ jsx(Docs.Join, {
170
- items: properties,
171
- limit: 3,
172
- children: /* @__PURE__ */ jsx("span", {
173
- className: style_default.TextPunctuation,
174
- children: ", "
175
- })
176
- })
177
- ]
178
- })]
179
- });
180
- }
181
- case "resource": return /* @__PURE__ */ jsxs("div", {
182
- className: style_default.SearchResultResourceInfo,
183
- children: [/* @__PURE__ */ jsx("span", {
184
- className: style_default.SearchResultResourceTitle,
185
- children: /* @__PURE__ */ jsx(Highlight, {
186
- result,
187
- name: "title"
188
- })
189
- }), /* @__PURE__ */ jsx("span", {
190
- className: style_default.SearchResultResourcePath,
191
- children: /* @__PURE__ */ jsx(Highlight, {
192
- result,
193
- name: "QualifiedName"
194
- })
195
- })]
196
- });
197
- case "property": return /* @__PURE__ */ jsxs("div", {
198
- className: style_default.Property,
199
- "data-stldocs-language": language,
200
- children: [/* @__PURE__ */ jsxs("div", {
201
- className: style_default.PropertyHeader,
202
- children: [/* @__PURE__ */ jsx("span", {
203
- className: style_default.PropertyName,
204
- children: /* @__PURE__ */ jsx(Highlight, {
205
- result,
206
- name: "name"
207
- })
208
- }), /* @__PURE__ */ jsx("span", {
209
- className: style_default.PropertyTypeName,
210
- children: /* @__PURE__ */ jsx("span", { dangerouslySetInnerHTML: { __html: result.type ?? "" } })
211
- })]
212
- }), result.docstring && /* @__PURE__ */ jsx("span", {
213
- className: style_default.PropertyDescription,
214
- children: /* @__PURE__ */ jsx(Highlight, {
215
- result,
216
- name: "docstring"
217
- })
218
- })]
219
- });
220
- }
221
- }
222
-
223
- //#endregion
224
- //#region src/search/form.tsx
225
- function SearchForm() {
226
- const Docs = useComponents();
227
- const search = useSearch();
228
- const language = useLanguage();
229
- const { onSelect, pageFind } = useSearchContext();
230
- const [results, setResults] = React$1.useState(null);
231
- const [filterKind, setFilterKind] = React$1.useState("all");
232
- const [searchQuery, setSearchQuery] = React$1.useState("");
233
- const inputRef = React$1.useRef(null);
234
- async function performSearch() {
235
- const guideLimit = filterKind === "guide" ? 25 : 5;
236
- const kind = ["all", "guide"].includes(filterKind) ? void 0 : filterKind;
237
- const [guideResults, apiResults] = await Promise.all([pageFind ? guideSearch(pageFind, searchQuery, guideLimit) : [], search({
238
- query: searchQuery,
239
- kind,
240
- language
241
- })]);
242
- setResults({
243
- items: filterKind === "guide" ? guideResults : filterKind === "all" ? [...guideResults.slice(0, 5), ...apiResults?.hits ?? []] : apiResults?.hits ?? [],
244
- counts: {
245
- ...apiResults?.facets?.["kind"],
246
- guide: guideResults.length,
247
- all: apiResults?.nbHits
248
- }
249
- });
250
- }
251
- function clearInput() {
252
- setSearchQuery("");
253
- inputRef?.current?.focus();
254
- }
255
- React$1.useEffect(() => void performSearch(), [
256
- searchQuery,
257
- filterKind,
258
- language
259
- ]);
260
- return /* @__PURE__ */ jsxs("div", {
261
- className: style_default.SearchForm,
262
- children: [
263
- /* @__PURE__ */ jsx(Docs.Input, {
264
- ref: inputRef,
265
- autoFocus: true,
266
- onChange: (ev) => setSearchQuery(ev.target.value),
267
- left: /* @__PURE__ */ jsx(Search, {
268
- size: 16,
269
- className: style_default.Icon
270
- }),
271
- right: searchQuery && /* @__PURE__ */ jsx(X, {
272
- cursor: "pointer",
273
- onClick: () => clearInput(),
274
- size: 16,
275
- className: style_default.Icon
276
- }),
277
- value: searchQuery,
278
- placeholder: "Search"
279
- }),
280
- /* @__PURE__ */ jsx(SearchFilter, {
281
- results,
282
- filterKind,
283
- onChange: (filterKind$1) => setFilterKind(filterKind$1)
284
- }),
285
- /* @__PURE__ */ jsx(Docs.ListView, {
286
- items: results?.items ?? [],
287
- itemDelegate: (item) => "kind" in item ? /* @__PURE__ */ jsx(SearchResult, { result: item }) : /* @__PURE__ */ jsx(GuideResult, { result: item }),
288
- onSelectListItem: (item) => onSelect?.(item["data"]?.["url"] ?? item["stainlessPath"])
289
- })
290
- ]
291
- });
292
- }
293
- function SearchFilter({ results, filterKind, onChange }) {
294
- const Docs = useComponents();
295
- const { pageFind } = useSearchContext();
296
- const toggles = pageFind ? QueryKinds : QueryKinds.slice(0, -1);
297
- return /* @__PURE__ */ jsx("div", {
298
- className: style_default.SearchFilter,
299
- children: toggles.map((kind, index) => /* @__PURE__ */ jsxs(Docs.ToggleButton, {
300
- selected: filterKind === kind,
301
- onClick: () => onChange?.(kind),
302
- children: [
303
- React$1.createElement(QueryKindDisplay[kind].icon, {
304
- size: 16,
305
- className: style_default.Icon
306
- }),
307
- /* @__PURE__ */ jsx("span", {
308
- className: style_default.SearchFilterLabel,
309
- children: QueryKindDisplay[kind].name
310
- }),
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 ?? false);
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,13 +0,0 @@
1
- import { t as DocsLanguage } from "../routing-BcGPNh2R.js";
2
- import { n as IndexEntry, r as IndexMethod } from "../types-9YHj_ZeX.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,43 +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 "../use-components-BAHidYIO.js";
7
- import { p as renderMarkdown, u as generateIndex } from "../contexts-D3ClFTt3.js";
8
- import "../icons-DzBceOQw.js";
9
- import { n as getResourceFromSpec } from "../utils-0z34vxY4.js";
10
- import "../md-D5AxFoS4.js";
11
- import "../utils-CiZXDoFR.js";
12
-
13
- //#region src/search/mcp.ts
14
- function consolidate(results) {
15
- const resources = /* @__PURE__ */ new Set();
16
- const methods = /* @__PURE__ */ new Set();
17
- for (const entry of results) {
18
- const parsed = parseStainlessPath(entry.stainlessPath);
19
- if (parsed.method) methods.add(parsed.routable);
20
- else resources.add(parsed.routable);
21
- }
22
- const filtered = Array.from(methods).filter((path) => !resources.has(path.split(" >").at(0)));
23
- return [...resources, ...filtered];
24
- }
25
- function render(spec, language, items, includeModelProperties) {
26
- const env = {
27
- spec,
28
- language,
29
- options: {
30
- renderNestedResources: false,
31
- includeModelProperties
32
- }
33
- };
34
- const output = consolidate(items).map((entry) => {
35
- const parsed = parseStainlessPath(entry);
36
- const resource = getResourceFromSpec(parsed.resource, spec);
37
- return [entry, renderMarkdown(env, parsed.method ? resource.methods[parsed.method] : resource)];
38
- });
39
- return Object.fromEntries(output);
40
- }
41
-
42
- //#endregion
43
- export { generateIndex, render };
@@ -1,24 +0,0 @@
1
- import { f as ResultType, g as SearchSettings, h as SearchParams, s as ProseIndexEntry } from "../../types-9YHj_ZeX.js";
2
- import * as SDKJSON from "@stainless/sdk-json";
3
-
4
- //#region src/search/providers/algolia.d.ts
5
- declare function buildIndex(appId: string, indexName: string, writeKey: string, spec: SDKJSON.Spec, renderMarkdown: (_: string) => string | null): Promise<void>;
6
- declare function buildChatIndex(appId: string, indexName: string, writeKey: string, spec: SDKJSON.Spec): Promise<void>;
7
- declare function buildProseIndex(appId: string, indexName: string, writeKey: string, objects: ProseIndexEntry[]): 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, buildProseIndex, search };
@@ -1,11 +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 "../../use-components-BAHidYIO.js";
6
- import { c as buildProseIndex, l as search, o as buildChatIndex, s as buildIndex } from "../../contexts-D3ClFTt3.js";
7
- import "../../icons-DzBceOQw.js";
8
- import "../../md-D5AxFoS4.js";
9
- import "../../utils-CiZXDoFR.js";
10
-
11
- export { buildChatIndex, buildIndex, buildProseIndex, search };
@@ -1,18 +0,0 @@
1
- import { t as DocsLanguage } from "../../routing-BcGPNh2R.js";
2
- import { n as IndexEntry } from "../../types-9YHj_ZeX.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,27 +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 "../../use-components-BAHidYIO.js";
6
- import { u as generateIndex } from "../../contexts-D3ClFTt3.js";
7
- import "../../icons-DzBceOQw.js";
8
- import "../../md-D5AxFoS4.js";
9
- import "../../utils-CiZXDoFR.js";
10
- import { n as SearchableAttributes } from "../../types-mRzd9aqe.js";
11
- import Fuse from "fuse.js";
12
-
13
- //#region src/search/providers/fuse.ts
14
- function buildIndex(spec, language) {
15
- const idx = Array.from(generateIndex(spec, void 0, false));
16
- const content = language ? idx.filter((entry) => entry.language === language) : idx;
17
- return {
18
- content,
19
- index: Fuse.createIndex([...SearchableAttributes], content)
20
- };
21
- }
22
- function search({ content, index }, query, limit = 100) {
23
- return new Fuse(content, { keys: [...SearchableAttributes] }, index).search(query).slice(0, limit);
24
- }
25
-
26
- //#endregion
27
- export { buildIndex, search };
@@ -1,6 +0,0 @@
1
- import { t as GuideResultType } from "../../types-9YHj_ZeX.js";
2
-
3
- //#region src/search/providers/pagefind.d.ts
4
- declare function guideSearch(loadPath: string, query: string, limit?: number): Promise<GuideResultType[]>;
5
- //#endregion
6
- 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-BcGPNh2R.js";
2
- import { n as IndexEntry } from "../../types-9YHj_ZeX.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,31 +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 "../../use-components-BAHidYIO.js";
6
- import { u as generateIndex } from "../../contexts-D3ClFTt3.js";
7
- import "../../icons-DzBceOQw.js";
8
- import "../../md-D5AxFoS4.js";
9
- import "../../utils-CiZXDoFR.js";
10
- import { n as SearchableAttributes } from "../../types-mRzd9aqe.js";
11
-
12
- //#region src/search/providers/walker.ts
13
- function buildIndex(spec) {
14
- return generateIndex(spec, void 0, false);
15
- }
16
- function* findEntryInIndex(index, language, query) {
17
- for (const entry of index) {
18
- if (entry.language !== language) continue;
19
- for (const attr of SearchableAttributes) {
20
- const attr_ = attr in entry ? attr : null;
21
- if (attr_ && entry[attr_] && typeof entry[attr_] === "string" && entry[attr_].includes(query)) yield entry;
22
- }
23
- }
24
- }
25
- function search(index, language, query, limit = 100) {
26
- const results = findEntryInIndex(index, language, query);
27
- return Array.from(results).sort((a, b) => a.priority - b.priority).slice(0, limit);
28
- }
29
-
30
- //#endregion
31
- export { buildIndex, search };
@@ -1,2 +0,0 @@
1
- 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-9YHj_ZeX.js";
2
- 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-9YHj_ZeX.js";
2
- import * as React$1 from "react";
3
- import * as react_jsx_runtime60 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_runtime60.JSX.Element;
20
- //#endregion
21
- export { useSearchContext as a, useSearch as i, SearchProvider as n, SearchProviderProps as r, SearchContextType as t };