@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
@@ -0,0 +1,269 @@
1
+ import { t as __exportAll } from "./chunk-BN_g-Awi.js";
2
+ import { n as useLanguageComponents } from "./contexts-CVj20VV4.js";
3
+ import { t as useComponents } from "./use-components-BUz3GbO4.js";
4
+ import { t as style_default } from "./style-HpXpcJ9v.js";
5
+ import * as React$1 from "react";
6
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
+
8
+ //#region src/languages/python.tsx
9
+ var python_exports = /* @__PURE__ */ __exportAll({
10
+ Declaration: () => Declaration,
11
+ MethodSignature: () => MethodSignature,
12
+ Property: () => Property,
13
+ Type: () => Type,
14
+ TypeName: () => TypeName
15
+ });
16
+ const constStyle = {
17
+ string: style_default.LiteralString,
18
+ number: style_default.LiteralNumeric,
19
+ boolean: style_default.LiteralBoolean
20
+ };
21
+ function showFullType(type) {
22
+ if (type.kind !== "PythonTypeReference") return false;
23
+ return type.typeName === "Optional" ? showFullType(type.typeParameters[0]) : type.typeParameters.length > 0;
24
+ }
25
+ function TypeName({ type }) {
26
+ const Lang = useLanguageComponents();
27
+ if (type.kind === "PythonTypeReference") switch (type.typeName) {
28
+ case "Optional": return /* @__PURE__ */ jsx(Lang.TypeName, { type: type.typeParameters[0] });
29
+ case "List":
30
+ case "Iterable":
31
+ case "Literal":
32
+ case "Union": return type.typeName.toLowerCase();
33
+ }
34
+ return /* @__PURE__ */ jsx(Lang.Type, { type });
35
+ }
36
+ function Type({ type }) {
37
+ const Lang = useLanguageComponents();
38
+ const { Join, SDKReference } = useComponents();
39
+ switch (type.kind) {
40
+ case "PythonTypeAny":
41
+ case "PythonTypeUnknown":
42
+ case "PythonTypeInt":
43
+ case "PythonTypeFloat":
44
+ case "PythonTypeBool": return /* @__PURE__ */ jsx("span", {
45
+ className: style_default.Type,
46
+ children: /* @__PURE__ */ jsx("span", {
47
+ className: style_default.TypeKeyword,
48
+ children: type.kind.slice(10).toLowerCase()
49
+ })
50
+ });
51
+ case "PythonTypeString": return /* @__PURE__ */ jsx("span", {
52
+ className: style_default.Type,
53
+ children: /* @__PURE__ */ jsx("span", {
54
+ className: style_default.TypeString,
55
+ children: "str"
56
+ })
57
+ });
58
+ case "PythonTypeLiteral": return /* @__PURE__ */ jsx("span", {
59
+ className: style_default.Type,
60
+ children: /* @__PURE__ */ jsx("span", {
61
+ className: constStyle[typeof type.literal.value],
62
+ children: JSON.stringify(type.literal.value)
63
+ })
64
+ });
65
+ case "PythonTypeArray": return /* @__PURE__ */ jsxs("span", {
66
+ className: style_default.Type,
67
+ children: [
68
+ /* @__PURE__ */ jsx("span", {
69
+ className: style_default.TypeArray,
70
+ children: "Array<"
71
+ }),
72
+ /* @__PURE__ */ jsx(Lang.Type, { type: type.elementType }),
73
+ /* @__PURE__ */ jsx("span", {
74
+ className: style_default.TypeArray,
75
+ children: ">"
76
+ })
77
+ ]
78
+ });
79
+ case "PythonTypeClass": return /* @__PURE__ */ jsx("span", {
80
+ className: style_default.Type,
81
+ children: /* @__PURE__ */ jsx("span", {
82
+ className: style_default.TypeKeyword,
83
+ children: "class"
84
+ })
85
+ });
86
+ case "PythonTypeMap": return /* @__PURE__ */ jsx("span", {
87
+ className: style_default.Type,
88
+ children: /* @__PURE__ */ jsx("span", {
89
+ className: style_default.TypeKeyword,
90
+ children: "Dict"
91
+ })
92
+ });
93
+ case "PythonTypeReference": {
94
+ const params = type.typeParameters?.map((param, key) => /* @__PURE__ */ jsx(Lang.Type, { type: param }, key));
95
+ return /* @__PURE__ */ jsxs("span", {
96
+ className: style_default.Type,
97
+ children: [/* @__PURE__ */ jsx("span", {
98
+ className: type.typeName === "Optional" ? style_default.TypeArray : "",
99
+ children: /* @__PURE__ */ jsx(SDKReference, {
100
+ stainlessPath: type.$ref,
101
+ children: type.typeName
102
+ })
103
+ }), params && params.length > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [
104
+ /* @__PURE__ */ jsx("span", {
105
+ className: style_default.TypeBracket,
106
+ children: "["
107
+ }),
108
+ /* @__PURE__ */ jsx(Join, {
109
+ items: params,
110
+ limit: 3,
111
+ children: /* @__PURE__ */ jsx("span", {
112
+ className: style_default.TextOperator,
113
+ children: ", "
114
+ })
115
+ }),
116
+ /* @__PURE__ */ jsx("span", {
117
+ className: style_default.TypeBracket,
118
+ children: "]"
119
+ })
120
+ ] })]
121
+ });
122
+ }
123
+ }
124
+ }
125
+ function MethodSignature({ decl }) {
126
+ const Lang = useLanguageComponents();
127
+ const { Join, Tooltip } = useComponents();
128
+ const params = decl.parameters.map((param, i) => /* @__PURE__ */ jsx(React$1.Fragment, { children: /* @__PURE__ */ jsx(Tooltip, {
129
+ content: /* @__PURE__ */ jsx(Lang.Type, { type: param.type }),
130
+ children: /* @__PURE__ */ jsx("span", {
131
+ className: style_default.TextIdentifier,
132
+ children: param.ident
133
+ })
134
+ }) }, i));
135
+ return /* @__PURE__ */ jsx("div", {
136
+ className: style_default.MethodSignature,
137
+ children: /* @__PURE__ */ jsxs("span", {
138
+ className: style_default.SignatureTitle,
139
+ children: [
140
+ decl.async && /* @__PURE__ */ jsx("span", {
141
+ className: style_default.TextKeyword,
142
+ children: "async "
143
+ }),
144
+ decl.qualified && /* @__PURE__ */ jsx("span", {
145
+ className: style_default.SignatureQualified,
146
+ children: /* @__PURE__ */ jsx("span", {
147
+ className: style_default.TextIdentifier,
148
+ children: decl.qualified?.slice(0, -decl.ident.length)
149
+ })
150
+ }),
151
+ /* @__PURE__ */ jsx("span", {
152
+ className: style_default.SignatureName,
153
+ children: /* @__PURE__ */ jsx("span", {
154
+ className: style_default.TextIdentifier,
155
+ children: decl.ident
156
+ })
157
+ }),
158
+ /* @__PURE__ */ jsxs("span", {
159
+ className: style_default.MethodSignature,
160
+ children: [
161
+ /* @__PURE__ */ jsx("span", {
162
+ className: style_default.SignatureParen,
163
+ children: "("
164
+ }),
165
+ /* @__PURE__ */ jsx("span", {
166
+ className: style_default.SignatureParams,
167
+ children: /* @__PURE__ */ jsx(Join, {
168
+ items: params,
169
+ children: /* @__PURE__ */ jsx("span", {
170
+ className: style_default.TextOperator,
171
+ children: ", "
172
+ })
173
+ })
174
+ }),
175
+ /* @__PURE__ */ jsxs("span", {
176
+ className: style_default.SignatureParen,
177
+ children: [")", " "]
178
+ }),
179
+ decl.returns && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
180
+ className: style_default.TextOperator,
181
+ children: " -> "
182
+ }), /* @__PURE__ */ jsx(Lang.Type, { type: decl.returns })] })
183
+ ]
184
+ })
185
+ ]
186
+ })
187
+ });
188
+ }
189
+ function Property({ decl, children }) {
190
+ const Lang = useLanguageComponents();
191
+ if (!decl) return;
192
+ switch (decl.kind) {
193
+ case "PythonDeclProperty": return children({
194
+ name: decl.ident,
195
+ typeName: /* @__PURE__ */ jsx(Lang.TypeName, { type: decl.type }),
196
+ type: showFullType(decl.type) && /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
197
+ });
198
+ case "PythonDeclClass": return children({
199
+ name: decl.ident,
200
+ typeName: "class"
201
+ });
202
+ case "PythonDeclType": return children({
203
+ name: decl.ident,
204
+ typeName: "type",
205
+ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
206
+ });
207
+ case "PythonDeclReference": return children({ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type }) });
208
+ }
209
+ }
210
+ function Declaration({ decl }) {
211
+ const Lang = useLanguageComponents();
212
+ if (!decl) return;
213
+ switch (decl.kind) {
214
+ case "PythonDeclProperty": {
215
+ const nullable = decl.type.kind === "PythonTypeReference" && decl.type.typeName === "Optional" && (decl.type.typeParameters ?? []).length > 0;
216
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
217
+ /* @__PURE__ */ jsx("span", {
218
+ className: style_default.TypePropertyName,
219
+ children: /* @__PURE__ */ jsx("span", {
220
+ className: style_default.TextIdentifier,
221
+ children: decl.ident
222
+ })
223
+ }),
224
+ /* @__PURE__ */ jsx("span", {
225
+ className: style_default.TextPunctuation,
226
+ children: ": "
227
+ }),
228
+ decl.optional && !nullable ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
229
+ /* @__PURE__ */ jsx("span", {
230
+ className: style_default.TypePlain,
231
+ children: "Optional"
232
+ }),
233
+ /* @__PURE__ */ jsx("span", {
234
+ className: style_default.TypeBracket,
235
+ children: "["
236
+ }),
237
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type }),
238
+ /* @__PURE__ */ jsx("span", {
239
+ className: style_default.TypeBrace,
240
+ children: "]"
241
+ })
242
+ ] }) : /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
243
+ ] });
244
+ }
245
+ case "PythonDeclClass": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
246
+ /* @__PURE__ */ jsx("span", {
247
+ className: style_default.TextKeyword,
248
+ children: "class "
249
+ }),
250
+ /* @__PURE__ */ jsx("span", {
251
+ className: style_default.TextIdentifier,
252
+ children: decl.ident
253
+ }),
254
+ /* @__PURE__ */ jsx("span", {
255
+ className: style_default.TextPunctuation,
256
+ children: ": "
257
+ }),
258
+ /* @__PURE__ */ jsx("span", {
259
+ className: `${style_default.TypePreviewContent} ${style_default.TextPunctuation}`,
260
+ children: "…"
261
+ })
262
+ ] });
263
+ case "PythonDeclType": return /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type }) });
264
+ case "PythonDeclReference": return /* @__PURE__ */ jsx(Lang.Type, { type: decl.type });
265
+ }
266
+ }
267
+
268
+ //#endregion
269
+ export { TypeName as a, Type as i, MethodSignature as n, python_exports as o, Property as r, Declaration as t };
@@ -0,0 +1,205 @@
1
+ import { t as __exportAll } from "./chunk-BN_g-Awi.js";
2
+
3
+ //#region src/routing.ts
4
+ var routing_exports = /* @__PURE__ */ __exportAll({
5
+ LanguageNames: () => LanguageNames,
6
+ Languages: () => Languages,
7
+ SupportedLanguageSyntaxes: () => SupportedLanguageSyntaxes,
8
+ expandToElement: () => expandToElement,
9
+ findNavigationPath: () => findNavigationPath,
10
+ generateMissingRouteList: () => generateMissingRouteList,
11
+ generateRoute: () => generateRoute,
12
+ generateRouteList: () => generateRouteList,
13
+ getLanguageSnippet: () => getLanguageSnippet,
14
+ getResource: () => getResource,
15
+ isSupportedLanguage: () => isSupportedLanguage,
16
+ parseRoute: () => parseRoute,
17
+ parseStainlessPath: () => parseStainlessPath,
18
+ scrollToPath: () => scrollToPath,
19
+ trimStainlessPath: () => trimStainlessPath,
20
+ updateHistory: () => updateHistory,
21
+ walkTree: () => walkTree
22
+ });
23
+ const Languages = [
24
+ "http",
25
+ "node",
26
+ "python",
27
+ "go",
28
+ "typescript",
29
+ "terraform",
30
+ "ruby",
31
+ "java",
32
+ "kotlin",
33
+ "csharp",
34
+ "php",
35
+ "cli"
36
+ ];
37
+ const SupportedLanguageSyntaxes = [
38
+ "http",
39
+ "javascript",
40
+ "python",
41
+ "go",
42
+ "typescript",
43
+ "terraform",
44
+ "ruby",
45
+ "java",
46
+ "kotlin",
47
+ "csharp",
48
+ "bash"
49
+ ];
50
+ const LanguageNames = {
51
+ http: "HTTP",
52
+ node: "TypeScript",
53
+ typescript: "TypeScript",
54
+ python: "Python",
55
+ go: "Go",
56
+ ruby: "Ruby",
57
+ java: "Java",
58
+ kotlin: "Kotlin",
59
+ terraform: "Terraform",
60
+ csharp: "C#",
61
+ php: "PHP",
62
+ cli: "CLI Tool"
63
+ };
64
+ function getLanguageSnippet(language) {
65
+ return language === "http" ? "http.curl" : `${language}.default`;
66
+ }
67
+ function isSupportedLanguage(language) {
68
+ return Languages.includes(language);
69
+ }
70
+ const DefaultLanguage = "http";
71
+ const StainlessPathPattern = /(\(resource\) (?<resource>[^\s]+))( > (\(method\) (?<method>[^\s]+)|\(model\) (?<model>[^\s]+))?)?/;
72
+ function parseStainlessPath(stainlessPath) {
73
+ const match = stainlessPath.match(StainlessPathPattern);
74
+ if (!match?.groups) return null;
75
+ return {
76
+ resource: match.groups.resource?.split(".") ?? null,
77
+ method: match.groups.method ?? null,
78
+ model: match.groups.model ?? null,
79
+ routable: match.groups.model ? match[1] : match[0]
80
+ };
81
+ }
82
+ function trimStainlessPath(stainlessPath) {
83
+ return stainlessPath.replace(/ > \([^\s]+\)$/, "");
84
+ }
85
+ function getResource(stainlessPath) {
86
+ return parseStainlessPath(stainlessPath)?.resource?.[0];
87
+ }
88
+ function parseRoute(basePath, route) {
89
+ if (!route.startsWith(basePath)) return {
90
+ stainlessPath: "",
91
+ language: DefaultLanguage
92
+ };
93
+ if (basePath && route.startsWith(basePath)) route = route.slice(basePath.length);
94
+ let stainlessPath = "";
95
+ let elements = route.slice(1).split("/");
96
+ let language = DefaultLanguage;
97
+ if (elements[0] && Languages.includes(elements[0])) {
98
+ language = elements[0];
99
+ elements = elements.slice(1);
100
+ }
101
+ while (elements.length > 0) switch (elements.shift()) {
102
+ case "resources":
103
+ stainlessPath += `(resource) ${elements.shift()}`;
104
+ break;
105
+ case "subresources":
106
+ stainlessPath += `.${elements.shift()}`;
107
+ break;
108
+ case "methods":
109
+ stainlessPath += ` > (method) ${elements.shift()}`;
110
+ break;
111
+ }
112
+ return {
113
+ stainlessPath,
114
+ language
115
+ };
116
+ }
117
+ function generateRoute(basePath, language, stainlessPath) {
118
+ const parsedPath = parseStainlessPath(stainlessPath);
119
+ if (!parsedPath) return null;
120
+ const path = [basePath.endsWith("/") ? basePath.slice(0, -1) : basePath];
121
+ if (language && language !== DefaultLanguage) path.push(language);
122
+ const resources = parsedPath.resource.flatMap((name, index) => [index > 0 ? "subresources" : "resources", name]);
123
+ const resourcePath = parsedPath.model ? resources.slice(0, 2) : resources;
124
+ path.push(...resourcePath);
125
+ if (parsedPath.method) path.push("methods", parsedPath.method);
126
+ return stainlessPath.length > parsedPath.routable.length ? `${path.join("/")}#${encodeURIComponent(stainlessPath)}` : path.join("/");
127
+ }
128
+ function* walkResource(resource, path, includeModels) {
129
+ yield {
130
+ data: resource,
131
+ path
132
+ };
133
+ for (const data of Object.values(resource.methods)) yield {
134
+ data,
135
+ path: [
136
+ ...path,
137
+ "methods",
138
+ data.name
139
+ ]
140
+ };
141
+ if (includeModels) for (const data of Object.values(resource.models)) yield {
142
+ data,
143
+ path: [
144
+ ...path,
145
+ "models",
146
+ data.name
147
+ ]
148
+ };
149
+ for (const data of Object.values(resource.subresources ?? {})) yield* walkResource(data, [
150
+ ...path,
151
+ "subresources",
152
+ data.name
153
+ ]);
154
+ }
155
+ function* walkTree(spec, includeModels) {
156
+ for (const data of Object.values(spec.resources)) yield* walkResource(data, ["resources", data.name], includeModels);
157
+ }
158
+ function generateRouteList({ spec, languages, excludeLanguages = [] }) {
159
+ const entries = Array.from(walkTree(spec));
160
+ return (languages ?? spec.docs?.languages ?? ["http"]).filter((lang) => Languages.includes(lang)).filter((lang) => !excludeLanguages?.includes(lang)).flatMap((language) => entries.map(({ path, data: { title, kind, stainlessPath } }) => ({
161
+ title,
162
+ kind,
163
+ language,
164
+ stainlessPath,
165
+ slug: (language === "http" ? path : [language, ...path]).join("/")
166
+ })));
167
+ }
168
+ function generateMissingRouteList({ spec, basePath }) {
169
+ const entries = Array.from(walkTree(spec));
170
+ return (spec.docs?.languages ?? ["http"]).filter((lang) => Languages.includes(lang) && lang !== "terraform").flatMap((language) => entries.filter(({ data: { stainlessPath, ...rest } }) => {
171
+ if (spec.decls?.[language]?.[stainlessPath] === void 0) return rest.kind === "http_method";
172
+ return false;
173
+ }).map(({ path }) => `${basePath.endsWith("/") ? basePath.slice(0, -1) : basePath}/${language === "http" ? path.join("/") : [language, ...path].join("/")}`));
174
+ }
175
+ function findNavigationPath(items, target) {
176
+ for (const item of Object.values(items)) {
177
+ if (item.stainlessPath === target) return [item.stainlessPath];
178
+ if (item.kind === "http_method") continue;
179
+ const path = findNavigationPath([...Object.values(item.methods ?? {}), ...Object.values(item.subresources ?? {})], target);
180
+ if (path) return [item.stainlessPath, ...path];
181
+ }
182
+ }
183
+ function expandToElement(el) {
184
+ while (el) {
185
+ if (el instanceof HTMLDetailsElement) el.open = true;
186
+ el = el.parentElement;
187
+ }
188
+ }
189
+ function scrollToPath(stainlessPath) {
190
+ const el = document.getElementById(stainlessPath);
191
+ if (el) {
192
+ expandToElement(el);
193
+ el.scrollIntoView({ behavior: "smooth" });
194
+ }
195
+ }
196
+ function updateHistory(basePath, language, stainlessPath) {
197
+ const path = generateRoute(basePath, language, stainlessPath);
198
+ window.history.pushState({
199
+ stainlessPath,
200
+ language
201
+ }, "", path);
202
+ }
203
+
204
+ //#endregion
205
+ export { updateHistory as _, findNavigationPath as a, generateRouteList as c, isSupportedLanguage as d, parseRoute as f, trimStainlessPath as g, scrollToPath as h, expandToElement as i, getLanguageSnippet as l, routing_exports as m, Languages as n, generateMissingRouteList as o, parseStainlessPath as p, SupportedLanguageSyntaxes as r, generateRoute as s, LanguageNames as t, getResource as u, walkTree as v };
@@ -0,0 +1,61 @@
1
+ import { _ as Spec, d as Method, f as Model, m as Resource } from "./index-CwjGm9zX.js";
2
+
3
+ //#region src/routing.d.ts
4
+ declare namespace routing_d_exports {
5
+ export { DocsLanguage, LanguageNames, Languages, ParsedStainlessPath, RouteEntry, SpecTreeEntry, SupportedLanguageSyntaxes, expandToElement, findNavigationPath, generateMissingRouteList, generateRoute, generateRouteList, getLanguageSnippet, getResource, isSupportedLanguage, parseRoute, parseStainlessPath, scrollToPath, trimStainlessPath, updateHistory, walkTree };
6
+ }
7
+ declare const Languages: readonly ["http", "node", "python", "go", "typescript", "terraform", "ruby", "java", "kotlin", "csharp", "php", "cli"];
8
+ declare const SupportedLanguageSyntaxes: string[];
9
+ type DocsLanguage = (typeof Languages)[number];
10
+ declare const LanguageNames: Record<DocsLanguage, string>;
11
+ declare function getLanguageSnippet(language: DocsLanguage): "http.curl" | "node.default" | "python.default" | "go.default" | "typescript.default" | "terraform.default" | "ruby.default" | "java.default" | "kotlin.default" | "csharp.default" | "php.default" | "cli.default";
12
+ declare function isSupportedLanguage(language: string): language is DocsLanguage;
13
+ type ParsedStainlessPath = ReturnType<typeof parseStainlessPath>;
14
+ declare function parseStainlessPath(stainlessPath: string): {
15
+ resource: string[] | null;
16
+ method: string | null;
17
+ model: string | null;
18
+ routable: string | undefined;
19
+ } | null;
20
+ declare function trimStainlessPath(stainlessPath: string): string;
21
+ declare function getResource(stainlessPath: string): string | undefined;
22
+ declare function parseRoute(basePath: string, route: string): {
23
+ stainlessPath: string;
24
+ language: DocsLanguage;
25
+ };
26
+ declare function generateRoute(basePath: string, language: string, stainlessPath: string): string | null;
27
+ type SpecTreeEntry = {
28
+ data: Method | Resource | Model;
29
+ path: string[];
30
+ };
31
+ declare function walkTree(spec: Spec, includeModels?: boolean): Generator<SpecTreeEntry, void, any>;
32
+ type RouteEntry = {
33
+ title: string;
34
+ kind: SpecTreeEntry['data']['kind'];
35
+ language: DocsLanguage;
36
+ stainlessPath: string;
37
+ slug: string;
38
+ };
39
+ declare function generateRouteList({
40
+ spec,
41
+ languages,
42
+ excludeLanguages
43
+ }: {
44
+ spec: Spec;
45
+ languages?: DocsLanguage[];
46
+ excludeLanguages?: DocsLanguage[];
47
+ }): RouteEntry[];
48
+ declare function generateMissingRouteList({
49
+ spec,
50
+ basePath
51
+ }: {
52
+ spec: Spec;
53
+ basePath: string;
54
+ }): string[];
55
+ type ResourceOrMethod = Resource | Method;
56
+ declare function findNavigationPath(items: ResourceOrMethod[], target: string): string[] | undefined;
57
+ declare function expandToElement(el: HTMLElement | null): void;
58
+ declare function scrollToPath(stainlessPath: string): void;
59
+ declare function updateHistory(basePath: string, language: DocsLanguage, stainlessPath: string): void;
60
+ //#endregion
61
+ export { walkTree as S, parseStainlessPath as _, RouteEntry as a, trimStainlessPath as b, expandToElement as c, generateRoute as d, generateRouteList as f, parseRoute as g, isSupportedLanguage as h, ParsedStainlessPath as i, findNavigationPath as l, getResource as m, LanguageNames as n, SpecTreeEntry as o, getLanguageSnippet as p, Languages as r, SupportedLanguageSyntaxes as s, DocsLanguage as t, generateMissingRouteList as u, routing_d_exports as v, updateHistory as x, scrollToPath as y };
@@ -0,0 +1,61 @@
1
+ import { _ as Spec, d as Method, f as Model, m as Resource } from "./index-CwjGm9zX.js";
2
+
3
+ //#region src/routing.d.ts
4
+ declare namespace routing_d_exports {
5
+ export { DocsLanguage, LanguageNames, Languages, ParsedStainlessPath, RouteEntry, SpecTreeEntry, SupportedLanguageSyntaxes, expandToElement, findNavigationPath, generateMissingRouteList, generateRoute, generateRouteList, getLanguageSnippet, getResource, isSupportedLanguage, parseRoute, parseStainlessPath, scrollToPath, trimStainlessPath, updateHistory, walkTree };
6
+ }
7
+ declare const Languages: readonly ["http", "node", "python", "go", "typescript", "terraform", "ruby", "java", "kotlin", "csharp", "php", "cli"];
8
+ declare const SupportedLanguageSyntaxes: string[];
9
+ type DocsLanguage = (typeof Languages)[number];
10
+ declare const LanguageNames: Record<DocsLanguage, string>;
11
+ declare function getLanguageSnippet(language: DocsLanguage): "http.curl" | "cli.default" | "csharp.default" | "go.default" | "java.default" | "kotlin.default" | "node.default" | "php.default" | "python.default" | "ruby.default" | "terraform.default" | "typescript.default";
12
+ declare function isSupportedLanguage(language: string): language is DocsLanguage;
13
+ type ParsedStainlessPath = ReturnType<typeof parseStainlessPath>;
14
+ declare function parseStainlessPath(stainlessPath: string): {
15
+ resource: string[] | null;
16
+ method: string | null;
17
+ model: string | null;
18
+ routable: string | undefined;
19
+ } | null;
20
+ declare function trimStainlessPath(stainlessPath: string): string;
21
+ declare function getResource(stainlessPath: string): string | undefined;
22
+ declare function parseRoute(basePath: string, route: string): {
23
+ stainlessPath: string;
24
+ language: DocsLanguage;
25
+ };
26
+ declare function generateRoute(basePath: string, language: string, stainlessPath: string): string | null;
27
+ type SpecTreeEntry = {
28
+ data: Method | Resource | Model;
29
+ path: string[];
30
+ };
31
+ declare function walkTree(spec: Spec, includeModels?: boolean): Generator<SpecTreeEntry, void, any>;
32
+ type RouteEntry = {
33
+ title: string;
34
+ kind: SpecTreeEntry['data']['kind'];
35
+ language: DocsLanguage;
36
+ stainlessPath: string;
37
+ slug: string;
38
+ };
39
+ declare function generateRouteList({
40
+ spec,
41
+ languages,
42
+ excludeLanguages
43
+ }: {
44
+ spec: Spec;
45
+ languages?: DocsLanguage[];
46
+ excludeLanguages?: DocsLanguage[];
47
+ }): RouteEntry[];
48
+ declare function generateMissingRouteList({
49
+ spec,
50
+ basePath
51
+ }: {
52
+ spec: Spec;
53
+ basePath: string;
54
+ }): string[];
55
+ type ResourceOrMethod = Resource | Method;
56
+ declare function findNavigationPath(items: ResourceOrMethod[], target: string): string[] | undefined;
57
+ declare function expandToElement(el: HTMLElement | null): void;
58
+ declare function scrollToPath(stainlessPath: string): void;
59
+ declare function updateHistory(basePath: string, language: DocsLanguage, stainlessPath: string): void;
60
+ //#endregion
61
+ export { walkTree as S, parseStainlessPath as _, RouteEntry as a, trimStainlessPath as b, expandToElement as c, generateRoute as d, generateRouteList as f, parseRoute as g, isSupportedLanguage as h, ParsedStainlessPath as i, findNavigationPath as l, getResource as m, LanguageNames as n, SpecTreeEntry as o, getLanguageSnippet as p, Languages as r, SupportedLanguageSyntaxes as s, DocsLanguage as t, generateMissingRouteList as u, routing_d_exports as v, updateHistory as x, scrollToPath as y };
@@ -0,0 +1,2 @@
1
+ import { S as walkTree, _ as parseStainlessPath, a as RouteEntry, b as trimStainlessPath, c as expandToElement, d as generateRoute, f as generateRouteList, g as parseRoute, h as isSupportedLanguage, i as ParsedStainlessPath, l as findNavigationPath, m as getResource, n as LanguageNames, o as SpecTreeEntry, p as getLanguageSnippet, r as Languages, s as SupportedLanguageSyntaxes, t as DocsLanguage, u as generateMissingRouteList, x as updateHistory, y as scrollToPath } from "./routing-Cm_9XJiQ.js";
2
+ export { DocsLanguage, LanguageNames, Languages, ParsedStainlessPath, RouteEntry, SpecTreeEntry, SupportedLanguageSyntaxes, expandToElement, findNavigationPath, generateMissingRouteList, generateRoute, generateRouteList, getLanguageSnippet, getResource, isSupportedLanguage, parseRoute, parseStainlessPath, scrollToPath, trimStainlessPath, updateHistory, walkTree };