@stainless-api/docs-ui 0.1.0-beta.21 → 0.1.0-beta.22

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 (123) hide show
  1. package/dist/index.js +1762 -1015
  2. package/package.json +4 -4
  3. package/dist/breadcrumbs-Z-hEqjcp.d.ts +0 -19
  4. package/dist/chunk-Bp6m_JJh.js +0 -13
  5. package/dist/component-generics-DzI21jRn.js +0 -35
  6. package/dist/component-generics-q5Dqiu2D.d.ts +0 -30
  7. package/dist/components/breadcrumbs.d.ts +0 -2
  8. package/dist/components/breadcrumbs.js +0 -16
  9. package/dist/components/chat.d.ts +0 -14
  10. package/dist/components/chat.js +0 -144
  11. package/dist/components/dropdown.d.ts +0 -2
  12. package/dist/components/dropdown.js +0 -4
  13. package/dist/components/icons.d.ts +0 -50
  14. package/dist/components/icons.js +0 -3
  15. package/dist/components/index.d.ts +0 -12
  16. package/dist/components/index.js +0 -16
  17. package/dist/components/method.d.ts +0 -2
  18. package/dist/components/method.js +0 -16
  19. package/dist/components/overview.d.ts +0 -2
  20. package/dist/components/overview.js +0 -16
  21. package/dist/components/primitives.d.ts +0 -2
  22. package/dist/components/primitives.js +0 -16
  23. package/dist/components/properties.d.ts +0 -2
  24. package/dist/components/properties.js +0 -16
  25. package/dist/components/scripts/dropdown.d.ts +0 -12
  26. package/dist/components/scripts/dropdown.js +0 -50
  27. package/dist/components/sdk.d.ts +0 -3
  28. package/dist/components/sdk.js +0 -16
  29. package/dist/components/sidebar.d.ts +0 -2
  30. package/dist/components/sidebar.js +0 -16
  31. package/dist/components/snippets.d.ts +0 -4
  32. package/dist/components/snippets.js +0 -16
  33. package/dist/contexts/component-generics.d.ts +0 -2
  34. package/dist/contexts/component-generics.js +0 -3
  35. package/dist/contexts/component-types.d.ts +0 -18
  36. package/dist/contexts/component-types.js +0 -1
  37. package/dist/contexts/component.d.ts +0 -31
  38. package/dist/contexts/component.js +0 -16
  39. package/dist/contexts/docs.d.ts +0 -2
  40. package/dist/contexts/docs.js +0 -3
  41. package/dist/contexts/index.d.ts +0 -20
  42. package/dist/contexts/index.js +0 -16
  43. package/dist/contexts/markdown.d.ts +0 -2
  44. package/dist/contexts/markdown.js +0 -4
  45. package/dist/contexts/navigation.d.ts +0 -3
  46. package/dist/contexts/navigation.js +0 -3
  47. package/dist/contexts/search.d.ts +0 -4
  48. package/dist/contexts/search.js +0 -16
  49. package/dist/contexts/use-components.d.ts +0 -16
  50. package/dist/contexts/use-components.js +0 -4
  51. package/dist/contexts-DRxRO-xO.js +0 -3747
  52. package/dist/docs-Dh8kE1va.js +0 -50
  53. package/dist/docs-EUy-wfbA.d.ts +0 -43
  54. package/dist/dropdown-B7VyGMOw.d.ts +0 -43
  55. package/dist/dropdown-DtgAi6lb.js +0 -62
  56. package/dist/icons-DdKM-01E.js +0 -753
  57. package/dist/index-AicgPYKB.d.ts +0 -239
  58. package/dist/index-BhwLhiWk.d.ts +0 -14
  59. package/dist/index-YnpUtXLB.d.ts +0 -16
  60. package/dist/index.d.ts +0 -22
  61. package/dist/languages/go.d.ts +0 -13
  62. package/dist/languages/go.js +0 -16
  63. package/dist/languages/http.d.ts +0 -13
  64. package/dist/languages/http.js +0 -16
  65. package/dist/languages/index.d.ts +0 -13
  66. package/dist/languages/index.js +0 -16
  67. package/dist/languages/java.d.ts +0 -13
  68. package/dist/languages/java.js +0 -16
  69. package/dist/languages/python.d.ts +0 -13
  70. package/dist/languages/python.js +0 -16
  71. package/dist/languages/ruby.d.ts +0 -13
  72. package/dist/languages/ruby.js +0 -16
  73. package/dist/languages/typescript.d.ts +0 -13
  74. package/dist/languages/typescript.js +0 -16
  75. package/dist/markdown/index.d.ts +0 -11
  76. package/dist/markdown/index.js +0 -16
  77. package/dist/markdown/md.d.ts +0 -15
  78. package/dist/markdown/md.js +0 -3
  79. package/dist/markdown/utils.d.ts +0 -4
  80. package/dist/markdown/utils.js +0 -3
  81. package/dist/markdown-BXfX1D7C.js +0 -42
  82. package/dist/markdown-nFyAEX_K.d.ts +0 -22
  83. package/dist/mcp.js +0 -983441
  84. package/dist/md-Dg8aOyMA.js +0 -41
  85. package/dist/method-DpsVuzZW.d.ts +0 -71
  86. package/dist/navigation-aoYZ_tl4.js +0 -24
  87. package/dist/navigation-nyXBY-75.d.ts +0 -29
  88. package/dist/overview-C8e-6jGr.d.ts +0 -38
  89. package/dist/pagefind-ChrPfuVv.js +0 -15
  90. package/dist/primitives-DWz23_Ub.d.ts +0 -99
  91. package/dist/properties-CF71V58d.d.ts +0 -46
  92. package/dist/routing-DQjbRxdJ.js +0 -189
  93. package/dist/routing-qc0V00-j.d.ts +0 -51
  94. package/dist/routing.d.ts +0 -2
  95. package/dist/sdk-Zg3Rggk3.d.ts +0 -118
  96. package/dist/search/index.d.ts +0 -26
  97. package/dist/search/index.js +0 -332
  98. package/dist/search/providers/algolia.d.ts +0 -23
  99. package/dist/search/providers/algolia.js +0 -16
  100. package/dist/search/providers/fuse.d.ts +0 -17
  101. package/dist/search/providers/fuse.js +0 -31
  102. package/dist/search/providers/pagefind.d.ts +0 -7
  103. package/dist/search/providers/pagefind.js +0 -3
  104. package/dist/search/providers/walker.d.ts +0 -8
  105. package/dist/search/providers/walker.js +0 -32
  106. package/dist/search/types.d.ts +0 -3
  107. package/dist/search/types.js +0 -3
  108. package/dist/search-B6loAGmB.d.ts +0 -21
  109. package/dist/sidebar-C8KirYjg.d.ts +0 -35
  110. package/dist/snippets-EUzM4fRO.d.ts +0 -45
  111. package/dist/style-pN9hCoec.d.ts +0 -181
  112. package/dist/style-rYbbxIR_.js +0 -182
  113. package/dist/style.d.ts +0 -2
  114. package/dist/style.js +0 -3
  115. package/dist/types-CTBDtD34.d.ts +0 -82
  116. package/dist/types-DFN4M1Sp.js +0 -34
  117. package/dist/use-components-D9E85p5x.js +0 -7
  118. package/dist/utils-BHwvUDKn.js +0 -30
  119. package/dist/utils-CJfFBNgT.js +0 -32
  120. package/dist/utils-DQhEbvUC.d.ts +0 -20
  121. package/dist/utils-nDazhti8.d.ts +0 -11
  122. package/dist/utils.d.ts +0 -2
  123. package/dist/utils.js +0 -4
