@stainless-api/docs-ui 0.1.0-beta.9 → 0.1.0-beta.91

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 (162) hide show
  1. package/dist/breadcrumbs-BaNU4WsC.d.ts +25 -0
  2. package/dist/chunk-pbuEa-1d.js +13 -0
  3. package/dist/component-generics-D9XaPlr8.d.ts +30 -0
  4. package/dist/component-generics-DYxBWv1v.js +42 -0
  5. package/dist/components/MaskedInput.d.ts +14 -0
  6. package/dist/components/MaskedInput.js +74 -0
  7. package/dist/components/breadcrumbs.d.ts +2 -0
  8. package/dist/components/breadcrumbs.js +61 -0
  9. package/dist/components/icons.d.ts +72 -0
  10. package/dist/components/icons.js +953 -0
  11. package/dist/components/index.d.ts +10 -0
  12. package/dist/components/index.js +72 -0
  13. package/dist/components/method.d.ts +2 -0
  14. package/dist/components/method.js +94 -0
  15. package/dist/components/overview.d.ts +2 -0
  16. package/dist/components/overview.js +139 -0
  17. package/dist/components/primitives.d.ts +2 -0
  18. package/dist/components/primitives.js +250 -0
  19. package/dist/components/properties.d.ts +2 -0
  20. package/dist/components/properties.js +143 -0
  21. package/dist/components/sdk-sidebar.d.ts +2 -0
  22. package/dist/components/sdk-sidebar.js +49 -0
  23. package/dist/components/sdk.d.ts +2 -0
  24. package/dist/components/sdk.js +487 -0
  25. package/dist/components/snippets.d.ts +2 -0
  26. package/dist/components/snippets.js +183 -0
  27. package/dist/components/stl-sidebar.d.ts +2 -0
  28. package/dist/components/stl-sidebar.js +111 -0
  29. package/dist/contexts/component-generics.d.ts +2 -0
  30. package/dist/contexts/component-generics.js +2 -0
  31. package/dist/contexts/component-types.d.ts +7 -0
  32. package/dist/contexts/component-types.js +0 -0
  33. package/dist/contexts/component.d.ts +20 -0
  34. package/dist/contexts/component.js +21 -0
  35. package/dist/contexts/docs.d.ts +2 -0
  36. package/dist/contexts/docs.js +89 -0
  37. package/dist/contexts/index.d.ts +6 -0
  38. package/dist/contexts/index.js +43 -0
  39. package/dist/contexts/markdown.d.ts +2 -0
  40. package/dist/contexts/markdown.js +62 -0
  41. package/dist/contexts/navigation.d.ts +2 -0
  42. package/dist/contexts/navigation.js +21 -0
  43. package/dist/contexts/use-components.d.ts +6 -0
  44. package/dist/contexts/use-components.js +5 -0
  45. package/dist/docs-D0qzNoXq.d.ts +62 -0
  46. package/dist/index-DFr9Mesr.d.ts +1776 -0
  47. package/dist/index-Dt9uPKZP.d.ts +464 -0
  48. package/dist/index.d.ts +5 -0
  49. package/dist/index.js +7 -7542
  50. package/dist/languages/cli.d.ts +2 -0
  51. package/dist/languages/cli.js +164 -0
  52. package/dist/languages/csharp.d.ts +2 -0
  53. package/dist/languages/csharp.js +281 -0
  54. package/dist/languages/go.d.ts +2 -0
  55. package/dist/languages/go.js +301 -0
  56. package/dist/languages/http.d.ts +2 -0
  57. package/dist/languages/http.js +381 -0
  58. package/dist/languages/index.d.ts +2 -0
  59. package/dist/languages/index.js +30 -0
  60. package/dist/languages/java.d.ts +2 -0
  61. package/dist/languages/java.js +401 -0
  62. package/dist/languages/php.d.ts +2 -0
  63. package/dist/languages/php.js +310 -0
  64. package/dist/languages/python.d.ts +2 -0
  65. package/dist/languages/python.js +267 -0
  66. package/dist/languages/ruby.d.ts +2 -0
  67. package/dist/languages/ruby.js +385 -0
  68. package/dist/languages/terraform.d.ts +2 -0
  69. package/dist/languages/terraform.js +258 -0
  70. package/dist/languages/typescript.d.ts +2 -0
  71. package/dist/languages/typescript.js +447 -0
  72. package/dist/markdown/index.d.ts +11 -0
  73. package/dist/markdown/index.js +86 -0
  74. package/dist/markdown/md.d.ts +15 -0
  75. package/dist/markdown/md.js +39 -0
  76. package/dist/markdown/printer.d.ts +13 -0
  77. package/dist/markdown/printer.js +73 -0
  78. package/dist/markdown/utils.d.ts +28 -0
  79. package/dist/markdown/utils.js +31 -0
  80. package/dist/markdown-B30HO-Vy.d.ts +33 -0
  81. package/dist/method-BKJnP-rW.d.ts +59 -0
  82. package/dist/navigation-DGl8lR6w.d.ts +29 -0
  83. package/dist/overview-iH1evPEF.d.ts +39 -0
  84. package/dist/primitives-BHt-BuLf.d.ts +107 -0
  85. package/dist/properties-CCbMRhSX.d.ts +54 -0
  86. package/dist/routing-yTSG7nWM.d.ts +61 -0
  87. package/dist/routing.d.ts +2 -0
  88. package/dist/routing.js +174 -150
  89. package/dist/sdk-BengV7mg.d.ts +128 -0
  90. package/dist/sdk-sidebar-CRqLm3YO.d.ts +15 -0
  91. package/dist/spec.d.ts +65 -0
  92. package/dist/spec.js +165 -0
  93. package/dist/stl-sidebar-Pra9uCYo.d.ts +58 -0
  94. package/dist/style.d.ts +178 -0
  95. package/dist/style.js +178 -0
  96. package/dist/styles/main.css +765 -755
  97. package/dist/styles/primitives.css +359 -442
  98. package/dist/styles/resets.css +25 -41
  99. package/dist/styles/search.css +187 -270
  100. package/dist/styles/sidebar.css +155 -69
  101. package/dist/styles/variables.css +23 -89
  102. package/dist/styles.css +3171 -0
  103. package/dist/utils.d.ts +20 -0
  104. package/dist/utils.js +52 -0
  105. package/package.json +75 -22
  106. package/dist/mcp.js +0 -16003
  107. package/dist/styles/snippets.css +0 -132
  108. package/src/components/breadcrumbs.tsx +0 -94
  109. package/src/components/chat.tsx +0 -154
  110. package/src/components/dropdown.tsx +0 -91
  111. package/src/components/icons.tsx +0 -584
  112. package/src/components/index.ts +0 -9
  113. package/src/components/method.tsx +0 -146
  114. package/src/components/overview.tsx +0 -160
  115. package/src/components/primitives.tsx +0 -284
  116. package/src/components/properties.tsx +0 -130
  117. package/src/components/scripts/dropdown.ts +0 -78
  118. package/src/components/sdk.tsx +0 -403
  119. package/src/components/sidebar.tsx +0 -99
  120. package/src/components/snippets.tsx +0 -180
  121. package/src/contexts/component-generics.tsx +0 -48
  122. package/src/contexts/component-types.tsx +0 -5
  123. package/src/contexts/component.tsx +0 -32
  124. package/src/contexts/docs.tsx +0 -75
  125. package/src/contexts/index.tsx +0 -17
  126. package/src/contexts/markdown.tsx +0 -43
  127. package/src/contexts/navigation.tsx +0 -44
  128. package/src/contexts/search.tsx +0 -28
  129. package/src/contexts/use-components.tsx +0 -4
  130. package/src/index.ts +0 -6
  131. package/src/languages/go.tsx +0 -281
  132. package/src/languages/http.tsx +0 -321
  133. package/src/languages/index.ts +0 -26
  134. package/src/languages/java.tsx +0 -358
  135. package/src/languages/python.tsx +0 -255
  136. package/src/languages/ruby.tsx +0 -320
  137. package/src/languages/typescript.tsx +0 -393
  138. package/src/markdown/index.ts +0 -107
  139. package/src/markdown/md.ts +0 -45
  140. package/src/markdown/utils.ts +0 -49
  141. package/src/routing.ts +0 -238
  142. package/src/search/form.tsx +0 -127
  143. package/src/search/index.tsx +0 -1
  144. package/src/search/indexer.ts +0 -246
  145. package/src/search/mcp.ts +0 -61
  146. package/src/search/printer.tsx +0 -86
  147. package/src/search/providers/algolia.ts +0 -88
  148. package/src/search/providers/fuse.ts +0 -19
  149. package/src/search/providers/pagefind.ts +0 -17
  150. package/src/search/providers/walker.ts +0 -30
  151. package/src/search/results.tsx +0 -182
  152. package/src/search/state.ts +0 -64
  153. package/src/search/types.ts +0 -116
  154. package/src/style.ts +0 -196
  155. package/src/styles/main.css +0 -986
  156. package/src/styles/primitives.css +0 -580
  157. package/src/styles/resets.css +0 -39
  158. package/src/styles/search.css +0 -341
  159. package/src/styles/sidebar.css +0 -85
  160. package/src/styles/snippets.css +0 -130
  161. package/src/styles/variables.css +0 -86
  162. package/src/utils.ts +0 -41
