docusaurus-theme-openapi-docs 0.0.0-737 → 0.0.0-738
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/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +2 -4
- package/lib/theme/ApiExplorer/FloatingButton/_FloatingButton.scss +1 -3
- package/lib/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +1 -2
- package/lib/theme/ApiExplorer/Request/_Request.scss +2 -4
- package/lib/theme/ApiExplorer/Response/_Response.scss +2 -4
- package/lib/theme/styles.scss +15 -15
- package/package.json +3 -3
- package/src/index.ts +1 -1
- package/src/markdown/schema.ts +3 -3
- package/src/markdown/utils.ts +1 -1
- package/src/theme/ApiExplorer/ApiCodeBlock/Container/index.js +1 -1
- package/src/theme/ApiExplorer/ApiCodeBlock/Content/Element.js +1 -1
- package/src/theme/ApiExplorer/ApiCodeBlock/Content/String.js +4 -4
- package/src/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.js +1 -1
- package/src/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.js +1 -1
- package/src/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.js +4 -4
- package/src/theme/ApiExplorer/ApiCodeBlock/Line/index.js +1 -1
- package/src/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.js +1 -1
- package/src/theme/ApiExplorer/Authorization/index.tsx +5 -5
- package/src/theme/ApiExplorer/Authorization/slice.ts +1 -1
- package/src/theme/ApiExplorer/Body/index.tsx +4 -4
- package/src/theme/ApiExplorer/Body/slice.ts +2 -2
- package/src/theme/ApiExplorer/CodeSnippets/index.tsx +7 -7
- package/src/theme/ApiExplorer/CodeSnippets/languages.ts +4 -4
- package/src/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +2 -4
- package/src/theme/ApiExplorer/CodeTabs/index.js +7 -7
- package/src/theme/ApiExplorer/FloatingButton/_FloatingButton.scss +1 -3
- package/src/theme/ApiExplorer/MethodEndpoint/index.tsx +1 -1
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.tsx +1 -1
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.tsx +1 -1
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.tsx +5 -5
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.tsx +1 -1
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.tsx +1 -1
- package/src/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +1 -2
- package/src/theme/ApiExplorer/Request/_Request.scss +2 -4
- package/src/theme/ApiExplorer/Request/index.tsx +1 -1
- package/src/theme/ApiExplorer/Request/makeRequest.ts +3 -3
- package/src/theme/ApiExplorer/Response/_Response.scss +2 -4
- package/src/theme/ApiExplorer/Response/index.tsx +2 -2
- package/src/theme/ApiExplorer/Server/index.tsx +8 -8
- package/src/theme/ApiExplorer/Server/slice.ts +1 -1
- package/src/theme/ApiExplorer/buildPostmanRequest.ts +3 -3
- package/src/theme/ApiExplorer/persistanceMiddleware.ts +1 -1
- package/src/theme/ApiItem/index.tsx +3 -3
- package/src/theme/ApiItem/store.ts +2 -2
- package/src/theme/ApiTabs/index.js +6 -6
- package/src/theme/DiscriminatorTabs/index.js +4 -4
- package/src/theme/MimeTabs/index.js +4 -4
- package/src/theme/OperationTabs/index.js +4 -4
- package/src/theme/ParamsItem/index.js +3 -3
- package/src/theme/SchemaItem/index.js +1 -1
- package/src/theme/SchemaTabs/index.js +4 -4
- package/src/theme/styles.scss +15 -15
- package/src/theme-openapi.d.ts +5 -13
|
@@ -18,14 +18,12 @@
|
|
|
18
18
|
background-color: var(--ifm-pre-background);
|
|
19
19
|
border-radius: var(--ifm-global-radius);
|
|
20
20
|
border: 1px solid var(--openapi-explorer-border-color);
|
|
21
|
-
box-shadow:
|
|
22
|
-
0 2px 3px hsla(222, 8%, 43%, 0.1),
|
|
21
|
+
box-shadow: 0 2px 3px hsla(222, 8%, 43%, 0.1),
|
|
23
22
|
0 8px 16px -10px hsla(222, 8%, 43%, 0.2);
|
|
24
23
|
transition: 300ms;
|
|
25
24
|
|
|
26
25
|
&:hover {
|
|
27
|
-
box-shadow:
|
|
28
|
-
0 0 0 2px rgba(38, 53, 61, 0.15),
|
|
26
|
+
box-shadow: 0 0 0 2px rgba(38, 53, 61, 0.15),
|
|
29
27
|
0 2px 3px hsla(222, 8%, 43%, 0.15),
|
|
30
28
|
0 16px 16px -10px hsla(222, 8%, 43%, 0.2);
|
|
31
29
|
}
|
|
@@ -11,9 +11,7 @@
|
|
|
11
11
|
padding: 0.4rem 0.5rem;
|
|
12
12
|
opacity: 0;
|
|
13
13
|
visibility: hidden;
|
|
14
|
-
transition:
|
|
15
|
-
opacity 0.2s ease-in-out,
|
|
16
|
-
visibility 0.2s ease-in-out,
|
|
14
|
+
transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out,
|
|
17
15
|
bottom 0.2s ease-in-out;
|
|
18
16
|
position: absolute;
|
|
19
17
|
right: calc(var(--ifm-pre-padding) / 2);
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
background-color: var(--ifm-pre-background);
|
|
3
3
|
border-radius: var(--openapi-card-border-radius);
|
|
4
4
|
border: 1px solid var(--openapi-explorer-border-color);
|
|
5
|
-
box-shadow:
|
|
6
|
-
0 2px 3px hsla(222, 8%, 43%, 0.1),
|
|
5
|
+
box-shadow: 0 2px 3px hsla(222, 8%, 43%, 0.1),
|
|
7
6
|
0 8px 16px -10px hsla(222, 8%, 43%, 0.2);
|
|
8
7
|
color: var(--ifm-pre-color);
|
|
9
8
|
line-height: var(--ifm-pre-line-height);
|
|
@@ -20,8 +19,7 @@
|
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
&:hover {
|
|
23
|
-
box-shadow:
|
|
24
|
-
0 0 0 2px rgba(38, 53, 61, 0.15),
|
|
22
|
+
box-shadow: 0 0 0 2px rgba(38, 53, 61, 0.15),
|
|
25
23
|
0 2px 3px hsla(222, 8%, 43%, 0.15),
|
|
26
24
|
0 16px 16px -10px hsla(222, 8%, 43%, 0.2);
|
|
27
25
|
}
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
background-color: var(--ifm-pre-background);
|
|
3
3
|
border-radius: var(--openapi-card-border-radius);
|
|
4
4
|
border: 1px solid var(--openapi-explorer-border-color);
|
|
5
|
-
box-shadow:
|
|
6
|
-
0 2px 3px hsla(222, 8%, 43%, 0.1),
|
|
5
|
+
box-shadow: 0 2px 3px hsla(222, 8%, 43%, 0.1),
|
|
7
6
|
0 8px 16px -10px hsla(222, 8%, 43%, 0.2);
|
|
8
7
|
color: var(--ifm-pre-color);
|
|
9
8
|
line-height: var(--ifm-pre-line-height);
|
|
@@ -13,8 +12,7 @@
|
|
|
13
12
|
transition: 300ms;
|
|
14
13
|
|
|
15
14
|
&:hover {
|
|
16
|
-
box-shadow:
|
|
17
|
-
0 0 0 2px rgba(38, 53, 61, 0.15),
|
|
15
|
+
box-shadow: 0 0 0 2px rgba(38, 53, 61, 0.15),
|
|
18
16
|
0 2px 3px hsla(222, 8%, 43%, 0.15),
|
|
19
17
|
0 16px 16px -10px hsla(222, 8%, 43%, 0.2);
|
|
20
18
|
}
|
package/lib/theme/styles.scss
CHANGED
|
@@ -130,22 +130,22 @@
|
|
|
130
130
|
|
|
131
131
|
/* Version button */
|
|
132
132
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
133
|
+
.version-button div {
|
|
134
|
+
display: block;
|
|
135
|
+
}
|
|
136
136
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
137
|
+
.version-button div > button > span::after {
|
|
138
|
+
border-color: currentcolor transparent;
|
|
139
|
+
border-style: solid;
|
|
140
|
+
border-width: 0.4em 0.4em 0;
|
|
141
|
+
content: "";
|
|
142
|
+
margin-left: 0.3em;
|
|
143
|
+
position: relative;
|
|
144
|
+
transform: translateY(-50%);
|
|
145
|
+
display: inline-block;
|
|
146
|
+
font-size: 0.8rem;
|
|
147
|
+
top: 1px;
|
|
148
|
+
}
|
|
149
149
|
|
|
150
150
|
.openapi__logo {
|
|
151
151
|
width: 250px;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docusaurus-theme-openapi-docs",
|
|
3
3
|
"description": "OpenAPI theme for Docusaurus.",
|
|
4
|
-
"version": "0.0.0-
|
|
4
|
+
"version": "0.0.0-738",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"openapi",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"clsx": "^1.1.1",
|
|
42
42
|
"copy-text-to-clipboard": "^3.1.0",
|
|
43
43
|
"crypto-js": "^4.1.1",
|
|
44
|
-
"docusaurus-plugin-openapi-docs": "0.0.0-
|
|
44
|
+
"docusaurus-plugin-openapi-docs": "0.0.0-738",
|
|
45
45
|
"docusaurus-plugin-sass": "^0.2.3",
|
|
46
46
|
"file-saver": "^2.0.5",
|
|
47
47
|
"lodash": "^4.17.20",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"engines": {
|
|
69
69
|
"node": ">=14"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "4c48921ed3b574960f207d9f5ce8f9de6feab169"
|
|
72
72
|
}
|
package/src/index.ts
CHANGED
|
@@ -18,7 +18,7 @@ export default function docusaurusThemeOpenAPI(): Plugin<void> {
|
|
|
18
18
|
getClientModules() {
|
|
19
19
|
const modules = [
|
|
20
20
|
require.resolve(
|
|
21
|
-
path.join(__dirname, "..", "lib", "theme", "styles.scss")
|
|
21
|
+
path.join(__dirname, "..", "lib", "theme", "styles.scss")
|
|
22
22
|
),
|
|
23
23
|
];
|
|
24
24
|
return modules;
|
package/src/markdown/schema.ts
CHANGED
|
@@ -45,7 +45,7 @@ function prettyName(schema: SchemaObject, circular?: boolean) {
|
|
|
45
45
|
|
|
46
46
|
export function getSchemaName(
|
|
47
47
|
schema: SchemaObject,
|
|
48
|
-
circular?: boolean
|
|
48
|
+
circular?: boolean
|
|
49
49
|
): string {
|
|
50
50
|
if (schema.items) {
|
|
51
51
|
return prettyName(schema.items, circular) + "[]";
|
|
@@ -79,7 +79,7 @@ export function getQualifierMessage(schema?: SchemaObject): string | undefined {
|
|
|
79
79
|
if (schema.items && schema.items.enum) {
|
|
80
80
|
if (schema.items.enum) {
|
|
81
81
|
qualifierGroups.push(
|
|
82
|
-
`[${schema.items.enum.map((e) => `\`${e}\``).join(", ")}]
|
|
82
|
+
`[${schema.items.enum.map((e) => `\`${e}\``).join(", ")}]`
|
|
83
83
|
);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
@@ -150,7 +150,7 @@ export function getQualifierMessage(schema?: SchemaObject): string | undefined {
|
|
|
150
150
|
|
|
151
151
|
if (schema.pattern) {
|
|
152
152
|
qualifierGroups.push(
|
|
153
|
-
`Value must match regular expression \`${schema.pattern}
|
|
153
|
+
`Value must match regular expression \`${schema.pattern}\``
|
|
154
154
|
);
|
|
155
155
|
}
|
|
156
156
|
|
package/src/markdown/utils.ts
CHANGED
|
@@ -22,7 +22,7 @@ export function create(tag: string, props: Props): string {
|
|
|
22
22
|
|
|
23
23
|
export function guard<T>(
|
|
24
24
|
value: T | undefined | string,
|
|
25
|
-
cb: (value: T) => Children
|
|
25
|
+
cb: (value: T) => Children
|
|
26
26
|
): string {
|
|
27
27
|
if (!!value || value === 0) {
|
|
28
28
|
const children = cb(value as T);
|
|
@@ -21,7 +21,7 @@ export default function CodeBlockJSX({ children, className }) {
|
|
|
21
21
|
className={clsx(
|
|
22
22
|
"openapi-explorer__code-block-standalone",
|
|
23
23
|
"thin-scrollbar",
|
|
24
|
-
className
|
|
24
|
+
className
|
|
25
25
|
)}
|
|
26
26
|
>
|
|
27
27
|
<code className="openapi-explorer__code-block-lines">{children}</code>
|
|
@@ -57,7 +57,7 @@ export default function CodeBlockString({
|
|
|
57
57
|
blockClassName,
|
|
58
58
|
language &&
|
|
59
59
|
!blockClassName.includes(`language-${language}`) &&
|
|
60
|
-
`language-${language}
|
|
60
|
+
`language-${language}`
|
|
61
61
|
)}
|
|
62
62
|
>
|
|
63
63
|
{title && (
|
|
@@ -78,14 +78,14 @@ export default function CodeBlockString({
|
|
|
78
78
|
className={clsx(
|
|
79
79
|
className,
|
|
80
80
|
"openapi-explorer__code-block",
|
|
81
|
-
"thin-scrollbar"
|
|
81
|
+
"thin-scrollbar"
|
|
82
82
|
)}
|
|
83
83
|
>
|
|
84
84
|
<code
|
|
85
85
|
className={clsx(
|
|
86
86
|
"openapi-explorer__code-block-lines",
|
|
87
87
|
showLineNumbers &&
|
|
88
|
-
"openapi-explorer__code-block-lines-numbering"
|
|
88
|
+
"openapi-explorer__code-block-lines-numbering"
|
|
89
89
|
)}
|
|
90
90
|
>
|
|
91
91
|
{tokens.map((line, i) => (
|
|
@@ -117,7 +117,7 @@ export default function CodeBlockString({
|
|
|
117
117
|
<ExpandButton
|
|
118
118
|
className={clsx(
|
|
119
119
|
"openapi-explorer__code-block-code-btn",
|
|
120
|
-
"openapi-explorer__expand-btn"
|
|
120
|
+
"openapi-explorer__expand-btn"
|
|
121
121
|
)}
|
|
122
122
|
code={code}
|
|
123
123
|
language={language}
|
|
@@ -48,7 +48,7 @@ export default function CopyButton({ code, className }) {
|
|
|
48
48
|
"clean-btn",
|
|
49
49
|
className,
|
|
50
50
|
"openapi-explorer__code-block-copy-btn",
|
|
51
|
-
isCopied && "openapi-explorer__code-block-copy-btn--copied"
|
|
51
|
+
isCopied && "openapi-explorer__code-block-copy-btn--copied"
|
|
52
52
|
)}
|
|
53
53
|
onClick={handleCopyCode}
|
|
54
54
|
>
|
|
@@ -59,7 +59,7 @@ export default function ExpandButton({
|
|
|
59
59
|
"clean-btn",
|
|
60
60
|
className,
|
|
61
61
|
"openapi-explorer__code-block-expand-btn",
|
|
62
|
-
isModalOpen && "openapi-explorer__code-block-expand-btn--copied"
|
|
62
|
+
isModalOpen && "openapi-explorer__code-block-expand-btn--copied"
|
|
63
63
|
)}
|
|
64
64
|
onClick={() => setIsModalOpen(true)}
|
|
65
65
|
>
|
|
@@ -94,7 +94,7 @@ export default function ExpandButton({
|
|
|
94
94
|
"openapi-explorer__code-block-container",
|
|
95
95
|
language &&
|
|
96
96
|
!blockClassName.includes(`language-${language}`) &&
|
|
97
|
-
`language-${language}
|
|
97
|
+
`language-${language}`
|
|
98
98
|
)}
|
|
99
99
|
>
|
|
100
100
|
{title && (
|
|
@@ -114,14 +114,14 @@ export default function ExpandButton({
|
|
|
114
114
|
className={clsx(
|
|
115
115
|
className,
|
|
116
116
|
"openapi-explorer__code-block",
|
|
117
|
-
"thin-scrollbar"
|
|
117
|
+
"thin-scrollbar"
|
|
118
118
|
)}
|
|
119
119
|
>
|
|
120
120
|
<code
|
|
121
121
|
className={clsx(
|
|
122
122
|
"openapi-explorer__code-block-lines",
|
|
123
123
|
showLineNumbers &&
|
|
124
|
-
"openapi-explorer__code-block-lines-numbers"
|
|
124
|
+
"openapi-explorer__code-block-lines-numbers"
|
|
125
125
|
)}
|
|
126
126
|
>
|
|
127
127
|
{tokens.map((line, i) => (
|
|
@@ -23,7 +23,7 @@ export default function CodeBlockLine({
|
|
|
23
23
|
line,
|
|
24
24
|
className: clsx(
|
|
25
25
|
classNames,
|
|
26
|
-
showLineNumbers && "openapi-explorer__code-block-code-line"
|
|
26
|
+
showLineNumbers && "openapi-explorer__code-block-code-line"
|
|
27
27
|
),
|
|
28
28
|
});
|
|
29
29
|
const lineTokens = line.map((token, key) => (
|
|
@@ -24,7 +24,7 @@ export default function WordWrapButton({ className, onClick, isEnabled }) {
|
|
|
24
24
|
className={clsx(
|
|
25
25
|
"clean-btn",
|
|
26
26
|
className,
|
|
27
|
-
isEnabled && "openapi-explorer__code-block-word-wrap-btn--enabled"
|
|
27
|
+
isEnabled && "openapi-explorer__code-block-word-wrap-btn--enabled"
|
|
28
28
|
)}
|
|
29
29
|
aria-label={title}
|
|
30
30
|
title={title}
|
|
@@ -56,7 +56,7 @@ function Authorization() {
|
|
|
56
56
|
scheme: a.key,
|
|
57
57
|
key: "token",
|
|
58
58
|
value: value ? value : undefined,
|
|
59
|
-
})
|
|
59
|
+
})
|
|
60
60
|
);
|
|
61
61
|
}}
|
|
62
62
|
/>
|
|
@@ -77,7 +77,7 @@ function Authorization() {
|
|
|
77
77
|
scheme: a.key,
|
|
78
78
|
key: "token",
|
|
79
79
|
value: value ? value : undefined,
|
|
80
|
-
})
|
|
80
|
+
})
|
|
81
81
|
);
|
|
82
82
|
}}
|
|
83
83
|
/>
|
|
@@ -99,7 +99,7 @@ function Authorization() {
|
|
|
99
99
|
scheme: a.key,
|
|
100
100
|
key: "username",
|
|
101
101
|
value: value ? value : undefined,
|
|
102
|
-
})
|
|
102
|
+
})
|
|
103
103
|
);
|
|
104
104
|
}}
|
|
105
105
|
/>
|
|
@@ -116,7 +116,7 @@ function Authorization() {
|
|
|
116
116
|
scheme: a.key,
|
|
117
117
|
key: "password",
|
|
118
118
|
value: value ? value : undefined,
|
|
119
|
-
})
|
|
119
|
+
})
|
|
120
120
|
);
|
|
121
121
|
}}
|
|
122
122
|
/>
|
|
@@ -138,7 +138,7 @@ function Authorization() {
|
|
|
138
138
|
scheme: a.key,
|
|
139
139
|
key: "apiKey",
|
|
140
140
|
value: value ? value : undefined,
|
|
141
|
-
})
|
|
141
|
+
})
|
|
142
142
|
);
|
|
143
143
|
}}
|
|
144
144
|
/>
|
|
@@ -130,7 +130,7 @@ export const slice = createSlice({
|
|
|
130
130
|
reducers: {
|
|
131
131
|
setAuthData: (
|
|
132
132
|
state,
|
|
133
|
-
action: PayloadAction<{ scheme: string; key: string; value?: string }
|
|
133
|
+
action: PayloadAction<{ scheme: string; key: string; value?: string }>
|
|
134
134
|
) => {
|
|
135
135
|
const { scheme, key, value } = action.payload;
|
|
136
136
|
state.data[scheme][key] = value;
|
|
@@ -108,7 +108,7 @@ function Body({
|
|
|
108
108
|
setFileRawBody({
|
|
109
109
|
src: `/path/to/${file.name}`,
|
|
110
110
|
content: file,
|
|
111
|
-
})
|
|
111
|
+
})
|
|
112
112
|
);
|
|
113
113
|
}}
|
|
114
114
|
/>
|
|
@@ -148,7 +148,7 @@ function Body({
|
|
|
148
148
|
src: `/path/to/${file.name}`,
|
|
149
149
|
content: file,
|
|
150
150
|
},
|
|
151
|
-
})
|
|
151
|
+
})
|
|
152
152
|
);
|
|
153
153
|
}}
|
|
154
154
|
/>
|
|
@@ -177,7 +177,7 @@ function Body({
|
|
|
177
177
|
setStringFormBody({
|
|
178
178
|
key: key,
|
|
179
179
|
value: val,
|
|
180
|
-
})
|
|
180
|
+
})
|
|
181
181
|
);
|
|
182
182
|
}
|
|
183
183
|
}}
|
|
@@ -204,7 +204,7 @@ function Body({
|
|
|
204
204
|
placeholder={val.description || key}
|
|
205
205
|
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
|
|
206
206
|
dispatch(
|
|
207
|
-
setStringFormBody({ key: key, value: e.target.value })
|
|
207
|
+
setStringFormBody({ key: key, value: e.target.value })
|
|
208
208
|
);
|
|
209
209
|
}}
|
|
210
210
|
/>
|
|
@@ -78,7 +78,7 @@ export const slice = createSlice({
|
|
|
78
78
|
},
|
|
79
79
|
setStringFormBody: (
|
|
80
80
|
state,
|
|
81
|
-
action: PayloadAction<{ key: string; value: string }
|
|
81
|
+
action: PayloadAction<{ key: string; value: string }>
|
|
82
82
|
) => {
|
|
83
83
|
if (state?.type !== "form") {
|
|
84
84
|
return {
|
|
@@ -99,7 +99,7 @@ export const slice = createSlice({
|
|
|
99
99
|
},
|
|
100
100
|
setFileFormBody: (
|
|
101
101
|
state,
|
|
102
|
-
action: PayloadAction<{ key: string; value: FileContent["value"] }
|
|
102
|
+
action: PayloadAction<{ key: string; value: FileContent["value"] }>
|
|
103
103
|
) => {
|
|
104
104
|
if (state?.type !== "form") {
|
|
105
105
|
return {
|
|
@@ -186,7 +186,7 @@ function CodeSnippets({ postman, codeSamples }: Props) {
|
|
|
186
186
|
// Merge user-defined langs into languageSet
|
|
187
187
|
const mergedLangs = mergeCodeSampleLanguage(
|
|
188
188
|
mergeArraysbyLanguage(userDefinedLanguageSet, filteredLanguageSet),
|
|
189
|
-
codeSamples
|
|
189
|
+
codeSamples
|
|
190
190
|
);
|
|
191
191
|
|
|
192
192
|
console.log("merged", mergedLangs);
|
|
@@ -194,7 +194,7 @@ function CodeSnippets({ postman, codeSamples }: Props) {
|
|
|
194
194
|
// Read defaultLang from localStorage
|
|
195
195
|
const defaultLang: Language[] = mergedLangs.filter(
|
|
196
196
|
(lang) =>
|
|
197
|
-
lang.language === localStorage.getItem("docusaurus.tab.code-samples")
|
|
197
|
+
lang.language === localStorage.getItem("docusaurus.tab.code-samples")
|
|
198
198
|
);
|
|
199
199
|
const [selectedVariant, setSelectedVariant] = useState<string | undefined>();
|
|
200
200
|
const [selectedSample, setSelectedSample] = useState<string | undefined>();
|
|
@@ -238,11 +238,11 @@ function CodeSnippets({ postman, codeSamples }: Props) {
|
|
|
238
238
|
return;
|
|
239
239
|
}
|
|
240
240
|
setCodeText(snippet);
|
|
241
|
-
}
|
|
241
|
+
}
|
|
242
242
|
);
|
|
243
243
|
} else if (language && !language.options) {
|
|
244
244
|
const langSource = mergedLangs.filter(
|
|
245
|
-
(lang) => lang.language === language.language
|
|
245
|
+
(lang) => lang.language === language.language
|
|
246
246
|
);
|
|
247
247
|
|
|
248
248
|
// Merges user-defined language with default languageSet
|
|
@@ -271,7 +271,7 @@ function CodeSnippets({ postman, codeSamples }: Props) {
|
|
|
271
271
|
return;
|
|
272
272
|
}
|
|
273
273
|
setCodeText(snippet);
|
|
274
|
-
}
|
|
274
|
+
}
|
|
275
275
|
);
|
|
276
276
|
} else {
|
|
277
277
|
setCodeText("");
|
|
@@ -314,7 +314,7 @@ function CodeSnippets({ postman, codeSamples }: Props) {
|
|
|
314
314
|
return;
|
|
315
315
|
}
|
|
316
316
|
setCodeText(snippet);
|
|
317
|
-
}
|
|
317
|
+
}
|
|
318
318
|
);
|
|
319
319
|
}
|
|
320
320
|
});
|
|
@@ -329,7 +329,7 @@ function CodeSnippets({ postman, codeSamples }: Props) {
|
|
|
329
329
|
selectedSample !== language.sample
|
|
330
330
|
) {
|
|
331
331
|
const sampleIndex = language.samples.findIndex(
|
|
332
|
-
(smp) => smp === selectedSample
|
|
332
|
+
(smp) => smp === selectedSample
|
|
333
333
|
);
|
|
334
334
|
setCodeSampleCodeText(language.samplesSources[sampleIndex]);
|
|
335
335
|
}
|
|
@@ -14,17 +14,17 @@ import { CodeSample, Language } from "./code-snippets-types";
|
|
|
14
14
|
|
|
15
15
|
export function mergeCodeSampleLanguage(
|
|
16
16
|
languages: Language[],
|
|
17
|
-
codeSamples: CodeSample[]
|
|
17
|
+
codeSamples: CodeSample[]
|
|
18
18
|
): Language[] {
|
|
19
19
|
return languages.map((language) => {
|
|
20
20
|
const languageCodeSamples = codeSamples.filter(
|
|
21
|
-
({ lang }) => lang === language.codeSampleLanguage
|
|
21
|
+
({ lang }) => lang === language.codeSampleLanguage
|
|
22
22
|
);
|
|
23
23
|
|
|
24
24
|
if (languageCodeSamples.length) {
|
|
25
25
|
const samples = languageCodeSamples.map(({ lang }) => lang);
|
|
26
26
|
const samplesLabels = languageCodeSamples.map(
|
|
27
|
-
({ label, lang }) => label || lang
|
|
27
|
+
({ label, lang }) => label || lang
|
|
28
28
|
);
|
|
29
29
|
const samplesSources = languageCodeSamples.map(({ source }) => source);
|
|
30
30
|
|
|
@@ -66,7 +66,7 @@ export function getCodeSampleSourceFromLanguage(language: Language) {
|
|
|
66
66
|
language.samplesSources
|
|
67
67
|
) {
|
|
68
68
|
const sampleIndex = language.samples.findIndex(
|
|
69
|
-
(smp) => smp === language.sample
|
|
69
|
+
(smp) => smp === language.sample
|
|
70
70
|
);
|
|
71
71
|
return language.samplesSources[sampleIndex];
|
|
72
72
|
}
|
|
@@ -18,14 +18,12 @@
|
|
|
18
18
|
background-color: var(--ifm-pre-background);
|
|
19
19
|
border-radius: var(--ifm-global-radius);
|
|
20
20
|
border: 1px solid var(--openapi-explorer-border-color);
|
|
21
|
-
box-shadow:
|
|
22
|
-
0 2px 3px hsla(222, 8%, 43%, 0.1),
|
|
21
|
+
box-shadow: 0 2px 3px hsla(222, 8%, 43%, 0.1),
|
|
23
22
|
0 8px 16px -10px hsla(222, 8%, 43%, 0.2);
|
|
24
23
|
transition: 300ms;
|
|
25
24
|
|
|
26
25
|
&:hover {
|
|
27
|
-
box-shadow:
|
|
28
|
-
0 0 0 2px rgba(38, 53, 61, 0.15),
|
|
26
|
+
box-shadow: 0 0 0 2px rgba(38, 53, 61, 0.15),
|
|
29
27
|
0 2px 3px hsla(222, 8%, 43%, 0.15),
|
|
30
28
|
0 16px 16px -10px hsla(222, 8%, 43%, 0.2);
|
|
31
29
|
}
|
|
@@ -44,19 +44,19 @@ function TabList({
|
|
|
44
44
|
let newLanguage;
|
|
45
45
|
if (currentLanguage && includeVariant) {
|
|
46
46
|
newLanguage = languageSet.filter(
|
|
47
|
-
(lang) => lang.language === currentLanguage
|
|
47
|
+
(lang) => lang.language === currentLanguage
|
|
48
48
|
)[0];
|
|
49
49
|
newLanguage.variant = newTabValue;
|
|
50
50
|
action.setSelectedVariant(newTabValue.toLowerCase());
|
|
51
51
|
} else if (currentLanguage && includeSample) {
|
|
52
52
|
newLanguage = languageSet.filter(
|
|
53
|
-
(lang) => lang.language === currentLanguage
|
|
53
|
+
(lang) => lang.language === currentLanguage
|
|
54
54
|
)[0];
|
|
55
55
|
newLanguage.sample = newTabValue;
|
|
56
56
|
action.setSelectedSample(newTabValue);
|
|
57
57
|
} else {
|
|
58
58
|
newLanguage = languageSet.filter(
|
|
59
|
-
(lang) => lang.language === newTabValue
|
|
59
|
+
(lang) => lang.language === newTabValue
|
|
60
60
|
)[0];
|
|
61
61
|
action.setSelectedVariant(newLanguage.variant.toLowerCase());
|
|
62
62
|
action.setSelectedSample(newLanguage.sample);
|
|
@@ -99,7 +99,7 @@ function TabList({
|
|
|
99
99
|
{
|
|
100
100
|
"tabs--block": block,
|
|
101
101
|
},
|
|
102
|
-
className
|
|
102
|
+
className
|
|
103
103
|
)}
|
|
104
104
|
>
|
|
105
105
|
{tabValues.map(({ value, label, attributes }) => (
|
|
@@ -119,7 +119,7 @@ function TabList({
|
|
|
119
119
|
attributes?.className,
|
|
120
120
|
{
|
|
121
121
|
active: selectedValue === value,
|
|
122
|
-
}
|
|
122
|
+
}
|
|
123
123
|
)}
|
|
124
124
|
>
|
|
125
125
|
<span>{label ?? value}</span>
|
|
@@ -134,7 +134,7 @@ function TabContent({ lazy, children, selectedValue }) {
|
|
|
134
134
|
children = Array.isArray(children) ? children : [children];
|
|
135
135
|
if (lazy) {
|
|
136
136
|
const selectedTabItem = children.find(
|
|
137
|
-
(tabItem) => tabItem.props.value === selectedValue
|
|
137
|
+
(tabItem) => tabItem.props.value === selectedValue
|
|
138
138
|
);
|
|
139
139
|
if (!selectedTabItem) {
|
|
140
140
|
// fail-safe or fail-fast? not sure what's best here
|
|
@@ -148,7 +148,7 @@ function TabContent({ lazy, children, selectedValue }) {
|
|
|
148
148
|
cloneElement(tabItem, {
|
|
149
149
|
key: i,
|
|
150
150
|
hidden: tabItem.props.value !== selectedValue,
|
|
151
|
-
})
|
|
151
|
+
})
|
|
152
152
|
)}
|
|
153
153
|
</div>
|
|
154
154
|
);
|
|
@@ -11,9 +11,7 @@
|
|
|
11
11
|
padding: 0.4rem 0.5rem;
|
|
12
12
|
opacity: 0;
|
|
13
13
|
visibility: hidden;
|
|
14
|
-
transition:
|
|
15
|
-
opacity 0.2s ease-in-out,
|
|
16
|
-
visibility 0.2s ease-in-out,
|
|
14
|
+
transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out,
|
|
17
15
|
bottom 0.2s ease-in-out;
|
|
18
16
|
position: absolute;
|
|
19
17
|
right: calc(var(--ifm-pre-padding) / 2);
|
|
@@ -48,7 +48,7 @@ function MethodEndpoint({ method, path }: Props) {
|
|
|
48
48
|
Object.keys(serverValue.variables).forEach((variable) => {
|
|
49
49
|
serverUrlWithVariables = serverUrlWithVariables.replace(
|
|
50
50
|
`{${variable}}`,
|
|
51
|
-
serverValue.variables?.[variable].default ?? ""
|
|
51
|
+
serverValue.variables?.[variable].default ?? ""
|
|
52
52
|
);
|
|
53
53
|
});
|
|
54
54
|
}
|