@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.
Files changed (110) hide show
  1. package/lib/common/components/Badge.js +1 -1
  2. package/lib/common/components/Badge.js.map +1 -1
  3. package/lib/common/components/BetaNotice.js +1 -1
  4. package/lib/common/components/BetaNotice.js.map +1 -1
  5. package/lib/common/components/Button.js +2 -2
  6. package/lib/common/components/Button.js.map +1 -1
  7. package/lib/common/components/CodeBlock.js +1 -1
  8. package/lib/common/components/CodeBlock.js.map +1 -1
  9. package/lib/common/components/CodeLink.js +4 -4
  10. package/lib/common/components/CodeLink.js.map +1 -1
  11. package/lib/common/components/DeprecationNotice.js +1 -1
  12. package/lib/common/components/DeprecationNotice.js.map +1 -1
  13. package/lib/common/components/FunctionParamDesc.js +1 -1
  14. package/lib/common/components/FunctionParamDesc.js.map +1 -1
  15. package/lib/common/components/FunctionParamDescEntry.js +13 -9
  16. package/lib/common/components/FunctionParamDescEntry.js.map +1 -1
  17. package/lib/common/components/FunctionReturnType.js +1 -1
  18. package/lib/common/components/FunctionReturnType.js.map +1 -1
  19. package/lib/common/components/FunctionSignature.js +1 -1
  20. package/lib/common/components/FunctionSignature.js.map +1 -1
  21. package/lib/common/components/InterfaceRepresentation.js +5 -3
  22. package/lib/common/components/InterfaceRepresentation.js.map +1 -1
  23. package/lib/common/components/MainMenu.js +2 -2
  24. package/lib/common/components/MainMenu.js.map +1 -1
  25. package/lib/common/components/NavMenu.js +3 -3
  26. package/lib/common/components/NavMenu.js.map +1 -1
  27. package/lib/common/components/NavMenuGroup.js +2 -2
  28. package/lib/common/components/NavMenuGroup.js.map +1 -1
  29. package/lib/common/components/NavMenuItem.js +1 -1
  30. package/lib/common/components/NavMenuItem.js.map +1 -1
  31. package/lib/common/components/TypeAliasHint.js +2 -2
  32. package/lib/common/components/TypeAliasHint.js.map +1 -1
  33. package/lib/common/components/TypeLink.js +2 -2
  34. package/lib/common/components/TypeLink.js.map +1 -1
  35. package/lib/common/components/VersionMenu.js +1 -1
  36. package/lib/common/components/VersionMenu.js.map +1 -1
  37. package/lib/common/components/cards/CardToolbar.js +5 -5
  38. package/lib/common/components/cards/CardToolbar.js.map +1 -1
  39. package/lib/common/components/cards/EventCard.js +1 -1
  40. package/lib/common/components/cards/EventCard.js.map +1 -1
  41. package/lib/common/components/cards/FunctionCardHeader.js +1 -1
  42. package/lib/common/components/cards/FunctionCardHeader.js.map +1 -1
  43. package/lib/common/components/cards/MethodCard.js +1 -1
  44. package/lib/common/components/cards/MethodCard.js.map +1 -1
  45. package/lib/common/components/cards/PropertyCard.js +1 -1
  46. package/lib/common/components/cards/PropertyCard.js.map +1 -1
  47. package/lib/common/components/codeBuilders/ReferenceTypeView.js +3 -3
  48. package/lib/common/components/codeBuilders/ReferenceTypeView.js.map +1 -1
  49. package/lib/common/components/overviewTable/OverviewTable.js +6 -6
  50. package/lib/common/components/overviewTable/OverviewTable.js.map +1 -1
  51. package/lib/common/components/overviewTable/OverviewTableEntry.js +1 -1
  52. package/lib/common/components/overviewTable/OverviewTableEntry.js.map +1 -1
  53. package/lib/common/containers/Card.js +2 -2
  54. package/lib/common/containers/Card.js.map +1 -1
  55. package/lib/common/containers/PageContent.js +2 -2
  56. package/lib/common/containers/PageContent.js.map +1 -1
  57. package/lib/common/containers/PageHeader.js +2 -2
  58. package/lib/common/containers/PageHeader.js.map +1 -1
  59. package/lib/common/containers/ReferencePackageContainer.js +1 -1
  60. package/lib/common/containers/ReferencePackageContainer.js.map +1 -1
  61. package/lib/common/htmlRenderer/HtmlRenderer.js +5 -5
  62. package/lib/common/htmlRenderer/HtmlRenderer.js.map +1 -1
  63. package/lib/common/pages/DocPage.js +1 -1
  64. package/lib/common/pages/DocPage.js.map +1 -1
  65. package/lib/common/pages/InterfacePage.js +1 -1
  66. package/lib/common/pages/InterfacePage.js.map +1 -1
  67. package/lib/common/pages/TypeAliasPage.js +1 -1
  68. package/lib/common/pages/TypeAliasPage.js.map +1 -1
  69. package/lib/common/tools/markdown/MarkdownParser.js +6 -6
  70. package/lib/common/tools/markdown/MarkdownParser.js.map +1 -1
  71. package/package.json +8 -5
  72. package/src/common/components/Badge.tsx +2 -2
  73. package/src/common/components/BetaNotice.tsx +1 -1
  74. package/src/common/components/Button.tsx +27 -24
  75. package/src/common/components/CodeBlock.tsx +1 -1
  76. package/src/common/components/CodeLink.tsx +5 -5
  77. package/src/common/components/DeprecationNotice.tsx +2 -2
  78. package/src/common/components/FunctionParamDesc.tsx +1 -1
  79. package/src/common/components/FunctionParamDescEntry.tsx +75 -50
  80. package/src/common/components/FunctionReturnType.tsx +1 -1
  81. package/src/common/components/FunctionSignature.tsx +25 -15
  82. package/src/common/components/InterfaceRepresentation.tsx +61 -56
  83. package/src/common/components/MainMenu.tsx +2 -2
  84. package/src/common/components/NavMenu.tsx +12 -13
  85. package/src/common/components/NavMenuGroup.tsx +25 -24
  86. package/src/common/components/NavMenuItem.tsx +1 -1
  87. package/src/common/components/TypeAliasHint.tsx +2 -2
  88. package/src/common/components/TypeLink.tsx +17 -10
  89. package/src/common/components/VersionMenu.tsx +1 -1
  90. package/src/common/components/cards/CardToolbar.tsx +31 -24
  91. package/src/common/components/cards/EventCard.tsx +2 -2
  92. package/src/common/components/cards/FunctionCardHeader.tsx +1 -1
  93. package/src/common/components/cards/MethodCard.tsx +1 -1
  94. package/src/common/components/cards/PropertyCard.tsx +1 -1
  95. package/src/common/components/codeBuilders/ReferenceTypeView.tsx +4 -4
  96. package/src/common/components/overviewTable/OverviewTable.tsx +41 -25
  97. package/src/common/components/overviewTable/OverviewTableEntry.tsx +1 -1
  98. package/src/common/containers/Card.tsx +20 -17
  99. package/src/common/containers/PageContent.tsx +14 -15
  100. package/src/common/containers/PageHeader.tsx +22 -23
  101. package/src/common/containers/ReferencePackageContainer.tsx +1 -1
  102. package/src/common/htmlRenderer/HtmlRenderer.tsx +7 -7
  103. package/src/common/pages/DocPage.tsx +28 -14
  104. package/src/common/pages/InterfacePage.tsx +1 -1
  105. package/src/common/pages/TypeAliasPage.tsx +1 -1
  106. package/src/common/theme.ts +1 -1
  107. package/src/common/tools/markdown/MarkdownParser.tsx +100 -73
  108. package/src/dev/index.tsx +1 -1
  109. package/src/progressiveEnhancement/index.tsx +7 -9
  110. package/vite.config.dev.ts +1 -1