@@ -0,0 +1,301 @@
1
+ import { t as __exportAll } from "../chunk-pbuEa-1d.js";
2
+ import { useLanguageComponents } from "../contexts/index.js";
3
+ import { useComponents } from "../contexts/use-components.js";
4
+ import style_default from "../style.js";
5
+ import * as React$1 from "react";
6
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
+ //#region src/languages/go.tsx
8
+ var go_exports = /* @__PURE__ */ __exportAll({
9
+ Declaration: () => Declaration,
10
+ MethodSignature: () => MethodSignature,
11
+ Property: () => Property,
12
+ Type: () => Type,
13
+ TypeName: () => TypeName
14
+ });
15
+ const ComplexTypes = {
16
+ GoTypeMap: "map",
17
+ GoTypeArray: "array"
18
+ };
19
+ const Keywords = {
20
+ GoTypeAny: "any",
21
+ GoTypeUnknown: "unknown",
22
+ GoTypeInt: "int64",
23
+ GoTypeFloat: "float64",
24
+ GoTypeBool: "bool",
25
+ GoTypeError: "error"
26
+ };
27
+ function isField(type) {
28
+ return type.kind === "GoTypeReference" && type.typeName === "param.Field";
29
+ }
30
+ function TypeName({ type }) {
31
+ const Lang = useLanguageComponents();
32
+ return isField(type) ? "field" : ComplexTypes[type.kind] ?? /* @__PURE__ */ jsx(Lang.Type, { type });
33
+ }
34
+ function Type({ type }) {
35
+ const Lang = useLanguageComponents();
36
+ const { Join, SDKReference } = useComponents();
37
+ switch (type.kind) {
38
+ case "GoTypeReference": {
39
+ const params = type.typeParameters?.map((param, key) => /* @__PURE__ */ jsx(Lang.Type, { type: param }, key));
40
+ return /* @__PURE__ */ jsxs("span", {
41
+ className: style_default.Type,
42
+ children: [type.$ref ? /* @__PURE__ */ jsx(SDKReference, {
43
+ stainlessPath: type.$ref,
44
+ children: type.typeName
45
+ }) : type.typeName, params && params.length > 0 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
46
+ /* @__PURE__ */ jsx("span", {
47
+ className: style_default.TypeBracket,
48
+ children: "["
49
+ }),
50
+ /* @__PURE__ */ jsx(Join, {
51
+ items: params,
52
+ limit: 3,
53
+ children: /* @__PURE__ */ jsx("span", {
54
+ className: style_default.TextOperator,
55
+ children: ", "
56
+ })
57
+ }),
58
+ /* @__PURE__ */ jsx("span", {
59
+ className: style_default.TypeBracket,
60
+ children: "]"
61
+ })
62
+ ] }) : null]
63
+ });
64
+ }
65
+ case "GoTypeAny":
66
+ case "GoTypeUnknown":
67
+ case "GoTypeInt":
68
+ case "GoTypeFloat":
69
+ case "GoTypeBool":
70
+ case "GoTypeError": return /* @__PURE__ */ jsx("span", {
71
+ className: style_default.Type,
72
+ children: /* @__PURE__ */ jsx("span", {
73
+ className: style_default.TypeKeyword,
74
+ children: Keywords[type.kind]
75
+ })
76
+ });
77
+ case "GoTypeString": return /* @__PURE__ */ jsx("span", {
78
+ className: style_default.Type,
79
+ children: /* @__PURE__ */ jsx("span", {
80
+ className: style_default.TypeString,
81
+ children: "string"
82
+ })
83
+ });
84
+ case "GoTypeArray": return /* @__PURE__ */ jsxs("span", {
85
+ className: style_default.Type,
86
+ children: [/* @__PURE__ */ jsx("span", {
87
+ className: style_default.TextOperator,
88
+ children: "[]"
89
+ }), /* @__PURE__ */ jsx(Lang.Type, { type: type.elementType })]
90
+ });
91
+ case "GoTypeStruct": return /* @__PURE__ */ jsx("span", {
92
+ className: style_default.Type,
93
+ children: /* @__PURE__ */ jsx("span", {
94
+ className: style_default.TypeKeyword,
95
+ children: "struct{…}"
96
+ })
97
+ });
98
+ case "GoTypeInterface": return /* @__PURE__ */ jsx("span", {
99
+ className: style_default.Type,
100
+ children: /* @__PURE__ */ jsx("span", {
101
+ className: style_default.TypeKeyword,
102
+ children: "interface{…}"
103
+ })
104
+ });
105
+ case "GoTypeMap": return /* @__PURE__ */ jsxs("span", {
106
+ className: style_default.Type,
107
+ children: [
108
+ /* @__PURE__ */ jsx("span", {
109
+ className: style_default.TypeKeyword,
110
+ children: "map"
111
+ }),
112
+ /* @__PURE__ */ jsx("span", {
113
+ className: style_default.TypeBracket,
114
+ children: "["
115
+ }),
116
+ /* @__PURE__ */ jsx(Lang.Type, { type: type.indexType }),
117
+ /* @__PURE__ */ jsx("span", {
118
+ className: style_default.TextPunctuation,
119
+ children: ","
120
+ }),
121
+ " ",
122
+ /* @__PURE__ */ jsx(Lang.Type, { type: type.itemType }),
123
+ /* @__PURE__ */ jsx("span", {
124
+ className: style_default.TypeBracket,
125
+ children: "]"
126
+ })
127
+ ]
128
+ });
129
+ case "GoTypePointer": return /* @__PURE__ */ jsxs("span", {
130
+ className: style_default.Type,
131
+ children: [/* @__PURE__ */ jsx("span", {
132
+ className: style_default.TextOperator,
133
+ children: "*"
134
+ }), /* @__PURE__ */ jsx(Lang.Type, { type: type.inner })]
135
+ });
136
+ }
137
+ }
138
+ function MethodSignature({ decl }) {
139
+ const Lang = useLanguageComponents();
140
+ const { Join } = useComponents();
141
+ const params = decl.parameters.map((param, i) => /* @__PURE__ */ jsxs(React$1.Fragment, { children: [/* @__PURE__ */ jsx("span", {
142
+ className: style_default.TextIdentifier,
143
+ children: param.ident
144
+ }), param.optional && /* @__PURE__ */ jsx("span", {
145
+ className: style_default.TextPunctuation,
146
+ children: "?"
147
+ })] }, i));
148
+ const returns = decl.returnType.map((t, key) => /* @__PURE__ */ jsx(Lang.Type, { type: t }, key));
149
+ return /* @__PURE__ */ jsx("div", {
150
+ className: style_default.MethodSignature,
151
+ children: /* @__PURE__ */ jsxs("span", {
152
+ className: style_default.SignatureTitle,
153
+ children: [
154
+ decl.async && /* @__PURE__ */ jsx("span", {
155
+ className: style_default.TextKeyword,
156
+ children: "async "
157
+ }),
158
+ decl.qualified && /* @__PURE__ */ jsx("span", {
159
+ className: style_default.SignatureQualified,
160
+ children: /* @__PURE__ */ jsx("span", {
161
+ className: style_default.TextIdentifier,
162
+ children: decl.qualified?.slice(0, -decl.ident.length)
163
+ })
164
+ }),
165
+ decl.kind === "GoDeclFunction" && /* @__PURE__ */ jsx("span", {
166
+ className: style_default.SignatureName,
167
+ children: /* @__PURE__ */ jsx("span", {
168
+ className: style_default.TextIdentifier,
169
+ children: decl.ident
170
+ })
171
+ }),
172
+ /* @__PURE__ */ jsxs("span", {
173
+ className: style_default.MethodSignature,
174
+ children: [
175
+ /* @__PURE__ */ jsx("span", {
176
+ className: style_default.SignatureParen,
177
+ children: "("
178
+ }),
179
+ /* @__PURE__ */ jsx("span", {
180
+ className: style_default.SignatureParams,
181
+ children: /* @__PURE__ */ jsx(Join, {
182
+ items: params,
183
+ children: /* @__PURE__ */ jsx("span", {
184
+ className: style_default.TextOperator,
185
+ children: ", "
186
+ })
187
+ })
188
+ }),
189
+ /* @__PURE__ */ jsxs("span", {
190
+ className: style_default.SignatureParen,
191
+ children: [")", " "]
192
+ }),
193
+ decl.returnType.length === 1 ? returns : /* @__PURE__ */ jsxs(Fragment$1, { children: [
194
+ /* @__PURE__ */ jsx("span", {
195
+ className: style_default.SignatureParen,
196
+ children: "("
197
+ }),
198
+ /* @__PURE__ */ jsx(Join, {
199
+ items: returns,
200
+ children: /* @__PURE__ */ jsx("span", {
201
+ className: style_default.TextOperator,
202
+ children: ", "
203
+ })
204
+ }),
205
+ /* @__PURE__ */ jsx("span", {
206
+ className: style_default.SignatureParen,
207
+ children: ")"
208
+ })
209
+ ] })
210
+ ]
211
+ })
212
+ ]
213
+ })
214
+ });
215
+ }
216
+ function Property({ decl, children }) {
217
+ const Docs = useComponents();
218
+ const Lang = useLanguageComponents();
219
+ if (!decl) return null;
220
+ switch (decl.kind) {
221
+ case "GoDeclProperty": return children({
222
+ name: decl.ident,
223
+ typeName: /* @__PURE__ */ jsx(Lang.TypeName, { type: decl.type }),
224
+ badges: decl.optional && /* @__PURE__ */ jsx(Docs.Badge, { id: "optional" }),
225
+ type: (isField(decl.type) || decl.type.kind in ComplexTypes) && /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
226
+ });
227
+ case "GoDeclConst": return children({
228
+ name: decl.ident,
229
+ typeName: "const",
230
+ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
231
+ });
232
+ case "GoDeclReference": return children({ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type }) });
233
+ case "GoDeclType":
234
+ case "GoDeclTypeAlias": {
235
+ const typeName = decl.type.kind === "GoTypeStruct" ? "struct" : decl.type.kind === "GoTypeInterface" ? "interface" : decl.kind === "GoDeclTypeAlias" ? "alias" : "type";
236
+ return children({
237
+ name: decl.ident,
238
+ typeName,
239
+ type: ["GoTypeStruct", "GoTypeInterface"].includes(decl.type.kind) || /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
240
+ });
241
+ }
242
+ }
243
+ }
244
+ function Declaration({ decl }) {
245
+ const Lang = useLanguageComponents();
246
+ if (!decl) return;
247
+ switch (decl.kind) {
248
+ case "GoDeclType": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
249
+ /* @__PURE__ */ jsx("span", {
250
+ className: style_default.TextKeyword,
251
+ children: "type "
252
+ }),
253
+ /* @__PURE__ */ jsxs("span", {
254
+ className: style_default.TextIdentifier,
255
+ children: [decl.ident, " "]
256
+ }),
257
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
258
+ ] });
259
+ case "GoDeclTypeAlias": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
260
+ /* @__PURE__ */ jsx("span", {
261
+ className: style_default.TextKeyword,
262
+ children: "type "
263
+ }),
264
+ /* @__PURE__ */ jsxs("span", {
265
+ className: style_default.TextIdentifier,
266
+ children: [decl.ident, " "]
267
+ }),
268
+ /* @__PURE__ */ jsx("span", {
269
+ className: style_default.TextOperator,
270
+ children: "= "
271
+ }),
272
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
273
+ ] });
274
+ case "GoDeclProperty": return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
275
+ className: style_default.TypePropertyName,
276
+ children: /* @__PURE__ */ jsxs("span", {
277
+ className: style_default.TextIdentifier,
278
+ children: [decl.ident, " "]
279
+ })
280
+ }), /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })] });
281
+ case "GoDeclReference": return /* @__PURE__ */ jsx(Lang.Type, { type: decl.type });
282
+ case "GoDeclConst": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
283
+ /* @__PURE__ */ jsx("span", {
284
+ className: style_default.TextKeyword,
285
+ children: "const "
286
+ }),
287
+ /* @__PURE__ */ jsxs("span", {
288
+ className: style_default.TextIdentifier,
289
+ children: [decl.ident, " "]
290
+ }),
291
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type }),
292
+ /* @__PURE__ */ jsx("span", {
293
+ className: style_default.TextOperator,
294
+ children: " = "
295
+ }),
296
+ JSON.stringify(decl.value)
297
+ ] });
298
+ }
299
+ }
300
+ //#endregion
301
+ export { Declaration, MethodSignature, Property, Type, TypeName, go_exports as t };
@@ -0,0 +1,2 @@
1
+ import { ct as Declaration, dt as MethodSignature, ft as MethodSignatureProps, gt as TypeName, ht as Type, lt as DeclarationProps, mt as PropertyProps, pt as Property, ut as MethodInfo } from "../index-Dt9uPKZP.js";
2
+ export { Declaration, DeclarationProps, MethodInfo, MethodSignature, MethodSignatureProps, Property, PropertyProps, Type, TypeName };
@@ -0,0 +1,381 @@
1
+ import { t as __exportAll } from "../chunk-pbuEa-1d.js";
2
+ import { useAvailableLanguages, useDeclaration, useLanguage, useSpec } from "../contexts/docs.js";
3
+ import { useNavigation } from "../contexts/navigation.js";
4
+ import { useLanguageComponents } from "../contexts/index.js";
5
+ import { useComponents } from "../contexts/use-components.js";
6
+ import style_default from "../style.js";
7
+ import { PropertyToggle } from "../components/properties.js";
8
+ import { LanguageNames, generateRoute } from "../routing.js";
9
+ import { useStreamingResponse } from "../components/sdk.js";
10
+ import { getBodyParams } from "../utils.js";
11
+ import "../components/index.js";
12
+ import React from "react";
13
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
14
+ import clsx from "clsx";
15
+ import { BracesIcon, FormIcon } from "lucide-react";
16
+ import { Badge } from "@stainless-api/ui-primitives";
17
+ //#region src/languages/http.tsx
18
+ var http_exports = /* @__PURE__ */ __exportAll({
19
+ Declaration: () => Declaration,
20
+ MethodInfo: () => MethodInfo,
21
+ MethodSignature: () => MethodSignature,
22
+ Property: () => Property,
23
+ Type: () => Type,
24
+ TypeName: () => TypeName
25
+ });
26
+ const ComplexTypes = {
27
+ HttpTypeUnion: "union",
28
+ HttpTypeIntersection: "intersection"
29
+ };
30
+ const constStyle = {
31
+ string: style_default.LiteralString,
32
+ number: style_default.LiteralNumeric,
33
+ boolean: style_default.LiteralBoolean
34
+ };
35
+ function Identifier({ name }) {
36
+ return /* @__PURE__ */ jsx("span", {
37
+ className: style_default.TextIdentifier,
38
+ children: /^[_a-zA-Z][_a-zA-Z0-9]*$/.test(name) ? name : JSON.stringify(name)
39
+ });
40
+ }
41
+ function TypePreview({ path }) {
42
+ const spec = useSpec();
43
+ const language = useLanguage();
44
+ const decl = useDeclaration(path, false);
45
+ const { Join } = useComponents();
46
+ if (!(decl && "children" in decl && decl.children && decl.children.length > 0) || "type" in decl && decl["type"] && "kind" in decl["type"] && decl["type"]["kind"] === "HttpTypeUnion") return;
47
+ const items = decl.children.map((prop, key) => {
48
+ const decl = spec?.decls?.[language]?.[prop];
49
+ const ident = decl && "key" in decl ? decl.key : decl && "ident" in decl ? decl.ident : null;
50
+ return /* @__PURE__ */ jsx("span", {
51
+ className: style_default.TypePropertyName,
52
+ children: /* @__PURE__ */ jsx("span", {
53
+ className: style_default.TextIdentifier,
54
+ children: ident
55
+ })
56
+ }, key);
57
+ });
58
+ return /* @__PURE__ */ jsxs("span", {
59
+ className: style_default.TypePreview,
60
+ "data-stldocs-type-preview": "properties",
61
+ children: [
62
+ /* @__PURE__ */ jsx("span", {
63
+ className: style_default.TypeBrace,
64
+ children: " { "
65
+ }),
66
+ /* @__PURE__ */ jsx("span", {
67
+ className: style_default.TypePreviewContent,
68
+ children: /* @__PURE__ */ jsx(Join, {
69
+ items,
70
+ limit: 3,
71
+ children: /* @__PURE__ */ jsx("span", {
72
+ className: style_default.TextOperator,
73
+ children: ", "
74
+ })
75
+ })
76
+ }),
77
+ /* @__PURE__ */ jsx("span", {
78
+ className: style_default.TypeBrace,
79
+ children: " } "
80
+ })
81
+ ]
82
+ });
83
+ }
84
+ function TypeName({ type }) {
85
+ const Lang = useLanguageComponents();
86
+ if (type.kind === "HttpTypeArray") return /* @__PURE__ */ jsxs(Fragment$1, { children: ["array of ", /* @__PURE__ */ jsx(Lang.TypeName, { type: type.elementType })] });
87
+ if (type.kind === "HttpTypeUnion" && type.types.every((t) => t.kind === "HttpTypeLiteral")) return "enum";
88
+ if (type.kind === "HttpTypeReference" && type.ident.split(".").at(-1) === "Record") return "map";
89
+ return ComplexTypes[type.kind] ?? /* @__PURE__ */ jsx(Lang.Type, { type });
90
+ }
91
+ function Type({ type }) {
92
+ const Lang = useLanguageComponents();
93
+ const { Join, SDKReference } = useComponents();
94
+ switch (type.kind) {
95
+ case "HttpTypeUnknown":
96
+ case "HttpTypeUndefined":
97
+ case "HttpTypeNull":
98
+ case "HttpTypeBoolean":
99
+ case "HttpTypeNumber":
100
+ case "HttpTypeString": return /* @__PURE__ */ jsx("span", {
101
+ className: style_default.Type,
102
+ children: /* @__PURE__ */ jsx("span", {
103
+ className: style_default.TypePlain,
104
+ children: type.kind.slice(8).toLowerCase()
105
+ })
106
+ });
107
+ case "HttpTypeBinary": return /* @__PURE__ */ jsx("span", {
108
+ className: style_default.Type,
109
+ children: /* @__PURE__ */ jsx("span", {
110
+ className: style_default.TypePlain,
111
+ children: "file"
112
+ })
113
+ });
114
+ case "HttpTypeLiteral": return /* @__PURE__ */ jsx("span", {
115
+ className: style_default.Type,
116
+ children: /* @__PURE__ */ jsx("span", {
117
+ className: constStyle[typeof type.literal],
118
+ children: JSON.stringify(type.literal)
119
+ })
120
+ });
121
+ case "HttpTypeArray": return /* @__PURE__ */ jsxs("span", {
122
+ className: style_default.Type,
123
+ children: [/* @__PURE__ */ jsx("span", {
124
+ className: style_default.TypeArray,
125
+ children: "array of "
126
+ }), /* @__PURE__ */ jsx(Lang.Type, { type: type.elementType })]
127
+ });
128
+ case "HttpTypeIntersection":
129
+ case "HttpTypeUnion": {
130
+ const items = type.types.map((t, key) => /* @__PURE__ */ jsx(Lang.Type, { type: t }, key));
131
+ const delimiter = type.kind === "HttpTypeUnion" ? "or" : "and";
132
+ return /* @__PURE__ */ jsx("span", {
133
+ className: style_default.Type,
134
+ children: /* @__PURE__ */ jsx("span", {
135
+ className: style_default.TypePreview,
136
+ "data-stldocs-type-preview": "union",
137
+ children: /* @__PURE__ */ jsx("span", {
138
+ className: style_default.TypePreviewContent,
139
+ children: /* @__PURE__ */ jsx(Join, {
140
+ items,
141
+ limit: 3,
142
+ children: /* @__PURE__ */ jsxs("span", {
143
+ className: style_default.TextOperator,
144
+ children: [
145
+ " ",
146
+ delimiter,
147
+ " "
148
+ ]
149
+ })
150
+ })
151
+ })
152
+ })
153
+ });
154
+ }
155
+ case "HttpTypeReference": {
156
+ const name = type.ident.split(".").at(-1);
157
+ const params = type.typeParameters?.map((param, key) => /* @__PURE__ */ jsx(Lang.Type, { type: param }, key));
158
+ if (name === "Record" && type.typeParameters?.length === 2 && type.typeParameters?.at(0).kind === "HttpTypeString") return /* @__PURE__ */ jsxs(Fragment$1, { children: [
159
+ /* @__PURE__ */ jsx("span", {
160
+ className: style_default.TypeArray,
161
+ children: "map"
162
+ }),
163
+ "[",
164
+ params?.[1],
165
+ "]"
166
+ ] });
167
+ return /* @__PURE__ */ jsxs("span", {
168
+ className: style_default.Type,
169
+ children: [
170
+ /* @__PURE__ */ jsx(SDKReference, {
171
+ stainlessPath: type.$ref,
172
+ children: name
173
+ }),
174
+ params && params.length > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [
175
+ /* @__PURE__ */ jsx("span", {
176
+ className: style_default.TypeBracket,
177
+ children: "<"
178
+ }),
179
+ /* @__PURE__ */ jsx(Join, {
180
+ items: params,
181
+ limit: 3,
182
+ children: /* @__PURE__ */ jsx("span", {
183
+ className: style_default.TextOperator,
184
+ children: ", "
185
+ })
186
+ }),
187
+ /* @__PURE__ */ jsx("span", {
188
+ className: style_default.TypeBracket,
189
+ children: ">"
190
+ })
191
+ ] }),
192
+ /* @__PURE__ */ jsx(TypePreview, { path: type.$ref })
193
+ ]
194
+ });
195
+ }
196
+ case "HttpTypeObject": {
197
+ const items = type.members.map(({ ident }) => /* @__PURE__ */ jsx("span", {
198
+ className: style_default.TypePropertyName,
199
+ children: /* @__PURE__ */ jsx(Identifier, { name: ident })
200
+ }, ident));
201
+ return /* @__PURE__ */ jsx("span", {
202
+ className: style_default.Type,
203
+ children: /* @__PURE__ */ jsxs("span", {
204
+ className: style_default.TypePreview,
205
+ "data-stldocs-type-preview": "properties",
206
+ children: [
207
+ /* @__PURE__ */ jsx("span", {
208
+ className: style_default.TypeBrace,
209
+ children: " {"
210
+ }),
211
+ /* @__PURE__ */ jsxs("span", {
212
+ className: style_default.TypePreviewContent,
213
+ children: [
214
+ " ",
215
+ /* @__PURE__ */ jsx(Join, {
216
+ items,
217
+ limit: 3,
218
+ children: /* @__PURE__ */ jsx("span", {
219
+ className: style_default.TextOperator,
220
+ children: ", "
221
+ })
222
+ }),
223
+ " "
224
+ ]
225
+ }),
226
+ /* @__PURE__ */ jsx("span", {
227
+ className: style_default.TypeBrace,
228
+ children: "} "
229
+ })
230
+ ]
231
+ })
232
+ });
233
+ }
234
+ default: return /* @__PURE__ */ jsx("span", {
235
+ className: style_default.Type,
236
+ children: /* @__PURE__ */ jsx("span", {
237
+ className: style_default.TypePlain,
238
+ children: "unknown"
239
+ })
240
+ });
241
+ }
242
+ }
243
+ function MethodSignature({ decl }) {
244
+ return null;
245
+ }
246
+ const EncodingBadges = {
247
+ unknown: null,
248
+ json: /* @__PURE__ */ jsx(Badge, {
249
+ size: "sm",
250
+ icon: /* @__PURE__ */ jsx(BracesIcon, {}),
251
+ children: "JSON"
252
+ }),
253
+ "form-data": /* @__PURE__ */ jsx(Badge, {
254
+ size: "sm",
255
+ icon: /* @__PURE__ */ jsx(FormIcon, {}),
256
+ children: "Form Data"
257
+ })
258
+ };
259
+ function MethodInfo({ decl, children }) {
260
+ const Docs = useComponents();
261
+ const streamingResponse = useStreamingResponse(decl);
262
+ const implementedLanguages = useAvailableLanguages(decl.stainlessPath);
263
+ const { basePath } = useNavigation();
264
+ const params = Object.entries(decl.paramsChildren).filter(([, value]) => value.length).map(([location, value]) => /* @__PURE__ */ jsx(React.Fragment, { children: /* @__PURE__ */ jsxs("div", {
265
+ className: style_default.MethodParameters,
266
+ "data-stldocs-property-group": location.at(0),
267
+ children: [/* @__PURE__ */ jsxs("h5", { children: [
268
+ location.at(0).toUpperCase(),
269
+ location.slice(1),
270
+ " Parameters",
271
+ /* @__PURE__ */ jsx(PropertyToggle, { target: location.at(0) })
272
+ ] }), /* @__PURE__ */ jsx(Docs.SDKChildren, { paths: value })]
273
+ }) }, location));
274
+ const bodyParams = getBodyParams(decl);
275
+ if (bodyParams && bodyParams.params.length > 0) params.push(/* @__PURE__ */ jsxs("div", {
276
+ className: style_default.MethodInfoSection,
277
+ children: [/* @__PURE__ */ jsxs("h5", { children: [/* @__PURE__ */ jsxs("span", { children: ["Body Parameters", EncodingBadges[bodyParams.encoding]] }), /* @__PURE__ */ jsx(PropertyToggle, { target: "body" })] }), /* @__PURE__ */ jsx("div", {
278
+ className: style_default.MethodParameters,
279
+ "data-stldocs-property-group": "body",
280
+ children: /* @__PURE__ */ jsx(Docs.SDKChildren, { paths: bodyParams.params })
281
+ })]
282
+ }, "method-info-section"));
283
+ const responseChildren = "responseChildren" in decl && decl.responseChildren && decl.responseChildren.length > 0 ? [...decl.responseChildren] : [];
284
+ if (streamingResponse) responseChildren.push(streamingResponse);
285
+ if (params.length === 0 && responseChildren.length === 0) {
286
+ const availableLanguageLinks = implementedLanguages.filter((lang) => lang !== "http").flatMap((lang) => {
287
+ const url = generateRoute(basePath ?? "/", lang, decl.stainlessPath);
288
+ return url ? [{
289
+ url,
290
+ label: LanguageNames[lang] ?? lang
291
+ }] : [];
292
+ });
293
+ return /* @__PURE__ */ jsxs("div", {
294
+ className: style_default.MethodInfo,
295
+ children: [children, availableLanguageLinks.length > 0 && /* @__PURE__ */ jsxs("div", {
296
+ className: clsx("stl-ui-prose", style_default.MethodAvailableLanguages),
297
+ children: [/* @__PURE__ */ jsx("h5", { children: "Supported Languages" }), /* @__PURE__ */ jsxs("div", {
298
+ className: style_default.MethodAvailableLanguages,
299
+ children: ["This method is available in:", /* @__PURE__ */ jsx("ul", { children: availableLanguageLinks.map(({ url, label }) => {
300
+ return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("a", {
301
+ href: url,
302
+ children: label
303
+ }) }, url);
304
+ }) })]
305
+ })]
306
+ })]
307
+ });
308
+ }
309
+ return /* @__PURE__ */ jsxs("div", {
310
+ className: style_default.MethodInfo,
311
+ children: [
312
+ children ? /* @__PURE__ */ jsx("div", {
313
+ className: style_default.MethodContent,
314
+ children
315
+ }) : null,
316
+ params.length > 0 && params,
317
+ responseChildren.length > 0 && /* @__PURE__ */ jsxs("div", {
318
+ className: style_default.MethodInfoSection,
319
+ children: [/* @__PURE__ */ jsxs("h5", { children: ["Returns", /* @__PURE__ */ jsx(PropertyToggle, { target: "returns" })] }), /* @__PURE__ */ jsx("div", {
320
+ className: style_default.MethodReturns,
321
+ "data-stldocs-property-group": "returns",
322
+ children: /* @__PURE__ */ jsx(Docs.SDKChildren, { paths: responseChildren })
323
+ })]
324
+ })
325
+ ]
326
+ });
327
+ }
328
+ function renderVariantInfo(type) {
329
+ if (type.kind === "HttpTypeUnion" && type.types.every((t) => t.kind === "HttpTypeObject" || t.kind === "HttpTypeReference")) return /* @__PURE__ */ jsxs(Fragment$1, { children: [
330
+ "One of the following ",
331
+ type.types.length,
332
+ " object variants:"
333
+ ] });
334
+ }
335
+ function Property({ decl, children }) {
336
+ const Lang = useLanguageComponents();
337
+ if (!decl) return;
338
+ switch (decl.kind) {
339
+ case "HttpDeclProperty": {
340
+ const variants = renderVariantInfo(decl.type);
341
+ return children({
342
+ name: decl.key,
343
+ typeName: /* @__PURE__ */ jsx(Lang.TypeName, { type: decl.type }),
344
+ type: decl.type.kind in ComplexTypes && !variants && /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
345
+ });
346
+ }
347
+ case "HttpDeclTypeAlias": return children({
348
+ name: decl.ident,
349
+ typeName: /* @__PURE__ */ jsx(Lang.TypeName, { type: decl.type })
350
+ });
351
+ case "HttpDeclReference": return children({ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type }) });
352
+ }
353
+ }
354
+ function Declaration({ decl }) {
355
+ const Lang = useLanguageComponents();
356
+ if (!decl) return;
357
+ switch (decl.kind) {
358
+ case "HttpDeclProperty": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
359
+ /* @__PURE__ */ jsx("span", {
360
+ className: style_default.TypePropertyName,
361
+ children: /* @__PURE__ */ jsx(Identifier, { name: decl.key })
362
+ }),
363
+ /* @__PURE__ */ jsx("span", {
364
+ className: style_default.TextPunctuation,
365
+ children: ": "
366
+ }),
367
+ decl.optional && /* @__PURE__ */ jsx("span", {
368
+ className: style_default.TextPunctuation,
369
+ children: "optional "
370
+ }),
371
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
372
+ ] });
373
+ case "HttpDeclTypeAlias": return /* @__PURE__ */ jsxs(Fragment$1, { children: [/^UnionMember/.test(decl.ident) ? null : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Identifier, { name: decl.ident }), decl.type.kind === "HttpTypeObject" ? " " : /* @__PURE__ */ jsx("span", {
374
+ className: style_default.TextOperator,
375
+ children: " = "
376
+ })] }), /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })] });
377
+ case "HttpDeclReference": return /* @__PURE__ */ jsx(Lang.Type, { type: decl.type });
378
+ }
379
+ }
380
+ //#endregion
381
+ export { Declaration, MethodInfo, MethodSignature, Property, Type, TypeName, http_exports as t };
@@ -0,0 +1,2 @@
1
+ import { Et as ruby_d_exports, Ft as python_d_exports, Gt as go_d_exports, P as terraform_d_exports, Q as php_d_exports, U as cli_d_exports, _ as LanguageComponentDefinition, _t as http_d_exports, b as kotlin, en as java_d_exports, ln as typescript_d_exports, st as csharp_d_exports, v as PropertyFn, x as node } from "../index-Dt9uPKZP.js";
2
+ export { LanguageComponentDefinition, PropertyFn, cli_d_exports as cli, csharp_d_exports as csharp, go_d_exports as go, http_d_exports as http, java_d_exports as java, kotlin, node, php_d_exports as php, python_d_exports as python, ruby_d_exports as ruby, terraform_d_exports as terraform, typescript_d_exports as typescript };