-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAPI.jsx
More file actions
299 lines (276 loc) · 6.5 KB
/
API.jsx
File metadata and controls
299 lines (276 loc) · 6.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
import React from "react";
import styles from "./styles.module.css";
export const Function = ({ children }) => (
<div className={styles.function}>{children}</div>
);
class NilableInfo extends React.Component {
render() {
return <>?</>;
}
}
class OptionalInfo extends React.Component {
render() {
return <>?</>;
}
}
class Parameter extends React.Component {
render() {
let displayName = this.props.name;
let displayType = this.props.type;
if (this.props.varargs) {
displayName = "...";
displayType = (
<a
href="https://www.lua.org/pil/5.2.html"
target="_blank"
alt="Programming in Lua: Variable Arguments"
>
varargs
</a>
);
}
return (
<tr>
<td className={styles.tdCounter}>{this.props.index}</td>
<td>{displayName}</td>
<td>
{displayType ? displayType : "any"}
{this.props.optional ? <OptionalInfo /> : ""}
</td>
<td>{this.props.fallback ? this.props.fallback : ""}</td>
</tr>
);
}
}
class Parameters extends React.Component {
hasChildren() {
return this.props.children !== undefined;
}
render() {
return (
<table
className={[
styles.functionParametersTable,
this.hasChildren() ? "visible" : "hidden",
].join(" ")}
>
<tbody
className={[
styles.tdCounterReset,
styles.functionParametersTableBody,
].join(" ")}
>
<tr className={styles.functionParametersFirstRow}>
<th colspan="4">Arguments</th>
</tr>
<tr className={styles.functionParametersHeadRow}>
<th>#</th>
<th>Name</th>
<th>Type</th>
<th>Fallback</th>
</tr>
{this.props.children}
</tbody>
</table>
);
}
}
class Returns extends React.Component {
render() {
return (
<table className={styles.functionReturnValuesTable}>
<tbody
className={[
styles.tdCounterReset,
styles.functionReturnValuesTableBody,
].join(" ")}
>
<tr className={styles.functionReturnValuesFirstRow}>
<th colspan="3">Return values</th>
</tr>
<tr className={styles.functionReturnValuesHeadRow}>
<th>#</th>
<th>Name</th>
<th>Type</th>
</tr>
{this.props.children}
</tbody>
</table>
);
}
}
class Return extends React.Component {
render() {
let displayName = this.props.name;
let displayType = this.props.type;
if (this.props.varargs) {
displayName = "...";
displayType = (
<a
href="https://www.lua.org/pil/5.2.html"
target="_blank"
alt="Programming in Lua: Variable Arguments"
>
varargs
</a>
);
}
return (
<tr>
<td className={styles.tdCounter}>{this.props.index}</td>
<td>{displayName}</td>
<td>
{displayType ? displayType : "any"}
{this.props.optional ? <OptionalInfo /> : ""}
</td>
</tr>
);
return (
<tr>
<td className={styles.tdCounter}>{this.props.index}</td>
<td>{this.props.name}</td>
<td>
{this.props.type ? this.props.type : "any"}
{this.props.optional ? <NilableInfo /> : ""}
</td>
</tr>
);
}
}
class Struct extends React.Component {
render() {
return (
<>
<table className={styles.structMembersTable}>
<tbody
className={[
styles.tdCounterReset,
styles.structMembersTableBody,
].join(" ")}
>
<tr className={styles.structMembersFirstRow}>
<th colspan="3">{this.props.name}</th>
</tr>
<tr className={styles.structMembersHeadRow}>
<th>Field</th>
<th>Type</th>
</tr>
{this.props.children}
</tbody>
</table>
</>
);
}
}
class Member extends React.Component {
render() {
return (
<tr>
<td>{this.props.name}</td>
<td>
{this.props.type ? this.props.type : "any"}
{this.props.optional ? <NilableInfo /> : ""}
</td>
</tr>
);
}
}
class Experimental extends React.Component {
render() {
return (
<>
<div className={styles.experimental}>
Experimental: Functionality may change for any reason, without
semantic versioning guarantees
</div>
</>
);
}
}
class Stable extends React.Component {
render() {
return (
<>
<div className={styles.stable}>
Stable: Functionality is covered by semantic versioning guarantees and
unlikely to see breaking changes
</div>
</>
);
}
}
class Deprecated extends React.Component {
render() {
return (
<>
<div className={styles.deprecated}>
Deprecated: Functionality is maintained for backwards compatibility
only, but covered by semantic versioning guarantees
</div>
</>
);
}
}
class External extends React.Component {
render() {
return (
<>
<div className={styles.external}>
External: Functionality is provided by a third-party library, which
may or may not give semantic versioning guarantees
</div>
</>
);
}
}
import Admonition from "@theme/Admonition";
class FFI extends React.Component {
render() {
return (
<>
<Admonition type="danger" title="Foreign Function Interface">
This is a low-level module; misuse can easily crash the runtime!
</Admonition>
</>
);
}
}
class Placeholder extends React.Component {
render() {
return (
<>
<Admonition type="info">
This section is a placeholder. If you know anything about the topic,
please help fill it with content!
</Admonition>
</>
);
}
}
class Blocking extends React.Component {
render() {
return (
<>
<Admonition type="caution" title="Blocking API">
This operation is synchronous; it will prevent the event loop from
running while the request is being handled.
</Admonition>
</>
);
}
}
export {
Parameters,
Parameter,
Returns,
Return,
Struct,
Member,
Experimental,
Stable,
Deprecated,
External,
FFI,
Placeholder,
Blocking,
};