@redocly/theme 0.17.0 → 0.17.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/components/CodeBlock/CodeBlock.d.ts +29 -1
- package/lib/components/CodeBlock/CodeBlock.js +56 -94
- package/lib/components/CodeBlock/CodeBlockContainer.d.ts +3 -0
- package/lib/components/CodeBlock/CodeBlockContainer.js +120 -0
- package/lib/components/CodeBlock/CodeBlockControlButton.d.ts +5 -0
- package/lib/components/CodeBlock/CodeBlockControlButton.js +63 -0
- package/lib/components/CodeBlock/CodeBlockControls.d.ts +33 -0
- package/lib/components/CodeBlock/CodeBlockControls.js +56 -0
- package/lib/components/CodeBlock/index.d.ts +3 -0
- package/lib/components/CodeBlock/index.js +3 -0
- package/lib/components/CopyButton/CopyButton.d.ts +12 -3
- package/lib/components/CopyButton/CopyButton.js +30 -26
- package/lib/components/CopyButton/index.d.ts +0 -1
- package/lib/components/CopyButton/index.js +0 -1
- package/lib/components/Feedback/useReportDialog.d.ts +12 -6
- package/lib/components/Feedback/useReportDialog.js +13 -5
- package/lib/components/JsonViewer/JsonViewer.d.ts +0 -1
- package/lib/components/JsonViewer/JsonViewer.js +100 -119
- package/lib/components/Markdown/MarkdownWrapper.d.ts +5 -1
- package/lib/components/Markdown/MarkdownWrapper.js +59 -53
- package/lib/components/Menu/MobileMenu.js +2 -2
- package/lib/components/Menu/MobileMenuGroup.js +1 -1
- package/lib/components/Panel/PanelHeader.js +0 -1
- package/lib/components/Tooltip/Tooltip.js +2 -0
- package/lib/components/index.d.ts +0 -3
- package/lib/components/index.js +0 -3
- package/lib/config.d.ts +30 -23
- package/lib/config.js +16 -3
- package/lib/globalStyle.js +50 -7
- package/lib/icons/ArrowIcon/ArrowIcon.d.ts +3 -3
- package/lib/icons/ArrowIcon/ArrowIcon.js +33 -6
- package/lib/icons/CollapseIcon/CollapseIcon.d.ts +7 -0
- package/lib/icons/CollapseIcon/CollapseIcon.js +22 -0
- package/lib/icons/CollapseIcon/index.d.ts +1 -0
- package/lib/{components/SourceCode → icons/CollapseIcon}/index.js +1 -1
- package/lib/icons/CopyIcon/CopyIcon.d.ts +7 -0
- package/lib/icons/CopyIcon/CopyIcon.js +17 -0
- package/lib/icons/CopyIcon/index.d.ts +1 -0
- package/lib/{components/CodeSample → icons/CopyIcon}/index.js +1 -1
- package/lib/icons/DeselectIcon/DeselectIcon.d.ts +7 -0
- package/lib/icons/DeselectIcon/DeselectIcon.js +19 -0
- package/lib/icons/DeselectIcon/index.d.ts +1 -0
- package/lib/{components/SamplesPanelControls → icons/DeselectIcon}/index.js +1 -1
- package/lib/icons/ExpandIcon/ExpandIcon.d.ts +5 -6
- package/lib/icons/ExpandIcon/ExpandIcon.js +10 -19
- package/lib/icons/FileIcon/FileIcon.d.ts +7 -0
- package/lib/icons/FileIcon/FileIcon.js +17 -0
- package/lib/icons/FileIcon/index.d.ts +1 -0
- package/lib/icons/FileIcon/index.js +18 -0
- package/lib/icons/ReportIcon/ReportIcon.d.ts +7 -0
- package/lib/icons/ReportIcon/ReportIcon.js +19 -0
- package/lib/icons/ReportIcon/index.d.ts +1 -0
- package/lib/icons/ReportIcon/index.js +18 -0
- package/lib/icons/SelectIcon/SelectIcon.d.ts +7 -0
- package/lib/icons/SelectIcon/SelectIcon.js +19 -0
- package/lib/icons/SelectIcon/index.d.ts +1 -0
- package/lib/icons/SelectIcon/index.js +18 -0
- package/lib/icons/index.d.ts +7 -1
- package/lib/icons/index.js +7 -1
- package/lib/layouts/Forbidden.js +2 -2
- package/lib/utils/highlight.d.ts +1 -0
- package/lib/utils/highlight.js +1 -0
- package/package.json +1 -1
- package/src/components/CodeBlock/CodeBlock.tsx +100 -0
- package/src/components/CodeBlock/{CodeBlock.ts → CodeBlockContainer.tsx} +23 -6
- package/src/components/CodeBlock/CodeBlockControlButton.tsx +38 -0
- package/src/components/CodeBlock/CodeBlockControls.tsx +182 -0
- package/src/components/CodeBlock/index.ts +3 -0
- package/src/components/CopyButton/CopyButton.tsx +71 -19
- package/src/components/CopyButton/index.ts +0 -1
- package/src/components/Feedback/useReportDialog.ts +24 -14
- package/src/components/JsonViewer/JsonViewer.tsx +112 -142
- package/src/components/Markdown/MarkdownWrapper.tsx +65 -54
- package/src/components/Menu/MobileMenu.tsx +3 -3
- package/src/components/Menu/MobileMenuGroup.tsx +4 -2
- package/src/components/Panel/PanelHeader.ts +0 -1
- package/src/components/Tooltip/Tooltip.tsx +2 -0
- package/src/components/index.ts +0 -3
- package/src/config.ts +18 -7
- package/src/globalStyle.ts +50 -7
- package/src/icons/ArrowIcon/ArrowIcon.tsx +37 -14
- package/src/icons/CollapseIcon/CollapseIcon.tsx +40 -0
- package/src/icons/CollapseIcon/index.tsx +1 -0
- package/src/icons/CopyIcon/CopyIcon.tsx +26 -0
- package/src/icons/CopyIcon/index.ts +1 -0
- package/src/icons/DeselectIcon/DeselectIcon.tsx +28 -0
- package/src/icons/DeselectIcon/index.ts +1 -0
- package/src/icons/ExpandIcon/ExpandIcon.tsx +28 -34
- package/src/icons/FileIcon/FileIcon.tsx +29 -0
- package/src/icons/FileIcon/index.ts +1 -0
- package/src/icons/ReportIcon/ReportIcon.tsx +36 -0
- package/src/icons/ReportIcon/index.ts +1 -0
- package/src/icons/SelectIcon/SelectIcon.tsx +31 -0
- package/src/icons/SelectIcon/index.ts +1 -0
- package/src/icons/index.ts +7 -1
- package/src/layouts/Forbidden.tsx +1 -1
- package/src/utils/highlight.ts +1 -0
- package/lib/components/CodeSample/CodeSample.d.ts +0 -10
- package/lib/components/CodeSample/CodeSample.js +0 -226
- package/lib/components/CodeSample/index.d.ts +0 -1
- package/lib/components/CopyButton/CopyButtonWrapper.d.ts +0 -11
- package/lib/components/CopyButton/CopyButtonWrapper.js +0 -53
- package/lib/components/SamplesPanelControls/SamplesPanelControls.d.ts +0 -4
- package/lib/components/SamplesPanelControls/SamplesPanelControls.js +0 -76
- package/lib/components/SamplesPanelControls/index.d.ts +0 -1
- package/lib/components/SourceCode/SourceCode.d.ts +0 -33
- package/lib/components/SourceCode/SourceCode.js +0 -60
- package/lib/components/SourceCode/index.d.ts +0 -1
- package/src/components/CodeSample/CodeSample.tsx +0 -257
- package/src/components/CodeSample/index.ts +0 -1
- package/src/components/CopyButton/CopyButtonWrapper.tsx +0 -55
- package/src/components/SamplesPanelControls/SamplesPanelControls.ts +0 -76
- package/src/components/SamplesPanelControls/index.ts +0 -1
- package/src/components/SourceCode/SourceCode.tsx +0 -128
- package/src/components/SourceCode/index.ts +0 -1
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import React, { memo, useRef } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
-
import type { ReactElement } from 'react';
|
|
5
|
-
|
|
6
|
-
import { CopyButtonWrapper } from '@theme/components/CopyButton';
|
|
7
|
-
import { SampleControls, SamplesControlButton } from '@theme/components/SamplesPanelControls';
|
|
8
4
|
import { jsonToHTML } from '@theme/utils';
|
|
9
5
|
import { useMount, useUnmount } from '@theme/hooks';
|
|
10
6
|
import { CodeBlock } from '@theme/components/CodeBlock';
|
|
@@ -26,7 +22,7 @@ function JsonComponent({
|
|
|
26
22
|
startLineNumber,
|
|
27
23
|
onCopyClick,
|
|
28
24
|
}: JsonProps): JSX.Element {
|
|
29
|
-
const node = useRef<
|
|
25
|
+
const node = useRef<HTMLPreElement | null>(null);
|
|
30
26
|
|
|
31
27
|
useMount(() => {
|
|
32
28
|
node?.current?.addEventListener('click', clickListener);
|
|
@@ -36,6 +32,13 @@ function JsonComponent({
|
|
|
36
32
|
node?.current?.removeEventListener('click', clickListener);
|
|
37
33
|
});
|
|
38
34
|
|
|
35
|
+
const setRef = (instance?: HTMLPreElement | null) => {
|
|
36
|
+
if (instance) node.current = instance;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const showFoldingButtons =
|
|
40
|
+
data && Object.values(data).some((value) => typeof value === 'object' && value !== null);
|
|
41
|
+
|
|
39
42
|
const expandAll = () => {
|
|
40
43
|
const elements = node?.current?.getElementsByClassName('collapsible');
|
|
41
44
|
for (const collapsed of Array.prototype.slice.call(elements)) {
|
|
@@ -76,40 +79,25 @@ function JsonComponent({
|
|
|
76
79
|
collapseElement(event.target as HTMLElement);
|
|
77
80
|
};
|
|
78
81
|
|
|
79
|
-
const renderInner = ({ renderCopyButton }: { renderCopyButton: () => ReactElement }) => {
|
|
80
|
-
const showFoldingButtons =
|
|
81
|
-
data && Object.values(data).some((value) => typeof value === 'object' && value !== null);
|
|
82
|
-
|
|
83
|
-
return (
|
|
84
|
-
<JsonViewerWrap data-cy="json-viewer">
|
|
85
|
-
<SampleControls data-cy="buttons">
|
|
86
|
-
{renderCopyButton()}
|
|
87
|
-
{showFoldingButtons && (
|
|
88
|
-
<>
|
|
89
|
-
<SamplesControlButton onClick={expandAll} data-cy="expand-all">
|
|
90
|
-
Expand all
|
|
91
|
-
</SamplesControlButton>
|
|
92
|
-
<SamplesControlButton onClick={collapseAll} data-cy="collapse-all">
|
|
93
|
-
Collapse all
|
|
94
|
-
</SamplesControlButton>
|
|
95
|
-
</>
|
|
96
|
-
)}
|
|
97
|
-
</SampleControls>
|
|
98
|
-
<StyledCodeBlock
|
|
99
|
-
className={withLineNumbers ? `${className} line-numbers` : className}
|
|
100
|
-
ref={node}
|
|
101
|
-
dangerouslySetInnerHTML={{
|
|
102
|
-
__html: jsonToHTML(data, jsonSampleExpandLevel, startLineNumber),
|
|
103
|
-
}}
|
|
104
|
-
/>
|
|
105
|
-
</JsonViewerWrap>
|
|
106
|
-
);
|
|
107
|
-
};
|
|
108
|
-
|
|
109
82
|
return (
|
|
110
|
-
<
|
|
111
|
-
|
|
112
|
-
|
|
83
|
+
<JsonViewerWrap
|
|
84
|
+
data-cy="json-viewer"
|
|
85
|
+
data-component-name="JsonViewer/JsonViewer"
|
|
86
|
+
className={className}
|
|
87
|
+
>
|
|
88
|
+
<CodeBlock
|
|
89
|
+
header={{
|
|
90
|
+
controls: {
|
|
91
|
+
copy: { data, onClick: onCopyClick, handleOutside: true },
|
|
92
|
+
expand: showFoldingButtons ? { onClick: expandAll } : undefined,
|
|
93
|
+
collapse: showFoldingButtons ? { onClick: collapseAll } : undefined,
|
|
94
|
+
},
|
|
95
|
+
}}
|
|
96
|
+
codeBlockRef={setRef}
|
|
97
|
+
withLineNumbers={withLineNumbers}
|
|
98
|
+
highlightedHtml={jsonToHTML(data, jsonSampleExpandLevel, startLineNumber)}
|
|
99
|
+
/>
|
|
100
|
+
</JsonViewerWrap>
|
|
113
101
|
);
|
|
114
102
|
}
|
|
115
103
|
|
|
@@ -125,113 +113,109 @@ export const JsonViewer = styled(Json).attrs(() => ({
|
|
|
125
113
|
border: none;
|
|
126
114
|
}
|
|
127
115
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
pointer-events: none;
|
|
150
|
-
user-select: none;
|
|
151
|
-
padding: 0 0.5em;
|
|
152
|
-
font-size: 13px;
|
|
116
|
+
pre {
|
|
117
|
+
contain: content;
|
|
118
|
+
overflow-x: auto;
|
|
119
|
+
position: relative;
|
|
120
|
+
border-radius: 0 0 var(--border-radius) var(--border-radius);
|
|
121
|
+
|
|
122
|
+
&.line-numbers {
|
|
123
|
+
padding: 20px 20px 20px 3em;
|
|
124
|
+
|
|
125
|
+
*[data-line]:not(.collapsed *[data-line]) {
|
|
126
|
+
&:before {
|
|
127
|
+
content: attr(data-line);
|
|
128
|
+
position: absolute;
|
|
129
|
+
left: 0;
|
|
130
|
+
min-width: 2em;
|
|
131
|
+
text-align: right;
|
|
132
|
+
pointer-events: none;
|
|
133
|
+
user-select: none;
|
|
134
|
+
padding: 0 0.5em;
|
|
135
|
+
font-size: 13px;
|
|
136
|
+
}
|
|
153
137
|
}
|
|
154
138
|
}
|
|
155
|
-
}
|
|
156
139
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
140
|
+
.callback-function {
|
|
141
|
+
color: gray;
|
|
142
|
+
}
|
|
160
143
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
144
|
+
.ellipsis:after {
|
|
145
|
+
content: ' … ';
|
|
146
|
+
}
|
|
164
147
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
148
|
+
.collapsible {
|
|
149
|
+
padding-left: 2ch;
|
|
150
|
+
display: inline-block;
|
|
151
|
+
}
|
|
169
152
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
153
|
+
.hoverable {
|
|
154
|
+
padding: 1px 2px;
|
|
155
|
+
display: inline-block;
|
|
156
|
+
}
|
|
174
157
|
|
|
175
|
-
|
|
176
|
-
|
|
158
|
+
.collapsed {
|
|
159
|
+
white-space: nowrap;
|
|
177
160
|
|
|
178
|
-
|
|
179
|
-
|
|
161
|
+
& > .collapser:after {
|
|
162
|
+
content: '+';
|
|
163
|
+
}
|
|
180
164
|
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
.hovered {
|
|
184
|
-
background-color: rgba(235, 238, 249, 1);
|
|
185
|
-
}
|
|
186
165
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
--margin-right: 3px;
|
|
190
|
-
|
|
191
|
-
display: inline-block;
|
|
192
|
-
background-color: transparent;
|
|
193
|
-
border: 0;
|
|
194
|
-
padding: 1px;
|
|
195
|
-
color: #fff;
|
|
196
|
-
width: var(--size);
|
|
197
|
-
height: var(--size);
|
|
198
|
-
margin-left: calc((var(--size) + var(--margin-right)) * -1);
|
|
199
|
-
margin-right: var(--margin-right);
|
|
200
|
-
cursor: pointer;
|
|
201
|
-
user-select: none;
|
|
202
|
-
-webkit-user-select: none;
|
|
203
|
-
font-family: var(--code-font-family);
|
|
204
|
-
font-size: var(--code-font-size);
|
|
205
|
-
|
|
206
|
-
&:after {
|
|
207
|
-
content: '-';
|
|
208
|
-
display: flex;
|
|
209
|
-
align-items: center;
|
|
210
|
-
justify-content: center;
|
|
211
|
-
height: 100%;
|
|
212
|
-
width: 100%;
|
|
166
|
+
.hovered {
|
|
167
|
+
background-color: rgba(235, 238, 249, 1);
|
|
213
168
|
}
|
|
214
169
|
|
|
215
|
-
|
|
216
|
-
|
|
170
|
+
.collapser {
|
|
171
|
+
--size: 15px;
|
|
172
|
+
--margin-right: 3px;
|
|
173
|
+
|
|
174
|
+
display: inline-block;
|
|
175
|
+
background-color: transparent;
|
|
176
|
+
border: 0;
|
|
177
|
+
padding: 1px;
|
|
178
|
+
color: #fff;
|
|
179
|
+
width: var(--size);
|
|
180
|
+
height: var(--size);
|
|
181
|
+
margin-left: calc((var(--size) + var(--margin-right)) * -1);
|
|
182
|
+
margin-right: var(--margin-right);
|
|
183
|
+
cursor: pointer;
|
|
184
|
+
user-select: none;
|
|
185
|
+
-webkit-user-select: none;
|
|
186
|
+
font-family: var(--code-font-family);
|
|
187
|
+
font-size: var(--code-font-size);
|
|
188
|
+
|
|
189
|
+
&:after {
|
|
190
|
+
content: '-';
|
|
191
|
+
display: flex;
|
|
192
|
+
align-items: center;
|
|
193
|
+
justify-content: center;
|
|
194
|
+
height: 100%;
|
|
195
|
+
width: 100%;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
&:focus {
|
|
199
|
+
outline: #fff dotted 1px;
|
|
200
|
+
}
|
|
217
201
|
}
|
|
218
|
-
}
|
|
219
202
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
203
|
+
.selected {
|
|
204
|
+
outline-width: 1px;
|
|
205
|
+
outline-style: dotted;
|
|
206
|
+
}
|
|
224
207
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
208
|
+
.collapsed > .collapsible {
|
|
209
|
+
display: none;
|
|
210
|
+
}
|
|
228
211
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
212
|
+
.ellipsis {
|
|
213
|
+
display: none;
|
|
214
|
+
}
|
|
232
215
|
|
|
233
|
-
|
|
234
|
-
|
|
216
|
+
.collapsed > .ellipsis {
|
|
217
|
+
display: inline;
|
|
218
|
+
}
|
|
235
219
|
}
|
|
236
220
|
`;
|
|
237
221
|
|
|
@@ -239,18 +223,4 @@ export const JsonViewerWrap = styled.div`
|
|
|
239
223
|
display: flex;
|
|
240
224
|
flex-direction: column;
|
|
241
225
|
flex: 1;
|
|
242
|
-
|
|
243
|
-
&:hover > ${SampleControls} {
|
|
244
|
-
opacity: 1;
|
|
245
|
-
}
|
|
246
|
-
`;
|
|
247
|
-
|
|
248
|
-
export const StyledCodeBlock = styled(CodeBlock)`
|
|
249
|
-
flex: 1;
|
|
250
|
-
|
|
251
|
-
code {
|
|
252
|
-
font-family: var(--code-font-family);
|
|
253
|
-
font-size: 14px;
|
|
254
|
-
line-height: 18px;
|
|
255
|
-
}
|
|
256
226
|
`;
|
|
@@ -84,6 +84,29 @@ export const baseTable = css`
|
|
|
84
84
|
}
|
|
85
85
|
`;
|
|
86
86
|
|
|
87
|
+
export const linksCss = css`
|
|
88
|
+
a:not([role='button']) {
|
|
89
|
+
text-decoration: var(--link-decoration);
|
|
90
|
+
color: var(--link-text-color);
|
|
91
|
+
font-weight: var(--link-font-weight);
|
|
92
|
+
|
|
93
|
+
&:visited {
|
|
94
|
+
color: var(--link-visited-text-color);
|
|
95
|
+
text-decoration: var(--link-visited-decoration);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
&:hover {
|
|
99
|
+
text-decoration: var(--link-hover-decoration);
|
|
100
|
+
color: var(--link-hover-text-color);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&:focus {
|
|
104
|
+
color: var(--link-active-text-color);
|
|
105
|
+
text-decoration: var(--link-active-decoration);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
`;
|
|
109
|
+
|
|
87
110
|
// TODO: Can users specify another className or we should hardcode it?
|
|
88
111
|
export function headingAnchor(className = 'anchor'): FlattenSimpleInterpolation {
|
|
89
112
|
return css`
|
|
@@ -117,10 +140,12 @@ export function headingAnchor(className = 'anchor'): FlattenSimpleInterpolation
|
|
|
117
140
|
`;
|
|
118
141
|
}
|
|
119
142
|
|
|
120
|
-
export const MarkdownWrapper = styled.main.attrs<{
|
|
143
|
+
export const MarkdownWrapper = styled.main.attrs<{
|
|
144
|
+
className?: string;
|
|
145
|
+
}>(({ className }) => ({
|
|
121
146
|
'data-component-name': 'Markdown/MarkdownWrapper',
|
|
122
147
|
className,
|
|
123
|
-
}))
|
|
148
|
+
}))<{ compact?: boolean; inline?: boolean }>`
|
|
124
149
|
font-weight: var(--font-weight-regular);
|
|
125
150
|
padding: 0;
|
|
126
151
|
|
|
@@ -129,26 +154,26 @@ export const MarkdownWrapper = styled.main.attrs<{ className?: string }>(({ clas
|
|
|
129
154
|
font-family: var(--font-family-base);
|
|
130
155
|
line-height: var(--line-height-base);
|
|
131
156
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
157
|
+
${({ compact }) =>
|
|
158
|
+
compact &&
|
|
159
|
+
css`
|
|
160
|
+
p:first-child {
|
|
161
|
+
margin-top: 0;
|
|
162
|
+
}
|
|
163
|
+
p:last-child {
|
|
164
|
+
margin-bottom: 0;
|
|
165
|
+
}
|
|
166
|
+
`}
|
|
141
167
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
168
|
+
${({ inline }) =>
|
|
169
|
+
inline &&
|
|
170
|
+
css`
|
|
171
|
+
p {
|
|
172
|
+
display: inline-block;
|
|
173
|
+
}
|
|
174
|
+
`}
|
|
146
175
|
|
|
147
|
-
|
|
148
|
-
color: var(--link-active-text-color);
|
|
149
|
-
text-decoration: var(--link-active-decoration);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
176
|
+
${linksCss}
|
|
152
177
|
|
|
153
178
|
img {
|
|
154
179
|
max-width: 100%;
|
|
@@ -200,40 +225,6 @@ export const MarkdownWrapper = styled.main.attrs<{ className?: string }>(({ clas
|
|
|
200
225
|
|
|
201
226
|
${baseTable};
|
|
202
227
|
|
|
203
|
-
.code-snippets-tabs {
|
|
204
|
-
.snippets-tabs-headers {
|
|
205
|
-
font-size: 0.9em;
|
|
206
|
-
|
|
207
|
-
font-family: var(--heading-font-family);
|
|
208
|
-
|
|
209
|
-
.tab-header {
|
|
210
|
-
text-align: center;
|
|
211
|
-
padding: 0.2em 0.5em;
|
|
212
|
-
display: inline-block;
|
|
213
|
-
cursor: pointer;
|
|
214
|
-
color: var(--text-color-secondary);
|
|
215
|
-
|
|
216
|
-
&.active {
|
|
217
|
-
color: var(--heading-text-color);
|
|
218
|
-
font-weight: var(--font-weight-bold);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
.tab-content {
|
|
224
|
-
margin-top: 4px;
|
|
225
|
-
display: none;
|
|
226
|
-
|
|
227
|
-
pre {
|
|
228
|
-
margin-top: 0;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
&.active {
|
|
232
|
-
display: block;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
228
|
p {
|
|
238
229
|
margin: var(--md-paragraph-margin-vertical) var(--md-paragraph-margin-horizontal);
|
|
239
230
|
|
|
@@ -318,6 +309,26 @@ export const MarkdownWrapper = styled.main.attrs<{ className?: string }>(({ clas
|
|
|
318
309
|
font-family: var(--code-font-family);
|
|
319
310
|
}
|
|
320
311
|
|
|
312
|
+
pre {
|
|
313
|
+
white-space: var(--code-wrap, pre);
|
|
314
|
+
background-color: var(--code-block-background-color);
|
|
315
|
+
font-family: var(--code-block-font-family);
|
|
316
|
+
color: var(--code-block-text-color);
|
|
317
|
+
padding: calc(var(--spacing-unit) * 2);
|
|
318
|
+
overflow-x: auto;
|
|
319
|
+
line-height: normal;
|
|
320
|
+
border-radius: var(--code-block-border-radius);
|
|
321
|
+
border: 1px solid var(--code-block-border-color);
|
|
322
|
+
|
|
323
|
+
code {
|
|
324
|
+
background-color: transparent;
|
|
325
|
+
color: inherit;
|
|
326
|
+
font-size: inherit;
|
|
327
|
+
font-family: inherit;
|
|
328
|
+
border: none;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
321
332
|
blockquote {
|
|
322
333
|
margin: var(--md-blockquote-margin-vertical) var(--md-blockquote-margin-horizontal);
|
|
323
334
|
padding: var(--md-blockquote-padding-vertical) var(--md-blockquote-padding-horizontal);
|
|
@@ -10,7 +10,7 @@ import type { ItemState } from '@portal/Sidebar/types';
|
|
|
10
10
|
import { MobileUserProfile } from '@theme/components/Navbar/MobileUserProfile';
|
|
11
11
|
import { getPathnameForLocale } from '@portal/utils';
|
|
12
12
|
import { useI18nConfig, useTranslate } from '@portal/hooks';
|
|
13
|
-
import {
|
|
13
|
+
import { ArrowIcon } from '@theme/icons';
|
|
14
14
|
|
|
15
15
|
interface MobileMenuProps {
|
|
16
16
|
navItems: ResolvedNavItem[];
|
|
@@ -88,7 +88,7 @@ export function MobileMenu({
|
|
|
88
88
|
data-component-name="Menu/ControlButton"
|
|
89
89
|
onClick={() => setMenuLevel(MenuLevel.NAVBAR)}
|
|
90
90
|
>
|
|
91
|
-
<
|
|
91
|
+
<ArrowIcon direction="left" weight="thin" />
|
|
92
92
|
<ControlButtonLabel paddingDirection="left">
|
|
93
93
|
{translate(translationKeys.mainMenu, 'Main Menu')}
|
|
94
94
|
</ControlButtonLabel>
|
|
@@ -102,7 +102,7 @@ export function MobileMenu({
|
|
|
102
102
|
<ControlButtonLabel paddingDirection="right">
|
|
103
103
|
{translate(translationKeys.previous, 'Previous')}
|
|
104
104
|
</ControlButtonLabel>
|
|
105
|
-
<
|
|
105
|
+
<ArrowIcon direction="right" weight="thin" />
|
|
106
106
|
</ControlButton>
|
|
107
107
|
)}
|
|
108
108
|
</ButtonsSection>
|
|
@@ -6,7 +6,7 @@ import { MenuItemLabel } from '@theme/components/Menu/MenuItemLabel';
|
|
|
6
6
|
import { SeparatorLine } from '@theme/components/Separator/SeparatorLine';
|
|
7
7
|
import type { ItemState } from '@theme/components/Sidebar/types';
|
|
8
8
|
import { useTranslate } from '@portal/hooks';
|
|
9
|
-
import {
|
|
9
|
+
import { ArrowIcon } from '@theme/icons';
|
|
10
10
|
|
|
11
11
|
interface MenuGroupProps {
|
|
12
12
|
item: ItemState;
|
|
@@ -29,7 +29,9 @@ export function MobileMenuGroup({
|
|
|
29
29
|
<LabelContainer>
|
|
30
30
|
<Label>{translate(item.labelTranslationKey, item.label)}</Label>
|
|
31
31
|
</LabelContainer>
|
|
32
|
-
{!!item.items.length &&
|
|
32
|
+
{!!item.items.length && (
|
|
33
|
+
<ArrowIcon direction={isExpanded ? 'down' : 'right'} weight="thin" />
|
|
34
|
+
)}
|
|
33
35
|
</MenuGroupLabel>
|
|
34
36
|
</MenuLinkItem>
|
|
35
37
|
<MenuWrapper isExpanded={isExpanded}>{children}</MenuWrapper>
|
package/src/components/index.ts
CHANGED
|
@@ -13,9 +13,7 @@ export * from './CodeBlock';
|
|
|
13
13
|
export * from './OpenApiDocs/hooks/OpenApiFooter';
|
|
14
14
|
export * from './OpenApiDocs/hooks/OpenApiHeader';
|
|
15
15
|
export * from './OpenApiDocs/hooks/OpenApiTryItSecurityPanel';
|
|
16
|
-
export * from './SamplesPanelControls';
|
|
17
16
|
export * from './Tooltip';
|
|
18
|
-
export * from './SourceCode';
|
|
19
17
|
export * from './Panel';
|
|
20
18
|
export * from './Feedback';
|
|
21
19
|
export * from './OperationBadge';
|
|
@@ -28,7 +26,6 @@ export * from './OpenApiDocs';
|
|
|
28
26
|
export * from './SidebarActions';
|
|
29
27
|
export * from './Filter';
|
|
30
28
|
export * from './Tags';
|
|
31
|
-
export * from './CodeSample';
|
|
32
29
|
export * from './Tabs';
|
|
33
30
|
export * from './Menu';
|
|
34
31
|
export * from './Separator';
|
package/src/config.ts
CHANGED
|
@@ -434,28 +434,39 @@ export const themeConfigSchema = {
|
|
|
434
434
|
codeSnippet: {
|
|
435
435
|
type: 'object',
|
|
436
436
|
properties: {
|
|
437
|
+
controlsStyle: { type: 'string', default: 'icon' },
|
|
437
438
|
copy: {
|
|
438
439
|
type: 'object',
|
|
439
440
|
properties: {
|
|
440
|
-
buttonText: { type: 'string', default: 'Copy' },
|
|
441
|
-
tooltipText: { type: 'string', default: 'Copy to clipboard' },
|
|
442
|
-
toasterText: { type: 'string', default: 'Copied!' },
|
|
443
|
-
toasterDuration: { type: 'number', default: 1500 },
|
|
444
441
|
...hideConfigSchema.properties,
|
|
445
442
|
},
|
|
446
443
|
additionalProperties: false,
|
|
447
|
-
default: {},
|
|
444
|
+
default: { hide: false },
|
|
448
445
|
},
|
|
449
446
|
report: {
|
|
450
447
|
type: 'object',
|
|
451
448
|
properties: {
|
|
452
|
-
tooltipText: { type: 'string', default: 'Report a problem' },
|
|
453
|
-
label: { type: 'string' },
|
|
454
449
|
...hideConfigSchema.properties,
|
|
455
450
|
},
|
|
456
451
|
additionalProperties: false,
|
|
457
452
|
default: { hide: true },
|
|
458
453
|
},
|
|
454
|
+
expand: {
|
|
455
|
+
type: 'object',
|
|
456
|
+
properties: {
|
|
457
|
+
...hideConfigSchema.properties,
|
|
458
|
+
},
|
|
459
|
+
additionalProperties: false,
|
|
460
|
+
default: { hide: false },
|
|
461
|
+
},
|
|
462
|
+
collapse: {
|
|
463
|
+
type: 'object',
|
|
464
|
+
properties: {
|
|
465
|
+
...hideConfigSchema.properties,
|
|
466
|
+
},
|
|
467
|
+
additionalProperties: false,
|
|
468
|
+
default: { hide: false },
|
|
469
|
+
},
|
|
459
470
|
},
|
|
460
471
|
additionalProperties: false,
|
|
461
472
|
default: {},
|