@stainless-api/docs-ui 0.1.0-beta.72 → 0.1.0-beta.74

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 (135) hide show
  1. package/dist/{chunk-BN_g-Awi.js → chunk-BYypO7fO.js} +3 -3
  2. package/dist/components/MaskedInput.d.ts +1 -1
  3. package/dist/components/MaskedInput.js +1 -1
  4. package/dist/components/breadcrumbs.d.ts +24 -1
  5. package/dist/components/breadcrumbs.js +62 -7
  6. package/dist/components/icons.d.ts +12 -12
  7. package/dist/components/icons.js +883 -1
  8. package/dist/components/index.d.ts +16 -14
  9. package/dist/components/index.js +72 -18
  10. package/dist/components/method.d.ts +58 -1
  11. package/dist/components/method.js +95 -8
  12. package/dist/components/overview.d.ts +38 -1
  13. package/dist/components/overview.js +137 -9
  14. package/dist/components/primitives.d.ts +104 -1
  15. package/dist/components/primitives.js +250 -6
  16. package/dist/components/properties.d.ts +53 -1
  17. package/dist/components/properties.js +138 -7
  18. package/dist/components/sdk-sidebar.d.ts +14 -1
  19. package/dist/components/sdk-sidebar.js +50 -8
  20. package/dist/components/sdk.d.ts +121 -1
  21. package/dist/components/sdk.js +404 -8
  22. package/dist/components/snippets.d.ts +70 -13
  23. package/dist/components/snippets.js +182 -7
  24. package/dist/components/stl-sidebar.d.ts +57 -1
  25. package/dist/components/stl-sidebar.js +105 -3
  26. package/dist/contexts/component-generics.d.ts +29 -1
  27. package/dist/contexts/component-generics.js +31 -1
  28. package/dist/contexts/component-types.d.ts +4 -15
  29. package/dist/contexts/component.d.ts +7 -17
  30. package/dist/contexts/component.js +22 -28
  31. package/dist/contexts/docs.d.ts +61 -1
  32. package/dist/contexts/docs.js +89 -1
  33. package/dist/contexts/index.d.ts +13 -14
  34. package/dist/contexts/index.js +44 -6
  35. package/dist/contexts/markdown.d.ts +21 -1
  36. package/dist/contexts/markdown.js +47 -2
  37. package/dist/contexts/navigation.d.ts +28 -1
  38. package/dist/contexts/navigation.js +22 -1
  39. package/dist/contexts/use-components.d.ts +1 -13
  40. package/dist/contexts/use-components.js +6 -2
  41. package/dist/{index-W4Td2Hl7.d.ts → index-PdnFhQF9.d.ts} +1 -1
  42. package/dist/index.d.ts +4 -14
  43. package/dist/index.js +7 -30
  44. package/dist/languages/cli.d.ts +38 -14
  45. package/dist/languages/cli.js +166 -20
  46. package/dist/languages/csharp.d.ts +42 -14
  47. package/dist/languages/csharp.js +283 -8
  48. package/dist/languages/go.d.ts +40 -14
  49. package/dist/languages/go.js +303 -8
  50. package/dist/languages/http.d.ts +46 -14
  51. package/dist/languages/http.js +390 -19
  52. package/dist/languages/index.d.ts +50 -14
  53. package/dist/languages/index.js +30 -28
  54. package/dist/languages/java.d.ts +43 -14
  55. package/dist/languages/java.js +403 -8
  56. package/dist/languages/python.d.ts +40 -14
  57. package/dist/languages/python.js +269 -8
  58. package/dist/languages/ruby.d.ts +40 -14
  59. package/dist/languages/ruby.js +387 -8
  60. package/dist/languages/terraform.d.ts +48 -14
  61. package/dist/languages/terraform.js +243 -8
  62. package/dist/languages/typescript.d.ts +40 -14
  63. package/dist/languages/typescript.js +449 -8
  64. package/dist/markdown/index.d.ts +1 -2
  65. package/dist/markdown/index.js +1 -28
  66. package/dist/markdown/printer.d.ts +2 -2
  67. package/dist/markdown/printer.js +6 -30
  68. package/dist/markdown/utils.d.ts +3 -3
  69. package/dist/routing.d.ts +61 -2
  70. package/dist/routing.js +204 -2
  71. package/dist/spec.d.ts +4 -4
  72. package/dist/spec.js +2 -2
  73. package/dist/style.js +176 -1
  74. package/dist/use-strict-context-L0c8JKg4.js +16 -0
  75. package/dist/utils.d.ts +1 -1
  76. package/dist/utils.js +53 -2
  77. package/package.json +3 -3
  78. package/dist/breadcrumbs-46Qjx1Pd.d.ts +0 -25
  79. package/dist/breadcrumbs-BZ4wBC9-.d.ts +0 -25
  80. package/dist/breadcrumbs-BiBfNqBI.js +0 -63
  81. package/dist/cli-hduQ5XS1.js +0 -166
  82. package/dist/component-BU8BTbqz.js +0 -23
  83. package/dist/component-generics-Bw4ZOyEG.d.ts +0 -30
  84. package/dist/component-generics-D-WarFUb.d.ts +0 -30
  85. package/dist/component-generics-POFirVVb.js +0 -45
  86. package/dist/components-9NMl1791.js +0 -72
  87. package/dist/contexts-_NNW5yqC.js +0 -44
  88. package/dist/csharp-sn5CJu9t.js +0 -283
  89. package/dist/docs-Cu9Yl6-y.d.ts +0 -66
  90. package/dist/docs-YgoQ3bzY.js +0 -81
  91. package/dist/docs-xb5wYGjM.d.ts +0 -66
  92. package/dist/go-BoaAVmP0.js +0 -303
  93. package/dist/http-B3qTyMc3.js +0 -389
  94. package/dist/icons-BYKn5X8E.js +0 -885
  95. package/dist/index-BOmn7DHa.d.ts +0 -428
  96. package/dist/index-BvcPmB0r.d.ts +0 -428
  97. package/dist/java-BiLRuLuD.js +0 -403
  98. package/dist/languages-vUhD5Hu_.js +0 -30
  99. package/dist/markdown-BszOPZhh.d.ts +0 -22
  100. package/dist/markdown-Cq3XEhrR.js +0 -49
  101. package/dist/markdown-plMAoN22.d.ts +0 -22
  102. package/dist/method-C4PgTWAu.d.ts +0 -59
  103. package/dist/method-D6R_farj.d.ts +0 -59
  104. package/dist/method-DjzVBzZe.js +0 -96
  105. package/dist/navigation-HiZWRl34.d.ts +0 -29
  106. package/dist/navigation-MrP4Ubbg.d.ts +0 -29
  107. package/dist/navigation-aoYZ_tl4.js +0 -24
  108. package/dist/overview-CTeKhpQq.d.ts +0 -39
  109. package/dist/overview-Yf1PTJNi.d.ts +0 -39
  110. package/dist/overview-ocTARt-j.js +0 -138
  111. package/dist/primitives-CNG-fEhQ.js +0 -250
  112. package/dist/primitives-K7NijV36.d.ts +0 -105
  113. package/dist/primitives-WGxdBJDS.d.ts +0 -105
  114. package/dist/properties-Bu4nW9JD.d.ts +0 -54
  115. package/dist/properties-Bynmj9_H.d.ts +0 -54
  116. package/dist/properties-DQU0NBzb.js +0 -138
  117. package/dist/python-nqOBH7GS.js +0 -269
  118. package/dist/routing-C64k4fmX.js +0 -205
  119. package/dist/routing-pAL4V4hv.d.ts +0 -61
  120. package/dist/ruby-BBc8HdIt.js +0 -387
  121. package/dist/sdk-BSdgEEJw.js +0 -405
  122. package/dist/sdk-BVCk1ox2.d.ts +0 -122
  123. package/dist/sdk-Dm0S-XQE.d.ts +0 -122
  124. package/dist/sdk-sidebar-B1ehT_xI.d.ts +0 -15
  125. package/dist/sdk-sidebar-BDn8S1xS.js +0 -50
  126. package/dist/sdk-sidebar-Dqeu7C1-.d.ts +0 -15
  127. package/dist/snippets-CLpNVNlA.js +0 -181
  128. package/dist/stl-sidebar-BTTErIJs.d.ts +0 -58
  129. package/dist/stl-sidebar-C7GNALtk.d.ts +0 -58
  130. package/dist/stl-sidebar-DC5UOJiT.js +0 -106
  131. package/dist/style-DJIYkFhO.js +0 -178
  132. package/dist/terraform-DVx2ea2h.js +0 -243
  133. package/dist/typescript-Cmk-jBBw.js +0 -449
  134. package/dist/use-components-BUz3GbO4.js +0 -7
  135. package/dist/utils-DPbkW1Tz.js +0 -54
