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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/dist/breadcrumbs-BaNU4WsC.d.ts +25 -0
  2. package/dist/chunk-pbuEa-1d.js +13 -0
  3. package/dist/component-generics-D9XaPlr8.d.ts +30 -0
  4. package/dist/component-generics-DYxBWv1v.js +42 -0
  5. package/dist/components/MaskedInput.d.ts +14 -0
  6. package/dist/components/MaskedInput.js +74 -0
  7. package/dist/components/breadcrumbs.d.ts +2 -0
  8. package/dist/components/breadcrumbs.js +61 -0
  9. package/dist/components/icons.d.ts +72 -0
  10. package/dist/components/icons.js +953 -0
  11. package/dist/components/index.d.ts +10 -0
  12. package/dist/components/index.js +72 -0
  13. package/dist/components/method.d.ts +2 -0
  14. package/dist/components/method.js +94 -0
  15. package/dist/components/overview.d.ts +2 -0
  16. package/dist/components/overview.js +139 -0
  17. package/dist/components/primitives.d.ts +2 -0
  18. package/dist/components/primitives.js +250 -0
  19. package/dist/components/properties.d.ts +2 -0
  20. package/dist/components/properties.js +143 -0
  21. package/dist/components/sdk-sidebar.d.ts +2 -0
  22. package/dist/components/sdk-sidebar.js +49 -0
  23. package/dist/components/sdk.d.ts +2 -0
  24. package/dist/components/sdk.js +487 -0
  25. package/dist/components/snippets.d.ts +2 -0
  26. package/dist/components/snippets.js +183 -0
  27. package/dist/components/stl-sidebar.d.ts +2 -0
  28. package/dist/components/stl-sidebar.js +111 -0
  29. package/dist/contexts/component-generics.d.ts +2 -0
  30. package/dist/contexts/component-generics.js +2 -0
  31. package/dist/contexts/component-types.d.ts +7 -0
  32. package/dist/contexts/component-types.js +0 -0
  33. package/dist/contexts/component.d.ts +20 -0
  34. package/dist/contexts/component.js +21 -0
  35. package/dist/contexts/docs.d.ts +2 -0
  36. package/dist/contexts/docs.js +89 -0
  37. package/dist/contexts/index.d.ts +6 -0
  38. package/dist/contexts/index.js +43 -0
  39. package/dist/contexts/markdown.d.ts +2 -0
  40. package/dist/contexts/markdown.js +62 -0
  41. package/dist/contexts/navigation.d.ts +2 -0
  42. package/dist/contexts/navigation.js +21 -0
  43. package/dist/contexts/use-components.d.ts +6 -0
  44. package/dist/contexts/use-components.js +5 -0
  45. package/dist/docs-D0qzNoXq.d.ts +62 -0
  46. package/dist/index-DFr9Mesr.d.ts +1776 -0
  47. package/dist/index-Dt9uPKZP.d.ts +464 -0
  48. package/dist/index.d.ts +5 -0
  49. package/dist/index.js +7 -7542
  50. package/dist/languages/cli.d.ts +2 -0
  51. package/dist/languages/cli.js +164 -0
  52. package/dist/languages/csharp.d.ts +2 -0
  53. package/dist/languages/csharp.js +281 -0
  54. package/dist/languages/go.d.ts +2 -0
  55. package/dist/languages/go.js +301 -0
  56. package/dist/languages/http.d.ts +2 -0
  57. package/dist/languages/http.js +381 -0
  58. package/dist/languages/index.d.ts +2 -0
  59. package/dist/languages/index.js +30 -0
  60. package/dist/languages/java.d.ts +2 -0
  61. package/dist/languages/java.js +401 -0
  62. package/dist/languages/php.d.ts +2 -0
  63. package/dist/languages/php.js +310 -0
  64. package/dist/languages/python.d.ts +2 -0
  65. package/dist/languages/python.js +267 -0
  66. package/dist/languages/ruby.d.ts +2 -0
  67. package/dist/languages/ruby.js +385 -0
  68. package/dist/languages/terraform.d.ts +2 -0
  69. package/dist/languages/terraform.js +258 -0
  70. package/dist/languages/typescript.d.ts +2 -0
  71. package/dist/languages/typescript.js +447 -0
  72. package/dist/markdown/index.d.ts +11 -0
  73. package/dist/markdown/index.js +86 -0
  74. package/dist/markdown/md.d.ts +15 -0
  75. package/dist/markdown/md.js +39 -0
  76. package/dist/markdown/printer.d.ts +13 -0
  77. package/dist/markdown/printer.js +73 -0
  78. package/dist/markdown/utils.d.ts +28 -0
  79. package/dist/markdown/utils.js +31 -0
  80. package/dist/markdown-B30HO-Vy.d.ts +33 -0
  81. package/dist/method-BKJnP-rW.d.ts +59 -0
  82. package/dist/navigation-DGl8lR6w.d.ts +29 -0
  83. package/dist/overview-iH1evPEF.d.ts +39 -0
  84. package/dist/primitives-BHt-BuLf.d.ts +107 -0
  85. package/dist/properties-CCbMRhSX.d.ts +54 -0
  86. package/dist/routing-yTSG7nWM.d.ts +61 -0
  87. package/dist/routing.d.ts +2 -0
  88. package/dist/routing.js +174 -150
  89. package/dist/sdk-BengV7mg.d.ts +128 -0
  90. package/dist/sdk-sidebar-CRqLm3YO.d.ts +15 -0
  91. package/dist/spec.d.ts +65 -0
  92. package/dist/spec.js +165 -0
  93. package/dist/stl-sidebar-Pra9uCYo.d.ts +58 -0
  94. package/dist/style.d.ts +178 -0
  95. package/dist/style.js +178 -0
  96. package/dist/styles/main.css +765 -755
  97. package/dist/styles/primitives.css +359 -442
  98. package/dist/styles/resets.css +25 -41
  99. package/dist/styles/search.css +187 -270
  100. package/dist/styles/sidebar.css +155 -69
  101. package/dist/styles/variables.css +23 -89
  102. package/dist/styles.css +3171 -0
  103. package/dist/utils.d.ts +20 -0
  104. package/dist/utils.js +52 -0
  105. package/package.json +75 -22
  106. package/dist/mcp.js +0 -16003
  107. package/dist/styles/snippets.css +0 -132
  108. package/src/components/breadcrumbs.tsx +0 -94
  109. package/src/components/chat.tsx +0 -154
  110. package/src/components/dropdown.tsx +0 -91
  111. package/src/components/icons.tsx +0 -584
  112. package/src/components/index.ts +0 -9
  113. package/src/components/method.tsx +0 -146
  114. package/src/components/overview.tsx +0 -160
  115. package/src/components/primitives.tsx +0 -284
  116. package/src/components/properties.tsx +0 -130
  117. package/src/components/scripts/dropdown.ts +0 -78
  118. package/src/components/sdk.tsx +0 -403
  119. package/src/components/sidebar.tsx +0 -99
  120. package/src/components/snippets.tsx +0 -180
  121. package/src/contexts/component-generics.tsx +0 -48
  122. package/src/contexts/component-types.tsx +0 -5
  123. package/src/contexts/component.tsx +0 -32
  124. package/src/contexts/docs.tsx +0 -75
  125. package/src/contexts/index.tsx +0 -17
  126. package/src/contexts/markdown.tsx +0 -43
  127. package/src/contexts/navigation.tsx +0 -44
  128. package/src/contexts/search.tsx +0 -28
  129. package/src/contexts/use-components.tsx +0 -4
  130. package/src/index.ts +0 -6
  131. package/src/languages/go.tsx +0 -281
  132. package/src/languages/http.tsx +0 -321
  133. package/src/languages/index.ts +0 -26
  134. package/src/languages/java.tsx +0 -358
  135. package/src/languages/python.tsx +0 -255
  136. package/src/languages/ruby.tsx +0 -320
  137. package/src/languages/typescript.tsx +0 -393
  138. package/src/markdown/index.ts +0 -107
  139. package/src/markdown/md.ts +0 -45
  140. package/src/markdown/utils.ts +0 -49
  141. package/src/routing.ts +0 -238
  142. package/src/search/form.tsx +0 -127
  143. package/src/search/index.tsx +0 -1
  144. package/src/search/indexer.ts +0 -246
  145. package/src/search/mcp.ts +0 -61
  146. package/src/search/printer.tsx +0 -86
  147. package/src/search/providers/algolia.ts +0 -88
  148. package/src/search/providers/fuse.ts +0 -19
  149. package/src/search/providers/pagefind.ts +0 -17
  150. package/src/search/providers/walker.ts +0 -30
  151. package/src/search/results.tsx +0 -182
  152. package/src/search/state.ts +0 -64
  153. package/src/search/types.ts +0 -116
  154. package/src/style.ts +0 -196
  155. package/src/styles/main.css +0 -986
  156. package/src/styles/primitives.css +0 -580
  157. package/src/styles/resets.css +0 -39
  158. package/src/styles/search.css +0 -341
  159. package/src/styles/sidebar.css +0 -85
  160. package/src/styles/snippets.css +0 -130
  161. package/src/styles/variables.css +0 -86
  162. package/src/utils.ts +0 -41
