@stainless-api/docs-ui 0.1.0-beta.6 → 0.1.0-beta.61

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 (206) hide show
  1. package/dist/breadcrumbs-BVskoBYz.d.ts +25 -0
  2. package/dist/breadcrumbs-C9LLJyuJ.d.ts +25 -0
  3. package/dist/breadcrumbs-CqA6kow2.js +63 -0
  4. package/dist/chunk-BN_g-Awi.js +18 -0
  5. package/dist/cli-0bJ66S1r.js +157 -0
  6. package/dist/component-CjJJYIxG.js +23 -0
  7. package/dist/component-generics-BC_P155r.d.ts +30 -0
  8. package/dist/component-generics-BkwbbxJF.d.ts +30 -0
  9. package/dist/component-generics-POFirVVb.js +45 -0
  10. package/dist/components/MaskedInput.d.ts +14 -0
  11. package/dist/components/MaskedInput.js +76 -0
  12. package/dist/components/breadcrumbs.d.ts +2 -0
  13. package/dist/components/breadcrumbs.js +9 -0
  14. package/dist/components/icons.d.ts +60 -0
  15. package/dist/components/icons.js +3 -0
  16. package/dist/components/index.d.ts +10 -0
  17. package/dist/components/index.js +18 -0
  18. package/dist/components/method.d.ts +2 -0
  19. package/dist/components/method.js +10 -0
  20. package/dist/components/overview.d.ts +2 -0
  21. package/dist/components/overview.js +11 -0
  22. package/dist/components/primitives.d.ts +2 -0
  23. package/dist/components/primitives.js +8 -0
  24. package/dist/components/properties.d.ts +2 -0
  25. package/dist/components/properties.js +9 -0
  26. package/dist/components/sdk.d.ts +2 -0
  27. package/dist/components/sdk.js +10 -0
  28. package/dist/components/sidebar.d.ts +2 -0
  29. package/dist/components/sidebar.js +9 -0
  30. package/dist/components/snippets.d.ts +3 -0
  31. package/dist/components/snippets.js +9 -0
  32. package/dist/components-FEHnQBJC.js +70 -0
  33. package/dist/contexts/component-generics.d.ts +2 -0
  34. package/dist/contexts/component-generics.js +3 -0
  35. package/dist/contexts/component-types.d.ts +16 -0
  36. package/dist/contexts/component-types.js +0 -0
  37. package/dist/contexts/component.d.ts +29 -0
  38. package/dist/contexts/component.js +28 -0
  39. package/dist/contexts/docs.d.ts +2 -0
  40. package/dist/contexts/docs.js +3 -0
  41. package/dist/contexts/index.d.ts +22 -0
  42. package/dist/contexts/index.js +7 -0
  43. package/dist/contexts/markdown.d.ts +2 -0
  44. package/dist/contexts/markdown.js +4 -0
  45. package/dist/contexts/navigation.d.ts +2 -0
  46. package/dist/contexts/navigation.js +3 -0
  47. package/dist/contexts/use-components.d.ts +14 -0
  48. package/dist/contexts/use-components.js +4 -0
  49. package/dist/contexts-CeV_L_Iy.js +39 -0
  50. package/dist/csharp-Dl2RIiYP.js +283 -0
  51. package/dist/docs--qWFuJCM.d.ts +46 -0
  52. package/dist/docs-DSFRsmbQ.d.ts +46 -0
  53. package/dist/docs-Di94viZV.js +54 -0
  54. package/dist/go-DuKdRGqU.js +303 -0
  55. package/dist/http-C7bu4oCl.js +331 -0
  56. package/dist/icons-BYKn5X8E.js +885 -0
  57. package/dist/index-C0qvL4yP.d.ts +15 -0
  58. package/dist/index-DE1vA8T2.d.ts +302 -0
  59. package/dist/index-DsFyACw9.d.ts +15 -0
  60. package/dist/index-FDM-j9s-.d.ts +302 -0
  61. package/dist/index-zNpvNvtN.d.ts +1691 -0
  62. package/dist/index.d.ts +19 -0
  63. package/dist/index.js +30 -7542
  64. package/dist/java-DSyzO-6F.js +403 -0
  65. package/dist/languages/cli.d.ts +11 -0
  66. package/dist/languages/cli.js +20 -0
  67. package/dist/languages/csharp.d.ts +11 -0
  68. package/dist/languages/csharp.js +9 -0
  69. package/dist/languages/go.d.ts +11 -0
  70. package/dist/languages/go.js +9 -0
  71. package/dist/languages/http.d.ts +11 -0
  72. package/dist/languages/http.js +19 -0
  73. package/dist/languages/index.d.ts +11 -0
  74. package/dist/languages/index.js +27 -0
  75. package/dist/languages/java.d.ts +11 -0
  76. package/dist/languages/java.js +9 -0
  77. package/dist/languages/python.d.ts +11 -0
  78. package/dist/languages/python.js +9 -0
  79. package/dist/languages/ruby.d.ts +11 -0
  80. package/dist/languages/ruby.js +9 -0
  81. package/dist/languages/typescript.d.ts +11 -0
  82. package/dist/languages/typescript.js +9 -0
  83. package/dist/languages-BO5YJ6cy.js +28 -0
  84. package/dist/markdown/index.d.ts +12 -0
  85. package/dist/markdown/index.js +105 -0
  86. package/dist/markdown/md.d.ts +15 -0
  87. package/dist/markdown/md.js +41 -0
  88. package/dist/markdown/printer.d.ts +13 -0
  89. package/dist/markdown/printer.js +98 -0
  90. package/dist/markdown/utils.d.ts +21 -0
  91. package/dist/markdown/utils.js +31 -0
  92. package/dist/markdown-B517MrZh.d.ts +22 -0
  93. package/dist/markdown-C7Tb41LZ.d.ts +22 -0
  94. package/dist/markdown-D2JWyRws.js +49 -0
  95. package/dist/method-BaQEZVlw.d.ts +59 -0
  96. package/dist/method-Dln4ZTIB.d.ts +59 -0
  97. package/dist/method-jTnA0G8m.js +90 -0
  98. package/dist/navigation-XhIgqXwM.d.ts +29 -0
  99. package/dist/navigation-aoYZ_tl4.js +24 -0
  100. package/dist/navigation-rKdts-BR.d.ts +29 -0
  101. package/dist/overview-B3kgyac2.d.ts +39 -0
  102. package/dist/overview-BnagZfH1.js +139 -0
  103. package/dist/overview-Dp-gGl3v.d.ts +39 -0
  104. package/dist/primitives-B6zu2rrx.d.ts +105 -0
  105. package/dist/primitives-DQLc9kN7.js +250 -0
  106. package/dist/primitives-VtUGoYwX.d.ts +105 -0
  107. package/dist/properties-Bun4nfUE.d.ts +54 -0
  108. package/dist/properties-DGL2J11L.js +131 -0
  109. package/dist/properties-ZOIqpkET.d.ts +54 -0
  110. package/dist/python-D8ABqtn1.js +269 -0
  111. package/dist/routing-Ce0_tBW6.js +197 -0
  112. package/dist/routing-CtbZJru_.d.ts +54 -0
  113. package/dist/routing.d.ts +2 -0
  114. package/dist/routing.js +3 -180
  115. package/dist/ruby-261jvCjl.js +387 -0
  116. package/dist/sdk-BebFnWYL.d.ts +118 -0
  117. package/dist/sdk-CIxaNoAs.d.ts +118 -0
  118. package/dist/sdk-GGpyGTao.js +338 -0
  119. package/dist/sidebar-BWno0E4w.js +85 -0
  120. package/dist/sidebar-CLsIJZZf.d.ts +36 -0
  121. package/dist/sidebar-D4m_pVpS.d.ts +36 -0
  122. package/dist/snippets-CwVjwsAo.d.ts +53 -0
  123. package/dist/snippets-Ym3mnHO3.d.ts +53 -0
  124. package/dist/snippets-kI8eNs1F.js +164 -0
  125. package/dist/spec.d.ts +65 -0
  126. package/dist/spec.js +167 -0
  127. package/dist/style-LwfvXElj.js +170 -0
  128. package/dist/style.d.ts +169 -0
  129. package/dist/style.js +3 -0
  130. package/dist/styles/main.css +722 -755
  131. package/dist/styles/main.js +0 -0
  132. package/dist/styles/primitives.css +322 -459
  133. package/dist/styles/primitives.js +0 -0
  134. package/dist/styles/resets.css +32 -41
  135. package/dist/styles/resets.js +0 -0
  136. package/dist/styles/search.css +192 -270
  137. package/dist/styles/search.js +0 -0
  138. package/dist/styles/sidebar.css +56 -61
  139. package/dist/styles/sidebar.js +0 -0
  140. package/dist/styles/variables.css +26 -89
  141. package/dist/styles/variables.js +0 -0
  142. package/dist/styles.css +3145 -0
  143. package/dist/styles.mjs +1 -0
  144. package/dist/typescript-D924WidI.js +449 -0
  145. package/dist/use-components-BUz3GbO4.js +7 -0
  146. package/dist/utils-D01mAUfQ.js +32 -0
  147. package/dist/utils.d.ts +14 -0
  148. package/dist/utils.js +3 -0
  149. package/package.json +73 -21
  150. package/dist/mcp.js +0 -16003
  151. package/dist/styles/snippets.css +0 -132
  152. package/src/components/breadcrumbs.tsx +0 -94
  153. package/src/components/chat.tsx +0 -154
  154. package/src/components/dropdown.tsx +0 -91
  155. package/src/components/icons.tsx +0 -584
  156. package/src/components/index.ts +0 -9
  157. package/src/components/method.tsx +0 -144
  158. package/src/components/overview.tsx +0 -159
  159. package/src/components/primitives.tsx +0 -284
  160. package/src/components/properties.tsx +0 -130
  161. package/src/components/scripts/dropdown.ts +0 -78
  162. package/src/components/sdk.tsx +0 -402
  163. package/src/components/sidebar.tsx +0 -99
  164. package/src/components/snippets.tsx +0 -179
  165. package/src/contexts/component-generics.tsx +0 -48
  166. package/src/contexts/component-types.tsx +0 -5
  167. package/src/contexts/component.tsx +0 -32
  168. package/src/contexts/docs.tsx +0 -75
  169. package/src/contexts/index.tsx +0 -17
  170. package/src/contexts/markdown.tsx +0 -43
  171. package/src/contexts/navigation.tsx +0 -44
  172. package/src/contexts/search.tsx +0 -28
  173. package/src/contexts/use-components.tsx +0 -4
  174. package/src/index.ts +0 -6
  175. package/src/languages/go.tsx +0 -281
  176. package/src/languages/http.tsx +0 -321
  177. package/src/languages/index.ts +0 -26
  178. package/src/languages/java.tsx +0 -358
  179. package/src/languages/python.tsx +0 -255
  180. package/src/languages/ruby.tsx +0 -320
  181. package/src/languages/typescript.tsx +0 -393
  182. package/src/markdown/index.ts +0 -107
  183. package/src/markdown/md.ts +0 -45
  184. package/src/markdown/utils.ts +0 -49
  185. package/src/routing.ts +0 -238
  186. package/src/search/form.tsx +0 -127
  187. package/src/search/index.tsx +0 -1
  188. package/src/search/indexer.ts +0 -246
  189. package/src/search/mcp.ts +0 -61
  190. package/src/search/printer.tsx +0 -86
  191. package/src/search/providers/algolia.ts +0 -88
  192. package/src/search/providers/fuse.ts +0 -19
  193. package/src/search/providers/pagefind.ts +0 -17
  194. package/src/search/providers/walker.ts +0 -30
  195. package/src/search/results.tsx +0 -181
  196. package/src/search/state.ts +0 -64
  197. package/src/search/types.ts +0 -116
  198. package/src/style.ts +0 -197
  199. package/src/styles/main.css +0 -993
  200. package/src/styles/primitives.css +0 -573
  201. package/src/styles/resets.css +0 -47
  202. package/src/styles/search.css +0 -342
  203. package/src/styles/sidebar.css +0 -87
  204. package/src/styles/snippets.css +0 -132
  205. package/src/styles/variables.css +0 -90
  206. package/src/utils.ts +0 -41
