@redocly/theme 0.45.2-rc.1 → 0.45.2
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/Filter/FilterContent.js +4 -1
- package/lib/components/Footer/FooterColumn.js +1 -1
- package/lib/components/Markdown/variables.js +1 -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/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/Filter/FilterContent.tsx +6 -1
- package/src/components/Footer/FooterColumn.tsx +2 -2
- package/src/components/Markdown/variables.ts +1 -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/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
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.mapLang = mapLang;
|
|
27
|
+
exports.highlight = highlight;
|
|
28
|
+
exports.addLineNumbers = addLineNumbers;
|
|
29
|
+
const Prism = __importStar(require("prismjs"));
|
|
30
|
+
require("prismjs/components/prism-bash.js");
|
|
31
|
+
require("prismjs/components/prism-c.js");
|
|
32
|
+
require("prismjs/components/prism-clike.js");
|
|
33
|
+
require("prismjs/components/prism-coffeescript.js");
|
|
34
|
+
require("prismjs/components/prism-cpp.js");
|
|
35
|
+
require("prismjs/components/prism-csharp.js");
|
|
36
|
+
require("prismjs/components/prism-go.js");
|
|
37
|
+
require("prismjs/components/prism-http.js");
|
|
38
|
+
require("prismjs/components/prism-java.js");
|
|
39
|
+
require("prismjs/components/prism-lua.js");
|
|
40
|
+
require("prismjs/components/prism-markdown.js");
|
|
41
|
+
require("prismjs/components/prism-markup-templating.js"); // dep of php
|
|
42
|
+
require("prismjs/components/prism-markup.js"); // xml
|
|
43
|
+
require("prismjs/components/prism-objectivec.js");
|
|
44
|
+
require("prismjs/components/prism-perl.js");
|
|
45
|
+
require("prismjs/components/prism-php.js");
|
|
46
|
+
require("prismjs/components/prism-python.js");
|
|
47
|
+
require("prismjs/components/prism-ruby.js");
|
|
48
|
+
require("prismjs/components/prism-scala.js");
|
|
49
|
+
require("prismjs/components/prism-sql.js");
|
|
50
|
+
require("prismjs/components/prism-swift.js");
|
|
51
|
+
require("prismjs/components/prism-graphql.js");
|
|
52
|
+
require("prismjs/plugins/treeview/prism-treeview.js");
|
|
53
|
+
const DEFAULT_LANG = 'clike';
|
|
54
|
+
const NEW_LINE_EXP = /\n(?!$)/g;
|
|
55
|
+
Prism.languages.insertBefore('javascript', 'string', {
|
|
56
|
+
'property string': {
|
|
57
|
+
pattern: /([{,]\s*)"(?:\\.|[^\\"\r\n])*"(?=\s*:)/i,
|
|
58
|
+
lookbehind: true,
|
|
59
|
+
},
|
|
60
|
+
}, undefined);
|
|
61
|
+
Prism.languages.insertBefore('javascript', 'punctuation', {
|
|
62
|
+
property: {
|
|
63
|
+
pattern: /([{,]\s*)[a-z]\w*(?=\s*:)/i,
|
|
64
|
+
lookbehind: true,
|
|
65
|
+
},
|
|
66
|
+
}, undefined);
|
|
67
|
+
Prism.languages.markdoc = Object.assign(Object.assign({}, Prism.languages.markdown), { tag: {
|
|
68
|
+
pattern: /{%(.|\n)*?%}/i,
|
|
69
|
+
inside: {
|
|
70
|
+
keyword: {
|
|
71
|
+
pattern: /^({%\s*\/?)(\w*|-)*\b/i,
|
|
72
|
+
lookbehind: true,
|
|
73
|
+
},
|
|
74
|
+
id: /#(\w|-)*\b/,
|
|
75
|
+
string: /".*?"/,
|
|
76
|
+
equals: /=/,
|
|
77
|
+
number: /\b\d+\b/i,
|
|
78
|
+
variable: {
|
|
79
|
+
pattern: /\$[\w.]+/i,
|
|
80
|
+
inside: {
|
|
81
|
+
punctuation: /\./i,
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
function: /\b\w+(?=\()/,
|
|
85
|
+
punctuation: /({%|\/?%})/i,
|
|
86
|
+
boolean: /false|true/,
|
|
87
|
+
},
|
|
88
|
+
}, variable: {
|
|
89
|
+
pattern: /\$\w+/i,
|
|
90
|
+
}, function: {
|
|
91
|
+
pattern: /\b\w+(?=\()/i,
|
|
92
|
+
} });
|
|
93
|
+
/**
|
|
94
|
+
* map language names to Prism.js names
|
|
95
|
+
*/
|
|
96
|
+
function mapLang(lang) {
|
|
97
|
+
return ({
|
|
98
|
+
json: 'js',
|
|
99
|
+
'c++': 'cpp',
|
|
100
|
+
'c#': 'csharp',
|
|
101
|
+
'c#+newtonsoft': 'csharp',
|
|
102
|
+
'java8+apache': 'java',
|
|
103
|
+
'objective-c': 'objectivec',
|
|
104
|
+
shell: 'bash',
|
|
105
|
+
viml: 'vim',
|
|
106
|
+
curl: 'bash',
|
|
107
|
+
'node.js': 'js',
|
|
108
|
+
}[lang] || DEFAULT_LANG);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Highlight source code string using Prism.js
|
|
112
|
+
* @param source source code to highlight
|
|
113
|
+
* @param lang highlight language
|
|
114
|
+
* @return highlighted source code as **html string**
|
|
115
|
+
*/
|
|
116
|
+
function highlight(source, lang = DEFAULT_LANG) {
|
|
117
|
+
lang = lang.toLowerCase();
|
|
118
|
+
const grammar = Prism.languages[lang] || Prism.languages[mapLang(lang)];
|
|
119
|
+
return Prism.highlight(source.toString(), grammar, lang);
|
|
120
|
+
}
|
|
121
|
+
function addLineNumbers(highlightedCode, start = 1) {
|
|
122
|
+
const codeLines = highlightedCode.split(NEW_LINE_EXP);
|
|
123
|
+
return codeLines
|
|
124
|
+
.map((line, i) => {
|
|
125
|
+
return `<span class="code-line" data-line-number=${start + i}>${line}</span>`;
|
|
126
|
+
})
|
|
127
|
+
.join('\n');
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=highlight.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from '../../core/utils/clipboard-service';
|
|
2
2
|
export * from '../../core/utils/css-variables';
|
|
3
|
-
export * from '../../core/utils/
|
|
3
|
+
export * from '../../core/utils/highlight';
|
|
4
4
|
export * from '../../core/utils/media-css';
|
|
5
5
|
export * from '../../core/utils/theme-helpers';
|
|
6
6
|
export * from '../../core/utils/class-names';
|
package/lib/core/utils/index.js
CHANGED
|
@@ -16,7 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("../../core/utils/clipboard-service"), exports);
|
|
18
18
|
__exportStar(require("../../core/utils/css-variables"), exports);
|
|
19
|
-
__exportStar(require("../../core/utils/
|
|
19
|
+
__exportStar(require("../../core/utils/highlight"), exports);
|
|
20
20
|
__exportStar(require("../../core/utils/media-css"), exports);
|
|
21
21
|
__exportStar(require("../../core/utils/theme-helpers"), exports);
|
|
22
22
|
__exportStar(require("../../core/utils/class-names"), exports);
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
import { ResolvedNavItem, ResolvedNavLinkItem } from '@redocly/config';
|
|
1
2
|
export declare function isUndefined<T>(value: T | undefined): value is undefined;
|
|
2
3
|
export declare function isNull<T>(value: T | null): value is null;
|
|
3
4
|
export declare function isString<T>(value: T | string): value is string;
|
|
4
5
|
export declare function isNotNull<T>(value: T): value is NonNullable<T>;
|
|
5
6
|
export declare const isObject: (item: unknown) => item is object;
|
|
7
|
+
export declare const isNavLinkItem: (item: ResolvedNavItem) => item is ResolvedNavLinkItem;
|
|
8
|
+
export declare const isFromToSelectedOptions: (options: unknown) => options is {
|
|
9
|
+
from: string;
|
|
10
|
+
to: string;
|
|
11
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isObject = void 0;
|
|
3
|
+
exports.isFromToSelectedOptions = exports.isNavLinkItem = exports.isObject = void 0;
|
|
4
4
|
exports.isUndefined = isUndefined;
|
|
5
5
|
exports.isNull = isNull;
|
|
6
6
|
exports.isString = isString;
|
|
@@ -21,4 +21,12 @@ const isObject = (item) => {
|
|
|
21
21
|
return isNotNull(item) && typeof item === 'object';
|
|
22
22
|
};
|
|
23
23
|
exports.isObject = isObject;
|
|
24
|
+
const isNavLinkItem = (item) => {
|
|
25
|
+
return item.link !== undefined;
|
|
26
|
+
};
|
|
27
|
+
exports.isNavLinkItem = isNavLinkItem;
|
|
28
|
+
const isFromToSelectedOptions = (options) => {
|
|
29
|
+
return (0, exports.isObject)(options) && 'from' in options && 'to' in options;
|
|
30
|
+
};
|
|
31
|
+
exports.isFromToSelectedOptions = isFromToSelectedOptions;
|
|
24
32
|
//# sourceMappingURL=type-guards.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/theme",
|
|
3
|
-
"version": "0.45.2
|
|
3
|
+
"version": "0.45.2",
|
|
4
4
|
"description": "Shared UI components lib",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"theme",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"@markdoc/markdoc": "0.4.0",
|
|
29
29
|
"lodash.throttle": "^4.1.1",
|
|
30
|
+
"prismjs": "^1.28.0",
|
|
30
31
|
"react": "^17.0.0 || ^18.0.0",
|
|
31
32
|
"react-dom": "^17.0.0 || ^18.0.0",
|
|
32
33
|
"react-router-dom": "^6.21.1",
|
|
@@ -43,6 +44,7 @@
|
|
|
43
44
|
"@types/jest-when": "3.5.5",
|
|
44
45
|
"@types/lodash.throttle": "4.1.9",
|
|
45
46
|
"@types/node": "18.19.3",
|
|
47
|
+
"@types/prismjs": "1.26.4",
|
|
46
48
|
"@types/react": "18.3.9",
|
|
47
49
|
"@types/react-dom": "18.2.25",
|
|
48
50
|
"@types/styled-components": "5.1.34",
|
|
@@ -4,8 +4,8 @@ import styled from 'styled-components';
|
|
|
4
4
|
import type { CodeBlockControlsProps } from '@redocly/theme/components/CodeBlock/CodeBlockControls';
|
|
5
5
|
import type { ReportDialogProps } from '@redocly/theme/components/Feedback/ReportDialog';
|
|
6
6
|
|
|
7
|
-
import { addLineNumbers } from '@redocly/theme/core/utils';
|
|
8
|
-
import { useModalScrollLock, useReportDialog
|
|
7
|
+
import { highlight, addLineNumbers } from '@redocly/theme/core/utils';
|
|
8
|
+
import { useModalScrollLock, useReportDialog } from '@redocly/theme/core/hooks';
|
|
9
9
|
import { ReportDialog } from '@redocly/theme/components/Feedback/ReportDialog';
|
|
10
10
|
import { CodeBlockContainer } from '@redocly/theme/components/CodeBlock/CodeBlockContainer';
|
|
11
11
|
import { CodeBlockControls } from '@redocly/theme/components/CodeBlock/CodeBlockControls';
|
|
@@ -26,7 +26,6 @@ export type CodeBlockProps = {
|
|
|
26
26
|
codeBlockMaxHeight?: string;
|
|
27
27
|
hideCodeColors?: boolean;
|
|
28
28
|
wrapContents?: boolean;
|
|
29
|
-
[key: string]: unknown;
|
|
30
29
|
};
|
|
31
30
|
|
|
32
31
|
type UnstableExternalCodeSample = {
|
|
@@ -65,25 +64,12 @@ export function CodeBlock({
|
|
|
65
64
|
hideCodeColors,
|
|
66
65
|
wrapContents = false,
|
|
67
66
|
children,
|
|
68
|
-
...rest
|
|
69
67
|
}: React.PropsWithChildren<CodeBlockProps>): JSX.Element {
|
|
70
68
|
const [sourceCode, setSourceCode] = useState<string>(
|
|
71
69
|
(source || externalSource?.sample?.get?.(externalSource)) ?? '',
|
|
72
70
|
);
|
|
73
|
-
const { useCodeHighlight } = useThemeHooks();
|
|
74
|
-
const { highlight } = useCodeHighlight() || {};
|
|
75
71
|
|
|
76
|
-
const highlightedCode = highlightedHtml
|
|
77
|
-
? withLineNumbers
|
|
78
|
-
? addLineNumbers(highlightedHtml, startLineNumber)
|
|
79
|
-
: highlightedHtml
|
|
80
|
-
: children
|
|
81
|
-
? null
|
|
82
|
-
: highlight?.(sourceCode, lang, {
|
|
83
|
-
withLineNumbers,
|
|
84
|
-
startLineNumber,
|
|
85
|
-
highlight: rest['data-highlight'] as string | undefined,
|
|
86
|
-
});
|
|
72
|
+
const highlightedCode = highlightedHtml || (children ? null : highlight(sourceCode, lang));
|
|
87
73
|
|
|
88
74
|
// The same initial value should be returned for ssr and frontend to avoid issues
|
|
89
75
|
// Because we don't have session storage in ssr and can't get the security details there
|
|
@@ -116,11 +102,13 @@ export function CodeBlock({
|
|
|
116
102
|
/>
|
|
117
103
|
<CodeBlockContainer
|
|
118
104
|
ref={codeBlockRef}
|
|
119
|
-
|
|
105
|
+
className={withLineNumbers ? 'line-numbers' : ''}
|
|
120
106
|
dangerouslySetInnerHTML={
|
|
121
107
|
highlightedCode
|
|
122
108
|
? {
|
|
123
|
-
__html:
|
|
109
|
+
__html: withLineNumbers
|
|
110
|
+
? addLineNumbers(highlightedCode, startLineNumber)
|
|
111
|
+
: highlightedCode,
|
|
124
112
|
}
|
|
125
113
|
: undefined
|
|
126
114
|
}
|
|
@@ -8,7 +8,7 @@ export type CodeBlockContainerProps = PropsWithChildren<{
|
|
|
8
8
|
maxHeight?: string;
|
|
9
9
|
wrapContents?: boolean;
|
|
10
10
|
ref?: (instance: HTMLPreElement | null) => void;
|
|
11
|
-
|
|
11
|
+
className?: string;
|
|
12
12
|
dangerouslySetInnerHTML?: {
|
|
13
13
|
__html: string;
|
|
14
14
|
};
|
|
@@ -117,249 +117,20 @@ const CodeBlockContainerComponent = styled.pre<CodeBlockContainerProps>`
|
|
|
117
117
|
cursor: help;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
.line
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
120
|
+
.code-line {
|
|
121
|
+
&:before {
|
|
122
|
+
content: attr(data-line-number);
|
|
123
|
+
display: inline-block;
|
|
124
|
+
min-width: 2em;
|
|
125
|
+
padding-right: 0.8em;
|
|
126
|
+
text-align: right;
|
|
127
|
+
pointer-events: none;
|
|
128
|
+
user-select: none;
|
|
129
|
+
}
|
|
127
130
|
}
|
|
128
131
|
|
|
129
132
|
.highlighted {
|
|
130
133
|
background: var(--tag-basic-bg-color);
|
|
131
|
-
margin-left: calc(var(--spacing-sm) * -1);
|
|
132
|
-
padding-left: var(--spacing-sm);
|
|
133
|
-
|
|
134
|
-
&.error {
|
|
135
|
-
background: var(--color-raspberry-2);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
&.warning {
|
|
139
|
-
background: var(--color-carrot-2);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/*
|
|
144
|
-
* Shiki styles
|
|
145
|
-
*/
|
|
146
|
-
|
|
147
|
-
.line {
|
|
148
|
-
display: block;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
.has-diff {
|
|
152
|
-
> .line {
|
|
153
|
-
&:before {
|
|
154
|
-
content: ' ';
|
|
155
|
-
display: inline-block;
|
|
156
|
-
min-width: 1em;
|
|
157
|
-
padding-right: 0.4em;
|
|
158
|
-
text-align: right;
|
|
159
|
-
pointer-events: none;
|
|
160
|
-
user-select: none;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
.diff {
|
|
166
|
-
margin-left: calc(var(--spacing-sm) * -1);
|
|
167
|
-
padding-left: var(--spacing-sm);
|
|
168
|
-
|
|
169
|
-
&.add {
|
|
170
|
-
background: var(--color-grass-2);
|
|
171
|
-
&:before {
|
|
172
|
-
content: '+';
|
|
173
|
-
color: var(--color-grass-7);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
&.remove {
|
|
177
|
-
background: var(--color-raspberry-2);
|
|
178
|
-
|
|
179
|
-
&:before {
|
|
180
|
-
content: '-';
|
|
181
|
-
color: var(--color-raspberry-7);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
.highlighted-word {
|
|
187
|
-
background: var(--color-carrot-2);
|
|
188
|
-
border: 1px solid var(--color-carrot-5);
|
|
189
|
-
border-radius: 4px;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
.has-focused {
|
|
193
|
-
.line {
|
|
194
|
-
opacity: 0.7;
|
|
195
|
-
filter: blur(0.095rem);
|
|
196
|
-
transition:
|
|
197
|
-
filter 0.35s,
|
|
198
|
-
opacity 0.35s;
|
|
199
|
-
&.focused {
|
|
200
|
-
opacity: 1;
|
|
201
|
-
filter: blur(0);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
&:hover {
|
|
206
|
-
.line {
|
|
207
|
-
opacity: 1;
|
|
208
|
-
filter: blur(0);
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/*
|
|
214
|
-
* Tree view styles
|
|
215
|
-
*/
|
|
216
|
-
|
|
217
|
-
.tree-view-line {
|
|
218
|
-
display: flex;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
.tree-view-branch {
|
|
222
|
-
color: var(--code-block-tree-view-lines-color);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
.tree-view-file {
|
|
226
|
-
display: inline-flex;
|
|
227
|
-
&::before {
|
|
228
|
-
content: '\\ea01';
|
|
229
|
-
margin-right: 0.5rem;
|
|
230
|
-
font-family: 'TreeViewIcons';
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
&.no-file {
|
|
234
|
-
&::before {
|
|
235
|
-
content: '';
|
|
236
|
-
margin-right: 0;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
&.ext-folder {
|
|
241
|
-
&::before {
|
|
242
|
-
content: '\\ea02';
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
&.ext-img,
|
|
247
|
-
&.ext-png,
|
|
248
|
-
&.ext-jpg,
|
|
249
|
-
&.ext-jpeg,
|
|
250
|
-
&.ext-gif,
|
|
251
|
-
&.ext-svg {
|
|
252
|
-
&::before {
|
|
253
|
-
content: '\\ea03';
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
&.ext-mp2,
|
|
258
|
-
&.ext-mp3,
|
|
259
|
-
&.ext-wav,
|
|
260
|
-
&.ext-ogg,
|
|
261
|
-
&.ext-flac {
|
|
262
|
-
&::before {
|
|
263
|
-
content: '\\ea04';
|
|
264
|
-
margin-right: 0.5rem;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
&.ext-mp4,
|
|
269
|
-
&.ext-mkv,
|
|
270
|
-
&.ext-avi,
|
|
271
|
-
&.ext-mov,
|
|
272
|
-
&.ext-wmv,
|
|
273
|
-
&.ext-flv {
|
|
274
|
-
&::before {
|
|
275
|
-
content: '\\ea05';
|
|
276
|
-
margin-right: 0.5rem;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
&.ext-txt,
|
|
281
|
-
&.ext-text,
|
|
282
|
-
&.ext-md,
|
|
283
|
-
&.ext-markdown {
|
|
284
|
-
&::before {
|
|
285
|
-
content: '\\ea06';
|
|
286
|
-
margin-right: 0.5rem;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
&.ext-js,
|
|
291
|
-
&.ext-ts,
|
|
292
|
-
&.ext-jsx,
|
|
293
|
-
&.ext-tsx,
|
|
294
|
-
&.ext-json,
|
|
295
|
-
&.ext-yaml,
|
|
296
|
-
&.ext-yml,
|
|
297
|
-
&.ext-xml,
|
|
298
|
-
&.ext-html,
|
|
299
|
-
&.ext-css,
|
|
300
|
-
&.ext-scss,
|
|
301
|
-
&.ext-less,
|
|
302
|
-
&.ext-sass,
|
|
303
|
-
&.ext-java,
|
|
304
|
-
&.ext-c,
|
|
305
|
-
&.ext-cpp,
|
|
306
|
-
&.ext-cs,
|
|
307
|
-
&.ext-php,
|
|
308
|
-
&.ext-py,
|
|
309
|
-
&.ext-rb,
|
|
310
|
-
&.ext-go,
|
|
311
|
-
&.ext-swift,
|
|
312
|
-
&.ext-sql,
|
|
313
|
-
&.ext-perl,
|
|
314
|
-
&.ext-lua,
|
|
315
|
-
&.ext-scala,
|
|
316
|
-
&.ext-sh {
|
|
317
|
-
&::before {
|
|
318
|
-
content: '\\ea07';
|
|
319
|
-
margin-right: 0.5rem;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
&.ext-zip,
|
|
324
|
-
&.ext-rar,
|
|
325
|
-
&.ext-tar,
|
|
326
|
-
&.ext-gz,
|
|
327
|
-
&.ext-iso {
|
|
328
|
-
&::before {
|
|
329
|
-
content: '\\ea08';
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
&.ext-pdf,
|
|
334
|
-
&.ext-PDF {
|
|
335
|
-
&::before {
|
|
336
|
-
content: '\\ea09';
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
&.ext-excel,
|
|
341
|
-
&.ext-xls,
|
|
342
|
-
&.ext-xlsx {
|
|
343
|
-
&::before {
|
|
344
|
-
content: '\\ea0a';
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
&.ext-powerpoint,
|
|
349
|
-
&.ext-ppt,
|
|
350
|
-
&.ext-pptx {
|
|
351
|
-
&::before {
|
|
352
|
-
content: '\\ea0b';
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
&.ext-doc,
|
|
357
|
-
&.ext-docx,
|
|
358
|
-
&.ext-rtf {
|
|
359
|
-
&::before {
|
|
360
|
-
content: '\\ea0c';
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
134
|
}
|
|
364
135
|
|
|
365
136
|
${generateCodeBlockTokens()}
|
|
@@ -367,9 +138,9 @@ const CodeBlockContainerComponent = styled.pre<CodeBlockContainerProps>`
|
|
|
367
138
|
${({ hideCodeColors }) =>
|
|
368
139
|
hideCodeColors &&
|
|
369
140
|
css`
|
|
370
|
-
.line
|
|
371
|
-
.line
|
|
372
|
-
.line
|
|
141
|
+
.code-line:not(.highlighted),
|
|
142
|
+
.code-line:not(.highlighted) > span,
|
|
143
|
+
.code-line:not(.highlighted) > span > span {
|
|
373
144
|
color: grey;
|
|
374
145
|
}
|
|
375
146
|
`}
|
|
@@ -1,30 +1,6 @@
|
|
|
1
1
|
import { css } from 'styled-components';
|
|
2
2
|
|
|
3
3
|
export const code = css`
|
|
4
|
-
/**
|
|
5
|
-
* Tree view icons font
|
|
6
|
-
*/
|
|
7
|
-
@font-face {
|
|
8
|
-
font-family: 'TreeViewIcons';
|
|
9
|
-
/**
|
|
10
|
-
* Use the following escape sequences to refer to a specific icon:
|
|
11
|
-
*
|
|
12
|
-
* - \\ea01 file
|
|
13
|
-
* - \\ea02 folder
|
|
14
|
-
* - \\ea03 image
|
|
15
|
-
* - \\ea04 audio
|
|
16
|
-
* - \\ea05 video
|
|
17
|
-
* - \\ea06 text
|
|
18
|
-
* - \\ea07 code
|
|
19
|
-
* - \\ea08 archive
|
|
20
|
-
* - \\ea09 pdf
|
|
21
|
-
* - \\ea0a excel
|
|
22
|
-
* - \\ea0b powerpoint
|
|
23
|
-
* - \\ea0c word
|
|
24
|
-
*/
|
|
25
|
-
src: url('data:application/font-woff;base64,d09GRgABAAAAAAgYAAsAAAAAEGAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADsAAABUIIslek9TLzIAAAFEAAAAPwAAAFY1UkH9Y21hcAAAAYQAAAB/AAACCtvO7yxnbHlmAAACBAAAA+MAAAlACm1V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+6riLF0wc93CHN27wWtdUHvHuuIFbfDhuUv903CKfHbfxgC/HHerfjrtYen3HPTx7ambiIl0YKQ+xPM5ltE9CU9NqxVKaItaZGPqDmj6VmTShlRuxOoniEI2sVUIZnYqJzqxMEi1yo3dybf2ttfk4CJTT/bVOMYNBjAIpFiTJOLCWOGLOHGGPBCE7l32XO0tmw04MjQwCQ7774B//lDmrZkJY3hvOrHBiLuiJMKJqoVgrejQ3CP5Yubt0JwxNJa96Oypr6j621VSOMQKG+uP36eKmHylcb0MAeJxtwdEOgjAMBdBeWEFR/Mdl7bTJtMsygc/nwVfPoYF+QP+tGDAigDFhxgVXLLjhjhUPCtmKTtmLaGN7x6dy/Io5bybqoevRQ3LRObb0sk3HKpn1SFqW6ru26vbpYfcmRCccJhqsAAA=') format('woff');
|
|
26
|
-
}
|
|
27
|
-
|
|
28
4
|
/**
|
|
29
5
|
* @tokens Code base styles
|
|
30
6
|
*/
|
|
@@ -112,11 +88,5 @@ export const code = css`
|
|
|
112
88
|
--code-block-tokens-class-name-color: var(--color-carrot-7); // @presenter Color
|
|
113
89
|
--code-block-tokens-function-color: var(--color-carrot-7); // @presenter Color
|
|
114
90
|
|
|
115
|
-
/**
|
|
116
|
-
* @tokens Code Block tree view
|
|
117
|
-
*/
|
|
118
|
-
--code-block-tree-view-icon-font-family: 'TreeViewIcons'; // @presenter FontFamily
|
|
119
|
-
--code-block-tree-view-lines-color: var(--border-color-primary); // @presenter Color
|
|
120
|
-
|
|
121
91
|
// @tokens End
|
|
122
92
|
`;
|
|
@@ -8,6 +8,7 @@ import { FilterInput } from '@redocly/theme/components/Filter/FilterInput';
|
|
|
8
8
|
import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
9
9
|
import { Button } from '@redocly/theme/components/Button/Button';
|
|
10
10
|
import { Filter } from '@redocly/theme/components/Filter/Filter';
|
|
11
|
+
import { isFromToSelectedOptions } from '@redocly/theme/core/utils';
|
|
11
12
|
|
|
12
13
|
export type FilterContentProps = {
|
|
13
14
|
setFilterTerm: (value: string) => void;
|
|
@@ -29,7 +30,11 @@ export function FilterContent({
|
|
|
29
30
|
if (filterTerm) return true;
|
|
30
31
|
if (filter.selectedOptions && filter.selectedOptions instanceof Set) {
|
|
31
32
|
return filter.selectedOptions.size;
|
|
32
|
-
} else if (
|
|
33
|
+
} else if (
|
|
34
|
+
isFromToSelectedOptions(filter.selectedOptions) &&
|
|
35
|
+
filter.selectedOptions.from &&
|
|
36
|
+
filter.selectedOptions.to
|
|
37
|
+
) {
|
|
33
38
|
return true;
|
|
34
39
|
}
|
|
35
40
|
});
|
|
@@ -4,7 +4,7 @@ import styled from 'styled-components';
|
|
|
4
4
|
import type { ResolvedNavItem } from '@redocly/config';
|
|
5
5
|
|
|
6
6
|
import { FooterItem } from '@redocly/theme/components/Footer/FooterItem';
|
|
7
|
-
import { breakpoints } from '@redocly/theme/core/utils';
|
|
7
|
+
import { breakpoints, isNavLinkItem } from '@redocly/theme/core/utils';
|
|
8
8
|
import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
9
9
|
import { Link } from '@redocly/theme/components/Link/Link';
|
|
10
10
|
|
|
@@ -24,7 +24,7 @@ export function FooterColumn({ column, className }: FooterColumnProps): JSX.Elem
|
|
|
24
24
|
return (
|
|
25
25
|
<FooterColumnWrapper data-component-name="Footer/FooterColumn" className={className}>
|
|
26
26
|
<FooterColumnTitle>
|
|
27
|
-
{column
|
|
27
|
+
{isNavLinkItem(column) ? (
|
|
28
28
|
<Link to={column.link} external={column.external} target={column.target}>
|
|
29
29
|
{label}
|
|
30
30
|
</Link>
|
|
@@ -5,7 +5,7 @@ export const markdown = css`
|
|
|
5
5
|
* @tokens Markdown Content
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
--md-content-max-width:
|
|
8
|
+
--md-content-max-width: 688px;
|
|
9
9
|
--md-content-padding: 25px 0px 25px 0px; // @presenter Spacing
|
|
10
10
|
--md-content-font-size: var(--font-size-base); // @presenter FontSize
|
|
11
11
|
--md-content-font-family: var(--font-family-base); // @presenter FontFamily
|
|
@@ -5,7 +5,7 @@ import type { SearchFacet, SearchFilterItem } from '@redocly/theme/core/types';
|
|
|
5
5
|
|
|
6
6
|
import { Button } from '@redocly/theme/components/Button/Button';
|
|
7
7
|
import { ResetIcon } from '@redocly/theme/icons/ResetIcon/ResetIcon';
|
|
8
|
-
import { useThemeHooks } from '@redocly/theme/core';
|
|
8
|
+
import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
9
9
|
import { SearchFilterFieldSelect } from '@redocly/theme/components/Search/FilterFields/SearchFilterFieldSelect';
|
|
10
10
|
import { SearchFilterFieldTags } from '@redocly/theme/components/Search/FilterFields/SearchFilterFieldTags';
|
|
11
11
|
|
|
@@ -2,8 +2,7 @@ import React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
4
4
|
import { LogoutIcon } from '@redocly/theme/icons/LogoutIcon/LogoutIcon';
|
|
5
|
-
|
|
6
|
-
import { DropdownMenuItem } from '../Dropdown/DropdownMenuItem';
|
|
5
|
+
import { DropdownMenuItem } from '@redocly/theme/components/Dropdown/DropdownMenuItem';
|
|
7
6
|
|
|
8
7
|
export type LogoutMenuItemProps = {
|
|
9
8
|
iconOnly?: boolean;
|
|
@@ -12,7 +12,7 @@ import { UserAvatar } from '@redocly/theme/components/UserMenu/UserAvatar';
|
|
|
12
12
|
import { UserInfoMenuItem } from '@redocly/theme/components/UserMenu/UserInfoMenuItem';
|
|
13
13
|
import { Dropdown } from '@redocly/theme/components/Dropdown/Dropdown';
|
|
14
14
|
import { LogoutMenuItem } from '@redocly/theme/components/UserMenu/LogoutMenuItem';
|
|
15
|
-
import { breakpoints } from '@redocly/theme/core';
|
|
15
|
+
import { breakpoints } from '@redocly/theme/core/utils';
|
|
16
16
|
|
|
17
17
|
export type UserMenuProps = {
|
|
18
18
|
className?: string;
|