@stainless-api/docs-ui 0.1.0-beta.72 → 0.1.0-beta.74

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 (135) hide show
  1. package/dist/{chunk-BN_g-Awi.js → chunk-BYypO7fO.js} +3 -3
  2. package/dist/components/MaskedInput.d.ts +1 -1
  3. package/dist/components/MaskedInput.js +1 -1
  4. package/dist/components/breadcrumbs.d.ts +24 -1
  5. package/dist/components/breadcrumbs.js +62 -7
  6. package/dist/components/icons.d.ts +12 -12
  7. package/dist/components/icons.js +883 -1
  8. package/dist/components/index.d.ts +16 -14
  9. package/dist/components/index.js +72 -18
  10. package/dist/components/method.d.ts +58 -1
  11. package/dist/components/method.js +95 -8
  12. package/dist/components/overview.d.ts +38 -1
  13. package/dist/components/overview.js +137 -9
  14. package/dist/components/primitives.d.ts +104 -1
  15. package/dist/components/primitives.js +250 -6
  16. package/dist/components/properties.d.ts +53 -1
  17. package/dist/components/properties.js +138 -7
  18. package/dist/components/sdk-sidebar.d.ts +14 -1
  19. package/dist/components/sdk-sidebar.js +50 -8
  20. package/dist/components/sdk.d.ts +121 -1
  21. package/dist/components/sdk.js +404 -8
  22. package/dist/components/snippets.d.ts +70 -13
  23. package/dist/components/snippets.js +182 -7
  24. package/dist/components/stl-sidebar.d.ts +57 -1
  25. package/dist/components/stl-sidebar.js +105 -3
  26. package/dist/contexts/component-generics.d.ts +29 -1
  27. package/dist/contexts/component-generics.js +31 -1
  28. package/dist/contexts/component-types.d.ts +4 -15
  29. package/dist/contexts/component.d.ts +7 -17
  30. package/dist/contexts/component.js +22 -28
  31. package/dist/contexts/docs.d.ts +61 -1
  32. package/dist/contexts/docs.js +89 -1
  33. package/dist/contexts/index.d.ts +13 -14
  34. package/dist/contexts/index.js +44 -6
  35. package/dist/contexts/markdown.d.ts +21 -1
  36. package/dist/contexts/markdown.js +47 -2
  37. package/dist/contexts/navigation.d.ts +28 -1
  38. package/dist/contexts/navigation.js +22 -1
  39. package/dist/contexts/use-components.d.ts +1 -13
  40. package/dist/contexts/use-components.js +6 -2
  41. package/dist/{index-W4Td2Hl7.d.ts → index-PdnFhQF9.d.ts} +1 -1
  42. package/dist/index.d.ts +4 -14
  43. package/dist/index.js +7 -30
  44. package/dist/languages/cli.d.ts +38 -14
  45. package/dist/languages/cli.js +166 -20
  46. package/dist/languages/csharp.d.ts +42 -14
  47. package/dist/languages/csharp.js +283 -8
  48. package/dist/languages/go.d.ts +40 -14
  49. package/dist/languages/go.js +303 -8
  50. package/dist/languages/http.d.ts +46 -14
  51. package/dist/languages/http.js +390 -19
  52. package/dist/languages/index.d.ts +50 -14
  53. package/dist/languages/index.js +30 -28
  54. package/dist/languages/java.d.ts +43 -14
  55. package/dist/languages/java.js +403 -8
  56. package/dist/languages/python.d.ts +40 -14
  57. package/dist/languages/python.js +269 -8
  58. package/dist/languages/ruby.d.ts +40 -14
  59. package/dist/languages/ruby.js +387 -8
  60. package/dist/languages/terraform.d.ts +48 -14
  61. package/dist/languages/terraform.js +243 -8
  62. package/dist/languages/typescript.d.ts +40 -14
  63. package/dist/languages/typescript.js +449 -8
  64. package/dist/markdown/index.d.ts +1 -2
  65. package/dist/markdown/index.js +1 -28
  66. package/dist/markdown/printer.d.ts +2 -2
  67. package/dist/markdown/printer.js +6 -30
  68. package/dist/markdown/utils.d.ts +3 -3
  69. package/dist/routing.d.ts +61 -2
  70. package/dist/routing.js +204 -2
  71. package/dist/spec.d.ts +4 -4
  72. package/dist/spec.js +2 -2
  73. package/dist/style.js +176 -1
  74. package/dist/use-strict-context-L0c8JKg4.js +16 -0
  75. package/dist/utils.d.ts +1 -1
  76. package/dist/utils.js +53 -2
  77. package/package.json +3 -3
  78. package/dist/breadcrumbs-46Qjx1Pd.d.ts +0 -25
  79. package/dist/breadcrumbs-BZ4wBC9-.d.ts +0 -25
  80. package/dist/breadcrumbs-BiBfNqBI.js +0 -63
  81. package/dist/cli-hduQ5XS1.js +0 -166
  82. package/dist/component-BU8BTbqz.js +0 -23
  83. package/dist/component-generics-Bw4ZOyEG.d.ts +0 -30
  84. package/dist/component-generics-D-WarFUb.d.ts +0 -30
  85. package/dist/component-generics-POFirVVb.js +0 -45
  86. package/dist/components-9NMl1791.js +0 -72
  87. package/dist/contexts-_NNW5yqC.js +0 -44
  88. package/dist/csharp-sn5CJu9t.js +0 -283
  89. package/dist/docs-Cu9Yl6-y.d.ts +0 -66
  90. package/dist/docs-YgoQ3bzY.js +0 -81
  91. package/dist/docs-xb5wYGjM.d.ts +0 -66
  92. package/dist/go-BoaAVmP0.js +0 -303
  93. package/dist/http-B3qTyMc3.js +0 -389
  94. package/dist/icons-BYKn5X8E.js +0 -885
  95. package/dist/index-BOmn7DHa.d.ts +0 -428
  96. package/dist/index-BvcPmB0r.d.ts +0 -428
  97. package/dist/java-BiLRuLuD.js +0 -403
  98. package/dist/languages-vUhD5Hu_.js +0 -30
  99. package/dist/markdown-BszOPZhh.d.ts +0 -22
  100. package/dist/markdown-Cq3XEhrR.js +0 -49
  101. package/dist/markdown-plMAoN22.d.ts +0 -22
  102. package/dist/method-C4PgTWAu.d.ts +0 -59
  103. package/dist/method-D6R_farj.d.ts +0 -59
  104. package/dist/method-DjzVBzZe.js +0 -96
  105. package/dist/navigation-HiZWRl34.d.ts +0 -29
  106. package/dist/navigation-MrP4Ubbg.d.ts +0 -29
  107. package/dist/navigation-aoYZ_tl4.js +0 -24
  108. package/dist/overview-CTeKhpQq.d.ts +0 -39
  109. package/dist/overview-Yf1PTJNi.d.ts +0 -39
  110. package/dist/overview-ocTARt-j.js +0 -138
  111. package/dist/primitives-CNG-fEhQ.js +0 -250
  112. package/dist/primitives-K7NijV36.d.ts +0 -105
  113. package/dist/primitives-WGxdBJDS.d.ts +0 -105
  114. package/dist/properties-Bu4nW9JD.d.ts +0 -54
  115. package/dist/properties-Bynmj9_H.d.ts +0 -54
  116. package/dist/properties-DQU0NBzb.js +0 -138
  117. package/dist/python-nqOBH7GS.js +0 -269
  118. package/dist/routing-C64k4fmX.js +0 -205
  119. package/dist/routing-pAL4V4hv.d.ts +0 -61
  120. package/dist/ruby-BBc8HdIt.js +0 -387
  121. package/dist/sdk-BSdgEEJw.js +0 -405
  122. package/dist/sdk-BVCk1ox2.d.ts +0 -122
  123. package/dist/sdk-Dm0S-XQE.d.ts +0 -122
  124. package/dist/sdk-sidebar-B1ehT_xI.d.ts +0 -15
  125. package/dist/sdk-sidebar-BDn8S1xS.js +0 -50
  126. package/dist/sdk-sidebar-Dqeu7C1-.d.ts +0 -15
  127. package/dist/snippets-CLpNVNlA.js +0 -181
  128. package/dist/stl-sidebar-BTTErIJs.d.ts +0 -58
  129. package/dist/stl-sidebar-C7GNALtk.d.ts +0 -58
  130. package/dist/stl-sidebar-DC5UOJiT.js +0 -106
  131. package/dist/style-DJIYkFhO.js +0 -178
  132. package/dist/terraform-DVx2ea2h.js +0 -243
  133. package/dist/typescript-Cmk-jBBw.js +0 -449
  134. package/dist/use-components-BUz3GbO4.js +0 -7
  135. package/dist/utils-DPbkW1Tz.js +0 -54
@@ -1,303 +0,0 @@
1
- import { t as __exportAll } from "./chunk-BN_g-Awi.js";
2
- import { n as useLanguageComponents } from "./contexts-_NNW5yqC.js";
3
- import { t as useComponents } from "./use-components-BUz3GbO4.js";
4
- import { t as style_default } from "./style-DJIYkFhO.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 };
@@ -1,389 +0,0 @@
1
- import { t as __exportAll } from "./chunk-BN_g-Awi.js";
2
- import { i as useDeclaration, m as useSpec, n as useAvailableLanguages, s as useLanguage } from "./docs-YgoQ3bzY.js";
3
- import { n as useNavigation } from "./navigation-aoYZ_tl4.js";
4
- import { n as useLanguageComponents } from "./contexts-_NNW5yqC.js";
5
- import { t as useComponents } from "./use-components-BUz3GbO4.js";
6
- import { t as style_default } from "./style-DJIYkFhO.js";
7
- import { i as PropertyToggle } from "./properties-DQU0NBzb.js";
8
- import { s as generateRoute, t as LanguageNames } from "./routing-C64k4fmX.js";
9
- import { y as useStreamingResponse } from "./sdk-BSdgEEJw.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 };