@@ -1,4 +1,4 @@
1
- import { makeStyles } from '@material-ui/styles';
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(theme => ({
16
- root: {
17
- '& table': {
18
- borderCollapse: 'collapse'
19
- },
15
+ const useStyles = makeStyles(
16
+ theme => ({
17
+ root: {
18
+ '& table': {
19
+ borderCollapse: 'collapse'
20
+ },
20
21
 
21
- '& th, & td': {
22
- border: `1px solid ${theme.colors.border}`,
23
- padding: theme.spacing.unit
24
- },
22
+ '& th, & td': {
23
+ border: `1px solid ${theme.colors.border}`,
24
+ padding: theme.spacing.unit
25
+ },
25
26
 
26
- '& li': {
27
- margin: `${theme.spacing.unit * 2}px 0`,
27
+ '& li': {
28
+ margin: `${theme.spacing.unit * 2}px 0`,
28
29
 
29
- '&::marker': {
30
- color: '#647d0f'
30
+ '&::marker': {
31
+ color: '#647d0f'
32
+ }
31
33
  }
32
- }
33
- },
34
- link: {
35
- color: 'inherit',
36
- fontWeight: 'bold',
37
- textDecoration: 'none',
38
- borderBottom: `1.5px solid ${theme.colors.accent.default}`,
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
- '&:hover': {
42
- borderBottomColor: theme.colors.accent.focus
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
- warning: {
46
- display: 'flow-root',
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
- /* eslint-disable @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call */
62
- // eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/naming-convention
63
- a: function MdLink(mdProps: any) {
64
- const props = {
65
- key: mdProps.nodeKey,
66
- className: mdProps.className
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
- if (mdProps.href.startsWith('/')) {
70
- return (
71
- <HashLink {...props} className={classNames(props.className, classes.link)} to={mdProps.href}>
72
- {mdProps.children}
73
- </HashLink>
74
- );
75
- } else {
76
- return (
77
- <a className={classes.link} href={mdProps.href}>
78
- {mdProps.children}
79
- </a>
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
- // eslint-disable-next-line @typescript-eslint/naming-convention,@typescript-eslint/no-explicit-any
85
- code: function MdCodeBlock({node, inline, className, children, ...props}: any) {
86
- if (!inline) {
87
- const match = /language-(\w+)/.exec(className || '');
88
- if (match) {
89
- return <CodeBlock lang={match[1]} langMeta={node.data?.meta.split(' ') ?? []} text={String(children).trimEnd()}/>;
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
- return <code className={className} {...props}>{children}</code>;
93
- },
94
- /* eslint-enable @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call */
95
- }), [classes]);
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
- warning: classes.warning,
99
- warningTitle: classes.warningTitle
100
- }), [classes]);
113
+ const customDirectiveClasses = useMemo(
114
+ () => ({
115
+ warning: classes.warning,
116
+ warningTitle: classes.warningTitle
117
+ }),
118
+ [classes]
119
+ );
101
120
 
102
- return <ReactMarkdown className={classes.root} remarkPlugins={[symbolLinks, gfmTables, [customDirectives, { classes: customDirectiveClasses }]]} components={components}>{source}</ReactMarkdown>
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 '@material-ui/styles';
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 '@material-ui/styles';
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
- <StylesProvider generateClassName={generateClassName}>
26
- <ThemeProvider theme={theme}>
27
- <Component {...props}/>
28
- </ThemeProvider>
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
  }
@@ -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()]).replace(/\$/g, '$$$$'),
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'),