@d-fischer/documen.ts 0.16.9 → 0.17.0
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/index.html +36 -35
- package/lib/common/CustomError.js +1 -4
- package/lib/common/CustomError.js.map +1 -1
- package/lib/common/Paths.js +1 -2
- package/lib/common/components/Badge.js +7 -10
- package/lib/common/components/Badge.js.map +1 -1
- package/lib/common/components/BetaNotice.js +5 -10
- package/lib/common/components/BetaNotice.js.map +1 -1
- package/lib/common/components/Button.js +8 -12
- package/lib/common/components/Button.js.map +1 -1
- package/lib/common/components/CodeBlock.js +45 -61
- package/lib/common/components/CodeBlock.js.map +1 -1
- package/lib/common/components/CodeLink.js +12 -15
- package/lib/common/components/CodeLink.js.map +1 -1
- package/lib/common/components/DeprecationNotice.js +5 -10
- package/lib/common/components/DeprecationNotice.js.map +1 -1
- package/lib/common/components/FunctionParamDesc.js +7 -19
- package/lib/common/components/FunctionParamDesc.js.map +1 -1
- package/lib/common/components/FunctionParamDescEntry.js +26 -38
- package/lib/common/components/FunctionParamDescEntry.js.map +1 -1
- package/lib/common/components/FunctionReturnType.js +8 -17
- package/lib/common/components/FunctionReturnType.js.map +1 -1
- package/lib/common/components/FunctionSignature.js +7 -22
- package/lib/common/components/FunctionSignature.js.map +1 -1
- package/lib/common/components/InterfaceDetail.js +11 -18
- package/lib/common/components/InterfaceDetail.js.map +1 -1
- package/lib/common/components/InterfaceRepresentation.js +21 -40
- package/lib/common/components/InterfaceRepresentation.js.map +1 -1
- package/lib/common/components/MainMenu.js +20 -36
- package/lib/common/components/MainMenu.js.map +1 -1
- package/lib/common/components/NavMenu.js +6 -9
- package/lib/common/components/NavMenu.js.map +1 -1
- package/lib/common/components/NavMenuGroup.js +5 -10
- package/lib/common/components/NavMenuGroup.js.map +1 -1
- package/lib/common/components/NavMenuItem.js +8 -11
- package/lib/common/components/NavMenuItem.js.map +1 -1
- package/lib/common/components/PageArticle.js +7 -10
- package/lib/common/components/PageArticle.js.map +1 -1
- package/lib/common/components/SymbolHeader.js +6 -20
- package/lib/common/components/SymbolHeader.js.map +1 -1
- package/lib/common/components/TypeAliasHint.js +7 -22
- package/lib/common/components/TypeAliasHint.js.map +1 -1
- package/lib/common/components/TypeLink.js +12 -16
- package/lib/common/components/TypeLink.js.map +1 -1
- package/lib/common/components/VersionMenu.js +21 -28
- package/lib/common/components/VersionMenu.js.map +1 -1
- package/lib/common/components/cards/CardToolbar.js +11 -17
- package/lib/common/components/cards/CardToolbar.js.map +1 -1
- package/lib/common/components/cards/EventCard.js +21 -46
- package/lib/common/components/cards/EventCard.js.map +1 -1
- package/lib/common/components/cards/FunctionCardHeader.js +13 -25
- package/lib/common/components/cards/FunctionCardHeader.js.map +1 -1
- package/lib/common/components/cards/MethodCard.js +13 -23
- package/lib/common/components/cards/MethodCard.js.map +1 -1
- package/lib/common/components/cards/PropertyCard.js +15 -31
- package/lib/common/components/cards/PropertyCard.js.map +1 -1
- package/lib/common/components/codeBuilders/ReferenceTypeView.js +12 -25
- package/lib/common/components/codeBuilders/ReferenceTypeView.js.map +1 -1
- package/lib/common/components/codeBuilders/Type.js +30 -75
- package/lib/common/components/codeBuilders/Type.js.map +1 -1
- package/lib/common/components/overviewTable/OverviewTable.js +6 -21
- package/lib/common/components/overviewTable/OverviewTable.js.map +1 -1
- package/lib/common/components/overviewTable/OverviewTableEntry.js +13 -22
- package/lib/common/components/overviewTable/OverviewTableEntry.js.map +1 -1
- package/lib/common/config/Config.js +1 -2
- package/lib/common/config/Util.js +4 -8
- package/lib/common/config/Util.js.map +1 -1
- package/lib/common/config/index.js +5 -9
- package/lib/common/config/index.js.map +1 -1
- package/lib/common/containers/App.js +10 -18
- package/lib/common/containers/App.js.map +1 -1
- package/lib/common/containers/AppLayout.js +5 -10
- package/lib/common/containers/AppLayout.js.map +1 -1
- package/lib/common/containers/Card.js +6 -9
- package/lib/common/containers/Card.js.map +1 -1
- package/lib/common/containers/PageContent.js +5 -8
- package/lib/common/containers/PageContent.js.map +1 -1
- package/lib/common/containers/PageHeader.js +5 -8
- package/lib/common/containers/PageHeader.js.map +1 -1
- package/lib/common/containers/PageSwitch.js +10 -19
- package/lib/common/containers/PageSwitch.js.map +1 -1
- package/lib/common/containers/ReferencePackageContainer.js +37 -54
- package/lib/common/containers/ReferencePackageContainer.js.map +1 -1
- package/lib/common/htmlRenderer/HtmlRenderer.js +23 -37
- package/lib/common/htmlRenderer/HtmlRenderer.js.map +1 -1
- package/lib/common/htmlRenderer/RouterMode.js +1 -2
- package/lib/common/htmlRenderer/StaticRouterWithSuffix.js +20 -24
- package/lib/common/htmlRenderer/StaticRouterWithSuffix.js.map +1 -1
- package/lib/common/pages/ClassPage.js +39 -67
- package/lib/common/pages/ClassPage.js.map +1 -1
- package/lib/common/pages/DocPage.js +27 -39
- package/lib/common/pages/DocPage.js.map +1 -1
- package/lib/common/pages/EnumPage.js +20 -40
- package/lib/common/pages/EnumPage.js.map +1 -1
- package/lib/common/pages/FunctionPage.js +20 -39
- package/lib/common/pages/FunctionPage.js.map +1 -1
- package/lib/common/pages/InterfacePage.js +20 -32
- package/lib/common/pages/InterfacePage.js.map +1 -1
- package/lib/common/pages/TypeAliasPage.js +19 -34
- package/lib/common/pages/TypeAliasPage.js.map +1 -1
- package/lib/common/reference/index.js +1 -3
- package/lib/common/reference/index.js.map +1 -1
- package/lib/common/theme.js +1 -3
- package/lib/common/theme.js.map +1 -1
- package/lib/common/tools/ArrayTools.js +7 -18
- package/lib/common/tools/ArrayTools.js.map +1 -1
- package/lib/common/tools/CodeTools.js +12 -23
- package/lib/common/tools/CodeTools.js.map +1 -1
- package/lib/common/tools/ConfigTools.js +15 -20
- package/lib/common/tools/ConfigTools.js.map +1 -1
- package/lib/common/tools/FileTools.js +9 -16
- package/lib/common/tools/FileTools.js.map +1 -1
- package/lib/common/tools/FunctionTools.js +3 -7
- package/lib/common/tools/FunctionTools.js.map +1 -1
- package/lib/common/tools/NodeTools.js +22 -33
- package/lib/common/tools/NodeTools.js.map +1 -1
- package/lib/common/tools/Point.js +1 -2
- package/lib/common/tools/ReferenceTools.js +30 -43
- package/lib/common/tools/ReferenceTools.js.map +1 -1
- package/lib/common/tools/StringTools.js +3 -9
- package/lib/common/tools/StringTools.js.map +1 -1
- package/lib/common/tools/TypeTools.js +1 -2
- package/lib/common/tools/markdown/MarkdownParser.js +21 -28
- package/lib/common/tools/markdown/MarkdownParser.js.map +1 -1
- package/lib/common/tools/markdown/plugins/customDirectives.js +15 -17
- package/lib/common/tools/markdown/plugins/customDirectives.js.map +1 -1
- package/lib/common/tools/markdown/plugins/gfmTables.js +7 -12
- package/lib/common/tools/markdown/plugins/gfmTables.js.map +1 -1
- package/lib/common/tools/markdown/plugins/symbolLinks.js +9 -13
- package/lib/common/tools/markdown/plugins/symbolLinks.js.map +1 -1
- package/lib/generator/analyzer/AnalyzeContext.js +5 -6
- package/lib/generator/analyzer/AnalyzeContext.js.map +1 -1
- package/lib/generator/analyzer/DocComment.js +17 -23
- package/lib/generator/analyzer/DocComment.js.map +1 -1
- package/lib/generator/analyzer/DocCommentTag.js +4 -5
- package/lib/generator/analyzer/DocCommentTag.js.map +1 -1
- package/lib/generator/analyzer/Project.js +71 -84
- package/lib/generator/analyzer/Project.js.map +1 -1
- package/lib/generator/analyzer/createReflection.js +87 -101
- package/lib/generator/analyzer/createReflection.js.map +1 -1
- package/lib/generator/analyzer/createType.js +51 -62
- package/lib/generator/analyzer/createType.js.map +1 -1
- package/lib/generator/analyzer/reflections/AccessorReflection.js +36 -39
- package/lib/generator/analyzer/reflections/AccessorReflection.js.map +1 -1
- package/lib/generator/analyzer/reflections/ClassReflection.js +58 -51
- package/lib/generator/analyzer/reflections/ClassReflection.js.map +1 -1
- package/lib/generator/analyzer/reflections/ConstructorReflection.js +28 -36
- package/lib/generator/analyzer/reflections/ConstructorReflection.js.map +1 -1
- package/lib/generator/analyzer/reflections/EnumMemberReflection.js +15 -18
- package/lib/generator/analyzer/reflections/EnumMemberReflection.js.map +1 -1
- package/lib/generator/analyzer/reflections/EnumReflection.js +21 -23
- package/lib/generator/analyzer/reflections/EnumReflection.js.map +1 -1
- package/lib/generator/analyzer/reflections/FunctionReflection.js +14 -16
- package/lib/generator/analyzer/reflections/FunctionReflection.js.map +1 -1
- package/lib/generator/analyzer/reflections/Heritage.js +6 -11
- package/lib/generator/analyzer/reflections/Heritage.js.map +1 -1
- package/lib/generator/analyzer/reflections/InterfaceReflection.js +41 -41
- package/lib/generator/analyzer/reflections/InterfaceReflection.js.map +1 -1
- package/lib/generator/analyzer/reflections/MethodReflection.js +40 -45
- package/lib/generator/analyzer/reflections/MethodReflection.js.map +1 -1
- package/lib/generator/analyzer/reflections/ParameterReflection.js +68 -69
- package/lib/generator/analyzer/reflections/ParameterReflection.js.map +1 -1
- package/lib/generator/analyzer/reflections/PropertyReflection.js +43 -40
- package/lib/generator/analyzer/reflections/PropertyReflection.js.map +1 -1
- package/lib/generator/analyzer/reflections/ReferenceReflection.js +8 -7
- package/lib/generator/analyzer/reflections/ReferenceReflection.js.map +1 -1
- package/lib/generator/analyzer/reflections/Reflection.js +35 -38
- package/lib/generator/analyzer/reflections/Reflection.js.map +1 -1
- package/lib/generator/analyzer/reflections/SignatureReflection.js +42 -46
- package/lib/generator/analyzer/reflections/SignatureReflection.js.map +1 -1
- package/lib/generator/analyzer/reflections/SymbolBasedReflection.js +6 -13
- package/lib/generator/analyzer/reflections/SymbolBasedReflection.js.map +1 -1
- package/lib/generator/analyzer/reflections/TypeAliasReflection.js +24 -26
- package/lib/generator/analyzer/reflections/TypeAliasReflection.js.map +1 -1
- package/lib/generator/analyzer/reflections/TypeLiteralReflection.js +22 -21
- package/lib/generator/analyzer/reflections/TypeLiteralReflection.js.map +1 -1
- package/lib/generator/analyzer/reflections/TypeParameterReflection.js +38 -39
- package/lib/generator/analyzer/reflections/TypeParameterReflection.js.map +1 -1
- package/lib/generator/analyzer/types/ArrayType.js +15 -23
- package/lib/generator/analyzer/types/ArrayType.js.map +1 -1
- package/lib/generator/analyzer/types/FunctionType.js +31 -38
- package/lib/generator/analyzer/types/FunctionType.js.map +1 -1
- package/lib/generator/analyzer/types/IntersectionType.js +12 -20
- package/lib/generator/analyzer/types/IntersectionType.js.map +1 -1
- package/lib/generator/analyzer/types/IntrinsicType.js +33 -41
- package/lib/generator/analyzer/types/IntrinsicType.js.map +1 -1
- package/lib/generator/analyzer/types/LiteralType.js +60 -68
- package/lib/generator/analyzer/types/LiteralType.js.map +1 -1
- package/lib/generator/analyzer/types/NamedTupleElementType.js +11 -15
- package/lib/generator/analyzer/types/NamedTupleElementType.js.map +1 -1
- package/lib/generator/analyzer/types/ObjectLiteralType.js +21 -30
- package/lib/generator/analyzer/types/ObjectLiteralType.js.map +1 -1
- package/lib/generator/analyzer/types/OptionalType.js +11 -17
- package/lib/generator/analyzer/types/OptionalType.js.map +1 -1
- package/lib/generator/analyzer/types/ReferenceType.js +118 -133
- package/lib/generator/analyzer/types/ReferenceType.js.map +1 -1
- package/lib/generator/analyzer/types/ReflectionType.js +4 -7
- package/lib/generator/analyzer/types/ReflectionType.js.map +1 -1
- package/lib/generator/analyzer/types/TupleType.js +27 -31
- package/lib/generator/analyzer/types/TupleType.js.map +1 -1
- package/lib/generator/analyzer/types/Type.js +1 -5
- package/lib/generator/analyzer/types/Type.js.map +1 -1
- package/lib/generator/analyzer/types/TypeOperatorType.js +38 -40
- package/lib/generator/analyzer/types/TypeOperatorType.js.map +1 -1
- package/lib/generator/analyzer/types/UnionType.js +22 -30
- package/lib/generator/analyzer/types/UnionType.js.map +1 -1
- package/lib/generator/analyzer/types/UnknownType.js +5 -6
- package/lib/generator/analyzer/types/UnknownType.js.map +1 -1
- package/lib/generator/analyzer/util/expressions.js +8 -13
- package/lib/generator/analyzer/util/expressions.js.map +1 -1
- package/lib/generator/analyzer/util/functions.js +15 -19
- package/lib/generator/analyzer/util/functions.js.map +1 -1
- package/lib/generator/analyzer/util/inheritance.js +26 -32
- package/lib/generator/analyzer/util/inheritance.js.map +1 -1
- package/lib/generator/analyzer/util/promises.js +2 -9
- package/lib/generator/analyzer/util/promises.js.map +1 -1
- package/lib/generator/analyzer/util/sourceMaps.js +12 -20
- package/lib/generator/analyzer/util/sourceMaps.js.map +1 -1
- package/lib/generator/analyzer/util/symbols.js +3 -9
- package/lib/generator/analyzer/util/symbols.js.map +1 -1
- package/lib/generator/analyzer/util/types.js +6 -10
- package/lib/generator/analyzer/util/types.js.map +1 -1
- package/lib/generator/cli.js +5 -8
- package/lib/generator/cli.js.map +1 -1
- package/lib/generator/commands/default.js +260 -259
- package/lib/generator/commands/default.js.map +1 -1
- package/lib/generator/index.js +1 -1
- package/lib/generator/modes/Generator.js +20 -31
- package/lib/generator/modes/Generator.js.map +1 -1
- package/lib/generator/modes/HtmlGenerator.js +214 -228
- package/lib/generator/modes/HtmlGenerator.js.map +1 -1
- package/lib/generator/modes/MonorepoGenerator.js +143 -159
- package/lib/generator/modes/MonorepoGenerator.js.map +1 -1
- package/lib/generator/modes/OutputGenerator.js +2 -7
- package/lib/generator/modes/OutputGenerator.js.map +1 -1
- package/lib/progressiveEnhancement/fsMap.js +2 -5
- package/lib/progressiveEnhancement/fsMap.js.map +1 -1
- package/package.json +16 -16
- package/src/common/components/CodeBlock.tsx +2 -2
- package/src/common/components/CodeLink.tsx +2 -2
- package/src/common/components/DeprecationNotice.tsx +2 -2
- package/src/common/components/FunctionParamDesc.tsx +3 -3
- package/src/common/components/FunctionParamDescEntry.tsx +6 -6
- package/src/common/components/FunctionReturnType.tsx +3 -3
- package/src/common/components/FunctionSignature.tsx +2 -2
- package/src/common/components/InterfaceDetail.tsx +15 -7
- package/src/common/components/InterfaceRepresentation.tsx +9 -9
- package/src/common/components/MainMenu.tsx +4 -4
- package/src/common/components/NavMenuItem.tsx +1 -1
- package/src/common/components/PageArticle.tsx +2 -2
- package/src/common/components/SymbolHeader.tsx +7 -9
- package/src/common/components/TypeAliasHint.tsx +3 -5
- package/src/common/components/TypeLink.tsx +6 -7
- package/src/common/components/VersionMenu.tsx +3 -3
- package/src/common/components/cards/CardToolbar.tsx +10 -6
- package/src/common/components/cards/EventCard.tsx +19 -23
- package/src/common/components/cards/FunctionCardHeader.tsx +8 -8
- package/src/common/components/cards/MethodCard.tsx +8 -8
- package/src/common/components/cards/PropertyCard.tsx +11 -11
- package/src/common/components/codeBuilders/ReferenceTypeView.tsx +4 -4
- package/src/common/components/codeBuilders/Type.tsx +4 -4
- package/src/common/components/overviewTable/OverviewTable.tsx +2 -2
- package/src/common/components/overviewTable/OverviewTableEntry.tsx +7 -7
- package/src/common/config/Config.ts +1 -1
- package/src/common/config/Util.ts +11 -3
- package/src/common/config/index.tsx +2 -2
- package/src/common/containers/App.tsx +12 -9
- package/src/common/containers/AppLayout.tsx +2 -2
- package/src/common/containers/PageHeader.tsx +2 -2
- package/src/common/containers/PageSwitch.tsx +7 -7
- package/src/common/containers/ReferencePackageContainer.tsx +13 -13
- package/src/common/htmlRenderer/HtmlRenderer.tsx +8 -9
- package/src/common/htmlRenderer/StaticRouterWithSuffix.tsx +18 -21
- package/src/common/pages/ClassPage.tsx +17 -17
- package/src/common/pages/DocPage.tsx +10 -10
- package/src/common/pages/EnumPage.tsx +14 -14
- package/src/common/pages/FunctionPage.tsx +15 -15
- package/src/common/pages/InterfacePage.tsx +13 -13
- package/src/common/pages/TypeAliasPage.tsx +12 -12
- package/src/common/reference/index.ts +0 -1
- package/src/common/tools/ArrayTools.ts +27 -11
- package/src/common/tools/CodeTools.tsx +1 -1
- package/src/common/tools/ConfigTools.ts +1 -1
- package/src/common/tools/FunctionTools.ts +2 -3
- package/src/common/tools/NodeTools.ts +3 -2
- package/src/common/tools/ReferenceTools.ts +10 -11
- package/src/common/tools/StringTools.ts +1 -1
- package/src/common/tools/markdown/MarkdownParser.tsx +13 -15
- package/src/common/tools/markdown/plugins/customDirectives.ts +1 -1
- package/src/common/tools/markdown/plugins/symbolLinks.ts +3 -3
- package/src/dev/index.tsx +9 -9
- package/src/dev/registerServiceWorker.ts +8 -16
- package/src/progressiveEnhancement/fsMap.ts +0 -1
- package/src/progressiveEnhancement/index.tsx +9 -11
- package/tsconfig-dev.json +1 -6
- package/tsconfig-enhance.json +1 -5
- package/tsconfig-html.json +1 -5
- package/tsconfig.json +7 -21
- package/types/globals.d.ts +0 -1
- package/types/react-router-hash-link.d.ts +0 -8
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { type Nodes as MdastNodes } from 'mdast';
|
|
1
2
|
import { toHast } from 'mdast-util-to-hast';
|
|
2
|
-
import { type MdastNodes } from 'mdast-util-to-hast/lib';
|
|
3
3
|
import remarkDirective from 'remark-directive';
|
|
4
4
|
import type { Processor, Transformer } from 'unified';
|
|
5
5
|
import type { Node } from 'unist';
|
|
@@ -2,9 +2,9 @@ import type { Content, Link, Text } from 'mdast';
|
|
|
2
2
|
import type { Transformer } from 'unified';
|
|
3
3
|
import type { Parent } from 'unist';
|
|
4
4
|
import { visit } from 'unist-util-visit';
|
|
5
|
-
import { getPageType } from '../../CodeTools';
|
|
6
|
-
import { findSymbolByMember } from '../../ReferenceTools';
|
|
7
|
-
import { getPackagePath } from '../../StringTools';
|
|
5
|
+
import { getPageType } from '../../CodeTools.js';
|
|
6
|
+
import { findSymbolByMember } from '../../ReferenceTools.js';
|
|
7
|
+
import { getPackagePath } from '../../StringTools.js';
|
|
8
8
|
|
|
9
9
|
function insertAt(array: Parent['children'], index: number, ...items: Content[]): Parent['children'] {
|
|
10
10
|
return [...array.slice(0, index), ...items, ...array.slice(index)];
|
package/src/dev/index.tsx
CHANGED
|
@@ -3,14 +3,13 @@ import js from '@d-fischer/react-syntax-highlighter/dist/esm/languages/hljs/java
|
|
|
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
5
|
import { ThemeProvider } from '@mui/styles';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { BrowserRouter, HashRouter } from 'react-router-dom';
|
|
6
|
+
import { createRoot } from 'react-dom/client';
|
|
7
|
+
import { BrowserRouter, HashRouter } from 'react-router';
|
|
9
8
|
|
|
10
|
-
import App from '../common/containers/App';
|
|
11
|
-
import theme from '../common/theme';
|
|
9
|
+
import App from '../common/containers/App.js';
|
|
10
|
+
import theme from '../common/theme.js';
|
|
12
11
|
|
|
13
|
-
import registerServiceWorker from './registerServiceWorker';
|
|
12
|
+
import registerServiceWorker from './registerServiceWorker.js';
|
|
14
13
|
|
|
15
14
|
const Router = process.env.SUPPORTS_DYNAMIC_ROUTING ? BrowserRouter : HashRouter;
|
|
16
15
|
|
|
@@ -20,13 +19,14 @@ SyntaxHighlighter.registerLanguage('json', json);
|
|
|
20
19
|
SyntaxHighlighter.registerLanguage('typescript', ts);
|
|
21
20
|
SyntaxHighlighter.registerLanguage('ts', ts);
|
|
22
21
|
|
|
23
|
-
|
|
22
|
+
const root = createRoot(document.getElementById('app-root'));
|
|
23
|
+
|
|
24
|
+
root.render(
|
|
24
25
|
<ThemeProvider theme={theme}>
|
|
25
26
|
<Router>
|
|
26
27
|
<App />
|
|
27
28
|
</Router>
|
|
28
|
-
</ThemeProvider
|
|
29
|
-
document.getElementById('app-root')
|
|
29
|
+
</ThemeProvider>
|
|
30
30
|
);
|
|
31
31
|
|
|
32
32
|
// eslint-disable-next-line no-console
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* eslint-disable no-console
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
2
|
// In production, we register a service worker to serve assets from local cache.
|
|
3
3
|
|
|
4
4
|
// This lets the app load faster on subsequent visits in production, and gives
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
|
|
12
12
|
const isLocalhost = Boolean(
|
|
13
13
|
window.location.hostname === 'localhost' ||
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
// [::1] is the IPv6 localhost address.
|
|
15
|
+
window.location.hostname === '[::1]' ||
|
|
16
|
+
// 127.0.0.1/8 is considered localhost for IPv4.
|
|
17
|
+
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/.exec(window.location.hostname)
|
|
18
18
|
);
|
|
19
19
|
|
|
20
20
|
async function registerValidServiceWorker(swUrl: string) {
|
|
@@ -53,10 +53,7 @@ async function checkValidServiceWorker(swUrl: string) {
|
|
|
53
53
|
// Check if the service worker can be found. If it can't, reload the page.
|
|
54
54
|
const response = await fetch(swUrl);
|
|
55
55
|
// Ensure service worker exists, and that we really are getting a JS file.
|
|
56
|
-
if (
|
|
57
|
-
response.status === 404 ||
|
|
58
|
-
!response.headers.get('content-type')!.includes('javascript')
|
|
59
|
-
) {
|
|
56
|
+
if (response.status === 404 || !response.headers.get('content-type')!.includes('javascript')) {
|
|
60
57
|
// No service worker found. Probably a different app. Reload the page.
|
|
61
58
|
const registration = await navigator.serviceWorker.ready;
|
|
62
59
|
await registration.unregister();
|
|
@@ -66,9 +63,7 @@ async function checkValidServiceWorker(swUrl: string) {
|
|
|
66
63
|
await registerValidServiceWorker(swUrl);
|
|
67
64
|
}
|
|
68
65
|
} catch (e) {
|
|
69
|
-
console.log(
|
|
70
|
-
'No internet connection found. App is running in offline mode.'
|
|
71
|
-
);
|
|
66
|
+
console.log('No internet connection found. App is running in offline mode.');
|
|
72
67
|
}
|
|
73
68
|
}
|
|
74
69
|
|
|
@@ -76,10 +71,7 @@ export default async function registerServiceWorker() {
|
|
|
76
71
|
await new Promise<void>((resolve, reject) => {
|
|
77
72
|
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
|
|
78
73
|
// The URL constructor is available in all browsers that support SW.
|
|
79
|
-
const publicUrl = new URL(
|
|
80
|
-
process.env.PUBLIC_URL!,
|
|
81
|
-
window.location.toString()
|
|
82
|
-
);
|
|
74
|
+
const publicUrl = new URL(process.env.PUBLIC_URL!, window.location.toString());
|
|
83
75
|
if (publicUrl.origin !== window.location.origin) {
|
|
84
76
|
// Our service worker won't work if PUBLIC_URL is on a different origin
|
|
85
77
|
// from what our page is served on. This might happen if a CDN is used to
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { createGenerateClassName, StylesProvider, ThemeProvider } from '@mui/styles';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
2
|
+
import { CodeBlock } from '../common/components/CodeBlock.js';
|
|
3
|
+
import VersionMenu from '../common/components/VersionMenu.js';
|
|
4
|
+
import theme from '../common/theme.js';
|
|
5
|
+
import { type ComponentType } from 'react';
|
|
6
|
+
import { createRoot } from 'react-dom/client';
|
|
7
7
|
|
|
8
8
|
const registeredComponents = {
|
|
9
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
10
9
|
CodeBlock,
|
|
11
10
|
VersionMenu
|
|
12
|
-
/* eslint-enable @typescript-eslint/naming-convention */
|
|
13
11
|
};
|
|
14
12
|
|
|
15
13
|
const generateClassName = createGenerateClassName({
|
|
@@ -17,16 +15,16 @@ const generateClassName = createGenerateClassName({
|
|
|
17
15
|
});
|
|
18
16
|
|
|
19
17
|
for (const elem of document.querySelectorAll<HTMLElement>('[data-dynamic-component]')) {
|
|
20
|
-
const Component = registeredComponents[elem.dataset.dynamicComponent!] as
|
|
18
|
+
const Component = registeredComponents[elem.dataset.dynamicComponent!] as ComponentType | undefined;
|
|
21
19
|
if (Component) {
|
|
22
20
|
const props = JSON.parse(elem.dataset.componentProps ?? '{}') as JSX.IntrinsicAttributes;
|
|
23
|
-
|
|
21
|
+
const root = createRoot(elem);
|
|
22
|
+
root.render(
|
|
24
23
|
<StylesProvider generateClassName={generateClassName}>
|
|
25
24
|
<ThemeProvider theme={theme}>
|
|
26
25
|
<Component {...props} />
|
|
27
26
|
</ThemeProvider>
|
|
28
|
-
</StylesProvider
|
|
29
|
-
elem
|
|
27
|
+
</StylesProvider>
|
|
30
28
|
);
|
|
31
29
|
}
|
|
32
30
|
}
|
package/tsconfig-dev.json
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "./tsconfig.json",
|
|
3
3
|
"outDir": "tmp",
|
|
4
|
-
"include": [
|
|
5
|
-
"types",
|
|
6
|
-
"src/common",
|
|
7
|
-
"src/dev",
|
|
8
|
-
"vite.config.dev.ts"
|
|
9
|
-
],
|
|
4
|
+
"include": ["types", "src/common", "src/dev", "vite.config.dev.ts"],
|
|
10
5
|
"compilerOptions": {
|
|
11
6
|
"importHelpers": false
|
|
12
7
|
}
|
package/tsconfig-enhance.json
CHANGED
package/tsconfig-html.json
CHANGED
package/tsconfig.json
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"outDir": "lib",
|
|
4
|
-
"module": "
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
"dom.iterable",
|
|
9
|
-
"es2019"
|
|
10
|
-
],
|
|
4
|
+
"module": "node16",
|
|
5
|
+
"moduleResolution": "node16",
|
|
6
|
+
"target": "es2022",
|
|
7
|
+
"lib": ["dom", "dom.iterable", "es2022"],
|
|
11
8
|
"sourceMap": true,
|
|
12
9
|
"allowJs": true,
|
|
13
|
-
"jsx": "react",
|
|
14
|
-
"moduleResolution": "node",
|
|
10
|
+
"jsx": "react-jsx",
|
|
15
11
|
"rootDir": "src",
|
|
16
12
|
"forceConsistentCasingInFileNames": true,
|
|
17
13
|
"strict": true,
|
|
@@ -22,16 +18,6 @@
|
|
|
22
18
|
"esModuleInterop": true,
|
|
23
19
|
"skipLibCheck": true
|
|
24
20
|
},
|
|
25
|
-
"include": [
|
|
26
|
-
|
|
27
|
-
"src/common",
|
|
28
|
-
"src/generator"
|
|
29
|
-
],
|
|
30
|
-
"exclude": [
|
|
31
|
-
"node_modules",
|
|
32
|
-
"build",
|
|
33
|
-
"scripts",
|
|
34
|
-
"config",
|
|
35
|
-
"vite.config.dev.ts"
|
|
36
|
-
]
|
|
21
|
+
"include": ["types", "src/common", "src/generator"],
|
|
22
|
+
"exclude": ["node_modules", "build", "scripts", "config", "vite.config.dev.ts"]
|
|
37
23
|
}
|
package/types/globals.d.ts
CHANGED