@@ -0,0 +1,447 @@
1
+ import { t as __exportAll } from "../chunk-pbuEa-1d.js";
2
+ import { useDeclaration, useLanguage, useSpec } from "../contexts/docs.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/typescript.tsx
9
+ var typescript_exports = /* @__PURE__ */ __exportAll({
10
+ Declaration: () => Declaration,
11
+ MethodSignature: () => MethodSignature,
12
+ Property: () => Property,
13
+ Type: () => Type,
14
+ TypeName: () => TypeName
15
+ });
16
+ const ComplexTypes = {
17
+ TSTypeObject: "object",
18
+ TSTypeUnion: "union",
19
+ TSTypeInterface: "interface",
20
+ TSTypeIntersection: "intersection",
21
+ TSTypeArray: "array"
22
+ };
23
+ const constStyle = {
24
+ string: style_default.LiteralString,
25
+ number: style_default.LiteralNumeric,
26
+ boolean: style_default.LiteralBoolean
27
+ };
28
+ function Identifier({ name, optional }) {
29
+ return /* @__PURE__ */ jsxs(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
+ }), optional && /* @__PURE__ */ jsx("span", {
33
+ className: style_default.TextPunctuation,
34
+ children: "?"
35
+ })] });
36
+ }
37
+ function TypeParams({ params }) {
38
+ const Lang = useLanguageComponents();
39
+ const { Join } = useComponents();
40
+ if (!params?.length) return null;
41
+ const typeParams = params?.map((param, key) => param.constraint ? /* @__PURE__ */ jsxs(React$1.Fragment, { children: [
42
+ /* @__PURE__ */ jsx("span", {
43
+ className: style_default.TypeReference,
44
+ children: param.name
45
+ }),
46
+ /* @__PURE__ */ jsx("span", {
47
+ className: style_default.TextKeyword,
48
+ children: "extends "
49
+ }),
50
+ /* @__PURE__ */ jsx(Lang.Type, { type: param.constraint })
51
+ ] }, key) : /* @__PURE__ */ jsx(React$1.Fragment, { children: "param.name" }, key));
52
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
53
+ /* @__PURE__ */ jsx("span", {
54
+ className: style_default.TypeBracket,
55
+ children: "<"
56
+ }),
57
+ /* @__PURE__ */ jsx(Join, {
58
+ items: typeParams,
59
+ limit: 3,
60
+ children: /* @__PURE__ */ jsx("span", {
61
+ className: style_default.TextOperator,
62
+ children: ", "
63
+ })
64
+ }),
65
+ /* @__PURE__ */ jsx("span", {
66
+ className: style_default.TypeBracket,
67
+ children: ">"
68
+ })
69
+ ] });
70
+ }
71
+ function TypePreview({ path }) {
72
+ const spec = useSpec();
73
+ const language = useLanguage();
74
+ const decl = useDeclaration(path, false);
75
+ const { Join } = useComponents();
76
+ if (!(decl && "children" in decl && decl.children && decl.children.length > 0) || decl && "type" in decl && decl.type !== void 0 && "kind" in decl["type"] && decl["type"]["kind"] === "TSTypeUnion") return;
77
+ const items = decl.children.map((prop, key) => {
78
+ const p = spec?.decls?.[language]?.[prop];
79
+ return /* @__PURE__ */ jsx("span", {
80
+ className: style_default.TypePropertyName,
81
+ children: /* @__PURE__ */ jsx("span", {
82
+ className: style_default.TextIdentifier,
83
+ children: p && "key" in p ? p["key"] : null
84
+ })
85
+ }, key);
86
+ });
87
+ return /* @__PURE__ */ jsxs("span", {
88
+ className: style_default.TypePreview,
89
+ "data-stldocs-type-preview": "properties",
90
+ children: [
91
+ /* @__PURE__ */ jsx("span", {
92
+ className: style_default.TypeBrace,
93
+ children: " {"
94
+ }),
95
+ /* @__PURE__ */ jsxs("span", {
96
+ className: style_default.TypePreviewContent,
97
+ children: [
98
+ " ",
99
+ /* @__PURE__ */ jsx(Join, {
100
+ items,
101
+ limit: 3,
102
+ children: /* @__PURE__ */ jsx("span", {
103
+ className: style_default.TextOperator,
104
+ children: ", "
105
+ })
106
+ }),
107
+ " "
108
+ ]
109
+ }),
110
+ /* @__PURE__ */ jsx("span", {
111
+ className: style_default.TypeBrace,
112
+ children: "} "
113
+ })
114
+ ]
115
+ });
116
+ }
117
+ function TypeName({ type }) {
118
+ const Lang = useLanguageComponents();
119
+ return ComplexTypes[type.kind] ?? /* @__PURE__ */ jsx(Lang.Type, { type });
120
+ }
121
+ function Type({ type }) {
122
+ const Lang = useLanguageComponents();
123
+ const { Join, SDKReference } = useComponents();
124
+ switch (type.kind) {
125
+ case "TSTypeUnknown":
126
+ case "TSTypeUndefined":
127
+ case "TSTypeNever":
128
+ case "TSTypeVoid":
129
+ case "TSTypeNull":
130
+ case "TSTypeAny":
131
+ case "TSTypeBoolean":
132
+ case "TSTypeNumber": return /* @__PURE__ */ jsx("span", {
133
+ className: style_default.Type,
134
+ children: /* @__PURE__ */ jsx("span", {
135
+ className: style_default.TypeKeyword,
136
+ children: type.kind.slice(6).toLowerCase()
137
+ })
138
+ });
139
+ case "TSTypeString": return /* @__PURE__ */ jsx("span", {
140
+ className: style_default.Type,
141
+ children: /* @__PURE__ */ jsx("span", {
142
+ className: style_default.TypeString,
143
+ children: "string"
144
+ })
145
+ });
146
+ case "TSTypeLiteral": return /* @__PURE__ */ jsx("span", {
147
+ className: style_default.Type,
148
+ children: /* @__PURE__ */ jsx("span", {
149
+ className: constStyle[typeof type.literal],
150
+ children: JSON.stringify(type.literal)
151
+ })
152
+ });
153
+ case "TSTypeArray": return /* @__PURE__ */ jsxs("span", {
154
+ className: style_default.Type,
155
+ children: [
156
+ /* @__PURE__ */ jsx("span", {
157
+ className: style_default.TypeArray,
158
+ children: "Array<"
159
+ }),
160
+ /* @__PURE__ */ jsx(Lang.Type, { type: type.elementType }),
161
+ /* @__PURE__ */ jsx("span", {
162
+ className: style_default.TypeArray,
163
+ children: ">"
164
+ })
165
+ ]
166
+ });
167
+ case "TSTypeReference": {
168
+ const name = type.ident.split(".").at(-1);
169
+ const params = type.typeParameters?.map((param, key) => /* @__PURE__ */ jsx(Lang.Type, { type: param }, key));
170
+ return /* @__PURE__ */ jsxs("span", {
171
+ className: style_default.Type,
172
+ children: [
173
+ /* @__PURE__ */ jsx(SDKReference, {
174
+ stainlessPath: type.$ref,
175
+ children: name
176
+ }),
177
+ params && params.length > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [
178
+ /* @__PURE__ */ jsx("span", {
179
+ className: style_default.TypeBracket,
180
+ children: "<"
181
+ }),
182
+ /* @__PURE__ */ jsx(Join, {
183
+ items: params,
184
+ limit: 3,
185
+ children: /* @__PURE__ */ jsx("span", {
186
+ className: style_default.TextOperator,
187
+ children: ", "
188
+ })
189
+ }),
190
+ /* @__PURE__ */ jsx("span", {
191
+ className: style_default.TypeBracket,
192
+ children: ">"
193
+ })
194
+ ] }),
195
+ /* @__PURE__ */ jsx(TypePreview, { path: type.$ref })
196
+ ]
197
+ });
198
+ }
199
+ case "TSTypeIntersection":
200
+ case "TSTypeUnion": {
201
+ const items = type.types.map((t, key) => /* @__PURE__ */ jsx(Lang.Type, { type: t }, key));
202
+ const delimiter = type.kind === "TSTypeUnion" ? "|" : "&";
203
+ return /* @__PURE__ */ jsx("span", {
204
+ className: style_default.Type,
205
+ children: /* @__PURE__ */ jsx("span", {
206
+ className: style_default.TypePreview,
207
+ "data-stldocs-type-preview": "union",
208
+ children: /* @__PURE__ */ jsx("span", {
209
+ className: style_default.TypePreviewContent,
210
+ children: /* @__PURE__ */ jsx(Join, {
211
+ items,
212
+ limit: 3,
213
+ children: /* @__PURE__ */ jsxs("span", {
214
+ className: style_default.TextOperator,
215
+ children: [
216
+ " ",
217
+ delimiter,
218
+ " "
219
+ ]
220
+ })
221
+ })
222
+ })
223
+ })
224
+ });
225
+ }
226
+ case "TSTypeObject":
227
+ case "TSTypeInterface": {
228
+ const extend = type.kind === "TSTypeObject" ? null : type.extends?.map((ref, key) => /* @__PURE__ */ jsx(Lang.Type, { type: ref }, key));
229
+ const items = type.members.map((prop, key) => /* @__PURE__ */ jsxs(React$1.Fragment, { children: [
230
+ /* @__PURE__ */ jsx("span", {
231
+ className: style_default.TypePropertyName,
232
+ children: /* @__PURE__ */ jsx(Identifier, {
233
+ name: prop.ident,
234
+ optional: prop.optional
235
+ })
236
+ }),
237
+ /* @__PURE__ */ jsx("span", {
238
+ className: style_default.TextPunctuation,
239
+ children: ": "
240
+ }),
241
+ /* @__PURE__ */ jsx(Lang.Type, { type: prop.type })
242
+ ] }, key));
243
+ return /* @__PURE__ */ jsxs("span", {
244
+ className: style_default.Type,
245
+ children: [extend?.length ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
246
+ className: style_default.TypeKeyword,
247
+ children: " extends "
248
+ }), /* @__PURE__ */ jsx(Join, {
249
+ items: extend,
250
+ limit: 3,
251
+ children: /* @__PURE__ */ jsx("span", {
252
+ className: style_default.TextOperator,
253
+ children: ", "
254
+ })
255
+ })] }) : null, /* @__PURE__ */ jsxs("span", {
256
+ className: style_default.TypePreview,
257
+ "data-stldocs-type-preview": "properties",
258
+ children: [
259
+ /* @__PURE__ */ jsx("span", {
260
+ className: style_default.TypeBrace,
261
+ children: "{ "
262
+ }),
263
+ /* @__PURE__ */ jsx("span", {
264
+ className: style_default.TypePreviewContent,
265
+ children: /* @__PURE__ */ jsx(Join, {
266
+ items,
267
+ limit: 3,
268
+ children: /* @__PURE__ */ jsx("span", {
269
+ className: style_default.TextOperator,
270
+ children: ", "
271
+ })
272
+ })
273
+ }),
274
+ /* @__PURE__ */ jsx("span", {
275
+ className: style_default.TypeBrace,
276
+ children: "} "
277
+ })
278
+ ]
279
+ })]
280
+ });
281
+ }
282
+ }
283
+ }
284
+ function MethodSignature({ decl }) {
285
+ const Lang = useLanguageComponents();
286
+ const { Join, Tooltip } = useComponents();
287
+ const params = decl.signature.parameters.map((param, i) => /* @__PURE__ */ jsxs(React$1.Fragment, { children: [/* @__PURE__ */ jsx(Tooltip, {
288
+ content: /* @__PURE__ */ jsx(Lang.Type, { type: param.type }),
289
+ children: /* @__PURE__ */ jsx("span", {
290
+ className: style_default.TextIdentifier,
291
+ children: param.ident
292
+ })
293
+ }), param.optional && /* @__PURE__ */ jsx("span", {
294
+ className: style_default.TextPunctuation,
295
+ children: "?"
296
+ })] }, i));
297
+ return /* @__PURE__ */ jsx("div", {
298
+ className: style_default.MethodSignature,
299
+ children: /* @__PURE__ */ jsxs("span", {
300
+ className: style_default.SignatureTitle,
301
+ children: [
302
+ decl.signature.async && /* @__PURE__ */ jsx("span", {
303
+ className: style_default.TextKeyword,
304
+ children: "async "
305
+ }),
306
+ /* @__PURE__ */ jsx("span", {
307
+ className: style_default.SignatureQualified,
308
+ children: /* @__PURE__ */ jsx("span", {
309
+ className: style_default.TextIdentifier,
310
+ children: decl.qualified?.slice(0, -decl.ident.length)
311
+ })
312
+ }),
313
+ /* @__PURE__ */ jsx("span", {
314
+ className: style_default.SignatureName,
315
+ children: /* @__PURE__ */ jsx("span", {
316
+ className: style_default.TextIdentifier,
317
+ children: decl.ident
318
+ })
319
+ }),
320
+ /* @__PURE__ */ jsxs("span", {
321
+ className: style_default.MethodSignature,
322
+ children: [
323
+ decl.signature.typeParameters && /* @__PURE__ */ jsx(TypeParams, { params: decl.signature.typeParameters }),
324
+ /* @__PURE__ */ jsx("span", {
325
+ className: style_default.SignatureParen,
326
+ children: "("
327
+ }),
328
+ /* @__PURE__ */ jsx("span", {
329
+ className: style_default.SignatureParams,
330
+ children: /* @__PURE__ */ jsx(Join, {
331
+ items: params,
332
+ children: /* @__PURE__ */ jsx("span", {
333
+ className: style_default.TextOperator,
334
+ children: ", "
335
+ })
336
+ })
337
+ }),
338
+ /* @__PURE__ */ jsx("span", {
339
+ className: style_default.SignatureParen,
340
+ children: ")"
341
+ }),
342
+ decl.signature.returns && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
343
+ className: style_default.TextPunctuation,
344
+ children: ": "
345
+ }), /* @__PURE__ */ jsx(Lang.Type, { type: decl.signature.returns })] })
346
+ ]
347
+ })
348
+ ]
349
+ })
350
+ });
351
+ }
352
+ function Property({ decl, children }) {
353
+ const Lang = useLanguageComponents();
354
+ if (!decl) return;
355
+ switch (decl.kind) {
356
+ case "TSDeclProperty": return children({
357
+ name: decl.key,
358
+ typeName: /* @__PURE__ */ jsx(Lang.TypeName, { type: decl.type }),
359
+ type: decl.type.kind in ComplexTypes && /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
360
+ });
361
+ case "TSDeclTypeAlias": return children({
362
+ name: decl.ident,
363
+ typeName: "alias",
364
+ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
365
+ });
366
+ case "TSDeclReference": return children({ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type }) });
367
+ case "TSDeclInterface": return children({ type: /* @__PURE__ */ jsxs(Fragment$1, { children: [
368
+ /* @__PURE__ */ jsx("span", {
369
+ className: style_default.TextIdentifier,
370
+ children: decl.ident
371
+ }),
372
+ decl.typeParameters && /* @__PURE__ */ jsx(TypeParams, { params: decl.typeParameters }),
373
+ decl.extends?.flatMap((t, key) => /* @__PURE__ */ jsxs(React$1.Fragment, { children: [/* @__PURE__ */ jsx("span", {
374
+ className: style_default.TextKeyword,
375
+ children: " extends "
376
+ }), /* @__PURE__ */ jsx(Lang.Type, { type: t })] }, `extends:${key}`))
377
+ ] }) });
378
+ }
379
+ }
380
+ function Declaration({ decl }) {
381
+ const Lang = useLanguageComponents();
382
+ if (!decl) return;
383
+ switch (decl.kind) {
384
+ case "TSDeclProperty": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
385
+ decl.declare && /* @__PURE__ */ jsx("span", {
386
+ className: style_default.TextKeyword,
387
+ children: "declare "
388
+ }),
389
+ /* @__PURE__ */ jsx("span", {
390
+ className: style_default.TypePropertyName,
391
+ children: /* @__PURE__ */ jsx(Identifier, {
392
+ name: decl.key,
393
+ optional: decl.optional
394
+ })
395
+ }),
396
+ /* @__PURE__ */ jsx("span", {
397
+ className: style_default.TextPunctuation,
398
+ children: ": "
399
+ }),
400
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
401
+ ] });
402
+ case "TSDeclFunction": return /* @__PURE__ */ jsx(Lang.MethodSignature, { decl });
403
+ case "TSDeclTypeAlias": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
404
+ /* @__PURE__ */ jsx(Identifier, { name: decl.ident }),
405
+ /* @__PURE__ */ jsx(TypeParams, { params: decl.typeParameters }),
406
+ /* @__PURE__ */ jsx("span", {
407
+ className: style_default.TextOperator,
408
+ children: " = "
409
+ }),
410
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
411
+ ] });
412
+ case "TSDeclReference": return /* @__PURE__ */ jsx(Lang.Type, { type: decl.type });
413
+ case "TSDeclInterface": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
414
+ /* @__PURE__ */ jsx("span", {
415
+ className: style_default.TextIdentifier,
416
+ children: decl.ident
417
+ }),
418
+ /* @__PURE__ */ jsx(TypeParams, { params: decl.typeParameters }),
419
+ decl.extends?.map((t, index) => /* @__PURE__ */ jsxs(React$1.Fragment, { children: [/* @__PURE__ */ jsx("span", {
420
+ className: style_default.TextKeyword,
421
+ children: " extends "
422
+ }), /* @__PURE__ */ jsx(Lang.Type, { type: t })] }, index)),
423
+ /* @__PURE__ */ jsx(TypePreview, { path: decl.stainlessPath })
424
+ ] });
425
+ case "TSDeclClass": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
426
+ /* @__PURE__ */ jsx("span", {
427
+ className: style_default.TextKeyword,
428
+ children: "class "
429
+ }),
430
+ /* @__PURE__ */ jsx("span", {
431
+ className: style_default.TextIdentifier,
432
+ children: decl.ident
433
+ }),
434
+ /* @__PURE__ */ jsx(TypeParams, { params: decl.typeParameters }),
435
+ decl.superClass ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
436
+ className: style_default.TextKeyword,
437
+ children: " extends "
438
+ }), /* @__PURE__ */ jsx(Lang.Type, { type: decl.superClass })] }) : null,
439
+ decl.implements?.map((t, index) => /* @__PURE__ */ jsxs(React$1.Fragment, { children: [/* @__PURE__ */ jsx("span", {
440
+ className: style_default.TextKeyword,
441
+ children: " implements "
442
+ }), /* @__PURE__ */ jsx(Lang.Type, { type: t })] }, index))
443
+ ] });
444
+ }
445
+ }
446
+ //#endregion
447
+ export { Declaration, MethodSignature, Property, Type, TypeName, typescript_exports as t };
@@ -0,0 +1,11 @@
1
+ import { d as Method, f as Model, h as Resource, i as DeclarationNode } from "../index-DFr9Mesr.js";
2
+ import { EnvironmentType } from "./utils.js";
3
+ import { t as printer_d_exports } from "./printer.js";
4
+ import { Node } from "@markdoc/markdoc";
5
+
6
+ //#region src/markdown/index.d.ts
7
+ declare function declaration(env: EnvironmentType, decl: DeclarationNode): Node;
8
+ declare function render(env: EnvironmentType, node: Resource | Method | Model): Node[];
9
+ declare function renderMarkdown(env: EnvironmentType, node: Resource | Method | Model): string;
10
+ //#endregion
11
+ export { declaration, printer_d_exports as printer, render, renderMarkdown };
@@ -0,0 +1,86 @@
1
+ import { code, fence, heading, item, list, paragraph, parse, strong, text } from "./md.js";
2
+ import { getCustomSnippetTitle, getDecl, getSnippets, stripMarkup } from "./utils.js";
3
+ import { declaration as declaration$1, methodSignature, t as printer_exports } from "./printer.js";
4
+ import Markdoc from "@markdoc/markdoc";
5
+ //#region src/markdown/index.ts
6
+ function declaration(env, decl) {
7
+ return paragraph(code(stripMarkup(declaration$1(env.language, decl))));
8
+ }
9
+ function renderChildren(env, children, nesting = /* @__PURE__ */ new Set()) {
10
+ return list(...children.map((child) => renderDecl(env, child, nesting)));
11
+ }
12
+ function renderDecl(env, path, nesting = /* @__PURE__ */ new Set()) {
13
+ const decl = getDecl(env, path);
14
+ const item$1 = item(declaration(env, decl));
15
+ const effectivePath = ("modelPath" in decl && decl["modelPath"] ? `${decl.modelPath} > (schema)` : null) ?? decl.stainlessPath;
16
+ const hasChildren = "children" in decl && decl.children && decl.children.length > 0;
17
+ const showModelProps = !("modelPath" in decl && decl["modelPath"]) || env.options.includeModelProperties;
18
+ if ("docstring" in decl && decl.docstring) item$1.children.push(...parse(decl.docstring));
19
+ if (hasChildren && showModelProps && !nesting.has(effectivePath)) {
20
+ nesting.add(effectivePath);
21
+ item$1.push(renderChildren(env, decl.children ?? [], nesting));
22
+ }
23
+ return item$1;
24
+ }
25
+ function renderMethod(env, method) {
26
+ const decl = getDecl(env, method.stainlessPath);
27
+ if (!decl) return [paragraph(text("The method "), code(method.name), text(" is not available in this language."))];
28
+ const signature = methodSignature(env.language, decl);
29
+ const [httpMethod, endpoint] = method.endpoint.split(" ");
30
+ const output = [
31
+ heading(2, method.summary ?? method.title),
32
+ ...env.language === "http" ? [] : [paragraph(code(stripMarkup(signature)))],
33
+ paragraph(strong(text(httpMethod)), text(" "), code(endpoint))
34
+ ];
35
+ if (method.description) output.push(...parse(method.description));
36
+ if (env.language === "http") {
37
+ const p = "paramsChildren" in decl && typeof decl.paramsChildren === "object" ? decl.paramsChildren : {};
38
+ for (const [location, value] of Object.entries(p)) {
39
+ if (value.length < 1) continue;
40
+ output.push(heading(3, [
41
+ text(location.at(0)?.toUpperCase() ?? ""),
42
+ text(location.slice(1)),
43
+ text(" Parameters")
44
+ ]), renderChildren(env, value));
45
+ }
46
+ const bp = "bodyParamsChildren" in decl ? decl.bodyParamsChildren?.["application/json"] : [];
47
+ if (bp && bp.length > 0) output.push(heading(3, "Body Parameters"), renderChildren(env, bp));
48
+ }
49
+ if ("paramsChildren" in decl && Array.isArray(decl.paramsChildren) && decl.paramsChildren.length > 0) output.push(heading(3, "Parameters"), renderChildren(env, decl.paramsChildren));
50
+ if ("responseChildren" in decl && decl.responseChildren && decl.responseChildren.length > 0) output.push(heading(3, "Returns"), renderChildren(env, decl.responseChildren));
51
+ const snippetEntries = getSnippets(env, method.stainlessPath);
52
+ for (const [key, { snippet, response }] of Object.entries(snippetEntries)) {
53
+ if (!snippet) continue;
54
+ let title = getCustomSnippetTitle(key);
55
+ if (title.toLowerCase() === "default") title = "Example";
56
+ output.push(heading(3, title), fence(env.language, snippet));
57
+ if (response) output.push(heading(4, "Response"), fence("json", response));
58
+ }
59
+ return output;
60
+ }
61
+ function renderModel(env, model) {
62
+ return [heading(3, model.title), list(renderDecl(env, `${model.stainlessPath} > (schema)`))];
63
+ }
64
+ function renderResource(env, resource) {
65
+ const methods = Object.values(resource.methods).filter((method) => getDecl(env, method.stainlessPath)).flatMap((method) => renderMethod(env, method));
66
+ const models = Object.values(resource.models).filter((model) => getDecl(env, `${model.stainlessPath} > (schema)`)).flatMap((model) => renderModel(env, model));
67
+ const doc = [heading(1, resource.title), ...methods];
68
+ if (models.length > 0) doc.push(heading(2, "Domain Types"), ...models);
69
+ if (!env.options.renderNestedResources) return doc;
70
+ const children = Object.values(resource.subresources ?? {}).flatMap((resource) => renderResource(env, resource));
71
+ return [...doc, ...children];
72
+ }
73
+ function render(env, node) {
74
+ switch (node.kind) {
75
+ case "resource": return renderResource(env, node);
76
+ case "http_method": return renderMethod(env, node);
77
+ case "model": return renderModel(env, node);
78
+ }
79
+ }
80
+ function renderMarkdown(env, node) {
81
+ const content = render(env, node);
82
+ const doc = new Markdoc.Ast.Node("document", {}, content);
83
+ return Markdoc.format(doc);
84
+ }
85
+ //#endregion
86
+ export { declaration, printer_exports as printer, render, renderMarkdown };
@@ -0,0 +1,15 @@
1
+ import { Node } from "@markdoc/markdoc";
2
+
3
+ //#region src/markdown/md.d.ts
4
+ declare function heading(level: number, children: string | Node[]): Node;
5
+ declare function text(content: string): Node;
6
+ declare function code(content: string): Node;
7
+ declare function paragraph(...children: Node[]): Node;
8
+ declare function list(...children: Node[]): Node;
9
+ declare function item(...children: Node[]): Node;
10
+ declare function strong(...children: Node[]): Node;
11
+ declare function inline(...children: Node[]): Node;
12
+ declare function fence(language: string, content: string): Node;
13
+ declare function parse(content: string): Node[];
14
+ //#endregion
15
+ export { code, fence, heading, inline, item, list, paragraph, parse, strong, text };
@@ -0,0 +1,39 @@
1
+ import Markdoc from "@markdoc/markdoc";
2
+ //#region src/markdown/md.ts
3
+ function heading(level, children) {
4
+ const content = inline(...typeof children === "string" ? [text(children)] : children);
5
+ return new Markdoc.Ast.Node("heading", { level }, [content]);
6
+ }
7
+ function text(content) {
8
+ return new Markdoc.Ast.Node("text", { content });
9
+ }
10
+ function code(content) {
11
+ return new Markdoc.Ast.Node("code", { content });
12
+ }
13
+ function paragraph(...children) {
14
+ const inline = new Markdoc.Ast.Node("inline", {}, children);
15
+ return new Markdoc.Ast.Node("paragraph", {}, [inline]);
16
+ }
17
+ function list(...children) {
18
+ return new Markdoc.Ast.Node("list", { ordered: false }, children);
19
+ }
20
+ function item(...children) {
21
+ return new Markdoc.Ast.Node("item", {}, children);
22
+ }
23
+ function strong(...children) {
24
+ return new Markdoc.Ast.Node("strong", {}, children);
25
+ }
26
+ function inline(...children) {
27
+ return new Markdoc.Ast.Node("inline", {}, children);
28
+ }
29
+ function fence(language, content) {
30
+ return new Markdoc.Ast.Node("fence", {
31
+ language,
32
+ content
33
+ });
34
+ }
35
+ function parse(content) {
36
+ return Markdoc.parse(content).children;
37
+ }
38
+ //#endregion
39
+ export { code, fence, heading, inline, item, list, paragraph, parse, strong, text };
@@ -0,0 +1,13 @@
1
+ import { S as Type, i as DeclarationNode } from "../index-DFr9Mesr.js";
2
+ import { t as DocsLanguage } from "../routing-yTSG7nWM.js";
3
+
4
+ //#region src/markdown/printer.d.ts
5
+ declare namespace printer_d_exports {
6
+ export { declaration, methodSignature, type, typeName };
7
+ }
8
+ declare function typeName(language: DocsLanguage, type: Type): string;
9
+ declare function type(language: DocsLanguage, type: Type): string;
10
+ declare function declaration(language: DocsLanguage, decl: DeclarationNode): string;
11
+ declare function methodSignature(language: DocsLanguage, decl: DeclarationNode): string;
12
+ //#endregion
13
+ export { declaration, methodSignature, printer_d_exports as t, type, typeName };
@@ -0,0 +1,73 @@
1
+ import { t as __exportAll } from "../chunk-pbuEa-1d.js";
2
+ import { DocsProvider } from "../contexts/docs.js";
3
+ import { useLanguageComponents } from "../contexts/index.js";
4
+ import style_default from "../style.js";
5
+ import { ComponentProvider } from "../contexts/component.js";
6
+ import "react";
7
+ import { jsx } from "react/jsx-runtime";
8
+ import { renderToStaticMarkup } from "react-dom/server";
9
+ //#region src/markdown/printer.tsx
10
+ var printer_exports = /* @__PURE__ */ __exportAll({
11
+ declaration: () => declaration,
12
+ methodSignature: () => methodSignature,
13
+ type: () => type,
14
+ typeName: () => typeName
15
+ });
16
+ function SDKReference({ stainlessPath, children }) {
17
+ if (!stainlessPath) return children;
18
+ return /* @__PURE__ */ jsx("span", {
19
+ className: style_default.TypeReference,
20
+ children
21
+ });
22
+ }
23
+ function Providers({ language, children }) {
24
+ return /* @__PURE__ */ jsx(DocsProvider, {
25
+ spec: null,
26
+ language,
27
+ children: /* @__PURE__ */ jsx(ComponentProvider, {
28
+ components: { SDKReference },
29
+ children
30
+ })
31
+ });
32
+ }
33
+ function RenderType({ type, full }) {
34
+ const { Type, TypeName } = useLanguageComponents();
35
+ return full ? /* @__PURE__ */ jsx(Type, { type }) : /* @__PURE__ */ jsx(TypeName, { type });
36
+ }
37
+ function typeName(language, type) {
38
+ return renderToStaticMarkup(/* @__PURE__ */ jsx(Providers, {
39
+ language,
40
+ children: /* @__PURE__ */ jsx(RenderType, { type })
41
+ }));
42
+ }
43
+ function type(language, type) {
44
+ return renderToStaticMarkup(/* @__PURE__ */ jsx(Providers, {
45
+ language,
46
+ children: /* @__PURE__ */ jsx(RenderType, {
47
+ type,
48
+ full: true
49
+ })
50
+ }));
51
+ }
52
+ function RenderDeclaration({ decl }) {
53
+ const { Declaration } = useLanguageComponents();
54
+ return /* @__PURE__ */ jsx(Declaration, { decl });
55
+ }
56
+ function declaration(language, decl) {
57
+ return renderToStaticMarkup(/* @__PURE__ */ jsx(Providers, {
58
+ language,
59
+ children: /* @__PURE__ */ jsx(RenderDeclaration, { decl })
60
+ }));
61
+ }
62
+ function RenderMethod({ method }) {
63
+ const { MethodSignature } = useLanguageComponents();
64
+ return /* @__PURE__ */ jsx(MethodSignature, { decl: method });
65
+ }
66
+ function methodSignature(language, decl) {
67
+ return renderToStaticMarkup(/* @__PURE__ */ jsx(Providers, {
68
+ language,
69
+ children: /* @__PURE__ */ jsx(RenderMethod, { method: decl })
70
+ }));
71
+ }
72
+ //#endregion
73
+ export { declaration, methodSignature, printer_exports as t, type, typeName };