@@ -1,118 +0,0 @@
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 };
@@ -1,26 +0,0 @@
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 };
@@ -1,332 +0,0 @@
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,23 +0,0 @@
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;
21
- }): Promise<ResultType | undefined>;
22
- //#endregion
23
- export { buildChatIndex, buildIndex, search };
@@ -1,16 +0,0 @@
1
- import "../../component-generics-DzI21jRn.js";
2
- import "../../docs-Dh8kE1va.js";
3
- import "../../navigation-aoYZ_tl4.js";
4
- import "../../markdown-BXfX1D7C.js";
5
- import "../../routing-DQjbRxdJ.js";
6
- import "../../style-rYbbxIR_.js";
7
- import "../../use-components-D9E85p5x.js";
8
- import { c as search, o as buildChatIndex, s as buildIndex } 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 "../../types-DFN4M1Sp.js";
15
-
16
- export { buildChatIndex, buildIndex, search };
@@ -1,17 +0,0 @@
1
- import { t as DocsLanguage } from "../../routing-qc0V00-j.js";
2
- import { n as IndexEntry } from "../../types-CTBDtD34.js";
3
- import * as fuse_js0 from "fuse.js";
4
- import { FuseIndex } from "fuse.js";
5
-
6
- //#region src/search/providers/fuse.d.ts
7
- type FuseIndexData = {
8
- content: IndexEntry[];
9
- index: FuseIndex<IndexEntry>;
10
- };
11
- declare function buildIndex(spec: SDKJSON.Spec, language?: DocsLanguage): FuseIndexData;
12
- declare function search({
13
- content,
14
- index
15
- }: FuseIndexData, query: string, limit?: number): fuse_js0.FuseResult<IndexEntry>[];
16
- //#endregion
17
- export { FuseIndexData, buildIndex, search };
@@ -1,31 +0,0 @@
1
- import "../../component-generics-DzI21jRn.js";
2
- import "../../docs-Dh8kE1va.js";
3
- import "../../navigation-aoYZ_tl4.js";
4
- import "../../markdown-BXfX1D7C.js";
5
- import "../../routing-DQjbRxdJ.js";
6
- import "../../style-rYbbxIR_.js";
7
- import "../../use-components-D9E85p5x.js";
8
- import { l as generateIndex } 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 { n as SearchableAttributes } from "../../types-DFN4M1Sp.js";
15
- import Fuse from "fuse.js";
16
-
17
- //#region src/search/providers/fuse.ts
18
- function buildIndex(spec, language) {
19
- const idx = Array.from(generateIndex(spec, null, false));
20
- const content = language ? idx.filter((entry) => entry.language === language) : idx;
21
- return {
22
- content,
23
- index: Fuse.createIndex(SearchableAttributes, content)
24
- };
25
- }
26
- function search({ content, index }, query, limit = 100) {
27
- return new Fuse(content, { keys: SearchableAttributes }, index).search(query).slice(0, limit);
28
- }
29
-
30
- //#endregion
31
- export { buildIndex, search };
@@ -1,7 +0,0 @@
1
- import "../../routing-qc0V00-j.js";
2
- import { t as GuideResultType } from "../../types-CTBDtD34.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-ChrPfuVv.js";
2
-
3
- export { guideSearch };
@@ -1,8 +0,0 @@
1
- import { t as DocsLanguage } from "../../routing-qc0V00-j.js";
2
- import { n as IndexEntry } from "../../types-CTBDtD34.js";
3
-
4
- //#region src/search/providers/walker.d.ts
5
- declare function buildIndex(spec: SDKJSON.Spec): Generator<IndexEntry, any, any>;
6
- declare function search(index: Generator<IndexEntry>, language: DocsLanguage, query: string, limit?: number): IndexEntry[];
7
- //#endregion
8
- export { buildIndex, search };
@@ -1,32 +0,0 @@
1
- import "../../component-generics-DzI21jRn.js";
2
- import "../../docs-Dh8kE1va.js";
3
- import "../../navigation-aoYZ_tl4.js";
4
- import "../../markdown-BXfX1D7C.js";
5
- import "../../routing-DQjbRxdJ.js";
6
- import "../../style-rYbbxIR_.js";
7
- import "../../use-components-D9E85p5x.js";
8
- import { l as generateIndex } 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 { n as SearchableAttributes } from "../../types-DFN4M1Sp.js";
15
-
16
- //#region src/search/providers/walker.ts
17
- function buildIndex(spec) {
18
- return generateIndex(spec, null, false);
19
- }
20
- function* findEntryInIndex(index, language, query) {
21
- for (const entry of index) {
22
- if (entry.language !== language) continue;
23
- for (const attr of SearchableAttributes) if (entry[attr] && typeof entry[attr] === "string" && entry[attr].includes(query)) yield entry;
24
- }
25
- }
26
- function search(index, language, query, limit = 100) {
27
- const results = findEntryInIndex(index, language, query);
28
- return Array.from(results).sort((a, b) => a.priority - b.priority).slice(0, limit);
29
- }
30
-
31
- //#endregion
32
- export { buildIndex, search };
@@ -1,3 +0,0 @@
1
- import "../routing-qc0V00-j.js";
2
- import { _ as SearchableAttributesChat, a as IndexProperty, c as QueryKindsType, d as ResultType, f as RoutableJsonNode, g as SearchableAttributes, h as SearchSettings, i as IndexModel, l as ResultData, m as SearchParams, n as IndexEntry, o as IndexResource, p as SearchAttributeNames, r as IndexMethod, s as QueryKinds, t as GuideResultType, u as ResultRecordType } from "../types-CTBDtD34.js";
3
- export { GuideResultType, IndexEntry, IndexMethod, IndexModel, IndexProperty, IndexResource, QueryKinds, QueryKindsType, ResultData, ResultRecordType, ResultType, RoutableJsonNode, SearchAttributeNames, SearchParams, SearchSettings, SearchableAttributes, SearchableAttributesChat };
@@ -1,3 +0,0 @@
1
- import { n as SearchableAttributes, r as SearchableAttributesChat, t as QueryKinds } from "../types-DFN4M1Sp.js";
2
-
3
- export { QueryKinds, SearchableAttributes, SearchableAttributesChat };
@@ -1,21 +0,0 @@
1
- import { d as ResultType, h as SearchSettings, m as SearchParams } from "./types-CTBDtD34.js";
2
- import * as React$1 from "react";
3
- import * as react_jsx_runtime63 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 function 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_runtime63.JSX.Element;
20
- //#endregion
21
- export { useSearchContext as a, useSearch as i, SearchProvider as n, SearchProviderProps as r, SearchContextType as t };