@stainless-api/docs-ui 0.1.0-beta.5 → 0.1.0-beta.50

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 (212) hide show
  1. package/dist/breadcrumbs-C6pTTw_o.d.ts +20 -0
  2. package/dist/breadcrumbs-DEyC9k79.d.ts +20 -0
  3. package/dist/breadcrumbs-nSFZO5Gf.js +63 -0
  4. package/dist/chunk-DRcLgZ1e.js +18 -0
  5. package/dist/component-DRO8kQSp.js +23 -0
  6. package/dist/component-generics-B6Fn47Mz.js +45 -0
  7. package/dist/component-generics-D_yxZT6v.d.ts +30 -0
  8. package/dist/component-generics-DxN-MaP2.d.ts +30 -0
  9. package/dist/components/MaskedInput.d.ts +14 -0
  10. package/dist/components/MaskedInput.js +76 -0
  11. package/dist/components/breadcrumbs.d.ts +2 -0
  12. package/dist/components/breadcrumbs.js +9 -0
  13. package/dist/components/icons.d.ts +55 -0
  14. package/dist/components/icons.js +3 -0
  15. package/dist/components/index.d.ts +10 -0
  16. package/dist/components/index.js +18 -0
  17. package/dist/components/method.d.ts +2 -0
  18. package/dist/components/method.js +10 -0
  19. package/dist/components/overview.d.ts +2 -0
  20. package/dist/components/overview.js +11 -0
  21. package/dist/components/primitives.d.ts +2 -0
  22. package/dist/components/primitives.js +8 -0
  23. package/dist/components/properties.d.ts +2 -0
  24. package/dist/components/properties.js +9 -0
  25. package/dist/components/sdk.d.ts +2 -0
  26. package/dist/components/sdk.js +10 -0
  27. package/dist/components/sidebar.d.ts +2 -0
  28. package/dist/components/sidebar.js +11 -0
  29. package/dist/components/snippets.d.ts +3 -0
  30. package/dist/components/snippets.js +9 -0
  31. package/dist/components-D7M-BwNI.js +71 -0
  32. package/dist/contexts/component-generics.d.ts +2 -0
  33. package/dist/contexts/component-generics.js +3 -0
  34. package/dist/contexts/component-types.d.ts +16 -0
  35. package/dist/contexts/component-types.js +0 -0
  36. package/dist/contexts/component.d.ts +29 -0
  37. package/dist/contexts/component.js +27 -0
  38. package/dist/contexts/docs.d.ts +2 -0
  39. package/dist/contexts/docs.js +3 -0
  40. package/dist/contexts/index.d.ts +16 -0
  41. package/dist/contexts/index.js +7 -0
  42. package/dist/contexts/markdown.d.ts +2 -0
  43. package/dist/contexts/markdown.js +4 -0
  44. package/dist/contexts/navigation.d.ts +2 -0
  45. package/dist/contexts/navigation.js +3 -0
  46. package/dist/contexts/use-components.d.ts +14 -0
  47. package/dist/contexts/use-components.js +4 -0
  48. package/dist/contexts-p3rRZDlM.js +39 -0
  49. package/dist/csharp-CDSxfCZE.js +283 -0
  50. package/dist/docs-CXqi26jB.js +54 -0
  51. package/dist/docs-dNFWvk6w.d.ts +47 -0
  52. package/dist/docs-mMDqYdkf.d.ts +47 -0
  53. package/dist/go-1c3S5ETL.js +303 -0
  54. package/dist/http-2QNWXH9t.js +330 -0
  55. package/dist/icons-Ckod9aod.js +869 -0
  56. package/dist/index-0imEqwWy.d.ts +15 -0
  57. package/dist/index-BJR7MT73.d.ts +13 -0
  58. package/dist/index-DGWbX2x8.d.ts +13 -0
  59. package/dist/index-DJO7hQAU.d.ts +274 -0
  60. package/dist/index-DMFZJxNb.d.ts +15 -0
  61. package/dist/index-tw6MEWKp.d.ts +274 -0
  62. package/dist/index.d.ts +19 -0
  63. package/dist/index.js +29 -7542
  64. package/dist/java-BbjF_oUI.js +403 -0
  65. package/dist/languages/csharp.d.ts +11 -0
  66. package/dist/languages/csharp.js +9 -0
  67. package/dist/languages/go.d.ts +11 -0
  68. package/dist/languages/go.js +9 -0
  69. package/dist/languages/http.d.ts +11 -0
  70. package/dist/languages/http.js +19 -0
  71. package/dist/languages/index.d.ts +11 -0
  72. package/dist/languages/index.js +26 -0
  73. package/dist/languages/java.d.ts +11 -0
  74. package/dist/languages/java.js +9 -0
  75. package/dist/languages/python.d.ts +11 -0
  76. package/dist/languages/python.js +9 -0
  77. package/dist/languages/ruby.d.ts +11 -0
  78. package/dist/languages/ruby.js +9 -0
  79. package/dist/languages/typescript.d.ts +11 -0
  80. package/dist/languages/typescript.js +9 -0
  81. package/dist/languages-BCYZjzuS.js +26 -0
  82. package/dist/markdown/index.d.ts +12 -0
  83. package/dist/markdown/index.js +104 -0
  84. package/dist/markdown/md.d.ts +15 -0
  85. package/dist/markdown/md.js +3 -0
  86. package/dist/markdown/printer.d.ts +2 -0
  87. package/dist/markdown/printer.js +28 -0
  88. package/dist/markdown/utils.d.ts +3 -0
  89. package/dist/markdown/utils.js +3 -0
  90. package/dist/markdown-CxdeWgjV.js +48 -0
  91. package/dist/markdown-DeSSIANr.d.ts +22 -0
  92. package/dist/markdown-OuUthjwK.d.ts +22 -0
  93. package/dist/md-oM2tUaCA.js +41 -0
  94. package/dist/method-BiXJltKa.d.ts +71 -0
  95. package/dist/method-CE08mUME.js +115 -0
  96. package/dist/method-DQ3lDoTM.d.ts +71 -0
  97. package/dist/navigation-BX8nuda9.d.ts +29 -0
  98. package/dist/navigation-C5TN0SgC.js +24 -0
  99. package/dist/navigation-CWDfzVoR.d.ts +29 -0
  100. package/dist/overview-B43BuZbK.d.ts +39 -0
  101. package/dist/overview-MTDgZ7Xr.d.ts +39 -0
  102. package/dist/overview-S2hUqPXA.js +139 -0
  103. package/dist/primitives-1lB1L0is.d.ts +97 -0
  104. package/dist/primitives-BIWfwN5L.js +258 -0
  105. package/dist/primitives-DLv4uMoz.d.ts +97 -0
  106. package/dist/printer-DBw4S_Jn.d.ts +13 -0
  107. package/dist/printer-bNxiG6UB.js +74 -0
  108. package/dist/properties-B-giMW4K.d.ts +54 -0
  109. package/dist/properties-BvP2WAjP.d.ts +54 -0
  110. package/dist/properties-jlGW3USi.js +131 -0
  111. package/dist/python-USOwFDv_.js +279 -0
  112. package/dist/routing-CMqh1cTZ.d.ts +54 -0
  113. package/dist/routing-Wbb7YECB.js +194 -0
  114. package/dist/routing.d.ts +2 -0
  115. package/dist/routing.js +3 -180
  116. package/dist/ruby-CSvGbSLe.js +387 -0
  117. package/dist/sdk-BwXeHS3_.d.ts +118 -0
  118. package/dist/sdk-CSCbbn3O.js +336 -0
  119. package/dist/sdk-DXdNszcC.d.ts +118 -0
  120. package/dist/sidebar-CWyvCrJ0.js +81 -0
  121. package/dist/sidebar-DGGt5gik.d.ts +36 -0
  122. package/dist/sidebar-DfS6SWQz.d.ts +36 -0
  123. package/dist/snippets-BQLXEIf6.js +161 -0
  124. package/dist/snippets-BRs_4F1I.d.ts +51 -0
  125. package/dist/snippets-DxSMK50g.d.ts +51 -0
  126. package/dist/spec.d.ts +65 -0
  127. package/dist/spec.js +167 -0
  128. package/dist/style-D7RO5ymE.d.ts +168 -0
  129. package/dist/style-gnVEeXFj.js +169 -0
  130. package/dist/style.d.ts +2 -0
  131. package/dist/style.js +3 -0
  132. package/dist/styles/main.css +727 -754
  133. package/dist/styles/main.js +0 -0
  134. package/dist/styles/primitives.css +317 -461
  135. package/dist/styles/primitives.js +0 -0
  136. package/dist/styles/resets.css +32 -41
  137. package/dist/styles/resets.js +0 -0
  138. package/dist/styles/search.css +175 -274
  139. package/dist/styles/search.js +0 -0
  140. package/dist/styles/sidebar.css +59 -60
  141. package/dist/styles/sidebar.js +0 -0
  142. package/dist/styles/variables.css +26 -89
  143. package/dist/styles/variables.js +0 -0
  144. package/dist/styles.css +2910 -0
  145. package/dist/styles.mjs +1 -0
  146. package/dist/typescript-DXG9psK3.js +449 -0
  147. package/dist/use-components-RWQbviGq.js +7 -0
  148. package/dist/utils-BaLi5Bed.d.ts +21 -0
  149. package/dist/utils-CqnL9Fc3.js +31 -0
  150. package/dist/utils-D_1AWSRX.js +32 -0
  151. package/dist/utils-_AEBNJhG.d.ts +21 -0
  152. package/dist/utils-d8paVwKN.d.ts +14 -0
  153. package/dist/utils.d.ts +2 -0
  154. package/dist/utils.js +3 -0
  155. package/package.json +73 -21
  156. package/dist/mcp.js +0 -16003
  157. package/dist/styles/snippets.css +0 -132
  158. package/src/components/breadcrumbs.tsx +0 -94
  159. package/src/components/chat.tsx +0 -154
  160. package/src/components/dropdown.tsx +0 -91
  161. package/src/components/icons.tsx +0 -584
  162. package/src/components/index.ts +0 -9
  163. package/src/components/method.tsx +0 -144
  164. package/src/components/overview.tsx +0 -159
  165. package/src/components/primitives.tsx +0 -284
  166. package/src/components/properties.tsx +0 -130
  167. package/src/components/scripts/dropdown.ts +0 -78
  168. package/src/components/sdk.tsx +0 -402
  169. package/src/components/sidebar.tsx +0 -99
  170. package/src/components/snippets.tsx +0 -179
  171. package/src/contexts/component-generics.tsx +0 -48
  172. package/src/contexts/component-types.tsx +0 -5
  173. package/src/contexts/component.tsx +0 -32
  174. package/src/contexts/docs.tsx +0 -75
  175. package/src/contexts/index.tsx +0 -17
  176. package/src/contexts/markdown.tsx +0 -43
  177. package/src/contexts/navigation.tsx +0 -44
  178. package/src/contexts/search.tsx +0 -28
  179. package/src/contexts/use-components.tsx +0 -4
  180. package/src/index.ts +0 -6
  181. package/src/languages/go.tsx +0 -281
  182. package/src/languages/http.tsx +0 -321
  183. package/src/languages/index.ts +0 -26
  184. package/src/languages/java.tsx +0 -358
  185. package/src/languages/python.tsx +0 -255
  186. package/src/languages/ruby.tsx +0 -320
  187. package/src/languages/typescript.tsx +0 -393
  188. package/src/markdown/index.ts +0 -107
  189. package/src/markdown/md.ts +0 -45
  190. package/src/markdown/utils.ts +0 -49
  191. package/src/routing.ts +0 -238
  192. package/src/search/form.tsx +0 -127
  193. package/src/search/index.tsx +0 -1
  194. package/src/search/indexer.ts +0 -246
  195. package/src/search/mcp.ts +0 -61
  196. package/src/search/printer.tsx +0 -86
  197. package/src/search/providers/algolia.ts +0 -88
  198. package/src/search/providers/fuse.ts +0 -19
  199. package/src/search/providers/pagefind.ts +0 -17
  200. package/src/search/providers/walker.ts +0 -30
  201. package/src/search/results.tsx +0 -181
  202. package/src/search/state.ts +0 -64
  203. package/src/search/types.ts +0 -116
  204. package/src/style.ts +0 -197
  205. package/src/styles/main.css +0 -993
  206. package/src/styles/primitives.css +0 -573
  207. package/src/styles/resets.css +0 -47
  208. package/src/styles/search.css +0 -342
  209. package/src/styles/sidebar.css +0 -87
  210. package/src/styles/snippets.css +0 -132
  211. package/src/styles/variables.css +0 -90
  212. package/src/utils.ts +0 -41
