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