rspress-plugin-api-extractor 0.1.2 → 0.2.0
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/README.md +2 -2
- package/api-extracted-package.js +426 -0
- package/build-program.js +120 -0
- package/build-stages.js +664 -0
- package/category-resolver.js +50 -0
- package/code-post-processor.js +38 -0
- package/config-helpers.js +106 -0
- package/config-utils.js +258 -0
- package/content-hash.js +79 -0
- package/errors.js +29 -0
- package/formatter.js +69 -0
- package/hide-cut-transformer.js +96 -0
- package/index.d.ts +901 -831
- package/index.js +4 -6128
- package/layers/ConfigServiceLive.js +377 -0
- package/layers/ObservabilityLive.js +136 -0
- package/layers/PathDerivationServiceLive.js +16 -0
- package/layers/SnapshotServiceLive.js +94 -0
- package/layers/TypeRegistryServiceLive.js +46 -0
- package/llms-processing.js +270 -0
- package/llms-program.js +262 -0
- package/loader.js +186 -0
- package/markdown/cross-linker.js +156 -0
- package/markdown/helpers.js +364 -0
- package/markdown/index.js +11 -0
- package/markdown/page-generators/class-page.js +357 -0
- package/markdown/page-generators/enum-page.js +152 -0
- package/markdown/page-generators/function-page.js +127 -0
- package/markdown/page-generators/index-pages.js +27 -0
- package/markdown/page-generators/interface-page.js +307 -0
- package/markdown/page-generators/namespace-page.js +280 -0
- package/markdown/page-generators/type-alias-page.js +110 -0
- package/markdown/page-generators/variable-page.js +110 -0
- package/markdown/shiki-utils.js +48 -0
- package/migrations/001_create_snapshots.js +25 -0
- package/model-loader.js +95 -0
- package/multi-entry-resolver.js +70 -0
- package/og-resolver.js +271 -0
- package/package.json +63 -73
- package/path-derivation.js +48 -0
- package/plugin.js +218 -0
- package/prettier-formatter.js +73 -0
- package/public/tsconfig/rspress.json +44 -0
- package/remark-api-codeblocks.js +130 -0
- package/remark-with-api.js +172 -0
- package/route-collisions.js +52 -0
- package/runtime/components/ApiExample/index.js +29 -25
- package/runtime/components/ApiLlmsPackageActions/index.js +252 -323
- package/runtime/components/ApiLlmsViewOptions/index.js +269 -340
- package/runtime/components/ApiMember/index.js +49 -47
- package/runtime/components/ApiSignature/index.js +32 -28
- package/runtime/components/EnumMembersTable/{index_module.css → index.css} +18 -19
- package/runtime/components/EnumMembersTable/index.js +36 -67
- package/runtime/components/EnumMembersTable/index.module.js +9 -6
- package/runtime/components/ExampleBlock/{index_module.css → index.css} +2 -3
- package/runtime/components/ExampleBlock/index.js +23 -28
- package/runtime/components/ExampleBlock/index.module.js +8 -5
- package/runtime/components/MarkdownContent/index.js +26 -18
- package/runtime/components/MarkdownText/index.js +28 -22
- package/runtime/components/MemberSignature/{index_module.css → index.css} +5 -6
- package/runtime/components/MemberSignature/index.js +46 -46
- package/runtime/components/MemberSignature/index.module.js +9 -6
- package/runtime/components/ParametersTable/{index_module.css → index.css} +19 -20
- package/runtime/components/ParametersTable/index.js +36 -67
- package/runtime/components/ParametersTable/index.module.js +9 -6
- package/runtime/components/SignatureBlock/{index_module.css → index.css} +5 -6
- package/runtime/components/SignatureBlock/index.js +30 -29
- package/runtime/components/SignatureBlock/index.module.js +9 -6
- package/runtime/components/SignatureCode/{index_module.css → index.css} +9 -10
- package/runtime/components/SignatureCode/index.js +40 -32
- package/runtime/components/SignatureCode/index.module.js +9 -6
- package/runtime/components/SignatureToolbar/{index_module.css → index.css} +18 -20
- package/runtime/components/SignatureToolbar/index.js +48 -51
- package/runtime/components/SignatureToolbar/index.module.js +13 -10
- package/runtime/components/buttons/ButtonGroup.js +13 -6
- package/runtime/components/buttons/CopyCodeButton.js +40 -38
- package/runtime/components/buttons/WrapSignatureButton.js +20 -16
- package/runtime/components/buttons/{index_module.css → index.css} +5 -6
- package/runtime/components/buttons/index.module.js +8 -5
- package/runtime/components/icons/CheckIcon/index.js +20 -17
- package/runtime/components/icons/CopyIcon/index.js +20 -17
- package/runtime/components/icons/UnwrapIcon/index.js +22 -18
- package/runtime/components/icons/WrapIcon/index.js +20 -17
- package/runtime/components/shared/_twoslash.css +3 -10
- package/runtime/components/shared/variables.css +0 -3
- package/runtime/hooks/useWrapToggle.js +32 -9
- package/runtime/index.d.ts +513 -173
- package/runtime/index.js +11 -9
- package/runtime/utils/decode-hast.js +31 -16
- package/runtime/utils/hast-renderer.js +21 -7
- package/schemas/config.js +199 -0
- package/schemas/index.js +5 -0
- package/schemas/opengraph.js +26 -0
- package/schemas/performance.js +19 -0
- package/serve.js +133 -0
- package/services/ConfigService.js +7 -0
- package/services/PathDerivationService.js +7 -0
- package/services/SnapshotService.js +7 -0
- package/services/TypeRegistryService.js +7 -0
- package/shiki-transformer.js +758 -0
- package/tsconfig-parser.js +127 -0
- package/tsdoc-metadata.json +11 -11
- package/twoslash-patterns.js +87 -0
- package/twoslash-transformer.js +316 -0
- package/type-reference-extractor.js +201 -0
- package/typescript-config.js +168 -0
- package/vfs-registry.js +121 -0
- package/0~llms-program.js +0 -344
- package/runtime/components/ApiLlmsPackageActions/index.module.js +0 -2
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import clsx from "clsx";
|
|
3
1
|
import { useWrapToggle } from "../../hooks/useWrapToggle.js";
|
|
4
2
|
import { WrapSignatureButton } from "../buttons/WrapSignatureButton.js";
|
|
5
3
|
import { SignatureCode } from "../SignatureCode/index.js";
|
|
6
4
|
import { SignatureToolbar } from "../SignatureToolbar/index.js";
|
|
7
|
-
import
|
|
5
|
+
import index_module_default from "./index.module.js";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import clsx from "clsx";
|
|
8
|
+
|
|
9
|
+
//#region src/runtime/components/MemberSignature/index.tsx
|
|
10
|
+
/**
|
|
11
|
+
* Interactive member signature block with h3 header and wrap button
|
|
12
|
+
* Displays syntax-highlighted TypeScript member signatures with hover tooltips
|
|
13
|
+
*/
|
|
8
14
|
function MemberSignature({ hast, memberName, id, summary, hasParameters = false }) {
|
|
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
|
-
onToggle: toggleWrap
|
|
38
|
-
})
|
|
39
|
-
}),
|
|
40
|
-
/*#__PURE__*/ jsx(SignatureCode, {
|
|
41
|
-
hast: hast,
|
|
42
|
-
wrapped: wrapped
|
|
43
|
-
})
|
|
44
|
-
]
|
|
45
|
-
});
|
|
15
|
+
const { wrapped, toggleWrap } = useWrapToggle();
|
|
16
|
+
if (import.meta.env.SSG_MD) {
|
|
17
|
+
let signature = "";
|
|
18
|
+
if (hast) signature = extractTextFromHast(hast);
|
|
19
|
+
const lines = signature.split("\n").filter((line) => line.trim());
|
|
20
|
+
if (lines.length >= 2) signature = lines[1].trim();
|
|
21
|
+
let markdown = `### ${memberName}\n\n**Signature:** \`${signature}\``;
|
|
22
|
+
if (summary) markdown += `\n\n${summary}`;
|
|
23
|
+
return /* @__PURE__ */ jsx(Fragment, { children: markdown });
|
|
24
|
+
}
|
|
25
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
26
|
+
className: clsx(index_module_default.block, hasParameters && index_module_default.hasParameters),
|
|
27
|
+
children: [/* @__PURE__ */ jsx(SignatureToolbar, {
|
|
28
|
+
heading: {
|
|
29
|
+
text: memberName,
|
|
30
|
+
...id != null ? { id } : {},
|
|
31
|
+
level: "h3"
|
|
32
|
+
},
|
|
33
|
+
...summary != null ? { summary } : {},
|
|
34
|
+
buttons: /* @__PURE__ */ jsx(WrapSignatureButton, {
|
|
35
|
+
wrapped,
|
|
36
|
+
onToggle: toggleWrap
|
|
37
|
+
})
|
|
38
|
+
}), /* @__PURE__ */ jsx(SignatureCode, {
|
|
39
|
+
hast,
|
|
40
|
+
wrapped
|
|
41
|
+
})]
|
|
42
|
+
});
|
|
46
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Extract plain text from a HAST tree
|
|
46
|
+
*/
|
|
47
47
|
function extractTextFromHast(node) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
if ("value" in node && typeof node.value === "string") return node.value;
|
|
49
|
+
if ("children" in node && Array.isArray(node.children)) return node.children.map(extractTextFromHast).join("");
|
|
50
|
+
return "";
|
|
51
51
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
export { MemberSignature };
|
|
52
|
+
|
|
53
|
+
//#endregion
|
|
54
|
+
export { MemberSignature, MemberSignature as default };
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import './index.css';
|
|
2
|
+
//#region src/runtime/components/MemberSignature/index.module.css
|
|
3
|
+
var index_module_default = {
|
|
4
|
+
"block": "gRiZQa_block",
|
|
5
|
+
"hasParameters": "gRiZQa_hasParameters",
|
|
6
|
+
"rpDark": "gRiZQa_rp-dark"
|
|
6
7
|
};
|
|
7
|
-
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
export { index_module_default as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.
|
|
1
|
+
.NDYkiG_table {
|
|
2
2
|
border: 1px solid var(--api-color-border);
|
|
3
3
|
border-radius: 0 0 var(--api-border-radius) var(--api-border-radius);
|
|
4
4
|
border-top: none;
|
|
@@ -7,16 +7,16 @@
|
|
|
7
7
|
overflow: hidden;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
html.
|
|
10
|
+
html.NDYkiG_rp-dark .NDYkiG_table {
|
|
11
11
|
border-color: var(--api-color-border);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
.
|
|
14
|
+
.NDYkiG_scroll {
|
|
15
15
|
-webkit-overflow-scrolling: touch;
|
|
16
16
|
overflow-x: auto;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
.
|
|
19
|
+
.NDYkiG_table table {
|
|
20
20
|
border-collapse: collapse;
|
|
21
21
|
width: 100%;
|
|
22
22
|
font-size: var(--api-font-size-base);
|
|
@@ -25,12 +25,12 @@ html.rp-dark-MFxhEo .table-wOupSX {
|
|
|
25
25
|
margin: 0;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
.
|
|
28
|
+
.NDYkiG_table thead {
|
|
29
29
|
background-color: var(--api-color-bg);
|
|
30
30
|
border-bottom: 1px solid var(--api-color-border);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
.
|
|
33
|
+
.NDYkiG_table th {
|
|
34
34
|
padding: var(--api-spacing-md) var(--api-spacing-lg);
|
|
35
35
|
text-align: left;
|
|
36
36
|
color: var(--api-color-text);
|
|
@@ -38,67 +38,66 @@ html.rp-dark-MFxhEo .table-wOupSX {
|
|
|
38
38
|
font-weight: 600;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
.
|
|
41
|
+
.NDYkiG_table th:first-child {
|
|
42
42
|
width: 20%;
|
|
43
43
|
min-width: 120px;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
.
|
|
46
|
+
.NDYkiG_table th:nth-child(2) {
|
|
47
47
|
width: 30%;
|
|
48
48
|
min-width: 150px;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
.
|
|
51
|
+
.NDYkiG_table th:last-child {
|
|
52
52
|
width: 50%;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
.
|
|
55
|
+
.NDYkiG_table td {
|
|
56
56
|
padding: var(--api-spacing-md) var(--api-spacing-lg);
|
|
57
57
|
border-top: 1px solid var(--api-color-border);
|
|
58
58
|
vertical-align: top;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
.
|
|
61
|
+
.NDYkiG_table td:first-child {
|
|
62
62
|
width: 20%;
|
|
63
63
|
min-width: 120px;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
.
|
|
66
|
+
.NDYkiG_table td:nth-child(2) {
|
|
67
67
|
width: 30%;
|
|
68
68
|
min-width: 150px;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
.
|
|
71
|
+
.NDYkiG_table td:last-child {
|
|
72
72
|
width: 50%;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
.
|
|
75
|
+
.NDYkiG_table td code, .NDYkiG_table th code {
|
|
76
76
|
font-size: var(--api-font-size-sm);
|
|
77
77
|
background-color: var(--api-color-code-bg);
|
|
78
78
|
border-radius: var(--api-border-radius-sm);
|
|
79
79
|
padding: .125rem .375rem;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
.
|
|
82
|
+
.NDYkiG_table td:last-child p:first-child {
|
|
83
83
|
margin-top: 0;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
.
|
|
86
|
+
.NDYkiG_table td:last-child p:last-child, .NDYkiG_table td:last-child ul:last-child, .NDYkiG_table td:last-child ol:last-child {
|
|
87
87
|
margin-bottom: 0;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
@media (width <= 768px) {
|
|
91
|
-
.
|
|
91
|
+
.NDYkiG_table td, .NDYkiG_table th {
|
|
92
92
|
padding: var(--api-spacing-sm) var(--api-spacing-md);
|
|
93
93
|
font-size: var(--api-font-size-sm);
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
.
|
|
96
|
+
.NDYkiG_table td:first-child, .NDYkiG_table th:first-child {
|
|
97
97
|
min-width: 100px;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
.
|
|
100
|
+
.NDYkiG_table td:nth-child(2), .NDYkiG_table th:nth-child(2) {
|
|
101
101
|
min-width: 120px;
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
|
|
@@ -1,69 +1,38 @@
|
|
|
1
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
1
|
import { MarkdownContent } from "../MarkdownContent/index.js";
|
|
3
|
-
import
|
|
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
|
-
children: "Description"
|
|
37
|
-
})
|
|
38
|
-
]
|
|
39
|
-
})
|
|
40
|
-
}),
|
|
41
|
-
/*#__PURE__*/ jsx("tbody", {
|
|
42
|
-
children: parameters.map((param)=>/*#__PURE__*/ jsxs("tr", {
|
|
43
|
-
children: [
|
|
44
|
-
/*#__PURE__*/ jsx("td", {
|
|
45
|
-
children: /*#__PURE__*/ jsx("code", {
|
|
46
|
-
children: param.name
|
|
47
|
-
})
|
|
48
|
-
}),
|
|
49
|
-
/*#__PURE__*/ jsx("td", {
|
|
50
|
-
children: param.type && /*#__PURE__*/ jsx("code", {
|
|
51
|
-
children: param.type
|
|
52
|
-
})
|
|
53
|
-
}),
|
|
54
|
-
/*#__PURE__*/ jsx("td", {
|
|
55
|
-
children: /*#__PURE__*/ jsx(MarkdownContent, {
|
|
56
|
-
children: param.description
|
|
57
|
-
})
|
|
58
|
-
})
|
|
59
|
-
]
|
|
60
|
-
}, param.name))
|
|
61
|
-
})
|
|
62
|
-
]
|
|
63
|
-
})
|
|
64
|
-
})
|
|
65
|
-
});
|
|
2
|
+
import index_module_default from "./index.module.js";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/runtime/components/ParametersTable/index.tsx
|
|
6
|
+
const ParametersTable = ({ parameters }) => {
|
|
7
|
+
if (!parameters || parameters.length === 0) return null;
|
|
8
|
+
if (import.meta.env.SSG_MD) {
|
|
9
|
+
let markdown = "#### Parameters\n\n";
|
|
10
|
+
markdown += "| Name | Type | Description |\n";
|
|
11
|
+
markdown += "|------|------|-------------|\n";
|
|
12
|
+
for (const param of parameters) {
|
|
13
|
+
const name = `\`${param.name}\``;
|
|
14
|
+
const type = param.type ? `\`${param.type}\`` : "";
|
|
15
|
+
const description = param.description.replace(/<[^>]*>/g, "").trim();
|
|
16
|
+
markdown += `| ${name} | ${type} | ${description} |\n`;
|
|
17
|
+
}
|
|
18
|
+
return /* @__PURE__ */ jsx(Fragment, { children: markdown });
|
|
19
|
+
}
|
|
20
|
+
return /* @__PURE__ */ jsx("div", {
|
|
21
|
+
className: index_module_default.table,
|
|
22
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
23
|
+
className: index_module_default.scroll,
|
|
24
|
+
children: /* @__PURE__ */ jsxs("table", { children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
25
|
+
/* @__PURE__ */ jsx("th", { children: "Parameter" }),
|
|
26
|
+
/* @__PURE__ */ jsx("th", { children: "Type" }),
|
|
27
|
+
/* @__PURE__ */ jsx("th", { children: "Description" })
|
|
28
|
+
] }) }), /* @__PURE__ */ jsx("tbody", { children: parameters.map((param) => /* @__PURE__ */ jsxs("tr", { children: [
|
|
29
|
+
/* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsx("code", { children: param.name }) }),
|
|
30
|
+
/* @__PURE__ */ jsx("td", { children: param.type && /* @__PURE__ */ jsx("code", { children: param.type }) }),
|
|
31
|
+
/* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsx(MarkdownContent, { children: param.description }) })
|
|
32
|
+
] }, param.name)) })] })
|
|
33
|
+
})
|
|
34
|
+
});
|
|
66
35
|
};
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
export { ParametersTable };
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
export { ParametersTable, ParametersTable as default };
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import './index.css';
|
|
2
|
+
//#region src/runtime/components/ParametersTable/index.module.css
|
|
3
|
+
var index_module_default = {
|
|
4
|
+
"rpDark": "NDYkiG_rp-dark",
|
|
5
|
+
"scroll": "NDYkiG_scroll",
|
|
6
|
+
"table": "NDYkiG_table"
|
|
6
7
|
};
|
|
7
|
-
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
export { index_module_default as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.
|
|
1
|
+
.L_PAPG_block {
|
|
2
2
|
margin: var(--api-spacing-xl) 0;
|
|
3
3
|
border-radius: var(--api-border-radius);
|
|
4
4
|
border: 1px solid var(--api-color-border);
|
|
@@ -6,22 +6,21 @@
|
|
|
6
6
|
overflow: visible;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
html.
|
|
9
|
+
html.L_PAPG_rp-dark .L_PAPG_block {
|
|
10
10
|
border-color: var(--api-color-border);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
.
|
|
13
|
+
.L_PAPG_hasParameters {
|
|
14
14
|
border-bottom-right-radius: 0;
|
|
15
15
|
border-bottom-left-radius: 0;
|
|
16
16
|
margin-bottom: 0;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
.
|
|
19
|
+
.L_PAPG_hasParameters .api-signature-code {
|
|
20
20
|
border-bottom-right-radius: 0;
|
|
21
21
|
border-bottom-left-radius: 0;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
.
|
|
24
|
+
.L_PAPG_hasParameters .api-signature-code pre {
|
|
25
25
|
border-radius: 0;
|
|
26
26
|
}
|
|
27
|
-
|
|
@@ -1,35 +1,36 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import clsx from "clsx";
|
|
3
1
|
import { useWrapToggle } from "../../hooks/useWrapToggle.js";
|
|
4
2
|
import { WrapSignatureButton } from "../buttons/WrapSignatureButton.js";
|
|
5
3
|
import { SignatureCode } from "../SignatureCode/index.js";
|
|
6
4
|
import { SignatureToolbar } from "../SignatureToolbar/index.js";
|
|
7
|
-
import
|
|
5
|
+
import index_module_default from "./index.module.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import clsx from "clsx";
|
|
8
|
+
|
|
9
|
+
//#region src/runtime/components/SignatureBlock/index.tsx
|
|
10
|
+
/**
|
|
11
|
+
* Interactive signature block with wrap button
|
|
12
|
+
* Displays syntax-highlighted TypeScript signatures with hover tooltips
|
|
13
|
+
*/
|
|
8
14
|
function SignatureBlock({ hast, heading = "Signature", id = "signature", hasParameters = false }) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
hast: hast,
|
|
28
|
-
wrapped: wrapped
|
|
29
|
-
})
|
|
30
|
-
]
|
|
31
|
-
});
|
|
15
|
+
const { wrapped, toggleWrap } = useWrapToggle();
|
|
16
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
17
|
+
className: clsx(index_module_default.block, hasParameters && index_module_default.hasParameters),
|
|
18
|
+
children: [/* @__PURE__ */ jsx(SignatureToolbar, {
|
|
19
|
+
...heading && id ? { heading: {
|
|
20
|
+
text: heading,
|
|
21
|
+
id,
|
|
22
|
+
level: "h2"
|
|
23
|
+
} } : {},
|
|
24
|
+
buttons: /* @__PURE__ */ jsx(WrapSignatureButton, {
|
|
25
|
+
wrapped,
|
|
26
|
+
onToggle: toggleWrap
|
|
27
|
+
})
|
|
28
|
+
}), /* @__PURE__ */ jsx(SignatureCode, {
|
|
29
|
+
hast,
|
|
30
|
+
wrapped
|
|
31
|
+
})]
|
|
32
|
+
});
|
|
32
33
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
export { SignatureBlock };
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
export { SignatureBlock, SignatureBlock as default };
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import './index.css';
|
|
2
|
+
//#region src/runtime/components/SignatureBlock/index.module.css
|
|
3
|
+
var index_module_default = {
|
|
4
|
+
"block": "L_PAPG_block",
|
|
5
|
+
"hasParameters": "L_PAPG_hasParameters",
|
|
6
|
+
"rpDark": "L_PAPG_rp-dark"
|
|
6
7
|
};
|
|
7
|
-
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
export { index_module_default as default };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
.
|
|
1
|
+
.Ze8uHG_code {
|
|
2
2
|
border-bottom-left-radius: var(--api-border-radius);
|
|
3
3
|
border-bottom-right-radius: var(--api-border-radius);
|
|
4
4
|
position: relative;
|
|
5
5
|
container-type: inline-size;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
.
|
|
8
|
+
.Ze8uHG_code pre {
|
|
9
9
|
height: auto;
|
|
10
10
|
max-height: none;
|
|
11
11
|
padding: var(--api-spacing-lg);
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
overflow-x: auto;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
html.
|
|
18
|
+
html.Ze8uHG_rp-dark .Ze8uHG_code pre {
|
|
19
19
|
background-color: var(--shiki-dark-bg);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
.
|
|
22
|
+
.Ze8uHG_code code {
|
|
23
23
|
background-color: unset;
|
|
24
24
|
min-height: var(--api-font-size-md);
|
|
25
25
|
line-height: var(--api-line-height-base);
|
|
@@ -28,26 +28,25 @@ html.rp-dark-uV29jl .code-C94Xw8 pre {
|
|
|
28
28
|
display: flex;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
.
|
|
31
|
+
.Ze8uHG_code code span {
|
|
32
32
|
color: var(--shiki-light);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
html.
|
|
35
|
+
html.Ze8uHG_rp-dark .Ze8uHG_code code span {
|
|
36
36
|
color: var(--shiki-dark);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
.
|
|
39
|
+
.Ze8uHG_code .line {
|
|
40
40
|
background: none;
|
|
41
41
|
min-height: 1lh;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
.
|
|
44
|
+
.Ze8uHG_wrapped pre {
|
|
45
45
|
white-space: pre-wrap;
|
|
46
46
|
overflow-wrap: break-word;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
.
|
|
49
|
+
.Ze8uHG_wrapped code {
|
|
50
50
|
white-space: pre-wrap;
|
|
51
51
|
overflow-wrap: break-word;
|
|
52
52
|
}
|
|
53
|
-
|
|
@@ -1,36 +1,44 @@
|
|
|
1
|
+
import { hastToReact } from "../../utils/hast-renderer.js";
|
|
2
|
+
import index_module_default from "./index.module.js";
|
|
3
|
+
import { useEffect, useRef } from "react";
|
|
1
4
|
import { jsx } from "react/jsx-runtime";
|
|
2
5
|
import clsx from "clsx";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
|
|
7
|
+
//#region src/runtime/components/SignatureCode/index.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Code block for displaying syntax-highlighted signatures
|
|
10
|
+
* Supports wrapped and unwrapped states
|
|
11
|
+
* Uses HAST for safe rendering without dangerouslySetInnerHTML
|
|
12
|
+
*/
|
|
6
13
|
function SignatureCode({ hast, wrapped }) {
|
|
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
|
-
});
|
|
14
|
+
const containerRef = useRef(null);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
const container = containerRef.current;
|
|
17
|
+
if (!container) return;
|
|
18
|
+
const handleMouseOver = (e) => {
|
|
19
|
+
const hover = e.target.closest?.(".twoslash-hover");
|
|
20
|
+
if (!hover) return;
|
|
21
|
+
const popup = hover.querySelector(".twoslash-popup-container");
|
|
22
|
+
if (!popup) return;
|
|
23
|
+
const hoverRect = hover.getBoundingClientRect();
|
|
24
|
+
const containerWidth = container.getBoundingClientRect().width;
|
|
25
|
+
popup.style.setProperty("--popup-top", `${hoverRect.bottom + 4}px`);
|
|
26
|
+
popup.style.setProperty("--popup-left", `${hoverRect.left}px`);
|
|
27
|
+
popup.style.setProperty("--popup-max-width", `${containerWidth * .75}px`);
|
|
28
|
+
};
|
|
29
|
+
container.addEventListener("mouseover", handleMouseOver);
|
|
30
|
+
return () => container.removeEventListener("mouseover", handleMouseOver);
|
|
31
|
+
}, []);
|
|
32
|
+
if (!hast) return /* @__PURE__ */ jsx("div", {
|
|
33
|
+
ref: containerRef,
|
|
34
|
+
className: clsx(index_module_default.code, wrapped && index_module_default.wrapped)
|
|
35
|
+
});
|
|
36
|
+
return /* @__PURE__ */ jsx("div", {
|
|
37
|
+
ref: containerRef,
|
|
38
|
+
className: clsx("api-doc-code", index_module_default.code, wrapped && index_module_default.wrapped),
|
|
39
|
+
children: hastToReact(hast)
|
|
40
|
+
});
|
|
35
41
|
}
|
|
36
|
-
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
export { SignatureCode };
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import './index.css';
|
|
2
|
+
//#region src/runtime/components/SignatureCode/index.module.css
|
|
3
|
+
var index_module_default = {
|
|
4
|
+
"code": "Ze8uHG_code",
|
|
5
|
+
"rpDark": "Ze8uHG_rp-dark",
|
|
6
|
+
"wrapped": "Ze8uHG_wrapped"
|
|
6
7
|
};
|
|
7
|
-
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
export { index_module_default as default };
|