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

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