@stainless-api/docs-ui 0.1.0-beta.72 → 0.1.0-beta.74

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 (135) hide show
  1. package/dist/{chunk-BN_g-Awi.js → chunk-BYypO7fO.js} +3 -3
  2. package/dist/components/MaskedInput.d.ts +1 -1
  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 +12 -12
  7. package/dist/components/icons.js +883 -1
  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 +404 -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-W4Td2Hl7.d.ts → index-PdnFhQF9.d.ts} +1 -1
  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 +50 -14
  53. package/dist/languages/index.js +30 -28
  54. package/dist/languages/java.d.ts +43 -14
  55. package/dist/languages/java.js +403 -8
  56. package/dist/languages/python.d.ts +40 -14
  57. package/dist/languages/python.js +269 -8
  58. package/dist/languages/ruby.d.ts +40 -14
  59. package/dist/languages/ruby.js +387 -8
  60. package/dist/languages/terraform.d.ts +48 -14
  61. package/dist/languages/terraform.js +243 -8
  62. package/dist/languages/typescript.d.ts +40 -14
  63. package/dist/languages/typescript.js +449 -8
  64. package/dist/markdown/index.d.ts +1 -2
  65. package/dist/markdown/index.js +1 -28
  66. package/dist/markdown/printer.d.ts +2 -2
  67. package/dist/markdown/printer.js +6 -30
  68. package/dist/markdown/utils.d.ts +3 -3
  69. package/dist/routing.d.ts +61 -2
  70. package/dist/routing.js +204 -2
  71. package/dist/spec.d.ts +4 -4
  72. package/dist/spec.js +2 -2
  73. package/dist/style.js +176 -1
  74. package/dist/use-strict-context-L0c8JKg4.js +16 -0
  75. package/dist/utils.d.ts +1 -1
  76. package/dist/utils.js +53 -2
  77. package/package.json +3 -3
  78. package/dist/breadcrumbs-46Qjx1Pd.d.ts +0 -25
  79. package/dist/breadcrumbs-BZ4wBC9-.d.ts +0 -25
  80. package/dist/breadcrumbs-BiBfNqBI.js +0 -63
  81. package/dist/cli-hduQ5XS1.js +0 -166
  82. package/dist/component-BU8BTbqz.js +0 -23
  83. package/dist/component-generics-Bw4ZOyEG.d.ts +0 -30
  84. package/dist/component-generics-D-WarFUb.d.ts +0 -30
  85. package/dist/component-generics-POFirVVb.js +0 -45
  86. package/dist/components-9NMl1791.js +0 -72
  87. package/dist/contexts-_NNW5yqC.js +0 -44
  88. package/dist/csharp-sn5CJu9t.js +0 -283
  89. package/dist/docs-Cu9Yl6-y.d.ts +0 -66
  90. package/dist/docs-YgoQ3bzY.js +0 -81
  91. package/dist/docs-xb5wYGjM.d.ts +0 -66
  92. package/dist/go-BoaAVmP0.js +0 -303
  93. package/dist/http-B3qTyMc3.js +0 -389
  94. package/dist/icons-BYKn5X8E.js +0 -885
  95. package/dist/index-BOmn7DHa.d.ts +0 -428
  96. package/dist/index-BvcPmB0r.d.ts +0 -428
  97. package/dist/java-BiLRuLuD.js +0 -403
  98. package/dist/languages-vUhD5Hu_.js +0 -30
  99. package/dist/markdown-BszOPZhh.d.ts +0 -22
  100. package/dist/markdown-Cq3XEhrR.js +0 -49
  101. package/dist/markdown-plMAoN22.d.ts +0 -22
  102. package/dist/method-C4PgTWAu.d.ts +0 -59
  103. package/dist/method-D6R_farj.d.ts +0 -59
  104. package/dist/method-DjzVBzZe.js +0 -96
  105. package/dist/navigation-HiZWRl34.d.ts +0 -29
  106. package/dist/navigation-MrP4Ubbg.d.ts +0 -29
  107. package/dist/navigation-aoYZ_tl4.js +0 -24
  108. package/dist/overview-CTeKhpQq.d.ts +0 -39
  109. package/dist/overview-Yf1PTJNi.d.ts +0 -39
  110. package/dist/overview-ocTARt-j.js +0 -138
  111. package/dist/primitives-CNG-fEhQ.js +0 -250
  112. package/dist/primitives-K7NijV36.d.ts +0 -105
  113. package/dist/primitives-WGxdBJDS.d.ts +0 -105
  114. package/dist/properties-Bu4nW9JD.d.ts +0 -54
  115. package/dist/properties-Bynmj9_H.d.ts +0 -54
  116. package/dist/properties-DQU0NBzb.js +0 -138
  117. package/dist/python-nqOBH7GS.js +0 -269
  118. package/dist/routing-C64k4fmX.js +0 -205
  119. package/dist/routing-pAL4V4hv.d.ts +0 -61
  120. package/dist/ruby-BBc8HdIt.js +0 -387
  121. package/dist/sdk-BSdgEEJw.js +0 -405
  122. package/dist/sdk-BVCk1ox2.d.ts +0 -122
  123. package/dist/sdk-Dm0S-XQE.d.ts +0 -122
  124. package/dist/sdk-sidebar-B1ehT_xI.d.ts +0 -15
  125. package/dist/sdk-sidebar-BDn8S1xS.js +0 -50
  126. package/dist/sdk-sidebar-Dqeu7C1-.d.ts +0 -15
  127. package/dist/snippets-CLpNVNlA.js +0 -181
  128. package/dist/stl-sidebar-BTTErIJs.d.ts +0 -58
  129. package/dist/stl-sidebar-C7GNALtk.d.ts +0 -58
  130. package/dist/stl-sidebar-DC5UOJiT.js +0 -106
  131. package/dist/style-DJIYkFhO.js +0 -178
  132. package/dist/terraform-DVx2ea2h.js +0 -243
  133. package/dist/typescript-Cmk-jBBw.js +0 -449
  134. package/dist/use-components-BUz3GbO4.js +0 -7
  135. package/dist/utils-DPbkW1Tz.js +0 -54
