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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (215) hide show
  1. package/dist/breadcrumbs-BhYwbXkc.d.ts +25 -0
  2. package/dist/breadcrumbs-Cvm5Ifm7.d.ts +25 -0
  3. package/dist/breadcrumbs-DA4WgDhR.js +63 -0
  4. package/dist/chunk-BN_g-Awi.js +18 -0
  5. package/dist/cli-F3kMmeoJ.js +166 -0
  6. package/dist/component-P9sn5yyG.js +23 -0
  7. package/dist/component-generics-ByGsYTc8.d.ts +30 -0
  8. package/dist/component-generics-POFirVVb.js +45 -0
  9. package/dist/component-generics-zU0Pqx8m.d.ts +30 -0
  10. package/dist/components/MaskedInput.d.ts +14 -0
  11. package/dist/components/MaskedInput.js +76 -0
  12. package/dist/components/breadcrumbs.d.ts +2 -0
  13. package/dist/components/breadcrumbs.js +9 -0
  14. package/dist/components/icons.d.ts +60 -0
  15. package/dist/components/icons.js +3 -0
  16. package/dist/components/index.d.ts +11 -0
  17. package/dist/components/index.js +19 -0
  18. package/dist/components/method.d.ts +2 -0
  19. package/dist/components/method.js +10 -0
  20. package/dist/components/overview.d.ts +2 -0
  21. package/dist/components/overview.js +11 -0
  22. package/dist/components/primitives.d.ts +2 -0
  23. package/dist/components/primitives.js +8 -0
  24. package/dist/components/properties.d.ts +2 -0
  25. package/dist/components/properties.js +9 -0
  26. package/dist/components/sdk-sidebar.d.ts +2 -0
  27. package/dist/components/sdk-sidebar.js +10 -0
  28. package/dist/components/sdk.d.ts +2 -0
  29. package/dist/components/sdk.js +10 -0
  30. package/dist/components/snippets.d.ts +3 -0
  31. package/dist/components/snippets.js +9 -0
  32. package/dist/components/stl-sidebar.d.ts +2 -0
  33. package/dist/components/stl-sidebar.js +5 -0
  34. package/dist/components-w1JmIrB0.js +71 -0
  35. package/dist/contexts/component-generics.d.ts +2 -0
  36. package/dist/contexts/component-generics.js +3 -0
  37. package/dist/contexts/component-types.d.ts +17 -0
  38. package/dist/contexts/component-types.js +0 -0
  39. package/dist/contexts/component.d.ts +30 -0
  40. package/dist/contexts/component.js +30 -0
  41. package/dist/contexts/docs.d.ts +2 -0
  42. package/dist/contexts/docs.js +3 -0
  43. package/dist/contexts/index.d.ts +23 -0
  44. package/dist/contexts/index.js +7 -0
  45. package/dist/contexts/markdown.d.ts +2 -0
  46. package/dist/contexts/markdown.js +4 -0
  47. package/dist/contexts/navigation.d.ts +2 -0
  48. package/dist/contexts/navigation.js +3 -0
  49. package/dist/contexts/use-components.d.ts +15 -0
  50. package/dist/contexts/use-components.js +4 -0
  51. package/dist/contexts-CVj20VV4.js +41 -0
  52. package/dist/csharp-D6_jlynY.js +283 -0
  53. package/dist/docs-BmOB2f-I.js +61 -0
  54. package/dist/docs-g4IPmtZr.d.ts +48 -0
  55. package/dist/docs-z3fl2eW-.d.ts +48 -0
  56. package/dist/go-COaHV3Hc.js +303 -0
  57. package/dist/http-fOPCX17A.js +389 -0
  58. package/dist/icons-BYKn5X8E.js +885 -0
  59. package/dist/index-B8Zys1C2.d.ts +347 -0
  60. package/dist/index-C5Zmb2CI.d.ts +16 -0
  61. package/dist/index-CwjGm9zX.d.ts +1722 -0
  62. package/dist/index-D7PkxNgB.d.ts +16 -0
  63. package/dist/index-DIaM6Ync.d.ts +347 -0
  64. package/dist/index.d.ts +20 -0
  65. package/dist/index.js +32 -7542
  66. package/dist/java-CxGSJVvv.js +403 -0
  67. package/dist/languages/cli.d.ts +12 -0
  68. package/dist/languages/cli.js +21 -0
  69. package/dist/languages/csharp.d.ts +12 -0
  70. package/dist/languages/csharp.js +9 -0
  71. package/dist/languages/go.d.ts +12 -0
  72. package/dist/languages/go.js +9 -0
  73. package/dist/languages/http.d.ts +12 -0
  74. package/dist/languages/http.js +20 -0
  75. package/dist/languages/index.d.ts +12 -0
  76. package/dist/languages/index.js +29 -0
  77. package/dist/languages/java.d.ts +12 -0
  78. package/dist/languages/java.js +9 -0
  79. package/dist/languages/python.d.ts +12 -0
  80. package/dist/languages/python.js +9 -0
  81. package/dist/languages/ruby.d.ts +12 -0
  82. package/dist/languages/ruby.js +9 -0
  83. package/dist/languages/terraform.d.ts +12 -0
  84. package/dist/languages/terraform.js +9 -0
  85. package/dist/languages/typescript.d.ts +12 -0
  86. package/dist/languages/typescript.js +9 -0
  87. package/dist/languages-B6eap2M6.js +30 -0
  88. package/dist/markdown/index.d.ts +12 -0
  89. package/dist/markdown/index.js +107 -0
  90. package/dist/markdown/md.d.ts +15 -0
  91. package/dist/markdown/md.js +41 -0
  92. package/dist/markdown/printer.d.ts +13 -0
  93. package/dist/markdown/printer.js +100 -0
  94. package/dist/markdown/utils.d.ts +21 -0
  95. package/dist/markdown/utils.js +31 -0
  96. package/dist/markdown-CTKHMLVr.js +49 -0
  97. package/dist/markdown-Cdh0TSHp.d.ts +22 -0
  98. package/dist/markdown-Cibv9fDR.d.ts +22 -0
  99. package/dist/method-630cPKDl.d.ts +59 -0
  100. package/dist/method-BPDUyBlD.js +96 -0
  101. package/dist/method-BzkPRXGL.d.ts +59 -0
  102. package/dist/navigation-BW-SBvb4.d.ts +29 -0
  103. package/dist/navigation-DWYqC_HX.d.ts +29 -0
  104. package/dist/navigation-aoYZ_tl4.js +24 -0
  105. package/dist/overview-Cui1XtuC.d.ts +39 -0
  106. package/dist/overview-DFwfIK6k.js +138 -0
  107. package/dist/overview-RXc9iPzz.d.ts +39 -0
  108. package/dist/primitives-DJEqe_r1.js +250 -0
  109. package/dist/primitives-DhGxFYx6.d.ts +105 -0
  110. package/dist/primitives-MsH-h0bU.d.ts +105 -0
  111. package/dist/properties-BnbBKd5a.js +132 -0
  112. package/dist/properties-Bynmj9_H.d.ts +54 -0
  113. package/dist/properties-C9W4QJ_F.d.ts +54 -0
  114. package/dist/python-DsTuWCKE.js +269 -0
  115. package/dist/routing-C64k4fmX.js +205 -0
  116. package/dist/routing-Cm_9XJiQ.d.ts +61 -0
  117. package/dist/routing-utiR5mY3.d.ts +61 -0
  118. package/dist/routing.d.ts +2 -0
  119. package/dist/routing.js +3 -180
  120. package/dist/ruby-BncKp6hd.js +387 -0
  121. package/dist/sdk-BvZeXpsj.d.ts +122 -0
  122. package/dist/sdk-Bw99eXxA.js +399 -0
  123. package/dist/sdk-GMOw94wL.d.ts +122 -0
  124. package/dist/sdk-sidebar-NCBSWuUW.d.ts +15 -0
  125. package/dist/sdk-sidebar-VNY2-O1Y.d.ts +15 -0
  126. package/dist/sdk-sidebar-V_MTkVw8.js +50 -0
  127. package/dist/snippets-BehbU3rt.js +164 -0
  128. package/dist/snippets-Bj7Ey56K.d.ts +53 -0
  129. package/dist/snippets-CQQSDvg2.d.ts +53 -0
  130. package/dist/spec.d.ts +65 -0
  131. package/dist/spec.js +167 -0
  132. package/dist/stl-sidebar-CXzs_shz.d.ts +58 -0
  133. package/dist/stl-sidebar-DSkUHwcU.d.ts +58 -0
  134. package/dist/stl-sidebar-WtimNrk1.js +106 -0
  135. package/dist/style-HpXpcJ9v.js +172 -0
  136. package/dist/style.d.ts +171 -0
  137. package/dist/style.js +3 -0
  138. package/dist/styles/main.css +744 -754
  139. package/dist/styles/main.js +0 -0
  140. package/dist/styles/primitives.css +327 -458
  141. package/dist/styles/primitives.js +0 -0
  142. package/dist/styles/resets.css +32 -41
  143. package/dist/styles/resets.js +0 -0
  144. package/dist/styles/search.css +192 -270
  145. package/dist/styles/search.js +0 -0
  146. package/dist/styles/sidebar.css +170 -69
  147. package/dist/styles/sidebar.js +0 -0
  148. package/dist/styles/variables.css +26 -89
  149. package/dist/styles/variables.js +0 -0
  150. package/dist/styles.css +3273 -0
  151. package/dist/styles.mjs +1 -0
  152. package/dist/terraform-B95X4rNK.js +243 -0
  153. package/dist/typescript-n46M9OtL.js +449 -0
  154. package/dist/use-components-BUz3GbO4.js +7 -0
  155. package/dist/utils-DPbkW1Tz.js +54 -0
  156. package/dist/utils.d.ts +20 -0
  157. package/dist/utils.js +3 -0
  158. package/package.json +74 -22
  159. package/dist/mcp.js +0 -16003
  160. package/dist/styles/snippets.css +0 -132
  161. package/src/components/breadcrumbs.tsx +0 -94
  162. package/src/components/chat.tsx +0 -154
  163. package/src/components/dropdown.tsx +0 -91
  164. package/src/components/icons.tsx +0 -584
  165. package/src/components/index.ts +0 -9
  166. package/src/components/method.tsx +0 -144
  167. package/src/components/overview.tsx +0 -159
  168. package/src/components/primitives.tsx +0 -284
  169. package/src/components/properties.tsx +0 -130
  170. package/src/components/scripts/dropdown.ts +0 -78
  171. package/src/components/sdk.tsx +0 -402
  172. package/src/components/sidebar.tsx +0 -99
  173. package/src/components/snippets.tsx +0 -179
  174. package/src/contexts/component-generics.tsx +0 -48
  175. package/src/contexts/component-types.tsx +0 -5
  176. package/src/contexts/component.tsx +0 -32
  177. package/src/contexts/docs.tsx +0 -75
  178. package/src/contexts/index.tsx +0 -17
  179. package/src/contexts/markdown.tsx +0 -43
  180. package/src/contexts/navigation.tsx +0 -44
  181. package/src/contexts/search.tsx +0 -28
  182. package/src/contexts/use-components.tsx +0 -4
  183. package/src/index.ts +0 -6
  184. package/src/languages/go.tsx +0 -281
  185. package/src/languages/http.tsx +0 -321
  186. package/src/languages/index.ts +0 -26
  187. package/src/languages/java.tsx +0 -358
  188. package/src/languages/python.tsx +0 -255
  189. package/src/languages/ruby.tsx +0 -320
  190. package/src/languages/typescript.tsx +0 -393
  191. package/src/markdown/index.ts +0 -107
  192. package/src/markdown/md.ts +0 -45
  193. package/src/markdown/utils.ts +0 -49
  194. package/src/routing.ts +0 -238
  195. package/src/search/form.tsx +0 -127
  196. package/src/search/index.tsx +0 -1
  197. package/src/search/indexer.ts +0 -246
  198. package/src/search/mcp.ts +0 -61
  199. package/src/search/printer.tsx +0 -86
  200. package/src/search/providers/algolia.ts +0 -88
  201. package/src/search/providers/fuse.ts +0 -19
  202. package/src/search/providers/pagefind.ts +0 -17
  203. package/src/search/providers/walker.ts +0 -30
  204. package/src/search/results.tsx +0 -181
  205. package/src/search/state.ts +0 -64
  206. package/src/search/types.ts +0 -116
  207. package/src/style.ts +0 -197
  208. package/src/styles/main.css +0 -993
  209. package/src/styles/primitives.css +0 -572
  210. package/src/styles/resets.css +0 -47
  211. package/src/styles/search.css +0 -342
  212. package/src/styles/sidebar.css +0 -87
  213. package/src/styles/snippets.css +0 -132
  214. package/src/styles/variables.css +0 -90
  215. package/src/utils.ts +0 -41
