@stainless-api/docs-ui 0.1.0-beta.8 → 0.1.0-beta.81

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 (155) hide show
  1. package/dist/chunk-BYypO7fO.js +18 -0
  2. package/dist/components/MaskedInput.d.ts +14 -0
  3. package/dist/components/MaskedInput.js +76 -0
  4. package/dist/components/breadcrumbs.d.ts +25 -0
  5. package/dist/components/breadcrumbs.js +64 -0
  6. package/dist/components/icons.d.ts +65 -0
  7. package/dist/components/icons.js +941 -0
  8. package/dist/components/index.d.ts +16 -0
  9. package/dist/components/index.js +75 -0
  10. package/dist/components/method.d.ts +59 -0
  11. package/dist/components/method.js +97 -0
  12. package/dist/components/overview.d.ts +39 -0
  13. package/dist/components/overview.js +139 -0
  14. package/dist/components/primitives.d.ts +107 -0
  15. package/dist/components/primitives.js +253 -0
  16. package/dist/components/properties.d.ts +54 -0
  17. package/dist/components/properties.js +146 -0
  18. package/dist/components/sdk-sidebar.d.ts +15 -0
  19. package/dist/components/sdk-sidebar.js +52 -0
  20. package/dist/components/sdk.d.ts +128 -0
  21. package/dist/components/sdk.js +490 -0
  22. package/dist/components/snippets.d.ts +71 -0
  23. package/dist/components/snippets.js +184 -0
  24. package/dist/components/stl-sidebar.d.ts +58 -0
  25. package/dist/components/stl-sidebar.js +114 -0
  26. package/dist/contexts/component-generics.d.ts +30 -0
  27. package/dist/contexts/component-generics.js +33 -0
  28. package/dist/contexts/component-types.d.ts +8 -0
  29. package/dist/contexts/component-types.js +0 -0
  30. package/dist/contexts/component.d.ts +21 -0
  31. package/dist/contexts/component.js +24 -0
  32. package/dist/contexts/docs.d.ts +62 -0
  33. package/dist/contexts/docs.js +91 -0
  34. package/dist/contexts/index.d.ts +13 -0
  35. package/dist/contexts/index.js +45 -0
  36. package/dist/contexts/markdown.d.ts +22 -0
  37. package/dist/contexts/markdown.js +49 -0
  38. package/dist/contexts/navigation.d.ts +29 -0
  39. package/dist/contexts/navigation.js +24 -0
  40. package/dist/contexts/use-components.d.ts +6 -0
  41. package/dist/contexts/use-components.js +8 -0
  42. package/dist/index-pvh-w1xa.d.ts +1776 -0
  43. package/dist/index.d.ts +7 -0
  44. package/dist/index.js +9 -7542
  45. package/dist/languages/cli.d.ts +38 -0
  46. package/dist/languages/cli.js +167 -0
  47. package/dist/languages/csharp.d.ts +42 -0
  48. package/dist/languages/csharp.js +284 -0
  49. package/dist/languages/go.d.ts +40 -0
  50. package/dist/languages/go.js +304 -0
  51. package/dist/languages/http.d.ts +46 -0
  52. package/dist/languages/http.js +387 -0
  53. package/dist/languages/index.d.ts +51 -0
  54. package/dist/languages/index.js +33 -0
  55. package/dist/languages/java.d.ts +43 -0
  56. package/dist/languages/java.js +404 -0
  57. package/dist/languages/php.d.ts +40 -0
  58. package/dist/languages/php.js +313 -0
  59. package/dist/languages/python.d.ts +40 -0
  60. package/dist/languages/python.js +270 -0
  61. package/dist/languages/ruby.d.ts +40 -0
  62. package/dist/languages/ruby.js +388 -0
  63. package/dist/languages/terraform.d.ts +48 -0
  64. package/dist/languages/terraform.js +244 -0
  65. package/dist/languages/typescript.d.ts +40 -0
  66. package/dist/languages/typescript.js +450 -0
  67. package/dist/markdown/index.d.ts +11 -0
  68. package/dist/markdown/index.js +80 -0
  69. package/dist/markdown/md.d.ts +15 -0
  70. package/dist/markdown/md.js +41 -0
  71. package/dist/markdown/printer.d.ts +13 -0
  72. package/dist/markdown/printer.js +76 -0
  73. package/dist/markdown/utils.d.ts +21 -0
  74. package/dist/markdown/utils.js +31 -0
  75. package/dist/routing.d.ts +61 -0
  76. package/dist/routing.js +176 -150
  77. package/dist/spec.d.ts +65 -0
  78. package/dist/spec.js +167 -0
  79. package/dist/style.d.ts +178 -0
  80. package/dist/style.js +179 -0
  81. package/dist/styles/main.css +784 -752
  82. package/dist/styles/main.js +0 -0
  83. package/dist/styles/primitives.css +408 -446
  84. package/dist/styles/primitives.js +0 -0
  85. package/dist/styles/resets.css +32 -41
  86. package/dist/styles/resets.js +0 -0
  87. package/dist/styles/search.css +192 -270
  88. package/dist/styles/search.js +0 -0
  89. package/dist/styles/sidebar.css +182 -69
  90. package/dist/styles/sidebar.js +0 -0
  91. package/dist/styles/variables.css +28 -89
  92. package/dist/styles/variables.js +0 -0
  93. package/dist/styles.css +3423 -0
  94. package/dist/styles.mjs +1 -0
  95. package/dist/use-strict-context-L0c8JKg4.js +16 -0
  96. package/dist/utils.d.ts +20 -0
  97. package/dist/utils.js +54 -0
  98. package/package.json +74 -22
  99. package/dist/mcp.js +0 -16003
  100. package/dist/styles/snippets.css +0 -132
  101. package/src/components/breadcrumbs.tsx +0 -94
  102. package/src/components/chat.tsx +0 -154
  103. package/src/components/dropdown.tsx +0 -91
  104. package/src/components/icons.tsx +0 -584
  105. package/src/components/index.ts +0 -9
  106. package/src/components/method.tsx +0 -146
  107. package/src/components/overview.tsx +0 -160
  108. package/src/components/primitives.tsx +0 -284
  109. package/src/components/properties.tsx +0 -130
  110. package/src/components/scripts/dropdown.ts +0 -78
  111. package/src/components/sdk.tsx +0 -403
  112. package/src/components/sidebar.tsx +0 -99
  113. package/src/components/snippets.tsx +0 -180
  114. package/src/contexts/component-generics.tsx +0 -48
  115. package/src/contexts/component-types.tsx +0 -5
  116. package/src/contexts/component.tsx +0 -32
  117. package/src/contexts/docs.tsx +0 -75
  118. package/src/contexts/index.tsx +0 -17
  119. package/src/contexts/markdown.tsx +0 -43
  120. package/src/contexts/navigation.tsx +0 -44
  121. package/src/contexts/search.tsx +0 -28
  122. package/src/contexts/use-components.tsx +0 -4
  123. package/src/index.ts +0 -6
  124. package/src/languages/go.tsx +0 -281
  125. package/src/languages/http.tsx +0 -321
  126. package/src/languages/index.ts +0 -26
  127. package/src/languages/java.tsx +0 -358
  128. package/src/languages/python.tsx +0 -255
  129. package/src/languages/ruby.tsx +0 -320
  130. package/src/languages/typescript.tsx +0 -393
  131. package/src/markdown/index.ts +0 -107
  132. package/src/markdown/md.ts +0 -45
  133. package/src/markdown/utils.ts +0 -49
  134. package/src/routing.ts +0 -238
  135. package/src/search/form.tsx +0 -127
  136. package/src/search/index.tsx +0 -1
  137. package/src/search/indexer.ts +0 -246
  138. package/src/search/mcp.ts +0 -61
  139. package/src/search/printer.tsx +0 -86
  140. package/src/search/providers/algolia.ts +0 -88
  141. package/src/search/providers/fuse.ts +0 -19
  142. package/src/search/providers/pagefind.ts +0 -17
  143. package/src/search/providers/walker.ts +0 -30
  144. package/src/search/results.tsx +0 -182
  145. package/src/search/state.ts +0 -64
  146. package/src/search/types.ts +0 -116
  147. package/src/style.ts +0 -196
  148. package/src/styles/main.css +0 -986
  149. package/src/styles/primitives.css +0 -580
  150. package/src/styles/resets.css +0 -39
  151. package/src/styles/search.css +0 -341
  152. package/src/styles/sidebar.css +0 -85
  153. package/src/styles/snippets.css +0 -130
  154. package/src/styles/variables.css +0 -86
  155. package/src/utils.ts +0 -41