@@ -0,0 +1,28 @@
1
+ import { t as __exportAll } from "./chunk-BN_g-Awi.js";
2
+ import { o as typescript_exports } from "./typescript-D924WidI.js";
3
+ import { o as java_exports } from "./java-DSyzO-6F.js";
4
+ import { o as go_exports } from "./go-DuKdRGqU.js";
5
+ import { o as python_exports } from "./python-D8ABqtn1.js";
6
+ import { o as ruby_exports } from "./ruby-261jvCjl.js";
7
+ import { s as http_exports } from "./http-C7bu4oCl.js";
8
+ import { o as csharp_exports } from "./csharp-Dl2RIiYP.js";
9
+ import { o as cli_exports } from "./cli-0bJ66S1r.js";
10
+
11
+ //#region src/languages/index.ts
12
+ var languages_exports = /* @__PURE__ */ __exportAll({
13
+ cli: () => cli_exports,
14
+ csharp: () => csharp_exports,
15
+ go: () => go_exports,
16
+ http: () => http_exports,
17
+ java: () => java_exports,
18
+ kotlin: () => kotlin,
19
+ node: () => node,
20
+ python: () => python_exports,
21
+ ruby: () => ruby_exports,
22
+ typescript: () => typescript_exports
23
+ });
24
+ const node = typescript_exports;
25
+ const kotlin = java_exports;
26
+
27
+ //#endregion
28
+ export { languages_exports as n, node as r, kotlin as t };
@@ -0,0 +1,12 @@
1
+ import { f as Resource, l as Method, r as DeclarationNode, u as Model } from "../index-zNpvNvtN.js";
2
+ import "../sdk-CIxaNoAs.js";
3
+ import { EnvironmentType } from "./utils.js";
4
+ import { t as printer_d_exports } from "./printer.js";
5
+ import { Node } from "@markdoc/markdoc";
6
+
7
+ //#region src/markdown/index.d.ts
8
+ declare function declaration(env: EnvironmentType, decl: DeclarationNode): Node;
9
+ declare function render(env: EnvironmentType, node: Resource | Method | Model): Node[];
10
+ declare function renderMarkdown(env: EnvironmentType, node: Resource | Method | Model): string;
11
+ //#endregion
12
+ export { declaration, printer_d_exports as printer, render, renderMarkdown };
@@ -0,0 +1,105 @@
1
+ import "../docs-Di94viZV.js";
2
+ import "../component-generics-POFirVVb.js";
3
+ import "../navigation-aoYZ_tl4.js";
4
+ import "../markdown-D2JWyRws.js";
5
+ import "../contexts-CeV_L_Iy.js";
6
+ import "../use-components-BUz3GbO4.js";
7
+ import "../properties-DGL2J11L.js";
8
+ import "../method-jTnA0G8m.js";
9
+ import "../primitives-DQLc9kN7.js";
10
+ import "../icons-BYKn5X8E.js";
11
+ import "../sdk-GGpyGTao.js";
12
+ import "../snippets-kI8eNs1F.js";
13
+ import "../overview-BnagZfH1.js";
14
+ import "../breadcrumbs-CqA6kow2.js";
15
+ import "../sidebar-BWno0E4w.js";
16
+ import "../components-FEHnQBJC.js";
17
+ import "../typescript-D924WidI.js";
18
+ import "../java-DSyzO-6F.js";
19
+ import "../go-DuKdRGqU.js";
20
+ import "../python-D8ABqtn1.js";
21
+ import "../ruby-261jvCjl.js";
22
+ import "../http-C7bu4oCl.js";
23
+ import "../csharp-Dl2RIiYP.js";
24
+ import "../cli-0bJ66S1r.js";
25
+ import "../languages-BO5YJ6cy.js";
26
+ import "../component-CjJJYIxG.js";
27
+ import { code, fence, heading, item, list, paragraph, parse, strong, text } from "./md.js";
28
+ import { getDecl, getSnippet, stripMarkup } from "./utils.js";
29
+ import { declaration as declaration$1, methodSignature, t as printer_exports } from "./printer.js";
30
+ import Markdoc from "@markdoc/markdoc";
31
+
32
+ //#region src/markdown/index.ts
33
+ function declaration(env, decl) {
34
+ const content = declaration$1(env.language, decl);
35
+ return paragraph(code(stripMarkup(content)));
36
+ }
37
+ function renderChildren(env, children, nesting = []) {
38
+ return list(...children.map((child) => renderDecl(env, child, nesting)));
39
+ }
40
+ function renderDecl(env, path, nesting = []) {
41
+ const decl = getDecl(env, path);
42
+ const item$1 = item(declaration(env, decl));
43
+ const hasChildren = "children" in decl && decl.children && decl.children.length > 0;
44
+ const showModelProps = !("modelPath" in decl && decl["modelPath"]) || env.options.includeModelProperties;
45
+ if ("docstring" in decl && decl.docstring) item$1.children.push(...parse(decl.docstring));
46
+ if (hasChildren && showModelProps && !nesting.includes(path)) item$1.push(renderChildren(env, decl.children ?? [], [...nesting, path]));
47
+ return item$1;
48
+ }
49
+ function renderMethod(env, method) {
50
+ const decl = getDecl(env, method.stainlessPath);
51
+ if (!decl) return [paragraph(text("The method "), code(method.name), text(" is not available in this language."))];
52
+ const signature = methodSignature(env.language, decl);
53
+ const [httpMethod, endpoint] = method.endpoint.split(" ");
54
+ const output = [
55
+ heading(2, method.title),
56
+ ...env.language === "http" ? [] : [paragraph(code(stripMarkup(signature)))],
57
+ paragraph(strong(text(httpMethod)), text(" "), code(endpoint))
58
+ ];
59
+ if (method.description) output.push(...parse(method.description));
60
+ if (env.language === "http") {
61
+ const p = "paramsChildren" in decl && typeof decl.paramsChildren === "object" ? decl.paramsChildren : {};
62
+ for (const [location, value] of Object.entries(p)) {
63
+ if (value.length < 1) continue;
64
+ output.push(heading(3, [
65
+ text(location.at(0)?.toUpperCase() ?? ""),
66
+ text(location.slice(1)),
67
+ text(" Parameters")
68
+ ]), renderChildren(env, value));
69
+ }
70
+ const bp = "bodyParamsChildren" in decl ? decl.bodyParamsChildren?.["application/json"] : [];
71
+ if (bp && bp.length > 0) output.push(heading(3, "Body Parameters"), renderChildren(env, bp));
72
+ }
73
+ if ("paramsChildren" in decl && Array.isArray(decl.paramsChildren) && decl.paramsChildren.length > 0) output.push(heading(3, "Parameters"), renderChildren(env, decl.paramsChildren));
74
+ if ("responseChildren" in decl && decl.responseChildren && decl.responseChildren.length > 0) output.push(heading(3, "Returns"), renderChildren(env, decl.responseChildren));
75
+ const snippet = getSnippet(env, method.stainlessPath);
76
+ if (snippet) output.push(heading(3, "Example"), fence(env.language, snippet));
77
+ return output;
78
+ }
79
+ function renderModel(env, model) {
80
+ return [heading(3, model.title), list(renderDecl(env, `${model.stainlessPath} > (schema)`))];
81
+ }
82
+ function renderResource(env, resource) {
83
+ const methods = Object.values(resource.methods).filter((method) => getDecl(env, method.stainlessPath)).flatMap((method) => renderMethod(env, method));
84
+ const models = Object.values(resource.models).filter((model) => getDecl(env, `${model.stainlessPath} > (schema)`)).flatMap((model) => renderModel(env, model));
85
+ const doc = [heading(1, resource.title), ...methods];
86
+ if (models.length > 0) doc.push(heading(2, "Domain Types"), ...models);
87
+ if (!env.options.renderNestedResources) return doc;
88
+ const children = Object.values(resource.subresources ?? {}).flatMap((resource) => renderResource(env, resource));
89
+ return [...doc, ...children];
90
+ }
91
+ function render(env, node) {
92
+ switch (node.kind) {
93
+ case "resource": return renderResource(env, node);
94
+ case "http_method": return renderMethod(env, node);
95
+ case "model": return renderModel(env, node);
96
+ }
97
+ }
98
+ function renderMarkdown(env, node) {
99
+ const content = render(env, node);
100
+ const doc = new Markdoc.Ast.Node("document", {}, content);
101
+ return Markdoc.format(doc);
102
+ }
103
+
104
+ //#endregion
105
+ 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,41 @@
1
+ import Markdoc from "@markdoc/markdoc";
2
+
3
+ //#region src/markdown/md.ts
4
+ function heading(level, children) {
5
+ const content = inline(...typeof children === "string" ? [text(children)] : children);
6
+ return new Markdoc.Ast.Node("heading", { level }, [content]);
7
+ }
8
+ function text(content) {
9
+ return new Markdoc.Ast.Node("text", { content });
10
+ }
11
+ function code(content) {
12
+ return new Markdoc.Ast.Node("code", { content });
13
+ }
14
+ function paragraph(...children) {
15
+ const inline = new Markdoc.Ast.Node("inline", {}, children);
16
+ return new Markdoc.Ast.Node("paragraph", {}, [inline]);
17
+ }
18
+ function list(...children) {
19
+ return new Markdoc.Ast.Node("list", { ordered: false }, children);
20
+ }
21
+ function item(...children) {
22
+ return new Markdoc.Ast.Node("item", {}, children);
23
+ }
24
+ function strong(...children) {
25
+ return new Markdoc.Ast.Node("strong", {}, children);
26
+ }
27
+ function inline(...children) {
28
+ return new Markdoc.Ast.Node("inline", {}, children);
29
+ }
30
+ function fence(language, content) {
31
+ return new Markdoc.Ast.Node("fence", {
32
+ language,
33
+ content
34
+ });
35
+ }
36
+ function parse(content) {
37
+ return Markdoc.parse(content).children;
38
+ }
39
+
40
+ //#endregion
41
+ export { code, fence, heading, inline, item, list, paragraph, parse, strong, text };
@@ -0,0 +1,13 @@
1
+ import { r as DeclarationNode, v as Type } from "../index-zNpvNvtN.js";
2
+ import { t as DocsLanguage } from "../routing-CtbZJru_.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,98 @@
1
+ import { t as __exportAll } from "../chunk-BN_g-Awi.js";
2
+ import { t as DocsProvider } from "../docs-Di94viZV.js";
3
+ import "../component-generics-POFirVVb.js";
4
+ import "../navigation-aoYZ_tl4.js";
5
+ import "../markdown-D2JWyRws.js";
6
+ import { n as useLanguageComponents } from "../contexts-CeV_L_Iy.js";
7
+ import "../use-components-BUz3GbO4.js";
8
+ import { t as style_default } from "../style-LwfvXElj.js";
9
+ import "../properties-DGL2J11L.js";
10
+ import "../method-jTnA0G8m.js";
11
+ import "../primitives-DQLc9kN7.js";
12
+ import "../icons-BYKn5X8E.js";
13
+ import "../sdk-GGpyGTao.js";
14
+ import "../snippets-kI8eNs1F.js";
15
+ import "../overview-BnagZfH1.js";
16
+ import "../breadcrumbs-CqA6kow2.js";
17
+ import "../sidebar-BWno0E4w.js";
18
+ import "../components-FEHnQBJC.js";
19
+ import "../typescript-D924WidI.js";
20
+ import "../java-DSyzO-6F.js";
21
+ import "../go-DuKdRGqU.js";
22
+ import "../python-D8ABqtn1.js";
23
+ import "../ruby-261jvCjl.js";
24
+ import "../http-C7bu4oCl.js";
25
+ import "../csharp-Dl2RIiYP.js";
26
+ import "../cli-0bJ66S1r.js";
27
+ import "../languages-BO5YJ6cy.js";
28
+ import { t as ComponentProvider } from "../component-CjJJYIxG.js";
29
+ import "react";
30
+ import { jsx } from "react/jsx-runtime";
31
+ import { renderToStaticMarkup } from "react-dom/server";
32
+
33
+ //#region src/markdown/printer.tsx
34
+ var printer_exports = /* @__PURE__ */ __exportAll({
35
+ declaration: () => declaration,
36
+ methodSignature: () => methodSignature,
37
+ type: () => type,
38
+ typeName: () => typeName
39
+ });
40
+ function SDKReference({ stainlessPath, children }) {
41
+ if (!stainlessPath) return children;
42
+ return /* @__PURE__ */ jsx("span", {
43
+ className: style_default.TypeReference,
44
+ children
45
+ });
46
+ }
47
+ function Providers({ language, children }) {
48
+ return /* @__PURE__ */ jsx(DocsProvider, {
49
+ spec: null,
50
+ language,
51
+ children: /* @__PURE__ */ jsx(ComponentProvider, {
52
+ components: { SDKReference },
53
+ children
54
+ })
55
+ });
56
+ }
57
+ function RenderType({ type, full }) {
58
+ const { Type, TypeName } = useLanguageComponents();
59
+ return full ? /* @__PURE__ */ jsx(Type, { type }) : /* @__PURE__ */ jsx(TypeName, { type });
60
+ }
61
+ function typeName(language, type) {
62
+ return renderToStaticMarkup(/* @__PURE__ */ jsx(Providers, {
63
+ language,
64
+ children: /* @__PURE__ */ jsx(RenderType, { type })
65
+ }));
66
+ }
67
+ function type(language, type) {
68
+ return renderToStaticMarkup(/* @__PURE__ */ jsx(Providers, {
69
+ language,
70
+ children: /* @__PURE__ */ jsx(RenderType, {
71
+ type,
72
+ full: true
73
+ })
74
+ }));
75
+ }
76
+ function RenderDeclaration({ decl }) {
77
+ const { Declaration } = useLanguageComponents();
78
+ return /* @__PURE__ */ jsx(Declaration, { decl });
79
+ }
80
+ function declaration(language, decl) {
81
+ return renderToStaticMarkup(/* @__PURE__ */ jsx(Providers, {
82
+ language,
83
+ children: /* @__PURE__ */ jsx(RenderDeclaration, { decl })
84
+ }));
85
+ }
86
+ function RenderMethod({ method }) {
87
+ const { MethodSignature } = useLanguageComponents();
88
+ return /* @__PURE__ */ jsx(MethodSignature, { decl: method });
89
+ }
90
+ function methodSignature(language, decl) {
91
+ return renderToStaticMarkup(/* @__PURE__ */ jsx(Providers, {
92
+ language,
93
+ children: /* @__PURE__ */ jsx(RenderMethod, { method: decl })
94
+ }));
95
+ }
96
+
97
+ //#endregion
98
+ export { declaration, methodSignature, printer_exports as t, type, typeName };
@@ -0,0 +1,21 @@
1
+ import { c as LanguageDeclNodes, g as SpecLanguage, h as Spec } from "../index-zNpvNvtN.js";
2
+ import { t as DocsLanguage } from "../routing-CtbZJru_.js";
3
+ import { C as TransformRequestSnippetFn } from "../sdk-CIxaNoAs.js";
4
+
5
+ //#region src/markdown/utils.d.ts
6
+ type EnvironmentType = {
7
+ spec: Spec;
8
+ language: DocsLanguage;
9
+ transforms?: {
10
+ transformRequestSnippet?: TransformRequestSnippetFn;
11
+ };
12
+ options: {
13
+ renderNestedResources?: boolean;
14
+ includeModelProperties?: boolean;
15
+ };
16
+ };
17
+ declare function getDecl(env: EnvironmentType, path: string): LanguageDeclNodes[SpecLanguage] | undefined;
18
+ declare function getSnippet(env: EnvironmentType, path: string): string | undefined;
19
+ declare function stripMarkup(content: string): string;
20
+ //#endregion
21
+ export { EnvironmentType, getDecl, getSnippet, stripMarkup };
@@ -0,0 +1,31 @@
1
+ import { Parser } from "htmlparser2";
2
+
3
+ //#region src/markdown/utils.ts
4
+ function getDecl(env, path) {
5
+ const decl = env.spec?.decls?.[env.language]?.[path];
6
+ if (decl?.kind?.endsWith("Reference")) {
7
+ const refId = "type" in decl && typeof decl["type"] === "object" && "$ref" in decl["type"] ? decl["type"]["$ref"] : null;
8
+ if (refId === path) return decl;
9
+ if (refId) return getDecl(env, refId);
10
+ }
11
+ return decl;
12
+ }
13
+ function getSnippet(env, path) {
14
+ const lang = env.language === "http" ? "http.curl" : `${env.language}.default`;
15
+ let snippet = env.spec?.snippets?.[lang]?.[path];
16
+ if (typeof snippet === "string" && env.transforms?.transformRequestSnippet) snippet = env.transforms.transformRequestSnippet({
17
+ snippet,
18
+ language: env.language
19
+ });
20
+ return snippet;
21
+ }
22
+ function stripMarkup(content) {
23
+ let output = "";
24
+ new Parser({ ontext(content) {
25
+ output += content;
26
+ } }).parseComplete(content);
27
+ return output;
28
+ }
29
+
30
+ //#endregion
31
+ export { getDecl, getSnippet, stripMarkup };
@@ -0,0 +1,22 @@
1
+ import * as React$1 from "react";
2
+ import * as react_jsx_runtime39 from "react/jsx-runtime";
3
+
4
+ //#region src/contexts/markdown.d.ts
5
+ type MarkdownContext = {
6
+ highlight: (content: string, language: string) => string | Promise<string>;
7
+ render: (content: string) => string | Promise<string>;
8
+ };
9
+ declare const MarkdownContext: React$1.Context<MarkdownContext>;
10
+ declare const useMarkdownContext: () => MarkdownContext;
11
+ declare function useRenderMarkdown(content?: string): string | undefined;
12
+ declare function useHighlight(content: string, language?: string): string;
13
+ type MarkdownProviderProps = MarkdownContext & {
14
+ children: React$1.ReactNode;
15
+ };
16
+ declare function MarkdownProvider({
17
+ render,
18
+ highlight,
19
+ children
20
+ }: MarkdownProviderProps): react_jsx_runtime39.JSX.Element;
21
+ //#endregion
22
+ export { useMarkdownContext as a, useHighlight as i, MarkdownProvider as n, useRenderMarkdown as o, MarkdownProviderProps as r, MarkdownContext as t };
@@ -0,0 +1,22 @@
1
+ import * as React$1 from "react";
2
+ import * as react_jsx_runtime41 from "react/jsx-runtime";
3
+
4
+ //#region src/contexts/markdown.d.ts
5
+ type MarkdownContext = {
6
+ highlight: (content: string, language: string) => string | Promise<string>;
7
+ render: (content: string) => string | Promise<string>;
8
+ };
9
+ declare const MarkdownContext: React$1.Context<MarkdownContext>;
10
+ declare const useMarkdownContext: () => MarkdownContext;
11
+ declare function useRenderMarkdown(content?: string): string | undefined;
12
+ declare function useHighlight(content: string, language?: string): string;
13
+ type MarkdownProviderProps = MarkdownContext & {
14
+ children: React$1.ReactNode;
15
+ };
16
+ declare function MarkdownProvider({
17
+ render,
18
+ highlight,
19
+ children
20
+ }: MarkdownProviderProps): react_jsx_runtime41.JSX.Element;
21
+ //#endregion
22
+ export { useMarkdownContext as a, useHighlight as i, MarkdownProvider as n, useRenderMarkdown as o, MarkdownProviderProps as r, MarkdownContext as t };
@@ -0,0 +1,49 @@
1
+ import { a as useLanguage } from "./docs-Di94viZV.js";
2
+ import * as React$1 from "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+
5
+ //#region src/contexts/markdown.tsx
6
+ const HighlightLanguageMappings = {
7
+ node: "typescript",
8
+ http: "bash",
9
+ cli: "bash"
10
+ };
11
+ const MarkdownContext = React$1.createContext({
12
+ highlight: (content) => content,
13
+ render: (content) => content
14
+ });
15
+ const useMarkdownContext = () => React$1.useContext(MarkdownContext);
16
+ function useRenderMarkdown(content) {
17
+ const { render } = React$1.useContext(MarkdownContext);
18
+ return React$1.useMemo(() => {
19
+ if (!content) return void 0;
20
+ const rendered = render(content);
21
+ return typeof rendered === "string" ? rendered : React$1.use(rendered);
22
+ }, [content, render]);
23
+ }
24
+ function useHighlight(content, language) {
25
+ const { highlight } = React$1.useContext(MarkdownContext);
26
+ const defaultLanguage = useLanguage();
27
+ const lang = language ?? defaultLanguage;
28
+ return React$1.useMemo(() => {
29
+ if (lang === "none") return content;
30
+ const rendered = highlight(content, HighlightLanguageMappings[lang] ?? lang);
31
+ return typeof rendered === "string" ? rendered : React$1.use(rendered);
32
+ }, [
33
+ content,
34
+ highlight,
35
+ lang
36
+ ]);
37
+ }
38
+ function MarkdownProvider({ render, highlight, children }) {
39
+ return /* @__PURE__ */ jsx(MarkdownContext.Provider, {
40
+ value: {
41
+ render,
42
+ highlight
43
+ },
44
+ children
45
+ });
46
+ }
47
+
48
+ //#endregion
49
+ export { useRenderMarkdown as a, useMarkdownContext as i, MarkdownProvider as n, useHighlight as r, MarkdownContext as t };
@@ -0,0 +1,59 @@
1
+ import * as React$1 from "react";
2
+ import { ReactNode } from "react";
3
+ import * as react_jsx_runtime10 from "react/jsx-runtime";
4
+
5
+ //#region src/components/method.d.ts
6
+ type MethodHeaderProps = {
7
+ title: ReactNode;
8
+ level?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5';
9
+ signature?: ReactNode;
10
+ badges?: ReactNode;
11
+ children?: ReactNode;
12
+ };
13
+ declare function MethodHeader({
14
+ title,
15
+ badges,
16
+ signature,
17
+ children,
18
+ level
19
+ }: MethodHeaderProps): react_jsx_runtime10.JSX.Element;
20
+ type MethodRouteProps = {
21
+ httpMethod?: string;
22
+ endpoint?: string | ReactNode;
23
+ iconOnly?: boolean;
24
+ };
25
+ declare function MethodRoute({
26
+ httpMethod,
27
+ endpoint,
28
+ iconOnly
29
+ }: MethodRouteProps): react_jsx_runtime10.JSX.Element;
30
+ type MethodDescriptionProps = {
31
+ description?: string;
32
+ };
33
+ declare function MethodDescription({
34
+ description
35
+ }: MethodDescriptionProps): react_jsx_runtime10.JSX.Element | undefined;
36
+ type MethodInfoProps = {
37
+ children?: ReactNode;
38
+ parameters?: ReactNode;
39
+ returns?: ReactNode;
40
+ };
41
+ declare function MethodInfo({
42
+ children,
43
+ parameters,
44
+ returns
45
+ }: MethodInfoProps): react_jsx_runtime10.JSX.Element;
46
+ type MethodProps = {
47
+ id?: string;
48
+ header?: ReactNode;
49
+ children?: ReactNode;
50
+ } & React$1.HTMLProps<HTMLDivElement>;
51
+ declare function Method({
52
+ id,
53
+ header,
54
+ children,
55
+ className,
56
+ ...props
57
+ }: MethodProps): react_jsx_runtime10.JSX.Element;
58
+ //#endregion
59
+ export { MethodHeaderProps as a, MethodProps as c, MethodHeader as i, MethodRoute as l, MethodDescription as n, MethodInfo as o, MethodDescriptionProps as r, MethodInfoProps as s, Method as t, MethodRouteProps as u };
@@ -0,0 +1,59 @@
1
+ import * as React$1 from "react";
2
+ import { ReactNode } from "react";
3
+ import * as react_jsx_runtime16 from "react/jsx-runtime";
4
+
5
+ //#region src/components/method.d.ts
6
+ type MethodHeaderProps = {
7
+ title: ReactNode;
8
+ level?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5';
9
+ signature?: ReactNode;
10
+ badges?: ReactNode;
11
+ children?: ReactNode;
12
+ };
13
+ declare function MethodHeader({
14
+ title,
15
+ badges,
16
+ signature,
17
+ children,
18
+ level
19
+ }: MethodHeaderProps): react_jsx_runtime16.JSX.Element;
20
+ type MethodRouteProps = {
21
+ httpMethod?: string;
22
+ endpoint?: string | ReactNode;
23
+ iconOnly?: boolean;
24
+ };
25
+ declare function MethodRoute({
26
+ httpMethod,
27
+ endpoint,
28
+ iconOnly
29
+ }: MethodRouteProps): react_jsx_runtime16.JSX.Element;
30
+ type MethodDescriptionProps = {
31
+ description?: string;
32
+ };
33
+ declare function MethodDescription({
34
+ description
35
+ }: MethodDescriptionProps): react_jsx_runtime16.JSX.Element | undefined;
36
+ type MethodInfoProps = {
37
+ children?: ReactNode;
38
+ parameters?: ReactNode;
39
+ returns?: ReactNode;
40
+ };
41
+ declare function MethodInfo({
42
+ children,
43
+ parameters,
44
+ returns
45
+ }: MethodInfoProps): react_jsx_runtime16.JSX.Element;
46
+ type MethodProps = {
47
+ id?: string;
48
+ header?: ReactNode;
49
+ children?: ReactNode;
50
+ } & React$1.HTMLProps<HTMLDivElement>;
51
+ declare function Method({
52
+ id,
53
+ header,
54
+ children,
55
+ className,
56
+ ...props
57
+ }: MethodProps): react_jsx_runtime16.JSX.Element;
58
+ //#endregion
59
+ export { MethodHeaderProps as a, MethodProps as c, MethodHeader as i, MethodRoute as l, MethodDescription as n, MethodInfo as o, MethodDescriptionProps as r, MethodInfoProps as s, Method as t, MethodRouteProps as u };
@@ -0,0 +1,90 @@
1
+ import { t as useComponents } from "./use-components-BUz3GbO4.js";
2
+ import { t as style_default } from "./style-LwfvXElj.js";
3
+ import { i as PropertyToggle } from "./properties-DGL2J11L.js";
4
+ import "react";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import clsx from "clsx";
7
+ import { Badge, getHttpMethod } from "@stainless-api/ui-primitives";
8
+
9
+ //#region src/components/method.tsx
10
+ function MethodHeader({ title, badges, signature, children, level }) {
11
+ const Heading = level ?? "h5";
12
+ return /* @__PURE__ */ jsxs("div", {
13
+ className: style_default.MethodHeader,
14
+ children: [
15
+ /* @__PURE__ */ jsx(Heading, {
16
+ className: style_default.MethodTitle,
17
+ children: title
18
+ }),
19
+ badges && /* @__PURE__ */ jsx("div", {
20
+ className: style_default.MethodBadges,
21
+ children: badges
22
+ }),
23
+ signature,
24
+ children
25
+ ]
26
+ });
27
+ }
28
+ function MethodRoute({ httpMethod, endpoint, iconOnly }) {
29
+ const httpMethodTyped = getHttpMethod(httpMethod);
30
+ return /* @__PURE__ */ jsxs("div", {
31
+ className: style_default.MethodRoute,
32
+ children: [httpMethodTyped && /* @__PURE__ */ jsx(Badge.HTTP, {
33
+ method: httpMethodTyped,
34
+ iconOnly,
35
+ size: "sm"
36
+ }), endpoint && /* @__PURE__ */ jsx("span", {
37
+ className: style_default.MethodRouteEndpoint,
38
+ children: endpoint
39
+ })]
40
+ });
41
+ }
42
+ function MethodDescription({ description }) {
43
+ const { Markdown } = useComponents();
44
+ if (description) return /* @__PURE__ */ jsx("div", {
45
+ className: style_default.MethodDescription,
46
+ children: /* @__PURE__ */ jsx(Markdown, { content: description })
47
+ });
48
+ }
49
+ function MethodInfo({ children, parameters, returns }) {
50
+ return /* @__PURE__ */ jsxs("div", {
51
+ className: style_default.MethodInfo,
52
+ children: [
53
+ children && /* @__PURE__ */ jsx("div", {
54
+ className: style_default.MethodContent,
55
+ children
56
+ }),
57
+ parameters && /* @__PURE__ */ jsxs("div", {
58
+ className: style_default.MethodInfoSection,
59
+ children: [/* @__PURE__ */ jsxs("h5", { children: ["Parameters", /* @__PURE__ */ jsx(PropertyToggle, { target: "parameters" })] }), /* @__PURE__ */ jsx("div", {
60
+ className: style_default.MethodParameters,
61
+ "data-stldocs-property-group": "parameters",
62
+ children: parameters
63
+ })]
64
+ }),
65
+ returns && /* @__PURE__ */ jsxs("div", {
66
+ className: style_default.MethodInfoSection,
67
+ children: [/* @__PURE__ */ jsxs("h5", { children: ["Returns", /* @__PURE__ */ jsx(PropertyToggle, { target: "returns" })] }), /* @__PURE__ */ jsx("div", {
68
+ className: style_default.MethodReturns,
69
+ "data-stldocs-property-group": "returns",
70
+ children: returns
71
+ })]
72
+ })
73
+ ]
74
+ });
75
+ }
76
+ function Method({ id, header, children, className, ...props }) {
77
+ return /* @__PURE__ */ jsxs("div", {
78
+ id,
79
+ className: clsx(style_default.Method, className),
80
+ tabIndex: 0,
81
+ ...props,
82
+ children: [header, /* @__PURE__ */ jsx("div", {
83
+ className: style_default.MethodBody,
84
+ children
85
+ })]
86
+ });
87
+ }
88
+
89
+ //#endregion
90
+ export { MethodRoute as a, MethodInfo as i, MethodDescription as n, MethodHeader as r, Method as t };