@stainless-api/docs-ui 0.1.0-beta.73 → 0.1.0-beta.75

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 (124) hide show
  1. package/dist/{chunk-BN_g-Awi.js → chunk-BYypO7fO.js} +3 -3
  2. package/dist/components/MaskedInput.d.ts +3 -3
  3. package/dist/components/MaskedInput.js +1 -1
  4. package/dist/components/breadcrumbs.d.ts +24 -1
  5. package/dist/components/breadcrumbs.js +62 -7
  6. package/dist/components/icons.d.ts +18 -13
  7. package/dist/components/icons.js +940 -2
  8. package/dist/components/index.d.ts +16 -14
  9. package/dist/components/index.js +72 -18
  10. package/dist/components/method.d.ts +58 -1
  11. package/dist/components/method.js +95 -8
  12. package/dist/components/overview.d.ts +38 -1
  13. package/dist/components/overview.js +137 -9
  14. package/dist/components/primitives.d.ts +104 -1
  15. package/dist/components/primitives.js +250 -6
  16. package/dist/components/properties.d.ts +53 -1
  17. package/dist/components/properties.js +138 -7
  18. package/dist/components/sdk-sidebar.d.ts +14 -1
  19. package/dist/components/sdk-sidebar.js +50 -8
  20. package/dist/components/sdk.d.ts +121 -1
  21. package/dist/components/sdk.js +405 -8
  22. package/dist/components/snippets.d.ts +70 -13
  23. package/dist/components/snippets.js +182 -7
  24. package/dist/components/stl-sidebar.d.ts +57 -1
  25. package/dist/components/stl-sidebar.js +105 -3
  26. package/dist/contexts/component-generics.d.ts +29 -1
  27. package/dist/contexts/component-generics.js +31 -1
  28. package/dist/contexts/component-types.d.ts +4 -15
  29. package/dist/contexts/component.d.ts +7 -17
  30. package/dist/contexts/component.js +22 -28
  31. package/dist/contexts/docs.d.ts +61 -1
  32. package/dist/contexts/docs.js +89 -1
  33. package/dist/contexts/index.d.ts +13 -14
  34. package/dist/contexts/index.js +44 -6
  35. package/dist/contexts/markdown.d.ts +21 -1
  36. package/dist/contexts/markdown.js +47 -2
  37. package/dist/contexts/navigation.d.ts +28 -1
  38. package/dist/contexts/navigation.js +22 -1
  39. package/dist/contexts/use-components.d.ts +1 -13
  40. package/dist/contexts/use-components.js +6 -2
  41. package/dist/{index-HDt5wRiR.d.ts → index-Cl6Gny0o.d.ts} +37 -2
  42. package/dist/index.d.ts +4 -14
  43. package/dist/index.js +7 -30
  44. package/dist/languages/cli.d.ts +38 -14
  45. package/dist/languages/cli.js +166 -20
  46. package/dist/languages/csharp.d.ts +42 -14
  47. package/dist/languages/csharp.js +283 -8
  48. package/dist/languages/go.d.ts +40 -14
  49. package/dist/languages/go.js +303 -8
  50. package/dist/languages/http.d.ts +46 -14
  51. package/dist/languages/http.js +390 -19
  52. package/dist/languages/index.d.ts +51 -14
  53. package/dist/languages/index.js +32 -28
  54. package/dist/languages/java.d.ts +43 -14
  55. package/dist/languages/java.js +403 -8
  56. package/dist/languages/php.d.ts +40 -0
  57. package/dist/languages/php.js +313 -0
  58. package/dist/languages/python.d.ts +40 -14
  59. package/dist/languages/python.js +269 -8
  60. package/dist/languages/ruby.d.ts +40 -14
  61. package/dist/languages/ruby.js +387 -8
  62. package/dist/languages/terraform.d.ts +48 -14
  63. package/dist/languages/terraform.js +243 -8
  64. package/dist/languages/typescript.d.ts +40 -14
  65. package/dist/languages/typescript.js +449 -8
  66. package/dist/markdown/index.d.ts +1 -2
  67. package/dist/markdown/index.js +1 -28
  68. package/dist/markdown/printer.d.ts +2 -2
  69. package/dist/markdown/printer.js +6 -30
  70. package/dist/markdown/utils.d.ts +3 -3
  71. package/dist/routing.d.ts +61 -2
  72. package/dist/routing.js +205 -2
  73. package/dist/spec.d.ts +2 -2
  74. package/dist/spec.js +2 -2
  75. package/dist/style.js +176 -1
  76. package/dist/use-strict-context-L0c8JKg4.js +16 -0
  77. package/dist/utils.d.ts +1 -1
  78. package/dist/utils.js +53 -2
  79. package/package.json +3 -3
  80. package/dist/breadcrumbs-Dei_5sHd.d.ts +0 -25
  81. package/dist/breadcrumbs-oUp-6oJK.js +0 -63
  82. package/dist/cli-BX9ofVCR.js +0 -166
  83. package/dist/component-Dl5ZEHxB.js +0 -23
  84. package/dist/component-generics-C9ALAcZI.d.ts +0 -30
  85. package/dist/component-generics-POFirVVb.js +0 -45
  86. package/dist/components-DQPlXEwE.js +0 -72
  87. package/dist/contexts-_NNW5yqC.js +0 -44
  88. package/dist/csharp-sn5CJu9t.js +0 -283
  89. package/dist/docs-YgoQ3bzY.js +0 -81
  90. package/dist/docs-x-kfjRMc.d.ts +0 -66
  91. package/dist/go-BoaAVmP0.js +0 -303
  92. package/dist/http-Ccj1dOvE.js +0 -389
  93. package/dist/icons-BYKn5X8E.js +0 -885
  94. package/dist/index-OCM-LZIo.d.ts +0 -428
  95. package/dist/java-BiLRuLuD.js +0 -403
  96. package/dist/languages-COjc0Nwx.js +0 -30
  97. package/dist/markdown-BszOPZhh.d.ts +0 -22
  98. package/dist/markdown-Cq3XEhrR.js +0 -49
  99. package/dist/method-DjzVBzZe.js +0 -96
  100. package/dist/method-KkWyhvKa.d.ts +0 -59
  101. package/dist/navigation-BZjwfN2P.d.ts +0 -29
  102. package/dist/navigation-aoYZ_tl4.js +0 -24
  103. package/dist/overview-BNmMeDUE.d.ts +0 -39
  104. package/dist/overview-Clq5psZe.js +0 -138
  105. package/dist/primitives-B8OnSXRP.d.ts +0 -105
  106. package/dist/primitives-BBUs_flm.js +0 -250
  107. package/dist/properties-BhlRtWo4.d.ts +0 -54
  108. package/dist/properties-DQU0NBzb.js +0 -138
  109. package/dist/python-nqOBH7GS.js +0 -269
  110. package/dist/routing-GvhEMw6E.js +0 -205
  111. package/dist/routing-qJMPICGo.d.ts +0 -61
  112. package/dist/ruby-BBc8HdIt.js +0 -387
  113. package/dist/sdk-C8C6IRQp.d.ts +0 -122
  114. package/dist/sdk-DzCHhEoX.js +0 -405
  115. package/dist/sdk-sidebar-CkjSLggl.js +0 -50
  116. package/dist/sdk-sidebar-lgNmf-ns.d.ts +0 -15
  117. package/dist/snippets-CLpNVNlA.js +0 -181
  118. package/dist/stl-sidebar-8jF9cdnn.d.ts +0 -58
  119. package/dist/stl-sidebar-DC5UOJiT.js +0 -106
  120. package/dist/style-DJIYkFhO.js +0 -178
  121. package/dist/terraform-DVx2ea2h.js +0 -243
  122. package/dist/typescript-Cmk-jBBw.js +0 -449
  123. package/dist/use-components-BUz3GbO4.js +0 -7
  124. package/dist/utils-D6zJxUZ9.js +0 -54
