docusaurus-plugin-typedoc-api
Version:
Docusaurus plugin that provides source code API documentation powered by TypeDoc.
110 lines (108 loc) • 4.48 kB
JavaScript
'use strict';
const react = require('react');
const Link = require('@docusaurus/Link');
const useReflection = require('../hooks/useReflection.js');
const helpers = require('../utils/helpers.js');
const AnchorLink = require('./AnchorLink.js');
const Icon = require('./Icon.js');
const jsxRuntime = require('react/jsx-runtime');
const _interopDefault = e => e && e.__esModule ? e : {
default: e
};
const Link__default = /*#__PURE__*/_interopDefault(Link);
function IndexChild({
id
}) {
const reflection = useReflection.useRequiredReflection(id);
return /*#__PURE__*/jsxRuntime.jsx("li", {
children: /*#__PURE__*/jsxRuntime.jsxs(Link__default.default, {
className: "tsd-kind-icon",
to: reflection.permalink ?? `#${reflection.name}`,
children: [/*#__PURE__*/jsxRuntime.jsx(Icon.Icon, {
reflection: reflection
}), helpers.escapeMdx(reflection.name)]
})
});
}
function Index({
reflection
}) {
if (reflection.categories && reflection.categories.length > 0) {
return /*#__PURE__*/jsxRuntime.jsxs("section", {
className: "tsd-panel-group tsd-index-group",
children: [/*#__PURE__*/jsxRuntime.jsxs("h2", {
children: ["Index ", /*#__PURE__*/jsxRuntime.jsx(AnchorLink.AnchorLink, {
id: "Index"
})]
}), /*#__PURE__*/jsxRuntime.jsx("section", {
className: "tsd-panel tsd-index-panel",
children: /*#__PURE__*/jsxRuntime.jsx("div", {
className: "tsd-index-content",
children: reflection.categories.map(category => /*#__PURE__*/jsxRuntime.jsxs("section", {
className: "tsd-index-section",
children: [/*#__PURE__*/jsxRuntime.jsx("h3", {
className: "tsd-panel-header",
children: category.title === '__CATEGORY__' ? 'Other' : category.title
}), /*#__PURE__*/jsxRuntime.jsx("div", {
className: "tsd-panel-content",
children: /*#__PURE__*/jsxRuntime.jsx("ul", {
className: "tsd-index-list",
children: category.children?.map(child => /*#__PURE__*/jsxRuntime.jsx(IndexChild, {
id: child
}, child))
})
})]
}, category.title))
})
})]
});
}
if (reflection.groups && reflection.groups.length > 0) {
return /*#__PURE__*/jsxRuntime.jsxs("section", {
className: "tsd-panel-group tsd-index-group",
children: [/*#__PURE__*/jsxRuntime.jsxs("h2", {
children: ["Index ", /*#__PURE__*/jsxRuntime.jsx(AnchorLink.AnchorLink, {
id: "Index"
})]
}), /*#__PURE__*/jsxRuntime.jsx("section", {
className: "tsd-panel tsd-index-panel",
children: /*#__PURE__*/jsxRuntime.jsx("div", {
className: "tsd-index-content",
children: reflection.groups.map(group => /*#__PURE__*/jsxRuntime.jsx("section", {
className: "tsd-index-section",
children: group.categories && group.categories.length > 0 ? group.categories.map(category => /*#__PURE__*/jsxRuntime.jsxs(react.Fragment, {
children: [/*#__PURE__*/jsxRuntime.jsx("h3", {
className: "tsd-panel-header",
children: category.title === '__CATEGORY__' ? group.title : category.title
}), /*#__PURE__*/jsxRuntime.jsx("div", {
className: "tsd-panel-content",
children: /*#__PURE__*/jsxRuntime.jsx("ul", {
className: "tsd-index-list",
children: category.children?.map(child => /*#__PURE__*/jsxRuntime.jsx(IndexChild, {
id: child
}, child))
})
})]
}, category.title)) : /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
children: [/*#__PURE__*/jsxRuntime.jsx("h3", {
className: "tsd-panel-header",
children: group.title
}), /*#__PURE__*/jsxRuntime.jsx("div", {
className: "tsd-panel-content",
children: /*#__PURE__*/jsxRuntime.jsx("ul", {
className: "tsd-index-list",
children: group.children?.map(child => /*#__PURE__*/jsxRuntime.jsx(IndexChild, {
id: child
}, child))
})
})]
})
}, group.title))
})
})]
});
}
return null;
}
exports.Index = Index;
//# sourceMappingURL=Index.js.map