@d-fischer/documen.ts 0.16.2 → 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 +8 -5
- 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
- package/vite.config.dev.ts +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { makeStyles } from '@
|
|
1
|
+
import { makeStyles } from '@mui/styles';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import React, { useMemo } from 'react';
|
|
4
4
|
import ReactMarkdown from 'react-markdown';
|
|
@@ -12,94 +12,121 @@ interface MarkdownParserProps {
|
|
|
12
12
|
source: string;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
const useStyles = makeStyles(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
const useStyles = makeStyles(
|
|
16
|
+
theme => ({
|
|
17
|
+
root: {
|
|
18
|
+
'& table': {
|
|
19
|
+
borderCollapse: 'collapse'
|
|
20
|
+
},
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
'& th, & td': {
|
|
23
|
+
border: `1px solid ${theme.colors.border}`,
|
|
24
|
+
padding: theme.spacing.unit
|
|
25
|
+
},
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
'& li': {
|
|
28
|
+
margin: `${theme.spacing.unit * 2}px 0`,
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
'&::marker': {
|
|
31
|
+
color: '#647d0f'
|
|
32
|
+
}
|
|
31
33
|
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
transition: 'border-color .3s ease-in-out',
|
|
34
|
+
},
|
|
35
|
+
link: {
|
|
36
|
+
color: 'inherit',
|
|
37
|
+
fontWeight: 'bold',
|
|
38
|
+
textDecoration: 'none',
|
|
39
|
+
borderBottom: `1.5px solid ${theme.colors.accent.default}`,
|
|
40
|
+
transition: 'border-color .3s ease-in-out',
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
'&:hover': {
|
|
43
|
+
borderBottomColor: theme.colors.accent.focus
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
warning: {
|
|
47
|
+
display: 'flow-root',
|
|
48
|
+
borderLeft: `${theme.spacing.unit / 2}px solid ${theme.colors.warning}`,
|
|
49
|
+
backgroundColor: theme.colors.background.active,
|
|
50
|
+
marginBottom: '1em',
|
|
51
|
+
padding: '0 1em'
|
|
52
|
+
},
|
|
53
|
+
warningTitle: {
|
|
54
|
+
fontSize: '1em'
|
|
43
55
|
}
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
borderLeft: `${theme.spacing.unit / 2}px solid ${theme.colors.warning}`,
|
|
48
|
-
backgroundColor: theme.colors.background.active,
|
|
49
|
-
marginBottom: '1em',
|
|
50
|
-
padding: '0 1em'
|
|
51
|
-
},
|
|
52
|
-
warningTitle: {
|
|
53
|
-
fontSize: '1em',
|
|
54
|
-
}
|
|
55
|
-
}), { name: 'MarkdownParser' });
|
|
56
|
+
}),
|
|
57
|
+
{ name: 'MarkdownParser' }
|
|
58
|
+
);
|
|
56
59
|
|
|
57
60
|
const MarkdownParser: React.FC<MarkdownParserProps> = ({ source }) => {
|
|
58
61
|
const classes = useStyles();
|
|
59
62
|
|
|
60
|
-
const components = useMemo(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
const components = useMemo(
|
|
64
|
+
() => ({
|
|
65
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call */
|
|
66
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/naming-convention
|
|
67
|
+
a: function MdLink(mdProps: any) {
|
|
68
|
+
const props = {
|
|
69
|
+
key: mdProps.nodeKey,
|
|
70
|
+
className: mdProps.className
|
|
71
|
+
};
|
|
68
72
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
73
|
+
if (mdProps.href.startsWith('/')) {
|
|
74
|
+
return (
|
|
75
|
+
<HashLink {...props} className={classNames(props.className, classes.link)} to={mdProps.href}>
|
|
76
|
+
{mdProps.children}
|
|
77
|
+
</HashLink>
|
|
78
|
+
);
|
|
79
|
+
} else {
|
|
80
|
+
return (
|
|
81
|
+
<a className={classes.link} href={mdProps.href}>
|
|
82
|
+
{mdProps.children}
|
|
83
|
+
</a>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
},
|
|
83
87
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention,@typescript-eslint/no-explicit-any
|
|
89
|
+
code: function MdCodeBlock({ node, inline, className, children, ...props }: any) {
|
|
90
|
+
if (!inline) {
|
|
91
|
+
const match = /language-(\w+)/.exec(className || '');
|
|
92
|
+
if (match) {
|
|
93
|
+
return (
|
|
94
|
+
<CodeBlock
|
|
95
|
+
lang={match[1]}
|
|
96
|
+
langMeta={node.data?.meta.split(' ') ?? []}
|
|
97
|
+
text={String(children).trimEnd()}
|
|
98
|
+
/>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
90
101
|
}
|
|
102
|
+
return (
|
|
103
|
+
<code className={className} {...props}>
|
|
104
|
+
{children}
|
|
105
|
+
</code>
|
|
106
|
+
);
|
|
91
107
|
}
|
|
92
|
-
|
|
93
|
-
},
|
|
94
|
-
|
|
95
|
-
|
|
108
|
+
/* eslint-enable @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call */
|
|
109
|
+
}),
|
|
110
|
+
[classes]
|
|
111
|
+
);
|
|
96
112
|
|
|
97
|
-
const customDirectiveClasses = useMemo(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
113
|
+
const customDirectiveClasses = useMemo(
|
|
114
|
+
() => ({
|
|
115
|
+
warning: classes.warning,
|
|
116
|
+
warningTitle: classes.warningTitle
|
|
117
|
+
}),
|
|
118
|
+
[classes]
|
|
119
|
+
);
|
|
101
120
|
|
|
102
|
-
return
|
|
121
|
+
return (
|
|
122
|
+
<ReactMarkdown
|
|
123
|
+
className={classes.root}
|
|
124
|
+
remarkPlugins={[symbolLinks, gfmTables, [customDirectives, { classes: customDirectiveClasses }]]}
|
|
125
|
+
components={components}
|
|
126
|
+
>
|
|
127
|
+
{source}
|
|
128
|
+
</ReactMarkdown>
|
|
129
|
+
);
|
|
103
130
|
};
|
|
104
131
|
|
|
105
132
|
export default React.memo(MarkdownParser);
|
package/src/dev/index.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import { Light as SyntaxHighlighter } from '@d-fischer/react-syntax-highlighter'
|
|
|
2
2
|
import js from '@d-fischer/react-syntax-highlighter/dist/esm/languages/hljs/javascript';
|
|
3
3
|
import json from '@d-fischer/react-syntax-highlighter/dist/esm/languages/hljs/json';
|
|
4
4
|
import ts from '@d-fischer/react-syntax-highlighter/dist/esm/languages/hljs/typescript';
|
|
5
|
-
import { ThemeProvider } from '@
|
|
5
|
+
import { ThemeProvider } from '@mui/styles';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import ReactDOM from 'react-dom';
|
|
8
8
|
import { BrowserRouter, HashRouter } from 'react-router-dom';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createGenerateClassName, StylesProvider, ThemeProvider } from '@
|
|
1
|
+
import { createGenerateClassName, StylesProvider, ThemeProvider } from '@mui/styles';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import * as ReactDOM from 'react-dom';
|
|
4
4
|
import { CodeBlock } from '../common/components/CodeBlock';
|
|
@@ -8,7 +8,7 @@ import theme from '../common/theme';
|
|
|
8
8
|
const registeredComponents = {
|
|
9
9
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
10
10
|
CodeBlock,
|
|
11
|
-
VersionMenu
|
|
11
|
+
VersionMenu
|
|
12
12
|
/* eslint-enable @typescript-eslint/naming-convention */
|
|
13
13
|
};
|
|
14
14
|
|
|
@@ -21,13 +21,11 @@ for (const elem of document.querySelectorAll<HTMLElement>('[data-dynamic-compone
|
|
|
21
21
|
if (Component) {
|
|
22
22
|
const props = JSON.parse(elem.dataset.componentProps ?? '{}') as JSX.IntrinsicAttributes;
|
|
23
23
|
ReactDOM.render(
|
|
24
|
-
|
|
25
|
-
<
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
</StylesProvider>
|
|
30
|
-
),
|
|
24
|
+
<StylesProvider generateClassName={generateClassName}>
|
|
25
|
+
<ThemeProvider theme={theme}>
|
|
26
|
+
<Component {...props} />
|
|
27
|
+
</ThemeProvider>
|
|
28
|
+
</StylesProvider>,
|
|
31
29
|
elem
|
|
32
30
|
);
|
|
33
31
|
}
|
package/vite.config.dev.ts
CHANGED
|
@@ -63,7 +63,7 @@ export default defineConfig(async () => {
|
|
|
63
63
|
define: {
|
|
64
64
|
__DOCTS_REFERENCE: monoRefJson,
|
|
65
65
|
__DOCTS_CONFIG: JSON.stringify(generatorConfig),
|
|
66
|
-
__DOCTS_FSMAP: JSON.stringify([...fsMap.entries()])
|
|
66
|
+
__DOCTS_FSMAP: JSON.stringify([...fsMap.entries()]),
|
|
67
67
|
__DOCTS_MOCK_FS: mockFs ? JSON.stringify([...mockFs]) : 'null',
|
|
68
68
|
__DOCTS_PATHS: JSON.stringify({ projectBase: path.resolve('../twitch') }),
|
|
69
69
|
__DOCTS_COMPONENT_MODE: JSON.stringify('dynamic'),
|