@@ -1,10 +1,406 @@
1
- import "../docs-YgoQ3bzY.js";
2
- import "../component-generics-POFirVVb.js";
3
- import "../navigation-aoYZ_tl4.js";
4
- import "../markdown-Cq3XEhrR.js";
5
- import "../contexts-_NNW5yqC.js";
6
- import "../use-components-BUz3GbO4.js";
7
- import "../icons-BYKn5X8E.js";
8
- import { _ as usePropertyModel, a as SDKDeclaration, c as SDKLanguageBlock, d as SDKMethodInfo, f as SDKMethodNotImplemented, g as SDKSnippetLanguages, h as SDKRequestTitle, i as SDKConstraints, l as SDKMethod, m as SDKReference, n as ReferenceNestingContext, o as SDKExample, p as SDKModel, r as SDKChildren, s as SDKIcon, t as PropertyModelContext, u as SDKMethodHeader, v as useReferenceNesting, y as useStreamingResponse } from "../sdk-BSdgEEJw.js";
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, 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";
9
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 SDKSnippetLanguages = {
25
+ "node.default": { name: "TypeScript" },
26
+ "typescript.default": { name: "TypeScript" },
27
+ "python.default": { name: "Python" },
28
+ "go.default": { name: "Go" },
29
+ "java.default": { name: "Java" },
30
+ "kotlin.default": { name: "Kotlin" },
31
+ "http.curl": { name: "cURL" },
32
+ "http.powershell": { name: "Powershell" },
33
+ "terraform.default": { name: "Terraform" },
34
+ "ruby.default": { name: "Ruby" },
35
+ "csharp.default": { name: "C#" },
36
+ "php.default": { name: "PHP" },
37
+ "cli.default": { name: "CLI tool" }
38
+ };
39
+ function SDKChildren({ paths, expand, depth }) {
40
+ const Docs = useComponents();
41
+ return /* @__PURE__ */ jsx("div", {
42
+ className: style_default.Properties,
43
+ children: paths.map((path, i) => /* @__PURE__ */ jsx(Docs.SDKDeclaration, {
44
+ path,
45
+ expand,
46
+ depth
47
+ }, i))
48
+ });
49
+ }
50
+ function normalizeDeclaration(raw, http) {
51
+ if (raw.kind === "JavaDeclProperty" && raw.type.kind === "JavaTypeString" && raw.constraints?.format === "binary") return {
52
+ ...raw,
53
+ type: {
54
+ kind: "JavaTypeReference",
55
+ typeName: "InputStream"
56
+ }
57
+ };
58
+ if (http?.kind === "HttpDeclProperty" && http.type.kind === "HttpTypeString" && http.constraints?.format === "binary") switch (raw.kind) {
59
+ case "CLISchemaProperty":
60
+ case "CLIFlag":
61
+ case "HttpDeclProperty": return {
62
+ ...raw,
63
+ type: {
64
+ kind: "HttpTypeBinary",
65
+ contentType: []
66
+ }
67
+ };
68
+ case "RubyDeclProperty": return {
69
+ ...raw,
70
+ type: {
71
+ kind: "RubyTypeBinary",
72
+ contentType: []
73
+ }
74
+ };
75
+ }
76
+ return raw;
77
+ }
78
+ function SDKDeclaration({ path, expand, depth = 0 }) {
79
+ const Lang = useLanguageComponents();
80
+ const Docs = useComponents();
81
+ const decl = normalizeDeclaration(useDeclaration(path, true), useDeclaration(path.replace(/ > \(schema\)$/, "") + " > (schema)", false, "http"));
82
+ const settings = useSettings();
83
+ const model = usePropertyModel();
84
+ const nesting = useReferenceNesting();
85
+ const { selectedPath } = useNavigation();
86
+ if (decl.kind.endsWith("Reference")) {
87
+ const refId = "type" in decl && decl.type !== void 0 && typeof decl.type !== "string" && "$ref" in decl.type ? decl.type["$ref"] : void 0;
88
+ if (refId && refId !== path && !nesting.includes(refId)) return /* @__PURE__ */ jsx(ReferenceNestingContext.Provider, {
89
+ value: [...nesting, refId],
90
+ children: /* @__PURE__ */ jsx(SDKDeclaration, {
91
+ path: refId,
92
+ expand,
93
+ depth
94
+ })
95
+ });
96
+ }
97
+ const parsedPath = selectedPath ? parseStainlessPath(selectedPath) : null;
98
+ const modelPropSetting = settings?.properties?.includeModelProperties;
99
+ const inlineModelProps = modelPropSetting === "method-page" ? Boolean(parsedPath?.method) : modelPropSetting !== false;
100
+ const isUnion = "childrenParentSchema" in decl && decl.childrenParentSchema && decl.kind !== "CLIFlag" && decl.kind !== "CLISchemaProperty" && ["enum", "union"].includes(decl.childrenParentSchema);
101
+ const id = model?.propertyPath ? `${model.propertyPath} + ${path}` : path;
102
+ const shouldExpand = selectedPath?.startsWith(path) && nesting.length < 1 || settings?.properties?.expandDepth && depth <= settings?.properties?.expandDepth && !isUnion || expand;
103
+ 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));
104
+ const content = /* @__PURE__ */ jsx(Lang.Property, {
105
+ decl,
106
+ children: ({ ...props }) => /* @__PURE__ */ jsx(Docs.Property, {
107
+ id,
108
+ expand: shouldExpand,
109
+ constraints: "constraints" in decl && decl.kind !== "CLIFlag" && decl.kind !== "CLISchemaProperty" && /* @__PURE__ */ jsx(Docs.SDKConstraints, { constraints: decl["constraints"] }),
110
+ declaration: /* @__PURE__ */ jsx(Lang.Declaration, { decl }),
111
+ title: "title" in decl ? decl.title : void 0,
112
+ description: "docstring" in decl ? decl["docstring"] : void 0,
113
+ deprecated: decl.deprecated,
114
+ ...props,
115
+ children: hasChildren && /* @__PURE__ */ jsxs(Fragment$1, { children: [isUnion && /* @__PURE__ */ jsx("div", {
116
+ className: style_default.PropertyAnnotation,
117
+ children: "Accepts one of the following:"
118
+ }), /* @__PURE__ */ jsx(Docs.SDKChildren, {
119
+ paths: decl.children ?? [],
120
+ depth: depth + 1
121
+ })] })
122
+ })
123
+ });
124
+ if ("modelPath" in decl) {
125
+ const value = {
126
+ modelPath: decl.modelPath,
127
+ propertyPath: decl.stainlessPath
128
+ };
129
+ return /* @__PURE__ */ jsx(PropertyModelContext.Provider, {
130
+ value,
131
+ children: content
132
+ });
133
+ }
134
+ return content;
135
+ }
136
+ function SDKConstraints({ constraints }) {
137
+ if (constraints) return /* @__PURE__ */ jsx("div", {
138
+ className: style_default.PropertyConstraints,
139
+ children: Object.entries(constraints).map(([name, value]) => name === "format" && value === "binary" ? null : /* @__PURE__ */ jsxs("div", {
140
+ className: style_default.PropertyConstraint,
141
+ children: [/* @__PURE__ */ jsx("span", {
142
+ className: style_default.PropertyConstraintName,
143
+ children: name
144
+ }), /* @__PURE__ */ jsx("span", {
145
+ className: style_default.PropertyConstraintValue,
146
+ children: value
147
+ })]
148
+ }, name))
149
+ });
150
+ }
151
+ const snippetIcons = {
152
+ "node.default": TypescriptIcon,
153
+ "typescript.default": TypescriptIcon,
154
+ "go.default": GoIcon,
155
+ "python.default": PythonIcon,
156
+ "terraform.default": TerraformIcon,
157
+ "http.curl": CurlIcon,
158
+ "http.powershell": PowershellIcon,
159
+ "ruby.default": RubyIcon,
160
+ "java.default": JavaIcon,
161
+ "kotlin.default": KotlinIcon,
162
+ "csharp.default": CSharpIcon,
163
+ "cli.default": CLIIcon,
164
+ "php.default": CSharpIcon
165
+ };
166
+ function SDKIcon({ language }) {
167
+ const LangIcon = snippetIcons[language];
168
+ if (!LangIcon) return null;
169
+ return /* @__PURE__ */ jsx(LangIcon, { className: clsx(style_default.Icon, language.split(".").shift()) });
170
+ }
171
+ function SDKRequestTitle({ snippetLanguage }) {
172
+ const languageName = SDKSnippetLanguages[snippetLanguage]?.name;
173
+ return /* @__PURE__ */ jsxs("span", {
174
+ className: style_default.SnippetRequestTitleLanguage,
175
+ children: [
176
+ /* @__PURE__ */ jsx(SDKIcon, { language: snippetLanguage }),
177
+ " ",
178
+ languageName
179
+ ]
180
+ });
181
+ }
182
+ function SDKExample({ method, transformRequestSnippet }) {
183
+ const Docs = useComponents();
184
+ const language = useLanguage();
185
+ const snippetLanguage = getLanguageSnippet(language);
186
+ if ((useSnippetIds(method.stainlessPath, language)?.filter((id) => id !== "default")?.length ?? 0) >= 2) return /* @__PURE__ */ jsx(Docs.MultiSnippets, {
187
+ requestTitle: /* @__PURE__ */ jsx(Docs.SDKRequestTitle, { snippetLanguage }),
188
+ method
189
+ });
190
+ return /* @__PURE__ */ jsx(Docs.Snippet, {
191
+ requestTitle: /* @__PURE__ */ jsx(Docs.SDKRequestTitle, { snippetLanguage }),
192
+ method,
193
+ transformRequestSnippet
194
+ });
195
+ }
196
+ function SDKMethodHeader({ method }) {
197
+ const Docs = useComponents();
198
+ const Lang = useLanguageComponents();
199
+ const decl = useDeclaration(method.stainlessPath, true);
200
+ return /* @__PURE__ */ jsx(Docs.MethodHeader, {
201
+ level: "h1",
202
+ title: method.summary || method.title,
203
+ signature: /* @__PURE__ */ jsx(Lang.MethodSignature, { decl }),
204
+ badges: method.deprecated && /* @__PURE__ */ jsx(Docs.Badge, {
205
+ id: "deprecated",
206
+ children: "Deprecated"
207
+ }),
208
+ children: /* @__PURE__ */ jsx(Docs.MethodRoute, {
209
+ httpMethod: method.httpMethod,
210
+ endpoint: method.endpoint.split(" ", 2).at(-1)
211
+ })
212
+ });
213
+ }
214
+ function useStreamingResponse(method) {
215
+ const tsDecl = useDeclaration(method.stainlessPath, false, "typescript");
216
+ if (tsDecl?.kind === "TSDeclFunction" && tsDecl.overloads) {
217
+ 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") {
218
+ const id = e.returns.typeParameters?.[0].$ref;
219
+ if (id) return id;
220
+ }
221
+ }
222
+ }
223
+ function SDKMethodInfo({ method }) {
224
+ const Docs = useComponents();
225
+ const Lang = useLanguageComponents();
226
+ const decl = useDeclaration(method.stainlessPath, true);
227
+ const streamingResponse = useStreamingResponse(method);
228
+ const spec = useSpec();
229
+ const language = useLanguage();
230
+ if (Lang.MethodInfo) return /* @__PURE__ */ jsx(Lang.MethodInfo, { decl });
231
+ function shouldExpand(items) {
232
+ if (items.length > 1) return false;
233
+ const item = items[0];
234
+ if (!item) return false;
235
+ const decl = spec?.decls?.[language]?.[item];
236
+ return decl && "children" in decl && decl.children && decl.children.length > 0;
237
+ }
238
+ const responseChildren = "responseChildren" in decl && decl.responseChildren && decl.responseChildren.length > 0 ? [...decl.responseChildren] : [];
239
+ if (streamingResponse) responseChildren.push(streamingResponse);
240
+ return /* @__PURE__ */ jsx(Docs.MethodInfo, {
241
+ parameters: "paramsChildren" in decl && Array.isArray(decl.paramsChildren) && decl.paramsChildren.length > 0 && /* @__PURE__ */ jsx(Docs.SDKChildren, {
242
+ expand: shouldExpand(decl.paramsChildren),
243
+ paths: decl.paramsChildren
244
+ }),
245
+ returns: responseChildren.length > 0 && /* @__PURE__ */ jsx(Docs.SDKChildren, {
246
+ expand: shouldExpand(responseChildren),
247
+ paths: responseChildren
248
+ })
249
+ });
250
+ }
251
+ function SDKMethodNotImplemented({ method }) {
252
+ const Docs = useComponents();
253
+ const languages = useAvailableLanguages(method?.stainlessPath);
254
+ const language = useLanguage();
255
+ const { basePath } = useNavigation();
256
+ const availableLanguageLinks = languages.flatMap((lang) => {
257
+ const url = generateRoute(basePath ?? "/", lang, method.stainlessPath);
258
+ return url ? [{
259
+ url,
260
+ label: LanguageNames[lang] ?? lang
261
+ }] : [];
262
+ });
263
+ return /* @__PURE__ */ jsxs("div", {
264
+ className: style_default.Method,
265
+ children: [/* @__PURE__ */ jsx(Docs.MethodHeader, {
266
+ level: "h1",
267
+ title: method.summary || method.title,
268
+ children: /* @__PURE__ */ jsx(Docs.MethodRoute, {
269
+ httpMethod: method.httpMethod,
270
+ endpoint: method.endpoint.split(" ", 2).at(-1)
271
+ })
272
+ }), /* @__PURE__ */ jsxs(Callout, {
273
+ variant: "warning",
274
+ children: [
275
+ "The method ",
276
+ /* @__PURE__ */ jsx("code", { children: method.name }),
277
+ " is not implemented in ",
278
+ LanguageNames[language] ?? language,
279
+ 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 }) => {
280
+ return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("a", {
281
+ href: url,
282
+ children: label
283
+ }) }, url);
284
+ }) })] }) : "."
285
+ ]
286
+ })]
287
+ });
288
+ }
289
+ function SDKMethod({ method, transformRequestSnippet }) {
290
+ const Docs = useComponents();
291
+ const decl = useDeclaration(method?.stainlessPath, false);
292
+ const layout = useContentPanelLayout();
293
+ const defaultResponses = useSnippetResponse(method.stainlessPath);
294
+ if (!decl) return /* @__PURE__ */ jsx(SDKMethodNotImplemented, { method });
295
+ return /* @__PURE__ */ jsxs(Docs.Method, {
296
+ id: method.stainlessPath,
297
+ header: /* @__PURE__ */ jsx(Docs.SDKMethodHeader, { method }),
298
+ className: clsx({
299
+ [style_default.MethodSinglePane]: layout === "single-pane",
300
+ [style_default.MethodDoublePane]: layout === "double-pane"
301
+ }),
302
+ children: [
303
+ /* @__PURE__ */ jsxs("div", {
304
+ className: style_default.MethodContentColumn,
305
+ children: [/* @__PURE__ */ jsx(Docs.MethodDescription, { description: method.description }), /* @__PURE__ */ jsx(Docs.SDKMethodInfo, { method })]
306
+ }),
307
+ /* @__PURE__ */ jsx("div", {
308
+ className: clsx(style_default.MethodExample, "not-content", "stl-ui-not-prose"),
309
+ children: /* @__PURE__ */ jsx(Docs.SDKExample, {
310
+ method,
311
+ transformRequestSnippet
312
+ })
313
+ }),
314
+ /* @__PURE__ */ jsxs("div", {
315
+ className: style_default.MethodResponseColumn,
316
+ children: [/* @__PURE__ */ jsx("h5", { children: "Returns Examples" }), /* @__PURE__ */ jsx(Docs.SnippetResponse, { responses: defaultResponses })]
317
+ })
318
+ ]
319
+ });
320
+ }
321
+ function SDKModel({ model }) {
322
+ const Docs = useComponents();
323
+ if (!useDeclaration(`${model.stainlessPath} > (schema)`, true)) return null;
324
+ return /* @__PURE__ */ jsx("div", {
325
+ className: style_default.Model,
326
+ tabIndex: 0,
327
+ children: /* @__PURE__ */ jsx("div", {
328
+ className: style_default.ResourceContentProperties,
329
+ children: /* @__PURE__ */ jsx(Docs.SDKDeclaration, { path: `${model.stainlessPath} > (schema)` })
330
+ })
331
+ });
332
+ }
333
+ function SDKReference({ stainlessPath, children }) {
334
+ const Docs = useComponents();
335
+ if (!stainlessPath || !stainlessPath.endsWith("(schema)")) return children;
336
+ return /* @__PURE__ */ jsx("span", {
337
+ className: style_default.TypeReference,
338
+ children: /* @__PURE__ */ jsx(Docs.Link, {
339
+ stainlessPath,
340
+ children
341
+ })
342
+ });
343
+ }
344
+ function SDKLanguageBlock({ language, version, install, links }) {
345
+ const Docs = useComponents();
346
+ const lang = `${language}.default`;
347
+ return /* @__PURE__ */ jsxs("div", {
348
+ className: style_default.LanguageBlock,
349
+ children: [
350
+ /* @__PURE__ */ jsxs("div", {
351
+ className: style_default.LanguageBlockContent,
352
+ children: [/* @__PURE__ */ jsx("div", {
353
+ className: style_default.LanguageBlockContentIcon,
354
+ children: /* @__PURE__ */ jsx(Docs.SDKIcon, {
355
+ language: lang,
356
+ size: 24
357
+ })
358
+ }), /* @__PURE__ */ jsxs("div", {
359
+ className: style_default.LanguageBlockContentInfo,
360
+ children: [/* @__PURE__ */ jsx("div", {
361
+ className: style_default.LanguageBlockContentInfoLanguage,
362
+ children: Docs.SDKSnippetLanguages[lang].name
363
+ }), /* @__PURE__ */ jsx("div", {
364
+ className: style_default.LanguageBlockContentInfoVersion,
365
+ children: version
366
+ })]
367
+ })]
368
+ }),
369
+ /* @__PURE__ */ jsxs("div", {
370
+ className: style_default.LanguageBlockInstall,
371
+ "data-stldocs-copy-parent": true,
372
+ children: [
373
+ /* @__PURE__ */ jsx("pre", {
374
+ "data-stldocs-copy-content": true,
375
+ children: install
376
+ }),
377
+ " ",
378
+ /* @__PURE__ */ jsx(Button, {
379
+ variant: "ghost",
380
+ size: "sm",
381
+ "data-stldocs-snippet-copy": true,
382
+ children: /* @__PURE__ */ jsx(Copy, {
383
+ size: 16,
384
+ className: style_default.Icon
385
+ })
386
+ })
387
+ ]
388
+ }),
389
+ /* @__PURE__ */ jsxs("div", {
390
+ className: style_default.LanguageBlockLinks,
391
+ children: [/* @__PURE__ */ jsx(Button, {
392
+ href: links.repo,
393
+ variant: "outline",
394
+ children: /* @__PURE__ */ jsx(Button.Icon, { icon: Github })
395
+ }), /* @__PURE__ */ jsxs(Button, {
396
+ href: links.docs,
397
+ variant: "outline",
398
+ children: [/* @__PURE__ */ jsx(Button.Icon, { icon: BookOpen }), /* @__PURE__ */ jsx(Button.Label, { children: "Read Docs" })]
399
+ })]
400
+ })
401
+ ]
402
+ });
403
+ }
404
+
405
+ //#endregion
10
406
  export { PropertyModelContext, ReferenceNestingContext, SDKChildren, SDKConstraints, SDKDeclaration, SDKExample, SDKIcon, SDKLanguageBlock, SDKMethod, SDKMethodHeader, SDKMethodInfo, SDKMethodNotImplemented, SDKModel, SDKReference, SDKRequestTitle, SDKSnippetLanguages, usePropertyModel, useReferenceNesting, useStreamingResponse };