@@ -0,0 +1,303 @@
1
+ import { t as __export } from "./chunk-DRcLgZ1e.js";
2
+ import { n as useLanguageComponents } from "./contexts-p3rRZDlM.js";
3
+ import { t as useComponents } from "./use-components-RWQbviGq.js";
4
+ import { t as style_default } from "./style-gnVEeXFj.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__ */ __export({
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,330 @@
1
+ import { t as __export } from "./chunk-DRcLgZ1e.js";
2
+ import { a as useLanguage, l as useSpec, r as useDeclaration } from "./docs-CXqi26jB.js";
3
+ import { n as useLanguageComponents } from "./contexts-p3rRZDlM.js";
4
+ import { t as useComponents } from "./use-components-RWQbviGq.js";
5
+ import { t as style_default } from "./style-gnVEeXFj.js";
6
+ import { i as PropertyToggle } from "./properties-jlGW3USi.js";
7
+ import React from "react";
8
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
9
+
10
+ //#region src/languages/http.tsx
11
+ var http_exports = /* @__PURE__ */ __export({
12
+ Declaration: () => Declaration,
13
+ MethodInfo: () => MethodInfo,
14
+ MethodSignature: () => MethodSignature,
15
+ Property: () => Property,
16
+ Type: () => Type,
17
+ TypeName: () => TypeName
18
+ });
19
+ const ComplexTypes = {
20
+ HttpTypeUnion: "union",
21
+ HttpTypeIntersection: "intersection"
22
+ };
23
+ const constStyle = {
24
+ string: style_default.LiteralString,
25
+ number: style_default.LiteralNumeric,
26
+ boolean: style_default.LiteralBoolean
27
+ };
28
+ function Identifier({ name }) {
29
+ return /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx("span", {
30
+ className: style_default.TextIdentifier,
31
+ children: /^[_a-zA-Z][_a-zA-Z0-9]*$/.test(name) ? name : JSON.stringify(name)
32
+ }) });
33
+ }
34
+ function TypePreview({ path }) {
35
+ const spec = useSpec();
36
+ const language = useLanguage();
37
+ const decl = useDeclaration(path, false);
38
+ const { Join } = useComponents();
39
+ 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;
40
+ const items = decl.children.map((prop, key) => {
41
+ const decl$1 = spec?.decls?.[language]?.[prop];
42
+ return /* @__PURE__ */ jsx("span", {
43
+ className: style_default.TypePropertyName,
44
+ children: /* @__PURE__ */ jsx("span", {
45
+ className: style_default.TextIdentifier,
46
+ children: decl$1 && "key" in decl$1 ? decl$1?.["key"] : null
47
+ })
48
+ }, key);
49
+ });
50
+ return /* @__PURE__ */ jsxs("span", {
51
+ className: style_default.TypePreview,
52
+ "data-stldocs-type-preview": "properties",
53
+ children: [
54
+ /* @__PURE__ */ jsx("span", {
55
+ className: style_default.TypeBrace,
56
+ children: " { "
57
+ }),
58
+ /* @__PURE__ */ jsx("span", {
59
+ className: style_default.TypePreviewContent,
60
+ children: /* @__PURE__ */ jsx(Join, {
61
+ items,
62
+ limit: 3,
63
+ children: /* @__PURE__ */ jsx("span", {
64
+ className: style_default.TextOperator,
65
+ children: ", "
66
+ })
67
+ })
68
+ }),
69
+ /* @__PURE__ */ jsx("span", {
70
+ className: style_default.TypeBrace,
71
+ children: " } "
72
+ })
73
+ ]
74
+ });
75
+ }
76
+ function TypeName({ type }) {
77
+ const Lang = useLanguageComponents();
78
+ if (type.kind === "HttpTypeArray") return /* @__PURE__ */ jsxs(Fragment$1, { children: ["array of ", /* @__PURE__ */ jsx(Lang.TypeName, { type: type.elementType })] });
79
+ if (type.kind === "HttpTypeUnion" && type.types.every((t) => t.kind === "HttpTypeLiteral")) return "enum";
80
+ if (type.kind === "HttpTypeReference" && type.ident.split(".").at(-1) === "Record") return "map";
81
+ return ComplexTypes[type.kind] ?? /* @__PURE__ */ jsx(Lang.Type, { type });
82
+ }
83
+ function Type({ type }) {
84
+ const Lang = useLanguageComponents();
85
+ const { Join, SDKReference } = useComponents();
86
+ switch (type.kind) {
87
+ case "HttpTypeUnknown":
88
+ case "HttpTypeUndefined":
89
+ case "HttpTypeNull":
90
+ case "HttpTypeBoolean":
91
+ case "HttpTypeNumber": return /* @__PURE__ */ jsx("span", {
92
+ className: style_default.Type,
93
+ children: /* @__PURE__ */ jsx("span", {
94
+ className: style_default.TypePlain,
95
+ children: type.kind.slice(8).toLowerCase()
96
+ })
97
+ });
98
+ case "HttpTypeString": return /* @__PURE__ */ jsx("span", {
99
+ className: style_default.Type,
100
+ children: /* @__PURE__ */ jsx("span", {
101
+ className: style_default.TypePlain,
102
+ children: "string"
103
+ })
104
+ });
105
+ case "HttpTypeLiteral": return /* @__PURE__ */ jsx("span", {
106
+ className: style_default.Type,
107
+ children: /* @__PURE__ */ jsx("span", {
108
+ className: constStyle[typeof type.literal],
109
+ children: JSON.stringify(type.literal)
110
+ })
111
+ });
112
+ case "HttpTypeArray": return /* @__PURE__ */ jsxs("span", {
113
+ className: style_default.Type,
114
+ children: [/* @__PURE__ */ jsx("span", {
115
+ className: style_default.TypeArray,
116
+ children: "array of "
117
+ }), /* @__PURE__ */ jsx(Lang.Type, { type: type.elementType })]
118
+ });
119
+ case "HttpTypeIntersection":
120
+ case "HttpTypeUnion": {
121
+ const items = type.types.map((t, key) => /* @__PURE__ */ jsx(Lang.Type, { type: t }, key));
122
+ const delimiter = type.kind === "HttpTypeUnion" ? "or" : "and";
123
+ return /* @__PURE__ */ jsx("span", {
124
+ className: style_default.Type,
125
+ children: /* @__PURE__ */ jsx("span", {
126
+ className: style_default.TypePreview,
127
+ "data-stldocs-type-preview": "union",
128
+ children: /* @__PURE__ */ jsx("span", {
129
+ className: style_default.TypePreviewContent,
130
+ children: /* @__PURE__ */ jsx(Join, {
131
+ items,
132
+ limit: 3,
133
+ children: /* @__PURE__ */ jsxs("span", {
134
+ className: style_default.TextOperator,
135
+ children: [
136
+ " ",
137
+ delimiter,
138
+ " "
139
+ ]
140
+ })
141
+ })
142
+ })
143
+ })
144
+ });
145
+ }
146
+ case "HttpTypeReference": {
147
+ const name = type.ident.split(".").at(-1);
148
+ const params = type.typeParameters?.map((param, key) => /* @__PURE__ */ jsx(Lang.Type, { type: param }, key));
149
+ if (name === "Record" && type.typeParameters?.length === 2 && type.typeParameters?.at(0).kind === "HttpTypeString") return /* @__PURE__ */ jsxs(Fragment$1, { children: [
150
+ /* @__PURE__ */ jsx("span", {
151
+ className: style_default.TypeArray,
152
+ children: "map"
153
+ }),
154
+ "[",
155
+ params?.[1],
156
+ "]"
157
+ ] });
158
+ return /* @__PURE__ */ jsxs("span", {
159
+ className: style_default.Type,
160
+ children: [
161
+ /* @__PURE__ */ jsx(SDKReference, {
162
+ stainlessPath: type.$ref,
163
+ children: name
164
+ }),
165
+ params && params.length > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [
166
+ /* @__PURE__ */ jsx("span", {
167
+ className: style_default.TypeBracket,
168
+ children: "<"
169
+ }),
170
+ /* @__PURE__ */ jsx(Join, {
171
+ items: params,
172
+ limit: 3,
173
+ children: /* @__PURE__ */ jsx("span", {
174
+ className: style_default.TextOperator,
175
+ children: ", "
176
+ })
177
+ }),
178
+ /* @__PURE__ */ jsx("span", {
179
+ className: style_default.TypeBracket,
180
+ children: ">"
181
+ })
182
+ ] }),
183
+ /* @__PURE__ */ jsx(TypePreview, { path: type.$ref })
184
+ ]
185
+ });
186
+ }
187
+ case "HttpTypeObject": {
188
+ const items = type.members.map(({ ident }) => /* @__PURE__ */ jsx("span", {
189
+ className: style_default.TypePropertyName,
190
+ children: /* @__PURE__ */ jsx(Identifier, { name: ident })
191
+ }, ident));
192
+ return /* @__PURE__ */ jsxs("span", {
193
+ className: style_default.Type,
194
+ children: [/* @__PURE__ */ jsx("span", {
195
+ className: style_default.TypePlain,
196
+ children: "object"
197
+ }), /* @__PURE__ */ jsxs("span", {
198
+ className: style_default.TypePreview,
199
+ "data-stldocs-type-preview": "properties",
200
+ children: [
201
+ /* @__PURE__ */ jsx("span", {
202
+ className: style_default.TypeBrace,
203
+ children: " {"
204
+ }),
205
+ /* @__PURE__ */ jsxs("span", {
206
+ className: style_default.TypePreviewContent,
207
+ children: [
208
+ " ",
209
+ /* @__PURE__ */ jsx(Join, {
210
+ items,
211
+ limit: 3,
212
+ children: /* @__PURE__ */ jsx("span", {
213
+ className: style_default.TextOperator,
214
+ children: ", "
215
+ })
216
+ }),
217
+ " "
218
+ ]
219
+ }),
220
+ /* @__PURE__ */ jsx("span", {
221
+ className: style_default.TypeBrace,
222
+ children: "} "
223
+ })
224
+ ]
225
+ })]
226
+ });
227
+ }
228
+ }
229
+ }
230
+ function MethodSignature({ decl }) {
231
+ return null;
232
+ }
233
+ function MethodInfo({ decl, children }) {
234
+ const Docs = useComponents();
235
+ const params = Object.entries(decl.paramsChildren).filter(([, value]) => value.length).map(([location, value]) => /* @__PURE__ */ jsx(React.Fragment, { children: /* @__PURE__ */ jsxs("div", {
236
+ className: style_default.MethodParameters,
237
+ "data-stldocs-property-group": location.at(0),
238
+ children: [/* @__PURE__ */ jsxs("h5", { children: [
239
+ location.at(0).toUpperCase(),
240
+ location.slice(1),
241
+ " Parameters",
242
+ /* @__PURE__ */ jsx(PropertyToggle, { target: location.at(0) })
243
+ ] }), /* @__PURE__ */ jsx(Docs.SDKChildren, { paths: value })]
244
+ }) }, location));
245
+ if ((decl.bodyParamsChildren?.["application/json"]?.length ?? 0) > 0) params.push(/* @__PURE__ */ jsxs("div", {
246
+ className: style_default.MethodInfoSection,
247
+ children: [/* @__PURE__ */ jsxs("h5", { children: ["Body Parameters", /* @__PURE__ */ jsx(PropertyToggle, { target: "body" })] }), /* @__PURE__ */ jsx("div", {
248
+ className: style_default.MethodParameters,
249
+ "data-stldocs-property-group": "body",
250
+ children: /* @__PURE__ */ jsx(Docs.SDKChildren, { paths: decl.bodyParamsChildren?.["application/json"] ?? [] })
251
+ })]
252
+ }));
253
+ return /* @__PURE__ */ jsxs("div", {
254
+ className: style_default.MethodInfo,
255
+ children: [
256
+ children && /* @__PURE__ */ jsx("div", {
257
+ className: style_default.MethodContent,
258
+ children
259
+ }),
260
+ params.length > 0 && params,
261
+ (decl.responseChildren?.length ?? 0) > 0 && /* @__PURE__ */ jsxs("div", {
262
+ className: style_default.MethodInfoSection,
263
+ children: [/* @__PURE__ */ jsxs("h5", { children: ["Returns", /* @__PURE__ */ jsx(PropertyToggle, { target: "returns" })] }), /* @__PURE__ */ jsx("div", {
264
+ className: style_default.MethodReturns,
265
+ "data-stldocs-property-group": "returns",
266
+ children: /* @__PURE__ */ jsx(Docs.SDKChildren, { paths: decl.responseChildren ?? [] })
267
+ })]
268
+ })
269
+ ]
270
+ });
271
+ }
272
+ function renderVariantInfo(type) {
273
+ if (type.kind === "HttpTypeUnion" && type.types.every((t) => t.kind === "HttpTypeObject" || t.kind === "HttpTypeReference")) return /* @__PURE__ */ jsxs(Fragment$1, { children: [
274
+ "One of the following ",
275
+ type.types.length,
276
+ " object variants:"
277
+ ] });
278
+ }
279
+ function Property({ decl, children }) {
280
+ const Lang = useLanguageComponents();
281
+ if (!decl) return;
282
+ switch (decl.kind) {
283
+ case "HttpDeclProperty": {
284
+ const variants = renderVariantInfo(decl.type);
285
+ return children({
286
+ name: decl.key,
287
+ typeName: /* @__PURE__ */ jsx(Lang.TypeName, { type: decl.type }),
288
+ type: decl.type.kind in ComplexTypes && !variants && /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
289
+ });
290
+ }
291
+ case "HttpDeclTypeAlias": return children({
292
+ name: decl.ident,
293
+ typeName: /* @__PURE__ */ jsx(Lang.TypeName, { type: decl.type })
294
+ });
295
+ case "HttpDeclReference": return children({ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type }) });
296
+ }
297
+ }
298
+ function Declaration({ decl }) {
299
+ const Lang = useLanguageComponents();
300
+ if (!decl) return;
301
+ switch (decl.kind) {
302
+ case "HttpDeclProperty": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
303
+ /* @__PURE__ */ jsx("span", {
304
+ className: style_default.TypePropertyName,
305
+ children: /* @__PURE__ */ jsx(Identifier, { name: decl.key })
306
+ }),
307
+ /* @__PURE__ */ jsx("span", {
308
+ className: style_default.TextPunctuation,
309
+ children: ": "
310
+ }),
311
+ decl.optional && /* @__PURE__ */ jsx("span", {
312
+ className: style_default.TextPunctuation,
313
+ children: "optional "
314
+ }),
315
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
316
+ ] });
317
+ case "HttpDeclTypeAlias": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
318
+ /* @__PURE__ */ jsx(Identifier, { name: decl.ident }),
319
+ /* @__PURE__ */ jsx("span", {
320
+ className: style_default.TextOperator,
321
+ children: " = "
322
+ }),
323
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
324
+ ] });
325
+ case "HttpDeclReference": return /* @__PURE__ */ jsx(Lang.Type, { type: decl.type });
326
+ }
327
+ }
328
+
329
+ //#endregion
330
+ export { Type as a, Property as i, MethodInfo as n, TypeName as o, MethodSignature as r, http_exports as s, Declaration as t };