@stainless-api/docs-ui 0.1.0-beta.7 → 0.1.0-beta.70

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 (215) hide show
  1. package/dist/breadcrumbs-BhYwbXkc.d.ts +25 -0
  2. package/dist/breadcrumbs-Cvm5Ifm7.d.ts +25 -0
  3. package/dist/breadcrumbs-DA4WgDhR.js +63 -0
  4. package/dist/chunk-BN_g-Awi.js +18 -0
  5. package/dist/cli-F3kMmeoJ.js +166 -0
  6. package/dist/component-P9sn5yyG.js +23 -0
  7. package/dist/component-generics-ByGsYTc8.d.ts +30 -0
  8. package/dist/component-generics-POFirVVb.js +45 -0
  9. package/dist/component-generics-zU0Pqx8m.d.ts +30 -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 +11 -0
  17. package/dist/components/index.js +19 -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-sidebar.d.ts +2 -0
  27. package/dist/components/sdk-sidebar.js +10 -0
  28. package/dist/components/sdk.d.ts +2 -0
  29. package/dist/components/sdk.js +10 -0
  30. package/dist/components/snippets.d.ts +3 -0
  31. package/dist/components/snippets.js +9 -0
  32. package/dist/components/stl-sidebar.d.ts +2 -0
  33. package/dist/components/stl-sidebar.js +5 -0
  34. package/dist/components-w1JmIrB0.js +71 -0
  35. package/dist/contexts/component-generics.d.ts +2 -0
  36. package/dist/contexts/component-generics.js +3 -0
  37. package/dist/contexts/component-types.d.ts +17 -0
  38. package/dist/contexts/component-types.js +0 -0
  39. package/dist/contexts/component.d.ts +30 -0
  40. package/dist/contexts/component.js +30 -0
  41. package/dist/contexts/docs.d.ts +2 -0
  42. package/dist/contexts/docs.js +3 -0
  43. package/dist/contexts/index.d.ts +23 -0
  44. package/dist/contexts/index.js +7 -0
  45. package/dist/contexts/markdown.d.ts +2 -0
  46. package/dist/contexts/markdown.js +4 -0
  47. package/dist/contexts/navigation.d.ts +2 -0
  48. package/dist/contexts/navigation.js +3 -0
  49. package/dist/contexts/use-components.d.ts +15 -0
  50. package/dist/contexts/use-components.js +4 -0
  51. package/dist/contexts-CVj20VV4.js +41 -0
  52. package/dist/csharp-D6_jlynY.js +283 -0
  53. package/dist/docs-BmOB2f-I.js +61 -0
  54. package/dist/docs-g4IPmtZr.d.ts +48 -0
  55. package/dist/docs-z3fl2eW-.d.ts +48 -0
  56. package/dist/go-COaHV3Hc.js +303 -0
  57. package/dist/http-fOPCX17A.js +389 -0
  58. package/dist/icons-BYKn5X8E.js +885 -0
  59. package/dist/index-B8Zys1C2.d.ts +347 -0
  60. package/dist/index-C5Zmb2CI.d.ts +16 -0
  61. package/dist/index-CwjGm9zX.d.ts +1722 -0
  62. package/dist/index-D7PkxNgB.d.ts +16 -0
  63. package/dist/index-DIaM6Ync.d.ts +347 -0
  64. package/dist/index.d.ts +20 -0
  65. package/dist/index.js +32 -7542
  66. package/dist/java-CxGSJVvv.js +403 -0
  67. package/dist/languages/cli.d.ts +12 -0
  68. package/dist/languages/cli.js +21 -0
  69. package/dist/languages/csharp.d.ts +12 -0
  70. package/dist/languages/csharp.js +9 -0
  71. package/dist/languages/go.d.ts +12 -0
  72. package/dist/languages/go.js +9 -0
  73. package/dist/languages/http.d.ts +12 -0
  74. package/dist/languages/http.js +20 -0
  75. package/dist/languages/index.d.ts +12 -0
  76. package/dist/languages/index.js +29 -0
  77. package/dist/languages/java.d.ts +12 -0
  78. package/dist/languages/java.js +9 -0
  79. package/dist/languages/python.d.ts +12 -0
  80. package/dist/languages/python.js +9 -0
  81. package/dist/languages/ruby.d.ts +12 -0
  82. package/dist/languages/ruby.js +9 -0
  83. package/dist/languages/terraform.d.ts +12 -0
  84. package/dist/languages/terraform.js +9 -0
  85. package/dist/languages/typescript.d.ts +12 -0
  86. package/dist/languages/typescript.js +9 -0
  87. package/dist/languages-B6eap2M6.js +30 -0
  88. package/dist/markdown/index.d.ts +12 -0
  89. package/dist/markdown/index.js +107 -0
  90. package/dist/markdown/md.d.ts +15 -0
  91. package/dist/markdown/md.js +41 -0
  92. package/dist/markdown/printer.d.ts +13 -0
  93. package/dist/markdown/printer.js +100 -0
  94. package/dist/markdown/utils.d.ts +21 -0
  95. package/dist/markdown/utils.js +31 -0
  96. package/dist/markdown-CTKHMLVr.js +49 -0
  97. package/dist/markdown-Cdh0TSHp.d.ts +22 -0
  98. package/dist/markdown-Cibv9fDR.d.ts +22 -0
  99. package/dist/method-630cPKDl.d.ts +59 -0
  100. package/dist/method-BPDUyBlD.js +96 -0
  101. package/dist/method-BzkPRXGL.d.ts +59 -0
  102. package/dist/navigation-BW-SBvb4.d.ts +29 -0
  103. package/dist/navigation-DWYqC_HX.d.ts +29 -0
  104. package/dist/navigation-aoYZ_tl4.js +24 -0
  105. package/dist/overview-Cui1XtuC.d.ts +39 -0
  106. package/dist/overview-DFwfIK6k.js +138 -0
  107. package/dist/overview-RXc9iPzz.d.ts +39 -0
  108. package/dist/primitives-DJEqe_r1.js +250 -0
  109. package/dist/primitives-DhGxFYx6.d.ts +105 -0
  110. package/dist/primitives-MsH-h0bU.d.ts +105 -0
  111. package/dist/properties-BnbBKd5a.js +132 -0
  112. package/dist/properties-Bynmj9_H.d.ts +54 -0
  113. package/dist/properties-C9W4QJ_F.d.ts +54 -0
  114. package/dist/python-DsTuWCKE.js +269 -0
  115. package/dist/routing-C64k4fmX.js +205 -0
  116. package/dist/routing-Cm_9XJiQ.d.ts +61 -0
  117. package/dist/routing-utiR5mY3.d.ts +61 -0
  118. package/dist/routing.d.ts +2 -0
  119. package/dist/routing.js +3 -180
  120. package/dist/ruby-BncKp6hd.js +387 -0
  121. package/dist/sdk-BvZeXpsj.d.ts +122 -0
  122. package/dist/sdk-Bw99eXxA.js +399 -0
  123. package/dist/sdk-GMOw94wL.d.ts +122 -0
  124. package/dist/sdk-sidebar-NCBSWuUW.d.ts +15 -0
  125. package/dist/sdk-sidebar-VNY2-O1Y.d.ts +15 -0
  126. package/dist/sdk-sidebar-V_MTkVw8.js +50 -0
  127. package/dist/snippets-BehbU3rt.js +164 -0
  128. package/dist/snippets-Bj7Ey56K.d.ts +53 -0
  129. package/dist/snippets-CQQSDvg2.d.ts +53 -0
  130. package/dist/spec.d.ts +65 -0
  131. package/dist/spec.js +167 -0
  132. package/dist/stl-sidebar-CXzs_shz.d.ts +58 -0
  133. package/dist/stl-sidebar-DSkUHwcU.d.ts +58 -0
  134. package/dist/stl-sidebar-WtimNrk1.js +106 -0
  135. package/dist/style-HpXpcJ9v.js +172 -0
  136. package/dist/style.d.ts +171 -0
  137. package/dist/style.js +3 -0
  138. package/dist/styles/main.css +744 -754
  139. package/dist/styles/main.js +0 -0
  140. package/dist/styles/primitives.css +327 -458
  141. package/dist/styles/primitives.js +0 -0
  142. package/dist/styles/resets.css +32 -41
  143. package/dist/styles/resets.js +0 -0
  144. package/dist/styles/search.css +192 -270
  145. package/dist/styles/search.js +0 -0
  146. package/dist/styles/sidebar.css +170 -69
  147. package/dist/styles/sidebar.js +0 -0
  148. package/dist/styles/variables.css +26 -89
  149. package/dist/styles/variables.js +0 -0
  150. package/dist/styles.css +3273 -0
  151. package/dist/styles.mjs +1 -0
  152. package/dist/terraform-B95X4rNK.js +243 -0
  153. package/dist/typescript-n46M9OtL.js +449 -0
  154. package/dist/use-components-BUz3GbO4.js +7 -0
  155. package/dist/utils-DPbkW1Tz.js +54 -0
  156. package/dist/utils.d.ts +20 -0
  157. package/dist/utils.js +3 -0
  158. package/package.json +74 -22
  159. package/dist/mcp.js +0 -16003
  160. package/dist/styles/snippets.css +0 -132
  161. package/src/components/breadcrumbs.tsx +0 -94
  162. package/src/components/chat.tsx +0 -154
  163. package/src/components/dropdown.tsx +0 -91
  164. package/src/components/icons.tsx +0 -584
  165. package/src/components/index.ts +0 -9
  166. package/src/components/method.tsx +0 -144
  167. package/src/components/overview.tsx +0 -159
  168. package/src/components/primitives.tsx +0 -284
  169. package/src/components/properties.tsx +0 -130
  170. package/src/components/scripts/dropdown.ts +0 -78
  171. package/src/components/sdk.tsx +0 -402
  172. package/src/components/sidebar.tsx +0 -99
  173. package/src/components/snippets.tsx +0 -179
  174. package/src/contexts/component-generics.tsx +0 -48
  175. package/src/contexts/component-types.tsx +0 -5
  176. package/src/contexts/component.tsx +0 -32
  177. package/src/contexts/docs.tsx +0 -75
  178. package/src/contexts/index.tsx +0 -17
  179. package/src/contexts/markdown.tsx +0 -43
  180. package/src/contexts/navigation.tsx +0 -44
  181. package/src/contexts/search.tsx +0 -28
  182. package/src/contexts/use-components.tsx +0 -4
  183. package/src/index.ts +0 -6
  184. package/src/languages/go.tsx +0 -281
  185. package/src/languages/http.tsx +0 -321
  186. package/src/languages/index.ts +0 -26
  187. package/src/languages/java.tsx +0 -358
  188. package/src/languages/python.tsx +0 -255
  189. package/src/languages/ruby.tsx +0 -320
  190. package/src/languages/typescript.tsx +0 -393
  191. package/src/markdown/index.ts +0 -107
  192. package/src/markdown/md.ts +0 -45
  193. package/src/markdown/utils.ts +0 -49
  194. package/src/routing.ts +0 -238
  195. package/src/search/form.tsx +0 -127
  196. package/src/search/index.tsx +0 -1
  197. package/src/search/indexer.ts +0 -246
  198. package/src/search/mcp.ts +0 -61
  199. package/src/search/printer.tsx +0 -86
  200. package/src/search/providers/algolia.ts +0 -88
  201. package/src/search/providers/fuse.ts +0 -19
  202. package/src/search/providers/pagefind.ts +0 -17
  203. package/src/search/providers/walker.ts +0 -30
  204. package/src/search/results.tsx +0 -181
  205. package/src/search/state.ts +0 -64
  206. package/src/search/types.ts +0 -116
  207. package/src/style.ts +0 -197
  208. package/src/styles/main.css +0 -993
  209. package/src/styles/primitives.css +0 -572
  210. package/src/styles/resets.css +0 -47
  211. package/src/styles/search.css +0 -342
  212. package/src/styles/sidebar.css +0 -87
  213. package/src/styles/snippets.css +0 -132
  214. package/src/styles/variables.css +0 -90
  215. package/src/utils.ts +0 -41
