rspress-plugin-api-extractor 0.1.0 → 0.1.2

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.
Files changed (48) hide show
  1. package/index.js +32 -236
  2. package/package.json +3 -3
  3. package/runtime/components/ApiExample/index.js +29 -0
  4. package/runtime/components/ApiLlmsPackageActions/index.js +348 -0
  5. package/runtime/components/ApiLlmsPackageActions/index.module.js +2 -0
  6. package/runtime/components/ApiLlmsViewOptions/index.js +365 -0
  7. package/runtime/components/ApiMember/index.js +51 -0
  8. package/runtime/components/ApiSignature/index.js +32 -0
  9. package/runtime/components/EnumMembersTable/index.js +69 -0
  10. package/runtime/components/EnumMembersTable/index.module.js +7 -0
  11. package/runtime/components/EnumMembersTable/index_module.css +100 -0
  12. package/runtime/components/ExampleBlock/index.js +36 -0
  13. package/runtime/components/ExampleBlock/index.module.js +6 -0
  14. package/runtime/components/ExampleBlock/index_module.css +12 -0
  15. package/runtime/components/MarkdownContent/index.js +23 -0
  16. package/runtime/components/MarkdownText/index.js +27 -0
  17. package/runtime/components/MemberSignature/index.js +54 -0
  18. package/runtime/components/MemberSignature/index.module.js +7 -0
  19. package/runtime/components/MemberSignature/index_module.css +27 -0
  20. package/runtime/components/ParametersTable/index.js +69 -0
  21. package/runtime/components/ParametersTable/index.module.js +7 -0
  22. package/runtime/components/ParametersTable/index_module.css +104 -0
  23. package/runtime/components/SignatureBlock/index.js +35 -0
  24. package/runtime/components/SignatureBlock/index.module.js +7 -0
  25. package/runtime/components/SignatureBlock/index_module.css +27 -0
  26. package/runtime/components/SignatureCode/index.js +36 -0
  27. package/runtime/components/SignatureCode/index.module.js +7 -0
  28. package/runtime/components/SignatureCode/index_module.css +53 -0
  29. package/runtime/components/SignatureToolbar/index.js +55 -0
  30. package/runtime/components/SignatureToolbar/index.module.js +11 -0
  31. package/runtime/components/SignatureToolbar/index_module.css +124 -0
  32. package/runtime/components/buttons/ButtonGroup.js +9 -0
  33. package/runtime/components/buttons/CopyCodeButton.js +42 -0
  34. package/runtime/components/buttons/WrapSignatureButton.js +20 -0
  35. package/runtime/components/buttons/index.module.js +6 -0
  36. package/runtime/components/buttons/index_module.css +37 -0
  37. package/runtime/components/icons/CheckIcon/index.js +20 -0
  38. package/runtime/components/icons/CopyIcon/index.js +20 -0
  39. package/runtime/components/icons/UnwrapIcon/index.js +21 -0
  40. package/runtime/components/icons/WrapIcon/index.js +20 -0
  41. package/runtime/components/shared/_twoslash.css +447 -0
  42. package/runtime/components/shared/types.js +0 -0
  43. package/runtime/components/shared/variables.css +85 -0
  44. package/runtime/hooks/useWrapToggle.js +12 -0
  45. package/runtime/index.d.ts +173 -0
  46. package/runtime/index.js +11 -0
  47. package/runtime/utils/decode-hast.js +18 -0
  48. package/runtime/utils/hast-renderer.js +10 -0
