@stainless-api/docs-ui 0.1.0-beta.8 → 0.1.0-beta.81

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 (155) hide show
  1. package/dist/chunk-BYypO7fO.js +18 -0
  2. package/dist/components/MaskedInput.d.ts +14 -0
  3. package/dist/components/MaskedInput.js +76 -0
  4. package/dist/components/breadcrumbs.d.ts +25 -0
  5. package/dist/components/breadcrumbs.js +64 -0
  6. package/dist/components/icons.d.ts +65 -0
  7. package/dist/components/icons.js +941 -0
  8. package/dist/components/index.d.ts +16 -0
  9. package/dist/components/index.js +75 -0
  10. package/dist/components/method.d.ts +59 -0
  11. package/dist/components/method.js +97 -0
  12. package/dist/components/overview.d.ts +39 -0
  13. package/dist/components/overview.js +139 -0
  14. package/dist/components/primitives.d.ts +107 -0
  15. package/dist/components/primitives.js +253 -0
  16. package/dist/components/properties.d.ts +54 -0
  17. package/dist/components/properties.js +146 -0
  18. package/dist/components/sdk-sidebar.d.ts +15 -0
  19. package/dist/components/sdk-sidebar.js +52 -0
  20. package/dist/components/sdk.d.ts +128 -0
  21. package/dist/components/sdk.js +490 -0
  22. package/dist/components/snippets.d.ts +71 -0
  23. package/dist/components/snippets.js +184 -0
  24. package/dist/components/stl-sidebar.d.ts +58 -0
  25. package/dist/components/stl-sidebar.js +114 -0
  26. package/dist/contexts/component-generics.d.ts +30 -0
  27. package/dist/contexts/component-generics.js +33 -0
  28. package/dist/contexts/component-types.d.ts +8 -0
  29. package/dist/contexts/component-types.js +0 -0
  30. package/dist/contexts/component.d.ts +21 -0
  31. package/dist/contexts/component.js +24 -0
  32. package/dist/contexts/docs.d.ts +62 -0
  33. package/dist/contexts/docs.js +91 -0
  34. package/dist/contexts/index.d.ts +13 -0
  35. package/dist/contexts/index.js +45 -0
  36. package/dist/contexts/markdown.d.ts +22 -0
  37. package/dist/contexts/markdown.js +49 -0
  38. package/dist/contexts/navigation.d.ts +29 -0
  39. package/dist/contexts/navigation.js +24 -0
  40. package/dist/contexts/use-components.d.ts +6 -0
  41. package/dist/contexts/use-components.js +8 -0
  42. package/dist/index-pvh-w1xa.d.ts +1776 -0
  43. package/dist/index.d.ts +7 -0
  44. package/dist/index.js +9 -7542
  45. package/dist/languages/cli.d.ts +38 -0
  46. package/dist/languages/cli.js +167 -0
  47. package/dist/languages/csharp.d.ts +42 -0
  48. package/dist/languages/csharp.js +284 -0
  49. package/dist/languages/go.d.ts +40 -0
  50. package/dist/languages/go.js +304 -0
  51. package/dist/languages/http.d.ts +46 -0
  52. package/dist/languages/http.js +387 -0
  53. package/dist/languages/index.d.ts +51 -0
  54. package/dist/languages/index.js +33 -0
  55. package/dist/languages/java.d.ts +43 -0
  56. package/dist/languages/java.js +404 -0
  57. package/dist/languages/php.d.ts +40 -0
  58. package/dist/languages/php.js +313 -0
  59. package/dist/languages/python.d.ts +40 -0
  60. package/dist/languages/python.js +270 -0
  61. package/dist/languages/ruby.d.ts +40 -0
  62. package/dist/languages/ruby.js +388 -0
  63. package/dist/languages/terraform.d.ts +48 -0
  64. package/dist/languages/terraform.js +244 -0
  65. package/dist/languages/typescript.d.ts +40 -0
  66. package/dist/languages/typescript.js +450 -0
  67. package/dist/markdown/index.d.ts +11 -0
  68. package/dist/markdown/index.js +80 -0
  69. package/dist/markdown/md.d.ts +15 -0
  70. package/dist/markdown/md.js +41 -0
  71. package/dist/markdown/printer.d.ts +13 -0
  72. package/dist/markdown/printer.js +76 -0
  73. package/dist/markdown/utils.d.ts +21 -0
  74. package/dist/markdown/utils.js +31 -0
  75. package/dist/routing.d.ts +61 -0
  76. package/dist/routing.js +176 -150
  77. package/dist/spec.d.ts +65 -0
  78. package/dist/spec.js +167 -0
  79. package/dist/style.d.ts +178 -0
  80. package/dist/style.js +179 -0
  81. package/dist/styles/main.css +784 -752
  82. package/dist/styles/main.js +0 -0
  83. package/dist/styles/primitives.css +408 -446
  84. package/dist/styles/primitives.js +0 -0
  85. package/dist/styles/resets.css +32 -41
  86. package/dist/styles/resets.js +0 -0
  87. package/dist/styles/search.css +192 -270
  88. package/dist/styles/search.js +0 -0
  89. package/dist/styles/sidebar.css +182 -69
  90. package/dist/styles/sidebar.js +0 -0
  91. package/dist/styles/variables.css +28 -89
  92. package/dist/styles/variables.js +0 -0
  93. package/dist/styles.css +3423 -0
  94. package/dist/styles.mjs +1 -0
  95. package/dist/use-strict-context-L0c8JKg4.js +16 -0
  96. package/dist/utils.d.ts +20 -0
  97. package/dist/utils.js +54 -0
  98. package/package.json +74 -22
  99. package/dist/mcp.js +0 -16003
  100. package/dist/styles/snippets.css +0 -132
  101. package/src/components/breadcrumbs.tsx +0 -94
  102. package/src/components/chat.tsx +0 -154
  103. package/src/components/dropdown.tsx +0 -91
  104. package/src/components/icons.tsx +0 -584
  105. package/src/components/index.ts +0 -9
  106. package/src/components/method.tsx +0 -146
  107. package/src/components/overview.tsx +0 -160
  108. package/src/components/primitives.tsx +0 -284
  109. package/src/components/properties.tsx +0 -130
  110. package/src/components/scripts/dropdown.ts +0 -78
  111. package/src/components/sdk.tsx +0 -403
  112. package/src/components/sidebar.tsx +0 -99
  113. package/src/components/snippets.tsx +0 -180
  114. package/src/contexts/component-generics.tsx +0 -48
  115. package/src/contexts/component-types.tsx +0 -5
  116. package/src/contexts/component.tsx +0 -32
  117. package/src/contexts/docs.tsx +0 -75
  118. package/src/contexts/index.tsx +0 -17
  119. package/src/contexts/markdown.tsx +0 -43
  120. package/src/contexts/navigation.tsx +0 -44
  121. package/src/contexts/search.tsx +0 -28
  122. package/src/contexts/use-components.tsx +0 -4
  123. package/src/index.ts +0 -6
  124. package/src/languages/go.tsx +0 -281
  125. package/src/languages/http.tsx +0 -321
  126. package/src/languages/index.ts +0 -26
  127. package/src/languages/java.tsx +0 -358
  128. package/src/languages/python.tsx +0 -255
  129. package/src/languages/ruby.tsx +0 -320
  130. package/src/languages/typescript.tsx +0 -393
  131. package/src/markdown/index.ts +0 -107
  132. package/src/markdown/md.ts +0 -45
  133. package/src/markdown/utils.ts +0 -49
  134. package/src/routing.ts +0 -238
  135. package/src/search/form.tsx +0 -127
  136. package/src/search/index.tsx +0 -1
  137. package/src/search/indexer.ts +0 -246
  138. package/src/search/mcp.ts +0 -61
  139. package/src/search/printer.tsx +0 -86
  140. package/src/search/providers/algolia.ts +0 -88
  141. package/src/search/providers/fuse.ts +0 -19
  142. package/src/search/providers/pagefind.ts +0 -17
  143. package/src/search/providers/walker.ts +0 -30
  144. package/src/search/results.tsx +0 -182
  145. package/src/search/state.ts +0 -64
  146. package/src/search/types.ts +0 -116
  147. package/src/style.ts +0 -196
  148. package/src/styles/main.css +0 -986
  149. package/src/styles/primitives.css +0 -580
  150. package/src/styles/resets.css +0 -39
  151. package/src/styles/search.css +0 -341
  152. package/src/styles/sidebar.css +0 -85
  153. package/src/styles/snippets.css +0 -130
  154. package/src/styles/variables.css +0 -86
  155. package/src/utils.ts +0 -41