@@ -0,0 +1,399 @@
1
+ import { d as useSpec, i as useDeclaration, l as useSettings, n as useAvailableLanguages, r as useContentPanelLayout, s as useLanguage } from "./docs-BmOB2f-I.js";
2
+ import { n as useNavigation } from "./navigation-aoYZ_tl4.js";
3
+ import { n as useLanguageComponents } from "./contexts-CVj20VV4.js";
4
+ import { t as useComponents } from "./use-components-BUz3GbO4.js";
5
+ import { t as style_default } from "./style-HpXpcJ9v.js";
6
+ import { l as getLanguageSnippet, p as parseStainlessPath, s as generateRoute, t as LanguageNames } from "./routing-C64k4fmX.js";
7
+ import { a as JavaIcon, c as PythonIcon, d as TypescriptIcon, i as GoIcon, l as RubyIcon, n as CSharpIcon, o as KotlinIcon, r as CurlIcon, s as PowershellIcon, t as CLIIcon, u as TerraformIcon } from "./icons-BYKn5X8E.js";
8
+ import * as React$1 from "react";
9
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
10
+ import clsx from "clsx";
11
+ import { BookOpen, Copy, Github } from "lucide-react";
12
+ import { Button, Callout } from "@stainless-api/ui-primitives";
13
+
14
+ //#region src/components/sdk.tsx
15
+ const PropertyModelContext = React$1.createContext({});
16
+ function usePropertyModel() {
17
+ return React$1.useContext(PropertyModelContext);
18
+ }
19
+ const ReferenceNestingContext = React$1.createContext([]);
20
+ function useReferenceNesting() {
21
+ return React$1.useContext(ReferenceNestingContext);
22
+ }
23
+ const SDKSnippetLanguages = {
24
+ "node.default": { name: "TypeScript" },
25
+ "typescript.default": { name: "TypeScript" },
26
+ "python.default": { name: "Python" },
27
+ "go.default": { name: "Go" },
28
+ "java.default": { name: "Java" },
29
+ "kotlin.default": { name: "Kotlin" },
30
+ "http.curl": { name: "cURL" },
31
+ "http.powershell": { name: "Powershell" },
32
+ "terraform.default": { name: "Terraform" },
33
+ "ruby.default": { name: "Ruby" },
34
+ "csharp.default": { name: "C#" },
35
+ "php.default": { name: "PHP" },
36
+ "cli.default": { name: "CLI tool" }
37
+ };
38
+ function SDKChildren({ paths, expand, depth }) {
39
+ const Docs = useComponents();
40
+ return /* @__PURE__ */ jsx("div", {
41
+ className: style_default.Properties,
42
+ children: paths.map((path, i) => /* @__PURE__ */ jsx(Docs.SDKDeclaration, {
43
+ path,
44
+ expand,
45
+ depth
46
+ }, i))
47
+ });
48
+ }
49
+ function normalizeDeclaration(raw, http) {
50
+ if (raw.kind === "JavaDeclProperty" && raw.type.kind === "JavaTypeString" && raw.constraints?.format === "binary") return {
51
+ ...raw,
52
+ type: {
53
+ kind: "JavaTypeReference",
54
+ typeName: "InputStream"
55
+ }
56
+ };
57
+ if (http?.kind === "HttpDeclProperty" && http.type.kind === "HttpTypeString" && http.constraints?.format === "binary") switch (raw.kind) {
58
+ case "CLISchemaProperty":
59
+ case "CLIFlag":
60
+ case "HttpDeclProperty": return {
61
+ ...raw,
62
+ type: {
63
+ kind: "HttpTypeBinary",
64
+ contentType: []
65
+ }
66
+ };
67
+ case "RubyDeclProperty": return {
68
+ ...raw,
69
+ type: {
70
+ kind: "RubyTypeBinary",
71
+ contentType: []
72
+ }
73
+ };
74
+ }
75
+ return raw;
76
+ }
77
+ function SDKDeclaration({ path, expand, depth = 0 }) {
78
+ const Lang = useLanguageComponents();
79
+ const Docs = useComponents();
80
+ const decl = normalizeDeclaration(useDeclaration(path, true), useDeclaration(path.replace(/ > \(schema\)$/, "") + " > (schema)", false, "http"));
81
+ const settings = useSettings();
82
+ const model = usePropertyModel();
83
+ const nesting = useReferenceNesting();
84
+ const { selectedPath } = useNavigation();
85
+ if (decl.kind.endsWith("Reference")) {
86
+ const refId = "type" in decl && decl.type !== void 0 && typeof decl.type !== "string" && "$ref" in decl.type ? decl.type["$ref"] : void 0;
87
+ if (refId && refId !== path && !nesting.includes(refId)) return /* @__PURE__ */ jsx(ReferenceNestingContext.Provider, {
88
+ value: [...nesting, refId],
89
+ children: /* @__PURE__ */ jsx(SDKDeclaration, {
90
+ path: refId,
91
+ expand,
92
+ depth
93
+ })
94
+ });
95
+ }
96
+ const parsedPath = selectedPath ? parseStainlessPath(selectedPath) : null;
97
+ const modelPropSetting = settings?.properties?.includeModelProperties;
98
+ const inlineModelProps = modelPropSetting === "method-page" ? Boolean(parsedPath?.method) : modelPropSetting !== false;
99
+ const isUnion = "childrenParentSchema" in decl && decl.childrenParentSchema && ["enum", "union"].includes(decl.childrenParentSchema);
100
+ const id = model?.propertyPath ? `${model.propertyPath} + ${path}` : path;
101
+ const shouldExpand = selectedPath?.startsWith(path) && nesting.length < 1 || settings?.properties?.expandDepth && depth <= settings?.properties?.expandDepth && !isUnion || expand;
102
+ const hasChildren = "children" in decl && (decl.children?.length ?? 0) > 0 && !decl.children?.includes(path) && !(isUnion && decl.childrenParentSchema === "enum" && decl.children?.length === 1) && (inlineModelProps || !("modelPath" in decl));
103
+ const content = /* @__PURE__ */ jsx(Lang.Property, {
104
+ decl,
105
+ children: ({ ...props }) => /* @__PURE__ */ jsx(Docs.Property, {
106
+ id,
107
+ expand: shouldExpand,
108
+ constraints: "constraints" in decl && /* @__PURE__ */ jsx(Docs.SDKConstraints, { constraints: decl["constraints"] }),
109
+ declaration: /* @__PURE__ */ jsx(Lang.Declaration, { decl }),
110
+ title: "title" in decl ? decl.title : void 0,
111
+ description: "docstring" in decl ? decl["docstring"] : void 0,
112
+ deprecated: decl.deprecated,
113
+ ...props,
114
+ children: hasChildren && /* @__PURE__ */ jsxs(Fragment$1, { children: [isUnion && /* @__PURE__ */ jsx("div", {
115
+ className: style_default.PropertyAnnotation,
116
+ children: "Accepts one of the following:"
117
+ }), /* @__PURE__ */ jsx(Docs.SDKChildren, {
118
+ paths: decl.children ?? [],
119
+ depth: depth + 1
120
+ })] })
121
+ })
122
+ });
123
+ if ("modelPath" in decl) {
124
+ const value = {
125
+ modelPath: decl.modelPath,
126
+ propertyPath: decl.stainlessPath
127
+ };
128
+ return /* @__PURE__ */ jsx(PropertyModelContext.Provider, {
129
+ value,
130
+ children: content
131
+ });
132
+ }
133
+ return content;
134
+ }
135
+ function SDKConstraints({ constraints }) {
136
+ if (constraints) return /* @__PURE__ */ jsx("div", {
137
+ className: style_default.PropertyConstraints,
138
+ children: Object.entries(constraints).map(([name, value]) => name === "format" && value === "binary" ? null : /* @__PURE__ */ jsxs("div", {
139
+ className: style_default.PropertyConstraint,
140
+ children: [/* @__PURE__ */ jsx("span", {
141
+ className: style_default.PropertyConstraintName,
142
+ children: name
143
+ }), /* @__PURE__ */ jsx("span", {
144
+ className: style_default.PropertyConstraintValue,
145
+ children: value
146
+ })]
147
+ }, name))
148
+ });
149
+ }
150
+ const snippetIcons = {
151
+ "node.default": TypescriptIcon,
152
+ "typescript.default": TypescriptIcon,
153
+ "go.default": GoIcon,
154
+ "python.default": PythonIcon,
155
+ "terraform.default": TerraformIcon,
156
+ "http.curl": CurlIcon,
157
+ "http.powershell": PowershellIcon,
158
+ "ruby.default": RubyIcon,
159
+ "java.default": JavaIcon,
160
+ "kotlin.default": KotlinIcon,
161
+ "csharp.default": CSharpIcon,
162
+ "cli.default": CLIIcon,
163
+ "php.default": CSharpIcon
164
+ };
165
+ function SDKIcon({ language }) {
166
+ const LangIcon = snippetIcons[language];
167
+ if (!LangIcon) return null;
168
+ return /* @__PURE__ */ jsx(LangIcon, { className: clsx(style_default.Icon, language.split(".").shift()) });
169
+ }
170
+ function SDKRequestTitle({ snippetLanguage }) {
171
+ const languageName = SDKSnippetLanguages[snippetLanguage]?.name;
172
+ return /* @__PURE__ */ jsxs("span", {
173
+ className: style_default.SnippetRequestTitleLanguage,
174
+ children: [
175
+ /* @__PURE__ */ jsx(SDKIcon, { language: snippetLanguage }),
176
+ " ",
177
+ languageName
178
+ ]
179
+ });
180
+ }
181
+ function SDKExample({ method, transformRequestSnippet }) {
182
+ const Docs = useComponents();
183
+ const snippetLanguage = getLanguageSnippet(useLanguage());
184
+ return /* @__PURE__ */ jsx(Docs.Snippet, {
185
+ requestTitle: /* @__PURE__ */ jsx(Docs.SDKRequestTitle, { snippetLanguage }),
186
+ method,
187
+ transformRequestSnippet
188
+ });
189
+ }
190
+ function SDKMethodHeader({ method }) {
191
+ const Docs = useComponents();
192
+ const Lang = useLanguageComponents();
193
+ const decl = useDeclaration(method.stainlessPath, true);
194
+ return /* @__PURE__ */ jsx(Docs.MethodHeader, {
195
+ level: "h1",
196
+ title: method.summary || method.title,
197
+ signature: /* @__PURE__ */ jsx(Lang.MethodSignature, { decl }),
198
+ badges: method.deprecated && /* @__PURE__ */ jsx(Docs.Badge, {
199
+ id: "deprecated",
200
+ children: "Deprecated"
201
+ }),
202
+ children: /* @__PURE__ */ jsx(Docs.MethodRoute, {
203
+ httpMethod: method.httpMethod,
204
+ endpoint: method.endpoint.split(" ", 2).at(-1)
205
+ })
206
+ });
207
+ }
208
+ function useStreamingResponse(method) {
209
+ const tsDecl = useDeclaration(method.stainlessPath, false, "typescript");
210
+ if (tsDecl?.kind === "TSDeclFunction" && tsDecl.overloads) {
211
+ for (const e of tsDecl.overloads) if (e.returns.kind === "TSTypeReference" && (e.returns.$ref === "$.typescript.Stream" || e.returns.$ref === "$.node.Stream") && e.returns.typeParameters?.[0]?.kind === "TSTypeReference") {
212
+ const id = e.returns.typeParameters?.[0].$ref;
213
+ if (id) return id;
214
+ }
215
+ }
216
+ }
217
+ function SDKMethodInfo({ method }) {
218
+ const Docs = useComponents();
219
+ const Lang = useLanguageComponents();
220
+ const decl = useDeclaration(method.stainlessPath, true);
221
+ const streamingResponse = useStreamingResponse(method);
222
+ const spec = useSpec();
223
+ const language = useLanguage();
224
+ if (Lang.MethodInfo) return /* @__PURE__ */ jsx(Lang.MethodInfo, { decl });
225
+ function shouldExpand(items) {
226
+ if (items.length > 1) return false;
227
+ const item = items[0];
228
+ if (!item) return false;
229
+ const decl = spec?.decls?.[language]?.[item];
230
+ return decl && "children" in decl && decl.children && decl.children.length > 0;
231
+ }
232
+ const responseChildren = "responseChildren" in decl && decl.responseChildren && decl.responseChildren.length > 0 ? [...decl.responseChildren] : [];
233
+ if (streamingResponse) responseChildren.push(streamingResponse);
234
+ return /* @__PURE__ */ jsx(Docs.MethodInfo, {
235
+ parameters: "paramsChildren" in decl && Array.isArray(decl.paramsChildren) && decl.paramsChildren.length > 0 && /* @__PURE__ */ jsx(Docs.SDKChildren, {
236
+ expand: shouldExpand(decl.paramsChildren),
237
+ paths: decl.paramsChildren
238
+ }),
239
+ returns: responseChildren.length > 0 && /* @__PURE__ */ jsx(Docs.SDKChildren, {
240
+ expand: shouldExpand(responseChildren),
241
+ paths: responseChildren
242
+ })
243
+ });
244
+ }
245
+ function SDKMethodNotImplemented({ method }) {
246
+ const Docs = useComponents();
247
+ const languages = useAvailableLanguages(method?.stainlessPath);
248
+ const language = useLanguage();
249
+ const { basePath } = useNavigation();
250
+ const availableLanguageLinks = languages.flatMap((lang) => {
251
+ const url = generateRoute(basePath ?? "/", lang, method.stainlessPath);
252
+ return url ? [{
253
+ url,
254
+ label: LanguageNames[lang] ?? lang
255
+ }] : [];
256
+ });
257
+ return /* @__PURE__ */ jsxs("div", {
258
+ className: style_default.Method,
259
+ children: [/* @__PURE__ */ jsx(Docs.MethodHeader, {
260
+ level: "h1",
261
+ title: method.summary || method.title,
262
+ children: /* @__PURE__ */ jsx(Docs.MethodRoute, {
263
+ httpMethod: method.httpMethod,
264
+ endpoint: method.endpoint.split(" ", 2).at(-1)
265
+ })
266
+ }), /* @__PURE__ */ jsxs(Callout, {
267
+ variant: "warning",
268
+ children: [
269
+ "The method ",
270
+ /* @__PURE__ */ jsx("code", { children: method.name }),
271
+ " is not implemented in ",
272
+ LanguageNames[language] ?? language,
273
+ basePath && availableLanguageLinks.length > 0 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [", but it is available in the following languages:", /* @__PURE__ */ jsx("ul", { children: availableLanguageLinks.map(({ url, label }) => {
274
+ return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("a", {
275
+ href: url,
276
+ children: label
277
+ }) }, url);
278
+ }) })] }) : "."
279
+ ]
280
+ })]
281
+ });
282
+ }
283
+ function SDKMethod({ method, transformRequestSnippet }) {
284
+ const Docs = useComponents();
285
+ const decl = useDeclaration(method?.stainlessPath, false);
286
+ const layout = useContentPanelLayout();
287
+ if (!decl) return /* @__PURE__ */ jsx(SDKMethodNotImplemented, { method });
288
+ return /* @__PURE__ */ jsxs(Docs.Method, {
289
+ id: method.stainlessPath,
290
+ header: /* @__PURE__ */ jsx(Docs.SDKMethodHeader, { method }),
291
+ className: clsx({
292
+ [style_default.MethodSinglePane]: layout === "single-pane",
293
+ [style_default.MethodDoublePane]: layout === "double-pane"
294
+ }),
295
+ children: [
296
+ /* @__PURE__ */ jsxs("div", {
297
+ className: style_default.MethodContentColumn,
298
+ children: [/* @__PURE__ */ jsx(Docs.MethodDescription, { description: method.description }), /* @__PURE__ */ jsx(Docs.SDKMethodInfo, { method })]
299
+ }),
300
+ /* @__PURE__ */ jsx("div", {
301
+ className: clsx(style_default.MethodExample, "not-content", "stl-ui-not-prose"),
302
+ children: /* @__PURE__ */ jsx(Docs.SDKExample, {
303
+ method,
304
+ transformRequestSnippet
305
+ })
306
+ }),
307
+ /* @__PURE__ */ jsxs("div", {
308
+ className: style_default.MethodResponseColumn,
309
+ children: [/* @__PURE__ */ jsx("h5", { children: "Returns Examples" }), /* @__PURE__ */ jsx(Docs.SnippetResponse, { responses: method.exampleResponses })]
310
+ })
311
+ ]
312
+ });
313
+ }
314
+ function SDKModel({ model }) {
315
+ const Docs = useComponents();
316
+ if (!useDeclaration(`${model.stainlessPath} > (schema)`, true)) return null;
317
+ return /* @__PURE__ */ jsx("div", {
318
+ className: style_default.Model,
319
+ tabIndex: 0,
320
+ children: /* @__PURE__ */ jsx("div", {
321
+ className: style_default.ResourceContentProperties,
322
+ children: /* @__PURE__ */ jsx(Docs.SDKDeclaration, { path: `${model.stainlessPath} > (schema)` })
323
+ })
324
+ });
325
+ }
326
+ function SDKReference({ stainlessPath, children }) {
327
+ const Docs = useComponents();
328
+ if (!stainlessPath || !stainlessPath.endsWith("(schema)")) return children;
329
+ return /* @__PURE__ */ jsx("span", {
330
+ className: style_default.TypeReference,
331
+ children: /* @__PURE__ */ jsx(Docs.Link, {
332
+ stainlessPath,
333
+ children
334
+ })
335
+ });
336
+ }
337
+ function SDKLanguageBlock({ language, version, install, links }) {
338
+ const Docs = useComponents();
339
+ const lang = `${language}.default`;
340
+ return /* @__PURE__ */ jsxs("div", {
341
+ className: style_default.LanguageBlock,
342
+ children: [
343
+ /* @__PURE__ */ jsxs("div", {
344
+ className: style_default.LanguageBlockContent,
345
+ children: [/* @__PURE__ */ jsx("div", {
346
+ className: style_default.LanguageBlockContentIcon,
347
+ children: /* @__PURE__ */ jsx(Docs.SDKIcon, {
348
+ language: lang,
349
+ size: 24
350
+ })
351
+ }), /* @__PURE__ */ jsxs("div", {
352
+ className: style_default.LanguageBlockContentInfo,
353
+ children: [/* @__PURE__ */ jsx("div", {
354
+ className: style_default.LanguageBlockContentInfoLanguage,
355
+ children: Docs.SDKSnippetLanguages[lang].name
356
+ }), /* @__PURE__ */ jsx("div", {
357
+ className: style_default.LanguageBlockContentInfoVersion,
358
+ children: version
359
+ })]
360
+ })]
361
+ }),
362
+ /* @__PURE__ */ jsxs("div", {
363
+ className: style_default.LanguageBlockInstall,
364
+ "data-stldocs-copy-parent": true,
365
+ children: [
366
+ /* @__PURE__ */ jsx("pre", {
367
+ "data-stldocs-copy-content": true,
368
+ children: install
369
+ }),
370
+ " ",
371
+ /* @__PURE__ */ jsx(Button, {
372
+ variant: "ghost",
373
+ size: "sm",
374
+ "data-stldocs-snippet-copy": true,
375
+ children: /* @__PURE__ */ jsx(Copy, {
376
+ size: 16,
377
+ className: style_default.Icon
378
+ })
379
+ })
380
+ ]
381
+ }),
382
+ /* @__PURE__ */ jsxs("div", {
383
+ className: style_default.LanguageBlockLinks,
384
+ children: [/* @__PURE__ */ jsx(Button, {
385
+ href: links.repo,
386
+ variant: "outline",
387
+ children: /* @__PURE__ */ jsx(Button.Icon, { icon: Github })
388
+ }), /* @__PURE__ */ jsxs(Button, {
389
+ href: links.docs,
390
+ variant: "outline",
391
+ children: [/* @__PURE__ */ jsx(Button.Icon, { icon: BookOpen }), /* @__PURE__ */ jsx(Button.Label, { children: "Read Docs" })]
392
+ })]
393
+ })
394
+ ]
395
+ });
396
+ }
397
+
398
+ //#endregion
399
+ export { usePropertyModel as _, SDKDeclaration as a, SDKLanguageBlock as c, SDKMethodInfo as d, SDKMethodNotImplemented as f, SDKSnippetLanguages as g, SDKRequestTitle as h, SDKConstraints as i, SDKMethod as l, SDKReference as m, ReferenceNestingContext as n, SDKExample as o, SDKModel as p, SDKChildren as r, SDKIcon as s, PropertyModelContext as t, SDKMethodHeader as u, useReferenceNesting as v, useStreamingResponse as y };
@@ -0,0 +1,122 @@
1
+ import { c as ID, d as Method, f as Model, g as SnippetLanguage, o as HasStainlessPath, t as BaseDeclaration } from "./index-CwjGm9zX.js";
2
+ import { t as DocsLanguage } from "./routing-Cm_9XJiQ.js";
3
+ import * as React$1 from "react";
4
+ import * as react_jsx_runtime30 from "react/jsx-runtime";
5
+
6
+ //#region src/components/sdk.d.ts
7
+ type PropertyModelContextType = {
8
+ modelPath?: string;
9
+ propertyPath?: string;
10
+ };
11
+ declare const PropertyModelContext: React$1.Context<PropertyModelContextType>;
12
+ declare function usePropertyModel(): PropertyModelContextType;
13
+ type ReferenceNestingContextType = string[];
14
+ declare const ReferenceNestingContext: React$1.Context<ReferenceNestingContextType>;
15
+ declare function useReferenceNesting(): ReferenceNestingContextType;
16
+ type SDKSnippetLanguagesType = Record<SnippetLanguage, {
17
+ name: string;
18
+ }>;
19
+ declare const SDKSnippetLanguages: SDKSnippetLanguagesType;
20
+ type TransformRequestSnippetFn = ({
21
+ snippet,
22
+ language
23
+ }: {
24
+ snippet: string;
25
+ language: DocsLanguage;
26
+ }) => string;
27
+ type SDKChildrenProps = {
28
+ paths: ID[];
29
+ expand?: boolean;
30
+ depth?: number;
31
+ };
32
+ declare function SDKChildren({
33
+ paths,
34
+ expand,
35
+ depth
36
+ }: SDKChildrenProps): react_jsx_runtime30.JSX.Element;
37
+ type SDKDeclarationProps = {
38
+ path: string;
39
+ expand?: boolean;
40
+ depth?: number;
41
+ };
42
+ declare function SDKDeclaration({
43
+ path,
44
+ expand,
45
+ depth
46
+ }: SDKDeclarationProps): react_jsx_runtime30.JSX.Element;
47
+ type SDKConstraintsProps = {
48
+ constraints?: Record<string, any>;
49
+ };
50
+ declare function SDKConstraints({
51
+ constraints
52
+ }: SDKConstraintsProps): react_jsx_runtime30.JSX.Element | undefined;
53
+ type SDKIconProps = {
54
+ language: SnippetLanguage;
55
+ size?: number;
56
+ };
57
+ declare function SDKIcon({
58
+ language
59
+ }: SDKIconProps): react_jsx_runtime30.JSX.Element | null;
60
+ type SDKRequestTitleProps = {
61
+ snippetLanguage: SnippetLanguage;
62
+ };
63
+ declare function SDKRequestTitle({
64
+ snippetLanguage
65
+ }: SDKRequestTitleProps): react_jsx_runtime30.JSX.Element;
66
+ type SDKExampleProps = {
67
+ method: Partial<Method> & HasStainlessPath;
68
+ transformRequestSnippet?: TransformRequestSnippetFn;
69
+ };
70
+ declare function SDKExample({
71
+ method,
72
+ transformRequestSnippet
73
+ }: SDKExampleProps): react_jsx_runtime30.JSX.Element;
74
+ type SDKMethodProps = {
75
+ method: Method;
76
+ transformRequestSnippet?: TransformRequestSnippetFn;
77
+ };
78
+ declare function SDKMethodHeader({
79
+ method
80
+ }: SDKMethodProps): react_jsx_runtime30.JSX.Element;
81
+ declare function useStreamingResponse(method: BaseDeclaration): ID | undefined;
82
+ declare function SDKMethodInfo({
83
+ method
84
+ }: SDKMethodProps): react_jsx_runtime30.JSX.Element;
85
+ declare function SDKMethodNotImplemented({
86
+ method
87
+ }: SDKMethodProps): react_jsx_runtime30.JSX.Element;
88
+ declare function SDKMethod({
89
+ method,
90
+ transformRequestSnippet
91
+ }: SDKMethodProps): react_jsx_runtime30.JSX.Element;
92
+ type SDKModelProps = {
93
+ model: Model;
94
+ };
95
+ declare function SDKModel({
96
+ model
97
+ }: SDKModelProps): react_jsx_runtime30.JSX.Element | null;
98
+ type SDKReferenceProps = {
99
+ stainlessPath: string;
100
+ children?: React$1.ReactNode;
101
+ };
102
+ declare function SDKReference({
103
+ stainlessPath,
104
+ children
105
+ }: SDKReferenceProps): string | number | bigint | boolean | react_jsx_runtime30.JSX.Element | Iterable<React$1.ReactNode> | Promise<string | number | bigint | boolean | React$1.ReactPortal | React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>> | Iterable<React$1.ReactNode> | null | undefined> | null | undefined;
106
+ type SDKLanguageBlockProps = {
107
+ language: DocsLanguage;
108
+ version: string;
109
+ install: string;
110
+ links: {
111
+ repo: string;
112
+ docs: string;
113
+ };
114
+ };
115
+ declare function SDKLanguageBlock({
116
+ language,
117
+ version,
118
+ install,
119
+ links
120
+ }: SDKLanguageBlockProps): react_jsx_runtime30.JSX.Element;
121
+ //#endregion
122
+ export { SDKSnippetLanguagesType as C, useStreamingResponse as D, useReferenceNesting as E, SDKSnippetLanguages as S, usePropertyModel as T, SDKModel as _, SDKChildren as a, SDKRequestTitle as b, SDKDeclaration as c, SDKLanguageBlock as d, SDKMethod as f, SDKMethodProps as g, SDKMethodNotImplemented as h, ReferenceNestingContextType as i, SDKExample as l, SDKMethodInfo as m, PropertyModelContextType as n, SDKConstraints as o, SDKMethodHeader as p, ReferenceNestingContext as r, SDKConstraintsProps as s, PropertyModelContext as t, SDKIcon as u, SDKModelProps as v, TransformRequestSnippetFn as w, SDKRequestTitleProps as x, SDKReference as y };
@@ -0,0 +1,15 @@
1
+ import { m as Resource } from "./index-CwjGm9zX.js";
2
+ import * as react_jsx_runtime36 from "react/jsx-runtime";
3
+
4
+ //#region src/components/sdk-sidebar.d.ts
5
+ type SDKSidebarProps = {
6
+ resources: Resource[];
7
+ };
8
+ /**
9
+ * Given some SDKJSON.Resources, calls into StlSidebar with the appropriate sidebar entries.
10
+ */
11
+ declare function SDKSidebar({
12
+ resources
13
+ }: SDKSidebarProps): react_jsx_runtime36.JSX.Element;
14
+ //#endregion
15
+ export { SDKSidebarProps as n, SDKSidebar as t };
@@ -0,0 +1,15 @@
1
+ import { m as Resource } from "./index-CwjGm9zX.js";
2
+ import * as react_jsx_runtime29 from "react/jsx-runtime";
3
+
4
+ //#region src/components/sdk-sidebar.d.ts
5
+ type SDKSidebarProps = {
6
+ resources: Resource[];
7
+ };
8
+ /**
9
+ * Given some SDKJSON.Resources, calls into StlSidebar with the appropriate sidebar entries.
10
+ */
11
+ declare function SDKSidebar({
12
+ resources
13
+ }: SDKSidebarProps): react_jsx_runtime29.JSX.Element;
14
+ //#endregion
15
+ export { SDKSidebarProps as n, SDKSidebar as t };
@@ -0,0 +1,50 @@
1
+ import { n as useNavigation } from "./navigation-aoYZ_tl4.js";
2
+ import { i as isResourceEmpty } from "./utils-DPbkW1Tz.js";
3
+ import { t as StlSidebar } from "./stl-sidebar-WtimNrk1.js";
4
+ import * as React$1 from "react";
5
+ import { jsx } from "react/jsx-runtime";
6
+ import { Badge, getHttpMethod } from "@stainless-api/ui-primitives";
7
+
8
+ //#region src/components/sdk-sidebar.tsx
9
+ function resourceToEntry(resource, selectedPath) {
10
+ const result = {
11
+ type: "group",
12
+ collapsed: false,
13
+ label: resource.title,
14
+ entries: [],
15
+ target: {
16
+ type: "stainlessPath",
17
+ stainlessPath: resource.stainlessPath
18
+ },
19
+ isCurrent: selectedPath === resource.stainlessPath
20
+ };
21
+ for (const method of Object.values(resource.methods)) {
22
+ const httpMethod = getHttpMethod(method.httpMethod);
23
+ result.entries.push({
24
+ type: "link",
25
+ target: {
26
+ type: "stainlessPath",
27
+ stainlessPath: method.stainlessPath
28
+ },
29
+ label: method.title,
30
+ isCurrent: selectedPath === method.stainlessPath,
31
+ icon: httpMethod ? /* @__PURE__ */ jsx(Badge.HTTP, {
32
+ method: httpMethod,
33
+ iconOnly: true,
34
+ size: "sm"
35
+ }) : void 0
36
+ });
37
+ }
38
+ for (const subresource of Object.values(resource.subresources ?? {})) result.entries.push(resourceToEntry(subresource, selectedPath));
39
+ return result;
40
+ }
41
+ /**
42
+ * Given some SDKJSON.Resources, calls into StlSidebar with the appropriate sidebar entries.
43
+ */
44
+ function SDKSidebar({ resources }) {
45
+ const { selectedPath } = useNavigation();
46
+ return /* @__PURE__ */ jsx(StlSidebar, { entries: React$1.useMemo(() => resources.filter((resource) => !isResourceEmpty(resource)).map((resource) => resourceToEntry(resource, selectedPath)), [resources, selectedPath]) });
47
+ }
48
+
49
+ //#endregion
50
+ export { SDKSidebar as t };