@stainless-api/docs-ui 0.1.0-beta.9 → 0.1.0-beta.90

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