@stainless-api/docs-ui 0.1.0-beta.7 → 0.1.0-beta.70

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 (215) hide show
  1. package/dist/breadcrumbs-BhYwbXkc.d.ts +25 -0
  2. package/dist/breadcrumbs-Cvm5Ifm7.d.ts +25 -0
  3. package/dist/breadcrumbs-DA4WgDhR.js +63 -0
  4. package/dist/chunk-BN_g-Awi.js +18 -0
  5. package/dist/cli-F3kMmeoJ.js +166 -0
  6. package/dist/component-P9sn5yyG.js +23 -0
  7. package/dist/component-generics-ByGsYTc8.d.ts +30 -0
  8. package/dist/component-generics-POFirVVb.js +45 -0
  9. package/dist/component-generics-zU0Pqx8m.d.ts +30 -0
  10. package/dist/components/MaskedInput.d.ts +14 -0
  11. package/dist/components/MaskedInput.js +76 -0
  12. package/dist/components/breadcrumbs.d.ts +2 -0
  13. package/dist/components/breadcrumbs.js +9 -0
  14. package/dist/components/icons.d.ts +60 -0
  15. package/dist/components/icons.js +3 -0
  16. package/dist/components/index.d.ts +11 -0
  17. package/dist/components/index.js +19 -0
  18. package/dist/components/method.d.ts +2 -0
  19. package/dist/components/method.js +10 -0
  20. package/dist/components/overview.d.ts +2 -0
  21. package/dist/components/overview.js +11 -0
  22. package/dist/components/primitives.d.ts +2 -0
  23. package/dist/components/primitives.js +8 -0
  24. package/dist/components/properties.d.ts +2 -0
  25. package/dist/components/properties.js +9 -0
  26. package/dist/components/sdk-sidebar.d.ts +2 -0
  27. package/dist/components/sdk-sidebar.js +10 -0
  28. package/dist/components/sdk.d.ts +2 -0
  29. package/dist/components/sdk.js +10 -0
  30. package/dist/components/snippets.d.ts +3 -0
  31. package/dist/components/snippets.js +9 -0
  32. package/dist/components/stl-sidebar.d.ts +2 -0
  33. package/dist/components/stl-sidebar.js +5 -0
  34. package/dist/components-w1JmIrB0.js +71 -0
  35. package/dist/contexts/component-generics.d.ts +2 -0
  36. package/dist/contexts/component-generics.js +3 -0
  37. package/dist/contexts/component-types.d.ts +17 -0
  38. package/dist/contexts/component-types.js +0 -0
  39. package/dist/contexts/component.d.ts +30 -0
  40. package/dist/contexts/component.js +30 -0
  41. package/dist/contexts/docs.d.ts +2 -0
  42. package/dist/contexts/docs.js +3 -0
  43. package/dist/contexts/index.d.ts +23 -0
  44. package/dist/contexts/index.js +7 -0
  45. package/dist/contexts/markdown.d.ts +2 -0
  46. package/dist/contexts/markdown.js +4 -0
  47. package/dist/contexts/navigation.d.ts +2 -0
  48. package/dist/contexts/navigation.js +3 -0
  49. package/dist/contexts/use-components.d.ts +15 -0
  50. package/dist/contexts/use-components.js +4 -0
  51. package/dist/contexts-CVj20VV4.js +41 -0
  52. package/dist/csharp-D6_jlynY.js +283 -0
  53. package/dist/docs-BmOB2f-I.js +61 -0
  54. package/dist/docs-g4IPmtZr.d.ts +48 -0
  55. package/dist/docs-z3fl2eW-.d.ts +48 -0
  56. package/dist/go-COaHV3Hc.js +303 -0
  57. package/dist/http-fOPCX17A.js +389 -0
  58. package/dist/icons-BYKn5X8E.js +885 -0
  59. package/dist/index-B8Zys1C2.d.ts +347 -0
  60. package/dist/index-C5Zmb2CI.d.ts +16 -0
  61. package/dist/index-CwjGm9zX.d.ts +1722 -0
  62. package/dist/index-D7PkxNgB.d.ts +16 -0
  63. package/dist/index-DIaM6Ync.d.ts +347 -0
  64. package/dist/index.d.ts +20 -0
  65. package/dist/index.js +32 -7542
  66. package/dist/java-CxGSJVvv.js +403 -0
  67. package/dist/languages/cli.d.ts +12 -0
  68. package/dist/languages/cli.js +21 -0
  69. package/dist/languages/csharp.d.ts +12 -0
  70. package/dist/languages/csharp.js +9 -0
  71. package/dist/languages/go.d.ts +12 -0
  72. package/dist/languages/go.js +9 -0
  73. package/dist/languages/http.d.ts +12 -0
  74. package/dist/languages/http.js +20 -0
  75. package/dist/languages/index.d.ts +12 -0
  76. package/dist/languages/index.js +29 -0
  77. package/dist/languages/java.d.ts +12 -0
  78. package/dist/languages/java.js +9 -0
  79. package/dist/languages/python.d.ts +12 -0
  80. package/dist/languages/python.js +9 -0
  81. package/dist/languages/ruby.d.ts +12 -0
  82. package/dist/languages/ruby.js +9 -0
  83. package/dist/languages/terraform.d.ts +12 -0
  84. package/dist/languages/terraform.js +9 -0
  85. package/dist/languages/typescript.d.ts +12 -0
  86. package/dist/languages/typescript.js +9 -0
  87. package/dist/languages-B6eap2M6.js +30 -0
  88. package/dist/markdown/index.d.ts +12 -0
  89. package/dist/markdown/index.js +107 -0
  90. package/dist/markdown/md.d.ts +15 -0
  91. package/dist/markdown/md.js +41 -0
  92. package/dist/markdown/printer.d.ts +13 -0
  93. package/dist/markdown/printer.js +100 -0
  94. package/dist/markdown/utils.d.ts +21 -0
  95. package/dist/markdown/utils.js +31 -0
  96. package/dist/markdown-CTKHMLVr.js +49 -0
  97. package/dist/markdown-Cdh0TSHp.d.ts +22 -0
  98. package/dist/markdown-Cibv9fDR.d.ts +22 -0
  99. package/dist/method-630cPKDl.d.ts +59 -0
  100. package/dist/method-BPDUyBlD.js +96 -0
  101. package/dist/method-BzkPRXGL.d.ts +59 -0
  102. package/dist/navigation-BW-SBvb4.d.ts +29 -0
  103. package/dist/navigation-DWYqC_HX.d.ts +29 -0
  104. package/dist/navigation-aoYZ_tl4.js +24 -0
  105. package/dist/overview-Cui1XtuC.d.ts +39 -0
  106. package/dist/overview-DFwfIK6k.js +138 -0
  107. package/dist/overview-RXc9iPzz.d.ts +39 -0
  108. package/dist/primitives-DJEqe_r1.js +250 -0
  109. package/dist/primitives-DhGxFYx6.d.ts +105 -0
  110. package/dist/primitives-MsH-h0bU.d.ts +105 -0
  111. package/dist/properties-BnbBKd5a.js +132 -0
  112. package/dist/properties-Bynmj9_H.d.ts +54 -0
  113. package/dist/properties-C9W4QJ_F.d.ts +54 -0
  114. package/dist/python-DsTuWCKE.js +269 -0
  115. package/dist/routing-C64k4fmX.js +205 -0
  116. package/dist/routing-Cm_9XJiQ.d.ts +61 -0
  117. package/dist/routing-utiR5mY3.d.ts +61 -0
  118. package/dist/routing.d.ts +2 -0
  119. package/dist/routing.js +3 -180
  120. package/dist/ruby-BncKp6hd.js +387 -0
  121. package/dist/sdk-BvZeXpsj.d.ts +122 -0
  122. package/dist/sdk-Bw99eXxA.js +399 -0
  123. package/dist/sdk-GMOw94wL.d.ts +122 -0
  124. package/dist/sdk-sidebar-NCBSWuUW.d.ts +15 -0
  125. package/dist/sdk-sidebar-VNY2-O1Y.d.ts +15 -0
  126. package/dist/sdk-sidebar-V_MTkVw8.js +50 -0
  127. package/dist/snippets-BehbU3rt.js +164 -0
  128. package/dist/snippets-Bj7Ey56K.d.ts +53 -0
  129. package/dist/snippets-CQQSDvg2.d.ts +53 -0
  130. package/dist/spec.d.ts +65 -0
  131. package/dist/spec.js +167 -0
  132. package/dist/stl-sidebar-CXzs_shz.d.ts +58 -0
  133. package/dist/stl-sidebar-DSkUHwcU.d.ts +58 -0
  134. package/dist/stl-sidebar-WtimNrk1.js +106 -0
  135. package/dist/style-HpXpcJ9v.js +172 -0
  136. package/dist/style.d.ts +171 -0
  137. package/dist/style.js +3 -0
  138. package/dist/styles/main.css +744 -754
  139. package/dist/styles/main.js +0 -0
  140. package/dist/styles/primitives.css +327 -458
  141. package/dist/styles/primitives.js +0 -0
  142. package/dist/styles/resets.css +32 -41
  143. package/dist/styles/resets.js +0 -0
  144. package/dist/styles/search.css +192 -270
  145. package/dist/styles/search.js +0 -0
  146. package/dist/styles/sidebar.css +170 -69
  147. package/dist/styles/sidebar.js +0 -0
  148. package/dist/styles/variables.css +26 -89
  149. package/dist/styles/variables.js +0 -0
  150. package/dist/styles.css +3273 -0
  151. package/dist/styles.mjs +1 -0
  152. package/dist/terraform-B95X4rNK.js +243 -0
  153. package/dist/typescript-n46M9OtL.js +449 -0
  154. package/dist/use-components-BUz3GbO4.js +7 -0
  155. package/dist/utils-DPbkW1Tz.js +54 -0
  156. package/dist/utils.d.ts +20 -0
  157. package/dist/utils.js +3 -0
  158. package/package.json +74 -22
  159. package/dist/mcp.js +0 -16003
  160. package/dist/styles/snippets.css +0 -132
  161. package/src/components/breadcrumbs.tsx +0 -94
  162. package/src/components/chat.tsx +0 -154
  163. package/src/components/dropdown.tsx +0 -91
  164. package/src/components/icons.tsx +0 -584
  165. package/src/components/index.ts +0 -9
  166. package/src/components/method.tsx +0 -144
  167. package/src/components/overview.tsx +0 -159
  168. package/src/components/primitives.tsx +0 -284
  169. package/src/components/properties.tsx +0 -130
  170. package/src/components/scripts/dropdown.ts +0 -78
  171. package/src/components/sdk.tsx +0 -402
  172. package/src/components/sidebar.tsx +0 -99
  173. package/src/components/snippets.tsx +0 -179
  174. package/src/contexts/component-generics.tsx +0 -48
  175. package/src/contexts/component-types.tsx +0 -5
  176. package/src/contexts/component.tsx +0 -32
  177. package/src/contexts/docs.tsx +0 -75
  178. package/src/contexts/index.tsx +0 -17
  179. package/src/contexts/markdown.tsx +0 -43
  180. package/src/contexts/navigation.tsx +0 -44
  181. package/src/contexts/search.tsx +0 -28
  182. package/src/contexts/use-components.tsx +0 -4
  183. package/src/index.ts +0 -6
  184. package/src/languages/go.tsx +0 -281
  185. package/src/languages/http.tsx +0 -321
  186. package/src/languages/index.ts +0 -26
  187. package/src/languages/java.tsx +0 -358
  188. package/src/languages/python.tsx +0 -255
  189. package/src/languages/ruby.tsx +0 -320
  190. package/src/languages/typescript.tsx +0 -393
  191. package/src/markdown/index.ts +0 -107
  192. package/src/markdown/md.ts +0 -45
  193. package/src/markdown/utils.ts +0 -49
  194. package/src/routing.ts +0 -238
  195. package/src/search/form.tsx +0 -127
  196. package/src/search/index.tsx +0 -1
  197. package/src/search/indexer.ts +0 -246
  198. package/src/search/mcp.ts +0 -61
  199. package/src/search/printer.tsx +0 -86
  200. package/src/search/providers/algolia.ts +0 -88
  201. package/src/search/providers/fuse.ts +0 -19
  202. package/src/search/providers/pagefind.ts +0 -17
  203. package/src/search/providers/walker.ts +0 -30
  204. package/src/search/results.tsx +0 -181
  205. package/src/search/state.ts +0 -64
  206. package/src/search/types.ts +0 -116
  207. package/src/style.ts +0 -197
  208. package/src/styles/main.css +0 -993
  209. package/src/styles/primitives.css +0 -572
  210. package/src/styles/resets.css +0 -47
  211. package/src/styles/search.css +0 -342
  212. package/src/styles/sidebar.css +0 -87
  213. package/src/styles/snippets.css +0 -132
  214. package/src/styles/variables.css +0 -90
  215. package/src/utils.ts +0 -41