@@ -1,14 +1,71 @@
1
- import "../primitives-WGxdBJDS.js";
2
- import "../breadcrumbs-46Qjx1Pd.js";
3
- import "../method-D6R_farj.js";
4
- import "../properties-Bu4nW9JD.js";
5
- import "../sdk-Dm0S-XQE.js";
6
- import { a as SnippetButtons, c as SnippetContainer, d as SnippetProps, f as SnippetRequestContainer, i as Snippet, l as SnippetContainerProps, m as SnippetResponse, n as MultiSnippets, o as SnippetCode, p as SnippetRequestContainerProps, r as MultiSnippetsProps, s as SnippetCodeProps, u as SnippetFooter } from "../index-BOmn7DHa.js";
7
- import "../navigation-HiZWRl34.js";
8
- import "../markdown-plMAoN22.js";
9
- import "../component-generics-Bw4ZOyEG.js";
10
- import "../docs-xb5wYGjM.js";
11
- import "../overview-CTeKhpQq.js";
12
- import "../sdk-sidebar-Dqeu7C1-.js";
13
- import "../stl-sidebar-BTTErIJs.js";
1
+ import { d as Method, o as HasStainlessPath } from "../index-PdnFhQF9.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
14
71
  export { MultiSnippets, MultiSnippetsProps, Snippet, SnippetButtons, SnippetCode, SnippetCodeProps, SnippetContainer, SnippetContainerProps, SnippetFooter, SnippetProps, SnippetRequestContainer, SnippetRequestContainerProps, SnippetResponse };