UNPKG

docusaurus-plugin-typedoc-api

Version:

Docusaurus plugin that provides source code API documentation powered by TypeDoc.

136 lines (132 loc) 6.21 kB
'use strict'; const react = require('react'); const hierarchy = require('../utils/hierarchy.js'); const Comment = require('./Comment.js'); const CommentBadges = require('./CommentBadges.js'); const Hierarchy = require('./Hierarchy.js'); const Icon = require('./Icon.js'); const Index = require('./Index.js'); const Members = require('./Members.js'); const MemberSignatures = require('./MemberSignatures.js'); const Parameter = require('./Parameter.js'); const Type = require('./Type.js'); const TypeParameters = require('./TypeParameters.js'); const jsxRuntime = require('react/jsx-runtime'); // https://github.com/TypeStrong/typedoc-default-themes/blob/master/src/default/templates/reflection.hbs // eslint-disable-next-line complexity function Reflection({ reflection }) { const hierarchy$1 = react.useMemo(() => hierarchy.createHierarchy(reflection), [reflection]); return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [CommentBadges.isCommentWithModifiers(reflection.comment) && /*#__PURE__*/jsxRuntime.jsx(CommentBadges.CommentBadges, { comment: reflection.comment }), Comment.hasComment(reflection.comment) && /*#__PURE__*/jsxRuntime.jsx(Comment.Comment, { root: true, comment: reflection.comment }), 'typeParameter' in reflection && reflection.typeParameter && reflection.typeParameter.length > 0 && // Class reflection.kind !== 128 && /*#__PURE__*/jsxRuntime.jsxs("section", { className: "tsd-panel", children: [/*#__PURE__*/jsxRuntime.jsx("h3", { className: "tsd-panel-header", children: "Type parameters" }), /*#__PURE__*/jsxRuntime.jsx("div", { className: "tsd-panel-content", children: /*#__PURE__*/jsxRuntime.jsx(TypeParameters.TypeParameters, { params: reflection.typeParameter }) })] }), ('extendedBy' in reflection && reflection.extendedBy && reflection.extendedBy.length > 0 || 'extendedTypes' in reflection && reflection.extendedTypes && reflection.extendedTypes.length > 0) && /*#__PURE__*/jsxRuntime.jsxs("section", { className: "tsd-panel", children: [/*#__PURE__*/jsxRuntime.jsx("h3", { className: "tsd-panel-header", children: "Hierarchy" }), /*#__PURE__*/jsxRuntime.jsx("div", { className: "tsd-panel-content", children: /*#__PURE__*/jsxRuntime.jsx(Hierarchy.Hierarchy, { tree: hierarchy$1 }) })] }), 'implementedTypes' in reflection && reflection.implementedTypes && reflection.implementedTypes.length > 0 && /*#__PURE__*/jsxRuntime.jsxs("section", { className: "tsd-panel", children: [/*#__PURE__*/jsxRuntime.jsx("h3", { className: "tsd-panel-header", children: "Implements" }), /*#__PURE__*/jsxRuntime.jsx("div", { className: "tsd-panel-content", children: /*#__PURE__*/jsxRuntime.jsx("ul", { className: "tsd-hierarchy", children: reflection.implementedTypes.map((type, i) => /*#__PURE__*/jsxRuntime.jsx("li", { children: /*#__PURE__*/jsxRuntime.jsx(Type.Type, { type: type }) }, type.type + String(i))) }) })] }), 'implementedBy' in reflection && reflection.implementedBy && reflection.implementedBy.length > 0 && /*#__PURE__*/jsxRuntime.jsxs("section", { className: "tsd-panel", children: [/*#__PURE__*/jsxRuntime.jsx("h3", { className: "tsd-panel-header", children: "Implemented by" }), /*#__PURE__*/jsxRuntime.jsx("div", { className: "tsd-panel-content", children: /*#__PURE__*/jsxRuntime.jsx("ul", { className: "tsd-hierarchy", children: reflection.implementedBy.map((type, i) => /*#__PURE__*/jsxRuntime.jsx("li", { children: /*#__PURE__*/jsxRuntime.jsx(Type.Type, { type: type }) }, type.name + String(i))) }) })] }), 'signatures' in reflection && reflection.signatures && reflection.signatures.length > 0 && /*#__PURE__*/jsxRuntime.jsxs("section", { className: "tsd-panel", children: [/*#__PURE__*/jsxRuntime.jsx("h3", { className: "tsd-panel-header tsd-before-signature", children: "Callable" }), /*#__PURE__*/jsxRuntime.jsx("div", { className: "tsd-panel-content", children: /*#__PURE__*/jsxRuntime.jsx(MemberSignatures.MemberSignatures, { sigs: reflection.signatures }) })] }), 'indexSignature' in reflection && reflection.indexSignature && /*#__PURE__*/jsxRuntime.jsxs("section", { className: "tsd-panel", children: [/*#__PURE__*/jsxRuntime.jsx("h3", { className: "tsd-panel-header tsd-before-signature", children: "Indexable" }), /*#__PURE__*/jsxRuntime.jsxs("div", { className: "tsd-panel-content", children: [/*#__PURE__*/jsxRuntime.jsxs("div", { className: "tsd-signature tsd-kind-icon", children: [/*#__PURE__*/jsxRuntime.jsx(Icon.Icon, { reflection: reflection.indexSignature }), /*#__PURE__*/jsxRuntime.jsx("span", { className: "tsd-signature-symbol", children: "[" }), reflection.indexSignature.parameters?.map(param => /*#__PURE__*/jsxRuntime.jsxs("span", { children: [param.name, ': ', /*#__PURE__*/jsxRuntime.jsx(Type.Type, { type: param.type })] }, param.id)), /*#__PURE__*/jsxRuntime.jsx("span", { className: "tsd-signature-symbol", children: "]: " }), /*#__PURE__*/jsxRuntime.jsx(Type.Type, { type: reflection.indexSignature.type })] }), /*#__PURE__*/jsxRuntime.jsx(Comment.Comment, { comment: reflection.indexSignature.comment }), /*#__PURE__*/jsxRuntime.jsx(Parameter.Parameter, { param: Type.extractDeclarationFromType(reflection.indexSignature.type) })] })] }), /*#__PURE__*/jsxRuntime.jsx(Index.Index, { reflection: reflection }), /*#__PURE__*/jsxRuntime.jsx(Members.Members, { reflection: reflection })] }); } exports.Reflection = Reflection; //# sourceMappingURL=Reflection.js.map