@stainless-api/docs-ui 0.1.0-beta.47 → 0.1.0-beta.49

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 (159) hide show
  1. package/dist/breadcrumbs-nSFZO5Gf.js +63 -0
  2. package/dist/component-DRO8kQSp.js +23 -0
  3. package/dist/{component-generics-F0_Dx7UT.js → component-generics-B6Fn47Mz.js} +1 -1
  4. package/dist/{component-generics-DrrwsjTH.d.ts → component-generics-COP53CRn.d.ts} +2 -2
  5. package/dist/component-generics-fyFHB6qA.d.ts +30 -0
  6. package/dist/components/MaskedInput.d.ts +1 -1
  7. package/dist/components/MaskedInput.js +1 -1
  8. package/dist/components/breadcrumbs.d.ts +1 -1
  9. package/dist/components/breadcrumbs.js +7 -13
  10. package/dist/components/icons.js +1 -1
  11. package/dist/components/index.d.ts +9 -10
  12. package/dist/components/index.js +16 -13
  13. package/dist/components/method.d.ts +1 -1
  14. package/dist/components/method.js +8 -13
  15. package/dist/components/overview.d.ts +1 -1
  16. package/dist/components/overview.js +9 -13
  17. package/dist/components/primitives.d.ts +1 -1
  18. package/dist/components/primitives.js +6 -13
  19. package/dist/components/properties.d.ts +1 -1
  20. package/dist/components/properties.js +7 -13
  21. package/dist/components/sdk.d.ts +1 -2
  22. package/dist/components/sdk.js +8 -13
  23. package/dist/components/sidebar.d.ts +1 -1
  24. package/dist/components/sidebar.js +9 -13
  25. package/dist/components/snippets.d.ts +2 -3
  26. package/dist/components/snippets.js +7 -13
  27. package/dist/components-D7M-BwNI.js +71 -0
  28. package/dist/contexts/component-generics.d.ts +1 -1
  29. package/dist/contexts/component-generics.js +1 -1
  30. package/dist/contexts/component-types.d.ts +10 -11
  31. package/dist/contexts/component.d.ts +13 -14
  32. package/dist/contexts/component.js +25 -13
  33. package/dist/contexts/docs.d.ts +1 -1
  34. package/dist/contexts/docs.js +1 -1
  35. package/dist/contexts/index.d.ts +16 -19
  36. package/dist/contexts/index.js +6 -14
  37. package/dist/contexts/markdown.d.ts +1 -1
  38. package/dist/contexts/markdown.js +2 -2
  39. package/dist/contexts/navigation.d.ts +1 -2
  40. package/dist/contexts/navigation.js +1 -1
  41. package/dist/contexts/use-components.d.ts +9 -10
  42. package/dist/contexts/use-components.js +2 -2
  43. package/dist/contexts-p3rRZDlM.js +39 -0
  44. package/dist/csharp-CDSxfCZE.js +283 -0
  45. package/dist/docs-yYrp-uzs.d.ts +47 -0
  46. package/dist/go-1c3S5ETL.js +303 -0
  47. package/dist/http-2QNWXH9t.js +330 -0
  48. package/dist/{index-CeFeLPGr.d.ts → index-BQpRynot.d.ts} +8 -8
  49. package/dist/index-CnilsjrJ.d.ts +274 -0
  50. package/dist/{index-CTSOZqei.d.ts → index-Ct0NcQUK.d.ts} +1 -1
  51. package/dist/{index-Bt01VI67.d.ts → index-D6NhcxHd.d.ts} +6 -7
  52. package/dist/index-LboM0f0c.d.ts +15 -0
  53. package/dist/index-avtZIGmX.d.ts +13 -0
  54. package/dist/index.d.ts +18 -20
  55. package/dist/index.js +27 -13
  56. package/dist/java-BbjF_oUI.js +403 -0
  57. package/dist/languages/csharp.d.ts +10 -11
  58. package/dist/languages/csharp.js +7 -13
  59. package/dist/languages/go.d.ts +10 -11
  60. package/dist/languages/go.js +7 -13
  61. package/dist/languages/http.d.ts +10 -11
  62. package/dist/languages/http.js +17 -13
  63. package/dist/languages/index.d.ts +10 -11
  64. package/dist/languages/index.js +24 -13
  65. package/dist/languages/java.d.ts +10 -11
  66. package/dist/languages/java.js +7 -13
  67. package/dist/languages/python.d.ts +10 -11
  68. package/dist/languages/python.js +7 -13
  69. package/dist/languages/ruby.d.ts +10 -11
  70. package/dist/languages/ruby.js +7 -13
  71. package/dist/languages/typescript.d.ts +10 -11
  72. package/dist/languages/typescript.js +7 -13
  73. package/dist/languages-BCYZjzuS.js +26 -0
  74. package/dist/markdown/index.d.ts +4 -4
  75. package/dist/markdown/index.js +103 -14
  76. package/dist/markdown/md.js +1 -1
  77. package/dist/markdown/printer.d.ts +2 -0
  78. package/dist/markdown/printer.js +28 -0
  79. package/dist/markdown/utils.d.ts +2 -3
  80. package/dist/markdown/utils.js +1 -1
  81. package/dist/{markdown-Bx-mQFEj.js → markdown-CxdeWgjV.js} +1 -1
  82. package/dist/markdown-DA2cRtlr.d.ts +22 -0
  83. package/dist/method-CE08mUME.js +115 -0
  84. package/dist/{navigation-Cg69h_9U.d.ts → navigation-BfAVGPgw.d.ts} +3 -3
  85. package/dist/navigation-CjBnMcop.d.ts +29 -0
  86. package/dist/overview-DeZSiqFa.d.ts +39 -0
  87. package/dist/overview-S2hUqPXA.js +139 -0
  88. package/dist/primitives-BIWfwN5L.js +258 -0
  89. package/dist/primitives-CbqXZ-5f.d.ts +97 -0
  90. package/dist/printer-DBw4S_Jn.d.ts +13 -0
  91. package/dist/printer-DVZVkqAr.d.ts +13 -0
  92. package/dist/printer-bNxiG6UB.js +74 -0
  93. package/dist/properties-jlGW3USi.js +131 -0
  94. package/dist/python-USOwFDv_.js +279 -0
  95. package/dist/routing-CMqh1cTZ.d.ts +54 -0
  96. package/dist/{routing-BGBmkDBL.js → routing-Wbb7YECB.js} +1 -1
  97. package/dist/routing.d.ts +1 -1
  98. package/dist/routing.js +1 -1
  99. package/dist/ruby-CSvGbSLe.js +387 -0
  100. package/dist/{sdk-Ck0IERc7.d.ts → sdk-BOwYR0k6.d.ts} +1 -1
  101. package/dist/sdk-CSCbbn3O.js +336 -0
  102. package/dist/sdk-CdhDsvo3.d.ts +118 -0
  103. package/dist/sidebar-CWyvCrJ0.js +81 -0
  104. package/dist/snippets-BQLXEIf6.js +161 -0
  105. package/dist/snippets-CbVFNmfq.d.ts +51 -0
  106. package/dist/{snippets-XTXit9Ya.d.ts → snippets-Wjo2dJNw.d.ts} +1 -1
  107. package/dist/spec.d.ts +3 -3
  108. package/dist/spec.js +2 -2
  109. package/dist/style.d.ts +1 -1
  110. package/dist/style.js +1 -1
  111. package/dist/styles/resets.css +2 -1
  112. package/dist/styles.css +1099 -1
  113. package/dist/typescript-DXG9psK3.js +449 -0
  114. package/dist/{use-components-BAHidYIO.js → use-components-RWQbviGq.js} +1 -1
  115. package/dist/{utils-CJElSUwc.d.ts → utils-CTGH5e8c.d.ts} +2 -2
  116. package/dist/utils-DNKOwa7D.d.ts +21 -0
  117. package/dist/{utils-0z34vxY4.js → utils-D_1AWSRX.js} +2 -2
  118. package/dist/utils.d.ts +1 -1
  119. package/dist/utils.js +1 -2
  120. package/package.json +6 -20
  121. package/dist/contexts/search.d.ts +0 -4
  122. package/dist/contexts/search.js +0 -15
  123. package/dist/contexts-D3ClFTt3.js +0 -4117
  124. package/dist/pagefind-BHm6c3fb.js +0 -15
  125. package/dist/search/index.d.ts +0 -26
  126. package/dist/search/index.js +0 -334
  127. package/dist/search/mcp.d.ts +0 -13
  128. package/dist/search/mcp.js +0 -45
  129. package/dist/search/providers/algolia.d.ts +0 -25
  130. package/dist/search/providers/algolia.js +0 -15
  131. package/dist/search/providers/fuse.d.ts +0 -18
  132. package/dist/search/providers/fuse.js +0 -30
  133. package/dist/search/providers/pagefind.d.ts +0 -7
  134. package/dist/search/providers/pagefind.js +0 -3
  135. package/dist/search/providers/walker.d.ts +0 -9
  136. package/dist/search/providers/walker.js +0 -34
  137. package/dist/search/types.d.ts +0 -3
  138. package/dist/search/types.js +0 -3
  139. package/dist/search-B9SJyFXg.d.ts +0 -21
  140. package/dist/types-D7Ipu1J2.d.ts +0 -91
  141. package/dist/types-mRzd9aqe.js +0 -35
  142. /package/dist/{breadcrumbs-Bg3nNgu9.d.ts → breadcrumbs-DEyC9k79.d.ts} +0 -0
  143. /package/dist/{chunk-BWfJHHBp.js → chunk-DRcLgZ1e.js} +0 -0
  144. /package/dist/{docs-DGpIHBGY.d.ts → docs-B8-nCRaa.d.ts} +0 -0
  145. /package/dist/{docs-CNvEp0VL.js → docs-CXqi26jB.js} +0 -0
  146. /package/dist/{icons-DzBceOQw.js → icons-Ckod9aod.js} +0 -0
  147. /package/dist/{markdown-COcowhve.d.ts → markdown-C8o8WrwG.d.ts} +0 -0
  148. /package/dist/{md-D5AxFoS4.js → md-oM2tUaCA.js} +0 -0
  149. /package/dist/{method-DI8ARQ3m.d.ts → method-B6eAtYl2.d.ts} +0 -0
  150. /package/dist/{navigation-bydkHNUW.js → navigation-C5TN0SgC.js} +0 -0
  151. /package/dist/{overview-Bv43Hf_w.d.ts → overview-CswoJHww.d.ts} +0 -0
  152. /package/dist/{primitives-Br-H_CYo.d.ts → primitives-Caj5rKBc.d.ts} +0 -0
  153. /package/dist/{properties-RPXKwEeY.d.ts → properties-BkUlpvU4.d.ts} +0 -0
  154. /package/dist/{routing-nN1nc0jx.d.ts → routing-Dhmv52Fd.d.ts} +0 -0
  155. /package/dist/{sidebar-b3y7VIbU.d.ts → sidebar-BXz93vSy.d.ts} +0 -0
  156. /package/dist/{style-D8hwSwrv.d.ts → style-D7RO5ymE.d.ts} +0 -0
  157. /package/dist/{style-0miv2y38.js → style-gnVEeXFj.js} +0 -0
  158. /package/dist/{utils-CiZXDoFR.js → utils-CqnL9Fc3.js} +0 -0
  159. /package/dist/{utils-BcWczffA.d.ts → utils-d8paVwKN.d.ts} +0 -0