@@ -0,0 +1,490 @@
1
+ import { useAvailableLanguages, useContentPanelLayout, useDeclaration, useLanguage, useSettings, useSnippetIds, useSnippetResponse, useSpec } from "../contexts/docs.js";
2
+ import "../use-strict-context-L0c8JKg4.js";
3
+ import { useNavigation } from "../contexts/navigation.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 { LanguageNames, generateRoute, getLanguageSnippet, parseStainlessPath } from "../routing.js";
8
+ import { CLIIcon, CSharpIcon, CurlIcon, GoIcon, JavaIcon, KotlinIcon, PHPIcon, PowershellIcon, PythonIcon, RubyIcon, TerraformIcon, TypescriptIcon } from "./icons.js";
9
+ import * as React$1 from "react";
10
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
11
+ import clsx from "clsx";
12
+ import { BookOpen, Copy, Github } from "lucide-react";
13
+ import { Button, Callout } from "@stainless-api/ui-primitives";
14
+
15
+ //#region src/components/sdk.tsx
16
+ const PropertyModelContext = React$1.createContext({});
17
+ function usePropertyModel() {
18
+ return React$1.useContext(PropertyModelContext);
19
+ }
20
+ const ReferenceNestingContext = React$1.createContext([]);
21
+ function useReferenceNesting() {
22
+ return React$1.useContext(ReferenceNestingContext);
23
+ }
24
+ const DeclarationParentsContext = React$1.createContext(/* @__PURE__ */ new Set());
25
+ const AddToDeclarationParents = ({ id, children }) => /* @__PURE__ */ jsx(DeclarationParentsContext, {
26
+ value: new Set([...useDeclarationParents(), id.replace(/(?<=> \(schema\))((?!> \(schema\) > ).)+$/, "")]),
27
+ children
28
+ });
29
+ function useDeclarationParents() {
30
+ return React$1.useContext(DeclarationParentsContext);
31
+ }
32
+ const SDKSnippetLanguages = {
33
+ "node.default": { name: "TypeScript" },
34
+ "typescript.default": { name: "TypeScript" },
35
+ "python.default": { name: "Python" },
36
+ "go.default": { name: "Go" },
37
+ "java.default": { name: "Java" },
38
+ "kotlin.default": { name: "Kotlin" },
39
+ "http.curl": { name: "cURL" },
40
+ "http.powershell": { name: "Powershell" },
41
+ "terraform.default": { name: "Terraform" },
42
+ "ruby.default": { name: "Ruby" },
43
+ "csharp.default": { name: "C#" },
44
+ "php.default": { name: "PHP" },
45
+ "cli.default": { name: "CLI tool" }
46
+ };
47
+ function SDKChildren({ paths, expand, depth }) {
48
+ const Docs = useComponents();
49
+ return /* @__PURE__ */ jsx("div", {
50
+ className: style_default.Properties,
51
+ children: paths.map((path, i) => /* @__PURE__ */ jsx(Docs.SDKDeclaration, {
52
+ path,
53
+ expand,
54
+ depth
55
+ }, i))
56
+ });
57
+ }
58
+ function normalizeDeclaration(raw, http) {
59
+ if (raw.kind === "JavaDeclProperty" && raw.type.kind === "JavaTypeString" && raw.constraints?.format === "binary") return {
60
+ ...raw,
61
+ type: {
62
+ kind: "JavaTypeReference",
63
+ typeName: "InputStream"
64
+ }
65
+ };
66
+ if (http?.kind === "HttpDeclProperty" && http.type.kind === "HttpTypeString" && http.constraints?.format === "binary") switch (raw.kind) {
67
+ case "CLISchemaProperty":
68
+ case "CLIFlag":
69
+ case "HttpDeclProperty": return {
70
+ ...raw,
71
+ type: {
72
+ kind: "HttpTypeBinary",
73
+ contentType: []
74
+ }
75
+ };
76
+ case "RubyDeclProperty": return {
77
+ ...raw,
78
+ type: {
79
+ kind: "RubyTypeBinary",
80
+ contentType: []
81
+ }
82
+ };
83
+ }
84
+ return raw;
85
+ }
86
+ function SDKDeclaration({ path, expand, depth = 0 }) {
87
+ const Lang = useLanguageComponents();
88
+ const Docs = useComponents();
89
+ let pendingDecl = normalizeDeclaration(useDeclaration(path, true), useDeclaration(path.replace(/ > \(schema\)$/, "") + " > (schema)", false, "http"));
90
+ const settings = useSettings();
91
+ const model = usePropertyModel();
92
+ const nesting = useReferenceNesting();
93
+ const { selectedPath, basePath } = useNavigation();
94
+ const parents = useDeclarationParents();
95
+ const language = useLanguage();
96
+ if (parents.has(path)) if (pendingDecl.kind === "GoDeclType") pendingDecl = {
97
+ ...pendingDecl,
98
+ kind: "GoDeclType",
99
+ type: {
100
+ kind: "GoTypeReference",
101
+ typeName: pendingDecl.ident,
102
+ $ref: pendingDecl.stainlessPath
103
+ },
104
+ children: []
105
+ };
106
+ else if (pendingDecl.kind === "HttpDeclTypeAlias") pendingDecl = {
107
+ ...pendingDecl,
108
+ kind: "HttpDeclTypeAlias",
109
+ children: []
110
+ };
111
+ else if (pendingDecl.kind === "PythonDeclClass") pendingDecl = {
112
+ kind: "PythonDeclType",
113
+ ident: pendingDecl.ident,
114
+ stainlessPath: pendingDecl.stainlessPath,
115
+ type: {
116
+ kind: "PythonTypeReference",
117
+ typeName: pendingDecl.ident,
118
+ $ref: pendingDecl.stainlessPath
119
+ }
120
+ };
121
+ else if (pendingDecl.kind === "TSDeclInterface") pendingDecl = {
122
+ kind: "TSDeclTypeAlias",
123
+ ident: pendingDecl.ident,
124
+ stainlessPath: pendingDecl.stainlessPath,
125
+ type: {
126
+ kind: "TSTypeReference",
127
+ ident: pendingDecl.ident,
128
+ $ref: pendingDecl.stainlessPath
129
+ }
130
+ };
131
+ else if ("ident" in pendingDecl) {
132
+ const ident = pendingDecl.ident;
133
+ const url = generateRoute(basePath ?? "/", language, pendingDecl.stainlessPath);
134
+ return /* @__PURE__ */ jsx("span", {
135
+ className: style_default.Type,
136
+ children: /* @__PURE__ */ jsx("span", {
137
+ className: style_default.TypeReference,
138
+ children: url ? /* @__PURE__ */ jsx("a", {
139
+ href: url,
140
+ children: ident
141
+ }) : ident
142
+ })
143
+ });
144
+ } else throw new Error("Infinite recursion in SDKDeclaration: " + JSON.stringify({
145
+ parents: [...parents],
146
+ path,
147
+ pendingDecl
148
+ }));
149
+ const decl = pendingDecl;
150
+ if (decl.kind.endsWith("Reference")) {
151
+ const refId = "type" in decl && decl.type !== void 0 && typeof decl.type !== "string" && "$ref" in decl.type ? decl.type["$ref"] : void 0;
152
+ if (refId && refId !== path && !nesting.includes(refId)) return /* @__PURE__ */ jsx(AddToDeclarationParents, {
153
+ id: path,
154
+ children: /* @__PURE__ */ jsx(ReferenceNestingContext.Provider, {
155
+ value: [...nesting, refId],
156
+ children: /* @__PURE__ */ jsx(SDKDeclaration, {
157
+ path: refId,
158
+ expand,
159
+ depth
160
+ })
161
+ })
162
+ });
163
+ }
164
+ const parsedPath = selectedPath ? parseStainlessPath(selectedPath) : null;
165
+ const modelPropSetting = settings?.properties?.includeModelProperties;
166
+ const inlineModelProps = modelPropSetting === "method-page" ? Boolean(parsedPath?.method) : modelPropSetting !== false;
167
+ const isUnion = "childrenParentSchema" in decl && decl.childrenParentSchema && decl.kind !== "CLIFlag" && decl.kind !== "CLISchemaProperty" && ["enum", "union"].includes(decl.childrenParentSchema);
168
+ const id = model?.propertyPath ? `${model.propertyPath} + ${path}` : path;
169
+ const shouldExpand = selectedPath?.startsWith(path) && nesting.length < 1 || settings?.properties?.expandDepth && depth <= settings?.properties?.expandDepth && !isUnion || expand;
170
+ 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));
171
+ const content = /* @__PURE__ */ jsx(Lang.Property, {
172
+ decl,
173
+ children: ({ ...props }) => /* @__PURE__ */ jsx(Docs.Property, {
174
+ id,
175
+ expand: shouldExpand,
176
+ constraints: "constraints" in decl && decl.kind !== "CLIFlag" && decl.kind !== "CLISchemaProperty" && /* @__PURE__ */ jsx(Docs.SDKConstraints, { constraints: decl["constraints"] }),
177
+ declaration: /* @__PURE__ */ jsx(Lang.Declaration, { decl }),
178
+ title: "title" in decl ? decl.title : void 0,
179
+ description: "docstring" in decl ? decl["docstring"] : void 0,
180
+ deprecated: decl.deprecated,
181
+ ...props,
182
+ children: hasChildren && /* @__PURE__ */ jsxs(Fragment$1, { children: [isUnion && /* @__PURE__ */ jsx("div", {
183
+ className: style_default.PropertyAnnotation,
184
+ children: "One of the following:"
185
+ }), /* @__PURE__ */ jsx(Docs.SDKChildren, {
186
+ paths: decl.children ?? [],
187
+ depth: depth + 1
188
+ })] })
189
+ })
190
+ });
191
+ if ("modelPath" in decl) {
192
+ const value = {
193
+ modelPath: decl.modelPath,
194
+ propertyPath: decl.stainlessPath
195
+ };
196
+ return /* @__PURE__ */ jsx(AddToDeclarationParents, {
197
+ id: path,
198
+ children: /* @__PURE__ */ jsx(PropertyModelContext.Provider, {
199
+ value,
200
+ children: content
201
+ })
202
+ });
203
+ }
204
+ return /* @__PURE__ */ jsx(AddToDeclarationParents, {
205
+ id: path,
206
+ children: content
207
+ });
208
+ }
209
+ function SDKConstraints({ constraints }) {
210
+ if (constraints) return /* @__PURE__ */ jsx("div", {
211
+ className: style_default.PropertyConstraints,
212
+ children: Object.entries(constraints).map(([name, value]) => name === "format" && value === "binary" ? null : /* @__PURE__ */ jsxs("div", {
213
+ className: style_default.PropertyConstraint,
214
+ children: [/* @__PURE__ */ jsx("span", {
215
+ className: style_default.PropertyConstraintName,
216
+ children: name
217
+ }), /* @__PURE__ */ jsx("span", {
218
+ className: style_default.PropertyConstraintValue,
219
+ children: value
220
+ })]
221
+ }, name))
222
+ });
223
+ }
224
+ const snippetIcons = {
225
+ "node.default": TypescriptIcon,
226
+ "typescript.default": TypescriptIcon,
227
+ "go.default": GoIcon,
228
+ "python.default": PythonIcon,
229
+ "terraform.default": TerraformIcon,
230
+ "http.curl": CurlIcon,
231
+ "http.powershell": PowershellIcon,
232
+ "ruby.default": RubyIcon,
233
+ "java.default": JavaIcon,
234
+ "kotlin.default": KotlinIcon,
235
+ "csharp.default": CSharpIcon,
236
+ "cli.default": CLIIcon,
237
+ "php.default": PHPIcon
238
+ };
239
+ function SDKIcon({ language }) {
240
+ const LangIcon = snippetIcons[language];
241
+ if (!LangIcon) return null;
242
+ return /* @__PURE__ */ jsx(LangIcon, { className: clsx(style_default.Icon, language.split(".").shift()) });
243
+ }
244
+ function SDKRequestTitle({ snippetLanguage }) {
245
+ const languageName = SDKSnippetLanguages[snippetLanguage]?.name;
246
+ return /* @__PURE__ */ jsxs("span", {
247
+ className: style_default.SnippetRequestTitleLanguage,
248
+ children: [
249
+ /* @__PURE__ */ jsx(SDKIcon, { language: snippetLanguage }),
250
+ " ",
251
+ languageName
252
+ ]
253
+ });
254
+ }
255
+ function SDKExample({ method, transformRequestSnippet }) {
256
+ const Docs = useComponents();
257
+ const language = useLanguage();
258
+ const snippetLanguage = getLanguageSnippet(language);
259
+ if ((useSnippetIds(method.stainlessPath, language)?.filter((id) => id !== "default")?.length ?? 0) >= 2) return /* @__PURE__ */ jsx(Docs.MultiSnippets, {
260
+ requestTitle: /* @__PURE__ */ jsx(Docs.SDKRequestTitle, { snippetLanguage }),
261
+ method
262
+ });
263
+ return /* @__PURE__ */ jsx(Docs.Snippet, {
264
+ requestTitle: /* @__PURE__ */ jsx(Docs.SDKRequestTitle, { snippetLanguage }),
265
+ method,
266
+ transformRequestSnippet
267
+ });
268
+ }
269
+ function SDKMethodHeader({ method }) {
270
+ const Docs = useComponents();
271
+ const Lang = useLanguageComponents();
272
+ const decl = useDeclaration(method.stainlessPath, true);
273
+ return /* @__PURE__ */ jsx(Docs.MethodHeader, {
274
+ level: "h1",
275
+ title: method.summary || method.title,
276
+ signature: /* @__PURE__ */ jsx(Lang.MethodSignature, { decl }),
277
+ badges: method.deprecated && /* @__PURE__ */ jsx(Docs.Badge, {
278
+ id: "deprecated",
279
+ children: "Deprecated"
280
+ }),
281
+ children: /* @__PURE__ */ jsx(Docs.MethodRoute, {
282
+ httpMethod: method.httpMethod,
283
+ endpoint: method.endpoint.split(" ", 2).at(-1)
284
+ })
285
+ });
286
+ }
287
+ function useStreamingResponse(method) {
288
+ const tsDecl = useDeclaration(method.stainlessPath, false, "typescript");
289
+ if (tsDecl?.kind === "TSDeclFunction" && tsDecl.overloads) {
290
+ 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") {
291
+ const id = e.returns.typeParameters?.[0].$ref;
292
+ if (id) return id;
293
+ }
294
+ }
295
+ }
296
+ function SDKMethodInfo({ method, children }) {
297
+ const Docs = useComponents();
298
+ const Lang = useLanguageComponents();
299
+ const decl = useDeclaration(method.stainlessPath, true);
300
+ const streamingResponseID = useStreamingResponse(method);
301
+ const streamingResponseDecl = useDeclaration(streamingResponseID ?? "", false);
302
+ const spec = useSpec();
303
+ const language = useLanguage();
304
+ if (Lang.MethodInfo) return /* @__PURE__ */ jsx(Lang.MethodInfo, {
305
+ decl,
306
+ children
307
+ });
308
+ function shouldExpand(items) {
309
+ if (items.length > 1) return false;
310
+ const item = items[0];
311
+ if (!item) return false;
312
+ const decl = spec?.decls?.[language]?.[item];
313
+ return decl && "children" in decl && decl.children && decl.children.length > 0;
314
+ }
315
+ const responseChildren = "responseChildren" in decl && decl.responseChildren && decl.responseChildren.length > 0 ? [...decl.responseChildren] : [];
316
+ if (streamingResponseDecl && streamingResponseID && !responseChildren.includes(streamingResponseID)) responseChildren.push(streamingResponseID);
317
+ return /* @__PURE__ */ jsx(Docs.MethodInfo, {
318
+ parameters: "paramsChildren" in decl && Array.isArray(decl.paramsChildren) && decl.paramsChildren.length > 0 && /* @__PURE__ */ jsx(Docs.SDKChildren, {
319
+ expand: shouldExpand(decl.paramsChildren),
320
+ paths: decl.paramsChildren
321
+ }),
322
+ returns: responseChildren.length > 0 && /* @__PURE__ */ jsx(Docs.SDKChildren, {
323
+ expand: shouldExpand(responseChildren),
324
+ paths: responseChildren
325
+ }),
326
+ children
327
+ });
328
+ }
329
+ function SDKMethodNotImplemented({ method }) {
330
+ const Docs = useComponents();
331
+ const languages = useAvailableLanguages(method?.stainlessPath);
332
+ const language = useLanguage();
333
+ const { basePath } = useNavigation();
334
+ const availableLanguageLinks = languages.flatMap((lang) => {
335
+ const url = generateRoute(basePath ?? "/", lang, method.stainlessPath);
336
+ return url ? [{
337
+ url,
338
+ label: LanguageNames[lang] ?? lang
339
+ }] : [];
340
+ });
341
+ return /* @__PURE__ */ jsxs("div", {
342
+ className: style_default.Method,
343
+ children: [/* @__PURE__ */ jsx(Docs.MethodHeader, {
344
+ level: "h1",
345
+ title: method.summary || method.title,
346
+ children: /* @__PURE__ */ jsx(Docs.MethodRoute, {
347
+ httpMethod: method.httpMethod,
348
+ endpoint: method.endpoint.split(" ", 2).at(-1)
349
+ })
350
+ }), /* @__PURE__ */ jsxs(Callout, {
351
+ variant: "warning",
352
+ children: [
353
+ "The method ",
354
+ /* @__PURE__ */ jsx("code", { children: method.name }),
355
+ " is not implemented in ",
356
+ LanguageNames[language] ?? language,
357
+ 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 }) => {
358
+ return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("a", {
359
+ href: url,
360
+ children: label
361
+ }) }, url);
362
+ }) })] }) : "."
363
+ ]
364
+ })]
365
+ });
366
+ }
367
+ function SDKMethodInfoContent(_props) {
368
+ return null;
369
+ }
370
+ function SDKMethod({ method, transformRequestSnippet }) {
371
+ const Docs = useComponents();
372
+ const decl = useDeclaration(method?.stainlessPath, false);
373
+ const layout = useContentPanelLayout();
374
+ const defaultResponses = useSnippetResponse(method.stainlessPath);
375
+ if (!decl) return /* @__PURE__ */ jsx(SDKMethodNotImplemented, { method });
376
+ return /* @__PURE__ */ jsxs(Docs.Method, {
377
+ id: method.stainlessPath,
378
+ header: /* @__PURE__ */ jsx(Docs.SDKMethodHeader, { method }),
379
+ className: clsx({
380
+ [style_default.MethodSinglePane]: layout === "single-pane",
381
+ [style_default.MethodDoublePane]: layout === "double-pane"
382
+ }),
383
+ children: [
384
+ /* @__PURE__ */ jsxs("div", {
385
+ className: style_default.MethodContentColumn,
386
+ children: [/* @__PURE__ */ jsx(Docs.MethodDescription, { description: method.description }), /* @__PURE__ */ jsx(Docs.SDKMethodInfo, {
387
+ method,
388
+ children: /* @__PURE__ */ jsx(Docs.SDKMethodInfoContent, { method })
389
+ })]
390
+ }),
391
+ /* @__PURE__ */ jsx("div", {
392
+ className: clsx(style_default.MethodExample, "not-content", "stl-ui-not-prose"),
393
+ children: /* @__PURE__ */ jsx(Docs.SDKExample, {
394
+ method,
395
+ transformRequestSnippet
396
+ })
397
+ }),
398
+ /* @__PURE__ */ jsxs("div", {
399
+ className: style_default.MethodResponseColumn,
400
+ children: [/* @__PURE__ */ jsx("h5", { children: "Returns Examples" }), /* @__PURE__ */ jsx(Docs.SnippetResponse, { responses: defaultResponses })]
401
+ })
402
+ ]
403
+ });
404
+ }
405
+ function SDKModel({ model }) {
406
+ const Docs = useComponents();
407
+ if (!useDeclaration(`${model.stainlessPath} > (schema)`, true)) return null;
408
+ return /* @__PURE__ */ jsx("div", {
409
+ className: style_default.Model,
410
+ tabIndex: 0,
411
+ children: /* @__PURE__ */ jsx("div", {
412
+ className: style_default.ResourceContentProperties,
413
+ children: /* @__PURE__ */ jsx(Docs.SDKDeclaration, { path: `${model.stainlessPath} > (schema)` })
414
+ })
415
+ });
416
+ }
417
+ function SDKReference({ stainlessPath, children }) {
418
+ const Docs = useComponents();
419
+ if (!stainlessPath || !stainlessPath.endsWith("(schema)")) return children;
420
+ return /* @__PURE__ */ jsx("span", {
421
+ className: style_default.TypeReference,
422
+ children: /* @__PURE__ */ jsx(Docs.Link, {
423
+ stainlessPath,
424
+ children
425
+ })
426
+ });
427
+ }
428
+ function SDKLanguageBlock({ language, version, install, links }) {
429
+ const Docs = useComponents();
430
+ const lang = `${language}.default`;
431
+ return /* @__PURE__ */ jsxs("div", {
432
+ className: style_default.LanguageBlock,
433
+ children: [
434
+ /* @__PURE__ */ jsxs("div", {
435
+ className: style_default.LanguageBlockContent,
436
+ children: [/* @__PURE__ */ jsx("div", {
437
+ className: style_default.LanguageBlockContentIcon,
438
+ children: /* @__PURE__ */ jsx(Docs.SDKIcon, {
439
+ language: lang,
440
+ size: 24
441
+ })
442
+ }), /* @__PURE__ */ jsxs("div", {
443
+ className: style_default.LanguageBlockContentInfo,
444
+ children: [/* @__PURE__ */ jsx("div", {
445
+ className: style_default.LanguageBlockContentInfoLanguage,
446
+ children: Docs.SDKSnippetLanguages[lang].name
447
+ }), /* @__PURE__ */ jsx("div", {
448
+ className: style_default.LanguageBlockContentInfoVersion,
449
+ children: version
450
+ })]
451
+ })]
452
+ }),
453
+ /* @__PURE__ */ jsxs("div", {
454
+ className: style_default.LanguageBlockInstall,
455
+ "data-stldocs-copy-parent": true,
456
+ children: [
457
+ /* @__PURE__ */ jsx("pre", {
458
+ "data-stldocs-copy-content": true,
459
+ children: install
460
+ }),
461
+ " ",
462
+ /* @__PURE__ */ jsx(Button, {
463
+ variant: "ghost",
464
+ size: "sm",
465
+ "data-stldocs-snippet-copy": true,
466
+ children: /* @__PURE__ */ jsx(Copy, {
467
+ size: 16,
468
+ className: style_default.Icon
469
+ })
470
+ })
471
+ ]
472
+ }),
473
+ /* @__PURE__ */ jsxs("div", {
474
+ className: style_default.LanguageBlockLinks,
475
+ children: [/* @__PURE__ */ jsx(Button, {
476
+ href: links.repo,
477
+ variant: "outline",
478
+ children: /* @__PURE__ */ jsx(Button.Icon, { icon: Github })
479
+ }), /* @__PURE__ */ jsxs(Button, {
480
+ href: links.docs,
481
+ variant: "outline",
482
+ children: [/* @__PURE__ */ jsx(Button.Icon, { icon: BookOpen }), /* @__PURE__ */ jsx(Button.Label, { children: "Read Docs" })]
483
+ })]
484
+ })
485
+ ]
486
+ });
487
+ }
488
+
489
+ //#endregion
490
+ export { PropertyModelContext, ReferenceNestingContext, SDKChildren, SDKConstraints, SDKDeclaration, SDKExample, SDKIcon, SDKLanguageBlock, SDKMethod, SDKMethodHeader, SDKMethodInfo, SDKMethodInfoContent, SDKMethodNotImplemented, SDKModel, SDKReference, SDKRequestTitle, SDKSnippetLanguages, useDeclarationParents, usePropertyModel, useReferenceNesting, useStreamingResponse };
@@ -0,0 +1,71 @@
1
+ import { d as Method, o as HasStainlessPath } from "../index-pvh-w1xa.js";
2
+ import { TransformRequestSnippetFn } from "./sdk.js";
3
+ import { useSnippet } from "../contexts/docs.js";
4
+ import "../contexts/index.js";
5
+ import * as React$1 from "react";
6
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
7
+
8
+ //#region src/components/snippets.d.ts
9
+ type SnippetCodeProps = {
10
+ content: string;
11
+ signature?: string;
12
+ language?: string;
13
+ };
14
+ declare function SnippetCode({
15
+ content,
16
+ language
17
+ }: SnippetCodeProps): react_jsx_runtime0.JSX.Element;
18
+ type SnippetContainerProps = {
19
+ method: Partial<Method> & HasStainlessPath;
20
+ children: React$1.ReactNode;
21
+ signature?: string;
22
+ } & React$1.ComponentProps<'div'>;
23
+ declare function SnippetContainer({
24
+ children,
25
+ className,
26
+ ...props
27
+ }: SnippetContainerProps): react_jsx_runtime0.JSX.Element;
28
+ type SnippetRequestContainerProps = {
29
+ children?: React$1.ReactNode;
30
+ signature?: string;
31
+ };
32
+ declare function SnippetRequestContainer({
33
+ children
34
+ }: SnippetRequestContainerProps): react_jsx_runtime0.JSX.Element;
35
+ type SnippetProps = {
36
+ requestTitle?: React$1.ReactNode;
37
+ method: Partial<Method> & HasStainlessPath;
38
+ snippet?: Parameters<typeof useSnippet>[2];
39
+ transformRequestSnippet?: TransformRequestSnippetFn;
40
+ };
41
+ declare function Snippet({
42
+ requestTitle,
43
+ method,
44
+ snippet,
45
+ transformRequestSnippet
46
+ }: SnippetProps): react_jsx_runtime0.JSX.Element | null;
47
+ type MultiSnippetsProps = {
48
+ method: Partial<Method> & HasStainlessPath;
49
+ requestTitle?: React$1.ReactNode;
50
+ };
51
+ declare function MultiSnippets({
52
+ requestTitle,
53
+ method
54
+ }: MultiSnippetsProps): react_jsx_runtime0.JSX.Element | null;
55
+ declare function SnippetButtons({
56
+ content
57
+ }: {
58
+ content: string;
59
+ }): react_jsx_runtime0.JSX.Element;
60
+ declare function SnippetFooter(): React$1.ReactNode;
61
+ declare function SnippetResponse({
62
+ responses
63
+ }: {
64
+ responses?: {
65
+ status?: string;
66
+ content: string;
67
+ contentType?: string;
68
+ }[];
69
+ }): react_jsx_runtime0.JSX.Element | null;
70
+ //#endregion
71
+ export { MultiSnippets, MultiSnippetsProps, Snippet, SnippetButtons, SnippetCode, SnippetCodeProps, SnippetContainer, SnippetContainerProps, SnippetFooter, SnippetProps, SnippetRequestContainer, SnippetRequestContainerProps, SnippetResponse };