@@ -0,0 +1,303 @@
1
+ import { t as __exportAll } from "./chunk-BN_g-Awi.js";
2
+ import { n as useLanguageComponents } from "./contexts-CVj20VV4.js";
3
+ import { t as useComponents } from "./use-components-BUz3GbO4.js";
4
+ import { t as style_default } from "./style-HpXpcJ9v.js";
5
+ import * as React$1 from "react";
6
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
+
8
+ //#region src/languages/go.tsx
9
+ var go_exports = /* @__PURE__ */ __exportAll({
10
+ Declaration: () => Declaration,
11
+ MethodSignature: () => MethodSignature,
12
+ Property: () => Property,
13
+ Type: () => Type,
14
+ TypeName: () => TypeName
15
+ });
16
+ const ComplexTypes = {
17
+ GoTypeMap: "map",
18
+ GoTypeArray: "array"
19
+ };
20
+ const Keywords = {
21
+ GoTypeAny: "any",
22
+ GoTypeUnknown: "unknown",
23
+ GoTypeInt: "int64",
24
+ GoTypeFloat: "float64",
25
+ GoTypeBool: "bool",
26
+ GoTypeError: "error"
27
+ };
28
+ function isField(type) {
29
+ return type.kind === "GoTypeReference" && type.typeName === "param.Field";
30
+ }
31
+ function TypeName({ type }) {
32
+ const Lang = useLanguageComponents();
33
+ return isField(type) ? "field" : ComplexTypes[type.kind] ?? /* @__PURE__ */ jsx(Lang.Type, { type });
34
+ }
35
+ function Type({ type }) {
36
+ const Lang = useLanguageComponents();
37
+ const { Join, SDKReference } = useComponents();
38
+ switch (type.kind) {
39
+ case "GoTypeReference": {
40
+ const params = type.typeParameters?.map((param, key) => /* @__PURE__ */ jsx(Lang.Type, { type: param }, key));
41
+ return /* @__PURE__ */ jsxs("span", {
42
+ className: style_default.Type,
43
+ children: [type.$ref ? /* @__PURE__ */ jsx(SDKReference, {
44
+ stainlessPath: type.$ref,
45
+ children: type.typeName
46
+ }) : type.typeName, params && params.length > 0 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
47
+ /* @__PURE__ */ jsx("span", {
48
+ className: style_default.TypeBracket,
49
+ children: "["
50
+ }),
51
+ /* @__PURE__ */ jsx(Join, {
52
+ items: params,
53
+ limit: 3,
54
+ children: /* @__PURE__ */ jsx("span", {
55
+ className: style_default.TextOperator,
56
+ children: ", "
57
+ })
58
+ }),
59
+ /* @__PURE__ */ jsx("span", {
60
+ className: style_default.TypeBracket,
61
+ children: "]"
62
+ })
63
+ ] }) : null]
64
+ });
65
+ }
66
+ case "GoTypeAny":
67
+ case "GoTypeUnknown":
68
+ case "GoTypeInt":
69
+ case "GoTypeFloat":
70
+ case "GoTypeBool":
71
+ case "GoTypeError": return /* @__PURE__ */ jsx("span", {
72
+ className: style_default.Type,
73
+ children: /* @__PURE__ */ jsx("span", {
74
+ className: style_default.TypeKeyword,
75
+ children: Keywords[type.kind]
76
+ })
77
+ });
78
+ case "GoTypeString": return /* @__PURE__ */ jsx("span", {
79
+ className: style_default.Type,
80
+ children: /* @__PURE__ */ jsx("span", {
81
+ className: style_default.TypeString,
82
+ children: "string"
83
+ })
84
+ });
85
+ case "GoTypeArray": return /* @__PURE__ */ jsxs("span", {
86
+ className: style_default.Type,
87
+ children: [/* @__PURE__ */ jsx("span", {
88
+ className: style_default.TextOperator,
89
+ children: "[]"
90
+ }), /* @__PURE__ */ jsx(Lang.Type, { type: type.elementType })]
91
+ });
92
+ case "GoTypeStruct": return /* @__PURE__ */ jsx("span", {
93
+ className: style_default.Type,
94
+ children: /* @__PURE__ */ jsx("span", {
95
+ className: style_default.TypeKeyword,
96
+ children: "struct{…}"
97
+ })
98
+ });
99
+ case "GoTypeInterface": return /* @__PURE__ */ jsx("span", {
100
+ className: style_default.Type,
101
+ children: /* @__PURE__ */ jsx("span", {
102
+ className: style_default.TypeKeyword,
103
+ children: "interface{…}"
104
+ })
105
+ });
106
+ case "GoTypeMap": return /* @__PURE__ */ jsxs("span", {
107
+ className: style_default.Type,
108
+ children: [
109
+ /* @__PURE__ */ jsx("span", {
110
+ className: style_default.TypeKeyword,
111
+ children: "map"
112
+ }),
113
+ /* @__PURE__ */ jsx("span", {
114
+ className: style_default.TypeBracket,
115
+ children: "["
116
+ }),
117
+ /* @__PURE__ */ jsx(Lang.Type, { type: type.indexType }),
118
+ /* @__PURE__ */ jsx("span", {
119
+ className: style_default.TextPunctuation,
120
+ children: ","
121
+ }),
122
+ " ",
123
+ /* @__PURE__ */ jsx(Lang.Type, { type: type.itemType }),
124
+ /* @__PURE__ */ jsx("span", {
125
+ className: style_default.TypeBracket,
126
+ children: "]"
127
+ })
128
+ ]
129
+ });
130
+ case "GoTypePointer": return /* @__PURE__ */ jsxs("span", {
131
+ className: style_default.Type,
132
+ children: [/* @__PURE__ */ jsx("span", {
133
+ className: style_default.TextOperator,
134
+ children: "*"
135
+ }), /* @__PURE__ */ jsx(Lang.Type, { type: type.inner })]
136
+ });
137
+ }
138
+ }
139
+ function MethodSignature({ decl }) {
140
+ const Lang = useLanguageComponents();
141
+ const { Join } = useComponents();
142
+ const params = decl.parameters.map((param, i) => /* @__PURE__ */ jsxs(React$1.Fragment, { children: [/* @__PURE__ */ jsx("span", {
143
+ className: style_default.TextIdentifier,
144
+ children: param.ident
145
+ }), param.optional && /* @__PURE__ */ jsx("span", {
146
+ className: style_default.TextPunctuation,
147
+ children: "?"
148
+ })] }, i));
149
+ const returns = decl.returnType.map((t, key) => /* @__PURE__ */ jsx(Lang.Type, { type: t }, key));
150
+ return /* @__PURE__ */ jsx("div", {
151
+ className: style_default.MethodSignature,
152
+ children: /* @__PURE__ */ jsxs("span", {
153
+ className: style_default.SignatureTitle,
154
+ children: [
155
+ decl.async && /* @__PURE__ */ jsx("span", {
156
+ className: style_default.TextKeyword,
157
+ children: "async "
158
+ }),
159
+ decl.qualified && /* @__PURE__ */ jsx("span", {
160
+ className: style_default.SignatureQualified,
161
+ children: /* @__PURE__ */ jsx("span", {
162
+ className: style_default.TextIdentifier,
163
+ children: decl.qualified?.slice(0, -decl.ident.length)
164
+ })
165
+ }),
166
+ decl.kind === "GoDeclFunction" && /* @__PURE__ */ jsx("span", {
167
+ className: style_default.SignatureName,
168
+ children: /* @__PURE__ */ jsx("span", {
169
+ className: style_default.TextIdentifier,
170
+ children: decl.ident
171
+ })
172
+ }),
173
+ /* @__PURE__ */ jsxs("span", {
174
+ className: style_default.MethodSignature,
175
+ children: [
176
+ /* @__PURE__ */ jsx("span", {
177
+ className: style_default.SignatureParen,
178
+ children: "("
179
+ }),
180
+ /* @__PURE__ */ jsx("span", {
181
+ className: style_default.SignatureParams,
182
+ children: /* @__PURE__ */ jsx(Join, {
183
+ items: params,
184
+ children: /* @__PURE__ */ jsx("span", {
185
+ className: style_default.TextOperator,
186
+ children: ", "
187
+ })
188
+ })
189
+ }),
190
+ /* @__PURE__ */ jsxs("span", {
191
+ className: style_default.SignatureParen,
192
+ children: [")", " "]
193
+ }),
194
+ decl.returnType.length === 1 ? returns : /* @__PURE__ */ jsxs(Fragment$1, { children: [
195
+ /* @__PURE__ */ jsx("span", {
196
+ className: style_default.SignatureParen,
197
+ children: "("
198
+ }),
199
+ /* @__PURE__ */ jsx(Join, {
200
+ items: returns,
201
+ children: /* @__PURE__ */ jsx("span", {
202
+ className: style_default.TextOperator,
203
+ children: ", "
204
+ })
205
+ }),
206
+ /* @__PURE__ */ jsx("span", {
207
+ className: style_default.SignatureParen,
208
+ children: ")"
209
+ })
210
+ ] })
211
+ ]
212
+ })
213
+ ]
214
+ })
215
+ });
216
+ }
217
+ function Property({ decl, children }) {
218
+ const Docs = useComponents();
219
+ const Lang = useLanguageComponents();
220
+ if (!decl) return null;
221
+ switch (decl.kind) {
222
+ case "GoDeclProperty": return children({
223
+ name: decl.ident,
224
+ typeName: /* @__PURE__ */ jsx(Lang.TypeName, { type: decl.type }),
225
+ badges: decl.optional && /* @__PURE__ */ jsx(Docs.Badge, { id: "optional" }),
226
+ type: (isField(decl.type) || decl.type.kind in ComplexTypes) && /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
227
+ });
228
+ case "GoDeclConst": return children({
229
+ name: decl.ident,
230
+ typeName: "const",
231
+ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
232
+ });
233
+ case "GoDeclReference": return children({ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type }) });
234
+ case "GoDeclType":
235
+ case "GoDeclTypeAlias": {
236
+ const typeName = decl.type.kind === "GoTypeStruct" ? "struct" : decl.type.kind === "GoTypeInterface" ? "interface" : decl.kind === "GoDeclTypeAlias" ? "alias" : "type";
237
+ return children({
238
+ name: decl.ident,
239
+ typeName,
240
+ type: ["GoTypeStruct", "GoTypeInterface"].includes(decl.type.kind) || /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
241
+ });
242
+ }
243
+ }
244
+ }
245
+ function Declaration({ decl }) {
246
+ const Lang = useLanguageComponents();
247
+ if (!decl) return;
248
+ switch (decl.kind) {
249
+ case "GoDeclType": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
250
+ /* @__PURE__ */ jsx("span", {
251
+ className: style_default.TextKeyword,
252
+ children: "type "
253
+ }),
254
+ /* @__PURE__ */ jsxs("span", {
255
+ className: style_default.TextIdentifier,
256
+ children: [decl.ident, " "]
257
+ }),
258
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
259
+ ] });
260
+ case "GoDeclTypeAlias": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
261
+ /* @__PURE__ */ jsx("span", {
262
+ className: style_default.TextKeyword,
263
+ children: "type "
264
+ }),
265
+ /* @__PURE__ */ jsxs("span", {
266
+ className: style_default.TextIdentifier,
267
+ children: [decl.ident, " "]
268
+ }),
269
+ /* @__PURE__ */ jsx("span", {
270
+ className: style_default.TextOperator,
271
+ children: "= "
272
+ }),
273
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
274
+ ] });
275
+ case "GoDeclProperty": return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
276
+ className: style_default.TypePropertyName,
277
+ children: /* @__PURE__ */ jsxs("span", {
278
+ className: style_default.TextIdentifier,
279
+ children: [decl.ident, " "]
280
+ })
281
+ }), /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })] });
282
+ case "GoDeclReference": return /* @__PURE__ */ jsx(Lang.Type, { type: decl.type });
283
+ case "GoDeclConst": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
284
+ /* @__PURE__ */ jsx("span", {
285
+ className: style_default.TextKeyword,
286
+ children: "const "
287
+ }),
288
+ /* @__PURE__ */ jsxs("span", {
289
+ className: style_default.TextIdentifier,
290
+ children: [decl.ident, " "]
291
+ }),
292
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type }),
293
+ /* @__PURE__ */ jsx("span", {
294
+ className: style_default.TextOperator,
295
+ children: " = "
296
+ }),
297
+ JSON.stringify(decl.value)
298
+ ] });
299
+ }
300
+ }
301
+
302
+ //#endregion
303
+ export { TypeName as a, Type as i, MethodSignature as n, go_exports as o, Property as r, Declaration as t };
@@ -0,0 +1,389 @@
1
+ import { t as __exportAll } from "./chunk-BN_g-Awi.js";
2
+ import { d as useSpec, i as useDeclaration, n as useAvailableLanguages, s as useLanguage } from "./docs-BmOB2f-I.js";
3
+ import { n as useNavigation } from "./navigation-aoYZ_tl4.js";
4
+ import { n as useLanguageComponents } from "./contexts-CVj20VV4.js";
5
+ import { t as useComponents } from "./use-components-BUz3GbO4.js";
6
+ import { t as style_default } from "./style-HpXpcJ9v.js";
7
+ import { i as PropertyToggle } from "./properties-BnbBKd5a.js";
8
+ import { s as generateRoute, t as LanguageNames } from "./routing-C64k4fmX.js";
9
+ import { y as useStreamingResponse } from "./sdk-Bw99eXxA.js";
10
+ import { n as getBodyParams } from "./utils-DPbkW1Tz.js";
11
+ import React from "react";
12
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
13
+ import clsx from "clsx";
14
+ import { BracesIcon, FormIcon } from "lucide-react";
15
+ import { Badge } from "@stainless-api/ui-primitives";
16
+
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(Fragment$1, { children: /* @__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__ */ jsxs("span", {
202
+ className: style_default.Type,
203
+ children: [/* @__PURE__ */ jsx("span", {
204
+ className: style_default.TypePlain,
205
+ children: "object"
206
+ }), /* @__PURE__ */ jsxs("span", {
207
+ className: style_default.TypePreview,
208
+ "data-stldocs-type-preview": "properties",
209
+ children: [
210
+ /* @__PURE__ */ jsx("span", {
211
+ className: style_default.TypeBrace,
212
+ children: " {"
213
+ }),
214
+ /* @__PURE__ */ jsxs("span", {
215
+ className: style_default.TypePreviewContent,
216
+ children: [
217
+ " ",
218
+ /* @__PURE__ */ jsx(Join, {
219
+ items,
220
+ limit: 3,
221
+ children: /* @__PURE__ */ jsx("span", {
222
+ className: style_default.TextOperator,
223
+ children: ", "
224
+ })
225
+ }),
226
+ " "
227
+ ]
228
+ }),
229
+ /* @__PURE__ */ jsx("span", {
230
+ className: style_default.TypeBrace,
231
+ children: "} "
232
+ })
233
+ ]
234
+ })]
235
+ });
236
+ }
237
+ default: return /* @__PURE__ */ jsx("span", {
238
+ className: style_default.Type,
239
+ children: /* @__PURE__ */ jsx("span", {
240
+ className: style_default.TypePlain,
241
+ children: "unknown"
242
+ })
243
+ });
244
+ }
245
+ }
246
+ function MethodSignature({ decl }) {
247
+ return null;
248
+ }
249
+ const EncodingBadges = {
250
+ unknown: null,
251
+ json: /* @__PURE__ */ jsx(Badge, {
252
+ size: "sm",
253
+ icon: /* @__PURE__ */ jsx(BracesIcon, {}),
254
+ children: "JSON"
255
+ }),
256
+ "form-data": /* @__PURE__ */ jsx(Badge, {
257
+ size: "sm",
258
+ icon: /* @__PURE__ */ jsx(FormIcon, {}),
259
+ children: "Form Data"
260
+ })
261
+ };
262
+ function MethodInfo({ decl, children }) {
263
+ const Docs = useComponents();
264
+ const streamingResponse = useStreamingResponse(decl);
265
+ const implementedLanguages = useAvailableLanguages(decl.stainlessPath);
266
+ const { basePath } = useNavigation();
267
+ const params = Object.entries(decl.paramsChildren).filter(([, value]) => value.length).map(([location, value]) => /* @__PURE__ */ jsx(React.Fragment, { children: /* @__PURE__ */ jsxs("div", {
268
+ className: style_default.MethodParameters,
269
+ "data-stldocs-property-group": location.at(0),
270
+ children: [/* @__PURE__ */ jsxs("h5", { children: [
271
+ location.at(0).toUpperCase(),
272
+ location.slice(1),
273
+ " Parameters",
274
+ /* @__PURE__ */ jsx(PropertyToggle, { target: location.at(0) })
275
+ ] }), /* @__PURE__ */ jsx(Docs.SDKChildren, { paths: value })]
276
+ }) }, location));
277
+ const bodyParams = getBodyParams(decl);
278
+ if (bodyParams && bodyParams.params.length > 0) params.push(/* @__PURE__ */ jsxs("div", {
279
+ className: style_default.MethodInfoSection,
280
+ children: [/* @__PURE__ */ jsxs("h5", { children: [/* @__PURE__ */ jsxs("span", { children: ["Body Parameters", EncodingBadges[bodyParams.encoding]] }), /* @__PURE__ */ jsx(PropertyToggle, { target: "body" })] }), /* @__PURE__ */ jsx("div", {
281
+ className: style_default.MethodParameters,
282
+ "data-stldocs-property-group": "body",
283
+ children: /* @__PURE__ */ jsx(Docs.SDKChildren, { paths: bodyParams.params })
284
+ })]
285
+ }, "method-info-section"));
286
+ const responseChildren = "responseChildren" in decl && decl.responseChildren && decl.responseChildren.length > 0 ? [...decl.responseChildren] : [];
287
+ if (streamingResponse) responseChildren.push(streamingResponse);
288
+ if (params.length === 0 && responseChildren.length === 0) {
289
+ const availableLanguageLinks = implementedLanguages.filter((lang) => lang !== "http").flatMap((lang) => {
290
+ const url = generateRoute(basePath ?? "/", lang, decl.stainlessPath);
291
+ return url ? [{
292
+ url,
293
+ label: LanguageNames[lang] ?? lang
294
+ }] : [];
295
+ });
296
+ return /* @__PURE__ */ jsxs("div", {
297
+ className: style_default.MethodInfo,
298
+ children: [children, implementedLanguages.length > 0 && /* @__PURE__ */ jsxs("div", {
299
+ className: clsx("stl-ui-prose", style_default.MethodAvailableLanguages),
300
+ children: [/* @__PURE__ */ jsx("h5", { children: "Supported Languages" }), /* @__PURE__ */ jsxs("div", {
301
+ className: style_default.MethodAvailableLanguages,
302
+ children: ["This method is available in:", /* @__PURE__ */ jsx("ul", { children: availableLanguageLinks.map(({ url, label }) => {
303
+ return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("a", {
304
+ href: url,
305
+ children: label
306
+ }) }, url);
307
+ }) })]
308
+ })]
309
+ })]
310
+ });
311
+ }
312
+ return /* @__PURE__ */ jsxs("div", {
313
+ className: style_default.MethodInfo,
314
+ children: [
315
+ children && /* @__PURE__ */ jsx("div", {
316
+ className: style_default.MethodContent,
317
+ children
318
+ }),
319
+ params.length > 0 && params,
320
+ responseChildren.length > 0 && /* @__PURE__ */ jsxs("div", {
321
+ className: style_default.MethodInfoSection,
322
+ children: [/* @__PURE__ */ jsxs("h5", { children: ["Returns", /* @__PURE__ */ jsx(PropertyToggle, { target: "returns" })] }), /* @__PURE__ */ jsx("div", {
323
+ className: style_default.MethodReturns,
324
+ "data-stldocs-property-group": "returns",
325
+ children: /* @__PURE__ */ jsx(Docs.SDKChildren, { paths: responseChildren })
326
+ })]
327
+ })
328
+ ]
329
+ });
330
+ }
331
+ function renderVariantInfo(type) {
332
+ if (type.kind === "HttpTypeUnion" && type.types.every((t) => t.kind === "HttpTypeObject" || t.kind === "HttpTypeReference")) return /* @__PURE__ */ jsxs(Fragment$1, { children: [
333
+ "One of the following ",
334
+ type.types.length,
335
+ " object variants:"
336
+ ] });
337
+ }
338
+ function Property({ decl, children }) {
339
+ const Lang = useLanguageComponents();
340
+ if (!decl) return;
341
+ switch (decl.kind) {
342
+ case "HttpDeclProperty": {
343
+ const variants = renderVariantInfo(decl.type);
344
+ return children({
345
+ name: decl.key,
346
+ typeName: /* @__PURE__ */ jsx(Lang.TypeName, { type: decl.type }),
347
+ type: decl.type.kind in ComplexTypes && !variants && /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
348
+ });
349
+ }
350
+ case "HttpDeclTypeAlias": return children({
351
+ name: decl.ident,
352
+ typeName: /* @__PURE__ */ jsx(Lang.TypeName, { type: decl.type })
353
+ });
354
+ case "HttpDeclReference": return children({ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type }) });
355
+ }
356
+ }
357
+ function Declaration({ decl }) {
358
+ const Lang = useLanguageComponents();
359
+ if (!decl) return;
360
+ switch (decl.kind) {
361
+ case "HttpDeclProperty": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
362
+ /* @__PURE__ */ jsx("span", {
363
+ className: style_default.TypePropertyName,
364
+ children: /* @__PURE__ */ jsx(Identifier, { name: decl.key })
365
+ }),
366
+ /* @__PURE__ */ jsx("span", {
367
+ className: style_default.TextPunctuation,
368
+ children: ": "
369
+ }),
370
+ decl.optional && /* @__PURE__ */ jsx("span", {
371
+ className: style_default.TextPunctuation,
372
+ children: "optional "
373
+ }),
374
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
375
+ ] });
376
+ case "HttpDeclTypeAlias": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
377
+ /* @__PURE__ */ jsx(Identifier, { name: decl.ident }),
378
+ /* @__PURE__ */ jsx("span", {
379
+ className: style_default.TextOperator,
380
+ children: " = "
381
+ }),
382
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
383
+ ] });
384
+ case "HttpDeclReference": return /* @__PURE__ */ jsx(Lang.Type, { type: decl.type });
385
+ }
386
+ }
387
+
388
+ //#endregion
389
+ export { Type as a, Property as i, MethodInfo as n, TypeName as o, MethodSignature as r, http_exports as s, Declaration as t };