@stainless-api/docs-ui 0.1.0-beta.10 → 0.1.0-beta.11
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/breadcrumbs-Z-hEqjcp.d.ts +19 -0
- package/dist/chunk-Bp6m_JJh.js +13 -0
- package/dist/component-generics-DzI21jRn.js +35 -0
- package/dist/component-generics-q5Dqiu2D.d.ts +30 -0
- package/dist/components/breadcrumbs.d.ts +2 -11
- package/dist/components/breadcrumbs.js +16 -52
- package/dist/components/chat.d.ts +13 -5
- package/dist/components/chat.js +138 -74
- package/dist/components/dropdown.d.ts +2 -17
- package/dist/components/dropdown.js +4 -18
- package/dist/components/icons.d.ts +50 -27
- package/dist/components/icons.js +3 -34
- package/dist/components/index.d.ts +12 -9
- package/dist/components/index.js +16 -10
- package/dist/components/method.d.ts +2 -41
- package/dist/components/method.js +16 -44
- package/dist/components/overview.d.ts +2 -21
- package/dist/components/overview.js +16 -49
- package/dist/components/primitives.d.ts +2 -60
- package/dist/components/primitives.js +16 -117
- package/dist/components/properties.d.ts +2 -24
- package/dist/components/properties.js +16 -24
- package/dist/components/scripts/dropdown.d.ts +11 -4
- package/dist/components/scripts/dropdown.js +49 -63
- package/dist/components/sdk.d.ts +3 -78
- package/dist/components/sdk.js +16 -153
- package/dist/components/sidebar.d.ts +2 -22
- package/dist/components/sidebar.js +16 -30
- package/dist/components/snippets.d.ts +4 -28
- package/dist/components/snippets.js +16 -76
- package/dist/contexts/component-generics.d.ts +2 -25
- package/dist/contexts/component-generics.js +3 -24
- package/dist/contexts/component-types.d.ts +18 -4
- package/dist/contexts/component-types.js +1 -2
- package/dist/contexts/component.d.ts +31 -14
- package/dist/contexts/component.js +16 -14
- package/dist/contexts/docs.d.ts +2 -34
- package/dist/contexts/docs.js +3 -43
- package/dist/contexts/index.d.ts +20 -7
- package/dist/contexts/index.js +16 -15
- package/dist/contexts/markdown.d.ts +2 -13
- package/dist/contexts/markdown.js +4 -29
- package/dist/contexts/navigation.d.ts +3 -19
- package/dist/contexts/navigation.js +3 -14
- package/dist/contexts/search.d.ts +4 -13
- package/dist/contexts/search.js +16 -15
- package/dist/contexts/use-components.d.ts +16 -1
- package/dist/contexts/use-components.js +4 -3
- package/dist/contexts-DRxRO-xO.js +3747 -0
- package/dist/docs-Dh8kE1va.js +50 -0
- package/dist/docs-EUy-wfbA.d.ts +43 -0
- package/dist/dropdown-B7VyGMOw.d.ts +43 -0
- package/dist/dropdown-DtgAi6lb.js +62 -0
- package/dist/icons-DdKM-01E.js +753 -0
- package/dist/index-AicgPYKB.d.ts +239 -0
- package/dist/index-BhwLhiWk.d.ts +14 -0
- package/dist/index-YnpUtXLB.d.ts +16 -0
- package/dist/index.d.ts +22 -6
- package/dist/index.js +16 -7
- package/dist/languages/go.d.ts +13 -21
- package/dist/languages/go.js +16 -116
- package/dist/languages/http.d.ts +13 -25
- package/dist/languages/http.js +16 -130
- package/dist/languages/index.d.ts +13 -37
- package/dist/languages/index.js +16 -10
- package/dist/languages/java.d.ts +13 -23
- package/dist/languages/java.js +16 -120
- package/dist/languages/python.d.ts +13 -22
- package/dist/languages/python.js +16 -104
- package/dist/languages/ruby.d.ts +13 -22
- package/dist/languages/ruby.js +16 -125
- package/dist/languages/typescript.d.ts +13 -22
- package/dist/languages/typescript.js +16 -134
- package/dist/markdown/index.d.ts +11 -6
- package/dist/markdown/index.js +16 -80
- package/dist/markdown/md.d.ts +15 -11
- package/dist/markdown/md.js +3 -34
- package/dist/markdown/utils.d.ts +4 -17
- package/dist/markdown/utils.js +3 -30
- package/dist/markdown-BXfX1D7C.js +42 -0
- package/dist/markdown-nFyAEX_K.d.ts +22 -0
- package/dist/md-Dg8aOyMA.js +41 -0
- package/dist/method-DpsVuzZW.d.ts +71 -0
- package/dist/navigation-aoYZ_tl4.js +24 -0
- package/dist/navigation-nyXBY-75.d.ts +29 -0
- package/dist/overview-C8e-6jGr.d.ts +38 -0
- package/dist/pagefind-ChrPfuVv.js +15 -0
- package/dist/primitives-DWz23_Ub.d.ts +99 -0
- package/dist/properties-CF71V58d.d.ts +46 -0
- package/dist/routing-DQjbRxdJ.js +189 -0
- package/dist/routing-qc0V00-j.d.ts +51 -0
- package/dist/routing.d.ts +2 -44
- package/dist/routing.js +3 -169
- package/dist/sdk-Zg3Rggk3.d.ts +118 -0
- package/dist/search/index.d.ts +26 -1
- package/dist/search/index.js +332 -2
- package/dist/search/providers/algolia.d.ts +22 -7
- package/dist/search/providers/algolia.js +16 -64
- package/dist/search/providers/fuse.d.ts +16 -9
- package/dist/search/providers/fuse.js +29 -12
- package/dist/search/providers/pagefind.d.ts +7 -2
- package/dist/search/providers/pagefind.js +3 -19
- package/dist/search/providers/walker.d.ts +8 -5
- package/dist/search/providers/walker.js +28 -19
- package/dist/search/types.d.ts +3 -79
- package/dist/search/types.js +3 -24
- package/dist/search-B6loAGmB.d.ts +21 -0
- package/dist/sidebar-C8KirYjg.d.ts +35 -0
- package/dist/snippets-EUzM4fRO.d.ts +45 -0
- package/dist/style-pN9hCoec.d.ts +181 -0
- package/dist/style-rYbbxIR_.js +182 -0
- package/dist/style.d.ts +2 -179
- package/dist/style.js +3 -179
- package/dist/styles/main.css +740 -746
- package/dist/styles/main.js +1 -0
- package/dist/styles/primitives.css +436 -428
- package/dist/styles/primitives.js +1 -0
- package/dist/styles/resets.css +34 -41
- package/dist/styles/resets.js +1 -0
- package/dist/styles/search.css +248 -248
- package/dist/styles/search.js +1 -0
- package/dist/styles/sidebar.css +59 -60
- package/dist/styles/sidebar.js +1 -0
- package/dist/styles/snippets.css +87 -88
- package/dist/styles/snippets.js +1 -0
- package/dist/styles/variables.css +86 -89
- package/dist/styles/variables.js +1 -0
- package/dist/types-CTBDtD34.d.ts +82 -0
- package/dist/types-DFN4M1Sp.js +34 -0
- package/dist/use-components-D9E85p5x.js +7 -0
- package/dist/utils-BHwvUDKn.js +30 -0
- package/dist/utils-CJfFBNgT.js +32 -0
- package/dist/utils-DQhEbvUC.d.ts +20 -0
- package/dist/utils-nDazhti8.d.ts +11 -0
- package/dist/utils.d.ts +2 -7
- package/dist/utils.js +4 -27
- package/package.json +2 -2
- package/dist/components/breadcrumbs.js.map +0 -1
- package/dist/components/chat.js.map +0 -1
- package/dist/components/dropdown.js.map +0 -1
- package/dist/components/icons.js.map +0 -1
- package/dist/components/index.js.map +0 -1
- package/dist/components/method.js.map +0 -1
- package/dist/components/overview.js.map +0 -1
- package/dist/components/primitives.js.map +0 -1
- package/dist/components/properties.js.map +0 -1
- package/dist/components/scripts/dropdown.js.map +0 -1
- package/dist/components/sdk.js.map +0 -1
- package/dist/components/sidebar.js.map +0 -1
- package/dist/components/snippets.js.map +0 -1
- package/dist/contexts/component-generics.js.map +0 -1
- package/dist/contexts/component-types.js.map +0 -1
- package/dist/contexts/component.js.map +0 -1
- package/dist/contexts/docs.js.map +0 -1
- package/dist/contexts/index.js.map +0 -1
- package/dist/contexts/markdown.js.map +0 -1
- package/dist/contexts/navigation.js.map +0 -1
- package/dist/contexts/search.js.map +0 -1
- package/dist/contexts/use-components.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/languages/go.js.map +0 -1
- package/dist/languages/http.js.map +0 -1
- package/dist/languages/index.js.map +0 -1
- package/dist/languages/java.js.map +0 -1
- package/dist/languages/python.js.map +0 -1
- package/dist/languages/ruby.js.map +0 -1
- package/dist/languages/typescript.js.map +0 -1
- package/dist/markdown/index.js.map +0 -1
- package/dist/markdown/md.js.map +0 -1
- package/dist/markdown/utils.js.map +0 -1
- package/dist/mcp.js +0 -16105
- package/dist/routing.js.map +0 -1
- package/dist/search/form.d.ts +0 -13
- package/dist/search/form.js +0 -55
- package/dist/search/form.js.map +0 -1
- package/dist/search/index.js.map +0 -1
- package/dist/search/indexer.d.ts +0 -31
- package/dist/search/indexer.js +0 -212
- package/dist/search/indexer.js.map +0 -1
- package/dist/search/mcp.d.ts +0 -8
- package/dist/search/mcp.js +0 -43
- package/dist/search/mcp.js.map +0 -1
- package/dist/search/printer.d.ts +0 -6
- package/dist/search/printer.js +0 -43
- package/dist/search/printer.js.map +0 -1
- package/dist/search/providers/algolia.js.map +0 -1
- package/dist/search/providers/fuse.js.map +0 -1
- package/dist/search/providers/pagefind.js.map +0 -1
- package/dist/search/providers/walker.js.map +0 -1
- package/dist/search/results.d.ts +0 -21
- package/dist/search/results.js +0 -58
- package/dist/search/results.js.map +0 -1
- package/dist/search/state.d.ts +0 -29
- package/dist/search/state.js +0 -38
- package/dist/search/state.js.map +0 -1
- package/dist/search/types.js.map +0 -1
- package/dist/style.js.map +0 -1
- package/dist/types/sdkjson.d.ts +0 -1
- package/dist/types/sdkjson.js +0 -2
- package/dist/types/sdkjson.js.map +0 -1
- package/dist/types/stainless-alias/lib/json-spec-v2/GoAST.d.ts +0 -120
- package/dist/types/stainless-alias/lib/json-spec-v2/GoAST.js +0 -2
- package/dist/types/stainless-alias/lib/json-spec-v2/GoAST.js.map +0 -1
- package/dist/types/stainless-alias/lib/json-spec-v2/HttpAST.d.ts +0 -100
- package/dist/types/stainless-alias/lib/json-spec-v2/HttpAST.js +0 -3
- package/dist/types/stainless-alias/lib/json-spec-v2/HttpAST.js.map +0 -1
- package/dist/types/stainless-alias/lib/json-spec-v2/JavaAST.d.ts +0 -87
- package/dist/types/stainless-alias/lib/json-spec-v2/JavaAST.js +0 -2
- package/dist/types/stainless-alias/lib/json-spec-v2/JavaAST.js.map +0 -1
- package/dist/types/stainless-alias/lib/json-spec-v2/PythonAST.d.ts +0 -110
- package/dist/types/stainless-alias/lib/json-spec-v2/PythonAST.js +0 -3
- package/dist/types/stainless-alias/lib/json-spec-v2/PythonAST.js.map +0 -1
- package/dist/types/stainless-alias/lib/json-spec-v2/RubyAST.d.ts +0 -122
- package/dist/types/stainless-alias/lib/json-spec-v2/RubyAST.js +0 -2
- package/dist/types/stainless-alias/lib/json-spec-v2/RubyAST.js.map +0 -1
- package/dist/types/stainless-alias/lib/json-spec-v2/TSAST.d.ts +0 -146
- package/dist/types/stainless-alias/lib/json-spec-v2/TSAST.js +0 -3
- package/dist/types/stainless-alias/lib/json-spec-v2/TSAST.js.map +0 -1
- package/dist/types/stainless-alias/lib/json-spec-v2/TerraformAST.d.ts +0 -89
- package/dist/types/stainless-alias/lib/json-spec-v2/TerraformAST.js +0 -3
- package/dist/types/stainless-alias/lib/json-spec-v2/TerraformAST.js.map +0 -1
- package/dist/types/stainless-alias/lib/json-spec-v2/types.d.ts +0 -190
- package/dist/types/stainless-alias/lib/json-spec-v2/types.js +0 -105
- package/dist/types/stainless-alias/lib/json-spec-v2/types.js.map +0 -1
- package/dist/utils.js.map +0 -1
package/dist/languages/http.js
CHANGED
|
@@ -1,130 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return (_jsx(_Fragment, { children: _jsx("span", { className: style.TextIdentifier, children: /^[_a-zA-Z][_a-zA-Z0-9]*$/.test(name) ? name : JSON.stringify(name) }) }));
|
|
18
|
-
}
|
|
19
|
-
function TypePreview({ path }) {
|
|
20
|
-
const spec = useSpec();
|
|
21
|
-
const language = useLanguage();
|
|
22
|
-
const decl = useDeclaration(path);
|
|
23
|
-
const { Join } = useComponents();
|
|
24
|
-
if (!(decl && 'children' in decl && decl.children.length > 0) || decl['type']?.['kind'] === 'HttpTypeUnion')
|
|
25
|
-
return;
|
|
26
|
-
const items = decl.children.map((prop, key) => (_jsx("span", { className: style.TypePropertyName, children: _jsx("span", { className: style.TextIdentifier, children: spec?.decls?.[language]?.[prop]?.['key'] }) }, key)));
|
|
27
|
-
return (_jsxs("span", { className: style.TypePreview, "data-stldocs-type-preview": "properties", children: [_jsx("span", { className: style.TypeBrace, children: ' { ' }), _jsx("span", { className: style.TypePreviewContent, children: _jsx(Join, { items: items, limit: 3, children: _jsx("span", { className: style.TextOperator, children: ", " }) }) }), _jsx("span", { className: style.TypeBrace, children: ' } ' })] }));
|
|
28
|
-
}
|
|
29
|
-
export function TypeName({ type }) {
|
|
30
|
-
const Lang = useLanguageComponents();
|
|
31
|
-
if (type.kind === 'HttpTypeArray')
|
|
32
|
-
return _jsxs(_Fragment, { children: ["array of ", _jsx(Lang.TypeName, { type: type.elementType })] });
|
|
33
|
-
if (type.kind === 'HttpTypeUnion' && type.types.every((t) => t.kind === 'HttpTypeLiteral'))
|
|
34
|
-
return 'enum';
|
|
35
|
-
if (type.kind === 'HttpTypeReference' && type.ident.split('.').at(-1) === 'Record')
|
|
36
|
-
return 'map';
|
|
37
|
-
return ComplexTypes[type.kind] ?? _jsx(Lang.Type, { type: type });
|
|
38
|
-
}
|
|
39
|
-
export function Type({ type }) {
|
|
40
|
-
const Lang = useLanguageComponents();
|
|
41
|
-
const { Join, SDKReference } = useComponents();
|
|
42
|
-
switch (type.kind) {
|
|
43
|
-
case 'HttpTypeUnknown':
|
|
44
|
-
case 'HttpTypeUndefined':
|
|
45
|
-
case 'HttpTypeNull':
|
|
46
|
-
case 'HttpTypeBoolean':
|
|
47
|
-
case 'HttpTypeNumber':
|
|
48
|
-
return (_jsx("span", { className: style.Type, children: _jsx("span", { className: style.TypePlain, children: type.kind.slice(8).toLowerCase() }) }));
|
|
49
|
-
case 'HttpTypeString':
|
|
50
|
-
return (_jsx("span", { className: style.Type, children: _jsx("span", { className: style.TypePlain, children: "string" }) }));
|
|
51
|
-
case 'HttpTypeLiteral':
|
|
52
|
-
return (_jsx("span", { className: style.Type, children: _jsx("span", { className: constStyle[typeof type.literal], children: JSON.stringify(type.literal) }) }));
|
|
53
|
-
case 'HttpTypeArray': {
|
|
54
|
-
return (_jsxs("span", { className: style.Type, children: [_jsx("span", { className: style.TypeArray, children: 'array of ' }), _jsx(Lang.Type, { type: type.elementType })] }));
|
|
55
|
-
}
|
|
56
|
-
case 'HttpTypeIntersection':
|
|
57
|
-
case 'HttpTypeUnion': {
|
|
58
|
-
const items = type.types.map((t, key) => _jsx(Lang.Type, { type: t }, key));
|
|
59
|
-
const delimiter = type.kind === 'HttpTypeUnion' ? 'or' : 'and';
|
|
60
|
-
return (_jsx("span", { className: style.Type, children: _jsx("span", { className: style.TypePreview, "data-stldocs-type-preview": "union", children: _jsx("span", { className: style.TypePreviewContent, children: _jsx(Join, { items: items, limit: 3, children: _jsxs("span", { className: style.TextOperator, children: [" ", delimiter, " "] }) }) }) }) }));
|
|
61
|
-
}
|
|
62
|
-
case 'HttpTypeReference': {
|
|
63
|
-
const name = type.ident.split('.').at(-1);
|
|
64
|
-
const params = type.typeParameters?.map((param, key) => _jsx(Lang.Type, { type: param }, key));
|
|
65
|
-
// TODO: come up with an unambiguous way to identify these on the sdkjson side
|
|
66
|
-
// This is sketchy because it's possible for a user-defined type to be named "Record"
|
|
67
|
-
if (name === 'Record' &&
|
|
68
|
-
type.typeParameters?.length === 2 &&
|
|
69
|
-
type.typeParameters?.at(0).kind === 'HttpTypeString')
|
|
70
|
-
return (_jsxs(_Fragment, { children: [_jsx("span", { className: style.TypeArray, children: "map" }), "[", params?.[1], "]"] }));
|
|
71
|
-
return (_jsxs("span", { className: style.Type, children: [_jsx(SDKReference, { stainlessPath: type.$ref, children: name }), params && params.length > 0 && (_jsxs(_Fragment, { children: [_jsx("span", { className: style.TypeBracket, children: '<' }), _jsx(Join, { items: params, limit: 3, children: _jsx("span", { className: style.TextOperator, children: ", " }) }), _jsx("span", { className: style.TypeBracket, children: '>' })] })), _jsx(TypePreview, { path: type.$ref })] }));
|
|
72
|
-
}
|
|
73
|
-
case 'HttpTypeObject':
|
|
74
|
-
const items = type.members.map(({ ident }) => (_jsx("span", { className: style.TypePropertyName, children: _jsx(Identifier, { name: ident }) })));
|
|
75
|
-
return (_jsxs("span", { className: style.Type, children: [_jsx("span", { className: style.TypePlain, children: "object" }), _jsxs("span", { className: style.TypePreview, "data-stldocs-type-preview": "properties", children: [_jsx("span", { className: style.TypeBrace, children: ' {' }), _jsxs("span", { className: style.TypePreviewContent, children: [' ', _jsx(Join, { items: items, limit: 3, children: _jsx("span", { className: style.TextOperator, children: ", " }) }), ' '] }), _jsx("span", { className: style.TypeBrace, children: '} ' })] })] }));
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
export function MethodSignature({ decl }) {
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
export function MethodInfo({ decl, children }) {
|
|
82
|
-
const Docs = useComponents();
|
|
83
|
-
const params = Object.entries(decl.paramsChildren)
|
|
84
|
-
.filter(([_, value]) => value.length)
|
|
85
|
-
.map(([location, value]) => (_jsx(React.Fragment, { children: _jsxs("div", { className: style.MethodParameters, "data-stldocs-property-group": location.at(0), children: [_jsxs("h5", { children: [location.at(0).toUpperCase(), location.slice(1), " Parameters", _jsx(PropertyToggle, { target: location.at(0) })] }), _jsx(Docs.SDKChildren, { paths: value })] }) }, location)));
|
|
86
|
-
if (decl.bodyParamsChildren?.['application/json']?.length > 0)
|
|
87
|
-
params.push(_jsxs("div", { className: style.MethodInfoSection, children: [_jsxs("h5", { children: ["Body Parameters", _jsx(PropertyToggle, { target: "body" })] }), _jsx("div", { className: style.MethodParameters, "data-stldocs-property-group": "body", children: _jsx(Docs.SDKChildren, { paths: decl.bodyParamsChildren?.['application/json'] }) })] }));
|
|
88
|
-
return (_jsxs("div", { className: style.MethodInfo, children: [children && _jsx("div", { className: style.MethodContent, children: children }), params.length > 0 && params, decl.responseChildren.length > 0 && (_jsxs("div", { className: style.MethodInfoSection, children: [_jsxs("h5", { children: ["Returns", _jsx(PropertyToggle, { target: "returns" })] }), _jsx("div", { className: style.MethodReturns, "data-stldocs-property-group": "returns", children: _jsx(Docs.SDKChildren, { paths: decl.responseChildren }) })] }))] }));
|
|
89
|
-
}
|
|
90
|
-
function renderVariantInfo(type) {
|
|
91
|
-
if (type.kind === 'HttpTypeUnion' &&
|
|
92
|
-
type.types.every((t) => t.kind === 'HttpTypeObject' || t.kind === 'HttpTypeReference'))
|
|
93
|
-
return _jsxs(_Fragment, { children: ["One of the following ", type.types.length, " object variants:"] });
|
|
94
|
-
}
|
|
95
|
-
export function Property({ decl, children }) {
|
|
96
|
-
const Lang = useLanguageComponents();
|
|
97
|
-
if (!decl)
|
|
98
|
-
return;
|
|
99
|
-
switch (decl.kind) {
|
|
100
|
-
case 'HttpDeclProperty': {
|
|
101
|
-
const variants = renderVariantInfo(decl.type);
|
|
102
|
-
return children({
|
|
103
|
-
name: decl.key,
|
|
104
|
-
typeName: _jsx(Lang.TypeName, { type: decl.type }),
|
|
105
|
-
type: decl.type.kind in ComplexTypes && !variants && _jsx(Lang.Type, { type: decl.type }),
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
case 'HttpDeclTypeAlias':
|
|
109
|
-
return children({
|
|
110
|
-
name: decl.ident,
|
|
111
|
-
typeName: _jsx(Lang.TypeName, { type: decl.type }),
|
|
112
|
-
});
|
|
113
|
-
case 'HttpDeclReference':
|
|
114
|
-
return children({ type: _jsx(Lang.Type, { type: decl.type }) });
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
export function Declaration({ decl }) {
|
|
118
|
-
const Lang = useLanguageComponents();
|
|
119
|
-
if (!decl)
|
|
120
|
-
return;
|
|
121
|
-
switch (decl.kind) {
|
|
122
|
-
case 'HttpDeclProperty':
|
|
123
|
-
return (_jsxs(_Fragment, { children: [_jsx("span", { className: style.TypePropertyName, children: _jsx(Identifier, { name: decl.key }) }), _jsx("span", { className: style.TextPunctuation, children: ": " }), decl.optional && _jsx("span", { className: style.TextPunctuation, children: "optional " }), _jsx(Lang.Type, { type: decl.type })] }));
|
|
124
|
-
case 'HttpDeclTypeAlias':
|
|
125
|
-
return (_jsxs(_Fragment, { children: [_jsx(Identifier, { name: decl.ident }), _jsx("span", { className: style.TextOperator, children: " = " }), _jsx(Lang.Type, { type: decl.type })] }));
|
|
126
|
-
case 'HttpDeclReference':
|
|
127
|
-
return _jsx(Lang.Type, { type: decl.type });
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
//# sourceMappingURL=http.js.map
|
|
1
|
+
import "../component-generics-DzI21jRn.js";
|
|
2
|
+
import "../docs-Dh8kE1va.js";
|
|
3
|
+
import "../navigation-aoYZ_tl4.js";
|
|
4
|
+
import "../markdown-BXfX1D7C.js";
|
|
5
|
+
import "../routing-DQjbRxdJ.js";
|
|
6
|
+
import "../style-rYbbxIR_.js";
|
|
7
|
+
import "../use-components-D9E85p5x.js";
|
|
8
|
+
import { C as TypeName, S as Type, b as MethodSignature, v as Declaration, x as Property, y as MethodInfo } from "../contexts-DRxRO-xO.js";
|
|
9
|
+
import "../icons-DdKM-01E.js";
|
|
10
|
+
import "../utils-CJfFBNgT.js";
|
|
11
|
+
import "../dropdown-DtgAi6lb.js";
|
|
12
|
+
import "../md-Dg8aOyMA.js";
|
|
13
|
+
import "../utils-BHwvUDKn.js";
|
|
14
|
+
import "../types-DFN4M1Sp.js";
|
|
15
|
+
|
|
16
|
+
export { Declaration, MethodInfo, MethodSignature, Property, Type, TypeName };
|
|
@@ -1,37 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export
|
|
14
|
-
export interface LanguageComponentDefinition {
|
|
15
|
-
Declaration(props: {
|
|
16
|
-
decl: SDKJSON.DeclarationNode;
|
|
17
|
-
}): any;
|
|
18
|
-
Property(props: {
|
|
19
|
-
decl: SDKJSON.DeclarationNode;
|
|
20
|
-
children: PropertyFn;
|
|
21
|
-
}): any;
|
|
22
|
-
TypeName(props: {
|
|
23
|
-
type: SDKJSON.Type;
|
|
24
|
-
optional?: boolean;
|
|
25
|
-
}): any;
|
|
26
|
-
Type(props: {
|
|
27
|
-
type: SDKJSON.Type;
|
|
28
|
-
optional?: boolean;
|
|
29
|
-
}): any;
|
|
30
|
-
MethodSignature(props: {
|
|
31
|
-
decl: SDKJSON.DeclarationNode;
|
|
32
|
-
}): any;
|
|
33
|
-
MethodInfo?(props: {
|
|
34
|
-
decl: SDKJSON.DeclarationNode;
|
|
35
|
-
children?: ReactNode;
|
|
36
|
-
}): any;
|
|
37
|
-
}
|
|
1
|
+
import "../breadcrumbs-Z-hEqjcp.js";
|
|
2
|
+
import "../dropdown-B7VyGMOw.js";
|
|
3
|
+
import "../method-DpsVuzZW.js";
|
|
4
|
+
import "../primitives-DWz23_Ub.js";
|
|
5
|
+
import "../properties-CF71V58d.js";
|
|
6
|
+
import "../routing-qc0V00-j.js";
|
|
7
|
+
import "../sdk-Zg3Rggk3.js";
|
|
8
|
+
import "../snippets-EUzM4fRO.js";
|
|
9
|
+
import "../overview-C8e-6jGr.js";
|
|
10
|
+
import "../sidebar-C8KirYjg.js";
|
|
11
|
+
import "../index-YnpUtXLB.js";
|
|
12
|
+
import { N as python_d_exports, Q as java_d_exports, U as go_d_exports, a as node, h as http_d_exports, i as kotlin, n as PropertyFn, st as typescript_d_exports, t as LanguageComponentDefinition, w as ruby_d_exports } from "../index-AicgPYKB.js";
|
|
13
|
+
export { LanguageComponentDefinition, PropertyFn, go_d_exports as go, http_d_exports as http, java_d_exports as java, kotlin, node, python_d_exports as python, ruby_d_exports as ruby, typescript_d_exports as typescript };
|
package/dist/languages/index.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import "../component-generics-DzI21jRn.js";
|
|
2
|
+
import "../docs-Dh8kE1va.js";
|
|
3
|
+
import "../navigation-aoYZ_tl4.js";
|
|
4
|
+
import "../markdown-BXfX1D7C.js";
|
|
5
|
+
import "../routing-DQjbRxdJ.js";
|
|
6
|
+
import "../style-rYbbxIR_.js";
|
|
7
|
+
import "../use-components-D9E85p5x.js";
|
|
8
|
+
import { A as ruby_exports, H as go_exports, I as python_exports, J as java_exports, _ as node, et as typescript_exports, h as kotlin, w as http_exports } from "../contexts-DRxRO-xO.js";
|
|
9
|
+
import "../icons-DdKM-01E.js";
|
|
10
|
+
import "../utils-CJfFBNgT.js";
|
|
11
|
+
import "../dropdown-DtgAi6lb.js";
|
|
12
|
+
import "../md-Dg8aOyMA.js";
|
|
13
|
+
import "../utils-BHwvUDKn.js";
|
|
14
|
+
import "../types-DFN4M1Sp.js";
|
|
15
|
+
|
|
16
|
+
export { go_exports as go, http_exports as http, java_exports as java, kotlin, node, python_exports as python, ruby_exports as ruby, typescript_exports as typescript };
|
package/dist/languages/java.d.ts
CHANGED
|
@@ -1,23 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
export
|
|
14
|
-
export type PropertyProps = {
|
|
15
|
-
decl: AST.JavaDeclaration;
|
|
16
|
-
children?: PropertyFn;
|
|
17
|
-
};
|
|
18
|
-
export declare function Property({ decl, children }: PropertyProps): React.ReactNode;
|
|
19
|
-
export type DeclarationProps = {
|
|
20
|
-
decl: AST.JavaDeclaration;
|
|
21
|
-
};
|
|
22
|
-
export declare function Declaration({ decl }: DeclarationProps): import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
23
|
-
export {};
|
|
1
|
+
import "../breadcrumbs-Z-hEqjcp.js";
|
|
2
|
+
import "../dropdown-B7VyGMOw.js";
|
|
3
|
+
import "../method-DpsVuzZW.js";
|
|
4
|
+
import "../primitives-DWz23_Ub.js";
|
|
5
|
+
import "../properties-CF71V58d.js";
|
|
6
|
+
import "../routing-qc0V00-j.js";
|
|
7
|
+
import "../sdk-Zg3Rggk3.js";
|
|
8
|
+
import "../snippets-EUzM4fRO.js";
|
|
9
|
+
import "../overview-C8e-6jGr.js";
|
|
10
|
+
import "../sidebar-C8KirYjg.js";
|
|
11
|
+
import "../index-YnpUtXLB.js";
|
|
12
|
+
import { G as DeclarationProps, J as Property, K as MethodSignature, W as Declaration, X as Type, Y as PropertyProps, Z as TypeName, q as MethodSignatureProps } from "../index-AicgPYKB.js";
|
|
13
|
+
export { Declaration, DeclarationProps, MethodSignature, MethodSignatureProps, Property, PropertyProps, Type, TypeName };
|
package/dist/languages/java.js
CHANGED
|
@@ -1,120 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
if (type.kind === 'JavaTypeReference' && type.typeName === 'List')
|
|
18
|
-
return 'List';
|
|
19
|
-
return _jsx(Lang.Type, { type: type, optional: optional });
|
|
20
|
-
}
|
|
21
|
-
export function Type({ type, optional }) {
|
|
22
|
-
const language = useLanguage();
|
|
23
|
-
const Lang = useLanguageComponents();
|
|
24
|
-
const { Join, SDKReference } = useComponents();
|
|
25
|
-
switch (type.kind) {
|
|
26
|
-
case 'JavaTypeReference': {
|
|
27
|
-
const name = type.typeName.split('.').at(-1);
|
|
28
|
-
const params = type.typeParameters?.map((param, key) => (_jsx(Lang.Type, { type: param, optional: optional }, key)));
|
|
29
|
-
return (_jsxs("span", { className: style.Type, children: [_jsx(SDKReference, { stainlessPath: type.$ref, children: name }), params && params.length > 0 ? (_jsxs(_Fragment, { children: [_jsx("span", { className: style.TypeBracket, children: '<' }), _jsx(Join, { items: params, limit: 3, children: _jsx("span", { className: style.TextOperator, children: ", " }) }), _jsx("span", { className: style.TypeBracket, children: '>' })] })) : null] }));
|
|
30
|
-
}
|
|
31
|
-
case 'JavaTypeClass':
|
|
32
|
-
case 'JavaTypeUnion':
|
|
33
|
-
return (_jsx("span", { className: style.Type, children: _jsx("span", { className: style.TypeKeyword, children: "class" }) }));
|
|
34
|
-
case 'JavaTypeEnum':
|
|
35
|
-
return (_jsx("span", { className: style.Type, children: _jsx("span", { className: style.TypeKeyword, children: language === 'kotlin' ? 'enum class' : 'enum' }) }));
|
|
36
|
-
case 'JavaTypeVoid':
|
|
37
|
-
return (_jsx("span", { className: style.Type, children: _jsx("span", { className: style.TypeKeyword, children: language === 'kotlin' ? 'Nothing?' : 'Void' }) }));
|
|
38
|
-
case 'JavaTypeBoolean':
|
|
39
|
-
return (_jsx("span", { className: style.Type, children: _jsx("span", { className: style.TypeKeyword, children: language === 'kotlin' || optional ? 'Boolean' : 'boolean' }) }));
|
|
40
|
-
case 'JavaTypeDouble':
|
|
41
|
-
return (_jsx("span", { className: style.Type, children: _jsx("span", { className: style.TypeKeyword, children: language === 'kotlin' || optional ? 'Double' : 'double' }) }));
|
|
42
|
-
case 'JavaTypeLong':
|
|
43
|
-
return (_jsx("span", { className: style.Type, children: _jsx("span", { className: style.TypeKeyword, children: language === 'kotlin' || optional ? 'Long' : 'long' }) }));
|
|
44
|
-
case 'JavaTypeString':
|
|
45
|
-
return (_jsx("span", { className: style.Type, children: _jsx("span", { className: style.TypeString, children: "String" }) }));
|
|
46
|
-
case 'JavaTypeConstant':
|
|
47
|
-
return (_jsxs("span", { className: style.Type, children: [_jsx("span", { className: style.TypeKeyword, children: "JsonValue" }), ";"] }));
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
export function MethodSignature({ decl }) {
|
|
51
|
-
const Lang = useLanguageComponents();
|
|
52
|
-
const language = useLanguage();
|
|
53
|
-
const { Join, Tooltip } = useComponents();
|
|
54
|
-
const params = decl.parameters.map((param, i) => (_jsx(React.Fragment, { children: _jsxs(Tooltip, { content: _jsx(Lang.Type, { type: param.typeAnnotation }), children: [_jsx("span", { className: style.TextIdentifier, children: param.ident }), param.hasDefault && (_jsxs(_Fragment, { children: [' ', _jsx("span", { className: style.TextOperator, children: "=" }), " ", _jsx(Lang.Type, { type: param.typeAnnotation }), _jsx("span", { className: style.TextOperator, children: "." }), _jsx("span", { className: style.TextIdentifier, children: "none" }), _jsx("span", { className: style.TextOperator, children: "()" })] }))] }) }, i)));
|
|
55
|
-
return (_jsx("div", { className: style.MethodSignature, children: _jsxs("span", { className: style.SignatureTitle, children: [decl.returnType && language !== 'kotlin' && (_jsxs("span", { className: style.SignatureReturns, children: [_jsx(Lang.Type, { type: decl.returnType }), ' '] })), decl.qualified && (_jsx("span", { className: style.SignatureQualified, children: _jsx("span", { className: style.TextIdentifier, children: decl.qualified?.slice(0, -decl.ident.length) }) })), _jsx("span", { className: style.SignatureName, children: _jsx("span", { className: style.TextIdentifier, children: decl.ident }) }), _jsxs("span", { className: style.MethodSignature, children: [_jsx("span", { className: style.SignatureParen, children: '(' }), _jsx("span", { className: style.SignatureParams, children: _jsx(Join, { items: params, children: _jsx("span", { className: style.TextOperator, children: ', ' }) }) }), _jsxs("span", { className: style.SignatureParen, children: [')', " "] }), decl.returnType && language === 'kotlin' && (_jsxs(_Fragment, { children: [_jsx("span", { className: style.TextOperator, children: ":" }), " ", _jsx(Lang.Type, { type: decl.returnType })] }))] })] }) }));
|
|
56
|
-
}
|
|
57
|
-
export function Property({ decl, children }) {
|
|
58
|
-
const Docs = useComponents();
|
|
59
|
-
const Lang = useLanguageComponents();
|
|
60
|
-
const language = useLanguage();
|
|
61
|
-
if (!decl)
|
|
62
|
-
return null;
|
|
63
|
-
switch (decl.kind) {
|
|
64
|
-
case 'JavaDeclProperty': {
|
|
65
|
-
const typeRaw = _jsx(Lang.Type, { type: decl.type, optional: decl.optional });
|
|
66
|
-
const typeWrapped = decl.optional ? (_jsxs(_Fragment, { children: [_jsx("span", { className: style.TypeKeyword, children: "Optional" }), _jsx("span", { className: style.TypeBracket, children: '<' }), typeRaw, _jsx("span", { className: style.TypeBracket, children: '>' })] })) : (typeRaw);
|
|
67
|
-
const badges = (_jsx(_Fragment, { children: decl.type.kind === 'JavaTypeConstant' && (_jsx(Docs.Tooltip, { content: _jsx("span", { className: style.TextIdentifier, children: decl.type.value }), children: _jsx("span", { className: style.TextIdentifier, children: "constant" }) })) }));
|
|
68
|
-
return children({
|
|
69
|
-
name: decl.ident,
|
|
70
|
-
typeName: _jsx(Lang.TypeName, { type: decl.type, optional: decl.optional }),
|
|
71
|
-
type: showFullType(decl.type) && typeWrapped,
|
|
72
|
-
badges,
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
case 'JavaDeclConst':
|
|
76
|
-
return children({
|
|
77
|
-
name: decl.ident,
|
|
78
|
-
typeName: 'const',
|
|
79
|
-
type: _jsx("span", { className: constStyle[typeof decl.value], children: JSON.stringify(decl.value) }),
|
|
80
|
-
});
|
|
81
|
-
case 'JavaDeclType': {
|
|
82
|
-
const typeName = decl.type.kind === 'JavaTypeUnion'
|
|
83
|
-
? 'union'
|
|
84
|
-
: decl.type.kind === 'JavaTypeEnum'
|
|
85
|
-
? language === 'kotlin'
|
|
86
|
-
? 'enum class'
|
|
87
|
-
: 'enum'
|
|
88
|
-
: 'class';
|
|
89
|
-
return children({ name: decl.ident, typeName });
|
|
90
|
-
}
|
|
91
|
-
case 'JavaDeclReference':
|
|
92
|
-
return children({ type: _jsx(Lang.Type, { type: decl.type }) });
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
export function Declaration({ decl }) {
|
|
96
|
-
const Docs = useComponents();
|
|
97
|
-
const Lang = useLanguageComponents();
|
|
98
|
-
const language = useLanguage();
|
|
99
|
-
if (!decl)
|
|
100
|
-
return null;
|
|
101
|
-
switch (decl.kind) {
|
|
102
|
-
case 'JavaDeclConst':
|
|
103
|
-
return (_jsxs(_Fragment, { children: [_jsx("span", { className: style.TextIdentifier, children: decl.ident }), _jsx("span", { className: style.TextPunctuation, children: '(' }), JSON.stringify(decl.value), _jsx("span", { className: style.TextPunctuation, children: ')' })] }));
|
|
104
|
-
case 'JavaDeclType': {
|
|
105
|
-
const keyword = decl.type.kind === 'JavaTypeEnum' ? (language === 'kotlin' ? 'enum class' : 'enum') : 'class';
|
|
106
|
-
return (_jsxs(_Fragment, { children: [_jsx("span", { className: style.TextKeyword, children: keyword }), ' ', _jsx("span", { className: style.TextIdentifier, children: decl.ident }), _jsx("span", { className: style.TextPunctuation, children: ":" }), decl.type.kind === 'JavaTypeUnion' && (_jsxs(_Fragment, { children: [' ', _jsx(Docs.Tooltip, { content: "A class that can be one of several variants.", children: _jsx(Docs.Badge, { id: "java-union", children: "union" }) }), ' '] }))] }));
|
|
107
|
-
}
|
|
108
|
-
case 'JavaDeclProperty': {
|
|
109
|
-
const inlineType = _jsx(Lang.Type, { type: decl.type, optional: decl.optional });
|
|
110
|
-
const ident = (_jsx("span", { className: style.TypePropertyName, children: _jsx("span", { className: style.TextIdentifier, children: decl.ident }) }));
|
|
111
|
-
const suffix = decl.type.kind === 'JavaTypeConstant' ? (_jsxs(_Fragment, { children: [' ', _jsx(Docs.Tooltip, { content: _jsx("span", { className: style.TextIdentifier, children: decl.type.value }), children: _jsx(Docs.Badge, { id: "java-constant", children: "constant" }) })] })) : null;
|
|
112
|
-
if (language === 'kotlin')
|
|
113
|
-
return (_jsxs(_Fragment, { children: [ident, _jsx("span", { className: style.TextPunctuation, children: ":" }), ' ', decl.optional ? (_jsxs(_Fragment, { children: [_jsx("span", { className: style.TypeReference, children: "Optional" }), _jsx("span", { className: style.TypeBracket, children: '<' }), inlineType, _jsx("span", { className: style.TypeBracket, children: '>' })] })) : (inlineType), suffix] }));
|
|
114
|
-
return (_jsxs(_Fragment, { children: [decl.optional ? (_jsxs(_Fragment, { children: [_jsx("span", { className: style.TypeReference, children: "Optional" }), _jsx("span", { className: style.TypeBracket, children: '<' }), inlineType, _jsx("span", { className: style.TypeBracket, children: '>' })] })) : (inlineType), ' ', ident, suffix] }));
|
|
115
|
-
}
|
|
116
|
-
case 'JavaDeclReference':
|
|
117
|
-
return _jsx(Lang.Type, { type: decl.type });
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
//# sourceMappingURL=java.js.map
|
|
1
|
+
import "../component-generics-DzI21jRn.js";
|
|
2
|
+
import "../docs-Dh8kE1va.js";
|
|
3
|
+
import "../navigation-aoYZ_tl4.js";
|
|
4
|
+
import "../markdown-BXfX1D7C.js";
|
|
5
|
+
import "../routing-DQjbRxdJ.js";
|
|
6
|
+
import "../style-rYbbxIR_.js";
|
|
7
|
+
import "../use-components-D9E85p5x.js";
|
|
8
|
+
import { G as Property, K as Type, U as Declaration, W as MethodSignature, q as TypeName } from "../contexts-DRxRO-xO.js";
|
|
9
|
+
import "../icons-DdKM-01E.js";
|
|
10
|
+
import "../utils-CJfFBNgT.js";
|
|
11
|
+
import "../dropdown-DtgAi6lb.js";
|
|
12
|
+
import "../md-Dg8aOyMA.js";
|
|
13
|
+
import "../utils-BHwvUDKn.js";
|
|
14
|
+
import "../types-DFN4M1Sp.js";
|
|
15
|
+
|
|
16
|
+
export { Declaration, MethodSignature, Property, Type, TypeName };
|
|
@@ -1,22 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export
|
|
14
|
-
decl: AST.PythonDeclaration;
|
|
15
|
-
children?: PropertyFn;
|
|
16
|
-
};
|
|
17
|
-
export declare function Property({ decl, children }: PropertyProps): React.ReactNode;
|
|
18
|
-
export type DeclarationProps = {
|
|
19
|
-
decl: AST.PythonDeclaration;
|
|
20
|
-
};
|
|
21
|
-
export declare function Declaration({ decl }: DeclarationProps): import("react/jsx-runtime").JSX.Element | undefined;
|
|
22
|
-
export {};
|
|
1
|
+
import "../breadcrumbs-Z-hEqjcp.js";
|
|
2
|
+
import "../dropdown-B7VyGMOw.js";
|
|
3
|
+
import "../method-DpsVuzZW.js";
|
|
4
|
+
import "../primitives-DWz23_Ub.js";
|
|
5
|
+
import "../properties-CF71V58d.js";
|
|
6
|
+
import "../routing-qc0V00-j.js";
|
|
7
|
+
import "../sdk-Zg3Rggk3.js";
|
|
8
|
+
import "../snippets-EUzM4fRO.js";
|
|
9
|
+
import "../overview-C8e-6jGr.js";
|
|
10
|
+
import "../sidebar-C8KirYjg.js";
|
|
11
|
+
import "../index-YnpUtXLB.js";
|
|
12
|
+
import { A as PropertyProps, D as MethodSignature, E as DeclarationProps, M as TypeName, O as MethodSignatureProps, T as Declaration, j as Type, k as Property } from "../index-AicgPYKB.js";
|
|
13
|
+
export { Declaration, DeclarationProps, MethodSignature, MethodSignatureProps, Property, PropertyProps, Type, TypeName };
|
package/dist/languages/python.js
CHANGED
|
@@ -1,104 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export
|
|
17
|
-
const Lang = useLanguageComponents();
|
|
18
|
-
if (type.kind === 'PythonTypeReference') {
|
|
19
|
-
switch (type.typeName) {
|
|
20
|
-
case 'Optional':
|
|
21
|
-
return _jsx(Lang.TypeName, { type: type.typeParameters[0] });
|
|
22
|
-
case 'List':
|
|
23
|
-
case 'Iterable':
|
|
24
|
-
case 'Literal':
|
|
25
|
-
case 'Union':
|
|
26
|
-
return type.typeName.toLowerCase();
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return _jsx(Lang.Type, { type: type });
|
|
30
|
-
}
|
|
31
|
-
export function Type({ type }) {
|
|
32
|
-
const Lang = useLanguageComponents();
|
|
33
|
-
const { Join, SDKReference } = useComponents();
|
|
34
|
-
switch (type.kind) {
|
|
35
|
-
case 'PythonTypeAny':
|
|
36
|
-
case 'PythonTypeUnknown':
|
|
37
|
-
case 'PythonTypeInt':
|
|
38
|
-
case 'PythonTypeFloat':
|
|
39
|
-
case 'PythonTypeBool':
|
|
40
|
-
return (_jsx("span", { className: style.Type, children: _jsx("span", { className: style.TypeKeyword, children: type.kind.slice(10).toLowerCase() }) }));
|
|
41
|
-
case 'PythonTypeString':
|
|
42
|
-
return (_jsx("span", { className: style.Type, children: _jsx("span", { className: style.TypeString, children: "str" }) }));
|
|
43
|
-
case 'PythonTypeLiteral':
|
|
44
|
-
return (_jsx("span", { className: style.Type, children: _jsx("span", { className: constStyle[typeof type.literal.value], children: JSON.stringify(type.literal.value) }) }));
|
|
45
|
-
case 'PythonTypeArray':
|
|
46
|
-
return (_jsxs("span", { className: style.Type, children: [_jsx("span", { className: style.TypeArray, children: 'Array<' }), _jsx(Lang.Type, { type: type.elementType }), _jsx("span", { className: style.TypeArray, children: '>' })] }));
|
|
47
|
-
case 'PythonTypeClass':
|
|
48
|
-
return (_jsx("span", { className: style.Type, children: _jsx("span", { className: style.TypeKeyword, children: "class" }) }));
|
|
49
|
-
case 'PythonTypeMap':
|
|
50
|
-
return (_jsx("span", { className: style.Type, children: _jsx("span", { className: style.TypeKeyword, children: "Dict" }) }));
|
|
51
|
-
case 'PythonTypeReference': {
|
|
52
|
-
const params = type.typeParameters?.map((param, key) => _jsx(Lang.Type, { type: param }, key));
|
|
53
|
-
return (_jsxs("span", { className: style.Type, children: [_jsx("span", { className: type.typeName === 'Optional' ? style.TypeArray : '', children: _jsx(SDKReference, { stainlessPath: type.$ref, children: type.typeName }) }), params && params.length > 0 && (_jsxs(_Fragment, { children: [_jsx("span", { className: style.TypeBracket, children: '[' }), _jsx(Join, { items: params, limit: 3, children: _jsx("span", { className: style.TextOperator, children: ", " }) }), _jsx("span", { className: style.TypeBracket, children: ']' })] }))] }));
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
export function MethodSignature({ decl }) {
|
|
58
|
-
const Lang = useLanguageComponents();
|
|
59
|
-
const { Join, Tooltip } = useComponents();
|
|
60
|
-
const params = decl.parameters.map((param, i) => (_jsx(React.Fragment, { children: _jsx(Tooltip, { content: _jsx(Lang.Type, { type: param.type }), children: _jsx("span", { className: style.TextIdentifier, children: param.ident }) }) }, i)));
|
|
61
|
-
return (_jsx("div", { className: style.MethodSignature, children: _jsxs("span", { className: style.SignatureTitle, children: [decl.async && _jsx("span", { className: style.TextKeyword, children: "async " }), decl.qualified && (_jsx("span", { className: style.SignatureQualified, children: _jsx("span", { className: style.TextIdentifier, children: decl.qualified?.slice(0, -decl.ident.length) }) })), _jsx("span", { className: style.SignatureName, children: _jsx("span", { className: style.TextIdentifier, children: decl.ident }) }), _jsxs("span", { className: style.MethodSignature, children: [_jsx("span", { className: style.SignatureParen, children: '(' }), _jsx("span", { className: style.SignatureParams, children: _jsx(Join, { items: params, children: _jsx("span", { className: style.TextOperator, children: ', ' }) }) }), _jsxs("span", { className: style.SignatureParen, children: [')', " "] }), decl.returns && (_jsxs(_Fragment, { children: [_jsx("span", { className: style.TextOperator, children: ' -> ' }), _jsx(Lang.Type, { type: decl.returns })] }))] })] }) }));
|
|
62
|
-
}
|
|
63
|
-
export function Property({ decl, children }) {
|
|
64
|
-
const Lang = useLanguageComponents();
|
|
65
|
-
if (!decl)
|
|
66
|
-
return;
|
|
67
|
-
switch (decl.kind) {
|
|
68
|
-
case 'PythonDeclProperty':
|
|
69
|
-
return children({
|
|
70
|
-
name: decl.ident,
|
|
71
|
-
typeName: _jsx(Lang.TypeName, { type: decl.type }),
|
|
72
|
-
type: showFullType(decl.type) && _jsx(Lang.Type, { type: decl.type }),
|
|
73
|
-
});
|
|
74
|
-
case 'PythonDeclClass':
|
|
75
|
-
return children({ name: decl.ident, typeName: 'class' });
|
|
76
|
-
case 'PythonDeclType':
|
|
77
|
-
return children({
|
|
78
|
-
name: decl.ident,
|
|
79
|
-
typeName: 'type',
|
|
80
|
-
type: _jsx(Lang.Type, { type: decl.type }),
|
|
81
|
-
});
|
|
82
|
-
case 'PythonDeclReference':
|
|
83
|
-
return children({ type: _jsx(Lang.Type, { type: decl.type }) });
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
export function Declaration({ decl }) {
|
|
87
|
-
const Lang = useLanguageComponents();
|
|
88
|
-
if (!decl)
|
|
89
|
-
return;
|
|
90
|
-
switch (decl.kind) {
|
|
91
|
-
case 'PythonDeclProperty':
|
|
92
|
-
const nullable = decl.type.kind === 'PythonTypeReference' &&
|
|
93
|
-
decl.type.typeName === 'Optional' &&
|
|
94
|
-
(decl.type.typeParameters ?? []).length > 0;
|
|
95
|
-
return (_jsxs(_Fragment, { children: [_jsx("span", { className: style.TypePropertyName, children: _jsx("span", { className: style.TextIdentifier, children: decl.ident }) }), _jsx("span", { className: style.TextPunctuation, children: ": " }), decl.optional && !nullable ? (_jsxs(_Fragment, { children: [_jsx("span", { className: style.TypePlain, children: "Optional" }), _jsx("span", { className: style.TypeBracket, children: '[' }), _jsx(Lang.Type, { type: decl.type }), _jsx("span", { className: style.TypeBrace, children: ']' })] })) : (_jsx(Lang.Type, { type: decl.type }))] }));
|
|
96
|
-
case 'PythonDeclClass':
|
|
97
|
-
return (_jsxs(_Fragment, { children: [_jsx("span", { className: style.TextKeyword, children: "class " }), _jsx("span", { className: style.TextIdentifier, children: decl.ident }), _jsx("span", { className: style.TextPunctuation, children: ": " }), _jsx("span", { className: `${style.TypePreviewContent} ${style.TextPunctuation}`, children: "\u2026" })] }));
|
|
98
|
-
case 'PythonDeclType':
|
|
99
|
-
return (_jsxs(_Fragment, { children: [_jsx("span", { className: style.TextIdentifier, children: decl.ident }), _jsx("span", { className: style.TextOperator, children: " = " }), _jsx(Lang.Type, { type: decl.type })] }));
|
|
100
|
-
case 'PythonDeclReference':
|
|
101
|
-
return _jsx(Lang.Type, { type: decl.type });
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
//# sourceMappingURL=python.js.map
|
|
1
|
+
import "../component-generics-DzI21jRn.js";
|
|
2
|
+
import "../docs-Dh8kE1va.js";
|
|
3
|
+
import "../navigation-aoYZ_tl4.js";
|
|
4
|
+
import "../markdown-BXfX1D7C.js";
|
|
5
|
+
import "../routing-DQjbRxdJ.js";
|
|
6
|
+
import "../style-rYbbxIR_.js";
|
|
7
|
+
import "../use-components-D9E85p5x.js";
|
|
8
|
+
import { F as TypeName, M as MethodSignature, N as Property, P as Type, j as Declaration } from "../contexts-DRxRO-xO.js";
|
|
9
|
+
import "../icons-DdKM-01E.js";
|
|
10
|
+
import "../utils-CJfFBNgT.js";
|
|
11
|
+
import "../dropdown-DtgAi6lb.js";
|
|
12
|
+
import "../md-Dg8aOyMA.js";
|
|
13
|
+
import "../utils-BHwvUDKn.js";
|
|
14
|
+
import "../types-DFN4M1Sp.js";
|
|
15
|
+
|
|
16
|
+
export { Declaration, MethodSignature, Property, Type, TypeName };
|
package/dist/languages/ruby.d.ts
CHANGED
|
@@ -1,22 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export
|
|
14
|
-
decl: AST.RubyDeclaration;
|
|
15
|
-
children?: PropertyFn;
|
|
16
|
-
};
|
|
17
|
-
export declare function Property({ decl, children }: PropertyProps): React.ReactNode;
|
|
18
|
-
export type DeclarationProps = {
|
|
19
|
-
decl: AST.RubyDeclaration;
|
|
20
|
-
};
|
|
21
|
-
export declare function Declaration({ decl }: DeclarationProps): import("react/jsx-runtime").JSX.Element | undefined;
|
|
22
|
-
export {};
|
|
1
|
+
import "../breadcrumbs-Z-hEqjcp.js";
|
|
2
|
+
import "../dropdown-B7VyGMOw.js";
|
|
3
|
+
import "../method-DpsVuzZW.js";
|
|
4
|
+
import "../primitives-DWz23_Ub.js";
|
|
5
|
+
import "../properties-CF71V58d.js";
|
|
6
|
+
import "../routing-qc0V00-j.js";
|
|
7
|
+
import "../sdk-Zg3Rggk3.js";
|
|
8
|
+
import "../snippets-EUzM4fRO.js";
|
|
9
|
+
import "../overview-C8e-6jGr.js";
|
|
10
|
+
import "../sidebar-C8KirYjg.js";
|
|
11
|
+
import "../index-YnpUtXLB.js";
|
|
12
|
+
import { C as TypeName, S as Type, _ as DeclarationProps, b as Property, g as Declaration, v as MethodSignature, x as PropertyProps, y as MethodSignatureProps } from "../index-AicgPYKB.js";
|
|
13
|
+
export { Declaration, DeclarationProps, MethodSignature, MethodSignatureProps, Property, PropertyProps, Type, TypeName };
|