@redocly/portal-plugin-async-api 1.0.1
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/CHANGELOG.md +11 -0
- package/LICENSE +3 -0
- package/README.md +1 -0
- package/lib/.tsbuildinfo +1 -0
- package/lib/config.d.ts +158 -0
- package/lib/config.js +32 -0
- package/lib/config.js.map +1 -0
- package/lib/plugin.d.ts +2 -0
- package/lib/plugin.js +86 -0
- package/lib/plugin.js.map +1 -0
- package/lib/styles.d.ts +1 -0
- package/lib/styles.js +573 -0
- package/lib/styles.js.map +1 -0
- package/lib/template.d.ts +12 -0
- package/lib/template.js +38 -0
- package/lib/template.js.map +1 -0
- package/package.json +43 -0
- package/src/config.ts +37 -0
- package/src/plugin.ts +101 -0
- package/src/styles.tsx +573 -0
- package/src/template.tsx +69 -0
- package/tsconfig.build.json +12 -0
- package/tsconfig.json +12 -0
package/src/template.tsx
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import AsyncApiComponent from '@asyncapi/react-component';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
import { Breadcrumbs as ThemeBreadcrumbs } from '@theme';
|
|
6
|
+
import { usePageSharedData } from '@redocly/portal/dist/client/providers/page-data/use-page-shared-data';
|
|
7
|
+
import '@asyncapi/react-component/lib/styles/fiori.css';
|
|
8
|
+
|
|
9
|
+
import type { ConfigInterface } from '@asyncapi/react-component';
|
|
10
|
+
import type { PageProps } from '@redocly/portal/dist/shared/types';
|
|
11
|
+
import type { AsyncApiDocsSettings } from './config';
|
|
12
|
+
|
|
13
|
+
import { StylesProvider } from './styles.js';
|
|
14
|
+
|
|
15
|
+
interface AsyncApiDocsProps {
|
|
16
|
+
pageProps: PageProps & {
|
|
17
|
+
settings?: AsyncApiDocsSettings;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function AsyncApiDocs({ pageProps }: AsyncApiDocsProps) {
|
|
22
|
+
const { settings = {} } = pageProps;
|
|
23
|
+
const asyncApiDefinition = usePageSharedData('AsyncApiDefinition');
|
|
24
|
+
|
|
25
|
+
const {
|
|
26
|
+
schemaId,
|
|
27
|
+
hideChannels,
|
|
28
|
+
hideErrors,
|
|
29
|
+
hideInfo,
|
|
30
|
+
hideMessages,
|
|
31
|
+
hideSchemas,
|
|
32
|
+
hideServers,
|
|
33
|
+
expandChannels,
|
|
34
|
+
expandMessages,
|
|
35
|
+
expandSchemas,
|
|
36
|
+
expandServers,
|
|
37
|
+
} = settings;
|
|
38
|
+
|
|
39
|
+
const componentConfig: Partial<ConfigInterface> = {
|
|
40
|
+
schemaID: schemaId,
|
|
41
|
+
showErrors: !hideErrors,
|
|
42
|
+
show: {
|
|
43
|
+
info: !hideInfo,
|
|
44
|
+
channels: !hideChannels,
|
|
45
|
+
servers: !hideServers,
|
|
46
|
+
messages: !hideMessages,
|
|
47
|
+
schemas: !hideSchemas,
|
|
48
|
+
},
|
|
49
|
+
expand: {
|
|
50
|
+
schemas: expandSchemas,
|
|
51
|
+
channels: expandChannels,
|
|
52
|
+
messages: expandMessages,
|
|
53
|
+
servers: expandServers,
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<StylesProvider>
|
|
59
|
+
<Breadcrumbs />
|
|
60
|
+
<AsyncApiComponent schema={asyncApiDefinition} config={componentConfig} />
|
|
61
|
+
</StylesProvider>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export default React.memo(AsyncApiDocs);
|
|
66
|
+
|
|
67
|
+
const Breadcrumbs = styled(ThemeBreadcrumbs)`
|
|
68
|
+
margin-top: 20px;
|
|
69
|
+
`;
|