@@ -0,0 +1,365 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { useI18n, usePage, useSite } from "@rspress/core/runtime";
3
+ import { useMdUrl } from "@rspress/core/theme";
4
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
5
+ function resolveUrl(urlPath) {
6
+ if ("u" < typeof window) return urlPath;
7
+ return urlPath.startsWith("http") ? urlPath : `${window.location.origin}${urlPath}`;
8
+ }
9
+ function findScope(pathname, scopes) {
10
+ const sorted = [
11
+ ...scopes
12
+ ].sort((a, b)=>b.packageRoute.length - a.packageRoute.length);
13
+ for (const s of sorted){
14
+ const base = s.packageRoute.endsWith("/") ? s.packageRoute : `${s.packageRoute}/`;
15
+ if (pathname === s.packageRoute || pathname.startsWith(base)) return s;
16
+ }
17
+ return null;
18
+ }
19
+ async function copyText(text) {
20
+ await navigator.clipboard.writeText(text);
21
+ }
22
+ function DownArrow({ className }) {
23
+ return /*#__PURE__*/ jsxs("svg", {
24
+ className: className,
25
+ width: 16,
26
+ height: 16,
27
+ viewBox: "0 0 24 24",
28
+ fill: "none",
29
+ stroke: "currentColor",
30
+ strokeWidth: 2,
31
+ strokeLinecap: "round",
32
+ strokeLinejoin: "round",
33
+ children: [
34
+ /*#__PURE__*/ jsx("title", {
35
+ children: "Toggle menu"
36
+ }),
37
+ /*#__PURE__*/ jsx("path", {
38
+ d: "m6 9 6 6 6-6"
39
+ })
40
+ ]
41
+ });
42
+ }
43
+ function LinkIcon() {
44
+ return /*#__PURE__*/ jsxs("svg", {
45
+ width: 16,
46
+ height: 16,
47
+ viewBox: "0 0 24 24",
48
+ fill: "none",
49
+ stroke: "currentColor",
50
+ strokeWidth: 2,
51
+ strokeLinecap: "round",
52
+ strokeLinejoin: "round",
53
+ children: [
54
+ /*#__PURE__*/ jsx("title", {
55
+ children: "Link"
56
+ }),
57
+ /*#__PURE__*/ jsx("path", {
58
+ d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"
59
+ }),
60
+ /*#__PURE__*/ jsx("path", {
61
+ d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"
62
+ })
63
+ ]
64
+ });
65
+ }
66
+ function CopyIcon() {
67
+ return /*#__PURE__*/ jsxs("svg", {
68
+ width: 16,
69
+ height: 16,
70
+ viewBox: "0 0 24 24",
71
+ fill: "none",
72
+ stroke: "currentColor",
73
+ strokeWidth: 2,
74
+ strokeLinecap: "round",
75
+ strokeLinejoin: "round",
76
+ children: [
77
+ /*#__PURE__*/ jsx("title", {
78
+ children: "Copy"
79
+ }),
80
+ /*#__PURE__*/ jsx("rect", {
81
+ x: 9,
82
+ y: 9,
83
+ width: 13,
84
+ height: 13,
85
+ rx: 2,
86
+ ry: 2
87
+ }),
88
+ /*#__PURE__*/ jsx("path", {
89
+ d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"
90
+ })
91
+ ]
92
+ });
93
+ }
94
+ function ExternalLinkIcon() {
95
+ return /*#__PURE__*/ jsxs("svg", {
96
+ width: 12,
97
+ height: 12,
98
+ viewBox: "0 0 24 24",
99
+ fill: "none",
100
+ stroke: "currentColor",
101
+ strokeWidth: 2,
102
+ strokeLinecap: "round",
103
+ strokeLinejoin: "round",
104
+ children: [
105
+ /*#__PURE__*/ jsx("title", {
106
+ children: "External link"
107
+ }),
108
+ /*#__PURE__*/ jsx("path", {
109
+ d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"
110
+ }),
111
+ /*#__PURE__*/ jsx("polyline", {
112
+ points: "15 3 21 3 21 9"
113
+ }),
114
+ /*#__PURE__*/ jsx("line", {
115
+ x1: 10,
116
+ y1: 14,
117
+ x2: 21,
118
+ y2: 3
119
+ })
120
+ ]
121
+ });
122
+ }
123
+ function ChatGPTIcon() {
124
+ return /*#__PURE__*/ jsxs("svg", {
125
+ role: "img",
126
+ viewBox: "0 0 24 24",
127
+ fill: "currentColor",
128
+ xmlns: "http://www.w3.org/2000/svg",
129
+ width: 16,
130
+ height: 16,
131
+ children: [
132
+ /*#__PURE__*/ jsx("title", {
133
+ children: "ChatGPT"
134
+ }),
135
+ /*#__PURE__*/ jsx("path", {
136
+ d: "M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"
137
+ })
138
+ ]
139
+ });
140
+ }
141
+ function ClaudeIcon() {
142
+ return /*#__PURE__*/ jsxs("svg", {
143
+ fill: "currentColor",
144
+ role: "img",
145
+ viewBox: "0 0 24 24",
146
+ xmlns: "http://www.w3.org/2000/svg",
147
+ width: 16,
148
+ height: 16,
149
+ children: [
150
+ /*#__PURE__*/ jsx("title", {
151
+ children: "Anthropic"
152
+ }),
153
+ /*#__PURE__*/ jsx("path", {
154
+ d: "M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z"
155
+ })
156
+ ]
157
+ });
158
+ }
159
+ function LlmsViewOptions(props) {
160
+ const { site } = useSite();
161
+ const { page } = usePage();
162
+ const { pathname } = useMdUrl();
163
+ const t = useI18n();
164
+ const [isOpen, setIsOpen] = useState(false);
165
+ const [feedback, setFeedback] = useState(null);
166
+ const dropdownRef = useRef(null);
167
+ const llmsUI = site?.themeConfig?.llmsUI;
168
+ const configOptions = "object" == typeof llmsUI ? llmsUI?.viewOptions : void 0;
169
+ const options = props.options ?? configOptions ?? [
170
+ "markdownLink",
171
+ "chatgpt",
172
+ "claude"
173
+ ];
174
+ const tc = site?.themeConfig;
175
+ const scopes = tc?.apiExtractorScopes ?? [];
176
+ const activeScope = useMemo(()=>findScope(page.routePath, scopes), [
177
+ page.routePath,
178
+ scopes
179
+ ]);
180
+ useEffect(()=>{
181
+ if (!isOpen) return;
182
+ const handler = (e)=>{
183
+ if (dropdownRef.current && !dropdownRef.current.contains(e.target)) setIsOpen(false);
184
+ };
185
+ document.addEventListener("mousedown", handler);
186
+ return ()=>document.removeEventListener("mousedown", handler);
187
+ }, [
188
+ isOpen
189
+ ]);
190
+ const fullMarkdownUrl = useMemo(()=>"u" > typeof window ? new URL(pathname, window.location.origin).toString() : "", [
191
+ pathname
192
+ ]);
193
+ const pageQ = `Read ${fullMarkdownUrl}, I want to ask questions about it.`;
194
+ const pageItems = useMemo(()=>{
195
+ const builtins = {
196
+ markdownLink: {
197
+ title: t("copyMarkdownLinkText"),
198
+ icon: /*#__PURE__*/ jsx(LinkIcon, {}),
199
+ onClick: ()=>copyText(fullMarkdownUrl)
200
+ },
201
+ chatgpt: {
202
+ title: t("openInText", {
203
+ name: "ChatGPT"
204
+ }),
205
+ href: `https://chatgpt.com/?${new URLSearchParams({
206
+ hints: "search",
207
+ q: pageQ
208
+ })}`,
209
+ icon: /*#__PURE__*/ jsx(ChatGPTIcon, {})
210
+ },
211
+ claude: {
212
+ title: t("openInText", {
213
+ name: "Claude"
214
+ }),
215
+ href: `https://claude.ai/new?${new URLSearchParams({
216
+ q: pageQ
217
+ })}`,
218
+ icon: /*#__PURE__*/ jsx(ClaudeIcon, {})
219
+ }
220
+ };
221
+ return options.map((opt)=>{
222
+ if ("string" == typeof opt) return builtins[opt] ?? null;
223
+ return opt;
224
+ }).filter(Boolean);
225
+ }, [
226
+ options,
227
+ fullMarkdownUrl,
228
+ pageQ,
229
+ t
230
+ ]);
231
+ const showFeedback = useCallback((msg)=>{
232
+ setFeedback(msg);
233
+ setTimeout(()=>setFeedback(null), 1500);
234
+ }, []);
235
+ const handleCopyDocs = useCallback(async ()=>{
236
+ if (!activeScope) return;
237
+ try {
238
+ const res = await fetch(resolveUrl(activeScope.llmsDocsTxt));
239
+ await copyText(await res.text());
240
+ showFeedback("Copied!");
241
+ } catch {
242
+ showFeedback("Failed");
243
+ }
244
+ }, [
245
+ activeScope,
246
+ showFeedback
247
+ ]);
248
+ const handleCopyLink = useCallback(async (urlPath)=>{
249
+ try {
250
+ await copyText(resolveUrl(urlPath));
251
+ showFeedback("Copied!");
252
+ } catch {
253
+ showFeedback("Failed");
254
+ }
255
+ }, [
256
+ showFeedback
257
+ ]);
258
+ if (!pathname) return null;
259
+ const packageItems = [];
260
+ if (activeScope) {
261
+ const pkgQ = `Read ${resolveUrl(activeScope.llmsTxt)}, I want to ask questions about the ${activeScope.name} package.`;
262
+ packageItems.push({
263
+ title: feedback ?? `Copy ${activeScope.name} docs`,
264
+ icon: /*#__PURE__*/ jsx(CopyIcon, {}),
265
+ onClick: handleCopyDocs
266
+ }, {
267
+ title: "Copy llms.txt link",
268
+ icon: /*#__PURE__*/ jsx(LinkIcon, {}),
269
+ onClick: ()=>handleCopyLink(activeScope.llmsTxt)
270
+ }, {
271
+ title: "Copy llms-full.txt link",
272
+ icon: /*#__PURE__*/ jsx(LinkIcon, {}),
273
+ onClick: ()=>handleCopyLink(activeScope.llmsFullTxt)
274
+ }, {
275
+ title: `Open ${activeScope.name} in ChatGPT`,
276
+ href: `https://chatgpt.com/?${new URLSearchParams({
277
+ hints: "search",
278
+ q: pkgQ
279
+ })}`,
280
+ icon: /*#__PURE__*/ jsx(ChatGPTIcon, {})
281
+ }, {
282
+ title: `Open ${activeScope.name} in Claude`,
283
+ href: `https://claude.ai/new?${new URLSearchParams({
284
+ q: pkgQ
285
+ })}`,
286
+ icon: /*#__PURE__*/ jsx(ClaudeIcon, {})
287
+ });
288
+ }
289
+ return /*#__PURE__*/ jsxs("button", {
290
+ ref: dropdownRef,
291
+ type: "button",
292
+ className: `rp-llms-button rp-llms-view-options__trigger ${isOpen ? "rp-llms-view-options__trigger--active" : ""}`,
293
+ onClick: ()=>setIsOpen(!isOpen),
294
+ children: [
295
+ /*#__PURE__*/ jsx(DownArrow, {
296
+ className: `rp-llms-view-options__arrow ${isOpen ? "rp-llms-view-options__arrow--rotated" : ""}`
297
+ }),
298
+ isOpen && /*#__PURE__*/ jsxs("div", {
299
+ className: "rp-llms-view-options__menu",
300
+ children: [
301
+ pageItems.map((item)=>/*#__PURE__*/ jsx(MenuItem, {
302
+ item: item,
303
+ onClose: ()=>setIsOpen(false)
304
+ }, item.title)),
305
+ packageItems.length > 0 && /*#__PURE__*/ jsxs(Fragment, {
306
+ children: [
307
+ /*#__PURE__*/ jsx("div", {
308
+ style: {
309
+ height: 1,
310
+ margin: "4px 0",
311
+ background: "var(--rp-c-divider)"
312
+ }
313
+ }),
314
+ packageItems.map((item)=>/*#__PURE__*/ jsx(MenuItem, {
315
+ item: item,
316
+ onClose: ()=>setIsOpen(false)
317
+ }, item.title))
318
+ ]
319
+ })
320
+ ]
321
+ })
322
+ ]
323
+ });
324
+ }
325
+ function MenuItem({ item, onClose }) {
326
+ if (item.href) return /*#__PURE__*/ jsxs("a", {
327
+ className: "rp-llms-view-options__menu-item",
328
+ href: item.href,
329
+ target: "_blank",
330
+ rel: "noopener noreferrer",
331
+ onClick: onClose,
332
+ children: [
333
+ /*#__PURE__*/ jsx("span", {
334
+ className: "rp-llms-view-options__item-icon",
335
+ children: item.icon
336
+ }),
337
+ /*#__PURE__*/ jsx("span", {
338
+ children: item.title
339
+ }),
340
+ /*#__PURE__*/ jsx("span", {
341
+ className: "rp-llms-view-options__external-icon",
342
+ children: /*#__PURE__*/ jsx(ExternalLinkIcon, {})
343
+ })
344
+ ]
345
+ });
346
+ return /*#__PURE__*/ jsxs("button", {
347
+ type: "button",
348
+ className: "rp-llms-view-options__menu-item",
349
+ onClick: (e)=>{
350
+ e.stopPropagation();
351
+ item.onClick?.();
352
+ onClose();
353
+ },
354
+ children: [
355
+ /*#__PURE__*/ jsx("span", {
356
+ className: "rp-llms-view-options__item-icon",
357
+ children: item.icon
358
+ }),
359
+ /*#__PURE__*/ jsx("span", {
360
+ children: item.title
361
+ })
362
+ ]
363
+ });
364
+ }
365
+ export { LlmsViewOptions };
@@ -0,0 +1,51 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { createElement, useMemo } from "react";
3
+ import { decodeHast } from "../../utils/decode-hast.js";
4
+ import { MemberSignature } from "../MemberSignature/index.js";
5
+ function ApiMember({ code, memberName, summary, id, hast, hasParameters }) {
6
+ const parsedHast = useMemo(()=>decodeHast(hast, "ApiMember"), [
7
+ hast
8
+ ]);
9
+ const hasParamsBoolean = "string" == typeof hasParameters ? "true" === hasParameters : !!hasParameters;
10
+ if (import.meta.env.SSG_MD) {
11
+ const header = "```typescript\n";
12
+ const footer = "\n```\n";
13
+ return /*#__PURE__*/ jsxs(Fragment, {
14
+ children: [
15
+ `### ${memberName}\n\n`,
16
+ summary && `${summary}\n\n`,
17
+ `${header}${code.trim()}${footer}`
18
+ ]
19
+ });
20
+ }
21
+ if (parsedHast) {
22
+ const memberProps = {
23
+ hast: parsedHast,
24
+ memberName,
25
+ hasParameters: hasParamsBoolean
26
+ };
27
+ if (null != summary) memberProps.summary = summary;
28
+ if (null != id) memberProps.id = id;
29
+ return /*#__PURE__*/ createElement(MemberSignature, memberProps);
30
+ }
31
+ return /*#__PURE__*/ jsxs("div", {
32
+ children: [
33
+ /*#__PURE__*/ jsx("h3", {
34
+ id: id,
35
+ children: memberName
36
+ }),
37
+ summary && /*#__PURE__*/ jsx("p", {
38
+ children: summary
39
+ }),
40
+ /*#__PURE__*/ jsx("pre", {
41
+ children: /*#__PURE__*/ jsx("code", {
42
+ className: "language-typescript",
43
+ children: code.trim()
44
+ })
45
+ })
46
+ ]
47
+ });
48
+ }
49
+ const components_ApiMember = ApiMember;
50
+ export default components_ApiMember;
51
+ export { ApiMember };
@@ -0,0 +1,32 @@
1
+ import { Fragment, jsx } from "react/jsx-runtime";
2
+ import { createElement, useMemo } from "react";
3
+ import { decodeHast } from "../../utils/decode-hast.js";
4
+ import { SignatureBlock } from "../SignatureBlock/index.js";
5
+ function ApiSignature({ code, heading: _heading = "Signature", id: _id = "signature", hast, hasParameters, hasMembers }) {
6
+ const parsedHast = useMemo(()=>decodeHast(hast, "ApiSignature"), [
7
+ hast
8
+ ]);
9
+ const hasParamsBoolean = "string" == typeof hasParameters ? "true" === hasParameters : !!hasParameters;
10
+ const hasMembersBoolean = "string" == typeof hasMembers ? "true" === hasMembers : !!hasMembers;
11
+ const hasTableBelow = hasParamsBoolean || hasMembersBoolean;
12
+ if (import.meta.env.SSG_MD) {
13
+ const header = "```typescript\n";
14
+ const footer = "\n```\n";
15
+ return /*#__PURE__*/ jsx(Fragment, {
16
+ children: `${header}${code.trim()}${footer}`
17
+ });
18
+ }
19
+ if (parsedHast) return /*#__PURE__*/ createElement(SignatureBlock, {
20
+ hast: parsedHast,
21
+ hasParameters: hasTableBelow
22
+ });
23
+ return /*#__PURE__*/ jsx("pre", {
24
+ children: /*#__PURE__*/ jsx("code", {
25
+ className: "language-typescript",
26
+ children: code.trim()
27
+ })
28
+ });
29
+ }
30
+ const components_ApiSignature = ApiSignature;
31
+ export default components_ApiSignature;
32
+ export { ApiSignature };
@@ -0,0 +1,69 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { MarkdownContent } from "../MarkdownContent/index.js";
3
+ import index_module from "./index.module.js";
4
+ const EnumMembersTable = ({ members })=>{
5
+ if (!members || 0 === members.length) return null;
6
+ if (import.meta.env.SSG_MD) {
7
+ let markdown = "#### Members\n\n";
8
+ markdown += "| Member | Value | Description |\n";
9
+ markdown += "|--------|-------|-------------|\n";
10
+ for (const member of members){
11
+ const name = `\`${member.name}\``;
12
+ const value = member.value ? `\`${member.value}\`` : "";
13
+ const description = member.description.replace(/<[^>]*>/g, "").trim();
14
+ markdown += `| ${name} | ${value} | ${description} |\n`;
15
+ }
16
+ return /*#__PURE__*/ jsx(Fragment, {
17
+ children: markdown
18
+ });
19
+ }
20
+ return /*#__PURE__*/ jsx("div", {
21
+ className: index_module.table,
22
+ children: /*#__PURE__*/ jsx("div", {
23
+ className: index_module.scroll,
24
+ children: /*#__PURE__*/ jsxs("table", {
25
+ children: [
26
+ /*#__PURE__*/ jsx("thead", {
27
+ children: /*#__PURE__*/ jsxs("tr", {
28
+ children: [
29
+ /*#__PURE__*/ jsx("th", {
30
+ children: "Member"
31
+ }),
32
+ /*#__PURE__*/ jsx("th", {
33
+ children: "Value"
34
+ }),
35
+ /*#__PURE__*/ jsx("th", {
36
+ children: "Description"
37
+ })
38
+ ]
39
+ })
40
+ }),
41
+ /*#__PURE__*/ jsx("tbody", {
42
+ children: members.map((member)=>/*#__PURE__*/ jsxs("tr", {
43
+ children: [
44
+ /*#__PURE__*/ jsx("td", {
45
+ children: /*#__PURE__*/ jsx("code", {
46
+ children: member.name
47
+ })
48
+ }),
49
+ /*#__PURE__*/ jsx("td", {
50
+ children: member.value && /*#__PURE__*/ jsx("code", {
51
+ children: member.value
52
+ })
53
+ }),
54
+ /*#__PURE__*/ jsx("td", {
55
+ children: /*#__PURE__*/ jsx(MarkdownContent, {
56
+ children: member.description
57
+ })
58
+ })
59
+ ]
60
+ }, member.name))
61
+ })
62
+ ]
63
+ })
64
+ })
65
+ });
66
+ };
67
+ const components_EnumMembersTable = EnumMembersTable;
68
+ export default components_EnumMembersTable;
69
+ export { EnumMembersTable };
@@ -0,0 +1,7 @@
1
+ import "./index_module.css";
2
+ const index_module = {
3
+ table: "table-vZ4IFZ",
4
+ rpDark: "rp-dark-Xp3cTC",
5
+ scroll: "scroll-NvHud6"
6
+ };
7
+ export default index_module;
@@ -0,0 +1,100 @@
1
+ .table-vZ4IFZ {
2
+ border: 1px solid var(--api-color-border);
3
+ border-radius: 0 0 var(--api-border-radius) var(--api-border-radius);
4
+ border-top: none;
5
+ margin: 0;
6
+ position: relative;
7
+ overflow: hidden;
8
+ }
9
+
10
+ html.rp-dark-Xp3cTC .table-vZ4IFZ {
11
+ border-color: var(--api-color-border);
12
+ }
13
+
14
+ .scroll-NvHud6 {
15
+ -webkit-overflow-scrolling: touch;
16
+ overflow-x: auto;
17
+ }
18
+
19
+ .table-vZ4IFZ table {
20
+ border-collapse: collapse;
21
+ width: 100%;
22
+ font-size: var(--api-font-size-base);
23
+ border-top-left-radius: 0;
24
+ border-top-right-radius: 0;
25
+ margin: 0;
26
+ }
27
+
28
+ .table-vZ4IFZ thead {
29
+ background-color: var(--api-color-bg);
30
+ border-bottom: 1px solid var(--api-color-border);
31
+ }
32
+
33
+ .table-vZ4IFZ th {
34
+ padding: var(--api-spacing-md) var(--api-spacing-lg);
35
+ text-align: left;
36
+ color: var(--api-color-text);
37
+ white-space: nowrap;
38
+ font-weight: 600;
39
+ }
40
+
41
+ .table-vZ4IFZ th:first-child {
42
+ width: 20%;
43
+ min-width: 120px;
44
+ }
45
+
46
+ .table-vZ4IFZ th:nth-child(2) {
47
+ width: 25%;
48
+ min-width: 120px;
49
+ }
50
+
51
+ .table-vZ4IFZ th:last-child {
52
+ width: 55%;
53
+ }
54
+
55
+ .table-vZ4IFZ td {
56
+ padding: var(--api-spacing-md) var(--api-spacing-lg);
57
+ border-top: 1px solid var(--api-color-border);
58
+ vertical-align: top;
59
+ }
60
+
61
+ .table-vZ4IFZ td:first-child {
62
+ width: 20%;
63
+ min-width: 120px;
64
+ }
65
+
66
+ .table-vZ4IFZ td:nth-child(2) {
67
+ width: 25%;
68
+ min-width: 120px;
69
+ }
70
+
71
+ .table-vZ4IFZ td:last-child {
72
+ width: 55%;
73
+ }
74
+
75
+ .table-vZ4IFZ td code, .table-vZ4IFZ th code {
76
+ font-size: var(--api-font-size-sm);
77
+ background-color: var(--api-color-code-bg);
78
+ border-radius: var(--api-border-radius-sm);
79
+ padding: .125rem .375rem;
80
+ }
81
+
82
+ .table-vZ4IFZ td:last-child p:first-child {
83
+ margin-top: 0;
84
+ }
85
+
86
+ .table-vZ4IFZ td:last-child p:last-child, .table-vZ4IFZ td:last-child ul:last-child, .table-vZ4IFZ td:last-child ol:last-child {
87
+ margin-bottom: 0;
88
+ }
89
+
90
+ @media (width <= 768px) {
91
+ .table-vZ4IFZ td, .table-vZ4IFZ th {
92
+ padding: var(--api-spacing-sm) var(--api-spacing-md);
93
+ font-size: var(--api-font-size-sm);
94
+ }
95
+
96
+ .table-vZ4IFZ td:first-child, .table-vZ4IFZ th:first-child, .table-vZ4IFZ td:nth-child(2), .table-vZ4IFZ th:nth-child(2) {
97
+ min-width: 100px;
98
+ }
99
+ }
100
+
@@ -0,0 +1,36 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useWrapToggle } from "../../hooks/useWrapToggle.js";
3
+ import { ButtonGroup } from "../buttons/ButtonGroup.js";
4
+ import { CopyCodeButton } from "../buttons/CopyCodeButton.js";
5
+ import { WrapSignatureButton } from "../buttons/WrapSignatureButton.js";
6
+ import { SignatureCode } from "../SignatureCode/index.js";
7
+ import { SignatureToolbar } from "../SignatureToolbar/index.js";
8
+ import index_module from "./index.module.js";
9
+ function ExampleBlock({ hast, code }) {
10
+ const { wrapped, toggleWrap } = useWrapToggle();
11
+ return /*#__PURE__*/ jsxs("div", {
12
+ className: index_module.block,
13
+ children: [
14
+ /*#__PURE__*/ jsx(SignatureToolbar, {
15
+ buttons: /*#__PURE__*/ jsxs(ButtonGroup, {
16
+ children: [
17
+ code && /*#__PURE__*/ jsx(CopyCodeButton, {
18
+ code: code
19
+ }),
20
+ /*#__PURE__*/ jsx(WrapSignatureButton, {
21
+ wrapped: wrapped,
22
+ onToggle: toggleWrap
23
+ })
24
+ ]
25
+ })
26
+ }),
27
+ /*#__PURE__*/ jsx(SignatureCode, {
28
+ hast: hast,
29
+ wrapped: wrapped
30
+ })
31
+ ]
32
+ });
33
+ }
34
+ const components_ExampleBlock = ExampleBlock;
35
+ export default components_ExampleBlock;
36
+ export { ExampleBlock };
@@ -0,0 +1,6 @@
1
+ import "./index_module.css";
2
+ const index_module = {
3
+ block: "block-g6Xu1V",
4
+ rpDark: "rp-dark-q3G77C"
5
+ };
6
+ export default index_module;
@@ -0,0 +1,12 @@
1
+ .block-g6Xu1V {
2
+ margin: var(--api-spacing-xl) 0;
3
+ border-radius: var(--api-border-radius);
4
+ border: 1px solid var(--api-color-border);
5
+ position: relative;
6
+ overflow: visible;
7
+ }
8
+
9
+ html.rp-dark-q3G77C .block-g6Xu1V {
10
+ border-color: var(--api-color-border);
11
+ }
12
+