@@ -0,0 +1,388 @@
1
+ import { t as __exportAll } from "../chunk-BYypO7fO.js";
2
+ import { useDeclaration, useLanguage, useSpec } from "../contexts/docs.js";
3
+ import "../use-strict-context-L0c8JKg4.js";
4
+ import { useLanguageComponents } from "../contexts/index.js";
5
+ import { useComponents } from "../contexts/use-components.js";
6
+ import style_default from "../style.js";
7
+ import * as React$1 from "react";
8
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
9
+
10
+ //#region src/languages/ruby.tsx
11
+ var ruby_exports = /* @__PURE__ */ __exportAll({
12
+ Declaration: () => Declaration,
13
+ MethodSignature: () => MethodSignature,
14
+ Property: () => Property,
15
+ Type: () => Type,
16
+ TypeName: () => TypeName
17
+ });
18
+ const ComplexTypes = {
19
+ RubyTypeObject: "object",
20
+ RubyTypeUnion: "union",
21
+ RubyTypeIntersection: "intersection",
22
+ RubyTypeArray: "array",
23
+ RubyTypeMap: "hash"
24
+ };
25
+ const Keywords = {
26
+ RubyTypeBinary: "FileInput",
27
+ RubyTypeUnknown: "untyped",
28
+ RubyTypeNull: "nil",
29
+ RubyTypeInteger: "Integer",
30
+ RubyTypeFloat: "Float",
31
+ RubyTypeBoolean: "bool"
32
+ };
33
+ function TypeName({ type }) {
34
+ const Lang = useLanguageComponents();
35
+ return ComplexTypes[type.kind] ?? /* @__PURE__ */ jsx(Lang.Type, { type });
36
+ }
37
+ const VALID_IDENTIFIER = /^[_A-Za-z][_A-Za-z0-9]*$/;
38
+ function TypePreview({ path }) {
39
+ const spec = useSpec();
40
+ const language = useLanguage();
41
+ const decl = useDeclaration(path, false);
42
+ const { Join } = useComponents();
43
+ if (!(decl && "children" in decl && decl.children && decl.children.length > 0) || "type" in decl && decl["type"] && "kind" in decl["type"] && decl["type"]?.["kind"] === "RubyTypeUnion") return;
44
+ const items = decl.children.map((prop, key) => {
45
+ const p = spec?.decls?.[language]?.[prop];
46
+ return /* @__PURE__ */ jsx("span", {
47
+ className: style_default.TypePropertyName,
48
+ children: /* @__PURE__ */ jsx("span", {
49
+ className: style_default.TextIdentifier,
50
+ children: p && "ident" in p ? p["ident"] : null
51
+ })
52
+ }, key);
53
+ });
54
+ return /* @__PURE__ */ jsxs("span", {
55
+ className: style_default.TypePreview,
56
+ "data-stldocs-type-preview": "properties",
57
+ children: [
58
+ /* @__PURE__ */ jsx("span", {
59
+ className: style_default.TypeBrace,
60
+ children: " {"
61
+ }),
62
+ /* @__PURE__ */ jsxs("span", {
63
+ className: style_default.TypePreviewContent,
64
+ children: [
65
+ " ",
66
+ /* @__PURE__ */ jsx(Join, {
67
+ items,
68
+ limit: 3,
69
+ children: /* @__PURE__ */ jsx("span", {
70
+ className: style_default.TextOperator,
71
+ children: ", "
72
+ })
73
+ }),
74
+ " "
75
+ ]
76
+ }),
77
+ /* @__PURE__ */ jsx("span", {
78
+ className: style_default.TypeBrace,
79
+ children: "} "
80
+ })
81
+ ]
82
+ });
83
+ }
84
+ function Type({ type }) {
85
+ const Lang = useLanguageComponents();
86
+ const { SDKReference, Join } = useComponents();
87
+ switch (type.kind) {
88
+ case "RubyTypeBinary":
89
+ case "RubyTypeUnknown":
90
+ case "RubyTypeNull":
91
+ case "RubyTypeInteger":
92
+ case "RubyTypeFloat":
93
+ case "RubyTypeBoolean": return /* @__PURE__ */ jsx("span", {
94
+ className: style_default.Type,
95
+ children: /* @__PURE__ */ jsx("span", {
96
+ className: style_default.TypeKeyword,
97
+ children: Keywords[type.kind]
98
+ })
99
+ });
100
+ case "RubyTypeString": return /* @__PURE__ */ jsx("span", {
101
+ className: style_default.Type,
102
+ children: /* @__PURE__ */ jsx("span", {
103
+ className: style_default.TypeString,
104
+ children: "String"
105
+ })
106
+ });
107
+ case "RubyTypeLiteral":
108
+ switch (typeof type.literal) {
109
+ case "string": return /* @__PURE__ */ jsx("span", {
110
+ className: style_default.Type,
111
+ children: /* @__PURE__ */ jsxs("span", {
112
+ className: style_default.LiteralString,
113
+ children: [":", type.literal.match(VALID_IDENTIFIER) ? type.literal : JSON.stringify(type.literal)]
114
+ })
115
+ });
116
+ case "number": return /* @__PURE__ */ jsx("span", {
117
+ className: style_default.Type,
118
+ children: /* @__PURE__ */ jsx("span", {
119
+ className: style_default.LiteralNumeric,
120
+ children: JSON.stringify(type.literal)
121
+ })
122
+ });
123
+ case "boolean": return /* @__PURE__ */ jsx("span", {
124
+ className: style_default.Type,
125
+ children: /* @__PURE__ */ jsx("span", {
126
+ className: style_default.LiteralBoolean,
127
+ children: JSON.stringify(type.literal)
128
+ })
129
+ });
130
+ }
131
+ break;
132
+ case "RubyTypeArray": return /* @__PURE__ */ jsxs("span", {
133
+ className: style_default.Type,
134
+ children: [
135
+ /* @__PURE__ */ jsx("span", {
136
+ className: style_default.TypeArray,
137
+ children: "Array["
138
+ }),
139
+ /* @__PURE__ */ jsx(Lang.Type, { type: type.elementType }),
140
+ /* @__PURE__ */ jsx("span", {
141
+ className: style_default.TypeArray,
142
+ children: "]"
143
+ })
144
+ ]
145
+ });
146
+ case "RubyTypeMap": return /* @__PURE__ */ jsxs("span", {
147
+ className: style_default.Type,
148
+ children: [
149
+ /* @__PURE__ */ jsx("span", {
150
+ className: style_default.TypeArray,
151
+ children: "Hash["
152
+ }),
153
+ type.indexType.kind === "RubyTypeString" ? /* @__PURE__ */ jsx("span", {
154
+ className: style_default.TypeString,
155
+ children: "Symbol"
156
+ }) : /* @__PURE__ */ jsx(Lang.Type, { type: type.indexType }),
157
+ ", ",
158
+ /* @__PURE__ */ jsx(Lang.Type, { type: type.itemType }),
159
+ /* @__PURE__ */ jsx("span", {
160
+ className: style_default.TypeArray,
161
+ children: "]"
162
+ })
163
+ ]
164
+ });
165
+ case "RubyTypeReference": {
166
+ const name = type.ident.split(".").at(-1);
167
+ if (!type.typeParameters || type.typeParameters.length === 0) return /* @__PURE__ */ jsxs("span", {
168
+ className: style_default.Type,
169
+ children: [/* @__PURE__ */ jsx(SDKReference, {
170
+ stainlessPath: type.$ref,
171
+ children: name
172
+ }), /* @__PURE__ */ jsx(TypePreview, { path: type.$ref })]
173
+ });
174
+ const typeParameters = type.typeParameters.map((t, i) => /* @__PURE__ */ jsx(Lang.Type, { type: t }, i));
175
+ return /* @__PURE__ */ jsxs("span", {
176
+ className: style_default.Type,
177
+ children: [
178
+ /* @__PURE__ */ jsx(SDKReference, {
179
+ stainlessPath: type.$ref,
180
+ children: name
181
+ }),
182
+ /* @__PURE__ */ jsx("span", {
183
+ className: style_default.TypeBracket,
184
+ children: "<"
185
+ }),
186
+ /* @__PURE__ */ jsx(Join, {
187
+ items: typeParameters,
188
+ children: /* @__PURE__ */ jsx("span", {
189
+ className: style_default.TextOperator,
190
+ children: ", "
191
+ })
192
+ }),
193
+ /* @__PURE__ */ jsx("span", {
194
+ className: style_default.TypeBracket,
195
+ children: ">"
196
+ }),
197
+ /* @__PURE__ */ jsx(TypePreview, { path: type.$ref })
198
+ ]
199
+ });
200
+ }
201
+ case "RubyTypeIntersection":
202
+ case "RubyTypeUnion": {
203
+ const items = type.types.map((t, key) => /* @__PURE__ */ jsx(Lang.Type, { type: t }, key));
204
+ const delimiter = type.kind === "RubyTypeUnion" ? "|" : "&";
205
+ return /* @__PURE__ */ jsx("span", {
206
+ className: style_default.Type,
207
+ children: /* @__PURE__ */ jsx("span", {
208
+ className: style_default.TypePreview,
209
+ "data-stldocs-type-preview": "union",
210
+ children: /* @__PURE__ */ jsx("span", {
211
+ className: style_default.TypePreviewContent,
212
+ children: /* @__PURE__ */ jsx(Join, {
213
+ items,
214
+ limit: 3,
215
+ children: /* @__PURE__ */ jsxs("span", {
216
+ className: style_default.TextOperator,
217
+ children: [
218
+ " ",
219
+ delimiter,
220
+ " "
221
+ ]
222
+ })
223
+ })
224
+ })
225
+ })
226
+ });
227
+ }
228
+ case "RubyTypeBuiltinClass": return /* @__PURE__ */ jsx("span", {
229
+ className: style_default.TypeReference,
230
+ children: type.className
231
+ });
232
+ case "RubyTypeObject": {
233
+ const items = type.members.map((prop, key) => /* @__PURE__ */ jsx("span", {
234
+ className: style_default.TextIdentifier,
235
+ children: prop.ident
236
+ }, key));
237
+ return /* @__PURE__ */ jsx("span", {
238
+ className: style_default.Type,
239
+ children: /* @__PURE__ */ jsx("span", {
240
+ className: style_default.TypePreview,
241
+ "data-stldocs-type-preview": "properties",
242
+ children: /* @__PURE__ */ jsxs("span", {
243
+ className: style_default.TypePreviewContent,
244
+ children: [
245
+ /* @__PURE__ */ jsx("span", {
246
+ className: style_default.TypeBrace,
247
+ children: "{ "
248
+ }),
249
+ /* @__PURE__ */ jsx(Join, {
250
+ items,
251
+ limit: 3,
252
+ children: /* @__PURE__ */ jsx("span", {
253
+ className: style_default.TextOperator,
254
+ children: ", "
255
+ })
256
+ }),
257
+ /* @__PURE__ */ jsx("span", {
258
+ className: style_default.TypeBrace,
259
+ children: "}"
260
+ })
261
+ ]
262
+ })
263
+ })
264
+ });
265
+ }
266
+ }
267
+ }
268
+ function MethodSignature({ decl }) {
269
+ const Lang = useLanguageComponents();
270
+ const { Join } = useComponents();
271
+ const params = decl.args.map((param, i) => /* @__PURE__ */ jsx(React$1.Fragment, { children: /* @__PURE__ */ jsx("span", {
272
+ className: style_default.TextIdentifier,
273
+ children: param.ident
274
+ }) }, i));
275
+ return /* @__PURE__ */ jsx("div", {
276
+ className: style_default.MethodSignature,
277
+ children: /* @__PURE__ */ jsxs("span", {
278
+ className: style_default.SignatureTitle,
279
+ children: [
280
+ /* @__PURE__ */ jsx("span", {
281
+ className: style_default.SignatureQualified,
282
+ children: /* @__PURE__ */ jsx("span", {
283
+ className: style_default.TextIdentifier,
284
+ children: decl.qualified?.slice(0, -decl.ident.length)
285
+ })
286
+ }),
287
+ /* @__PURE__ */ jsx("span", {
288
+ className: style_default.SignatureName,
289
+ children: /* @__PURE__ */ jsx("span", {
290
+ className: style_default.TextIdentifier,
291
+ children: decl.ident
292
+ })
293
+ }),
294
+ /* @__PURE__ */ jsxs("span", {
295
+ className: style_default.MethodSignature,
296
+ children: [
297
+ /* @__PURE__ */ jsx("span", {
298
+ className: style_default.SignatureParen,
299
+ children: "("
300
+ }),
301
+ /* @__PURE__ */ jsx("span", {
302
+ className: style_default.SignatureParams,
303
+ children: /* @__PURE__ */ jsx(Join, {
304
+ items: params,
305
+ children: /* @__PURE__ */ jsx("span", {
306
+ className: style_default.TextOperator,
307
+ children: ", "
308
+ })
309
+ })
310
+ }),
311
+ /* @__PURE__ */ jsx("span", {
312
+ className: style_default.SignatureParen,
313
+ children: ")"
314
+ }),
315
+ " -> ",
316
+ decl.returns ? /* @__PURE__ */ jsx(Lang.Type, { type: decl.returns }) : "void"
317
+ ]
318
+ })
319
+ ]
320
+ })
321
+ });
322
+ }
323
+ function Property({ decl, children }) {
324
+ const Lang = useLanguageComponents();
325
+ switch (decl.kind) {
326
+ case "RubyDeclProperty": return children({
327
+ name: decl.ident,
328
+ typeName: /* @__PURE__ */ jsx(Lang.TypeName, { type: decl.type }),
329
+ type: decl.type.kind in ComplexTypes && /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
330
+ });
331
+ case "RubyDeclTypeAlias": return children({
332
+ name: decl.ident,
333
+ typeName: "alias",
334
+ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
335
+ });
336
+ case "RubyDeclReference": return children({ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type }) });
337
+ case "RubyDeclClass": return children({
338
+ name: decl.ident,
339
+ typeName: "class"
340
+ });
341
+ }
342
+ }
343
+ function Declaration({ decl }) {
344
+ const Lang = useLanguageComponents();
345
+ if (!decl) return;
346
+ switch (decl.kind) {
347
+ case "RubyDeclProperty": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
348
+ /* @__PURE__ */ jsx("span", {
349
+ className: style_default.TypePropertyName,
350
+ children: /* @__PURE__ */ jsx("span", {
351
+ className: style_default.TextIdentifier,
352
+ children: decl.ident
353
+ })
354
+ }),
355
+ /* @__PURE__ */ jsx("span", {
356
+ className: style_default.TextPunctuation,
357
+ children: ": "
358
+ }),
359
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
360
+ ] });
361
+ case "RubyDeclTypeAlias": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
362
+ /* @__PURE__ */ jsx("span", {
363
+ className: style_default.TextIdentifier,
364
+ children: decl.ident
365
+ }),
366
+ /* @__PURE__ */ jsx("span", {
367
+ className: style_default.TextOperator,
368
+ children: " = "
369
+ }),
370
+ /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
371
+ ] });
372
+ case "RubyDeclClass": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
373
+ /* @__PURE__ */ jsx("span", {
374
+ className: style_default.TextKeyword,
375
+ children: "class "
376
+ }),
377
+ /* @__PURE__ */ jsx("span", {
378
+ className: style_default.TextIdentifier,
379
+ children: decl.ident
380
+ }),
381
+ /* @__PURE__ */ jsx(TypePreview, { path: decl.stainlessPath })
382
+ ] });
383
+ case "RubyDeclReference": return /* @__PURE__ */ jsx(Lang.Type, { type: decl.type });
384
+ }
385
+ }
386
+
387
+ //#endregion
388
+ export { Declaration, MethodSignature, Property, Type, TypeName, ruby_exports as t };
@@ -0,0 +1,48 @@
1
+ import { h as Resource$1, x as TerraformAST } from "../index-pvh-w1xa.js";
2
+ import { PropertyFn } from "./index.js";
3
+ import * as React$1 from "react";
4
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
5
+
6
+ //#region src/languages/terraform.d.ts
7
+ declare namespace terraform_d_exports {
8
+ export { Declaration, DeclarationProps, MethodSignature, Property, PropertyProps, Resource, ResourceProps, TerraformSource, Type, TypeName, TypeProps };
9
+ }
10
+ type TypeProps = {
11
+ type: TerraformAST.AttributeType;
12
+ };
13
+ declare function TypeName({
14
+ type
15
+ }: TypeProps): react_jsx_runtime0.JSX.Element;
16
+ declare function Type({
17
+ type
18
+ }: TypeProps): react_jsx_runtime0.JSX.Element | undefined;
19
+ declare function MethodSignature(): null;
20
+ type PropertyProps = {
21
+ decl: TerraformAST.TerraformDeclaration;
22
+ children: PropertyFn;
23
+ };
24
+ declare function Property({
25
+ decl,
26
+ children
27
+ }: PropertyProps): React$1.ReactNode;
28
+ declare function TerraformSource({
29
+ path,
30
+ group
31
+ }: {
32
+ path: string;
33
+ group: string;
34
+ }): react_jsx_runtime0.JSX.Element | undefined;
35
+ type DeclarationProps = {
36
+ decl: TerraformAST.TerraformDeclaration;
37
+ };
38
+ declare function Declaration({
39
+ decl
40
+ }: DeclarationProps): react_jsx_runtime0.JSX.Element | undefined;
41
+ type ResourceProps = {
42
+ resource: Resource$1;
43
+ };
44
+ declare function Resource({
45
+ resource
46
+ }: ResourceProps): react_jsx_runtime0.JSX.Element;
47
+ //#endregion
48
+ export { Declaration, DeclarationProps, MethodSignature, Property, PropertyProps, Resource, ResourceProps, TerraformSource, Type, TypeName, TypeProps, terraform_d_exports as t };
@@ -0,0 +1,244 @@
1
+ import { t as __exportAll } from "../chunk-BYypO7fO.js";
2
+ import { useDeclaration } from "../contexts/docs.js";
3
+ import "../use-strict-context-L0c8JKg4.js";
4
+ import { useLanguageComponents } from "../contexts/index.js";
5
+ import { useComponents } from "../contexts/use-components.js";
6
+ import style_default from "../style.js";
7
+ import "react";
8
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
9
+ import clsx from "clsx";
10
+ import { Badge, Callout } from "@stainless-api/ui-primitives";
11
+
12
+ //#region src/languages/terraform.tsx
13
+ var terraform_exports = /* @__PURE__ */ __exportAll({
14
+ Declaration: () => Declaration,
15
+ MethodSignature: () => MethodSignature,
16
+ Property: () => Property,
17
+ Resource: () => Resource,
18
+ TerraformSource: () => TerraformSource,
19
+ Type: () => Type,
20
+ TypeName: () => TypeName
21
+ });
22
+ function TypeName({ type }) {
23
+ return /* @__PURE__ */ jsx(useLanguageComponents().Type, { type });
24
+ }
25
+ function Type({ type }) {
26
+ const Lang = useLanguageComponents();
27
+ const { Join } = useComponents();
28
+ switch (type.category) {
29
+ case "nested": switch (type.type) {
30
+ case "ListNested":
31
+ case "MapNested":
32
+ case "SetNested": return /* @__PURE__ */ jsxs("span", {
33
+ className: style_default.Type,
34
+ children: [
35
+ /* @__PURE__ */ jsx("span", {
36
+ className: style_default.TypeArray,
37
+ children: type.type.replace("Nested", "")
38
+ }),
39
+ /* @__PURE__ */ jsx("span", {
40
+ className: style_default.TypeBracket,
41
+ children: "["
42
+ }),
43
+ /* @__PURE__ */ jsx("span", {
44
+ className: style_default.TypeReference,
45
+ children: "Attributes"
46
+ }),
47
+ /* @__PURE__ */ jsx("span", {
48
+ className: style_default.TypeBracket,
49
+ children: "]"
50
+ })
51
+ ]
52
+ });
53
+ case "SingleNested": return /* @__PURE__ */ jsx("span", {
54
+ className: style_default.Type,
55
+ children: /* @__PURE__ */ jsx("span", {
56
+ className: style_default.TypeReference,
57
+ children: "Attributes"
58
+ })
59
+ });
60
+ default: return;
61
+ }
62
+ case "collection": return /* @__PURE__ */ jsxs("span", {
63
+ className: style_default.Type,
64
+ children: [
65
+ /* @__PURE__ */ jsx("span", {
66
+ className: style_default.TypeArray,
67
+ children: type.type
68
+ }),
69
+ /* @__PURE__ */ jsx("span", {
70
+ className: style_default.TypeBracket,
71
+ children: "["
72
+ }),
73
+ /* @__PURE__ */ jsx(Lang.Type, { type: type.elementType }),
74
+ /* @__PURE__ */ jsx("span", {
75
+ className: style_default.TypeBracket,
76
+ children: "]"
77
+ })
78
+ ]
79
+ });
80
+ case "dynamic": {
81
+ const subtypes = type.allowedSubtypes.length > 0 ? /* @__PURE__ */ jsx(Join, {
82
+ items: type.allowedSubtypes,
83
+ children: " | "
84
+ }) : null;
85
+ return /* @__PURE__ */ jsx("span", {
86
+ className: style_default.Type,
87
+ children: /* @__PURE__ */ jsxs("span", {
88
+ className: style_default.TypeKeyword,
89
+ children: ["Dynamic ", subtypes]
90
+ })
91
+ });
92
+ }
93
+ case "primitive":
94
+ if (type.type === "String") return /* @__PURE__ */ jsx("span", {
95
+ className: style_default.Type,
96
+ children: /* @__PURE__ */ jsx("span", {
97
+ className: style_default.TypeString,
98
+ children: "String"
99
+ })
100
+ });
101
+ return /* @__PURE__ */ jsx("span", {
102
+ className: style_default.Type,
103
+ children: /* @__PURE__ */ jsx("span", {
104
+ className: style_default.TypeKeyword,
105
+ children: type.type
106
+ })
107
+ });
108
+ case "unknown": return /* @__PURE__ */ jsx("span", {
109
+ className: style_default.Type,
110
+ children: /* @__PURE__ */ jsx("span", {
111
+ className: style_default.TypeKeyword,
112
+ children: "JSON"
113
+ })
114
+ });
115
+ }
116
+ }
117
+ function MethodSignature() {
118
+ return null;
119
+ }
120
+ const PropGroups = [
121
+ "required",
122
+ "optional",
123
+ "computed"
124
+ ];
125
+ function Property({ decl, children }) {
126
+ if (!decl) return null;
127
+ switch (decl.kind) {
128
+ case "TerraformDeclAttribute": return children({ name: decl.name });
129
+ }
130
+ }
131
+ function TerraformSource({ path, group }) {
132
+ const Docs = useComponents();
133
+ const decl = useDeclaration(path, true);
134
+ if (decl.kind !== "TerraformDeclSource") return;
135
+ const type = decl.type === "resource" ? "resource" : "data";
136
+ const badge = type === "resource" ? `success` : `note`;
137
+ const children = PropGroups.filter((section) => decl[section].length > 0).map((section) => {
138
+ const propGroupId = `${decl.name}-${section}-${group}`;
139
+ return /* @__PURE__ */ jsxs("div", {
140
+ className: style_default.ResourceContentGroup,
141
+ children: [/* @__PURE__ */ jsxs("h5", {
142
+ className: style_default.ResourceContentGroupModelTitle,
143
+ children: [
144
+ section,
145
+ " ",
146
+ /* @__PURE__ */ jsx(Docs.PropertyToggle, { target: propGroupId })
147
+ ]
148
+ }), /* @__PURE__ */ jsx("div", {
149
+ className: style_default.ResourceContentProperties,
150
+ "data-stldocs-property-group": propGroupId,
151
+ children: /* @__PURE__ */ jsx(Docs.SDKChildren, { paths: decl[section] })
152
+ })]
153
+ }, section);
154
+ });
155
+ return /* @__PURE__ */ jsx("div", {
156
+ className: clsx(style_default.Method, style_default.MethodDoublePane),
157
+ children: /* @__PURE__ */ jsxs("div", {
158
+ className: style_default.MethodBody,
159
+ children: [/* @__PURE__ */ jsxs("div", {
160
+ className: style_default.MethodContentColumn,
161
+ children: [/* @__PURE__ */ jsxs("h4", {
162
+ className: style_default.TerraformResourceTitle,
163
+ children: [
164
+ /* @__PURE__ */ jsx(Badge, {
165
+ intent: badge,
166
+ children: type
167
+ }),
168
+ " ",
169
+ decl.name
170
+ ]
171
+ }), children]
172
+ }), /* @__PURE__ */ jsx("div", {
173
+ className: clsx(style_default.MethodExample, "not-content", "stl-ui-not-prose"),
174
+ children: /* @__PURE__ */ jsx(Docs.SDKExample, { method: {
175
+ title: decl.name,
176
+ stainlessPath: path
177
+ } })
178
+ })]
179
+ })
180
+ });
181
+ }
182
+ function Declaration({ decl }) {
183
+ const Lang = useLanguageComponents();
184
+ if (!decl) return;
185
+ switch (decl.kind) {
186
+ case "TerraformDeclAttribute": {
187
+ const isOptional = decl.configurability === "optional" || decl.configurability === "computed_optional";
188
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
189
+ /* @__PURE__ */ jsx("span", {
190
+ className: style_default.TextIdentifier,
191
+ children: decl.name
192
+ }),
193
+ isOptional && /* @__PURE__ */ jsx("span", {
194
+ className: style_default.TextPunctuation,
195
+ children: "?"
196
+ }),
197
+ /* @__PURE__ */ jsx("span", {
198
+ className: style_default.TextPunctuation,
199
+ children: ": "
200
+ }),
201
+ /* @__PURE__ */ jsx("span", {
202
+ className: style_default.TextKeyword,
203
+ children: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
204
+ })
205
+ ] });
206
+ }
207
+ case "TerraformDeclServiceNode": {
208
+ const { resource, dataSource, listDataSource } = decl;
209
+ return /* @__PURE__ */ jsxs("div", {
210
+ className: style_default.Method,
211
+ children: [
212
+ resource && /* @__PURE__ */ jsx(TerraformSource, {
213
+ path: resource,
214
+ group: "resource"
215
+ }),
216
+ dataSource && /* @__PURE__ */ jsx(TerraformSource, {
217
+ path: dataSource,
218
+ group: "dataSource"
219
+ }),
220
+ listDataSource && /* @__PURE__ */ jsx(TerraformSource, {
221
+ path: listDataSource,
222
+ group: "listDataSource"
223
+ })
224
+ ]
225
+ });
226
+ }
227
+ }
228
+ }
229
+ function Resource({ resource }) {
230
+ const Lang = useLanguageComponents();
231
+ const decl = useDeclaration(resource.stainlessPath, false);
232
+ if (decl) return /* @__PURE__ */ jsx(Lang.Declaration, { decl });
233
+ return /* @__PURE__ */ jsxs(Callout, {
234
+ variant: "warning",
235
+ children: [
236
+ "The resource ",
237
+ /* @__PURE__ */ jsx("code", { children: resource.name }),
238
+ " is not supported in Terraform."
239
+ ]
240
+ });
241
+ }
242
+
243
+ //#endregion
244
+ export { Declaration, MethodSignature, Property, Resource, TerraformSource, Type, TypeName, terraform_exports as t };