@stainless-api/docs-ui 0.1.0-beta.8 → 0.1.0-beta.80
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.
- package/dist/chunk-BYypO7fO.js +18 -0
- package/dist/components/MaskedInput.d.ts +14 -0
- package/dist/components/MaskedInput.js +76 -0
- package/dist/components/breadcrumbs.d.ts +25 -0
- package/dist/components/breadcrumbs.js +64 -0
- package/dist/components/icons.d.ts +65 -0
- package/dist/components/icons.js +941 -0
- package/dist/components/index.d.ts +16 -0
- package/dist/components/index.js +75 -0
- package/dist/components/method.d.ts +59 -0
- package/dist/components/method.js +97 -0
- package/dist/components/overview.d.ts +39 -0
- package/dist/components/overview.js +139 -0
- package/dist/components/primitives.d.ts +107 -0
- package/dist/components/primitives.js +253 -0
- package/dist/components/properties.d.ts +54 -0
- package/dist/components/properties.js +140 -0
- package/dist/components/sdk-sidebar.d.ts +15 -0
- package/dist/components/sdk-sidebar.js +52 -0
- package/dist/components/sdk.d.ts +128 -0
- package/dist/components/sdk.js +490 -0
- package/dist/components/snippets.d.ts +71 -0
- package/dist/components/snippets.js +184 -0
- package/dist/components/stl-sidebar.d.ts +58 -0
- package/dist/components/stl-sidebar.js +114 -0
- package/dist/contexts/component-generics.d.ts +30 -0
- package/dist/contexts/component-generics.js +33 -0
- package/dist/contexts/component-types.d.ts +8 -0
- package/dist/contexts/component-types.js +0 -0
- package/dist/contexts/component.d.ts +21 -0
- package/dist/contexts/component.js +24 -0
- package/dist/contexts/docs.d.ts +62 -0
- package/dist/contexts/docs.js +91 -0
- package/dist/contexts/index.d.ts +13 -0
- package/dist/contexts/index.js +45 -0
- package/dist/contexts/markdown.d.ts +22 -0
- package/dist/contexts/markdown.js +49 -0
- package/dist/contexts/navigation.d.ts +29 -0
- package/dist/contexts/navigation.js +24 -0
- package/dist/contexts/use-components.d.ts +6 -0
- package/dist/contexts/use-components.js +8 -0
- package/dist/index-pvh-w1xa.d.ts +1776 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +9 -7542
- package/dist/languages/cli.d.ts +38 -0
- package/dist/languages/cli.js +167 -0
- package/dist/languages/csharp.d.ts +42 -0
- package/dist/languages/csharp.js +284 -0
- package/dist/languages/go.d.ts +40 -0
- package/dist/languages/go.js +304 -0
- package/dist/languages/http.d.ts +46 -0
- package/dist/languages/http.js +391 -0
- package/dist/languages/index.d.ts +51 -0
- package/dist/languages/index.js +33 -0
- package/dist/languages/java.d.ts +43 -0
- package/dist/languages/java.js +404 -0
- package/dist/languages/php.d.ts +40 -0
- package/dist/languages/php.js +313 -0
- package/dist/languages/python.d.ts +40 -0
- package/dist/languages/python.js +270 -0
- package/dist/languages/ruby.d.ts +40 -0
- package/dist/languages/ruby.js +388 -0
- package/dist/languages/terraform.d.ts +48 -0
- package/dist/languages/terraform.js +244 -0
- package/dist/languages/typescript.d.ts +40 -0
- package/dist/languages/typescript.js +450 -0
- package/dist/markdown/index.d.ts +11 -0
- package/dist/markdown/index.js +80 -0
- package/dist/markdown/md.d.ts +15 -0
- package/dist/markdown/md.js +41 -0
- package/dist/markdown/printer.d.ts +13 -0
- package/dist/markdown/printer.js +76 -0
- package/dist/markdown/utils.d.ts +21 -0
- package/dist/markdown/utils.js +31 -0
- package/dist/routing.d.ts +61 -0
- package/dist/routing.js +176 -150
- package/dist/spec.d.ts +65 -0
- package/dist/spec.js +167 -0
- package/dist/style.d.ts +177 -0
- package/dist/style.js +178 -0
- package/dist/styles/main.css +788 -752
- package/dist/styles/main.js +0 -0
- package/dist/styles/primitives.css +326 -458
- package/dist/styles/primitives.js +0 -0
- package/dist/styles/resets.css +32 -41
- package/dist/styles/resets.js +0 -0
- package/dist/styles/search.css +192 -270
- package/dist/styles/search.js +0 -0
- package/dist/styles/sidebar.css +182 -69
- package/dist/styles/sidebar.js +0 -0
- package/dist/styles/variables.css +28 -89
- package/dist/styles/variables.js +0 -0
- package/dist/styles.css +3333 -0
- package/dist/styles.mjs +1 -0
- package/dist/use-strict-context-L0c8JKg4.js +16 -0
- package/dist/utils.d.ts +20 -0
- package/dist/utils.js +54 -0
- package/package.json +74 -22
- package/dist/mcp.js +0 -16003
- package/dist/styles/snippets.css +0 -132
- package/src/components/breadcrumbs.tsx +0 -94
- package/src/components/chat.tsx +0 -154
- package/src/components/dropdown.tsx +0 -91
- package/src/components/icons.tsx +0 -584
- package/src/components/index.ts +0 -9
- package/src/components/method.tsx +0 -146
- package/src/components/overview.tsx +0 -160
- package/src/components/primitives.tsx +0 -284
- package/src/components/properties.tsx +0 -130
- package/src/components/scripts/dropdown.ts +0 -78
- package/src/components/sdk.tsx +0 -403
- package/src/components/sidebar.tsx +0 -99
- package/src/components/snippets.tsx +0 -180
- package/src/contexts/component-generics.tsx +0 -48
- package/src/contexts/component-types.tsx +0 -5
- package/src/contexts/component.tsx +0 -32
- package/src/contexts/docs.tsx +0 -75
- package/src/contexts/index.tsx +0 -17
- package/src/contexts/markdown.tsx +0 -43
- package/src/contexts/navigation.tsx +0 -44
- package/src/contexts/search.tsx +0 -28
- package/src/contexts/use-components.tsx +0 -4
- package/src/index.ts +0 -6
- package/src/languages/go.tsx +0 -281
- package/src/languages/http.tsx +0 -321
- package/src/languages/index.ts +0 -26
- package/src/languages/java.tsx +0 -358
- package/src/languages/python.tsx +0 -255
- package/src/languages/ruby.tsx +0 -320
- package/src/languages/typescript.tsx +0 -393
- package/src/markdown/index.ts +0 -107
- package/src/markdown/md.ts +0 -45
- package/src/markdown/utils.ts +0 -49
- package/src/routing.ts +0 -238
- package/src/search/form.tsx +0 -127
- package/src/search/index.tsx +0 -1
- package/src/search/indexer.ts +0 -246
- package/src/search/mcp.ts +0 -61
- package/src/search/printer.tsx +0 -86
- package/src/search/providers/algolia.ts +0 -88
- package/src/search/providers/fuse.ts +0 -19
- package/src/search/providers/pagefind.ts +0 -17
- package/src/search/providers/walker.ts +0 -30
- package/src/search/results.tsx +0 -182
- package/src/search/state.ts +0 -64
- package/src/search/types.ts +0 -116
- package/src/style.ts +0 -196
- package/src/styles/main.css +0 -986
- package/src/styles/primitives.css +0 -580
- package/src/styles/resets.css +0 -39
- package/src/styles/search.css +0 -341
- package/src/styles/sidebar.css +0 -85
- package/src/styles/snippets.css +0 -130
- package/src/styles/variables.css +0 -86
- package/src/utils.ts +0 -41
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import { t as __exportAll } from "../chunk-BYypO7fO.js";
|
|
2
|
+
import "../use-strict-context-L0c8JKg4.js";
|
|
3
|
+
import { useLanguageComponents } from "../contexts/index.js";
|
|
4
|
+
import { useComponents } from "../contexts/use-components.js";
|
|
5
|
+
import style_default from "../style.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/php.tsx
|
|
10
|
+
var php_exports = /* @__PURE__ */ __exportAll({
|
|
11
|
+
Declaration: () => Declaration,
|
|
12
|
+
MethodSignature: () => MethodSignature,
|
|
13
|
+
Property: () => Property,
|
|
14
|
+
Type: () => Type,
|
|
15
|
+
TypeName: () => TypeName
|
|
16
|
+
});
|
|
17
|
+
const ComplexTypes = {
|
|
18
|
+
PHPTypeMapArray: "array",
|
|
19
|
+
PhpTypeListArray: "list",
|
|
20
|
+
PhpTypeUnion: "union"
|
|
21
|
+
};
|
|
22
|
+
const constStyle = {
|
|
23
|
+
string: style_default.LiteralString,
|
|
24
|
+
number: style_default.LiteralNumeric,
|
|
25
|
+
boolean: style_default.LiteralBoolean
|
|
26
|
+
};
|
|
27
|
+
function TypeName({ type }) {
|
|
28
|
+
const Lang = useLanguageComponents();
|
|
29
|
+
return ComplexTypes[type.kind] ?? /* @__PURE__ */ jsx(Lang.Type, { type });
|
|
30
|
+
}
|
|
31
|
+
function Type({ type }) {
|
|
32
|
+
const Docs = useComponents();
|
|
33
|
+
const Lang = useLanguageComponents();
|
|
34
|
+
const { Join } = useComponents();
|
|
35
|
+
switch (type.kind) {
|
|
36
|
+
case "PhpTypeFloat":
|
|
37
|
+
case "PhpTypeInt":
|
|
38
|
+
case "PhpTypeBool":
|
|
39
|
+
case "PhpTypeNull":
|
|
40
|
+
case "PhpTypeMixed": return /* @__PURE__ */ jsx("span", {
|
|
41
|
+
className: style_default.Type,
|
|
42
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
43
|
+
className: style_default.TypeKeyword,
|
|
44
|
+
children: type.kind.slice(7).toLowerCase()
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
case "PhpTypeString": return /* @__PURE__ */ jsx("span", {
|
|
48
|
+
className: style_default.Type,
|
|
49
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
50
|
+
className: style_default.TypeString,
|
|
51
|
+
children: "string"
|
|
52
|
+
})
|
|
53
|
+
});
|
|
54
|
+
case "PhpTypeComplexBuiltin": return /* @__PURE__ */ jsx("span", {
|
|
55
|
+
className: style_default.Type,
|
|
56
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
57
|
+
className: style_default.TypeKeyword,
|
|
58
|
+
children: type.typeName
|
|
59
|
+
})
|
|
60
|
+
});
|
|
61
|
+
case "PhpTypeLiteral": return /* @__PURE__ */ jsx("span", {
|
|
62
|
+
className: style_default.Type,
|
|
63
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
64
|
+
className: constStyle[typeof type.literal],
|
|
65
|
+
children: JSON.stringify(type.literal)
|
|
66
|
+
})
|
|
67
|
+
});
|
|
68
|
+
case "PhpTypeDatetime": return /* @__PURE__ */ jsx("span", {
|
|
69
|
+
className: style_default.Type,
|
|
70
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
71
|
+
className: style_default.TypeReference,
|
|
72
|
+
children: "\\Datetime"
|
|
73
|
+
})
|
|
74
|
+
});
|
|
75
|
+
case "PhpTypeReference": {
|
|
76
|
+
const params = type.typeParameters?.map((param, key) => /* @__PURE__ */ jsx(Lang.Type, { type: param }, key));
|
|
77
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
78
|
+
className: style_default.Type,
|
|
79
|
+
children: [/* @__PURE__ */ jsx(Docs.SDKReference, {
|
|
80
|
+
stainlessPath: type.$ref,
|
|
81
|
+
children: type.typeName
|
|
82
|
+
}), params && params.length > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
83
|
+
/* @__PURE__ */ jsx("span", {
|
|
84
|
+
className: style_default.TypeBracket,
|
|
85
|
+
children: "<"
|
|
86
|
+
}),
|
|
87
|
+
/* @__PURE__ */ jsx(Join, {
|
|
88
|
+
items: params,
|
|
89
|
+
limit: 3,
|
|
90
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
91
|
+
className: style_default.TextOperator,
|
|
92
|
+
children: ", "
|
|
93
|
+
})
|
|
94
|
+
}),
|
|
95
|
+
/* @__PURE__ */ jsx("span", {
|
|
96
|
+
className: style_default.TypeBracket,
|
|
97
|
+
children: ">"
|
|
98
|
+
})
|
|
99
|
+
] })]
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
case "PhpTypeMapArray": return /* @__PURE__ */ jsxs("span", {
|
|
103
|
+
className: style_default.Type,
|
|
104
|
+
children: [
|
|
105
|
+
/* @__PURE__ */ jsx("span", {
|
|
106
|
+
className: style_default.TypeArray,
|
|
107
|
+
children: "array<string,"
|
|
108
|
+
}),
|
|
109
|
+
/* @__PURE__ */ jsx(Lang.Type, { type: type.elementType }),
|
|
110
|
+
/* @__PURE__ */ jsx("span", {
|
|
111
|
+
className: style_default.TypeArray,
|
|
112
|
+
children: ">"
|
|
113
|
+
})
|
|
114
|
+
]
|
|
115
|
+
});
|
|
116
|
+
case "PhpTypeListArray": return /* @__PURE__ */ jsxs("span", {
|
|
117
|
+
className: style_default.Type,
|
|
118
|
+
children: [
|
|
119
|
+
/* @__PURE__ */ jsx("span", {
|
|
120
|
+
className: style_default.TypeArray,
|
|
121
|
+
children: "list<"
|
|
122
|
+
}),
|
|
123
|
+
/* @__PURE__ */ jsx(Lang.Type, { type: type.elementType }),
|
|
124
|
+
/* @__PURE__ */ jsx("span", {
|
|
125
|
+
className: style_default.TypeArray,
|
|
126
|
+
children: ">"
|
|
127
|
+
})
|
|
128
|
+
]
|
|
129
|
+
});
|
|
130
|
+
case "PhpTypeUnion": {
|
|
131
|
+
const items = type.types.map((t, key) => /* @__PURE__ */ jsx(Lang.Type, { type: t }, key));
|
|
132
|
+
return /* @__PURE__ */ jsx("span", {
|
|
133
|
+
className: style_default.Type,
|
|
134
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
135
|
+
className: style_default.TypePreview,
|
|
136
|
+
"data-stldocs-type-preview": "union",
|
|
137
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
138
|
+
className: style_default.TypePreviewContent,
|
|
139
|
+
children: /* @__PURE__ */ jsx(Join, {
|
|
140
|
+
items,
|
|
141
|
+
limit: 3,
|
|
142
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
143
|
+
className: style_default.TextOperator,
|
|
144
|
+
children: " | "
|
|
145
|
+
})
|
|
146
|
+
})
|
|
147
|
+
})
|
|
148
|
+
})
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
function MethodSignature({ decl }) {
|
|
154
|
+
const Lang = useLanguageComponents();
|
|
155
|
+
const { Join } = useComponents();
|
|
156
|
+
const params = decl.parameters.map((param, i) => /* @__PURE__ */ jsxs(React$1.Fragment, { children: [
|
|
157
|
+
param.optional && /* @__PURE__ */ jsx("span", {
|
|
158
|
+
className: style_default.TextPunctuation,
|
|
159
|
+
children: "?"
|
|
160
|
+
}),
|
|
161
|
+
/* @__PURE__ */ jsx(Lang.Type, { type: param.typeAnnotation }),
|
|
162
|
+
" ",
|
|
163
|
+
/* @__PURE__ */ jsx("span", {
|
|
164
|
+
className: style_default.TextIdentifier,
|
|
165
|
+
children: param.ident
|
|
166
|
+
}),
|
|
167
|
+
param.hasDefault && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
168
|
+
className: style_default.TextPunctuation,
|
|
169
|
+
children: " = "
|
|
170
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
171
|
+
className: style_default.TextKeyword,
|
|
172
|
+
children: "default"
|
|
173
|
+
})] })
|
|
174
|
+
] }, i));
|
|
175
|
+
return /* @__PURE__ */ jsx("div", {
|
|
176
|
+
className: style_default.MethodSignature,
|
|
177
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
178
|
+
className: style_default.SignatureTitle,
|
|
179
|
+
children: [
|
|
180
|
+
decl.qualified && /* @__PURE__ */ jsx("span", {
|
|
181
|
+
className: style_default.SignatureQualified,
|
|
182
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
183
|
+
className: style_default.TextIdentifier,
|
|
184
|
+
children: ["$client->", decl.qualified?.slice(0, -decl.ident.length)]
|
|
185
|
+
})
|
|
186
|
+
}),
|
|
187
|
+
/* @__PURE__ */ jsx("span", {
|
|
188
|
+
className: style_default.SignatureName,
|
|
189
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
190
|
+
className: style_default.TextIdentifier,
|
|
191
|
+
children: decl.ident
|
|
192
|
+
})
|
|
193
|
+
}),
|
|
194
|
+
/* @__PURE__ */ jsxs("span", {
|
|
195
|
+
className: style_default.MethodSignature,
|
|
196
|
+
children: [
|
|
197
|
+
/* @__PURE__ */ jsx("span", {
|
|
198
|
+
className: style_default.SignatureParen,
|
|
199
|
+
children: "("
|
|
200
|
+
}),
|
|
201
|
+
/* @__PURE__ */ jsx("span", {
|
|
202
|
+
className: style_default.SignatureParams,
|
|
203
|
+
children: /* @__PURE__ */ jsx(Join, {
|
|
204
|
+
items: params,
|
|
205
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
206
|
+
className: style_default.TextOperator,
|
|
207
|
+
children: ", "
|
|
208
|
+
})
|
|
209
|
+
})
|
|
210
|
+
}),
|
|
211
|
+
/* @__PURE__ */ jsx("span", {
|
|
212
|
+
className: style_default.SignatureParen,
|
|
213
|
+
children: ")"
|
|
214
|
+
}),
|
|
215
|
+
/* @__PURE__ */ jsx("span", {
|
|
216
|
+
className: style_default.TextPunctuation,
|
|
217
|
+
children: ": "
|
|
218
|
+
}),
|
|
219
|
+
decl.returnType ? /* @__PURE__ */ jsx(Lang.Type, { type: decl.returnType }) : /* @__PURE__ */ jsx("span", {
|
|
220
|
+
className: style_default.Type,
|
|
221
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
222
|
+
className: style_default.TypeKeyword,
|
|
223
|
+
children: "void"
|
|
224
|
+
})
|
|
225
|
+
})
|
|
226
|
+
]
|
|
227
|
+
})
|
|
228
|
+
]
|
|
229
|
+
})
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
function Property({ decl, children }) {
|
|
233
|
+
const Lang = useLanguageComponents();
|
|
234
|
+
if (!decl) return;
|
|
235
|
+
switch (decl.kind) {
|
|
236
|
+
case "PhpDeclReference": return children({ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type }) });
|
|
237
|
+
case "PhpDeclClassProperty":
|
|
238
|
+
case "PhpDeclParam": return children({
|
|
239
|
+
name: decl.ident,
|
|
240
|
+
typeName: /* @__PURE__ */ jsx(Lang.TypeName, { type: decl.type }),
|
|
241
|
+
type: decl.type.kind in ComplexTypes && /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
function Declaration({ decl }) {
|
|
246
|
+
const Lang = useLanguageComponents();
|
|
247
|
+
if (!decl) return;
|
|
248
|
+
switch (decl.kind) {
|
|
249
|
+
case "PhpDeclClass":
|
|
250
|
+
case "PhpDeclAssocArray":
|
|
251
|
+
case "PhpDeclEnum": return /* @__PURE__ */ jsx(Fragment$1, { children: "Not yet implemented." });
|
|
252
|
+
case "PhpDeclReference": return /* @__PURE__ */ jsxs(Fragment$1, { children: [decl.scope && /* @__PURE__ */ jsxs("span", {
|
|
253
|
+
className: style_default.TextKeyword,
|
|
254
|
+
children: [decl.scope, " "]
|
|
255
|
+
}), /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })] });
|
|
256
|
+
case "PhpDeclParam": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
257
|
+
/* @__PURE__ */ jsx("span", {
|
|
258
|
+
className: style_default.TextIdentifier,
|
|
259
|
+
children: decl.ident
|
|
260
|
+
}),
|
|
261
|
+
decl.isPositional ? /* @__PURE__ */ jsx("span", {
|
|
262
|
+
className: style_default.TextOperator,
|
|
263
|
+
children: ": "
|
|
264
|
+
}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
265
|
+
className: style_default.TextOperator,
|
|
266
|
+
children: decl.optional ? "?:" : ": "
|
|
267
|
+
}), decl.optional && /* @__PURE__ */ jsx("span", {
|
|
268
|
+
className: style_default.TextOperator,
|
|
269
|
+
children: "optional "
|
|
270
|
+
})] }),
|
|
271
|
+
/* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
|
|
272
|
+
] });
|
|
273
|
+
case "PhpDeclAssocArrayProperty": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
274
|
+
/* @__PURE__ */ jsxs("span", {
|
|
275
|
+
className: style_default.LiteralString,
|
|
276
|
+
children: [
|
|
277
|
+
"'",
|
|
278
|
+
decl.ident,
|
|
279
|
+
"'"
|
|
280
|
+
]
|
|
281
|
+
}),
|
|
282
|
+
decl.optional && /* @__PURE__ */ jsx("span", {
|
|
283
|
+
className: style_default.TextOperator,
|
|
284
|
+
children: "?"
|
|
285
|
+
}),
|
|
286
|
+
/* @__PURE__ */ jsx("span", {
|
|
287
|
+
className: style_default.TextOperator,
|
|
288
|
+
children: ": "
|
|
289
|
+
}),
|
|
290
|
+
decl.optional && /* @__PURE__ */ jsx("span", {
|
|
291
|
+
className: style_default.TextKeyword,
|
|
292
|
+
children: "optional "
|
|
293
|
+
}),
|
|
294
|
+
/* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
|
|
295
|
+
] });
|
|
296
|
+
case "PhpDeclClassProperty": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
297
|
+
decl.nullable && /* @__PURE__ */ jsx("span", {
|
|
298
|
+
className: style_default.TextOperator,
|
|
299
|
+
children: "?"
|
|
300
|
+
}),
|
|
301
|
+
/* @__PURE__ */ jsx(Lang.Type, { type: decl.type }),
|
|
302
|
+
" ",
|
|
303
|
+
/* @__PURE__ */ jsx("span", {
|
|
304
|
+
className: style_default.TextIdentifier,
|
|
305
|
+
children: decl.ident
|
|
306
|
+
})
|
|
307
|
+
] });
|
|
308
|
+
case "PhpDeclMethod": return /* @__PURE__ */ jsx(Lang.MethodSignature, { decl });
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
//#endregion
|
|
313
|
+
export { Declaration, MethodSignature, Property, Type, TypeName, php_exports as t };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { m as PythonAST } 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/python.d.ts
|
|
7
|
+
declare namespace python_d_exports {
|
|
8
|
+
export { Declaration, DeclarationProps, MethodSignature, MethodSignatureProps, Property, PropertyProps, Type, TypeName };
|
|
9
|
+
}
|
|
10
|
+
type TypeProps = {
|
|
11
|
+
type: PythonAST.PythonType;
|
|
12
|
+
};
|
|
13
|
+
declare function TypeName({
|
|
14
|
+
type
|
|
15
|
+
}: TypeProps): string | react_jsx_runtime0.JSX.Element;
|
|
16
|
+
declare function Type({
|
|
17
|
+
type
|
|
18
|
+
}: TypeProps): react_jsx_runtime0.JSX.Element;
|
|
19
|
+
type MethodSignatureProps = {
|
|
20
|
+
decl: PythonAST.PythonDeclFunction;
|
|
21
|
+
};
|
|
22
|
+
declare function MethodSignature({
|
|
23
|
+
decl
|
|
24
|
+
}: MethodSignatureProps): react_jsx_runtime0.JSX.Element;
|
|
25
|
+
type PropertyProps = {
|
|
26
|
+
decl: PythonAST.PythonDeclaration;
|
|
27
|
+
children: PropertyFn;
|
|
28
|
+
};
|
|
29
|
+
declare function Property({
|
|
30
|
+
decl,
|
|
31
|
+
children
|
|
32
|
+
}: PropertyProps): React$1.ReactNode;
|
|
33
|
+
type DeclarationProps = {
|
|
34
|
+
decl: PythonAST.PythonDeclaration;
|
|
35
|
+
};
|
|
36
|
+
declare function Declaration({
|
|
37
|
+
decl
|
|
38
|
+
}: DeclarationProps): react_jsx_runtime0.JSX.Element | undefined;
|
|
39
|
+
//#endregion
|
|
40
|
+
export { Declaration, DeclarationProps, MethodSignature, MethodSignatureProps, Property, PropertyProps, Type, TypeName, python_d_exports as t };
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import { t as __exportAll } from "../chunk-BYypO7fO.js";
|
|
2
|
+
import "../use-strict-context-L0c8JKg4.js";
|
|
3
|
+
import { useLanguageComponents } from "../contexts/index.js";
|
|
4
|
+
import { useComponents } from "../contexts/use-components.js";
|
|
5
|
+
import style_default from "../style.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/python.tsx
|
|
10
|
+
var python_exports = /* @__PURE__ */ __exportAll({
|
|
11
|
+
Declaration: () => Declaration,
|
|
12
|
+
MethodSignature: () => MethodSignature,
|
|
13
|
+
Property: () => Property,
|
|
14
|
+
Type: () => Type,
|
|
15
|
+
TypeName: () => TypeName
|
|
16
|
+
});
|
|
17
|
+
const constStyle = {
|
|
18
|
+
string: style_default.LiteralString,
|
|
19
|
+
number: style_default.LiteralNumeric,
|
|
20
|
+
boolean: style_default.LiteralBoolean
|
|
21
|
+
};
|
|
22
|
+
function showFullType(type) {
|
|
23
|
+
if (type.kind !== "PythonTypeReference") return false;
|
|
24
|
+
return type.typeName === "Optional" ? showFullType(type.typeParameters[0]) : type.typeParameters.length > 0;
|
|
25
|
+
}
|
|
26
|
+
function TypeName({ type }) {
|
|
27
|
+
const Lang = useLanguageComponents();
|
|
28
|
+
if (type.kind === "PythonTypeReference") switch (type.typeName) {
|
|
29
|
+
case "Optional": return /* @__PURE__ */ jsx(Lang.TypeName, { type: type.typeParameters[0] });
|
|
30
|
+
case "List":
|
|
31
|
+
case "Iterable":
|
|
32
|
+
case "Literal":
|
|
33
|
+
case "Union": return type.typeName.toLowerCase();
|
|
34
|
+
}
|
|
35
|
+
return /* @__PURE__ */ jsx(Lang.Type, { type });
|
|
36
|
+
}
|
|
37
|
+
function Type({ type }) {
|
|
38
|
+
const Lang = useLanguageComponents();
|
|
39
|
+
const { Join, SDKReference } = useComponents();
|
|
40
|
+
switch (type.kind) {
|
|
41
|
+
case "PythonTypeAny":
|
|
42
|
+
case "PythonTypeUnknown":
|
|
43
|
+
case "PythonTypeInt":
|
|
44
|
+
case "PythonTypeFloat":
|
|
45
|
+
case "PythonTypeBool": return /* @__PURE__ */ jsx("span", {
|
|
46
|
+
className: style_default.Type,
|
|
47
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
48
|
+
className: style_default.TypeKeyword,
|
|
49
|
+
children: type.kind.slice(10).toLowerCase()
|
|
50
|
+
})
|
|
51
|
+
});
|
|
52
|
+
case "PythonTypeString": return /* @__PURE__ */ jsx("span", {
|
|
53
|
+
className: style_default.Type,
|
|
54
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
55
|
+
className: style_default.TypeString,
|
|
56
|
+
children: "str"
|
|
57
|
+
})
|
|
58
|
+
});
|
|
59
|
+
case "PythonTypeLiteral": return /* @__PURE__ */ jsx("span", {
|
|
60
|
+
className: style_default.Type,
|
|
61
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
62
|
+
className: constStyle[typeof type.literal.value],
|
|
63
|
+
children: JSON.stringify(type.literal.value)
|
|
64
|
+
})
|
|
65
|
+
});
|
|
66
|
+
case "PythonTypeArray": return /* @__PURE__ */ jsxs("span", {
|
|
67
|
+
className: style_default.Type,
|
|
68
|
+
children: [
|
|
69
|
+
/* @__PURE__ */ jsx("span", {
|
|
70
|
+
className: style_default.TypeArray,
|
|
71
|
+
children: "Array<"
|
|
72
|
+
}),
|
|
73
|
+
/* @__PURE__ */ jsx(Lang.Type, { type: type.elementType }),
|
|
74
|
+
/* @__PURE__ */ jsx("span", {
|
|
75
|
+
className: style_default.TypeArray,
|
|
76
|
+
children: ">"
|
|
77
|
+
})
|
|
78
|
+
]
|
|
79
|
+
});
|
|
80
|
+
case "PythonTypeClass": return /* @__PURE__ */ jsx("span", {
|
|
81
|
+
className: style_default.Type,
|
|
82
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
83
|
+
className: style_default.TypeKeyword,
|
|
84
|
+
children: "class"
|
|
85
|
+
})
|
|
86
|
+
});
|
|
87
|
+
case "PythonTypeMap": return /* @__PURE__ */ jsx("span", {
|
|
88
|
+
className: style_default.Type,
|
|
89
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
90
|
+
className: style_default.TypeKeyword,
|
|
91
|
+
children: "Dict"
|
|
92
|
+
})
|
|
93
|
+
});
|
|
94
|
+
case "PythonTypeReference": {
|
|
95
|
+
const params = type.typeParameters?.map((param, key) => /* @__PURE__ */ jsx(Lang.Type, { type: param }, key));
|
|
96
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
97
|
+
className: style_default.Type,
|
|
98
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
99
|
+
className: type.typeName === "Optional" ? style_default.TypeArray : "",
|
|
100
|
+
children: /* @__PURE__ */ jsx(SDKReference, {
|
|
101
|
+
stainlessPath: type.$ref,
|
|
102
|
+
children: type.typeName
|
|
103
|
+
})
|
|
104
|
+
}), params && params.length > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
105
|
+
/* @__PURE__ */ jsx("span", {
|
|
106
|
+
className: style_default.TypeBracket,
|
|
107
|
+
children: "["
|
|
108
|
+
}),
|
|
109
|
+
/* @__PURE__ */ jsx(Join, {
|
|
110
|
+
items: params,
|
|
111
|
+
limit: 3,
|
|
112
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
113
|
+
className: style_default.TextOperator,
|
|
114
|
+
children: ", "
|
|
115
|
+
})
|
|
116
|
+
}),
|
|
117
|
+
/* @__PURE__ */ jsx("span", {
|
|
118
|
+
className: style_default.TypeBracket,
|
|
119
|
+
children: "]"
|
|
120
|
+
})
|
|
121
|
+
] })]
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
function MethodSignature({ decl }) {
|
|
127
|
+
const Lang = useLanguageComponents();
|
|
128
|
+
const { Join, Tooltip } = useComponents();
|
|
129
|
+
const params = decl.parameters.map((param, i) => /* @__PURE__ */ jsx(React$1.Fragment, { children: /* @__PURE__ */ jsx(Tooltip, {
|
|
130
|
+
content: /* @__PURE__ */ jsx(Lang.Type, { type: param.type }),
|
|
131
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
132
|
+
className: style_default.TextIdentifier,
|
|
133
|
+
children: param.ident
|
|
134
|
+
})
|
|
135
|
+
}) }, i));
|
|
136
|
+
return /* @__PURE__ */ jsx("div", {
|
|
137
|
+
className: style_default.MethodSignature,
|
|
138
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
139
|
+
className: style_default.SignatureTitle,
|
|
140
|
+
children: [
|
|
141
|
+
decl.async && /* @__PURE__ */ jsx("span", {
|
|
142
|
+
className: style_default.TextKeyword,
|
|
143
|
+
children: "async "
|
|
144
|
+
}),
|
|
145
|
+
decl.qualified && /* @__PURE__ */ jsx("span", {
|
|
146
|
+
className: style_default.SignatureQualified,
|
|
147
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
148
|
+
className: style_default.TextIdentifier,
|
|
149
|
+
children: decl.qualified?.slice(0, -decl.ident.length)
|
|
150
|
+
})
|
|
151
|
+
}),
|
|
152
|
+
/* @__PURE__ */ jsx("span", {
|
|
153
|
+
className: style_default.SignatureName,
|
|
154
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
155
|
+
className: style_default.TextIdentifier,
|
|
156
|
+
children: decl.ident
|
|
157
|
+
})
|
|
158
|
+
}),
|
|
159
|
+
/* @__PURE__ */ jsxs("span", {
|
|
160
|
+
className: style_default.MethodSignature,
|
|
161
|
+
children: [
|
|
162
|
+
/* @__PURE__ */ jsx("span", {
|
|
163
|
+
className: style_default.SignatureParen,
|
|
164
|
+
children: "("
|
|
165
|
+
}),
|
|
166
|
+
/* @__PURE__ */ jsx("span", {
|
|
167
|
+
className: style_default.SignatureParams,
|
|
168
|
+
children: /* @__PURE__ */ jsx(Join, {
|
|
169
|
+
items: params,
|
|
170
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
171
|
+
className: style_default.TextOperator,
|
|
172
|
+
children: ", "
|
|
173
|
+
})
|
|
174
|
+
})
|
|
175
|
+
}),
|
|
176
|
+
/* @__PURE__ */ jsxs("span", {
|
|
177
|
+
className: style_default.SignatureParen,
|
|
178
|
+
children: [")", " "]
|
|
179
|
+
}),
|
|
180
|
+
decl.returns && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
181
|
+
className: style_default.TextOperator,
|
|
182
|
+
children: " -> "
|
|
183
|
+
}), /* @__PURE__ */ jsx(Lang.Type, { type: decl.returns })] })
|
|
184
|
+
]
|
|
185
|
+
})
|
|
186
|
+
]
|
|
187
|
+
})
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
function Property({ decl, children }) {
|
|
191
|
+
const Lang = useLanguageComponents();
|
|
192
|
+
if (!decl) return;
|
|
193
|
+
switch (decl.kind) {
|
|
194
|
+
case "PythonDeclProperty": return children({
|
|
195
|
+
name: decl.ident,
|
|
196
|
+
typeName: /* @__PURE__ */ jsx(Lang.TypeName, { type: decl.type }),
|
|
197
|
+
type: showFullType(decl.type) && /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
|
|
198
|
+
});
|
|
199
|
+
case "PythonDeclClass": return children({
|
|
200
|
+
name: decl.ident,
|
|
201
|
+
typeName: "class"
|
|
202
|
+
});
|
|
203
|
+
case "PythonDeclType": return children({
|
|
204
|
+
name: decl.ident,
|
|
205
|
+
typeName: "type",
|
|
206
|
+
type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
|
|
207
|
+
});
|
|
208
|
+
case "PythonDeclReference": return children({ type: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type }) });
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
function Declaration({ decl }) {
|
|
212
|
+
const Lang = useLanguageComponents();
|
|
213
|
+
if (!decl) return;
|
|
214
|
+
switch (decl.kind) {
|
|
215
|
+
case "PythonDeclProperty": {
|
|
216
|
+
const nullable = decl.type.kind === "PythonTypeReference" && decl.type.typeName === "Optional" && (decl.type.typeParameters ?? []).length > 0;
|
|
217
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
218
|
+
/* @__PURE__ */ jsx("span", {
|
|
219
|
+
className: style_default.TypePropertyName,
|
|
220
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
221
|
+
className: style_default.TextIdentifier,
|
|
222
|
+
children: decl.ident
|
|
223
|
+
})
|
|
224
|
+
}),
|
|
225
|
+
/* @__PURE__ */ jsx("span", {
|
|
226
|
+
className: style_default.TextPunctuation,
|
|
227
|
+
children: ": "
|
|
228
|
+
}),
|
|
229
|
+
decl.optional && !nullable ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
230
|
+
/* @__PURE__ */ jsx("span", {
|
|
231
|
+
className: style_default.TypePlain,
|
|
232
|
+
children: "Optional"
|
|
233
|
+
}),
|
|
234
|
+
/* @__PURE__ */ jsx("span", {
|
|
235
|
+
className: style_default.TypeBracket,
|
|
236
|
+
children: "["
|
|
237
|
+
}),
|
|
238
|
+
/* @__PURE__ */ jsx(Lang.Type, { type: decl.type }),
|
|
239
|
+
/* @__PURE__ */ jsx("span", {
|
|
240
|
+
className: style_default.TypeBrace,
|
|
241
|
+
children: "]"
|
|
242
|
+
})
|
|
243
|
+
] }) : /* @__PURE__ */ jsx(Lang.Type, { type: decl.type })
|
|
244
|
+
] });
|
|
245
|
+
}
|
|
246
|
+
case "PythonDeclClass": return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
247
|
+
/* @__PURE__ */ jsx("span", {
|
|
248
|
+
className: style_default.TextKeyword,
|
|
249
|
+
children: "class "
|
|
250
|
+
}),
|
|
251
|
+
/* @__PURE__ */ jsx("span", {
|
|
252
|
+
className: style_default.TextIdentifier,
|
|
253
|
+
children: decl.ident
|
|
254
|
+
}),
|
|
255
|
+
/* @__PURE__ */ jsx("span", {
|
|
256
|
+
className: style_default.TextPunctuation,
|
|
257
|
+
children: ": "
|
|
258
|
+
}),
|
|
259
|
+
/* @__PURE__ */ jsx("span", {
|
|
260
|
+
className: `${style_default.TypePreviewContent} ${style_default.TextPunctuation}`,
|
|
261
|
+
children: "…"
|
|
262
|
+
})
|
|
263
|
+
] });
|
|
264
|
+
case "PythonDeclType": return /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(Lang.Type, { type: decl.type }) });
|
|
265
|
+
case "PythonDeclReference": return /* @__PURE__ */ jsx(Lang.Type, { type: decl.type });
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
//#endregion
|
|
270
|
+
export { Declaration, MethodSignature, Property, Type, TypeName, python_exports as t };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { g as RubyAST } 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/ruby.d.ts
|
|
7
|
+
declare namespace ruby_d_exports {
|
|
8
|
+
export { Declaration, DeclarationProps, MethodSignature, MethodSignatureProps, Property, PropertyProps, Type, TypeName };
|
|
9
|
+
}
|
|
10
|
+
type TypeProps = {
|
|
11
|
+
type: RubyAST.RubyType;
|
|
12
|
+
};
|
|
13
|
+
declare function TypeName({
|
|
14
|
+
type
|
|
15
|
+
}: TypeProps): string | react_jsx_runtime0.JSX.Element;
|
|
16
|
+
declare function Type({
|
|
17
|
+
type
|
|
18
|
+
}: TypeProps): react_jsx_runtime0.JSX.Element;
|
|
19
|
+
type MethodSignatureProps = {
|
|
20
|
+
decl: RubyAST.RubyDeclFunction;
|
|
21
|
+
};
|
|
22
|
+
declare function MethodSignature({
|
|
23
|
+
decl
|
|
24
|
+
}: MethodSignatureProps): react_jsx_runtime0.JSX.Element;
|
|
25
|
+
type PropertyProps = {
|
|
26
|
+
decl: RubyAST.RubyDeclaration;
|
|
27
|
+
children: PropertyFn;
|
|
28
|
+
};
|
|
29
|
+
declare function Property({
|
|
30
|
+
decl,
|
|
31
|
+
children
|
|
32
|
+
}: PropertyProps): React$1.ReactNode;
|
|
33
|
+
type DeclarationProps = {
|
|
34
|
+
decl: RubyAST.RubyDeclaration;
|
|
35
|
+
};
|
|
36
|
+
declare function Declaration({
|
|
37
|
+
decl
|
|
38
|
+
}: DeclarationProps): react_jsx_runtime0.JSX.Element | undefined;
|
|
39
|
+
//#endregion
|
|
40
|
+
export { Declaration, DeclarationProps, MethodSignature, MethodSignatureProps, Property, PropertyProps, Type, TypeName, ruby_d_exports as t };
|