@d-fischer/documen.ts 0.16.3 → 0.16.4
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/lib/common/components/Badge.js +1 -1
- package/lib/common/components/Badge.js.map +1 -1
- package/lib/common/components/BetaNotice.js +1 -1
- package/lib/common/components/BetaNotice.js.map +1 -1
- package/lib/common/components/Button.js +2 -2
- package/lib/common/components/Button.js.map +1 -1
- package/lib/common/components/CodeBlock.js +1 -1
- package/lib/common/components/CodeBlock.js.map +1 -1
- package/lib/common/components/CodeLink.js +4 -4
- package/lib/common/components/CodeLink.js.map +1 -1
- package/lib/common/components/DeprecationNotice.js +1 -1
- package/lib/common/components/DeprecationNotice.js.map +1 -1
- package/lib/common/components/FunctionParamDesc.js +1 -1
- package/lib/common/components/FunctionParamDesc.js.map +1 -1
- package/lib/common/components/FunctionParamDescEntry.js +13 -9
- package/lib/common/components/FunctionParamDescEntry.js.map +1 -1
- package/lib/common/components/FunctionReturnType.js +1 -1
- package/lib/common/components/FunctionReturnType.js.map +1 -1
- package/lib/common/components/FunctionSignature.js +1 -1
- package/lib/common/components/FunctionSignature.js.map +1 -1
- package/lib/common/components/InterfaceRepresentation.js +5 -3
- package/lib/common/components/InterfaceRepresentation.js.map +1 -1
- package/lib/common/components/MainMenu.js +2 -2
- package/lib/common/components/MainMenu.js.map +1 -1
- package/lib/common/components/NavMenu.js +3 -3
- package/lib/common/components/NavMenu.js.map +1 -1
- package/lib/common/components/NavMenuGroup.js +2 -2
- package/lib/common/components/NavMenuGroup.js.map +1 -1
- package/lib/common/components/NavMenuItem.js +1 -1
- package/lib/common/components/NavMenuItem.js.map +1 -1
- package/lib/common/components/TypeAliasHint.js +2 -2
- package/lib/common/components/TypeAliasHint.js.map +1 -1
- package/lib/common/components/TypeLink.js +2 -2
- package/lib/common/components/TypeLink.js.map +1 -1
- package/lib/common/components/VersionMenu.js +1 -1
- package/lib/common/components/VersionMenu.js.map +1 -1
- package/lib/common/components/cards/CardToolbar.js +5 -5
- package/lib/common/components/cards/CardToolbar.js.map +1 -1
- package/lib/common/components/cards/EventCard.js +1 -1
- package/lib/common/components/cards/EventCard.js.map +1 -1
- package/lib/common/components/cards/FunctionCardHeader.js +1 -1
- package/lib/common/components/cards/FunctionCardHeader.js.map +1 -1
- package/lib/common/components/cards/MethodCard.js +1 -1
- package/lib/common/components/cards/MethodCard.js.map +1 -1
- package/lib/common/components/cards/PropertyCard.js +1 -1
- package/lib/common/components/cards/PropertyCard.js.map +1 -1
- package/lib/common/components/codeBuilders/ReferenceTypeView.js +3 -3
- package/lib/common/components/codeBuilders/ReferenceTypeView.js.map +1 -1
- package/lib/common/components/overviewTable/OverviewTable.js +6 -6
- package/lib/common/components/overviewTable/OverviewTable.js.map +1 -1
- package/lib/common/components/overviewTable/OverviewTableEntry.js +1 -1
- package/lib/common/components/overviewTable/OverviewTableEntry.js.map +1 -1
- package/lib/common/containers/Card.js +2 -2
- package/lib/common/containers/Card.js.map +1 -1
- package/lib/common/containers/PageContent.js +2 -2
- package/lib/common/containers/PageContent.js.map +1 -1
- package/lib/common/containers/PageHeader.js +2 -2
- package/lib/common/containers/PageHeader.js.map +1 -1
- package/lib/common/containers/ReferencePackageContainer.js +1 -1
- package/lib/common/containers/ReferencePackageContainer.js.map +1 -1
- package/lib/common/htmlRenderer/HtmlRenderer.js +5 -5
- package/lib/common/htmlRenderer/HtmlRenderer.js.map +1 -1
- package/lib/common/pages/DocPage.js +1 -1
- package/lib/common/pages/DocPage.js.map +1 -1
- package/lib/common/pages/InterfacePage.js +1 -1
- package/lib/common/pages/InterfacePage.js.map +1 -1
- package/lib/common/pages/TypeAliasPage.js +1 -1
- package/lib/common/pages/TypeAliasPage.js.map +1 -1
- package/lib/common/tools/markdown/MarkdownParser.js +6 -6
- package/lib/common/tools/markdown/MarkdownParser.js.map +1 -1
- package/package.json +7 -4
- package/src/common/components/Badge.tsx +2 -2
- package/src/common/components/BetaNotice.tsx +1 -1
- package/src/common/components/Button.tsx +27 -24
- package/src/common/components/CodeBlock.tsx +1 -1
- package/src/common/components/CodeLink.tsx +5 -5
- package/src/common/components/DeprecationNotice.tsx +2 -2
- package/src/common/components/FunctionParamDesc.tsx +1 -1
- package/src/common/components/FunctionParamDescEntry.tsx +75 -50
- package/src/common/components/FunctionReturnType.tsx +1 -1
- package/src/common/components/FunctionSignature.tsx +25 -15
- package/src/common/components/InterfaceRepresentation.tsx +61 -56
- package/src/common/components/MainMenu.tsx +2 -2
- package/src/common/components/NavMenu.tsx +12 -13
- package/src/common/components/NavMenuGroup.tsx +25 -24
- package/src/common/components/NavMenuItem.tsx +1 -1
- package/src/common/components/TypeAliasHint.tsx +2 -2
- package/src/common/components/TypeLink.tsx +17 -10
- package/src/common/components/VersionMenu.tsx +1 -1
- package/src/common/components/cards/CardToolbar.tsx +31 -24
- package/src/common/components/cards/EventCard.tsx +2 -2
- package/src/common/components/cards/FunctionCardHeader.tsx +1 -1
- package/src/common/components/cards/MethodCard.tsx +1 -1
- package/src/common/components/cards/PropertyCard.tsx +1 -1
- package/src/common/components/codeBuilders/ReferenceTypeView.tsx +4 -4
- package/src/common/components/overviewTable/OverviewTable.tsx +41 -25
- package/src/common/components/overviewTable/OverviewTableEntry.tsx +1 -1
- package/src/common/containers/Card.tsx +20 -17
- package/src/common/containers/PageContent.tsx +14 -15
- package/src/common/containers/PageHeader.tsx +22 -23
- package/src/common/containers/ReferencePackageContainer.tsx +1 -1
- package/src/common/htmlRenderer/HtmlRenderer.tsx +7 -7
- package/src/common/pages/DocPage.tsx +28 -14
- package/src/common/pages/InterfacePage.tsx +1 -1
- package/src/common/pages/TypeAliasPage.tsx +1 -1
- package/src/common/theme.ts +1 -1
- package/src/common/tools/markdown/MarkdownParser.tsx +100 -73
- package/src/dev/index.tsx +1 -1
- package/src/progressiveEnhancement/index.tsx +7 -9
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { makeStyles } from '@mui/styles';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
-
import
|
|
3
|
+
import React from 'react';
|
|
4
4
|
|
|
5
5
|
type ButtonStyle = 'primary';
|
|
6
6
|
|
|
@@ -12,30 +12,33 @@ interface ButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>
|
|
|
12
12
|
onClick: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
const useStyles = makeStyles(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
transition: 'background-color .3s ease-in-out, border-color .3s ease-in-out',
|
|
29
|
-
backgroundColor: theme.colors.accent.default,
|
|
30
|
-
borderColor: theme.colors.accent.default,
|
|
31
|
-
|
|
32
|
-
'&:hover, &:active, &:focus': {
|
|
15
|
+
const useStyles = makeStyles(
|
|
16
|
+
theme => ({
|
|
17
|
+
root: {
|
|
18
|
+
display: 'inline-block',
|
|
19
|
+
padding: '.4em .8em',
|
|
20
|
+
borderRadius: 5,
|
|
21
|
+
cursor: 'pointer'
|
|
22
|
+
},
|
|
23
|
+
rootSmall: {
|
|
24
|
+
padding: 1,
|
|
25
|
+
borderRadius: 5
|
|
26
|
+
},
|
|
27
|
+
rootPrimary: {
|
|
33
28
|
color: 'white',
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
transition: 'background-color .3s ease-in-out, border-color .3s ease-in-out',
|
|
30
|
+
backgroundColor: theme.colors.accent.default,
|
|
31
|
+
borderColor: theme.colors.accent.default,
|
|
32
|
+
|
|
33
|
+
'&:hover, &:active, &:focus': {
|
|
34
|
+
color: 'white',
|
|
35
|
+
backgroundColor: theme.colors.accent.focus,
|
|
36
|
+
borderColor: theme.colors.accent.focus
|
|
37
|
+
}
|
|
36
38
|
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
+
}),
|
|
40
|
+
{ name: 'Button' }
|
|
41
|
+
);
|
|
39
42
|
|
|
40
43
|
const Button: React.FC<ButtonProps> = ({ className, type, small, ...props }) => {
|
|
41
44
|
const classes = useStyles();
|
|
@@ -3,7 +3,7 @@ import jsHighlight from '@d-fischer/react-syntax-highlighter/dist/esm/languages/
|
|
|
3
3
|
import json from '@d-fischer/react-syntax-highlighter/dist/esm/languages/hljs/json';
|
|
4
4
|
import tsHighlight from '@d-fischer/react-syntax-highlighter/dist/esm/languages/hljs/typescript';
|
|
5
5
|
import darcula from '@d-fischer/react-syntax-highlighter/dist/esm/styles/hljs/darcula';
|
|
6
|
-
import { makeStyles } from '@
|
|
6
|
+
import { makeStyles } from '@mui/styles';
|
|
7
7
|
import { twoslasher } from '@typescript/twoslash';
|
|
8
8
|
import * as lzString from 'lz-string';
|
|
9
9
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React, { useContext } from 'react';
|
|
2
|
-
import type { CallSignatureReferenceNode, ConstructSignatureReferenceNode, ReferenceNode } from '../reference';
|
|
3
|
-
import { FontAwesomeIcon as Icon } from '@fortawesome/react-fontawesome';
|
|
4
1
|
import { faCode } from '@fortawesome/free-solid-svg-icons';
|
|
5
|
-
import {
|
|
2
|
+
import { FontAwesomeIcon as Icon } from '@fortawesome/react-fontawesome';
|
|
3
|
+
import { makeStyles } from '@mui/styles';
|
|
6
4
|
|
|
7
5
|
import classNames from 'classnames';
|
|
8
|
-
import {
|
|
6
|
+
import React, { useContext } from 'react';
|
|
7
|
+
import { ConfigContext } from '../config';
|
|
8
|
+
import type { CallSignatureReferenceNode, ConstructSignatureReferenceNode, ReferenceNode } from '../reference';
|
|
9
9
|
|
|
10
10
|
interface CodeLinkProps {
|
|
11
11
|
symbol: ReferenceNode;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { makeStyles } from '@mui/styles';
|
|
1
2
|
import React from 'react';
|
|
2
|
-
import { makeStyles } from '@material-ui/styles';
|
|
3
3
|
|
|
4
4
|
const useStyles = makeStyles(
|
|
5
5
|
theme => ({
|
|
@@ -17,7 +17,7 @@ const useStyles = makeStyles(
|
|
|
17
17
|
{ name: 'DeprecationNotice' }
|
|
18
18
|
);
|
|
19
19
|
|
|
20
|
-
const DeprecationNotice: React.FC
|
|
20
|
+
const DeprecationNotice: React.FC = ({ children }) => {
|
|
21
21
|
const classes = useStyles();
|
|
22
22
|
return (
|
|
23
23
|
<div className={classes.root}>
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { faCheck } from '@fortawesome/free-solid-svg-icons';
|
|
2
2
|
import { FontAwesomeIcon as Icon } from '@fortawesome/react-fontawesome';
|
|
3
|
-
import { makeStyles } from '@
|
|
3
|
+
import { makeStyles } from '@mui/styles';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import type {
|
|
6
6
|
CallSignatureReferenceNode,
|
|
7
|
-
ConstructorReferenceNode,
|
|
7
|
+
ConstructorReferenceNode,
|
|
8
|
+
ConstructSignatureReferenceNode,
|
|
8
9
|
FunctionReferenceNode,
|
|
9
10
|
MethodReferenceNode,
|
|
10
11
|
ParameterReferenceNode,
|
|
@@ -26,31 +27,43 @@ interface FunctionParamDescEntryProps {
|
|
|
26
27
|
paramNamePrefix?: string;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
const useStyles = makeStyles(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
const useStyles = makeStyles(
|
|
31
|
+
theme => ({
|
|
32
|
+
row: {
|
|
33
|
+
padding: theme.spacing.unit,
|
|
34
|
+
textAlign: 'center',
|
|
33
35
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
'& p': {
|
|
37
|
+
margin: 0,
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
'& + p': {
|
|
40
|
+
marginTop: theme.spacing.unit
|
|
41
|
+
}
|
|
39
42
|
}
|
|
43
|
+
},
|
|
44
|
+
checkMark: {
|
|
45
|
+
width: '1em'
|
|
40
46
|
}
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
}), { name: 'FunctionParamDescEntry' });
|
|
47
|
+
}),
|
|
48
|
+
{ name: 'FunctionParamDescEntry' }
|
|
49
|
+
);
|
|
46
50
|
|
|
47
|
-
const FunctionParamDescEntry: React.FC<FunctionParamDescEntryProps> = ({
|
|
51
|
+
const FunctionParamDescEntry: React.FC<FunctionParamDescEntryProps> = ({
|
|
52
|
+
param,
|
|
53
|
+
functionDefinition,
|
|
54
|
+
functionSignature,
|
|
55
|
+
isCallback,
|
|
56
|
+
expandParams,
|
|
57
|
+
paramNamePrefix = ''
|
|
58
|
+
}) => {
|
|
48
59
|
const classes = useStyles();
|
|
49
60
|
const shortDesc = param.comment?.shortText;
|
|
50
61
|
let desc = param.comment?.text;
|
|
51
62
|
|
|
52
63
|
if (!desc) {
|
|
53
|
-
const correctTag = (functionSignature?.comment ?? functionDefinition.comment)?.tags?.find(
|
|
64
|
+
const correctTag = (functionSignature?.comment ?? functionDefinition.comment)?.tags?.find(
|
|
65
|
+
tag => tag.tag === 'param' && tag.param === param.name
|
|
66
|
+
);
|
|
54
67
|
if (correctTag) {
|
|
55
68
|
desc = correctTag.text;
|
|
56
69
|
}
|
|
@@ -60,28 +73,16 @@ const FunctionParamDescEntry: React.FC<FunctionParamDescEntryProps> = ({ param,
|
|
|
60
73
|
expandParams ||= isNamedParams;
|
|
61
74
|
const paramName = `${paramNamePrefix}${isNamedParams ? 'params' : param.name}`;
|
|
62
75
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
63
|
-
const defaultValue = param.kind === 'property' ? undefined :
|
|
76
|
+
const defaultValue = param.kind === 'property' ? undefined : param.defaultValue || undefined;
|
|
64
77
|
|
|
65
78
|
const result: React.ReactNode[] = [];
|
|
66
79
|
|
|
67
80
|
if (param.type.type === 'reflection') {
|
|
68
|
-
result.push(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
functionSignature={functionSignature}
|
|
74
|
-
isCallback={isCallback}
|
|
75
|
-
expandParams={expandParams}
|
|
76
|
-
paramNamePrefix={`${paramName}.`}
|
|
77
|
-
/>
|
|
78
|
-
)));
|
|
79
|
-
} else if (param.type.type === 'reference' && param.type.id && expandParams) {
|
|
80
|
-
const refDesc = findSymbolByMember('id', param.type.id);
|
|
81
|
-
if (refDesc) {
|
|
82
|
-
const { symbol: ref } = refDesc;
|
|
83
|
-
if (ref.kind === 'interface' && !hasTag(ref, 'neverExpand')) {
|
|
84
|
-
result.push(...getChildren(ref).filter((c): c is PropertyReferenceNode => c.kind === 'property').sort(defaultNodeSort).map(subParam => (
|
|
81
|
+
result.push(
|
|
82
|
+
...getChildren(param.type.declaration)
|
|
83
|
+
.filter((c): c is VariableReferenceNode => c.kind === 'variable')
|
|
84
|
+
.sort(defaultNodeSort)
|
|
85
|
+
.map(subParam => (
|
|
85
86
|
<FunctionParamDescEntry
|
|
86
87
|
key={`${paramName}.${subParam.name}`}
|
|
87
88
|
param={subParam}
|
|
@@ -91,7 +92,29 @@ const FunctionParamDescEntry: React.FC<FunctionParamDescEntryProps> = ({ param,
|
|
|
91
92
|
expandParams={expandParams}
|
|
92
93
|
paramNamePrefix={`${paramName}.`}
|
|
93
94
|
/>
|
|
94
|
-
))
|
|
95
|
+
))
|
|
96
|
+
);
|
|
97
|
+
} else if (param.type.type === 'reference' && param.type.id && expandParams) {
|
|
98
|
+
const refDesc = findSymbolByMember('id', param.type.id);
|
|
99
|
+
if (refDesc) {
|
|
100
|
+
const { symbol: ref } = refDesc;
|
|
101
|
+
if (ref.kind === 'interface' && !hasTag(ref, 'neverExpand')) {
|
|
102
|
+
result.push(
|
|
103
|
+
...getChildren(ref)
|
|
104
|
+
.filter((c): c is PropertyReferenceNode => c.kind === 'property')
|
|
105
|
+
.sort(defaultNodeSort)
|
|
106
|
+
.map(subParam => (
|
|
107
|
+
<FunctionParamDescEntry
|
|
108
|
+
key={`${paramName}.${subParam.name}`}
|
|
109
|
+
param={subParam}
|
|
110
|
+
functionDefinition={functionDefinition}
|
|
111
|
+
functionSignature={functionSignature}
|
|
112
|
+
isCallback={isCallback}
|
|
113
|
+
expandParams={expandParams}
|
|
114
|
+
paramNamePrefix={`${paramName}.`}
|
|
115
|
+
/>
|
|
116
|
+
))
|
|
117
|
+
);
|
|
95
118
|
}
|
|
96
119
|
}
|
|
97
120
|
}
|
|
@@ -100,27 +123,29 @@ const FunctionParamDescEntry: React.FC<FunctionParamDescEntryProps> = ({ param,
|
|
|
100
123
|
<tr key={paramName}>
|
|
101
124
|
<td className={classes.row}>{paramName}</td>
|
|
102
125
|
<td className={classes.row}>
|
|
103
|
-
<Type def={param.type} ignoreUndefined={param.kind !== 'parameter' || param.flags?.isOptional}/>
|
|
126
|
+
<Type def={param.type} ignoreUndefined={param.kind !== 'parameter' || param.flags?.isOptional} />
|
|
104
127
|
</td>
|
|
105
128
|
{isCallback ? null : (
|
|
106
129
|
<>
|
|
107
|
-
<td className={classes.row}>
|
|
108
|
-
param.flags?.isOptional || defaultValue || isOptionalType(param.type)
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
130
|
+
<td className={classes.row}>
|
|
131
|
+
{param.flags?.isOptional || defaultValue || isOptionalType(param.type) ? (
|
|
132
|
+
''
|
|
133
|
+
) : (
|
|
134
|
+
<Icon className={classes.checkMark} icon={faCheck} />
|
|
135
|
+
)}
|
|
136
|
+
</td>
|
|
112
137
|
<td className={classes.row}>{defaultValue ?? <em>none</em>}</td>
|
|
113
138
|
</>
|
|
114
139
|
)}
|
|
115
140
|
<td className={classes.row}>
|
|
116
|
-
{
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
141
|
+
{shortDesc || desc ? (
|
|
142
|
+
<>
|
|
143
|
+
{shortDesc ? <MarkdownParser source={shortDesc} /> : null}
|
|
144
|
+
{desc ? <MarkdownParser source={desc} /> : null}
|
|
145
|
+
</>
|
|
146
|
+
) : (
|
|
147
|
+
<em>{result.length ? 'see below' : 'none'}</em>
|
|
148
|
+
)}
|
|
124
149
|
</td>
|
|
125
150
|
</tr>
|
|
126
151
|
);
|
|
@@ -1,19 +1,27 @@
|
|
|
1
|
-
import { makeStyles } from '@
|
|
1
|
+
import { makeStyles } from '@mui/styles';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import type {
|
|
3
|
+
import type {
|
|
4
|
+
CallSignatureReferenceNode,
|
|
5
|
+
ClassReferenceNode,
|
|
6
|
+
ConstructSignatureReferenceNode,
|
|
7
|
+
InterfaceReferenceNode
|
|
8
|
+
} from '../reference';
|
|
4
9
|
|
|
5
10
|
interface FunctionSignatureProps {
|
|
6
11
|
signature: CallSignatureReferenceNode | ConstructSignatureReferenceNode;
|
|
7
12
|
parent?: ClassReferenceNode | InterfaceReferenceNode;
|
|
8
13
|
}
|
|
9
14
|
|
|
10
|
-
const useStyles = makeStyles(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
15
|
+
const useStyles = makeStyles(
|
|
16
|
+
theme => ({
|
|
17
|
+
root: {
|
|
18
|
+
fontFamily: theme.fonts.code,
|
|
19
|
+
margin: '0 0 .5em',
|
|
20
|
+
display: 'inline-block'
|
|
21
|
+
}
|
|
22
|
+
}),
|
|
23
|
+
{ name: 'FunctionSignature' }
|
|
24
|
+
);
|
|
17
25
|
|
|
18
26
|
const FunctionSignature: React.FC<FunctionSignatureProps> = ({ signature, parent }) => {
|
|
19
27
|
const classes = useStyles();
|
|
@@ -39,12 +47,14 @@ const FunctionSignature: React.FC<FunctionSignatureProps> = ({ signature, parent
|
|
|
39
47
|
>
|
|
40
48
|
</>
|
|
41
49
|
)}
|
|
42
|
-
(
|
|
43
|
-
|
|
44
|
-
{
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
50
|
+
(
|
|
51
|
+
{signature.parameters.map((param, idx) => (
|
|
52
|
+
<React.Fragment key={param.name}>
|
|
53
|
+
{idx === 0 ? '' : ', '}
|
|
54
|
+
{/^__\d+$/.test(param.name) ? 'params' : param.name}
|
|
55
|
+
</React.Fragment>
|
|
56
|
+
))}
|
|
57
|
+
)
|
|
48
58
|
</h3>
|
|
49
59
|
);
|
|
50
60
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { makeStyles } from '@
|
|
1
|
+
import { makeStyles } from '@mui/styles';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { HashLink } from 'react-router-hash-link';
|
|
@@ -12,31 +12,34 @@ interface InterfaceRepresentationProps {
|
|
|
12
12
|
className?: string;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
const useStyles = makeStyles(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
15
|
+
const useStyles = makeStyles(
|
|
16
|
+
theme => ({
|
|
17
|
+
root: {
|
|
18
|
+
fontFamily: theme.fonts.code
|
|
19
|
+
},
|
|
20
|
+
prop: {
|
|
21
|
+
display: 'block',
|
|
22
|
+
marginLeft: '2em',
|
|
23
|
+
'& + $prop': {
|
|
24
|
+
marginTop: '.5em'
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
comment: {
|
|
28
|
+
color: '#808080',
|
|
29
|
+
fontSize: '.8em',
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
'&:before': {
|
|
32
|
+
content: '"// "',
|
|
33
|
+
display: 'inline'
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
name: {
|
|
37
|
+
color: '#9876AA',
|
|
38
|
+
textDecoration: 'none'
|
|
33
39
|
}
|
|
34
|
-
},
|
|
35
|
-
name:
|
|
36
|
-
|
|
37
|
-
textDecoration: 'none'
|
|
38
|
-
}
|
|
39
|
-
}), { name: 'InterfaceRepresentation' });
|
|
40
|
+
}),
|
|
41
|
+
{ name: 'InterfaceRepresentation' }
|
|
42
|
+
);
|
|
40
43
|
|
|
41
44
|
const InterfaceRepresentation: React.FC<InterfaceRepresentationProps> = ({ symbol, className }) => {
|
|
42
45
|
const classes = useStyles();
|
|
@@ -44,42 +47,44 @@ const InterfaceRepresentation: React.FC<InterfaceRepresentationProps> = ({ symbo
|
|
|
44
47
|
return (
|
|
45
48
|
<div className={classNames(classes.root, className)}>
|
|
46
49
|
{'{'}
|
|
47
|
-
{getChildren(symbol)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
{getChildren(symbol)
|
|
51
|
+
.sort(defaultNodeSort)
|
|
52
|
+
.map(member => {
|
|
53
|
+
if (member.kind === 'property') {
|
|
54
|
+
return (
|
|
55
|
+
<div key={member.name} className={classes.prop}>
|
|
56
|
+
{member.comment?.shortText ? (
|
|
57
|
+
<div className={classes.comment}>{member.comment.shortText}</div>
|
|
58
|
+
) : null}
|
|
59
|
+
<div>
|
|
60
|
+
<HashLink to={`#${member.name}`} className={classes.name}>
|
|
61
|
+
{member.name}
|
|
62
|
+
</HashLink>
|
|
63
|
+
{member.flags?.isOptional ? '?' : ''}
|
|
64
|
+
: <Type def={member.type} ignoreUndefined />
|
|
54
65
|
</div>
|
|
55
|
-
) : null}
|
|
56
|
-
<div>
|
|
57
|
-
<HashLink to={`#${member.name}`} className={classes.name}>{member.name}</HashLink>
|
|
58
|
-
{member.flags?.isOptional ? '?' : ''}
|
|
59
|
-
: <Type def={member.type} ignoreUndefined/>
|
|
60
66
|
</div>
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
if (member.kind === 'method') {
|
|
70
|
+
const sig = member.signatures![0];
|
|
71
|
+
return (
|
|
72
|
+
<div key={member.name} className={classes.prop}>
|
|
73
|
+
{sig.comment?.shortText ? (
|
|
74
|
+
<div className={classes.comment}>{sig.comment.shortText}</div>
|
|
75
|
+
) : null}
|
|
76
|
+
<div>
|
|
77
|
+
<HashLink to={`#${member.name}`} className={classes.name}>
|
|
78
|
+
{member.name}
|
|
79
|
+
</HashLink>
|
|
80
|
+
{member.flags?.isOptional ? '?' : ''}
|
|
81
|
+
(): <Type def={member.signatures![0].type} />
|
|
71
82
|
</div>
|
|
72
|
-
) : null}
|
|
73
|
-
<div>
|
|
74
|
-
<HashLink to={`#${member.name}`} className={classes.name}>{member.name}</HashLink>
|
|
75
|
-
{member.flags?.isOptional ? '?' : ''}
|
|
76
|
-
(): <Type def={member.signatures![0].type}/>
|
|
77
83
|
</div>
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
})}
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
return null;
|
|
87
|
+
})}
|
|
83
88
|
{'}'}
|
|
84
89
|
</div>
|
|
85
90
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { FontAwesomeIcon as Icon } from '@fortawesome/react-fontawesome';
|
|
2
1
|
import { faGithub } from '@fortawesome/free-brands-svg-icons';
|
|
3
|
-
import {
|
|
2
|
+
import { FontAwesomeIcon as Icon } from '@fortawesome/react-fontawesome';
|
|
3
|
+
import { makeStyles } from '@mui/styles';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
import React, { useContext, useMemo } from 'react';
|
|
6
6
|
import { NavLink, useLocation, useResolvedPath } from 'react-router-dom';
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { makeStyles } from '@mui/styles';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
-
import
|
|
3
|
+
import React from 'react';
|
|
4
4
|
|
|
5
|
-
const useStyles = makeStyles(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
5
|
+
const useStyles = makeStyles(
|
|
6
|
+
theme => ({
|
|
7
|
+
root: {
|
|
8
|
+
borderRight: `1px solid ${theme.colors.border}`,
|
|
9
|
+
minHeight: '100%'
|
|
10
|
+
}
|
|
11
|
+
}),
|
|
12
|
+
{ name: 'NavMenu' }
|
|
13
|
+
);
|
|
11
14
|
|
|
12
15
|
interface NavMenuProps {
|
|
13
16
|
className?: string;
|
|
@@ -15,11 +18,7 @@ interface NavMenuProps {
|
|
|
15
18
|
|
|
16
19
|
const NavMenu: React.FC<React.PropsWithChildren<NavMenuProps>> = ({ children, className }) => {
|
|
17
20
|
const classes = useStyles();
|
|
18
|
-
return (
|
|
19
|
-
<div className={classNames(classes.root, className)}>
|
|
20
|
-
{children}
|
|
21
|
-
</div>
|
|
22
|
-
);
|
|
21
|
+
return <div className={classNames(classes.root, className)}>{children}</div>;
|
|
23
22
|
};
|
|
24
23
|
|
|
25
24
|
export default NavMenu;
|
|
@@ -1,40 +1,41 @@
|
|
|
1
|
+
import { makeStyles } from '@mui/styles';
|
|
1
2
|
import React from 'react';
|
|
2
|
-
import { makeStyles } from '@material-ui/styles';
|
|
3
3
|
|
|
4
4
|
interface NavMenuGroupProps {
|
|
5
5
|
title: string;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
const useStyles = makeStyles(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
8
|
+
const useStyles = makeStyles(
|
|
9
|
+
({ colors: { text: textColor }, spacing: { unit: space } }) => ({
|
|
10
|
+
root: {
|
|
11
|
+
display: 'block',
|
|
12
|
+
color: textColor,
|
|
13
|
+
padding: `${space}px 0`
|
|
14
|
+
},
|
|
15
|
+
title: {
|
|
16
|
+
margin: 0,
|
|
17
|
+
padding: `${space / 2}px ${space}px ${space / 2}px ${space * 1.5}px`,
|
|
18
|
+
fontSize: '1.1em',
|
|
19
|
+
lineHeight: '1em',
|
|
20
|
+
height: '1em',
|
|
21
|
+
fontWeight: 'bold',
|
|
22
|
+
textTransform: 'uppercase'
|
|
23
|
+
},
|
|
24
|
+
items: {
|
|
25
|
+
'& > a': {
|
|
26
|
+
paddingLeft: space * 2.5
|
|
27
|
+
}
|
|
26
28
|
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
+
}),
|
|
30
|
+
{ name: 'NavMenuGroup' }
|
|
31
|
+
);
|
|
29
32
|
|
|
30
33
|
const NavMenuGroup: React.FC<React.PropsWithChildren<NavMenuGroupProps>> = ({ title, children }) => {
|
|
31
34
|
const classes = useStyles();
|
|
32
35
|
return (
|
|
33
36
|
<div className={classes.root}>
|
|
34
37
|
<h2 className={classes.title}>{title}</h2>
|
|
35
|
-
<div className={classes.items}>
|
|
36
|
-
{children}
|
|
37
|
-
</div>
|
|
38
|
+
<div className={classes.items}>{children}</div>
|
|
38
39
|
</div>
|
|
39
40
|
);
|
|
40
41
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { makeStyles } from '@mui/styles';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import type { TypeAliasReferenceNode } from '../reference';
|
|
3
|
-
import { makeStyles } from '@material-ui/styles';
|
|
4
|
-
import Type from './codeBuilders/Type';
|
|
5
4
|
import MarkdownParser from '../tools/markdown/MarkdownParser';
|
|
5
|
+
import Type from './codeBuilders/Type';
|
|
6
6
|
|
|
7
7
|
interface TypeAliasHintProps {
|
|
8
8
|
symbol: TypeAliasReferenceNode;
|