@alauda/doom 0.11.0 → 0.11.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/lib/runtime/components/JsonViewer.js +2 -1
- package/lib/runtime/components/K8sCrd.js +3 -1
- package/lib/runtime/components/K8sPermissionTable.js +3 -2
- package/lib/runtime/components/OpenAPIPath.js +4 -2
- package/lib/runtime/components/OpenAPIRef.js +2 -2
- package/lib/runtime/components/_HeadingTitle.js +2 -2
- package/lib/runtime/components/_Markdown.js +5 -2
- package/lib/runtime/components/_RefLink.js +2 -2
- package/package.json +1 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { getCustomMDXComponent, Tab, Tabs } from '@rspress/core/theme';
|
|
3
|
+
import { useState } from 'react';
|
|
3
4
|
import { stringify } from 'yaml';
|
|
4
|
-
const X = getCustomMDXComponent();
|
|
5
5
|
export const JsonViewer = ({ value }) => {
|
|
6
|
+
const [X] = useState(getCustomMDXComponent);
|
|
6
7
|
return (_jsxs(Tabs, { children: [_jsx(Tab, { label: "yaml", children: _jsx(X.pre, { children: _jsx(X.code, { className: "language-yaml", codeHighlighter: "prism", children: stringify(value) }) }) }), _jsx(Tab, { label: "json", children: _jsx(X.pre, { children: _jsx(X.code, { className: "language-json", codeHighlighter: "prism", children: JSON.stringify(value, null, 2) }) }) })] }));
|
|
7
8
|
};
|
|
8
9
|
export default JsonViewer;
|
|
@@ -8,8 +8,8 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
|
8
8
|
import { useTranslation } from '../hooks/index.js';
|
|
9
9
|
import { Directive } from './Directive.js';
|
|
10
10
|
import { Markdown } from './_Markdown.js';
|
|
11
|
-
const X = getCustomMDXComponent();
|
|
12
11
|
export const K8sCrdSchemaPart = ({ name, parent, schema: property, expandAll, }) => {
|
|
12
|
+
const [X] = useState(getCustomMDXComponent);
|
|
13
13
|
const [open, setOpen] = useState(expandAll);
|
|
14
14
|
const onToggle = useCallback((open) => {
|
|
15
15
|
setOpen(open);
|
|
@@ -43,6 +43,7 @@ export const K8sCrdSchemaPart = ({ name, parent, schema: property, expandAll, })
|
|
|
43
43
|
};
|
|
44
44
|
const SKIPPED_PROPERTIES = ['apiVersion', 'kind', 'metadata'];
|
|
45
45
|
export const K8sCrdSchema = ({ schema, version, }) => {
|
|
46
|
+
const [X] = useState(getCustomMDXComponent);
|
|
46
47
|
const { description, properties } = schema;
|
|
47
48
|
const t = useTranslation();
|
|
48
49
|
const [expandAll, setExpandAll] = useState(false);
|
|
@@ -52,6 +53,7 @@ export const K8sCrdSchema = ({ schema, version, }) => {
|
|
|
52
53
|
return (_jsxs(_Fragment, { children: [_jsx(Markdown, { children: description }), _jsxs("div", { className: "flex items-center", children: [_jsxs("span", { children: [_jsx(X.code, { children: version }), _jsx(Badge, { children: "version" })] }), properties != null && (_jsx(Button, { className: "ml-auto doom-btn", type: "button", text: _jsxs("span", { onClick: toggleExpandAll, children: [expandAll ? '-' : '+', ' ', t(expandAll ? 'collapse_all' : 'expand_all')] }), size: "medium", theme: "alt" }))] }), properties == null ? (_jsx(Directive, { type: "warning", children: t('crd_no_schema') })) : (_jsx("div", { className: "doom-collapse-group", children: Object.entries(properties).map(([name, subSchema]) => SKIPPED_PROPERTIES.includes(name) || (_jsx(K8sCrdSchemaPart, { name: name, parent: schema, schema: subSchema, expandAll: expandAll }, name))) }))] }));
|
|
53
54
|
};
|
|
54
55
|
export const K8sCrd = ({ name, crdPath }) => {
|
|
56
|
+
const [X] = useState(getCustomMDXComponent);
|
|
55
57
|
const { page } = usePageData();
|
|
56
58
|
const [, crd] = useMemo(() => Object.entries(page.crdsMap || {}).find(([pathname, crd]) => {
|
|
57
59
|
if (crdPath && pathname !== crdPath) {
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useLang, usePageData } from '@rspress/core/runtime';
|
|
3
3
|
import { getCustomMDXComponent } from '@rspress/core/theme';
|
|
4
4
|
import { intersection, sortBy } from 'es-toolkit';
|
|
5
|
-
import { Fragment, useMemo } from 'react';
|
|
5
|
+
import { Fragment, useMemo, useState } from 'react';
|
|
6
6
|
import { useTranslation } from '../hooks/index.js';
|
|
7
7
|
export const VerbsMap = {
|
|
8
8
|
view: ['get', 'list', 'watch'],
|
|
@@ -17,8 +17,8 @@ const DISPLAY_NAME_ZH = 'cpaas.io/display-name';
|
|
|
17
17
|
const DISPLAY_NAME_EN = 'cpaas.io/display-name.en';
|
|
18
18
|
const TEXT_CENTER_STYLE = { textAlign: 'center' };
|
|
19
19
|
const TEXT_NO_WRAP_STYLE = { whiteSpace: 'nowrap' };
|
|
20
|
-
const X = getCustomMDXComponent();
|
|
21
20
|
const RolesPermission = ({ functionResource, roleTemplates, verb, }) => {
|
|
21
|
+
const [X] = useState(getCustomMDXComponent);
|
|
22
22
|
const functionResourceName = functionResource.metadata.name;
|
|
23
23
|
const actions = functionResource.metadata.annotations['auth.cpaas.io/actions'];
|
|
24
24
|
return roleTemplates.map(({ metadata: { name }, spec: { rules } }) => {
|
|
@@ -41,6 +41,7 @@ const RolesPermission = ({ functionResource, roleTemplates, verb, }) => {
|
|
|
41
41
|
});
|
|
42
42
|
};
|
|
43
43
|
export const K8sPermissionTable = ({ functions }) => {
|
|
44
|
+
const [X] = useState(getCustomMDXComponent);
|
|
44
45
|
const { page } = usePageData();
|
|
45
46
|
const functionResourcesMap = useMemo(() => Object.values(page.functionResourcesMap || {}).reduce((acc, curr) => Object.assign(acc, ...curr.map((fr) => ({ [fr.metadata.name]: fr }))), {}), [page.functionResourcesMap]);
|
|
46
47
|
const functionResources = useMemo(() => {
|
|
@@ -3,14 +3,14 @@ import { usePageData } from '@rspress/core/runtime';
|
|
|
3
3
|
import { Badge, getCustomMDXComponent } from '@rspress/core/theme';
|
|
4
4
|
import BananaSlug from 'github-slugger';
|
|
5
5
|
import { OpenAPIV3 } from 'openapi-types';
|
|
6
|
-
import { useMemo } from 'react';
|
|
6
|
+
import { useMemo, useState } from 'react';
|
|
7
7
|
import { DEFAULT_COMMON_REFS, omitRoutePathRefs, resolveRef } from '../utils.js';
|
|
8
8
|
import { HeadingTitle } from './_HeadingTitle.js';
|
|
9
9
|
import { RefLink } from './_RefLink.js';
|
|
10
10
|
import OpenAPIRef from './OpenAPIRef.js';
|
|
11
11
|
import { Markdown } from './_Markdown.js';
|
|
12
|
-
const X = getCustomMDXComponent();
|
|
13
12
|
export const OpenAPIParameters = ({ parameters, openapi, }) => {
|
|
13
|
+
const [X] = useState(getCustomMDXComponent);
|
|
14
14
|
return (_jsx(X.ul, { children: parameters.map((param, index) => {
|
|
15
15
|
const paramObj = '$ref' in param
|
|
16
16
|
? resolveRef(openapi, param.$ref)
|
|
@@ -28,6 +28,7 @@ export const OpenAPIParameters = ({ parameters, openapi, }) => {
|
|
|
28
28
|
}) }));
|
|
29
29
|
};
|
|
30
30
|
export const OpenAPIResponses = ({ responses, openapi, }) => {
|
|
31
|
+
const [X] = useState(getCustomMDXComponent);
|
|
31
32
|
return (_jsx(X.ul, { children: Object.entries(responses).map(([code, response], index) => {
|
|
32
33
|
const responseObj = '$ref' in response
|
|
33
34
|
? resolveRef(openapi, response.$ref)
|
|
@@ -73,6 +74,7 @@ const getRefsForPath = (openapi, path, knownRefs) => {
|
|
|
73
74
|
return Array.from(refs);
|
|
74
75
|
};
|
|
75
76
|
export const OpenAPIPath = ({ path, openapiPath: openapiPath_, pathPrefix: pathPrefix_, }) => {
|
|
77
|
+
const [X] = useState(getCustomMDXComponent);
|
|
76
78
|
const { page } = usePageData();
|
|
77
79
|
const pathPrefix = pathPrefix_ ?? (page.pathPrefix || '');
|
|
78
80
|
const slugger = useMemo(() => new BananaSlug(), []);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { usePageData } from '@rspress/core/runtime';
|
|
3
3
|
import { getCustomMDXComponent } from '@rspress/core/theme';
|
|
4
|
-
import { useMemo } from 'react';
|
|
4
|
+
import { useMemo, useState } from 'react';
|
|
5
5
|
import { DEFAULT_COMMON_REFS, modelName, omitRoutePathRefs, resolveRef, } from '../utils.js';
|
|
6
6
|
import { HeadingTitle } from './_HeadingTitle.js';
|
|
7
7
|
import { Markdown } from './_Markdown.js';
|
|
8
8
|
import { RefLink } from './_RefLink.js';
|
|
9
|
-
const X = getCustomMDXComponent();
|
|
10
9
|
export const OpenAPIProperties = ({ properties, openapi, }) => {
|
|
10
|
+
const [X] = useState(getCustomMDXComponent);
|
|
11
11
|
return (_jsx(X.ul, { children: Object.entries(properties).map(([name, prop], index) => {
|
|
12
12
|
const propObj = '$ref' in prop ? resolveRef(openapi, prop.$ref) : prop;
|
|
13
13
|
const type = propObj.type;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { getCustomMDXComponent } from '@rspress/core/theme';
|
|
3
|
-
import { Children, useMemo } from 'react';
|
|
3
|
+
import { Children, useMemo, useState } from 'react';
|
|
4
4
|
export const HeadingTitle = ({ slug, slugger, level, children, }) => {
|
|
5
|
-
const X =
|
|
5
|
+
const [X] = useState(getCustomMDXComponent);
|
|
6
6
|
const HeadingComponents = useMemo(() => {
|
|
7
7
|
return [null, X.h1, X.h2, X.h3, X.h4, X.h5, X.h6];
|
|
8
8
|
}, [X]);
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { getCustomMDXComponent } from '@rspress/core/theme';
|
|
3
|
+
import { useState } from 'react';
|
|
3
4
|
import ReactMarkdown from 'react-markdown';
|
|
4
5
|
import remarkGfm from 'remark-gfm';
|
|
5
|
-
const
|
|
6
|
-
|
|
6
|
+
export const Markdown = ({ children }) => {
|
|
7
|
+
const [components] = useState(getCustomMDXComponent);
|
|
8
|
+
return (children && (_jsx(ReactMarkdown, { remarkPlugins: [[remarkGfm]], components: components, skipHtml: true, children: children })));
|
|
9
|
+
};
|
|
@@ -2,9 +2,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { getCustomMDXComponent } from '@rspress/core/theme';
|
|
3
3
|
import { DEFAULT_COMMON_REFS, modelName } from '../utils.js';
|
|
4
4
|
import { usePageData } from '@rspress/core/runtime';
|
|
5
|
-
import { useMemo } from 'react';
|
|
6
|
-
const X = getCustomMDXComponent();
|
|
5
|
+
import { useMemo, useState } from 'react';
|
|
7
6
|
export const RefLink = ({ $ref }) => {
|
|
7
|
+
const [X] = useState(getCustomMDXComponent);
|
|
8
8
|
const { page } = usePageData();
|
|
9
9
|
const references = useMemo(() => ({
|
|
10
10
|
...DEFAULT_COMMON_REFS,
|