@@ -1,138 +0,0 @@
1
- import { l as useSettings, o as useIgnoredResources, s as useLanguage } from "./docs-YgoQ3bzY.js";
2
- import { t as useComponents } from "./use-components-BUz3GbO4.js";
3
- import { t as style_default } from "./style-DJIYkFhO.js";
4
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
- import { ArrowDownWideNarrowIcon, ArrowUpNarrowWideIcon } from "lucide-react";
6
-
7
- //#region src/components/properties.tsx
8
- function PropertyToggle({ target }) {
9
- return /* @__PURE__ */ jsxs("span", {
10
- className: style_default.ExpandToggle,
11
- "data-stldocs-property-toggle-expanded": "false",
12
- "data-stldocs-property-toggle-target": target,
13
- children: [/* @__PURE__ */ jsxs("span", {
14
- className: style_default.ExpandToggleContent,
15
- children: ["Expand ", /* @__PURE__ */ jsx(ArrowDownWideNarrowIcon, {
16
- className: style_default.Icon,
17
- size: 16
18
- })]
19
- }), /* @__PURE__ */ jsxs("span", {
20
- className: style_default.ExpandToggleContent,
21
- children: ["Collapse ", /* @__PURE__ */ jsx(ArrowUpNarrowWideIcon, {
22
- className: style_default.Icon,
23
- size: 16
24
- })]
25
- })]
26
- });
27
- }
28
- function PropertyDescription({ description }) {
29
- const { Markdown } = useComponents();
30
- if (description) return /* @__PURE__ */ jsx("div", {
31
- className: style_default.PropertyDescription,
32
- children: /* @__PURE__ */ jsx(Markdown, { content: description })
33
- });
34
- }
35
- function PropertyTitle({ title }) {
36
- const { Markdown } = useComponents();
37
- if (title) return /* @__PURE__ */ jsx("div", {
38
- className: style_default.PropertyTitle,
39
- children: /* @__PURE__ */ jsx(Markdown, { content: title })
40
- });
41
- }
42
- function splitDescription(description) {
43
- const pos = description?.indexOf("\n\n");
44
- if (!description || !pos || pos < 0) return [description, null];
45
- return [description.slice(0, pos), description.slice(pos)];
46
- }
47
- function Property({ id, name, typeName, badges, type, declaration, description, title, deprecated, expand, additional, constraints, children }) {
48
- const Docs = useComponents();
49
- const language = useLanguage();
50
- const properties = useSettings()?.properties;
51
- if (useIgnoredResources().includes(id || "")) return null;
52
- const { collapseDescription, showTitle } = properties ?? {};
53
- const types = properties?.types;
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
- })
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
- })
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
- name && /* @__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
- }),
100
- badges && /* @__PURE__ */ jsx("span", {
101
- className: style_default.PropertyBadges,
102
- children: badges
103
- })
104
- ]
105
- }),
106
- type && /* @__PURE__ */ jsx("div", {
107
- className: style_default.PropertyType,
108
- children: type
109
- }),
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__ */ jsx("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
- })
132
- ]
133
- }) : content
134
- });
135
- }
136
-
137
- //#endregion
138
- export { PropertyToggle as i, PropertyDescription as n, PropertyTitle as r, Property as t };
@@ -1,269 +0,0 @@
1
- import { t as __exportAll } from "./chunk-BN_g-Awi.js";
2
- import { n as useLanguageComponents } from "./contexts-_NNW5yqC.js";
3
- import { t as useComponents } from "./use-components-BUz3GbO4.js";
4
- import { t as style_default } from "./style-DJIYkFhO.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 };
@@ -1,205 +0,0 @@
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)).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 };
@@ -1,61 +0,0 @@
1
- import { _ as Spec, d as Method, f as Model, m as Resource } from "./index-HDt5wRiR.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 };