@@ -0,0 +1,336 @@
1
+ import { a as useLanguage, l as useSpec, n as useContentPanelLayout, r as useDeclaration, s as useSettings } from "./docs-CXqi26jB.js";
2
+ import { n as useNavigation } from "./navigation-C5TN0SgC.js";
3
+ import { n as useLanguageComponents } from "./contexts-p3rRZDlM.js";
4
+ import { t as useComponents } from "./use-components-RWQbviGq.js";
5
+ import { t as style_default } from "./style-gnVEeXFj.js";
6
+ import { c as getLanguageSnippet, t as LanguageNames } from "./routing-Wbb7YECB.js";
7
+ import { a as KotlinIcon, c as RubyIcon, i as JavaIcon, l as TerraformIcon, n as CurlIcon, o as PowershellIcon, r as GoIcon, s as PythonIcon, t as CSharpIcon, u as TypescriptIcon } from "./icons-Ckod9aod.js";
8
+ import * as React$1 from "react";
9
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
10
+ import { BookOpen, Copy, Github } from "lucide-react";
11
+ import clsx from "clsx";
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
+ };
37
+ function SDKChildren({ paths, expand, depth }) {
38
+ const Docs = useComponents();
39
+ return /* @__PURE__ */ jsx("div", {
40
+ className: style_default.Properties,
41
+ children: paths.map((path, i) => /* @__PURE__ */ jsx(Docs.SDKDeclaration, {
42
+ path,
43
+ expand,
44
+ depth
45
+ }, i))
46
+ });
47
+ }
48
+ function SDKDeclaration({ path, expand, depth = 0 }) {
49
+ const Lang = useLanguageComponents();
50
+ const Docs = useComponents();
51
+ const decl = useDeclaration(path, true);
52
+ const settings = useSettings();
53
+ const model = usePropertyModel();
54
+ const nesting = useReferenceNesting();
55
+ const { selectedPath } = useNavigation();
56
+ if (decl.kind.endsWith("Reference")) {
57
+ const refId = "type" in decl && typeof decl.type !== "string" && "$ref" in decl.type ? decl.type["$ref"] : void 0;
58
+ if (refId && refId !== path && !nesting.includes(refId)) return /* @__PURE__ */ jsx(ReferenceNestingContext.Provider, {
59
+ value: [...nesting, refId],
60
+ children: /* @__PURE__ */ jsx(SDKDeclaration, {
61
+ path: refId,
62
+ expand,
63
+ depth
64
+ })
65
+ });
66
+ }
67
+ const isUnion = "childrenParentSchema" in decl && decl.childrenParentSchema && ["enum", "union"].includes(decl.childrenParentSchema);
68
+ const id = model?.propertyPath ? `${model.propertyPath} + ${path}` : path;
69
+ const shouldExpand = selectedPath?.startsWith(path) && nesting.length < 1 || settings?.properties?.expandDepth && depth <= settings?.properties?.expandDepth && !isUnion || expand;
70
+ const hasChildren = "children" in decl && (decl.children?.length ?? 0) > 0 && !decl.children?.includes(path) && !(isUnion && decl.childrenParentSchema === "enum" && decl.children?.length === 1) && (settings?.properties?.includeModelProperties !== false || !("modelPath" in decl));
71
+ const content = /* @__PURE__ */ jsx(Lang.Property, {
72
+ decl,
73
+ children: ({ ...props }) => /* @__PURE__ */ jsx(Docs.Property, {
74
+ id,
75
+ expand: shouldExpand,
76
+ constraints: "constraints" in decl && /* @__PURE__ */ jsx(Docs.SDKConstraints, { constraints: decl["constraints"] }),
77
+ declaration: /* @__PURE__ */ jsx(Lang.Declaration, { decl }),
78
+ title: "title" in decl ? decl.title : void 0,
79
+ description: "docstring" in decl ? decl["docstring"] : void 0,
80
+ deprecated: decl.deprecated,
81
+ ...props,
82
+ children: hasChildren && /* @__PURE__ */ jsxs(Fragment$1, { children: [isUnion && /* @__PURE__ */ jsx("div", {
83
+ className: style_default.PropertyAnnotation,
84
+ children: "Accepts one of the following:"
85
+ }), /* @__PURE__ */ jsx(Docs.SDKChildren, {
86
+ paths: decl.children ?? [],
87
+ depth: depth + 1
88
+ })] })
89
+ })
90
+ });
91
+ if ("modelPath" in decl) {
92
+ const value = {
93
+ modelPath: decl.modelPath,
94
+ propertyPath: decl.stainlessPath
95
+ };
96
+ return /* @__PURE__ */ jsx(PropertyModelContext.Provider, {
97
+ value,
98
+ children: content
99
+ });
100
+ }
101
+ return content;
102
+ }
103
+ function SDKConstraints({ constraints }) {
104
+ if (constraints) return /* @__PURE__ */ jsx("div", {
105
+ className: style_default.PropertyConstraints,
106
+ children: Object.entries(constraints).map(([name, value]) => /* @__PURE__ */ jsxs("div", {
107
+ className: style_default.PropertyConstraint,
108
+ children: [/* @__PURE__ */ jsx("span", {
109
+ className: style_default.PropertyConstraintName,
110
+ children: name
111
+ }), /* @__PURE__ */ jsx("span", {
112
+ className: style_default.PropertyConstraintValue,
113
+ children: value
114
+ })]
115
+ }, name))
116
+ });
117
+ }
118
+ const snippetIcons = {
119
+ "node.default": TypescriptIcon,
120
+ "typescript.default": TypescriptIcon,
121
+ "go.default": GoIcon,
122
+ "python.default": PythonIcon,
123
+ "terraform.default": TerraformIcon,
124
+ "http.curl": CurlIcon,
125
+ "http.powershell": PowershellIcon,
126
+ "ruby.default": RubyIcon,
127
+ "java.default": JavaIcon,
128
+ "kotlin.default": KotlinIcon,
129
+ "csharp.default": CSharpIcon,
130
+ "php.default": CSharpIcon
131
+ };
132
+ function SDKIcon({ language }) {
133
+ const LangIcon = snippetIcons[language];
134
+ if (!LangIcon) return null;
135
+ return /* @__PURE__ */ jsx(LangIcon, { className: clsx(style_default.Icon, language.split(".").shift()) });
136
+ }
137
+ function SDKRequestTitle({ snippetLanguage }) {
138
+ const languageName = SDKSnippetLanguages[snippetLanguage]?.name;
139
+ return /* @__PURE__ */ jsxs("span", {
140
+ className: style_default.SnippetRequestTitleLanguage,
141
+ children: [
142
+ /* @__PURE__ */ jsx(SDKIcon, { language: snippetLanguage }),
143
+ " ",
144
+ languageName
145
+ ]
146
+ });
147
+ }
148
+ function SDKExample({ method, transformRequestSnippet }) {
149
+ const Docs = useComponents();
150
+ const snippetLanguage = getLanguageSnippet(useLanguage());
151
+ return /* @__PURE__ */ jsx(Docs.Snippet, {
152
+ requestTitle: /* @__PURE__ */ jsx(Docs.SDKRequestTitle, { snippetLanguage }),
153
+ method,
154
+ transformRequestSnippet
155
+ });
156
+ }
157
+ function SDKMethodHeader({ method }) {
158
+ const Docs = useComponents();
159
+ const Lang = useLanguageComponents();
160
+ const decl = useDeclaration(method.stainlessPath, true);
161
+ return /* @__PURE__ */ jsx(Docs.MethodHeader, {
162
+ level: "h1",
163
+ title: method.summary ?? method.title,
164
+ signature: /* @__PURE__ */ jsx(Lang.MethodSignature, { decl }),
165
+ badges: method.deprecated && /* @__PURE__ */ jsx(Docs.Badge, {
166
+ id: "deprecated",
167
+ children: "Deprecated"
168
+ }),
169
+ children: /* @__PURE__ */ jsx(Docs.MethodRoute, {
170
+ httpMethod: method.httpMethod,
171
+ endpoint: method.endpoint.split(" ", 2).at(-1)
172
+ })
173
+ });
174
+ }
175
+ function SDKMethodInfo({ method }) {
176
+ const Docs = useComponents();
177
+ const Lang = useLanguageComponents();
178
+ const decl = useDeclaration(method.stainlessPath, true);
179
+ const spec = useSpec();
180
+ const language = useLanguage();
181
+ if (Lang.MethodInfo) return /* @__PURE__ */ jsx(Lang.MethodInfo, { decl });
182
+ function shouldExpand(items) {
183
+ if (items.length > 1) return false;
184
+ const item = items[0];
185
+ if (!item) return false;
186
+ const decl$1 = spec?.decls?.[language]?.[item];
187
+ return decl$1 && "children" in decl$1 && decl$1.children && decl$1.children.length > 0;
188
+ }
189
+ return /* @__PURE__ */ jsx(Docs.MethodInfo, {
190
+ parameters: "paramsChildren" in decl && Array.isArray(decl.paramsChildren) && decl.paramsChildren.length > 0 && /* @__PURE__ */ jsx(Docs.SDKChildren, {
191
+ expand: shouldExpand(decl.paramsChildren),
192
+ paths: decl.paramsChildren
193
+ }),
194
+ returns: "responseChildren" in decl && decl.responseChildren && decl.responseChildren.length > 0 && /* @__PURE__ */ jsx(Docs.SDKChildren, {
195
+ expand: shouldExpand(decl.responseChildren),
196
+ paths: decl.responseChildren
197
+ })
198
+ });
199
+ }
200
+ function SDKMethod({ method, transformRequestSnippet }) {
201
+ const Docs = useComponents();
202
+ const decl = useDeclaration(method?.stainlessPath, false);
203
+ const layout = useContentPanelLayout();
204
+ const language = useLanguage();
205
+ if (!decl) return /* @__PURE__ */ jsxs("div", {
206
+ className: style_default.Method,
207
+ children: [/* @__PURE__ */ jsx(Docs.MethodHeader, {
208
+ level: "h1",
209
+ title: method.summary ?? method.title,
210
+ children: /* @__PURE__ */ jsx(Docs.MethodRoute, {
211
+ httpMethod: method.httpMethod,
212
+ endpoint: method.endpoint.split(" ", 2).at(-1)
213
+ })
214
+ }), /* @__PURE__ */ jsxs(Callout, {
215
+ variant: "warning",
216
+ children: [
217
+ "The method ",
218
+ /* @__PURE__ */ jsx("code", { children: method.name }),
219
+ " is not implemented in ",
220
+ LanguageNames[language] ?? language,
221
+ "."
222
+ ]
223
+ })]
224
+ });
225
+ return /* @__PURE__ */ jsxs(Docs.Method, {
226
+ id: method.stainlessPath,
227
+ header: /* @__PURE__ */ jsx(Docs.SDKMethodHeader, { method }),
228
+ className: clsx({
229
+ [style_default.MethodSinglePane]: layout === "single-pane",
230
+ [style_default.MethodDoublePane]: layout === "double-pane"
231
+ }),
232
+ children: [
233
+ /* @__PURE__ */ jsxs("div", {
234
+ className: style_default.MethodContentColumn,
235
+ children: [/* @__PURE__ */ jsx(Docs.MethodDescription, { description: method.description }), /* @__PURE__ */ jsx(Docs.SDKMethodInfo, { method })]
236
+ }),
237
+ /* @__PURE__ */ jsx("div", {
238
+ className: clsx(style_default.MethodExample, "not-content", "stl-ui-not-prose"),
239
+ children: /* @__PURE__ */ jsx(Docs.SDKExample, {
240
+ method,
241
+ transformRequestSnippet
242
+ })
243
+ }),
244
+ /* @__PURE__ */ jsxs("div", {
245
+ className: style_default.MethodResponseColumn,
246
+ children: [/* @__PURE__ */ jsx("h5", { children: "Returns Examples" }), /* @__PURE__ */ jsx(Docs.SnippetResponse, { responses: method.exampleResponses })]
247
+ })
248
+ ]
249
+ });
250
+ }
251
+ function SDKModel({ model }) {
252
+ const Docs = useComponents();
253
+ if (!useDeclaration(`${model.stainlessPath} > (schema)`, true)) return null;
254
+ return /* @__PURE__ */ jsx("div", {
255
+ className: style_default.Model,
256
+ tabIndex: 0,
257
+ children: /* @__PURE__ */ jsx("div", {
258
+ className: style_default.ResourceContentProperties,
259
+ children: /* @__PURE__ */ jsx(Docs.SDKDeclaration, { path: `${model.stainlessPath} > (schema)` })
260
+ })
261
+ });
262
+ }
263
+ function SDKReference({ stainlessPath, children }) {
264
+ const Docs = useComponents();
265
+ if (!stainlessPath || !stainlessPath.endsWith("(schema)")) return children;
266
+ return /* @__PURE__ */ jsx("span", {
267
+ className: style_default.TypeReference,
268
+ children: /* @__PURE__ */ jsx(Docs.Link, {
269
+ stainlessPath,
270
+ children
271
+ })
272
+ });
273
+ }
274
+ function SDKLanguageBlock({ language, version, install, links }) {
275
+ const Docs = useComponents();
276
+ const lang = `${language}.default`;
277
+ return /* @__PURE__ */ jsxs("div", {
278
+ className: style_default.LanguageBlock,
279
+ children: [
280
+ /* @__PURE__ */ jsxs("div", {
281
+ className: style_default.LanguageBlockContent,
282
+ children: [/* @__PURE__ */ jsx("div", {
283
+ className: style_default.LanguageBlockContentIcon,
284
+ children: /* @__PURE__ */ jsx(Docs.SDKIcon, {
285
+ language: lang,
286
+ size: 24
287
+ })
288
+ }), /* @__PURE__ */ jsxs("div", {
289
+ className: style_default.LanguageBlockContentInfo,
290
+ children: [/* @__PURE__ */ jsx("div", {
291
+ className: style_default.LanguageBlockContentInfoLanguage,
292
+ children: Docs.SDKSnippetLanguages[lang].name
293
+ }), /* @__PURE__ */ jsx("div", {
294
+ className: style_default.LanguageBlockContentInfoVersion,
295
+ children: version
296
+ })]
297
+ })]
298
+ }),
299
+ /* @__PURE__ */ jsxs("div", {
300
+ className: style_default.LanguageBlockInstall,
301
+ "data-stldocs-copy-parent": true,
302
+ children: [
303
+ /* @__PURE__ */ jsx("pre", {
304
+ "data-stldocs-copy-content": true,
305
+ children: install
306
+ }),
307
+ " ",
308
+ /* @__PURE__ */ jsx(Button, {
309
+ variant: "ghost",
310
+ size: "sm",
311
+ "data-stldocs-snippet-copy": true,
312
+ children: /* @__PURE__ */ jsx(Copy, {
313
+ size: 16,
314
+ className: style_default.Icon
315
+ })
316
+ })
317
+ ]
318
+ }),
319
+ /* @__PURE__ */ jsxs("div", {
320
+ className: style_default.LanguageBlockLinks,
321
+ children: [/* @__PURE__ */ jsx(Button, {
322
+ href: links.repo,
323
+ variant: "outline",
324
+ children: /* @__PURE__ */ jsx(Button.Icon, { icon: Github })
325
+ }), /* @__PURE__ */ jsxs(Button, {
326
+ href: links.docs,
327
+ variant: "outline",
328
+ children: [/* @__PURE__ */ jsx(Button.Icon, { icon: BookOpen }), /* @__PURE__ */ jsx(Button.Label, { children: "Read Docs" })]
329
+ })]
330
+ })
331
+ ]
332
+ });
333
+ }
334
+
335
+ //#endregion
336
+ export { useReferenceNesting as _, SDKDeclaration as a, SDKLanguageBlock as c, SDKMethodInfo as d, SDKModel as f, usePropertyModel as g, SDKSnippetLanguages as h, SDKConstraints as i, SDKMethod as l, SDKRequestTitle as m, ReferenceNestingContext as n, SDKExample as o, SDKReference as p, SDKChildren as r, SDKIcon as s, PropertyModelContext as t, SDKMethodHeader as u };
@@ -0,0 +1,118 @@
1
+ import { t as DocsLanguage } from "./routing-Dhmv52Fd.js";
2
+ import * as React$1 from "react";
3
+ import * as react_jsx_runtime35 from "react/jsx-runtime";
4
+ import * as SDKJSON from "@stainless/sdk-json";
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<SDKJSON.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: SDKJSON.ID[];
29
+ expand?: boolean;
30
+ depth?: number;
31
+ };
32
+ declare function SDKChildren({
33
+ paths,
34
+ expand,
35
+ depth
36
+ }: SDKChildrenProps): react_jsx_runtime35.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_runtime35.JSX.Element;
47
+ type SDKConstraintsProps = {
48
+ constraints?: Record<string, any>;
49
+ };
50
+ declare function SDKConstraints({
51
+ constraints
52
+ }: SDKConstraintsProps): react_jsx_runtime35.JSX.Element | undefined;
53
+ type SDKIconProps = {
54
+ language: SDKJSON.SnippetLanguage;
55
+ size?: number;
56
+ };
57
+ declare function SDKIcon({
58
+ language
59
+ }: SDKIconProps): react_jsx_runtime35.JSX.Element | null;
60
+ type SDKRequestTitleProps = {
61
+ snippetLanguage: SDKJSON.SnippetLanguage;
62
+ };
63
+ declare function SDKRequestTitle({
64
+ snippetLanguage
65
+ }: SDKRequestTitleProps): react_jsx_runtime35.JSX.Element;
66
+ type SDKExampleProps = {
67
+ method: SDKJSON.Method;
68
+ transformRequestSnippet?: TransformRequestSnippetFn;
69
+ };
70
+ declare function SDKExample({
71
+ method,
72
+ transformRequestSnippet
73
+ }: SDKExampleProps): react_jsx_runtime35.JSX.Element;
74
+ type SDKMethodProps = {
75
+ method: SDKJSON.Method;
76
+ transformRequestSnippet?: TransformRequestSnippetFn;
77
+ };
78
+ declare function SDKMethodHeader({
79
+ method
80
+ }: SDKMethodProps): react_jsx_runtime35.JSX.Element;
81
+ declare function SDKMethodInfo({
82
+ method
83
+ }: SDKMethodProps): react_jsx_runtime35.JSX.Element;
84
+ declare function SDKMethod({
85
+ method,
86
+ transformRequestSnippet
87
+ }: SDKMethodProps): react_jsx_runtime35.JSX.Element;
88
+ type SDKModelProps = {
89
+ model: SDKJSON.Model;
90
+ };
91
+ declare function SDKModel({
92
+ model
93
+ }: SDKModelProps): react_jsx_runtime35.JSX.Element | null;
94
+ type SDKReferenceProps = {
95
+ stainlessPath: string;
96
+ children?: React$1.ReactNode;
97
+ };
98
+ declare function SDKReference({
99
+ stainlessPath,
100
+ children
101
+ }: SDKReferenceProps): string | number | bigint | boolean | react_jsx_runtime35.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;
102
+ type SDKLanguageBlockProps = {
103
+ language: DocsLanguage;
104
+ version: string;
105
+ install: string;
106
+ links: {
107
+ repo: string;
108
+ docs: string;
109
+ };
110
+ };
111
+ declare function SDKLanguageBlock({
112
+ language,
113
+ version,
114
+ install,
115
+ links
116
+ }: SDKLanguageBlockProps): react_jsx_runtime35.JSX.Element;
117
+ //#endregion
118
+ export { TransformRequestSnippetFn as C, SDKSnippetLanguagesType as S, useReferenceNesting as T, SDKModelProps as _, SDKChildren as a, SDKRequestTitleProps as b, SDKDeclaration as c, SDKLanguageBlock as d, SDKMethod as f, SDKModel as g, SDKMethodProps 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, SDKReference as v, usePropertyModel as w, SDKSnippetLanguages as x, SDKRequestTitle as y };
@@ -0,0 +1,81 @@
1
+ import { n as useNavigation } from "./navigation-C5TN0SgC.js";
2
+ import { t as useComponents } from "./use-components-RWQbviGq.js";
3
+ import { t as style_default } from "./style-gnVEeXFj.js";
4
+ import { o as MethodIconBadge } from "./method-CE08mUME.js";
5
+ import { r as isResourceEmpty } from "./utils-D_1AWSRX.js";
6
+ import "react";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ import { ChevronDown, ChevronRight } from "lucide-react";
9
+
10
+ //#region src/components/sidebar.tsx
11
+ function SidebarExpander({ open, summary, children }) {
12
+ return /* @__PURE__ */ jsxs("details", {
13
+ className: style_default.SidebarExpander,
14
+ open,
15
+ children: [/* @__PURE__ */ jsxs("summary", {
16
+ className: style_default.ExpanderSummary,
17
+ children: [/* @__PURE__ */ jsx("div", {
18
+ className: style_default.ExpanderSummaryContent,
19
+ children: summary
20
+ }), /* @__PURE__ */ jsxs("div", {
21
+ className: style_default.ExpanderSummaryIcon,
22
+ children: [/* @__PURE__ */ jsx(ChevronRight, {
23
+ size: 16,
24
+ strokeWidth: 1,
25
+ className: style_default.Icon
26
+ }), /* @__PURE__ */ jsx(ChevronDown, {
27
+ size: 16,
28
+ strokeWidth: 1,
29
+ className: style_default.Icon
30
+ })]
31
+ })]
32
+ }), /* @__PURE__ */ jsx("div", {
33
+ className: style_default.ExpanderContent,
34
+ children
35
+ })]
36
+ });
37
+ }
38
+ function SidebarMethod({ method }) {
39
+ const Docs = useComponents();
40
+ const { selectedPath } = useNavigation();
41
+ return /* @__PURE__ */ jsxs("div", {
42
+ className: style_default.SidebarMethod,
43
+ "data-selected": method.stainlessPath === selectedPath,
44
+ children: [/* @__PURE__ */ jsx(MethodIconBadge, { httpMethod: method.httpMethod }), /* @__PURE__ */ jsx(Docs.Link, {
45
+ stainlessPath: method.stainlessPath,
46
+ children: method.summary
47
+ })]
48
+ });
49
+ }
50
+ function SidebarResource({ resource }) {
51
+ const Docs = useComponents();
52
+ const { selectedPath } = useNavigation();
53
+ const subresources = Object.values(resource.subresources ?? {}).map((sub) => /* @__PURE__ */ jsx(SidebarResource, { resource: sub }, sub.stainlessPath));
54
+ const methods = Object.values(resource.methods).map((method) => /* @__PURE__ */ jsx(SidebarMethod, { method }, method.stainlessPath));
55
+ const hasChildren = subresources.length > 0 || methods.length > 0;
56
+ const title = /* @__PURE__ */ jsx("div", {
57
+ className: style_default.SidebarResourceTitle,
58
+ children: /* @__PURE__ */ jsx(Docs.Link, {
59
+ stainlessPath: resource.stainlessPath,
60
+ children: resource.title
61
+ })
62
+ });
63
+ return /* @__PURE__ */ jsx("div", {
64
+ className: style_default.SidebarResource,
65
+ "data-selected": resource.stainlessPath === selectedPath,
66
+ children: hasChildren ? /* @__PURE__ */ jsxs(SidebarExpander, {
67
+ summary: title,
68
+ open: true,
69
+ children: [methods, subresources]
70
+ }) : title
71
+ });
72
+ }
73
+ function Sidebar({ resources }) {
74
+ return /* @__PURE__ */ jsx("div", {
75
+ className: `${style_default.Root} ${style_default.Sidebar}`,
76
+ children: resources.filter((resource) => !isResourceEmpty(resource)).map((resource) => /* @__PURE__ */ jsx(SidebarResource, { resource }, resource.stainlessPath))
77
+ });
78
+ }
79
+
80
+ //#endregion
81
+ export { SidebarResource as i, SidebarExpander as n, SidebarMethod as r, Sidebar as t };
@@ -0,0 +1,161 @@
1
+ import { a as useLanguage, c as useSnippet, r as useDeclaration } from "./docs-CXqi26jB.js";
2
+ import { r as useHighlight } from "./markdown-CxdeWgjV.js";
3
+ import { t as useComponents } from "./use-components-RWQbviGq.js";
4
+ import { t as style_default } from "./style-gnVEeXFj.js";
5
+ import * as React$1 from "react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { CheckIcon, CircleAlertIcon, CopyIcon } from "lucide-react";
8
+ import clsx from "clsx";
9
+ import { Button } from "@stainless-api/ui-primitives";
10
+
11
+ //#region src/components/snippets.tsx
12
+ function SnippetCode({ content, language }) {
13
+ const lang = useLanguage();
14
+ const highlighted = useHighlight(content, language || lang);
15
+ return /* @__PURE__ */ jsx("div", {
16
+ className: style_default.SnippetCode,
17
+ children: /* @__PURE__ */ jsx("pre", {
18
+ className: style_default.SnippetCodeContent,
19
+ "data-stldocs-copy-content": true,
20
+ children: /* @__PURE__ */ jsx("code", {
21
+ className: language === "json" ? "snippet-json" : "snippet",
22
+ dangerouslySetInnerHTML: { __html: highlighted }
23
+ })
24
+ })
25
+ });
26
+ }
27
+ function SnippetContainer({ children }) {
28
+ return /* @__PURE__ */ jsx("div", {
29
+ className: clsx(style_default.Snippet),
30
+ children
31
+ });
32
+ }
33
+ function SnippetRequestContainer({ children }) {
34
+ return /* @__PURE__ */ jsx("div", { children });
35
+ }
36
+ function Snippet({ requestTitle, method, transformRequestSnippet }) {
37
+ const Docs = useComponents();
38
+ const language = useLanguage();
39
+ const originalSnippet = useSnippet(method.stainlessPath, void 0, language === "http" ? "curl" : "default");
40
+ const decl = useDeclaration(method.stainlessPath, false);
41
+ if (!originalSnippet) {
42
+ console.warn(`Snippet not found for method '${method.stainlessPath}'`);
43
+ return null;
44
+ }
45
+ const signature = decl && "qualified" in decl ? decl.qualified : void 0;
46
+ const responses = method.exampleResponses;
47
+ const snippet = transformRequestSnippet ? transformRequestSnippet({
48
+ snippet: originalSnippet,
49
+ language
50
+ }) : originalSnippet;
51
+ return /* @__PURE__ */ jsxs(Docs.SnippetContainer, {
52
+ signature,
53
+ children: [snippet && /* @__PURE__ */ jsx(Docs.SnippetRequestContainer, {
54
+ signature,
55
+ children: /* @__PURE__ */ jsxs("div", {
56
+ className: style_default.SnippetRequest,
57
+ "data-stldocs-copy-parent": true,
58
+ children: [/* @__PURE__ */ jsxs("div", {
59
+ className: style_default.SnippetRequestTitle,
60
+ children: [
61
+ /* @__PURE__ */ jsxs("div", {
62
+ className: style_default.SnippetRequestTitleMethod,
63
+ children: [/* @__PURE__ */ jsx(Docs.MethodRoute, {
64
+ httpMethod: method.httpMethod,
65
+ iconOnly: true
66
+ }), /* @__PURE__ */ jsx("h5", { children: method.summary ?? method.title })]
67
+ }),
68
+ /* @__PURE__ */ jsx("div", {
69
+ className: style_default.SnippetRequestTitleContent,
70
+ children: requestTitle
71
+ }),
72
+ /* @__PURE__ */ jsx(Docs.SnippetButtons, { content: snippet })
73
+ ]
74
+ }), /* @__PURE__ */ jsx(Docs.SnippetCode, {
75
+ content: snippet,
76
+ signature
77
+ })]
78
+ })
79
+ }), responses && /* @__PURE__ */ jsx(Docs.SnippetResponse, { responses })]
80
+ });
81
+ }
82
+ function SnippetButtons({ content }) {
83
+ const [CopyButtonIcon, setCopyIcon] = React$1.useState(CopyIcon);
84
+ async function handleCopy() {
85
+ try {
86
+ await navigator.clipboard.writeText(content);
87
+ setCopyIcon(CheckIcon);
88
+ } catch {
89
+ setCopyIcon(CircleAlertIcon);
90
+ }
91
+ setTimeout(() => setCopyIcon(CopyIcon), 1e3);
92
+ }
93
+ return /* @__PURE__ */ jsx(Button, {
94
+ variant: "ghost",
95
+ "data-stldocs-snippet-copy": true,
96
+ children: /* @__PURE__ */ jsx(CopyButtonIcon, {
97
+ size: 16,
98
+ className: style_default.Icon,
99
+ onClick: handleCopy
100
+ })
101
+ });
102
+ }
103
+ function SnippetResponse({ responses }) {
104
+ const { SnippetCode: SnippetCode$1 } = useComponents();
105
+ if (!responses) return null;
106
+ const mappedResponses = Object.keys(responses).map((key) => {
107
+ const responseContent = responses[key];
108
+ if (!responseContent) return null;
109
+ const responseType = Object.keys(responseContent)[0];
110
+ if (!responseType) return null;
111
+ const response = responseContent[responseType];
112
+ if (!response) return null;
113
+ const examples = response?.examples;
114
+ if (!examples) return null;
115
+ const exampleType = Object.keys(examples)[0];
116
+ if (!exampleType) return null;
117
+ let value = examples[exampleType]?.value;
118
+ if (!value) return null;
119
+ let language = "none";
120
+ if (responseType === "application/json" || typeof value === "object") {
121
+ language = "json";
122
+ value = JSON.stringify(value, null, 2);
123
+ }
124
+ return {
125
+ language,
126
+ responseCode: key,
127
+ content: value
128
+ };
129
+ }).filter(Boolean);
130
+ if (mappedResponses.length === 0) return null;
131
+ return /* @__PURE__ */ jsx("div", {
132
+ className: style_default.SnippetMultiResponse,
133
+ children: /* @__PURE__ */ jsxs("div", {
134
+ className: clsx(style_default.Snippet),
135
+ children: [/* @__PURE__ */ jsx("div", {
136
+ className: clsx(style_default.SnippetResponseTab, mappedResponses.length === 1 && style_default.SnippetResponseTabSingleReturn),
137
+ children: mappedResponses.map(({ responseCode }, index) => /* @__PURE__ */ jsx("div", {
138
+ "data-snippet-response-tab-id": `snippet-response-tab-${responseCode}-${index}`,
139
+ className: clsx(style_default.SnippetResponseTabItem, index === 0 && style_default.SnippetResponseTabItemActive),
140
+ children: /* @__PURE__ */ jsxs(Button, {
141
+ disabled: mappedResponses.length === 1,
142
+ variant: "ghost",
143
+ children: [responseCode, " example"]
144
+ })
145
+ }, `snippet-response-tab-item-${responseCode}-${index}`))
146
+ }), mappedResponses.map(({ responseCode, content, language }, index) => {
147
+ return /* @__PURE__ */ jsx("div", {
148
+ className: clsx(style_default.SnippetResponsePane, index === 0 && style_default.SnippetResponsePaneActive),
149
+ "data-snippet-response-pane-id": `snippet-response-tab-${responseCode}-${index}`,
150
+ children: /* @__PURE__ */ jsx(SnippetCode$1, {
151
+ content,
152
+ language
153
+ })
154
+ }, `snippet-response-${responseCode}-${index}`);
155
+ })]
156
+ })
157
+ });
158
+ }
159
+
160
+ //#endregion
161
+ export { SnippetRequestContainer as a, SnippetContainer as i, SnippetButtons as n, SnippetResponse as o, SnippetCode as r, Snippet as t };