@alloy-js/python 0.2.0-dev.3 → 0.2.0-dev.5
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/src/builtins/python.d.ts +3 -0
- package/dist/src/builtins/python.d.ts.map +1 -1
- package/dist/src/builtins/python.js +6 -0
- package/dist/src/builtins/python.js.map +1 -1
- package/dist/src/components/Atom.d.ts +1 -0
- package/dist/src/components/Atom.d.ts.map +1 -1
- package/dist/src/components/Atom.js +3 -0
- package/dist/src/components/Atom.js.map +1 -1
- package/dist/src/components/CallSignature.d.ts +4 -15
- package/dist/src/components/CallSignature.d.ts.map +1 -1
- package/dist/src/components/CallSignature.js +13 -67
- package/dist/src/components/CallSignature.js.map +1 -1
- package/dist/src/components/ClassMethodDeclaration.d.ts +22 -0
- package/dist/src/components/ClassMethodDeclaration.d.ts.map +1 -0
- package/dist/src/components/ClassMethodDeclaration.js +32 -0
- package/dist/src/components/ClassMethodDeclaration.js.map +1 -0
- package/dist/src/components/ConstructorDeclaration.d.ts +21 -0
- package/dist/src/components/ConstructorDeclaration.d.ts.map +1 -0
- package/dist/src/components/ConstructorDeclaration.js +35 -0
- package/dist/src/components/ConstructorDeclaration.js.map +1 -0
- package/dist/src/components/DunderMethodDeclaration.d.ts +21 -0
- package/dist/src/components/DunderMethodDeclaration.d.ts.map +1 -0
- package/dist/src/components/DunderMethodDeclaration.js +29 -0
- package/dist/src/components/DunderMethodDeclaration.js.map +1 -0
- package/dist/src/components/EnumDeclaration.d.ts +11 -32
- package/dist/src/components/EnumDeclaration.d.ts.map +1 -1
- package/dist/src/components/EnumDeclaration.js +10 -48
- package/dist/src/components/EnumDeclaration.js.map +1 -1
- package/dist/src/components/EnumMember.js +3 -3
- package/dist/src/components/EnumMember.js.map +1 -1
- package/dist/src/components/FunctionBase.d.ts +48 -0
- package/dist/src/components/FunctionBase.d.ts.map +1 -0
- package/dist/src/components/FunctionBase.js +91 -0
- package/dist/src/components/FunctionBase.js.map +1 -0
- package/dist/src/components/FunctionDeclaration.d.ts +11 -31
- package/dist/src/components/FunctionDeclaration.d.ts.map +1 -1
- package/dist/src/components/FunctionDeclaration.js +22 -79
- package/dist/src/components/FunctionDeclaration.js.map +1 -1
- package/dist/src/components/MethodBase.d.ts +29 -0
- package/dist/src/components/MethodBase.d.ts.map +1 -0
- package/dist/src/components/MethodBase.js +32 -0
- package/dist/src/components/MethodBase.js.map +1 -0
- package/dist/src/components/MethodDeclaration.d.ts +22 -0
- package/dist/src/components/MethodDeclaration.d.ts.map +1 -0
- package/dist/src/components/MethodDeclaration.js +34 -0
- package/dist/src/components/MethodDeclaration.js.map +1 -0
- package/dist/src/components/PropertyDeclaration.d.ts +71 -0
- package/dist/src/components/PropertyDeclaration.d.ts.map +1 -0
- package/dist/src/components/PropertyDeclaration.js +227 -0
- package/dist/src/components/PropertyDeclaration.js.map +1 -0
- package/dist/src/components/PyDoc.d.ts +107 -42
- package/dist/src/components/PyDoc.d.ts.map +1 -1
- package/dist/src/components/PyDoc.js +845 -181
- package/dist/src/components/PyDoc.js.map +1 -1
- package/dist/src/components/SourceFile.d.ts +24 -0
- package/dist/src/components/SourceFile.d.ts.map +1 -1
- package/dist/src/components/SourceFile.js +28 -1
- package/dist/src/components/SourceFile.js.map +1 -1
- package/dist/src/components/StaticMethodDeclaration.d.ts +22 -0
- package/dist/src/components/StaticMethodDeclaration.d.ts.map +1 -0
- package/dist/src/components/StaticMethodDeclaration.js +32 -0
- package/dist/src/components/StaticMethodDeclaration.js.map +1 -0
- package/dist/src/components/TypeArguments.d.ts +9 -0
- package/dist/src/components/TypeArguments.d.ts.map +1 -0
- package/dist/src/components/TypeArguments.js +18 -0
- package/dist/src/components/TypeArguments.js.map +1 -0
- package/dist/src/components/TypeReference.d.ts +14 -0
- package/dist/src/components/TypeReference.d.ts.map +1 -0
- package/dist/src/components/TypeReference.js +29 -0
- package/dist/src/components/TypeReference.js.map +1 -0
- package/dist/src/components/UnionTypeExpression.d.ts +1 -2
- package/dist/src/components/UnionTypeExpression.d.ts.map +1 -1
- package/dist/src/components/UnionTypeExpression.js +3 -11
- package/dist/src/components/UnionTypeExpression.js.map +1 -1
- package/dist/src/components/VariableDeclaration.d.ts.map +1 -1
- package/dist/src/components/VariableDeclaration.js +3 -3
- package/dist/src/components/VariableDeclaration.js.map +1 -1
- package/dist/src/components/index.d.ts +10 -0
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +9 -0
- package/dist/src/components/index.js.map +1 -1
- package/dist/src/parameter-descriptor.d.ts +1 -4
- package/dist/src/parameter-descriptor.d.ts.map +1 -1
- package/dist/src/parameter-descriptor.js +7 -1
- package/dist/src/parameter-descriptor.js.map +1 -1
- package/dist/src/symbol-creation.d.ts +4 -0
- package/dist/src/symbol-creation.d.ts.map +1 -1
- package/dist/src/symbol-creation.js +12 -0
- package/dist/src/symbol-creation.js.map +1 -1
- package/dist/src/symbols/factories.d.ts +15 -0
- package/dist/src/symbols/factories.d.ts.map +1 -0
- package/dist/src/symbols/factories.js +28 -0
- package/dist/src/symbols/factories.js.map +1 -0
- package/dist/src/symbols/index.d.ts +1 -0
- package/dist/src/symbols/index.d.ts.map +1 -1
- package/dist/src/symbols/index.js +1 -0
- package/dist/src/symbols/index.js.map +1 -1
- package/dist/src/symbols/reference.d.ts +1 -1
- package/dist/src/symbols/reference.d.ts.map +1 -1
- package/dist/src/symbols/reference.js +1 -1
- package/dist/src/symbols/reference.js.map +1 -1
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +1 -1
- package/dist/src/utils.js.map +1 -1
- package/dist/test/callsignatures.test.js +42 -64
- package/dist/test/callsignatures.test.js.map +1 -1
- package/dist/test/class-method-declaration.test.d.ts +2 -0
- package/dist/test/class-method-declaration.test.d.ts.map +1 -0
- package/dist/test/class-method-declaration.test.js +61 -0
- package/dist/test/class-method-declaration.test.js.map +1 -0
- package/dist/test/classdeclarations.test.js +6 -8
- package/dist/test/classdeclarations.test.js.map +1 -1
- package/dist/test/constructordeclaration.test.d.ts +2 -0
- package/dist/test/constructordeclaration.test.d.ts.map +1 -0
- package/dist/test/constructordeclaration.test.js +58 -0
- package/dist/test/constructordeclaration.test.js.map +1 -0
- package/dist/test/dundermethoddeclaration.test.d.ts +2 -0
- package/dist/test/dundermethoddeclaration.test.d.ts.map +1 -0
- package/dist/test/dundermethoddeclaration.test.js +65 -0
- package/dist/test/dundermethoddeclaration.test.js.map +1 -0
- package/dist/test/enums.test.js +14 -16
- package/dist/test/enums.test.js.map +1 -1
- package/dist/test/externals.test.js +2 -4
- package/dist/test/externals.test.js.map +1 -1
- package/dist/test/factories.test.d.ts +2 -0
- package/dist/test/factories.test.d.ts.map +1 -0
- package/dist/test/factories.test.js +78 -0
- package/dist/test/factories.test.js.map +1 -0
- package/dist/test/functiondeclaration.test.js +213 -59
- package/dist/test/functiondeclaration.test.js.map +1 -1
- package/dist/test/memberexpressions.test.js +1 -1
- package/dist/test/memberexpressions.test.js.map +1 -1
- package/dist/test/methoddeclaration.test.d.ts +2 -0
- package/dist/test/methoddeclaration.test.d.ts.map +1 -0
- package/dist/test/methoddeclaration.test.js +239 -0
- package/dist/test/methoddeclaration.test.js.map +1 -0
- package/dist/test/namepolicies.test.js +1 -2
- package/dist/test/namepolicies.test.js.map +1 -1
- package/dist/test/propertydeclaration.test.d.ts +2 -0
- package/dist/test/propertydeclaration.test.d.ts.map +1 -0
- package/dist/test/propertydeclaration.test.js +229 -0
- package/dist/test/propertydeclaration.test.js.map +1 -0
- package/dist/test/pydocs.test.js +926 -126
- package/dist/test/pydocs.test.js.map +1 -1
- package/dist/test/references.test.js +1 -5
- package/dist/test/references.test.js.map +1 -1
- package/dist/test/sourcefiles.test.js +90 -1
- package/dist/test/sourcefiles.test.js.map +1 -1
- package/dist/test/staticmethoddeclaration.test.d.ts +2 -0
- package/dist/test/staticmethoddeclaration.test.d.ts.map +1 -0
- package/dist/test/staticmethoddeclaration.test.js +61 -0
- package/dist/test/staticmethoddeclaration.test.js.map +1 -0
- package/dist/test/typereference.test.d.ts +2 -0
- package/dist/test/typereference.test.d.ts.map +1 -0
- package/dist/test/typereference.test.js +51 -0
- package/dist/test/typereference.test.js.map +1 -0
- package/dist/test/uniontypeexpression.test.js +152 -15
- package/dist/test/uniontypeexpression.test.js.map +1 -1
- package/dist/test/values.test.js +35 -0
- package/dist/test/values.test.js.map +1 -1
- package/dist/test/variables.test.js +28 -19
- package/dist/test/variables.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/builtins/python.ts +7 -0
- package/src/components/Atom.tsx +4 -0
- package/src/components/CallSignature.tsx +17 -69
- package/src/components/ClassMethodDeclaration.tsx +34 -0
- package/src/components/ConstructorDeclaration.tsx +37 -0
- package/src/components/DunderMethodDeclaration.tsx +30 -0
- package/src/components/EnumDeclaration.tsx +16 -44
- package/src/components/EnumMember.tsx +3 -3
- package/src/components/FunctionBase.tsx +88 -0
- package/src/components/FunctionDeclaration.tsx +18 -82
- package/src/components/MethodBase.tsx +53 -0
- package/src/components/MethodDeclaration.tsx +27 -0
- package/src/components/PropertyDeclaration.tsx +264 -0
- package/src/components/PyDoc.tsx +795 -195
- package/src/components/SourceFile.tsx +29 -0
- package/src/components/StaticMethodDeclaration.tsx +34 -0
- package/src/components/TypeArguments.tsx +24 -0
- package/src/components/TypeReference.tsx +33 -0
- package/src/components/UnionTypeExpression.tsx +4 -15
- package/src/components/VariableDeclaration.tsx +1 -3
- package/src/components/index.ts +10 -0
- package/src/parameter-descriptor.ts +6 -5
- package/src/symbol-creation.ts +17 -0
- package/src/symbols/factories.ts +39 -0
- package/src/symbols/index.ts +1 -0
- package/src/symbols/reference.tsx +3 -5
- package/src/utils.ts +0 -2
- package/temp/api.json +5323 -2288
- package/test/callsignatures.test.tsx +102 -74
- package/test/class-method-declaration.test.tsx +53 -0
- package/test/classdeclarations.test.tsx +7 -9
- package/test/constructordeclaration.test.tsx +48 -0
- package/test/dundermethoddeclaration.test.tsx +53 -0
- package/test/enums.test.tsx +14 -16
- package/test/externals.test.tsx +5 -7
- package/test/factories.test.tsx +72 -0
- package/test/functiondeclaration.test.tsx +196 -44
- package/test/memberexpressions.test.tsx +7 -2
- package/test/methoddeclaration.test.tsx +202 -0
- package/test/namepolicies.test.tsx +1 -2
- package/test/propertydeclaration.test.tsx +192 -0
- package/test/pydocs.test.tsx +1093 -129
- package/test/references.test.tsx +1 -1
- package/test/sourcefiles.test.tsx +100 -1
- package/test/staticmethoddeclaration.test.tsx +49 -0
- package/test/typereference.test.tsx +52 -0
- package/test/uniontypeexpression.test.tsx +169 -34
- package/test/values.test.tsx +34 -0
- package/test/variables.test.tsx +27 -16
|
@@ -1,131 +1,189 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createComponent as _$createComponent, createIntrinsic as _$createIntrinsic, memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
import { For, Indent, List, Prose, Show, childrenArray } from "@alloy-js/core";
|
|
3
|
-
import { Atom } from "./
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
3
|
+
import { Atom } from "./Atom.js";
|
|
4
|
+
/**
|
|
5
|
+
* A component that creates a FunctionDoc block for functions.
|
|
6
|
+
*/
|
|
7
|
+
export function FunctionDoc(props) {
|
|
8
|
+
const {
|
|
9
|
+
style = "google",
|
|
10
|
+
...rest
|
|
11
|
+
} = props;
|
|
12
|
+
switch (style) {
|
|
13
|
+
case "google":
|
|
14
|
+
return _$createComponent(GoogleStyleFunctionDoc, rest);
|
|
15
|
+
default:
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
/**
|
|
20
|
+
* A component that creates a ClassDoc block for classes.
|
|
21
|
+
*/
|
|
22
|
+
export function ClassDoc(props) {
|
|
23
|
+
const {
|
|
24
|
+
style = "google",
|
|
25
|
+
...rest
|
|
26
|
+
} = props;
|
|
27
|
+
switch (style) {
|
|
28
|
+
case "google":
|
|
29
|
+
return _$createComponent(GoogleStyleClassDoc, rest);
|
|
30
|
+
default:
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
21
33
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
get when() {
|
|
37
|
-
return Boolean(props.defaultValue);
|
|
38
|
-
},
|
|
39
|
-
get children() {
|
|
40
|
-
return [" ", "Defaults to ", _$createComponent(Atom, {
|
|
41
|
-
get jsValue() {
|
|
42
|
-
return props.defaultValue;
|
|
43
|
-
}
|
|
44
|
-
}), "."];
|
|
45
|
-
}
|
|
46
|
-
})];
|
|
47
|
-
}
|
|
48
|
-
})];
|
|
49
|
-
}
|
|
50
|
-
});
|
|
34
|
+
/**
|
|
35
|
+
* A component that creates a ModuleDoc block for module-level documentation.
|
|
36
|
+
*/
|
|
37
|
+
export function ModuleDoc(props) {
|
|
38
|
+
const {
|
|
39
|
+
style = "google",
|
|
40
|
+
...rest
|
|
41
|
+
} = props;
|
|
42
|
+
switch (style) {
|
|
43
|
+
case "google":
|
|
44
|
+
return _$createComponent(GoogleStyleModuleDoc, rest);
|
|
45
|
+
default:
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
51
48
|
}
|
|
52
49
|
/**
|
|
53
|
-
*
|
|
50
|
+
* A component that creates a PropertyDoc block for `@property` decorated methods.
|
|
54
51
|
*/
|
|
55
|
-
export function
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
}), _$createComponent(GoogleStyleDocParamDescription, {
|
|
68
|
-
get children() {
|
|
69
|
-
return props.children;
|
|
70
|
-
},
|
|
71
|
-
get defaultValue() {
|
|
72
|
-
return props.defaultValue;
|
|
73
|
-
}
|
|
74
|
-
})];
|
|
52
|
+
export function PropertyDoc(props) {
|
|
53
|
+
const {
|
|
54
|
+
style = "google",
|
|
55
|
+
...rest
|
|
56
|
+
} = props;
|
|
57
|
+
switch (style) {
|
|
58
|
+
case "google":
|
|
59
|
+
return _$createComponent(GoogleStylePropertyDoc, rest);
|
|
60
|
+
default:
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
75
63
|
}
|
|
76
64
|
/**
|
|
77
|
-
* A component that creates a
|
|
65
|
+
* A component that creates a GeneratorDoc block for generator functions.
|
|
78
66
|
*/
|
|
79
|
-
export function
|
|
80
|
-
const
|
|
81
|
-
|
|
67
|
+
export function GeneratorDoc(props) {
|
|
68
|
+
const {
|
|
69
|
+
style = "google",
|
|
70
|
+
...rest
|
|
71
|
+
} = props;
|
|
72
|
+
switch (style) {
|
|
73
|
+
case "google":
|
|
74
|
+
return _$createComponent(GoogleStyleGeneratorDoc, rest);
|
|
75
|
+
default:
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* A component that creates an ExceptionDoc block for custom exception classes.
|
|
81
|
+
*/
|
|
82
|
+
export function ExceptionDoc(props) {
|
|
83
|
+
const {
|
|
84
|
+
style = "google",
|
|
85
|
+
...rest
|
|
86
|
+
} = props;
|
|
87
|
+
switch (style) {
|
|
88
|
+
case "google":
|
|
89
|
+
return _$createComponent(GoogleStyleExceptionDoc, rest);
|
|
90
|
+
default:
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* A component that creates documentation for a single attribute.
|
|
96
|
+
* This can be used for both inline and block attribute documentation.
|
|
97
|
+
*/
|
|
98
|
+
export function AttributeDoc(props) {
|
|
99
|
+
const {
|
|
100
|
+
style = "google",
|
|
101
|
+
...rest
|
|
102
|
+
} = props;
|
|
103
|
+
switch (style) {
|
|
104
|
+
case "google":
|
|
105
|
+
return _$createComponent(GoogleStyleAttributeDoc, rest);
|
|
106
|
+
default:
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* A component that creates a MethodDoc block for class methods.
|
|
112
|
+
* Automatically adds a note about not including 'self' parameter if no custom note is provided.
|
|
113
|
+
*/
|
|
114
|
+
export function MethodDoc(props) {
|
|
115
|
+
const {
|
|
116
|
+
style = "google",
|
|
117
|
+
...rest
|
|
118
|
+
} = props;
|
|
119
|
+
switch (style) {
|
|
120
|
+
case "google":
|
|
121
|
+
{
|
|
122
|
+
return _$createComponent(GoogleStyleMethodDoc, rest);
|
|
123
|
+
}
|
|
124
|
+
default:
|
|
125
|
+
return undefined;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* A PyDoc comment. The children of this component are joined with two hard
|
|
130
|
+
* linebreaks. This is useful for creating PyDoc comments with multiple paragraphs.
|
|
131
|
+
*/
|
|
132
|
+
export function PyDoc(props) {
|
|
133
|
+
const children = childrenArray(() => props.children);
|
|
134
|
+
return ['"""', _$createIntrinsic("hbr", {}), _$createComponent(List, {
|
|
135
|
+
doubleHardline: true,
|
|
136
|
+
children: children
|
|
137
|
+
}), _$createIntrinsic("hbr", {}), '"""', _$createIntrinsic("hbr", {})];
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Create a PyDoc example, which is prepended by \>\>.
|
|
141
|
+
*/
|
|
142
|
+
export function PyDocExample(props) {
|
|
143
|
+
const children = childrenArray(() => props.children);
|
|
144
|
+
let lines = [];
|
|
145
|
+
if (children.length === 1 && typeof children[0] === "string") {
|
|
146
|
+
// Split, trim each line, and filter out empty lines
|
|
147
|
+
lines = children[0].split(/\r?\n/).map(line => line.trim()).filter(line => line.length > 0);
|
|
148
|
+
} else {
|
|
149
|
+
// For non-string children, filter out empty/whitespace-only strings
|
|
150
|
+
lines = children.map(child => typeof child === "string" ? child : "").map(line => line.trim()).filter(line => line.length > 0);
|
|
151
|
+
}
|
|
152
|
+
return [_$createComponent(For, {
|
|
153
|
+
each: lines,
|
|
154
|
+
children: line => [">> ", line]
|
|
155
|
+
})];
|
|
156
|
+
}
|
|
157
|
+
export function SimpleCommentBlock(props) {
|
|
158
|
+
return ["#", " ", _$createIntrinsic("align", {
|
|
159
|
+
string: "# ",
|
|
82
160
|
get children() {
|
|
83
|
-
return _$createComponent(
|
|
84
|
-
doubleHardline: true,
|
|
161
|
+
return _$createComponent(Prose, {
|
|
85
162
|
get children() {
|
|
86
|
-
return
|
|
87
|
-
get name() {
|
|
88
|
-
return param.name;
|
|
89
|
-
},
|
|
90
|
-
get type() {
|
|
91
|
-
return param.type;
|
|
92
|
-
},
|
|
93
|
-
get optional() {
|
|
94
|
-
return param.optional;
|
|
95
|
-
},
|
|
96
|
-
get children() {
|
|
97
|
-
return param.doc;
|
|
98
|
-
}
|
|
99
|
-
}));
|
|
163
|
+
return props.children;
|
|
100
164
|
}
|
|
101
165
|
});
|
|
102
166
|
}
|
|
103
167
|
})];
|
|
104
168
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
*/
|
|
108
|
-
export function GoogleStyleDocReturn(props) {
|
|
109
|
-
return ["Returns:", _$createComponent(Indent, {
|
|
169
|
+
export function SimpleInlineComment(props) {
|
|
170
|
+
return [" ", "# ", _$createComponent(Prose, {
|
|
110
171
|
get children() {
|
|
111
|
-
return props.
|
|
172
|
+
return props.children;
|
|
112
173
|
}
|
|
113
174
|
})];
|
|
114
175
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
*/
|
|
118
|
-
export function GoogleStyleDocRaises(props) {
|
|
119
|
-
return ["Raises:", _$createComponent(Indent, {
|
|
176
|
+
export function SimpleInlineMemberComment(props) {
|
|
177
|
+
return [" ", "#: ", _$createComponent(Prose, {
|
|
120
178
|
get children() {
|
|
121
|
-
return props.
|
|
179
|
+
return props.children;
|
|
122
180
|
}
|
|
123
181
|
})];
|
|
124
182
|
}
|
|
125
183
|
/**
|
|
126
|
-
* A component that creates a GoogleStyleFunctionDoc block for
|
|
184
|
+
* A component that creates a GoogleStyleFunctionDoc block for functions.
|
|
127
185
|
*/
|
|
128
|
-
|
|
186
|
+
function GoogleStyleFunctionDoc(props) {
|
|
129
187
|
// We are creating a list instead of relying on <Show> because otherwise
|
|
130
188
|
// <List> would render spaces between the elements even if <Show> evaluates to false.
|
|
131
189
|
const children = [];
|
|
@@ -133,75 +191,79 @@ export function GoogleStyleFunctionDoc(props) {
|
|
|
133
191
|
children.push(_$createComponent(List, {
|
|
134
192
|
doubleHardline: true,
|
|
135
193
|
get children() {
|
|
136
|
-
return props.description
|
|
194
|
+
return props.description;
|
|
137
195
|
}
|
|
138
196
|
}));
|
|
139
197
|
}
|
|
140
|
-
if (props.parameters
|
|
198
|
+
if (props.parameters?.length) {
|
|
141
199
|
children.push(_$createComponent(GoogleStyleDocParams, {
|
|
142
200
|
get parameters() {
|
|
143
201
|
return props.parameters;
|
|
144
202
|
}
|
|
145
203
|
}));
|
|
146
204
|
}
|
|
147
|
-
if (props.returns
|
|
205
|
+
if (props.returns) {
|
|
148
206
|
children.push(_$createComponent(GoogleStyleDocReturn, {
|
|
149
207
|
get message() {
|
|
150
208
|
return props.returns;
|
|
151
209
|
}
|
|
152
210
|
}));
|
|
153
211
|
}
|
|
154
|
-
if (props.
|
|
212
|
+
if (props.yields) {
|
|
213
|
+
children.push(_$createComponent(GoogleStyleDocYields, {
|
|
214
|
+
get message() {
|
|
215
|
+
return props.yields;
|
|
216
|
+
}
|
|
217
|
+
}));
|
|
218
|
+
}
|
|
219
|
+
if (props.raises?.length) {
|
|
155
220
|
children.push(props.raises.map(param => _$createComponent(GoogleStyleDocRaises, {
|
|
156
221
|
message: param
|
|
157
222
|
})));
|
|
158
223
|
}
|
|
159
|
-
|
|
160
|
-
children
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* A component that creates a FunctionDoc block for parameters.
|
|
165
|
-
*/
|
|
166
|
-
export function FunctionDoc(props) {
|
|
167
|
-
const style = props.style ?? "google";
|
|
168
|
-
if (style === "google") {
|
|
169
|
-
return _$createComponent(GoogleStyleFunctionDoc, {
|
|
170
|
-
get description() {
|
|
171
|
-
return props.description;
|
|
172
|
-
},
|
|
173
|
-
get parameters() {
|
|
174
|
-
return props.parameters;
|
|
175
|
-
},
|
|
176
|
-
get returns() {
|
|
177
|
-
return props.returns;
|
|
178
|
-
},
|
|
179
|
-
get raises() {
|
|
180
|
-
return props.raises;
|
|
224
|
+
if (props.examples?.length) {
|
|
225
|
+
children.push(_$createComponent(GoogleStyleDocExamples, {
|
|
226
|
+
get items() {
|
|
227
|
+
return props.examples;
|
|
181
228
|
}
|
|
182
|
-
});
|
|
229
|
+
}));
|
|
183
230
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
231
|
+
if (props.seeAlso?.length) {
|
|
232
|
+
children.push(_$createComponent(GoogleStyleDocSeeAlso, {
|
|
233
|
+
get items() {
|
|
234
|
+
return props.seeAlso;
|
|
235
|
+
}
|
|
236
|
+
}));
|
|
237
|
+
}
|
|
238
|
+
if (props.warning) {
|
|
239
|
+
children.push(_$createComponent(GoogleStyleDocWarning, {
|
|
240
|
+
get message() {
|
|
241
|
+
return props.warning;
|
|
242
|
+
}
|
|
243
|
+
}));
|
|
244
|
+
}
|
|
245
|
+
if (props.deprecated) {
|
|
246
|
+
children.push(_$createComponent(GoogleStyleDocDeprecated, {
|
|
247
|
+
get message() {
|
|
248
|
+
return props.deprecated;
|
|
249
|
+
}
|
|
250
|
+
}));
|
|
251
|
+
}
|
|
252
|
+
if (props.note) {
|
|
253
|
+
children.push(_$createComponent(GoogleStyleDocNote, {
|
|
254
|
+
get message() {
|
|
255
|
+
return props.note;
|
|
197
256
|
}
|
|
198
|
-
});
|
|
257
|
+
}));
|
|
199
258
|
}
|
|
259
|
+
return _$createComponent(PyDoc, {
|
|
260
|
+
children: children
|
|
261
|
+
});
|
|
200
262
|
}
|
|
201
263
|
/**
|
|
202
|
-
* A component that creates a GoogleStyleClassDoc block for
|
|
264
|
+
* A component that creates a GoogleStyleClassDoc block for classes.
|
|
203
265
|
*/
|
|
204
|
-
|
|
266
|
+
function GoogleStyleClassDoc(props) {
|
|
205
267
|
// We are creating a list instead of relying on <Show> because otherwise
|
|
206
268
|
// <List> would render spaces between the elements even if <Show> evaluates to false.
|
|
207
269
|
const children = [];
|
|
@@ -209,73 +271,675 @@ export function GoogleStyleClassDoc(props) {
|
|
|
209
271
|
children.push(_$createComponent(List, {
|
|
210
272
|
doubleHardline: true,
|
|
211
273
|
get children() {
|
|
212
|
-
return props.description
|
|
274
|
+
return props.description;
|
|
275
|
+
}
|
|
276
|
+
}));
|
|
277
|
+
}
|
|
278
|
+
if (props.attributes?.length) {
|
|
279
|
+
children.push(_$createComponent(GoogleStyleDocAttributes, {
|
|
280
|
+
get attributes() {
|
|
281
|
+
return props.attributes;
|
|
213
282
|
}
|
|
214
283
|
}));
|
|
215
284
|
}
|
|
216
|
-
if (props.parameters
|
|
285
|
+
if (props.parameters?.length) {
|
|
217
286
|
children.push(_$createComponent(GoogleStyleDocParams, {
|
|
218
287
|
get parameters() {
|
|
219
288
|
return props.parameters;
|
|
220
289
|
}
|
|
221
290
|
}));
|
|
222
291
|
}
|
|
292
|
+
if (props.examples?.length) {
|
|
293
|
+
children.push(_$createComponent(GoogleStyleDocExamples, {
|
|
294
|
+
get items() {
|
|
295
|
+
return props.examples;
|
|
296
|
+
}
|
|
297
|
+
}));
|
|
298
|
+
}
|
|
299
|
+
if (props.seeAlso?.length) {
|
|
300
|
+
children.push(_$createComponent(GoogleStyleDocSeeAlso, {
|
|
301
|
+
get items() {
|
|
302
|
+
return props.seeAlso;
|
|
303
|
+
}
|
|
304
|
+
}));
|
|
305
|
+
}
|
|
306
|
+
if (props.warning) {
|
|
307
|
+
children.push(_$createComponent(GoogleStyleDocWarning, {
|
|
308
|
+
get message() {
|
|
309
|
+
return props.warning;
|
|
310
|
+
}
|
|
311
|
+
}));
|
|
312
|
+
}
|
|
313
|
+
if (props.deprecated) {
|
|
314
|
+
children.push(_$createComponent(GoogleStyleDocDeprecated, {
|
|
315
|
+
get message() {
|
|
316
|
+
return props.deprecated;
|
|
317
|
+
}
|
|
318
|
+
}));
|
|
319
|
+
}
|
|
320
|
+
if (props.note) {
|
|
321
|
+
children.push(_$createComponent(GoogleStyleDocNote, {
|
|
322
|
+
get message() {
|
|
323
|
+
return props.note;
|
|
324
|
+
}
|
|
325
|
+
}));
|
|
326
|
+
}
|
|
223
327
|
return _$createComponent(PyDoc, {
|
|
224
328
|
children: children
|
|
225
329
|
});
|
|
226
330
|
}
|
|
227
331
|
/**
|
|
228
|
-
*
|
|
332
|
+
* A component that creates a GoogleStyleModuleDoc block for modules.
|
|
229
333
|
*/
|
|
230
|
-
|
|
231
|
-
const children =
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
334
|
+
function GoogleStyleModuleDoc(props) {
|
|
335
|
+
const children = [];
|
|
336
|
+
if (props.description !== undefined) {
|
|
337
|
+
children.push(_$createComponent(List, {
|
|
338
|
+
doubleHardline: true,
|
|
339
|
+
get children() {
|
|
340
|
+
return props.description;
|
|
341
|
+
}
|
|
342
|
+
}));
|
|
239
343
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
344
|
+
if (props.attributes?.length) {
|
|
345
|
+
children.push(_$createComponent(GoogleStyleDocAttributes, {
|
|
346
|
+
get attributes() {
|
|
347
|
+
return props.attributes;
|
|
348
|
+
}
|
|
349
|
+
}));
|
|
350
|
+
}
|
|
351
|
+
if (props.examples?.length) {
|
|
352
|
+
children.push(_$createComponent(GoogleStyleDocExamples, {
|
|
353
|
+
get items() {
|
|
354
|
+
return props.examples;
|
|
355
|
+
}
|
|
356
|
+
}));
|
|
357
|
+
}
|
|
358
|
+
if (props.seeAlso?.length) {
|
|
359
|
+
children.push(_$createComponent(GoogleStyleDocSeeAlso, {
|
|
360
|
+
get items() {
|
|
361
|
+
return props.seeAlso;
|
|
362
|
+
}
|
|
363
|
+
}));
|
|
364
|
+
}
|
|
365
|
+
if (props.warning) {
|
|
366
|
+
children.push(_$createComponent(GoogleStyleDocWarning, {
|
|
367
|
+
get message() {
|
|
368
|
+
return props.warning;
|
|
369
|
+
}
|
|
370
|
+
}));
|
|
371
|
+
}
|
|
372
|
+
if (props.deprecated) {
|
|
373
|
+
children.push(_$createComponent(GoogleStyleDocDeprecated, {
|
|
374
|
+
get message() {
|
|
375
|
+
return props.deprecated;
|
|
376
|
+
}
|
|
377
|
+
}));
|
|
378
|
+
}
|
|
379
|
+
if (props.todo?.length) {
|
|
380
|
+
children.push(_$createComponent(GoogleStyleDocTodo, {
|
|
381
|
+
get items() {
|
|
382
|
+
return props.todo;
|
|
383
|
+
}
|
|
384
|
+
}));
|
|
248
385
|
}
|
|
249
|
-
return
|
|
386
|
+
return _$createComponent(PyDoc, {
|
|
387
|
+
children: children
|
|
388
|
+
});
|
|
250
389
|
}
|
|
251
390
|
/**
|
|
252
|
-
* A
|
|
253
|
-
* linebreaks. This is useful for creating PyDoc comments with multiple paragraphs.
|
|
391
|
+
* A component that creates a GoogleStylePropertyDoc block for properties.
|
|
254
392
|
*/
|
|
255
|
-
|
|
256
|
-
const children =
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
393
|
+
function GoogleStylePropertyDoc(props) {
|
|
394
|
+
const children = [];
|
|
395
|
+
if (props.description !== undefined) {
|
|
396
|
+
children.push(_$createComponent(List, {
|
|
397
|
+
doubleHardline: true,
|
|
398
|
+
get children() {
|
|
399
|
+
return props.description;
|
|
400
|
+
}
|
|
401
|
+
}));
|
|
402
|
+
}
|
|
403
|
+
if (props.returns) {
|
|
404
|
+
children.push(_$createComponent(GoogleStyleDocReturn, {
|
|
405
|
+
get message() {
|
|
406
|
+
return props.returns;
|
|
407
|
+
}
|
|
408
|
+
}));
|
|
409
|
+
}
|
|
410
|
+
if (props.examples?.length) {
|
|
411
|
+
children.push(_$createComponent(GoogleStyleDocExamples, {
|
|
412
|
+
get items() {
|
|
413
|
+
return props.examples;
|
|
414
|
+
}
|
|
415
|
+
}));
|
|
416
|
+
}
|
|
417
|
+
if (props.seeAlso?.length) {
|
|
418
|
+
children.push(_$createComponent(GoogleStyleDocSeeAlso, {
|
|
419
|
+
get items() {
|
|
420
|
+
return props.seeAlso;
|
|
421
|
+
}
|
|
422
|
+
}));
|
|
423
|
+
}
|
|
424
|
+
if (props.warning) {
|
|
425
|
+
children.push(_$createComponent(GoogleStyleDocWarning, {
|
|
426
|
+
get message() {
|
|
427
|
+
return props.warning;
|
|
428
|
+
}
|
|
429
|
+
}));
|
|
430
|
+
}
|
|
431
|
+
if (props.deprecated) {
|
|
432
|
+
children.push(_$createComponent(GoogleStyleDocDeprecated, {
|
|
433
|
+
get message() {
|
|
434
|
+
return props.deprecated;
|
|
435
|
+
}
|
|
436
|
+
}));
|
|
437
|
+
}
|
|
438
|
+
if (props.note) {
|
|
439
|
+
children.push(_$createComponent(GoogleStyleDocNote, {
|
|
440
|
+
get message() {
|
|
441
|
+
return props.note;
|
|
442
|
+
}
|
|
443
|
+
}));
|
|
444
|
+
}
|
|
445
|
+
return _$createComponent(PyDoc, {
|
|
446
|
+
children: children
|
|
447
|
+
});
|
|
261
448
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
449
|
+
/**
|
|
450
|
+
* A component that creates a GoogleStyleGeneratorDoc block for generators.
|
|
451
|
+
*/
|
|
452
|
+
function GoogleStyleGeneratorDoc(props) {
|
|
453
|
+
const children = [];
|
|
454
|
+
if (props.description !== undefined) {
|
|
455
|
+
children.push(_$createComponent(List, {
|
|
456
|
+
doubleHardline: true,
|
|
457
|
+
get children() {
|
|
458
|
+
return props.description;
|
|
459
|
+
}
|
|
460
|
+
}));
|
|
461
|
+
}
|
|
462
|
+
if (props.parameters?.length) {
|
|
463
|
+
children.push(_$createComponent(GoogleStyleDocParams, {
|
|
464
|
+
get parameters() {
|
|
465
|
+
return props.parameters;
|
|
466
|
+
}
|
|
467
|
+
}));
|
|
468
|
+
}
|
|
469
|
+
if (props.yields) {
|
|
470
|
+
children.push(_$createComponent(GoogleStyleDocYields, {
|
|
471
|
+
get message() {
|
|
472
|
+
return props.yields;
|
|
473
|
+
}
|
|
474
|
+
}));
|
|
475
|
+
}
|
|
476
|
+
if (props.raises?.length) {
|
|
477
|
+
children.push(props.raises.map(param => _$createComponent(GoogleStyleDocRaises, {
|
|
478
|
+
message: param
|
|
479
|
+
})));
|
|
480
|
+
}
|
|
481
|
+
if (props.examples?.length) {
|
|
482
|
+
children.push(_$createComponent(GoogleStyleDocExamples, {
|
|
483
|
+
get items() {
|
|
484
|
+
return props.examples;
|
|
485
|
+
}
|
|
486
|
+
}));
|
|
487
|
+
}
|
|
488
|
+
if (props.seeAlso?.length) {
|
|
489
|
+
children.push(_$createComponent(GoogleStyleDocSeeAlso, {
|
|
490
|
+
get items() {
|
|
491
|
+
return props.seeAlso;
|
|
492
|
+
}
|
|
493
|
+
}));
|
|
494
|
+
}
|
|
495
|
+
if (props.warning) {
|
|
496
|
+
children.push(_$createComponent(GoogleStyleDocWarning, {
|
|
497
|
+
get message() {
|
|
498
|
+
return props.warning;
|
|
499
|
+
}
|
|
500
|
+
}));
|
|
501
|
+
}
|
|
502
|
+
if (props.deprecated) {
|
|
503
|
+
children.push(_$createComponent(GoogleStyleDocDeprecated, {
|
|
504
|
+
get message() {
|
|
505
|
+
return props.deprecated;
|
|
506
|
+
}
|
|
507
|
+
}));
|
|
508
|
+
}
|
|
509
|
+
if (props.note) {
|
|
510
|
+
children.push(_$createComponent(GoogleStyleDocNote, {
|
|
511
|
+
get message() {
|
|
512
|
+
return props.note;
|
|
513
|
+
}
|
|
514
|
+
}));
|
|
515
|
+
}
|
|
516
|
+
return _$createComponent(PyDoc, {
|
|
517
|
+
children: children
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* A component that creates a GoogleStyleExceptionDoc block for exceptions.
|
|
522
|
+
*/
|
|
523
|
+
function GoogleStyleExceptionDoc(props) {
|
|
524
|
+
const children = [];
|
|
525
|
+
if (props.description !== undefined) {
|
|
526
|
+
children.push(_$createComponent(List, {
|
|
527
|
+
doubleHardline: true,
|
|
528
|
+
get children() {
|
|
529
|
+
return props.description;
|
|
530
|
+
}
|
|
531
|
+
}));
|
|
532
|
+
}
|
|
533
|
+
if (props.parameters?.length) {
|
|
534
|
+
children.push(_$createComponent(GoogleStyleDocParams, {
|
|
535
|
+
get parameters() {
|
|
536
|
+
return props.parameters;
|
|
537
|
+
}
|
|
538
|
+
}));
|
|
539
|
+
}
|
|
540
|
+
if (props.attributes?.length) {
|
|
541
|
+
children.push(_$createComponent(GoogleStyleDocAttributes, {
|
|
542
|
+
get attributes() {
|
|
543
|
+
return props.attributes;
|
|
544
|
+
}
|
|
545
|
+
}));
|
|
546
|
+
}
|
|
547
|
+
if (props.examples?.length) {
|
|
548
|
+
children.push(_$createComponent(GoogleStyleDocExamples, {
|
|
549
|
+
get items() {
|
|
550
|
+
return props.examples;
|
|
551
|
+
}
|
|
552
|
+
}));
|
|
553
|
+
}
|
|
554
|
+
if (props.seeAlso?.length) {
|
|
555
|
+
children.push(_$createComponent(GoogleStyleDocSeeAlso, {
|
|
556
|
+
get items() {
|
|
557
|
+
return props.seeAlso;
|
|
558
|
+
}
|
|
559
|
+
}));
|
|
560
|
+
}
|
|
561
|
+
if (props.warning) {
|
|
562
|
+
children.push(_$createComponent(GoogleStyleDocWarning, {
|
|
563
|
+
get message() {
|
|
564
|
+
return props.warning;
|
|
565
|
+
}
|
|
566
|
+
}));
|
|
567
|
+
}
|
|
568
|
+
if (props.deprecated) {
|
|
569
|
+
children.push(_$createComponent(GoogleStyleDocDeprecated, {
|
|
570
|
+
get message() {
|
|
571
|
+
return props.deprecated;
|
|
572
|
+
}
|
|
573
|
+
}));
|
|
574
|
+
}
|
|
575
|
+
if (props.note) {
|
|
576
|
+
children.push(_$createComponent(GoogleStyleDocNote, {
|
|
577
|
+
get message() {
|
|
578
|
+
return props.note;
|
|
579
|
+
}
|
|
580
|
+
}));
|
|
581
|
+
}
|
|
582
|
+
return _$createComponent(PyDoc, {
|
|
583
|
+
children: children
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
587
|
+
* A component that creates a GoogleStyleAttributeDoc block for attributes.
|
|
588
|
+
*/
|
|
589
|
+
function GoogleStyleAttributeDoc(props) {
|
|
590
|
+
return _$createComponent(GoogleStyleDocAttribute, {
|
|
591
|
+
get name() {
|
|
592
|
+
return props.name;
|
|
593
|
+
},
|
|
594
|
+
get type() {
|
|
595
|
+
return props.type;
|
|
596
|
+
},
|
|
265
597
|
get children() {
|
|
266
|
-
return
|
|
598
|
+
return props.children;
|
|
599
|
+
}
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* A component that creates a GoogleStyleMethodDoc block for methods.
|
|
604
|
+
*/
|
|
605
|
+
function GoogleStyleMethodDoc(props) {
|
|
606
|
+
const children = [];
|
|
607
|
+
if (props.description !== undefined) {
|
|
608
|
+
children.push(_$createComponent(List, {
|
|
609
|
+
doubleHardline: true,
|
|
610
|
+
get children() {
|
|
611
|
+
return props.description;
|
|
612
|
+
}
|
|
613
|
+
}));
|
|
614
|
+
}
|
|
615
|
+
if (props.parameters?.length) {
|
|
616
|
+
children.push(_$createComponent(GoogleStyleDocParams, {
|
|
617
|
+
get parameters() {
|
|
618
|
+
return props.parameters;
|
|
619
|
+
}
|
|
620
|
+
}));
|
|
621
|
+
}
|
|
622
|
+
if (props.returns) {
|
|
623
|
+
children.push(_$createComponent(GoogleStyleDocReturn, {
|
|
624
|
+
get message() {
|
|
625
|
+
return props.returns;
|
|
626
|
+
}
|
|
627
|
+
}));
|
|
628
|
+
}
|
|
629
|
+
if (props.raises?.length) {
|
|
630
|
+
children.push(props.raises.map(param => _$createComponent(GoogleStyleDocRaises, {
|
|
631
|
+
message: param
|
|
632
|
+
})));
|
|
633
|
+
}
|
|
634
|
+
if (props.examples?.length) {
|
|
635
|
+
children.push(_$createComponent(GoogleStyleDocExamples, {
|
|
636
|
+
get items() {
|
|
637
|
+
return props.examples;
|
|
638
|
+
}
|
|
639
|
+
}));
|
|
640
|
+
}
|
|
641
|
+
if (props.seeAlso?.length) {
|
|
642
|
+
children.push(_$createComponent(GoogleStyleDocSeeAlso, {
|
|
643
|
+
get items() {
|
|
644
|
+
return props.seeAlso;
|
|
645
|
+
}
|
|
646
|
+
}));
|
|
647
|
+
}
|
|
648
|
+
if (props.warning) {
|
|
649
|
+
children.push(_$createComponent(GoogleStyleDocWarning, {
|
|
650
|
+
get message() {
|
|
651
|
+
return props.warning;
|
|
652
|
+
}
|
|
653
|
+
}));
|
|
654
|
+
}
|
|
655
|
+
if (props.deprecated) {
|
|
656
|
+
children.push(_$createComponent(GoogleStyleDocDeprecated, {
|
|
657
|
+
get message() {
|
|
658
|
+
return props.deprecated;
|
|
659
|
+
}
|
|
660
|
+
}));
|
|
661
|
+
}
|
|
662
|
+
if (props.overrides) {
|
|
663
|
+
children.push(_$createComponent(GoogleStyleDocOverrides, {
|
|
664
|
+
get parentClass() {
|
|
665
|
+
return props.overrides;
|
|
666
|
+
}
|
|
667
|
+
}));
|
|
668
|
+
}
|
|
669
|
+
if (props.note) {
|
|
670
|
+
children.push(_$createComponent(GoogleStyleDocNote, {
|
|
671
|
+
get message() {
|
|
672
|
+
return props.note;
|
|
673
|
+
}
|
|
674
|
+
}));
|
|
675
|
+
}
|
|
676
|
+
return _$createComponent(PyDoc, {
|
|
677
|
+
children: children
|
|
678
|
+
});
|
|
679
|
+
}
|
|
680
|
+
/**
|
|
681
|
+
* A component that creates a GoogleStyleDoc block for parameters.
|
|
682
|
+
*/
|
|
683
|
+
function GoogleStyleDocParams(props) {
|
|
684
|
+
const parameters = props.parameters;
|
|
685
|
+
|
|
686
|
+
// Don't render anything if there are no parameters
|
|
687
|
+
if (!parameters || parameters.length === 0) {
|
|
688
|
+
return null;
|
|
689
|
+
}
|
|
690
|
+
return ["Args:", _$createComponent(Indent, {
|
|
691
|
+
get children() {
|
|
692
|
+
return _$createComponent(List, {
|
|
693
|
+
doubleHardline: true,
|
|
267
694
|
get children() {
|
|
268
|
-
return
|
|
695
|
+
return parameters.map(param => _$createComponent(GoogleStyleDocParam, {
|
|
696
|
+
get name() {
|
|
697
|
+
return param.name;
|
|
698
|
+
},
|
|
699
|
+
get type() {
|
|
700
|
+
return param.type;
|
|
701
|
+
},
|
|
702
|
+
get ["default"]() {
|
|
703
|
+
return param.default;
|
|
704
|
+
},
|
|
705
|
+
get children() {
|
|
706
|
+
return param.doc;
|
|
707
|
+
}
|
|
708
|
+
}));
|
|
269
709
|
}
|
|
270
710
|
});
|
|
271
711
|
}
|
|
272
712
|
})];
|
|
273
713
|
}
|
|
274
|
-
|
|
275
|
-
|
|
714
|
+
/**
|
|
715
|
+
* Create a GoogleStyleDoc parameter.
|
|
716
|
+
*/
|
|
717
|
+
function GoogleStyleDocParam(props) {
|
|
718
|
+
return [_$createComponent(GoogleStyleDocParamName, {
|
|
719
|
+
get name() {
|
|
720
|
+
return props.name;
|
|
721
|
+
}
|
|
722
|
+
}), _$createComponent(GoogleStyleDocParamType, {
|
|
723
|
+
get type() {
|
|
724
|
+
return props.type;
|
|
725
|
+
},
|
|
726
|
+
get ["default"]() {
|
|
727
|
+
return Boolean(props.default);
|
|
728
|
+
}
|
|
729
|
+
}), _$createComponent(GoogleStyleDocParamDescription, {
|
|
276
730
|
get children() {
|
|
277
731
|
return props.children;
|
|
732
|
+
},
|
|
733
|
+
get ["default"]() {
|
|
734
|
+
return props.default;
|
|
735
|
+
}
|
|
736
|
+
})];
|
|
737
|
+
}
|
|
738
|
+
/**
|
|
739
|
+
* A component that creates a GoogleStyleDoc block for parameters.
|
|
740
|
+
*/
|
|
741
|
+
function GoogleStyleDocReturn(props) {
|
|
742
|
+
return ["Returns:", _$createComponent(Indent, {
|
|
743
|
+
get children() {
|
|
744
|
+
return props.message;
|
|
745
|
+
}
|
|
746
|
+
})];
|
|
747
|
+
}
|
|
748
|
+
/**
|
|
749
|
+
* A component that creates a GoogleStyleDoc block for exceptions.
|
|
750
|
+
*/
|
|
751
|
+
function GoogleStyleDocRaises(props) {
|
|
752
|
+
return ["Raises:", _$createComponent(Indent, {
|
|
753
|
+
get children() {
|
|
754
|
+
return props.message;
|
|
755
|
+
}
|
|
756
|
+
})];
|
|
757
|
+
}
|
|
758
|
+
/**
|
|
759
|
+
* A component that creates a GoogleStyleDoc block for generator yields.
|
|
760
|
+
*/
|
|
761
|
+
function GoogleStyleDocYields(props) {
|
|
762
|
+
return ["Yields:", _$createComponent(Indent, {
|
|
763
|
+
get children() {
|
|
764
|
+
return props.message;
|
|
765
|
+
}
|
|
766
|
+
})];
|
|
767
|
+
}
|
|
768
|
+
/**
|
|
769
|
+
* Create a GoogleStyleDoc attribute entry.
|
|
770
|
+
*/
|
|
771
|
+
function GoogleStyleDocAttribute(props) {
|
|
772
|
+
return [_$createComponent(GoogleStyleDocParamName, {
|
|
773
|
+
get name() {
|
|
774
|
+
return props.name;
|
|
775
|
+
}
|
|
776
|
+
}), _$createComponent(GoogleStyleDocParamType, {
|
|
777
|
+
get type() {
|
|
778
|
+
return props.type;
|
|
779
|
+
}
|
|
780
|
+
}), _$createComponent(GoogleStyleDocParamDescription, {
|
|
781
|
+
get children() {
|
|
782
|
+
return props.children;
|
|
783
|
+
}
|
|
784
|
+
})];
|
|
785
|
+
}
|
|
786
|
+
/**
|
|
787
|
+
* A component that creates a GoogleStyleDoc block for attributes.
|
|
788
|
+
*/
|
|
789
|
+
function GoogleStyleDocAttributes(props) {
|
|
790
|
+
return ["Attributes:", _$createComponent(Indent, {
|
|
791
|
+
get children() {
|
|
792
|
+
return _$createComponent(List, {
|
|
793
|
+
doubleHardline: true,
|
|
794
|
+
get children() {
|
|
795
|
+
return props.attributes.map(attr => _$createComponent(GoogleStyleDocAttribute, {
|
|
796
|
+
get name() {
|
|
797
|
+
return attr.name;
|
|
798
|
+
},
|
|
799
|
+
get type() {
|
|
800
|
+
return attr.type;
|
|
801
|
+
},
|
|
802
|
+
get children() {
|
|
803
|
+
return attr.children;
|
|
804
|
+
}
|
|
805
|
+
}));
|
|
806
|
+
}
|
|
807
|
+
});
|
|
808
|
+
}
|
|
809
|
+
})];
|
|
810
|
+
}
|
|
811
|
+
/**
|
|
812
|
+
* A component that creates a GoogleStyleDoc block for notes.
|
|
813
|
+
*/
|
|
814
|
+
function GoogleStyleDocNote(props) {
|
|
815
|
+
return ["Note:", _$createComponent(Indent, {
|
|
816
|
+
get children() {
|
|
817
|
+
return props.message;
|
|
818
|
+
}
|
|
819
|
+
})];
|
|
820
|
+
}
|
|
821
|
+
/**
|
|
822
|
+
* A component that creates a GoogleStyleDoc block for todo items.
|
|
823
|
+
*/
|
|
824
|
+
function GoogleStyleDocTodo(props) {
|
|
825
|
+
return ["Todo:", _$createComponent(Indent, {
|
|
826
|
+
get children() {
|
|
827
|
+
return _$createComponent(List, {
|
|
828
|
+
hardline: true,
|
|
829
|
+
get children() {
|
|
830
|
+
return props.items.map(item => ["* ", item]);
|
|
831
|
+
}
|
|
832
|
+
});
|
|
833
|
+
}
|
|
834
|
+
})];
|
|
835
|
+
}
|
|
836
|
+
/**
|
|
837
|
+
* A component that creates a GoogleStyleDoc block for examples.
|
|
838
|
+
*/
|
|
839
|
+
function GoogleStyleDocExamples(props) {
|
|
840
|
+
return ["Examples:", _$createComponent(Indent, {
|
|
841
|
+
get children() {
|
|
842
|
+
return _$createComponent(List, {
|
|
843
|
+
doubleHardline: true,
|
|
844
|
+
get children() {
|
|
845
|
+
return props.items.map(item => item);
|
|
846
|
+
}
|
|
847
|
+
});
|
|
848
|
+
}
|
|
849
|
+
})];
|
|
850
|
+
}
|
|
851
|
+
/**
|
|
852
|
+
* A component that creates a GoogleStyleDoc block for see also references.
|
|
853
|
+
*/
|
|
854
|
+
function GoogleStyleDocSeeAlso(props) {
|
|
855
|
+
return ["See Also:", _$createComponent(Indent, {
|
|
856
|
+
get children() {
|
|
857
|
+
return _$createComponent(List, {
|
|
858
|
+
hardline: true,
|
|
859
|
+
get children() {
|
|
860
|
+
return props.items.map(item => [item]);
|
|
861
|
+
}
|
|
862
|
+
});
|
|
863
|
+
}
|
|
864
|
+
})];
|
|
865
|
+
}
|
|
866
|
+
/**
|
|
867
|
+
* A component that creates a GoogleStyleDoc block for warnings.
|
|
868
|
+
*/
|
|
869
|
+
function GoogleStyleDocWarning(props) {
|
|
870
|
+
return ["Warning:", _$createComponent(Indent, {
|
|
871
|
+
get children() {
|
|
872
|
+
return props.message;
|
|
278
873
|
}
|
|
279
874
|
})];
|
|
280
875
|
}
|
|
876
|
+
/**
|
|
877
|
+
* A component that creates a GoogleStyleDoc block for deprecation notices.
|
|
878
|
+
*/
|
|
879
|
+
function GoogleStyleDocDeprecated(props) {
|
|
880
|
+
return ["Deprecated:", _$createComponent(Indent, {
|
|
881
|
+
get children() {
|
|
882
|
+
return props.message;
|
|
883
|
+
}
|
|
884
|
+
})];
|
|
885
|
+
}
|
|
886
|
+
/**
|
|
887
|
+
* A component that creates a GoogleStyleDoc block for overridden methods.
|
|
888
|
+
* This indicates that the method overrides a parent class method.
|
|
889
|
+
*/
|
|
890
|
+
function GoogleStyleDocOverrides(props) {
|
|
891
|
+
return ["Overrides:", _$createComponent(Indent, {
|
|
892
|
+
get children() {
|
|
893
|
+
return props.parentClass;
|
|
894
|
+
}
|
|
895
|
+
})];
|
|
896
|
+
}
|
|
897
|
+
function GoogleStyleDocParamType(props) {
|
|
898
|
+
return [_$createComponent(Show, {
|
|
899
|
+
get when() {
|
|
900
|
+
return Boolean(props.type);
|
|
901
|
+
},
|
|
902
|
+
get children() {
|
|
903
|
+
return [" (", _$memo(() => props.type), _$createComponent(Show, {
|
|
904
|
+
get when() {
|
|
905
|
+
return props.default;
|
|
906
|
+
},
|
|
907
|
+
children: ", optional"
|
|
908
|
+
}), ")"];
|
|
909
|
+
}
|
|
910
|
+
})];
|
|
911
|
+
}
|
|
912
|
+
function GoogleStyleDocParamName(props) {
|
|
913
|
+
return [_$memo(() => props.name)];
|
|
914
|
+
}
|
|
915
|
+
function GoogleStyleDocParamDescription(props) {
|
|
916
|
+
return _$createComponent(Show, {
|
|
917
|
+
get when() {
|
|
918
|
+
return Boolean(props.children);
|
|
919
|
+
},
|
|
920
|
+
get children() {
|
|
921
|
+
return [": ", _$createIntrinsic("align", {
|
|
922
|
+
width: 4,
|
|
923
|
+
get children() {
|
|
924
|
+
return _$createComponent(Prose, {
|
|
925
|
+
get children() {
|
|
926
|
+
return [_$memo(() => props.children), _$createComponent(Show, {
|
|
927
|
+
get when() {
|
|
928
|
+
return Boolean(props.default);
|
|
929
|
+
},
|
|
930
|
+
get children() {
|
|
931
|
+
return [_$createIntrinsic("br", {}), "Defaults to ", _$createComponent(Atom, {
|
|
932
|
+
get jsValue() {
|
|
933
|
+
return props.default;
|
|
934
|
+
}
|
|
935
|
+
}), "."];
|
|
936
|
+
}
|
|
937
|
+
})];
|
|
938
|
+
}
|
|
939
|
+
});
|
|
940
|
+
}
|
|
941
|
+
})];
|
|
942
|
+
}
|
|
943
|
+
});
|
|
944
|
+
}
|
|
281
945
|
//# sourceMappingURL=PyDoc.js.map
|