package/dist/routing.js CHANGED
@@ -1,180 +1,3 @@
1
- // src/routing.ts
2
- var Languages = [
3
- "http",
4
- "node",
5
- "python",
6
- "go",
7
- "typescript",
8
- "terraform",
9
- "ruby",
10
- "java",
11
- "kotlin"
12
- ];
13
- var SupportedLanguageSyntaxes = [
14
- "http",
15
- "javascript",
16
- "python",
17
- "go",
18
- "typescript",
19
- "terraform",
20
- "ruby",
21
- "java",
22
- "kotlin"
23
- ];
24
- var LanguageNames = {
25
- http: "HTTP",
26
- node: "TypeScript",
27
- typescript: "TypeScript",
28
- python: "Python",
29
- go: "Go",
30
- ruby: "Ruby",
31
- java: "Java",
32
- kotlin: "Kotlin",
33
- terraform: "Terraform"
34
- };
35
- function getLanguageSnippet(language) {
36
- return language === "http" ? "http.curl" : `${language}.default`;
37
- }
38
- function isSupportedLanguage(language) {
39
- return Languages.includes(language);
40
- }
41
- var DefaultLanguage = "http";
42
- var StainlessPathPattern = /(\(resource\) (?<resource>[^\s]+))( > (\(method\) (?<method>[^\s]+)|\(model\) (?<model>[^\s]+))?)?/;
43
- function parseStainlessPath(stainlessPath) {
44
- const match = stainlessPath.match(StainlessPathPattern);
45
- if (!match) return null;
46
- return {
47
- resource: match.groups.resource.split("."),
48
- method: match.groups.method ?? null,
49
- model: match.groups.model ?? null,
50
- routable: match.groups.model ? match[1] : match[0]
51
- };
52
- }
53
- function trimStainlessPath(stainlessPath) {
54
- return stainlessPath.replace(/ > \([^\s]+\)$/, "");
55
- }
56
- function getResource(stainlessPath) {
57
- const parsed = parseStainlessPath(stainlessPath);
58
- return parsed?.resource[0];
59
- }
60
- function parseRoute(basePath, route) {
61
- if (!route.startsWith(basePath)) return { stainlessPath: "", language: DefaultLanguage };
62
- if (basePath && route.startsWith(basePath)) route = route.slice(basePath.length);
63
- let stainlessPath = "";
64
- let elements = route.slice(1).split("/");
65
- let language = DefaultLanguage;
66
- if (elements[0] && Languages.includes(elements[0])) {
67
- language = elements[0];
68
- elements = elements.slice(1);
69
- }
70
- while (elements.length > 0) {
71
- const element = elements.shift();
72
- switch (element) {
73
- case "resources":
74
- stainlessPath += `(resource) ${elements.shift()}`;
75
- break;
76
- case "subresources":
77
- stainlessPath += `.${elements.shift()}`;
78
- break;
79
- case "methods":
80
- stainlessPath += ` > (method) ${elements.shift()}`;
81
- break;
82
- }
83
- }
84
- return { stainlessPath, language };
85
- }
86
- function generateRoute(basePath, language, stainlessPath) {
87
- const parsedPath = parseStainlessPath(stainlessPath);
88
- if (!parsedPath) return null;
89
- const path = [basePath.endsWith("/") ? basePath.slice(0, -1) : basePath];
90
- if (language && language !== DefaultLanguage) path.push(language);
91
- const resources = parsedPath.resource.flatMap((name, index) => [
92
- index > 0 ? "subresources" : "resources",
93
- name
94
- ]);
95
- const resourcePath = parsedPath.model ? resources.slice(0, 2) : resources;
96
- path.push(...resourcePath);
97
- if (parsedPath.method) path.push("methods", parsedPath.method);
98
- return stainlessPath.length > parsedPath.routable.length ? `${path.join("/")}#${encodeURIComponent(stainlessPath)}` : path.join("/");
99
- }
100
- function* walkResource(resource, path, includeModels) {
101
- yield { data: resource, path };
102
- for (const data of Object.values(resource.methods)) {
103
- yield { data, path: [...path, "methods", data.name] };
104
- }
105
- if (includeModels)
106
- for (const data of Object.values(resource.models)) {
107
- yield { data, path: [...path, "models", data.name] };
108
- }
109
- for (const data of Object.values(resource.subresources ?? {})) {
110
- yield* walkResource(data, [...path, "subresources", data.name]);
111
- }
112
- }
113
- function* walkTree(spec, includeModels) {
114
- for (const data of Object.values(spec.resources)) {
115
- yield* walkResource(data, ["resources", data.name], includeModels);
116
- }
117
- }
118
- function generateRouteList({
119
- spec,
120
- languages,
121
- excludeLanguages = []
122
- }) {
123
- const entries = Array.from(walkTree(spec));
124
- const langs = languages ?? spec.docs?.languages ?? ["http"];
125
- return langs.filter((lang) => Languages.includes(lang) && lang !== "terraform").filter((lang) => !excludeLanguages?.includes(lang)).flatMap(
126
- (language) => entries.map(({ path, data: { title, kind, stainlessPath } }) => ({
127
- title,
128
- kind,
129
- language,
130
- stainlessPath,
131
- slug: (language === "http" ? path : [language, ...path]).join("/")
132
- }))
133
- );
134
- }
135
- function findNavigationPath(items, target) {
136
- for (const item of Object.values(items)) {
137
- if (item.stainlessPath === target) return [item.stainlessPath];
138
- if (item.kind === "http_method") continue;
139
- const path = findNavigationPath(
140
- [...Object.values(item.methods ?? {}), ...Object.values(item.subresources ?? {})],
141
- target
142
- );
143
- if (path) return [item.stainlessPath, ...path];
144
- }
145
- }
146
- function expandToElement(el) {
147
- while (el) {
148
- if (el.tagName === "DETAILS") el["open"] = true;
149
- el = el.parentElement;
150
- }
151
- }
152
- function scrollToPath(stainlessPath) {
153
- const el = document.getElementById(stainlessPath);
154
- if (el) {
155
- expandToElement(el);
156
- el.scrollIntoView({ behavior: "smooth" });
157
- }
158
- }
159
- function updateHistory(basePath, language, stainlessPath) {
160
- const path = generateRoute(basePath, language, stainlessPath);
161
- window.history.pushState({ stainlessPath, language }, "", path);
162
- }
163
- export {
164
- LanguageNames,
165
- Languages,
166
- SupportedLanguageSyntaxes,
167
- expandToElement,
168
- findNavigationPath,
169
- generateRoute,
170
- generateRouteList,
171
- getLanguageSnippet,
172
- getResource,
173
- isSupportedLanguage,
174
- parseRoute,
175
- parseStainlessPath,
176
- scrollToPath,
177
- trimStainlessPath,
178
- updateHistory,
179
- walkTree
180
- };
1
+ import { _ as updateHistory, a as findNavigationPath, c as generateRouteList, d as isSupportedLanguage, f as parseRoute, g as trimStainlessPath, h as scrollToPath, i as expandToElement, l as getLanguageSnippet, n as Languages, o as generateMissingRouteList, p as parseStainlessPath, r as SupportedLanguageSyntaxes, s as generateRoute, t as LanguageNames, u as getResource, v as walkTree } from "./routing-C64k4fmX.js";
2
+
3
+ export { LanguageNames, Languages, SupportedLanguageSyntaxes, expandToElement, findNavigationPath, generateMissingRouteList, generateRoute, generateRouteList, getLanguageSnippet, getResource, isSupportedLanguage, parseRoute, parseStainlessPath, scrollToPath, trimStainlessPath, updateHistory, walkTree };
@@ -0,0 +1,387 @@
1
+ import { t as __exportAll } from "./chunk-BN_g-Awi.js";
2
+ import { d as useSpec, i as useDeclaration, s as useLanguage } from "./docs-BmOB2f-I.js";
3
+ import { n as useLanguageComponents } from "./contexts-CVj20VV4.js";
4
+ import { t as useComponents } from "./use-components-BUz3GbO4.js";
5
+ import { t as style_default } from "./style-HpXpcJ9v.js";
6
+ import * as React$1 from "react";
7
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
+
9
+ //#region src/languages/ruby.tsx
10
+ var ruby_exports = /* @__PURE__ */ __exportAll({
11
+ Declaration: () => Declaration,
12
+ MethodSignature: () => MethodSignature,
13
+ Property: () => Property,
14
+ Type: () => Type,
15
+ TypeName: () => TypeName
16
+ });
17
+ const ComplexTypes = {
18
+ RubyTypeObject: "object",
19
+ RubyTypeUnion: "union",
20
+ RubyTypeIntersection: "intersection",
21
+ RubyTypeArray: "array",
22
+ RubyTypeMap: "hash"
23
+ };
24
+ const Keywords = {
25
+ RubyTypeBinary: "FileInput",
26
+ RubyTypeUnknown: "untyped",
27
+ RubyTypeNull: "nil",
28
+ RubyTypeInteger: "Integer",
29
+ RubyTypeFloat: "Float",
30
+ RubyTypeBoolean: "bool"
31
+ };
32
+ function TypeName({ type }) {
33
+ const Lang = useLanguageComponents();
34
+ return ComplexTypes[type.kind] ?? /* @__PURE__ */ jsx(Lang.Type, { type });
35
+ }
36
+ const VALID_IDENTIFIER = /^[_A-Za-z][_A-Za-z0-9]*$/;
37
+ function TypePreview({ path }) {
38
+ const spec = useSpec();
39
+ const language = useLanguage();
40
+ const decl = useDeclaration(path, false);
41
+ const { Join } = useComponents();
42
+ if (!(decl && "children" in decl && decl.children && decl.children.length > 0) || "type" in decl && decl["type"] && "kind" in decl["type"] && decl["type"]?.["kind"] === "RubyTypeUnion") return;
43
+ const items = decl.children.map((prop, key) => {
44
+ const p = spec?.decls?.[language]?.[prop];
45
+ return /* @__PURE__ */ jsx("span", {
46
+ className: style_default.TypePropertyName,
47
+ children: /* @__PURE__ */ jsx("span", {
48
+ className: style_default.TextIdentifier,
49
+ children: p && "ident" in p ? p["ident"] : null
50
+ })
51
+ }, key);
52
+ });
53
+ return /* @__PURE__ */ jsxs("span", {
54
+ className: style_default.TypePreview,
55
+ "data-stldocs-type-preview": "properties",
56
+ children: [
57
+ /* @__PURE__ */ jsx("span", {
58
+ className: style_default.TypeBrace,
59
+ children: " {"
60
+ }),
61
+ /* @__PURE__ */ jsxs("span", {
62
+ className: style_default.TypePreviewContent,
63
+ children: [
64
+ " ",
65
+ /* @__PURE__ */ jsx(Join, {
66
+ items,
67
+ limit: 3,
68
+ children: /* @__PURE__ */ jsx("span", {
69
+ className: style_default.TextOperator,
70
+ children: ", "
71
+ })
72
+ }),
73
+ " "
74
+ ]
75
+ }),
76
+ /* @__PURE__ */ jsx("span", {
77
+ className: style_default.TypeBrace,
78
+ children: "} "
79
+ })
80
+ ]
81
+ });
82
+ }
83
+ function Type({ type }) {
84
+ const Lang = useLanguageComponents();
85
+ const { SDKReference, Join } = useComponents();
86
+ switch (type.kind) {
87
+ case "RubyTypeBinary":
88
+ case "RubyTypeUnknown":
89
+ case "RubyTypeNull":
90
+ case "RubyTypeInteger":
91
+ case "RubyTypeFloat":
92
+ case "RubyTypeBoolean": return /* @__PURE__ */ jsx("span", {
93
+ className: style_default.Type,
94
+ children: /* @__PURE__ */ jsx("span", {
95
+ className: style_default.TypeKeyword,
96
+ children: Keywords[type.kind]
97
+ })
98
+ });
99
+ case "RubyTypeString": return /* @__PURE__ */ jsx("span", {
100
+ className: style_default.Type,
101
+ children: /* @__PURE__ */ jsx("span", {
102
+ className: style_default.TypeString,
103
+ children: "String"
104
+ })
105
+ });
106
+ case "RubyTypeLiteral":
107
+ switch (typeof type.literal) {
108
+ case "string": return /* @__PURE__ */ jsx("span", {
109
+ className: style_default.Type,
110
+ children: /* @__PURE__ */ jsxs("span", {
111
+ className: style_default.LiteralString,
112
+ children: [":", type.literal.match(VALID_IDENTIFIER) ? type.literal : JSON.stringify(type.literal)]
113
+ })
114
+ });
115
+ case "number": return /* @__PURE__ */ jsx("span", {
116
+ className: style_default.Type,
117
+ children: /* @__PURE__ */ jsx("span", {
118
+ className: style_default.LiteralNumeric,
119
+ children: JSON.stringify(type.literal)
120
+ })
121
+ });
122
+ case "boolean": return /* @__PURE__ */ jsx("span", {
123
+ className: style_default.Type,
124
+ children: /* @__PURE__ */ jsx("span", {
125
+ className: style_default.LiteralBoolean,
126
+ children: JSON.stringify(type.literal)
127
+ })
128
+ });
129
+ }
130
+ break;
131
+ case "RubyTypeArray": return /* @__PURE__ */ jsxs("span", {
132
+ className: style_default.Type,
133
+ children: [
134
+ /* @__PURE__ */ jsx("span", {
135
+ className: style_default.TypeArray,
136
+ children: "Array["
137
+ }),
138
+ /* @__PURE__ */ jsx(Lang.Type, { type: type.elementType }),
139
+ /* @__PURE__ */ jsx("span", {
140
+ className: style_default.TypeArray,
141
+ children: "]"
142
+ })
143
+ ]
144
+ });
145
+ case "RubyTypeMap": return /* @__PURE__ */ jsxs("span", {
146
+ className: style_default.Type,
147
+ children: [
148
+ /* @__PURE__ */ jsx("span", {
149
+ className: style_default.TypeArray,
150
+ children: "Hash["
151
+ }),
152
+ type.indexType.kind === "RubyTypeString" ? /* @__PURE__ */ jsx("span", {
153
+ className: style_default.TypeString,
154
+ children: "Symbol"
155
+ }) : /* @__PURE__ */ jsx(Lang.Type, { type: type.indexType }),
156
+ ", ",
157
+ /* @__PURE__ */ jsx(Lang.Type, { type: type.itemType }),
158
+ /* @__PURE__ */ jsx("span", {
159
+ className: style_default.TypeArray,
160
+ children: "]"
161
+ })
162
+ ]
163
+ });
164
+ case "RubyTypeReference": {
165
+ const name = type.ident.split(".").at(-1);
166
+ if (!type.typeParameters || type.typeParameters.length === 0) return /* @__PURE__ */ jsxs("span", {
167
+ className: style_default.Type,
168
+ children: [/* @__PURE__ */ jsx(SDKReference, {
169
+ stainlessPath: type.$ref,
170
+ children: name
171
+ }), /* @__PURE__ */ jsx(TypePreview, { path: type.$ref })]
172
+ });
173
+ const typeParameters = type.typeParameters.map((t, i) => /* @__PURE__ */ jsx(Lang.Type, { type: t }, i));
174
+ return /* @__PURE__ */ jsxs("span", {
175
+ className: style_default.Type,
176
+ children: [
177
+ /* @__PURE__ */ jsx(SDKReference, {
178
+ stainlessPath: type.$ref,
179
+ children: name
180
+ }),
181
+ /* @__PURE__ */ jsx("span", {
182
+ className: style_default.TypeBracket,
183
+ children: "<"
184
+ }),
185
+ /* @__PURE__ */ jsx(Join, {
186
+ items: typeParameters,
187
+ children: /* @__PURE__ */ jsx("span", {
188
+ className: style_default.TextOperator,
189
+ children: ", "
190
+ })
191
+ }),
192
+ /* @__PURE__ */ jsx("span", {
193
+ className: style_default.TypeBracket,
194
+ children: ">"
195
+ }),
196
+ /* @__PURE__ */ jsx(TypePreview, { path: type.$ref })
197
+ ]
198
+ });
199
+ }
200
+ case "RubyTypeIntersection":
201
+ case "RubyTypeUnion": {
202
+ const items = type.types.map((t, key) => /* @__PURE__ */ jsx(Lang.Type, { type: t }, key));
203
+ const delimiter = type.kind === "RubyTypeUnion" ? "|" : "&";
204
+ return /* @__PURE__ */ jsx("span", {
205
+ className: style_default.Type,
206
+ children: /* @__PURE__ */ jsx("span", {
207
+ className: style_default.TypePreview,
208
+ "data-stldocs-type-preview": "union",
209
+ children: /* @__PURE__ */ jsx("span", {
210
+ className: style_default.TypePreviewContent,
211
+ children: /* @__PURE__ */ jsx(Join, {
212
+ items,
213
+ limit: 3,
214
+ children: /* @__PURE__ */ jsxs("span", {
215
+ className: style_default.TextOperator,
216
+ children: [
217
+ " ",
218
+ delimiter,
219
+ " "
220
+ ]
221
+ })
222
+ })
223
+ })
224
+ })
225
+ });
226
+ }
227
+ case "RubyTypeBuiltinClass": return /* @__PURE__ */ jsx("span", {
228
+ className: style_default.TypeReference,
229
+ children: type.className
230
+ });
231
+ case "RubyTypeObject": {
232
+ const items = type.members.map((prop, key) => /* @__PURE__ */ jsx("span", {
233
+ className: style_default.TextIdentifier,
234
+ children: prop.ident
235
+ }, key));
236
+ return /* @__PURE__ */ jsx("span", {
237
+ className: style_default.Type,
238
+ children: /* @__PURE__ */ jsx("span", {
239
+ className: style_default.TypePreview,
240
+ "data-stldocs-type-preview": "properties",
241
+ children: /* @__PURE__ */ jsxs("span", {
242
+ className: style_default.TypePreviewContent,
243
+ children: [
244
+ /* @__PURE__ */ jsx("span", {
245
+ className: style_default.TypeBrace,
246
+ children: "{ "
247
+ }),
248
+ /* @__PURE__ */ jsx(Join, {
249
+ items,
250
+ limit: 3,
251
+ children: /* @__PURE__ */ jsx("span", {
252
+ className: style_default.TextOperator,
253
+ children: ", "
254
+ })
255
+ }),
256
+ /* @__PURE__ */ jsx("span", {
257
+ className: style_default.TypeBrace,
258
+ children: "}"
259
+ })
260
+ ]
261
+ })
262
+ })
263
+ });
264
+ }
265
+ }
266
+ }
267
+ function MethodSignature({ decl }) {
268
+ const Lang = useLanguageComponents();
269
+ const { Join } = useComponents();
270
+ const params = decl.args.map((param, i) => /* @__PURE__ */ jsx(React$1.Fragment, { children: /* @__PURE__ */ jsx("span", {
271
+ className: style_default.TextIdentifier,
272
+ children: param.ident
273
+ }) }, i));
274
+ return /* @__PURE__ */ jsx("div", {
275
+ className: style_default.MethodSignature,
276
+ children: /* @__PURE__ */ jsxs("span", {
277
+ className: style_default.SignatureTitle,
278
+ children: [
279
+ /* @__PURE__ */ jsx("span", {
280
+ className: style_default.SignatureQualified,
281
+ children: /* @__PURE__ */ jsx("span", {
282
+ className: style_default.TextIdentifier,
283
+ children: decl.qualified?.slice(0, -decl.ident.length)
284
+ })
285
+ }),
286
+ /* @__PURE__ */ jsx("span", {
287
+ className: style_default.SignatureName,
288
+ children: /* @__PURE__ */ jsx("span", {
289
+ className: style_default.TextIdentifier,
290
+ children: decl.ident
291
+ })
292
+ }),
293
+ /* @__PURE__ */ jsxs("span", {
294
+ className: style_default.MethodSignature,
295
+ children: [
296
+ /* @__PURE__ */ jsx("span", {
297
+ className: style_default.SignatureParen,
298
+ children: "("
299
+ }),
300
+ /* @__PURE__ */ jsx("span", {
301
+ className: style_default.SignatureParams,
302
+ children: /* @__PURE__ */ jsx(Join, {
303
+ items: params,
304
+ children: /* @__PURE__ */ jsx("span", {
305
+ className: style_default.TextOperator,
306
+ children: ", "
307
+ })
308
+ })
309
+ }),
310
+ /* @__PURE__ */ jsx("span", {
311
+ className: style_default.SignatureParen,
312
+ children: ")"
313
+ }),
314
+ " -> ",
315
+ decl.returns ? /* @__PURE__ */ jsx(Lang.Type, { type: decl.returns }) : "void"
316
+ ]
317
+ })
318
+ ]
319
+ })
320
+ });
321
+ }
322
+ function Property({ decl, children }) {
323
+ const Lang = useLanguageComponents();
324
+ switch (decl.kind) {
325
+ case "RubyDeclProperty": return children({
326
+ name: decl.ident,
327
+ typeName: /* @__PURE__ */ jsx(Lang.TypeName, { type: decl.type }),
328
+ type: decl.type.kind in ComplexTypes && /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
329
+ });
330
+ case "RubyDeclTypeAlias": return children({
331
+ name: decl.ident,
332
+ typeName: "alias",
333
+ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
334
+ });
335
+ case "RubyDeclReference": return children({ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type }) });
336
+ case "RubyDeclClass": return children({
337
+ name: decl.ident,
338
+ typeName: "class"
339
+ });
340
+ }
341
+ }
342
+ function Declaration({ decl }) {
343
+ const Lang = useLanguageComponents();
344
+ if (!decl) return;
345
+ switch (decl.kind) {
346
+ case "RubyDeclProperty": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
347
+ /* @__PURE__ */ jsx("span", {
348
+ className: style_default.TypePropertyName,
349
+ children: /* @__PURE__ */ jsx("span", {
350
+ className: style_default.TextIdentifier,
351
+ children: decl.ident
352
+ })
353
+ }),
354
+ /* @__PURE__ */ jsx("span", {
355
+ className: style_default.TextPunctuation,
356
+ children: ": "
357
+ }),
358
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
359
+ ] });
360
+ case "RubyDeclTypeAlias": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
361
+ /* @__PURE__ */ jsx("span", {
362
+ className: style_default.TextIdentifier,
363
+ children: decl.ident
364
+ }),
365
+ /* @__PURE__ */ jsx("span", {
366
+ className: style_default.TextOperator,
367
+ children: " = "
368
+ }),
369
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
370
+ ] });
371
+ case "RubyDeclClass": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
372
+ /* @__PURE__ */ jsx("span", {
373
+ className: style_default.TextKeyword,
374
+ children: "class "
375
+ }),
376
+ /* @__PURE__ */ jsx("span", {
377
+ className: style_default.TextIdentifier,
378
+ children: decl.ident
379
+ }),
380
+ /* @__PURE__ */ jsx(TypePreview, { path: decl.stainlessPath })
381
+ ] });
382
+ case "RubyDeclReference": return /* @__PURE__ */ jsx(Lang.Type, { type: decl.type });
383
+ }
384
+ }
385
+
386
+ //#endregion
387
+ export { TypeName as a, Type as i, MethodSignature as n, ruby_exports as o, Property as r, Declaration as t };
@@ -0,0 +1,122 @@
1
+ import { c as ID, d as Method, f as Model, g as SnippetLanguage, o as HasStainlessPath, t as BaseDeclaration } from "./index-CwjGm9zX.js";
2
+ import { t as DocsLanguage } from "./routing-utiR5mY3.js";
3
+ import * as React$1 from "react";
4
+ import * as react_jsx_runtime37 from "react/jsx-runtime";
5
+
6
+ //#region src/components/sdk.d.ts
7
+ type PropertyModelContextType = {
8
+ modelPath?: string;
9
+ propertyPath?: string;
10
+ };
11
+ declare const PropertyModelContext: React$1.Context<PropertyModelContextType>;
12
+ declare function usePropertyModel(): PropertyModelContextType;
13
+ type ReferenceNestingContextType = string[];
14
+ declare const ReferenceNestingContext: React$1.Context<ReferenceNestingContextType>;
15
+ declare function useReferenceNesting(): ReferenceNestingContextType;
16
+ type SDKSnippetLanguagesType = Record<SnippetLanguage, {
17
+ name: string;
18
+ }>;
19
+ declare const SDKSnippetLanguages: SDKSnippetLanguagesType;
20
+ type TransformRequestSnippetFn = ({
21
+ snippet,
22
+ language
23
+ }: {
24
+ snippet: string;
25
+ language: DocsLanguage;
26
+ }) => string;
27
+ type SDKChildrenProps = {
28
+ paths: ID[];
29
+ expand?: boolean;
30
+ depth?: number;
31
+ };
32
+ declare function SDKChildren({
33
+ paths,
34
+ expand,
35
+ depth
36
+ }: SDKChildrenProps): react_jsx_runtime37.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_runtime37.JSX.Element;
47
+ type SDKConstraintsProps = {
48
+ constraints?: Record<string, any>;
49
+ };
50
+ declare function SDKConstraints({
51
+ constraints
52
+ }: SDKConstraintsProps): react_jsx_runtime37.JSX.Element | undefined;
53
+ type SDKIconProps = {
54
+ language: SnippetLanguage;
55
+ size?: number;
56
+ };
57
+ declare function SDKIcon({
58
+ language
59
+ }: SDKIconProps): react_jsx_runtime37.JSX.Element | null;
60
+ type SDKRequestTitleProps = {
61
+ snippetLanguage: SnippetLanguage;
62
+ };
63
+ declare function SDKRequestTitle({
64
+ snippetLanguage
65
+ }: SDKRequestTitleProps): react_jsx_runtime37.JSX.Element;
66
+ type SDKExampleProps = {
67
+ method: Partial<Method> & HasStainlessPath;
68
+ transformRequestSnippet?: TransformRequestSnippetFn;
69
+ };
70
+ declare function SDKExample({
71
+ method,
72
+ transformRequestSnippet
73
+ }: SDKExampleProps): react_jsx_runtime37.JSX.Element;
74
+ type SDKMethodProps = {
75
+ method: Method;
76
+ transformRequestSnippet?: TransformRequestSnippetFn;
77
+ };
78
+ declare function SDKMethodHeader({
79
+ method
80
+ }: SDKMethodProps): react_jsx_runtime37.JSX.Element;
81
+ declare function useStreamingResponse(method: BaseDeclaration): ID | undefined;
82
+ declare function SDKMethodInfo({
83
+ method
84
+ }: SDKMethodProps): react_jsx_runtime37.JSX.Element;
85
+ declare function SDKMethodNotImplemented({
86
+ method
87
+ }: SDKMethodProps): react_jsx_runtime37.JSX.Element;
88
+ declare function SDKMethod({
89
+ method,
90
+ transformRequestSnippet
91
+ }: SDKMethodProps): react_jsx_runtime37.JSX.Element;
92
+ type SDKModelProps = {
93
+ model: Model;
94
+ };
95
+ declare function SDKModel({
96
+ model
97
+ }: SDKModelProps): react_jsx_runtime37.JSX.Element | null;
98
+ type SDKReferenceProps = {
99
+ stainlessPath: string;
100
+ children?: React$1.ReactNode;
101
+ };
102
+ declare function SDKReference({
103
+ stainlessPath,
104
+ children
105
+ }: SDKReferenceProps): string | number | bigint | boolean | 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> | react_jsx_runtime37.JSX.Element | null | undefined;
106
+ type SDKLanguageBlockProps = {
107
+ language: DocsLanguage;
108
+ version: string;
109
+ install: string;
110
+ links: {
111
+ repo: string;
112
+ docs: string;
113
+ };
114
+ };
115
+ declare function SDKLanguageBlock({
116
+ language,
117
+ version,
118
+ install,
119
+ links
120
+ }: SDKLanguageBlockProps): react_jsx_runtime37.JSX.Element;
121
+ //#endregion
122
+ export { SDKSnippetLanguagesType as C, useStreamingResponse as D, useReferenceNesting as E, SDKSnippetLanguages as S, usePropertyModel as T, SDKModel as _, SDKChildren as a, SDKRequestTitle as b, SDKDeclaration as c, SDKLanguageBlock as d, SDKMethod as f, SDKMethodProps as g, SDKMethodNotImplemented as h, ReferenceNestingContextType as i, SDKExample as l, SDKMethodInfo as m, PropertyModelContextType as n, SDKConstraints as o, SDKMethodHeader as p, ReferenceNestingContext as r, SDKConstraintsProps as s, PropertyModelContext as t, SDKIcon as u, SDKModelProps as v, TransformRequestSnippetFn as w, SDKRequestTitleProps as x, SDKReference as y };