@redocly/theme 0.45.2-rc.1 → 0.45.3
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 +1 -2
- package/lib/components/CodeBlock/CodeBlock.js +9 -31
- package/lib/components/CodeBlock/CodeBlockContainer.d.ts +1 -1
- package/lib/components/CodeBlock/CodeBlockContainer.js +13 -242
- package/lib/components/CodeBlock/variables.js +0 -30
- package/lib/components/Feedback/Feedback.js +2 -1
- package/lib/components/Filter/FilterContent.js +4 -1
- package/lib/components/Footer/FooterColumn.js +1 -1
- package/lib/components/Markdown/variables.js +1 -1
- package/lib/components/Menu/MenuMobile.js +4 -1
- package/lib/components/Search/SearchFilterField.js +2 -2
- package/lib/components/UserMenu/LogoutMenuItem.js +1 -1
- package/lib/components/UserMenu/UserMenu.js +2 -2
- package/lib/core/constants/common.d.ts +1 -0
- package/lib/core/constants/common.js +2 -1
- package/lib/core/types/hooks.d.ts +0 -7
- package/lib/core/utils/highlight.d.ts +35 -0
- package/lib/core/utils/highlight.js +129 -0
- package/lib/core/utils/index.d.ts +1 -1
- package/lib/core/utils/index.js +1 -1
- package/lib/core/utils/type-guards.d.ts +6 -0
- package/lib/core/utils/type-guards.js +9 -1
- package/package.json +3 -1
- package/src/components/CodeBlock/CodeBlock.tsx +7 -19
- package/src/components/CodeBlock/CodeBlockContainer.tsx +14 -243
- package/src/components/CodeBlock/variables.ts +0 -30
- package/src/components/Feedback/Feedback.tsx +2 -1
- package/src/components/Filter/FilterContent.tsx +6 -1
- package/src/components/Footer/FooterColumn.tsx +2 -2
- package/src/components/Markdown/variables.ts +1 -1
- package/src/components/Menu/MenuMobile.tsx +4 -1
- package/src/components/Search/SearchFilterField.tsx +1 -1
- package/src/components/UserMenu/LogoutMenuItem.tsx +1 -2
- package/src/components/UserMenu/UserMenu.tsx +1 -1
- package/src/core/constants/common.ts +2 -0
- package/src/core/types/hooks.ts +0 -10
- package/src/core/utils/highlight.ts +125 -0
- package/src/core/utils/index.ts +1 -1
- package/src/core/utils/type-guards.ts +12 -0
- package/lib/core/utils/add-line-numbers.d.ts +0 -6
- package/lib/core/utils/add-line-numbers.js +0 -19
- package/src/core/utils/add-line-numbers.ts +0 -17
|
@@ -16,7 +16,6 @@ export type CodeBlockProps = {
|
|
|
16
16
|
codeBlockMaxHeight?: string;
|
|
17
17
|
hideCodeColors?: boolean;
|
|
18
18
|
wrapContents?: boolean;
|
|
19
|
-
[key: string]: unknown;
|
|
20
19
|
};
|
|
21
20
|
type UnstableExternalCodeSample = {
|
|
22
21
|
lang: string;
|
|
@@ -37,5 +36,5 @@ type ExternalSource = {
|
|
|
37
36
|
properties?: any;
|
|
38
37
|
operation?: any;
|
|
39
38
|
};
|
|
40
|
-
export declare function CodeBlock({ lang, source, externalSource, header, dataTestId, codeBlockRef, highlightedHtml, withLineNumbers, startLineNumber, className, codeBlockMaxHeight, tabs, hideCodeColors, wrapContents, children,
|
|
39
|
+
export declare function CodeBlock({ lang, source, externalSource, header, dataTestId, codeBlockRef, highlightedHtml, withLineNumbers, startLineNumber, className, codeBlockMaxHeight, tabs, hideCodeColors, wrapContents, children, }: React.PropsWithChildren<CodeBlockProps>): JSX.Element;
|
|
41
40
|
export {};
|
|
@@ -22,17 +22,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
-
var t = {};
|
|
27
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
-
t[p] = s[p];
|
|
29
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
-
t[p[i]] = s[p[i]];
|
|
33
|
-
}
|
|
34
|
-
return t;
|
|
35
|
-
};
|
|
36
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
27
|
};
|
|
@@ -45,23 +34,10 @@ const hooks_1 = require("../../core/hooks");
|
|
|
45
34
|
const ReportDialog_1 = require("../../components/Feedback/ReportDialog");
|
|
46
35
|
const CodeBlockContainer_1 = require("../../components/CodeBlock/CodeBlockContainer");
|
|
47
36
|
const CodeBlockControls_1 = require("../../components/CodeBlock/CodeBlockControls");
|
|
48
|
-
function CodeBlock(
|
|
49
|
-
var _b, _c, _d, _e, _f
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
const { useCodeHighlight } = (0, hooks_1.useThemeHooks)();
|
|
53
|
-
const { highlight } = useCodeHighlight() || {};
|
|
54
|
-
const highlightedCode = highlightedHtml
|
|
55
|
-
? withLineNumbers
|
|
56
|
-
? (0, utils_1.addLineNumbers)(highlightedHtml, startLineNumber)
|
|
57
|
-
: highlightedHtml
|
|
58
|
-
: children
|
|
59
|
-
? null
|
|
60
|
-
: highlight === null || highlight === void 0 ? void 0 : highlight(sourceCode, lang, {
|
|
61
|
-
withLineNumbers,
|
|
62
|
-
startLineNumber,
|
|
63
|
-
highlight: rest['data-highlight'],
|
|
64
|
-
});
|
|
37
|
+
function CodeBlock({ lang, source, externalSource, header, dataTestId = 'source-code', codeBlockRef, highlightedHtml, withLineNumbers, startLineNumber, className, codeBlockMaxHeight, tabs, hideCodeColors, wrapContents = false, children, }) {
|
|
38
|
+
var _a, _b, _c, _d, _e, _f;
|
|
39
|
+
const [sourceCode, setSourceCode] = (0, react_1.useState)((_c = (source || ((_b = (_a = externalSource === null || externalSource === void 0 ? void 0 : externalSource.sample) === null || _a === void 0 ? void 0 : _a.get) === null || _b === void 0 ? void 0 : _b.call(_a, externalSource)))) !== null && _c !== void 0 ? _c : '');
|
|
40
|
+
const highlightedCode = highlightedHtml || (children ? null : (0, utils_1.highlight)(sourceCode, lang));
|
|
65
41
|
// The same initial value should be returned for ssr and frontend to avoid issues
|
|
66
42
|
// Because we don't have session storage in ssr and can't get the security details there
|
|
67
43
|
// Issue for more details https://github.com/Redocly/reference-docs/issues/888
|
|
@@ -74,13 +50,15 @@ function CodeBlock(_a) {
|
|
|
74
50
|
}, [source, externalSource]);
|
|
75
51
|
const { reportDialog, reportButton } = (0, hooks_1.useReportDialog)();
|
|
76
52
|
(0, hooks_1.useModalScrollLock)(Boolean(reportDialog.visible));
|
|
77
|
-
const controls = (header === null || header === void 0 ? void 0 : header.controls) && Object.assign(Object.assign({}, header === null || header === void 0 ? void 0 : header.controls), { report: Object.assign(Object.assign({}, (
|
|
53
|
+
const controls = (header === null || header === void 0 ? void 0 : header.controls) && Object.assign(Object.assign({}, header === null || header === void 0 ? void 0 : header.controls), { report: Object.assign(Object.assign({}, (_d = header === null || header === void 0 ? void 0 : header.controls) === null || _d === void 0 ? void 0 : _d.report), { props: reportButton.props }), copy: ((_e = header === null || header === void 0 ? void 0 : header.controls) === null || _e === void 0 ? void 0 : _e.copy) ? Object.assign(Object.assign({}, (_f = header === null || header === void 0 ? void 0 : header.controls) === null || _f === void 0 ? void 0 : _f.copy), { data: sourceCode }) : undefined });
|
|
78
54
|
return (react_1.default.createElement(CodeBlockWrapper, { "data-component-name": "CodeBlock/CodeBlock", className: className },
|
|
79
55
|
react_1.default.createElement(ContainerWrapper, null,
|
|
80
56
|
react_1.default.createElement(CodeBlockControls_1.CodeBlockControls, { tabs: tabs, className: header === null || header === void 0 ? void 0 : header.className, title: header === null || header === void 0 ? void 0 : header.title, controls: controls }),
|
|
81
|
-
react_1.default.createElement(CodeBlockContainer_1.CodeBlockContainer, { ref: codeBlockRef, withLineNumbers:
|
|
57
|
+
react_1.default.createElement(CodeBlockContainer_1.CodeBlockContainer, { ref: codeBlockRef, className: withLineNumbers ? 'line-numbers' : '', dangerouslySetInnerHTML: highlightedCode
|
|
82
58
|
? {
|
|
83
|
-
__html:
|
|
59
|
+
__html: withLineNumbers
|
|
60
|
+
? (0, utils_1.addLineNumbers)(highlightedCode, startLineNumber)
|
|
61
|
+
: highlightedCode,
|
|
84
62
|
}
|
|
85
63
|
: undefined, suppressHydrationWarning // TODO: investigate issue
|
|
86
64
|
: true, "data-testid": dataTestId, hideCodeColors: hideCodeColors, maxHeight: codeBlockMaxHeight, wrapContents: wrapContents, tabIndex: 0 }, children),
|
|
@@ -127,258 +127,29 @@ const CodeBlockContainerComponent = styled_components_1.default.pre `
|
|
|
127
127
|
cursor: help;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
.line
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
130
|
+
.code-line {
|
|
131
|
+
&:before {
|
|
132
|
+
content: attr(data-line-number);
|
|
133
|
+
display: inline-block;
|
|
134
|
+
min-width: 2em;
|
|
135
|
+
padding-right: 0.8em;
|
|
136
|
+
text-align: right;
|
|
137
|
+
pointer-events: none;
|
|
138
|
+
user-select: none;
|
|
139
|
+
}
|
|
137
140
|
}
|
|
138
141
|
|
|
139
142
|
.highlighted {
|
|
140
143
|
background: var(--tag-basic-bg-color);
|
|
141
|
-
margin-left: calc(var(--spacing-sm) * -1);
|
|
142
|
-
padding-left: var(--spacing-sm);
|
|
143
|
-
|
|
144
|
-
&.error {
|
|
145
|
-
background: var(--color-raspberry-2);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
&.warning {
|
|
149
|
-
background: var(--color-carrot-2);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/*
|
|
154
|
-
* Shiki styles
|
|
155
|
-
*/
|
|
156
|
-
|
|
157
|
-
.line {
|
|
158
|
-
display: block;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
.has-diff {
|
|
162
|
-
> .line {
|
|
163
|
-
&:before {
|
|
164
|
-
content: ' ';
|
|
165
|
-
display: inline-block;
|
|
166
|
-
min-width: 1em;
|
|
167
|
-
padding-right: 0.4em;
|
|
168
|
-
text-align: right;
|
|
169
|
-
pointer-events: none;
|
|
170
|
-
user-select: none;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
.diff {
|
|
176
|
-
margin-left: calc(var(--spacing-sm) * -1);
|
|
177
|
-
padding-left: var(--spacing-sm);
|
|
178
|
-
|
|
179
|
-
&.add {
|
|
180
|
-
background: var(--color-grass-2);
|
|
181
|
-
&:before {
|
|
182
|
-
content: '+';
|
|
183
|
-
color: var(--color-grass-7);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
&.remove {
|
|
187
|
-
background: var(--color-raspberry-2);
|
|
188
|
-
|
|
189
|
-
&:before {
|
|
190
|
-
content: '-';
|
|
191
|
-
color: var(--color-raspberry-7);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
.highlighted-word {
|
|
197
|
-
background: var(--color-carrot-2);
|
|
198
|
-
border: 1px solid var(--color-carrot-5);
|
|
199
|
-
border-radius: 4px;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
.has-focused {
|
|
203
|
-
.line {
|
|
204
|
-
opacity: 0.7;
|
|
205
|
-
filter: blur(0.095rem);
|
|
206
|
-
transition:
|
|
207
|
-
filter 0.35s,
|
|
208
|
-
opacity 0.35s;
|
|
209
|
-
&.focused {
|
|
210
|
-
opacity: 1;
|
|
211
|
-
filter: blur(0);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
&:hover {
|
|
216
|
-
.line {
|
|
217
|
-
opacity: 1;
|
|
218
|
-
filter: blur(0);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
/*
|
|
224
|
-
* Tree view styles
|
|
225
|
-
*/
|
|
226
|
-
|
|
227
|
-
.tree-view-line {
|
|
228
|
-
display: flex;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
.tree-view-branch {
|
|
232
|
-
color: var(--code-block-tree-view-lines-color);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
.tree-view-file {
|
|
236
|
-
display: inline-flex;
|
|
237
|
-
&::before {
|
|
238
|
-
content: '\\ea01';
|
|
239
|
-
margin-right: 0.5rem;
|
|
240
|
-
font-family: 'TreeViewIcons';
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
&.no-file {
|
|
244
|
-
&::before {
|
|
245
|
-
content: '';
|
|
246
|
-
margin-right: 0;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
&.ext-folder {
|
|
251
|
-
&::before {
|
|
252
|
-
content: '\\ea02';
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
&.ext-img,
|
|
257
|
-
&.ext-png,
|
|
258
|
-
&.ext-jpg,
|
|
259
|
-
&.ext-jpeg,
|
|
260
|
-
&.ext-gif,
|
|
261
|
-
&.ext-svg {
|
|
262
|
-
&::before {
|
|
263
|
-
content: '\\ea03';
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
&.ext-mp2,
|
|
268
|
-
&.ext-mp3,
|
|
269
|
-
&.ext-wav,
|
|
270
|
-
&.ext-ogg,
|
|
271
|
-
&.ext-flac {
|
|
272
|
-
&::before {
|
|
273
|
-
content: '\\ea04';
|
|
274
|
-
margin-right: 0.5rem;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
&.ext-mp4,
|
|
279
|
-
&.ext-mkv,
|
|
280
|
-
&.ext-avi,
|
|
281
|
-
&.ext-mov,
|
|
282
|
-
&.ext-wmv,
|
|
283
|
-
&.ext-flv {
|
|
284
|
-
&::before {
|
|
285
|
-
content: '\\ea05';
|
|
286
|
-
margin-right: 0.5rem;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
&.ext-txt,
|
|
291
|
-
&.ext-text,
|
|
292
|
-
&.ext-md,
|
|
293
|
-
&.ext-markdown {
|
|
294
|
-
&::before {
|
|
295
|
-
content: '\\ea06';
|
|
296
|
-
margin-right: 0.5rem;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
&.ext-js,
|
|
301
|
-
&.ext-ts,
|
|
302
|
-
&.ext-jsx,
|
|
303
|
-
&.ext-tsx,
|
|
304
|
-
&.ext-json,
|
|
305
|
-
&.ext-yaml,
|
|
306
|
-
&.ext-yml,
|
|
307
|
-
&.ext-xml,
|
|
308
|
-
&.ext-html,
|
|
309
|
-
&.ext-css,
|
|
310
|
-
&.ext-scss,
|
|
311
|
-
&.ext-less,
|
|
312
|
-
&.ext-sass,
|
|
313
|
-
&.ext-java,
|
|
314
|
-
&.ext-c,
|
|
315
|
-
&.ext-cpp,
|
|
316
|
-
&.ext-cs,
|
|
317
|
-
&.ext-php,
|
|
318
|
-
&.ext-py,
|
|
319
|
-
&.ext-rb,
|
|
320
|
-
&.ext-go,
|
|
321
|
-
&.ext-swift,
|
|
322
|
-
&.ext-sql,
|
|
323
|
-
&.ext-perl,
|
|
324
|
-
&.ext-lua,
|
|
325
|
-
&.ext-scala,
|
|
326
|
-
&.ext-sh {
|
|
327
|
-
&::before {
|
|
328
|
-
content: '\\ea07';
|
|
329
|
-
margin-right: 0.5rem;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
&.ext-zip,
|
|
334
|
-
&.ext-rar,
|
|
335
|
-
&.ext-tar,
|
|
336
|
-
&.ext-gz,
|
|
337
|
-
&.ext-iso {
|
|
338
|
-
&::before {
|
|
339
|
-
content: '\\ea08';
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
&.ext-pdf,
|
|
344
|
-
&.ext-PDF {
|
|
345
|
-
&::before {
|
|
346
|
-
content: '\\ea09';
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
&.ext-excel,
|
|
351
|
-
&.ext-xls,
|
|
352
|
-
&.ext-xlsx {
|
|
353
|
-
&::before {
|
|
354
|
-
content: '\\ea0a';
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
&.ext-powerpoint,
|
|
359
|
-
&.ext-ppt,
|
|
360
|
-
&.ext-pptx {
|
|
361
|
-
&::before {
|
|
362
|
-
content: '\\ea0b';
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
&.ext-doc,
|
|
367
|
-
&.ext-docx,
|
|
368
|
-
&.ext-rtf {
|
|
369
|
-
&::before {
|
|
370
|
-
content: '\\ea0c';
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
144
|
}
|
|
374
145
|
|
|
375
146
|
${(0, utils_1.generateCodeBlockTokens)()}
|
|
376
147
|
|
|
377
148
|
${({ hideCodeColors }) => hideCodeColors &&
|
|
378
149
|
(0, styled_components_1.css) `
|
|
379
|
-
.line
|
|
380
|
-
.line
|
|
381
|
-
.line
|
|
150
|
+
.code-line:not(.highlighted),
|
|
151
|
+
.code-line:not(.highlighted) > span,
|
|
152
|
+
.code-line:not(.highlighted) > span > span {
|
|
382
153
|
color: grey;
|
|
383
154
|
}
|
|
384
155
|
`}
|
|
@@ -3,30 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.code = void 0;
|
|
4
4
|
const styled_components_1 = require("styled-components");
|
|
5
5
|
exports.code = (0, styled_components_1.css) `
|
|
6
|
-
/**
|
|
7
|
-
* Tree view icons font
|
|
8
|
-
*/
|
|
9
|
-
@font-face {
|
|
10
|
-
font-family: 'TreeViewIcons';
|
|
11
|
-
/**
|
|
12
|
-
* Use the following escape sequences to refer to a specific icon:
|
|
13
|
-
*
|
|
14
|
-
* - \\ea01 file
|
|
15
|
-
* - \\ea02 folder
|
|
16
|
-
* - \\ea03 image
|
|
17
|
-
* - \\ea04 audio
|
|
18
|
-
* - \\ea05 video
|
|
19
|
-
* - \\ea06 text
|
|
20
|
-
* - \\ea07 code
|
|
21
|
-
* - \\ea08 archive
|
|
22
|
-
* - \\ea09 pdf
|
|
23
|
-
* - \\ea0a excel
|
|
24
|
-
* - \\ea0b powerpoint
|
|
25
|
-
* - \\ea0c word
|
|
26
|
-
*/
|
|
27
|
-
src: url('data:application/font-woff;base64,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') format('woff');
|
|
28
|
-
}
|
|
29
|
-
|
|
30
6
|
/**
|
|
31
7
|
* @tokens Code base styles
|
|
32
8
|
*/
|
|
@@ -114,12 +90,6 @@ exports.code = (0, styled_components_1.css) `
|
|
|
114
90
|
--code-block-tokens-class-name-color: var(--color-carrot-7); // @presenter Color
|
|
115
91
|
--code-block-tokens-function-color: var(--color-carrot-7); // @presenter Color
|
|
116
92
|
|
|
117
|
-
/**
|
|
118
|
-
* @tokens Code Block tree view
|
|
119
|
-
*/
|
|
120
|
-
--code-block-tree-view-icon-font-family: 'TreeViewIcons'; // @presenter FontFamily
|
|
121
|
-
--code-block-tree-view-lines-color: var(--border-color-primary); // @presenter Color
|
|
122
|
-
|
|
123
93
|
// @tokens End
|
|
124
94
|
`;
|
|
125
95
|
//# sourceMappingURL=variables.js.map
|
|
@@ -36,6 +36,7 @@ const Sentiment_1 = require("../../components/Feedback/Sentiment");
|
|
|
36
36
|
const Comment_1 = require("../../components/Feedback/Comment");
|
|
37
37
|
const Mood_1 = require("../../components/Feedback/Mood");
|
|
38
38
|
const Scale_1 = require("../../components/Feedback/Scale");
|
|
39
|
+
const constants_1 = require("../../core/constants");
|
|
39
40
|
const feedbackComponents = {
|
|
40
41
|
rating: Rating_1.Rating,
|
|
41
42
|
sentiment: Sentiment_1.Sentiment,
|
|
@@ -50,7 +51,7 @@ function Feedback(props) {
|
|
|
50
51
|
const telemetry = useTelemetry();
|
|
51
52
|
const { pathname } = (0, react_router_dom_1.useLocation)();
|
|
52
53
|
const { feedback: themeFeedbackConf } = (0, hooks_1.useThemeConfig)();
|
|
53
|
-
const feedbackConf = Object.assign(Object.assign({}, themeFeedbackConf), { path: props === null || props === void 0 ? void 0 : props.path, type: (props === null || props === void 0 ? void 0 : props.type) || (themeFeedbackConf === null || themeFeedbackConf === void 0 ? void 0 : themeFeedbackConf.type), settings: (props === null || props === void 0 ? void 0 : props.settings) || (themeFeedbackConf === null || themeFeedbackConf === void 0 ? void 0 : themeFeedbackConf.settings) || {}, hide: (_a = props.hide) !== null && _a !== void 0 ? _a : themeFeedbackConf === null || themeFeedbackConf === void 0 ? void 0 : themeFeedbackConf.hide });
|
|
54
|
+
const feedbackConf = Object.assign(Object.assign({}, themeFeedbackConf), { path: props === null || props === void 0 ? void 0 : props.path, type: (props === null || props === void 0 ? void 0 : props.type) || (themeFeedbackConf === null || themeFeedbackConf === void 0 ? void 0 : themeFeedbackConf.type) || constants_1.DEFAULT_FEEDBACK_TYPE, settings: (props === null || props === void 0 ? void 0 : props.settings) || (themeFeedbackConf === null || themeFeedbackConf === void 0 ? void 0 : themeFeedbackConf.settings) || {}, hide: (_a = props.hide) !== null && _a !== void 0 ? _a : themeFeedbackConf === null || themeFeedbackConf === void 0 ? void 0 : themeFeedbackConf.hide });
|
|
54
55
|
if (feedbackConf.hide) {
|
|
55
56
|
return null;
|
|
56
57
|
}
|
|
@@ -10,6 +10,7 @@ const FilterInput_1 = require("../../components/Filter/FilterInput");
|
|
|
10
10
|
const hooks_1 = require("../../core/hooks");
|
|
11
11
|
const Button_1 = require("../../components/Button/Button");
|
|
12
12
|
const Filter_1 = require("../../components/Filter/Filter");
|
|
13
|
+
const utils_1 = require("../../core/utils");
|
|
13
14
|
function FilterContent({ setFilterTerm, filters, filterTerm, filterValuesCasing, }) {
|
|
14
15
|
const { useTranslate } = (0, hooks_1.useThemeHooks)();
|
|
15
16
|
const { translate } = useTranslate();
|
|
@@ -19,7 +20,9 @@ function FilterContent({ setFilterTerm, filters, filterTerm, filterValuesCasing,
|
|
|
19
20
|
if (filter.selectedOptions && filter.selectedOptions instanceof Set) {
|
|
20
21
|
return filter.selectedOptions.size;
|
|
21
22
|
}
|
|
22
|
-
else if (
|
|
23
|
+
else if ((0, utils_1.isFromToSelectedOptions)(filter.selectedOptions) &&
|
|
24
|
+
filter.selectedOptions.from &&
|
|
25
|
+
filter.selectedOptions.to) {
|
|
23
26
|
return true;
|
|
24
27
|
}
|
|
25
28
|
});
|
|
@@ -17,7 +17,7 @@ function FooterColumn({ column, className }) {
|
|
|
17
17
|
const iconsOnly = items.every((item) => item.label === item.link && (item.icon || item.srcSet));
|
|
18
18
|
const label = translate(column.labelTranslationKey, column.label);
|
|
19
19
|
return (react_1.default.createElement(FooterColumnWrapper, { "data-component-name": "Footer/FooterColumn", className: className },
|
|
20
|
-
react_1.default.createElement(FooterColumnTitle, null, column
|
|
20
|
+
react_1.default.createElement(FooterColumnTitle, null, (0, utils_1.isNavLinkItem)(column) ? (react_1.default.createElement(Link_1.Link, { to: column.link, external: column.external, target: column.target }, label)) : (label)),
|
|
21
21
|
react_1.default.createElement(FooterColumnItems, { iconsOnly: iconsOnly }, items === null || items === void 0 ? void 0 : items.map((columnItem, columnItemIndex) => (react_1.default.createElement(FooterItem_1.FooterItem, { item: columnItem, iconsOnly: iconsOnly, key: columnItemIndex }))))));
|
|
22
22
|
}
|
|
23
23
|
const FooterColumnWrapper = styled_components_1.default.div `
|
|
@@ -7,7 +7,7 @@ exports.markdown = (0, styled_components_1.css) `
|
|
|
7
7
|
* @tokens Markdown Content
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
--md-content-max-width:
|
|
10
|
+
--md-content-max-width: 688px;
|
|
11
11
|
--md-content-padding: 25px 0px 25px 0px; // @presenter Spacing
|
|
12
12
|
--md-content-font-size: var(--font-size-base); // @presenter FontSize
|
|
13
13
|
--md-content-font-family: var(--font-family-base); // @presenter FontFamily
|
|
@@ -58,7 +58,10 @@ function MenuMobile({ className, hideUserProfile }) {
|
|
|
58
58
|
return (react_1.default.createElement(MobileMenuWrapper, { "data-component-name": "Menu/MenuMobile", className: className },
|
|
59
59
|
react_1.default.createElement(ScrollableArea, { isButtonsSectionVisible: !!isButtonsSectionVisible },
|
|
60
60
|
isButtonsSectionVisible && (react_1.default.createElement(ButtonsSection, { alignRight: !prevLevelName && !!nextLevelName },
|
|
61
|
-
prevLevelName && (react_1.default.createElement(ControlButton, { "data-testid": "control-button", onClick: () =>
|
|
61
|
+
prevLevelName && (react_1.default.createElement(ControlButton, { "data-testid": "control-button", onClick: () => {
|
|
62
|
+
setMenuLevel(menuLevel - 1);
|
|
63
|
+
popDrilldownState();
|
|
64
|
+
} },
|
|
62
65
|
react_1.default.createElement(ChevronLeftIcon_1.ChevronLeftIcon, { size: "12px", color: "--tree-content-color-default" }),
|
|
63
66
|
react_1.default.createElement(ControlButtonLabel, { paddingDirection: "left" }, prevLevelName))),
|
|
64
67
|
nextLevelName && (react_1.default.createElement(ControlButton, { "data-testid": "control-button", onClick: () => setMenuLevel(menuLevel + 1) },
|
|
@@ -8,12 +8,12 @@ const react_1 = __importDefault(require("react"));
|
|
|
8
8
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
9
|
const Button_1 = require("../../components/Button/Button");
|
|
10
10
|
const ResetIcon_1 = require("../../icons/ResetIcon/ResetIcon");
|
|
11
|
-
const
|
|
11
|
+
const hooks_1 = require("../../core/hooks");
|
|
12
12
|
const SearchFilterFieldSelect_1 = require("../../components/Search/FilterFields/SearchFilterFieldSelect");
|
|
13
13
|
const SearchFilterFieldTags_1 = require("../../components/Search/FilterFields/SearchFilterFieldTags");
|
|
14
14
|
function SearchFilterField({ className, facet, filter, query, onFilterChange, onFacetReset, }) {
|
|
15
15
|
var _a;
|
|
16
|
-
const { useTranslate } = (0,
|
|
16
|
+
const { useTranslate } = (0, hooks_1.useThemeHooks)();
|
|
17
17
|
const { translate } = useTranslate();
|
|
18
18
|
const selectedValues = ((_a = filter.find((item) => item.field === facet.field)) === null || _a === void 0 ? void 0 : _a.values) || [];
|
|
19
19
|
const onChange = (value) => {
|
|
@@ -7,7 +7,7 @@ exports.LogoutMenuItem = LogoutMenuItem;
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const hooks_1 = require("../../core/hooks");
|
|
9
9
|
const LogoutIcon_1 = require("../../icons/LogoutIcon/LogoutIcon");
|
|
10
|
-
const DropdownMenuItem_1 = require("
|
|
10
|
+
const DropdownMenuItem_1 = require("../../components/Dropdown/DropdownMenuItem");
|
|
11
11
|
function LogoutMenuItem({ iconOnly, className }) {
|
|
12
12
|
const { useTranslate, useTelemetry, useUserMenu } = (0, hooks_1.useThemeHooks)();
|
|
13
13
|
const { handleLogout } = useUserMenu();
|
|
@@ -15,7 +15,7 @@ const UserAvatar_1 = require("../../components/UserMenu/UserAvatar");
|
|
|
15
15
|
const UserInfoMenuItem_1 = require("../../components/UserMenu/UserInfoMenuItem");
|
|
16
16
|
const Dropdown_1 = require("../../components/Dropdown/Dropdown");
|
|
17
17
|
const LogoutMenuItem_1 = require("../../components/UserMenu/LogoutMenuItem");
|
|
18
|
-
const
|
|
18
|
+
const utils_1 = require("../../core/utils");
|
|
19
19
|
function UserMenu({ className }) {
|
|
20
20
|
const { userMenu } = (0, hooks_1.useThemeConfig)();
|
|
21
21
|
const { useTranslate, useUserMenu } = (0, hooks_1.useThemeHooks)();
|
|
@@ -52,7 +52,7 @@ function UserMenu({ className }) {
|
|
|
52
52
|
const UserMenuWrapper = styled_components_1.default.div `
|
|
53
53
|
display: none;
|
|
54
54
|
|
|
55
|
-
@media screen and (min-width: ${
|
|
55
|
+
@media screen and (min-width: ${utils_1.breakpoints.medium}) {
|
|
56
56
|
display: block;
|
|
57
57
|
}
|
|
58
58
|
`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MobileMenuType = exports.MenuItemType = exports.FEEDBACK_TYPES = exports.DEFAULT_LOCALE_PLACEHOLDER = exports.REDOCLY_TEAMS_RBAC = void 0;
|
|
3
|
+
exports.MobileMenuType = exports.MenuItemType = exports.DEFAULT_FEEDBACK_TYPE = exports.FEEDBACK_TYPES = exports.DEFAULT_LOCALE_PLACEHOLDER = exports.REDOCLY_TEAMS_RBAC = void 0;
|
|
4
4
|
var config_1 = require("@redocly/config");
|
|
5
5
|
Object.defineProperty(exports, "REDOCLY_TEAMS_RBAC", { enumerable: true, get: function () { return config_1.REDOCLY_TEAMS_RBAC; } });
|
|
6
6
|
exports.DEFAULT_LOCALE_PLACEHOLDER = 'default_locale';
|
|
@@ -13,6 +13,7 @@ var FEEDBACK_TYPES;
|
|
|
13
13
|
FEEDBACK_TYPES["PROBLEM"] = "problem";
|
|
14
14
|
FEEDBACK_TYPES["SCALE"] = "scale";
|
|
15
15
|
})(FEEDBACK_TYPES || (exports.FEEDBACK_TYPES = FEEDBACK_TYPES = {}));
|
|
16
|
+
exports.DEFAULT_FEEDBACK_TYPE = FEEDBACK_TYPES.SENTIMENT;
|
|
16
17
|
var MenuItemType;
|
|
17
18
|
(function (MenuItemType) {
|
|
18
19
|
MenuItemType["Separator"] = "separator";
|
|
@@ -95,13 +95,6 @@ export type ThemeHooks = {
|
|
|
95
95
|
};
|
|
96
96
|
useUserTeams: () => string[];
|
|
97
97
|
usePageProps: <T extends Record<string, unknown>>() => PageProps & T;
|
|
98
|
-
useCodeHighlight: () => {
|
|
99
|
-
highlight: (code: string, language: string | undefined, { withLineNumbers, startLineNumber, }: {
|
|
100
|
-
withLineNumbers?: boolean;
|
|
101
|
-
startLineNumber?: number;
|
|
102
|
-
highlight?: string;
|
|
103
|
-
}) => string;
|
|
104
|
-
};
|
|
105
98
|
};
|
|
106
99
|
export type L10nConfig = {
|
|
107
100
|
currentLocale: string;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import 'prismjs/components/prism-bash.js';
|
|
2
|
+
import 'prismjs/components/prism-c.js';
|
|
3
|
+
import 'prismjs/components/prism-clike.js';
|
|
4
|
+
import 'prismjs/components/prism-coffeescript.js';
|
|
5
|
+
import 'prismjs/components/prism-cpp.js';
|
|
6
|
+
import 'prismjs/components/prism-csharp.js';
|
|
7
|
+
import 'prismjs/components/prism-go.js';
|
|
8
|
+
import 'prismjs/components/prism-http.js';
|
|
9
|
+
import 'prismjs/components/prism-java.js';
|
|
10
|
+
import 'prismjs/components/prism-lua.js';
|
|
11
|
+
import 'prismjs/components/prism-markdown.js';
|
|
12
|
+
import 'prismjs/components/prism-markup-templating.js';
|
|
13
|
+
import 'prismjs/components/prism-markup.js';
|
|
14
|
+
import 'prismjs/components/prism-objectivec.js';
|
|
15
|
+
import 'prismjs/components/prism-perl.js';
|
|
16
|
+
import 'prismjs/components/prism-php.js';
|
|
17
|
+
import 'prismjs/components/prism-python.js';
|
|
18
|
+
import 'prismjs/components/prism-ruby.js';
|
|
19
|
+
import 'prismjs/components/prism-scala.js';
|
|
20
|
+
import 'prismjs/components/prism-sql.js';
|
|
21
|
+
import 'prismjs/components/prism-swift.js';
|
|
22
|
+
import 'prismjs/components/prism-graphql.js';
|
|
23
|
+
import 'prismjs/plugins/treeview/prism-treeview.js';
|
|
24
|
+
/**
|
|
25
|
+
* map language names to Prism.js names
|
|
26
|
+
*/
|
|
27
|
+
export declare function mapLang(lang: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Highlight source code string using Prism.js
|
|
30
|
+
* @param source source code to highlight
|
|
31
|
+
* @param lang highlight language
|
|
32
|
+
* @return highlighted source code as **html string**
|
|
33
|
+
*/
|
|
34
|
+
export declare function highlight(source: string | number | boolean, lang?: string): string;
|
|
35
|
+
export declare function addLineNumbers(highlightedCode: string, start?: number): string;
|