rspress-plugin-api-extractor 0.1.0 → 0.1.1
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/package.json +2 -3
- package/runtime/index.css +1016 -0
- package/runtime/index.d.ts +173 -0
- package/runtime/index.js +664 -0
package/runtime/index.js
ADDED
|
@@ -0,0 +1,664 @@
|
|
|
1
|
+
import "./index.css";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { createElement, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
4
|
+
import clsx from "clsx";
|
|
5
|
+
import { toJsxRuntime } from "hast-util-to-jsx-runtime";
|
|
6
|
+
import react_markdown from "react-markdown";
|
|
7
|
+
var __webpack_require__ = {};
|
|
8
|
+
(()=>{
|
|
9
|
+
__webpack_require__.d = (exports, definition)=>{
|
|
10
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: definition[key]
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
(()=>{
|
|
17
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
18
|
+
})();
|
|
19
|
+
(()=>{
|
|
20
|
+
__webpack_require__.r = (exports)=>{
|
|
21
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports, Symbol.toStringTag, {
|
|
22
|
+
value: 'Module'
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, '__esModule', {
|
|
25
|
+
value: true
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
})();
|
|
29
|
+
var ExampleBlock_namespaceObject = {};
|
|
30
|
+
__webpack_require__.r(ExampleBlock_namespaceObject);
|
|
31
|
+
__webpack_require__.d(ExampleBlock_namespaceObject, {
|
|
32
|
+
O: ()=>ExampleBlock_ExampleBlock
|
|
33
|
+
});
|
|
34
|
+
var MemberSignature_namespaceObject = {};
|
|
35
|
+
__webpack_require__.r(MemberSignature_namespaceObject);
|
|
36
|
+
__webpack_require__.d(MemberSignature_namespaceObject, {
|
|
37
|
+
N: ()=>MemberSignature_MemberSignature
|
|
38
|
+
});
|
|
39
|
+
var SignatureBlock_namespaceObject = {};
|
|
40
|
+
__webpack_require__.r(SignatureBlock_namespaceObject);
|
|
41
|
+
__webpack_require__.d(SignatureBlock_namespaceObject, {
|
|
42
|
+
G: ()=>SignatureBlock_SignatureBlock
|
|
43
|
+
});
|
|
44
|
+
function decodeHast(hast, componentName) {
|
|
45
|
+
if (!hast) return null;
|
|
46
|
+
if ("string" != typeof hast) return hast;
|
|
47
|
+
try {
|
|
48
|
+
if (/^[A-Za-z0-9+/=]+$/.test(hast) && hast.length > 20) {
|
|
49
|
+
const binaryString = atob(hast);
|
|
50
|
+
const bytes = Uint8Array.from(binaryString, (char)=>char.charCodeAt(0));
|
|
51
|
+
const json = new TextDecoder("utf-8").decode(bytes);
|
|
52
|
+
return JSON.parse(json);
|
|
53
|
+
}
|
|
54
|
+
return JSON.parse(hast);
|
|
55
|
+
} catch {
|
|
56
|
+
const name = componentName ? `${componentName}: ` : "";
|
|
57
|
+
console.warn(`${name}Failed to decode HAST`);
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function useWrapToggle() {
|
|
62
|
+
const [wrapped, setWrapped] = useState(false);
|
|
63
|
+
const toggleWrap = ()=>{
|
|
64
|
+
setWrapped(!wrapped);
|
|
65
|
+
};
|
|
66
|
+
return {
|
|
67
|
+
wrapped,
|
|
68
|
+
toggleWrap
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
const index_module = {
|
|
72
|
+
buttonGroup: "buttonGroup-AcnFuI",
|
|
73
|
+
button: "button-O9z52c"
|
|
74
|
+
};
|
|
75
|
+
function ButtonGroup({ children }) {
|
|
76
|
+
return /*#__PURE__*/ jsx("div", {
|
|
77
|
+
className: index_module.buttonGroup,
|
|
78
|
+
children: children
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function CheckIcon({ size = 16, ...props }) {
|
|
82
|
+
return /*#__PURE__*/ jsxs("svg", {
|
|
83
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
84
|
+
width: size,
|
|
85
|
+
height: size,
|
|
86
|
+
viewBox: "0 0 24 24",
|
|
87
|
+
...props,
|
|
88
|
+
children: [
|
|
89
|
+
/*#__PURE__*/ jsx("title", {
|
|
90
|
+
children: "Copied"
|
|
91
|
+
}),
|
|
92
|
+
/*#__PURE__*/ jsx("path", {
|
|
93
|
+
fill: "currentColor",
|
|
94
|
+
d: "M21 7L9 19l-5.5-5.5l1.41-1.41L9 16.17L19.59 5.59L21 7Z"
|
|
95
|
+
})
|
|
96
|
+
]
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function CopyIcon({ size = 16, ...props }) {
|
|
100
|
+
return /*#__PURE__*/ jsxs("svg", {
|
|
101
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
102
|
+
width: size,
|
|
103
|
+
height: size,
|
|
104
|
+
viewBox: "0 0 24 24",
|
|
105
|
+
...props,
|
|
106
|
+
children: [
|
|
107
|
+
/*#__PURE__*/ jsx("title", {
|
|
108
|
+
children: "Copy"
|
|
109
|
+
}),
|
|
110
|
+
/*#__PURE__*/ jsx("path", {
|
|
111
|
+
fill: "currentColor",
|
|
112
|
+
d: "M19 21H8V7h11m0-2H8a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2m-3-4H4a2 2 0 0 0-2 2v14h2V3h12V1Z"
|
|
113
|
+
})
|
|
114
|
+
]
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
function CopyCodeButton({ code }) {
|
|
118
|
+
const [copied, setCopied] = useState(false);
|
|
119
|
+
const handleCopy = useCallback(async ()=>{
|
|
120
|
+
try {
|
|
121
|
+
await navigator.clipboard.writeText(code);
|
|
122
|
+
setCopied(true);
|
|
123
|
+
setTimeout(()=>setCopied(false), 2000);
|
|
124
|
+
} catch {
|
|
125
|
+
const textarea = document.createElement("textarea");
|
|
126
|
+
textarea.value = code;
|
|
127
|
+
textarea.style.position = "fixed";
|
|
128
|
+
textarea.style.opacity = "0";
|
|
129
|
+
document.body.appendChild(textarea);
|
|
130
|
+
textarea.select();
|
|
131
|
+
document.execCommand("copy");
|
|
132
|
+
document.body.removeChild(textarea);
|
|
133
|
+
setCopied(true);
|
|
134
|
+
setTimeout(()=>setCopied(false), 2000);
|
|
135
|
+
}
|
|
136
|
+
}, [
|
|
137
|
+
code
|
|
138
|
+
]);
|
|
139
|
+
return /*#__PURE__*/ jsx("button", {
|
|
140
|
+
type: "button",
|
|
141
|
+
className: clsx(index_module.button, copied && "active"),
|
|
142
|
+
onClick: handleCopy,
|
|
143
|
+
"aria-label": copied ? "Copied!" : "Copy code",
|
|
144
|
+
title: copied ? "Copied!" : "Copy code",
|
|
145
|
+
children: copied ? /*#__PURE__*/ jsx(CheckIcon, {
|
|
146
|
+
size: 16
|
|
147
|
+
}) : /*#__PURE__*/ jsx(CopyIcon, {
|
|
148
|
+
size: 16
|
|
149
|
+
})
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
function UnwrapIcon({ size = 16, ...props }) {
|
|
153
|
+
return /*#__PURE__*/ jsxs("svg", {
|
|
154
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
155
|
+
width: size,
|
|
156
|
+
height: size,
|
|
157
|
+
viewBox: "0 0 24 24",
|
|
158
|
+
"aria-label": "Wrapped",
|
|
159
|
+
...props,
|
|
160
|
+
children: [
|
|
161
|
+
/*#__PURE__*/ jsx("title", {
|
|
162
|
+
children: "Unwrap"
|
|
163
|
+
}),
|
|
164
|
+
/*#__PURE__*/ jsx("path", {
|
|
165
|
+
fill: "#22a041",
|
|
166
|
+
d: "M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3l4 3v-2h2c2.95 0 4-1.27 4-4c0-2.72-1-4-4-4H3z"
|
|
167
|
+
})
|
|
168
|
+
]
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
function WrapIcon({ size = 16, ...props }) {
|
|
172
|
+
return /*#__PURE__*/ jsxs("svg", {
|
|
173
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
174
|
+
width: size,
|
|
175
|
+
height: size,
|
|
176
|
+
viewBox: "0 0 24 24",
|
|
177
|
+
...props,
|
|
178
|
+
children: [
|
|
179
|
+
/*#__PURE__*/ jsx("title", {
|
|
180
|
+
children: "Wrap"
|
|
181
|
+
}),
|
|
182
|
+
/*#__PURE__*/ jsx("path", {
|
|
183
|
+
fill: "currentColor",
|
|
184
|
+
d: "M16 7H3V5h13v2M3 19h13v-2H3v2m19-7l-4-3v2H3v2h15v2l4-3Z"
|
|
185
|
+
})
|
|
186
|
+
]
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
function WrapSignatureButton({ wrapped, onToggle }) {
|
|
190
|
+
return /*#__PURE__*/ jsx("button", {
|
|
191
|
+
type: "button",
|
|
192
|
+
className: clsx(index_module.button, wrapped && "active"),
|
|
193
|
+
onClick: onToggle,
|
|
194
|
+
"aria-label": wrapped ? "Disable line wrapping" : "Enable line wrapping",
|
|
195
|
+
title: wrapped ? "Disable wrapping" : "Enable wrapping",
|
|
196
|
+
children: wrapped ? /*#__PURE__*/ jsx(UnwrapIcon, {
|
|
197
|
+
size: 16
|
|
198
|
+
}) : /*#__PURE__*/ jsx(WrapIcon, {
|
|
199
|
+
size: 16
|
|
200
|
+
})
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
function hastToReact(hast) {
|
|
204
|
+
return toJsxRuntime(hast, {
|
|
205
|
+
Fragment: Fragment,
|
|
206
|
+
jsx: jsx,
|
|
207
|
+
jsxs: jsxs
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
const SignatureCode_index_module = {
|
|
211
|
+
code: "code-C94Xw8",
|
|
212
|
+
rpDark: "rp-dark-uV29jl",
|
|
213
|
+
wrapped: "wrapped-CCFVeG"
|
|
214
|
+
};
|
|
215
|
+
function SignatureCode({ hast, wrapped }) {
|
|
216
|
+
const containerRef = useRef(null);
|
|
217
|
+
useEffect(()=>{
|
|
218
|
+
const container = containerRef.current;
|
|
219
|
+
if (!container) return;
|
|
220
|
+
const handleMouseOver = (e)=>{
|
|
221
|
+
const target = e.target;
|
|
222
|
+
const hover = target.closest?.(".twoslash-hover");
|
|
223
|
+
if (!hover) return;
|
|
224
|
+
const popup = hover.querySelector(".twoslash-popup-container");
|
|
225
|
+
if (!popup) return;
|
|
226
|
+
const hoverRect = hover.getBoundingClientRect();
|
|
227
|
+
const containerWidth = container.getBoundingClientRect().width;
|
|
228
|
+
popup.style.setProperty("--popup-top", `${hoverRect.bottom + 4}px`);
|
|
229
|
+
popup.style.setProperty("--popup-left", `${hoverRect.left}px`);
|
|
230
|
+
popup.style.setProperty("--popup-max-width", `${0.75 * containerWidth}px`);
|
|
231
|
+
};
|
|
232
|
+
container.addEventListener("mouseover", handleMouseOver);
|
|
233
|
+
return ()=>container.removeEventListener("mouseover", handleMouseOver);
|
|
234
|
+
}, []);
|
|
235
|
+
if (!hast) return /*#__PURE__*/ jsx("div", {
|
|
236
|
+
ref: containerRef,
|
|
237
|
+
className: clsx(SignatureCode_index_module.code, wrapped && SignatureCode_index_module.wrapped)
|
|
238
|
+
});
|
|
239
|
+
return /*#__PURE__*/ jsx("div", {
|
|
240
|
+
ref: containerRef,
|
|
241
|
+
className: clsx("api-doc-code", SignatureCode_index_module.code, wrapped && SignatureCode_index_module.wrapped),
|
|
242
|
+
children: hastToReact(hast)
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
function Link({ children, href, title, target, rel }) {
|
|
246
|
+
return /*#__PURE__*/ jsx("a", {
|
|
247
|
+
className: "rp-link",
|
|
248
|
+
href: href,
|
|
249
|
+
title: title,
|
|
250
|
+
target: target,
|
|
251
|
+
rel: rel,
|
|
252
|
+
children: children
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
function MarkdownContent({ children }) {
|
|
256
|
+
return /*#__PURE__*/ jsx(react_markdown, {
|
|
257
|
+
components: {
|
|
258
|
+
a: Link
|
|
259
|
+
},
|
|
260
|
+
children: children
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
const SignatureToolbar_index_module = {
|
|
264
|
+
toolbar: "toolbar-UkMKNw",
|
|
265
|
+
rpDark: "rp-dark-nxUy8b",
|
|
266
|
+
memberHeading: "memberHeading-feA4hu",
|
|
267
|
+
toolbarLeft: "toolbarLeft-UmB7Yb",
|
|
268
|
+
memberHeadingH2: "memberHeadingH2-mEqox1",
|
|
269
|
+
summary: "summary-flYT6K",
|
|
270
|
+
buttons: "buttons-YWl5hD"
|
|
271
|
+
};
|
|
272
|
+
function SignatureToolbar({ heading, summary, buttons }) {
|
|
273
|
+
const renderHeading = ()=>{
|
|
274
|
+
if (!heading) return null;
|
|
275
|
+
const HeadingTag = heading.level;
|
|
276
|
+
const headingClasses = heading.className || clsx("rp-toc-include", SignatureToolbar_index_module.memberHeading, "h2" === heading.level && SignatureToolbar_index_module.memberHeadingH2);
|
|
277
|
+
return /*#__PURE__*/ jsxs(HeadingTag, {
|
|
278
|
+
id: heading.id,
|
|
279
|
+
className: headingClasses,
|
|
280
|
+
children: [
|
|
281
|
+
heading.id && /*#__PURE__*/ jsx("a", {
|
|
282
|
+
href: `#${heading.id}`,
|
|
283
|
+
className: "rp-header-anchor rp-link",
|
|
284
|
+
tabIndex: -1,
|
|
285
|
+
"aria-label": "Permalink",
|
|
286
|
+
children: "#"
|
|
287
|
+
}),
|
|
288
|
+
heading.text
|
|
289
|
+
]
|
|
290
|
+
});
|
|
291
|
+
};
|
|
292
|
+
const renderSummary = ()=>{
|
|
293
|
+
if (!summary) return null;
|
|
294
|
+
return /*#__PURE__*/ jsx("div", {
|
|
295
|
+
className: SignatureToolbar_index_module.summary,
|
|
296
|
+
children: /*#__PURE__*/ jsx(MarkdownContent, {
|
|
297
|
+
children: summary
|
|
298
|
+
})
|
|
299
|
+
});
|
|
300
|
+
};
|
|
301
|
+
if (heading) return /*#__PURE__*/ jsxs("div", {
|
|
302
|
+
className: SignatureToolbar_index_module.toolbar,
|
|
303
|
+
children: [
|
|
304
|
+
/*#__PURE__*/ jsxs("div", {
|
|
305
|
+
className: SignatureToolbar_index_module.toolbarLeft,
|
|
306
|
+
children: [
|
|
307
|
+
renderHeading(),
|
|
308
|
+
renderSummary()
|
|
309
|
+
]
|
|
310
|
+
}),
|
|
311
|
+
/*#__PURE__*/ jsx("div", {
|
|
312
|
+
className: SignatureToolbar_index_module.buttons,
|
|
313
|
+
children: buttons
|
|
314
|
+
})
|
|
315
|
+
]
|
|
316
|
+
});
|
|
317
|
+
return /*#__PURE__*/ jsx("div", {
|
|
318
|
+
className: SignatureToolbar_index_module.toolbar,
|
|
319
|
+
children: buttons
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
const ExampleBlock_index_module = {
|
|
323
|
+
block: "block-g6Xu1V",
|
|
324
|
+
rpDark: "rp-dark-q3G77C"
|
|
325
|
+
};
|
|
326
|
+
function ExampleBlock_ExampleBlock({ hast, code }) {
|
|
327
|
+
const { wrapped, toggleWrap } = useWrapToggle();
|
|
328
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
329
|
+
className: ExampleBlock_index_module.block,
|
|
330
|
+
children: [
|
|
331
|
+
/*#__PURE__*/ jsx(SignatureToolbar, {
|
|
332
|
+
buttons: /*#__PURE__*/ jsxs(ButtonGroup, {
|
|
333
|
+
children: [
|
|
334
|
+
code && /*#__PURE__*/ jsx(CopyCodeButton, {
|
|
335
|
+
code: code
|
|
336
|
+
}),
|
|
337
|
+
/*#__PURE__*/ jsx(WrapSignatureButton, {
|
|
338
|
+
wrapped: wrapped,
|
|
339
|
+
onToggle: toggleWrap
|
|
340
|
+
})
|
|
341
|
+
]
|
|
342
|
+
})
|
|
343
|
+
}),
|
|
344
|
+
/*#__PURE__*/ jsx(SignatureCode, {
|
|
345
|
+
hast: hast,
|
|
346
|
+
wrapped: wrapped
|
|
347
|
+
})
|
|
348
|
+
]
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
function ApiExample({ code, hast }) {
|
|
352
|
+
const parsedHast = useMemo(()=>decodeHast(hast, "ApiExample"), [
|
|
353
|
+
hast
|
|
354
|
+
]);
|
|
355
|
+
if (import.meta.env.SSG_MD) {
|
|
356
|
+
const header = "```typescript\n";
|
|
357
|
+
const footer = "\n```\n";
|
|
358
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
359
|
+
children: `${header}${code.trim()}${footer}`
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
if (parsedHast) {
|
|
363
|
+
const { O: ExampleBlock } = ExampleBlock_namespaceObject;
|
|
364
|
+
return /*#__PURE__*/ createElement(ExampleBlock, {
|
|
365
|
+
hast: parsedHast,
|
|
366
|
+
code: code.trim()
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
return /*#__PURE__*/ jsx("pre", {
|
|
370
|
+
children: /*#__PURE__*/ jsx("code", {
|
|
371
|
+
className: "language-typescript",
|
|
372
|
+
children: code.trim()
|
|
373
|
+
})
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
const MemberSignature_index_module = {
|
|
377
|
+
block: "block-Qq5hxM",
|
|
378
|
+
rpDark: "rp-dark-TylSkU",
|
|
379
|
+
hasParameters: "hasParameters-u13UWy"
|
|
380
|
+
};
|
|
381
|
+
function MemberSignature_MemberSignature({ hast, memberName, id, summary, hasParameters = false }) {
|
|
382
|
+
const { wrapped, toggleWrap } = useWrapToggle();
|
|
383
|
+
if (import.meta.env.SSG_MD) {
|
|
384
|
+
let signature = "";
|
|
385
|
+
if (hast) signature = extractTextFromHast(hast);
|
|
386
|
+
const lines = signature.split("\n").filter((line)=>line.trim());
|
|
387
|
+
if (lines.length >= 2) signature = lines[1].trim();
|
|
388
|
+
let markdown = `### ${memberName}\n\n**Signature:** \`${signature}\``;
|
|
389
|
+
if (summary) markdown += `\n\n${summary}`;
|
|
390
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
391
|
+
children: markdown
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
395
|
+
className: clsx(MemberSignature_index_module.block, hasParameters && MemberSignature_index_module.hasParameters),
|
|
396
|
+
children: [
|
|
397
|
+
/*#__PURE__*/ jsx(SignatureToolbar, {
|
|
398
|
+
heading: {
|
|
399
|
+
text: memberName,
|
|
400
|
+
...null != id ? {
|
|
401
|
+
id
|
|
402
|
+
} : {},
|
|
403
|
+
level: "h3"
|
|
404
|
+
},
|
|
405
|
+
...null != summary ? {
|
|
406
|
+
summary
|
|
407
|
+
} : {},
|
|
408
|
+
buttons: /*#__PURE__*/ jsx(WrapSignatureButton, {
|
|
409
|
+
wrapped: wrapped,
|
|
410
|
+
onToggle: toggleWrap
|
|
411
|
+
})
|
|
412
|
+
}),
|
|
413
|
+
/*#__PURE__*/ jsx(SignatureCode, {
|
|
414
|
+
hast: hast,
|
|
415
|
+
wrapped: wrapped
|
|
416
|
+
})
|
|
417
|
+
]
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
function extractTextFromHast(node) {
|
|
421
|
+
if ("value" in node && "string" == typeof node.value) return node.value;
|
|
422
|
+
if ("children" in node && Array.isArray(node.children)) return node.children.map(extractTextFromHast).join("");
|
|
423
|
+
return "";
|
|
424
|
+
}
|
|
425
|
+
function ApiMember({ code, memberName, summary, id, hast, hasParameters }) {
|
|
426
|
+
const parsedHast = useMemo(()=>decodeHast(hast, "ApiMember"), [
|
|
427
|
+
hast
|
|
428
|
+
]);
|
|
429
|
+
const hasParamsBoolean = "string" == typeof hasParameters ? "true" === hasParameters : !!hasParameters;
|
|
430
|
+
if (import.meta.env.SSG_MD) {
|
|
431
|
+
const header = "```typescript\n";
|
|
432
|
+
const footer = "\n```\n";
|
|
433
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
434
|
+
children: [
|
|
435
|
+
`### ${memberName}\n\n`,
|
|
436
|
+
summary && `${summary}\n\n`,
|
|
437
|
+
`${header}${code.trim()}${footer}`
|
|
438
|
+
]
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
if (parsedHast) {
|
|
442
|
+
const { N: MemberSignature } = MemberSignature_namespaceObject;
|
|
443
|
+
const memberProps = {
|
|
444
|
+
hast: parsedHast,
|
|
445
|
+
memberName,
|
|
446
|
+
hasParameters: hasParamsBoolean
|
|
447
|
+
};
|
|
448
|
+
if (null != summary) memberProps.summary = summary;
|
|
449
|
+
if (null != id) memberProps.id = id;
|
|
450
|
+
return /*#__PURE__*/ createElement(MemberSignature, memberProps);
|
|
451
|
+
}
|
|
452
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
453
|
+
children: [
|
|
454
|
+
/*#__PURE__*/ jsx("h3", {
|
|
455
|
+
id: id,
|
|
456
|
+
children: memberName
|
|
457
|
+
}),
|
|
458
|
+
summary && /*#__PURE__*/ jsx("p", {
|
|
459
|
+
children: summary
|
|
460
|
+
}),
|
|
461
|
+
/*#__PURE__*/ jsx("pre", {
|
|
462
|
+
children: /*#__PURE__*/ jsx("code", {
|
|
463
|
+
className: "language-typescript",
|
|
464
|
+
children: code.trim()
|
|
465
|
+
})
|
|
466
|
+
})
|
|
467
|
+
]
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
const SignatureBlock_index_module = {
|
|
471
|
+
block: "block-fru9Q7",
|
|
472
|
+
rpDark: "rp-dark-Bh4pwS",
|
|
473
|
+
hasParameters: "hasParameters-UU0nI6"
|
|
474
|
+
};
|
|
475
|
+
function SignatureBlock_SignatureBlock({ hast, heading = "Signature", id = "signature", hasParameters = false }) {
|
|
476
|
+
const { wrapped, toggleWrap } = useWrapToggle();
|
|
477
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
478
|
+
className: clsx(SignatureBlock_index_module.block, hasParameters && SignatureBlock_index_module.hasParameters),
|
|
479
|
+
children: [
|
|
480
|
+
/*#__PURE__*/ jsx(SignatureToolbar, {
|
|
481
|
+
...heading && id ? {
|
|
482
|
+
heading: {
|
|
483
|
+
text: heading,
|
|
484
|
+
id,
|
|
485
|
+
level: "h2"
|
|
486
|
+
}
|
|
487
|
+
} : {},
|
|
488
|
+
buttons: /*#__PURE__*/ jsx(WrapSignatureButton, {
|
|
489
|
+
wrapped: wrapped,
|
|
490
|
+
onToggle: toggleWrap
|
|
491
|
+
})
|
|
492
|
+
}),
|
|
493
|
+
/*#__PURE__*/ jsx(SignatureCode, {
|
|
494
|
+
hast: hast,
|
|
495
|
+
wrapped: wrapped
|
|
496
|
+
})
|
|
497
|
+
]
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
function ApiSignature({ code, heading: _heading = "Signature", id: _id = "signature", hast, hasParameters, hasMembers }) {
|
|
501
|
+
const parsedHast = useMemo(()=>decodeHast(hast, "ApiSignature"), [
|
|
502
|
+
hast
|
|
503
|
+
]);
|
|
504
|
+
const hasParamsBoolean = "string" == typeof hasParameters ? "true" === hasParameters : !!hasParameters;
|
|
505
|
+
const hasMembersBoolean = "string" == typeof hasMembers ? "true" === hasMembers : !!hasMembers;
|
|
506
|
+
const hasTableBelow = hasParamsBoolean || hasMembersBoolean;
|
|
507
|
+
if (import.meta.env.SSG_MD) {
|
|
508
|
+
const header = "```typescript\n";
|
|
509
|
+
const footer = "\n```\n";
|
|
510
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
511
|
+
children: `${header}${code.trim()}${footer}`
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
if (parsedHast) {
|
|
515
|
+
const { G: SignatureBlock } = SignatureBlock_namespaceObject;
|
|
516
|
+
return /*#__PURE__*/ createElement(SignatureBlock, {
|
|
517
|
+
hast: parsedHast,
|
|
518
|
+
hasParameters: hasTableBelow
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
return /*#__PURE__*/ jsx("pre", {
|
|
522
|
+
children: /*#__PURE__*/ jsx("code", {
|
|
523
|
+
className: "language-typescript",
|
|
524
|
+
children: code.trim()
|
|
525
|
+
})
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
const EnumMembersTable_index_module = {
|
|
529
|
+
table: "table-vZ4IFZ",
|
|
530
|
+
rpDark: "rp-dark-Xp3cTC",
|
|
531
|
+
scroll: "scroll-NvHud6"
|
|
532
|
+
};
|
|
533
|
+
const EnumMembersTable = ({ members })=>{
|
|
534
|
+
if (!members || 0 === members.length) return null;
|
|
535
|
+
if (import.meta.env.SSG_MD) {
|
|
536
|
+
let markdown = "#### Members\n\n";
|
|
537
|
+
markdown += "| Member | Value | Description |\n";
|
|
538
|
+
markdown += "|--------|-------|-------------|\n";
|
|
539
|
+
for (const member of members){
|
|
540
|
+
const name = `\`${member.name}\``;
|
|
541
|
+
const value = member.value ? `\`${member.value}\`` : "";
|
|
542
|
+
const description = member.description.replace(/<[^>]*>/g, "").trim();
|
|
543
|
+
markdown += `| ${name} | ${value} | ${description} |\n`;
|
|
544
|
+
}
|
|
545
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
546
|
+
children: markdown
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
return /*#__PURE__*/ jsx("div", {
|
|
550
|
+
className: EnumMembersTable_index_module.table,
|
|
551
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
552
|
+
className: EnumMembersTable_index_module.scroll,
|
|
553
|
+
children: /*#__PURE__*/ jsxs("table", {
|
|
554
|
+
children: [
|
|
555
|
+
/*#__PURE__*/ jsx("thead", {
|
|
556
|
+
children: /*#__PURE__*/ jsxs("tr", {
|
|
557
|
+
children: [
|
|
558
|
+
/*#__PURE__*/ jsx("th", {
|
|
559
|
+
children: "Member"
|
|
560
|
+
}),
|
|
561
|
+
/*#__PURE__*/ jsx("th", {
|
|
562
|
+
children: "Value"
|
|
563
|
+
}),
|
|
564
|
+
/*#__PURE__*/ jsx("th", {
|
|
565
|
+
children: "Description"
|
|
566
|
+
})
|
|
567
|
+
]
|
|
568
|
+
})
|
|
569
|
+
}),
|
|
570
|
+
/*#__PURE__*/ jsx("tbody", {
|
|
571
|
+
children: members.map((member)=>/*#__PURE__*/ jsxs("tr", {
|
|
572
|
+
children: [
|
|
573
|
+
/*#__PURE__*/ jsx("td", {
|
|
574
|
+
children: /*#__PURE__*/ jsx("code", {
|
|
575
|
+
children: member.name
|
|
576
|
+
})
|
|
577
|
+
}),
|
|
578
|
+
/*#__PURE__*/ jsx("td", {
|
|
579
|
+
children: member.value && /*#__PURE__*/ jsx("code", {
|
|
580
|
+
children: member.value
|
|
581
|
+
})
|
|
582
|
+
}),
|
|
583
|
+
/*#__PURE__*/ jsx("td", {
|
|
584
|
+
children: /*#__PURE__*/ jsx(MarkdownContent, {
|
|
585
|
+
children: member.description
|
|
586
|
+
})
|
|
587
|
+
})
|
|
588
|
+
]
|
|
589
|
+
}, member.name))
|
|
590
|
+
})
|
|
591
|
+
]
|
|
592
|
+
})
|
|
593
|
+
})
|
|
594
|
+
});
|
|
595
|
+
};
|
|
596
|
+
const ParametersTable_index_module = {
|
|
597
|
+
table: "table-wOupSX",
|
|
598
|
+
rpDark: "rp-dark-MFxhEo",
|
|
599
|
+
scroll: "scroll-prKOBp"
|
|
600
|
+
};
|
|
601
|
+
const ParametersTable = ({ parameters })=>{
|
|
602
|
+
if (!parameters || 0 === parameters.length) return null;
|
|
603
|
+
if (import.meta.env.SSG_MD) {
|
|
604
|
+
let markdown = "#### Parameters\n\n";
|
|
605
|
+
markdown += "| Name | Type | Description |\n";
|
|
606
|
+
markdown += "|------|------|-------------|\n";
|
|
607
|
+
for (const param of parameters){
|
|
608
|
+
const name = `\`${param.name}\``;
|
|
609
|
+
const type = param.type ? `\`${param.type}\`` : "";
|
|
610
|
+
const description = param.description.replace(/<[^>]*>/g, "").trim();
|
|
611
|
+
markdown += `| ${name} | ${type} | ${description} |\n`;
|
|
612
|
+
}
|
|
613
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
614
|
+
children: markdown
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
return /*#__PURE__*/ jsx("div", {
|
|
618
|
+
className: ParametersTable_index_module.table,
|
|
619
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
620
|
+
className: ParametersTable_index_module.scroll,
|
|
621
|
+
children: /*#__PURE__*/ jsxs("table", {
|
|
622
|
+
children: [
|
|
623
|
+
/*#__PURE__*/ jsx("thead", {
|
|
624
|
+
children: /*#__PURE__*/ jsxs("tr", {
|
|
625
|
+
children: [
|
|
626
|
+
/*#__PURE__*/ jsx("th", {
|
|
627
|
+
children: "Parameter"
|
|
628
|
+
}),
|
|
629
|
+
/*#__PURE__*/ jsx("th", {
|
|
630
|
+
children: "Type"
|
|
631
|
+
}),
|
|
632
|
+
/*#__PURE__*/ jsx("th", {
|
|
633
|
+
children: "Description"
|
|
634
|
+
})
|
|
635
|
+
]
|
|
636
|
+
})
|
|
637
|
+
}),
|
|
638
|
+
/*#__PURE__*/ jsx("tbody", {
|
|
639
|
+
children: parameters.map((param)=>/*#__PURE__*/ jsxs("tr", {
|
|
640
|
+
children: [
|
|
641
|
+
/*#__PURE__*/ jsx("td", {
|
|
642
|
+
children: /*#__PURE__*/ jsx("code", {
|
|
643
|
+
children: param.name
|
|
644
|
+
})
|
|
645
|
+
}),
|
|
646
|
+
/*#__PURE__*/ jsx("td", {
|
|
647
|
+
children: param.type && /*#__PURE__*/ jsx("code", {
|
|
648
|
+
children: param.type
|
|
649
|
+
})
|
|
650
|
+
}),
|
|
651
|
+
/*#__PURE__*/ jsx("td", {
|
|
652
|
+
children: /*#__PURE__*/ jsx(MarkdownContent, {
|
|
653
|
+
children: param.description
|
|
654
|
+
})
|
|
655
|
+
})
|
|
656
|
+
]
|
|
657
|
+
}, param.name))
|
|
658
|
+
})
|
|
659
|
+
]
|
|
660
|
+
})
|
|
661
|
+
})
|
|
662
|
+
});
|
|
663
|
+
};
|
|
664
|
+
export { ApiExample, ApiMember, ApiSignature, EnumMembersTable, ExampleBlock_ExampleBlock as ExampleBlock, MemberSignature_MemberSignature as MemberSignature, ParametersTable, SignatureBlock_SignatureBlock as SignatureBlock, hastToReact };
|