@@ -1,243 +0,0 @@
1
- import { t as __exportAll } from "./chunk-BN_g-Awi.js";
2
- import { i as useDeclaration } from "./docs-YgoQ3bzY.js";
3
- import { n as useLanguageComponents } from "./contexts-_NNW5yqC.js";
4
- import { t as useComponents } from "./use-components-BUz3GbO4.js";
5
- import { t as style_default } from "./style-DJIYkFhO.js";
6
- import "react";
7
- import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
- import clsx from "clsx";
9
- import { Badge, Callout } from "@stainless-api/ui-primitives";
10
-
11
- //#region src/languages/terraform.tsx
12
- var terraform_exports = /* @__PURE__ */ __exportAll({
13
- Declaration: () => Declaration,
14
- MethodSignature: () => MethodSignature,
15
- Property: () => Property,
16
- Resource: () => Resource,
17
- TerraformSource: () => TerraformSource,
18
- Type: () => Type,
19
- TypeName: () => TypeName
20
- });
21
- function TypeName({ type }) {
22
- return /* @__PURE__ */ jsx(useLanguageComponents().Type, { type });
23
- }
24
- function Type({ type }) {
25
- const Lang = useLanguageComponents();
26
- const { Join } = useComponents();
27
- switch (type.category) {
28
- case "nested": switch (type.type) {
29
- case "ListNested":
30
- case "MapNested":
31
- case "SetNested": return /* @__PURE__ */ jsxs("span", {
32
- className: style_default.Type,
33
- children: [
34
- /* @__PURE__ */ jsx("span", {
35
- className: style_default.TypeArray,
36
- children: type.type.replace("Nested", "")
37
- }),
38
- /* @__PURE__ */ jsx("span", {
39
- className: style_default.TypeBracket,
40
- children: "["
41
- }),
42
- /* @__PURE__ */ jsx("span", {
43
- className: style_default.TypeReference,
44
- children: "Attributes"
45
- }),
46
- /* @__PURE__ */ jsx("span", {
47
- className: style_default.TypeBracket,
48
- children: "]"
49
- })
50
- ]
51
- });
52
- case "SingleNested": return /* @__PURE__ */ jsx("span", {
53
- className: style_default.Type,
54
- children: /* @__PURE__ */ jsx("span", {
55
- className: style_default.TypeReference,
56
- children: "Attributes"
57
- })
58
- });
59
- default: return;
60
- }
61
- case "collection": return /* @__PURE__ */ jsxs("span", {
62
- className: style_default.Type,
63
- children: [
64
- /* @__PURE__ */ jsx("span", {
65
- className: style_default.TypeArray,
66
- children: type.type
67
- }),
68
- /* @__PURE__ */ jsx("span", {
69
- className: style_default.TypeBracket,
70
- children: "["
71
- }),
72
- /* @__PURE__ */ jsx(Lang.Type, { type: type.elementType }),
73
- /* @__PURE__ */ jsx("span", {
74
- className: style_default.TypeBracket,
75
- children: "]"
76
- })
77
- ]
78
- });
79
- case "dynamic": {
80
- const subtypes = type.allowedSubtypes.length > 0 ? /* @__PURE__ */ jsx(Join, {
81
- items: type.allowedSubtypes,
82
- children: " | "
83
- }) : null;
84
- return /* @__PURE__ */ jsx("span", {
85
- className: style_default.Type,
86
- children: /* @__PURE__ */ jsxs("span", {
87
- className: style_default.TypeKeyword,
88
- children: ["Dynamic ", subtypes]
89
- })
90
- });
91
- }
92
- case "primitive":
93
- if (type.type === "String") return /* @__PURE__ */ jsx("span", {
94
- className: style_default.Type,
95
- children: /* @__PURE__ */ jsx("span", {
96
- className: style_default.TypeString,
97
- children: "String"
98
- })
99
- });
100
- return /* @__PURE__ */ jsx("span", {
101
- className: style_default.Type,
102
- children: /* @__PURE__ */ jsx("span", {
103
- className: style_default.TypeKeyword,
104
- children: type.type
105
- })
106
- });
107
- case "unknown": return /* @__PURE__ */ jsx("span", {
108
- className: style_default.Type,
109
- children: /* @__PURE__ */ jsx("span", {
110
- className: style_default.TypeKeyword,
111
- children: "JSON"
112
- })
113
- });
114
- }
115
- }
116
- function MethodSignature() {
117
- return null;
118
- }
119
- const PropGroups = [
120
- "required",
121
- "optional",
122
- "computed"
123
- ];
124
- function Property({ decl, children }) {
125
- if (!decl) return null;
126
- switch (decl.kind) {
127
- case "TerraformDeclAttribute": return children({ name: decl.name });
128
- }
129
- }
130
- function TerraformSource({ path, group }) {
131
- const Docs = useComponents();
132
- const decl = useDeclaration(path, true);
133
- if (decl.kind !== "TerraformDeclSource") return;
134
- const type = decl.type === "resource" ? "resource" : "data";
135
- const badge = type === "resource" ? `success` : `note`;
136
- const children = PropGroups.filter((section) => decl[section].length > 0).map((section) => {
137
- const propGroupId = `${decl.name}-${section}-${group}`;
138
- return /* @__PURE__ */ jsxs("div", {
139
- className: style_default.ResourceContentGroup,
140
- children: [/* @__PURE__ */ jsxs("h5", {
141
- className: style_default.ResourceContentGroupModelTitle,
142
- children: [
143
- section,
144
- " ",
145
- /* @__PURE__ */ jsx(Docs.PropertyToggle, { target: propGroupId })
146
- ]
147
- }), /* @__PURE__ */ jsx("div", {
148
- className: style_default.ResourceContentProperties,
149
- "data-stldocs-property-group": propGroupId,
150
- children: /* @__PURE__ */ jsx(Docs.SDKChildren, { paths: decl[section] })
151
- })]
152
- }, section);
153
- });
154
- return /* @__PURE__ */ jsx("div", {
155
- className: clsx(style_default.Method, style_default.MethodDoublePane),
156
- children: /* @__PURE__ */ jsxs("div", {
157
- className: style_default.MethodBody,
158
- children: [/* @__PURE__ */ jsxs("div", {
159
- className: style_default.MethodContentColumn,
160
- children: [/* @__PURE__ */ jsxs("h4", {
161
- className: style_default.TerraformResourceTitle,
162
- children: [
163
- /* @__PURE__ */ jsx(Badge, {
164
- intent: badge,
165
- children: type
166
- }),
167
- " ",
168
- decl.name
169
- ]
170
- }), children]
171
- }), /* @__PURE__ */ jsx("div", {
172
- className: clsx(style_default.MethodExample, "not-content", "stl-ui-not-prose"),
173
- children: /* @__PURE__ */ jsx(Docs.SDKExample, { method: {
174
- title: decl.name,
175
- stainlessPath: path
176
- } })
177
- })]
178
- })
179
- });
180
- }
181
- function Declaration({ decl }) {
182
- const Lang = useLanguageComponents();
183
- if (!decl) return;
184
- switch (decl.kind) {
185
- case "TerraformDeclAttribute": {
186
- const isOptional = decl.configurability === "optional" || decl.configurability === "computed_optional";
187
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [
188
- /* @__PURE__ */ jsx("span", {
189
- className: style_default.TextIdentifier,
190
- children: decl.name
191
- }),
192
- isOptional && /* @__PURE__ */ jsx("span", {
193
- className: style_default.TextPunctuation,
194
- children: "?"
195
- }),
196
- /* @__PURE__ */ jsx("span", {
197
- className: style_default.TextPunctuation,
198
- children: ": "
199
- }),
200
- /* @__PURE__ */ jsx("span", {
201
- className: style_default.TextKeyword,
202
- children: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
203
- })
204
- ] });
205
- }
206
- case "TerraformDeclServiceNode": {
207
- const { resource, dataSource, listDataSource } = decl;
208
- return /* @__PURE__ */ jsxs("div", {
209
- className: style_default.Method,
210
- children: [
211
- resource && /* @__PURE__ */ jsx(TerraformSource, {
212
- path: resource,
213
- group: "resource"
214
- }),
215
- dataSource && /* @__PURE__ */ jsx(TerraformSource, {
216
- path: dataSource,
217
- group: "dataSource"
218
- }),
219
- listDataSource && /* @__PURE__ */ jsx(TerraformSource, {
220
- path: listDataSource,
221
- group: "listDataSource"
222
- })
223
- ]
224
- });
225
- }
226
- }
227
- }
228
- function Resource({ resource }) {
229
- const Lang = useLanguageComponents();
230
- const decl = useDeclaration(resource.stainlessPath, false);
231
- if (decl) return /* @__PURE__ */ jsx(Lang.Declaration, { decl });
232
- return /* @__PURE__ */ jsxs(Callout, {
233
- variant: "warning",
234
- children: [
235
- "The resource ",
236
- /* @__PURE__ */ jsx("code", { children: resource.name }),
237
- " is not supported in Terraform."
238
- ]
239
- });
240
- }
241
-
242
- //#endregion
243
- export { TerraformSource as a, terraform_exports as c, Resource as i, MethodSignature as n, Type as o, Property as r, TypeName as s, Declaration as t };
@@ -1,449 +0,0 @@
1
- import { t as __exportAll } from "./chunk-BN_g-Awi.js";
2
- import { i as useDeclaration, m as useSpec, s as useLanguage } from "./docs-YgoQ3bzY.js";
3
- import { n as useLanguageComponents } from "./contexts-_NNW5yqC.js";
4
- import { t as useComponents } from "./use-components-BUz3GbO4.js";
5
- import { t as style_default } from "./style-DJIYkFhO.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/typescript.tsx
10
- var typescript_exports = /* @__PURE__ */ __exportAll({
11
- Declaration: () => Declaration,
12
- MethodSignature: () => MethodSignature,
13
- Property: () => Property,
14
- Type: () => Type,
15
- TypeName: () => TypeName
16
- });
17
- const ComplexTypes = {
18
- TSTypeObject: "object",
19
- TSTypeUnion: "union",
20
- TSTypeInterface: "interface",
21
- TSTypeIntersection: "intersection",
22
- TSTypeArray: "array"
23
- };
24
- const constStyle = {
25
- string: style_default.LiteralString,
26
- number: style_default.LiteralNumeric,
27
- boolean: style_default.LiteralBoolean
28
- };
29
- function Identifier({ name, optional }) {
30
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
31
- className: style_default.TextIdentifier,
32
- children: /^[_a-zA-Z][_a-zA-Z0-9]*$/.test(name) ? name : JSON.stringify(name)
33
- }), optional && /* @__PURE__ */ jsx("span", {
34
- className: style_default.TextPunctuation,
35
- children: "?"
36
- })] });
37
- }
38
- function TypeParams({ params }) {
39
- const Lang = useLanguageComponents();
40
- const { Join } = useComponents();
41
- if (!params?.length) return null;
42
- const typeParams = params?.map((param, key) => param.constraint ? /* @__PURE__ */ jsxs(React$1.Fragment, { children: [
43
- /* @__PURE__ */ jsx("span", {
44
- className: style_default.TypeReference,
45
- children: param.name
46
- }),
47
- /* @__PURE__ */ jsx("span", {
48
- className: style_default.TextKeyword,
49
- children: "extends "
50
- }),
51
- /* @__PURE__ */ jsx(Lang.Type, { type: param.constraint })
52
- ] }, key) : /* @__PURE__ */ jsx(React$1.Fragment, { children: "param.name" }, key));
53
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [
54
- /* @__PURE__ */ jsx("span", {
55
- className: style_default.TypeBracket,
56
- children: "<"
57
- }),
58
- /* @__PURE__ */ jsx(Join, {
59
- items: typeParams,
60
- limit: 3,
61
- children: /* @__PURE__ */ jsx("span", {
62
- className: style_default.TextOperator,
63
- children: ", "
64
- })
65
- }),
66
- /* @__PURE__ */ jsx("span", {
67
- className: style_default.TypeBracket,
68
- children: ">"
69
- })
70
- ] });
71
- }
72
- function TypePreview({ path }) {
73
- const spec = useSpec();
74
- const language = useLanguage();
75
- const decl = useDeclaration(path, false);
76
- const { Join } = useComponents();
77
- if (!(decl && "children" in decl && decl.children && decl.children.length > 0) || decl && "type" in decl && decl.type !== void 0 && "kind" in decl["type"] && decl["type"]["kind"] === "TSTypeUnion") return;
78
- const items = decl.children.map((prop, key) => {
79
- const p = spec?.decls?.[language]?.[prop];
80
- return /* @__PURE__ */ jsx("span", {
81
- className: style_default.TypePropertyName,
82
- children: /* @__PURE__ */ jsx("span", {
83
- className: style_default.TextIdentifier,
84
- children: p && "key" in p ? p["key"] : null
85
- })
86
- }, key);
87
- });
88
- return /* @__PURE__ */ jsxs("span", {
89
- className: style_default.TypePreview,
90
- "data-stldocs-type-preview": "properties",
91
- children: [
92
- /* @__PURE__ */ jsx("span", {
93
- className: style_default.TypeBrace,
94
- children: " {"
95
- }),
96
- /* @__PURE__ */ jsxs("span", {
97
- className: style_default.TypePreviewContent,
98
- children: [
99
- " ",
100
- /* @__PURE__ */ jsx(Join, {
101
- items,
102
- limit: 3,
103
- children: /* @__PURE__ */ jsx("span", {
104
- className: style_default.TextOperator,
105
- children: ", "
106
- })
107
- }),
108
- " "
109
- ]
110
- }),
111
- /* @__PURE__ */ jsx("span", {
112
- className: style_default.TypeBrace,
113
- children: "} "
114
- })
115
- ]
116
- });
117
- }
118
- function TypeName({ type }) {
119
- const Lang = useLanguageComponents();
120
- return ComplexTypes[type.kind] ?? /* @__PURE__ */ jsx(Lang.Type, { type });
121
- }
122
- function Type({ type }) {
123
- const Lang = useLanguageComponents();
124
- const { Join, SDKReference } = useComponents();
125
- switch (type.kind) {
126
- case "TSTypeUnknown":
127
- case "TSTypeUndefined":
128
- case "TSTypeNever":
129
- case "TSTypeVoid":
130
- case "TSTypeNull":
131
- case "TSTypeAny":
132
- case "TSTypeBoolean":
133
- case "TSTypeNumber": return /* @__PURE__ */ jsx("span", {
134
- className: style_default.Type,
135
- children: /* @__PURE__ */ jsx("span", {
136
- className: style_default.TypeKeyword,
137
- children: type.kind.slice(6).toLowerCase()
138
- })
139
- });
140
- case "TSTypeString": return /* @__PURE__ */ jsx("span", {
141
- className: style_default.Type,
142
- children: /* @__PURE__ */ jsx("span", {
143
- className: style_default.TypeString,
144
- children: "string"
145
- })
146
- });
147
- case "TSTypeLiteral": return /* @__PURE__ */ jsx("span", {
148
- className: style_default.Type,
149
- children: /* @__PURE__ */ jsx("span", {
150
- className: constStyle[typeof type.literal],
151
- children: JSON.stringify(type.literal)
152
- })
153
- });
154
- case "TSTypeArray": return /* @__PURE__ */ jsxs("span", {
155
- className: style_default.Type,
156
- children: [
157
- /* @__PURE__ */ jsx("span", {
158
- className: style_default.TypeArray,
159
- children: "Array<"
160
- }),
161
- /* @__PURE__ */ jsx(Lang.Type, { type: type.elementType }),
162
- /* @__PURE__ */ jsx("span", {
163
- className: style_default.TypeArray,
164
- children: ">"
165
- })
166
- ]
167
- });
168
- case "TSTypeReference": {
169
- const name = type.ident.split(".").at(-1);
170
- const params = type.typeParameters?.map((param, key) => /* @__PURE__ */ jsx(Lang.Type, { type: param }, key));
171
- return /* @__PURE__ */ jsxs("span", {
172
- className: style_default.Type,
173
- children: [
174
- /* @__PURE__ */ jsx(SDKReference, {
175
- stainlessPath: type.$ref,
176
- children: name
177
- }),
178
- params && params.length > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [
179
- /* @__PURE__ */ jsx("span", {
180
- className: style_default.TypeBracket,
181
- children: "<"
182
- }),
183
- /* @__PURE__ */ jsx(Join, {
184
- items: params,
185
- limit: 3,
186
- children: /* @__PURE__ */ jsx("span", {
187
- className: style_default.TextOperator,
188
- children: ", "
189
- })
190
- }),
191
- /* @__PURE__ */ jsx("span", {
192
- className: style_default.TypeBracket,
193
- children: ">"
194
- })
195
- ] }),
196
- /* @__PURE__ */ jsx(TypePreview, { path: type.$ref })
197
- ]
198
- });
199
- }
200
- case "TSTypeIntersection":
201
- case "TSTypeUnion": {
202
- const items = type.types.map((t, key) => /* @__PURE__ */ jsx(Lang.Type, { type: t }, key));
203
- const delimiter = type.kind === "TSTypeUnion" ? "|" : "&";
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 "TSTypeObject":
228
- case "TSTypeInterface": {
229
- const extend = type.kind === "TSTypeObject" ? null : type.extends?.map((ref, key) => /* @__PURE__ */ jsx(Lang.Type, { type: ref }, key));
230
- const items = type.members.map((prop, key) => /* @__PURE__ */ jsxs(React$1.Fragment, { children: [
231
- /* @__PURE__ */ jsx("span", {
232
- className: style_default.TypePropertyName,
233
- children: /* @__PURE__ */ jsx(Identifier, {
234
- name: prop.ident,
235
- optional: prop.optional
236
- })
237
- }),
238
- /* @__PURE__ */ jsx("span", {
239
- className: style_default.TextPunctuation,
240
- children: ": "
241
- }),
242
- /* @__PURE__ */ jsx(Lang.Type, { type: prop.type })
243
- ] }, key));
244
- return /* @__PURE__ */ jsxs("span", {
245
- className: style_default.Type,
246
- children: [extend?.length && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
247
- className: style_default.TypeKeyword,
248
- children: " extends "
249
- }), /* @__PURE__ */ jsx(Join, {
250
- items: extend,
251
- limit: 3,
252
- children: /* @__PURE__ */ jsx("span", {
253
- className: style_default.TextOperator,
254
- children: ", "
255
- })
256
- })] }), /* @__PURE__ */ jsxs("span", {
257
- className: style_default.TypePreview,
258
- "data-stldocs-type-preview": "properties",
259
- children: [
260
- /* @__PURE__ */ jsx("span", {
261
- className: style_default.TypeBrace,
262
- children: "{ "
263
- }),
264
- /* @__PURE__ */ jsx("span", {
265
- className: style_default.TypePreviewContent,
266
- children: /* @__PURE__ */ jsx(Join, {
267
- items,
268
- limit: 3,
269
- children: /* @__PURE__ */ jsx("span", {
270
- className: style_default.TextOperator,
271
- children: ", "
272
- })
273
- })
274
- }),
275
- /* @__PURE__ */ jsx("span", {
276
- className: style_default.TypeBrace,
277
- children: "} "
278
- })
279
- ]
280
- })]
281
- });
282
- }
283
- }
284
- }
285
- function MethodSignature({ decl }) {
286
- const Lang = useLanguageComponents();
287
- const { Join, Tooltip } = useComponents();
288
- const params = decl.signature.parameters.map((param, i) => /* @__PURE__ */ jsxs(React$1.Fragment, { children: [/* @__PURE__ */ jsx(Tooltip, {
289
- content: /* @__PURE__ */ jsx(Lang.Type, { type: param.type }),
290
- children: /* @__PURE__ */ jsx("span", {
291
- className: style_default.TextIdentifier,
292
- children: param.ident
293
- })
294
- }), param.optional && /* @__PURE__ */ jsx("span", {
295
- className: style_default.TextPunctuation,
296
- children: "?"
297
- })] }, i));
298
- return /* @__PURE__ */ jsx("div", {
299
- className: style_default.MethodSignature,
300
- children: /* @__PURE__ */ jsxs("span", {
301
- className: style_default.SignatureTitle,
302
- children: [
303
- decl.signature.async && /* @__PURE__ */ jsx("span", {
304
- className: style_default.TextKeyword,
305
- children: "async "
306
- }),
307
- /* @__PURE__ */ jsx("span", {
308
- className: style_default.SignatureQualified,
309
- children: /* @__PURE__ */ jsx("span", {
310
- className: style_default.TextIdentifier,
311
- children: decl.qualified?.slice(0, -decl.ident.length)
312
- })
313
- }),
314
- /* @__PURE__ */ jsx("span", {
315
- className: style_default.SignatureName,
316
- children: /* @__PURE__ */ jsx("span", {
317
- className: style_default.TextIdentifier,
318
- children: decl.ident
319
- })
320
- }),
321
- /* @__PURE__ */ jsxs("span", {
322
- className: style_default.MethodSignature,
323
- children: [
324
- decl.signature.typeParameters && /* @__PURE__ */ jsx(TypeParams, { params: decl.signature.typeParameters }),
325
- /* @__PURE__ */ jsx("span", {
326
- className: style_default.SignatureParen,
327
- children: "("
328
- }),
329
- /* @__PURE__ */ jsx("span", {
330
- className: style_default.SignatureParams,
331
- children: /* @__PURE__ */ jsx(Join, {
332
- items: params,
333
- children: /* @__PURE__ */ jsx("span", {
334
- className: style_default.TextOperator,
335
- children: ", "
336
- })
337
- })
338
- }),
339
- /* @__PURE__ */ jsx("span", {
340
- className: style_default.SignatureParen,
341
- children: ")"
342
- }),
343
- decl.signature.returns && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
344
- className: style_default.TextPunctuation,
345
- children: ": "
346
- }), /* @__PURE__ */ jsx(Lang.Type, { type: decl.signature.returns })] })
347
- ]
348
- })
349
- ]
350
- })
351
- });
352
- }
353
- function Property({ decl, children }) {
354
- const Lang = useLanguageComponents();
355
- if (!decl) return;
356
- switch (decl.kind) {
357
- case "TSDeclProperty": return children({
358
- name: decl.key,
359
- typeName: /* @__PURE__ */ jsx(Lang.TypeName, { type: decl.type }),
360
- type: decl.type.kind in ComplexTypes && /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
361
- });
362
- case "TSDeclTypeAlias": return children({
363
- name: decl.ident,
364
- typeName: "alias",
365
- type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
366
- });
367
- case "TSDeclReference": return children({ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type }) });
368
- case "TSDeclInterface": return children({ type: /* @__PURE__ */ jsxs(Fragment$1, { children: [
369
- /* @__PURE__ */ jsx("span", {
370
- className: style_default.TextIdentifier,
371
- children: decl.ident
372
- }),
373
- decl.typeParameters && /* @__PURE__ */ jsx(TypeParams, { params: decl.typeParameters }),
374
- decl.extends?.flatMap((t, key) => /* @__PURE__ */ jsxs(React$1.Fragment, { children: [/* @__PURE__ */ jsx("span", {
375
- className: style_default.TextKeyword,
376
- children: " extends "
377
- }), /* @__PURE__ */ jsx(Lang.Type, { type: t })] }, `extends:${key}`))
378
- ] }) });
379
- }
380
- }
381
- function Declaration({ decl }) {
382
- const Lang = useLanguageComponents();
383
- if (!decl) return;
384
- switch (decl.kind) {
385
- case "TSDeclProperty": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
386
- decl.declare && /* @__PURE__ */ jsx("span", {
387
- className: style_default.TextKeyword,
388
- children: "declare "
389
- }),
390
- /* @__PURE__ */ jsx("span", {
391
- className: style_default.TypePropertyName,
392
- children: /* @__PURE__ */ jsx(Identifier, {
393
- name: decl.key,
394
- optional: decl.optional
395
- })
396
- }),
397
- /* @__PURE__ */ jsx("span", {
398
- className: style_default.TextPunctuation,
399
- children: ": "
400
- }),
401
- /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
402
- ] });
403
- case "TSDeclFunction": return /* @__PURE__ */ jsx(Lang.MethodSignature, { decl });
404
- case "TSDeclTypeAlias": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
405
- /* @__PURE__ */ jsx(Identifier, { name: decl.ident }),
406
- /* @__PURE__ */ jsx(TypeParams, { params: decl.typeParameters }),
407
- /* @__PURE__ */ jsx("span", {
408
- className: style_default.TextOperator,
409
- children: " = "
410
- }),
411
- /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
412
- ] });
413
- case "TSDeclReference": return /* @__PURE__ */ jsx(Lang.Type, { type: decl.type });
414
- case "TSDeclInterface": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
415
- /* @__PURE__ */ jsx("span", {
416
- className: style_default.TextIdentifier,
417
- children: decl.ident
418
- }),
419
- /* @__PURE__ */ jsx(TypeParams, { params: decl.typeParameters }),
420
- decl.extends?.map((t, index) => /* @__PURE__ */ jsxs(React$1.Fragment, { children: [/* @__PURE__ */ jsx("span", {
421
- className: style_default.TextKeyword,
422
- children: " extends "
423
- }), /* @__PURE__ */ jsx(Lang.Type, { type: t })] }, index)),
424
- /* @__PURE__ */ jsx(TypePreview, { path: decl.stainlessPath })
425
- ] });
426
- case "TSDeclClass": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
427
- /* @__PURE__ */ jsx("span", {
428
- className: style_default.TextKeyword,
429
- children: "class "
430
- }),
431
- /* @__PURE__ */ jsx("span", {
432
- className: style_default.TextIdentifier,
433
- children: decl.ident
434
- }),
435
- /* @__PURE__ */ jsx(TypeParams, { params: decl.typeParameters }),
436
- decl.superClass ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
437
- className: style_default.TextKeyword,
438
- children: " extends "
439
- }), /* @__PURE__ */ jsx(Lang.Type, { type: decl.superClass })] }) : null,
440
- decl.implements?.map((t, index) => /* @__PURE__ */ jsxs(React$1.Fragment, { children: [/* @__PURE__ */ jsx("span", {
441
- className: style_default.TextKeyword,
442
- children: " implements "
443
- }), /* @__PURE__ */ jsx(Lang.Type, { type: t })] }, index))
444
- ] });
445
- }
446
- }
447
-
448
- //#endregion
449
- export { TypeName as a, Type as i, MethodSignature as n, typescript_exports as o, Property as r, Declaration as t };
@@ -1,7 +0,0 @@
1
- import { i as useComponents$1 } from "./component-generics-POFirVVb.js";
2
-
3
- //#region src/contexts/use-components.tsx
4
- const useComponents = () => useComponents$1();
5
-
6
- //#endregion
7
- export { useComponents as t };